@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
|
@@ -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
|
|
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.
|
|
37
|
-
const SLIDER_WIDTH =
|
|
38
|
-
/** Room kept between the last button and the edge, so nothing sits flush against it. */
|
|
39
|
-
const SLACK =
|
|
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:
|
|
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 (
|
|
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
|
|
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:
|
|
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
|
|
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.
|
|
49
|
-
|
|
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
|
-
|
|
61
|
-
|
|
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
|
|
75
|
-
*
|
|
76
|
-
*
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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;
|
|
@@ -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
|
|
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:
|
|
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 =
|
|
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
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
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~=popup][more]{-webkit-mask-image:linear-gradient(#000 calc(100% - 1.5em),#0000);mask-image:linear-gradient(#000 calc(100% - 1.5em),#0000)}[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~=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~=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;max-height:70vh;padding-bottom:calc(.4286em + env(safe-area-inset-bottom,0px));background:#1c1c20;border-radius:.75em .75em 0 0;margin:0;font-size:1em;position:fixed;bottom:0;left:0;right:0;box-shadow:0 0 0 100vmax #00000080}";
|
|
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:
|
|
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:-
|
|
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}}";
|
|
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,14 @@ 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 in the middle of the picture left over the bar's
|
|
81
|
+
* controls, not of the whole player: with the bar at the foot, the
|
|
82
|
+
* player's own middle reads as too low. The bar's top padding is the
|
|
83
|
+
* lead-in of its gradient, so the controls start under it.
|
|
84
|
+
*
|
|
77
85
|
* Cramped when the button's foot would be inside the bar's box, which
|
|
78
86
|
* starts at the top of its gradient: then the bar's own play button is
|
|
79
87
|
* the one to press. Measured with the button shown, since a hidden one
|
|
@@ -83,13 +91,18 @@ var MbxStartButton = class extends Component {
|
|
|
83
91
|
const bar = player.querySelector("mbx-control-bar");
|
|
84
92
|
if (bar === null) {
|
|
85
93
|
this.removeAttribute("cramped");
|
|
94
|
+
this.style.removeProperty("--mbx-start-top");
|
|
86
95
|
return;
|
|
87
96
|
}
|
|
97
|
+
const box = player.getBoundingClientRect();
|
|
98
|
+
const barBox = bar.getBoundingClientRect();
|
|
99
|
+
const controls = barBox.top + (Number.parseFloat(getComputedStyle(bar).paddingTop) || 0);
|
|
100
|
+
this.style.setProperty("--mbx-start-top", `${(controls - box.top) / 2}px`);
|
|
88
101
|
const wasHidden = this.hidden;
|
|
89
102
|
const wasCramped = this.hasAttribute("cramped");
|
|
90
103
|
this.hidden = false;
|
|
91
104
|
this.removeAttribute("cramped");
|
|
92
|
-
const cramped = this.button.getBoundingClientRect().bottom >
|
|
105
|
+
const cramped = this.button.getBoundingClientRect().bottom > barBox.top;
|
|
93
106
|
this.hidden = wasHidden;
|
|
94
107
|
this.toggleAttribute("cramped", cramped);
|
|
95
108
|
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" ? "
|
|
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
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
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
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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$
|
|
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:
|
|
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:
|
|
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:
|
|
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();
|
package/dist/es2015/style.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const STYLE = ":host{--mbx-surface:#
|
|
1
|
+
const STYLE = ":host{--mbx-surface:#1c1c20;--mbx-text:#f3ede4;--mbx-muted:#aaa49a;--mbx-accent:#e0543c;--mbx-error:#ffb4ab;--mbx-live:#ff4d4d;--mbx-radius:.25em;--mbx-gap:.625em;--mbx-pad:.5em;--mbx-font:system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;background:#000;outline:none;font-size:16px;display:block;position:relative}:host([hidden]){display:none}[part~=stage]{flex-direction:column;justify-content:center;height:100%;display:flex;position:relative}::slotted(video){object-fit:contain;width:100%;min-height:0;max-height:100%;display:block}::slotted(source){display:none}@supports (aspect-ratio:1){::slotted(video){aspect-ratio:auto 16/9}}:host([casting]) ::slotted(mbx-control-bar),:host([casting]) ::slotted(mbx-start-button),:host([ended]) ::slotted(mbx-marker-button),:host([controls=none]) ::slotted(:not(video)){display:none}:host(:focus) [part~=stage]{outline:2px solid var(--mbx-accent);outline-offset:-2px}:host(:focus:not(:focus-visible)) [part~=stage]{outline:none}[part~=error]{padding:calc(var(--mbx-pad) - var(--mbx-gap) / 2);background:var(--mbx-surface);color:var(--mbx-error);font:400 .8125em / 1.4 var(--mbx-font);flex-wrap:wrap;align-items:center;display:flex}:host(:fullscreen) ::slotted(video){flex:1}:host(:fullscreen) [part~=error]{position:absolute;bottom:0;left:0;right:0}:host(:-webkit-full-screen) ::slotted(video){flex:1}:host(:-webkit-full-screen) [part~=error]{position:absolute;bottom:0;left:0;right:0}[part~=error]>*{margin:calc(var(--mbx-gap) / 2)}[part~=value]{color:var(--mbx-accent)}[part~=button]{font:inherit;color:inherit;border-radius:var(--mbx-radius);background:0 0;border:1px solid;padding:.125em .375em}[hidden]{display:none}:host([tooltips=off]){--mbx-tooltip:none}:host([layout=wide]){font-size:20px}";
|
|
2
2
|
//#endregion
|
|
3
3
|
export { STYLE };
|
package/dist/style.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const STYLE = ":host{--mbx-surface:#
|
|
1
|
+
const STYLE = ":host{--mbx-surface:#1c1c20;--mbx-text:#f3ede4;--mbx-muted:#aaa49a;--mbx-accent:#e0543c;--mbx-error:#ffb4ab;--mbx-live:#ff4d4d;--mbx-radius:.25em;--mbx-gap:.625em;--mbx-pad:.5em;--mbx-font:system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;background:#000;outline:none;font-size:16px;display:block;position:relative}:host([hidden]){display:none}[part~=stage]{flex-direction:column;justify-content:center;height:100%;display:flex;position:relative}::slotted(video){object-fit:contain;width:100%;min-height:0;max-height:100%;display:block}::slotted(source){display:none}@supports (aspect-ratio:1){::slotted(video){aspect-ratio:auto 16/9}}:host([casting]) ::slotted(mbx-control-bar),:host([casting]) ::slotted(mbx-start-button),:host([ended]) ::slotted(mbx-marker-button),:host([controls=none]) ::slotted(:not(video)){display:none}:host(:focus) [part~=stage]{outline:2px solid var(--mbx-accent);outline-offset:-2px}:host(:focus:not(:focus-visible)) [part~=stage]{outline:none}[part~=error]{padding:calc(var(--mbx-pad) - var(--mbx-gap) / 2);background:var(--mbx-surface);color:var(--mbx-error);font:400 .8125em / 1.4 var(--mbx-font);flex-wrap:wrap;align-items:center;display:flex}:host(:fullscreen) ::slotted(video){flex:1}:host(:fullscreen) [part~=error]{position:absolute;bottom:0;left:0;right:0}:host(:-webkit-full-screen) ::slotted(video){flex:1}:host(:-webkit-full-screen) [part~=error]{position:absolute;bottom:0;left:0;right:0}[part~=error]>*{margin:calc(var(--mbx-gap) / 2)}[part~=value]{color:var(--mbx-accent)}[part~=button]{font:inherit;color:inherit;border-radius:var(--mbx-radius);background:0 0;border:1px solid;padding:.125em .375em}[hidden]{display:none}:host([tooltips=off]){--mbx-tooltip:none}:host([layout=wide]){font-size:20px}";
|
|
2
2
|
//#endregion
|
|
3
3
|
export { STYLE };
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mattebox/player",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "A <mattebox-player> custom element over @mattebox/player-core.",
|
|
5
5
|
"author": "Josep Boix Requesens",
|
|
6
6
|
"repository": {
|
|
@@ -57,8 +57,7 @@
|
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"files": [
|
|
60
|
-
"dist"
|
|
61
|
-
"NOTICE"
|
|
60
|
+
"dist"
|
|
62
61
|
],
|
|
63
62
|
"scripts": {
|
|
64
63
|
"clean": "rm -rf dist",
|
|
@@ -70,9 +69,9 @@
|
|
|
70
69
|
"release:ci": "semantic-release"
|
|
71
70
|
},
|
|
72
71
|
"dependencies": {
|
|
73
|
-
"@mattebox/player-core": "^0.
|
|
72
|
+
"@mattebox/player-core": "^0.6.0"
|
|
74
73
|
},
|
|
75
74
|
"peerDependencies": {
|
|
76
|
-
"mattebox": "^0.
|
|
75
|
+
"mattebox": "^0.14.0"
|
|
77
76
|
}
|
|
78
77
|
}
|
package/NOTICE
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
@mattebox/player carries glyphs copied from media-icons
|
|
2
|
-
(https://github.com/vidstack/media-icons), used under the MIT License:
|
|
3
|
-
|
|
4
|
-
MIT License
|
|
5
|
-
|
|
6
|
-
Copyright (c) 2023 Rahim Alwer
|
|
7
|
-
|
|
8
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
-
in the Software without restriction, including without limitation the rights
|
|
11
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
-
furnished to do so, subject to the following conditions:
|
|
14
|
-
|
|
15
|
-
The above copyright notice and this permission notice shall be included in all
|
|
16
|
-
copies or substantial portions of the Software.
|
|
17
|
-
|
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
-
SOFTWARE.
|