@reformer/core 10.2.0 → 11.0.0-beta.2

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 (63) hide show
  1. package/dist/behaviors.js +134 -134
  2. package/dist/form/form-submitter.d.ts +0 -4
  3. package/dist/form/hooks/types.d.ts +3 -3
  4. package/dist/form/index.d.ts +0 -3
  5. package/dist/form/nodes/array-node.d.ts +0 -84
  6. package/dist/form/nodes/form-node.d.ts +0 -14
  7. package/dist/form/nodes/group-node.d.ts +0 -4
  8. package/dist/form/status-machine.d.ts +0 -38
  9. package/dist/form/types/contracts.d.ts +0 -6
  10. package/dist/form/types/deep-schema.d.ts +0 -9
  11. package/dist/form/types/index.d.ts +4 -38
  12. package/dist/form/types/schema-node.d.ts +13 -16
  13. package/dist/form/types/validation-schema.d.ts +0 -25
  14. package/dist/form/unique-id.d.ts +3 -11
  15. package/dist/form/validators.d.ts +8 -3
  16. package/dist/form-model-DhW2HZOB.js +323 -0
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +448 -636
  19. package/dist/runtime-token.d.ts +23 -0
  20. package/dist/state/form-model.d.ts +14 -0
  21. package/dist/state/index.d.ts +2 -1
  22. package/dist/state/types.d.ts +39 -11
  23. package/dist/state.js +18 -18
  24. package/dist/validation.js +1 -1
  25. package/dist/validators.d.ts +0 -4
  26. package/dist/validators.js +88 -122
  27. package/docs/llms/01-api-reference.md +63 -0
  28. package/docs/llms/02-quick-start.md +143 -0
  29. package/docs/llms/03-api-signatures.md +273 -0
  30. package/docs/llms/04-common-patterns.md +202 -0
  31. package/docs/llms/05-common-mistakes.md +167 -0
  32. package/docs/llms/06-troubleshooting.md +11 -0
  33. package/docs/llms/07-complete-import.md +99 -0
  34. package/docs/llms/08-form-types.md +47 -0
  35. package/docs/llms/09-formschema.md +143 -0
  36. package/docs/llms/10-arrays.md +161 -0
  37. package/docs/llms/11-async-watchfield.md +53 -0
  38. package/docs/llms/12-array-cleanup.md +31 -0
  39. package/docs/llms/13-multi-step.md +91 -0
  40. package/docs/llms/14-extended-mistakes.md +98 -0
  41. package/docs/llms/15-project-structure.md +125 -0
  42. package/docs/llms/16-ui-components.md +189 -0
  43. package/docs/llms/17-nonexistent-api.md +93 -0
  44. package/docs/llms/18-conditional-fields.md +183 -0
  45. package/docs/llms/19-reading-values.md +88 -0
  46. package/docs/llms/20-compute-vs-watch.md +147 -0
  47. package/docs/llms/21-array-operations.md +113 -0
  48. package/docs/llms/22-cycle-detection.md +86 -0
  49. package/docs/llms/23-copy-from.md +141 -0
  50. package/docs/llms/24-sync-fields.md +114 -0
  51. package/docs/llms/25-reset-when.md +115 -0
  52. package/docs/llms/26-transform-value.md +136 -0
  53. package/docs/llms/27-revalidate-when.md +132 -0
  54. package/docs/llms/28-submit-and-reset.md +259 -0
  55. package/docs/llms/29-async-preload.md +193 -0
  56. package/docs/llms/30-type-safety-recipes.md +159 -0
  57. package/docs/llms/31-async-validator-debounce.md +135 -0
  58. package/docs/llms/32-async-options-loading.md +108 -0
  59. package/docs/llms/33-validation-strategy.md +193 -0
  60. package/llms.txt +219 -1533
  61. package/package.json +33 -10
  62. package/dist/derived-registry-CluZCQ7U.js +0 -16
  63. package/dist/form-model-DYCzGGKF.js +0 -286
package/dist/behaviors.js CHANGED
@@ -1,7 +1,7 @@
1
- import { effect as O } from "@preact/signals-core";
2
- import { d as $, a as S, w as F, t as A, r as C, s as D, b as M } from "./behaviors-value-C7dSEhCc.js";
3
- import { m as k, u as x } from "./derived-registry-CluZCQ7U.js";
4
- import { e as G } from "./behaviors-node-DGEFMTQu.js";
1
+ import { effect as j } from "@preact/signals-core";
2
+ import { m as $, u as k, i as C } from "./form-model-DhW2HZOB.js";
3
+ import { d as x, a as M, w as F, t as O, r as A, s as D, b as G } from "./behaviors-value-C7dSEhCc.js";
4
+ import { e as T } from "./behaviors-node-DGEFMTQu.js";
5
5
  let p = null;
6
6
  function P(e) {
7
7
  if (!p)
@@ -17,13 +17,13 @@ function y() {
17
17
  const e = P("getScope");
18
18
  return { model: e.model, form: e.form };
19
19
  }
20
- function T(e) {
20
+ function I(e) {
21
21
  return {
22
- __run(n, t) {
23
- const o = { cleanups: [], model: n, form: t }, r = p;
22
+ __run(t, n) {
23
+ const o = { cleanups: [], model: t, form: n }, r = p;
24
24
  p = o;
25
25
  try {
26
- e({ model: n, form: t });
26
+ e({ model: t, form: n });
27
27
  } finally {
28
28
  p = r;
29
29
  }
@@ -34,111 +34,111 @@ function T(e) {
34
34
  };
35
35
  }
36
36
  function h(e) {
37
- s(O(e));
37
+ s(j(e));
38
38
  }
39
- function _(e) {
40
- $(e);
39
+ function g(e) {
40
+ x(e);
41
41
  }
42
- const m = (e) => typeof e == "object" && e !== null && typeof e.peek == "function", B = (e) => Array.isArray(e) ? e : [e];
42
+ const m = (e) => typeof e == "object" && e !== null && typeof e.peek == "function" && !C(e), B = (e) => Array.isArray(e) ? e : [e];
43
43
  function E(e) {
44
- const n = {};
45
- for (const t of Object.keys(e)) {
46
- const o = e[t];
47
- n[t] = m(o) ? o.value : E(o);
44
+ const t = {};
45
+ for (const n of Object.keys(e)) {
46
+ const o = e[n];
47
+ t[n] = m(o) ? o.value : E(o);
48
48
  }
49
- return n;
49
+ return t;
50
50
  }
51
- function W(e, n) {
52
- for (const t of Object.keys(e)) {
53
- const o = e[t];
54
- m(o) ? o.value = n?.[t] : W(o, n?.[t] ?? {});
51
+ function W(e, t) {
52
+ for (const n of Object.keys(e)) {
53
+ const o = e[n];
54
+ m(o) ? o.value = t?.[n] : W(o, t?.[n] ?? {});
55
55
  }
56
56
  }
57
- function I(e) {
57
+ function R(e) {
58
58
  if (!e) return;
59
- const { form: n } = y();
60
- return n.getFieldByPath(e);
59
+ const { form: t } = y();
60
+ return t.getFieldByPath(e);
61
61
  }
62
- function V(e) {
62
+ function S(e) {
63
63
  return new Proxy(
64
64
  {},
65
65
  {
66
- get: (n, t) => {
67
- if (t === "$") return e;
68
- if (typeof t != "string") return;
69
- const o = e[t];
66
+ get: (t, n) => {
67
+ if (n === "$") return e;
68
+ if (typeof n != "string") return;
69
+ const o = e[n];
70
70
  if (o != null)
71
- return m(o) ? o.value : V(o);
71
+ return m(o) ? o.value : S(o);
72
72
  }
73
73
  }
74
74
  );
75
75
  }
76
- function j(e) {
77
- return (n) => {
76
+ function V(e) {
77
+ return (t) => {
78
78
  try {
79
- n();
80
- } catch (t) {
81
- if (t instanceof Error && /cycle detected/i.test(t.message)) {
79
+ t();
80
+ } catch (n) {
81
+ if (n instanceof Error && /cycle detected/i.test(n.message)) {
82
82
  const o = e.__path ?? "?";
83
83
  throw new Error(
84
84
  `[@reformer/core/behaviors] compute("${o}"): расходящийся цикл пересчёта — взаимные compute/computeFrom без стабилизации. Проверьте зависимости или добавьте стабилизирующее условие (when) / разорвите цикл через peek.`
85
85
  );
86
86
  }
87
- throw t;
87
+ throw n;
88
88
  }
89
89
  };
90
90
  }
91
- function U(e, n, t) {
92
- k(e), s(() => x(e));
93
- const o = j(e);
91
+ function X(e, t, n) {
92
+ $(e), s(() => k(e));
93
+ const o = V(e);
94
94
  h(() => {
95
- if (t?.when && !t.when()) return;
96
- const r = n();
95
+ if (n?.when && !n.when()) return;
96
+ const r = t();
97
97
  e.peek() !== r && o(() => {
98
98
  e.value = r;
99
99
  });
100
100
  });
101
101
  }
102
- function X(e, n, t, o) {
103
- k(n), s(() => x(n));
104
- const r = j(n);
102
+ function Y(e, t, n, o) {
103
+ $(t), s(() => k(t));
104
+ const r = V(t);
105
105
  h(() => {
106
106
  const c = e.map((f) => f.value);
107
107
  if (o?.when && !o.when(...c)) return;
108
- const i = t(...c);
109
- n.peek() !== i && r(() => {
110
- n.value = i;
108
+ const i = n(...c);
109
+ t.peek() !== i && r(() => {
110
+ t.value = i;
111
111
  });
112
112
  });
113
113
  }
114
- function Y(e, n, t) {
115
- if (m(e) && m(n)) {
116
- s(S(e, n, t));
114
+ function Z(e, t, n) {
115
+ if (m(e) && m(t)) {
116
+ s(M(e, t, n));
117
117
  return;
118
118
  }
119
- const o = e, r = n;
119
+ const o = e, r = t;
120
120
  h(() => {
121
121
  const c = E(o);
122
- t?.when && !t.when() || _(() => W(r, c));
122
+ n?.when && !n.when() || g(() => W(r, c));
123
123
  });
124
124
  }
125
- function R(e, n, t) {
125
+ function q(e, t, n) {
126
126
  let o;
127
127
  const r = (c) => {
128
128
  o?.abort(), o = new AbortController();
129
129
  const { signal: i } = o;
130
- $(() => n(c, { signal: i }));
130
+ x(() => t(c, { signal: i }));
131
131
  };
132
- if (!t?.debounce)
133
- s(F(e, r, { immediate: t?.immediate }));
132
+ if (!n?.debounce)
133
+ s(F(e, r, { immediate: n?.immediate }));
134
134
  else {
135
135
  let c;
136
136
  const i = F(
137
137
  e,
138
138
  (f) => {
139
- c && clearTimeout(c), c = setTimeout(() => r(f), t.debounce);
139
+ c && clearTimeout(c), c = setTimeout(() => r(f), n.debounce);
140
140
  },
141
- { immediate: t?.immediate }
141
+ { immediate: n?.immediate }
142
142
  );
143
143
  s(() => {
144
144
  c && clearTimeout(c), i();
@@ -146,99 +146,99 @@ function R(e, n, t) {
146
146
  }
147
147
  s(() => o?.abort());
148
148
  }
149
- function q(e, n, t) {
149
+ function z(e, t, n) {
150
150
  for (const o of B(e))
151
- m(o) ? s(G(o, n, t)) : z(o, n, t);
151
+ m(o) ? s(T(o, t, n)) : L(o, t, n);
152
152
  }
153
- function Z(e, n, t) {
154
- q(e, () => !n(), t);
153
+ function ee(e, t, n) {
154
+ z(e, () => !t(), n);
155
155
  }
156
- function z(e, n, t) {
157
- const o = I(e.__path);
156
+ function L(e, t, n) {
157
+ const o = R(e.__path);
158
158
  o && h(() => {
159
- const r = n();
160
- _(() => {
161
- r ? o.enable() : (o.disable(), t?.resetOnDisable && o.reset());
159
+ const r = t();
160
+ g(() => {
161
+ r ? o.enable() : (o.disable(), n?.resetOnDisable && o.reset());
162
162
  });
163
163
  });
164
164
  }
165
- function ee(e, n) {
166
- s(A(e, n));
165
+ function ne(e, t) {
166
+ s(O(e, t));
167
167
  }
168
- function te(e, n, t) {
169
- s(C(e, n, t));
168
+ function te(e, t, n) {
169
+ s(A(e, t, n));
170
170
  }
171
- function ne(e, n, t) {
172
- s(D(e, n, t));
171
+ function oe(e, t, n) {
172
+ s(D(e, t, n));
173
173
  }
174
- function oe(e, n) {
175
- s(M(e, n));
174
+ function re(e, t) {
175
+ s(G(e, t));
176
176
  }
177
- function g(e, n) {
178
- return n.split(".").reduce((t, o) => t?.[o], e);
177
+ function _(e, t) {
178
+ return t.split(".").reduce((n, o) => n?.[o], e);
179
179
  }
180
180
  function N(e) {
181
181
  return new Proxy(
182
182
  {},
183
183
  {
184
- get(n, t) {
185
- if (!(typeof t == "symbol" || t === "then"))
184
+ get(t, n) {
185
+ if (!(typeof n == "symbol" || n === "then"))
186
186
  throw new Error(
187
187
  `[@reformer/core/behaviors] applyEach: форма строки массива "${e}" недоступна (form.${String(
188
- t
188
+ n
189
189
  )}) — массив не материализован в схеме формы. Per-row node-операции (enableWhen/updateComponentProps/reset) требуют узла { array, item } в схеме; value-операции (row.$.*: compute/copyFrom/transformValue) работают и без материализации.`
190
190
  );
191
191
  }
192
192
  }
193
193
  );
194
194
  }
195
- function H(e, n) {
196
- const { model: t, form: o } = y(), r = e.__path;
195
+ function H(e, t) {
196
+ const { model: n, form: o } = y(), r = e.__path;
197
197
  if (!r) return;
198
- const c = g(t, r);
198
+ const c = _(n, r);
199
199
  if (!c) return;
200
200
  const i = o.getFieldByPath(
201
201
  r
202
- ), f = i?.length, u = /* @__PURE__ */ new Map();
202
+ ), f = i?.length, a = /* @__PURE__ */ new Map();
203
203
  h(() => {
204
204
  const d = f ? f.value : c.length, w = /* @__PURE__ */ new Set();
205
- for (let a = 0; a < d; a++) {
206
- const l = c.at(a);
207
- if (l != null && (w.add(l), !u.has(l))) {
208
- const b = i?.at?.(a) ?? N(r);
209
- u.set(l, n.__run(l, b));
205
+ for (let u = 0; u < d; u++) {
206
+ const l = c.at(u);
207
+ if (l != null && (w.add(l), !a.has(l))) {
208
+ const b = i?.at?.(u) ?? N(r);
209
+ a.set(l, t.__run(l, b));
210
210
  }
211
211
  }
212
- for (const [a, l] of u)
213
- w.has(a) || (l(), u.delete(a));
212
+ for (const [u, l] of a)
213
+ w.has(u) || (l(), a.delete(u));
214
214
  }), s(() => {
215
- for (const d of u.values()) d();
216
- u.clear();
215
+ for (const d of a.values()) d();
216
+ a.clear();
217
217
  });
218
218
  }
219
219
  function v(e) {
220
220
  if (e == null || typeof e != "object") return;
221
- const n = e;
222
- if (typeof n.at == "function" && typeof n.length == "number") {
223
- const t = n.length;
224
- for (let o = 0; o < t; o++) v(n.at(o));
221
+ const t = e;
222
+ if (typeof t.at == "function" && typeof t.length == "number") {
223
+ const n = t.length;
224
+ for (let o = 0; o < n; o++) v(t.at(o));
225
225
  return;
226
226
  }
227
- for (const t of Object.keys(e)) v(e[t]);
227
+ for (const n of Object.keys(e)) v(e[n]);
228
228
  }
229
- function re(e, n) {
230
- const { model: t } = y(), o = e.__path;
229
+ function ce(e, t) {
230
+ const { model: n } = y(), o = e.__path;
231
231
  if (!o) return;
232
- const r = g(t, o);
232
+ const r = _(n, o);
233
233
  r && H(
234
234
  e,
235
- T(({ model: c }) => {
236
- R(n(c), (i) => {
235
+ I(({ model: c }) => {
236
+ q(t(c), (i) => {
237
237
  if (i)
238
238
  for (let f = 0; f < r.length; f++) {
239
- const u = r.at(f);
240
- if (u && u !== c) {
241
- const d = n(u);
239
+ const a = r.at(f);
240
+ if (a && a !== c) {
241
+ const d = t(a);
242
242
  d.peek() && (d.value = !1);
243
243
  }
244
244
  }
@@ -246,57 +246,57 @@ function re(e, n) {
246
246
  })
247
247
  );
248
248
  }
249
- function ce(e, n) {
250
- const { model: t } = y(), o = e.__path;
249
+ function ie(e, t) {
250
+ const { model: n } = y(), o = e.__path;
251
251
  if (!o) return;
252
- const r = g(t, o);
252
+ const r = _(n, o);
253
253
  if (!r) return;
254
254
  let c = !1, i = 0;
255
255
  h(() => {
256
- v(r), !c && (c = !0, _(() => {
256
+ v(r), !c && (c = !0, g(() => {
257
257
  c = !1;
258
- const f = n(r.toArray());
259
- let u = !1;
258
+ const f = t(r.toArray());
259
+ let a = !1;
260
260
  for (const { index: d, patch: w } of f) {
261
- const a = r.at(d);
262
- if (a)
261
+ const u = r.at(d);
262
+ if (u)
263
263
  for (const [l, b] of Object.entries(w))
264
- a[l] !== b && (a[l] = b, u = !0);
264
+ u[l] !== b && (u[l] = b, a = !0);
265
265
  }
266
- if (i = u ? i + 1 : 0, i > 50)
266
+ if (i = a ? i + 1 : 0, i > 50)
267
267
  throw i = 0, new Error(
268
268
  `[@reformer/core/behaviors] aggregateInto("${o}"): запись не сходится (>50 проходов) — derive должна быть идемпотентной на фикспоинте.`
269
269
  );
270
270
  }));
271
271
  });
272
272
  }
273
- function ie(e, n) {
274
- const { form: t } = y();
273
+ function fe(e, t) {
274
+ const { form: n } = y();
275
275
  for (const o of B(e)) {
276
276
  const r = o, c = r.__path;
277
277
  if (!c) continue;
278
- const i = t ? t.getFieldByPath(c) : void 0, f = i ? i.getProxy?.() ?? i : void 0;
279
- s(n.__run(V(r), f));
278
+ const i = n ? n.getFieldByPath(c) : void 0, f = i ? i.getProxy?.() ?? i : void 0;
279
+ s(t.__run(S(r), f));
280
280
  }
281
281
  }
282
282
  export {
283
- ce as aggregateInto,
284
- ie as apply,
283
+ ie as aggregateInto,
284
+ fe as apply,
285
285
  H as applyEach,
286
- U as compute,
287
- X as computeFrom,
288
- Y as copyFrom,
289
- _ as defer,
290
- T as defineFormBehavior,
291
- Z as disableWhen,
286
+ X as compute,
287
+ Y as computeFrom,
288
+ Z as copyFrom,
289
+ g as defer,
290
+ I as defineFormBehavior,
291
+ ee as disableWhen,
292
292
  h as effect,
293
- q as enableWhen,
294
- re as exclusiveFlag,
293
+ z as enableWhen,
294
+ ce as exclusiveFlag,
295
295
  y as getScope,
296
- R as onChange,
296
+ q as onChange,
297
297
  s as onDispose,
298
298
  te as resetWhen,
299
- oe as revalidateWhen,
300
- ne as syncFields,
301
- ee as transformValue
299
+ re as revalidateWhen,
300
+ oe as syncFields,
301
+ ne as transformValue
302
302
  };
@@ -118,8 +118,4 @@ export declare class FormSubmitter<T extends object> {
118
118
  * ```
119
119
  */
120
120
  submitWithResult<R>(onSubmit: (values: T) => Promise<R> | R, options?: SubmitOptions): Promise<SubmitResult<R>>;
121
- /**
122
- * Проверить, идет ли отправка формы
123
- */
124
- isSubmitting(): boolean;
125
121
  }
@@ -166,12 +166,12 @@ export interface FieldControlState<T> {
166
166
  shouldShowError: boolean;
167
167
  /**
168
168
  * Пользовательские props для передачи в UI-компоненты.
169
- * Устанавливаются через {@link FieldNode.setComponentProps}.
169
+ * Устанавливаются через {@link FieldNode.updateComponentProps}.
170
170
  *
171
171
  * @example
172
172
  * ```tsx
173
173
  * // Установка props
174
- * field.setComponentProps({
174
+ * field.updateComponentProps({
175
175
  * placeholder: 'Enter email...',
176
176
  * maxLength: 100,
177
177
  * autoComplete: 'email'
@@ -234,7 +234,7 @@ export interface FieldControlState<T> {
234
234
  * <PhoneItem
235
235
  * key={item.id}
236
236
  * control={item}
237
- * onRemove={() => control.remove(index)}
237
+ * onRemove={() => control.removeAt(index)}
238
238
  * />
239
239
  * ))}
240
240
  *
@@ -24,10 +24,7 @@ export { FormErrorHandler, ErrorStrategy } from './error-handler';
24
24
  export { registerSignalNode, getNodeForSignal } from './signal-node-registry';
25
25
  export { FormSubmitter } from './form-submitter';
26
26
  export type { SubmittableForm, SubmitOptions, SubmitResult } from './form-submitter';
27
- export { FormStatusMachine } from './status-machine';
28
- export type { StatusEvent } from './status-machine';
29
27
  export { isFormNode, isFieldNode, isGroupNode, isArrayNode, getNodeType } from './type-guards';
30
- export { uniqueId } from './unique-id';
31
28
  export { useFormControl } from './hooks/useFormControl';
32
29
  export { useFormControlValue } from './hooks/useFormControlValue';
33
30
  export { useArrayLength } from './hooks/useArrayLength';
@@ -31,8 +31,6 @@ export declare class ArrayNode<T extends object> extends FormNode<T[]> {
31
31
  private disposers;
32
32
  /** Array-level validation errors (e.g., "минимум 1 элемент") */
33
33
  private readonly _arrayErrors;
34
- private validationSchemaFn?;
35
- private behaviorSchemaFn?;
36
34
  readonly value: ReadonlySignal<T[]>;
37
35
  readonly valid: ReadonlySignal<boolean>;
38
36
  readonly invalid: ReadonlySignal<boolean>;
@@ -227,88 +225,6 @@ export declare class ArrayNode<T extends object> extends FormNode<T[]> {
227
225
  * @param schema - Схема для проверки
228
226
  */
229
227
  private isGroupSchema;
230
- /**
231
- * Применить validation schema ко всем элементам массива
232
- *
233
- * Validation schema будет применена к:
234
- * - Всем существующим элементам
235
- * - Всем новым элементам, добавляемым через push/insert
236
- *
237
- * @param schemaFn - Функция валидации для элемента массива
238
- *
239
- * @example
240
- * ```typescript
241
- * import { propertyValidation } from './validation/property-validation';
242
- *
243
- * form.properties.applyValidationSchema(propertyValidation);
244
- * ```
245
- */
246
- applyValidationSchema(schemaFn: unknown): void;
247
- /**
248
- * Применить behavior schema ко всем элементам ArrayNode
249
- *
250
- * Автоматически применяется к новым элементам при push/insert.
251
- *
252
- * @param schemaFn - Behavior schema функция
253
- *
254
- * @example
255
- * ```typescript
256
- * import { addressBehavior } from './behaviors/address-behavior';
257
- *
258
- * form.addresses.applyBehaviorSchema(addressBehavior);
259
- * ```
260
- */
261
- applyBehaviorSchema(schemaFn: unknown): void;
262
- /**
263
- * Подписка на изменения конкретного поля во всех элементах массива
264
- * Срабатывает при изменении значения поля в любом элементе
265
- *
266
- * @param fieldKey - Ключ поля для отслеживания
267
- * @param callback - Функция, вызываемая при изменении, получает массив всех значений и индекс измененного элемента
268
- * @returns Функция отписки для cleanup
269
- *
270
- * @example
271
- * ```typescript
272
- * // Автоматический пересчет общей стоимости при изменении цен
273
- * const dispose = form.existingLoans.watchItems(
274
- * 'remainingAmount',
275
- * (amounts) => {
276
- * const totalDebt = amounts.reduce((sum, amount) => sum + (amount || 0), 0);
277
- * form.totalDebt.setValue(totalDebt);
278
- * }
279
- * );
280
- *
281
- * // При изменении любого remainingAmount → пересчитается totalDebt
282
- * form.existingLoans.at(0)?.remainingAmount.setValue(500000);
283
- *
284
- * // Cleanup
285
- * useEffect(() => dispose, []);
286
- * ```
287
- */
288
- watchItems<K extends keyof T>(fieldKey: K, callback: (values: Array<T[K] | undefined>) => void | Promise<void>): () => void;
289
- /**
290
- * Подписка на изменение длины массива
291
- * Срабатывает при добавлении/удалении элементов
292
- *
293
- * @param callback - Функция, вызываемая при изменении длины, получает новую длину
294
- * @returns Функция отписки для cleanup
295
- *
296
- * @example
297
- * ```typescript
298
- * // Обновление счетчика элементов в UI
299
- * const dispose = form.properties.watchLength((length) => {
300
- * console.log(`Количество объектов недвижимости: ${length}`);
301
- * form.propertyCount.setValue(length);
302
- * });
303
- *
304
- * form.properties.push({ title: 'Квартира', value: 5000000 });
305
- * // Выведет: "Количество объектов недвижимости: 1"
306
- *
307
- * // Cleanup
308
- * useEffect(() => dispose, []);
309
- * ```
310
- */
311
- watchLength(callback: (length: number) => void | Promise<void>): () => void;
312
228
  /**
313
229
  * Очистить все ресурсы узла
314
230
  * Рекурсивно очищает все subscriptions и элементы массива
@@ -7,8 +7,6 @@ import { FieldStatus, ValidationError, ErrorFilterOptions } from '../types/index
7
7
  export interface SetValueOptions {
8
8
  /** Не вызывать событие изменения (не триггерить валидацию) */
9
9
  emitEvent?: boolean;
10
- /** Обновить только этот узел, не распространять на родителей */
11
- onlySelf?: boolean;
12
10
  }
13
11
  /**
14
12
  * Абстрактный базовый класс для всех узлов формы.
@@ -54,19 +52,11 @@ export declare abstract class FormNode<T> {
54
52
  * Computed из _touched для предоставления readonly интерфейса
55
53
  */
56
54
  readonly touched: ReadonlySignal<boolean>;
57
- /**
58
- * Пользователь не взаимодействовал с узлом (untouched)
59
- */
60
- readonly untouched: ReadonlySignal<boolean>;
61
55
  /**
62
56
  * Значение узла было изменено (dirty)
63
57
  * Computed из _dirty для предоставления readonly интерфейса
64
58
  */
65
59
  readonly dirty: ReadonlySignal<boolean>;
66
- /**
67
- * Значение узла не было изменено (pristine)
68
- */
69
- readonly pristine: ReadonlySignal<boolean>;
70
60
  /**
71
61
  * Текущий статус узла
72
62
  * Computed из _status для предоставления readonly интерфейса
@@ -76,10 +66,6 @@ export declare abstract class FormNode<T> {
76
66
  * Узел отключен (disabled)
77
67
  */
78
68
  readonly disabled: ReadonlySignal<boolean>;
79
- /**
80
- * Узел включен (enabled)
81
- */
82
- readonly enabled: ReadonlySignal<boolean>;
83
69
  /**
84
70
  * Текущее значение узла
85
71
  * - Для FieldNode: значение поля
@@ -131,10 +131,6 @@ export declare class GroupNode<T> extends FormNode<T> {
131
131
  * - form.email вместо form.fields.get('email')
132
132
  * - form.address.city вместо form.fields.get('address').fields.get('city')
133
133
  *
134
- * Используется в:
135
- * - BehaviorApplicator для доступа к полям в behavior functions
136
- * - ValidationApplicator для доступа к форме в tree validators
137
- *
138
134
  * @returns Proxy-инстанс с типобезопасным доступом к полям или сама форма, если proxy не доступен
139
135
  *
140
136
  * @example
@@ -1,23 +1,5 @@
1
1
  import { ReadonlySignal } from '@preact/signals-core';
2
2
  import { FieldStatus } from './types/index';
3
- /**
4
- * События для State Machine
5
- */
6
- export type StatusEvent = {
7
- type: 'START_VALIDATION';
8
- } | {
9
- type: 'VALIDATION_SUCCESS';
10
- } | {
11
- type: 'VALIDATION_FAILURE';
12
- } | {
13
- type: 'DISABLE';
14
- } | {
15
- type: 'ENABLE';
16
- hasErrors?: boolean;
17
- } | {
18
- type: 'SET_ERRORS';
19
- hasErrors: boolean;
20
- };
21
3
  /**
22
4
  * FormStatusMachine - управляет состоянием поля формы
23
5
  *
@@ -130,24 +112,4 @@ export declare class FormStatusMachine {
130
112
  * ```
131
113
  */
132
114
  enable(hasErrors?: boolean): void;
133
- /**
134
- * Обработать событие (альтернативный API)
135
- *
136
- * @param event - Событие для обработки
137
- *
138
- * @example
139
- * ```typescript
140
- * statusMachine.dispatch({ type: 'START_VALIDATION' });
141
- * statusMachine.dispatch({ type: 'VALIDATION_FAILURE' });
142
- * ```
143
- */
144
- dispatch(event: StatusEvent): void;
145
- /**
146
- * Получить текущий статус
147
- */
148
- getStatus(): FieldStatus;
149
- /**
150
- * Проверить, можно ли начать валидацию
151
- */
152
- canValidate(): boolean;
153
115
  }