attaform 0.25.0 → 0.27.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 (163) hide show
  1. package/README.md +21 -11
  2. package/bin/attaform.mjs +78 -0
  3. package/dist/abstract.cjs +47 -0
  4. package/dist/abstract.cjs.map +1 -0
  5. package/dist/abstract.d.cts +42 -0
  6. package/dist/abstract.d.mts +42 -0
  7. package/dist/abstract.d.ts +42 -0
  8. package/dist/abstract.mjs +4 -0
  9. package/dist/abstract.mjs.map +1 -0
  10. package/dist/chunks/devtools.cjs +2 -2
  11. package/dist/chunks/devtools.cjs.map +1 -1
  12. package/dist/chunks/devtools.mjs +1 -1
  13. package/dist/chunks/fingerprint2.cjs +1 -1
  14. package/dist/chunks/fingerprint2.mjs +1 -1
  15. package/dist/esbuild.cjs +2 -2
  16. package/dist/esbuild.cjs.map +1 -1
  17. package/dist/esbuild.d.cts +3 -3
  18. package/dist/esbuild.d.mts +3 -3
  19. package/dist/esbuild.d.ts +3 -3
  20. package/dist/esbuild.mjs +2 -2
  21. package/dist/esbuild.mjs.map +1 -1
  22. package/dist/index.cjs +41 -56
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +194 -282
  25. package/dist/index.d.mts +194 -282
  26. package/dist/index.d.ts +194 -282
  27. package/dist/index.mjs +4 -25
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/nuxt.cjs +3 -1
  30. package/dist/nuxt.cjs.map +1 -1
  31. package/dist/nuxt.d.cts +17 -4
  32. package/dist/nuxt.d.mts +17 -4
  33. package/dist/nuxt.d.ts +17 -4
  34. package/dist/nuxt.mjs +4 -2
  35. package/dist/nuxt.mjs.map +1 -1
  36. package/dist/rollup.cjs +2 -2
  37. package/dist/rollup.cjs.map +1 -1
  38. package/dist/rollup.d.cts +3 -3
  39. package/dist/rollup.d.mts +3 -3
  40. package/dist/rollup.d.ts +3 -3
  41. package/dist/rollup.mjs +2 -2
  42. package/dist/rollup.mjs.map +1 -1
  43. package/dist/rspack.cjs +1 -1
  44. package/dist/rspack.d.cts +1 -1
  45. package/dist/rspack.d.mts +1 -1
  46. package/dist/rspack.d.ts +1 -1
  47. package/dist/rspack.mjs +1 -1
  48. package/dist/runtime/plugins/attaform.cjs +4 -5
  49. package/dist/runtime/plugins/attaform.cjs.map +1 -1
  50. package/dist/runtime/plugins/attaform.mjs +1 -2
  51. package/dist/runtime/plugins/attaform.mjs.map +1 -1
  52. package/dist/shared/{attaform.BRzKBj2g.cjs → attaform.8tFZu1Ub.cjs} +2 -2
  53. package/dist/shared/{attaform.BRzKBj2g.cjs.map → attaform.8tFZu1Ub.cjs.map} +1 -1
  54. package/dist/shared/{attaform.k9V0py0s.mjs → attaform.BERt5YMU.mjs} +2 -2
  55. package/dist/shared/{attaform.k9V0py0s.mjs.map → attaform.BERt5YMU.mjs.map} +1 -1
  56. package/dist/shared/{attaform.CN4ZEGo6.mjs → attaform.BceJrhQ7.mjs} +5 -5
  57. package/dist/shared/{attaform.CN4ZEGo6.mjs.map → attaform.BceJrhQ7.mjs.map} +1 -1
  58. package/dist/shared/{attaform.i_LA3X9o.d.cts → attaform.C3WnCDXz.d.cts} +81 -24
  59. package/dist/shared/{attaform.i_LA3X9o.d.ts → attaform.C3WnCDXz.d.mts} +81 -24
  60. package/dist/shared/{attaform.i_LA3X9o.d.mts → attaform.C3WnCDXz.d.ts} +81 -24
  61. package/dist/shared/{attaform.DuzQYscR.d.ts → attaform.C9fPTxjB.d.cts} +5 -5
  62. package/dist/shared/{attaform.DuzQYscR.d.cts → attaform.C9fPTxjB.d.mts} +5 -5
  63. package/dist/shared/{attaform.DuzQYscR.d.mts → attaform.C9fPTxjB.d.ts} +5 -5
  64. package/dist/shared/{attaform.B3cgZE3c.d.ts → attaform.CC_y1_Ej.d.ts} +33 -33
  65. package/dist/shared/{attaform.DS_zBcdr.d.ts → attaform.CEXUlUkc.d.ts} +1588 -1190
  66. package/dist/shared/{attaform.Xe8dATED.cjs → attaform.C__F01CE.cjs} +15 -15
  67. package/dist/shared/{attaform.Xe8dATED.cjs.map → attaform.C__F01CE.cjs.map} +1 -1
  68. package/dist/shared/{attaform.3heDHayA.cjs → attaform.Co5LNRnv.cjs} +186 -129
  69. package/dist/shared/attaform.Co5LNRnv.cjs.map +1 -0
  70. package/dist/shared/{attaform.BJt4ZCkM.d.mts → attaform.CpXHK60W.d.cts} +33 -33
  71. package/dist/shared/{attaform.DmKLa4tL.d.cts → attaform.CvVYOvZF.d.mts} +33 -33
  72. package/dist/shared/{attaform.DK3xUBkj.mjs → attaform.CyQxTOdX.mjs} +162 -79
  73. package/dist/shared/attaform.CyQxTOdX.mjs.map +1 -0
  74. package/dist/shared/{attaform.B5GFS3Su.d.cts → attaform.D99pd7JG.d.cts} +1588 -1190
  75. package/dist/shared/{attaform.CwXXbZIQ.mjs → attaform.DDAmSFnl.mjs} +4 -4
  76. package/dist/shared/{attaform.CwXXbZIQ.mjs.map → attaform.DDAmSFnl.mjs.map} +1 -1
  77. package/dist/shared/{attaform.BkUzunyB.cjs → attaform.DQT7_-FO.cjs} +371 -287
  78. package/dist/shared/attaform.DQT7_-FO.cjs.map +1 -0
  79. package/dist/shared/{attaform.CqwcTExO.mjs → attaform.Da8EdI2t.mjs} +182 -129
  80. package/dist/shared/attaform.Da8EdI2t.mjs.map +1 -0
  81. package/dist/shared/{attaform.sks1MFVO.cjs → attaform.DhVgG2jh.cjs} +16 -16
  82. package/dist/shared/{attaform.sks1MFVO.cjs.map → attaform.DhVgG2jh.cjs.map} +1 -1
  83. package/dist/shared/{attaform.sHkHv_98.mjs → attaform.DhnPb6nK.mjs} +6 -3
  84. package/dist/shared/attaform.DhnPb6nK.mjs.map +1 -0
  85. package/dist/shared/attaform.DkD0DR7R.mjs +42 -0
  86. package/dist/shared/attaform.DkD0DR7R.mjs.map +1 -0
  87. package/dist/shared/{attaform.DMNnfQq_.mjs → attaform.DlSu08F5.mjs} +4 -4
  88. package/dist/shared/{attaform.DMNnfQq_.mjs.map → attaform.DlSu08F5.mjs.map} +1 -1
  89. package/dist/shared/{attaform.LEWUFqUw.cjs → attaform.DoQm_Vkd.cjs} +7 -3
  90. package/dist/shared/attaform.DoQm_Vkd.cjs.map +1 -0
  91. package/dist/shared/{attaform.B5YcWrKi.cjs → attaform.Drsi43GG.cjs} +19 -19
  92. package/dist/shared/{attaform.B5YcWrKi.cjs.map → attaform.Drsi43GG.cjs.map} +1 -1
  93. package/dist/shared/attaform.K6Thc6By.cjs +46 -0
  94. package/dist/shared/attaform.K6Thc6By.cjs.map +1 -0
  95. package/dist/shared/{attaform.Vp2-CWZB.mjs → attaform.KvlEedlF.mjs} +3 -3
  96. package/dist/shared/{attaform.Vp2-CWZB.mjs.map → attaform.KvlEedlF.mjs.map} +1 -1
  97. package/dist/shared/{attaform.BRGIpZo4.cjs → attaform.RaTzp1WF.cjs} +3 -3
  98. package/dist/shared/attaform.RaTzp1WF.cjs.map +1 -0
  99. package/dist/shared/{attaform.8vmdOURQ.d.mts → attaform.kBkYlKP_.d.mts} +1588 -1190
  100. package/dist/shared/{attaform.C3Doa9Pt.mjs → attaform.v0fQtWyA.mjs} +3 -3
  101. package/dist/shared/attaform.v0fQtWyA.mjs.map +1 -0
  102. package/dist/shared/{attaform.ZXZ6dH72.cjs → attaform.yUrz7C2z.cjs} +3 -3
  103. package/dist/shared/{attaform.ZXZ6dH72.cjs.map → attaform.yUrz7C2z.cjs.map} +1 -1
  104. package/dist/transforms.cjs +1 -1
  105. package/dist/transforms.mjs +1 -1
  106. package/dist/vite.cjs +21 -3
  107. package/dist/vite.cjs.map +1 -1
  108. package/dist/vite.d.cts +70 -17
  109. package/dist/vite.d.mts +70 -17
  110. package/dist/vite.d.ts +70 -17
  111. package/dist/vite.mjs +20 -4
  112. package/dist/vite.mjs.map +1 -1
  113. package/dist/webpack.cjs +1 -1
  114. package/dist/webpack.d.cts +1 -1
  115. package/dist/webpack.d.mts +1 -1
  116. package/dist/webpack.d.ts +1 -1
  117. package/dist/webpack.mjs +1 -1
  118. package/dist/zod-v3.cjs +41 -10
  119. package/dist/zod-v3.cjs.map +1 -1
  120. package/dist/zod-v3.d.cts +5 -5
  121. package/dist/zod-v3.d.mts +5 -5
  122. package/dist/zod-v3.d.ts +5 -5
  123. package/dist/zod-v3.mjs +4 -2
  124. package/dist/zod-v3.mjs.map +1 -1
  125. package/dist/zod-v4.cjs +41 -10
  126. package/dist/zod-v4.cjs.map +1 -1
  127. package/dist/zod-v4.d.cts +7 -7
  128. package/dist/zod-v4.d.mts +7 -7
  129. package/dist/zod-v4.d.ts +7 -7
  130. package/dist/zod-v4.mjs +4 -2
  131. package/dist/zod-v4.mjs.map +1 -1
  132. package/dist/zod.cjs +44 -49
  133. package/dist/zod.cjs.map +1 -1
  134. package/dist/zod.d.cts +6 -248
  135. package/dist/zod.d.mts +6 -248
  136. package/dist/zod.d.ts +6 -248
  137. package/dist/zod.mjs +4 -42
  138. package/dist/zod.mjs.map +1 -1
  139. package/package.json +12 -2
  140. package/skills/attaform/SKILL.md +128 -0
  141. package/skills/attaform/references/custom-components.md +72 -0
  142. package/skills/attaform/references/errors.md +62 -0
  143. package/skills/attaform/references/ssr.md +26 -0
  144. package/skills/attaform/references/validation.md +40 -0
  145. package/skills/attaform/references/wizards.md +104 -0
  146. package/dist/shared/attaform.3heDHayA.cjs.map +0 -1
  147. package/dist/shared/attaform.BRGIpZo4.cjs.map +0 -1
  148. package/dist/shared/attaform.BkUzunyB.cjs.map +0 -1
  149. package/dist/shared/attaform.C3Doa9Pt.mjs.map +0 -1
  150. package/dist/shared/attaform.CO0e7YVY.d.cts +0 -94
  151. package/dist/shared/attaform.CO0e7YVY.d.mts +0 -94
  152. package/dist/shared/attaform.CO0e7YVY.d.ts +0 -94
  153. package/dist/shared/attaform.CqwcTExO.mjs.map +0 -1
  154. package/dist/shared/attaform.DK3xUBkj.mjs.map +0 -1
  155. package/dist/shared/attaform.LEWUFqUw.cjs.map +0 -1
  156. package/dist/shared/attaform.OLtKd9gM.mjs +0 -35
  157. package/dist/shared/attaform.OLtKd9gM.mjs.map +0 -1
  158. package/dist/shared/attaform.sHkHv_98.mjs.map +0 -1
  159. package/dist/shared/attaform.xBDo0Ko0.cjs +0 -39
  160. package/dist/shared/attaform.xBDo0Ko0.cjs.map +0 -1
  161. package/dist/shared/{attaform.DdjDqTah.d.mts → attaform.DRUT703x.d.cts} +14 -14
  162. package/dist/shared/{attaform.DdjDqTah.d.ts → attaform.DRUT703x.d.mts} +14 -14
  163. package/dist/shared/{attaform.DdjDqTah.d.cts → attaform.DRUT703x.d.ts} +14 -14
@@ -1,5 +1,37 @@
1
1
  import { z } from 'zod';
2
- import { G as GenericForm, u as FlatPath, O as NestedType, F as FormKey, U as UseFormConfiguration, a as AbstractSchema, ar as AcceptableDefaults, af as ValidateOnConfig, b as UseFormReturnType } from './attaform.i_LA3X9o.mjs';
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.C3WnCDXz.cjs';
3
+
4
+ /**
5
+ * The Zod v4 schema roots `useForm` accepts. A fixed-shape
6
+ * `z.object({ … })` is the common case; `z.record(K, V)` admits a
7
+ * dictionary form (a homogeneous map with runtime-known keys);
8
+ * `z.discriminatedUnion(disc, [...])` admits a variant form (one of
9
+ * several object shapes, picked by a discriminator). Each projects to
10
+ * a `GenericForm`-shaped value the form engine drives: an object root
11
+ * descends into its fixed keys, a record root treats its entries as an
12
+ * open live-keyed container, a variant root lifts the active variant's
13
+ * keys into one addressable surface.
14
+ *
15
+ * Other roots (a bare `z.union`, a root `z.array`, primitives,
16
+ * `z.map` / `z.set`) are not form roots; wrap them under a key. The
17
+ * adapter's runtime construction rejects them with a legible error.
18
+ *
19
+ * `z.ZodObject` MUST keep its `z.ZodRawShape` argument, and the
20
+ * discriminated-union arm MUST stay fully applied. The unified entry's
21
+ * v4 overload constrains on `SupportedRootSchema & ZodV4Internals` to
22
+ * keep v3 schemas out (see `../unified/types-zod-major.ts`). In a
23
+ * single-major (v3-only) consumer install, the published `.d.mts`
24
+ * resolves this `z` to v3, where a bare or under-applied Zod class is
25
+ * missing its required arguments and degrades to an `any`-like error
26
+ * type; `any` then absorbs the union and `any & ZodV4Internals`
27
+ * collapses back to `any`, so the marker stops excluding v3 schemas and
28
+ * the read slot poisons to `never`. `z.ZodRecord` carries defaults for
29
+ * both arguments, so it stays concrete in either major.
30
+ * `z.ZodDiscriminatedUnion` does NOT (v3 requires both arguments, and
31
+ * its parameter order is the reverse of v4's), so the arm is written
32
+ * fully applied; the v3-only bundled-types fixture guards it.
33
+ */
34
+ type SupportedRootSchema = z.ZodObject<z.ZodRawShape> | z.ZodRecord | z.ZodDiscriminatedUnion<readonly z.ZodObject<z.ZodRawShape>[], string>;
3
35
 
4
36
  /**
5
37
  * The shape `form.values.<key>` returns at runtime.
@@ -120,38 +152,6 @@ type StorageLeaf<L> = InputIsUnknown<L> extends true ? unknown : L extends {
120
152
  };
121
153
  } ? Out : never;
122
154
 
123
- /**
124
- * The Zod v4 schema roots `useForm` accepts. A fixed-shape
125
- * `z.object({ … })` is the common case; `z.record(K, V)` admits a
126
- * dictionary form (a homogeneous map with runtime-known keys);
127
- * `z.discriminatedUnion(disc, [...])` admits a variant form (one of
128
- * several object shapes, picked by a discriminator). Each projects to
129
- * a `GenericForm`-shaped value the form engine drives: an object root
130
- * descends into its fixed keys, a record root treats its entries as an
131
- * open live-keyed container, a variant root lifts the active variant's
132
- * keys into one addressable surface.
133
- *
134
- * Other roots (a bare `z.union`, a root `z.array`, primitives,
135
- * `z.map` / `z.set`) are not form roots; wrap them under a key. The
136
- * adapter's runtime construction rejects them with a legible error.
137
- *
138
- * `z.ZodObject` MUST keep its `z.ZodRawShape` argument, and the
139
- * discriminated-union arm MUST stay fully applied. The unified entry's
140
- * v4 overload constrains on `SupportedRootSchema & ZodV4Internals` to
141
- * keep v3 schemas out (see `../unified/types-zod-major.ts`). In a
142
- * single-major (v3-only) consumer install, the published `.d.mts`
143
- * resolves this `z` to v3, where a bare or under-applied Zod class is
144
- * missing its required arguments and degrades to an `any`-like error
145
- * type; `any` then absorbs the union and `any & ZodV4Internals`
146
- * collapses back to `any`, so the marker stops excluding v3 schemas and
147
- * the read slot poisons to `never`. `z.ZodRecord` carries defaults for
148
- * both arguments, so it stays concrete in either major.
149
- * `z.ZodDiscriminatedUnion` does NOT (v3 requires both arguments, and
150
- * its parameter order is the reverse of v4's), so the arm is written
151
- * fully applied; the v3-only bundled-types fixture guards it.
152
- */
153
- type SupportedRootSchema = z.ZodObject<z.ZodRawShape> | z.ZodRecord | z.ZodDiscriminatedUnion<readonly z.ZodObject<z.ZodRawShape>[], string>;
154
-
155
155
  /**
156
156
  * Zod v4 adapter entry point. Re-exports the adapter + the useForm
157
157
  * wrapper that threads zod-v4-specific schema types through
@@ -1,5 +1,37 @@
1
1
  import { z } from 'zod';
2
- import { G as GenericForm, u as FlatPath, O as NestedType, F as FormKey, U as UseFormConfiguration, a as AbstractSchema, ar as AcceptableDefaults, af as ValidateOnConfig, b as UseFormReturnType } from './attaform.i_LA3X9o.cjs';
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.C3WnCDXz.mjs';
3
+
4
+ /**
5
+ * The Zod v4 schema roots `useForm` accepts. A fixed-shape
6
+ * `z.object({ … })` is the common case; `z.record(K, V)` admits a
7
+ * dictionary form (a homogeneous map with runtime-known keys);
8
+ * `z.discriminatedUnion(disc, [...])` admits a variant form (one of
9
+ * several object shapes, picked by a discriminator). Each projects to
10
+ * a `GenericForm`-shaped value the form engine drives: an object root
11
+ * descends into its fixed keys, a record root treats its entries as an
12
+ * open live-keyed container, a variant root lifts the active variant's
13
+ * keys into one addressable surface.
14
+ *
15
+ * Other roots (a bare `z.union`, a root `z.array`, primitives,
16
+ * `z.map` / `z.set`) are not form roots; wrap them under a key. The
17
+ * adapter's runtime construction rejects them with a legible error.
18
+ *
19
+ * `z.ZodObject` MUST keep its `z.ZodRawShape` argument, and the
20
+ * discriminated-union arm MUST stay fully applied. The unified entry's
21
+ * v4 overload constrains on `SupportedRootSchema & ZodV4Internals` to
22
+ * keep v3 schemas out (see `../unified/types-zod-major.ts`). In a
23
+ * single-major (v3-only) consumer install, the published `.d.mts`
24
+ * resolves this `z` to v3, where a bare or under-applied Zod class is
25
+ * missing its required arguments and degrades to an `any`-like error
26
+ * type; `any` then absorbs the union and `any & ZodV4Internals`
27
+ * collapses back to `any`, so the marker stops excluding v3 schemas and
28
+ * the read slot poisons to `never`. `z.ZodRecord` carries defaults for
29
+ * both arguments, so it stays concrete in either major.
30
+ * `z.ZodDiscriminatedUnion` does NOT (v3 requires both arguments, and
31
+ * its parameter order is the reverse of v4's), so the arm is written
32
+ * fully applied; the v3-only bundled-types fixture guards it.
33
+ */
34
+ type SupportedRootSchema = z.ZodObject<z.ZodRawShape> | z.ZodRecord | z.ZodDiscriminatedUnion<readonly z.ZodObject<z.ZodRawShape>[], string>;
3
35
 
4
36
  /**
5
37
  * The shape `form.values.<key>` returns at runtime.
@@ -120,38 +152,6 @@ type StorageLeaf<L> = InputIsUnknown<L> extends true ? unknown : L extends {
120
152
  };
121
153
  } ? Out : never;
122
154
 
123
- /**
124
- * The Zod v4 schema roots `useForm` accepts. A fixed-shape
125
- * `z.object({ … })` is the common case; `z.record(K, V)` admits a
126
- * dictionary form (a homogeneous map with runtime-known keys);
127
- * `z.discriminatedUnion(disc, [...])` admits a variant form (one of
128
- * several object shapes, picked by a discriminator). Each projects to
129
- * a `GenericForm`-shaped value the form engine drives: an object root
130
- * descends into its fixed keys, a record root treats its entries as an
131
- * open live-keyed container, a variant root lifts the active variant's
132
- * keys into one addressable surface.
133
- *
134
- * Other roots (a bare `z.union`, a root `z.array`, primitives,
135
- * `z.map` / `z.set`) are not form roots; wrap them under a key. The
136
- * adapter's runtime construction rejects them with a legible error.
137
- *
138
- * `z.ZodObject` MUST keep its `z.ZodRawShape` argument, and the
139
- * discriminated-union arm MUST stay fully applied. The unified entry's
140
- * v4 overload constrains on `SupportedRootSchema & ZodV4Internals` to
141
- * keep v3 schemas out (see `../unified/types-zod-major.ts`). In a
142
- * single-major (v3-only) consumer install, the published `.d.mts`
143
- * resolves this `z` to v3, where a bare or under-applied Zod class is
144
- * missing its required arguments and degrades to an `any`-like error
145
- * type; `any` then absorbs the union and `any & ZodV4Internals`
146
- * collapses back to `any`, so the marker stops excluding v3 schemas and
147
- * the read slot poisons to `never`. `z.ZodRecord` carries defaults for
148
- * both arguments, so it stays concrete in either major.
149
- * `z.ZodDiscriminatedUnion` does NOT (v3 requires both arguments, and
150
- * its parameter order is the reverse of v4's), so the arm is written
151
- * fully applied; the v3-only bundled-types fixture guards it.
152
- */
153
- type SupportedRootSchema = z.ZodObject<z.ZodRawShape> | z.ZodRecord | z.ZodDiscriminatedUnion<readonly z.ZodObject<z.ZodRawShape>[], string>;
154
-
155
155
  /**
156
156
  * Zod v4 adapter entry point. Re-exports the adapter + the useForm
157
157
  * wrapper that threads zod-v4-specific schema types through
@@ -1,6 +1,6 @@
1
1
  import { computed, ref, watchEffect, getCurrentScope, onScopeDispose, shallowReadonly, nextTick, warn, readonly, toRaw, reactive, watch, markRaw, triggerRef, shallowRef, getCurrentInstance, onServerPrefetch, provide, useId, inject, onBeforeMount, onBeforeUpdate, onMounted, effectScope } from 'vue';
2
- import { n as pathsEqual, j as isPathPrefix, _ as __DEV__, f as canonicalizePath, s as segmentsForPathKey, o as keyForSegments, b as ROOT_PATH_KEY, S as SubmitErrorHandlerError, t as toError, q as INTERACTIVE_TAG_NAMES, R as ROOT_PATH, r as coerceToPathKey, a as InvalidUseFormConfigError, w as ensureAttaformInstalled, u as useRegistry, x as kFormContext, y as kFormInstanceId, d as ReservedFormKeyError, l as kAttaformWizardActiveStepResolver, z as kAttaformAncestorWizard } from './attaform.CqwcTExO.mjs';
3
- import { R as REGISTER_OWNER_MARKER, b as V_REGISTER_MARKER } from './attaform.Vp2-CWZB.mjs';
2
+ import { n as pathsEqual, k as isPathPrefix, _ as __DEV__, f as canonicalizePath, s as segmentsForPathKey, o as keyForSegments, b as ROOT_PATH_KEY, S as SubmitErrorHandlerError, t as toError, q as normalizeErrorInput, w as INTERACTIVE_TAG_NAMES, R as ROOT_PATH, x as normalizeErrorInputs, y as coerceToPathKey, a as InvalidUseFormConfigError, z as ensureAttaformInstalled, u as useRegistry, B as kFormContext, C as kFormInstanceId, d as ReservedFormKeyError, m as kAttaformWizardActiveStepResolver, E as kAttaformAncestorWizard } from './attaform.Da8EdI2t.mjs';
3
+ import { R as REGISTER_OWNER_MARKER, b as V_REGISTER_MARKER } from './attaform.KvlEedlF.mjs';
4
4
 
5
5
  function safeAssign(target, key, value) {
6
6
  if (key === "__proto__") {
@@ -29,7 +29,7 @@ function safeOwnHas(target, key) {
29
29
  return Object.prototype.hasOwnProperty.call(target, key);
30
30
  }
31
31
 
32
- const NOT_FOUND = Symbol("NOT_FOUND");
32
+ const NOT_FOUND = /* @__PURE__ */ Symbol("NOT_FOUND");
33
33
  function descendStep(value, segment) {
34
34
  if (value === null || value === void 0) return NOT_FOUND;
35
35
  if (typeof value !== "object") return NOT_FOUND;
@@ -432,7 +432,7 @@ function applyChangedKeys(target, source, arrayOpPath, currentPath) {
432
432
  const targetIsArray = Array.isArray(target);
433
433
  const sourceIsArray = Array.isArray(source);
434
434
  if (targetIsArray !== sourceIsArray) return false;
435
- const ROOT_SENTINEL = Symbol.for("attaform.applyChangedKeys.rootMismatch");
435
+ const ROOT_SENTINEL = /* @__PURE__ */ Symbol.for("attaform.applyChangedKeys.rootMismatch");
436
436
  const changedFirstSegments = /* @__PURE__ */ new Set();
437
437
  diffAndApply(target, source, [], (patch) => {
438
438
  if (patch.path.length === 0) {
@@ -582,7 +582,18 @@ const AttaformErrorCode = {
582
582
  * produced `ValidationError` carrying a stable, branchable identifier.
583
583
  * Override it per error by passing your own `code` (`api:…`, `auth:…`).
584
584
  */
585
- UserError: "atta:user-error"
585
+ UserError: "atta:user-error",
586
+ /**
587
+ * Stamped on a `ValidationError` synthesized from a throw or rejection
588
+ * out of a `handleSubmit` `onSubmit` callback. The raw error also lands
589
+ * on `form.meta.submitError` (a raw-`Error` inspection channel); this
590
+ * code marks the copy piped into the user-error layer so the failure
591
+ * also surfaces on `form.errors` / `meta.ownErrors` / `firstOwnError`
592
+ * where the UI already reads. A throw carrying its own `path` / `code`
593
+ * keeps them; a bare `Error` or a non-Error throw defaults here at the
594
+ * form-level path `[]`.
595
+ */
596
+ SubmitError: "atta:submit-error"
586
597
  };
587
598
  function makeBlankRequiredError(segments, formKey) {
588
599
  return {
@@ -790,6 +801,11 @@ function buildLeafFieldStateBase(state, segments, key, formInstanceId) {
790
801
  elements: elementsArr,
791
802
  updatedAt: record?.updatedAt ?? null,
792
803
  errors,
804
+ // A leaf has no descendants, so its own-bucket errors ARE its subtree
805
+ // errors. Reuse the same array reference: referential `ownErrors ===
806
+ // errors`, and no second read of the whole-form `derivedBlankErrors`
807
+ // map (preserves the P3 blank-reactivity optimization above).
808
+ ownErrors: errors,
793
809
  validating,
794
810
  valid,
795
811
  transforming,
@@ -968,6 +984,12 @@ function buildContainerFieldStateBase(state, segments, key, formInstanceId) {
968
984
  elements: EMPTY_ELEMENTS,
969
985
  updatedAt,
970
986
  errors,
987
+ // The container's OWN bucket only (this exact path), excluding every
988
+ // descendant that `errors` rolls up: a cross-field `.refine()` here,
989
+ // or `setErrors` pinned at this node. The same raw union the leaf
990
+ // builds from the three stores; the container already depends on all
991
+ // three via `aggregateErrorsAt`, so there's no new reactivity cost.
992
+ ownErrors: state.getErrorsForPath(segments),
971
993
  validating,
972
994
  valid,
973
995
  transforming,
@@ -1006,6 +1028,7 @@ function buildContainerFieldState(state, segments, key, formInstanceId, getFormM
1006
1028
  }
1007
1029
  function decorateWithDerivedProps(base, state, getFormMetaBase, key, validatingSince, transformingSince, revealedDescendantError, isRoot, getDisplayState) {
1008
1030
  const firstError = base.errors[0];
1031
+ const firstOwnError = base.ownErrors[0];
1009
1032
  const predicate = getDisplayState ?? state.getDisplayState;
1010
1033
  const formMeta = getFormMetaBase();
1011
1034
  const ctx = {
@@ -1041,7 +1064,8 @@ function decorateWithDerivedProps(base, state, getFormMetaBase, key, validatingS
1041
1064
  showPending: displayState === "pending",
1042
1065
  showSuccess: displayState === "success",
1043
1066
  showIdle: displayState === "idle",
1044
- firstError
1067
+ firstError,
1068
+ firstOwnError
1045
1069
  };
1046
1070
  }
1047
1071
  function aggregateErrorsAt(state, prefix) {
@@ -1410,17 +1434,15 @@ function buildErrorsProxy(state) {
1410
1434
  // shared `aggregateErrorsAt` helper that `form.meta.errors` and
1411
1435
  // `form.fields(path).errors` also use, so the surfaces never drift.
1412
1436
  //
1413
- // The root is the one carve-out. An EXPLICIT root path
1414
- // (`errors([])`) returns ONLY the global `[]` bucket (root
1415
- // `.refine()`, hydration failures, `setErrors`) via
1416
- // `getErrorsForPath`, giving consumers a dedicated channel for
1417
- // global messages undiluted by field errors. The no-arg `errors()`
1418
- // instead resolves the FULL aggregate through `resolveRootCall`
1419
- // below (identical to `meta.errors`).
1420
- resolveCallTarget: (path) => path.length === 0 ? state.getErrorsForPath([]) : aggregateErrorsAt(state, path),
1437
+ // The root is uniform with every other path: `errors([])` is the
1438
+ // subtree aggregate at `[]`, which is the whole form, identical to
1439
+ // the no-arg `errors()` and to `meta.errors`. The root `[]` bucket
1440
+ // alone (root `.refine()`, hydration failures, path-less
1441
+ // `setErrors`) is read through `meta.ownErrors` / `meta.firstOwnError`,
1442
+ // the dedicated own-bucket accessor, not a call-form carve-out.
1443
+ resolveCallTarget: (path) => aggregateErrorsAt(state, path),
1421
1444
  // No-arg `errors()` = the whole-form aggregate, matching
1422
- // `meta.errors`. Distinct from `errors([])` (global bucket only);
1423
- // see `resolveCallTarget`.
1445
+ // `meta.errors` and `errors([])`. All three are the same aggregate.
1424
1446
  resolveRootCall: () => aggregateErrorsAt(state, []),
1425
1447
  // Enumeration unions the live form-data keys at this path with the
1426
1448
  // first-child segments drawn from every error store. Without the
@@ -1604,6 +1626,7 @@ const FIELD_STATE_KEYS = /* @__PURE__ */ new Set([
1604
1626
  "elements",
1605
1627
  "updatedAt",
1606
1628
  "errors",
1629
+ "ownErrors",
1607
1630
  "validating",
1608
1631
  "valid",
1609
1632
  "transforming",
@@ -1615,6 +1638,7 @@ const FIELD_STATE_KEYS = /* @__PURE__ */ new Set([
1615
1638
  "showSuccess",
1616
1639
  "showIdle",
1617
1640
  "firstError",
1641
+ "firstOwnError",
1618
1642
  "path",
1619
1643
  "id",
1620
1644
  "aria",
@@ -1756,6 +1780,32 @@ function walk$1(value, basePath, schema, snapshotFieldStateAt) {
1756
1780
  }
1757
1781
 
1758
1782
  const warnedNoScopeStores = __DEV__ ? /* @__PURE__ */ new WeakSet() : null;
1783
+ function isErrorInputLike(value) {
1784
+ if (value instanceof Error) return true;
1785
+ if (typeof value !== "object" || value === null) return false;
1786
+ const shape = value;
1787
+ return typeof shape.message === "string" && shape.message.length > 0 || Array.isArray(shape.path);
1788
+ }
1789
+ function deriveSubmitErrors(err, formKey) {
1790
+ if (Array.isArray(err) && err.length > 0 && err.every(isErrorInputLike)) {
1791
+ return {
1792
+ entries: err.map(
1793
+ (item) => normalizeErrorInput(item, void 0, formKey, AttaformErrorCode.SubmitError)
1794
+ ),
1795
+ messageless: false
1796
+ };
1797
+ }
1798
+ if (isErrorInputLike(err)) {
1799
+ return {
1800
+ entries: [normalizeErrorInput(err, void 0, formKey, AttaformErrorCode.SubmitError)],
1801
+ messageless: false
1802
+ };
1803
+ }
1804
+ return {
1805
+ entries: [normalizeErrorInput({}, void 0, formKey, AttaformErrorCode.SubmitError)],
1806
+ messageless: true
1807
+ };
1808
+ }
1759
1809
  function buildProcessForm(state, formInstanceId, options = {}) {
1760
1810
  const invalidPolicy = options.onInvalidSubmit ?? "focus-first-error";
1761
1811
  function validate(pathInput) {
@@ -1937,13 +1987,6 @@ function buildProcessForm(state, formInstanceId, options = {}) {
1937
1987
  if (state.submissionGeneration.value === genAtEntry) {
1938
1988
  applyInvalidSubmitPolicy(state, formInstanceId, invalidPolicy);
1939
1989
  }
1940
- if (onError !== void 0) {
1941
- try {
1942
- await onError(Array.from(state.userErrors.values()).flat());
1943
- } catch (cause) {
1944
- throw new SubmitErrorHandlerError("User-provided onError threw", { cause });
1945
- }
1946
- }
1947
1990
  return;
1948
1991
  }
1949
1992
  if (state.submissionGeneration.value === genAtEntry) {
@@ -1953,6 +1996,25 @@ function buildProcessForm(state, formInstanceId, options = {}) {
1953
1996
  } catch (err) {
1954
1997
  if (state.submissionGeneration.value === genAtEntry) {
1955
1998
  state.submitError.value = toError(err);
1999
+ if (!(err instanceof SubmitErrorHandlerError)) {
2000
+ const { entries, messageless } = deriveSubmitErrors(err, state.formKey);
2001
+ const byPath = /* @__PURE__ */ new Map();
2002
+ for (const entry of entries) {
2003
+ const { key } = canonicalizePath(entry.path);
2004
+ const bucket = byPath.get(key);
2005
+ if (bucket === void 0) byPath.set(key, { segments: entry.path, entries: [entry] });
2006
+ else bucket.entries.push(entry);
2007
+ }
2008
+ for (const { segments, entries: bucket } of byPath.values()) {
2009
+ state.setUserErrorsForPath(segments, bucket);
2010
+ }
2011
+ applyInvalidSubmitPolicy(state, formInstanceId, invalidPolicy);
2012
+ if (__DEV__ && messageless) {
2013
+ console.warn(
2014
+ "[attaform] handleSubmit callback threw a non-Error value; throw an Error or a ValidationError ({ message, path? }) so the failure surfaces with a usable message."
2015
+ );
2016
+ }
2017
+ }
1956
2018
  }
1957
2019
  } finally {
1958
2020
  if (!validationSettled) {
@@ -2295,7 +2357,7 @@ function coerceValue(value, accepted, elementAccepted, index) {
2295
2357
 
2296
2358
  const warnedMultiRootHosts = /* @__PURE__ */ new Set();
2297
2359
  const EMPTY_TRANSFORMS = Object.freeze([]);
2298
- const attaformListenersSymbol = Symbol.for("attaform:focus-listeners");
2360
+ const attaformListenersSymbol = /* @__PURE__ */ Symbol.for("attaform:focus-listeners");
2299
2361
  function attachFocusListeners(state, segments, element, instanceMeta) {
2300
2362
  const target = element;
2301
2363
  if (target[attaformListenersSymbol] !== void 0) return;
@@ -2485,7 +2547,7 @@ function buildRegister(state, formInstanceId, instanceConfig) {
2485
2547
  };
2486
2548
  }
2487
2549
 
2488
- const unset = Symbol.for("attaform/unset");
2550
+ const unset = /* @__PURE__ */ Symbol.for("attaform/unset");
2489
2551
  function isUnset(value) {
2490
2552
  return value === unset;
2491
2553
  }
@@ -2814,6 +2876,9 @@ function buildFormApi(state, formInstanceId, options = {}) {
2814
2876
  get errors() {
2815
2877
  return rootBase().errors;
2816
2878
  },
2879
+ get ownErrors() {
2880
+ return rootBase().ownErrors;
2881
+ },
2817
2882
  get validating() {
2818
2883
  return rootBase().validating;
2819
2884
  },
@@ -2977,28 +3042,6 @@ function buildFormApi(state, formInstanceId, options = {}) {
2977
3042
  return true;
2978
3043
  }
2979
3044
  const errorsProxy = buildErrorsProxy(state);
2980
- function normalizeErrorInput(item, scope) {
2981
- if (item instanceof Error) {
2982
- return {
2983
- message: item.message.length > 0 ? item.message : "Unknown error",
2984
- path: scope !== void 0 ? [...scope] : [],
2985
- formKey: state.formKey,
2986
- code: AttaformErrorCode.UserError
2987
- };
2988
- }
2989
- const entry = {
2990
- message: typeof item.message === "string" && item.message.length > 0 ? item.message : "Unknown error",
2991
- path: scope !== void 0 ? [...scope] : Array.isArray(item.path) ? [...item.path] : [],
2992
- formKey: state.formKey,
2993
- code: typeof item.code === "string" && item.code.length > 0 ? item.code : AttaformErrorCode.UserError
2994
- };
2995
- if (item.data !== void 0) entry.data = item.data;
2996
- return entry;
2997
- }
2998
- function normalizeErrorInputs(input, scope) {
2999
- const items = Array.isArray(input) ? input : [input];
3000
- return items.map((item) => normalizeErrorInput(item, scope));
3001
- }
3002
3045
  function flattenUserErrors() {
3003
3046
  const all = [];
3004
3047
  for (const errs of state.userErrors.values()) all.push(...errs);
@@ -3010,12 +3053,17 @@ function buildFormApi(state, formInstanceId, options = {}) {
3010
3053
  const { segments, key } = canonicalizePath(arg1);
3011
3054
  const input2 = arg2;
3012
3055
  const resolved2 = typeof input2 === "function" ? input2((state.userErrors.get(key) ?? []).slice()) : input2;
3013
- state.setUserErrorsForPath(segments, normalizeErrorInputs(resolved2, segments));
3056
+ state.setUserErrorsForPath(
3057
+ segments,
3058
+ normalizeErrorInputs(resolved2, segments, state.formKey, AttaformErrorCode.UserError)
3059
+ );
3014
3060
  return;
3015
3061
  }
3016
3062
  const input = arg1;
3017
3063
  const resolved = typeof input === "function" ? input(flattenUserErrors()) : input;
3018
- state.setAllUserErrors(normalizeErrorInputs(resolved, void 0));
3064
+ state.setAllUserErrors(
3065
+ normalizeErrorInputs(resolved, void 0, state.formKey, AttaformErrorCode.UserError)
3066
+ );
3019
3067
  }
3020
3068
  function clearErrors(path) {
3021
3069
  if (path === void 0) {
@@ -3110,6 +3158,17 @@ function buildFormApi(state, formInstanceId, options = {}) {
3110
3158
  // keep the explicit form-level computation for the gate.
3111
3159
  valid,
3112
3160
  errors: metaErrors,
3161
+ // The root `[]` bucket alone: form-level errors from a root
3162
+ // `.refine()` or a path-less `setErrors`, excluding every field error
3163
+ // that `errors` (the whole-form aggregate) rolls up. This is the
3164
+ // banner accessor. Mirrors `rootFieldState` rather than taking a
3165
+ // dedicated computed: `getFieldState([])` routes a container root
3166
+ // through `getErrorsForPath([])` and a primitive root through its own
3167
+ // bucket, and both equal the root bucket, so the root field state is
3168
+ // already the single source of truth.
3169
+ get ownErrors() {
3170
+ return rootFieldState.value.ownErrors;
3171
+ },
3113
3172
  // Whole-form transforming mirrors the global `activeTransforms`
3114
3173
  // counter ORed with any per-leaf transform in flight (the root
3115
3174
  // rollup), exactly as `validating` composes its lifecycle and
@@ -3148,6 +3207,11 @@ function buildFormApi(state, formInstanceId, options = {}) {
3148
3207
  get firstError() {
3149
3208
  return rootFieldState.value.firstError;
3150
3209
  },
3210
+ // `ownErrors[0]`: the form's first top-level error. Pair it with
3211
+ // `ownErrors` for the form-level banner.
3212
+ get firstOwnError() {
3213
+ return rootFieldState.value.firstOwnError;
3214
+ },
3151
3215
  get path() {
3152
3216
  return rootFieldState.value.path;
3153
3217
  },
@@ -3391,6 +3455,33 @@ function buildFormApi(state, formInstanceId, options = {}) {
3391
3455
  return api;
3392
3456
  }
3393
3457
 
3458
+ function captureUserCallSite() {
3459
+ const raw = new Error().stack;
3460
+ if (typeof raw !== "string") return void 0;
3461
+ const lines = raw.split("\n");
3462
+ for (let i = 1; i < lines.length; i++) {
3463
+ const frame = lines[i];
3464
+ if (frame === void 0) continue;
3465
+ if (/attaform[/-]forms?/i.test(frame)) continue;
3466
+ if (/\bforms\.[A-Za-z0-9_-]+\.m?js\b/.test(frame)) continue;
3467
+ const trimmed = frame.trim();
3468
+ if (trimmed.length === 0) continue;
3469
+ return shortenSourceFrame(trimmed);
3470
+ }
3471
+ return void 0;
3472
+ }
3473
+ function shortenSourceFrame(frame) {
3474
+ const match = /(?:^|\s|\()([^\s()]+):(\d+):\d+\)?$/.exec(frame);
3475
+ if (match === null) return frame;
3476
+ const [, urlOrPath, line] = match;
3477
+ if (urlOrPath === void 0 || line === void 0) return frame;
3478
+ let path = urlOrPath;
3479
+ path = path.replace(/^[a-z]+:\/\/[^/]+\//i, "");
3480
+ path = path.replace(/^_nuxt\//, "");
3481
+ path = path.replace(/^\//, "");
3482
+ return `(${path}:${line})`;
3483
+ }
3484
+
3394
3485
  const IDLE = Object.freeze({ display: "idle" });
3395
3486
  const MAX_DELAY = 2147483647;
3396
3487
  function createDisplayEngine(ssr) {
@@ -5471,33 +5562,6 @@ function createFormStore(options) {
5471
5562
  };
5472
5563
  }
5473
5564
 
5474
- function captureUserCallSite() {
5475
- const raw = new Error().stack;
5476
- if (typeof raw !== "string") return void 0;
5477
- const lines = raw.split("\n");
5478
- for (let i = 1; i < lines.length; i++) {
5479
- const frame = lines[i];
5480
- if (frame === void 0) continue;
5481
- if (/attaform[/-]forms?/i.test(frame)) continue;
5482
- if (/\bforms\.[A-Za-z0-9_-]+\.m?js\b/.test(frame)) continue;
5483
- const trimmed = frame.trim();
5484
- if (trimmed.length === 0) continue;
5485
- return shortenSourceFrame(trimmed);
5486
- }
5487
- return void 0;
5488
- }
5489
- function shortenSourceFrame(frame) {
5490
- const match = /(?:^|\s|\()([^\s()]+):(\d+):\d+\)?$/.exec(frame);
5491
- if (match === null) return frame;
5492
- const [, urlOrPath, line] = match;
5493
- if (urlOrPath === void 0 || line === void 0) return frame;
5494
- let path = urlOrPath;
5495
- path = path.replace(/^[a-z]+:\/\/[^/]+\//i, "");
5496
- path = path.replace(/^_nuxt\//, "");
5497
- path = path.replace(/^\//, "");
5498
- return `(${path}:${line})`;
5499
- }
5500
-
5501
5565
  function getComputedSchema(formKey, schemaOrCallback, options) {
5502
5566
  if (typeof schemaOrCallback === "function") return schemaOrCallback(formKey, options);
5503
5567
  return schemaOrCallback;
@@ -6084,7 +6148,7 @@ function warnNoParentRV(instance) {
6084
6148
  );
6085
6149
  }
6086
6150
 
6087
- const LAZY_BRAND = Symbol.for("attaform/wizard-lazy");
6151
+ const LAZY_BRAND = /* @__PURE__ */ Symbol.for("attaform/wizard-lazy");
6088
6152
  function lazy(resolve) {
6089
6153
  return { [LAZY_BRAND]: true, resolve };
6090
6154
  }
@@ -7241,5 +7305,24 @@ function warnIfAmbientWizardProviderHadDuplicates() {
7241
7305
  }
7242
7306
  }
7243
7307
 
7244
- export { AttaformErrorCode as A, DEFAULT_TIMINGS as D, injectWizard as a, isUnset as b, useRegister as c, useWizard as d, defaultCoercionRules as e, defaultDisplayState as f, defineCoercion as g, useAbstractForm as h, injectForm as i, isPlainRecord as j, safeAssign as k, lazy as l, makeDefaultDisplayState as m, slimKindOf as n, humanize as o, getAtPath as p, setAtPath as q, safeOwnRead as s, unset as u };
7245
- //# sourceMappingURL=attaform.DK3xUBkj.mjs.map
7308
+ function escapeForInlineScript(json) {
7309
+ return json.replace(/[<>&\u2028\u2029]/g, (char) => {
7310
+ switch (char) {
7311
+ case "<":
7312
+ return "\\u003c";
7313
+ case ">":
7314
+ return "\\u003e";
7315
+ case "&":
7316
+ return "\\u0026";
7317
+ case "\u2028":
7318
+ return "\\u2028";
7319
+ case "\u2029":
7320
+ return "\\u2029";
7321
+ default:
7322
+ return char;
7323
+ }
7324
+ });
7325
+ }
7326
+
7327
+ export { AttaformErrorCode as A, DEFAULT_TIMINGS as D, defaultDisplayState as a, defineCoercion as b, injectWizard as c, defaultCoercionRules as d, escapeForInlineScript as e, isUnset as f, useAbstractForm as g, useRegister as h, injectForm as i, useWizard as j, isPlainRecord as k, lazy as l, makeDefaultDisplayState as m, safeAssign as n, slimKindOf as o, humanize as p, getAtPath as q, setAtPath as r, safeOwnRead as s, unset as u };
7328
+ //# sourceMappingURL=attaform.CyQxTOdX.mjs.map