@vuepress/theme-default 2.0.0-rc.55 → 2.0.0-rc.57
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/VPHome.vue +1 -1
- package/lib/client/components/VPHomeFeatures.vue +1 -1
- package/lib/client/components/VPHomeHero.vue +1 -1
- package/lib/client/components/VPNavbar.vue +1 -1
- package/lib/client/components/VPNavbarBrand.vue +1 -1
- package/lib/client/components/VPNavbarDropdown.vue +36 -22
- package/lib/client/components/VPNavbarItems.vue +2 -2
- package/lib/client/components/VPPage.vue +4 -2
- package/lib/client/components/VPPageMeta.vue +9 -7
- package/lib/client/components/VPPageNav.vue +1 -1
- package/lib/client/components/VPSidebar.vue +1 -1
- package/lib/client/components/VPSidebarItem.vue +1 -1
- package/lib/client/components/VPSidebarItems.vue +1 -1
- package/lib/client/components/VPToggleSidebarButton.vue +1 -1
- package/lib/client/layouts/Layout.vue +1 -1
- package/lib/client/styles/_mixins.scss +1 -1
- package/lib/client/styles/_variables.module.scss +1 -1
- package/lib/client/styles/_variables.scss +1 -1
- package/lib/client/styles/code-group.scss +1 -1
- package/lib/client/styles/content/code.scss +1 -1
- package/lib/client/styles/content/normalize.scss +1 -1
- package/lib/client/styles/external-link-icon.scss +0 -1
- package/lib/client/styles/layout.scss +1 -1
- package/lib/client/styles/plugins.scss +1 -1
- package/lib/node/defaultTheme.js +1 -27
- package/package.json +19 -19
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import VPDropdownTransition from '@theme/VPDropdownTransition.vue'
|
|
3
|
-
import {
|
|
3
|
+
import { useToggle } from '@vueuse/core'
|
|
4
|
+
import { computed, toRefs, watch } from 'vue'
|
|
4
5
|
import { AutoLink, useRoute } from 'vuepress/client'
|
|
5
6
|
import type { AutoLinkOptions, NavGroup } from '../../shared/index.js'
|
|
6
7
|
|
|
7
8
|
const props = defineProps<{
|
|
8
|
-
/** dropdown
|
|
9
|
-
|
|
9
|
+
/** dropdown config */
|
|
10
|
+
config: NavGroup<AutoLinkOptions | NavGroup<AutoLinkOptions>>
|
|
10
11
|
}>()
|
|
11
12
|
|
|
12
|
-
const {
|
|
13
|
+
const { config } = toRefs(props)
|
|
13
14
|
const route = useRoute()
|
|
14
15
|
|
|
15
|
-
const open =
|
|
16
|
+
const [open, toggleOpen] = useToggle(false)
|
|
16
17
|
|
|
17
18
|
const dropdownAriaLabel = computed(
|
|
18
|
-
() =>
|
|
19
|
+
() => config.value.ariaLabel || config.value.text,
|
|
19
20
|
)
|
|
20
21
|
|
|
21
22
|
const isLastItemOfArray = (arrayItem: unknown, array: unknown[]): boolean =>
|
|
@@ -30,15 +31,14 @@ const isLastItemOfArray = (arrayItem: unknown, array: unknown[]): boolean =>
|
|
|
30
31
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
|
|
31
32
|
*/
|
|
32
33
|
const handleDropdown = (e: UIEvent): void => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
open.value = isTriggerByTab ? !open.value : false
|
|
34
|
+
if (e.detail === 0) toggleOpen()
|
|
35
|
+
else toggleOpen(false)
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
watch(
|
|
39
39
|
() => route.path,
|
|
40
40
|
() => {
|
|
41
|
-
|
|
41
|
+
toggleOpen(false)
|
|
42
42
|
},
|
|
43
43
|
)
|
|
44
44
|
</script>
|
|
@@ -51,7 +51,7 @@ watch(
|
|
|
51
51
|
:aria-label="dropdownAriaLabel"
|
|
52
52
|
@click="handleDropdown"
|
|
53
53
|
>
|
|
54
|
-
<span class="title">{{
|
|
54
|
+
<span class="title">{{ config.text }}</span>
|
|
55
55
|
<span class="arrow down" />
|
|
56
56
|
</button>
|
|
57
57
|
|
|
@@ -59,16 +59,16 @@ watch(
|
|
|
59
59
|
class="vp-navbar-dropdown-title-mobile"
|
|
60
60
|
type="button"
|
|
61
61
|
:aria-label="dropdownAriaLabel"
|
|
62
|
-
@click="
|
|
62
|
+
@click="() => toggleOpen()"
|
|
63
63
|
>
|
|
64
|
-
<span class="title">{{
|
|
64
|
+
<span class="title">{{ config.text }}</span>
|
|
65
65
|
<span class="arrow" :class="open ? 'down' : 'right'" />
|
|
66
66
|
</button>
|
|
67
67
|
|
|
68
68
|
<VPDropdownTransition>
|
|
69
69
|
<ul v-show="open" class="vp-navbar-dropdown">
|
|
70
70
|
<li
|
|
71
|
-
v-for="child in
|
|
71
|
+
v-for="child in config.children"
|
|
72
72
|
:key="child.text"
|
|
73
73
|
class="vp-navbar-dropdown-item"
|
|
74
74
|
>
|
|
@@ -78,9 +78,14 @@ watch(
|
|
|
78
78
|
v-if="child.link"
|
|
79
79
|
:config="child"
|
|
80
80
|
@focusout="
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
() => {
|
|
82
|
+
if (
|
|
83
|
+
isLastItemOfArray(child, config.children) &&
|
|
84
|
+
child.children.length === 0
|
|
85
|
+
) {
|
|
86
|
+
open = false
|
|
87
|
+
}
|
|
88
|
+
}
|
|
84
89
|
"
|
|
85
90
|
/>
|
|
86
91
|
|
|
@@ -96,9 +101,14 @@ watch(
|
|
|
96
101
|
<AutoLink
|
|
97
102
|
:config="grandchild"
|
|
98
103
|
@focusout="
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
104
|
+
() => {
|
|
105
|
+
if (
|
|
106
|
+
isLastItemOfArray(grandchild, child.children) &&
|
|
107
|
+
isLastItemOfArray(child, config.children)
|
|
108
|
+
) {
|
|
109
|
+
toggleOpen(false)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
102
112
|
"
|
|
103
113
|
/>
|
|
104
114
|
</li>
|
|
@@ -109,7 +119,11 @@ watch(
|
|
|
109
119
|
<AutoLink
|
|
110
120
|
:config="child"
|
|
111
121
|
@focusout="
|
|
112
|
-
|
|
122
|
+
() => {
|
|
123
|
+
if (isLastItemOfArray(child, config.children)) {
|
|
124
|
+
toggleOpen(false)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
113
127
|
"
|
|
114
128
|
/>
|
|
115
129
|
</template>
|
|
@@ -121,7 +135,7 @@ watch(
|
|
|
121
135
|
|
|
122
136
|
<style lang="scss">
|
|
123
137
|
@use '../styles/mixins';
|
|
124
|
-
@
|
|
138
|
+
@use '../styles/variables' as *;
|
|
125
139
|
|
|
126
140
|
.vp-navbar-dropdown-wrapper {
|
|
127
141
|
cursor: pointer;
|
|
@@ -45,7 +45,7 @@ useUpdateDeviceStatus(
|
|
|
45
45
|
<VPNavbarDropdown
|
|
46
46
|
v-if="'children' in item"
|
|
47
47
|
:class="{ mobile: isMobile }"
|
|
48
|
-
:
|
|
48
|
+
:config="item"
|
|
49
49
|
/>
|
|
50
50
|
<AutoLink v-else :config="item" />
|
|
51
51
|
</div>
|
|
@@ -53,7 +53,7 @@ useUpdateDeviceStatus(
|
|
|
53
53
|
</template>
|
|
54
54
|
|
|
55
55
|
<style lang="scss">
|
|
56
|
-
@
|
|
56
|
+
@use '../styles/variables' as *;
|
|
57
57
|
|
|
58
58
|
.vp-navbar-items {
|
|
59
59
|
display: inline-block;
|
|
@@ -37,7 +37,7 @@ setupHeaders()
|
|
|
37
37
|
|
|
38
38
|
<style lang="scss">
|
|
39
39
|
@use '../styles/mixins';
|
|
40
|
-
@
|
|
40
|
+
@use '../styles/variables' as *;
|
|
41
41
|
|
|
42
42
|
.vp-page {
|
|
43
43
|
display: block;
|
|
@@ -64,7 +64,9 @@ setupHeaders()
|
|
|
64
64
|
.theme-default-content {
|
|
65
65
|
@include mixins.content-wrapper;
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
& {
|
|
68
|
+
padding-top: 0;
|
|
69
|
+
}
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
</style>
|
|
@@ -52,19 +52,21 @@ const contributors = useContributors()
|
|
|
52
52
|
|
|
53
53
|
<style lang="scss">
|
|
54
54
|
@use '../styles/mixins';
|
|
55
|
-
@
|
|
55
|
+
@use '../styles/variables' as *;
|
|
56
56
|
|
|
57
57
|
.vp-page-meta {
|
|
58
58
|
@include mixins.content-wrapper;
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
& {
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-wrap: wrap;
|
|
63
|
+
justify-content: space-between;
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
overflow: auto;
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
padding-top: 0.75rem;
|
|
68
|
+
padding-bottom: 0.75rem;
|
|
69
|
+
}
|
|
68
70
|
|
|
69
71
|
@media print {
|
|
70
72
|
margin: 0 !important;
|
package/lib/node/defaultTheme.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { addViteOptimizeDepsExclude } from '@vuepress/helper';
|
|
2
2
|
import { activeHeaderLinksPlugin } from '@vuepress/plugin-active-header-links';
|
|
3
3
|
import { backToTopPlugin } from '@vuepress/plugin-back-to-top';
|
|
4
4
|
import { copyCodePlugin } from '@vuepress/plugin-copy-code';
|
|
@@ -42,32 +42,6 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
|
|
|
42
42
|
},
|
|
43
43
|
clientConfigFile: path.resolve(__dirname, '../client/config.js'),
|
|
44
44
|
extendsBundlerOptions: (bundlerOptions, app) => {
|
|
45
|
-
// FIXME: hide sass deprecation warning for mixed-decls
|
|
46
|
-
addViteConfig(bundlerOptions, app, {
|
|
47
|
-
css: {
|
|
48
|
-
preprocessorOptions: {
|
|
49
|
-
sass: {
|
|
50
|
-
silenceDeprecations: ['mixed-decls'],
|
|
51
|
-
},
|
|
52
|
-
scss: {
|
|
53
|
-
silenceDeprecations: ['mixed-decls'],
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
chainWebpack(bundlerOptions, app, (config) => {
|
|
59
|
-
config.module
|
|
60
|
-
.rule('scss')
|
|
61
|
-
.use('sass-loader')
|
|
62
|
-
.tap((options) => ({
|
|
63
|
-
...options,
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
65
|
-
sassOptions: {
|
|
66
|
-
silenceDeprecations: ['mixed-decls'],
|
|
67
|
-
...options.sassOptions,
|
|
68
|
-
},
|
|
69
|
-
}));
|
|
70
|
-
});
|
|
71
45
|
// ensure theme alias is not optimized by Vite
|
|
72
46
|
addViteOptimizeDepsExclude(bundlerOptions, app, '@theme');
|
|
73
47
|
},
|
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.57",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -37,28 +37,28 @@
|
|
|
37
37
|
"templates"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@vuepress/helper": "2.0.0-rc.
|
|
40
|
+
"@vuepress/helper": "2.0.0-rc.57",
|
|
41
41
|
"@vuepress/plugin-active-header-links": "2.0.0-rc.55",
|
|
42
|
-
"@vuepress/plugin-back-to-top": "2.0.0-rc.
|
|
43
|
-
"@vuepress/plugin-copy-code": "2.0.0-rc.
|
|
44
|
-
"@vuepress/plugin-git": "2.0.0-rc.
|
|
45
|
-
"@vuepress/plugin-links-check": "2.0.0-rc.
|
|
46
|
-
"@vuepress/plugin-markdown-hint": "2.0.0-rc.
|
|
47
|
-
"@vuepress/plugin-markdown-tab": "2.0.0-rc.
|
|
48
|
-
"@vuepress/plugin-medium-zoom": "2.0.0-rc.
|
|
49
|
-
"@vuepress/plugin-nprogress": "2.0.0-rc.
|
|
50
|
-
"@vuepress/plugin-palette": "2.0.0-rc.
|
|
51
|
-
"@vuepress/plugin-prismjs": "2.0.0-rc.
|
|
52
|
-
"@vuepress/plugin-seo": "2.0.0-rc.
|
|
53
|
-
"@vuepress/plugin-sitemap": "2.0.0-rc.
|
|
54
|
-
"@vuepress/plugin-theme-data": "2.0.0-rc.
|
|
42
|
+
"@vuepress/plugin-back-to-top": "2.0.0-rc.57",
|
|
43
|
+
"@vuepress/plugin-copy-code": "2.0.0-rc.57",
|
|
44
|
+
"@vuepress/plugin-git": "2.0.0-rc.56",
|
|
45
|
+
"@vuepress/plugin-links-check": "2.0.0-rc.57",
|
|
46
|
+
"@vuepress/plugin-markdown-hint": "2.0.0-rc.57",
|
|
47
|
+
"@vuepress/plugin-markdown-tab": "2.0.0-rc.57",
|
|
48
|
+
"@vuepress/plugin-medium-zoom": "2.0.0-rc.57",
|
|
49
|
+
"@vuepress/plugin-nprogress": "2.0.0-rc.57",
|
|
50
|
+
"@vuepress/plugin-palette": "2.0.0-rc.57",
|
|
51
|
+
"@vuepress/plugin-prismjs": "2.0.0-rc.57",
|
|
52
|
+
"@vuepress/plugin-seo": "2.0.0-rc.57",
|
|
53
|
+
"@vuepress/plugin-sitemap": "2.0.0-rc.57",
|
|
54
|
+
"@vuepress/plugin-theme-data": "2.0.0-rc.57",
|
|
55
55
|
"@vueuse/core": "^11.1.0",
|
|
56
56
|
"vue": "^3.5.12"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"sass": "^1.
|
|
60
|
-
"sass-embedded": "^1.
|
|
61
|
-
"sass-loader": "^16.0.
|
|
59
|
+
"sass": "^1.80.3",
|
|
60
|
+
"sass-embedded": "^1.80.3",
|
|
61
|
+
"sass-loader": "^16.0.2",
|
|
62
62
|
"vuepress": "2.0.0-rc.18"
|
|
63
63
|
},
|
|
64
64
|
"peerDependenciesMeta": {
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "9867ed9acd94e6faa16ecea31cccfb0c37da8f50"
|
|
79
79
|
}
|