Polish Bento scrolling and controls with full screen coverage
This commit is contained in:
@@ -10887,6 +10887,9 @@ function isStackedPlayerLayout() {
|
||||
if (document.documentElement.dataset.layout === 'classic') {
|
||||
return getComputedStyle(document.documentElement).getPropertyValue('--classic-stacked').trim() === '1';
|
||||
}
|
||||
if (document.documentElement.dataset.layout === 'bento-hub') {
|
||||
return getComputedStyle(document.documentElement).getPropertyValue('--bento-stacked').trim() === '1';
|
||||
}
|
||||
return isPortraitPWA();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,13 @@
|
||||
const resize=new root.ResizeObserver(schedule),observer=new root.MutationObserver(schedule);
|
||||
function paint(){
|
||||
frame=0;const on=html.dataset.layout==='bento-hub';
|
||||
if(!on){if(active){resize.disconnect();observer.disconnect();html.style.removeProperty('--bento-bottom-clearance');doc.querySelectorAll('.bento-collage').forEach(n=>n.remove());}active=false;return;}
|
||||
if(!on){if(active){resize.disconnect();observer.disconnect();html.style.removeProperty('--bento-bottom-clearance');doc.querySelectorAll('.bento-collage,.bento-search-icon').forEach(n=>n.remove());doc.querySelectorAll('.bento-search-label').forEach(n=>n.replaceWith(...n.childNodes));}active=false;return;}
|
||||
if(!active){active=true;observer.observe(doc.body,{childList:true,subtree:true,attributes:true,attributeFilter:['class','hidden']});for(const id of ['bottomNav','miniBar','sectionRail']){const el=doc.getElementById(id);if(el)resize.observe(el);}}
|
||||
const search=doc.querySelector('.search-btn');
|
||||
if(search&&!search.querySelector('.bento-search-icon')){
|
||||
const label=doc.createElement('span');label.className='bento-search-label';label.append(...search.childNodes);
|
||||
const icon=doc.createElementNS('http://www.w3.org/2000/svg','svg');icon.classList.add('bento-search-icon');icon.setAttribute('aria-hidden','true');icon.setAttribute('viewBox','0 0 24 24');icon.innerHTML='<circle cx="10.5" cy="10.5" r="6.5"/><path d="m16 16 5 5"/>';search.append(label,icon);
|
||||
}
|
||||
const boxes=['bottomNav','miniBar','sectionRail'].map(id=>doc.getElementById(id)).filter(Boolean).map(el=>{const r=el.getBoundingClientRect(),s=root.getComputedStyle(el);return {top:r.top,height:r.height,fixed:s.position==='fixed',visible:s.display!=='none'&&s.visibility!=='hidden'};});
|
||||
const clearance=chromeClearance(root.innerHeight,boxes)+'px';if(html.style.getPropertyValue('--bento-bottom-clearance')!==clearance)html.style.setProperty('--bento-bottom-clearance',clearance);
|
||||
for(const card of doc.querySelectorAll('.home-pl-card')){
|
||||
|
||||
@@ -20,15 +20,17 @@
|
||||
clock:'<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>',
|
||||
shuffle:'<path d="m18 3 3 3-3 3M3 6h3c5 0 7 12 12 12h3m-3-3 3 3-3 3M3 18h3c2 0 4-3 6-6s4-6 6-6h3"/>',
|
||||
down:'<path d="m6 9 6 6 6-6"/>', right:'<path d="m9 6 6 6-6 6"/>', back:'<path d="M20 12H4m6-6-6 6 6 6"/>', more:'<circle cx="5" cy="12" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/>',
|
||||
television:'<rect x="3" y="4" width="18" height="13" rx="2"/><path d="M8 21h8m-4-4v4"/>', pin:'<path d="M9 3h6l-1 6 4 4H6l4-4zM12 13v8"/>',
|
||||
devices:'<rect x="3" y="4" width="14" height="12" rx="2"/><path d="M7 20h6M10 16v4"/><rect x="17" y="10" width="5" height="11" rx="1"/>'
|
||||
};
|
||||
const glyphs = {'+':'add','✕':'close','×':'close','✖':'close','🔍':'search','🔎':'search','⬇':'save','⤓':'save','💾':'save','▶':'play','⏸':'pause','⏭':'next','⏮':'previous','↻':'repeat','↺':'repeat','✎':'edit','✏':'edit','📝':'edit','🎤':'lyrics','↗':'share','⧉':'copy','✓':'check','📁':'folder','⚙':'settings','📋':'chapters','🕘':'clock','🔀':'shuffle','📡':'devices','▾':'down','▸':'right','←':'back','⋯':'more','⋮':'more','🗑':'trash','🎵':'music'};
|
||||
function leadingGlyph(text) {
|
||||
function leadingGlyph(text,bento=false) {
|
||||
const mapping=bento?{...glyphs,'📺':'television','⏱':'clock','⇅':'settings','📌':'pin','🎧':'music','📚':'folder'}:glyphs;
|
||||
const prefix = text.match(/^\s*/)[0], rest = text.slice(prefix.length);
|
||||
const glyph = Object.keys(glyphs).find(key => rest.startsWith(key));
|
||||
const glyph = Object.keys(mapping).find(key => rest.startsWith(key));
|
||||
if (!glyph) return null;
|
||||
const length = glyph.length + (rest[glyph.length] === '\uFE0F' ? 1 : 0);
|
||||
return { kind:glyphs[glyph], original:prefix+rest.slice(0,length), rest:rest.slice(length) };
|
||||
return { kind:mapping[glyph], original:prefix+rest.slice(0,length), rest:rest.slice(length) };
|
||||
}
|
||||
function mount(doc) {
|
||||
const decorations = new Set(), tabLabels = new Map(); let scheduled=false;
|
||||
@@ -49,11 +51,11 @@
|
||||
const active=bento || doc.documentElement.dataset.layout==='glass-stage';
|
||||
for(const [parent,record] of tabLabels)if(!active || !parent.isConnected){restoreTab(parent,record);tabLabels.delete(parent);}
|
||||
for(const record of decorations)if(!active || !record.svg.isConnected){restore(record);decorations.delete(record);}
|
||||
if(active) for(const parent of doc.querySelectorAll(selector+(bento?', .service-btn, .np-btn, .ctrl, .empty-icon, .dl-saved-cta, .brand-mark, .upnext-head button':''))) {
|
||||
if(active) for(const parent of doc.querySelectorAll(selector+(bento?', .service-btn, .np-btn, .ctrl, .empty-icon, .dl-saved-cta, .brand-mark, .upnext-head button, .ph-logo, .saved-badge':''))) {
|
||||
// Existing SVGs already express the action; only legacy glyphs change.
|
||||
if(parent.querySelector('svg:not(.glass-control-icon),.legacy-nav-icon'))continue;
|
||||
for(const node of [...parent.childNodes]) {
|
||||
if(node.nodeType!==3)continue;const match=leadingGlyph(node.textContent);if(!match)continue;
|
||||
if(node.nodeType!==3)continue;const match=leadingGlyph(node.textContent,bento);if(!match)continue;
|
||||
const icon=svg(match.kind);
|
||||
if(parent.matches('.pl-offline-badge,.home-pl-offline')) { icon.removeAttribute('aria-hidden'); icon.setAttribute('role','img'); icon.setAttribute('aria-label',parent.title || 'Available offline'); }
|
||||
const original=doc.createElement('span'); original.className='glass-original-glyph';original.textContent=match.original;
|
||||
|
||||
@@ -13,3 +13,10 @@ test('playlist trash, menu and music glyphs use drawn glass icons',()=>{
|
||||
assert.equal(leadingGlyph('⋮').kind,'more');
|
||||
assert.equal(leadingGlyph('🎵').kind,'music');
|
||||
});
|
||||
|
||||
test('Bento-only legacy icons leave the Glass glyph set unchanged',()=>{
|
||||
assert.equal(leadingGlyph('📺 Show video'),null);
|
||||
assert.deepEqual(leadingGlyph('📺 Show video',true),{kind:'television',original:'📺',rest:' Show video'});
|
||||
assert.equal(leadingGlyph('⏱ Tap-sync',true).kind,'clock');
|
||||
assert.equal(leadingGlyph('📌 Bookmark',true).kind,'pin');
|
||||
});
|
||||
|
||||
@@ -305,3 +305,59 @@ html[data-layout="bento-hub"] .body:has(.cards:is([data-view="search"],[data-vie
|
||||
html[data-layout="bento-hub"] .settings-grid { grid-template-columns:minmax(240px,.65fr) minmax(0,1.35fr); gap:24px; }
|
||||
html[data-layout="bento-hub"] .cards:is([data-view="search"],[data-view="channel"],[data-view="library"]) { grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); }
|
||||
}
|
||||
|
||||
/* Batched reference polish: one mobile scroller, generous controls, no clipping. */
|
||||
html[data-layout="bento-hub"] { --bento-stacked:0; --ease-bento:cubic-bezier(.16,1,.3,1); }
|
||||
html[data-layout="bento-hub"] button { min-width:44px; }
|
||||
html[data-layout="bento-hub"] .switch { min-height:44px; }
|
||||
html[data-layout="bento-hub"] .hero-title { background:none; -webkit-text-fill-color:var(--text); }
|
||||
html[data-layout="bento-hub"] .ph-logo { width:56px; height:56px; border-radius:16px; color:var(--on-accent); animation:none; }
|
||||
html[data-layout="bento-hub"] .player-pane.empty :is(#controls,#nowPlayingMeta,#notesPanel,.upnext) { display:none; }
|
||||
html[data-layout="bento-hub"] .body:has(.cards[data-view="settings"]) #listFilterBar { display:none; }
|
||||
html[data-layout="bento-hub"] #controls .deck-main .ctrl { border-radius:999px; }
|
||||
html[data-layout="bento-hub"] #controls input[type="range"]::-webkit-slider-thumb { border:0; box-shadow:var(--shadow-sm); }
|
||||
html[data-layout="bento-hub"] #nowPlayingMeta .np-actions :is(#addBtn,#saveBtn,#exportBtn,#serviceBtn) { border:1px solid var(--line); border-radius:10px; background:var(--bg-2); color:var(--text); box-shadow:none; min-width:44px; }
|
||||
html[data-layout="bento-hub"] #nowPlayingMeta .np-actions #saveBtn.done { color:var(--accent-sec); }
|
||||
html[data-layout="bento-hub"] .stage-lyrics { background:#05070a; }
|
||||
html[data-layout="bento-hub"] :is(.stage-lyrics,.service-lyrics) .sl-line.active { color:#00f5d4; background:rgba(0,245,212,.08); text-shadow:none; }
|
||||
html[data-layout="bento-hub"] .svc-dock { flex-wrap:wrap; gap:8px; padding:8px; }
|
||||
html[data-layout="bento-hub"] .svc-dock > :is(.svc-tile,.np-btn) { flex:1 0 96px; min-width:96px; min-height:56px; }
|
||||
html[data-layout="bento-hub"] .svc-dock > .np-btn { background:#19202d; border-color:rgba(255,255,255,.09); color:#f1f5f9; }
|
||||
html[data-layout="bento-hub"] .svc-font { flex:1 0 112px; justify-content:center; min-height:56px; }
|
||||
html[data-layout="bento-hub"] .svc-label { white-space:nowrap; }
|
||||
html[data-layout="bento-hub"] .shortcut-overlay { background:rgba(0,0,0,.75); backdrop-filter:blur(8px); }
|
||||
html[data-layout="bento-hub"] .shortcut-panel { border:1px solid var(--line); border-radius:16px; background:var(--bg-1); }
|
||||
html[data-layout="bento-hub"] .shortcut-key { border-radius:6px; background:var(--bg-2); color:var(--text); font:500 12px var(--mono); }
|
||||
html[data-layout="bento-hub"] :is(.modal-list button,.mc-row,.export-actions .btn) { min-height:44px; border-radius:10px; background:var(--bg-2); color:var(--text); border-color:var(--line); }
|
||||
html[data-layout="bento-hub"] .bento-search-label { position:absolute; width:1px; height:1px; padding:0; margin:-1px; clip-path:inset(50%); overflow:hidden; white-space:nowrap; }
|
||||
html[data-layout="bento-hub"] .bento-search-icon { display:none; width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
|
||||
html[data-layout="bento-hub"] .saved-badge .glass-control-icon { width:14px; height:14px; }
|
||||
html[data-layout="bento-hub"] .card.downloading .saved-badge::before { content:''; }
|
||||
@media(max-width:1023px) {
|
||||
html[data-layout="bento-hub"] .app { grid-template-columns:minmax(0,1fr); }
|
||||
html[data-layout="bento-hub"] .sidebar { position:fixed; inset:0 auto 0 0; width:260px; max-width:calc(100vw - 48px); z-index:350; transform:translateX(-100%); transition:transform .25s var(--ease-bento); }
|
||||
html[data-layout="bento-hub"] .app.sidebar-open .sidebar { transform:translateX(0); }
|
||||
html[data-layout="bento-hub"] .app.sidebar-open .sidebar-backdrop { display:block; opacity:1; z-index:340; }
|
||||
html[data-layout="bento-hub"] .sidebar-toggle { display:inline-flex; }
|
||||
html[data-layout="bento-hub"] .mini-bar { left:12px; }
|
||||
}
|
||||
@media(max-width:860px) {
|
||||
html[data-layout="bento-hub"] { --bento-stacked:1; }
|
||||
html[data-layout="bento-hub"] .body { flex-direction:column; overflow-y:auto; overflow-x:hidden; min-height:0; }
|
||||
html[data-layout="bento-hub"] .player-pane { flex:none; width:100%; overflow:visible; }
|
||||
html[data-layout="bento-hub"] .list-pane { flex:none!important; min-height:100%; overflow:visible; padding-bottom:16px; }
|
||||
html[data-layout="bento-hub"] .cards { flex:none; overflow:visible; }
|
||||
html[data-layout="bento-hub"] .player-pane.empty.home-playlists .player-stage { max-height:none; }
|
||||
html[data-layout="bento-hub"] .search-btn { display:grid; place-items:center; flex:0 0 44px; width:44px; min-width:44px; padding:0; border-radius:999px; }
|
||||
html[data-layout="bento-hub"] .bento-search-icon { display:block; }
|
||||
html[data-layout="bento-hub"] .search-form { min-width:0; flex:1; gap:8px; }
|
||||
html[data-layout="bento-hub"] #searchInput { min-width:0; padding-inline:12px; }
|
||||
html[data-layout="bento-hub"] .home-pl-grid { grid-template-columns:1fr; }
|
||||
}
|
||||
@media(min-width:861px) { html[data-layout="bento-hub"] .bento-search-label { position:static; width:auto; height:auto; margin:0; clip-path:none; overflow:visible; } }
|
||||
/* Bound the scroll viewport above floating chrome, rather than painting rows
|
||||
underneath it and relying only on extra padding at the end of the list. */
|
||||
html[data-layout="bento-hub"] .main { padding-bottom:var(--bento-bottom-clearance,16px); min-height:0; }
|
||||
html[data-layout="bento-hub"] :is(.body,.player-pane,.cards) { padding-bottom:16px; }
|
||||
html[data-layout="bento-hub"] .modal-backdrop { z-index:600; }
|
||||
html[data-layout="bento-hub"] .shortcut-overlay { z-index:600; }
|
||||
|
||||
Reference in New Issue
Block a user