/* ============================================================
unClick — Tweaks panel
Mounts the React panel (tweaks-panel.jsx) and bridges every
control to CSS custom properties / body attributes so the
vanilla page reacts live.
============================================================ */
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
"hero": "split",
"accent": ["#F37022", "#FFA640"],
"tone": "#F8F6F1",
"headline": "serif",
"motion": true
}/*EDITMODE-END*/;
function applyTweaks(t) {
const root = document.documentElement.style;
// hero direction
document.body.setAttribute("data-hero", t.hero);
// accent (pair: [warm, light])
const acc = Array.isArray(t.accent) ? t.accent : [t.accent, t.accent];
root.setProperty("--color-accent-warm", acc[0]);
root.setProperty("--color-accent-light", acc[1] || acc[0]);
// section tone
root.setProperty("--color-bg-warm", t.tone);
// headline font
root.setProperty("--font-display", t.headline === "sans"
? "'DM Sans', -apple-system, sans-serif"
: "'DM Serif Display', Georgia, serif");
// headline font is sans -> drop the italic styling (sans italic looks off): keep but lighter
document.body.classList.toggle("headline-sans", t.headline === "sans");
// motion
document.body.classList.toggle("no-motion", !t.motion);
}
function App() {
const [t, setTweak] = useTweaks(TWEAK_DEFAULTS);
React.useEffect(() => { applyTweaks(t); }, [t]);
// when hero switches, re-kick the phone animation on the now-visible phone
React.useEffect(() => {
const id = setTimeout(() => { if (window.unclick) window.unclick.remountVisible(); }, 60);
return () => clearTimeout(id);
}, [t.hero]);
return (
setTweak("hero", v)}
/>
setTweak("accent", v)}
/>
setTweak("tone", v)}
/>
setTweak("headline", v)}
/>
setTweak("motion", v)}
/>
);
}
ReactDOM.createRoot(document.getElementById("tweaks-root")).render();