@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.
- package/README.md +91 -73
- package/dist/behaviors-value-HA_Q03hc.js +108 -0
- package/dist/behaviors.js +370 -242
- package/dist/{create-model-BBRHhHwK.js → create-model-BvcbNPgL.js} +6 -6
- package/dist/date-utils-90-qZbse.js +43 -0
- package/dist/{en-CjAqn7h0.js → en-HP8XEych.js} +6 -3
- package/dist/form/aggregate-signals.d.ts +21 -63
- package/dist/form/behaviors/collections.d.ts +28 -7
- package/dist/form/behaviors/context.d.ts +19 -2
- package/dist/form/behaviors/index.d.ts +3 -3
- package/dist/form/behaviors/internals.d.ts +9 -2
- package/dist/form/behaviors/node.d.ts +25 -2
- package/dist/form/behaviors/operators.d.ts +17 -9
- package/dist/form/behaviors/schema-operators.d.ts +6 -4
- package/dist/form/behaviors/types.d.ts +12 -4
- package/dist/form/create-form.d.ts +47 -35
- package/dist/form/flow/flow.d.ts +87 -0
- package/dist/form/form-bundle.d.ts +45 -28
- package/dist/form/form-config-base.d.ts +46 -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 +16 -21
- 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 +30 -14
- package/dist/form/signal-node-registry.d.ts +6 -7
- package/dist/form/submission.d.ts +93 -0
- package/dist/form/type-guards.d.ts +14 -73
- package/dist/form/types/contracts.d.ts +19 -92
- package/dist/form/types/field-config.d.ts +27 -0
- package/dist/form/types/index.d.ts +5 -57
- package/dist/form/types/nodes.d.ts +159 -0
- package/dist/form/types/schema-node.d.ts +139 -63
- package/dist/form/types/validation-schema.d.ts +23 -27
- package/dist/form/validation/context.d.ts +42 -7
- package/dist/form/validation/index.d.ts +9 -8
- package/dist/form/validation/operators.d.ts +22 -30
- package/dist/form/validation/run.d.ts +93 -18
- package/dist/form/validation/strategy.d.ts +41 -13
- package/dist/form/validation/types.d.ts +74 -20
- package/dist/form/validators/date-utils.d.ts +13 -1
- package/dist/form/validators/email.d.ts +8 -7
- package/dist/form/validators/file-type.d.ts +8 -7
- package/dist/form/validators/file-utils.d.ts +2 -1
- package/dist/form/validators/future-date.d.ts +8 -7
- package/dist/form/validators/index.d.ts +1 -1
- package/dist/form/validators/integer.d.ts +8 -7
- package/dist/form/validators/is-date.d.ts +11 -9
- package/dist/form/validators/is-number.d.ts +11 -9
- package/dist/form/validators/max-age.d.ts +13 -9
- package/dist/form/validators/max-date.d.ts +8 -7
- package/dist/form/validators/max-file-size.d.ts +8 -7
- package/dist/form/validators/max-files.d.ts +8 -7
- package/dist/form/validators/max-length.d.ts +14 -7
- package/dist/form/validators/max-total-file-size.d.ts +8 -7
- package/dist/form/validators/max.d.ts +10 -8
- package/dist/form/validators/min-age.d.ts +12 -9
- package/dist/form/validators/min-date.d.ts +8 -7
- package/dist/form/validators/min-file-size.d.ts +8 -7
- package/dist/form/validators/min-files.d.ts +11 -9
- package/dist/form/validators/min-length.d.ts +14 -7
- package/dist/form/validators/min.d.ts +10 -8
- package/dist/form/validators/multiple-of.d.ts +10 -8
- package/dist/form/validators/non-negative.d.ts +8 -7
- package/dist/form/validators/non-zero.d.ts +8 -7
- package/dist/form/validators/past-date.d.ts +8 -7
- package/dist/form/validators/pattern.d.ts +9 -8
- package/dist/form/validators/phone.d.ts +8 -7
- package/dist/form/validators/required.d.ts +11 -9
- package/dist/form/validators/url.d.ts +20 -13
- package/dist/form/validators/validation-issue.d.ts +8 -0
- package/dist/i18n/descriptor.d.ts +1 -1
- package/dist/i18n/en.json.d.ts +5 -1
- package/dist/i18n/locale-store.d.ts +7 -0
- package/dist/i18n/message-format.d.ts +24 -4
- package/dist/i18n/ru.json.d.ts +5 -1
- package/dist/i18n/translator.d.ts +11 -0
- package/dist/i18n/validation-message.d.ts +42 -7
- package/dist/i18n.d.ts +7 -12
- package/dist/i18n.js +66 -283
- package/dist/index.d.ts +16 -7
- package/dist/index.js +924 -2855
- package/dist/loader-BWkigpVe.js +52 -0
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.json +4 -1
- package/dist/locale/ru.js +4 -1
- package/dist/locale/ru.json +4 -1
- package/dist/locale-CG54AU2Q.js +219 -0
- package/dist/locale.js +1 -1
- package/dist/model/behaviors-value.d.ts +24 -6
- package/dist/model/create-model.d.ts +2 -2
- package/dist/model/derived-registry.d.ts +1 -1
- package/dist/model/index.d.ts +11 -5
- package/dist/model/model-nodes.d.ts +79 -12
- package/dist/model/model-signals-proxy.d.ts +5 -6
- package/dist/model/model-value-proxy.d.ts +20 -15
- package/dist/model/safe-effect.d.ts +33 -1
- package/dist/model/types.d.ts +63 -13
- package/dist/model.js +20 -18
- package/dist/node-kind-C-r6ZMdo.js +15 -0
- package/dist/platforms/react/field-binding/field-adapter.d.ts +1 -1
- package/dist/platforms/react/field-binding/field-handle.d.ts +5 -2
- package/dist/platforms/react/form-bundle-context.d.ts +2 -2
- package/dist/platforms/react/hooks/types.d.ts +57 -38
- package/dist/platforms/react/hooks/use-form-bundle.d.ts +19 -4
- package/dist/platforms/react/hooks/use-form-flow.d.ts +40 -0
- package/dist/platforms/react/hooks/use-form-validation.d.ts +12 -6
- package/dist/platforms/react/hooks/useArrayLength.d.ts +6 -6
- package/dist/platforms/react/hooks/useFormControl.d.ts +7 -9
- package/dist/platforms/react/hooks/useFormControlValue.d.ts +18 -19
- package/dist/platforms/react/hooks/useSignalSubscription.d.ts +9 -1
- package/dist/platforms/react/i18n/context.d.ts +6 -1
- package/dist/platforms/react/i18n/hooks.d.ts +16 -10
- package/dist/platforms/react/i18n/provider.d.ts +9 -2
- package/dist/platforms/react/index.d.ts +6 -4
- package/dist/react.d.ts +22 -0
- package/dist/react.js +505 -0
- package/dist/runtime-token.d.ts +1 -2
- package/dist/safe-effect-BbtX3KuN.js +643 -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-CoFSemuP.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.js +9 -9
- package/dist/validators/email.js +5 -5
- package/dist/validators/future-date.js +8 -8
- package/dist/validators/integer.js +3 -3
- package/dist/validators/is-date.js +4 -4
- package/dist/validators/is-number.js +4 -4
- package/dist/validators/max-age.js +8 -9
- package/dist/validators/max-date.js +8 -8
- package/dist/validators/max-length.js +7 -7
- package/dist/validators/max.js +4 -4
- package/dist/validators/min-age.js +10 -8
- package/dist/validators/min-date.js +3 -3
- package/dist/validators/min-length.js +5 -5
- package/dist/validators/min.js +4 -4
- package/dist/validators/multiple-of.js +11 -7
- package/dist/validators/non-negative.js +3 -3
- package/dist/validators/non-zero.js +3 -3
- package/dist/validators/past-date.js +8 -8
- package/dist/validators/pattern.js +5 -5
- package/dist/validators/phone.js +11 -9
- package/dist/validators/required.js +2 -2
- package/dist/validators/url.js +48 -12
- package/dist/validators.js +17 -17
- package/docs/llms/01-api-reference.md +60 -34
- package/docs/llms/02-quick-start.md +111 -80
- package/docs/llms/03-api-signatures.md +368 -153
- package/docs/llms/04-common-patterns.md +58 -56
- package/docs/llms/05-common-mistakes.md +69 -44
- package/docs/llms/06-troubleshooting.md +14 -9
- package/docs/llms/07-complete-import.md +74 -43
- package/docs/llms/08-form-types.md +11 -4
- package/docs/llms/09-formschema.md +129 -81
- package/docs/llms/10-arrays.md +106 -75
- package/docs/llms/11-async-watchfield.md +2 -2
- package/docs/llms/13-multi-step.md +134 -63
- package/docs/llms/14-extended-mistakes.md +20 -17
- package/docs/llms/15-project-structure.md +221 -74
- package/docs/llms/16-ui-components.md +55 -42
- package/docs/llms/17-nonexistent-api.md +199 -32
- package/docs/llms/18-conditional-fields.md +66 -32
- package/docs/llms/19-reading-values.md +15 -3
- package/docs/llms/20-compute-vs-watch.md +16 -10
- package/docs/llms/21-array-operations.md +51 -27
- package/docs/llms/22-cycle-detection.md +1 -1
- package/docs/llms/23-copy-from.md +2 -2
- package/docs/llms/24-sync-fields.md +6 -5
- package/docs/llms/25-reset-when.md +14 -7
- package/docs/llms/26-transform-value.md +4 -4
- package/docs/llms/27-revalidate-when.md +16 -15
- package/docs/llms/28-submit-and-reset.md +276 -128
- package/docs/llms/29-async-preload.md +39 -29
- package/docs/llms/30-type-safety-recipes.md +105 -51
- package/docs/llms/31-async-validator-debounce.md +96 -53
- package/docs/llms/33-validation-strategy.md +177 -65
- package/docs/llms/34-i18n.md +69 -43
- package/docs/llms/35-unified-contract.md +100 -39
- 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 +397 -0
- package/llms-index.json +1 -1
- package/llms.txt +6084 -3420
- package/package.json +23 -4
- package/dist/behaviors-value-C7dSEhCc.js +0 -134
- package/dist/date-utils-dTT_x_Be.js +0 -31
- package/dist/form/create-core-form.d.ts +0 -72
- package/dist/form/factories/index.d.ts +0 -6
- package/dist/form/factories/node-factory.d.ts +0 -189
- package/dist/form/form-submitter.d.ts +0 -121
- package/dist/form/nodes/array-node.d.ts +0 -276
- package/dist/form/nodes/field-node.d.ts +0 -297
- package/dist/form/nodes/form-node.d.ts +0 -326
- package/dist/form/nodes/group-node.d.ts +0 -284
- package/dist/form/nodes/model-array-node.d.ts +0 -126
- package/dist/form/nodes/subscription-manager.d.ts +0 -180
- package/dist/form/status-machine.d.ts +0 -115
- package/dist/form/types/deep-schema.d.ts +0 -107
- package/dist/form/types/form-proxy.d.ts +0 -141
- package/dist/form/unique-id.d.ts +0 -45
- package/dist/form/validation/config.d.ts +0 -73
- package/dist/form/validation/error-handler.d.ts +0 -166
- package/dist/form/validators/validation-error.d.ts +0 -8
- package/dist/index-BrNkQj1y.js +0 -105
- package/dist/loader-Dv_Hl7JC.js +0 -216
- package/dist/model-value-proxy-caTmAiUd.js +0 -419
- package/dist/node-BeV_lV5i.js +0 -100
- package/dist/strategy-DgzELWno.js +0 -204
- package/dist/validation-error-B-U3RsV0.js +0 -11
package/dist/i18n.js
CHANGED
|
@@ -1,303 +1,86 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function q(e, t, n = {}) {
|
|
8
|
-
const r = /* @__PURE__ */ new Set(), o = e.peek?.(t);
|
|
9
|
-
let a = {
|
|
10
|
-
lang: t,
|
|
11
|
-
locale: o ?? null,
|
|
12
|
-
pending: o === void 0,
|
|
13
|
-
error: void 0
|
|
14
|
-
}, c = null, i = o === void 0 ? null : t;
|
|
15
|
-
const f = (s) => {
|
|
16
|
-
a = s;
|
|
17
|
-
for (const u of [...r]) u();
|
|
18
|
-
};
|
|
19
|
-
return {
|
|
20
|
-
getState: () => a,
|
|
21
|
-
subscribe(s) {
|
|
22
|
-
return r.add(s), () => {
|
|
23
|
-
r.delete(s);
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
setLang(s) {
|
|
27
|
-
if (c === s) return;
|
|
28
|
-
if (i === s) {
|
|
29
|
-
c = null, (a.lang !== s || a.pending || a.error !== void 0) && f({ ...a, lang: s, pending: !1, error: void 0 });
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const u = e.peek?.(s);
|
|
33
|
-
if (u !== void 0) {
|
|
34
|
-
c = null, i = s, f({ lang: s, locale: u, pending: !1, error: void 0 });
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
c = s, f({ ...a, lang: s, pending: !0, error: void 0 }), e(s).then(
|
|
38
|
-
(l) => {
|
|
39
|
-
c === s && (c = null, i = s, f({ lang: s, locale: l, pending: !1, error: void 0 }));
|
|
40
|
-
},
|
|
41
|
-
(l) => {
|
|
42
|
-
c === s && (c = null, f({ ...a, pending: !1, error: l }), n.onError?.(l, s));
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
const w = "en", N = { onMissingArgument: (e) => `{${e}}` }, L = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new WeakMap();
|
|
49
|
-
function C() {
|
|
50
|
-
return process.env.NODE_ENV !== "production";
|
|
51
|
-
}
|
|
52
|
-
function j(e, t) {
|
|
53
|
-
try {
|
|
54
|
-
if (typeof e != "string") throw new TypeError("сообщение не является строкой");
|
|
55
|
-
return U(e);
|
|
56
|
-
} catch (n) {
|
|
57
|
-
return C() && console.error(
|
|
58
|
-
`[@reformer/core/i18n] ${t}: ${n instanceof Error ? n.message : String(n)}`
|
|
59
|
-
), null;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function B(e, t, n) {
|
|
63
|
-
if (!b(e, t)) return;
|
|
64
|
-
let r = L.get(e);
|
|
65
|
-
r === void 0 && L.set(e, r = /* @__PURE__ */ new Map());
|
|
66
|
-
let o = r.get(t);
|
|
67
|
-
return o === void 0 && (o = j(e[t], `локаль «${n}», ключ «${t}»`), r.set(t, o)), o;
|
|
68
|
-
}
|
|
69
|
-
function S(e, t, n, r) {
|
|
70
|
-
const o = B(e, n, t);
|
|
71
|
-
if (o != null)
|
|
72
|
-
return T(o, r ?? {}, t, N);
|
|
73
|
-
}
|
|
74
|
-
function Z(e, t, n, r) {
|
|
75
|
-
return S(e.messages, e.code, n, r) ?? S(t, w, n, r) ?? n;
|
|
76
|
-
}
|
|
77
|
-
function J(e, t) {
|
|
78
|
-
let n = O.get(e);
|
|
79
|
-
return n === void 0 && (n = j(e, `defaultMessage «${e}»`), O.set(e, n)), n === null ? void 0 : T(n, t ?? {}, w, N);
|
|
80
|
-
}
|
|
81
|
-
const F = ["b", "kb", "mb", "gb", "tb"], X = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Map();
|
|
82
|
-
function A(e, t, n, r) {
|
|
83
|
-
const o = n === void 0 ? t : `${t}|${JSON.stringify(n)}`;
|
|
84
|
-
let a = e.get(o);
|
|
85
|
-
return a === void 0 && e.set(o, a = r()), a;
|
|
86
|
-
}
|
|
87
|
-
const I = /* @__PURE__ */ new WeakMap();
|
|
88
|
-
function v(e) {
|
|
89
|
-
const t = I.get(e);
|
|
90
|
-
if (t !== void 0) return t;
|
|
91
|
-
const { code: n, messages: r } = e, o = (i, f) => A(X, n, f, () => new Intl.NumberFormat(n, f)).format(i), a = (i, f, s) => {
|
|
92
|
-
const u = S(r, n, i, f);
|
|
93
|
-
if (u !== void 0) return u;
|
|
94
|
-
if (s !== void 0) {
|
|
95
|
-
const d = J(s, f);
|
|
96
|
-
if (d !== void 0) return d;
|
|
97
|
-
}
|
|
98
|
-
const l = S(D, w, i, f);
|
|
99
|
-
if (l !== void 0) return l;
|
|
100
|
-
if (C()) {
|
|
101
|
-
let d = h.get(r);
|
|
102
|
-
d === void 0 && h.set(r, d = /* @__PURE__ */ new Set()), d.has(i) || (d.add(i), console.warn(
|
|
103
|
-
`[@reformer/core/i18n] ключа «${i}» нет в локали «${n}», и defaultMessage не задан — показан сам ключ`
|
|
104
|
-
));
|
|
105
|
-
}
|
|
106
|
-
return i;
|
|
107
|
-
}, c = {
|
|
108
|
-
locale: e,
|
|
109
|
-
code: n,
|
|
110
|
-
has: (i) => b(r, i),
|
|
111
|
-
t: a,
|
|
112
|
-
number: o,
|
|
113
|
-
date: (i, f) => A(Y, n, f, () => new Intl.DateTimeFormat(n, f)).format(
|
|
114
|
-
i
|
|
115
|
-
),
|
|
116
|
-
fileSize: (i) => {
|
|
117
|
-
if (!Number.isFinite(i) || i < 0) return "";
|
|
118
|
-
let f = i, s = 0;
|
|
119
|
-
for (; f >= 1024 && s < F.length - 1; )
|
|
120
|
-
f /= 1024, s += 1;
|
|
121
|
-
const u = o(f, { maximumFractionDigits: s === 0 ? 0 : 1, useGrouping: !1 });
|
|
122
|
-
return a(`format.fileSize.${F[s]}`, { value: u });
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
return I.set(e, c), c;
|
|
126
|
-
}
|
|
127
|
-
const H = "invalid", Q = /* @__PURE__ */ new Set([
|
|
128
|
-
"maxFileSize",
|
|
129
|
-
"minFileSize",
|
|
130
|
-
"actualSize",
|
|
131
|
-
"maxTotalFileSize",
|
|
132
|
-
"actualTotal"
|
|
133
|
-
]), _ = /* @__PURE__ */ new Map();
|
|
134
|
-
function ee(e, t) {
|
|
135
|
-
const n = t.map(String);
|
|
136
|
-
let r = _.get(e);
|
|
137
|
-
if (r === void 0) {
|
|
138
|
-
try {
|
|
139
|
-
r = new Intl.ListFormat(e, { style: "short", type: "unit" });
|
|
140
|
-
} catch {
|
|
141
|
-
r = null;
|
|
142
|
-
}
|
|
143
|
-
_.set(e, r);
|
|
144
|
-
}
|
|
145
|
-
return r === null ? n.join(", ") : r.format(n);
|
|
146
|
-
}
|
|
147
|
-
function $(e, t) {
|
|
148
|
-
if (e === void 0) return;
|
|
149
|
-
const n = {};
|
|
150
|
-
for (const r of Object.keys(e)) {
|
|
151
|
-
const o = e[r];
|
|
152
|
-
o instanceof Date ? n[r] = t.date(o, { dateStyle: "medium" }) : Array.isArray(o) ? n[r] = ee(t.code, o) : typeof o == "number" && Q.has(r) ? n[r] = t.fileSize(o) : n[r] = o;
|
|
153
|
-
}
|
|
154
|
-
return n;
|
|
155
|
-
}
|
|
156
|
-
function te(e, t) {
|
|
157
|
-
if (e.messageKey !== void 0 && t.has(e.messageKey))
|
|
158
|
-
return t.t(e.messageKey, $(e.params, t));
|
|
159
|
-
if (typeof e.message == "string" && e.message !== "" && e.message !== H)
|
|
160
|
-
return e.message;
|
|
161
|
-
const n = `validation.${e.code}`;
|
|
162
|
-
return t.has(n) || b(D, n) ? t.t(n, $(e.params, t)) : e.code;
|
|
163
|
-
}
|
|
164
|
-
const z = Symbol.for("reformer.i18n.message");
|
|
165
|
-
function ne(e, t, n) {
|
|
1
|
+
import { D as j, M as x, c as A, e as E, f as _, m as k, p as l, v as D } from "./locale-CG54AU2Q.js";
|
|
2
|
+
import { b as P, c as z, f as C } from "./loader-BWkigpVe.js";
|
|
3
|
+
import { a as R, c as T, d as $, r as q, t as w } from "./validation-message-Ced9MGxs.js";
|
|
4
|
+
import { isSignal as a } from "./signals.js";
|
|
5
|
+
const d = Symbol.for("reformer.i18n.message");
|
|
6
|
+
function g(e, r, t) {
|
|
166
7
|
return Object.freeze({
|
|
167
|
-
[
|
|
8
|
+
[d]: !0,
|
|
168
9
|
key: e,
|
|
169
|
-
...
|
|
170
|
-
...
|
|
10
|
+
...r === void 0 ? {} : { values: r },
|
|
11
|
+
...t === void 0 ? {} : { defaultMessage: t }
|
|
171
12
|
});
|
|
172
13
|
}
|
|
173
|
-
function
|
|
174
|
-
return e !== null && typeof e == "object" && e[
|
|
14
|
+
function m(e) {
|
|
15
|
+
return e !== null && typeof e == "object" && e[d] === !0;
|
|
175
16
|
}
|
|
176
|
-
function
|
|
177
|
-
return { msg: (
|
|
17
|
+
function L(e) {
|
|
18
|
+
return { msg: (r, t) => g(r, t, e[r]) };
|
|
178
19
|
}
|
|
179
|
-
function
|
|
180
|
-
const
|
|
181
|
-
return
|
|
20
|
+
function u(e) {
|
|
21
|
+
const r = Object.getPrototypeOf(e);
|
|
22
|
+
return r === Object.prototype || r === null;
|
|
182
23
|
}
|
|
183
|
-
function
|
|
184
|
-
if (e
|
|
185
|
-
const
|
|
186
|
-
return
|
|
24
|
+
function p(e) {
|
|
25
|
+
if (a(e)) return !0;
|
|
26
|
+
const r = e;
|
|
27
|
+
return r.$$typeof !== void 0 || r.__path !== void 0 || r.__kind !== void 0;
|
|
187
28
|
}
|
|
188
|
-
function
|
|
29
|
+
function y(e) {
|
|
189
30
|
if (e === void 0) return;
|
|
190
|
-
const
|
|
191
|
-
for (const
|
|
192
|
-
const
|
|
193
|
-
t
|
|
31
|
+
const r = {};
|
|
32
|
+
for (const t of Object.keys(e)) {
|
|
33
|
+
const o = e[t];
|
|
34
|
+
r[t] = a(o) ? o.value : o;
|
|
194
35
|
}
|
|
195
|
-
return
|
|
36
|
+
return r;
|
|
196
37
|
}
|
|
197
|
-
function
|
|
38
|
+
function f(e, r, t) {
|
|
198
39
|
if (e === null || typeof e != "object") return e;
|
|
199
|
-
if (
|
|
200
|
-
return
|
|
201
|
-
if (
|
|
40
|
+
if (m(e))
|
|
41
|
+
return r.t(e.key, y(e.values), e.defaultMessage);
|
|
42
|
+
if (p(e) || t.has(e)) return e;
|
|
202
43
|
if (Array.isArray(e)) {
|
|
203
|
-
|
|
204
|
-
let
|
|
205
|
-
const
|
|
206
|
-
const i =
|
|
207
|
-
return i !==
|
|
44
|
+
t.add(e);
|
|
45
|
+
let s = !1;
|
|
46
|
+
const c = e.map((n) => {
|
|
47
|
+
const i = f(n, r, t);
|
|
48
|
+
return i !== n && (s = !0), i;
|
|
208
49
|
});
|
|
209
|
-
return
|
|
50
|
+
return t.delete(e), s ? c : e;
|
|
210
51
|
}
|
|
211
|
-
if (!
|
|
212
|
-
|
|
213
|
-
let
|
|
214
|
-
for (const
|
|
215
|
-
const
|
|
216
|
-
|
|
52
|
+
if (!u(e)) return e;
|
|
53
|
+
t.add(e);
|
|
54
|
+
let o;
|
|
55
|
+
for (const s of Object.keys(e)) {
|
|
56
|
+
const c = e[s], n = f(c, r, t);
|
|
57
|
+
n !== c && (o ??= { ...e }, o[s] = n);
|
|
217
58
|
}
|
|
218
|
-
return
|
|
219
|
-
}
|
|
220
|
-
function ve(e, t) {
|
|
221
|
-
return E(e, t, /* @__PURE__ */ new Set());
|
|
222
|
-
}
|
|
223
|
-
const ae = "ReformerI18nContext";
|
|
224
|
-
function y(e, t, n) {
|
|
225
|
-
return { ...e, pending: t, error: n };
|
|
226
|
-
}
|
|
227
|
-
const ce = y(v(V), !1, void 0), m = G(ce);
|
|
228
|
-
m.displayName = ae;
|
|
229
|
-
function fe({ locale: e, children: t }) {
|
|
230
|
-
const n = p(() => y(v(e), !1, void 0), [e]);
|
|
231
|
-
return g(m.Provider, { value: n }, t);
|
|
232
|
-
}
|
|
233
|
-
function ue({
|
|
234
|
-
lang: e,
|
|
235
|
-
load: t,
|
|
236
|
-
fallback: n,
|
|
237
|
-
onError: r,
|
|
238
|
-
children: o
|
|
239
|
-
}) {
|
|
240
|
-
const a = K(r);
|
|
241
|
-
a.current = r;
|
|
242
|
-
const c = p(
|
|
243
|
-
() => q(t, e, {
|
|
244
|
-
onError: (d, R) => a.current?.(d, R)
|
|
245
|
-
}),
|
|
246
|
-
[t]
|
|
247
|
-
);
|
|
248
|
-
k(() => {
|
|
249
|
-
c.setLang(e);
|
|
250
|
-
}, [c, e]);
|
|
251
|
-
const i = W.useSyncExternalStore(c.subscribe, c.getState, c.getState), { locale: f, pending: s, error: u } = i, l = p(
|
|
252
|
-
() => f === null ? null : y(v(f), s, u),
|
|
253
|
-
[f, s, u]
|
|
254
|
-
);
|
|
255
|
-
return l === null ? n === void 0 ? null : g(x, null, n) : g(m.Provider, { value: l }, o);
|
|
256
|
-
}
|
|
257
|
-
function Ee(e) {
|
|
258
|
-
return "locale" in e ? g(fe, e) : g(ue, e);
|
|
259
|
-
}
|
|
260
|
-
function be() {
|
|
261
|
-
return M(m);
|
|
262
|
-
}
|
|
263
|
-
function Me(e) {
|
|
264
|
-
const { locale: t } = M(m);
|
|
265
|
-
return p(
|
|
266
|
-
() => (n, r) => Z(t, e, n, r),
|
|
267
|
-
[t, e]
|
|
268
|
-
);
|
|
59
|
+
return t.delete(e), o ?? e;
|
|
269
60
|
}
|
|
270
|
-
function
|
|
271
|
-
|
|
272
|
-
return p(() => {
|
|
273
|
-
const t = v(e);
|
|
274
|
-
return (n) => te(n, t);
|
|
275
|
-
}, [e]);
|
|
61
|
+
function M(e, r) {
|
|
62
|
+
return f(e, r, /* @__PURE__ */ new Set());
|
|
276
63
|
}
|
|
277
64
|
export {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
be as useI18n,
|
|
300
|
-
Me as useMessages,
|
|
301
|
-
we as useValidationMessage,
|
|
302
|
-
Te as validateLocale
|
|
65
|
+
j as DEFAULT_LOCALE,
|
|
66
|
+
d as MESSAGE_DESCRIPTOR,
|
|
67
|
+
x as MessageSyntaxError,
|
|
68
|
+
P as bundledLocaleSource,
|
|
69
|
+
R as createI18n,
|
|
70
|
+
z as createLocaleLoader,
|
|
71
|
+
T as createLocaleStore,
|
|
72
|
+
A as createMessageFormatter,
|
|
73
|
+
$ as defineIssueMessages,
|
|
74
|
+
L as defineMessages,
|
|
75
|
+
E as extendLocale,
|
|
76
|
+
C as fetchMessages,
|
|
77
|
+
_ as formatPattern,
|
|
78
|
+
m as isMessageDescriptor,
|
|
79
|
+
k as messageArguments,
|
|
80
|
+
g as msg,
|
|
81
|
+
l as parseMessage,
|
|
82
|
+
q as resolveIssueMessage,
|
|
83
|
+
M as resolveLocalized,
|
|
84
|
+
w as translateBuiltin,
|
|
85
|
+
D as validateLocale
|
|
303
86
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Публичный barrel `@reformer/core` — зонтик над слоями `model
|
|
2
|
+
* Публичный barrel `@reformer/core` — зонтик над слоями `model` и `form`.
|
|
3
3
|
*
|
|
4
4
|
* `model` — реактивная модель данных (сабпат `@reformer/core/model`); `form` — узлы, поведение и
|
|
5
|
-
* валидация поверх её
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* валидация поверх её сигналов. React здесь нет ни в рантайме, ни в типах: хуки, связка поля с
|
|
6
|
+
* контролом и React-привязки локализации живут в отдельном входе `@reformer/core/react`
|
|
7
|
+
* (`src/react.ts`), поэтому корень работает на сервере и с любым слоем представления.
|
|
8
|
+
*
|
|
9
|
+
* @module index
|
|
10
|
+
* @mergeModuleWith <project>
|
|
8
11
|
*/
|
|
9
12
|
export * from './form/types/index';
|
|
10
|
-
export
|
|
11
|
-
export
|
|
13
|
+
export { createModel, eachLeafSignal, eachValueSignal } from './model/create-model';
|
|
14
|
+
export { arrayOf } from './model/model-nodes';
|
|
15
|
+
export type { DeepPartial, FormModel, ModelArray, ModelArraySignals, ModelGroupSignals, ModelObject, ModelValue, ModelSignals, ModelApi, PathAwareSignal, } from './model/types';
|
|
16
|
+
export { isModelContainerSignal, isValueSignal } from './model/model-signals-proxy';
|
|
17
|
+
export { modelOf } from './model/model-value-proxy';
|
|
18
|
+
export type { ModelOf } from './model/model-value-proxy';
|
|
19
|
+
export type { BehaviorCleanup } from './model/behaviors-value';
|
|
20
|
+
export { markDerived, isDerived, unmarkDerived } from './model/derived-registry';
|
|
21
|
+
export { runOutsideEffect, safeCallback, safeDebouncedCallback } from './model/safe-effect';
|
|
12
22
|
export * from './form/index';
|
|
13
|
-
export * from './platforms/react/index';
|
|
14
23
|
export { CORE_RUNTIME_TOKEN } from './runtime-token';
|