attaform 0.26.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.DSOIz08n.mjs → attaform.BceJrhQ7.mjs} +5 -5
- package/dist/shared/{attaform.DSOIz08n.mjs.map → attaform.BceJrhQ7.mjs.map} +1 -1
- package/dist/shared/{attaform.DBNjHgNj.d.cts → attaform.C3WnCDXz.d.cts} +11 -9
- package/dist/shared/{attaform.DBNjHgNj.d.mts → attaform.C3WnCDXz.d.mts} +11 -9
- package/dist/shared/{attaform.DBNjHgNj.d.ts → attaform.C3WnCDXz.d.ts} +11 -9
- package/dist/shared/{attaform.DuzQYscR.d.mts → attaform.C9fPTxjB.d.cts} +5 -5
- package/dist/shared/{attaform.DuzQYscR.d.ts → attaform.C9fPTxjB.d.mts} +5 -5
- package/dist/shared/{attaform.DuzQYscR.d.cts → attaform.C9fPTxjB.d.ts} +5 -5
- package/dist/shared/{attaform.Be5otUVw.d.ts → attaform.CC_y1_Ej.d.ts} +33 -33
- package/dist/shared/{attaform.ceYeVkjn.d.ts → attaform.CEXUlUkc.d.ts} +1579 -1192
- package/dist/shared/{attaform.tZ0YKisf.cjs → attaform.C__F01CE.cjs} +15 -15
- package/dist/shared/{attaform.tZ0YKisf.cjs.map → attaform.C__F01CE.cjs.map} +1 -1
- package/dist/shared/{attaform.BPl-ECRT.cjs → attaform.Co5LNRnv.cjs} +162 -129
- package/dist/shared/attaform.Co5LNRnv.cjs.map +1 -0
- package/dist/shared/{attaform.B71rfNL5.d.mts → attaform.CpXHK60W.d.cts} +33 -33
- package/dist/shared/{attaform.BFfY7HRI.d.cts → attaform.CvVYOvZF.d.mts} +33 -33
- package/dist/shared/{attaform.BoYqnIPI.mjs → attaform.CyQxTOdX.mjs} +55 -36
- package/dist/shared/attaform.CyQxTOdX.mjs.map +1 -0
- package/dist/shared/{attaform.CEY_WLRJ.d.mts → attaform.D99pd7JG.d.cts} +1579 -1192
- package/dist/shared/{attaform.CXVmZtFq.mjs → attaform.DDAmSFnl.mjs} +4 -4
- package/dist/shared/{attaform.CXVmZtFq.mjs.map → attaform.DDAmSFnl.mjs.map} +1 -1
- package/dist/shared/{attaform.Du9RZp8m.cjs → attaform.DQT7_-FO.cjs} +272 -252
- package/dist/shared/attaform.DQT7_-FO.cjs.map +1 -0
- package/dist/shared/{attaform.DGhIix5D.mjs → attaform.Da8EdI2t.mjs} +160 -129
- package/dist/shared/attaform.Da8EdI2t.mjs.map +1 -0
- package/dist/shared/{attaform.Cs0UZ7q6.cjs → attaform.DhVgG2jh.cjs} +16 -16
- package/dist/shared/{attaform.Cs0UZ7q6.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.CSXDW2tO.mjs → attaform.DlSu08F5.mjs} +4 -4
- package/dist/shared/{attaform.CSXDW2tO.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.BQflyVOL.cjs → attaform.Drsi43GG.cjs} +19 -19
- package/dist/shared/{attaform.BQflyVOL.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.MgaYKlPP.d.cts → attaform.kBkYlKP_.d.mts} +1579 -1192
- 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.55hFR_cl.d.ts +0 -97
- package/dist/shared/attaform.BPl-ECRT.cjs.map +0 -1
- package/dist/shared/attaform.BRGIpZo4.cjs.map +0 -1
- package/dist/shared/attaform.BoYqnIPI.mjs.map +0 -1
- package/dist/shared/attaform.C3Doa9Pt.mjs.map +0 -1
- package/dist/shared/attaform.D51IwDtP.cjs +0 -39
- package/dist/shared/attaform.D51IwDtP.cjs.map +0 -1
- package/dist/shared/attaform.DGhIix5D.mjs.map +0 -1
- package/dist/shared/attaform.DJRz_bzM.d.cts +0 -97
- package/dist/shared/attaform.Du9RZp8m.cjs.map +0 -1
- package/dist/shared/attaform.JPsaqjLl.d.mts +0 -97
- package/dist/shared/attaform.LEWUFqUw.cjs.map +0 -1
- package/dist/shared/attaform.NqYEzRcM.mjs +0 -35
- package/dist/shared/attaform.NqYEzRcM.mjs.map +0 -1
- package/dist/shared/attaform.sHkHv_98.mjs.map +0 -1
- package/dist/shared/{attaform.DdjDqTah.d.ts → attaform.DRUT703x.d.cts} +14 -14
- package/dist/shared/{attaform.DdjDqTah.d.cts → attaform.DRUT703x.d.mts} +14 -14
- package/dist/shared/{attaform.DdjDqTah.d.mts → 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) {
|
|
@@ -69,20 +67,140 @@ class ReservedFormKeyError extends AttaformError {
|
|
|
69
67
|
}
|
|
70
68
|
}
|
|
71
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
|
+
|
|
72
190
|
function detectSSR(options = {}) {
|
|
73
191
|
if (options.ssr !== void 0) return options.ssr;
|
|
74
192
|
return typeof window === "undefined" && typeof document === "undefined";
|
|
75
193
|
}
|
|
76
194
|
|
|
77
|
-
const kAttaformRegistry = Symbol.for("attaform:registry");
|
|
78
|
-
const kAttaformAncestorWizard = Symbol.for(
|
|
195
|
+
const kAttaformRegistry = /* @__PURE__ */ Symbol.for("attaform:registry");
|
|
196
|
+
const kAttaformAncestorWizard = /* @__PURE__ */ Symbol.for(
|
|
79
197
|
"attaform:ancestor-wizard"
|
|
80
198
|
);
|
|
81
|
-
const kAttaformWizardActiveStepResolver = Symbol.for(
|
|
199
|
+
const kAttaformWizardActiveStepResolver = /* @__PURE__ */ Symbol.for(
|
|
82
200
|
"attaform:wizard-active-step-resolver"
|
|
83
201
|
);
|
|
84
|
-
const kFormContext = Symbol.for("attaform:form-context");
|
|
85
|
-
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");
|
|
86
204
|
function createRegistry(options = {}) {
|
|
87
205
|
const ssr = detectSSR(options);
|
|
88
206
|
const defaults = Object.freeze({ ...options.defaults ?? {} });
|
|
@@ -282,16 +400,14 @@ function invokeArrayFns(fns, ...args) {
|
|
|
282
400
|
}
|
|
283
401
|
}
|
|
284
402
|
|
|
285
|
-
const INTERACTIVE_TAG_NAMES = /* @__PURE__ */ new Set(["INPUT", "SELECT", "TEXTAREA"]);
|
|
286
|
-
|
|
287
403
|
const MANAGED_ARIA_ATTRS = [
|
|
288
404
|
"aria-invalid",
|
|
289
405
|
"aria-busy",
|
|
290
406
|
"aria-required",
|
|
291
407
|
"aria-describedby"
|
|
292
408
|
];
|
|
293
|
-
const ariaLockKey = Symbol.for("attaform:aria-locks");
|
|
294
|
-
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");
|
|
295
411
|
const EMPTY_ARIA_LOCKS = /* @__PURE__ */ new Set();
|
|
296
412
|
function mergeAriaLocks(el, vnode) {
|
|
297
413
|
let locks = el[ariaLockKey];
|
|
@@ -408,7 +524,7 @@ function teardownAria(el) {
|
|
|
408
524
|
delete el[ariaLockKey];
|
|
409
525
|
}
|
|
410
526
|
|
|
411
|
-
const listenersKey = Symbol.for("attaform:directive-listeners");
|
|
527
|
+
const listenersKey = /* @__PURE__ */ Symbol.for("attaform:directive-listeners");
|
|
412
528
|
function addTrackedListener(el, event, handler, options) {
|
|
413
529
|
el.addEventListener(event, handler, options);
|
|
414
530
|
const carrier = el;
|
|
@@ -432,12 +548,12 @@ function isRegisterValueLike(val) {
|
|
|
432
548
|
return typeof val === "object" && val !== null && "markInteracted" in val && typeof val.markInteracted === "function";
|
|
433
549
|
}
|
|
434
550
|
|
|
435
|
-
const assignKey = Symbol.for("attaform:assign-key");
|
|
436
|
-
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");
|
|
437
553
|
function isDefaultAssigner(fn) {
|
|
438
554
|
return typeof fn === "function" && fn[DEFAULT_ASSIGNER_TAG] === true;
|
|
439
555
|
}
|
|
440
|
-
const CONSUMER_WRAPPED_TAG = Symbol.for("attaform:consumer-wrapped-assigner");
|
|
556
|
+
const CONSUMER_WRAPPED_TAG = /* @__PURE__ */ Symbol.for("attaform:consumer-wrapped-assigner");
|
|
441
557
|
function isConsumerWrapped(fn) {
|
|
442
558
|
return typeof fn === "function" && fn[CONSUMER_WRAPPED_TAG] === true;
|
|
443
559
|
}
|
|
@@ -645,7 +761,7 @@ function readFilesFromInput(el) {
|
|
|
645
761
|
if (files === null || files.length === 0) return null;
|
|
646
762
|
return files.item(0);
|
|
647
763
|
}
|
|
648
|
-
const fileScopeKey = Symbol.for("attaform:file-scope");
|
|
764
|
+
const fileScopeKey = /* @__PURE__ */ Symbol.for("attaform:file-scope");
|
|
649
765
|
const vRegisterFile = {
|
|
650
766
|
created(el, { value }, vnode) {
|
|
651
767
|
if (!isRegisterValue(value)) return;
|
|
@@ -714,7 +830,7 @@ function syncElementRegistration(el, value, oldValue) {
|
|
|
714
830
|
}
|
|
715
831
|
}
|
|
716
832
|
|
|
717
|
-
const valueSyncScopeKey = Symbol.for("attaform:value-sync-scope");
|
|
833
|
+
const valueSyncScopeKey = /* @__PURE__ */ Symbol.for("attaform:value-sync-scope");
|
|
718
834
|
function isElementFocused(el) {
|
|
719
835
|
const rootNode = el.getRootNode();
|
|
720
836
|
const activeElement = rootNode instanceof Document || rootNode instanceof ShadowRoot ? rootNode.activeElement : null;
|
|
@@ -1498,121 +1614,36 @@ function createAttaform(options = {}) {
|
|
|
1498
1614
|
return plugin;
|
|
1499
1615
|
}
|
|
1500
1616
|
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
);
|
|
1508
|
-
|
|
1509
|
-
return raw;
|
|
1510
|
-
}
|
|
1511
|
-
if (INTEGER_SEGMENT.test(raw)) return Number(raw);
|
|
1512
|
-
return raw;
|
|
1513
|
-
}
|
|
1514
|
-
function parseDottedPath(path) {
|
|
1515
|
-
if (path.length === 0) return [""];
|
|
1516
|
-
const rawSegments = path.split(".");
|
|
1517
|
-
const segments = [];
|
|
1518
|
-
for (const raw of rawSegments) {
|
|
1519
|
-
if (raw.length === 0) {
|
|
1520
|
-
throw new InvalidPathError(
|
|
1521
|
-
`Path '${path}' has an empty segment; use the array form for empty keys.`
|
|
1522
|
-
);
|
|
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);
|
|
1523
1625
|
}
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
function rememberSegmentsForPathKey(key, segments) {
|
|
1533
|
-
if (!pathKeyToSegments.has(key) && pathKeyToSegments.size >= PATHKEY_TO_SEGMENTS_MAX) {
|
|
1534
|
-
const oldest = pathKeyToSegments.keys().next().value;
|
|
1535
|
-
if (oldest !== void 0) pathKeyToSegments.delete(oldest);
|
|
1536
|
-
}
|
|
1537
|
-
pathKeyToSegments.set(key, segments);
|
|
1538
|
-
}
|
|
1539
|
-
function segmentsForPathKey(key) {
|
|
1540
|
-
const cached = pathKeyToSegments.get(key);
|
|
1541
|
-
if (cached !== void 0) return cached;
|
|
1542
|
-
let parsed;
|
|
1543
|
-
try {
|
|
1544
|
-
parsed = JSON.parse(key);
|
|
1545
|
-
} catch {
|
|
1546
|
-
return null;
|
|
1547
|
-
}
|
|
1548
|
-
if (!Array.isArray(parsed)) return null;
|
|
1549
|
-
const segments = [];
|
|
1550
|
-
for (const raw of parsed) {
|
|
1551
|
-
if (typeof raw !== "string" && typeof raw !== "number") return null;
|
|
1552
|
-
segments.push(normalizeSegment(raw));
|
|
1553
|
-
}
|
|
1554
|
-
rememberSegmentsForPathKey(key, segments);
|
|
1555
|
-
return segments;
|
|
1556
|
-
}
|
|
1557
|
-
function canonicalizePath(input) {
|
|
1558
|
-
if (typeof input === "string") {
|
|
1559
|
-
const cached = canonicalStringCache.get(input);
|
|
1560
|
-
if (cached !== void 0) return cached;
|
|
1561
|
-
const segments = parseDottedPath(input);
|
|
1562
|
-
const key = JSON.stringify(segments);
|
|
1563
|
-
const entry = { segments, key };
|
|
1564
|
-
if (canonicalStringCache.size >= CANONICAL_STRING_CACHE_MAX) {
|
|
1565
|
-
const oldest = canonicalStringCache.keys().next().value;
|
|
1566
|
-
if (oldest !== void 0) canonicalStringCache.delete(oldest);
|
|
1567
|
-
}
|
|
1568
|
-
canonicalStringCache.set(input, entry);
|
|
1569
|
-
rememberSegmentsForPathKey(key, segments);
|
|
1570
|
-
return entry;
|
|
1571
|
-
}
|
|
1572
|
-
return keyForSegments(input);
|
|
1573
|
-
}
|
|
1574
|
-
function keyForSegments(input) {
|
|
1575
|
-
const segments = Array.from(input).map(normalizeSegment);
|
|
1576
|
-
const key = JSON.stringify(segments);
|
|
1577
|
-
rememberSegmentsForPathKey(key, segments);
|
|
1578
|
-
return { segments, key };
|
|
1579
|
-
}
|
|
1580
|
-
function segmentsToDotted(segments) {
|
|
1581
|
-
return segments.join(".");
|
|
1582
|
-
}
|
|
1583
|
-
function pathKeyToDotted(key) {
|
|
1584
|
-
const segments = segmentsForPathKey(key);
|
|
1585
|
-
if (segments === null) return null;
|
|
1586
|
-
return segmentsToDotted(segments);
|
|
1587
|
-
}
|
|
1588
|
-
function coerceToPathKey(input) {
|
|
1589
|
-
if (input.length > 0 && input.charCodeAt(0) === 91) {
|
|
1590
|
-
try {
|
|
1591
|
-
const parsed = JSON.parse(input);
|
|
1592
|
-
if (Array.isArray(parsed) && parsed.every((s) => typeof s === "string" || typeof s === "number")) {
|
|
1593
|
-
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 } : {}
|
|
1594
1634
|
}
|
|
1595
|
-
|
|
1596
|
-
}
|
|
1635
|
+
]);
|
|
1597
1636
|
}
|
|
1598
|
-
return
|
|
1637
|
+
return { forms };
|
|
1599
1638
|
}
|
|
1600
|
-
|
|
1601
|
-
const
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
for (let i = 0; i < prefix.length; i++) {
|
|
1605
|
-
if (path[i] !== prefix[i]) return false;
|
|
1606
|
-
}
|
|
1607
|
-
return true;
|
|
1608
|
-
}
|
|
1609
|
-
function pathsEqual(a, b) {
|
|
1610
|
-
if (a.length !== b.length) return false;
|
|
1611
|
-
for (let i = 0; i < a.length; i++) {
|
|
1612
|
-
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);
|
|
1613
1643
|
}
|
|
1614
|
-
return true;
|
|
1615
1644
|
}
|
|
1616
1645
|
|
|
1617
|
-
|
|
1618
|
-
|
|
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
|