@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
@@ -19,12 +19,6 @@
19
19
  export type FormValue = string | number | boolean | null | undefined | Date | File | FormValue[] | {
20
20
  [key: string]: FormValue;
21
21
  };
22
- /**
23
- * Type-safe alternative to 'any' for unknown form values
24
- * Requires explicit type checking before use
25
- * @internal
26
- */
27
- export type UnknownFormValue = unknown;
28
22
  /**
29
23
  * Синхронная функция валидации
30
24
  * @group Types
@@ -58,15 +58,6 @@ type RequireAtLeastOne<T> = {
58
58
  * @internal
59
59
  */
60
60
  type NonEmptyFieldConfig<T> = RequireAtLeastOne<FieldConfig<T>>;
61
- /**
62
- * Конфигурация массива
63
- * @group Types
64
- * @category Configuration Types
65
- */
66
- export interface ArrayConfig<T extends object> {
67
- itemSchema: FormSchema<T>;
68
- initial?: Partial<T>[];
69
- }
70
61
  /**
71
62
  * **Data-shaped** конфиг формы: ключи повторяют структуру данных `T`, значения — {@link FieldConfig}
72
63
  * (или вложенный `FormSchema`). Форма конфига, из которой строится {@link GroupNode}.
@@ -1,10 +1,10 @@
1
1
  import { FormSchema } from './deep-schema';
2
2
  import { FormNode } from '../nodes/form-node';
3
- export type { FormValue, UnknownFormValue, ValidatorFn, AsyncValidatorOptions, AsyncValidatorFn, ValidationError, ErrorFilterOptions, FieldStatus, } from './contracts';
3
+ export type { FormValue, ValidatorFn, AsyncValidatorOptions, AsyncValidatorFn, ValidationError, ErrorFilterOptions, FieldStatus, } from './contracts';
4
4
  export type { FieldConfig } from './deep-schema';
5
- export type { Validator, AsyncValidator, ConditionFn, ValidateOptions, ValidateAsyncOptions, } from './validation-schema';
6
- export type { FormSchema, ArrayConfig } from './deep-schema';
7
- export type { FormSchemaNode, SchemaArrayControl, SchemaValidator } from './schema-node';
5
+ export type { Validator, ValidateOptions } from './validation-schema';
6
+ export type { FormSchema } from './deep-schema';
7
+ export type { FormSchemaNode, SchemaArrayControl } from './schema-node';
8
8
  export type { FormControlsProxy, FormProxy, FormArrayProxy } from './form-proxy';
9
9
  /**
10
10
  * Конфигурация GroupNode.
@@ -25,20 +25,6 @@ export interface GroupNodeConfig<T> {
25
25
  * @internal
26
26
  */
27
27
  export type UnknownRecord = Record<string, unknown>;
28
- /**
29
- * Интерфейс для узлов с методом applyValidationSchema
30
- * @internal
31
- */
32
- export interface WithValidationSchema {
33
- applyValidationSchema(schemaFn: unknown): void;
34
- }
35
- /**
36
- * Интерфейс для узлов с методом applyBehaviorSchema
37
- * @internal
38
- */
39
- export interface WithBehaviorSchema {
40
- applyBehaviorSchema(schemaFn: unknown): void;
41
- }
42
28
  /**
43
29
  * Интерфейс для узлов, похожих на ArrayNode (с методом at)
44
30
  * Используется для duck typing при обходе путей
@@ -63,29 +49,9 @@ export interface ConfigWithSchema {
63
49
  export interface ConfigWithValue {
64
50
  value: unknown;
65
51
  }
66
- /**
67
- * Тип для путей к полям (field paths)
68
- * Используется в навигации по полям вместо any
69
- * @internal
70
- */
71
- export type FieldPathSegment = {
72
- key: string;
73
- index?: number;
74
- };
75
- /**
76
- * Тип для коллбэков и обработчиков событий
77
- * Используется вместо (...args: any[]) => any
78
- * @internal
79
- */
80
- export type UnknownCallback = (...args: unknown[]) => unknown;
81
52
  /**
82
53
  * Тип для проверки на функцию в conditional types
83
54
  * Используется вместо Function для type narrowing
84
55
  * @internal
85
56
  */
86
57
  export type AnyFunction = (...args: never[]) => unknown;
87
- /**
88
- * Тип для результатов загрузки ресурсов
89
- * @internal
90
- */
91
- export type ResourceLoadResult = unknown;
@@ -1,14 +1,5 @@
1
1
  import { ElementType } from 'react';
2
- import { ValidationError } from './contracts';
3
- /**
4
- * Валидатор поля схемы (legacy). Дерево-движок, вызывавший `validators` узла как
5
- * `(value, scope, root)`, удалён — живые правила это `Rule<T>` в `validate(sig, [...])`
6
- * (`@reformer/core/validation`). Тип остаётся широким по параметрам для совместимости
7
- * узлов, всё ещё несущих `validators` (гетерогенные контракты `ValidatorFn`/`Validator`).
8
- *
9
- * @group Types
10
- */
11
- export type SchemaValidator = (value: any, ...rest: any[]) => ValidationError | null | Promise<ValidationError | null>;
2
+ import { Signal } from '../../signals';
12
3
  /**
13
4
  * Минимальный контракт реактивного массива модели ({@link FormSchemaNode.array}).
14
5
  * Совпадает по форме с рантайм-фасадом `model.<array>` (см. `ModelArray`); рендерерский
@@ -55,19 +46,25 @@ export interface FormSchemaNode {
55
46
  component?: ElementType;
56
47
  /** Props компонента. Также «клапан» для вложенности под-узлов (напр. steps визарда). */
57
48
  componentProps?: Record<string, unknown>;
58
- validators?: SchemaValidator[];
59
- asyncValidators?: SchemaValidator[];
60
49
  updateOn?: 'change' | 'blur' | 'submit';
61
50
  disabled?: boolean;
62
51
  /** Задержка (мс) перед запуском асинхронной валидации. */
63
52
  debounce?: number;
64
53
  /** Идентификатор узла (для wizard/tabs/renderBehavior). */
65
54
  selector?: string;
55
+ /**
56
+ * ⚠️ Рантайм этого поля НЕ ЧИТАЕТ — `renderer-react` берёт testId из `componentProps.testId`
57
+ * (иначе выводит из пути сигнала). Поле оставлено только потому, что `RenderSchemaNode`
58
+ * рендерера объявляет свой одноимённый; пишите `componentProps: { testId: '…' }`.
59
+ */
66
60
  testId?: string;
67
- /** Дочерние узлы (даёт контекстную типизацию вложенным литералам — value/validators/when). */
68
- children?: readonly FormSchemaNode[];
69
- /** Условие включения поддерева (branch-узел `{ when, children }`). */
70
- when?: (scope: any, root: any) => boolean;
61
+ /**
62
+ * Содержимое узла: под-узлы (даёт контекстную типизацию вложенным литералам — value/validators/when)
63
+ * и текстовые части. Текст (литерал, число, сигнал модели) — такой же ребёнок, как узел: core его
64
+ * не интерпретирует (обход пропускает примитивы и не спускается внутрь сигнала), а рендерер
65
+ * выводит на своём месте в порядке следования.
66
+ */
67
+ children?: readonly (FormSchemaNode | string | number | Signal<any>)[];
71
68
  /** Реактивный массив модели (`model.<path>`) — маркер узла-массива (вместе с `item`). */
72
69
  array?: SchemaArrayControl;
73
70
  /** Схема элемента массива: под-модель элемента → узел поддерева. */
@@ -11,22 +11,6 @@ import { FormModel } from '../../state/types';
11
11
  * обратной совместимости (`SchemaValidator`-union).
12
12
  */
13
13
  export type Validator<TForm, TField> = (value: TField, scope: unknown, root: FormModel<TForm>) => ValidationError | null;
14
- /**
15
- * Чистый асинхронный валидатор поля. Та же тройка аргументов `(value, scope, root)`, что у
16
- * {@link Validator}, но возвращает `Promise`.
17
- *
18
- * @deprecated Осиротевший остаток удалённого оператора `validateAsync` (Ф7). Рантаймом не
19
- * потребляется — живой async-путь узла поля использует `AsyncValidatorFn` `(value, { signal })`.
20
- * Экспортируется только ради обратной совместимости.
21
- */
22
- export type AsyncValidator<TForm, TField> = (value: TField, scope: unknown, root: FormModel<TForm>) => Promise<ValidationError | null>;
23
- /**
24
- * Функция-предикат `(value) => boolean`.
25
- *
26
- * @deprecated Осиротевший остаток удалённого оператора `applyWhen` (Ф7). Рантаймом не
27
- * потребляется; экспортируется только ради обратной совместимости.
28
- */
29
- export type ConditionFn<T> = (value: T) => boolean;
30
14
  /**
31
15
  * Опции валидатора-фабрики (`required()`/`pattern()`/…). Передаются вторым (или последним)
32
16
  * аргументом в фабрику и попадают в возвращаемую {@link ValidationError}.
@@ -38,12 +22,3 @@ export interface ValidateOptions {
38
22
  /** Параметры ошибки (подстановка в шаблон сообщения / i18n). */
39
23
  params?: Record<string, FormValue>;
40
24
  }
41
- /**
42
- * @deprecated Осиротевший остаток удалённого оператора `validateAsync` (Ф7): опция `debounce`
43
- * подключалась тем оператором, которого больше нет. Рантаймом не потребляется; экспортируется
44
- * только ради обратной совместимости.
45
- */
46
- export interface ValidateAsyncOptions extends ValidateOptions {
47
- /** Задержка перед выполнением валидации (в мс). */
48
- debounce?: number;
49
- }
@@ -25,10 +25,6 @@ export declare const SubscriptionKey: {
25
25
  readonly LinkFields: "linkFields";
26
26
  /** GroupNode.watchField() */
27
27
  readonly WatchField: "watchField";
28
- /** ArrayNode.watchItems() */
29
- readonly WatchItems: "watchItems";
30
- /** ArrayNode.watchLength() */
31
- readonly WatchLength: "watchLength";
32
28
  };
33
29
  export type SubscriptionKeyType = (typeof SubscriptionKey)[keyof typeof SubscriptionKey];
34
30
  /**
@@ -37,17 +33,13 @@ export type SubscriptionKeyType = (typeof SubscriptionKey)[keyof typeof Subscrip
37
33
  * @param prefix - Префикс для идентификатора (используйте {@link SubscriptionKey}).
38
34
  * @returns Уникальный идентификатор в формате `${prefix}-${counter}`.
39
35
  *
36
+ * ⚠️ `SubscriptionKey`/`SubscriptionKeyType` — внутренние: барель `@reformer/core` их не отдаёт,
37
+ * поэтому вызвать `uniqueId` извне пакета типобезопасно нельзя. Пример ниже — внутрипакетный.
38
+ *
40
39
  * @example
41
40
  * ```typescript
42
- * import { uniqueId, SubscriptionKey } from '@reformer/core';
43
- *
44
41
  * uniqueId(SubscriptionKey.WatchField); // → 'watchField-1'
45
42
  * uniqueId(SubscriptionKey.WatchField); // → 'watchField-2'
46
43
  * ```
47
44
  */
48
45
  export declare function uniqueId(prefix: SubscriptionKeyType): string;
49
- /**
50
- * Сбросить счётчик (только для тестов)
51
- * @internal
52
- */
53
- export declare function resetUniqueIdCounter(): void;
@@ -1,6 +1,11 @@
1
1
  /**
2
- * Re-export validators from the main index to ensure single module instance.
3
- * This prevents static registry isolation issues when consuming the library.
2
+ * Точка входа сабпата `@reformer/core/validators` — все фабрики правил одним импортом.
3
+ *
4
+ * Гранулярные сабпаты (`@reformer/core/validators/required` и ещё 21) собираются отдельными
5
+ * entry для tree-shaking; этот модуль отдаёт полный набор для случаев, когда правил много.
6
+ *
7
+ * Ранее здесь был ещё и default-экспорт (`validators` из корневого `index`), заведённый как
8
+ * часть бандл-фикса «shared static registry». Реестров, ради которых он существовал, в коде
9
+ * больше нет, чанк-шаринг он не обеспечивал, потребителей не имел — удалён в 7.0.
4
10
  */
5
- export { validators as default } from '../index';
6
11
  export * from './validation/index';
@@ -0,0 +1,323 @@
1
+ import { batch as k, signal as _, computed as O } from "@preact/signals-core";
2
+ const h = /* @__PURE__ */ new WeakMap();
3
+ function F(e) {
4
+ h.set(e, (h.get(e) ?? 0) + 1);
5
+ }
6
+ function K(e) {
7
+ const t = h.get(e);
8
+ t !== void 0 && (t <= 1 ? h.delete(e) : h.set(e, t - 1));
9
+ }
10
+ function P(e) {
11
+ return h.has(e);
12
+ }
13
+ const p = (e) => !(e === null || typeof e != "object" || Array.isArray(e) || e instanceof Date || typeof Blob < "u" && e instanceof Blob || typeof File < "u" && e instanceof File), c = (e, t) => e === "" ? String(t) : `${e}.${t}`, m = (e) => /^\d+$/.test(e), l = (e) => {
14
+ if (Array.isArray(e)) return e.map(l);
15
+ if (p(e)) {
16
+ const t = {};
17
+ for (const i of Object.keys(e)) t[i] = l(e[i]);
18
+ return t;
19
+ }
20
+ return e;
21
+ }, g = (e, t) => {
22
+ if (e === t) return !0;
23
+ if (Array.isArray(e) && Array.isArray(t))
24
+ return e.length !== t.length ? !1 : e.every((i, r) => g(i, t[r]));
25
+ if (p(e) && p(t)) {
26
+ const i = Object.keys(e), r = Object.keys(t);
27
+ return i.length !== r.length ? !1 : i.every((n) => g(e[n], t[n]));
28
+ }
29
+ return !1;
30
+ };
31
+ class j {
32
+ constructor(t, i) {
33
+ this.path = i;
34
+ const r = _(t);
35
+ r.__path = i, this.signal = r, this.initial = l(t);
36
+ }
37
+ kind = "leaf";
38
+ signal;
39
+ initial;
40
+ rebase(t) {
41
+ this.path = t, this.signal.__path = t;
42
+ }
43
+ /** Реактивное чтение (внутри effect/computed создаёт зависимость). */
44
+ read() {
45
+ return this.signal.value;
46
+ }
47
+ /** Нереактивный снимок. */
48
+ peek() {
49
+ return this.signal.peek();
50
+ }
51
+ set(t) {
52
+ this.signal.value = t;
53
+ }
54
+ resetToInitial() {
55
+ this.signal.value = l(this.initial);
56
+ }
57
+ captureInitial() {
58
+ this.initial = l(this.signal.peek());
59
+ }
60
+ dirty() {
61
+ return !g(this.signal.peek(), this.initial);
62
+ }
63
+ }
64
+ class x {
65
+ constructor(t, i) {
66
+ this.path = i;
67
+ for (const r of Object.keys(t))
68
+ this.children.set(r, d(t[r], c(i, r)));
69
+ }
70
+ kind = "group";
71
+ children = /* @__PURE__ */ new Map();
72
+ rebase(t) {
73
+ this.path = t;
74
+ for (const [i, r] of this.children) r.rebase(c(t, i));
75
+ }
76
+ /** Реактивное чтение поддерева (внутри effect/computed подписывает на все листья группы). */
77
+ read() {
78
+ const t = {};
79
+ for (const [i, r] of this.children) t[i] = r.read();
80
+ return t;
81
+ }
82
+ peek() {
83
+ const t = {};
84
+ for (const [i, r] of this.children) t[i] = r.peek();
85
+ return t;
86
+ }
87
+ set(t) {
88
+ if (t == null || typeof t != "object") return;
89
+ const i = t;
90
+ k(() => {
91
+ for (const [r, n] of this.children)
92
+ r in i && (n.kind === "leaf" && P(n.signal) || n.set(i[r]));
93
+ });
94
+ }
95
+ resetToInitial() {
96
+ k(() => {
97
+ for (const t of this.children.values()) t.resetToInitial();
98
+ });
99
+ }
100
+ captureInitial() {
101
+ for (const t of this.children.values()) t.captureInitial();
102
+ }
103
+ dirty() {
104
+ for (const t of this.children.values()) if (t.dirty()) return !0;
105
+ return !1;
106
+ }
107
+ }
108
+ class N {
109
+ constructor(t, i) {
110
+ this.path = i, this.items = _(t.map((r, n) => d(r, c(i, n)))), this.initial = l(t);
111
+ }
112
+ kind = "array";
113
+ items;
114
+ initial;
115
+ rebase(t) {
116
+ this.path = t, this.items.peek().forEach((i, r) => i.rebase(c(t, r)));
117
+ }
118
+ reindex() {
119
+ this.items.peek().forEach((t, i) => t.rebase(c(this.path, i)));
120
+ }
121
+ push(t) {
122
+ const i = this.items.peek();
123
+ this.items.value = [...i, d(t, c(this.path, i.length))];
124
+ }
125
+ insertAt(t, i) {
126
+ const r = [...this.items.peek()];
127
+ r.splice(t, 0, d(i, c(this.path, t))), this.items.value = r, this.reindex();
128
+ }
129
+ removeAt(t) {
130
+ const i = [...this.items.peek()];
131
+ i.splice(t, 1), this.items.value = i, this.reindex();
132
+ }
133
+ move(t, i) {
134
+ const r = [...this.items.peek()], [n] = r.splice(t, 1);
135
+ n && r.splice(i, 0, n), this.items.value = r, this.reindex();
136
+ }
137
+ swap(t, i) {
138
+ const r = [...this.items.peek()];
139
+ t < 0 || i < 0 || t >= r.length || i >= r.length || t === i || ([r[t], r[i]] = [r[i], r[t]], this.items.value = r, this.reindex());
140
+ }
141
+ clear() {
142
+ this.items.value = [];
143
+ }
144
+ /**
145
+ * Реактивное чтение массива. Читаем `items.value` (а не `.peek()`) — внутри effect/computed это
146
+ * подписка на СОСТАВ массива, поэтому push/removeAt/move ретригерят наравне с правкой элемента.
147
+ */
148
+ read() {
149
+ return this.items.value.map((t) => t.read());
150
+ }
151
+ peek() {
152
+ return this.items.peek().map((t) => t.peek());
153
+ }
154
+ set(t) {
155
+ const i = Array.isArray(t) ? t : [];
156
+ this.items.value = i.map((r, n) => d(r, c(this.path, n)));
157
+ }
158
+ resetToInitial() {
159
+ this.set(l(this.initial));
160
+ }
161
+ captureInitial() {
162
+ this.initial = l(this.peek());
163
+ }
164
+ dirty() {
165
+ return !g(this.peek(), this.initial);
166
+ }
167
+ }
168
+ function d(e, t) {
169
+ return Array.isArray(e) ? new N(e, t) : p(e) ? new x(e, t) : new j(e, t);
170
+ }
171
+ function f(e) {
172
+ if (e)
173
+ return e.kind === "group" ? S(e) : e.kind === "array" ? E(e) : e.read();
174
+ }
175
+ function E(e) {
176
+ const t = {
177
+ get length() {
178
+ return e.items.value.length;
179
+ },
180
+ push: (i) => e.push(i),
181
+ insertAt: (i, r) => e.insertAt(i, r),
182
+ removeAt: (i) => e.removeAt(i),
183
+ move: (i, r) => e.move(i, r),
184
+ swap: (i, r) => e.swap(i, r),
185
+ clear: () => e.clear(),
186
+ at: (i) => f(e.items.value[i]),
187
+ map: (i) => e.items.value.map((r, n) => i(f(r), n)),
188
+ forEach: (i) => e.items.value.forEach((r, n) => i(f(r), n)),
189
+ toArray: () => e.peek(),
190
+ [Symbol.iterator]: function* () {
191
+ const i = e.items.value;
192
+ for (let r = 0; r < i.length; r++) yield f(i[r]);
193
+ }
194
+ };
195
+ return new Proxy(t, {
196
+ get: (i, r, n) => r === "__path" ? e.path : typeof r == "string" && m(r) ? f(e.items.value[Number(r)]) : Reflect.get(i, r, n),
197
+ has: (i, r) => typeof r == "string" && m(r) ? Number(r) < e.items.value.length : Reflect.has(i, r)
198
+ });
199
+ }
200
+ const A = /* @__PURE__ */ new WeakMap();
201
+ function M(e) {
202
+ const t = O(() => e.read());
203
+ return {
204
+ get value() {
205
+ return t.value;
206
+ },
207
+ peek: () => t.peek(),
208
+ subscribe: (i) => t.subscribe(i),
209
+ valueOf: () => t.value,
210
+ toString: () => String(t.value),
211
+ toJSON: () => t.value,
212
+ brand: t.brand
213
+ };
214
+ }
215
+ function I(e) {
216
+ if (e.kind === "leaf") return e.signal;
217
+ const t = A.get(e);
218
+ if (t) return t;
219
+ const i = M(e), r = e.kind === "group", n = (o) => r ? e.children.get(o) : m(o) ? e.items.value[Number(o)] : void 0, s = r ? {} : {
220
+ get length() {
221
+ return e.items.value.length;
222
+ }
223
+ }, u = new Proxy(s, {
224
+ get: (o, a, D) => {
225
+ if (a === "__path") return e.path;
226
+ if (a === "__kind") return e.kind;
227
+ if (typeof a != "string") return Reflect.get(i, a, i);
228
+ const v = n(a);
229
+ return v ? I(v) : !r && Reflect.has(o, a) ? Reflect.get(o, a, D) : Reflect.get(i, a, i);
230
+ },
231
+ has: (o, a) => typeof a == "string" && (n(a) !== void 0 || !r && Reflect.has(o, a)),
232
+ ownKeys: () => r ? [...e.children.keys()] : Reflect.ownKeys(s),
233
+ getOwnPropertyDescriptor: (o, a) => typeof a == "string" && n(a) ? { enumerable: !0, configurable: !0 } : r ? void 0 : Reflect.getOwnPropertyDescriptor(o, a)
234
+ });
235
+ return A.set(e, u), u;
236
+ }
237
+ function W(e) {
238
+ if (e == null || typeof e != "object") return !1;
239
+ const t = e.__kind;
240
+ return t === "group" || t === "array";
241
+ }
242
+ function T(e, t) {
243
+ if (!t) return;
244
+ let i = e;
245
+ for (const r of t.split(".")) {
246
+ if (!i) return;
247
+ if (i.kind === "group") i = i.children.get(r);
248
+ else if (i.kind === "array") i = i.items.peek()[Number(r)];
249
+ else return;
250
+ }
251
+ return i && i.kind === "leaf" ? i.signal : void 0;
252
+ }
253
+ const b = /* @__PURE__ */ new Set([
254
+ "$",
255
+ "get",
256
+ "set",
257
+ "patch",
258
+ "isDirty",
259
+ "reset",
260
+ "captureInitial",
261
+ "signalAt"
262
+ ]), w = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap();
263
+ function S(e) {
264
+ const t = w.get(e);
265
+ if (t) return t;
266
+ const i = {
267
+ $: I(e),
268
+ get: () => e.peek(),
269
+ set: (n) => e.set(n),
270
+ patch: (n) => e.set(n),
271
+ isDirty: () => e.dirty(),
272
+ reset: () => e.resetToInitial(),
273
+ captureInitial: () => e.captureInitial(),
274
+ signalAt: (n) => T(e, n)
275
+ }, r = new Proxy(
276
+ {},
277
+ {
278
+ get: (n, s) => {
279
+ if (s === "__path") return e.path;
280
+ if (typeof s != "string") return;
281
+ const u = e.children.get(s);
282
+ if (u) return f(u);
283
+ if (b.has(s)) return i[s];
284
+ },
285
+ set: (n, s, u) => {
286
+ if (typeof s != "string") return !1;
287
+ const o = e.children.get(s);
288
+ return o ? (o.set(u), !0) : !1;
289
+ },
290
+ has: (n, s) => typeof s == "string" && (e.children.has(s) || b.has(s)),
291
+ ownKeys: () => [...e.children.keys()],
292
+ getOwnPropertyDescriptor: (n, s) => typeof s == "string" && e.children.has(s) ? { enumerable: !0, configurable: !0 } : void 0
293
+ }
294
+ );
295
+ return w.set(e, r), R.set(r, e), r;
296
+ }
297
+ function y(e, t) {
298
+ if (e.kind === "leaf") {
299
+ t(e.signal);
300
+ return;
301
+ }
302
+ if (e.kind === "group") {
303
+ for (const i of e.children.values()) y(i, t);
304
+ return;
305
+ }
306
+ for (const i of e.items.value) y(i, t);
307
+ }
308
+ function B(e, t) {
309
+ const i = R.get(e);
310
+ i && y(i, t);
311
+ }
312
+ function C(e) {
313
+ const t = new x(e, "");
314
+ return S(t);
315
+ }
316
+ export {
317
+ P as a,
318
+ C as c,
319
+ B as e,
320
+ W as i,
321
+ F as m,
322
+ K as u
323
+ };
package/dist/index.d.ts CHANGED
@@ -8,4 +8,4 @@ export * from './form/types/index';
8
8
  export * from './form/factories/index';
9
9
  export * from './state/index';
10
10
  export * from './form/index';
11
- export * as validators from './form/validation/index';
11
+ export { CORE_RUNTIME_TOKEN } from './runtime-token';