UNPKG

trellis

Version:

Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications

27 lines 1.37 kB
/** * Form Engine — headless form state machine (values, errors, dirty/touched, * validation, submit). Framework-free. * * Ported from the `form-v1` sprite work and merged with the descriptor * contract: `createFormCore` runs off a {@link FormSchema}, which is built * either from a `defineType` handle (zod validation) or a headless * `FormDescriptor` (metadata validation). * * Framework adapters (`trellis/forms/react`, `/vue`, `/svelte`, `/vanilla`) * build their reactivity on {@link UseFormReturn.subscribe}. * * @module trellis/forms/core */ import type { FormSchema, FormValues, UseFormReturn } from './types.js'; export type { FieldBinding, FieldState, FormActions, FormFieldConfig, FormSchema, FormState, FormValues, UseFormReturn, ValidationError, ValidationResult, } from './types.js'; export { formSchemaFrom, formSchemaFromDescriptor, toFormSchema, } from './schema.js'; /** * Create a headless form core for an entity schema. * * const core = createFormCore(formSchemaFromDescriptor(descriptor)); * const unsub = core.subscribe(() => render(core.state)); * core.actions.setValue('title', 'Fix the sync'); * await core.actions.submit(async (values) => createEntity(type, values)); */ export declare function createFormCore(formSchema: FormSchema, initialValues?: FormValues): UseFormReturn; //# sourceMappingURL=index.d.ts.map