// Accessibility.jsx — ГОСТ Р 52872-2019 compliant a11y panel + state const A11Y_DEFAULTS = { font: 'md', // sm | md | lg | xl color: 'bw', // bw (black on white) | wb (white on black) | bg (black on beige) | bs (light-blue on dark-blue) family: 'serif', // serif | sans kerning: 'normal',// normal | wide images: 'on', // on | off }; function useA11y() { const [s, setS] = React.useState(() => { try { const stored = localStorage.getItem('a11y_v1'); if (stored) return { ...A11Y_DEFAULTS, ...JSON.parse(stored) }; } catch (e) {} return A11Y_DEFAULTS; }); const setOne = (k, v) => setS(p => ({ ...p, [k]: v })); React.useEffect(() => { try { localStorage.setItem('a11y_v1', JSON.stringify(s)); } catch (e) {} }, [s]); return [s, setOne, setS]; } function applyA11y(active, s) { const html = document.documentElement; if (active) { html.setAttribute('data-acc', '1'); html.setAttribute('data-acc-font', s.font); html.setAttribute('data-acc-color', s.color); html.setAttribute('data-acc-family', s.family); html.setAttribute('data-acc-kerning', s.kerning); html.setAttribute('data-acc-images', s.images); } else { html.removeAttribute('data-acc'); html.removeAttribute('data-acc-font'); html.removeAttribute('data-acc-color'); html.removeAttribute('data-acc-family'); html.removeAttribute('data-acc-kerning'); html.removeAttribute('data-acc-images'); } } function A11yBar({ open, settings, setOne, onClose }) { if (!open) return null; const Group = ({ label, children }) => (
{label}
{children}
); const Opt = ({ k, v, label, title, style }) => ( ); return (
); } Object.assign(window, { useA11y, applyA11y, A11yBar, A11Y_DEFAULTS });