a11y-elements 0.7.0 → 1.0.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 +112 -72
- package/dist/a11y.css +28 -1
- package/dist/browser/all.js +43 -43
- package/dist/browser/{chunk-P22R5WMV.js → chunk-44L3YUQJ.js} +7 -6
- package/dist/browser/chunk-44L3YUQJ.js.map +1 -0
- package/dist/browser/{chunk-4KU26VOY.js → chunk-5RSHQHGV.js} +6 -2
- package/dist/browser/chunk-5RSHQHGV.js.map +1 -0
- package/dist/browser/{chunk-X3FGPMOG.js → chunk-5YFWJMAQ.js} +14 -11
- package/dist/browser/chunk-5YFWJMAQ.js.map +1 -0
- package/dist/browser/{chunk-VZZ6PGGW.js → chunk-6IEDNGLL.js} +3 -3
- package/dist/browser/{chunk-XNWCI66X.js → chunk-7PDXC6SD.js} +52 -6
- package/dist/browser/chunk-7PDXC6SD.js.map +1 -0
- package/dist/browser/{chunk-DFQ4O2RT.js → chunk-7QXDGULX.js} +15 -8
- package/dist/browser/chunk-7QXDGULX.js.map +1 -0
- package/dist/browser/{chunk-S3G36NHT.js → chunk-APLB5CIR.js} +30 -6
- package/dist/browser/chunk-APLB5CIR.js.map +1 -0
- package/dist/browser/{chunk-5SFYIGMT.js → chunk-CC6Q5ZYC.js} +3 -3
- package/dist/browser/{chunk-K4P65IHJ.js → chunk-CTZJDUT7.js} +27 -26
- package/dist/browser/chunk-CTZJDUT7.js.map +1 -0
- package/dist/browser/{chunk-ANCRYRXA.js → chunk-DF7YV5G6.js} +17 -16
- package/dist/browser/chunk-DF7YV5G6.js.map +1 -0
- package/dist/browser/{chunk-F4AVN6JZ.js → chunk-DRPQFOOG.js} +2 -2
- package/dist/browser/{chunk-IAXHGJ62.js → chunk-DSJKEIPD.js} +3 -3
- package/dist/browser/chunk-EDDGUTWP.js +147 -0
- package/dist/browser/chunk-EDDGUTWP.js.map +1 -0
- package/dist/browser/{chunk-GJIJX2MO.js → chunk-EQB7LLIW.js} +3 -3
- package/dist/browser/{chunk-JZJW3GXR.js → chunk-EU7DRJE4.js} +32 -19
- package/dist/browser/chunk-EU7DRJE4.js.map +1 -0
- package/dist/browser/{chunk-4JFOUSU7.js → chunk-HWWZILDK.js} +17 -12
- package/dist/browser/chunk-HWWZILDK.js.map +1 -0
- package/dist/browser/{chunk-K24OBXOZ.js → chunk-JGSJG5EU.js} +11 -8
- package/dist/browser/chunk-JGSJG5EU.js.map +1 -0
- package/dist/browser/{chunk-H23YF56K.js → chunk-K67ZZOBF.js} +4 -4
- package/dist/browser/{chunk-73Y3YTSE.js → chunk-KCPJBNAY.js} +15 -9
- package/dist/browser/chunk-KCPJBNAY.js.map +1 -0
- package/dist/browser/{chunk-BLDP54O5.js → chunk-KFG6RX7I.js} +3 -3
- package/dist/browser/{chunk-R3ESHCSH.js → chunk-LJBKYSX6.js} +55 -29
- package/dist/browser/chunk-LJBKYSX6.js.map +1 -0
- package/dist/browser/{chunk-2E2MNSPU.js → chunk-MAAAS7KK.js} +6 -6
- package/dist/browser/chunk-MCZ5NL77.js +115 -0
- package/dist/browser/chunk-MCZ5NL77.js.map +1 -0
- package/dist/browser/{chunk-IP2X2FJW.js → chunk-MDFG22D6.js} +10 -7
- package/dist/browser/chunk-MDFG22D6.js.map +1 -0
- package/dist/browser/{chunk-F47DDMFE.js → chunk-MNWKDM3I.js} +22 -2
- package/dist/browser/chunk-MNWKDM3I.js.map +1 -0
- package/dist/browser/{chunk-QT3RDF3H.js → chunk-MOCHOGCP.js} +6 -5
- package/dist/browser/chunk-MOCHOGCP.js.map +1 -0
- package/dist/browser/{chunk-VAMC6L65.js → chunk-MY5QZOLS.js} +12 -7
- package/dist/browser/chunk-MY5QZOLS.js.map +1 -0
- package/dist/browser/{chunk-6AYXOLXI.js → chunk-NAUZUS6P.js} +7 -6
- package/dist/browser/chunk-NAUZUS6P.js.map +1 -0
- package/dist/browser/{chunk-ACNPSWNA.js → chunk-NTKTYCDW.js} +6 -5
- package/dist/browser/chunk-NTKTYCDW.js.map +1 -0
- package/dist/browser/{chunk-DO53LTZ7.js → chunk-O57KZZ6M.js} +40 -12
- package/dist/browser/chunk-O57KZZ6M.js.map +1 -0
- package/dist/browser/{chunk-NEQKRAIP.js → chunk-PDDWEAQP.js} +4 -3
- package/dist/browser/chunk-PDDWEAQP.js.map +1 -0
- package/dist/browser/{chunk-6G3UL7FH.js → chunk-R66EFEQ3.js} +3 -3
- package/dist/browser/{chunk-3IYYFR25.js → chunk-UEEWMPZ5.js} +11 -6
- package/dist/browser/chunk-UEEWMPZ5.js.map +1 -0
- package/dist/browser/{chunk-O6WGSOHI.js → chunk-VEP2LUWY.js} +4 -4
- package/dist/browser/{chunk-GEGVADVM.js → chunk-VWWLEAFY.js} +11 -6
- package/dist/browser/chunk-VWWLEAFY.js.map +1 -0
- package/dist/browser/{chunk-PTU2DM52.js → chunk-VYWCL2P2.js} +18 -9
- package/dist/browser/chunk-VYWCL2P2.js.map +1 -0
- package/dist/browser/{chunk-7NNZKO4M.js → chunk-W4ZI3OMR.js} +2 -2
- package/dist/browser/{chunk-HF2UHDNK.js → chunk-WBIAPWRP.js} +3 -3
- package/dist/browser/{chunk-GFNWEW7C.js → chunk-WLOXJS2P.js} +11 -7
- package/dist/browser/chunk-WLOXJS2P.js.map +1 -0
- package/dist/browser/{chunk-CKFVCVMO.js → chunk-WM7T7VI4.js} +16 -14
- package/dist/browser/chunk-WM7T7VI4.js.map +1 -0
- package/dist/browser/{chunk-PWR4UC47.js → chunk-YCZIATJ3.js} +47 -20
- package/dist/browser/chunk-YCZIATJ3.js.map +1 -0
- package/dist/browser/{chunk-EOI2JDNP.js → chunk-YEEV4BVN.js} +12 -9
- package/dist/browser/chunk-YEEV4BVN.js.map +1 -0
- package/dist/browser/{chunk-XWWLU5PH.js → chunk-ZYWLTQ77.js} +6 -5
- package/dist/browser/chunk-ZYWLTQ77.js.map +1 -0
- package/dist/browser/components/anchor/define.js +3 -3
- package/dist/browser/components/avatar/define.js +3 -3
- package/dist/browser/components/card-link/define.js +4 -4
- 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 +5 -5
- package/dist/browser/components/focusable/define.js +2 -2
- package/dist/browser/components/input/define.js +5 -5
- 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 +4 -4
- 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 -3
- package/dist/browser/components/spinner/define.js +3 -3
- package/dist/browser/components/switch/define.js +3 -3
- package/dist/browser/components/tabs/define.js +4 -4
- package/dist/browser/components/textarea/define.js +5 -5
- package/dist/browser/components/visually-hidden/define.js +2 -2
- package/dist/browser/overlays/blocking-loader/define.js +7 -7
- package/dist/browser/overlays/context-menu/define.js +8 -8
- package/dist/browser/overlays/drawer/define.js +8 -8
- package/dist/browser/overlays/dropdown/define.js +9 -9
- package/dist/browser/overlays/emergency-dialog/define.js +8 -8
- package/dist/browser/overlays/floating/define.js +6 -6
- package/dist/browser/overlays/modal/define.js +9 -9
- package/dist/browser/overlays/notification-banner/define.js +5 -5
- package/dist/browser/overlays/popover/define.js +8 -8
- package/dist/browser/overlays/snackbar/define.js +5 -5
- package/dist/browser/overlays/tooltip/define.js +8 -8
- package/dist/components/anchor/anchor.element.d.ts +2 -0
- package/dist/components/anchor/anchor.element.js +12 -6
- package/dist/components/anchor/anchor.element.js.map +1 -1
- package/dist/components/card-link/card-link.element.js +2 -1
- package/dist/components/card-link/card-link.element.js.map +1 -1
- package/dist/components/checkbox/checkbox.element.d.ts +2 -0
- package/dist/components/checkbox/checkbox.element.js +11 -3
- package/dist/components/checkbox/checkbox.element.js.map +1 -1
- package/dist/components/checkbox-group/checkbox-group.element.js +17 -9
- package/dist/components/checkbox-group/checkbox-group.element.js.map +1 -1
- package/dist/components/file-input/file-input.element.js +13 -12
- package/dist/components/file-input/file-input.element.js.map +1 -1
- package/dist/components/focusable/focusable.element.js +5 -1
- package/dist/components/focusable/focusable.element.js.map +1 -1
- package/dist/components/label/label.element.js +2 -1
- package/dist/components/label/label.element.js.map +1 -1
- package/dist/components/picture/picture.element.js +12 -5
- package/dist/components/picture/picture.element.js.map +1 -1
- package/dist/components/progress/progress.element.d.ts +2 -0
- package/dist/components/progress/progress.element.js +8 -2
- package/dist/components/progress/progress.element.js.map +1 -1
- package/dist/components/radio-group/radio-group.element.js +9 -3
- package/dist/components/radio-group/radio-group.element.js.map +1 -1
- package/dist/components/select/select.element.js +3 -2
- package/dist/components/select/select.element.js.map +1 -1
- package/dist/components/switch/switch.element.js +3 -2
- package/dist/components/switch/switch.element.js.map +1 -1
- package/dist/components/tabs/tabs.element.d.ts +2 -0
- package/dist/components/tabs/tabs.element.js +13 -3
- package/dist/components/tabs/tabs.element.js.map +1 -1
- package/dist/core/a11y-element.d.ts +1 -0
- package/dist/core/a11y-element.js +5 -3
- package/dist/core/a11y-element.js.map +1 -1
- package/dist/core/a11y-field-element.js +3 -1
- package/dist/core/a11y-field-element.js.map +1 -1
- package/dist/core/a11y-overlay-element.js +10 -6
- package/dist/core/a11y-overlay-element.js.map +1 -1
- package/dist/core/dom.js +6 -4
- package/dist/core/dom.js.map +1 -1
- package/dist/core/field.js +5 -4
- package/dist/core/field.js.map +1 -1
- package/dist/core/focus-trap.d.ts +13 -1
- package/dist/core/focus-trap.js +71 -33
- package/dist/core/focus-trap.js.map +1 -1
- package/dist/core/ids.js +2 -1
- package/dist/core/ids.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 +25 -3
- package/dist/core/overlay-registry.js +105 -22
- package/dist/core/overlay-registry.js.map +1 -1
- package/dist/core/safe-dom.d.ts +35 -0
- package/dist/core/safe-dom.js +62 -0
- package/dist/core/safe-dom.js.map +1 -0
- package/dist/core/sanitize.d.ts +1 -7
- package/dist/core/sanitize.js +53 -14
- package/dist/core/sanitize.js.map +1 -1
- package/dist/core/strings.js +3 -2
- package/dist/core/strings.js.map +1 -1
- package/dist/core/template.d.ts +3 -1
- package/dist/core/template.js +5 -3
- package/dist/core/template.js.map +1 -1
- package/dist/core/transition.d.ts +8 -2
- package/dist/core/transition.js +34 -4
- package/dist/core/transition.js.map +1 -1
- package/dist/overlays/context-menu/context-menu.element.js +2 -1
- package/dist/overlays/context-menu/context-menu.element.js.map +1 -1
- package/dist/overlays/core/a11y-anchored-overlay-element.js +33 -15
- package/dist/overlays/core/a11y-anchored-overlay-element.js.map +1 -1
- package/dist/overlays/core/a11y-menu-overlay-element.d.ts +9 -0
- package/dist/overlays/core/a11y-menu-overlay-element.js +40 -9
- package/dist/overlays/core/a11y-menu-overlay-element.js.map +1 -1
- package/dist/overlays/core/a11y-modal-overlay-element.js +10 -7
- package/dist/overlays/core/a11y-modal-overlay-element.js.map +1 -1
- package/dist/overlays/core/a11y-passive-overlay-element.d.ts +18 -1
- package/dist/overlays/core/a11y-passive-overlay-element.js +39 -2
- package/dist/overlays/core/a11y-passive-overlay-element.js.map +1 -1
- package/dist/overlays/dropdown/dropdown.element.d.ts +1 -0
- package/dist/overlays/dropdown/dropdown.element.js +9 -2
- package/dist/overlays/dropdown/dropdown.element.js.map +1 -1
- package/dist/overlays/floating/floating.element.js +22 -21
- package/dist/overlays/floating/floating.element.js.map +1 -1
- package/dist/overlays/modal/confirm-dialog.js +7 -3
- package/dist/overlays/modal/confirm-dialog.js.map +1 -1
- package/dist/overlays/notification-banner/define.js +4 -3
- package/dist/overlays/notification-banner/define.js.map +1 -1
- package/dist/overlays/notification-banner/notification-banner.element.d.ts +4 -4
- package/dist/overlays/notification-banner/notification-banner.element.js +14 -8
- package/dist/overlays/notification-banner/notification-banner.element.js.map +1 -1
- package/dist/overlays/snackbar/define.js +4 -3
- package/dist/overlays/snackbar/define.js.map +1 -1
- package/dist/overlays/snackbar/snackbar.element.d.ts +18 -0
- package/dist/overlays/snackbar/snackbar.element.js +52 -6
- package/dist/overlays/snackbar/snackbar.element.js.map +1 -1
- package/package.json +1 -1
- package/dist/browser/chunk-23I2KVFV.js +0 -85
- package/dist/browser/chunk-23I2KVFV.js.map +0 -1
- package/dist/browser/chunk-3IYYFR25.js.map +0 -1
- package/dist/browser/chunk-4JFOUSU7.js.map +0 -1
- package/dist/browser/chunk-4KU26VOY.js.map +0 -1
- package/dist/browser/chunk-6AYXOLXI.js.map +0 -1
- package/dist/browser/chunk-73Y3YTSE.js.map +0 -1
- package/dist/browser/chunk-ACNPSWNA.js.map +0 -1
- package/dist/browser/chunk-ANCRYRXA.js.map +0 -1
- package/dist/browser/chunk-CKFVCVMO.js.map +0 -1
- package/dist/browser/chunk-DFQ4O2RT.js.map +0 -1
- package/dist/browser/chunk-DO53LTZ7.js.map +0 -1
- package/dist/browser/chunk-EOI2JDNP.js.map +0 -1
- package/dist/browser/chunk-F47DDMFE.js.map +0 -1
- package/dist/browser/chunk-GEGVADVM.js.map +0 -1
- package/dist/browser/chunk-GFNWEW7C.js.map +0 -1
- package/dist/browser/chunk-HMJBQAFR.js +0 -80
- package/dist/browser/chunk-HMJBQAFR.js.map +0 -1
- package/dist/browser/chunk-IP2X2FJW.js.map +0 -1
- package/dist/browser/chunk-JZJW3GXR.js.map +0 -1
- package/dist/browser/chunk-K24OBXOZ.js.map +0 -1
- package/dist/browser/chunk-K4P65IHJ.js.map +0 -1
- package/dist/browser/chunk-NEQKRAIP.js.map +0 -1
- package/dist/browser/chunk-P22R5WMV.js.map +0 -1
- package/dist/browser/chunk-PTU2DM52.js.map +0 -1
- package/dist/browser/chunk-PWR4UC47.js.map +0 -1
- package/dist/browser/chunk-QT3RDF3H.js.map +0 -1
- package/dist/browser/chunk-R3ESHCSH.js.map +0 -1
- package/dist/browser/chunk-S3G36NHT.js.map +0 -1
- package/dist/browser/chunk-VAMC6L65.js.map +0 -1
- package/dist/browser/chunk-X3FGPMOG.js.map +0 -1
- package/dist/browser/chunk-XNWCI66X.js.map +0 -1
- package/dist/browser/chunk-XWWLU5PH.js.map +0 -1
- /package/dist/browser/{chunk-VZZ6PGGW.js.map → chunk-6IEDNGLL.js.map} +0 -0
- /package/dist/browser/{chunk-5SFYIGMT.js.map → chunk-CC6Q5ZYC.js.map} +0 -0
- /package/dist/browser/{chunk-F4AVN6JZ.js.map → chunk-DRPQFOOG.js.map} +0 -0
- /package/dist/browser/{chunk-IAXHGJ62.js.map → chunk-DSJKEIPD.js.map} +0 -0
- /package/dist/browser/{chunk-GJIJX2MO.js.map → chunk-EQB7LLIW.js.map} +0 -0
- /package/dist/browser/{chunk-H23YF56K.js.map → chunk-K67ZZOBF.js.map} +0 -0
- /package/dist/browser/{chunk-BLDP54O5.js.map → chunk-KFG6RX7I.js.map} +0 -0
- /package/dist/browser/{chunk-2E2MNSPU.js.map → chunk-MAAAS7KK.js.map} +0 -0
- /package/dist/browser/{chunk-6G3UL7FH.js.map → chunk-R66EFEQ3.js.map} +0 -0
- /package/dist/browser/{chunk-O6WGSOHI.js.map → chunk-VEP2LUWY.js.map} +0 -0
- /package/dist/browser/{chunk-7NNZKO4M.js.map → chunk-W4ZI3OMR.js.map} +0 -0
- /package/dist/browser/{chunk-HF2UHDNK.js.map → chunk-WBIAPWRP.js.map} +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { A11yPassiveOverlayElement } from '../core/a11y-passive-overlay-element.js';
|
|
2
|
+
import { getString } from '../../core/strings.js';
|
|
2
3
|
import { h } from '../../core/dom.js';
|
|
4
|
+
import { doc } from '../../core/safe-dom.js';
|
|
3
5
|
/**
|
|
4
6
|
* A toast notification region. Auto-dismisses after `duration`ms — default
|
|
5
7
|
* 3000, or 10000 when the toast has an action button (time to reach it) —
|
|
@@ -7,20 +9,59 @@ import { h } from '../../core/dom.js';
|
|
|
7
9
|
* (it portals itself to `document.body`), then call `.notify(message, options)`
|
|
8
10
|
* on it — or skip placing one entirely and use the `notify()` convenience
|
|
9
11
|
* export from this module, which finds-or-creates one automatically.
|
|
12
|
+
*
|
|
13
|
+
* Every toast has a round × close button in its top-right corner that
|
|
14
|
+
* dismisses it early (without calling `onAction`). It's named by
|
|
15
|
+
* `dismiss-label="…"`, else `setStrings({ dismiss })`.
|
|
16
|
+
*
|
|
17
|
+
* While the region stays in the page, toasts finish their own timers
|
|
18
|
+
* regardless of navigation (call `dismissAll()` to clear them). Removing the
|
|
19
|
+
* region from the document drops its toasts, queued ones included, and
|
|
20
|
+
* cancels their timers; re-adding it starts empty.
|
|
10
21
|
*/
|
|
11
22
|
export class SnackbarElement extends A11yPassiveOverlayElement {
|
|
12
23
|
_bottomContainer;
|
|
13
24
|
_topContainer;
|
|
25
|
+
static get observedAttributes() {
|
|
26
|
+
return [...super.observedAttributes, 'dismiss-label'];
|
|
27
|
+
}
|
|
28
|
+
/** The accessible name of each toast's close button. */
|
|
29
|
+
get dismissLabel() {
|
|
30
|
+
return this.stringAttr('dismiss-label', getString('dismiss'));
|
|
31
|
+
}
|
|
32
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
33
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
34
|
+
if (name === 'dismiss-label' && oldValue !== newValue)
|
|
35
|
+
this._relabelDismissButtons();
|
|
36
|
+
}
|
|
37
|
+
onStringsChange() {
|
|
38
|
+
this._relabelDismissButtons();
|
|
39
|
+
}
|
|
40
|
+
_relabelDismissButtons() {
|
|
41
|
+
for (const btn of this.querySelectorAll('.a11y-snackbar__close'))
|
|
42
|
+
btn.setAttribute('aria-label', this.dismissLabel);
|
|
43
|
+
}
|
|
14
44
|
connectedCallback() {
|
|
15
45
|
super.connectedCallback();
|
|
16
46
|
this.classList.add('a11y-snackbar-region');
|
|
17
47
|
if (!this._bottomContainer) {
|
|
18
|
-
this._bottomContainer =
|
|
48
|
+
this._bottomContainer = doc.createElement('div');
|
|
19
49
|
this._bottomContainer.className = 'a11y-snackbar-region__bottom';
|
|
20
|
-
this._topContainer =
|
|
50
|
+
this._topContainer = doc.createElement('div');
|
|
21
51
|
this._topContainer.className = 'a11y-snackbar-region__top';
|
|
22
52
|
this.append(this._bottomContainer, this._topContainer);
|
|
23
53
|
}
|
|
54
|
+
this._drainQueue();
|
|
55
|
+
}
|
|
56
|
+
/** Removes every showing toast and drops queued ones, without calling `onAction`. */
|
|
57
|
+
dismissAll() {
|
|
58
|
+
this._queue = [];
|
|
59
|
+
this._cancelAutoDismissTimers();
|
|
60
|
+
this.querySelectorAll('.a11y-snackbar').forEach((toast) => toast.remove());
|
|
61
|
+
this._activeCount = 0;
|
|
62
|
+
}
|
|
63
|
+
_onRemoved() {
|
|
64
|
+
this.dismissAll();
|
|
24
65
|
}
|
|
25
66
|
notify(message, options = {}) {
|
|
26
67
|
if (options.maxStack)
|
|
@@ -39,22 +80,27 @@ export class SnackbarElement extends A11yPassiveOverlayElement {
|
|
|
39
80
|
const position = item.position ?? 'bottom';
|
|
40
81
|
const duration = item.duration ?? (item.actionText ? 10_000 : 3000);
|
|
41
82
|
const container = position === 'bottom' ? this._bottomContainer : this._topContainer;
|
|
42
|
-
const el =
|
|
83
|
+
const el = doc.createElement('div');
|
|
43
84
|
el.className = `a11y-snackbar a11y-snackbar--${type}`;
|
|
44
85
|
el.setAttribute('role', type === 'error' ? 'alert' : 'status');
|
|
45
86
|
el.setAttribute('aria-live', type === 'error' ? 'assertive' : 'polite');
|
|
46
87
|
el.setAttribute('aria-atomic', 'true');
|
|
47
|
-
el.append(h('span',
|
|
88
|
+
el.append(h('span', { class: 'a11y-snackbar__message' }, item.message));
|
|
48
89
|
if (item.actionText)
|
|
49
|
-
el.append(h('button', { type: 'button' }, item.actionText));
|
|
90
|
+
el.append(h('button', { type: 'button', class: 'a11y-snackbar__action' }, item.actionText));
|
|
91
|
+
el.append(h('button', { type: 'button', class: 'a11y-snackbar__close', 'aria-label': this.dismissLabel }, '\u00d7'));
|
|
50
92
|
container.appendChild(el);
|
|
51
93
|
const cancelAutoDismiss = this._autoDismiss(el, duration, () => this._onItemDismissed());
|
|
52
|
-
|
|
94
|
+
const dismiss = () => {
|
|
53
95
|
cancelAutoDismiss();
|
|
54
96
|
el.remove();
|
|
55
97
|
this._onItemDismissed();
|
|
98
|
+
};
|
|
99
|
+
el.querySelector('.a11y-snackbar__action')?.addEventListener('click', () => {
|
|
100
|
+
dismiss();
|
|
56
101
|
item.onAction?.();
|
|
57
102
|
});
|
|
103
|
+
el.querySelector('.a11y-snackbar__close')?.addEventListener('click', dismiss);
|
|
58
104
|
}
|
|
59
105
|
}
|
|
60
106
|
//# sourceMappingURL=snackbar.element.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snackbar.element.js","sourceRoot":"","sources":["../../../src/overlays/snackbar/snackbar.element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAA2B,MAAM,yCAAyC,CAAC;AAC7G,OAAO,EAAE,CAAC,EAAgB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"snackbar.element.js","sourceRoot":"","sources":["../../../src/overlays/snackbar/snackbar.element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAA2B,MAAM,yCAAyC,CAAC;AAC7G,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAgB,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAkB7C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,eAAgB,SAAQ,yBAAuC;IAClE,gBAAgB,CAAe;IAC/B,aAAa,CAAe;IAEpC,MAAM,KAAc,kBAAkB;QACpC,OAAO,CAAC,GAAG,KAAK,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;IACxD,CAAC;IAED,wDAAwD;IACxD,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,SAAS,CAAC,SAAS,CAA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AAC,aAAa,CAAoB,uBAAuB,CAAC,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACnG,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
// src/core/overlay-registry.ts
|
|
2
|
-
var OVERLAY_OPEN_EVENT = "a11y-overlay-open";
|
|
3
|
-
var OVERLAY_CLOSE_EVENT = "a11y-overlay-close";
|
|
4
|
-
var STATE_KEY = /* @__PURE__ */ Symbol.for("a11y-elements/overlay-state");
|
|
5
|
-
var store = globalThis;
|
|
6
|
-
var state = store[STATE_KEY] ??= { openOverlays: /* @__PURE__ */ new Set(), scrollLocks: 0, portalOrigins: /* @__PURE__ */ new Map() };
|
|
7
|
-
state.portalOrigins ??= /* @__PURE__ */ new Map();
|
|
8
|
-
function registerOpenOverlay(overlay) {
|
|
9
|
-
state.openOverlays.add(overlay);
|
|
10
|
-
}
|
|
11
|
-
function unregisterOpenOverlay(overlay) {
|
|
12
|
-
state.openOverlays.delete(overlay);
|
|
13
|
-
}
|
|
14
|
-
function dismissAllOverlays() {
|
|
15
|
-
for (const overlay of Array.from(state.openOverlays)) overlay.close("dismiss-all");
|
|
16
|
-
}
|
|
17
|
-
function recordPortalOrigin(overlay, origin) {
|
|
18
|
-
state.portalOrigins.set(overlay, origin);
|
|
19
|
-
}
|
|
20
|
-
function forgetPortalOrigin(overlay) {
|
|
21
|
-
state.portalOrigins.delete(overlay);
|
|
22
|
-
}
|
|
23
|
-
function removeOverlaysWithin(host) {
|
|
24
|
-
let removed = 0;
|
|
25
|
-
for (const [overlay, origin] of Array.from(state.portalOrigins)) {
|
|
26
|
-
if (!host.contains(origin)) continue;
|
|
27
|
-
overlay.remove();
|
|
28
|
-
state.portalOrigins.delete(overlay);
|
|
29
|
-
removed++;
|
|
30
|
-
}
|
|
31
|
-
return removed;
|
|
32
|
-
}
|
|
33
|
-
function inertOutside(keep, exempt) {
|
|
34
|
-
const inerted = [];
|
|
35
|
-
for (const child of Array.from(document.body.children)) {
|
|
36
|
-
if (child === keep || child.contains(keep) || child.hasAttribute("inert") || exempt?.(child)) continue;
|
|
37
|
-
child.setAttribute("inert", "");
|
|
38
|
-
inerted.push(child);
|
|
39
|
-
}
|
|
40
|
-
return () => {
|
|
41
|
-
for (const el of inerted) el.removeAttribute("inert");
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
var NO_SCROLL_CLASS = "a11y-no-scroll";
|
|
45
|
-
var GUTTER_CLASS = "a11y-no-scroll--gutter";
|
|
46
|
-
function lockScroll() {
|
|
47
|
-
if (state.scrollLocks++ !== 0) return;
|
|
48
|
-
const root = document.documentElement;
|
|
49
|
-
const widthBefore = root.clientWidth;
|
|
50
|
-
root.classList.add(NO_SCROLL_CLASS);
|
|
51
|
-
if (root.clientWidth > widthBefore) root.classList.add(GUTTER_CLASS);
|
|
52
|
-
}
|
|
53
|
-
function unlockScroll() {
|
|
54
|
-
if (state.scrollLocks === 0) return;
|
|
55
|
-
if (--state.scrollLocks === 0) document.documentElement.classList.remove(NO_SCROLL_CLASS, GUTTER_CLASS);
|
|
56
|
-
}
|
|
57
|
-
function emitOverlayEvent(type, name, extra) {
|
|
58
|
-
const { element, reason } = extra;
|
|
59
|
-
const detail = { name };
|
|
60
|
-
if (element) detail.element = element;
|
|
61
|
-
if (reason) detail.reason = reason;
|
|
62
|
-
const target = element?.isConnected ? element : document;
|
|
63
|
-
return target.dispatchEvent(new CustomEvent(type, { bubbles: true, detail }));
|
|
64
|
-
}
|
|
65
|
-
function emitOverlayOpen(name, extra = {}) {
|
|
66
|
-
return emitOverlayEvent(OVERLAY_OPEN_EVENT, name, extra);
|
|
67
|
-
}
|
|
68
|
-
function emitOverlayClose(name, extra = {}) {
|
|
69
|
-
return emitOverlayEvent(OVERLAY_CLOSE_EVENT, name, extra);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export {
|
|
73
|
-
registerOpenOverlay,
|
|
74
|
-
unregisterOpenOverlay,
|
|
75
|
-
dismissAllOverlays,
|
|
76
|
-
recordPortalOrigin,
|
|
77
|
-
forgetPortalOrigin,
|
|
78
|
-
removeOverlaysWithin,
|
|
79
|
-
inertOutside,
|
|
80
|
-
lockScroll,
|
|
81
|
-
unlockScroll,
|
|
82
|
-
emitOverlayOpen,
|
|
83
|
-
emitOverlayClose
|
|
84
|
-
};
|
|
85
|
-
//# sourceMappingURL=chunk-23I2KVFV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/overlay-registry.ts"],"sourcesContent":["/**\n * Why an overlay closed: `'escape'`, a click on the `'backdrop'`, the ×\n * `'close-button'`, an `'outside-click'`, focus leaving a menu (`'focus-out'`),\n * a menu `'item'` being activated, `'dismiss-all'` (`dismissAllOverlays()`),\n * the element being `'removed'` from the document while open, or `'api'`:\n * `close()`, `open = false` or removing the `open` attribute.\n */\nexport type OverlayCloseReason =\n | 'escape'\n | 'backdrop'\n | 'close-button'\n | 'outside-click'\n | 'focus-out'\n | 'item'\n | 'api'\n | 'dismiss-all'\n | 'removed';\n\nexport interface OverlayOpenCloseDetail {\n /** The overlay's tag name. */\n name: string;\n /** The overlay element itself. */\n element?: Element;\n /** Only on `a11y-overlay-close`, for overlays opened with `open`. */\n reason?: OverlayCloseReason;\n}\n\nexport interface OverlayEventExtra {\n element?: Element;\n reason?: OverlayCloseReason;\n}\n\nexport const OVERLAY_OPEN_EVENT = 'a11y-overlay-open';\nexport const OVERLAY_CLOSE_EVENT = 'a11y-overlay-close';\n\ninterface Dismissible {\n close(reason?: OverlayCloseReason): 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('dismiss-all');\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\n/**\n * Makes every child of `<body>` except `keep` (and those `exempt` keeps)\n * `inert`, so keyboard and assistive-tech users can't reach the page behind a\n * modal overlay — a dimmed backdrop only blocks the mouse, and `aria-modal`\n * alone still lets some screen readers wander out. Children that were already\n * `inert` (e.g. behind a modal below this one) are left as they are. Returns\n * a function that undoes exactly what this call did.\n */\nexport function inertOutside(keep: Element, exempt?: (el: Element) => boolean): () => void {\n const inerted: Element[] = [];\n for (const child of Array.from(document.body.children)) {\n if (child === keep || child.contains(keep) || child.hasAttribute('inert') || exempt?.(child)) continue;\n child.setAttribute('inert', '');\n inerted.push(child);\n }\n return () => {\n for (const el of inerted) el.removeAttribute('inert');\n };\n}\n\nconst NO_SCROLL_CLASS = 'a11y-no-scroll';\nconst GUTTER_CLASS = 'a11y-no-scroll--gutter';\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 *\n * `overflow: hidden` removes a classic (non-overlay) scrollbar, which would\n * widen the page. The gutter class keeps that space reserved, but only when\n * hiding overflow actually widened the root: reserving it on a page without\n * a scrollbar would narrow the page instead. Comparing the root's width\n * before and after (rather than against `innerWidth`) isn't fooled by\n * fractional-zoom rounding or by a gutter the app already reserves.\n */\nexport function lockScroll(): void {\n if (state.scrollLocks++ !== 0) return;\n const root = document.documentElement;\n const widthBefore = root.clientWidth;\n root.classList.add(NO_SCROLL_CLASS);\n if (root.clientWidth > widthBefore) root.classList.add(GUTTER_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, GUTTER_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` dispatches these uniformly. They bubble from the\n * overlay element (so a listener on it, or on `document`, sees them), or fire\n * on `document` when there's no element or it has already left the document.\n */\nfunction emitOverlayEvent(type: string, name: string, extra: OverlayEventExtra): boolean {\n const { element, reason } = extra;\n const detail: OverlayOpenCloseDetail = { name };\n if (element) detail.element = element;\n if (reason) detail.reason = reason;\n const target = element?.isConnected ? element : document;\n return target.dispatchEvent(new CustomEvent<OverlayOpenCloseDetail>(type, { bubbles: true, detail }));\n}\n\nexport function emitOverlayOpen(name: string, extra: Omit<OverlayEventExtra, 'reason'> = {}): boolean {\n return emitOverlayEvent(OVERLAY_OPEN_EVENT, name, extra);\n}\n\nexport function emitOverlayClose(name: string, extra: OverlayEventExtra = {}): boolean {\n return emitOverlayEvent(OVERLAY_CLOSE_EVENT, name, extra);\n}\n"],"mappings":";AAgCO,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,aAAa;AACnF;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,c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M,KAAK;AAC1D;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overlays/dropdown/dropdown.element.ts","../../src/overlays/dropdown/define.ts"],"sourcesContent":["import { A11yMenuOverlayElement } from '../core/a11y-menu-overlay-element.js';\nimport { nextId } from '../../core/ids.js';\n\n/**\n * A menu anchored to a trigger element (e.g. a \"more actions\" button).\n *\n * ```html\n * <button id=\"actions-btn\">Actions</button>\n * <a11y-dropdown anchor=\"actions-btn\">\n * <div role=\"menuitem\">Edit</div>\n * <div role=\"menuitem\">Delete</div>\n * </a11y-dropdown>\n * ```\n *\n * The anchor is the trigger: clicking it (or Enter/Space on a real\n * `<button>`) toggles the menu — no click handler to wire yourself — and it\n * gets `aria-haspopup=\"menu\"`, `aria-controls`, and an `aria-expanded` kept\n * in sync with the menu's open state. The menu is labelled by the anchor.\n */\nexport class DropdownElement extends A11yMenuOverlayElement {\n private _trigger: HTMLElement | null = null;\n /**\n * Whether the menu was open when the trigger was pressed. Where pressing a\n * button focuses it (Chrome, Firefox on Windows), that focus move closes the\n * menu (`focus-out`) before the click, which must then not reopen it.\n */\n private _openAtPress: boolean | null = null;\n private _onTriggerPointerDown = (): void => {\n this._openAtPress = this.open;\n };\n private _onTriggerClick = (): void => {\n const wasOpen = this._openAtPress ?? this.open; // no press for a keyboard click\n this._openAtPress = null;\n this.open = !wasOpen;\n };\n\n protected override onConnect(): void {\n if (!this.id) this.id = nextId('a11y-dropdown');\n this._bindTrigger();\n // Anchor not parsed yet (dropdown authored before it, define script loaded synchronously).\n if (!this._trigger) this.afterParse(() => this._bindTrigger());\n }\n\n protected override onDisconnect(): void {\n this._unbindTrigger();\n }\n\n protected override onAnchorChanged(): void {\n super.onAnchorChanged();\n if (this._connected) this._bindTrigger();\n }\n\n protected override createWrapper(): HTMLElement {\n const el = super.createWrapper();\n el.classList.add('a11y-dropdown-wrapper');\n if (this._trigger?.id) el.setAttribute('aria-labelledby', this._trigger.id);\n return el;\n }\n\n protected override getContentClass(): string {\n return 'a11y-dropdown-content';\n }\n\n protected override _onShown(name?: string): void {\n super._onShown(name);\n this._trigger?.setAttribute('aria-expanded', 'true');\n }\n\n protected override _onHidden(name?: string): void {\n super._onHidden(name);\n this._trigger?.setAttribute('aria-expanded', 'false');\n }\n\n private _bindTrigger(): void {\n const anchor = this.anchorElement;\n if (anchor === this._trigger) return;\n this._unbindTrigger();\n if (!anchor) return;\n anchor.setAttribute('aria-haspopup', 'menu');\n anchor.setAttribute('aria-controls', this.id);\n anchor.setAttribute('aria-expanded', String(this._isShowing));\n anchor.addEventListener('pointerdown', this._onTriggerPointerDown);\n anchor.addEventListener('click', this._onTriggerClick);\n this._trigger = anchor;\n }\n\n private _unbindTrigger(): void {\n const trigger = this._trigger;\n if (!trigger) return;\n trigger.removeEventListener('pointerdown', this._onTriggerPointerDown);\n trigger.removeEventListener('click', this._onTriggerClick);\n trigger.removeAttribute('aria-haspopup');\n trigger.removeAttribute('aria-controls');\n trigger.removeAttribute('aria-expanded');\n this._trigger = null;\n }\n}\n","import { defineElement } from '../../core/define-element.js';\nimport { DropdownElement } from './dropdown.element.js';\n\ndefineElement('a11y-dropdown', DropdownElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'a11y-dropdown': DropdownElement;\n }\n}\n\nexport { DropdownElement };\nexport * from '../core/zero-build-exports.js';\n"],"mappings":";;;;;;;;;;;AAmBO,IAAM,kBAAN,cAA8B,uBAAuB;AAAA,EAClD,WAA+B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM/B,eAA+B;AAAA,EAC/B,wBAAwB,MAAY;AAC1C,SAAK,eAAe,KAAK;AAAA,EAC3B;AAAA,EACQ,kBAAkB,MAAY;AACpC,UAAM,UAAU,KAAK,gBAAgB,KAAK;AAC1C,SAAK,eAAe;AACpB,SAAK,OAAO,CAAC;AAAA,EACf;AAAA,EAEmB,YAAkB;AACnC,QAAI,CAAC,KAAK,GAAI,MAAK,KAAK,OAAO,eAAe;A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,YAAQ,gBAAgB,eAAe;AACvC,SAAK,WAAW;AAAA,EAClB;AACF;;;AC7FA,cAAc,iBAAiB,eAAe;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/checkbox-group/checkbox-group.element.ts","../../src/components/checkbox-group/define.ts"],"sourcesContent":["import { A11yWrapperElement } from '../../core/a11y-wrapper-element.js';\nimport { syncAttr, syncClass, syncText } from '../../core/dom-sync.js';\nimport { getString } from '../../core/strings.js';\nimport type { ValueElement } from '../../core/value-element.js';\n\nconst SELECT_ALL_INPUT_CLASS = 'a11y-checkbox-group__select-all-input';\n\n/**\n * Enhances a set of real, consumer-authored `<input type=\"checkbox\">`\n * options (each typically inside its own `<label>`) with a wrapping\n * `<fieldset>`/`<legend>` — the multi-select counterpart of\n * `<a11y-radio-group>`. Options reuse `<a11y-checkbox>`'s styling\n * (`.a11y-checkbox` on the label, `.a11y-checkbox__input` on the input).\n *\n * `select-all` adds a generated \"Select all\" checkbox after the legend: it's\n * checked when every enabled option is, `indeterminate` when only some are,\n * and toggles every enabled option at once. It has no `name`, so it's never\n * submitted with the form. Disabled options keep their own state.\n *\n * ```html\n * <a11y-checkbox-group legend=\"Toppings\" select-all>\n * <label><input type=\"checkbox\" name=\"toppings\" value=\"cheese\"> Cheese</label>\n * <label><input type=\"checkbox\" name=\"toppings\" value=\"ham\"> Ham</label>\n * </a11y-checkbox-group>\n * ```\n *\n * The select-all label: `select-all-label=\"…\"`, else `setStrings({ selectAll })`.\n */\nexport class CheckboxGroupElement extends A11yWrapperElement implements ValueElement<string[]> {\n static get observedAttributes(): string[] {\n return ['legend', 'aria-label', 'disabled', 'select-all', 'select-all-label'];\n }\n\n /** Called with the checked values once per user action — including one select-all click that changes many options. */\n declare onChange?: (values: string[]) => void;\n\n /** True while select-all toggles options, so their `change` events don't each call `onChange`. */\n private _bulkUpdating = false;\n\n getValue(): string[] {\n return this._options()\n .filter((input) => input.checked)\n .map((input) => input.value);\n }\n\n /** Checks exactly the options whose value is in `values` and unchecks the rest. */\n setValue(values: string[]): void {\n for (const input of this._options()) input.checked = values.includes(input.value);\n this._syncSelectAll();\n }\n\n /** Checks every enabled option. Silent, like `setValue()`: no events, no `onChange`. */\n selectAll(): void {\n this._setAllEnabled(true);\n }\n\n /** Unchecks every enabled option. Silent, like `setValue()`: no events, no `onChange`. */\n unselectAll(): void {\n this._setAllEnabled(false);\n }\n\n private _fieldset(): HTMLFieldSetElement | null {\n return this.querySelector('fieldset.a11y-checkbox-group');\n }\n\n private _selectAllInput(): HTMLInputElement | null {\n return this._fieldset()?.querySelector<HTMLInputElement>(`.${SELECT_ALL_INPUT_CLASS}`) ?? null;\n }\n\n private _options(): HTMLInputElement[] {\n const fieldset = this._fieldset();\n if (!fieldset) return [];\n return [...fieldset.querySelectorAll<HTMLInputElement>(`input[type=\"checkbox\"]:not(.${SELECT_ALL_INPUT_CLASS})`)];\n }\n\n private _enabledOptions(): HTMLInputElement[] {\n return this._options().filter((input) => !input.matches(':disabled'));\n }\n\n protected override onStringsChange(): void {\n this._sync();\n }\n\n protected override _sync(): void {\n if (!this.querySelector('input[type=\"checkbox\"]')) return;\n\n const fieldset = this._ensureFieldset();\n for (const input of this._options()) {\n syncClass(input, 'a11y-checkbox__input', true);\n const label = input.closest('label');\n if (label && fieldset.contains(label)) syncClass(label, 'a11y-checkbox', true);\n }\n\n syncAttr(fieldset, 'disabled', this.boolAttr('disabled') ? '' : null);\n this._syncLegend(fieldset);\n this._syncSelectAllControl(fieldset);\n this._syncSelectAll();\n\n this.wireOnce(fieldset, () =>\n this.listen(fieldset, 'change', (e) => {\n const target = e.target as HTMLInputElement;\n if (!target.matches('input[type=\"checkbox\"]')) return;\n if (target.classList.contains(SELECT_ALL_INPUT_CLASS)) {\n this._toggleAllFromUser(target.checked);\n return;\n }\n this._syncSelectAll();\n if (!this._bulkUpdating) this.onChange?.(this.getValue());\n }),\n );\n }\n\n private _ensureFieldset(): HTMLFieldSetElement {\n const existing = this._fieldset();\n if (existing) return existing;\n\n const fieldset = document.createElement('fieldset');\n fieldset.className = 'a11y-checkbox-group';\n // Move every existing child (the consumer's option markup) into it.\n while (this.firstChild) fieldset.appendChild(this.firstChild);\n this.appendChild(fieldset);\n return fieldset;\n }\n\n private _syncLegend(fieldset: HTMLFieldSetElement): void {\n const legendText = this.optionalStringAttr('legend');\n const ariaLabel = this.optionalStringAttr('aria-label');\n let legend = fieldset.querySelector<HTMLLegendElement>('.a11y-checkbox-group__legend');\n\n if (legendText) {\n if (!legend) {\n legend = document.createElement('legend');\n legend.className = 'a11y-checkbox-group__legend';\n fieldset.prepend(legend);\n }\n syncText(legend, legendText);\n syncAttr(fieldset, 'aria-label', null); // <legend> already provides an accessible name natively\n } else {\n legend?.remove();\n syncAttr(fieldset, 'aria-label', ariaLabel);\n }\n }\n\n /** Builds/removes the select-all `<label>` and keeps it right after the legend (or first). */\n private _syncSelectAllControl(fieldset: HTMLFieldSetElement): void {\n let wrapper = fieldset.querySelector<HTMLLabelElement>('.a11y-checkbox-group__select-all');\n if (!this.boolAttr('select-all')) {\n wrapper?.remove();\n return;\n }\n\n if (!wrapper) {\n wrapper = document.createElement('label');\n wrapper.className = 'a11y-checkbox a11y-checkbox-group__select-all';\n const input = document.createElement('input');\n input.type = 'checkbox';\n input.className = `a11y-checkbox__input ${SELECT_ALL_INPUT_CLASS}`;\n const span = document.createElement('span');\n span.className = 'a11y-checkbox__label';\n wrapper.append(input, span);\n }\n\n const legend = fieldset.querySelector('.a11y-checkbox-group__legend');\n const expectedPrevious = legend ?? null;\n if (wrapper.parentElement !== fieldset || wrapper.previousElementSibling !== expectedPrevious) {\n if (legend) legend.after(wrapper);\n else fieldset.prepend(wrapper);\n }\n\n syncText(wrapper.querySelector('.a11y-checkbox__label')!, this.stringAttr('select-all-label', getString('selectAll')));\n }\n\n /** Mirrors the enabled options onto the select-all input: checked / indeterminate / unchecked. */\n private _syncSelectAll(): void {\n const selectAll = this._selectAllInput();\n if (!selectAll) return;\n const enabled = this._enabledOptions();\n const checkedCount = enabled.filter((input) => input.checked).length;\n // IDL-only properties (never reflected) — safe to write unguarded.\n selectAll.checked = enabled.length > 0 && checkedCount === enabled.length;\n selectAll.indeterminate = checkedCount > 0 && checkedCount < enabled.length;\n // `disabled` reflects to the attribute, so an unguarded write would retrigger the observer forever.\n syncAttr(selectAll, 'disabled', enabled.length === 0 ? '' : null);\n }\n\n private _setAllEnabled(checked: boolean): HTMLInputElement[] {\n const changed = this._enabledOptions().filter((input) => input.checked !== checked);\n for (const input of changed) input.checked = checked;\n this._syncSelectAll();\n return changed;\n }\n\n /** A select-all click: toggles every enabled option, fires their native events, then `onChange` once. */\n private _toggleAllFromUser(checked: boolean): void {\n const changed = this._setAllEnabled(checked);\n this._bulkUpdating = true;\n try {\n for (const input of changed) {\n input.dispatchEvent(new Event('input', { bubbles: true, composed: true }));\n input.dispatchEvent(new Event('change', { bubbles: true }));\n }\n } finally {\n this._bulkUpdating = false;\n }\n if (changed.length > 0) this.onChange?.(this.getValue());\n }\n}\n","import { defineElement } from '../../core/define-element.js';\nimport { CheckboxGroupElement } from './checkbox-group.element.js';\n\ndefineElement('a11y-checkbox-group', CheckboxGroupElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'a11y-checkbox-group': CheckboxGroupElement;\n }\n}\n\nexport { CheckboxGroupElement };\nexport * from '../../core/zero-build-exports.js';\n"],"mappings":";;;;;;;;;;;;;;AAKA,IAAM,yBAAyB;AAuBxB,IAAM,uBAAN,cAAmC,mBAAqD;AAAA,EAC7F,WAAW,qBAA+B;AACxC,WAAO,CAAC,UAAU,cAAc,YAAY,cAAc,kBAAkB;AAAA,EAC9E;AAAA;AAAA,EAMQ,gBAAgB;AAAA,EAExB,WAAqB;AACnB,WAAO,KAAK,SAAS,EAClB,OAAO,CAAC,UAAU,MAAM,OAAO,EAC/B,IAAI,CAAC,UAAU,MAAM,KAAK;AAAA,EAC/B;AAAA;AAAA,EAGA,SAAS,QAAwB;AAC/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UAAE;AACA,WAAK,gBAAgB;AAAA,IACvB;AACA,QAAI,QAAQ,SAAS,EAAG,MAAK,WAAW,KAAK,SAAS,CAAC;AAAA,EACzD;AACF;;;AC3MA,cAAc,uBAAuB,oBAAoB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/ids.ts"],"sourcesContent":["/**\n * Page-wide id counter, on `globalThis` for the same reason as the strings\n * store: each standalone `dist/browser/**\\/define.js` bundle inlines its own\n * copy of this module, and two bundles counting from 1 on their own would\n * hand out the same ids.\n */\nconst IDS_KEY = Symbol.for('a11y-elements/ids');\nconst store = globalThis as unknown as Record<symbol, { count: number } | undefined>;\nconst counter = (store[IDS_KEY] ??= { count: 0 });\n\n/** Returns an id unique across every bundle on the page, e.g. `a11y-field-3`. Skips ids already taken in the document. */\nexport function nextId(prefix: string): string {\n let id: string;\n do id = `${prefix}-${++counter.count}`;\n while (typeof document !== 'undefined' && document.getElementById(id));\n return id;\n}\n"],"mappings":";AAMA,IAAM,UAAU,uBAAO,IAAI,mBAAmB;AAC9C,IAAM,QAAQ;AACd,IAAM,UAAW,MAAM,OAAO,MAAM,EAAE,OAAO,EAAE;AAGxC,SAAS,OAAO,QAAwB;AAC7C,MAAI;AACJ;AAAG,SAAK,GAAG,MAAM,IAAI,EAAE,QAAQ,KAAK;AAAA,SAC7B,OAAO,aAAa,eAAe,SAAS,eAAe,EAAE;AACpE,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/select/select.element.ts","../../src/components/select/define.ts"],"sourcesContent":["import { A11yWrapperElement } from '../../core/a11y-wrapper-element.js';\nimport { syncClass, syncText } from '../../core/dom-sync.js';\nimport type { ValueElement } from '../../core/value-element.js';\n\n/**\n * Enhances a real `<select>` (with real `<option>` children — the browser's\n * own native picker/keyboard handling needs no help) with a wrapping\n * `<label>` and visible label span.\n *\n * ```html\n * <a11y-select label=\"Country\">\n * <select name=\"country\">\n * <option value=\"us\">United States</option>\n * <option value=\"ca\">Canada</option>\n * </select>\n * </a11y-select>\n * ```\n */\nexport class SelectElement extends A11yWrapperElement implements ValueElement<string> {\n static get observedAttributes(): string[] {\n return ['label'];\n }\n\n\n declare onChange?: (value: string) => void;\n\n getValue(): string {\n return this._select()?.value ?? '';\n }\n\n setValue(value: string): void {\n const select = this._select();\n if (select) select.value = value;\n }\n\n private _select(): HTMLSelectElement | null {\n return this.querySelector('select');\n }\n\n protected override _sync(): void {\n const select = this._select();\n if (!select) return;\n\n const wrapper = this._ensureWrapper(select);\n syncClass(select, 'a11y-select__control', true);\n this._syncLabel(wrapper);\n\n this.wireOnce(select, () => this.listen(select, 'change', () => this.onChange?.(select.value)));\n }\n\n private _ensureWrapper(select: HTMLSelectElement): HTMLLabelElement {\n const existing = select.closest<HTMLLabelElement>('label.a11y-select');\n if (existing && existing.parentElement === this) return existing;\n\n const wrapper = document.createElement('label');\n wrapper.className = 'a11y-select';\n select.replaceWith(wrapper);\n wrapper.appendChild(select);\n return wrapper;\n }\n\n private _syncLabel(wrapper: HTMLLabelElement): void {\n const text = this.optionalStringAttr('label');\n let span = wrapper.querySelector<HTMLElement>('.a11y-select__label');\n if (!text) {\n span?.remove();\n return;\n }\n if (!span) {\n span = document.createElement('span');\n span.className = 'a11y-select__label';\n wrapper.prepend(span); // label text visually precedes the control\n }\n syncText(span, text);\n }\n}\n","import { defineElement } from '../../core/define-element.js';\nimport { SelectElement } from './select.element.js';\n\ndefineElement('a11y-select', SelectElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'a11y-select': SelectElement;\n }\n}\n\nexport { SelectElement };\nexport * from '../../core/zero-build-exports.js';\n"],"mappings":";;;;;;;;;;;;AAkBO,IAAM,gBAAN,cAA4B,mBAAmD;AAAA,EACpF,WAAW,qBAA+B;AACxC,WAAO,CAAC,OAAO;AAAA,EACjB;AAAA,EAKA,WAAmB;AACjB,WAAO,KAAK,QAAQ,GAAG,SAAS;AAAA,EAClC;AAAA,EAEA,SAAS,OAAqB;AAC5B,UAAM,SAAS,KAAK,QAAQ;AAC5B,QAAI,OAAQ,QAAO,QAAQ;AAAA,EAC7B;AAAA,EAEQ,UAAoC;AAC1C,WAAO,KAAK,cAAc,QAAQ;AAAA,EACpC;AAAA,EAEmB,QAAc;AAC/B,UAAM,SAAS,KAAK,QAAQ;AAC5B,QAAI,CAAC,OAAQ;AAEb,UAAM,UAAU,KAAK,eAAe,MAAM;AAC1C,cAAU,QAAQ,wBAAwB,IAAI;AAC9C,SAAK,WAAW,OAAO;AAEvB,SAAK,SAAS,QAAQ,MAAM,KAAK,OAAO,QAAQ,UAAU,MAAM,KAAK,WAAW,OAAO,KAAK,CAAC,CAAC;AAAA,EAChG;AAAA,EAEQ,eAAe,QAA6C;AAClE,UAAM,WAAW,OAAO,QAA0B,mBAAmB;AACrE,QAAI,YAAY,SAAS,kBAAkB,KAAM,QAAO;AAExD,UAAM,UAAU,SAAS,cAAc,OAAO;AAC9C,YAAQ,YAAY;AACpB,WAAO,YAAY,OAAO;AAC1B,YAAQ,YAAY,MAAM;AAC1B,WAAO;AAAA,EACT;AAAA,EAEQ,WAAW,SAAiC;AAClD,UAAM,OAAO,KAAK,mBAAmB,OAAO;AAC5C,QAAI,OAAO,QAAQ,cAA2B,qBAAqB;AACnE,QAAI,CAAC,MAAM;AACT,YAAM,OAAO;AACb;AAAA,IACF;AACA,QAAI,CAAC,MAAM;AACT,aAAO,SAAS,cAAc,MAAM;AACpC,WAAK,YAAY;AACjB,cAAQ,QAAQ,IAAI;AAAA,IACtB;AACA,aAAS,MAAM,IAAI;AAAA,EACrB;AACF;;;ACxEA,cAAc,eAAe,aAAa;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/picture/picture.element.ts","../../src/components/picture/define.ts"],"sourcesContent":["import { A11yWrapperElement } from '../../core/a11y-wrapper-element.js';\nimport { syncAttr, syncClass, syncText } from '../../core/dom-sync.js';\n\n/** Marks the markup this element builds itself (in generated mode), so it never mixes it up with the consumer's. */\nconst GENERATED = 'data-a11y-generated';\n\n/** One `<source>` of a generated `<picture>`. */\nexport interface PictureSource {\n /** A URL, or a full srcset (`s.avif 1x, s@2x.avif 2x`). */\n src: string;\n /** The MIME type (`image/avif`), so the browser skips formats it can't decode. */\n type?: string;\n media?: string;\n sizes?: string;\n}\n\n/** Everything a generated picture needs, in one object — see `PictureElement.image`. */\nexport interface PictureImage {\n /** Tried in order: put the most efficient format first. */\n sources?: PictureSource[];\n /** The `<img>` src, used when no source's type is supported. */\n fallback: string;\n alt: string;\n caption?: string;\n width?: number;\n height?: number;\n loading?: 'lazy' | 'eager';\n}\n\n/**\n * An accessible figure around a picture: `role=\"figure\"`, and hidden from\n * assistive tech (`aria-hidden`) when the image is decorative — an empty\n * `alt` and no caption.\n *\n * The picture is either authored by the consumer — native HTML already\n * handles format and responsive selection through real `<source>` children:\n *\n * ```html\n * <a11y-picture>\n * <picture>\n * <source srcset=\"hero.webp\" type=\"image/webp\">\n * <img src=\"hero.jpg\" alt=\"Sunset over the Rockies\" loading=\"lazy\" decoding=\"async\">\n * </picture>\n * <figcaption>Sunset over the Rockies</figcaption>\n * </a11y-picture>\n * ```\n *\n * …or generated from attributes/properties, as soon as there's a `src` (the\n * fallback image). The browser uses the first source whose `type` it\n * supports, else the fallback:\n *\n * ```html\n * <a11y-picture src=\"s.jpg\" alt=\"S illustration\" sources=\"s.avif image/avif, s.webp image/webp\"></a11y-picture>\n * ```\n *\n * ```js\n * el.image = { sources: [{ src: 's.avif', type: 'image/avif' }], fallback: 's.jpg', alt: 'S illustration' };\n * ```\n *\n * Use one or the other: in generated mode, authored children are ignored.\n */\nexport class PictureElement extends A11yWrapperElement {\n static get observedAttributes(): string[] {\n return ['src', 'alt', 'sources', 'caption', 'width', 'height', 'loading', 'sizes'];\n }\n\n /** Sources set as a property; `null` falls back to the `sources` attribute. */\n private _sources: PictureSource[] | null = null;\n /** The `sources` attribute value last parsed, and the result — parsed (and warned about) once per value. */\n private _parsed: [value: string | null, sources: PictureSource[]] = [null, []];\n private _warnedAlt = false;\n\n /** The fallback image. Setting it switches to generated mode. */\n get src(): string {\n return this.stringAttr('src');\n }\n\n set src(value: string) {\n this._setOptionalAttr('src', value);\n }\n\n get alt(): string {\n return this.stringAttr('alt');\n }\n\n set alt(value: string) {\n // `''` is meaningful (decorative), so only null/undefined remove it.\n if (value == null) this.removeAttribute('alt');\n else this.setAttribute('alt', value);\n }\n\n get caption(): string {\n return this.stringAttr('caption');\n }\n\n set caption(value: string) {\n this._setOptionalAttr('caption', value);\n }\n\n get width(): number | undefined {\n return this._optionalNumber('width');\n }\n\n set width(value: number | undefined) {\n this._setOptionalAttr('width', value);\n }\n\n get height(): number | undefined {\n return this._optionalNumber('height');\n }\n\n set height(value: number | undefined) {\n this._setOptionalAttr('height', value);\n }\n\n get loading(): 'lazy' | 'eager' {\n return this.getAttribute('loading') === 'eager' ? 'eager' : 'lazy';\n }\n\n set loading(value: 'lazy' | 'eager') {\n this._setOptionalAttr('loading', value);\n }\n\n /** Set as a property, or parsed from the `sources` attribute (`url type` pairs, comma-separated). */\n get sources(): PictureSource[] {\n if (this._sources) return this._sources;\n const value = this.getAttribute('sources');\n if (this._parsed[0] !== value) this._parsed = [value, parseSources(value)];\n return this._parsed[1];\n }\n\n /** Overrides the `sources` attribute until it changes. Needed for srcset descriptors, `media` or `sizes`. */\n set sources(value: PictureSource[]) {\n this._sources = value ? value.map((source) => ({ ...source })) : null;\n if (this._connected) this._sync();\n }\n\n /** Sets the whole picture at once — sources, fallback, alt and the optional fields — in one sync. */\n set image(image: PictureImage) {\n this._sources = (image.sources ?? []).map((source) => ({ ...source }));\n const connected = this._connected;\n this._connected = false; // one sync at the end, not one per attribute\n try {\n this.src = image.fallback;\n this.alt = image.alt;\n this.caption = image.caption ?? '';\n this.width = image.width;\n this.height = image.height;\n this.loading = image.loading ?? 'lazy';\n } finally {\n this._connected = connected;\n }\n if (connected) this._sync();\n }\n\n override attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {\n if (name === 'sources' && oldValue !== newValue) this._sources = null; // the attribute set last wins\n super.attributeChangedCallback(name, oldValue, newValue);\n }\n\n protected override observerInit(): MutationObserverInit {\n return { childList: true, subtree: true, attributes: true, attributeFilter: ['alt'] };\n }\n\n protected override _sync(): void {\n const generated = this.hasAttribute('src');\n if (generated) this._syncGenerated();\n else this._removeGenerated();\n\n const img = generated\n ? this.querySelector<HTMLImageElement>(`:scope > picture[${GENERATED}] > img`)\n : this.querySelector('img');\n if (!img) return;\n\n // Guarded writes: this runs inside a MutationObserver callback watching\n // this subtree, and setAttribute/classList.add queue a mutation record\n // even when the value is unchanged — unguarded, that retriggers the\n // observer forever. The attributeFilter above already keeps this element's\n // own writes (role/class/aria-hidden) out of scope, but staying guarded\n // here too means that isn't load-bearing for correctness.\n syncClass(this, 'a11y-picture', true);\n syncAttr(this, 'role', 'figure');\n\n const caption = generated ? this.querySelector(`:scope > figcaption[${GENERATED}]`) : this.querySelector('figcaption');\n const hasCaption = !!caption?.textContent?.trim();\n const isDecorative = img.getAttribute('alt') === '' && !hasCaption;\n\n syncAttr(this, 'aria-hidden', isDecorative ? 'true' : null);\n }\n\n /** Builds `<picture>` (sources, then the fallback `<img>`) and the caption from this element's attributes/properties. */\n private _syncGenerated(): void {\n let picture = this.querySelector<HTMLPictureElement>(`:scope > picture[${GENERATED}]`);\n if (!picture) {\n picture = document.createElement('picture');\n picture.setAttribute(GENERATED, '');\n picture.append(document.createElement('img'));\n this.prepend(picture);\n }\n const img = picture.querySelector<HTMLImageElement>(':scope > img')!;\n\n const sources = this.sources.filter((source) => source.src);\n let elements = [...picture.querySelectorAll<HTMLSourceElement>(':scope > source')];\n // Add or remove only the difference, so unchanged sources aren't reloaded.\n while (elements.length < sources.length) {\n const source = document.createElement('source');\n img.before(source);\n elements.push(source);\n }\n for (const extra of elements.splice(sources.length)) extra.remove();\n sources.forEach((source, i) => {\n const el = elements[i]!;\n syncAttr(el, 'srcset', source.src);\n syncAttr(el, 'type', source.type || null);\n syncAttr(el, 'media', source.media || null);\n syncAttr(el, 'sizes', source.sizes || null);\n });\n\n // Sizes first: the browser picks from srcset/src with them already known.\n syncAttr(img, 'sizes', this.getAttribute('sizes'));\n syncAttr(img, 'width', this.getAttribute('width'));\n syncAttr(img, 'height', this.getAttribute('height'));\n syncAttr(img, 'loading', this.loading);\n syncAttr(img, 'decoding', 'async');\n syncAttr(img, 'alt', this.getAttribute('alt') ?? '');\n syncAttr(img, 'src', this.src);\n if (!this.hasAttribute('alt') && !this._warnedAlt) {\n this._warnedAlt = true;\n console.warn('<a11y-picture> has no alt — describe the image, or set alt=\"\" if it is decorative.');\n }\n\n let caption = this.querySelector<HTMLElement>(`:scope > figcaption[${GENERATED}]`);\n const text = this.caption.trim();\n if (!text) {\n caption?.remove();\n return;\n }\n if (!caption) {\n caption = document.createElement('figcaption');\n caption.setAttribute(GENERATED, '');\n }\n if (caption.previousElementSibling !== picture) picture.after(caption);\n syncText(caption, text);\n }\n\n private _removeGenerated(): void {\n for (const el of this.querySelectorAll(`:scope > [${GENERATED}]`)) el.remove();\n }\n\n private _setOptionalAttr(name: string, value: string | number | null | undefined): void {\n if (value == null || value === '') this.removeAttribute(name);\n else this.setAttribute(name, String(value));\n }\n\n private _optionalNumber(name: string): number | undefined {\n const value = Number(this.getAttribute(name) ?? NaN);\n return Number.isNaN(value) ? undefined : value;\n }\n}\n\n/** `\"s.avif image/avif, s.webp image/webp\"` → sources. Entries that aren't `url type` are skipped, with a warning. */\nfunction parseSources(value: string | null): PictureSource[] {\n if (!value) return [];\n const sources: PictureSource[] = [];\n for (const entry of value.split(',').map((part) => part.trim()).filter(Boolean)) {\n const match = entry.match(/^(\\S+)\\s+([\\w-]+\\/[\\w.+-]+)$/);\n if (match) sources.push({ src: match[1]!, type: match[2]! });\n else console.warn(`<a11y-picture> ignored the source \"${entry}\": write \"url type\", e.g. \"hero.avif image/avif\".`);\n }\n return sources;\n}\n","import { defineElement } from '../../core/define-element.js';\nimport { PictureElement } from './picture.element.js';\n\ndefineElement('a11y-picture', PictureElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'a11y-picture': PictureElement;\n }\n}\n\nexport { PictureElement };\nexport type { PictureImage, PictureSource } from './picture.element.js';\nexport * from '../../core/zero-build-exports.js';\n"],"mappings":";;;;;;;;;;;;;AAIA,IAAM,YAAY;AAyDX,IAAM,iBAAN,cAA6B,mBAAmB;AAAA,EACrD,WAAW,qBAA+B;AACxC,WAAO,CAAC,OAAO,OAAO,WAAW,WAAW,SAAS,UAAU,WAAW,OAAO;AAAA,EACnF;AAAA;AAAA,EAGQ,WAAmC;AAAA;AAAA,EAEnC,UAA4D,CAAC,MAAM,CAAC,CAAC;AAAA,EACrE,aAAa;AAAA;AAAA,EAGrB,IAAI,MAAc;AAChB,WAAO,KAAK,WAAW,KAAK;AAAA,EAC9B;AAAA,EAEA,IAAI,IAAI,OAAe;AACrB,SAAK,iBAAiB,OAAO,KAAK;AAAA,EACpC;AAAA,EAEA,IAAI,MAAc;AAChB,WAAO,KAAK,WAAW,KAAK;AAAA,EAC9B;AAAA,EAEA,IAAI,IAAI,OAAe;AAErB,QAAI,SAAS,KAAM,MAAK,gBAAgB,KAAK;AAAA,QACxC,MAAK,aAAa,OAAO,KAAK;AAAA,EACrC;AAAA,EAEA,IAAI,UAAkB;AACpB,WAAO,KAAK,WAAW,SAAS;AAAA,EAClC;AAAA,EAEA,IAAI,QAAQ,OAAe;AACzB,SAAK,iBAAiB,WAAW,KAAK;AAAA,EACxC;AAAA,EAEA,IAAI,QAA4B;AAC9B,WAAO,KAAK,gBAAgB,OAAO;AAAA,EACrC;AAAA,EAEA,IAAI,MAAM,OAA2B;AACnC,SAAK,iBAAiB,SAAS,KAAK;AAAA,EACtC;AAAA,EAEA,IAAI,SAA6B;AAC/B,WAAO,KAAK,gBAAgB,QAAQ;AAAA,EACtC;AAAA,EAEA,IAAI,OAAO,OAA2B;A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,EAEQ,gBAAgB,MAAkC;AACxD,UAAM,QAAQ,OAAO,KAAK,aAAa,IAAI,KAAK,GAAG;AACnD,WAAO,OAAO,MAAM,KAAK,IAAI,SAAY;AAAA,EAC3C;AACF;AAGA,SAAS,aAAa,OAAuC;AAC3D,MAAI,CAAC,MAAO,QAAO,CAAC;AACpB,QAAM,UAA2B,CAAC;AAClC,aAAW,SAAS,MAAM,MAAM,GAAG,EAAE,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,EAAE,OAAO,OAAO,GAAG;AAC/E,UAAM,QAAQ,MAAM,MAAM,8BAA8B;AACxD,QAAI,MAAO,SAAQ,KAAK,EAAE,KAAK,MAAM,CAAC,GAAI,MAAM,MAAM,CAAC,EAAG,CAAC;AAAA,QACtD,SAAQ,KAAK,sCAAsC,KAAK,mDAAmD;AAAA,EAClH;AACA,SAAO;AACT;;;AC3QA,cAAc,gBAAgB,cAAc;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/label/label.element.ts","../../src/components/label/define.ts"],"sourcesContent":["import { A11yWrapperElement } from '../../core/a11y-wrapper-element.js';\nimport { syncAttr } from '../../core/dom-sync.js';\n\n/**\n * A label that renders a real `<label class=\"a11y-label\">` around its\n * content — a custom element can't itself *be* a `<label>`, and only a real\n * one gives click-to-focus and native accessible naming.\n *\n * Inside `<a11y-input>`/`<a11y-textarea>`/`<a11y-file-input>` it's linked to the control\n * automatically. On its own, `for` is forwarded to the inner `<label>`:\n *\n * ```html\n * <a11y-label for=\"search\">Search</a11y-label>\n * <input id=\"search\" type=\"search\">\n * ```\n *\n * The required marker (`*`) is CSS only and hidden from assistive tech,\n * which already announces the control's native `required`. It shows inside\n * a field whose control is required, or with the `required` attribute here.\n */\nexport class LabelElement extends A11yWrapperElement {\n static get observedAttributes(): string[] {\n return ['for'];\n }\n\n /** Whether the inner label's `for` came from this element's own `for`, so removing that one clears it. */\n private _forwardedFor = false;\n\n /**\n * The real `<label>` this element renders, built on first access. A field\n * reads this while syncing, which can run before this element's own\n * `connectedCallback` (the field comes first in tree order), so it links\n * the real label straight away instead of on a later sync.\n */\n get label(): HTMLLabelElement {\n let label = this.querySelector<HTMLLabelElement>(':scope > label.a11y-label');\n if (!label) {\n label = document.createElement('label');\n label.className = 'a11y-label';\n }\n // Move the author's content (and anything added later) into the real label.\n for (const node of [...this.childNodes]) if (node !== label) label.appendChild(node);\n if (label.parentNode !== this) this.appendChild(label);\n return label;\n }\n\n protected override observerInit(): MutationObserverInit {\n return { childList: true };\n }\n\n protected override _sync(): void {\n const label = this.label;\n\n const forId = this.getAttribute('for');\n if (forId != null) {\n syncAttr(label, 'for', forId);\n this._forwardedFor = true;\n } else if (this._forwardedFor) {\n syncAttr(label, 'for', null);\n this._forwardedFor = false;\n }\n }\n}\n","import { defineElement } from '../../core/define-element.js';\nimport { LabelElement } from './label.element.js';\n\ndefineElement('a11y-label', LabelElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'a11y-label': LabelElement;\n }\n}\n\nexport { LabelElement };\nexport * from '../../core/zero-build-exports.js';\n"],"mappings":";;;;;;;;;;;AAoBO,IAAM,eAAN,cAA2B,mBAAmB;AAAA,EACnD,WAAW,qBAA+B;AACxC,WAAO,CAAC,KAAK;AAAA,EACf;AAAA;AAAA,EAGQ,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQxB,IAAI,QAA0B;AAC5B,QAAI,QAAQ,KAAK,cAAgC,2BAA2B;AAC5E,QAAI,CAAC,OAAO;AACV,cAAQ,SAAS,cAAc,OAAO;AACtC,YAAM,YAAY;AAAA,IACpB;AAEA,eAAW,QAAQ,CAAC,GAAG,KAAK,UAAU,EAAG,KAAI,SAAS,MAAO,OAAM,YAAY,IAAI;AACnF,QAAI,MAAM,eAAe,KAAM,MAAK,YAAY,KAAK;AACrD,WAAO;AAAA,EACT;AAAA,EAEmB,eAAqC;AACtD,WAAO,EAAE,WAAW,KAAK;AAAA,EAC3B;AAAA,EAEmB,QAAc;AAC/B,UAAM,QAAQ,KAAK;AAEnB,UAAM,QAAQ,KAAK,aAAa,KAAK;AACrC,QAAI,SAAS,MAAM;AACjB,eAAS,OAAO,OAAO,KAAK;AAC5B,WAAK,gBAAgB;AAAA,IACvB,WAAW,KAAK,eAAe;AAC7B,eAAS,OAAO,OAAO,IAAI;AAC3B,WAAK,gBAAgB;AAAA,IACvB;AAAA,EACF;AACF;;;AC3DA,cAAc,cAAc,YAAY;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/file-input/file-input.element.ts","../../src/components/file-input/define.ts"],"sourcesContent":["import { A11yFieldElement } from '../../core/a11y-field-element.js';\nimport { syncAttr, syncText } from '../../core/dom-sync.js';\nimport type { FieldControl } from '../../core/field.js';\nimport { nextId } from '../../core/ids.js';\nimport { formatString, getString } from '../../core/strings.js';\n\n/** Marks the markup this element builds, so the field never takes it for a consumer part. */\nconst GENERATED = 'data-a11y-generated';\n\nconst SIZE_UNITS = ['byte', 'kilobyte', 'megabyte', 'gigabyte'] as const;\nconst SIZE_FACTORS: Record<string, number> = { b: 1, kb: 1024, mb: 1024 ** 2, gb: 1024 ** 3 };\n\n/**\n * A file picker built from a real `<input type=\"file\">`, with the same\n * optional parts as `<a11y-input>` (`<a11y-label>`, `<a11y-hint>`,\n * `<a11y-error>`). Files can be browsed for or dragged onto the element.\n *\n * ```html\n * <a11y-file-input max-size=\"5MB\" max-files=\"3\" previews>\n * <a11y-label>Attachments</a11y-label>\n * <input type=\"file\" name=\"attachments\" multiple accept=\".pdf,image/*\" required>\n * <a11y-hint>PDF or images, up to 5 MB each.</a11y-hint>\n * <a11y-error></a11y-error>\n * </a11y-file-input>\n * ```\n *\n * The native input stays the focusable control: it's only visually hidden,\n * so it keeps its role, `required`, validity and the field's ARIA. It's\n * joined by generated markup:\n *\n * - a drop zone holding a `<label for>` styled as a \"Browse files\" button,\n * which opens the picker natively and adds its text to the input's\n * accessible name (so voice control users can say it);\n * - the list of selected files, each with a \"Remove\" button named after\n * its file;\n * - a list of the files that weren't added, and why;\n * - a polite status region announcing what was added, removed or rejected.\n *\n * Dragging is only a shortcut: everything works from the keyboard. With\n * `multiple`, browsing or dropping again adds to the selection instead of\n * replacing it. Files that fail `accept`, `max-size` or `max-files` are never\n * added (the browser doesn't check `accept` on drop), so those rules can't\n * make the field invalid; `required` and `validators` still can.\n *\n * The selection is written back to `input.files`, so the input submits it\n * with the form like any file input.\n */\nexport class FileInputElement extends A11yFieldElement<File[]> {\n static override get observedAttributes(): string[] {\n return [...super.observedAttributes, 'max-size', 'max-files', 'previews', 'browse-label', 'drop-label'];\n }\n\n protected readonly controlSelector = 'input[type=\"file\"]';\n\n private _files: File[] = [];\n /** The control `_files` was last read from — a new one brings its own files. */\n private _filesControl: HTMLInputElement | null = null;\n private _previewUrls = new Map<File, string>();\n /** Set while this element fires `input`/`change` itself, so it doesn't take them for a new pick. */\n private _committing = false;\n /** `dragenter`s minus `dragleave`s, since both fire again for every child crossed. */\n private _dragDepth = 0;\n /** Key for the host's own listeners in `wireOnce()`, which the field base already uses for the host. */\n private readonly _hostKey = document.createComment('');\n\n /** Adds files as a drop would: checked against the rules, announced, and followed by `input`/`change` events. */\n addFiles(files: Iterable<File>): void {\n const control = this._fileControl();\n if (control) this._addFromUser(control, [...files], true);\n }\n\n /** Removes a file, by reference or index. Silent, like `setValue()`: no events, no announcement. */\n removeFile(file: File | number): void {\n const index = typeof file === 'number' ? file : this._files.indexOf(file);\n const control = this._fileControl();\n if (!control || index < 0 || index >= this._files.length) return;\n this._files.splice(index, 1);\n this._afterSilentChange(control);\n }\n\n /** Removes every file. Silent, like `setValue()`. */\n clear(): void {\n const control = this._fileControl();\n if (!control) return;\n this._files = [];\n this._afterSilentChange(control);\n }\n\n override formResetCallback(): void {\n super.formResetCallback();\n // The form empties `input.files` itself; only this element's copy is left.\n this._files = [];\n this._renderList();\n this._renderRejected([]);\n const status = this._generated('status');\n if (status) syncText(status, '');\n }\n\n protected override readValue(): File[] {\n return [...this._files];\n }\n\n /** Replaces the selection. Files the rules rule out are dropped, silently. */\n protected override writeValue(control: FieldControl, files: File[]): void {\n this._files = this._intake(control as HTMLInputElement, files, []).files;\n this._commit(control as HTMLInputElement);\n this._renderList();\n this._renderRejected([]);\n }\n\n protected override onDisconnect(): void {\n this._setDragover(false);\n for (const url of this._previewUrls.values()) URL.revokeObjectURL(url);\n this._previewUrls.clear();\n // Previews are rebuilt on reconnect.\n this._filesControl = null;\n }\n\n protected override onStringsChange(): void {\n this._sync(); // relabels the drop zone and re-links the field\n this._renderList();\n }\n\n protected override _sync(): void {\n const control = this._fileControl();\n if (control) {\n this._syncUi(control);\n if (this._filesControl !== control) {\n this._filesControl = control;\n this._files = [...(control.files ?? [])];\n this._renderList();\n }\n const list = this._generated('list');\n if (list && this.boolAttr('previews') !== list.hasAttribute('data-previews')) this._renderList();\n const disabled = control.matches(':disabled');\n for (const button of this._removeButtons()) syncAttr(button, 'disabled', disabled ? '' : null);\n }\n\n this.wireOnce(this._hostKey, () => {\n // Capture: runs before the field base's `onChange`/`onInput`, which then see the merged selection.\n this.listen(this, 'input', (event) => this._onNativePick(event), true);\n this.listen(this, 'change', (event) => this._onNativePick(event), true);\n this.listen(this, 'dragenter', (event) => this._onDrag(event as DragEvent));\n this.listen(this, 'dragover', (event) => this._onDrag(event as DragEvent));\n this.listen(this, 'dragleave', (event) => this._onDrag(event as DragEvent));\n this.listen(this, 'drop', (event) => this._onDrag(event as DragEvent));\n this.listen(this, 'click', (event) => this._onClick(event));\n });\n\n super._sync();\n }\n\n private _fileControl(): HTMLInputElement | null {\n return this._control() as HTMLInputElement | null;\n }\n\n private _generated(name: 'dropzone' | 'rejected' | 'list' | 'status'): HTMLElement | null {\n return this.querySelector<HTMLElement>(`:scope > .a11y-file-input__${name}`);\n }\n\n private _removeButtons(): HTMLButtonElement[] {\n const list = this._generated('list');\n return list ? [...list.querySelectorAll<HTMLButtonElement>('.a11y-file-input__remove')] : [];\n }\n\n /** Builds the drop zone (right after the input) and the lists and status (last), moving them only when misplaced. */\n private _syncUi(control: HTMLInputElement): void {\n if (!control.id) control.id = nextId('a11y-field');\n\n let dropzone = this._generated('dropzone');\n if (!dropzone) {\n dropzone = document.createElement('div');\n dropzone.className = 'a11y-file-input__dropzone';\n dropzone.setAttribute(GENERATED, '');\n const button = document.createElement('label');\n button.className = 'a11y-file-input__button';\n const prompt = document.createElement('span');\n prompt.className = 'a11y-file-input__prompt';\n // A pointer-only instruction: keyboard and screen reader users browse instead.\n prompt.setAttribute('aria-hidden', 'true');\n dropzone.append(button, prompt);\n }\n if (control.nextElementSibling !== dropzone) control.after(dropzone);\n const button = dropzone.querySelector<HTMLLabelElement>('.a11y-file-input__button')!;\n syncAttr(button, 'for', control.id);\n syncText(button, this.stringAttr('browse-label', getString('browseFiles')));\n syncText(dropzone.querySelector('.a11y-file-input__prompt')!, this.stringAttr('drop-label', getString('dropFiles')));\n\n // After the consumer's parts, so the rejections sit right below the error.\n const tail = (['rejected', 'list', 'status'] as const).map((name) => {\n const existing = this._generated(name);\n if (existing) return existing;\n const el = document.createElement(name === 'status' ? 'div' : 'ul');\n el.className = `a11y-file-input__${name}`;\n el.setAttribute(GENERATED, '');\n if (name === 'status') el.setAttribute('role', 'status');\n else el.hidden = true;\n return el;\n });\n const children = [...this.children];\n if (tail.some((el, i) => children[children.length - tail.length + i] !== el)) this.append(...tail);\n syncAttr(tail[1]!, 'aria-label', getString('selectedFiles'));\n }\n\n /** A pick from the browser's dialog: merge it into the selection before anyone else reads the input. */\n private _onNativePick(event: Event): void {\n const control = this._fileControl();\n if (this._committing || !control || event.target !== control) return;\n const picked = [...(control.files ?? [])];\n // `input` and `change` both fire for one pick: the second finds it already merged.\n if (sameFiles(picked, this._files)) return;\n this._addFromUser(control, picked, false);\n }\n\n private _onDrag(event: DragEvent): void {\n if (![...(event.dataTransfer?.types ?? [])].includes('Files')) return;\n const control = this._fileControl();\n const enabled = !!control && !control.matches(':disabled');\n\n switch (event.type) {\n case 'dragenter':\n if (!enabled) return;\n event.preventDefault();\n this._dragDepth++;\n this._setDragover(true);\n break;\n case 'dragover':\n if (!enabled) return;\n event.preventDefault(); // allows the drop\n event.dataTransfer!.dropEffect = 'copy';\n break;\n case 'dragleave':\n this._dragDepth = Math.max(0, this._dragDepth - 1);\n if (this._dragDepth === 0) this._setDragover(false);\n break;\n case 'drop':\n event.preventDefault(); // never let the browser open the file instead\n this._dragDepth = 0;\n this._setDragover(false);\n if (enabled) this._addFromUser(control, [...(event.dataTransfer?.files ?? [])], true);\n break;\n }\n }\n\n private _onClick(event: Event): void {\n const button = (event.target as Element).closest?.('.a11y-file-input__remove');\n const control = this._fileControl();\n if (!button || !control || !this._generated('list')?.contains(button)) return;\n const index = this._removeButtons().indexOf(button as HTMLButtonElement);\n const [removed] = this._files.splice(index, 1);\n if (!removed) return;\n\n this._commit(control);\n this._renderList();\n this._renderRejected([]);\n this._announce([formatString(getString('fileRemoved'), { name: removed.name })]);\n this._dispatch(control);\n this.binding?.show();\n\n // Never drop focus to <body>: the next file, else the previous one, else the input.\n const buttons = this._removeButtons();\n (buttons[index] ?? buttons[index - 1] ?? control).focus();\n }\n\n /** Adds files the user picked or dropped, then lists, announces and (for drops) fires `input`/`change`. */\n private _addFromUser(control: HTMLInputElement, incoming: File[], dispatch: boolean): void {\n const { files, added, rejected } = this._intake(control, incoming, this._files);\n this._files = files;\n this._commit(control);\n this._renderList();\n this._renderRejected(rejected);\n\n const messages: string[] = [];\n if (added.length === 1) messages.push(formatString(getString('fileAdded'), { name: added[0]!.name }));\n else if (added.length > 1) messages.push(formatString(getString('filesAdded'), { count: String(added.length) }));\n this._announce([...messages, ...rejected]);\n\n if (dispatch) {\n this._dispatch(control);\n this.binding?.show();\n }\n }\n\n /**\n * Checks `incoming` against `accept`, `max-size` and `max-files`. With\n * `multiple`, new files join `current` (skipping ones already there);\n * without, the first acceptable one replaces it — and if none is, `current`\n * stays.\n */\n private _intake(control: HTMLInputElement, incoming: File[], current: File[]): { files: File[]; added: File[]; rejected: string[] } {\n const multiple = control.multiple;\n const maxFiles = multiple ? this.numberAttr('max-files', Infinity) : 1;\n const maxSize = parseSize(this.getAttribute('max-size'));\n const values = {\n max: String(maxFiles),\n maxSize: maxSize == null ? '' : formatSize(maxSize, this._lang()),\n };\n const files = multiple ? [...current] : [];\n const added: File[] = [];\n const rejected: string[] = [];\n const reject = (key: 'fileTypeRejected' | 'fileSizeRejected' | 'fileCountRejected', attribute: string, file: File) =>\n rejected.push(formatString(this.stringAttr(attribute, getString(key)), { ...values, name: file.name }));\n\n for (const file of incoming) {\n if (files.some((kept) => sameFile(kept, file))) continue;\n if (!matchesAccept(file, control.accept)) reject('fileTypeRejected', 'type-rejected-message', file);\n else if (maxSize != null && file.size > maxSize) reject('fileSizeRejected', 'size-rejected-message', file);\n else if (files.length >= maxFiles) reject('fileCountRejected', 'count-rejected-message', file);\n else {\n files.push(file);\n added.push(file);\n }\n }\n return { files: multiple || added.length ? files : [...current], added, rejected };\n }\n\n private _afterSilentChange(control: HTMLInputElement): void {\n this._commit(control);\n this._renderList();\n this._renderRejected([]);\n this.binding?.validate();\n }\n\n /** Writes the selection to `input.files`, so the form submits it and `required` sees it. */\n private _commit(control: HTMLInputElement): void {\n if (typeof DataTransfer === 'undefined') return;\n const transfer = new DataTransfer();\n for (const file of this._files) transfer.items.add(file);\n control.files = transfer.files;\n }\n\n private _dispatch(control: HTMLInputElement): void {\n this._committing = true;\n try {\n control.dispatchEvent(new Event('input', { bubbles: true, composed: true }));\n control.dispatchEvent(new Event('change', { bubbles: true }));\n } finally {\n this._committing = false;\n }\n }\n\n private _renderList(): void {\n const list = this._generated('list');\n if (!list) return;\n const previews = this.boolAttr('previews');\n const disabled = !!this._fileControl()?.matches(':disabled');\n const lang = this._lang();\n\n for (const [file, url] of this._previewUrls) {\n if (previews && this._files.includes(file)) continue;\n URL.revokeObjectURL(url);\n this._previewUrls.delete(file);\n }\n\n list.replaceChildren(\n ...this._files.map((file) => {\n const item = document.createElement('li');\n item.className = 'a11y-file-input__item';\n if (previews && file.type.startsWith('image/')) {\n let url = this._previewUrls.get(file);\n if (!url) {\n url = URL.createObjectURL(file);\n this._previewUrls.set(file, url);\n }\n const img = document.createElement('img');\n img.className = 'a11y-file-input__preview';\n img.alt = ''; // the name next to it already says what it is\n img.src = url;\n item.append(img);\n }\n const name = document.createElement('span');\n name.className = 'a11y-file-input__name';\n name.textContent = file.name;\n const size = document.createElement('span');\n size.className = 'a11y-file-input__size';\n size.textContent = formatSize(file.size, lang);\n const remove = document.createElement('button');\n remove.type = 'button';\n remove.className = 'a11y-file-input__remove';\n remove.textContent = getString('remove');\n // Starts with the visible text, so voice control's \"click Remove\" still matches.\n remove.setAttribute('aria-label', formatString(getString('removeFile'), { name: file.name }));\n remove.disabled = disabled;\n item.append(name, size, remove);\n return item;\n }),\n );\n syncAttr(list, 'data-previews', previews ? '' : null);\n syncAttr(list, 'hidden', this._files.length ? null : '');\n }\n\n private _renderRejected(messages: string[]): void {\n const list = this._generated('rejected');\n if (!list) return;\n if (messages.length || list.childElementCount) {\n list.replaceChildren(\n ...messages.map((message) => {\n const item = document.createElement('li');\n item.textContent = message;\n return item;\n }),\n );\n }\n syncAttr(list, 'hidden', messages.length ? null : '');\n }\n\n private _announce(messages: string[]): void {\n const status = this._generated('status');\n if (status && messages.length) status.textContent = messages.join('. ');\n }\n\n private _setDragover(on: boolean): void {\n const dropzone = this._generated('dropzone');\n if (dropzone) syncAttr(dropzone, 'data-dragover', on ? '' : null);\n if (!on) this._dragDepth = 0;\n try {\n if (on) this.internals.states?.add('dragover');\n else this.internals.states?.delete('dragover');\n } catch {\n // Older Chromium only accepted `--dashed` state names.\n }\n }\n\n private _lang(): string | undefined {\n return this.closest('[lang]')?.getAttribute('lang') || undefined;\n }\n}\n\nfunction sameFile(a: File, b: File): boolean {\n return a === b || (a.name === b.name && a.size === b.size && a.lastModified === b.lastModified && a.type === b.type);\n}\n\nfunction sameFiles(a: File[], b: File[]): boolean {\n return a.length === b.length && a.every((file, i) => sameFile(file, b[i]!));\n}\n\n/** The `accept` attribute's rules: `.ext`, `type/*` or an exact MIME type. Empty accepts everything. */\nfunction matchesAccept(file: File, accept: string): boolean {\n const rules = accept\n .split(',')\n .map((rule) => rule.trim().toLowerCase())\n .filter(Boolean);\n if (!rules.length) return true;\n const name = file.name.toLowerCase();\n const type = file.type.toLowerCase();\n return rules.some((rule) => {\n if (rule.startsWith('.')) return name.endsWith(rule);\n if (rule.endsWith('/*')) return type.startsWith(rule.slice(0, -1));\n return type === rule;\n });\n}\n\n/** `5MB`, `500 KB`, `1.5gb` or plain bytes (binary units) → bytes; anything else → no limit. */\nexport function parseSize(value: string | null): number | null {\n const match = value?.trim().match(/^(\\d+(?:\\.\\d+)?)\\s*(b|kb|mb|gb)?$/i);\n if (!match) return null;\n return Math.round(Number(match[1]) * SIZE_FACTORS[(match[2] ?? 'b').toLowerCase()]!);\n}\n\n/** A size in the largest fitting unit, localized with `Intl` (`1.5 MB`, `1,5 Mo`, …). */\nexport function formatSize(bytes: number, lang?: string): string {\n let value = bytes;\n let unit = 0;\n while (value >= 1024 && unit < SIZE_UNITS.length - 1) {\n value /= 1024;\n unit++;\n }\n const options: Intl.NumberFormatOptions = {\n style: 'unit',\n unit: SIZE_UNITS[unit],\n unitDisplay: unit === 0 ? 'long' : 'short', // \"3 bytes\", but \"1.5 MB\"\n maximumFractionDigits: unit === 0 ? 0 : 1,\n };\n try {\n return new Intl.NumberFormat(lang, options).format(value);\n } catch {\n return new Intl.NumberFormat(undefined, options).format(value); // an invalid `lang`\n }\n}\n","import { defineElement } from '../../core/define-element.js';\nimport { FileInputElement } from './file-input.element.js';\n\ndefineElement('a11y-file-input', FileInputElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'a11y-file-input': FileInputElement;\n }\n}\n\nexport { FileInputElement };\nexport { bindField } from '../../core/field.js';\nexport * from '../../core/zero-build-exports.js';\n"],"mappings":";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B,QAAM,OAAO,KAAK,KAAK,YAAY;AACnC,QAAM,OAAO,KAAK,KAAK,YAAY;AACnC,SAAO,MAAM,KAAK,CAAC,SAAS;AAC1B,QAAI,KAAK,WAAW,GAAG,EAAG,QAAO,KAAK,SAAS,IAAI;AACnD,QAAI,KAAK,SAAS,IAAI,EAAG,QAAO,KAAK,WAAW,KAAK,MAAM,GAAG,EAAE,CAAC;AACjE,WAAO,SAAS;AAAA,EAClB,CAAC;AACH;AAGO,SAAS,UAAU,OAAqC;AAC7D,QAAM,QAAQ,OAAO,KAAK,EAAE,MAAM,oCAAoC;AACtE,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,KAAK,MAAM,OAAO,MAAM,CAAC,CAAC,IAAI,cAAc,MAAM,CAAC,KAAK,KAAK,YAAY,CAAC,CAAE;AACrF;AAGO,SAAS,WAAW,OAAe,MAAuB;AAC/D,MAAI,QAAQ;AACZ,MAAI,OAAO;AACX,SAAO,SAAS,QAAQ,OAAO,WAAW,SAAS,GAAG;AACpD,aAAS;AACT;AAAA,EACF;AACA,QAAM,UAAoC;AAAA,IACxC,OAAO;AAAA,IACP,MAAM,WAAW,IAAI;AAAA,IACrB,aAAa,SAAS,IAAI,SAAS;AAAA;AAAA,IACnC,uBAAuB,SAAS,IAAI,IAAI;AAAA,EAC1C;AACA,MAAI;AACF,WAAO,IAAI,KAAK,aAAa,MAAM,OAAO,EAAE,OAAO,KAAK;AAAA,EAC1D,QAAQ;AACN,WAAO,IAAI,KAAK,aAAa,QAAW,OAAO,EAAE,OAAO,KAAK;AAAA,EAC/D;AACF;;;AC3dA,cAAc,mBAAmB,gBAAgB;","names":["button"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overlays/core/a11y-modal-overlay-element.ts"],"sourcesContent":["import { A11yOverlayElement } from '../../core/a11y-overlay-element.js';\nimport { FocusTrapHelper, type IFocusTrapOptions } from '../../core/focus-trap.js';\nimport { inertOutside, lockScroll, unlockScroll } from '../../core/overlay-registry.js';\nimport { getString } from '../../core/strings.js';\nimport { whenTransitionDone } from '../../core/transition.js';\nimport { nextId } from '../../core/ids.js';\n\n/**\n * Base for centered/backdrop overlays that always trap focus and lock page\n * scroll: modal, drawer, emergency-dialog. `this` (holding the consumer's\n * own dialog content) is moved into a `.a11y-modal-content` wrapper inside a\n * `.a11y-modal-wrapper`/`.a11y-modal-overlay` backdrop pair on show, and moved back\n * out before that chrome is torn down on hide — same portal dance as\n * `A11yAnchoredOverlayElement`. While open, the rest of `<body>` is `inert`\n * (except toast/banner regions), so nothing behind it can be reached by\n * keyboard or assistive tech.\n *\n * `dismissible` defaults to true when absent, so it's expressed as the\n * inverse presence-attribute `non-dismissible` (booleans read more naturally\n * as \"presence enables the thing\"; `dismissible=\"false\"` would be the odd\n * one out) — `EmergencyDialogElement` overrides the getter to force it, so\n * that safety property can't be relaxed via the attribute.\n *\n * Accessible name: `dialog-label=\"…\"` (plain text, becomes `aria-label`)\n * when given; otherwise the first heading in the content, referenced via\n * `aria-labelledby` (its own `id` is kept, or a unique one is generated).\n *\n * The close button's name: `close-label=\"…\"`, else `setStrings({ closeDialog })`.\n *\n * Initial focus: `initial-focus=\"…\"` (an id, else a selector, looked up inside\n * the content), else a descendant with `autofocus`, else the first focusable\n * element — the × close button when dismissible.\n */\nexport abstract class A11yModalOverlayElement extends A11yOverlayElement {\n static override get observedAttributes(): string[] {\n return ['open', 'non-dismissible', 'dialog-label', 'close-label', 'initial-focus'];\n }\n\n protected _backdrop: HTMLElement | null = null;\n protected _wrapper: HTMLElement | null = null;\n private _focusTrap: FocusTrapHelper | null = null;\n private _closeButton: HTMLButtonElement | null = null;\n private _restoreInert: (() => void) | null = null;\n /** Completes a close whose transition is still running — see `_flushPendingHide()`. */\n private _pendingHide: (() => void) | null = null;\n private _cancelHideWait: (() => void) | null = null;\n\n get dismissible(): boolean {\n return !this.boolAttr('non-dismissible');\n }\n\n get dialogLabel(): string {\n return this.stringAttr('dialog-label');\n }\n\n /** The `initial-focus` attribute: an id or selector of the element to focus on open. */\n get initialFocus(): string {\n return this.stringAttr('initial-focus');\n }\n\n /** The close button's accessible name. */\n get closeLabel(): string {\n return this.stringAttr('close-label', getString('closeDialog'));\n }\n\n protected override onAttributeChanged(name: string): void {\n if (name === 'close-label') this._relabelCloseButton();\n if (!this._wrapper) return;\n if (name === 'dialog-label') this._labelWrapper(this._wrapper);\n else if (name === 'non-dismissible') this._syncCloseButton();\n }\n\n protected override onStringsChange(): void {\n this._relabelCloseButton();\n }\n\n protected createBackdrop(): HTMLElement {\n const el = document.createElement('div');\n el.className = 'a11y-modal-overlay';\n return el;\n }\n\n protected createWrapper(): HTMLElement {\n const el = document.createElement('div');\n el.className = 'a11y-modal-wrapper';\n el.setAttribute('role', 'dialog');\n el.setAttribute('aria-modal', 'true');\n return el;\n }\n\n protected getContentClass(): string {\n return 'a11y-modal-content';\n }\n\n protected focusTrapOptions(): IFocusTrapOptions {\n return {\n escapeDeactivates: () => this.dismissible, // asked on each press: `non-dismissible` can change while open\n onDeactivate: () => this.close('escape'),\n initialFocus: () => this._initialFocusTarget(),\n };\n }\n\n private _initialFocusTarget(): HTMLElement | null {\n const ref = this.initialFocus;\n if (ref) {\n const byId = document.getElementById(ref);\n if (byId && this.contains(byId)) return byId;\n try {\n const bySelector = this.querySelector<HTMLElement>(ref);\n if (bySelector) return bySelector;\n } catch {\n // not a valid selector: fall through to the default\n }\n }\n return this.querySelector<HTMLElement>('[autofocus]');\n }\n\n protected override _show(): void {\n // Reopened while the previous close transition is still running: finish\n // that close now, so its deferred teardown can't later pull `this` out\n // of the chrome built below.\n this._flushPendingHide();\n if (this._wrapper) return; // already showing\n\n lockScroll();\n\n if (this.dismissible) this._prependCloseButton();\n const { backdrop, wrapper } = this._buildDom();\n this._backdrop = backdrop;\n this._wrapper = wrapper;\n\n this._labelWrapper(wrapper);\n\n backdrop.addEventListener('click', (e: MouseEvent) => {\n if (e.target === backdrop && this.dismissible) this.close('backdrop');\n });\n\n this._focusTrap = new FocusTrapHelper({ container: wrapper, options: this.focusTrapOptions() });\n this._focusTrap.activate();\n // After the trap took focus inside: inerting the focused trigger first would blur it.\n // Toast/banner regions stay reachable, so their announcements and buttons still work.\n this._restoreInert = inertOutside(backdrop, (el) => el.classList.contains('a11y-passive-overlay-region'));\n\n requestAnimationFrame(() => {\n backdrop.classList.add('a11y-is-open');\n wrapper.classList.add('a11y-is-open');\n });\n\n this._onShown();\n }\n\n protected override _hide(opts?: { immediate?: boolean }): void {\n const backdrop = this._backdrop;\n const wrapper = this._wrapper;\n if (!backdrop || !wrapper) {\n // Already closing (or closed): an immediate hide just completes it.\n if (opts?.immediate) this._flushPendingHide();\n return;\n }\n\n // Before the trap returns focus, which an inert trigger can't take.\n this._restoreInert?.();\n this._restoreInert = null;\n this._focusTrap?.deactivate();\n this._focusTrap = null;\n this._backdrop = null;\n this._wrapper = null;\n\n const finish = (): void => {\n this._pendingHide = null;\n this._cancelHideWait = null;\n unlockScroll();\n this._closeButton?.remove();\n this._closeButton = null;\n this.classList.remove(this.getContentClass());\n // Detach from the wrapper before it's removed — unless the consumer is\n // removing this element from the document, which must stay removed.\n if (!this._detaching) this._moveSelfTo(document.body);\n wrapper.remove();\n backdrop.remove();\n this._onHidden();\n };\n this._pendingHide = finish;\n\n if (opts?.immediate) {\n finish();\n return;\n }\n\n wrapper.classList.remove('a11y-is-open');\n backdrop.classList.remove('a11y-is-open');\n this._cancelHideWait = whenTransitionDone(wrapper, finish);\n }\n\n private _flushPendingHide(): void {\n const finish = this._pendingHide;\n if (!finish) return;\n this._cancelHideWait?.();\n finish();\n }\n\n private _prependCloseButton(): void {\n const btn = document.createElement('button');\n btn.type = 'button';\n btn.className = 'a11y-modal-close-button';\n btn.textContent = '×';\n btn.setAttribute('aria-label', this.closeLabel);\n btn.addEventListener('click', () => this.close('close-button'));\n this.prepend(btn);\n this._closeButton = btn;\n }\n\n /** Adds or removes the × button after `non-dismissible` changed while open. */\n private _syncCloseButton(): void {\n if (this.dismissible && !this._closeButton) {\n this._prependCloseButton();\n return;\n }\n const button = this._closeButton;\n if (this.dismissible || !button) return;\n const hadFocus = document.activeElement === button;\n button.remove();\n this._closeButton = null;\n if (hadFocus && this._wrapper) {\n // Never drop focus to <body>; the trap removes this tabindex on close.\n this._wrapper.setAttribute('tabindex', '-1');\n this._wrapper.focus();\n }\n }\n\n private _relabelCloseButton(): void {\n this._closeButton?.setAttribute('aria-label', this.closeLabel);\n }\n\n private _buildDom(): { backdrop: HTMLElement; wrapper: HTMLElement } {\n const backdrop = this.createBackdrop();\n const wrapper = this.createWrapper();\n backdrop.appendChild(wrapper);\n document.body.appendChild(backdrop);\n this.classList.add(this.getContentClass());\n this._moveSelfTo(wrapper); // see A11yOverlayElement's class doc on why this isn't a raw appendChild\n return { backdrop, wrapper };\n }\n\n private _labelWrapper(wrapper: HTMLElement): void {\n wrapper.removeAttribute('aria-label');\n wrapper.removeAttribute('aria-labelledby');\n if (this.dialogLabel) {\n wrapper.setAttribute('aria-label', this.dialogLabel);\n return;\n }\n const heading = this.querySelector<HTMLElement>('h1, h2, h3, h4, h5, h6');\n if (!heading) return;\n if (!heading.id) heading.id = nextId('a11y-dialog-title');\n wrapper.setAttribute('aria-labelledby', heading.id);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiCO,IAAe,0BAAf,cAA+C,mBAAmB;AAAA,EACvE,WAAoB,qBAA+B;AACjD,WAAO,CAAC,QAAQ,mBAAmB,gBAAgB,eAAe,eAAe;AAAA,EACnF;AAAA,EAEU,YAAgC;AAAA,EAChC,WAA+B;AAAA,EACjC,aAAqC;AAAA,EACrC,eAAyC;AAAA,EACzC,gBAAqC;AAAA;AAAA,EAErC,eAAoC;AAAA,EACpC,kBAAuC;AAAA,EAE/C,IAAI,cAAuB;AACzB,WAAO,CAAC,KAAK,SAAS,iBAAiB;AAAA,EACzC;AAAA,EAEA,IAAI,cAAsB;AACxB,WAAO,KAAK,WAAW,cAAc;AAAA,EACvC;AA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AAc,SAA4B;AAChD,YAAQ,gBAAgB,YAAY;AACpC,YAAQ,gBAAgB,iBAAiB;AACzC,QAAI,KAAK,aAAa;AACpB,cAAQ,aAAa,cAAc,KAAK,WAAW;AACnD;AAAA,IACF;AACA,UAAM,UAAU,KAAK,cAA2B,wBAAwB;AACxE,QAAI,CAAC,QAAS;AACd,QAAI,CAAC,QAAQ,GAAI,SAAQ,KAAK,OAAO,mBAAmB;AACxD,YAAQ,aAAa,mBAAmB,QAAQ,EAAE;AAAA,EACpD;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/anchor/anchor.element.ts","../../src/components/anchor/define.ts"],"sourcesContent":["import { A11yWrapperElement } from '../../core/a11y-wrapper-element.js';\nimport { syncAttr } from '../../core/dom-sync.js';\nimport { formatString, getString } from '../../core/strings.js';\n\n/** Whether a link `target` opens a new browsing context — `_blank` or a named window, not `_self`/`_parent`/`_top`. */\nfunction opensNewContext(target: string | null): boolean {\n return !!target && (target === '_blank' || !target.startsWith('_'));\n}\n\nconst HEADING_SELECTOR = 'h1, h2, h3, h4, h5, h6, [role=\"heading\"]';\n\n/** The target's name for the navigation announcement — its label or heading, never its whole content. */\nfunction targetName(target: HTMLElement, id: string): string {\n const label = target.getAttribute('aria-label')?.trim();\n if (label) return label;\n\n const labelledBy = (target.getAttribute('aria-labelledby') ?? '')\n .split(/\\s+/)\n .filter(Boolean)\n .map((ref) => document.getElementById(ref)?.textContent?.trim() ?? '')\n .filter(Boolean)\n .join(' ');\n if (labelledBy) return labelledBy;\n\n const heading = target.matches(HEADING_SELECTOR) ? target : target.querySelector(HEADING_SELECTOR);\n return heading?.textContent?.trim() || id;\n}\n\n/** A fragment's percent-decoded id, or `null` when it holds a malformed escape sequence. */\nfunction decodeFragment(fragment: string): string | null {\n try {\n return decodeURIComponent(fragment);\n } catch {\n return null;\n }\n}\n\nfunction prefersReducedMotion(): boolean {\n return window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;\n}\n\n/** Targets currently made focusable by a jump, mapped to their own `tabindex` (`null` = none) to restore on blur. */\nconst pendingTabindexRestores = new WeakMap<HTMLElement, string | null>();\n\n/**\n * Enhances a real, consumer-authored `<a href>`:\n *\n * - **New-context links** (`target=\"_blank\"` or a named target — not\n * `_self`/`_parent`/`_top`): adds `noopener noreferrer` to `rel`\n * (security — an opened page can't reach back via `window.opener`) and\n * appends \"(opens in new tab)\" to the accessible name, so it isn't a\n * surprise to screen-reader/keyboard users.\n * - **Internal same-page anchors** (`href=\"#id\"`): native browser jump-links\n * are jarring for keyboard/AT users — no scroll animation, and focus isn't\n * moved to the target, so subsequent Tab presses continue from wherever\n * focus happened to be. This smooth-scrolls to the target (instantly under\n * `prefers-reduced-motion: reduce`), moves focus to it (temporarily made\n * focusable via `tabindex=\"-1\"`, its own `tabindex` restored on blur), and\n * announces the navigation — by the target's label or heading — through a\n * live region for screen-reader users. The fragment is still added to the\n * URL and history (`history.pushState`, so no `hashchange` and no\n * `:target` update). A link whose target doesn't exist is left to the\n * browser. Space also activates (native anchors only activate on Enter).\n *\n * Both built-in strings can be translated: `new-tab-label=\"…\"` /\n * `navigated-label=\"… {name}\"` on this element, else `setStrings({\n * opensInNewTab, navigatedTo })`.\n *\n * ```html\n * <a11y-anchor><a href=\"#section-2\">Jump to section 2</a></a11y-anchor>\n * <a11y-anchor><a href=\"https://example.com\" target=\"_blank\">External site</a></a11y-anchor>\n * ```\n */\nexport class AnchorElement extends A11yWrapperElement {\n static get observedAttributes(): string[] {\n return ['new-tab-label', 'navigated-label'];\n }\n\n /** Each link's own `aria-label` before this element touched it, so the new-tab suffix is never applied twice and can be undone. */\n private _originalLabels = new WeakMap<HTMLAnchorElement, string | null>();\n\n protected override _sync(): void {\n const anchor = this.querySelector<HTMLAnchorElement>('a[href]');\n if (!anchor) return;\n\n if (!this._originalLabels.has(anchor)) this._originalLabels.set(anchor, anchor.getAttribute('aria-label'));\n const originalLabel = this._originalLabels.get(anchor) ?? null;\n\n if (opensNewContext(anchor.getAttribute('target'))) {\n const rel = new Set((anchor.getAttribute('rel') ?? '').split(/\\s+/).filter(Boolean));\n rel.add('noopener').add('noreferrer');\n syncAttr(anchor, 'rel', [...rel].join(' '));\n const base = originalLabel || anchor.textContent?.trim() || anchor.getAttribute('href') || '';\n const suffix = this.getAttribute('new-tab-label') ?? getString('opensInNewTab');\n syncAttr(anchor, 'aria-label', `${base} ${suffix}`.trim());\n } else {\n syncAttr(anchor, 'aria-label', originalLabel);\n }\n\n // `href` is read at activation time, not captured here, so a link\n // whose href changes later is handled according to its current value.\n this.wireOnce(anchor, () => {\n const activate = (e: Event): void => {\n const href = anchor.getAttribute('href') ?? '';\n if (!href.startsWith('#') || href.length < 2) return; // not a same-page anchor: native behavior\n const id = decodeFragment(href.slice(1));\n const target = id === null ? null : document.getElementById(id);\n if (!id || !target) return; // malformed, or nothing to jump to: leave it to the browser\n e.preventDefault();\n // The URL and history still get the fragment, as on a native jump (back returns here).\n if (location.hash !== href) history.pushState(history.state, '', href);\n this._activateInternalAnchor(target, id);\n };\n this.listen(anchor, 'click', activate);\n this.listen(anchor, 'keydown', (e) => {\n if ((e as KeyboardEvent).key === ' ') activate(e);\n });\n });\n }\n\n protected override onStringsChange(): void {\n this._sync();\n }\n\n private _activateInternalAnchor(target: HTMLElement, id: string): void {\n target.scrollIntoView({ behavior: prefersReducedMotion() ? 'auto' : 'smooth' });\n\n setTimeout(() => {\n // A jump before the previous one's blur must not record our own -1 as the original.\n if (!pendingTabindexRestores.has(target)) {\n pendingTabindexRestores.set(target, target.getAttribute('tabindex'));\n target.addEventListener(\n 'blur',\n () => {\n syncAttr(target, 'tabindex', pendingTabindexRestores.get(target) ?? null);\n pendingTabindexRestores.delete(target);\n },\n { once: true },\n );\n }\n target.setAttribute('tabindex', '-1');\n target.focus({ preventScroll: true });\n }, 100);\n\n const template = this.getAttribute('navigated-label') ?? getString('navigatedTo');\n const announcement = document.createElement('div');\n announcement.setAttribute('role', 'status');\n announcement.setAttribute('aria-live', 'polite');\n announcement.setAttribute('aria-atomic', 'true');\n announcement.className = 'a11y-visually-hidden';\n document.body.appendChild(announcement);\n // Delay content so AT registers the live region before it receives text.\n setTimeout(() => {\n announcement.textContent = formatString(template, { name: targetName(target, id) });\n setTimeout(() => announcement.remove(), 3000);\n }, 100);\n }\n}\n","import { defineElement } from '../../core/define-element.js';\nimport { AnchorElement } from './anchor.element.js';\n\ndefineElement('a11y-anchor', AnchorElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'a11y-anchor': AnchorElement;\n }\n}\n\nexport { AnchorElement };\nexport * from '../../core/zero-build-exports.js';\n"],"mappings":";;;;;;;;;;;;;AAKA,SAAS,gBAAgB,QAAgC;AACvD,SAAO,CAAC,CAAC,WAAW,WAAW,YAAY,CAAC,OAAO,WAAW,GAAG;AACnE;AAEA,IAAM,mBAAmB;AAGzB,SAAS,WAAW,QAAqB,IAAoB;AAC3D,QAAM,QAAQ,OAAO,aAAa,YAAY,GAAG,KAAK;AACtD,MAAI,MAAO,QAAO;AAElB,QAAM,cAAc,OAAO,aAAa,iBAAiB,KAAK,IAC3D,MAAM,KAAK,EACX,OAAO,OAAO,EACd,IAAI,CAAC,QAAQ,SAAS,eAAe,GAAG,GAAG,aAAa,KAAK,KAAK,EAAE,EACpE,OAAO,OAAO,EACd,KAAK,GAAG;AACX,MAAI,WAAY,QAAO;AAEvB,QAAM,UAAU,OAAO,QAAQ,gBAAgB,IAAI,SAAS,OAAO,cAAc,gBAAgB;AACjG,SAAO,SAAS,aAAa,KAAK,KAAK;AACzC;AAGA,SAAS,eAAe,UAAiC;AACvD,MAAI;AACF,WAAO,mBAAmB,QAAQ;AAAA,EACpC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,uBAAgC;AACvC,SAAO,OAAO,aAAa,kCAAkC,EAAE,WAAW;AAC5E;AAGA,IAAM,0BAA0B,oBAAI,QAAoC;AA+BjE,IAAM,gBAAN,cAA4B,mBAA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C1JA,cAAc,eAAe,aAAa;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overlays/core/a11y-menu-overlay-element.ts"],"sourcesContent":["import { focusFromKeyboard, focusReturnTarget } from '../../core/focus-trap.js';\nimport { A11yAnchoredOverlayElement } from './a11y-anchored-overlay-element.js';\n\n/**\n * Base for menu-shaped anchored overlays (dropdown, context menu): roving\n * tabindex over `[role=\"menuitem\"]` children instead of a focus trap, with\n * Arrow/Home/End navigation and Enter/Space activating the focused item.\n *\n * Items are the consumer's own light-DOM children — no `MenuItem[]`/\n * `onSelect` config to keep in sync. Each item is a real element the\n * consumer can attach their own `click` listener to directly; Enter/Space\n * on the focused item triggers a real synthetic `.click()` on it (same\n * \"keyboard activation = real click\" pattern as `FocusableElement`), and\n * this element auto-closes after any enabled item is clicked, by mouse or\n * keyboard — the one piece of behavior that's still the menu's own to own.\n *\n * Listener (un)binding is manual, not via `this.listen()`: the wrapper is a\n * fresh element built by `_show()` on every open, and `this.listen()`'s\n * cleanup only runs on disconnect — across many open/close cycles that would\n * accumulate dead entries. Binding/unbinding explicitly in `_show()`/`_hide()`\n * (matching `A11yAnchoredOverlayElement`'s own dismiss/reposition listeners)\n * keeps each cycle self-contained.\n *\n * Focus returns to whatever was focused when the menu opened (normally its\n * trigger) when it closes while focus is still inside it — Escape, item\n * activation — but not when focus already moved elsewhere (Tab away, a\n * click on another control).\n */\nexport abstract class A11yMenuOverlayElement extends A11yAnchoredOverlayElement {\n private _boundMenuKeyDown: ((e: KeyboardEvent) => void) | null = null;\n private _boundFocusOut: ((e: FocusEvent) => void) | null = null;\n private _boundClick: ((e: MouseEvent) => void) | null = null;\n private _returnFocusTo: HTMLElement | null = null;\n\n /** Menus always use roving tabindex, never a focus trap. */\n protected override wantsFocusTrap(): boolean {\n return false;\n }\n\n protected override createWrapper(): HTMLElement {\n const el = super.createWrapper();\n el.setAttribute('role', 'menu');\n return el;\n }\n\n protected override _show(): void {\n // Captured once per open cycle (a re-show while already open keeps the original).\n if (!this._returnFocusTo) this._returnFocusTo = focusReturnTarget();\n this._unbindMenuKeyboardHandling(); // re-shown while open: drop the previous wrapper's handlers\n super._show();\n this._initRovingTabindex();\n this._bindMenuKeyboardHandling();\n this._focusFirstEnabledItem();\n }\n\n protected override _hide(opts?: { immediate?: boolean }): void {\n const focusWasInside = !!this._wrapper?.contains(document.activeElement);\n this._unbindMenuKeyboardHandling(); // before moving focus, so our own focusout handler doesn't fire\n const returnTo = this._returnFocusTo;\n this._returnFocusTo = null;\n if (focusWasInside && returnTo?.isConnected && !this._detaching) returnTo.focus();\n super._hide(opts);\n }\n\n private _items(): HTMLElement[] {\n return Array.from(this.querySelectorAll<HTMLElement>('[role=\"menuitem\"]'));\n }\n\n private _enabledItems(): HTMLElement[] {\n return this._items().filter((el) => el.getAttribute('aria-disabled') !== 'true');\n }\n\n private _initRovingTabindex(): void {\n this._items().forEach((el, i) => el.setAttribute('tabindex', i === 0 ? '0' : '-1'));\n }\n\n private _focusFirstEnabledItem(): void {\n const target = this._enabledItems()[0];\n if (target) {\n target.focus();\n return;\n }\n // Nothing to roving-tabindex onto — fall back to focusing the menu\n // wrapper itself so focus doesn't stay stranded on whatever triggered\n // the menu, mirroring FocusTrapHelper's empty-container fallback.\n if (this._wrapper) {\n this._wrapper.setAttribute('tabindex', '-1');\n this._wrapper.focus();\n }\n }\n\n private _focusItemAt(items: HTMLElement[], index: number): void {\n items.forEach((el) => el.setAttribute('tabindex', '-1'));\n const target = items[index];\n if (!target) return;\n target.setAttribute('tabindex', '0');\n focusFromKeyboard(target);\n }\n\n private _bindMenuKeyboardHandling(): void {\n if (!this._wrapper) return;\n const wrapper = this._wrapper;\n\n this._boundMenuKeyDown = (e: KeyboardEvent): void => {\n const items = this._enabledItems();\n if (items.length === 0) return;\n const currentIndex = items.indexOf(document.activeElement as HTMLElement);\n\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n this._focusItemAt(items, (currentIndex + 1) % items.length);\n break;\n case 'ArrowUp':\n e.preventDefault();\n this._focusItemAt(items, (currentIndex - 1 + items.length) % items.length);\n break;\n case 'Home':\n e.preventDefault();\n this._focusItemAt(items, 0);\n break;\n case 'End':\n e.preventDefault();\n this._focusItemAt(items, items.length - 1);\n break;\n case 'Enter':\n case ' ':\n if (currentIndex >= 0) {\n e.preventDefault();\n items[currentIndex]!.click();\n }\n break;\n }\n };\n\n this._boundFocusOut = (e: FocusEvent): void => {\n const related = e.relatedTarget as Node | null;\n if (related && !wrapper.contains(related)) this.close('focus-out');\n };\n\n this._boundClick = (e: MouseEvent): void => {\n const item = (e.target as HTMLElement).closest<HTMLElement>('[role=\"menuitem\"]');\n if (item && item.getAttribute('aria-disabled') !== 'true') this.close('item');\n };\n\n wrapper.addEventListener('keydown', this._boundMenuKeyDown);\n wrapper.addEventListener('focusout', this._boundFocusOut);\n wrapper.addEventListener('click', this._boundClick);\n }\n\n private _unbindMenuKeyboardHandling(): void {\n if (this._wrapper && this._boundMenuKeyDown) this._wrapper.removeEventListener('keydown', this._boundMenuKeyDown);\n if (this._wrapper && this._boundFocusOut) this._wrapper.removeEventListener('focusout', this._boundFocusOut);\n if (this._wrapper && this._boundClick) this._wrapper.removeEventListener('click', this._boundClick);\n this._boundMenuKeyDown = null;\n this._boundFocusOut = null;\n this._boundClick = null;\n }\n}\n"],"mappings":";;;;;;;;;AA4BO,IAAe,yBAAf,cAA8C,2BAA2B;AAAA,EACtE,oBAAyD;AAAA,EACzD,iBAAmD;AAAA,EACnD,cAAgD;AAAA,EAChD,iBAAqC;AAAA;AAAA,EAG1B,iBAA0B;AAC3C,WAAO;AAAA,EACT;AAAA,EAEmB,gBAA6B;AAC9C,UAAM,KAAK,MAAM,cAAc;AAC/B,OAAG,aAAa,QAAQ,MAAM;AAC9B,WAAO;AAAA,EACT;AAAA,EAEmB,QAAc;AAE/B,QAAI,CAAC,KAAK,eAAgB,MAAK,iBAAiB,kBAAkB;AAClE,SAAK,4BAA4B;AACjC,U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