/* Tweaks panel wiring. */ const { useEffect: useTE } = React; const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{ "theme": "dark", "density": "comfortable", "fontPair": "garamond", "showFlavor": true, "showDetriments": true, "predatorPrey": false, "plainReadings": false }/*EDITMODE-END*/; const FONT_PAIRS = { garamond: { display: "'Cormorant Garamond', serif", body: "'Crimson Pro', serif" }, spectral: { display: "'Spectral', serif", body: "'Spectral', serif" }, cinzel: { display: "'Cinzel', serif", body: "'EB Garamond', serif" }, uncial: { display: "'Uncial Antiqua', serif", body: "'EB Garamond', serif" }, }; const TweaksWiring = ({ tweaks, setTweaks }) => { // Apply theme + density + fonts to root useTE(() => { document.documentElement.dataset.theme = tweaks.theme; document.documentElement.dataset.density = tweaks.density; const pair = FONT_PAIRS[tweaks.fontPair] || FONT_PAIRS.garamond; document.documentElement.style.setProperty("--serif-display", pair.display); document.documentElement.style.setProperty("--serif-body", pair.body); }, [tweaks.theme, tweaks.density, tweaks.fontPair]); return ( setTweaks({ theme: v })} options={[{value:"parchment", label:"Parchment"}, {value:"dark", label:"Candlelit"}, {value:"blood", label:"Blood-warm"}]} /> setTweaks({ density: v })} options={[{value:"comfortable", label:"Comfortable"}, {value:"compact", label:"Compact"}]} /> setTweaks({ fontPair: v })} options={[ {value:"garamond", label:"Cormorant + Crimson"}, {value:"spectral", label:"Spectral throughout"}, {value:"cinzel", label:"Cinzel + Garamond"}, {value:"uncial", label:"Uncial + Garamond"}, ]} /> setTweaks({ showFlavor: v })} /> setTweaks({ showDetriments: v })} /> setTweaks({ predatorPrey: v })} /> setTweaks({ plainReadings: v })} /> ); }; window.TweakDefaults = TWEAK_DEFAULTS; window.TweaksWiring = TweaksWiring;