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 +0,0 @@
1
- {"version":3,"file":"attaform.C3Doa9Pt.mjs","sources":["../../src/core/webpack-family-plugin.ts"],"sourcesContent":["/**\n * Shared webpack/rspack plugin body. Rspack mirrors webpack's plugin API\n * for the resolve hooks attaform taps, so one implementation backs both\n * `attaform/webpack` and `attaform/rspack`; only the diagnostic `tag`\n * differs.\n *\n * The plugin taps `normalModuleFactory.beforeResolve` and rewrites the\n * `attaform/zod` request to the matching adapter subpath, the same effect\n * as webpack's own `NormalModuleReplacementPlugin` but tapping the hook\n * directly so the plugin imports nothing from webpack/rspack (keeping\n * attaform dependency-free). The bundler injects the hook API at the\n * consumer's build, so the minimal structural types below are all the\n * plugin needs to compile.\n *\n * Build-time only: never part of a consumer's browser bundle.\n */\nimport { resolveZodAliasTarget, ZOD_UNIFIED_SPECIFIER } from './detect-zod-major'\n\nexport interface WebpackFamilyPluginOptions {\n /**\n * Rewrite `attaform/zod` imports at build time to the matching adapter\n * subpath, based on the consumer's installed Zod major. Default `true`.\n * Set to `false` to keep the runtime-dispatch unified entry (ships both\n * adapters) when a project intentionally mixes Zod versions or resolves\n * Zod in a non-standard way.\n */\n resolveZodAlias?: boolean\n /**\n * Project root to resolve the installed Zod from. Defaults to the\n * compiler's `context`, falling back to `process.cwd()`. Set this when\n * the build runs from a directory other than the project that owns the\n * Zod dependency (some monorepo layouts).\n */\n root?: string\n}\n\ninterface WebpackTapable<T> {\n tap(name: string, fn: (arg: T) => void): void\n}\ninterface WebpackResolveData {\n request: string\n}\ninterface WebpackNormalModuleFactory {\n hooks: { beforeResolve: WebpackTapable<WebpackResolveData> }\n}\ninterface WebpackCompiler {\n context?: string\n hooks: { normalModuleFactory: WebpackTapable<WebpackNormalModuleFactory> }\n}\n\n/** The structural shape webpack/rspack require of a plugin: an object\n * with an `apply(compiler)` method. */\nexport interface WebpackFamilyPlugin {\n apply(compiler: WebpackCompiler): void\n}\n\nconst TAP_NAME = 'attaform'\n\nexport function createWebpackFamilyPlugin(\n tag: string,\n options: WebpackFamilyPluginOptions\n): WebpackFamilyPlugin {\n const resolveZodAlias = options.resolveZodAlias !== false\n const warnState = { warned: false }\n return {\n apply(compiler) {\n const root = compiler.context ?? options.root ?? process.cwd()\n const target = resolveZodAliasTarget(root, tag, resolveZodAlias, warnState)\n if (target === null) return\n compiler.hooks.normalModuleFactory.tap(TAP_NAME, (factory) => {\n factory.hooks.beforeResolve.tap(TAP_NAME, (data) => {\n if (data.request === ZOD_UNIFIED_SPECIFIER) {\n data.request = target\n }\n })\n })\n },\n }\n}\n"],"names":[],"mappings":";;AAwDA,MAAM,QAAA,GAAW,UAAA;AAEV,SAAS,yBAAA,CACd,KACA,OAAA,EACqB;AACrB,EAAA,MAAM,eAAA,GAAkB,QAAQ,eAAA,KAAoB,KAAA;AACpD,EAAA,MAAM,SAAA,GAAY,EAAE,MAAA,EAAQ,KAAA,EAAM;AAClC,EAAA,OAAO;AAAA,IACL,MAAM,QAAA,EAAU;AACd,MAAA,MAAM,OAAO,QAAA,CAAS,OAAA,IAAW,OAAA,CAAQ,IAAA,IAAQ,QAAQ,GAAA,EAAI;AAC7D,MAAA,MAAM,MAAA,GAAS,qBAAA,CAAsB,IAAA,EAAM,GAAA,EAAK,iBAAiB,SAAS,CAAA;AAC1E,MAAA,IAAI,WAAW,IAAA,EAAM;AACrB,MAAA,QAAA,CAAS,KAAA,CAAM,mBAAA,CAAoB,GAAA,CAAI,QAAA,EAAU,CAAC,OAAA,KAAY;AAC5D,QAAA,OAAA,CAAQ,KAAA,CAAM,aAAA,CAAc,GAAA,CAAI,QAAA,EAAU,CAAC,IAAA,KAAS;AAClD,UAAA,IAAI,IAAA,CAAK,YAAY,qBAAA,EAAuB;AAC1C,YAAA,IAAA,CAAK,OAAA,GAAU,MAAA;AAAA,UACjB;AAAA,QACF,CAAC,CAAA;AAAA,MACH,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF;;;;"}
@@ -1,94 +0,0 @@
1
- /**
2
- * Typed error classes thrown by the form library. Each one signals a
3
- * distinct misuse so calling code can branch on `instanceof` instead
4
- * of pattern-matching error messages.
5
- *
6
- * Every class extends `AttaformError`, so consumers can write a single
7
- * polymorphic catch (`catch (e) { if (e instanceof AttaformError) ... }`)
8
- * instead of OR-chaining checks for each subclass. `AttaformError` itself
9
- * extends the standard `Error`, so existing `instanceof Error` usage
10
- * keeps working.
11
- */
12
- /**
13
- * Base for every error class thrown by `attaform`. Sets
14
- * `this.name` from the constructor's `new.target.name`, so subclasses
15
- * don't have to redeclare their own name override.
16
- */
17
- declare class AttaformError extends Error {
18
- constructor(message: string, options?: ErrorOptions);
19
- }
20
- /**
21
- * Thrown when a path string is malformed — typically a dotted path
22
- * with empty segments (e.g. `'a..b'`, leading or trailing dots).
23
- * Use array form (`['a', 'b']`) for keys that contain literal dots.
24
- */
25
- declare class InvalidPathError extends AttaformError {
26
- }
27
- /**
28
- * Thrown when `useForm` receives an invalid configuration — most often
29
- * a schema passed directly as the first argument, or no argument at
30
- * all. The configuration is an options bag; the schema is one of
31
- * several fields, even when it's the only one in use.
32
- *
33
- * ```ts
34
- * // ✗ Crashes deep inside the validator with an opaque message:
35
- * const form = useForm(z.object({ ... }))
36
- * // ✗ Same:
37
- * const form = useForm()
38
- * // ✓ Pass the schema as the `schema` field:
39
- * const form = useForm({ schema: z.object({ ... }) })
40
- * ```
41
- *
42
- * The same shape applies to every entry point: `attaform/zod`,
43
- * `attaform/zod-v3`, `attaform/zod-v4`, and the schema-agnostic
44
- * `attaform` root.
45
- */
46
- declare class InvalidUseFormConfigError extends AttaformError {
47
- constructor();
48
- }
49
- /**
50
- * Thrown when a `handleSubmit`-supplied `onError` callback itself
51
- * throws or rejects. Wraps the inner failure so both the original
52
- * cause (via `error.cause`) and the propagation site are visible.
53
- */
54
- declare class SubmitErrorHandlerError extends AttaformError {
55
- }
56
- /**
57
- * Thrown when an `attaform` API needs the registry attached to a Vue
58
- * app but it isn't there yet. Component-level entry points (`useForm`,
59
- * `injectForm`, `useRegister`) lazy-install the registry on first use,
60
- * so this error is mostly reached by SSR helpers — `renderAttaformState`
61
- * and `hydrateAttaformState` — which run outside a setup context and
62
- * have no current instance to install against.
63
- *
64
- * Fix: add `app.use(createAttaform())` (or `app.use(createAttaform({
65
- * ssr: true }))` on the server) to your SSR entry, before
66
- * `renderToString` / hydration. Under Nuxt, `attaform/nuxt` already
67
- * does this; the error usually points at a non-Nuxt SSR setup that
68
- * hasn't installed explicitly.
69
- */
70
- declare class RegistryNotInstalledError extends AttaformError {
71
- constructor();
72
- }
73
- /**
74
- * Thrown when `useForm` / `injectForm` is called outside of a
75
- * Vue `setup()` function — typically from an event handler, watcher,
76
- * or async callback that runs after mount.
77
- *
78
- * Fix: move the call into `setup()`, or trigger it from a child
79
- * component whose `setup()` runs the composable.
80
- */
81
- declare class OutsideSetupError extends AttaformError {
82
- constructor();
83
- }
84
- /**
85
- * Thrown when a `useForm({ key })` call uses a key starting with
86
- * `__atta:`. That prefix is reserved for keys the library generates
87
- * internally (e.g. for anonymous `useForm()` calls without an
88
- * explicit key). Pick a different prefix for your form.
89
- */
90
- declare class ReservedFormKeyError extends AttaformError {
91
- constructor(key: string);
92
- }
93
-
94
- export { AttaformError as A, InvalidPathError as I, OutsideSetupError as O, RegistryNotInstalledError as R, SubmitErrorHandlerError as S, InvalidUseFormConfigError as a, ReservedFormKeyError as b };
@@ -1,94 +0,0 @@
1
- /**
2
- * Typed error classes thrown by the form library. Each one signals a
3
- * distinct misuse so calling code can branch on `instanceof` instead
4
- * of pattern-matching error messages.
5
- *
6
- * Every class extends `AttaformError`, so consumers can write a single
7
- * polymorphic catch (`catch (e) { if (e instanceof AttaformError) ... }`)
8
- * instead of OR-chaining checks for each subclass. `AttaformError` itself
9
- * extends the standard `Error`, so existing `instanceof Error` usage
10
- * keeps working.
11
- */
12
- /**
13
- * Base for every error class thrown by `attaform`. Sets
14
- * `this.name` from the constructor's `new.target.name`, so subclasses
15
- * don't have to redeclare their own name override.
16
- */
17
- declare class AttaformError extends Error {
18
- constructor(message: string, options?: ErrorOptions);
19
- }
20
- /**
21
- * Thrown when a path string is malformed — typically a dotted path
22
- * with empty segments (e.g. `'a..b'`, leading or trailing dots).
23
- * Use array form (`['a', 'b']`) for keys that contain literal dots.
24
- */
25
- declare class InvalidPathError extends AttaformError {
26
- }
27
- /**
28
- * Thrown when `useForm` receives an invalid configuration — most often
29
- * a schema passed directly as the first argument, or no argument at
30
- * all. The configuration is an options bag; the schema is one of
31
- * several fields, even when it's the only one in use.
32
- *
33
- * ```ts
34
- * // ✗ Crashes deep inside the validator with an opaque message:
35
- * const form = useForm(z.object({ ... }))
36
- * // ✗ Same:
37
- * const form = useForm()
38
- * // ✓ Pass the schema as the `schema` field:
39
- * const form = useForm({ schema: z.object({ ... }) })
40
- * ```
41
- *
42
- * The same shape applies to every entry point: `attaform/zod`,
43
- * `attaform/zod-v3`, `attaform/zod-v4`, and the schema-agnostic
44
- * `attaform` root.
45
- */
46
- declare class InvalidUseFormConfigError extends AttaformError {
47
- constructor();
48
- }
49
- /**
50
- * Thrown when a `handleSubmit`-supplied `onError` callback itself
51
- * throws or rejects. Wraps the inner failure so both the original
52
- * cause (via `error.cause`) and the propagation site are visible.
53
- */
54
- declare class SubmitErrorHandlerError extends AttaformError {
55
- }
56
- /**
57
- * Thrown when an `attaform` API needs the registry attached to a Vue
58
- * app but it isn't there yet. Component-level entry points (`useForm`,
59
- * `injectForm`, `useRegister`) lazy-install the registry on first use,
60
- * so this error is mostly reached by SSR helpers — `renderAttaformState`
61
- * and `hydrateAttaformState` — which run outside a setup context and
62
- * have no current instance to install against.
63
- *
64
- * Fix: add `app.use(createAttaform())` (or `app.use(createAttaform({
65
- * ssr: true }))` on the server) to your SSR entry, before
66
- * `renderToString` / hydration. Under Nuxt, `attaform/nuxt` already
67
- * does this; the error usually points at a non-Nuxt SSR setup that
68
- * hasn't installed explicitly.
69
- */
70
- declare class RegistryNotInstalledError extends AttaformError {
71
- constructor();
72
- }
73
- /**
74
- * Thrown when `useForm` / `injectForm` is called outside of a
75
- * Vue `setup()` function — typically from an event handler, watcher,
76
- * or async callback that runs after mount.
77
- *
78
- * Fix: move the call into `setup()`, or trigger it from a child
79
- * component whose `setup()` runs the composable.
80
- */
81
- declare class OutsideSetupError extends AttaformError {
82
- constructor();
83
- }
84
- /**
85
- * Thrown when a `useForm({ key })` call uses a key starting with
86
- * `__atta:`. That prefix is reserved for keys the library generates
87
- * internally (e.g. for anonymous `useForm()` calls without an
88
- * explicit key). Pick a different prefix for your form.
89
- */
90
- declare class ReservedFormKeyError extends AttaformError {
91
- constructor(key: string);
92
- }
93
-
94
- export { AttaformError as A, InvalidPathError as I, OutsideSetupError as O, RegistryNotInstalledError as R, SubmitErrorHandlerError as S, InvalidUseFormConfigError as a, ReservedFormKeyError as b };
@@ -1,94 +0,0 @@
1
- /**
2
- * Typed error classes thrown by the form library. Each one signals a
3
- * distinct misuse so calling code can branch on `instanceof` instead
4
- * of pattern-matching error messages.
5
- *
6
- * Every class extends `AttaformError`, so consumers can write a single
7
- * polymorphic catch (`catch (e) { if (e instanceof AttaformError) ... }`)
8
- * instead of OR-chaining checks for each subclass. `AttaformError` itself
9
- * extends the standard `Error`, so existing `instanceof Error` usage
10
- * keeps working.
11
- */
12
- /**
13
- * Base for every error class thrown by `attaform`. Sets
14
- * `this.name` from the constructor's `new.target.name`, so subclasses
15
- * don't have to redeclare their own name override.
16
- */
17
- declare class AttaformError extends Error {
18
- constructor(message: string, options?: ErrorOptions);
19
- }
20
- /**
21
- * Thrown when a path string is malformed — typically a dotted path
22
- * with empty segments (e.g. `'a..b'`, leading or trailing dots).
23
- * Use array form (`['a', 'b']`) for keys that contain literal dots.
24
- */
25
- declare class InvalidPathError extends AttaformError {
26
- }
27
- /**
28
- * Thrown when `useForm` receives an invalid configuration — most often
29
- * a schema passed directly as the first argument, or no argument at
30
- * all. The configuration is an options bag; the schema is one of
31
- * several fields, even when it's the only one in use.
32
- *
33
- * ```ts
34
- * // ✗ Crashes deep inside the validator with an opaque message:
35
- * const form = useForm(z.object({ ... }))
36
- * // ✗ Same:
37
- * const form = useForm()
38
- * // ✓ Pass the schema as the `schema` field:
39
- * const form = useForm({ schema: z.object({ ... }) })
40
- * ```
41
- *
42
- * The same shape applies to every entry point: `attaform/zod`,
43
- * `attaform/zod-v3`, `attaform/zod-v4`, and the schema-agnostic
44
- * `attaform` root.
45
- */
46
- declare class InvalidUseFormConfigError extends AttaformError {
47
- constructor();
48
- }
49
- /**
50
- * Thrown when a `handleSubmit`-supplied `onError` callback itself
51
- * throws or rejects. Wraps the inner failure so both the original
52
- * cause (via `error.cause`) and the propagation site are visible.
53
- */
54
- declare class SubmitErrorHandlerError extends AttaformError {
55
- }
56
- /**
57
- * Thrown when an `attaform` API needs the registry attached to a Vue
58
- * app but it isn't there yet. Component-level entry points (`useForm`,
59
- * `injectForm`, `useRegister`) lazy-install the registry on first use,
60
- * so this error is mostly reached by SSR helpers — `renderAttaformState`
61
- * and `hydrateAttaformState` — which run outside a setup context and
62
- * have no current instance to install against.
63
- *
64
- * Fix: add `app.use(createAttaform())` (or `app.use(createAttaform({
65
- * ssr: true }))` on the server) to your SSR entry, before
66
- * `renderToString` / hydration. Under Nuxt, `attaform/nuxt` already
67
- * does this; the error usually points at a non-Nuxt SSR setup that
68
- * hasn't installed explicitly.
69
- */
70
- declare class RegistryNotInstalledError extends AttaformError {
71
- constructor();
72
- }
73
- /**
74
- * Thrown when `useForm` / `injectForm` is called outside of a
75
- * Vue `setup()` function — typically from an event handler, watcher,
76
- * or async callback that runs after mount.
77
- *
78
- * Fix: move the call into `setup()`, or trigger it from a child
79
- * component whose `setup()` runs the composable.
80
- */
81
- declare class OutsideSetupError extends AttaformError {
82
- constructor();
83
- }
84
- /**
85
- * Thrown when a `useForm({ key })` call uses a key starting with
86
- * `__atta:`. That prefix is reserved for keys the library generates
87
- * internally (e.g. for anonymous `useForm()` calls without an
88
- * explicit key). Pick a different prefix for your form.
89
- */
90
- declare class ReservedFormKeyError extends AttaformError {
91
- constructor(key: string);
92
- }
93
-
94
- export { AttaformError as A, InvalidPathError as I, OutsideSetupError as O, RegistryNotInstalledError as R, SubmitErrorHandlerError as S, InvalidUseFormConfigError as a, ReservedFormKeyError as b };