attaform 0.24.0 → 0.24.2
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/chunks/devtools.cjs +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/index.cjs +5 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +4 -3
- package/dist/index.mjs.map +1 -1
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/runtime/plugins/attaform.cjs +2 -2
- package/dist/runtime/plugins/attaform.mjs +2 -2
- package/dist/shared/{attaform.CAWKNCzc.mjs → attaform.0-00cYGw.mjs} +2 -2
- package/dist/shared/{attaform.CAWKNCzc.mjs.map → attaform.0-00cYGw.mjs.map} +1 -1
- package/dist/shared/{attaform.DdUYEhkV.d.cts → attaform.0zueP54D.d.mts} +33 -15
- package/dist/shared/{attaform.Z1qTwOYE.cjs → attaform.B57G7ePY.cjs} +4 -4
- package/dist/shared/{attaform.BJ_W7q3U.mjs.map → attaform.B57G7ePY.cjs.map} +1 -1
- package/dist/shared/{attaform.DwkU0oY9.cjs → attaform.B7UdTs_o.cjs} +79 -75
- package/dist/shared/attaform.B7UdTs_o.cjs.map +1 -0
- package/dist/shared/{attaform.CuBdtfbe.mjs → attaform.BI7M3wK8.mjs} +88 -16
- package/dist/shared/attaform.BI7M3wK8.mjs.map +1 -0
- package/dist/shared/{attaform.nycEksJn.cjs → attaform.BOi6n2Pn.cjs} +2 -2
- package/dist/shared/{attaform.nycEksJn.cjs.map → attaform.BOi6n2Pn.cjs.map} +1 -1
- package/dist/shared/{attaform.BJ_W7q3U.mjs → attaform.B_-nZHtM.mjs} +4 -4
- package/dist/shared/{attaform.Z1qTwOYE.cjs.map → attaform.B_-nZHtM.mjs.map} +1 -1
- package/dist/shared/{attaform.o95Kjd3U.mjs → attaform.BjUaX7s8.mjs} +3 -3
- package/dist/shared/{attaform.o95Kjd3U.mjs.map → attaform.BjUaX7s8.mjs.map} +1 -1
- package/dist/shared/{attaform.BNmkKz0q.d.mts → attaform.BjiHiYAZ.d.ts} +3 -2
- package/dist/shared/{attaform.C42wL7EJ.cjs → attaform.Bos7wVZw.cjs} +90 -18
- package/dist/shared/attaform.Bos7wVZw.cjs.map +1 -0
- package/dist/shared/{attaform.CwFZGv5-.d.ts → attaform.Bx6pgrIy.d.cts} +3 -2
- package/dist/shared/{attaform.Df-s8j1X.mjs → attaform.C0au8oXd.mjs} +36 -29
- package/dist/shared/attaform.C0au8oXd.mjs.map +1 -0
- package/dist/shared/attaform.CjdepGnw.cjs +27 -0
- package/dist/shared/attaform.CjdepGnw.cjs.map +1 -0
- package/dist/shared/{attaform.BnUXV01g.cjs → attaform.D-gYGj5z.cjs} +4 -4
- package/dist/shared/{attaform.C-dAB90u.mjs.map → attaform.D-gYGj5z.cjs.map} +1 -1
- package/dist/shared/{attaform.C6eE50re.d.ts → attaform.DHjRN5JP.d.cts} +33 -15
- package/dist/shared/{attaform.CR6wGvNu.cjs → attaform.DK6_Ctv7.cjs} +10 -4
- package/dist/shared/attaform.DK6_Ctv7.cjs.map +1 -0
- package/dist/shared/{attaform.GJbSmwLB.d.mts → attaform.DUc6cetN.d.cts} +62 -13
- package/dist/shared/{attaform.GJbSmwLB.d.cts → attaform.DUc6cetN.d.mts} +62 -13
- package/dist/shared/{attaform.GJbSmwLB.d.ts → attaform.DUc6cetN.d.ts} +62 -13
- package/dist/shared/{attaform.BV_HyaMO.cjs → attaform.DdfLrIgM.cjs} +3 -3
- package/dist/shared/{attaform.BV_HyaMO.cjs.map → attaform.DdfLrIgM.cjs.map} +1 -1
- package/dist/shared/{attaform.K-3glmiT.d.cts → attaform.DvqdxvNU.d.mts} +3 -2
- package/dist/shared/{attaform.BFWb6hDk.mjs → attaform.DwCtxauq.mjs} +10 -4
- package/dist/shared/attaform.DwCtxauq.mjs.map +1 -0
- package/dist/shared/{attaform.C-dAB90u.mjs → attaform.K1MbxmIu.mjs} +4 -4
- package/dist/shared/{attaform.BnUXV01g.cjs.map → attaform.K1MbxmIu.mjs.map} +1 -1
- package/dist/shared/attaform.WvcckZMD.mjs +21 -0
- package/dist/shared/attaform.WvcckZMD.mjs.map +1 -0
- package/dist/shared/{attaform.DiWNbKWa.d.mts → attaform.yqcYwt0d.d.ts} +33 -15
- package/dist/transforms.cjs +1 -1
- package/dist/transforms.d.cts +4 -1
- package/dist/transforms.d.mts +4 -1
- package/dist/transforms.d.ts +4 -1
- package/dist/transforms.mjs +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/zod-v3.cjs +2 -2
- package/dist/zod-v3.d.cts +8 -5
- package/dist/zod-v3.d.mts +8 -5
- package/dist/zod-v3.d.ts +8 -5
- package/dist/zod-v3.mjs +2 -2
- package/dist/zod-v4.cjs +2 -2
- package/dist/zod-v4.d.cts +5 -5
- package/dist/zod-v4.d.mts +5 -5
- package/dist/zod-v4.d.ts +5 -5
- package/dist/zod-v4.mjs +2 -2
- package/dist/zod.cjs +5 -5
- package/dist/zod.cjs.map +1 -1
- package/dist/zod.d.cts +23 -7
- package/dist/zod.d.mts +23 -7
- package/dist/zod.d.ts +23 -7
- package/dist/zod.mjs +5 -5
- package/dist/zod.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/shared/attaform.BFWb6hDk.mjs.map +0 -1
- package/dist/shared/attaform.C42wL7EJ.cjs.map +0 -1
- package/dist/shared/attaform.CR6wGvNu.cjs.map +0 -1
- package/dist/shared/attaform.CuBdtfbe.mjs.map +0 -1
- package/dist/shared/attaform.Df-s8j1X.mjs.map +0 -1
- package/dist/shared/attaform.DwkU0oY9.cjs.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const vue = require('vue');
|
|
4
|
+
const registerProtocol = require('./attaform.CjdepGnw.cjs');
|
|
4
5
|
|
|
5
6
|
const __DEV__ = (typeof process !== "undefined" ? process.env.NODE_ENV : "production") !== "production";
|
|
6
7
|
|
|
@@ -261,21 +262,7 @@ function invokeArrayFns(fns, ...args) {
|
|
|
261
262
|
}
|
|
262
263
|
}
|
|
263
264
|
|
|
264
|
-
const
|
|
265
|
-
const REGISTER_OWNER_MARKER = Symbol.for("attaform:register-owner-marker");
|
|
266
|
-
function isRegisterValue(val) {
|
|
267
|
-
if (typeof val !== "object" || val === null) return false;
|
|
268
|
-
if (!("innerRef" in val)) return false;
|
|
269
|
-
if (!vue.isRef(val.innerRef)) return false;
|
|
270
|
-
if (!("registerElement" in val)) return false;
|
|
271
|
-
if (typeof val.registerElement !== "function") return false;
|
|
272
|
-
if (!("setValueWithInternalPath" in val)) return false;
|
|
273
|
-
if (typeof val.setValueWithInternalPath !== "function") return false;
|
|
274
|
-
return true;
|
|
275
|
-
}
|
|
276
|
-
function isTransforming(value) {
|
|
277
|
-
return isRegisterValue(value) && value.transforming;
|
|
278
|
-
}
|
|
265
|
+
const INTERACTIVE_TAG_NAMES = /* @__PURE__ */ new Set(["INPUT", "SELECT", "TEXTAREA"]);
|
|
279
266
|
|
|
280
267
|
const MANAGED_ARIA_ATTRS = [
|
|
281
268
|
"aria-invalid",
|
|
@@ -304,36 +291,52 @@ function setAriaAttr(el, attr, value) {
|
|
|
304
291
|
if (value === null) el.removeAttribute(attr);
|
|
305
292
|
else el.setAttribute(attr, value);
|
|
306
293
|
}
|
|
307
|
-
function resolveAriaValue(attr, rv, ds) {
|
|
294
|
+
function resolveAriaValue(attr, rv, ds, suppressRequired) {
|
|
308
295
|
switch (attr) {
|
|
309
296
|
case "aria-invalid":
|
|
310
297
|
return ds === "error" ? "true" : null;
|
|
311
298
|
case "aria-busy":
|
|
312
299
|
return ds === "pending" ? "true" : null;
|
|
313
300
|
case "aria-required":
|
|
314
|
-
return rv.isRequired === true ? "true" : null;
|
|
301
|
+
return rv.isRequired === true && !suppressRequired ? "true" : null;
|
|
315
302
|
case "aria-describedby":
|
|
316
303
|
return ds === "error" && rv.aria?.errorId !== void 0 ? rv.aria.errorId : null;
|
|
317
304
|
default:
|
|
318
305
|
return null;
|
|
319
306
|
}
|
|
320
307
|
}
|
|
321
|
-
function
|
|
308
|
+
function suppressesRequired(rv, isCheckbox) {
|
|
309
|
+
if (!isCheckbox) return false;
|
|
310
|
+
const model = rv.innerRef.value;
|
|
311
|
+
return isArray(model) || isSet(model);
|
|
312
|
+
}
|
|
313
|
+
function isCheckboxInput(tagName, type) {
|
|
314
|
+
return tagName === "INPUT" && typeof type === "string" && type.toLowerCase() === "checkbox";
|
|
315
|
+
}
|
|
316
|
+
function applyAria(el, rv, vnode) {
|
|
322
317
|
if (rv.ariaEnabled !== true || rv.ariaDisplayState === void 0) return;
|
|
318
|
+
if (!INTERACTIVE_TAG_NAMES.has(el.tagName)) return;
|
|
323
319
|
const locks = el[ariaLockKey] ?? EMPTY_ARIA_LOCKS;
|
|
324
320
|
const ds = rv.ariaDisplayState.value;
|
|
321
|
+
const vnodeType = vnode?.props?.["type"];
|
|
322
|
+
const checkbox = isCheckboxInput(
|
|
323
|
+
el.tagName,
|
|
324
|
+
typeof vnodeType === "string" ? vnodeType : el.type
|
|
325
|
+
);
|
|
326
|
+
const suppressRequired = suppressesRequired(rv, checkbox);
|
|
325
327
|
for (const attr of MANAGED_ARIA_ATTRS) {
|
|
326
|
-
if (!locks.has(attr)) setAriaAttr(el, attr, resolveAriaValue(attr, rv, ds));
|
|
328
|
+
if (!locks.has(attr)) setAriaAttr(el, attr, resolveAriaValue(attr, rv, ds, suppressRequired));
|
|
327
329
|
}
|
|
328
330
|
}
|
|
329
331
|
function setupAria(el, rv, vnode) {
|
|
330
332
|
if (rv.ariaEnabled !== true || rv.ariaDisplayState === void 0) return;
|
|
333
|
+
if (!INTERACTIVE_TAG_NAMES.has(el.tagName)) return;
|
|
331
334
|
mergeAriaLocks(el, vnode);
|
|
332
|
-
applyAria(el, rv);
|
|
335
|
+
applyAria(el, rv, vnode);
|
|
333
336
|
const displayState = rv.ariaDisplayState;
|
|
334
337
|
const scope = vue.effectScope(true);
|
|
335
338
|
scope.run(() => {
|
|
336
|
-
vue.watch(displayState, () => applyAria(el, rv), { flush: "post" });
|
|
339
|
+
vue.watch(displayState, () => applyAria(el, rv, vnode), { flush: "post" });
|
|
337
340
|
});
|
|
338
341
|
el[ariaScopeKey] = () => scope.stop();
|
|
339
342
|
}
|
|
@@ -341,10 +344,12 @@ function getSSRAriaProps(rv, vnode) {
|
|
|
341
344
|
if (rv.ariaEnabled !== true || rv.ariaDisplayState === void 0) return void 0;
|
|
342
345
|
const props = vnode?.props ?? null;
|
|
343
346
|
const ds = rv.ariaDisplayState.value;
|
|
347
|
+
const tagName = typeof vnode?.type === "string" ? vnode.type.toUpperCase() : "";
|
|
348
|
+
const suppressRequired = suppressesRequired(rv, isCheckboxInput(tagName, props?.["type"]));
|
|
344
349
|
const out = {};
|
|
345
350
|
for (const attr of MANAGED_ARIA_ATTRS) {
|
|
346
351
|
if (props !== null && attr in props) continue;
|
|
347
|
-
const value = resolveAriaValue(attr, rv, ds);
|
|
352
|
+
const value = resolveAriaValue(attr, rv, ds, suppressRequired);
|
|
348
353
|
if (value !== null) out[attr] = value;
|
|
349
354
|
}
|
|
350
355
|
return out;
|
|
@@ -400,7 +405,7 @@ function fireAssigner(el, registerValue, value) {
|
|
|
400
405
|
if (isDefaultAssigner(fn) || isConsumerWrapped(fn)) {
|
|
401
406
|
return fn(value);
|
|
402
407
|
}
|
|
403
|
-
if (!isRegisterValue(registerValue)) {
|
|
408
|
+
if (!registerProtocol.isRegisterValue(registerValue)) {
|
|
404
409
|
return fn(value, void 0);
|
|
405
410
|
}
|
|
406
411
|
return wrapWithTransforms(
|
|
@@ -568,7 +573,7 @@ function setAssignFunction(el, vnode, value) {
|
|
|
568
573
|
el[assignKey] = makeNoopAssigner();
|
|
569
574
|
return;
|
|
570
575
|
}
|
|
571
|
-
if (!isRegisterValue(value)) {
|
|
576
|
+
if (!registerProtocol.isRegisterValue(value)) {
|
|
572
577
|
vue.warn(
|
|
573
578
|
`v-register expected a RegisterValue, got '${typeof value}'. Bind to form.register('field') \u2014 not the field's ref, value, or path string.`
|
|
574
579
|
);
|
|
@@ -601,7 +606,7 @@ function readFilesFromInput(el) {
|
|
|
601
606
|
const fileScopeKey = Symbol.for("attaform:file-scope");
|
|
602
607
|
const vRegisterFile = {
|
|
603
608
|
created(el, { value }, vnode) {
|
|
604
|
-
if (!isRegisterValue(value)) return;
|
|
609
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
605
610
|
const input = el;
|
|
606
611
|
value.registerElement(input);
|
|
607
612
|
setAssignFunction(input, vnode, value);
|
|
@@ -634,10 +639,10 @@ const vRegisterFile = {
|
|
|
634
639
|
input[fileScopeKey] = () => scope.stop();
|
|
635
640
|
},
|
|
636
641
|
beforeUpdate(el, { value }) {
|
|
637
|
-
if (!isRegisterValue(value)) return;
|
|
642
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
638
643
|
const input = el;
|
|
639
644
|
const currentRaw = value.innerRef.value;
|
|
640
|
-
if (isBlankFileValue(currentRaw) && !isTransforming(value)) {
|
|
645
|
+
if (isBlankFileValue(currentRaw) && !registerProtocol.isTransforming(value)) {
|
|
641
646
|
value.setValueWithInternalPath(currentRaw, { blank: true });
|
|
642
647
|
if (input.value !== "") input.value = "";
|
|
643
648
|
}
|
|
@@ -649,14 +654,14 @@ const vRegisterFile = {
|
|
|
649
654
|
stop();
|
|
650
655
|
delete el[fileScopeKey];
|
|
651
656
|
}
|
|
652
|
-
if (!isRegisterValue(value)) return;
|
|
657
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
653
658
|
value.deregisterElement(el);
|
|
654
659
|
}
|
|
655
660
|
};
|
|
656
661
|
|
|
657
662
|
function syncElementRegistration(el, value, oldValue) {
|
|
658
|
-
const wasRegistered = isRegisterValue(oldValue);
|
|
659
|
-
const isRegistered = isRegisterValue(value);
|
|
663
|
+
const wasRegistered = registerProtocol.isRegisterValue(oldValue);
|
|
664
|
+
const isRegistered = registerProtocol.isRegisterValue(value);
|
|
660
665
|
if (!wasRegistered && !isRegistered) return;
|
|
661
666
|
const samePathAndStore = wasRegistered && isRegistered && oldValue.path === value.path && oldValue.formKey === value.formKey;
|
|
662
667
|
if (wasRegistered && !samePathAndStore) {
|
|
@@ -697,8 +702,6 @@ function teardownValueSync(el) {
|
|
|
697
702
|
delete carrier[valueSyncScopeKey];
|
|
698
703
|
}
|
|
699
704
|
|
|
700
|
-
const INTERACTIVE_TAG_NAMES = /* @__PURE__ */ new Set(["INPUT", "SELECT", "TEXTAREA"]);
|
|
701
|
-
|
|
702
705
|
function writeLastTypedForm(rv, next) {
|
|
703
706
|
rv.lastTypedForm.value = next;
|
|
704
707
|
}
|
|
@@ -725,12 +728,12 @@ const vRegisterText = {
|
|
|
725
728
|
created(el, { value, modifiers: { lazy, trim, number } }, vnode) {
|
|
726
729
|
const castToNumberAtCreated = number === true || vnode.props?.["type"] === "number";
|
|
727
730
|
const liveCastToNumber = () => number === true || el.getAttribute("type") === "number";
|
|
728
|
-
if (isRegisterValue(value)) {
|
|
731
|
+
if (registerProtocol.isRegisterValue(value)) {
|
|
729
732
|
value.registerElement(el);
|
|
730
733
|
setAssignFunction(el, vnode, value);
|
|
731
734
|
}
|
|
732
735
|
el._syncFromStorage = () => {
|
|
733
|
-
if (!isRegisterValue(value)) return;
|
|
736
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
734
737
|
const storage = value.innerRef.value;
|
|
735
738
|
const display = storage == null ? "" : String(storage);
|
|
736
739
|
if (el.value !== display) el.value = display;
|
|
@@ -752,7 +755,7 @@ const vRegisterText = {
|
|
|
752
755
|
if (validity?.badInput === true) {
|
|
753
756
|
return;
|
|
754
757
|
}
|
|
755
|
-
if (isRegisterValue(value)) {
|
|
758
|
+
if (registerProtocol.isRegisterValue(value)) {
|
|
756
759
|
writeLastTypedForm(value, null);
|
|
757
760
|
value.markBlank();
|
|
758
761
|
}
|
|
@@ -761,29 +764,29 @@ const vRegisterText = {
|
|
|
761
764
|
const typedString = domValue;
|
|
762
765
|
domValue = looseToNumber(domValue);
|
|
763
766
|
if (typeof domValue !== "number") {
|
|
764
|
-
if (isRegisterValue(value)) {
|
|
767
|
+
if (registerProtocol.isRegisterValue(value)) {
|
|
765
768
|
writeLastTypedForm(value, null);
|
|
766
769
|
value.markBlank();
|
|
767
770
|
}
|
|
768
771
|
return;
|
|
769
772
|
}
|
|
770
773
|
if (!Number.isFinite(domValue)) {
|
|
771
|
-
if (isRegisterValue(value)) {
|
|
774
|
+
if (registerProtocol.isRegisterValue(value)) {
|
|
772
775
|
const target2 = value.displayValue.value;
|
|
773
776
|
if (el.value !== target2) el.value = target2;
|
|
774
777
|
}
|
|
775
778
|
return;
|
|
776
779
|
}
|
|
777
|
-
if (isRegisterValue(value)) writeLastTypedForm(value, typedString);
|
|
780
|
+
if (registerProtocol.isRegisterValue(value)) writeLastTypedForm(value, typedString);
|
|
778
781
|
}
|
|
779
|
-
if (domValue === "" && isRegisterValue(value) && !value.acceptsString && !value.acceptsUndefined) {
|
|
782
|
+
if (domValue === "" && registerProtocol.isRegisterValue(value) && !value.acceptsString && !value.acceptsUndefined) {
|
|
780
783
|
writeLastTypedForm(value, null);
|
|
781
784
|
value.markBlank();
|
|
782
785
|
return;
|
|
783
786
|
}
|
|
784
|
-
const commit = domValue === "" && isRegisterValue(value) && value.acceptsUndefined ? void 0 : domValue;
|
|
787
|
+
const commit = domValue === "" && registerProtocol.isRegisterValue(value) && value.acceptsUndefined ? void 0 : domValue;
|
|
785
788
|
fireAssigner(el, value, commit);
|
|
786
|
-
if (isRegisterValue(value) && isDefaultAssigner(el[assignKey]) && !isTransforming(value)) {
|
|
789
|
+
if (registerProtocol.isRegisterValue(value) && isDefaultAssigner(el[assignKey]) && !registerProtocol.isTransforming(value)) {
|
|
787
790
|
const storage = value.innerRef.value;
|
|
788
791
|
if (storage !== domValue) {
|
|
789
792
|
const display = storage == null ? "" : String(storage);
|
|
@@ -801,11 +804,11 @@ const vRegisterText = {
|
|
|
801
804
|
if (castToNumber) {
|
|
802
805
|
const cast = looseToNumber(normalized);
|
|
803
806
|
if (typeof cast === "number" && Number.isFinite(cast)) {
|
|
804
|
-
if (isRegisterValue(value)) writeLastTypedForm(value, null);
|
|
807
|
+
if (registerProtocol.isRegisterValue(value)) writeLastTypedForm(value, null);
|
|
805
808
|
el.value = String(cast);
|
|
806
809
|
if (lazy !== true) fireAssigner(el, value, cast);
|
|
807
810
|
} else {
|
|
808
|
-
if (isRegisterValue(value)) {
|
|
811
|
+
if (registerProtocol.isRegisterValue(value)) {
|
|
809
812
|
writeLastTypedForm(value, null);
|
|
810
813
|
value.markBlank();
|
|
811
814
|
}
|
|
@@ -841,7 +844,7 @@ const vRegisterText = {
|
|
|
841
844
|
},
|
|
842
845
|
// set value on mounted so it's after min/max for type="range"
|
|
843
846
|
mounted(el, { value }) {
|
|
844
|
-
if (!isRegisterValue(value)) return;
|
|
847
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
845
848
|
el.value = value.displayValue.value;
|
|
846
849
|
setupValueSync(
|
|
847
850
|
el,
|
|
@@ -856,7 +859,7 @@ const vRegisterText = {
|
|
|
856
859
|
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim } }, vnode) {
|
|
857
860
|
setAssignFunction(el, vnode, value);
|
|
858
861
|
if (el.composing === true) return;
|
|
859
|
-
if (!isRegisterValue(value)) return;
|
|
862
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
860
863
|
const target = value.displayValue.value;
|
|
861
864
|
if (el.value === target) {
|
|
862
865
|
return;
|
|
@@ -878,11 +881,11 @@ const vRegisterCheckbox = {
|
|
|
878
881
|
// #4096 array checkboxes need to be deep traversed
|
|
879
882
|
deep: true,
|
|
880
883
|
created(el, { value }, vnode) {
|
|
881
|
-
if (!isRegisterValue(value)) return;
|
|
884
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
882
885
|
value.registerElement(el);
|
|
883
886
|
setAssignFunction(el, vnode, value);
|
|
884
887
|
el._syncFromStorage = () => {
|
|
885
|
-
if (!isRegisterValue(value)) return;
|
|
888
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
886
889
|
setChecked(el, value);
|
|
887
890
|
el._lastAppliedModel = value.innerRef.value;
|
|
888
891
|
};
|
|
@@ -928,7 +931,7 @@ const vRegisterCheckbox = {
|
|
|
928
931
|
} else {
|
|
929
932
|
fireAssigner(el, value, getCheckboxValue(el, checked));
|
|
930
933
|
}
|
|
931
|
-
if (isRegisterValue(value) && isDefaultAssigner(el[assignKey]) && !isTransforming(value)) {
|
|
934
|
+
if (registerProtocol.isRegisterValue(value) && isDefaultAssigner(el[assignKey]) && !registerProtocol.isTransforming(value)) {
|
|
932
935
|
setChecked(el, value);
|
|
933
936
|
el._lastAppliedModel = value.innerRef.value;
|
|
934
937
|
}
|
|
@@ -937,7 +940,7 @@ const vRegisterCheckbox = {
|
|
|
937
940
|
// set initial checked on mount to wait for true-value/false-value
|
|
938
941
|
mounted(el, { value }) {
|
|
939
942
|
setChecked(el, value);
|
|
940
|
-
if (!isRegisterValue(value)) return;
|
|
943
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
941
944
|
el._lastAppliedModel = value.innerRef.value;
|
|
942
945
|
setupValueSync(el, value.innerRef, () => {
|
|
943
946
|
setChecked(el, value);
|
|
@@ -960,7 +963,7 @@ const vRegisterCheckbox = {
|
|
|
960
963
|
// reference equality tracks "did the model move" exactly.
|
|
961
964
|
beforeUpdate(el, binding, vnode) {
|
|
962
965
|
setAssignFunction(el, vnode, binding.value);
|
|
963
|
-
if (!isRegisterValue(binding.value)) return;
|
|
966
|
+
if (!registerProtocol.isRegisterValue(binding.value)) return;
|
|
964
967
|
const currentModel = binding.value.innerRef.value;
|
|
965
968
|
if (el._lastAppliedModel === currentModel) return;
|
|
966
969
|
setChecked(el, binding.value);
|
|
@@ -968,7 +971,7 @@ const vRegisterCheckbox = {
|
|
|
968
971
|
}
|
|
969
972
|
};
|
|
970
973
|
function setChecked(el, value) {
|
|
971
|
-
if (!isRegisterValue(value)) return;
|
|
974
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
972
975
|
const originalValue = value.innerRef.value;
|
|
973
976
|
let checked;
|
|
974
977
|
if (isArray(originalValue)) {
|
|
@@ -985,11 +988,11 @@ function setChecked(el, value) {
|
|
|
985
988
|
}
|
|
986
989
|
const vRegisterRadio = {
|
|
987
990
|
created(el, { value }, vnode) {
|
|
988
|
-
if (!isRegisterValue(value)) return;
|
|
991
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
989
992
|
value.registerElement(el);
|
|
990
993
|
setAssignFunction(el, vnode, value);
|
|
991
994
|
el._syncFromStorage = () => {
|
|
992
|
-
if (!isRegisterValue(value)) return;
|
|
995
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
993
996
|
const currentModel = value.innerRef.value;
|
|
994
997
|
const target = looseEqual(currentModel, applyCoerce(getValue(el), value));
|
|
995
998
|
if (el.checked !== target) el.checked = target;
|
|
@@ -999,7 +1002,7 @@ const vRegisterRadio = {
|
|
|
999
1002
|
if (shouldBailListener(el)) return;
|
|
1000
1003
|
noteInteraction(value);
|
|
1001
1004
|
fireAssigner(el, value, getValue(el));
|
|
1002
|
-
if (isRegisterValue(value) && isDefaultAssigner(el[assignKey]) && !isTransforming(value)) {
|
|
1005
|
+
if (registerProtocol.isRegisterValue(value) && isDefaultAssigner(el[assignKey]) && !registerProtocol.isTransforming(value)) {
|
|
1003
1006
|
const currentModel = value.innerRef.value;
|
|
1004
1007
|
const target = looseEqual(currentModel, applyCoerce(getValue(el), value));
|
|
1005
1008
|
if (el.checked !== target) el.checked = target;
|
|
@@ -1015,7 +1018,7 @@ const vRegisterRadio = {
|
|
|
1015
1018
|
// model. Checkbox already uses `mounted: setChecked` for the same
|
|
1016
1019
|
// reason.
|
|
1017
1020
|
mounted(el, { value }) {
|
|
1018
|
-
if (!isRegisterValue(value)) return;
|
|
1021
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
1019
1022
|
el.checked = looseEqual(value.innerRef.value, applyCoerce(getValue(el), value));
|
|
1020
1023
|
el._lastAppliedModel = value.innerRef.value;
|
|
1021
1024
|
setupValueSync(el, value.innerRef, () => {
|
|
@@ -1033,7 +1036,7 @@ const vRegisterRadio = {
|
|
|
1033
1036
|
// write triggers `beforeUpdate` mid-click and writes back the
|
|
1034
1037
|
// prior model state, clobbering the in-flight selection.
|
|
1035
1038
|
beforeUpdate(el, { value }, vnode) {
|
|
1036
|
-
if (!isRegisterValue(value)) return;
|
|
1039
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
1037
1040
|
setAssignFunction(el, vnode, value);
|
|
1038
1041
|
const currentModel = value.innerRef.value;
|
|
1039
1042
|
if (el._lastAppliedModel === currentModel) return;
|
|
@@ -1045,10 +1048,10 @@ const vRegisterSelect = {
|
|
|
1045
1048
|
// <select multiple> value need to be deep traversed
|
|
1046
1049
|
deep: true,
|
|
1047
1050
|
created(el, { value, modifiers: { number } }, vnode) {
|
|
1048
|
-
if (!isRegisterValue(value)) return;
|
|
1051
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
1049
1052
|
value.registerElement(el);
|
|
1050
1053
|
el._syncFromStorage = () => {
|
|
1051
|
-
if (!isRegisterValue(value)) return;
|
|
1054
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
1052
1055
|
setSelected(el, value);
|
|
1053
1056
|
el._lastAppliedModel = value.innerRef.value;
|
|
1054
1057
|
};
|
|
@@ -1068,7 +1071,7 @@ const vRegisterSelect = {
|
|
|
1068
1071
|
el._assigning = false;
|
|
1069
1072
|
});
|
|
1070
1073
|
}
|
|
1071
|
-
if (isRegisterValue(value) && isDefaultAssigner(el[assignKey]) && !isTransforming(value)) {
|
|
1074
|
+
if (registerProtocol.isRegisterValue(value) && isDefaultAssigner(el[assignKey]) && !registerProtocol.isTransforming(value)) {
|
|
1072
1075
|
setSelected(el, value);
|
|
1073
1076
|
el._lastAppliedModel = value.innerRef.value;
|
|
1074
1077
|
}
|
|
@@ -1079,7 +1082,7 @@ const vRegisterSelect = {
|
|
|
1079
1082
|
// <option>s.
|
|
1080
1083
|
mounted(el, { value }) {
|
|
1081
1084
|
setSelected(el, value);
|
|
1082
|
-
if (!isRegisterValue(value)) return;
|
|
1085
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
1083
1086
|
el._lastAppliedModel = value.innerRef.value;
|
|
1084
1087
|
setupValueSync(el, value.innerRef, () => {
|
|
1085
1088
|
if (el._assigning === true) return;
|
|
@@ -1108,7 +1111,7 @@ const vRegisterSelect = {
|
|
|
1108
1111
|
// DOM is already in sync from the user's click.
|
|
1109
1112
|
updated(el, { value }) {
|
|
1110
1113
|
if (el._assigning === true) return;
|
|
1111
|
-
if (!isRegisterValue(value)) return;
|
|
1114
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
1112
1115
|
const currentModel = value.innerRef.value;
|
|
1113
1116
|
if (el._lastAppliedModel === currentModel) return;
|
|
1114
1117
|
setSelected(el, value);
|
|
@@ -1116,7 +1119,7 @@ const vRegisterSelect = {
|
|
|
1116
1119
|
}
|
|
1117
1120
|
};
|
|
1118
1121
|
function setSelected(el, value) {
|
|
1119
|
-
if (!isRegisterValue(value)) return;
|
|
1122
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
1120
1123
|
const externalValue = value.innerRef.value;
|
|
1121
1124
|
const isMultiple = el.multiple;
|
|
1122
1125
|
const isArrayValue = isArray(externalValue);
|
|
@@ -1180,14 +1183,14 @@ const warnedUnsupportedElements = __DEV__ ? /* @__PURE__ */ new WeakSet() : null
|
|
|
1180
1183
|
const vRegisterDynamic = {
|
|
1181
1184
|
created(el, binding, vnode) {
|
|
1182
1185
|
callModelHook(el, binding, vnode, null, "created");
|
|
1183
|
-
if (isRegisterValue(binding.value)) setupAria(el, binding.value, vnode);
|
|
1186
|
+
if (registerProtocol.isRegisterValue(binding.value)) setupAria(el, binding.value, vnode);
|
|
1184
1187
|
},
|
|
1185
1188
|
mounted(el, binding, vnode) {
|
|
1186
1189
|
callModelHook(el, binding, vnode, null, "mounted");
|
|
1187
1190
|
if (__DEV__ && warnedUnsupportedElements !== null && !INTERACTIVE_TAG_NAMES.has(el.tagName) && !warnedUnsupportedElements.has(el)) {
|
|
1188
1191
|
void vue.nextTick(() => {
|
|
1189
1192
|
if (warnedUnsupportedElements.has(el)) return;
|
|
1190
|
-
const hasMarker = el[REGISTER_OWNER_MARKER] === true;
|
|
1193
|
+
const hasMarker = el[registerProtocol.REGISTER_OWNER_MARKER] === true;
|
|
1191
1194
|
const hasUserAssigner = !isDefaultAssigner(
|
|
1192
1195
|
el[assignKey]
|
|
1193
1196
|
);
|
|
@@ -1204,17 +1207,17 @@ const vRegisterDynamic = {
|
|
|
1204
1207
|
callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
|
|
1205
1208
|
const ariaEl = el;
|
|
1206
1209
|
const value = binding.value;
|
|
1207
|
-
if (!isRegisterValue(value) || value.ariaEnabled !== true || value.ariaDisplayState === void 0) {
|
|
1210
|
+
if (!registerProtocol.isRegisterValue(value) || value.ariaEnabled !== true || value.ariaDisplayState === void 0) {
|
|
1208
1211
|
teardownAria(ariaEl);
|
|
1209
1212
|
} else {
|
|
1210
1213
|
const old = binding.oldValue;
|
|
1211
|
-
const pathChanged = !isRegisterValue(old) || old.path !== value.path;
|
|
1214
|
+
const pathChanged = !registerProtocol.isRegisterValue(old) || old.path !== value.path;
|
|
1212
1215
|
if (pathChanged) {
|
|
1213
1216
|
teardownAria(ariaEl);
|
|
1214
1217
|
setupAria(ariaEl, value, vnode);
|
|
1215
1218
|
} else {
|
|
1216
1219
|
mergeAriaLocks(ariaEl, vnode);
|
|
1217
|
-
applyAria(ariaEl, value);
|
|
1220
|
+
applyAria(ariaEl, value, vnode);
|
|
1218
1221
|
}
|
|
1219
1222
|
}
|
|
1220
1223
|
},
|
|
@@ -1225,7 +1228,7 @@ const vRegisterDynamic = {
|
|
|
1225
1228
|
removeTrackedListeners(el);
|
|
1226
1229
|
teardownAria(el);
|
|
1227
1230
|
teardownValueSync(el);
|
|
1228
|
-
if (!isRegisterValue(value)) return;
|
|
1231
|
+
if (!registerProtocol.isRegisterValue(value)) return;
|
|
1229
1232
|
value.deregisterElement(el);
|
|
1230
1233
|
delete el.composing;
|
|
1231
1234
|
delete el._assigning;
|
|
@@ -1241,9 +1244,13 @@ const vRegisterDynamic = {
|
|
|
1241
1244
|
// describedby matches the client after hydration.
|
|
1242
1245
|
getSSRProps(binding, vnode) {
|
|
1243
1246
|
const rv = binding.value;
|
|
1244
|
-
if (!isRegisterValue(rv)) return void 0;
|
|
1247
|
+
if (!registerProtocol.isRegisterValue(rv)) return void 0;
|
|
1245
1248
|
const realVnode = vnode ?? null;
|
|
1246
|
-
const
|
|
1249
|
+
const isInteractiveElementVnode = realVnode !== null && typeof realVnode.type === "string" && INTERACTIVE_TAG_NAMES.has(realVnode.type.toUpperCase());
|
|
1250
|
+
const modifiers = binding.modifiers;
|
|
1251
|
+
const isComponentHostModifier = modifiers?.[registerProtocol.SSR_COMPONENT_HOST_MODIFIER] === true;
|
|
1252
|
+
const suppressHostAria = isComponentHostModifier || realVnode !== null && !isInteractiveElementVnode;
|
|
1253
|
+
const ariaProps = suppressHostAria ? void 0 : getSSRAriaProps(rv, realVnode);
|
|
1247
1254
|
const formStateProps = realVnode !== null ? getSSRFormStateProps(rv, realVnode) : void 0;
|
|
1248
1255
|
if (ariaProps === void 0 && formStateProps === void 0) return void 0;
|
|
1249
1256
|
return { ...ariaProps, ...formStateProps };
|
|
@@ -1291,7 +1298,7 @@ function callModelHook(el, binding, vnode, prevVNode, hook) {
|
|
|
1291
1298
|
fn?.(el, binding, vnode, prevVNode);
|
|
1292
1299
|
}
|
|
1293
1300
|
const vRegister = vRegisterDynamic;
|
|
1294
|
-
vRegisterDynamic[V_REGISTER_MARKER] = true;
|
|
1301
|
+
vRegisterDynamic[registerProtocol.V_REGISTER_MARKER] = true;
|
|
1295
1302
|
|
|
1296
1303
|
function installAttaformOnApp(app, options, source) {
|
|
1297
1304
|
if (app._attaform !== void 0) {
|
|
@@ -1449,13 +1456,11 @@ exports.INTERACTIVE_TAG_NAMES = INTERACTIVE_TAG_NAMES;
|
|
|
1449
1456
|
exports.InvalidPathError = InvalidPathError;
|
|
1450
1457
|
exports.InvalidUseFormConfigError = InvalidUseFormConfigError;
|
|
1451
1458
|
exports.OutsideSetupError = OutsideSetupError;
|
|
1452
|
-
exports.REGISTER_OWNER_MARKER = REGISTER_OWNER_MARKER;
|
|
1453
1459
|
exports.ROOT_PATH = ROOT_PATH;
|
|
1454
1460
|
exports.ROOT_PATH_KEY = ROOT_PATH_KEY;
|
|
1455
1461
|
exports.RegistryNotInstalledError = RegistryNotInstalledError;
|
|
1456
1462
|
exports.ReservedFormKeyError = ReservedFormKeyError;
|
|
1457
1463
|
exports.SubmitErrorHandlerError = SubmitErrorHandlerError;
|
|
1458
|
-
exports.V_REGISTER_MARKER = V_REGISTER_MARKER;
|
|
1459
1464
|
exports.__DEV__ = __DEV__;
|
|
1460
1465
|
exports.assignKey = assignKey;
|
|
1461
1466
|
exports.canonicalizePath = canonicalizePath;
|
|
@@ -1465,7 +1470,6 @@ exports.createRegistry = createRegistry;
|
|
|
1465
1470
|
exports.ensureAttaformInstalled = ensureAttaformInstalled;
|
|
1466
1471
|
exports.getRegistryFromApp = getRegistryFromApp;
|
|
1467
1472
|
exports.isPathPrefix = isPathPrefix;
|
|
1468
|
-
exports.isRegisterValue = isRegisterValue;
|
|
1469
1473
|
exports.kAttaformAncestorWizard = kAttaformAncestorWizard;
|
|
1470
1474
|
exports.kAttaformRegistry = kAttaformRegistry;
|
|
1471
1475
|
exports.kAttaformWizardActiveStepResolver = kAttaformWizardActiveStepResolver;
|
|
@@ -1479,4 +1483,4 @@ exports.segmentsForPathKey = segmentsForPathKey;
|
|
|
1479
1483
|
exports.toError = toError;
|
|
1480
1484
|
exports.useRegistry = useRegistry;
|
|
1481
1485
|
exports.vRegister = vRegister;
|
|
1482
|
-
//# sourceMappingURL=attaform.
|
|
1486
|
+
//# sourceMappingURL=attaform.B7UdTs_o.cjs.map
|