@vuepress/theme-default 2.0.0-beta.62 → 2.0.0-beta.64
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 +15 -10
- package/package.json +20 -20
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import AutoLink from '@theme/AutoLink.vue'
|
|
3
3
|
import NavbarDropdown from '@theme/NavbarDropdown.vue'
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
useRouteLocale,
|
|
6
|
+
useSiteData,
|
|
7
|
+
useSiteLocaleData,
|
|
8
|
+
} from '@vuepress/client'
|
|
5
9
|
import { isLinkHttp, isString } from '@vuepress/shared'
|
|
6
10
|
import { computed, ref } from 'vue'
|
|
7
11
|
import type { ComputedRef } from 'vue'
|
|
@@ -14,6 +18,7 @@ import type {
|
|
|
14
18
|
import {
|
|
15
19
|
DeviceType,
|
|
16
20
|
useNavLink,
|
|
21
|
+
useThemeData,
|
|
17
22
|
useThemeLocaleData,
|
|
18
23
|
useUpdateDeviceStatus,
|
|
19
24
|
} from '../composables/index.js'
|
|
@@ -25,11 +30,13 @@ import { resolveRepoType } from '../utils/index.js'
|
|
|
25
30
|
const useNavbarSelectLanguage = (): ComputedRef<ResolvedNavbarItem[]> => {
|
|
26
31
|
const router = useRouter()
|
|
27
32
|
const routeLocale = useRouteLocale()
|
|
33
|
+
const site = useSiteData()
|
|
28
34
|
const siteLocale = useSiteLocaleData()
|
|
35
|
+
const theme = useThemeData()
|
|
29
36
|
const themeLocale = useThemeLocaleData()
|
|
30
37
|
|
|
31
38
|
return computed<ResolvedNavbarItem[]>(() => {
|
|
32
|
-
const localePaths = Object.keys(
|
|
39
|
+
const localePaths = Object.keys(site.value.locales)
|
|
33
40
|
// do not display language selection dropdown if there is only one language
|
|
34
41
|
if (localePaths.length < 2) {
|
|
35
42
|
return []
|
|
@@ -38,17 +45,15 @@ const useNavbarSelectLanguage = (): ComputedRef<ResolvedNavbarItem[]> => {
|
|
|
38
45
|
const currentFullPath = router.currentRoute.value.fullPath
|
|
39
46
|
|
|
40
47
|
const languageDropdown: ResolvedNavbarItem = {
|
|
41
|
-
text: themeLocale.value.selectLanguageText
|
|
42
|
-
ariaLabel:
|
|
48
|
+
text: `${themeLocale.value.selectLanguageText}`,
|
|
49
|
+
ariaLabel: `${
|
|
43
50
|
themeLocale.value.selectLanguageAriaLabel ??
|
|
44
|
-
themeLocale.value.selectLanguageText
|
|
45
|
-
|
|
51
|
+
themeLocale.value.selectLanguageText
|
|
52
|
+
}`,
|
|
46
53
|
children: localePaths.map((targetLocalePath) => {
|
|
47
54
|
// target locale config of this language link
|
|
48
|
-
const targetSiteLocale =
|
|
49
|
-
|
|
50
|
-
const targetThemeLocale =
|
|
51
|
-
themeLocale.value.locales?.[targetLocalePath] ?? {}
|
|
55
|
+
const targetSiteLocale = site.value.locales?.[targetLocalePath] ?? {}
|
|
56
|
+
const targetThemeLocale = theme.value.locales?.[targetLocalePath] ?? {}
|
|
52
57
|
const targetLang = `${targetSiteLocale.lang}`
|
|
53
58
|
|
|
54
59
|
const text = targetThemeLocale.selectLanguageName ?? targetLang
|
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.64",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -36,25 +36,25 @@
|
|
|
36
36
|
"templates"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@vueuse/core": "^10.1
|
|
40
|
-
"sass": "^1.
|
|
41
|
-
"sass-loader": "^13.
|
|
42
|
-
"vue": "^3.3.
|
|
43
|
-
"vue-router": "^4.2.
|
|
44
|
-
"@vuepress/
|
|
45
|
-
"@vuepress/
|
|
46
|
-
"@vuepress/
|
|
47
|
-
"@vuepress/plugin-
|
|
48
|
-
"@vuepress/plugin-
|
|
49
|
-
"@vuepress/plugin-
|
|
50
|
-
"@vuepress/plugin-
|
|
51
|
-
"@vuepress/plugin-
|
|
52
|
-
"@vuepress/
|
|
53
|
-
"@vuepress/plugin-
|
|
54
|
-
"@vuepress/
|
|
55
|
-
"@vuepress/plugin-
|
|
56
|
-
"@vuepress/
|
|
57
|
-
"@vuepress/
|
|
39
|
+
"@vueuse/core": "^10.2.1",
|
|
40
|
+
"sass": "^1.63.6",
|
|
41
|
+
"sass-loader": "^13.3.2",
|
|
42
|
+
"vue": "^3.3.4",
|
|
43
|
+
"vue-router": "^4.2.2",
|
|
44
|
+
"@vuepress/core": "2.0.0-beta.64",
|
|
45
|
+
"@vuepress/plugin-back-to-top": "2.0.0-beta.64",
|
|
46
|
+
"@vuepress/client": "2.0.0-beta.64",
|
|
47
|
+
"@vuepress/plugin-container": "2.0.0-beta.64",
|
|
48
|
+
"@vuepress/plugin-git": "2.0.0-beta.64",
|
|
49
|
+
"@vuepress/plugin-external-link-icon": "2.0.0-beta.64",
|
|
50
|
+
"@vuepress/plugin-nprogress": "2.0.0-beta.64",
|
|
51
|
+
"@vuepress/plugin-active-header-links": "2.0.0-beta.64",
|
|
52
|
+
"@vuepress/plugin-palette": "2.0.0-beta.64",
|
|
53
|
+
"@vuepress/plugin-medium-zoom": "2.0.0-beta.64",
|
|
54
|
+
"@vuepress/plugin-prismjs": "2.0.0-beta.64",
|
|
55
|
+
"@vuepress/plugin-theme-data": "2.0.0-beta.64",
|
|
56
|
+
"@vuepress/shared": "2.0.0-beta.64",
|
|
57
|
+
"@vuepress/utils": "2.0.0-beta.64"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"sass-loader": "^13.2.1"
|