/* =====================================================================
自由IT同盟 — Landing page Tweaks
Maps panel state → #lp-root CSS vars / data-* attributes
===================================================================== */
const { useTweaks, TweaksPanel, TweakSection, TweakRadio, TweakToggle, TweakColor } = window;
const LP_DEFAULTS = /*EDITMODE-BEGIN*/{
"accent": "#4f46e5",
"motif": "none",
"glow": true,
"mark": true,
"cards": "plain"
}/*EDITMODE-END*/;
// accent hex → derive ink/soft/line via oklch-ish tints in CSS using color-mix on the hex
function applyAccent(root, hex) {
root.style.setProperty('--acc', hex);
root.style.setProperty('--acc-ink', `color-mix(in oklch, ${hex} 82%, black)`);
root.style.setProperty('--acc-soft', `color-mix(in oklch, ${hex} 12%, white)`);
root.style.setProperty('--acc-line', `color-mix(in oklch, ${hex} 32%, white)`);
}
function LandingTweaks() {
const [t, setTweak] = useTweaks(LP_DEFAULTS);
const root = document.getElementById('lp-root');
React.useEffect(() => {
if (!root) return;
applyAccent(root, t.accent);
root.dataset.motif = t.motif;
root.dataset.glow = t.glow ? 'on' : 'off';
root.dataset.mark = t.mark ? 'on' : 'off';
root.dataset.cards = t.cards;
}, [t]);
return (
setTweak('accent', v)} />
setTweak('motif', v)} />
setTweak('glow', v)} />
setTweak('mark', v)} />
setTweak('cards', v)} />
);
}
ReactDOM.createRoot(document.getElementById('tweaks-root')).render();