@reformer/core 11.0.0-beta.8 → 11.0.0-beta.9

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 (224) hide show
  1. package/README.md +91 -73
  2. package/dist/behaviors-value-HA_Q03hc.js +108 -0
  3. package/dist/behaviors.js +370 -242
  4. package/dist/{create-model-BBRHhHwK.js → create-model-BvcbNPgL.js} +6 -6
  5. package/dist/date-utils-90-qZbse.js +43 -0
  6. package/dist/{en-CjAqn7h0.js → en-HP8XEych.js} +6 -3
  7. package/dist/form/aggregate-signals.d.ts +21 -63
  8. package/dist/form/behaviors/collections.d.ts +28 -7
  9. package/dist/form/behaviors/context.d.ts +19 -2
  10. package/dist/form/behaviors/index.d.ts +3 -3
  11. package/dist/form/behaviors/internals.d.ts +9 -2
  12. package/dist/form/behaviors/node.d.ts +25 -2
  13. package/dist/form/behaviors/operators.d.ts +17 -9
  14. package/dist/form/behaviors/schema-operators.d.ts +6 -4
  15. package/dist/form/behaviors/types.d.ts +12 -4
  16. package/dist/form/create-form.d.ts +47 -35
  17. package/dist/form/flow/flow.d.ts +87 -0
  18. package/dist/form/form-bundle.d.ts +45 -28
  19. package/dist/form/form-config-base.d.ts +46 -0
  20. package/dist/form/form-level.d.ts +121 -0
  21. package/dist/form/form-proxy-builder.d.ts +6 -22
  22. package/dist/form/index.d.ts +16 -21
  23. package/dist/form/nodes/form-array-node.d.ts +100 -0
  24. package/dist/form/nodes/form-control-node.d.ts +73 -0
  25. package/dist/form/nodes/form-group-node.d.ts +66 -0
  26. package/dist/form/nodes/node-kind.d.ts +29 -0
  27. package/dist/form/nodes/state/availability.d.ts +6 -0
  28. package/dist/form/nodes/state/component.d.ts +6 -0
  29. package/dist/form/nodes/state/index.d.ts +12 -0
  30. package/dist/form/nodes/state/interaction.d.ts +13 -0
  31. package/dist/form/nodes/state/issues.d.ts +9 -0
  32. package/dist/form/nodes/state/pending.d.ts +6 -0
  33. package/dist/form/schema/compile.d.ts +59 -0
  34. package/dist/form/schema/compiled.d.ts +143 -0
  35. package/dist/form/schema/row-key.d.ts +11 -0
  36. package/dist/form/schema-controller.d.ts +30 -14
  37. package/dist/form/signal-node-registry.d.ts +6 -7
  38. package/dist/form/submission.d.ts +93 -0
  39. package/dist/form/type-guards.d.ts +14 -73
  40. package/dist/form/types/contracts.d.ts +19 -92
  41. package/dist/form/types/field-config.d.ts +27 -0
  42. package/dist/form/types/index.d.ts +5 -57
  43. package/dist/form/types/nodes.d.ts +159 -0
  44. package/dist/form/types/schema-node.d.ts +139 -63
  45. package/dist/form/types/validation-schema.d.ts +23 -27
  46. package/dist/form/validation/context.d.ts +42 -7
  47. package/dist/form/validation/index.d.ts +9 -8
  48. package/dist/form/validation/operators.d.ts +22 -30
  49. package/dist/form/validation/run.d.ts +93 -18
  50. package/dist/form/validation/strategy.d.ts +41 -13
  51. package/dist/form/validation/types.d.ts +74 -20
  52. package/dist/form/validators/date-utils.d.ts +13 -1
  53. package/dist/form/validators/email.d.ts +8 -7
  54. package/dist/form/validators/file-type.d.ts +8 -7
  55. package/dist/form/validators/file-utils.d.ts +2 -1
  56. package/dist/form/validators/future-date.d.ts +8 -7
  57. package/dist/form/validators/index.d.ts +1 -1
  58. package/dist/form/validators/integer.d.ts +8 -7
  59. package/dist/form/validators/is-date.d.ts +11 -9
  60. package/dist/form/validators/is-number.d.ts +11 -9
  61. package/dist/form/validators/max-age.d.ts +13 -9
  62. package/dist/form/validators/max-date.d.ts +8 -7
  63. package/dist/form/validators/max-file-size.d.ts +8 -7
  64. package/dist/form/validators/max-files.d.ts +8 -7
  65. package/dist/form/validators/max-length.d.ts +14 -7
  66. package/dist/form/validators/max-total-file-size.d.ts +8 -7
  67. package/dist/form/validators/max.d.ts +10 -8
  68. package/dist/form/validators/min-age.d.ts +12 -9
  69. package/dist/form/validators/min-date.d.ts +8 -7
  70. package/dist/form/validators/min-file-size.d.ts +8 -7
  71. package/dist/form/validators/min-files.d.ts +11 -9
  72. package/dist/form/validators/min-length.d.ts +14 -7
  73. package/dist/form/validators/min.d.ts +10 -8
  74. package/dist/form/validators/multiple-of.d.ts +10 -8
  75. package/dist/form/validators/non-negative.d.ts +8 -7
  76. package/dist/form/validators/non-zero.d.ts +8 -7
  77. package/dist/form/validators/past-date.d.ts +8 -7
  78. package/dist/form/validators/pattern.d.ts +9 -8
  79. package/dist/form/validators/phone.d.ts +8 -7
  80. package/dist/form/validators/required.d.ts +11 -9
  81. package/dist/form/validators/url.d.ts +20 -13
  82. package/dist/form/validators/validation-issue.d.ts +8 -0
  83. package/dist/i18n/descriptor.d.ts +1 -1
  84. package/dist/i18n/en.json.d.ts +5 -1
  85. package/dist/i18n/locale-store.d.ts +7 -0
  86. package/dist/i18n/message-format.d.ts +24 -4
  87. package/dist/i18n/ru.json.d.ts +5 -1
  88. package/dist/i18n/translator.d.ts +11 -0
  89. package/dist/i18n/validation-message.d.ts +42 -7
  90. package/dist/i18n.d.ts +7 -12
  91. package/dist/i18n.js +66 -283
  92. package/dist/index.d.ts +16 -7
  93. package/dist/index.js +924 -2855
  94. package/dist/loader-BWkigpVe.js +52 -0
  95. package/dist/locale/en.js +1 -1
  96. package/dist/locale/en.json +4 -1
  97. package/dist/locale/ru.js +4 -1
  98. package/dist/locale/ru.json +4 -1
  99. package/dist/locale-CG54AU2Q.js +219 -0
  100. package/dist/locale.js +1 -1
  101. package/dist/model/behaviors-value.d.ts +24 -6
  102. package/dist/model/create-model.d.ts +2 -2
  103. package/dist/model/derived-registry.d.ts +1 -1
  104. package/dist/model/index.d.ts +11 -5
  105. package/dist/model/model-nodes.d.ts +79 -12
  106. package/dist/model/model-signals-proxy.d.ts +5 -6
  107. package/dist/model/model-value-proxy.d.ts +20 -15
  108. package/dist/model/safe-effect.d.ts +33 -1
  109. package/dist/model/types.d.ts +63 -13
  110. package/dist/model.js +20 -18
  111. package/dist/node-kind-C-r6ZMdo.js +15 -0
  112. package/dist/platforms/react/field-binding/field-adapter.d.ts +1 -1
  113. package/dist/platforms/react/field-binding/field-handle.d.ts +5 -2
  114. package/dist/platforms/react/form-bundle-context.d.ts +2 -2
  115. package/dist/platforms/react/hooks/types.d.ts +57 -38
  116. package/dist/platforms/react/hooks/use-form-bundle.d.ts +19 -4
  117. package/dist/platforms/react/hooks/use-form-flow.d.ts +40 -0
  118. package/dist/platforms/react/hooks/use-form-validation.d.ts +12 -6
  119. package/dist/platforms/react/hooks/useArrayLength.d.ts +6 -6
  120. package/dist/platforms/react/hooks/useFormControl.d.ts +7 -9
  121. package/dist/platforms/react/hooks/useFormControlValue.d.ts +18 -19
  122. package/dist/platforms/react/hooks/useSignalSubscription.d.ts +9 -1
  123. package/dist/platforms/react/i18n/context.d.ts +6 -1
  124. package/dist/platforms/react/i18n/hooks.d.ts +16 -10
  125. package/dist/platforms/react/i18n/provider.d.ts +9 -2
  126. package/dist/platforms/react/index.d.ts +6 -4
  127. package/dist/react.d.ts +22 -0
  128. package/dist/react.js +505 -0
  129. package/dist/runtime-token.d.ts +1 -2
  130. package/dist/safe-effect-BbtX3KuN.js +643 -0
  131. package/dist/schema-controller-CpiO2JoK.js +143 -0
  132. package/dist/signals.d.ts +15 -9
  133. package/dist/signals.js +11 -6
  134. package/dist/strategy-CoFSemuP.js +375 -0
  135. package/dist/type-guards-D-N_5Ddh.js +19 -0
  136. package/dist/validation-issue-B9mjI8jz.js +7 -0
  137. package/dist/validation-message-Ced9MGxs.js +194 -0
  138. package/dist/validation.js +9 -9
  139. package/dist/validators/email.js +5 -5
  140. package/dist/validators/future-date.js +8 -8
  141. package/dist/validators/integer.js +3 -3
  142. package/dist/validators/is-date.js +4 -4
  143. package/dist/validators/is-number.js +4 -4
  144. package/dist/validators/max-age.js +8 -9
  145. package/dist/validators/max-date.js +8 -8
  146. package/dist/validators/max-length.js +7 -7
  147. package/dist/validators/max.js +4 -4
  148. package/dist/validators/min-age.js +10 -8
  149. package/dist/validators/min-date.js +3 -3
  150. package/dist/validators/min-length.js +5 -5
  151. package/dist/validators/min.js +4 -4
  152. package/dist/validators/multiple-of.js +11 -7
  153. package/dist/validators/non-negative.js +3 -3
  154. package/dist/validators/non-zero.js +3 -3
  155. package/dist/validators/past-date.js +8 -8
  156. package/dist/validators/pattern.js +5 -5
  157. package/dist/validators/phone.js +11 -9
  158. package/dist/validators/required.js +2 -2
  159. package/dist/validators/url.js +48 -12
  160. package/dist/validators.js +17 -17
  161. package/docs/llms/01-api-reference.md +60 -34
  162. package/docs/llms/02-quick-start.md +111 -80
  163. package/docs/llms/03-api-signatures.md +368 -153
  164. package/docs/llms/04-common-patterns.md +58 -56
  165. package/docs/llms/05-common-mistakes.md +69 -44
  166. package/docs/llms/06-troubleshooting.md +14 -9
  167. package/docs/llms/07-complete-import.md +74 -43
  168. package/docs/llms/08-form-types.md +11 -4
  169. package/docs/llms/09-formschema.md +129 -81
  170. package/docs/llms/10-arrays.md +106 -75
  171. package/docs/llms/11-async-watchfield.md +2 -2
  172. package/docs/llms/13-multi-step.md +134 -63
  173. package/docs/llms/14-extended-mistakes.md +20 -17
  174. package/docs/llms/15-project-structure.md +221 -74
  175. package/docs/llms/16-ui-components.md +55 -42
  176. package/docs/llms/17-nonexistent-api.md +199 -32
  177. package/docs/llms/18-conditional-fields.md +66 -32
  178. package/docs/llms/19-reading-values.md +15 -3
  179. package/docs/llms/20-compute-vs-watch.md +16 -10
  180. package/docs/llms/21-array-operations.md +51 -27
  181. package/docs/llms/22-cycle-detection.md +1 -1
  182. package/docs/llms/23-copy-from.md +2 -2
  183. package/docs/llms/24-sync-fields.md +6 -5
  184. package/docs/llms/25-reset-when.md +14 -7
  185. package/docs/llms/26-transform-value.md +4 -4
  186. package/docs/llms/27-revalidate-when.md +16 -15
  187. package/docs/llms/28-submit-and-reset.md +276 -128
  188. package/docs/llms/29-async-preload.md +39 -29
  189. package/docs/llms/30-type-safety-recipes.md +105 -51
  190. package/docs/llms/31-async-validator-debounce.md +96 -53
  191. package/docs/llms/33-validation-strategy.md +177 -65
  192. package/docs/llms/34-i18n.md +69 -43
  193. package/docs/llms/35-unified-contract.md +100 -39
  194. package/docs/llms/36-issue-messages.md +284 -0
  195. package/docs/llms/37-compiled-schema.md +332 -0
  196. package/docs/llms/38-form-flow.md +397 -0
  197. package/llms-index.json +1 -1
  198. package/llms.txt +6084 -3420
  199. package/package.json +23 -4
  200. package/dist/behaviors-value-C7dSEhCc.js +0 -134
  201. package/dist/date-utils-dTT_x_Be.js +0 -31
  202. package/dist/form/create-core-form.d.ts +0 -72
  203. package/dist/form/factories/index.d.ts +0 -6
  204. package/dist/form/factories/node-factory.d.ts +0 -189
  205. package/dist/form/form-submitter.d.ts +0 -121
  206. package/dist/form/nodes/array-node.d.ts +0 -276
  207. package/dist/form/nodes/field-node.d.ts +0 -297
  208. package/dist/form/nodes/form-node.d.ts +0 -326
  209. package/dist/form/nodes/group-node.d.ts +0 -284
  210. package/dist/form/nodes/model-array-node.d.ts +0 -126
  211. package/dist/form/nodes/subscription-manager.d.ts +0 -180
  212. package/dist/form/status-machine.d.ts +0 -115
  213. package/dist/form/types/deep-schema.d.ts +0 -107
  214. package/dist/form/types/form-proxy.d.ts +0 -141
  215. package/dist/form/unique-id.d.ts +0 -45
  216. package/dist/form/validation/config.d.ts +0 -73
  217. package/dist/form/validation/error-handler.d.ts +0 -166
  218. package/dist/form/validators/validation-error.d.ts +0 -8
  219. package/dist/index-BrNkQj1y.js +0 -105
  220. package/dist/loader-Dv_Hl7JC.js +0 -216
  221. package/dist/model-value-proxy-caTmAiUd.js +0 -419
  222. package/dist/node-BeV_lV5i.js +0 -100
  223. package/dist/strategy-DgzELWno.js +0 -204
  224. package/dist/validation-error-B-U3RsV0.js +0 -11
package/dist/react.js ADDED
@@ -0,0 +1,505 @@
1
+ import U, { useRef as v, useCallback as y, useMemo as m, useEffect as F, useState as j, createContext as G, useContext as L, useImperativeHandle as $, createElement as k, Fragment as K } from "react";
2
+ import { D as N } from "./locale-CG54AU2Q.js";
3
+ import { a as x, c as W, t as Y, r as X } from "./validation-message-Ced9MGxs.js";
4
+ import { c as z } from "./type-guards-D-N_5Ddh.js";
5
+ import { effect as R } from "@preact/signals-core";
6
+ import { h as J } from "./strategy-CoFSemuP.js";
7
+ var w = { exports: {} }, I = {};
8
+ var q;
9
+ function Q() {
10
+ if (q) return I;
11
+ q = 1;
12
+ var e = U;
13
+ function t(i, c) {
14
+ return i === c && (i !== 0 || 1 / i === 1 / c) || i !== i && c !== c;
15
+ }
16
+ var r = typeof Object.is == "function" ? Object.is : t, u = e.useState, n = e.useEffect, s = e.useLayoutEffect, d = e.useDebugValue;
17
+ function h(i, c) {
18
+ var o = c(), l = u({ inst: { value: o, getSnapshot: c } }), f = l[0].inst, S = l[1];
19
+ return s(
20
+ function() {
21
+ f.value = o, f.getSnapshot = c, p(f) && S({ inst: f });
22
+ },
23
+ [i, o, c]
24
+ ), n(
25
+ function() {
26
+ return p(f) && S({ inst: f }), i(function() {
27
+ p(f) && S({ inst: f });
28
+ });
29
+ },
30
+ [i]
31
+ ), d(o), o;
32
+ }
33
+ function p(i) {
34
+ var c = i.getSnapshot;
35
+ i = i.value;
36
+ try {
37
+ var o = c();
38
+ return !r(i, o);
39
+ } catch {
40
+ return !0;
41
+ }
42
+ }
43
+ function E(i, c) {
44
+ return c();
45
+ }
46
+ var a = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? E : h;
47
+ return I.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : a, I;
48
+ }
49
+ var C = {};
50
+ var B;
51
+ function Z() {
52
+ return B || (B = 1, process.env.NODE_ENV !== "production" && (function() {
53
+ function e(o, l) {
54
+ return o === l && (o !== 0 || 1 / o === 1 / l) || o !== o && l !== l;
55
+ }
56
+ function t(o, l) {
57
+ a || n.startTransition === void 0 || (a = !0, console.error(
58
+ "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
59
+ ));
60
+ var f = l();
61
+ if (!i) {
62
+ var S = l();
63
+ s(f, S) || (console.error(
64
+ "The result of getSnapshot should be cached to avoid an infinite loop"
65
+ ), i = !0);
66
+ }
67
+ S = d({
68
+ inst: { value: f, getSnapshot: l }
69
+ });
70
+ var g = S[0].inst, _ = S[1];
71
+ return p(
72
+ function() {
73
+ g.value = f, g.getSnapshot = l, r(g) && _({ inst: g });
74
+ },
75
+ [o, f, l]
76
+ ), h(
77
+ function() {
78
+ return r(g) && _({ inst: g }), o(function() {
79
+ r(g) && _({ inst: g });
80
+ });
81
+ },
82
+ [o]
83
+ ), E(f), f;
84
+ }
85
+ function r(o) {
86
+ var l = o.getSnapshot;
87
+ o = o.value;
88
+ try {
89
+ var f = l();
90
+ return !s(o, f);
91
+ } catch {
92
+ return !0;
93
+ }
94
+ }
95
+ function u(o, l) {
96
+ return l();
97
+ }
98
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
99
+ var n = U, s = typeof Object.is == "function" ? Object.is : e, d = n.useState, h = n.useEffect, p = n.useLayoutEffect, E = n.useDebugValue, a = !1, i = !1, c = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : t;
100
+ C.useSyncExternalStore = n.useSyncExternalStore !== void 0 ? n.useSyncExternalStore : c, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
101
+ })()), C;
102
+ }
103
+ var P;
104
+ function ee() {
105
+ return P || (P = 1, process.env.NODE_ENV === "production" ? w.exports = Q() : w.exports = Z()), w.exports;
106
+ }
107
+ var b = ee();
108
+ function te(e, t) {
109
+ if (e === t) return !0;
110
+ if (e.length !== t.length) return !1;
111
+ for (let r = 0; r < e.length; r++)
112
+ if (e[r] !== t[r]) return !1;
113
+ return !0;
114
+ }
115
+ function ne(e, t) {
116
+ if (Object.is(e, t)) return !0;
117
+ if (e === null || t === null || typeof e != "object" || typeof t != "object") return !1;
118
+ const r = e, u = t, n = Object.keys(r);
119
+ return n.length !== Object.keys(u).length ? !1 : n.every(
120
+ (s) => Object.prototype.hasOwnProperty.call(u, s) && Object.is(r[s], u[s])
121
+ );
122
+ }
123
+ function V(e, t, r, u) {
124
+ const n = v(null), s = v(e);
125
+ s.current = e;
126
+ const d = v(t);
127
+ d.current = t;
128
+ const h = v(r);
129
+ if (h.current = r, n.current === null) {
130
+ const a = {};
131
+ for (const i in e)
132
+ a[i] = e[i].value;
133
+ n.current = { ...a, __snapshot: null };
134
+ }
135
+ const p = y(
136
+ (a) => {
137
+ let i = !0;
138
+ return R(() => {
139
+ const o = s.current;
140
+ for (const { key: l } of d.current)
141
+ o[l]?.value;
142
+ if (i) {
143
+ i = !1;
144
+ return;
145
+ }
146
+ a();
147
+ });
148
+ },
149
+ // subscriptionKey намеренно не читается в теле — он здесь КЛЮЧ ИДЕНТИЧНОСТИ подписки (см. JSDoc
150
+ // параметра). Убрать его (как предлагает автофикс) значит получить subscribe, созданный один раз
151
+ // навсегда: подмена контрола на другой узел перестанет пересоздавать effect. Тот же приём ниже
152
+ // у getSnapshot.
153
+ // eslint-disable-next-line react-hooks/exhaustive-deps
154
+ [u]
155
+ ), E = y(() => {
156
+ const a = n.current, i = s.current, c = {};
157
+ for (const l in i)
158
+ c[l] = i[l].value;
159
+ let o = !1;
160
+ for (const l of d.current) {
161
+ const { key: f, useShallowArrayEqual: S, useShallowObjectEqual: g } = l, _ = c[f], A = a[f];
162
+ if (g) {
163
+ if (!ne(A, _)) {
164
+ o = !0;
165
+ break;
166
+ }
167
+ } else if (S) {
168
+ if (!te(A, _)) {
169
+ o = !0;
170
+ break;
171
+ }
172
+ } else if (A !== _) {
173
+ o = !0;
174
+ break;
175
+ }
176
+ }
177
+ if (!o && a.__snapshot && a.__key === u)
178
+ return a.__snapshot;
179
+ for (const l in i)
180
+ a[l] = c[l];
181
+ return a.__key = u, a.__snapshot = h.current(c), a.__snapshot;
182
+ }, [u]);
183
+ return b.useSyncExternalStore(p, E, E);
184
+ }
185
+ function re(e) {
186
+ const t = {
187
+ value: e.value,
188
+ disabled: e.disabled,
189
+ issues: e.issues,
190
+ pending: e.pending,
191
+ valid: e.valid,
192
+ invalid: e.invalid,
193
+ touched: e.touched,
194
+ dirty: e.dirty,
195
+ shouldShowError: e.shouldShowError,
196
+ shouldShowIssues: e.shouldShowIssues,
197
+ componentProps: e.componentProps
198
+ };
199
+ return V(t, [
200
+ { key: "value" },
201
+ { key: "disabled" },
202
+ { key: "issues", useShallowArrayEqual: !0 },
203
+ { key: "pending" },
204
+ { key: "valid" },
205
+ { key: "invalid" },
206
+ { key: "touched" },
207
+ { key: "dirty" },
208
+ { key: "shouldShowError" },
209
+ { key: "shouldShowIssues" },
210
+ // `updateComponentProps` всегда отдаёт новый объект: те же значения поле не перерисовывают.
211
+ { key: "componentProps", useShallowObjectEqual: !0 }
212
+ ], (n) => ({
213
+ value: n.value,
214
+ pending: n.pending,
215
+ disabled: n.disabled,
216
+ issues: n.issues,
217
+ valid: n.valid,
218
+ invalid: n.invalid,
219
+ touched: n.touched,
220
+ dirty: n.dirty,
221
+ shouldShowError: n.shouldShowError,
222
+ shouldShowIssues: n.shouldShowIssues,
223
+ componentProps: n.componentProps
224
+ }), e);
225
+ }
226
+ function ue(e) {
227
+ const t = {
228
+ value: e.value,
229
+ issues: e.issues,
230
+ ownIssues: e.ownIssues,
231
+ pending: e.pending,
232
+ valid: e.valid,
233
+ invalid: e.invalid,
234
+ touched: e.touched,
235
+ dirty: e.dirty,
236
+ disabled: e.disabled
237
+ };
238
+ return V(t, [
239
+ { key: "value" },
240
+ { key: "issues", useShallowArrayEqual: !0 },
241
+ { key: "ownIssues", useShallowArrayEqual: !0 },
242
+ { key: "pending" },
243
+ { key: "valid" },
244
+ { key: "invalid" },
245
+ { key: "touched" },
246
+ { key: "dirty" },
247
+ { key: "disabled" }
248
+ ], (n) => ({
249
+ value: n.value,
250
+ length: n.value.length,
251
+ pending: n.pending,
252
+ issues: n.issues,
253
+ ownIssues: n.ownIssues,
254
+ valid: n.valid,
255
+ invalid: n.invalid,
256
+ touched: n.touched,
257
+ dirty: n.dirty,
258
+ disabled: n.disabled
259
+ }), e);
260
+ }
261
+ function se() {
262
+ return V({}, [], () => ({
263
+ value: [],
264
+ length: 0,
265
+ pending: !1,
266
+ issues: [],
267
+ ownIssues: [],
268
+ valid: !0,
269
+ invalid: !1,
270
+ touched: !1,
271
+ dirty: !1,
272
+ disabled: !1
273
+ }));
274
+ }
275
+ function be(e) {
276
+ return e ? z(e) ? ue(e) : re(e) : se();
277
+ }
278
+ function Oe(e) {
279
+ const t = v({ value: e.value.value }), r = y(
280
+ (n) => {
281
+ let s = !0;
282
+ return R(() => {
283
+ if (e.value.value, s) {
284
+ s = !1;
285
+ return;
286
+ }
287
+ n();
288
+ });
289
+ },
290
+ [e]
291
+ ), u = y(() => {
292
+ const n = e.value.value;
293
+ return t.current.value === n ? t.current.value : (t.current.value = n, n);
294
+ }, [e]);
295
+ return b.useSyncExternalStore(r, u, u);
296
+ }
297
+ function ke(e) {
298
+ const t = v({ length: e.length }), r = y(
299
+ (n) => {
300
+ let s = !0;
301
+ return R(() => {
302
+ if (e.length, s) {
303
+ s = !1;
304
+ return;
305
+ }
306
+ n();
307
+ });
308
+ },
309
+ [e]
310
+ ), u = y(() => {
311
+ const n = e.length;
312
+ return t.current.length === n ? t.current.length : (t.current.length = n, n);
313
+ }, [e]);
314
+ return b.useSyncExternalStore(r, u, u);
315
+ }
316
+ function we(e) {
317
+ const { model: t, schema: r, strategy: u, debounce: n, liveAfterSubmit: s } = e, d = m(
318
+ () => J(t, r, { strategy: u, debounce: n, liveAfterSubmit: s }),
319
+ [t, r, u, n, s]
320
+ );
321
+ F(() => d.start(), [d]);
322
+ const h = b.useSyncExternalStore(
323
+ y((a) => d.validating.subscribe(a), [d]),
324
+ () => d.validating.peek(),
325
+ () => !1
326
+ // SSR: прогон не идёт
327
+ ), p = y(
328
+ async () => (await d.run({ touch: "all", submit: !0 })).status === "valid",
329
+ [d]
330
+ ), E = y(() => d.validate(), [d]);
331
+ return { submit: p, validate: E, isValidating: h };
332
+ }
333
+ function Le(e) {
334
+ const [t, r] = j(e), [u] = j(() => e), n = v(null);
335
+ return F(() => {
336
+ const s = n.current;
337
+ if (s?.bundle === t && s.done) {
338
+ let h = !0;
339
+ return queueMicrotask(() => {
340
+ h && r(u());
341
+ }), () => {
342
+ h = !1;
343
+ };
344
+ }
345
+ n.current = null, s?.bundle === t && (s.cancelled = !0);
346
+ const d = t.validation?.controller.start();
347
+ return () => {
348
+ d?.();
349
+ const h = { bundle: t, cancelled: !1, done: !1 };
350
+ n.current = h, queueMicrotask(() => {
351
+ h.cancelled || (t.dispose?.(), h.done = !0);
352
+ });
353
+ };
354
+ }, [t, u]), t;
355
+ }
356
+ const D = (e) => ({
357
+ current: e.current.value,
358
+ index: e.index.value,
359
+ completed: e.completed.value,
360
+ isFirst: e.isFirst.value,
361
+ isLast: e.isLast.value,
362
+ validating: e.validating.value
363
+ }), oe = (e, t) => e.current === t.current && e.index === t.index && e.completed === t.completed && e.validating === t.validating;
364
+ function xe(e) {
365
+ const t = v(null), r = y(() => {
366
+ const n = D(e), s = t.current;
367
+ return s && s.flow === e && oe(s.snapshot, n) ? s.snapshot : (t.current = { flow: e, snapshot: n }, n);
368
+ }, [e]), u = y(
369
+ (n) => {
370
+ let s = !0;
371
+ return R(() => {
372
+ if (D(e), s) {
373
+ s = !1;
374
+ return;
375
+ }
376
+ n();
377
+ });
378
+ },
379
+ [e]
380
+ );
381
+ return b.useSyncExternalStore(u, r, r);
382
+ }
383
+ const ie = G(null);
384
+ function Re() {
385
+ return L(ie);
386
+ }
387
+ const le = ["labelTooltip"];
388
+ function Ae(e) {
389
+ if (!(e == null || typeof e != "function" && typeof e != "object"))
390
+ return e.reformerAdapter;
391
+ }
392
+ const H = (e) => e;
393
+ function Ie(e, t, r = {}) {
394
+ const u = { ...r };
395
+ for (const s of le) delete u[s];
396
+ for (const s of e?.strip ?? []) delete u[s];
397
+ if (!e)
398
+ return { ...u, value: t.value, onChange: t.onChange, onBlur: t.onBlur };
399
+ const n = e.fromEmit ?? H;
400
+ return {
401
+ ...u,
402
+ [e.valueProp ?? "value"]: (e.toValue ?? H)(t.value),
403
+ [e.changeProp ?? "onChange"]: (s) => t.onChange(n(s, u)),
404
+ ...e.bindBlur ? e.bindBlur(t.onBlur) : { onBlur: t.onBlur }
405
+ };
406
+ }
407
+ function M(e) {
408
+ return {
409
+ focus: () => e.current?.focus(),
410
+ blur: () => e.current?.blur(),
411
+ scrollIntoView: (t) => e.current?.scrollIntoView(t),
412
+ getElement: () => e.current
413
+ };
414
+ }
415
+ function ae(e) {
416
+ return typeof e == "object" && e !== null && e.nodeType === 1;
417
+ }
418
+ function Ce(e) {
419
+ const t = v(null), r = v(null);
420
+ return $(e, () => ce(t, r)), t;
421
+ }
422
+ function ce(e, t) {
423
+ const r = e.current;
424
+ if (r != null && !ae(r)) return r;
425
+ const u = e;
426
+ return t ? (t.current ??= M(u), t.current) : M(u);
427
+ }
428
+ const de = "ReformerI18nContext", fe = () => {
429
+ };
430
+ function T(e, t, r, u = fe) {
431
+ return { ...e, pending: t, error: r, retry: u };
432
+ }
433
+ const he = T(x(N), !1, void 0), O = G(he);
434
+ O.displayName = de;
435
+ function pe({ locale: e, children: t }) {
436
+ const r = m(() => T(x(e), !1, void 0), [e]);
437
+ return k(O.Provider, { value: r }, t);
438
+ }
439
+ function Se({
440
+ lang: e,
441
+ load: t,
442
+ fallback: r,
443
+ onError: u,
444
+ children: n
445
+ }) {
446
+ const s = v(u);
447
+ s.current = u;
448
+ const d = v(null), h = v(!1), p = m(
449
+ () => W(t, e, {
450
+ onError: (f, S) => s.current?.(f, S),
451
+ previous: d.current ?? void 0
452
+ }),
453
+ [t]
454
+ );
455
+ F(() => {
456
+ p.setLang(e);
457
+ }, [p, e]);
458
+ const E = b.useSyncExternalStore(p.subscribe, p.getState, p.getState), { locale: a, pending: i, error: c } = E;
459
+ a !== null && (d.current = a);
460
+ const o = a === null && (c !== void 0 || h.current), l = m(
461
+ () => a === null && !o ? null : T(x(a ?? N), i, c, p.retry),
462
+ [a, o, i, c, p]
463
+ );
464
+ return l === null ? r === void 0 ? null : k(K, null, r) : (h.current = !0, k(O.Provider, { value: l }, n));
465
+ }
466
+ function Fe(e) {
467
+ return "locale" in e ? k(pe, e) : k(Se, e);
468
+ }
469
+ function Ve() {
470
+ return L(O);
471
+ }
472
+ function Te(e) {
473
+ const { locale: t } = L(O);
474
+ return m(
475
+ () => (r, u) => Y(t, e, r, u),
476
+ [t, e]
477
+ );
478
+ }
479
+ function je(e) {
480
+ const { locale: t } = L(O);
481
+ return m(() => {
482
+ const r = x(t);
483
+ return (u) => X(u, r, e);
484
+ }, [t, e]);
485
+ }
486
+ export {
487
+ le as FIELD_WRAPPER_ONLY_PROPS,
488
+ ie as FormBundleContext,
489
+ de as I18N_CONTEXT_MARKER,
490
+ Fe as I18nProvider,
491
+ Ie as bindFieldProps,
492
+ Ae as getFieldAdapter,
493
+ M as makeElementFieldHandle,
494
+ ke as useArrayLength,
495
+ Ce as useFieldHandleRef,
496
+ Le as useFormBundle,
497
+ Re as useFormBundleContext,
498
+ be as useFormControl,
499
+ Oe as useFormControlValue,
500
+ xe as useFormFlow,
501
+ we as useFormValidation,
502
+ Ve as useI18n,
503
+ je as useIssueMessage,
504
+ Te as useMessages
505
+ };
@@ -7,8 +7,7 @@
7
7
  *
8
8
  * Почему именно объект, а не строка с версией: две копии ОДНОЙ версии ломают всё ровно так же,
9
9
  * как две копии разных версий, — раздваиваются модульные `WeakMap` (`derived-registry`,
10
- * `signal-node-registry`) и перестают работать проверки `instanceof Signal`. Сравнение версий
11
- * такой случай пропустило бы.
10
+ * `signal-node-registry`). Сравнение версий такой случай пропустило бы.
12
11
  *
13
12
  * @see `@reformer/form-registry/guard`
14
13
  *