@vuepress/theme-default 2.0.0-rc.10 → 2.0.0-rc.102
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/VPAutoLink.vue +35 -0
- package/lib/client/components/VPDarkIcon.vue +8 -0
- package/lib/client/components/VPDropdownTransition.vue +43 -0
- package/lib/client/components/VPEditIcon.vue +12 -0
- package/lib/client/components/VPFadeSlideYTransition.vue +23 -0
- package/lib/client/components/VPHome.vue +37 -0
- package/lib/client/components/VPHomeFeatures.vue +65 -0
- package/lib/client/components/VPHomeFooter.vue +30 -0
- package/lib/client/components/VPHomeHero.vue +186 -0
- package/lib/client/components/VPLightIcon.vue +28 -0
- package/lib/client/components/VPNavbar.vue +138 -0
- package/lib/client/components/{NavbarBrand.vue → VPNavbarBrand.vue} +39 -15
- package/lib/client/components/VPNavbarDropdown.vue +330 -0
- package/lib/client/components/VPNavbarItems.vue +111 -0
- package/lib/client/components/VPPage.vue +69 -0
- package/lib/client/components/VPPageMeta.vue +139 -0
- package/lib/client/components/VPPageNav.vue +123 -0
- package/lib/client/components/VPSidebar.vue +120 -0
- package/lib/client/components/VPSidebarItem.vue +189 -0
- package/lib/client/components/{SidebarItems.vue → VPSidebarItems.vue} +27 -7
- package/lib/client/components/VPToggleColorModeButton.vue +55 -0
- package/lib/client/components/VPToggleSidebarButton.vue +92 -0
- package/lib/client/components/global/Badge.vue +84 -18
- package/lib/client/components/global/index.d.ts +1 -3
- package/lib/client/components/global/index.js +1 -3
- package/lib/client/composables/index.d.ts +7 -1
- package/lib/client/composables/index.js +7 -1
- package/lib/client/composables/useDarkMode.d.ts +0 -1
- package/lib/client/composables/useDarkMode.js +19 -16
- package/lib/client/composables/useData.d.ts +8 -0
- package/lib/client/composables/useData.js +7 -0
- package/lib/client/composables/useEditLink.d.ts +3 -0
- package/lib/client/composables/useEditLink.js +28 -0
- package/lib/client/composables/useHeaders.d.ts +9 -0
- package/lib/client/composables/useHeaders.js +38 -0
- package/lib/client/composables/useNavbarConfig.d.ts +3 -0
- package/lib/client/composables/useNavbarConfig.js +29 -0
- package/lib/client/composables/useNavbarRepo.d.ts +6 -0
- package/lib/client/composables/useNavbarRepo.js +38 -0
- package/lib/client/composables/useNavbarSelectLanguage.d.ts +6 -0
- package/lib/client/composables/useNavbarSelectLanguage.js +55 -0
- package/lib/client/composables/useNavigate.d.ts +1 -0
- package/lib/client/composables/useNavigate.js +22 -0
- package/lib/client/composables/useRelatedLinks.d.ts +8 -0
- package/lib/client/composables/useRelatedLinks.js +90 -0
- package/lib/client/composables/useScrollPromise.js +3 -1
- package/lib/client/composables/useSidebarItems.d.ts +21 -20
- package/lib/client/composables/useSidebarItems.js +96 -85
- package/lib/client/composables/useUpdateDeviceStatus.d.ts +1 -1
- package/lib/client/composables/useUpdateDeviceStatus.js +10 -5
- package/lib/client/config.d.ts +3 -2
- package/lib/client/config.js +8 -23
- package/lib/client/index.d.ts +1 -0
- package/lib/client/layouts/Layout.vue +126 -56
- package/lib/client/layouts/NotFound.vue +24 -10
- package/lib/client/shim.d.ts +6 -5
- package/lib/client/styles/_mixins.scss +4 -4
- package/lib/client/styles/_variables.module.scss +1 -1
- package/lib/client/styles/_variables.scss +2 -1
- package/lib/client/styles/arrow.scss +24 -22
- package/lib/client/styles/code-group.scss +34 -30
- package/lib/client/styles/content/code.scss +23 -0
- package/lib/client/styles/content/index.scss +3 -0
- package/lib/client/styles/content/normalize.scss +39 -0
- package/lib/client/styles/{toc.scss → content/toc.scss} +1 -1
- package/lib/client/styles/external-link-icon.scss +36 -0
- package/lib/client/styles/index.scss +3 -13
- package/lib/client/styles/layout.scss +5 -197
- package/lib/client/styles/normalize.scss +1 -194
- package/lib/client/styles/plugins.scss +28 -0
- package/lib/client/styles/vars-dark.scss +20 -58
- package/lib/client/styles/vars.scss +54 -139
- package/lib/client/typings.d.ts +13 -0
- package/lib/client/typings.js +1 -0
- package/lib/client/utils/index.d.ts +2 -1
- package/lib/client/utils/index.js +2 -1
- package/lib/client/utils/isActiveSidebarItem.d.ts +3 -3
- package/lib/client/utils/isActiveSidebarItem.js +1 -1
- package/lib/client/utils/resolveAutoLink.d.ts +9 -0
- package/lib/client/utils/{getNavLink.js → resolveAutoLink.js} +3 -3
- package/lib/client/utils/resolveEditLink.d.ts +3 -3
- package/lib/client/utils/resolveEditLink.js +3 -3
- package/lib/client/utils/resolvePrefix.d.ts +1 -0
- package/lib/client/utils/resolvePrefix.js +4 -0
- package/lib/client/utils/resolveRepoType.d.ts +1 -1
- package/lib/client/utils/resolveRepoType.js +4 -4
- package/lib/node/defaultTheme.d.ts +2 -1
- package/lib/node/defaultTheme.js +57 -64
- package/lib/node/index.d.ts +1 -3
- package/lib/node/index.js +0 -3
- package/lib/node/typings.d.ts +59 -0
- package/lib/node/typings.js +1 -0
- package/lib/node/utils/assignDefaultLocaleOptions.js +3 -8
- package/lib/node/utils/index.d.ts +1 -1
- package/lib/node/utils/index.js +1 -1
- package/lib/node/utils/resolveMarkdownHintLocales.d.ts +9 -0
- package/lib/node/utils/resolveMarkdownHintLocales.js +19 -0
- package/lib/shared/index.d.ts +5 -3
- package/lib/shared/index.js +1 -3
- package/lib/shared/nav.d.ts +19 -30
- package/lib/shared/navbar.d.ts +21 -0
- package/lib/shared/navbar.js +1 -0
- package/lib/shared/options.d.ts +36 -66
- package/lib/shared/page.d.ts +9 -6
- package/lib/shared/sidebar.d.ts +26 -0
- package/lib/shared/sidebar.js +1 -0
- package/package.json +34 -27
- package/templates/build.html +16 -10
- package/lib/client/components/AutoLink.vue +0 -113
- package/lib/client/components/DropdownTransition.vue +0 -25
- package/lib/client/components/Home.vue +0 -15
- package/lib/client/components/HomeContent.vue +0 -5
- package/lib/client/components/HomeFeatures.vue +0 -22
- package/lib/client/components/HomeFooter.vue +0 -17
- package/lib/client/components/HomeHero.vue +0 -97
- package/lib/client/components/Navbar.vue +0 -79
- package/lib/client/components/NavbarDropdown.vue +0 -126
- package/lib/client/components/NavbarItems.vue +0 -194
- package/lib/client/components/Page.vue +0 -31
- package/lib/client/components/PageMeta.vue +0 -124
- package/lib/client/components/PageNav.vue +0 -122
- package/lib/client/components/Sidebar.vue +0 -18
- package/lib/client/components/SidebarItem.vue +0 -87
- package/lib/client/components/ToggleColorModeButton.vue +0 -57
- package/lib/client/components/ToggleSidebarButton.vue +0 -24
- package/lib/client/components/global/CodeGroup.d.ts +0 -6
- package/lib/client/components/global/CodeGroup.js +0 -120
- package/lib/client/components/global/CodeGroupItem.vue +0 -27
- package/lib/client/composables/useThemeData.d.ts +0 -4
- package/lib/client/composables/useThemeData.js +0 -3
- package/lib/client/styles/badge.scss +0 -36
- package/lib/client/styles/code.scss +0 -263
- package/lib/client/styles/custom-container.scss +0 -142
- package/lib/client/styles/home.scss +0 -168
- package/lib/client/styles/navbar-dropdown.scss +0 -183
- package/lib/client/styles/navbar.scss +0 -197
- package/lib/client/styles/page.scss +0 -87
- package/lib/client/styles/sidebar.scss +0 -134
- package/lib/client/styles/transitions.scss +0 -22
- package/lib/client/utils/getNavLink.d.ts +0 -9
- package/lib/node/utils/resolveContainerPluginOptions.d.ts +0 -8
- package/lib/node/utils/resolveContainerPluginOptions.js +0 -17
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import VPAutoLink from '@theme/VPAutoLink.vue'
|
|
3
|
+
import { FadeInExpandTransition } from '@vuepress/helper/client'
|
|
4
|
+
import { useToggle } from '@vueuse/core'
|
|
5
|
+
import { computed, toRefs } from 'vue'
|
|
6
|
+
import { onContentUpdated } from 'vuepress/client'
|
|
7
|
+
import type { AutoLinkOptions, NavGroup } from '../../shared/index.js'
|
|
8
|
+
|
|
9
|
+
import '@vuepress/helper/transition/fade-in-height-expand.css'
|
|
10
|
+
|
|
11
|
+
const props = defineProps<{
|
|
12
|
+
/** dropdown config */
|
|
13
|
+
config: NavGroup<AutoLinkOptions | NavGroup<AutoLinkOptions>>
|
|
14
|
+
}>()
|
|
15
|
+
|
|
16
|
+
const { config } = toRefs(props)
|
|
17
|
+
|
|
18
|
+
const [open, toggleOpen] = useToggle()
|
|
19
|
+
|
|
20
|
+
const dropdownAriaLabel = computed(
|
|
21
|
+
() => config.value.ariaLabel || config.value.text,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
const isLastItemOfArray = (arrayItem: unknown, array: unknown[]): boolean =>
|
|
25
|
+
array[array.length - 1] === arrayItem
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Open the dropdown when user tab and click from keyboard.
|
|
29
|
+
*
|
|
30
|
+
* Use event.detail to detect tab and click from keyboard.
|
|
31
|
+
* The Tab + Click is UIEvent > KeyboardEvent, so the detail is 0.
|
|
32
|
+
*
|
|
33
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
|
|
34
|
+
*/
|
|
35
|
+
const handleDropdown = (e: UIEvent): void => {
|
|
36
|
+
if (e.detail === 0) toggleOpen()
|
|
37
|
+
else toggleOpen(false)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
onContentUpdated(() => {
|
|
41
|
+
toggleOpen(false)
|
|
42
|
+
})
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<div class="vp-navbar-dropdown-wrapper" :class="{ open }">
|
|
47
|
+
<button
|
|
48
|
+
class="vp-navbar-dropdown-title"
|
|
49
|
+
type="button"
|
|
50
|
+
:aria-label="dropdownAriaLabel"
|
|
51
|
+
@click="handleDropdown"
|
|
52
|
+
>
|
|
53
|
+
<span class="title">{{ config.text }}</span>
|
|
54
|
+
<span class="arrow down" />
|
|
55
|
+
</button>
|
|
56
|
+
|
|
57
|
+
<button
|
|
58
|
+
class="vp-navbar-dropdown-title-mobile"
|
|
59
|
+
type="button"
|
|
60
|
+
:aria-label="dropdownAriaLabel"
|
|
61
|
+
@click="() => toggleOpen()"
|
|
62
|
+
>
|
|
63
|
+
<span class="title">{{ config.text }}</span>
|
|
64
|
+
<span class="arrow" :class="open ? 'down' : 'right'" />
|
|
65
|
+
</button>
|
|
66
|
+
|
|
67
|
+
<FadeInExpandTransition>
|
|
68
|
+
<ul v-show="open" class="vp-navbar-dropdown">
|
|
69
|
+
<li
|
|
70
|
+
v-for="child in config.children"
|
|
71
|
+
:key="child.text"
|
|
72
|
+
class="vp-navbar-dropdown-item"
|
|
73
|
+
>
|
|
74
|
+
<template v-if="'children' in child">
|
|
75
|
+
<h4 class="vp-navbar-dropdown-subtitle">
|
|
76
|
+
<VPAutoLink
|
|
77
|
+
v-if="child.link"
|
|
78
|
+
:config="child"
|
|
79
|
+
@focusout="
|
|
80
|
+
() => {
|
|
81
|
+
if (
|
|
82
|
+
isLastItemOfArray(child, config.children) &&
|
|
83
|
+
child.children.length === 0
|
|
84
|
+
) {
|
|
85
|
+
open = false
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
"
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
<span v-else>{{ child.text }}</span>
|
|
92
|
+
</h4>
|
|
93
|
+
|
|
94
|
+
<ul class="vp-navbar-dropdown-subitem-wrapper">
|
|
95
|
+
<li
|
|
96
|
+
v-for="grandchild in child.children"
|
|
97
|
+
:key="grandchild.link"
|
|
98
|
+
class="vp-navbar-dropdown-subitem"
|
|
99
|
+
>
|
|
100
|
+
<VPAutoLink
|
|
101
|
+
:config="grandchild"
|
|
102
|
+
@focusout="
|
|
103
|
+
() => {
|
|
104
|
+
if (
|
|
105
|
+
isLastItemOfArray(grandchild, child.children) &&
|
|
106
|
+
isLastItemOfArray(child, config.children)
|
|
107
|
+
) {
|
|
108
|
+
toggleOpen(false)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
"
|
|
112
|
+
/>
|
|
113
|
+
</li>
|
|
114
|
+
</ul>
|
|
115
|
+
</template>
|
|
116
|
+
|
|
117
|
+
<template v-else>
|
|
118
|
+
<VPAutoLink
|
|
119
|
+
:config="child"
|
|
120
|
+
@focusout="
|
|
121
|
+
() => {
|
|
122
|
+
if (isLastItemOfArray(child, config.children)) {
|
|
123
|
+
toggleOpen(false)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
"
|
|
127
|
+
/>
|
|
128
|
+
</template>
|
|
129
|
+
</li>
|
|
130
|
+
</ul>
|
|
131
|
+
</FadeInExpandTransition>
|
|
132
|
+
</div>
|
|
133
|
+
</template>
|
|
134
|
+
|
|
135
|
+
<style lang="scss">
|
|
136
|
+
@use '../styles/mixins';
|
|
137
|
+
@use '../styles/variables' as *;
|
|
138
|
+
|
|
139
|
+
.vp-navbar-dropdown-wrapper {
|
|
140
|
+
cursor: pointer;
|
|
141
|
+
|
|
142
|
+
&:not(.mobile) {
|
|
143
|
+
height: 1.8rem;
|
|
144
|
+
|
|
145
|
+
&:hover,
|
|
146
|
+
&.open {
|
|
147
|
+
.vp-navbar-dropdown {
|
|
148
|
+
// override the inline style.
|
|
149
|
+
display: block !important;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.vp-navbar-dropdown {
|
|
156
|
+
.vp-navbar-dropdown-wrapper.mobile & {
|
|
157
|
+
@include mixins.dropdown-wrapper;
|
|
158
|
+
|
|
159
|
+
padding-top: 0.5rem;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.vp-navbar-dropdown-wrapper:not(.mobile) & {
|
|
163
|
+
position: absolute;
|
|
164
|
+
inset-inline-end: 0;
|
|
165
|
+
top: 100%;
|
|
166
|
+
|
|
167
|
+
display: none;
|
|
168
|
+
|
|
169
|
+
overflow-y: auto;
|
|
170
|
+
|
|
171
|
+
box-sizing: border-box;
|
|
172
|
+
|
|
173
|
+
// Avoid height shake by clicking
|
|
174
|
+
height: auto !important;
|
|
175
|
+
max-height: calc(100vh - 2.7rem);
|
|
176
|
+
margin: 0;
|
|
177
|
+
padding: 0.6rem 0;
|
|
178
|
+
border: 1px solid var(--vp-c-gutter);
|
|
179
|
+
border-radius: 0.5rem;
|
|
180
|
+
|
|
181
|
+
background-color: var(--vp-c-bg-elv);
|
|
182
|
+
|
|
183
|
+
text-align: start;
|
|
184
|
+
white-space: nowrap;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.vp-navbar-dropdown-title {
|
|
189
|
+
display: block;
|
|
190
|
+
|
|
191
|
+
padding: inherit;
|
|
192
|
+
border: none;
|
|
193
|
+
|
|
194
|
+
background: transparent;
|
|
195
|
+
color: var(--vp-c-text);
|
|
196
|
+
|
|
197
|
+
font-weight: 500;
|
|
198
|
+
font-size: 0.9rem;
|
|
199
|
+
font-family: inherit;
|
|
200
|
+
line-height: 1.4rem;
|
|
201
|
+
|
|
202
|
+
cursor: inherit;
|
|
203
|
+
|
|
204
|
+
.vp-navbar-dropdown-wrapper.mobile & {
|
|
205
|
+
display: none;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
&:hover {
|
|
209
|
+
border-color: transparent;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.vp-navbar-dropdown-title-mobile {
|
|
214
|
+
display: none;
|
|
215
|
+
|
|
216
|
+
padding: inherit;
|
|
217
|
+
border: none;
|
|
218
|
+
|
|
219
|
+
background: transparent;
|
|
220
|
+
color: var(--vp-c-text);
|
|
221
|
+
|
|
222
|
+
font-weight: 600;
|
|
223
|
+
font-size: inherit;
|
|
224
|
+
font-family: inherit;
|
|
225
|
+
line-height: 1.4rem;
|
|
226
|
+
|
|
227
|
+
cursor: inherit;
|
|
228
|
+
|
|
229
|
+
.vp-navbar-dropdown-wrapper.mobile & {
|
|
230
|
+
display: block;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
&:hover {
|
|
234
|
+
color: var(--vp-c-accent);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.vp-navbar-dropdown-item {
|
|
239
|
+
color: inherit;
|
|
240
|
+
line-height: 1.7rem;
|
|
241
|
+
|
|
242
|
+
.auto-link {
|
|
243
|
+
position: relative;
|
|
244
|
+
|
|
245
|
+
display: block;
|
|
246
|
+
|
|
247
|
+
margin-bottom: 0;
|
|
248
|
+
padding: 0 1.25rem;
|
|
249
|
+
border-bottom: none;
|
|
250
|
+
|
|
251
|
+
font-weight: 400;
|
|
252
|
+
line-height: 1.7rem;
|
|
253
|
+
|
|
254
|
+
&:hover {
|
|
255
|
+
color: var(--vp-c-accent);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
&.route-link-active {
|
|
259
|
+
color: var(--vp-c-accent);
|
|
260
|
+
|
|
261
|
+
&::after {
|
|
262
|
+
content: '';
|
|
263
|
+
|
|
264
|
+
position: absolute;
|
|
265
|
+
inset-inline-start: 9px;
|
|
266
|
+
top: calc(50% - 2px);
|
|
267
|
+
|
|
268
|
+
width: 0;
|
|
269
|
+
height: 0;
|
|
270
|
+
border-top: 3px solid transparent;
|
|
271
|
+
border-bottom: 3px solid transparent;
|
|
272
|
+
border-inline-start: 5px solid var(--vp-c-accent);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.vp-navbar-dropdown-wrapper.mobile & > a {
|
|
278
|
+
line-height: 2rem;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.vp-navbar-dropdown-subtitle {
|
|
283
|
+
margin: 0.45rem 0 0;
|
|
284
|
+
padding: 1rem 0 0.45rem;
|
|
285
|
+
border-top: 1px solid var(--vp-c-gutter);
|
|
286
|
+
font-size: 0.9rem;
|
|
287
|
+
|
|
288
|
+
.vp-navbar-dropdown-wrapper.mobile & {
|
|
289
|
+
margin-top: 0;
|
|
290
|
+
padding-top: 0;
|
|
291
|
+
padding-bottom: 0;
|
|
292
|
+
border-top: 0;
|
|
293
|
+
|
|
294
|
+
line-height: 2rem;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.vp-navbar-dropdown-item:first-child & {
|
|
298
|
+
margin-top: 0;
|
|
299
|
+
padding-top: 0;
|
|
300
|
+
border-top: 0;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
> span {
|
|
304
|
+
padding-inline: 1.25rem 1.5rem;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
> .auto-link {
|
|
308
|
+
font-weight: inherit;
|
|
309
|
+
|
|
310
|
+
&.route-link-active {
|
|
311
|
+
&::after {
|
|
312
|
+
display: none;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.vp-navbar-dropdown-subitem-wrapper {
|
|
319
|
+
padding: 0;
|
|
320
|
+
list-style: none;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.vp-navbar-dropdown-subitem {
|
|
324
|
+
font-size: 0.9em;
|
|
325
|
+
|
|
326
|
+
.vp-navbar-dropdown-wrapper.mobile & {
|
|
327
|
+
padding-inline-start: 1rem;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
</style>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import VPAutoLink from '@theme/VPAutoLink.vue'
|
|
3
|
+
import VPNavbarDropdown from '@theme/VPNavbarDropdown.vue'
|
|
4
|
+
import { useData } from '@theme/useData'
|
|
5
|
+
import { useNavbarConfig } from '@theme/useNavbarConfig'
|
|
6
|
+
import { useNavbarRepo } from '@theme/useNavbarRepo'
|
|
7
|
+
import { useNavbarSelectLanguage } from '@theme/useNavbarSelectLanguage'
|
|
8
|
+
import { DeviceType, useUpdateDeviceStatus } from '@theme/useUpdateDeviceStatus'
|
|
9
|
+
import { computed, ref } from 'vue'
|
|
10
|
+
|
|
11
|
+
const { themeLocale } = useData()
|
|
12
|
+
const navbarConfig = useNavbarConfig()
|
|
13
|
+
const navbarSelectLanguage = useNavbarSelectLanguage()
|
|
14
|
+
const navbarRepo = useNavbarRepo()
|
|
15
|
+
|
|
16
|
+
const isMobile = ref(false)
|
|
17
|
+
|
|
18
|
+
const navbarLabel = computed(() => {
|
|
19
|
+
return themeLocale.value.navbarLabel ?? 'site navigation'
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const navbarLinks = computed(() => [
|
|
23
|
+
...navbarConfig.value,
|
|
24
|
+
...navbarSelectLanguage.value,
|
|
25
|
+
...navbarRepo.value,
|
|
26
|
+
])
|
|
27
|
+
|
|
28
|
+
useUpdateDeviceStatus(
|
|
29
|
+
DeviceType.Mobile,
|
|
30
|
+
(mobileDesktopBreakpoint: number): void => {
|
|
31
|
+
// avoid overlapping of long title and long navbar links
|
|
32
|
+
isMobile.value = window.innerWidth < mobileDesktopBreakpoint
|
|
33
|
+
},
|
|
34
|
+
)
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<nav
|
|
39
|
+
v-if="navbarLinks.length"
|
|
40
|
+
class="vp-navbar-items"
|
|
41
|
+
:aria-label="navbarLabel"
|
|
42
|
+
>
|
|
43
|
+
<div v-for="item in navbarLinks" :key="item.text" class="vp-navbar-item">
|
|
44
|
+
<VPNavbarDropdown
|
|
45
|
+
v-if="'children' in item"
|
|
46
|
+
:class="{ mobile: isMobile }"
|
|
47
|
+
:config="item"
|
|
48
|
+
/>
|
|
49
|
+
<VPAutoLink v-else :config="item" />
|
|
50
|
+
</div>
|
|
51
|
+
</nav>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<style lang="scss">
|
|
55
|
+
@use '../styles/variables' as *;
|
|
56
|
+
|
|
57
|
+
.vp-navbar-items {
|
|
58
|
+
display: inline-block;
|
|
59
|
+
|
|
60
|
+
@media print {
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.auto-link {
|
|
65
|
+
color: inherit;
|
|
66
|
+
line-height: 1.4rem;
|
|
67
|
+
|
|
68
|
+
&:hover,
|
|
69
|
+
&.route-link-active {
|
|
70
|
+
color: var(--vp-c-text);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.vp-navbar-item {
|
|
76
|
+
position: relative;
|
|
77
|
+
display: inline-block;
|
|
78
|
+
margin-inline-start: 1.5rem;
|
|
79
|
+
line-height: var(--navbar-line-height);
|
|
80
|
+
|
|
81
|
+
@media (max-width: $MQMobile) {
|
|
82
|
+
margin-inline-start: 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:first-child {
|
|
86
|
+
margin-inline-start: 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.auto-link {
|
|
90
|
+
&:hover,
|
|
91
|
+
&.route-link-active {
|
|
92
|
+
color: var(--vp-c-accent);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
> .auto-link {
|
|
97
|
+
display: inline-block;
|
|
98
|
+
|
|
99
|
+
&:hover,
|
|
100
|
+
&.route-link-active {
|
|
101
|
+
margin-bottom: -2px;
|
|
102
|
+
border-bottom: 2px solid var(--vp-c-accent);
|
|
103
|
+
|
|
104
|
+
@media (max-width: $MQMobile) {
|
|
105
|
+
margin-bottom: 0;
|
|
106
|
+
border-bottom: none;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
</style>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import VPPageMeta from '@theme/VPPageMeta.vue'
|
|
3
|
+
import VPPageNav from '@theme/VPPageNav.vue'
|
|
4
|
+
import type { Slot } from '@vuepress/helper/client'
|
|
5
|
+
import { Content } from 'vuepress/client'
|
|
6
|
+
|
|
7
|
+
defineSlots<{
|
|
8
|
+
'top'?: Slot
|
|
9
|
+
'bottom'?: Slot
|
|
10
|
+
'content-top'?: Slot
|
|
11
|
+
'content-bottom'?: Slot
|
|
12
|
+
}>()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<main class="vp-page">
|
|
17
|
+
<slot name="top" />
|
|
18
|
+
|
|
19
|
+
<div vp-content>
|
|
20
|
+
<slot name="content-top" />
|
|
21
|
+
|
|
22
|
+
<Content />
|
|
23
|
+
|
|
24
|
+
<slot name="content-bottom" />
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<VPPageMeta />
|
|
28
|
+
|
|
29
|
+
<VPPageNav />
|
|
30
|
+
|
|
31
|
+
<slot name="bottom" />
|
|
32
|
+
</main>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<style lang="scss">
|
|
36
|
+
@use '../styles/mixins';
|
|
37
|
+
@use '../styles/variables' as *;
|
|
38
|
+
|
|
39
|
+
.vp-page {
|
|
40
|
+
display: block;
|
|
41
|
+
|
|
42
|
+
// leave space for navbar
|
|
43
|
+
padding-top: var(--navbar-height);
|
|
44
|
+
padding-bottom: 2rem;
|
|
45
|
+
|
|
46
|
+
// leave space for sidebar
|
|
47
|
+
padding-inline-start: var(--sidebar-width);
|
|
48
|
+
|
|
49
|
+
// narrow desktop / iPad
|
|
50
|
+
@media (max-width: $MQNarrow) {
|
|
51
|
+
// leave space for sidebar
|
|
52
|
+
padding-inline-start: var(--sidebar-width-mobile);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// wide mobile
|
|
56
|
+
@media (max-width: $MQMobile) {
|
|
57
|
+
// sidebar is collapsed
|
|
58
|
+
padding-inline-start: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
[vp-content] {
|
|
62
|
+
@include mixins.content-wrapper;
|
|
63
|
+
|
|
64
|
+
& {
|
|
65
|
+
padding-top: 0;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
</style>
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import VPAutoLink from '@theme/VPAutoLink.vue'
|
|
3
|
+
import VPEditIcon from '@theme/VPEditIcon.vue'
|
|
4
|
+
import { useData } from '@theme/useData'
|
|
5
|
+
import { useEditLink } from '@theme/useEditLink'
|
|
6
|
+
import { useContributors, useLastUpdated } from '@vuepress/plugin-git/client'
|
|
7
|
+
|
|
8
|
+
const { frontmatter, themeLocale } = useData()
|
|
9
|
+
const contributors = useContributors(
|
|
10
|
+
() =>
|
|
11
|
+
frontmatter.value.contributors ?? themeLocale.value.contributors ?? true,
|
|
12
|
+
)
|
|
13
|
+
const editLink = useEditLink()
|
|
14
|
+
const lastUpdated = useLastUpdated(
|
|
15
|
+
() => frontmatter.value.lastUpdated ?? themeLocale.value.lastUpdated ?? true,
|
|
16
|
+
)
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<footer class="vp-page-meta">
|
|
21
|
+
<div v-if="editLink" class="vp-meta-item edit-link">
|
|
22
|
+
<VPAutoLink class="label" :config="editLink">
|
|
23
|
+
<template #before>
|
|
24
|
+
<VPEditIcon />
|
|
25
|
+
</template>
|
|
26
|
+
</VPAutoLink>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div class="vp-meta-item git-info">
|
|
30
|
+
<div v-if="lastUpdated" class="vp-meta-item last-updated">
|
|
31
|
+
<span class="meta-item-label"
|
|
32
|
+
>{{ themeLocale.lastUpdatedText ?? lastUpdated.locale }}:
|
|
33
|
+
</span>
|
|
34
|
+
<time
|
|
35
|
+
class="meta-item-info"
|
|
36
|
+
:datetime="lastUpdated.iso"
|
|
37
|
+
data-allow-mismatch
|
|
38
|
+
>{{ lastUpdated.text }}</time
|
|
39
|
+
>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div v-if="contributors.length" class="vp-meta-item contributors">
|
|
43
|
+
<span class="meta-item-label"
|
|
44
|
+
>{{ themeLocale.contributorsText }}:
|
|
45
|
+
</span>
|
|
46
|
+
<span class="meta-item-info">
|
|
47
|
+
<template v-for="(contributor, index) in contributors" :key="index">
|
|
48
|
+
<span class="contributor" :title="`email: ${contributor.email}`">
|
|
49
|
+
{{ contributor.name }}
|
|
50
|
+
</span>
|
|
51
|
+
<template v-if="index !== contributors.length - 1">, </template>
|
|
52
|
+
</template>
|
|
53
|
+
</span>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</footer>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<style lang="scss">
|
|
60
|
+
@use '../styles/mixins';
|
|
61
|
+
@use '../styles/variables' as *;
|
|
62
|
+
|
|
63
|
+
.vp-page-meta {
|
|
64
|
+
@include mixins.content-wrapper;
|
|
65
|
+
|
|
66
|
+
& {
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-wrap: wrap;
|
|
69
|
+
justify-content: space-between;
|
|
70
|
+
|
|
71
|
+
overflow: auto;
|
|
72
|
+
|
|
73
|
+
padding-top: 0.75rem;
|
|
74
|
+
padding-bottom: 0.75rem;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@media print {
|
|
78
|
+
margin: 0 !important;
|
|
79
|
+
padding-inline: 0 !important;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@media (max-width: $MQMobile) {
|
|
83
|
+
display: block;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.vp-meta-item {
|
|
87
|
+
flex-grow: 1;
|
|
88
|
+
|
|
89
|
+
.vp-meta-label {
|
|
90
|
+
font-weight: 500;
|
|
91
|
+
|
|
92
|
+
&:not(a) {
|
|
93
|
+
color: var(--vp-c-text-mute);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.vp-meta-info {
|
|
98
|
+
color: var(--vp-c-text-mute);
|
|
99
|
+
font-weight: 400;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.git-info {
|
|
104
|
+
text-align: end;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.edit-link {
|
|
108
|
+
margin-top: 0.25rem;
|
|
109
|
+
margin-bottom: 0.25rem;
|
|
110
|
+
margin-inline-end: 0.5rem;
|
|
111
|
+
font-size: 0.875em;
|
|
112
|
+
|
|
113
|
+
@media print {
|
|
114
|
+
display: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.edit-icon {
|
|
118
|
+
position: relative;
|
|
119
|
+
bottom: -0.125em;
|
|
120
|
+
|
|
121
|
+
width: 1em;
|
|
122
|
+
height: 1em;
|
|
123
|
+
margin-inline-end: 0.25em;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.last-updated,
|
|
128
|
+
.contributors {
|
|
129
|
+
margin-top: 0.25rem;
|
|
130
|
+
margin-bottom: 0.25rem;
|
|
131
|
+
font-size: 0.875em;
|
|
132
|
+
|
|
133
|
+
@media (max-width: $MQMobile) {
|
|
134
|
+
font-size: 0.825em;
|
|
135
|
+
text-align: start;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
</style>
|