@vuepress/theme-default 2.0.0-beta.62 → 2.0.0-beta.63

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.
@@ -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 { useRouteLocale, useSiteLocaleData } from '@vuepress/client'
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(siteLocale.value.locales)
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 ?? 'unknown language',
42
- ariaLabel:
48
+ text: `${themeLocale.value.selectLanguageText}`,
49
+ ariaLabel: `${
43
50
  themeLocale.value.selectLanguageAriaLabel ??
44
- themeLocale.value.selectLanguageText ??
45
- 'unknown language',
51
+ themeLocale.value.selectLanguageText
52
+ }`,
46
53
  children: localePaths.map((targetLocalePath) => {
47
54
  // target locale config of this language link
48
- const targetSiteLocale =
49
- siteLocale.value.locales?.[targetLocalePath] ?? {}
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.62",
3
+ "version": "2.0.0-beta.63",
4
4
  "description": "Default theme of VuePress",
5
5
  "keywords": [
6
6
  "vuepress-theme",
@@ -37,24 +37,24 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "@vueuse/core": "^10.1.2",
40
- "sass": "^1.62.1",
41
- "sass-loader": "^13.2.2",
42
- "vue": "^3.3.1",
43
- "vue-router": "^4.2.0",
44
- "@vuepress/client": "2.0.0-beta.62",
45
- "@vuepress/core": "2.0.0-beta.62",
46
- "@vuepress/plugin-container": "2.0.0-beta.62",
47
- "@vuepress/plugin-git": "2.0.0-beta.62",
48
- "@vuepress/plugin-active-header-links": "2.0.0-beta.62",
49
- "@vuepress/plugin-back-to-top": "2.0.0-beta.62",
50
- "@vuepress/plugin-palette": "2.0.0-beta.62",
51
- "@vuepress/plugin-theme-data": "2.0.0-beta.62",
52
- "@vuepress/shared": "2.0.0-beta.62",
53
- "@vuepress/plugin-prismjs": "2.0.0-beta.62",
54
- "@vuepress/utils": "2.0.0-beta.62",
55
- "@vuepress/plugin-medium-zoom": "2.0.0-beta.62",
56
- "@vuepress/plugin-nprogress": "2.0.0-beta.62",
57
- "@vuepress/plugin-external-link-icon": "2.0.0-beta.62"
40
+ "sass": "^1.63.2",
41
+ "sass-loader": "^13.3.1",
42
+ "vue": "^3.3.4",
43
+ "vue-router": "^4.2.2",
44
+ "@vuepress/client": "2.0.0-beta.63",
45
+ "@vuepress/plugin-back-to-top": "2.0.0-beta.63",
46
+ "@vuepress/plugin-active-header-links": "2.0.0-beta.63",
47
+ "@vuepress/plugin-container": "2.0.0-beta.63",
48
+ "@vuepress/plugin-external-link-icon": "2.0.0-beta.63",
49
+ "@vuepress/plugin-medium-zoom": "2.0.0-beta.63",
50
+ "@vuepress/plugin-git": "2.0.0-beta.63",
51
+ "@vuepress/plugin-nprogress": "2.0.0-beta.63",
52
+ "@vuepress/core": "2.0.0-beta.63",
53
+ "@vuepress/plugin-palette": "2.0.0-beta.63",
54
+ "@vuepress/plugin-prismjs": "2.0.0-beta.63",
55
+ "@vuepress/utils": "2.0.0-beta.63",
56
+ "@vuepress/plugin-theme-data": "2.0.0-beta.63",
57
+ "@vuepress/shared": "2.0.0-beta.63"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "sass-loader": "^13.2.1"