attaform 0.28.0 → 0.29.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/chunks/fingerprint.mjs +1 -1
- package/dist/chunks/fingerprint2.mjs +2 -2
- package/dist/dev/abstract.mjs +4 -4
- package/dist/dev/chunks/devtools.mjs +1 -1
- package/dist/dev/chunks/fingerprint.mjs +1 -1
- package/dist/dev/chunks/fingerprint2.mjs +2 -2
- package/dist/dev/directive.mjs +1 -1
- package/dist/dev/history.mjs +1 -1
- package/dist/dev/index.mjs +5 -5
- package/dist/dev/runtime/plugins/attaform.mjs +1 -1
- package/dist/dev/shared/{attaform-dev.Dr2YzS5B.mjs → attaform-dev.A-TpJW0B.mjs} +11 -1
- package/dist/dev/shared/{attaform-dev.oYrkP9dj.mjs → attaform-dev.BO-71R54.mjs} +51 -158
- package/dist/dev/shared/{attaform-dev.6qxD-Yqo.mjs → attaform-dev.BgM6FdtA.mjs} +143 -36
- package/dist/{shared/attaform.h0i6LijT.mjs → dev/shared/attaform-dev.ButTkwHd.mjs} +149 -16
- package/dist/{shared/attaform.BJGA_UOS.mjs → dev/shared/attaform-dev.BxfsuwBR.mjs} +8 -0
- package/dist/dev/shared/{attaform-dev.P7cseiEG.mjs → attaform-dev.D8aoKb89.mjs} +13 -4
- package/dist/dev/shared/{attaform-dev.BXE2cr0L.mjs → attaform-dev.DD5m2W51.mjs} +1 -1
- package/dist/dev/shared/{attaform-dev.WmuhD_CZ.mjs → attaform-dev.DHuydLAC.mjs} +344 -96
- package/dist/dev/shared/{attaform-dev.BR8u0YOZ.mjs → attaform-dev.DrzObAZo.mjs} +4 -4
- package/dist/dev/shared/{attaform-dev.D2I8e_Mm.mjs → attaform-dev.q6UutkCx.mjs} +170 -132
- 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 -1
- package/dist/index.d.mts +9 -7
- package/dist/index.mjs +5 -5
- package/dist/nuxt.d.mts +10 -10
- package/dist/runtime/plugins/attaform.mjs +1 -1
- package/dist/shared/{attaform.C09fpdLS.mjs → attaform.B0dKL8ST.mjs} +143 -36
- package/dist/shared/{attaform.Cs2Rbdlo.mjs → attaform.BK0cgu2K.mjs} +123 -139
- package/dist/shared/{attaform.D6DCnnQu.mjs → attaform.BndjUUYX.mjs} +4 -4
- package/dist/{dev/shared/attaform-dev.BJGA_UOS.mjs → shared/attaform.BxfsuwBR.mjs} +8 -0
- package/dist/shared/{attaform.NLmerepI.mjs → attaform.C2MVyuxC.mjs} +42 -151
- package/dist/shared/{attaform.B4VkS43-.d.mts → attaform.CIWLMY-R.d.mts} +1 -1
- package/dist/shared/{attaform.B8k8JrmK.mjs → attaform.CZMAYwSK.mjs} +338 -95
- package/dist/shared/{attaform.wfY8XFvm.mjs → attaform.CZYt_5N_.mjs} +11 -1
- package/dist/shared/{attaform.Cgu-hdSb.d.mts → attaform.CsoeRi3P.d.mts} +224 -32
- package/dist/{dev/shared/attaform-dev.By4PRjt0.mjs → shared/attaform.Cvao8bW5.mjs} +132 -22
- package/dist/shared/{attaform.Dq4vWxuG.mjs → attaform.D0x-qSXm.mjs} +1 -1
- package/dist/shared/{attaform.CJP3RkGa.mjs → attaform.D1fnTifF.mjs} +168 -132
- package/dist/shared/{attaform.D5V4tZWq.d.mts → attaform.DDtqHYv1.d.mts} +88 -7
- package/dist/shared/{attaform.uLbun31C.mjs → attaform.DffRL5pP.mjs} +12 -4
- package/dist/shared/{attaform.JfSWdEcb.d.mts → attaform.axHXVQO7.d.mts} +1 -1
- package/dist/transforms.d.mts +0 -22
- package/dist/transforms.mjs +1 -1
- package/dist/vite.d.mts +13 -4
- package/dist/vite.mjs +3 -2
- package/dist/zod-v3.d.mts +6 -4
- package/dist/zod-v3.mjs +6 -6
- package/dist/zod-v4.d.mts +14 -27
- package/dist/zod-v4.mjs +6 -6
- package/dist/zod.d.mts +4 -4
- package/dist/zod.mjs +5 -5
- package/package.json +17 -14
- package/skills/attaform/SKILL.md +5 -2
- package/skills/attaform/references/custom-components.md +7 -2
- package/skills/attaform/references/errors.md +8 -3
- package/skills/attaform/references/saving.md +77 -0
- package/skills/attaform/references/wizards.md +10 -8
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as InvalidUseFormConfigError } from './attaform-dev.
|
|
2
|
-
import { u as useForm$2 } from './attaform-dev.
|
|
3
|
-
import { u as useForm$1 } from './attaform-dev.
|
|
4
|
-
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './attaform-dev.
|
|
1
|
+
import { a as InvalidUseFormConfigError } from './attaform-dev.A-TpJW0B.mjs';
|
|
2
|
+
import { u as useForm$2 } from './attaform-dev.q6UutkCx.mjs';
|
|
3
|
+
import { u as useForm$1 } from './attaform-dev.BO-71R54.mjs';
|
|
4
|
+
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './attaform-dev.BgM6FdtA.mjs';
|
|
5
5
|
|
|
6
6
|
function isZodV4SchemaShape(value) {
|
|
7
7
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
class UnsupportedSchemaError extends AttaformError {
|
|
6
|
-
}
|
|
1
|
+
import { w as walkPathSegments, s as slimPrimitivesWalk, c as createAbstractSchema, b as buildFieldMetaPathMap, g as getFieldMetaForSchema, m as mergeDeep, f as fixStructuralDefaults, d as deriveDefaultWalk, a as getFieldMetaListForSchema } from './attaform-dev.BgM6FdtA.mjs';
|
|
2
|
+
import { p as getAtPath, q as humanize, h as useAbstractForm } from './attaform-dev.DHuydLAC.mjs';
|
|
3
|
+
import { c as callConsumerSchemaFn } from './attaform-dev.ButTkwHd.mjs';
|
|
4
|
+
import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform-dev.A-TpJW0B.mjs';
|
|
7
5
|
|
|
8
6
|
function isZodSchemaType(schema, expectedType) {
|
|
9
7
|
if (typeof schema !== "object" || schema === null) return false;
|
|
@@ -123,6 +121,8 @@ function getRecordValueType(schema) {
|
|
|
123
121
|
const def = readDef(schema);
|
|
124
122
|
return def?.valueType;
|
|
125
123
|
}
|
|
124
|
+
const getMapKeyType = getRecordKeyType;
|
|
125
|
+
const getMapValueType = getRecordValueType;
|
|
126
126
|
function getTupleItems(schema) {
|
|
127
127
|
const def = readDef(schema);
|
|
128
128
|
return def?.items ?? [];
|
|
@@ -163,6 +163,10 @@ function unwrapEffectsSource(schema) {
|
|
|
163
163
|
const def = readDef(schema);
|
|
164
164
|
return def?.schema;
|
|
165
165
|
}
|
|
166
|
+
function getEffect(schema) {
|
|
167
|
+
const def = readDef(schema);
|
|
168
|
+
return def?.effect;
|
|
169
|
+
}
|
|
166
170
|
function getEffectsKind(schema) {
|
|
167
171
|
const def = readDef(schema);
|
|
168
172
|
const type = def?.effect?.type;
|
|
@@ -188,6 +192,9 @@ function isAsyncEffect(schema) {
|
|
|
188
192
|
function containsAsyncRefine(schema, seen) {
|
|
189
193
|
return walkForTarget(schema, "refinement", seen ?? /* @__PURE__ */ new WeakSet());
|
|
190
194
|
}
|
|
195
|
+
function containsMapOrSet(schema, seen) {
|
|
196
|
+
return walkForTarget(schema, "map-or-set", /* @__PURE__ */ new WeakSet());
|
|
197
|
+
}
|
|
191
198
|
function containsDiscriminatedUnion(schema, seen) {
|
|
192
199
|
return walkForTarget(schema, "discriminated-union", seen ?? /* @__PURE__ */ new WeakSet());
|
|
193
200
|
}
|
|
@@ -267,9 +274,17 @@ function walkForTarget(schema, target, visited) {
|
|
|
267
274
|
return false;
|
|
268
275
|
}
|
|
269
276
|
if (isZodSchemaType(schema, "ZodSet")) {
|
|
277
|
+
if (target === "map-or-set") return true;
|
|
270
278
|
const elem = getSetValueType(schema);
|
|
271
279
|
return elem !== void 0 && walkForTarget(elem, target, visited);
|
|
272
280
|
}
|
|
281
|
+
if (isZodSchemaType(schema, "ZodMap")) {
|
|
282
|
+
if (target === "map-or-set") return true;
|
|
283
|
+
const keyType = getMapKeyType(schema);
|
|
284
|
+
if (keyType !== void 0 && walkForTarget(keyType, target, visited)) return true;
|
|
285
|
+
const valueType = getMapValueType(schema);
|
|
286
|
+
return valueType !== void 0 && walkForTarget(valueType, target, visited);
|
|
287
|
+
}
|
|
273
288
|
return false;
|
|
274
289
|
}
|
|
275
290
|
function unwrapPipeIn(schema) {
|
|
@@ -284,11 +299,7 @@ function unwrapLazy(schema) {
|
|
|
284
299
|
const def = readDef(schema);
|
|
285
300
|
const getter = def?.getter;
|
|
286
301
|
if (typeof getter !== "function") return void 0;
|
|
287
|
-
|
|
288
|
-
return getter();
|
|
289
|
-
} catch {
|
|
290
|
-
return void 0;
|
|
291
|
-
}
|
|
302
|
+
return callConsumerSchemaFn(() => getter(), void 0, "lazy-getter");
|
|
292
303
|
}
|
|
293
304
|
function getLazyGetter(schema) {
|
|
294
305
|
const def = readDef(schema);
|
|
@@ -309,21 +320,17 @@ function getDefaultValue(schema) {
|
|
|
309
320
|
const def = readDef(schema);
|
|
310
321
|
const thunk = def?.defaultValue;
|
|
311
322
|
if (typeof thunk !== "function") return void 0;
|
|
312
|
-
|
|
313
|
-
return thunk();
|
|
314
|
-
} catch {
|
|
315
|
-
return void 0;
|
|
316
|
-
}
|
|
323
|
+
return callConsumerSchemaFn(() => thunk(), void 0, "default-factory");
|
|
317
324
|
}
|
|
318
325
|
function getCatchDefault(schema) {
|
|
319
326
|
const def = readDef(schema);
|
|
320
327
|
const cv = def?.catchValue;
|
|
321
328
|
if (typeof cv !== "function") return void 0;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
329
|
+
return callConsumerSchemaFn(
|
|
330
|
+
() => cv({ error: null, input: void 0 }),
|
|
331
|
+
void 0,
|
|
332
|
+
"catch-factory"
|
|
333
|
+
);
|
|
327
334
|
}
|
|
328
335
|
function hasCatchValue(schema) {
|
|
329
336
|
const def = readDef(schema);
|
|
@@ -424,95 +431,6 @@ function isContainerAfterWrapperPeel(schema) {
|
|
|
424
431
|
return isZodSchemaType(cur, "ZodObject") || isZodSchemaType(cur, "ZodArray") || isZodSchemaType(cur, "ZodTuple") || isZodSchemaType(cur, "ZodIntersection") || isZodSchemaType(cur, "ZodUnion") || isZodSchemaType(cur, "ZodDiscriminatedUnion") || isZodSchemaType(cur, "ZodRecord") || isZodSchemaType(cur, "ZodSet");
|
|
425
432
|
}
|
|
426
433
|
|
|
427
|
-
const UNSUPPORTED_TYPE_NAMES = /* @__PURE__ */ new Set(["ZodPromise", "ZodFunction", "ZodMap", "ZodSymbol"]);
|
|
428
|
-
function labelPath(path) {
|
|
429
|
-
return path.length === 0 ? "<root>" : path.join(".");
|
|
430
|
-
}
|
|
431
|
-
function assertSupportedKinds(schema, path = [], lazyGetters = []) {
|
|
432
|
-
const typeName = getTypeName(schema);
|
|
433
|
-
if (typeName !== void 0 && UNSUPPORTED_TYPE_NAMES.has(typeName)) {
|
|
434
|
-
throw new UnsupportedSchemaError(
|
|
435
|
-
`[attaform/zod-v3] unsupported kind '${typeName}' at '${labelPath(path)}'`
|
|
436
|
-
);
|
|
437
|
-
}
|
|
438
|
-
if (isZodSchemaType(schema, "ZodObject")) {
|
|
439
|
-
for (const [key, sub] of Object.entries(getObjectShape(schema))) {
|
|
440
|
-
assertSupportedKinds(sub, [...path, key], lazyGetters);
|
|
441
|
-
}
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
if (isZodSchemaType(schema, "ZodArray")) {
|
|
445
|
-
const inner = getArrayElement(schema);
|
|
446
|
-
if (inner) assertSupportedKinds(inner, [...path, "*"], lazyGetters);
|
|
447
|
-
return;
|
|
448
|
-
}
|
|
449
|
-
if (isZodSchemaType(schema, "ZodSet")) {
|
|
450
|
-
const inner = getSetValueType(schema);
|
|
451
|
-
if (inner) assertSupportedKinds(inner, [...path, "*"], lazyGetters);
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
if (isZodSchemaType(schema, "ZodRecord")) {
|
|
455
|
-
const inner = getRecordValueType(schema);
|
|
456
|
-
if (inner) assertSupportedKinds(inner, [...path, "*"], lazyGetters);
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
if (isZodSchemaType(schema, "ZodTuple")) {
|
|
460
|
-
const items = getTupleItems(schema);
|
|
461
|
-
items.forEach((item, i) => assertSupportedKinds(item, [...path, String(i)], lazyGetters));
|
|
462
|
-
return;
|
|
463
|
-
}
|
|
464
|
-
if (isZodSchemaType(schema, "ZodUnion")) {
|
|
465
|
-
const options = getUnionOptions(schema);
|
|
466
|
-
options.forEach((opt, i) => assertSupportedKinds(opt, [...path, `|${i}`], lazyGetters));
|
|
467
|
-
return;
|
|
468
|
-
}
|
|
469
|
-
if (isZodSchemaType(schema, "ZodDiscriminatedUnion")) {
|
|
470
|
-
const options = getDiscriminatedOptions(schema);
|
|
471
|
-
options.forEach((opt, i) => assertSupportedKinds(opt, [...path, `|${i}`], lazyGetters));
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
if (isZodSchemaType(schema, "ZodIntersection")) {
|
|
475
|
-
const left = getIntersectionLeft(schema);
|
|
476
|
-
if (left) assertSupportedKinds(left, [...path, "left"], lazyGetters);
|
|
477
|
-
const right = getIntersectionRight(schema);
|
|
478
|
-
if (right) assertSupportedKinds(right, [...path, "right"], lazyGetters);
|
|
479
|
-
return;
|
|
480
|
-
}
|
|
481
|
-
if (isZodSchemaType(schema, "ZodOptional") || isZodSchemaType(schema, "ZodNullable") || isZodSchemaType(schema, "ZodDefault") || isZodSchemaType(schema, "ZodReadonly") || isZodSchemaType(schema, "ZodCatch")) {
|
|
482
|
-
const inner = unwrapInner(schema);
|
|
483
|
-
if (inner) assertSupportedKinds(inner, path, lazyGetters);
|
|
484
|
-
return;
|
|
485
|
-
}
|
|
486
|
-
if (isZodSchemaType(schema, "ZodBranded")) {
|
|
487
|
-
const inner = unwrapBranded(schema);
|
|
488
|
-
if (inner) assertSupportedKinds(inner, path, lazyGetters);
|
|
489
|
-
return;
|
|
490
|
-
}
|
|
491
|
-
if (isZodSchemaType(schema, "ZodEffects")) {
|
|
492
|
-
const inner = unwrapEffectsSource(schema);
|
|
493
|
-
if (inner) assertSupportedKinds(inner, path, lazyGetters);
|
|
494
|
-
return;
|
|
495
|
-
}
|
|
496
|
-
if (isZodSchemaType(schema, "ZodPipeline")) {
|
|
497
|
-
const inner = unwrapPipeIn(schema);
|
|
498
|
-
if (inner) assertSupportedKinds(inner, path, lazyGetters);
|
|
499
|
-
return;
|
|
500
|
-
}
|
|
501
|
-
if (isZodSchemaType(schema, "ZodLazy")) {
|
|
502
|
-
const getter = getLazyGetter(schema);
|
|
503
|
-
if (getter !== void 0 && lazyGetters.includes(getter)) return;
|
|
504
|
-
const inner = getter?.();
|
|
505
|
-
if (inner !== void 0) {
|
|
506
|
-
assertSupportedKinds(
|
|
507
|
-
inner,
|
|
508
|
-
path,
|
|
509
|
-
getter === void 0 ? lazyGetters : [...lazyGetters, getter]
|
|
510
|
-
);
|
|
511
|
-
}
|
|
512
|
-
return;
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
|
|
516
434
|
const V3_INTROSPECTOR = {
|
|
517
435
|
kindOf: (schema) => kindOf(schema),
|
|
518
436
|
getObjectShape,
|
|
@@ -531,6 +449,8 @@ const V3_INTROSPECTOR = {
|
|
|
531
449
|
getSetValueType,
|
|
532
450
|
getRecordKeyType,
|
|
533
451
|
getRecordValueType,
|
|
452
|
+
getMapKeyType: (schema) => kindOf(schema) === "map" ? getMapKeyType(schema) : void 0,
|
|
453
|
+
getMapValueType: (schema) => kindOf(schema) === "map" ? getMapValueType(schema) : void 0,
|
|
534
454
|
getUnionOptions,
|
|
535
455
|
getIntersectionLeft,
|
|
536
456
|
getIntersectionRight,
|
|
@@ -551,14 +471,84 @@ const V3_INTROSPECTOR = {
|
|
|
551
471
|
hasCatchValue
|
|
552
472
|
};
|
|
553
473
|
|
|
474
|
+
function mapKeyAt(value, index) {
|
|
475
|
+
if (!(value instanceof Map)) return void 0;
|
|
476
|
+
if (typeof index !== "number" || !Number.isInteger(index) || index < 0) return void 0;
|
|
477
|
+
let i = 0;
|
|
478
|
+
for (const key of value.keys()) {
|
|
479
|
+
if (i === index) return key;
|
|
480
|
+
i += 1;
|
|
481
|
+
}
|
|
482
|
+
return void 0;
|
|
483
|
+
}
|
|
484
|
+
function stepSchema(schema, segment, maxRecursionDepth) {
|
|
485
|
+
if (schema === void 0) return void 0;
|
|
486
|
+
return walkPathSegments(schema, [String(segment)], V3_INTROSPECTOR, maxRecursionDepth, 0)[0];
|
|
487
|
+
}
|
|
488
|
+
function normalizeIssuePaths(issues, rootSchema, data, maxRecursionDepth, peel) {
|
|
489
|
+
let out = null;
|
|
490
|
+
for (let i = 0; i < issues.length; i++) {
|
|
491
|
+
const issue = issues[i];
|
|
492
|
+
const next = normalizeOne(issue.path, rootSchema, data, maxRecursionDepth, peel);
|
|
493
|
+
if (next === null) continue;
|
|
494
|
+
out ?? (out = [...issues]);
|
|
495
|
+
out[i] = { ...issue, path: next };
|
|
496
|
+
}
|
|
497
|
+
return out ?? issues;
|
|
498
|
+
}
|
|
499
|
+
function normalizeOne(path, rootSchema, data, maxRecursionDepth, peel) {
|
|
500
|
+
const out = [];
|
|
501
|
+
let schema = rootSchema;
|
|
502
|
+
let value = data;
|
|
503
|
+
let changed = false;
|
|
504
|
+
let i = 0;
|
|
505
|
+
while (i < path.length) {
|
|
506
|
+
const peeled = schema === void 0 ? void 0 : peel(schema);
|
|
507
|
+
const kind = peeled === void 0 ? void 0 : V3_INTROSPECTOR.kindOf(peeled);
|
|
508
|
+
if (kind === "set") {
|
|
509
|
+
changed = true;
|
|
510
|
+
break;
|
|
511
|
+
}
|
|
512
|
+
if (kind === "map") {
|
|
513
|
+
const key = mapKeyAt(value, path[i]);
|
|
514
|
+
if (key === void 0) {
|
|
515
|
+
changed = true;
|
|
516
|
+
break;
|
|
517
|
+
}
|
|
518
|
+
if (typeof key !== "string" && typeof key !== "number") {
|
|
519
|
+
changed = true;
|
|
520
|
+
break;
|
|
521
|
+
}
|
|
522
|
+
out.push(key);
|
|
523
|
+
value = value.get(key);
|
|
524
|
+
schema = V3_INTROSPECTOR.getMapValueType(peeled);
|
|
525
|
+
changed = true;
|
|
526
|
+
const half = path[i + 1];
|
|
527
|
+
i += half === "key" || half === "value" ? 2 : 1;
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
const segment = path[i];
|
|
531
|
+
out.push(segment);
|
|
532
|
+
value = getAtPath(value, [segment]);
|
|
533
|
+
schema = stepSchema(schema, segment, maxRecursionDepth);
|
|
534
|
+
i += 1;
|
|
535
|
+
}
|
|
536
|
+
return changed ? out : null;
|
|
537
|
+
}
|
|
538
|
+
|
|
554
539
|
function slimPrimitivesV3(schema) {
|
|
555
540
|
return new Set(slimPrimitivesWalk(schema, V3_INTROSPECTOR, 64));
|
|
556
541
|
}
|
|
557
542
|
|
|
558
543
|
function rebuildWithDef(original, defPatch) {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
544
|
+
return Object.create(Object.getPrototypeOf(original), {
|
|
545
|
+
_def: {
|
|
546
|
+
value: { ...original._def, ...defPatch },
|
|
547
|
+
writable: true,
|
|
548
|
+
enumerable: true,
|
|
549
|
+
configurable: true
|
|
550
|
+
}
|
|
551
|
+
});
|
|
562
552
|
}
|
|
563
553
|
function rebuildObject(original, shape) {
|
|
564
554
|
const node = rebuildWithDef(original, { shape: () => shape, unknownKeys: "strip" });
|
|
@@ -613,8 +603,20 @@ function rebuildDiscriminatedUnion(original, options) {
|
|
|
613
603
|
}
|
|
614
604
|
return rebuildWithDef(original, { options, optionsMap });
|
|
615
605
|
}
|
|
606
|
+
function rebuildEffects(original, source, effect) {
|
|
607
|
+
return rebuildWithDef(original, { schema: source, effect });
|
|
608
|
+
}
|
|
616
609
|
|
|
617
610
|
function stripAsyncChecks(schema) {
|
|
611
|
+
return walkEffects(schema, "strip");
|
|
612
|
+
}
|
|
613
|
+
function wrapAsyncSafeRefinements(schema) {
|
|
614
|
+
return walkEffects(schema, "wrap");
|
|
615
|
+
}
|
|
616
|
+
function isThenable(value) {
|
|
617
|
+
return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
618
|
+
}
|
|
619
|
+
function walkEffects(schema, policy) {
|
|
618
620
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
619
621
|
function recurse(s) {
|
|
620
622
|
const candidate = s;
|
|
@@ -623,7 +625,26 @@ function stripAsyncChecks(schema) {
|
|
|
623
625
|
seen.add(candidate);
|
|
624
626
|
if (isZodSchemaType(s, "ZodEffects")) {
|
|
625
627
|
const inner = unwrapEffectsSource(s);
|
|
626
|
-
|
|
628
|
+
if (inner === void 0) return s;
|
|
629
|
+
if (policy === "strip") return recurse(inner);
|
|
630
|
+
const effect = getEffect(s);
|
|
631
|
+
const rebuiltInner = recurse(inner);
|
|
632
|
+
const original = effect?.["refinement"];
|
|
633
|
+
if (effect === void 0 || typeof original !== "function") {
|
|
634
|
+
return rebuildEffects(s, rebuiltInner, effect);
|
|
635
|
+
}
|
|
636
|
+
const refine = original;
|
|
637
|
+
const safeEffect = {
|
|
638
|
+
...effect,
|
|
639
|
+
refinement: (value, ctx) => {
|
|
640
|
+
const result = refine(value, ctx);
|
|
641
|
+
if (isThenable(result)) {
|
|
642
|
+
void result.catch(() => void 0);
|
|
643
|
+
}
|
|
644
|
+
return result;
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
return rebuildEffects(s, rebuiltInner, safeEffect);
|
|
627
648
|
}
|
|
628
649
|
if (isZodSchemaType(s, "ZodOptional")) {
|
|
629
650
|
const inner = unwrapInner(s);
|
|
@@ -772,18 +793,17 @@ function carryObjectChecks(rebuilt, original) {
|
|
|
772
793
|
const MAX_UNWRAP_STEPS = 64;
|
|
773
794
|
let warnedZodCodeMissing = false;
|
|
774
795
|
function zodAdapter(zodSchema) {
|
|
775
|
-
assertSupportedKinds(zodSchema);
|
|
776
796
|
const peeledRoot = peelAllV3Wrappers(zodSchema);
|
|
777
797
|
if (!isZodSchemaType(peeledRoot, "ZodObject") && !isZodSchemaType(peeledRoot, "ZodRecord") && !isZodSchemaType(peeledRoot, "ZodDiscriminatedUnion")) {
|
|
778
|
-
const name = getTypeName(peeledRoot);
|
|
779
|
-
throw new
|
|
780
|
-
`
|
|
798
|
+
const name = getTypeName(peeledRoot) ?? "unknown";
|
|
799
|
+
throw new AttaformError(
|
|
800
|
+
`[attaform/zod-v3] useForm schema root must be a ZodObject, ZodRecord, or ZodDiscriminatedUnion (got '${name}'). Wrap other shapes under a key.`
|
|
781
801
|
);
|
|
782
802
|
}
|
|
783
803
|
return (formKey, options) => createAbstractSchema(
|
|
784
804
|
zodSchema,
|
|
785
805
|
V3_INTROSPECTOR,
|
|
786
|
-
buildV3Services(),
|
|
806
|
+
buildV3Services(options.maxRecursionDepth),
|
|
787
807
|
formKey,
|
|
788
808
|
options
|
|
789
809
|
);
|
|
@@ -792,10 +812,28 @@ async function lazyFingerprint(schema) {
|
|
|
792
812
|
const { fingerprintZodSchema } = await import('../chunks/fingerprint.mjs');
|
|
793
813
|
return fingerprintZodSchema(schema);
|
|
794
814
|
}
|
|
795
|
-
|
|
815
|
+
const syncSafeCache = /* @__PURE__ */ new WeakMap();
|
|
816
|
+
function syncSafe(schema) {
|
|
817
|
+
const cached = syncSafeCache.get(schema);
|
|
818
|
+
if (cached !== void 0) return cached;
|
|
819
|
+
const wrapped = wrapAsyncSafeRefinements(schema);
|
|
820
|
+
syncSafeCache.set(schema, wrapped);
|
|
821
|
+
return wrapped;
|
|
822
|
+
}
|
|
823
|
+
function buildV3Services(maxRecursionDepth) {
|
|
824
|
+
const mapOrSetBySchema = /* @__PURE__ */ new WeakMap();
|
|
825
|
+
const refileIssues = (schema, data, issues) => {
|
|
826
|
+
let hasMapOrSet = mapOrSetBySchema.get(schema);
|
|
827
|
+
if (hasMapOrSet === void 0) {
|
|
828
|
+
hasMapOrSet = containsMapOrSet(schema);
|
|
829
|
+
mapOrSetBySchema.set(schema, hasMapOrSet);
|
|
830
|
+
}
|
|
831
|
+
if (!hasMapOrSet) return issues;
|
|
832
|
+
return normalizeIssuePaths(issues, schema, data, maxRecursionDepth, peelAllV3Wrappers);
|
|
833
|
+
};
|
|
796
834
|
return {
|
|
797
835
|
fingerprint: (schema) => lazyFingerprint(schema),
|
|
798
|
-
getNestedSchemasAtPath: (schema, path,
|
|
836
|
+
getNestedSchemasAtPath: (schema, path, maxRecursionDepth2) => getNestedZodSchemasAtPath(schema, path, maxRecursionDepth2),
|
|
799
837
|
// v3 pre-strips refinements / defaults / wrappers off the root for
|
|
800
838
|
// slim-mode walks — `getSlimPrimitiveTypesAtPath` and
|
|
801
839
|
// `getSchemasAtPath` both consume this variant so the yielded
|
|
@@ -803,34 +841,34 @@ function buildV3Services() {
|
|
|
803
841
|
// The slim-root projection is gone (size-teardown P7): the shared
|
|
804
842
|
// path walker peels wrappers / effects inline, so the slim and
|
|
805
843
|
// unstripped walks coincide — same aliasing v4 always had.
|
|
806
|
-
getNestedSchemasInSlimMode: (schema, path,
|
|
844
|
+
getNestedSchemasInSlimMode: (schema, path, maxRecursionDepth2) => getNestedZodSchemasAtPath(schema, path, maxRecursionDepth2),
|
|
807
845
|
slimPrimitivesOf: (schema, _maxRecursionDepth) => slimPrimitivesV3(schema),
|
|
808
846
|
deriveDefault: (schema, useDefault, _maxRecursionDepth, formKey) => getDefaultValuesFromZodSchema(schema, useDefault, formKey),
|
|
809
|
-
runStrictGetDefaults: (schema, config, formKey,
|
|
847
|
+
runStrictGetDefaults: (schema, config, formKey, maxRecursionDepth2) => runStrictGetDefaultsV3(schema, config, formKey, maxRecursionDepth2),
|
|
810
848
|
unwrapStructuralWrappers: (schema) => unwrapStructuralLeafV3(schema),
|
|
811
849
|
unwrapToDiscriminatedUnion: (schema) => unwrapToDiscriminatedUnion(schema),
|
|
812
850
|
peelAllWrappers: (schema) => peelAllV3Wrappers(schema),
|
|
813
851
|
isLeafRequired: (schema) => isLeafRequiredV3(schema),
|
|
814
|
-
resolveFieldMetaAtPath: (schema, path,
|
|
852
|
+
resolveFieldMetaAtPath: (schema, path, maxRecursionDepth2) => resolveFieldMetaAtPathV3(schema, path, maxRecursionDepth2),
|
|
815
853
|
issuesToValidationErrors: (issues) => zodIssuesToValidationErrors(issues),
|
|
816
854
|
safeParseSync: (schema, data) => {
|
|
817
|
-
const result = schema.safeParse(data);
|
|
818
|
-
return result.success ? { success: true, data: result.data } : { success: false, issues: result.error.issues };
|
|
855
|
+
const result = syncSafe(schema).safeParse(data);
|
|
856
|
+
return result.success ? { success: true, data: result.data } : { success: false, issues: refileIssues(schema, data, result.error.issues) };
|
|
819
857
|
},
|
|
820
858
|
safeParseAsync: async (schema, data) => {
|
|
821
859
|
const result = await schema.safeParseAsync(data);
|
|
822
|
-
return result.success ? { success: true, data: result.data } : { success: false, issues: result.error.issues };
|
|
860
|
+
return result.success ? { success: true, data: result.data } : { success: false, issues: refileIssues(schema, data, result.error.issues) };
|
|
823
861
|
},
|
|
824
862
|
// v3 returns the full recursive AbstractSchema for sub-schemas (the
|
|
825
863
|
// historical shape) — `getSchemasAtPath` consumers may probe any
|
|
826
864
|
// method on the result. The factory call rebuilds the full surface
|
|
827
865
|
// against the sub-schema with its own per-form caches.
|
|
828
|
-
makeSubSchema: (sub, formKey,
|
|
866
|
+
makeSubSchema: (sub, formKey, maxRecursionDepth2) => createAbstractSchema(
|
|
829
867
|
sub,
|
|
830
868
|
V3_INTROSPECTOR,
|
|
831
|
-
buildV3Services(),
|
|
869
|
+
buildV3Services(maxRecursionDepth2),
|
|
832
870
|
formKey,
|
|
833
|
-
{ maxRecursionDepth }
|
|
871
|
+
{ maxRecursionDepth: maxRecursionDepth2 }
|
|
834
872
|
)
|
|
835
873
|
};
|
|
836
874
|
}
|
|
@@ -1105,7 +1143,7 @@ function runStrictGetDefaultsV3(rootSchema, config, formKey, maxRecursionDepth)
|
|
|
1105
1143
|
};
|
|
1106
1144
|
}
|
|
1107
1145
|
try {
|
|
1108
|
-
const strictResult = rootSchema.safeParse(rawDefaultValues);
|
|
1146
|
+
const strictResult = syncSafe(rootSchema).safeParse(rawDefaultValues);
|
|
1109
1147
|
if (strictResult.success) {
|
|
1110
1148
|
return {
|
|
1111
1149
|
data: rawDefaultValues,
|
|
@@ -1124,7 +1162,7 @@ function runStrictGetDefaultsV3(rootSchema, config, formKey, maxRecursionDepth)
|
|
|
1124
1162
|
const isAsyncDetect = err instanceof Error && err.message.includes("Async refinement encountered");
|
|
1125
1163
|
if (isAsyncDetect) {
|
|
1126
1164
|
try {
|
|
1127
|
-
const strippedResult = stripAsyncChecks(rootSchema).safeParse(rawDefaultValues);
|
|
1165
|
+
const strippedResult = syncSafe(stripAsyncChecks(rootSchema)).safeParse(rawDefaultValues);
|
|
1128
1166
|
if (strippedResult.success) {
|
|
1129
1167
|
return {
|
|
1130
1168
|
data: rawDefaultValues,
|
package/dist/dev/zod-v3.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { i as isZodSchemaType, u as useForm, z as zodAdapter } from './shared/attaform-dev.
|
|
2
|
-
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.
|
|
3
|
-
export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform-dev.
|
|
4
|
-
export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform-dev.
|
|
5
|
-
export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform-dev.
|
|
6
|
-
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.
|
|
1
|
+
export { i as isZodSchemaType, u as useForm, z as zodAdapter } from './shared/attaform-dev.q6UutkCx.mjs';
|
|
2
|
+
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.BgM6FdtA.mjs';
|
|
3
|
+
export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform-dev.A-TpJW0B.mjs';
|
|
4
|
+
export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform-dev.DHuydLAC.mjs';
|
|
5
|
+
export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform-dev.DD5m2W51.mjs';
|
|
6
|
+
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.D8aoKb89.mjs';
|
|
7
7
|
|
|
8
8
|
const fieldMeta = installingFieldMetaStore;
|
|
9
9
|
function withMeta(schema, payload) {
|
package/dist/dev/zod-v4.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.
|
|
3
|
-
export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform-dev.
|
|
4
|
-
export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform-dev.
|
|
5
|
-
export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform-dev.
|
|
6
|
-
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.
|
|
1
|
+
export { a as assertZodVersion, k as kindOf, u as useForm, z as zodAdapter } from './shared/attaform-dev.BO-71R54.mjs';
|
|
2
|
+
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.BgM6FdtA.mjs';
|
|
3
|
+
export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform-dev.A-TpJW0B.mjs';
|
|
4
|
+
export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform-dev.DHuydLAC.mjs';
|
|
5
|
+
export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform-dev.DD5m2W51.mjs';
|
|
6
|
+
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.D8aoKb89.mjs';
|
|
7
7
|
|
|
8
8
|
const fieldMeta = installingFieldMetaStore;
|
|
9
9
|
function withMeta(schema, payload) {
|
package/dist/dev/zod.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform-dev.
|
|
2
|
-
export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform-dev.
|
|
3
|
-
export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform-dev.
|
|
4
|
-
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.
|
|
5
|
-
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform-dev.
|
|
1
|
+
export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform-dev.A-TpJW0B.mjs';
|
|
2
|
+
export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform-dev.DHuydLAC.mjs';
|
|
3
|
+
export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform-dev.DD5m2W51.mjs';
|
|
4
|
+
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.D8aoKb89.mjs';
|
|
5
|
+
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform-dev.DrzObAZo.mjs';
|
package/dist/directive.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { i as installVRegister, v as vRegister } from './shared/attaform.
|
|
2
|
-
import {
|
|
1
|
+
export { i as installVRegister, v as vRegister } from './shared/attaform.axHXVQO7.mjs';
|
|
2
|
+
import { at as RegisterModelDynamicCustomDirective } from './shared/attaform.CsoeRi3P.mjs';
|
|
3
3
|
import 'vue';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/directive.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { i as installVRegister, v as vRegister, b as vRegisterFile } from './shared/attaform.
|
|
1
|
+
export { i as installVRegister, v as vRegister, b as vRegisterFile } from './shared/attaform.DffRL5pP.mjs';
|
package/dist/history.d.mts
CHANGED
package/dist/history.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallowRef, computed } from 'vue';
|
|
2
|
-
import { n as normalizeNumericOption, D as DEFAULT_HISTORY_MAX_SNAPSHOTS, s as structuralSnapshot } from './shared/attaform.
|
|
2
|
+
import { n as normalizeNumericOption, D as DEFAULT_HISTORY_MAX_SNAPSHOTS, s as structuralSnapshot } from './shared/attaform.Cvao8bW5.mjs';
|
|
3
3
|
|
|
4
4
|
function captureErrorCells(map) {
|
|
5
5
|
const out = [];
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEFAULT_TIMINGS, f as DEVTOOLS_WINDOW_KEY, g as DisplayTimings, F as FormStatus, h as FormStatusSeed, G as GateMarker, I as InjectWizardInput, i as InvalidPathError, j as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, k as ReservedFormKeyError, S as SerializedAttaformState, l as SerializedFormData, m as StepSlot, n as SubmitErrorHandlerError, U as
|
|
2
|
-
import { G as GenericForm, F as FormKey, U as UseFormConfiguration,
|
|
3
|
-
|
|
4
|
-
export { v as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEFAULT_TIMINGS, f as DEVTOOLS_WINDOW_KEY, g as DisplayTimings, F as FormStatus, h as FormStatusSeed, G as GateMarker, I as InjectWizardInput, i as InvalidPathError, j as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, k as ReservedFormKeyError, S as SerializedAttaformState, l as SerializedFormData, m as StepSlot, n as SubmitErrorHandlerError, U as UseRegisterOptions, o as UseRegisterReturn, p as UseWizardReturnType, W as WizardAggregateError, q as WizardCtx, r as WizardCtxForm, s as WizardOnError, t as WizardOnSubmit, u as WizardOptions, v as WizardPersistFn, w as WizardRestoreFn, x as WizardRestoreState, y as WizardStatusesProxy, z as WizardSubmitContext, B as assignKey, E as createAttaform, H as createRegistry, J as defaultCoercionRules, K as defaultDisplayState, M as defineCoercion, N as escapeForInlineScript, P as gate, Q as getRegistryFromApp, T as hydrateAttaformState, V as injectForm, X as injectWizard, Y as isRegisterValue, Z as kAttaformRegistry, _ as lazy, $ as makeDefaultDisplayState, a0 as renderAttaformState, a1 as useRegister, a2 as useRegistry, a3 as useWizard } from './shared/attaform.DDtqHYv1.mjs';
|
|
2
|
+
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, av as AcceptableDefaults, ah as ValidateOnConfig, a as UseFormReturnType, D as DefaultValuesInput, o as FieldMetaPayload } from './shared/attaform.CsoeRi3P.mjs';
|
|
3
|
+
import { AbstractSchema } from './abstract.mjs';
|
|
4
|
+
export { b as ArrayItem, c as ArrayPath, d as AttaformDefaults, C as CoercionEntry, e as CoercionRegistry, f as CoercionResult, g as CustomDirectiveRegisterAssignerFn, h as DeepPartial, i as DefaultValuesResponse, j as DefaultValuesShape, k as DisplayCtx, l as DisplayMachine, m as DisplayState, E as ErrorInput, n as ErrorsProxyShape, p as FieldState, q as FieldStateMap, r as FieldStateMapEntry, s as FlatPath, t as FormErrorRecord, u as FormErrorsSurface, v as FormMeta, w as GetDisplayState, H as HandleSubmit, x as HistoryPlugin, I as IsTuple, y as IsUnion, J as JoinSegments, z as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, B as NestedType, O as OnError, P as OnInvalidSubmitPolicy, Q as OnSubmit, R as ParseOptions, S as PartialFlatPath, T as Path, V as PathKey, W as PendingValidationStatus, X as Primitive, Y as ROOT_PATH, Z as ROOT_PATH_KEY, _ as ReactiveValidationStatus, $ as RecordPath, a0 as RecordValue, a1 as RegisterDirective, a2 as RegisterFlatPath, a3 as RegisterOptions, a4 as RegisterSelectModifier, a5 as RegisterTextModifier, a6 as RegisterTransform, a7 as RegisterValue, a8 as Segment, a9 as SetValueCallback, aa as SetValuePayload, ab as SettledValidationStatus, ac as SlimPrimitiveKind, ad as SlimRuntimeOf, ae as SubmitHandler, af as Unset, ag as ValidateOn, ai as ValidationError, aj as ValidationResponse, ak as ValidationResponseWithoutValue, al as ValueOfUnion, am as WriteMeta, an as WriteShape, ao as canonicalizePath, ap as isPathPrefix, aq as isUnset, ar as parseDottedPath, as as unset } from './shared/attaform.CsoeRi3P.mjs';
|
|
5
|
+
export { v as vRegister } from './shared/attaform.axHXVQO7.mjs';
|
|
6
|
+
import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.CIWLMY-R.mjs';
|
|
7
|
+
export { P as PathInput, a as PathOutput } from './shared/attaform.CIWLMY-R.mjs';
|
|
8
|
+
import { S as SupportedRootSchema$1, a as StorageShape$1 } from './shared/attaform.DRUT703x.mjs';
|
|
9
|
+
import { UnwrapZodRoot } from './zod-v3.mjs';
|
|
8
10
|
import { z } from 'zod';
|
|
9
11
|
import 'vue';
|
|
10
12
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform.
|
|
2
|
-
export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform.
|
|
3
|
-
export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform.
|
|
4
|
-
export { a as assignKey, v as vRegister } from './shared/attaform.
|
|
5
|
-
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.
|
|
1
|
+
export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform.CZYt_5N_.mjs';
|
|
2
|
+
export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform.CZMAYwSK.mjs';
|
|
3
|
+
export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform.D0x-qSXm.mjs';
|
|
4
|
+
export { a as assignKey, v as vRegister } from './shared/attaform.DffRL5pP.mjs';
|
|
5
|
+
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.BndjUUYX.mjs';
|
|
6
6
|
export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
|
package/dist/nuxt.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import {
|
|
2
|
+
import { AttaformDefaults } from './abstract.mjs';
|
|
3
3
|
import 'vue';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -33,15 +33,15 @@ interface AttaformModuleOptions {
|
|
|
33
33
|
resolveZodAlias?: boolean;
|
|
34
34
|
/**
|
|
35
35
|
* Auto-import Attaform's form composables (`useForm`, `useWizard`,
|
|
36
|
-
* `injectForm`, `injectWizard`, `fieldMeta`, `withMeta`, `lazy
|
|
37
|
-
* components can call them without an
|
|
38
|
-
* `true`. The set is declared in
|
|
39
|
-
* resolves from `attaform/zod`,
|
|
40
|
-
* still ships a single Zod major.
|
|
41
|
-
*
|
|
42
|
-
* auto-import already loses to an
|
|
43
|
-
* same name, so opting out is only
|
|
44
|
-
* global scope altogether.
|
|
36
|
+
* `injectForm`, `injectWizard`, `fieldMeta`, `withMeta`, `lazy`,
|
|
37
|
+
* `gate`, `useRegister`) so components can call them without an
|
|
38
|
+
* explicit `import`. Default `true`. The set is declared in
|
|
39
|
+
* Attaform's auto-import manifest and resolves from `attaform/zod`,
|
|
40
|
+
* so the build-time adapter rewrite still ships a single Zod major.
|
|
41
|
+
* Set to `false` to suppress the names entirely and import the
|
|
42
|
+
* composables yourself. Note a Nuxt auto-import already loses to an
|
|
43
|
+
* explicit or local binding of the same name, so opting out is only
|
|
44
|
+
* needed to keep the names out of global scope altogether.
|
|
45
45
|
*/
|
|
46
46
|
autoImports?: boolean;
|
|
47
47
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineNuxtPlugin, useRuntimeConfig, useRoute } from 'nuxt/app';
|
|
2
|
-
import { c as createAttaform, b as kAttaformWizardActiveStepResolver, r as renderAttaformState, h as hydrateAttaformState, g as getRegistryFromApp, D as DEVTOOLS_WINDOW_KEY } from '../../shared/attaform.
|
|
2
|
+
import { c as createAttaform, b as kAttaformWizardActiveStepResolver, r as renderAttaformState, h as hydrateAttaformState, g as getRegistryFromApp, D as DEVTOOLS_WINDOW_KEY } from '../../shared/attaform.D0x-qSXm.mjs';
|
|
3
3
|
|
|
4
4
|
var attaform_default = defineNuxtPlugin({
|
|
5
5
|
// `enforce: 'pre'` makes the "we run before any component's setup" claim
|