attaform 0.14.0 → 0.15.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 (69) hide show
  1. package/dist/chunks/devtools.cjs +3 -3
  2. package/dist/chunks/devtools.cjs.map +1 -1
  3. package/dist/chunks/devtools.mjs +3 -3
  4. package/dist/chunks/devtools.mjs.map +1 -1
  5. package/dist/chunks/indexeddb.cjs +1 -1
  6. package/dist/chunks/indexeddb.mjs +1 -1
  7. package/dist/chunks/local-storage.cjs +1 -1
  8. package/dist/chunks/local-storage.mjs +1 -1
  9. package/dist/chunks/session-storage.cjs +1 -1
  10. package/dist/chunks/session-storage.mjs +1 -1
  11. package/dist/index.cjs +5 -4
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +4 -4
  14. package/dist/index.d.mts +4 -4
  15. package/dist/index.d.ts +4 -4
  16. package/dist/index.mjs +6 -6
  17. package/dist/nuxt.d.cts +1 -1
  18. package/dist/nuxt.d.mts +1 -1
  19. package/dist/nuxt.d.ts +1 -1
  20. package/dist/runtime/plugins/attaform.cjs +1 -1
  21. package/dist/runtime/plugins/attaform.mjs +1 -1
  22. package/dist/shared/{attaform.DDXrY-1Q.d.mts → attaform.0Gxd_OOx.d.cts} +558 -174
  23. package/dist/shared/{attaform.DDXrY-1Q.d.ts → attaform.0Gxd_OOx.d.mts} +558 -174
  24. package/dist/shared/{attaform.DDXrY-1Q.d.cts → attaform.0Gxd_OOx.d.ts} +558 -174
  25. package/dist/shared/{attaform.xKWYHMdq.cjs → attaform.BOi138GE.cjs} +10 -2
  26. package/dist/shared/{attaform.xKWYHMdq.cjs.map → attaform.BOi138GE.cjs.map} +1 -1
  27. package/dist/shared/{attaform.CRgix6_n.cjs → attaform.BgYBU8gV.cjs} +18 -17
  28. package/dist/shared/attaform.BgYBU8gV.cjs.map +1 -0
  29. package/dist/shared/attaform.Bubm_slq.cjs.map +1 -1
  30. package/dist/shared/{attaform.CNJO3mME.cjs → attaform.CDJVeoJU.cjs} +633 -236
  31. package/dist/shared/attaform.CDJVeoJU.cjs.map +1 -0
  32. package/dist/shared/{attaform.DlgKK10S.mjs → attaform.CRk8NhlD.mjs} +18 -17
  33. package/dist/shared/attaform.CRk8NhlD.mjs.map +1 -0
  34. package/dist/shared/{attaform.CXZgUECn.d.cts → attaform.CVv9Oh0a.d.mts} +41 -9
  35. package/dist/shared/{attaform.BYc9kugA.d.ts → attaform.CWCx2r0x.d.ts} +41 -9
  36. package/dist/shared/attaform.CXpzmj38.mjs.map +1 -1
  37. package/dist/shared/{attaform.Cc93zNzD.mjs → attaform.DXye3JKf.mjs} +10 -3
  38. package/dist/shared/{attaform.Cc93zNzD.mjs.map → attaform.DXye3JKf.mjs.map} +1 -1
  39. package/dist/shared/{attaform.DOKOyb3Y.d.mts → attaform.Dq5BabH1.d.cts} +41 -9
  40. package/dist/shared/{attaform.B5GWYl76.cjs → attaform.RypIkgVy.cjs} +38 -7
  41. package/dist/shared/attaform.RypIkgVy.cjs.map +1 -0
  42. package/dist/shared/{attaform.al_rpt7_.mjs → attaform.a99dQV7Q.mjs} +39 -8
  43. package/dist/shared/attaform.a99dQV7Q.mjs.map +1 -0
  44. package/dist/shared/{attaform.BRTxpA3q.mjs → attaform.qxyip_aN.mjs} +634 -238
  45. package/dist/shared/attaform.qxyip_aN.mjs.map +1 -0
  46. package/dist/transforms.d.cts +2 -2
  47. package/dist/transforms.d.mts +2 -2
  48. package/dist/transforms.d.ts +2 -2
  49. package/dist/zod-v3.cjs +55 -3
  50. package/dist/zod-v3.cjs.map +1 -1
  51. package/dist/zod-v3.d.cts +77 -4
  52. package/dist/zod-v3.d.mts +77 -4
  53. package/dist/zod-v3.d.ts +77 -4
  54. package/dist/zod-v3.mjs +56 -6
  55. package/dist/zod-v3.mjs.map +1 -1
  56. package/dist/zod.cjs +372 -5
  57. package/dist/zod.cjs.map +1 -1
  58. package/dist/zod.d.cts +120 -4
  59. package/dist/zod.d.mts +120 -4
  60. package/dist/zod.d.ts +120 -4
  61. package/dist/zod.mjs +371 -8
  62. package/dist/zod.mjs.map +1 -1
  63. package/package.json +3 -1
  64. package/dist/shared/attaform.B5GWYl76.cjs.map +0 -1
  65. package/dist/shared/attaform.BRTxpA3q.mjs.map +0 -1
  66. package/dist/shared/attaform.CNJO3mME.cjs.map +0 -1
  67. package/dist/shared/attaform.CRgix6_n.cjs.map +0 -1
  68. package/dist/shared/attaform.DlgKK10S.mjs.map +0 -1
  69. package/dist/shared/attaform.al_rpt7_.mjs.map +0 -1
package/dist/zod-v3.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { a8 as ValidateOnConfig, F as FormKey, x as OnInvalidSubmitPolicy, E as PersistConfig, v as HistoryConfig, C as CoercionRegistry, G as GenericForm, U as UseFormConfiguration, b as AbstractSchema, D as DeepPartial, c as DefaultValuesShape, d as UseFormReturnType } from './shared/attaform.DDXrY-1Q.cjs';
3
- export { a6 as Unset, ad as isUnset, af as unset } from './shared/attaform.DDXrY-1Q.cjs';
4
- export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.CXZgUECn.cjs';
2
+ import { ae as ValidateOnConfig, F as FormKey, B as OnInvalidSubmitPolicy, W as PersistConfig, x as HistoryConfig, C as CoercionRegistry, G as GenericForm, U as UseFormConfiguration, b as AbstractSchema, D as DeepPartial, c as DefaultValuesShape, d as UseFormReturnType, n as FieldMetaPayload } from './shared/attaform.0Gxd_OOx.cjs';
3
+ export { ac as Unset, am as isUnset, ao as unset } from './shared/attaform.0Gxd_OOx.cjs';
4
+ export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.Dq5BabH1.cjs';
5
5
  import 'vue';
6
6
 
7
7
  /**
@@ -160,5 +160,78 @@ type ZodTypeMap = {
160
160
  */
161
161
  declare function isZodSchemaType<K extends keyof ZodTypeMap>(schema: unknown, expectedType: K): schema is ZodTypeMap[K];
162
162
 
163
- export { isZodSchemaType, useForm, zodAdapter };
163
+ /**
164
+ * Field-metadata write/read API for the Zod v3 adapter.
165
+ *
166
+ * Zod 3 has no `z.registry()` mechanism, so we shim one with a
167
+ * module-scoped `WeakMap<ZodTypeAny, FieldMetaPayload>` plus a
168
+ * registry-shaped object exposing `add` / `get` / `has`. The public
169
+ * `withMeta(schema, payload)` write API matches `attaform/zod` so
170
+ * schema authoring reads identically across the two adapters.
171
+ *
172
+ * **Registration patterns:** both styles work — register on whatever
173
+ * schema reference you assign into the parent's shape, OR on the
174
+ * inner schema before wrapping. The adapter's resolver tries the
175
+ * walker-returned schema first, then falls back to the peeled
176
+ * inner so either ordering hits:
177
+ *
178
+ * // both equivalent — registry hits at lookup time
179
+ * withMeta(z.string(), { label: 'Email' }).optional()
180
+ * withMeta(z.string().optional(), { label: 'Email' })
181
+ *
182
+ * The path walker returns the wrapper at terminal positions and
183
+ * peels at intermediate descent. The two-stage lookup covers both
184
+ * leaf and container registrations symmetrically.
185
+ */
186
+
187
+ /**
188
+ * The shared registry every Attaform-aware Zod 3 schema can register
189
+ * field metadata against. Exposes a registry-shaped surface so that
190
+ * v3 user code can use the same idiom v4 users do (`fieldMeta.add(schema,
191
+ * payload)`); under the hood it's just a `WeakMap`.
192
+ */
193
+ type FieldMetaRegistryV3 = {
194
+ /**
195
+ * Register `payload` against `schema`. Returns the registry to
196
+ * mirror Zod 4's `$ZodRegistry.add` chain shape.
197
+ */
198
+ add<S extends z.ZodTypeAny>(schema: S, payload: FieldMetaPayload): FieldMetaRegistryV3;
199
+ /**
200
+ * Read the registered payload for a schema, or `undefined` if
201
+ * nothing has been registered.
202
+ */
203
+ get(schema: z.ZodTypeAny): FieldMetaPayload | undefined;
204
+ /** True iff a payload has been registered for the schema. */
205
+ has(schema: z.ZodTypeAny): boolean;
206
+ };
207
+ declare const fieldMeta: FieldMetaRegistryV3;
208
+ /**
209
+ * Attach `payload` to `schema` in the shared `fieldMeta` registry
210
+ * and return a clone of `schema` (chainable, with the new metadata).
211
+ * Cross-version with `attaform/zod`'s `withMeta()`.
212
+ *
213
+ * **Why clone, not mutate.** The WeakMap shim keys metadata on the
214
+ * schema reference. Calling `withMeta` twice on the same instance
215
+ * would overwrite (last-write-wins) — so a sub-schema reused at
216
+ * multiple form paths (e.g. an address schema shared between pickup
217
+ * and delivery) couldn't carry distinct metadata per path.
218
+ *
219
+ * `withMeta` sidesteps the footgun by reconstructing `schema` via
220
+ * its constructor + `_def` — Zod 3 schemas don't expose `.clone()`,
221
+ * but `new schema.constructor(schema._def)` is the equivalent. Each
222
+ * call gets a fresh identity and a fresh registry slot. Existing
223
+ * metadata on the original is merged through, so chaining
224
+ * `withMeta` accumulates payload fields rather than replacing.
225
+ *
226
+ * Inner field schemas (e.g. an object's `.shape.city`) are shared
227
+ * across clones — the def is held by reference — so leaf metadata
228
+ * registers once and surfaces at every path.
229
+ *
230
+ * `schema.register()` does NOT exist on Zod 3 — `withMeta` is the
231
+ * only write API. Register on the inner schema before wrapping;
232
+ * see the "Registration rule" note in this file's header.
233
+ */
234
+ declare function withMeta<S extends z.ZodTypeAny>(schema: S, payload: FieldMetaPayload): S;
235
+
236
+ export { FieldMetaPayload, fieldMeta, isZodSchemaType, useForm, withMeta, zodAdapter };
164
237
  export type { TypeWithNullableDynamicKeys, UnwrapZodObject, UseFormConfigurationWithZod, ZodTypeWithInnerType };
package/dist/zod-v3.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { a8 as ValidateOnConfig, F as FormKey, x as OnInvalidSubmitPolicy, E as PersistConfig, v as HistoryConfig, C as CoercionRegistry, G as GenericForm, U as UseFormConfiguration, b as AbstractSchema, D as DeepPartial, c as DefaultValuesShape, d as UseFormReturnType } from './shared/attaform.DDXrY-1Q.mjs';
3
- export { a6 as Unset, ad as isUnset, af as unset } from './shared/attaform.DDXrY-1Q.mjs';
4
- export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.DOKOyb3Y.mjs';
2
+ import { ae as ValidateOnConfig, F as FormKey, B as OnInvalidSubmitPolicy, W as PersistConfig, x as HistoryConfig, C as CoercionRegistry, G as GenericForm, U as UseFormConfiguration, b as AbstractSchema, D as DeepPartial, c as DefaultValuesShape, d as UseFormReturnType, n as FieldMetaPayload } from './shared/attaform.0Gxd_OOx.mjs';
3
+ export { ac as Unset, am as isUnset, ao as unset } from './shared/attaform.0Gxd_OOx.mjs';
4
+ export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.CVv9Oh0a.mjs';
5
5
  import 'vue';
6
6
 
7
7
  /**
@@ -160,5 +160,78 @@ type ZodTypeMap = {
160
160
  */
161
161
  declare function isZodSchemaType<K extends keyof ZodTypeMap>(schema: unknown, expectedType: K): schema is ZodTypeMap[K];
162
162
 
163
- export { isZodSchemaType, useForm, zodAdapter };
163
+ /**
164
+ * Field-metadata write/read API for the Zod v3 adapter.
165
+ *
166
+ * Zod 3 has no `z.registry()` mechanism, so we shim one with a
167
+ * module-scoped `WeakMap<ZodTypeAny, FieldMetaPayload>` plus a
168
+ * registry-shaped object exposing `add` / `get` / `has`. The public
169
+ * `withMeta(schema, payload)` write API matches `attaform/zod` so
170
+ * schema authoring reads identically across the two adapters.
171
+ *
172
+ * **Registration patterns:** both styles work — register on whatever
173
+ * schema reference you assign into the parent's shape, OR on the
174
+ * inner schema before wrapping. The adapter's resolver tries the
175
+ * walker-returned schema first, then falls back to the peeled
176
+ * inner so either ordering hits:
177
+ *
178
+ * // both equivalent — registry hits at lookup time
179
+ * withMeta(z.string(), { label: 'Email' }).optional()
180
+ * withMeta(z.string().optional(), { label: 'Email' })
181
+ *
182
+ * The path walker returns the wrapper at terminal positions and
183
+ * peels at intermediate descent. The two-stage lookup covers both
184
+ * leaf and container registrations symmetrically.
185
+ */
186
+
187
+ /**
188
+ * The shared registry every Attaform-aware Zod 3 schema can register
189
+ * field metadata against. Exposes a registry-shaped surface so that
190
+ * v3 user code can use the same idiom v4 users do (`fieldMeta.add(schema,
191
+ * payload)`); under the hood it's just a `WeakMap`.
192
+ */
193
+ type FieldMetaRegistryV3 = {
194
+ /**
195
+ * Register `payload` against `schema`. Returns the registry to
196
+ * mirror Zod 4's `$ZodRegistry.add` chain shape.
197
+ */
198
+ add<S extends z.ZodTypeAny>(schema: S, payload: FieldMetaPayload): FieldMetaRegistryV3;
199
+ /**
200
+ * Read the registered payload for a schema, or `undefined` if
201
+ * nothing has been registered.
202
+ */
203
+ get(schema: z.ZodTypeAny): FieldMetaPayload | undefined;
204
+ /** True iff a payload has been registered for the schema. */
205
+ has(schema: z.ZodTypeAny): boolean;
206
+ };
207
+ declare const fieldMeta: FieldMetaRegistryV3;
208
+ /**
209
+ * Attach `payload` to `schema` in the shared `fieldMeta` registry
210
+ * and return a clone of `schema` (chainable, with the new metadata).
211
+ * Cross-version with `attaform/zod`'s `withMeta()`.
212
+ *
213
+ * **Why clone, not mutate.** The WeakMap shim keys metadata on the
214
+ * schema reference. Calling `withMeta` twice on the same instance
215
+ * would overwrite (last-write-wins) — so a sub-schema reused at
216
+ * multiple form paths (e.g. an address schema shared between pickup
217
+ * and delivery) couldn't carry distinct metadata per path.
218
+ *
219
+ * `withMeta` sidesteps the footgun by reconstructing `schema` via
220
+ * its constructor + `_def` — Zod 3 schemas don't expose `.clone()`,
221
+ * but `new schema.constructor(schema._def)` is the equivalent. Each
222
+ * call gets a fresh identity and a fresh registry slot. Existing
223
+ * metadata on the original is merged through, so chaining
224
+ * `withMeta` accumulates payload fields rather than replacing.
225
+ *
226
+ * Inner field schemas (e.g. an object's `.shape.city`) are shared
227
+ * across clones — the def is held by reference — so leaf metadata
228
+ * registers once and surfaces at every path.
229
+ *
230
+ * `schema.register()` does NOT exist on Zod 3 — `withMeta` is the
231
+ * only write API. Register on the inner schema before wrapping;
232
+ * see the "Registration rule" note in this file's header.
233
+ */
234
+ declare function withMeta<S extends z.ZodTypeAny>(schema: S, payload: FieldMetaPayload): S;
235
+
236
+ export { FieldMetaPayload, fieldMeta, isZodSchemaType, useForm, withMeta, zodAdapter };
164
237
  export type { TypeWithNullableDynamicKeys, UnwrapZodObject, UseFormConfigurationWithZod, ZodTypeWithInnerType };
package/dist/zod-v3.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { a8 as ValidateOnConfig, F as FormKey, x as OnInvalidSubmitPolicy, E as PersistConfig, v as HistoryConfig, C as CoercionRegistry, G as GenericForm, U as UseFormConfiguration, b as AbstractSchema, D as DeepPartial, c as DefaultValuesShape, d as UseFormReturnType } from './shared/attaform.DDXrY-1Q.js';
3
- export { a6 as Unset, ad as isUnset, af as unset } from './shared/attaform.DDXrY-1Q.js';
4
- export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.BYc9kugA.js';
2
+ import { ae as ValidateOnConfig, F as FormKey, B as OnInvalidSubmitPolicy, W as PersistConfig, x as HistoryConfig, C as CoercionRegistry, G as GenericForm, U as UseFormConfiguration, b as AbstractSchema, D as DeepPartial, c as DefaultValuesShape, d as UseFormReturnType, n as FieldMetaPayload } from './shared/attaform.0Gxd_OOx.js';
3
+ export { ac as Unset, am as isUnset, ao as unset } from './shared/attaform.0Gxd_OOx.js';
4
+ export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.CWCx2r0x.js';
5
5
  import 'vue';
6
6
 
7
7
  /**
@@ -160,5 +160,78 @@ type ZodTypeMap = {
160
160
  */
161
161
  declare function isZodSchemaType<K extends keyof ZodTypeMap>(schema: unknown, expectedType: K): schema is ZodTypeMap[K];
162
162
 
163
- export { isZodSchemaType, useForm, zodAdapter };
163
+ /**
164
+ * Field-metadata write/read API for the Zod v3 adapter.
165
+ *
166
+ * Zod 3 has no `z.registry()` mechanism, so we shim one with a
167
+ * module-scoped `WeakMap<ZodTypeAny, FieldMetaPayload>` plus a
168
+ * registry-shaped object exposing `add` / `get` / `has`. The public
169
+ * `withMeta(schema, payload)` write API matches `attaform/zod` so
170
+ * schema authoring reads identically across the two adapters.
171
+ *
172
+ * **Registration patterns:** both styles work — register on whatever
173
+ * schema reference you assign into the parent's shape, OR on the
174
+ * inner schema before wrapping. The adapter's resolver tries the
175
+ * walker-returned schema first, then falls back to the peeled
176
+ * inner so either ordering hits:
177
+ *
178
+ * // both equivalent — registry hits at lookup time
179
+ * withMeta(z.string(), { label: 'Email' }).optional()
180
+ * withMeta(z.string().optional(), { label: 'Email' })
181
+ *
182
+ * The path walker returns the wrapper at terminal positions and
183
+ * peels at intermediate descent. The two-stage lookup covers both
184
+ * leaf and container registrations symmetrically.
185
+ */
186
+
187
+ /**
188
+ * The shared registry every Attaform-aware Zod 3 schema can register
189
+ * field metadata against. Exposes a registry-shaped surface so that
190
+ * v3 user code can use the same idiom v4 users do (`fieldMeta.add(schema,
191
+ * payload)`); under the hood it's just a `WeakMap`.
192
+ */
193
+ type FieldMetaRegistryV3 = {
194
+ /**
195
+ * Register `payload` against `schema`. Returns the registry to
196
+ * mirror Zod 4's `$ZodRegistry.add` chain shape.
197
+ */
198
+ add<S extends z.ZodTypeAny>(schema: S, payload: FieldMetaPayload): FieldMetaRegistryV3;
199
+ /**
200
+ * Read the registered payload for a schema, or `undefined` if
201
+ * nothing has been registered.
202
+ */
203
+ get(schema: z.ZodTypeAny): FieldMetaPayload | undefined;
204
+ /** True iff a payload has been registered for the schema. */
205
+ has(schema: z.ZodTypeAny): boolean;
206
+ };
207
+ declare const fieldMeta: FieldMetaRegistryV3;
208
+ /**
209
+ * Attach `payload` to `schema` in the shared `fieldMeta` registry
210
+ * and return a clone of `schema` (chainable, with the new metadata).
211
+ * Cross-version with `attaform/zod`'s `withMeta()`.
212
+ *
213
+ * **Why clone, not mutate.** The WeakMap shim keys metadata on the
214
+ * schema reference. Calling `withMeta` twice on the same instance
215
+ * would overwrite (last-write-wins) — so a sub-schema reused at
216
+ * multiple form paths (e.g. an address schema shared between pickup
217
+ * and delivery) couldn't carry distinct metadata per path.
218
+ *
219
+ * `withMeta` sidesteps the footgun by reconstructing `schema` via
220
+ * its constructor + `_def` — Zod 3 schemas don't expose `.clone()`,
221
+ * but `new schema.constructor(schema._def)` is the equivalent. Each
222
+ * call gets a fresh identity and a fresh registry slot. Existing
223
+ * metadata on the original is merged through, so chaining
224
+ * `withMeta` accumulates payload fields rather than replacing.
225
+ *
226
+ * Inner field schemas (e.g. an object's `.shape.city`) are shared
227
+ * across clones — the def is held by reference — so leaf metadata
228
+ * registers once and surfaces at every path.
229
+ *
230
+ * `schema.register()` does NOT exist on Zod 3 — `withMeta` is the
231
+ * only write API. Register on the inner schema before wrapping;
232
+ * see the "Registration rule" note in this file's header.
233
+ */
234
+ declare function withMeta<S extends z.ZodTypeAny>(schema: S, payload: FieldMetaPayload): S;
235
+
236
+ export { FieldMetaPayload, fieldMeta, isZodSchemaType, useForm, withMeta, zodAdapter };
164
237
  export type { TypeWithNullableDynamicKeys, UnwrapZodObject, UseFormConfigurationWithZod, ZodTypeWithInnerType };
package/dist/zod-v3.mjs CHANGED
@@ -1,10 +1,34 @@
1
1
  import { merge, set, isFunction, cloneDeep } from 'lodash-es';
2
2
  import { z } from 'zod';
3
- import { g as getAtPath, s as slimKindOf, A as AttaformErrorCode, c as useAbstractForm } from './shared/attaform.BRTxpA3q.mjs';
4
- export { i as injectForm, b as isUnset, u as unset } from './shared/attaform.BRTxpA3q.mjs';
5
- import { c as canonicalizePath } from './shared/attaform.Cc93zNzD.mjs';
6
- import { a as AttaformError, _ as __DEV__ } from './shared/attaform.al_rpt7_.mjs';
7
- export { u as useRegister } from './shared/attaform.al_rpt7_.mjs';
3
+ import { g as getAtPath, s as slimKindOf, A as AttaformErrorCode, h as humanize, c as useAbstractForm } from './shared/attaform.qxyip_aN.mjs';
4
+ export { i as injectForm, b as isUnset, u as unset } from './shared/attaform.qxyip_aN.mjs';
5
+ import { c as canonicalizePath } from './shared/attaform.DXye3JKf.mjs';
6
+ import { a as AttaformError, _ as __DEV__ } from './shared/attaform.a99dQV7Q.mjs';
7
+ export { u as useRegister } from './shared/attaform.a99dQV7Q.mjs';
8
+
9
+ const store = /* @__PURE__ */ new WeakMap();
10
+ const fieldMeta = {
11
+ add(schema, payload) {
12
+ store.set(schema, payload);
13
+ return fieldMeta;
14
+ },
15
+ get(schema) {
16
+ return store.get(schema);
17
+ },
18
+ has(schema) {
19
+ return store.has(schema);
20
+ }
21
+ };
22
+ function withMeta(schema, payload) {
23
+ const existing = store.get(schema) ?? {};
24
+ const Ctor = schema.constructor;
25
+ const cloned = new Ctor(schema._def);
26
+ store.set(cloned, { ...existing, ...payload });
27
+ return cloned;
28
+ }
29
+ function getFieldMeta(schema) {
30
+ return store.get(schema);
31
+ }
8
32
 
9
33
  class UnsupportedSchemaError extends AttaformError {
10
34
  }
@@ -659,6 +683,9 @@ function zodAdapter(zodSchema) {
659
683
  if (!leaf) return false;
660
684
  return isLeafRequiredV3(leaf);
661
685
  },
686
+ getFieldMetaAtPath(path) {
687
+ return resolveFieldMetaAtPathV3(_zodSchema, path);
688
+ },
662
689
  getUnionDiscriminatorAtPath(path) {
663
690
  const candidates = path.length === 0 ? [_zodSchema] : getNestedZodSchemasAtPath(_zodSchema, path);
664
691
  let matchedUnion;
@@ -1486,6 +1513,29 @@ function getSlimSchema(config) {
1486
1513
  const processedRootSchema = stripRootSchema(config.schema, config.stripConfig)[0];
1487
1514
  return _getSlimSchema(processedRootSchema);
1488
1515
  }
1516
+ function resolveFieldMetaAtPathV3(rootSchema, path) {
1517
+ const lastSegment = path.length === 0 ? "" : path[path.length - 1];
1518
+ const target = path.length === 0 ? rootSchema : walkV3ToLeafSchema(rootSchema, path);
1519
+ if (target === void 0) {
1520
+ return {
1521
+ label: humanize(lastSegment),
1522
+ description: void 0,
1523
+ placeholder: void 0,
1524
+ meta: Object.freeze({})
1525
+ };
1526
+ }
1527
+ const peeled = peelV3Wrappers(target);
1528
+ const payload = getFieldMeta(target) ?? (peeled !== target ? getFieldMeta(peeled) : void 0);
1529
+ const targetDescription = typeof target.description === "string" ? target.description : void 0;
1530
+ const peeledDescription = peeled !== target && typeof peeled.description === "string" ? peeled.description : void 0;
1531
+ const schemaDescription = targetDescription ?? peeledDescription;
1532
+ return {
1533
+ label: payload?.label ?? humanize(lastSegment),
1534
+ description: payload?.description ?? schemaDescription ?? void 0,
1535
+ placeholder: payload?.placeholder ?? void 0,
1536
+ meta: Object.freeze({ ...payload ?? {} })
1537
+ };
1538
+ }
1489
1539
 
1490
1540
  function useForm(configuration) {
1491
1541
  function isZodType(value) {
@@ -1500,5 +1550,5 @@ function useForm(configuration) {
1500
1550
  });
1501
1551
  }
1502
1552
 
1503
- export { AttaformErrorCode, isZodSchemaType, useForm, zodAdapter };
1553
+ export { AttaformErrorCode, fieldMeta, isZodSchemaType, useForm, withMeta, zodAdapter };
1504
1554
  //# sourceMappingURL=zod-v3.mjs.map