@vuepress/theme-default 2.0.0-beta.23 → 2.0.0-beta.27
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.
- package/lib/client/clientAppEnhance.js +1 -1
- package/lib/client/clientAppSetup.js +4 -9
- package/lib/client/components/DropdownLink.vue +83 -98
- package/lib/client/components/DropdownTransition.vue +8 -21
- package/lib/client/components/Home.vue +52 -75
- package/lib/client/components/NavLink.vue +71 -83
- package/lib/client/components/Navbar.vue +18 -9
- package/lib/client/components/NavbarLinks.vue +13 -29
- package/lib/client/components/Page.vue +1 -11
- package/lib/client/components/PageMeta.vue +10 -26
- package/lib/client/components/PageNav.vue +19 -34
- package/lib/client/components/Sidebar.vue +2 -17
- package/lib/client/components/ToggleDarkModeButton.vue +2 -9
- package/lib/client/components/ToggleSidebarButton.vue +17 -19
- package/lib/client/components/global/Badge.vue +16 -22
- package/lib/client/components/global/CodeGroup.js +8 -3
- package/lib/client/components/global/CodeGroupItem.vue +13 -11
- package/lib/client/components/global/OutboundLink.vue +4 -19
- package/lib/client/composables/index.d.ts +0 -2
- package/lib/client/composables/index.js +0 -2
- package/lib/client/composables/useDarkMode.d.ts +12 -2
- package/lib/client/composables/useDarkMode.js +57 -3
- package/lib/client/composables/useResolveRouteWithRedirect.js +1 -1
- package/lib/client/composables/useSidebarItems.d.ts +6 -2
- package/lib/client/composables/useSidebarItems.js +13 -4
- package/lib/client/index.d.ts +1 -1
- package/lib/client/layouts/404.vue +8 -21
- package/lib/client/layouts/Layout.vue +76 -106
- package/lib/client/styles/badge.scss +1 -3
- package/lib/client/styles/code.scss +1 -0
- package/lib/client/styles/custom-container.scss +2 -4
- package/lib/client/styles/home.scss +10 -7
- package/lib/client/styles/layout.scss +24 -3
- package/lib/client/styles/navbar.scss +18 -2
- package/lib/client/styles/normalize.scss +3 -3
- package/lib/client/styles/page.scss +1 -1
- package/lib/client/styles/sidebar.scss +1 -1
- package/lib/client/styles/vars.scss +4 -0
- package/lib/client/utils/resolveEditLink.js +1 -1
- package/lib/node/defaultTheme.js +10 -10
- package/lib/node/utils/assignDefaultLocaleOptions.js +1 -0
- package/lib/node/utils/resolveContainerPluginOptions.d.ts +1 -1
- package/lib/node/utils/resolveGitPluginOptions.d.ts +1 -1
- package/lib/shared/options.d.ts +11 -1
- package/lib/shared/page.d.ts +1 -0
- package/package.json +20 -19
- package/lib/client/composables/useHtmlDarkClass.d.ts +0 -2
- package/lib/client/composables/useHtmlDarkClass.js +0 -14
- package/lib/client/composables/usePrefersColorScheme.d.ts +0 -2
- package/lib/client/composables/usePrefersColorScheme.js +0 -18
|
@@ -5,25 +5,29 @@
|
|
|
5
5
|
@touchstart="onTouchStart"
|
|
6
6
|
@touchend="onTouchEnd"
|
|
7
7
|
>
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
<slot name="navbar">
|
|
9
|
+
<Navbar v-if="shouldShowNavbar" @toggle-sidebar="toggleSidebar">
|
|
10
|
+
<template #before>
|
|
11
|
+
<slot name="navbar-before" />
|
|
12
|
+
</template>
|
|
13
|
+
<template #after>
|
|
14
|
+
<slot name="navbar-after" />
|
|
15
|
+
</template>
|
|
16
|
+
</Navbar>
|
|
17
|
+
</slot>
|
|
16
18
|
|
|
17
19
|
<div class="sidebar-mask" @click="toggleSidebar(false)" />
|
|
18
20
|
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
<slot name="sidebar">
|
|
22
|
+
<Sidebar>
|
|
23
|
+
<template #top>
|
|
24
|
+
<slot name="sidebar-top" />
|
|
25
|
+
</template>
|
|
26
|
+
<template #bottom>
|
|
27
|
+
<slot name="sidebar-bottom" />
|
|
28
|
+
</template>
|
|
29
|
+
</Sidebar>
|
|
30
|
+
</slot>
|
|
27
31
|
|
|
28
32
|
<slot name="page">
|
|
29
33
|
<Home v-if="frontmatter.home" />
|
|
@@ -48,21 +52,14 @@
|
|
|
48
52
|
</div>
|
|
49
53
|
</template>
|
|
50
54
|
|
|
51
|
-
<script lang="ts">
|
|
52
|
-
import {
|
|
53
|
-
computed,
|
|
54
|
-
defineComponent,
|
|
55
|
-
onMounted,
|
|
56
|
-
onUnmounted,
|
|
57
|
-
ref,
|
|
58
|
-
Transition,
|
|
59
|
-
} from 'vue'
|
|
60
|
-
import { useRouter } from 'vue-router'
|
|
55
|
+
<script setup lang="ts">
|
|
61
56
|
import { usePageData, usePageFrontmatter } from '@vuepress/client'
|
|
57
|
+
import { computed, onMounted, onUnmounted, ref, Transition } from 'vue'
|
|
58
|
+
import { useRouter } from 'vue-router'
|
|
62
59
|
import type { DefaultThemePageFrontmatter } from '../../shared'
|
|
63
60
|
import Home from '../components/Home.vue'
|
|
64
|
-
import Page from '../components/Page.vue'
|
|
65
61
|
import Navbar from '../components/Navbar.vue'
|
|
62
|
+
import Page from '../components/Page.vue'
|
|
66
63
|
import Sidebar from '../components/Sidebar.vue'
|
|
67
64
|
import {
|
|
68
65
|
useScrollPromise,
|
|
@@ -70,89 +67,62 @@ import {
|
|
|
70
67
|
useThemeLocaleData,
|
|
71
68
|
} from '../composables'
|
|
72
69
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
components: {
|
|
77
|
-
Home,
|
|
78
|
-
Page,
|
|
79
|
-
Navbar,
|
|
80
|
-
Sidebar,
|
|
81
|
-
Transition,
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
setup() {
|
|
85
|
-
const page = usePageData()
|
|
86
|
-
const frontmatter = usePageFrontmatter<DefaultThemePageFrontmatter>()
|
|
87
|
-
const themeLocale = useThemeLocaleData()
|
|
70
|
+
const page = usePageData()
|
|
71
|
+
const frontmatter = usePageFrontmatter<DefaultThemePageFrontmatter>()
|
|
72
|
+
const themeLocale = useThemeLocaleData()
|
|
88
73
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
)
|
|
74
|
+
// navbar
|
|
75
|
+
const shouldShowNavbar = computed(
|
|
76
|
+
() => frontmatter.value.navbar !== false && themeLocale.value.navbar !== false
|
|
77
|
+
)
|
|
94
78
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
79
|
+
// sidebar
|
|
80
|
+
const sidebarItems = useSidebarItems()
|
|
81
|
+
const isSidebarOpen = ref(false)
|
|
82
|
+
const toggleSidebar = (to?: boolean): void => {
|
|
83
|
+
isSidebarOpen.value = typeof to === 'boolean' ? to : !isSidebarOpen.value
|
|
84
|
+
}
|
|
85
|
+
const touchStart = { x: 0, y: 0 }
|
|
86
|
+
const onTouchStart = (e): void => {
|
|
87
|
+
touchStart.x = e.changedTouches[0].clientX
|
|
88
|
+
touchStart.y = e.changedTouches[0].clientY
|
|
89
|
+
}
|
|
90
|
+
const onTouchEnd = (e): void => {
|
|
91
|
+
const dx = e.changedTouches[0].clientX - touchStart.x
|
|
92
|
+
const dy = e.changedTouches[0].clientY - touchStart.y
|
|
93
|
+
if (Math.abs(dx) > Math.abs(dy) && Math.abs(dx) > 40) {
|
|
94
|
+
if (dx > 0 && touchStart.x <= 80) {
|
|
95
|
+
toggleSidebar(true)
|
|
96
|
+
} else {
|
|
97
|
+
toggleSidebar(false)
|
|
100
98
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
touchStart.x = e.changedTouches[0].clientX
|
|
104
|
-
touchStart.y = e.changedTouches[0].clientY
|
|
105
|
-
}
|
|
106
|
-
const onTouchEnd = (e): void => {
|
|
107
|
-
const dx = e.changedTouches[0].clientX - touchStart.x
|
|
108
|
-
const dy = e.changedTouches[0].clientY - touchStart.y
|
|
109
|
-
if (Math.abs(dx) > Math.abs(dy) && Math.abs(dx) > 40) {
|
|
110
|
-
if (dx > 0 && touchStart.x <= 80) {
|
|
111
|
-
toggleSidebar(true)
|
|
112
|
-
} else {
|
|
113
|
-
toggleSidebar(false)
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// classes
|
|
119
|
-
const containerClass = computed(() => [
|
|
120
|
-
{
|
|
121
|
-
'no-navbar': !shouldShowNavbar.value,
|
|
122
|
-
'no-sidebar': !sidebarItems.value.length,
|
|
123
|
-
'sidebar-open': isSidebarOpen.value,
|
|
124
|
-
},
|
|
125
|
-
frontmatter.value.pageClass,
|
|
126
|
-
])
|
|
127
|
-
|
|
128
|
-
// close sidebar after navigation
|
|
129
|
-
let unregisterRouterHook
|
|
130
|
-
onMounted(() => {
|
|
131
|
-
const router = useRouter()
|
|
132
|
-
unregisterRouterHook = router.afterEach(() => {
|
|
133
|
-
toggleSidebar(false)
|
|
134
|
-
})
|
|
135
|
-
})
|
|
136
|
-
onUnmounted(() => {
|
|
137
|
-
unregisterRouterHook()
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
// handle scrollBehavior with transition
|
|
141
|
-
const scrollPromise = useScrollPromise()
|
|
142
|
-
const onBeforeEnter = scrollPromise.resolve
|
|
143
|
-
const onBeforeLeave = scrollPromise.pending
|
|
99
|
+
}
|
|
100
|
+
}
|
|
144
101
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
onTouchStart,
|
|
152
|
-
onTouchEnd,
|
|
153
|
-
onBeforeEnter,
|
|
154
|
-
onBeforeLeave,
|
|
155
|
-
}
|
|
102
|
+
// classes
|
|
103
|
+
const containerClass = computed(() => [
|
|
104
|
+
{
|
|
105
|
+
'no-navbar': !shouldShowNavbar.value,
|
|
106
|
+
'no-sidebar': !sidebarItems.value.length,
|
|
107
|
+
'sidebar-open': isSidebarOpen.value,
|
|
156
108
|
},
|
|
109
|
+
frontmatter.value.pageClass,
|
|
110
|
+
])
|
|
111
|
+
|
|
112
|
+
// close sidebar after navigation
|
|
113
|
+
let unregisterRouterHook
|
|
114
|
+
onMounted(() => {
|
|
115
|
+
const router = useRouter()
|
|
116
|
+
unregisterRouterHook = router.afterEach(() => {
|
|
117
|
+
toggleSidebar(false)
|
|
118
|
+
})
|
|
157
119
|
})
|
|
120
|
+
onUnmounted(() => {
|
|
121
|
+
unregisterRouterHook()
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
// handle scrollBehavior with transition
|
|
125
|
+
const scrollPromise = useScrollPromise()
|
|
126
|
+
const onBeforeEnter = scrollPromise.resolve
|
|
127
|
+
const onBeforeLeave = scrollPromise.pending
|
|
158
128
|
</script>
|
|
@@ -26,6 +26,13 @@
|
|
|
26
26
|
margin: 1.8rem auto;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
.actions {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-wrap: wrap;
|
|
32
|
+
gap: 1rem;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
}
|
|
35
|
+
|
|
29
36
|
.description {
|
|
30
37
|
max-width: 35rem;
|
|
31
38
|
font-size: 1.6rem;
|
|
@@ -40,13 +47,9 @@
|
|
|
40
47
|
border-width: 2px;
|
|
41
48
|
border-style: solid;
|
|
42
49
|
border-radius: 4px;
|
|
43
|
-
transition: background-color
|
|
50
|
+
transition: background-color var(--t-color);
|
|
44
51
|
box-sizing: border-box;
|
|
45
52
|
|
|
46
|
-
&:not(:first-child) {
|
|
47
|
-
margin-left: 1.5rem;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
53
|
&.primary {
|
|
51
54
|
color: var(--c-bg);
|
|
52
55
|
background-color: var(--c-brand);
|
|
@@ -70,7 +73,7 @@
|
|
|
70
73
|
|
|
71
74
|
.features {
|
|
72
75
|
border-top: 1px solid var(--c-border);
|
|
73
|
-
transition: border-
|
|
76
|
+
transition: border-color var(--t-color);
|
|
74
77
|
padding: 1.2rem 0;
|
|
75
78
|
margin-top: 2.5rem;
|
|
76
79
|
display: flex;
|
|
@@ -103,7 +106,7 @@
|
|
|
103
106
|
border-top: 1px solid var(--c-border);
|
|
104
107
|
text-align: center;
|
|
105
108
|
color: var(--c-text-lighter);
|
|
106
|
-
transition: border-
|
|
109
|
+
transition: border-color var(--t-color);
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
112
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
box-sizing: border-box;
|
|
17
17
|
border-bottom: 1px solid var(--c-border);
|
|
18
18
|
background-color: var(--c-bg-navbar);
|
|
19
|
-
transition: background-color
|
|
19
|
+
transition: background-color var(--t-color), border-color var(--t-color);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.sidebar {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
scrollbar-width: thin;
|
|
35
35
|
scrollbar-color: var(--c-brand) var(--c-border);
|
|
36
36
|
background-color: var(--c-bg-sidebar);
|
|
37
|
-
transition: transform
|
|
38
|
-
border-
|
|
37
|
+
transition: transform var(--t-transform), background-color var(--t-color),
|
|
38
|
+
border-color var(--t-color);
|
|
39
39
|
&::-webkit-scrollbar {
|
|
40
40
|
width: 7px;
|
|
41
41
|
}
|
|
@@ -62,6 +62,27 @@
|
|
|
62
62
|
.sidebar-mask {
|
|
63
63
|
display: block;
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
.navbar > .toggle-sidebar-button .icon {
|
|
67
|
+
span {
|
|
68
|
+
&:nth-child(1) {
|
|
69
|
+
transform: rotate(45deg) translate3d(5.5px, 5.5px, 0);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&:nth-child(2) {
|
|
73
|
+
transform: scale3d(0, 1, 1);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&:nth-child(3) {
|
|
77
|
+
transform: rotate(-45deg) translate3d(6px, -6px, 0);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:nth-child(1),
|
|
81
|
+
&:nth-child(3) {
|
|
82
|
+
transform-origin: center;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
65
86
|
}
|
|
66
87
|
|
|
67
88
|
&.no-navbar {
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
.logo {
|
|
12
12
|
height: var(--navbar-line-height);
|
|
13
|
-
min-width: var(--navbar-line-height);
|
|
14
13
|
margin-right: var(--navbar-padding-v);
|
|
15
14
|
vertical-align: top;
|
|
16
15
|
}
|
|
@@ -124,9 +123,26 @@
|
|
|
124
123
|
}
|
|
125
124
|
|
|
126
125
|
.toggle-sidebar-button .icon {
|
|
127
|
-
display:
|
|
126
|
+
display: flex;
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
align-items: center;
|
|
128
130
|
width: 1.25rem;
|
|
129
131
|
height: 1.25rem;
|
|
132
|
+
cursor: inherit;
|
|
133
|
+
|
|
134
|
+
span {
|
|
135
|
+
display: inline-block;
|
|
136
|
+
width: 100%;
|
|
137
|
+
height: 2px;
|
|
138
|
+
border-radius: 2px;
|
|
139
|
+
background-color: var(--c-text);
|
|
140
|
+
transition: transform var(--t-transform);
|
|
141
|
+
|
|
142
|
+
&:nth-child(2) {
|
|
143
|
+
margin: 6px 0;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
130
146
|
}
|
|
131
147
|
|
|
132
148
|
@media screen and (max-width: $MQMobile) {
|
|
@@ -3,7 +3,7 @@ body {
|
|
|
3
3
|
padding: 0;
|
|
4
4
|
margin: 0;
|
|
5
5
|
background-color: var(--c-bg);
|
|
6
|
-
transition: background-color
|
|
6
|
+
transition: background-color var(--t-color);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
html.dark {
|
|
@@ -48,7 +48,7 @@ code {
|
|
|
48
48
|
background-color: var(--c-bg-light);
|
|
49
49
|
border-radius: 3px;
|
|
50
50
|
overflow-wrap: break-word;
|
|
51
|
-
transition: background-color
|
|
51
|
+
transition: background-color var(--t-color), color var(--t-color);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
blockquote {
|
|
@@ -94,7 +94,7 @@ h2 {
|
|
|
94
94
|
font-size: 1.65rem;
|
|
95
95
|
padding-bottom: 0.3rem;
|
|
96
96
|
border-bottom: 1px solid var(--c-border);
|
|
97
|
-
transition: border-
|
|
97
|
+
transition: border-color var(--t-color);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
h3 {
|
|
@@ -46,6 +46,10 @@
|
|
|
46
46
|
--c-badge-warning: var(--c-warning);
|
|
47
47
|
--c-badge-danger: var(--c-danger);
|
|
48
48
|
|
|
49
|
+
// transition vars
|
|
50
|
+
--t-color: 0.3s ease;
|
|
51
|
+
--t-transform: 0.3s ease;
|
|
52
|
+
|
|
49
53
|
// code blocks vars
|
|
50
54
|
--code-bg-color: #282c34;
|
|
51
55
|
--code-hl-bg-color: rgba(0, 0, 0, 0.66);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isLinkHttp,
|
|
1
|
+
import { isLinkHttp, removeEndingSlash, removeLeadingSlash, } from '@vuepress/shared';
|
|
2
2
|
import { resolveRepoType } from './resolveRepoType';
|
|
3
3
|
export const editLinkPatterns = {
|
|
4
4
|
GitHub: ':repo/edit/:branch/:path',
|
package/lib/node/defaultTheme.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.defaultTheme = void 0;
|
|
|
4
4
|
const utils_1 = require("@vuepress/utils");
|
|
5
5
|
const utils_2 = require("./utils");
|
|
6
6
|
const defaultTheme = ({ themePlugins = {}, ...localeOptions }) => {
|
|
7
|
-
utils_2.assignDefaultLocaleOptions(localeOptions);
|
|
7
|
+
(0, utils_2.assignDefaultLocaleOptions)(localeOptions);
|
|
8
8
|
return {
|
|
9
9
|
name: '@vuepress/theme-default',
|
|
10
10
|
layouts: utils_1.path.resolve(__dirname, '../client/layouts'),
|
|
@@ -15,35 +15,35 @@ const defaultTheme = ({ themePlugins = {}, ...localeOptions }) => {
|
|
|
15
15
|
plugins: [
|
|
16
16
|
[
|
|
17
17
|
'@vuepress/active-header-links',
|
|
18
|
-
utils_2.resolveActiveHeaderLinksPluginOptions(themePlugins),
|
|
18
|
+
(0, utils_2.resolveActiveHeaderLinksPluginOptions)(themePlugins),
|
|
19
19
|
],
|
|
20
20
|
['@vuepress/back-to-top', themePlugins.backToTop !== false],
|
|
21
21
|
[
|
|
22
22
|
'@vuepress/container',
|
|
23
|
-
utils_2.resolveContainerPluginOptions(themePlugins, localeOptions, 'tip'),
|
|
23
|
+
(0, utils_2.resolveContainerPluginOptions)(themePlugins, localeOptions, 'tip'),
|
|
24
24
|
],
|
|
25
25
|
[
|
|
26
26
|
'@vuepress/container',
|
|
27
|
-
utils_2.resolveContainerPluginOptions(themePlugins, localeOptions, 'warning'),
|
|
27
|
+
(0, utils_2.resolveContainerPluginOptions)(themePlugins, localeOptions, 'warning'),
|
|
28
28
|
],
|
|
29
29
|
[
|
|
30
30
|
'@vuepress/container',
|
|
31
|
-
utils_2.resolveContainerPluginOptions(themePlugins, localeOptions, 'danger'),
|
|
31
|
+
(0, utils_2.resolveContainerPluginOptions)(themePlugins, localeOptions, 'danger'),
|
|
32
32
|
],
|
|
33
33
|
[
|
|
34
34
|
'@vuepress/container',
|
|
35
|
-
utils_2.resolveContainerPluginOptionsForDetails(themePlugins),
|
|
35
|
+
(0, utils_2.resolveContainerPluginOptionsForDetails)(themePlugins),
|
|
36
36
|
],
|
|
37
37
|
[
|
|
38
38
|
'@vuepress/container',
|
|
39
|
-
utils_2.resolveContainerPluginOptionsForCodeGroup(themePlugins),
|
|
39
|
+
(0, utils_2.resolveContainerPluginOptionsForCodeGroup)(themePlugins),
|
|
40
40
|
],
|
|
41
41
|
[
|
|
42
42
|
'@vuepress/container',
|
|
43
|
-
utils_2.resolveContainerPluginOptionsForCodeGroupItem(themePlugins),
|
|
43
|
+
(0, utils_2.resolveContainerPluginOptionsForCodeGroupItem)(themePlugins),
|
|
44
44
|
],
|
|
45
|
-
['@vuepress/git', utils_2.resolveGitPluginOptions(themePlugins, localeOptions)],
|
|
46
|
-
['@vuepress/medium-zoom', utils_2.resolveMediumZoomPluginOptions(themePlugins)],
|
|
45
|
+
['@vuepress/git', (0, utils_2.resolveGitPluginOptions)(themePlugins, localeOptions)],
|
|
46
|
+
['@vuepress/medium-zoom', (0, utils_2.resolveMediumZoomPluginOptions)(themePlugins)],
|
|
47
47
|
['@vuepress/nprogress', themePlugins.nprogress !== false],
|
|
48
48
|
['@vuepress/palette', { preset: 'sass' }],
|
|
49
49
|
['@vuepress/prismjs', themePlugins.prismjs !== false],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ContainerPluginOptions } from '@vuepress/plugin-container';
|
|
2
|
-
import type {
|
|
2
|
+
import type { DefaultThemeData, DefaultThemePluginsOptions } from '../../shared';
|
|
3
3
|
/**
|
|
4
4
|
* Resolve options for @vuepress/plugin-container
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GitPluginOptions } from '@vuepress/plugin-git';
|
|
2
|
-
import type {
|
|
2
|
+
import type { DefaultThemeLocaleOptions, DefaultThemePluginsOptions } from '../../shared';
|
|
3
3
|
/**
|
|
4
4
|
* Resolve options for @vuepress/plugin-git
|
|
5
5
|
*/
|
package/lib/shared/options.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { LocaleData } from '@vuepress/shared';
|
|
2
1
|
import type { ThemeData } from '@vuepress/plugin-theme-data';
|
|
2
|
+
import type { LocaleData } from '@vuepress/shared';
|
|
3
3
|
import type { NavbarConfig, SidebarConfig } from './nav';
|
|
4
4
|
export interface DefaultThemePluginsOptions {
|
|
5
5
|
/**
|
|
@@ -59,6 +59,12 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
59
59
|
* Logo to display in navbar
|
|
60
60
|
*/
|
|
61
61
|
logo?: null | string;
|
|
62
|
+
/**
|
|
63
|
+
* Navbar logo config for dark mode
|
|
64
|
+
*
|
|
65
|
+
* Logo to display in navbar in dark mode
|
|
66
|
+
*/
|
|
67
|
+
logoDark?: null | string;
|
|
62
68
|
/**
|
|
63
69
|
* Navbar dark mode button config
|
|
64
70
|
*
|
|
@@ -220,4 +226,8 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
220
226
|
* A11y text for dark mode toggle button
|
|
221
227
|
*/
|
|
222
228
|
toggleDarkMode?: string;
|
|
229
|
+
/**
|
|
230
|
+
* A11y text for sidebar toggle button
|
|
231
|
+
*/
|
|
232
|
+
toggleSidebar?: string;
|
|
223
233
|
}
|
package/lib/shared/page.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export interface DefaultThemeHomePageFrontmatter extends DefaultThemePageFrontma
|
|
|
29
29
|
export interface DefaultThemeNormalPageFrontmatter extends DefaultThemePageFrontmatter {
|
|
30
30
|
home?: false;
|
|
31
31
|
editLink?: boolean;
|
|
32
|
+
editLinkPattern?: string;
|
|
32
33
|
lastUpdated?: boolean;
|
|
33
34
|
contributors?: boolean;
|
|
34
35
|
sidebar?: 'auto' | false | SidebarConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/theme-default",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.27",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -29,26 +29,27 @@
|
|
|
29
29
|
"copy": "cpx \"src/**/*.{d.ts,vue,scss}\" lib"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@vuepress/client": "2.0.0-beta.
|
|
33
|
-
"@vuepress/core": "2.0.0-beta.
|
|
34
|
-
"@vuepress/plugin-active-header-links": "2.0.0-beta.
|
|
35
|
-
"@vuepress/plugin-back-to-top": "2.0.0-beta.
|
|
36
|
-
"@vuepress/plugin-container": "2.0.0-beta.
|
|
37
|
-
"@vuepress/plugin-git": "2.0.0-beta.
|
|
38
|
-
"@vuepress/plugin-medium-zoom": "2.0.0-beta.
|
|
39
|
-
"@vuepress/plugin-nprogress": "2.0.0-beta.
|
|
40
|
-
"@vuepress/plugin-palette": "2.0.0-beta.
|
|
41
|
-
"@vuepress/plugin-prismjs": "2.0.0-beta.
|
|
42
|
-
"@vuepress/plugin-theme-data": "2.0.0-beta.
|
|
43
|
-
"@vuepress/shared": "2.0.0-beta.
|
|
44
|
-
"@vuepress/utils": "2.0.0-beta.
|
|
45
|
-
"
|
|
46
|
-
"sass
|
|
47
|
-
"
|
|
48
|
-
"vue
|
|
32
|
+
"@vuepress/client": "2.0.0-beta.27",
|
|
33
|
+
"@vuepress/core": "2.0.0-beta.27",
|
|
34
|
+
"@vuepress/plugin-active-header-links": "2.0.0-beta.27",
|
|
35
|
+
"@vuepress/plugin-back-to-top": "2.0.0-beta.27",
|
|
36
|
+
"@vuepress/plugin-container": "2.0.0-beta.27",
|
|
37
|
+
"@vuepress/plugin-git": "2.0.0-beta.27",
|
|
38
|
+
"@vuepress/plugin-medium-zoom": "2.0.0-beta.27",
|
|
39
|
+
"@vuepress/plugin-nprogress": "2.0.0-beta.27",
|
|
40
|
+
"@vuepress/plugin-palette": "2.0.0-beta.27",
|
|
41
|
+
"@vuepress/plugin-prismjs": "2.0.0-beta.27",
|
|
42
|
+
"@vuepress/plugin-theme-data": "2.0.0-beta.27",
|
|
43
|
+
"@vuepress/shared": "2.0.0-beta.27",
|
|
44
|
+
"@vuepress/utils": "2.0.0-beta.27",
|
|
45
|
+
"@vueuse/core": "^6.7.3",
|
|
46
|
+
"sass": "^1.43.4",
|
|
47
|
+
"sass-loader": "^12.2.0",
|
|
48
|
+
"vue": "^3.2.20",
|
|
49
|
+
"vue-router": "^4.0.12"
|
|
49
50
|
},
|
|
50
51
|
"publishConfig": {
|
|
51
52
|
"access": "public"
|
|
52
53
|
},
|
|
53
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "2671a94fe6864e215eb84f318b7e657744a0bc5d"
|
|
54
55
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { onMounted, onUnmounted, watch } from 'vue';
|
|
2
|
-
export const useHtmlDarkClass = (isDarkMode) => {
|
|
3
|
-
const updateDarkModeClass = (value = isDarkMode.value) => {
|
|
4
|
-
// set `class="dark"` on `<html>` element
|
|
5
|
-
const htmlEl = window === null || window === void 0 ? void 0 : window.document.querySelector('html');
|
|
6
|
-
htmlEl === null || htmlEl === void 0 ? void 0 : htmlEl.classList.toggle('dark', value);
|
|
7
|
-
};
|
|
8
|
-
onMounted(() => {
|
|
9
|
-
watch(isDarkMode, updateDarkModeClass, { immediate: true });
|
|
10
|
-
});
|
|
11
|
-
onUnmounted(() => {
|
|
12
|
-
updateDarkModeClass(false);
|
|
13
|
-
});
|
|
14
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { onMounted, onUnmounted, ref } from 'vue';
|
|
2
|
-
export const usePrefersColorScheme = (isDarkMode) => {
|
|
3
|
-
const mediaQuery = ref(null);
|
|
4
|
-
const onMediaQueryChange = (event) => {
|
|
5
|
-
isDarkMode.value = event.matches;
|
|
6
|
-
};
|
|
7
|
-
onMounted(() => {
|
|
8
|
-
// get `prefers-color-scheme` media query and set the initial mode
|
|
9
|
-
mediaQuery.value = window.matchMedia('(prefers-color-scheme: dark)');
|
|
10
|
-
isDarkMode.value = mediaQuery.value.matches;
|
|
11
|
-
// watch changes
|
|
12
|
-
mediaQuery.value.addEventListener('change', onMediaQueryChange);
|
|
13
|
-
});
|
|
14
|
-
onUnmounted(() => {
|
|
15
|
-
var _a;
|
|
16
|
-
(_a = mediaQuery.value) === null || _a === void 0 ? void 0 : _a.removeEventListener('change', onMediaQueryChange);
|
|
17
|
-
});
|
|
18
|
-
};
|