/* ============================================================ Albert Lorenzo — Tweaks panel (variations to compare) Applies to the vanilla page via CSS variables + data attrs. ============================================================ */ const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{ "accent": ["#2b59c3", "#2348a0"], "headingFont": "serif", "heroLayout": "split", "heroDim": "medio", "effects": true }/*EDITMODE-END*/; const HERO_DIM = { suave: 0.06, medio: 0.18, alto: 0.34 }; function applyTweaks(t) { const root = document.documentElement; if (Array.isArray(t.accent)) { root.style.setProperty('--accent', t.accent[0]); root.style.setProperty('--accent-600', t.accent[1] || t.accent[0]); } root.style.setProperty('--display', t.headingFont === 'sans' ? 'var(--sans)' : 'var(--serif)'); document.body.setAttribute('data-hero', t.heroLayout); root.style.setProperty('--hero-dim', String(HERO_DIM[t.heroDim] != null ? HERO_DIM[t.heroDim] : 0.18)); root.style.setProperty('--fx', t.effects ? '1' : '0'); document.body.setAttribute('data-fx', t.effects ? 'on' : 'off'); } function TweaksApp() { const [t, setTweak] = useTweaks(TWEAK_DEFAULTS); React.useEffect(() => { applyTweaks(t); }, [t]); return ( setTweak('accent', v)} /> setTweak('headingFont', v)} /> setTweak('heroLayout', v)} /> setTweak('heroDim', v)} /> setTweak('effects', v)} /> ); } // Apply defaults immediately (the host rewrites this block on disk when tweaked, // so TWEAK_DEFAULTS already reflects the saved state on reload). applyTweaks(TWEAK_DEFAULTS); ReactDOM.createRoot(document.getElementById('tweaks-root')).render();