@vuepress/theme-default 2.0.0-rc.77 → 2.0.0-rc.78
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.
|
@@ -2,7 +2,7 @@ import { useThemeLocaleData } from '@theme/useThemeData';
|
|
|
2
2
|
import { usePreferredDark, useStorage, watchImmediate } from '@vueuse/core';
|
|
3
3
|
import { computed, inject, onMounted, onUnmounted, provide } from 'vue';
|
|
4
4
|
export const darkModeSymbol = Symbol(__VUEPRESS_DEV__ ? 'darkMode' : '');
|
|
5
|
-
const
|
|
5
|
+
const applyDarkModeToHTML = (isDarkMode) => {
|
|
6
6
|
const update = (value = isDarkMode.value) => {
|
|
7
7
|
// set `class="dark"` on `<html>` element
|
|
8
8
|
const el = window.document.documentElement;
|
|
@@ -56,5 +56,5 @@ export const setupDarkMode = () => {
|
|
|
56
56
|
},
|
|
57
57
|
});
|
|
58
58
|
provide(darkModeSymbol, isDarkMode);
|
|
59
|
-
|
|
59
|
+
applyDarkModeToHTML(isDarkMode);
|
|
60
60
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/theme-default",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.78",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -37,20 +37,20 @@
|
|
|
37
37
|
"templates"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@vuepress/helper": "2.0.0-rc.
|
|
40
|
+
"@vuepress/helper": "2.0.0-rc.78",
|
|
41
41
|
"@vuepress/plugin-active-header-links": "2.0.0-rc.77",
|
|
42
|
-
"@vuepress/plugin-back-to-top": "2.0.0-rc.
|
|
43
|
-
"@vuepress/plugin-copy-code": "2.0.0-rc.
|
|
42
|
+
"@vuepress/plugin-back-to-top": "2.0.0-rc.78",
|
|
43
|
+
"@vuepress/plugin-copy-code": "2.0.0-rc.78",
|
|
44
44
|
"@vuepress/plugin-git": "2.0.0-rc.68",
|
|
45
|
-
"@vuepress/plugin-links-check": "2.0.0-rc.
|
|
46
|
-
"@vuepress/plugin-markdown-hint": "2.0.0-rc.
|
|
47
|
-
"@vuepress/plugin-markdown-tab": "2.0.0-rc.
|
|
48
|
-
"@vuepress/plugin-medium-zoom": "2.0.0-rc.
|
|
49
|
-
"@vuepress/plugin-nprogress": "2.0.0-rc.
|
|
50
|
-
"@vuepress/plugin-palette": "2.0.0-rc.
|
|
51
|
-
"@vuepress/plugin-prismjs": "2.0.0-rc.
|
|
52
|
-
"@vuepress/plugin-seo": "2.0.0-rc.
|
|
53
|
-
"@vuepress/plugin-sitemap": "2.0.0-rc.
|
|
45
|
+
"@vuepress/plugin-links-check": "2.0.0-rc.78",
|
|
46
|
+
"@vuepress/plugin-markdown-hint": "2.0.0-rc.78",
|
|
47
|
+
"@vuepress/plugin-markdown-tab": "2.0.0-rc.78",
|
|
48
|
+
"@vuepress/plugin-medium-zoom": "2.0.0-rc.78",
|
|
49
|
+
"@vuepress/plugin-nprogress": "2.0.0-rc.78",
|
|
50
|
+
"@vuepress/plugin-palette": "2.0.0-rc.78",
|
|
51
|
+
"@vuepress/plugin-prismjs": "2.0.0-rc.78",
|
|
52
|
+
"@vuepress/plugin-seo": "2.0.0-rc.78",
|
|
53
|
+
"@vuepress/plugin-sitemap": "2.0.0-rc.78",
|
|
54
54
|
"@vuepress/plugin-theme-data": "2.0.0-rc.77",
|
|
55
55
|
"@vueuse/core": "^12.7.0",
|
|
56
56
|
"vue": "^3.5.13"
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "90c47921feaddca96444aa12e9df0cca4df05a6b"
|
|
79
79
|
}
|
package/templates/build.html
CHANGED
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
}
|
|
20
20
|
</style>
|
|
21
21
|
<script>
|
|
22
|
-
const
|
|
23
|
-
const
|
|
22
|
+
const useChoice = localStorage.getItem('vuepress-color-scheme')
|
|
23
|
+
const systemStatus =
|
|
24
24
|
'matchMedia' in window
|
|
25
25
|
? window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
26
26
|
: false
|
|
27
27
|
|
|
28
|
-
if (
|
|
28
|
+
if (useChoice === 'light') {
|
|
29
29
|
document.documentElement.dataset.theme = 'light'
|
|
30
|
-
} else if (
|
|
30
|
+
} else if (useChoice === 'dark' || systemStatus) {
|
|
31
31
|
document.documentElement.dataset.theme = 'dark'
|
|
32
32
|
}
|
|
33
33
|
</script>
|