Load layouts and optional features from staged asset caches

This commit is contained in:
Jonathan Sykes
2026-10-08 01:29:50 +08:00
parent d98d444552
commit 5d6a1545df
30 changed files with 512 additions and 146 deletions

View File

@@ -45,14 +45,23 @@
const text = document.createElement('span'), title = document.createElement('b'), summary = document.createElement('small'); title.textContent = section.title; text.append(title, summary); button.append(text);
button.setAttribute('aria-controls', 'settings-section-' + section.id); navigation.append(button); rows.set(section.id, { button, summary });
const panel = document.createElement('section'); panel.id = 'settings-section-' + section.id; panel.className = 'settings-section'; panel.setAttribute('aria-label', section.title); panels.set(section.id, panel); detail.append(panel);
const cleanup = section.render(panel, context); if (typeof cleanup === 'function') cleanups.push(cleanup);
if (!section.lazyGroup) {
const cleanup = section.render(panel, context); if (typeof cleanup === 'function') cleanups.push(cleanup);
}
button.addEventListener('click', () => open(section.id));
if(section.lazyGroup)root.Lazy.intent(button,section.lazyGroup);
}
}
grid.append(navigation, detail); host.replaceChildren(toolbar, results, empty, grid);
function summaries() { for (const section of sections) { try { rows.get(section.id).summary.textContent = section.summary(context) || ''; } catch {} } }
function show(id, inDetail, focusId) {
if (registry.get(id)) active = id;
const section = sections.find(section => section.id === active);
const panel = panels.get(active);
if ((inDetail || win.matchMedia?.('(min-width: 861px)').matches) && section?.lazyGroup && !panel.dataset.rendered) {
panel.dataset.rendered = '1';
const cleanup = section.render(panel, context); if (typeof cleanup === 'function') cleanups.push(cleanup);
}
host.dataset.detail = inDetail ? '1' : '0';
for (const [key, panel] of panels) panel.hidden = key !== active;
for (const [key, row] of rows) row.button.setAttribute('aria-current', key === active ? 'true' : 'false');