@schema-engine/forms-react 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +7 -7
  2. package/dist/{chunk-WRJWSEL7.js → chunk-65FTA4N2.js} +1 -1
  3. package/dist/{chunk-DTJ64NZQ.js → chunk-7SE2EAS6.js} +1 -1
  4. package/dist/{chunk-ISDPSORR.js → chunk-BLBPZL42.js} +4 -4
  5. package/dist/{chunk-SED35QJC.js → chunk-CQB4L54B.js} +4 -4
  6. package/dist/chunk-CQB4L54B.js.map +7 -0
  7. package/dist/chunk-FV6KW2EK.js +16 -0
  8. package/dist/chunk-FV6KW2EK.js.map +7 -0
  9. package/dist/{chunk-AALIXTCD.js → chunk-HBXM7CPI.js} +4 -13
  10. package/dist/chunk-HBXM7CPI.js.map +7 -0
  11. package/dist/{chunk-K3LLWGXU.js → chunk-HNUS4XKC.js} +1 -1
  12. package/dist/{chunk-KG6Q7MNI.js → chunk-HX66MLOM.js} +4 -4
  13. package/dist/{chunk-QUZN42PL.js → chunk-J5P7HUMV.js} +13 -9
  14. package/dist/chunk-J5P7HUMV.js.map +7 -0
  15. package/dist/chunk-KYBOEYMM.js.map +7 -0
  16. package/dist/chunk-SEWP4GIN.js +34 -0
  17. package/dist/chunk-SEWP4GIN.js.map +7 -0
  18. package/dist/{chunk-WFRWVH4X.js → chunk-WJYJ3Q4J.js} +1 -1
  19. package/dist/components/form-debugger/form-debugger.js +5 -5
  20. package/dist/components/form-debugger/index.js +5 -5
  21. package/dist/components/form-provider.js +2 -2
  22. package/dist/components/index.js +13 -12
  23. package/dist/components/internals/child-grid.d.ts +43 -0
  24. package/dist/components/internals/child-grid.js +10 -0
  25. package/dist/components/internals/child-grid.js.map +7 -0
  26. package/dist/components/internals/field-renderer.js +8 -8
  27. package/dist/components/internals/form-elements.js +9 -9
  28. package/dist/components/internals/form-renderer.js +13 -12
  29. package/dist/components/internals/grid-container.d.ts +13 -0
  30. package/dist/components/internals/grid-container.js +9 -0
  31. package/dist/components/internals/grid-container.js.map +7 -0
  32. package/dist/components/internals/recipe-renderer.js +5 -5
  33. package/dist/contexts/index.js +1 -1
  34. package/dist/contexts/view-context.d.ts +2 -2
  35. package/dist/contexts/view-context.js +1 -1
  36. package/dist/hooks/form-state/index.js +7 -7
  37. package/dist/hooks/form-state/use-form-field.js +2 -2
  38. package/dist/hooks/index.js +15 -17
  39. package/dist/hooks/use-field.js +2 -2
  40. package/dist/hooks/use-form-context.d.ts +4 -36
  41. package/dist/hooks/use-form-context.js +3 -5
  42. package/dist/index.js +13 -12
  43. package/dist/primitives.d.ts +5 -3
  44. package/dist/primitives.js +14 -9
  45. package/dist/primitives.js.map +2 -2
  46. package/package.json +8 -7
  47. package/skill/SKILL.md +12 -11
  48. package/skill/reference/forms-react.md +1 -1
  49. package/dist/chunk-AALIXTCD.js.map +0 -7
  50. package/dist/chunk-IXRV3YCF.js.map +0 -7
  51. package/dist/chunk-QUZN42PL.js.map +0 -7
  52. package/dist/chunk-SED35QJC.js.map +0 -7
  53. /package/dist/{chunk-WRJWSEL7.js.map → chunk-65FTA4N2.js.map} +0 -0
  54. /package/dist/{chunk-DTJ64NZQ.js.map → chunk-7SE2EAS6.js.map} +0 -0
  55. /package/dist/{chunk-ISDPSORR.js.map → chunk-BLBPZL42.js.map} +0 -0
  56. /package/dist/{chunk-K3LLWGXU.js.map → chunk-HNUS4XKC.js.map} +0 -0
  57. /package/dist/{chunk-KG6Q7MNI.js.map → chunk-HX66MLOM.js.map} +0 -0
  58. /package/dist/{chunk-IXRV3YCF.js → chunk-KYBOEYMM.js} +0 -0
  59. /package/dist/{chunk-WFRWVH4X.js.map → chunk-WJYJ3Q4J.js.map} +0 -0
@@ -1,31 +1,32 @@
1
1
  import {
2
2
  FormRenderer
3
- } from "../../chunk-QUZN42PL.js";
4
- import "../../chunk-SED35QJC.js";
5
- import "../../chunk-K3LLWGXU.js";
6
- import "../../chunk-KG6Q7MNI.js";
3
+ } from "../../chunk-J5P7HUMV.js";
4
+ import "../../chunk-CQB4L54B.js";
5
+ import "../../chunk-HNUS4XKC.js";
6
+ import "../../chunk-HX66MLOM.js";
7
7
  import "../../chunk-HT43MPKW.js";
8
- import "../../chunk-7RUFT6EJ.js";
9
- import "../../chunk-WFRWVH4X.js";
10
8
  import "../../chunk-7QNWPTT7.js";
9
+ import "../../chunk-7RUFT6EJ.js";
10
+ import "../../chunk-WJYJ3Q4J.js";
11
11
  import "../../chunk-WOTW7A2I.js";
12
+ import "../../chunk-5XCNXEJB.js";
12
13
  import "../../chunk-ULKJHK3P.js";
14
+ import "../../chunk-K66J2V73.js";
15
+ import "../../chunk-7SE2EAS6.js";
13
16
  import "../../chunk-NDFV5AQW.js";
14
17
  import "../../chunk-MBN4WIAC.js";
15
- import "../../chunk-K66J2V73.js";
16
- import "../../chunk-DTJ64NZQ.js";
18
+ import "../../chunk-KYBOEYMM.js";
17
19
  import "../../chunk-EYDB6NR6.js";
18
- import "../../chunk-IXRV3YCF.js";
19
20
  import "../../chunk-6RI4LMM6.js";
20
- import "../../chunk-WRJWSEL7.js";
21
+ import "../../chunk-65FTA4N2.js";
21
22
  import "../../chunk-USRF3EEE.js";
22
23
  import "../../chunk-CPJMN2IH.js";
23
24
  import "../../chunk-H25SUEJE.js";
24
25
  import "../../chunk-XWHP2AGG.js";
25
- import "../../chunk-AALIXTCD.js";
26
+ import "../../chunk-FV6KW2EK.js";
27
+ import "../../chunk-HBXM7CPI.js";
26
28
  import "../../chunk-ZWEYALBG.js";
27
29
  import "../../chunk-GH2QO3WC.js";
28
- import "../../chunk-5XCNXEJB.js";
29
30
  export {
30
31
  FormRenderer
31
32
  };
@@ -0,0 +1,13 @@
1
+ import type React from 'react';
2
+ /**
3
+ * Wraps one grid in the element a `query: 'container'` layout theme measures its breakpoints against.
4
+ *
5
+ * @remarks
6
+ * Renders only its children when the engine's theme queries the viewport, so the markup of a media
7
+ * theme is unchanged. The step grid uses it directly; the grid of a container element gets it
8
+ * through `ChildGrid`. The theme comes from the engine context, with the library default outside a
9
+ * `FormEngineProvider`.
10
+ */
11
+ export declare function GridContainer({ children }: {
12
+ children: React.ReactNode;
13
+ }): React.JSX.Element;
@@ -0,0 +1,9 @@
1
+ import {
2
+ GridContainer
3
+ } from "../../chunk-FV6KW2EK.js";
4
+ import "../../chunk-HBXM7CPI.js";
5
+ import "../../chunk-ZWEYALBG.js";
6
+ import "../../chunk-GH2QO3WC.js";
7
+ export {
8
+ GridContainer
9
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  RecipeRenderer
3
- } from "../../chunk-SED35QJC.js";
3
+ } from "../../chunk-CQB4L54B.js";
4
4
  import "../../chunk-ULKJHK3P.js";
5
+ import "../../chunk-K66J2V73.js";
6
+ import "../../chunk-7SE2EAS6.js";
5
7
  import "../../chunk-NDFV5AQW.js";
6
8
  import "../../chunk-MBN4WIAC.js";
7
- import "../../chunk-K66J2V73.js";
8
- import "../../chunk-DTJ64NZQ.js";
9
+ import "../../chunk-KYBOEYMM.js";
9
10
  import "../../chunk-EYDB6NR6.js";
10
- import "../../chunk-IXRV3YCF.js";
11
11
  import "../../chunk-XWHP2AGG.js";
12
- import "../../chunk-AALIXTCD.js";
12
+ import "../../chunk-HBXM7CPI.js";
13
13
  import "../../chunk-ZWEYALBG.js";
14
14
  import "../../chunk-GH2QO3WC.js";
15
15
  export {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ViewProvider
3
- } from "../chunk-IXRV3YCF.js";
3
+ } from "../chunk-KYBOEYMM.js";
4
4
  export {
5
5
  ViewProvider
6
6
  };
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from 'react';
2
- import type * as z from 'zod/mini';
2
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
3
3
  import type { RecipeSlot, ViewModel, ViewNavigation } from '@schema-engine/forms/recipes';
4
4
  export type { ViewModel as ViewContextValue, ViewNavigation, ViewStep } from '@schema-engine/forms/recipes';
5
5
  export declare function ViewProvider({ children, value }: {
@@ -11,4 +11,4 @@ export declare function useOptionalViewContext(): ViewModel | null;
11
11
  export declare function useActiveStep(): import("@schema-engine/forms/recipes").ViewStep;
12
12
  export declare function useFormNavigation(): ViewNavigation;
13
13
  /** Reads the complete config of one slot, typed by the slot schema's output. */
14
- export declare function useViewConfig<TSchema extends z.ZodMiniType>(slot: RecipeSlot, schema: TSchema): z.output<TSchema>;
14
+ export declare function useViewConfig<TSchema extends StandardSchemaV1>(slot: RecipeSlot, schema: TSchema): StandardSchemaV1.InferOutput<TSchema>;
@@ -5,7 +5,7 @@ import {
5
5
  useOptionalViewContext,
6
6
  useViewConfig,
7
7
  useViewContext
8
- } from "../chunk-IXRV3YCF.js";
8
+ } from "../chunk-KYBOEYMM.js";
9
9
  export {
10
10
  ViewProvider,
11
11
  useActiveStep,
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  FORM_ROOT
3
3
  } from "../../chunk-ULKJHK3P.js";
4
+ import {
5
+ useFormContext
6
+ } from "../../chunk-K66J2V73.js";
7
+ import {
8
+ useFormField
9
+ } from "../../chunk-7SE2EAS6.js";
4
10
  import {
5
11
  useWatch
6
12
  } from "../../chunk-NDFV5AQW.js";
7
13
  import {
8
14
  useFieldArray
9
15
  } from "../../chunk-MBN4WIAC.js";
10
- import {
11
- useFormContext
12
- } from "../../chunk-K66J2V73.js";
13
- import {
14
- useFormField
15
- } from "../../chunk-DTJ64NZQ.js";
16
16
  import "../../chunk-EYDB6NR6.js";
17
17
  import "../../chunk-XWHP2AGG.js";
18
- import "../../chunk-AALIXTCD.js";
18
+ import "../../chunk-HBXM7CPI.js";
19
19
  import "../../chunk-ZWEYALBG.js";
20
20
  import "../../chunk-GH2QO3WC.js";
21
21
  export {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  useFormField
3
- } from "../../chunk-DTJ64NZQ.js";
3
+ } from "../../chunk-7SE2EAS6.js";
4
4
  import "../../chunk-EYDB6NR6.js";
5
5
  import "../../chunk-XWHP2AGG.js";
6
- import "../../chunk-AALIXTCD.js";
6
+ import "../../chunk-HBXM7CPI.js";
7
7
  import "../../chunk-ZWEYALBG.js";
8
8
  import "../../chunk-GH2QO3WC.js";
9
9
  export {
@@ -1,4 +1,7 @@
1
1
  import "../chunk-HT43MPKW.js";
2
+ import {
3
+ useIsMobile
4
+ } from "../chunk-7QNWPTT7.js";
2
5
  import {
3
6
  useDebounce,
4
7
  useDebouncedValue
@@ -8,46 +11,42 @@ import {
8
11
  useFieldAppearanceAttributes,
9
12
  useFieldClassName,
10
13
  useFieldHost
11
- } from "../chunk-WFRWVH4X.js";
12
- import {
13
- useIsMobile
14
- } from "../chunk-7QNWPTT7.js";
14
+ } from "../chunk-WJYJ3Q4J.js";
15
15
  import "../chunk-WOTW7A2I.js";
16
16
  import {
17
17
  FORM_ROOT
18
18
  } from "../chunk-ULKJHK3P.js";
19
+ import {
20
+ useFormContext
21
+ } from "../chunk-K66J2V73.js";
22
+ import {
23
+ useFormField
24
+ } from "../chunk-7SE2EAS6.js";
19
25
  import {
20
26
  useWatch
21
27
  } from "../chunk-NDFV5AQW.js";
22
28
  import {
23
29
  useFieldArray
24
30
  } from "../chunk-MBN4WIAC.js";
25
- import {
26
- useFormContext
27
- } from "../chunk-K66J2V73.js";
28
- import {
29
- useFormField
30
- } from "../chunk-DTJ64NZQ.js";
31
- import "../chunk-EYDB6NR6.js";
32
31
  import {
33
32
  useActiveStep,
34
33
  useFormNavigation,
35
34
  useOptionalViewContext,
36
35
  useViewConfig,
37
36
  useViewContext
38
- } from "../chunk-IXRV3YCF.js";
37
+ } from "../chunk-KYBOEYMM.js";
38
+ import "../chunk-EYDB6NR6.js";
39
39
  import {
40
40
  fieldText
41
41
  } from "../chunk-H25SUEJE.js";
42
42
  import "../chunk-XWHP2AGG.js";
43
43
  import {
44
- useChildGridProps,
45
44
  useFormEngine,
46
- useFormInstanceActions,
47
45
  useFormRuntime,
46
+ useFormWizard,
48
47
  useLayoutThemeId,
49
48
  useOptionalFormEngine
50
- } from "../chunk-AALIXTCD.js";
49
+ } from "../chunk-HBXM7CPI.js";
51
50
  import "../chunk-ZWEYALBG.js";
52
51
  import "../chunk-GH2QO3WC.js";
53
52
  export {
@@ -55,7 +54,6 @@ export {
55
54
  combineHandlers,
56
55
  fieldText,
57
56
  useActiveStep,
58
- useChildGridProps,
59
57
  useDebounce,
60
58
  useDebouncedValue,
61
59
  useFieldAppearanceAttributes,
@@ -65,9 +63,9 @@ export {
65
63
  useFormContext,
66
64
  useFormEngine,
67
65
  useFormField,
68
- useFormInstanceActions,
69
66
  useFormNavigation,
70
67
  useFormRuntime,
68
+ useFormWizard,
71
69
  useIsMobile,
72
70
  useLayoutThemeId,
73
71
  useOptionalFormEngine,
@@ -3,9 +3,9 @@ import {
3
3
  useFieldAppearanceAttributes,
4
4
  useFieldClassName,
5
5
  useFieldHost
6
- } from "../chunk-WFRWVH4X.js";
6
+ } from "../chunk-WJYJ3Q4J.js";
7
7
  import "../chunk-WOTW7A2I.js";
8
- import "../chunk-AALIXTCD.js";
8
+ import "../chunk-HBXM7CPI.js";
9
9
  import "../chunk-ZWEYALBG.js";
10
10
  import "../chunk-GH2QO3WC.js";
11
11
  export {
@@ -1,28 +1,11 @@
1
- import type { FormRuntime, FormStepState, EngineOutputMaps } from '@schema-engine/forms';
2
- import { type CssVariables } from '@schema-engine/layout';
1
+ import type { EngineOutputMaps, FormRuntime, FormWizard } from '@schema-engine/forms';
3
2
  import type { FormEngineContextValue } from '../components/provider';
4
3
  /**
5
- * What a component reads of the form's wizard: where it is, and the commands that move it.
4
+ * The form's wizard: where it is, and the commands that move it.
6
5
  *
7
- * @remarks
8
- * The commands are those of the form's runtime and end with an outcome (`'moved'`, `'invalid'`, `'busy'`, ...). `steps` lists every
9
- * step in order with `skipped`, `visited`, `complete` and `invalid`; a skipped step is passed over by `next` and `back` and refused by `goTo`.
10
- */
11
- export interface FormInstanceContextValue {
12
- /** The id of the current step. */
13
- current: string;
14
- steps: readonly FormStepState[];
15
- /** A `next`, `back` or `goTo` runs. */
16
- navigating: boolean;
17
- next: FormRuntime['next'];
18
- back: FormRuntime['back'];
19
- goTo: FormRuntime['goTo'];
20
- }
21
- /**
22
- * Hook to access the form's wizard state and navigation
23
- * Must be used within a FormProvider
6
+ * @remarks Must be used within a FormProvider. See {@link FormWizard} for the commands' outcomes and the steps' state.
24
7
  */
25
- export declare function useFormInstanceActions(): FormInstanceContextValue;
8
+ export declare function useFormWizard(): FormWizard;
26
9
  /**
27
10
  * The form's runtime: its container, its submission and its wizard, for what takes a form over whole, such as `registerFormAgentTool`.
28
11
  *
@@ -46,18 +29,3 @@ export declare function useOptionalFormEngine<TElements extends Record<string, u
46
29
  * default for hosts rendered outside a `FormEngineProvider`.
47
30
  */
48
31
  export declare function useLayoutThemeId(): string;
49
- /**
50
- * Props that make an element's children a grid of their own.
51
- *
52
- * @remarks
53
- * A container (a fieldset, an array row) lays its direct children out in a grid
54
- * the way a step does: spread the result on the wrapper of its `FormElements`.
55
- * The grid takes twelve tracks when a child sets `width` or `offset`, and
56
- * otherwise stays the engine's single column. The theme comes from the engine
57
- * context, with the library default outside a `FormEngineProvider`.
58
- */
59
- export declare function useChildGridProps(elements: readonly unknown[]): {
60
- className: string;
61
- 'data-se-theme': string;
62
- style: CssVariables;
63
- };
@@ -1,18 +1,16 @@
1
1
  import {
2
- useChildGridProps,
3
2
  useFormEngine,
4
- useFormInstanceActions,
5
3
  useFormRuntime,
4
+ useFormWizard,
6
5
  useLayoutThemeId,
7
6
  useOptionalFormEngine
8
- } from "../chunk-AALIXTCD.js";
7
+ } from "../chunk-HBXM7CPI.js";
9
8
  import "../chunk-ZWEYALBG.js";
10
9
  import "../chunk-GH2QO3WC.js";
11
10
  export {
12
- useChildGridProps,
13
11
  useFormEngine,
14
- useFormInstanceActions,
15
12
  useFormRuntime,
13
+ useFormWizard,
16
14
  useLayoutThemeId,
17
15
  useOptionalFormEngine
18
16
  };
package/dist/index.js CHANGED
@@ -1,39 +1,40 @@
1
1
  import "./chunk-IHX6VMAQ.js";
2
2
  import {
3
3
  FormRenderer
4
- } from "./chunk-QUZN42PL.js";
5
- import "./chunk-SED35QJC.js";
6
- import "./chunk-K3LLWGXU.js";
7
- import "./chunk-KG6Q7MNI.js";
4
+ } from "./chunk-J5P7HUMV.js";
5
+ import "./chunk-CQB4L54B.js";
6
+ import "./chunk-HNUS4XKC.js";
7
+ import "./chunk-HX66MLOM.js";
8
8
  import "./chunk-HT43MPKW.js";
9
- import "./chunk-7RUFT6EJ.js";
10
- import "./chunk-WFRWVH4X.js";
11
9
  import "./chunk-7QNWPTT7.js";
10
+ import "./chunk-7RUFT6EJ.js";
11
+ import "./chunk-WJYJ3Q4J.js";
12
12
  import "./chunk-WOTW7A2I.js";
13
+ import "./chunk-5XCNXEJB.js";
13
14
  import "./chunk-ULKJHK3P.js";
15
+ import "./chunk-K66J2V73.js";
16
+ import "./chunk-7SE2EAS6.js";
14
17
  import "./chunk-NDFV5AQW.js";
15
18
  import "./chunk-MBN4WIAC.js";
16
- import "./chunk-K66J2V73.js";
17
- import "./chunk-DTJ64NZQ.js";
19
+ import "./chunk-KYBOEYMM.js";
18
20
  import "./chunk-EYDB6NR6.js";
19
- import "./chunk-IXRV3YCF.js";
20
21
  import {
21
22
  FormEngineProvider
22
23
  } from "./chunk-6RI4LMM6.js";
23
24
  import {
24
25
  FormProvider
25
- } from "./chunk-WRJWSEL7.js";
26
+ } from "./chunk-65FTA4N2.js";
26
27
  import "./chunk-USRF3EEE.js";
27
28
  import "./chunk-CPJMN2IH.js";
28
29
  import "./chunk-H25SUEJE.js";
29
30
  import "./chunk-XWHP2AGG.js";
30
- import "./chunk-AALIXTCD.js";
31
+ import "./chunk-FV6KW2EK.js";
32
+ import "./chunk-HBXM7CPI.js";
31
33
  import "./chunk-ZWEYALBG.js";
32
34
  import {
33
35
  FormEngineContext,
34
36
  createFormEngineContextValue
35
37
  } from "./chunk-GH2QO3WC.js";
36
- import "./chunk-5XCNXEJB.js";
37
38
  export {
38
39
  FormEngineContext,
39
40
  FormEngineProvider,
@@ -5,12 +5,14 @@
5
5
  * package implementation paths.
6
6
  */
7
7
  import type React from 'react';
8
- import { type FormShellLayout, type RecipeRenderPayload, type RecipeSlot, type RecipeSpec } from '@schema-engine/forms/recipes';
9
- import type * as z from 'zod/mini';
8
+ import { type FormShellLayout, type RecipeRenderPayload, type RecipeSlotSchemas, type RecipeSpec } from '@schema-engine/forms/recipes';
9
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
10
10
  export { FormElement } from './components/internals/field-renderer';
11
11
  export type { FormElementProps } from './components/internals/field-renderer';
12
12
  export { FormElements } from './components/internals/form-elements';
13
13
  export type { FormElementsProps } from './components/internals/form-elements';
14
+ export { ChildGrid } from './components/internals/child-grid';
15
+ export type { ChildGridProps } from './components/internals/child-grid';
14
16
  /** Stable React recipe contracts for consumer-owned view implementations. */
15
17
  export type FormShellProps = FormShellLayout<React.ReactNode>;
16
18
  export type FormShellComponent = React.FC<FormShellProps>;
@@ -25,4 +27,4 @@ export interface ReactRecipeAdapterPayload {
25
27
  * Wraps the renderer-neutral `defineFormRecipe`; the payload type is what makes a missing or
26
28
  * extra slot a compile error.
27
29
  */
28
- export declare function defineRecipe<const TType extends string, TSlots extends Partial<Record<RecipeSlot, z.ZodMiniType>>, TSchema extends z.ZodMiniType>(spec: RecipeSpec<TType, TSchema, TSlots>, payload: RecipeRenderPayload<TSlots, FormShellComponent, React.FC>): import("@schema-engine/forms").RecipeRegistration<TType, TSchema, RecipeRenderPayload<TSlots, FormShellComponent, React.FC<{}>>>;
30
+ export declare function defineRecipe<const TType extends string, TSlots extends RecipeSlotSchemas, TSchema extends StandardSchemaV1>(spec: RecipeSpec<TType, TSchema, TSlots>, payload: RecipeRenderPayload<TSlots, FormShellComponent, React.FC>): import("@schema-engine/forms").RecipeRegistration<TType, TSchema, RecipeRenderPayload<TSlots, FormShellComponent, React.FC<{}>>>;
@@ -1,27 +1,31 @@
1
1
  import {
2
2
  FormElements
3
- } from "./chunk-K3LLWGXU.js";
3
+ } from "./chunk-HNUS4XKC.js";
4
4
  import {
5
5
  FormElement
6
- } from "./chunk-KG6Q7MNI.js";
6
+ } from "./chunk-HX66MLOM.js";
7
7
  import "./chunk-HT43MPKW.js";
8
- import "./chunk-7RUFT6EJ.js";
9
- import "./chunk-WFRWVH4X.js";
10
8
  import "./chunk-7QNWPTT7.js";
9
+ import "./chunk-7RUFT6EJ.js";
10
+ import "./chunk-WJYJ3Q4J.js";
11
11
  import "./chunk-WOTW7A2I.js";
12
+ import "./chunk-5XCNXEJB.js";
12
13
  import "./chunk-ULKJHK3P.js";
14
+ import "./chunk-K66J2V73.js";
15
+ import "./chunk-7SE2EAS6.js";
13
16
  import "./chunk-NDFV5AQW.js";
14
17
  import "./chunk-MBN4WIAC.js";
15
- import "./chunk-K66J2V73.js";
16
- import "./chunk-DTJ64NZQ.js";
18
+ import "./chunk-KYBOEYMM.js";
17
19
  import "./chunk-EYDB6NR6.js";
18
- import "./chunk-IXRV3YCF.js";
19
20
  import "./chunk-H25SUEJE.js";
20
21
  import "./chunk-XWHP2AGG.js";
21
- import "./chunk-AALIXTCD.js";
22
+ import {
23
+ ChildGrid
24
+ } from "./chunk-SEWP4GIN.js";
25
+ import "./chunk-FV6KW2EK.js";
26
+ import "./chunk-HBXM7CPI.js";
22
27
  import "./chunk-ZWEYALBG.js";
23
28
  import "./chunk-GH2QO3WC.js";
24
- import "./chunk-5XCNXEJB.js";
25
29
 
26
30
  // src/primitives.ts
27
31
  import {
@@ -31,6 +35,7 @@ function defineRecipe(spec, payload) {
31
35
  return defineFormRecipe(spec, payload);
32
36
  }
33
37
  export {
38
+ ChildGrid,
34
39
  FormElement,
35
40
  FormElements,
36
41
  defineRecipe
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/primitives.ts"],
4
- "sourcesContent": ["/**\n * Stable runtime contracts used by consumer-owned form registrations.\n *\n * Registry components must use this entrypoint instead of reaching into\n * package implementation paths.\n */\nimport type React from 'react';\nimport {\n\tdefineFormRecipe,\n\ttype FormShellLayout,\n\ttype RecipeRenderPayload,\n\ttype RecipeSlot,\n\ttype RecipeSpec,\n} from '@schema-engine/forms/recipes';\nimport type * as z from 'zod/mini';\n\nexport { FormElement } from './components/internals/field-renderer';\nexport type { FormElementProps } from './components/internals/field-renderer';\nexport { FormElements } from './components/internals/form-elements';\nexport type { FormElementsProps } from './components/internals/form-elements';\n\n/** Stable React recipe contracts for consumer-owned view implementations. */\nexport type FormShellProps = FormShellLayout<React.ReactNode>;\nexport type FormShellComponent = React.FC<FormShellProps>;\nexport interface ReactRecipeAdapterPayload {\n\tshell?: FormShellComponent;\n\tslots: Partial<Record<'header' | 'progress' | 'actions', React.FC>>;\n}\n\n/**\n * Binds a recipe spec to React components, requiring exactly the slots the spec declares.\n *\n * @remarks\n * Wraps the renderer-neutral `defineFormRecipe`; the payload type is what makes a missing or\n * extra slot a compile error.\n */\nexport function defineRecipe<\n\tconst TType extends string,\n\tTSlots extends Partial<Record<RecipeSlot, z.ZodMiniType>>,\n\tTSchema extends z.ZodMiniType,\n>(spec: RecipeSpec<TType, TSchema, TSlots>, payload: RecipeRenderPayload<TSlots, FormShellComponent, React.FC>) {\n\treturn defineFormRecipe(spec, payload);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAOA;AAAA,EACC;AAAA,OAKM;AAuBA,SAAS,aAId,MAA0C,SAAoE;AAC/G,SAAO,iBAAiB,MAAM,OAAO;AACtC;",
4
+ "sourcesContent": ["/**\n * Stable runtime contracts used by consumer-owned form registrations.\n *\n * Registry components must use this entrypoint instead of reaching into\n * package implementation paths.\n */\nimport type React from 'react';\nimport {\n\tdefineFormRecipe,\n\ttype FormShellLayout,\n\ttype RecipeRenderPayload,\n\ttype RecipeSlotSchemas,\n\ttype RecipeSpec,\n} from '@schema-engine/forms/recipes';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\n\nexport { FormElement } from './components/internals/field-renderer';\nexport type { FormElementProps } from './components/internals/field-renderer';\nexport { FormElements } from './components/internals/form-elements';\nexport type { FormElementsProps } from './components/internals/form-elements';\nexport { ChildGrid } from './components/internals/child-grid';\nexport type { ChildGridProps } from './components/internals/child-grid';\n\n/** Stable React recipe contracts for consumer-owned view implementations. */\nexport type FormShellProps = FormShellLayout<React.ReactNode>;\nexport type FormShellComponent = React.FC<FormShellProps>;\nexport interface ReactRecipeAdapterPayload {\n\tshell?: FormShellComponent;\n\tslots: Partial<Record<'header' | 'progress' | 'actions', React.FC>>;\n}\n\n/**\n * Binds a recipe spec to React components, requiring exactly the slots the spec declares.\n *\n * @remarks\n * Wraps the renderer-neutral `defineFormRecipe`; the payload type is what makes a missing or\n * extra slot a compile error.\n */\nexport function defineRecipe<\n\tconst TType extends string,\n\tTSlots extends RecipeSlotSchemas,\n\tTSchema extends StandardSchemaV1,\n>(spec: RecipeSpec<TType, TSchema, TSlots>, payload: RecipeRenderPayload<TSlots, FormShellComponent, React.FC>) {\n\treturn defineFormRecipe(spec, payload);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA;AAAA,EACC;AAAA,OAKM;AAyBA,SAAS,aAId,MAA0C,SAAoE;AAC/G,SAAO,iBAAiB,MAAM,OAAO;AACtC;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@schema-engine/forms-react",
3
3
  "type": "module",
4
- "version": "0.5.2",
4
+ "version": "0.5.3",
5
5
  "description": "The React renderer for Schema Engine forms",
6
6
  "keywords": [
7
7
  "schema-engine",
@@ -81,20 +81,21 @@
81
81
  "vitest": "^5.1.1",
82
82
  "vitest-browser-react": "^2.3.0",
83
83
  "zod": "^4.0.17",
84
- "@schema-engine/forms": "0.5.2",
85
- "@schema-engine/layout": "0.5.1",
86
- "@schema-engine/actions": "0.5.1",
84
+ "@schema-engine/actions": "0.5.2",
85
+ "@schema-engine/layout": "0.5.2",
86
+ "@schema-engine/forms": "0.5.3",
87
87
  "@schema-engine/scripts": "0.0.0"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "react": "^19",
91
91
  "react-dom": "^19",
92
92
  "zod": "^4.0.17",
93
- "@schema-engine/forms": "^0.5.2",
94
- "@schema-engine/layout": "^0.5.1"
93
+ "@schema-engine/forms": "^0.5.3",
94
+ "@schema-engine/layout": "^0.5.2"
95
95
  },
96
96
  "dependencies": {
97
- "@ecopages/logger": "^0.2.3"
97
+ "@ecopages/logger": "^0.2.3",
98
+ "@standard-schema/spec": "^1.1.0"
98
99
  },
99
100
  "exports": {
100
101
  "./package.json": {
package/skill/SKILL.md CHANGED
@@ -19,7 +19,7 @@ This file is the router. It defines the concepts once; the references assume the
19
19
  ## Core concepts
20
20
 
21
21
  - **registration**: `{ $type, schema, metadata, ... }`, where `$type` is the stable key, `schema` is any Standard Schema that describes its config, and `metadata` names it. Elements, recipes, actions, validation rules and appearance axes are all registrations.
22
- - **registry**: a read-only registry, `createRegistry(kind, registrations)` from `@schema-engine/registry`, built once from a list. The last registration of a `$type` wins without a warning, which is how you replace a built-in.
22
+ - **registry**: a read-only registry, `createRegistry(kind, registrations)` from `@schema-engine/registry`, built once from a list. The last registration of a `$type` wins without a warning, which is how you replace a built-in; pass `{ duplicates: 'error' }` to make a repeat a build error instead.
23
23
  - **document**: serializable data whose every node names a registration by `$type`. It is checked against the registrations at the boundary, so what is rendered or run has passed its schema.
24
24
  - **action**: a registration with `execute` that runs on a trigger. Actions run as a sequence, an inner array is a parallel group, and a failure that sets `shouldContinue: false` stops what follows and cancels the group's siblings through their `signal`.
25
25
 
@@ -67,13 +67,14 @@ Each package ships this router as its own `skill/SKILL.md` and its references in
67
67
 
68
68
  The full documentation is at `/docs` on the deployed site. The LLM-exported corpus is `/llms.txt` (index) and `/docs-llm/<section>/<slug>.md` (page bodies).
69
69
 
70
- | Section | Path prefix |
71
- | ------------------------------ | ---------------------------------- |
72
- | Schema Engine | `/docs/schema-engine/introduction` |
73
- | `@schema-engine/registry` | `/docs/registry/overview` |
74
- | `@schema-engine/actions` | `/docs/actions/overview` |
75
- | `@schema-engine/forms` | `/docs/forms/overview` |
76
- | `@schema-engine/forms-react` | `/docs/forms-react/overview` |
77
- | `@schema-engine/forms-radiant` | `/docs/forms-radiant/overview` |
78
- | `@schema-engine/layout` | `/docs/layout/overview` |
79
- | Examples | `/docs/examples/overview` |
70
+ | Section | Path prefix |
71
+ | ------------------------------ | ----------------------------------------- |
72
+ | Schema Engine | `/docs/schema-engine/introduction` |
73
+ | `@schema-engine/registry` | `/docs/registry/overview` |
74
+ | `@schema-engine/actions` | `/docs/actions/overview` |
75
+ | `@schema-engine/forms` | `/docs/forms/overview` |
76
+ | `@schema-engine/forms-react` | `/docs/forms-react/overview` |
77
+ | `@schema-engine/forms-radiant` | `/docs/forms-radiant/overview` |
78
+ | `@schema-engine/layout` | `/docs/layout/overview` |
79
+ | Examples | `/docs/examples/overview` |
80
+ | Renderer authors | `/docs/renderer-authors/write-a-renderer` |
@@ -87,6 +87,6 @@ export function ResetButton() {
87
87
  }
88
88
  ```
89
89
 
90
- For a wizard, `useFormInstanceActions()` exposes `current` (the step id), `steps`, `navigating` and `next()`, `back()` and `goTo(id)`. `useFormEngine()` reads the engine the provider supplied. Recipe blocks read the active view with `useViewContext`, `useActiveStep`, `useFormNavigation` and `useViewConfig`.
90
+ For a wizard, `useFormWizard()` exposes `current` (the step id), `steps`, `navigating` and `next()`, `back()` and `goTo(id)`. `useFormEngine()` reads the engine the provider supplied. Recipe blocks read the active view with `useViewContext`, `useActiveStep`, `useFormNavigation` and `useViewConfig`.
91
91
 
92
92
  `useFormRuntime()` gives the runtime of the form the component sits in, which `registerFormAgentTool` takes (`forms.md`).
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/hooks/use-form-context.ts"],
4
- "sourcesContent": ["import { useContext, useMemo, useSyncExternalStore } from 'react';\nimport type { FormRuntime, FormStepState, EngineOutputMaps } from '@schema-engine/forms';\nimport { useFormStateContext } from './form-state/context';\nimport { GRID_CLASS, getDefaultLayoutTheme, getGridVariables, type CssVariables } from '@schema-engine/layout';\nimport { FormEngineContext } from '../components/provider';\nimport type { FormEngineContextValue } from '../components/provider';\n\n/**\n * What a component reads of the form's wizard: where it is, and the commands that move it.\n *\n * @remarks\n * The commands are those of the form's runtime and end with an outcome (`'moved'`, `'invalid'`, `'busy'`, ...). `steps` lists every\n * step in order with `skipped`, `visited`, `complete` and `invalid`; a skipped step is passed over by `next` and `back` and refused by `goTo`.\n */\nexport interface FormInstanceContextValue {\n\t/** The id of the current step. */\n\tcurrent: string;\n\tsteps: readonly FormStepState[];\n\t/** A `next`, `back` or `goTo` runs. */\n\tnavigating: boolean;\n\tnext: FormRuntime['next'];\n\tback: FormRuntime['back'];\n\tgoTo: FormRuntime['goTo'];\n}\n\n/**\n * Hook to access the form's wizard state and navigation\n * Must be used within a FormProvider\n */\nexport function useFormInstanceActions(): FormInstanceContextValue {\n\tconst { runtime } = useFormStateContext();\n\tconst { current, navigating, steps } = useSyncExternalStore(\n\t\truntime.subscribe,\n\t\truntime.getSnapshot,\n\t\truntime.getServerSnapshot,\n\t);\n\treturn useMemo(\n\t\t() => ({ current, steps, navigating, next: runtime.next, back: runtime.back, goTo: runtime.goTo }),\n\t\t[runtime, current, navigating, steps],\n\t);\n}\n\n/**\n * The form's runtime: its container, its submission and its wizard, for what takes a form over whole, such as `registerFormAgentTool`.\n *\n * @remarks\n * Must be used within a FormProvider. A new config or engine starts a new runtime, and the provider's children remount with it, so an effect that registers it runs again.\n */\nexport function useFormRuntime(): FormRuntime {\n\treturn useFormStateContext().runtime;\n}\n\n/**\n * Hook to access the form engine context\n * Must be used within a FormEngineProvider\n */\nexport function useFormEngine<\n\tTElements extends Record<string, unknown> = Record<string, unknown>,\n\tTRecipes extends Record<string, unknown> = Record<string, unknown>,\n\tTActions extends Record<string, unknown> = Record<string, unknown>,\n\tTOutputs extends EngineOutputMaps = EngineOutputMaps,\n>(): FormEngineContextValue<TElements, TRecipes, TActions, TOutputs> {\n\tconst context = useContext(FormEngineContext);\n\tif (!context) {\n\t\tthrow new Error('useFormEngine must be used within a FormEngineProvider');\n\t}\n\treturn context as unknown as FormEngineContextValue<TElements, TRecipes, TActions, TOutputs>;\n}\n\nexport function useOptionalFormEngine<\n\tTElements extends Record<string, unknown> = Record<string, unknown>,\n\tTRecipes extends Record<string, unknown> = Record<string, unknown>,\n\tTActions extends Record<string, unknown> = Record<string, unknown>,\n\tTOutputs extends EngineOutputMaps = EngineOutputMaps,\n>(): FormEngineContextValue<TElements, TRecipes, TActions, TOutputs> | null {\n\tconst context = useContext(FormEngineContext);\n\treturn context ? (context as unknown as FormEngineContextValue<TElements, TRecipes, TActions, TOutputs>) : null;\n}\n\n/**\n * Id of the layout theme that owns the field being rendered.\n *\n * @remarks\n * Field hosts set `data-se-theme` to this value so the engine's generated\n * stylesheet matches them and nested grids stay isolated. Single resolver for\n * the React renderer \u2014 the engine context is the only source, with the library\n * default for hosts rendered outside a `FormEngineProvider`.\n */\nexport function useLayoutThemeId(): string {\n\treturn (useOptionalFormEngine()?.engine.getLayout() ?? getDefaultLayoutTheme()).id;\n}\n\n/**\n * Props that make an element's children a grid of their own.\n *\n * @remarks\n * A container (a fieldset, an array row) lays its direct children out in a grid\n * the way a step does: spread the result on the wrapper of its `FormElements`.\n * The grid takes twelve tracks when a child sets `width` or `offset`, and\n * otherwise stays the engine's single column. The theme comes from the engine\n * context, with the library default outside a `FormEngineProvider`.\n */\nexport function useChildGridProps(elements: readonly unknown[]): {\n\tclassName: string;\n\t'data-se-theme': string;\n\tstyle: CssVariables;\n} {\n\tconst layout = useOptionalFormEngine()?.engine.getLayout() ?? getDefaultLayoutTheme();\n\treturn {\n\t\tclassName: `se-form-grid ${GRID_CLASS}`,\n\t\t'data-se-theme': layout.id,\n\t\tstyle: getGridVariables(undefined, layout.grid, elements),\n\t};\n}\n"],
5
- "mappings": ";;;;;;;;AAAA,SAAS,YAAY,SAAS,4BAA4B;AAG1D,SAAS,YAAY,uBAAuB,wBAA2C;AA0BhF,SAAS,yBAAmD;AAClE,QAAM,EAAE,QAAQ,IAAI,oBAAoB;AACxC,QAAM,EAAE,SAAS,YAAY,MAAM,IAAI;AAAA,IACtC,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,EACT;AACA,SAAO;AAAA,IACN,OAAO,EAAE,SAAS,OAAO,YAAY,MAAM,QAAQ,MAAM,MAAM,QAAQ,MAAM,MAAM,QAAQ,KAAK;AAAA,IAChG,CAAC,SAAS,SAAS,YAAY,KAAK;AAAA,EACrC;AACD;AAQO,SAAS,iBAA8B;AAC7C,SAAO,oBAAoB,EAAE;AAC9B;AAMO,SAAS,gBAKqD;AACpE,QAAM,UAAU,WAAW,iBAAiB;AAC5C,MAAI,CAAC,SAAS;AACb,UAAM,IAAI,MAAM,wDAAwD;AAAA,EACzE;AACA,SAAO;AACR;AAEO,SAAS,wBAK4D;AAC3E,QAAM,UAAU,WAAW,iBAAiB;AAC5C,SAAO,UAAW,UAAyF;AAC5G;AAWO,SAAS,mBAA2B;AAC1C,UAAQ,sBAAsB,GAAG,OAAO,UAAU,KAAK,sBAAsB,GAAG;AACjF;AAYO,SAAS,kBAAkB,UAIhC;AACD,QAAM,SAAS,sBAAsB,GAAG,OAAO,UAAU,KAAK,sBAAsB;AACpF,SAAO;AAAA,IACN,WAAW,gBAAgB,UAAU;AAAA,IACrC,iBAAiB,OAAO;AAAA,IACxB,OAAO,iBAAiB,QAAW,OAAO,MAAM,QAAQ;AAAA,EACzD;AACD;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/contexts/view-context.tsx"],
4
- "sourcesContent": ["import { createContext, useContext, type ReactNode } from 'react';\nimport type * as z from 'zod/mini';\nimport type { RecipeSlot, ViewModel, ViewNavigation } from '@schema-engine/forms/recipes';\nimport { getSlotConfig } from '@schema-engine/forms/recipes';\n\nexport type { ViewModel as ViewContextValue, ViewNavigation, ViewStep } from '@schema-engine/forms/recipes';\n\nconst ViewContext = createContext<ViewModel | null>(null);\n\nexport function ViewProvider({ children, value }: { children: ReactNode; value: ViewModel }) {\n\treturn <ViewContext.Provider value={value}>{children}</ViewContext.Provider>;\n}\n\nexport function useViewContext(): ViewModel {\n\tconst context = useContext(ViewContext);\n\tif (!context) {\n\t\tthrow new Error('useViewContext must be used within a ViewProvider');\n\t}\n\treturn context;\n}\n\nexport function useOptionalViewContext(): ViewModel | null {\n\treturn useContext(ViewContext);\n}\n\nexport function useActiveStep() {\n\treturn useViewContext().activeStep;\n}\n\nexport function useFormNavigation(): ViewNavigation {\n\treturn useViewContext().navigation;\n}\n\n/** Reads the complete config of one slot, typed by the slot schema's output. */\nexport function useViewConfig<TSchema extends z.ZodMiniType>(slot: RecipeSlot, schema: TSchema): z.output<TSchema> {\n\treturn getSlotConfig(useViewContext().viewConfig, slot, schema);\n}\n"],
5
- "mappings": ";AAAA,SAAS,eAAe,kBAAkC;AAG1D,SAAS,qBAAqB;AAOtB;AAHR,IAAM,cAAc,cAAgC,IAAI;AAEjD,SAAS,aAAa,EAAE,UAAU,MAAM,GAA8C;AAC5F,SAAO,oBAAC,YAAY,UAAZ,EAAqB,OAAe,UAAS;AACtD;AAEO,SAAS,iBAA4B;AAC3C,QAAM,UAAU,WAAW,WAAW;AACtC,MAAI,CAAC,SAAS;AACb,UAAM,IAAI,MAAM,mDAAmD;AAAA,EACpE;AACA,SAAO;AACR;AAEO,SAAS,yBAA2C;AAC1D,SAAO,WAAW,WAAW;AAC9B;AAEO,SAAS,gBAAgB;AAC/B,SAAO,eAAe,EAAE;AACzB;AAEO,SAAS,oBAAoC;AACnD,SAAO,eAAe,EAAE;AACzB;AAGO,SAAS,cAA6C,MAAkB,QAAoC;AAClH,SAAO,cAAc,eAAe,EAAE,YAAY,MAAM,MAAM;AAC/D;",
6
- "names": []
7
- }