attaform 0.29.0 → 0.30.1

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 (79) hide show
  1. package/dist/abstract.d.mts +15 -21
  2. package/dist/abstract.mjs +4 -4
  3. package/dist/dev/abstract.mjs +4 -4
  4. package/dist/dev/chunks/dev-key-collision-warnings.mjs +47 -8
  5. package/dist/dev/chunks/devtools.mjs +2 -2
  6. package/dist/dev/directive.mjs +1 -1
  7. package/dist/dev/history.mjs +1 -2
  8. package/dist/dev/index.mjs +5 -5
  9. package/dist/dev/runtime/plugins/attaform.mjs +3 -3
  10. package/dist/dev/shared/{attaform-dev.BO-71R54.mjs → attaform-dev.BJK1kqHY.mjs} +44 -198
  11. package/dist/dev/shared/{attaform-dev.D8aoKb89.mjs → attaform-dev.BMQ3GcgD.mjs} +51 -64
  12. package/dist/dev/shared/{attaform-dev.BgM6FdtA.mjs → attaform-dev.BUIFcTYf.mjs} +94 -62
  13. package/dist/dev/shared/{attaform-dev.q6UutkCx.mjs → attaform-dev.CT7MDjPy.mjs} +92 -152
  14. package/dist/dev/shared/{attaform-dev.ButTkwHd.mjs → attaform-dev.CZz4GYZ6.mjs} +26 -15
  15. package/dist/dev/shared/{attaform-dev.DD5m2W51.mjs → attaform-dev.Chm4D6SJ.mjs} +2 -4
  16. package/dist/dev/shared/{attaform-dev.DrzObAZo.mjs → attaform-dev.DuEE4GU1.mjs} +4 -4
  17. package/dist/dev/shared/{attaform-dev.DHuydLAC.mjs → attaform-dev.DxHdkkPG.mjs} +674 -734
  18. package/dist/dev/shared/{attaform-dev.A-TpJW0B.mjs → attaform-dev.zlvDr0WB.mjs} +3 -21
  19. package/dist/dev/zod-v3.mjs +6 -6
  20. package/dist/dev/zod-v4.mjs +6 -6
  21. package/dist/dev/zod.mjs +5 -5
  22. package/dist/directive.d.mts +4 -4
  23. package/dist/directive.mjs +1 -1
  24. package/dist/esbuild.d.mts +11 -0
  25. package/dist/esbuild.mjs +1 -1
  26. package/dist/history.d.mts +3 -32
  27. package/dist/history.mjs +1 -2
  28. package/dist/index.d.mts +67 -70
  29. package/dist/index.mjs +5 -5
  30. package/dist/nuxt.d.mts +6 -14
  31. package/dist/nuxt.mjs +3 -7
  32. package/dist/rollup.d.mts +11 -0
  33. package/dist/rollup.mjs +1 -1
  34. package/dist/rspack.d.mts +19 -11
  35. package/dist/rspack.mjs +1 -1
  36. package/dist/runtime/components/AttaformDevtoolsPanel.vue +12 -12
  37. package/dist/runtime/components/DevtoolsValueTree.vue +2 -2
  38. package/dist/runtime/plugins/attaform.mjs +3 -3
  39. package/dist/shared/{attaform.CIWLMY-R.d.mts → attaform.2FslhB9R.d.mts} +83 -95
  40. package/dist/shared/{attaform.Cvao8bW5.mjs → attaform.8mfKZCwH.mjs} +7 -7
  41. package/dist/shared/{attaform.DRUT703x.d.mts → attaform.B-Tb62qV.d.mts} +12 -12
  42. package/dist/shared/{attaform.v0fQtWyA.mjs → attaform.B1rH9ht6.mjs} +1 -1
  43. package/dist/shared/{attaform.BndjUUYX.mjs → attaform.B2iebkPA.mjs} +4 -4
  44. package/dist/shared/{attaform.DhnPb6nK.mjs → attaform.BAf3UNn4.mjs} +1 -1
  45. package/dist/shared/{attaform.CZMAYwSK.mjs → attaform.BIWicztt.mjs} +651 -678
  46. package/dist/shared/attaform.BcQwgWaq.d.mts +2153 -0
  47. package/dist/shared/attaform.Br8EBn5B.d.mts +4553 -0
  48. package/dist/shared/{attaform.C2MVyuxC.mjs → attaform.CO918TdU.mjs} +44 -198
  49. package/dist/shared/{attaform.CZYt_5N_.mjs → attaform.CdZIEf7_.mjs} +1 -19
  50. package/dist/shared/{attaform.B0dKL8ST.mjs → attaform.DRsANMok.mjs} +94 -62
  51. package/dist/shared/{attaform.DffRL5pP.mjs → attaform.D_f1WgYf.mjs} +46 -59
  52. package/dist/shared/{attaform.D1fnTifF.mjs → attaform.D_pt1gOj.mjs} +92 -150
  53. package/dist/shared/attaform.L0kUn3vL.d.mts +42 -0
  54. package/dist/shared/{attaform.D0x-qSXm.mjs → attaform.WiGdIqgx.mjs} +1 -3
  55. package/dist/shared/{attaform.BK0cgu2K.mjs → attaform.ZYn2ahzJ.mjs} +3 -3
  56. package/dist/transforms.d.mts +153 -26
  57. package/dist/transforms.mjs +1 -1
  58. package/dist/vite.d.mts +29 -52
  59. package/dist/vite.mjs +8 -3
  60. package/dist/webpack.d.mts +20 -12
  61. package/dist/webpack.mjs +1 -1
  62. package/dist/zod-v3.d.mts +90 -96
  63. package/dist/zod-v3.mjs +6 -6
  64. package/dist/zod-v4.d.mts +119 -119
  65. package/dist/zod-v4.mjs +6 -6
  66. package/dist/zod.d.mts +5 -5
  67. package/dist/zod.mjs +5 -5
  68. package/package.json +9 -7
  69. package/skills/attaform/SKILL.md +1 -1
  70. package/skills/attaform/references/custom-components.md +1 -1
  71. package/dist/chunks/fingerprint.mjs +0 -183
  72. package/dist/chunks/fingerprint2.mjs +0 -159
  73. package/dist/dev/chunks/fingerprint.mjs +0 -183
  74. package/dist/dev/chunks/fingerprint2.mjs +0 -159
  75. package/dist/dev/shared/attaform-dev.BxfsuwBR.mjs +0 -44
  76. package/dist/shared/attaform.BxfsuwBR.mjs +0 -44
  77. package/dist/shared/attaform.CsoeRi3P.d.mts +0 -5155
  78. package/dist/shared/attaform.DDtqHYv1.d.mts +0 -2465
  79. package/dist/shared/attaform.axHXVQO7.d.mts +0 -44
@@ -1,18 +1,42 @@
1
- import { A as AttaformErrorCode, n as isPlainRecord, s as slimKindOf, o as crossCopyState } from './attaform.CZMAYwSK.mjs';
2
- import { e as canonicalizePath, h as SET_MEMBER_SEGMENT } from './attaform.CZYt_5N_.mjs';
3
- import { a as safeOwnRead, b as safeAssign } from './attaform.Cvao8bW5.mjs';
1
+ import { A as AttaformErrorCode, k as isPlainRecord, s as slimKindOf } from './attaform.BIWicztt.mjs';
2
+ import { e as canonicalizePath, h as SET_MEMBER_SEGMENT } from './attaform.CdZIEf7_.mjs';
3
+ import { a as safeOwnRead, b as safeAssign } from './attaform.8mfKZCwH.mjs';
4
4
 
5
5
  const PATH_SEPARATOR = ".";
6
6
  function isOpaqueKind(kind) {
7
7
  return kind === "any" || kind === "unknown" || kind === "custom";
8
8
  }
9
- function createAbstractSchema(rootSchema, intro, services, formKey, options) {
9
+ const MEMO_CAP = 4096;
10
+ const ROOT_KINDS = /* @__PURE__ */ new Set(["object"]);
11
+ const NO_KINDS = /* @__PURE__ */ new Set();
12
+ function memoPut(memo, key, value) {
13
+ if (memo.size >= MEMO_CAP) memo.clear();
14
+ memo.set(key, value);
15
+ return value;
16
+ }
17
+ function createSharedSchemaStore() {
18
+ const bySchema = /* @__PURE__ */ new WeakMap();
19
+ return (rootSchema, maxRecursionDepth, build) => {
20
+ let byDepth = bySchema.get(rootSchema);
21
+ if (byDepth === void 0) {
22
+ byDepth = /* @__PURE__ */ new Map();
23
+ bySchema.set(rootSchema, byDepth);
24
+ }
25
+ const hit = byDepth.get(maxRecursionDepth);
26
+ if (hit !== void 0) return hit;
27
+ const built = build();
28
+ byDepth.set(maxRecursionDepth, built);
29
+ return built;
30
+ };
31
+ }
32
+ function createAbstractSchema(rootSchema, intro, services, options) {
10
33
  const maxRecursionDepth = options.maxRecursionDepth;
11
34
  const leafCache = /* @__PURE__ */ new Map();
12
35
  const preprocessOrCoerceCache = /* @__PURE__ */ new Map();
13
36
  const opaqueLeafCache = /* @__PURE__ */ new Map();
14
37
  const discriminatorCache = /* @__PURE__ */ new Map();
15
38
  const entryKeyKindCache = /* @__PURE__ */ new Map();
39
+ const slimKindsCache = /* @__PURE__ */ new Map();
16
40
  let asyncValidationFlag = null;
17
41
  let containerRefineFlag = null;
18
42
  let discriminatedUnionFlag = null;
@@ -56,7 +80,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
56
80
  if (intro.kindOf(litSchema) !== "literal") continue;
57
81
  const literalValues = intro.getLiteralValues(litSchema);
58
82
  if (literalValues.includes(value)) {
59
- return services.deriveDefault(opt, true, maxRecursionDepth, formKey);
83
+ return services.deriveDefault(opt, true, maxRecursionDepth);
60
84
  }
61
85
  }
62
86
  return void 0;
@@ -67,7 +91,6 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
67
91
  };
68
92
  }
69
93
  const abstractSchema = {
70
- fingerprint: () => services.fingerprint(rootSchema),
71
94
  needsAsyncValidation() {
72
95
  asyncValidationFlag ?? (asyncValidationFlag = intro.containsAsyncRefine(rootSchema) || intro.containsAsyncTransform(rootSchema));
73
96
  return asyncValidationFlag;
@@ -81,24 +104,24 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
81
104
  return discriminatedUnionFlag;
82
105
  },
83
106
  getDefaultValues(config) {
84
- return services.runStrictGetDefaults(rootSchema, config, formKey, maxRecursionDepth);
107
+ return services.runGetDefaults(rootSchema, config, maxRecursionDepth);
85
108
  },
86
109
  getDefaultAtPath(path) {
87
110
  if (path.length === 0) {
88
- return services.deriveDefault(rootSchema, true, maxRecursionDepth, formKey);
111
+ return services.deriveDefault(rootSchema, true, maxRecursionDepth);
89
112
  }
90
113
  const [first] = services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth);
91
114
  if (first === void 0) return void 0;
92
115
  const peeled = services.unwrapStructuralWrappers(first);
93
- return services.deriveDefault(peeled, true, maxRecursionDepth, formKey);
116
+ return services.deriveDefault(peeled, true, maxRecursionDepth);
94
117
  },
95
118
  getEmptyValueAtPath(path) {
96
119
  if (path.length === 0) {
97
- return services.deriveDefault(rootSchema, false, maxRecursionDepth, formKey);
120
+ return services.deriveDefault(rootSchema, false, maxRecursionDepth);
98
121
  }
99
122
  const [first] = services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth);
100
123
  if (first === void 0) return void 0;
101
- return services.deriveDefault(first, false, maxRecursionDepth, formKey);
124
+ return services.deriveDefault(first, false, maxRecursionDepth);
102
125
  },
103
126
  arrayShapeAtPath(path) {
104
127
  if (path.length === 0) return null;
@@ -139,25 +162,27 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
139
162
  answer = void 0;
140
163
  }
141
164
  }
142
- entryKeyKindCache.set(cacheKey, answer);
143
- return answer;
165
+ return memoPut(entryKeyKindCache, cacheKey, answer);
144
166
  },
145
167
  getSchemasAtPath(path) {
146
168
  const resolved = services.getNestedSchemasInSlimMode(rootSchema, path, maxRecursionDepth);
147
169
  if (resolved.length === 0) return [];
148
- return resolved.map((sub) => services.makeSubSchema(sub, formKey, maxRecursionDepth));
170
+ return resolved.map((sub) => services.makeSubSchema(sub, maxRecursionDepth));
149
171
  },
150
172
  getSlimPrimitiveTypesAtPath(path) {
151
- if (path.length === 0) return /* @__PURE__ */ new Set(["object"]);
173
+ if (path.length === 0) return ROOT_KINDS;
174
+ const cacheKey = canonicalizePath(path).key;
175
+ const hit = slimKindsCache.get(cacheKey);
176
+ if (hit !== void 0) return hit;
152
177
  const resolved = services.getNestedSchemasInSlimMode(rootSchema, path, maxRecursionDepth);
153
- if (resolved.length === 0) return /* @__PURE__ */ new Set();
178
+ if (resolved.length === 0) return memoPut(slimKindsCache, cacheKey, NO_KINDS);
154
179
  const out = /* @__PURE__ */ new Set();
155
180
  for (const candidate of resolved) {
156
181
  for (const k of services.slimPrimitivesOf(candidate, maxRecursionDepth)) {
157
182
  out.add(k);
158
183
  }
159
184
  }
160
- return out;
185
+ return memoPut(slimKindsCache, cacheKey, out);
161
186
  },
162
187
  isLeafAtPath(path) {
163
188
  const cacheKey = canonicalizePath(path).key;
@@ -166,8 +191,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
166
191
  const opaque = path.length > 0 && this.isOpaqueLeafAtPath(path);
167
192
  const prim = opaque ? void 0 : this.getSlimPrimitiveTypesAtPath(path);
168
193
  const isLeaf = opaque || prim !== void 0 && prim.size > 0 && !prim.has("object") && !prim.has("array") && !prim.has("map") && !prim.has("set");
169
- leafCache.set(cacheKey, isLeaf);
170
- return isLeaf;
194
+ return memoPut(leafCache, cacheKey, isLeaf);
171
195
  },
172
196
  isPreprocessOrCoerceLeaf(path) {
173
197
  const cacheKey = canonicalizePath(path).key;
@@ -184,8 +208,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
184
208
  }
185
209
  }
186
210
  }
187
- preprocessOrCoerceCache.set(cacheKey, hit);
188
- return hit;
211
+ return memoPut(preprocessOrCoerceCache, cacheKey, hit);
189
212
  },
190
213
  isOpaqueLeafAtPath(path) {
191
214
  const cacheKey = canonicalizePath(path).key;
@@ -195,8 +218,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
195
218
  const opaque = resolved.length > 0 && resolved.every(
196
219
  (candidate) => isOpaqueKind(intro.kindOf(services.peelAllWrappers(candidate)))
197
220
  );
198
- opaqueLeafCache.set(cacheKey, opaque);
199
- return opaque;
221
+ return memoPut(opaqueLeafCache, cacheKey, opaque);
200
222
  },
201
223
  isRequiredAtPath(path) {
202
224
  if (path.length === 0) return true;
@@ -212,9 +234,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
212
234
  if (discriminatorCache.has(cacheKey)) {
213
235
  return discriminatorCache.get(cacheKey);
214
236
  }
215
- const result = computeDiscriminator(path);
216
- discriminatorCache.set(cacheKey, result);
217
- return result;
237
+ return memoPut(discriminatorCache, cacheKey, computeDiscriminator(path));
218
238
  },
219
239
  validateAtPath(data, path, validateOptions) {
220
240
  const trySync = validateOptions?.sync === true;
@@ -226,11 +246,10 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
226
246
  }
227
247
  return runAsync();
228
248
  function parseResultToResponse(result) {
229
- return result.success ? { data: result.data, errors: void 0, success: true, formKey } : {
249
+ return result.success ? { data: result.data, errors: void 0, success: true } : {
230
250
  data: void 0,
231
251
  errors: services.issuesToValidationErrors(result.issues),
232
- success: false,
233
- formKey
252
+ success: false
234
253
  };
235
254
  }
236
255
  function runSync() {
@@ -245,7 +264,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
245
264
  if (response.success) return response;
246
265
  aggregated.push(...response.errors);
247
266
  }
248
- return { data: void 0, errors: aggregated, success: false, formKey };
267
+ return { data: void 0, errors: aggregated, success: false };
249
268
  }
250
269
  async function runAsync() {
251
270
  if (path === void 0) {
@@ -271,7 +290,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
271
290
  if (response.success) return response;
272
291
  aggregated.push(...response.errors);
273
292
  }
274
- return { data: void 0, errors: aggregated, success: false, formKey };
293
+ return { data: void 0, errors: aggregated, success: false };
275
294
  }
276
295
  function validatorThrewResponse(err, errPath) {
277
296
  const message = err instanceof Error ? err.message : typeof err === "string" ? err : "Validator threw";
@@ -284,8 +303,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
284
303
  code: AttaformErrorCode.ValidatorThrew
285
304
  }
286
305
  ],
287
- success: false,
288
- formKey
306
+ success: false
289
307
  };
290
308
  }
291
309
  function pathNotFound(p) {
@@ -298,8 +316,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
298
316
  code: AttaformErrorCode.PathNotFound
299
317
  }
300
318
  ],
301
- success: false,
302
- formKey
319
+ success: false
303
320
  };
304
321
  }
305
322
  }
@@ -373,6 +390,8 @@ function walkPathSegments(schema, segments, intro, maxDepth, lazyDepth) {
373
390
  case "optional":
374
391
  case "nullable":
375
392
  case "default":
393
+ case "nonoptional":
394
+ case "success":
376
395
  case "readonly":
377
396
  case "catch": {
378
397
  const inner = intro.unwrapInner(schema);
@@ -406,8 +425,8 @@ function walkPathSegments(schema, segments, intro, maxDepth, lazyDepth) {
406
425
  const rightResults = right === void 0 ? [] : walkPathSegments(right, segments, intro, maxDepth, lazyDepth);
407
426
  return [...leftResults, ...rightResults];
408
427
  }
409
- // Leaves — can't descend further. Opaque leaves (`any` /
410
- // `unknown` / `custom`) land here too and `[]` is the truthful
428
+ // Leaves, with nothing further to descend. An opaque leaf (`any` /
429
+ // `unknown` / `custom`) lands here too and `[]` is the truthful
411
430
  // answer: the schema declares no sub-paths under them, so none are
412
431
  // fabricated. `symbol` / `function` / `promise` hold a value
413
432
  // without declaring anything inside it and land here for the same
@@ -446,6 +465,8 @@ function fixNode(schema, value, ctx, lazyDepth) {
446
465
  return inner === void 0 ? value : fixNode(inner, value, ctx, lazyDepth);
447
466
  }
448
467
  case "default":
468
+ case "nonoptional":
469
+ case "success":
449
470
  case "readonly":
450
471
  case "catch": {
451
472
  const inner = intro.unwrapInner(schema);
@@ -611,7 +632,7 @@ function hasDeclaredDefaultInChain(schema, intro) {
611
632
  }
612
633
  return false;
613
634
  }
614
- function deriveDefaultWalk(schema, useDefault, intro, maxDepth, ctx, lazyDepth = 0) {
635
+ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, lazyDepth = 0) {
615
636
  if (useDefault) {
616
637
  const peeled = peelEmbeddedDefault(schema, intro);
617
638
  if (peeled !== NO_EMBEDDED_DEFAULT) return peeled;
@@ -623,11 +644,7 @@ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, ctx, lazyDepth =
623
644
  const shape = intro.getObjectShape(schema);
624
645
  const out = {};
625
646
  for (const [key, subSchema] of Object.entries(shape)) {
626
- safeAssign(
627
- out,
628
- key,
629
- deriveDefaultWalk(subSchema, useDefault, intro, maxDepth, ctx, lazyDepth)
630
- );
647
+ safeAssign(out, key, deriveDefaultWalk(subSchema, useDefault, intro, maxDepth, lazyDepth));
631
648
  }
632
649
  return out;
633
650
  }
@@ -639,19 +656,17 @@ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, ctx, lazyDepth =
639
656
  return {};
640
657
  case "tuple": {
641
658
  const items = intro.getTupleItems(schema);
642
- return items.map(
643
- (item) => deriveDefaultWalk(item, useDefault, intro, maxDepth, ctx, lazyDepth)
644
- );
659
+ return items.map((item) => deriveDefaultWalk(item, useDefault, intro, maxDepth, lazyDepth));
645
660
  }
646
661
  case "union": {
647
662
  const options = intro.getUnionOptions(schema);
648
663
  const first = options[0];
649
- return first === void 0 ? void 0 : deriveDefaultWalk(first, useDefault, intro, maxDepth, ctx, lazyDepth);
664
+ return first === void 0 ? void 0 : deriveDefaultWalk(first, useDefault, intro, maxDepth, lazyDepth);
650
665
  }
651
666
  case "discriminated-union": {
652
667
  const options = intro.getDiscriminatedOptions(schema);
653
668
  const first = options[0];
654
- return first === void 0 ? void 0 : deriveDefaultWalk(first, useDefault, intro, maxDepth, ctx, lazyDepth);
669
+ return first === void 0 ? void 0 : deriveDefaultWalk(first, useDefault, intro, maxDepth, lazyDepth);
655
670
  }
656
671
  case "optional":
657
672
  return void 0;
@@ -660,39 +675,41 @@ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, ctx, lazyDepth =
660
675
  case "default": {
661
676
  if (useDefault) return intro.getDefaultValue(schema);
662
677
  const inner = intro.unwrapInner(schema);
663
- return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth);
678
+ return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth);
664
679
  }
680
+ case "nonoptional":
681
+ case "success":
665
682
  case "readonly":
666
683
  case "branded": {
667
684
  const inner = kind === "branded" ? intro.unwrapBranded(schema) : intro.unwrapInner(schema);
668
- return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth);
685
+ return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth);
669
686
  }
670
687
  case "effects": {
671
688
  const inner = intro.unwrapEffectsSource(schema);
672
689
  if (intro.isPreprocessNode(schema)) {
673
690
  if (inner !== void 0 && hasDeclaredDefaultInChain(inner, intro)) {
674
- return deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth);
691
+ return deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth);
675
692
  }
676
693
  return void 0;
677
694
  }
678
- return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth);
695
+ return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth);
679
696
  }
680
697
  case "pipeline": {
681
698
  const inner = intro.unwrapPipeIn(schema);
682
- return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth);
699
+ return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth);
683
700
  }
684
701
  case "pipe": {
685
702
  const inn = intro.unwrapPipeIn(schema);
686
703
  if (inn !== void 0 && intro.kindOf(inn) === "transform") {
687
704
  const out2 = intro.unwrapPipeOut(schema);
688
705
  if (out2 !== void 0 && hasDeclaredDefaultInChain(out2, intro)) {
689
- return deriveDefaultWalk(out2, useDefault, intro, maxDepth, ctx, lazyDepth);
706
+ return deriveDefaultWalk(out2, useDefault, intro, maxDepth, lazyDepth);
690
707
  }
691
708
  return void 0;
692
709
  }
693
710
  const out = intro.unwrapPipeOut(schema);
694
711
  const real = inn !== void 0 && intro.kindOf(inn) !== "transform" ? inn : out !== void 0 && intro.kindOf(out) !== "transform" ? out : inn ?? out;
695
- return real === void 0 ? void 0 : deriveDefaultWalk(real, useDefault, intro, maxDepth, ctx, lazyDepth);
712
+ return real === void 0 ? void 0 : deriveDefaultWalk(real, useDefault, intro, maxDepth, lazyDepth);
696
713
  }
697
714
  case "string":
698
715
  return "";
@@ -736,19 +753,19 @@ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, ctx, lazyDepth =
736
753
  } catch {
737
754
  return void 0;
738
755
  }
739
- return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth + 1);
756
+ return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth + 1);
740
757
  }
741
758
  case "intersection": {
742
759
  const left = intro.getIntersectionLeft(schema);
743
760
  const right = intro.getIntersectionRight(schema);
744
- const l = left === void 0 ? void 0 : deriveDefaultWalk(left, useDefault, intro, maxDepth, ctx, lazyDepth);
745
- const r = right === void 0 ? void 0 : deriveDefaultWalk(right, useDefault, intro, maxDepth, ctx, lazyDepth);
761
+ const l = left === void 0 ? void 0 : deriveDefaultWalk(left, useDefault, intro, maxDepth, lazyDepth);
762
+ const r = right === void 0 ? void 0 : deriveDefaultWalk(right, useDefault, intro, maxDepth, lazyDepth);
746
763
  return mergeDeep(l, r);
747
764
  }
748
765
  case "catch": {
749
766
  if (useDefault) return intro.getCatchDefault(schema);
750
767
  const inner = intro.unwrapInner(schema);
751
- return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth);
768
+ return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth);
752
769
  }
753
770
  case "file":
754
771
  return null;
@@ -767,10 +784,15 @@ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, ctx, lazyDepth =
767
784
  case "transform":
768
785
  return void 0;
769
786
  default:
770
- return ctx.unsupportedKindFallback(schema, kind);
787
+ return void 0;
771
788
  }
772
789
  }
773
790
 
791
+ function crossCopyState(key, create) {
792
+ const carrier = globalThis;
793
+ return carrier[key] ?? (carrier[key] = create());
794
+ }
795
+
774
796
  const state = crossCopyState(/* @__PURE__ */ Symbol.for("attaform:field-meta-state"), () => ({
775
797
  store: /* @__PURE__ */ new WeakMap(),
776
798
  lists: /* @__PURE__ */ new WeakMap(),
@@ -929,10 +951,20 @@ function slimPrimitivesWalk(schema, intro, maxDepth, lazyDepth = 0) {
929
951
  }
930
952
  case "default":
931
953
  case "readonly":
954
+ case "success":
932
955
  case "catch": {
933
956
  const inner = intro.unwrapInner(schema);
934
957
  return inner === void 0 ? PERMISSIVE_SLIM_KINDS : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth);
935
958
  }
959
+ case "nonoptional": {
960
+ const inner = intro.unwrapInner(schema);
961
+ if (inner === void 0) return PERMISSIVE_SLIM_KINDS;
962
+ const innerSet = slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth);
963
+ if (!innerSet.has("undefined")) return innerSet;
964
+ const out = new Set(innerSet);
965
+ out.delete("undefined");
966
+ return out;
967
+ }
936
968
  case "branded": {
937
969
  const inner = intro.unwrapBranded(schema);
938
970
  return inner === void 0 ? PERMISSIVE_SLIM_KINDS : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth);
@@ -985,7 +1017,7 @@ function slimPrimitivesWalk(schema, intro, maxDepth, lazyDepth = 0) {
985
1017
  case "unknown":
986
1018
  case "custom":
987
1019
  return PERMISSIVE_SLIM_KINDS;
988
- // A kind this walker has no case for — in practice a kind a newer
1020
+ // A kind this walker has no case for, in practice one a newer
989
1021
  // Zod introduced. Be permissive rather than reject: the adapter
990
1022
  // carries the value opaquely and the schema's own parse is what
991
1023
  // decides whether it was legal.
@@ -1167,4 +1199,4 @@ function walkForMeta(schema, path, map, counters, lastPathPerSchema, inProgress,
1167
1199
  }
1168
1200
  }
1169
1201
 
1170
- export { getFieldMetaListForSchema as a, buildFieldMetaPathMap as b, createAbstractSchema as c, deriveDefaultWalk as d, fixStructuralDefaults as f, getFieldMetaForSchema as g, installingFieldMetaStore as i, mergeDeep as m, slimPrimitivesWalk as s, walkPathSegments as w };
1202
+ export { createSharedSchemaStore as a, buildFieldMetaPathMap as b, createAbstractSchema as c, deriveDefaultWalk as d, getFieldMetaListForSchema as e, fixStructuralDefaults as f, getFieldMetaForSchema as g, installingFieldMetaStore as i, mergeDeep as m, slimPrimitivesWalk as s, walkPathSegments as w };
@@ -1,6 +1,6 @@
1
1
  import { reactive, markRaw, effectScope, watch, nextTick } from 'vue';
2
2
  import { i as isRegisterValue, a as isTransforming, S as SSR_COMPONENT_HOST_MODIFIER, R as REGISTER_OWNER_MARKER, b as V_REGISTER_MARKER } from './attaform.KvlEedlF.mjs';
3
- import { e as canonicalizePath } from './attaform.CZYt_5N_.mjs';
3
+ import { e as canonicalizePath } from './attaform.CdZIEf7_.mjs';
4
4
 
5
5
  const INTERACTIVE_TAG_NAMES = /* @__PURE__ */ new Set(["INPUT", "SELECT", "TEXTAREA"]);
6
6
 
@@ -271,7 +271,7 @@ function isCheckboxInput(tagName, type) {
271
271
  return tagName === "INPUT" && typeof type === "string" && type.toLowerCase() === "checkbox";
272
272
  }
273
273
  function applyAria(el, rv, vnode) {
274
- if (rv.ariaEnabled !== true || rv.ariaDisplayState === void 0) return;
274
+ if (rv.ariaDisplayState === void 0) return;
275
275
  if (!INTERACTIVE_TAG_NAMES.has(el.tagName)) return;
276
276
  const locks = el[ariaLockKey] ?? EMPTY_ARIA_LOCKS;
277
277
  const ds = rv.ariaDisplayState.value;
@@ -286,7 +286,7 @@ function applyAria(el, rv, vnode) {
286
286
  }
287
287
  }
288
288
  function setupAria(el, rv, vnode) {
289
- if (rv.ariaEnabled !== true || rv.ariaDisplayState === void 0) return;
289
+ if (rv.ariaDisplayState === void 0) return;
290
290
  if (!INTERACTIVE_TAG_NAMES.has(el.tagName)) return;
291
291
  mergeAriaLocks(el, vnode);
292
292
  applyAria(el, rv, vnode);
@@ -308,7 +308,7 @@ function seedLocksFromDom(el) {
308
308
  }
309
309
  }
310
310
  function setupAriaLive(el, rv) {
311
- if (rv.ariaEnabled !== true || rv.ariaDisplayState === void 0) return;
311
+ if (rv.ariaDisplayState === void 0) return;
312
312
  if (!INTERACTIVE_TAG_NAMES.has(el.tagName)) return;
313
313
  seedLocksFromDom(el);
314
314
  applyAria(el, rv, null);
@@ -320,7 +320,7 @@ function setupAriaLive(el, rv) {
320
320
  el[ariaScopeKey] = () => scope.stop();
321
321
  }
322
322
  function getSSRAriaProps(rv, vnode) {
323
- if (rv.ariaEnabled !== true || rv.ariaDisplayState === void 0) return void 0;
323
+ if (rv.ariaDisplayState === void 0) return void 0;
324
324
  const props = vnode?.props ?? null;
325
325
  const ds = rv.ariaDisplayState.value;
326
326
  const tagName = typeof vnode?.type === "string" ? vnode.type.toUpperCase() : "";
@@ -931,20 +931,15 @@ const vRegisterCheckbox = {
931
931
  el._lastAppliedModel = value.innerRef.value;
932
932
  });
933
933
  },
934
- // Skip the DOM sync when the model is identity-unchanged from the
935
- // last application. Pre-fix the scalar branch in `setChecked`
936
- // gated on `originalValue === oldValue`, comparing a primitive
937
- // scalar against the wrapper RegisterValue object — always !==,
938
- // so the guard was a silent no-op. Array / Set branches lacked
939
- // any guard. The per-render re-apply mirrors the just-fixed
940
- // `vRegisterSelect` shape: a sibling's reactive write triggers
941
- // `beforeUpdate` mid-click, `setChecked` re-applies the prior
942
- // model state, and the in-flight user toggle is clobbered before
943
- // the browser fires `change`. Identity comparison on
944
- // `innerRef.value` is sound for the same reason as multi-select —
945
- // every form write produces a fresh value at the path (new
946
- // primitives; new array/Set references along the spine), so
947
- // reference equality tracks "did the model move" exactly.
934
+ // Skip the DOM sync when the model is identity-unchanged since the last
935
+ // application. Without the guard, a sibling's reactive write triggers
936
+ // `beforeUpdate` mid-click, `setChecked` re-applies the prior model state,
937
+ // and the in-flight toggle is clobbered before the browser fires `change`.
938
+ // Compare `innerRef.value` by identity: every form write produces a fresh
939
+ // value at the path, new primitives and new array or Set references along
940
+ // the spine, so reference equality tracks "did the model move" exactly. The
941
+ // guard must NOT compare against `oldValue`, which is the previous binding's
942
+ // wrapper RegisterValue and never equals a model scalar.
948
943
  beforeUpdate(el, binding, vnode) {
949
944
  setAssignFunction(el, vnode, binding.value);
950
945
  if (!isRegisterValue(binding.value)) return;
@@ -994,13 +989,11 @@ const vRegisterRadio = {
994
989
  }
995
990
  });
996
991
  },
997
- // Initial checked-state sync runs in `mounted`, NOT `created` —
998
- // Vue's directive lifecycle fires `created` BEFORE the element's
999
- // attributes are patched (`type`, `value`, `_value` etc. aren't on
1000
- // the element yet), so `getValue(el)` would return `undefined` and
1001
- // every radio in a group would mount unchecked regardless of the
1002
- // model. Checkbox already uses `mounted: setChecked` for the same
1003
- // reason.
992
+ // The initial checked sync runs in `mounted`, NOT `created`: Vue fires
993
+ // `created` before the element's attributes are patched, so `type`, `value`
994
+ // and `_value` are absent, `getValue(el)` returns undefined, and every radio
995
+ // in a group mounts unchecked whatever the model says. Checkbox uses
996
+ // `mounted` for the same reason.
1004
997
  mounted(el, { value }) {
1005
998
  if (!isRegisterValue(value)) return;
1006
999
  el.checked = looseEqual(value.innerRef.value, applyCoerce(getValue(el), value));
@@ -1010,15 +1003,12 @@ const vRegisterRadio = {
1010
1003
  el._lastAppliedModel = value.innerRef.value;
1011
1004
  });
1012
1005
  },
1013
- // Skip the DOM sync when the model is identity-unchanged from the
1014
- // last application. Pre-fix the guard read `value.innerRef.value
1015
- // !== oldValue`, comparing a primitive scalar against the previous
1016
- // binding's wrapper RegisterValue object — always !==, so the
1017
- // guard was a silent no-op and `el.checked = …` re-applied on
1018
- // every parent re-render. Same shape as the just-fixed
1019
- // `vRegisterSelect` and `setChecked` bugs: a sibling's reactive
1020
- // write triggers `beforeUpdate` mid-click and writes back the
1021
- // prior model state, clobbering the in-flight selection.
1006
+ // Skip the DOM sync when the model is identity-unchanged since the last
1007
+ // application, tracked on `_lastAppliedModel`. Comparing against `oldValue`
1008
+ // instead compares a primitive scalar to the previous binding's wrapper
1009
+ // RegisterValue, never equal, so `el.checked` re-applies on every parent
1010
+ // re-render and a sibling's reactive write clobbers an in-flight selection
1011
+ // mid-click.
1022
1012
  beforeUpdate(el, { value }, vnode) {
1023
1013
  if (!isRegisterValue(value)) return;
1024
1014
  setAssignFunction(el, vnode, value);
@@ -1077,22 +1067,20 @@ const vRegisterSelect = {
1077
1067
  beforeUpdate(el, binding, vnode) {
1078
1068
  setAssignFunction(el, vnode, binding.value);
1079
1069
  },
1080
- // Skip the DOM sync when the model is identity-unchanged from the
1081
- // last application. Parent re-renders fire `updated` whether or not
1082
- // the bound model actually moved (a typed character in a sibling,
1083
- // an async-validation tick, any reactive read elsewhere on the
1084
- // page). Without this guard, every such render unconditionally re-
1085
- // applies `setSelected` against the prior model, which on a
1086
- // `<select multiple>` clobbers any in-progress user selection
1087
- // between mousedown and the browser's change-event decision — the
1088
- // browser then sees no net change, never fires `change`, and the
1089
- // model never updates. Identity comparison is sound: every form
1090
- // write produces a new array/Set reference at the path (the diff-
1091
- // apply replacement of `form.value` rolls forward fresh structures
1092
- // along the spine), so reference equality on `innerRef.value`
1093
- // tracks "did the model move" exactly. The `_assigning` gate stays
1094
- // — it short-circuits the immediate post-write render where the
1095
- // DOM is already in sync from the user's click.
1070
+ // Skip the DOM sync when the model is identity-unchanged since the last
1071
+ // application. A parent re-render fires `updated` whether or not the bound
1072
+ // model moved: a typed character in a sibling, an async-validation tick, any
1073
+ // reactive read elsewhere on the page. Re-applying `setSelected` against the
1074
+ // prior model on each of those clobbers an in-progress `<select multiple>`
1075
+ // selection between mousedown and the browser's change decision, after which
1076
+ // the browser sees no net change, never fires `change`, and the model never
1077
+ // updates.
1078
+ //
1079
+ // Identity comparison is sound: every form write produces a new array or Set
1080
+ // reference at the path, the replacement of `form.value` rolling fresh
1081
+ // structures forward along the spine. The `_assigning` gate stays as well,
1082
+ // short-circuiting the immediate post-write render where the DOM is already
1083
+ // in sync from the user's click.
1096
1084
  updated(el, { value }) {
1097
1085
  if (el._assigning === true) return;
1098
1086
  if (!isRegisterValue(value)) return;
@@ -1264,7 +1252,7 @@ const vRegisterDynamic = {
1264
1252
  callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
1265
1253
  const ariaEl = el;
1266
1254
  const value = binding.value;
1267
- if (!isRegisterValue(value) || value.ariaEnabled !== true || value.ariaDisplayState === void 0) {
1255
+ if (!isRegisterValue(value) || value.ariaDisplayState === void 0) {
1268
1256
  teardownAria(ariaEl);
1269
1257
  } else {
1270
1258
  const old = binding.oldValue;
@@ -1306,13 +1294,12 @@ const vRegisterDynamic = {
1306
1294
  delete el._syncFromStorage;
1307
1295
  delete el[assignKey];
1308
1296
  },
1309
- // The lifecycle hooks above don't run on the server (Vue skips
1310
- // directive lifecycle during SSR), so emit the same aria attributes
1311
- // here from the SSR-time gated display state. Honors authored attrs
1312
- // (vnode-level lockout) and the ariaEnabled gate, touches no DOM, and
1313
- // shares `resolveAriaValue` with the client path. Ids are SSR-stable
1314
- // (formInstanceId derives from Vue's useId), so a server-rendered
1315
- // describedby matches the client after hydration.
1297
+ // Vue skips directive lifecycle during SSR, so the hooks above never run on
1298
+ // the server and the same aria attributes are emitted here from the SSR-time
1299
+ // gated display state. Honours authored attrs through the vnode-level
1300
+ // lockout, touches no DOM, and shares `resolveAriaValue` with the client
1301
+ // path. Ids are SSR-stable, `formInstanceId` deriving from Vue's `useId`, so
1302
+ // a server-rendered describedby matches the client after hydration.
1316
1303
  getSSRProps(binding, vnode) {
1317
1304
  const rv = binding.value;
1318
1305
  if (!isRegisterValue(rv)) return void 0;