attaform 0.27.5 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstract.d.mts +5 -4
- package/dist/abstract.mjs +4 -3
- package/dist/chunks/fingerprint.mjs +0 -1
- package/dist/chunks/fingerprint2.mjs +1 -2
- package/dist/dev/abstract.mjs +4 -0
- package/dist/{chunks → dev/chunks}/dev-key-collision-warnings.mjs +0 -1
- package/dist/{chunks → dev/chunks}/devtools.mjs +5 -6
- package/dist/{chunks/fingerprint.cjs → dev/chunks/fingerprint.mjs} +7 -10
- package/dist/{chunks/fingerprint2.cjs → dev/chunks/fingerprint2.mjs} +32 -35
- package/dist/dev/directive.mjs +1 -0
- package/dist/dev/history.mjs +89 -0
- package/dist/dev/index.mjs +5 -0
- package/dist/dev/runtime/plugins/attaform.mjs +40 -0
- package/dist/{shared/attaform.f2zyNh5d.cjs → dev/shared/attaform-dev.6qxD-Yqo.mjs} +187 -43
- package/dist/{shared/attaform.CQN9R62B.cjs → dev/shared/attaform-dev.BJGA_UOS.mjs} +1 -4
- package/dist/{shared/attaform.Dc1mx48r.mjs → dev/shared/attaform-dev.BR8u0YOZ.mjs} +6 -7
- package/dist/dev/shared/attaform-dev.BXE2cr0L.mjs +220 -0
- package/dist/dev/shared/attaform-dev.By4PRjt0.mjs +248 -0
- package/dist/{shared/attaform.Cg_8gFQ7.mjs → dev/shared/attaform-dev.D2I8e_Mm.mjs} +132 -568
- package/dist/dev/shared/attaform-dev.Dr2YzS5B.mjs +197 -0
- package/dist/{shared/attaform.nMaz2C5P.mjs → dev/shared/attaform-dev.P7cseiEG.mjs} +178 -397
- package/dist/{shared/attaform.BypWgXRB.mjs → dev/shared/attaform-dev.WmuhD_CZ.mjs} +3955 -5029
- package/dist/{shared/attaform.Dkjh_F30.mjs → dev/shared/attaform-dev.oYrkP9dj.mjs} +160 -508
- package/dist/dev/zod-v3.mjs +17 -0
- package/dist/dev/zod-v4.mjs +16 -0
- package/dist/dev/zod.mjs +5 -0
- package/dist/directive.d.mts +20 -0
- package/dist/directive.mjs +1 -0
- package/dist/esbuild.mjs +0 -1
- package/dist/history.d.mts +59 -0
- package/dist/history.mjs +89 -0
- package/dist/index.d.mts +11 -5
- package/dist/index.mjs +5 -4
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.mjs +5 -2
- package/dist/rollup.mjs +0 -1
- package/dist/rspack.d.mts +6 -1
- package/dist/rspack.mjs +0 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.vue +9 -8
- package/dist/runtime/plugins/attaform.mjs +1 -2
- package/dist/shared/{attaform.CIBMfxg9.d.ts → attaform.B4VkS43-.d.mts} +2 -2
- package/dist/shared/{attaform.Cg1rUfcF.cjs → attaform.B8k8JrmK.mjs} +3778 -5297
- package/dist/shared/attaform.BJGA_UOS.mjs +0 -1
- package/dist/shared/{attaform.CTiZ9Rrv.mjs → attaform.C09fpdLS.mjs} +172 -16
- package/dist/shared/{attaform.Bh8A6YAc.cjs → attaform.CJP3RkGa.mjs} +141 -590
- package/dist/shared/{attaform.CzL2CZ8U.d.ts → attaform.Cgu-hdSb.d.mts} +328 -78
- package/dist/shared/attaform.Cs2Rbdlo.mjs +0 -1
- package/dist/shared/{attaform.DcFDQVpa.d.ts → attaform.D5V4tZWq.d.mts} +79 -179
- package/dist/shared/{attaform.CF-EnyJn.cjs → attaform.D6DCnnQu.mjs} +11 -16
- package/dist/shared/attaform.DhnPb6nK.mjs +0 -1
- package/dist/shared/attaform.Dq4vWxuG.mjs +197 -0
- package/dist/shared/attaform.JfSWdEcb.d.mts +44 -0
- package/dist/shared/attaform.KvlEedlF.mjs +0 -1
- package/dist/shared/{attaform.Crv0RNiz.cjs → attaform.NLmerepI.mjs} +175 -557
- package/dist/shared/attaform.h0i6LijT.mjs +242 -0
- package/dist/shared/{attaform.Biytrv0-.cjs → attaform.uLbun31C.mjs} +204 -544
- package/dist/shared/attaform.v0fQtWyA.mjs +0 -1
- package/dist/shared/attaform.wfY8XFvm.mjs +197 -0
- package/dist/transforms.mjs +0 -1
- package/dist/vite.d.mts +17 -5
- package/dist/vite.mjs +24 -2
- package/dist/webpack.d.mts +6 -1
- package/dist/webpack.mjs +0 -1
- package/dist/zod-v3.d.mts +11 -6
- package/dist/zod-v3.mjs +17 -4
- package/dist/zod-v4.d.mts +12 -6
- package/dist/zod-v4.mjs +16 -4
- package/dist/zod.d.mts +4 -3
- package/dist/zod.mjs +5 -4
- package/package.json +23 -8
- package/skills/attaform/SKILL.md +2 -1
- package/dist/abstract.cjs +0 -48
- package/dist/abstract.cjs.map +0 -1
- package/dist/abstract.d.cts +0 -42
- package/dist/abstract.d.ts +0 -42
- package/dist/abstract.mjs.map +0 -1
- package/dist/chunks/dev-key-collision-warnings.cjs +0 -25
- package/dist/chunks/dev-key-collision-warnings.cjs.map +0 -1
- package/dist/chunks/dev-key-collision-warnings.mjs.map +0 -1
- package/dist/chunks/devtools.cjs +0 -157
- package/dist/chunks/devtools.cjs.map +0 -1
- package/dist/chunks/devtools.mjs.map +0 -1
- package/dist/chunks/fingerprint.cjs.map +0 -1
- package/dist/chunks/fingerprint.mjs.map +0 -1
- package/dist/chunks/fingerprint2.cjs.map +0 -1
- package/dist/chunks/fingerprint2.mjs.map +0 -1
- package/dist/esbuild.cjs +0 -28
- package/dist/esbuild.cjs.map +0 -1
- package/dist/esbuild.d.cts +0 -56
- package/dist/esbuild.d.ts +0 -56
- package/dist/esbuild.mjs.map +0 -1
- package/dist/index.cjs +0 -51
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -249
- package/dist/index.d.ts +0 -249
- package/dist/index.mjs.map +0 -1
- package/dist/nuxt.cjs +0 -84
- package/dist/nuxt.cjs.map +0 -1
- package/dist/nuxt.d.cts +0 -66
- package/dist/nuxt.d.ts +0 -66
- package/dist/nuxt.mjs.map +0 -1
- package/dist/rollup.cjs +0 -24
- package/dist/rollup.cjs.map +0 -1
- package/dist/rollup.d.cts +0 -35
- package/dist/rollup.d.ts +0 -35
- package/dist/rollup.mjs.map +0 -1
- package/dist/rspack.cjs +0 -10
- package/dist/rspack.cjs.map +0 -1
- package/dist/rspack.d.cts +0 -40
- package/dist/rspack.d.ts +0 -40
- package/dist/rspack.mjs.map +0 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.vue.d.ts +0 -7
- package/dist/runtime/components/DevtoolsValueTree.vue.d.ts +0 -35
- package/dist/runtime/plugins/attaform.cjs +0 -43
- package/dist/runtime/plugins/attaform.cjs.map +0 -1
- package/dist/runtime/plugins/attaform.d.cts +0 -5
- package/dist/runtime/plugins/attaform.d.ts +0 -5
- package/dist/runtime/plugins/attaform.mjs.map +0 -1
- package/dist/shared/attaform.B3abZaCV.d.cts +0 -2484
- package/dist/shared/attaform.BJGA_UOS.mjs.map +0 -1
- package/dist/shared/attaform.Bh8A6YAc.cjs.map +0 -1
- package/dist/shared/attaform.Biytrv0-.cjs.map +0 -1
- package/dist/shared/attaform.Bn0IzhD_.cjs +0 -800
- package/dist/shared/attaform.Bn0IzhD_.cjs.map +0 -1
- package/dist/shared/attaform.BypWgXRB.mjs.map +0 -1
- package/dist/shared/attaform.C9fPTxjB.d.cts +0 -41
- package/dist/shared/attaform.C9fPTxjB.d.ts +0 -41
- package/dist/shared/attaform.CF-EnyJn.cjs.map +0 -1
- package/dist/shared/attaform.CJ1Z9Mz4.d.mts +0 -2484
- package/dist/shared/attaform.CQN9R62B.cjs.map +0 -1
- package/dist/shared/attaform.CTiZ9Rrv.mjs.map +0 -1
- package/dist/shared/attaform.Cg1rUfcF.cjs.map +0 -1
- package/dist/shared/attaform.Cg_8gFQ7.mjs.map +0 -1
- package/dist/shared/attaform.Crv0RNiz.cjs.map +0 -1
- package/dist/shared/attaform.Cs2Rbdlo.mjs.map +0 -1
- package/dist/shared/attaform.CzL2CZ8U.d.cts +0 -4713
- package/dist/shared/attaform.CzL2CZ8U.d.mts +0 -4713
- package/dist/shared/attaform.DRUT703x.d.cts +0 -56
- package/dist/shared/attaform.DRUT703x.d.ts +0 -56
- package/dist/shared/attaform.DYwyM5Cp.d.cts +0 -232
- package/dist/shared/attaform.Dc1mx48r.mjs.map +0 -1
- package/dist/shared/attaform.DhnPb6nK.mjs.map +0 -1
- package/dist/shared/attaform.Dkjh_F30.mjs.map +0 -1
- package/dist/shared/attaform.DoQm_Vkd.cjs +0 -58
- package/dist/shared/attaform.DoQm_Vkd.cjs.map +0 -1
- package/dist/shared/attaform.DrHOqB-d.d.mts +0 -232
- package/dist/shared/attaform.KvlEedlF.mjs.map +0 -1
- package/dist/shared/attaform.RaTzp1WF.cjs +0 -26
- package/dist/shared/attaform.RaTzp1WF.cjs.map +0 -1
- package/dist/shared/attaform.f2zyNh5d.cjs.map +0 -1
- package/dist/shared/attaform.nMaz2C5P.mjs.map +0 -1
- package/dist/shared/attaform.v0fQtWyA.mjs.map +0 -1
- package/dist/shared/attaform.yUrz7C2z.cjs +0 -29
- package/dist/shared/attaform.yUrz7C2z.cjs.map +0 -1
- package/dist/transforms.cjs +0 -12
- package/dist/transforms.cjs.map +0 -1
- package/dist/transforms.d.cts +0 -73
- package/dist/transforms.d.ts +0 -73
- package/dist/transforms.mjs.map +0 -1
- package/dist/vite.cjs +0 -363
- package/dist/vite.cjs.map +0 -1
- package/dist/vite.d.cts +0 -133
- package/dist/vite.d.ts +0 -133
- package/dist/vite.mjs.map +0 -1
- package/dist/webpack.cjs +0 -10
- package/dist/webpack.cjs.map +0 -1
- package/dist/webpack.d.cts +0 -37
- package/dist/webpack.d.ts +0 -37
- package/dist/webpack.mjs.map +0 -1
- package/dist/zod-v3.cjs +0 -53
- package/dist/zod-v3.cjs.map +0 -1
- package/dist/zod-v3.d.cts +0 -246
- package/dist/zod-v3.d.ts +0 -246
- package/dist/zod-v3.mjs.map +0 -1
- package/dist/zod-v4.cjs +0 -55
- package/dist/zod-v4.cjs.map +0 -1
- package/dist/zod-v4.d.cts +0 -172
- package/dist/zod-v4.d.ts +0 -172
- package/dist/zod-v4.mjs.map +0 -1
- package/dist/zod.cjs +0 -51
- package/dist/zod.cjs.map +0 -1
- package/dist/zod.d.cts +0 -7
- package/dist/zod.d.ts +0 -7
- package/dist/zod.mjs.map +0 -1
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
class AttaformError extends Error {
|
|
2
|
+
constructor(message, options) {
|
|
3
|
+
super(message, options);
|
|
4
|
+
this.name = new.target.name;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
class InvalidPathError extends AttaformError {
|
|
8
|
+
}
|
|
9
|
+
class InvalidUseFormConfigError extends AttaformError {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(
|
|
12
|
+
"[attaform] AF04 attaform.dev/e/af04"
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
class SubmitErrorHandlerError extends AttaformError {
|
|
17
|
+
}
|
|
18
|
+
function toError(value) {
|
|
19
|
+
if (value instanceof Error) return value;
|
|
20
|
+
const message = typeof value === "string" && value.length > 0 ? value : `Submit callback threw a non-Error value (${typeof value})`;
|
|
21
|
+
return new Error(message, { cause: value });
|
|
22
|
+
}
|
|
23
|
+
function normalizeErrorInput(item, scope, defaultCode) {
|
|
24
|
+
if (item instanceof Error) {
|
|
25
|
+
return {
|
|
26
|
+
message: item.message.length > 0 ? item.message : "Unknown error",
|
|
27
|
+
path: scope !== void 0 ? [...scope] : [],
|
|
28
|
+
code: defaultCode
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const entry = {
|
|
32
|
+
message: typeof item.message === "string" && item.message.length > 0 ? item.message : "Unknown error",
|
|
33
|
+
path: scope !== void 0 ? [...scope] : Array.isArray(item.path) ? [...item.path] : [],
|
|
34
|
+
code: typeof item.code === "string" && item.code.length > 0 ? item.code : defaultCode
|
|
35
|
+
};
|
|
36
|
+
if (item.data !== void 0) entry.data = item.data;
|
|
37
|
+
return entry;
|
|
38
|
+
}
|
|
39
|
+
function normalizeErrorInputs(input, scope, defaultCode) {
|
|
40
|
+
const items = Array.isArray(input) ? input : [input];
|
|
41
|
+
return items.map((item) => normalizeErrorInput(item, scope, defaultCode));
|
|
42
|
+
}
|
|
43
|
+
function* cellEntriesFor(cells, side) {
|
|
44
|
+
for (const [key, cell] of cells) {
|
|
45
|
+
const list = cell[side];
|
|
46
|
+
if (list.length > 0) yield [key, list];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
class RegistryNotInstalledError extends AttaformError {
|
|
50
|
+
constructor() {
|
|
51
|
+
super(
|
|
52
|
+
"[attaform] AF07 attaform.dev/e/af07"
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
class OutsideSetupError extends AttaformError {
|
|
57
|
+
constructor() {
|
|
58
|
+
super(
|
|
59
|
+
"[attaform] AF06 attaform.dev/e/af06"
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
class ReservedFormKeyError extends AttaformError {
|
|
64
|
+
constructor(key) {
|
|
65
|
+
super(
|
|
66
|
+
`[attaform] AF05 attaform.dev/e/af05 "${key}"`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function groupErrorsByKey(entries) {
|
|
71
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
72
|
+
for (const raw of entries) {
|
|
73
|
+
const { key } = canonicalizePath(raw.path);
|
|
74
|
+
const list = grouped.get(key);
|
|
75
|
+
if (list === void 0) grouped.set(key, [raw]);
|
|
76
|
+
else list.push(raw);
|
|
77
|
+
}
|
|
78
|
+
return grouped;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const INTEGER_SEGMENT = /^(?:0|[1-9]\d*)$/;
|
|
82
|
+
function normalizeSegment(raw) {
|
|
83
|
+
if (typeof raw === "number") {
|
|
84
|
+
if (!Number.isInteger(raw) || raw < 0) {
|
|
85
|
+
throw new InvalidPathError(
|
|
86
|
+
`[attaform] AF08 attaform.dev/e/af08 ${String(raw)}`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
return raw;
|
|
90
|
+
}
|
|
91
|
+
if (INTEGER_SEGMENT.test(raw)) return Number(raw);
|
|
92
|
+
return raw;
|
|
93
|
+
}
|
|
94
|
+
function parseDottedPath(path) {
|
|
95
|
+
if (path.length === 0) return [""];
|
|
96
|
+
const rawSegments = path.split(".");
|
|
97
|
+
const segments = [];
|
|
98
|
+
for (const raw of rawSegments) {
|
|
99
|
+
if (raw.length === 0) {
|
|
100
|
+
throw new InvalidPathError(
|
|
101
|
+
`[attaform] AF09 attaform.dev/e/af09 '${path}'`
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
segments.push(normalizeSegment(raw));
|
|
105
|
+
}
|
|
106
|
+
return segments;
|
|
107
|
+
}
|
|
108
|
+
const CANONICAL_STRING_CACHE_MAX = 128;
|
|
109
|
+
const canonicalStringCache = /* @__PURE__ */ new Map();
|
|
110
|
+
const PATHKEY_TO_SEGMENTS_MAX = 4096;
|
|
111
|
+
const pathKeyToSegments = /* @__PURE__ */ new Map();
|
|
112
|
+
function rememberSegmentsForPathKey(key, segments) {
|
|
113
|
+
if (!pathKeyToSegments.has(key) && pathKeyToSegments.size >= PATHKEY_TO_SEGMENTS_MAX) {
|
|
114
|
+
const oldest = pathKeyToSegments.keys().next().value;
|
|
115
|
+
if (oldest !== void 0) pathKeyToSegments.delete(oldest);
|
|
116
|
+
}
|
|
117
|
+
pathKeyToSegments.set(key, segments);
|
|
118
|
+
}
|
|
119
|
+
function segmentsForPathKey(key) {
|
|
120
|
+
const cached = pathKeyToSegments.get(key);
|
|
121
|
+
if (cached !== void 0) return cached;
|
|
122
|
+
let parsed;
|
|
123
|
+
try {
|
|
124
|
+
parsed = JSON.parse(key);
|
|
125
|
+
} catch {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
if (!Array.isArray(parsed)) return null;
|
|
129
|
+
const segments = [];
|
|
130
|
+
for (const raw of parsed) {
|
|
131
|
+
if (typeof raw !== "string" && typeof raw !== "number") return null;
|
|
132
|
+
segments.push(normalizeSegment(raw));
|
|
133
|
+
}
|
|
134
|
+
rememberSegmentsForPathKey(key, segments);
|
|
135
|
+
return segments;
|
|
136
|
+
}
|
|
137
|
+
function canonicalizePath(input) {
|
|
138
|
+
if (typeof input === "string") {
|
|
139
|
+
const cached = canonicalStringCache.get(input);
|
|
140
|
+
if (cached !== void 0) return cached;
|
|
141
|
+
const segments = parseDottedPath(input);
|
|
142
|
+
const key = JSON.stringify(segments);
|
|
143
|
+
const entry = { segments, key };
|
|
144
|
+
if (canonicalStringCache.size >= CANONICAL_STRING_CACHE_MAX) {
|
|
145
|
+
const oldest = canonicalStringCache.keys().next().value;
|
|
146
|
+
if (oldest !== void 0) canonicalStringCache.delete(oldest);
|
|
147
|
+
}
|
|
148
|
+
canonicalStringCache.set(input, entry);
|
|
149
|
+
rememberSegmentsForPathKey(key, segments);
|
|
150
|
+
return entry;
|
|
151
|
+
}
|
|
152
|
+
return keyForSegments(input);
|
|
153
|
+
}
|
|
154
|
+
function keyForSegments(input) {
|
|
155
|
+
const segments = Array.from(input).map(normalizeSegment);
|
|
156
|
+
const key = JSON.stringify(segments);
|
|
157
|
+
rememberSegmentsForPathKey(key, segments);
|
|
158
|
+
return { segments, key };
|
|
159
|
+
}
|
|
160
|
+
function segmentsToDotted(segments) {
|
|
161
|
+
return segments.join(".");
|
|
162
|
+
}
|
|
163
|
+
function pathKeyToDotted(key) {
|
|
164
|
+
const segments = segmentsForPathKey(key);
|
|
165
|
+
if (segments === null) return null;
|
|
166
|
+
return segmentsToDotted(segments);
|
|
167
|
+
}
|
|
168
|
+
function coerceToPathKey(input) {
|
|
169
|
+
if (input.length > 0 && input.charCodeAt(0) === 91) {
|
|
170
|
+
try {
|
|
171
|
+
const parsed = JSON.parse(input);
|
|
172
|
+
if (Array.isArray(parsed) && parsed.every((s) => typeof s === "string" || typeof s === "number")) {
|
|
173
|
+
return input;
|
|
174
|
+
}
|
|
175
|
+
} catch {
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return canonicalizePath(input).key;
|
|
179
|
+
}
|
|
180
|
+
const ROOT_PATH = Object.freeze([]);
|
|
181
|
+
const ROOT_PATH_KEY = "[]";
|
|
182
|
+
function isPathPrefix(prefix, path) {
|
|
183
|
+
if (path.length < prefix.length) return false;
|
|
184
|
+
for (let i = 0; i < prefix.length; i++) {
|
|
185
|
+
if (path[i] !== prefix[i]) return false;
|
|
186
|
+
}
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
function pathsEqual(a, b) {
|
|
190
|
+
if (a.length !== b.length) return false;
|
|
191
|
+
for (let i = 0; i < a.length; i++) {
|
|
192
|
+
if (a[i] !== b[i]) return false;
|
|
193
|
+
}
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export { AttaformError as A, InvalidPathError as I, OutsideSetupError as O, ROOT_PATH as R, SubmitErrorHandlerError as S, InvalidUseFormConfigError as a, ROOT_PATH_KEY as b, RegistryNotInstalledError as c, ReservedFormKeyError as d, canonicalizePath as e, pathsEqual as f, pathKeyToDotted as g, cellEntriesFor as h, isPathPrefix as i, groupErrorsByKey as j, keyForSegments as k, normalizeErrorInputs as l, coerceToPathKey as m, normalizeErrorInput as n, parseDottedPath as p, segmentsForPathKey as s, toError as t };
|
package/dist/transforms.mjs
CHANGED
package/dist/vite.d.mts
CHANGED
|
@@ -55,7 +55,9 @@ declare const attaformAutoImportsMap: Record<string, string[]>;
|
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* `attaform/vite` — Vite plugin that wires the compile-time node
|
|
58
|
-
* transforms with @vitejs/plugin-vue
|
|
58
|
+
* transforms with @vitejs/plugin-vue, binds `v-register` into each
|
|
59
|
+
* compiled template that uses it (so no app-level directive
|
|
60
|
+
* registration exists or is needed), AND rewrites `attaform` and
|
|
59
61
|
* `attaform/zod` imports to either `attaform/zod-v3` or `attaform/zod-v4`
|
|
60
62
|
* at build time, based on the consumer's installed Zod major. The result
|
|
61
63
|
* is one Zod adapter shipped per bundle, with no manual subpath choice.
|
|
@@ -110,9 +112,11 @@ interface AttaformVitePluginOptions {
|
|
|
110
112
|
}
|
|
111
113
|
/**
|
|
112
114
|
* Vite plugin that wires the form library's compile-time template
|
|
113
|
-
* transforms into `@vitejs/plugin-vue
|
|
114
|
-
*
|
|
115
|
-
*
|
|
115
|
+
* transforms into `@vitejs/plugin-vue`, binds the `v-register`
|
|
116
|
+
* directive into each compiled template that uses it, and rewrites the
|
|
117
|
+
* bare `attaform` barrel and the unified `attaform/zod` import to the
|
|
118
|
+
* matching adapter subpath. Required for SSR and for hydration
|
|
119
|
+
* accuracy under bare Vue 3.
|
|
116
120
|
*
|
|
117
121
|
* ```ts
|
|
118
122
|
* // vite.config.ts
|
|
@@ -126,8 +130,16 @@ interface AttaformVitePluginOptions {
|
|
|
126
130
|
*
|
|
127
131
|
* Place the call after `vue()` in the plugins array. Nuxt projects
|
|
128
132
|
* don't need this — `attaform/nuxt` handles it.
|
|
133
|
+
*
|
|
134
|
+
* Returns a two-plugin array (Vite flattens nested plugin arrays): the
|
|
135
|
+
* main pre-plugin above, plus a post-plugin that rewrites each compiled
|
|
136
|
+
* SFC's `resolveDirective("register")` to a static import from
|
|
137
|
+
* `attaform/directive`. The rewrite is why no app-level directive
|
|
138
|
+
* registration exists or is needed here — see
|
|
139
|
+
* `runtime/lib/core/transforms/directive-delivery-transform.ts` for the
|
|
140
|
+
* mechanism and its scope.
|
|
129
141
|
*/
|
|
130
|
-
declare function attaform(options?: AttaformVitePluginOptions): Plugin;
|
|
142
|
+
declare function attaform(options?: AttaformVitePluginOptions): Plugin[];
|
|
131
143
|
|
|
132
144
|
export { attaform, attaformAutoImports, attaformAutoImportsMap };
|
|
133
145
|
export type { AttaformAutoImport, AttaformVitePluginOptions };
|
package/dist/vite.mjs
CHANGED
|
@@ -20,6 +20,20 @@ const attaformAutoImportsMap = attaformAutoImports.reduce((map, entry) => {
|
|
|
20
20
|
return map;
|
|
21
21
|
}, {});
|
|
22
22
|
|
|
23
|
+
const RESOLVE_CALL = '_resolveDirective("register")';
|
|
24
|
+
const LOCAL_ID = "__attaformVRegister";
|
|
25
|
+
const PADDED_LOCAL_ID = LOCAL_ID.padEnd(RESOLVE_CALL.length, " ");
|
|
26
|
+
const IMPORT_LINE = `
|
|
27
|
+
import { vRegister as ${LOCAL_ID} } from "attaform/directive";
|
|
28
|
+
`;
|
|
29
|
+
function rewriteDirectiveDelivery(code, id) {
|
|
30
|
+
if (id.includes("/node_modules/")) return null;
|
|
31
|
+
const file = id.split("?", 1)[0];
|
|
32
|
+
if (file === void 0 || !file.endsWith(".vue")) return null;
|
|
33
|
+
if (!code.includes(RESOLVE_CALL)) return null;
|
|
34
|
+
return code.split(RESOLVE_CALL).join(PADDED_LOCAL_ID) + IMPORT_LINE;
|
|
35
|
+
}
|
|
36
|
+
|
|
23
37
|
var __defProp = Object.defineProperty;
|
|
24
38
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
25
39
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -207,7 +221,7 @@ function attaform(options = {}) {
|
|
|
207
221
|
const resolveZodAlias = options.resolveZodAlias !== false;
|
|
208
222
|
let aliasTarget = null;
|
|
209
223
|
const warnState = { warned: false };
|
|
210
|
-
|
|
224
|
+
const main = {
|
|
211
225
|
name: "attaform",
|
|
212
226
|
enforce: "pre",
|
|
213
227
|
configResolved(resolved) {
|
|
@@ -353,7 +367,15 @@ function attaform(options = {}) {
|
|
|
353
367
|
return transformSsrAccessed(code, id);
|
|
354
368
|
}
|
|
355
369
|
};
|
|
370
|
+
const delivery = {
|
|
371
|
+
name: "attaform:directive-delivery",
|
|
372
|
+
enforce: "post",
|
|
373
|
+
transform(code, id) {
|
|
374
|
+
const rewritten = rewriteDirectiveDelivery(code, id);
|
|
375
|
+
return rewritten === null ? null : { code: rewritten, map: null };
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
return [main, delivery];
|
|
356
379
|
}
|
|
357
380
|
|
|
358
381
|
export { attaform, attaformAutoImports, attaformAutoImportsMap };
|
|
359
|
-
//# sourceMappingURL=vite.mjs.map
|
package/dist/webpack.d.mts
CHANGED
|
@@ -20,7 +20,12 @@ import { W as WebpackFamilyPlugin, a as WebpackFamilyPluginOptions } from './sha
|
|
|
20
20
|
* transforms that `attaform/vite` wires (load-bearing for SSR initial
|
|
21
21
|
* render) are `@vitejs/plugin-vue`-specific and do not transfer; a
|
|
22
22
|
* non-Vite consumer that needs them wires `attaform/transforms` into
|
|
23
|
-
* their Vue compiler separately.
|
|
23
|
+
* their Vue compiler separately. The `v-register` directive itself is
|
|
24
|
+
* also delivered by the Vite plugin's compile-time binding, so outside
|
|
25
|
+
* that pipeline register it once per app:
|
|
26
|
+
*
|
|
27
|
+
* import { installVRegister } from 'attaform/directive'
|
|
28
|
+
* installVRegister(app)
|
|
24
29
|
*
|
|
25
30
|
* Zero-dep: the plugin imports nothing from `webpack` (it taps the resolve
|
|
26
31
|
* hook the compiler injects at the consumer's build). Shares its body with
|
package/dist/webpack.mjs
CHANGED
package/dist/zod-v3.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, A as AbstractSchema,
|
|
3
|
-
export { b as ArrayItem, c as ArrayPath, d as AttaformDefaults, C as CoercionEntry, e as CoercionRegistry, f as CoercionResult, g as CustomDirectiveRegisterAssignerFn, h as DeepPartial, D as DefaultValuesInput, i as DefaultValuesResponse, j as DefaultValuesShape, k as DisplayCtx, l as DisplayMachine, m as DisplayState, E as ErrorInput, n as ErrorsProxyShape, p as FieldState, q as FieldStateMap, r as FieldStateMapEntry, s as FlatPath, t as FormErrorRecord, u as FormErrorsSurface, v as FormMeta, w as GetDisplayState, H as HandleSubmit, x as
|
|
2
|
+
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, A as AbstractSchema, as as AcceptableDefaults, a as UseFormReturnType, af as ValidateOnConfig, at as SchemaFactoryOptions, o as FieldMetaPayload } from './shared/attaform.Cgu-hdSb.mjs';
|
|
3
|
+
export { b as ArrayItem, c as ArrayPath, d as AttaformDefaults, C as CoercionEntry, e as CoercionRegistry, f as CoercionResult, g as CustomDirectiveRegisterAssignerFn, h as DeepPartial, D as DefaultValuesInput, i as DefaultValuesResponse, j as DefaultValuesShape, k as DisplayCtx, l as DisplayMachine, m as DisplayState, E as ErrorInput, n as ErrorsProxyShape, p as FieldState, q as FieldStateMap, r as FieldStateMapEntry, s as FlatPath, t as FormErrorRecord, u as FormErrorsSurface, v as FormMeta, w as GetDisplayState, H as HandleSubmit, x as HistoryPlugin, I as IsTuple, y as IsUnion, J as JoinSegments, z as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, B as NestedType, O as OnError, P as OnInvalidSubmitPolicy, Q as OnSubmit, R as ParseOptions, S as PartialFlatPath, T as Path, V as PathKey, W as PendingValidationStatus, X as Primitive, Y as ROOT_PATH, Z as ROOT_PATH_KEY, _ as ReactiveValidationStatus, $ as RegisterDirective, a0 as RegisterFlatPath, a1 as RegisterOptions, a2 as RegisterSelectModifier, a3 as RegisterTextModifier, a4 as RegisterTransform, a5 as RegisterValue, a6 as Segment, a7 as SetValueCallback, a8 as SetValuePayload, a9 as SettledValidationStatus, aa as SlimPrimitiveKind, ab as SlimRuntimeOf, ac as SubmitHandler, ad as Unset, ae as ValidateOn, ag as ValidationError, ah as ValidationResponse, ai as ValidationResponseWithoutValue, aj as ValueOfUnion, ak as WriteMeta, al as WriteShape, am as canonicalizePath, an as isPathPrefix, ao as isUnset, ap as parseDottedPath, aq as unset } from './shared/attaform.Cgu-hdSb.mjs';
|
|
4
4
|
import { S as SupportedRootSchema, U as UnwrapZodRoot, a as StorageShape } from './shared/attaform.DRUT703x.mjs';
|
|
5
|
-
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEFAULT_TIMINGS, f as DEVTOOLS_WINDOW_KEY, g as DisplayTimings, F as FormStatus, h as FormStatusSeed, G as GateMarker, I as InjectWizardInput, i as InvalidPathError, j as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, k as ReservedFormKeyError, S as SerializedAttaformState, l as SerializedFormData, m as StepSlot, n as SubmitErrorHandlerError, U as UseRegisterReturn, o as UseWizardReturnType, W as WizardAggregateError, p as WizardCtx, q as WizardCtxForm, r as WizardOnError, s as WizardOnSubmit, t as WizardOptions, u as WizardPersistFn, v as WizardRestoreFn, w as WizardRestoreState, x as WizardStatusesProxy, y as WizardSubmitContext, z as assignKey, B as createAttaform, E as createRegistry, H as defaultCoercionRules, J as defaultDisplayState, K as defineCoercion, M as escapeForInlineScript, N as gate, P as getRegistryFromApp, Q as hydrateAttaformState, T as injectForm, V as injectWizard, X as isRegisterValue, Y as kAttaformRegistry, Z as lazy, _ as makeDefaultDisplayState, $ as renderAttaformState, a0 as useRegister, a1 as useRegistry, a2 as useWizard
|
|
5
|
+
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEFAULT_TIMINGS, f as DEVTOOLS_WINDOW_KEY, g as DisplayTimings, F as FormStatus, h as FormStatusSeed, G as GateMarker, I as InjectWizardInput, i as InvalidPathError, j as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, k as ReservedFormKeyError, S as SerializedAttaformState, l as SerializedFormData, m as StepSlot, n as SubmitErrorHandlerError, U as UseRegisterReturn, o as UseWizardReturnType, W as WizardAggregateError, p as WizardCtx, q as WizardCtxForm, r as WizardOnError, s as WizardOnSubmit, t as WizardOptions, u as WizardPersistFn, v as WizardRestoreFn, w as WizardRestoreState, x as WizardStatusesProxy, y as WizardSubmitContext, z as assignKey, B as createAttaform, E as createRegistry, H as defaultCoercionRules, J as defaultDisplayState, K as defineCoercion, M as escapeForInlineScript, N as gate, P as getRegistryFromApp, Q as hydrateAttaformState, T as injectForm, V as injectWizard, X as isRegisterValue, Y as kAttaformRegistry, Z as lazy, _ as makeDefaultDisplayState, $ as renderAttaformState, a0 as useRegister, a1 as useRegistry, a2 as useWizard } from './shared/attaform.D5V4tZWq.mjs';
|
|
6
|
+
export { v as vRegister } from './shared/attaform.JfSWdEcb.mjs';
|
|
6
7
|
import 'vue';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -190,9 +191,13 @@ declare function isZodSchemaType<K extends keyof ZodTypeMap>(schema: unknown, ex
|
|
|
190
191
|
|
|
191
192
|
/**
|
|
192
193
|
* The shared registry every Attaform-aware Zod 3 schema can register
|
|
193
|
-
* field metadata against. Backed by the cross-adapter
|
|
194
|
-
*
|
|
195
|
-
*
|
|
194
|
+
* field metadata against. Backed by the cross-adapter store — a
|
|
195
|
+
* payload registered here is visible to the v4 adapter and the
|
|
196
|
+
* unified `attaform/zod` entry, and vice versa. Every `add` also
|
|
197
|
+
* installs the path-walking resolver into the shared store's builder
|
|
198
|
+
* slot, so the walk's bytes ride this module's import instead of the
|
|
199
|
+
* adapter — a consumer that never registers metadata never ships the
|
|
200
|
+
* walk.
|
|
196
201
|
*/
|
|
197
202
|
type FieldMetaRegistryV3 = {
|
|
198
203
|
/**
|
package/dist/zod-v3.mjs
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
export { A as
|
|
1
|
+
export { i as isZodSchemaType, u as useForm, z as zodAdapter } from './shared/attaform.CJP3RkGa.mjs';
|
|
2
|
+
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform.C09fpdLS.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.wfY8XFvm.mjs';
|
|
4
|
+
export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform.B8k8JrmK.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.Dq4vWxuG.mjs';
|
|
6
|
+
export { a as assignKey, v as vRegister } from './shared/attaform.uLbun31C.mjs';
|
|
4
7
|
export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
|
|
5
|
-
|
|
8
|
+
|
|
9
|
+
const fieldMeta = installingFieldMetaStore;
|
|
10
|
+
function withMeta(schema, payload) {
|
|
11
|
+
const existing = getFieldMetaForSchema(schema) ?? {};
|
|
12
|
+
const Ctor = schema.constructor;
|
|
13
|
+
const cloned = new Ctor(schema._def);
|
|
14
|
+
installingFieldMetaStore.add(cloned, { ...existing, ...payload });
|
|
15
|
+
return cloned;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { fieldMeta, withMeta };
|
package/dist/zod-v4.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { S as SupportedRootSchema } from './shared/attaform.
|
|
2
|
-
export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.
|
|
3
|
-
import { c as AttaformError } from './shared/attaform.
|
|
4
|
-
export { a as AnyForm, b as AttaformDevtoolsBridge, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEFAULT_TIMINGS, f as DEVTOOLS_WINDOW_KEY, g as DisplayTimings, F as FormStatus, h as FormStatusSeed, G as GateMarker, I as InjectWizardInput, i as InvalidPathError, j as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, k as ReservedFormKeyError, S as SerializedAttaformState, l as SerializedFormData, m as StepSlot, n as SubmitErrorHandlerError, U as UseRegisterReturn, o as UseWizardReturnType, W as WizardAggregateError, p as WizardCtx, q as WizardCtxForm, r as WizardOnError, s as WizardOnSubmit, t as WizardOptions, u as WizardPersistFn, v as WizardRestoreFn, w as WizardRestoreState, x as WizardStatusesProxy, y as WizardSubmitContext, z as assignKey, B as createAttaform, E as createRegistry, H as defaultCoercionRules, J as defaultDisplayState, K as defineCoercion, M as escapeForInlineScript, N as gate, P as getRegistryFromApp, Q as hydrateAttaformState, T as injectForm, V as injectWizard, X as isRegisterValue, Y as kAttaformRegistry, Z as lazy, _ as makeDefaultDisplayState, $ as renderAttaformState, a0 as useRegister, a1 as useRegistry, a2 as useWizard
|
|
5
|
-
import { F as FormKey,
|
|
6
|
-
export { b as ArrayItem, c as ArrayPath, d as AttaformDefaults, C as CoercionEntry, e as CoercionRegistry, f as CoercionResult, g as CustomDirectiveRegisterAssignerFn, h as DeepPartial, D as DefaultValuesInput, i as DefaultValuesResponse, j as DefaultValuesShape, k as DisplayCtx, l as DisplayMachine, m as DisplayState, E as ErrorInput, n as ErrorsProxyShape, p as FieldState, q as FieldStateMap, r as FieldStateMapEntry, s as FlatPath, t as FormErrorRecord, u as FormErrorsSurface, v as FormMeta, G as GenericForm, w as GetDisplayState, H as HandleSubmit, x as
|
|
1
|
+
import { S as SupportedRootSchema } from './shared/attaform.B4VkS43-.mjs';
|
|
2
|
+
export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.B4VkS43-.mjs';
|
|
3
|
+
import { c as AttaformError } from './shared/attaform.D5V4tZWq.mjs';
|
|
4
|
+
export { a as AnyForm, b as AttaformDevtoolsBridge, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEFAULT_TIMINGS, f as DEVTOOLS_WINDOW_KEY, g as DisplayTimings, F as FormStatus, h as FormStatusSeed, G as GateMarker, I as InjectWizardInput, i as InvalidPathError, j as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, k as ReservedFormKeyError, S as SerializedAttaformState, l as SerializedFormData, m as StepSlot, n as SubmitErrorHandlerError, U as UseRegisterReturn, o as UseWizardReturnType, W as WizardAggregateError, p as WizardCtx, q as WizardCtxForm, r as WizardOnError, s as WizardOnSubmit, t as WizardOptions, u as WizardPersistFn, v as WizardRestoreFn, w as WizardRestoreState, x as WizardStatusesProxy, y as WizardSubmitContext, z as assignKey, B as createAttaform, E as createRegistry, H as defaultCoercionRules, J as defaultDisplayState, K as defineCoercion, M as escapeForInlineScript, N as gate, P as getRegistryFromApp, Q as hydrateAttaformState, T as injectForm, V as injectWizard, X as isRegisterValue, Y as kAttaformRegistry, Z as lazy, _ as makeDefaultDisplayState, $ as renderAttaformState, a0 as useRegister, a1 as useRegistry, a2 as useWizard } from './shared/attaform.D5V4tZWq.mjs';
|
|
5
|
+
import { F as FormKey, at as SchemaFactoryOptions, A as AbstractSchema, o as FieldMetaPayload } from './shared/attaform.Cgu-hdSb.mjs';
|
|
6
|
+
export { b as ArrayItem, c as ArrayPath, d as AttaformDefaults, C as CoercionEntry, e as CoercionRegistry, f as CoercionResult, g as CustomDirectiveRegisterAssignerFn, h as DeepPartial, D as DefaultValuesInput, i as DefaultValuesResponse, j as DefaultValuesShape, k as DisplayCtx, l as DisplayMachine, m as DisplayState, E as ErrorInput, n as ErrorsProxyShape, p as FieldState, q as FieldStateMap, r as FieldStateMapEntry, s as FlatPath, t as FormErrorRecord, u as FormErrorsSurface, v as FormMeta, G as GenericForm, w as GetDisplayState, H as HandleSubmit, x as HistoryPlugin, I as IsTuple, y as IsUnion, J as JoinSegments, z as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, B as NestedType, O as OnError, P as OnInvalidSubmitPolicy, Q as OnSubmit, R as ParseOptions, S as PartialFlatPath, T as Path, V as PathKey, W as PendingValidationStatus, X as Primitive, Y as ROOT_PATH, Z as ROOT_PATH_KEY, _ as ReactiveValidationStatus, $ as RegisterDirective, a0 as RegisterFlatPath, a1 as RegisterOptions, a2 as RegisterSelectModifier, a3 as RegisterTextModifier, a4 as RegisterTransform, a5 as RegisterValue, a6 as Segment, a7 as SetValueCallback, a8 as SetValuePayload, a9 as SettledValidationStatus, aa as SlimPrimitiveKind, ab as SlimRuntimeOf, ac as SubmitHandler, ad as Unset, U as UseFormConfiguration, a as UseFormReturnType, ae as ValidateOn, af as ValidateOnConfig, ag as ValidationError, ah as ValidationResponse, ai as ValidationResponseWithoutValue, aj as ValueOfUnion, ak as WriteMeta, al as WriteShape, am as canonicalizePath, an as isPathPrefix, ao as isUnset, ap as parseDottedPath, aq as unset } from './shared/attaform.Cgu-hdSb.mjs';
|
|
7
|
+
export { v as vRegister } from './shared/attaform.JfSWdEcb.mjs';
|
|
7
8
|
import { z } from 'zod';
|
|
8
9
|
import 'vue';
|
|
9
10
|
|
|
@@ -148,6 +149,11 @@ type ZodFieldMetaRegistry = ReturnType<typeof z.registry<FieldMetaPayload>>;
|
|
|
148
149
|
* `schema.register(fieldMeta, payload)` chains type-check at the call
|
|
149
150
|
* site — Zod 4's `.register()` only calls `.add(this, payload)`
|
|
150
151
|
* structurally, so the cast is sound at runtime.
|
|
152
|
+
*
|
|
153
|
+
* Backed by `installingFieldMetaStore`: every `add` also installs the
|
|
154
|
+
* path-walking resolver into the shared store's builder slot, so the
|
|
155
|
+
* walk's bytes ride this module's import instead of the adapter. A
|
|
156
|
+
* consumer that never registers metadata never ships the walk.
|
|
151
157
|
*/
|
|
152
158
|
declare const fieldMeta: ZodFieldMetaRegistry;
|
|
153
159
|
/**
|
package/dist/zod-v4.mjs
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
export { U as UnsupportedSchemaError, a as assertZodVersion,
|
|
2
|
-
|
|
3
|
-
export { A as
|
|
1
|
+
export { U as UnsupportedSchemaError, a as assertZodVersion, k as kindOf, u as useForm, z as zodAdapter } from './shared/attaform.NLmerepI.mjs';
|
|
2
|
+
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform.C09fpdLS.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.wfY8XFvm.mjs';
|
|
4
|
+
export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform.B8k8JrmK.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.Dq4vWxuG.mjs';
|
|
6
|
+
export { a as assignKey, v as vRegister } from './shared/attaform.uLbun31C.mjs';
|
|
4
7
|
export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
|
|
5
|
-
|
|
8
|
+
|
|
9
|
+
const fieldMeta = installingFieldMetaStore;
|
|
10
|
+
function withMeta(schema, payload) {
|
|
11
|
+
const existing = getFieldMetaForSchema(schema) ?? {};
|
|
12
|
+
const cloned = schema.clone();
|
|
13
|
+
installingFieldMetaStore.add(cloned, { ...existing, ...payload });
|
|
14
|
+
return cloned;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { fieldMeta, withMeta };
|
package/dist/zod.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEFAULT_TIMINGS, f as DEVTOOLS_WINDOW_KEY, g as DisplayTimings, F as FormStatus, h as FormStatusSeed, G as GateMarker, I as InjectWizardInput, i as InvalidPathError, j as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, k as ReservedFormKeyError, S as SerializedAttaformState, l as SerializedFormData, m as StepSlot, n as SubmitErrorHandlerError, U as UseRegisterReturn, o as UseWizardReturnType, W as WizardAggregateError, p as WizardCtx, q as WizardCtxForm, r as WizardOnError, s as WizardOnSubmit, t as WizardOptions, u as WizardPersistFn, v as WizardRestoreFn, w as WizardRestoreState, x as WizardStatusesProxy, y as WizardSubmitContext, z as assignKey, B as createAttaform, E as createRegistry, H as defaultCoercionRules, J as defaultDisplayState, K as defineCoercion, M as escapeForInlineScript, N as gate, P as getRegistryFromApp, Q as hydrateAttaformState, T as injectForm, V as injectWizard, X as isRegisterValue, Y as kAttaformRegistry, Z as lazy, _ as makeDefaultDisplayState, $ as renderAttaformState, a0 as useRegister, a1 as useRegistry, a2 as useWizard
|
|
2
|
-
export { b as ArrayItem, c as ArrayPath, d as AttaformDefaults, C as CoercionEntry, e as CoercionRegistry, f as CoercionResult, g as CustomDirectiveRegisterAssignerFn, h as DeepPartial, D as DefaultValuesInput, i as DefaultValuesResponse, j as DefaultValuesShape, k as DisplayCtx, l as DisplayMachine, m as DisplayState, E as ErrorInput, n as ErrorsProxyShape, o as FieldMetaPayload, p as FieldState, q as FieldStateMap, r as FieldStateMapEntry, s as FlatPath, t as FormErrorRecord, u as FormErrorsSurface, F as FormKey, v as FormMeta, G as GenericForm, w as GetDisplayState, H as HandleSubmit, x as
|
|
1
|
+
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEFAULT_TIMINGS, f as DEVTOOLS_WINDOW_KEY, g as DisplayTimings, F as FormStatus, h as FormStatusSeed, G as GateMarker, I as InjectWizardInput, i as InvalidPathError, j as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, k as ReservedFormKeyError, S as SerializedAttaformState, l as SerializedFormData, m as StepSlot, n as SubmitErrorHandlerError, U as UseRegisterReturn, o as UseWizardReturnType, W as WizardAggregateError, p as WizardCtx, q as WizardCtxForm, r as WizardOnError, s as WizardOnSubmit, t as WizardOptions, u as WizardPersistFn, v as WizardRestoreFn, w as WizardRestoreState, x as WizardStatusesProxy, y as WizardSubmitContext, z as assignKey, B as createAttaform, E as createRegistry, H as defaultCoercionRules, J as defaultDisplayState, K as defineCoercion, M as escapeForInlineScript, N as gate, P as getRegistryFromApp, Q as hydrateAttaformState, T as injectForm, V as injectWizard, X as isRegisterValue, Y as kAttaformRegistry, Z as lazy, _ as makeDefaultDisplayState, $ as renderAttaformState, a0 as useRegister, a1 as useRegistry, a2 as useWizard } from './shared/attaform.D5V4tZWq.mjs';
|
|
2
|
+
export { b as ArrayItem, c as ArrayPath, d as AttaformDefaults, C as CoercionEntry, e as CoercionRegistry, f as CoercionResult, g as CustomDirectiveRegisterAssignerFn, h as DeepPartial, D as DefaultValuesInput, i as DefaultValuesResponse, j as DefaultValuesShape, k as DisplayCtx, l as DisplayMachine, m as DisplayState, E as ErrorInput, n as ErrorsProxyShape, o as FieldMetaPayload, p as FieldState, q as FieldStateMap, r as FieldStateMapEntry, s as FlatPath, t as FormErrorRecord, u as FormErrorsSurface, F as FormKey, v as FormMeta, G as GenericForm, w as GetDisplayState, H as HandleSubmit, x as HistoryPlugin, I as IsTuple, y as IsUnion, J as JoinSegments, z as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, B as NestedType, O as OnError, P as OnInvalidSubmitPolicy, Q as OnSubmit, R as ParseOptions, S as PartialFlatPath, T as Path, V as PathKey, W as PendingValidationStatus, X as Primitive, Y as ROOT_PATH, Z as ROOT_PATH_KEY, _ as ReactiveValidationStatus, $ as RegisterDirective, a0 as RegisterFlatPath, a1 as RegisterOptions, a2 as RegisterSelectModifier, a3 as RegisterTextModifier, a4 as RegisterTransform, a5 as RegisterValue, a6 as Segment, a7 as SetValueCallback, a8 as SetValuePayload, a9 as SettledValidationStatus, aa as SlimPrimitiveKind, ab as SlimRuntimeOf, ac as SubmitHandler, ad as Unset, U as UseFormConfiguration, a as UseFormReturnType, ae as ValidateOn, af as ValidateOnConfig, ag as ValidationError, ah as ValidationResponse, ai as ValidationResponseWithoutValue, aj as ValueOfUnion, ak as WriteMeta, al as WriteShape, am as canonicalizePath, an as isPathPrefix, ao as isUnset, ap as parseDottedPath, aq as unset } from './shared/attaform.Cgu-hdSb.mjs';
|
|
3
|
+
export { v as vRegister } from './shared/attaform.JfSWdEcb.mjs';
|
|
3
4
|
export { UseFormConfig, UseFormConfigV3, UseFormConfigV4, UseFormReturn, UseFormReturnV3, UseFormReturnV4, fieldMeta, useForm, withMeta } from './index.mjs';
|
|
4
|
-
export { P as PathInput, a as PathOutput } from './shared/attaform.
|
|
5
|
+
export { P as PathInput, a as PathOutput } from './shared/attaform.B4VkS43-.mjs';
|
|
5
6
|
import 'vue';
|
|
6
7
|
import './shared/attaform.DRUT703x.mjs';
|
|
7
8
|
import 'zod';
|
package/dist/zod.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { A as AttaformError,
|
|
2
|
-
export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform.
|
|
3
|
-
export {
|
|
1
|
+
export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform.wfY8XFvm.mjs';
|
|
2
|
+
export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform.B8k8JrmK.mjs';
|
|
3
|
+
export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform.Dq4vWxuG.mjs';
|
|
4
|
+
export { a as assignKey, v as vRegister } from './shared/attaform.uLbun31C.mjs';
|
|
5
|
+
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.D6DCnnQu.mjs';
|
|
4
6
|
export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
|
|
5
|
-
//# sourceMappingURL=zod.mjs.map
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "attaform",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"main": "./dist/index.mjs",
|
|
3
|
+
"version": "0.28.0",
|
|
5
4
|
"types": "./dist/index.d.mts",
|
|
6
5
|
"files": [
|
|
7
6
|
"dist",
|
|
7
|
+
"!dist/**/*.map",
|
|
8
|
+
"!dist/**/*.cjs",
|
|
9
|
+
"!dist/**/*.d.cts",
|
|
10
|
+
"!dist/**/*.d.ts",
|
|
8
11
|
"skills",
|
|
9
12
|
"bin"
|
|
10
13
|
],
|
|
@@ -34,12 +37,12 @@
|
|
|
34
37
|
"exports": {
|
|
35
38
|
".": {
|
|
36
39
|
"types": "./dist/index.d.mts",
|
|
40
|
+
"development": "./dist/dev/index.mjs",
|
|
37
41
|
"import": "./dist/index.mjs"
|
|
38
42
|
},
|
|
39
43
|
"./nuxt": {
|
|
40
44
|
"types": "./dist/nuxt.d.mts",
|
|
41
|
-
"import": "./dist/nuxt.mjs"
|
|
42
|
-
"require": "./dist/nuxt.cjs"
|
|
45
|
+
"import": "./dist/nuxt.mjs"
|
|
43
46
|
},
|
|
44
47
|
"./vite": {
|
|
45
48
|
"types": "./dist/vite.d.mts",
|
|
@@ -70,22 +73,33 @@
|
|
|
70
73
|
},
|
|
71
74
|
"./zod": {
|
|
72
75
|
"types": "./dist/zod.d.mts",
|
|
76
|
+
"development": "./dist/dev/zod.mjs",
|
|
73
77
|
"import": "./dist/zod.mjs"
|
|
74
78
|
},
|
|
75
79
|
"./zod-v3": {
|
|
76
80
|
"types": "./dist/zod-v3.d.mts",
|
|
81
|
+
"development": "./dist/dev/zod-v3.mjs",
|
|
77
82
|
"import": "./dist/zod-v3.mjs"
|
|
78
83
|
},
|
|
79
84
|
"./zod-v4": {
|
|
80
85
|
"types": "./dist/zod-v4.d.mts",
|
|
86
|
+
"development": "./dist/dev/zod-v4.mjs",
|
|
81
87
|
"import": "./dist/zod-v4.mjs"
|
|
82
88
|
},
|
|
83
89
|
"./abstract": {
|
|
84
90
|
"types": "./dist/abstract.d.mts",
|
|
91
|
+
"development": "./dist/dev/abstract.mjs",
|
|
85
92
|
"import": "./dist/abstract.mjs"
|
|
86
93
|
},
|
|
87
|
-
"./
|
|
88
|
-
"types": "./dist/
|
|
94
|
+
"./directive": {
|
|
95
|
+
"types": "./dist/directive.d.mts",
|
|
96
|
+
"development": "./dist/dev/directive.mjs",
|
|
97
|
+
"import": "./dist/directive.mjs"
|
|
98
|
+
},
|
|
99
|
+
"./history": {
|
|
100
|
+
"types": "./dist/history.d.mts",
|
|
101
|
+
"development": "./dist/dev/history.mjs",
|
|
102
|
+
"import": "./dist/history.mjs"
|
|
89
103
|
},
|
|
90
104
|
"./package.json": "./package.json"
|
|
91
105
|
},
|
|
@@ -145,7 +159,7 @@
|
|
|
145
159
|
"husky": "^9.1.7",
|
|
146
160
|
"jsdom": "^29.0.2",
|
|
147
161
|
"lint-staged": "^17.0.4",
|
|
148
|
-
"nuxt": "^4.
|
|
162
|
+
"nuxt": "^4.5.2",
|
|
149
163
|
"prettier": "^3.8.3",
|
|
150
164
|
"primevue": "^4.5.5",
|
|
151
165
|
"reka-ui": "^2.9.10",
|
|
@@ -198,7 +212,7 @@
|
|
|
198
212
|
"lint:fix": "eslint --cache --concurrency=auto --fix . && pnpm format",
|
|
199
213
|
"format": "prettier --write '**/*.{ts,js,vue,css,scss,md,json,yml,yaml}'",
|
|
200
214
|
"format:check": "prettier --check '**/*.{ts,js,vue,css,scss,md,json,yml,yaml}'",
|
|
201
|
-
"check": "pnpm lint && pnpm typecheck && pnpm check:site && pnpm test && pnpm test:nuxt-ui && pnpm check:size && pnpm check:eager && pnpm check:bench && pnpm check:coverage",
|
|
215
|
+
"check": "pnpm lint && pnpm typecheck && pnpm check:site && pnpm test && pnpm test:nuxt-ui && pnpm check:size && pnpm check:tarball && pnpm check:eager && pnpm check:bench && pnpm check:coverage",
|
|
202
216
|
"fix": "pnpm lint:fix",
|
|
203
217
|
"typecheck": "tsc --noEmit",
|
|
204
218
|
"prepack:watch": "chokidar 'src/**/*' -c 'pnpm prepack' --initial",
|
|
@@ -209,6 +223,7 @@
|
|
|
209
223
|
"test:watch": "node scripts/run-with-webstorage-flag.mjs vitest watch",
|
|
210
224
|
"bench": "node scripts/run-with-webstorage-flag.mjs vitest bench --run",
|
|
211
225
|
"check:size": "pnpm prepack && size-limit",
|
|
226
|
+
"check:tarball": "node scripts/check-tarball-size.mjs",
|
|
212
227
|
"check:eager": "node scripts/check-eager-size.mjs",
|
|
213
228
|
"check:coverage": "node scripts/run-with-webstorage-flag.mjs vitest run --coverage",
|
|
214
229
|
"check:bench": "node scripts/check-bench.mjs",
|
package/skills/attaform/SKILL.md
CHANGED
|
@@ -30,7 +30,8 @@ import {
|
|
|
30
30
|
- **Do not import `useForm` from `attaform/abstract`.** That entry is the bring-your-own-adapter escape hatch: it exports `useAbstractForm`, which needs a schema adapter wired by hand. A Zod project wants `useForm` from `attaform`. This mismatch is the single most common first-try mistake.
|
|
31
31
|
- Types come from the same barrel: `import type { AnyForm, WizardCtx, Json, ValidationError } from 'attaform'`.
|
|
32
32
|
- `attaform/zod` is the same surface named explicitly; `attaform/zod-v3` and `attaform/zod-v4` pin a Zod major. Any of these works; default to `attaform`.
|
|
33
|
-
- In **Nuxt** with the module installed (`attaform/nuxt`), this surface auto-imports and the `v-register` directive is
|
|
33
|
+
- In **Nuxt** with the module installed (`attaform/nuxt`), this surface auto-imports and the `v-register` directive is bound into each compiled template, so a component needs no import lines at all. In **plain Vite**, add the Attaform plugin from `attaform/vite` (it binds `v-register` the same way) plus the auto-import preset it exports. Without either build plugin, register the directive once per app: `import { installVRegister } from 'attaform/directive'` then `installVRegister(app)`.
|
|
34
|
+
- Undo/redo ships from its own entry: `import { historyPlugin } from 'attaform/history'`, then `useForm({ schema, history: historyPlugin({ max: 200 }) })` unlocks a live `form.history` namespace (`undo` / `redo` / `clear` / `canUndo` / `canRedo` / `size`). Without the plugin the namespace is inert stubs.
|
|
34
35
|
|
|
35
36
|
## Build a form
|
|
36
37
|
|