@reformer/core 10.2.0 → 11.0.0-beta.10
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 +90 -68
- package/dist/behaviors-value-D05z3my6.js +109 -0
- package/dist/behaviors.d.ts +1 -1
- package/dist/behaviors.js +376 -211
- package/dist/create-model-DPSG3I0O.js +30 -0
- package/dist/date-utils-90-qZbse.js +43 -0
- package/dist/en-HP8XEych.js +44 -0
- package/dist/form/aggregate-signals.d.ts +21 -63
- package/dist/form/behaviors/collections.d.ts +84 -0
- package/dist/form/behaviors/context.d.ts +56 -0
- package/dist/form/behaviors/index.d.ts +30 -0
- package/dist/form/behaviors/internals.d.ts +41 -0
- package/dist/form/{behaviors-node.d.ts → behaviors/node.d.ts} +28 -5
- package/dist/form/behaviors/operators.d.ts +59 -0
- package/dist/form/behaviors/schema-operators.d.ts +83 -0
- package/dist/form/behaviors/types.d.ts +37 -0
- package/dist/form/create-form.d.ts +59 -70
- package/dist/form/flow/flow.d.ts +87 -0
- package/dist/form/form-bundle.d.ts +153 -0
- package/dist/form/form-level.d.ts +121 -0
- package/dist/form/form-proxy-builder.d.ts +6 -22
- package/dist/form/index.d.ts +23 -27
- package/dist/form/nodes/form-array-node.d.ts +100 -0
- package/dist/form/nodes/form-control-node.d.ts +73 -0
- package/dist/form/nodes/form-group-node.d.ts +66 -0
- package/dist/form/nodes/node-kind.d.ts +29 -0
- package/dist/form/nodes/state/availability.d.ts +6 -0
- package/dist/form/nodes/state/component.d.ts +6 -0
- package/dist/form/nodes/state/index.d.ts +12 -0
- package/dist/form/nodes/state/interaction.d.ts +13 -0
- package/dist/form/nodes/state/issues.d.ts +9 -0
- package/dist/form/nodes/state/pending.d.ts +6 -0
- package/dist/form/schema/compile.d.ts +59 -0
- package/dist/form/schema/compiled.d.ts +143 -0
- package/dist/form/schema/row-key.d.ts +11 -0
- package/dist/form/schema-controller.d.ts +159 -0
- package/dist/form/schema-subtree.d.ts +28 -0
- package/dist/form/signal-node-registry.d.ts +27 -22
- package/dist/form/submission.d.ts +93 -0
- package/dist/form/type-guards.d.ts +14 -73
- package/dist/form/types/contracts.d.ts +21 -91
- package/dist/form/types/field-config.d.ts +27 -0
- package/dist/form/types/index.d.ts +5 -91
- package/dist/form/types/nodes.d.ts +159 -0
- package/dist/form/types/schema-node.d.ts +148 -50
- package/dist/form/types/validation-schema.d.ts +24 -41
- package/dist/form/validation/context.d.ts +67 -0
- package/dist/form/validation/index.d.ts +24 -28
- package/dist/form/validation/operators.d.ts +101 -0
- package/dist/form/validation/run.d.ts +120 -0
- package/dist/form/validation/strategy.d.ts +89 -0
- package/dist/form/validation/types.d.ts +83 -0
- package/dist/form/validators/date-utils.d.ts +42 -0
- package/dist/form/validators/email.d.ts +23 -0
- package/dist/form/{validation/validators → validators}/file-type.d.ts +10 -10
- package/dist/form/{validation/validators → validators}/file-utils.d.ts +3 -2
- package/dist/form/validators/future-date.d.ts +23 -0
- package/dist/form/{validation/validators → validators}/index.d.ts +7 -4
- package/dist/form/validators/integer.d.ts +22 -0
- package/dist/form/validators/is-date.d.ts +24 -0
- package/dist/form/validators/is-number.d.ts +25 -0
- package/dist/form/validators/max-age.d.ts +28 -0
- package/dist/form/validators/max-date.d.ts +25 -0
- package/dist/form/{validation/validators → validators}/max-file-size.d.ts +10 -10
- package/dist/form/validators/max-files.d.ts +26 -0
- package/dist/form/validators/max-length.d.ts +33 -0
- package/dist/form/validators/max-total-file-size.d.ts +26 -0
- package/dist/form/validators/max.d.ts +26 -0
- package/dist/form/validators/min-age.d.ts +27 -0
- package/dist/form/validators/min-date.d.ts +25 -0
- package/dist/form/{validation/validators → validators}/min-file-size.d.ts +10 -10
- package/dist/form/validators/min-files.d.ts +27 -0
- package/dist/form/validators/min-length.d.ts +33 -0
- package/dist/form/validators/min.d.ts +26 -0
- package/dist/form/validators/multiple-of.d.ts +25 -0
- package/dist/form/validators/non-negative.d.ts +22 -0
- package/dist/form/validators/non-zero.d.ts +22 -0
- package/dist/form/validators/past-date.d.ts +23 -0
- package/dist/form/validators/pattern.d.ts +26 -0
- package/dist/form/{validation/validators → validators}/phone.d.ts +11 -11
- package/dist/form/validators/required.d.ts +29 -0
- package/dist/form/validators/url.d.ts +45 -0
- package/dist/form/validators/validation-issue.d.ts +8 -0
- package/dist/i18n/descriptor.d.ts +54 -0
- package/dist/i18n/en.json.d.ts +49 -0
- package/dist/i18n/loader.d.ts +71 -0
- package/dist/i18n/locale-store.d.ts +46 -0
- package/dist/i18n/locale.d.ts +90 -0
- package/dist/i18n/message-format.d.ts +136 -0
- package/dist/i18n/resolve-localized.d.ts +17 -0
- package/dist/i18n/ru.json.d.ts +49 -0
- package/dist/i18n/translator.d.ts +61 -0
- package/dist/i18n/validation-message.d.ts +53 -0
- package/dist/i18n.d.ts +26 -0
- package/dist/i18n.js +86 -0
- package/dist/index.d.ts +18 -6
- package/dist/index.js +932 -2779
- package/dist/loader-BWkigpVe.js +52 -0
- package/dist/locale/en.d.ts +2 -0
- package/dist/locale/en.js +5 -0
- package/dist/locale/en.json +45 -0
- package/dist/locale/index.d.ts +18 -0
- package/dist/locale/ru.d.ts +2 -0
- package/dist/locale/ru.js +44 -0
- package/dist/locale/ru.json +45 -0
- package/dist/locale-CG54AU2Q.js +219 -0
- package/dist/locale.d.ts +2 -0
- package/dist/locale.js +9 -0
- package/dist/{state → model}/behaviors-value.d.ts +24 -6
- package/dist/{state/form-model.d.ts → model/create-model.d.ts} +18 -4
- package/dist/{state → model}/derived-registry.d.ts +1 -1
- package/dist/model/index.d.ts +42 -0
- package/dist/model/model-nodes.d.ts +190 -0
- package/dist/model/model-signals-proxy.d.ts +63 -0
- package/dist/model/model-value-proxy.d.ts +84 -0
- package/dist/{state → model}/safe-effect.d.ts +50 -2
- package/dist/model/types.d.ts +239 -0
- package/dist/model.d.ts +2 -0
- package/dist/model.js +27 -0
- package/dist/node-kind-C-r6ZMdo.js +15 -0
- package/dist/platforms/react/field-binding/field-adapter.d.ts +87 -0
- package/dist/platforms/react/field-binding/field-handle.d.ts +53 -0
- package/dist/platforms/react/form-bundle-context.d.ts +27 -0
- package/dist/{form → platforms/react}/hooks/types.d.ts +60 -38
- package/dist/platforms/react/hooks/use-form-bundle.d.ts +41 -0
- package/dist/platforms/react/hooks/use-form-flow.d.ts +40 -0
- package/dist/{form → platforms/react}/hooks/use-form-validation.d.ts +13 -7
- package/dist/{form → platforms/react}/hooks/useArrayLength.d.ts +6 -6
- package/dist/{form → platforms/react}/hooks/useFormControl.d.ts +7 -9
- package/dist/{form → platforms/react}/hooks/useFormControlValue.d.ts +18 -18
- package/dist/{form → platforms/react}/hooks/useSignalSubscription.d.ts +9 -1
- package/dist/platforms/react/i18n/context.d.ts +18 -0
- package/dist/platforms/react/i18n/hooks.d.ts +65 -0
- package/dist/platforms/react/i18n/provider.d.ts +59 -0
- package/dist/platforms/react/index.d.ts +30 -0
- package/dist/react.d.ts +22 -0
- package/dist/react.js +505 -0
- package/dist/runtime-token.d.ts +22 -0
- package/dist/safe-effect-BazLOv1g.js +669 -0
- package/dist/schema-controller-CpiO2JoK.js +143 -0
- package/dist/signals.d.ts +15 -9
- package/dist/signals.js +11 -6
- package/dist/strategy-DzvnsWLh.js +375 -0
- package/dist/type-guards-D-N_5Ddh.js +19 -0
- package/dist/validation-issue-B9mjI8jz.js +7 -0
- package/dist/validation-message-Ced9MGxs.js +194 -0
- package/dist/validation.d.ts +1 -1
- package/dist/validation.js +11 -165
- package/dist/validators/email.d.ts +1 -1
- package/dist/validators/email.js +5 -8
- package/dist/validators/future-date.d.ts +1 -1
- package/dist/validators/future-date.js +10 -13
- package/dist/validators/integer.d.ts +1 -1
- package/dist/validators/integer.js +4 -7
- package/dist/validators/is-date.d.ts +1 -1
- package/dist/validators/is-date.js +5 -8
- package/dist/validators/is-number.d.ts +1 -1
- package/dist/validators/is-number.js +4 -7
- package/dist/validators/max-age.d.ts +1 -1
- package/dist/validators/max-age.js +8 -12
- package/dist/validators/max-date.d.ts +1 -1
- package/dist/validators/max-date.js +10 -13
- package/dist/validators/max-length.d.ts +1 -1
- package/dist/validators/max-length.js +7 -10
- package/dist/validators/max.d.ts +1 -1
- package/dist/validators/max.js +4 -7
- package/dist/validators/min-age.d.ts +1 -1
- package/dist/validators/min-age.js +10 -11
- package/dist/validators/min-date.d.ts +1 -1
- package/dist/validators/min-date.js +8 -11
- package/dist/validators/min-length.d.ts +1 -1
- package/dist/validators/min-length.js +4 -7
- package/dist/validators/min.d.ts +1 -1
- package/dist/validators/min.js +4 -7
- package/dist/validators/multiple-of.d.ts +1 -1
- package/dist/validators/multiple-of.js +11 -10
- package/dist/validators/non-negative.d.ts +1 -1
- package/dist/validators/non-negative.js +2 -5
- package/dist/validators/non-zero.d.ts +1 -1
- package/dist/validators/non-zero.js +4 -7
- package/dist/validators/past-date.d.ts +1 -1
- package/dist/validators/past-date.js +10 -13
- package/dist/validators/pattern.d.ts +1 -1
- package/dist/validators/pattern.js +5 -8
- package/dist/validators/phone.d.ts +1 -1
- package/dist/validators/phone.js +10 -11
- package/dist/validators/required.d.ts +1 -1
- package/dist/validators/required.js +4 -7
- package/dist/validators/url.d.ts +1 -1
- package/dist/validators/url.js +48 -17
- package/dist/validators.d.ts +1 -5
- package/dist/validators.js +98 -154
- package/docs/llms/01-api-reference.md +89 -0
- package/docs/llms/02-quick-start.md +181 -0
- package/docs/llms/03-api-signatures.md +494 -0
- package/docs/llms/04-common-patterns.md +204 -0
- package/docs/llms/05-common-mistakes.md +192 -0
- package/docs/llms/06-troubleshooting.md +16 -0
- package/docs/llms/07-complete-import.md +130 -0
- package/docs/llms/08-form-types.md +54 -0
- package/docs/llms/09-formschema.md +191 -0
- package/docs/llms/10-arrays.md +241 -0
- package/docs/llms/11-async-watchfield.md +53 -0
- package/docs/llms/12-array-cleanup.md +31 -0
- package/docs/llms/13-multi-step.md +162 -0
- package/docs/llms/14-extended-mistakes.md +101 -0
- package/docs/llms/15-project-structure.md +279 -0
- package/docs/llms/16-ui-components.md +229 -0
- package/docs/llms/17-nonexistent-api.md +278 -0
- package/docs/llms/18-conditional-fields.md +222 -0
- package/docs/llms/19-reading-values.md +100 -0
- package/docs/llms/20-compute-vs-watch.md +153 -0
- package/docs/llms/21-array-operations.md +163 -0
- package/docs/llms/22-cycle-detection.md +86 -0
- package/docs/llms/23-copy-from.md +141 -0
- package/docs/llms/24-sync-fields.md +115 -0
- package/docs/llms/25-reset-when.md +122 -0
- package/docs/llms/26-transform-value.md +136 -0
- package/docs/llms/27-revalidate-when.md +133 -0
- package/docs/llms/28-submit-and-reset.md +409 -0
- package/docs/llms/29-async-preload.md +203 -0
- package/docs/llms/30-type-safety-recipes.md +213 -0
- package/docs/llms/31-async-validator-debounce.md +178 -0
- package/docs/llms/32-async-options-loading.md +108 -0
- package/docs/llms/33-validation-strategy.md +305 -0
- package/docs/llms/34-i18n.md +298 -0
- package/docs/llms/35-unified-contract.md +309 -0
- package/docs/llms/36-issue-messages.md +284 -0
- package/docs/llms/37-compiled-schema.md +332 -0
- package/docs/llms/38-form-flow.md +396 -0
- package/llms-index.json +1 -0
- package/llms.txt +10014 -3826
- package/package.json +77 -15
- package/dist/behaviors-node-DGEFMTQu.js +0 -18
- package/dist/behaviors-value-C7dSEhCc.js +0 -134
- package/dist/date-utils-dTT_x_Be.js +0 -31
- package/dist/derived-registry-CluZCQ7U.js +0 -16
- package/dist/form/behaviors.d.ts +0 -133
- package/dist/form/error-handler.d.ts +0 -166
- package/dist/form/factories/index.d.ts +0 -6
- package/dist/form/factories/node-factory.d.ts +0 -188
- package/dist/form/form-submitter.d.ts +0 -125
- package/dist/form/nodes/array-node.d.ts +0 -360
- package/dist/form/nodes/field-node.d.ts +0 -294
- package/dist/form/nodes/form-node.d.ts +0 -340
- package/dist/form/nodes/group-node.d.ts +0 -288
- package/dist/form/nodes/model-array-node.d.ts +0 -121
- package/dist/form/status-machine.d.ts +0 -153
- package/dist/form/types/deep-schema.d.ts +0 -116
- package/dist/form/types/form-proxy.d.ts +0 -141
- package/dist/form/unique-id.d.ts +0 -53
- package/dist/form/validation/validators/date-utils.d.ts +0 -30
- package/dist/form/validation/validators/email.d.ts +0 -23
- package/dist/form/validation/validators/future-date.d.ts +0 -23
- package/dist/form/validation/validators/integer.d.ts +0 -22
- package/dist/form/validation/validators/is-date.d.ts +0 -23
- package/dist/form/validation/validators/is-number.d.ts +0 -24
- package/dist/form/validation/validators/max-age.d.ts +0 -25
- package/dist/form/validation/validators/max-date.d.ts +0 -25
- package/dist/form/validation/validators/max-files.d.ts +0 -26
- package/dist/form/validation/validators/max-length.d.ts +0 -27
- package/dist/form/validation/validators/max-total-file-size.d.ts +0 -26
- package/dist/form/validation/validators/max.d.ts +0 -25
- package/dist/form/validation/validators/min-age.d.ts +0 -25
- package/dist/form/validation/validators/min-date.d.ts +0 -25
- package/dist/form/validation/validators/min-files.d.ts +0 -26
- package/dist/form/validation/validators/min-length.d.ts +0 -27
- package/dist/form/validation/validators/min.d.ts +0 -25
- package/dist/form/validation/validators/multiple-of.d.ts +0 -24
- package/dist/form/validation/validators/non-negative.d.ts +0 -22
- package/dist/form/validation/validators/non-zero.d.ts +0 -22
- package/dist/form/validation/validators/past-date.d.ts +0 -23
- package/dist/form/validation/validators/pattern.d.ts +0 -33
- package/dist/form/validation/validators/required.d.ts +0 -32
- package/dist/form/validation/validators/url.d.ts +0 -43
- package/dist/form/validation-schema.d.ts +0 -106
- package/dist/form/validation-strategy.d.ts +0 -55
- package/dist/form/validators.d.ts +0 -6
- package/dist/form-model-DYCzGGKF.js +0 -286
- package/dist/state/index.d.ts +0 -31
- package/dist/state/subscription-manager.d.ts +0 -180
- package/dist/state/types.d.ts +0 -144
- package/dist/state.d.ts +0 -2
- package/dist/state.js +0 -21
- package/dist/subscription-manager-705bls97.js +0 -171
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-DzvnsWLh.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
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Штамп копии рантайма ядра.
|
|
3
|
+
*
|
|
4
|
+
* Единственное назначение — быть объектом, уникальным в пределах ОДНОЙ копии модуля. Две
|
|
5
|
+
* независимо загруженные копии `@reformer/core` дадут два разных объекта, и по их несовпадению
|
|
6
|
+
* guard распознаёт дубль рантайма.
|
|
7
|
+
*
|
|
8
|
+
* Почему именно объект, а не строка с версией: две копии ОДНОЙ версии ломают всё ровно так же,
|
|
9
|
+
* как две копии разных версий, — раздваиваются модульные `WeakMap` (`derived-registry`,
|
|
10
|
+
* `signal-node-registry`). Сравнение версий такой случай пропустило бы.
|
|
11
|
+
*
|
|
12
|
+
* @see `@reformer/form-registry/guard`
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { CORE_RUNTIME_TOKEN } from '@reformer/core';
|
|
17
|
+
* import { stampRuntime } from '@reformer/form-registry/guard';
|
|
18
|
+
*
|
|
19
|
+
* stampRuntime('@reformer/core', CORE_RUNTIME_TOKEN);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const CORE_RUNTIME_TOKEN: object;
|