@xsynaptic/plazmoid-player 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/LICENSE +21 -0
- package/README.md +57 -2
- package/dist/astro.d.ts +4 -0
- package/dist/astro.js +33 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +7 -0
- package/dist/define/artist-line.d.ts +1 -0
- package/dist/define/artist-line.js +6 -0
- package/dist/define/artwork.d.ts +1 -0
- package/dist/define/artwork.js +5 -0
- package/dist/define/bar.d.ts +1 -0
- package/dist/define/bar.js +5 -0
- package/dist/define/cue-list.d.ts +1 -0
- package/dist/define/cue-list.js +5 -0
- package/dist/define/mute-button.d.ts +1 -0
- package/dist/define/mute-button.js +6 -0
- package/dist/define/overlay-content.d.ts +1 -0
- package/dist/define/overlay-content.js +6 -0
- package/dist/define/overlay-toggle.d.ts +1 -0
- package/dist/define/overlay-toggle.js +6 -0
- package/dist/define/overlay.d.ts +1 -0
- package/dist/define/overlay.js +5 -0
- package/dist/define/panel-toggle.d.ts +1 -0
- package/dist/define/panel-toggle.js +6 -0
- package/dist/define/panel-zoom.d.ts +1 -0
- package/dist/define/panel-zoom.js +6 -0
- package/dist/define/panel.d.ts +1 -0
- package/dist/define/panel.js +5 -0
- package/dist/define/play-button.d.ts +1 -0
- package/dist/define/play-button.js +6 -0
- package/dist/define/progress.d.ts +1 -0
- package/dist/define/progress.js +6 -0
- package/dist/define/queue-actions.d.ts +1 -0
- package/dist/define/queue-actions.js +6 -0
- package/dist/define/queue-button.d.ts +1 -0
- package/dist/define/queue-button.js +6 -0
- package/dist/define/root.d.ts +1 -0
- package/dist/define/root.js +5 -0
- package/dist/define/scope.d.ts +1 -0
- package/dist/define/scope.js +5 -0
- package/dist/define/scrub-readout.d.ts +1 -0
- package/dist/define/scrub-readout.js +5 -0
- package/dist/define/seek-button.d.ts +1 -0
- package/dist/define/seek-button.js +6 -0
- package/dist/define/status.d.ts +1 -0
- package/dist/define/status.js +5 -0
- package/dist/define/step-button.d.ts +1 -0
- package/dist/define/step-button.js +6 -0
- package/dist/define/time-slider.d.ts +1 -0
- package/dist/define/time-slider.js +6 -0
- package/dist/define/time.d.ts +1 -0
- package/dist/define/time.js +5 -0
- package/dist/define/title.d.ts +1 -0
- package/dist/define/title.js +6 -0
- package/dist/define/tray.d.ts +1 -0
- package/dist/define/tray.js +6 -0
- package/dist/define/volume.d.ts +1 -0
- package/dist/define/volume.js +6 -0
- package/dist/define.d.ts +1 -0
- package/dist/define.js +4 -0
- package/dist/elements/artist-line.js +30 -0
- package/dist/elements/artwork.js +40 -0
- package/dist/elements/bind-buffered.js +20 -0
- package/dist/elements/bind-player.js +22 -0
- package/dist/elements/bind-scrub-preview.js +13 -0
- package/dist/elements/button-part.js +32 -0
- package/dist/elements/create-player.d.ts +16 -0
- package/dist/elements/create-player.js +22 -0
- package/dist/elements/define-once.js +6 -0
- package/dist/elements/define.js +60 -0
- package/dist/elements/mute-button.js +25 -0
- package/dist/elements/overlay/overlay-body.js +172 -0
- package/dist/elements/overlay/overlay-content.js +23 -0
- package/dist/elements/overlay/overlay-grab.js +69 -0
- package/dist/elements/overlay/overlay-module.js +12 -0
- package/dist/elements/overlay/overlay-sheets.js +38 -0
- package/dist/elements/overlay/overlay-tabs.js +95 -0
- package/dist/elements/overlay/overlay.js +54 -0
- package/dist/elements/overlay/tracklist.js +76 -0
- package/dist/elements/overlay-toggle.js +39 -0
- package/dist/elements/panel/panel-module.js +9 -0
- package/dist/elements/panel/panel-surface.js +92 -0
- package/dist/elements/panel/panel-zoom.js +55 -0
- package/dist/elements/panel/panel.js +45 -0
- package/dist/elements/panel-toggle.js +43 -0
- package/dist/elements/place-seek-buttons.js +11 -0
- package/dist/elements/play-button.js +32 -0
- package/dist/elements/player-bar.js +54 -0
- package/dist/elements/player-context.js +19 -0
- package/dist/elements/player-element.d.ts +9 -0
- package/dist/elements/player-element.js +36 -0
- package/dist/elements/player-root.d.ts +27 -0
- package/dist/elements/player-root.js +96 -0
- package/dist/elements/progress.js +50 -0
- package/dist/elements/queue-button.js +92 -0
- package/dist/elements/scope/scope-module.js +9 -0
- package/dist/elements/scope/scope-surface.js +26 -0
- package/dist/elements/scope/scope.js +61 -0
- package/dist/elements/scrub-readout.js +63 -0
- package/dist/elements/seek-button.js +42 -0
- package/dist/elements/status.js +37 -0
- package/dist/elements/step-button.js +36 -0
- package/dist/elements/time-slider/label-placement.js +11 -0
- package/dist/elements/time-slider/spoken-time.js +39 -0
- package/dist/elements/time-slider/time-slider.js +139 -0
- package/dist/elements/time.js +47 -0
- package/dist/elements/title.js +46 -0
- package/dist/elements/tray/drop-index.js +8 -0
- package/dist/elements/tray/queue-actions.js +58 -0
- package/dist/elements/tray/row-drag.js +123 -0
- package/dist/elements/tray/tray-module.js +11 -0
- package/dist/elements/tray/tray-rows.js +85 -0
- package/dist/elements/tray/tray.js +102 -0
- package/dist/elements/volume-level.js +23 -0
- package/dist/elements/volume.js +41 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +5 -0
- package/dist/labels.d.ts +36 -0
- package/dist/labels.js +39 -0
- package/dist/lib/bind-button.js +12 -0
- package/dist/lib/bind-preload.js +11 -0
- package/dist/lib/can-set-volume.js +15 -0
- package/dist/lib/dialog-exit.js +50 -0
- package/dist/lib/dismiss.js +15 -0
- package/dist/lib/format.js +12 -0
- package/dist/lib/icons.js +106 -0
- package/dist/lib/keyed-children.js +34 -0
- package/dist/lib/lazy-module.d.ts +5 -0
- package/dist/lib/lazy-module.js +41 -0
- package/dist/lib/observe-resize.js +10 -0
- package/dist/lib/preload-when-queued.js +29 -0
- package/dist/lib/read-px-property.js +7 -0
- package/dist/lib/render.js +22 -0
- package/dist/lib/sonic-button.js +22 -0
- package/dist/lib/supersede.js +19 -0
- package/dist/player.css +33 -0
- package/dist/styles/bar.css +253 -0
- package/dist/styles/coarse.css +47 -0
- package/dist/styles/controls.css +220 -0
- package/dist/styles/cue.css +53 -0
- package/dist/styles/focus.css +12 -0
- package/dist/styles/host.css +34 -0
- package/dist/styles/overlay-layout.css +258 -0
- package/dist/styles/overlay.css +282 -0
- package/dist/styles/panel.css +94 -0
- package/dist/styles/primitives.css +176 -0
- package/dist/styles/reset.css +21 -0
- package/dist/styles/status.css +42 -0
- package/dist/styles/tokens.css +142 -0
- package/dist/styles/track.css +150 -0
- package/dist/styles/tray.css +151 -0
- package/dist/types.d.ts +37 -0
- package/dist/view/view-persistence.js +33 -0
- package/dist/view/view-store.d.ts +30 -0
- package/dist/view/view-store.js +64 -0
- package/dist/view/zoom-levels.js +21 -0
- package/dist/waveform/bind-loaded-waveform.js +36 -0
- package/dist/waveform/cue-markers.js +31 -0
- package/dist/waveform/known-peaks.js +9 -0
- package/dist/waveform/overview-values.js +13 -0
- package/dist/waveform/retry-delay.js +8 -0
- package/dist/waveform/tint-cell.js +15 -0
- package/dist/waveform/waveform-peaks.js +144 -0
- package/package.json +80 -3
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { template } from "./render.js";
|
|
2
|
+
|
|
3
|
+
// src/lib/icons.ts
|
|
4
|
+
const glyphSize = 512;
|
|
5
|
+
const seekCount = "<text dominant-baseline=\"central\" fill=\"currentColor\" font-size=\"7\" font-weight=\"700\" stroke=\"none\" text-anchor=\"middle\" x=\"12\" y=\"12.5\"></text>";
|
|
6
|
+
const cross = "<path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/>";
|
|
7
|
+
const speaker = "<path d=\"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z\"/>";
|
|
8
|
+
const icons = {
|
|
9
|
+
alert: lucide({
|
|
10
|
+
name: "circle-alert",
|
|
11
|
+
size: 18
|
|
12
|
+
}, "<circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"12\" x2=\"12\" y1=\"8\" y2=\"12\"/><line x1=\"12\" x2=\"12.01\" y1=\"16\" y2=\"16\"/>"),
|
|
13
|
+
close: lucide({
|
|
14
|
+
name: "x",
|
|
15
|
+
size: 18
|
|
16
|
+
}, cross),
|
|
17
|
+
closeLarge: lucide({
|
|
18
|
+
name: "x",
|
|
19
|
+
size: 20
|
|
20
|
+
}, cross),
|
|
21
|
+
dragHandle: lucide({
|
|
22
|
+
name: "grip-vertical",
|
|
23
|
+
size: 18
|
|
24
|
+
}, "<circle cx=\"9\" cy=\"12\" r=\"1\"/><circle cx=\"9\" cy=\"5\" r=\"1\"/><circle cx=\"9\" cy=\"19\" r=\"1\"/><circle cx=\"15\" cy=\"12\" r=\"1\"/><circle cx=\"15\" cy=\"5\" r=\"1\"/><circle cx=\"15\" cy=\"19\" r=\"1\"/>"),
|
|
25
|
+
expand: lucide({
|
|
26
|
+
name: "fullscreen",
|
|
27
|
+
size: 20,
|
|
28
|
+
strokeWidth: 2.5
|
|
29
|
+
}, "<path d=\"M3 7V5a2 2 0 0 1 2-2h2\"/><path d=\"M17 3h2a2 2 0 0 1 2 2v2\"/><path d=\"M21 17v2a2 2 0 0 1-2 2h-2\"/><path d=\"M7 21H5a2 2 0 0 1-2-2v-2\"/><rect width=\"10\" height=\"8\" x=\"7\" y=\"8\" rx=\"1\"/>"),
|
|
30
|
+
next: lucide({
|
|
31
|
+
isSolid: true,
|
|
32
|
+
name: "skip-forward",
|
|
33
|
+
size: 20
|
|
34
|
+
}, "<path d=\"M21 4v16\"/><path d=\"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z\"/>"),
|
|
35
|
+
pause: lucide({
|
|
36
|
+
isSolid: true,
|
|
37
|
+
name: "pause",
|
|
38
|
+
size: 20
|
|
39
|
+
}, "<rect x=\"14\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\"/><rect x=\"5\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\"/>"),
|
|
40
|
+
play: lucide({
|
|
41
|
+
isSolid: true,
|
|
42
|
+
name: "play",
|
|
43
|
+
size: 20
|
|
44
|
+
}, "<path d=\"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z\"/>"),
|
|
45
|
+
playing: "<svg aria-hidden=\"true\" fill=\"currentColor\" height=\"10\" viewBox=\"0 0 8 10\" width=\"8\"><rect height=\"5\" rx=\"0.5\" width=\"2\" x=\"0\" y=\"5\"/><rect height=\"10\" rx=\"0.5\" width=\"2\" x=\"3\" y=\"0\"/><rect height=\"7\" rx=\"0.5\" width=\"2\" x=\"6\" y=\"3\"/></svg>",
|
|
46
|
+
previous: lucide({
|
|
47
|
+
isSolid: true,
|
|
48
|
+
name: "skip-back",
|
|
49
|
+
size: 20
|
|
50
|
+
}, "<path d=\"M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z\"/><path d=\"M3 20V4\"/>"),
|
|
51
|
+
queue: glyph(18, "<path d=\"M40 48C26.7 48 16 58.7 16 72l0 48c0 13.3 10.7 24 24 24l48 0c13.3 0 24-10.7 24-24l0-48c0-13.3-10.7-24-24-24L40 48zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zM16 232l0 48c0 13.3 10.7 24 24 24l48 0c13.3 0 24-10.7 24-24l0-48c0-13.3-10.7-24-24-24l-48 0c-13.3 0-24 10.7-24 24zM40 368c-13.3 0-24 10.7-24 24l0 48c0 13.3 10.7 24 24 24l48 0c13.3 0 24-10.7 24-24l0-48c0-13.3-10.7-24-24-24l-48 0z\"/>"),
|
|
52
|
+
seekBack: lucide({
|
|
53
|
+
name: "rotate-ccw",
|
|
54
|
+
size: 25
|
|
55
|
+
}, `<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/>${seekCount}`),
|
|
56
|
+
seekForward: lucide({
|
|
57
|
+
name: "rotate-cw",
|
|
58
|
+
size: 25
|
|
59
|
+
}, `<path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/>${seekCount}`),
|
|
60
|
+
tracklist: glyph(16, "<path d=\"M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z\"/>"),
|
|
61
|
+
volume: lucide({
|
|
62
|
+
name: "volume-2",
|
|
63
|
+
size: 20
|
|
64
|
+
}, `${speaker}<path d="M16 9a5 5 0 0 1 0 6"/><path d="M19.364 18.364a9 9 0 0 0 0-12.728"/>`),
|
|
65
|
+
volumeLow: lucide({
|
|
66
|
+
name: "volume",
|
|
67
|
+
size: 20
|
|
68
|
+
}, speaker),
|
|
69
|
+
volumeMedium: lucide({
|
|
70
|
+
name: "volume-1",
|
|
71
|
+
size: 20
|
|
72
|
+
}, `${speaker}<path d="M16 9a5 5 0 0 1 0 6"/>`),
|
|
73
|
+
volumeMuted: lucide({
|
|
74
|
+
name: "volume-x",
|
|
75
|
+
size: 20
|
|
76
|
+
}, "<path d=\"M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z\"/><path d=\"m16.5 14.5 5-5\"/><path d=\"m16.5 9.5 5 5\"/>"),
|
|
77
|
+
waveform: lucide({
|
|
78
|
+
name: "audio-waveform",
|
|
79
|
+
size: 20
|
|
80
|
+
}, "<path d=\"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2\"/>"),
|
|
81
|
+
zoomIn: lucide({
|
|
82
|
+
name: "plus",
|
|
83
|
+
size: 14
|
|
84
|
+
}, "<path d=\"M5 12h14\"/><path d=\"M12 5v14\"/>"),
|
|
85
|
+
zoomOut: lucide({
|
|
86
|
+
name: "minus",
|
|
87
|
+
size: 14
|
|
88
|
+
}, "<path d=\"M5 12h14\"/>")
|
|
89
|
+
};
|
|
90
|
+
const renderers = /* @__PURE__ */ new Map();
|
|
91
|
+
function cloneIcon(name) {
|
|
92
|
+
let render = renderers.get(name);
|
|
93
|
+
if (!render) {
|
|
94
|
+
render = template(icons[name], SVGSVGElement);
|
|
95
|
+
renderers.set(name, render);
|
|
96
|
+
}
|
|
97
|
+
return render();
|
|
98
|
+
}
|
|
99
|
+
function glyph(size, children) {
|
|
100
|
+
return `<svg aria-hidden="true" fill="currentColor" height="${String(size)}" viewBox="0 0 ${String(glyphSize)} ${String(glyphSize)}" width="${String(size)}">${children}</svg>`;
|
|
101
|
+
}
|
|
102
|
+
function lucide({ isSolid, name, size, strokeWidth = 2 }, children) {
|
|
103
|
+
return `<svg aria-hidden="true" data-lucide="${name}" fill="${isSolid === true ? "currentColor" : "none"}" height="${String(size)}" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="${String(strokeWidth)}" viewBox="0 0 24 24" width="${String(size)}">${children}</svg>`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { cloneIcon };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/lib/keyed-children.ts
|
|
2
|
+
function keyedChildren(parent, children) {
|
|
3
|
+
let current = /* @__PURE__ */ new Map();
|
|
4
|
+
return (items) => {
|
|
5
|
+
const next = /* @__PURE__ */ new Map();
|
|
6
|
+
for (const item of items) {
|
|
7
|
+
const key = children.key(item);
|
|
8
|
+
const child = current.get(key) ?? children.create(item);
|
|
9
|
+
children.update(child, item);
|
|
10
|
+
next.set(key, child);
|
|
11
|
+
}
|
|
12
|
+
for (const [key, child] of current) if (!next.has(key)) child.node.remove();
|
|
13
|
+
current = next;
|
|
14
|
+
placeInOrder(parent, [...next.values()].map((child) => child.node));
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function canMoveBefore(parent) {
|
|
18
|
+
return "moveBefore" in parent && parent.isConnected;
|
|
19
|
+
}
|
|
20
|
+
function place(parent, node, reference) {
|
|
21
|
+
if (node.isConnected && canMoveBefore(parent)) parent.moveBefore(node, reference);
|
|
22
|
+
else if (reference) reference.before(node);
|
|
23
|
+
else parent.append(node);
|
|
24
|
+
}
|
|
25
|
+
function placeInOrder(parent, nodes) {
|
|
26
|
+
const focused = document.activeElement;
|
|
27
|
+
let reference = parent.firstElementChild;
|
|
28
|
+
for (const node of nodes) if (node === reference) reference = node.nextElementSibling;
|
|
29
|
+
else place(parent, node, reference);
|
|
30
|
+
if (!(focused instanceof HTMLElement) || focused === document.activeElement) return;
|
|
31
|
+
if (parent.contains(focused)) focused.focus();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { keyedChildren };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/lib/lazy-module.ts
|
|
2
|
+
var LazyModuleError = class extends Error {
|
|
3
|
+
chunk;
|
|
4
|
+
reason;
|
|
5
|
+
constructor(chunk, reason, options) {
|
|
6
|
+
super(`The ${chunk} chunk failed to open (${reason})`, options);
|
|
7
|
+
this.chunk = chunk;
|
|
8
|
+
this.name = "LazyModuleError";
|
|
9
|
+
this.reason = reason;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
function lazyModule(chunk, importModule) {
|
|
13
|
+
let pending;
|
|
14
|
+
async function request() {
|
|
15
|
+
try {
|
|
16
|
+
return await importModule();
|
|
17
|
+
} catch (error) {
|
|
18
|
+
pending = void 0;
|
|
19
|
+
throw new LazyModuleError(chunk, "import", { cause: error });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function load() {
|
|
23
|
+
if (pending !== void 0) return pending;
|
|
24
|
+
if (!navigator.onLine) return Promise.reject(new LazyModuleError(chunk, "offline"));
|
|
25
|
+
pending = request();
|
|
26
|
+
return pending;
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
load,
|
|
30
|
+
preload: () => {
|
|
31
|
+
settle(load());
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
async function settle(pending) {
|
|
36
|
+
try {
|
|
37
|
+
await pending;
|
|
38
|
+
} catch {}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { LazyModuleError, lazyModule };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/lib/observe-resize.ts
|
|
2
|
+
function observeResize(element, onResize, signal) {
|
|
3
|
+
const observer = new ResizeObserver(onResize);
|
|
4
|
+
observer.observe(element);
|
|
5
|
+
signal.addEventListener("abort", () => {
|
|
6
|
+
observer.disconnect();
|
|
7
|
+
}, { once: true });
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { observeResize };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/lib/preload-when-queued.ts
|
|
2
|
+
function preloadWhenQueued(store, preload) {
|
|
3
|
+
let cancelIdle;
|
|
4
|
+
const schedule = (state) => {
|
|
5
|
+
if (cancelIdle !== void 0 || state.queue.length === 0) return;
|
|
6
|
+
unsubscribe();
|
|
7
|
+
cancelIdle = requestIdle(preload);
|
|
8
|
+
};
|
|
9
|
+
const unsubscribe = store.subscribe(schedule);
|
|
10
|
+
schedule(store.getState());
|
|
11
|
+
return () => {
|
|
12
|
+
unsubscribe();
|
|
13
|
+
cancelIdle?.();
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function requestIdle(callback) {
|
|
17
|
+
if (typeof requestIdleCallback === "function") {
|
|
18
|
+
const handle = requestIdleCallback(callback);
|
|
19
|
+
return () => {
|
|
20
|
+
cancelIdleCallback(handle);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const handle = setTimeout(callback, 200);
|
|
24
|
+
return () => {
|
|
25
|
+
clearTimeout(handle);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { preloadWhenQueued };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/lib/render.ts
|
|
2
|
+
function requireChild(root, selector, child) {
|
|
3
|
+
const found = root.querySelector(selector);
|
|
4
|
+
if (!(found instanceof child)) throw new TypeError(`A template is missing its ${selector}`);
|
|
5
|
+
return found;
|
|
6
|
+
}
|
|
7
|
+
function requireChildren(root, selector, count, child) {
|
|
8
|
+
const found = [...root.querySelectorAll(selector)];
|
|
9
|
+
if (found.length !== count || found.some((element) => !(element instanceof child))) throw new Error(`A template is missing one of its ${String(count)} ${selector}`);
|
|
10
|
+
return found;
|
|
11
|
+
}
|
|
12
|
+
function template(html, root) {
|
|
13
|
+
const parsed = document.createElement("template");
|
|
14
|
+
parsed.innerHTML = html;
|
|
15
|
+
return () => {
|
|
16
|
+
const clone = document.importNode(parsed.content, true).firstElementChild;
|
|
17
|
+
if (!(clone instanceof root)) throw new TypeError(`A template's root is not a ${root.name}`);
|
|
18
|
+
return clone;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { requireChild, requireChildren, template };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cloneIcon } from "./icons.js";
|
|
2
|
+
|
|
3
|
+
// src/lib/sonic-button.ts
|
|
4
|
+
function fillButton(button, icons) {
|
|
5
|
+
button.style.setProperty("--pzm-icon-px", icons[0]?.getAttribute("height") ?? "");
|
|
6
|
+
button.append(...icons);
|
|
7
|
+
}
|
|
8
|
+
function legendIcons(names) {
|
|
9
|
+
return names.map((name) => {
|
|
10
|
+
const icon = cloneIcon(name);
|
|
11
|
+
icon.dataset.sonicWhen = name;
|
|
12
|
+
return icon;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function renderSonicButton({ className, icons }) {
|
|
16
|
+
const button = document.createElement("sonic-button");
|
|
17
|
+
if (className !== void 0) button.className = className;
|
|
18
|
+
fillButton(button, icons);
|
|
19
|
+
return button;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { fillButton, legendIcons, renderSonicButton };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/lib/supersede.ts
|
|
2
|
+
function supersede(signal) {
|
|
3
|
+
let current;
|
|
4
|
+
const cancel = () => {
|
|
5
|
+
current?.abort();
|
|
6
|
+
current = void 0;
|
|
7
|
+
};
|
|
8
|
+
signal.addEventListener("abort", cancel, { once: true });
|
|
9
|
+
return {
|
|
10
|
+
cancel,
|
|
11
|
+
next: () => {
|
|
12
|
+
cancel();
|
|
13
|
+
current = new AbortController();
|
|
14
|
+
return current.signal;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { supersede };
|
package/dist/player.css
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@import '@xsynaptic/sonic-ui/material/core.css';
|
|
2
|
+
@import '@xsynaptic/sonic-ui/material/cap.css';
|
|
3
|
+
@import '@xsynaptic/sonic-ui/material/glass.css';
|
|
4
|
+
@import '@xsynaptic/sonic-ui/material/pane.css';
|
|
5
|
+
@import '@xsynaptic/sonic-ui/material/well.css';
|
|
6
|
+
@import '@xsynaptic/sonic-ui/material/readout.css';
|
|
7
|
+
@import '@xsynaptic/sonic-ui/material/value.css';
|
|
8
|
+
@import '@xsynaptic/sonic-ui/material/arc.css';
|
|
9
|
+
@import '@xsynaptic/sonic-ui/material/scale.css';
|
|
10
|
+
@import '@xsynaptic/sonic-ui/material/groove.css';
|
|
11
|
+
@import '@xsynaptic/sonic-ui/material/keycap.css';
|
|
12
|
+
@import '@xsynaptic/sonic-ui/button.css';
|
|
13
|
+
@import '@xsynaptic/sonic-ui/dial.css';
|
|
14
|
+
@import '@xsynaptic/sonic-ui/screen.css';
|
|
15
|
+
@import '@xsynaptic/sonic-ui/slider.css';
|
|
16
|
+
@import '@xsynaptic/sonic-ui/ticker.css';
|
|
17
|
+
@import '@xsynaptic/sonic-ui/wavestrip.css';
|
|
18
|
+
@import '@xsynaptic/sonic-ui/waveform.css';
|
|
19
|
+
@import './styles/tokens.css';
|
|
20
|
+
@import './styles/reset.css';
|
|
21
|
+
@import './styles/host.css';
|
|
22
|
+
@import './styles/focus.css';
|
|
23
|
+
@import './styles/status.css';
|
|
24
|
+
@import './styles/primitives.css';
|
|
25
|
+
@import './styles/track.css';
|
|
26
|
+
@import './styles/controls.css';
|
|
27
|
+
@import './styles/cue.css';
|
|
28
|
+
@import './styles/tray.css';
|
|
29
|
+
@import './styles/panel.css';
|
|
30
|
+
@import './styles/bar.css';
|
|
31
|
+
@import './styles/overlay.css';
|
|
32
|
+
@import './styles/overlay-layout.css';
|
|
33
|
+
@import './styles/coarse.css';
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
.pzm-bar {
|
|
2
|
+
--pzm-padding-block-start: calc(var(--pzm-padding-block) - 1px);
|
|
3
|
+
--pzm-inset-left: max(var(--pzm-padding-inline), env(safe-area-inset-left));
|
|
4
|
+
--pzm-inset-right: max(var(--pzm-padding-inline), env(safe-area-inset-right));
|
|
5
|
+
--pzm-inset-bottom: env(safe-area-inset-bottom);
|
|
6
|
+
--pzm-progress-space: calc(var(--pzm-progress-height) + 2px);
|
|
7
|
+
|
|
8
|
+
position: relative;
|
|
9
|
+
padding: var(--pzm-padding-block-start) var(--pzm-inset-right)
|
|
10
|
+
calc(var(--pzm-padding-block) + var(--pzm-inset-bottom)) var(--pzm-inset-left);
|
|
11
|
+
container-type: inline-size;
|
|
12
|
+
background-color: var(--pzm-surface);
|
|
13
|
+
border-top: 1px solid var(--pzm-bar-border);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* On the pseudo-element, since the overlay sits inside the bar and would inherit them */
|
|
17
|
+
.pzm-bar::before {
|
|
18
|
+
--pzm-texture-corner: 0 100%;
|
|
19
|
+
--pzm-texture-reach: 60% 200%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.pzm-bar > pzm-panel > .pzm-panel {
|
|
23
|
+
--pzm-panel-inset-left: env(safe-area-inset-left);
|
|
24
|
+
--sonic-waveform-scrim: linear-gradient(to top, var(--pzm-panel-surface), transparent 1.75rem);
|
|
25
|
+
|
|
26
|
+
position: absolute;
|
|
27
|
+
inset-block-end: 100%;
|
|
28
|
+
inset-inline: 0;
|
|
29
|
+
background-color: var(--pzm-panel-surface);
|
|
30
|
+
border-top: 1px solid var(--pzm-bar-border);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.pzm-bar > pzm-panel > .pzm-panel .pzm-panel-zoom {
|
|
34
|
+
right: env(safe-area-inset-right);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.pzm-progress {
|
|
38
|
+
--sonic-buffered: var(--pzm-waveform-buffered);
|
|
39
|
+
--sonic-focus: var(--pzm-bar-border);
|
|
40
|
+
--sonic-lit: var(--pzm-progress-played);
|
|
41
|
+
--sonic-reveal-delay: 150ms;
|
|
42
|
+
--sonic-scrub: var(--pzm-waveform-scrub);
|
|
43
|
+
--sonic-slider-cap-ratio: 0;
|
|
44
|
+
--sonic-slider-groove-anchor: 1;
|
|
45
|
+
--sonic-slider-groove-hover-delay: 100ms;
|
|
46
|
+
--sonic-slider-groove-hover-ratio: calc(2 / 3);
|
|
47
|
+
--sonic-slider-groove-radius-ratio: 0;
|
|
48
|
+
--sonic-slider-groove-ratio: calc(1 / 3);
|
|
49
|
+
--sonic-slider-indicator-ratio: 0;
|
|
50
|
+
--sonic-slider-length: 100%;
|
|
51
|
+
--sonic-slider-size: calc(var(--pzm-progress-height) * 3);
|
|
52
|
+
--sonic-unlit: var(--pzm-waveform-base);
|
|
53
|
+
|
|
54
|
+
display: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* The bar's top edge, carried on the groove so it rises as the groove thickens */
|
|
58
|
+
.pzm-progress .sonic-slider-groove::before {
|
|
59
|
+
position: absolute;
|
|
60
|
+
inset-block-end: 100%;
|
|
61
|
+
inset-inline: 0;
|
|
62
|
+
block-size: 1px;
|
|
63
|
+
content: '';
|
|
64
|
+
background-color: var(--pzm-bar-border);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.pzm-bar-grid {
|
|
68
|
+
--pzm-layout: 'transport info panel volume queue expand' auto 'seek seek seek seek seek seek'
|
|
69
|
+
minmax(0, 1fr) / auto minmax(0, 1fr) auto auto auto auto;
|
|
70
|
+
--pzm-waveform-height: var(--pzm-waveform-height-bar);
|
|
71
|
+
--pzm-control-gap: 1rem;
|
|
72
|
+
|
|
73
|
+
display: grid;
|
|
74
|
+
grid-template: var(--pzm-layout);
|
|
75
|
+
gap: var(--pzm-gap-tight) var(--pzm-control-gap);
|
|
76
|
+
align-items: center;
|
|
77
|
+
block-size: calc(
|
|
78
|
+
var(--pzm-artwork-size) - var(--pzm-padding-block-start) - var(--pzm-padding-block)
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.pzm-bar-grid .pzm-scope {
|
|
83
|
+
display: none;
|
|
84
|
+
grid-area: scope;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@container (width >= 64rem) {
|
|
88
|
+
.pzm-bar-grid:has(> pzm-scope) {
|
|
89
|
+
--pzm-layout: 'transport info scope panel volume queue expand' auto
|
|
90
|
+
'seek seek seek seek seek seek seek' minmax(0, 1fr) / auto minmax(0, 1fr) auto auto auto auto
|
|
91
|
+
auto;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.pzm-bar-grid .pzm-scope {
|
|
95
|
+
display: grid;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.pzm-artwork {
|
|
100
|
+
object-fit: cover;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Full-bleed from under the bar's top border to its foot, beside the grid rows and never the panel */
|
|
104
|
+
.pzm-bar-grid .pzm-artwork {
|
|
105
|
+
position: absolute;
|
|
106
|
+
bottom: var(--pzm-inset-bottom);
|
|
107
|
+
left: env(safe-area-inset-left);
|
|
108
|
+
inline-size: var(--pzm-artwork-size);
|
|
109
|
+
block-size: var(--pzm-artwork-size);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.pzm-bar-grid:has(.pzm-artwork) {
|
|
113
|
+
padding-left: calc(
|
|
114
|
+
env(safe-area-inset-left) + var(--pzm-artwork-size) + var(--pzm-gap) - var(--pzm-inset-left)
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@container (26rem <= width < 40rem) {
|
|
119
|
+
.pzm-bar-grid .pzm-artwork {
|
|
120
|
+
display: none;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.pzm-bar-grid:has(.pzm-artwork) {
|
|
124
|
+
padding-left: 0;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.pzm-bar-grid .pzm-transport {
|
|
129
|
+
grid-area: transport;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.pzm-bar-grid .pzm-track {
|
|
133
|
+
grid-area: info;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.pzm-bar-grid pzm-time-slider > .pzm-waveform-frame {
|
|
137
|
+
grid-area: seek;
|
|
138
|
+
min-block-size: var(--pzm-waveform-height);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.pzm-bar-grid .pzm-panel-toggle > .sonic-button {
|
|
142
|
+
grid-area: panel;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.pzm-bar-grid .pzm-volume {
|
|
146
|
+
--sonic-dial-travel: var(--pzm-dial-travel-bar);
|
|
147
|
+
|
|
148
|
+
grid-area: volume;
|
|
149
|
+
gap: var(--pzm-control-gap);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.pzm-bar-grid .pzm-queue {
|
|
153
|
+
grid-area: queue;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.pzm-bar-grid .pzm-overlay-toggle > .sonic-button {
|
|
157
|
+
grid-area: expand;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
@container (width < 64rem) {
|
|
161
|
+
.pzm-bar-grid .pzm-seek-button {
|
|
162
|
+
display: none;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* Each box takes back the room around its glyph, so `--pzm-control-gap` is what shows between rendered edges */
|
|
167
|
+
@container (width >= 26rem) {
|
|
168
|
+
.pzm-bar-grid .pzm-transport {
|
|
169
|
+
gap: var(--pzm-control-gap);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.pzm-bar-grid .pzm-step-button > .sonic-button {
|
|
173
|
+
margin-inline: calc((var(--pzm-button-size) - 1.0417rem) / -2);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.pzm-bar-grid .pzm-seek-button > .sonic-button {
|
|
177
|
+
margin-inline: calc((var(--pzm-button-size) - 1.1875rem) / -2);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.pzm-bar-grid :is(.pzm-panel-toggle, pzm-mute-button > sonic-button) > .sonic-button {
|
|
181
|
+
margin-inline: calc((var(--pzm-button-size) - 1.0625rem) / -2);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.pzm-bar-grid .pzm-overlay-toggle > .sonic-button {
|
|
185
|
+
margin-inline: calc((var(--pzm-button-size) - 0.9375rem) / -2);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.pzm-bar-grid .pzm-queue > sonic-button > .sonic-button {
|
|
189
|
+
margin-inline: calc((var(--pzm-button-size) - 1.125rem) / -2);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/* Too narrow for the tray to hang from its button without running off the left edge, so it spans the bar */
|
|
194
|
+
@container (width < 30rem) {
|
|
195
|
+
.pzm-bar-grid .pzm-queue {
|
|
196
|
+
position: static;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.pzm-bar-grid .pzm-queue-popover {
|
|
200
|
+
left: 0;
|
|
201
|
+
width: auto;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/* Scoped to the grid and the bar's own panel, since the overlay's dialog sits in this container too */
|
|
206
|
+
@container (width < 26rem) {
|
|
207
|
+
.pzm-bar-grid {
|
|
208
|
+
--pzm-layout: 'transport info expand' auto / auto minmax(0, 1fr) auto;
|
|
209
|
+
|
|
210
|
+
block-size: auto;
|
|
211
|
+
padding-block-start: var(--pzm-progress-space);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.pzm-bar-grid:not(:has(> pzm-overlay-toggle)) {
|
|
215
|
+
--pzm-layout: 'transport info queue' auto / auto minmax(0, 1fr) auto;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.pzm-bar-grid:has(.pzm-artwork) {
|
|
219
|
+
padding-left: 0;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.pzm-progress {
|
|
223
|
+
position: absolute;
|
|
224
|
+
inset-block-end: calc(100% - var(--pzm-progress-height));
|
|
225
|
+
inset-inline: 0;
|
|
226
|
+
display: block;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.pzm-bar-grid .pzm-track {
|
|
230
|
+
position: relative;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.pzm-bar-grid .pzm-scrub-readout {
|
|
234
|
+
display: block;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.pzm-bar-grid .pzm-track:has(> pzm-scrub-readout[data-held]) pzm-time,
|
|
238
|
+
.pzm-bar-grid
|
|
239
|
+
.pzm-track:has(> pzm-scrub-readout[data-held][data-cue])
|
|
240
|
+
:is(pzm-title, pzm-artist-line) {
|
|
241
|
+
visibility: hidden;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.pzm-bar > pzm-panel > .pzm-panel,
|
|
245
|
+
.pzm-bar-grid .pzm-artwork,
|
|
246
|
+
.pzm-bar-grid pzm-time-slider > .pzm-waveform-frame,
|
|
247
|
+
.pzm-bar-grid .pzm-panel-toggle,
|
|
248
|
+
.pzm-bar-grid:has(> pzm-overlay-toggle) .pzm-queue,
|
|
249
|
+
.pzm-bar-grid .pzm-step-button,
|
|
250
|
+
.pzm-bar-grid .pzm-volume {
|
|
251
|
+
display: none;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@media (pointer: coarse) {
|
|
2
|
+
pzm-root sonic-button {
|
|
3
|
+
--sonic-target-size: var(--pzm-hit-target);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.pzm-tray-handle {
|
|
7
|
+
position: relative;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.pzm-tray-handle::before {
|
|
11
|
+
position: absolute;
|
|
12
|
+
inset: calc((var(--pzm-hit-target) - 100%) / -2);
|
|
13
|
+
content: '';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.pzm-transport {
|
|
17
|
+
gap: var(--pzm-gap);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.pzm-overlay-tab,
|
|
21
|
+
.pzm-overlay-list {
|
|
22
|
+
user-select: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.pzm-track-title {
|
|
26
|
+
position: relative;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.pzm-track-title::before {
|
|
30
|
+
position: absolute;
|
|
31
|
+
inset-block: calc((var(--pzm-hit-target) - 100%) / -2);
|
|
32
|
+
inset-inline: 0;
|
|
33
|
+
content: '';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@container (width >= 26rem) {
|
|
37
|
+
.pzm-bar-grid .pzm-track-title::before {
|
|
38
|
+
inset-block: calc(var(--pzm-gap-tight) / -2);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@container (width < 26rem) {
|
|
43
|
+
.pzm-bar-grid .pzm-track-title::before {
|
|
44
|
+
inset-block-start: calc((var(--pzm-hit-target) - var(--pzm-button-size-primary)) / -2);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|