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
package/dist/rspack.d.mts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { W as WebpackFamilyPlugin, a as WebpackFamilyPluginOptions } from './shared/attaform.C9fPTxjB.mjs';
2
2
 
3
3
  /**
4
- * `attaform/rspack` — Rspack plugin that rewrites `attaform/zod` imports
4
+ * `attaform/rspack`, the Rspack plugin that rewrites `attaform/zod`
5
+ * imports
5
6
  * to the single matching adapter subpath (`attaform/zod-v3` or
6
7
  * `attaform/zod-v4`) at build time, based on the consumer's installed Zod
7
8
  * major. Without it, Rspack ships both adapters because the unified
@@ -20,16 +21,12 @@ import { W as WebpackFamilyPlugin, a as WebpackFamilyPluginOptions } from './sha
20
21
  * so this shares its body with `attaform/webpack` via
21
22
  * `createWebpackFamilyPlugin`; only the diagnostic tag differs.
22
23
  *
23
- * This plugin only does the adapter rewrite. The Vue SFC `v-register`
24
- * transforms that `attaform/vite` wires (load-bearing for SSR initial
25
- * render) are `@vitejs/plugin-vue`-specific and do not transfer; a
26
- * non-Vite consumer that needs them wires `attaform/transforms` into
27
- * their Vue compiler separately. The `v-register` directive itself is
28
- * also delivered by the Vite plugin's compile-time binding, so outside
29
- * that pipeline register it once per app:
30
- *
31
- * import { installVRegister } from 'attaform/directive'
32
- * installVRegister(app)
24
+ * The adapter rewrite is all this plugin does. Two things
25
+ * `attaform/vite` also provides do NOT transfer, because both are
26
+ * `@vitejs/plugin-vue`-specific: wire `attaform/transforms` into your
27
+ * Vue compiler for the SSR-critical template transforms, and register
28
+ * the directive once per app with `installVRegister(app)` from
29
+ * `attaform/directive`.
33
30
  *
34
31
  * Zero-dep: the plugin imports nothing from `@rspack/core` (it taps the
35
32
  * resolve hook the compiler injects at the consumer's build).
@@ -39,6 +36,17 @@ import { W as WebpackFamilyPlugin, a as WebpackFamilyPluginOptions } from './sha
39
36
  type AttaformRspackPluginOptions = WebpackFamilyPluginOptions;
40
37
  /** The structural shape Rspack requires of the plugin. */
41
38
  type AttaformRspackPlugin = WebpackFamilyPlugin;
39
+ /**
40
+ * Rspack plugin that resolves `attaform/zod` to the one adapter subpath
41
+ * matching the installed Zod major, so the build ships a single adapter
42
+ * instead of both.
43
+ *
44
+ * ```js
45
+ * import { attaform } from 'attaform/rspack'
46
+ *
47
+ * export default { plugins: [attaform()] }
48
+ * ```
49
+ */
42
50
  declare function attaform(options?: AttaformRspackPluginOptions): AttaformRspackPlugin;
43
51
 
44
52
  export { attaform };
package/dist/rspack.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createWebpackFamilyPlugin } from './shared/attaform.v0fQtWyA.mjs';
1
+ import { c as createWebpackFamilyPlugin } from './shared/attaform.B1rH9ht6.mjs';
2
2
 
3
3
  function attaform(options = {}) {
4
4
  return createWebpackFamilyPlugin("attaform/rspack", options);
@@ -5,7 +5,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
5
5
  // can resolve through the consumer's node_modules → `dist/index.mjs`,
6
6
  // rather than through brittle relative paths into the rollup-bundled
7
7
  // shared chunks (which mkdist doesn't co-locate). Type-only imports of
8
- // internal types stay relative — they're erased at compile time and
8
+ // internal types stay relative: they're erased at compile time and
9
9
  // don't need to resolve at the consumer's runtime.
10
10
  import { type AttaformDevtoolsBridge, canonicalizePath, type Segment } from 'attaform'
11
11
  import type { FormStore } from '../core/create-form-store'
@@ -18,7 +18,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
18
18
  }>()
19
19
 
20
20
  // Cross-iframe reactivity bridge. Vue's reactivity system is module-
21
- // scoped — the host's `@vue/reactivity` instance and the panel's are
21
+ // scoped: the host's `@vue/reactivity` instance and the panel's are
22
22
  // different copies of the same module, each with its own targetMap.
23
23
  // When the panel reads `host.form.value` in a `computed`, the proxy's
24
24
  // get trap runs in the host's tracking context (the function lives
@@ -31,7 +31,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
31
31
  // (`onFormChange` / `onSubmitSuccess` / `onReset`), plus a 250ms
32
32
  // polling fallback for state that changes outside those events (user
33
33
  // errors via `setErrors`, submit-lifecycle flags). The panel's
34
- // own reactivity then re-evaluates everything in one pass — cheap
34
+ // own reactivity then re-evaluates everything in one pass, cheap
35
35
  // because the underlying reads are direct property accesses.
36
36
  const updateTick = ref(0)
37
37
 
@@ -120,7 +120,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
120
120
  }
121
121
 
122
122
  /**
123
- * Render a JS value as a debug-friendly string with no masking —
123
+ * Render a JS value as a debug-friendly string with no masking,
124
124
  * `null` / `undefined` show as their literal names, booleans and
125
125
  * numbers as-is, strings bare (no surrounding quotes), everything
126
126
  * else JSON-stringified. Devtools is for inspecting state, not for
@@ -169,13 +169,13 @@ import { computed, onUnmounted, ref, watch } from 'vue'
169
169
  /**
170
170
  * Raw field data at the selected path, composed from `FormStore`
171
171
  * primitives. The callable `form.fields(path)` proxy lives on the
172
- * public `useForm` return, not on `FormStore` — the bridge exposes
172
+ * public `useForm` return, not on `FormStore`: the bridge exposes
173
173
  * the store, so we synthesise the same data from `fields.get(key)`
174
174
  * + the error Maps + an inline value walk.
175
175
  *
176
176
  * Returns the raw `FieldRecord` (updatedAt / focused / blurred /
177
177
  * touched / connected) rather than the wrapped `FieldState`
178
- * surface. Sufficient for inspection — the full aggregated
178
+ * surface. Sufficient for inspection: the full aggregated
179
179
  * FieldState would require either lifting the surface-proxy into
180
180
  * `FormStore` (architectural change) or rebuilding the aggregation
181
181
  * walker in the panel (duplication).
@@ -211,7 +211,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
211
211
  | undefined) ?? null
212
212
 
213
213
  // Inline path walk (avoids importing path-walker through the
214
- // bridge — it lives in the host's shared chunk).
214
+ // bridge: it lives in the host's shared chunk).
215
215
  let value: unknown = form.form.value
216
216
  for (const seg of path) {
217
217
  if (value === null || typeof value !== 'object') {
@@ -259,7 +259,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
259
259
  const { segments: canonicalPath } = canonicalizePath(rawPath as readonly Segment[])
260
260
  form.setValueAtPath(canonicalPath, next)
261
261
  // The host's setValueAtPath fires `onFormChange` listeners, which
262
- // bumps our updateTick (see subscribeForm) — that refreshes the
262
+ // bumps our updateTick (see subscribeForm): that refreshes the
263
263
  // panel's view of the new value on the next microtask.
264
264
  } catch (err) {
265
265
  // Surface cross-iframe write failures (e.g., type-instance checks
@@ -285,7 +285,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
285
285
 
286
286
  /**
287
287
  * Hard cap on the in-memory event log. Sized for a debugging session,
288
- * not an audit log — older events fall off the back when capacity
288
+ * not an audit log, older events fall off the back when capacity
289
289
  * fills. Tunable later if real consumers ask for more.
290
290
  */
291
291
  const MAX_TIMELINE_EVENTS = 200
@@ -325,7 +325,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
325
325
 
326
326
  function subscribeForm(key: FormKey, form: FormStore<GenericForm>): void {
327
327
  if (subscribers.has(key)) return
328
- // Deep-clone the form value at the moment of fire — FormStore
328
+ // Deep-clone the form value at the moment of fire, FormStore
329
329
  // mutates form data in place, so a stored reference would update
330
330
  // every existing timeline entry whenever the form changed again
331
331
  // ("type a, delete a, both timeline events show the empty value"
@@ -336,7 +336,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
336
336
  try {
337
337
  return structuredClone(form.form.value)
338
338
  } catch {
339
- // Non-cloneable values (functions, Symbols, Vue refs, etc.) —
339
+ // Non-cloneable values (functions, Symbols, Vue refs, etc.),
340
340
  // fall back to the live reference. Worst case: that one entry
341
341
  // still shows the current state, same as before this fix.
342
342
  return form.form.value
@@ -379,7 +379,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
379
379
  )
380
380
 
381
381
  // Polling fallback for state that changes outside the `onFormChange` /
382
- // `onSubmitSuccess` / `onReset` event surface — user errors injected
382
+ // `onSubmitSuccess` / `onReset` event surface, user errors injected
383
383
  // via `setErrors`, submit-lifecycle flags between events, or
384
384
  // new forms registered in the host's registry. 120ms is faster than
385
385
  // a human can notice between an input event and a visible panel
@@ -100,7 +100,7 @@ import { computed, nextTick, ref } from 'vue'
100
100
  // Array indices arrive as stringified numbers from `Object.entries` /
101
101
  // `array.map`. Coerce back to numbers when the parent is an array
102
102
  // so `canonicalizePath` on the consumer side gets a structured Path
103
- // with the right shape — `["users", 0, "name"]`, not
103
+ // with the right shape, `["users", 0, "name"]`, not
104
104
  // `["users", "0", "name"]`.
105
105
  if (type.value === 'array') return [...path.value, Number(rawKey)]
106
106
  return [...path.value, rawKey]
@@ -159,7 +159,7 @@ import { computed, nextTick, ref } from 'vue'
159
159
 
160
160
  // Selection (Field-state inspector hook). Canonical key uses JSON-
161
161
  // serialised path-array form so two arrays with the same shape produce
162
- // the same string — direct equality check.
162
+ // the same string, direct equality check.
163
163
  const ownKey = computed(() => JSON.stringify(path.value))
164
164
  const isSelected = computed(
165
165
  () =>
@@ -1,5 +1,5 @@
1
1
  import { defineNuxtPlugin, useRuntimeConfig, useRoute } from 'nuxt/app';
2
- import { c as createAttaform, b as kAttaformWizardActiveStepResolver, r as renderAttaformState, h as hydrateAttaformState, g as getRegistryFromApp, D as DEVTOOLS_WINDOW_KEY } from '../../shared/attaform.D0x-qSXm.mjs';
2
+ import { c as createAttaform, b as kAttaformWizardActiveStepResolver, r as renderAttaformState, h as hydrateAttaformState, g as getRegistryFromApp, D as DEVTOOLS_WINDOW_KEY } from '../../shared/attaform.WiGdIqgx.mjs';
3
3
 
4
4
  var attaform_default = defineNuxtPlugin({
5
5
  // `enforce: 'pre'` makes the "we run before any component's setup" claim
@@ -11,8 +11,8 @@ var attaform_default = defineNuxtPlugin({
11
11
  setup(nuxtApp) {
12
12
  const isServer = import.meta.server;
13
13
  const config = useRuntimeConfig().public;
14
- const { defaults, version } = config.attaform;
15
- nuxtApp.vueApp.use(createAttaform({ ssr: isServer, defaults }));
14
+ const { version } = config.attaform;
15
+ nuxtApp.vueApp.use(createAttaform({ ssr: isServer }));
16
16
  nuxtApp.vueApp.provide(kAttaformWizardActiveStepResolver, (param) => {
17
17
  const value = useRoute().query[param];
18
18
  if (typeof value === "string") return value;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { G as GenericForm, s as FlatPath, B as NestedType, F as FormKey, U as UseFormConfiguration, A as AbstractSchema, av as AcceptableDefaults, ah as ValidateOnConfig, a as UseFormReturnType } from './attaform.CsoeRi3P.mjs';
2
+ import { G as GenericForm, l as FlatPath, s as NestedType, F as FormKey, U as UseFormConfiguration, A as AbstractSchema, aq as AcceptableDefaults, ac as ValidateOnConfig, a as UseFormReturnType } from './attaform.Br8EBn5B.mjs';
3
3
 
4
4
  /**
5
5
  * The Zod v4 schema roots `useForm` accepts. A fixed-shape
@@ -34,60 +34,54 @@ import { G as GenericForm, s as FlatPath, B as NestedType, F as FormKey, U as Us
34
34
  type SupportedRootSchema = z.ZodObject<z.ZodRawShape> | z.ZodRecord | z.ZodDiscriminatedUnion<readonly z.ZodObject<z.ZodRawShape>[], string>;
35
35
 
36
36
  /**
37
- * The shape `form.values.<key>` returns at runtime.
38
- *
39
- * Per leaf:
40
- *
41
- * 1. Schema-side input normalizers — `z.preprocess(fn, inner)` AND
42
- * `z.coerce.X()`. Zod v4 represents these differently
43
- * (`ZodPipe<ZodTransform, inner>` for preprocess; a primitive
44
- * with `def.coerce === true` for coerce), but they share the
45
- * same type-level marker: `_zod.input` is `unknown`. The
46
- * normalizer runs at parse time, NOT at the write boundary, so
47
- * storage holds the consumer's raw input and the type collapses
48
- * to `unknown` to match. Reach the typed value via
49
- * `handleSubmit`, `validate`, or `parse` — they re-parse
50
- * storage through the wrapper.
51
- *
52
- * 2. `inner.transform(fn)` — compiles to `ZodPipe<inner, ZodTransform>`.
53
- * Transforms fire at submit / validate, NOT at the write boundary,
54
- * so storage holds whatever `inner` stores. Recurse `StorageShape`
55
- * on `inner` so a defaulted leaf inside `inner` still reads `T`
56
- * (not `T | undefined`).
57
- *
58
- * A bare top-level `ZodTransform` (no `in` schema) reads
59
- * `_zod.input` directly — there's no inner to recurse into.
60
- *
61
- * 3. Codec / generic pipe — neither side is a transform. Read
62
- * `_zod.output`. Codecs aren't write-boundary-synthesized, so the
37
+ * The shape `form.values.<key>` returns at runtime. Four cases per leaf:
38
+ *
39
+ * 1. A schema-side input normalizer, meaning `z.preprocess(fn, inner)`
40
+ * or `z.coerce.X()`. v4 represents the two differently, a
41
+ * `ZodPipe<ZodTransform, inner>` against a primitive with
42
+ * `def.coerce === true`, but they share one type-level marker:
43
+ * `_zod.input` is `unknown`. The normalizer runs at PARSE time, not
44
+ * at the write boundary, so storage holds the consumer's raw input
45
+ * and the type collapses to `unknown` to match. `handleSubmit`,
46
+ * `validate` and `parse` re-parse storage through the wrapper, so
47
+ * the typed value is reachable there.
48
+ *
49
+ * 2. `inner.transform(fn)`, which compiles to `ZodPipe<inner,
50
+ * ZodTransform>`. A transform fires at submit or validate, not at the
51
+ * write boundary, so storage holds whatever `inner` stores.
52
+ * `StorageShape` recurses on `inner`, so a defaulted leaf inside it
53
+ * still reads `T` rather than `T | undefined`. A bare top-level
54
+ * `ZodTransform`, with no `in` schema, reads `_zod.input` directly,
55
+ * having no inner to recurse into.
56
+ *
57
+ * 3. A codec or generic pipe, where neither side is a transform: read
58
+ * `_zod.output`. A codec is not write-boundary-synthesized, so the
63
59
  * post-parse view is the only honest storage type.
64
60
  *
65
- * 4. Everything else (defaults, catch, readonly, optional, primitives,
66
- * nested objects) — read `_zod.output`. Defaults and catches fire
67
- * at parse time, so the post-init view is what storage holds.
68
- * Nested objects delegate to Zod's own recursion on `_zod.output`,
61
+ * 4. Everything else, defaults, catch, readonly, optional, primitives
62
+ * and nested objects: read `_zod.output`. Defaults and catches fire
63
+ * at parse time, so the post-init view is what storage holds, and a
64
+ * nested object delegates to Zod's own recursion on `_zod.output`,
69
65
  * which peels nested defaults inside structural containers.
70
66
  *
71
- * Detection order: case 1 wins via the `_zod.input` IsUnknown check
72
- * before the pipe/transform cascade fires, so wrapped variants like
73
- * `z.coerce.number().optional()` (input = `unknown | undefined` →
74
- * collapses to `unknown`) and `z.preprocess(fn, z.object(...))` (input
75
- * = `unknown`) both land on `unknown` without descending. The IsAny
76
- * filter keeps `z.any()` from being mistaken for coerce.
77
- *
78
- * Implementation note: direct `_zod` property access mirrors Zod's
79
- * own `$InferObjectOutput` / `$InferObjectInput`, which read
80
- * `T[k]['_zod']['output']` / `T[k]['_zod']['input']` directly rather
81
- * than wrapping in the top-level `output<T>` / `input<T>` conditional.
82
- * Wrapping per key spawns a fresh conditional instantiation for every
83
- * key; Volar's web-worker checker collapses that per-key walk to
84
- * `any` once the schema is non-trivial. Property access has no
85
- * conditional and resolves cleanly under the same budget.
86
- *
87
- * Shape access also goes through `_zod.def.shape` rather than
88
- * `infer Shape from z.ZodObject<Shape>` — the latter collapses to the
89
- * `$ZodShape` upper bound in the same worker because of
90
- * `z.ZodObject`'s `out Shape` covariance markers.
67
+ * Case 1 wins first, on the `_zod.input` IsUnknown check, before the
68
+ * pipe and transform cascade can fire. So `z.coerce.number().optional()`
69
+ * (input `unknown | undefined`, collapsing to `unknown`) and
70
+ * `z.preprocess(fn, z.object(...))` (input `unknown`) both land on
71
+ * `unknown` without descending, while the IsAny filter keeps `z.any()`
72
+ * from being read as coerce.
73
+ *
74
+ * The direct `_zod` property access is deliberate, and matches Zod's own
75
+ * `$InferObjectOutput` / `$InferObjectInput`, which read
76
+ * `T[k]['_zod']['output']` rather than wrapping in the top-level
77
+ * `output<T>` conditional. Wrapping per key spawns a fresh conditional
78
+ * instantiation for every key, and Volar's web-worker checker collapses
79
+ * that per-key walk to `any` once the schema is non-trivial. Property
80
+ * access has no conditional and resolves cleanly on the same budget.
81
+ * Shape access goes through `_zod.def.shape` for the same reason: `infer
82
+ * Shape from z.ZodObject<Shape>` collapses to the `$ZodShape` upper
83
+ * bound in that worker, because of `z.ZodObject`'s `out Shape`
84
+ * covariance markers.
91
85
  */
92
86
  type StorageShape<S> = S extends {
93
87
  _zod: {
@@ -100,10 +94,10 @@ type StorageShape<S> = S extends {
100
94
  [K in keyof Shape]-?: StorageLeaf<Shape[K]>;
101
95
  } : StorageLeaf<S>;
102
96
  /**
103
- * Detects a schema whose `_zod.input` is `unknown` — the marker both
104
- * `z.preprocess(fn, _)` and `z.coerce.X()` share in Zod v4. Excludes
105
- * `any` via the canonical `0 extends 1 & T` test so `z.any()` leaves
106
- * fall through to the cascade below and keep their `any` typing.
97
+ * Detect a schema whose `_zod.input` is `unknown`, the marker
98
+ * `z.preprocess(fn, _)` and `z.coerce.X()` share in v4. `any` is
99
+ * excluded through the canonical `0 extends 1 & T` test, so a `z.any()`
100
+ * leaf falls through to the cascade below and keeps its `any`.
107
101
  */
108
102
  type InputIsUnknown<L> = L extends {
109
103
  _zod: {
@@ -111,12 +105,11 @@ type InputIsUnknown<L> = L extends {
111
105
  };
112
106
  } ? 0 extends 1 & In ? false : unknown extends In ? true : false : false;
113
107
  /**
114
- * Implementation-detail per-leaf branching for `StorageShape`.
115
- * Exported so the bundled `.d.ts` carries a single alias body —
116
- * every leaf of a Zod object schema otherwise re-emits the full
117
- * pipe / transform / default conditional ladder, which compounds
118
- * badly with multiple complex schemas in the same scope. Consumers
119
- * should reach for `StorageShape` instead.
108
+ * The per-leaf branching behind `StorageShape`. It is exported so the
109
+ * bundled `.d.ts` carries ONE alias body: otherwise every leaf of a Zod
110
+ * object re-emits the full pipe / transform / default conditional
111
+ * ladder, which compounds badly once several complex schemas share a
112
+ * scope. Reach for `StorageShape` instead.
120
113
  */
121
114
  type StorageLeaf<L> = InputIsUnknown<L> extends true ? unknown : L extends {
122
115
  _zod: {
@@ -159,10 +152,10 @@ type StorageLeaf<L> = InputIsUnknown<L> extends true ? unknown : L extends {
159
152
  */
160
153
 
161
154
  /**
162
- * Type of the value accepted at `Path` for `setValue` / `defaultValues`
163
- * — the schema's `z.input<Schema>` shape at that path. Matches what
164
- * `form.values.X` returns at runtime (the honest input view storage
165
- * holds before transforms run).
155
+ * What `setValue` and `defaultValues` accept at `Path`: the schema's
156
+ * `z.input<Schema>` shape there. It matches what `form.values.X` returns
157
+ * at runtime, storage holding the honest input view until transforms
158
+ * run.
166
159
  *
167
160
  * ```ts
168
161
  * const schema = z.object({
@@ -173,9 +166,9 @@ type StorageLeaf<L> = InputIsUnknown<L> extends true ? unknown : L extends {
173
166
  */
174
167
  type PathInput<Schema extends z.ZodType, Path extends string> = z.input<Schema> extends GenericForm ? Path extends FlatPath<z.input<Schema>> ? NestedType<z.input<Schema>, Path> : never : never;
175
168
  /**
176
- * Type produced at `Path` after the full parse pipeline — the schema's
177
- * `z.output<Schema>` shape at that path. Matches the `data` payload of
178
- * `form.parse()` and the value handed to `handleSubmit`'s callback.
169
+ * What `Path` holds after the full parse pipeline: the schema's
170
+ * `z.output<Schema>` shape there. It matches `form.parse()`'s `data` and
171
+ * the value `handleSubmit`'s callback receives.
179
172
  *
180
173
  * ```ts
181
174
  * const schema = z.object({
@@ -185,6 +178,19 @@ type PathInput<Schema extends z.ZodType, Path extends string> = z.input<Schema>
185
178
  * ```
186
179
  */
187
180
  type PathOutput<Schema extends z.ZodType, Path extends string> = z.output<Schema> extends GenericForm ? Path extends FlatPath<z.output<Schema>> ? NestedType<z.output<Schema>, Path> : never : never;
181
+ /**
182
+ * Factor the three identical-shape conditionals out of `useForm`'s public
183
+ * signature, so the bundled `.d.ts` carries one alias per shape instead
184
+ * of re-inlining `z.input<Schema> extends GenericForm ? z.input<Schema>
185
+ * : never` four times. That inlining is what produces TS2589 ("Type
186
+ * instantiation is excessively deep") at a consumer call site holding a
187
+ * discriminated union, a transform pipe, or a deep `.register()` chain.
188
+ * Each alias computes once per `Schema` instantiation, and downstream
189
+ * generics ride it rather than re-evaluating the conditional.
190
+ */
191
+ type FormOf<Schema extends SupportedRootSchema> = z.input<Schema> extends GenericForm ? z.input<Schema> : never;
192
+ type OutOf<Schema extends SupportedRootSchema> = z.output<Schema> extends GenericForm ? z.output<Schema> : never;
193
+ type ReadOf<Schema extends SupportedRootSchema> = StorageShape<Schema> extends GenericForm ? StorageShape<Schema> : never;
188
194
  /**
189
195
  * Create a form bound to a Zod v4 schema.
190
196
  *
@@ -192,37 +198,19 @@ type PathOutput<Schema extends z.ZodType, Path extends string> = z.output<Schema
192
198
  * import { useForm } from 'attaform/zod'
193
199
  * import { z } from 'zod'
194
200
  *
195
- * const form = useForm({
196
- * schema: z.object({
197
- * email: z.email(),
198
- * password: z.string().min(8),
199
- * }),
200
- * defaultValues: { email: '' },
201
+ * const schema = z.object({
202
+ * email: z.email(),
203
+ * password: z.string().min(8),
201
204
  * })
202
- * ```
203
205
  *
204
- * Returns a form API exposing `register`, `values`, `errors`,
205
- * `fields`, `setValue`, `handleSubmit`, `meta`, field-array
206
- * helpers, and more. See `UseFormReturnType` for the full
207
- * surface.
206
+ * const form = useForm({ schema, defaultValues: { email: '' } })
207
+ * ```
208
208
  *
209
- * For Zod v3, import from `attaform/zod-v3` instead.
209
+ * The returned form carries `register`, `values`, `errors`, `fields`,
210
+ * `setValue`, `handleSubmit`, `meta` and the field-array helpers; see
211
+ * `UseFormReturnType` for the whole surface. For Zod v3, import from
212
+ * `attaform/zod-v3`.
210
213
  */
211
- /**
212
- * `FormOf` / `OutOf` / `ReadOf` factor the three identical-shape
213
- * conditionals out of `useForm`'s public signature. The bundled
214
- * `.d.ts` then carries one alias per shape rather than re-inlining
215
- * `z.input<Schema> extends GenericForm ? z.input<Schema> : never`
216
- * four times — which is what produces TS2589 ("Type instantiation
217
- * is excessively deep") on consumer call sites with complex schemas
218
- * (discriminated unions, transform pipes, deep `.register()` chains).
219
- * Each alias is computed once per `Schema` instantiation; downstream
220
- * generics ride on the alias rather than re-evaluating the
221
- * conditional from scratch.
222
- */
223
- type FormOf<Schema extends SupportedRootSchema> = z.input<Schema> extends GenericForm ? z.input<Schema> : never;
224
- type OutOf<Schema extends SupportedRootSchema> = z.output<Schema> extends GenericForm ? z.output<Schema> : never;
225
- type ReadOf<Schema extends SupportedRootSchema> = StorageShape<Schema> extends GenericForm ? StorageShape<Schema> : never;
226
214
  declare function useForm<Schema extends SupportedRootSchema, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<FormOf<Schema>, OutOf<Schema>, AbstractSchema<FormOf<Schema>, OutOf<Schema>>, never, K>, 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'> & {
227
215
  schema: Schema;
228
216
  defaultValues?: AcceptableDefaults<FormOf<Schema>, z.input<Schema>>;
@@ -1,4 +1,4 @@
1
- import { m as mapSegmentKeys, f as pathsEqual, i as isPathPrefix } from './attaform.CZYt_5N_.mjs';
1
+ import { m as mapSegmentKeys, f as pathsEqual, i as isPathPrefix } from './attaform.CdZIEf7_.mjs';
2
2
 
3
3
  const DEFAULT_FIELD_VALIDATION_DEBOUNCE_MS = 0;
4
4
  const DEFAULT_HISTORY_MAX_SNAPSHOTS = 128;
@@ -7,9 +7,8 @@ const ANONYMOUS_FORM_KEY_PREFIX = `${RESERVED_KEY_PREFIX}anon:`;
7
7
  const ANONYMOUS_WIZARD_KEY_PREFIX = `${RESERVED_KEY_PREFIX}anon-wizard:`;
8
8
  const DEFAULT_MAX_RECURSION_DEPTH = 64;
9
9
  function normalizeNumericOption(config) {
10
- const { value, source, allowInfinity, min, defaultValue } = config;
11
- if (allowInfinity && value === Infinity) return Infinity;
12
- if (typeof value !== "number" || Number.isNaN(value) || value === Infinity || value === -Infinity) {
10
+ const { value, source, min, defaultValue } = config;
11
+ if (typeof value !== "number" || !Number.isFinite(value)) {
13
12
  return defaultValue;
14
13
  }
15
14
  return Math.max(min, Math.floor(value));
@@ -22,7 +21,7 @@ function pickDefined(bag) {
22
21
  return out;
23
22
  }
24
23
 
25
- function callConsumerSchemaFn(fn, fallback, site) {
24
+ function callConsumerFn(fn, fallback, site, detail) {
26
25
  try {
27
26
  return fn();
28
27
  } catch (err) {
@@ -77,8 +76,9 @@ function safeAssign(target, key, value) {
77
76
  }
78
77
  target[key] = value;
79
78
  }
79
+ const SHADOWED_KEYS = new Set(Object.getOwnPropertyNames(Object.prototype));
80
80
  function isShadowedKey(key) {
81
- return key in Object.prototype;
81
+ return SHADOWED_KEYS.has(key);
82
82
  }
83
83
  function safeOwnRead(target, key) {
84
84
  if (isShadowedKey(key)) {
@@ -355,4 +355,4 @@ function structuralSnapshot(value) {
355
355
  return out;
356
356
  }
357
357
 
358
- export { ANONYMOUS_FORM_KEY_PREFIX as A, DEFAULT_HISTORY_MAX_SNAPSHOTS as D, RESERVED_KEY_PREFIX as R, safeOwnRead as a, safeAssign as b, callConsumerSchemaFn as c, consumerHas as d, safeOwnHas as e, spreadConsumerRecord as f, copyConsumerArray as g, consumerKeys as h, isShadowedKey as i, readConsumerProp as j, diffAndApply as k, DEFAULT_FIELD_VALIDATION_DEBOUNCE_MS as l, consumerSymbolKeys as m, normalizeNumericOption as n, applyChangedKeys as o, pickDefined as p, DEFAULT_MAX_RECURSION_DEPTH as q, readConsumerIndex as r, structuralSnapshot as s, ANONYMOUS_WIZARD_KEY_PREFIX as t };
358
+ export { ANONYMOUS_FORM_KEY_PREFIX as A, DEFAULT_HISTORY_MAX_SNAPSHOTS as D, RESERVED_KEY_PREFIX as R, safeOwnRead as a, safeAssign as b, callConsumerFn as c, safeOwnHas as d, consumerHas as e, spreadConsumerRecord as f, copyConsumerArray as g, consumerKeys as h, isShadowedKey as i, readConsumerProp as j, diffAndApply as k, DEFAULT_FIELD_VALIDATION_DEBOUNCE_MS as l, consumerSymbolKeys as m, normalizeNumericOption as n, applyChangedKeys as o, pickDefined as p, DEFAULT_MAX_RECURSION_DEPTH as q, readConsumerIndex as r, structuralSnapshot as s, ANONYMOUS_WIZARD_KEY_PREFIX as t };
@@ -18,19 +18,19 @@ import { z } from 'zod';
18
18
  type SupportedRootSchema = z.ZodObject<z.ZodRawShape> | z.ZodRecord<z.ZodTypeAny, z.ZodTypeAny> | z.ZodDiscriminatedUnion<string, readonly z.ZodDiscriminatedUnionOption<string>[]>;
19
19
 
20
20
  /**
21
- * v3 mirror of the Zod v4 `StorageShape`. Per top-level key, default
22
- * to `z.output<Shape[K]>` (the post-init view — defaults have fired,
23
- * Zod's own recursion peels nested defaults inside structural
24
- * containers); fall back to `z.input<Shape[K]>` for transform / pipe
25
- * carriers (`ZodEffects`, `ZodPipeline`) where storage holds the
26
- * pre-transform input — transforms only run at submission /
27
- * validation, not at the write boundary.
21
+ * The v3 mirror of Zod v4's `StorageShape`. Each top-level key defaults
22
+ * to `z.output<Shape[K]>`, the post-init view, where defaults have fired
23
+ * and Zod's own recursion has peeled nested defaults inside structural
24
+ * containers. A transform or pipe carrier (`ZodEffects`, `ZodPipeline`)
25
+ * falls back to `z.input<Shape[K]>`, storage there holding the
26
+ * pre-transform input: a transform runs at submission or validation, not
27
+ * at the write boundary.
28
28
  *
29
- * v3 quirk: `ZodEffects` covers BOTH `.transform()` and
30
- * `z.preprocess()` at the TS level — v3 doesn't carry a separate
31
- * preprocess class the way v4 does. Deferring to `z.input` for
32
- * `ZodEffects` means a top-level `z.preprocess(fn, T)` leaf reads as
33
- * the preprocess input (commonly `unknown`); reach for the
29
+ * A v3 quirk sharpens this: `ZodEffects` covers BOTH `.transform()` and
30
+ * `z.preprocess()` at the TS level, v3 carrying no separate preprocess
31
+ * class. So deferring to `z.input` there makes a top-level
32
+ * `z.preprocess(fn, T)` leaf read as the preprocess input, commonly
33
+ * `unknown`; reach for the
34
34
  * `AbstractSchema` escape hatch if a stronger type is needed.
35
35
  * Transforms preserve their pre-transform input shape, which matches
36
36
  * storage.
@@ -1,4 +1,4 @@
1
- import { r as resolveZodAliasTarget, i as isRewritableZodSpecifier } from './attaform.DhnPb6nK.mjs';
1
+ import { r as resolveZodAliasTarget, i as isRewritableZodSpecifier } from './attaform.BAf3UNn4.mjs';
2
2
 
3
3
  const TAP_NAME = "attaform";
4
4
  function createWebpackFamilyPlugin(tag, options) {
@@ -1,7 +1,7 @@
1
- import { a as InvalidUseFormConfigError } from './attaform.CZYt_5N_.mjs';
2
- import { u as useForm$2 } from './attaform.D1fnTifF.mjs';
3
- import { u as useForm$1 } from './attaform.C2MVyuxC.mjs';
4
- import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './attaform.B0dKL8ST.mjs';
1
+ import { a as InvalidUseFormConfigError } from './attaform.CdZIEf7_.mjs';
2
+ import { u as useForm$2 } from './attaform.D_pt1gOj.mjs';
3
+ import { u as useForm$1 } from './attaform.CO918TdU.mjs';
4
+ import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './attaform.DRsANMok.mjs';
5
5
 
6
6
  function isZodV4SchemaShape(value) {
7
7
  if (typeof value !== "object" || value === null) return false;
@@ -32,7 +32,7 @@ function missingZodError(tag) {
32
32
  return `[${tag}] zod is not installed. attaform requires zod as a peer dependency. Install \`zod@^3\` or \`zod@^4\`, OR pass \`attaform({ resolveZodAlias: false })\` to keep the runtime-dispatch unified entry (and silence this check).`;
33
33
  }
34
34
  function unclassifiableZodWarning(tag) {
35
- return `[${tag}] Could not classify the installed Zod major (corrupted package.json, monorepo edge case, or an unexpected version string). Falling through to runtime dispatch \u2014 both Zod adapters will ship in the bundle. Pass \`attaform({ resolveZodAlias: false })\` to silence this warning.`;
35
+ return `[${tag}] Could not classify the installed Zod major (corrupted package.json, monorepo edge case, or an unexpected version string). Falling through to runtime dispatch, so both Zod adapters will ship in the bundle. Pass \`attaform({ resolveZodAlias: false })\` to silence this warning.`;
36
36
  }
37
37
  function resolveZodAliasTarget(consumerRootDir, tag, resolveZodAlias, warnState) {
38
38
  if (!resolveZodAlias) return null;