attaform 0.30.0 → 0.31.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.
- package/dist/abstract.d.mts +15 -21
- package/dist/abstract.mjs +3 -3
- package/dist/dev/abstract.mjs +4 -4
- package/dist/dev/chunks/devtools.mjs +4 -4
- package/dist/dev/directive.mjs +1 -1
- package/dist/dev/history.mjs +2 -2
- package/dist/dev/index.mjs +5 -5
- package/dist/dev/runtime/plugins/attaform.mjs +1 -1
- package/dist/dev/shared/{attaform-dev.DUZckyV8.mjs → attaform-dev.B1q-x9R9.mjs} +4 -4
- package/dist/dev/shared/{attaform-dev.BcYT6tFh.mjs → attaform-dev.CZz4GYZ6.mjs} +21 -9
- package/dist/dev/shared/{attaform-dev.BisFstxh.mjs → attaform-dev.Caibt7sb.mjs} +16 -15
- package/dist/dev/shared/{attaform-dev.DTrHonpc.mjs → attaform-dev.CtyqGia7.mjs} +176 -260
- package/dist/dev/shared/{attaform-dev.BK6Ge2qR.mjs → attaform-dev.DJ3nsWw6.mjs} +86 -122
- package/dist/dev/shared/{attaform-dev.BcNtyOmf.mjs → attaform-dev.DlaT4xGd.mjs} +4 -4
- package/dist/dev/shared/{attaform-dev.D6CLvaQT.mjs → attaform-dev.k5X47GMD.mjs} +520 -395
- package/dist/dev/shared/{attaform-dev.CQ2rJiAX.mjs → attaform-dev.y9x9Vp9F.mjs} +324 -234
- package/dist/dev/shared/{attaform-dev.BQc5QV3Y.mjs → attaform-dev.zlvDr0WB.mjs} +2 -2
- package/dist/dev/zod-v3.mjs +6 -6
- package/dist/dev/zod-v4.mjs +6 -6
- package/dist/dev/zod.mjs +5 -5
- package/dist/directive.d.mts +4 -4
- package/dist/directive.mjs +1 -1
- package/dist/esbuild.d.mts +11 -0
- package/dist/esbuild.mjs +1 -1
- package/dist/history.d.mts +3 -32
- package/dist/history.mjs +2 -2
- package/dist/index.d.mts +67 -70
- package/dist/index.mjs +4 -4
- package/dist/nuxt.d.mts +4 -3
- package/dist/nuxt.mjs +3 -6
- package/dist/rollup.d.mts +11 -0
- package/dist/rollup.mjs +1 -1
- package/dist/rspack.d.mts +19 -11
- package/dist/rspack.mjs +1 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.vue +15 -15
- package/dist/runtime/components/DevtoolsValueTree.vue +2 -2
- package/dist/runtime/plugins/attaform.mjs +1 -1
- package/dist/shared/{attaform.BRDDQeHV.mjs → attaform.8mfKZCwH.mjs} +2 -2
- package/dist/shared/{attaform.DRUT703x.d.mts → attaform.B-Tb62qV.d.mts} +12 -12
- package/dist/shared/{attaform.v0fQtWyA.mjs → attaform.B1rH9ht6.mjs} +1 -1
- package/dist/shared/{attaform.DhnPb6nK.mjs → attaform.BAf3UNn4.mjs} +1 -1
- package/dist/shared/{attaform.BXneBxEj.mjs → attaform.BWUn8Kjy.mjs} +85 -121
- package/dist/shared/{attaform.WiGdIqgx.mjs → attaform.C4shmwyJ.mjs} +2 -2
- package/dist/shared/{attaform.Rc9u4Vfw.d.mts → attaform.CRVe8s82.d.mts} +83 -95
- package/dist/shared/attaform.D9RqPgGu.d.mts +42 -0
- package/dist/shared/attaform.DAo0QBmS.d.mts +2173 -0
- package/dist/shared/{attaform.BK0cgu2K.mjs → attaform.DBCbxlyk.mjs} +62 -4
- package/dist/shared/{attaform.CUfrMK7t.mjs → attaform.DL2nl_QR.mjs} +15 -14
- package/dist/shared/{attaform.DNJOWjQw.mjs → attaform.DNPJPOO7.mjs} +299 -218
- package/dist/shared/attaform.DZnrDrNb.d.mts +4657 -0
- package/dist/shared/{attaform.B3resMQ1.mjs → attaform.DxKQsqFZ.mjs} +496 -371
- package/dist/shared/{attaform.ByWP6kSx.mjs → attaform.L011tHgJ.mjs} +3 -3
- package/dist/shared/{attaform.CJ8DpRGj.mjs → attaform.LUPC-2Qg.mjs} +175 -257
- package/dist/transforms.d.mts +153 -26
- package/dist/transforms.mjs +1 -1
- package/dist/vite.d.mts +29 -52
- package/dist/vite.mjs +3 -3
- package/dist/webpack.d.mts +20 -12
- package/dist/webpack.mjs +1 -1
- package/dist/zod-v3.d.mts +90 -96
- package/dist/zod-v3.mjs +5 -5
- package/dist/zod-v4.d.mts +120 -118
- package/dist/zod-v4.mjs +5 -5
- package/dist/zod.d.mts +5 -5
- package/dist/zod.mjs +4 -4
- package/package.json +7 -6
- package/skills/attaform/SKILL.md +1 -1
- package/skills/attaform/references/custom-components.md +4 -0
- package/dist/shared/attaform.Clz0ArIi.d.mts +0 -44
- package/dist/shared/attaform.UGyOK83T.d.mts +0 -2366
- package/dist/shared/attaform.bKLzMU0o.d.mts +0 -4761
|
@@ -9,7 +9,7 @@ class InvalidPathError extends AttaformError {
|
|
|
9
9
|
class InvalidUseFormConfigError extends AttaformError {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(
|
|
12
|
-
"[attaform] useForm received an invalid configuration (a schema directly, no argument, or no `schema` field). Pass it as `useForm({ schema })
|
|
12
|
+
"[attaform] useForm received an invalid configuration (a schema directly, no argument, or no `schema` field). Pass it as `useForm({ schema })`: the schema is one of several configuration options. See https://attaform.dev/docs/reading-the-form/the-form for the full configuration shape."
|
|
13
13
|
);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -57,7 +57,7 @@ class OutsideSetupError extends AttaformError {
|
|
|
57
57
|
class ReservedFormKeyError extends AttaformError {
|
|
58
58
|
constructor(key) {
|
|
59
59
|
super(
|
|
60
|
-
`[attaform] Form key "${key}" uses the reserved "__atta:" namespace. Use a different prefix
|
|
60
|
+
`[attaform] Form key "${key}" uses the reserved "__atta:" namespace. Use a different prefix: "__atta:" is for library-internal synthetic keys (anonymous useForm() calls without an explicit key).`
|
|
61
61
|
);
|
|
62
62
|
}
|
|
63
63
|
}
|
package/dist/dev/zod-v3.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { i as isZodSchemaType, u as useForm, z as zodAdapter } from './shared/attaform-dev.
|
|
2
|
-
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.
|
|
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.
|
|
4
|
-
export { A as AttaformErrorCode, e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform-dev.
|
|
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.
|
|
6
|
-
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.
|
|
1
|
+
export { i as isZodSchemaType, u as useForm, z as zodAdapter } from './shared/attaform-dev.CtyqGia7.mjs';
|
|
2
|
+
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.Caibt7sb.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.zlvDr0WB.mjs';
|
|
4
|
+
export { A as AttaformErrorCode, e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform-dev.y9x9Vp9F.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.B1q-x9R9.mjs';
|
|
6
|
+
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.k5X47GMD.mjs';
|
|
7
7
|
|
|
8
8
|
const fieldMeta = installingFieldMetaStore;
|
|
9
9
|
function withMeta(schema, payload) {
|
package/dist/dev/zod-v4.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { a as assertZodVersion, k as kindOf, u as useForm, z as zodAdapter } from './shared/attaform-dev.
|
|
2
|
-
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.
|
|
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.
|
|
4
|
-
export { A as AttaformErrorCode, e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform-dev.
|
|
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.
|
|
6
|
-
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.
|
|
1
|
+
export { a as assertZodVersion, k as kindOf, u as useForm, z as zodAdapter } from './shared/attaform-dev.DJ3nsWw6.mjs';
|
|
2
|
+
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.Caibt7sb.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.zlvDr0WB.mjs';
|
|
4
|
+
export { A as AttaformErrorCode, e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform-dev.y9x9Vp9F.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.B1q-x9R9.mjs';
|
|
6
|
+
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.k5X47GMD.mjs';
|
|
7
7
|
|
|
8
8
|
const fieldMeta = installingFieldMetaStore;
|
|
9
9
|
function withMeta(schema, payload) {
|
package/dist/dev/zod.mjs
CHANGED
|
@@ -1,5 +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.
|
|
2
|
-
export { A as AttaformErrorCode, e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform-dev.
|
|
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.
|
|
4
|
-
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.
|
|
5
|
-
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform-dev.
|
|
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.zlvDr0WB.mjs';
|
|
2
|
+
export { A as AttaformErrorCode, e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform-dev.y9x9Vp9F.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.B1q-x9R9.mjs';
|
|
4
|
+
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.k5X47GMD.mjs';
|
|
5
|
+
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform-dev.DlaT4xGd.mjs';
|
package/dist/directive.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { i as installVRegister, v as vRegister } from './shared/attaform.
|
|
2
|
-
import {
|
|
1
|
+
export { i as installVRegister, v as vRegister } from './shared/attaform.D9RqPgGu.mjs';
|
|
2
|
+
import { an as RegisterModelDynamicCustomDirective } from './shared/attaform.DZnrDrNb.mjs';
|
|
3
3
|
import 'vue';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -8,11 +8,11 @@ import 'vue';
|
|
|
8
8
|
* `File[]` (multiple). Storage is the canonical blank shape (`null` /
|
|
9
9
|
* `[]`) when no file is selected, with the path marked in
|
|
10
10
|
* `blankPaths` so the friendly "No value supplied" error surfaces
|
|
11
|
-
* through `derivedBlankErrors` on required-file fields
|
|
11
|
+
* through `derivedBlankErrors` on required-file fields, the same channel
|
|
12
12
|
* as required numbers / bigints.
|
|
13
13
|
*
|
|
14
14
|
* The `beforeUpdate` hook keeps the DOM in lockstep with storage by
|
|
15
|
-
* clearing `el.value` when storage transitions to blank
|
|
15
|
+
* clearing `el.value` when storage transitions to blank, the only
|
|
16
16
|
* programmatic write browsers permit on file inputs.
|
|
17
17
|
*/
|
|
18
18
|
declare const vRegisterFile: RegisterModelDynamicCustomDirective;
|
package/dist/directive.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { i as installVRegister, v as vRegister, b as vRegisterFile } from './shared/attaform.
|
|
1
|
+
export { i as installVRegister, v as vRegister, b as vRegisterFile } from './shared/attaform.DxKQsqFZ.mjs';
|
package/dist/esbuild.d.mts
CHANGED
|
@@ -50,6 +50,17 @@ interface AttaformEsbuildPlugin {
|
|
|
50
50
|
name: string;
|
|
51
51
|
setup(build: EsbuildPluginBuild): void;
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* esbuild plugin that resolves `attaform` and `attaform/zod` to the one
|
|
55
|
+
* adapter subpath matching the installed Zod major, so the build ships a
|
|
56
|
+
* single adapter instead of both.
|
|
57
|
+
*
|
|
58
|
+
* ```js
|
|
59
|
+
* import { attaform } from 'attaform/esbuild'
|
|
60
|
+
*
|
|
61
|
+
* await build({ entryPoints: ['src/main.ts'], bundle: true, plugins: [attaform()] })
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
53
64
|
declare function attaform(options?: AttaformEsbuildPluginOptions): AttaformEsbuildPlugin;
|
|
54
65
|
|
|
55
66
|
export { attaform };
|
package/dist/esbuild.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as resolveZodAliasTarget, R as REWRITABLE_ZOD_SPECIFIER_FILTER } from './shared/attaform.
|
|
1
|
+
import { r as resolveZodAliasTarget, R as REWRITABLE_ZOD_SPECIFIER_FILTER } from './shared/attaform.BAf3UNn4.mjs';
|
|
2
2
|
|
|
3
3
|
function attaform(options = {}) {
|
|
4
4
|
const resolveZodAlias = options.resolveZodAlias !== false;
|
package/dist/history.d.mts
CHANGED
|
@@ -1,42 +1,13 @@
|
|
|
1
|
-
import { p as HistoryPlugin } from './shared/attaform.
|
|
1
|
+
import { p as HistoryPlugin } from './shared/attaform.DZnrDrNb.mjs';
|
|
2
2
|
import 'vue';
|
|
3
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
|
-
*/
|
|
4
|
+
/** Options for `historyPlugin()`, passed as `useForm({ history })`. */
|
|
34
5
|
type HistoryPluginOptions = {
|
|
35
6
|
/**
|
|
36
7
|
* Cap on total reachable positions (the current one plus everything
|
|
37
8
|
* reachable via `undo()` / `redo()`). Default `128`. When a fresh
|
|
38
9
|
* mutation would exceed it, the oldest position is dropped. `0` keeps
|
|
39
|
-
* no positions beyond the current state
|
|
10
|
+
* no positions beyond the current state, so history is effectively off,
|
|
40
11
|
* preserved as an explicit override.
|
|
41
12
|
*/
|
|
42
13
|
max?: number;
|
package/dist/history.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallowRef, computed } from 'vue';
|
|
2
|
-
import { n as normalizeNumericOption, D as DEFAULT_HISTORY_MAX_SNAPSHOTS, s as structuralSnapshot } from './shared/attaform.
|
|
2
|
+
import { n as normalizeNumericOption, D as DEFAULT_HISTORY_MAX_SNAPSHOTS, s as structuralSnapshot } from './shared/attaform.8mfKZCwH.mjs';
|
|
3
3
|
|
|
4
4
|
function captureErrorCells(map) {
|
|
5
5
|
const out = [];
|
|
@@ -14,7 +14,7 @@ function createHistoryRuntime(kernel, max) {
|
|
|
14
14
|
return {
|
|
15
15
|
form: structuralSnapshot(kernel.form.value),
|
|
16
16
|
blankPaths: [...kernel.blankPaths],
|
|
17
|
-
errorCells: captureErrorCells(kernel.errorCells)
|
|
17
|
+
errorCells: captureErrorCells(kernel.errorCells())
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
const positions = shallowRef([captureSnapshot()]);
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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 DEVTOOLS_WINDOW_KEY, F as FormStatus, f as FormStatusSeed, G as GateMarker, I as InjectWizardInput, g as InvalidPathError, h as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, i as ReservedFormKeyError, S as SerializedAttaformState, j as SerializedFormData, k as StepSlot, l as SubmitErrorHandlerError, U as UseRegisterOptions, m as UseRegisterReturn, n as UseWizardReturnType, W as WizardAggregateError, o as WizardCtx, p as WizardCtxForm, q as WizardOnError, r as WizardOnSubmit, s as WizardOptions, t as WizardPersistFn, u as WizardRestoreFn, v as WizardRestoreState, w as WizardStatusesProxy, x as WizardSubmitContext, y as assignKey, z as createAttaform, B as createRegistry, E as escapeForInlineScript, H as gate, J as getRegistryFromApp, K as hydrateAttaformState, M as injectForm, N as injectWizard, P as isRegisterValue, Q as kAttaformRegistry, T as lazy, V as renderAttaformState, X as useRegister, Y as useRegistry, Z as useWizard } from './shared/attaform.
|
|
2
|
-
import { G as GenericForm, F as FormKey, U as UseFormConfiguration,
|
|
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 DEVTOOLS_WINDOW_KEY, F as FormStatus, f as FormStatusSeed, G as GateMarker, I as InjectWizardInput, g as InvalidPathError, h as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, i as ReservedFormKeyError, S as SerializedAttaformState, j as SerializedFormData, k as StepSlot, l as SubmitErrorHandlerError, U as UseRegisterOptions, m as UseRegisterReturn, n as UseWizardReturnType, W as WizardAggregateError, o as WizardCtx, p as WizardCtxForm, q as WizardOnError, r as WizardOnSubmit, s as WizardOptions, t as WizardPersistFn, u as WizardRestoreFn, v as WizardRestoreState, w as WizardStatusesProxy, x as WizardSubmitContext, y as assignKey, z as createAttaform, B as createRegistry, E as escapeForInlineScript, H as gate, J as getRegistryFromApp, K as hydrateAttaformState, M as injectForm, N as injectWizard, P as isRegisterValue, Q as kAttaformRegistry, T as lazy, V as renderAttaformState, X as useRegister, Y as useRegistry, Z as useWizard } from './shared/attaform.DAo0QBmS.mjs';
|
|
2
|
+
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, ap as AcceptableDefaults, ab as ValidateOnConfig, a as UseFormReturnType, D as DefaultValuesInput, h as FieldMetaPayload } from './shared/attaform.DZnrDrNb.mjs';
|
|
3
3
|
import { AbstractSchema } from './abstract.mjs';
|
|
4
|
-
export { b as ArrayItem, c as ArrayPath, C as CustomDirectiveRegisterAssignerFn, d as DeepPartial, e as DefaultValuesShape, f as DisplayState, E as ErrorInput, g as ErrorsProxyShape, i as FieldState, j as FieldStateMap, k as FieldStateMapEntry, l as FlatPath, m as FormErrorRecord, n as FormErrorsSurface, o as FormMeta, H as HandleSubmit, p as HistoryPlugin, I as IsTuple, q as IsUnion, J as JoinSegments, r as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, s as NestedType, O as OnError, t as OnSubmit, P as ParseOptions, u as PartialFlatPath, v as Path, w as PathKey, x as PendingValidationStatus, y as Primitive, R as ROOT_PATH, z as ROOT_PATH_KEY, B as ReactiveValidationStatus, Q as RecordPath, S as RecordValue, T as RegisterDirective, V as RegisterFlatPath, W as RegisterOptions, X as RegisterSelectModifier, Y as RegisterTextModifier, Z as RegisterTransform, _ as RegisterValue, $ as
|
|
5
|
-
export { v as vRegister } from './shared/attaform.
|
|
6
|
-
import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.
|
|
7
|
-
export { P as PathInput, a as PathOutput } from './shared/attaform.
|
|
8
|
-
import { S as SupportedRootSchema$1, a as StorageShape$1 } from './shared/attaform.
|
|
4
|
+
export { b as ArrayItem, c as ArrayPath, C as CustomDirectiveRegisterAssignerFn, d as DeepPartial, e as DefaultValuesShape, f as DisplayState, E as ErrorInput, g as ErrorsProxyShape, i as FieldState, j as FieldStateMap, k as FieldStateMapEntry, l as FlatPath, m as FormErrorRecord, n as FormErrorsSurface, o as FormMeta, H as HandleSubmit, p as HistoryPlugin, I as IsTuple, q as IsUnion, J as JoinSegments, r as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, s as NestedType, O as OnError, t as OnSubmit, P as ParseOptions, u as PartialFlatPath, v as Path, w as PathKey, x as PendingValidationStatus, y as Primitive, R as ROOT_PATH, z as ROOT_PATH_KEY, B as ReactiveValidationStatus, Q as RecordPath, S as RecordValue, T as RegisterDirective, V as RegisterFlatPath, W as RegisterOptions, X as RegisterSelectModifier, Y as RegisterTextModifier, Z as RegisterTransform, _ as RegisterValue, $ as SchemaParseErrorWithData, a0 as SchemaParseErrorWithoutData, a1 as SchemaParseResult, a2 as SchemaParseSuccess, a3 as Segment, a4 as SetValueCallback, a5 as SetValuePayload, a6 as SettledValidationStatus, a7 as SlimPrimitiveKind, a8 as SubmitHandler, a9 as Unset, aa as ValidateOn, ac as ValidationError, ad as ValidationResponse, ae as ValidationResponseWithoutValue, af as ValueOfUnion, ag as WriteMeta, ah as WriteShape, ai as canonicalizePath, aj as isPathPrefix, ak as isUnset, al as parseDottedPath, am as unset } from './shared/attaform.DZnrDrNb.mjs';
|
|
5
|
+
export { v as vRegister } from './shared/attaform.D9RqPgGu.mjs';
|
|
6
|
+
import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.CRVe8s82.mjs';
|
|
7
|
+
export { P as PathInput, a as PathOutput } from './shared/attaform.CRVe8s82.mjs';
|
|
8
|
+
import { S as SupportedRootSchema$1, a as StorageShape$1 } from './shared/attaform.B-Tb62qV.mjs';
|
|
9
9
|
import { UnwrapZodRoot } from './zod-v3.mjs';
|
|
10
10
|
import { z } from 'zod';
|
|
11
11
|
import 'vue';
|
|
@@ -23,7 +23,7 @@ import 'vue';
|
|
|
23
23
|
* installed. In a v3-only install `z.ZodObject` is v3's `ZodObject`
|
|
24
24
|
* (and, lacking its required type arguments, degrades to an `any`-like
|
|
25
25
|
* error type under `skipLibCheck`), so a v3 schema satisfies the v4
|
|
26
|
-
* overload's constraint and binds it
|
|
26
|
+
* overload's constraint and binds it, collapsing the read slot to
|
|
27
27
|
* `never`. A Zod v4 schema carries the `_zod` internals brand; a v3
|
|
28
28
|
* schema never does.
|
|
29
29
|
* Intersecting a v4-only constraint or conditional branch with this
|
|
@@ -38,7 +38,7 @@ import 'vue';
|
|
|
38
38
|
* `z.ZodObject<z.ZodRawShape> & ZodV4Internals`, NOT bare
|
|
39
39
|
* `z.ZodObject & ZodV4Internals`. In a v3-only install `z.ZodObject`
|
|
40
40
|
* with no type argument is `ZodObject<T, ...>` missing its required
|
|
41
|
-
* arguments
|
|
41
|
+
* arguments, an error type that behaves like `any` under
|
|
42
42
|
* `skipLibCheck`, so `any & ZodV4Internals` collapses back to `any` and
|
|
43
43
|
* the marker stops excluding v3 schemas. Supplying `z.ZodRawShape`
|
|
44
44
|
* keeps it a concrete object type in both majors, so the intersection
|
|
@@ -58,23 +58,24 @@ type ZodV4Internals = {
|
|
|
58
58
|
* `S` to one Zod major, so the projection is a direct read with no
|
|
59
59
|
* dispatch in the type body.
|
|
60
60
|
*
|
|
61
|
-
*
|
|
62
|
-
* points share one definition. Internal
|
|
63
|
-
*
|
|
64
|
-
*
|
|
61
|
+
* They live here rather than in `types-unified.ts` or `use-form.ts` so
|
|
62
|
+
* the two entry points share one definition. Internal: the overloaded
|
|
63
|
+
* `useForm` already infers fully at a call site, so consumer code never
|
|
64
|
+
* reaches for them.
|
|
65
65
|
*/
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
* The schema's own input type
|
|
69
|
-
*
|
|
70
|
-
* is the reflexive escape arm `AcceptableDefaults`
|
|
71
|
-
* `defaultValues` slot so a generic form wrapper forwarding
|
|
72
|
-
* type-checks under a free `S` (#422).
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
68
|
+
* The schema's own input type exactly as a consumer would write it,
|
|
69
|
+
* `z.input<S>`, routed through neither `GenericForm` nor
|
|
70
|
+
* `UnwrapZodRoot`. It is the reflexive escape arm `AcceptableDefaults`
|
|
71
|
+
* adds to the `defaultValues` slot, so a generic form wrapper forwarding
|
|
72
|
+
* `z.input<S>` type-checks under a free `S` (#422).
|
|
73
|
+
*
|
|
74
|
+
* It MUST stay syntactically identical to what the wrapper forwards:
|
|
75
|
+
* wrapping it in a conditional makes it a deferred conditional, which
|
|
76
|
+
* stops matching the forwarded value under a generic. A wrong-major
|
|
77
|
+
* schema cannot bind the slot anyway, being rejected at the overload's
|
|
78
|
+
* `schema` constraint, so the raw input never widens it.
|
|
78
79
|
*/
|
|
79
80
|
type V4SchemaInput<S extends SupportedRootSchema> = z.input<S>;
|
|
80
81
|
type V3SchemaInput<S extends SupportedRootSchema$1> = z.input<S>;
|
|
@@ -92,18 +93,18 @@ type V3ReadOf<S extends SupportedRootSchema$1> = StorageShape$1<UnwrapZodRoot<S>
|
|
|
92
93
|
* import { useForm } from 'attaform/zod'
|
|
93
94
|
* import { z } from 'zod'
|
|
94
95
|
*
|
|
95
|
-
* const
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* password: z.string().min(8, 'At least 8 characters'),
|
|
99
|
-
* }),
|
|
96
|
+
* const schema = z.object({
|
|
97
|
+
* username: z.string().min(2, 'At least 2 characters'),
|
|
98
|
+
* password: z.string().min(8, 'At least 8 characters'),
|
|
100
99
|
* })
|
|
100
|
+
*
|
|
101
|
+
* const form = useForm({ schema })
|
|
101
102
|
* ```
|
|
102
103
|
*
|
|
103
|
-
* The constraint intersects `ZodV4Internals
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
104
|
+
* The constraint intersects `ZodV4Internals`, the v4-only `_zod` brand,
|
|
105
|
+
* so a v3 schema cannot bind this overload even where `z` resolves to v3
|
|
106
|
+
* in a single-major install; it falls through to the v3 overload below.
|
|
107
|
+
* See `types-zod-major.ts`.
|
|
107
108
|
*/
|
|
108
109
|
declare function useForm<Schema extends SupportedRootSchema & ZodV4Internals, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, never, K>, 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'> & {
|
|
109
110
|
schema: Schema;
|
|
@@ -116,16 +117,15 @@ declare function useForm<Schema extends SupportedRootSchema & ZodV4Internals, K
|
|
|
116
117
|
* import { useForm } from 'attaform/zod'
|
|
117
118
|
* import { z } from 'zod-v3'
|
|
118
119
|
*
|
|
119
|
-
* const
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* password: z.string().min(8, 'At least 8 characters'),
|
|
123
|
-
* }),
|
|
120
|
+
* const schema = z.object({
|
|
121
|
+
* username: z.string().min(2, 'At least 2 characters'),
|
|
122
|
+
* password: z.string().min(8, 'At least 8 characters'),
|
|
124
123
|
* })
|
|
124
|
+
*
|
|
125
|
+
* const form = useForm({ schema })
|
|
125
126
|
* ```
|
|
126
127
|
*
|
|
127
|
-
*
|
|
128
|
-
* above first and never reach here.
|
|
128
|
+
* A v4 schema binds the overload above and never reaches this one.
|
|
129
129
|
*/
|
|
130
130
|
declare function useForm<Schema extends SupportedRootSchema$1, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V3FormOf<Schema>, V3OutOf<Schema>, AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>, never, K>, 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'> & {
|
|
131
131
|
schema: Schema;
|
|
@@ -141,21 +141,21 @@ declare function useForm<Schema extends SupportedRootSchema$1, K extends FormKey
|
|
|
141
141
|
* overload or the impl signature, depending on whether the type
|
|
142
142
|
* argument is a concrete schema, a generic, or a constraint).
|
|
143
143
|
*
|
|
144
|
-
* The helpers dispatch ONCE per use site
|
|
145
|
-
*
|
|
146
|
-
* to
|
|
144
|
+
* The helpers dispatch ONCE per use site through a binary conditional,
|
|
145
|
+
* so nothing stacks and nothing amplifies across the return type.
|
|
146
|
+
* Equivalent to `ReturnType<typeof useForm<S>>`, but cache-stable across
|
|
147
147
|
* call patterns.
|
|
148
148
|
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
149
|
+
* They are test- and internal-facing. Consumer code has no reason to
|
|
150
|
+
* reach for them: the overloaded `useForm` already infers fully at the
|
|
151
|
+
* call site.
|
|
152
152
|
*/
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
|
-
* Direct V4 projection
|
|
156
|
-
* Zod major is known
|
|
157
|
-
* `function setup<S extends z.ZodObject>(s: S)
|
|
158
|
-
*
|
|
155
|
+
* Direct V4 projection, with no major dispatch. Use it when the schema's
|
|
156
|
+
* Zod major is statically known, the usual case for a V4 generic helper
|
|
157
|
+
* like `function setup<S extends z.ZodObject>(s: S)`. TS simplifies it
|
|
158
|
+
* cleanly under a generic constraint because no conditional
|
|
159
159
|
* is present.
|
|
160
160
|
*/
|
|
161
161
|
type UseFormReturnV4<Schema extends z.ZodObject, K extends FormKey = FormKey> = UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K>;
|
|
@@ -166,8 +166,8 @@ type UseFormConfigV4<Schema extends z.ZodObject, K extends FormKey = FormKey> =
|
|
|
166
166
|
schema: Schema;
|
|
167
167
|
} & ValidateOnConfig;
|
|
168
168
|
/**
|
|
169
|
-
* Direct V3 projection
|
|
170
|
-
* Zod major is known
|
|
169
|
+
* Direct V3 projection, with no major dispatch. Use it when the schema's
|
|
170
|
+
* Zod major is statically known.
|
|
171
171
|
*/
|
|
172
172
|
type UseFormReturnV3<Schema extends z.ZodObject<z.ZodRawShape>, K extends FormKey = FormKey> = UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K>;
|
|
173
173
|
/**
|
|
@@ -184,17 +184,16 @@ type UseFormConfigV3<Schema extends z.ZodObject<z.ZodRawShape>, K extends FormKe
|
|
|
184
184
|
* discriminated-union root all resolve here exactly as the runtime
|
|
185
185
|
* `useForm` overloads accept them.
|
|
186
186
|
*
|
|
187
|
-
* Replaces `ReturnType<typeof useForm<Schema, K>>` in test code
|
|
188
|
-
* concrete schemas.
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* compatibility.
|
|
187
|
+
* Replaces `ReturnType<typeof useForm<Schema, K>>` in test code holding
|
|
188
|
+
* concrete schemas. In a generic helper, `<S extends z.ZodObject>`, reach
|
|
189
|
+
* for `UseFormReturnV4<S>` instead: TS does not simplify a conditional
|
|
190
|
+
* under a generic constraint, so this helper's dispatch stays deferred
|
|
191
|
+
* and return-type compatibility cannot be proven.
|
|
193
192
|
*/
|
|
194
193
|
type UseFormReturn<Schema, K extends FormKey = FormKey> = Schema extends SupportedRootSchema & ZodV4Internals ? UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K> : Schema extends SupportedRootSchema$1 ? UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K> : never;
|
|
195
194
|
/**
|
|
196
195
|
* The configuration parameter shape of `useForm` for a given Zod
|
|
197
|
-
* schema.
|
|
196
|
+
* schema. Same dispatch as `UseFormReturn`; it replaces
|
|
198
197
|
* `Parameters<typeof useForm<Schema, K>>[0]` in test code.
|
|
199
198
|
*/
|
|
200
199
|
type UseFormConfig<Schema, K extends FormKey = FormKey> = Schema extends SupportedRootSchema & ZodV4Internals ? Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, DefaultValuesInput<V4FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
@@ -206,24 +205,23 @@ type UseFormConfig<Schema, K extends FormKey = FormKey> = Schema extends Support
|
|
|
206
205
|
/**
|
|
207
206
|
* Field-metadata write/read API for the unified `attaform/zod` entry.
|
|
208
207
|
*
|
|
209
|
-
* Storage is shared with both adapters
|
|
210
|
-
* payload written here is visible to whichever adapter the unified
|
|
211
|
-
* `useForm` dispatches to at runtime,
|
|
208
|
+
* Storage is shared with both adapters through `core/field-meta-store`,
|
|
209
|
+
* so a payload written here is visible to whichever adapter the unified
|
|
210
|
+
* `useForm` dispatches to at runtime, whatever the Zod major. No
|
|
212
211
|
* `zod` runtime import; the type-only `import type` is erased at
|
|
213
212
|
* build, so `attaform/zod` carries no `z.registry` reference even
|
|
214
213
|
* when consumed by a Zod 3 project without the Vite plugin alias.
|
|
215
214
|
*
|
|
216
|
-
* The native v4 chain `schema.register(fieldMeta, payload)`
|
|
217
|
-
*
|
|
218
|
-
*
|
|
215
|
+
* The native v4 chain `schema.register(fieldMeta, payload)` works too:
|
|
216
|
+
* Zod 4's `.register()` only calls `.add(this, payload)` structurally,
|
|
217
|
+
* which the shared store satisfies.
|
|
219
218
|
*/
|
|
220
219
|
|
|
221
220
|
type ZodFieldMetaRegistry = ReturnType<typeof z.registry<FieldMetaPayload>>;
|
|
222
221
|
/**
|
|
223
|
-
* The shared registry
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
* any.
|
|
222
|
+
* The shared registry an Attaform-aware Zod schema registers field
|
|
223
|
+
* metadata against, whatever its major. The same instance the v3 and v4
|
|
224
|
+
* adapter entries expose: write in one place, read from any.
|
|
227
225
|
*
|
|
228
226
|
* Cast to Zod 4's `$ZodRegistry<FieldMetaPayload>` so the native
|
|
229
227
|
* `schema.register(fieldMeta, payload)` chain type-checks for v4
|
|
@@ -242,8 +240,7 @@ declare const fieldMeta: ZodFieldMetaRegistry;
|
|
|
242
240
|
* keys on schema reference, so cloning prevents last-write-wins
|
|
243
241
|
* collisions for sub-schemas reused at multiple paths).
|
|
244
242
|
*
|
|
245
|
-
* Works on
|
|
246
|
-
* shape of the schema:
|
|
243
|
+
* Works on a Zod 3 or a Zod 4 schema, branching on runtime shape:
|
|
247
244
|
* - Zod 4 schemas expose a public `.clone()` method; we call it.
|
|
248
245
|
* - Zod 3 schemas don't, so we reconstruct via
|
|
249
246
|
* `new schema.constructor(schema._def)`.
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
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.CdZIEf7_.mjs';
|
|
2
|
-
export { A as AttaformErrorCode, e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform.
|
|
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.
|
|
4
|
-
export { a as assignKey, v as vRegister } from './shared/attaform.
|
|
5
|
-
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.
|
|
2
|
+
export { A as AttaformErrorCode, e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform.DNPJPOO7.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.C4shmwyJ.mjs';
|
|
4
|
+
export { a as assignKey, v as vRegister } from './shared/attaform.DxKQsqFZ.mjs';
|
|
5
|
+
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.L011tHgJ.mjs';
|
|
6
6
|
export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
|
package/dist/nuxt.d.mts
CHANGED
|
@@ -17,8 +17,9 @@ import * as _nuxt_schema from '@nuxt/schema';
|
|
|
17
17
|
interface AttaformModuleOptions {
|
|
18
18
|
/**
|
|
19
19
|
* Forwarded to `attaform/vite`'s `resolveZodAlias` option.
|
|
20
|
-
* Default `true
|
|
21
|
-
* at build time to
|
|
20
|
+
* Default `true`, so `attaform` and `attaform/zod` imports are
|
|
21
|
+
* rewritten at build time to `attaform/zod-v3` or `attaform/zod-v4`,
|
|
22
|
+
* based
|
|
22
23
|
* on the consumer's installed Zod major. Set to `false` to bypass
|
|
23
24
|
* the rewrite and ship the runtime-dispatch unified entry instead.
|
|
24
25
|
*/
|
|
@@ -46,7 +47,7 @@ type AttaformRuntimeConfig = {
|
|
|
46
47
|
/**
|
|
47
48
|
* Library version, read from the package's own `package.json` at
|
|
48
49
|
* module setup. Surfaced to the runtime plugin so the DevTools
|
|
49
|
-
* overlay panel can render a version pill
|
|
50
|
+
* overlay panel can render a version pill. One source of truth, so it
|
|
50
51
|
* matches the `meta.version` Nuxt DevTools sees in the Modules panel.
|
|
51
52
|
*/
|
|
52
53
|
version: string;
|
package/dist/nuxt.mjs
CHANGED
|
@@ -60,12 +60,9 @@ var nuxt_default = defineNuxtModule({
|
|
|
60
60
|
addCustomTab({
|
|
61
61
|
name: "attaform",
|
|
62
62
|
title: "Attaform",
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
// route family (sibling to the panel HTML). A real URL
|
|
67
|
-
// renders reliably across Nuxt DevTools versions where
|
|
68
|
-
// `data:` URIs don't.
|
|
63
|
+
// Served by the `attaform/vite` middleware, sibling to the
|
|
64
|
+
// panel HTML. A real URL renders reliably across Nuxt
|
|
65
|
+
// DevTools versions where `data:` URIs do not.
|
|
69
66
|
icon: "/_attaform_devtools/icon.svg",
|
|
70
67
|
view: {
|
|
71
68
|
type: "iframe",
|
package/dist/rollup.d.mts
CHANGED
|
@@ -29,6 +29,17 @@ interface AttaformRollupPlugin {
|
|
|
29
29
|
id: string;
|
|
30
30
|
} | null> | null;
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Rollup plugin that resolves `attaform` and `attaform/zod` to the one
|
|
34
|
+
* adapter subpath matching the installed Zod major, so the build ships a
|
|
35
|
+
* single adapter instead of both.
|
|
36
|
+
*
|
|
37
|
+
* ```js
|
|
38
|
+
* import { attaform } from 'attaform/rollup'
|
|
39
|
+
*
|
|
40
|
+
* export default { plugins: [attaform()] }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
32
43
|
declare function attaform(options?: AttaformRollupPluginOptions): AttaformRollupPlugin;
|
|
33
44
|
|
|
34
45
|
export { attaform };
|
package/dist/rollup.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as resolveZodAliasTarget, i as isRewritableZodSpecifier } from './shared/attaform.
|
|
1
|
+
import { r as resolveZodAliasTarget, i as isRewritableZodSpecifier } from './shared/attaform.BAf3UNn4.mjs';
|
|
2
2
|
|
|
3
3
|
function attaform(options = {}) {
|
|
4
4
|
const resolveZodAlias = options.resolveZodAlias !== false;
|
package/dist/rspack.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { W as WebpackFamilyPlugin, a as WebpackFamilyPluginOptions } from './shared/attaform.C9fPTxjB.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* `attaform/rspack
|
|
4
|
+
* `attaform/rspack`, the Rspack plugin that rewrites `attaform/zod`
|
|
5
|
+
* imports
|
|
5
6
|
* to the single matching adapter subpath (`attaform/zod-v3` or
|
|
6
7
|
* `attaform/zod-v4`) at build time, based on the consumer's installed Zod
|
|
7
8
|
* major. Without it, Rspack ships both adapters because the unified
|
|
@@ -20,16 +21,12 @@ import { W as WebpackFamilyPlugin, a as WebpackFamilyPluginOptions } from './sha
|
|
|
20
21
|
* so this shares its body with `attaform/webpack` via
|
|
21
22
|
* `createWebpackFamilyPlugin`; only the diagnostic tag differs.
|
|
22
23
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* that pipeline register it once per app:
|
|
30
|
-
*
|
|
31
|
-
* import { installVRegister } from 'attaform/directive'
|
|
32
|
-
* installVRegister(app)
|
|
24
|
+
* The adapter rewrite is all this plugin does. Two things
|
|
25
|
+
* `attaform/vite` also provides do NOT transfer, because both are
|
|
26
|
+
* `@vitejs/plugin-vue`-specific: wire `attaform/transforms` into your
|
|
27
|
+
* Vue compiler for the SSR-critical template transforms, and register
|
|
28
|
+
* the directive once per app with `installVRegister(app)` from
|
|
29
|
+
* `attaform/directive`.
|
|
33
30
|
*
|
|
34
31
|
* Zero-dep: the plugin imports nothing from `@rspack/core` (it taps the
|
|
35
32
|
* resolve hook the compiler injects at the consumer's build).
|
|
@@ -39,6 +36,17 @@ import { W as WebpackFamilyPlugin, a as WebpackFamilyPluginOptions } from './sha
|
|
|
39
36
|
type AttaformRspackPluginOptions = WebpackFamilyPluginOptions;
|
|
40
37
|
/** The structural shape Rspack requires of the plugin. */
|
|
41
38
|
type AttaformRspackPlugin = WebpackFamilyPlugin;
|
|
39
|
+
/**
|
|
40
|
+
* Rspack plugin that resolves `attaform/zod` to the one adapter subpath
|
|
41
|
+
* matching the installed Zod major, so the build ships a single adapter
|
|
42
|
+
* instead of both.
|
|
43
|
+
*
|
|
44
|
+
* ```js
|
|
45
|
+
* import { attaform } from 'attaform/rspack'
|
|
46
|
+
*
|
|
47
|
+
* export default { plugins: [attaform()] }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
42
50
|
declare function attaform(options?: AttaformRspackPluginOptions): AttaformRspackPlugin;
|
|
43
51
|
|
|
44
52
|
export { attaform };
|
package/dist/rspack.mjs
CHANGED