@macrulez/vue-form-schema 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/LICENSE +21 -0
  2. package/dist/MaskEngine-DAKSNIHQ.cjs +1 -0
  3. package/dist/MaskEngine-mLoXKd4d.js +251 -0
  4. package/dist/core/ValidationEngine.d.ts +6 -0
  5. package/dist/core/ValidationEngine.d.ts.map +1 -1
  6. package/dist/core/types.d.ts +10 -2
  7. package/dist/core/types.d.ts.map +1 -1
  8. package/dist/core/useForm.d.ts.map +1 -1
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +159 -151
  13. package/dist/ui/index.d.ts +1 -0
  14. package/dist/ui/index.d.ts.map +1 -1
  15. package/dist/ui/tailwind/index.d.ts +11 -0
  16. package/dist/ui/tailwind/index.d.ts.map +1 -0
  17. package/dist/ui-tailwind.cjs +1 -0
  18. package/dist/ui-tailwind.d.ts +397 -0
  19. package/dist/ui-tailwind.js +650 -0
  20. package/dist/ui.cjs +1 -1
  21. package/dist/ui.d.ts +47 -10
  22. package/dist/ui.js +436 -300
  23. package/dist/valibot.d.ts +10 -2
  24. package/dist/yup.d.ts +10 -2
  25. package/dist/zod.d.ts +10 -2
  26. package/package.json +38 -24
  27. package/dist/MaskEngine-BqJQYybS.js +0 -233
  28. package/dist/MaskEngine-BwAs2Zb0.cjs +0 -1
  29. package/dist/__tests__/ConditionEvaluator.test.d.ts +0 -2
  30. package/dist/__tests__/ConditionEvaluator.test.d.ts.map +0 -1
  31. package/dist/__tests__/MaskEngine.test.d.ts +0 -2
  32. package/dist/__tests__/MaskEngine.test.d.ts.map +0 -1
  33. package/dist/__tests__/ValidationEngine.test.d.ts +0 -2
  34. package/dist/__tests__/ValidationEngine.test.d.ts.map +0 -1
  35. package/dist/__tests__/parsers.test.d.ts +0 -2
  36. package/dist/__tests__/parsers.test.d.ts.map +0 -1
  37. package/dist/__tests__/phase3.test.d.ts +0 -2
  38. package/dist/__tests__/phase3.test.d.ts.map +0 -1
  39. package/dist/__tests__/phase4.test.d.ts +0 -2
  40. package/dist/__tests__/phase4.test.d.ts.map +0 -1
  41. package/dist/__tests__/useFieldArray.test.d.ts +0 -2
  42. package/dist/__tests__/useFieldArray.test.d.ts.map +0 -1
  43. package/dist/__tests__/useForm.test.d.ts +0 -2
  44. package/dist/__tests__/useForm.test.d.ts.map +0 -1
  45. package/dist/__tests__/useMultiStepForm.test.d.ts +0 -2
  46. package/dist/__tests__/useMultiStepForm.test.d.ts.map +0 -1
package/dist/valibot.d.ts CHANGED
@@ -8,7 +8,7 @@ declare interface FieldDefinition {
8
8
  name: string;
9
9
  label?: string;
10
10
  placeholder?: string;
11
- defaultValue?: unknown;
11
+ defaultValue?: unknown | ((values: Record<string, unknown>) => unknown);
12
12
  required?: boolean;
13
13
  /** Static or dynamic disabled state */
14
14
  disabled?: boolean | ((values: Record<string, unknown>) => boolean);
@@ -43,6 +43,14 @@ declare interface FieldDefinition {
43
43
  * Receives FormFieldProps and must emit 'update:modelValue' and 'blur'.
44
44
  */
45
45
  component?: Component | string;
46
+ /** Accepted file types, e.g. "image/*,.pdf" — passed to <input accept> */
47
+ accept?: string;
48
+ /** Allow selecting multiple files */
49
+ multiple?: boolean;
50
+ /** Maximum file size in bytes */
51
+ maxSize?: number;
52
+ /** Maximum number of files (only relevant when multiple=true) */
53
+ maxFiles?: number;
46
54
  }
47
55
 
48
56
  declare interface FieldOption {
@@ -50,7 +58,7 @@ declare interface FieldOption {
50
58
  value: unknown;
51
59
  }
52
60
 
53
- declare type FieldType = 'text' | 'number' | 'email' | 'select' | 'checkbox' | 'radio' | 'textarea' | 'date' | 'array' | 'group';
61
+ declare type FieldType = 'text' | 'number' | 'email' | 'select' | 'checkbox' | 'radio' | 'textarea' | 'date' | 'array' | 'group' | 'file';
54
62
 
55
63
  declare interface MaskConfig {
56
64
  preset?: MaskPreset;
package/dist/yup.d.ts CHANGED
@@ -8,7 +8,7 @@ declare interface FieldDefinition {
8
8
  name: string;
9
9
  label?: string;
10
10
  placeholder?: string;
11
- defaultValue?: unknown;
11
+ defaultValue?: unknown | ((values: Record<string, unknown>) => unknown);
12
12
  required?: boolean;
13
13
  /** Static or dynamic disabled state */
14
14
  disabled?: boolean | ((values: Record<string, unknown>) => boolean);
@@ -43,6 +43,14 @@ declare interface FieldDefinition {
43
43
  * Receives FormFieldProps and must emit 'update:modelValue' and 'blur'.
44
44
  */
45
45
  component?: Component | string;
46
+ /** Accepted file types, e.g. "image/*,.pdf" — passed to <input accept> */
47
+ accept?: string;
48
+ /** Allow selecting multiple files */
49
+ multiple?: boolean;
50
+ /** Maximum file size in bytes */
51
+ maxSize?: number;
52
+ /** Maximum number of files (only relevant when multiple=true) */
53
+ maxFiles?: number;
46
54
  }
47
55
 
48
56
  declare interface FieldOption {
@@ -50,7 +58,7 @@ declare interface FieldOption {
50
58
  value: unknown;
51
59
  }
52
60
 
53
- declare type FieldType = 'text' | 'number' | 'email' | 'select' | 'checkbox' | 'radio' | 'textarea' | 'date' | 'array' | 'group';
61
+ declare type FieldType = 'text' | 'number' | 'email' | 'select' | 'checkbox' | 'radio' | 'textarea' | 'date' | 'array' | 'group' | 'file';
54
62
 
55
63
  declare interface MaskConfig {
56
64
  preset?: MaskPreset;
package/dist/zod.d.ts CHANGED
@@ -8,7 +8,7 @@ declare interface FieldDefinition {
8
8
  name: string;
9
9
  label?: string;
10
10
  placeholder?: string;
11
- defaultValue?: unknown;
11
+ defaultValue?: unknown | ((values: Record<string, unknown>) => unknown);
12
12
  required?: boolean;
13
13
  /** Static or dynamic disabled state */
14
14
  disabled?: boolean | ((values: Record<string, unknown>) => boolean);
@@ -43,6 +43,14 @@ declare interface FieldDefinition {
43
43
  * Receives FormFieldProps and must emit 'update:modelValue' and 'blur'.
44
44
  */
45
45
  component?: Component | string;
46
+ /** Accepted file types, e.g. "image/*,.pdf" — passed to <input accept> */
47
+ accept?: string;
48
+ /** Allow selecting multiple files */
49
+ multiple?: boolean;
50
+ /** Maximum file size in bytes */
51
+ maxSize?: number;
52
+ /** Maximum number of files (only relevant when multiple=true) */
53
+ maxFiles?: number;
46
54
  }
47
55
 
48
56
  declare interface FieldOption {
@@ -50,7 +58,7 @@ declare interface FieldOption {
50
58
  value: unknown;
51
59
  }
52
60
 
53
- declare type FieldType = 'text' | 'number' | 'email' | 'select' | 'checkbox' | 'radio' | 'textarea' | 'date' | 'array' | 'group';
61
+ declare type FieldType = 'text' | 'number' | 'email' | 'select' | 'checkbox' | 'radio' | 'textarea' | 'date' | 'array' | 'group' | 'file';
54
62
 
55
63
  declare interface MaskConfig {
56
64
  preset?: MaskPreset;
package/package.json CHANGED
@@ -1,50 +1,66 @@
1
1
  {
2
2
  "name": "@macrulez/vue-form-schema",
3
- "version": "0.1.7",
4
- "description": "Reactive forms from JSON/Zod/Yup/Valibot schema with validation, masking and conditional UI for Vue 3",
3
+ "version": "0.1.9",
4
+ "description": "Reactive Vue 3 forms generated from JSON, Zod, Yup or Valibot schemas, with validation, input masking, conditional UI and SSR support.",
5
+ "author": "macrulez <macrulezru@gmail.com> (https://macrulez.ru/en)",
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/macrulezru/vue-form-schema#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/macrulezru/vue-form-schema.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/macrulezru/vue-form-schema/issues"
14
+ },
5
15
  "type": "module",
6
16
  "main": "./dist/index.cjs",
7
17
  "module": "./dist/index.js",
8
18
  "types": "./dist/index.d.ts",
9
19
  "exports": {
10
20
  ".": {
21
+ "types": "./dist/index.d.ts",
11
22
  "import": "./dist/index.js",
12
- "require": "./dist/index.cjs",
13
- "types": "./dist/index.d.ts"
23
+ "require": "./dist/index.cjs"
14
24
  },
15
25
  "./zod": {
26
+ "types": "./dist/zod.d.ts",
16
27
  "import": "./dist/zod.js",
17
- "require": "./dist/zod.cjs",
18
- "types": "./dist/zod.d.ts"
28
+ "require": "./dist/zod.cjs"
19
29
  },
20
30
  "./yup": {
31
+ "types": "./dist/yup.d.ts",
21
32
  "import": "./dist/yup.js",
22
- "require": "./dist/yup.cjs",
23
- "types": "./dist/yup.d.ts"
33
+ "require": "./dist/yup.cjs"
24
34
  },
25
35
  "./valibot": {
36
+ "types": "./dist/valibot.d.ts",
26
37
  "import": "./dist/valibot.js",
27
- "require": "./dist/valibot.cjs",
28
- "types": "./dist/valibot.d.ts"
38
+ "require": "./dist/valibot.cjs"
29
39
  },
30
40
  "./ui": {
41
+ "types": "./dist/ui.d.ts",
31
42
  "import": "./dist/ui.js",
32
- "require": "./dist/ui.cjs",
33
- "types": "./dist/ui.d.ts"
43
+ "require": "./dist/ui.cjs"
34
44
  },
35
45
  "./ui/tailwind": {
46
+ "types": "./dist/ui-tailwind.d.ts",
36
47
  "import": "./dist/ui-tailwind.js",
37
- "require": "./dist/ui-tailwind.cjs",
38
- "types": "./dist/ui-tailwind.d.ts"
48
+ "require": "./dist/ui-tailwind.cjs"
39
49
  }
40
50
  },
41
51
  "files": [
42
- "dist"
52
+ "dist",
53
+ "README.md",
54
+ "LICENSE"
43
55
  ],
56
+ "engines": {
57
+ "node": ">=18"
58
+ },
44
59
  "publishConfig": {
45
60
  "access": "public"
46
61
  },
47
62
  "scripts": {
63
+ "prepublishOnly": "npm run build",
48
64
  "dev": "vite",
49
65
  "build": "vite build && tsc -p tsconfig.build.json",
50
66
  "demo": "vite --config vite.demo.config.ts",
@@ -60,18 +76,16 @@
60
76
  "validation",
61
77
  "zod",
62
78
  "yup",
63
- "composable",
79
+ "valibot",
64
80
  "mask",
65
- "reactive"
81
+ "ssr",
82
+ "typescript"
66
83
  ],
67
- "author": "macrulez",
68
- "license": "MIT",
69
- "bugs": {
70
- "url": "https://github.com/macrulezru/vue-form-schema"
71
- },
72
- "homepage": "https://macrulez.ru/en",
73
84
  "peerDependencies": {
74
- "vue": "^3.3.0"
85
+ "vue": "^3.3.0",
86
+ "zod": ">=3.22.0",
87
+ "yup": ">=1.3.0",
88
+ "valibot": ">=1.0.0"
75
89
  },
76
90
  "peerDependenciesMeta": {
77
91
  "zod": {
@@ -1,233 +0,0 @@
1
- import { inject as $, provide as w, computed as p } from "vue";
2
- const m = Symbol("vfs:registry");
3
- function P(t) {
4
- return {
5
- install(n) {
6
- n.provide(m, t);
7
- }
8
- };
9
- }
10
- function k() {
11
- return $(m, {});
12
- }
13
- function L(t) {
14
- w(m, t);
15
- }
16
- function j(t, n) {
17
- const e = p(() => T(t.fields.value, n)), r = p(() => (t.getField(n) ?? []).map((c, u) => {
18
- var g;
19
- return {
20
- key: `${n}__${u}`,
21
- index: u,
22
- fields: F(((g = e.value) == null ? void 0 : g.fields) ?? [], n, u)
23
- };
24
- })), i = p(() => r.value.length);
25
- function s() {
26
- return [...t.getField(n) ?? []];
27
- }
28
- function o(f = {}) {
29
- const c = s();
30
- c.push(f), t.setField(n, c);
31
- }
32
- function l(f = {}) {
33
- const c = s();
34
- c.unshift(f), t.setField(n, c);
35
- }
36
- function a(f) {
37
- const c = s();
38
- c.splice(f, 1), t.setField(n, c);
39
- }
40
- function d(f, c) {
41
- const u = s(), [g] = u.splice(f, 1);
42
- u.splice(c, 0, g), t.setField(n, u);
43
- }
44
- function h(f, c) {
45
- const u = s();
46
- [u[f], u[c]] = [u[c], u[f]], t.setField(n, u);
47
- }
48
- function I(f, c) {
49
- const u = s();
50
- u[f] = c, t.setField(n, u);
51
- }
52
- return { rows: r, count: i, append: o, prepend: l, remove: a, move: d, swap: h, replace: I };
53
- }
54
- function F(t, n, e) {
55
- return t.map((r) => ({
56
- ...r,
57
- name: `${n}.${e}.${r.name}`,
58
- fields: r.fields ? F(r.fields, n, e) : void 0
59
- }));
60
- }
61
- function T(t, n) {
62
- for (const e of t) {
63
- if (e.name === n) return e;
64
- if (e.fields) {
65
- const r = T(e.fields, n);
66
- if (r) return r;
67
- }
68
- }
69
- }
70
- const b = (t) => t == null || t === "" || Array.isArray(t) && t.length === 0 ? "This field is required" : null, q = (t, n) => (e) => typeof e != "string" && !Array.isArray(e) || e.length >= t ? null : n ?? `Minimum length is ${t}`, C = (t, n) => (e) => typeof e != "string" && !Array.isArray(e) || e.length <= t ? null : n ?? `Maximum length is ${t}`, _ = (t, n) => (e) => {
71
- const r = Number(e);
72
- return isNaN(r) || r >= t ? null : n ?? `Minimum value is ${t}`;
73
- }, U = (t, n) => (e) => {
74
- const r = Number(e);
75
- return isNaN(r) || r <= t ? null : n ?? `Maximum value is ${t}`;
76
- }, B = (t, n) => (e) => typeof e != "string" || t.test(e) ? null : n ?? "Invalid format", V = (t) => t ? /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t)) ? null : "Invalid email address" : null, Y = (t) => {
77
- if (!t) return null;
78
- try {
79
- return new URL(String(t)), null;
80
- } catch {
81
- return "Invalid URL";
82
- }
83
- }, z = (t, n) => (e, r) => e === r[t] ? null : n ?? `Must match ${t}`;
84
- class G {
85
- constructor(n = 300, e = "first") {
86
- this.asyncTimers = /* @__PURE__ */ new Map(), this.debounceMs = n, this.validateMode = e;
87
- }
88
- /** Run sync validators for a single field; returns list of error messages */
89
- validateField(n, e, r) {
90
- const i = [];
91
- if (n.required) {
92
- const s = b(e);
93
- if (s && (i.push(s), this.validateMode === "first"))
94
- return i;
95
- }
96
- for (const s of n.validators ?? []) {
97
- const o = s(e, r);
98
- if (o && (i.push(o), this.validateMode === "first"))
99
- return i;
100
- }
101
- return i;
102
- }
103
- /** Run all sync validators across all visible fields */
104
- validateAll(n, e) {
105
- const r = {};
106
- return this.collectErrors(n, e, r), r;
107
- }
108
- collectErrors(n, e, r) {
109
- for (const i of n) {
110
- const s = x(e, i.name), o = this.validateField(i, s, e);
111
- o.length && (r[i.name] = o), (i.type === "group" || i.type === "array") && i.fields && this.collectErrors(i.fields, e, r);
112
- }
113
- }
114
- /** Run async validators with debounce; calls onResult when done */
115
- validateAsync(n, e, r, i) {
116
- var l;
117
- if (!((l = n.asyncValidators) != null && l.length)) return;
118
- const s = this.asyncTimers.get(n.name);
119
- s && clearTimeout(s);
120
- const o = setTimeout(async () => {
121
- const d = (await Promise.all(
122
- n.asyncValidators.map((h) => h(e, r))
123
- )).filter((h) => h !== null);
124
- i(n.name, d), this.asyncTimers.delete(n.name);
125
- }, this.debounceMs);
126
- this.asyncTimers.set(n.name, o);
127
- }
128
- destroy() {
129
- for (const n of this.asyncTimers.values()) clearTimeout(n);
130
- this.asyncTimers.clear();
131
- }
132
- }
133
- function x(t, n) {
134
- return n.split(".").reduce((e, r) => {
135
- if (e && typeof e == "object") return e[r];
136
- }, t);
137
- }
138
- function K(t, n, e) {
139
- const r = n.split("."), i = { ...t };
140
- let s = i;
141
- for (let o = 0; o < r.length - 1; o++) {
142
- const l = r[o], a = s[l];
143
- Array.isArray(a) ? s[l] = [...a] : a && typeof a == "object" ? s[l] = { ...a } : s[l] = {}, s = s[l];
144
- }
145
- return s[r[r.length - 1]] = e, i;
146
- }
147
- const R = {
148
- "phone-ru": "+7 (###) ###-##-##",
149
- "phone-eu": "+## (##) ###-##-##",
150
- date: "##.##.####",
151
- inn: "############",
152
- iban: "AA## #### #### #### #### #### ####"
153
- };
154
- function E(t) {
155
- return t.preset ? R[t.preset] : t.pattern ?? "";
156
- }
157
- function y(t) {
158
- return t === "#" || t === "A";
159
- }
160
- function v(t, n) {
161
- return n === "#" ? /\d/.test(t) : n === "A" ? /[a-zA-Z]/.test(t) : !1;
162
- }
163
- function A(t, n) {
164
- const r = E(typeof n == "string" ? { pattern: n } : n);
165
- if (!r) return t;
166
- const i = Array.from(t);
167
- let s = 0, o = -1;
168
- for (let a = 0; a < r.length && s < i.length; a++) {
169
- const d = r[a];
170
- if (y(d)) {
171
- for (; s < i.length && !v(i[s], d); ) s++;
172
- s < i.length && (o = a, s++);
173
- }
174
- }
175
- if (o === -1) return "";
176
- let l = "";
177
- s = 0;
178
- for (let a = 0; a <= o; a++) {
179
- const d = r[a];
180
- if (y(d)) {
181
- for (; s < i.length && !v(i[s], d); ) s++;
182
- s < i.length && (l += d === "A" ? i[s++].toUpperCase() : i[s++]);
183
- } else
184
- l += d;
185
- }
186
- return l;
187
- }
188
- function M(t, n) {
189
- const r = E(typeof n == "string" ? { pattern: n } : n);
190
- if (!r) return t;
191
- const i = [];
192
- let s = 0;
193
- for (let o = 0; o < r.length && s < t.length; o++) {
194
- const l = r[o], a = t[s];
195
- y(l) ? (i.push(a), s++) : a === l && s++;
196
- }
197
- return i.join("");
198
- }
199
- function Z(t, n) {
200
- function e() {
201
- const i = M(t.value, n), s = A(i, n);
202
- if (t.value !== s) {
203
- const o = t.selectionStart ?? s.length;
204
- t.value = s;
205
- const l = Math.min(o, s.length);
206
- t.setSelectionRange(l, l);
207
- }
208
- }
209
- t.addEventListener("input", e);
210
- const r = A(M(t.value, n), n);
211
- return t.value !== r && r && (t.value = r), () => t.removeEventListener("input", e);
212
- }
213
- export {
214
- G as V,
215
- A as a,
216
- Z as b,
217
- P as c,
218
- C as d,
219
- V as e,
220
- _ as f,
221
- x as g,
222
- q as h,
223
- L as i,
224
- b as j,
225
- K as k,
226
- j as l,
227
- U as m,
228
- k as n,
229
- B as p,
230
- M as r,
231
- z as s,
232
- Y as u
233
- };
@@ -1 +0,0 @@
1
- "use strict";const g=require("vue"),A=Symbol("vfs:registry");function w(t){return{install(e){e.provide(A,t)}}}function x(){return g.inject(A,{})}function b(t){g.provide(A,t)}function P(t,e){const n=g.computed(()=>T(t.fields.value,e)),r=g.computed(()=>(t.getField(e)??[]).map((u,a)=>{var y;return{key:`${e}__${a}`,index:a,fields:F(((y=n.value)==null?void 0:y.fields)??[],e,a)}})),i=g.computed(()=>r.value.length);function s(){return[...t.getField(e)??[]]}function o(f={}){const u=s();u.push(f),t.setField(e,u)}function l(f={}){const u=s();u.unshift(f),t.setField(e,u)}function c(f){const u=s();u.splice(f,1),t.setField(e,u)}function d(f,u){const a=s(),[y]=a.splice(f,1);a.splice(u,0,y),t.setField(e,a)}function h(f,u){const a=s();[a[f],a[u]]=[a[u],a[f]],t.setField(e,a)}function $(f,u){const a=s();a[f]=u,t.setField(e,a)}return{rows:r,count:i,append:o,prepend:l,remove:c,move:d,swap:h,replace:$}}function F(t,e,n){return t.map(r=>({...r,name:`${e}.${n}.${r.name}`,fields:r.fields?F(r.fields,e,n):void 0}))}function T(t,e){for(const n of t){if(n.name===e)return n;if(n.fields){const r=T(n.fields,e);if(r)return r}}}const E=t=>t==null||t===""||Array.isArray(t)&&t.length===0?"This field is required":null,S=(t,e)=>n=>typeof n!="string"&&!Array.isArray(n)||n.length>=t?null:e??`Minimum length is ${t}`,k=(t,e)=>n=>typeof n!="string"&&!Array.isArray(n)||n.length<=t?null:e??`Maximum length is ${t}`,L=(t,e)=>n=>{const r=Number(n);return isNaN(r)||r>=t?null:e??`Minimum value is ${t}`},q=(t,e)=>n=>{const r=Number(n);return isNaN(r)||r<=t?null:e??`Maximum value is ${t}`},j=(t,e)=>n=>typeof n!="string"||t.test(n)?null:e??"Invalid format",B=t=>t?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))?null:"Invalid email address":null,C=t=>{if(!t)return null;try{return new URL(String(t)),null}catch{return"Invalid URL"}},_=(t,e)=>(n,r)=>n===r[t]?null:e??`Must match ${t}`;class U{constructor(e=300,n="first"){this.asyncTimers=new Map,this.debounceMs=e,this.validateMode=n}validateField(e,n,r){const i=[];if(e.required){const s=E(n);if(s&&(i.push(s),this.validateMode==="first"))return i}for(const s of e.validators??[]){const o=s(n,r);if(o&&(i.push(o),this.validateMode==="first"))return i}return i}validateAll(e,n){const r={};return this.collectErrors(e,n,r),r}collectErrors(e,n,r){for(const i of e){const s=R(n,i.name),o=this.validateField(i,s,n);o.length&&(r[i.name]=o),(i.type==="group"||i.type==="array")&&i.fields&&this.collectErrors(i.fields,n,r)}}validateAsync(e,n,r,i){var l;if(!((l=e.asyncValidators)!=null&&l.length))return;const s=this.asyncTimers.get(e.name);s&&clearTimeout(s);const o=setTimeout(async()=>{const d=(await Promise.all(e.asyncValidators.map(h=>h(n,r)))).filter(h=>h!==null);i(e.name,d),this.asyncTimers.delete(e.name)},this.debounceMs);this.asyncTimers.set(e.name,o)}destroy(){for(const e of this.asyncTimers.values())clearTimeout(e);this.asyncTimers.clear()}}function R(t,e){return e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t)}function V(t,e,n){const r=e.split("."),i={...t};let s=i;for(let o=0;o<r.length-1;o++){const l=r[o],c=s[l];Array.isArray(c)?s[l]=[...c]:c&&typeof c=="object"?s[l]={...c}:s[l]={},s=s[l]}return s[r[r.length-1]]=n,i}const Y={"phone-ru":"+7 (###) ###-##-##","phone-eu":"+## (##) ###-##-##",date:"##.##.####",inn:"############",iban:"AA## #### #### #### #### #### ####"};function I(t){return t.preset?Y[t.preset]:t.pattern??""}function p(t){return t==="#"||t==="A"}function M(t,e){return e==="#"?/\d/.test(t):e==="A"?/[a-zA-Z]/.test(t):!1}function m(t,e){const r=I(typeof e=="string"?{pattern:e}:e);if(!r)return t;const i=Array.from(t);let s=0,o=-1;for(let c=0;c<r.length&&s<i.length;c++){const d=r[c];if(p(d)){for(;s<i.length&&!M(i[s],d);)s++;s<i.length&&(o=c,s++)}}if(o===-1)return"";let l="";s=0;for(let c=0;c<=o;c++){const d=r[c];if(p(d)){for(;s<i.length&&!M(i[s],d);)s++;s<i.length&&(l+=d==="A"?i[s++].toUpperCase():i[s++])}else l+=d}return l}function v(t,e){const r=I(typeof e=="string"?{pattern:e}:e);if(!r)return t;const i=[];let s=0;for(let o=0;o<r.length&&s<t.length;o++){const l=r[o],c=t[s];p(l)?(i.push(c),s++):c===l&&s++}return i.join("")}function z(t,e){function n(){const i=v(t.value,e),s=m(i,e);if(t.value!==s){const o=t.selectionStart??s.length;t.value=s;const l=Math.min(o,s.length);t.setSelectionRange(l,l)}}t.addEventListener("input",n);const r=m(v(t.value,e),e);return t.value!==r&&r&&(t.value=r),()=>t.removeEventListener("input",n)}exports.ValidationEngine=U;exports.applyMask=m;exports.bindMask=z;exports.createFormRegistry=w;exports.email=B;exports.getByPath=R;exports.max=q;exports.maxLength=k;exports.min=L;exports.minLength=S;exports.pattern=j;exports.provideRegistry=b;exports.removeMask=v;exports.required=E;exports.sameAs=_;exports.setByPath=V;exports.url=C;exports.useFieldArray=P;exports.useRegistry=x;
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ConditionEvaluator.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ConditionEvaluator.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/ConditionEvaluator.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=MaskEngine.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MaskEngine.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/MaskEngine.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ValidationEngine.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ValidationEngine.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/ValidationEngine.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=parsers.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parsers.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/parsers.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=phase3.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"phase3.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/phase3.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=phase4.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"phase4.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/phase4.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=useFieldArray.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFieldArray.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/useFieldArray.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=useForm.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useForm.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/useForm.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=useMultiStepForm.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useMultiStepForm.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/useMultiStepForm.test.ts"],"names":[],"mappings":""}