/* ============================================================ KUSHAEV — Tweaks island ============================================================ */ const { useEffect } = React; const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{ "theme": "dark", "accent": "#cfd4d8", "headline": "Архитектор", "diagonal": 58, "motion": 1, "pairing": "Golos" }/*EDITMODE-END*/; const HEADLINES = { "Архитектор": `Архитектор
бизнес-решений`, "Преимущество": `Системы, что
создают
преимущество`, "Founder": `Founder.
Инженер.
Стратег.` }; const PAIRINGS = { "Manrope": { display: '"Manrope", system-ui, sans-serif', body: '"Manrope", system-ui, sans-serif' }, "Golos": { display: '"Golos Text", system-ui, sans-serif', body: '"Golos Text", system-ui, sans-serif' } }; function hexToRgba(hex, a) { const h = hex.replace('#', ''); const n = parseInt(h.length === 3 ? h.split('').map(c => c + c).join('') : h, 16); const r = (n >> 16) & 255, g = (n >> 8) & 255, b = n & 255; return `rgba(${r},${g},${b},${a})`; } function App() { const [t, setTweak] = useTweaks(TWEAK_DEFAULTS); // theme useEffect(() => { document.documentElement.setAttribute('data-theme', t.theme); }, [t.theme]); // accent useEffect(() => { const r = document.documentElement.style; r.setProperty('--accent', t.accent); r.setProperty('--accent-soft', hexToRgba(t.accent, 0.16)); r.setProperty('--accent-line', hexToRgba(t.accent, 0.32)); }, [t.accent]); // headline copy useEffect(() => { const h = document.querySelector('.content-chapter[data-ch="0"] .headline'); if (h && HEADLINES[t.headline]) h.innerHTML = HEADLINES[t.headline]; }, [t.headline]); // diagonal geometry useEffect(() => { const top = (22 + (t.diagonal / 100) * 24); // 22 → 46 % const bot = (4 + (t.diagonal / 100) * 18); // 4 → 22 % ['visual', 'visualFrame'].forEach(id => { const el = document.getElementById(id); if (el) { el.style.setProperty('--cut-top', top + '%'); el.style.setProperty('--cut-bot', bot + '%'); } }); const ln = document.querySelector('#diagLine line'); if (ln) { ln.setAttribute('x1', top); ln.setAttribute('x2', bot); } }, [t.diagonal]); // motion useEffect(() => { window.__kuMotion = t.motion; }, [t.motion]); // font pairing useEffect(() => { const p = PAIRINGS[t.pairing] || PAIRINGS.Manrope; document.documentElement.style.setProperty('--font-display', p.display); document.documentElement.style.setProperty('--font-body', p.body); }, [t.pairing]); return ( setTweak('theme', v)} /> setTweak('accent', v)} /> setTweak('headline', v)} /> setTweak('diagonal', v)} /> setTweak('motion', v)} /> setTweak('pairing', v)} /> ); } ReactDOM.createRoot(document.getElementById('tweaks-root')).render();