@vuepress/theme-default 2.0.0-beta.51 → 2.0.0-beta.53
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/HomeHero.vue +5 -4
- package/lib/client/components/Navbar.vue +1 -1
- package/lib/client/components/NavbarItems.vue +25 -2
- package/lib/client/components/global/CodeGroup.d.ts +1 -1
- package/lib/client/styles/_variables.scss +0 -5
- package/lib/client/styles/code.scss +1 -8
- package/lib/client/styles/layout.scss +8 -7
- package/lib/client/styles/navbar-dropdown.scss +2 -6
- package/lib/client/styles/navbar.scss +21 -15
- package/lib/node/defaultTheme.js +0 -2
- package/lib/shared/page.d.ts +1 -0
- package/package.json +21 -19
- package/templates/build.html +1 -1
|
@@ -22,6 +22,10 @@ const heroImage = computed(() => {
|
|
|
22
22
|
}
|
|
23
23
|
return frontmatter.value.heroImage
|
|
24
24
|
})
|
|
25
|
+
const heroAlt = computed(
|
|
26
|
+
() => frontmatter.value.heroAlt || heroText.value || 'hero'
|
|
27
|
+
)
|
|
28
|
+
const heroHeight = computed(() => frontmatter.value.heroHeight || 280)
|
|
25
29
|
|
|
26
30
|
const heroText = computed(() => {
|
|
27
31
|
if (frontmatter.value.heroText === null) {
|
|
@@ -30,10 +34,6 @@ const heroText = computed(() => {
|
|
|
30
34
|
return frontmatter.value.heroText || siteLocale.value.title || 'Hello'
|
|
31
35
|
})
|
|
32
36
|
|
|
33
|
-
const heroAlt = computed(
|
|
34
|
-
() => frontmatter.value.heroAlt || heroText.value || 'hero'
|
|
35
|
-
)
|
|
36
|
-
|
|
37
37
|
const tagline = computed(() => {
|
|
38
38
|
if (frontmatter.value.tagline === null) {
|
|
39
39
|
return null
|
|
@@ -62,6 +62,7 @@ const HomeHeroImage: FunctionalComponent = () => {
|
|
|
62
62
|
const img = h('img', {
|
|
63
63
|
src: withBase(heroImage.value),
|
|
64
64
|
alt: heroAlt.value,
|
|
65
|
+
height: heroHeight.value,
|
|
65
66
|
})
|
|
66
67
|
if (frontmatter.value.heroImageDark === undefined) {
|
|
67
68
|
return img
|
|
@@ -32,7 +32,7 @@ onMounted(() => {
|
|
|
32
32
|
getCssValue(navbar.value, 'paddingLeft') +
|
|
33
33
|
getCssValue(navbar.value, 'paddingRight')
|
|
34
34
|
const handleLinksWrapWidth = (): void => {
|
|
35
|
-
if (window.innerWidth
|
|
35
|
+
if (window.innerWidth < MOBILE_DESKTOP_BREAKPOINT) {
|
|
36
36
|
linksWrapperMaxWidth.value = 0
|
|
37
37
|
} else {
|
|
38
38
|
linksWrapperMaxWidth.value =
|
|
@@ -3,7 +3,7 @@ import AutoLink from '@theme/AutoLink.vue'
|
|
|
3
3
|
import NavbarDropdown from '@theme/NavbarDropdown.vue'
|
|
4
4
|
import { useRouteLocale, useSiteLocaleData } from '@vuepress/client'
|
|
5
5
|
import { isLinkHttp, isString } from '@vuepress/shared'
|
|
6
|
-
import { computed } from 'vue'
|
|
6
|
+
import { computed, onMounted, ref } from 'vue'
|
|
7
7
|
import type { ComputedRef } from 'vue'
|
|
8
8
|
import { useRouter } from 'vue-router'
|
|
9
9
|
import type {
|
|
@@ -143,6 +143,7 @@ const useNavbarConfig = (): ComputedRef<ResolvedNavbarItem[]> => {
|
|
|
143
143
|
return computed(() => (themeLocale.value.navbar || []).map(resolveNavbarItem))
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
const isMobile = ref(false)
|
|
146
147
|
const navbarConfig = useNavbarConfig()
|
|
147
148
|
const navbarSelectLanguage = useNavbarSelectLanguage()
|
|
148
149
|
const navbarRepo = useNavbarRepo()
|
|
@@ -151,12 +152,34 @@ const navbarLinks = computed(() => [
|
|
|
151
152
|
...navbarSelectLanguage.value,
|
|
152
153
|
...navbarRepo.value,
|
|
153
154
|
])
|
|
155
|
+
|
|
156
|
+
// avoid overlapping of long title and long navbar links
|
|
157
|
+
onMounted(() => {
|
|
158
|
+
// TODO: migrate to css var
|
|
159
|
+
// refer to _variables.scss
|
|
160
|
+
const MOBILE_DESKTOP_BREAKPOINT = 719
|
|
161
|
+
|
|
162
|
+
const handleMobile = (): void => {
|
|
163
|
+
if (window.innerWidth < MOBILE_DESKTOP_BREAKPOINT) {
|
|
164
|
+
isMobile.value = true
|
|
165
|
+
} else {
|
|
166
|
+
isMobile.value = false
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
handleMobile()
|
|
170
|
+
window.addEventListener('resize', handleMobile, false)
|
|
171
|
+
window.addEventListener('orientationchange', handleMobile, false)
|
|
172
|
+
})
|
|
154
173
|
</script>
|
|
155
174
|
|
|
156
175
|
<template>
|
|
157
176
|
<nav v-if="navbarLinks.length" class="navbar-items">
|
|
158
177
|
<div v-for="item in navbarLinks" :key="item.text" class="navbar-item">
|
|
159
|
-
<NavbarDropdown
|
|
178
|
+
<NavbarDropdown
|
|
179
|
+
v-if="item.children"
|
|
180
|
+
:item="item"
|
|
181
|
+
:class="isMobile ? 'mobile' : ''"
|
|
182
|
+
/>
|
|
160
183
|
<AutoLink v-else :item="item" />
|
|
161
184
|
</div>
|
|
162
185
|
</nav>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { VNode } from 'vue';
|
|
2
2
|
export declare const CodeGroup: import("vue").DefineComponent<{}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
3
3
|
[key: string]: any;
|
|
4
|
-
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
4
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
@@ -4,8 +4,3 @@
|
|
|
4
4
|
$MQNarrow: 959px !default;
|
|
5
5
|
$MQMobile: 719px !default;
|
|
6
6
|
$MQMobileNarrow: 419px !default;
|
|
7
|
-
|
|
8
|
-
// code languages
|
|
9
|
-
$codeLang: 'c' 'cpp' 'cs' 'css' 'dart' 'docker' 'fs' 'go' 'html' 'java' 'js'
|
|
10
|
-
'json' 'kt' 'less' 'makefile' 'md' 'php' 'py' 'rb' 'rs' 'sass' 'scss' 'sh'
|
|
11
|
-
'styl' 'ts' 'toml' 'vue' 'yml' !default;
|
|
@@ -152,6 +152,7 @@ div[class*='language-'] {
|
|
|
152
152
|
border-radius: 6px;
|
|
153
153
|
|
|
154
154
|
&::before {
|
|
155
|
+
content: attr(data-ext);
|
|
155
156
|
position: absolute;
|
|
156
157
|
z-index: 3;
|
|
157
158
|
top: 0.8em;
|
|
@@ -247,14 +248,6 @@ div[class*='language-'] {
|
|
|
247
248
|
}
|
|
248
249
|
}
|
|
249
250
|
|
|
250
|
-
@each $lang in $codeLang {
|
|
251
|
-
div[class*='language-'].ext-#{$lang} {
|
|
252
|
-
&:before {
|
|
253
|
-
content: '' + $lang;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
251
|
// narrow mobile
|
|
259
252
|
@media (max-width: $MQMobileNarrow) {
|
|
260
253
|
.theme-default-content {
|
|
@@ -107,16 +107,17 @@
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
+
.theme-container.no-sidebar {
|
|
111
|
+
.sidebar {
|
|
112
|
+
display: none;
|
|
110
113
|
|
|
111
|
-
@media (
|
|
112
|
-
|
|
113
|
-
.sidebar {
|
|
114
|
-
display: none;
|
|
114
|
+
@media (max-width: $MQMobile) {
|
|
115
|
+
display: block;
|
|
115
116
|
}
|
|
117
|
+
}
|
|
116
118
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
119
|
+
.page {
|
|
120
|
+
padding-left: 0;
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
|
|
@@ -108,10 +108,8 @@
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
}
|
|
112
111
|
|
|
113
|
-
|
|
114
|
-
.navbar-dropdown-wrapper {
|
|
112
|
+
&.mobile {
|
|
115
113
|
&.open .navbar-dropdown-title {
|
|
116
114
|
margin-bottom: 0.5rem;
|
|
117
115
|
}
|
|
@@ -148,10 +146,8 @@
|
|
|
148
146
|
}
|
|
149
147
|
}
|
|
150
148
|
}
|
|
151
|
-
}
|
|
152
149
|
|
|
153
|
-
|
|
154
|
-
.navbar-dropdown-wrapper {
|
|
150
|
+
&:not(.mobile) {
|
|
155
151
|
height: 1.8rem;
|
|
156
152
|
|
|
157
153
|
&:hover .navbar-dropdown,
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
|
|
70
70
|
&:hover,
|
|
71
71
|
&.router-link-active {
|
|
72
|
-
color: var(--c-text
|
|
72
|
+
color: var(--c-text);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -82,6 +82,14 @@
|
|
|
82
82
|
&:first-child {
|
|
83
83
|
margin-left: 0;
|
|
84
84
|
}
|
|
85
|
+
|
|
86
|
+
> a {
|
|
87
|
+
&:hover,
|
|
88
|
+
&.router-link-active {
|
|
89
|
+
margin-bottom: -2px;
|
|
90
|
+
border-bottom: 2px solid var(--c-text-accent);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
85
93
|
}
|
|
86
94
|
}
|
|
87
95
|
|
|
@@ -89,23 +97,21 @@
|
|
|
89
97
|
.navbar-items {
|
|
90
98
|
.navbar-item {
|
|
91
99
|
margin-left: 0;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
100
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
> a {
|
|
102
|
+
&:hover,
|
|
103
|
+
&.router-link-active {
|
|
104
|
+
margin-bottom: 0;
|
|
105
|
+
border-bottom: none;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
101
108
|
}
|
|
102
|
-
}
|
|
103
109
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
110
|
+
a {
|
|
111
|
+
&:hover,
|
|
112
|
+
&.router-link-active {
|
|
113
|
+
color: var(--c-text-accent);
|
|
114
|
+
}
|
|
109
115
|
}
|
|
110
116
|
}
|
|
111
117
|
}
|
package/lib/node/defaultTheme.js
CHANGED
|
@@ -25,8 +25,6 @@ export const defaultTheme = ({ themePlugins = {}, ...localeOptions } = {}) => {
|
|
|
25
25
|
`@theme/${file}`,
|
|
26
26
|
path.resolve(__dirname, '../client/components', file),
|
|
27
27
|
])),
|
|
28
|
-
// workaround for https://github.com/vitejs/vite/issues/7621
|
|
29
|
-
'@vuepress/theme-default/client': path.resolve(__dirname, '../client/index.js'),
|
|
30
28
|
},
|
|
31
29
|
clientConfigFile: path.resolve(__dirname, '../client/config.js'),
|
|
32
30
|
extendsPage: (page) => {
|
package/lib/shared/page.d.ts
CHANGED
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.53",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
"./client": "./lib/client/index.js",
|
|
25
25
|
"./components/*": "./lib/client/components/*",
|
|
26
26
|
"./layouts/*": "./lib/client/layouts/*",
|
|
27
|
+
"./styles/*": "./lib/client/styles/*",
|
|
27
28
|
"./templates/*": "./templates/*",
|
|
29
|
+
"./lib/*": "./lib/*",
|
|
28
30
|
"./package.json": "./package.json"
|
|
29
31
|
},
|
|
30
32
|
"main": "./lib/node/index.js",
|
|
@@ -34,24 +36,24 @@
|
|
|
34
36
|
"templates"
|
|
35
37
|
],
|
|
36
38
|
"dependencies": {
|
|
37
|
-
"@vuepress/client": "2.0.0-beta.
|
|
38
|
-
"@vuepress/core": "2.0.0-beta.
|
|
39
|
-
"@vuepress/plugin-active-header-links": "2.0.0-beta.
|
|
40
|
-
"@vuepress/plugin-back-to-top": "2.0.0-beta.
|
|
41
|
-
"@vuepress/plugin-container": "2.0.0-beta.
|
|
42
|
-
"@vuepress/plugin-external-link-icon": "2.0.0-beta.
|
|
43
|
-
"@vuepress/plugin-git": "2.0.0-beta.
|
|
44
|
-
"@vuepress/plugin-medium-zoom": "2.0.0-beta.
|
|
45
|
-
"@vuepress/plugin-nprogress": "2.0.0-beta.
|
|
46
|
-
"@vuepress/plugin-palette": "2.0.0-beta.
|
|
47
|
-
"@vuepress/plugin-prismjs": "2.0.0-beta.
|
|
48
|
-
"@vuepress/plugin-theme-data": "2.0.0-beta.
|
|
49
|
-
"@vuepress/shared": "2.0.0-beta.
|
|
50
|
-
"@vuepress/utils": "2.0.0-beta.
|
|
51
|
-
"@vueuse/core": "^9.1
|
|
52
|
-
"sass": "^1.
|
|
53
|
-
"vue": "^3.2.
|
|
54
|
-
"vue-router": "^4.1.
|
|
39
|
+
"@vuepress/client": "2.0.0-beta.53",
|
|
40
|
+
"@vuepress/core": "2.0.0-beta.53",
|
|
41
|
+
"@vuepress/plugin-active-header-links": "2.0.0-beta.53",
|
|
42
|
+
"@vuepress/plugin-back-to-top": "2.0.0-beta.53",
|
|
43
|
+
"@vuepress/plugin-container": "2.0.0-beta.53",
|
|
44
|
+
"@vuepress/plugin-external-link-icon": "2.0.0-beta.53",
|
|
45
|
+
"@vuepress/plugin-git": "2.0.0-beta.53",
|
|
46
|
+
"@vuepress/plugin-medium-zoom": "2.0.0-beta.53",
|
|
47
|
+
"@vuepress/plugin-nprogress": "2.0.0-beta.53",
|
|
48
|
+
"@vuepress/plugin-palette": "2.0.0-beta.53",
|
|
49
|
+
"@vuepress/plugin-prismjs": "2.0.0-beta.53",
|
|
50
|
+
"@vuepress/plugin-theme-data": "2.0.0-beta.53",
|
|
51
|
+
"@vuepress/shared": "2.0.0-beta.53",
|
|
52
|
+
"@vuepress/utils": "2.0.0-beta.53",
|
|
53
|
+
"@vueuse/core": "^9.3.1",
|
|
54
|
+
"sass": "^1.55.0",
|
|
55
|
+
"vue": "^3.2.41",
|
|
56
|
+
"vue-router": "^4.1.6"
|
|
55
57
|
},
|
|
56
58
|
"peerDependencies": {
|
|
57
59
|
"sass-loader": "^13.0.2"
|