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
- 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-dev.BisFstxh.mjs';
2
- import { h as getAtPath, j as humanize, c as useAbstractForm } from './attaform-dev.CQ2rJiAX.mjs';
3
- import { c as callConsumerSchemaFn } from './attaform-dev.BcYT6tFh.mjs';
4
- import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform-dev.BQc5QV3Y.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-dev.Caibt7sb.mjs';
2
+ import { h as getAtPath, j as humanize, c as useAbstractForm } from './attaform-dev.y9x9Vp9F.mjs';
3
+ import { c as callConsumerFn } from './attaform-dev.CZz4GYZ6.mjs';
4
+ import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform-dev.zlvDr0WB.mjs';
5
5
 
6
6
  function isZodSchemaType(schema, expectedType) {
7
7
  if (typeof schema !== "object" || schema === null) return false;
@@ -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, "lazy-getter");
211
+ return callConsumerFn(() => getter(), void 0, "lazy-getter");
310
212
  }
311
213
  function getLiteralValues(schema) {
312
214
  const def = readDef(schema);
@@ -323,115 +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, "default-factory");
228
+ return callConsumerFn(() => thunk(), void 0, "default-factory");
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,
335
- "catch-factory"
336
- );
234
+ return callConsumerFn(() => cv({ error: null, input: void 0 }), void 0, "catch-factory");
337
235
  }
338
236
  function hasCatchValue(schema) {
339
237
  const def = readDef(schema);
340
238
  return typeof def?.catchValue === "function";
341
239
  }
342
- function hasContainerOrRootRefine(schema, seen) {
343
- 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;
344
264
  const candidate = schema;
345
- if (typeof candidate !== "object" || candidate === null) return false;
346
- if (visited.has(candidate)) return false;
265
+ if (typeof candidate !== "object" || candidate === null || visited.has(candidate)) return;
347
266
  visited.add(candidate);
348
- if (isZodSchemaType(schema, "ZodEffects")) {
349
- const inner = unwrapEffectsSource(schema);
350
- if (inner === void 0) return false;
351
- if (isContainerAfterWrapperPeel(inner)) return true;
352
- return hasContainerOrRootRefine(inner, visited);
353
- }
354
- if (isZodSchemaType(schema, "ZodOptional") || isZodSchemaType(schema, "ZodNullable") || isZodSchemaType(schema, "ZodDefault") || isZodSchemaType(schema, "ZodCatch") || isZodSchemaType(schema, "ZodReadonly")) {
355
- const inner = unwrapInner(schema);
356
- return inner !== void 0 && hasContainerOrRootRefine(inner, visited);
357
- }
358
- if (isZodSchemaType(schema, "ZodBranded")) {
359
- const inner = unwrapBranded(schema);
360
- return inner !== void 0 && hasContainerOrRootRefine(inner, visited);
361
- }
362
- if (isZodSchemaType(schema, "ZodLazy")) {
363
- const inner = unwrapLazy(schema);
364
- return inner !== void 0 && hasContainerOrRootRefine(inner, visited);
365
- }
366
- if (isZodSchemaType(schema, "ZodPipeline")) {
367
- const inSide = unwrapPipeIn(schema);
368
- if (inSide !== void 0 && hasContainerOrRootRefine(inSide, visited)) return true;
369
- const outSide = unwrapPipeOut(schema);
370
- if (outSide !== void 0 && hasContainerOrRootRefine(outSide, visited)) return true;
371
- return false;
372
- }
373
- if (isZodSchemaType(schema, "ZodObject")) {
374
- for (const sub of Object.values(getObjectShape(schema))) {
375
- if (hasContainerOrRootRefine(sub, visited)) return true;
376
- }
377
- return false;
378
- }
379
- if (isZodSchemaType(schema, "ZodArray")) {
380
- const elem = getArrayElement(schema);
381
- return elem !== void 0 && hasContainerOrRootRefine(elem, visited);
382
- }
383
- if (isZodSchemaType(schema, "ZodTuple")) {
384
- for (const it of getTupleItems(schema)) {
385
- if (hasContainerOrRootRefine(it, visited)) return true;
386
- }
387
- return false;
388
- }
389
- if (isZodSchemaType(schema, "ZodUnion") || isZodSchemaType(schema, "ZodDiscriminatedUnion")) {
390
- for (const opt of getUnionOptions(schema)) {
391
- 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;
392
283
  }
393
- return false;
394
- }
395
- if (isZodSchemaType(schema, "ZodIntersection")) {
396
- const left = getIntersectionLeft(schema);
397
- if (left !== void 0 && hasContainerOrRootRefine(left, visited)) return true;
398
- const right = getIntersectionRight(schema);
399
- if (right !== void 0 && hasContainerOrRootRefine(right, visited)) return true;
400
- return false;
401
- }
402
- if (isZodSchemaType(schema, "ZodRecord")) {
403
- const keyType = getRecordKeyType(schema);
404
- if (keyType !== void 0 && hasContainerOrRootRefine(keyType, visited)) return true;
405
- const valueType = getRecordValueType(schema);
406
- if (valueType !== void 0 && hasContainerOrRootRefine(valueType, visited)) return true;
407
- return false;
408
- }
409
- if (isZodSchemaType(schema, "ZodSet")) {
410
- const elem = getSetValueType(schema);
411
- 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;
412
334
  }
413
- return false;
414
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
+ ]);
415
347
  function isContainerAfterWrapperPeel(schema) {
416
348
  let cur = schema;
417
- for (let i = 0; i < MAX_UNWRAP_STEPS$1; i++) {
418
- if (isZodSchemaType(cur, "ZodOptional") || isZodSchemaType(cur, "ZodNullable") || isZodSchemaType(cur, "ZodDefault") || isZodSchemaType(cur, "ZodCatch") || isZodSchemaType(cur, "ZodReadonly")) {
419
- const inner = unwrapInner(cur);
420
- if (inner === void 0) return false;
421
- cur = inner;
422
- } else if (isZodSchemaType(cur, "ZodBranded")) {
423
- const inner = unwrapBranded(cur);
424
- if (inner === void 0) return false;
425
- cur = inner;
426
- } else if (isZodSchemaType(cur, "ZodLazy")) {
427
- const inner = unwrapLazy(cur);
428
- if (inner === void 0) return false;
429
- cur = inner;
430
- } else {
431
- 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);
432
367
  }
433
368
  }
434
- 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;
435
370
  }
436
371
 
437
372
  const V3_INTROSPECTOR = {
@@ -443,10 +378,7 @@ const V3_INTROSPECTOR = {
443
378
  getLiteralValues,
444
379
  isPreprocessNode,
445
380
  isCoercePrimitive,
446
- containsAsyncRefine,
447
- containsAsyncTransform,
448
- containsDiscriminatedUnion,
449
- hasContainerOrRootRefine,
381
+ capabilitiesOf,
450
382
  // Walker accessors (D2 / D3 / D5).
451
383
  getArrayElement,
452
384
  getSetValueType,
@@ -471,6 +403,10 @@ const V3_INTROSPECTOR = {
471
403
  getCatchDefault,
472
404
  hasCatchValue
473
405
  };
406
+ const V3_SUB_SCHEMA_INTROSPECTOR = {
407
+ ...V3_INTROSPECTOR,
408
+ capabilitiesOf: scanCapabilities
409
+ };
474
410
 
475
411
  function mapKeyAt(value, index) {
476
412
  if (!(value instanceof Map)) return void 0;
@@ -538,7 +474,7 @@ function normalizeOne(path, rootSchema, data, maxRecursionDepth, peel) {
538
474
  }
539
475
 
540
476
  function slimPrimitivesV3(schema) {
541
- return new Set(slimPrimitivesWalk(schema, V3_INTROSPECTOR, 64));
477
+ return slimPrimitivesWalk(schema, V3_INTROSPECTOR, 64);
542
478
  }
543
479
 
544
480
  function rebuildWithDef(original, defPatch) {
@@ -607,6 +543,9 @@ function rebuildDiscriminatedUnion(original, options) {
607
543
  }
608
544
  return rebuildWithDef(original, { options, optionsMap });
609
545
  }
546
+ function rebuildPipeline(original, inSide, outSide) {
547
+ return rebuildWithDef(original, { in: inSide, out: outSide });
548
+ }
610
549
  function rebuildEffects(original, source, effect) {
611
550
  return rebuildWithDef(original, { schema: source, effect });
612
551
  }
@@ -682,7 +621,9 @@ function walkEffects(schema) {
682
621
  }
683
622
  if (isZodSchemaType(s, "ZodPipeline")) {
684
623
  const inSide = unwrapPipeIn(s);
685
- 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));
686
627
  }
687
628
  if (isZodSchemaType(s, "ZodObject")) {
688
629
  const shape = getObjectShape(s);
@@ -821,29 +762,32 @@ function syncSafe(schema) {
821
762
  return wrapped;
822
763
  }
823
764
  function buildV3Services(maxRecursionDepth) {
824
- const mapOrSetBySchema = /* @__PURE__ */ new WeakMap();
825
765
  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);
766
+ if (!issues.some((issue) => issue.path.some((segment) => typeof segment === "number"))) {
767
+ return issues;
830
768
  }
831
- if (!hasMapOrSet) return issues;
769
+ if (!capabilitiesOf(schema).mapOrSet) return issues;
832
770
  return normalizeIssuePaths(issues, schema, data, maxRecursionDepth, peelAllV3Wrappers);
833
771
  };
772
+ const validateSync = (schema, data) => {
773
+ if (capabilitiesOf(schema).asyncTransform) return [];
774
+ try {
775
+ const result = syncSafe(schema).safeParse(data);
776
+ return result.success ? [] : zodIssuesToValidationErrors(refileIssues(schema, data, result.error.issues));
777
+ } catch {
778
+ return [];
779
+ }
780
+ };
834
781
  return {
835
782
  getNestedSchemasAtPath: (schema, path, maxRecursionDepth2) => getNestedZodSchemasAtPath(schema, path, maxRecursionDepth2),
836
- // v3 pre-strips refinements / defaults / wrappers off the root for
837
- // slim-mode walks — `getSlimPrimitiveTypesAtPath` and
838
- // `getSchemasAtPath` both consume this variant so the yielded
839
- // candidates reflect the slim shape.
840
- // The slim-root projection is gone (size-teardown P7): the shared
841
- // path walker peels wrappers / effects inline, so the slim and
842
- // unstripped walks coincide — same aliasing v4 always had.
783
+ // The shared path walker peels wrappers and effects inline, so the
784
+ // slim and unstripped walks coincide and the root needs no slim
785
+ // projection of its own. Same aliasing v4 has.
843
786
  getNestedSchemasInSlimMode: (schema, path, maxRecursionDepth2) => getNestedZodSchemasAtPath(schema, path, maxRecursionDepth2),
844
787
  slimPrimitivesOf: (schema, _maxRecursionDepth) => slimPrimitivesV3(schema),
845
788
  deriveDefault: (schema, useDefault) => getDefaultValuesFromZodSchema(schema, useDefault),
846
789
  runGetDefaults: (schema, config, maxRecursionDepth2) => runGetDefaultsV3(schema, config, maxRecursionDepth2),
790
+ validateSync,
847
791
  unwrapStructuralWrappers: (schema) => unwrapStructuralLeafV3(schema),
848
792
  unwrapToDiscriminatedUnion: (schema) => unwrapToDiscriminatedUnion(schema),
849
793
  peelAllWrappers: (schema) => peelAllV3Wrappers(schema),
@@ -858,13 +802,13 @@ function buildV3Services(maxRecursionDepth) {
858
802
  const result = await schema.safeParseAsync(data);
859
803
  return result.success ? { success: true, data: result.data } : { success: false, issues: refileIssues(schema, data, result.error.issues) };
860
804
  },
861
- // v3 returns the full recursive AbstractSchema for sub-schemas (the
862
- // historical shape) — `getSchemasAtPath` consumers may probe any
863
- // method on the result. The factory call rebuilds the full surface
864
- // against the sub-schema with its own per-form caches.
805
+ // A `getSchemasAtPath` consumer may probe any method on the result,
806
+ // so a sub-schema comes back as a full recursive AbstractSchema: the
807
+ // factory call rebuilds the whole surface against it, with its own
808
+ // per-form caches, and walks its capabilities without the memo.
865
809
  makeSubSchema: (sub, maxRecursionDepth2) => createAbstractSchema(
866
810
  sub,
867
- V3_INTROSPECTOR,
811
+ V3_SUB_SCHEMA_INTROSPECTOR,
868
812
  buildV3Services(maxRecursionDepth2),
869
813
  { maxRecursionDepth: maxRecursionDepth2 }
870
814
  )
@@ -887,17 +831,16 @@ function zodIssuesToValidationErrors(issues) {
887
831
  }
888
832
  validationErrors.push({
889
833
  message: issue.message,
890
- // `ValidationError.path` is `(string | number)[]` per the
891
- // public type. v3's `issue.path` is the same in the standard
892
- // case, but a custom check via `ctx.addIssue({ path: [...] })`
893
- // can smuggle a Symbol through — the public surface promised
894
- // strings/numbers, so coerce defensively to keep the contract.
895
- // Mirrors v4's behaviour at the same site.
834
+ // `ValidationError.path` is `(string | number)[]` publicly, and
835
+ // v3's `issue.path` matches in the standard case, but a custom
836
+ // check calling `ctx.addIssue({ path: [...] })` can smuggle a
837
+ // Symbol through. Coerce to keep the promise. v4 does the same
838
+ // here.
896
839
  //
897
- // Adapter-side paths stay schema-relative — the validation
898
- // pipeline in `create-form-store.ts` prepends the parent path
899
- // to absolutise, then routes form-level (absolute path length 0)
900
- // entries to the empty-string bucket at storage time.
840
+ // Adapter-side paths stay schema-RELATIVE: the validation pipeline
841
+ // in `core/create-form-store.ts` prepends the parent path to
842
+ // absolutise, then routes form-level entries, those whose absolute
843
+ // path is empty, to the empty-string bucket at storage time.
901
844
  path: coercePathSegments(issue.path),
902
845
  code
903
846
  });
@@ -929,10 +872,10 @@ function unwrapStructuralLeafV3(schema) {
929
872
  return current;
930
873
  }
931
874
  function isStructuralV3Kind(schema) {
932
- 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
933
- // peeling at the next iteration.
934
- isZodSchemaType(schema, "ZodOptional") || isZodSchemaType(schema, "ZodNullable") || isZodSchemaType(schema, "ZodDefault") || isZodSchemaType(schema, "ZodEffects") || // Newer transparent wrappers (v3.23+). Each wraps a single inner
935
- // schema with no structural impact — `peelV3Wrappers` resolves them.
875
+ 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
876
+ // peeling next iteration.
877
+ isZodSchemaType(schema, "ZodOptional") || isZodSchemaType(schema, "ZodNullable") || isZodSchemaType(schema, "ZodDefault") || isZodSchemaType(schema, "ZodEffects") || // Newer transparent wrappers (v3.23+), each wrapping one inner
878
+ // schema with no structural impact. `peelV3Wrappers` resolves them.
936
879
  isZodSchemaType(schema, "ZodPipeline") || isZodSchemaType(schema, "ZodReadonly") || isZodSchemaType(schema, "ZodBranded");
937
880
  }
938
881
  function peelV3Wrappers(schema) {
@@ -1121,7 +1064,8 @@ function runGetDefaultsV3(rootSchema, config, maxRecursionDepth) {
1121
1064
  rootSchema,
1122
1065
  config.useDefaultSchemaValues
1123
1066
  );
1124
- const rawDefaultValues = config.constraints === void 0 ? defaultValuesWithoutConstraints : fixStructuralDefaults(
1067
+ if (config.constraints === void 0) return defaultValuesWithoutConstraints;
1068
+ return fixStructuralDefaults(
1125
1069
  rootSchema,
1126
1070
  mergeDeep(defaultValuesWithoutConstraints, config.constraints),
1127
1071
  config.useDefaultSchemaValues,
@@ -1133,34 +1077,6 @@ function runGetDefaultsV3(rootSchema, config, maxRecursionDepth) {
1133
1077
  unwrapToDiscriminatedUnion: (s) => unwrapToDiscriminatedUnion(s)
1134
1078
  }
1135
1079
  ).data;
1136
- if (containsAsyncTransform(rootSchema)) {
1137
- return {
1138
- data: rawDefaultValues,
1139
- errors: void 0,
1140
- success: true
1141
- };
1142
- }
1143
- try {
1144
- const parseResult = syncSafe(rootSchema).safeParse(rawDefaultValues);
1145
- if (parseResult.success) {
1146
- return {
1147
- data: rawDefaultValues,
1148
- errors: void 0,
1149
- success: true
1150
- };
1151
- }
1152
- return {
1153
- data: rawDefaultValues,
1154
- errors: zodIssuesToValidationErrors(parseResult.error.issues),
1155
- success: false
1156
- };
1157
- } catch {
1158
- return {
1159
- data: rawDefaultValues,
1160
- errors: void 0,
1161
- success: true
1162
- };
1163
- }
1164
1080
  }
1165
1081
 
1166
1082
  function useForm(configuration) {