@mattebox/player 0.9.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.
- package/dist/cdn/mattebox-player.min.js +3 -3
- package/dist/controls/cues.d.ts.map +1 -1
- package/dist/controls/cues.js +11 -5
- package/dist/controls/cues.js.map +1 -1
- package/dist/controls/menu.d.ts +9 -0
- package/dist/controls/menu.d.ts.map +1 -1
- package/dist/controls/menu.js +57 -14
- package/dist/controls/menu.js.map +1 -1
- package/dist/elements/menu-element.d.ts.map +1 -1
- package/dist/elements/menu-element.js +2 -1
- package/dist/elements/menu-element.js.map +1 -1
- package/dist/elements/shared.js +1 -1
- package/dist/elements/start-button.d.ts +7 -4
- package/dist/elements/start-button.d.ts.map +1 -1
- package/dist/elements/start-button.js +9 -6
- package/dist/elements/start-button.js.map +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/asyncToGenerator.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/defineProperty.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/objectSpread2.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPrimitive.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPropertyKey.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/typeof.js +1 -1
- package/dist/es2015/controls/chapters.js +1 -1
- package/dist/es2015/controls/cues.js +11 -5
- package/dist/es2015/controls/menu.js +62 -17
- package/dist/es2015/element.js +2 -2
- package/dist/es2015/elements/menu-element.js +2 -1
- package/dist/es2015/elements/shared.js +1 -1
- package/dist/es2015/elements/start-button.js +9 -6
- package/dist/es2015/presets.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { optional } from "./session.js";
|
|
3
3
|
//#region src/controls/chapters.ts
|
|
4
4
|
/** The first chapters track on the video, or null. */
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Subtitles and the bar. Two things.
|
|
4
4
|
*
|
|
5
|
-
* The lift: the browser draws native cues
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* The lift: the browser draws native cues on the bottom edge of the video,
|
|
6
|
+
* and under the bar. Every active cue the author left unpositioned is
|
|
7
|
+
* moved up: above the bar while it shows, and one line off the edge while
|
|
8
|
+
* it is hidden, so the text never sits on the picture's border. The
|
|
8
9
|
* position is a negative line count, the one form every browser wraps at
|
|
9
10
|
* the video's width; a percentage does not wrap in Chromium. Chromium
|
|
10
11
|
* anchors the box's top on the count and Gecko its bottom, and their
|
|
@@ -43,6 +44,8 @@ const LINE_HEIGHT = 1.2;
|
|
|
43
44
|
const CUE_WIDTH = .96;
|
|
44
45
|
/** Pixels of air between the bar and the cue above it, before rounding up to a line. */
|
|
45
46
|
const AIR = 6;
|
|
47
|
+
/** Lines of air under a cue while the bar is hidden. */
|
|
48
|
+
const REST = 1;
|
|
46
49
|
/** Puts the cue rules in the document, once. */
|
|
47
50
|
function cueStyle() {
|
|
48
51
|
if (document.head.querySelector(`style[${MARK}]`) !== null) return;
|
|
@@ -55,6 +58,8 @@ function cueLift(video, host, covered) {
|
|
|
55
58
|
/** The cues moved, with what they were, so they and only they are put back. */
|
|
56
59
|
const lifted = /* @__PURE__ */ new Map();
|
|
57
60
|
let on = false;
|
|
61
|
+
/** False once disposed: the cues go back to where the author left them. */
|
|
62
|
+
let live = true;
|
|
58
63
|
let canvas;
|
|
59
64
|
function showing() {
|
|
60
65
|
const out = [];
|
|
@@ -104,10 +109,10 @@ function cueLift(video, host, covered) {
|
|
|
104
109
|
const height = box.height;
|
|
105
110
|
const span = covered();
|
|
106
111
|
const pixels = span.bottom - span.top;
|
|
107
|
-
const lift =
|
|
112
|
+
const lift = live && height > 0;
|
|
108
113
|
const font = fontSize(height);
|
|
109
114
|
const unit = font * LINE_HEIGHT;
|
|
110
|
-
const base = Math.ceil((pixels + AIR) / unit);
|
|
115
|
+
const base = on && pixels > 0 && pixels < height ? Math.ceil((pixels + AIR) / unit) : REST;
|
|
111
116
|
for (const track of showing()) {
|
|
112
117
|
var _track$activeCues;
|
|
113
118
|
const active = [...(_track$activeCues = track.activeCues) !== null && _track$activeCues !== void 0 ? _track$activeCues : []].filter((cue) => cue instanceof VTTCue).sort((a, b) => a.startTime - b.startTime);
|
|
@@ -163,6 +168,7 @@ function cueLift(video, host, covered) {
|
|
|
163
168
|
},
|
|
164
169
|
dispose() {
|
|
165
170
|
on = false;
|
|
171
|
+
live = false;
|
|
166
172
|
apply();
|
|
167
173
|
video.textTracks.removeEventListener("change", watch);
|
|
168
174
|
video.textTracks.removeEventListener("addtrack", watch);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { el, setChildren, state } from "../dom.js";
|
|
2
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
3
3
|
//#region src/controls/menu.ts
|
|
4
4
|
/**
|
|
5
5
|
* The menu primitive the quality, audio, subtitles and speed menus share: a
|
|
@@ -50,12 +50,31 @@ function menu(options) {
|
|
|
50
50
|
button.setAttribute("aria-haspopup", "menu");
|
|
51
51
|
button.setAttribute("aria-expanded", "false");
|
|
52
52
|
const popup = el("div", "popup");
|
|
53
|
-
popup.addEventListener("scroll", () => {
|
|
54
|
-
more();
|
|
55
|
-
});
|
|
56
53
|
popup.setAttribute("role", "menu");
|
|
57
54
|
popup.hidden = true;
|
|
55
|
+
const backdrop = el("div", "backdrop");
|
|
56
|
+
backdrop.hidden = true;
|
|
57
|
+
backdrop.addEventListener("click", () => {
|
|
58
|
+
close();
|
|
59
|
+
});
|
|
58
60
|
let open = false;
|
|
61
|
+
/**
|
|
62
|
+
* While the menu is open it follows its player: a change of tier draws
|
|
63
|
+
* the page again, as a popup or as a sheet, and a change of size places
|
|
64
|
+
* it again. A page that resizes with a menu open sees it keep up.
|
|
65
|
+
*/
|
|
66
|
+
const tiers = typeof MutationObserver === "undefined" ? null : new MutationObserver(() => {
|
|
67
|
+
var _ref, _checked;
|
|
68
|
+
if (!open) return;
|
|
69
|
+
const held = popup.contains(focused());
|
|
70
|
+
render();
|
|
71
|
+
if (held) (_ref = (_checked = checked()) !== null && _checked !== void 0 ? _checked : items()[0]) === null || _ref === void 0 || _ref.focus();
|
|
72
|
+
});
|
|
73
|
+
const sizes = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => {
|
|
74
|
+
if (open) fit();
|
|
75
|
+
});
|
|
76
|
+
/** Whether the page drawn last was drawn for a compact player. */
|
|
77
|
+
let drawnCompact = false;
|
|
59
78
|
let name = "";
|
|
60
79
|
let first = [];
|
|
61
80
|
/** The pages opened, the first being the menu itself. */
|
|
@@ -80,25 +99,31 @@ function menu(options) {
|
|
|
80
99
|
* left of its right edge.
|
|
81
100
|
*/
|
|
82
101
|
function fit() {
|
|
83
|
-
|
|
84
|
-
|
|
102
|
+
var _options$frame$getBou, _options$frame;
|
|
103
|
+
const compact = host.getAttribute("layout") === "compact";
|
|
104
|
+
const picture = compact ? (_options$frame$getBou = (_options$frame = options.frame()) === null || _options$frame === void 0 ? void 0 : _options$frame.getBoundingClientRect()) !== null && _options$frame$getBou !== void 0 ? _options$frame$getBou : null : options.picture();
|
|
105
|
+
backdrop.hidden = !(open && compact && picture !== null);
|
|
106
|
+
for (const node of [popup, backdrop]) node.style.left = node.style.bottom = node.style.width = "";
|
|
107
|
+
backdrop.style.height = "";
|
|
108
|
+
if (picture === null) return;
|
|
109
|
+
if (compact) {
|
|
110
|
+
const box = host.getBoundingClientRect();
|
|
111
|
+
for (const node of [popup, backdrop]) {
|
|
112
|
+
node.style.left = `${picture.left - box.left}px`;
|
|
113
|
+
node.style.bottom = `${box.bottom - picture.bottom}px`;
|
|
114
|
+
node.style.width = `${picture.width}px`;
|
|
115
|
+
}
|
|
116
|
+
backdrop.style.height = `${picture.height}px`;
|
|
117
|
+
popup.style.maxHeight = `${Math.max(0, Math.floor(picture.height - AIR))}px`;
|
|
85
118
|
popup.style.maxWidth = "";
|
|
86
|
-
more();
|
|
87
119
|
return;
|
|
88
120
|
}
|
|
89
|
-
const picture = options.picture();
|
|
90
|
-
if (picture === null) return;
|
|
91
121
|
const room = button.getBoundingClientRect().top - picture.top - AIR;
|
|
92
122
|
const most = Number.parseFloat(getComputedStyle(host).getPropertyValue("--mbx-menu-max-height")) || MAX_HEIGHT * (Number.parseFloat(getComputedStyle(host).fontSize) || 16);
|
|
93
123
|
popup.style.maxHeight = `${Math.max(0, Math.floor(Math.min(most, room)))}px`;
|
|
94
|
-
more();
|
|
95
124
|
const wide = host.getBoundingClientRect().right - picture.left - AIR;
|
|
96
125
|
popup.style.maxWidth = `${Math.max(0, Math.floor(wide))}px`;
|
|
97
126
|
}
|
|
98
|
-
/** `more` on the popup while rows wait below its foot, which then fades out. */
|
|
99
|
-
function more() {
|
|
100
|
-
popup.toggleAttribute("more", popup.scrollTop + popup.clientHeight < popup.scrollHeight - 1);
|
|
101
|
-
}
|
|
102
127
|
function clear() {
|
|
103
128
|
for (const item of items()) {
|
|
104
129
|
const handler = handlers.get(item);
|
|
@@ -120,7 +145,16 @@ function menu(options) {
|
|
|
120
145
|
const page = stack[stack.length - 1];
|
|
121
146
|
if (page === void 0) return;
|
|
122
147
|
let tab = true;
|
|
123
|
-
|
|
148
|
+
drawnCompact = host.getAttribute("layout") === "compact";
|
|
149
|
+
if (stack.length === 1 && name !== "" && drawnCompact) {
|
|
150
|
+
const leave = item("item back-item", name, () => {
|
|
151
|
+
close();
|
|
152
|
+
button.focus();
|
|
153
|
+
});
|
|
154
|
+
leave.setAttribute("role", "menuitem");
|
|
155
|
+
leave.setAttribute("aria-label", options.back(name));
|
|
156
|
+
popup.append(leave);
|
|
157
|
+
} else if (stack.length === 1 && name !== "") {
|
|
124
158
|
const title = el("div", "title", name);
|
|
125
159
|
title.setAttribute("aria-hidden", "true");
|
|
126
160
|
popup.append(title);
|
|
@@ -202,7 +236,10 @@ function menu(options) {
|
|
|
202
236
|
function close() {
|
|
203
237
|
if (!open) return;
|
|
204
238
|
open = false;
|
|
239
|
+
tiers === null || tiers === void 0 || tiers.disconnect();
|
|
240
|
+
sizes === null || sizes === void 0 || sizes.disconnect();
|
|
205
241
|
popup.hidden = true;
|
|
242
|
+
backdrop.hidden = true;
|
|
206
243
|
button.setAttribute("aria-expanded", "false");
|
|
207
244
|
host.removeAttribute("open");
|
|
208
245
|
document.removeEventListener("pointerdown", outside, true);
|
|
@@ -212,15 +249,22 @@ function menu(options) {
|
|
|
212
249
|
}
|
|
213
250
|
}
|
|
214
251
|
function show() {
|
|
215
|
-
var
|
|
252
|
+
var _ref2, _checked2;
|
|
216
253
|
if (open) return;
|
|
217
254
|
open = true;
|
|
255
|
+
if (host.getAttribute("layout") === "compact" !== drawnCompact) render();
|
|
218
256
|
popup.hidden = false;
|
|
219
257
|
button.setAttribute("aria-expanded", "true");
|
|
220
258
|
host.setAttribute("open", "");
|
|
221
259
|
document.addEventListener("pointerdown", outside, true);
|
|
260
|
+
tiers === null || tiers === void 0 || tiers.observe(host, {
|
|
261
|
+
attributes: true,
|
|
262
|
+
attributeFilter: ["layout"]
|
|
263
|
+
});
|
|
264
|
+
const frame = options.frame();
|
|
265
|
+
if (frame !== null) sizes === null || sizes === void 0 || sizes.observe(frame);
|
|
222
266
|
fit();
|
|
223
|
-
(
|
|
267
|
+
(_ref2 = (_checked2 = checked()) !== null && _checked2 !== void 0 ? _checked2 : items()[0]) === null || _ref2 === void 0 || _ref2.focus();
|
|
224
268
|
}
|
|
225
269
|
function toggle() {
|
|
226
270
|
if (open) close();
|
|
@@ -267,6 +311,7 @@ function menu(options) {
|
|
|
267
311
|
return {
|
|
268
312
|
button,
|
|
269
313
|
popup,
|
|
314
|
+
backdrop,
|
|
270
315
|
label(text) {
|
|
271
316
|
name = text;
|
|
272
317
|
button.setAttribute("aria-label", text);
|
package/dist/es2015/element.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createMarkers } from "./controls/markers.js";
|
|
2
2
|
import { namespaces } from "./namespaces.js";
|
|
3
|
-
import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.
|
|
3
|
+
import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/asyncToGenerator.js";
|
|
4
4
|
import { drmGuard, resolvePreset } from "./presets.js";
|
|
5
5
|
import { STYLE } from "./style.js";
|
|
6
6
|
import { errorSurface } from "./surface.js";
|
|
7
7
|
import { PLAYER } from "./tags.js";
|
|
8
|
-
import _objectSpread2 from "./_virtual/_@oxc-project_runtime@0.
|
|
8
|
+
import _objectSpread2 from "./_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
9
9
|
import { createPlayer, inferType, matteboxHandler, nativeHandler, preferNativeHls } from "@mattebox/player-core";
|
|
10
10
|
//#region src/element.ts
|
|
11
11
|
/**
|
|
@@ -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();
|
|
@@ -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: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~=
|
|
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;
|
|
@@ -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{--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}@media (prefers-reduced-motion:reduce){[part~=button],[part~=button]:before{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 {
|
|
@@ -77,10 +77,13 @@ var MbxStartButton = class extends Component {
|
|
|
77
77
|
this.style.removeProperty("--mbx-start-top");
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
|
-
* The button sits
|
|
81
|
-
*
|
|
82
|
-
* player's
|
|
83
|
-
*
|
|
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.
|
|
84
87
|
*
|
|
85
88
|
* Cramped when the button's foot would be inside the bar's box, which
|
|
86
89
|
* starts at the top of its gradient: then the bar's own play button is
|
|
@@ -97,7 +100,7 @@ var MbxStartButton = class extends Component {
|
|
|
97
100
|
const box = player.getBoundingClientRect();
|
|
98
101
|
const barBox = bar.getBoundingClientRect();
|
|
99
102
|
const controls = barBox.top + (Number.parseFloat(getComputedStyle(bar).paddingTop) || 0);
|
|
100
|
-
this.style.setProperty("--mbx-start-top", `${(controls - box.top) /
|
|
103
|
+
this.style.setProperty("--mbx-start-top", `${(box.height + controls - box.top) / 4}px`);
|
|
101
104
|
const wasHidden = this.hidden;
|
|
102
105
|
const wasCramped = this.hasAttribute("cramped");
|
|
103
106
|
this.hidden = false;
|
package/dist/es2015/presets.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.
|
|
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 = [
|