UNPKG

trellis

Version:

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

34 lines (32 loc) 856 B
import { toSvelteStore } from "../../chunk-TSOAW5E2.js"; import { createFormCore, formSchemaFrom } from "../../chunk-25WAHQHF.js"; import "../../chunk-2ESYSVXG.js"; // src/forms/svelte/index.ts function createFormStore(schema, initialValues) { const core = createFormCore(formSchemaFrom(schema), initialValues ?? {}); return { state: toSvelteStore(core), actions: core.actions, field: (name) => toSvelteStore(core, (s) => ({ value: s.values[name], error: s.errors[name], dirty: s.dirty[name], touched: s.touched[name], onChange: (value) => core.actions.setValue(name, value), onBlur: () => core.actions.setTouched(name, true) })), core }; } function useFormSvelte(schema, initialValues) { return createFormStore(schema, initialValues); } export { createFormStore, useFormSvelte };