attaform 0.27.6 → 0.29.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 (192) hide show
  1. package/dist/abstract.d.mts +5 -4
  2. package/dist/abstract.mjs +4 -3
  3. package/dist/chunks/fingerprint.mjs +1 -2
  4. package/dist/chunks/fingerprint2.mjs +2 -3
  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/dev/shared/attaform-dev.A-TpJW0B.mjs +207 -0
  15. package/dist/dev/shared/attaform-dev.BO-71R54.mjs +820 -0
  16. package/dist/{shared/attaform.D6tk90Rc.cjs → dev/shared/attaform-dev.BgM6FdtA.mjs} +324 -73
  17. package/dist/dev/shared/attaform-dev.ButTkwHd.mjs +375 -0
  18. package/dist/{shared/attaform.BJGA_UOS.mjs → dev/shared/attaform-dev.BxfsuwBR.mjs} +8 -1
  19. package/dist/{shared/attaform.nMaz2C5P.mjs → dev/shared/attaform-dev.D8aoKb89.mjs} +190 -400
  20. package/dist/dev/shared/attaform-dev.DD5m2W51.mjs +220 -0
  21. package/dist/{shared/attaform.CKH2lGdL.mjs → dev/shared/attaform-dev.DHuydLAC.mjs} +3867 -4731
  22. package/dist/{shared/attaform.DYEr28Pt.mjs → dev/shared/attaform-dev.DrzObAZo.mjs} +6 -7
  23. package/dist/{shared/attaform.B1ZYt2Li.mjs → dev/shared/attaform-dev.q6UutkCx.mjs} +274 -672
  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 +14 -6
  33. package/dist/index.mjs +5 -4
  34. package/dist/nuxt.d.mts +10 -10
  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.CoR4mWfv.mjs → attaform.B0dKL8ST.mjs} +309 -46
  42. package/dist/shared/{attaform.Cs2Rbdlo.mjs → attaform.BK0cgu2K.mjs} +123 -140
  43. package/dist/shared/{attaform.B9Wyhfro.cjs → attaform.BndjUUYX.mjs} +11 -16
  44. package/dist/shared/{attaform.CQN9R62B.cjs → attaform.BxfsuwBR.mjs} +9 -4
  45. package/dist/shared/attaform.C2MVyuxC.mjs +811 -0
  46. package/dist/shared/{attaform.Fp3sCrVs.d.ts → attaform.CIWLMY-R.d.mts} +2 -2
  47. package/dist/shared/attaform.CZMAYwSK.mjs +6383 -0
  48. package/dist/shared/attaform.CZYt_5N_.mjs +207 -0
  49. package/dist/shared/{attaform.DniawQLP.d.cts → attaform.CsoeRi3P.d.mts} +490 -98
  50. package/dist/shared/attaform.Cvao8bW5.mjs +358 -0
  51. package/dist/shared/attaform.D0x-qSXm.mjs +197 -0
  52. package/dist/shared/{attaform.D8kliaKw.cjs → attaform.D1fnTifF.mjs} +279 -692
  53. package/dist/shared/{attaform.CHlJLAiv.d.mts → attaform.DDtqHYv1.d.mts} +155 -184
  54. package/dist/shared/{attaform.Biytrv0-.cjs → attaform.DffRL5pP.mjs} +215 -547
  55. package/dist/shared/attaform.DhnPb6nK.mjs +0 -1
  56. package/dist/shared/attaform.KvlEedlF.mjs +0 -1
  57. package/dist/shared/attaform.axHXVQO7.d.mts +44 -0
  58. package/dist/shared/attaform.v0fQtWyA.mjs +0 -1
  59. package/dist/transforms.d.mts +0 -22
  60. package/dist/transforms.mjs +1 -2
  61. package/dist/vite.d.mts +30 -9
  62. package/dist/vite.mjs +27 -4
  63. package/dist/webpack.d.mts +6 -1
  64. package/dist/webpack.mjs +0 -1
  65. package/dist/zod-v3.d.mts +13 -6
  66. package/dist/zod-v3.mjs +17 -4
  67. package/dist/zod-v4.d.mts +19 -26
  68. package/dist/zod-v4.mjs +16 -4
  69. package/dist/zod.d.mts +4 -3
  70. package/dist/zod.mjs +5 -4
  71. package/package.json +38 -20
  72. package/skills/attaform/SKILL.md +6 -2
  73. package/skills/attaform/references/custom-components.md +7 -2
  74. package/skills/attaform/references/errors.md +8 -3
  75. package/skills/attaform/references/saving.md +77 -0
  76. package/skills/attaform/references/wizards.md +10 -8
  77. package/dist/abstract.cjs +0 -48
  78. package/dist/abstract.cjs.map +0 -1
  79. package/dist/abstract.d.cts +0 -42
  80. package/dist/abstract.d.ts +0 -42
  81. package/dist/abstract.mjs.map +0 -1
  82. package/dist/chunks/dev-key-collision-warnings.cjs +0 -25
  83. package/dist/chunks/dev-key-collision-warnings.cjs.map +0 -1
  84. package/dist/chunks/dev-key-collision-warnings.mjs.map +0 -1
  85. package/dist/chunks/devtools.cjs +0 -157
  86. package/dist/chunks/devtools.cjs.map +0 -1
  87. package/dist/chunks/devtools.mjs.map +0 -1
  88. package/dist/chunks/fingerprint.cjs.map +0 -1
  89. package/dist/chunks/fingerprint.mjs.map +0 -1
  90. package/dist/chunks/fingerprint2.cjs.map +0 -1
  91. package/dist/chunks/fingerprint2.mjs.map +0 -1
  92. package/dist/esbuild.cjs +0 -28
  93. package/dist/esbuild.cjs.map +0 -1
  94. package/dist/esbuild.d.cts +0 -56
  95. package/dist/esbuild.d.ts +0 -56
  96. package/dist/esbuild.mjs.map +0 -1
  97. package/dist/index.cjs +0 -51
  98. package/dist/index.cjs.map +0 -1
  99. package/dist/index.d.cts +0 -249
  100. package/dist/index.d.ts +0 -249
  101. package/dist/index.mjs.map +0 -1
  102. package/dist/nuxt.cjs +0 -84
  103. package/dist/nuxt.cjs.map +0 -1
  104. package/dist/nuxt.d.cts +0 -66
  105. package/dist/nuxt.d.ts +0 -66
  106. package/dist/nuxt.mjs.map +0 -1
  107. package/dist/rollup.cjs +0 -24
  108. package/dist/rollup.cjs.map +0 -1
  109. package/dist/rollup.d.cts +0 -35
  110. package/dist/rollup.d.ts +0 -35
  111. package/dist/rollup.mjs.map +0 -1
  112. package/dist/rspack.cjs +0 -10
  113. package/dist/rspack.cjs.map +0 -1
  114. package/dist/rspack.d.cts +0 -40
  115. package/dist/rspack.d.ts +0 -40
  116. package/dist/rspack.mjs.map +0 -1
  117. package/dist/runtime/components/AttaformDevtoolsPanel.vue.d.ts +0 -7
  118. package/dist/runtime/components/DevtoolsValueTree.vue.d.ts +0 -35
  119. package/dist/runtime/plugins/attaform.cjs +0 -43
  120. package/dist/runtime/plugins/attaform.cjs.map +0 -1
  121. package/dist/runtime/plugins/attaform.d.cts +0 -5
  122. package/dist/runtime/plugins/attaform.d.ts +0 -5
  123. package/dist/runtime/plugins/attaform.mjs.map +0 -1
  124. package/dist/shared/attaform.B1ZYt2Li.mjs.map +0 -1
  125. package/dist/shared/attaform.B9Wyhfro.cjs.map +0 -1
  126. package/dist/shared/attaform.BGDV42hI.d.cts +0 -232
  127. package/dist/shared/attaform.BJGA_UOS.mjs.map +0 -1
  128. package/dist/shared/attaform.Biytrv0-.cjs.map +0 -1
  129. package/dist/shared/attaform.Bn0IzhD_.cjs +0 -800
  130. package/dist/shared/attaform.Bn0IzhD_.cjs.map +0 -1
  131. package/dist/shared/attaform.C9fPTxjB.d.cts +0 -41
  132. package/dist/shared/attaform.C9fPTxjB.d.ts +0 -41
  133. package/dist/shared/attaform.CKH2lGdL.mjs.map +0 -1
  134. package/dist/shared/attaform.CQN9R62B.cjs.map +0 -1
  135. package/dist/shared/attaform.CoR4mWfv.mjs.map +0 -1
  136. package/dist/shared/attaform.Cs2Rbdlo.mjs.map +0 -1
  137. package/dist/shared/attaform.D6tk90Rc.cjs.map +0 -1
  138. package/dist/shared/attaform.D8kliaKw.cjs.map +0 -1
  139. package/dist/shared/attaform.DLknk9nF.d.mts +0 -232
  140. package/dist/shared/attaform.DMxM2kol.mjs +0 -1275
  141. package/dist/shared/attaform.DMxM2kol.mjs.map +0 -1
  142. package/dist/shared/attaform.DRUT703x.d.cts +0 -56
  143. package/dist/shared/attaform.DRUT703x.d.ts +0 -56
  144. package/dist/shared/attaform.DYEr28Pt.mjs.map +0 -1
  145. package/dist/shared/attaform.DdQN7sgN.cjs +0 -1302
  146. package/dist/shared/attaform.DdQN7sgN.cjs.map +0 -1
  147. package/dist/shared/attaform.DhnPb6nK.mjs.map +0 -1
  148. package/dist/shared/attaform.DniawQLP.d.mts +0 -4763
  149. package/dist/shared/attaform.DniawQLP.d.ts +0 -4763
  150. package/dist/shared/attaform.DoQm_Vkd.cjs +0 -58
  151. package/dist/shared/attaform.DoQm_Vkd.cjs.map +0 -1
  152. package/dist/shared/attaform.DrvMscNX.cjs +0 -7697
  153. package/dist/shared/attaform.DrvMscNX.cjs.map +0 -1
  154. package/dist/shared/attaform.F2Q8iv38.d.ts +0 -2494
  155. package/dist/shared/attaform.FmqKO1Ex.d.cts +0 -2494
  156. package/dist/shared/attaform.KvlEedlF.mjs.map +0 -1
  157. package/dist/shared/attaform.RaTzp1WF.cjs +0 -26
  158. package/dist/shared/attaform.RaTzp1WF.cjs.map +0 -1
  159. package/dist/shared/attaform.nMaz2C5P.mjs.map +0 -1
  160. package/dist/shared/attaform.v0fQtWyA.mjs.map +0 -1
  161. package/dist/shared/attaform.yUrz7C2z.cjs +0 -29
  162. package/dist/shared/attaform.yUrz7C2z.cjs.map +0 -1
  163. package/dist/transforms.cjs +0 -12
  164. package/dist/transforms.cjs.map +0 -1
  165. package/dist/transforms.d.cts +0 -73
  166. package/dist/transforms.d.ts +0 -73
  167. package/dist/transforms.mjs.map +0 -1
  168. package/dist/vite.cjs +0 -363
  169. package/dist/vite.cjs.map +0 -1
  170. package/dist/vite.d.cts +0 -133
  171. package/dist/vite.d.ts +0 -133
  172. package/dist/vite.mjs.map +0 -1
  173. package/dist/webpack.cjs +0 -10
  174. package/dist/webpack.cjs.map +0 -1
  175. package/dist/webpack.d.cts +0 -37
  176. package/dist/webpack.d.ts +0 -37
  177. package/dist/webpack.mjs.map +0 -1
  178. package/dist/zod-v3.cjs +0 -53
  179. package/dist/zod-v3.cjs.map +0 -1
  180. package/dist/zod-v3.d.cts +0 -246
  181. package/dist/zod-v3.d.ts +0 -246
  182. package/dist/zod-v3.mjs.map +0 -1
  183. package/dist/zod-v4.cjs +0 -55
  184. package/dist/zod-v4.cjs.map +0 -1
  185. package/dist/zod-v4.d.cts +0 -172
  186. package/dist/zod-v4.d.ts +0 -172
  187. package/dist/zod-v4.mjs.map +0 -1
  188. package/dist/zod.cjs +0 -51
  189. package/dist/zod.cjs.map +0 -1
  190. package/dist/zod.d.cts +0 -7
  191. package/dist/zod.d.ts +0 -7
  192. 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.q6UutkCx.mjs';
2
+ import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.BgM6FdtA.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.A-TpJW0B.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.DHuydLAC.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.DD5m2W51.mjs';
6
+ export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.D8aoKb89.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 { a as assertZodVersion, k as kindOf, u as useForm, z as zodAdapter } from './shared/attaform-dev.BO-71R54.mjs';
2
+ import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.BgM6FdtA.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.A-TpJW0B.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.DHuydLAC.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.DD5m2W51.mjs';
6
+ export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.D8aoKb89.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.A-TpJW0B.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.DHuydLAC.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.DD5m2W51.mjs';
4
+ export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.D8aoKb89.mjs';
5
+ export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform-dev.DrzObAZo.mjs';
@@ -0,0 +1,20 @@
1
+ export { i as installVRegister, v as vRegister } from './shared/attaform.axHXVQO7.mjs';
2
+ import { at as RegisterModelDynamicCustomDirective } from './shared/attaform.CsoeRi3P.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.DffRL5pP.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.CsoeRi3P.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.Cvao8bW5.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,9 +1,12 @@
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.CHlJLAiv.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.DniawQLP.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.DniawQLP.mjs';
4
- import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.DLknk9nF.mjs';
5
- export { P as PathInput, a as PathOutput } from './shared/attaform.DLknk9nF.mjs';
6
- import { S as SupportedRootSchema$1, U as UnwrapZodRoot, a as StorageShape$1 } from './shared/attaform.DRUT703x.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 UseRegisterOptions, o as UseRegisterReturn, p as UseWizardReturnType, W as WizardAggregateError, q as WizardCtx, r as WizardCtxForm, s as WizardOnError, t as WizardOnSubmit, u as WizardOptions, v as WizardPersistFn, w as WizardRestoreFn, x as WizardRestoreState, y as WizardStatusesProxy, z as WizardSubmitContext, B as assignKey, E as createAttaform, H as createRegistry, J as defaultCoercionRules, K as defaultDisplayState, M as defineCoercion, N as escapeForInlineScript, P as gate, Q as getRegistryFromApp, T as hydrateAttaformState, V as injectForm, X as injectWizard, Y as isRegisterValue, Z as kAttaformRegistry, _ as lazy, $ as makeDefaultDisplayState, a0 as renderAttaformState, a1 as useRegister, a2 as useRegistry, a3 as useWizard } from './shared/attaform.DDtqHYv1.mjs';
2
+ import { G as GenericForm, F as FormKey, U as UseFormConfiguration, av as AcceptableDefaults, ah as ValidateOnConfig, a as UseFormReturnType, D as DefaultValuesInput, o as FieldMetaPayload } from './shared/attaform.CsoeRi3P.mjs';
3
+ import { AbstractSchema } from './abstract.mjs';
4
+ 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 RecordPath, a0 as RecordValue, a1 as RegisterDirective, a2 as RegisterFlatPath, a3 as RegisterOptions, a4 as RegisterSelectModifier, a5 as RegisterTextModifier, a6 as RegisterTransform, a7 as RegisterValue, a8 as Segment, a9 as SetValueCallback, aa as SetValuePayload, ab as SettledValidationStatus, ac as SlimPrimitiveKind, ad as SlimRuntimeOf, ae as SubmitHandler, af as Unset, ag as ValidateOn, ai as ValidationError, aj as ValidationResponse, ak as ValidationResponseWithoutValue, al as ValueOfUnion, am as WriteMeta, an as WriteShape, ao as canonicalizePath, ap as isPathPrefix, aq as isUnset, ar as parseDottedPath, as as unset } from './shared/attaform.CsoeRi3P.mjs';
5
+ export { v as vRegister } from './shared/attaform.axHXVQO7.mjs';
6
+ import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.CIWLMY-R.mjs';
7
+ export { P as PathInput, a as PathOutput } from './shared/attaform.CIWLMY-R.mjs';
8
+ import { S as SupportedRootSchema$1, a as StorageShape$1 } from './shared/attaform.DRUT703x.mjs';
9
+ import { UnwrapZodRoot } from './zod-v3.mjs';
7
10
  import { z } from 'zod';
8
11
  import 'vue';
9
12
 
@@ -226,6 +229,11 @@ type ZodFieldMetaRegistry = ReturnType<typeof z.registry<FieldMetaPayload>>;
226
229
  * `schema.register(fieldMeta, payload)` chain type-checks for v4
227
230
  * users; the runtime call only needs `.add` structurally, which the
228
231
  * shared store provides.
232
+ *
233
+ * Backed by `installingFieldMetaStore`: every `add` also installs the
234
+ * path-walking resolver into the shared store's builder slot, so the
235
+ * walk's bytes ride this module's import instead of the adapters. A
236
+ * consumer that never registers metadata never ships the walk.
229
237
  */
230
238
  declare const fieldMeta: ZodFieldMetaRegistry;
231
239
  /**
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.CKH2lGdL.mjs';
3
- export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.DYEr28Pt.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.CZYt_5N_.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.CZMAYwSK.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.D0x-qSXm.mjs';
4
+ export { a as assignKey, v as vRegister } from './shared/attaform.DffRL5pP.mjs';
5
+ export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.BndjUUYX.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.DniawQLP.mjs';
2
+ import { AttaformDefaults } from './abstract.mjs';
3
3
  import 'vue';
4
4
 
5
5
  /**
@@ -33,15 +33,15 @@ interface AttaformModuleOptions {
33
33
  resolveZodAlias?: boolean;
34
34
  /**
35
35
  * Auto-import Attaform's form composables (`useForm`, `useWizard`,
36
- * `injectForm`, `injectWizard`, `fieldMeta`, `withMeta`, `lazy`) so
37
- * components can call them without an explicit `import`. Default
38
- * `true`. The set is declared in Attaform's auto-import manifest and
39
- * resolves from `attaform/zod`, so the build-time adapter rewrite
40
- * still ships a single Zod major. Set to `false` to suppress the
41
- * names entirely and import the composables yourself. Note a Nuxt
42
- * auto-import already loses to an explicit or local binding of the
43
- * same name, so opting out is only needed to keep the names out of
44
- * global scope altogether.
36
+ * `injectForm`, `injectWizard`, `fieldMeta`, `withMeta`, `lazy`,
37
+ * `gate`, `useRegister`) so components can call them without an
38
+ * explicit `import`. Default `true`. The set is declared in
39
+ * Attaform's auto-import manifest and resolves from `attaform/zod`,
40
+ * so the build-time adapter rewrite still ships a single Zod major.
41
+ * Set to `false` to suppress the names entirely and import the
42
+ * composables yourself. Note a Nuxt auto-import already loses to an
43
+ * explicit or local binding of the same name, so opting out is only
44
+ * needed to keep the names out of global scope altogether.
45
45
  */
46
46
  autoImports?: boolean;
47
47
  }
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.D0x-qSXm.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