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

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 (56) hide show
  1. package/README.md +7 -3
  2. package/dist/behaviors.js +211 -174
  3. package/dist/create-model-BBRHhHwK.js +30 -0
  4. package/dist/form/behaviors/collections.d.ts +14 -1
  5. package/dist/form/behaviors/context.d.ts +18 -2
  6. package/dist/form/behaviors/index.d.ts +3 -1
  7. package/dist/form/behaviors/internals.d.ts +0 -1
  8. package/dist/form/behaviors/schema-operators.d.ts +76 -0
  9. package/dist/form/behaviors/types.d.ts +15 -3
  10. package/dist/form/create-core-form.d.ts +5 -3
  11. package/dist/form/create-form.d.ts +28 -53
  12. package/dist/form/form-bundle.d.ts +136 -0
  13. package/dist/form/index.d.ts +6 -1
  14. package/dist/form/nodes/field-node.d.ts +2 -2
  15. package/dist/form/nodes/group-node.d.ts +1 -1
  16. package/dist/form/nodes/model-array-node.d.ts +10 -5
  17. package/dist/form/schema-controller.d.ts +137 -0
  18. package/dist/form/schema-subtree.d.ts +28 -0
  19. package/dist/form/signal-node-registry.d.ts +22 -16
  20. package/dist/form/types/deep-schema.d.ts +2 -2
  21. package/dist/form/types/form-proxy.d.ts +1 -1
  22. package/dist/form/types/schema-node.d.ts +37 -12
  23. package/dist/form/validation/context.d.ts +6 -1
  24. package/dist/form/validation/index.d.ts +1 -1
  25. package/dist/form/validation/operators.d.ts +70 -8
  26. package/dist/form/validation/types.d.ts +2 -1
  27. package/dist/index.js +345 -254
  28. package/dist/model/index.d.ts +5 -0
  29. package/dist/model/model-nodes.d.ts +67 -4
  30. package/dist/model/model-signals-proxy.d.ts +8 -1
  31. package/dist/model/model-value-proxy.d.ts +76 -0
  32. package/dist/model/types.d.ts +7 -4
  33. package/dist/model-value-proxy-caTmAiUd.js +419 -0
  34. package/dist/model.js +19 -17
  35. package/dist/node-BeV_lV5i.js +100 -0
  36. package/dist/platforms/react/form-bundle-context.d.ts +27 -0
  37. package/dist/platforms/react/index.d.ts +1 -0
  38. package/dist/strategy-DgzELWno.js +204 -0
  39. package/dist/validation.js +7 -6
  40. package/docs/llms/03-api-signatures.md +4 -4
  41. package/docs/llms/09-formschema.md +5 -5
  42. package/docs/llms/10-arrays.md +23 -4
  43. package/docs/llms/16-ui-components.md +2 -2
  44. package/docs/llms/18-conditional-fields.md +1 -1
  45. package/docs/llms/21-array-operations.md +26 -0
  46. package/docs/llms/28-submit-and-reset.md +3 -3
  47. package/docs/llms/29-async-preload.md +4 -4
  48. package/docs/llms/33-validation-strategy.md +2 -2
  49. package/docs/llms/35-unified-contract.md +246 -0
  50. package/llms-index.json +1 -1
  51. package/llms.txt +1148 -122
  52. package/package.json +1 -1
  53. package/dist/create-model-B8U-COv-.js +0 -103
  54. package/dist/model-signals-proxy-2vqS243J.js +0 -250
  55. package/dist/node-DGEFMTQu.js +0 -18
  56. package/dist/strategy-BXS_gBfz.js +0 -170
package/dist/index.js CHANGED
@@ -1,16 +1,17 @@
1
- import { c as K } from "./create-model-B8U-COv-.js";
2
- import { e as He, a as Ke } from "./create-model-B8U-COv-.js";
3
- import { b as R, d as L, a as $ } from "./model-signals-proxy-2vqS243J.js";
4
- import { i as Ye, m as Je, u as Qe } from "./model-signals-proxy-2vqS243J.js";
5
- import { c as Ze, a as et, r as tt, b as st, d as it, e as rt, f as nt, s as at, t as ot, w as lt } from "./behaviors-value-C7dSEhCc.js";
6
- import { signal as m, computed as h, effect as g, batch as z, Signal as Y } from "@preact/signals-core";
7
- import { r as J } from "./signal-node-registry-tiwel-TV.js";
8
- import { g as dt } from "./signal-node-registry-tiwel-TV.js";
9
- import { f as Q, h as P, g as X, d as Z } from "./strategy-BXS_gBfz.js";
10
- import { d as ht, e as ft } from "./node-DGEFMTQu.js";
11
- import { useRef as _, useCallback as y, useMemo as ee, useEffect as U, useState as te, useImperativeHandle as se } from "react";
12
- import { s as F } from "./index-BrNkQj1y.js";
13
- class N {
1
+ import { c as te } from "./create-model-BBRHhHwK.js";
2
+ import { e as dt, a as ct } from "./create-model-BBRHhHwK.js";
3
+ import { d as G, m as Y, b as D, i as j, f as W, h as L, p as se, g as re, j as ie } from "./model-value-proxy-caTmAiUd.js";
4
+ import { a as ft, c as vt, u as mt } from "./model-value-proxy-caTmAiUd.js";
5
+ import { c as yt, a as gt, r as bt, b as Et, d as _t, e as wt, f as At, s as Vt, t as kt, w as St } from "./behaviors-value-C7dSEhCc.js";
6
+ import { signal as m, computed as h, effect as g, batch as ne, Signal as ae } from "@preact/signals-core";
7
+ import { r as N } from "./signal-node-registry-tiwel-TV.js";
8
+ import { g as Nt } from "./signal-node-registry-tiwel-TV.js";
9
+ import { c as oe, u as le } from "./node-BeV_lV5i.js";
10
+ import { b as Ct, a as Pt, d as xt, e as Ot } from "./node-BeV_lV5i.js";
11
+ import { g as ue, i as I, h as de, d as ce } from "./strategy-DgzELWno.js";
12
+ import { useRef as E, useCallback as y, useMemo as he, useEffect as Q, useState as fe, createContext as ve, useContext as me, useImperativeHandle as pe } from "react";
13
+ import { s as P } from "./index-BrNkQj1y.js";
14
+ class x {
14
15
  // ============================================================================
15
16
  // Protected состояние (для Template Method паттерна)
16
17
  // ============================================================================
@@ -275,7 +276,7 @@ class N {
275
276
  onEnable() {
276
277
  }
277
278
  }
278
- class x {
279
+ class $ {
279
280
  /**
280
281
  * Хранилище подписок
281
282
  * Ключ: уникальный идентификатор подписки
@@ -453,11 +454,11 @@ const k = {
453
454
  /** GroupNode.watchField() */
454
455
  WatchField: "watchField"
455
456
  };
456
- let ie = 0;
457
- function V(s) {
458
- return `${s}-${++ie}`;
457
+ let ye = 0;
458
+ function S(s) {
459
+ return `${s}-${++ye}`;
459
460
  }
460
- var E = /* @__PURE__ */ ((s) => (s.THROW = "throw", s.LOG = "log", s.CONVERT = "convert", s))(E || {});
461
+ var b = /* @__PURE__ */ ((s) => (s.THROW = "throw", s.LOG = "log", s.CONVERT = "convert", s))(b || {});
461
462
  class w {
462
463
  static handle(e, t, i = "throw") {
463
464
  const r = this.extractMessage(e);
@@ -551,7 +552,7 @@ class w {
551
552
  return typeof e == "object" && e !== null && "code" in e && "message" in e && typeof e.code == "string" && typeof e.message == "string";
552
553
  }
553
554
  }
554
- class re {
555
+ class ge {
555
556
  /** Внутренний сигнал статуса */
556
557
  _status;
557
558
  /** Публичный read-only сигнал статуса */
@@ -651,7 +652,7 @@ class re {
651
652
  this._status.value = e ? "invalid" : "valid";
652
653
  }
653
654
  }
654
- class ne extends N {
655
+ class be extends x {
655
656
  // ============================================================================
656
657
  // Приватные сигналы
657
658
  // ============================================================================
@@ -703,13 +704,13 @@ class ne extends N {
703
704
  * Менеджер подписок для централизованного cleanup
704
705
  * Использует SubscriptionManager вместо массива для управления подписками
705
706
  */
706
- disposers = new x();
707
+ disposers = new $();
707
708
  component;
708
709
  // ============================================================================
709
710
  // Конструктор
710
711
  // ============================================================================
711
712
  constructor(e) {
712
- super(), this.validators = e.validators || [], this.asyncValidators = e.asyncValidators || [], this.updateOn = e.updateOn || "blur", this.debounceMs = e.debounce || 0, this.component = e.component, this._value = e.valueSignal ?? m(e.value), this.initialValue = this._value.peek(), this._errors = m([]), this._componentProps = m(e.componentProps || {}), this.statusMachine = new re(e.disabled ? "disabled" : "valid"), this.value = h(() => this._value.value), this.valid = h(() => this.statusMachine.valid.value), this.invalid = h(() => this.statusMachine.invalid.value), this.pending = h(() => this.statusMachine.pending.value), this.status = h(() => this.statusMachine.status.value), this.disabled = h(() => this.statusMachine.disabled.value), this.errors = h(() => this._errors.value), this.componentProps = h(() => this._componentProps.value), this.shouldShowError = h(
713
+ super(), this.validators = e.validators || [], this.asyncValidators = e.asyncValidators || [], this.updateOn = e.updateOn || "blur", this.debounceMs = e.debounce || 0, this.component = e.component, this._value = e.valueSignal ?? m(e.value), this.initialValue = this._value.peek(), this._errors = m([]), this._componentProps = m(e.componentProps || {}), this.statusMachine = new ge(e.disabled ? "disabled" : "valid"), this.value = h(() => this._value.value), this.valid = h(() => this.statusMachine.valid.value), this.invalid = h(() => this.statusMachine.invalid.value), this.pending = h(() => this.statusMachine.pending.value), this.status = h(() => this.statusMachine.status.value), this.disabled = h(() => this.statusMachine.disabled.value), this.errors = h(() => this._errors.value), this.componentProps = h(() => this._componentProps.value), this.shouldShowError = h(
713
714
  () => this.statusMachine.invalid.value && (this._touched.value || this._dirty.value)
714
715
  );
715
716
  }
@@ -885,7 +886,7 @@ class ne extends N {
885
886
  return w.handle(
886
887
  l,
887
888
  "FieldNode AsyncValidator",
888
- E.CONVERT
889
+ b.CONVERT
889
890
  );
890
891
  }
891
892
  })
@@ -967,10 +968,10 @@ class ne extends N {
967
968
  *
968
969
  * @example
969
970
  * Пример node-level: плоская схема с инлайн-значениями (back-compat путь до M1). В layout-схеме
970
- * `createForm({ model, schema })` поля `validators` нет — правила живут в `defineValidationSchema`.
971
+ * `createFormFromModel({ model, schema })` поля `validators` нет — правила живут в `defineValidationSchema`.
971
972
  * ```typescript
972
973
  * // Сценарий 1: Instant feedback после submit
973
- * const form = createForm({
974
+ * const form = createLegacyForm({
974
975
  * email: {
975
976
  * value: '',
976
977
  * component: Input,
@@ -1031,7 +1032,7 @@ class ne extends N {
1031
1032
  const t = new AbortController(), i = g(() => {
1032
1033
  const n = this.value.value;
1033
1034
  e(n, t.signal);
1034
- }), r = V(k.Watch);
1035
+ }), r = S(k.Watch);
1035
1036
  return this.disposers.add(r, () => {
1036
1037
  t.abort(), i();
1037
1038
  });
@@ -1062,7 +1063,7 @@ class ne extends N {
1062
1063
  const i = g(() => {
1063
1064
  const n = e.map((u) => u.value), a = t(...n);
1064
1065
  this.setValue(a, { emitEvent: !1 });
1065
- }), r = V(k.ComputeFrom);
1066
+ }), r = S(k.ComputeFrom);
1066
1067
  return this.disposers.add(r, i);
1067
1068
  }
1068
1069
  /**
@@ -1093,7 +1094,7 @@ class ne extends N {
1093
1094
  }
1094
1095
  }
1095
1096
  }
1096
- function O(s) {
1097
+ function R(s) {
1097
1098
  const { getChildren: e, ownErrors: t, disabled: i } = s, r = h(() => t.value.length > 0 ? !1 : e().every((o) => o.disabled.value || o.valid.value)), n = h(() => !r.value), a = h(() => e().some((o) => o.pending.value)), u = h(() => e().some((o) => o.touched.value)), d = h(() => e().some((o) => o.dirty.value)), l = h(() => {
1098
1099
  const o = [...t.value];
1099
1100
  for (const f of e())
@@ -1110,34 +1111,34 @@ function O(s) {
1110
1111
  status: c
1111
1112
  };
1112
1113
  }
1113
- function B(s) {
1114
+ function U(s) {
1114
1115
  return typeof s == "object" && s !== null && "getProxy" in s && typeof s.getProxy == "function";
1115
1116
  }
1116
- const G = "$";
1117
- function ae(s, e) {
1117
+ const H = "$";
1118
+ function Ee(s, e) {
1118
1119
  let t;
1119
1120
  const i = () => {
1120
1121
  if (!t) {
1121
1122
  const r = {};
1122
1123
  e.forEach((n, a) => {
1123
- r[a] = n && B(n) ? n.getProxy() : n;
1124
+ r[a] = n && U(n) ? n.getProxy() : n;
1124
1125
  }), t = r;
1125
1126
  }
1126
1127
  return t;
1127
1128
  };
1128
1129
  return new Proxy(s, {
1129
1130
  get: (r, n) => {
1130
- if (n === G)
1131
+ if (n === H)
1131
1132
  return i();
1132
1133
  if (n in r)
1133
1134
  return r[n];
1134
1135
  if (typeof n == "string" && e.has(n)) {
1135
1136
  const a = e.get(n);
1136
- return a && B(a) ? a.getProxy() : a;
1137
+ return a && U(a) ? a.getProxy() : a;
1137
1138
  }
1138
1139
  },
1139
1140
  set: (r, n, a) => typeof n == "string" && e.has(n) ? !1 : (r[n] = a, !0),
1140
- has: (r, n) => n === G || typeof n == "string" && e.has(n) ? !0 : n in r,
1141
+ has: (r, n) => n === H || typeof n == "string" && e.has(n) ? !0 : n in r,
1141
1142
  ownKeys: (r) => {
1142
1143
  const n = Reflect.ownKeys(r), a = Array.from(e.keys());
1143
1144
  return [.../* @__PURE__ */ new Set([...n, ...a])];
@@ -1145,7 +1146,7 @@ function ae(s, e) {
1145
1146
  getOwnPropertyDescriptor: (r, n) => typeof n == "string" && e.has(n) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(r, n)
1146
1147
  });
1147
1148
  }
1148
- class oe {
1149
+ class _e {
1149
1150
  /**
1150
1151
  * @param form - Форма для отправки
1151
1152
  */
@@ -1242,7 +1243,7 @@ class oe {
1242
1243
  }
1243
1244
  }
1244
1245
  }
1245
- function le(s) {
1246
+ function we(s) {
1246
1247
  const e = [];
1247
1248
  for (const t of s.split(".")) {
1248
1249
  const i = /^([^[\]]+)(?:\[(\d+)\])?$/.exec(t);
@@ -1251,7 +1252,7 @@ function le(s) {
1251
1252
  }
1252
1253
  return e;
1253
1254
  }
1254
- class A extends N {
1255
+ class _ extends x {
1255
1256
  // ============================================================================
1256
1257
  // Приватные поля
1257
1258
  // ============================================================================
@@ -1264,7 +1265,7 @@ class A extends N {
1264
1265
  /**
1265
1266
  * Менеджер подписок для централизованного cleanup
1266
1267
  */
1267
- disposers = new x();
1268
+ disposers = new $();
1268
1269
  /**
1269
1270
  * Ссылка на Proxy-инстанс
1270
1271
  */
@@ -1276,7 +1277,7 @@ class A extends N {
1276
1277
  /**
1277
1278
  * Фабрика для создания узлов формы
1278
1279
  */
1279
- nodeFactory = new ue();
1280
+ nodeFactory = new Ae();
1280
1281
  // ============================================================================
1281
1282
  // Приватные сигналы состояния (inline из StateManager)
1282
1283
  // ============================================================================
@@ -1307,7 +1308,7 @@ class A extends N {
1307
1308
  status;
1308
1309
  submitting;
1309
1310
  constructor(e) {
1310
- super(), this.formSubmitter = new oe(this);
1311
+ super(), this.formSubmitter = new _e(this);
1311
1312
  const t = e.form, i = t != null && typeof t == "object" && ("valueSignal" in t || "value" in t), n = "form" in e && !i ? e.form : e;
1312
1313
  for (const [u, d] of Object.entries(n)) {
1313
1314
  const l = this.createNode(d);
@@ -1319,7 +1320,7 @@ class A extends N {
1319
1320
  u[l] = d.value.value;
1320
1321
  }), u;
1321
1322
  });
1322
- const a = O({
1323
+ const a = R({
1323
1324
  getChildren: () => Array.from(this._fields.values()),
1324
1325
  ownErrors: this._formErrors,
1325
1326
  disabled: this._disabled
@@ -1334,7 +1335,7 @@ class A extends N {
1334
1335
  * @see buildFormProxy
1335
1336
  */
1336
1337
  buildProxy() {
1337
- return ae(this, this._fields);
1338
+ return Ee(this, this._fields);
1338
1339
  }
1339
1340
  // ============================================================================
1340
1341
  // Реализация абстрактных методов FormNode
@@ -1350,18 +1351,18 @@ class A extends N {
1350
1351
  const n = this._fields.get(i);
1351
1352
  if (n) {
1352
1353
  const a = this._fieldSignals.get(n) ?? n.value;
1353
- if (R(a)) continue;
1354
+ if (G(a)) continue;
1354
1355
  n.setValue(r, t);
1355
1356
  }
1356
1357
  }
1357
1358
  }
1358
1359
  patchValue(e) {
1359
- z(() => {
1360
+ ne(() => {
1360
1361
  for (const [t, i] of Object.entries(e)) {
1361
1362
  const r = this._fields.get(t);
1362
1363
  if (r && i !== void 0) {
1363
1364
  const n = this._fieldSignals.get(r) ?? r.value;
1364
- if (R(n)) continue;
1365
+ if (G(n)) continue;
1365
1366
  r.setValue(i, { emitEvent: !1 });
1366
1367
  }
1367
1368
  }
@@ -1531,12 +1532,12 @@ class A extends N {
1531
1532
  getFieldByPath(e) {
1532
1533
  if (e.startsWith(".") || e.endsWith("."))
1533
1534
  return;
1534
- const t = le(e);
1535
+ const t = we(e);
1535
1536
  if (t.length === 0)
1536
1537
  return;
1537
1538
  let i = this;
1538
1539
  for (const r of t) {
1539
- if (!(i instanceof A) || (i = i.getField(r.key), !i)) return;
1540
+ if (!(i instanceof _) || (i = i.getField(r.key), !i)) return;
1540
1541
  if (r.index !== void 0)
1541
1542
  if ("at" in i && "length" in i && typeof i.at == "function") {
1542
1543
  const n = i.at(r.index);
@@ -1583,7 +1584,7 @@ class A extends N {
1583
1584
  const a = g(() => {
1584
1585
  const d = r.value.value, l = i ? i(d) : d;
1585
1586
  n.setValue(l, { emitEvent: !1 });
1586
- }), u = V(k.LinkFields);
1587
+ }), u = S(k.LinkFields);
1587
1588
  return this.disposers.add(u, a);
1588
1589
  }
1589
1590
  /**
@@ -1620,7 +1621,7 @@ class A extends N {
1620
1621
  throw new Error(`GroupNode.watchField: field "${e}" not found`);
1621
1622
  const r = g(() => {
1622
1623
  t(i.value.value);
1623
- }), n = V(k.WatchField);
1624
+ }), n = S(k.WatchField);
1624
1625
  return this.disposers.add(n, r);
1625
1626
  }
1626
1627
  /**
@@ -1633,7 +1634,7 @@ class A extends N {
1633
1634
  throw new Error(`GroupNode.watchFieldByPath: field "${e}" not found`);
1634
1635
  const r = g(() => {
1635
1636
  t(i.value.value);
1636
- }), n = V(k.WatchField);
1637
+ }), n = S(k.WatchField);
1637
1638
  return this.disposers.add(n, r);
1638
1639
  }
1639
1640
  /**
@@ -1673,7 +1674,7 @@ class A extends N {
1673
1674
  });
1674
1675
  }
1675
1676
  }
1676
- class j extends N {
1677
+ class q extends x {
1677
1678
  // ============================================================================
1678
1679
  // Приватные поля
1679
1680
  // ============================================================================
@@ -1684,7 +1685,7 @@ class j extends N {
1684
1685
  * Менеджер подписок для централизованного cleanup
1685
1686
  * Использует SubscriptionManager вместо массива для управления подписками
1686
1687
  */
1687
- disposers = new x();
1688
+ disposers = new $();
1688
1689
  /** Array-level validation errors (e.g., "минимум 1 элемент") */
1689
1690
  _arrayErrors = m([]);
1690
1691
  // ============================================================================
@@ -1707,7 +1708,7 @@ class j extends N {
1707
1708
  for (const r of t)
1708
1709
  this.push(r);
1709
1710
  this.length = h(() => this.items.value.length), this.value = h(() => this.items.value.map((r) => r.value.value));
1710
- const i = O({
1711
+ const i = R({
1711
1712
  getChildren: () => this.items.value,
1712
1713
  ownErrors: this._arrayErrors
1713
1714
  });
@@ -1738,7 +1739,7 @@ class j extends N {
1738
1739
  `ArrayNode.removeAt: index ${e} out of bounds (length: ${this.items.value.length})`
1739
1740
  ),
1740
1741
  "ArrayNode.removeAt",
1741
- E.LOG
1742
+ b.LOG
1742
1743
  );
1743
1744
  return;
1744
1745
  }
@@ -1757,7 +1758,7 @@ class j extends N {
1757
1758
  `ArrayNode.insert: index ${e} out of bounds (length: ${this.items.value.length})`
1758
1759
  ),
1759
1760
  "ArrayNode.insert",
1760
- E.LOG
1761
+ b.LOG
1761
1762
  );
1762
1763
  return;
1763
1764
  }
@@ -1786,7 +1787,7 @@ class j extends N {
1786
1787
  w.handle(
1787
1788
  new Error(`ArrayNode.move: index out of bounds (from=${e}, to=${t}, length=${i})`),
1788
1789
  "ArrayNode.move",
1789
- E.LOG
1790
+ b.LOG
1790
1791
  );
1791
1792
  return;
1792
1793
  }
@@ -1814,7 +1815,7 @@ class j extends N {
1814
1815
  w.handle(
1815
1816
  new Error(`ArrayNode.swap: index out of bounds (a=${e}, b=${t}, length=${i})`),
1816
1817
  "ArrayNode.swap",
1817
- E.LOG
1818
+ b.LOG
1818
1819
  );
1819
1820
  return;
1820
1821
  }
@@ -1852,7 +1853,7 @@ class j extends N {
1852
1853
  }
1853
1854
  setValue(e, t) {
1854
1855
  this.clear(), e.forEach((i) => this.push(i)), t?.emitEvent !== !1 && this.validate().catch((i) => {
1855
- w.handle(i, "ArrayNode.setValue", E.LOG);
1856
+ w.handle(i, "ArrayNode.setValue", b.LOG);
1856
1857
  });
1857
1858
  }
1858
1859
  patchValue(e) {
@@ -2010,7 +2011,7 @@ class j extends N {
2010
2011
  */
2011
2012
  createItem(e) {
2012
2013
  if (this.isGroupSchema(this.itemSchema)) {
2013
- const t = new A(this.itemSchema);
2014
+ const t = new _(this.itemSchema);
2014
2015
  return e && t.patchValue(e), t;
2015
2016
  }
2016
2017
  throw new Error(
@@ -2088,7 +2089,7 @@ class j extends N {
2088
2089
  });
2089
2090
  }
2090
2091
  }
2091
- class ue {
2092
+ class Ae {
2092
2093
  /**
2093
2094
  * Создает узел формы на основе конфигурации
2094
2095
  *
@@ -2139,14 +2140,14 @@ class ue {
2139
2140
  if (Array.isArray(e) && e.length >= 1)
2140
2141
  return this.createArrayNodeFromArray(e);
2141
2142
  if (this.isFieldConfig(e))
2142
- return new ne(e);
2143
+ return new be(e);
2143
2144
  if (this.isArrayConfig(e))
2144
- return new j(
2145
+ return new q(
2145
2146
  e.schema,
2146
2147
  e.initialItems
2147
2148
  );
2148
2149
  if (this.isGroupConfig(e))
2149
- return new A(e);
2150
+ return new _(e);
2150
2151
  throw new Error(
2151
2152
  `NodeFactory: Unknown node config. Expected FieldConfig, GroupConfig, or ArrayConfig, but got: ${JSON.stringify(
2152
2153
  e
@@ -2184,7 +2185,7 @@ class ue {
2184
2185
  this.isGroupConfig(t) && r.push(this.extractValues(t));
2185
2186
  for (const n of i)
2186
2187
  this.isGroupConfig(n) ? r.push(this.extractValues(n)) : r.push(n);
2187
- return new j(t, r);
2188
+ return new q(t, r);
2188
2189
  }
2189
2190
  /**
2190
2191
  * Извлечь значения из схемы (рекурсивно)
@@ -2303,11 +2304,11 @@ class ue {
2303
2304
  return e != null && typeof e == "object" && !this.isFieldConfig(e) && !this.isArrayConfig(e);
2304
2305
  }
2305
2306
  }
2306
- class de extends N {
2307
+ class Ve extends x {
2307
2308
  /**
2308
2309
  * @param control Реактивный массив модели (`model.<path>`).
2309
2310
  * @param buildItem Строитель формы элемента по его под-модели (инъекция, чтобы избежать цикла
2310
- * импорта с `create-form`). Обычно `(item) => createForm({ model: item, schema: itemSchema(item) })`.
2311
+ * импорта с `create-form`). Обычно `(item) => createFormFromModel({ model: item, schema: itemSchema(item) })`.
2311
2312
  */
2312
2313
  constructor(e, t) {
2313
2314
  super(), this.control = e, this.buildItem = t, this.initial = e.toArray(), this.disposeSync = g(() => {
@@ -2326,7 +2327,7 @@ class de extends N {
2326
2327
  }
2327
2328
  this.mountedModels = n, this.itemNodes.value = a, d.forEach((l) => this.disposeItemNode(l));
2328
2329
  }), this.length = h(() => this.itemNodes.value.length), this.value = h(() => this.itemNodes.value.map((r) => r.value.value));
2329
- const i = O({
2330
+ const i = R({
2330
2331
  getChildren: () => this.itemNodes.value,
2331
2332
  ownErrors: this._arrayErrors
2332
2333
  });
@@ -2368,11 +2369,16 @@ class de extends N {
2368
2369
  this.itemNodes.value.forEach((t, i) => e(t, i));
2369
2370
  }
2370
2371
  // ── Мутации (делегируют массиву модели; effect пересоберёт itemNodes) ──────
2372
+ /**
2373
+ * Добавить элемент. Без значения — элемент по шаблону массива модели (`arrayOf(blank)` либо
2374
+ * `initialValue` узла-массива схемы); шаблона нет — ошибка модели.
2375
+ */
2371
2376
  push(e) {
2372
- this.control.push(e ?? {});
2377
+ this.control.push(e);
2373
2378
  }
2379
+ /** Вставить элемент по индексу; без значения — по шаблону, как у {@link push}. */
2374
2380
  insert(e, t) {
2375
- this.control.insertAt(e, t ?? {});
2381
+ this.control.insertAt(e, t);
2376
2382
  }
2377
2383
  removeAt(e) {
2378
2384
  this.control.removeAt(e);
@@ -2465,52 +2471,79 @@ class de extends N {
2465
2471
  this.disposeSync(), this.itemNodes.value.forEach((e) => this.disposeItemNode(e)), this.mountedModels = [];
2466
2472
  }
2467
2473
  }
2468
- function C(s, e, t) {
2469
- if (s == null || typeof s != "object" || $(s)) return;
2470
- if (typeof s.getProxy == "function") {
2474
+ const K = /* @__PURE__ */ new WeakMap();
2475
+ function X(s, e) {
2476
+ let t = K.get(e);
2477
+ return t || (t = /* @__PURE__ */ new Map(), K.set(e, t)), t.has(s) || t.set(s, s(e)), t.get(s);
2478
+ }
2479
+ function M(s, e, t, i) {
2480
+ if (s == null || typeof s != "object" || D(s) || j(s) || W(s) || s.$$typeof !== void 0 || i.has(s)) return;
2481
+ if (i.add(s), typeof s.getProxy == "function") {
2471
2482
  process.env.NODE_ENV !== "production" && console.warn(
2472
2483
  "[reformer] createForm({ schema }): в схему попал узел формы (FormProxy) — он пропущен. Стройте дерево для createForm БЕЗ формы, а форму донесите до узла вторым проходом (билдер `(model, form?) => …`) либо через render-behavior `patchProps({ form })`."
2473
2484
  );
2474
2485
  return;
2475
2486
  }
2476
2487
  if (Array.isArray(s)) {
2477
- for (const n of s) C(n, e, t);
2488
+ for (const a of s) M(a, e, t, i);
2478
2489
  return;
2479
2490
  }
2480
- const i = s, r = i.array;
2481
- if (r && typeof r.__path == "string" && typeof i.item == "function") {
2482
- t.set(r.__path, i.item);
2483
- return;
2491
+ const r = s;
2492
+ if (typeof r.item == "function") {
2493
+ const a = L(r.model) ?? L(r.array);
2494
+ if (a) {
2495
+ t.set(a, r.item), r.initialValue !== void 0 && se(a, r.initialValue);
2496
+ return;
2497
+ }
2498
+ if (r.array != null) {
2499
+ process.env.NODE_ENV !== "production" && console.warn(
2500
+ "[reformer] createForm({ schema }): у узла-массива `array` — не массив модели, узел пропущен. Ожидается `model: model.$.<массив>`."
2501
+ );
2502
+ return;
2503
+ }
2504
+ }
2505
+ if (typeof r.part == "function") {
2506
+ const a = re(r.model);
2507
+ if (a) {
2508
+ const u = Y(a), d = X(r.part, u);
2509
+ M(d, e, t, i);
2510
+ return;
2511
+ }
2484
2512
  }
2485
- $(i.value) ? e.set(i.value, {
2486
- component: i.component,
2487
- componentProps: i.componentProps,
2488
- updateOn: i.updateOn,
2489
- disabled: i.disabled,
2490
- debounce: i.debounce
2491
- }) : process.env.NODE_ENV !== "production" && i.component !== void 0 && ("valueSignal" in i || i.value != null) && console.warn(
2492
- "[reformer] createForm({ schema }): узел с `component` не распознан как поле — `value` не является сигналом модели. Ожидается `value: model.$.<path>` (лист или массив); проверьте, что не передан `value: model.<path>` (value-прокси), группа или `valueSignal:`."
2513
+ const n = D(r.model) ? r.model : r.value;
2514
+ D(n) ? e.set(n, {
2515
+ component: r.component,
2516
+ componentProps: r.componentProps,
2517
+ updateOn: r.updateOn,
2518
+ disabled: r.disabled,
2519
+ debounce: r.debounce
2520
+ }) : process.env.NODE_ENV !== "production" && r.component !== void 0 && ("valueSignal" in r || r.value != null || W(r.model) || j(r.model)) && console.warn(
2521
+ "[reformer] createForm({ schema }): узел с `component` не распознан как поле — привязка не является сигналом модели. Ожидается `model: model.$.<path>` (лист или массив); проверьте, что не передан `model: model.<path>` (value-прокси), группа без `part` или `valueSignal:`."
2493
2522
  );
2494
- for (const [n, a] of Object.entries(i))
2495
- n !== "value" && C(a, e, t);
2523
+ for (const a of Object.values(r)) M(a, e, t, i);
2496
2524
  }
2497
- function q(s, e, t, i, r) {
2525
+ function Z(s, e, t, i, r) {
2498
2526
  const n = {};
2499
2527
  for (const a of Object.keys(s)) {
2500
2528
  const u = e === "" ? a : `${e}.${a}`, d = s[a];
2501
- if (L(d)) {
2502
- const l = i.has(u) ? void 0 : t.get(d);
2503
- if (l !== void 0) {
2504
- const c = d;
2505
- n[a] = { ...l, valueSignal: c }, r.push({ path: u, signal: c });
2529
+ if (ie(d)) {
2530
+ const l = i.get(d);
2531
+ if (l) {
2532
+ r.arrays.push({ path: u, handle: d, item: l });
2533
+ continue;
2534
+ }
2535
+ const c = t.get(d);
2536
+ if (c !== void 0) {
2537
+ const o = d;
2538
+ n[a] = { ...c, valueSignal: o }, r.fields.push({ path: u, signal: o });
2506
2539
  }
2507
2540
  continue;
2508
2541
  }
2509
- if (d instanceof Y) {
2510
- n[a] = { ...t.get(d) ?? {}, valueSignal: d }, r.push({ path: u, signal: d });
2542
+ if (d instanceof ae) {
2543
+ n[a] = { ...t.get(d) ?? {}, valueSignal: d }, r.fields.push({ path: u, signal: d });
2511
2544
  continue;
2512
2545
  }
2513
- n[a] = q(
2546
+ r.groups.push({ path: u, handle: d }), n[a] = Z(
2514
2547
  d,
2515
2548
  u,
2516
2549
  t,
@@ -2520,42 +2553,47 @@ function q(s, e, t, i, r) {
2520
2553
  }
2521
2554
  return n;
2522
2555
  }
2523
- function H(s) {
2556
+ function z(s, e) {
2557
+ const t = e.lastIndexOf(".");
2558
+ if (t === -1) return s;
2559
+ const i = s.getFieldByPath(e.slice(0, t));
2560
+ return i instanceof _ ? i : void 0;
2561
+ }
2562
+ function ee(s) {
2524
2563
  const { model: e, schema: t, behavior: i } = s, r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
2525
- t !== void 0 && C(t, r, n);
2526
- const a = e.$, u = [], d = q(a, "", r, n, u), l = new A(d);
2527
- for (const o of Object.keys(a)) {
2528
- if (!L(a[o])) continue;
2529
- const f = n.get(o);
2530
- if (!f) continue;
2531
- const p = e[o], v = (S) => H({ model: S, schema: f(S) }), b = new de(p, v);
2532
- l.fields.set(o, b);
2564
+ t !== void 0 && M(t, r, n, /* @__PURE__ */ new WeakSet());
2565
+ const a = e.$, u = { fields: [], groups: [], arrays: [] }, d = Z(a, "", r, n, u), l = new _(d);
2566
+ for (const { path: o, handle: f, item: v } of u.arrays) {
2567
+ const p = z(l, o);
2568
+ if (!p) continue;
2569
+ const F = (V) => ee({ model: V, schema: X(v, V) }), T = Y(f), A = new Ve(T, F);
2570
+ p.fields.set(o.slice(o.lastIndexOf(".") + 1), A), N(f, A);
2533
2571
  }
2534
2572
  const c = l.getProxy();
2535
- for (const { path: o, signal: f } of u) {
2536
- const p = l.getFieldByPath(o);
2537
- if (p) {
2538
- J(f, p);
2539
- const v = o.lastIndexOf("."), b = v === -1 ? l : l.getFieldByPath(o.slice(0, v));
2540
- b instanceof A && b.registerFieldSignal(p, f);
2541
- }
2573
+ N(e.$, l);
2574
+ for (const { path: o, handle: f } of u.groups) {
2575
+ const v = l.getFieldByPath(o);
2576
+ v && N(f, v);
2577
+ }
2578
+ for (const { path: o, signal: f } of u.fields) {
2579
+ const v = l.getFieldByPath(o);
2580
+ v && (N(f, v), z(l, o)?.registerFieldSignal(v, f));
2542
2581
  }
2543
- return i && l.attachBehaviorCleanup(i.__run(e, c)), c;
2582
+ return i && l.attachBehaviorCleanup(i.__run(e, c, s.schemaController)), c;
2544
2583
  }
2545
- const ce = (s) => s != null && typeof s == "object" && "model" in s && typeof s.model?.signalAt == "function";
2546
- function he(s) {
2547
- return ce(s) ? H(s) : new A(s).getProxy();
2584
+ function Je(s) {
2585
+ return new _(s).getProxy();
2548
2586
  }
2549
- const fe = () => {
2587
+ const ke = () => {
2550
2588
  };
2551
- function ve(s, e) {
2589
+ function Se(s, e) {
2552
2590
  if (!e) return;
2553
- const t = typeof e == "function" ? { schema: e } : e, i = Object.keys(t.steps ?? {}), r = i.map((o) => t.steps?.[o]).filter((o) => o != null), n = t.schema ?? Q(
2554
- () => Z(...r, ...t.extras ? [t.extras] : [])
2591
+ const t = typeof e == "function" ? { schema: e } : e, i = Object.keys(t.steps ?? {}), r = i.map((o) => t.steps?.[o]).filter((o) => o != null), n = t.schema ?? ue(
2592
+ () => ce(...r, ...t.extras ? [t.extras] : [])
2555
2593
  ), a = (o) => {
2556
2594
  const f = typeof o == "number" ? i[o - 1] : o;
2557
2595
  return (f != null ? t.steps?.[f] : null) ?? null;
2558
- }, { strategy: u, debounce: d, liveAfterSubmit: l } = t, c = P(s, n, {
2596
+ }, { strategy: u, debounce: d, liveAfterSubmit: l } = t, c = I(s, n, {
2559
2597
  strategy: u,
2560
2598
  debounce: d,
2561
2599
  liveAfterSubmit: l
@@ -2565,62 +2603,101 @@ function ve(s, e) {
2565
2603
  stepSelectors: i,
2566
2604
  validate: () => c.validate(),
2567
2605
  validateAll: () => c.validate(),
2568
- validateStep: (o) => X(s, a(o) ?? fe, { touch: !0 }),
2606
+ validateStep: (o) => de(s, a(o) ?? ke, { touch: !0 }),
2569
2607
  createStepController: (o) => {
2570
2608
  if (!u || u === "submit") return null;
2571
2609
  const f = a(o);
2572
- return f ? P(s, f, { strategy: u, debounce: d, liveAfterSubmit: l }) : null;
2610
+ return f ? I(s, f, { strategy: u, debounce: d, liveAfterSubmit: l }) : null;
2573
2611
  },
2574
2612
  controller: c,
2575
2613
  validating: c.validating
2576
2614
  };
2577
2615
  }
2578
- function Oe(s) {
2579
- if (!s.model && s.initial === void 0)
2580
- throw new Error("createCoreForm: provide either `initial` (to create a model) or `model`.");
2581
- const e = s.model ?? K(s.initial);
2582
- s.seed?.(e);
2583
- const t = he({
2584
- model: e,
2585
- ...s.schema ? { schema: s.schema(e) } : {},
2586
- ...s.behavior ? { behavior: s.behavior } : {}
2587
- }), i = ve(e, s.validation), r = { model: e, form: t, ...i ? { validation: i } : {} };
2588
- return s.setup?.(r), r;
2616
+ const C = "[@reformer/core] createForm";
2617
+ function Fe(s, e) {
2618
+ const { schema: t, registry: i } = s;
2619
+ if (t == null) return {};
2620
+ if (typeof t == "function")
2621
+ return { tree: t(e) };
2622
+ if (i == null)
2623
+ throw new Error(
2624
+ `${C}: \`schema\` — готовое дерево, а не билдер \`(model) => узел\`. Передайте билдер; документу схемы (JSON) нужен \`registry\`. Форму из модели и готового дерева без сборки собирает \`createFormFromModel({ model, schema })\`.`
2625
+ );
2626
+ if (typeof i.resolveSchema != "function")
2627
+ throw new Error(
2628
+ `${C}: \`registry\` не умеет собирать дерево из документа схемы — у него нет метода \`resolveSchema\`. Возьмите реестр \`@reformer/renderer-json\` (\`createComponentRegistry\`).`
2629
+ );
2630
+ return i.resolveSchema(t, e);
2631
+ }
2632
+ function Ne(s) {
2633
+ if (typeof s?.model?.signalAt != "function" && s?.initial === void 0)
2634
+ throw new Error(
2635
+ `${C}: нужна модель — \`model\` либо \`initial\`. Форму без модели — из плоской схемы полей (\`{ email: { value: '', component } }\`) или конфига группы — собирает \`createLegacyForm(...)\`.`
2636
+ );
2637
+ const t = s.model ?? te(s.initial);
2638
+ s.seed?.(t);
2639
+ const { tree: i, fieldWrapper: r, errorBoundary: n } = Fe(s, t), a = oe(), u = a.scopeOf(t), d = ee({
2640
+ model: t,
2641
+ ...i !== void 0 ? { schema: i } : {},
2642
+ ...s.behavior ? { behavior: s.behavior, schemaController: a } : {}
2643
+ });
2644
+ if (process.env.NODE_ENV !== "production") {
2645
+ const o = le(u.__overrideMaps, i);
2646
+ o.length > 0 && console.warn(
2647
+ `${C}: поведение обращается к узлам схемы, которых нет в корневом дереве: ${o.map((f) => `"${f}"`).join(", ")}. Правило ничего не сделает. Узлы строки массива и подформы адресуются из их поведения — через \`applyEach\` / \`apply\`.`
2648
+ );
2649
+ }
2650
+ const l = Se(t, s.validation), c = {
2651
+ model: t,
2652
+ form: d,
2653
+ ...l ? { validation: l } : {},
2654
+ render: {
2655
+ tree: i,
2656
+ controller: a,
2657
+ node: (o) => u.node(o),
2658
+ ...r !== void 0 ? { fieldWrapper: r } : {},
2659
+ ...n !== void 0 ? { errorBoundary: n } : {}
2660
+ }
2661
+ };
2662
+ return s.setup?.(c), c;
2663
+ }
2664
+ function Ye(s) {
2665
+ return Ne(s);
2589
2666
  }
2590
- function M(s) {
2667
+ function O(s) {
2591
2668
  return s == null ? !1 : typeof s == "object" && "value" in s && "setValue" in s && "getValue" in s && "validate" in s;
2592
2669
  }
2593
- function me(s) {
2594
- return M(s) && "validators" in s && "asyncValidators" in s && // FieldNode имеет markAsTouched метод
2670
+ function Me(s) {
2671
+ return O(s) && "validators" in s && "asyncValidators" in s && // FieldNode имеет markAsTouched метод
2595
2672
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2596
2673
  typeof s.markAsTouched == "function" && // У FieldNode нет fields или items
2597
2674
  !("fields" in s) && !("items" in s);
2598
2675
  }
2599
- function pe(s) {
2600
- return M(s) && "getFieldByPath" in s && "fields" in s && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode/ModelArrayNode)
2676
+ function Ce(s) {
2677
+ return O(s) && "getFieldByPath" in s && "fields" in s && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode/ModelArrayNode)
2601
2678
  !("items" in s) && !("push" in s) && !("removeAt" in s);
2602
2679
  }
2603
- function ye(s) {
2604
- return M(s) && "items" in s && "length" in s && "push" in s && "removeAt" in s && "at" in s && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2680
+ function Pe(s) {
2681
+ return O(s) && "items" in s && "length" in s && "push" in s && "removeAt" in s && "at" in s && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2605
2682
  typeof s.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2606
2683
  typeof s.removeAt == "function";
2607
2684
  }
2608
- function Te(s) {
2609
- return me(s) ? "FieldNode" : pe(s) ? "GroupNode" : ye(s) ? "ArrayNode" : M(s) ? "FormNode" : "Unknown";
2685
+ function Qe(s) {
2686
+ return Me(s) ? "FieldNode" : Ce(s) ? "GroupNode" : Pe(s) ? "ArrayNode" : O(s) ? "FormNode" : "Unknown";
2610
2687
  }
2611
- function ge(s, e) {
2688
+ function xe(s, e) {
2612
2689
  if (s === e) return !0;
2613
2690
  if (s.length !== e.length) return !1;
2614
2691
  for (let t = 0; t < s.length; t++)
2615
2692
  if (s[t] !== e[t]) return !1;
2616
2693
  return !0;
2617
2694
  }
2618
- function T(s, e, t, i) {
2619
- const r = _(null), n = _(s);
2695
+ function B(s, e, t, i) {
2696
+ const r = E(null), n = E(s);
2620
2697
  n.current = s;
2621
- const a = _(e);
2698
+ const a = E(e);
2622
2699
  a.current = e;
2623
- const u = _(t);
2700
+ const u = E(t);
2624
2701
  if (u.current = t, r.current === null) {
2625
2702
  const c = {};
2626
2703
  for (const o in s)
@@ -2631,9 +2708,9 @@ function T(s, e, t, i) {
2631
2708
  (c) => {
2632
2709
  let o = !0;
2633
2710
  return g(() => {
2634
- const p = n.current;
2635
- for (const v in p)
2636
- p[v].value;
2711
+ const v = n.current;
2712
+ for (const p in v)
2713
+ v[p].value;
2637
2714
  if (o) {
2638
2715
  o = !1;
2639
2716
  return;
@@ -2649,30 +2726,30 @@ function T(s, e, t, i) {
2649
2726
  [i]
2650
2727
  ), l = y(() => {
2651
2728
  const c = r.current, o = n.current, f = {};
2652
- for (const v in o)
2653
- f[v] = o[v].value;
2654
- let p = !1;
2655
- for (const v of a.current) {
2656
- const { key: b, useShallowArrayEqual: S } = v, D = f[b], I = c[b];
2657
- if (S) {
2658
- if (!ge(I, D)) {
2659
- p = !0;
2729
+ for (const p in o)
2730
+ f[p] = o[p].value;
2731
+ let v = !1;
2732
+ for (const p of a.current) {
2733
+ const { key: F, useShallowArrayEqual: T } = p, A = f[F], V = c[F];
2734
+ if (T) {
2735
+ if (!xe(V, A)) {
2736
+ v = !0;
2660
2737
  break;
2661
2738
  }
2662
- } else if (I !== D) {
2663
- p = !0;
2739
+ } else if (V !== A) {
2740
+ v = !0;
2664
2741
  break;
2665
2742
  }
2666
2743
  }
2667
- if (!p && c.__snapshot)
2744
+ if (!v && c.__snapshot)
2668
2745
  return c.__snapshot;
2669
- for (const v in o)
2670
- c[v] = f[v];
2746
+ for (const p in o)
2747
+ c[p] = f[p];
2671
2748
  return c.__snapshot = u.current(f), c.__snapshot;
2672
2749
  }, [i]);
2673
- return F.useSyncExternalStore(d, l, l);
2750
+ return P.useSyncExternalStore(d, l, l);
2674
2751
  }
2675
- function be(s) {
2752
+ function Oe(s) {
2676
2753
  const e = {
2677
2754
  value: s.value,
2678
2755
  disabled: s.disabled,
@@ -2710,9 +2787,9 @@ function be(s) {
2710
2787
  }),
2711
2788
  []
2712
2789
  );
2713
- return T(e, t, i, s);
2790
+ return B(e, t, i, s);
2714
2791
  }
2715
- function Ee(s) {
2792
+ function Te(s) {
2716
2793
  const e = {
2717
2794
  value: s.value,
2718
2795
  length: s.length,
@@ -2747,9 +2824,9 @@ function Ee(s) {
2747
2824
  }),
2748
2825
  []
2749
2826
  );
2750
- return T(e, t, i, s);
2827
+ return B(e, t, i, s);
2751
2828
  }
2752
- function _e() {
2829
+ function De() {
2753
2830
  const s = y(
2754
2831
  () => ({
2755
2832
  value: [],
@@ -2764,14 +2841,14 @@ function _e() {
2764
2841
  }),
2765
2842
  []
2766
2843
  );
2767
- return T({}, [], s);
2844
+ return B({}, [], s);
2768
2845
  }
2769
- function De(s) {
2846
+ function Xe(s) {
2770
2847
  const e = s && "length" in s && "map" in s;
2771
- return s ? e ? Ee(s) : be(s) : _e();
2848
+ return s ? e ? Te(s) : Oe(s) : De();
2772
2849
  }
2773
- function Ie(s) {
2774
- const e = _({ value: s.value.value }), t = y(
2850
+ function Ze(s) {
2851
+ const e = E({ value: s.value.value }), t = y(
2775
2852
  (r) => {
2776
2853
  let n = !0;
2777
2854
  return g(() => {
@@ -2787,10 +2864,10 @@ function Ie(s) {
2787
2864
  const r = s.value.value;
2788
2865
  return e.current.value === r ? e.current.value : (e.current.value = r, r);
2789
2866
  }, [s]);
2790
- return F.useSyncExternalStore(t, i, i);
2867
+ return P.useSyncExternalStore(t, i, i);
2791
2868
  }
2792
- function Re(s) {
2793
- const e = _({ length: s.length.value }), t = y(
2869
+ function et(s) {
2870
+ const e = E({ length: s.length.value }), t = y(
2794
2871
  (r) => {
2795
2872
  let n = !0;
2796
2873
  return g(() => {
@@ -2806,15 +2883,15 @@ function Re(s) {
2806
2883
  const r = s.length.value;
2807
2884
  return e.current.length === r ? e.current.length : (e.current.length = r, r);
2808
2885
  }, [s]);
2809
- return F.useSyncExternalStore(t, i, i);
2886
+ return P.useSyncExternalStore(t, i, i);
2810
2887
  }
2811
- function $e(s) {
2812
- const { model: e, schema: t, strategy: i, debounce: r, liveAfterSubmit: n } = s, a = ee(
2813
- () => P(e, t, { strategy: i, debounce: r, liveAfterSubmit: n }),
2888
+ function tt(s) {
2889
+ const { model: e, schema: t, strategy: i, debounce: r, liveAfterSubmit: n } = s, a = he(
2890
+ () => I(e, t, { strategy: i, debounce: r, liveAfterSubmit: n }),
2814
2891
  [e, t, i, r, n]
2815
2892
  );
2816
- U(() => a.start(), [a]);
2817
- const u = F.useSyncExternalStore(
2893
+ Q(() => a.start(), [a]);
2894
+ const u = P.useSyncExternalStore(
2818
2895
  y((l) => a.validating.subscribe(l), [a]),
2819
2896
  () => a.validating.peek(),
2820
2897
  () => !1
@@ -2822,31 +2899,35 @@ function $e(s) {
2822
2899
  ), d = y(() => a.validate(), [a]);
2823
2900
  return { submit: d, validate: d, isValidating: u };
2824
2901
  }
2825
- function Be(s) {
2826
- const [e] = te(s), t = e.validation?.controller;
2827
- return U(() => t?.start(), [t]), e;
2902
+ function st(s) {
2903
+ const [e] = fe(s), t = e.validation?.controller;
2904
+ return Q(() => t?.start(), [t]), e;
2828
2905
  }
2829
- const Ae = ["labelTooltip"];
2830
- function Ge(s) {
2906
+ const Ie = ve(null);
2907
+ function rt() {
2908
+ return me(Ie);
2909
+ }
2910
+ const $e = ["labelTooltip"];
2911
+ function it(s) {
2831
2912
  if (!(s == null || typeof s != "function" && typeof s != "object"))
2832
2913
  return s.reformerAdapter;
2833
2914
  }
2834
- const W = (s) => s;
2835
- function je(s, e, t = {}) {
2915
+ const J = (s) => s;
2916
+ function nt(s, e, t = {}) {
2836
2917
  const i = { ...t };
2837
- for (const n of Ae) delete i[n];
2918
+ for (const n of $e) delete i[n];
2838
2919
  for (const n of s?.strip ?? []) delete i[n];
2839
2920
  if (!s)
2840
2921
  return { ...i, value: e.value, onChange: e.onChange, onBlur: e.onBlur };
2841
- const r = s.fromEmit ?? W;
2922
+ const r = s.fromEmit ?? J;
2842
2923
  return {
2843
2924
  ...i,
2844
- [s.valueProp ?? "value"]: (s.toValue ?? W)(e.value),
2925
+ [s.valueProp ?? "value"]: (s.toValue ?? J)(e.value),
2845
2926
  [s.changeProp ?? "onChange"]: (n) => e.onChange(r(n, i)),
2846
2927
  ...s.bindBlur ? s.bindBlur(e.onBlur) : { onBlur: e.onBlur }
2847
2928
  };
2848
2929
  }
2849
- function we(s) {
2930
+ function Re(s) {
2850
2931
  return {
2851
2932
  focus: () => s.current?.focus(),
2852
2933
  blur: () => s.current?.blur(),
@@ -2854,69 +2935,79 @@ function we(s) {
2854
2935
  getElement: () => s.current
2855
2936
  };
2856
2937
  }
2857
- function ke(s) {
2938
+ function Be(s) {
2858
2939
  return typeof s == "object" && s !== null && s.nodeType === 1;
2859
2940
  }
2860
- function We(s) {
2861
- const e = _(null);
2862
- return se(s, () => Ve(e)), e;
2941
+ function at(s) {
2942
+ const e = E(null);
2943
+ return pe(s, () => Ge(e)), e;
2863
2944
  }
2864
- function Ve(s) {
2945
+ function Ge(s) {
2865
2946
  const e = s.current;
2866
- return e == null || ke(e) ? we(s) : e;
2947
+ return e == null || Be(e) ? Re(s) : e;
2867
2948
  }
2868
- const Le = Object.freeze({ runtime: "reformer-core", v: 1 });
2949
+ const ot = Object.freeze({ runtime: "reformer-core", v: 1 });
2869
2950
  export {
2870
- j as ArrayNode,
2871
- Le as CORE_RUNTIME_TOKEN,
2872
- E as ErrorStrategy,
2873
- Ae as FIELD_WRAPPER_ONLY_PROPS,
2874
- ne as FieldNode,
2951
+ q as ArrayNode,
2952
+ ot as CORE_RUNTIME_TOKEN,
2953
+ b as ErrorStrategy,
2954
+ $e as FIELD_WRAPPER_ONLY_PROPS,
2955
+ be as FieldNode,
2956
+ Ie as FormBundleContext,
2875
2957
  w as FormErrorHandler,
2876
- N as FormNode,
2877
- oe as FormSubmitter,
2878
- A as GroupNode,
2879
- de as ModelArrayNode,
2880
- ue as NodeFactory,
2881
- x as SubscriptionManager,
2882
- je as bindFieldProps,
2883
- ve as buildValidation,
2884
- Ze as computeFrom,
2885
- et as copyFrom,
2886
- Oe as createCoreForm,
2887
- he as createForm,
2888
- H as createFormFromModel,
2889
- K as createModel,
2890
- ht as disableWhen,
2891
- He as eachLeafSignal,
2892
- Ke as eachValueSignal,
2893
- ft as enableWhen,
2894
- Ge as getFieldAdapter,
2895
- dt as getNodeForSignal,
2896
- Te as getNodeType,
2897
- ye as isArrayNode,
2898
- R as isDerived,
2899
- me as isFieldNode,
2900
- M as isFormNode,
2901
- pe as isGroupNode,
2902
- Ye as isModelContainerSignal,
2903
- $ as isValueSignal,
2904
- we as makeElementFieldHandle,
2905
- Je as markDerived,
2906
- J as registerSignalNode,
2907
- tt as resetWhen,
2908
- st as revalidateWhen,
2909
- it as runOutsideEffect,
2910
- rt as safeCallback,
2911
- nt as safeDebouncedCallback,
2912
- at as syncFields,
2913
- ot as transformValue,
2914
- Qe as unmarkDerived,
2915
- Re as useArrayLength,
2916
- We as useFieldHandleRef,
2917
- Be as useFormBundle,
2918
- De as useFormControl,
2919
- Ie as useFormControlValue,
2920
- $e as useFormValidation,
2921
- lt as watchField
2958
+ x as FormNode,
2959
+ _e as FormSubmitter,
2960
+ _ as GroupNode,
2961
+ Ve as ModelArrayNode,
2962
+ Ae as NodeFactory,
2963
+ $ as SubscriptionManager,
2964
+ ft as arrayOf,
2965
+ nt as bindFieldProps,
2966
+ Se as buildValidation,
2967
+ yt as computeFrom,
2968
+ gt as copyFrom,
2969
+ Ye as createCoreForm,
2970
+ Ne as createForm,
2971
+ ee as createFormFromModel,
2972
+ Je as createLegacyForm,
2973
+ te as createModel,
2974
+ oe as createSchemaController,
2975
+ Ct as createSchemaOverrideMaps,
2976
+ Pt as createSchemaScope,
2977
+ xt as disableWhen,
2978
+ dt as eachLeafSignal,
2979
+ ct as eachValueSignal,
2980
+ Ot as enableWhen,
2981
+ it as getFieldAdapter,
2982
+ Nt as getNodeForSignal,
2983
+ Qe as getNodeType,
2984
+ Pe as isArrayNode,
2985
+ G as isDerived,
2986
+ Me as isFieldNode,
2987
+ O as isFormNode,
2988
+ Ce as isGroupNode,
2989
+ j as isModelContainerSignal,
2990
+ D as isValueSignal,
2991
+ Re as makeElementFieldHandle,
2992
+ vt as markDerived,
2993
+ Y as modelOf,
2994
+ N as registerSignalNode,
2995
+ bt as resetWhen,
2996
+ Et as revalidateWhen,
2997
+ _t as runOutsideEffect,
2998
+ wt as safeCallback,
2999
+ At as safeDebouncedCallback,
3000
+ X as schemaSubtree,
3001
+ Vt as syncFields,
3002
+ kt as transformValue,
3003
+ le as unknownSchemaSelectors,
3004
+ mt as unmarkDerived,
3005
+ et as useArrayLength,
3006
+ at as useFieldHandleRef,
3007
+ st as useFormBundle,
3008
+ rt as useFormBundleContext,
3009
+ Xe as useFormControl,
3010
+ Ze as useFormControlValue,
3011
+ tt as useFormValidation,
3012
+ St as watchField
2922
3013
  };