attaform 0.30.0 → 0.31.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.
Files changed (71) hide show
  1. package/dist/abstract.d.mts +15 -21
  2. package/dist/abstract.mjs +3 -3
  3. package/dist/dev/abstract.mjs +4 -4
  4. package/dist/dev/chunks/devtools.mjs +4 -4
  5. package/dist/dev/directive.mjs +1 -1
  6. package/dist/dev/history.mjs +2 -2
  7. package/dist/dev/index.mjs +5 -5
  8. package/dist/dev/runtime/plugins/attaform.mjs +1 -1
  9. package/dist/dev/shared/{attaform-dev.DUZckyV8.mjs → attaform-dev.B1q-x9R9.mjs} +4 -4
  10. package/dist/dev/shared/{attaform-dev.BcYT6tFh.mjs → attaform-dev.CZz4GYZ6.mjs} +21 -9
  11. package/dist/dev/shared/{attaform-dev.BisFstxh.mjs → attaform-dev.Caibt7sb.mjs} +16 -15
  12. package/dist/dev/shared/{attaform-dev.DTrHonpc.mjs → attaform-dev.CtyqGia7.mjs} +176 -260
  13. package/dist/dev/shared/{attaform-dev.BK6Ge2qR.mjs → attaform-dev.DJ3nsWw6.mjs} +86 -122
  14. package/dist/dev/shared/{attaform-dev.BcNtyOmf.mjs → attaform-dev.DlaT4xGd.mjs} +4 -4
  15. package/dist/dev/shared/{attaform-dev.D6CLvaQT.mjs → attaform-dev.k5X47GMD.mjs} +520 -395
  16. package/dist/dev/shared/{attaform-dev.CQ2rJiAX.mjs → attaform-dev.y9x9Vp9F.mjs} +324 -234
  17. package/dist/dev/shared/{attaform-dev.BQc5QV3Y.mjs → attaform-dev.zlvDr0WB.mjs} +2 -2
  18. package/dist/dev/zod-v3.mjs +6 -6
  19. package/dist/dev/zod-v4.mjs +6 -6
  20. package/dist/dev/zod.mjs +5 -5
  21. package/dist/directive.d.mts +4 -4
  22. package/dist/directive.mjs +1 -1
  23. package/dist/esbuild.d.mts +11 -0
  24. package/dist/esbuild.mjs +1 -1
  25. package/dist/history.d.mts +3 -32
  26. package/dist/history.mjs +2 -2
  27. package/dist/index.d.mts +67 -70
  28. package/dist/index.mjs +4 -4
  29. package/dist/nuxt.d.mts +4 -3
  30. package/dist/nuxt.mjs +3 -6
  31. package/dist/rollup.d.mts +11 -0
  32. package/dist/rollup.mjs +1 -1
  33. package/dist/rspack.d.mts +19 -11
  34. package/dist/rspack.mjs +1 -1
  35. package/dist/runtime/components/AttaformDevtoolsPanel.vue +15 -15
  36. package/dist/runtime/components/DevtoolsValueTree.vue +2 -2
  37. package/dist/runtime/plugins/attaform.mjs +1 -1
  38. package/dist/shared/{attaform.BRDDQeHV.mjs → attaform.8mfKZCwH.mjs} +2 -2
  39. package/dist/shared/{attaform.DRUT703x.d.mts → attaform.B-Tb62qV.d.mts} +12 -12
  40. package/dist/shared/{attaform.v0fQtWyA.mjs → attaform.B1rH9ht6.mjs} +1 -1
  41. package/dist/shared/{attaform.DhnPb6nK.mjs → attaform.BAf3UNn4.mjs} +1 -1
  42. package/dist/shared/{attaform.BXneBxEj.mjs → attaform.BWUn8Kjy.mjs} +85 -121
  43. package/dist/shared/{attaform.WiGdIqgx.mjs → attaform.C4shmwyJ.mjs} +2 -2
  44. package/dist/shared/{attaform.Rc9u4Vfw.d.mts → attaform.CRVe8s82.d.mts} +83 -95
  45. package/dist/shared/attaform.D9RqPgGu.d.mts +42 -0
  46. package/dist/shared/attaform.DAo0QBmS.d.mts +2173 -0
  47. package/dist/shared/{attaform.BK0cgu2K.mjs → attaform.DBCbxlyk.mjs} +62 -4
  48. package/dist/shared/{attaform.CUfrMK7t.mjs → attaform.DL2nl_QR.mjs} +15 -14
  49. package/dist/shared/{attaform.DNJOWjQw.mjs → attaform.DNPJPOO7.mjs} +299 -218
  50. package/dist/shared/attaform.DZnrDrNb.d.mts +4657 -0
  51. package/dist/shared/{attaform.B3resMQ1.mjs → attaform.DxKQsqFZ.mjs} +496 -371
  52. package/dist/shared/{attaform.ByWP6kSx.mjs → attaform.L011tHgJ.mjs} +3 -3
  53. package/dist/shared/{attaform.CJ8DpRGj.mjs → attaform.LUPC-2Qg.mjs} +175 -257
  54. package/dist/transforms.d.mts +153 -26
  55. package/dist/transforms.mjs +1 -1
  56. package/dist/vite.d.mts +29 -52
  57. package/dist/vite.mjs +3 -3
  58. package/dist/webpack.d.mts +20 -12
  59. package/dist/webpack.mjs +1 -1
  60. package/dist/zod-v3.d.mts +90 -96
  61. package/dist/zod-v3.mjs +5 -5
  62. package/dist/zod-v4.d.mts +120 -118
  63. package/dist/zod-v4.mjs +5 -5
  64. package/dist/zod.d.mts +5 -5
  65. package/dist/zod.mjs +4 -4
  66. package/package.json +7 -6
  67. package/skills/attaform/SKILL.md +1 -1
  68. package/skills/attaform/references/custom-components.md +4 -0
  69. package/dist/shared/attaform.Clz0ArIi.d.mts +0 -44
  70. package/dist/shared/attaform.UGyOK83T.d.mts +0 -2366
  71. package/dist/shared/attaform.bKLzMU0o.d.mts +0 -4761
@@ -1,7 +1,7 @@
1
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';
2
+ import { u as useForm$2 } from './attaform.LUPC-2Qg.mjs';
3
+ import { u as useForm$1 } from './attaform.BWUn8Kjy.mjs';
4
+ import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './attaform.DL2nl_QR.mjs';
5
5
 
6
6
  function isZodV4SchemaShape(value) {
7
7
  if (typeof value !== "object" || value === null) return false;
@@ -1,6 +1,6 @@
1
- import { w as walkPathSegments, s as slimPrimitivesWalk, c as createAbstractSchema, a as createSharedSchemaStore, b as buildFieldMetaPathMap, g as getFieldMetaForSchema, f as fixStructuralDefaults, m as mergeDeep, d as deriveDefaultWalk, e as getFieldMetaListForSchema } from './attaform.CUfrMK7t.mjs';
2
- import { h as getAtPath, j as humanize, c as useAbstractForm } from './attaform.DNJOWjQw.mjs';
3
- import { c as callConsumerSchemaFn } from './attaform.BRDDQeHV.mjs';
1
+ import { w as walkPathSegments, s as slimPrimitivesWalk, c as createAbstractSchema, a as createSharedSchemaStore, b as buildFieldMetaPathMap, g as getFieldMetaForSchema, f as fixStructuralDefaults, m as mergeDeep, d as deriveDefaultWalk, e as getFieldMetaListForSchema } from './attaform.DL2nl_QR.mjs';
2
+ import { h as getAtPath, j as humanize, c as useAbstractForm } from './attaform.DNPJPOO7.mjs';
3
+ import { c as callConsumerFn } from './attaform.8mfKZCwH.mjs';
4
4
  import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform.CdZIEf7_.mjs';
5
5
 
6
6
  function isZodSchemaType(schema, expectedType) {
@@ -196,104 +196,6 @@ function isAsyncEffect(schema) {
196
196
  if (typeof fn !== "function") return false;
197
197
  return fn.constructor.name === "AsyncFunction";
198
198
  }
199
- function containsAsyncRefine(schema, seen) {
200
- return walkForTarget(schema, "refinement", seen ?? /* @__PURE__ */ new WeakSet());
201
- }
202
- function containsMapOrSet(schema, seen) {
203
- return walkForTarget(schema, "map-or-set", /* @__PURE__ */ new WeakSet());
204
- }
205
- function containsDiscriminatedUnion(schema, seen) {
206
- return walkForTarget(schema, "discriminated-union", seen ?? /* @__PURE__ */ new WeakSet());
207
- }
208
- function containsAsyncTransform(schema, seen) {
209
- return walkForTarget(schema, "transform-or-preprocess", seen ?? /* @__PURE__ */ new WeakSet());
210
- }
211
- function walkForTarget(schema, target, visited) {
212
- const candidate = schema;
213
- if (typeof candidate !== "object" || candidate === null) return false;
214
- if (visited.has(candidate)) return false;
215
- visited.add(candidate);
216
- if (isZodSchemaType(schema, "ZodEffects")) {
217
- const kind = getEffectsKind(schema);
218
- if (target === "refinement" && kind === "refinement") return true;
219
- if (target === "transform-or-preprocess" && (kind === "transform" || kind === "preprocess") && isAsyncEffect(schema)) {
220
- return true;
221
- }
222
- const inner = unwrapEffectsSource(schema);
223
- return inner !== void 0 && walkForTarget(inner, target, visited);
224
- }
225
- if (isZodSchemaType(schema, "ZodOptional") || isZodSchemaType(schema, "ZodNullable") || isZodSchemaType(schema, "ZodDefault") || isZodSchemaType(schema, "ZodCatch") || isZodSchemaType(schema, "ZodReadonly")) {
226
- const inner = unwrapInner(schema);
227
- return inner !== void 0 && walkForTarget(inner, target, visited);
228
- }
229
- if (isZodSchemaType(schema, "ZodBranded")) {
230
- const inner = unwrapBranded(schema);
231
- return inner !== void 0 && walkForTarget(inner, target, visited);
232
- }
233
- if (isZodSchemaType(schema, "ZodLazy")) {
234
- const inner = unwrapLazy(schema);
235
- return inner !== void 0 && walkForTarget(inner, target, visited);
236
- }
237
- if (isZodSchemaType(schema, "ZodPipeline")) {
238
- const inSide = unwrapPipeIn(schema);
239
- if (inSide !== void 0 && walkForTarget(inSide, target, visited)) return true;
240
- const outSide = unwrapPipeOut(schema);
241
- if (outSide !== void 0 && walkForTarget(outSide, target, visited)) return true;
242
- return false;
243
- }
244
- if (isZodSchemaType(schema, "ZodObject")) {
245
- for (const sub of Object.values(getObjectShape(schema))) {
246
- if (walkForTarget(sub, target, visited)) return true;
247
- }
248
- return false;
249
- }
250
- if (isZodSchemaType(schema, "ZodArray")) {
251
- const elem = getArrayElement(schema);
252
- return elem !== void 0 && walkForTarget(elem, target, visited);
253
- }
254
- if (isZodSchemaType(schema, "ZodTuple")) {
255
- for (const it of getTupleItems(schema)) {
256
- if (walkForTarget(it, target, visited)) return true;
257
- }
258
- return false;
259
- }
260
- if (isZodSchemaType(schema, "ZodUnion") || isZodSchemaType(schema, "ZodDiscriminatedUnion")) {
261
- if (target === "discriminated-union" && isZodSchemaType(schema, "ZodDiscriminatedUnion")) {
262
- return true;
263
- }
264
- for (const opt of getUnionOptions(schema)) {
265
- if (walkForTarget(opt, target, visited)) return true;
266
- }
267
- return false;
268
- }
269
- if (isZodSchemaType(schema, "ZodIntersection")) {
270
- const left = getIntersectionLeft(schema);
271
- if (left !== void 0 && walkForTarget(left, target, visited)) return true;
272
- const right = getIntersectionRight(schema);
273
- if (right !== void 0 && walkForTarget(right, target, visited)) return true;
274
- return false;
275
- }
276
- if (isZodSchemaType(schema, "ZodRecord")) {
277
- const keyType = getRecordKeyType(schema);
278
- if (keyType !== void 0 && walkForTarget(keyType, target, visited)) return true;
279
- const valueType = getRecordValueType(schema);
280
- if (valueType !== void 0 && walkForTarget(valueType, target, visited)) return true;
281
- return false;
282
- }
283
- if (isZodSchemaType(schema, "ZodSet")) {
284
- if (target === "map-or-set") return true;
285
- const elem = getSetValueType(schema);
286
- return elem !== void 0 && walkForTarget(elem, target, visited);
287
- }
288
- if (isZodSchemaType(schema, "ZodMap")) {
289
- if (target === "map-or-set") return true;
290
- const keyType = getMapKeyType(schema);
291
- if (keyType !== void 0 && walkForTarget(keyType, target, visited)) return true;
292
- const valueType = getMapValueType(schema);
293
- return valueType !== void 0 && walkForTarget(valueType, target, visited);
294
- }
295
- return false;
296
- }
297
199
  function unwrapPipeIn(schema) {
298
200
  const def = readDef(schema);
299
201
  return def?.in;
@@ -306,7 +208,7 @@ function unwrapLazy(schema) {
306
208
  const def = readDef(schema);
307
209
  const getter = def?.getter;
308
210
  if (typeof getter !== "function") return void 0;
309
- return callConsumerSchemaFn(() => getter(), void 0);
211
+ return callConsumerFn(() => getter(), void 0);
310
212
  }
311
213
  function getLiteralValues(schema) {
312
214
  const def = readDef(schema);
@@ -323,113 +225,148 @@ function getDefaultValue(schema) {
323
225
  const def = readDef(schema);
324
226
  const thunk = def?.defaultValue;
325
227
  if (typeof thunk !== "function") return void 0;
326
- return callConsumerSchemaFn(() => thunk(), void 0);
228
+ return callConsumerFn(() => thunk(), void 0);
327
229
  }
328
230
  function getCatchDefault(schema) {
329
231
  const def = readDef(schema);
330
232
  const cv = def?.catchValue;
331
233
  if (typeof cv !== "function") return void 0;
332
- return callConsumerSchemaFn(
333
- () => cv({ error: null, input: void 0 }),
334
- void 0);
234
+ return callConsumerFn(() => cv({ error: null, input: void 0 }), void 0);
335
235
  }
336
236
  function hasCatchValue(schema) {
337
237
  const def = readDef(schema);
338
238
  return typeof def?.catchValue === "function";
339
239
  }
340
- function hasContainerOrRootRefine(schema, seen) {
341
- const visited = seen ?? /* @__PURE__ */ new WeakSet();
240
+ const capabilityMemo = /* @__PURE__ */ new WeakMap();
241
+ function capabilitiesOf(schema) {
242
+ let capabilities = capabilityMemo.get(schema);
243
+ if (capabilities === void 0) {
244
+ capabilities = scanCapabilities(schema);
245
+ const key = schema;
246
+ if (typeof key === "object" && key !== null) capabilityMemo.set(key, capabilities);
247
+ }
248
+ return capabilities;
249
+ }
250
+ function scanCapabilities(schema) {
251
+ const capabilities = {
252
+ asyncRefine: false,
253
+ asyncTransform: false,
254
+ discriminatedUnion: false,
255
+ containerOrRootRefine: false,
256
+ preprocessOrCoerce: false,
257
+ mapOrSet: false
258
+ };
259
+ walkCapabilities(schema, capabilities, /* @__PURE__ */ new WeakSet());
260
+ return capabilities;
261
+ }
262
+ function walkCapabilities(schema, capabilities, visited) {
263
+ if (schema === void 0) return;
342
264
  const candidate = schema;
343
- if (typeof candidate !== "object" || candidate === null) return false;
344
- if (visited.has(candidate)) return false;
265
+ if (typeof candidate !== "object" || candidate === null || visited.has(candidate)) return;
345
266
  visited.add(candidate);
346
- if (isZodSchemaType(schema, "ZodEffects")) {
347
- const inner = unwrapEffectsSource(schema);
348
- if (inner === void 0) return false;
349
- if (isContainerAfterWrapperPeel(inner)) return true;
350
- return hasContainerOrRootRefine(inner, visited);
351
- }
352
- if (isZodSchemaType(schema, "ZodOptional") || isZodSchemaType(schema, "ZodNullable") || isZodSchemaType(schema, "ZodDefault") || isZodSchemaType(schema, "ZodCatch") || isZodSchemaType(schema, "ZodReadonly")) {
353
- const inner = unwrapInner(schema);
354
- return inner !== void 0 && hasContainerOrRootRefine(inner, visited);
355
- }
356
- if (isZodSchemaType(schema, "ZodBranded")) {
357
- const inner = unwrapBranded(schema);
358
- return inner !== void 0 && hasContainerOrRootRefine(inner, visited);
359
- }
360
- if (isZodSchemaType(schema, "ZodLazy")) {
361
- const inner = unwrapLazy(schema);
362
- return inner !== void 0 && hasContainerOrRootRefine(inner, visited);
363
- }
364
- if (isZodSchemaType(schema, "ZodPipeline")) {
365
- const inSide = unwrapPipeIn(schema);
366
- if (inSide !== void 0 && hasContainerOrRootRefine(inSide, visited)) return true;
367
- const outSide = unwrapPipeOut(schema);
368
- if (outSide !== void 0 && hasContainerOrRootRefine(outSide, visited)) return true;
369
- return false;
370
- }
371
- if (isZodSchemaType(schema, "ZodObject")) {
372
- for (const sub of Object.values(getObjectShape(schema))) {
373
- if (hasContainerOrRootRefine(sub, visited)) return true;
374
- }
375
- return false;
376
- }
377
- if (isZodSchemaType(schema, "ZodArray")) {
378
- const elem = getArrayElement(schema);
379
- return elem !== void 0 && hasContainerOrRootRefine(elem, visited);
380
- }
381
- if (isZodSchemaType(schema, "ZodTuple")) {
382
- for (const it of getTupleItems(schema)) {
383
- if (hasContainerOrRootRefine(it, visited)) return true;
384
- }
385
- return false;
386
- }
387
- if (isZodSchemaType(schema, "ZodUnion") || isZodSchemaType(schema, "ZodDiscriminatedUnion")) {
388
- for (const opt of getUnionOptions(schema)) {
389
- if (hasContainerOrRootRefine(opt, visited)) return true;
267
+ if (isCoercePrimitive(schema)) capabilities.preprocessOrCoerce = true;
268
+ const typeName = getTypeName(schema) ?? "";
269
+ switch (typeName) {
270
+ case "ZodEffects": {
271
+ const kind = getEffectsKind(schema);
272
+ if (kind === "refinement") capabilities.asyncRefine = true;
273
+ else if ((kind === "transform" || kind === "preprocess") && isAsyncEffect(schema)) {
274
+ capabilities.asyncTransform = true;
275
+ }
276
+ if (kind === "preprocess") capabilities.preprocessOrCoerce = true;
277
+ const inner = unwrapEffectsSource(schema);
278
+ if (!capabilities.containerOrRootRefine && inner !== void 0 && isContainerAfterWrapperPeel(inner)) {
279
+ capabilities.containerOrRootRefine = true;
280
+ }
281
+ walkCapabilities(inner, capabilities, visited);
282
+ return;
390
283
  }
391
- return false;
392
- }
393
- if (isZodSchemaType(schema, "ZodIntersection")) {
394
- const left = getIntersectionLeft(schema);
395
- if (left !== void 0 && hasContainerOrRootRefine(left, visited)) return true;
396
- const right = getIntersectionRight(schema);
397
- if (right !== void 0 && hasContainerOrRootRefine(right, visited)) return true;
398
- return false;
399
- }
400
- if (isZodSchemaType(schema, "ZodRecord")) {
401
- const keyType = getRecordKeyType(schema);
402
- if (keyType !== void 0 && hasContainerOrRootRefine(keyType, visited)) return true;
403
- const valueType = getRecordValueType(schema);
404
- if (valueType !== void 0 && hasContainerOrRootRefine(valueType, visited)) return true;
405
- return false;
406
- }
407
- if (isZodSchemaType(schema, "ZodSet")) {
408
- const elem = getSetValueType(schema);
409
- return elem !== void 0 && hasContainerOrRootRefine(elem, visited);
284
+ case "ZodOptional":
285
+ case "ZodNullable":
286
+ case "ZodDefault":
287
+ case "ZodCatch":
288
+ case "ZodReadonly":
289
+ walkCapabilities(unwrapInner(schema), capabilities, visited);
290
+ return;
291
+ case "ZodBranded":
292
+ walkCapabilities(unwrapBranded(schema), capabilities, visited);
293
+ return;
294
+ case "ZodLazy":
295
+ walkCapabilities(unwrapLazy(schema), capabilities, visited);
296
+ return;
297
+ case "ZodPipeline":
298
+ walkCapabilities(unwrapPipeIn(schema), capabilities, visited);
299
+ walkCapabilities(unwrapPipeOut(schema), capabilities, visited);
300
+ return;
301
+ case "ZodObject":
302
+ for (const sub of Object.values(getObjectShape(schema))) {
303
+ walkCapabilities(sub, capabilities, visited);
304
+ }
305
+ return;
306
+ case "ZodArray":
307
+ walkCapabilities(getArrayElement(schema), capabilities, visited);
308
+ return;
309
+ case "ZodTuple":
310
+ for (const item of getTupleItems(schema)) walkCapabilities(item, capabilities, visited);
311
+ return;
312
+ case "ZodUnion":
313
+ case "ZodDiscriminatedUnion":
314
+ if (typeName === "ZodDiscriminatedUnion") capabilities.discriminatedUnion = true;
315
+ for (const option of getUnionOptions(schema)) walkCapabilities(option, capabilities, visited);
316
+ return;
317
+ case "ZodIntersection":
318
+ walkCapabilities(getIntersectionLeft(schema), capabilities, visited);
319
+ walkCapabilities(getIntersectionRight(schema), capabilities, visited);
320
+ return;
321
+ case "ZodRecord":
322
+ walkCapabilities(getRecordKeyType(schema), capabilities, visited);
323
+ walkCapabilities(getRecordValueType(schema), capabilities, visited);
324
+ return;
325
+ case "ZodSet":
326
+ capabilities.mapOrSet = true;
327
+ walkCapabilities(getSetValueType(schema), capabilities, visited);
328
+ return;
329
+ case "ZodMap":
330
+ capabilities.mapOrSet = true;
331
+ walkCapabilities(getMapKeyType(schema), capabilities, visited);
332
+ walkCapabilities(getMapValueType(schema), capabilities, visited);
333
+ return;
410
334
  }
411
- return false;
412
335
  }
336
+ const CONTAINER_TYPE_NAMES = /* @__PURE__ */ new Set([
337
+ "ZodObject",
338
+ "ZodArray",
339
+ "ZodTuple",
340
+ "ZodIntersection",
341
+ "ZodUnion",
342
+ "ZodDiscriminatedUnion",
343
+ "ZodRecord",
344
+ "ZodMap",
345
+ "ZodSet"
346
+ ]);
413
347
  function isContainerAfterWrapperPeel(schema) {
414
348
  let cur = schema;
415
- for (let i = 0; i < MAX_UNWRAP_STEPS$1; i++) {
416
- if (isZodSchemaType(cur, "ZodOptional") || isZodSchemaType(cur, "ZodNullable") || isZodSchemaType(cur, "ZodDefault") || isZodSchemaType(cur, "ZodCatch") || isZodSchemaType(cur, "ZodReadonly")) {
417
- const inner = unwrapInner(cur);
418
- if (inner === void 0) return false;
419
- cur = inner;
420
- } else if (isZodSchemaType(cur, "ZodBranded")) {
421
- const inner = unwrapBranded(cur);
422
- if (inner === void 0) return false;
423
- cur = inner;
424
- } else if (isZodSchemaType(cur, "ZodLazy")) {
425
- const inner = unwrapLazy(cur);
426
- if (inner === void 0) return false;
427
- cur = inner;
428
- } else {
429
- break;
349
+ for (let i = 0; i < MAX_UNWRAP_STEPS$1 && cur !== void 0; i++) {
350
+ const typeName = getTypeName(cur) ?? "";
351
+ switch (typeName) {
352
+ case "ZodOptional":
353
+ case "ZodNullable":
354
+ case "ZodDefault":
355
+ case "ZodCatch":
356
+ case "ZodReadonly":
357
+ cur = unwrapInner(cur);
358
+ break;
359
+ case "ZodBranded":
360
+ cur = unwrapBranded(cur);
361
+ break;
362
+ case "ZodLazy":
363
+ cur = unwrapLazy(cur);
364
+ break;
365
+ default:
366
+ return CONTAINER_TYPE_NAMES.has(typeName);
430
367
  }
431
368
  }
432
- 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");
369
+ return false;
433
370
  }
434
371
 
435
372
  const V3_INTROSPECTOR = {
@@ -441,10 +378,7 @@ const V3_INTROSPECTOR = {
441
378
  getLiteralValues,
442
379
  isPreprocessNode,
443
380
  isCoercePrimitive,
444
- containsAsyncRefine,
445
- containsAsyncTransform,
446
- containsDiscriminatedUnion,
447
- hasContainerOrRootRefine,
381
+ capabilitiesOf,
448
382
  // Walker accessors (D2 / D3 / D5).
449
383
  getArrayElement,
450
384
  getSetValueType,
@@ -469,6 +403,10 @@ const V3_INTROSPECTOR = {
469
403
  getCatchDefault,
470
404
  hasCatchValue
471
405
  };
406
+ const V3_SUB_SCHEMA_INTROSPECTOR = {
407
+ ...V3_INTROSPECTOR,
408
+ capabilitiesOf: scanCapabilities
409
+ };
472
410
 
473
411
  function mapKeyAt(value, index) {
474
412
  if (!(value instanceof Map)) return void 0;
@@ -536,7 +474,7 @@ function normalizeOne(path, rootSchema, data, maxRecursionDepth, peel) {
536
474
  }
537
475
 
538
476
  function slimPrimitivesV3(schema) {
539
- return new Set(slimPrimitivesWalk(schema, V3_INTROSPECTOR, 64));
477
+ return slimPrimitivesWalk(schema, V3_INTROSPECTOR, 64);
540
478
  }
541
479
 
542
480
  function rebuildWithDef(original, defPatch) {
@@ -605,6 +543,9 @@ function rebuildDiscriminatedUnion(original, options) {
605
543
  }
606
544
  return rebuildWithDef(original, { options, optionsMap });
607
545
  }
546
+ function rebuildPipeline(original, inSide, outSide) {
547
+ return rebuildWithDef(original, { in: inSide, out: outSide });
548
+ }
608
549
  function rebuildEffects(original, source, effect) {
609
550
  return rebuildWithDef(original, { schema: source, effect });
610
551
  }
@@ -680,7 +621,9 @@ function walkEffects(schema) {
680
621
  }
681
622
  if (isZodSchemaType(s, "ZodPipeline")) {
682
623
  const inSide = unwrapPipeIn(s);
683
- return inSide === void 0 ? s : recurse(inSide);
624
+ const outSide = unwrapPipeOut(s);
625
+ if (inSide === void 0 || outSide === void 0) return s;
626
+ return rebuildPipeline(s, recurse(inSide), recurse(outSide));
684
627
  }
685
628
  if (isZodSchemaType(s, "ZodObject")) {
686
629
  const shape = getObjectShape(s);
@@ -818,29 +761,32 @@ function syncSafe(schema) {
818
761
  return wrapped;
819
762
  }
820
763
  function buildV3Services(maxRecursionDepth) {
821
- const mapOrSetBySchema = /* @__PURE__ */ new WeakMap();
822
764
  const refileIssues = (schema, data, issues) => {
823
- let hasMapOrSet = mapOrSetBySchema.get(schema);
824
- if (hasMapOrSet === void 0) {
825
- hasMapOrSet = containsMapOrSet(schema);
826
- mapOrSetBySchema.set(schema, hasMapOrSet);
765
+ if (!issues.some((issue) => issue.path.some((segment) => typeof segment === "number"))) {
766
+ return issues;
827
767
  }
828
- if (!hasMapOrSet) return issues;
768
+ if (!capabilitiesOf(schema).mapOrSet) return issues;
829
769
  return normalizeIssuePaths(issues, schema, data, maxRecursionDepth, peelAllV3Wrappers);
830
770
  };
771
+ const validateSync = (schema, data) => {
772
+ if (capabilitiesOf(schema).asyncTransform) return [];
773
+ try {
774
+ const result = syncSafe(schema).safeParse(data);
775
+ return result.success ? [] : zodIssuesToValidationErrors(refileIssues(schema, data, result.error.issues));
776
+ } catch {
777
+ return [];
778
+ }
779
+ };
831
780
  return {
832
781
  getNestedSchemasAtPath: (schema, path, maxRecursionDepth2) => getNestedZodSchemasAtPath(schema, path, maxRecursionDepth2),
833
- // v3 pre-strips refinements / defaults / wrappers off the root for
834
- // slim-mode walks — `getSlimPrimitiveTypesAtPath` and
835
- // `getSchemasAtPath` both consume this variant so the yielded
836
- // candidates reflect the slim shape.
837
- // The slim-root projection is gone (size-teardown P7): the shared
838
- // path walker peels wrappers / effects inline, so the slim and
839
- // unstripped walks coincide — same aliasing v4 always had.
782
+ // The shared path walker peels wrappers and effects inline, so the
783
+ // slim and unstripped walks coincide and the root needs no slim
784
+ // projection of its own. Same aliasing v4 has.
840
785
  getNestedSchemasInSlimMode: (schema, path, maxRecursionDepth2) => getNestedZodSchemasAtPath(schema, path, maxRecursionDepth2),
841
786
  slimPrimitivesOf: (schema, _maxRecursionDepth) => slimPrimitivesV3(schema),
842
787
  deriveDefault: (schema, useDefault) => getDefaultValuesFromZodSchema(schema, useDefault),
843
788
  runGetDefaults: (schema, config, maxRecursionDepth2) => runGetDefaultsV3(schema, config, maxRecursionDepth2),
789
+ validateSync,
844
790
  unwrapStructuralWrappers: (schema) => unwrapStructuralLeafV3(schema),
845
791
  unwrapToDiscriminatedUnion: (schema) => unwrapToDiscriminatedUnion(schema),
846
792
  peelAllWrappers: (schema) => peelAllV3Wrappers(schema),
@@ -855,13 +801,13 @@ function buildV3Services(maxRecursionDepth) {
855
801
  const result = await schema.safeParseAsync(data);
856
802
  return result.success ? { success: true, data: result.data } : { success: false, issues: refileIssues(schema, data, result.error.issues) };
857
803
  },
858
- // v3 returns the full recursive AbstractSchema for sub-schemas (the
859
- // historical shape) — `getSchemasAtPath` consumers may probe any
860
- // method on the result. The factory call rebuilds the full surface
861
- // against the sub-schema with its own per-form caches.
804
+ // A `getSchemasAtPath` consumer may probe any method on the result,
805
+ // so a sub-schema comes back as a full recursive AbstractSchema: the
806
+ // factory call rebuilds the whole surface against it, with its own
807
+ // per-form caches, and walks its capabilities without the memo.
862
808
  makeSubSchema: (sub, maxRecursionDepth2) => createAbstractSchema(
863
809
  sub,
864
- V3_INTROSPECTOR,
810
+ V3_SUB_SCHEMA_INTROSPECTOR,
865
811
  buildV3Services(maxRecursionDepth2),
866
812
  { maxRecursionDepth: maxRecursionDepth2 }
867
813
  )
@@ -878,17 +824,16 @@ function zodIssuesToValidationErrors(issues) {
878
824
  }
879
825
  validationErrors.push({
880
826
  message: issue.message,
881
- // `ValidationError.path` is `(string | number)[]` per the
882
- // public type. v3's `issue.path` is the same in the standard
883
- // case, but a custom check via `ctx.addIssue({ path: [...] })`
884
- // can smuggle a Symbol through — the public surface promised
885
- // strings/numbers, so coerce defensively to keep the contract.
886
- // Mirrors v4's behaviour at the same site.
827
+ // `ValidationError.path` is `(string | number)[]` publicly, and
828
+ // v3's `issue.path` matches in the standard case, but a custom
829
+ // check calling `ctx.addIssue({ path: [...] })` can smuggle a
830
+ // Symbol through. Coerce to keep the promise. v4 does the same
831
+ // here.
887
832
  //
888
- // Adapter-side paths stay schema-relative — the validation
889
- // pipeline in `create-form-store.ts` prepends the parent path
890
- // to absolutise, then routes form-level (absolute path length 0)
891
- // entries to the empty-string bucket at storage time.
833
+ // Adapter-side paths stay schema-RELATIVE: the validation pipeline
834
+ // in `core/create-form-store.ts` prepends the parent path to
835
+ // absolutise, then routes form-level entries, those whose absolute
836
+ // path is empty, to the empty-string bucket at storage time.
892
837
  path: coercePathSegments(issue.path),
893
838
  code
894
839
  });
@@ -920,10 +865,10 @@ function unwrapStructuralLeafV3(schema) {
920
865
  return current;
921
866
  }
922
867
  function isStructuralV3Kind(schema) {
923
- return isZodSchemaType(schema, "ZodObject") || isZodSchemaType(schema, "ZodArray") || isZodSchemaType(schema, "ZodRecord") || isZodSchemaType(schema, "ZodTuple") || isZodSchemaType(schema, "ZodUnion") || isZodSchemaType(schema, "ZodDiscriminatedUnion") || // Wrappers that themselves resolve to a structural type — keep
924
- // peeling at the next iteration.
925
- isZodSchemaType(schema, "ZodOptional") || isZodSchemaType(schema, "ZodNullable") || isZodSchemaType(schema, "ZodDefault") || isZodSchemaType(schema, "ZodEffects") || // Newer transparent wrappers (v3.23+). Each wraps a single inner
926
- // schema with no structural impact — `peelV3Wrappers` resolves them.
868
+ return isZodSchemaType(schema, "ZodObject") || isZodSchemaType(schema, "ZodArray") || isZodSchemaType(schema, "ZodRecord") || isZodSchemaType(schema, "ZodTuple") || isZodSchemaType(schema, "ZodUnion") || isZodSchemaType(schema, "ZodDiscriminatedUnion") || // Wrappers that themselves resolve to a structural type; keep
869
+ // peeling next iteration.
870
+ isZodSchemaType(schema, "ZodOptional") || isZodSchemaType(schema, "ZodNullable") || isZodSchemaType(schema, "ZodDefault") || isZodSchemaType(schema, "ZodEffects") || // Newer transparent wrappers (v3.23+), each wrapping one inner
871
+ // schema with no structural impact. `peelV3Wrappers` resolves them.
927
872
  isZodSchemaType(schema, "ZodPipeline") || isZodSchemaType(schema, "ZodReadonly") || isZodSchemaType(schema, "ZodBranded");
928
873
  }
929
874
  function peelV3Wrappers(schema) {
@@ -1112,7 +1057,8 @@ function runGetDefaultsV3(rootSchema, config, maxRecursionDepth) {
1112
1057
  rootSchema,
1113
1058
  config.useDefaultSchemaValues
1114
1059
  );
1115
- const rawDefaultValues = config.constraints === void 0 ? defaultValuesWithoutConstraints : fixStructuralDefaults(
1060
+ if (config.constraints === void 0) return defaultValuesWithoutConstraints;
1061
+ return fixStructuralDefaults(
1116
1062
  rootSchema,
1117
1063
  mergeDeep(defaultValuesWithoutConstraints, config.constraints),
1118
1064
  config.useDefaultSchemaValues,
@@ -1124,34 +1070,6 @@ function runGetDefaultsV3(rootSchema, config, maxRecursionDepth) {
1124
1070
  unwrapToDiscriminatedUnion: (s) => unwrapToDiscriminatedUnion(s)
1125
1071
  }
1126
1072
  ).data;
1127
- if (containsAsyncTransform(rootSchema)) {
1128
- return {
1129
- data: rawDefaultValues,
1130
- errors: void 0,
1131
- success: true
1132
- };
1133
- }
1134
- try {
1135
- const parseResult = syncSafe(rootSchema).safeParse(rawDefaultValues);
1136
- if (parseResult.success) {
1137
- return {
1138
- data: rawDefaultValues,
1139
- errors: void 0,
1140
- success: true
1141
- };
1142
- }
1143
- return {
1144
- data: rawDefaultValues,
1145
- errors: zodIssuesToValidationErrors(parseResult.error.issues),
1146
- success: false
1147
- };
1148
- } catch {
1149
- return {
1150
- data: rawDefaultValues,
1151
- errors: void 0,
1152
- success: true
1153
- };
1154
- }
1155
1073
  }
1156
1074
 
1157
1075
  function useForm(configuration) {