Skip to content

Commit 7b76fef

Browse files
committed
Tune empty shelf and subtitle performance
1 parent 9068181 commit 7b76fef

3 files changed

Lines changed: 44 additions & 2 deletions

File tree

dist/homeii-music-flow.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11712,7 +11712,7 @@ class HomeiiBaseMusicCard extends HTMLElement {
1171211712
const el = this.$("npSub");
1171311713
if (!el) return;
1171411714
const text = String(value || "—");
11715-
const shouldScroll = !!scrollWhenOverflow && !this._isHebrew();
11715+
const shouldScroll = this._nowPlayingSubtitleShouldScroll(scrollWhenOverflow);
1171611716
const existingInner = el.querySelector?.(".scrolling-text-inner");
1171711717
const unchanged = el.dataset.homeiiSubtitleText === text
1171811718
&& el.dataset.homeiiSubtitleScroll === String(shouldScroll)
@@ -11748,6 +11748,10 @@ class HomeiiBaseMusicCard extends HTMLElement {
1174811748
if (shouldScroll) this._queueNowPlayingSubtitleOverflowSync(el);
1174911749
}
1175011750

11751+
_nowPlayingSubtitleShouldScroll(scrollWhenOverflow = false) {
11752+
return !!scrollWhenOverflow && !this._isHebrew() && !this._performanceUltraLiteEnabled();
11753+
}
11754+
1175111755
_queueNowPlayingSubtitleOverflowSync(el) {
1175211756
if (typeof requestAnimationFrame === "function") requestAnimationFrame(() => this._syncNowPlayingSubtitleOverflow(el));
1175311757
else this._syncNowPlayingSubtitleOverflow(el);
@@ -27167,6 +27171,11 @@ class HomeiiMusicFlowBaseCard extends HomeiiBaseMusicCard {
2716727171
width:min(1040px, calc(100% - clamp(320px, 24cqi, 440px)));
2716827172
margin-left:clamp(300px, 22cqi, 420px);
2716927173
margin-right:auto;
27174+
padding-inline:max(var(--empty-quick-edge-fade), calc(50% - 452px));
27175+
scroll-padding-inline:max(var(--empty-quick-edge-fade), calc(50% - 452px));
27176+
}
27177+
.card.layout-tablet.empty-media .empty-quick-card {
27178+
scroll-snap-align:start;
2717027179
}
2717127180
.card.radio-media .empty-quick-shelf {
2717227181
display:none !important;
@@ -34532,6 +34541,11 @@ class HomeiiMusicFlowBaseCard extends HomeiiBaseMusicCard {
3453234541
animation:none!important;
3453334542
transform:none!important;
3453434543
}
34544+
.card.performance-ultra-lite .np-sub.scroll-when-overflow.is-overflowing .scrolling-text-inner{
34545+
animation:none!important;
34546+
transform:none!important;
34547+
will-change:auto!important;
34548+
}
3453534549
.performance-profile-pills .settings-pill{
3453634550
flex:1 1 96px;
3453734551
}

src/homeii-music-flow.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11712,7 +11712,7 @@ class HomeiiBaseMusicCard extends HTMLElement {
1171211712
const el = this.$("npSub");
1171311713
if (!el) return;
1171411714
const text = String(value || "—");
11715-
const shouldScroll = !!scrollWhenOverflow && !this._isHebrew();
11715+
const shouldScroll = this._nowPlayingSubtitleShouldScroll(scrollWhenOverflow);
1171611716
const existingInner = el.querySelector?.(".scrolling-text-inner");
1171711717
const unchanged = el.dataset.homeiiSubtitleText === text
1171811718
&& el.dataset.homeiiSubtitleScroll === String(shouldScroll)
@@ -11748,6 +11748,10 @@ class HomeiiBaseMusicCard extends HTMLElement {
1174811748
if (shouldScroll) this._queueNowPlayingSubtitleOverflowSync(el);
1174911749
}
1175011750

11751+
_nowPlayingSubtitleShouldScroll(scrollWhenOverflow = false) {
11752+
return !!scrollWhenOverflow && !this._isHebrew() && !this._performanceUltraLiteEnabled();
11753+
}
11754+
1175111755
_queueNowPlayingSubtitleOverflowSync(el) {
1175211756
if (typeof requestAnimationFrame === "function") requestAnimationFrame(() => this._syncNowPlayingSubtitleOverflow(el));
1175311757
else this._syncNowPlayingSubtitleOverflow(el);
@@ -27167,6 +27171,11 @@ class HomeiiMusicFlowBaseCard extends HomeiiBaseMusicCard {
2716727171
width:min(1040px, calc(100% - clamp(320px, 24cqi, 440px)));
2716827172
margin-left:clamp(300px, 22cqi, 420px);
2716927173
margin-right:auto;
27174+
padding-inline:max(var(--empty-quick-edge-fade), calc(50% - 452px));
27175+
scroll-padding-inline:max(var(--empty-quick-edge-fade), calc(50% - 452px));
27176+
}
27177+
.card.layout-tablet.empty-media .empty-quick-card {
27178+
scroll-snap-align:start;
2717027179
}
2717127180
.card.radio-media .empty-quick-shelf {
2717227181
display:none !important;
@@ -34532,6 +34541,11 @@ class HomeiiMusicFlowBaseCard extends HomeiiBaseMusicCard {
3453234541
animation:none!important;
3453334542
transform:none!important;
3453434543
}
34544+
.card.performance-ultra-lite .np-sub.scroll-when-overflow.is-overflowing .scrolling-text-inner{
34545+
animation:none!important;
34546+
transform:none!important;
34547+
will-change:auto!important;
34548+
}
3453534549
.performance-profile-pills .settings-pill{
3453634550
flex:1 1 96px;
3453734551
}

tests/voice-assistant-matching.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,20 @@ describe("Music Assistant player filtering", () => {
100100
});
101101
});
102102

103+
describe("now playing subtitle", () => {
104+
it("disables subtitle scrolling in Ultra Lite performance mode", () => {
105+
const card = createCard();
106+
card._state.lang = "en";
107+
card._state.performanceProfile = "full";
108+
109+
expect(card._nowPlayingSubtitleShouldScroll(true)).toBe(true);
110+
111+
card._state.performanceProfile = "ultra_lite";
112+
113+
expect(card._nowPlayingSubtitleShouldScroll(true)).toBe(false);
114+
});
115+
});
116+
103117
describe("voice assistant music matching", () => {
104118
it("rejects unrelated search results instead of auto-playing by media type only", () => {
105119
const card = createCard();

0 commit comments

Comments
 (0)