@reformer/core 1.1.0-beta.4 → 1.1.0-beta.5

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.
@@ -1,243 +1,4 @@
1
- var P = Symbol.for("preact-signals");
2
- function S() {
3
- if (d > 1)
4
- d--;
5
- else {
6
- for (var i, t = !1; l !== void 0; ) {
7
- var e = l;
8
- for (l = void 0, x++; e !== void 0; ) {
9
- var n = e.o;
10
- if (e.o = void 0, e.f &= -3, !(8 & e.f) && _(e)) try {
11
- e.c();
12
- } catch (r) {
13
- t || (i = r, t = !0);
14
- }
15
- e = n;
16
- }
17
- }
18
- if (x = 0, d--, t) throw i;
19
- }
20
- }
21
- var o = void 0;
22
- function C(i) {
23
- var t = o;
24
- o = void 0;
25
- try {
26
- return i();
27
- } finally {
28
- o = t;
29
- }
30
- }
31
- var l = void 0, d = 0, x = 0, y = 0;
32
- function k(i) {
33
- if (o !== void 0) {
34
- var t = i.n;
35
- if (t === void 0 || t.t !== o)
36
- return t = { i: 0, S: i, p: o.s, n: void 0, t: o, e: void 0, x: void 0, r: t }, o.s !== void 0 && (o.s.n = t), o.s = t, i.n = t, 32 & o.f && i.S(t), t;
37
- if (t.i === -1)
38
- return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = o.s, t.n = void 0, o.s.n = t, o.s = t), t;
39
- }
40
- }
41
- function c(i, t) {
42
- this.v = i, this.i = 0, this.n = void 0, this.t = void 0, this.W = t?.watched, this.Z = t?.unwatched, this.name = t?.name;
43
- }
44
- c.prototype.brand = P;
45
- c.prototype.h = function() {
46
- return !0;
47
- };
48
- c.prototype.S = function(i) {
49
- var t = this, e = this.t;
50
- e !== i && i.e === void 0 && (i.x = e, this.t = i, e !== void 0 ? e.e = i : C(function() {
51
- var n;
52
- (n = t.W) == null || n.call(t);
53
- }));
54
- };
55
- c.prototype.U = function(i) {
56
- var t = this;
57
- if (this.t !== void 0) {
58
- var e = i.e, n = i.x;
59
- e !== void 0 && (e.x = n, i.e = void 0), n !== void 0 && (n.e = e, i.x = void 0), i === this.t && (this.t = n, n === void 0 && C(function() {
60
- var r;
61
- (r = t.Z) == null || r.call(t);
62
- }));
63
- }
64
- };
65
- c.prototype.subscribe = function(i) {
66
- var t = this;
67
- return F(function() {
68
- var e = t.value, n = o;
69
- o = void 0;
70
- try {
71
- i(e);
72
- } finally {
73
- o = n;
74
- }
75
- }, { name: "sub" });
76
- };
77
- c.prototype.valueOf = function() {
78
- return this.value;
79
- };
80
- c.prototype.toString = function() {
81
- return this.value + "";
82
- };
83
- c.prototype.toJSON = function() {
84
- return this.value;
85
- };
86
- c.prototype.peek = function() {
87
- var i = o;
88
- o = void 0;
89
- try {
90
- return this.value;
91
- } finally {
92
- o = i;
93
- }
94
- };
95
- Object.defineProperty(c.prototype, "value", { get: function() {
96
- var i = k(this);
97
- return i !== void 0 && (i.i = this.i), this.v;
98
- }, set: function(i) {
99
- if (i !== this.v) {
100
- if (x > 100) throw new Error("Cycle detected");
101
- this.v = i, this.i++, y++, d++;
102
- try {
103
- for (var t = this.t; t !== void 0; t = t.x) t.t.N();
104
- } finally {
105
- S();
106
- }
107
- }
108
- } });
109
- function O(i, t) {
110
- return new c(i, t);
111
- }
112
- function _(i) {
113
- for (var t = i.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;
114
- return !1;
115
- }
116
- function b(i) {
117
- for (var t = i.s; t !== void 0; t = t.n) {
118
- var e = t.S.n;
119
- if (e !== void 0 && (t.r = e), t.S.n = t, t.i = -1, t.n === void 0) {
120
- i.s = t;
121
- break;
122
- }
123
- }
124
- }
125
- function V(i) {
126
- for (var t = i.s, e = void 0; t !== void 0; ) {
127
- var n = t.p;
128
- t.i === -1 ? (t.S.U(t), n !== void 0 && (n.n = t.n), t.n !== void 0 && (t.n.p = n)) : e = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = n;
129
- }
130
- i.s = e;
131
- }
132
- function h(i, t) {
133
- c.call(this, void 0), this.x = i, this.s = void 0, this.g = y - 1, this.f = 4, this.W = t?.watched, this.Z = t?.unwatched, this.name = t?.name;
134
- }
135
- h.prototype = new c();
136
- h.prototype.h = function() {
137
- if (this.f &= -3, 1 & this.f) return !1;
138
- if ((36 & this.f) == 32 || (this.f &= -5, this.g === y)) return !0;
139
- if (this.g = y, this.f |= 1, this.i > 0 && !_(this))
140
- return this.f &= -2, !0;
141
- var i = o;
142
- try {
143
- b(this), o = this;
144
- var t = this.x();
145
- (16 & this.f || this.v !== t || this.i === 0) && (this.v = t, this.f &= -17, this.i++);
146
- } catch (e) {
147
- this.v = e, this.f |= 16, this.i++;
148
- }
149
- return o = i, V(this), this.f &= -2, !0;
150
- };
151
- h.prototype.S = function(i) {
152
- if (this.t === void 0) {
153
- this.f |= 36;
154
- for (var t = this.s; t !== void 0; t = t.n) t.S.S(t);
155
- }
156
- c.prototype.S.call(this, i);
157
- };
158
- h.prototype.U = function(i) {
159
- if (this.t !== void 0 && (c.prototype.U.call(this, i), this.t === void 0)) {
160
- this.f &= -33;
161
- for (var t = this.s; t !== void 0; t = t.n) t.S.U(t);
162
- }
163
- };
164
- h.prototype.N = function() {
165
- if (!(2 & this.f)) {
166
- this.f |= 6;
167
- for (var i = this.t; i !== void 0; i = i.x) i.t.N();
168
- }
169
- };
170
- Object.defineProperty(h.prototype, "value", { get: function() {
171
- if (1 & this.f) throw new Error("Cycle detected");
172
- var i = k(this);
173
- if (this.h(), i !== void 0 && (i.i = this.i), 16 & this.f) throw this.v;
174
- return this.v;
175
- } });
176
- function B(i, t) {
177
- return new h(i, t);
178
- }
179
- function E(i) {
180
- var t = i.u;
181
- if (i.u = void 0, typeof t == "function") {
182
- d++;
183
- var e = o;
184
- o = void 0;
185
- try {
186
- t();
187
- } catch (n) {
188
- throw i.f &= -2, i.f |= 8, w(i), n;
189
- } finally {
190
- o = e, S();
191
- }
192
- }
193
- }
194
- function w(i) {
195
- for (var t = i.s; t !== void 0; t = t.n) t.S.U(t);
196
- i.x = void 0, i.s = void 0, E(i);
197
- }
198
- function A(i) {
199
- if (o !== this) throw new Error("Out-of-order effect");
200
- V(this), o = i, this.f &= -2, 8 & this.f && w(this), S();
201
- }
202
- function u(i, t) {
203
- this.x = i, this.u = void 0, this.s = void 0, this.o = void 0, this.f = 32, this.name = t?.name;
204
- }
205
- u.prototype.c = function() {
206
- var i = this.S();
207
- try {
208
- if (8 & this.f || this.x === void 0) return;
209
- var t = this.x();
210
- typeof t == "function" && (this.u = t);
211
- } finally {
212
- i();
213
- }
214
- };
215
- u.prototype.S = function() {
216
- if (1 & this.f) throw new Error("Cycle detected");
217
- this.f |= 1, this.f &= -9, E(this), b(this), d++;
218
- var i = o;
219
- return o = this, A.bind(this, i);
220
- };
221
- u.prototype.N = function() {
222
- 2 & this.f || (this.f |= 2, this.o = l, l = this);
223
- };
224
- u.prototype.d = function() {
225
- this.f |= 8, 1 & this.f || w(this);
226
- };
227
- u.prototype.dispose = function() {
228
- this.d();
229
- };
230
- function F(i, t) {
231
- var e = new u(i, t);
232
- try {
233
- e.c();
234
- } catch (r) {
235
- throw e.d(), r;
236
- }
237
- var n = e.d.bind(e);
238
- return n[Symbol.dispose] = n, n;
239
- }
240
- class R {
1
+ class h {
241
2
  stack = [];
242
3
  /**
243
4
  * Добавить элемент в стек
@@ -291,7 +52,7 @@ class R {
291
52
  this.stack = [];
292
53
  }
293
54
  }
294
- class I {
55
+ class f {
295
56
  validators = [];
296
57
  conditionStack = [];
297
58
  /**
@@ -323,12 +84,12 @@ class I {
323
84
  return this.validators;
324
85
  }
325
86
  }
326
- class f {
87
+ class a {
327
88
  /**
328
89
  * Global stack активных реестров
329
90
  * Используется для изоляции форм друг от друга
330
91
  */
331
- static registryStack = new R();
92
+ static registryStack = new h();
332
93
  contextStack = [];
333
94
  validators = [];
334
95
  /**
@@ -348,7 +109,7 @@ class f {
348
109
  * ```
349
110
  */
350
111
  static getCurrent() {
351
- return f.registryStack.getCurrent();
112
+ return a.registryStack.getCurrent();
352
113
  }
353
114
  /**
354
115
  * Начать регистрацию валидаторов для формы
@@ -356,8 +117,8 @@ class f {
356
117
  * Помещает this в global stack для изоляции форм
357
118
  */
358
119
  beginRegistration() {
359
- const t = new I();
360
- return this.contextStack.push(t), f.registryStack.push(this), t;
120
+ const t = new f();
121
+ return this.contextStack.push(t), a.registryStack.push(this), t;
361
122
  }
362
123
  /**
363
124
  * Завершить регистрацию и применить валидаторы к GroupNode
@@ -370,7 +131,7 @@ class f {
370
131
  const e = this.contextStack.pop();
371
132
  if (!e)
372
133
  throw new Error("No active registration context");
373
- f.registryStack.verify(this, "ValidationRegistry"), this.validators = e.getValidators(), this.applyValidators(t, this.validators), this.applyArrayItemValidators(t, this.validators);
134
+ a.registryStack.verify(this, "ValidationRegistry"), this.validators = e.getValidators(), this.applyValidators(t, this.validators), this.applyArrayItemValidators(t, this.validators);
374
135
  }
375
136
  /**
376
137
  * Отменить регистрацию без применения валидаторов
@@ -381,7 +142,7 @@ class f {
381
142
  cancelRegistration() {
382
143
  if (!this.contextStack.pop())
383
144
  throw new Error("No active registration context to cancel");
384
- f.registryStack.verify(this, "ValidationRegistry");
145
+ a.registryStack.verify(this, "ValidationRegistry");
385
146
  }
386
147
  /**
387
148
  * Получить текущий контекст регистрации
@@ -392,7 +153,7 @@ class f {
392
153
  /**
393
154
  * Зарегистрировать синхронный валидатор
394
155
  */
395
- registerSync(t, e, n) {
156
+ registerSync(t, e, i) {
396
157
  const r = this.getCurrentContext();
397
158
  if (!r)
398
159
  throw new Error("Validators can only be registered inside a validation schema function");
@@ -400,13 +161,13 @@ class f {
400
161
  fieldPath: t,
401
162
  type: "sync",
402
163
  validator: e,
403
- options: n
164
+ options: i
404
165
  });
405
166
  }
406
167
  /**
407
168
  * Зарегистрировать асинхронный валидатор
408
169
  */
409
- registerAsync(t, e, n) {
170
+ registerAsync(t, e, i) {
410
171
  const r = this.getCurrentContext();
411
172
  if (!r)
412
173
  throw new Error("Validators can only be registered inside a validation schema function");
@@ -414,17 +175,17 @@ class f {
414
175
  fieldPath: t,
415
176
  type: "async",
416
177
  validator: e,
417
- options: n
178
+ options: i
418
179
  });
419
180
  }
420
181
  /**
421
182
  * Зарегистрировать tree валидатор
422
183
  */
423
184
  registerTree(t, e) {
424
- const n = this.getCurrentContext();
425
- if (!n)
185
+ const i = this.getCurrentContext();
186
+ if (!i)
426
187
  throw new Error("Validators can only be registered inside a validation schema function");
427
- n.addValidator({
188
+ i.addValidator({
428
189
  fieldPath: e?.targetField || "__tree__",
429
190
  type: "tree",
430
191
  validator: t,
@@ -435,10 +196,10 @@ class f {
435
196
  * Войти в условный блок
436
197
  */
437
198
  enterCondition(t, e) {
438
- const n = this.getCurrentContext();
439
- if (!n)
199
+ const i = this.getCurrentContext();
200
+ if (!i)
440
201
  throw new Error("Conditions can only be used inside a validation schema function");
441
- n.enterCondition(t, e);
202
+ i.enterCondition(t, e);
442
203
  }
443
204
  /**
444
205
  * Выйти из условного блока
@@ -459,12 +220,12 @@ class f {
459
220
  * @param itemSchemaFn - Validation schema для элемента массива
460
221
  */
461
222
  registerArrayItemValidation(t, e) {
462
- const n = this.getCurrentContext();
463
- if (!n)
223
+ const i = this.getCurrentContext();
224
+ if (!i)
464
225
  throw new Error(
465
226
  "Array item validators can only be registered inside a validation schema function"
466
227
  );
467
- n.addValidator({
228
+ i.addValidator({
468
229
  fieldPath: t,
469
230
  type: "array-items",
470
231
  validator: e,
@@ -485,12 +246,12 @@ class f {
485
246
  * @private
486
247
  */
487
248
  applyValidators(t, e) {
488
- const n = /* @__PURE__ */ new Map();
249
+ const i = /* @__PURE__ */ new Map();
489
250
  for (const r of e) {
490
251
  if (r.type === "tree" || r.type === "array-items")
491
252
  continue;
492
- const a = n.get(r.fieldPath) || [];
493
- a.push(r), n.set(r.fieldPath, a);
253
+ const n = i.get(r.fieldPath) || [];
254
+ n.push(r), i.set(r.fieldPath, n);
494
255
  }
495
256
  }
496
257
  /**
@@ -498,18 +259,18 @@ class f {
498
259
  * @private
499
260
  */
500
261
  applyArrayItemValidators(t, e) {
501
- const n = e.filter((r) => r.type === "array-items");
502
- if (n.length !== 0)
503
- for (const r of n) {
504
- const a = t[r.fieldPath.split(".")[0]];
505
- if (a && "applyValidationSchema" in a) {
262
+ const i = e.filter((r) => r.type === "array-items");
263
+ if (i.length !== 0)
264
+ for (const r of i) {
265
+ const n = t[r.fieldPath.split(".")[0]];
266
+ if (n && "applyValidationSchema" in n) {
506
267
  const s = r.validator;
507
- a.applyValidationSchema(s);
268
+ n.applyValidationSchema(s);
508
269
  }
509
270
  }
510
271
  }
511
272
  }
512
- class U {
273
+ class p {
513
274
  /**
514
275
  * Форма с типизированным Proxy-доступом к полям
515
276
  */
@@ -529,16 +290,16 @@ class U {
529
290
  * @param value - Новое значение
530
291
  */
531
292
  setFieldValue(t, e) {
532
- const n = typeof t == "string" ? t : t.toString(), r = this._form.getFieldByPath(n);
293
+ const i = typeof t == "string" ? t : t.toString(), r = this._form.getFieldByPath(i);
533
294
  r && r.setValue(e, { emitEvent: !1 });
534
295
  }
535
296
  }
536
- class v {
297
+ class c {
537
298
  /**
538
299
  * Stack активных контекстов регистрации
539
300
  * Используется для изоляции форм друг от друга
540
301
  */
541
- static contextStack = new R();
302
+ static contextStack = new h();
542
303
  registrations = [];
543
304
  isRegistering = !1;
544
305
  /**
@@ -558,7 +319,7 @@ class v {
558
319
  * ```
559
320
  */
560
321
  static getCurrent() {
561
- return v.contextStack.getCurrent();
322
+ return c.contextStack.getCurrent();
562
323
  }
563
324
  /**
564
325
  * Начать регистрацию behaviors
@@ -567,7 +328,7 @@ class v {
567
328
  * Помещает this в context stack для изоляции форм
568
329
  */
569
330
  beginRegistration() {
570
- this.isRegistering = !0, this.registrations = [], v.contextStack.push(this);
331
+ this.isRegistering = !0, this.registrations = [], c.contextStack.push(this);
571
332
  }
572
333
  /**
573
334
  * Зарегистрировать behavior handler
@@ -600,14 +361,14 @@ class v {
600
361
  * @returns Количество зарегистрированных behaviors и функция cleanup
601
362
  */
602
363
  endRegistration(t) {
603
- this.isRegistering = !1, v.contextStack.verify(this, "BehaviorRegistry");
604
- const e = new U(t), n = [];
605
- for (const a of this.registrations) {
606
- const s = this.createEffect(a, t, e);
607
- s && n.push(s);
364
+ this.isRegistering = !1, c.contextStack.verify(this, "BehaviorRegistry");
365
+ const e = new p(t), i = [];
366
+ for (const n of this.registrations) {
367
+ const s = this.createEffect(n, t, e);
368
+ s && i.push(s);
608
369
  }
609
370
  const r = () => {
610
- n.forEach((a) => a());
371
+ i.forEach((n) => n());
611
372
  };
612
373
  return {
613
374
  count: this.registrations.length,
@@ -618,22 +379,22 @@ class v {
618
379
  * Создать effect подписку для behavior
619
380
  * @private
620
381
  */
621
- createEffect(t, e, n) {
622
- const { handler: r, debounce: a = 0 } = t;
382
+ createEffect(t, e, i) {
383
+ const { handler: r, debounce: n = 0 } = t;
623
384
  let s = null;
624
- const p = (m) => {
625
- a > 0 ? (s && clearTimeout(s), s = setTimeout(m, a)) : m();
626
- }, N = () => {
385
+ const g = (l) => {
386
+ n > 0 ? (s && clearTimeout(s), s = setTimeout(l, n)) : l();
387
+ }, u = () => {
627
388
  s && (clearTimeout(s), s = null);
628
- }, g = r(e, n, p);
629
- return g ? () => {
630
- N(), g && g();
389
+ }, d = r(e, i, g);
390
+ return d ? () => {
391
+ u(), d && d();
631
392
  } : null;
632
393
  }
633
394
  }
634
- function $() {
635
- const i = f.getCurrent();
636
- return i || {
395
+ function y() {
396
+ const o = a.getCurrent();
397
+ return o || {
637
398
  registerSync: () => {
638
399
  },
639
400
  registerAsync: () => {
@@ -648,60 +409,18 @@ function $() {
648
409
  }
649
410
  };
650
411
  }
651
- function D() {
652
- const i = v.getCurrent();
653
- return i || {
412
+ function x() {
413
+ const o = c.getCurrent();
414
+ return o || {
654
415
  register: () => {
655
416
  }
656
417
  };
657
418
  }
658
- function W() {
659
- return T("");
660
- }
661
- function T(i) {
662
- return new Proxy(
663
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
664
- {},
665
- {
666
- get(t, e) {
667
- if (e === "__path" || e === "__fieldPath")
668
- return i || e;
669
- if (e === "__key") {
670
- const a = i.split(".");
671
- return a[a.length - 1] || e;
672
- }
673
- const n = i ? `${i}.${e}` : e, r = {
674
- __path: n,
675
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
676
- __key: e,
677
- __formType: void 0,
678
- __fieldType: void 0
679
- };
680
- return new Proxy(r, {
681
- get(a, s) {
682
- if (s === "__path" || s === "__fieldPath")
683
- return n;
684
- if (s === "__key")
685
- return e;
686
- if (s === "__formType" || s === "__fieldType")
687
- return;
688
- const p = `${n}.${s}`;
689
- return T(p);
690
- }
691
- });
692
- }
693
- }
694
- );
695
- }
696
419
  export {
697
- v as B,
698
- F as E,
699
- R,
700
- f as V,
701
- D as a,
702
- U as b,
703
- W as c,
704
- O as d,
705
- $ as g,
706
- B as w
420
+ c as B,
421
+ h as R,
422
+ a as V,
423
+ x as a,
424
+ p as b,
425
+ y as g
707
426
  };