diff --git a/docs/functions/client_core_core.Core.html b/docs/functions/client_core_core.Core.html index 3f895167..1d502db6 100644 --- a/docs/functions/client_core_core.Core.html +++ b/docs/functions/client_core_core.Core.html @@ -9,4 +9,4 @@
export const Core = ({ t, nonce, k = "o" }: CoreProps) => {
// handle client side exceptions when script is not run. <- for client side apps like vite or CRA
if (typeof window !== "undefined" && !window.m) noFOUCScript(k);
const [{ m: mode, s: systemMode }, setThemeState] = useStore();
useEffect(() => {
// store global functions to local variables to avoid any interference
[media, updateDOM] = [m, u];
/** Updating media: prefers-color-scheme*/
media.addEventListener("change", () =>
setThemeState(state => ({ ...state, s: media.matches ? DARK : LIGHT })),
);
/** Sync the tabs */
addEventListener("storage", (e: StorageEvent): void => {
e.key === k && setThemeState(state => ({ ...state, m: e.newValue as ColorSchemePreference }));
});
}, []);
useEffect(() => {
const restoreTransitions = modifyTransition(t, nonce);
updateDOM(mode, systemMode);
restoreTransitions();
}, [systemMode, mode, t, nonce]);
return <Script {...{ n: nonce, k }} />;
};
-