The Core component wich applies classes and transitions.
Cookies are set only if corresponding ServerTarget is detected.
Example
<Core[t="background-color.3s"]/>
Source
Source code
exportconstCore = ({ t = "none", nonce = "", k = "o" }: CoreProps) => { constisWindowDefined = typeofwindow != "undefined"; // handle client side exceptions when script is not run. <- for client side apps like vite or CRA if (isWindowDefined && !window.q) noFOUCScript(k, t, nonce);
const [{ m, s }, setThemeState] = useStore();
if (!updateDOM && isWindowDefined) { // store global functions to local variables to avoid any interference [media, updateDOM] = [q, 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.newValueasColorSchemePreference })); }); } updateDOM?.(m, s);
The Core component wich applies classes and transitions. Cookies are set only if corresponding ServerTarget is detected.
Example
Source