@texaryn/react 0.0.0

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 (82) hide show
  1. package/LICENSE +190 -0
  2. package/dist/components/FormRoot.d.ts +7 -0
  3. package/dist/components/FormRoot.d.ts.map +1 -0
  4. package/dist/components/FormRoot.js +14 -0
  5. package/dist/components/FormRoot.js.map +1 -0
  6. package/dist/components/NodeRenderer.d.ts +15 -0
  7. package/dist/components/NodeRenderer.d.ts.map +1 -0
  8. package/dist/components/NodeRenderer.js +19 -0
  9. package/dist/components/NodeRenderer.js.map +1 -0
  10. package/dist/components/renderer-context.d.ts +17 -0
  11. package/dist/components/renderer-context.d.ts.map +1 -0
  12. package/dist/components/renderer-context.js +10 -0
  13. package/dist/components/renderer-context.js.map +1 -0
  14. package/dist/context.d.ts +5 -0
  15. package/dist/context.d.ts.map +1 -0
  16. package/dist/context.js +11 -0
  17. package/dist/context.js.map +1 -0
  18. package/dist/hooks/use-field-array.d.ts +16 -0
  19. package/dist/hooks/use-field-array.d.ts.map +1 -0
  20. package/dist/hooks/use-field-array.js +27 -0
  21. package/dist/hooks/use-field-array.js.map +1 -0
  22. package/dist/hooks/use-field.d.ts +13 -0
  23. package/dist/hooks/use-field.d.ts.map +1 -0
  24. package/dist/hooks/use-field.js +31 -0
  25. package/dist/hooks/use-field.js.map +1 -0
  26. package/dist/hooks/use-form.d.ts +11 -0
  27. package/dist/hooks/use-form.d.ts.map +1 -0
  28. package/dist/hooks/use-form.js +22 -0
  29. package/dist/hooks/use-form.js.map +1 -0
  30. package/dist/hooks/use-store.d.ts +3 -0
  31. package/dist/hooks/use-store.d.ts.map +1 -0
  32. package/dist/hooks/use-store.js +5 -0
  33. package/dist/hooks/use-store.js.map +1 -0
  34. package/dist/index.d.ts +18 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +11 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/props/field-props.d.ts +72 -0
  39. package/dist/props/field-props.d.ts.map +1 -0
  40. package/dist/props/field-props.js +62 -0
  41. package/dist/props/field-props.js.map +1 -0
  42. package/dist/props/index.d.ts +3 -0
  43. package/dist/props/index.d.ts.map +1 -0
  44. package/dist/props/index.js +2 -0
  45. package/dist/props/index.js.map +1 -0
  46. package/dist/widgets/ArrayControl.d.ts +9 -0
  47. package/dist/widgets/ArrayControl.d.ts.map +1 -0
  48. package/dist/widgets/ArrayControl.js +16 -0
  49. package/dist/widgets/ArrayControl.js.map +1 -0
  50. package/dist/widgets/Checkbox.d.ts +9 -0
  51. package/dist/widgets/Checkbox.d.ts.map +1 -0
  52. package/dist/widgets/Checkbox.js +19 -0
  53. package/dist/widgets/Checkbox.js.map +1 -0
  54. package/dist/widgets/NumberInput.d.ts +9 -0
  55. package/dist/widgets/NumberInput.d.ts.map +1 -0
  56. package/dist/widgets/NumberInput.js +20 -0
  57. package/dist/widgets/NumberInput.js.map +1 -0
  58. package/dist/widgets/ObjectLayout.d.ts +9 -0
  59. package/dist/widgets/ObjectLayout.d.ts.map +1 -0
  60. package/dist/widgets/ObjectLayout.js +17 -0
  61. package/dist/widgets/ObjectLayout.js.map +1 -0
  62. package/dist/widgets/Select.d.ts +9 -0
  63. package/dist/widgets/Select.d.ts.map +1 -0
  64. package/dist/widgets/Select.js +21 -0
  65. package/dist/widgets/Select.js.map +1 -0
  66. package/dist/widgets/TextInput.d.ts +9 -0
  67. package/dist/widgets/TextInput.d.ts.map +1 -0
  68. package/dist/widgets/TextInput.js +16 -0
  69. package/dist/widgets/TextInput.js.map +1 -0
  70. package/dist/widgets/Textarea.d.ts +9 -0
  71. package/dist/widgets/Textarea.d.ts.map +1 -0
  72. package/dist/widgets/Textarea.js +16 -0
  73. package/dist/widgets/Textarea.js.map +1 -0
  74. package/dist/widgets/default-registry.d.ts +4 -0
  75. package/dist/widgets/default-registry.d.ts.map +1 -0
  76. package/dist/widgets/default-registry.js +46 -0
  77. package/dist/widgets/default-registry.js.map +1 -0
  78. package/dist/widgets/index.d.ts +9 -0
  79. package/dist/widgets/index.d.ts.map +1 -0
  80. package/dist/widgets/index.js +9 -0
  81. package/dist/widgets/index.js.map +1 -0
  82. package/package.json +47 -0
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2024-2026 Hamza Hamidi
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,7 @@
1
+ import type { RendererRegistry } from '@texaryn/core';
2
+ import type { WidgetComponent } from './renderer-context.js';
3
+ export interface FormRootProps {
4
+ registry: RendererRegistry<WidgetComponent>;
5
+ }
6
+ export declare function FormRoot({ registry }: FormRootProps): import("react").JSX.Element | null;
7
+ //# sourceMappingURL=FormRoot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormRoot.d.ts","sourceRoot":"","sources":["../../src/components/FormRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAIrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE5D,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAA;CAC5C;AAED,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,aAAa,sCAUnD"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useFormContext } from '../context.js';
3
+ import { useStore } from '../hooks/use-store.js';
4
+ import { NodeRenderer } from './NodeRenderer.js';
5
+ export function FormRoot({ registry }) {
6
+ const runtime = useFormContext();
7
+ const document = useStore(runtime.document);
8
+ const rootNode = document.nodes[document.rootId];
9
+ if (!rootNode) {
10
+ return null;
11
+ }
12
+ return _jsx(NodeRenderer, { node: rootNode, document: document, registry: registry });
13
+ }
14
+ //# sourceMappingURL=FormRoot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormRoot.js","sourceRoot":"","sources":["../../src/components/FormRoot.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAOhD,MAAM,UAAU,QAAQ,CAAC,EAAE,QAAQ,EAAiB;IAClD,MAAM,OAAO,GAAG,cAAc,EAAE,CAAA;IAChC,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC3C,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAEhD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,KAAC,YAAY,IAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAA;AACjF,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { UIDocument, UINode, RendererRegistry } from '@texaryn/core';
2
+ import { type WidgetComponent } from './renderer-context.js';
3
+ export interface NodeRendererProps {
4
+ node: UINode;
5
+ document: UIDocument;
6
+ registry: RendererRegistry<WidgetComponent>;
7
+ }
8
+ /**
9
+ * Compiling a schema with `active: false` produces a node with
10
+ * `visible: false`. That is the source of truth for hiding a node, so it is
11
+ * read straight off the document rather than through useField, which would
12
+ * cost a hook subscription for a subtree that never renders.
13
+ */
14
+ export declare function NodeRenderer({ node, document, registry }: NodeRendererProps): import("react").JSX.Element | null;
15
+ //# sourceMappingURL=NodeRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodeRenderer.d.ts","sourceRoot":"","sources":["../../src/components/NodeRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACzE,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE7E,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,UAAU,CAAA;IACpB,QAAQ,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAA;CAC5C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,iBAAiB,sCAe3E"}
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { RendererContext } from './renderer-context.js';
3
+ /**
4
+ * Compiling a schema with `active: false` produces a node with
5
+ * `visible: false`. That is the source of truth for hiding a node, so it is
6
+ * read straight off the document rather than through useField, which would
7
+ * cost a hook subscription for a subtree that never renders.
8
+ */
9
+ export function NodeRenderer({ node, document, registry }) {
10
+ if (!node.visible) {
11
+ return null;
12
+ }
13
+ const Widget = registry.resolve(node);
14
+ if (!Widget) {
15
+ return null;
16
+ }
17
+ return (_jsx(RendererContext.Provider, { value: { document, registry }, children: _jsx(Widget, { node: node }) }));
18
+ }
19
+ //# sourceMappingURL=NodeRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodeRenderer.js","sourceRoot":"","sources":["../../src/components/NodeRenderer.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAwB,MAAM,uBAAuB,CAAA;AAQ7E;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAqB;IAC1E,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,KAAC,eAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,YACrD,KAAC,MAAM,IAAC,IAAI,EAAE,IAAI,GAAI,GACG,CAC5B,CAAA;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { ComponentType } from 'react';
2
+ import type { UIDocument, UINode, RendererRegistry } from '@texaryn/core';
3
+ /**
4
+ * A widget component only ever receives the node it renders. Container
5
+ * widgets recover the document and registry from RendererContext instead,
6
+ * because RendererRegistry<T> fixes the widget prop shape to `{ node }`.
7
+ */
8
+ export type WidgetComponent = ComponentType<{
9
+ node: UINode;
10
+ }>;
11
+ export interface RendererContextValue {
12
+ document: UIDocument;
13
+ registry: RendererRegistry<WidgetComponent>;
14
+ }
15
+ export declare const RendererContext: import("react").Context<RendererContextValue | null>;
16
+ export declare function useRendererContext(): RendererContextValue;
17
+ //# sourceMappingURL=renderer-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer-context.d.ts","sourceRoot":"","sources":["../../src/components/renderer-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEzE;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAE7D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,UAAU,CAAA;IACpB,QAAQ,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAA;CAC5C;AAED,eAAO,MAAM,eAAe,sDAAmD,CAAA;AAE/E,wBAAgB,kBAAkB,IAAI,oBAAoB,CAMzD"}
@@ -0,0 +1,10 @@
1
+ import { createContext, useContext } from 'react';
2
+ export const RendererContext = createContext(null);
3
+ export function useRendererContext() {
4
+ const value = useContext(RendererContext);
5
+ if (!value) {
6
+ throw new Error('useRendererContext must be used within a NodeRenderer/FormRoot tree');
7
+ }
8
+ return value;
9
+ }
10
+ //# sourceMappingURL=renderer-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer-context.js","sourceRoot":"","sources":["../../src/components/renderer-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAgBjD,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAA8B,IAAI,CAAC,CAAA;AAE/E,MAAM,UAAU,kBAAkB;IAChC,MAAM,KAAK,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;IACzC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAA;IACxF,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { FormRuntime } from '@texaryn/core';
2
+ export declare const FormContext: import("react").Context<FormRuntime | null>;
3
+ export declare const FormProvider: import("react").Provider<FormRuntime | null>;
4
+ export declare function useFormContext(): FormRuntime;
5
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,eAAO,MAAM,WAAW,6CAA0C,CAAA;AAElE,eAAO,MAAM,YAAY,8CAAuB,CAAA;AAEhD,wBAAgB,cAAc,IAAI,WAAW,CAM5C"}
@@ -0,0 +1,11 @@
1
+ import { createContext, useContext } from 'react';
2
+ export const FormContext = createContext(null);
3
+ export const FormProvider = FormContext.Provider;
4
+ export function useFormContext() {
5
+ const runtime = useContext(FormContext);
6
+ if (!runtime) {
7
+ throw new Error('useFormContext must be used within a FormProvider');
8
+ }
9
+ return runtime;
10
+ }
11
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGjD,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAqB,IAAI,CAAC,CAAA;AAElE,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC,QAAQ,CAAA;AAEhD,MAAM,UAAU,cAAc;IAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAAA;IACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAA;IACtE,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { NodeId, StableItemId } from '@texaryn/core';
2
+ export interface FieldArrayItem {
3
+ id: StableItemId;
4
+ nodeId: NodeId | undefined;
5
+ }
6
+ export interface UseFieldArrayReturn {
7
+ items: FieldArrayItem[];
8
+ canAdd: boolean;
9
+ canRemove: boolean;
10
+ canReorder: boolean;
11
+ add(value?: unknown): void;
12
+ remove(index: number): void;
13
+ move(from: number, to: number): void;
14
+ }
15
+ export declare function useFieldArray(nodeId: NodeId): UseFieldArrayReturn;
16
+ //# sourceMappingURL=use-field-array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-field-array.d.ts","sourceRoot":"","sources":["../../src/hooks/use-field-array.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,MAAM,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAIxE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,YAAY,CAAA;IAGhB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,OAAO,CAAA;IACnB,GAAG,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IAC1B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;CACrC;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAsCjE"}
@@ -0,0 +1,27 @@
1
+ import { useCallback } from 'react';
2
+ import { useFormContext } from '../context.js';
3
+ import { useStore } from './use-store.js';
4
+ export function useFieldArray(nodeId) {
5
+ const runtime = useFormContext();
6
+ const document = useStore(runtime.document);
7
+ const node = document.nodes[nodeId];
8
+ const containerNode = node?.type === 'container' && node.containerType === 'array'
9
+ ? node
10
+ : undefined;
11
+ const items = containerNode?.arrayMeta
12
+ ? containerNode.arrayMeta.itemIds.map((id, index) => ({
13
+ id,
14
+ nodeId: containerNode.children[index],
15
+ }))
16
+ : [];
17
+ const canAdd = containerNode?.arrayMeta?.canAdd ?? false;
18
+ const canRemove = containerNode?.arrayMeta?.canRemove ?? false;
19
+ const canReorder = containerNode?.arrayMeta?.canReorder ?? false;
20
+ const add = useCallback((value) => {
21
+ runtime.dispatch({ type: 'InsertItem', containerId: nodeId, index: items.length, value });
22
+ }, [runtime, nodeId, items.length]);
23
+ const remove = useCallback((index) => { runtime.dispatch({ type: 'RemoveItem', containerId: nodeId, index }); }, [runtime, nodeId]);
24
+ const move = useCallback((from, to) => { runtime.dispatch({ type: 'MoveItem', containerId: nodeId, from, to }); }, [runtime, nodeId]);
25
+ return { items, canAdd, canRemove, canReorder, add, remove, move };
26
+ }
27
+ //# sourceMappingURL=use-field-array.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-field-array.js","sourceRoot":"","sources":["../../src/hooks/use-field-array.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAmBzC,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,MAAM,OAAO,GAAG,cAAc,EAAE,CAAA;IAChC,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAE3C,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IACnC,MAAM,aAAa,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,IAAI,IAAI,CAAC,aAAa,KAAK,OAAO;QAChF,CAAC,CAAE,IAAsB;QACzB,CAAC,CAAC,SAAS,CAAA;IAEb,MAAM,KAAK,GAAqB,aAAa,EAAE,SAAS;QACtD,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YAClD,EAAE;YACF,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC;SACtC,CAAC,CAAC;QACL,CAAC,CAAC,EAAE,CAAA;IAEN,MAAM,MAAM,GAAG,aAAa,EAAE,SAAS,EAAE,MAAM,IAAI,KAAK,CAAA;IACxD,MAAM,SAAS,GAAG,aAAa,EAAE,SAAS,EAAE,SAAS,IAAI,KAAK,CAAA;IAC9D,MAAM,UAAU,GAAG,aAAa,EAAE,SAAS,EAAE,UAAU,IAAI,KAAK,CAAA;IAEhE,MAAM,GAAG,GAAG,WAAW,CACrB,CAAC,KAAe,EAAE,EAAE;QAClB,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;IAC3F,CAAC,EACD,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAChC,CAAA;IAED,MAAM,MAAM,GAAG,WAAW,CACxB,CAAC,KAAa,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA,CAAC,CAAC,EAC3F,CAAC,OAAO,EAAE,MAAM,CAAC,CAClB,CAAA;IAED,MAAM,IAAI,GAAG,WAAW,CACtB,CAAC,IAAY,EAAE,EAAU,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAA,CAAC,CAAC,EACvG,CAAC,OAAO,EAAE,MAAM,CAAC,CAClB,CAAA;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AACpE,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { NodeId, ValidationError } from '@texaryn/core';
2
+ export interface UseFieldReturn {
3
+ value: unknown;
4
+ errors: ValidationError[];
5
+ dirty: boolean;
6
+ touched: boolean;
7
+ visible: boolean;
8
+ disabled: boolean;
9
+ onChange(value: unknown): void;
10
+ onBlur(): void;
11
+ }
12
+ export declare function useField(nodeId: NodeId): UseFieldReturn;
13
+ //# sourceMappingURL=use-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-field.d.ts","sourceRoot":"","sources":["../../src/hooks/use-field.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAI5D,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,OAAO,CAAA;IACd,MAAM,EAAE,eAAe,EAAE,CAAA;IACzB,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;IAC9B,MAAM,IAAI,IAAI,CAAA;CACf;AAaD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAyBvD"}
@@ -0,0 +1,31 @@
1
+ import { useCallback } from 'react';
2
+ import { createStore } from '@texaryn/core';
3
+ import { useFormContext } from '../context.js';
4
+ import { useStore } from './use-store.js';
5
+ // Module-level singletons so useStore always receives the same store
6
+ // reference for a missing node, keeping useSyncExternalStore stable
7
+ // across renders instead of resubscribing to a fresh store every time.
8
+ const FALLBACK_VALUE = createStore(undefined);
9
+ const FALLBACK_ERRORS = createStore([]);
10
+ const FALLBACK_DIRTY = createStore(false);
11
+ const FALLBACK_TOUCHED = createStore(false);
12
+ const FALLBACK_VISIBLE = createStore(true);
13
+ const FALLBACK_DISABLED = createStore(false);
14
+ const FALLBACK_VALIDATION_STATUS = createStore('idle');
15
+ export function useField(nodeId) {
16
+ const runtime = useFormContext();
17
+ const nodeState = runtime.getNodeState(nodeId);
18
+ const value = useStore(nodeState?.value ?? FALLBACK_VALUE);
19
+ const errors = useStore(nodeState?.errors ?? FALLBACK_ERRORS);
20
+ const dirty = useStore(nodeState?.dirty ?? FALLBACK_DIRTY);
21
+ const touched = useStore(nodeState?.touched ?? FALLBACK_TOUCHED);
22
+ const visible = useStore(nodeState?.visible ?? FALLBACK_VISIBLE);
23
+ const disabled = useStore(nodeState?.disabled ?? FALLBACK_DISABLED);
24
+ // Subscribed for re-render parity with the other six node stores, even
25
+ // though validation status is not part of this hook's return value.
26
+ useStore(nodeState?.validationStatus ?? FALLBACK_VALIDATION_STATUS);
27
+ const onChange = useCallback((newValue) => { runtime.dispatch({ type: 'SetValue', nodeId, value: newValue }); }, [runtime, nodeId]);
28
+ const onBlur = useCallback(() => { runtime.dispatch({ type: 'SetTouched', nodeId }); }, [runtime, nodeId]);
29
+ return { value, errors, dirty, touched, visible, disabled, onChange, onBlur };
30
+ }
31
+ //# sourceMappingURL=use-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-field.js","sourceRoot":"","sources":["../../src/hooks/use-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAazC,qEAAqE;AACrE,oEAAoE;AACpE,uEAAuE;AACvE,MAAM,cAAc,GAAG,WAAW,CAAU,SAAS,CAAC,CAAA;AACtD,MAAM,eAAe,GAAG,WAAW,CAAoB,EAAE,CAAC,CAAA;AAC1D,MAAM,cAAc,GAAG,WAAW,CAAC,KAAK,CAAC,CAAA;AACzC,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,CAAC,CAAA;AAC3C,MAAM,gBAAgB,GAAG,WAAW,CAAC,IAAI,CAAC,CAAA;AAC1C,MAAM,iBAAiB,GAAG,WAAW,CAAC,KAAK,CAAC,CAAA;AAC5C,MAAM,0BAA0B,GAAG,WAAW,CAA2C,MAAM,CAAC,CAAA;AAEhG,MAAM,UAAU,QAAQ,CAAC,MAAc;IACrC,MAAM,OAAO,GAAG,cAAc,EAAE,CAAA;IAChC,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;IAE9C,MAAM,KAAK,GAAG,QAAQ,CAAC,SAAS,EAAE,KAAK,IAAI,cAAc,CAAC,CAAA;IAC1D,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,EAAE,MAAM,IAAI,eAAe,CAAC,CAAA;IAC7D,MAAM,KAAK,GAAG,QAAQ,CAAC,SAAS,EAAE,KAAK,IAAI,cAAc,CAAC,CAAA;IAC1D,MAAM,OAAO,GAAG,QAAQ,CAAC,SAAS,EAAE,OAAO,IAAI,gBAAgB,CAAC,CAAA;IAChE,MAAM,OAAO,GAAG,QAAQ,CAAC,SAAS,EAAE,OAAO,IAAI,gBAAgB,CAAC,CAAA;IAChE,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,EAAE,QAAQ,IAAI,iBAAiB,CAAC,CAAA;IACnE,uEAAuE;IACvE,oEAAoE;IACpE,QAAQ,CAAC,SAAS,EAAE,gBAAgB,IAAI,0BAA0B,CAAC,CAAA;IAEnE,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,QAAiB,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAA,CAAC,CAAC,EAC1F,CAAC,OAAO,EAAE,MAAM,CAAC,CAClB,CAAA;IAED,MAAM,MAAM,GAAG,WAAW,CACxB,GAAG,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAA,CAAC,CAAC,EAC1D,CAAC,OAAO,EAAE,MAAM,CAAC,CAClB,CAAA;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;AAC/E,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Command, FormRuntime, FormRuntimeOptions, NodeId, NodeState, SchemaEvaluationPort, SubmissionState, UIDocument } from '@texaryn/core';
2
+ export interface UseFormReturn {
3
+ runtime: FormRuntime;
4
+ document: UIDocument;
5
+ data: unknown;
6
+ submission: SubmissionState;
7
+ dispatch(command: Command): void;
8
+ getNodeState(nodeId: NodeId): NodeState | undefined;
9
+ }
10
+ export declare function useForm(port: SchemaEvaluationPort, options?: FormRuntimeOptions): UseFormReturn;
11
+ //# sourceMappingURL=use-form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["../../src/hooks/use-form.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,oBAAoB,EACpB,eAAe,EACf,UAAU,EACX,MAAM,eAAe,CAAA;AAGtB,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,WAAW,CAAA;IACpB,QAAQ,EAAE,UAAU,CAAA;IACpB,IAAI,EAAE,OAAO,CAAA;IACb,UAAU,EAAE,eAAe,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IAChC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;CACpD;AAED,wBAAgB,OAAO,CACrB,IAAI,EAAE,oBAAoB,EAC1B,OAAO,CAAC,EAAE,kBAAkB,GAC3B,aAAa,CA4Bf"}
@@ -0,0 +1,22 @@
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+ import { createFormRuntime } from '@texaryn/core';
3
+ import { useStore } from './use-store.js';
4
+ export function useForm(port, options) {
5
+ const runtimeRef = useRef(null);
6
+ if (runtimeRef.current === null) {
7
+ runtimeRef.current = createFormRuntime(port, options);
8
+ }
9
+ const runtime = runtimeRef.current;
10
+ useEffect(() => {
11
+ return () => {
12
+ runtime.destroy();
13
+ };
14
+ }, [runtime]);
15
+ const document = useStore(runtime.document);
16
+ const data = useStore(runtime.data);
17
+ const submission = useStore(runtime.submission);
18
+ const dispatch = useCallback((command) => { runtime.dispatch(command); }, [runtime]);
19
+ const getNodeState = useCallback((nodeId) => runtime.getNodeState(nodeId), [runtime]);
20
+ return { runtime, document, data, submission, dispatch, getNodeState };
21
+ }
22
+ //# sourceMappingURL=use-form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-form.js","sourceRoot":"","sources":["../../src/hooks/use-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAWjD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAWzC,MAAM,UAAU,OAAO,CACrB,IAA0B,EAC1B,OAA4B;IAE5B,MAAM,UAAU,GAAG,MAAM,CAAqB,IAAI,CAAC,CAAA;IACnD,IAAI,UAAU,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QAChC,UAAU,CAAC,OAAO,GAAG,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACvD,CAAC;IACD,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAA;IAElC,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,OAAO,EAAE,CAAA;QACnB,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAEb,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC3C,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IAE/C,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,OAAgB,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA,CAAC,CAAC,EACnD,CAAC,OAAO,CAAC,CACV,CAAA;IAED,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,MAAc,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,EAChD,CAAC,OAAO,CAAC,CACV,CAAA;IAED,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAA;AACxE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Store } from '@texaryn/core';
2
+ export declare function useStore<T>(store: Store<T>): T;
3
+ //# sourceMappingURL=use-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-store.d.ts","sourceRoot":"","sources":["../../src/hooks/use-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAE9C"}
@@ -0,0 +1,5 @@
1
+ import { useSyncExternalStore } from 'react';
2
+ export function useStore(store) {
3
+ return useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
4
+ }
5
+ //# sourceMappingURL=use-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-store.js","sourceRoot":"","sources":["../../src/hooks/use-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAG5C,MAAM,UAAU,QAAQ,CAAI,KAAe;IACzC,OAAO,oBAAoB,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,CAAA;AACpF,CAAC"}
@@ -0,0 +1,18 @@
1
+ export { useStore } from './hooks/use-store.js';
2
+ export { useForm } from './hooks/use-form.js';
3
+ export type { UseFormReturn } from './hooks/use-form.js';
4
+ export { useField } from './hooks/use-field.js';
5
+ export type { UseFieldReturn } from './hooks/use-field.js';
6
+ export { useFieldArray } from './hooks/use-field-array.js';
7
+ export type { UseFieldArrayReturn } from './hooks/use-field-array.js';
8
+ export { FormContext, FormProvider, useFormContext } from './context.js';
9
+ export { getInputProps, getLabelProps, getErrorProps, getDescriptionProps } from './props/index.js';
10
+ export type { InputProps, LabelProps, ErrorProps, DescriptionProps, FieldState } from './props/index.js';
11
+ export { FormRoot } from './components/FormRoot.js';
12
+ export type { FormRootProps } from './components/FormRoot.js';
13
+ export { NodeRenderer } from './components/NodeRenderer.js';
14
+ export type { NodeRendererProps } from './components/NodeRenderer.js';
15
+ export { useRendererContext } from './components/renderer-context.js';
16
+ export type { WidgetComponent, RendererContextValue } from './components/renderer-context.js';
17
+ export { TextInput, NumberInput, Checkbox, Select, Textarea, ObjectLayout, ArrayControl, createDefaultRegistry, } from './widgets/index.js';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,YAAY,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AACxE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACnG,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxG,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACnD,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,YAAY,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AAC7F,OAAO,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,qBAAqB,GACtB,MAAM,oBAAoB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ export { useStore } from './hooks/use-store.js';
2
+ export { useForm } from './hooks/use-form.js';
3
+ export { useField } from './hooks/use-field.js';
4
+ export { useFieldArray } from './hooks/use-field-array.js';
5
+ export { FormContext, FormProvider, useFormContext } from './context.js';
6
+ export { getInputProps, getLabelProps, getErrorProps, getDescriptionProps } from './props/index.js';
7
+ export { FormRoot } from './components/FormRoot.js';
8
+ export { NodeRenderer } from './components/NodeRenderer.js';
9
+ export { useRendererContext } from './components/renderer-context.js';
10
+ export { TextInput, NumberInput, Checkbox, Select, Textarea, ObjectLayout, ArrayControl, createDefaultRegistry, } from './widgets/index.js';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE1D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AACxE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAEnG,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAErE,OAAO,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,qBAAqB,GACtB,MAAM,oBAAoB,CAAA"}
@@ -0,0 +1,72 @@
1
+ import type { FieldNode } from '@texaryn/core';
2
+ /**
3
+ * Field state shape (from useField hook return)
4
+ */
5
+ export interface FieldState {
6
+ value: unknown;
7
+ errors: Array<{
8
+ instancePointer: string;
9
+ keyword: string;
10
+ message?: string;
11
+ params: Record<string, unknown>;
12
+ }>;
13
+ dirty: boolean;
14
+ touched: boolean;
15
+ visible: boolean;
16
+ disabled: boolean;
17
+ onChange: (value: unknown) => void;
18
+ onBlur: () => void;
19
+ }
20
+ /**
21
+ * HTML/ARIA attributes for an input element
22
+ */
23
+ export interface InputProps extends Record<string, unknown> {
24
+ id: string;
25
+ name: string;
26
+ value: unknown;
27
+ disabled: boolean;
28
+ 'aria-required': boolean;
29
+ 'aria-invalid': boolean;
30
+ 'aria-describedby'?: string;
31
+ onChange: (value: unknown) => void;
32
+ onBlur: () => void;
33
+ }
34
+ /**
35
+ * HTML/ARIA attributes for a label element
36
+ */
37
+ export interface LabelProps extends Record<string, unknown> {
38
+ id: string;
39
+ htmlFor: string;
40
+ }
41
+ /**
42
+ * HTML/ARIA attributes for an error container
43
+ */
44
+ export interface ErrorProps extends Record<string, unknown> {
45
+ id: string;
46
+ role: 'alert';
47
+ 'aria-live': 'polite';
48
+ }
49
+ /**
50
+ * HTML/ARIA attributes for a description element
51
+ */
52
+ export interface DescriptionProps extends Record<string, unknown> {
53
+ id: string;
54
+ }
55
+ /**
56
+ * getInputProps: Returns ARIA-correct props for an input element
57
+ * Includes id, name, value, disabled, aria-required, aria-invalid, aria-describedby
58
+ */
59
+ export declare function getInputProps(node: FieldNode, fieldState: FieldState): InputProps;
60
+ /**
61
+ * getLabelProps: Returns ARIA-correct props for a label element
62
+ */
63
+ export declare function getLabelProps(node: FieldNode): LabelProps;
64
+ /**
65
+ * getErrorProps: Returns ARIA-correct props for an error container
66
+ */
67
+ export declare function getErrorProps(node: FieldNode): ErrorProps;
68
+ /**
69
+ * getDescriptionProps: Returns ARIA-correct props for a description element
70
+ */
71
+ export declare function getDescriptionProps(node: FieldNode): DescriptionProps;
72
+ //# sourceMappingURL=field-props.d.ts.map