/* APP — orchestrator, tweaks, variant switcher */
const DEFAULTS = /*EDITMODE-BEGIN*/{
"accent": "#ff3d00",
"typeScale": "archivo",
"animIntensity": "max"
}/*EDITMODE-END*/;
const ACCENTS_MONOLITH = [
{ name:'Orange', v:'#ff3d00' },
{ name:'Lime', v:'#d4ff3a' },
{ name:'Cyan', v:'#06d4ff' },
{ name:'Pink', v:'#ff3a8a' },
{ name:'Yellow', v:'#fde047' },
{ name:'White', v:'#ffffff' },
];
function GlobalStyles() {
return (
);
}
function ScrollProgress({ color }) {
const { y } = useScroll();
const [p, setP] = useState(0);
useEffect(() => {
const total = document.body.scrollHeight - window.innerHeight;
setP(total > 0 ? y/total : 0);
}, [y]);
return (
);
}
function Nav({ variant, setVariant }) {
const { y, dir } = useScroll();
const hidden = y > 200 && dir === 'down';
return (
);
}
function App() {
const [accent, setAccent] = usePersisted('kern.accent.v2', DEFAULTS.accent);
const setVariant = () => {};
const [typeScale, setTypeScale] = usePersisted('kern.type.v2', DEFAULTS.typeScale);
const [animIntensity, setAnimIntensity] = usePersisted('kern.anim', DEFAULTS.animIntensity);
const [tweaksOpen, setTweaksOpen] = useState(false);
// Tweaks protocol
useEffect(() => {
const onMsg = (e) => {
if (e.data?.type === '__activate_edit_mode') setTweaksOpen(true);
if (e.data?.type === '__deactivate_edit_mode') setTweaksOpen(false);
};
window.addEventListener('message', onMsg);
try { window.parent.postMessage({ type: '__edit_mode_available' }, '*'); } catch {}
return () => window.removeEventListener('message', onMsg);
}, []);
const persist = useCallback((edits) => {
try { window.parent.postMessage({ type:'__edit_mode_set_keys', edits }, '*'); } catch {}
}, []);
const accentColors = ACCENTS_MONOLITH;
// type families
const bodyFont = typeScale === 'archivo' ? 'Inter,system-ui,sans-serif' :
typeScale === 'space' ? 'Space Grotesk,sans-serif' :
'Inter,system-ui,sans-serif';
useEffect(() => { document.body.style.fontFamily = bodyFont; }, [bodyFont]);
return (
<>