a11y-elements 1.0.2 → 1.1.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 +48 -6
- package/dist/a11y.css +42 -9
- package/dist/browser/all.js +16 -16
- package/dist/browser/{chunk-K7JWBING.js → chunk-2X4DBANG.js} +2 -2
- package/dist/browser/{chunk-MB2GJCKB.js → chunk-3AHPI6C5.js} +2 -2
- package/dist/browser/{chunk-OB2NQV77.js → chunk-3QCORK3F.js} +2 -2
- package/dist/browser/{chunk-7CL7TH7I.js → chunk-4ER4RFUO.js} +2 -2
- package/dist/browser/{chunk-MIBUA46B.js → chunk-6HI2FNGK.js} +2 -2
- package/dist/browser/{chunk-KVUJT6BC.js → chunk-7FIT24VV.js} +56 -7
- package/dist/browser/chunk-7FIT24VV.js.map +1 -0
- package/dist/browser/{chunk-GOYSEJKF.js → chunk-B6V4HID2.js} +2 -2
- package/dist/browser/{chunk-NT7DOWM7.js → chunk-CDDBLEN6.js} +2 -2
- package/dist/browser/{chunk-UKFZ7AT5.js → chunk-F4KVDZS3.js} +12 -1
- package/dist/browser/chunk-F4KVDZS3.js.map +1 -0
- package/dist/browser/{chunk-GA3VPLST.js → chunk-GNAF4MSU.js} +2 -2
- package/dist/browser/{chunk-2HQKZFJV.js → chunk-ONS5T35N.js} +2 -2
- package/dist/browser/{chunk-J5T2K5NR.js → chunk-RGO5EYGG.js} +2 -2
- package/dist/browser/{chunk-OMZFF2KR.js → chunk-RKZNZKLG.js} +47 -22
- package/dist/browser/chunk-RKZNZKLG.js.map +1 -0
- package/dist/browser/{chunk-PO7RAUEO.js → chunk-TU4BZYED.js} +6 -4
- package/dist/browser/chunk-TU4BZYED.js.map +1 -0
- package/dist/browser/chunk-WKWX3MMT.js +233 -0
- package/dist/browser/chunk-WKWX3MMT.js.map +1 -0
- package/dist/browser/{chunk-YQ2VLQAY.js → chunk-YYYJ6D77.js} +15 -1
- package/dist/browser/chunk-YYYJ6D77.js.map +1 -0
- package/dist/browser/components/avatar/define.js +2 -2
- package/dist/browser/components/progress/define.js +2 -2
- package/dist/browser/components/skeleton/define.js +2 -2
- package/dist/browser/components/spinner/define.js +2 -2
- package/dist/browser/overlays/blocking-loader/define.js +3 -3
- package/dist/browser/overlays/context-menu/define.js +3 -3
- package/dist/browser/overlays/dropdown/define.js +3 -3
- package/dist/browser/overlays/modal/define.js +2 -2
- package/dist/browser/overlays/notification-banner/define.js +3 -3
- package/dist/browser/overlays/popover/define.js +2 -2
- package/dist/browser/overlays/snackbar/define.js +3 -3
- package/dist/browser/overlays/tooltip/define.js +2 -2
- package/dist/core/input-modality.d.ts +21 -0
- package/dist/core/input-modality.js +56 -0
- package/dist/core/input-modality.js.map +1 -0
- package/dist/core/sanitize.d.ts +7 -2
- package/dist/core/sanitize.js +14 -5
- package/dist/core/sanitize.js.map +1 -1
- package/dist/core/template.d.ts +11 -2
- package/dist/core/template.js +28 -8
- package/dist/core/template.js.map +1 -1
- package/dist/core/trusted-types.d.ts +34 -0
- package/dist/core/trusted-types.js +78 -0
- package/dist/core/trusted-types.js.map +1 -0
- package/dist/overlays/core/a11y-anchored-overlay-element.d.ts +4 -0
- package/dist/overlays/core/a11y-anchored-overlay-element.js +14 -0
- package/dist/overlays/core/a11y-anchored-overlay-element.js.map +1 -1
- package/dist/overlays/core/a11y-passive-overlay-element.d.ts +9 -0
- package/dist/overlays/core/a11y-passive-overlay-element.js +14 -0
- package/dist/overlays/core/a11y-passive-overlay-element.js.map +1 -1
- package/dist/overlays/notification-banner/notification-banner.element.d.ts +7 -1
- package/dist/overlays/notification-banner/notification-banner.element.js +9 -1
- package/dist/overlays/notification-banner/notification-banner.element.js.map +1 -1
- package/dist/overlays/snackbar/snackbar.element.d.ts +20 -7
- package/dist/overlays/snackbar/snackbar.element.js +55 -20
- package/dist/overlays/snackbar/snackbar.element.js.map +1 -1
- package/dist/overlays/tooltip/tooltip.element.d.ts +32 -8
- package/dist/overlays/tooltip/tooltip.element.js +112 -18
- package/dist/overlays/tooltip/tooltip.element.js.map +1 -1
- package/package.json +1 -1
- package/dist/browser/chunk-KVUJT6BC.js.map +0 -1
- package/dist/browser/chunk-OMZFF2KR.js.map +0 -1
- package/dist/browser/chunk-PMGHD553.js +0 -124
- package/dist/browser/chunk-PMGHD553.js.map +0 -1
- package/dist/browser/chunk-PO7RAUEO.js.map +0 -1
- package/dist/browser/chunk-UKFZ7AT5.js.map +0 -1
- package/dist/browser/chunk-YQ2VLQAY.js.map +0 -1
- /package/dist/browser/{chunk-K7JWBING.js.map → chunk-2X4DBANG.js.map} +0 -0
- /package/dist/browser/{chunk-MB2GJCKB.js.map → chunk-3AHPI6C5.js.map} +0 -0
- /package/dist/browser/{chunk-OB2NQV77.js.map → chunk-3QCORK3F.js.map} +0 -0
- /package/dist/browser/{chunk-7CL7TH7I.js.map → chunk-4ER4RFUO.js.map} +0 -0
- /package/dist/browser/{chunk-MIBUA46B.js.map → chunk-6HI2FNGK.js.map} +0 -0
- /package/dist/browser/{chunk-GOYSEJKF.js.map → chunk-B6V4HID2.js.map} +0 -0
- /package/dist/browser/{chunk-NT7DOWM7.js.map → chunk-CDDBLEN6.js.map} +0 -0
- /package/dist/browser/{chunk-GA3VPLST.js.map → chunk-GNAF4MSU.js.map} +0 -0
- /package/dist/browser/{chunk-2HQKZFJV.js.map → chunk-ONS5T35N.js.map} +0 -0
- /package/dist/browser/{chunk-J5T2K5NR.js.map → chunk-RGO5EYGG.js.map} +0 -0
package/README.md
CHANGED
|
@@ -101,6 +101,22 @@ import { A11yElement } from 'a11y-elements/core';
|
|
|
101
101
|
|
|
102
102
|
Importing a component's subpath also adds its tag to TypeScript's `HTMLElementTagNameMap`, so exact-tag lookups such as `document.createElement('a11y-checkbox')` or `document.querySelector('a11y-checkbox')` come back typed as `CheckboxElement` without a cast.
|
|
103
103
|
|
|
104
|
+
### Trusted Types (CSP)
|
|
105
|
+
|
|
106
|
+
On a page whose Content Security Policy has `require-trusted-types-for 'script'`, list `a11y-elements` in `trusted-types`:
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
Content-Security-Policy: require-trusted-types-for 'script'; trusted-types a11y-elements <your own policies>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Without Trusted Types nothing changes. With them:
|
|
113
|
+
|
|
114
|
+
* **The `a11y-elements` policy only covers `raw()`.** It is created the first time `raw()` markup is parsed. It passes that markup through unchanged: the markup is parsed into the inert document behind a `<template>` (nothing loads or runs there), then sanitized as nodes before anything reaches the page. The policy is private to the library, so no other script can use it. The library never creates a `default` policy.
|
|
115
|
+
* **`trustedRaw()` needs a `TrustedHTML`.** Its markup is inserted unsanitized, so it doesn't go through the library's policy: pass it a value made by your own policy, e.g. `trustedRaw(myPolicy.createHTML(markup))`. A plain string is rejected by the browser when the content is inserted.
|
|
116
|
+
* **`String(raw(…))` and `.__html` are strings.** If you assign them to `innerHTML` yourself, that's your own sink, and it needs your own policy.
|
|
117
|
+
* **Loading two copies of the library** (two versions, or `dist/core` alongside `dist/browser`) makes two policies with the same name. The second copy to render logs a warning and its content is rejected, unless the CSP allows duplicates: `trusted-types a11y-elements 'allow-duplicates'`. One `dist/browser` load is a single copy: its elements share one chunk.
|
|
118
|
+
* `h()` sets attributes with `setAttribute()`, so `h('script', { src })` is a Trusted Types sink of yours, and the browser rejects it without a `TrustedScriptURL`.
|
|
119
|
+
|
|
104
120
|
### Translating built-in strings
|
|
105
121
|
|
|
106
122
|
A few English strings end up in accessible names and announcements. Replace them page-wide with `setStrings()`, exported from `a11y-elements/core` and from every zero-build `define.js`:
|
|
@@ -1546,11 +1562,21 @@ It's a page region, not an open/close overlay: it fires no open/close events and
|
|
|
1546
1562
|
| Option | Default | Description |
|
|
1547
1563
|
| --- | --- | --- |
|
|
1548
1564
|
| `type` | `info` | `info`, `success`, `warning` or `error` (`error` uses `role="alert"`). |
|
|
1549
|
-
| `position` | `top` | `top` or `bottom`. |
|
|
1565
|
+
| `position` | `--a11y-notification-banner-position`, else `top` | `top` or `bottom`. |
|
|
1550
1566
|
| `actionText` / `onAction` | — | Adds an action button; clicking it runs `onAction` and dismisses the banner. |
|
|
1551
1567
|
| `onClose` | — | Called when the banner is dismissed. |
|
|
1552
1568
|
| `maxStack` | — | Sets `max-stack` on the region (sticky for later banners). |
|
|
1553
1569
|
|
|
1570
|
+
To set the default position for every banner, use CSS, like any other style property:
|
|
1571
|
+
|
|
1572
|
+
```css
|
|
1573
|
+
:root {
|
|
1574
|
+
--a11y-notification-banner-position: bottom;
|
|
1575
|
+
}
|
|
1576
|
+
```
|
|
1577
|
+
|
|
1578
|
+
It's read each time a banner is shown, so a change applies to the next banners, not to those already on screen. A `position` passed to `show()` wins. Other values, corners included, are ignored.
|
|
1579
|
+
|
|
1554
1580
|
Classes: `.a11y-notification-banner--info` / `--success` / `--warning` / `--error`, `__message`, `__action`, `__close`.
|
|
1555
1581
|
|
|
1556
1582
|
<details>
|
|
@@ -1565,6 +1591,7 @@ Colors come from the shared `--a11y-color-*` tokens (see [Shared tokens](#shared
|
|
|
1565
1591
|
| `--a11y-notification-banner-close-font-size` | `1.25rem` |
|
|
1566
1592
|
| `--a11y-notification-banner-gap` | `1rem` |
|
|
1567
1593
|
| `--a11y-notification-banner-padding` | `0.75rem 1.5rem` |
|
|
1594
|
+
| `--a11y-notification-banner-position` | `top` |
|
|
1568
1595
|
|
|
1569
1596
|
</details>
|
|
1570
1597
|
|
|
@@ -1624,7 +1651,8 @@ import { h, raw } from 'a11y-elements/core';
|
|
|
1624
1651
|
|
|
1625
1652
|
notify('Saved');
|
|
1626
1653
|
notify('Upload failed', { type: 'error', actionText: 'Retry', onAction: retryUpload });
|
|
1627
|
-
notify('Copied to clipboard', { position: 'top', duration: 1500 });
|
|
1654
|
+
notify('Copied to clipboard', { position: 'top-right', duration: 1500 });
|
|
1655
|
+
notify('Draft deleted', { actionText: 'Undo', onAction: restoreDraft, onClose: () => console.log('toast gone') });
|
|
1628
1656
|
notify(raw('Saved. <a href="/files">View files</a>')); // markup: sanitized, see below
|
|
1629
1657
|
notify(h('span', null, 'Saved. ', h('a', { href: '/files' }, 'View files'))); // nodes, no parsing at all
|
|
1630
1658
|
```
|
|
@@ -1635,7 +1663,7 @@ notify(h('span', null, 'Saved. ', h('a', { href: '/files' }, 'View files'))); //
|
|
|
1635
1663
|
| `max-stack` | attribute | `3` | How many toasts show at once; the rest wait in a queue and show as earlier ones are dismissed. |
|
|
1636
1664
|
| `maxStack` | property | `3` | Same as `max-stack`. `setMaxStack(n)` is an alias. |
|
|
1637
1665
|
| `notify(message, options)` | method | — | Shows a toast (or queues it). |
|
|
1638
|
-
| `dismissAll()` | method | — | Removes every showing toast and drops queued ones, without running `onAction`. |
|
|
1666
|
+
| `dismissAll()` | method | — | Removes every showing toast (calling its `onClose`) and drops queued ones silently, without running `onAction`. |
|
|
1639
1667
|
|
|
1640
1668
|
It's a page region, not an open/close overlay: it fires no open/close events and `dismissAllOverlays()` leaves it alone, so toasts outlive a SPA navigation while the region stays in the page. Call `dismissAll()` to clear them. Removing the region from the document (e.g. with `removeOverlaysWithin()`) drops its toasts, queued ones included, and cancels their timers; re-adding it starts empty. A toast enqueued while the region is detached waits until it's back in the page. Like every overlay it moves itself to `<body>`; see [Overlays in a framework](#overlays-in-a-framework) for `removeOverlaysWithin()`.
|
|
1641
1669
|
|
|
@@ -1646,11 +1674,22 @@ A `message` is text: a string is inserted as text, never parsed. A DOM node (e.g
|
|
|
1646
1674
|
| Option | Default | Description |
|
|
1647
1675
|
| --- | --- | --- |
|
|
1648
1676
|
| `type` | `info` | `info`, `success`, `warning` or `error` (`error` uses `role="alert"`). |
|
|
1649
|
-
| `position` | `bottom` | `bottom` or `
|
|
1677
|
+
| `position` | `--a11y-snackbar-position`, else `bottom` | `top`, `bottom`, `top-left`, `top-right`, `bottom-left` or `bottom-right`. |
|
|
1650
1678
|
| `duration` | `3000` (`10000` with an action) | Time on screen, in ms, not counting hover/focus. `Infinity` keeps the toast until it's dismissed. |
|
|
1651
1679
|
| `actionText` / `onAction` | — | Adds an action button; clicking it dismisses the toast and runs `onAction`. |
|
|
1680
|
+
| `onClose` | — | Called once the toast is gone: × button, action button (after `onAction`), timeout, or `dismissAll()`. Not called for a queued toast that never showed. |
|
|
1652
1681
|
| `maxStack` | — | Sets `max-stack` on the region (sticky for later toasts). |
|
|
1653
1682
|
|
|
1683
|
+
To set the default position for every toast, use CSS, like any other style property:
|
|
1684
|
+
|
|
1685
|
+
```css
|
|
1686
|
+
:root {
|
|
1687
|
+
--a11y-snackbar-position: top-right;
|
|
1688
|
+
}
|
|
1689
|
+
```
|
|
1690
|
+
|
|
1691
|
+
It's read each time a toast is shown, so a change applies to the next toasts, not to those already on screen. A `position` passed to `notify()` wins. Toasts in the same position stack; each position has its own stack. Each stack is up to 90% of the viewport wide, so on a narrow screen toasts in different positions can overlap.
|
|
1692
|
+
|
|
1654
1693
|
Classes: `.a11y-snackbar--info` / `--success` / `--warning` / `--error`.
|
|
1655
1694
|
|
|
1656
1695
|
<details>
|
|
@@ -1669,6 +1708,7 @@ Colors come from the shared `--a11y-color-*` tokens (see [Shared tokens](#shared
|
|
|
1669
1708
|
| `--a11y-snackbar-gap` | `1rem` |
|
|
1670
1709
|
| `--a11y-snackbar-offset` | `1rem` |
|
|
1671
1710
|
| `--a11y-snackbar-padding` | `0.75rem 1.5rem` |
|
|
1711
|
+
| `--a11y-snackbar-position` | `bottom` |
|
|
1672
1712
|
| `--a11y-snackbar-shadow-blur` | `6px` |
|
|
1673
1713
|
| `--a11y-snackbar-shadow-color` | `rgba(0, 0, 0, 0.3)` |
|
|
1674
1714
|
| `--a11y-snackbar-shadow-offset-y` | `2px` |
|
|
@@ -1678,7 +1718,9 @@ Colors come from the shared `--a11y-color-*` tokens (see [Shared tokens](#shared
|
|
|
1678
1718
|
|
|
1679
1719
|
### `a11y-tooltip`
|
|
1680
1720
|
|
|
1681
|
-
A short description shown on hover or focus of its anchor, which gets `aria-describedby`. It stays open while the pointer is over it, and Escape hides it. Never traps focus. See [Anchored overlays](#anchored-overlays).
|
|
1721
|
+
A short description shown on mouse hover or keyboard focus of its anchor, which gets `aria-describedby`. It stays open while the pointer is over it, and Escape hides it. Never traps focus. See [Anchored overlays](#anchored-overlays).
|
|
1722
|
+
|
|
1723
|
+
Pressing the anchor hides it, and hover doesn't bring it back until the pointer leaves and returns. On a touch screen a tap doesn't show it, since the tap is the action. Instead, a long press (500 ms) shows it, until the next tap elsewhere or on the anchor. Screen readers still announce the text through `aria-describedby`. Focus shows it only when the keyboard was used last (Tab, or Escape closing a modal that hands focus back), not after a click or tap. Before any input, it follows `:focus-visible`.
|
|
1682
1724
|
|
|
1683
1725
|
```html
|
|
1684
1726
|
<button id="save-btn">Save</button>
|
|
@@ -1890,4 +1932,4 @@ MIT — see [`LICENSE.txt`](./LICENSE.txt).
|
|
|
1890
1932
|
|
|
1891
1933
|
## Support
|
|
1892
1934
|
|
|
1893
|
-
If you find a11y-elements useful, consider supporting its development
|
|
1935
|
+
If you find a11y-elements useful, consider supporting its development on [Ko-fi](https://ko-fi.com/loiskouninef)
|
package/dist/a11y.css
CHANGED
|
@@ -1461,11 +1461,8 @@ a11y-floating.a11y-floating--scrolled-away {
|
|
|
1461
1461
|
}
|
|
1462
1462
|
|
|
1463
1463
|
/* src/overlays/snackbar/snackbar.css */
|
|
1464
|
-
.a11y-snackbar-
|
|
1465
|
-
.a11y-snackbar-region__top {
|
|
1464
|
+
.a11y-snackbar-region__stack {
|
|
1466
1465
|
position: fixed;
|
|
1467
|
-
left: 50%;
|
|
1468
|
-
transform: translateX(-50%);
|
|
1469
1466
|
display: flex;
|
|
1470
1467
|
flex-direction: column;
|
|
1471
1468
|
align-items: stretch;
|
|
@@ -1475,16 +1472,26 @@ a11y-floating.a11y-floating--scrolled-away {
|
|
|
1475
1472
|
pointer-events: none;
|
|
1476
1473
|
z-index: var(--a11y-z-snackbar, 400);
|
|
1477
1474
|
}
|
|
1478
|
-
.a11y-snackbar-
|
|
1479
|
-
.a11y-snackbar-region__top .a11y-snackbar {
|
|
1475
|
+
.a11y-snackbar-region__stack .a11y-snackbar {
|
|
1480
1476
|
pointer-events: auto;
|
|
1481
1477
|
}
|
|
1482
|
-
.a11y-snackbar-
|
|
1478
|
+
.a11y-snackbar-region__stack[data-position^=top] {
|
|
1479
|
+
top: var(--a11y-snackbar-offset, 1rem);
|
|
1480
|
+
}
|
|
1481
|
+
.a11y-snackbar-region__stack[data-position^=bottom] {
|
|
1483
1482
|
bottom: var(--a11y-snackbar-offset, 1rem);
|
|
1484
1483
|
flex-direction: column-reverse;
|
|
1485
1484
|
}
|
|
1486
|
-
.a11y-snackbar-
|
|
1487
|
-
|
|
1485
|
+
.a11y-snackbar-region__stack[data-position$=left] {
|
|
1486
|
+
left: var(--a11y-snackbar-offset, 1rem);
|
|
1487
|
+
}
|
|
1488
|
+
.a11y-snackbar-region__stack[data-position$=right] {
|
|
1489
|
+
right: var(--a11y-snackbar-offset, 1rem);
|
|
1490
|
+
}
|
|
1491
|
+
.a11y-snackbar-region__stack[data-position=top],
|
|
1492
|
+
.a11y-snackbar-region__stack[data-position=bottom] {
|
|
1493
|
+
left: 50%;
|
|
1494
|
+
transform: translateX(-50%);
|
|
1488
1495
|
}
|
|
1489
1496
|
.a11y-snackbar {
|
|
1490
1497
|
position: relative;
|
|
@@ -1500,6 +1507,9 @@ a11y-floating.a11y-floating--scrolled-away {
|
|
|
1500
1507
|
width: 100%;
|
|
1501
1508
|
animation: a11y-snackbar-fade-in var(--a11y-snackbar-animation-duration, 0.3s) ease;
|
|
1502
1509
|
}
|
|
1510
|
+
.a11y-snackbar-region__stack[data-position^=top] .a11y-snackbar {
|
|
1511
|
+
animation-name: a11y-snackbar-fade-in-down;
|
|
1512
|
+
}
|
|
1503
1513
|
.a11y-snackbar--success {
|
|
1504
1514
|
background: var(--a11y-color-success, #2e7d32);
|
|
1505
1515
|
color: var(--a11y-color-text-on-success, var(--a11y-color-text, white));
|
|
@@ -1559,6 +1569,16 @@ a11y-floating.a11y-floating--scrolled-away {
|
|
|
1559
1569
|
transform: translateY(0);
|
|
1560
1570
|
}
|
|
1561
1571
|
}
|
|
1572
|
+
@keyframes a11y-snackbar-fade-in-down {
|
|
1573
|
+
from {
|
|
1574
|
+
opacity: 0;
|
|
1575
|
+
transform: translateY(-8px);
|
|
1576
|
+
}
|
|
1577
|
+
to {
|
|
1578
|
+
opacity: 1;
|
|
1579
|
+
transform: translateY(0);
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1562
1582
|
@media (prefers-reduced-motion: reduce) {
|
|
1563
1583
|
.a11y-snackbar {
|
|
1564
1584
|
animation: none;
|
|
@@ -1633,6 +1653,19 @@ html.a11y-modal-layer-open .a11y-snackbar-region {
|
|
|
1633
1653
|
font-size: var(--a11y-notification-banner-close-font-size, 1.25rem);
|
|
1634
1654
|
line-height: 1;
|
|
1635
1655
|
}
|
|
1656
|
+
.a11y-notification-banner-region__bottom .a11y-notification-banner {
|
|
1657
|
+
animation-name: a11y-notification-banner-fade-in-up;
|
|
1658
|
+
}
|
|
1659
|
+
@keyframes a11y-notification-banner-fade-in-up {
|
|
1660
|
+
from {
|
|
1661
|
+
opacity: 0;
|
|
1662
|
+
transform: translateY(8px);
|
|
1663
|
+
}
|
|
1664
|
+
to {
|
|
1665
|
+
opacity: 1;
|
|
1666
|
+
transform: translateY(0);
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1636
1669
|
@keyframes a11y-notification-banner-fade-in {
|
|
1637
1670
|
from {
|
|
1638
1671
|
opacity: 0;
|
package/dist/browser/all.js
CHANGED
|
@@ -4,22 +4,22 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
ModalElement,
|
|
6
6
|
confirmDialog
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ONS5T35N.js";
|
|
8
8
|
import {
|
|
9
9
|
NotificationBannerElement,
|
|
10
10
|
showNotificationBanner
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-TU4BZYED.js";
|
|
12
12
|
import {
|
|
13
13
|
PopoverElement
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-3AHPI6C5.js";
|
|
15
15
|
import {
|
|
16
16
|
SnackbarElement,
|
|
17
17
|
notify
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-RKZNZKLG.js";
|
|
19
|
+
import "./chunk-YYYJ6D77.js";
|
|
20
20
|
import {
|
|
21
21
|
TooltipElement
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-WKWX3MMT.js";
|
|
23
23
|
import {
|
|
24
24
|
TabsElement
|
|
25
25
|
} from "./chunk-4V5TTMP4.js";
|
|
@@ -31,18 +31,18 @@ import {
|
|
|
31
31
|
} from "./chunk-SRWD5UK6.js";
|
|
32
32
|
import {
|
|
33
33
|
BlockingLoaderElement
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-3QCORK3F.js";
|
|
35
35
|
import {
|
|
36
36
|
ContextMenuElement
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-B6V4HID2.js";
|
|
38
38
|
import {
|
|
39
39
|
DrawerElement
|
|
40
40
|
} from "./chunk-6BEWDDER.js";
|
|
41
41
|
import {
|
|
42
42
|
DropdownElement
|
|
43
|
-
} from "./chunk-
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import "./chunk-
|
|
43
|
+
} from "./chunk-2X4DBANG.js";
|
|
44
|
+
import "./chunk-RGO5EYGG.js";
|
|
45
|
+
import "./chunk-F4KVDZS3.js";
|
|
46
46
|
import {
|
|
47
47
|
EmergencyDialogElement
|
|
48
48
|
} from "./chunk-2TPJ5MVQ.js";
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
} from "./chunk-F5VLI6QP.js";
|
|
63
63
|
import {
|
|
64
64
|
ProgressElement
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-6HI2FNGK.js";
|
|
66
66
|
import {
|
|
67
67
|
RadioGroupElement
|
|
68
68
|
} from "./chunk-P42G35OU.js";
|
|
@@ -71,10 +71,10 @@ import {
|
|
|
71
71
|
} from "./chunk-NJSZSBR5.js";
|
|
72
72
|
import {
|
|
73
73
|
SkeletonElement
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-GNAF4MSU.js";
|
|
75
75
|
import {
|
|
76
76
|
SpinnerElement
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-CDDBLEN6.js";
|
|
78
78
|
import {
|
|
79
79
|
SwitchElement
|
|
80
80
|
} from "./chunk-UFLTXMN2.js";
|
|
@@ -83,8 +83,8 @@ import {
|
|
|
83
83
|
} from "./chunk-HG7FJAXE.js";
|
|
84
84
|
import {
|
|
85
85
|
AvatarElement
|
|
86
|
-
} from "./chunk-
|
|
87
|
-
import "./chunk-
|
|
86
|
+
} from "./chunk-4ER4RFUO.js";
|
|
87
|
+
import "./chunk-7FIT24VV.js";
|
|
88
88
|
import {
|
|
89
89
|
CardLinkElement
|
|
90
90
|
} from "./chunk-6AJBXOCZ.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
A11yMenuOverlayElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RGO5EYGG.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-2X4DBANG.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
A11yAnchoredOverlayElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-F4KVDZS3.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-3AHPI6C5.js.map
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./chunk-H25W66MH.js";
|
|
12
12
|
import {
|
|
13
13
|
h
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-7FIT24VV.js";
|
|
15
15
|
import {
|
|
16
16
|
defineElement,
|
|
17
17
|
getString
|
|
@@ -74,4 +74,4 @@ defineElement("a11y-blocking-loader", BlockingLoaderElement);
|
|
|
74
74
|
export {
|
|
75
75
|
BlockingLoaderElement
|
|
76
76
|
};
|
|
77
|
-
//# sourceMappingURL=chunk-
|
|
77
|
+
//# sourceMappingURL=chunk-3QCORK3F.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
h,
|
|
3
3
|
setAttrs
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7FIT24VV.js";
|
|
5
5
|
import {
|
|
6
6
|
A11yElement,
|
|
7
7
|
defineElement,
|
|
@@ -79,4 +79,4 @@ defineElement("a11y-avatar", AvatarElement);
|
|
|
79
79
|
export {
|
|
80
80
|
AvatarElement
|
|
81
81
|
};
|
|
82
|
-
//# sourceMappingURL=chunk-
|
|
82
|
+
//# sourceMappingURL=chunk-4ER4RFUO.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
h,
|
|
3
3
|
setAttrs
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7FIT24VV.js";
|
|
5
5
|
import {
|
|
6
6
|
nextId
|
|
7
7
|
} from "./chunk-Q4TMA3P7.js";
|
|
@@ -66,4 +66,4 @@ defineElement("a11y-progress", ProgressElement);
|
|
|
66
66
|
export {
|
|
67
67
|
ProgressElement
|
|
68
68
|
};
|
|
69
|
-
//# sourceMappingURL=chunk-
|
|
69
|
+
//# sourceMappingURL=chunk-6HI2FNGK.js.map
|
|
@@ -4,6 +4,46 @@ import {
|
|
|
4
4
|
doc
|
|
5
5
|
} from "./chunk-ED3UMYMY.js";
|
|
6
6
|
|
|
7
|
+
// src/core/trusted-types.ts
|
|
8
|
+
var POLICY_NAME = "a11y-elements";
|
|
9
|
+
function factory() {
|
|
10
|
+
const tt = globalThis.trustedTypes;
|
|
11
|
+
return tt && typeof tt.createPolicy === "function" && typeof tt.isHTML === "function" ? tt : void 0;
|
|
12
|
+
}
|
|
13
|
+
function enforced() {
|
|
14
|
+
try {
|
|
15
|
+
doc.createElement("template").innerHTML = "";
|
|
16
|
+
return false;
|
|
17
|
+
} catch {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function isTrustedHTML(value) {
|
|
22
|
+
return typeof value === "object" && value !== null && factory()?.isHTML(value) === true;
|
|
23
|
+
}
|
|
24
|
+
var policy;
|
|
25
|
+
var failed = false;
|
|
26
|
+
function getPolicy() {
|
|
27
|
+
if (policy || failed) return policy;
|
|
28
|
+
const tt = factory();
|
|
29
|
+
if (!tt) return void 0;
|
|
30
|
+
try {
|
|
31
|
+
policy = tt.createPolicy(POLICY_NAME, { createHTML: (markup) => markup });
|
|
32
|
+
} catch (error) {
|
|
33
|
+
failed = true;
|
|
34
|
+
if (!enforced()) return void 0;
|
|
35
|
+
console.warn(
|
|
36
|
+
`a11y-elements: could not create the "${POLICY_NAME}" Trusted Types policy. List ${POLICY_NAME} in the CSP's trusted-types, and add 'allow-duplicates' if more than one copy of a11y-elements is loaded.`,
|
|
37
|
+
error
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
return policy;
|
|
41
|
+
}
|
|
42
|
+
function toTrustedHTML(markup) {
|
|
43
|
+
const p = getPolicy();
|
|
44
|
+
return p ? p.createHTML(markup) : markup;
|
|
45
|
+
}
|
|
46
|
+
|
|
7
47
|
// src/core/sanitize.ts
|
|
8
48
|
var STRIPPED_TAGS = /* @__PURE__ */ new Set(["script", "style", "link", "base", "meta"]);
|
|
9
49
|
var FRAME_TAGS = /* @__PURE__ */ new Set(["iframe", "object", "embed", "frame"]);
|
|
@@ -39,12 +79,12 @@ function childrenOf(root) {
|
|
|
39
79
|
var SCRIPT_OR_DATA_URL = /^(javascript|data):/i;
|
|
40
80
|
function sanitizeMarkup(source) {
|
|
41
81
|
const holder = doc.createElement("template");
|
|
42
|
-
holder
|
|
82
|
+
setHTML(holder, toTrustedHTML(source));
|
|
43
83
|
sanitizeTemplate(holder);
|
|
44
84
|
return holder.innerHTML;
|
|
45
85
|
}
|
|
46
86
|
function parseSanitized(source, parent) {
|
|
47
|
-
const root = parseInContext(source, parent);
|
|
87
|
+
const root = parseInContext(toTrustedHTML(source), parent);
|
|
48
88
|
sanitizeNode(root);
|
|
49
89
|
return Array.from(nodeChildNodes(root));
|
|
50
90
|
}
|
|
@@ -53,12 +93,15 @@ function parseInContext(source, parent) {
|
|
|
53
93
|
const parentEl = parent && nodeType(parent) === ELEMENT_NODE ? parent : null;
|
|
54
94
|
if (parentEl && !templateContent(parentEl)) {
|
|
55
95
|
const context = holder.content.ownerDocument.createElementNS(elementNamespace(parentEl), elementLocalName(parentEl));
|
|
56
|
-
context
|
|
96
|
+
setHTML(context, source);
|
|
57
97
|
return context;
|
|
58
98
|
}
|
|
59
|
-
holder
|
|
99
|
+
setHTML(holder, source);
|
|
60
100
|
return holder.content;
|
|
61
101
|
}
|
|
102
|
+
function setHTML(el, source) {
|
|
103
|
+
el.innerHTML = source;
|
|
104
|
+
}
|
|
62
105
|
function isAllowedAttribute(name, value) {
|
|
63
106
|
if (name.startsWith("on") || name === "srcdoc") return false;
|
|
64
107
|
return !(URL_ATTRS.has(name) && isDangerousUrl(value, SCRIPT_URL));
|
|
@@ -101,14 +144,17 @@ function isDangerousUrl(value, schemes) {
|
|
|
101
144
|
// src/core/template.ts
|
|
102
145
|
var RAW = /* @__PURE__ */ Symbol.for("a11y-elements/raw");
|
|
103
146
|
var SOURCE = /* @__PURE__ */ Symbol.for("a11y-elements/raw-source");
|
|
147
|
+
var TRUSTED_HTML = /* @__PURE__ */ Symbol.for("a11y-elements/raw-trusted-html");
|
|
104
148
|
var TRUSTED = /* @__PURE__ */ Symbol.for("a11y-elements/raw-trusted");
|
|
105
149
|
var Markup = class {
|
|
106
150
|
[RAW] = true;
|
|
107
151
|
[SOURCE];
|
|
108
152
|
[TRUSTED];
|
|
109
|
-
|
|
153
|
+
[TRUSTED_HTML];
|
|
154
|
+
constructor(source, trusted, trustedHtml) {
|
|
110
155
|
this[SOURCE] = source;
|
|
111
156
|
this[TRUSTED] = trusted;
|
|
157
|
+
if (trustedHtml) this[TRUSTED_HTML] = trustedHtml;
|
|
112
158
|
}
|
|
113
159
|
get __html() {
|
|
114
160
|
return this.toString();
|
|
@@ -124,7 +170,10 @@ function rawNodes(value, parent) {
|
|
|
124
170
|
const brand = value;
|
|
125
171
|
const source = brand[SOURCE];
|
|
126
172
|
if (typeof source !== "string") return parseSanitized(value.__html, parent);
|
|
127
|
-
if (brand[TRUSTED] === true)
|
|
173
|
+
if (brand[TRUSTED] === true) {
|
|
174
|
+
const trustedHtml = brand[TRUSTED_HTML];
|
|
175
|
+
return Array.from(nodeChildNodes(parseInContext(isTrustedHTML(trustedHtml) ? trustedHtml : source, parent)));
|
|
176
|
+
}
|
|
128
177
|
return parseSanitized(source, parent);
|
|
129
178
|
}
|
|
130
179
|
|
|
@@ -156,4 +205,4 @@ export {
|
|
|
156
205
|
h,
|
|
157
206
|
setAttrs
|
|
158
207
|
};
|
|
159
|
-
//# sourceMappingURL=chunk-
|
|
208
|
+
//# sourceMappingURL=chunk-7FIT24VV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/trusted-types.ts","../../src/core/sanitize.ts","../../src/core/template.ts","../../src/core/dom.ts"],"sourcesContent":["/**\n * Trusted Types, opt-in: used only where `trustedTypes` exists, so pages\n * without a Trusted Types CSP see no change.\n *\n * The `a11y-elements` policy passes markup through as it is. That's safe\n * only because of where it is used: `raw()` markup is parsed into the inert\n * document behind a `<template>` (nothing loads or runs there) and sanitized\n * as nodes before anything is attached to the page. It is never used for\n * `trustedRaw()`, whose markup is inserted unsanitized: under a Trusted Types\n * CSP that needs a `TrustedHTML` made by the host's own policy.\n *\n * - Never a `default` policy, which would pass every sink on the page.\n * - Created on first use, so a copy of the library that never renders never\n * asks for the name.\n * - Module-private: no way to reach it from outside, so listing\n * `a11y-elements` in `trusted-types` allows only this parse step. A second\n * copy that renders on the same page gets a duplicate-name error unless the\n * CSP has `'allow-duplicates'`: it warns once and writes plain strings,\n * which the browser then rejects.\n */\n\nimport { doc } from './safe-dom.js';\n\nexport const POLICY_NAME = 'a11y-elements';\n\n/**\n * A `TrustedHTML` value (TypeScript's DOM lib doesn't declare the type yet).\n * `@types/trusted-types` brands its own with a private member, so its public\n * shape is empty and no brand here could match it. Instead this rules out\n * the likely mistakes: primitives (`object`) and DOM nodes (`nodeType`).\n */\nexport type TrustedHTML = object & { readonly nodeType?: never };\n\ninterface HtmlPolicy {\n createHTML(markup: string): TrustedHTML;\n}\n\ninterface TrustedTypesFactory {\n createPolicy(name: string, rules: { createHTML(markup: string): string }): HtmlPolicy;\n isHTML(value: unknown): boolean;\n}\n\n/**\n * The page's `trustedTypes`, if it is the real one. Where the browser has\n * none, an element with `id=\"trustedTypes\"` (which `raw()` content can carry)\n * is what `window.trustedTypes` returns: check for its methods.\n */\nfunction factory(): TrustedTypesFactory | undefined {\n const tt = (globalThis as { trustedTypes?: Partial<TrustedTypesFactory> }).trustedTypes;\n return tt && typeof tt.createPolicy === 'function' && typeof tt.isHTML === 'function' ? (tt as TrustedTypesFactory) : undefined;\n}\n\n/**\n * Whether a plain string written to an HTML sink is rejected, i.e. the CSP\n * has `require-trusted-types-for 'script'`. Probed only once a policy\n * couldn't be created; under enforcement the probe itself adds one\n * violation report.\n */\nfunction enforced(): boolean {\n try {\n doc.createElement('template').innerHTML = '';\n return false;\n } catch {\n return true;\n }\n}\n\n/** Whether `value` is a real `TrustedHTML`; always false where Trusted Types don't exist. */\nexport function isTrustedHTML(value: unknown): value is TrustedHTML {\n return typeof value === 'object' && value !== null && factory()?.isHTML(value) === true;\n}\n\nlet policy: HtmlPolicy | undefined;\nlet failed = false;\n\nfunction getPolicy(): HtmlPolicy | undefined {\n if (policy || failed) return policy;\n const tt = factory();\n if (!tt) return undefined;\n try {\n policy = tt.createPolicy(POLICY_NAME, { createHTML: (markup) => markup });\n } catch (error) {\n // Not listed in the CSP's `trusted-types`, or a second copy without 'allow-duplicates'.\n // Without enforcement plain strings still work: a `trusted-types` list alone isn't worth a warning.\n failed = true;\n if (!enforced()) return undefined;\n console.warn(\n `a11y-elements: could not create the \"${POLICY_NAME}\" Trusted Types policy. ` +\n `List ${POLICY_NAME} in the CSP's trusted-types, and add 'allow-duplicates' if more than one copy of a11y-elements is loaded.`,\n error,\n );\n }\n return policy;\n}\n\n/** `markup` as `TrustedHTML` where Trusted Types exist, else as is. Only for markup parsed into an inert template and sanitized before use. */\nexport function toTrustedHTML(markup: string): string | TrustedHTML {\n const p = getPolicy();\n return p ? p.createHTML(markup) : markup;\n}\n","import { builtIn } from './builtin.js';\nimport { doc } from './safe-dom.js';\nimport { toTrustedHTML, type TrustedHTML } from './trusted-types.js';\n\n/**\n * DOM-based sanitizer behind `raw()`: markup is parsed once in the inert\n * document behind a `<template>` (nothing loads or runs there), cleaned as\n * nodes, and those nodes are what gets inserted — never re-serialized and\n * parsed again, which is where mutation XSS turns inert text back into\n * elements.\n */\n\n/** Compared against `localName`, so SVG/MathML elements of the same name are caught too. style/link restyle the page, base moves every relative URL, meta can refresh/navigate. */\nconst STRIPPED_TAGS = new Set(['script', 'style', 'link', 'base', 'meta']);\n\n/** A `data:` document in a frame runs its own scripts (opaque origin). */\nconst FRAME_TAGS = new Set(['iframe', 'object', 'embed', 'frame']);\nconst FRAME_URL_ATTRS = new Set(['src', 'data']);\nconst URL_ATTRS = new Set(['href', 'src', 'action', 'formaction', 'poster', 'background', 'xlink:href']);\n\n/** SVG `<animate>`/`<set>` can rewrite an attribute after sanitization: those targeting a URL attribute are dropped. */\nconst ATTR_ANIMATION_TAGS = new Set(['animate', 'set']);\n\nconst SCRIPT_URL = /^javascript:/i;\n\n/**\n * `document` and `<form>` are `[LegacyOverrideBuiltIns]` too: once inserted,\n * `<img name=\"createElement\">` makes `document.createElement` that image, and\n * `<input name=\"action\">` shadows its form's `action`. An `id`/`name` whose\n * value names a property of either (or of a named element already on the\n * page) is dropped — DOMPurify's `SANITIZE_DOM`. Markup you write yourself,\n * or pass to `trustedRaw()`, keeps its names.\n */\nconst CLOBBERING_ATTRS = new Set(['id', 'name']);\nlet probeForm: HTMLFormElement | undefined;\n\nfunction clobbers(value: string): boolean {\n probeForm ??= doc.createElement('form');\n return value in document || value in probeForm;\n}\n\n/*\n * Clobbering-proof DOM access. A `<form>` is `[LegacyOverrideBuiltIns]`: a\n * descendant named `children`, `attributes`, `localName`, `remove`, … shadows\n * that property on the form itself, so reading `form.children` straight off\n * the element can return an attacker's `<img>` and make the walk skip it.\n * Every read below goes through the node's prototype chain instead (named\n * properties are own properties of the instance, never on a prototype).\n *\n * Resolved on each call, never captured at load: importing this module needs\n * no DOM, and non-spec DOMs used for SSR work too — linkedom puts `children`\n * on a mixin, has a stub `childNodes` on `Node.prototype` that subclasses\n * override, and sets `nodeType`/`localName` as data on each node.\n */\nfunction read<T>(node: unknown, name: string): T {\n const desc = builtIn(node as object, name);\n if (desc) return (desc.get ? desc.get.call(node) : desc.value) as T;\n // No prototype has it (per-node data, as in linkedom). Never an own getter.\n return Object.getOwnPropertyDescriptor(node as object, name)?.value as T;\n}\n\nfunction invoke<T>(node: unknown, name: string, ...args: unknown[]): T {\n return (builtIn(node as object, name)!.value as (...a: unknown[]) => T).apply(node, args);\n}\n\nexport const nodeChildNodes = (node: unknown): NodeListOf<ChildNode> => read(node, 'childNodes');\nconst nodeType = (node: unknown): number => read(node, 'nodeType');\nconst elementChildren = (node: unknown): HTMLCollection => read(node, 'children');\nconst elementAttributes = (el: Element): NamedNodeMap => read(el, 'attributes');\nconst elementLocalName = (el: Element): string => read(el, 'localName');\nconst elementNamespace = (el: Element): string | null => read(el, 'namespaceURI');\nconst templateContentOf = (el: Element): DocumentFragment => read(el, 'content');\n\nconst ELEMENT_NODE = 1;\n\nfunction childrenOf(root: ParentNode): Element[] {\n return Array.from(elementChildren(root));\n}\nconst SCRIPT_OR_DATA_URL = /^(javascript|data):/i;\n\n/** Parses `source` as markup and returns it sanitized, as a string. Only for `String()` fallbacks: rendering inserts the nodes from `parseSanitized()` instead. */\nexport function sanitizeMarkup(source: string): string {\n const holder = doc.createElement('template');\n setHTML(holder, toTrustedHTML(source));\n sanitizeTemplate(holder);\n return holder.innerHTML;\n}\n\n/**\n * Parses `source` with an element like `parent` as context (so `<tr>`, SVG\n * or MathML content parses as it will once inserted under it), sanitizes it,\n * and returns the resulting nodes.\n */\nexport function parseSanitized(source: string, parent: Node | null): Node[] {\n const root = parseInContext(toTrustedHTML(source), parent);\n sanitizeNode(root);\n return Array.from(nodeChildNodes(root));\n}\n\n/**\n * Parses `source` as markup with an element like `parent` as context,\n * unsanitized: the holder of the parsed nodes. `source` is written as given:\n * under a Trusted Types CSP it must already be `TrustedHTML`.\n */\nexport function parseInContext(source: string | TrustedHTML, parent: Node | null): ParentNode {\n const holder = doc.createElement('template');\n const parentEl = parent && nodeType(parent) === ELEMENT_NODE ? (parent as Element) : null;\n if (parentEl && !templateContent(parentEl)) {\n const context = holder.content.ownerDocument.createElementNS(elementNamespace(parentEl), elementLocalName(parentEl));\n setHTML(context, source);\n return context;\n }\n setHTML(holder, source);\n return holder.content;\n}\n\n/** `innerHTML` takes `TrustedHTML` as it does a string; TypeScript's DOM lib only knows the string. */\nfunction setHTML(el: Element, source: string | TrustedHTML): void {\n el.innerHTML = source as string;\n}\n\nfunction isAllowedAttribute(name: string, value: string): boolean {\n // srcdoc is parsed as a same-origin document: escaped markup in it is decoded and runs.\n if (name.startsWith('on') || name === 'srcdoc') return false;\n return !(URL_ATTRS.has(name) && isDangerousUrl(value, SCRIPT_URL));\n}\n\nconst HTML_NS = 'http://www.w3.org/1999/xhtml';\n\n/** Only an HTML `<template>` has a content fragment; `<svg><template>` is a plain element. */\nfunction templateContent(el: Element): DocumentFragment | null {\n return elementLocalName(el) === 'template' && elementNamespace(el) === HTML_NS ? templateContentOf(el) : null;\n}\n\n/**\n * A spec `<template>` keeps its parsed nodes in `content` and has no\n * children. linkedom keeps them as the template's children, which is what it\n * serializes, and fills `content` with a copy when it is first read: sanitize\n * both.\n */\nfunction sanitizeTemplate(el: Element, content: DocumentFragment = templateContentOf(el)): void {\n sanitizeNode(content);\n sanitizeNode(el);\n}\n\nfunction sanitizeNode(root: ParentNode): void {\n // Snapshot before mutating: removing from a live collection while iterating it skips the next sibling.\n for (const el of childrenOf(root)) {\n const tag = elementLocalName(el).toLowerCase();\n if (STRIPPED_TAGS.has(tag) || animatesUrlAttribute(el, tag)) {\n invoke(el, 'remove');\n continue;\n }\n for (const attr of Array.from(elementAttributes(el))) {\n const name = attr.name.toLowerCase();\n if (\n !isAllowedAttribute(name, attr.value) ||\n (FRAME_TAGS.has(tag) && FRAME_URL_ATTRS.has(name) && isDangerousUrl(attr.value, SCRIPT_OR_DATA_URL)) ||\n (CLOBBERING_ATTRS.has(name) && clobbers(attr.value))\n ) {\n invoke(el, 'removeAttribute', attr.name);\n }\n }\n const content = templateContent(el);\n if (content) sanitizeTemplate(el, content);\n else sanitizeNode(el);\n }\n}\n\nfunction animatesUrlAttribute(el: Element, tag: string): boolean {\n if (!ATTR_ANIMATION_TAGS.has(tag)) return false;\n const target = (invoke<string | null>(el, 'getAttribute', 'attributeName') ?? '').trim().toLowerCase();\n return URL_ATTRS.has(target) || URL_ATTRS.has(target.replace(/^xlink:/, ''));\n}\n\nfunction isDangerousUrl(value: string, schemes: RegExp): boolean {\n // Browsers strip ASCII tab/newline/CR from a URL (and trim leading C0\n // control/space) before sniffing the scheme, so \"java\\tscript:\" still runs\n // as javascript: — normalize the same way before checking it.\n return schemes.test(value.replace(/[\\t\\n\\r]/g, '').replace(/^[\\x00-\\x20]+/, ''));\n}\n","import { nodeChildNodes, parseInContext, parseSanitized, sanitizeMarkup } from './sanitize.js';\nimport { isTrustedHTML, type TrustedHTML } from './trusted-types.js';\n\n/**\n * Markup to insert as HTML rather than as text: made by `raw()` (sanitized)\n * or `trustedRaw()` (as is). Anywhere this library takes content — a `h()`\n * child, a snackbar/banner/`confirmDialog()` message — a plain string is text\n * and a `Raw` is markup, parsed in the context of the element it goes into.\n *\n * Only values made by `raw()`/`trustedRaw()` count: a plain object with an\n * `__html` key (e.g. parsed JSON) is inserted as text like any other value.\n *\n * `__html` and `String()` give the markup as a string (sanitized for\n * `raw()`), which the browser parses a second time when it is assigned to\n * `innerHTML`; inserting it as content parses it only once.\n */\nexport interface Raw {\n readonly __html: string;\n toString(): string;\n}\n\n/**\n * Brands, through `Symbol.for` rather than module-local symbols: a page can\n * hold more than one copy of this module, and markup made through one copy\n * must stay recognized in another. The `dist/browser` entries share a single\n * copy (code splitting puts it in one chunk), but `dist/core` loaded\n * alongside `dist/browser`, or two versions of the package, are two.\n */\nconst RAW: unique symbol = Symbol.for('a11y-elements/raw');\n/** The markup as given, always a string: copies of the library before 1.1 read it, and sanitize anything else. */\nconst SOURCE: unique symbol = Symbol.for('a11y-elements/raw-source');\n/** Set by `trustedRaw()` when given a `TrustedHTML`: what is written to the sink. 1.1+ only. */\nconst TRUSTED_HTML: unique symbol = Symbol.for('a11y-elements/raw-trusted-html');\n/** Set by `trustedRaw()`: insert unsanitized. */\nconst TRUSTED: unique symbol = Symbol.for('a11y-elements/raw-trusted');\n\nclass Markup implements Raw {\n readonly [RAW] = true;\n readonly [SOURCE]: string;\n readonly [TRUSTED]: boolean;\n readonly [TRUSTED_HTML]?: TrustedHTML;\n\n constructor(source: string, trusted: boolean, trustedHtml?: TrustedHTML) {\n this[SOURCE] = source;\n this[TRUSTED] = trusted;\n if (trustedHtml) this[TRUSTED_HTML] = trustedHtml;\n }\n\n get __html(): string {\n return this.toString();\n }\n\n toString(): string {\n return this[TRUSTED] ? this[SOURCE] : sanitizeMarkup(this[SOURCE]);\n }\n}\n\n/**\n * Markup inserted sanitized: `<script>`, `<style>`, `<link>`, `<base>`,\n * `<meta>`, event handler attributes, `srcdoc`, `javascript:` URLs, `data:`\n * frame sources and SVG animations of URL attributes are removed, and so is\n * an `id`/`name` that would shadow a built-in of `document` or of a `<form>`\n * (`name=\"createElement\"`, `name=\"action\"`, `id=\"body\"`, …).\n */\nexport function raw(value: string): Raw {\n return new Markup(value == null ? '' : String(value), false);\n}\n\n/**\n * Markup inserted exactly as given, unsanitized. Only for markup you wrote\n * yourself — never for anything user input can reach.\n *\n * Under a Trusted Types CSP (`require-trusted-types-for 'script'`) pass a\n * `TrustedHTML` made by your own policy: a plain string is rejected by the\n * browser when it is inserted. The library's `a11y-elements` policy only\n * covers `raw()`, which it sanitizes.\n */\nexport function trustedRaw(value: string | TrustedHTML): Raw {\n if (isTrustedHTML(value)) return new Markup(String(value), true, value);\n return new Markup(value == null ? '' : String(value), true);\n}\n\nexport function isRaw(value: unknown): value is Raw {\n return typeof value === 'object' && value !== null && (value as Record<symbol, unknown>)[RAW] === true;\n}\n\n/**\n * Parses `value` with `parent` as context and returns its nodes, sanitized\n * unless it came from `trustedRaw()`. Markup from an older bundle (no\n * `SOURCE`, e.g. an `html` result) is its `__html`, sanitized.\n */\nexport function rawNodes(value: Raw, parent: Node | null): Node[] {\n const brand = value as unknown as Record<symbol, unknown>;\n const source = brand[SOURCE];\n if (typeof source !== 'string') return parseSanitized(value.__html, parent);\n if (brand[TRUSTED] === true) {\n const trustedHtml = brand[TRUSTED_HTML];\n return Array.from(nodeChildNodes(parseInContext(isTrustedHTML(trustedHtml) ? trustedHtml : source, parent)));\n }\n return parseSanitized(source, parent);\n}\n","import { isRaw, rawNodes, type Raw } from './template.js';\nimport { call, doc } from './safe-dom.js';\n\n/** Content for an element: a string is text, a `Raw` is markup (see `raw()`), a `Node` goes in as is. */\nexport type Content = string | number | Node | Raw;\n\n/** A `h()` child or `appendContent()` item: `null`/`undefined`/`false` add nothing, so `cond && h(…)` works inline. */\nexport type Child = Content | null | undefined | false;\n\n/** An attribute value: `true` sets it bare (`disabled`), `null`/`undefined`/`false` leave it out, anything else is stringified. */\nexport type AttrValue = string | number | boolean | null | undefined;\n\n/**\n * Appends `children` to `parent`, in order. Strings and numbers become text\n * nodes (never parsed), a `Raw` is parsed with `parent` as context.\n */\nexport function appendContent(parent: ParentNode & Node, ...children: Child[]): void {\n for (const child of children) {\n if (child == null || child === false) continue;\n // `call()`: `parent` can be a <form> whose controls shadow `append`.\n if (isRaw(child)) call(parent, 'append', ...rawNodes(child, parent));\n else if (typeof child === 'object' && 'nodeType' in child) call(parent, 'append', child);\n else call(parent, 'append', String(child));\n }\n}\n\n/**\n * Creates an element node by node — the safe counterpart of building markup\n * as a string: values are set with `setAttribute()` and inserted as text, so\n * nothing in them is ever parsed as HTML.\n *\n * `` h('button', { type: 'button', class: 'x', disabled: busy }, label) ``\n */\nexport function h<K extends keyof HTMLElementTagNameMap>(\n tag: K,\n attrs?: Record<string, AttrValue> | null,\n ...children: Child[]\n): HTMLElementTagNameMap[K];\nexport function h(tag: string, attrs?: Record<string, AttrValue> | null, ...children: Child[]): HTMLElement;\nexport function h(tag: string, attrs?: Record<string, AttrValue> | null, ...children: Child[]): HTMLElement {\n const el = doc.createElement(tag);\n setAttrs(el, attrs);\n appendContent(el, ...children);\n return el;\n}\n\n/** Sets each attribute of `attrs` on `el` — `true` bare — and removes those that are `null`/`undefined`/`false`. */\nexport function setAttrs(el: Element, attrs?: Record<string, AttrValue> | null): void {\n if (!attrs) return;\n for (const [name, value] of Object.entries(attrs)) {\n if (value == null || value === false) el.removeAttribute(name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]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
A11yMenuOverlayElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RGO5EYGG.js";
|
|
4
4
|
import {
|
|
5
5
|
defineElement,
|
|
6
6
|
doc
|
|
@@ -78,4 +78,4 @@ defineElement("a11y-context-menu", ContextMenuElement);
|
|
|
78
78
|
export {
|
|
79
79
|
ContextMenuElement
|
|
80
80
|
};
|
|
81
|
-
//# sourceMappingURL=chunk-
|
|
81
|
+
//# sourceMappingURL=chunk-B6V4HID2.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
h
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7FIT24VV.js";
|
|
4
4
|
import {
|
|
5
5
|
A11yElement,
|
|
6
6
|
defineElement,
|
|
@@ -72,4 +72,4 @@ defineElement("a11y-spinner", SpinnerElement);
|
|
|
72
72
|
export {
|
|
73
73
|
SpinnerElement
|
|
74
74
|
};
|
|
75
|
-
//# sourceMappingURL=chunk-
|
|
75
|
+
//# sourceMappingURL=chunk-CDDBLEN6.js.map
|
|
@@ -29,6 +29,11 @@ var A11yAnchoredOverlayElement = class extends A11yOverlayElement {
|
|
|
29
29
|
_focusTrap = null;
|
|
30
30
|
_boundOutsideClick = null;
|
|
31
31
|
_outsideClickTimer = null;
|
|
32
|
+
/** The `<html>` given the no-op click listener, kept to remove it from the same element. */
|
|
33
|
+
_tapTargetRoot = null;
|
|
34
|
+
/** Per instance: a shared function would be added once, and the first overlay to close would remove it for all. */
|
|
35
|
+
_noopClick = () => {
|
|
36
|
+
};
|
|
32
37
|
_boundKeyDown = null;
|
|
33
38
|
_boundReposition = null;
|
|
34
39
|
_resizeObserver = null;
|
|
@@ -237,6 +242,8 @@ var A11yAnchoredOverlayElement = class extends A11yOverlayElement {
|
|
|
237
242
|
this._outsideClickTimer = setTimeout(() => {
|
|
238
243
|
doc.addEventListener("click", this._boundOutsideClick, true);
|
|
239
244
|
}, 0);
|
|
245
|
+
this._tapTargetRoot = doc.documentElement;
|
|
246
|
+
this._tapTargetRoot.addEventListener("click", this._noopClick);
|
|
240
247
|
if (!this.wantsFocusTrap()) {
|
|
241
248
|
this._boundKeyDown = (e) => {
|
|
242
249
|
if (e.key !== "Escape" || e.defaultPrevented) return;
|
|
@@ -256,6 +263,10 @@ var A11yAnchoredOverlayElement = class extends A11yOverlayElement {
|
|
|
256
263
|
doc.removeEventListener("click", this._boundOutsideClick, true);
|
|
257
264
|
this._boundOutsideClick = null;
|
|
258
265
|
}
|
|
266
|
+
if (this._tapTargetRoot) {
|
|
267
|
+
this._tapTargetRoot.removeEventListener("click", this._noopClick);
|
|
268
|
+
this._tapTargetRoot = null;
|
|
269
|
+
}
|
|
259
270
|
if (this._boundKeyDown) {
|
|
260
271
|
doc.removeEventListener("keydown", this._boundKeyDown, true);
|
|
261
272
|
this._boundKeyDown = null;
|
|
@@ -285,4 +296,4 @@ var A11yAnchoredOverlayElement = class extends A11yOverlayElement {
|
|
|
285
296
|
export {
|
|
286
297
|
A11yAnchoredOverlayElement
|
|
287
298
|
};
|
|
288
|
-
//# sourceMappingURL=chunk-
|
|
299
|
+
//# sourceMappingURL=chunk-F4KVDZS3.js.map
|