attaform 0.16.2 → 0.16.4

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 (67) hide show
  1. package/README.md +7 -7
  2. package/dist/chunks/devtools.cjs +1 -1
  3. package/dist/chunks/devtools.mjs +1 -1
  4. package/dist/index.cjs +3 -2
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +33 -4
  7. package/dist/index.d.mts +33 -4
  8. package/dist/index.d.ts +33 -4
  9. package/dist/index.mjs +3 -3
  10. package/dist/nuxt.d.cts +1 -1
  11. package/dist/nuxt.d.mts +1 -1
  12. package/dist/nuxt.d.ts +1 -1
  13. package/dist/shared/attaform.C8CyvYa_.cjs +36 -0
  14. package/dist/shared/attaform.C8CyvYa_.cjs.map +1 -0
  15. package/dist/shared/{attaform.CWCx2r0x.d.ts → attaform.CCQkY4Ta.d.ts} +1 -1
  16. package/dist/shared/{attaform.c_NzdRyc.cjs → attaform.CIwZtbGV.cjs} +6 -2
  17. package/dist/shared/attaform.CIwZtbGV.cjs.map +1 -0
  18. package/dist/shared/{attaform.CVv9Oh0a.d.mts → attaform.CMRmwGDt.d.cts} +1 -1
  19. package/dist/shared/{attaform.0Gxd_OOx.d.cts → attaform.CU3JperC.d.cts} +193 -27
  20. package/dist/shared/{attaform.0Gxd_OOx.d.mts → attaform.CU3JperC.d.mts} +193 -27
  21. package/dist/shared/{attaform.0Gxd_OOx.d.ts → attaform.CU3JperC.d.ts} +193 -27
  22. package/dist/shared/{attaform.Dq5BabH1.d.cts → attaform.CXMOheyZ.d.mts} +1 -1
  23. package/dist/shared/attaform.D13GMFgK.mjs +32 -0
  24. package/dist/shared/attaform.D13GMFgK.mjs.map +1 -0
  25. package/dist/shared/{attaform.jrxE_xZw.mjs → attaform.DZRj9s0s.mjs} +5 -3
  26. package/dist/shared/attaform.DZRj9s0s.mjs.map +1 -0
  27. package/dist/shared/{attaform.Bp1c-uGF.cjs → attaform.Dd_pWnmn.cjs} +17 -29
  28. package/dist/shared/attaform.Dd_pWnmn.cjs.map +1 -0
  29. package/dist/shared/{attaform.DILbdvfo.mjs → attaform.DyV1O4tI.mjs} +111 -22
  30. package/dist/shared/attaform.DyV1O4tI.mjs.map +1 -0
  31. package/dist/shared/{attaform.DdnithOf.mjs → attaform.UA19EF3J.mjs} +17 -29
  32. package/dist/shared/attaform.UA19EF3J.mjs.map +1 -0
  33. package/dist/shared/{attaform.C9Ph2SMx.cjs → attaform.fegmBJaq.cjs} +111 -21
  34. package/dist/shared/attaform.fegmBJaq.cjs.map +1 -0
  35. package/dist/shared/{attaform.CvOXSpCb.mjs → attaform.g7rfuXdz.mjs} +13 -16
  36. package/dist/shared/attaform.g7rfuXdz.mjs.map +1 -0
  37. package/dist/shared/{attaform.DfrYByDj.cjs → attaform.keLBaHB6.cjs} +13 -16
  38. package/dist/shared/attaform.keLBaHB6.cjs.map +1 -0
  39. package/dist/zod-v3.cjs +2 -2
  40. package/dist/zod-v3.d.cts +19 -14
  41. package/dist/zod-v3.d.mts +19 -14
  42. package/dist/zod-v3.d.ts +19 -14
  43. package/dist/zod-v3.mjs +2 -2
  44. package/dist/zod-v4.cjs +2 -2
  45. package/dist/zod-v4.d.cts +94 -5
  46. package/dist/zod-v4.d.mts +94 -5
  47. package/dist/zod-v4.d.ts +94 -5
  48. package/dist/zod-v4.mjs +2 -2
  49. package/dist/zod.cjs +23 -5
  50. package/dist/zod.cjs.map +1 -1
  51. package/dist/zod.d.cts +51 -7
  52. package/dist/zod.d.mts +51 -7
  53. package/dist/zod.d.ts +51 -7
  54. package/dist/zod.mjs +22 -5
  55. package/dist/zod.mjs.map +1 -1
  56. package/package.json +1 -1
  57. package/dist/shared/attaform.BAuJTWuT.d.mts +0 -84
  58. package/dist/shared/attaform.Bp1c-uGF.cjs.map +0 -1
  59. package/dist/shared/attaform.C9Ph2SMx.cjs.map +0 -1
  60. package/dist/shared/attaform.CvOXSpCb.mjs.map +0 -1
  61. package/dist/shared/attaform.DILbdvfo.mjs.map +0 -1
  62. package/dist/shared/attaform.DdnithOf.mjs.map +0 -1
  63. package/dist/shared/attaform.DfrYByDj.cjs.map +0 -1
  64. package/dist/shared/attaform.c_NzdRyc.cjs.map +0 -1
  65. package/dist/shared/attaform.jrxE_xZw.mjs.map +0 -1
  66. package/dist/shared/attaform.ls_7jBYc.d.ts +0 -84
  67. package/dist/shared/attaform.xIcmqscx.d.cts +0 -84
@@ -1,84 +0,0 @@
1
- import { z } from 'zod';
2
- import { n as FieldMetaPayload } from './attaform.0Gxd_OOx.js';
3
-
4
- /**
5
- * Field-metadata write/read API for the Zod v4 adapter.
6
- *
7
- * Backed by Zod 4's native `z.registry<T>()` mechanism — the schema
8
- * carries the metadata directly through `schema.register(fieldMeta,
9
- * payload)` (returns the schema, chainable) or the `withMeta()`
10
- * helper (same effect, version-agnostic across the v3 / v4 adapter
11
- * split).
12
- *
13
- * **Registration patterns:** both styles work — register on whatever
14
- * schema reference you assign into the parent's shape, OR on the
15
- * inner schema before wrapping. The adapter's resolver tries the
16
- * walker-returned schema first, then falls back to the peeled
17
- * inner so either ordering hits:
18
- *
19
- * // both equivalent — registry hits at lookup time
20
- * withMeta(z.string(), { label: 'Email' }).optional()
21
- * withMeta(z.string().optional(), { label: 'Email' })
22
- * z.string().optional().register(fieldMeta, { label: 'Email' })
23
- * z.string().register(fieldMeta, { label: 'Email' }).optional()
24
- *
25
- * The path walker returns the wrapper at terminal positions
26
- * (`['email']` against `{ email: z.string().optional() }` resolves
27
- * to `ZodOptional<ZodString>`) and peels at intermediate descent
28
- * (`['address', 'street']` peels through `address`'s wrapper to
29
- * reach the inner object). The two-stage lookup covers both leaf
30
- * and container registrations symmetrically.
31
- */
32
-
33
- /**
34
- * The shared registry every Attaform-aware Zod 4 schema can register
35
- * field metadata against. One module-scoped instance per consumer
36
- * project — re-exported from `attaform/zod` so user code reads the
37
- * same registry the runtime does.
38
- *
39
- * Consumers extending `FieldMetaPayload` via declaration merging
40
- * automatically get the richer payload type at every `register` /
41
- * `add` / `get` call site.
42
- *
43
- * **Shared-instance disambiguation.** A single schema instance reused
44
- * at multiple form paths (e.g. one address schema bound to both
45
- * `pickup` and `delivery`) can carry distinct metadata per path —
46
- * even via the canonical `schema.register(fieldMeta, payload)` chain.
47
- * Internally we maintain a parallel WeakMap of payload LISTS indexed
48
- * per schema reference, and the path-resolver walks the form's
49
- * schema tree counting per-schema occurrences to pick the right
50
- * payload for each path. Object literals evaluate left-to-right, so
51
- * registration order matches tree-walk order, and shared schemas
52
- * pair their two registrations to the two paths correctly:
53
- *
54
- * z.object({
55
- * pickup: addressSchema.register(fieldMeta, { label: 'Pickup address' }),
56
- * delivery: addressSchema.register(fieldMeta, { label: 'Delivery address' }),
57
- * })
58
- * // form.fields('pickup').label → 'Pickup address'
59
- * // form.fields('delivery').label → 'Delivery address'
60
- *
61
- * Schemas reused via `withMeta()` get a fresh clone per call (see
62
- * `withMeta` below), so they never share a registry slot in the
63
- * first place.
64
- */
65
- declare const fieldMeta: z.core.$ZodRegistry<FieldMetaPayload, z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
66
- /**
67
- * Attach `payload` to `schema` in the shared `fieldMeta` registry
68
- * and return `schema` (chainable). Cross-version with `attaform/zod-v3`'s
69
- * `withMeta()`; user code that uses this helper reads the same on
70
- * either adapter.
71
- *
72
- * Equivalent to `schema.register(fieldMeta, payload)` on Zod 4.
73
- * Prefer the native chain for v4-only code; reach for `withMeta`
74
- * when authoring schema modules that may need to compile under both
75
- * adapters.
76
- *
77
- * Registers on the schema reference passed in. See the
78
- * "Registration rule" note in this file's header — register on the
79
- * inner schema before wrapping with `.optional()` / `.nullable()` /
80
- * `.default()` / etc.
81
- */
82
- declare function withMeta<S extends z.ZodType>(schema: S, payload: FieldMetaPayload): S;
83
-
84
- export { fieldMeta as f, withMeta as w };
@@ -1,84 +0,0 @@
1
- import { z } from 'zod';
2
- import { n as FieldMetaPayload } from './attaform.0Gxd_OOx.cjs';
3
-
4
- /**
5
- * Field-metadata write/read API for the Zod v4 adapter.
6
- *
7
- * Backed by Zod 4's native `z.registry<T>()` mechanism — the schema
8
- * carries the metadata directly through `schema.register(fieldMeta,
9
- * payload)` (returns the schema, chainable) or the `withMeta()`
10
- * helper (same effect, version-agnostic across the v3 / v4 adapter
11
- * split).
12
- *
13
- * **Registration patterns:** both styles work — register on whatever
14
- * schema reference you assign into the parent's shape, OR on the
15
- * inner schema before wrapping. The adapter's resolver tries the
16
- * walker-returned schema first, then falls back to the peeled
17
- * inner so either ordering hits:
18
- *
19
- * // both equivalent — registry hits at lookup time
20
- * withMeta(z.string(), { label: 'Email' }).optional()
21
- * withMeta(z.string().optional(), { label: 'Email' })
22
- * z.string().optional().register(fieldMeta, { label: 'Email' })
23
- * z.string().register(fieldMeta, { label: 'Email' }).optional()
24
- *
25
- * The path walker returns the wrapper at terminal positions
26
- * (`['email']` against `{ email: z.string().optional() }` resolves
27
- * to `ZodOptional<ZodString>`) and peels at intermediate descent
28
- * (`['address', 'street']` peels through `address`'s wrapper to
29
- * reach the inner object). The two-stage lookup covers both leaf
30
- * and container registrations symmetrically.
31
- */
32
-
33
- /**
34
- * The shared registry every Attaform-aware Zod 4 schema can register
35
- * field metadata against. One module-scoped instance per consumer
36
- * project — re-exported from `attaform/zod` so user code reads the
37
- * same registry the runtime does.
38
- *
39
- * Consumers extending `FieldMetaPayload` via declaration merging
40
- * automatically get the richer payload type at every `register` /
41
- * `add` / `get` call site.
42
- *
43
- * **Shared-instance disambiguation.** A single schema instance reused
44
- * at multiple form paths (e.g. one address schema bound to both
45
- * `pickup` and `delivery`) can carry distinct metadata per path —
46
- * even via the canonical `schema.register(fieldMeta, payload)` chain.
47
- * Internally we maintain a parallel WeakMap of payload LISTS indexed
48
- * per schema reference, and the path-resolver walks the form's
49
- * schema tree counting per-schema occurrences to pick the right
50
- * payload for each path. Object literals evaluate left-to-right, so
51
- * registration order matches tree-walk order, and shared schemas
52
- * pair their two registrations to the two paths correctly:
53
- *
54
- * z.object({
55
- * pickup: addressSchema.register(fieldMeta, { label: 'Pickup address' }),
56
- * delivery: addressSchema.register(fieldMeta, { label: 'Delivery address' }),
57
- * })
58
- * // form.fields('pickup').label → 'Pickup address'
59
- * // form.fields('delivery').label → 'Delivery address'
60
- *
61
- * Schemas reused via `withMeta()` get a fresh clone per call (see
62
- * `withMeta` below), so they never share a registry slot in the
63
- * first place.
64
- */
65
- declare const fieldMeta: z.core.$ZodRegistry<FieldMetaPayload, z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
66
- /**
67
- * Attach `payload` to `schema` in the shared `fieldMeta` registry
68
- * and return `schema` (chainable). Cross-version with `attaform/zod-v3`'s
69
- * `withMeta()`; user code that uses this helper reads the same on
70
- * either adapter.
71
- *
72
- * Equivalent to `schema.register(fieldMeta, payload)` on Zod 4.
73
- * Prefer the native chain for v4-only code; reach for `withMeta`
74
- * when authoring schema modules that may need to compile under both
75
- * adapters.
76
- *
77
- * Registers on the schema reference passed in. See the
78
- * "Registration rule" note in this file's header — register on the
79
- * inner schema before wrapping with `.optional()` / `.nullable()` /
80
- * `.default()` / etc.
81
- */
82
- declare function withMeta<S extends z.ZodType>(schema: S, payload: FieldMetaPayload): S;
83
-
84
- export { fieldMeta as f, withMeta as w };