@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/i18n.js CHANGED
@@ -1,303 +1,86 @@
1
- import { h as b, f as T, p as U, D as V } from "./loader-Dv_Hl7JC.js";
2
- import { M as Oe, b as he, a as Fe, c as Ae, e as Ie, d as _e, m as $e, v as Te } from "./loader-Dv_Hl7JC.js";
3
- import { m as D } from "./en-CjAqn7h0.js";
4
- import { Signal as P } from "@preact/signals-core";
5
- import { createContext as G, createElement as g, useMemo as p, useRef as K, useEffect as k, Fragment as x, useContext as M } from "react";
6
- import { s as W } from "./index-BrNkQj1y.js";
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
- [z]: !0,
8
+ [d]: !0,
168
9
  key: e,
169
- ...t === void 0 ? {} : { values: t },
170
- ...n === void 0 ? {} : { defaultMessage: n }
10
+ ...r === void 0 ? {} : { values: r },
11
+ ...t === void 0 ? {} : { defaultMessage: t }
171
12
  });
172
13
  }
173
- function re(e) {
174
- return e !== null && typeof e == "object" && e[z] === !0;
14
+ function m(e) {
15
+ return e !== null && typeof e == "object" && e[d] === !0;
175
16
  }
176
- function Se(e) {
177
- return { msg: (t, n) => ne(t, n, e[t]) };
17
+ function L(e) {
18
+ return { msg: (r, t) => g(r, t, e[r]) };
178
19
  }
179
- function oe(e) {
180
- const t = Object.getPrototypeOf(e);
181
- return t === Object.prototype || t === null;
20
+ function u(e) {
21
+ const r = Object.getPrototypeOf(e);
22
+ return r === Object.prototype || r === null;
182
23
  }
183
- function se(e) {
184
- if (e instanceof P) return !0;
185
- const t = e;
186
- return t.$$typeof !== void 0 || t.__path !== void 0 || t.__kind !== void 0;
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 ie(e) {
29
+ function y(e) {
189
30
  if (e === void 0) return;
190
- const t = {};
191
- for (const n of Object.keys(e)) {
192
- const r = e[n];
193
- t[n] = r instanceof P ? r.value : r;
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 t;
36
+ return r;
196
37
  }
197
- function E(e, t, n) {
38
+ function f(e, r, t) {
198
39
  if (e === null || typeof e != "object") return e;
199
- if (re(e))
200
- return t.t(e.key, ie(e.values), e.defaultMessage);
201
- if (se(e) || n.has(e)) return e;
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
- n.add(e);
204
- let o = !1;
205
- const a = e.map((c) => {
206
- const i = E(c, t, n);
207
- return i !== c && (o = !0), 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 n.delete(e), o ? a : e;
50
+ return t.delete(e), s ? c : e;
210
51
  }
211
- if (!oe(e)) return e;
212
- n.add(e);
213
- let r;
214
- for (const o of Object.keys(e)) {
215
- const a = e[o], c = E(a, t, n);
216
- c !== a && (r ??= { ...e }, r[o] = c);
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 n.delete(e), r ?? e;
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 we() {
271
- const { locale: e } = M(m);
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
- V as DEFAULT_LOCALE,
279
- ae as I18N_CONTEXT_MARKER,
280
- Ee as I18nProvider,
281
- z as MESSAGE_DESCRIPTOR,
282
- Oe as MessageSyntaxError,
283
- he as bundledLocaleSource,
284
- v as createI18n,
285
- Fe as createLocaleLoader,
286
- q as createLocaleStore,
287
- Ae as createMessageFormatter,
288
- Se as defineMessages,
289
- Ie as extendLocale,
290
- _e as fetchMessages,
291
- T as formatPattern,
292
- re as isMessageDescriptor,
293
- $e as messageArguments,
294
- ne as msg,
295
- U as parseMessage,
296
- ve as resolveLocalized,
297
- te as resolveValidationError,
298
- Z as translateBuiltin,
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`, `form` и `platforms/react`.
2
+ * Публичный barrel `@reformer/core` — зонтик над слоями `model` и `form`.
3
3
  *
4
4
  * `model` — реактивная модель данных (сабпат `@reformer/core/model`); `form` — узлы, поведение и
5
- * валидация поверх её сигналов; `platforms/react` — биндинги в React, единственный слой с
6
- * рантайм-зависимостью от `react`. Состав экспортов зонтика не меняется при реорганизациях:
7
- * реализация разложена по слоям, а barrel по-прежнему отдаёт единую поверхность.
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 * from './form/factories/index';
11
- export * from './model/index';
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';