attaform 0.29.0 → 0.30.0
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.
- package/dist/abstract.d.mts +5 -5
- package/dist/abstract.mjs +4 -4
- package/dist/dev/abstract.mjs +4 -4
- package/dist/dev/chunks/dev-key-collision-warnings.mjs +47 -8
- package/dist/dev/chunks/devtools.mjs +1 -1
- package/dist/dev/directive.mjs +1 -1
- package/dist/dev/history.mjs +1 -2
- package/dist/dev/index.mjs +5 -5
- package/dist/dev/runtime/plugins/attaform.mjs +3 -3
- package/dist/dev/shared/{attaform-dev.BO-71R54.mjs → attaform-dev.BK6Ge2qR.mjs} +34 -188
- package/dist/dev/shared/{attaform-dev.A-TpJW0B.mjs → attaform-dev.BQc5QV3Y.mjs} +1 -19
- package/dist/dev/shared/{attaform-dev.DrzObAZo.mjs → attaform-dev.BcNtyOmf.mjs} +4 -4
- package/dist/dev/shared/{attaform-dev.ButTkwHd.mjs → attaform-dev.BcYT6tFh.mjs} +7 -8
- package/dist/dev/shared/{attaform-dev.BgM6FdtA.mjs → attaform-dev.BisFstxh.mjs} +91 -59
- package/dist/dev/shared/{attaform-dev.DHuydLAC.mjs → attaform-dev.CQ2rJiAX.mjs} +560 -631
- package/dist/dev/shared/{attaform-dev.D8aoKb89.mjs → attaform-dev.D6CLvaQT.mjs} +8 -8
- package/dist/dev/shared/{attaform-dev.q6UutkCx.mjs → attaform-dev.DTrHonpc.mjs} +69 -120
- package/dist/dev/shared/{attaform-dev.DD5m2W51.mjs → attaform-dev.DUZckyV8.mjs} +1 -3
- package/dist/dev/zod-v3.mjs +6 -6
- package/dist/dev/zod-v4.mjs +6 -6
- package/dist/dev/zod.mjs +5 -5
- package/dist/directive.d.mts +2 -2
- package/dist/directive.mjs +1 -1
- package/dist/history.d.mts +1 -1
- package/dist/history.mjs +1 -2
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +5 -5
- package/dist/nuxt.d.mts +2 -11
- package/dist/nuxt.mjs +0 -1
- package/dist/runtime/plugins/attaform.mjs +3 -3
- package/dist/shared/{attaform.DffRL5pP.mjs → attaform.B3resMQ1.mjs} +8 -8
- package/dist/shared/{attaform.Cvao8bW5.mjs → attaform.BRDDQeHV.mjs} +6 -6
- package/dist/shared/{attaform.C2MVyuxC.mjs → attaform.BXneBxEj.mjs} +34 -188
- package/dist/shared/{attaform.BndjUUYX.mjs → attaform.ByWP6kSx.mjs} +4 -4
- package/dist/shared/{attaform.D1fnTifF.mjs → attaform.CJ8DpRGj.mjs} +69 -120
- package/dist/shared/{attaform.B0dKL8ST.mjs → attaform.CUfrMK7t.mjs} +91 -59
- package/dist/shared/{attaform.CZYt_5N_.mjs → attaform.CdZIEf7_.mjs} +1 -19
- package/dist/shared/{attaform.axHXVQO7.d.mts → attaform.Clz0ArIi.d.mts} +1 -1
- package/dist/shared/{attaform.CZMAYwSK.mjs → attaform.DNJOWjQw.mjs} +559 -588
- package/dist/shared/{attaform.CIWLMY-R.d.mts → attaform.Rc9u4Vfw.d.mts} +1 -1
- package/dist/shared/{attaform.DDtqHYv1.d.mts → attaform.UGyOK83T.d.mts} +115 -214
- package/dist/shared/{attaform.D0x-qSXm.mjs → attaform.WiGdIqgx.mjs} +1 -3
- package/dist/shared/{attaform.CsoeRi3P.d.mts → attaform.bKLzMU0o.d.mts} +99 -493
- package/dist/vite.mjs +5 -0
- package/dist/zod-v3.d.mts +4 -4
- package/dist/zod-v3.mjs +6 -6
- package/dist/zod-v4.d.mts +9 -9
- package/dist/zod-v4.mjs +6 -6
- package/dist/zod.d.mts +4 -4
- package/dist/zod.mjs +5 -5
- package/package.json +3 -2
- package/skills/attaform/SKILL.md +1 -1
- package/skills/attaform/references/custom-components.md +1 -1
- package/dist/chunks/fingerprint.mjs +0 -183
- package/dist/chunks/fingerprint2.mjs +0 -159
- package/dist/dev/chunks/fingerprint.mjs +0 -183
- package/dist/dev/chunks/fingerprint2.mjs +0 -159
- package/dist/dev/shared/attaform-dev.BxfsuwBR.mjs +0 -44
- package/dist/shared/attaform.BxfsuwBR.mjs +0 -44
|
@@ -1,18 +1,42 @@
|
|
|
1
|
-
import { A as AttaformErrorCode,
|
|
2
|
-
import { e as canonicalizePath, h as SET_MEMBER_SEGMENT } from './attaform.
|
|
3
|
-
import { a as safeOwnRead, b as safeAssign } from './attaform.
|
|
1
|
+
import { A as AttaformErrorCode, k as isPlainRecord, s as slimKindOf } from './attaform.DNJOWjQw.mjs';
|
|
2
|
+
import { e as canonicalizePath, h as SET_MEMBER_SEGMENT } from './attaform.CdZIEf7_.mjs';
|
|
3
|
+
import { a as safeOwnRead, b as safeAssign } from './attaform.BRDDQeHV.mjs';
|
|
4
4
|
|
|
5
5
|
const PATH_SEPARATOR = ".";
|
|
6
6
|
function isOpaqueKind(kind) {
|
|
7
7
|
return kind === "any" || kind === "unknown" || kind === "custom";
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
const MEMO_CAP = 4096;
|
|
10
|
+
const ROOT_KINDS = /* @__PURE__ */ new Set(["object"]);
|
|
11
|
+
const NO_KINDS = /* @__PURE__ */ new Set();
|
|
12
|
+
function memoPut(memo, key, value) {
|
|
13
|
+
if (memo.size >= MEMO_CAP) memo.clear();
|
|
14
|
+
memo.set(key, value);
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
function createSharedSchemaStore() {
|
|
18
|
+
const bySchema = /* @__PURE__ */ new WeakMap();
|
|
19
|
+
return (rootSchema, maxRecursionDepth, build) => {
|
|
20
|
+
let byDepth = bySchema.get(rootSchema);
|
|
21
|
+
if (byDepth === void 0) {
|
|
22
|
+
byDepth = /* @__PURE__ */ new Map();
|
|
23
|
+
bySchema.set(rootSchema, byDepth);
|
|
24
|
+
}
|
|
25
|
+
const hit = byDepth.get(maxRecursionDepth);
|
|
26
|
+
if (hit !== void 0) return hit;
|
|
27
|
+
const built = build();
|
|
28
|
+
byDepth.set(maxRecursionDepth, built);
|
|
29
|
+
return built;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function createAbstractSchema(rootSchema, intro, services, options) {
|
|
10
33
|
const maxRecursionDepth = options.maxRecursionDepth;
|
|
11
34
|
const leafCache = /* @__PURE__ */ new Map();
|
|
12
35
|
const preprocessOrCoerceCache = /* @__PURE__ */ new Map();
|
|
13
36
|
const opaqueLeafCache = /* @__PURE__ */ new Map();
|
|
14
37
|
const discriminatorCache = /* @__PURE__ */ new Map();
|
|
15
38
|
const entryKeyKindCache = /* @__PURE__ */ new Map();
|
|
39
|
+
const slimKindsCache = /* @__PURE__ */ new Map();
|
|
16
40
|
let asyncValidationFlag = null;
|
|
17
41
|
let containerRefineFlag = null;
|
|
18
42
|
let discriminatedUnionFlag = null;
|
|
@@ -56,7 +80,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
56
80
|
if (intro.kindOf(litSchema) !== "literal") continue;
|
|
57
81
|
const literalValues = intro.getLiteralValues(litSchema);
|
|
58
82
|
if (literalValues.includes(value)) {
|
|
59
|
-
return services.deriveDefault(opt, true, maxRecursionDepth
|
|
83
|
+
return services.deriveDefault(opt, true, maxRecursionDepth);
|
|
60
84
|
}
|
|
61
85
|
}
|
|
62
86
|
return void 0;
|
|
@@ -67,7 +91,6 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
67
91
|
};
|
|
68
92
|
}
|
|
69
93
|
const abstractSchema = {
|
|
70
|
-
fingerprint: () => services.fingerprint(rootSchema),
|
|
71
94
|
needsAsyncValidation() {
|
|
72
95
|
asyncValidationFlag ?? (asyncValidationFlag = intro.containsAsyncRefine(rootSchema) || intro.containsAsyncTransform(rootSchema));
|
|
73
96
|
return asyncValidationFlag;
|
|
@@ -81,24 +104,24 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
81
104
|
return discriminatedUnionFlag;
|
|
82
105
|
},
|
|
83
106
|
getDefaultValues(config) {
|
|
84
|
-
return services.
|
|
107
|
+
return services.runGetDefaults(rootSchema, config, maxRecursionDepth);
|
|
85
108
|
},
|
|
86
109
|
getDefaultAtPath(path) {
|
|
87
110
|
if (path.length === 0) {
|
|
88
|
-
return services.deriveDefault(rootSchema, true, maxRecursionDepth
|
|
111
|
+
return services.deriveDefault(rootSchema, true, maxRecursionDepth);
|
|
89
112
|
}
|
|
90
113
|
const [first] = services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth);
|
|
91
114
|
if (first === void 0) return void 0;
|
|
92
115
|
const peeled = services.unwrapStructuralWrappers(first);
|
|
93
|
-
return services.deriveDefault(peeled, true, maxRecursionDepth
|
|
116
|
+
return services.deriveDefault(peeled, true, maxRecursionDepth);
|
|
94
117
|
},
|
|
95
118
|
getEmptyValueAtPath(path) {
|
|
96
119
|
if (path.length === 0) {
|
|
97
|
-
return services.deriveDefault(rootSchema, false, maxRecursionDepth
|
|
120
|
+
return services.deriveDefault(rootSchema, false, maxRecursionDepth);
|
|
98
121
|
}
|
|
99
122
|
const [first] = services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth);
|
|
100
123
|
if (first === void 0) return void 0;
|
|
101
|
-
return services.deriveDefault(first, false, maxRecursionDepth
|
|
124
|
+
return services.deriveDefault(first, false, maxRecursionDepth);
|
|
102
125
|
},
|
|
103
126
|
arrayShapeAtPath(path) {
|
|
104
127
|
if (path.length === 0) return null;
|
|
@@ -139,25 +162,27 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
139
162
|
answer = void 0;
|
|
140
163
|
}
|
|
141
164
|
}
|
|
142
|
-
entryKeyKindCache
|
|
143
|
-
return answer;
|
|
165
|
+
return memoPut(entryKeyKindCache, cacheKey, answer);
|
|
144
166
|
},
|
|
145
167
|
getSchemasAtPath(path) {
|
|
146
168
|
const resolved = services.getNestedSchemasInSlimMode(rootSchema, path, maxRecursionDepth);
|
|
147
169
|
if (resolved.length === 0) return [];
|
|
148
|
-
return resolved.map((sub) => services.makeSubSchema(sub,
|
|
170
|
+
return resolved.map((sub) => services.makeSubSchema(sub, maxRecursionDepth));
|
|
149
171
|
},
|
|
150
172
|
getSlimPrimitiveTypesAtPath(path) {
|
|
151
|
-
if (path.length === 0) return
|
|
173
|
+
if (path.length === 0) return ROOT_KINDS;
|
|
174
|
+
const cacheKey = canonicalizePath(path).key;
|
|
175
|
+
const hit = slimKindsCache.get(cacheKey);
|
|
176
|
+
if (hit !== void 0) return hit;
|
|
152
177
|
const resolved = services.getNestedSchemasInSlimMode(rootSchema, path, maxRecursionDepth);
|
|
153
|
-
if (resolved.length === 0) return
|
|
178
|
+
if (resolved.length === 0) return memoPut(slimKindsCache, cacheKey, NO_KINDS);
|
|
154
179
|
const out = /* @__PURE__ */ new Set();
|
|
155
180
|
for (const candidate of resolved) {
|
|
156
181
|
for (const k of services.slimPrimitivesOf(candidate, maxRecursionDepth)) {
|
|
157
182
|
out.add(k);
|
|
158
183
|
}
|
|
159
184
|
}
|
|
160
|
-
return out;
|
|
185
|
+
return memoPut(slimKindsCache, cacheKey, out);
|
|
161
186
|
},
|
|
162
187
|
isLeafAtPath(path) {
|
|
163
188
|
const cacheKey = canonicalizePath(path).key;
|
|
@@ -166,8 +191,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
166
191
|
const opaque = path.length > 0 && this.isOpaqueLeafAtPath(path);
|
|
167
192
|
const prim = opaque ? void 0 : this.getSlimPrimitiveTypesAtPath(path);
|
|
168
193
|
const isLeaf = opaque || prim !== void 0 && prim.size > 0 && !prim.has("object") && !prim.has("array") && !prim.has("map") && !prim.has("set");
|
|
169
|
-
leafCache
|
|
170
|
-
return isLeaf;
|
|
194
|
+
return memoPut(leafCache, cacheKey, isLeaf);
|
|
171
195
|
},
|
|
172
196
|
isPreprocessOrCoerceLeaf(path) {
|
|
173
197
|
const cacheKey = canonicalizePath(path).key;
|
|
@@ -184,8 +208,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
184
208
|
}
|
|
185
209
|
}
|
|
186
210
|
}
|
|
187
|
-
preprocessOrCoerceCache
|
|
188
|
-
return hit;
|
|
211
|
+
return memoPut(preprocessOrCoerceCache, cacheKey, hit);
|
|
189
212
|
},
|
|
190
213
|
isOpaqueLeafAtPath(path) {
|
|
191
214
|
const cacheKey = canonicalizePath(path).key;
|
|
@@ -195,8 +218,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
195
218
|
const opaque = resolved.length > 0 && resolved.every(
|
|
196
219
|
(candidate) => isOpaqueKind(intro.kindOf(services.peelAllWrappers(candidate)))
|
|
197
220
|
);
|
|
198
|
-
opaqueLeafCache
|
|
199
|
-
return opaque;
|
|
221
|
+
return memoPut(opaqueLeafCache, cacheKey, opaque);
|
|
200
222
|
},
|
|
201
223
|
isRequiredAtPath(path) {
|
|
202
224
|
if (path.length === 0) return true;
|
|
@@ -212,9 +234,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
212
234
|
if (discriminatorCache.has(cacheKey)) {
|
|
213
235
|
return discriminatorCache.get(cacheKey);
|
|
214
236
|
}
|
|
215
|
-
|
|
216
|
-
discriminatorCache.set(cacheKey, result);
|
|
217
|
-
return result;
|
|
237
|
+
return memoPut(discriminatorCache, cacheKey, computeDiscriminator(path));
|
|
218
238
|
},
|
|
219
239
|
validateAtPath(data, path, validateOptions) {
|
|
220
240
|
const trySync = validateOptions?.sync === true;
|
|
@@ -226,11 +246,10 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
226
246
|
}
|
|
227
247
|
return runAsync();
|
|
228
248
|
function parseResultToResponse(result) {
|
|
229
|
-
return result.success ? { data: result.data, errors: void 0, success: true
|
|
249
|
+
return result.success ? { data: result.data, errors: void 0, success: true } : {
|
|
230
250
|
data: void 0,
|
|
231
251
|
errors: services.issuesToValidationErrors(result.issues),
|
|
232
|
-
success: false
|
|
233
|
-
formKey
|
|
252
|
+
success: false
|
|
234
253
|
};
|
|
235
254
|
}
|
|
236
255
|
function runSync() {
|
|
@@ -245,7 +264,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
245
264
|
if (response.success) return response;
|
|
246
265
|
aggregated.push(...response.errors);
|
|
247
266
|
}
|
|
248
|
-
return { data: void 0, errors: aggregated, success: false
|
|
267
|
+
return { data: void 0, errors: aggregated, success: false };
|
|
249
268
|
}
|
|
250
269
|
async function runAsync() {
|
|
251
270
|
if (path === void 0) {
|
|
@@ -271,7 +290,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
271
290
|
if (response.success) return response;
|
|
272
291
|
aggregated.push(...response.errors);
|
|
273
292
|
}
|
|
274
|
-
return { data: void 0, errors: aggregated, success: false
|
|
293
|
+
return { data: void 0, errors: aggregated, success: false };
|
|
275
294
|
}
|
|
276
295
|
function validatorThrewResponse(err, errPath) {
|
|
277
296
|
const message = err instanceof Error ? err.message : typeof err === "string" ? err : "Validator threw";
|
|
@@ -284,8 +303,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
284
303
|
code: AttaformErrorCode.ValidatorThrew
|
|
285
304
|
}
|
|
286
305
|
],
|
|
287
|
-
success: false
|
|
288
|
-
formKey
|
|
306
|
+
success: false
|
|
289
307
|
};
|
|
290
308
|
}
|
|
291
309
|
function pathNotFound(p) {
|
|
@@ -298,8 +316,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
298
316
|
code: AttaformErrorCode.PathNotFound
|
|
299
317
|
}
|
|
300
318
|
],
|
|
301
|
-
success: false
|
|
302
|
-
formKey
|
|
319
|
+
success: false
|
|
303
320
|
};
|
|
304
321
|
}
|
|
305
322
|
}
|
|
@@ -373,6 +390,8 @@ function walkPathSegments(schema, segments, intro, maxDepth, lazyDepth) {
|
|
|
373
390
|
case "optional":
|
|
374
391
|
case "nullable":
|
|
375
392
|
case "default":
|
|
393
|
+
case "nonoptional":
|
|
394
|
+
case "success":
|
|
376
395
|
case "readonly":
|
|
377
396
|
case "catch": {
|
|
378
397
|
const inner = intro.unwrapInner(schema);
|
|
@@ -446,6 +465,8 @@ function fixNode(schema, value, ctx, lazyDepth) {
|
|
|
446
465
|
return inner === void 0 ? value : fixNode(inner, value, ctx, lazyDepth);
|
|
447
466
|
}
|
|
448
467
|
case "default":
|
|
468
|
+
case "nonoptional":
|
|
469
|
+
case "success":
|
|
449
470
|
case "readonly":
|
|
450
471
|
case "catch": {
|
|
451
472
|
const inner = intro.unwrapInner(schema);
|
|
@@ -611,7 +632,7 @@ function hasDeclaredDefaultInChain(schema, intro) {
|
|
|
611
632
|
}
|
|
612
633
|
return false;
|
|
613
634
|
}
|
|
614
|
-
function deriveDefaultWalk(schema, useDefault, intro, maxDepth,
|
|
635
|
+
function deriveDefaultWalk(schema, useDefault, intro, maxDepth, lazyDepth = 0) {
|
|
615
636
|
if (useDefault) {
|
|
616
637
|
const peeled = peelEmbeddedDefault(schema, intro);
|
|
617
638
|
if (peeled !== NO_EMBEDDED_DEFAULT) return peeled;
|
|
@@ -623,11 +644,7 @@ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, ctx, lazyDepth =
|
|
|
623
644
|
const shape = intro.getObjectShape(schema);
|
|
624
645
|
const out = {};
|
|
625
646
|
for (const [key, subSchema] of Object.entries(shape)) {
|
|
626
|
-
safeAssign(
|
|
627
|
-
out,
|
|
628
|
-
key,
|
|
629
|
-
deriveDefaultWalk(subSchema, useDefault, intro, maxDepth, ctx, lazyDepth)
|
|
630
|
-
);
|
|
647
|
+
safeAssign(out, key, deriveDefaultWalk(subSchema, useDefault, intro, maxDepth, lazyDepth));
|
|
631
648
|
}
|
|
632
649
|
return out;
|
|
633
650
|
}
|
|
@@ -639,19 +656,17 @@ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, ctx, lazyDepth =
|
|
|
639
656
|
return {};
|
|
640
657
|
case "tuple": {
|
|
641
658
|
const items = intro.getTupleItems(schema);
|
|
642
|
-
return items.map(
|
|
643
|
-
(item) => deriveDefaultWalk(item, useDefault, intro, maxDepth, ctx, lazyDepth)
|
|
644
|
-
);
|
|
659
|
+
return items.map((item) => deriveDefaultWalk(item, useDefault, intro, maxDepth, lazyDepth));
|
|
645
660
|
}
|
|
646
661
|
case "union": {
|
|
647
662
|
const options = intro.getUnionOptions(schema);
|
|
648
663
|
const first = options[0];
|
|
649
|
-
return first === void 0 ? void 0 : deriveDefaultWalk(first, useDefault, intro, maxDepth,
|
|
664
|
+
return first === void 0 ? void 0 : deriveDefaultWalk(first, useDefault, intro, maxDepth, lazyDepth);
|
|
650
665
|
}
|
|
651
666
|
case "discriminated-union": {
|
|
652
667
|
const options = intro.getDiscriminatedOptions(schema);
|
|
653
668
|
const first = options[0];
|
|
654
|
-
return first === void 0 ? void 0 : deriveDefaultWalk(first, useDefault, intro, maxDepth,
|
|
669
|
+
return first === void 0 ? void 0 : deriveDefaultWalk(first, useDefault, intro, maxDepth, lazyDepth);
|
|
655
670
|
}
|
|
656
671
|
case "optional":
|
|
657
672
|
return void 0;
|
|
@@ -660,39 +675,41 @@ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, ctx, lazyDepth =
|
|
|
660
675
|
case "default": {
|
|
661
676
|
if (useDefault) return intro.getDefaultValue(schema);
|
|
662
677
|
const inner = intro.unwrapInner(schema);
|
|
663
|
-
return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth,
|
|
678
|
+
return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth);
|
|
664
679
|
}
|
|
680
|
+
case "nonoptional":
|
|
681
|
+
case "success":
|
|
665
682
|
case "readonly":
|
|
666
683
|
case "branded": {
|
|
667
684
|
const inner = kind === "branded" ? intro.unwrapBranded(schema) : intro.unwrapInner(schema);
|
|
668
|
-
return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth,
|
|
685
|
+
return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth);
|
|
669
686
|
}
|
|
670
687
|
case "effects": {
|
|
671
688
|
const inner = intro.unwrapEffectsSource(schema);
|
|
672
689
|
if (intro.isPreprocessNode(schema)) {
|
|
673
690
|
if (inner !== void 0 && hasDeclaredDefaultInChain(inner, intro)) {
|
|
674
|
-
return deriveDefaultWalk(inner, useDefault, intro, maxDepth,
|
|
691
|
+
return deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth);
|
|
675
692
|
}
|
|
676
693
|
return void 0;
|
|
677
694
|
}
|
|
678
|
-
return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth,
|
|
695
|
+
return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth);
|
|
679
696
|
}
|
|
680
697
|
case "pipeline": {
|
|
681
698
|
const inner = intro.unwrapPipeIn(schema);
|
|
682
|
-
return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth,
|
|
699
|
+
return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth);
|
|
683
700
|
}
|
|
684
701
|
case "pipe": {
|
|
685
702
|
const inn = intro.unwrapPipeIn(schema);
|
|
686
703
|
if (inn !== void 0 && intro.kindOf(inn) === "transform") {
|
|
687
704
|
const out2 = intro.unwrapPipeOut(schema);
|
|
688
705
|
if (out2 !== void 0 && hasDeclaredDefaultInChain(out2, intro)) {
|
|
689
|
-
return deriveDefaultWalk(out2, useDefault, intro, maxDepth,
|
|
706
|
+
return deriveDefaultWalk(out2, useDefault, intro, maxDepth, lazyDepth);
|
|
690
707
|
}
|
|
691
708
|
return void 0;
|
|
692
709
|
}
|
|
693
710
|
const out = intro.unwrapPipeOut(schema);
|
|
694
711
|
const real = inn !== void 0 && intro.kindOf(inn) !== "transform" ? inn : out !== void 0 && intro.kindOf(out) !== "transform" ? out : inn ?? out;
|
|
695
|
-
return real === void 0 ? void 0 : deriveDefaultWalk(real, useDefault, intro, maxDepth,
|
|
712
|
+
return real === void 0 ? void 0 : deriveDefaultWalk(real, useDefault, intro, maxDepth, lazyDepth);
|
|
696
713
|
}
|
|
697
714
|
case "string":
|
|
698
715
|
return "";
|
|
@@ -736,19 +753,19 @@ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, ctx, lazyDepth =
|
|
|
736
753
|
} catch {
|
|
737
754
|
return void 0;
|
|
738
755
|
}
|
|
739
|
-
return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth,
|
|
756
|
+
return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth + 1);
|
|
740
757
|
}
|
|
741
758
|
case "intersection": {
|
|
742
759
|
const left = intro.getIntersectionLeft(schema);
|
|
743
760
|
const right = intro.getIntersectionRight(schema);
|
|
744
|
-
const l = left === void 0 ? void 0 : deriveDefaultWalk(left, useDefault, intro, maxDepth,
|
|
745
|
-
const r = right === void 0 ? void 0 : deriveDefaultWalk(right, useDefault, intro, maxDepth,
|
|
761
|
+
const l = left === void 0 ? void 0 : deriveDefaultWalk(left, useDefault, intro, maxDepth, lazyDepth);
|
|
762
|
+
const r = right === void 0 ? void 0 : deriveDefaultWalk(right, useDefault, intro, maxDepth, lazyDepth);
|
|
746
763
|
return mergeDeep(l, r);
|
|
747
764
|
}
|
|
748
765
|
case "catch": {
|
|
749
766
|
if (useDefault) return intro.getCatchDefault(schema);
|
|
750
767
|
const inner = intro.unwrapInner(schema);
|
|
751
|
-
return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth,
|
|
768
|
+
return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth);
|
|
752
769
|
}
|
|
753
770
|
case "file":
|
|
754
771
|
return null;
|
|
@@ -767,10 +784,15 @@ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, ctx, lazyDepth =
|
|
|
767
784
|
case "transform":
|
|
768
785
|
return void 0;
|
|
769
786
|
default:
|
|
770
|
-
return
|
|
787
|
+
return void 0;
|
|
771
788
|
}
|
|
772
789
|
}
|
|
773
790
|
|
|
791
|
+
function crossCopyState(key, create) {
|
|
792
|
+
const carrier = globalThis;
|
|
793
|
+
return carrier[key] ?? (carrier[key] = create());
|
|
794
|
+
}
|
|
795
|
+
|
|
774
796
|
const state = crossCopyState(/* @__PURE__ */ Symbol.for("attaform:field-meta-state"), () => ({
|
|
775
797
|
store: /* @__PURE__ */ new WeakMap(),
|
|
776
798
|
lists: /* @__PURE__ */ new WeakMap(),
|
|
@@ -929,10 +951,20 @@ function slimPrimitivesWalk(schema, intro, maxDepth, lazyDepth = 0) {
|
|
|
929
951
|
}
|
|
930
952
|
case "default":
|
|
931
953
|
case "readonly":
|
|
954
|
+
case "success":
|
|
932
955
|
case "catch": {
|
|
933
956
|
const inner = intro.unwrapInner(schema);
|
|
934
957
|
return inner === void 0 ? PERMISSIVE_SLIM_KINDS : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth);
|
|
935
958
|
}
|
|
959
|
+
case "nonoptional": {
|
|
960
|
+
const inner = intro.unwrapInner(schema);
|
|
961
|
+
if (inner === void 0) return PERMISSIVE_SLIM_KINDS;
|
|
962
|
+
const innerSet = slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth);
|
|
963
|
+
if (!innerSet.has("undefined")) return innerSet;
|
|
964
|
+
const out = new Set(innerSet);
|
|
965
|
+
out.delete("undefined");
|
|
966
|
+
return out;
|
|
967
|
+
}
|
|
936
968
|
case "branded": {
|
|
937
969
|
const inner = intro.unwrapBranded(schema);
|
|
938
970
|
return inner === void 0 ? PERMISSIVE_SLIM_KINDS : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth);
|
|
@@ -1167,4 +1199,4 @@ function walkForMeta(schema, path, map, counters, lastPathPerSchema, inProgress,
|
|
|
1167
1199
|
}
|
|
1168
1200
|
}
|
|
1169
1201
|
|
|
1170
|
-
export {
|
|
1202
|
+
export { createSharedSchemaStore as a, buildFieldMetaPathMap as b, createAbstractSchema as c, deriveDefaultWalk as d, getFieldMetaListForSchema as e, fixStructuralDefaults as f, getFieldMetaForSchema as g, installingFieldMetaStore as i, mergeDeep as m, slimPrimitivesWalk as s, walkPathSegments as w };
|
|
@@ -40,12 +40,6 @@ function normalizeErrorInputs(input, scope, defaultCode) {
|
|
|
40
40
|
const items = Array.isArray(input) ? input : [input];
|
|
41
41
|
return items.map((item) => normalizeErrorInput(item, scope, defaultCode));
|
|
42
42
|
}
|
|
43
|
-
function* cellEntriesFor(cells, side) {
|
|
44
|
-
for (const [key, cell] of cells) {
|
|
45
|
-
const list = cell[side];
|
|
46
|
-
if (list.length > 0) yield [key, list];
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
43
|
class RegistryNotInstalledError extends AttaformError {
|
|
50
44
|
constructor() {
|
|
51
45
|
super(
|
|
@@ -175,18 +169,6 @@ function pathKeyToDotted(key) {
|
|
|
175
169
|
if (segments === null) return null;
|
|
176
170
|
return segmentsToDotted(segments);
|
|
177
171
|
}
|
|
178
|
-
function coerceToPathKey(input) {
|
|
179
|
-
if (input.length > 0 && input.charCodeAt(0) === 91) {
|
|
180
|
-
try {
|
|
181
|
-
const parsed = JSON.parse(input);
|
|
182
|
-
if (Array.isArray(parsed) && parsed.every((s) => typeof s === "string" || typeof s === "number")) {
|
|
183
|
-
return input;
|
|
184
|
-
}
|
|
185
|
-
} catch {
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
return canonicalizePath(input).key;
|
|
189
|
-
}
|
|
190
172
|
const ROOT_PATH = Object.freeze([]);
|
|
191
173
|
const ROOT_PATH_KEY = "[]";
|
|
192
174
|
function isPathPrefix(prefix, path) {
|
|
@@ -204,4 +186,4 @@ function pathsEqual(a, b) {
|
|
|
204
186
|
return true;
|
|
205
187
|
}
|
|
206
188
|
|
|
207
|
-
export { AttaformError as A, InvalidPathError as I, OutsideSetupError as O, ROOT_PATH as R, SubmitErrorHandlerError as S, InvalidUseFormConfigError as a, ROOT_PATH_KEY as b, RegistryNotInstalledError as c, ReservedFormKeyError as d, canonicalizePath as e, pathsEqual as f, pathKeyToDotted as g, SET_MEMBER_SEGMENT as h, isPathPrefix as i,
|
|
189
|
+
export { AttaformError as A, InvalidPathError as I, OutsideSetupError as O, ROOT_PATH as R, SubmitErrorHandlerError as S, InvalidUseFormConfigError as a, ROOT_PATH_KEY as b, RegistryNotInstalledError as c, ReservedFormKeyError as d, canonicalizePath as e, pathsEqual as f, pathKeyToDotted as g, SET_MEMBER_SEGMENT as h, isPathPrefix as i, groupErrorsByKey as j, keyForSegments as k, normalizeErrorInputs as l, mapSegmentKeys as m, normalizeErrorInput as n, parseDottedPath as p, segmentsForPathKey as s, toError as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { App } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { ao as RegisterModelDynamicCustomDirective } from './attaform.bKLzMU0o.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The `v-register` directive. Bind a form field to a native input,
|