attaform 0.21.2 → 0.23.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 +7 -10
- package/dist/chunks/dev-key-collision-warnings.cjs +0 -33
- package/dist/chunks/dev-key-collision-warnings.cjs.map +1 -1
- package/dist/chunks/dev-key-collision-warnings.mjs +1 -33
- package/dist/chunks/dev-key-collision-warnings.mjs.map +1 -1
- package/dist/chunks/devtools.cjs +3 -5
- package/dist/chunks/devtools.cjs.map +1 -1
- package/dist/chunks/devtools.mjs +3 -5
- package/dist/chunks/devtools.mjs.map +1 -1
- package/dist/chunks/fingerprint2.cjs +1 -1
- package/dist/chunks/fingerprint2.mjs +1 -1
- package/dist/index.cjs +3 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -41
- package/dist/index.d.mts +6 -41
- package/dist/index.d.ts +6 -41
- package/dist/index.mjs +5 -5
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.vue +3 -11
- package/dist/runtime/plugins/attaform.cjs +2 -2
- package/dist/runtime/plugins/attaform.mjs +2 -2
- package/dist/shared/{attaform.BGf_J22U.d.ts → attaform.BGMRvckW.d.ts} +11 -70
- package/dist/shared/{attaform.ory-3WhV.d.mts → attaform.BJnNK75Y.d.cts} +41 -491
- package/dist/shared/{attaform.ory-3WhV.d.ts → attaform.BJnNK75Y.d.mts} +41 -491
- package/dist/shared/{attaform.ory-3WhV.d.cts → attaform.BJnNK75Y.d.ts} +41 -491
- package/dist/shared/{attaform.DP-u7_tk.mjs → attaform.BhI9Icek.mjs} +17 -291
- package/dist/shared/attaform.BhI9Icek.mjs.map +1 -0
- package/dist/shared/{attaform.BwLp9KM7.cjs → attaform.BibT5AS_.cjs} +2 -2
- package/dist/shared/{attaform.BwLp9KM7.cjs.map → attaform.BibT5AS_.cjs.map} +1 -1
- package/dist/shared/{attaform.DkA5J8NW.d.cts → attaform.CO0e7YVY.d.cts} +1 -46
- package/dist/shared/{attaform.DkA5J8NW.d.ts → attaform.CO0e7YVY.d.mts} +1 -46
- package/dist/shared/{attaform.DkA5J8NW.d.mts → attaform.CO0e7YVY.d.ts} +1 -46
- package/dist/shared/{attaform.BwrowMp2.cjs → attaform.CaYj3ZfY.cjs} +3 -3
- package/dist/shared/{attaform.BwrowMp2.cjs.map → attaform.CaYj3ZfY.cjs.map} +1 -1
- package/dist/shared/{attaform.BBDIKtKY.cjs → attaform.Cmb_LCie.cjs} +4 -4
- package/dist/shared/{attaform.BVeLgfEh.mjs.map → attaform.Cmb_LCie.cjs.map} +1 -1
- package/dist/shared/{attaform.CTheKoTc.mjs → attaform.CtJOd7ox.mjs} +446 -525
- package/dist/shared/attaform.CtJOd7ox.mjs.map +1 -0
- package/dist/shared/{attaform.CrD73S4m.mjs → attaform.CzVta5o2.mjs} +116 -47
- package/dist/shared/attaform.CzVta5o2.mjs.map +1 -0
- package/dist/shared/{attaform.CnEl--PF.d.mts → attaform.D52oJiYC.d.cts} +1 -1
- package/dist/shared/{attaform.BoY6RZUl.d.cts → attaform.DCkSNnPr.d.mts} +1 -1
- package/dist/shared/{attaform.B5LNzqQh.cjs → attaform.Db4E4IW6.cjs} +18 -297
- package/dist/shared/attaform.Db4E4IW6.cjs.map +1 -0
- package/dist/shared/{attaform.CcnF1AKJ.cjs → attaform.DbyTD8N2.cjs} +116 -47
- package/dist/shared/attaform.DbyTD8N2.cjs.map +1 -0
- package/dist/shared/{attaform.D6GYGshL.mjs → attaform.Dd1Kmmaj.mjs} +3 -3
- package/dist/shared/{attaform.D6GYGshL.mjs.map → attaform.Dd1Kmmaj.mjs.map} +1 -1
- package/dist/shared/{attaform.BCcrLApm.d.mts → attaform.DrY8srOp.d.mts} +11 -70
- package/dist/shared/{attaform.D2ZuIOCf.cjs → attaform.DsQkXE3o.cjs} +445 -534
- package/dist/shared/attaform.DsQkXE3o.cjs.map +1 -0
- package/dist/shared/{attaform.BkjJfMvJ.d.cts → attaform.DuPneYR0.d.cts} +11 -70
- package/dist/shared/{attaform.C41gjp-a.mjs → attaform.Dx9-QQE2.mjs} +2 -2
- package/dist/shared/{attaform.C41gjp-a.mjs.map → attaform.Dx9-QQE2.mjs.map} +1 -1
- package/dist/shared/{attaform.BYgioWLF.d.ts → attaform.WEwfXcHq.d.ts} +1 -1
- package/dist/shared/{attaform.BVeLgfEh.mjs → attaform.alpG7rT7.mjs} +4 -4
- package/dist/shared/{attaform.BBDIKtKY.cjs.map → attaform.alpG7rT7.mjs.map} +1 -1
- package/dist/zod-v3.cjs +2 -2
- package/dist/zod-v3.d.cts +3 -3
- package/dist/zod-v3.d.mts +3 -3
- package/dist/zod-v3.d.ts +3 -3
- 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.d.cts +5 -5
- package/dist/zod.d.mts +5 -5
- package/dist/zod.d.ts +5 -5
- package/dist/zod.mjs +5 -5
- package/package.json +2 -2
- package/dist/chunks/indexeddb.cjs +0 -119
- package/dist/chunks/indexeddb.cjs.map +0 -1
- package/dist/chunks/indexeddb.mjs +0 -117
- package/dist/chunks/indexeddb.mjs.map +0 -1
- package/dist/chunks/local-storage.cjs +0 -58
- package/dist/chunks/local-storage.cjs.map +0 -1
- package/dist/chunks/local-storage.mjs +0 -56
- package/dist/chunks/local-storage.mjs.map +0 -1
- package/dist/chunks/multi-tab-sync.cjs +0 -367
- package/dist/chunks/multi-tab-sync.cjs.map +0 -1
- package/dist/chunks/multi-tab-sync.mjs +0 -364
- package/dist/chunks/multi-tab-sync.mjs.map +0 -1
- package/dist/chunks/session-storage.cjs +0 -58
- package/dist/chunks/session-storage.cjs.map +0 -1
- package/dist/chunks/session-storage.mjs +0 -56
- package/dist/chunks/session-storage.mjs.map +0 -1
- package/dist/chunks/wire-persistence.cjs +0 -396
- package/dist/chunks/wire-persistence.cjs.map +0 -1
- package/dist/chunks/wire-persistence.mjs +0 -394
- package/dist/chunks/wire-persistence.mjs.map +0 -1
- package/dist/shared/attaform.B5LNzqQh.cjs.map +0 -1
- package/dist/shared/attaform.CTheKoTc.mjs.map +0 -1
- package/dist/shared/attaform.CcnF1AKJ.cjs.map +0 -1
- package/dist/shared/attaform.CrD73S4m.mjs.map +0 -1
- package/dist/shared/attaform.D2ZuIOCf.cjs.map +0 -1
- package/dist/shared/attaform.DP-u7_tk.mjs.map +0 -1
|
@@ -4,9 +4,6 @@ const vue = require('vue');
|
|
|
4
4
|
|
|
5
5
|
const __DEV__ = (typeof process !== "undefined" ? process.env.NODE_ENV : "production") !== "production";
|
|
6
6
|
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
10
7
|
class AttaformError extends Error {
|
|
11
8
|
constructor(message, options) {
|
|
12
9
|
super(message, options);
|
|
@@ -50,24 +47,6 @@ class ReservedFormKeyError extends AttaformError {
|
|
|
50
47
|
);
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
|
-
class AnonPersistError extends AttaformError {
|
|
54
|
-
constructor(opts) {
|
|
55
|
-
super(formatAnonPersistMessage(opts));
|
|
56
|
-
__publicField(this, "schemaFields");
|
|
57
|
-
__publicField(this, "callSite");
|
|
58
|
-
__publicField(this, "cause");
|
|
59
|
-
this.schemaFields = opts.schemaFields;
|
|
60
|
-
this.callSite = opts.callSite;
|
|
61
|
-
this.cause = opts.cause;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function formatAnonPersistMessage(opts) {
|
|
65
|
-
const head = opts.cause === "no-key" ? `useForm({ persist: ... }) requires an explicit \`key:\`. Anonymous synthetic keys (\`__atta:anon:*\`) drift across mounts and can collide between unrelated forms \u2014 refusing to persist to a non-deterministic location.` : `register(_, { persist: true }) declared on a form whose useForm() options have no \`persist:\` configured. The opt-in is recorded but nothing would ever land in storage.`;
|
|
66
|
-
const fields = opts.schemaFields !== void 0 && opts.schemaFields.length > 0 ? ` Form fields: { ${opts.schemaFields.join(", ")} }.` : "";
|
|
67
|
-
const fix = opts.cause === "no-key" ? ` Fix: add \`key: '<stable-id>'\` to useForm().` : ` Fix: add \`persist: 'session'\` (or 'local') and \`key:\` to useForm(), or remove \`{ persist: true }\` from this register() call.`;
|
|
68
|
-
const where = opts.callSite !== void 0 ? ` ${opts.callSite}` : "";
|
|
69
|
-
return `[attaform] ${head}${fields}${fix}${where}`;
|
|
70
|
-
}
|
|
71
50
|
|
|
72
51
|
function detectSSR(options = {}) {
|
|
73
52
|
if (options.ssr !== void 0) return options.ssr;
|
|
@@ -619,21 +598,6 @@ function readFilesFromInput(el) {
|
|
|
619
598
|
if (files === null || files.length === 0) return null;
|
|
620
599
|
return files.item(0);
|
|
621
600
|
}
|
|
622
|
-
const warnedPersistedFileForms = __DEV__ ? /* @__PURE__ */ new WeakMap() : null;
|
|
623
|
-
function maybeWarnPersistedFile(value) {
|
|
624
|
-
if (!__DEV__ || warnedPersistedFileForms === null) return;
|
|
625
|
-
if (value.persist !== true) return;
|
|
626
|
-
let warnedPaths = warnedPersistedFileForms.get(value.persistOptIns);
|
|
627
|
-
if (warnedPaths === void 0) {
|
|
628
|
-
warnedPaths = /* @__PURE__ */ new Set();
|
|
629
|
-
warnedPersistedFileForms.set(value.persistOptIns, warnedPaths);
|
|
630
|
-
}
|
|
631
|
-
if (warnedPaths.has(value.path)) return;
|
|
632
|
-
warnedPaths.add(value.path);
|
|
633
|
-
vue.warn(
|
|
634
|
-
`[attaform] register('${value.path}', { persist: true }) on <input type="file"> \u2014 files can't ride a refresh (browsers block programmatic writes to <input type="file">), so this path won't be saved. For long-lived flows, upload on selection and persist the resulting URL or ID in a sibling string field.`
|
|
635
|
-
);
|
|
636
|
-
}
|
|
637
601
|
const fileScopeKey = Symbol.for("attaform:file-scope");
|
|
638
602
|
const vRegisterFile = {
|
|
639
603
|
created(el, { value }, vnode) {
|
|
@@ -641,7 +605,6 @@ const vRegisterFile = {
|
|
|
641
605
|
const input = el;
|
|
642
606
|
value.registerElement(input);
|
|
643
607
|
setAssignFunction(input, vnode, value);
|
|
644
|
-
maybeWarnPersistedFile(value);
|
|
645
608
|
const currentRaw = value.innerRef.value;
|
|
646
609
|
if (isBlankFileValue(currentRaw)) {
|
|
647
610
|
const blankShape = isMultipleInput(input, vnode) ? [] : null;
|
|
@@ -691,250 +654,11 @@ const vRegisterFile = {
|
|
|
691
654
|
}
|
|
692
655
|
};
|
|
693
656
|
|
|
694
|
-
const idGenerator = /* @__PURE__ */ (() => {
|
|
695
|
-
let counter = 0;
|
|
696
|
-
return () => `el-${++counter}`;
|
|
697
|
-
})();
|
|
698
|
-
const elementIds = /* @__PURE__ */ new WeakMap();
|
|
699
|
-
function getOrAssignElementId(el) {
|
|
700
|
-
let id = elementIds.get(el);
|
|
701
|
-
if (id === void 0) {
|
|
702
|
-
id = idGenerator();
|
|
703
|
-
elementIds.set(el, id);
|
|
704
|
-
}
|
|
705
|
-
return id;
|
|
706
|
-
}
|
|
707
|
-
function createPersistOptInRegistry() {
|
|
708
|
-
const byPath = /* @__PURE__ */ new Map();
|
|
709
|
-
function add(elementId, path) {
|
|
710
|
-
const existing = byPath.get(path);
|
|
711
|
-
if (existing === void 0) {
|
|
712
|
-
byPath.set(path, /* @__PURE__ */ new Set([elementId]));
|
|
713
|
-
return;
|
|
714
|
-
}
|
|
715
|
-
existing.add(elementId);
|
|
716
|
-
}
|
|
717
|
-
function remove(elementId, path) {
|
|
718
|
-
const existing = byPath.get(path);
|
|
719
|
-
if (existing === void 0) return;
|
|
720
|
-
existing.delete(elementId);
|
|
721
|
-
if (existing.size === 0) byPath.delete(path);
|
|
722
|
-
}
|
|
723
|
-
function removeAllFor(elementId) {
|
|
724
|
-
for (const [path, ids] of byPath) {
|
|
725
|
-
if (!ids.delete(elementId)) continue;
|
|
726
|
-
if (ids.size === 0) byPath.delete(path);
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
function hasOptIn(elementId, path) {
|
|
730
|
-
return byPath.get(path)?.has(elementId) ?? false;
|
|
731
|
-
}
|
|
732
|
-
function hasAnyOptInForPath(path) {
|
|
733
|
-
const ids = byPath.get(path);
|
|
734
|
-
return ids !== void 0 && ids.size > 0;
|
|
735
|
-
}
|
|
736
|
-
function optedInPaths() {
|
|
737
|
-
return byPath.keys();
|
|
738
|
-
}
|
|
739
|
-
function isEmpty() {
|
|
740
|
-
return byPath.size === 0;
|
|
741
|
-
}
|
|
742
|
-
function clear() {
|
|
743
|
-
byPath.clear();
|
|
744
|
-
}
|
|
745
|
-
return {
|
|
746
|
-
add,
|
|
747
|
-
remove,
|
|
748
|
-
removeAllFor,
|
|
749
|
-
hasOptIn,
|
|
750
|
-
hasAnyOptInForPath,
|
|
751
|
-
optedInPaths,
|
|
752
|
-
isEmpty,
|
|
753
|
-
clear
|
|
754
|
-
};
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
const DEFAULT_SENSITIVE_NAMES = Object.freeze([
|
|
758
|
-
// Passwords + PIN-like
|
|
759
|
-
"password",
|
|
760
|
-
"passwd",
|
|
761
|
-
"pwd",
|
|
762
|
-
"pin",
|
|
763
|
-
// Card / payment
|
|
764
|
-
"cvv",
|
|
765
|
-
"cvc",
|
|
766
|
-
"card_number",
|
|
767
|
-
"card_num",
|
|
768
|
-
"card",
|
|
769
|
-
"iban",
|
|
770
|
-
"routing_number",
|
|
771
|
-
"account_number",
|
|
772
|
-
// Government / identity
|
|
773
|
-
"ssn",
|
|
774
|
-
"social_security",
|
|
775
|
-
"dob",
|
|
776
|
-
"date_of_birth",
|
|
777
|
-
"passport",
|
|
778
|
-
"driver_license",
|
|
779
|
-
// Tax IDs
|
|
780
|
-
"tin",
|
|
781
|
-
"ein",
|
|
782
|
-
"itin",
|
|
783
|
-
"tax_id",
|
|
784
|
-
// Tokens / secrets / API auth
|
|
785
|
-
"token",
|
|
786
|
-
"tokens",
|
|
787
|
-
"secret",
|
|
788
|
-
"secrets",
|
|
789
|
-
"api_key",
|
|
790
|
-
"api_secret",
|
|
791
|
-
"api_token",
|
|
792
|
-
"private_key",
|
|
793
|
-
"bearer",
|
|
794
|
-
"oauth",
|
|
795
|
-
"auth_token",
|
|
796
|
-
"access_token",
|
|
797
|
-
"refresh_token",
|
|
798
|
-
"session_id",
|
|
799
|
-
"session_key",
|
|
800
|
-
"session_token",
|
|
801
|
-
// MFA / OTP
|
|
802
|
-
"otp",
|
|
803
|
-
"one_time_password",
|
|
804
|
-
"one_time_code",
|
|
805
|
-
"mfa_secret",
|
|
806
|
-
"mfa_seed",
|
|
807
|
-
"mfa_code",
|
|
808
|
-
"mfa_token",
|
|
809
|
-
"two_factor_code",
|
|
810
|
-
"two_factor_token",
|
|
811
|
-
"2fa",
|
|
812
|
-
"2fa_code",
|
|
813
|
-
"2fa_token",
|
|
814
|
-
"recovery_code",
|
|
815
|
-
"backup_code"
|
|
816
|
-
]);
|
|
817
|
-
const WORD_BOUNDARY_THRESHOLD = 5;
|
|
818
|
-
function escapeRegex(s) {
|
|
819
|
-
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
820
|
-
}
|
|
821
|
-
function nameToRegex(name) {
|
|
822
|
-
const parts = name.split(/[_\s-]/).filter((p) => p.length > 0);
|
|
823
|
-
if (parts.length === 0) {
|
|
824
|
-
return /(?!)/;
|
|
825
|
-
}
|
|
826
|
-
const escaped = parts.map(escapeRegex).join("[_\\s-]?");
|
|
827
|
-
const compactLength = parts.reduce((sum, p) => sum + p.length, 0);
|
|
828
|
-
const useBoundary = compactLength <= WORD_BOUNDARY_THRESHOLD;
|
|
829
|
-
const source = useBoundary ? `\\b${escaped}\\b` : escaped;
|
|
830
|
-
return new RegExp(source, "i");
|
|
831
|
-
}
|
|
832
|
-
function namesToPatterns(names) {
|
|
833
|
-
const patterns = [];
|
|
834
|
-
for (const name of names) {
|
|
835
|
-
if (typeof name !== "string" || name.length === 0) continue;
|
|
836
|
-
patterns.push(nameToRegex(name));
|
|
837
|
-
}
|
|
838
|
-
return patterns;
|
|
839
|
-
}
|
|
840
|
-
const DEFAULT_PATTERNS = namesToPatterns(DEFAULT_SENSITIVE_NAMES);
|
|
841
|
-
function createSegmentMatchesSensitive(names = DEFAULT_SENSITIVE_NAMES) {
|
|
842
|
-
const patterns = names === DEFAULT_SENSITIVE_NAMES ? DEFAULT_PATTERNS : namesToPatterns(names);
|
|
843
|
-
return (segment) => {
|
|
844
|
-
if (typeof segment !== "string") return false;
|
|
845
|
-
for (const p of patterns) {
|
|
846
|
-
if (p.test(segment)) return true;
|
|
847
|
-
}
|
|
848
|
-
return false;
|
|
849
|
-
};
|
|
850
|
-
}
|
|
851
|
-
function createIsSensitivePath(names = DEFAULT_SENSITIVE_NAMES) {
|
|
852
|
-
const segmentMatches = createSegmentMatchesSensitive(names);
|
|
853
|
-
return (path) => {
|
|
854
|
-
if (typeof path !== "string") {
|
|
855
|
-
for (const segment of path) {
|
|
856
|
-
if (segmentMatches(segment)) return true;
|
|
857
|
-
}
|
|
858
|
-
return false;
|
|
859
|
-
}
|
|
860
|
-
if (path.startsWith("[")) {
|
|
861
|
-
try {
|
|
862
|
-
const parsed = JSON.parse(path);
|
|
863
|
-
if (Array.isArray(parsed)) {
|
|
864
|
-
for (const segment of parsed) {
|
|
865
|
-
if (segmentMatches(segment)) return true;
|
|
866
|
-
}
|
|
867
|
-
return false;
|
|
868
|
-
}
|
|
869
|
-
} catch {
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
for (const segment of path.split(".")) {
|
|
873
|
-
if (segmentMatches(segment)) return true;
|
|
874
|
-
}
|
|
875
|
-
return false;
|
|
876
|
-
};
|
|
877
|
-
}
|
|
878
|
-
const defaultIsSensitivePath = createIsSensitivePath();
|
|
879
|
-
function isSensitivePath(path) {
|
|
880
|
-
return defaultIsSensitivePath(path);
|
|
881
|
-
}
|
|
882
|
-
const warnedSensitivePersist = __DEV__ ? /* @__PURE__ */ new Set() : null;
|
|
883
|
-
function allowSensitivePersist(path, acknowledged, isSensitive = defaultIsSensitivePath) {
|
|
884
|
-
if (acknowledged) return true;
|
|
885
|
-
if (!isSensitive(path)) return true;
|
|
886
|
-
if (warnedSensitivePersist !== null) {
|
|
887
|
-
const display = Array.isArray(path) ? path.join(".") : String(path);
|
|
888
|
-
if (!warnedSensitivePersist.has(display)) {
|
|
889
|
-
warnedSensitivePersist.add(display);
|
|
890
|
-
console.warn(
|
|
891
|
-
`[attaform] Not persisting "${display}" \u2014 it matches a sensitive-name pattern (password / cvv / ssn / token / etc.) and was opted into persistence without \`acknowledgeSensitive: true\`. Storing sensitive data in client-side storage is a compliance risk (PII / PCI-DSS / HIPAA / SOC2). Persist it server-side, or pass \`acknowledgeSensitive: true\` to register() / form.persist() if this is intentional.`
|
|
892
|
-
);
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
return false;
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
function syncPersistOptIn(el, value, oldValue, vnodeType) {
|
|
899
|
-
const wasOptedIn = isRegisterValue(oldValue) && oldValue.persist === true;
|
|
900
|
-
const isFileInput = el.tagName === "INPUT" && (vnodeType === "file" || el.type === "file");
|
|
901
|
-
const wantsOptIn = !isFileInput && isRegisterValue(value) && value.persist === true;
|
|
902
|
-
if (!wasOptedIn && !wantsOptIn) return;
|
|
903
|
-
const elementId = getOrAssignElementId(el);
|
|
904
|
-
if (wasOptedIn) {
|
|
905
|
-
const old = oldValue;
|
|
906
|
-
const samePathAndRegistry = wantsOptIn && value.path === old.path && value.persistOptIns === old.persistOptIns;
|
|
907
|
-
if (!samePathAndRegistry) {
|
|
908
|
-
old.persistOptIns.remove(elementId, old.path);
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
if (wantsOptIn) {
|
|
912
|
-
const v = value;
|
|
913
|
-
if (allowSensitivePersist(v.path, v.acknowledgeSensitive, v.isSensitivePath)) {
|
|
914
|
-
v.persistOptIns.add(elementId, v.path);
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
function syncMultiTabOptOut(value, oldValue) {
|
|
919
|
-
const wasOptedOut = isRegisterValue(oldValue) && oldValue.unmarkNoSync !== void 0;
|
|
920
|
-
const wantsOptOut = isRegisterValue(value) && value.markNoSync !== void 0;
|
|
921
|
-
if (!wasOptedOut && !wantsOptOut) return;
|
|
922
|
-
if (wasOptedOut) {
|
|
923
|
-
const old = oldValue;
|
|
924
|
-
const samePath = wantsOptOut && value.path === old.path;
|
|
925
|
-
if (!samePath) old.unmarkNoSync?.();
|
|
926
|
-
}
|
|
927
|
-
if (wantsOptOut) {
|
|
928
|
-
const v = value;
|
|
929
|
-
const samePathOld = wasOptedOut && oldValue.path === v.path;
|
|
930
|
-
if (!samePathOld) v.markNoSync?.();
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
657
|
function syncElementRegistration(el, value, oldValue) {
|
|
934
658
|
const wasRegistered = isRegisterValue(oldValue);
|
|
935
659
|
const isRegistered = isRegisterValue(value);
|
|
936
660
|
if (!wasRegistered && !isRegistered) return;
|
|
937
|
-
const samePathAndStore = wasRegistered && isRegistered && oldValue.path === value.path && oldValue.
|
|
661
|
+
const samePathAndStore = wasRegistered && isRegistered && oldValue.path === value.path && oldValue.formKey === value.formKey;
|
|
938
662
|
if (wasRegistered && !samePathAndStore) {
|
|
939
663
|
oldValue.deregisterElement(el);
|
|
940
664
|
}
|
|
@@ -1455,8 +1179,6 @@ function getCheckboxValue(el, checked) {
|
|
|
1455
1179
|
const warnedUnsupportedElements = __DEV__ ? /* @__PURE__ */ new WeakSet() : null;
|
|
1456
1180
|
const vRegisterDynamic = {
|
|
1457
1181
|
created(el, binding, vnode) {
|
|
1458
|
-
syncPersistOptIn(el, binding.value, void 0, vnode.props?.["type"]);
|
|
1459
|
-
syncMultiTabOptOut(binding.value, void 0);
|
|
1460
1182
|
callModelHook(el, binding, vnode, null, "created");
|
|
1461
1183
|
if (isRegisterValue(binding.value)) setupAria(el, binding.value, vnode);
|
|
1462
1184
|
},
|
|
@@ -1478,8 +1200,6 @@ const vRegisterDynamic = {
|
|
|
1478
1200
|
}
|
|
1479
1201
|
},
|
|
1480
1202
|
beforeUpdate(el, binding, vnode, prevVNode) {
|
|
1481
|
-
syncPersistOptIn(el, binding.value, binding.oldValue, vnode.props?.["type"]);
|
|
1482
|
-
syncMultiTabOptOut(binding.value, binding.oldValue);
|
|
1483
1203
|
syncElementRegistration(el, binding.value, binding.oldValue);
|
|
1484
1204
|
callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
|
|
1485
1205
|
const ariaEl = el;
|
|
@@ -1505,10 +1225,6 @@ const vRegisterDynamic = {
|
|
|
1505
1225
|
removeTrackedListeners(el);
|
|
1506
1226
|
teardownAria(el);
|
|
1507
1227
|
teardownValueSync(el);
|
|
1508
|
-
if (isRegisterValue(value)) {
|
|
1509
|
-
value.persistOptIns.removeAllFor(getOrAssignElementId(el));
|
|
1510
|
-
value.unmarkNoSync?.();
|
|
1511
|
-
}
|
|
1512
1228
|
if (!isRegisterValue(value)) return;
|
|
1513
1229
|
value.deregisterElement(el);
|
|
1514
1230
|
delete el.composing;
|
|
@@ -1672,17 +1388,20 @@ function canonicalizePath(input) {
|
|
|
1672
1388
|
if (typeof input === "string") {
|
|
1673
1389
|
const cached = canonicalStringCache.get(input);
|
|
1674
1390
|
if (cached !== void 0) return cached;
|
|
1675
|
-
const
|
|
1676
|
-
const
|
|
1677
|
-
const entry = { segments
|
|
1391
|
+
const segments = parseDottedPath(input);
|
|
1392
|
+
const key = JSON.stringify(segments);
|
|
1393
|
+
const entry = { segments, key };
|
|
1678
1394
|
if (canonicalStringCache.size >= CANONICAL_STRING_CACHE_MAX) {
|
|
1679
1395
|
const oldest = canonicalStringCache.keys().next().value;
|
|
1680
1396
|
if (oldest !== void 0) canonicalStringCache.delete(oldest);
|
|
1681
1397
|
}
|
|
1682
1398
|
canonicalStringCache.set(input, entry);
|
|
1683
|
-
rememberSegmentsForPathKey(
|
|
1399
|
+
rememberSegmentsForPathKey(key, segments);
|
|
1684
1400
|
return entry;
|
|
1685
1401
|
}
|
|
1402
|
+
return keyForSegments(input);
|
|
1403
|
+
}
|
|
1404
|
+
function keyForSegments(input) {
|
|
1686
1405
|
const segments = Array.from(input).map(normalizeSegment);
|
|
1687
1406
|
const key = JSON.stringify(segments);
|
|
1688
1407
|
rememberSegmentsForPathKey(key, segments);
|
|
@@ -1719,10 +1438,15 @@ function isPathPrefix(prefix, path) {
|
|
|
1719
1438
|
}
|
|
1720
1439
|
return true;
|
|
1721
1440
|
}
|
|
1441
|
+
function pathsEqual(a, b) {
|
|
1442
|
+
if (a.length !== b.length) return false;
|
|
1443
|
+
for (let i = 0; i < a.length; i++) {
|
|
1444
|
+
if (a[i] !== b[i]) return false;
|
|
1445
|
+
}
|
|
1446
|
+
return true;
|
|
1447
|
+
}
|
|
1722
1448
|
|
|
1723
|
-
exports.AnonPersistError = AnonPersistError;
|
|
1724
1449
|
exports.AttaformError = AttaformError;
|
|
1725
|
-
exports.DEFAULT_SENSITIVE_NAMES = DEFAULT_SENSITIVE_NAMES;
|
|
1726
1450
|
exports.FORM_ERRORS_PATH = FORM_ERRORS_PATH;
|
|
1727
1451
|
exports.FORM_ERRORS_PATH_KEY = FORM_ERRORS_PATH_KEY;
|
|
1728
1452
|
exports.INTERACTIVE_TAG_NAMES = INTERACTIVE_TAG_NAMES;
|
|
@@ -1737,29 +1461,26 @@ exports.ReservedFormKeyError = ReservedFormKeyError;
|
|
|
1737
1461
|
exports.SubmitErrorHandlerError = SubmitErrorHandlerError;
|
|
1738
1462
|
exports.V_REGISTER_MARKER = V_REGISTER_MARKER;
|
|
1739
1463
|
exports.__DEV__ = __DEV__;
|
|
1740
|
-
exports.allowSensitivePersist = allowSensitivePersist;
|
|
1741
1464
|
exports.assignKey = assignKey;
|
|
1742
1465
|
exports.canonicalizePath = canonicalizePath;
|
|
1743
1466
|
exports.coerceToPathKey = coerceToPathKey;
|
|
1744
1467
|
exports.createAttaform = createAttaform;
|
|
1745
|
-
exports.createIsSensitivePath = createIsSensitivePath;
|
|
1746
|
-
exports.createPersistOptInRegistry = createPersistOptInRegistry;
|
|
1747
1468
|
exports.createRegistry = createRegistry;
|
|
1748
1469
|
exports.ensureAttaformInstalled = ensureAttaformInstalled;
|
|
1749
|
-
exports.getOrAssignElementId = getOrAssignElementId;
|
|
1750
1470
|
exports.getRegistryFromApp = getRegistryFromApp;
|
|
1751
1471
|
exports.isPathPrefix = isPathPrefix;
|
|
1752
1472
|
exports.isRegisterValue = isRegisterValue;
|
|
1753
|
-
exports.isSensitivePath = isSensitivePath;
|
|
1754
1473
|
exports.kAttaformAncestorWizard = kAttaformAncestorWizard;
|
|
1755
1474
|
exports.kAttaformRegistry = kAttaformRegistry;
|
|
1756
1475
|
exports.kAttaformWizardActiveStepResolver = kAttaformWizardActiveStepResolver;
|
|
1757
1476
|
exports.kFormContext = kFormContext;
|
|
1758
1477
|
exports.kFormInstanceId = kFormInstanceId;
|
|
1478
|
+
exports.keyForSegments = keyForSegments;
|
|
1759
1479
|
exports.parseDottedPath = parseDottedPath;
|
|
1760
1480
|
exports.pathKeyToDotted = pathKeyToDotted;
|
|
1481
|
+
exports.pathsEqual = pathsEqual;
|
|
1761
1482
|
exports.segmentsForPathKey = segmentsForPathKey;
|
|
1762
1483
|
exports.toError = toError;
|
|
1763
1484
|
exports.useRegistry = useRegistry;
|
|
1764
1485
|
exports.vRegister = vRegister;
|
|
1765
|
-
//# sourceMappingURL=attaform.
|
|
1486
|
+
//# sourceMappingURL=attaform.Db4E4IW6.cjs.map
|