// athena_mount.jsx — monta o AthenaChat no DOM, escutando mudanças de tweak
// Replica as paletas (lightweight) do redesign_app para standalone mount
const ATHENA_PALETTES = {
greek: {
bg: '#F7F3EC', bgAlt: '#EFE8DB', ink: '#0B2E55',
accent: '#0D5EAF', gold: '#B8892B', goldLight: '#D4A84B',
rule: 'rgba(11,46,85,0.14)', muted: '#57524A',
},
ink: {
bg: '#F5F1EA', bgAlt: '#ECE5D8', ink: '#1A2238',
accent: '#3B4771', gold: '#A07C2E', goldLight: '#C9A34E',
rule: 'rgba(26,34,56,0.14)', muted: '#5A5548',
},
night: {
bg: '#0E0E10', bgAlt: '#16161A', ink: '#F2ECDF',
accent: '#D4A84B', gold: '#C9A34E', goldLight: '#E3C77A',
rule: 'rgba(242,236,223,0.12)', muted: '#8F8A80',
},
};
const ATHENA_SERIF_FAMILIES = {
cormorant: '"Cormorant Garamond", Georgia, serif',
instrument: '"Instrument Serif", Georgia, serif',
};
function AthenaMount() {
const initial = (typeof window.__getTweaks === 'function') ? window.__getTweaks() : { palette: 'greek', serif: 'cormorant' };
const [tweaks, setTweaks] = React.useState(initial);
React.useEffect(() => {
const handler = (e) => setTweaks({ ...e.detail });
window.addEventListener('tweak-change', handler);
return () => window.removeEventListener('tweak-change', handler);
}, []);
const palette = ATHENA_PALETTES[tweaks.palette] || ATHENA_PALETTES.greek;
const serifFamily = ATHENA_SERIF_FAMILIES[tweaks.serif] || ATHENA_SERIF_FAMILIES.cormorant;
return ;
}
// Montar quando o DOM estiver pronto
(function mountAthena() {
const el = document.getElementById('athena-root');
if (!el) {
window.addEventListener('DOMContentLoaded', mountAthena);
return;
}
if (!window.AthenaChat) {
// aguarda athena.jsx transpile
setTimeout(mountAthena, 100);
return;
}
const root = ReactDOM.createRoot(el);
root.render();
})();