@vuepress/theme-default 2.0.0-rc.32 → 2.0.0-rc.34
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/VPDarkIcon.vue +8 -0
- package/lib/client/components/{DropdownTransition.vue → VPDropdownTransition.vue} +10 -1
- package/lib/client/components/VPEditIcon.vue +12 -0
- package/lib/client/components/VPHome.vue +38 -0
- package/lib/client/components/VPHomeFeatures.vue +68 -0
- package/lib/client/components/{HomeFooter.vue → VPHomeFooter.vue} +16 -2
- package/lib/client/components/{HomeHero.vue → VPHomeHero.vue} +107 -5
- package/lib/client/components/VPLightIcon.vue +28 -0
- package/lib/client/components/VPNavbar.vue +127 -0
- package/lib/client/components/{NavbarBrand.vue → VPNavbarBrand.vue} +36 -4
- package/lib/client/components/VPNavbarDropdown.vue +319 -0
- package/lib/client/components/VPNavbarItems.vue +110 -0
- package/lib/client/components/VPPage.vue +66 -0
- package/lib/client/components/VPPageMeta.vue +132 -0
- package/lib/client/components/VPPageNav.vue +118 -0
- package/lib/client/components/VPSidebar.vue +112 -0
- package/lib/client/components/VPSidebarItem.vue +169 -0
- package/lib/client/components/{SidebarItems.vue → VPSidebarItems.vue} +30 -6
- package/lib/client/components/VPToggleColorModeButton.vue +54 -0
- package/lib/client/components/VPToggleSidebarButton.vue +92 -0
- package/lib/client/components/global/Badge.vue +60 -18
- package/lib/client/components/global/CodeGroup.d.ts +1 -0
- package/lib/client/components/global/CodeGroup.js +4 -3
- package/lib/client/components/global/CodeGroupItem.vue +5 -16
- package/lib/client/composables/index.d.ts +7 -0
- package/lib/client/composables/index.js +7 -0
- package/lib/client/composables/useContributors.d.ts +3 -0
- package/lib/client/composables/useContributors.js +14 -0
- package/lib/client/composables/useDarkMode.js +1 -1
- package/lib/client/composables/useEditLink.d.ts +3 -0
- package/lib/client/composables/useEditLink.js +31 -0
- package/lib/client/composables/useLastUpdated.d.ts +2 -0
- package/lib/client/composables/useLastUpdated.js +17 -0
- package/lib/client/composables/useNavbarConfig.d.ts +3 -0
- package/lib/client/composables/useNavbarConfig.js +25 -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 +58 -0
- package/lib/client/composables/useNavigate.js +4 -7
- package/lib/client/composables/useRelatedLinks.d.ts +8 -0
- package/lib/client/composables/useRelatedLinks.js +73 -0
- package/lib/client/composables/useSidebarItems.d.ts +10 -9
- package/lib/client/composables/useSidebarItems.js +58 -47
- package/lib/client/config.d.ts +1 -0
- package/lib/client/config.js +2 -1
- package/lib/client/index.d.ts +1 -0
- package/lib/client/index.js +1 -0
- package/lib/client/layouts/Layout.vue +111 -18
- package/lib/client/layouts/NotFound.vue +1 -1
- package/lib/client/styles/_mixins.scss +4 -4
- package/lib/client/styles/_variables.module.scss +1 -1
- package/lib/client/styles/_variables.scss +1 -0
- package/lib/client/styles/code-group.scss +32 -29
- package/lib/client/styles/{code.scss → content/code.scss} +81 -99
- package/lib/client/styles/{custom-container.scss → content/custom-container.scss} +9 -5
- package/lib/client/styles/content/index.scss +4 -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 +7 -3
- package/lib/client/styles/index.scss +2 -13
- package/lib/client/styles/layout.scss +3 -203
- package/lib/client/styles/normalize.scss +18 -149
- package/lib/client/styles/plugins.scss +20 -0
- package/lib/client/styles/vars-dark.scss +17 -16
- package/lib/client/styles/vars.scss +19 -23
- package/lib/client/typings.d.ts +13 -0
- package/lib/client/typings.js +1 -0
- package/lib/client/utils/{getNavLink.d.ts → getAutoLink.d.ts} +2 -2
- package/lib/client/utils/index.d.ts +3 -1
- package/lib/client/utils/index.js +3 -1
- package/lib/client/utils/isActiveSidebarItem.d.ts +2 -2
- package/lib/client/utils/isActiveSidebarItem.js +3 -3
- package/lib/client/utils/isLinkInternal.d.ts +1 -0
- package/lib/client/utils/isLinkInternal.js +2 -0
- package/lib/client/utils/resolvePrefix.d.ts +1 -0
- package/lib/client/utils/resolvePrefix.js +4 -0
- package/lib/node/defaultTheme.js +9 -1
- package/lib/node/utils/assignDefaultLocaleOptions.js +1 -1
- package/lib/shared/index.d.ts +2 -0
- package/lib/shared/index.js +2 -0
- package/lib/shared/nav.d.ts +23 -26
- package/lib/shared/navbar.d.ts +21 -0
- package/lib/shared/navbar.js +1 -0
- package/lib/shared/options.d.ts +4 -3
- package/lib/shared/page.d.ts +2 -2
- package/lib/shared/sidebar.d.ts +26 -0
- package/lib/shared/sidebar.js +1 -0
- package/package.json +19 -19
- package/templates/build.html +2 -0
- 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/Navbar.vue +0 -80
- package/lib/client/components/NavbarDropdown.vue +0 -125
- package/lib/client/components/NavbarItems.vue +0 -198
- package/lib/client/components/Page.vue +0 -31
- package/lib/client/components/PageMeta.vue +0 -220
- package/lib/client/components/PageNav.vue +0 -228
- package/lib/client/components/Sidebar.vue +0 -18
- package/lib/client/components/SidebarItem.vue +0 -86
- package/lib/client/components/ToggleColorModeButton.vue +0 -57
- package/lib/client/components/ToggleSidebarButton.vue +0 -24
- package/lib/client/styles/badge.scss +0 -36
- 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 -11
- package/lib/client/styles/sidebar.scss +0 -134
- package/lib/client/styles/transitions.scss +0 -22
- /package/lib/client/utils/{getNavLink.js → getAutoLink.js} +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg class="dark-icon" viewBox="0 0 32 32">
|
|
3
|
+
<path
|
|
4
|
+
d="M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z"
|
|
5
|
+
fill="currentColor"
|
|
6
|
+
/>
|
|
7
|
+
</svg>
|
|
8
|
+
</template>
|
|
@@ -15,7 +15,7 @@ const unsetHeight = (items): void => {
|
|
|
15
15
|
|
|
16
16
|
<template>
|
|
17
17
|
<Transition
|
|
18
|
-
name="dropdown"
|
|
18
|
+
name="vp-dropdown"
|
|
19
19
|
@enter="setHeight"
|
|
20
20
|
@after-enter="unsetHeight"
|
|
21
21
|
@before-leave="setHeight"
|
|
@@ -23,3 +23,12 @@ const unsetHeight = (items): void => {
|
|
|
23
23
|
<slot />
|
|
24
24
|
</Transition>
|
|
25
25
|
</template>
|
|
26
|
+
|
|
27
|
+
<style lang="scss">
|
|
28
|
+
.vp-dropdown {
|
|
29
|
+
&-enter-from,
|
|
30
|
+
&-leave-to {
|
|
31
|
+
height: 0 !important;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg class="edit-icon" viewBox="0 0 1024 1024">
|
|
3
|
+
<g fill="currentColor">
|
|
4
|
+
<path
|
|
5
|
+
d="M430.818 653.65a60.46 60.46 0 0 1-50.96-93.281l71.69-114.012 7.773-10.365L816.038 80.138A60.46 60.46 0 0 1 859.225 62a60.46 60.46 0 0 1 43.186 18.138l43.186 43.186a60.46 60.46 0 0 1 0 86.373L588.879 565.55l-8.637 8.637-117.466 68.234a60.46 60.46 0 0 1-31.958 11.229z"
|
|
6
|
+
/>
|
|
7
|
+
<path
|
|
8
|
+
d="M728.802 962H252.891A190.883 190.883 0 0 1 62.008 771.98V296.934a190.883 190.883 0 0 1 190.883-192.61h267.754a60.46 60.46 0 0 1 0 120.92H252.891a69.962 69.962 0 0 0-69.098 69.099V771.98a69.962 69.962 0 0 0 69.098 69.098h475.911A69.962 69.962 0 0 0 797.9 771.98V503.363a60.46 60.46 0 1 1 120.922 0V771.98A190.883 190.883 0 0 1 728.802 962z"
|
|
9
|
+
/>
|
|
10
|
+
</g>
|
|
11
|
+
</svg>
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import VPHomeFeatures from '@theme/VPHomeFeatures.vue'
|
|
3
|
+
import VPHomeFooter from '@theme/VPHomeFooter.vue'
|
|
4
|
+
import VPHomeHero from '@theme/VPHomeHero.vue'
|
|
5
|
+
import { Content } from 'vuepress/client'
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<main class="vp-home">
|
|
10
|
+
<VPHomeHero />
|
|
11
|
+
<VPHomeFeatures />
|
|
12
|
+
<div class="theme-default-content">
|
|
13
|
+
<Content />
|
|
14
|
+
</div>
|
|
15
|
+
<VPHomeFooter />
|
|
16
|
+
</main>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<style lang="scss">
|
|
20
|
+
@import '../styles//variables';
|
|
21
|
+
|
|
22
|
+
.vp-home {
|
|
23
|
+
display: block;
|
|
24
|
+
max-width: var(--homepage-width);
|
|
25
|
+
margin: 0 auto;
|
|
26
|
+
padding: var(--navbar-height) 2rem 0;
|
|
27
|
+
|
|
28
|
+
@media (max-width: $MQMobileNarrow) {
|
|
29
|
+
padding-right: 1.5rem;
|
|
30
|
+
padding-left: 1.5rem;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.theme-default-content {
|
|
34
|
+
margin: 0;
|
|
35
|
+
padding: 0;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { usePageFrontmatter } from 'vuepress/client'
|
|
4
|
+
import type { DefaultThemeHomePageFrontmatter } from '../../shared/index.js'
|
|
5
|
+
|
|
6
|
+
const frontmatter = usePageFrontmatter<DefaultThemeHomePageFrontmatter>()
|
|
7
|
+
|
|
8
|
+
const features = computed(() => frontmatter.value.features ?? [])
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<div v-if="features.length" class="vp-features">
|
|
13
|
+
<div v-for="feature in features" :key="feature.title" class="vp-feature">
|
|
14
|
+
<h2>{{ feature.title }}</h2>
|
|
15
|
+
<p>{{ feature.details }}</p>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<style lang="scss">
|
|
21
|
+
@import '../styles/variables';
|
|
22
|
+
|
|
23
|
+
.vp-features {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-wrap: wrap;
|
|
26
|
+
align-items: flex-start;
|
|
27
|
+
place-content: stretch space-between;
|
|
28
|
+
|
|
29
|
+
margin-top: 2.5rem;
|
|
30
|
+
padding: 1.2rem 0;
|
|
31
|
+
border-top: 1px solid var(--c-border);
|
|
32
|
+
|
|
33
|
+
transition: border-color var(--t-color);
|
|
34
|
+
|
|
35
|
+
@media (max-width: $MQMobile) {
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.vp-feature {
|
|
41
|
+
flex-grow: 1;
|
|
42
|
+
flex-basis: 30%;
|
|
43
|
+
max-width: 30%;
|
|
44
|
+
|
|
45
|
+
@media (max-width: $MQMobile) {
|
|
46
|
+
max-width: 100%;
|
|
47
|
+
padding: 0 2.5rem;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
h2 {
|
|
51
|
+
padding-bottom: 0;
|
|
52
|
+
border-bottom: none;
|
|
53
|
+
|
|
54
|
+
color: var(--c-text-light);
|
|
55
|
+
|
|
56
|
+
font-weight: 500;
|
|
57
|
+
font-size: 1.4rem;
|
|
58
|
+
|
|
59
|
+
@media (max-width: $MQMobileNarrow) {
|
|
60
|
+
font-size: 1.25rem;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
p {
|
|
65
|
+
color: var(--c-text-lighter);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
</style>
|
|
@@ -4,6 +4,7 @@ import { usePageFrontmatter } from 'vuepress/client'
|
|
|
4
4
|
import type { DefaultThemeHomePageFrontmatter } from '../../shared/index.js'
|
|
5
5
|
|
|
6
6
|
const frontmatter = usePageFrontmatter<DefaultThemeHomePageFrontmatter>()
|
|
7
|
+
|
|
7
8
|
const footer = computed(() => frontmatter.value.footer)
|
|
8
9
|
const footerHtml = computed(() => frontmatter.value.footerHtml)
|
|
9
10
|
</script>
|
|
@@ -11,7 +12,20 @@ const footerHtml = computed(() => frontmatter.value.footerHtml)
|
|
|
11
12
|
<template>
|
|
12
13
|
<template v-if="footer">
|
|
13
14
|
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
14
|
-
<div v-if="footerHtml" class="footer" v-html="footer" />
|
|
15
|
-
<div v-else class="footer" v-text="footer" />
|
|
15
|
+
<div v-if="footerHtml" class="vp-footer" v-html="footer" />
|
|
16
|
+
<div v-else class="vp-footer" v-text="footer" />
|
|
16
17
|
</template>
|
|
17
18
|
</template>
|
|
19
|
+
|
|
20
|
+
<style>
|
|
21
|
+
.vp-footer {
|
|
22
|
+
padding: 2.5rem;
|
|
23
|
+
border-top: 1px solid var(--c-border);
|
|
24
|
+
|
|
25
|
+
color: var(--c-text-lighter);
|
|
26
|
+
|
|
27
|
+
text-align: center;
|
|
28
|
+
|
|
29
|
+
transition: border-color var(--t-color);
|
|
30
|
+
}
|
|
31
|
+
</style>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { useDarkMode } from '@theme/useDarkMode'
|
|
2
3
|
import type { FunctionalComponent } from 'vue'
|
|
3
4
|
import { computed, h } from 'vue'
|
|
4
5
|
import {
|
|
@@ -9,7 +10,6 @@ import {
|
|
|
9
10
|
withBase,
|
|
10
11
|
} from 'vuepress/client'
|
|
11
12
|
import type { DefaultThemeHomePageFrontmatter } from '../../shared/index.js'
|
|
12
|
-
import { useDarkMode } from '../composables/index.js'
|
|
13
13
|
|
|
14
14
|
const frontmatter = usePageFrontmatter<DefaultThemeHomePageFrontmatter>()
|
|
15
15
|
const siteLocale = useSiteLocaleData()
|
|
@@ -37,6 +37,7 @@ const tagline = computed(() => {
|
|
|
37
37
|
if (frontmatter.value.tagline === null) {
|
|
38
38
|
return null
|
|
39
39
|
}
|
|
40
|
+
|
|
40
41
|
return (
|
|
41
42
|
frontmatter.value.tagline ||
|
|
42
43
|
siteLocale.value.description ||
|
|
@@ -58,14 +59,18 @@ const actions = computed(() => {
|
|
|
58
59
|
|
|
59
60
|
const HomeHeroImage: FunctionalComponent = () => {
|
|
60
61
|
if (!heroImage.value) return null
|
|
62
|
+
|
|
61
63
|
const img = h('img', {
|
|
64
|
+
class: 'vp-hero-image',
|
|
62
65
|
src: withBase(heroImage.value),
|
|
63
66
|
alt: heroAlt.value,
|
|
64
67
|
height: heroHeight.value,
|
|
65
68
|
})
|
|
69
|
+
|
|
66
70
|
if (frontmatter.value.heroImageDark === undefined) {
|
|
67
71
|
return img
|
|
68
72
|
}
|
|
73
|
+
|
|
69
74
|
// wrap hero image with <ClientOnly> to avoid ssr-mismatch
|
|
70
75
|
// when using a different hero image in dark mode
|
|
71
76
|
return h(ClientOnly, () => img)
|
|
@@ -73,25 +78,122 @@ const HomeHeroImage: FunctionalComponent = () => {
|
|
|
73
78
|
</script>
|
|
74
79
|
|
|
75
80
|
<template>
|
|
76
|
-
<header class="hero">
|
|
81
|
+
<header class="vp-hero">
|
|
77
82
|
<HomeHeroImage />
|
|
78
83
|
|
|
79
84
|
<h1 v-if="heroText" id="main-title">
|
|
80
85
|
{{ heroText }}
|
|
81
86
|
</h1>
|
|
82
87
|
|
|
83
|
-
<p v-if="tagline" class="description">
|
|
88
|
+
<p v-if="tagline" class="vp-hero-description">
|
|
84
89
|
{{ tagline }}
|
|
85
90
|
</p>
|
|
86
91
|
|
|
87
|
-
<p v-if="actions.length" class="actions">
|
|
92
|
+
<p v-if="actions.length" class="vp-hero-actions">
|
|
88
93
|
<AutoLink
|
|
89
94
|
v-for="action in actions"
|
|
90
95
|
:key="action.text"
|
|
91
|
-
class="action-button"
|
|
96
|
+
class="vp-hero-action-button"
|
|
92
97
|
:class="[action.type]"
|
|
93
98
|
:config="action"
|
|
94
99
|
/>
|
|
95
100
|
</p>
|
|
96
101
|
</header>
|
|
97
102
|
</template>
|
|
103
|
+
|
|
104
|
+
<style lang="scss">
|
|
105
|
+
@import '../styles//variables';
|
|
106
|
+
|
|
107
|
+
.vp-hero {
|
|
108
|
+
text-align: center;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.vp-hero-image {
|
|
112
|
+
display: block;
|
|
113
|
+
max-width: 100%;
|
|
114
|
+
max-height: 280px;
|
|
115
|
+
margin: 3rem auto 1.5rem;
|
|
116
|
+
|
|
117
|
+
@media (max-width: $MQMobileNarrow) {
|
|
118
|
+
max-height: 210px;
|
|
119
|
+
margin: 2rem auto 1.2rem;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
#main-title {
|
|
124
|
+
font-size: 3rem;
|
|
125
|
+
|
|
126
|
+
@media (max-width: $MQMobileNarrow) {
|
|
127
|
+
font-size: 2rem;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
#main-title,
|
|
132
|
+
.vp-hero-description,
|
|
133
|
+
.vp-hero-actions {
|
|
134
|
+
margin: 1.8rem auto;
|
|
135
|
+
|
|
136
|
+
@media (max-width: $MQMobileNarrow) {
|
|
137
|
+
margin: 1.2rem auto;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.vp-hero-actions {
|
|
142
|
+
display: flex;
|
|
143
|
+
flex-wrap: wrap;
|
|
144
|
+
gap: 1rem;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.vp-hero-description {
|
|
149
|
+
max-width: 35rem;
|
|
150
|
+
color: var(--c-text-lightest);
|
|
151
|
+
font-size: 1.6rem;
|
|
152
|
+
line-height: 1.3;
|
|
153
|
+
|
|
154
|
+
@media (max-width: $MQMobileNarrow) {
|
|
155
|
+
font-size: 1.2rem;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.vp-hero-action-button {
|
|
160
|
+
display: inline-block;
|
|
161
|
+
|
|
162
|
+
box-sizing: border-box;
|
|
163
|
+
|
|
164
|
+
padding: 0.8rem 1.6rem;
|
|
165
|
+
border-width: 2px;
|
|
166
|
+
border-style: solid;
|
|
167
|
+
border-radius: 4px;
|
|
168
|
+
|
|
169
|
+
font-size: 1.2rem;
|
|
170
|
+
|
|
171
|
+
transition: background-color var(--t-color);
|
|
172
|
+
|
|
173
|
+
@media (max-width: $MQMobileNarrow) {
|
|
174
|
+
padding: 0.6rem 1.2rem;
|
|
175
|
+
font-size: 1rem;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&.primary {
|
|
179
|
+
border-color: var(--c-brand);
|
|
180
|
+
background-color: var(--c-brand);
|
|
181
|
+
color: var(--c-bg);
|
|
182
|
+
|
|
183
|
+
&:hover {
|
|
184
|
+
background-color: var(--c-brand-light);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
&.secondary {
|
|
189
|
+
border-color: var(--c-brand);
|
|
190
|
+
background-color: var(--c-bg);
|
|
191
|
+
color: var(--c-brand);
|
|
192
|
+
|
|
193
|
+
&:hover {
|
|
194
|
+
background-color: var(--c-brand-light);
|
|
195
|
+
color: var(--c-bg);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
</style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg class="light-icon" viewBox="0 0 32 32">
|
|
3
|
+
<path
|
|
4
|
+
d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6z"
|
|
5
|
+
fill="currentColor"
|
|
6
|
+
/>
|
|
7
|
+
<path
|
|
8
|
+
d="M5.394 6.813l1.414-1.415l3.506 3.506L8.9 10.318z"
|
|
9
|
+
fill="currentColor"
|
|
10
|
+
/>
|
|
11
|
+
<path d="M2 15.005h5v2H2z" fill="currentColor" />
|
|
12
|
+
<path
|
|
13
|
+
d="M5.394 25.197L8.9 21.691l1.414 1.415l-3.506 3.505z"
|
|
14
|
+
fill="currentColor"
|
|
15
|
+
/>
|
|
16
|
+
<path d="M15 25.005h2v5h-2z" fill="currentColor" />
|
|
17
|
+
<path
|
|
18
|
+
d="M21.687 23.106l1.414-1.415l3.506 3.506l-1.414 1.414z"
|
|
19
|
+
fill="currentColor"
|
|
20
|
+
/>
|
|
21
|
+
<path d="M25 15.005h5v2h-5z" fill="currentColor" />
|
|
22
|
+
<path
|
|
23
|
+
d="M21.687 8.904l3.506-3.506l1.414 1.415l-3.506 3.505z"
|
|
24
|
+
fill="currentColor"
|
|
25
|
+
/>
|
|
26
|
+
<path d="M15 2.005h2v5h-2z" fill="currentColor" />
|
|
27
|
+
</svg>
|
|
28
|
+
</template>
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useThemeLocaleData } from '@theme/useThemeData'
|
|
3
|
+
import { DeviceType, useUpdateDeviceStatus } from '@theme/useUpdateDeviceStatus'
|
|
4
|
+
import VPNavbarBrand from '@theme/VPNavbarBrand.vue'
|
|
5
|
+
import VPNavbarItems from '@theme/VPNavbarItems.vue'
|
|
6
|
+
import VPToggleColorModeButton from '@theme/VPToggleColorModeButton.vue'
|
|
7
|
+
import VPToggleSidebarButton from '@theme/VPToggleSidebarButton.vue'
|
|
8
|
+
import { computed, ref } from 'vue'
|
|
9
|
+
|
|
10
|
+
defineEmits<(e: 'toggle-sidebar') => void>()
|
|
11
|
+
|
|
12
|
+
defineSlots<{
|
|
13
|
+
before?: (props: Record<never, never>) => any
|
|
14
|
+
after?: (props: Record<never, never>) => any
|
|
15
|
+
}>()
|
|
16
|
+
|
|
17
|
+
const themeLocale = useThemeLocaleData()
|
|
18
|
+
|
|
19
|
+
const navbar = ref<HTMLElement | null>(null)
|
|
20
|
+
const navbarBrand = ref<HTMLElement | null>(null)
|
|
21
|
+
|
|
22
|
+
const linksWrapperMaxWidth = ref(0)
|
|
23
|
+
const linksWrapperStyle = computed(() => {
|
|
24
|
+
if (!linksWrapperMaxWidth.value) {
|
|
25
|
+
return {}
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
maxWidth: linksWrapperMaxWidth.value + 'px',
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const getCssValue = (el: HTMLElement | null, property: string): number => {
|
|
33
|
+
// NOTE: Known bug, will return 'auto' if style value is 'auto'
|
|
34
|
+
const val = el?.ownerDocument?.defaultView?.getComputedStyle(el, null)?.[
|
|
35
|
+
property
|
|
36
|
+
]
|
|
37
|
+
const num = Number.parseInt(val, 10)
|
|
38
|
+
|
|
39
|
+
return Number.isNaN(num) ? 0 : num
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
useUpdateDeviceStatus(
|
|
43
|
+
DeviceType.MOBILE,
|
|
44
|
+
(mobileDesktopBreakpoint: number): void => {
|
|
45
|
+
// avoid overlapping of long title and long navbar links
|
|
46
|
+
const navbarHorizontalPadding =
|
|
47
|
+
getCssValue(navbar.value, 'paddingLeft') +
|
|
48
|
+
getCssValue(navbar.value, 'paddingRight')
|
|
49
|
+
if (window.innerWidth < mobileDesktopBreakpoint) {
|
|
50
|
+
linksWrapperMaxWidth.value = 0
|
|
51
|
+
} else {
|
|
52
|
+
linksWrapperMaxWidth.value =
|
|
53
|
+
navbar.value!.offsetWidth -
|
|
54
|
+
navbarHorizontalPadding -
|
|
55
|
+
(navbarBrand.value?.offsetWidth || 0)
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
)
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<template>
|
|
62
|
+
<header ref="navbar" class="vp-navbar">
|
|
63
|
+
<VPToggleSidebarButton @toggle="$emit('toggle-sidebar')" />
|
|
64
|
+
|
|
65
|
+
<span ref="navbarBrand">
|
|
66
|
+
<VPNavbarBrand />
|
|
67
|
+
</span>
|
|
68
|
+
|
|
69
|
+
<div class="vp-navbar-items-wrapper" :style="linksWrapperStyle">
|
|
70
|
+
<slot name="before" />
|
|
71
|
+
<VPNavbarItems class="vp-hide-mobile" />
|
|
72
|
+
<slot name="after" />
|
|
73
|
+
<VPToggleColorModeButton v-if="themeLocale.colorModeSwitch" />
|
|
74
|
+
<VPSearch />
|
|
75
|
+
</div>
|
|
76
|
+
</header>
|
|
77
|
+
</template>
|
|
78
|
+
|
|
79
|
+
<style lang="scss">
|
|
80
|
+
@import '../styles/variables';
|
|
81
|
+
|
|
82
|
+
.vp-navbar {
|
|
83
|
+
--navbar-line-height: calc(
|
|
84
|
+
var(--navbar-height) - 2 * var(--navbar-padding-v)
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
position: fixed;
|
|
88
|
+
top: 0;
|
|
89
|
+
right: 0;
|
|
90
|
+
left: 0;
|
|
91
|
+
z-index: 20;
|
|
92
|
+
|
|
93
|
+
box-sizing: border-box;
|
|
94
|
+
|
|
95
|
+
height: var(--navbar-height);
|
|
96
|
+
padding: var(--navbar-padding-v) var(--navbar-padding-h);
|
|
97
|
+
border-bottom: 1px solid var(--c-border);
|
|
98
|
+
|
|
99
|
+
background-color: var(--c-bg-navbar);
|
|
100
|
+
|
|
101
|
+
line-height: var(--navbar-line-height);
|
|
102
|
+
|
|
103
|
+
transition:
|
|
104
|
+
background-color var(--t-color),
|
|
105
|
+
border-color var(--t-color);
|
|
106
|
+
|
|
107
|
+
@media screen and (max-width: $MQMobile) {
|
|
108
|
+
padding-left: 4rem;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.vp-navbar-items-wrapper {
|
|
113
|
+
position: absolute;
|
|
114
|
+
top: var(--navbar-padding-v);
|
|
115
|
+
right: var(--navbar-padding-h);
|
|
116
|
+
|
|
117
|
+
display: flex;
|
|
118
|
+
|
|
119
|
+
box-sizing: border-box;
|
|
120
|
+
|
|
121
|
+
height: var(--navbar-line-height);
|
|
122
|
+
padding-left: var(--navbar-padding-h);
|
|
123
|
+
|
|
124
|
+
font-size: 0.9rem;
|
|
125
|
+
white-space: nowrap;
|
|
126
|
+
}
|
|
127
|
+
</style>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { useDarkMode } from '@theme/useDarkMode'
|
|
3
|
+
import { useThemeLocaleData } from '@theme/useThemeData'
|
|
2
4
|
import { computed, h } from 'vue'
|
|
3
5
|
import type { FunctionalComponent } from 'vue'
|
|
4
6
|
import {
|
|
@@ -8,7 +10,6 @@ import {
|
|
|
8
10
|
useSiteLocaleData,
|
|
9
11
|
withBase,
|
|
10
12
|
} from 'vuepress/client'
|
|
11
|
-
import { useDarkMode, useThemeLocaleData } from '../composables/index.js'
|
|
12
13
|
|
|
13
14
|
const routeLocale = useRouteLocale()
|
|
14
15
|
const siteLocale = useSiteLocaleData()
|
|
@@ -36,7 +37,7 @@ const navBarLogoAltMatchesTitle = computed(
|
|
|
36
37
|
const NavbarBrandLogo: FunctionalComponent = () => {
|
|
37
38
|
if (!navbarBrandLogo.value) return null
|
|
38
39
|
const img = h('img', {
|
|
39
|
-
class: 'logo',
|
|
40
|
+
class: 'vp-site-logo',
|
|
40
41
|
src: withBase(navbarBrandLogo.value),
|
|
41
42
|
alt: navbarBrandLogoAlt.value,
|
|
42
43
|
})
|
|
@@ -55,11 +56,42 @@ const NavbarBrandLogo: FunctionalComponent = () => {
|
|
|
55
56
|
|
|
56
57
|
<span
|
|
57
58
|
v-if="navbarBrandTitle"
|
|
58
|
-
class="site-name"
|
|
59
|
-
:class="{ '
|
|
59
|
+
class="vp-site-name"
|
|
60
|
+
:class="{ 'vp-hide-mobile': navbarBrandLogo }"
|
|
60
61
|
:aria-hidden="navBarLogoAltMatchesTitle"
|
|
61
62
|
>
|
|
62
63
|
{{ navbarBrandTitle }}
|
|
63
64
|
</span>
|
|
64
65
|
</RouteLink>
|
|
65
66
|
</template>
|
|
67
|
+
|
|
68
|
+
<style lang="scss">
|
|
69
|
+
@import '../styles/variables';
|
|
70
|
+
|
|
71
|
+
.vp-site-logo {
|
|
72
|
+
vertical-align: top;
|
|
73
|
+
height: var(--navbar-line-height);
|
|
74
|
+
margin-right: var(--navbar-padding-v);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.vp-site-name {
|
|
78
|
+
position: relative;
|
|
79
|
+
color: var(--c-text);
|
|
80
|
+
font-weight: 600;
|
|
81
|
+
font-size: 1.3rem;
|
|
82
|
+
|
|
83
|
+
@media screen and (max-width: $MQMobile) {
|
|
84
|
+
display: block;
|
|
85
|
+
|
|
86
|
+
overflow: hidden;
|
|
87
|
+
|
|
88
|
+
// 5.5rem for navbar padding-inline
|
|
89
|
+
// 4.5rem for ColorModeSwitch and VPSearch
|
|
90
|
+
// 1rem for gap
|
|
91
|
+
width: calc(100vw - 11rem);
|
|
92
|
+
|
|
93
|
+
text-overflow: ellipsis;
|
|
94
|
+
white-space: nowrap;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
</style>
|