mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 08:21:39 -06:00
c544a28e77
Remove AppHeader. The sidebar gains a Search row that opens a Cmd+K palette (books, authors, series, places, settings pages and actions), a utility dock above the footer, and a Reading group below the lists. Every page opens with a shared PageTitleRow; phones without one get a slim bar. Settings headers gain a full description, and the top glow defaults to 50% with one reach and strength for every style. The Appearance panel opens past the sidebar, reorders its controls and names the current pick, and keeps each pastel accent under its vivid one.
44 lines
1.9 KiB
JavaScript
44 lines
1.9 KiB
JavaScript
;(function () {
|
|
function readStoredValue(key, fallback) {
|
|
var stored = localStorage.getItem(key)
|
|
if (stored === null) return fallback
|
|
var value = stored
|
|
try {
|
|
value = JSON.parse(stored)
|
|
} catch {
|
|
value = stored
|
|
}
|
|
return typeof value === 'string' ? value : fallback
|
|
}
|
|
|
|
// Mirrors STANDALONE_ROUTE_PREFIXES in src/lib/theme-styles.ts; theme-init.spec.ts keeps them equal.
|
|
var STANDALONE_ROUTE_PREFIXES = ['/read/', '/login', '/register', '/setup', '/forgot-password', '/reset-password', '/oauth2-callback', '/magic']
|
|
|
|
function isAppShellPath(path) {
|
|
for (var i = 0; i < STANDALONE_ROUTE_PREFIXES.length; i++) {
|
|
var prefix = STANDALONE_ROUTE_PREFIXES[i]
|
|
if (path === prefix || path.indexOf(prefix.charAt(prefix.length - 1) === '/' ? prefix : prefix + '/') === 0) return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
var root = document.documentElement
|
|
var theme = readStoredValue('theme', 'system')
|
|
var accent = readStoredValue('accent', 'blue')
|
|
var radius = readStoredValue('radius', 'default')
|
|
var style = readStoredValue('style', 'bookorbit')
|
|
var surfacePalette = readStoredValue('surfacePalette', 'steel')
|
|
var rawReach = localStorage.getItem('glowReach')
|
|
var storedReach = rawReach === null ? 50 : Number(rawReach)
|
|
var glowReach = isFinite(storedReach) ? Math.min(200, Math.max(0, storedReach)) : 50
|
|
var systemDark = typeof window.matchMedia === 'function' && window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
var isDark = theme === 'dark' || (theme !== 'light' && systemDark)
|
|
if (isDark) root.classList.add('dark')
|
|
root.classList.add('accent-' + accent)
|
|
if (radius !== 'default') root.classList.add('radius-' + radius)
|
|
root.setAttribute('data-style', isAppShellPath(window.location.pathname) ? style : 'bookorbit')
|
|
root.setAttribute('data-surface', surfacePalette)
|
|
root.style.setProperty('--glow-reach', String(glowReach / 100))
|
|
root.setAttribute('data-glow', glowReach > 0 ? 'on' : 'off')
|
|
})()
|