a11y-elements 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -1
- package/dist/a11y.css +24 -0
- package/dist/browser/all.js +17 -17
- package/dist/browser/{chunk-JFZTJO7H.js → chunk-2HQKZFJV.js} +2 -2
- package/dist/browser/{chunk-AHF64455.js → chunk-2TPJ5MVQ.js} +2 -2
- package/dist/browser/{chunk-D6ES5GYW.js → chunk-6BEWDDER.js} +2 -2
- package/dist/browser/{chunk-JTFESZPQ.js → chunk-6VUVGT2G.js} +3 -3
- package/dist/browser/{chunk-LVKKZ4XP.js → chunk-FJCQ4PVG.js} +2 -2
- package/dist/browser/{chunk-23IEROGQ.js → chunk-GOYSEJKF.js} +6 -2
- package/dist/browser/chunk-GOYSEJKF.js.map +1 -0
- package/dist/browser/{chunk-GJIRWFLA.js → chunk-H25W66MH.js} +42 -1
- package/dist/browser/chunk-H25W66MH.js.map +1 -0
- package/dist/browser/{chunk-6JAOKGVI.js → chunk-IJ6JK2XW.js} +2 -2
- package/dist/browser/{chunk-O235WSRL.js → chunk-J5T2K5NR.js} +2 -2
- package/dist/browser/{chunk-ORDVOV7E.js → chunk-K7JWBING.js} +2 -2
- package/dist/browser/{chunk-7YZP3GGZ.js → chunk-MB2GJCKB.js} +2 -2
- package/dist/browser/{chunk-MKDICSZ3.js → chunk-OB2NQV77.js} +3 -3
- package/dist/browser/{chunk-6AIK32FI.js → chunk-OMZFF2KR.js} +2 -2
- package/dist/browser/{chunk-LIZBBXUV.js → chunk-PMGHD553.js} +2 -2
- package/dist/browser/{chunk-EMXZKQ32.js → chunk-PO7RAUEO.js} +2 -2
- package/dist/browser/{chunk-NLRXEMHB.js → chunk-UKFZ7AT5.js} +27 -3
- package/dist/browser/chunk-UKFZ7AT5.js.map +1 -0
- package/dist/browser/{chunk-7GCUNMAO.js → chunk-YQ2VLQAY.js} +2 -2
- package/dist/browser/overlays/blocking-loader/define.js +3 -3
- package/dist/browser/overlays/context-menu/define.js +5 -5
- package/dist/browser/overlays/drawer/define.js +4 -4
- package/dist/browser/overlays/dropdown/define.js +5 -5
- package/dist/browser/overlays/emergency-dialog/define.js +4 -4
- package/dist/browser/overlays/floating/define.js +2 -2
- package/dist/browser/overlays/modal/define.js +4 -4
- package/dist/browser/overlays/notification-banner/define.js +3 -3
- package/dist/browser/overlays/popover/define.js +4 -4
- package/dist/browser/overlays/snackbar/define.js +3 -3
- package/dist/browser/overlays/tooltip/define.js +4 -4
- package/dist/core/overlay-registry.d.ts +12 -0
- package/dist/core/overlay-registry.js +55 -0
- package/dist/core/overlay-registry.js.map +1 -1
- package/dist/overlays/context-menu/context-menu.element.d.ts +2 -0
- package/dist/overlays/context-menu/context-menu.element.js +4 -0
- package/dist/overlays/context-menu/context-menu.element.js.map +1 -1
- package/dist/overlays/core/a11y-anchored-overlay-element.d.ts +12 -0
- package/dist/overlays/core/a11y-anchored-overlay-element.js +23 -1
- package/dist/overlays/core/a11y-anchored-overlay-element.js.map +1 -1
- package/package.json +1 -1
- package/dist/browser/chunk-23IEROGQ.js.map +0 -1
- package/dist/browser/chunk-GJIRWFLA.js.map +0 -1
- package/dist/browser/chunk-NLRXEMHB.js.map +0 -1
- /package/dist/browser/{chunk-JFZTJO7H.js.map → chunk-2HQKZFJV.js.map} +0 -0
- /package/dist/browser/{chunk-AHF64455.js.map → chunk-2TPJ5MVQ.js.map} +0 -0
- /package/dist/browser/{chunk-D6ES5GYW.js.map → chunk-6BEWDDER.js.map} +0 -0
- /package/dist/browser/{chunk-JTFESZPQ.js.map → chunk-6VUVGT2G.js.map} +0 -0
- /package/dist/browser/{chunk-LVKKZ4XP.js.map → chunk-FJCQ4PVG.js.map} +0 -0
- /package/dist/browser/{chunk-6JAOKGVI.js.map → chunk-IJ6JK2XW.js.map} +0 -0
- /package/dist/browser/{chunk-O235WSRL.js.map → chunk-J5T2K5NR.js.map} +0 -0
- /package/dist/browser/{chunk-ORDVOV7E.js.map → chunk-K7JWBING.js.map} +0 -0
- /package/dist/browser/{chunk-7YZP3GGZ.js.map → chunk-MB2GJCKB.js.map} +0 -0
- /package/dist/browser/{chunk-MKDICSZ3.js.map → chunk-OB2NQV77.js.map} +0 -0
- /package/dist/browser/{chunk-6AIK32FI.js.map → chunk-OMZFF2KR.js.map} +0 -0
- /package/dist/browser/{chunk-LIZBBXUV.js.map → chunk-PMGHD553.js.map} +0 -0
- /package/dist/browser/{chunk-EMXZKQ32.js.map → chunk-PO7RAUEO.js.map} +0 -0
- /package/dist/browser/{chunk-7GCUNMAO.js.map → chunk-YQ2VLQAY.js.map} +0 -0
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ Behavior shared by overlays is described once, in [Common to all overlays](#comm
|
|
|
43
43
|
- [`<a11y-notification-banner>`](#a11y-notification-banner)
|
|
44
44
|
- [`<a11y-popover>`](#a11y-popover)
|
|
45
45
|
- [`<a11y-snackbar>`](#a11y-snackbar)
|
|
46
|
-
- [`<a11y-tooltip>`](#a11y-
|
|
46
|
+
- [`<a11y-tooltip>`](#a11y-tooltip)
|
|
47
47
|
|
|
48
48
|
### Import paths
|
|
49
49
|
|
|
@@ -1713,6 +1713,8 @@ Status colors and the z-index scale, defined on `:root` (in `overlays/core/overl
|
|
|
1713
1713
|
|
|
1714
1714
|
Each status color has a text color drawn on it (`--a11y-color-text-on-<type>`). Every default pair passes WCAG AA (4.5:1): success 5.13:1, info 5.75:1, error 5.62:1, warning 9.00:1. Warning is amber with dark text, since white on it is only 1.97:1. If you change a status color, check its contrast with its text color.
|
|
1715
1715
|
|
|
1716
|
+
Overlays move themselves to `<body>`, so a tooltip opened from inside a modal would render behind it at its own level (320 < 510). Instead, a dropdown, popover, tooltip or context menu opened from inside another overlay (a modal, drawer, emergency dialog, popover or toast region) stacks just above that overlay: its z-index is the parent's plus its `--a11y-z-nested-<name>` offset. That's 513 for a tooltip in a modal, 523 in a drawer and 613 in an emergency dialog, so it stays below a drawer or blocking loader opened on top. Snackbar and notification-banner stay usable while a modal, drawer or emergency dialog is open, so they're shown that many levels above the topmost one instead of behind its backdrop. Under a blocking loader they keep their usual level. Keep the offsets below 10, the gap between modal layers. The parent's z-index is set at runtime as `--a11y-z-parent` on the nested overlay's wrapper (`.a11y-is-nested`), and as `--a11y-z-modal-layer` on `<html>` (`.a11y-modal-layer-open`).
|
|
1717
|
+
|
|
1716
1718
|
<details>
|
|
1717
1719
|
<summary>CSS variables</summary>
|
|
1718
1720
|
|
|
@@ -1749,6 +1751,12 @@ Each status color has a text color drawn on it (`--a11y-color-text-on-<type>`).
|
|
|
1749
1751
|
| `--a11y-z-emergency-dialog` | `610` |
|
|
1750
1752
|
| `--a11y-z-debug-panel` | `700` |
|
|
1751
1753
|
| `--a11y-z-inspector` | `710` |
|
|
1754
|
+
| `--a11y-z-nested-dropdown` | `1` |
|
|
1755
|
+
| `--a11y-z-nested-popover` | `2` |
|
|
1756
|
+
| `--a11y-z-nested-tooltip` | `3` |
|
|
1757
|
+
| `--a11y-z-nested-context-menu` | `4` |
|
|
1758
|
+
| `--a11y-z-nested-snackbar` | `5` |
|
|
1759
|
+
| `--a11y-z-nested-notification-banner` | `6` |
|
|
1752
1760
|
|
|
1753
1761
|
</details>
|
|
1754
1762
|
|
|
@@ -1879,3 +1887,7 @@ The full list of tokens, with their defaults, is in the shipped `dist/a11y.css`
|
|
|
1879
1887
|
## License
|
|
1880
1888
|
|
|
1881
1889
|
MIT — see [`LICENSE.txt`](./LICENSE.txt).
|
|
1890
|
+
|
|
1891
|
+
## Support
|
|
1892
|
+
|
|
1893
|
+
If you find a11y-elements useful, consider supporting its development via [Ko-fi](https://ko-fi.com/loiskouninef)
|
package/dist/a11y.css
CHANGED
|
@@ -926,6 +926,12 @@ a11y-file-input > input:disabled + .a11y-file-input__dropzone .a11y-file-input__
|
|
|
926
926
|
--a11y-z-emergency-dialog: 610;
|
|
927
927
|
--a11y-z-debug-panel: 700;
|
|
928
928
|
--a11y-z-inspector: 710;
|
|
929
|
+
--a11y-z-nested-dropdown: 1;
|
|
930
|
+
--a11y-z-nested-popover: 2;
|
|
931
|
+
--a11y-z-nested-tooltip: 3;
|
|
932
|
+
--a11y-z-nested-context-menu: 4;
|
|
933
|
+
--a11y-z-nested-snackbar: 5;
|
|
934
|
+
--a11y-z-nested-notification-banner: 6;
|
|
929
935
|
}
|
|
930
936
|
|
|
931
937
|
/* src/overlays/core/overlay-runtime.css */
|
|
@@ -1210,6 +1216,9 @@ a11y-emergency-dialog {
|
|
|
1210
1216
|
box-shadow: 0 var(--a11y-popover-shadow-offset-y, 2px) var(--a11y-popover-shadow-blur, 10px) color-mix(in srgb, var(--a11y-popover-color-text, var(--a11y-color-text-default, #111827)), transparent var(--a11y-popover-shadow-fade, 85%));
|
|
1211
1217
|
max-width: var(--a11y-popover-max-width, 320px);
|
|
1212
1218
|
}
|
|
1219
|
+
.a11y-popover-wrapper.a11y-is-nested {
|
|
1220
|
+
z-index: calc(var(--a11y-z-parent) + var(--a11y-z-nested-popover, 2));
|
|
1221
|
+
}
|
|
1213
1222
|
a11y-popover {
|
|
1214
1223
|
display: none;
|
|
1215
1224
|
}
|
|
@@ -1227,6 +1236,9 @@ a11y-popover {
|
|
|
1227
1236
|
font-size: var(--a11y-tooltip-font-size, 0.85rem);
|
|
1228
1237
|
max-width: var(--a11y-tooltip-max-width, 240px);
|
|
1229
1238
|
}
|
|
1239
|
+
.a11y-tooltip-wrapper.a11y-is-nested {
|
|
1240
|
+
z-index: calc(var(--a11y-z-parent) + var(--a11y-z-nested-tooltip, 3));
|
|
1241
|
+
}
|
|
1230
1242
|
a11y-tooltip {
|
|
1231
1243
|
display: none;
|
|
1232
1244
|
}
|
|
@@ -1244,6 +1256,9 @@ a11y-tooltip {
|
|
|
1244
1256
|
box-shadow: 0 var(--a11y-dropdown-shadow-offset-y, 2px) var(--a11y-dropdown-shadow-blur, 10px) color-mix(in srgb, var(--a11y-dropdown-color-text, var(--a11y-color-text-default, #111827)), transparent var(--a11y-dropdown-shadow-fade, 85%));
|
|
1245
1257
|
min-width: var(--a11y-dropdown-min-width, 160px);
|
|
1246
1258
|
}
|
|
1259
|
+
.a11y-dropdown-wrapper.a11y-is-nested {
|
|
1260
|
+
z-index: calc(var(--a11y-z-parent) + var(--a11y-z-nested-dropdown, 1));
|
|
1261
|
+
}
|
|
1247
1262
|
a11y-dropdown {
|
|
1248
1263
|
display: none;
|
|
1249
1264
|
}
|
|
@@ -1261,6 +1276,9 @@ a11y-dropdown {
|
|
|
1261
1276
|
box-shadow: 0 var(--a11y-context-menu-shadow-offset-y, 2px) var(--a11y-context-menu-shadow-blur, 10px) color-mix(in srgb, var(--a11y-context-menu-color-text, var(--a11y-color-text-default, #111827)), transparent var(--a11y-context-menu-shadow-fade, 85%));
|
|
1262
1277
|
min-width: var(--a11y-context-menu-min-width, 160px);
|
|
1263
1278
|
}
|
|
1279
|
+
.a11y-context-menu-wrapper.a11y-is-nested {
|
|
1280
|
+
z-index: calc(var(--a11y-z-parent) + var(--a11y-z-nested-context-menu, 4));
|
|
1281
|
+
}
|
|
1264
1282
|
a11y-context-menu {
|
|
1265
1283
|
display: none;
|
|
1266
1284
|
}
|
|
@@ -1546,6 +1564,9 @@ a11y-floating.a11y-floating--scrolled-away {
|
|
|
1546
1564
|
animation: none;
|
|
1547
1565
|
}
|
|
1548
1566
|
}
|
|
1567
|
+
html.a11y-modal-layer-open .a11y-snackbar-region {
|
|
1568
|
+
z-index: calc(var(--a11y-z-modal-layer) + var(--a11y-z-nested-snackbar, 5));
|
|
1569
|
+
}
|
|
1549
1570
|
|
|
1550
1571
|
/* src/overlays/notification-banner/notification-banner.css */
|
|
1551
1572
|
.a11y-notification-banner-region__top,
|
|
@@ -1627,5 +1648,8 @@ a11y-floating.a11y-floating--scrolled-away {
|
|
|
1627
1648
|
animation: none;
|
|
1628
1649
|
}
|
|
1629
1650
|
}
|
|
1651
|
+
html.a11y-modal-layer-open .a11y-notification-banner-region {
|
|
1652
|
+
z-index: calc(var(--a11y-z-modal-layer) + var(--a11y-z-nested-notification-banner, 6));
|
|
1653
|
+
}
|
|
1630
1654
|
|
|
1631
1655
|
/* src/a11y.css */
|
package/dist/browser/all.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FloatingElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FJCQ4PVG.js";
|
|
4
4
|
import {
|
|
5
5
|
ModalElement,
|
|
6
6
|
confirmDialog
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-2HQKZFJV.js";
|
|
8
8
|
import {
|
|
9
9
|
NotificationBannerElement,
|
|
10
10
|
showNotificationBanner
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-PO7RAUEO.js";
|
|
12
12
|
import {
|
|
13
13
|
PopoverElement
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MB2GJCKB.js";
|
|
15
15
|
import {
|
|
16
16
|
SnackbarElement,
|
|
17
17
|
notify
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-OMZFF2KR.js";
|
|
19
|
+
import "./chunk-YQ2VLQAY.js";
|
|
20
20
|
import {
|
|
21
21
|
TooltipElement
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-PMGHD553.js";
|
|
23
23
|
import {
|
|
24
24
|
TabsElement
|
|
25
25
|
} from "./chunk-4V5TTMP4.js";
|
|
@@ -31,29 +31,29 @@ import {
|
|
|
31
31
|
} from "./chunk-SRWD5UK6.js";
|
|
32
32
|
import {
|
|
33
33
|
BlockingLoaderElement
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-OB2NQV77.js";
|
|
35
35
|
import {
|
|
36
36
|
ContextMenuElement
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-GOYSEJKF.js";
|
|
38
38
|
import {
|
|
39
39
|
DrawerElement
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-6BEWDDER.js";
|
|
41
41
|
import {
|
|
42
42
|
DropdownElement
|
|
43
|
-
} from "./chunk-
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import "./chunk-
|
|
43
|
+
} from "./chunk-K7JWBING.js";
|
|
44
|
+
import "./chunk-J5T2K5NR.js";
|
|
45
|
+
import "./chunk-UKFZ7AT5.js";
|
|
46
46
|
import {
|
|
47
47
|
EmergencyDialogElement
|
|
48
|
-
} from "./chunk-
|
|
49
|
-
import "./chunk-
|
|
48
|
+
} from "./chunk-2TPJ5MVQ.js";
|
|
49
|
+
import "./chunk-6VUVGT2G.js";
|
|
50
50
|
import "./chunk-MNWKDM3I.js";
|
|
51
|
-
import "./chunk-
|
|
51
|
+
import "./chunk-IJ6JK2XW.js";
|
|
52
52
|
import "./chunk-FNILKXCO.js";
|
|
53
53
|
import {
|
|
54
54
|
dismissAllOverlays,
|
|
55
55
|
removeOverlaysWithin
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-H25W66MH.js";
|
|
57
57
|
import {
|
|
58
58
|
LabelElement
|
|
59
59
|
} from "./chunk-WDPW7UKG.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
A11yModalOverlayElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6VUVGT2G.js";
|
|
4
4
|
import {
|
|
5
5
|
appendContent,
|
|
6
6
|
h
|
|
@@ -88,4 +88,4 @@ export {
|
|
|
88
88
|
ModalElement,
|
|
89
89
|
confirmDialog
|
|
90
90
|
};
|
|
91
|
-
//# sourceMappingURL=chunk-
|
|
91
|
+
//# sourceMappingURL=chunk-2HQKZFJV.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
A11yModalOverlayElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6VUVGT2G.js";
|
|
4
4
|
import {
|
|
5
5
|
defineElement
|
|
6
6
|
} from "./chunk-ED3UMYMY.js";
|
|
@@ -33,4 +33,4 @@ defineElement("a11y-emergency-dialog", EmergencyDialogElement);
|
|
|
33
33
|
export {
|
|
34
34
|
EmergencyDialogElement
|
|
35
35
|
};
|
|
36
|
-
//# sourceMappingURL=chunk-
|
|
36
|
+
//# sourceMappingURL=chunk-2TPJ5MVQ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
A11yModalOverlayElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6VUVGT2G.js";
|
|
4
4
|
import {
|
|
5
5
|
defineElement
|
|
6
6
|
} from "./chunk-ED3UMYMY.js";
|
|
@@ -47,4 +47,4 @@ defineElement("a11y-drawer", DrawerElement);
|
|
|
47
47
|
export {
|
|
48
48
|
DrawerElement
|
|
49
49
|
};
|
|
50
|
-
//# sourceMappingURL=chunk-
|
|
50
|
+
//# sourceMappingURL=chunk-6BEWDDER.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-MNWKDM3I.js";
|
|
4
4
|
import {
|
|
5
5
|
A11yOverlayElement
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-IJ6JK2XW.js";
|
|
7
7
|
import {
|
|
8
8
|
FocusTrapHelper
|
|
9
9
|
} from "./chunk-FNILKXCO.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
inertOutside,
|
|
12
12
|
lockScroll,
|
|
13
13
|
unlockScroll
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-H25W66MH.js";
|
|
15
15
|
import {
|
|
16
16
|
nextId
|
|
17
17
|
} from "./chunk-Q4TMA3P7.js";
|
|
@@ -209,4 +209,4 @@ var A11yModalOverlayElement = class extends A11yOverlayElement {
|
|
|
209
209
|
export {
|
|
210
210
|
A11yModalOverlayElement
|
|
211
211
|
};
|
|
212
|
-
//# sourceMappingURL=chunk-
|
|
212
|
+
//# sourceMappingURL=chunk-6VUVGT2G.js.map
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
recordPortalOrigin,
|
|
12
12
|
registerOpenOverlay,
|
|
13
13
|
unregisterOpenOverlay
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-H25W66MH.js";
|
|
15
15
|
import {
|
|
16
16
|
nextId
|
|
17
17
|
} from "./chunk-Q4TMA3P7.js";
|
|
@@ -547,4 +547,4 @@ defineElement("a11y-floating", FloatingElement);
|
|
|
547
547
|
export {
|
|
548
548
|
FloatingElement
|
|
549
549
|
};
|
|
550
|
-
//# sourceMappingURL=chunk-
|
|
550
|
+
//# sourceMappingURL=chunk-FJCQ4PVG.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
A11yMenuOverlayElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-J5T2K5NR.js";
|
|
4
4
|
import {
|
|
5
5
|
defineElement,
|
|
6
6
|
doc
|
|
@@ -40,6 +40,10 @@ var ContextMenuElement = class extends A11yMenuOverlayElement {
|
|
|
40
40
|
super.onAttributeChanged(name);
|
|
41
41
|
if (name === "trigger") this._bindTrigger();
|
|
42
42
|
}
|
|
43
|
+
/** Anchored to a point, not an element: its trigger is what it was opened from. */
|
|
44
|
+
nestingTarget() {
|
|
45
|
+
return this.triggerElement ?? super.nestingTarget();
|
|
46
|
+
}
|
|
43
47
|
createWrapper() {
|
|
44
48
|
const el = super.createWrapper();
|
|
45
49
|
el.classList.add("a11y-context-menu-wrapper");
|
|
@@ -74,4 +78,4 @@ defineElement("a11y-context-menu", ContextMenuElement);
|
|
|
74
78
|
export {
|
|
75
79
|
ContextMenuElement
|
|
76
80
|
};
|
|
77
|
-
//# sourceMappingURL=chunk-
|
|
81
|
+
//# sourceMappingURL=chunk-GOYSEJKF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/overlays/context-menu/context-menu.element.ts","../../src/overlays/context-menu/define.ts"],"sourcesContent":["import { A11yMenuOverlayElement } from '../core/a11y-menu-overlay-element.js';\nimport { doc } from '../../core/safe-dom.js';\n\n/**\n * A menu that opens at the mouse position on right-click (`contextmenu`) of\n * a trigger element, replacing the browser's native context menu there.\n *\n * ```html\n * <div id=\"canvas\">Right-click me</div>\n * <a11y-context-menu trigger=\"canvas\">\n * <div role=\"menuitem\">Copy</div>\n * <div role=\"menuitem\">Paste</div>\n * </a11y-context-menu>\n * ```\n */\nexport class ContextMenuElement extends A11yMenuOverlayElement {\n static override get observedAttributes(): string[] {\n return [...super.observedAttributes, 'trigger'];\n }\n\n private _triggerEl: HTMLElement | null = null;\n private _boundTriggerEl: HTMLElement | null = null;\n private _boundContextMenu = (e: MouseEvent): void => {\n e.preventDefault();\n this.setAnchorPoint(e.clientX, e.clientY);\n // Re-right-clicking while already open repositions in place rather than\n // no-op'ing (the `open` attribute wouldn't change, so attributeChangedCallback\n // wouldn't fire) — _show() itself already guards on an existing wrapper.\n if (this.open) this._show();\n else this.open = true;\n };\n\n /** The element whose `contextmenu` event opens this menu: an explicit `.triggerElement` property, or the `trigger=\"<id>\"` attribute. */\n get triggerElement(): HTMLElement | null {\n if (this._triggerEl) return this._triggerEl;\n const id = this.getAttribute('trigger');\n return id ? doc.getElementById(id) : null;\n }\n\n set triggerElement(el: HTMLElement | null) {\n this._triggerEl = el;\n this._bindTrigger();\n }\n\n protected override onConnect(): void {\n this._bindTrigger();\n // Trigger not parsed yet (menu authored before it, define script loaded synchronously).\n if (!this._boundTriggerEl) this.afterParse(() => this._bindTrigger());\n }\n\n protected override onDisconnect(): void {\n this._unbindTrigger();\n }\n\n protected override onAttributeChanged(name: string): void {\n super.onAttributeChanged(name);\n if (name === 'trigger') this._bindTrigger();\n }\n\n /** Anchored to a point, not an element: its trigger is what it was opened from. */\n protected override nestingTarget(): Node | null {\n return this.triggerElement ?? super.nestingTarget();\n }\n\n protected override createWrapper(): HTMLElement {\n const el = super.createWrapper();\n el.classList.add('a11y-context-menu-wrapper');\n return el;\n }\n\n protected override getContentClass(): string {\n return 'a11y-context-menu-content';\n }\n\n /** Detaches from the trigger entirely (unlike `close()`, which just hides the current menu — it can still reopen on the next right-click). */\n dispose(): void {\n this._unbindTrigger();\n this.close();\n }\n\n private _bindTrigger(): void {\n const trigger = this.triggerElement;\n if (this._boundTriggerEl === trigger) return;\n this._unbindTrigger();\n if (!trigger) return;\n trigger.addEventListener('contextmenu', this._boundContextMenu);\n this._boundTriggerEl = trigger;\n }\n\n private _unbindTrigger(): void {\n if (!this._boundTriggerEl) return;\n this._boundTriggerEl.removeEventListener('contextmenu', this._boundContextMenu);\n this._boundTriggerEl = null;\n }\n}\n","import { defineElement } from '../../core/define-element.js';\nimport { ContextMenuElement } from './context-menu.element.js';\n\ndefineElement('a11y-context-menu', ContextMenuElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'a11y-context-menu': ContextMenuElement;\n }\n}\n\nexport { ContextMenuElement };\nexport * from '../core/zero-build-exports.js';\n"],"mappings":";;;;;;;;;AAeO,IAAM,qBAAN,cAAiC,uBAAuB;AAAA,EAC7D,WAAoB,qBAA+B;AACjD,WAAO,CAAC,GAAG,MAAM,oBAAoB,SAAS;AAAA,EAChD;AAAA,EAEQ,aAAiC;AAAA,EACjC,kBAAsC;AAAA,EACtC,oBAAoB,CAAC,MAAwB;AACnD,MAAE,eAAe;AACjB,SAAK,eAAe,EAAE,SAAS,EAAE,OAAO;AAIxC,QAAI,KAAK,KAAM,MAAK,MAAM;AAAA,QACrB,MAAK,OAAO;AAAA,EACnB;AAAA;AAAA,EAGA,IAAI,iBAAqC;AACvC,QAAI,KAAK,WAAY,QAAO,KAAK;AACjC,UAAM,KAAK,KAAK,aAAa,SAAS;AACtC,WAAO,KAAK,IAAI,eAAe,EAAE,IAAI;AAAA,EACvC;AAAA,EAEA,IAAI,eAAe,IAAwB;AACzC,SAAK,aAAa;AAClB,SAAK,aAAa;AAAA,EACpB;AAAA,EAEmB,YAAkB;AACnC,SAAK,aAAa;AAElB,QAAI,CAAC,KAAK,gBAAiB,MAAK,WAAW,MAAM,KAAK,aAAa,CAAC;AAAA,EACtE;AAAA,EAEmB,eAAqB;AACtC,SAAK,eAAe;AAAA,EACtB;AAAA,EAEmB,mBAAmB,MAAoB;AACxD,UAAM,mBAAmB,IAAI;AAC7B,QAAI,SAAS,UAAW,MAAK,aAAa;AAAA,EAC5C;AAAA;AAAA,EAGmB,gBAA6B;AAC9C,WAAO,KAAK,kBAAkB,MAAM,cAAc;AAAA,EACpD;AAAA,EAEmB,gBAA6B;AAC9C,UAAM,KAAK,MAAM,cAAc;AAC/B,OAAG,UAAU,IAAI,2BAA2B;AAC5C,WAAO;AAAA,EACT;AAAA,EAEmB,kBAA0B;AAC3C,WAAO;AAAA,EACT;AAAA;AAAA,EAGA,UAAgB;AACd,SAAK,eAAe;AACpB,SAAK,MAAM;AAAA,EACb;AAAA,EAEQ,eAAqB;AAC3B,UAAM,UAAU,KAAK;AACrB,QAAI,KAAK,oBAAoB,QAAS;AACtC,SAAK,eAAe;AACpB,QAAI,CAAC,QAAS;AACd,YAAQ,iBAAiB,eAAe,KAAK,iBAAiB;AAC9D,SAAK,kBAAkB;AAAA,EACzB;AAAA,EAEQ,iBAAuB;AAC7B,QAAI,CAAC,KAAK,gBAAiB;AAC3B,SAAK,gBAAgB,oBAAoB,eAAe,KAAK,iBAAiB;AAC9E,SAAK,kBAAkB;AAAA,EACzB;AACF;;;AC3FA,cAAc,qBAAqB,kBAAkB;","names":[]}
|
|
@@ -46,6 +46,30 @@ function dismissAllOverlays() {
|
|
|
46
46
|
function recordPortalOrigin(overlay, origin) {
|
|
47
47
|
state.portalOrigins.set(overlay, origin);
|
|
48
48
|
}
|
|
49
|
+
function getPortalOrigin(overlay) {
|
|
50
|
+
return state.portalOrigins.get(overlay) ?? null;
|
|
51
|
+
}
|
|
52
|
+
var PASSIVE_REGION_CLASS = "a11y-passive-overlay-region";
|
|
53
|
+
function findOverlayChromeRoot(target, except) {
|
|
54
|
+
const body = doc.body;
|
|
55
|
+
let overlay = null;
|
|
56
|
+
for (let node = target; node; node = prop(node, "parentNode") ?? node.host ?? null) {
|
|
57
|
+
if (node === body) return null;
|
|
58
|
+
if (node instanceof Element && node !== except && (state.openOverlays.has(node) || node.classList.contains(PASSIVE_REGION_CLASS))) {
|
|
59
|
+
overlay = node;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
for (let node = overlay; node; node = prop(node, "parentNode") ?? node.host ?? null) {
|
|
64
|
+
const parent = prop(node, "parentNode");
|
|
65
|
+
if (parent === body) return node;
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
function computedZIndex(el) {
|
|
70
|
+
const z = Number.parseInt(getComputedStyle(el).zIndex, 10);
|
|
71
|
+
return Number.isFinite(z) ? z : null;
|
|
72
|
+
}
|
|
49
73
|
function forgetPortalOrigin(overlay) {
|
|
50
74
|
state.portalOrigins.delete(overlay);
|
|
51
75
|
}
|
|
@@ -82,8 +106,11 @@ function inertOutside(keep, exempt) {
|
|
|
82
106
|
function releaseInert(el) {
|
|
83
107
|
if (state.inertedByLib.delete(el)) el.removeAttribute("inert");
|
|
84
108
|
}
|
|
109
|
+
var MODAL_LAYER_CLASS = "a11y-modal-layer-open";
|
|
110
|
+
var MODAL_LAYER_Z = "--a11y-z-modal-layer";
|
|
85
111
|
function syncInert() {
|
|
86
112
|
const top = state.inertLayers[state.inertLayers.length - 1];
|
|
113
|
+
syncModalLayer(top);
|
|
87
114
|
const wanted = /* @__PURE__ */ new Set();
|
|
88
115
|
if (top) {
|
|
89
116
|
for (const child of Array.from(doc.body.children)) {
|
|
@@ -100,6 +127,17 @@ function syncInert() {
|
|
|
100
127
|
state.inertedByLib.add(el);
|
|
101
128
|
}
|
|
102
129
|
}
|
|
130
|
+
function syncModalLayer(top) {
|
|
131
|
+
const root = doc.documentElement;
|
|
132
|
+
const z = top?.exempt ? computedZIndex(top.keep) : null;
|
|
133
|
+
if (z === null) {
|
|
134
|
+
root.classList.remove(MODAL_LAYER_CLASS);
|
|
135
|
+
root.style.removeProperty(MODAL_LAYER_Z);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
root.style.setProperty(MODAL_LAYER_Z, String(z));
|
|
139
|
+
root.classList.add(MODAL_LAYER_CLASS);
|
|
140
|
+
}
|
|
103
141
|
var NO_SCROLL_CLASS = "a11y-no-scroll";
|
|
104
142
|
var GUTTER_CLASS = "a11y-no-scroll--gutter";
|
|
105
143
|
function lockScroll() {
|
|
@@ -135,6 +173,9 @@ export {
|
|
|
135
173
|
isInsideOverlayOpenedAfter,
|
|
136
174
|
dismissAllOverlays,
|
|
137
175
|
recordPortalOrigin,
|
|
176
|
+
getPortalOrigin,
|
|
177
|
+
findOverlayChromeRoot,
|
|
178
|
+
computedZIndex,
|
|
138
179
|
forgetPortalOrigin,
|
|
139
180
|
removeOverlaysWithin,
|
|
140
181
|
inertOutside,
|
|
@@ -144,4 +185,4 @@ export {
|
|
|
144
185
|
emitOverlayOpen,
|
|
145
186
|
emitOverlayClose
|
|
146
187
|
};
|
|
147
|
-
//# sourceMappingURL=chunk-
|
|
188
|
+
//# sourceMappingURL=chunk-H25W66MH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/overlay-registry.ts"],"sourcesContent":["import { doc, prop } from './safe-dom.js';\n\n/**\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 /** Open modal layers (`inertOutside()` calls), bottom to top: only the top one decides what's inert. */\n inertLayers: InertLayer[];\n /** Elements whose `inert` attribute this library set — the only ones it ever removes it from. */\n inertedByLib: Set<Element>;\n}\n\ninterface InertLayer {\n keep: Element;\n exempt?: (el: Element) => boolean;\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] ??= {\n openOverlays: new Set(),\n scrollLocks: 0,\n portalOrigins: new Map(),\n inertLayers: [],\n inertedByLib: new Set(),\n});\n// A state object created by an older bundle on the same page predates these fields.\nstate.portalOrigins ??= new Map();\nstate.inertLayers ??= [];\nstate.inertedByLib ??= new Set();\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\n/** Open overlays registered after `overlay` (the set keeps opening order). */\nfunction openedAfter(overlay: Dismissible): Dismissible[] {\n const open = Array.from(state.openOverlays);\n const index = open.indexOf(overlay);\n return index === -1 ? [] : open.slice(index + 1);\n}\n\n/**\n * Whether another overlay was opened after `overlay` and is still open — so\n * a key press like Escape belongs to that one, the topmost, not to `overlay`.\n */\nexport function hasOverlayOpenedAfter(overlay: Dismissible): boolean {\n return openedAfter(overlay).length > 0;\n}\n\n/**\n * Whether `target` is inside an overlay opened after `overlay` (a dropdown in\n * a popover, a modal opened from it…). That overlay lives in its own chrome\n * on `<body>`, so a click in it is outside `overlay`'s DOM but not outside it\n * as far as the user is concerned.\n */\nexport function isInsideOverlayOpenedAfter(overlay: Dismissible, target: Node | null): boolean {\n const later = new Set<unknown>(openedAfter(overlay));\n if (later.size === 0) return false;\n for (let node: Node | null = target; node; node = prop(node, 'parentNode') ?? (node as ShadowRoot).host ?? null) {\n if (later.has(node)) return true;\n }\n return false;\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/** Where `overlay` was authored before it moved itself to `<body>`, if it did. */\nexport function getPortalOrigin(overlay: Element): Node | null {\n return state.portalOrigins.get(overlay) ?? null;\n}\n\nconst PASSIVE_REGION_CLASS = 'a11y-passive-overlay-region';\n\n/**\n * The stacking root (the direct child of `<body>`: a modal's backdrop, an\n * anchored overlay's wrapper, a snackbar region…) of the nearest overlay that\n * `target` sits inside — an open overlay other than `except`, or a passive\n * region. `null` when `target` isn't inside one. Overlays opened from inside\n * another one stack themselves just above this root's z-index.\n */\nexport function findOverlayChromeRoot(target: Node | null, except?: unknown): HTMLElement | null {\n const body = doc.body;\n let overlay: Element | null = null;\n for (let node: Node | null = target; node; node = prop(node, 'parentNode') ?? (node as ShadowRoot).host ?? null) {\n if (node === body) return null;\n if (node instanceof Element && node !== except && (state.openOverlays.has(node as unknown as Dismissible) || node.classList.contains(PASSIVE_REGION_CLASS))) {\n overlay = node;\n break;\n }\n }\n for (let node: Node | null = overlay; node; node = prop(node, 'parentNode') ?? (node as ShadowRoot).host ?? null) {\n const parent: Node | null = prop(node, 'parentNode');\n if (parent === body) return node as HTMLElement;\n }\n return null;\n}\n\n/** An element's computed z-index as a number, or `null` when it's `auto` (or not set). */\nexport function computedZIndex(el: Element): number | null {\n const z = Number.parseInt(getComputedStyle(el).zIndex, 10);\n return Number.isFinite(z) ? z : null;\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 // An overlay authored inside another one (a tooltip in a modal) records that overlay as its\n // origin, which sits in <body>, not in `host`: keep going until no removed root contains one.\n const roots: Node[] = [host];\n let removed = 0;\n let found = true;\n while (found) {\n found = false;\n for (const [overlay, origin] of Array.from(state.portalOrigins)) {\n if (!roots.some((root) => root.contains(origin))) continue;\n overlay.remove(); // its disconnectedCallback tears it down and forgets it\n state.portalOrigins.delete(overlay);\n roots.push(overlay);\n removed++;\n found = true;\n }\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.\n *\n * Calls stack: each pushes a layer, and only the topmost open layer decides\n * what's inert, so closing a lower modal (or a modal under a blocking loader)\n * first leaves the page behind the top one inert. `inert` the consumer set\n * themselves is never removed. Returns a function that pops this layer.\n */\nexport function inertOutside(keep: Element, exempt?: (el: Element) => boolean): () => void {\n const layer: InertLayer = { keep, exempt };\n state.inertLayers.push(layer);\n syncInert();\n let released = false;\n return () => {\n if (released) return;\n released = true;\n const index = state.inertLayers.indexOf(layer);\n if (index !== -1) state.inertLayers.splice(index, 1);\n syncInert();\n };\n}\n\n/**\n * Removes the `inert` this library put on `el`, if any. Overlays call it as\n * they move into their open chrome: a closed overlay sits in `<body>`, so a\n * modal opened before it inerted it, and it would stay unusable when opened\n * from inside that modal.\n */\nexport function releaseInert(el: Element): void {\n if (state.inertedByLib.delete(el)) el.removeAttribute('inert');\n}\n\nconst MODAL_LAYER_CLASS = 'a11y-modal-layer-open';\nconst MODAL_LAYER_Z = '--a11y-z-modal-layer';\n\nfunction syncInert(): void {\n const top = state.inertLayers[state.inertLayers.length - 1];\n syncModalLayer(top);\n const wanted = new Set<Element>();\n if (top) {\n for (const child of Array.from(doc.body.children)) {\n if (child === top.keep || child.contains(top.keep) || top.exempt?.(child)) continue;\n wanted.add(child);\n }\n }\n for (const el of Array.from(state.inertedByLib)) {\n if (!wanted.has(el)) releaseInert(el);\n }\n for (const el of wanted) {\n if (el.hasAttribute('inert')) continue; // already inert, by us or by the consumer\n el.setAttribute('inert', '');\n state.inertedByLib.add(el);\n }\n}\n\n/**\n * While the topmost modal layer keeps passive regions (snackbar,\n * notification-banner) usable, exposes its z-index on `<html>` so their CSS\n * can stack them just above it instead of behind its backdrop. A layer that\n * inerts them too (a blocking loader) keeps them at their usual level.\n */\nfunction syncModalLayer(top: InertLayer | undefined): void {\n const root = doc.documentElement;\n const z = top?.exempt ? computedZIndex(top.keep) : null;\n if (z === null) {\n root.classList.remove(MODAL_LAYER_CLASS);\n root.style.removeProperty(MODAL_LAYER_Z);\n return;\n }\n root.style.setProperty(MODAL_LAYER_Z, String(z));\n root.classList.add(MODAL_LAYER_CLASS);\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 = doc.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) doc.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":";;;;;;AAkCO,IAAM,qBAAqB;AAC3B,IAAM,sBAAsB;AA6BnC,IAAM,YAAY,uBAAO,IAAI,6BAA6B;AAC1D,IAAM,QAAQ;AACd,IAAM,QAAsB,MAAM,SAAS,MAAM;AAAA,EAC/C,cAAc,oBAAI,IAAI;AAAA,EACtB,aAAa;AAAA,EACb,eAAe,oBAAI,IAAI;AAAA,EACvB,aAAa,CAAC;AAAA,EACd,cAAc,oBAAI,IAAI;AACxB;AAEA,MAAM,kBAAkB,oBAAI,IAAI;AAChC,MAAM,gBAAgB,CAAC;AACvB,MAAM,iBAAiB,oBAAI,IAAI;AAWxB,SAAS,oBAAoB,SAA4B;AAC9D,QAAM,aAAa,IAAI,OAAO;AAChC;AAEO,SAAS,sBAAsB,SAA4B;AAChE,QAAM,aAAa,OAAO,OAAO;AACnC;AAGA,SAAS,YAAY,SAAqC;AACxD,QAAM,OAAO,MAAM,KAAK,MAAM,YAAY;AAC1C,QAAM,QAAQ,KAAK,QAAQ,OAAO;AAClC,SAAO,UAAU,KAAK,CAAC,IAAI,KAAK,MAAM,QAAQ,CAAC;AACjD;AAMO,SAAS,sBAAsB,SAA+B;AACnE,SAAO,YAAY,OAAO,EAAE,SAAS;AACvC;AAQO,SAAS,2BAA2B,SAAsB,QAA8B;AAC7F,QAAM,QAAQ,IAAI,IAAa,YAAY,OAAO,CAAC;AACnD,MAAI,MAAM,SAAS,EAAG,QAAO;AAC7B,WAAS,OAAoB,QAAQ,MAAM,OAAO,KAAK,MAAM,YAAY,KAAM,KAAoB,QAAQ,MAAM;AAC/G,QAAI,MAAM,IAAI,IAAI,EAAG,QAAO;AAAA,EAC9B;AACA,SAAO;AACT;AAEO,SAAS,qBAA2B;AACzC,aAAW,WAAW,MAAM,KAAK,MAAM,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
12
12
|
doc
|
|
@@ -137,4 +137,4 @@ var A11yOverlayElement = class extends A11yElement {
|
|
|
137
137
|
export {
|
|
138
138
|
A11yOverlayElement
|
|
139
139
|
};
|
|
140
|
-
//# sourceMappingURL=chunk-
|
|
140
|
+
//# sourceMappingURL=chunk-IJ6JK2XW.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
A11yAnchoredOverlayElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UKFZ7AT5.js";
|
|
4
4
|
import {
|
|
5
5
|
focusFromKeyboard,
|
|
6
6
|
focusReturnTarget,
|
|
@@ -150,4 +150,4 @@ var A11yMenuOverlayElement = class extends A11yAnchoredOverlayElement {
|
|
|
150
150
|
export {
|
|
151
151
|
A11yMenuOverlayElement
|
|
152
152
|
};
|
|
153
|
-
//# sourceMappingURL=chunk-
|
|
153
|
+
//# sourceMappingURL=chunk-J5T2K5NR.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
A11yMenuOverlayElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-J5T2K5NR.js";
|
|
4
4
|
import {
|
|
5
5
|
nextId
|
|
6
6
|
} from "./chunk-Q4TMA3P7.js";
|
|
@@ -89,4 +89,4 @@ defineElement("a11y-dropdown", DropdownElement);
|
|
|
89
89
|
export {
|
|
90
90
|
DropdownElement
|
|
91
91
|
};
|
|
92
|
-
//# sourceMappingURL=chunk-
|
|
92
|
+
//# sourceMappingURL=chunk-K7JWBING.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
A11yAnchoredOverlayElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UKFZ7AT5.js";
|
|
4
4
|
import {
|
|
5
5
|
nextId
|
|
6
6
|
} from "./chunk-Q4TMA3P7.js";
|
|
@@ -62,4 +62,4 @@ defineElement("a11y-popover", PopoverElement);
|
|
|
62
62
|
export {
|
|
63
63
|
PopoverElement
|
|
64
64
|
};
|
|
65
|
-
//# sourceMappingURL=chunk-
|
|
65
|
+
//# sourceMappingURL=chunk-MB2GJCKB.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
A11yOverlayElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IJ6JK2XW.js";
|
|
4
4
|
import {
|
|
5
5
|
focusReturnTarget
|
|
6
6
|
} from "./chunk-FNILKXCO.js";
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
inertOutside,
|
|
9
9
|
lockScroll,
|
|
10
10
|
unlockScroll
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-H25W66MH.js";
|
|
12
12
|
import {
|
|
13
13
|
h
|
|
14
14
|
} from "./chunk-KVUJT6BC.js";
|
|
@@ -74,4 +74,4 @@ defineElement("a11y-blocking-loader", BlockingLoaderElement);
|
|
|
74
74
|
export {
|
|
75
75
|
BlockingLoaderElement
|
|
76
76
|
};
|
|
77
|
-
//# sourceMappingURL=chunk-
|
|
77
|
+
//# sourceMappingURL=chunk-OB2NQV77.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
A11yPassiveOverlayElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YQ2VLQAY.js";
|
|
4
4
|
import {
|
|
5
5
|
h
|
|
6
6
|
} from "./chunk-KVUJT6BC.js";
|
|
@@ -112,4 +112,4 @@ export {
|
|
|
112
112
|
SnackbarElement,
|
|
113
113
|
notify
|
|
114
114
|
};
|
|
115
|
-
//# sourceMappingURL=chunk-
|
|
115
|
+
//# sourceMappingURL=chunk-OMZFF2KR.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
A11yAnchoredOverlayElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UKFZ7AT5.js";
|
|
4
4
|
import {
|
|
5
5
|
nextId
|
|
6
6
|
} from "./chunk-Q4TMA3P7.js";
|
|
@@ -121,4 +121,4 @@ defineElement("a11y-tooltip", TooltipElement);
|
|
|
121
121
|
export {
|
|
122
122
|
TooltipElement
|
|
123
123
|
};
|
|
124
|
-
//# sourceMappingURL=chunk-
|
|
124
|
+
//# sourceMappingURL=chunk-PMGHD553.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
A11yPassiveOverlayElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YQ2VLQAY.js";
|
|
4
4
|
import {
|
|
5
5
|
h
|
|
6
6
|
} from "./chunk-KVUJT6BC.js";
|
|
@@ -126,4 +126,4 @@ export {
|
|
|
126
126
|
NotificationBannerElement,
|
|
127
127
|
showNotificationBanner
|
|
128
128
|
};
|
|
129
|
-
//# sourceMappingURL=chunk-
|
|
129
|
+
//# sourceMappingURL=chunk-PO7RAUEO.js.map
|
|
@@ -3,14 +3,17 @@ import {
|
|
|
3
3
|
} from "./chunk-MNWKDM3I.js";
|
|
4
4
|
import {
|
|
5
5
|
A11yOverlayElement
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-IJ6JK2XW.js";
|
|
7
7
|
import {
|
|
8
8
|
FocusTrapHelper
|
|
9
9
|
} from "./chunk-FNILKXCO.js";
|
|
10
10
|
import {
|
|
11
|
+
computedZIndex,
|
|
12
|
+
findOverlayChromeRoot,
|
|
13
|
+
getPortalOrigin,
|
|
11
14
|
hasOverlayOpenedAfter,
|
|
12
15
|
isInsideOverlayOpenedAfter
|
|
13
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-H25W66MH.js";
|
|
14
17
|
import {
|
|
15
18
|
doc
|
|
16
19
|
} from "./chunk-ED3UMYMY.js";
|
|
@@ -77,10 +80,31 @@ var A11yAnchoredOverlayElement = class extends A11yOverlayElement {
|
|
|
77
80
|
getContentClass() {
|
|
78
81
|
return "a11y-anchored-overlay-content";
|
|
79
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* What this overlay was opened from, to tell whether it's nested in another
|
|
85
|
+
* overlay (a tooltip in a modal): the anchor, else where it was authored.
|
|
86
|
+
*/
|
|
87
|
+
nestingTarget() {
|
|
88
|
+
return this.anchorElement ?? getPortalOrigin(this);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* It lives on `<body>`, so its own z-index (tooltip 320…) would put it
|
|
92
|
+
* behind the overlay it was opened from (modal 510…). Nested, it records
|
|
93
|
+
* that overlay's z-index as `--a11y-z-parent`, and its CSS stacks it
|
|
94
|
+
* `--a11y-z-nested-<name>` above that.
|
|
95
|
+
*/
|
|
96
|
+
_markNesting(wrapper) {
|
|
97
|
+
const root = findOverlayChromeRoot(this.nestingTarget(), this);
|
|
98
|
+
const z = root && root !== wrapper ? computedZIndex(root) : null;
|
|
99
|
+
if (z === null) return;
|
|
100
|
+
wrapper.classList.add("a11y-is-nested");
|
|
101
|
+
wrapper.style.setProperty("--a11y-z-parent", String(z));
|
|
102
|
+
}
|
|
80
103
|
_show() {
|
|
81
104
|
this._flushPendingHide();
|
|
82
105
|
if (this._wrapper) this._teardownChrome();
|
|
83
106
|
const wrapper = this.createWrapper();
|
|
107
|
+
this._markNesting(wrapper);
|
|
84
108
|
doc.body.appendChild(wrapper);
|
|
85
109
|
this.classList.add(this.getContentClass());
|
|
86
110
|
this._moveSelfTo(wrapper);
|
|
@@ -261,4 +285,4 @@ var A11yAnchoredOverlayElement = class extends A11yOverlayElement {
|
|
|
261
285
|
export {
|
|
262
286
|
A11yAnchoredOverlayElement
|
|
263
287
|
};
|
|
264
|
-
//# sourceMappingURL=chunk-
|
|
288
|
+
//# sourceMappingURL=chunk-UKFZ7AT5.js.map
|