a11y-elements 0.4.0 → 0.6.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 +210 -18
- package/dist/a11y-dark.css +31 -0
- package/dist/a11y.css +253 -166
- package/dist/all.d.ts +2 -1
- package/dist/all.js +2 -1
- package/dist/all.js.map +1 -1
- package/dist/browser/all.js +49 -42
- package/dist/browser/{chunk-UCAUEEED.js → chunk-2NVBEX7S.js} +5 -5
- package/dist/browser/{chunk-UCAUEEED.js.map → chunk-2NVBEX7S.js.map} +1 -1
- package/dist/browser/{chunk-A32U5MX7.js → chunk-2ZZTJUCP.js} +3 -3
- package/dist/browser/{chunk-HLID3PP5.js → chunk-34XMXDXI.js} +3 -3
- package/dist/browser/{chunk-O4AJULBZ.js → chunk-4SU2MZLZ.js} +8 -8
- package/dist/browser/chunk-4SU2MZLZ.js.map +1 -0
- package/dist/browser/{chunk-VY6BZLCJ.js → chunk-5AG6BS4G.js} +3 -3
- package/dist/browser/{chunk-6BOK3R6K.js → chunk-5MZZUC7J.js} +3 -3
- package/dist/browser/{chunk-3UC2S6JJ.js → chunk-5VP2UQ2M.js} +5 -4
- package/dist/browser/chunk-5VP2UQ2M.js.map +1 -0
- package/dist/browser/{chunk-SYKTM7WJ.js → chunk-67ZOQAXV.js} +3 -3
- package/dist/browser/{chunk-R4OVZULJ.js → chunk-6G3UL7FH.js} +8 -6
- package/dist/browser/chunk-6G3UL7FH.js.map +1 -0
- package/dist/browser/{chunk-QT7Z23GS.js → chunk-73Y3YTSE.js} +3 -3
- package/dist/browser/{chunk-2YF57VSU.js → chunk-7H2JJLCH.js} +3 -3
- package/dist/browser/{chunk-3RRJOPEF.js → chunk-7NNZKO4M.js} +2 -2
- package/dist/browser/{chunk-ABTLBDUK.js → chunk-ACNPSWNA.js} +3 -3
- package/dist/browser/{chunk-4IURHUQU.js → chunk-BIPMRVAZ.js} +12 -10
- package/dist/browser/chunk-BIPMRVAZ.js.map +1 -0
- package/dist/browser/{chunk-P42KF3NM.js → chunk-BRTWVAIT.js} +4 -4
- package/dist/browser/chunk-BRTWVAIT.js.map +1 -0
- package/dist/browser/{chunk-ACOSO5NE.js → chunk-C3FJNOYD.js} +21 -12
- package/dist/browser/chunk-C3FJNOYD.js.map +1 -0
- package/dist/browser/{chunk-EAASMTBS.js → chunk-CKKI36NF.js} +16 -13
- package/dist/browser/chunk-CKKI36NF.js.map +1 -0
- package/dist/browser/{chunk-NI7PACR4.js → chunk-EOB4TM57.js} +3 -3
- package/dist/browser/{chunk-CXUZEGZY.js → chunk-F4AVN6JZ.js} +3 -3
- package/dist/browser/chunk-F4AVN6JZ.js.map +1 -0
- package/dist/browser/{chunk-I4KOJO4B.js → chunk-FFPWED5A.js} +3 -3
- package/dist/browser/{chunk-KUTHJLZ5.js → chunk-IAXHGJ62.js} +8 -5
- package/dist/browser/chunk-IAXHGJ62.js.map +1 -0
- package/dist/browser/{chunk-NTNPE4TH.js → chunk-IL347KK3.js} +28 -11
- package/dist/browser/chunk-IL347KK3.js.map +1 -0
- package/dist/browser/{chunk-S7GPESLQ.js → chunk-LCRRFDV5.js} +19 -7
- package/dist/browser/chunk-LCRRFDV5.js.map +1 -0
- package/dist/browser/{chunk-FXHJKL3U.js → chunk-MENBNSBN.js} +9 -10
- package/dist/browser/chunk-MENBNSBN.js.map +1 -0
- package/dist/browser/chunk-MENQDLBL.js +81 -0
- package/dist/browser/chunk-MENQDLBL.js.map +1 -0
- package/dist/browser/{chunk-GUKQIHPM.js → chunk-MG2YZ7AD.js} +3 -3
- package/dist/browser/{chunk-4FHDXZ3L.js → chunk-N7AMX7RC.js} +7 -7
- package/dist/browser/{chunk-4FHDXZ3L.js.map → chunk-N7AMX7RC.js.map} +1 -1
- package/dist/browser/{chunk-LQ34M47I.js → chunk-NEQKRAIP.js} +2 -2
- package/dist/browser/chunk-PTU2DM52.js +169 -0
- package/dist/browser/chunk-PTU2DM52.js.map +1 -0
- package/dist/browser/chunk-PWR4UC47.js +122 -0
- package/dist/browser/chunk-PWR4UC47.js.map +1 -0
- package/dist/browser/{chunk-GDJTILU4.js → chunk-QT3RDF3H.js} +3 -3
- package/dist/browser/{chunk-6Q6VW435.js → chunk-SGSOENNQ.js} +23 -11
- package/dist/browser/chunk-SGSOENNQ.js.map +1 -0
- package/dist/browser/{chunk-A5CV54CT.js → chunk-SQ7OFQMX.js} +5 -4
- package/dist/browser/chunk-SQ7OFQMX.js.map +1 -0
- package/dist/browser/{chunk-ISWQOJT7.js → chunk-SREYEWDY.js} +3 -3
- package/dist/browser/{chunk-HPTH4SJ2.js → chunk-UOOA4WYM.js} +3 -3
- package/dist/browser/{chunk-SIQUYA37.js → chunk-VZZ6PGGW.js} +17 -11
- package/dist/browser/chunk-VZZ6PGGW.js.map +1 -0
- package/dist/browser/{chunk-ZMCETLOQ.js → chunk-WQJUSHAX.js} +5 -4
- package/dist/browser/chunk-WQJUSHAX.js.map +1 -0
- package/dist/browser/{chunk-HGPHWR3R.js → chunk-WRM4HPFX.js} +3 -3
- package/dist/browser/chunk-XNWCI66X.js +202 -0
- package/dist/browser/chunk-XNWCI66X.js.map +1 -0
- package/dist/browser/{chunk-TTP33GXU.js → chunk-ZCMKKXSE.js} +32 -5
- package/dist/browser/chunk-ZCMKKXSE.js.map +1 -0
- package/dist/browser/{chunk-GKNBHWGY.js → chunk-ZLIFEZUJ.js} +3 -3
- package/dist/browser/components/anchor/define.js +3 -3
- package/dist/browser/components/avatar/define.js +3 -2
- package/dist/browser/components/card-link/define.js +3 -3
- package/dist/browser/components/checkbox/define.js +3 -3
- package/dist/browser/components/checkbox-group/define.js +3 -3
- package/dist/browser/components/file-input/define.js +4 -4
- package/dist/browser/components/focusable/define.js +2 -2
- package/dist/browser/components/input/define.js +4 -4
- package/dist/browser/components/label/define.js +3 -3
- package/dist/browser/components/picture/define.js +3 -3
- package/dist/browser/components/progress/define.js +3 -2
- package/dist/browser/components/radio-group/define.js +3 -3
- package/dist/browser/components/select/define.js +3 -3
- package/dist/browser/components/skeleton/define.js +3 -2
- package/dist/browser/components/spinner/define.js +3 -2
- package/dist/browser/components/switch/define.js +3 -3
- package/dist/browser/components/tabs/define.js +16 -0
- package/dist/browser/components/tabs/define.js.map +1 -0
- package/dist/browser/components/textarea/define.js +4 -4
- package/dist/browser/components/visually-hidden/define.js +2 -2
- package/dist/browser/overlays/blocking-loader/define.js +7 -6
- package/dist/browser/overlays/context-menu/define.js +7 -7
- package/dist/browser/overlays/drawer/define.js +6 -6
- package/dist/browser/overlays/dropdown/define.js +7 -7
- package/dist/browser/overlays/emergency-dialog/define.js +6 -6
- package/dist/browser/overlays/floating/define.js +4 -4
- package/dist/browser/overlays/modal/define.js +10 -7
- package/dist/browser/overlays/notification-banner/define.js +5 -4
- package/dist/browser/overlays/popover/define.js +6 -6
- package/dist/browser/overlays/snackbar/define.js +5 -4
- package/dist/browser/overlays/tooltip/define.js +6 -6
- package/dist/components/avatar/avatar.element.d.ts +5 -3
- package/dist/components/avatar/avatar.element.js +12 -9
- package/dist/components/avatar/avatar.element.js.map +1 -1
- package/dist/components/progress/progress.element.d.ts +4 -1
- package/dist/components/progress/progress.element.js +14 -4
- package/dist/components/progress/progress.element.js.map +1 -1
- package/dist/components/skeleton/skeleton.element.d.ts +1 -2
- package/dist/components/skeleton/skeleton.element.js +3 -3
- package/dist/components/skeleton/skeleton.element.js.map +1 -1
- package/dist/components/spinner/spinner.element.d.ts +2 -2
- package/dist/components/spinner/spinner.element.js +3 -2
- package/dist/components/spinner/spinner.element.js.map +1 -1
- package/dist/components/tabs/define.d.ts +8 -0
- package/dist/components/tabs/define.js +6 -0
- package/dist/components/tabs/define.js.map +1 -0
- package/dist/components/tabs/tabs.element.d.ts +60 -0
- package/dist/components/tabs/tabs.element.js +207 -0
- package/dist/components/tabs/tabs.element.js.map +1 -0
- package/dist/core/a11y-element.d.ts +6 -9
- package/dist/core/a11y-element.js +12 -5
- package/dist/core/a11y-element.js.map +1 -1
- package/dist/core/a11y-overlay-element.d.ts +17 -9
- package/dist/core/a11y-overlay-element.js +24 -11
- package/dist/core/a11y-overlay-element.js.map +1 -1
- package/dist/core/a11y-wrapper-element.d.ts +3 -3
- package/dist/core/a11y-wrapper-element.js +3 -3
- package/dist/core/a11y-wrapper-element.js.map +1 -1
- package/dist/core/dom.d.ts +23 -0
- package/dist/core/dom.js +35 -0
- package/dist/core/dom.js.map +1 -0
- package/dist/core/focus-trap.d.ts +7 -0
- package/dist/core/focus-trap.js +39 -3
- package/dist/core/focus-trap.js.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/overlay-registry.d.ts +27 -8
- package/dist/core/overlay-registry.js +34 -9
- package/dist/core/overlay-registry.js.map +1 -1
- package/dist/core/sanitize.d.ts +2 -6
- package/dist/core/sanitize.js +9 -28
- package/dist/core/sanitize.js.map +1 -1
- package/dist/core/strings.d.ts +4 -0
- package/dist/core/strings.js +2 -0
- package/dist/core/strings.js.map +1 -1
- package/dist/core/template.d.ts +18 -48
- package/dist/core/template.js +27 -213
- package/dist/core/template.js.map +1 -1
- package/dist/overlays/blocking-loader/blocking-loader.element.js +5 -3
- package/dist/overlays/blocking-loader/blocking-loader.element.js.map +1 -1
- package/dist/overlays/core/a11y-anchored-overlay-element.js +3 -3
- package/dist/overlays/core/a11y-anchored-overlay-element.js.map +1 -1
- package/dist/overlays/core/a11y-menu-overlay-element.js +2 -2
- package/dist/overlays/core/a11y-menu-overlay-element.js.map +1 -1
- package/dist/overlays/core/a11y-modal-overlay-element.d.ts +7 -0
- package/dist/overlays/core/a11y-modal-overlay-element.js +29 -4
- package/dist/overlays/core/a11y-modal-overlay-element.js.map +1 -1
- package/dist/overlays/core/a11y-passive-overlay-element.d.ts +4 -4
- package/dist/overlays/core/a11y-passive-overlay-element.js +1 -1
- package/dist/overlays/core/a11y-passive-overlay-element.js.map +1 -1
- package/dist/overlays/drawer/drawer.element.d.ts +2 -1
- package/dist/overlays/drawer/drawer.element.js +2 -1
- package/dist/overlays/drawer/drawer.element.js.map +1 -1
- package/dist/overlays/emergency-dialog/emergency-dialog.element.d.ts +2 -1
- package/dist/overlays/emergency-dialog/emergency-dialog.element.js +2 -1
- package/dist/overlays/emergency-dialog/emergency-dialog.element.js.map +1 -1
- package/dist/overlays/floating/floating.element.d.ts +1 -1
- package/dist/overlays/floating/floating.element.js +3 -3
- package/dist/overlays/floating/floating.element.js.map +1 -1
- package/dist/overlays/modal/confirm-dialog.d.ts +24 -0
- package/dist/overlays/modal/confirm-dialog.js +41 -0
- package/dist/overlays/modal/confirm-dialog.js.map +1 -0
- package/dist/overlays/modal/define.d.ts +1 -0
- package/dist/overlays/modal/define.js +1 -0
- package/dist/overlays/modal/define.js.map +1 -1
- package/dist/overlays/modal/modal.element.d.ts +3 -2
- package/dist/overlays/modal/modal.element.js +2 -1
- package/dist/overlays/modal/modal.element.js.map +1 -1
- package/dist/overlays/notification-banner/define.d.ts +2 -2
- package/dist/overlays/notification-banner/define.js.map +1 -1
- package/dist/overlays/notification-banner/notification-banner.element.d.ts +3 -3
- package/dist/overlays/notification-banner/notification-banner.element.js +2 -8
- package/dist/overlays/notification-banner/notification-banner.element.js.map +1 -1
- package/dist/overlays/popover/popover.element.d.ts +2 -1
- package/dist/overlays/popover/popover.element.js +2 -1
- package/dist/overlays/popover/popover.element.js.map +1 -1
- package/dist/overlays/snackbar/define.d.ts +2 -2
- package/dist/overlays/snackbar/define.js.map +1 -1
- package/dist/overlays/snackbar/snackbar.element.d.ts +2 -2
- package/dist/overlays/snackbar/snackbar.element.js +4 -5
- package/dist/overlays/snackbar/snackbar.element.js.map +1 -1
- package/package.json +3 -2
- package/dist/browser/chunk-3UC2S6JJ.js.map +0 -1
- package/dist/browser/chunk-46SIA3RI.js +0 -410
- package/dist/browser/chunk-46SIA3RI.js.map +0 -1
- package/dist/browser/chunk-4IURHUQU.js.map +0 -1
- package/dist/browser/chunk-6Q6VW435.js.map +0 -1
- package/dist/browser/chunk-A5CV54CT.js.map +0 -1
- package/dist/browser/chunk-ACOSO5NE.js.map +0 -1
- package/dist/browser/chunk-CXUZEGZY.js.map +0 -1
- package/dist/browser/chunk-EAASMTBS.js.map +0 -1
- package/dist/browser/chunk-FXHJKL3U.js.map +0 -1
- package/dist/browser/chunk-GH53G7MU.js +0 -35
- package/dist/browser/chunk-GH53G7MU.js.map +0 -1
- package/dist/browser/chunk-KUTHJLZ5.js.map +0 -1
- package/dist/browser/chunk-NTNPE4TH.js.map +0 -1
- package/dist/browser/chunk-O4AJULBZ.js.map +0 -1
- package/dist/browser/chunk-P42KF3NM.js.map +0 -1
- package/dist/browser/chunk-R4OVZULJ.js.map +0 -1
- package/dist/browser/chunk-S7GPESLQ.js.map +0 -1
- package/dist/browser/chunk-SIQUYA37.js.map +0 -1
- package/dist/browser/chunk-TTP33GXU.js.map +0 -1
- package/dist/browser/chunk-ZMCETLOQ.js.map +0 -1
- /package/dist/browser/{chunk-A32U5MX7.js.map → chunk-2ZZTJUCP.js.map} +0 -0
- /package/dist/browser/{chunk-HLID3PP5.js.map → chunk-34XMXDXI.js.map} +0 -0
- /package/dist/browser/{chunk-VY6BZLCJ.js.map → chunk-5AG6BS4G.js.map} +0 -0
- /package/dist/browser/{chunk-6BOK3R6K.js.map → chunk-5MZZUC7J.js.map} +0 -0
- /package/dist/browser/{chunk-SYKTM7WJ.js.map → chunk-67ZOQAXV.js.map} +0 -0
- /package/dist/browser/{chunk-QT7Z23GS.js.map → chunk-73Y3YTSE.js.map} +0 -0
- /package/dist/browser/{chunk-2YF57VSU.js.map → chunk-7H2JJLCH.js.map} +0 -0
- /package/dist/browser/{chunk-3RRJOPEF.js.map → chunk-7NNZKO4M.js.map} +0 -0
- /package/dist/browser/{chunk-ABTLBDUK.js.map → chunk-ACNPSWNA.js.map} +0 -0
- /package/dist/browser/{chunk-NI7PACR4.js.map → chunk-EOB4TM57.js.map} +0 -0
- /package/dist/browser/{chunk-I4KOJO4B.js.map → chunk-FFPWED5A.js.map} +0 -0
- /package/dist/browser/{chunk-GUKQIHPM.js.map → chunk-MG2YZ7AD.js.map} +0 -0
- /package/dist/browser/{chunk-LQ34M47I.js.map → chunk-NEQKRAIP.js.map} +0 -0
- /package/dist/browser/{chunk-GDJTILU4.js.map → chunk-QT3RDF3H.js.map} +0 -0
- /package/dist/browser/{chunk-ISWQOJT7.js.map → chunk-SREYEWDY.js.map} +0 -0
- /package/dist/browser/{chunk-HPTH4SJ2.js.map → chunk-UOOA4WYM.js.map} +0 -0
- /package/dist/browser/{chunk-HGPHWR3R.js.map → chunk-WRM4HPFX.js.map} +0 -0
- /package/dist/browser/{chunk-GKNBHWGY.js.map → chunk-ZLIFEZUJ.js.map} +0 -0
|
@@ -1,410 +0,0 @@
|
|
|
1
|
-
// src/core/define-element.ts
|
|
2
|
-
function defineElement(tag, ctor) {
|
|
3
|
-
if (!customElements.get(tag)) customElements.define(tag, ctor);
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
// src/core/strings.ts
|
|
7
|
-
var DEFAULT_STRINGS = Object.freeze({
|
|
8
|
-
opensInNewTab: "(opens in new tab)",
|
|
9
|
-
navigatedTo: "Navigated to {name}",
|
|
10
|
-
closeDialog: "Close dialog",
|
|
11
|
-
dismiss: "Dismiss",
|
|
12
|
-
loading: "Loading",
|
|
13
|
-
progress: "Progress",
|
|
14
|
-
avatar: "Avatar",
|
|
15
|
-
characterCount: "{count} / {max}",
|
|
16
|
-
charactersRemaining: "{count} characters remaining",
|
|
17
|
-
characterRemaining: "{count} character remaining",
|
|
18
|
-
selectAll: "Select all",
|
|
19
|
-
browseFiles: "Browse files",
|
|
20
|
-
dropFiles: "or drop files here",
|
|
21
|
-
selectedFiles: "Selected files",
|
|
22
|
-
remove: "Remove",
|
|
23
|
-
removeFile: "Remove {name}",
|
|
24
|
-
fileAdded: "{name} added",
|
|
25
|
-
filesAdded: "{count} files added",
|
|
26
|
-
fileRemoved: "{name} removed",
|
|
27
|
-
fileTypeRejected: "{name} wasn\u2019t added: this type of file isn\u2019t allowed",
|
|
28
|
-
fileSizeRejected: "{name} wasn\u2019t added: it\u2019s larger than {maxSize}",
|
|
29
|
-
fileCountRejected: "{name} wasn\u2019t added: too many files (maximum {max})"
|
|
30
|
-
});
|
|
31
|
-
var STRINGS_CHANGE_EVENT = "a11y-strings-change";
|
|
32
|
-
var STRINGS_KEY = /* @__PURE__ */ Symbol.for("a11y-elements/strings");
|
|
33
|
-
var store = globalThis;
|
|
34
|
-
var strings = store[STRINGS_KEY] ??= { ...DEFAULT_STRINGS };
|
|
35
|
-
for (const [key, value] of Object.entries(DEFAULT_STRINGS)) strings[key] ??= value;
|
|
36
|
-
function setStrings(partial) {
|
|
37
|
-
for (const [key, value] of Object.entries(partial)) {
|
|
38
|
-
if (Object.hasOwn(DEFAULT_STRINGS, key) && typeof value === "string") strings[key] = value;
|
|
39
|
-
}
|
|
40
|
-
document.dispatchEvent(new Event(STRINGS_CHANGE_EVENT));
|
|
41
|
-
}
|
|
42
|
-
function resetStrings() {
|
|
43
|
-
Object.assign(strings, DEFAULT_STRINGS);
|
|
44
|
-
document.dispatchEvent(new Event(STRINGS_CHANGE_EVENT));
|
|
45
|
-
}
|
|
46
|
-
function getString(key) {
|
|
47
|
-
return strings[key];
|
|
48
|
-
}
|
|
49
|
-
function formatString(template, values) {
|
|
50
|
-
return template.replace(/\{(\w+)\}/g, (match, key) => Object.hasOwn(values, key) ? values[key] : match);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// src/core/sanitize.ts
|
|
54
|
-
var STRIPPED_TAGS = /* @__PURE__ */ new Set(["script", "style", "link", "base", "meta"]);
|
|
55
|
-
var FRAME_TAGS = /* @__PURE__ */ new Set(["iframe", "object", "embed", "frame"]);
|
|
56
|
-
var FRAME_URL_ATTRS = /* @__PURE__ */ new Set(["src", "data"]);
|
|
57
|
-
var URL_ATTRS = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "poster", "background", "xlink:href"]);
|
|
58
|
-
var ATTR_ANIMATION_TAGS = /* @__PURE__ */ new Set(["animate", "set"]);
|
|
59
|
-
var SCRIPT_URL = /^javascript:/i;
|
|
60
|
-
var SCRIPT_OR_DATA_URL = /^(javascript|data):/i;
|
|
61
|
-
var ATTR_NAME = /^[a-z_:][-a-z0-9_:.]*$/;
|
|
62
|
-
function sanitizeMarkup(source) {
|
|
63
|
-
const holder = document.createElement("template");
|
|
64
|
-
holder.innerHTML = source;
|
|
65
|
-
sanitizeNode(holder.content);
|
|
66
|
-
return holder.innerHTML;
|
|
67
|
-
}
|
|
68
|
-
function parseSanitized(source, parent) {
|
|
69
|
-
const holder = document.createElement("template");
|
|
70
|
-
const parentEl = parent && parent.nodeType === Node.ELEMENT_NODE ? parent : null;
|
|
71
|
-
let root = holder.content;
|
|
72
|
-
if (parentEl && !templateContent(parentEl)) {
|
|
73
|
-
const context = holder.content.ownerDocument.createElementNS(parentEl.namespaceURI, parentEl.localName);
|
|
74
|
-
context.innerHTML = source;
|
|
75
|
-
root = context;
|
|
76
|
-
} else {
|
|
77
|
-
holder.innerHTML = source;
|
|
78
|
-
}
|
|
79
|
-
sanitizeNode(root);
|
|
80
|
-
return Array.from(root.childNodes);
|
|
81
|
-
}
|
|
82
|
-
function sanitizeAttributes(source) {
|
|
83
|
-
if (source === "" || ATTR_NAME.test(source.toLowerCase()) && isAllowedAttribute(source.toLowerCase(), "")) return source;
|
|
84
|
-
const holder = document.createElement("template");
|
|
85
|
-
holder.innerHTML = `<span ${source}></span>`;
|
|
86
|
-
const el = holder.content.firstElementChild;
|
|
87
|
-
if (!el) return "";
|
|
88
|
-
return Array.from(el.attributes).filter((a) => ATTR_NAME.test(a.name.toLowerCase()) && isAllowedAttribute(a.name.toLowerCase(), a.value)).map((a) => `${a.name}="${a.value.replace(/&/g, "&").replace(/"/g, """)}"`).join(" ");
|
|
89
|
-
}
|
|
90
|
-
function isAllowedAttribute(name, value) {
|
|
91
|
-
if (name.startsWith("on") || name === "srcdoc") return false;
|
|
92
|
-
return !(URL_ATTRS.has(name) && isDangerousUrl(value, SCRIPT_URL));
|
|
93
|
-
}
|
|
94
|
-
function templateContent(el) {
|
|
95
|
-
const content = el.content;
|
|
96
|
-
return content && typeof content.querySelectorAll === "function" ? content : null;
|
|
97
|
-
}
|
|
98
|
-
function sanitizeNode(root) {
|
|
99
|
-
for (const el of Array.from(root.children)) {
|
|
100
|
-
const tag = el.localName.toLowerCase();
|
|
101
|
-
if (STRIPPED_TAGS.has(tag) || animatesUrlAttribute(el, tag)) {
|
|
102
|
-
el.remove();
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
for (const attr of Array.from(el.attributes)) {
|
|
106
|
-
const name = attr.name.toLowerCase();
|
|
107
|
-
if (!isAllowedAttribute(name, attr.value) || FRAME_TAGS.has(tag) && FRAME_URL_ATTRS.has(name) && isDangerousUrl(attr.value, SCRIPT_OR_DATA_URL)) {
|
|
108
|
-
el.removeAttribute(attr.name);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
sanitizeNode(templateContent(el) ?? el);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
function animatesUrlAttribute(el, tag) {
|
|
115
|
-
if (!ATTR_ANIMATION_TAGS.has(tag)) return false;
|
|
116
|
-
const target = (el.getAttribute("attributeName") ?? "").trim().toLowerCase();
|
|
117
|
-
return URL_ATTRS.has(target) || URL_ATTRS.has(target.replace(/^xlink:/, ""));
|
|
118
|
-
}
|
|
119
|
-
function isDangerousUrl(value, schemes) {
|
|
120
|
-
return schemes.test(value.replace(/[\t\n\r]/g, "").replace(/^[\x00-\x20]+/, ""));
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// src/core/template.ts
|
|
124
|
-
var RAW = /* @__PURE__ */ Symbol.for("a11y-elements/raw");
|
|
125
|
-
var MARKUP = /* @__PURE__ */ Symbol.for("a11y-elements/markup");
|
|
126
|
-
var RAWS = /* @__PURE__ */ Symbol.for("a11y-elements/raws");
|
|
127
|
-
var SOURCE = /* @__PURE__ */ Symbol.for("a11y-elements/raw-source");
|
|
128
|
-
var PLACEHOLDER_ATTR = "data-a11y-raw";
|
|
129
|
-
var TOKEN_PREFIX = Math.random().toString(36).slice(2, 8);
|
|
130
|
-
var Markup = class {
|
|
131
|
-
[RAW] = true;
|
|
132
|
-
[MARKUP];
|
|
133
|
-
[RAWS];
|
|
134
|
-
[SOURCE];
|
|
135
|
-
constructor(markup, raws, source) {
|
|
136
|
-
this[MARKUP] = markup;
|
|
137
|
-
this[RAWS] = raws?.size ? raws : void 0;
|
|
138
|
-
this[SOURCE] = source;
|
|
139
|
-
}
|
|
140
|
-
get __html() {
|
|
141
|
-
return this.toString();
|
|
142
|
-
}
|
|
143
|
-
toString() {
|
|
144
|
-
const raws = this[RAWS];
|
|
145
|
-
if (!raws) return this[MARKUP];
|
|
146
|
-
let out = this[MARKUP];
|
|
147
|
-
raws.forEach((source, token) => {
|
|
148
|
-
out = out.split(placeholder(token)).join(sanitizeMarkup(source));
|
|
149
|
-
});
|
|
150
|
-
return out;
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
function placeholder(token) {
|
|
154
|
-
return `<template ${PLACEHOLDER_ATTR}="${token}"></template>`;
|
|
155
|
-
}
|
|
156
|
-
function isRaw(value) {
|
|
157
|
-
return typeof value === "object" && value !== null && value[RAW] === true;
|
|
158
|
-
}
|
|
159
|
-
function markupOf(value) {
|
|
160
|
-
const markup = value[MARKUP];
|
|
161
|
-
return typeof markup === "string" ? markup : value.__html;
|
|
162
|
-
}
|
|
163
|
-
function rawsOf(value) {
|
|
164
|
-
const raws = value[RAWS];
|
|
165
|
-
return raws instanceof Map ? raws : void 0;
|
|
166
|
-
}
|
|
167
|
-
var ESCAPES = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" };
|
|
168
|
-
var NEEDS_ESCAPE = /[&<>"']/;
|
|
169
|
-
var ESCAPE_ALL = /[&<>"']/g;
|
|
170
|
-
function escapeText(text) {
|
|
171
|
-
return NEEDS_ESCAPE.test(text) ? text.replace(ESCAPE_ALL, (c) => ESCAPES[c]) : text;
|
|
172
|
-
}
|
|
173
|
-
function interpolate(value, context, raws) {
|
|
174
|
-
if (value == null || value === false) return "";
|
|
175
|
-
if (Array.isArray(value)) return value.map((item) => interpolate(item, context, raws)).join(context === "tag" ? " " : "");
|
|
176
|
-
if (isRaw(value)) {
|
|
177
|
-
const nested = rawsOf(value);
|
|
178
|
-
if (context === "text") {
|
|
179
|
-
nested?.forEach((source2, token) => raws.set(token, source2));
|
|
180
|
-
return markupOf(value);
|
|
181
|
-
}
|
|
182
|
-
if (!nested) return markupOf(value);
|
|
183
|
-
const source = value[SOURCE];
|
|
184
|
-
const text = typeof source === "string" ? source : value.toString();
|
|
185
|
-
return context === "tag" ? sanitizeAttributes(text) : escapeText(text);
|
|
186
|
-
}
|
|
187
|
-
return context === "tag" ? sanitizeAttributes(String(value)) : escapeText(String(value));
|
|
188
|
-
}
|
|
189
|
-
function scan(context, chunk, quote) {
|
|
190
|
-
for (const ch of chunk) {
|
|
191
|
-
if (context === "text") {
|
|
192
|
-
if (ch === "<") context = "tag";
|
|
193
|
-
} else if (context === "tag") {
|
|
194
|
-
if (ch === ">") context = "text";
|
|
195
|
-
else if (ch === "=") context = "attr-start";
|
|
196
|
-
} else if (context === "attr-start") {
|
|
197
|
-
if (ch === '"' || ch === "'") [context, quote] = ["attr-quoted", ch];
|
|
198
|
-
else if (ch === ">") context = "text";
|
|
199
|
-
else if (!/\s/.test(ch)) context = "attr-unquoted";
|
|
200
|
-
} else if (context === "attr-unquoted") {
|
|
201
|
-
if (ch === ">") context = "text";
|
|
202
|
-
else if (/\s/.test(ch)) context = "tag";
|
|
203
|
-
} else if (ch === quote) {
|
|
204
|
-
context = "tag";
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
return [context, quote];
|
|
208
|
-
}
|
|
209
|
-
var contextCache = /* @__PURE__ */ new WeakMap();
|
|
210
|
-
function contextsOf(strings2) {
|
|
211
|
-
let contexts = contextCache.get(strings2);
|
|
212
|
-
if (contexts) return contexts;
|
|
213
|
-
contexts = [];
|
|
214
|
-
let [context, quote] = scan("text", strings2[0], "");
|
|
215
|
-
for (let i = 1; i < strings2.length; i++) {
|
|
216
|
-
contexts.push(context);
|
|
217
|
-
if (context === "attr-start") context = "tag";
|
|
218
|
-
[context, quote] = scan(context, strings2[i], quote);
|
|
219
|
-
}
|
|
220
|
-
contextCache.set(strings2, contexts);
|
|
221
|
-
return contexts;
|
|
222
|
-
}
|
|
223
|
-
function html(strings2, ...values) {
|
|
224
|
-
const contexts = contextsOf(strings2);
|
|
225
|
-
const raws = /* @__PURE__ */ new Map();
|
|
226
|
-
let out = strings2[0];
|
|
227
|
-
for (let i = 0; i < values.length; i++) {
|
|
228
|
-
const context = contexts[i];
|
|
229
|
-
const piece = interpolate(values[i], context, raws);
|
|
230
|
-
if (context === "attr-start") {
|
|
231
|
-
out += `"${piece.replace(/"/g, """)}"`;
|
|
232
|
-
} else if (context === "attr-unquoted") {
|
|
233
|
-
out += piece.replace(/[\s"'`=<>]/g, (c) => `&#${c.charCodeAt(0)};`);
|
|
234
|
-
} else {
|
|
235
|
-
out += piece;
|
|
236
|
-
}
|
|
237
|
-
out += strings2[i + 1];
|
|
238
|
-
}
|
|
239
|
-
return new Markup(out, raws);
|
|
240
|
-
}
|
|
241
|
-
function toFragment(markup) {
|
|
242
|
-
const holder = document.createElement("template");
|
|
243
|
-
const raws = isRaw(markup) ? rawsOf(markup) : void 0;
|
|
244
|
-
holder.innerHTML = isRaw(markup) ? markupOf(markup) : String(markup);
|
|
245
|
-
if (raws) resolveRaws(holder.content, raws);
|
|
246
|
-
return holder.content;
|
|
247
|
-
}
|
|
248
|
-
function renderInto(el, markup) {
|
|
249
|
-
el.replaceChildren(toFragment(markup));
|
|
250
|
-
}
|
|
251
|
-
function resolveRaws(root, raws) {
|
|
252
|
-
for (const holder of collectPlaceholders(root)) {
|
|
253
|
-
const source = raws.get(holder.getAttribute(PLACEHOLDER_ATTR) ?? "");
|
|
254
|
-
if (source === void 0) holder.remove();
|
|
255
|
-
else holder.replaceWith(...parseSanitized(source, holder.parentNode));
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
function collectPlaceholders(root) {
|
|
259
|
-
const found = [];
|
|
260
|
-
root.querySelectorAll("template").forEach((el) => {
|
|
261
|
-
if (el.hasAttribute(PLACEHOLDER_ATTR)) found.push(el);
|
|
262
|
-
const content = el.content;
|
|
263
|
-
if (content && typeof content.querySelectorAll === "function") found.push(...collectPlaceholders(content));
|
|
264
|
-
});
|
|
265
|
-
return found;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// src/core/a11y-element.ts
|
|
269
|
-
var A11yElement = class extends HTMLElement {
|
|
270
|
-
_connected = false;
|
|
271
|
-
_listeners = [];
|
|
272
|
-
_updating = false;
|
|
273
|
-
/** CSS vars `setCssVar()` currently owns → the consumer's inline value it replaced ('' if none). */
|
|
274
|
-
_cssVarOwned = /* @__PURE__ */ new Map();
|
|
275
|
-
/** The `document` listener `_watchStrings()` added, if any — outside `listen()`, whose listeners every render clears. */
|
|
276
|
-
_stringsListener = null;
|
|
277
|
-
connectedCallback() {
|
|
278
|
-
this._initConnect();
|
|
279
|
-
this._connected = true;
|
|
280
|
-
this.update();
|
|
281
|
-
}
|
|
282
|
-
disconnectedCallback() {
|
|
283
|
-
this._connected = false;
|
|
284
|
-
this._cleanupListeners();
|
|
285
|
-
if (this._stringsListener) document.removeEventListener(STRINGS_CHANGE_EVENT, this._stringsListener);
|
|
286
|
-
this._stringsListener = null;
|
|
287
|
-
this.onDisconnect?.();
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Connect-time setup shared by every base class. Every `connectedCallback`
|
|
291
|
-
* override that doesn't call super must call this itself, before setting
|
|
292
|
-
* `_connected` (so replayed setters only write attributes, and the normal
|
|
293
|
-
* connect path then acts on them).
|
|
294
|
-
*/
|
|
295
|
-
_initConnect() {
|
|
296
|
-
this._upgradeProperties();
|
|
297
|
-
this._watchStrings();
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* A property set on the element before its class was defined (e.g.
|
|
301
|
-
* `el.open = true` before a lazy-loaded bundle runs) is an own property
|
|
302
|
-
* that shadows the class accessor. Replay each one through the setter.
|
|
303
|
-
*/
|
|
304
|
-
_upgradeProperties() {
|
|
305
|
-
for (let proto = Object.getPrototypeOf(this); proto && proto !== HTMLElement.prototype; proto = Object.getPrototypeOf(proto)) {
|
|
306
|
-
for (const name of Object.getOwnPropertyNames(proto)) {
|
|
307
|
-
if (!Object.prototype.hasOwnProperty.call(this, name) || !Object.getOwnPropertyDescriptor(proto, name)?.set) continue;
|
|
308
|
-
const self = this;
|
|
309
|
-
const value = self[name];
|
|
310
|
-
delete self[name];
|
|
311
|
-
self[name] = value;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
/** Subscribes `onStringsChange()` (when defined) to `setStrings()` until disconnect. */
|
|
316
|
-
_watchStrings() {
|
|
317
|
-
if (!this.onStringsChange || this._stringsListener) return;
|
|
318
|
-
this._stringsListener = () => {
|
|
319
|
-
if (this._connected) this.onStringsChange?.();
|
|
320
|
-
};
|
|
321
|
-
document.addEventListener(STRINGS_CHANGE_EVENT, this._stringsListener);
|
|
322
|
-
}
|
|
323
|
-
attributeChangedCallback(_name, oldValue, newValue) {
|
|
324
|
-
if (oldValue === newValue || !this._connected) return;
|
|
325
|
-
this.update();
|
|
326
|
-
}
|
|
327
|
-
update() {
|
|
328
|
-
if (this._updating) return;
|
|
329
|
-
this._updating = true;
|
|
330
|
-
try {
|
|
331
|
-
this._cleanupListeners();
|
|
332
|
-
this.onBeforeRender?.();
|
|
333
|
-
const markup = this.render();
|
|
334
|
-
if (markup !== null) renderInto(this, markup);
|
|
335
|
-
this.onAfterRender?.();
|
|
336
|
-
} finally {
|
|
337
|
-
this._updating = false;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Adds a listener and tracks it for automatic removal on the next render
|
|
342
|
-
* and on disconnect — the direct replacement for the old framework's
|
|
343
|
-
* `[el, type, handler]` cleanup-array convention.
|
|
344
|
-
*/
|
|
345
|
-
listen(target, type, handler, options) {
|
|
346
|
-
target.addEventListener(type, handler, options);
|
|
347
|
-
this._listeners.push([target, type, handler, options]);
|
|
348
|
-
}
|
|
349
|
-
_cleanupListeners() {
|
|
350
|
-
for (const [target, type, handler, options] of this._listeners) {
|
|
351
|
-
target.removeEventListener(type, handler, options);
|
|
352
|
-
}
|
|
353
|
-
this._listeners = [];
|
|
354
|
-
}
|
|
355
|
-
/** Dispatches a bubbling CustomEvent from this element. */
|
|
356
|
-
emit(type, detail) {
|
|
357
|
-
return this.dispatchEvent(new CustomEvent(type, { bubbles: true, detail }));
|
|
358
|
-
}
|
|
359
|
-
// --- small attribute-reflection helpers, shared across components ---
|
|
360
|
-
stringAttr(name, fallback = "") {
|
|
361
|
-
return this.getAttribute(name) ?? fallback;
|
|
362
|
-
}
|
|
363
|
-
optionalStringAttr(name) {
|
|
364
|
-
return this.getAttribute(name) ?? void 0;
|
|
365
|
-
}
|
|
366
|
-
boolAttr(name) {
|
|
367
|
-
return this.hasAttribute(name);
|
|
368
|
-
}
|
|
369
|
-
numberAttr(name, fallback) {
|
|
370
|
-
const value = this.getAttribute(name);
|
|
371
|
-
if (value == null) return fallback;
|
|
372
|
-
const parsed = Number(value);
|
|
373
|
-
return Number.isNaN(parsed) ? fallback : parsed;
|
|
374
|
-
}
|
|
375
|
-
setBoolAttr(name, value) {
|
|
376
|
-
if (value) this.setAttribute(name, "");
|
|
377
|
-
else this.removeAttribute(name);
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Sets a CSS custom property on this element while `value` is truthy. When
|
|
381
|
-
* it isn't, only a property this method set itself is undone — restored to
|
|
382
|
-
* the consumer's own inline value from before (or removed if there was
|
|
383
|
-
* none) — so a consumer's `style="--a11y-…: …"` survives when the matching
|
|
384
|
-
* attribute is absent.
|
|
385
|
-
*/
|
|
386
|
-
setCssVar(name, value) {
|
|
387
|
-
if (value) {
|
|
388
|
-
if (!this._cssVarOwned.has(name)) this._cssVarOwned.set(name, this.style.getPropertyValue(name));
|
|
389
|
-
this.style.setProperty(name, value);
|
|
390
|
-
return;
|
|
391
|
-
}
|
|
392
|
-
if (!this._cssVarOwned.has(name)) return;
|
|
393
|
-
const previous = this._cssVarOwned.get(name);
|
|
394
|
-
this._cssVarOwned.delete(name);
|
|
395
|
-
if (previous) this.style.setProperty(name, previous);
|
|
396
|
-
else this.style.removeProperty(name);
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
export {
|
|
401
|
-
defineElement,
|
|
402
|
-
setStrings,
|
|
403
|
-
resetStrings,
|
|
404
|
-
getString,
|
|
405
|
-
formatString,
|
|
406
|
-
html,
|
|
407
|
-
renderInto,
|
|
408
|
-
A11yElement
|
|
409
|
-
};
|
|
410
|
-
//# sourceMappingURL=chunk-46SIA3RI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/define-element.ts","../../src/core/strings.ts","../../src/core/sanitize.ts","../../src/core/template.ts","../../src/core/a11y-element.ts"],"sourcesContent":["/**\n * Registers `ctor` as `tag` unless that tag is already taken — by an earlier\n * import of the same entry, or by another bundle on the page that shares this\n * element (a standalone `define.js` and the all-in-one entry, say).\n */\nexport function defineElement(tag: string, ctor: CustomElementConstructor): void {\n if (!customElements.get(tag)) customElements.define(tag, ctor);\n}\n","/**\n * The library's built-in, user-facing strings — text that ends up in\n * accessible names and announcements — so a consumer can translate them.\n *\n * Precedence, per element: an instance attribute (e.g. `close-label`) wins,\n * then whatever `setStrings()` set, then these English defaults.\n */\nexport interface A11yStrings {\n /** Appended to a new-tab link's accessible name by `<a11y-anchor>`. */\n opensInNewTab: string;\n /** `<a11y-anchor>`'s same-page jump announcement; `{name}` is the target's name. */\n navigatedTo: string;\n /** The close button of `<a11y-modal>`, `<a11y-drawer>` and `<a11y-emergency-dialog>`. */\n closeDialog: string;\n /** The close button of each `<a11y-notification-banner>` item. */\n dismiss: string;\n /** Default label of `<a11y-spinner>` and `<a11y-blocking-loader>`. */\n loading: string;\n /** Default accessible name of `<a11y-progress>`. */\n progress: string;\n /** Last-resort accessible name of `<a11y-avatar>`. */\n avatar: string;\n /** Visible text of an `<a11y-counter>`; `{count}` is the current length, `{max}` the `maxlength`. */\n characterCount: string;\n /** What an `<a11y-counter>` announces near the limit; `{count}` is the number of characters left. */\n charactersRemaining: string;\n /** `charactersRemaining` when exactly one character is left. */\n characterRemaining: string;\n /** The generated \"Select all\" checkbox of `<a11y-checkbox-group select-all>`. */\n selectAll: string;\n /** The browse button of `<a11y-file-input>`. */\n browseFiles: string;\n /** The drag & drop prompt next to `<a11y-file-input>`'s browse button. */\n dropFiles: string;\n /** Accessible name of `<a11y-file-input>`'s list of selected files. */\n selectedFiles: string;\n /** Visible text of each remove button of `<a11y-file-input>`. */\n remove: string;\n /** Accessible name of each remove button of `<a11y-file-input>`; `{name}` is the file name. */\n removeFile: string;\n /** Announced when `<a11y-file-input>` adds one file; `{name}` is its name. */\n fileAdded: string;\n /** Announced when `<a11y-file-input>` adds several files; `{count}` is how many. */\n filesAdded: string;\n /** Announced when `<a11y-file-input>` removes a file; `{name}` is its name. */\n fileRemoved: string;\n /** Shown and announced for a file `accept` rules out; `{name}` is its name. */\n fileTypeRejected: string;\n /** Shown and announced for a file over `max-size`; `{name}`, `{maxSize}`. */\n fileSizeRejected: string;\n /** Shown and announced for a file past `max-files`; `{name}`, `{max}`. */\n fileCountRejected: string;\n}\n\nexport const DEFAULT_STRINGS: Readonly<A11yStrings> = Object.freeze({\n opensInNewTab: '(opens in new tab)',\n navigatedTo: 'Navigated to {name}',\n closeDialog: 'Close dialog',\n dismiss: 'Dismiss',\n loading: 'Loading',\n progress: 'Progress',\n avatar: 'Avatar',\n characterCount: '{count} / {max}',\n charactersRemaining: '{count} characters remaining',\n characterRemaining: '{count} character remaining',\n selectAll: 'Select all',\n browseFiles: 'Browse files',\n dropFiles: 'or drop files here',\n selectedFiles: 'Selected files',\n remove: 'Remove',\n removeFile: 'Remove {name}',\n fileAdded: '{name} added',\n filesAdded: '{count} files added',\n fileRemoved: '{name} removed',\n fileTypeRejected: '{name} wasn’t added: this type of file isn’t allowed',\n fileSizeRejected: '{name} wasn’t added: it’s larger than {maxSize}',\n fileCountRejected: '{name} wasn’t added: too many files (maximum {max})',\n});\n\n/** Dispatched on `document` whenever `setStrings()`/`resetStrings()` runs, so mounted elements can relabel themselves. */\nexport const STRINGS_CHANGE_EVENT = 'a11y-strings-change';\n\n/**\n * Page-wide, on `globalThis` for the same reason as the overlay registry:\n * each standalone `dist/browser/**\\/define.js` bundle inlines its own copy of\n * this module, and `setStrings()` called through one bundle must reach the\n * elements every other bundle defined.\n */\nconst STRINGS_KEY = Symbol.for('a11y-elements/strings');\nconst store = globalThis as unknown as Record<symbol, A11yStrings | undefined>;\nconst strings: A11yStrings = (store[STRINGS_KEY] ??= { ...DEFAULT_STRINGS });\n// A store created by an older bundle on the same page predates newer keys.\nfor (const [key, value] of Object.entries(DEFAULT_STRINGS) as [keyof A11yStrings, string][]) strings[key] ??= value;\n\n/** Overrides some or all built-in strings, page-wide. Elements already on the page update right away. */\nexport function setStrings(partial: Partial<A11yStrings>): void {\n for (const [key, value] of Object.entries(partial) as [keyof A11yStrings, string | undefined][]) {\n if (Object.hasOwn(DEFAULT_STRINGS, key) && typeof value === 'string') strings[key] = value;\n }\n document.dispatchEvent(new Event(STRINGS_CHANGE_EVENT));\n}\n\n/** Restores every built-in string to its English default. */\nexport function resetStrings(): void {\n Object.assign(strings, DEFAULT_STRINGS);\n document.dispatchEvent(new Event(STRINGS_CHANGE_EVENT));\n}\n\nexport function getString(key: keyof A11yStrings): string {\n return strings[key];\n}\n\n/** Replaces each `{key}` placeholder with `values[key]`; placeholders without a value (own keys only, so `{constructor}` stays as is) are left as is. */\nexport function formatString(template: string, values: Record<string, string>): string {\n return template.replace(/\\{(\\w+)\\}/g, (match, key: string) => (Object.hasOwn(values, key) ? values[key]! : match));\n}\n","/**\n * DOM-based sanitizer behind `raw()`: markup is parsed once in the inert\n * document behind a `<template>` (nothing loads or runs there), cleaned as\n * nodes, and those nodes are what gets inserted — never re-serialized and\n * parsed again, which is where mutation XSS turns inert text back into\n * elements.\n */\n\n/** Compared against `localName`, so SVG/MathML elements of the same name are caught too. style/link restyle the page, base moves every relative URL, meta can refresh/navigate. */\nconst STRIPPED_TAGS = new Set(['script', 'style', 'link', 'base', 'meta']);\n\n/** A `data:` document in a frame runs its own scripts (opaque origin). */\nconst FRAME_TAGS = new Set(['iframe', 'object', 'embed', 'frame']);\nconst FRAME_URL_ATTRS = new Set(['src', 'data']);\nconst URL_ATTRS = new Set(['href', 'src', 'action', 'formaction', 'poster', 'background', 'xlink:href']);\n\n/** SVG `<animate>`/`<set>` can rewrite an attribute after sanitization: those targeting a URL attribute are dropped. */\nconst ATTR_ANIMATION_TAGS = new Set(['animate', 'set']);\n\nconst SCRIPT_URL = /^javascript:/i;\nconst SCRIPT_OR_DATA_URL = /^(javascript|data):/i;\nconst ATTR_NAME = /^[a-z_:][-a-z0-9_:.]*$/;\n\n/** Parses `source` as markup and returns it sanitized, as a string. Only for `String()` fallbacks: rendering inserts the nodes from `parseSanitized()` instead. */\nexport function sanitizeMarkup(source: string): string {\n const holder = document.createElement('template');\n holder.innerHTML = source;\n sanitizeNode(holder.content);\n return holder.innerHTML;\n}\n\n/**\n * Parses `source` with an element like `parent` as context (so `<tr>`, SVG\n * or MathML content parses as it will once inserted under it), sanitizes it,\n * and returns the resulting nodes.\n */\nexport function parseSanitized(source: string, parent: Node | null): Node[] {\n const holder = document.createElement('template');\n const parentEl = parent && parent.nodeType === Node.ELEMENT_NODE ? (parent as Element) : null;\n let root: ParentNode = holder.content;\n if (parentEl && !templateContent(parentEl)) {\n const context = holder.content.ownerDocument.createElementNS(parentEl.namespaceURI, parentEl.localName);\n context.innerHTML = source;\n root = context;\n } else {\n holder.innerHTML = source;\n }\n sanitizeNode(root);\n return Array.from(root.childNodes);\n}\n\n/**\n * Untrusted text in tag position (`<input ${x}>`): parsed as attributes and\n * rebuilt from the safe ones — no event handlers, `srcdoc`, script URLs or\n * invalid names. Escaping alone would leave `onfocus=alert(1)` intact.\n */\nexport function sanitizeAttributes(source: string): string {\n // Fast path for the common case: one bare attribute name (`disabled`).\n if (source === '' || (ATTR_NAME.test(source.toLowerCase()) && isAllowedAttribute(source.toLowerCase(), ''))) return source;\n const holder = document.createElement('template');\n holder.innerHTML = `<span ${source}></span>`;\n // An unterminated quote makes the parser drop the whole tag: nothing to keep.\n const el = holder.content.firstElementChild;\n if (!el) return '';\n return Array.from(el.attributes)\n .filter((a) => ATTR_NAME.test(a.name.toLowerCase()) && isAllowedAttribute(a.name.toLowerCase(), a.value))\n .map((a) => `${a.name}=\"${a.value.replace(/&/g, '&').replace(/\"/g, '"')}\"`)\n .join(' ');\n}\n\nfunction isAllowedAttribute(name: string, value: string): boolean {\n // srcdoc is parsed as a same-origin document: escaped markup in it is decoded and runs.\n if (name.startsWith('on') || name === 'srcdoc') return false;\n return !(URL_ATTRS.has(name) && isDangerousUrl(value, SCRIPT_URL));\n}\n\n/** Only an HTML `<template>` has a content fragment; `<svg><template>` is a plain element. */\nfunction templateContent(el: Element): DocumentFragment | null {\n const content = (el as HTMLTemplateElement).content;\n return content && typeof content.querySelectorAll === 'function' ? content : null;\n}\n\nfunction sanitizeNode(root: ParentNode): void {\n // Snapshot before mutating: removing from a live collection while iterating it skips the next sibling.\n for (const el of Array.from(root.children)) {\n const tag = el.localName.toLowerCase();\n if (STRIPPED_TAGS.has(tag) || animatesUrlAttribute(el, tag)) {\n el.remove();\n continue;\n }\n for (const attr of Array.from(el.attributes)) {\n const name = attr.name.toLowerCase();\n if (\n !isAllowedAttribute(name, attr.value) ||\n (FRAME_TAGS.has(tag) && FRAME_URL_ATTRS.has(name) && isDangerousUrl(attr.value, SCRIPT_OR_DATA_URL))\n ) {\n el.removeAttribute(attr.name);\n }\n }\n sanitizeNode(templateContent(el) ?? el);\n }\n}\n\nfunction animatesUrlAttribute(el: Element, tag: string): boolean {\n if (!ATTR_ANIMATION_TAGS.has(tag)) return false;\n const target = (el.getAttribute('attributeName') ?? '').trim().toLowerCase();\n return URL_ATTRS.has(target) || URL_ATTRS.has(target.replace(/^xlink:/, ''));\n}\n\nfunction isDangerousUrl(value: string, schemes: RegExp): boolean {\n // Browsers strip ASCII tab/newline/CR from a URL (and trim leading C0\n // control/space) before sniffing the scheme, so \"java\\tscript:\" still runs\n // as javascript: — normalize the same way before checking it.\n return schemes.test(value.replace(/[\\t\\n\\r]/g, '').replace(/^[\\x00-\\x20]+/, ''));\n}\n","import { parseSanitized, sanitizeAttributes, sanitizeMarkup } from './sanitize.js';\n\n/**\n * Markup that opts out of auto-escaping when interpolated into an `html`\n * tagged template. `html\\`...\\`` itself returns one of these, which is what\n * makes nesting `html` calls inside another `html` call safe by\n * construction — the inner result is never re-escaped, no caller discipline\n * (remembering to wrap it) required.\n *\n * Only values made by `html`/`raw()`/`trustedRaw()`/`attr()`/`flag()` count:\n * a plain object with an `__html` key (e.g. parsed JSON) is escaped like any\n * other value.\n *\n * Render one with `renderInto()` (what every element in this library does):\n * the `raw()` parts inside are then sanitized as DOM nodes. `__html` and\n * `String()` give the same markup with those parts sanitized as strings,\n * which the browser parses a second time when it is assigned to `innerHTML`.\n */\nexport interface Raw {\n readonly __html: string;\n toString(): string;\n}\n\n/**\n * Brands, through `Symbol.for` rather than module-local symbols: each\n * standalone `dist/browser/**\\/define.js` bundle inlines its own copy of this\n * module, and markup built through one bundle must stay recognized in another.\n */\nconst RAW: unique symbol = Symbol.for('a11y-elements/raw');\n/** Markup with each `raw()` part replaced by a placeholder. */\nconst MARKUP: unique symbol = Symbol.for('a11y-elements/markup');\n/** Placeholder token → unescaped `raw()` source, resolved as sanitized nodes at render. */\nconst RAWS: unique symbol = Symbol.for('a11y-elements/raws');\n/** A `raw()` value's own source, for when it lands in tag or attribute-value position. */\nconst SOURCE: unique symbol = Symbol.for('a11y-elements/raw-source');\n\nconst PLACEHOLDER_ATTR = 'data-a11y-raw';\n/** Per bundle, so placeholders made by two bundles on one page never collide. */\nconst TOKEN_PREFIX = Math.random().toString(36).slice(2, 8);\nlet tokenCounter = 0;\n\ntype Raws = Map<string, string>;\n\nclass Markup implements Raw {\n readonly [RAW] = true;\n readonly [MARKUP]: string;\n readonly [RAWS]: Raws | undefined;\n readonly [SOURCE]: string | undefined;\n\n constructor(markup: string, raws?: Raws, source?: string) {\n this[MARKUP] = markup;\n this[RAWS] = raws?.size ? raws : undefined;\n this[SOURCE] = source;\n }\n\n get __html(): string {\n return this.toString();\n }\n\n toString(): string {\n const raws = this[RAWS];\n if (!raws) return this[MARKUP];\n let out = this[MARKUP];\n raws.forEach((source, token) => {\n // The same raw() interpolated twice shares one token.\n out = out.split(placeholder(token)).join(sanitizeMarkup(source));\n });\n return out;\n }\n}\n\nfunction placeholder(token: string): string {\n return `<template ${PLACEHOLDER_ATTR}=\"${token}\"></template>`;\n}\n\n/**\n * Inserts HTML unescaped, but sanitized at render: `<script>`, `<style>`,\n * `<link>`, `<base>`, `<meta>`, event handler attributes, `srcdoc`,\n * `javascript:` URLs, `data:` frame sources and SVG animations of URL\n * attributes are removed. Inside `html`, it is sanitized down to its safe\n * attributes in tag position (`<input ${raw('checked')}>`) and escaped in an\n * attribute value.\n */\nexport function raw(value: string): Raw {\n const source = value == null ? '' : String(value);\n const token = `${TOKEN_PREFIX}${++tokenCounter}`;\n return new Markup(placeholder(token), new Map([[token, source]]), source);\n}\n\n/** Inserts HTML exactly as given, unsanitized. Only for markup you wrote yourself — never for anything user input can reach. */\nexport function trustedRaw(value: string): Raw {\n return new Markup(value == null ? '' : String(value));\n}\n\nfunction isRaw(value: unknown): value is Raw {\n return typeof value === 'object' && value !== null && (value as Record<symbol, unknown>)[RAW] === true;\n}\n\n/** Older bundles' `Raw`s have no `MARKUP`: their `__html` is the markup. */\nfunction markupOf(value: Raw): string {\n const markup = (value as unknown as Record<symbol, unknown>)[MARKUP];\n return typeof markup === 'string' ? markup : value.__html;\n}\n\nfunction rawsOf(value: Raw): Raws | undefined {\n const raws = (value as unknown as Record<symbol, unknown>)[RAWS];\n return raws instanceof Map ? (raws as Raws) : undefined;\n}\n\nconst ESCAPES: Record<string, string> = { '&': '&', '<': '<', '>': '>', '\"': '"', \"'\": ''' };\nconst NEEDS_ESCAPE = /[&<>\"']/;\nconst ESCAPE_ALL = /[&<>\"']/g;\n\nfunction escapeText(text: string): string {\n return NEEDS_ESCAPE.test(text) ? text.replace(ESCAPE_ALL, (c) => ESCAPES[c]!) : text;\n}\n\n/** Where an interpolation lands, tracked over the literal parts only. */\ntype Context = 'text' | 'tag' | 'attr-start' | 'attr-unquoted' | 'attr-quoted';\n\nfunction interpolate(value: unknown, context: Context, raws: Raws): string {\n if (value == null || value === false) return '';\n if (Array.isArray(value)) return value.map((item) => interpolate(item, context, raws)).join(context === 'tag' ? ' ' : '');\n if (isRaw(value)) {\n const nested = rawsOf(value);\n if (context === 'text') {\n nested?.forEach((source, token) => raws.set(token, source));\n return markupOf(value);\n }\n // Trusted markup goes in as is; a raw() part outside element position is\n // treated like text from then on: filtered in tag position, escaped in a value.\n if (!nested) return markupOf(value);\n const source = (value as unknown as Record<symbol, unknown>)[SOURCE];\n const text = typeof source === 'string' ? source : value.toString();\n return context === 'tag' ? sanitizeAttributes(text) : escapeText(text);\n }\n return context === 'tag' ? sanitizeAttributes(String(value)) : escapeText(String(value));\n}\n\nfunction scan(context: Context, chunk: string, quote: string): [Context, string] {\n for (const ch of chunk) {\n if (context === 'text') {\n if (ch === '<') context = 'tag';\n } else if (context === 'tag') {\n if (ch === '>') context = 'text';\n else if (ch === '=') context = 'attr-start';\n } else if (context === 'attr-start') {\n if (ch === '\"' || ch === \"'\") [context, quote] = ['attr-quoted', ch];\n else if (ch === '>') context = 'text';\n else if (!/\\s/.test(ch)) context = 'attr-unquoted';\n } else if (context === 'attr-unquoted') {\n if (ch === '>') context = 'text';\n else if (/\\s/.test(ch)) context = 'tag';\n } else if (ch === quote) {\n context = 'tag';\n }\n }\n return [context, quote];\n}\n\n/**\n * The context of each `${}`, per call site: it only depends on the literal\n * parts, and a template's strings array is the same object on every call\n * from one call site, so re-renders skip the scan.\n */\nconst contextCache = new WeakMap<TemplateStringsArray, Context[]>();\n\nfunction contextsOf(strings: TemplateStringsArray): Context[] {\n let contexts = contextCache.get(strings);\n if (contexts) return contexts;\n contexts = [];\n let [context, quote] = scan('text', strings[0]!, '');\n for (let i = 1; i < strings.length; i++) {\n contexts.push(context);\n // A quoted unquoted value ends right after the interpolation.\n if (context === 'attr-start') context = 'tag';\n [context, quote] = scan(context, strings[i]!, quote);\n }\n contextCache.set(strings, contexts);\n return contexts;\n}\n\n/**\n * Tagged template for building element markup. Literal template parts are\n * trusted structure; every interpolated value is HTML-escaped by default\n * (falsy values render as nothing, so `${cond && '<span>…</span>'}`-style\n * conditionals work without a directive attribute). Returns a `Raw`, so\n * nesting `html\\`...\\`` inside another `html\\`...\\`` template composes\n * safely without needing an explicit `raw()` wrapper.\n *\n * An unquoted attribute value (`title=${x}`) is quoted, and inside one already\n * started (`class=a${x}`) whitespace, quotes and `=<>` are encoded, so a value\n * can never add attributes of its own. A value in tag position\n * (`<input ${x}>`) keeps only its safe attributes.\n */\nexport function html(strings: TemplateStringsArray, ...values: unknown[]): Raw {\n const contexts = contextsOf(strings);\n const raws: Raws = new Map();\n let out = strings[0]!;\n for (let i = 0; i < values.length; i++) {\n const context = contexts[i]!;\n const piece = interpolate(values[i], context, raws);\n if (context === 'attr-start') {\n out += `\"${piece.replace(/\"/g, '"')}\"`;\n } else if (context === 'attr-unquoted') {\n out += piece.replace(/[\\s\"'`=<>]/g, (c) => `&#${c.charCodeAt(0)};`);\n } else {\n out += piece;\n }\n out += strings[i + 1]!;\n }\n return new Markup(out, raws);\n}\n\n/**\n * Parses `markup` once and returns its nodes, each `raw()` part parsed in\n * its real parent context and sanitized as nodes. A plain string is trusted\n * markup, as with `innerHTML`.\n */\nexport function toFragment(markup: string | Raw): DocumentFragment {\n const holder = document.createElement('template');\n const raws = isRaw(markup) ? rawsOf(markup) : undefined;\n holder.innerHTML = isRaw(markup) ? markupOf(markup) : String(markup);\n if (raws) resolveRaws(holder.content, raws);\n return holder.content;\n}\n\n/** Replaces `el`'s children with `markup` — the safe counterpart of `el.innerHTML = String(markup)`. */\nexport function renderInto(el: ParentNode, markup: string | Raw): void {\n el.replaceChildren(toFragment(markup));\n}\n\nfunction resolveRaws(root: ParentNode, raws: Raws): void {\n // Snapshot first: content put in place is never searched for placeholders again.\n for (const holder of collectPlaceholders(root)) {\n const source = raws.get(holder.getAttribute(PLACEHOLDER_ATTR) ?? '');\n if (source === undefined) holder.remove();\n else holder.replaceWith(...parseSanitized(source, holder.parentNode));\n }\n}\n\nfunction collectPlaceholders(root: ParentNode): Element[] {\n const found: Element[] = [];\n root.querySelectorAll('template').forEach((el) => {\n if (el.hasAttribute(PLACEHOLDER_ATTR)) found.push(el);\n const content = (el as HTMLTemplateElement).content;\n if (content && typeof content.querySelectorAll === 'function') found.push(...collectPlaceholders(content));\n });\n return found;\n}\n\n/**\n * A `name=\"value\"` HTML attribute, with a leading space, escaped — or\n * nothing at all when `value` is `null`/`undefined`/`false`/`''`. Meant for\n * building conditional attribute lists inline:\n * `` html`<input${attr('id', id)}${flag('disabled', disabled)}>` ``\n */\nexport function attr(name: string, value: unknown): Raw {\n if (value == null || value === false || value === '') return trustedRaw('');\n return trustedRaw(` ${name}=\"${escapeText(String(value))}\"`);\n}\n\n/** A bare boolean attribute (e.g. `disabled`, `checked`), with a leading space, present only when `condition` is true. */\nexport function flag(name: string, condition: boolean | undefined): Raw {\n return trustedRaw(condition ? ` ${name}` : '');\n}\n","import { STRINGS_CHANGE_EVENT } from './strings.js';\nimport { renderInto, type Raw } from './template.js';\n\ntype Listener = [target: EventTarget, type: string, handler: EventListener, options?: AddEventListenerOptions | boolean];\n\n/**\n * Base class for every element in this library. Light DOM only — elements\n * render real child markup styled by the consumer's own CSS, not a shadow\n * root.\n *\n * Lifecycle mirrors the old `onBeforeRender -> render template ->\n * onAfterRender` pipeline this library used to run through a proprietary\n * framework, just mapped onto native custom-element callbacks:\n *\n * connectedCallback -> first update()\n * attributeChangedCallback -> update() for any observed attribute change\n * disconnectedCallback -> remove all tracked listeners, then onDisconnect()\n * setStrings() -> onStringsChange(), for subclasses that define it\n *\n * Subclasses list attributes to watch via `static observedAttributes` and\n * implement `render()` to return the markup for the element's children (or `null`\n * to keep the consumer's own children as they are). Attribute/\n * property setters that need to reflect into the DOM should just mutate the\n * attribute — `attributeChangedCallback` re-renders synchronously while\n * connected, so state and DOM never drift out of sync across a render.\n */\nexport abstract class A11yElement extends HTMLElement {\n protected _connected = false;\n private _listeners: Listener[] = [];\n private _updating = false;\n /** CSS vars `setCssVar()` currently owns → the consumer's inline value it replaced ('' if none). */\n private _cssVarOwned = new Map<string, string>();\n /** The `document` listener `_watchStrings()` added, if any — outside `listen()`, whose listeners every render clears. */\n private _stringsListener: EventListener | null = null;\n\n connectedCallback(): void {\n this._initConnect();\n this._connected = true;\n this.update();\n }\n\n disconnectedCallback(): void {\n this._connected = false;\n this._cleanupListeners();\n if (this._stringsListener) document.removeEventListener(STRINGS_CHANGE_EVENT, this._stringsListener);\n this._stringsListener = null;\n this.onDisconnect?.();\n }\n\n /**\n * Connect-time setup shared by every base class. Every `connectedCallback`\n * override that doesn't call super must call this itself, before setting\n * `_connected` (so replayed setters only write attributes, and the normal\n * connect path then acts on them).\n */\n protected _initConnect(): void {\n this._upgradeProperties();\n this._watchStrings();\n }\n\n /**\n * A property set on the element before its class was defined (e.g.\n * `el.open = true` before a lazy-loaded bundle runs) is an own property\n * that shadows the class accessor. Replay each one through the setter.\n */\n private _upgradeProperties(): void {\n for (let proto = Object.getPrototypeOf(this); proto && proto !== HTMLElement.prototype; proto = Object.getPrototypeOf(proto)) {\n for (const name of Object.getOwnPropertyNames(proto)) {\n if (!Object.prototype.hasOwnProperty.call(this, name) || !Object.getOwnPropertyDescriptor(proto, name)?.set) continue;\n const self = this as unknown as Record<string, unknown>;\n const value = self[name];\n delete self[name];\n self[name] = value;\n }\n }\n }\n\n /** Subscribes `onStringsChange()` (when defined) to `setStrings()` until disconnect. */\n private _watchStrings(): void {\n if (!this.onStringsChange || this._stringsListener) return;\n this._stringsListener = () => {\n if (this._connected) this.onStringsChange?.();\n };\n document.addEventListener(STRINGS_CHANGE_EVENT, this._stringsListener);\n }\n\n attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void {\n if (oldValue === newValue || !this._connected) return;\n this.update();\n }\n\n protected update(): void {\n // Re-entrancy guard: a listener/hook that itself mutates an observed\n // attribute during render must not trigger a nested render.\n if (this._updating) return;\n this._updating = true;\n try {\n this._cleanupListeners();\n this.onBeforeRender?.();\n const markup = this.render();\n if (markup !== null) renderInto(this, markup);\n this.onAfterRender?.();\n } finally {\n this._updating = false;\n }\n }\n\n /**\n * Returns the markup that replaces the children on every render — a plain\n * (trusted) string, or an `html\\`...\\`` result, whose `raw()` parts are\n * sanitized as nodes (see `renderInto()`) — or `null` to leave the children\n * untouched. Never return `this.innerHTML`: assigning it back re-parses the\n * consumer's markup (which can turn sanitized markup live again — mutation\n * XSS) and drops listeners and state on their children.\n */\n protected abstract render(): string | Raw | null;\n\n /** Runs before `render()`. Typical use: set root-level classes/ARIA/CSS custom properties. */\n protected onBeforeRender?(): void;\n\n /** Runs after `render()` replaces the children. Typical use: query into fresh markup, wire listeners, set DOM-only properties. */\n protected onAfterRender?(): void;\n\n /** Runs once, after listener cleanup, when the element leaves the DOM. */\n protected onDisconnect?(): void;\n\n /** Runs after `setStrings()`/`resetStrings()` while connected. Define it to re-apply any built-in string this element shows. */\n protected onStringsChange?(): void;\n\n /**\n * Adds a listener and tracks it for automatic removal on the next render\n * and on disconnect — the direct replacement for the old framework's\n * `[el, type, handler]` cleanup-array convention.\n */\n protected listen(\n target: EventTarget,\n type: string,\n handler: EventListener,\n options?: AddEventListenerOptions | boolean,\n ): void {\n target.addEventListener(type, handler, options);\n this._listeners.push([target, type, handler, options]);\n }\n\n private _cleanupListeners(): void {\n for (const [target, type, handler, options] of this._listeners) {\n target.removeEventListener(type, handler, options);\n }\n this._listeners = [];\n }\n\n /** Dispatches a bubbling CustomEvent from this element. */\n protected emit<T = unknown>(type: string, detail?: T): boolean {\n return this.dispatchEvent(new CustomEvent<T>(type, { bubbles: true, detail: detail as T }));\n }\n\n // --- small attribute-reflection helpers, shared across components ---\n\n protected stringAttr(name: string, fallback = ''): string {\n return this.getAttribute(name) ?? fallback;\n }\n\n protected optionalStringAttr(name: string): string | undefined {\n return this.getAttribute(name) ?? undefined;\n }\n\n protected boolAttr(name: string): boolean {\n return this.hasAttribute(name);\n }\n\n protected numberAttr(name: string, fallback: number): number {\n const value = this.getAttribute(name);\n if (value == null) return fallback;\n const parsed = Number(value);\n return Number.isNaN(parsed) ? fallback : parsed;\n }\n\n protected setBoolAttr(name: string, value: boolean): void {\n if (value) this.setAttribute(name, '');\n else this.removeAttribute(name);\n }\n\n /**\n * Sets a CSS custom property on this element while `value` is truthy. When\n * it isn't, only a property this method set itself is undone — restored to\n * the consumer's own inline value from before (or removed if there was\n * none) — so a consumer's `style=\"--a11y-…: …\"` survives when the matching\n * attribute is absent.\n */\n protected setCssVar(name: string, value: string | null | undefined): void {\n if (value) {\n if (!this._cssVarOwned.has(name)) this._cssVarOwned.set(name, this.style.getPropertyValue(name));\n this.style.setProperty(name, value);\n return;\n }\n if (!this._cssVarOwned.has(name)) return;\n const previous = this._cssVarOwned.get(name)!;\n this._cssVarOwned.delete(name);\n if (previous) this.style.setProperty(name, previous);\n else this.style.removeProperty(name);\n }\n}\n"],"mappings":";AAKO,SAAS,cAAc,KAAa,MAAsC;AAC/E,MAAI,CAAC,eAAe,IAAI,GAAG,EAAG,gBAAe,OAAO,KAAK,IAAI;AAC/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AACxD,QAAI,MAAO,MAAK,aAAa,MAAM,EAAE;AAAA,QAChC,MAAK,gBAAgB,IAAI;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASU,UAAU,MAAc,OAAwC;AACxE,QAAI,OAAO;AACT,UAAI,CAAC,KAAK,aAAa,IAAI,IAAI,EAAG,MAAK,aAAa,IAAI,MAAM,KAAK,MAAM,iBAAiB,IAAI,CAAC;AAC/F,WAAK,MAAM,YAAY,MAAM,KAAK;AAClC;AAAA,IACF;AACA,QAAI,CAAC,KAAK,aAAa,IAAI,IAAI,EAAG;AAClC,UAAM,WAAW,KAAK,aAAa,IAAI,IAAI;AAC3C,SAAK,aAAa,OAAO,IAAI;AAC7B,QAAI,SAAU,MAAK,MAAM,YAAY,MAAM,QAAQ;AAAA,QAC9C,MAAK,MAAM,eAAe,IAAI;AAAA,EACrC;AACF;","names":["source","strings"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overlays/blocking-loader/blocking-loader.element.ts","../../src/overlays/blocking-loader/define.ts"],"sourcesContent":["import { A11yOverlayElement } from '../../core/a11y-overlay-element.js';\nimport { focusReturnTarget } from '../../core/focus-trap.js';\nimport { lockScroll, unlockScroll } from '../../core/overlay-registry.js';\nimport { getString } from '../../core/strings.js';\nimport { html, renderInto } from '../../core/template.js';\n\n/**\n * A full-screen, non-dismissible loading overlay — for blocking operations\n * where the user genuinely cannot interact with the page (no close button,\n * no backdrop click, no Escape — that's intentional, not a UI bug to fix).\n * While shown, every other child of `<body>` is made `inert` (so keyboard\n * and assistive-tech users can't reach the page it's blocking either — a\n * dimmed backdrop only blocks the mouse) and focus moves onto the loader;\n * both are restored on close.\n *\n * ```html\n * <a11y-blocking-loader message=\"Saving your changes…\"></a11y-blocking-loader>\n * ```\n *\n * Composes a real `<a11y-spinner>` child directly — the framework-agnostic\n * replacement for the old `[data-component]`/`childConfigs()` composition\n * model, which needed a whole registry indirection just to mount a nested\n * component; here it's just `document.createElement`.\n */\nexport class BlockingLoaderElement extends A11yOverlayElement {\n static override get observedAttributes(): string[] {\n return [...super.observedAttributes, 'message'];\n }\n\n get message(): string | undefined {\n return this.optionalStringAttr('message');\n }\n\n private _inerted: Element[] = [];\n private _returnFocusTo: HTMLElement | null = null;\n\n protected override onAttributeChanged(name: string): void {\n if (name === 'message' && this._isShowing) this._renderContent();\n }\n\n protected override onStringsChange(): void {\n if (this._isShowing) this._renderContent();\n }\n\n protected override _show(): void {\n if (this._isShowing) return;\n lockScroll();\n this.setAttribute('role', 'alert');\n this.setAttribute('aria-live', 'assertive');\n this.setAttribute('tabindex', '-1');\n this.classList.add('a11y-blocking-loader-overlay');\n this._renderContent();\n\n for (const child of Array.from(document.body.children)) {\n if (child === this || child.hasAttribute('inert')) continue;\n child.setAttribute('inert', '');\n this._inerted.push(child);\n }\n this._returnFocusTo = focusReturnTarget();\n this.focus({ preventScroll: true });\n\n this._onShown();\n }\n\n protected override _hide(): void {\n if (!this._isShowing) return;\n unlockScroll();\n this.innerHTML = '';\n this.classList.remove('a11y-blocking-loader-overlay');\n this.removeAttribute('role');\n this.removeAttribute('aria-live');\n this.removeAttribute('tabindex');\n\n for (const el of this._inerted) el.removeAttribute('inert');\n this._inerted = [];\n const returnTo = this._returnFocusTo;\n this._returnFocusTo = null;\n if (returnTo?.isConnected && !this._detaching) returnTo.focus({ preventScroll: true });\n\n this._onHidden();\n }\n\n private _renderContent(): void {\n const message = this.message;\n renderInto(this, html`<a11y-spinner size=\"3rem\" label=\"${message ?? getString('loading')}\"></a11y-spinner>${\n message ? html`<p class=\"a11y-blocking-loader-overlay__message\">${message}</p>` : ''\n }`);\n }\n}\n","import { defineElement } from '../../core/define-element.js';\nimport { BlockingLoaderElement } from './blocking-loader.element.js';\n// Ensures <a11y-spinner> is registered too, since blocking-loader composes one internally.\nimport '../../components/spinner/define.js';\n\ndefineElement('a11y-blocking-loader', BlockingLoaderElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'a11y-blocking-loader': BlockingLoaderElement;\n }\n}\n\nexport { BlockingLoaderElement };\nexport * from '../core/zero-build-exports.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwBO,IAAM,wBAAN,cAAoC,mBAAmB;AAAA,EAC5D,WAAoB,qBAA+B;AACjD,WAAO,CAAC,GAAG,MAAM,oBAAoB,SAAS;AAAA,EAChD;AAAA,EAEA,IAAI,UAA8B;AAChC,WAAO,KAAK,mBAAmB,SAAS;AAAA,EAC1C;AAAA,EAEQ,WAAsB,CAAC;AAAA,EACvB,iBAAqC;AAAA,EAE1B,mBAAmB,MAAoB;AACxD,QAAI,SAAS,aAAa,KAAK,WAAY,MAAK,eAAe;AAAA,EACjE;AAAA,EAEmB,kBAAwB;AACzC,QAAI,KAAK,WAAY,MAAK,eAAe;AAAA,EAC3C;AAAA,EAEmB,QAAc;AAC/B,QAAI,KAAK,WAAY;AACrB,eAAW;AACX,SAAK,aAAa,QAAQ,OAAO;AACjC,SAAK,aAAa,aAAa,WAAW;AAC1C,SAAK,aAAa,YAAY,IAAI;AAClC,SAAK,UAAU,IAAI,8BAA8B;AACjD,SAAK,eAAe;AAEpB,eAAW,SAAS,MAAM,KAAK,SAAS,KAAK,QAAQ,GAAG;AACtD,UAAI,UAAU,QAAQ,MAAM,aAAa,OAAO,EAAG;AACnD,YAAM,aAAa,SAAS,EAAE;AAC9B,WAAK,SAAS,KAAK,KAAK;AAAA,IAC1B;AACA,SAAK,iBAAiB,kBAAkB;AACxC,SAAK,MAAM,EAAE,eAAe,KAAK,CAAC;AAElC,SAAK,SAAS;AAAA,EAChB;AAAA,EAEmB,QAAc;AAC/B,QAAI,CAAC,KAAK,WAAY;AACtB,iBAAa;AACb,SAAK,YAAY;AACjB,SAAK,UAAU,OAAO,8BAA8B;AACpD,SAAK,gBAAgB,MAAM;AAC3B,SAAK,gBAAgB,WAAW;AAChC,SAAK,gBAAgB,UAAU;AAE/B,eAAW,MAAM,KAAK,SAAU,IAAG,gBAAgB,OAAO;AAC1D,SAAK,WAAW,CAAC;AACjB,UAAM,WAAW,KAAK;AACtB,SAAK,iBAAiB;AACtB,QAAI,UAAU,eAAe,CAAC,KAAK,WAAY,UAAS,MAAM,EAAE,eAAe,KAAK,CAAC;AAErF,SAAK,UAAU;AAAA,EACjB;AAAA,EAEQ,iBAAuB;AAC7B,UAAM,UAAU,KAAK;AACrB,eAAW,MAAM,wCAAwC,WAAW,UAAU,SAAS,CAAC,oBACtF,UAAU,wDAAwD,OAAO,SAAS,EACpF,EAAE;AAAA,EACJ;AACF;;;ACnFA,cAAc,wBAAwB,qBAAqB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/a11y-overlay-element.ts"],"sourcesContent":["import { A11yElement } from './a11y-element.js';\nimport {\n registerOpenOverlay,\n unregisterOpenOverlay,\n emitOverlayOpen,\n emitOverlayClose,\n recordPortalOrigin,\n forgetPortalOrigin,\n} from './overlay-registry.js';\n\n/**\n * Base for the overlay family (modal, drawer, popover, tooltip, snackbar,\n * blocking-loader, …). Declarative-first: the `open` attribute/property is\n * the primary interface — `<a11y-modal open>` behaves like native\n * `<dialog open>` — with `show()`/`close()` as thin convenience wrappers\n * around that same attribute, not a separate imperative lifecycle.\n *\n * Unlike `A11yElement`, this base does **not** drive `innerHTML` from a\n * `render()` string on every attribute change: many overlays (modal, popover,\n * tooltip) wrap real consumer-authored light-DOM children as their content,\n * and blowing away `innerHTML` would destroy that content. Instead, each\n * concrete overlay is fully responsible for its own DOM in `_show()`/`_hide()`\n * — some build/replace generated markup (blocking-loader), some wrap existing\n * children in backdrop/wrapper chrome (modal), some manage a list of\n * programmatically-created items (snackbar). `_onShown()`/`_onHidden()` are\n * the small pieces of behavior every overlay needs regardless: standardized\n * `a11y-overlay-open`/`a11y-overlay-close` events (the old code only fired\n * its equivalent inconsistently — 4 of 10 overlays) and registration with\n * the dismiss-all registry.\n *\n * Body-mounting: on connect, the element moves itself to be a direct child\n * of `document.body` if it isn't already — matching the old framework's\n * constructor-time force-mount — so a `position: fixed` backdrop/wrapper\n * isn't clipped or offset by an ancestor's `overflow`/`transform`. This\n * happens once, independent of `open`/`_show()`/`_hide()` churn. The\n * parent it left is recorded, so `removeOverlaysWithin(host)` can remove it\n * along with the subtree it was authored in.\n *\n * **Reparenting `this`** (modal/anchored overlays move `this` into\n * wrapper/backdrop chrome they build): moving an already-connected custom\n * element to a *different* parent — even one that's also already connected —\n * still fires `disconnectedCallback` then `connectedCallback` again (the DOM\n * spec's insertion algorithm removes-then-inserts when a node already has a\n * parent; this is not specific to jsdom). Left unguarded, that nested\n * `connectedCallback` calls `_show()` again while the outer `_show()` call\n * that triggered the move is still on the stack — infinite recursion (a real\n * bug this hit once). Subclasses must move `this` via `_moveSelfTo()` below,\n * never a raw `appendChild`/`insertBefore` — it suppresses exactly that\n * reentrant churn.\n */\nexport abstract class A11yOverlayElement extends A11yElement {\n static get observedAttributes(): string[] {\n return ['open'];\n }\n\n protected _isShowing = false;\n /**\n * True while `disconnectedCallback` tears down an overlay the consumer\n * removed from the document — `_hide()` implementations must then leave\n * `this` detached instead of moving it back to `document.body`.\n */\n protected _detaching = false;\n private _internalMove = false;\n\n get open(): boolean {\n return this.boolAttr('open');\n }\n\n set open(value: boolean) {\n this.setBoolAttr('open', value);\n }\n\n override connectedCallback(): void {\n if (this._internalMove) return; // reparented by our own _moveSelfTo() — not a real connect event\n this._initConnect();\n this._connected = true;\n this._portalToBody();\n this.onConnect?.();\n if (!this.open) return;\n // `<a11y-modal open>` upgraded mid-parse (define script loaded\n // synchronously ahead of the markup) connects before its children are\n // parsed — defer the initial show until the document is, so `_show()`\n // sees the real content (heading, focusable elements).\n if (document.readyState === 'loading') this.afterParse(() => this._showIfStillOpen());\n else this._show();\n }\n\n override disconnectedCallback(): void {\n if (this._internalMove) return; // reparented by our own _moveSelfTo() — not a real disconnect event\n if (this._isShowing) {\n this._detaching = true;\n try {\n this._hide({ immediate: true });\n } finally {\n this._detaching = false;\n }\n }\n unregisterOpenOverlay(this);\n forgetPortalOrigin(this);\n super.disconnectedCallback();\n }\n\n override attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {\n if (oldValue === newValue || !this._connected) return;\n if (name !== 'open') {\n this.onAttributeChanged?.(name);\n return;\n }\n if (newValue !== null) this._show();\n else this._hide();\n }\n\n /**\n * Runs on every *real* connect (not the internal reparenting `_moveSelfTo()`\n * does) — the counterpart of `onDisconnect()`. Subclasses wire anchor/\n * trigger listeners here rather than overriding `connectedCallback`.\n */\n protected onConnect?(): void;\n\n /** Called for every observed attribute other than `open` that changes while connected. */\n protected onAttributeChanged?(name: string): void;\n\n /** Runs `callback` once the document has finished parsing (never, if it already has — call sites handle that case directly). */\n protected afterParse(callback: () => void): void {\n if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', callback, { once: true });\n }\n\n private _showIfStillOpen(): void {\n if (this._connected && this.open && !this._isShowing) this._show();\n }\n\n /** Convenience wrapper — identical to `element.open = true`. */\n show(): void {\n this.open = true;\n }\n\n /** Convenience wrapper — identical to `element.open = false`. */\n close(): void {\n this.open = false;\n }\n\n private _portalToBody(): void {\n const origin = this.parentNode;\n if (origin === document.body) return;\n this._moveSelfTo(document.body);\n if (origin instanceof Element) recordPortalOrigin(this, origin);\n }\n\n /**\n * Moves `this` to be the last child of `newParent`, suppressing the\n * connected/disconnected lifecycle churn that a plain `appendChild` would\n * trigger (see the class doc). Use this — never a raw `appendChild`/\n * `insertBefore` on `this` — anywhere a subclass reparents itself while\n * building or tearing down wrapper/backdrop chrome.\n */\n protected _moveSelfTo(newParent: Node): void {\n this._internalMove = true;\n try {\n newParent.appendChild(this);\n } finally {\n this._internalMove = false;\n }\n }\n\n /** Build/animate in whatever DOM this overlay needs, then call `_onShown()`. */\n protected abstract _show(): void;\n\n /**\n * Tear down this overlay's DOM, then call `_onHidden()`. Implementations\n * should gate real removal on a `transitionend` event (not a timeout) to\n * match the CSS-driven animate-out contract, except when `immediate` is\n * set (used when the element is forcibly removed from the document while\n * still open — no animation to wait for).\n */\n protected abstract _hide(opts?: { immediate?: boolean }): void;\n\n protected _onShown(name: string = this.tagName.toLowerCase()): void {\n this._isShowing = true;\n registerOpenOverlay(this);\n emitOverlayOpen(name);\n }\n\n protected _onHidden(name: string = this.tagName.toLowerCase()): void {\n this._isShowing = false;\n unregisterOpenOverlay(this);\n emitOverlayClose(name);\n }\n\n /**\n * Unused by overlays — content is managed explicitly by each concrete\n * overlay in `_show()`/`_hide()`, never auto-replaced from a template\n * string, so that consumer-authored light-DOM children survive. Present\n * only to satisfy `A11yElement`'s abstract contract.\n */\n protected override render(): string {\n return '';\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAkDO,IAAe,qBAAf,cAA0C,YAAY;AAAA,EAC3D,WAAW,qBAA+B;AACxC,WAAO,CAAC,MAAM;AAAA,EAChB;AAAA,EAEU,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMb,aAAa;AAAA,EACf,gBAAgB;AAAA,EAExB,IAAI,OAAgB;AAClB,WAAO,KAAK,SAAS,MAAM;AAAA,EAC7B;AAAA,EAEA,IAAI,KAAK,OAAgB;AACvB,SAAK,YAAY,QAAQ,KAAK;AAAA,EAChC;AAAA,EAES,oBAA0B;AACjC,QAAI,KAAK,cAAe;AACxB,SAAK,aAAa;AAClB,SAAK,aAAa;AAClB,SAAK,cAAc;AACnB,SAAK,YAAY;AACjB,QAAI,CAAC,KAAK,KAAM;AAKhB,QAAI,SAAS,eAAe,UAAW,MAAK,WAAW,MAAM,KAAK,iBAAiB,CAAC;AAAA,QAC/E,MAAK,MAAM;AAAA,EAClB;AAAA,EAES,uBAA6B;AACpC,QAAI,KAAK,cAAe;AACxB,QAAI,KAAK,YAAY;AACnB,WAAK,aAAa;AAClB,UAAI;AACF,aAAK,MAAM,EAAE,WAAW,KAAK,CAAC;AAAA,MAChC,UAAE;AACA,aAAK,aAAa;AAAA,MACpB;AAAA,IACF;AACA,0BAAsB,IA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;AAAA;AAAA;AAAA;AAAA,EAQmB,SAAiB;AAClC,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overlays/emergency-dialog/emergency-dialog.element.ts","../../src/overlays/emergency-dialog/define.ts"],"sourcesContent":["import { A11yModalOverlayElement } from '../core/a11y-modal-overlay-element.js';\nimport type { IFocusTrapOptions } from '../../core/focus-trap.js';\n\n/**\n * A modal that cannot be dismissed except programmatically — no close\n * button, no backdrop-click-to-close, no Escape. For things the user must\n * consciously resolve (e.g. \"your session is about to expire\").\n *\n * `dismissible`/`non-dismissible` has no effect here — both getters are\n * hardcoded, not read from an attribute, so this safety property can't be\n * relaxed by setting an attribute on the element.\n *\n * ```html\n * <a11y-emergency-dialog><h2>Session expiring</h2>…</a11y-emergency-dialog>\n * ```\n */\nexport class EmergencyDialogElement extends A11yModalOverlayElement {\n declare onClose?: () => void;\n\n override get dismissible(): boolean {\n return false;\n }\n\n protected override focusTrapOptions(): IFocusTrapOptions {\n return { ...super.focusTrapOptions(), escapeDeactivates: false };\n }\n\n protected override createBackdrop(): HTMLElement {\n const el = super.createBackdrop();\n el.classList.add('a11y-emergency-dialog-overlay');\n return el;\n }\n\n protected override createWrapper(): HTMLElement {\n const el = super.createWrapper();\n el.classList.add('a11y-emergency-dialog-wrapper');\n return el;\n }\n\n protected override _onHidden(name?: string): void {\n super._onHidden(name);\n this.onClose?.();\n }\n}\n","import { defineElement } from '../../core/define-element.js';\nimport { EmergencyDialogElement } from './emergency-dialog.element.js';\n\ndefineElement('a11y-emergency-dialog', EmergencyDialogElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'a11y-emergency-dialog': EmergencyDialogElement;\n }\n}\n\nexport { EmergencyDialogElement };\nexport * from '../core/zero-build-exports.js';\n"],"mappings":";;;;;;;;AAgBO,IAAM,yBAAN,cAAqC,wBAAwB;AAAA,EAGlE,IAAa,cAAuB;AAClC,WAAO;AAAA,EACT;AAAA,EAEmB,mBAAsC;AACvD,WAAO,EAAE,GAAG,MAAM,iBAAiB,GAAG,mBAAmB,MAAM;AAAA,EACjE;AAAA,EAEmB,iBAA8B;AAC/C,UAAM,KAAK,MAAM,eAAe;AAChC,OAAG,UAAU,IAAI,+BAA+B;AAChD,WAAO;AAAA,EACT;AAAA,EAEmB,gBAA6B;AAC9C,UAAM,KAAK,MAAM,cAAc;AAC/B,OAAG,UAAU,IAAI,+BAA+B;AAChD,WAAO;AAAA,EACT;AAAA,EAEmB,UAAU,MAAqB;AAChD,UAAM,UAAU,IAAI;AACpB,SAAK,UAAU;AAAA,EACjB;AACF;;;ACxCA,cAAc,yBAAyB,sBAAsB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/overlay-registry.ts"],"sourcesContent":["export interface OverlayOpenCloseDetail {\n name: string;\n}\n\nexport const OVERLAY_OPEN_EVENT = 'a11y-overlay-open';\nexport const OVERLAY_CLOSE_EVENT = 'a11y-overlay-close';\n\ninterface Dismissible {\n close(): void;\n}\n\ninterface SharedState {\n openOverlays: Set<Dismissible>;\n scrollLocks: number;\n /** Each body-mounted overlay → the parent it was authored in, for `removeOverlaysWithin()`. */\n portalOrigins: Map<Element, Node>;\n}\n\n/**\n * Page-wide state, stored on `globalThis` rather than in module scope: each\n * standalone `dist/browser/**\\/define.js` bundle inlines its own copy of this\n * module, so a module-scoped `Set` would give every bundle loaded on the\n * same page its own private registry (and its own scroll-lock count). A\n * `Symbol.for()` key is shared across all of them.\n */\nconst STATE_KEY = Symbol.for('a11y-elements/overlay-state');\nconst store = globalThis as unknown as Record<symbol, SharedState | undefined>;\nconst state: SharedState = (store[STATE_KEY] ??= { openOverlays: new Set(), scrollLocks: 0, portalOrigins: new Map() });\n// A state object created by an older bundle on the same page predates this field.\nstate.portalOrigins ??= new Map();\n\n/**\n * Tracks every currently-open overlay instance so a consumer's own SPA\n * router (or anything else) can force-dismiss all of them, e.g. on\n * navigation — the framework-agnostic replacement for the old\n * `Lifecycle.onViewUnmount` global hook, which only `notification-banner`\n * used and `snackbar` deliberately opted out of. That asymmetry is\n * preserved: nothing here calls `dismissAllOverlays()` automatically, a\n * consumer wires it into their own navigation event if they want it.\n */\nexport function registerOpenOverlay(overlay: Dismissible): void {\n state.openOverlays.add(overlay);\n}\n\nexport function unregisterOpenOverlay(overlay: Dismissible): void {\n state.openOverlays.delete(overlay);\n}\n\nexport function dismissAllOverlays(): void {\n for (const overlay of Array.from(state.openOverlays)) overlay.close();\n}\n\n/** Remembers where an overlay was authored before it moved itself to `<body>`. */\nexport function recordPortalOrigin(overlay: Element, origin: Node): void {\n state.portalOrigins.set(overlay, origin);\n}\n\n/** Drops the record once an overlay leaves the document for real, so it isn't kept alive. */\nexport function forgetPortalOrigin(overlay: Element): void {\n state.portalOrigins.delete(overlay);\n}\n\n/**\n * Overlays move themselves to `<body>`, so removing the subtree they were\n * authored in (a component unmount, an SPA navigation) leaves them behind.\n * Call this with that subtree's root to remove every overlay authored inside\n * it (or directly in it) — it works after `host` has left the document too.\n * Returns how many were removed.\n */\nexport function removeOverlaysWithin(host: Node): number {\n let removed = 0;\n for (const [overlay, origin] of Array.from(state.portalOrigins)) {\n if (!host.contains(origin)) continue;\n overlay.remove(); // its disconnectedCallback tears it down and forgets it\n state.portalOrigins.delete(overlay);\n removed++;\n }\n return removed;\n}\n\nconst NO_SCROLL_CLASS = 'a11y-no-scroll';\n\n/**\n * Reference-counted page scroll lock. Every scroll-locking overlay (modal,\n * drawer, emergency-dialog, blocking-loader) calls `lockScroll()` once on\n * show and `unlockScroll()` once when fully hidden, so closing one of two\n * stacked overlays doesn't unlock the page under the one still open.\n */\nexport function lockScroll(): void {\n if (state.scrollLocks++ === 0) document.documentElement.classList.add(NO_SCROLL_CLASS);\n}\n\nexport function unlockScroll(): void {\n if (state.scrollLocks === 0) return;\n if (--state.scrollLocks === 0) document.documentElement.classList.remove(NO_SCROLL_CLASS);\n}\n\n/**\n * Standardized replacement for the old `Overlays.overlayOpened/overlayClosed`\n * singleton, which was only called by 4 of the 10 concrete overlays. Every\n * `A11yOverlayElement` now dispatches these uniformly on `document`.\n */\nexport function emitOverlayOpen(name: string): boolean {\n return document.dispatchEvent(\n new CustomEvent<OverlayOpenCloseDetail>(OVERLAY_OPEN_EVENT, { bubbles: true, detail: { name } }),\n );\n}\n\nexport function emitOverlayClose(name: string): boolean {\n return document.dispatchEvent(\n new CustomEvent<OverlayOpenCloseDetail>(OVERLAY_CLOSE_EVENT, { bubbles: true, detail: { name } }),\n );\n}\n"],"mappings":";AAIO,IAAM,qBAAqB;AAC3B,IAAM,sBAAsB;AAoBnC,IAAM,YAAY,uBAAO,IAAI,6BAA6B;AAC1D,IAAM,QAAQ;AACd,IAAM,QAAsB,MAAM,SAAS,MAAM,EAAE,cAAc,oBAAI,IAAI,GAAG,aAAa,GAAG,eAAe,oBAAI,IAAI,EAAE;AAErH,MAAM,kBAAkB,oBAAI,IAAI;AAWzB,SAAS,oBAAoB,SAA4B;AAC9D,QAAM,aAAa,IAAI,OAAO;AAChC;AAEO,SAAS,sBAAsB,SAA4B;AAChE,QAAM,aAAa,OAAO,OAAO;AACnC;AAEO,SAAS,qBAA2B;AACzC,aAAW,WAAW,MAAM,KAAK,MAAM,YAAY,EAAG,SAAQ,MAAM;AACtE;AAGO,SAAS,mBAAmB,SAAkB,QAAoB;AACvE,QAAM,cAAc,IAAI,SAAS,MAAM;AACzC;AAGO,SAAS,mBAAmB,SAAwB;AACzD,QAAM,cAAc,OAAO,OAAO;AACpC;AASO,SAAS,qBAAqB,MAAoB;AACvD,MAAI,UAAU;AACd,aAAW,CAAC,SAAS,MAAM,KAAK,MAAM,KAAK,MAAM,aAAa,GAAG;AAC/D,QAAI,CAAC,KAAK,SAAS,MAAM,EAAG;AAC5B,YAAQ,OAAO;AACf,UAAM,cAAc,OAAO,OAAO;AAClC;AAAA,EACF;AACA,SAAO;AACT;AAEA,IAAM,kBAAkB;AAQjB,SAAS,aAAmB;AACjC,MAAI,MAAM,kBAAkB,EAAG,UAAS,gBAAgB,UAAU,IAAI,eAAe;AACvF;AAEO,SAAS,eAAqB;AACnC,MAAI,MAAM,gBAAgB,EAAG;AAC7B,MAAI,EAAE,MAAM,gBAAgB,EAAG,UAAS,gBAAgB,UAAU,OAAO,eAAe;AAC1F;AAOO,SAAS,gBAAgB,MAAuB;AACrD,SAAO,SAAS;AAAA,IACd,IAAI,YAAoC,oBAAoB,EAAE,SAAS,MAAM,QAAQ,EAAE,KAAK,EAAE,CAAC;AAAA,EACjG;AACF;AAEO,SAAS,iBAAiB,MAAuB;AACtD,SAAO,SAAS;AAAA,IACd,IAAI,YAAoC,qBAAqB,EAAE,SAAS,MAAM,QAAQ,EAAE,KAAK,EAAE,CAAC;AAAA,EAClG;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/a11y-wrapper-element.ts"],"sourcesContent":["import { A11yElement } from './a11y-element.js';\n\n/**\n * Base for elements that enhance real, consumer-authored light-DOM children\n * instead of generating their own markup from a template string — e.g. a\n * `<a11y-picture>` wrapping a real `<picture>`/`<img>`/`<figcaption>`, or\n * `<a11y-select>` wrapping a real `<select>`/`<option>`s.\n *\n * Unlike `A11yElement`, this never sets `innerHTML` from a `render()`\n * string — that would destroy the author's children — so it opts out of the\n * normal render pipeline and instead re-syncs (`_sync()`) from two sources:\n *\n * - **This element's own observed attributes** (e.g. `label`, `legend`),\n * listed via `static observedAttributes` same as any other element —\n * these re-sync *synchronously*, matching every other element in this\n * library, so `el.setAttribute('label', 'x')` takes effect immediately.\n * - **Everything else** (children added/removed, an attribute changing on\n * one of *those* children) — light DOM has no `slotchange`, so a\n * `MutationObserver` is the equivalent, necessarily asynchronous (a real\n * microtask/task delay after the mutation).\n *\n * `_sync()` runs inside that `MutationObserver` callback, so every DOM write\n * it makes must be guarded (see `core/dom-sync.ts`) — `setAttribute`/\n * `classList.add`/`textContent =` all queue a mutation record even when the\n * value is unchanged, and an unguarded write would retrigger the observer\n * forever.\n */\nexport abstract class A11yWrapperElement extends A11yElement {\n private _observer: MutationObserver | null = null;\n /** Nodes already given their listeners since the last connect — see `wireOnce()`. */\n private _wiredNodes = new WeakSet<Node>();\n\n override connectedCallback(): void {\n this._initConnect();\n this._connected = true;\n this._sync();\n this._observer = new MutationObserver(() => this._sync());\n this._observer.observe(this, this.observerInit());\n }\n\n override disconnectedCallback(): void {\n this._observer?.disconnect();\n this._observer = null;\n super.disconnectedCallback(); // removes every `listen()` listener…\n this._wiredNodes = new WeakSet(); // …so the next connect must wire them again\n }\n\n override attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void {\n if (oldValue === newValue || !this._connected) return;\n this._sync();\n }\n\n /**\n * Runs `wire` the first time `node` is seen since this element was last\n * connected. `_sync()` runs on every mutation, so listener setup must be\n * idempotent — but those listeners (added via `listen()`) are all removed\n * on disconnect, so the \"already wired\" memory must reset with them, or a\n * reparented element (disconnect + connect) would silently stop firing.\n */\n protected wireOnce(node: Node, wire: () => void): void {\n if (this._wiredNodes.has(node)) return;\n this._wiredNodes.add(node);\n wire();\n }\n\n /** What to watch for changes worth re-syncing on. Override for a narrower/wider scope. */\n protected observerInit(): MutationObserverInit {\n return { childList: true, subtree: true, attributes: true };\n }\n\n /** Re-derive this element's own attributes/classes from its current children. */\n protected abstract _sync(): void;\n\n /** Unused — content is the author's own children, never replaced. */\n protected override render(): string {\n return '';\n }\n}\n"],"mappings":";;;;;AA2BO,IAAe,qBAAf,cAA0C,YAAY;AAAA,EACnD,YAAqC;AAAA;AAAA,EAErC,cAAc,oBAAI,QAAc;AAAA,EAE/B,oBAA0B;AACjC,SAAK,aAAa;AAClB,SAAK,aAAa;AAClB,SAAK,MAAM;AACX,SAAK,YAAY,IAAI,iBAAiB,MAAM,KAAK,MAAM,CAAC;AACxD,SAAK,UAAU,QAAQ,MAAM,KAAK,aAAa,CAAC;AAAA,EAClD;AAAA,EAES,uBAA6B;AACpC,SAAK,WAAW,WAAW;AAC3B,SAAK,YAAY;AACjB,UAAM,qBAAqB;AAC3B,SAAK,cAAc,oBAAI,QAAQ;AAAA,EACjC;AAAA,EAES,yBAAyB,OAAe,UAAyB,UAA+B;AACvG,QAAI,aAAa,YAAY,CAAC,KAAK,WAAY;AAC/C,SAAK,MAAM;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASU,SAAS,MAAY,MAAwB;AACrD,QAAI,KAAK,YAAY,IAAI,IAAI,EAAG;AAChC,SAAK,YAAY,IAAI,IAAI;AACzB,SAAK;AAAA,EACP;AAAA;AAAA,EAGU,eAAqC;AAC7C,WAAO,EAAE,WAAW,MAAM,SAAS,MAAM,YAAY,KAAK;AAAA,EAC5D;AAAA;AAAA,EAMmB,SAAiB;AAClC,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overlays/notification-banner/notification-banner.element.ts","../../src/overlays/notification-banner/define.ts"],"sourcesContent":["import { A11yPassiveOverlayElement, type PassiveOverlayItem } from '../core/a11y-passive-overlay-element.js';\nimport { getString } from '../../core/strings.js';\nimport { html, renderInto, type Raw } from '../../core/template.js';\n\nexport type NotificationBannerType = 'info' | 'success' | 'error';\n\nexport interface NotificationBannerOptions {\n type?: NotificationBannerType;\n position?: 'top' | 'bottom';\n actionText?: string;\n onAction?: () => void;\n onClose?: () => void;\n /** Sets the concurrency limit for this and all future items — sticky on the shared region, same as the `max-stack` attribute. */\n maxStack?: number;\n}\n\ninterface NotificationBannerItem extends PassiveOverlayItem {\n type?: NotificationBannerType;\n onClose?: () => void;\n}\n\n/**\n * A persistent banner region (unlike `<a11y-snackbar>`, items never\n * auto-dismiss — they stay until the user dismisses them or `dismissAll()`\n * is called). Place one `<a11y-notification-banner>` in your page, then\n * call `.show(message, options)` on it — or use the `showNotificationBanner()`\n * convenience export, which finds-or-creates one automatically.\n *\n * `dismissAll()` is the framework-agnostic replacement for the old\n * `Lifecycle.onViewUnmount` auto-wiring (which assumed a specific SPA-router\n * service) — if you want banners cleared on navigation, call it yourself\n * from your own router's navigation hook. Unlike `<a11y-snackbar>` (which\n * deliberately finishes its own timer regardless of navigation), this\n * asymmetry is intentional, not an oversight — a banner is scoped to the\n * page that raised it, a toast isn't.\n *\n * Each item's close button is named by `dismiss-label=\"…\"`, else\n * `setStrings({ dismiss })`.\n */\nexport class NotificationBannerElement extends A11yPassiveOverlayElement<NotificationBannerItem> {\n private _topContainer!: HTMLElement;\n private _bottomContainer!: HTMLElement;\n private _active: Array<{ el: HTMLElement; onClose?: () => void }> = [];\n\n static override get observedAttributes(): string[] {\n return [...super.observedAttributes, 'dismiss-label'];\n }\n\n /** The accessible name of each item's close button. */\n get dismissLabel(): string {\n return this.stringAttr('dismiss-label', getString('dismiss'));\n }\n\n override attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {\n super.attributeChangedCallback(name, oldValue, newValue);\n if (name === 'dismiss-label' && oldValue !== newValue) this._relabelDismissButtons();\n }\n\n protected override onStringsChange(): void {\n this._relabelDismissButtons();\n }\n\n private _relabelDismissButtons(): void {\n for (const { el } of this._active) {\n el.querySelector('.a11y-notification-banner__close')?.setAttribute('aria-label', this.dismissLabel);\n }\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.classList.add('a11y-notification-banner-region');\n if (!this._topContainer) {\n this._topContainer = document.createElement('div');\n this._topContainer.className = 'a11y-notification-banner-region__top';\n this._bottomContainer = document.createElement('div');\n this._bottomContainer.className = 'a11y-notification-banner-region__bottom';\n this.append(this._topContainer, this._bottomContainer);\n }\n }\n\n show(message: string | Raw, options: NotificationBannerOptions = {}): void {\n if (options.maxStack) this.setMaxStack(options.maxStack);\n this.enqueue({\n message,\n type: options.type,\n position: options.position,\n actionText: options.actionText,\n onAction: options.onAction,\n onClose: options.onClose,\n });\n }\n\n /** Force-dismisses every showing/queued item. Queued items never shown are dropped silently (no onClose); active ones get their onClose called. */\n dismissAll(): void {\n this._queue = [];\n const toClose = this._active;\n this._active = [];\n this._activeCount = 0;\n toClose.forEach(({ el, onClose }) => {\n el.remove();\n onClose?.();\n });\n }\n\n protected _showItem(item: NotificationBannerItem): void {\n const type = item.type ?? 'info';\n const position = item.position ?? 'top';\n const container = position === 'top' ? this._topContainer : this._bottomContainer;\n\n const el = document.createElement('div');\n el.className = `a11y-notification-banner a11y-notification-banner--${type}`;\n el.setAttribute('role', type === 'error' ? 'alert' : 'status');\n el.setAttribute('aria-live', type === 'error' ? 'assertive' : 'polite');\n renderInto(el, html`\n <span class=\"a11y-notification-banner__message\">${item.message}</span>\n <span class=\"a11y-notification-banner__actions\">\n ${item.actionText ? html`<button type=\"button\" class=\"a11y-notification-banner__action\">${item.actionText}</button>` : ''}\n <button type=\"button\" class=\"a11y-notification-banner__close\" aria-label=\"${this.dismissLabel}\">×</button>\n </span>\n `);\n\n container.appendChild(el);\n\n const entry = { el, onClose: item.onClose };\n this._active.push(entry);\n\n const dismiss = (): void => {\n el.remove();\n this._active = this._active.filter((a) => a !== entry);\n item.onClose?.();\n this._onItemDismissed();\n };\n\n if (item.actionText && item.onAction) {\n const actionBtn = el.querySelector<HTMLButtonElement>('.a11y-notification-banner__action');\n actionBtn?.addEventListener('click', () => {\n item.onAction?.();\n dismiss();\n });\n }\n\n el.querySelector<HTMLButtonElement>('.a11y-notification-banner__close')?.addEventListener('click', dismiss);\n }\n}\n","import { defineElement } from '../../core/define-element.js';\nimport type { Raw } from '../../core/template.js';\nimport { NotificationBannerElement, type NotificationBannerOptions } from './notification-banner.element.js';\n\ndefineElement('a11y-notification-banner', NotificationBannerElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'a11y-notification-banner': NotificationBannerElement;\n }\n}\n\nexport { NotificationBannerElement, type NotificationBannerOptions };\n\nlet cachedRegion: NotificationBannerElement | null = null;\n\nfunction getRegion(): NotificationBannerElement {\n const existing = document.querySelector<NotificationBannerElement>('a11y-notification-banner');\n if (existing) return existing;\n if (!cachedRegion || !cachedRegion.isConnected) {\n cachedRegion = document.createElement('a11y-notification-banner') as NotificationBannerElement;\n document.body.appendChild(cachedRegion);\n }\n return cachedRegion;\n}\n\n/**\n * Convenience: finds (or creates) an `<a11y-notification-banner>` region and\n * shows a banner in it. Skip this entirely and call `.show()` on your own\n * `<a11y-notification-banner>` element directly if you want explicit control\n * over where it lives in the DOM.\n */\nexport function showNotificationBanner(message: string | Raw, options: NotificationBannerOptions = {}): void {\n getRegion().show(message, options);\n}\n\nexport * from '../core/zero-build-exports.js';\n"],"mappings":";;;;;;;;;;;AAuCO,IAAM,4BAAN,cAAwC,0BAAkD;AAAA,EACvF;AAAA,EACA;AAAA,EACA,UAA4D,CAAC;AAAA,EAErE,WAAoB,qBAA+B;AACjD,WAAO,CAAC,GAAG,MAAM,oBAAoB,eAAe;AAAA,EACtD;AAAA;AAAA,EAGA,IAAI,eAAuB;AACzB,WAAO,KAAK,WAAW,iBAAiB,UAAU,SAAS,CAAC;AAAA,EAC9D;AAAA,EAES,yBAAyB,MAAc,UAAyB,UAA+B;AACtG,UAAM,yBAAyB,MAAM,UAAU,QAAQ;AACvD,QAAI,SAAS,mBAAmB,aAAa,SAAU,MAAK,uBAAuB;AAAA,EACrF;AAAA,EAEmB,kBAAwB;AACzC,SAAK,uBAAuB;AAAA,EAC9B;AAAA,EAEQ,yBAA+B;AACrC,eAAW,EAAE,GAAG,KAAK,KAAK,SAAS;AACjC,SAAG,cAAc,kCAAkC,GAAG,aAAa,cAAc,KAAK,YAAY;AAAA,IACpG;AAAA,EACF;AAAA,EAES,oBAA0B;AACjC,UAAM,kBAAkB;AACxB,SAAK,UAAU,IAAI,iCAAiC;AACpD,QAAI,CAAC,KAAK,eAAe;AACvB,WAAK,gBAAgB,SAAS,cAAc,KAAK;AACjD,WAAK,cAAc,YAAY;AAC/B,WAAK,mBAAmB,SAAS,cAAc,KAAK;AACpD,WAAK,iBAAiB,YAAY;AAClC,WAAK,OAAO,KAAK,eAAe,KAAK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,WAAK,iBAAiB;AAAA,IACxB;AAEA,QAAI,KAAK,cAAc,KAAK,UAAU;AACpC,YAAM,YAAY,GAAG,cAAiC,mCAAmC;AACzF,iBAAW,iBAAiB,SAAS,MAAM;AACzC,aAAK,WAAW;AAChB,gBAAQ;AAAA,MACV,CAAC;AAAA,IACH;AAEA,OAAG,cAAiC,kCAAkC,GAAG,iBAAiB,SAAS,OAAO;AAAA,EAC5G;AACF;;;AC3IA,cAAc,4BAA4B,yBAAyB;AAUnE,IAAI,eAAiD;AAErD,SAAS,YAAuC;AAC9C,QAAM,WAAW,SAAS,cAAyC,0BAA0B;AAC7F,MAAI,SAAU,QAAO;AACrB,MAAI,CAAC,gBAAgB,CAAC,aAAa,aAAa;AAC9C,mBAAe,SAAS,cAAc,0BAA0B;AAChE,aAAS,KAAK,YAAY,YAAY;AAAA,EACxC;AACA,SAAO;AACT;AAQO,SAAS,uBAAuB,SAAuB,UAAqC,CAAC,GAAS;AAC3G,YAAU,EAAE,KAAK,SAAS,OAAO;AACnC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overlays/snackbar/snackbar.element.ts","../../src/overlays/snackbar/define.ts"],"sourcesContent":["import { A11yPassiveOverlayElement, type PassiveOverlayItem } from '../core/a11y-passive-overlay-element.js';\nimport { html, renderInto, type Raw } from '../../core/template.js';\n\nexport type SnackbarType = 'info' | 'success' | 'error' | 'warning';\n\nexport interface NotifyOptions {\n type?: SnackbarType;\n position?: 'top' | 'bottom';\n duration?: number;\n actionText?: string;\n onAction?: () => void;\n /** Sets the concurrency limit for this and all future items — sticky on the shared region, same as the `max-stack` attribute. */\n maxStack?: number;\n}\n\ninterface SnackbarItem extends PassiveOverlayItem {\n type?: SnackbarType;\n}\n\n/**\n * A toast notification region. Auto-dismisses after `duration`ms — default\n * 3000, or 10000 when the toast has an action button (time to reach it) —\n * paused while the toast is hovered or focused. Place one `<a11y-snackbar></a11y-snackbar>` anywhere in your page\n * (it portals itself to `document.body`), then call `.notify(message, options)`\n * on it — or skip placing one entirely and use the `notify()` convenience\n * export from this module, which finds-or-creates one automatically.\n */\nexport class SnackbarElement extends A11yPassiveOverlayElement<SnackbarItem> {\n private _bottomContainer!: HTMLElement;\n private _topContainer!: HTMLElement;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.classList.add('a11y-snackbar-region');\n if (!this._bottomContainer) {\n this._bottomContainer = document.createElement('div');\n this._bottomContainer.className = 'a11y-snackbar-region__bottom';\n this._topContainer = document.createElement('div');\n this._topContainer.className = 'a11y-snackbar-region__top';\n this.append(this._bottomContainer, this._topContainer);\n }\n }\n\n notify(message: string | Raw, options: NotifyOptions = {}): void {\n if (options.maxStack) this.setMaxStack(options.maxStack);\n this.enqueue({\n message,\n type: options.type,\n position: options.position,\n duration: options.duration,\n actionText: options.actionText,\n onAction: options.onAction,\n });\n }\n\n protected _showItem(item: SnackbarItem): void {\n const type = item.type ?? 'info';\n const position = item.position ?? 'bottom';\n const duration = item.duration ?? (item.actionText ? 10_000 : 3000);\n const container = position === 'bottom' ? this._bottomContainer : this._topContainer;\n\n const el = document.createElement('div');\n el.className = `a11y-snackbar a11y-snackbar--${type}`;\n el.setAttribute('role', type === 'error' ? 'alert' : 'status');\n el.setAttribute('aria-live', type === 'error' ? 'assertive' : 'polite');\n el.setAttribute('aria-atomic', 'true');\n renderInto(el, html`\n <span>${item.message}</span>\n ${item.actionText ? html`<button type=\"button\">${item.actionText}</button>` : ''}\n `);\n\n container.appendChild(el);\n\n const cancelAutoDismiss = this._autoDismiss(el, duration, () => this._onItemDismissed());\n\n el.querySelector<HTMLButtonElement>('button')?.addEventListener('click', () => {\n cancelAutoDismiss();\n el.remove();\n this._onItemDismissed();\n item.onAction?.();\n });\n }\n}\n","import { defineElement } from '../../core/define-element.js';\nimport type { Raw } from '../../core/template.js';\nimport { SnackbarElement, type NotifyOptions } from './snackbar.element.js';\n\ndefineElement('a11y-snackbar', SnackbarElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'a11y-snackbar': SnackbarElement;\n }\n}\n\nexport { SnackbarElement, type NotifyOptions };\n\nlet cachedRegion: SnackbarElement | null = null;\n\nfunction getRegion(): SnackbarElement {\n const existing = document.querySelector<SnackbarElement>('a11y-snackbar');\n if (existing) return existing;\n if (!cachedRegion || !cachedRegion.isConnected) {\n cachedRegion = document.createElement('a11y-snackbar') as SnackbarElement;\n document.body.appendChild(cachedRegion);\n }\n return cachedRegion;\n}\n\n/**\n * Convenience: finds (or creates) an `<a11y-snackbar>` region and shows a\n * toast in it. Skip this entirely and call `.notify()` on your own\n * `<a11y-snackbar>` element directly if you want explicit control over\n * where it lives in the DOM.\n */\nexport function notify(message: string | Raw, options: NotifyOptions = {}): void {\n getRegion().notify(message, options);\n}\n\nexport * from '../core/zero-build-exports.js';\n"],"mappings":";;;;;;;;;;AA2BO,IAAM,kBAAN,cAA8B,0BAAwC;AAAA,EACnE;AAAA,EACA;AAAA,EAEC,oBAA0B;AACjC,UAAM,kBAAkB;AACxB,SAAK,UAAU,IAAI,sBAAsB;AACzC,QAAI,CAAC,KAAK,kBAAkB;AAC1B,WAAK,mBAAmB,SAAS,cAAc,KAAK;AACpD,WAAK,iBAAiB,YAAY;AAClC,WAAK,gBAAgB,SAAS,cAAc,KAAK;AACjD,WAAK,cAAc,YAAY;AAC/B,WAAK,OAAO,KAAK,kBAAkB,KAAK,aAAa;AAAA,IACvD;AAAA,EACF;AAAA,EAEA,OAAO,SAAuB,UAAyB,CAAC,GAAS;AAC/D,QAAI,QAAQ,SAAU,MAAK,YAAY,QAAQ,QAAQ;AACvD,SAAK,QAAQ;AAAA,MACX;AAAA,MACA,MAAM,QAAQ;AAAA,MACd,UAAU,QAAQ;AAAA,MAClB,UAAU,QAAQ;AAAA,MAClB,YAAY,QAAQ;AAAA,MACpB,UAAU,QAAQ;AAAA,IACpB,CAAC;AAAA,EACH;AAAA,EAEU,UAAU,MAA0B;AAC5C,UAAM,OAAO,KAAK,QAAQ;AAC1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