bookish-press 0.4.22 → 0.4.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -32,12 +32,14 @@ let darkMode = writable(typeof localStorage !== 'undefined' &&
|
|
|
32
32
|
setContext(DARK_MODE, darkMode);
|
|
33
33
|
// When dark mode changes, update the body's class list.
|
|
34
34
|
$: {
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
if (typeof document !== undefined) {
|
|
36
|
+
if ($darkMode)
|
|
37
|
+
document.body.classList.add('dark');
|
|
38
|
+
else
|
|
39
|
+
document.body.classList.remove('dark');
|
|
40
|
+
if (typeof localStorage !== 'undefined')
|
|
41
|
+
localStorage.setItem('dark', $darkMode ? 'true' : 'false');
|
|
42
|
+
}
|
|
41
43
|
}
|
|
42
44
|
// Redirect old hash routes by simply replacing their hash before routing.
|
|
43
45
|
if (typeof window !== 'undefined' && window.location.hash.startsWith('#/'))
|