mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
feat(site): new home page, docs, and design system (#566)
Co-authored-by: Darius Cepulis <dcepulis@mux.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Darius Cepulis
Claude Opus 4.6
parent
f2f9e6ddc3
commit
351a3e8bda
@@ -5,29 +5,35 @@ import { THEME_KEY } from '@/consts';
|
||||
{/* Dark mode initialization script - runs before paint to prevent FOUC */}
|
||||
<script is:inline define:vars={{ localStorageKey: THEME_KEY }}>
|
||||
if (
|
||||
typeof localStorage !== 'undefined' &&
|
||||
typeof document !== 'undefined' &&
|
||||
typeof document.documentElement !== 'undefined'
|
||||
typeof localStorage !== "undefined" &&
|
||||
typeof document !== "undefined" &&
|
||||
typeof document.documentElement !== "undefined"
|
||||
) {
|
||||
let localStorageValue = localStorage[localStorageKey];
|
||||
const isValidKey = localStorageValue === 'light' || localStorageValue === 'dark' || localStorageValue === 'system';
|
||||
const isValidKey =
|
||||
localStorageValue === "light" ||
|
||||
localStorageValue === "dark" ||
|
||||
localStorageValue === "system";
|
||||
if (!localStorageValue || !isValidKey) {
|
||||
localStorage[localStorageKey] = 'system';
|
||||
localStorageValue = 'system';
|
||||
localStorage[localStorageKey] = "system";
|
||||
localStorageValue = "system";
|
||||
}
|
||||
let isDark = false;
|
||||
if (localStorageValue === 'dark') {
|
||||
document.documentElement.classList.add('dark');
|
||||
if (localStorageValue === "dark") {
|
||||
document.documentElement.classList.add("dark");
|
||||
isDark = true;
|
||||
} else if (localStorageValue === 'system') {
|
||||
if (typeof window.matchMedia !== 'undefined' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
document.documentElement.classList.add('dark');
|
||||
} else if (localStorageValue === "system") {
|
||||
if (
|
||||
typeof window.matchMedia !== "undefined" &&
|
||||
window.matchMedia("(prefers-color-scheme: dark)").matches
|
||||
) {
|
||||
document.documentElement.classList.add("dark");
|
||||
isDark = true;
|
||||
}
|
||||
}
|
||||
const themeColorMeta = document.querySelector('meta[name="theme-color"]');
|
||||
if (themeColorMeta) {
|
||||
themeColorMeta.setAttribute('content', isDark ? '#393836' : '#ebe4c1');
|
||||
themeColorMeta.setAttribute("content", isDark ? "#393836" : "#ebe4c1");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user