These docs cover 0.2.0-beta.26. Each guide distinguishes supported beta behavior, explicit deployment boundaries, and retained 0.1 compatibility material.

Browse documentationAll guides

Reference · presolve

Framework API

The presolve package is the application authoring vocabulary (an npm alias for @presolve/framework). Its V2 calls are compiler intrinsics, not a browser component registry, state store, effect scheduler, or renderer.

Canonical 0.2 imports

import {action, defineForm, effect, field,loader, required, slot, state,Component, environment, type Resource,type RouteParameters, type SlotContent,} from "presolve";
Component<Props = {}>

Base class for an authored component. Export a concrete subclass with one instance render() method. The generic is a type surface; instance input fields remain compiler-resolved.

Component guide →
state<T>(initialValue: T): T

Declares component-owned reactive state initialized from a compiler-admitted value. Read the field normally; mutate it only from an admitted action.

State guide →
action(handler)

Declares an instance-field action and preserves its component receiver. The beta admits documented state writes, typed primitive parameters, serializable local literals, exact event captures, and closed named-import terminal package calls with synchronous or cancellable Promise<void> completion.

Action guide →
get value()

A synchronous pure getter is a computed candidate. The compiler derives dependencies, caching, and invalidation. New beta source does not call computed().

Computed guide →
effect(handler)

Declares synchronous terminal browser work. The handler may return compiler-admitted cleanup. Effects cannot write reactive state or call actions/effects.

Effect guide →
slot(): SlotContent

Initializes a default or named slot field. children is the default slot; other field names map to named outlets.

Slot guide →
defineForm({ fields, submit })

Declares a component-owned Form, typed nested value shape, optional serialization, validation, native submission, and resume membership.

Form guide →
field({ initial, validate? })

Declares one statically recoverable Field. Bind it with bind:value, bind:checked, or bind:files according to its value class.

Field bindings →
required · min · max · minLength · maxLength · pattern · email

Creates a built-in validation rule. A directly imported Standard Schema v1 validator may also participate when TypeScript authority resolves its exact export.

Validation guide →
equals(field) · notEquals(field)

Creates a compiler-bound cross-Field validation rule. The argument must resolve to another Field in the same canonical Form tree.

Cross-Field validation →
loader<Data, Error>(handler): Resource<Data, Error>

Declares a route-owned server Resource. The canonical handler receives RouteParameters and AbortSignal and consists of one direct call to an admitted named package import.

Loader guide →
environment.public(name): string

Reads a manifest-backed public value admitted under the PRESOLVE_PUBLIC_* naming boundary. A same-shaped local object does not acquire compiler authority.

Environment boundary →

Core types

TypeMeaning
SlotContentOpaque compiler-owned slot content marker.
DefinedForm<Fields>Typed Form with aggregate pristine, dirty, touched, submitting, submitted, valid, and issues state.
FormField<Value>Owned value plus pristine, dirty, touched, valid, and issues state.
FormFieldTreeA Field, nested object of Fields, or readonly Field-tree array accepted by defineForm.
FormValue<Tree>Recursively maps a Form Field tree to its nested submission-value shape.
FormDefinition<Fields>Serialization, Fields, and optional typed submission definition.
FormFieldOptions<Value>Initial value plus built-in or Standard Schema validators.
FormSubmission<Value>Compiler-built nested value, serialized FormData, and submission-owned AbortSignal.
FormSerializationjson | form-data | url-encoded.
StandardSchemaV1<Input, Output>Supported Standard Schema v1 validation interface.
StandardSchemaResult<Output>A transformed output or one or more normalized validation issues.
StandardSchemaIssueMessage plus optional property-key path segments.
FormFieldValidator<Value>A closed built-in rule or compatible Standard Schema v1 validator.
ValidationRuleClosed built-in validation-rule marker.
Resource<Data, Error>Route-owned loader data, typed error, and lifecycle state.
ResourceStateidle | pending | ready | failed | cancelled.
RouteParametersReadonly, compiler-decoded parameter record for the selected file route.
ServerActionResultJSON-compatible success data or a same-origin absolute-path redirect object.

Historical APIs

Presolve 0.1 declarations are documented only in the migration reference. This reference describes the current beta API and should be treated as the source of truth for new applications.

Import and version rules

  • Application source imports framework vocabulary from presolve; third-party package imports keep their published module names.
  • Pin framework, CLI, native CLI, TypeScript authority, tooling, and generated artifacts to the same prerelease.
  • Do not call framework intrinsics outside compiler-admitted source positions.
  • Do not infer semantic support from a TypeScript declaration alone; package use is classified at the exact use site and the compiler diagnostic is authoritative.