attaform 0.27.5 → 0.28.0

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 (184) hide show
  1. package/dist/abstract.d.mts +5 -4
  2. package/dist/abstract.mjs +4 -3
  3. package/dist/chunks/fingerprint.mjs +0 -1
  4. package/dist/chunks/fingerprint2.mjs +1 -2
  5. package/dist/dev/abstract.mjs +4 -0
  6. package/dist/{chunks → dev/chunks}/dev-key-collision-warnings.mjs +0 -1
  7. package/dist/{chunks → dev/chunks}/devtools.mjs +5 -6
  8. package/dist/{chunks/fingerprint.cjs → dev/chunks/fingerprint.mjs} +7 -10
  9. package/dist/{chunks/fingerprint2.cjs → dev/chunks/fingerprint2.mjs} +32 -35
  10. package/dist/dev/directive.mjs +1 -0
  11. package/dist/dev/history.mjs +89 -0
  12. package/dist/dev/index.mjs +5 -0
  13. package/dist/dev/runtime/plugins/attaform.mjs +40 -0
  14. package/dist/{shared/attaform.f2zyNh5d.cjs → dev/shared/attaform-dev.6qxD-Yqo.mjs} +187 -43
  15. package/dist/{shared/attaform.CQN9R62B.cjs → dev/shared/attaform-dev.BJGA_UOS.mjs} +1 -4
  16. package/dist/{shared/attaform.Dc1mx48r.mjs → dev/shared/attaform-dev.BR8u0YOZ.mjs} +6 -7
  17. package/dist/dev/shared/attaform-dev.BXE2cr0L.mjs +220 -0
  18. package/dist/dev/shared/attaform-dev.By4PRjt0.mjs +248 -0
  19. package/dist/{shared/attaform.Cg_8gFQ7.mjs → dev/shared/attaform-dev.D2I8e_Mm.mjs} +132 -568
  20. package/dist/dev/shared/attaform-dev.Dr2YzS5B.mjs +197 -0
  21. package/dist/{shared/attaform.nMaz2C5P.mjs → dev/shared/attaform-dev.P7cseiEG.mjs} +178 -397
  22. package/dist/{shared/attaform.BypWgXRB.mjs → dev/shared/attaform-dev.WmuhD_CZ.mjs} +3955 -5029
  23. package/dist/{shared/attaform.Dkjh_F30.mjs → dev/shared/attaform-dev.oYrkP9dj.mjs} +160 -508
  24. package/dist/dev/zod-v3.mjs +17 -0
  25. package/dist/dev/zod-v4.mjs +16 -0
  26. package/dist/dev/zod.mjs +5 -0
  27. package/dist/directive.d.mts +20 -0
  28. package/dist/directive.mjs +1 -0
  29. package/dist/esbuild.mjs +0 -1
  30. package/dist/history.d.mts +59 -0
  31. package/dist/history.mjs +89 -0
  32. package/dist/index.d.mts +11 -5
  33. package/dist/index.mjs +5 -4
  34. package/dist/nuxt.d.mts +1 -1
  35. package/dist/nuxt.mjs +5 -2
  36. package/dist/rollup.mjs +0 -1
  37. package/dist/rspack.d.mts +6 -1
  38. package/dist/rspack.mjs +0 -1
  39. package/dist/runtime/components/AttaformDevtoolsPanel.vue +9 -8
  40. package/dist/runtime/plugins/attaform.mjs +1 -2
  41. package/dist/shared/{attaform.CIBMfxg9.d.ts → attaform.B4VkS43-.d.mts} +2 -2
  42. package/dist/shared/{attaform.Cg1rUfcF.cjs → attaform.B8k8JrmK.mjs} +3778 -5297
  43. package/dist/shared/attaform.BJGA_UOS.mjs +0 -1
  44. package/dist/shared/{attaform.CTiZ9Rrv.mjs → attaform.C09fpdLS.mjs} +172 -16
  45. package/dist/shared/{attaform.Bh8A6YAc.cjs → attaform.CJP3RkGa.mjs} +141 -590
  46. package/dist/shared/{attaform.CzL2CZ8U.d.ts → attaform.Cgu-hdSb.d.mts} +328 -78
  47. package/dist/shared/attaform.Cs2Rbdlo.mjs +0 -1
  48. package/dist/shared/{attaform.DcFDQVpa.d.ts → attaform.D5V4tZWq.d.mts} +79 -179
  49. package/dist/shared/{attaform.CF-EnyJn.cjs → attaform.D6DCnnQu.mjs} +11 -16
  50. package/dist/shared/attaform.DhnPb6nK.mjs +0 -1
  51. package/dist/shared/attaform.Dq4vWxuG.mjs +197 -0
  52. package/dist/shared/attaform.JfSWdEcb.d.mts +44 -0
  53. package/dist/shared/attaform.KvlEedlF.mjs +0 -1
  54. package/dist/shared/{attaform.Crv0RNiz.cjs → attaform.NLmerepI.mjs} +175 -557
  55. package/dist/shared/attaform.h0i6LijT.mjs +242 -0
  56. package/dist/shared/{attaform.Biytrv0-.cjs → attaform.uLbun31C.mjs} +204 -544
  57. package/dist/shared/attaform.v0fQtWyA.mjs +0 -1
  58. package/dist/shared/attaform.wfY8XFvm.mjs +197 -0
  59. package/dist/transforms.mjs +0 -1
  60. package/dist/vite.d.mts +17 -5
  61. package/dist/vite.mjs +24 -2
  62. package/dist/webpack.d.mts +6 -1
  63. package/dist/webpack.mjs +0 -1
  64. package/dist/zod-v3.d.mts +11 -6
  65. package/dist/zod-v3.mjs +17 -4
  66. package/dist/zod-v4.d.mts +12 -6
  67. package/dist/zod-v4.mjs +16 -4
  68. package/dist/zod.d.mts +4 -3
  69. package/dist/zod.mjs +5 -4
  70. package/package.json +23 -8
  71. package/skills/attaform/SKILL.md +2 -1
  72. package/dist/abstract.cjs +0 -48
  73. package/dist/abstract.cjs.map +0 -1
  74. package/dist/abstract.d.cts +0 -42
  75. package/dist/abstract.d.ts +0 -42
  76. package/dist/abstract.mjs.map +0 -1
  77. package/dist/chunks/dev-key-collision-warnings.cjs +0 -25
  78. package/dist/chunks/dev-key-collision-warnings.cjs.map +0 -1
  79. package/dist/chunks/dev-key-collision-warnings.mjs.map +0 -1
  80. package/dist/chunks/devtools.cjs +0 -157
  81. package/dist/chunks/devtools.cjs.map +0 -1
  82. package/dist/chunks/devtools.mjs.map +0 -1
  83. package/dist/chunks/fingerprint.cjs.map +0 -1
  84. package/dist/chunks/fingerprint.mjs.map +0 -1
  85. package/dist/chunks/fingerprint2.cjs.map +0 -1
  86. package/dist/chunks/fingerprint2.mjs.map +0 -1
  87. package/dist/esbuild.cjs +0 -28
  88. package/dist/esbuild.cjs.map +0 -1
  89. package/dist/esbuild.d.cts +0 -56
  90. package/dist/esbuild.d.ts +0 -56
  91. package/dist/esbuild.mjs.map +0 -1
  92. package/dist/index.cjs +0 -51
  93. package/dist/index.cjs.map +0 -1
  94. package/dist/index.d.cts +0 -249
  95. package/dist/index.d.ts +0 -249
  96. package/dist/index.mjs.map +0 -1
  97. package/dist/nuxt.cjs +0 -84
  98. package/dist/nuxt.cjs.map +0 -1
  99. package/dist/nuxt.d.cts +0 -66
  100. package/dist/nuxt.d.ts +0 -66
  101. package/dist/nuxt.mjs.map +0 -1
  102. package/dist/rollup.cjs +0 -24
  103. package/dist/rollup.cjs.map +0 -1
  104. package/dist/rollup.d.cts +0 -35
  105. package/dist/rollup.d.ts +0 -35
  106. package/dist/rollup.mjs.map +0 -1
  107. package/dist/rspack.cjs +0 -10
  108. package/dist/rspack.cjs.map +0 -1
  109. package/dist/rspack.d.cts +0 -40
  110. package/dist/rspack.d.ts +0 -40
  111. package/dist/rspack.mjs.map +0 -1
  112. package/dist/runtime/components/AttaformDevtoolsPanel.vue.d.ts +0 -7
  113. package/dist/runtime/components/DevtoolsValueTree.vue.d.ts +0 -35
  114. package/dist/runtime/plugins/attaform.cjs +0 -43
  115. package/dist/runtime/plugins/attaform.cjs.map +0 -1
  116. package/dist/runtime/plugins/attaform.d.cts +0 -5
  117. package/dist/runtime/plugins/attaform.d.ts +0 -5
  118. package/dist/runtime/plugins/attaform.mjs.map +0 -1
  119. package/dist/shared/attaform.B3abZaCV.d.cts +0 -2484
  120. package/dist/shared/attaform.BJGA_UOS.mjs.map +0 -1
  121. package/dist/shared/attaform.Bh8A6YAc.cjs.map +0 -1
  122. package/dist/shared/attaform.Biytrv0-.cjs.map +0 -1
  123. package/dist/shared/attaform.Bn0IzhD_.cjs +0 -800
  124. package/dist/shared/attaform.Bn0IzhD_.cjs.map +0 -1
  125. package/dist/shared/attaform.BypWgXRB.mjs.map +0 -1
  126. package/dist/shared/attaform.C9fPTxjB.d.cts +0 -41
  127. package/dist/shared/attaform.C9fPTxjB.d.ts +0 -41
  128. package/dist/shared/attaform.CF-EnyJn.cjs.map +0 -1
  129. package/dist/shared/attaform.CJ1Z9Mz4.d.mts +0 -2484
  130. package/dist/shared/attaform.CQN9R62B.cjs.map +0 -1
  131. package/dist/shared/attaform.CTiZ9Rrv.mjs.map +0 -1
  132. package/dist/shared/attaform.Cg1rUfcF.cjs.map +0 -1
  133. package/dist/shared/attaform.Cg_8gFQ7.mjs.map +0 -1
  134. package/dist/shared/attaform.Crv0RNiz.cjs.map +0 -1
  135. package/dist/shared/attaform.Cs2Rbdlo.mjs.map +0 -1
  136. package/dist/shared/attaform.CzL2CZ8U.d.cts +0 -4713
  137. package/dist/shared/attaform.CzL2CZ8U.d.mts +0 -4713
  138. package/dist/shared/attaform.DRUT703x.d.cts +0 -56
  139. package/dist/shared/attaform.DRUT703x.d.ts +0 -56
  140. package/dist/shared/attaform.DYwyM5Cp.d.cts +0 -232
  141. package/dist/shared/attaform.Dc1mx48r.mjs.map +0 -1
  142. package/dist/shared/attaform.DhnPb6nK.mjs.map +0 -1
  143. package/dist/shared/attaform.Dkjh_F30.mjs.map +0 -1
  144. package/dist/shared/attaform.DoQm_Vkd.cjs +0 -58
  145. package/dist/shared/attaform.DoQm_Vkd.cjs.map +0 -1
  146. package/dist/shared/attaform.DrHOqB-d.d.mts +0 -232
  147. package/dist/shared/attaform.KvlEedlF.mjs.map +0 -1
  148. package/dist/shared/attaform.RaTzp1WF.cjs +0 -26
  149. package/dist/shared/attaform.RaTzp1WF.cjs.map +0 -1
  150. package/dist/shared/attaform.f2zyNh5d.cjs.map +0 -1
  151. package/dist/shared/attaform.nMaz2C5P.mjs.map +0 -1
  152. package/dist/shared/attaform.v0fQtWyA.mjs.map +0 -1
  153. package/dist/shared/attaform.yUrz7C2z.cjs +0 -29
  154. package/dist/shared/attaform.yUrz7C2z.cjs.map +0 -1
  155. package/dist/transforms.cjs +0 -12
  156. package/dist/transforms.cjs.map +0 -1
  157. package/dist/transforms.d.cts +0 -73
  158. package/dist/transforms.d.ts +0 -73
  159. package/dist/transforms.mjs.map +0 -1
  160. package/dist/vite.cjs +0 -363
  161. package/dist/vite.cjs.map +0 -1
  162. package/dist/vite.d.cts +0 -133
  163. package/dist/vite.d.ts +0 -133
  164. package/dist/vite.mjs.map +0 -1
  165. package/dist/webpack.cjs +0 -10
  166. package/dist/webpack.cjs.map +0 -1
  167. package/dist/webpack.d.cts +0 -37
  168. package/dist/webpack.d.ts +0 -37
  169. package/dist/webpack.mjs.map +0 -1
  170. package/dist/zod-v3.cjs +0 -53
  171. package/dist/zod-v3.cjs.map +0 -1
  172. package/dist/zod-v3.d.cts +0 -246
  173. package/dist/zod-v3.d.ts +0 -246
  174. package/dist/zod-v3.mjs.map +0 -1
  175. package/dist/zod-v4.cjs +0 -55
  176. package/dist/zod-v4.cjs.map +0 -1
  177. package/dist/zod-v4.d.cts +0 -172
  178. package/dist/zod-v4.d.ts +0 -172
  179. package/dist/zod-v4.mjs.map +0 -1
  180. package/dist/zod.cjs +0 -51
  181. package/dist/zod.cjs.map +0 -1
  182. package/dist/zod.d.cts +0 -7
  183. package/dist/zod.d.ts +0 -7
  184. package/dist/zod.mjs.map +0 -1
@@ -0,0 +1,17 @@
1
+ export { i as isZodSchemaType, u as useForm, z as zodAdapter } from './shared/attaform-dev.D2I8e_Mm.mjs';
2
+ import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.6qxD-Yqo.mjs';
3
+ export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform-dev.Dr2YzS5B.mjs';
4
+ export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform-dev.WmuhD_CZ.mjs';
5
+ export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform-dev.BXE2cr0L.mjs';
6
+ export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.P7cseiEG.mjs';
7
+
8
+ const fieldMeta = installingFieldMetaStore;
9
+ function withMeta(schema, payload) {
10
+ const existing = getFieldMetaForSchema(schema) ?? {};
11
+ const Ctor = schema.constructor;
12
+ const cloned = new Ctor(schema._def);
13
+ installingFieldMetaStore.add(cloned, { ...existing, ...payload });
14
+ return cloned;
15
+ }
16
+
17
+ export { fieldMeta, withMeta };
@@ -0,0 +1,16 @@
1
+ export { U as UnsupportedSchemaError, a as assertZodVersion, k as kindOf, u as useForm, z as zodAdapter } from './shared/attaform-dev.oYrkP9dj.mjs';
2
+ import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.6qxD-Yqo.mjs';
3
+ export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform-dev.Dr2YzS5B.mjs';
4
+ export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform-dev.WmuhD_CZ.mjs';
5
+ export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform-dev.BXE2cr0L.mjs';
6
+ export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.P7cseiEG.mjs';
7
+
8
+ const fieldMeta = installingFieldMetaStore;
9
+ function withMeta(schema, payload) {
10
+ const existing = getFieldMetaForSchema(schema) ?? {};
11
+ const cloned = schema.clone();
12
+ installingFieldMetaStore.add(cloned, { ...existing, ...payload });
13
+ return cloned;
14
+ }
15
+
16
+ export { fieldMeta, withMeta };
@@ -0,0 +1,5 @@
1
+ export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform-dev.Dr2YzS5B.mjs';
2
+ export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform-dev.WmuhD_CZ.mjs';
3
+ export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform-dev.BXE2cr0L.mjs';
4
+ export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.P7cseiEG.mjs';
5
+ export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform-dev.BR8u0YOZ.mjs';
@@ -0,0 +1,20 @@
1
+ export { i as installVRegister, v as vRegister } from './shared/attaform.JfSWdEcb.mjs';
2
+ import { ar as RegisterModelDynamicCustomDirective } from './shared/attaform.Cgu-hdSb.mjs';
3
+ import 'vue';
4
+
5
+ /**
6
+ * Real `v-register` variant for `<input type="file">`. Reads
7
+ * `event.target.files` into form state as `File | null` (single) or
8
+ * `File[]` (multiple). Storage is the canonical blank shape (`null` /
9
+ * `[]`) when no file is selected, with the path marked in
10
+ * `blankPaths` so the friendly "No value supplied" error surfaces
11
+ * through `derivedBlankErrors` on required-file fields — same channel
12
+ * as required numbers / bigints.
13
+ *
14
+ * The `beforeUpdate` hook keeps the DOM in lockstep with storage by
15
+ * clearing `el.value` when storage transitions to blank — the only
16
+ * programmatic write browsers permit on file inputs.
17
+ */
18
+ declare const vRegisterFile: RegisterModelDynamicCustomDirective;
19
+
20
+ export { vRegisterFile };
@@ -0,0 +1 @@
1
+ export { i as installVRegister, v as vRegister, b as vRegisterFile } from './shared/attaform.uLbun31C.mjs';
package/dist/esbuild.mjs CHANGED
@@ -23,4 +23,3 @@ function attaform(options = {}) {
23
23
  }
24
24
 
25
25
  export { attaform };
26
- //# sourceMappingURL=esbuild.mjs.map
@@ -0,0 +1,59 @@
1
+ import { x as HistoryPlugin } from './shared/attaform.Cgu-hdSb.mjs';
2
+ import 'vue';
3
+
4
+ /**
5
+ * Bounded undo/redo history for a form, delivered as the `attaform/history`
6
+ * entry: `useForm({ history: historyPlugin({ max }) })`. The plugin object
7
+ * is the delivery seam — `useForm` calls its `attach(kernel)` against the
8
+ * form's store, so the runtime here rides the consumer's own import instead
9
+ * of every form's eager path.
10
+ *
11
+ * Storage is a snapshot ring buffer: `positions` holds one full
12
+ * `HistorySnapshot` per reachable state (oldest → newest) and `cursor`
13
+ * points at the current one. Every form change appends a snapshot (dropping
14
+ * any redo branch past the cursor); `undo()` / `redo()` move the cursor and
15
+ * restore that position's snapshot wholesale. When the buffer exceeds the
16
+ * capacity cap, the oldest position falls off the front (FIFO eviction).
17
+ *
18
+ * Each snapshot carries the form value (deep structural clone), the
19
+ * `blankPaths` set, and both error stores' entries — everything `undo()`
20
+ * needs to restore a position without consulting neighbours.
21
+ *
22
+ * `reset()` is treated as an ordinary mutation: `applyFormReplacement`
23
+ * fires `onFormChange`, the post-reset state lands as a new position, and
24
+ * the pre-reset state stays one undo away. Persistence hydration
25
+ * (`meta.hydration === true`) is the floor — the buffer wipes and reseeds
26
+ * from the post-hydration snapshot, so `undo()` can't reach back into a
27
+ * pre-hydration default the consumer never saw.
28
+ *
29
+ * Field record state (touched / focused / blurred / connected) is
30
+ * deliberately NOT snapshotted. Those flags represent UI interaction
31
+ * history and shouldn't rewind when the user hits undo — a field that
32
+ * was touched stays touched.
33
+ */
34
+ type HistoryPluginOptions = {
35
+ /**
36
+ * Cap on total reachable positions (the current one plus everything
37
+ * reachable via `undo()` / `redo()`). Default `128`. When a fresh
38
+ * mutation would exceed it, the oldest position is dropped. `0` keeps
39
+ * no positions beyond the current state — history effectively off,
40
+ * preserved as an explicit override.
41
+ */
42
+ max?: number;
43
+ };
44
+ /**
45
+ * Create the undo/redo plugin for `useForm({ history })`. See
46
+ * {@link HistoryPlugin} for the full behaviour contract.
47
+ *
48
+ * ```ts
49
+ * import { historyPlugin } from 'attaform/history'
50
+ *
51
+ * const form = useForm({ schema, history: historyPlugin() })
52
+ * // or tune the position cap:
53
+ * const audited = useForm({ schema, history: historyPlugin({ max: 200 }) })
54
+ * ```
55
+ */
56
+ declare function historyPlugin(options?: HistoryPluginOptions): HistoryPlugin;
57
+
58
+ export { HistoryPlugin, historyPlugin };
59
+ export type { HistoryPluginOptions };
@@ -0,0 +1,89 @@
1
+ import { shallowRef, computed } from 'vue';
2
+ import { n as normalizeNumericOption, D as DEFAULT_HISTORY_MAX_SNAPSHOTS, s as structuralSnapshot } from './shared/attaform.h0i6LijT.mjs';
3
+
4
+ function captureErrorCells(map) {
5
+ const out = [];
6
+ for (const [k, cell] of map) {
7
+ out.push([k, { schema: [...cell.schema], user: [...cell.user] }]);
8
+ }
9
+ return out;
10
+ }
11
+ function createHistoryRuntime(kernel, max) {
12
+ const capacity = Math.max(1, max);
13
+ function captureSnapshot() {
14
+ return {
15
+ form: structuralSnapshot(kernel.form.value),
16
+ blankPaths: [...kernel.blankPaths],
17
+ errorCells: captureErrorCells(kernel.errorCells)
18
+ };
19
+ }
20
+ const positions = shallowRef([captureSnapshot()]);
21
+ const cursor = shallowRef(0);
22
+ let suppressNext = false;
23
+ const unsubscribeChange = kernel.onFormChange((_next, meta) => {
24
+ if (suppressNext) {
25
+ suppressNext = false;
26
+ return;
27
+ }
28
+ if (meta?.hydration === true) {
29
+ clear();
30
+ return;
31
+ }
32
+ const next = positions.value.slice(0, cursor.value + 1);
33
+ next.push(captureSnapshot());
34
+ while (next.length > capacity) next.shift();
35
+ positions.value = next;
36
+ cursor.value = next.length - 1;
37
+ });
38
+ function restorePosition(snap) {
39
+ suppressNext = true;
40
+ kernel.blankPaths.clear();
41
+ for (const key of snap.blankPaths) kernel.blankPaths.add(key);
42
+ kernel.applyFormReplacement(structuralSnapshot(snap.form));
43
+ kernel.restoreErrorCells(snap.errorCells);
44
+ }
45
+ function stepTo(nextCursor) {
46
+ const snap = positions.value[nextCursor];
47
+ if (snap === void 0) return false;
48
+ cursor.value = nextCursor;
49
+ restorePosition(snap);
50
+ return true;
51
+ }
52
+ function undo() {
53
+ return cursor.value > 0 && stepTo(cursor.value - 1);
54
+ }
55
+ function redo() {
56
+ return cursor.value < positions.value.length - 1 && stepTo(cursor.value + 1);
57
+ }
58
+ function clear() {
59
+ positions.value = [captureSnapshot()];
60
+ cursor.value = 0;
61
+ }
62
+ return {
63
+ undo,
64
+ redo,
65
+ clear,
66
+ canUndo: computed(() => cursor.value > 0),
67
+ canRedo: computed(() => cursor.value < positions.value.length - 1),
68
+ historySize: computed(() => positions.value.length),
69
+ dispose() {
70
+ unsubscribeChange();
71
+ positions.value = positions.value.slice(cursor.value, cursor.value + 1);
72
+ cursor.value = 0;
73
+ }
74
+ };
75
+ }
76
+ function historyPlugin(options) {
77
+ const max = normalizeNumericOption({
78
+ value: options?.max ?? DEFAULT_HISTORY_MAX_SNAPSHOTS,
79
+ source: "historyPlugin({ max })",
80
+ allowInfinity: false,
81
+ min: 0,
82
+ defaultValue: DEFAULT_HISTORY_MAX_SNAPSHOTS
83
+ });
84
+ return {
85
+ attach: (kernel) => createHistoryRuntime(kernel, max)
86
+ };
87
+ }
88
+
89
+ export { historyPlugin };
package/dist/index.d.mts CHANGED
@@ -1,8 +1,9 @@
1
- export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEFAULT_TIMINGS, f as DEVTOOLS_WINDOW_KEY, g as DisplayTimings, F as FormStatus, h as FormStatusSeed, G as GateMarker, I as InjectWizardInput, i as InvalidPathError, j as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, k as ReservedFormKeyError, S as SerializedAttaformState, l as SerializedFormData, m as StepSlot, n as SubmitErrorHandlerError, U as UseRegisterReturn, o as UseWizardReturnType, W as WizardAggregateError, p as WizardCtx, q as WizardCtxForm, r as WizardOnError, s as WizardOnSubmit, t as WizardOptions, u as WizardPersistFn, v as WizardRestoreFn, w as WizardRestoreState, x as WizardStatusesProxy, y as WizardSubmitContext, z as assignKey, B as createAttaform, E as createRegistry, H as defaultCoercionRules, J as defaultDisplayState, K as defineCoercion, M as escapeForInlineScript, N as gate, P as getRegistryFromApp, Q as hydrateAttaformState, T as injectForm, V as injectWizard, X as isRegisterValue, Y as kAttaformRegistry, Z as lazy, _ as makeDefaultDisplayState, $ as renderAttaformState, a0 as useRegister, a1 as useRegistry, a2 as useWizard, a3 as vRegister } from './shared/attaform.CJ1Z9Mz4.mjs';
2
- import { G as GenericForm, F as FormKey, U as UseFormConfiguration, A as AbstractSchema, aq as AcceptableDefaults, ae as ValidateOnConfig, a as UseFormReturnType, D as DefaultValuesInput, o as FieldMetaPayload } from './shared/attaform.CzL2CZ8U.mjs';
3
- export { b as ArrayItem, c as ArrayPath, d as AttaformDefaults, C as CoercionEntry, e as CoercionRegistry, f as CoercionResult, g as CustomDirectiveRegisterAssignerFn, h as DeepPartial, i as DefaultValuesResponse, j as DefaultValuesShape, k as DisplayCtx, l as DisplayMachine, m as DisplayState, E as ErrorInput, n as ErrorsProxyShape, p as FieldState, q as FieldStateMap, r as FieldStateMapEntry, s as FlatPath, t as FormErrorRecord, u as FormErrorsSurface, v as FormMeta, w as GetDisplayState, H as HandleSubmit, x as HistoryConfig, I as IsTuple, y as IsUnion, J as JoinSegments, z as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, B as NestedType, O as OnError, P as OnInvalidSubmitPolicy, Q as OnSubmit, R as PartialFlatPath, S as Path, T as PathKey, V as PendingValidationStatus, W as Primitive, X as ROOT_PATH, Y as ROOT_PATH_KEY, Z as ReactiveValidationStatus, _ as RegisterDirective, $ as RegisterFlatPath, a0 as RegisterOptions, a1 as RegisterSelectModifier, a2 as RegisterTextModifier, a3 as RegisterTransform, a4 as RegisterValue, a5 as Segment, a6 as SetValueCallback, a7 as SetValuePayload, a8 as SettledValidationStatus, a9 as SlimPrimitiveKind, aa as SlimRuntimeOf, ab as SubmitHandler, ac as Unset, ad as ValidateOn, af as ValidationError, ag as ValidationResponse, ah as ValidationResponseWithoutValue, ai as ValueOfUnion, aj as WriteMeta, ak as WriteShape, al as canonicalizePath, am as isPathPrefix, an as isUnset, ao as parseDottedPath, ap as unset } from './shared/attaform.CzL2CZ8U.mjs';
4
- import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.DrHOqB-d.mjs';
5
- export { P as PathInput, a as PathOutput } from './shared/attaform.DrHOqB-d.mjs';
1
+ export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEFAULT_TIMINGS, f as DEVTOOLS_WINDOW_KEY, g as DisplayTimings, F as FormStatus, h as FormStatusSeed, G as GateMarker, I as InjectWizardInput, i as InvalidPathError, j as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, k as ReservedFormKeyError, S as SerializedAttaformState, l as SerializedFormData, m as StepSlot, n as SubmitErrorHandlerError, U as UseRegisterReturn, o as UseWizardReturnType, W as WizardAggregateError, p as WizardCtx, q as WizardCtxForm, r as WizardOnError, s as WizardOnSubmit, t as WizardOptions, u as WizardPersistFn, v as WizardRestoreFn, w as WizardRestoreState, x as WizardStatusesProxy, y as WizardSubmitContext, z as assignKey, B as createAttaform, E as createRegistry, H as defaultCoercionRules, J as defaultDisplayState, K as defineCoercion, M as escapeForInlineScript, N as gate, P as getRegistryFromApp, Q as hydrateAttaformState, T as injectForm, V as injectWizard, X as isRegisterValue, Y as kAttaformRegistry, Z as lazy, _ as makeDefaultDisplayState, $ as renderAttaformState, a0 as useRegister, a1 as useRegistry, a2 as useWizard } from './shared/attaform.D5V4tZWq.mjs';
2
+ import { G as GenericForm, F as FormKey, U as UseFormConfiguration, A as AbstractSchema, as as AcceptableDefaults, af as ValidateOnConfig, a as UseFormReturnType, D as DefaultValuesInput, o as FieldMetaPayload } from './shared/attaform.Cgu-hdSb.mjs';
3
+ export { b as ArrayItem, c as ArrayPath, d as AttaformDefaults, C as CoercionEntry, e as CoercionRegistry, f as CoercionResult, g as CustomDirectiveRegisterAssignerFn, h as DeepPartial, i as DefaultValuesResponse, j as DefaultValuesShape, k as DisplayCtx, l as DisplayMachine, m as DisplayState, E as ErrorInput, n as ErrorsProxyShape, p as FieldState, q as FieldStateMap, r as FieldStateMapEntry, s as FlatPath, t as FormErrorRecord, u as FormErrorsSurface, v as FormMeta, w as GetDisplayState, H as HandleSubmit, x as HistoryPlugin, I as IsTuple, y as IsUnion, J as JoinSegments, z as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, B as NestedType, O as OnError, P as OnInvalidSubmitPolicy, Q as OnSubmit, R as ParseOptions, S as PartialFlatPath, T as Path, V as PathKey, W as PendingValidationStatus, X as Primitive, Y as ROOT_PATH, Z as ROOT_PATH_KEY, _ as ReactiveValidationStatus, $ as RegisterDirective, a0 as RegisterFlatPath, a1 as RegisterOptions, a2 as RegisterSelectModifier, a3 as RegisterTextModifier, a4 as RegisterTransform, a5 as RegisterValue, a6 as Segment, a7 as SetValueCallback, a8 as SetValuePayload, a9 as SettledValidationStatus, aa as SlimPrimitiveKind, ab as SlimRuntimeOf, ac as SubmitHandler, ad as Unset, ae as ValidateOn, ag as ValidationError, ah as ValidationResponse, ai as ValidationResponseWithoutValue, aj as ValueOfUnion, ak as WriteMeta, al as WriteShape, am as canonicalizePath, an as isPathPrefix, ao as isUnset, ap as parseDottedPath, aq as unset } from './shared/attaform.Cgu-hdSb.mjs';
4
+ export { v as vRegister } from './shared/attaform.JfSWdEcb.mjs';
5
+ import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.B4VkS43-.mjs';
6
+ export { P as PathInput, a as PathOutput } from './shared/attaform.B4VkS43-.mjs';
6
7
  import { S as SupportedRootSchema$1, U as UnwrapZodRoot, a as StorageShape$1 } from './shared/attaform.DRUT703x.mjs';
7
8
  import { z } from 'zod';
8
9
  import 'vue';
@@ -226,6 +227,11 @@ type ZodFieldMetaRegistry = ReturnType<typeof z.registry<FieldMetaPayload>>;
226
227
  * `schema.register(fieldMeta, payload)` chain type-checks for v4
227
228
  * users; the runtime call only needs `.add` structurally, which the
228
229
  * shared store provides.
230
+ *
231
+ * Backed by `installingFieldMetaStore`: every `add` also installs the
232
+ * path-walking resolver into the shared store's builder slot, so the
233
+ * walk's bytes ride this module's import instead of the adapters. A
234
+ * consumer that never registers metadata never ships the walk.
229
235
  */
230
236
  declare const fieldMeta: ZodFieldMetaRegistry;
231
237
  /**
package/dist/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
- export { A as AttaformError, D as DEVTOOLS_WINDOW_KEY, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as assignKey, f as canonicalizePath, g as createAttaform, h as createRegistry, i as getRegistryFromApp, j as hydrateAttaformState, k as isPathPrefix, l as kAttaformRegistry, p as parseDottedPath, r as renderAttaformState, u as useRegistry, v as vRegister } from './shared/attaform.nMaz2C5P.mjs';
2
- export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform.BypWgXRB.mjs';
3
- export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.Dc1mx48r.mjs';
1
+ export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform.wfY8XFvm.mjs';
2
+ export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform.B8k8JrmK.mjs';
3
+ export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform.Dq4vWxuG.mjs';
4
+ export { a as assignKey, v as vRegister } from './shared/attaform.uLbun31C.mjs';
5
+ export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.D6DCnnQu.mjs';
4
6
  export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
5
- //# sourceMappingURL=index.mjs.map
package/dist/nuxt.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { d as AttaformDefaults } from './shared/attaform.CzL2CZ8U.mjs';
2
+ import { d as AttaformDefaults } from './shared/attaform.Cgu-hdSb.mjs';
3
3
  import 'vue';
4
4
 
5
5
  /**
package/dist/nuxt.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { existsSync } from 'node:fs';
1
2
  import { createRequire } from 'node:module';
2
3
  import { join } from 'node:path';
3
4
  import { pathToFileURL } from 'node:url';
@@ -47,8 +48,11 @@ var nuxt_default = defineNuxtModule({
47
48
  if (_options.autoImports !== false) {
48
49
  addImports(attaformAutoImports);
49
50
  }
51
+ const prodPluginSrc = resolver.resolve("./runtime/plugins/attaform");
52
+ const devPluginSrc = resolver.resolve("./dev/runtime/plugins/attaform");
53
+ const devPluginExists = [".mjs", ".ts"].some((ext) => existsSync(devPluginSrc + ext));
50
54
  addPlugin({
51
- src: resolver.resolve("./runtime/plugins/attaform")
55
+ src: nuxt.options.dev && devPluginExists ? devPluginSrc : prodPluginSrc
52
56
  });
53
57
  if (nuxt.options.dev) {
54
58
  nuxt.hook("ready", async () => {
@@ -78,4 +82,3 @@ var nuxt_default = defineNuxtModule({
78
82
  });
79
83
 
80
84
  export { nuxt_default as default };
81
- //# sourceMappingURL=nuxt.mjs.map
package/dist/rollup.mjs CHANGED
@@ -19,4 +19,3 @@ function attaform(options = {}) {
19
19
  }
20
20
 
21
21
  export { attaform };
22
- //# sourceMappingURL=rollup.mjs.map
package/dist/rspack.d.mts CHANGED
@@ -24,7 +24,12 @@ import { W as WebpackFamilyPlugin, a as WebpackFamilyPluginOptions } from './sha
24
24
  * transforms that `attaform/vite` wires (load-bearing for SSR initial
25
25
  * render) are `@vitejs/plugin-vue`-specific and do not transfer; a
26
26
  * non-Vite consumer that needs them wires `attaform/transforms` into
27
- * their Vue compiler separately.
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)
28
33
  *
29
34
  * Zero-dep: the plugin imports nothing from `@rspack/core` (it taps the
30
35
  * resolve hook the compiler injects at the consumer's build).
package/dist/rspack.mjs CHANGED
@@ -5,4 +5,3 @@ function attaform(options = {}) {
5
5
  }
6
6
 
7
7
  export { attaform };
8
- //# sourceMappingURL=rspack.mjs.map
@@ -72,14 +72,18 @@ import { computed, onUnmounted, ref, watch } from 'vue'
72
72
  void updateTick.value
73
73
  const form = activeForm.value
74
74
  if (form === null) return []
75
- return Array.from(form.schemaErrors.entries())
75
+ return Array.from(form.errorCells.entries())
76
+ .filter(([, cell]) => cell.schema.length > 0)
77
+ .map(([key, cell]) => [key, cell.schema] as const)
76
78
  })
77
79
 
78
80
  const userErrorRows = computed(() => {
79
81
  void updateTick.value
80
82
  const form = activeForm.value
81
83
  if (form === null) return []
82
- return Array.from(form.userErrors.entries())
84
+ return Array.from(form.errorCells.entries())
85
+ .filter(([, cell]) => cell.user.length > 0)
86
+ .map(([key, cell]) => [key, cell.user] as const)
83
87
  })
84
88
 
85
89
  const aggregates = computed(() => {
@@ -217,14 +221,11 @@ import { computed, onUnmounted, ref, watch } from 'vue'
217
221
  value = (value as Record<string | number, unknown>)[seg]
218
222
  }
219
223
 
224
+ const cell = form.errorCells.get(canonicalKey)
220
225
  const schemaEntries =
221
- (form.schemaErrors.get(canonicalKey) as
222
- | ReadonlyArray<{ message: string; code: string }>
223
- | undefined) ?? []
226
+ (cell?.schema as ReadonlyArray<{ message: string; code: string }> | undefined) ?? []
224
227
  const userEntries =
225
- (form.userErrors.get(canonicalKey) as
226
- | ReadonlyArray<{ message: string; code: string }>
227
- | undefined) ?? []
228
+ (cell?.user as ReadonlyArray<{ message: string; code: string }> | undefined) ?? []
228
229
 
229
230
  return {
230
231
  record,
@@ -1,5 +1,5 @@
1
1
  import { defineNuxtPlugin, useRuntimeConfig, useRoute } from 'nuxt/app';
2
- import { g as createAttaform, m as kAttaformWizardActiveStepResolver, r as renderAttaformState, j as hydrateAttaformState, i as getRegistryFromApp, D as DEVTOOLS_WINDOW_KEY } from '../../shared/attaform.nMaz2C5P.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.Dq4vWxuG.mjs';
3
3
 
4
4
  var attaform_default = defineNuxtPlugin({
5
5
  // `enforce: 'pre'` makes the "we run before any component's setup" claim
@@ -38,4 +38,3 @@ var attaform_default = defineNuxtPlugin({
38
38
  });
39
39
 
40
40
  export { attaform_default as default };
41
- //# sourceMappingURL=attaform.mjs.map
@@ -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, aq as AcceptableDefaults, ae as ValidateOnConfig, a as UseFormReturnType } from './attaform.CzL2CZ8U.js';
2
+ import { G as GenericForm, s as FlatPath, B as NestedType, F as FormKey, U as UseFormConfiguration, A as AbstractSchema, as as AcceptableDefaults, af as ValidateOnConfig, a as UseFormReturnType } from './attaform.Cgu-hdSb.mjs';
3
3
 
4
4
  /**
5
5
  * The Zod v4 schema roots `useForm` accepts. A fixed-shape
@@ -46,7 +46,7 @@ type SupportedRootSchema = z.ZodObject<z.ZodRawShape> | z.ZodRecord | z.ZodDiscr
46
46
  * normalizer runs at parse time, NOT at the write boundary, so
47
47
  * storage holds the consumer's raw input and the type collapses
48
48
  * to `unknown` to match. Reach the typed value via
49
- * `handleSubmit`, `validate`, or `validateAsync` — they re-parse
49
+ * `handleSubmit`, `validate`, or `parse` — they re-parse
50
50
  * storage through the wrapper.
51
51
  *
52
52
  * 2. `inner.transform(fn)` — compiles to `ZodPipe<inner, ZodTransform>`.