attaform 0.31.0 → 0.31.2

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 (52) hide show
  1. package/dist/abstract.d.mts +5 -5
  2. package/dist/abstract.mjs +5 -4
  3. package/dist/dev/abstract.mjs +5 -4
  4. package/dist/dev/chunks/devtools.mjs +1 -1
  5. package/dist/dev/directive.mjs +1 -1
  6. package/dist/dev/history.mjs +126 -6
  7. package/dist/dev/index.mjs +6 -5
  8. package/dist/dev/runtime/plugins/attaform.mjs +1 -1
  9. package/dist/dev/shared/{attaform-dev.zlvDr0WB.mjs → attaform-dev.04aupFBW.mjs} +3 -2
  10. package/dist/dev/shared/{attaform-dev.CtyqGia7.mjs → attaform-dev.BKWPjEB2.mjs} +5 -4
  11. package/dist/dev/shared/{attaform-dev.DlaT4xGd.mjs → attaform-dev.BnLLxX2l.mjs} +4 -4
  12. package/dist/dev/shared/{attaform-dev.B1q-x9R9.mjs → attaform-dev.Bu6wgrA5.mjs} +1 -1
  13. package/dist/dev/shared/{attaform-dev.k5X47GMD.mjs → attaform-dev.CKSqs_xQ.mjs} +3 -2
  14. package/dist/dev/shared/{attaform-dev.DJ3nsWw6.mjs → attaform-dev.Cf_hZfbT.mjs} +18 -9
  15. package/dist/dev/shared/{attaform-dev.y9x9Vp9F.mjs → attaform-dev.DLk51W7-.mjs} +565 -926
  16. package/dist/dev/shared/attaform-dev.DoG8mZTq.mjs +127 -0
  17. package/dist/dev/shared/attaform-dev.G-3XDl9F.mjs +1192 -0
  18. package/dist/dev/shared/{attaform-dev.Caibt7sb.mjs → attaform-dev.oguHqv1W.mjs} +11 -10
  19. package/dist/dev/zod-v3.mjs +7 -6
  20. package/dist/dev/zod-v4.mjs +7 -6
  21. package/dist/dev/zod.mjs +6 -5
  22. package/dist/directive.d.mts +2 -2
  23. package/dist/directive.mjs +1 -1
  24. package/dist/history.d.mts +1 -1
  25. package/dist/history.mjs +126 -6
  26. package/dist/index.d.mts +16 -55
  27. package/dist/index.mjs +6 -5
  28. package/dist/runtime/plugins/attaform.mjs +1 -1
  29. package/dist/shared/{attaform.DL2nl_QR.mjs → attaform.3kV6PqVJ.mjs} +11 -10
  30. package/dist/shared/{attaform.L011tHgJ.mjs → attaform.BJeiuJE2.mjs} +4 -4
  31. package/dist/shared/attaform.BNUhW4qC.mjs +103 -0
  32. package/dist/shared/{attaform.CdZIEf7_.mjs → attaform.BhtAZysa.mjs} +3 -2
  33. package/dist/shared/{attaform.BWUn8Kjy.mjs → attaform.BlAmZ-WU.mjs} +18 -9
  34. package/dist/shared/{attaform.LUPC-2Qg.mjs → attaform.CMzc4bPI.mjs} +5 -4
  35. package/dist/shared/{attaform.C4shmwyJ.mjs → attaform.CdA9bfRv.mjs} +1 -1
  36. package/dist/shared/attaform.CgyyJVuq.mjs +1187 -0
  37. package/dist/shared/{attaform.DAo0QBmS.d.mts → attaform.CibLYe9-.d.mts} +214 -173
  38. package/dist/shared/{attaform.DNPJPOO7.mjs → attaform.DCUJCKyG.mjs} +562 -925
  39. package/dist/shared/{attaform.D9RqPgGu.d.mts → attaform.DCyZT7u-.d.mts} +1 -1
  40. package/dist/shared/{attaform.CRVe8s82.d.mts → attaform.DD0Y8krq.d.mts} +43 -19
  41. package/dist/shared/{attaform.DxKQsqFZ.mjs → attaform.T0YjhjPU.mjs} +3 -2
  42. package/dist/shared/{attaform.DZnrDrNb.d.mts → attaform.bI_4nKZp.d.mts} +119 -8
  43. package/dist/zod-v3.d.mts +4 -4
  44. package/dist/zod-v3.mjs +7 -6
  45. package/dist/zod-v4.d.mts +15 -11
  46. package/dist/zod-v4.mjs +7 -6
  47. package/dist/zod.d.mts +4 -4
  48. package/dist/zod.mjs +6 -5
  49. package/package.json +2 -1
  50. package/skills/attaform/SKILL.md +1 -0
  51. package/dist/dev/shared/attaform-dev.CZz4GYZ6.mjs +0 -386
  52. package/dist/shared/attaform.8mfKZCwH.mjs +0 -358
@@ -0,0 +1,103 @@
1
+ function callConsumerFn(fn, fallback, site, detail) {
2
+ try {
3
+ return fn();
4
+ } catch (err) {
5
+ return fallback;
6
+ }
7
+ }
8
+ function readConsumerProp(obj, key) {
9
+ try {
10
+ return obj[key];
11
+ } catch {
12
+ return void 0;
13
+ }
14
+ }
15
+ function consumerKeys(obj) {
16
+ try {
17
+ return Object.keys(obj);
18
+ } catch {
19
+ return [];
20
+ }
21
+ }
22
+ function readConsumerIndex(arr, i) {
23
+ try {
24
+ return arr[i];
25
+ } catch {
26
+ return void 0;
27
+ }
28
+ }
29
+ function consumerSymbolKeys(obj) {
30
+ try {
31
+ return Object.getOwnPropertySymbols(obj);
32
+ } catch {
33
+ return [];
34
+ }
35
+ }
36
+ function consumerHas(obj, key) {
37
+ try {
38
+ return key in obj;
39
+ } catch {
40
+ return false;
41
+ }
42
+ }
43
+ function consumerExtensible(obj) {
44
+ try {
45
+ return Object.isExtensible(obj);
46
+ } catch {
47
+ return true;
48
+ }
49
+ }
50
+
51
+ function safeAssign(target, key, value) {
52
+ if (key === "__proto__") {
53
+ Object.defineProperty(target, key, {
54
+ value,
55
+ writable: true,
56
+ enumerable: true,
57
+ configurable: true
58
+ });
59
+ return;
60
+ }
61
+ target[key] = value;
62
+ }
63
+ const SHADOWED_KEYS = new Set(Object.getOwnPropertyNames(Object.prototype));
64
+ function isShadowedKey(key) {
65
+ return SHADOWED_KEYS.has(key);
66
+ }
67
+ function safeOwnRead(target, key) {
68
+ if (isShadowedKey(key)) {
69
+ const desc = Object.getOwnPropertyDescriptor(target, key);
70
+ if (desc === void 0) return void 0;
71
+ return "value" in desc ? desc.value : readConsumerProp(target, key);
72
+ }
73
+ return readConsumerProp(target, key);
74
+ }
75
+ function safeOwnHas(target, key) {
76
+ try {
77
+ return Object.prototype.hasOwnProperty.call(target, key);
78
+ } catch {
79
+ return false;
80
+ }
81
+ }
82
+ function spreadConsumerRecord(src) {
83
+ try {
84
+ return { ...src };
85
+ } catch {
86
+ const out = {};
87
+ for (const key of Object.keys(src)) {
88
+ safeAssign(out, key, readConsumerProp(src, key));
89
+ }
90
+ return out;
91
+ }
92
+ }
93
+ function copyConsumerArray(src) {
94
+ try {
95
+ return src.slice();
96
+ } catch {
97
+ const out = new Array(src.length);
98
+ for (let i = 0; i < src.length; i++) out[i] = readConsumerIndex(src, i);
99
+ return out;
100
+ }
101
+ }
102
+
103
+ export { safeOwnRead as a, readConsumerProp as b, consumerKeys as c, safeOwnHas as d, consumerHas as e, spreadConsumerRecord as f, copyConsumerArray as g, callConsumerFn as h, isShadowedKey as i, consumerExtensible as j, consumerSymbolKeys as k, readConsumerIndex as r, safeAssign as s };
@@ -114,7 +114,8 @@ const canonicalStringCache = /* @__PURE__ */ new Map();
114
114
  const PATHKEY_TO_SEGMENTS_MAX = 4096;
115
115
  const pathKeyToSegments = /* @__PURE__ */ new Map();
116
116
  function rememberSegmentsForPathKey(key, segments) {
117
- if (!pathKeyToSegments.has(key) && pathKeyToSegments.size >= PATHKEY_TO_SEGMENTS_MAX) {
117
+ if (pathKeyToSegments.has(key)) return;
118
+ if (pathKeyToSegments.size >= PATHKEY_TO_SEGMENTS_MAX) {
118
119
  const oldest = pathKeyToSegments.keys().next().value;
119
120
  if (oldest !== void 0) pathKeyToSegments.delete(oldest);
120
121
  }
@@ -156,7 +157,7 @@ function canonicalizePath(input) {
156
157
  return keyForSegments(input);
157
158
  }
158
159
  function keyForSegments(input) {
159
- const segments = Array.from(input).map(normalizeSegment);
160
+ const segments = input.map(normalizeSegment);
160
161
  const key = JSON.stringify(segments);
161
162
  rememberSegmentsForPathKey(key, segments);
162
163
  return { segments, key };
@@ -1,7 +1,7 @@
1
- import { j as humanize, c as useAbstractForm } from './attaform.DNPJPOO7.mjs';
2
- import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform.CdZIEf7_.mjs';
3
- import { s as slimPrimitivesWalk, d as deriveDefaultWalk, m as mergeDeep, f as fixStructuralDefaults, w as walkPathSegments, c as createAbstractSchema, a as createSharedSchemaStore, b as buildFieldMetaPathMap, e as getFieldMetaListForSchema, g as getFieldMetaForSchema } from './attaform.DL2nl_QR.mjs';
4
- import { c as callConsumerFn } from './attaform.8mfKZCwH.mjs';
1
+ import { h as humanize, c as useAbstractForm } from './attaform.DCUJCKyG.mjs';
2
+ import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform.BhtAZysa.mjs';
3
+ import { s as slimPrimitivesWalk, d as deriveDefaultWalk, m as mergeDeep, f as fixStructuralDefaults, w as walkPathSegments, c as createAbstractSchema, a as createSharedSchemaStore, b as buildFieldMetaPathMap, e as getFieldMetaListForSchema, g as getFieldMetaForSchema } from './attaform.3kV6PqVJ.mjs';
4
+ import { h as callConsumerFn } from './attaform.BNUhW4qC.mjs';
5
5
 
6
6
  function readDef(schema) {
7
7
  if (schema === null || typeof schema !== "object") return void 0;
@@ -179,6 +179,9 @@ function getDiscriminatedOptions(schema) {
179
179
  return Array.isArray(options) ? options : [];
180
180
  }
181
181
  function assertZodVersion(schema) {
182
+ assertZodV4Node(schema);
183
+ }
184
+ function assertZodV4Node(schema) {
182
185
  const def = readDef(schema);
183
186
  if (def?.type === void 0) {
184
187
  throw new Error(
@@ -237,7 +240,7 @@ function walkCapabilities(node, capabilities, visited) {
237
240
  if (def === void 0) return;
238
241
  const checks = getChecks(node);
239
242
  if (checks.some(isAsyncCheck)) capabilities.asyncRefine = true;
240
- if (checks.length > 0 && CONTAINER_SLOTS.some((key) => def[key] !== void 0)) {
243
+ if (checks.some(isVerdictCheck) && CONTAINER_SLOTS.some((key) => def[key] !== void 0)) {
241
244
  capabilities.containerOrRootRefine = true;
242
245
  }
243
246
  if (typeof def.transform === "function" && def.transform.constructor.name === "AsyncFunction") {
@@ -259,6 +262,11 @@ function walkCapabilities(node, capabilities, visited) {
259
262
  }
260
263
  }
261
264
  }
265
+ function isVerdictCheck(check) {
266
+ if (typeof check !== "object" || check === null) return true;
267
+ const kind = check._zod?.def?.check;
268
+ return kind !== "describe" && kind !== "meta";
269
+ }
262
270
  function isAsyncCheck(check) {
263
271
  if (typeof check !== "object" || check === null) return false;
264
272
  const c = check;
@@ -315,9 +323,9 @@ function zodIssuesToValidationErrors(issues) {
315
323
 
316
324
  const V4_INTROSPECTOR = {
317
325
  kindOf: (schema) => kindOf(schema),
318
- getObjectShape: (schema) => getObjectShape(schema),
326
+ getObjectShape,
319
327
  getTupleItems,
320
- getDiscriminatedOptions: (schema) => getDiscriminatedOptions(schema),
328
+ getDiscriminatedOptions,
321
329
  getDiscriminator,
322
330
  getLiteralValues,
323
331
  isPreprocessNode,
@@ -481,7 +489,7 @@ function isLeafRequired(schema, depth = 0) {
481
489
  return true;
482
490
  }
483
491
  function zodV4Adapter(rootSchema) {
484
- assertZodVersion(rootSchema);
492
+ assertZodV4Node(rootSchema);
485
493
  assertKeyedRoot(rootSchema);
486
494
  return (_formKey, options) => sharedV4Schemas(
487
495
  rootSchema,
@@ -602,7 +610,8 @@ function resolveFieldMetaAtPath(rootSchema, path, maxRecursionDepth) {
602
610
  };
603
611
  }
604
612
  function readDescription(schema) {
605
- const candidate = schema.description;
613
+ const scope = globalThis;
614
+ const candidate = scope.__zod_globalRegistry?.get(schema)?.description ?? schema.description;
606
615
  return typeof candidate === "string" ? candidate : void 0;
607
616
  }
608
617
 
@@ -1,7 +1,8 @@
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
- import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform.CdZIEf7_.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.3kV6PqVJ.mjs';
2
+ import { g as getAtPath } from './attaform.CgyyJVuq.mjs';
3
+ import { h as callConsumerFn } from './attaform.BNUhW4qC.mjs';
4
+ import { h as humanize, c as useAbstractForm } from './attaform.DCUJCKyG.mjs';
5
+ import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform.BhtAZysa.mjs';
5
6
 
6
7
  function isZodSchemaType(schema, expectedType) {
7
8
  if (typeof schema !== "object" || schema === null) return false;
@@ -1,4 +1,4 @@
1
- import { c as RegistryNotInstalledError, O as OutsideSetupError, g as pathKeyToDotted } from './attaform.CdZIEf7_.mjs';
1
+ import { c as RegistryNotInstalledError, O as OutsideSetupError, g as pathKeyToDotted } from './attaform.BhtAZysa.mjs';
2
2
  import { shallowReactive, getCurrentInstance, inject } from 'vue';
3
3
 
4
4
  function detectSSR(options = {}) {