@mattebox/player 0.8.0 → 0.9.1

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.
Files changed (102) hide show
  1. package/dist/cdn/mattebox-player.min.js +3 -3
  2. package/dist/controls/cues.d.ts.map +1 -1
  3. package/dist/controls/cues.js +11 -5
  4. package/dist/controls/cues.js.map +1 -1
  5. package/dist/controls/icons.d.ts +5 -30
  6. package/dist/controls/icons.d.ts.map +1 -1
  7. package/dist/controls/icons.js +38 -29
  8. package/dist/controls/icons.js.map +1 -1
  9. package/dist/controls/menu.d.ts +20 -0
  10. package/dist/controls/menu.d.ts.map +1 -1
  11. package/dist/controls/menu.js +83 -14
  12. package/dist/controls/menu.js.map +1 -1
  13. package/dist/element.d.ts +36 -2
  14. package/dist/element.d.ts.map +1 -1
  15. package/dist/element.js +140 -24
  16. package/dist/element.js.map +1 -1
  17. package/dist/elements/audio-menu.d.ts.map +1 -1
  18. package/dist/elements/audio-menu.js +3 -1
  19. package/dist/elements/audio-menu.js.map +1 -1
  20. package/dist/elements/component.d.ts.map +1 -1
  21. package/dist/elements/component.js +10 -0
  22. package/dist/elements/component.js.map +1 -1
  23. package/dist/elements/control-bar.d.ts +2 -0
  24. package/dist/elements/control-bar.d.ts.map +1 -1
  25. package/dist/elements/control-bar.js +23 -7
  26. package/dist/elements/control-bar.js.map +1 -1
  27. package/dist/elements/current-time.d.ts.map +1 -1
  28. package/dist/elements/current-time.js +1 -1
  29. package/dist/elements/current-time.js.map +1 -1
  30. package/dist/elements/drm-badge.js +1 -1
  31. package/dist/elements/duration.d.ts.map +1 -1
  32. package/dist/elements/duration.js +6 -2
  33. package/dist/elements/duration.js.map +1 -1
  34. package/dist/elements/error-screen.js +1 -1
  35. package/dist/elements/live-button.js +1 -1
  36. package/dist/elements/marker-button.d.ts +3 -3
  37. package/dist/elements/marker-button.d.ts.map +1 -1
  38. package/dist/elements/marker-button.js +18 -22
  39. package/dist/elements/marker-button.js.map +1 -1
  40. package/dist/elements/menu-element.d.ts.map +1 -1
  41. package/dist/elements/menu-element.js +2 -1
  42. package/dist/elements/menu-element.js.map +1 -1
  43. package/dist/elements/quality-menu.js +1 -1
  44. package/dist/elements/quality-menu.js.map +1 -1
  45. package/dist/elements/scan-button.js +1 -1
  46. package/dist/elements/seek-bar.d.ts.map +1 -1
  47. package/dist/elements/seek-bar.js +5 -4
  48. package/dist/elements/seek-bar.js.map +1 -1
  49. package/dist/elements/shared.js +3 -3
  50. package/dist/elements/skip-button.js +2 -2
  51. package/dist/elements/skip-button.js.map +1 -1
  52. package/dist/elements/spinner.js +1 -1
  53. package/dist/elements/start-button.d.ts +8 -0
  54. package/dist/elements/start-button.d.ts.map +1 -1
  55. package/dist/elements/start-button.js +18 -2
  56. package/dist/elements/start-button.js.map +1 -1
  57. package/dist/elements/subtitles-menu.d.ts +5 -1
  58. package/dist/elements/subtitles-menu.d.ts.map +1 -1
  59. package/dist/elements/subtitles-menu.js +29 -11
  60. package/dist/elements/subtitles-menu.js.map +1 -1
  61. package/dist/elements/title.d.ts.map +1 -1
  62. package/dist/elements/title.js +3 -1
  63. package/dist/elements/title.js.map +1 -1
  64. package/dist/elements/volume-slider.js +1 -1
  65. package/dist/elements/volume.js +1 -1
  66. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/asyncToGenerator.js +1 -1
  67. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/defineProperty.js +1 -1
  68. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/objectSpread2.js +1 -1
  69. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPrimitive.js +1 -1
  70. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPropertyKey.js +1 -1
  71. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/typeof.js +1 -1
  72. package/dist/es2015/controls/chapters.js +1 -1
  73. package/dist/es2015/controls/cues.js +11 -5
  74. package/dist/es2015/controls/icons.js +38 -29
  75. package/dist/es2015/controls/menu.js +89 -17
  76. package/dist/es2015/element.js +144 -30
  77. package/dist/es2015/elements/audio-menu.js +4 -1
  78. package/dist/es2015/elements/component.js +10 -0
  79. package/dist/es2015/elements/control-bar.js +23 -7
  80. package/dist/es2015/elements/current-time.js +1 -1
  81. package/dist/es2015/elements/drm-badge.js +1 -1
  82. package/dist/es2015/elements/duration.js +6 -2
  83. package/dist/es2015/elements/error-screen.js +1 -1
  84. package/dist/es2015/elements/live-button.js +1 -1
  85. package/dist/es2015/elements/marker-button.js +19 -23
  86. package/dist/es2015/elements/menu-element.js +2 -1
  87. package/dist/es2015/elements/quality-menu.js +1 -1
  88. package/dist/es2015/elements/scan-button.js +1 -1
  89. package/dist/es2015/elements/seek-bar.js +5 -4
  90. package/dist/es2015/elements/shared.js +3 -3
  91. package/dist/es2015/elements/skip-button.js +2 -2
  92. package/dist/es2015/elements/spinner.js +1 -1
  93. package/dist/es2015/elements/start-button.js +18 -2
  94. package/dist/es2015/elements/subtitles-menu.js +35 -17
  95. package/dist/es2015/elements/title.js +3 -1
  96. package/dist/es2015/elements/volume-slider.js +1 -1
  97. package/dist/es2015/elements/volume.js +1 -1
  98. package/dist/es2015/presets.js +1 -1
  99. package/dist/es2015/style.js +1 -1
  100. package/dist/style.js +1 -1
  101. package/package.json +4 -5
  102. package/NOTICE +0 -24
@@ -1,3 +1,4 @@
1
+ import { icon } from "../controls/icons.js";
1
2
  import { show } from "./shared.js";
2
3
  import { nativeTracks, onNativeTracks } from "../controls/native-tracks.js";
3
4
  import { layout, trackNames } from "../controls/track-names.js";
@@ -47,7 +48,7 @@ var MbxAudioMenu = class extends MenuElement {
47
48
  ];
48
49
  }
49
50
  constructor() {
50
- super(...single("music"));
51
+ super(...single("audio"));
51
52
  this.engine = null;
52
53
  show(this.slots, "default");
53
54
  }
@@ -79,6 +80,7 @@ var MbxAudioMenu = class extends MenuElement {
79
80
  return [entries, on === -1 ? null : String(on)];
80
81
  }
81
82
  render() {
83
+ var _this$getAttribute4;
82
84
  super.render();
83
85
  const engine = this.engine;
84
86
  const player = this.player;
@@ -95,6 +97,7 @@ var MbxAudioMenu = class extends MenuElement {
95
97
  this.menu.fill([{
96
98
  name: "track",
97
99
  items,
100
+ badgeGlyphs: { [(_this$getAttribute4 = this.getAttribute("label-ad")) !== null && _this$getAttribute4 !== void 0 ? _this$getAttribute4 : "AD"]: () => icon("audio-description") },
98
101
  value: active !== null && active !== void 0 ? active : "",
99
102
  onSelect: (value) => {
100
103
  if (tracks !== void 0) tracks.forEach((track, index) => {
@@ -18,6 +18,16 @@ var Component = class extends HTMLElement {
18
18
  customElements.upgrade(found);
19
19
  if (!("video" in found)) return;
20
20
  this.player = found;
21
+ const tier = () => {
22
+ const layout = found.getAttribute("layout");
23
+ if (layout === null) this.removeAttribute("layout");
24
+ else this.setAttribute("layout", layout);
25
+ };
26
+ this.listen(found, ["layoutchange"], () => {
27
+ tier();
28
+ this.render();
29
+ });
30
+ tier();
21
31
  this.attach(this.player);
22
32
  };
23
33
  if ("video" in found) attach();
@@ -4,7 +4,7 @@ import { number, style } from "./shared.js";
4
4
  import { cueLift, cueStyle } from "../controls/cues.js";
5
5
  import { fullscreen } from "../controls/fullscreen.js";
6
6
  //#region src/elements/control-bar.ts
7
- const STYLE = ":host{box-sizing:border-box;color:var(--mbx-text);font:500 16px / 1.2 var(--mbx-font);background:linear-gradient(#0000,#0009);flex-direction:column;padding:40px 16px 12px;transition:opacity .2s;display:flex;position:absolute;bottom:0;left:0;right:0}:host([idle]){opacity:0;pointer-events:none}[part~=row]{align-items:center;margin:0 -4px;display:flex}[part~=buttons-row]{margin-top:4px}[part~=seek-row]{margin:0 -8px}slot:not([name])::slotted(*){margin:0 4px}slot[name=seek]::slotted(*){margin:0 8px}::slotted([collapsed]){display:none}@media (prefers-reduced-motion:reduce){:host{transition:none}}";
7
+ const STYLE = ":host{box-sizing:border-box;color:var(--mbx-text);font:500 1em / 1.2 var(--mbx-font);background:linear-gradient(#0000,#0009);flex-direction:column;padding:2.5em 1em .75em;transition:opacity .2s;display:flex;position:absolute;bottom:0;left:0;right:0}:host([menu]){z-index:2;--mbx-tooltip:none}:host([idle]){opacity:0;pointer-events:none}[part~=row]{align-items:center;margin:0 -.25em;display:flex}[part~=buttons-row]{margin-top:.25em}[part~=seek-row]{margin:0 -.5em}slot:not([name])::slotted(*){margin:0 .25em}slot[name=seek]::slotted(*){margin:0 .5em}::slotted([collapsed]){display:none}@media (prefers-reduced-motion:reduce){:host{transition:none}}:host([layout=compact]){padding:1.5em .5em .25em}";
8
8
  const IDLE_MS = 3e3;
9
9
  const SEEK_STEP = 5;
10
10
  /**
@@ -33,10 +33,10 @@ const PRIORITY = {
33
33
  [VOLUME]: 1,
34
34
  [MUTE_BUTTON]: 1
35
35
  };
36
- /** The width the volume group unfolds its slider to, from volume.ts: what a folded slider is counted at. */
37
- const SLIDER_WIDTH = 80;
38
- /** Room kept between the last button and the edge, so nothing sits flush against it. */
39
- const SLACK = 8;
36
+ /** The width the volume group unfolds its slider to, in em, from volume.css: what a folded slider is counted at. */
37
+ const SLIDER_WIDTH = 5;
38
+ /** Room kept between the last button and the edge, in em, so nothing sits flush against it. */
39
+ const SLACK = .5;
40
40
  function shown(node) {
41
41
  return node.getClientRects().length > 0;
42
42
  }
@@ -92,6 +92,10 @@ var MbxControlBar = class extends Component {
92
92
  * folded slider at the width it unfolds to. The row's own width says nothing, because the
93
93
  * spacer fills it whatever the buttons take.
94
94
  */
95
+ /** The bar's em in pixels: its sizes follow the player's font size. */
96
+ em() {
97
+ return Number.parseFloat(getComputedStyle(this).fontSize) || 16;
98
+ }
95
99
  needed(children) {
96
100
  let sum = 0;
97
101
  for (const child of children) {
@@ -100,7 +104,7 @@ var MbxControlBar = class extends Component {
100
104
  sum += child.getBoundingClientRect().width;
101
105
  sum += Number.parseFloat(margins.marginLeft) + Number.parseFloat(margins.marginRight);
102
106
  const folded = slider(child);
103
- if (folded !== null && shown(folded)) sum += Math.max(0, SLIDER_WIDTH - folded.getBoundingClientRect().width);
107
+ if (folded !== null && shown(folded)) sum += Math.max(0, SLIDER_WIDTH * this.em() - folded.getBoundingClientRect().width);
104
108
  }
105
109
  return sum;
106
110
  }
@@ -130,7 +134,7 @@ var MbxControlBar = class extends Component {
130
134
  });
131
135
  }
132
136
  candidates.sort((a, b) => b.priority - a.priority || b.index - a.index);
133
- const room = this.buttonsRow.clientWidth - SLACK;
137
+ const room = this.buttonsRow.clientWidth - SLACK * this.em();
134
138
  for (const { node, priority: level } of candidates) {
135
139
  if (level === 0) return;
136
140
  if (this.needed(children) <= room) return;
@@ -242,6 +246,18 @@ var MbxControlBar = class extends Component {
242
246
  };
243
247
  this.keep(screen.watch(reflect));
244
248
  reflect();
249
+ const menus = new MutationObserver(() => {
250
+ this.toggleAttribute("menu", this.querySelector("[open]") !== null);
251
+ });
252
+ menus.observe(this, {
253
+ subtree: true,
254
+ attributes: true,
255
+ attributeFilter: ["open"]
256
+ });
257
+ this.keep(() => {
258
+ menus.disconnect();
259
+ this.removeAttribute("menu");
260
+ });
245
261
  const pointer = () => {
246
262
  this.keyboard = false;
247
263
  this.wake(player);
@@ -20,7 +20,7 @@ var MbxCurrentTime = class extends TimeElement {
20
20
  const on = live(engine) !== void 0;
21
21
  const time = video.currentTime;
22
22
  this.text.data = on ? (_wall = wall(engine, time)) !== null && _wall !== void 0 ? _wall : `-${format(span(video, engine).end - time)}` : format(time);
23
- this.hidden = on && player.hasAttribute("live") && !player.hasAttribute("seekable");
23
+ this.hidden = on && player.hasAttribute("live") && !player.hasAttribute("seekable") || !on && this.getAttribute("layout") === "compact";
24
24
  }
25
25
  };
26
26
  //#endregion
@@ -5,7 +5,7 @@ import { Component } from "./component.js";
5
5
  import { style } from "./shared.js";
6
6
  import { fill } from "../labels.js";
7
7
  //#region src/elements/drm-badge.ts
8
- const STYLE = ":host{width:40px;height:40px;color:var(--mbx-muted);border-radius:var(--mbx-radius);cursor:default;justify-content:center;align-items:center;display:inline-flex;position:relative}:host([hidden]){display:none}:host(:focus){outline:2px solid var(--mbx-accent);outline-offset:-2px}:host(:focus:not(:focus-visible)){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}[part~=tooltip]{border-radius:var(--mbx-radius);color:var(--mbx-text);text-align:left;white-space:nowrap;pointer-events:none;background:#101114f2;margin-bottom:8px;padding:8px 10px;font-size:13px;line-height:1.4;position:absolute;bottom:100%;right:0;box-shadow:0 4px 16px #00000080}[part~=tooltip][hidden]{display:none}[part~=tooltip-title]{font-weight:600}[part~=tooltip-text]{color:var(--mbx-muted)}";
8
+ const STYLE = ":host{width:2.5em;height:2.5em;color:var(--mbx-muted);border-radius:var(--mbx-radius);cursor:default;justify-content:center;align-items:center;display:inline-flex;position:relative}:host([hidden]){display:none}:host(:focus){outline:2px solid var(--mbx-accent);outline-offset:-2px}:host(:focus:not(:focus-visible)){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}[part~=tooltip]{border-radius:var(--mbx-radius);color:var(--mbx-text);text-align:left;white-space:nowrap;pointer-events:none;background:#1c1c20f2;margin-bottom:.6154em;padding:.6154em .7692em;font-size:.8125em;line-height:1.4;position:absolute;bottom:100%;right:0;box-shadow:0 4px 16px #00000080}[part~=tooltip][hidden]{display:none}[part~=tooltip-title]{font-weight:600}[part~=tooltip-text]{color:var(--mbx-muted)}";
9
9
  /** The name a viewer knows a key system by. */
10
10
  function keySystemName(id) {
11
11
  if (id.startsWith("com.widevine")) return "Widevine";
@@ -4,7 +4,9 @@ import { TimeElement } from "./time-element.js";
4
4
  //#region src/elements/duration.ts
5
5
  /**
6
6
  * <mbx-duration>: the duration, "4:56", once the metadata is in. A live
7
- * stream has none, so the element hides while the stream is live.
7
+ * stream has none, so the element hides while the stream is live. On a
8
+ * compact player it shows the time left, "-3:12", in place of the current
9
+ * time, which hides there.
8
10
  */
9
11
  const TRAILING = ":host{text-align:right}";
10
12
  var MbxDuration = class extends TimeElement {
@@ -17,7 +19,9 @@ var MbxDuration = class extends TimeElement {
17
19
  const engine = player.engine;
18
20
  const on = live(engine) !== void 0;
19
21
  this.hidden = on;
20
- if (!on) this.text.data = format(span(player.video, engine).end);
22
+ if (on) return;
23
+ const end = span(player.video, engine).end;
24
+ this.text.data = this.getAttribute("layout") === "compact" ? `-${format(Math.max(0, end - player.video.currentTime))}` : format(end);
21
25
  }
22
26
  };
23
27
  //#endregion
@@ -2,7 +2,7 @@ import { el } from "../dom.js";
2
2
  import { Component } from "./component.js";
3
3
  import { style } from "./shared.js";
4
4
  //#region src/elements/error-screen.ts
5
- const STYLE = ":host{color:var(--mbx-text);font:400 15px / 1.4 var(--mbx-font);text-align:center;background:#000000bf;justify-content:center;align-items:center;padding:16px;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}:host([hidden]){display:none}[part~=box]{flex-direction:column;align-items:center;display:flex}[part~=box]>:not([hidden])~:not([hidden]){margin-top:8px}[part~=title]{font-size:18px;font-weight:600}[part~=detail]{color:var(--mbx-error);font-family:monospace;font-size:13px}[part~=retry]{height:36px;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;background:0 0;border:1px solid;padding:0 16px;font-weight:600}[part~=retry]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=retry]:focus:not(:focus-visible){outline:none}";
5
+ const STYLE = ":host{color:var(--mbx-text);font:400 .9375em / 1.4 var(--mbx-font);text-align:center;background:#000000bf;justify-content:center;align-items:center;padding:1.0667em;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}:host([hidden]){display:none}[part~=box]{flex-direction:column;align-items:center;display:flex}[part~=box]>:not([hidden])~:not([hidden]){margin-top:.5333em}[part~=title]{font-size:1.2em;font-weight:600}[part~=detail]{color:var(--mbx-error);font-family:monospace;font-size:.8667em}[part~=retry]{height:2.4em;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;background:0 0;border:1px solid;padding:0 1.0667em;font-weight:600}[part~=retry]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=retry]:focus:not(:focus-visible){outline:none}";
6
6
  var MbxErrorScreen = class extends Component {
7
7
  static get observedAttributes() {
8
8
  return ["label-title", "label-retry"];
@@ -16,7 +16,7 @@ import { live } from "../controls/session.js";
16
16
  * `text`, the name from `label-live` and `label-at-edge`. It sits in the
17
17
  * bar's seek row unless the page says otherwise.
18
18
  */
19
- const STYLE = ":host{display:inline-flex}:host([hidden]){display:none}[part~=button]{height:40px;font:inherit;letter-spacing:.06em;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;align-items:center;padding:0 8px;font-size:12px;font-weight:700;display:inline-flex}[part~=button]:hover{opacity:1}[part~=button]:disabled{cursor:default;opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=dot]{background:var(--mbx-muted);border-radius:50%;width:10px;height:10px;margin-right:6px;transition:background .2s}:host([at-edge]) [part~=dot]{background:var(--mbx-live);box-shadow:0 0 6px var(--mbx-live)}@media (prefers-reduced-motion:reduce){[part~=dot]{transition:none}}";
19
+ const STYLE = ":host{display:inline-flex}:host([hidden]){display:none}[part~=button]{height:2.5em;font:inherit;letter-spacing:.06em;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;align-items:center;padding:0 .5em;font-size:.75em;font-weight:700;display:inline-flex}[part~=button]:hover{opacity:1}[part~=button]:disabled{cursor:default;opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=dot]{background:var(--mbx-muted);border-radius:50%;width:.625em;height:.625em;margin-right:.375em;transition:background .2s}:host([at-edge]) [part~=dot]{background:var(--mbx-live);box-shadow:0 0 6px var(--mbx-live)}@media (prefers-reduced-motion:reduce){[part~=dot]{transition:none}}";
20
20
  var MbxLiveButton = class extends Component {
21
21
  static get observedAttributes() {
22
22
  return [
@@ -1,7 +1,7 @@
1
1
  import { Component } from "./component.js";
2
2
  import { BUTTON_STYLE, style } from "./shared.js";
3
3
  //#region src/elements/marker-button.ts
4
- const STYLE_CSS = ":host{right:calc(var(--mbx-pad,8px) + 8px);bottom:calc(var(--mbx-marker-lift,56px) + 12px);z-index:1;position:absolute}:host([hidden]){display:none}[part~=button]{width:auto;height:40px;color:var(--mbx-text);font:inherit;white-space:nowrap;background:#0009;border:1px solid #ffffff80;padding:0 18px;font-weight:600}[part~=button]:hover{background:#000c}";
4
+ const STYLE_CSS = ":host{right:calc(var(--mbx-pad,.5em) + .5em);bottom:calc(var(--mbx-marker-lift,3.5em) + .75em);z-index:1;transition:transform .3s;position:absolute}:host([idle]){transform:translateY(var(--mbx-marker-lift,3.5em))}:host([hidden]){display:none}[part~=button]{width:auto;height:2.5em;color:var(--mbx-text);font:inherit;white-space:nowrap;background:#0009;border:1px solid #ffffff80;padding:0 1.125em;font-weight:600}[part~=button]:hover{background:#000c}@media (prefers-reduced-motion:reduce){:host{transition:none}}";
5
5
  const WORDS = {
6
6
  "opening-credits": "Skip intro",
7
7
  "closing-credits": "Skip credits"
@@ -45,22 +45,21 @@ var MbxMarkerButton = class extends Component {
45
45
  this.listen(player, ["markerschange"], () => {
46
46
  this.render();
47
47
  });
48
- this.listen(player.video, [
49
- "play",
50
- "pause",
51
- "ended"
52
- ], () => {
53
- this.fit(player);
48
+ this.observe(player, ["upnext"], () => {
49
+ this.render();
54
50
  });
51
+ const idle = () => {
52
+ this.toggleAttribute("idle", player.hasAttribute("idle"));
53
+ };
54
+ this.observe(player, ["idle"], idle);
55
+ idle();
55
56
  if (typeof ResizeObserver !== "undefined") {
56
57
  this.resizer = new ResizeObserver(() => {
57
58
  this.fit(player);
58
59
  });
59
60
  this.resizer.observe(player);
60
- for (const tag of ["mbx-control-bar", "mbx-title"]) {
61
- const node = player.querySelector(tag);
62
- if (node !== null) this.resizer.observe(node);
63
- }
61
+ const bar = player.querySelector("mbx-control-bar");
62
+ if (bar !== null) this.resizer.observe(bar);
64
63
  }
65
64
  this.fit(player);
66
65
  this.render();
@@ -71,24 +70,21 @@ var MbxMarkerButton = class extends Component {
71
70
  this.resizer = null;
72
71
  }
73
72
  /**
74
- * Lifts the button above the bar's rows, or above the title's text while
75
- * it shows: each one's box less the padding over its content, which is
76
- * its fade. A hidden title has no box.
73
+ * Lifts the button above the bar's rows: the bar's box less the padding
74
+ * over them, its fade. The title sits on the other side, so the button
75
+ * stays where it is while the title shows.
77
76
  */
78
77
  fit(player) {
79
- let lift = 0;
80
- for (const tag of ["mbx-control-bar", "mbx-title"]) {
81
- const node = player.querySelector(tag);
82
- if (node === null) continue;
83
- const fade = Number.parseFloat(getComputedStyle(node).paddingTop) || 0;
84
- lift = Math.max(lift, node.getBoundingClientRect().height - fade);
85
- }
86
- this.style.setProperty("--mbx-marker-lift", `${lift}px`);
78
+ const bar = player.querySelector("mbx-control-bar");
79
+ const fade = bar === null ? 0 : Number.parseFloat(getComputedStyle(bar).paddingTop) || 0;
80
+ const lift = bar === null ? 0 : bar.getBoundingClientRect().height - fade;
81
+ this.style.setProperty("--mbx-marker-lift", `${Math.max(0, lift)}px`);
87
82
  }
88
83
  render() {
89
- var _player$markers$withi, _this$getAttribute, _ref, _this$getAttribute2;
84
+ var _player$markers$withi, _this$marker, _this$getAttribute, _ref, _this$getAttribute2;
90
85
  const player = this.player;
91
86
  this.marker = (_player$markers$withi = player === null || player === void 0 ? void 0 : player.markers.within(player.video.currentTime).find((marker) => marker.kind !== "blocked")) !== null && _player$markers$withi !== void 0 ? _player$markers$withi : null;
87
+ if (((_this$marker = this.marker) === null || _this$marker === void 0 ? void 0 : _this$marker.kind) === "closing-credits" && (player === null || player === void 0 ? void 0 : player.hasAttribute("upnext")) === true) this.marker = null;
92
88
  this.hidden = this.marker === null;
93
89
  if (this.marker === null) return;
94
90
  const kind = this.marker.kind;
@@ -14,6 +14,7 @@ var MenuElement = class extends Component {
14
14
  var _this$player$video$ge, _this$player;
15
15
  return (_this$player$video$ge = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.video.getBoundingClientRect()) !== null && _this$player$video$ge !== void 0 ? _this$player$video$ge : null;
16
16
  },
17
+ frame: () => this.player,
17
18
  back: (page) => {
18
19
  var _this$getAttribute;
19
20
  return fill((_this$getAttribute = this.getAttribute("label-back")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "Back from {page}", { page });
@@ -21,7 +22,7 @@ var MenuElement = class extends Component {
21
22
  });
22
23
  this.slots = iconSlots(states, glyphs);
23
24
  for (const state of states) this.menu.button.append(this.slots[state]);
24
- root.append(style(MENU_STYLE), this.menu.button, this.menu.popup);
25
+ root.append(style(MENU_STYLE), this.menu.button, this.menu.backdrop, this.menu.popup);
25
26
  }
26
27
  detach() {
27
28
  this.menu.close();
@@ -12,7 +12,7 @@ var MbxQualityMenu = class extends MenuElement {
12
12
  ];
13
13
  }
14
14
  constructor() {
15
- super(...single("settings"));
15
+ super(...single("quality"));
16
16
  this.engine = null;
17
17
  this.playing = void 0;
18
18
  show(this.slots, "default");
@@ -19,7 +19,7 @@ import { optional } from "../controls/session.js";
19
19
  * `rate` part shows the rate, "8×". The name comes from `label`,
20
20
  * "Fast forward" or "Rewind".
21
21
  */
22
- const STYLE_CSS = "[part~=button]{position:relative}[part~=rate]{font-variant-numeric:tabular-nums;font-size:10px;font-weight:700;line-height:1;position:absolute;bottom:2px;right:0}[part~=rate][hidden]{display:none}";
22
+ const STYLE_CSS = "[part~=button]{position:relative}[part~=rate]{font-variant-numeric:tabular-nums;font-size:.625em;font-weight:700;line-height:1;position:absolute;bottom:.2em;right:0}[part~=rate][hidden]{display:none}";
23
23
  const RATES = [
24
24
  4,
25
25
  8,
@@ -8,7 +8,7 @@ import { bufferGoal, live, optional, span, wall } from "../controls/session.js";
8
8
  import { chapterAt, chapters, followChapters } from "../controls/chapters.js";
9
9
  import { slider } from "../controls/slider.js";
10
10
  //#region src/elements/seek-bar.ts
11
- const STYLE_CSS = ":host,[part~=slider]{flex:1}[part~=thumb]{width:16px;height:16px;margin:-8px 0 0 -8px;box-shadow:0 1px 3px #0006}[part~=buffered]{position:absolute;top:0;bottom:0;left:0;right:0}[part~=blocked]{pointer-events:none;position:absolute;top:0;bottom:0;left:0;right:0}[part~=blocked-range]{background:var(--mbx-blocked,#000000bf);position:absolute;top:0;bottom:0}[part~=buffered-range]{background:#ffffff4d;position:absolute;top:0;bottom:0}[part~=hover]{background:var(--mbx-text);width:2px;margin-left:-1px;position:absolute;top:0;bottom:0}[part~=edge]{background:var(--mbx-live);width:2px;margin-left:-1px;position:absolute;top:0;bottom:0}[part~=preview]{background:var(--mbx-surface);border-radius:var(--mbx-radius);font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;flex-direction:column;align-items:center;margin-bottom:4px;padding:2px;font-size:13px;display:flex;position:absolute;bottom:100%;transform:translate(-50%)}[part~=preview]>:not([hidden])~:not([hidden]){margin-top:2px}[part~=preview-image]{border-radius:2px;position:relative;overflow:hidden}[part~=preview-frame]{border-radius:2px;display:block}[part~=preview-tile]{transform-origin:0 0;background-repeat:no-repeat;position:absolute;top:0;left:0}[part~=preview-time]{padding:0 4px}[part~=preview-title]{text-overflow:ellipsis;max-width:240px;padding:0 4px;overflow:hidden}[hidden]{display:none}";
11
+ const STYLE_CSS = ":host,[part~=slider]{flex:1}[part~=thumb]{width:1em;height:1em;margin:-.5em 0 0 -.5em;box-shadow:0 1px 3px #0006}[part~=buffered]{position:absolute;top:0;bottom:0;left:0;right:0}[part~=blocked]{pointer-events:none;position:absolute;top:0;bottom:0;left:0;right:0}[part~=blocked-range]{background:var(--mbx-blocked,#000000bf);position:absolute;top:0;bottom:0}[part~=buffered-range]{background:#ffffff4d;position:absolute;top:0;bottom:0}[part~=hover]{background:var(--mbx-text);width:.125em;margin-left:-1px;position:absolute;top:0;bottom:0}[part~=edge]{background:var(--mbx-live);width:.125em;margin-left:-1px;position:absolute;top:0;bottom:0}[part~=preview]{background:var(--mbx-surface);border-radius:var(--mbx-radius);font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;flex-direction:column;align-items:center;margin-bottom:.3077em;padding:.1538em;font-size:.8125em;display:flex;position:absolute;bottom:100%;transform:translate(-50%)}[part~=preview]>:not([hidden])~:not([hidden]){margin-top:.125em}[part~=preview-image]{border-radius:2px;position:relative;overflow:hidden}[part~=preview-frame]{border-radius:2px;display:block}[part~=preview-tile]{transform-origin:0 0;background-repeat:no-repeat;position:absolute;top:0;left:0}[part~=preview-time]{padding:0 .3077em}[part~=preview-title]{text-overflow:ellipsis;max-width:18.4615em;padding:0 .3077em;overflow:hidden}[hidden]{display:none}";
12
12
  const STEP = 5;
13
13
  /** Under `key-mode="preview"`, a target seeks this long after the last key. */
14
14
  const KEY_COMMIT_MS = 1e3;
@@ -26,8 +26,8 @@ const CANCEL_KEYS = [
26
26
  ];
27
27
  const PAGE = 30;
28
28
  const LIVE_WINDOW = 3;
29
- /** What the tile scales down to when the page sets no `--mbx-preview-width`. */
30
- const PREVIEW_WIDTH = 160;
29
+ /** What the tile scales down to, in em, when the page sets no `--mbx-preview-width`. */
30
+ const PREVIEW_WIDTH = 10;
31
31
  /** The buffer goal assumed for a session that reports none. */
32
32
  const BUFFER_GOAL = 30;
33
33
  /** The gap cut at a chapter boundary, in pixels. */
@@ -321,7 +321,8 @@ var MbxSeekBar = class extends Component {
321
321
  /** The width the page asked for through the token, or the default. */
322
322
  previewWidth() {
323
323
  const set = Number.parseFloat(getComputedStyle(this.preview).getPropertyValue("--mbx-preview-width"));
324
- return Number.isFinite(set) && set > 0 ? set : PREVIEW_WIDTH;
324
+ if (Number.isFinite(set) && set > 0) return set;
325
+ return PREVIEW_WIDTH * (Number.parseFloat(getComputedStyle(this).fontSize) || 16);
325
326
  }
326
327
  /** The preview's picture sources from `preview`, in order of preference: frames then tiles by default. */
327
328
  sources() {
@@ -7,8 +7,8 @@
7
7
  *
8
8
  * Nothing carries `!important`: a page's `::part()` rule must win.
9
9
  */
10
- const BUTTON_STYLE_CSS = ":host{display:inline-flex}:host([hidden]){display:none}[part~=button]{width:40px;height:40px;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}[part~=button]:hover{opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}slot[hidden]{display:none}";
11
- const SLIDER_STYLE_CSS = ":host{display:block}:host([hidden]){display:none}[part~=slider]{border-radius:var(--mbx-radius);cursor:pointer;touch-action:none;height:40px;position:relative}[part~=slider]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=slider]:focus:not(:focus-visible){outline:none}[part~=rail]{position:absolute;top:0;bottom:0;left:8px;right:8px}[part~=track]{background:#ffffff59;border-radius:2px;height:4px;position:absolute;top:50%;left:0;right:0;overflow:hidden;transform:translateY(-50%)}[part~=fill]{background:var(--mbx-accent);position:absolute;top:0;bottom:0;left:0}[part~=thumb]{background:var(--mbx-text);pointer-events:none;border-radius:50%;width:12px;height:12px;margin:-6px 0 0 -6px;position:absolute;top:50%}";
10
+ const BUTTON_STYLE_CSS = ":host{display:inline-flex}:host([hidden]){display:none}[part~=button]{width:2.5em;height:2.5em;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex;position:relative}[part~=button][aria-label]:after{content:attr(aria-label);display:var(--mbx-tooltip,block);background:var(--mbx-surface);border-radius:var(--mbx-radius);white-space:nowrap;pointer-events:none;opacity:0;margin-bottom:.4615em;padding:.3077em .6154em;font-size:.8125em;transition:opacity .1s;position:absolute;bottom:100%;left:50%;transform:translate(-50%)}[part~=button][aria-label]:focus:after{opacity:1;transition-delay:.4s}[part~=button][aria-label]:focus:not(:focus-visible):after{opacity:0;transition-delay:0s}@media (hover:hover){[part~=button][aria-label]:hover:after{opacity:1;transition-delay:.4s}}:host(:last-child) [part~=button][aria-label]:after{left:auto;right:0;transform:none}[part~=button]:hover{opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}slot[hidden]{display:none}";
11
+ const SLIDER_STYLE_CSS = ":host{display:block}:host([hidden]){display:none}[part~=slider]{border-radius:var(--mbx-radius);cursor:pointer;touch-action:none;height:2.5em;position:relative}[part~=slider]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=slider]:focus:not(:focus-visible){outline:none}[part~=rail]{position:absolute;top:0;bottom:0;left:.5em;right:.5em}[part~=track]{background:#ffffff59;border-radius:2px;height:.25em;position:absolute;top:50%;left:0;right:0;overflow:hidden;transform:translateY(-50%)}[part~=fill]{background:var(--mbx-accent);position:absolute;top:0;bottom:0;left:0}[part~=thumb]{background:var(--mbx-text);pointer-events:none;border-radius:50%;width:.75em;height:.75em;margin:-.375em 0 0 -.375em;position:absolute;top:50%}";
12
12
  const BUTTON_STYLE = BUTTON_STYLE_CSS;
13
13
  /** The style of a slider: the rail, the track with its fill, and the thumb. */
14
14
  const SLIDER_STYLE = SLIDER_STYLE_CSS;
@@ -19,7 +19,7 @@ function number(node, name, fallback) {
19
19
  return Number.isFinite(value) && value >= 0 ? value : fallback;
20
20
  }
21
21
  /** The style of a menu: the button from BUTTON_STYLE, and the popup above it with its items. */
22
- const MENU_STYLE = ":host{display:inline-flex}:host([hidden]){display:none}[part~=button]{width:40px;height:40px;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}[part~=button]:hover{opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}slot[hidden]{display:none}:host{position:relative}[part~=popup]{box-sizing:border-box;overscroll-behavior:contain;border-radius:var(--mbx-radius);background:#101114f2;flex-direction:column;min-width:160px;margin-bottom:8px;padding:6px;font-size:14px;display:flex;position:absolute;bottom:100%;right:0;overflow-y:auto;box-shadow:0 4px 16px #00000080}[part~=popup][hidden]{display:none}[part~=popup][more]{-webkit-mask-image:linear-gradient(#000 calc(100% - 24px),#0000);mask-image:linear-gradient(#000 calc(100% - 24px),#0000)}[part~=section]{flex-direction:column;display:flex}[part~=section]+[part~=section]{border-top:1px solid #ffffff1f;margin-top:6px;padding-top:6px}[part~=section-label]{letter-spacing:.06em;text-transform:uppercase;color:var(--mbx-muted);padding:4px 12px 2px;font-size:11px;font-weight:600}[part~=item]{width:100%;font:inherit;color:inherit;text-align:left;white-space:nowrap;border-radius:var(--mbx-radius);cursor:pointer;background:0 0;border:0;align-items:center;padding:8px 12px 8px 28px;display:flex}[part~=item]:hover{background:#ffffff1f}[part~=item-text]{text-overflow:ellipsis;min-width:0;overflow:hidden}[part~=item-image]{object-fit:cover;background:#ffffff14;border-radius:2px;flex:none;width:64px;height:36px;margin-right:12px}[part~=item-badge]{border:1px solid;border-radius:2px;flex:none;margin-left:8px;padding:0 4px;font-size:.75em;font-weight:600;line-height:1.5}[part~=item-detail]{color:var(--mbx-muted);font-variant-numeric:tabular-nums;margin-left:auto;padding-left:12px}[part~=item]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=item]:focus:not(:focus-visible){outline:none}[part~=page-item]{padding-right:28px;position:relative}[part~=page-item]:after{content:\"\";opacity:.7;border:1.5px solid;border-width:1.5px 1.5px 0 0;width:7px;height:7px;margin-top:-4px;position:absolute;top:50%;right:12px;transform:rotate(45deg)}[part~=back-item]{border-bottom:1px solid #ffffff1f;border-radius:0;margin-bottom:6px;font-weight:600;position:relative}[part~=back-item]:before{content:\"\";opacity:.7;border:0 solid;border-width:1.5px 0 0 1.5px;width:7px;height:7px;margin-top:-4px;position:absolute;top:50%;left:12px;transform:rotate(-45deg)}[part~=checked]{position:relative}[part~=checked]:before{content:\"\";background:var(--mbx-accent);border-radius:50%;width:6px;height:6px;margin-top:-3px;position:absolute;top:50%;left:12px}";
22
+ const MENU_STYLE = ":host{display:inline-flex}:host([hidden]){display:none}[part~=button]{width:2.5em;height:2.5em;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex;position:relative}[part~=button][aria-label]:after{content:attr(aria-label);display:var(--mbx-tooltip,block);background:var(--mbx-surface);border-radius:var(--mbx-radius);white-space:nowrap;pointer-events:none;opacity:0;margin-bottom:.4615em;padding:.3077em .6154em;font-size:.8125em;transition:opacity .1s;position:absolute;bottom:100%;left:50%;transform:translate(-50%)}[part~=button][aria-label]:focus:after{opacity:1;transition-delay:.4s}[part~=button][aria-label]:focus:not(:focus-visible):after{opacity:0;transition-delay:0s}@media (hover:hover){[part~=button][aria-label]:hover:after{opacity:1;transition-delay:.4s}}:host(:last-child) [part~=button][aria-label]:after{left:auto;right:0;transform:none}[part~=button]:hover{opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}slot[hidden]{display:none}:host{position:relative}[part~=popup]{box-sizing:border-box;overscroll-behavior:contain;border-radius:var(--mbx-radius);background:#1c1c20f2;flex-direction:column;min-width:16em;margin-bottom:.5714em;padding:.4286em;font-size:.875em;display:flex;position:absolute;bottom:100%;right:0;overflow-y:auto;box-shadow:0 4px 16px #00000080}[part~=popup][hidden]{display:none}[part~=section]{flex-direction:column;display:flex}[part~=section]+[part~=section]{border-top:1px solid #ffffff1f;margin-top:.4286em;padding-top:.4286em}[part~=section-label]{letter-spacing:.06em;text-transform:uppercase;color:var(--mbx-muted);padding:.3636em 1.0909em .1818em;font-size:.7857em;font-weight:600}[part~=glyph-item]{padding-left:1em}[part~=glyph-item]>svg{margin-right:.75em}[part~=item]{width:100%;font:inherit;color:inherit;text-align:left;white-space:nowrap;border-radius:var(--mbx-radius);cursor:pointer;background:0 0;border:0;align-items:center;padding:.7857em 1em .7857em 2.2857em;display:flex}[part~=item]:hover{background:#ffffff1f}[part~=item-text]{white-space:normal;-webkit-line-clamp:2;-webkit-box-orient:vertical;min-width:0;max-width:16em;display:-webkit-box;overflow:hidden}[part~=item-image]{object-fit:cover;background:#ffffff14;border-radius:2px;flex:none;width:4.5714em;height:2.5714em;margin-right:.8571em}[part~=item-badge]{border:1px solid;border-radius:2px;flex:none;margin-left:auto;padding:0 .381em;font-size:.75em;font-weight:600;line-height:1.5}[part~=item-glyph]{border:0;padding:0;font-size:1em;display:inline-flex}[part~=item-glyph] svg,[part~=glyph-item]>svg{fill:currentColor;flex:none;width:1.5em;height:1.5em}[part~=badge-text]{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}[part~=item-detail]{color:var(--mbx-muted);font-variant-numeric:tabular-nums;margin-left:auto;padding-left:.8571em}[part~=item-badge]~[part~=item-badge],[part~=item-badge]~[part~=item-detail]{margin-left:.7619em}[part~=item]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=item]:focus:not(:focus-visible){outline:none}[part~=page-item]{padding-right:2em;position:relative}[part~=page-item]:after{content:\"\";opacity:.7;border:1.5px solid;border-width:1.5px 1.5px 0 0;width:.5em;height:.5em;margin-top:-.2857em;position:absolute;top:50%;right:.8571em;transform:rotate(45deg)}[part~=title],[part~=back-item]{letter-spacing:.06em;text-transform:uppercase;color:var(--mbx-muted);font-size:.8125em;font-weight:600}[part~=title]{border-bottom:1px solid #ffffff1f;margin:-.5275em -.5275em .5275em;padding:.9231em 1.4066em}[part~=back-item]{border-bottom:1px solid #ffffff1f;border-radius:0;margin-bottom:.5275em;padding:.9231em 1.2308em .9231em 2.4615em;position:relative}[part~=back-item]:before{content:\"\";opacity:.7;border:0 solid;border-width:1.5px 0 0 1.5px;width:.5em;height:.5em;margin-top:-.2857em;position:absolute;top:50%;left:1em;transform:rotate(-45deg)}[part~=checked]{background:#ffffff14;position:relative}[part~=checked]:before{content:\"\";background:var(--mbx-accent);border-radius:50%;width:.4286em;height:.4286em;margin-top:-.2143em;position:absolute;top:50%;left:1em}:host([layout=compact]) [part~=popup]{z-index:1000;padding-bottom:calc(.4286em + env(safe-area-inset-bottom,0px));box-shadow:none;background:#1c1c20;border-radius:.75em .75em 0 0;margin:0;font-size:1em;right:auto}[part~=backdrop]{z-index:999;background:#00000080;position:absolute}[part~=backdrop][hidden]{display:none}";
23
23
  /** Puts a control in the bar's seek row when it is in a bar, unless the page wrote a `slot` of its own. */
24
24
  function seekRow(node) {
25
25
  var _node$parentElement;
@@ -5,10 +5,10 @@ import { BUTTON_STYLE, style } from "./shared.js";
5
5
  import { fill } from "../labels.js";
6
6
  //#region src/elements/skip-button.ts
7
7
  const SECONDS = 10;
8
- /** The glyph for a skip amount: the set draws 10 and 30, and a plain arrow says the rest. */
8
+ /** The glyph for a skip amount: the set draws 5, 10, 15 and 30, and a plain arrow says the rest. */
9
9
  function glyphFor(back, amount) {
10
10
  const side = back ? "seek-backward" : "seek-forward";
11
- if (amount === 10 || amount === 30) return `${side}-${amount}`;
11
+ if (amount === 5 || amount === 10 || amount === 15 || amount === 30) return `${side}-${amount}`;
12
12
  return side;
13
13
  }
14
14
  var MbxSkipButton = class extends Component {
@@ -1,7 +1,7 @@
1
1
  import { Component } from "./component.js";
2
2
  import { style } from "./shared.js";
3
3
  //#region src/elements/spinner.ts
4
- const STYLE = ":host{pointer-events:none;width:44px;height:44px;color:var(--mbx-text);filter:drop-shadow(0 1px 3px #00000080);margin:-22px 0 0 -22px;display:none;position:absolute;top:50%;left:50%}:host([waiting]){display:block}:host([hidden]){display:none}[part~=ring]{box-sizing:border-box;border:3px solid #ffffff38;border-top-color:currentColor;border-radius:50%;width:100%;height:100%;animation:.8s linear infinite mbx-turn}[part~=ring][hidden],slot[hidden]{display:none}::slotted(*){width:100%;height:100%}@keyframes mbx-turn{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){[part~=ring]{animation:none}}";
4
+ const STYLE = ":host{pointer-events:none;width:2.75em;height:2.75em;color:var(--mbx-text);filter:drop-shadow(0 1px 3px #00000080);margin:-1.375em 0 0 -1.375em;display:none;position:absolute;top:50%;left:50%}:host([waiting]){display:block}:host([hidden]){display:none}[part~=ring]{box-sizing:border-box;border:3px solid #ffffff38;border-top-color:currentColor;border-radius:50%;width:100%;height:100%;animation:.8s linear infinite mbx-turn}[part~=ring][hidden],slot[hidden]{display:none}::slotted(*){width:100%;height:100%}@keyframes mbx-turn{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){[part~=ring]{animation:none}}";
5
5
  /** What the video fires as it waits and as it goes on. */
6
6
  const EVENTS = [
7
7
  "waiting",
@@ -2,7 +2,7 @@ import { icon } from "../controls/icons.js";
2
2
  import { Component } from "./component.js";
3
3
  import { BUTTON_STYLE, iconSlots, show, style } from "./shared.js";
4
4
  //#region src/elements/start-button.ts
5
- const STYLE_CSS = ":host{margin:-32px 0 0 -52px;position:absolute;top:50%;left:50%}[part~=button]{width:104px;height:64px;color:var(--mbx-text);opacity:.9;background:#00000073;border:1px solid #ffffff2e;transition:opacity .15s,background .15s}[part~=button]:hover{opacity:1;background:#0009}:host([cramped]){display:none}[part~=icon],::slotted(*){width:40px;height:40px;margin-left:2px}@media (prefers-reduced-motion:reduce){[part~=button]{transition:none}}";
5
+ const STYLE_CSS = ":host{--mbx-tooltip:none;top:var(--mbx-start-top,50%);margin:-2.5em 0 0 -2.5em;position:absolute;left:50%}[part~=button]{z-index:0;width:5em;height:5em;color:var(--mbx-text);background:0 0;border:0;transition:color .15s;position:relative}[part~=button]:before{content:\"\";z-index:-1;background:var(--mbx-surface);opacity:.88;clip-path:polygon(0 0,79% 0,100% 21%,100% 100%,21% 100%,0 79%);transition:opacity .15s,background .15s;position:absolute;top:0;bottom:0;left:0;right:0}[part~=button]:hover{color:var(--mbx-surface)}[part~=button]:hover:before{background:var(--mbx-accent);opacity:1}:host([cramped]){display:none}[part~=icon],::slotted(*){width:3em;height:3em}slot[name=icon-play]>[part~=icon]{margin-left:.125em}@media (prefers-reduced-motion:reduce){[part~=button],[part~=button]:before{transition:none}}";
6
6
  const STATES = ["play", "replay"];
7
7
  const STYLE = BUTTON_STYLE + STYLE_CSS;
8
8
  var MbxStartButton = class extends Component {
@@ -63,6 +63,8 @@ var MbxStartButton = class extends Component {
63
63
  this.fit(player);
64
64
  });
65
65
  this.resizer.observe(player);
66
+ const bar = player.querySelector("mbx-control-bar");
67
+ if (bar !== null) this.resizer.observe(bar);
66
68
  }
67
69
  this.fit(player);
68
70
  this.render();
@@ -72,8 +74,17 @@ var MbxStartButton = class extends Component {
72
74
  (_this$resizer = this.resizer) === null || _this$resizer === void 0 || _this$resizer.disconnect();
73
75
  this.resizer = null;
74
76
  this.removeAttribute("cramped");
77
+ this.style.removeProperty("--mbx-start-top");
75
78
  }
76
79
  /**
80
+ * The button sits between two middles: the player's own, and the middle
81
+ * of the picture left over the bar's controls. With the bar at the foot,
82
+ * the player's middle reads as too low. The bar is light, a line and a
83
+ * few glyphs over a gradient, so the middle of what it leaves reads as
84
+ * too high, most of all in a short player. Halfway between them is where
85
+ * the eye puts the centre. The bar's top padding is the lead-in of its
86
+ * gradient, so the controls start under it.
87
+ *
77
88
  * Cramped when the button's foot would be inside the bar's box, which
78
89
  * starts at the top of its gradient: then the bar's own play button is
79
90
  * the one to press. Measured with the button shown, since a hidden one
@@ -83,13 +94,18 @@ var MbxStartButton = class extends Component {
83
94
  const bar = player.querySelector("mbx-control-bar");
84
95
  if (bar === null) {
85
96
  this.removeAttribute("cramped");
97
+ this.style.removeProperty("--mbx-start-top");
86
98
  return;
87
99
  }
100
+ const box = player.getBoundingClientRect();
101
+ const barBox = bar.getBoundingClientRect();
102
+ const controls = barBox.top + (Number.parseFloat(getComputedStyle(bar).paddingTop) || 0);
103
+ this.style.setProperty("--mbx-start-top", `${(box.height + controls - box.top) / 4}px`);
88
104
  const wasHidden = this.hidden;
89
105
  const wasCramped = this.hasAttribute("cramped");
90
106
  this.hidden = false;
91
107
  this.removeAttribute("cramped");
92
- const cramped = this.button.getBoundingClientRect().bottom > bar.getBoundingClientRect().top;
108
+ const cramped = this.button.getBoundingClientRect().bottom > barBox.top;
93
109
  this.hidden = wasHidden;
94
110
  this.toggleAttribute("cramped", cramped);
95
111
  if (cramped !== wasCramped) this.render();
@@ -38,30 +38,43 @@ var MbxSubtitlesMenu = class extends MenuElement {
38
38
  ];
39
39
  }
40
40
  constructor() {
41
- super(STATES, (state) => icon(state === "on" ? "closed-captions-on" : "closed-captions"));
41
+ super(STATES, (state) => icon(state === "on" ? "subtitles-on" : "subtitles"));
42
42
  this.engine = null;
43
43
  show(this.slots, "off");
44
44
  }
45
45
  name() {
46
46
  return "Subtitles";
47
47
  }
48
- /** A look's group: the choices named from the attributes, the value from the player's. */
49
- looks(player, attribute, name, fallback, choices, initial) {
50
- var _this$getAttribute;
48
+ /**
49
+ * A look's page: an item with the look's glyph, its name and the value
50
+ * chosen, which opens the choices. They are named from the attributes,
51
+ * and the value is the player's.
52
+ */
53
+ looks(player, attribute, name, fallback, choices, initial, glyph) {
54
+ var _this$getAttribute, _items$find$, _items$find;
51
55
  const set = player.getAttribute(attribute);
52
56
  const value = set !== null && choices.some(([id]) => id === set) ? set : initial;
57
+ const label = (_this$getAttribute = this.getAttribute(`label-${name}`)) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : fallback;
58
+ const items = choices.map(([id, text]) => {
59
+ var _this$getAttribute2;
60
+ return [id, (_this$getAttribute2 = this.getAttribute(`label-${id}`)) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : text];
61
+ });
53
62
  return {
54
63
  name,
55
- label: (_this$getAttribute = this.getAttribute(`label-${name}`)) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : fallback,
56
- items: choices.map(([id, text]) => {
57
- var _this$getAttribute2;
58
- return [id, (_this$getAttribute2 = this.getAttribute(`label-${id}`)) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : text];
59
- }),
60
- value,
61
- onSelect: (chosen) => {
62
- player.setAttribute(attribute, chosen);
63
- this.render();
64
- }
64
+ label,
65
+ glyph: () => icon(glyph),
66
+ detail: (_items$find$ = (_items$find = items.find(([id]) => id === value)) === null || _items$find === void 0 ? void 0 : _items$find[1]) !== null && _items$find$ !== void 0 ? _items$find$ : "",
67
+ entries: [{
68
+ name,
69
+ label,
70
+ hideLabel: true,
71
+ items,
72
+ value,
73
+ onSelect: (chosen) => {
74
+ player.setAttribute(attribute, chosen);
75
+ this.render();
76
+ }
77
+ }]
65
78
  };
66
79
  }
67
80
  attach(player) {
@@ -89,7 +102,7 @@ var MbxSubtitlesMenu = class extends MenuElement {
89
102
  return [entries, on === -1 ? null : String(on)];
90
103
  }
91
104
  render() {
92
- var _nativeTracks, _this$getAttribute6, _this$getAttribute7;
105
+ var _nativeTracks, _this$getAttribute6, _this$getAttribute7, _this$getAttribute8, _this$getAttribute9;
93
106
  super.render();
94
107
  const engine = this.engine;
95
108
  const player = this.player;
@@ -107,7 +120,12 @@ var MbxSubtitlesMenu = class extends MenuElement {
107
120
  this.menu.fill([{
108
121
  name: "track",
109
122
  label: word !== null && word !== void 0 ? word : "Track",
123
+ hideLabel: true,
110
124
  items,
125
+ badgeGlyphs: {
126
+ [(_this$getAttribute7 = this.getAttribute("label-cc")) !== null && _this$getAttribute7 !== void 0 ? _this$getAttribute7 : "CC"]: () => icon("closed-captions"),
127
+ [(_this$getAttribute8 = this.getAttribute("label-sdh")) !== null && _this$getAttribute8 !== void 0 ? _this$getAttribute8 : "SDH"]: () => icon("sdh")
128
+ },
111
129
  value: active !== null && active !== void 0 ? active : OFF,
112
130
  onSelect: (value) => {
113
131
  if (listed !== void 0) {
@@ -120,8 +138,8 @@ var MbxSubtitlesMenu = class extends MenuElement {
120
138
  }
121
139
  }, {
122
140
  name: "settings",
123
- label: (_this$getAttribute7 = this.getAttribute("label-settings")) !== null && _this$getAttribute7 !== void 0 ? _this$getAttribute7 : "Settings",
124
- entries: [this.looks(player, SUBTITLE_SIZE, "size", "Size", SIZES, "medium"), this.looks(player, SUBTITLE_BACKGROUND, "background", "Background", BACKGROUNDS, "dark")]
141
+ label: (_this$getAttribute9 = this.getAttribute("label-settings")) !== null && _this$getAttribute9 !== void 0 ? _this$getAttribute9 : "Settings",
142
+ entries: [this.looks(player, SUBTITLE_SIZE, "size", "Size", SIZES, "medium", "text-size"), this.looks(player, SUBTITLE_BACKGROUND, "background", "Background", BACKGROUNDS, "dark", "text-background")]
125
143
  }]);
126
144
  show(this.slots, active === null ? "off" : "on");
127
145
  this.hidden = tracks.length === 0;
@@ -24,7 +24,7 @@ import { style } from "./shared.js";
24
24
  * override. Placed first among the screens, so the start button, the
25
25
  * error screen and the spinner paint over its band.
26
26
  */
27
- const STYLE = ":host{padding:72px calc(var(--mbx-pad) + 8px) calc(var(--mbx-bar-rows,0px) + 12px);color:var(--mbx-text);font:400 14px / 1.35 var(--mbx-font);text-shadow:0 1px 2px #0006;pointer-events:none;background:linear-gradient(#0000,#0000004d 55%,#0000008c);align-items:flex-end;display:flex;position:absolute;bottom:0;left:0;right:0}:host([playing]),:host([empty]),:host([hidden]){display:none}[part~=artwork]{border-radius:var(--mbx-radius);object-fit:cover;flex:none;width:auto;max-width:128px;height:72px;margin-right:14px;box-shadow:0 0 0 1px #ffffff24}[part~=artwork][hidden]{display:none}[part~=text]{flex-direction:column;min-width:0;max-width:60ch;display:flex}[part~=text]>:not([hidden])~:not([hidden]){margin-top:2px}[part~=heading]{letter-spacing:-.01em;white-space:nowrap;text-overflow:ellipsis;font-size:20px;font-weight:600;line-height:1.2;overflow:hidden}[part~=subheading]{color:#ffffffc7;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}[part~=heading]:empty,[part~=subheading]:empty{display:none}";
27
+ const STYLE = ":host{padding:4.5em calc(var(--mbx-pad) + .5em) calc(var(--mbx-bar-rows,0px) + .75em);color:var(--mbx-text);font:400 1em / 1.35 var(--mbx-font);text-shadow:0 1px 2px #0006;pointer-events:none;background:linear-gradient(#0000,#0000004d 55%,#0000008c);align-items:flex-end;display:flex;position:absolute;bottom:0;left:0;right:0}:host([playing]),:host([empty]),:host([hidden]){display:none}[part~=artwork]{border-radius:var(--mbx-radius);object-fit:cover;flex:none;width:auto;max-width:8em;height:4.5em;margin-right:.875em;box-shadow:0 0 0 1px #ffffff24}[part~=artwork][hidden]{display:none}[part~=text]{flex-direction:column;min-width:0;max-width:60ch;font-size:.875em;display:flex}[part~=text]>:not([hidden])~:not([hidden]){margin-top:.1429em}[part~=heading]{letter-spacing:-.01em;white-space:nowrap;text-overflow:ellipsis;font-size:1.4286em;font-weight:600;line-height:1.2;overflow:hidden}[part~=subheading]{color:#ffffffc7;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}[part~=heading]:empty,[part~=subheading]:empty{display:none}:host([artwork]) [part~=heading]:not(:empty){white-space:normal;-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box}:host([artwork][subheading]) [part~=heading]:not(:empty){-webkit-line-clamp:2}:host([layout=compact]){padding:.75em calc(var(--mbx-pad) + .5em) 2.5em;background:linear-gradient(#0000008c,#0000);align-items:flex-start;top:0;bottom:auto}:host([layout=compact]) [part~=artwork],:host([layout=compact]) [part~=subheading]{display:none}:host([layout=compact]) [part~=text] [part~=heading]:not(:empty){white-space:nowrap;font-size:1.1429em;display:block}";
28
28
  var MbxTitle = class extends Component {
29
29
  static get observedAttributes() {
30
30
  return [
@@ -60,6 +60,8 @@ var MbxTitle = class extends Component {
60
60
  this.fit(player);
61
61
  });
62
62
  this.resizer.observe(player);
63
+ const bar = player.querySelector("mbx-control-bar");
64
+ if (bar !== null) this.resizer.observe(bar);
63
65
  }
64
66
  this.fit(player);
65
67
  this.state(player);
@@ -2,7 +2,7 @@ import { Component } from "./component.js";
2
2
  import { SLIDER_STYLE, number, style } from "./shared.js";
3
3
  import { slider } from "../controls/slider.js";
4
4
  //#region src/elements/volume-slider.ts
5
- const VOLUME_SLIDER_CSS = ":host{flex:none;width:80px}";
5
+ const VOLUME_SLIDER_CSS = ":host{flex:none;width:5em}";
6
6
  const STEP = .05;
7
7
  const PAGE = .2;
8
8
  var MbxVolumeSlider = class extends Component {
@@ -15,7 +15,7 @@ import { style } from "./shared.js";
15
15
  * stuck. So the group carries `pointer` from a pointer press until a key
16
16
  * is pressed or focus leaves, and focus unfolds the slider only without it.
17
17
  */
18
- const STYLE = ":host{align-items:center;display:inline-flex}:host([hidden]){display:none}::slotted(mbx-volume-slider){opacity:0;width:0;transition:width .2s,opacity .2s;overflow:hidden}::slotted(mbx-volume-slider[collapsed]){display:none}:host(:hover) ::slotted(mbx-volume-slider),:host(:focus-within:not([pointer])) ::slotted(mbx-volume-slider){opacity:1;width:80px}@media (prefers-reduced-motion:reduce){::slotted(mbx-volume-slider){transition:none}}";
18
+ const STYLE = ":host{align-items:center;display:inline-flex}:host([hidden]){display:none}::slotted(mbx-volume-slider){opacity:0;width:0;transition:width .2s,opacity .2s;overflow:hidden}::slotted(mbx-volume-slider[collapsed]){display:none}:host(:hover) ::slotted(mbx-volume-slider),:host(:focus-within:not([pointer])) ::slotted(mbx-volume-slider){opacity:1;width:5em}@media (prefers-reduced-motion:reduce){::slotted(mbx-volume-slider){transition:none}}";
19
19
  var MbxVolume = class extends Component {
20
20
  constructor() {
21
21
  super();
@@ -1,4 +1,4 @@
1
- import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/asyncToGenerator.js";
1
+ import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/asyncToGenerator.js";
2
2
  //#region src/presets.ts
3
3
  /** eme-core's teardown calls `element.setMediaKeys(null)` unguarded, so a build without EME throws out of `detach`. */
4
4
  const DRM_STAGES = [