@vuepress/theme-default 2.0.0-rc.103 → 2.0.0-rc.105
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/components/VPAutoLink.vue +1 -1
- package/lib/client/components/VPHomeFeatures.vue +1 -1
- package/lib/client/components/VPNavbarDropdown.vue +10 -11
- package/lib/client/components/VPPageNav.vue +2 -2
- package/lib/client/components/VPSidebar.vue +3 -3
- package/lib/client/components/VPSidebarItem.vue +14 -18
- package/lib/client/components/global/Badge.vue +19 -24
- package/lib/client/composables/useNavbarSelectLanguage.js +9 -3
- package/lib/client/layouts/NotFound.vue +44 -8
- package/lib/client/styles/vars-dark.scss +1 -1
- package/lib/client/styles/vars.scss +1 -1
- package/package.json +18 -18
|
@@ -2,24 +2,20 @@
|
|
|
2
2
|
import VPAutoLink from '@theme/VPAutoLink.vue'
|
|
3
3
|
import { FadeInExpandTransition } from '@vuepress/helper/client'
|
|
4
4
|
import { useToggle } from '@vueuse/core'
|
|
5
|
-
import { computed
|
|
5
|
+
import { computed } from 'vue'
|
|
6
6
|
import { onContentUpdated } from 'vuepress/client'
|
|
7
7
|
import type { AutoLinkOptions, NavGroup } from '../../shared/index.js'
|
|
8
8
|
|
|
9
9
|
import '@vuepress/helper/transition/fade-in-height-expand.css'
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const { config } = defineProps<{
|
|
12
12
|
/** dropdown config */
|
|
13
13
|
config: NavGroup<AutoLinkOptions | NavGroup<AutoLinkOptions>>
|
|
14
14
|
}>()
|
|
15
15
|
|
|
16
|
-
const { config } = toRefs(props)
|
|
17
|
-
|
|
18
16
|
const [open, toggleOpen] = useToggle()
|
|
19
17
|
|
|
20
|
-
const dropdownAriaLabel = computed(
|
|
21
|
-
() => config.value.ariaLabel || config.value.text,
|
|
22
|
-
)
|
|
18
|
+
const dropdownAriaLabel = computed(() => config.ariaLabel || config.text)
|
|
23
19
|
|
|
24
20
|
const isLastItemOfArray = (arrayItem: unknown, array: unknown[]): boolean =>
|
|
25
21
|
array[array.length - 1] === arrayItem
|
|
@@ -175,7 +171,7 @@ onContentUpdated(() => {
|
|
|
175
171
|
max-height: calc(100vh - 2.7rem);
|
|
176
172
|
margin: 0;
|
|
177
173
|
padding: 0.6rem 0;
|
|
178
|
-
border: 1px solid var(--vp-c-
|
|
174
|
+
border: 1px solid var(--vp-c-divider);
|
|
179
175
|
border-radius: 0.5rem;
|
|
180
176
|
|
|
181
177
|
background-color: var(--vp-c-bg-elv);
|
|
@@ -249,7 +245,6 @@ onContentUpdated(() => {
|
|
|
249
245
|
border-bottom: none;
|
|
250
246
|
|
|
251
247
|
font-weight: 400;
|
|
252
|
-
line-height: 1.7rem;
|
|
253
248
|
|
|
254
249
|
&:hover {
|
|
255
250
|
color: var(--vp-c-accent);
|
|
@@ -274,7 +269,11 @@ onContentUpdated(() => {
|
|
|
274
269
|
}
|
|
275
270
|
}
|
|
276
271
|
|
|
277
|
-
.vp-navbar-
|
|
272
|
+
.vp-navbar-items & .auto-link {
|
|
273
|
+
line-height: 1.7rem;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.vp-navbar-dropdown-wrapper.mobile & > .auto-link {
|
|
278
277
|
line-height: 2rem;
|
|
279
278
|
}
|
|
280
279
|
}
|
|
@@ -282,7 +281,7 @@ onContentUpdated(() => {
|
|
|
282
281
|
.vp-navbar-dropdown-subtitle {
|
|
283
282
|
margin: 0.45rem 0 0;
|
|
284
283
|
padding: 1rem 0 0.45rem;
|
|
285
|
-
border-top: 1px solid var(--vp-c-
|
|
284
|
+
border-top: 1px solid var(--vp-c-divider);
|
|
286
285
|
font-size: 0.9rem;
|
|
287
286
|
|
|
288
287
|
.vp-navbar-dropdown-wrapper.mobile & {
|
|
@@ -72,7 +72,7 @@ useEventListener('keydown', (event): void => {
|
|
|
72
72
|
margin-inline: auto;
|
|
73
73
|
margin-top: 0;
|
|
74
74
|
padding: 1rem 2rem 0;
|
|
75
|
-
border-top: 1px solid var(--vp-c-
|
|
75
|
+
border-top: 1px solid var(--vp-c-divider);
|
|
76
76
|
|
|
77
77
|
transition: border-top var(--vp-t-color);
|
|
78
78
|
|
|
@@ -90,7 +90,7 @@ useEventListener('keydown', (event): void => {
|
|
|
90
90
|
|
|
91
91
|
margin: 0.25rem;
|
|
92
92
|
padding: 0.25rem 0.5rem;
|
|
93
|
-
border: 1px solid var(--vp-c-
|
|
93
|
+
border: 1px solid var(--vp-c-divider);
|
|
94
94
|
border-radius: 0.25rem;
|
|
95
95
|
|
|
96
96
|
&:hover {
|
|
@@ -46,7 +46,7 @@ defineSlots<{
|
|
|
46
46
|
background-color var(--vp-t-color),
|
|
47
47
|
border-color var(--vp-t-color);
|
|
48
48
|
|
|
49
|
-
scrollbar-color: var(--vp-c-accent-bg) var(--vp-c-
|
|
49
|
+
scrollbar-color: var(--vp-c-accent-bg) var(--vp-c-divider);
|
|
50
50
|
scrollbar-width: thin;
|
|
51
51
|
|
|
52
52
|
// narrow desktop / iPad
|
|
@@ -73,7 +73,7 @@ defineSlots<{
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
&::-webkit-scrollbar-track {
|
|
76
|
-
background-color: var(--vp-c-
|
|
76
|
+
background-color: var(--vp-c-divider);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
&::-webkit-scrollbar-thumb {
|
|
@@ -84,7 +84,7 @@ defineSlots<{
|
|
|
84
84
|
.vp-navbar-items {
|
|
85
85
|
display: none;
|
|
86
86
|
padding: 0.5rem 0 0.75rem;
|
|
87
|
-
border-bottom: 1px solid var(--vp-c-
|
|
87
|
+
border-bottom: 1px solid var(--vp-c-divider);
|
|
88
88
|
transition: border-color var(--vp-t-color);
|
|
89
89
|
|
|
90
90
|
@media (max-width: $MQMobile) {
|
|
@@ -3,33 +3,29 @@ import VPAutoLink from '@theme/VPAutoLink.vue'
|
|
|
3
3
|
import VPDropdownTransition from '@theme/VPDropdownTransition.vue'
|
|
4
4
|
import { isActiveSidebarItem } from '@theme/isActiveSidebarItem'
|
|
5
5
|
import { useToggle } from '@vueuse/core'
|
|
6
|
-
import { computed, nextTick, onBeforeUnmount
|
|
6
|
+
import { computed, nextTick, onBeforeUnmount } from 'vue'
|
|
7
7
|
import { useRoute, useRouter } from 'vuepress/client'
|
|
8
8
|
import type { SidebarGroupItem, SidebarItem } from '../typings.js'
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}>(),
|
|
21
|
-
{ depth: 0 },
|
|
22
|
-
)
|
|
10
|
+
const { item, depth = 0 } = defineProps<{
|
|
11
|
+
/**
|
|
12
|
+
* The sidebar item to be rendered
|
|
13
|
+
*/
|
|
14
|
+
item: SidebarItem
|
|
15
|
+
/**
|
|
16
|
+
* The depth of the current sidebar item
|
|
17
|
+
*/
|
|
18
|
+
depth?: number
|
|
19
|
+
}>()
|
|
23
20
|
|
|
24
|
-
const { item, depth } = toRefs(props)
|
|
25
21
|
const route = useRoute()
|
|
26
22
|
const router = useRouter()
|
|
27
23
|
|
|
28
|
-
const collapsible = computed(() => (item
|
|
29
|
-
const isActive = computed(() => isActiveSidebarItem(item
|
|
24
|
+
const collapsible = computed(() => (item as SidebarGroupItem).collapsible)
|
|
25
|
+
const isActive = computed(() => isActiveSidebarItem(item, route))
|
|
30
26
|
const itemClass = computed(() => ({
|
|
31
27
|
'vp-sidebar-item': true,
|
|
32
|
-
'vp-sidebar-heading': depth
|
|
28
|
+
'vp-sidebar-heading': depth === 0,
|
|
33
29
|
'active': isActive.value,
|
|
34
30
|
'collapsible': collapsible.value,
|
|
35
31
|
}))
|
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { Slot } from '@vuepress/helper/client'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
vertical: undefined,
|
|
23
|
-
},
|
|
24
|
-
)
|
|
4
|
+
const {
|
|
5
|
+
type = 'tip',
|
|
6
|
+
text = '',
|
|
7
|
+
vertical = '',
|
|
8
|
+
} = defineProps<{
|
|
9
|
+
/**
|
|
10
|
+
* The type of the badge
|
|
11
|
+
*/
|
|
12
|
+
type?: string
|
|
13
|
+
/**
|
|
14
|
+
* The text of the badge
|
|
15
|
+
*/
|
|
16
|
+
text?: string
|
|
17
|
+
/**
|
|
18
|
+
* The vertical align of the badge
|
|
19
|
+
*/
|
|
20
|
+
vertical?: string
|
|
21
|
+
}>()
|
|
25
22
|
|
|
26
23
|
defineSlots<{
|
|
27
24
|
default?: Slot
|
|
@@ -32,9 +29,7 @@ defineSlots<{
|
|
|
32
29
|
<span
|
|
33
30
|
class="vp-badge"
|
|
34
31
|
:class="type"
|
|
35
|
-
:style="{
|
|
36
|
-
verticalAlign: vertical,
|
|
37
|
-
}"
|
|
32
|
+
:style="vertical ? { verticalAlign: vertical } : ''"
|
|
38
33
|
>
|
|
39
34
|
<slot>{{ text }}</slot>
|
|
40
35
|
</span>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useData } from '@theme/useData';
|
|
2
2
|
import { useRoutePaths } from '@vuepress/helper/client';
|
|
3
|
-
import { computed } from 'vue';
|
|
3
|
+
import { computed, onMounted, ref } from 'vue';
|
|
4
4
|
import { useRoute } from 'vuepress/client';
|
|
5
5
|
/**
|
|
6
6
|
* Get navbar config of select language dropdown
|
|
@@ -9,6 +9,10 @@ export const useNavbarSelectLanguage = () => {
|
|
|
9
9
|
const route = useRoute();
|
|
10
10
|
const routePaths = useRoutePaths();
|
|
11
11
|
const { routeLocale, site, siteLocale, theme, themeLocale } = useData();
|
|
12
|
+
const isMounted = ref(false);
|
|
13
|
+
onMounted(() => {
|
|
14
|
+
isMounted.value = true;
|
|
15
|
+
});
|
|
12
16
|
return computed(() => {
|
|
13
17
|
const localePaths = Object.keys(site.value.locales);
|
|
14
18
|
// do not display language selection dropdown if there is only one language
|
|
@@ -34,7 +38,7 @@ export const useNavbarSelectLanguage = () => {
|
|
|
34
38
|
return {
|
|
35
39
|
text,
|
|
36
40
|
activeMatch: '.',
|
|
37
|
-
link:
|
|
41
|
+
link: isMounted.value ? currentFullPath : currentPath,
|
|
38
42
|
};
|
|
39
43
|
}
|
|
40
44
|
// if the target language is not current language
|
|
@@ -45,7 +49,9 @@ export const useNavbarSelectLanguage = () => {
|
|
|
45
49
|
text,
|
|
46
50
|
// try to keep current hash and params across languages
|
|
47
51
|
link: routePaths.value.some((item) => item === targetLocalePage)
|
|
48
|
-
?
|
|
52
|
+
? isMounted.value
|
|
53
|
+
? currentFullPath.replace(currentPath, targetLocalePage)
|
|
54
|
+
: targetLocalePage
|
|
49
55
|
: (targetThemeLocale.home ?? targetLocalePath),
|
|
50
56
|
};
|
|
51
57
|
}),
|
|
@@ -1,17 +1,53 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useData } from '@theme/useData'
|
|
3
|
-
import { computed } from 'vue'
|
|
3
|
+
import { computed, onMounted, ref } from 'vue'
|
|
4
4
|
import { RouteLink } from 'vuepress/client'
|
|
5
5
|
|
|
6
|
-
const { routeLocale, themeLocale } = useData()
|
|
6
|
+
const { routeLocale, theme, themeLocale } = useData()
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const isMounted = ref(false)
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
// 404 page will fall back to root locale,
|
|
11
|
+
// so we shall use the '/' to avoid SSR mismatch
|
|
12
|
+
const expectedRouteLocale = computed(() =>
|
|
13
|
+
isMounted.value ? routeLocale.value : '/',
|
|
14
|
+
)
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
// 404 page will fall back to root locale,
|
|
17
|
+
// so we shall use the root theme locale to avoid SSR mismatch
|
|
18
|
+
const expectedThemeLocale = computed(() => {
|
|
19
|
+
if (isMounted.value) return themeLocale.value
|
|
20
|
+
|
|
21
|
+
const { locales, ...baseOptions } = theme.value
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
...baseOptions,
|
|
25
|
+
...locales?.['/'],
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const homeLink = computed(
|
|
30
|
+
() => expectedThemeLocale.value.home ?? expectedRouteLocale.value,
|
|
31
|
+
)
|
|
32
|
+
const homeText = computed(
|
|
33
|
+
() => expectedThemeLocale.value.backToHome ?? 'Back to home',
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
const messages = computed(
|
|
37
|
+
() => expectedThemeLocale.value.notFound ?? ['Not Found'],
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
const notFoundMsg = computed(() => {
|
|
41
|
+
if (isMounted.value) {
|
|
42
|
+
return messages.value[Math.floor(Math.random() * messages.value.length)]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return messages.value[0]
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
onMounted(() => {
|
|
49
|
+
isMounted.value = true
|
|
50
|
+
})
|
|
15
51
|
</script>
|
|
16
52
|
|
|
17
53
|
<template>
|
|
@@ -20,7 +56,7 @@ const homeText = computed(() => themeLocale.value.backToHome ?? 'Back to home')
|
|
|
20
56
|
<div vp-content>
|
|
21
57
|
<h1>404</h1>
|
|
22
58
|
|
|
23
|
-
<blockquote>{{
|
|
59
|
+
<blockquote>{{ notFoundMsg }}</blockquote>
|
|
24
60
|
|
|
25
61
|
<RouteLink :to="homeLink">{{ homeText }}</RouteLink>
|
|
26
62
|
</div>
|
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.105",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -42,23 +42,23 @@
|
|
|
42
42
|
"templates"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@vuepress/helper": "2.0.0-rc.
|
|
46
|
-
"@vuepress/plugin-active-header-links": "2.0.0-rc.
|
|
47
|
-
"@vuepress/plugin-back-to-top": "2.0.0-rc.
|
|
48
|
-
"@vuepress/plugin-copy-code": "2.0.0-rc.
|
|
49
|
-
"@vuepress/plugin-git": "2.0.0-rc.
|
|
50
|
-
"@vuepress/plugin-links-check": "2.0.0-rc.
|
|
51
|
-
"@vuepress/plugin-markdown-hint": "2.0.0-rc.
|
|
52
|
-
"@vuepress/plugin-markdown-tab": "2.0.0-rc.
|
|
53
|
-
"@vuepress/plugin-medium-zoom": "2.0.0-rc.
|
|
54
|
-
"@vuepress/plugin-nprogress": "2.0.0-rc.
|
|
55
|
-
"@vuepress/plugin-palette": "2.0.0-rc.
|
|
56
|
-
"@vuepress/plugin-prismjs": "2.0.0-rc.
|
|
57
|
-
"@vuepress/plugin-seo": "2.0.0-rc.
|
|
58
|
-
"@vuepress/plugin-sitemap": "2.0.0-rc.
|
|
59
|
-
"@vuepress/plugin-theme-data": "2.0.0-rc.
|
|
45
|
+
"@vuepress/helper": "2.0.0-rc.105",
|
|
46
|
+
"@vuepress/plugin-active-header-links": "2.0.0-rc.105",
|
|
47
|
+
"@vuepress/plugin-back-to-top": "2.0.0-rc.105",
|
|
48
|
+
"@vuepress/plugin-copy-code": "2.0.0-rc.105",
|
|
49
|
+
"@vuepress/plugin-git": "2.0.0-rc.105",
|
|
50
|
+
"@vuepress/plugin-links-check": "2.0.0-rc.105",
|
|
51
|
+
"@vuepress/plugin-markdown-hint": "2.0.0-rc.105",
|
|
52
|
+
"@vuepress/plugin-markdown-tab": "2.0.0-rc.105",
|
|
53
|
+
"@vuepress/plugin-medium-zoom": "2.0.0-rc.105",
|
|
54
|
+
"@vuepress/plugin-nprogress": "2.0.0-rc.105",
|
|
55
|
+
"@vuepress/plugin-palette": "2.0.0-rc.105",
|
|
56
|
+
"@vuepress/plugin-prismjs": "2.0.0-rc.105",
|
|
57
|
+
"@vuepress/plugin-seo": "2.0.0-rc.105",
|
|
58
|
+
"@vuepress/plugin-sitemap": "2.0.0-rc.105",
|
|
59
|
+
"@vuepress/plugin-theme-data": "2.0.0-rc.105",
|
|
60
60
|
"@vueuse/core": "^13.1.0",
|
|
61
|
-
"vue": "^3.5.
|
|
61
|
+
"vue": "^3.5.14"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"sass": "^1.86.3",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "7e83c690386036378a7ae248c4581b79ff37227f"
|
|
84
84
|
}
|