@livepeer-frameworks/player-wc 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/fw-context-menu.js +17 -0
- package/dist/cjs/components/fw-context-menu.js.map +1 -0
- package/dist/cjs/components/fw-dev-mode-panel.js +273 -0
- package/dist/cjs/components/fw-dev-mode-panel.js.map +1 -0
- package/dist/cjs/components/fw-error-overlay.js +101 -0
- package/dist/cjs/components/fw-error-overlay.js.map +1 -0
- package/dist/cjs/components/fw-idle-screen.js +182 -0
- package/dist/cjs/components/fw-idle-screen.js.map +1 -0
- package/dist/cjs/components/fw-loading-spinner.js +62 -0
- package/dist/cjs/components/fw-loading-spinner.js.map +1 -0
- package/dist/cjs/components/fw-player-controls.js +258 -0
- package/dist/cjs/components/fw-player-controls.js.map +1 -0
- package/dist/cjs/components/fw-player.js +570 -0
- package/dist/cjs/components/fw-player.js.map +1 -0
- package/dist/cjs/components/fw-seek-bar.js +233 -0
- package/dist/cjs/components/fw-seek-bar.js.map +1 -0
- package/dist/cjs/components/fw-settings-menu.js +126 -0
- package/dist/cjs/components/fw-settings-menu.js.map +1 -0
- package/dist/cjs/components/fw-skip-indicator.js +143 -0
- package/dist/cjs/components/fw-skip-indicator.js.map +1 -0
- package/dist/cjs/components/fw-speed-indicator.js +61 -0
- package/dist/cjs/components/fw-speed-indicator.js.map +1 -0
- package/dist/cjs/components/fw-stats-panel.js +141 -0
- package/dist/cjs/components/fw-stats-panel.js.map +1 -0
- package/dist/cjs/components/fw-subtitle-renderer.js +70 -0
- package/dist/cjs/components/fw-subtitle-renderer.js.map +1 -0
- package/dist/cjs/components/fw-title-overlay.js +72 -0
- package/dist/cjs/components/fw-title-overlay.js.map +1 -0
- package/dist/cjs/components/fw-toast.js +74 -0
- package/dist/cjs/components/fw-toast.js.map +1 -0
- package/dist/cjs/components/fw-volume-control.js +140 -0
- package/dist/cjs/components/fw-volume-control.js.map +1 -0
- package/dist/cjs/controllers/player-controller-host.js +315 -0
- package/dist/cjs/controllers/player-controller-host.js.map +1 -0
- package/dist/cjs/define.js +45 -0
- package/dist/cjs/define.js.map +1 -0
- package/dist/cjs/icons/index.js +153 -0
- package/dist/cjs/icons/index.js.map +1 -0
- package/dist/cjs/index.js +88 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js +33 -0
- package/dist/cjs/node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/cjs/styles/shared-styles.js +1967 -0
- package/dist/cjs/styles/shared-styles.js.map +1 -0
- package/dist/cjs/styles/utility-styles.js +725 -0
- package/dist/cjs/styles/utility-styles.js.map +1 -0
- package/dist/esm/components/fw-context-menu.js +17 -0
- package/dist/esm/components/fw-context-menu.js.map +1 -0
- package/dist/esm/components/fw-dev-mode-panel.js +273 -0
- package/dist/esm/components/fw-dev-mode-panel.js.map +1 -0
- package/dist/esm/components/fw-error-overlay.js +101 -0
- package/dist/esm/components/fw-error-overlay.js.map +1 -0
- package/dist/esm/components/fw-idle-screen.js +182 -0
- package/dist/esm/components/fw-idle-screen.js.map +1 -0
- package/dist/esm/components/fw-loading-spinner.js +62 -0
- package/dist/esm/components/fw-loading-spinner.js.map +1 -0
- package/dist/esm/components/fw-player-controls.js +258 -0
- package/dist/esm/components/fw-player-controls.js.map +1 -0
- package/dist/esm/components/fw-player.js +570 -0
- package/dist/esm/components/fw-player.js.map +1 -0
- package/dist/esm/components/fw-seek-bar.js +233 -0
- package/dist/esm/components/fw-seek-bar.js.map +1 -0
- package/dist/esm/components/fw-settings-menu.js +126 -0
- package/dist/esm/components/fw-settings-menu.js.map +1 -0
- package/dist/esm/components/fw-skip-indicator.js +143 -0
- package/dist/esm/components/fw-skip-indicator.js.map +1 -0
- package/dist/esm/components/fw-speed-indicator.js +61 -0
- package/dist/esm/components/fw-speed-indicator.js.map +1 -0
- package/dist/esm/components/fw-stats-panel.js +141 -0
- package/dist/esm/components/fw-stats-panel.js.map +1 -0
- package/dist/esm/components/fw-subtitle-renderer.js +70 -0
- package/dist/esm/components/fw-subtitle-renderer.js.map +1 -0
- package/dist/esm/components/fw-title-overlay.js +72 -0
- package/dist/esm/components/fw-title-overlay.js.map +1 -0
- package/dist/esm/components/fw-toast.js +74 -0
- package/dist/esm/components/fw-toast.js.map +1 -0
- package/dist/esm/components/fw-volume-control.js +140 -0
- package/dist/esm/components/fw-volume-control.js.map +1 -0
- package/dist/esm/controllers/player-controller-host.js +313 -0
- package/dist/esm/controllers/player-controller-host.js.map +1 -0
- package/dist/esm/define.js +43 -0
- package/dist/esm/define.js.map +1 -0
- package/dist/esm/icons/index.js +141 -0
- package/dist/esm/icons/index.js.map +1 -0
- package/dist/esm/index.js +18 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js +31 -0
- package/dist/esm/node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/esm/styles/shared-styles.js +1965 -0
- package/dist/esm/styles/shared-styles.js.map +1 -0
- package/dist/esm/styles/utility-styles.js +723 -0
- package/dist/esm/styles/utility-styles.js.map +1 -0
- package/dist/fw-player.iife.js +4362 -0
- package/dist/fw-player.iife.js.map +1 -0
- package/dist/types/components/fw-context-menu.d.ts +15 -0
- package/dist/types/components/fw-dev-mode-panel.d.ts +24 -0
- package/dist/types/components/fw-error-overlay.d.ts +14 -0
- package/dist/types/components/fw-idle-screen.d.ts +13 -0
- package/dist/types/components/fw-loading-spinner.d.ts +10 -0
- package/dist/types/components/fw-player-controls.d.ts +23 -0
- package/dist/types/components/fw-player.d.ts +74 -0
- package/dist/types/components/fw-seek-bar.d.ts +33 -0
- package/dist/types/components/fw-settings-menu.d.ts +16 -0
- package/dist/types/components/fw-skip-indicator.d.ts +18 -0
- package/dist/types/components/fw-speed-indicator.d.ts +11 -0
- package/dist/types/components/fw-stats-panel.d.ts +18 -0
- package/dist/types/components/fw-subtitle-renderer.d.ts +21 -0
- package/dist/types/components/fw-title-overlay.d.ts +12 -0
- package/dist/types/components/fw-toast.d.ts +12 -0
- package/dist/types/components/fw-volume-control.d.ts +18 -0
- package/dist/types/controllers/player-controller-host.d.ts +119 -0
- package/dist/types/define.d.ts +1 -0
- package/dist/types/icons/index.d.ts +23 -0
- package/dist/types/iife-entry.d.ts +11 -0
- package/dist/types/index.d.ts +25 -0
- package/dist/types/styles/shared-styles.d.ts +1 -0
- package/dist/types/styles/utility-styles.d.ts +1 -0
- package/package.json +65 -0
- package/src/components/fw-context-menu.ts +23 -0
- package/src/components/fw-dev-mode-panel.ts +285 -0
- package/src/components/fw-error-overlay.ts +96 -0
- package/src/components/fw-idle-screen.ts +182 -0
- package/src/components/fw-loading-spinner.ts +63 -0
- package/src/components/fw-player-controls.ts +256 -0
- package/src/components/fw-player.ts +557 -0
- package/src/components/fw-seek-bar.ts +219 -0
- package/src/components/fw-settings-menu.ts +128 -0
- package/src/components/fw-skip-indicator.ts +139 -0
- package/src/components/fw-speed-indicator.ts +57 -0
- package/src/components/fw-stats-panel.ts +154 -0
- package/src/components/fw-subtitle-renderer.ts +65 -0
- package/src/components/fw-title-overlay.ts +64 -0
- package/src/components/fw-toast.ts +70 -0
- package/src/components/fw-volume-control.ts +140 -0
- package/src/controllers/player-controller-host.ts +457 -0
- package/src/define.ts +43 -0
- package/src/icons/index.ts +209 -0
- package/src/iife-entry.ts +11 -0
- package/src/index.ts +31 -0
- package/src/styles/shared-styles.ts +1962 -0
- package/src/styles/utility-styles.ts +720 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('../node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js');
|
|
4
|
+
var lit = require('lit');
|
|
5
|
+
var decorators_js = require('lit/decorators.js');
|
|
6
|
+
var classMap_js = require('lit/directives/class-map.js');
|
|
7
|
+
var styleMap_js = require('lit/directives/style-map.js');
|
|
8
|
+
var sharedStyles = require('../styles/shared-styles.js');
|
|
9
|
+
|
|
10
|
+
exports.FwSeekBar = class FwSeekBar extends lit.LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.currentTime = 0;
|
|
14
|
+
this.duration = 0;
|
|
15
|
+
this.disabled = false;
|
|
16
|
+
this.isLive = false;
|
|
17
|
+
this._hovering = false;
|
|
18
|
+
this._dragging = false;
|
|
19
|
+
this._hoverPct = 0;
|
|
20
|
+
this._dragPct = null;
|
|
21
|
+
this._handlePointerDown = (e) => {
|
|
22
|
+
if (this.disabled)
|
|
23
|
+
return;
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
this._dragging = true;
|
|
26
|
+
this._dragPct = this._pctFromEvent(e);
|
|
27
|
+
e.target.setPointerCapture?.(e.pointerId);
|
|
28
|
+
};
|
|
29
|
+
this._handlePointerMove = (e) => {
|
|
30
|
+
const pct = this._pctFromEvent(e);
|
|
31
|
+
if (this._dragging) {
|
|
32
|
+
this._dragPct = pct;
|
|
33
|
+
}
|
|
34
|
+
this._hoverPct = pct;
|
|
35
|
+
};
|
|
36
|
+
this._handlePointerUp = (e) => {
|
|
37
|
+
if (this._dragging && this._dragPct != null) {
|
|
38
|
+
const time = this._timeFromPct(this._dragPct);
|
|
39
|
+
this.dispatchEvent(new CustomEvent("fw-seek", { detail: { time }, bubbles: true, composed: true }));
|
|
40
|
+
}
|
|
41
|
+
this._dragging = false;
|
|
42
|
+
this._dragPct = null;
|
|
43
|
+
};
|
|
44
|
+
this._handleClick = (e) => {
|
|
45
|
+
if (this.disabled || this._dragging)
|
|
46
|
+
return;
|
|
47
|
+
const pct = this._pctFromEvent(e);
|
|
48
|
+
const time = this._timeFromPct(pct);
|
|
49
|
+
this.dispatchEvent(new CustomEvent("fw-seek", { detail: { time }, bubbles: true, composed: true }));
|
|
50
|
+
};
|
|
51
|
+
this._handleMouseEnter = () => {
|
|
52
|
+
this._hovering = true;
|
|
53
|
+
};
|
|
54
|
+
this._handleMouseLeave = () => {
|
|
55
|
+
this._hovering = false;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
_pctFromEvent(e) {
|
|
59
|
+
if (!this._trackEl)
|
|
60
|
+
return 0;
|
|
61
|
+
const rect = this._trackEl.getBoundingClientRect();
|
|
62
|
+
return Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));
|
|
63
|
+
}
|
|
64
|
+
_timeFromPct(pct) {
|
|
65
|
+
const d = this.isLive ? this.duration : this.duration;
|
|
66
|
+
return isFinite(d) && d > 0 ? pct * d : 0;
|
|
67
|
+
}
|
|
68
|
+
_formatTime(seconds) {
|
|
69
|
+
if (!isFinite(seconds))
|
|
70
|
+
return "0:00";
|
|
71
|
+
const abs = Math.abs(Math.floor(seconds));
|
|
72
|
+
const h = Math.floor(abs / 3600);
|
|
73
|
+
const m = Math.floor((abs % 3600) / 60);
|
|
74
|
+
const s = abs % 60;
|
|
75
|
+
const sign = seconds < 0 ? "-" : "";
|
|
76
|
+
if (h > 0)
|
|
77
|
+
return `${sign}${h}:${String(m).padStart(2, "0")}:${String(s).padStart(2, "0")}`;
|
|
78
|
+
return `${sign}${m}:${String(s).padStart(2, "0")}`;
|
|
79
|
+
}
|
|
80
|
+
get _progressPct() {
|
|
81
|
+
if (this._dragPct != null)
|
|
82
|
+
return this._dragPct * 100;
|
|
83
|
+
const d = this.duration;
|
|
84
|
+
if (!isFinite(d) || d <= 0)
|
|
85
|
+
return 0;
|
|
86
|
+
return Math.min(100, (this.currentTime / d) * 100);
|
|
87
|
+
}
|
|
88
|
+
render() {
|
|
89
|
+
const progressPct = this._progressPct;
|
|
90
|
+
const thumbPct = this._dragPct != null ? this._dragPct * 100 : progressPct;
|
|
91
|
+
const showTooltip = this._hovering || this._dragging;
|
|
92
|
+
const tooltipPct = this._dragging ? (this._dragPct ?? 0) * 100 : this._hoverPct * 100;
|
|
93
|
+
const tooltipTime = this._timeFromPct(tooltipPct / 100);
|
|
94
|
+
let tooltipText = this._formatTime(tooltipTime);
|
|
95
|
+
if (this.isLive && isFinite(this.duration) && this.duration > 0) {
|
|
96
|
+
const behindLive = tooltipTime - this.duration;
|
|
97
|
+
if (behindLive < -1)
|
|
98
|
+
tooltipText = this._formatTime(behindLive);
|
|
99
|
+
}
|
|
100
|
+
return lit.html `
|
|
101
|
+
<div
|
|
102
|
+
class=${classMap_js.classMap({ wrap: true, "wrap--disabled": this.disabled })}
|
|
103
|
+
@pointerdown=${this._handlePointerDown}
|
|
104
|
+
@pointermove=${this._handlePointerMove}
|
|
105
|
+
@pointerup=${this._handlePointerUp}
|
|
106
|
+
@click=${this._handleClick}
|
|
107
|
+
@mouseenter=${this._handleMouseEnter}
|
|
108
|
+
@mouseleave=${this._handleMouseLeave}
|
|
109
|
+
>
|
|
110
|
+
<div
|
|
111
|
+
class=${classMap_js.classMap({ track: true, "track--active": this._dragging, "fw-seek-track": true })}
|
|
112
|
+
>
|
|
113
|
+
<div
|
|
114
|
+
class="progress fw-seek-progress"
|
|
115
|
+
style=${styleMap_js.styleMap({ width: `${progressPct}%` })}
|
|
116
|
+
></div>
|
|
117
|
+
</div>
|
|
118
|
+
<div
|
|
119
|
+
class=${classMap_js.classMap({ thumb: true, "thumb--active": this._dragging, "fw-seek-thumb": true })}
|
|
120
|
+
style=${styleMap_js.styleMap({ left: `${thumbPct}%` })}
|
|
121
|
+
></div>
|
|
122
|
+
${showTooltip
|
|
123
|
+
? lit.html `
|
|
124
|
+
<div class="tooltip fw-seek-tooltip" style=${styleMap_js.styleMap({ left: `${tooltipPct}%` })}>
|
|
125
|
+
${tooltipText}
|
|
126
|
+
</div>
|
|
127
|
+
`
|
|
128
|
+
: lit.nothing}
|
|
129
|
+
</div>
|
|
130
|
+
`;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
exports.FwSeekBar.styles = [
|
|
134
|
+
sharedStyles.sharedStyles,
|
|
135
|
+
lit.css `
|
|
136
|
+
:host {
|
|
137
|
+
display: block;
|
|
138
|
+
width: 100%;
|
|
139
|
+
}
|
|
140
|
+
.wrap {
|
|
141
|
+
position: relative;
|
|
142
|
+
padding: 0.25rem 0;
|
|
143
|
+
cursor: pointer;
|
|
144
|
+
}
|
|
145
|
+
.wrap--disabled {
|
|
146
|
+
opacity: 0.4;
|
|
147
|
+
pointer-events: none;
|
|
148
|
+
}
|
|
149
|
+
.track {
|
|
150
|
+
position: relative;
|
|
151
|
+
height: 4px;
|
|
152
|
+
background: rgb(255 255 255 / 0.15);
|
|
153
|
+
border-radius: 2px;
|
|
154
|
+
overflow: hidden;
|
|
155
|
+
transition: height 150ms ease;
|
|
156
|
+
}
|
|
157
|
+
.wrap:hover .track,
|
|
158
|
+
.track--active {
|
|
159
|
+
height: 6px;
|
|
160
|
+
}
|
|
161
|
+
.progress {
|
|
162
|
+
position: absolute;
|
|
163
|
+
top: 0;
|
|
164
|
+
left: 0;
|
|
165
|
+
height: 100%;
|
|
166
|
+
background: hsl(var(--tn-blue, 217 89% 61%));
|
|
167
|
+
border-radius: 2px;
|
|
168
|
+
pointer-events: none;
|
|
169
|
+
}
|
|
170
|
+
.thumb {
|
|
171
|
+
position: absolute;
|
|
172
|
+
top: 50%;
|
|
173
|
+
width: 12px;
|
|
174
|
+
height: 12px;
|
|
175
|
+
border-radius: 50%;
|
|
176
|
+
background: white;
|
|
177
|
+
transform: translate(-50%, -50%) scale(0);
|
|
178
|
+
transition: transform 150ms ease;
|
|
179
|
+
z-index: 5;
|
|
180
|
+
pointer-events: none;
|
|
181
|
+
}
|
|
182
|
+
.wrap:hover .thumb,
|
|
183
|
+
.thumb--active {
|
|
184
|
+
transform: translate(-50%, -50%) scale(1);
|
|
185
|
+
}
|
|
186
|
+
.tooltip {
|
|
187
|
+
position: absolute;
|
|
188
|
+
bottom: 100%;
|
|
189
|
+
margin-bottom: 8px;
|
|
190
|
+
transform: translateX(-50%);
|
|
191
|
+
padding: 0.25rem 0.5rem;
|
|
192
|
+
border-radius: 4px;
|
|
193
|
+
background: rgb(0 0 0 / 0.85);
|
|
194
|
+
color: white;
|
|
195
|
+
font-size: 0.6875rem;
|
|
196
|
+
font-variant-numeric: tabular-nums;
|
|
197
|
+
white-space: nowrap;
|
|
198
|
+
pointer-events: none;
|
|
199
|
+
z-index: 10;
|
|
200
|
+
}
|
|
201
|
+
`,
|
|
202
|
+
];
|
|
203
|
+
tslib_es6.__decorate([
|
|
204
|
+
decorators_js.property({ type: Number })
|
|
205
|
+
], exports.FwSeekBar.prototype, "currentTime", void 0);
|
|
206
|
+
tslib_es6.__decorate([
|
|
207
|
+
decorators_js.property({ type: Number })
|
|
208
|
+
], exports.FwSeekBar.prototype, "duration", void 0);
|
|
209
|
+
tslib_es6.__decorate([
|
|
210
|
+
decorators_js.property({ type: Boolean })
|
|
211
|
+
], exports.FwSeekBar.prototype, "disabled", void 0);
|
|
212
|
+
tslib_es6.__decorate([
|
|
213
|
+
decorators_js.property({ type: Boolean, attribute: "is-live" })
|
|
214
|
+
], exports.FwSeekBar.prototype, "isLive", void 0);
|
|
215
|
+
tslib_es6.__decorate([
|
|
216
|
+
decorators_js.state()
|
|
217
|
+
], exports.FwSeekBar.prototype, "_hovering", void 0);
|
|
218
|
+
tslib_es6.__decorate([
|
|
219
|
+
decorators_js.state()
|
|
220
|
+
], exports.FwSeekBar.prototype, "_dragging", void 0);
|
|
221
|
+
tslib_es6.__decorate([
|
|
222
|
+
decorators_js.state()
|
|
223
|
+
], exports.FwSeekBar.prototype, "_hoverPct", void 0);
|
|
224
|
+
tslib_es6.__decorate([
|
|
225
|
+
decorators_js.state()
|
|
226
|
+
], exports.FwSeekBar.prototype, "_dragPct", void 0);
|
|
227
|
+
tslib_es6.__decorate([
|
|
228
|
+
decorators_js.query(".track")
|
|
229
|
+
], exports.FwSeekBar.prototype, "_trackEl", void 0);
|
|
230
|
+
exports.FwSeekBar = tslib_es6.__decorate([
|
|
231
|
+
decorators_js.customElement("fw-seek-bar")
|
|
232
|
+
], exports.FwSeekBar);
|
|
233
|
+
//# sourceMappingURL=fw-seek-bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fw-seek-bar.js","sources":["../../../../src/components/fw-seek-bar.ts"],"sourcesContent":["/**\n * <fw-seek-bar> — Video seek bar with buffer visualization, drag, tooltips.\n * Port of SeekBar.tsx from player-react.\n */\nimport { LitElement, html, css, nothing } from \"lit\";\nimport { customElement, property, state, query } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport { sharedStyles } from \"../styles/shared-styles.js\";\n\n@customElement(\"fw-seek-bar\")\nexport class FwSeekBar extends LitElement {\n @property({ type: Number }) currentTime = 0;\n @property({ type: Number }) duration = 0;\n @property({ type: Boolean }) disabled = false;\n @property({ type: Boolean, attribute: \"is-live\" }) isLive = false;\n\n @state() private _hovering = false;\n @state() private _dragging = false;\n @state() private _hoverPct = 0;\n @state() private _dragPct: number | null = null;\n\n @query(\".track\") private _trackEl!: HTMLDivElement;\n\n static styles = [\n sharedStyles,\n css`\n :host {\n display: block;\n width: 100%;\n }\n .wrap {\n position: relative;\n padding: 0.25rem 0;\n cursor: pointer;\n }\n .wrap--disabled {\n opacity: 0.4;\n pointer-events: none;\n }\n .track {\n position: relative;\n height: 4px;\n background: rgb(255 255 255 / 0.15);\n border-radius: 2px;\n overflow: hidden;\n transition: height 150ms ease;\n }\n .wrap:hover .track,\n .track--active {\n height: 6px;\n }\n .progress {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n background: hsl(var(--tn-blue, 217 89% 61%));\n border-radius: 2px;\n pointer-events: none;\n }\n .thumb {\n position: absolute;\n top: 50%;\n width: 12px;\n height: 12px;\n border-radius: 50%;\n background: white;\n transform: translate(-50%, -50%) scale(0);\n transition: transform 150ms ease;\n z-index: 5;\n pointer-events: none;\n }\n .wrap:hover .thumb,\n .thumb--active {\n transform: translate(-50%, -50%) scale(1);\n }\n .tooltip {\n position: absolute;\n bottom: 100%;\n margin-bottom: 8px;\n transform: translateX(-50%);\n padding: 0.25rem 0.5rem;\n border-radius: 4px;\n background: rgb(0 0 0 / 0.85);\n color: white;\n font-size: 0.6875rem;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n pointer-events: none;\n z-index: 10;\n }\n `,\n ];\n\n private _pctFromEvent(e: MouseEvent | PointerEvent): number {\n if (!this._trackEl) return 0;\n const rect = this._trackEl.getBoundingClientRect();\n return Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));\n }\n\n private _timeFromPct(pct: number): number {\n const d = this.isLive ? this.duration : this.duration;\n return isFinite(d) && d > 0 ? pct * d : 0;\n }\n\n private _formatTime(seconds: number): string {\n if (!isFinite(seconds)) return \"0:00\";\n const abs = Math.abs(Math.floor(seconds));\n const h = Math.floor(abs / 3600);\n const m = Math.floor((abs % 3600) / 60);\n const s = abs % 60;\n const sign = seconds < 0 ? \"-\" : \"\";\n if (h > 0) return `${sign}${h}:${String(m).padStart(2, \"0\")}:${String(s).padStart(2, \"0\")}`;\n return `${sign}${m}:${String(s).padStart(2, \"0\")}`;\n }\n\n private _handlePointerDown = (e: PointerEvent) => {\n if (this.disabled) return;\n e.preventDefault();\n this._dragging = true;\n this._dragPct = this._pctFromEvent(e);\n (e.target as HTMLElement).setPointerCapture?.(e.pointerId);\n };\n\n private _handlePointerMove = (e: PointerEvent) => {\n const pct = this._pctFromEvent(e);\n if (this._dragging) {\n this._dragPct = pct;\n }\n this._hoverPct = pct;\n };\n\n private _handlePointerUp = (e: PointerEvent) => {\n if (this._dragging && this._dragPct != null) {\n const time = this._timeFromPct(this._dragPct);\n this.dispatchEvent(\n new CustomEvent(\"fw-seek\", { detail: { time }, bubbles: true, composed: true })\n );\n }\n this._dragging = false;\n this._dragPct = null;\n };\n\n private _handleClick = (e: MouseEvent) => {\n if (this.disabled || this._dragging) return;\n const pct = this._pctFromEvent(e);\n const time = this._timeFromPct(pct);\n this.dispatchEvent(\n new CustomEvent(\"fw-seek\", { detail: { time }, bubbles: true, composed: true })\n );\n };\n\n private _handleMouseEnter = () => {\n this._hovering = true;\n };\n private _handleMouseLeave = () => {\n this._hovering = false;\n };\n\n private get _progressPct(): number {\n if (this._dragPct != null) return this._dragPct * 100;\n const d = this.duration;\n if (!isFinite(d) || d <= 0) return 0;\n return Math.min(100, (this.currentTime / d) * 100);\n }\n\n protected render() {\n const progressPct = this._progressPct;\n const thumbPct = this._dragPct != null ? this._dragPct * 100 : progressPct;\n const showTooltip = this._hovering || this._dragging;\n const tooltipPct = this._dragging ? (this._dragPct ?? 0) * 100 : this._hoverPct * 100;\n const tooltipTime = this._timeFromPct(tooltipPct / 100);\n\n let tooltipText = this._formatTime(tooltipTime);\n if (this.isLive && isFinite(this.duration) && this.duration > 0) {\n const behindLive = tooltipTime - this.duration;\n if (behindLive < -1) tooltipText = this._formatTime(behindLive);\n }\n\n return html`\n <div\n class=${classMap({ wrap: true, \"wrap--disabled\": this.disabled })}\n @pointerdown=${this._handlePointerDown}\n @pointermove=${this._handlePointerMove}\n @pointerup=${this._handlePointerUp}\n @click=${this._handleClick}\n @mouseenter=${this._handleMouseEnter}\n @mouseleave=${this._handleMouseLeave}\n >\n <div\n class=${classMap({ track: true, \"track--active\": this._dragging, \"fw-seek-track\": true })}\n >\n <div\n class=\"progress fw-seek-progress\"\n style=${styleMap({ width: `${progressPct}%` })}\n ></div>\n </div>\n <div\n class=${classMap({ thumb: true, \"thumb--active\": this._dragging, \"fw-seek-thumb\": true })}\n style=${styleMap({ left: `${thumbPct}%` })}\n ></div>\n ${showTooltip\n ? html`\n <div class=\"tooltip fw-seek-tooltip\" style=${styleMap({ left: `${tooltipPct}%` })}>\n ${tooltipText}\n </div>\n `\n : nothing}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"fw-seek-bar\": FwSeekBar;\n }\n}\n"],"names":["FwSeekBar","LitElement","html","classMap","styleMap","nothing","sharedStyles","css","__decorate","property","state","query","customElement"],"mappings":";;;;;;;;;AAWaA,iBAAS,GAAf,MAAM,SAAU,SAAQC,cAAU,CAAA;AAAlC,IAAA,WAAA,GAAA;;QACuB,IAAA,CAAA,WAAW,GAAG,CAAC;QACf,IAAA,CAAA,QAAQ,GAAG,CAAC;QACX,IAAA,CAAA,QAAQ,GAAG,KAAK;QACM,IAAA,CAAA,MAAM,GAAG,KAAK;QAEhD,IAAA,CAAA,SAAS,GAAG,KAAK;QACjB,IAAA,CAAA,SAAS,GAAG,KAAK;QACjB,IAAA,CAAA,SAAS,GAAG,CAAC;QACb,IAAA,CAAA,QAAQ,GAAkB,IAAI;AAiGvC,QAAA,IAAA,CAAA,kBAAkB,GAAG,CAAC,CAAe,KAAI;YAC/C,IAAI,IAAI,CAAC,QAAQ;gBAAE;YACnB,CAAC,CAAC,cAAc,EAAE;AAClB,YAAA,IAAI,CAAC,SAAS,GAAG,IAAI;YACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;YACpC,CAAC,CAAC,MAAsB,CAAC,iBAAiB,GAAG,CAAC,CAAC,SAAS,CAAC;AAC5D,QAAA,CAAC;AAEO,QAAA,IAAA,CAAA,kBAAkB,GAAG,CAAC,CAAe,KAAI;YAC/C,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;AACjC,YAAA,IAAI,IAAI,CAAC,SAAS,EAAE;AAClB,gBAAA,IAAI,CAAC,QAAQ,GAAG,GAAG;YACrB;AACA,YAAA,IAAI,CAAC,SAAS,GAAG,GAAG;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AAA;AAXxCA,iBAAS,GAAAQ,oBAAA,CAAA;IADrBI,2BAAa,CAAC,aAAa;AACf,CAAA,EAAAZ,iBAAS,CAyMrB;;"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('../node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js');
|
|
4
|
+
var lit = require('lit');
|
|
5
|
+
var decorators_js = require('lit/decorators.js');
|
|
6
|
+
var classMap_js = require('lit/directives/class-map.js');
|
|
7
|
+
var sharedStyles = require('../styles/shared-styles.js');
|
|
8
|
+
var utilityStyles = require('../styles/utility-styles.js');
|
|
9
|
+
|
|
10
|
+
exports.FwSettingsMenu = class FwSettingsMenu extends lit.LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.open = false;
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
if (!this.open)
|
|
17
|
+
return lit.nothing;
|
|
18
|
+
const { qualities } = this.pc.s;
|
|
19
|
+
const speeds = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 2];
|
|
20
|
+
return lit.html `
|
|
21
|
+
<div class="menu fw-settings-menu">
|
|
22
|
+
${qualities.length > 0
|
|
23
|
+
? lit.html `
|
|
24
|
+
<div class="section">
|
|
25
|
+
<div class="label">Quality</div>
|
|
26
|
+
${qualities.map((q) => lit.html `
|
|
27
|
+
<button
|
|
28
|
+
class=${classMap_js.classMap({ option: true, "option--active": !!q.active })}
|
|
29
|
+
@click=${() => this.pc.selectQuality(q.id)}
|
|
30
|
+
>
|
|
31
|
+
<div class=${classMap_js.classMap({ dot: true, "dot--hidden": !q.active })}></div>
|
|
32
|
+
${q.label}
|
|
33
|
+
</button>
|
|
34
|
+
`)}
|
|
35
|
+
</div>
|
|
36
|
+
`
|
|
37
|
+
: lit.nothing}
|
|
38
|
+
<div class="section">
|
|
39
|
+
<div class="label">Speed</div>
|
|
40
|
+
${speeds.map((s) => lit.html `
|
|
41
|
+
<button class="option" @click=${() => this.pc.getController()?.setPlaybackRate(s)}>
|
|
42
|
+
${s === 1 ? "Normal" : `${s}x`}
|
|
43
|
+
</button>
|
|
44
|
+
`)}
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
`;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.FwSettingsMenu.styles = [
|
|
51
|
+
sharedStyles.sharedStyles,
|
|
52
|
+
utilityStyles.utilityStyles,
|
|
53
|
+
lit.css `
|
|
54
|
+
:host {
|
|
55
|
+
display: contents;
|
|
56
|
+
}
|
|
57
|
+
.menu {
|
|
58
|
+
position: absolute;
|
|
59
|
+
bottom: 100%;
|
|
60
|
+
right: 0;
|
|
61
|
+
margin-bottom: 0.5rem;
|
|
62
|
+
min-width: 200px;
|
|
63
|
+
border-radius: 0.5rem;
|
|
64
|
+
border: 1px solid rgb(255 255 255 / 0.1);
|
|
65
|
+
background: rgb(0 0 0 / 0.9);
|
|
66
|
+
backdrop-filter: blur(8px);
|
|
67
|
+
padding: 0.5rem;
|
|
68
|
+
z-index: 50;
|
|
69
|
+
box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.3);
|
|
70
|
+
}
|
|
71
|
+
.section {
|
|
72
|
+
padding: 0.25rem 0;
|
|
73
|
+
}
|
|
74
|
+
.section + .section {
|
|
75
|
+
border-top: 1px solid rgb(255 255 255 / 0.1);
|
|
76
|
+
}
|
|
77
|
+
.label {
|
|
78
|
+
padding: 0.25rem 0.5rem;
|
|
79
|
+
font-size: 0.6875rem;
|
|
80
|
+
font-weight: 600;
|
|
81
|
+
text-transform: uppercase;
|
|
82
|
+
letter-spacing: 0.05em;
|
|
83
|
+
color: rgb(255 255 255 / 0.4);
|
|
84
|
+
}
|
|
85
|
+
.option {
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
width: 100%;
|
|
89
|
+
padding: 0.375rem 0.5rem;
|
|
90
|
+
border: none;
|
|
91
|
+
background: none;
|
|
92
|
+
color: rgb(255 255 255 / 0.7);
|
|
93
|
+
font-size: 0.8125rem;
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
border-radius: 0.25rem;
|
|
96
|
+
text-align: left;
|
|
97
|
+
}
|
|
98
|
+
.option:hover {
|
|
99
|
+
background: rgb(255 255 255 / 0.1);
|
|
100
|
+
color: white;
|
|
101
|
+
}
|
|
102
|
+
.option--active {
|
|
103
|
+
color: hsl(var(--tn-blue, 217 89% 61%));
|
|
104
|
+
}
|
|
105
|
+
.dot {
|
|
106
|
+
width: 6px;
|
|
107
|
+
height: 6px;
|
|
108
|
+
border-radius: 50%;
|
|
109
|
+
background: hsl(var(--tn-blue, 217 89% 61%));
|
|
110
|
+
margin-right: 0.5rem;
|
|
111
|
+
}
|
|
112
|
+
.dot--hidden {
|
|
113
|
+
visibility: hidden;
|
|
114
|
+
}
|
|
115
|
+
`,
|
|
116
|
+
];
|
|
117
|
+
tslib_es6.__decorate([
|
|
118
|
+
decorators_js.property({ attribute: false })
|
|
119
|
+
], exports.FwSettingsMenu.prototype, "pc", void 0);
|
|
120
|
+
tslib_es6.__decorate([
|
|
121
|
+
decorators_js.property({ type: Boolean })
|
|
122
|
+
], exports.FwSettingsMenu.prototype, "open", void 0);
|
|
123
|
+
exports.FwSettingsMenu = tslib_es6.__decorate([
|
|
124
|
+
decorators_js.customElement("fw-settings-menu")
|
|
125
|
+
], exports.FwSettingsMenu);
|
|
126
|
+
//# sourceMappingURL=fw-settings-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fw-settings-menu.js","sources":["../../../../src/components/fw-settings-menu.ts"],"sourcesContent":["/**\n * <fw-settings-menu> — Quality, speed, and captions settings popup.\n */\nimport { LitElement, html, css, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { sharedStyles } from \"../styles/shared-styles.js\";\nimport { utilityStyles } from \"../styles/utility-styles.js\";\nimport type { PlayerControllerHost } from \"../controllers/player-controller-host.js\";\n\n@customElement(\"fw-settings-menu\")\nexport class FwSettingsMenu extends LitElement {\n @property({ attribute: false }) pc!: PlayerControllerHost;\n @property({ type: Boolean }) open = false;\n\n static styles = [\n sharedStyles,\n utilityStyles,\n css`\n :host {\n display: contents;\n }\n .menu {\n position: absolute;\n bottom: 100%;\n right: 0;\n margin-bottom: 0.5rem;\n min-width: 200px;\n border-radius: 0.5rem;\n border: 1px solid rgb(255 255 255 / 0.1);\n background: rgb(0 0 0 / 0.9);\n backdrop-filter: blur(8px);\n padding: 0.5rem;\n z-index: 50;\n box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.3);\n }\n .section {\n padding: 0.25rem 0;\n }\n .section + .section {\n border-top: 1px solid rgb(255 255 255 / 0.1);\n }\n .label {\n padding: 0.25rem 0.5rem;\n font-size: 0.6875rem;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: rgb(255 255 255 / 0.4);\n }\n .option {\n display: flex;\n align-items: center;\n width: 100%;\n padding: 0.375rem 0.5rem;\n border: none;\n background: none;\n color: rgb(255 255 255 / 0.7);\n font-size: 0.8125rem;\n cursor: pointer;\n border-radius: 0.25rem;\n text-align: left;\n }\n .option:hover {\n background: rgb(255 255 255 / 0.1);\n color: white;\n }\n .option--active {\n color: hsl(var(--tn-blue, 217 89% 61%));\n }\n .dot {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: hsl(var(--tn-blue, 217 89% 61%));\n margin-right: 0.5rem;\n }\n .dot--hidden {\n visibility: hidden;\n }\n `,\n ];\n\n protected render() {\n if (!this.open) return nothing;\n const { qualities } = this.pc.s;\n const speeds = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 2];\n\n return html`\n <div class=\"menu fw-settings-menu\">\n ${qualities.length > 0\n ? html`\n <div class=\"section\">\n <div class=\"label\">Quality</div>\n ${qualities.map(\n (q) => html`\n <button\n class=${classMap({ option: true, \"option--active\": !!q.active })}\n @click=${() => this.pc.selectQuality(q.id)}\n >\n <div class=${classMap({ dot: true, \"dot--hidden\": !q.active })}></div>\n ${q.label}\n </button>\n `\n )}\n </div>\n `\n : nothing}\n <div class=\"section\">\n <div class=\"label\">Speed</div>\n ${speeds.map(\n (s) => html`\n <button class=\"option\" @click=${() => this.pc.getController()?.setPlaybackRate(s)}>\n ${s === 1 ? \"Normal\" : `${s}x`}\n </button>\n `\n )}\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"fw-settings-menu\": FwSettingsMenu;\n }\n}\n"],"names":["FwSettingsMenu","LitElement","nothing","html","classMap","sharedStyles","utilityStyles","css","__decorate","property","customElement"],"mappings":";;;;;;;;;AAWaA,sBAAc,GAApB,MAAM,cAAe,SAAQC,cAAU,CAAA;AAAvC,IAAA,WAAA,GAAA;;QAEwB,IAAA,CAAA,IAAI,GAAG,KAAK;IA4G3C;IAtCY,MAAM,GAAA;QACd,IAAI,CAAC,IAAI,CAAC,IAAI;AAAE,YAAA,OAAOC,WAAO;QAC9B,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;AAC/B,QAAA,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;AAEjD,QAAA,OAAOC,QAAI,CAAA;;UAEL,SAAS,CAAC,MAAM,GAAG;cACjBA,QAAI,CAAA;;;kBAGE,SAAS,CAAC,GAAG,CACb,CAAC,CAAC,KAAKA,QAAI,CAAA;;AAEC,4BAAA,EAAAC,oBAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;+BACvD,MAAM,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC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escript@5.9.3/node_modules/tslib/tslib.es6.js');
|
|
4
|
+
var lit = require('lit');
|
|
5
|
+
var decorators_js = require('lit/decorators.js');
|
|
6
|
+
var classMap_js = require('lit/directives/class-map.js');
|
|
7
|
+
|
|
8
|
+
exports.FwSkipIndicator = class FwSkipIndicator extends lit.LitElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.direction = null;
|
|
12
|
+
this.seconds = 10;
|
|
13
|
+
this._visible = false;
|
|
14
|
+
}
|
|
15
|
+
updated() {
|
|
16
|
+
if (this.direction && !this._visible) {
|
|
17
|
+
this._visible = true;
|
|
18
|
+
clearTimeout(this._timer);
|
|
19
|
+
this._timer = setTimeout(() => {
|
|
20
|
+
this._visible = false;
|
|
21
|
+
this.dispatchEvent(new CustomEvent("fw-hide", { bubbles: true, composed: true }));
|
|
22
|
+
}, 600);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
_renderRewind() {
|
|
26
|
+
return lit.html `<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
|
|
27
|
+
<path d="M11 18V6l-8.5 6 8.5 6zm.5-6l8.5 6V6l-8.5 6z" />
|
|
28
|
+
</svg>`;
|
|
29
|
+
}
|
|
30
|
+
_renderForward() {
|
|
31
|
+
return lit.html `<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
|
|
32
|
+
<path d="M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z" />
|
|
33
|
+
</svg>`;
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
if (!this._visible || !this.direction)
|
|
37
|
+
return lit.nothing;
|
|
38
|
+
const isBack = this.direction === "back";
|
|
39
|
+
return lit.html `
|
|
40
|
+
<div class="overlay">
|
|
41
|
+
<div
|
|
42
|
+
class=${classMap_js.classMap({ ripple: true, "ripple--back": isBack, "ripple--forward": !isBack })}
|
|
43
|
+
></div>
|
|
44
|
+
<div
|
|
45
|
+
class=${classMap_js.classMap({ content: true, "content--back": isBack, "content--forward": !isBack })}
|
|
46
|
+
>
|
|
47
|
+
<div class="icons">
|
|
48
|
+
${isBack
|
|
49
|
+
? lit.html `${this._renderRewind()}${this._renderRewind()}`
|
|
50
|
+
: lit.html `${this._renderForward()}${this._renderForward()}`}
|
|
51
|
+
</div>
|
|
52
|
+
<span class="time">${isBack ? `-${this.seconds}s` : `+${this.seconds}s`}</span>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
exports.FwSkipIndicator.styles = lit.css `
|
|
59
|
+
:host {
|
|
60
|
+
display: contents;
|
|
61
|
+
}
|
|
62
|
+
.overlay {
|
|
63
|
+
position: absolute;
|
|
64
|
+
inset: 0;
|
|
65
|
+
pointer-events: none;
|
|
66
|
+
z-index: 25;
|
|
67
|
+
}
|
|
68
|
+
.ripple {
|
|
69
|
+
position: absolute;
|
|
70
|
+
top: 0;
|
|
71
|
+
bottom: 0;
|
|
72
|
+
width: 33%;
|
|
73
|
+
background: rgb(255 255 255 / 0.1);
|
|
74
|
+
border-radius: 50%;
|
|
75
|
+
animation: _fw-ripple 600ms ease-out forwards;
|
|
76
|
+
}
|
|
77
|
+
.ripple--back {
|
|
78
|
+
left: 0;
|
|
79
|
+
border-radius: 0 50% 50% 0;
|
|
80
|
+
}
|
|
81
|
+
.ripple--forward {
|
|
82
|
+
right: 0;
|
|
83
|
+
border-radius: 50% 0 0 50%;
|
|
84
|
+
}
|
|
85
|
+
@keyframes _fw-ripple {
|
|
86
|
+
from {
|
|
87
|
+
opacity: 1;
|
|
88
|
+
}
|
|
89
|
+
to {
|
|
90
|
+
opacity: 0;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
.content {
|
|
94
|
+
position: absolute;
|
|
95
|
+
top: 50%;
|
|
96
|
+
transform: translateY(-50%);
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
align-items: center;
|
|
100
|
+
gap: 0.25rem;
|
|
101
|
+
color: white;
|
|
102
|
+
animation: _fw-skip-pop 400ms ease-out;
|
|
103
|
+
}
|
|
104
|
+
.content--back {
|
|
105
|
+
left: 12%;
|
|
106
|
+
}
|
|
107
|
+
.content--forward {
|
|
108
|
+
right: 12%;
|
|
109
|
+
}
|
|
110
|
+
@keyframes _fw-skip-pop {
|
|
111
|
+
from {
|
|
112
|
+
opacity: 0;
|
|
113
|
+
transform: translateY(-50%) scale(0.8);
|
|
114
|
+
}
|
|
115
|
+
to {
|
|
116
|
+
opacity: 1;
|
|
117
|
+
transform: translateY(-50%) scale(1);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
.icons {
|
|
121
|
+
display: flex;
|
|
122
|
+
}
|
|
123
|
+
.icons svg:nth-child(2) {
|
|
124
|
+
margin-left: -1rem;
|
|
125
|
+
}
|
|
126
|
+
.time {
|
|
127
|
+
font-size: 0.75rem;
|
|
128
|
+
font-weight: 600;
|
|
129
|
+
}
|
|
130
|
+
`;
|
|
131
|
+
tslib_es6.__decorate([
|
|
132
|
+
decorators_js.property({ attribute: false })
|
|
133
|
+
], exports.FwSkipIndicator.prototype, "direction", void 0);
|
|
134
|
+
tslib_es6.__decorate([
|
|
135
|
+
decorators_js.property({ type: Number })
|
|
136
|
+
], exports.FwSkipIndicator.prototype, "seconds", void 0);
|
|
137
|
+
tslib_es6.__decorate([
|
|
138
|
+
decorators_js.state()
|
|
139
|
+
], exports.FwSkipIndicator.prototype, "_visible", void 0);
|
|
140
|
+
exports.FwSkipIndicator = tslib_es6.__decorate([
|
|
141
|
+
decorators_js.customElement("fw-skip-indicator")
|
|
142
|
+
], exports.FwSkipIndicator);
|
|
143
|
+
//# sourceMappingURL=fw-skip-indicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fw-skip-indicator.js","sources":["../../../../src/components/fw-skip-indicator.ts"],"sourcesContent":["import { LitElement, html, css, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\n\nexport type SkipDirection = \"back\" | \"forward\" | null;\n\n@customElement(\"fw-skip-indicator\")\nexport class FwSkipIndicator extends LitElement {\n @property({ attribute: false }) direction: SkipDirection = null;\n @property({ type: Number }) seconds = 10;\n\n @state() private _visible = false;\n private _timer?: ReturnType<typeof setTimeout>;\n\n static styles = css`\n :host {\n display: contents;\n }\n .overlay {\n position: absolute;\n inset: 0;\n pointer-events: none;\n z-index: 25;\n }\n .ripple {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 33%;\n background: rgb(255 255 255 / 0.1);\n border-radius: 50%;\n animation: _fw-ripple 600ms ease-out forwards;\n }\n .ripple--back {\n left: 0;\n border-radius: 0 50% 50% 0;\n }\n .ripple--forward {\n right: 0;\n border-radius: 50% 0 0 50%;\n }\n @keyframes _fw-ripple {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n }\n .content {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 0.25rem;\n color: white;\n animation: _fw-skip-pop 400ms ease-out;\n }\n .content--back {\n left: 12%;\n }\n .content--forward {\n right: 12%;\n }\n @keyframes _fw-skip-pop {\n from {\n opacity: 0;\n transform: translateY(-50%) scale(0.8);\n }\n to {\n opacity: 1;\n transform: translateY(-50%) scale(1);\n }\n }\n .icons {\n display: flex;\n }\n .icons svg:nth-child(2) {\n margin-left: -1rem;\n }\n .time {\n font-size: 0.75rem;\n font-weight: 600;\n }\n `;\n\n protected updated() {\n if (this.direction && !this._visible) {\n this._visible = true;\n clearTimeout(this._timer);\n this._timer = setTimeout(() => {\n this._visible = false;\n this.dispatchEvent(new CustomEvent(\"fw-hide\", { bubbles: true, composed: true }));\n }, 600);\n }\n }\n\n private _renderRewind() {\n return html`<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M11 18V6l-8.5 6 8.5 6zm.5-6l8.5 6V6l-8.5 6z\" />\n </svg>`;\n }\n\n private _renderForward() {\n return html`<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z\" />\n </svg>`;\n }\n\n protected render() {\n if (!this._visible || !this.direction) return nothing;\n const isBack = this.direction === \"back\";\n return html`\n <div class=\"overlay\">\n <div\n class=${classMap({ ripple: true, \"ripple--back\": isBack, \"ripple--forward\": !isBack })}\n ></div>\n <div\n class=${classMap({ content: true, \"content--back\": isBack, \"content--forward\": !isBack })}\n >\n <div class=\"icons\">\n ${isBack\n ? html`${this._renderRewind()}${this._renderRewind()}`\n : html`${this._renderForward()}${this._renderForward()}`}\n </div>\n <span class=\"time\">${isBack ? `-${this.seconds}s` : `+${this.seconds}s`}</span>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"fw-skip-indicator\": FwSkipIndicator;\n }\n}\n"],"names":["FwSkipIndicator","LitElement","html","nothing","classMap","css","__decorate","property","state","customElement"],"mappings":";;;;;;;AAOaA,uBAAe,GAArB,MAAM,eAAgB,SAAQC,cAAU,CAAA;AAAxC,IAAA,WAAA,GAAA;;QAC2B,IAAA,CAAA,SAAS,GAAkB,IAAI;QACnC,IAAA,CAAA,OAAO,GAAG,EAAE;QAEvB,IAAA,CAAA,QAAQ,GAAG,KAAK;IAyHnC;IA5CY,OAAO,GAAA;QACf,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;AACpC,YAAA,IAAI,CAAC,QAAQ,GAAG,IAAI;AACpB,YAAA,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC;AACzB,YAAA,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAK;AAC5B,gBAAA,IAAI,CAAC,QAAQ,GAAG,KAAK;AACrB,gBAAA,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,SAAS,EAAE,EAAE,O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AAA,CAxEY;AANmBC,oBAAA,CAAA;AAA/B,IAAAC,sBAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE;AAAkC,CAAA,EAAAP,uBAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AACpCM,oBAAA,CAAA;AAA3B,IAAAC,sBAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;AAAe,CAAA,EAAAP,uBAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAExBM,oBAAA,CAAA;AAAhB,IAAAE,mBAAK;AAA4B,CAAA,EAAAR,uBAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAJvBA,uBAAe,GAAAM,oBAAA,CAAA;IAD3BG,2BAAa,CAAC,mBAAmB;AACrB,CAAA,EAAAT,uBAAe,CA6H3B;;"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('../node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.57.1_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js');
|
|
4
|
+
var lit = require('lit');
|
|
5
|
+
var decorators_js = require('lit/decorators.js');
|
|
6
|
+
|
|
7
|
+
exports.FwSpeedIndicator = class FwSpeedIndicator extends lit.LitElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.speed = 2;
|
|
11
|
+
}
|
|
12
|
+
render() {
|
|
13
|
+
return lit.html `
|
|
14
|
+
<div class="pill fw-speed-indicator">
|
|
15
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
16
|
+
<path d="M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z" />
|
|
17
|
+
</svg>
|
|
18
|
+
<span>${this.speed}x</span>
|
|
19
|
+
</div>
|
|
20
|
+
`;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.FwSpeedIndicator.styles = lit.css `
|
|
24
|
+
:host {
|
|
25
|
+
display: contents;
|
|
26
|
+
}
|
|
27
|
+
.pill {
|
|
28
|
+
position: absolute;
|
|
29
|
+
top: 0.75rem;
|
|
30
|
+
right: 0.75rem;
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
gap: 0.375rem;
|
|
34
|
+
padding: 0.25rem 0.625rem;
|
|
35
|
+
border-radius: 9999px;
|
|
36
|
+
background: rgb(0 0 0 / 0.6);
|
|
37
|
+
color: white;
|
|
38
|
+
font-size: 0.75rem;
|
|
39
|
+
font-variant-numeric: tabular-nums;
|
|
40
|
+
z-index: 30;
|
|
41
|
+
transform: scale(1);
|
|
42
|
+
animation: _fw-pop 150ms ease-out;
|
|
43
|
+
}
|
|
44
|
+
@keyframes _fw-pop {
|
|
45
|
+
from {
|
|
46
|
+
transform: scale(0.9);
|
|
47
|
+
opacity: 0;
|
|
48
|
+
}
|
|
49
|
+
to {
|
|
50
|
+
transform: scale(1);
|
|
51
|
+
opacity: 1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
tslib_es6.__decorate([
|
|
56
|
+
decorators_js.property({ type: Number })
|
|
57
|
+
], exports.FwSpeedIndicator.prototype, "speed", void 0);
|
|
58
|
+
exports.FwSpeedIndicator = tslib_es6.__decorate([
|
|
59
|
+
decorators_js.customElement("fw-speed-indicator")
|
|
60
|
+
], exports.FwSpeedIndicator);
|
|
61
|
+
//# sourceMappingURL=fw-speed-indicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fw-speed-indicator.js","sources":["../../../../src/components/fw-speed-indicator.ts"],"sourcesContent":["import { LitElement, html, css } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\n\n@customElement(\"fw-speed-indicator\")\nexport class FwSpeedIndicator extends LitElement {\n @property({ type: Number }) speed = 2;\n\n static styles = css`\n :host {\n display: contents;\n }\n .pill {\n position: absolute;\n top: 0.75rem;\n right: 0.75rem;\n display: inline-flex;\n align-items: center;\n gap: 0.375rem;\n padding: 0.25rem 0.625rem;\n border-radius: 9999px;\n background: rgb(0 0 0 / 0.6);\n color: white;\n font-size: 0.75rem;\n font-variant-numeric: tabular-nums;\n z-index: 30;\n transform: scale(1);\n animation: _fw-pop 150ms ease-out;\n }\n @keyframes _fw-pop {\n from {\n transform: scale(0.9);\n opacity: 0;\n }\n to {\n transform: scale(1);\n opacity: 1;\n }\n }\n `;\n\n protected render() {\n return html`\n <div class=\"pill fw-speed-indicator\">\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n <path d=\"M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z\" />\n </svg>\n <span>${this.speed}x</span>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"fw-speed-indicator\": FwSpeedIndicator;\n }\n}\n"],"names":["FwSpeedIndicator","LitElement","html","css","__decorate","property","customElement"],"mappings":";;;;;;AAIaA,wBAAgB,GAAtB,MAAM,gBAAiB,SAAQC,cAAU,CAAA;AAAzC,IAAA,WAAA,GAAA;;QACuB,IAAA,CAAA,KAAK,GAAG,CAAC;IA6CvC;IAVY,MAAM,GAAA;AACd,QAAA,OAAOC,QAAI,CAAA;;;;;AAKC,cAAA,EAAA,IAAI,CAAC,KAAK,CAAA;;KAErB;IACH;;AA1COF,wBAAA,CAAA,MAAM,GAAGG,OAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BlB,EAAA,CA/BY;AAFeC,oBAAA,CAAA;AAA3B,IAAAC,sBAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;AAAY,CAAA,EAAAL,wBAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAD3BA,wBAAgB,GAAAI,oBAAA,CAAA;IAD5BE,2BAAa,CAAC,oBAAoB;AACtB,CAAA,EAAAN,wBAAgB,CA8C5B;;"}
|