Refactor architecture into eight components and consolidate reliability work
Extract Grammaratur, Dregarnuhr, Geduldh, Mestionora, Ordoschnellic, Schutzaria, Kunstzeal and Seheweit behind compatible application contracts. Include accumulated editor resilience, navigation and theme UX, remote CLI, storage/schema and DR groundwork, tests and design/operations documentation. Verified: uncached full Go suite; go vet ./...; race tests for all eight components; 11 targeted Chromium tests; Node suites; 19 Python CLI tests; reproducible editor build. No push, release tag or deployment in this checkpoint.
This commit is contained in:
1 parent
9dd425f765
commit
d5d21b7841
302 files changed
+20037
-3492
No files matched your search
@@ -0,0 +1,37 @@
|
||||
(() => {
|
||||
const picker = document.querySelector('[data-theme-picker]');
|
||||
if (!picker) return;
|
||||
const select = picker.querySelector('[data-theme-select]');
|
||||
const status = picker.querySelector('[data-theme-status]');
|
||||
const themeLink = [...document.querySelectorAll('link[rel="stylesheet"]')]
|
||||
.find(link => link.getAttribute('href') === picker.dataset.currentCss);
|
||||
if (!themeLink) { picker.hidden = true; return; }
|
||||
let current = picker.dataset.currentId;
|
||||
select.addEventListener('change', () => {
|
||||
const option = select.selectedOptions[0];
|
||||
const candidate = document.createElement('link');
|
||||
candidate.rel = 'stylesheet';
|
||||
candidate.href = option.dataset.css;
|
||||
select.disabled = true;
|
||||
status.textContent = '';
|
||||
// Load before replacing, so failure cannot leave an unstyled page. Keeping
|
||||
// the link's position preserves editor/component overrides and avoids reload.
|
||||
candidate.media = 'not all';
|
||||
candidate.onload = () => {
|
||||
themeLink.href = candidate.href;
|
||||
candidate.remove();
|
||||
current = option.value;
|
||||
const secure = location.protocol === 'https:' ? '; Secure' : '';
|
||||
document.cookie = 'pageswiki_theme=' + encodeURIComponent(current) + '; Path=/; SameSite=Lax; Max-Age=' + (current ? 31536000 : 0) + secure;
|
||||
select.disabled = false;
|
||||
document.dispatchEvent(new Event('pageswiki:theme'));
|
||||
};
|
||||
candidate.onerror = () => {
|
||||
candidate.remove(); select.value = current; select.disabled = false;
|
||||
status.textContent = picker.dataset.failed;
|
||||
};
|
||||
document.head.append(candidate);
|
||||
});
|
||||
document.addEventListener('pointerdown', event => { if (!picker.contains(event.target)) picker.open = false; });
|
||||
picker.addEventListener('keydown', event => { if (event.key === 'Escape') { picker.open = false; picker.querySelector('summary').focus(); } });
|
||||
})();
|
||||
Reference in new issue
Block a user