@vuepress/theme-default 2.0.0-beta.48 → 2.0.0-beta.49
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/NavbarItems.vue +8 -3
- package/lib/client/components/SidebarItem.vue +18 -14
- package/lib/client/components/SidebarItems.vue +1 -1
- package/lib/client/layouts/404.vue +7 -5
- package/lib/client/styles/normalize.scss +1 -0
- package/lib/client/styles/sidebar.scss +9 -9
- package/lib/shared/options.d.ts +2 -2
- package/package.json +19 -19
|
@@ -27,12 +27,16 @@ const useNavbarSelectLanguage = (): ComputedRef<ResolvedNavbarItem[]> => {
|
|
|
27
27
|
}
|
|
28
28
|
const currentPath = router.currentRoute.value.path
|
|
29
29
|
const currentFullPath = router.currentRoute.value.fullPath
|
|
30
|
+
const currentHash = router.currentRoute.value.hash
|
|
30
31
|
|
|
31
32
|
const languageDropdown: ResolvedNavbarItem = {
|
|
32
33
|
text: themeLocale.value.selectLanguageText ?? 'unknown language',
|
|
33
|
-
ariaLabel:
|
|
34
|
+
ariaLabel:
|
|
35
|
+
themeLocale.value.selectLanguageAriaLabel ??
|
|
36
|
+
themeLocale.value.selectLanguageText ??
|
|
37
|
+
'unknown language',
|
|
34
38
|
children: localePaths.map((targetLocalePath) => {
|
|
35
|
-
// target locale config of this
|
|
39
|
+
// target locale config of this language link
|
|
36
40
|
const targetSiteLocale =
|
|
37
41
|
siteLocale.value.locales?.[targetLocalePath] ?? {}
|
|
38
42
|
const targetThemeLocale =
|
|
@@ -57,7 +61,8 @@ const useNavbarSelectLanguage = (): ComputedRef<ResolvedNavbarItem[]> => {
|
|
|
57
61
|
if (
|
|
58
62
|
router.getRoutes().some((item) => item.path === targetLocalePage)
|
|
59
63
|
) {
|
|
60
|
-
|
|
64
|
+
// try to keep current hash across languages
|
|
65
|
+
link = `${targetLocalePage}${currentHash}`
|
|
61
66
|
} else {
|
|
62
67
|
link = targetThemeLocale.home ?? targetLocalePath
|
|
63
68
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import AutoLink from '@theme/AutoLink.vue'
|
|
3
3
|
import DropdownTransition from '@theme/DropdownTransition.vue'
|
|
4
|
-
import {
|
|
4
|
+
import { useToggle } from '@vueuse/core'
|
|
5
|
+
import { computed, nextTick, onBeforeUnmount, toRefs } from 'vue'
|
|
5
6
|
import type { PropType } from 'vue'
|
|
6
7
|
import { useRoute, useRouter } from 'vue-router'
|
|
7
8
|
import type { ResolvedSidebarItem } from '../../shared'
|
|
@@ -31,21 +32,24 @@ const itemClass = computed(() => ({
|
|
|
31
32
|
'collapsible': item.value.collapsible,
|
|
32
33
|
}))
|
|
33
34
|
|
|
34
|
-
const isOpen =
|
|
35
|
-
const onClick =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// toggle open status on click
|
|
41
|
-
onClick.value = () => {
|
|
42
|
-
isOpen.value = !isOpen.value
|
|
35
|
+
const [isOpen, toggleIsOpen] = useToggle(isActive.value)
|
|
36
|
+
const onClick = (e: Event): void => {
|
|
37
|
+
if (item.value.collapsible) {
|
|
38
|
+
e.preventDefault()
|
|
39
|
+
// toggle open status on click
|
|
40
|
+
toggleIsOpen()
|
|
43
41
|
}
|
|
44
|
-
// reset open status after navigation
|
|
45
|
-
router.afterEach(() => {
|
|
46
|
-
isOpen.value = isActive.value
|
|
47
|
-
})
|
|
48
42
|
}
|
|
43
|
+
|
|
44
|
+
// reset open status after navigation
|
|
45
|
+
const unregisterRouterHook = router.afterEach((to) => {
|
|
46
|
+
nextTick(() => {
|
|
47
|
+
isOpen.value = item.value.collapsible ? isActive.value : true
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
onBeforeUnmount(() => {
|
|
51
|
+
unregisterRouterHook()
|
|
52
|
+
})
|
|
49
53
|
</script>
|
|
50
54
|
|
|
51
55
|
<template>
|
|
@@ -14,12 +14,14 @@ const homeText = themeLocale.value.backToHome ?? 'Back to home'
|
|
|
14
14
|
|
|
15
15
|
<template>
|
|
16
16
|
<div class="theme-container">
|
|
17
|
-
<
|
|
18
|
-
<
|
|
17
|
+
<main class="page">
|
|
18
|
+
<div class="theme-default-content">
|
|
19
|
+
<h1>404</h1>
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
<blockquote>{{ getMsg() }}</blockquote>
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
<RouterLink :to="homeLink">{{ homeText }}</RouterLink>
|
|
24
|
+
</div>
|
|
25
|
+
</main>
|
|
24
26
|
</div>
|
|
25
27
|
</template>
|
|
@@ -79,20 +79,20 @@
|
|
|
79
79
|
box-sizing: border-box;
|
|
80
80
|
margin: 0;
|
|
81
81
|
|
|
82
|
+
+ .sidebar-item-children {
|
|
83
|
+
@include dropdown_wrapper;
|
|
84
|
+
margin-bottom: 0.75rem;
|
|
85
|
+
}
|
|
86
|
+
|
|
82
87
|
&.collapsible {
|
|
83
88
|
cursor: pointer;
|
|
84
89
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
.arrow {
|
|
91
|
+
position: relative;
|
|
92
|
+
top: -0.12em;
|
|
93
|
+
left: 0.5em;
|
|
88
94
|
}
|
|
89
95
|
}
|
|
90
|
-
|
|
91
|
-
.arrow {
|
|
92
|
-
position: relative;
|
|
93
|
-
top: -0.12em;
|
|
94
|
-
left: 0.5em;
|
|
95
|
-
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
&:not(.sidebar-heading) {
|
package/lib/shared/options.d.ts
CHANGED
|
@@ -128,9 +128,9 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
128
128
|
* - ...
|
|
129
129
|
*
|
|
130
130
|
* The max value depends on which headers you have extracted
|
|
131
|
-
* via `markdown.
|
|
131
|
+
* via `markdown.headers.level`.
|
|
132
132
|
*
|
|
133
|
-
* The default value of `markdown.
|
|
133
|
+
* The default value of `markdown.headers.level` is `[2, 3]`,
|
|
134
134
|
* so the default max value of `sidebarDepth` is `2`
|
|
135
135
|
*/
|
|
136
136
|
sidebarDepth?: number;
|
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.49",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -25,24 +25,24 @@
|
|
|
25
25
|
"templates"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@vuepress/client": "2.0.0-beta.
|
|
29
|
-
"@vuepress/core": "2.0.0-beta.
|
|
30
|
-
"@vuepress/plugin-active-header-links": "2.0.0-beta.
|
|
31
|
-
"@vuepress/plugin-back-to-top": "2.0.0-beta.
|
|
32
|
-
"@vuepress/plugin-container": "2.0.0-beta.
|
|
33
|
-
"@vuepress/plugin-external-link-icon": "2.0.0-beta.
|
|
34
|
-
"@vuepress/plugin-git": "2.0.0-beta.
|
|
35
|
-
"@vuepress/plugin-medium-zoom": "2.0.0-beta.
|
|
36
|
-
"@vuepress/plugin-nprogress": "2.0.0-beta.
|
|
37
|
-
"@vuepress/plugin-palette": "2.0.0-beta.
|
|
38
|
-
"@vuepress/plugin-prismjs": "2.0.0-beta.
|
|
39
|
-
"@vuepress/plugin-theme-data": "2.0.0-beta.
|
|
40
|
-
"@vuepress/shared": "2.0.0-beta.
|
|
41
|
-
"@vuepress/utils": "2.0.0-beta.
|
|
42
|
-
"@vueuse/core": "^8.5
|
|
43
|
-
"sass": "^1.
|
|
44
|
-
"vue": "^3.2.
|
|
45
|
-
"vue-router": "^4.
|
|
28
|
+
"@vuepress/client": "2.0.0-beta.49",
|
|
29
|
+
"@vuepress/core": "2.0.0-beta.49",
|
|
30
|
+
"@vuepress/plugin-active-header-links": "2.0.0-beta.49",
|
|
31
|
+
"@vuepress/plugin-back-to-top": "2.0.0-beta.49",
|
|
32
|
+
"@vuepress/plugin-container": "2.0.0-beta.49",
|
|
33
|
+
"@vuepress/plugin-external-link-icon": "2.0.0-beta.49",
|
|
34
|
+
"@vuepress/plugin-git": "2.0.0-beta.49",
|
|
35
|
+
"@vuepress/plugin-medium-zoom": "2.0.0-beta.49",
|
|
36
|
+
"@vuepress/plugin-nprogress": "2.0.0-beta.49",
|
|
37
|
+
"@vuepress/plugin-palette": "2.0.0-beta.49",
|
|
38
|
+
"@vuepress/plugin-prismjs": "2.0.0-beta.49",
|
|
39
|
+
"@vuepress/plugin-theme-data": "2.0.0-beta.49",
|
|
40
|
+
"@vuepress/shared": "2.0.0-beta.49",
|
|
41
|
+
"@vuepress/utils": "2.0.0-beta.49",
|
|
42
|
+
"@vueuse/core": "^8.7.5",
|
|
43
|
+
"sass": "^1.53.0",
|
|
44
|
+
"vue": "^3.2.37",
|
|
45
|
+
"vue-router": "^4.1.2"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"sass-loader": "^13.0.0"
|