smooth-player 2.1.0 → 2.1.2
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/SmoothPlayer.js +3 -1
- package/dist/smooth-player.css +8 -0
- package/dist/ui.js +4 -3
- package/dist-cjs/SmoothPlayer.js +3 -1
- package/dist-cjs/ui.js +4 -3
- package/package.json +1 -1
- package/styles/common/_base.scss +4 -0
- package/styles/themes/_nocturne.scss +4 -0
package/dist/SmoothPlayer.js
CHANGED
|
@@ -326,8 +326,10 @@ export class SmoothPlayer {
|
|
|
326
326
|
mountPlaylistTitle(element, options = {}) {
|
|
327
327
|
const fallbackTitle = options.fallbackTitle ?? DEFAULT_PLAYLIST_TITLE;
|
|
328
328
|
const render = () => {
|
|
329
|
+
const hasPlaylist = this.getPlaylists().length > 1 || this.getActiveTracks().length > 1;
|
|
329
330
|
const playlist = this.getCurrentPlaylist();
|
|
330
|
-
element.
|
|
331
|
+
element.hidden = !hasPlaylist;
|
|
332
|
+
element.textContent = hasPlaylist ? (playlist?.title ?? fallbackTitle) : "";
|
|
331
333
|
};
|
|
332
334
|
render();
|
|
333
335
|
const off = this.on("playlistchange", render);
|
package/dist/smooth-player.css
CHANGED
|
@@ -30,6 +30,10 @@
|
|
|
30
30
|
transition: opacity 420ms cubic-bezier(0.2, 0.7, 0.2, 1);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
.smooth-player [hidden] {
|
|
34
|
+
display: none !important;
|
|
35
|
+
}
|
|
36
|
+
|
|
33
37
|
.smooth-player.is-drag-over {
|
|
34
38
|
border-color: color-mix(in srgb, var(--smooth-player-accent) 44%, #fff 56%);
|
|
35
39
|
box-shadow: 0 0 0 calc(var(--smooth-player-rem) * 2) color-mix(in srgb, var(--smooth-player-accent) 18%, transparent);
|
|
@@ -628,6 +632,7 @@
|
|
|
628
632
|
top: 0.75rem;
|
|
629
633
|
right: 0;
|
|
630
634
|
left: auto;
|
|
635
|
+
z-index: 2;
|
|
631
636
|
width: 2.2rem;
|
|
632
637
|
height: 1.6rem;
|
|
633
638
|
display: block;
|
|
@@ -745,8 +750,11 @@
|
|
|
745
750
|
inset: auto 0 0 0;
|
|
746
751
|
z-index: 2;
|
|
747
752
|
width: 100%;
|
|
753
|
+
max-width: 100%;
|
|
754
|
+
box-sizing: border-box;
|
|
748
755
|
height: min(48%, 20rem);
|
|
749
756
|
overflow-y: auto;
|
|
757
|
+
overflow-x: hidden;
|
|
750
758
|
padding: 0.8rem 1rem 1rem;
|
|
751
759
|
border-top: 1px solid rgba(255, 255, 255, 0.16);
|
|
752
760
|
border-radius: 0;
|
package/dist/ui.js
CHANGED
|
@@ -12,7 +12,7 @@ function renderPlayerMarkup(root, debugEnabled) {
|
|
|
12
12
|
root.innerHTML = `
|
|
13
13
|
<div class="smooth-player__main">
|
|
14
14
|
<div class="smooth-player__top">
|
|
15
|
-
<div class="smooth-player__top-title"
|
|
15
|
+
<div class="smooth-player__top-title"></div>
|
|
16
16
|
<button id="shuffle-toggle" type="button" aria-label="${strings.shuffle.disabledLabel}" aria-pressed="false" hidden>
|
|
17
17
|
<span class="smooth-player__icon-shuffle" aria-hidden="true"></span>
|
|
18
18
|
<span id="shuffle-text" class="smooth-player__sr-only">${strings.shuffle.disabledLabel}</span>
|
|
@@ -416,8 +416,10 @@ export function mountPlayerUI(player, root, options = {}) {
|
|
|
416
416
|
visualizerText.textContent = label;
|
|
417
417
|
};
|
|
418
418
|
const renderTopPlaylist = () => {
|
|
419
|
+
const hasPlaylist = player.getPlaylists().length > 1 || player.getPlaylist().length > 1;
|
|
420
|
+
playlistTop.hidden = !hasPlaylist;
|
|
419
421
|
const playlist = player.getCurrentPlaylist();
|
|
420
|
-
playlistTitle.textContent = playlist?.title ?? strings.playlist.defaultTitle;
|
|
422
|
+
playlistTitle.textContent = hasPlaylist ? (playlist?.title ?? strings.playlist.defaultTitle) : "";
|
|
421
423
|
};
|
|
422
424
|
const renderVisualizerPanel = () => {
|
|
423
425
|
const mode = player.getVisualizer();
|
|
@@ -557,7 +559,6 @@ export function mountPlayerUI(player, root, options = {}) {
|
|
|
557
559
|
closeButton: playlistClose,
|
|
558
560
|
});
|
|
559
561
|
unmounts.push(() => playlistPanelController.destroy());
|
|
560
|
-
unmounts.push(player.mountPlaylistTitle(playlistTitle));
|
|
561
562
|
unmounts.push(player.mountShuffleToggle({
|
|
562
563
|
button: shuffleToggle,
|
|
563
564
|
labelElement: shuffleText,
|
package/dist-cjs/SmoothPlayer.js
CHANGED
|
@@ -329,8 +329,10 @@ class SmoothPlayer {
|
|
|
329
329
|
mountPlaylistTitle(element, options = {}) {
|
|
330
330
|
const fallbackTitle = options.fallbackTitle ?? DEFAULT_PLAYLIST_TITLE;
|
|
331
331
|
const render = () => {
|
|
332
|
+
const hasPlaylist = this.getPlaylists().length > 1 || this.getActiveTracks().length > 1;
|
|
332
333
|
const playlist = this.getCurrentPlaylist();
|
|
333
|
-
element.
|
|
334
|
+
element.hidden = !hasPlaylist;
|
|
335
|
+
element.textContent = hasPlaylist ? (playlist?.title ?? fallbackTitle) : "";
|
|
334
336
|
};
|
|
335
337
|
render();
|
|
336
338
|
const off = this.on("playlistchange", render);
|
package/dist-cjs/ui.js
CHANGED
|
@@ -15,7 +15,7 @@ function renderPlayerMarkup(root, debugEnabled) {
|
|
|
15
15
|
root.innerHTML = `
|
|
16
16
|
<div class="smooth-player__main">
|
|
17
17
|
<div class="smooth-player__top">
|
|
18
|
-
<div class="smooth-player__top-title"
|
|
18
|
+
<div class="smooth-player__top-title"></div>
|
|
19
19
|
<button id="shuffle-toggle" type="button" aria-label="${strings_js_1.strings.shuffle.disabledLabel}" aria-pressed="false" hidden>
|
|
20
20
|
<span class="smooth-player__icon-shuffle" aria-hidden="true"></span>
|
|
21
21
|
<span id="shuffle-text" class="smooth-player__sr-only">${strings_js_1.strings.shuffle.disabledLabel}</span>
|
|
@@ -419,8 +419,10 @@ function mountPlayerUI(player, root, options = {}) {
|
|
|
419
419
|
visualizerText.textContent = label;
|
|
420
420
|
};
|
|
421
421
|
const renderTopPlaylist = () => {
|
|
422
|
+
const hasPlaylist = player.getPlaylists().length > 1 || player.getPlaylist().length > 1;
|
|
423
|
+
playlistTop.hidden = !hasPlaylist;
|
|
422
424
|
const playlist = player.getCurrentPlaylist();
|
|
423
|
-
playlistTitle.textContent = playlist?.title ?? strings_js_1.strings.playlist.defaultTitle;
|
|
425
|
+
playlistTitle.textContent = hasPlaylist ? (playlist?.title ?? strings_js_1.strings.playlist.defaultTitle) : "";
|
|
424
426
|
};
|
|
425
427
|
const renderVisualizerPanel = () => {
|
|
426
428
|
const mode = player.getVisualizer();
|
|
@@ -560,7 +562,6 @@ function mountPlayerUI(player, root, options = {}) {
|
|
|
560
562
|
closeButton: playlistClose,
|
|
561
563
|
});
|
|
562
564
|
unmounts.push(() => playlistPanelController.destroy());
|
|
563
|
-
unmounts.push(player.mountPlaylistTitle(playlistTitle));
|
|
564
565
|
unmounts.push(player.mountShuffleToggle({
|
|
565
566
|
button: shuffleToggle,
|
|
566
567
|
labelElement: shuffleText,
|
package/package.json
CHANGED
package/styles/common/_base.scss
CHANGED
|
@@ -39,6 +39,10 @@
|
|
|
39
39
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
.smooth-player [hidden] {
|
|
43
|
+
display: none !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
42
46
|
.smooth-player.is-drag-over {
|
|
43
47
|
border-color: color-mix(in srgb, var(--smooth-player-accent) 44%, #fff 56%);
|
|
44
48
|
box-shadow: 0 0 0 sp-rem(2) color-mix(in srgb, var(--smooth-player-accent) 18%, transparent);
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
top: .75rem;
|
|
60
60
|
right: 0;
|
|
61
61
|
left: auto;
|
|
62
|
+
z-index: 2;
|
|
62
63
|
width: 2.2rem;
|
|
63
64
|
height: 1.6rem;
|
|
64
65
|
display: block;
|
|
@@ -192,8 +193,11 @@
|
|
|
192
193
|
inset: auto 0 0 0;
|
|
193
194
|
z-index: 2;
|
|
194
195
|
width: 100%;
|
|
196
|
+
max-width: 100%;
|
|
197
|
+
box-sizing: border-box;
|
|
195
198
|
height: min(48%, 20rem);
|
|
196
199
|
overflow-y: auto;
|
|
200
|
+
overflow-x: hidden;
|
|
197
201
|
padding: 0.8rem 1rem 1rem;
|
|
198
202
|
border-top: 1px solid rgba(255, 255, 255, 0.16);
|
|
199
203
|
border-radius: 0;
|