@mattebox/player 0.8.0 → 0.9.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/dist/cdn/mattebox-player.min.js +3 -3
- package/dist/controls/icons.d.ts +5 -30
- package/dist/controls/icons.d.ts.map +1 -1
- package/dist/controls/icons.js +38 -29
- package/dist/controls/icons.js.map +1 -1
- package/dist/controls/menu.d.ts +11 -0
- package/dist/controls/menu.d.ts.map +1 -1
- package/dist/controls/menu.js +31 -5
- package/dist/controls/menu.js.map +1 -1
- package/dist/element.d.ts +36 -2
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +140 -24
- package/dist/element.js.map +1 -1
- package/dist/elements/audio-menu.d.ts.map +1 -1
- package/dist/elements/audio-menu.js +3 -1
- package/dist/elements/audio-menu.js.map +1 -1
- package/dist/elements/component.d.ts.map +1 -1
- package/dist/elements/component.js +10 -0
- package/dist/elements/component.js.map +1 -1
- package/dist/elements/control-bar.d.ts +2 -0
- package/dist/elements/control-bar.d.ts.map +1 -1
- package/dist/elements/control-bar.js +23 -7
- package/dist/elements/control-bar.js.map +1 -1
- package/dist/elements/current-time.d.ts.map +1 -1
- package/dist/elements/current-time.js +1 -1
- package/dist/elements/current-time.js.map +1 -1
- package/dist/elements/drm-badge.js +1 -1
- package/dist/elements/duration.d.ts.map +1 -1
- package/dist/elements/duration.js +6 -2
- package/dist/elements/duration.js.map +1 -1
- package/dist/elements/error-screen.js +1 -1
- package/dist/elements/live-button.js +1 -1
- package/dist/elements/marker-button.d.ts +3 -3
- package/dist/elements/marker-button.d.ts.map +1 -1
- package/dist/elements/marker-button.js +18 -22
- package/dist/elements/marker-button.js.map +1 -1
- package/dist/elements/quality-menu.js +1 -1
- package/dist/elements/quality-menu.js.map +1 -1
- package/dist/elements/scan-button.js +1 -1
- package/dist/elements/seek-bar.d.ts.map +1 -1
- package/dist/elements/seek-bar.js +5 -4
- package/dist/elements/seek-bar.js.map +1 -1
- package/dist/elements/shared.js +3 -3
- package/dist/elements/skip-button.js +2 -2
- package/dist/elements/skip-button.js.map +1 -1
- package/dist/elements/spinner.js +1 -1
- package/dist/elements/start-button.d.ts +5 -0
- package/dist/elements/start-button.d.ts.map +1 -1
- package/dist/elements/start-button.js +15 -2
- package/dist/elements/start-button.js.map +1 -1
- package/dist/elements/subtitles-menu.d.ts +5 -1
- package/dist/elements/subtitles-menu.d.ts.map +1 -1
- package/dist/elements/subtitles-menu.js +29 -11
- package/dist/elements/subtitles-menu.js.map +1 -1
- package/dist/elements/title.d.ts.map +1 -1
- package/dist/elements/title.js +3 -1
- package/dist/elements/title.js.map +1 -1
- package/dist/elements/volume-slider.js +1 -1
- package/dist/elements/volume.js +1 -1
- package/dist/es2015/controls/icons.js +38 -29
- package/dist/es2015/controls/menu.js +32 -5
- package/dist/es2015/element.js +142 -28
- package/dist/es2015/elements/audio-menu.js +4 -1
- package/dist/es2015/elements/component.js +10 -0
- package/dist/es2015/elements/control-bar.js +23 -7
- package/dist/es2015/elements/current-time.js +1 -1
- package/dist/es2015/elements/drm-badge.js +1 -1
- package/dist/es2015/elements/duration.js +6 -2
- package/dist/es2015/elements/error-screen.js +1 -1
- package/dist/es2015/elements/live-button.js +1 -1
- package/dist/es2015/elements/marker-button.js +19 -23
- package/dist/es2015/elements/quality-menu.js +1 -1
- package/dist/es2015/elements/scan-button.js +1 -1
- package/dist/es2015/elements/seek-bar.js +5 -4
- package/dist/es2015/elements/shared.js +3 -3
- package/dist/es2015/elements/skip-button.js +2 -2
- package/dist/es2015/elements/spinner.js +1 -1
- package/dist/es2015/elements/start-button.js +15 -2
- package/dist/es2015/elements/subtitles-menu.js +35 -17
- package/dist/es2015/elements/title.js +3 -1
- package/dist/es2015/elements/volume-slider.js +1 -1
- package/dist/es2015/elements/volume.js +1 -1
- package/dist/es2015/style.js +1 -1
- package/dist/style.js +1 -1
- package/package.json +4 -5
- package/NOTICE +0 -24
package/dist/controls/icons.js
CHANGED
|
@@ -1,37 +1,46 @@
|
|
|
1
1
|
//#region src/controls/icons.ts
|
|
2
2
|
/**
|
|
3
3
|
* Each glyph's subpaths joined into one `d`. The path is drawn even-odd:
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* a frame, a ring or a letter cuts its hole with a nested subpath, and no
|
|
5
|
+
* two filled subpaths overlap.
|
|
6
6
|
*/
|
|
7
7
|
const PATHS = {
|
|
8
|
-
play: "
|
|
9
|
-
pause: "M8
|
|
10
|
-
replay: "
|
|
11
|
-
mute: "
|
|
12
|
-
"volume-low": "
|
|
13
|
-
"volume-high": "
|
|
14
|
-
fullscreen: "
|
|
15
|
-
"fullscreen-exit": "
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
"lock-closed": "
|
|
21
|
-
"seek-backward": "
|
|
22
|
-
"seek-forward": "
|
|
23
|
-
"seek-backward-
|
|
24
|
-
"seek-forward-
|
|
25
|
-
"seek-backward-
|
|
26
|
-
"seek-forward-
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
8
|
+
play: "M9 5L26 16L9 27z",
|
|
9
|
+
pause: "M8 6h5.5v20h-5.5zM18.5 6h5.5v20h-5.5z",
|
|
10
|
+
replay: "M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8z",
|
|
11
|
+
mute: "M4 12L9 12L16 6L16 26L9 20L4 20zM24 17.77L20.99 20.77L19.23 19.01L22.23 16L19.23 12.99L20.99 11.23L24 14.23L27.01 11.23L28.77 12.99L25.77 16L28.77 19.01L27.01 20.77z",
|
|
12
|
+
"volume-low": "M4 12L9 12L16 6L16 26L9 20L4 20zM21.13 10.87A7.25 7.25 0 0 1 21.13 21.13L19.36 19.36A4.75 4.75 0 0 0 19.36 12.64z",
|
|
13
|
+
"volume-high": "M4 12L9 12L16 6L16 26L9 20L4 20zM21.13 10.87A7.25 7.25 0 0 1 21.13 21.13L19.36 19.36A4.75 4.75 0 0 0 19.36 12.64zM24.31 7.69A11.75 11.75 0 0 1 24.31 24.31L22.54 22.54A9.25 9.25 0 0 0 22.54 9.46z",
|
|
14
|
+
fullscreen: "M5 5L14 5L11 8L8 8L8 11L5 14zM18 5L27 5L27 14L24 11L24 8L21 8zM5 18L8 21L8 24L11 24L14 27L5 27zM27 18L27 27L18 27L21 24L24 24L24 21z",
|
|
15
|
+
"fullscreen-exit": "M13 4L13 13L4 13L7 10L10 10L10 7zM19 4L22 7L22 10L25 10L28 13L19 13zM4 19L13 19L13 28L10 25L10 22L7 22zM19 19L28 19L25 22L22 22L22 25L19 28z",
|
|
16
|
+
quality: "M5 22L10 18.1L10 27L5 27zM13.5 15.4L18.5 11.6L18.5 27L13.5 27zM22 8.9L27 5L27 27L22 27z",
|
|
17
|
+
audio: "M4.75 13h2.5v6h-2.5zM9.75 9h2.5v14h-2.5zM14.75 5h2.5v22h-2.5zM19.75 10.5h2.5v11h-2.5zM24.75 13.5h2.5v5h-2.5z",
|
|
18
|
+
subtitles: "M4 6h20l4 4v16H4zM6.5 8.5H22.96L25.5 11.04V23.5H6.5zM9 14h8v2.5h-8zM19 14h4v2.5h-4zM9 18.5h4v2.5h-4zM15 18.5h8v2.5h-8z",
|
|
19
|
+
"subtitles-on": "M4 6h20l4 4v16H4zM9 14h8v2.5h-8zM19 14h4v2.5h-4zM9 18.5h4v2.5h-4zM15 18.5h8v2.5h-8z",
|
|
20
|
+
"lock-closed": "M7 14h18v13H7zM14.75 18.5v4.5h2.5v-4.5zM9.75 14V11A6.25 6.25 0 0 1 22.25 11V14H19.75V11A3.75 3.75 0 0 0 12.25 11V14z",
|
|
21
|
+
"seek-backward": "M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8z",
|
|
22
|
+
"seek-forward": "M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5z",
|
|
23
|
+
"seek-backward-5": "M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM13 13.5h6v2h-6zM13 15.5h2v0.5h-2zM13 16h6v2h-6zM17 18h2v0.5h-2zM13 18.5h6v2h-6z",
|
|
24
|
+
"seek-forward-5": "M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM13 13.5h6v2h-6zM13 15.5h2v0.5h-2zM13 16h6v2h-6zM17 18h2v0.5h-2zM13 18.5h6v2h-6z",
|
|
25
|
+
"seek-backward-10": "M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM11.5 13.5h2.2v7h-2.2zM15.5 13.5h5.5v7h-5.5zM17.6 15.6v2.8h1.3v-2.8z",
|
|
26
|
+
"seek-forward-10": "M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM11.5 13.5h2.2v7h-2.2zM15.5 13.5h5.5v7h-5.5zM17.6 15.6v2.8h1.3v-2.8z",
|
|
27
|
+
"seek-backward-15": "M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM10.5 13.5h2.2v7h-2.2zM14.7 13.5h5.8v2h-5.8zM14.7 15.5h2v0.5h-2zM14.7 16h5.8v2h-5.8zM18.5 18h2v0.5h-2zM14.7 18.5h5.8v2h-5.8z",
|
|
28
|
+
"seek-forward-15": "M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM10.5 13.5h2.2v7h-2.2zM14.7 13.5h5.8v2h-5.8zM14.7 15.5h2v0.5h-2zM14.7 16h5.8v2h-5.8zM18.5 18h2v0.5h-2zM14.7 18.5h5.8v2h-5.8z",
|
|
29
|
+
"seek-backward-30": "M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM13 13.5h2v7h-2zM10 13.5h3v2h-3zM11 16h2v2h-2zM10 18.5h3v2h-3zM16.5 13.5h5.5v7h-5.5zM18.6 15.6v2.8h1.3v-2.8z",
|
|
30
|
+
"seek-forward-30": "M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM13 13.5h2v7h-2zM10 13.5h3v2h-3zM11 16h2v2h-2zM10 18.5h3v2h-3zM16.5 13.5h5.5v7h-5.5zM18.6 15.6v2.8h1.3v-2.8z",
|
|
31
|
+
"playback-speed": "M7.69 26.31A11.75 11.75 0 1 1 24.31 26.31L22.54 24.54A9.25 9.25 0 1 0 9.46 24.54zM16.41 20.31L21.14 11.87L13.66 17.99z",
|
|
32
|
+
"picture-in-picture": "M4 6h24v20H4zM6.5 8.5v15h19v-15zM15 15h8v6h-8z",
|
|
33
|
+
"picture-in-picture-exit": "M4 6h24v20H4zM6.5 8.5v15h19v-15zM9.5 11.5L16 11.5L9.5 18zM13.63 13.87L19.29 19.52L17.52 21.29L11.87 15.63z",
|
|
34
|
+
airplay: "M4 6H28V23.25H23V20.75H25.5V8.5H6.5V20.75H9V23.25H4zM16 17.5L23.5 27L8.5 27z",
|
|
35
|
+
"airplay-active": "M4 6H28V23.25H22.1L16 15.5L9.9 23.25H4zM16 17.5L23.5 27L8.5 27z",
|
|
36
|
+
chapters: "M5 6.5h4v4h-4zM12 7.25h15v2.5h-15zM5 14h4v4h-4zM12 14.75h15v2.5h-15zM5 21.5h4v4h-4zM12 22.25h15v2.5h-15z",
|
|
37
|
+
"fast-forward": "M4 7L15 16L4 25zM16 7L27 16L16 25z",
|
|
38
|
+
"fast-backward": "M28 7L17 16L28 25zM16 7L5 16L16 25z",
|
|
39
|
+
"audio-description": "M1.5 23L4.8 9h2.6L10.7 23H8.4l-.75-3.2H4.55L3.8 23zM5.1 17.4h2L6.1 12.9zM12.2 9h2.8a7 7 0 0 1 0 14h-2.8zM14.6 11.4v9.2h.4a4.6 4.6 0 0 0 0-9.2zM24.2 9.96A9.4 9.4 0 0 1 24.2 22.04L22.82 20.89A7.6 7.6 0 0 0 22.82 11.11zM27.11 7.52A13.2 13.2 0 0 1 27.11 24.48L25.73 23.33A11.4 11.4 0 0 0 25.73 8.67z",
|
|
40
|
+
sdh: "M9.7 13.2L10.3 10.4L11.6 8.5L13.6 7.2L16 6.8L18.7 7.3L20.8 8.6L22.2 10.6L22.7 13L22.5 14.9L21.8 16.3L20.8 17.5L19.6 18.7L18.5 19.9L17.9 21.3L17.5 22.5L17.1 23.5L16.7 24.5L16 25.2L15.2 25.6L14.3 25.7L13.3 25.6L12.6 25.1L12 24.4L11.7 23.4L9.3 24.2L9.8 25.7L10.9 27L12.5 27.9L14.3 28.3L16 28L17.6 27.2L18.7 26L19.5 24.5L19.8 23.3L20.2 22.2L20.6 21.3L21.4 20.3L22.6 19.2L23.9 17.7L24.9 15.7L25.3 13L24.6 9.5L22.6 6.7L19.6 4.9L16 4.2L12.7 4.9L9.9 6.6L7.9 9.4L7.3 12.8zM13.7 13.2L13.9 12.1L14.4 11.4L15.1 10.9L16 10.8L16.9 10.9L17.6 11.4L18.1 12.1L18.3 13.2L20.7 12.8L20.4 11.1L19.4 9.6L17.9 8.6L16 8.2L14.1 8.6L12.6 9.6L11.6 11.1L11.3 12.8z",
|
|
41
|
+
"closed-captions": "M14.24 20.24A6 6 0 1 1 14.24 11.76L12.47 13.53A3.5 3.5 0 1 0 12.47 18.47zM26.24 20.24A6 6 0 1 1 26.24 11.76L24.47 13.53A3.5 3.5 0 1 0 24.47 18.47z",
|
|
42
|
+
"text-size": "M2.5 23L5.9 13L8.1 13L11.5 23zM7 16.53L7.64 18.4L6.36 18.4zM5.65 20.5L8.35 20.5L9.2 23L4.8 23zM12.5 23L19.5 6L22.5 6L29.5 23zM21 9.64L23.45 15.6L18.55 15.6zM17.48 18.2L24.52 18.2L26.5 23L15.5 23z",
|
|
43
|
+
"text-background": "M4 6h24v20h-24zM9 22.5L14.6 9.5L17.4 9.5L23 22.5zM16 12.75L17.66 16.6L14.34 16.6zM13.35 18.9L18.65 18.9L20.2 22.5L11.8 22.5z"
|
|
35
44
|
};
|
|
36
45
|
const SVG = "http://www.w3.org/2000/svg";
|
|
37
46
|
/** A glyph, hidden from the accessibility tree: the button it sits in carries the name. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","names":[],"sources":["../../src/controls/icons.ts"],"sourcesContent":["/**\n * The glyphs, copied from Vidstack's media-icons 0.10.0\n * (https://github.com/vidstack/media-icons): filled paths on a 32-unit\n * viewBox, drawn for a control bar, one visual weight across the set.\n * The paths went through svgo's path optimizer at 3 decimals: the\n * originals carry 4 to 6, which no screen shows on a 32-unit grid, and\n * cost about 4 kB of the bundle. Copied, not depended on. The notice below is the license's one condition,\n * and packages/player/NOTICE repeats it for the published tarball.\n *\n * MIT License\n *\n * Copyright (c) 2023 Rahim Alwer\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nexport type IconName =\n | 'play'\n | 'pause'\n | 'replay'\n | 'mute'\n | 'volume-low'\n | 'volume-high'\n | 'fullscreen'\n | 'fullscreen-exit'\n | 'settings'\n | 'music'\n | 'closed-captions'\n | 'closed-captions-on'\n | 'lock-closed'\n | 'seek-backward'\n | 'seek-forward'\n | 'seek-backward-10'\n | 'seek-forward-10'\n | 'seek-backward-30'\n | 'seek-forward-30'\n | 'playback-speed'\n | 'picture-in-picture'\n | 'picture-in-picture-exit'\n | 'airplay'\n | 'airplay-active'\n | 'chapters'\n | 'fast-forward'\n | 'fast-backward';\n\n/**\n * Each glyph's subpaths joined into one `d`. The path is drawn even-odd:\n * the gear, the note, the captions and the lock cut holes with a nested\n * subpath, and the rest have disjoint subpaths, where the rule is moot.\n */\nconst PATHS: Readonly<Record<IconName, string>> = {\n play: 'M10.667 6.655a.667.667 0 0 1 1.063-.536l12.647 9.344c.36.267.36.806 0 1.073L11.73 25.88a.667.667 0 0 1-1.063-.536z',\n pause:\n 'M8.667 6.667A.667.667 0 0 0 8 7.333v17.334c0 .368.298.666.667.666h4a.667.667 0 0 0 .666-.666V7.333a.667.667 0 0 0-.666-.666zm10.666 0a.667.667 0 0 0-.666.666v17.334c0 .368.298.666.666.666h4a.667.667 0 0 0 .667-.666V7.333a.667.667 0 0 0-.667-.666z',\n replay:\n 'M15.604 12.215a.667.667 0 0 0 1.063-.536v-1.5c0-.079.068-.14.146-.131a6.669 6.669 0 1 1-7.448 7.284c-.036-.367-.331-.666-.7-.666H6.667c-.369 0-.67.3-.645.667.343 5.212 4.68 9.334 9.978 9.334 5.523 0 10-4.478 10-10 0-5.257-4.056-9.566-9.208-9.97a.135.135 0 0 1-.125-.133V4.988a.667.667 0 0 0-1.063-.536l-4.527 3.345a.667.667 0 0 0 0 1.073z',\n mute: 'M17.51 24.66a.667.667 0 0 1-1.064.536l-6.998-5.17a.13.13 0 0 0-.079-.027H4.667A.667.667 0 0 1 4 19.333v-6.667c0-.368.298-.667.667-.667H9.37q.044 0 .08-.026l6.995-5.17a.667.667 0 0 1 1.063.537zm11.352-11.018a.667.667 0 0 0 0-.943l-.943-.942a.667.667 0 0 0-.942 0l-2.264 2.263a.134.134 0 0 1-.188 0l-2.263-2.263a.667.667 0 0 0-.943 0l-.943.943a.667.667 0 0 0 0 .942l2.263 2.263a.133.133 0 0 1 0 .189l-2.262 2.262a.667.667 0 0 0 0 .943l.943.943c.26.26.682.26.942 0l2.263-2.262a.133.133 0 0 1 .188 0l2.263 2.262c.26.26.683.26.943 0l.943-.943a.667.667 0 0 0 0-.943l-2.263-2.262a.133.133 0 0 1 0-.189z',\n 'volume-low':\n 'M17.51 24.66a.667.667 0 0 1-1.064.536l-6.998-5.17a.13.13 0 0 0-.079-.027H4.667A.667.667 0 0 1 4 19.332v-6.666c0-.368.298-.667.667-.667H9.37q.044 0 .08-.026l6.995-5.17a.667.667 0 0 1 1.063.537zm5.332-11.993a.667.667 0 0 0-.666-.667h-1.334a.667.667 0 0 0-.666.667v6.666c0 .369.298.667.666.667h1.334a.667.667 0 0 0 .666-.667z',\n 'volume-high':\n 'M17.51 24.66a.667.667 0 0 1-1.064.536l-6.998-5.17a.13.13 0 0 0-.079-.027H4.667A.667.667 0 0 1 4 19.333v-6.667c0-.368.298-.667.667-.667H9.37q.044 0 .08-.026l6.995-5.17a.667.667 0 0 1 1.063.537zm10-15.327c.367 0 .666.299.666.667v12a.667.667 0 0 1-.667.667h-1.333a.667.667 0 0 1-.667-.667V10c0-.368.299-.667.667-.667zM22.175 12c.368 0 .666.299.666.667v6.666a.667.667 0 0 1-.666.667h-1.334a.667.667 0 0 1-.666-.667v-6.666c0-.368.298-.667.666-.667z',\n fullscreen:\n 'M25.33 7.265a.667.667 0 0 0-.663-.598h-5.334a.667.667 0 0 0-.666.666v2c0 .369.298.667.666.667h2.534c.073 0 .133.06.133.133v2.534c0 .368.299.666.667.666h2a.667.667 0 0 0 .666-.666V7.333zM22 21.867c0 .073-.06.133-.133.133h-2.534a.667.667 0 0 0-.666.667v2c0 .368.298.666.666.666h5.334a.667.667 0 0 0 .666-.666v-5.334a.667.667 0 0 0-.666-.666h-2a.667.667 0 0 0-.667.666zM12.667 22h-2.534a.133.133 0 0 1-.133-.133v-2.534a.667.667 0 0 0-.667-.666h-2a.667.667 0 0 0-.666.666v5.334c0 .368.298.666.666.666h5.334a.667.667 0 0 0 .666-.666v-2a.667.667 0 0 0-.666-.667M10 12.667v-2.534c0-.073.06-.133.133-.133h2.534a.667.667 0 0 0 .666-.667v-2a.667.667 0 0 0-.666-.666H7.333a.667.667 0 0 0-.666.666v5.334c0 .368.298.666.666.666h2a.667.667 0 0 0 .667-.666',\n 'fullscreen-exit':\n 'M19.333 13.333a.667.667 0 0 1-.666-.666V7.333c0-.368.298-.666.666-.666h2c.369 0 .667.298.667.666v2.534c0 .073.06.133.133.133h2.534c.368 0 .666.299.666.667v2a.667.667 0 0 1-.666.666zm-6 6a.667.667 0 0 0-.666-.666H7.333a.667.667 0 0 0-.666.666v2c0 .369.298.667.666.667h2.534c.073 0 .133.06.133.133v2.534c0 .368.299.666.667.666h2a.667.667 0 0 0 .666-.666zm5.334 5.334c0 .368.298.666.666.666h2a.667.667 0 0 0 .667-.666v-2.534c0-.073.06-.133.133-.133h2.534a.667.667 0 0 0 .666-.667v-2a.667.667 0 0 0-.666-.666h-5.334a.667.667 0 0 0-.666.666zm-8-11.334h2a.667.667 0 0 0 .666-.666V7.333a.667.667 0 0 0-.666-.666h-2a.667.667 0 0 0-.667.666v2.534c0 .073-.06.133-.133.133H7.333a.667.667 0 0 0-.666.667v2c0 .368.298.666.666.666z',\n settings:\n 'M13.572 5.333c-.33 0-.61.24-.659.566l-.507 3.32a.13.13 0 0 1-.068.098q-.15.08-.294.17a.14.14 0 0 1-.119.01l-3.13-1.22a.67.67 0 0 0-.819.288L5.55 12.769a.67.67 0 0 0 .16.853l2.624 2.1a.14.14 0 0 1 .05.109 8 8 0 0 0 0 .337.14.14 0 0 1-.05.108L5.71 18.379a.67.67 0 0 0-.16.853l2.427 4.204a.67.67 0 0 0 .82.288l3.129-1.221a.14.14 0 0 1 .119.01q.144.088.293.17c.037.02.062.056.068.097l.507 3.32c.05.326.33.566.66.566h4.853c.33 0 .61-.24.66-.566l.507-3.319a.14.14 0 0 1 .069-.098q.15-.08.294-.17a.14.14 0 0 1 .12-.01l3.127 1.22a.67.67 0 0 0 .82-.287l2.427-4.204a.67.67 0 0 0-.16-.854l-2.622-2.1a.14.14 0 0 1-.05-.108 7 7 0 0 0 0-.338.14.14 0 0 1 .05-.109l2.622-2.099a.67.67 0 0 0 .161-.854l-2.427-4.204a.67.67 0 0 0-.82-.287l-3.128 1.22a.14.14 0 0 1-.12-.011 8 8 0 0 0-.294-.171.14.14 0 0 1-.069-.098L19.085 5.9a.67.67 0 0 0-.659-.566zM16 20.285a4.286 4.286 0 1 0 0-8.572 4.286 4.286 0 0 0 0 8.572',\n music:\n 'M26.667 6A.667.667 0 0 0 26 5.333H11.333a.667.667 0 0 0-.666.667v11.571a.138.138 0 0 1-.193.125A4.667 4.667 0 1 0 13.334 22V8.667c0-.369.298-.667.666-.667h9.333c.369 0 .667.298.667.667v6.238a.138.138 0 0 1-.192.125 4.667 4.667 0 1 0 2.86 4.304zM22 21.333a2 2 0 1 0 0-4 2 2 0 0 0 0 4M8.667 24a2 2 0 1 0 0-4 2 2 0 0 0 0 4',\n 'closed-captions':\n 'M4.666 6.667A.667.667 0 0 0 4 7.334v17.333c0 .368.299.667.667.667h22.667a.667.667 0 0 0 .666-.667V7.334a.667.667 0 0 0-.666-.667zm4 14.666A.667.667 0 0 1 8 20.667v-9.334c0-.368.298-.666.667-.666H14c.368 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666h-3.2a.133.133 0 0 0-.133.134v5.066c0 .074.06.134.133.134H14c.368 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666zm9.334 0a.667.667 0 0 1-.667-.666v-9.334c0-.368.299-.666.667-.666h5.333c.369 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666h-3.2a.133.133 0 0 0-.133.134v5.066c0 .074.06.134.133.134h3.2c.369 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666z',\n 'closed-captions-on':\n 'M8 28c0-.368.298-.666.667-.666h14.666c.369 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666H8.667A.667.667 0 0 1 8 29.334zM4.666 6.667a.667.667 0 0 0-.667.667v17.333c0 .368.299.667.667.667h22.667a.667.667 0 0 0 .666-.667V7.334a.667.667 0 0 0-.666-.667zm4 14.666A.667.667 0 0 1 8 20.667v-9.334c0-.368.298-.666.667-.666H14c.368 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666h-3.2a.133.133 0 0 0-.133.134v5.066c0 .074.06.134.133.134H14c.368 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666zm9.334 0a.667.667 0 0 1-.667-.666v-9.334c0-.368.299-.666.667-.666h5.333c.368 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666h-3.2a.133.133 0 0 0-.133.134v5.066c0 .074.06.134.133.134h3.2c.368 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666z',\n 'lock-closed':\n 'M16 4a6.667 6.667 0 0 1 6.665 6.533.136.136 0 0 0 .135.134h1.867c.368 0 .666.298.666.666V26a.667.667 0 0 1-.666.667H7.333A.667.667 0 0 1 6.667 26V11.333c0-.368.298-.666.666-.666H9.2c.074 0 .133-.06.135-.134A6.667 6.667 0 0 1 16 4m-3.998 6.533a.13.13 0 0 0 .131.134h7.734a.13.13 0 0 0 .13-.134 4 4 0 0 0-7.995 0M9.333 14c0-.368.299-.667.667-.667h12c.368 0 .667.299.667.667v9.333A.667.667 0 0 1 22 24H10a.667.667 0 0 1-.667-.667z',\n 'seek-backward':\n 'M15.604 12.215a.667.667 0 0 0 1.063-.536v-1.5c0-.079.068-.14.146-.131a6.669 6.669 0 1 1-7.448 7.284c-.036-.367-.331-.666-.7-.666H6.667c-.369 0-.67.3-.645.667.343 5.212 4.68 9.334 9.978 9.334 5.523 0 10-4.478 10-10 0-5.257-4.056-9.566-9.208-9.97a.135.135 0 0 1-.125-.133V4.988a.667.667 0 0 0-1.063-.536l-4.527 3.345a.667.667 0 0 0 0 1.073z',\n 'seek-forward':\n 'M16.417 12.215a.667.667 0 0 1-1.063-.536v-1.5a.13.13 0 0 0-.147-.131 6.668 6.668 0 1 0 7.448 7.284c.037-.367.332-.666.7-.666h1.999c.368 0 .669.3.645.667-.343 5.212-4.68 9.334-9.978 9.334-5.523 0-10-4.478-10-10 0-5.257 4.055-9.566 9.208-9.97a.135.135 0 0 0 .125-.133V4.988a.667.667 0 0 1 1.063-.536l4.527 3.345c.36.267.36.806 0 1.073z',\n 'seek-backward-10':\n 'M16.667 10.345a.667.667 0 0 1-1.063.536l-4.527-3.345a.667.667 0 0 1 0-1.072l4.527-3.345a.667.667 0 0 1 1.063.536v1.572c0 .07.055.129.126.134 5.89.407 10.54 5.313 10.54 11.306C27.333 22.926 22.26 28 16 28 9.965 28 5.031 23.283 4.686 17.334a.64.64 0 0 1 .647-.667h2c.369 0 .664.3.694.667a8 8 0 1 0 8.784-8.627.132.132 0 0 0-.144.132zm.42 9.334q.552.36 1.313.36.765 0 1.313-.357.55-.36.85-1.043.297-.681.298-1.642.003-.954-.296-1.625-.299-.67-.852-1.02Q19.163 14 18.4 14q-.761 0-1.312.352-.549.35-.847 1.02-.295.668-.298 1.625t.295 1.64q.3.678.85 1.042m2.05-1.253q-.282.463-.737.463a.78.78 0 0 1-.53-.204q-.231-.208-.359-.628-.125-.42-.122-1.06.003-.943.281-1.397.28-.458.73-.458.304 0 .532.202.227.201.355.613.128.41.128 1.04.003.963-.279 1.43m-5.362 1.472c.073 0 .133-.06.133-.134v-5.551a.133.133 0 0 0-.133-.133h-1.133a.13.13 0 0 0-.07.02l-1.34.832a.13.13 0 0 0-.063.114v.904c0 .104.114.168.203.114l1.092-.668a.027.027 0 0 1 .04.023v4.345c0 .074.06.134.134.134z',\n 'seek-forward-10':\n 'M15.333 10.345c0 .547.623.862 1.063.536l4.527-3.345a.667.667 0 0 0 0-1.072l-4.527-3.345a.667.667 0 0 0-1.063.536v1.572c0 .07-.055.129-.126.134-5.89.407-10.54 5.313-10.54 11.306C4.667 22.926 9.74 28 16 28c6.035 0 10.969-4.717 11.314-10.666a.64.64 0 0 0-.647-.667h-2c-.369 0-.664.3-.694.667a8 8 0 1 1-8.784-8.627.132.132 0 0 1 .144.132zm1.755 9.334q.551.36 1.312.36.765 0 1.313-.357.55-.36.85-1.043.297-.681.298-1.642.003-.954-.296-1.625-.299-.67-.852-1.02Q19.163 14 18.4 14q-.761 0-1.312.352-.549.35-.847 1.02-.295.668-.298 1.625t.295 1.64q.3.678.85 1.042m2.048-1.253q-.281.463-.736.463a.78.78 0 0 1-.53-.204q-.231-.208-.359-.628-.125-.42-.122-1.06.003-.943.281-1.397.28-.458.73-.458.304 0 .532.202.227.201.355.613.128.41.128 1.04.003.963-.279 1.43m-5.361 1.472c.073 0 .133-.06.133-.134v-5.551a.133.133 0 0 0-.133-.133h-1.133a.13.13 0 0 0-.07.02l-1.34.832a.13.13 0 0 0-.063.114v.904c0 .104.114.168.203.114l1.092-.668a.027.027 0 0 1 .04.023v4.345c0 .074.06.134.134.134z',\n 'seek-backward-30':\n 'M16.667 10.345a.667.667 0 0 1-1.063.536l-4.527-3.345a.667.667 0 0 1 0-1.072l4.527-3.345a.667.667 0 0 1 1.063.536v1.572c0 .07.055.129.126.134 5.89.407 10.54 5.313 10.54 11.306C27.333 22.926 22.26 28 16 28 9.965 28 5.031 23.283 4.686 17.334a.64.64 0 0 1 .647-.667h2c.369 0 .664.3.694.667a8 8 0 1 0 8.784-8.627.132.132 0 0 0-.144.132zm-5.083 9.405a2.9 2.9 0 0 0 1.18.227q.681 0 1.207-.221.528-.225.824-.614.298-.391.298-.898a1.23 1.23 0 0 0-.344-.895q-.337-.351-.997-.434a.026.026 0 0 1-.023-.026q.002-.021.023-.026.49-.078.804-.389.324-.318.321-.81 0-.474-.264-.849a1.8 1.8 0 0 0-.739-.596 2.6 2.6 0 0 0-1.1-.219q-.626 0-1.118.225-.49.225-.773.622a1.53 1.53 0 0 0-.284.78.126.126 0 0 0 .129.134h1.08c.071 0 .129-.058.145-.128a.6.6 0 0 1 .1-.221.7.7 0 0 1 .299-.233q.19-.082.423-.082.221 0 .39.082a.62.62 0 0 1 .357.577.6.6 0 0 1-.108.358.7.7 0 0 1-.31.238q-.196.085-.454.085h-.432a.133.133 0 0 0-.133.134v.733c0 .074.06.134.133.134h.432q.295 0 .511.088a.77.77 0 0 1 .338.247q.12.159.117.363a.6.6 0 0 1-.105.364.74.74 0 0 1-.301.247 1 1 0 0 1-.44.088q-.251 0-.447-.082a.76.76 0 0 1-.31-.227.6.6 0 0 1-.103-.212c-.018-.07-.075-.127-.146-.127H10.61a.126.126 0 0 0-.128.135q.037.444.295.794.296.404.806.634m6.196-.071q.552.36 1.313.36.765 0 1.312-.357.551-.36.85-1.043.297-.681.298-1.642.003-.954-.296-1.625-.299-.67-.852-1.02-.55-.352-1.311-.352t-1.313.352q-.548.35-.847 1.02-.295.668-.298 1.625t.296 1.64q.298.678.85 1.042m2.048-1.253q-.28.463-.735.463a.78.78 0 0 1-.532-.204q-.23-.208-.358-.628-.125-.42-.122-1.06.003-.943.282-1.397.277-.458.73-.458.304 0 .53.202.227.201.356.613.128.41.128 1.04.003.963-.279 1.43',\n 'seek-forward-30':\n 'M15.333 10.345c0 .547.623.862 1.063.536l4.528-3.345a.667.667 0 0 0 0-1.072l-4.528-3.345a.667.667 0 0 0-1.063.536v1.572c0 .07-.055.129-.126.134-5.89.407-10.54 5.313-10.54 11.306C4.667 22.926 9.74 28 16 28c6.035 0 10.969-4.717 11.314-10.666a.64.64 0 0 0-.647-.667h-2c-.369 0-.664.3-.694.667a8 8 0 1 1-8.784-8.627.132.132 0 0 1 .144.132zm-3.748 9.405a2.9 2.9 0 0 0 1.178.227q.682 0 1.208-.221.528-.225.824-.614.298-.391.298-.898a1.23 1.23 0 0 0-.344-.895q-.337-.351-.997-.434a.026.026 0 0 1-.023-.026q.002-.021.023-.026.49-.078.804-.389.324-.318.321-.81 0-.474-.264-.849a1.8 1.8 0 0 0-.739-.596 2.6 2.6 0 0 0-1.1-.219q-.626 0-1.118.225-.49.225-.773.622a1.53 1.53 0 0 0-.284.78.126.126 0 0 0 .129.134h1.08c.071 0 .129-.058.145-.128a.6.6 0 0 1 .1-.221.7.7 0 0 1 .299-.233q.19-.082.423-.082.221 0 .39.082a.62.62 0 0 1 .357.577.6.6 0 0 1-.108.358.7.7 0 0 1-.31.238q-.196.085-.454.085h-.432a.133.133 0 0 0-.133.134v.733c0 .074.06.134.133.134h.432q.295 0 .511.088a.77.77 0 0 1 .338.247q.12.159.117.363a.6.6 0 0 1-.105.364.74.74 0 0 1-.301.247 1 1 0 0 1-.44.088q-.251 0-.447-.082a.76.76 0 0 1-.31-.227.6.6 0 0 1-.103-.212c-.018-.07-.075-.127-.146-.127H10.61a.126.126 0 0 0-.128.135q.037.444.295.794.296.404.806.634m6.195-.071q.552.36 1.313.36.765 0 1.312-.357.551-.36.85-1.043.297-.681.298-1.642.003-.954-.296-1.625-.299-.67-.852-1.02-.549-.352-1.31-.352t-1.313.352q-.548.35-.847 1.02-.295.668-.298 1.625t.296 1.64q.298.678.85 1.042m2.048-1.253q-.28.463-.735.463a.78.78 0 0 1-.532-.204q-.23-.208-.358-.628-.125-.42-.122-1.06.003-.943.282-1.397.277-.458.73-.458.304 0 .53.202.227.201.356.613.128.41.128 1.04.003.963-.279 1.43',\n 'playback-speed':\n 'M13.921 5.536c.394-.078.746.234.746.635v1.401c0 .326-.236.6-.553.677a8 8 0 0 0-3.905 2.257.71.71 0 0 1-.862.14l-1.206-.697c-.347-.2-.441-.661-.177-.963a10.66 10.66 0 0 1 5.957-3.45M5.89 12.59c.128-.38.575-.53.923-.33l1.199.693a.71.71 0 0 1 .31.816A8 8 0 0 0 8 16.026c0 .783.113 1.54.322 2.255a.71.71 0 0 1-.31.817l-1.185.684c-.346.2-.792.052-.922-.327A10.7 10.7 0 0 1 5.333 16c0-1.192.196-2.339.557-3.41m2.281 9.494c-.348.201-.442.664-.176.965a10.66 10.66 0 0 0 5.926 3.414c.394.078.746-.234.746-.635v-1.35c0-.325-.236-.6-.553-.677a8 8 0 0 1-3.905-2.257.71.71 0 0 0-.862-.139zm9.162 3.744c0 .401.353.713.746.635 4.896-.967 8.588-5.284 8.588-10.464s-3.692-9.497-8.588-10.464c-.393-.078-.746.234-.746.635v1.401c0 .326.237.6.553.677a8.003 8.003 0 0 1 0 15.553.71.71 0 0 0-.553.677zm-2.937-15.413a.667.667 0 0 0-1.063.537v10.094c0 .548.623.862 1.063.537l6.831-5.048a.667.667 0 0 0 0-1.073z',\n 'picture-in-picture':\n 'M16 15.333a.667.667 0 0 0-.667.667v4c0 .368.299.667.667.667h5.333A.667.667 0 0 0 22 20v-4a.667.667 0 0 0-.667-.667zm-10.667-8c0-.368.299-.666.667-.666h20c.368 0 .667.298.667.666v17.334a.667.667 0 0 1-.667.666H6a.667.667 0 0 1-.667-.666zM8 10c0-.368.298-.667.667-.667h14.666c.369 0 .667.299.667.667v12a.667.667 0 0 1-.667.667H8.667A.667.667 0 0 1 8 22z',\n 'picture-in-picture-exit':\n 'M5.333 26v-6.533c0-.074.06-.134.134-.134h2.4c.073 0 .133.06.133.134v3.866c0 .369.298.667.667.667h14.666a.667.667 0 0 0 .667-.667V8.667A.667.667 0 0 0 23.333 8h-3.866a.133.133 0 0 1-.134-.133v-2.4c0-.074.06-.134.134-.134H26c.368 0 .667.299.667.667v20a.667.667 0 0 1-.667.667H6A.667.667 0 0 1 5.333 26M14.01 8.424h-3.204a.133.133 0 0 0-.094.227l5.837 5.838c.26.26.26.682 0 .942l-1.226 1.226a.667.667 0 0 1-.942 0l-5.744-5.743a.133.133 0 0 0-.227.094v3.016a.667.667 0 0 1-.667.666H6.01a.667.667 0 0 1-.667-.666v-8c0-.369.299-.667.667-.667h8c.368 0 .666.298.666.667v1.733a.667.667 0 0 1-.666.667',\n airplay:\n 'M5.333 6c0-.368.299-.667.667-.667h20c.368 0 .667.299.667.667v14.667a.667.667 0 0 1-.667.666h-2.293c-.211 0-.41-.1-.536-.27l-.985-1.333a.667.667 0 0 1 .536-1.063h.611A.667.667 0 0 0 24 18V8.667A.667.667 0 0 0 23.333 8H8.667A.667.667 0 0 0 8 8.667V18c0 .368.298.667.667.667h.627c.547 0 .86.622.536 1.063l-.985 1.333a.67.67 0 0 1-.537.27H6a.667.667 0 0 1-.667-.666zm3.452 19.604a.667.667 0 0 0 .536 1.063H22.68a.667.667 0 0 0 .536-1.063l-6.68-9.039a.667.667 0 0 0-1.072 0z',\n // The active glyph is the same drawing with the screen filled in.\n 'airplay-active':\n 'M5.333 6c0-.368.299-.667.667-.667h20c.368 0 .667.299.667.667v14.667a.667.667 0 0 1-.667.666H6a.667.667 0 0 1-.667-.666zm3.452 19.604a.667.667 0 0 0 .536 1.063H22.68a.667.667 0 0 0 .536-1.063l-6.68-9.039a.667.667 0 0 0-1.072 0z',\n chapters:\n 'M16.693 25.335a.667.667 0 0 1-.667-.667V7.335c0-.369.299-.667.667-.667h2c.368 0 .666.298.666.667v17.333a.667.667 0 0 1-.666.667zm7.333 0a.667.667 0 0 1-.667-.667V7.335c0-.369.299-.667.667-.667h2c.368 0 .667.298.667.667v17.333a.667.667 0 0 1-.667.667zM5.481 23.94a.667.667 0 0 0 .472.816l1.931.518a.667.667 0 0 0 .817-.472L13.187 8.06a.667.667 0 0 0-.471-.817l-1.932-.517a.667.667 0 0 0-.817.47z',\n 'fast-forward':\n 'M16.125 8.119a.667.667 0 0 0-1.062.536v5.603a.134.134 0 0 1-.213.107L6.396 8.119a.667.667 0 0 0-1.063.536v14.69c0 .547.623.861 1.063.536l8.454-6.246a.133.133 0 0 1 .213.107v5.603c0 .547.622.861 1.062.536l9.941-7.345a.667.667 0 0 0 0-1.073z',\n 'fast-backward':\n 'M15.875 8.119a.667.667 0 0 1 1.063.536v5.603c0 .109.124.172.212.107l8.454-6.246a.667.667 0 0 1 1.063.536v14.69a.667.667 0 0 1-1.063.536l-8.454-6.246a.133.133 0 0 0-.212.107v5.603a.667.667 0 0 1-1.063.536l-9.941-7.345a.667.667 0 0 1 0-1.073z',\n};\n\nconst SVG = 'http://www.w3.org/2000/svg';\n\n/** A glyph, hidden from the accessibility tree: the button it sits in carries the name. */\nexport function icon(name: IconName): SVGSVGElement {\n const svg = document.createElementNS(SVG, 'svg');\n svg.setAttribute('viewBox', '0 0 32 32');\n svg.setAttribute('aria-hidden', 'true');\n svg.setAttribute('part', 'icon');\n const path = document.createElementNS(SVG, 'path');\n path.setAttribute('fill-rule', 'evenodd');\n path.setAttribute('d', PATHS[name]);\n svg.append(path);\n return svg;\n}\n"],"mappings":";;;;;;AAkEA,MAAM,QAA4C;CAChD,MAAM;CACN,OACE;CACF,QACE;CACF,MAAM;CACN,cACE;CACF,eACE;CACF,YACE;CACF,mBACE;CACF,UACE;CACF,OACE;CACF,mBACE;CACF,sBACE;CACF,eACE;CACF,iBACE;CACF,gBACE;CACF,oBACE;CACF,mBACE;CACF,oBACE;CACF,mBACE;CACF,kBACE;CACF,sBACE;CACF,2BACE;CACF,SACE;CAEF,kBACE;CACF,UACE;CACF,gBACE;CACF,iBACE;AACJ;AAEA,MAAM,MAAM;;AAGZ,SAAgB,KAAK,MAA+B;CAClD,MAAM,MAAM,SAAS,gBAAgB,KAAK,KAAK;CAC/C,IAAI,aAAa,WAAW,WAAW;CACvC,IAAI,aAAa,eAAe,MAAM;CACtC,IAAI,aAAa,QAAQ,MAAM;CAC/B,MAAM,OAAO,SAAS,gBAAgB,KAAK,MAAM;CACjD,KAAK,aAAa,aAAa,SAAS;CACxC,KAAK,aAAa,KAAK,MAAM,KAAK;CAClC,IAAI,OAAO,IAAI;CACf,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"icons.js","names":[],"sources":["../../src/controls/icons.ts"],"sourcesContent":["/**\n * The glyphs, Mattebox's own drawings: filled paths on a 32-unit viewBox,\n * one visual weight across the set, with hard corners and 45 degree cuts\n * like the panels of the mark. Each is one path, so a glyph scales to any\n * size and takes the text colour.\n */\n\nexport type IconName =\n | 'play'\n | 'pause'\n | 'replay'\n | 'mute'\n | 'volume-low'\n | 'volume-high'\n | 'fullscreen'\n | 'fullscreen-exit'\n | 'quality'\n | 'audio'\n | 'subtitles'\n | 'subtitles-on'\n | 'lock-closed'\n | 'seek-backward'\n | 'seek-forward'\n | 'seek-backward-5'\n | 'seek-forward-5'\n | 'seek-backward-10'\n | 'seek-forward-10'\n | 'seek-backward-15'\n | 'seek-forward-15'\n | 'seek-backward-30'\n | 'seek-forward-30'\n | 'playback-speed'\n | 'picture-in-picture'\n | 'picture-in-picture-exit'\n | 'airplay'\n | 'airplay-active'\n | 'chapters'\n | 'fast-forward'\n | 'fast-backward'\n | 'audio-description'\n | 'sdh'\n | 'closed-captions'\n | 'text-size'\n | 'text-background';\n\n/**\n * Each glyph's subpaths joined into one `d`. The path is drawn even-odd:\n * a frame, a ring or a letter cuts its hole with a nested subpath, and no\n * two filled subpaths overlap.\n */\nconst PATHS: Readonly<Record<IconName, string>> = {\n play: 'M9 5L26 16L9 27z',\n pause: 'M8 6h5.5v20h-5.5zM18.5 6h5.5v20h-5.5z',\n replay:\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8z',\n mute: 'M4 12L9 12L16 6L16 26L9 20L4 20zM24 17.77L20.99 20.77L19.23 19.01L22.23 16L19.23 12.99L20.99 11.23L24 14.23L27.01 11.23L28.77 12.99L25.77 16L28.77 19.01L27.01 20.77z',\n 'volume-low':\n 'M4 12L9 12L16 6L16 26L9 20L4 20zM21.13 10.87A7.25 7.25 0 0 1 21.13 21.13L19.36 19.36A4.75 4.75 0 0 0 19.36 12.64z',\n 'volume-high':\n 'M4 12L9 12L16 6L16 26L9 20L4 20zM21.13 10.87A7.25 7.25 0 0 1 21.13 21.13L19.36 19.36A4.75 4.75 0 0 0 19.36 12.64zM24.31 7.69A11.75 11.75 0 0 1 24.31 24.31L22.54 22.54A9.25 9.25 0 0 0 22.54 9.46z',\n fullscreen:\n 'M5 5L14 5L11 8L8 8L8 11L5 14zM18 5L27 5L27 14L24 11L24 8L21 8zM5 18L8 21L8 24L11 24L14 27L5 27zM27 18L27 27L18 27L21 24L24 24L24 21z',\n 'fullscreen-exit':\n 'M13 4L13 13L4 13L7 10L10 10L10 7zM19 4L22 7L22 10L25 10L28 13L19 13zM4 19L13 19L13 28L10 25L10 22L7 22zM19 19L28 19L25 22L22 22L22 25L19 28z',\n quality:\n 'M5 22L10 18.1L10 27L5 27zM13.5 15.4L18.5 11.6L18.5 27L13.5 27zM22 8.9L27 5L27 27L22 27z',\n audio:\n 'M4.75 13h2.5v6h-2.5zM9.75 9h2.5v14h-2.5zM14.75 5h2.5v22h-2.5zM19.75 10.5h2.5v11h-2.5zM24.75 13.5h2.5v5h-2.5z',\n subtitles:\n 'M4 6h20l4 4v16H4zM6.5 8.5H22.96L25.5 11.04V23.5H6.5zM9 14h8v2.5h-8zM19 14h4v2.5h-4zM9 18.5h4v2.5h-4zM15 18.5h8v2.5h-8z',\n 'subtitles-on':\n 'M4 6h20l4 4v16H4zM9 14h8v2.5h-8zM19 14h4v2.5h-4zM9 18.5h4v2.5h-4zM15 18.5h8v2.5h-8z',\n 'lock-closed':\n 'M7 14h18v13H7zM14.75 18.5v4.5h2.5v-4.5zM9.75 14V11A6.25 6.25 0 0 1 22.25 11V14H19.75V11A3.75 3.75 0 0 0 12.25 11V14z',\n 'seek-backward':\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8z',\n 'seek-forward':\n 'M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5z',\n 'seek-backward-5':\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM13 13.5h6v2h-6zM13 15.5h2v0.5h-2zM13 16h6v2h-6zM17 18h2v0.5h-2zM13 18.5h6v2h-6z',\n 'seek-forward-5':\n 'M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM13 13.5h6v2h-6zM13 15.5h2v0.5h-2zM13 16h6v2h-6zM17 18h2v0.5h-2zM13 18.5h6v2h-6z',\n 'seek-backward-10':\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM11.5 13.5h2.2v7h-2.2zM15.5 13.5h5.5v7h-5.5zM17.6 15.6v2.8h1.3v-2.8z',\n 'seek-forward-10':\n 'M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM11.5 13.5h2.2v7h-2.2zM15.5 13.5h5.5v7h-5.5zM17.6 15.6v2.8h1.3v-2.8z',\n 'seek-backward-15':\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM10.5 13.5h2.2v7h-2.2zM14.7 13.5h5.8v2h-5.8zM14.7 15.5h2v0.5h-2zM14.7 16h5.8v2h-5.8zM18.5 18h2v0.5h-2zM14.7 18.5h5.8v2h-5.8z',\n 'seek-forward-15':\n 'M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM10.5 13.5h2.2v7h-2.2zM14.7 13.5h5.8v2h-5.8zM14.7 15.5h2v0.5h-2zM14.7 16h5.8v2h-5.8zM18.5 18h2v0.5h-2zM14.7 18.5h5.8v2h-5.8z',\n 'seek-backward-30':\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM13 13.5h2v7h-2zM10 13.5h3v2h-3zM11 16h2v2h-2zM10 18.5h3v2h-3zM16.5 13.5h5.5v7h-5.5zM18.6 15.6v2.8h1.3v-2.8z',\n 'seek-forward-30':\n 'M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM13 13.5h2v7h-2zM10 13.5h3v2h-3zM11 16h2v2h-2zM10 18.5h3v2h-3zM16.5 13.5h5.5v7h-5.5zM18.6 15.6v2.8h1.3v-2.8z',\n 'playback-speed':\n 'M7.69 26.31A11.75 11.75 0 1 1 24.31 26.31L22.54 24.54A9.25 9.25 0 1 0 9.46 24.54zM16.41 20.31L21.14 11.87L13.66 17.99z',\n 'picture-in-picture': 'M4 6h24v20H4zM6.5 8.5v15h19v-15zM15 15h8v6h-8z',\n 'picture-in-picture-exit':\n 'M4 6h24v20H4zM6.5 8.5v15h19v-15zM9.5 11.5L16 11.5L9.5 18zM13.63 13.87L19.29 19.52L17.52 21.29L11.87 15.63z',\n airplay: 'M4 6H28V23.25H23V20.75H25.5V8.5H6.5V20.75H9V23.25H4zM16 17.5L23.5 27L8.5 27z',\n 'airplay-active': 'M4 6H28V23.25H22.1L16 15.5L9.9 23.25H4zM16 17.5L23.5 27L8.5 27z',\n chapters:\n 'M5 6.5h4v4h-4zM12 7.25h15v2.5h-15zM5 14h4v4h-4zM12 14.75h15v2.5h-15zM5 21.5h4v4h-4zM12 22.25h15v2.5h-15z',\n 'fast-forward': 'M4 7L15 16L4 25zM16 7L27 16L16 25z',\n 'fast-backward': 'M28 7L17 16L28 25zM16 7L5 16L16 25z',\n 'audio-description':\n 'M1.5 23L4.8 9h2.6L10.7 23H8.4l-.75-3.2H4.55L3.8 23zM5.1 17.4h2L6.1 12.9zM12.2 9h2.8a7 7 0 0 1 0 14h-2.8zM14.6 11.4v9.2h.4a4.6 4.6 0 0 0 0-9.2zM24.2 9.96A9.4 9.4 0 0 1 24.2 22.04L22.82 20.89A7.6 7.6 0 0 0 22.82 11.11zM27.11 7.52A13.2 13.2 0 0 1 27.11 24.48L25.73 23.33A11.4 11.4 0 0 0 25.73 8.67z',\n sdh: 'M9.7 13.2L10.3 10.4L11.6 8.5L13.6 7.2L16 6.8L18.7 7.3L20.8 8.6L22.2 10.6L22.7 13L22.5 14.9L21.8 16.3L20.8 17.5L19.6 18.7L18.5 19.9L17.9 21.3L17.5 22.5L17.1 23.5L16.7 24.5L16 25.2L15.2 25.6L14.3 25.7L13.3 25.6L12.6 25.1L12 24.4L11.7 23.4L9.3 24.2L9.8 25.7L10.9 27L12.5 27.9L14.3 28.3L16 28L17.6 27.2L18.7 26L19.5 24.5L19.8 23.3L20.2 22.2L20.6 21.3L21.4 20.3L22.6 19.2L23.9 17.7L24.9 15.7L25.3 13L24.6 9.5L22.6 6.7L19.6 4.9L16 4.2L12.7 4.9L9.9 6.6L7.9 9.4L7.3 12.8zM13.7 13.2L13.9 12.1L14.4 11.4L15.1 10.9L16 10.8L16.9 10.9L17.6 11.4L18.1 12.1L18.3 13.2L20.7 12.8L20.4 11.1L19.4 9.6L17.9 8.6L16 8.2L14.1 8.6L12.6 9.6L11.6 11.1L11.3 12.8z',\n 'closed-captions':\n 'M14.24 20.24A6 6 0 1 1 14.24 11.76L12.47 13.53A3.5 3.5 0 1 0 12.47 18.47zM26.24 20.24A6 6 0 1 1 26.24 11.76L24.47 13.53A3.5 3.5 0 1 0 24.47 18.47z',\n 'text-size':\n 'M2.5 23L5.9 13L8.1 13L11.5 23zM7 16.53L7.64 18.4L6.36 18.4zM5.65 20.5L8.35 20.5L9.2 23L4.8 23zM12.5 23L19.5 6L22.5 6L29.5 23zM21 9.64L23.45 15.6L18.55 15.6zM17.48 18.2L24.52 18.2L26.5 23L15.5 23z',\n 'text-background':\n 'M4 6h24v20h-24zM9 22.5L14.6 9.5L17.4 9.5L23 22.5zM16 12.75L17.66 16.6L14.34 16.6zM13.35 18.9L18.65 18.9L20.2 22.5L11.8 22.5z',\n};\n\nconst SVG = 'http://www.w3.org/2000/svg';\n\n/** A glyph, hidden from the accessibility tree: the button it sits in carries the name. */\nexport function icon(name: IconName): SVGSVGElement {\n const svg = document.createElementNS(SVG, 'svg');\n svg.setAttribute('viewBox', '0 0 32 32');\n svg.setAttribute('aria-hidden', 'true');\n svg.setAttribute('part', 'icon');\n const path = document.createElementNS(SVG, 'path');\n path.setAttribute('fill-rule', 'evenodd');\n path.setAttribute('d', PATHS[name]);\n svg.append(path);\n return svg;\n}\n"],"mappings":";;;;;;AAkDA,MAAM,QAA4C;CAChD,MAAM;CACN,OAAO;CACP,QACE;CACF,MAAM;CACN,cACE;CACF,eACE;CACF,YACE;CACF,mBACE;CACF,SACE;CACF,OACE;CACF,WACE;CACF,gBACE;CACF,eACE;CACF,iBACE;CACF,gBACE;CACF,mBACE;CACF,kBACE;CACF,oBACE;CACF,mBACE;CACF,oBACE;CACF,mBACE;CACF,oBACE;CACF,mBACE;CACF,kBACE;CACF,sBAAsB;CACtB,2BACE;CACF,SAAS;CACT,kBAAkB;CAClB,UACE;CACF,gBAAgB;CAChB,iBAAiB;CACjB,qBACE;CACF,KAAK;CACL,mBACE;CACF,aACE;CACF,mBACE;AACJ;AAEA,MAAM,MAAM;;AAGZ,SAAgB,KAAK,MAA+B;CAClD,MAAM,MAAM,SAAS,gBAAgB,KAAK,KAAK;CAC/C,IAAI,aAAa,WAAW,WAAW;CACvC,IAAI,aAAa,eAAe,MAAM;CACtC,IAAI,aAAa,QAAQ,MAAM;CAC/B,MAAM,OAAO,SAAS,gBAAgB,KAAK,MAAM;CACjD,KAAK,aAAa,aAAa,SAAS;CACxC,KAAK,aAAa,KAAK,MAAM,KAAK;CAClC,IAAI,OAAO,IAAI;CACf,OAAO;AACT"}
|
package/dist/controls/menu.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export interface MenuGroup {
|
|
|
3
3
|
readonly name: string;
|
|
4
4
|
/** A heading, or none for a menu of one group. */
|
|
5
5
|
readonly label?: string;
|
|
6
|
+
/** The label names the group for a screen reader, and no heading is drawn. */
|
|
7
|
+
readonly hideLabel?: boolean;
|
|
6
8
|
/**
|
|
7
9
|
* Each item's id, its text, a detail drawn at its end, such as a chapter's
|
|
8
10
|
* time, the URL of a picture drawn at its start, and short badges drawn
|
|
@@ -11,12 +13,21 @@ export interface MenuGroup {
|
|
|
11
13
|
readonly items: ReadonlyArray<readonly [string, string, (string | undefined)?, (string | undefined)?, (readonly string[])?]>;
|
|
12
14
|
readonly value: string;
|
|
13
15
|
readonly onSelect: (value: string) => void;
|
|
16
|
+
/**
|
|
17
|
+
* The badges drawn as a glyph, by their text. The text stays in the
|
|
18
|
+
* badge for a screen reader and as its tooltip.
|
|
19
|
+
*/
|
|
20
|
+
readonly badgeGlyphs?: Readonly<Record<string, () => SVGSVGElement>>;
|
|
14
21
|
}
|
|
15
22
|
/** An entry that opens a page of groups, with a Back at its top. */
|
|
16
23
|
export interface MenuPage {
|
|
17
24
|
readonly name: string;
|
|
18
25
|
readonly label: string;
|
|
19
26
|
readonly entries: readonly MenuEntry[];
|
|
27
|
+
/** A glyph drawn before the label of the item that opens the page. */
|
|
28
|
+
readonly glyph?: () => SVGSVGElement;
|
|
29
|
+
/** A detail drawn at the end of that item, such as the value chosen on the page. */
|
|
30
|
+
readonly detail?: string;
|
|
20
31
|
}
|
|
21
32
|
export type MenuEntry = MenuGroup | MenuPage;
|
|
22
33
|
export interface MenuOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/controls/menu.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,SAAS;IACxB,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kDAAkD;IAClD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,aAAa,CAC3B,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC,CAC9F,CAAC;IACF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/controls/menu.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,SAAS;IACxB,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kDAAkD;IAClD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,8EAA8E;IAC9E,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,aAAa,CAC3B,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC,CAC9F,CAAC;IACF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KA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from "../dom.js";
|
|
|
25
25
|
/** Air between the popup's top and the picture's. */
|
|
26
26
|
const AIR = 8;
|
|
27
27
|
/**
|
|
28
|
-
* The tallest a popup grows, in pixels: about seven and a half rows, so
|
|
28
|
+
* The tallest a popup grows, in pixels: the title and about seven and a half rows, so
|
|
29
29
|
* the half row at the foot says the list goes on. A page sets its own
|
|
30
30
|
* with `--mbx-menu-max-height`.
|
|
31
31
|
*/
|
|
32
|
-
const MAX_HEIGHT =
|
|
32
|
+
const MAX_HEIGHT = 22;
|
|
33
33
|
/** An item's picture. Decorative: the item's text names it. Loaded when the popup first shows it. */
|
|
34
34
|
function picture(url) {
|
|
35
35
|
const node = el("img", "item-image");
|
|
@@ -79,10 +79,16 @@ function menu(options) {
|
|
|
79
79
|
* left of its right edge.
|
|
80
80
|
*/
|
|
81
81
|
function fit() {
|
|
82
|
+
if (host.getAttribute("layout") === "compact") {
|
|
83
|
+
popup.style.maxHeight = "";
|
|
84
|
+
popup.style.maxWidth = "";
|
|
85
|
+
more();
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
82
88
|
const picture = options.picture();
|
|
83
89
|
if (picture === null) return;
|
|
84
90
|
const room = button.getBoundingClientRect().top - picture.top - AIR;
|
|
85
|
-
const most = Number.parseFloat(getComputedStyle(host).getPropertyValue("--mbx-menu-max-height")) || MAX_HEIGHT;
|
|
91
|
+
const most = Number.parseFloat(getComputedStyle(host).getPropertyValue("--mbx-menu-max-height")) || MAX_HEIGHT * (Number.parseFloat(getComputedStyle(host).fontSize) || 16);
|
|
86
92
|
popup.style.maxHeight = `${Math.max(0, Math.floor(Math.min(most, room)))}px`;
|
|
87
93
|
more();
|
|
88
94
|
const wide = host.getBoundingClientRect().right - picture.left - AIR;
|
|
@@ -113,6 +119,11 @@ function menu(options) {
|
|
|
113
119
|
const page = stack[stack.length - 1];
|
|
114
120
|
if (page === void 0) return;
|
|
115
121
|
let tab = true;
|
|
122
|
+
if (stack.length === 1 && name !== "") {
|
|
123
|
+
const title = el("div", "title", name);
|
|
124
|
+
title.setAttribute("aria-hidden", "true");
|
|
125
|
+
popup.append(title);
|
|
126
|
+
}
|
|
116
127
|
if (stack.length > 1) {
|
|
117
128
|
const back = item("item back-item", page.label, () => {
|
|
118
129
|
stack.pop();
|
|
@@ -132,6 +143,11 @@ function menu(options) {
|
|
|
132
143
|
});
|
|
133
144
|
link.setAttribute("role", "menuitem");
|
|
134
145
|
link.setAttribute("aria-haspopup", "menu");
|
|
146
|
+
if (entry.glyph !== void 0) {
|
|
147
|
+
link.prepend(entry.glyph());
|
|
148
|
+
state(link, `item page-item ${entry.name}-item`, { "glyph-item": true });
|
|
149
|
+
}
|
|
150
|
+
if (entry.detail !== void 0) link.append(el("span", "item-detail", entry.detail));
|
|
135
151
|
popup.append(link);
|
|
136
152
|
continue;
|
|
137
153
|
}
|
|
@@ -139,7 +155,7 @@ function menu(options) {
|
|
|
139
155
|
section.setAttribute("role", "group");
|
|
140
156
|
if (entry.label !== void 0) {
|
|
141
157
|
section.setAttribute("aria-label", entry.label);
|
|
142
|
-
section.append(el("div", `section-label ${entry.name}-label`, entry.label));
|
|
158
|
+
if (entry.hideLabel !== true) section.append(el("div", `section-label ${entry.name}-label`, entry.label));
|
|
143
159
|
}
|
|
144
160
|
for (const [id, text, detail, image, badges] of entry.items) {
|
|
145
161
|
const choice = item(`item ${entry.name}-item`, text, () => {
|
|
@@ -147,7 +163,17 @@ function menu(options) {
|
|
|
147
163
|
button.focus();
|
|
148
164
|
entry.onSelect(id);
|
|
149
165
|
});
|
|
150
|
-
for (const badge of badges ?? [])
|
|
166
|
+
for (const badge of badges ?? []) {
|
|
167
|
+
const glyph = entry.badgeGlyphs?.[badge];
|
|
168
|
+
if (glyph === void 0) {
|
|
169
|
+
choice.append(el("span", "item-badge", badge));
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
const drawn = el("span", "item-badge item-glyph");
|
|
173
|
+
drawn.title = badge;
|
|
174
|
+
drawn.append(glyph(), el("span", "badge-text", badge));
|
|
175
|
+
choice.append(drawn);
|
|
176
|
+
}
|
|
151
177
|
if (detail !== void 0) choice.append(el("span", "item-detail", detail));
|
|
152
178
|
if (image !== void 0) {
|
|
153
179
|
const [, ...rest] = choice.childNodes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.js","names":[],"sources":["../../src/controls/menu.ts"],"sourcesContent":["/**\n * The menu primitive the quality, audio, subtitles and speed menus share: a\n * button that opens a popup of radio items above it, in one or more groups\n * with a heading each, and pages behind entries that open them. The button\n * carries the name and `aria-expanded`; the popup is `role=\"menu\"`, every\n * choice a `menuitemradio` with `aria-checked`, the checked one also\n * carrying `checked` on its part name, because an item inside a shadow\n * root has no other seam a page can style; an entry that opens a page is\n * a `menuitem` with `aria-haspopup`, and the page starts with a Back.\n *\n * Open on click. Inside, the arrows move focus across every item, Home and\n * End jump, Enter and Space choose, Escape goes back a page or closes and\n * hands focus to the button. A choice closes the popup. A pointer down\n * anywhere else closes it too.\n *\n * The popup never leaves the picture: on opening it takes the room above\n * the button up to the top of `picture()` as its height and scrolls past\n * that, and the room from its right edge to the picture's left as its\n * width, where a long item ends in an ellipsis. The\n * element that owns the menu carries `open` while the popup shows, which\n * the bar reads to hold its fade.\n */\nimport { el, setChildren, state } from '../dom.js';\n\nexport interface MenuGroup {\n /** The part suffix: `track`, `size`. */\n readonly name: string;\n /** A heading, or none for a menu of one group. */\n readonly label?: string;\n /**\n * Each item's id, its text, a detail drawn at its end, such as a chapter's\n * time, the URL of a picture drawn at its start, and short badges drawn\n * after the text, such as \"AD\" on an audio description track.\n */\n readonly items: ReadonlyArray<\n readonly [string, string, (string | undefined)?, (string | undefined)?, (readonly string[])?]\n >;\n readonly value: string;\n readonly onSelect: (value: string) => void;\n}\n\n/** An entry that opens a page of groups, with a Back at its top. */\nexport interface MenuPage {\n readonly name: string;\n readonly label: string;\n readonly entries: readonly MenuEntry[];\n}\n\nexport type MenuEntry = MenuGroup | MenuPage;\n\nexport interface MenuOptions {\n /** The element the menu belongs to: it carries `open`, and a pointer inside it is not outside. */\n readonly host: HTMLElement;\n /** The picture, in viewport pixels, which the popup never leaves. */\n readonly picture: () => DOMRect | null;\n /** The name of the Back item, from the page it leaves: \"Back from {page}\". */\n readonly back: (page: string) => string;\n}\n\nexport interface Menu {\n readonly button: HTMLButtonElement;\n readonly popup: HTMLElement;\n /** The accessible name of the button and the popup. */\n label(text: string): void;\n /** Replaces the entries, back at the first page. */\n fill(entries: readonly MenuEntry[]): void;\n close(): void;\n dispose(): void;\n}\n\n/** Air between the popup's top and the picture's. */\nconst AIR = 8;\n\n/**\n * The tallest a popup grows, in pixels: about seven and a half rows, so\n * the half row at the foot says the list goes on. A page sets its own\n * with `--mbx-menu-max-height`.\n */\nconst MAX_HEIGHT = 264;\n\n/** An item's picture. Decorative: the item's text names it. Loaded when the popup first shows it. */\nfunction picture(url: string): HTMLImageElement {\n const node = el('img', 'item-image');\n node.alt = '';\n node.loading = 'lazy';\n node.decoding = 'async';\n node.src = url;\n return node;\n}\n\nfunction isPage(entry: MenuEntry): entry is MenuPage {\n return 'entries' in entry;\n}\n\nexport function menu(options: MenuOptions): Menu {\n const { host } = options;\n const button = el('button', 'button');\n button.type = 'button';\n button.setAttribute('aria-haspopup', 'menu');\n button.setAttribute('aria-expanded', 'false');\n const popup = el('div', 'popup');\n popup.addEventListener('scroll', () => {\n more();\n });\n popup.setAttribute('role', 'menu');\n popup.hidden = true;\n\n let open = false;\n let name = '';\n let first: readonly MenuEntry[] = [];\n /** The pages opened, the first being the menu itself. */\n let stack: MenuPage[] = [];\n const handlers = new WeakMap<HTMLButtonElement, () => void>();\n\n function items(): HTMLButtonElement[] {\n return [...popup.querySelectorAll('button')];\n }\n\n function checked(): HTMLButtonElement | undefined {\n return items().find((item) => item.getAttribute('aria-checked') === 'true');\n }\n\n /** The focused element as this tree sees it: inside shadow DOM, `document.activeElement` is the host. */\n function focused(): Element | null {\n return (popup.getRootNode() as Document | ShadowRoot).activeElement;\n }\n\n function outside(event: PointerEvent): void {\n if (!event.composedPath().includes(host)) close();\n }\n\n /**\n * The popup's height: its maximum, or the room above the button if that\n * is less, so the popup never leaves the picture. Its width: the room\n * left of its right edge.\n */\n function fit(): void {\n const picture = options.picture();\n if (picture === null) return;\n const room = button.getBoundingClientRect().top - picture.top - AIR;\n const most =\n Number.parseFloat(getComputedStyle(host).getPropertyValue('--mbx-menu-max-height')) ||\n MAX_HEIGHT;\n popup.style.maxHeight = `${Math.max(0, Math.floor(Math.min(most, room)))}px`;\n more();\n // The popup is anchored at the host's right edge and grows leftwards.\n const wide = host.getBoundingClientRect().right - picture.left - AIR;\n popup.style.maxWidth = `${Math.max(0, Math.floor(wide))}px`;\n }\n\n /** `more` on the popup while rows wait below its foot, which then fades out. */\n function more(): void {\n popup.toggleAttribute('more', popup.scrollTop + popup.clientHeight < popup.scrollHeight - 1);\n }\n\n function clear(): void {\n for (const item of items()) {\n const handler = handlers.get(item);\n if (handler !== undefined) item.removeEventListener('click', handler);\n }\n setChildren(popup);\n }\n\n function item(part: string, text: string, handler: () => void): HTMLButtonElement {\n const node = el('button', part, text);\n node.type = 'button';\n node.tabIndex = -1;\n handlers.set(node, handler);\n node.addEventListener('click', handler);\n return node;\n }\n\n /** Draws the page on top of the stack. */\n function render(): void {\n clear();\n const page = stack[stack.length - 1];\n if (page === undefined) return;\n let tab = true;\n if (stack.length > 1) {\n const back = item('item back-item', page.label, () => {\n stack.pop();\n render();\n items()[0]?.focus();\n });\n back.setAttribute('role', 'menuitem');\n back.setAttribute('aria-label', options.back(page.label));\n popup.append(back);\n }\n for (const entry of page.entries) {\n if (isPage(entry)) {\n const link = item(`item page-item ${entry.name}-item`, entry.label, () => {\n stack.push(entry);\n render();\n items()[0]?.focus();\n });\n link.setAttribute('role', 'menuitem');\n link.setAttribute('aria-haspopup', 'menu');\n popup.append(link);\n continue;\n }\n const section = el('div', `section ${entry.name}-section`);\n section.setAttribute('role', 'group');\n if (entry.label !== undefined) {\n section.setAttribute('aria-label', entry.label);\n section.append(el('div', `section-label ${entry.name}-label`, entry.label));\n }\n for (const [id, text, detail, image, badges] of entry.items) {\n const choice = item(`item ${entry.name}-item`, text, () => {\n close();\n button.focus();\n entry.onSelect(id);\n });\n for (const badge of badges ?? []) choice.append(el('span', 'item-badge', badge));\n if (detail !== undefined) choice.append(el('span', 'item-detail', detail));\n if (image !== undefined) {\n // The text in a box of its own, so a long title ends in an ellipsis beside the picture.\n const [, ...rest] = choice.childNodes;\n setChildren(choice, el('span', 'item-text', text), ...rest);\n choice.prepend(picture(image));\n }\n choice.value = id;\n choice.setAttribute('role', 'menuitemradio');\n const on = id === entry.value;\n choice.setAttribute('aria-checked', String(on));\n state(choice, `item ${entry.name}-item`, { checked: on });\n // One tab stop: the first checked item.\n if (on && tab) {\n choice.tabIndex = 0;\n tab = false;\n }\n section.append(choice);\n }\n popup.append(section);\n }\n fit();\n }\n\n function close(): void {\n if (!open) return;\n open = false;\n popup.hidden = true;\n button.setAttribute('aria-expanded', 'false');\n host.removeAttribute('open');\n document.removeEventListener('pointerdown', outside, true);\n if (stack.length > 1) {\n stack = stack.slice(0, 1);\n render();\n }\n }\n\n function show(): void {\n if (open) return;\n open = true;\n popup.hidden = false;\n button.setAttribute('aria-expanded', 'true');\n host.setAttribute('open', '');\n document.addEventListener('pointerdown', outside, true);\n fit();\n (checked() ?? items()[0])?.focus();\n }\n\n function toggle(): void {\n if (open) close();\n else show();\n }\n\n function key(event: KeyboardEvent): void {\n // Handled already, by a handler that decides first.\n if (event.defaultPrevented) return;\n const list = items();\n const index = list.indexOf(focused() as HTMLButtonElement);\n let next: number;\n switch (event.key) {\n case 'ArrowDown':\n next = (index + 1) % list.length;\n break;\n case 'ArrowUp':\n next = (index - 1 + list.length) % list.length;\n break;\n case 'Home':\n next = 0;\n break;\n case 'End':\n next = list.length - 1;\n break;\n case 'Escape':\n event.preventDefault();\n if (stack.length > 1) {\n stack.pop();\n render();\n items()[0]?.focus();\n return;\n }\n close();\n button.focus();\n return;\n default:\n return;\n }\n event.preventDefault();\n list[next]?.focus();\n }\n\n button.addEventListener('click', toggle);\n popup.addEventListener('keydown', key);\n\n return {\n button,\n popup,\n label(text: string): void {\n name = text;\n button.setAttribute('aria-label', text);\n popup.setAttribute('aria-label', text);\n const root = stack[0];\n if (root !== undefined) stack[0] = { ...root, label: text };\n },\n fill(entries): void {\n first = entries;\n stack = [{ name: 'menu', label: name, entries: first }];\n render();\n },\n close,\n dispose(): void {\n close();\n clear();\n button.removeEventListener('click', toggle);\n popup.removeEventListener('keydown', key);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,MAAM,MAAM;;;;;;AAOZ,MAAM,aAAa;;AAGnB,SAAS,QAAQ,KAA+B;CAC9C,MAAM,OAAO,GAAG,OAAO,YAAY;CACnC,KAAK,MAAM;CACX,KAAK,UAAU;CACf,KAAK,WAAW;CAChB,KAAK,MAAM;CACX,OAAO;AACT;AAEA,SAAS,OAAO,OAAqC;CACnD,OAAO,aAAa;AACtB;AAEA,SAAgB,KAAK,SAA4B;CAC/C,MAAM,EAAE,SAAS;CACjB,MAAM,SAAS,GAAG,UAAU,QAAQ;CACpC,OAAO,OAAO;CACd,OAAO,aAAa,iBAAiB,MAAM;CAC3C,OAAO,aAAa,iBAAiB,OAAO;CAC5C,MAAM,QAAQ,GAAG,OAAO,OAAO;CAC/B,MAAM,iBAAiB,gBAAgB;EACrC,KAAK;CACP,CAAC;CACD,MAAM,aAAa,QAAQ,MAAM;CACjC,MAAM,SAAS;CAEf,IAAI,OAAO;CACX,IAAI,OAAO;CACX,IAAI,QAA8B,CAAC;;CAEnC,IAAI,QAAoB,CAAC;CACzB,MAAM,2BAAW,IAAI,QAAuC;CAE5D,SAAS,QAA6B;EACpC,OAAO,CAAC,GAAG,MAAM,iBAAiB,QAAQ,CAAC;CAC7C;CAEA,SAAS,UAAyC;EAChD,OAAO,MAAM,CAAC,CAAC,MAAM,SAAS,KAAK,aAAa,cAAc,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AQ,KAAK,KAAK;IAC1B;GACF,KAAK;IACH,QAAQ,QAAQ,IAAI,KAAK,UAAU,KAAK;IACxC;GACF,KAAK;IACH,OAAO;IACP;GACF,KAAK;IACH,OAAO,KAAK,SAAS;IACrB;GACF,KAAK;IACH,MAAM,eAAe;IACrB,IAAI,MAAM,SAAS,GAAG;KACpB,MAAM,IAAI;KACV,OAAO;KACP,MAAM,CAAC,CAAC,EAAE,EAAE,MAAM;KAClB;IACF;IACA,MAAM;IACN,OAAO,MAAM;IACb;GACF,SACE;EACJ;EACA,MAAM,eAAe;EACrB,KAAK,KAAK,EAAE,MAAM;CACpB;CAEA,OAAO,iBAAiB,SAAS,MAAM;CACvC,MAAM,iBAAiB,WAAW,GAAG;CAErC,OAAO;EACL;EACA;EACA,MAAM,MAAoB;GACxB,OAAO;GACP,OAAO,aAAa,cAAc,IAAI;GACtC,MAAM,aAAa,cAAc,IAAI;GACrC,MAAM,OAAO,MAAM;GACnB,IAAI,SAAS,KAAA,GAAW,MAAM,KAAK;IAAE,GAAG;IAAM,OAAO;GAAK;EAC5D;EACA,KAAK,SAAe;GAClB,QAAQ;GACR,QAAQ,CAAC;IAAE,MAAM;IAAQ,OAAO;IAAM,SAAS;GAAM,CAAC;GACtD,OAAO;EACT;EACA;EACA,UAAgB;GACd,MAAM;GACN,MAAM;GACN,OAAO,oBAAoB,SAAS,MAAM;GAC1C,MAAM,oBAAoB,WAAW,GAAG;EAC1C;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"menu.js","names":[],"sources":["../../src/controls/menu.ts"],"sourcesContent":["/**\n * The menu primitive the quality, audio, subtitles and speed menus share: a\n * button that opens a popup of radio items above it, in one or more groups\n * with a heading each, and pages behind entries that open them. The button\n * carries the name and `aria-expanded`; the popup is `role=\"menu\"`, every\n * choice a `menuitemradio` with `aria-checked`, the checked one also\n * carrying `checked` on its part name, because an item inside a shadow\n * root has no other seam a page can style; an entry that opens a page is\n * a `menuitem` with `aria-haspopup`, and the page starts with a Back.\n *\n * Open on click. Inside, the arrows move focus across every item, Home and\n * End jump, Enter and Space choose, Escape goes back a page or closes and\n * hands focus to the button. A choice closes the popup. A pointer down\n * anywhere else closes it too.\n *\n * The popup never leaves the picture: on opening it takes the room above\n * the button up to the top of `picture()` as its height and scrolls past\n * that, and the room from its right edge to the picture's left as its\n * width, where a long item ends in an ellipsis. The\n * element that owns the menu carries `open` while the popup shows, which\n * the bar reads to hold its fade.\n */\nimport { el, setChildren, state } from '../dom.js';\n\nexport interface MenuGroup {\n /** The part suffix: `track`, `size`. */\n readonly name: string;\n /** A heading, or none for a menu of one group. */\n readonly label?: string;\n /** The label names the group for a screen reader, and no heading is drawn. */\n readonly hideLabel?: boolean;\n /**\n * Each item's id, its text, a detail drawn at its end, such as a chapter's\n * time, the URL of a picture drawn at its start, and short badges drawn\n * after the text, such as \"AD\" on an audio description track.\n */\n readonly items: ReadonlyArray<\n readonly [string, string, (string | undefined)?, (string | undefined)?, (readonly string[])?]\n >;\n readonly value: string;\n readonly onSelect: (value: string) => void;\n /**\n * The badges drawn as a glyph, by their text. The text stays in the\n * badge for a screen reader and as its tooltip.\n */\n readonly badgeGlyphs?: Readonly<Record<string, () => SVGSVGElement>>;\n}\n\n/** An entry that opens a page of groups, with a Back at its top. */\nexport interface MenuPage {\n readonly name: string;\n readonly label: string;\n readonly entries: readonly MenuEntry[];\n /** A glyph drawn before the label of the item that opens the page. */\n readonly glyph?: () => SVGSVGElement;\n /** A detail drawn at the end of that item, such as the value chosen on the page. */\n readonly detail?: string;\n}\n\nexport type MenuEntry = MenuGroup | MenuPage;\n\nexport interface MenuOptions {\n /** The element the menu belongs to: it carries `open`, and a pointer inside it is not outside. */\n readonly host: HTMLElement;\n /** The picture, in viewport pixels, which the popup never leaves. */\n readonly picture: () => DOMRect | null;\n /** The name of the Back item, from the page it leaves: \"Back from {page}\". */\n readonly back: (page: string) => string;\n}\n\nexport interface Menu {\n readonly button: HTMLButtonElement;\n readonly popup: HTMLElement;\n /** The accessible name of the button and the popup. */\n label(text: string): void;\n /** Replaces the entries, back at the first page. */\n fill(entries: readonly MenuEntry[]): void;\n close(): void;\n dispose(): void;\n}\n\n/** Air between the popup's top and the picture's. */\nconst AIR = 8;\n\n/**\n * The tallest a popup grows, in pixels: the title and about seven and a half rows, so\n * the half row at the foot says the list goes on. A page sets its own\n * with `--mbx-menu-max-height`.\n */\n/* In em of the menu's own font size. */\nconst MAX_HEIGHT = 22;\n\n/** An item's picture. Decorative: the item's text names it. Loaded when the popup first shows it. */\nfunction picture(url: string): HTMLImageElement {\n const node = el('img', 'item-image');\n node.alt = '';\n node.loading = 'lazy';\n node.decoding = 'async';\n node.src = url;\n return node;\n}\n\nfunction isPage(entry: MenuEntry): entry is MenuPage {\n return 'entries' in entry;\n}\n\nexport function menu(options: MenuOptions): Menu {\n const { host } = options;\n const button = el('button', 'button');\n button.type = 'button';\n button.setAttribute('aria-haspopup', 'menu');\n button.setAttribute('aria-expanded', 'false');\n const popup = el('div', 'popup');\n popup.addEventListener('scroll', () => {\n more();\n });\n popup.setAttribute('role', 'menu');\n popup.hidden = true;\n\n let open = false;\n let name = '';\n let first: readonly MenuEntry[] = [];\n /** The pages opened, the first being the menu itself. */\n let stack: MenuPage[] = [];\n const handlers = new WeakMap<HTMLButtonElement, () => void>();\n\n function items(): HTMLButtonElement[] {\n return [...popup.querySelectorAll('button')];\n }\n\n function checked(): HTMLButtonElement | undefined {\n return items().find((item) => item.getAttribute('aria-checked') === 'true');\n }\n\n /** The focused element as this tree sees it: inside shadow DOM, `document.activeElement` is the host. */\n function focused(): Element | null {\n return (popup.getRootNode() as Document | ShadowRoot).activeElement;\n }\n\n function outside(event: PointerEvent): void {\n if (!event.composedPath().includes(host)) close();\n }\n\n /**\n * The popup's height: its maximum, or the room above the button if that\n * is less, so the popup never leaves the picture. Its width: the room\n * left of its right edge.\n */\n function fit(): void {\n // A compact player's menu is a sheet on the page: the stylesheet sizes it.\n if (host.getAttribute('layout') === 'compact') {\n popup.style.maxHeight = '';\n popup.style.maxWidth = '';\n more();\n return;\n }\n const picture = options.picture();\n if (picture === null) return;\n const room = button.getBoundingClientRect().top - picture.top - AIR;\n const most =\n Number.parseFloat(getComputedStyle(host).getPropertyValue('--mbx-menu-max-height')) ||\n MAX_HEIGHT * (Number.parseFloat(getComputedStyle(host).fontSize) || 16);\n popup.style.maxHeight = `${Math.max(0, Math.floor(Math.min(most, room)))}px`;\n more();\n // The popup is anchored at the host's right edge and grows leftwards.\n const wide = host.getBoundingClientRect().right - picture.left - AIR;\n popup.style.maxWidth = `${Math.max(0, Math.floor(wide))}px`;\n }\n\n /** `more` on the popup while rows wait below its foot, which then fades out. */\n function more(): void {\n popup.toggleAttribute('more', popup.scrollTop + popup.clientHeight < popup.scrollHeight - 1);\n }\n\n function clear(): void {\n for (const item of items()) {\n const handler = handlers.get(item);\n if (handler !== undefined) item.removeEventListener('click', handler);\n }\n setChildren(popup);\n }\n\n function item(part: string, text: string, handler: () => void): HTMLButtonElement {\n const node = el('button', part, text);\n node.type = 'button';\n node.tabIndex = -1;\n handlers.set(node, handler);\n node.addEventListener('click', handler);\n return node;\n }\n\n /** Draws the page on top of the stack. */\n function render(): void {\n clear();\n const page = stack[stack.length - 1];\n if (page === undefined) return;\n let tab = true;\n // The first page starts with the menu's name. The popup already carries it for a screen reader.\n if (stack.length === 1 && name !== '') {\n const title = el('div', 'title', name);\n title.setAttribute('aria-hidden', 'true');\n popup.append(title);\n }\n if (stack.length > 1) {\n const back = item('item back-item', page.label, () => {\n stack.pop();\n render();\n items()[0]?.focus();\n });\n back.setAttribute('role', 'menuitem');\n back.setAttribute('aria-label', options.back(page.label));\n popup.append(back);\n }\n for (const entry of page.entries) {\n if (isPage(entry)) {\n const link = item(`item page-item ${entry.name}-item`, entry.label, () => {\n stack.push(entry);\n render();\n items()[0]?.focus();\n });\n link.setAttribute('role', 'menuitem');\n link.setAttribute('aria-haspopup', 'menu');\n if (entry.glyph !== undefined) {\n link.prepend(entry.glyph());\n state(link, `item page-item ${entry.name}-item`, { 'glyph-item': true });\n }\n if (entry.detail !== undefined) link.append(el('span', 'item-detail', entry.detail));\n popup.append(link);\n continue;\n }\n const section = el('div', `section ${entry.name}-section`);\n section.setAttribute('role', 'group');\n if (entry.label !== undefined) {\n section.setAttribute('aria-label', entry.label);\n if (entry.hideLabel !== true) {\n section.append(el('div', `section-label ${entry.name}-label`, entry.label));\n }\n }\n for (const [id, text, detail, image, badges] of entry.items) {\n const choice = item(`item ${entry.name}-item`, text, () => {\n close();\n button.focus();\n entry.onSelect(id);\n });\n for (const badge of badges ?? []) {\n const glyph = entry.badgeGlyphs?.[badge];\n if (glyph === undefined) {\n choice.append(el('span', 'item-badge', badge));\n continue;\n }\n // The glyph is what a viewer sees, and the text is what a screen reader says.\n const drawn = el('span', 'item-badge item-glyph');\n drawn.title = badge;\n drawn.append(glyph(), el('span', 'badge-text', badge));\n choice.append(drawn);\n }\n if (detail !== undefined) choice.append(el('span', 'item-detail', detail));\n if (image !== undefined) {\n // The text in a box of its own, so a long title ends in an ellipsis beside the picture.\n const [, ...rest] = choice.childNodes;\n setChildren(choice, el('span', 'item-text', text), ...rest);\n choice.prepend(picture(image));\n }\n choice.value = id;\n choice.setAttribute('role', 'menuitemradio');\n const on = id === entry.value;\n choice.setAttribute('aria-checked', String(on));\n state(choice, `item ${entry.name}-item`, { checked: on });\n // One tab stop: the first checked item.\n if (on && tab) {\n choice.tabIndex = 0;\n tab = false;\n }\n section.append(choice);\n }\n popup.append(section);\n }\n fit();\n }\n\n function close(): void {\n if (!open) return;\n open = false;\n popup.hidden = true;\n button.setAttribute('aria-expanded', 'false');\n host.removeAttribute('open');\n document.removeEventListener('pointerdown', outside, true);\n if (stack.length > 1) {\n stack = stack.slice(0, 1);\n render();\n }\n }\n\n function show(): void {\n if (open) return;\n open = true;\n popup.hidden = false;\n button.setAttribute('aria-expanded', 'true');\n host.setAttribute('open', '');\n document.addEventListener('pointerdown', outside, true);\n fit();\n (checked() ?? items()[0])?.focus();\n }\n\n function toggle(): void {\n if (open) close();\n else show();\n }\n\n function key(event: KeyboardEvent): void {\n // Handled already, by a handler that decides first.\n if (event.defaultPrevented) return;\n const list = items();\n const index = list.indexOf(focused() as HTMLButtonElement);\n let next: number;\n switch (event.key) {\n case 'ArrowDown':\n next = (index + 1) % list.length;\n break;\n case 'ArrowUp':\n next = (index - 1 + list.length) % list.length;\n break;\n case 'Home':\n next = 0;\n break;\n case 'End':\n next = list.length - 1;\n break;\n case 'Escape':\n event.preventDefault();\n if (stack.length > 1) {\n stack.pop();\n render();\n items()[0]?.focus();\n return;\n }\n close();\n button.focus();\n return;\n default:\n return;\n }\n event.preventDefault();\n list[next]?.focus();\n }\n\n button.addEventListener('click', toggle);\n popup.addEventListener('keydown', key);\n\n return {\n button,\n popup,\n label(text: string): void {\n name = text;\n button.setAttribute('aria-label', text);\n popup.setAttribute('aria-label', text);\n const root = stack[0];\n if (root !== undefined) stack[0] = { ...root, label: text };\n },\n fill(entries): void {\n first = entries;\n stack = [{ name: 'menu', label: name, entries: first }];\n render();\n },\n close,\n dispose(): void {\n close();\n clear();\n button.removeEventListener('click', toggle);\n popup.removeEventListener('keydown', key);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkFA,MAAM,MAAM;;;;;;AAQZ,MAAM,aAAa;;AAGnB,SAAS,QAAQ,KAA+B;CAC9C,MAAM,OAAO,GAAG,OAAO,YAAY;CACnC,KAAK,MAAM;CACX,KAAK,UAAU;CACf,KAAK,WAAW;CAChB,KAAK,MAAM;CACX,OAAO;AACT;AAEA,SAAS,OAAO,OAAqC;CACnD,OAAO,aAAa;AACtB;AAEA,SAAgB,KAAK,SAA4B;CAC/C,MAAM,EAAE,SAAS;CACjB,MAAM,SAAS,GAAG,UAAU,QAAQ;CACpC,OAAO,OAAO;CACd,OAAO,aAAa,iBAAiB,MAAM;CAC3C,OAAO,aAAa,iBAAiB,OAAO;CAC5C,MAAM,QAAQ,GAAG,OAAO,OAAO;CA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AQ,IAAI,KAAK,UAAU,KAAK;IACxC;GACF,KAAK;IACH,OAAO;IACP;GACF,KAAK;IACH,OAAO,KAAK,SAAS;IACrB;GACF,KAAK;IACH,MAAM,eAAe;IACrB,IAAI,MAAM,SAAS,GAAG;KACpB,MAAM,IAAI;KACV,OAAO;KACP,MAAM,CAAC,CAAC,EAAE,EAAE,MAAM;KAClB;IACF;IACA,MAAM;IACN,OAAO,MAAM;IACb;GACF,SACE;EACJ;EACA,MAAM,eAAe;EACrB,KAAK,KAAK,EAAE,MAAM;CACpB;CAEA,OAAO,iBAAiB,SAAS,MAAM;CACvC,MAAM,iBAAiB,WAAW,GAAG;CAErC,OAAO;EACL;EACA;EACA,MAAM,MAAoB;GACxB,OAAO;GACP,OAAO,aAAa,cAAc,IAAI;GACtC,MAAM,aAAa,cAAc,IAAI;GACrC,MAAM,OAAO,MAAM;GACnB,IAAI,SAAS,KAAA,GAAW,MAAM,KAAK;IAAE,GAAG;IAAM,OAAO;GAAK;EAC5D;EACA,KAAK,SAAe;GAClB,QAAQ;GACR,QAAQ,CAAC;IAAE,MAAM;IAAQ,OAAO;IAAM,SAAS;GAAM,CAAC;GACtD,OAAO;EACT;EACA;EACA,UAAgB;GACd,MAAM;GACN,MAAM;GACN,OAAO,oBAAoB,SAAS,MAAM;GAC1C,MAAM,oBAAoB,WAAW,GAAG;EAC1C;CACF;AACF"}
|
package/dist/element.d.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* them into runtime helpers, and the emit check bans helpers. Statics are
|
|
18
18
|
* getters and instance state is declared, then assigned in the constructor.
|
|
19
19
|
*/
|
|
20
|
-
import type { Handler, Player, PlayerError, Session } from '@mattebox/player-core';
|
|
20
|
+
import type { Handler, Player, PlayerError, Session, Source } from '@mattebox/player-core';
|
|
21
21
|
import type { KernelConfig, Mattebox, Stage } from 'mattebox';
|
|
22
22
|
import type { AttachEmeOptions } from 'mattebox/eme';
|
|
23
23
|
import type { Marker, Markers } from './controls/markers.js';
|
|
@@ -29,6 +29,8 @@ import type { PlayerHost } from './host.js';
|
|
|
29
29
|
*/
|
|
30
30
|
export interface MatteboxPlayerEventMap {
|
|
31
31
|
sourcechange: CustomEvent<Session | null>;
|
|
32
|
+
/** The size tier changed: `compact`, `regular` or `wide`. */
|
|
33
|
+
layoutchange: CustomEvent<string>;
|
|
32
34
|
error: CustomEvent<PlayerError>;
|
|
33
35
|
/** The markers changed: set by the page, or cleared by a new source. */
|
|
34
36
|
markerschange: CustomEvent<readonly Marker[]>;
|
|
@@ -88,12 +90,21 @@ export declare class MatteboxPlayerElement extends HTMLElement implements Player
|
|
|
88
90
|
private track;
|
|
89
91
|
/** The chapters URL the current session's engine was given, or null. */
|
|
90
92
|
private given;
|
|
91
|
-
|
|
93
|
+
/** The sources the page set from script, or null. */
|
|
94
|
+
private list;
|
|
95
|
+
/** The sources of the last run, as text: what tells a new `<source>` child from the ones already tried. */
|
|
96
|
+
private tried;
|
|
97
|
+
/** The options this element was constructed with, or null for the ones `define()` recorded. */
|
|
98
|
+
private readonly own;
|
|
92
99
|
private core;
|
|
93
100
|
private current;
|
|
94
101
|
private failure;
|
|
95
102
|
/** Whether an attribute change is the element's own reflection, which must not write back to the video. */
|
|
96
103
|
private reflecting;
|
|
104
|
+
/** Watches the element's box for `layout`, while connected. */
|
|
105
|
+
private sizes;
|
|
106
|
+
/** Whether the page wrote `layout`, so the element leaves it alone. */
|
|
107
|
+
private fixed;
|
|
97
108
|
/** The video has played once since its source was set: `started`, which tells a first play from a pause. */
|
|
98
109
|
private started;
|
|
99
110
|
/** The video waits for data: `waiting`, set on `waiting` and `stalled`, cleared once it can play. */
|
|
@@ -108,6 +119,13 @@ export declare class MatteboxPlayerElement extends HTMLElement implements Player
|
|
|
108
119
|
get video(): HTMLVideoElement;
|
|
109
120
|
/** The ranges the page named in this source: credits to skip, parts that must not play. */
|
|
110
121
|
get markers(): Markers;
|
|
122
|
+
/**
|
|
123
|
+
* The sources to try in order, set from script. The `src` attribute wins
|
|
124
|
+
* over them, and they win over the `<source>` children. Setting them
|
|
125
|
+
* loads, and null returns to the children.
|
|
126
|
+
*/
|
|
127
|
+
get sources(): readonly Source[] | null;
|
|
128
|
+
set sources(value: readonly Source[] | null);
|
|
111
129
|
/** The core, or null until the first source has been set up: resolving a preset is asynchronous. */
|
|
112
130
|
get player(): Player | null;
|
|
113
131
|
/** The engine feeding the video, or null for a native session and before the first load. */
|
|
@@ -120,6 +138,8 @@ export declare class MatteboxPlayerElement extends HTMLElement implements Player
|
|
|
120
138
|
*/
|
|
121
139
|
get error(): PlayerError | null;
|
|
122
140
|
connectedCallback(): void;
|
|
141
|
+
/** Sets `layout` from the element's box, unless the page fixed it. */
|
|
142
|
+
private measure;
|
|
123
143
|
/** The two states the video does not hold: whether it has played once, and whether it waits for data. */
|
|
124
144
|
private note;
|
|
125
145
|
/** The video's state on the element, for `mattebox-player[paused]` and the like. */
|
|
@@ -153,7 +173,21 @@ export declare class MatteboxPlayerElement extends HTMLElement implements Player
|
|
|
153
173
|
private emit;
|
|
154
174
|
private report;
|
|
155
175
|
private run;
|
|
176
|
+
/**
|
|
177
|
+
* What to load, ranked as a video ranks them: the `src` attribute, then
|
|
178
|
+
* the `sources` property, then the `<source>` children in their order.
|
|
179
|
+
* A child carries its own `license-url` and `certificate-url`.
|
|
180
|
+
*/
|
|
181
|
+
private wanted;
|
|
182
|
+
/** Sets a session up. It runs for every session, the one that replaces a failed source included. */
|
|
183
|
+
private adopt;
|
|
156
184
|
private ensure;
|
|
185
|
+
/**
|
|
186
|
+
* Read at each use, not once in the constructor. Importing the package
|
|
187
|
+
* registers the element, and the parser's elements are constructed then,
|
|
188
|
+
* before the page's own `define()` call can run.
|
|
189
|
+
*/
|
|
190
|
+
private get options();
|
|
157
191
|
private chain;
|
|
158
192
|
/**
|
|
159
193
|
* The DRM a native session attaches: the page's `drm` option, the
|
package/dist/element.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAQ3F,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AA4F5C;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAC1C,6DAA6D;IAC7D,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,KAAK,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAChC,wEAAwE;IACxE,aAAa,EAAE,WAAW,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;IAC9C,0DAA0D;IAC1D,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,CAAC,CAAC,SAAS,MAAM,sBAAsB,EACrD,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,IAAI,EAAE,qBAAqB,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,IAAI,EACjF,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,I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