UNPKG

trellis

Version:

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

46 lines (44 loc) 1 kB
import { syncFromCore } from "../../chunk-TSOAW5E2.js"; import { createFormCore, formSchemaFrom } from "../../chunk-25WAHQHF.js"; import "../../chunk-2ESYSVXG.js"; // src/forms/vue/index.ts import { reactive } from "vue"; function useFormVue(schema, initialValues) { const core = createFormCore(formSchemaFrom(schema), initialValues ?? {}); const state = reactive(core.state); syncFromCore(state, core); const field = (name) => { return { get value() { return state.values[name]; }, get error() { return state.errors[name]; }, get dirty() { return state.dirty[name]; }, get touched() { return state.touched[name]; }, onChange: (value) => core.actions.setValue(name, value), onBlur: () => core.actions.setTouched(name, true) }; }; return { get state() { return state; }, actions: core.actions, field, subscribe: core.subscribe }; } export { useFormVue };