attaform 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -11
- package/bin/attaform.mjs +78 -0
- package/dist/abstract.cjs +47 -0
- package/dist/abstract.cjs.map +1 -0
- package/dist/abstract.d.cts +42 -0
- package/dist/abstract.d.mts +42 -0
- package/dist/abstract.d.ts +42 -0
- package/dist/abstract.mjs +4 -0
- package/dist/abstract.mjs.map +1 -0
- package/dist/chunks/devtools.cjs +2 -2
- package/dist/chunks/devtools.cjs.map +1 -1
- package/dist/chunks/devtools.mjs +1 -1
- package/dist/chunks/fingerprint2.cjs +1 -1
- package/dist/chunks/fingerprint2.mjs +1 -1
- package/dist/esbuild.cjs +2 -2
- package/dist/esbuild.cjs.map +1 -1
- package/dist/esbuild.d.cts +3 -3
- package/dist/esbuild.d.mts +3 -3
- package/dist/esbuild.d.ts +3 -3
- package/dist/esbuild.mjs +2 -2
- package/dist/esbuild.mjs.map +1 -1
- package/dist/index.cjs +41 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +194 -282
- package/dist/index.d.mts +194 -282
- package/dist/index.d.ts +194 -282
- package/dist/index.mjs +4 -25
- package/dist/index.mjs.map +1 -1
- package/dist/nuxt.cjs +3 -1
- package/dist/nuxt.cjs.map +1 -1
- package/dist/nuxt.d.cts +17 -4
- package/dist/nuxt.d.mts +17 -4
- package/dist/nuxt.d.ts +17 -4
- package/dist/nuxt.mjs +4 -2
- package/dist/nuxt.mjs.map +1 -1
- package/dist/rollup.cjs +2 -2
- package/dist/rollup.cjs.map +1 -1
- package/dist/rollup.d.cts +3 -3
- package/dist/rollup.d.mts +3 -3
- package/dist/rollup.d.ts +3 -3
- package/dist/rollup.mjs +2 -2
- package/dist/rollup.mjs.map +1 -1
- package/dist/rspack.cjs +1 -1
- package/dist/rspack.d.cts +1 -1
- package/dist/rspack.d.mts +1 -1
- package/dist/rspack.d.ts +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/runtime/plugins/attaform.cjs +4 -5
- package/dist/runtime/plugins/attaform.cjs.map +1 -1
- package/dist/runtime/plugins/attaform.mjs +1 -2
- package/dist/runtime/plugins/attaform.mjs.map +1 -1
- package/dist/shared/{attaform.BRzKBj2g.cjs → attaform.8tFZu1Ub.cjs} +2 -2
- package/dist/shared/{attaform.BRzKBj2g.cjs.map → attaform.8tFZu1Ub.cjs.map} +1 -1
- package/dist/shared/{attaform.k9V0py0s.mjs → attaform.BERt5YMU.mjs} +2 -2
- package/dist/shared/{attaform.k9V0py0s.mjs.map → attaform.BERt5YMU.mjs.map} +1 -1
- package/dist/shared/{attaform.CN4ZEGo6.mjs → attaform.BceJrhQ7.mjs} +5 -5
- package/dist/shared/{attaform.CN4ZEGo6.mjs.map → attaform.BceJrhQ7.mjs.map} +1 -1
- package/dist/shared/{attaform.i_LA3X9o.d.cts → attaform.C3WnCDXz.d.cts} +81 -24
- package/dist/shared/{attaform.i_LA3X9o.d.ts → attaform.C3WnCDXz.d.mts} +81 -24
- package/dist/shared/{attaform.i_LA3X9o.d.mts → attaform.C3WnCDXz.d.ts} +81 -24
- package/dist/shared/{attaform.DuzQYscR.d.ts → attaform.C9fPTxjB.d.cts} +5 -5
- package/dist/shared/{attaform.DuzQYscR.d.cts → attaform.C9fPTxjB.d.mts} +5 -5
- package/dist/shared/{attaform.DuzQYscR.d.mts → attaform.C9fPTxjB.d.ts} +5 -5
- package/dist/shared/{attaform.B3cgZE3c.d.ts → attaform.CC_y1_Ej.d.ts} +33 -33
- package/dist/shared/{attaform.DS_zBcdr.d.ts → attaform.CEXUlUkc.d.ts} +1588 -1190
- package/dist/shared/{attaform.Xe8dATED.cjs → attaform.C__F01CE.cjs} +15 -15
- package/dist/shared/{attaform.Xe8dATED.cjs.map → attaform.C__F01CE.cjs.map} +1 -1
- package/dist/shared/{attaform.3heDHayA.cjs → attaform.Co5LNRnv.cjs} +186 -129
- package/dist/shared/attaform.Co5LNRnv.cjs.map +1 -0
- package/dist/shared/{attaform.BJt4ZCkM.d.mts → attaform.CpXHK60W.d.cts} +33 -33
- package/dist/shared/{attaform.DmKLa4tL.d.cts → attaform.CvVYOvZF.d.mts} +33 -33
- package/dist/shared/{attaform.DK3xUBkj.mjs → attaform.CyQxTOdX.mjs} +162 -79
- package/dist/shared/attaform.CyQxTOdX.mjs.map +1 -0
- package/dist/shared/{attaform.B5GFS3Su.d.cts → attaform.D99pd7JG.d.cts} +1588 -1190
- package/dist/shared/{attaform.CwXXbZIQ.mjs → attaform.DDAmSFnl.mjs} +4 -4
- package/dist/shared/{attaform.CwXXbZIQ.mjs.map → attaform.DDAmSFnl.mjs.map} +1 -1
- package/dist/shared/{attaform.BkUzunyB.cjs → attaform.DQT7_-FO.cjs} +371 -287
- package/dist/shared/attaform.DQT7_-FO.cjs.map +1 -0
- package/dist/shared/{attaform.CqwcTExO.mjs → attaform.Da8EdI2t.mjs} +182 -129
- package/dist/shared/attaform.Da8EdI2t.mjs.map +1 -0
- package/dist/shared/{attaform.sks1MFVO.cjs → attaform.DhVgG2jh.cjs} +16 -16
- package/dist/shared/{attaform.sks1MFVO.cjs.map → attaform.DhVgG2jh.cjs.map} +1 -1
- package/dist/shared/{attaform.sHkHv_98.mjs → attaform.DhnPb6nK.mjs} +6 -3
- package/dist/shared/attaform.DhnPb6nK.mjs.map +1 -0
- package/dist/shared/attaform.DkD0DR7R.mjs +42 -0
- package/dist/shared/attaform.DkD0DR7R.mjs.map +1 -0
- package/dist/shared/{attaform.DMNnfQq_.mjs → attaform.DlSu08F5.mjs} +4 -4
- package/dist/shared/{attaform.DMNnfQq_.mjs.map → attaform.DlSu08F5.mjs.map} +1 -1
- package/dist/shared/{attaform.LEWUFqUw.cjs → attaform.DoQm_Vkd.cjs} +7 -3
- package/dist/shared/attaform.DoQm_Vkd.cjs.map +1 -0
- package/dist/shared/{attaform.B5YcWrKi.cjs → attaform.Drsi43GG.cjs} +19 -19
- package/dist/shared/{attaform.B5YcWrKi.cjs.map → attaform.Drsi43GG.cjs.map} +1 -1
- package/dist/shared/attaform.K6Thc6By.cjs +46 -0
- package/dist/shared/attaform.K6Thc6By.cjs.map +1 -0
- package/dist/shared/{attaform.Vp2-CWZB.mjs → attaform.KvlEedlF.mjs} +3 -3
- package/dist/shared/{attaform.Vp2-CWZB.mjs.map → attaform.KvlEedlF.mjs.map} +1 -1
- package/dist/shared/{attaform.BRGIpZo4.cjs → attaform.RaTzp1WF.cjs} +3 -3
- package/dist/shared/attaform.RaTzp1WF.cjs.map +1 -0
- package/dist/shared/{attaform.8vmdOURQ.d.mts → attaform.kBkYlKP_.d.mts} +1588 -1190
- package/dist/shared/{attaform.C3Doa9Pt.mjs → attaform.v0fQtWyA.mjs} +3 -3
- package/dist/shared/attaform.v0fQtWyA.mjs.map +1 -0
- package/dist/shared/{attaform.ZXZ6dH72.cjs → attaform.yUrz7C2z.cjs} +3 -3
- package/dist/shared/{attaform.ZXZ6dH72.cjs.map → attaform.yUrz7C2z.cjs.map} +1 -1
- package/dist/transforms.cjs +1 -1
- package/dist/transforms.mjs +1 -1
- package/dist/vite.cjs +21 -3
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.cts +70 -17
- package/dist/vite.d.mts +70 -17
- package/dist/vite.d.ts +70 -17
- package/dist/vite.mjs +20 -4
- package/dist/vite.mjs.map +1 -1
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.d.cts +1 -1
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.mjs +1 -1
- package/dist/zod-v3.cjs +41 -10
- package/dist/zod-v3.cjs.map +1 -1
- package/dist/zod-v3.d.cts +5 -5
- package/dist/zod-v3.d.mts +5 -5
- package/dist/zod-v3.d.ts +5 -5
- package/dist/zod-v3.mjs +4 -2
- package/dist/zod-v3.mjs.map +1 -1
- package/dist/zod-v4.cjs +41 -10
- package/dist/zod-v4.cjs.map +1 -1
- package/dist/zod-v4.d.cts +7 -7
- package/dist/zod-v4.d.mts +7 -7
- package/dist/zod-v4.d.ts +7 -7
- package/dist/zod-v4.mjs +4 -2
- package/dist/zod-v4.mjs.map +1 -1
- package/dist/zod.cjs +44 -49
- package/dist/zod.cjs.map +1 -1
- package/dist/zod.d.cts +6 -248
- package/dist/zod.d.mts +6 -248
- package/dist/zod.d.ts +6 -248
- package/dist/zod.mjs +4 -42
- package/dist/zod.mjs.map +1 -1
- package/package.json +12 -2
- package/skills/attaform/SKILL.md +128 -0
- package/skills/attaform/references/custom-components.md +72 -0
- package/skills/attaform/references/errors.md +62 -0
- package/skills/attaform/references/ssr.md +26 -0
- package/skills/attaform/references/validation.md +40 -0
- package/skills/attaform/references/wizards.md +104 -0
- package/dist/shared/attaform.3heDHayA.cjs.map +0 -1
- package/dist/shared/attaform.BRGIpZo4.cjs.map +0 -1
- package/dist/shared/attaform.BkUzunyB.cjs.map +0 -1
- package/dist/shared/attaform.C3Doa9Pt.mjs.map +0 -1
- package/dist/shared/attaform.CO0e7YVY.d.cts +0 -94
- package/dist/shared/attaform.CO0e7YVY.d.mts +0 -94
- package/dist/shared/attaform.CO0e7YVY.d.ts +0 -94
- package/dist/shared/attaform.CqwcTExO.mjs.map +0 -1
- package/dist/shared/attaform.DK3xUBkj.mjs.map +0 -1
- package/dist/shared/attaform.LEWUFqUw.cjs.map +0 -1
- package/dist/shared/attaform.OLtKd9gM.mjs +0 -35
- package/dist/shared/attaform.OLtKd9gM.mjs.map +0 -1
- package/dist/shared/attaform.sHkHv_98.mjs.map +0 -1
- package/dist/shared/attaform.xBDo0Ko0.cjs +0 -39
- package/dist/shared/attaform.xBDo0Ko0.cjs.map +0 -1
- package/dist/shared/{attaform.DdjDqTah.d.mts → attaform.DRUT703x.d.cts} +14 -14
- package/dist/shared/{attaform.DdjDqTah.d.ts → attaform.DRUT703x.d.mts} +14 -14
- package/dist/shared/{attaform.DdjDqTah.d.cts → attaform.DRUT703x.d.ts} +14 -14
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { shallowReactive, getCurrentInstance, inject, effectScope, watch, warn, nextTick } from 'vue';
|
|
2
|
-
import { i as isRegisterValue, a as isTransforming, S as SSR_COMPONENT_HOST_MODIFIER, R as REGISTER_OWNER_MARKER, V as V_REGISTER_COMPILED_MODIFIER, b as V_REGISTER_MARKER } from './attaform.
|
|
3
|
-
|
|
4
|
-
const __DEV__ = (typeof process !== "undefined" ? process.env.NODE_ENV : "production") !== "production";
|
|
2
|
+
import { i as isRegisterValue, a as isTransforming, S as SSR_COMPONENT_HOST_MODIFIER, R as REGISTER_OWNER_MARKER, V as V_REGISTER_COMPILED_MODIFIER, b as V_REGISTER_MARKER } from './attaform.KvlEedlF.mjs';
|
|
5
3
|
|
|
6
4
|
class AttaformError extends Error {
|
|
7
5
|
constructor(message, options) {
|
|
@@ -25,6 +23,28 @@ function toError(value) {
|
|
|
25
23
|
const message = typeof value === "string" && value.length > 0 ? value : `Submit callback threw a non-Error value (${typeof value})`;
|
|
26
24
|
return new Error(message, { cause: value });
|
|
27
25
|
}
|
|
26
|
+
function normalizeErrorInput(item, scope, formKey, defaultCode) {
|
|
27
|
+
if (item instanceof Error) {
|
|
28
|
+
return {
|
|
29
|
+
message: item.message.length > 0 ? item.message : "Unknown error",
|
|
30
|
+
path: scope !== void 0 ? [...scope] : [],
|
|
31
|
+
formKey,
|
|
32
|
+
code: defaultCode
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const entry = {
|
|
36
|
+
message: typeof item.message === "string" && item.message.length > 0 ? item.message : "Unknown error",
|
|
37
|
+
path: scope !== void 0 ? [...scope] : Array.isArray(item.path) ? [...item.path] : [],
|
|
38
|
+
formKey,
|
|
39
|
+
code: typeof item.code === "string" && item.code.length > 0 ? item.code : defaultCode
|
|
40
|
+
};
|
|
41
|
+
if (item.data !== void 0) entry.data = item.data;
|
|
42
|
+
return entry;
|
|
43
|
+
}
|
|
44
|
+
function normalizeErrorInputs(input, scope, formKey, defaultCode) {
|
|
45
|
+
const items = Array.isArray(input) ? input : [input];
|
|
46
|
+
return items.map((item) => normalizeErrorInput(item, scope, formKey, defaultCode));
|
|
47
|
+
}
|
|
28
48
|
class RegistryNotInstalledError extends AttaformError {
|
|
29
49
|
constructor() {
|
|
30
50
|
super(
|
|
@@ -47,20 +67,140 @@ class ReservedFormKeyError extends AttaformError {
|
|
|
47
67
|
}
|
|
48
68
|
}
|
|
49
69
|
|
|
70
|
+
const INTEGER_SEGMENT = /^(?:0|[1-9]\d*)$/;
|
|
71
|
+
function normalizeSegment(raw) {
|
|
72
|
+
if (typeof raw === "number") {
|
|
73
|
+
if (!Number.isInteger(raw) || raw < 0) {
|
|
74
|
+
throw new InvalidPathError(
|
|
75
|
+
`Path segments must be non-negative integers when numeric; got ${String(raw)}`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
return raw;
|
|
79
|
+
}
|
|
80
|
+
if (INTEGER_SEGMENT.test(raw)) return Number(raw);
|
|
81
|
+
return raw;
|
|
82
|
+
}
|
|
83
|
+
function parseDottedPath(path) {
|
|
84
|
+
if (path.length === 0) return [""];
|
|
85
|
+
const rawSegments = path.split(".");
|
|
86
|
+
const segments = [];
|
|
87
|
+
for (const raw of rawSegments) {
|
|
88
|
+
if (raw.length === 0) {
|
|
89
|
+
throw new InvalidPathError(
|
|
90
|
+
`Path '${path}' has an empty segment; use the array form for empty keys.`
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
segments.push(normalizeSegment(raw));
|
|
94
|
+
}
|
|
95
|
+
return segments;
|
|
96
|
+
}
|
|
97
|
+
const CANONICAL_STRING_CACHE_MAX = 128;
|
|
98
|
+
const canonicalStringCache = /* @__PURE__ */ new Map();
|
|
99
|
+
const PATHKEY_TO_SEGMENTS_MAX = 4096;
|
|
100
|
+
const pathKeyToSegments = /* @__PURE__ */ new Map();
|
|
101
|
+
function rememberSegmentsForPathKey(key, segments) {
|
|
102
|
+
if (!pathKeyToSegments.has(key) && pathKeyToSegments.size >= PATHKEY_TO_SEGMENTS_MAX) {
|
|
103
|
+
const oldest = pathKeyToSegments.keys().next().value;
|
|
104
|
+
if (oldest !== void 0) pathKeyToSegments.delete(oldest);
|
|
105
|
+
}
|
|
106
|
+
pathKeyToSegments.set(key, segments);
|
|
107
|
+
}
|
|
108
|
+
function segmentsForPathKey(key) {
|
|
109
|
+
const cached = pathKeyToSegments.get(key);
|
|
110
|
+
if (cached !== void 0) return cached;
|
|
111
|
+
let parsed;
|
|
112
|
+
try {
|
|
113
|
+
parsed = JSON.parse(key);
|
|
114
|
+
} catch {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
if (!Array.isArray(parsed)) return null;
|
|
118
|
+
const segments = [];
|
|
119
|
+
for (const raw of parsed) {
|
|
120
|
+
if (typeof raw !== "string" && typeof raw !== "number") return null;
|
|
121
|
+
segments.push(normalizeSegment(raw));
|
|
122
|
+
}
|
|
123
|
+
rememberSegmentsForPathKey(key, segments);
|
|
124
|
+
return segments;
|
|
125
|
+
}
|
|
126
|
+
function canonicalizePath(input) {
|
|
127
|
+
if (typeof input === "string") {
|
|
128
|
+
const cached = canonicalStringCache.get(input);
|
|
129
|
+
if (cached !== void 0) return cached;
|
|
130
|
+
const segments = parseDottedPath(input);
|
|
131
|
+
const key = JSON.stringify(segments);
|
|
132
|
+
const entry = { segments, key };
|
|
133
|
+
if (canonicalStringCache.size >= CANONICAL_STRING_CACHE_MAX) {
|
|
134
|
+
const oldest = canonicalStringCache.keys().next().value;
|
|
135
|
+
if (oldest !== void 0) canonicalStringCache.delete(oldest);
|
|
136
|
+
}
|
|
137
|
+
canonicalStringCache.set(input, entry);
|
|
138
|
+
rememberSegmentsForPathKey(key, segments);
|
|
139
|
+
return entry;
|
|
140
|
+
}
|
|
141
|
+
return keyForSegments(input);
|
|
142
|
+
}
|
|
143
|
+
function keyForSegments(input) {
|
|
144
|
+
const segments = Array.from(input).map(normalizeSegment);
|
|
145
|
+
const key = JSON.stringify(segments);
|
|
146
|
+
rememberSegmentsForPathKey(key, segments);
|
|
147
|
+
return { segments, key };
|
|
148
|
+
}
|
|
149
|
+
function segmentsToDotted(segments) {
|
|
150
|
+
return segments.join(".");
|
|
151
|
+
}
|
|
152
|
+
function pathKeyToDotted(key) {
|
|
153
|
+
const segments = segmentsForPathKey(key);
|
|
154
|
+
if (segments === null) return null;
|
|
155
|
+
return segmentsToDotted(segments);
|
|
156
|
+
}
|
|
157
|
+
function coerceToPathKey(input) {
|
|
158
|
+
if (input.length > 0 && input.charCodeAt(0) === 91) {
|
|
159
|
+
try {
|
|
160
|
+
const parsed = JSON.parse(input);
|
|
161
|
+
if (Array.isArray(parsed) && parsed.every((s) => typeof s === "string" || typeof s === "number")) {
|
|
162
|
+
return input;
|
|
163
|
+
}
|
|
164
|
+
} catch {
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return canonicalizePath(input).key;
|
|
168
|
+
}
|
|
169
|
+
const ROOT_PATH = Object.freeze([]);
|
|
170
|
+
const ROOT_PATH_KEY = "[]";
|
|
171
|
+
function isPathPrefix(prefix, path) {
|
|
172
|
+
if (path.length < prefix.length) return false;
|
|
173
|
+
for (let i = 0; i < prefix.length; i++) {
|
|
174
|
+
if (path[i] !== prefix[i]) return false;
|
|
175
|
+
}
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
function pathsEqual(a, b) {
|
|
179
|
+
if (a.length !== b.length) return false;
|
|
180
|
+
for (let i = 0; i < a.length; i++) {
|
|
181
|
+
if (a[i] !== b[i]) return false;
|
|
182
|
+
}
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const __DEV__ = (typeof process !== "undefined" ? process.env.NODE_ENV : "production") !== "production";
|
|
187
|
+
|
|
188
|
+
const INTERACTIVE_TAG_NAMES = /* @__PURE__ */ new Set(["INPUT", "SELECT", "TEXTAREA"]);
|
|
189
|
+
|
|
50
190
|
function detectSSR(options = {}) {
|
|
51
191
|
if (options.ssr !== void 0) return options.ssr;
|
|
52
192
|
return typeof window === "undefined" && typeof document === "undefined";
|
|
53
193
|
}
|
|
54
194
|
|
|
55
|
-
const kAttaformRegistry = Symbol.for("attaform:registry");
|
|
56
|
-
const kAttaformAncestorWizard = Symbol.for(
|
|
195
|
+
const kAttaformRegistry = /* @__PURE__ */ Symbol.for("attaform:registry");
|
|
196
|
+
const kAttaformAncestorWizard = /* @__PURE__ */ Symbol.for(
|
|
57
197
|
"attaform:ancestor-wizard"
|
|
58
198
|
);
|
|
59
|
-
const kAttaformWizardActiveStepResolver = Symbol.for(
|
|
199
|
+
const kAttaformWizardActiveStepResolver = /* @__PURE__ */ Symbol.for(
|
|
60
200
|
"attaform:wizard-active-step-resolver"
|
|
61
201
|
);
|
|
62
|
-
const kFormContext = Symbol.for("attaform:form-context");
|
|
63
|
-
const kFormInstanceId = Symbol.for("attaform:form-instance-id");
|
|
202
|
+
const kFormContext = /* @__PURE__ */ Symbol.for("attaform:form-context");
|
|
203
|
+
const kFormInstanceId = /* @__PURE__ */ Symbol.for("attaform:form-instance-id");
|
|
64
204
|
function createRegistry(options = {}) {
|
|
65
205
|
const ssr = detectSSR(options);
|
|
66
206
|
const defaults = Object.freeze({ ...options.defaults ?? {} });
|
|
@@ -260,16 +400,14 @@ function invokeArrayFns(fns, ...args) {
|
|
|
260
400
|
}
|
|
261
401
|
}
|
|
262
402
|
|
|
263
|
-
const INTERACTIVE_TAG_NAMES = /* @__PURE__ */ new Set(["INPUT", "SELECT", "TEXTAREA"]);
|
|
264
|
-
|
|
265
403
|
const MANAGED_ARIA_ATTRS = [
|
|
266
404
|
"aria-invalid",
|
|
267
405
|
"aria-busy",
|
|
268
406
|
"aria-required",
|
|
269
407
|
"aria-describedby"
|
|
270
408
|
];
|
|
271
|
-
const ariaLockKey = Symbol.for("attaform:aria-locks");
|
|
272
|
-
const ariaScopeKey = Symbol.for("attaform:aria-scope");
|
|
409
|
+
const ariaLockKey = /* @__PURE__ */ Symbol.for("attaform:aria-locks");
|
|
410
|
+
const ariaScopeKey = /* @__PURE__ */ Symbol.for("attaform:aria-scope");
|
|
273
411
|
const EMPTY_ARIA_LOCKS = /* @__PURE__ */ new Set();
|
|
274
412
|
function mergeAriaLocks(el, vnode) {
|
|
275
413
|
let locks = el[ariaLockKey];
|
|
@@ -386,7 +524,7 @@ function teardownAria(el) {
|
|
|
386
524
|
delete el[ariaLockKey];
|
|
387
525
|
}
|
|
388
526
|
|
|
389
|
-
const listenersKey = Symbol.for("attaform:directive-listeners");
|
|
527
|
+
const listenersKey = /* @__PURE__ */ Symbol.for("attaform:directive-listeners");
|
|
390
528
|
function addTrackedListener(el, event, handler, options) {
|
|
391
529
|
el.addEventListener(event, handler, options);
|
|
392
530
|
const carrier = el;
|
|
@@ -410,12 +548,12 @@ function isRegisterValueLike(val) {
|
|
|
410
548
|
return typeof val === "object" && val !== null && "markInteracted" in val && typeof val.markInteracted === "function";
|
|
411
549
|
}
|
|
412
550
|
|
|
413
|
-
const assignKey = Symbol.for("attaform:assign-key");
|
|
414
|
-
const DEFAULT_ASSIGNER_TAG = Symbol.for("attaform:default-assigner-tag");
|
|
551
|
+
const assignKey = /* @__PURE__ */ Symbol.for("attaform:assign-key");
|
|
552
|
+
const DEFAULT_ASSIGNER_TAG = /* @__PURE__ */ Symbol.for("attaform:default-assigner-tag");
|
|
415
553
|
function isDefaultAssigner(fn) {
|
|
416
554
|
return typeof fn === "function" && fn[DEFAULT_ASSIGNER_TAG] === true;
|
|
417
555
|
}
|
|
418
|
-
const CONSUMER_WRAPPED_TAG = Symbol.for("attaform:consumer-wrapped-assigner");
|
|
556
|
+
const CONSUMER_WRAPPED_TAG = /* @__PURE__ */ Symbol.for("attaform:consumer-wrapped-assigner");
|
|
419
557
|
function isConsumerWrapped(fn) {
|
|
420
558
|
return typeof fn === "function" && fn[CONSUMER_WRAPPED_TAG] === true;
|
|
421
559
|
}
|
|
@@ -623,7 +761,7 @@ function readFilesFromInput(el) {
|
|
|
623
761
|
if (files === null || files.length === 0) return null;
|
|
624
762
|
return files.item(0);
|
|
625
763
|
}
|
|
626
|
-
const fileScopeKey = Symbol.for("attaform:file-scope");
|
|
764
|
+
const fileScopeKey = /* @__PURE__ */ Symbol.for("attaform:file-scope");
|
|
627
765
|
const vRegisterFile = {
|
|
628
766
|
created(el, { value }, vnode) {
|
|
629
767
|
if (!isRegisterValue(value)) return;
|
|
@@ -692,7 +830,7 @@ function syncElementRegistration(el, value, oldValue) {
|
|
|
692
830
|
}
|
|
693
831
|
}
|
|
694
832
|
|
|
695
|
-
const valueSyncScopeKey = Symbol.for("attaform:value-sync-scope");
|
|
833
|
+
const valueSyncScopeKey = /* @__PURE__ */ Symbol.for("attaform:value-sync-scope");
|
|
696
834
|
function isElementFocused(el) {
|
|
697
835
|
const rootNode = el.getRootNode();
|
|
698
836
|
const activeElement = rootNode instanceof Document || rootNode instanceof ShadowRoot ? rootNode.activeElement : null;
|
|
@@ -1476,121 +1614,36 @@ function createAttaform(options = {}) {
|
|
|
1476
1614
|
return plugin;
|
|
1477
1615
|
}
|
|
1478
1616
|
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
);
|
|
1486
|
-
|
|
1487
|
-
return raw;
|
|
1488
|
-
}
|
|
1489
|
-
if (INTEGER_SEGMENT.test(raw)) return Number(raw);
|
|
1490
|
-
return raw;
|
|
1491
|
-
}
|
|
1492
|
-
function parseDottedPath(path) {
|
|
1493
|
-
if (path.length === 0) return [""];
|
|
1494
|
-
const rawSegments = path.split(".");
|
|
1495
|
-
const segments = [];
|
|
1496
|
-
for (const raw of rawSegments) {
|
|
1497
|
-
if (raw.length === 0) {
|
|
1498
|
-
throw new InvalidPathError(
|
|
1499
|
-
`Path '${path}' has an empty segment; use the array form for empty keys.`
|
|
1500
|
-
);
|
|
1617
|
+
function renderAttaformState(app) {
|
|
1618
|
+
const registry = getRegistryFromApp(app);
|
|
1619
|
+
const forms = [];
|
|
1620
|
+
for (const [key, state] of registry.forms) {
|
|
1621
|
+
const transientList = [];
|
|
1622
|
+
for (const pk of state.blankPaths) {
|
|
1623
|
+
const d = pathKeyToDotted(pk);
|
|
1624
|
+
if (d !== null) transientList.push(d);
|
|
1501
1625
|
}
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
function rememberSegmentsForPathKey(key, segments) {
|
|
1511
|
-
if (!pathKeyToSegments.has(key) && pathKeyToSegments.size >= PATHKEY_TO_SEGMENTS_MAX) {
|
|
1512
|
-
const oldest = pathKeyToSegments.keys().next().value;
|
|
1513
|
-
if (oldest !== void 0) pathKeyToSegments.delete(oldest);
|
|
1514
|
-
}
|
|
1515
|
-
pathKeyToSegments.set(key, segments);
|
|
1516
|
-
}
|
|
1517
|
-
function segmentsForPathKey(key) {
|
|
1518
|
-
const cached = pathKeyToSegments.get(key);
|
|
1519
|
-
if (cached !== void 0) return cached;
|
|
1520
|
-
let parsed;
|
|
1521
|
-
try {
|
|
1522
|
-
parsed = JSON.parse(key);
|
|
1523
|
-
} catch {
|
|
1524
|
-
return null;
|
|
1525
|
-
}
|
|
1526
|
-
if (!Array.isArray(parsed)) return null;
|
|
1527
|
-
const segments = [];
|
|
1528
|
-
for (const raw of parsed) {
|
|
1529
|
-
if (typeof raw !== "string" && typeof raw !== "number") return null;
|
|
1530
|
-
segments.push(normalizeSegment(raw));
|
|
1531
|
-
}
|
|
1532
|
-
rememberSegmentsForPathKey(key, segments);
|
|
1533
|
-
return segments;
|
|
1534
|
-
}
|
|
1535
|
-
function canonicalizePath(input) {
|
|
1536
|
-
if (typeof input === "string") {
|
|
1537
|
-
const cached = canonicalStringCache.get(input);
|
|
1538
|
-
if (cached !== void 0) return cached;
|
|
1539
|
-
const segments = parseDottedPath(input);
|
|
1540
|
-
const key = JSON.stringify(segments);
|
|
1541
|
-
const entry = { segments, key };
|
|
1542
|
-
if (canonicalStringCache.size >= CANONICAL_STRING_CACHE_MAX) {
|
|
1543
|
-
const oldest = canonicalStringCache.keys().next().value;
|
|
1544
|
-
if (oldest !== void 0) canonicalStringCache.delete(oldest);
|
|
1545
|
-
}
|
|
1546
|
-
canonicalStringCache.set(input, entry);
|
|
1547
|
-
rememberSegmentsForPathKey(key, segments);
|
|
1548
|
-
return entry;
|
|
1549
|
-
}
|
|
1550
|
-
return keyForSegments(input);
|
|
1551
|
-
}
|
|
1552
|
-
function keyForSegments(input) {
|
|
1553
|
-
const segments = Array.from(input).map(normalizeSegment);
|
|
1554
|
-
const key = JSON.stringify(segments);
|
|
1555
|
-
rememberSegmentsForPathKey(key, segments);
|
|
1556
|
-
return { segments, key };
|
|
1557
|
-
}
|
|
1558
|
-
function segmentsToDotted(segments) {
|
|
1559
|
-
return segments.join(".");
|
|
1560
|
-
}
|
|
1561
|
-
function pathKeyToDotted(key) {
|
|
1562
|
-
const segments = segmentsForPathKey(key);
|
|
1563
|
-
if (segments === null) return null;
|
|
1564
|
-
return segmentsToDotted(segments);
|
|
1565
|
-
}
|
|
1566
|
-
function coerceToPathKey(input) {
|
|
1567
|
-
if (input.length > 0 && input.charCodeAt(0) === 91) {
|
|
1568
|
-
try {
|
|
1569
|
-
const parsed = JSON.parse(input);
|
|
1570
|
-
if (Array.isArray(parsed) && parsed.every((s) => typeof s === "string" || typeof s === "number")) {
|
|
1571
|
-
return input;
|
|
1626
|
+
forms.push([
|
|
1627
|
+
key,
|
|
1628
|
+
{
|
|
1629
|
+
form: state.form.value,
|
|
1630
|
+
schemaErrors: Array.from(state.schemaErrors.entries()),
|
|
1631
|
+
userErrors: Array.from(state.userErrors.entries()),
|
|
1632
|
+
fields: Array.from(state.fields.entries()),
|
|
1633
|
+
...transientList.length > 0 ? { blankPaths: transientList } : {}
|
|
1572
1634
|
}
|
|
1573
|
-
|
|
1574
|
-
}
|
|
1635
|
+
]);
|
|
1575
1636
|
}
|
|
1576
|
-
return
|
|
1637
|
+
return { forms };
|
|
1577
1638
|
}
|
|
1578
|
-
|
|
1579
|
-
const
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
for (let i = 0; i < prefix.length; i++) {
|
|
1583
|
-
if (path[i] !== prefix[i]) return false;
|
|
1584
|
-
}
|
|
1585
|
-
return true;
|
|
1586
|
-
}
|
|
1587
|
-
function pathsEqual(a, b) {
|
|
1588
|
-
if (a.length !== b.length) return false;
|
|
1589
|
-
for (let i = 0; i < a.length; i++) {
|
|
1590
|
-
if (a[i] !== b[i]) return false;
|
|
1639
|
+
function hydrateAttaformState(app, payload) {
|
|
1640
|
+
const registry = getRegistryFromApp(app);
|
|
1641
|
+
for (const [key, data] of payload.forms) {
|
|
1642
|
+
registry.pendingHydration.set(key, data);
|
|
1591
1643
|
}
|
|
1592
|
-
return true;
|
|
1593
1644
|
}
|
|
1594
1645
|
|
|
1595
|
-
|
|
1596
|
-
|
|
1646
|
+
const DEVTOOLS_WINDOW_KEY = "__attaform_devtools__";
|
|
1647
|
+
|
|
1648
|
+
export { AttaformError as A, kFormContext as B, kFormInstanceId as C, DEVTOOLS_WINDOW_KEY as D, kAttaformAncestorWizard as E, InvalidPathError as I, OutsideSetupError as O, ROOT_PATH as R, SubmitErrorHandlerError as S, __DEV__ as _, InvalidUseFormConfigError as a, ROOT_PATH_KEY as b, RegistryNotInstalledError as c, ReservedFormKeyError as d, assignKey as e, canonicalizePath as f, createAttaform as g, createRegistry as h, getRegistryFromApp as i, hydrateAttaformState as j, isPathPrefix as k, kAttaformRegistry as l, kAttaformWizardActiveStepResolver as m, pathsEqual as n, keyForSegments as o, parseDottedPath as p, normalizeErrorInput as q, renderAttaformState as r, segmentsForPathKey as s, toError as t, useRegistry as u, vRegister as v, INTERACTIVE_TAG_NAMES as w, normalizeErrorInputs as x, coerceToPathKey as y, ensureAttaformInstalled as z };
|
|
1649
|
+
//# sourceMappingURL=attaform.Da8EdI2t.mjs.map
|