@schema-engine/forms-react 0.5.1 → 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.
- package/README.md +7 -7
- package/dist/{chunk-WRJWSEL7.js → chunk-65FTA4N2.js} +1 -1
- package/dist/{chunk-DTJ64NZQ.js → chunk-7SE2EAS6.js} +1 -1
- package/dist/{chunk-ISDPSORR.js → chunk-BLBPZL42.js} +4 -4
- package/dist/{chunk-SED35QJC.js → chunk-CQB4L54B.js} +4 -4
- package/dist/chunk-CQB4L54B.js.map +7 -0
- package/dist/chunk-FV6KW2EK.js +16 -0
- package/dist/chunk-FV6KW2EK.js.map +7 -0
- package/dist/{chunk-AALIXTCD.js → chunk-HBXM7CPI.js} +4 -13
- package/dist/chunk-HBXM7CPI.js.map +7 -0
- package/dist/{chunk-K3LLWGXU.js → chunk-HNUS4XKC.js} +1 -1
- package/dist/{chunk-KG6Q7MNI.js → chunk-HX66MLOM.js} +4 -4
- package/dist/{chunk-QUZN42PL.js → chunk-J5P7HUMV.js} +13 -9
- package/dist/chunk-J5P7HUMV.js.map +7 -0
- package/dist/chunk-KYBOEYMM.js.map +7 -0
- package/dist/chunk-SEWP4GIN.js +34 -0
- package/dist/chunk-SEWP4GIN.js.map +7 -0
- package/dist/{chunk-WFRWVH4X.js → chunk-WJYJ3Q4J.js} +1 -1
- package/dist/components/form-debugger/form-debugger.js +5 -5
- package/dist/components/form-debugger/index.js +5 -5
- package/dist/components/form-provider.js +2 -2
- package/dist/components/index.js +13 -12
- package/dist/components/internals/child-grid.d.ts +43 -0
- package/dist/components/internals/child-grid.js +10 -0
- package/dist/components/internals/child-grid.js.map +7 -0
- package/dist/components/internals/field-renderer.js +8 -8
- package/dist/components/internals/form-elements.js +9 -9
- package/dist/components/internals/form-renderer.js +13 -12
- package/dist/components/internals/grid-container.d.ts +13 -0
- package/dist/components/internals/grid-container.js +9 -0
- package/dist/components/internals/grid-container.js.map +7 -0
- package/dist/components/internals/recipe-renderer.js +5 -5
- package/dist/contexts/index.js +1 -1
- package/dist/contexts/view-context.d.ts +2 -2
- package/dist/contexts/view-context.js +1 -1
- package/dist/hooks/form-state/index.js +7 -7
- package/dist/hooks/form-state/use-form-field.js +2 -2
- package/dist/hooks/index.js +15 -17
- package/dist/hooks/use-field.js +2 -2
- package/dist/hooks/use-form-context.d.ts +4 -36
- package/dist/hooks/use-form-context.js +3 -5
- package/dist/index.js +13 -12
- package/dist/primitives.d.ts +5 -3
- package/dist/primitives.js +14 -9
- package/dist/primitives.js.map +2 -2
- package/package.json +9 -8
- package/skill/SKILL.md +26 -25
- package/skill/reference/forms-react.md +1 -1
- package/dist/chunk-AALIXTCD.js.map +0 -7
- package/dist/chunk-IXRV3YCF.js.map +0 -7
- package/dist/chunk-QUZN42PL.js.map +0 -7
- package/dist/chunk-SED35QJC.js.map +0 -7
- /package/dist/{chunk-WRJWSEL7.js.map → chunk-65FTA4N2.js.map} +0 -0
- /package/dist/{chunk-DTJ64NZQ.js.map → chunk-7SE2EAS6.js.map} +0 -0
- /package/dist/{chunk-ISDPSORR.js.map → chunk-BLBPZL42.js.map} +0 -0
- /package/dist/{chunk-K3LLWGXU.js.map → chunk-HNUS4XKC.js.map} +0 -0
- /package/dist/{chunk-KG6Q7MNI.js.map → chunk-HX66MLOM.js.map} +0 -0
- /package/dist/{chunk-IXRV3YCF.js → chunk-KYBOEYMM.js} +0 -0
- /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-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
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;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RecipeRenderer
|
|
3
|
-
} from "../../chunk-
|
|
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-
|
|
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-
|
|
12
|
+
import "../../chunk-HBXM7CPI.js";
|
|
13
13
|
import "../../chunk-ZWEYALBG.js";
|
|
14
14
|
import "../../chunk-GH2QO3WC.js";
|
|
15
15
|
export {
|
package/dist/contexts/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import type
|
|
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
|
|
14
|
+
export declare function useViewConfig<TSchema extends StandardSchemaV1>(slot: RecipeSlot, schema: TSchema): StandardSchemaV1.InferOutput<TSchema>;
|
|
@@ -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-
|
|
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-
|
|
3
|
+
} from "../../chunk-7SE2EAS6.js";
|
|
4
4
|
import "../../chunk-EYDB6NR6.js";
|
|
5
5
|
import "../../chunk-XWHP2AGG.js";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-HBXM7CPI.js";
|
|
7
7
|
import "../../chunk-ZWEYALBG.js";
|
|
8
8
|
import "../../chunk-GH2QO3WC.js";
|
|
9
9
|
export {
|
package/dist/hooks/index.js
CHANGED
|
@@ -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-
|
|
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-
|
|
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-
|
|
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,
|
package/dist/hooks/use-field.js
CHANGED
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
useFieldAppearanceAttributes,
|
|
4
4
|
useFieldClassName,
|
|
5
5
|
useFieldHost
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-WJYJ3Q4J.js";
|
|
7
7
|
import "../chunk-WOTW7A2I.js";
|
|
8
|
-
import "../chunk-
|
|
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 {
|
|
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
|
-
*
|
|
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
|
|
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-
|
|
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-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
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,
|
package/dist/primitives.d.ts
CHANGED
|
@@ -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
|
|
9
|
-
import type
|
|
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
|
|
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<{}>>>;
|
package/dist/primitives.js
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FormElements
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HNUS4XKC.js";
|
|
4
4
|
import {
|
|
5
5
|
FormElement
|
|
6
|
-
} from "./chunk-
|
|
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-
|
|
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
|
|
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
|
package/dist/primitives.js.map
CHANGED
|
@@ -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
|
|
5
|
-
"mappings": "
|
|
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.
|
|
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/actions": "0.5.
|
|
85
|
-
"@schema-engine/
|
|
86
|
-
"@schema-engine/
|
|
87
|
-
"@schema-engine/
|
|
84
|
+
"@schema-engine/actions": "0.5.2",
|
|
85
|
+
"@schema-engine/layout": "0.5.2",
|
|
86
|
+
"@schema-engine/forms": "0.5.3",
|
|
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.
|
|
94
|
-
"@schema-engine/layout": "^0.5.
|
|
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
|
|
|
@@ -27,7 +27,7 @@ This file is the router. It defines the concepts once; the references assume the
|
|
|
27
27
|
|
|
28
28
|
- **config**: a form is plain data, a `FormConfig` of steps holding elements, each with a `$type`, a `name`, `rules` and `constraints`. `engine.defineForm()` (typed, in TypeScript) or `engine.validateForm(unknown)` (portable JSON) checks it against the engine's registrations and returns a frozen `NormalizedFormConfig` that the engine owns.
|
|
29
29
|
- **container**: the form's state, a `FormStateContainer` from `@schema-engine/forms/state-container`. It owns the nested values, errors, warnings, touched and dirty marks, field-array row ids and the validation in flight. Paths are dotted (`contacts.1.email`) and `FORM_ROOT` is the form itself. Every change is a command (`setValue`, `blur`, `reportNative`, `validate`, `submit`, `reset`, `fieldArray`), and every read is a pure selector over an immutable snapshot.
|
|
30
|
-
- **runtime**: `createFormRuntime` is the lifecycle every renderer shares. It builds the container and owns the submission, the wizard steps and their navigation, `form_mount` and `form_change`, and every action dispatch. A renderer supplies only what an element can do, such as focus.
|
|
30
|
+
- **runtime**: for renderer authors, `createFormRuntime` is the lifecycle every renderer shares, and a renderer creates one for each form it draws. It builds the container and owns the submission, the wizard steps and their navigation, `form_mount` and `form_change`, and every action dispatch. A renderer supplies only what an element can do, such as focus. An app does not create one: it gives the engine and a config to a renderer.
|
|
31
31
|
- **issues and the formatter**: the engine reports what is wrong as an issue (`type`, `source`, `ruleId`, `params`, `message`) and never makes up text. `formatIssue`, a function of the application, turns an issue into the words shown, and falls back to the issue's own `message`.
|
|
32
32
|
|
|
33
33
|
Outcomes use one vocabulary: a check or a submission ends `passed`, `invalid` or `overtaken`. `overtaken` means an edit or a reset outran the check, so there is no verdict and nothing to show.
|
|
@@ -49,31 +49,32 @@ A symbol has one import path. `@schema-engine/forms` has these entries: `.` (the
|
|
|
49
49
|
|
|
50
50
|
Each package ships this router as its own `skill/SKILL.md` and its references in its `skill/reference/` folder, so a reference is `node_modules/@schema-engine/<package>/skill/reference/<file>`, and any installed package has the router. Read the rows of the packages the project depends on and skip the others: a package that is not installed has no file. The deployed site serves the latest version of the router and of every reference at `/skill/`, with the references flat at `/skill/reference/<file>`.
|
|
51
51
|
|
|
52
|
-
| To do
|
|
53
|
-
|
|
|
54
|
-
| Register something, build a registry, or read a YAML document
|
|
55
|
-
| Parse, dispatch or cancel actions outside a form
|
|
56
|
-
| Build a grid, an appearance axis or a layout theme
|
|
57
|
-
| Create an engine, author a config, use the container
|
|
58
|
-
| Add a rule, explain a validation result, or translate messages
|
|
59
|
-
| Handle submit, server errors, CSRF or wizard steps
|
|
60
|
-
| Run code on a form event, or define a form action
|
|
61
|
-
| Render a form in React, or use its hooks
|
|
62
|
-
| Write or change a React field widget, and test it
|
|
63
|
-
| Render a form in Radiant, or reach the container from an element
|
|
64
|
-
| Write or change a Radiant field widget, and test it
|
|
52
|
+
| To do | Package | Reference |
|
|
53
|
+
| ---------------------------------------------------------------- | ------------------------------ | ------------------------------------ |
|
|
54
|
+
| Register something, build a registry, or read a YAML document | `@schema-engine/registry` | `reference/registry.md` |
|
|
55
|
+
| Parse, dispatch or cancel actions outside a form | `@schema-engine/actions` | `reference/actions.md` |
|
|
56
|
+
| Build a grid, an appearance axis or a layout theme | `@schema-engine/layout` | `reference/layout.md` |
|
|
57
|
+
| Create an engine, author a config, or use the container directly | `@schema-engine/forms` | `reference/forms.md` |
|
|
58
|
+
| Add a rule, explain a validation result, or translate messages | `@schema-engine/forms` | `reference/forms-validation.md` |
|
|
59
|
+
| Handle submit, server errors, CSRF or wizard steps | `@schema-engine/forms` | `reference/forms-submission.md` |
|
|
60
|
+
| Run code on a form event, or define a form action | `@schema-engine/forms` | `reference/forms-actions.md` |
|
|
61
|
+
| Render a form in React, or use its hooks | `@schema-engine/forms-react` | `reference/forms-react.md` |
|
|
62
|
+
| Write or change a React field widget, and test it | `@schema-engine/forms-react` | `reference/forms-react-widgets.md` |
|
|
63
|
+
| Render a form in Radiant, or reach the container from an element | `@schema-engine/forms-radiant` | `reference/forms-radiant.md` |
|
|
64
|
+
| Write or change a Radiant field widget, and test it | `@schema-engine/forms-radiant` | `reference/forms-radiant-widgets.md` |
|
|
65
65
|
|
|
66
66
|
## Documentation map
|
|
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, `
|
|
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`).
|