@@ -11708,13 +11708,72 @@ class HomeiiBaseMusicCard extends HTMLElement {
1170811708 }, 50);
1170911709 }
1171011710
11711+ _setNowPlayingSubtitle(value, { scrollWhenOverflow = false } = {}) {
11712+ const el = this.$("npSub");
11713+ if (!el) return;
11714+ const text = String(value || "—");
11715+ const shouldScroll = !!scrollWhenOverflow && !this._isHebrew();
11716+ const existingInner = el.querySelector?.(".scrolling-text-inner");
11717+ const unchanged = el.dataset.homeiiSubtitleText === text
11718+ && el.dataset.homeiiSubtitleScroll === String(shouldScroll)
11719+ && existingInner;
11720+
11721+ el.title = text;
11722+ el.classList.toggle("scroll-when-overflow", shouldScroll);
11723+ if (unchanged) {
11724+ if (shouldScroll) this._queueNowPlayingSubtitleOverflowSync(el);
11725+ return;
11726+ }
11727+
11728+ el.dataset.homeiiSubtitleText = text;
11729+ el.dataset.homeiiSubtitleScroll = String(shouldScroll);
11730+ el.classList.remove("is-overflowing");
11731+ el.style.removeProperty("--scroll-distance");
11732+ el.style.removeProperty("--scroll-duration");
11733+ el.textContent = "";
11734+ const inner = document.createElement("span");
11735+ inner.className = "scrolling-text-inner";
11736+ const primary = document.createElement("span");
11737+ primary.className = "scrolling-text-item";
11738+ primary.textContent = text;
11739+ inner.appendChild(primary);
11740+ if (shouldScroll) {
11741+ const duplicate = document.createElement("span");
11742+ duplicate.className = "scrolling-text-item";
11743+ duplicate.setAttribute("aria-hidden", "true");
11744+ duplicate.textContent = text;
11745+ inner.appendChild(duplicate);
11746+ }
11747+ el.appendChild(inner);
11748+ if (shouldScroll) this._queueNowPlayingSubtitleOverflowSync(el);
11749+ }
11750+
11751+ _queueNowPlayingSubtitleOverflowSync(el) {
11752+ if (typeof requestAnimationFrame === "function") requestAnimationFrame(() => this._syncNowPlayingSubtitleOverflow(el));
11753+ else this._syncNowPlayingSubtitleOverflow(el);
11754+ }
11755+
11756+ _syncNowPlayingSubtitleOverflow(el) {
11757+ const inner = el?.querySelector?.(".scrolling-text-inner");
11758+ const item = inner?.querySelector?.(".scrolling-text-item");
11759+ if (!el || !inner || !item) return;
11760+ const gap = Math.max(24, Math.round(el.clientWidth * 0.18));
11761+ const itemWidth = item.scrollWidth;
11762+ const distance = itemWidth + gap;
11763+ const overflow = itemWidth > el.clientWidth + 1;
11764+ el.classList.toggle("is-overflowing", overflow);
11765+ el.style.setProperty("--scroll-gap", gap + "px");
11766+ el.style.setProperty("--scroll-distance", distance + "px");
11767+ el.style.setProperty("--scroll-duration", Math.max(9, Math.min(24, distance / 24)).toFixed(2) + "s");
11768+ }
11769+
1171111770 _syncNowPlayingUI() {
1171211771 const player = this._getSelectedPlayer();
1171311772 if (!player) {
1171411773 const issue = this._state.musicAssistantIssueMessage || this._musicAssistantRequiredMessage();
1171511774 this._setButtonIcon(this.$("btnPlay"), "play");
1171611775 if (this.$("npTitle")) this.$("npTitle").textContent = this._musicAssistantRequiredTitle();
11717- if ( this.$("npSub")) this.$("npSub").textContent = issue;
11776+ this._setNowPlayingSubtitle( issue) ;
1171811777 if (this.$("npArt")) this.$("npArt").innerHTML = this._artPlaceholderHtml("speaker");
1171911778 if (this.$("progressFill")) this.$("progressFill").style.width = "0%";
1172011779 const slider = this.$("volSlider");
@@ -11744,7 +11803,7 @@ class HomeiiBaseMusicCard extends HTMLElement {
1174411803 || "";
1174511804 this._setButtonIcon(this.$("btnPlay"), this._playPauseIconName(player));
1174611805 this.$("npTitle").textContent = queueTitle || player.attributes.media_title || this._i18n("ui.nothing_playing");
11747- this.$("npSub").textContent = queueArtist || player.attributes.media_artist || "—";
11806+ this._setNowPlayingSubtitle( queueArtist || player.attributes.media_artist || "—") ;
1174811807 const art = this._currentArtworkUrl(player, queueItem, 420, { preferPlayerArtwork: true }) || queueArt || this._bestArtworkUrl([
1174911808 player.attributes.entity_picture_local,
1175011809 player.attributes.entity_picture,
@@ -21189,7 +21248,7 @@ class HomeiiMusicFlowBaseCard extends HomeiiBaseMusicCard {
2118921248 || "";
2119021249 const browseAlbum = stack.current?.media_item?.album?.name || player?.attributes?.media_album_name || "";
2119121250 if (this.$("npTitle")) this.$("npTitle").textContent = browseTitle;
21192- if ( this.$("npSub")) this.$("npSub").textContent = [browseArtist, browseAlbum].filter(Boolean).join(" · ") || "—";
21251+ this._setNowPlayingSubtitle( [browseArtist, browseAlbum].filter(Boolean).join(" · ") || "—") ;
2119321252 this._scheduleMobileArtBrowseReset();
2119421253 } else {
2119521254 const hasPendingPlay = Number(this._state.mobileQueuePlayPendingUntil || 0) > Date.now();
@@ -21202,7 +21261,7 @@ class HomeiiMusicFlowBaseCard extends HomeiiBaseMusicCard {
2120221261 const subParts = hasPendingPlay
2120321262 ? [queueArtist || player?.attributes?.media_artist || "", queueAlbum || player?.attributes?.media_album_name || ""]
2120421263 : [player?.attributes?.media_artist || queueArtist || "", player?.attributes?.media_album_name || queueAlbum || ""];
21205- if ( this.$("npSub")) this.$("npSub").textContent = subParts.filter(Boolean).join(" · ") || "—";
21264+ this._setNowPlayingSubtitle( subParts.filter(Boolean).join(" · ") || "—") ;
2120621265 clearTimeout(this._mobileArtBrowseResetTimer);
2120721266 this._mobileArtBrowseResetTimer = null;
2120821267 }
@@ -24289,6 +24348,49 @@ class HomeiiMusicFlowBaseCard extends HomeiiBaseMusicCard {
2428924348 -webkit-line-clamp:2;
2429024349 -webkit-box-orient:vertical;
2429124350 }
24351+ .np-sub.scroll-when-overflow {
24352+ display:block;
24353+ white-space:nowrap;
24354+ overflow:hidden;
24355+ text-overflow:clip;
24356+ text-align:start;
24357+ -webkit-line-clamp:unset;
24358+ -webkit-box-orient:initial;
24359+ }
24360+ .np-sub.scroll-when-overflow .scrolling-text-inner {
24361+ display:inline-flex;
24362+ align-items:center;
24363+ min-width:0;
24364+ max-width:none;
24365+ width:max-content;
24366+ gap:var(--scroll-gap, 3rem);
24367+ }
24368+ .np-sub.scroll-when-overflow .scrolling-text-item {
24369+ flex:0 0 auto;
24370+ white-space:nowrap;
24371+ }
24372+ .np-sub.scroll-when-overflow.is-overflowing {
24373+ -webkit-mask-image:linear-gradient(90deg, transparent 0, #000 12%, #000 88%, transparent 100%);
24374+ mask-image:linear-gradient(90deg, transparent 0, #000 12%, #000 88%, transparent 100%);
24375+ }
24376+ .np-sub.scroll-when-overflow.is-overflowing .scrolling-text-inner {
24377+ animation:homeiiSubtitleScroll var(--scroll-duration, 12s) linear infinite;
24378+ will-change:transform;
24379+ }
24380+ @keyframes homeiiSubtitleScroll {
24381+ from { transform:translateX(0); }
24382+ to { transform:translateX(calc(-1 * var(--scroll-distance, 0px))); }
24383+ }
24384+ @media (prefers-reduced-motion: reduce) {
24385+ .np-sub.scroll-when-overflow {
24386+ text-overflow:ellipsis;
24387+ }
24388+ .np-sub.scroll-when-overflow.is-overflowing .scrolling-text-inner {
24389+ max-width:100%;
24390+ gap:0;
24391+ animation:none;
24392+ }
24393+ }
2429224394 .hero-up-next {
2429324395 justify-content:center;
2429424396 text-align:center;
@@ -38553,7 +38655,7 @@ class HomeiiMusicFlowBaseCard extends HomeiiBaseMusicCard {
3855338655 emptyActions.setAttribute("hidden", "");
3855438656 }
3855538657 if (this.$("npTitle")) this.$("npTitle").textContent = text;
38556- if ( this.$("npSub")) this.$("npSub").textContent = options.subtitle || this._i18n("ui.choose_something_from_the_quick_shelf_or_tap_the_wand_for_a_random_playl");
38658+ this._setNowPlayingSubtitle( options.subtitle || this._i18n("ui.choose_something_from_the_quick_shelf_or_tap_the_wand_for_a_random_playl"), { scrollWhenOverflow: true } );
3855738659 if (this.$("bigCurTime")) this.$("bigCurTime").textContent = "0:00";
3855838660 if (this.$("bigTotalTime")) this.$("bigTotalTime").textContent = "0:00";
3855938661 if (this.$("progressFill")) this.$("progressFill").style.width = "0%";
@@ -38842,7 +38944,7 @@ class HomeiiMusicFlowBaseCard extends HomeiiBaseMusicCard {
3884238944 if (compactCoverAura) compactCoverAura.style.backgroundImage = displayArt ? `url("${this._esc(displayArt)}")` : "";
3884338945 if (bg) bg.style.backgroundImage = displayArt ? `${overlay}, url("${this._esc(displayArt)}")` : "";
3884438946 if (this.$("npTitle")) this.$("npTitle").textContent = displayTitle || this._i18n("ui.nothing_playing");
38845- if ( this.$("npSub")) this.$("npSub").textContent = displaySubtitle || "—";
38947+ this._setNowPlayingSubtitle( displaySubtitle || "—") ;
3884638948 this._syncMobileUpNextUi(upNextItem);
3884738949 this._syncSourceBadgesUi(player, displayQueueItem);
3884838950 if (this.$("progressFill")) this.$("progressFill").style.width = duration ? `${Math.min(100, (position / duration) * 100)}%` : "0%";
@@ -38979,7 +39081,7 @@ class HomeiiMusicFlowBaseCard extends HomeiiBaseMusicCard {
3897939081 return;
3898039082 }
3898139083 if (this.$("npTitle")) this.$("npTitle").textContent = pendingTitle;
38982- if ( this.$("npSub")) this.$("npSub").textContent = this. _i18n("ui.starting_quick_mix");
39084+ this._setNowPlayingSubtitle( this._i18n("ui.starting_quick_mix") );
3898339085 if (this.$("npArt")) this.$("npArt").innerHTML = pendingArt ? `<img src="${this._esc(pendingArt)}" alt="">` : this._artPlaceholderHtml("radio");
3898439086 if (this.$("progressFill")) this.$("progressFill").style.width = "0%";
3898539087 this._syncDynamicThemeArtwork(pendingArt || "").catch(() => {});
@@ -39031,7 +39133,7 @@ class HomeiiMusicFlowBaseCard extends HomeiiBaseMusicCard {
3903139133 this._setMobileRandomFabVisible(true);
3903239134 this._setMobileRandomFabDisabled(false);
3903339135 if (this.$("npTitle")) this.$("npTitle").textContent = currentTitle;
39034- if ( this.$("npSub")) this.$("npSub").textContent = [currentArtist || player.attributes.media_artist || "", currentAlbum].filter(Boolean).join(" · ") || "—";
39136+ this._setNowPlayingSubtitle( [currentArtist || player.attributes.media_artist || "", currentAlbum].filter(Boolean).join(" · ") || "—") ;
3903539137 this._rememberRecentPlayback(player, currentQueueItem);
3903639138 this._syncRecentHistoryUi();
3903739139 this._syncSourceBadgesUi(player, currentQueueItem);
0 commit comments