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,6 +1,6 @@
|
|
|
1
1
|
import { reactive, markRaw, effectScope, watch, nextTick } from 'vue';
|
|
2
2
|
import { i as isRegisterValue, a as isTransforming, S as SSR_COMPONENT_HOST_MODIFIER, R as REGISTER_OWNER_MARKER, b as V_REGISTER_MARKER } from './attaform.KvlEedlF.mjs';
|
|
3
|
-
import { e as canonicalizePath } from './attaform.
|
|
3
|
+
import { e as canonicalizePath } from './attaform.CdZIEf7_.mjs';
|
|
4
4
|
|
|
5
5
|
const INTERACTIVE_TAG_NAMES = /* @__PURE__ */ new Set(["INPUT", "SELECT", "TEXTAREA"]);
|
|
6
6
|
|
|
@@ -271,7 +271,7 @@ function isCheckboxInput(tagName, type) {
|
|
|
271
271
|
return tagName === "INPUT" && typeof type === "string" && type.toLowerCase() === "checkbox";
|
|
272
272
|
}
|
|
273
273
|
function applyAria(el, rv, vnode) {
|
|
274
|
-
if (rv.
|
|
274
|
+
if (rv.ariaDisplayState === void 0) return;
|
|
275
275
|
if (!INTERACTIVE_TAG_NAMES.has(el.tagName)) return;
|
|
276
276
|
const locks = el[ariaLockKey] ?? EMPTY_ARIA_LOCKS;
|
|
277
277
|
const ds = rv.ariaDisplayState.value;
|
|
@@ -286,7 +286,7 @@ function applyAria(el, rv, vnode) {
|
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
function setupAria(el, rv, vnode) {
|
|
289
|
-
if (rv.
|
|
289
|
+
if (rv.ariaDisplayState === void 0) return;
|
|
290
290
|
if (!INTERACTIVE_TAG_NAMES.has(el.tagName)) return;
|
|
291
291
|
mergeAriaLocks(el, vnode);
|
|
292
292
|
applyAria(el, rv, vnode);
|
|
@@ -308,7 +308,7 @@ function seedLocksFromDom(el) {
|
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
function setupAriaLive(el, rv) {
|
|
311
|
-
if (rv.
|
|
311
|
+
if (rv.ariaDisplayState === void 0) return;
|
|
312
312
|
if (!INTERACTIVE_TAG_NAMES.has(el.tagName)) return;
|
|
313
313
|
seedLocksFromDom(el);
|
|
314
314
|
applyAria(el, rv, null);
|
|
@@ -320,7 +320,7 @@ function setupAriaLive(el, rv) {
|
|
|
320
320
|
el[ariaScopeKey] = () => scope.stop();
|
|
321
321
|
}
|
|
322
322
|
function getSSRAriaProps(rv, vnode) {
|
|
323
|
-
if (rv.
|
|
323
|
+
if (rv.ariaDisplayState === void 0) return void 0;
|
|
324
324
|
const props = vnode?.props ?? null;
|
|
325
325
|
const ds = rv.ariaDisplayState.value;
|
|
326
326
|
const tagName = typeof vnode?.type === "string" ? vnode.type.toUpperCase() : "";
|
|
@@ -1264,7 +1264,7 @@ const vRegisterDynamic = {
|
|
|
1264
1264
|
callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
|
|
1265
1265
|
const ariaEl = el;
|
|
1266
1266
|
const value = binding.value;
|
|
1267
|
-
if (!isRegisterValue(value) || value.
|
|
1267
|
+
if (!isRegisterValue(value) || value.ariaDisplayState === void 0) {
|
|
1268
1268
|
teardownAria(ariaEl);
|
|
1269
1269
|
} else {
|
|
1270
1270
|
const old = binding.oldValue;
|
|
@@ -1309,8 +1309,8 @@ const vRegisterDynamic = {
|
|
|
1309
1309
|
// The lifecycle hooks above don't run on the server (Vue skips
|
|
1310
1310
|
// directive lifecycle during SSR), so emit the same aria attributes
|
|
1311
1311
|
// here from the SSR-time gated display state. Honors authored attrs
|
|
1312
|
-
// (vnode-level lockout)
|
|
1313
|
-
//
|
|
1312
|
+
// (vnode-level lockout), touches no DOM, and shares
|
|
1313
|
+
// `resolveAriaValue` with the client path. Ids are SSR-stable
|
|
1314
1314
|
// (formInstanceId derives from Vue's useId), so a server-rendered
|
|
1315
1315
|
// describedby matches the client after hydration.
|
|
1316
1316
|
getSSRProps(binding, vnode) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as mapSegmentKeys, f as pathsEqual, i as isPathPrefix } from './attaform.
|
|
1
|
+
import { m as mapSegmentKeys, f as pathsEqual, i as isPathPrefix } from './attaform.CdZIEf7_.mjs';
|
|
2
2
|
|
|
3
3
|
const DEFAULT_FIELD_VALIDATION_DEBOUNCE_MS = 0;
|
|
4
4
|
const DEFAULT_HISTORY_MAX_SNAPSHOTS = 128;
|
|
@@ -7,9 +7,8 @@ const ANONYMOUS_FORM_KEY_PREFIX = `${RESERVED_KEY_PREFIX}anon:`;
|
|
|
7
7
|
const ANONYMOUS_WIZARD_KEY_PREFIX = `${RESERVED_KEY_PREFIX}anon-wizard:`;
|
|
8
8
|
const DEFAULT_MAX_RECURSION_DEPTH = 64;
|
|
9
9
|
function normalizeNumericOption(config) {
|
|
10
|
-
const { value, source,
|
|
11
|
-
if (
|
|
12
|
-
if (typeof value !== "number" || Number.isNaN(value) || value === Infinity || value === -Infinity) {
|
|
10
|
+
const { value, source, min, defaultValue } = config;
|
|
11
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
13
12
|
return defaultValue;
|
|
14
13
|
}
|
|
15
14
|
return Math.max(min, Math.floor(value));
|
|
@@ -77,8 +76,9 @@ function safeAssign(target, key, value) {
|
|
|
77
76
|
}
|
|
78
77
|
target[key] = value;
|
|
79
78
|
}
|
|
79
|
+
const SHADOWED_KEYS = new Set(Object.getOwnPropertyNames(Object.prototype));
|
|
80
80
|
function isShadowedKey(key) {
|
|
81
|
-
return key
|
|
81
|
+
return SHADOWED_KEYS.has(key);
|
|
82
82
|
}
|
|
83
83
|
function safeOwnRead(target, key) {
|
|
84
84
|
if (isShadowedKey(key)) {
|
|
@@ -355,4 +355,4 @@ function structuralSnapshot(value) {
|
|
|
355
355
|
return out;
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
-
export { ANONYMOUS_FORM_KEY_PREFIX as A, DEFAULT_HISTORY_MAX_SNAPSHOTS as D, RESERVED_KEY_PREFIX as R, safeOwnRead as a, safeAssign as b, callConsumerSchemaFn as c,
|
|
358
|
+
export { ANONYMOUS_FORM_KEY_PREFIX as A, DEFAULT_HISTORY_MAX_SNAPSHOTS as D, RESERVED_KEY_PREFIX as R, safeOwnRead as a, safeAssign as b, callConsumerSchemaFn as c, safeOwnHas as d, consumerHas as e, spreadConsumerRecord as f, copyConsumerArray as g, consumerKeys as h, isShadowedKey as i, readConsumerProp as j, diffAndApply as k, DEFAULT_FIELD_VALIDATION_DEBOUNCE_MS as l, consumerSymbolKeys as m, normalizeNumericOption as n, applyChangedKeys as o, pickDefined as p, DEFAULT_MAX_RECURSION_DEPTH as q, readConsumerIndex as r, structuralSnapshot as s, ANONYMOUS_WIZARD_KEY_PREFIX as t };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform.
|
|
3
|
-
import { s as slimPrimitivesWalk, d as deriveDefaultWalk, m as mergeDeep, f as fixStructuralDefaults, w as walkPathSegments, c as createAbstractSchema, b as buildFieldMetaPathMap,
|
|
4
|
-
import { c as callConsumerSchemaFn } from './attaform.
|
|
5
|
-
import { z } from 'zod';
|
|
1
|
+
import { j as humanize, c as useAbstractForm } from './attaform.DNJOWjQw.mjs';
|
|
2
|
+
import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform.CdZIEf7_.mjs';
|
|
3
|
+
import { s as slimPrimitivesWalk, d as deriveDefaultWalk, m as mergeDeep, f as fixStructuralDefaults, w as walkPathSegments, c as createAbstractSchema, a as createSharedSchemaStore, b as buildFieldMetaPathMap, e as getFieldMetaListForSchema, g as getFieldMetaForSchema } from './attaform.CUfrMK7t.mjs';
|
|
4
|
+
import { c as callConsumerSchemaFn } from './attaform.BRDDQeHV.mjs';
|
|
6
5
|
|
|
7
6
|
function readDef(schema) {
|
|
8
7
|
if (schema === null || typeof schema !== "object") return void 0;
|
|
@@ -49,7 +48,9 @@ const IDENTITY_KINDS = /* @__PURE__ */ new Set([
|
|
|
49
48
|
"file",
|
|
50
49
|
"map",
|
|
51
50
|
"symbol",
|
|
52
|
-
"function"
|
|
51
|
+
"function",
|
|
52
|
+
"nonoptional",
|
|
53
|
+
"success"
|
|
53
54
|
]);
|
|
54
55
|
function kindOf(schema) {
|
|
55
56
|
const def = readDef(schema);
|
|
@@ -132,10 +133,6 @@ function unwrapLazy(schema) {
|
|
|
132
133
|
if (typeof getter !== "function") return void 0;
|
|
133
134
|
return callConsumerSchemaFn(() => getter(), void 0);
|
|
134
135
|
}
|
|
135
|
-
function getLazyGetter(schema) {
|
|
136
|
-
const def = readDef(schema);
|
|
137
|
-
return typeof def?.getter === "function" ? def.getter : void 0;
|
|
138
|
-
}
|
|
139
136
|
function getIntersectionLeft(schema) {
|
|
140
137
|
const def = readDef(schema);
|
|
141
138
|
return def?.left;
|
|
@@ -169,11 +166,6 @@ function unwrapEffectsSource(_schema) {
|
|
|
169
166
|
function unwrapBranded(_schema) {
|
|
170
167
|
return void 0;
|
|
171
168
|
}
|
|
172
|
-
function hasChecks(schema) {
|
|
173
|
-
const def = readDef(schema);
|
|
174
|
-
const checks = def?.checks;
|
|
175
|
-
return Array.isArray(checks) && checks.length > 0;
|
|
176
|
-
}
|
|
177
169
|
function getChecks(schema) {
|
|
178
170
|
const def = readDef(schema);
|
|
179
171
|
const checks = def?.checks;
|
|
@@ -372,7 +364,6 @@ const V4_INTROSPECTOR = {
|
|
|
372
364
|
return getArrayElement(schema);
|
|
373
365
|
},
|
|
374
366
|
getSetValueType: (schema) => kindOf(schema) === "set" ? getSetValueType(schema) : void 0,
|
|
375
|
-
getRecordKeyType: (schema) => kindOf(schema) === "record" ? getRecordKeyType(schema) : void 0,
|
|
376
367
|
getRecordValueType: (schema) => kindOf(schema) === "record" ? getRecordValueType(schema) : void 0,
|
|
377
368
|
getMapKeyType: (schema) => kindOf(schema) === "map" ? getMapKeyType(schema) : void 0,
|
|
378
369
|
getMapValueType: (schema) => kindOf(schema) === "map" ? getMapValueType(schema) : void 0,
|
|
@@ -387,7 +378,6 @@ const V4_INTROSPECTOR = {
|
|
|
387
378
|
unwrapPipeIn,
|
|
388
379
|
unwrapPipeOut,
|
|
389
380
|
unwrapLazy,
|
|
390
|
-
getLazyGetter,
|
|
391
381
|
getDefaultValue,
|
|
392
382
|
getCatchDefault,
|
|
393
383
|
hasCatchValue
|
|
@@ -398,15 +388,12 @@ function slimPrimitivesOf(schema, maxRecursionDepth) {
|
|
|
398
388
|
}
|
|
399
389
|
|
|
400
390
|
function deriveDefault(schema, useDefault, maxRecursionDepth) {
|
|
401
|
-
return deriveDefaultWalk(schema, useDefault, V4_INTROSPECTOR, maxRecursionDepth
|
|
402
|
-
// v4 has an exhaustive switch against `SchemaIntrospector.kindOf`;
|
|
403
|
-
// unknown kinds genuinely shouldn't appear, so return undefined.
|
|
404
|
-
unsupportedKindFallback: () => void 0
|
|
405
|
-
});
|
|
391
|
+
return deriveDefaultWalk(schema, useDefault, V4_INTROSPECTOR, maxRecursionDepth);
|
|
406
392
|
}
|
|
407
393
|
function getDefaultValuesFromZodSchema(opts) {
|
|
408
394
|
const { schema, useDefaultSchemaValues, constraints, maxRecursionDepth } = opts;
|
|
409
395
|
const initial = deriveDefault(schema, useDefaultSchemaValues, maxRecursionDepth);
|
|
396
|
+
if (constraints === void 0) return { data: initial, success: true };
|
|
410
397
|
const merged = mergeDeep(initial, constraints);
|
|
411
398
|
return fixStructuralDefaults(
|
|
412
399
|
schema,
|
|
@@ -438,137 +425,6 @@ function getNestedZodSchemasAtPath(schema, path, maxRecursionDepth) {
|
|
|
438
425
|
);
|
|
439
426
|
}
|
|
440
427
|
|
|
441
|
-
function carrySyncChecks(rebuilt, original) {
|
|
442
|
-
if (!hasChecks(original)) return rebuilt;
|
|
443
|
-
const checks = getChecks(original).filter((c) => !isAsyncCheck(c));
|
|
444
|
-
if (checks.length === 0) return rebuilt;
|
|
445
|
-
return rebuilt.check(
|
|
446
|
-
...checks
|
|
447
|
-
);
|
|
448
|
-
}
|
|
449
|
-
function stripAsyncChecks(schema) {
|
|
450
|
-
const seen = /* @__PURE__ */ new WeakSet();
|
|
451
|
-
function recurse(s) {
|
|
452
|
-
if (seen.has(s)) return s;
|
|
453
|
-
seen.add(s);
|
|
454
|
-
const kind = kindOf(s);
|
|
455
|
-
switch (kind) {
|
|
456
|
-
case "string":
|
|
457
|
-
return hasChecks(s) ? carrySyncChecks(z.string(), s) : s;
|
|
458
|
-
case "number":
|
|
459
|
-
return hasChecks(s) ? carrySyncChecks(z.number(), s) : s;
|
|
460
|
-
case "bigint":
|
|
461
|
-
return hasChecks(s) ? carrySyncChecks(z.bigint(), s) : s;
|
|
462
|
-
case "array": {
|
|
463
|
-
const element = getArrayElement(s);
|
|
464
|
-
return carrySyncChecks(z.array(recurse(element)), s);
|
|
465
|
-
}
|
|
466
|
-
case "set": {
|
|
467
|
-
return carrySyncChecks(z.set(recurse(getSetValueType(s))), s);
|
|
468
|
-
}
|
|
469
|
-
case "tuple": {
|
|
470
|
-
const items = getTupleItems(s).map(recurse);
|
|
471
|
-
const rebuilt = z.tuple(
|
|
472
|
-
items
|
|
473
|
-
);
|
|
474
|
-
return carrySyncChecks(rebuilt, s);
|
|
475
|
-
}
|
|
476
|
-
case "object": {
|
|
477
|
-
const shape = getObjectShape(s);
|
|
478
|
-
const next = {};
|
|
479
|
-
for (const [k, v] of Object.entries(shape)) {
|
|
480
|
-
next[k] = recurse(v);
|
|
481
|
-
}
|
|
482
|
-
return carrySyncChecks(z.object(next), s);
|
|
483
|
-
}
|
|
484
|
-
case "record": {
|
|
485
|
-
const keyType = getRecordKeyType(s);
|
|
486
|
-
const valueType = recurse(getRecordValueType(s));
|
|
487
|
-
return carrySyncChecks(
|
|
488
|
-
z.record(keyType, valueType),
|
|
489
|
-
s
|
|
490
|
-
);
|
|
491
|
-
}
|
|
492
|
-
case "union": {
|
|
493
|
-
const options = getUnionOptions(s).map(recurse);
|
|
494
|
-
return carrySyncChecks(
|
|
495
|
-
z.union(options),
|
|
496
|
-
s
|
|
497
|
-
);
|
|
498
|
-
}
|
|
499
|
-
case "discriminated-union": {
|
|
500
|
-
const options = getDiscriminatedOptions(s).map((opt) => recurse(opt));
|
|
501
|
-
const discriminator = getDiscriminator(s);
|
|
502
|
-
if (discriminator === void 0) return s;
|
|
503
|
-
return z.discriminatedUnion(
|
|
504
|
-
discriminator,
|
|
505
|
-
options
|
|
506
|
-
);
|
|
507
|
-
}
|
|
508
|
-
case "optional": {
|
|
509
|
-
const inner = unwrapInner(s);
|
|
510
|
-
return inner === void 0 ? s : recurse(inner).optional();
|
|
511
|
-
}
|
|
512
|
-
case "nullable": {
|
|
513
|
-
const inner = unwrapInner(s);
|
|
514
|
-
return inner === void 0 ? s : recurse(inner).nullable();
|
|
515
|
-
}
|
|
516
|
-
case "default": {
|
|
517
|
-
const inner = unwrapInner(s);
|
|
518
|
-
if (inner === void 0) return s;
|
|
519
|
-
return recurse(inner).default(getDefaultValue(s));
|
|
520
|
-
}
|
|
521
|
-
case "readonly": {
|
|
522
|
-
const inner = unwrapInner(s);
|
|
523
|
-
return inner === void 0 ? s : recurse(inner).readonly();
|
|
524
|
-
}
|
|
525
|
-
case "lazy": {
|
|
526
|
-
const inner = unwrapLazy(s);
|
|
527
|
-
if (inner === void 0) return s;
|
|
528
|
-
const stripped = recurse(inner);
|
|
529
|
-
return z.lazy(() => stripped);
|
|
530
|
-
}
|
|
531
|
-
case "intersection": {
|
|
532
|
-
const left = getIntersectionLeft(s);
|
|
533
|
-
const right = getIntersectionRight(s);
|
|
534
|
-
if (left === void 0 || right === void 0) return s;
|
|
535
|
-
return z.intersection(recurse(left), recurse(right));
|
|
536
|
-
}
|
|
537
|
-
case "catch": {
|
|
538
|
-
const inner = unwrapInner(s);
|
|
539
|
-
if (inner === void 0) return s;
|
|
540
|
-
return recurse(inner).catch(getCatchDefault(s));
|
|
541
|
-
}
|
|
542
|
-
// Pipes pass through (see the docblock); the rest are leaves
|
|
543
|
-
// whose checks the strip walker deliberately leaves in place —
|
|
544
|
-
// an async check on one of these still poisons the sync parse
|
|
545
|
-
// and the callers' defensive catch owns that case.
|
|
546
|
-
case "pipe":
|
|
547
|
-
case "boolean":
|
|
548
|
-
case "date":
|
|
549
|
-
case "enum":
|
|
550
|
-
case "literal":
|
|
551
|
-
case "null":
|
|
552
|
-
case "undefined":
|
|
553
|
-
case "any":
|
|
554
|
-
case "unknown":
|
|
555
|
-
case "nan":
|
|
556
|
-
case "void":
|
|
557
|
-
case "never":
|
|
558
|
-
case "promise":
|
|
559
|
-
case "custom":
|
|
560
|
-
case "template-literal":
|
|
561
|
-
case "transform":
|
|
562
|
-
case "file":
|
|
563
|
-
case "map":
|
|
564
|
-
case "symbol":
|
|
565
|
-
case "function":
|
|
566
|
-
return s;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
return recurse(schema);
|
|
570
|
-
}
|
|
571
|
-
|
|
572
428
|
function unwrapStructuralWrappers(schema) {
|
|
573
429
|
let current = schema;
|
|
574
430
|
for (let i = 0; i < 64; i++) {
|
|
@@ -662,21 +518,20 @@ function isLeafRequired(schema, depth = 0) {
|
|
|
662
518
|
function zodV4Adapter(rootSchema) {
|
|
663
519
|
assertZodVersion(rootSchema);
|
|
664
520
|
assertKeyedRoot(rootSchema);
|
|
665
|
-
return (
|
|
521
|
+
return (_formKey, options) => sharedV4Schemas(
|
|
666
522
|
rootSchema,
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
523
|
+
options.maxRecursionDepth,
|
|
524
|
+
() => createAbstractSchema(
|
|
525
|
+
rootSchema,
|
|
526
|
+
V4_INTROSPECTOR,
|
|
527
|
+
buildV4Services(),
|
|
528
|
+
options
|
|
529
|
+
)
|
|
671
530
|
);
|
|
672
531
|
}
|
|
673
|
-
|
|
674
|
-
const { fingerprintZodSchema } = await import('../chunks/fingerprint2.mjs');
|
|
675
|
-
return fingerprintZodSchema(schema);
|
|
676
|
-
}
|
|
532
|
+
const sharedV4Schemas = createSharedSchemaStore();
|
|
677
533
|
function buildV4Services() {
|
|
678
534
|
return {
|
|
679
|
-
fingerprint: (schema) => lazyFingerprint(schema),
|
|
680
535
|
getNestedSchemasAtPath: (schema, path, maxRecursionDepth) => getNestedZodSchemasAtPath(schema, path, maxRecursionDepth),
|
|
681
536
|
// v4 doesn't pre-strip for the slim-mode walk — its path walker
|
|
682
537
|
// already peels every transparent wrapper inline, so the slim and
|
|
@@ -684,7 +539,7 @@ function buildV4Services() {
|
|
|
684
539
|
getNestedSchemasInSlimMode: (schema, path, maxRecursionDepth) => getNestedZodSchemasAtPath(schema, path, maxRecursionDepth),
|
|
685
540
|
slimPrimitivesOf: (schema, maxRecursionDepth) => slimPrimitivesOf(schema, maxRecursionDepth),
|
|
686
541
|
deriveDefault: (schema, useDefault, maxRecursionDepth) => deriveDefault(schema, useDefault, maxRecursionDepth),
|
|
687
|
-
|
|
542
|
+
runGetDefaults: (schema, config, maxRecursionDepth) => runGetDefaultsV4(schema, config, maxRecursionDepth),
|
|
688
543
|
unwrapStructuralWrappers: (schema) => unwrapStructuralWrappers(schema),
|
|
689
544
|
unwrapToDiscriminatedUnion: (schema) => unwrapToDiscriminatedUnion(schema),
|
|
690
545
|
peelAllWrappers: (schema) => peelAllWrappers(schema),
|
|
@@ -699,47 +554,40 @@ function buildV4Services() {
|
|
|
699
554
|
const result = await schema.safeParseAsync(data);
|
|
700
555
|
return result.success ? { success: true, data: result.data } : { success: false, issues: result.error.issues };
|
|
701
556
|
},
|
|
702
|
-
makeSubSchema: (schema,
|
|
557
|
+
makeSubSchema: (schema, maxRecursionDepth) => buildSubSchemaStubV4(schema, maxRecursionDepth)
|
|
703
558
|
};
|
|
704
559
|
}
|
|
705
|
-
function
|
|
560
|
+
function runGetDefaultsV4(rootSchema, config, maxRecursionDepth) {
|
|
706
561
|
const { data } = getDefaultValuesFromZodSchema({
|
|
707
562
|
schema: rootSchema,
|
|
708
563
|
useDefaultSchemaValues: config.useDefaultSchemaValues,
|
|
709
564
|
constraints: config.constraints,
|
|
710
565
|
maxRecursionDepth
|
|
711
566
|
});
|
|
712
|
-
if (
|
|
713
|
-
return { data, errors: void 0, success: true
|
|
714
|
-
}
|
|
715
|
-
if (containsAsyncTransform(rootSchema)) {
|
|
716
|
-
return { data, errors: void 0, success: true, formKey };
|
|
567
|
+
if (containsAsyncTransform(rootSchema) || containsAsyncRefine(rootSchema)) {
|
|
568
|
+
return { data, errors: void 0, success: true };
|
|
717
569
|
}
|
|
718
|
-
const parseTarget = containsAsyncRefine(rootSchema) ? stripAsyncChecks(rootSchema) : rootSchema;
|
|
719
570
|
try {
|
|
720
|
-
const
|
|
721
|
-
if (
|
|
722
|
-
return { data, errors: void 0, success: true
|
|
571
|
+
const parseResult = rootSchema.safeParse(data);
|
|
572
|
+
if (parseResult.success) {
|
|
573
|
+
return { data, errors: void 0, success: true };
|
|
723
574
|
}
|
|
724
575
|
return {
|
|
725
576
|
data,
|
|
726
|
-
errors: zodIssuesToValidationErrors(
|
|
727
|
-
success: false
|
|
728
|
-
formKey
|
|
577
|
+
errors: zodIssuesToValidationErrors(parseResult.error.issues),
|
|
578
|
+
success: false
|
|
729
579
|
};
|
|
730
580
|
} catch {
|
|
731
|
-
return { data, errors: void 0, success: true
|
|
581
|
+
return { data, errors: void 0, success: true };
|
|
732
582
|
}
|
|
733
583
|
}
|
|
734
|
-
function buildSubSchemaStubV4(schema,
|
|
584
|
+
function buildSubSchemaStubV4(schema, maxRecursionDepth) {
|
|
735
585
|
return {
|
|
736
|
-
fingerprint: () => lazyFingerprint(schema),
|
|
737
586
|
needsAsyncValidation: () => containsAsyncRefine(schema),
|
|
738
587
|
getDefaultValues: () => ({
|
|
739
588
|
data: deriveDefault(schema, true, maxRecursionDepth),
|
|
740
589
|
errors: void 0,
|
|
741
|
-
success: true
|
|
742
|
-
formKey
|
|
590
|
+
success: true
|
|
743
591
|
}),
|
|
744
592
|
getSchemasAtPath: () => [],
|
|
745
593
|
validateAtPath: async (data) => {
|
|
@@ -748,15 +596,13 @@ function buildSubSchemaStubV4(schema, formKey, maxRecursionDepth) {
|
|
|
748
596
|
return {
|
|
749
597
|
data: result.data,
|
|
750
598
|
errors: void 0,
|
|
751
|
-
success: true
|
|
752
|
-
formKey
|
|
599
|
+
success: true
|
|
753
600
|
};
|
|
754
601
|
}
|
|
755
602
|
return {
|
|
756
603
|
data: void 0,
|
|
757
604
|
errors: zodIssuesToValidationErrors(result.error.issues),
|
|
758
|
-
success: false
|
|
759
|
-
formKey
|
|
605
|
+
success: false
|
|
760
606
|
};
|
|
761
607
|
}
|
|
762
608
|
};
|
|
@@ -808,4 +654,4 @@ function useForm(configuration) {
|
|
|
808
654
|
});
|
|
809
655
|
}
|
|
810
656
|
|
|
811
|
-
export { assertZodVersion as a,
|
|
657
|
+
export { assertZodVersion as a, kindOf as k, useForm as u, zodV4Adapter as z };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as InvalidUseFormConfigError } from './attaform.
|
|
2
|
-
import { u as useForm$2 } from './attaform.
|
|
3
|
-
import { u as useForm$1 } from './attaform.
|
|
4
|
-
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './attaform.
|
|
1
|
+
import { a as InvalidUseFormConfigError } from './attaform.CdZIEf7_.mjs';
|
|
2
|
+
import { u as useForm$2 } from './attaform.CJ8DpRGj.mjs';
|
|
3
|
+
import { u as useForm$1 } from './attaform.BXneBxEj.mjs';
|
|
4
|
+
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './attaform.CUfrMK7t.mjs';
|
|
5
5
|
|
|
6
6
|
function isZodV4SchemaShape(value) {
|
|
7
7
|
if (typeof value !== "object" || value === null) return false;
|