The Core component wich applies classes and transitions. Cookies are set only if corresponding ServerTarget is detected.

<Core [t="background-color .3s"]/>
  • Source code
export const Core = ({ t = "none", nonce = "", k = "o" }: CoreProps) => {
const isWindowDefined = typeof window != "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.newValue as ColorSchemePreference }));
});
}
updateDOM?.(m, s);

return <Script {...{ n: nonce, k, t }} />;
};