@vuepress/theme-default 2.0.0-rc.18 → 2.0.0-rc.19
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.
|
@@ -63,13 +63,6 @@ const shouldBeActiveInSubpath = computed(() => {
|
|
|
63
63
|
}
|
|
64
64
|
return item.value.link !== '/'
|
|
65
65
|
})
|
|
66
|
-
// if this link is active in subpath
|
|
67
|
-
const isActiveInSubpath = computed(() => {
|
|
68
|
-
if (!shouldBeActiveInSubpath.value) {
|
|
69
|
-
return false
|
|
70
|
-
}
|
|
71
|
-
return route.path.startsWith(item.value.link)
|
|
72
|
-
})
|
|
73
66
|
|
|
74
67
|
// if this link is active
|
|
75
68
|
const isActive = computed(() => {
|
|
@@ -79,7 +72,13 @@ const isActive = computed(() => {
|
|
|
79
72
|
if (item.value.activeMatch) {
|
|
80
73
|
return new RegExp(item.value.activeMatch).test(route.path)
|
|
81
74
|
}
|
|
82
|
-
|
|
75
|
+
|
|
76
|
+
if (!shouldBeActiveInSubpath.value) {
|
|
77
|
+
return false
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// if this link is active in subpath
|
|
81
|
+
return route.path.startsWith(item.value.link)
|
|
83
82
|
})
|
|
84
83
|
</script>
|
|
85
84
|
|
|
@@ -58,31 +58,31 @@ const useNavbarSelectLanguage = (): ComputedRef<ResolvedNavbarItem[]> => {
|
|
|
58
58
|
const targetLang = `${targetSiteLocale.lang}`
|
|
59
59
|
|
|
60
60
|
const text = targetThemeLocale.selectLanguageName ?? targetLang
|
|
61
|
-
let link
|
|
62
61
|
|
|
62
|
+
// if the target language is current language
|
|
63
|
+
// stay at current link
|
|
63
64
|
if (targetLang === siteLocale.value.lang) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// if the target language is not current language
|
|
69
|
-
// try to link to the corresponding page of current page
|
|
70
|
-
// or fallback to homepage
|
|
71
|
-
const targetLocalePage = currentPath.replace(
|
|
72
|
-
routeLocale.value,
|
|
73
|
-
targetLocalePath,
|
|
74
|
-
)
|
|
75
|
-
if (routePaths.value.some((item) => item === targetLocalePage)) {
|
|
76
|
-
// try to keep current hash and params across languages
|
|
77
|
-
link = currentFullPath.replace(currentPath, targetLocalePage)
|
|
78
|
-
} else {
|
|
79
|
-
link = targetThemeLocale.home ?? targetLocalePath
|
|
65
|
+
return {
|
|
66
|
+
text,
|
|
67
|
+
activeMatch: /./,
|
|
68
|
+
link: route.hash ?? '#',
|
|
80
69
|
}
|
|
81
70
|
}
|
|
82
71
|
|
|
72
|
+
// if the target language is not current language
|
|
73
|
+
// try to link to the corresponding page of current page
|
|
74
|
+
// or fallback to homepage
|
|
75
|
+
const targetLocalePage = currentPath.replace(
|
|
76
|
+
routeLocale.value,
|
|
77
|
+
targetLocalePath,
|
|
78
|
+
)
|
|
79
|
+
|
|
83
80
|
return {
|
|
84
81
|
text,
|
|
85
|
-
|
|
82
|
+
// try to keep current hash and params across languages
|
|
83
|
+
link: routePaths.value.some((item) => item === targetLocalePage)
|
|
84
|
+
? currentFullPath.replace(currentPath, targetLocalePage)
|
|
85
|
+
: targetThemeLocale.home ?? targetLocalePath,
|
|
86
86
|
}
|
|
87
87
|
}),
|
|
88
88
|
}
|
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.19",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -42,20 +42,20 @@
|
|
|
42
42
|
"copy": "cpx \"src/**/*.{d.ts,vue,scss}\" lib"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@vuepress/helper": "~2.0.0-rc.
|
|
45
|
+
"@vuepress/helper": "~2.0.0-rc.19",
|
|
46
46
|
"@vuepress/plugin-active-header-links": "~2.0.0-rc.18",
|
|
47
|
-
"@vuepress/plugin-back-to-top": "~2.0.0-rc.
|
|
47
|
+
"@vuepress/plugin-back-to-top": "~2.0.0-rc.19",
|
|
48
48
|
"@vuepress/plugin-container": "~2.0.0-rc.15",
|
|
49
|
-
"@vuepress/plugin-copy-code": "~2.0.0-rc.
|
|
49
|
+
"@vuepress/plugin-copy-code": "~2.0.0-rc.19",
|
|
50
50
|
"@vuepress/plugin-external-link-icon": "~2.0.0-rc.18",
|
|
51
51
|
"@vuepress/plugin-git": "~2.0.0-rc.15",
|
|
52
|
-
"@vuepress/plugin-links-check": "~2.0.0-rc.
|
|
53
|
-
"@vuepress/plugin-medium-zoom": "~2.0.0-rc.
|
|
52
|
+
"@vuepress/plugin-links-check": "~2.0.0-rc.19",
|
|
53
|
+
"@vuepress/plugin-medium-zoom": "~2.0.0-rc.19",
|
|
54
54
|
"@vuepress/plugin-nprogress": "~2.0.0-rc.18",
|
|
55
55
|
"@vuepress/plugin-palette": "~2.0.0-rc.15",
|
|
56
56
|
"@vuepress/plugin-prismjs": "~2.0.0-rc.15",
|
|
57
|
-
"@vuepress/plugin-seo": "~2.0.0-rc.
|
|
58
|
-
"@vuepress/plugin-sitemap": "~2.0.0-rc.
|
|
57
|
+
"@vuepress/plugin-seo": "~2.0.0-rc.19",
|
|
58
|
+
"@vuepress/plugin-sitemap": "~2.0.0-rc.19",
|
|
59
59
|
"@vuepress/plugin-theme-data": "~2.0.0-rc.18",
|
|
60
60
|
"@vueuse/core": "^10.9.0",
|
|
61
61
|
"sass": "^1.71.1",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "87d2e11058e583f3f61f85c50c0a0bf540a9a932"
|
|
77
77
|
}
|