@vuepress/theme-default 2.0.0-rc.6 → 2.0.0-rc.60
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/VPDropdownTransition.vue +36 -0
- package/lib/client/components/VPEditIcon.vue +12 -0
- package/lib/client/components/VPHome.vue +38 -0
- package/lib/client/components/VPHomeFeatures.vue +66 -0
- package/lib/client/components/{HomeFooter.vue → VPHomeFooter.vue} +17 -2
- package/lib/client/components/{HomeHero.vue → VPHomeHero.vue} +113 -19
- package/lib/client/components/VPLightIcon.vue +28 -0
- package/lib/client/components/VPNavbar.vue +134 -0
- package/lib/client/components/{NavbarBrand.vue → VPNavbarBrand.vue} +40 -7
- package/lib/client/components/VPNavbarDropdown.vue +334 -0
- package/lib/client/components/VPNavbarItems.vue +111 -0
- package/lib/client/components/VPPage.vue +72 -0
- package/lib/client/components/VPPageMeta.vue +134 -0
- package/lib/client/components/VPPageNav.vue +118 -0
- package/lib/client/components/VPSidebar.vue +113 -0
- package/lib/client/components/VPSidebarItem.vue +174 -0
- package/lib/client/components/{SidebarItems.vue → VPSidebarItems.vue} +32 -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 +8 -0
- package/lib/client/composables/index.js +8 -0
- package/lib/client/composables/useContributors.d.ts +3 -0
- package/lib/client/composables/useContributors.js +14 -0
- package/lib/client/composables/useDarkMode.d.ts +0 -1
- package/lib/client/composables/useDarkMode.js +16 -13
- 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 +27 -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 +59 -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 +91 -0
- package/lib/client/composables/useScrollPromise.js +3 -1
- package/lib/client/composables/useSidebarItems.d.ts +28 -23
- package/lib/client/composables/useSidebarItems.js +120 -84
- 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 +6 -23
- package/lib/client/index.d.ts +2 -1
- package/lib/client/index.js +0 -1
- package/lib/client/layouts/Layout.vue +139 -34
- package/lib/client/layouts/NotFound.vue +17 -5
- package/lib/client/shim.d.ts +12 -3
- 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 +18 -24
- package/lib/client/styles/code-group.scss +35 -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 +3 -199
- 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 +53 -129
- package/lib/client/typings.d.ts +13 -0
- package/lib/client/typings.js +1 -0
- package/lib/client/utils/getAutoLink.d.ts +9 -0
- package/lib/client/utils/getAutoLink.js +17 -0
- package/lib/client/utils/index.d.ts +3 -2
- package/lib/client/utils/index.js +3 -2
- package/lib/client/utils/isActiveSidebarItem.d.ts +3 -3
- 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/resolveEditLink.d.ts +1 -1
- 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 +40 -49
- package/lib/node/index.d.ts +2 -3
- package/lib/node/index.js +0 -3
- package/lib/node/typings.d.ts +58 -0
- package/lib/node/typings.js +1 -0
- package/lib/node/utils/assignDefaultLocaleOptions.js +3 -7
- 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 -65
- 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 +30 -28
- package/templates/build.html +14 -8
- 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/Navbar.vue +0 -79
- package/lib/client/components/NavbarDropdown.vue +0 -126
- package/lib/client/components/NavbarItems.vue +0 -199
- 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/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 -15
- package/lib/client/utils/getNavLink.js +0 -18
- package/lib/client/utils/getResolveRouteWithRedirect.d.ts +0 -5
- package/lib/client/utils/getResolveRouteWithRedirect.js +0 -22
- package/lib/node/utils/resolveContainerPluginOptions.d.ts +0 -8
- package/lib/node/utils/resolveContainerPluginOptions.js +0 -17
|
@@ -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>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { VNode } from 'vue'
|
|
3
|
+
|
|
4
|
+
defineSlots<{
|
|
5
|
+
default?: (props: Record<never, never>) => VNode | VNode[] | null
|
|
6
|
+
}>()
|
|
7
|
+
|
|
8
|
+
const setHeight = (item: Element): void => {
|
|
9
|
+
// explicitly set height so that it can be transitioned
|
|
10
|
+
;(item as HTMLElement).style.height = `${item.scrollHeight}px`
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const unsetHeight = (item: Element): void => {
|
|
14
|
+
;(item as HTMLElement).style.height = ''
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<Transition
|
|
20
|
+
name="vp-dropdown"
|
|
21
|
+
@enter="setHeight"
|
|
22
|
+
@after-enter="unsetHeight"
|
|
23
|
+
@before-leave="setHeight"
|
|
24
|
+
>
|
|
25
|
+
<slot />
|
|
26
|
+
</Transition>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<style lang="scss">
|
|
30
|
+
.vp-dropdown {
|
|
31
|
+
&-enter-from,
|
|
32
|
+
&-leave-to {
|
|
33
|
+
height: 0 !important;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
</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" vp-content>
|
|
13
|
+
<Content />
|
|
14
|
+
</div>
|
|
15
|
+
<VPHomeFooter />
|
|
16
|
+
</main>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<style lang="scss">
|
|
20
|
+
@use '../styles/variables' as *;
|
|
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,66 @@
|
|
|
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
|
+
<!-- eslint-disable-next-line vue/no-root-v-if -->
|
|
12
|
+
<template>
|
|
13
|
+
<div v-if="features.length" class="vp-features">
|
|
14
|
+
<div v-for="feature in features" :key="feature.title" class="vp-feature">
|
|
15
|
+
<h2>{{ feature.title }}</h2>
|
|
16
|
+
<p>{{ feature.details }}</p>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<style lang="scss">
|
|
22
|
+
@use '../styles/variables' as *;
|
|
23
|
+
|
|
24
|
+
.vp-features {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-wrap: wrap;
|
|
27
|
+
place-content: stretch space-between;
|
|
28
|
+
align-items: flex-start;
|
|
29
|
+
|
|
30
|
+
margin-top: 2.5rem;
|
|
31
|
+
padding: 1.2rem 0;
|
|
32
|
+
border-top: 1px solid var(--vp-c-gutter);
|
|
33
|
+
|
|
34
|
+
transition: border-color var(--vp-t-color);
|
|
35
|
+
|
|
36
|
+
@media (max-width: $MQMobile) {
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.vp-feature {
|
|
42
|
+
flex-grow: 1;
|
|
43
|
+
flex-basis: 30%;
|
|
44
|
+
max-width: 30%;
|
|
45
|
+
|
|
46
|
+
@media (max-width: $MQMobile) {
|
|
47
|
+
max-width: 100%;
|
|
48
|
+
padding: 0 2.5rem;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
h2 {
|
|
52
|
+
padding-bottom: 0;
|
|
53
|
+
border-bottom: none;
|
|
54
|
+
font-weight: 500;
|
|
55
|
+
font-size: 1.4rem;
|
|
56
|
+
|
|
57
|
+
@media (max-width: $MQMobileNarrow) {
|
|
58
|
+
font-size: 1.25rem;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
p {
|
|
63
|
+
color: var(--vp-c-text-mute);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
</style>
|
|
@@ -4,14 +4,29 @@ 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>
|
|
10
11
|
|
|
12
|
+
<!-- eslint-disable-next-line vue/no-root-v-if -->
|
|
11
13
|
<template>
|
|
12
14
|
<template v-if="footer">
|
|
13
15
|
<!-- 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" />
|
|
16
|
+
<div v-if="footerHtml" class="vp-footer" vp-footer v-html="footer" />
|
|
17
|
+
<div v-else class="vp-footer" vp-footer v-text="footer" />
|
|
16
18
|
</template>
|
|
17
19
|
</template>
|
|
20
|
+
|
|
21
|
+
<style>
|
|
22
|
+
.vp-footer {
|
|
23
|
+
padding: 2.5rem;
|
|
24
|
+
border-top: 1px solid var(--vp-c-border);
|
|
25
|
+
|
|
26
|
+
color: var(--vp-c-text-mute);
|
|
27
|
+
|
|
28
|
+
text-align: center;
|
|
29
|
+
|
|
30
|
+
transition: border-color var(--vp-t-color);
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
@@ -1,48 +1,47 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import { useDarkMode } from '@theme/useDarkMode'
|
|
3
3
|
import type { FunctionalComponent } from 'vue'
|
|
4
4
|
import { computed, h } from 'vue'
|
|
5
5
|
import {
|
|
6
|
+
AutoLink,
|
|
6
7
|
ClientOnly,
|
|
7
8
|
usePageFrontmatter,
|
|
8
9
|
useSiteLocaleData,
|
|
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()
|
|
16
16
|
const isDarkMode = useDarkMode()
|
|
17
17
|
|
|
18
|
-
const heroImage = computed(() => {
|
|
19
|
-
if (isDarkMode.value && frontmatter.value.heroImageDark !== undefined) {
|
|
20
|
-
return frontmatter.value.heroImageDark
|
|
21
|
-
}
|
|
22
|
-
return frontmatter.value.heroImage
|
|
23
|
-
})
|
|
24
|
-
const heroAlt = computed(
|
|
25
|
-
() => frontmatter.value.heroAlt || heroText.value || 'hero',
|
|
26
|
-
)
|
|
27
|
-
const heroHeight = computed(() => frontmatter.value.heroHeight || 280)
|
|
28
|
-
|
|
29
18
|
const heroText = computed(() => {
|
|
30
19
|
if (frontmatter.value.heroText === null) {
|
|
31
20
|
return null
|
|
32
21
|
}
|
|
33
22
|
return frontmatter.value.heroText || siteLocale.value.title || 'Hello'
|
|
34
23
|
})
|
|
35
|
-
|
|
36
24
|
const tagline = computed(() => {
|
|
37
25
|
if (frontmatter.value.tagline === null) {
|
|
38
26
|
return null
|
|
39
27
|
}
|
|
28
|
+
|
|
40
29
|
return (
|
|
41
30
|
frontmatter.value.tagline ||
|
|
42
31
|
siteLocale.value.description ||
|
|
43
32
|
'Welcome to your VuePress site'
|
|
44
33
|
)
|
|
45
34
|
})
|
|
35
|
+
const heroImage = computed(() => {
|
|
36
|
+
if (isDarkMode.value && frontmatter.value.heroImageDark !== undefined) {
|
|
37
|
+
return frontmatter.value.heroImageDark
|
|
38
|
+
}
|
|
39
|
+
return frontmatter.value.heroImage
|
|
40
|
+
})
|
|
41
|
+
const heroAlt = computed(
|
|
42
|
+
() => frontmatter.value.heroAlt || heroText.value || 'hero',
|
|
43
|
+
)
|
|
44
|
+
const heroHeight = computed(() => frontmatter.value.heroHeight ?? 280)
|
|
46
45
|
|
|
47
46
|
const actions = computed(() => {
|
|
48
47
|
if (!Array.isArray(frontmatter.value.actions)) {
|
|
@@ -58,14 +57,18 @@ const actions = computed(() => {
|
|
|
58
57
|
|
|
59
58
|
const HomeHeroImage: FunctionalComponent = () => {
|
|
60
59
|
if (!heroImage.value) return null
|
|
60
|
+
|
|
61
61
|
const img = h('img', {
|
|
62
|
+
class: 'vp-hero-image',
|
|
62
63
|
src: withBase(heroImage.value),
|
|
63
64
|
alt: heroAlt.value,
|
|
64
65
|
height: heroHeight.value,
|
|
65
66
|
})
|
|
67
|
+
|
|
66
68
|
if (frontmatter.value.heroImageDark === undefined) {
|
|
67
69
|
return img
|
|
68
70
|
}
|
|
71
|
+
|
|
69
72
|
// wrap hero image with <ClientOnly> to avoid ssr-mismatch
|
|
70
73
|
// when using a different hero image in dark mode
|
|
71
74
|
return h(ClientOnly, () => img)
|
|
@@ -73,25 +76,116 @@ const HomeHeroImage: FunctionalComponent = () => {
|
|
|
73
76
|
</script>
|
|
74
77
|
|
|
75
78
|
<template>
|
|
76
|
-
<header class="hero">
|
|
79
|
+
<header class="vp-hero">
|
|
77
80
|
<HomeHeroImage />
|
|
78
81
|
|
|
79
82
|
<h1 v-if="heroText" id="main-title">
|
|
80
83
|
{{ heroText }}
|
|
81
84
|
</h1>
|
|
82
85
|
|
|
83
|
-
<p v-if="tagline" class="description">
|
|
86
|
+
<p v-if="tagline" class="vp-hero-description">
|
|
84
87
|
{{ tagline }}
|
|
85
88
|
</p>
|
|
86
89
|
|
|
87
|
-
<p v-if="actions.length" class="actions">
|
|
90
|
+
<p v-if="actions.length" class="vp-hero-actions">
|
|
88
91
|
<AutoLink
|
|
89
92
|
v-for="action in actions"
|
|
90
93
|
:key="action.text"
|
|
91
|
-
class="action-button"
|
|
94
|
+
class="vp-hero-action-button"
|
|
92
95
|
:class="[action.type]"
|
|
93
|
-
:
|
|
96
|
+
:config="action"
|
|
94
97
|
/>
|
|
95
98
|
</p>
|
|
96
99
|
</header>
|
|
97
100
|
</template>
|
|
101
|
+
|
|
102
|
+
<style lang="scss">
|
|
103
|
+
@use '../styles/variables' as *;
|
|
104
|
+
|
|
105
|
+
.vp-hero {
|
|
106
|
+
text-align: center;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.vp-hero-image {
|
|
110
|
+
display: block;
|
|
111
|
+
max-width: 100%;
|
|
112
|
+
max-height: 280px;
|
|
113
|
+
margin: 3rem auto 1.5rem;
|
|
114
|
+
|
|
115
|
+
@media (max-width: $MQMobileNarrow) {
|
|
116
|
+
max-height: 210px;
|
|
117
|
+
margin: 2rem auto 1.2rem;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
#main-title {
|
|
122
|
+
font-size: 3rem;
|
|
123
|
+
|
|
124
|
+
@media (max-width: $MQMobileNarrow) {
|
|
125
|
+
font-size: 2rem;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
#main-title,
|
|
130
|
+
.vp-hero-description,
|
|
131
|
+
.vp-hero-actions {
|
|
132
|
+
margin: 1.8rem auto;
|
|
133
|
+
|
|
134
|
+
@media (max-width: $MQMobileNarrow) {
|
|
135
|
+
margin: 1.2rem auto;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.vp-hero-actions {
|
|
140
|
+
display: flex;
|
|
141
|
+
flex-wrap: wrap;
|
|
142
|
+
gap: 1rem;
|
|
143
|
+
justify-content: center;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.vp-hero-description {
|
|
147
|
+
max-width: 35rem;
|
|
148
|
+
color: var(--vp-c-text-mute);
|
|
149
|
+
font-size: 1.6rem;
|
|
150
|
+
line-height: 1.3;
|
|
151
|
+
|
|
152
|
+
@media (max-width: $MQMobileNarrow) {
|
|
153
|
+
font-size: 1.2rem;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.vp-hero-action-button {
|
|
158
|
+
display: inline-block;
|
|
159
|
+
|
|
160
|
+
box-sizing: border-box;
|
|
161
|
+
padding: 0.8rem 1.6rem;
|
|
162
|
+
border: 2px solid var(--vp-c-accent-bg);
|
|
163
|
+
border-radius: 4px;
|
|
164
|
+
|
|
165
|
+
background-color: var(--vp-c-bg);
|
|
166
|
+
color: var(--vp-c-accent);
|
|
167
|
+
|
|
168
|
+
font-size: 1.2rem;
|
|
169
|
+
|
|
170
|
+
transition: background-color border-color color var(--vp-t-color);
|
|
171
|
+
|
|
172
|
+
@media (max-width: $MQMobileNarrow) {
|
|
173
|
+
padding: 0.6rem 1.2rem;
|
|
174
|
+
font-size: 1rem;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&:hover {
|
|
178
|
+
color: var(--vp-c-accent-text);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
&.primary {
|
|
182
|
+
background-color: var(--vp-c-accent-bg);
|
|
183
|
+
color: var(--vp-c-accent-text);
|
|
184
|
+
|
|
185
|
+
&:hover {
|
|
186
|
+
border-color: var(--vp-c-accent-hover);
|
|
187
|
+
background-color: var(--vp-c-accent-hover);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
</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,134 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import VPNavbarBrand from '@theme/VPNavbarBrand.vue'
|
|
3
|
+
import VPNavbarItems from '@theme/VPNavbarItems.vue'
|
|
4
|
+
import VPToggleColorModeButton from '@theme/VPToggleColorModeButton.vue'
|
|
5
|
+
import VPToggleSidebarButton from '@theme/VPToggleSidebarButton.vue'
|
|
6
|
+
import { useThemeLocaleData } from '@theme/useThemeData'
|
|
7
|
+
import { DeviceType, useUpdateDeviceStatus } from '@theme/useUpdateDeviceStatus'
|
|
8
|
+
import { hasGlobalComponent } from '@vuepress/helper/client'
|
|
9
|
+
import type { VNode } from 'vue'
|
|
10
|
+
import { computed, ref, resolveComponent } from 'vue'
|
|
11
|
+
|
|
12
|
+
defineEmits<{
|
|
13
|
+
toggleSidebar: []
|
|
14
|
+
}>()
|
|
15
|
+
|
|
16
|
+
defineSlots<{
|
|
17
|
+
before?: (props: Record<never, never>) => VNode | VNode[] | null
|
|
18
|
+
after?: (props: Record<never, never>) => VNode | VNode[] | null
|
|
19
|
+
}>()
|
|
20
|
+
|
|
21
|
+
const SearchBox = hasGlobalComponent('SearchBox')
|
|
22
|
+
? resolveComponent('SearchBox')
|
|
23
|
+
: (): null => null
|
|
24
|
+
|
|
25
|
+
const themeLocale = useThemeLocaleData()
|
|
26
|
+
|
|
27
|
+
const navbar = ref<HTMLElement | null>(null)
|
|
28
|
+
const navbarBrand = ref<HTMLElement | null>(null)
|
|
29
|
+
|
|
30
|
+
const linksWrapperMaxWidth = ref(0)
|
|
31
|
+
const linksWrapperStyle = computed(() => {
|
|
32
|
+
if (!linksWrapperMaxWidth.value) {
|
|
33
|
+
return {}
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
maxWidth: `${linksWrapperMaxWidth.value}px`,
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const getCssValue = (el: HTMLElement | null, property: string): number => {
|
|
41
|
+
// NOTE: Known bug, will return 'auto' if style value is 'auto'
|
|
42
|
+
const val = el?.ownerDocument.defaultView?.getComputedStyle(el, null)[
|
|
43
|
+
property as keyof CSSStyleDeclaration
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
const num = Number.parseInt(val as string, 10)
|
|
47
|
+
|
|
48
|
+
return Number.isNaN(num) ? 0 : num
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
useUpdateDeviceStatus(
|
|
52
|
+
DeviceType.Mobile,
|
|
53
|
+
(mobileDesktopBreakpoint: number): void => {
|
|
54
|
+
// avoid overlapping of long title and long navbar links
|
|
55
|
+
const navbarHorizontalPadding =
|
|
56
|
+
getCssValue(navbar.value, 'paddingLeft') +
|
|
57
|
+
getCssValue(navbar.value, 'paddingRight')
|
|
58
|
+
if (window.innerWidth < mobileDesktopBreakpoint) {
|
|
59
|
+
linksWrapperMaxWidth.value = 0
|
|
60
|
+
} else {
|
|
61
|
+
linksWrapperMaxWidth.value =
|
|
62
|
+
navbar.value!.offsetWidth -
|
|
63
|
+
navbarHorizontalPadding -
|
|
64
|
+
(navbarBrand.value?.offsetWidth ?? 0)
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
)
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<template>
|
|
71
|
+
<header ref="navbar" class="vp-navbar" vp-navbar>
|
|
72
|
+
<VPToggleSidebarButton @toggle="$emit('toggleSidebar')" />
|
|
73
|
+
|
|
74
|
+
<span ref="navbarBrand">
|
|
75
|
+
<VPNavbarBrand />
|
|
76
|
+
</span>
|
|
77
|
+
|
|
78
|
+
<div class="vp-navbar-items-wrapper" :style="linksWrapperStyle">
|
|
79
|
+
<slot name="before" />
|
|
80
|
+
<VPNavbarItems class="vp-hide-mobile" />
|
|
81
|
+
<slot name="after" />
|
|
82
|
+
<VPToggleColorModeButton v-if="themeLocale.colorModeSwitch" />
|
|
83
|
+
<SearchBox />
|
|
84
|
+
</div>
|
|
85
|
+
</header>
|
|
86
|
+
</template>
|
|
87
|
+
|
|
88
|
+
<style lang="scss">
|
|
89
|
+
@use '../styles/variables' as *;
|
|
90
|
+
|
|
91
|
+
.vp-navbar {
|
|
92
|
+
--navbar-line-height: calc(
|
|
93
|
+
var(--navbar-height) - 2 * var(--navbar-padding-v)
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
position: fixed;
|
|
97
|
+
top: 0;
|
|
98
|
+
right: 0;
|
|
99
|
+
left: 0;
|
|
100
|
+
z-index: 20;
|
|
101
|
+
|
|
102
|
+
box-sizing: border-box;
|
|
103
|
+
height: var(--navbar-height);
|
|
104
|
+
padding: var(--navbar-padding-v) var(--navbar-padding-h);
|
|
105
|
+
border-bottom: 1px solid var(--vp-c-border);
|
|
106
|
+
|
|
107
|
+
background-color: var(--vp-navbar-c-bg);
|
|
108
|
+
|
|
109
|
+
line-height: var(--navbar-line-height);
|
|
110
|
+
|
|
111
|
+
transition:
|
|
112
|
+
background-color var(--vp-t-color),
|
|
113
|
+
border-color var(--vp-t-color);
|
|
114
|
+
|
|
115
|
+
@media screen and (max-width: $MQMobile) {
|
|
116
|
+
padding-left: 4rem;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.vp-navbar-items-wrapper {
|
|
121
|
+
position: absolute;
|
|
122
|
+
top: var(--navbar-padding-v);
|
|
123
|
+
right: var(--navbar-padding-h);
|
|
124
|
+
|
|
125
|
+
display: flex;
|
|
126
|
+
|
|
127
|
+
box-sizing: border-box;
|
|
128
|
+
height: var(--navbar-line-height);
|
|
129
|
+
padding-left: var(--navbar-padding-h);
|
|
130
|
+
|
|
131
|
+
font-size: 0.9rem;
|
|
132
|
+
white-space: nowrap;
|
|
133
|
+
}
|
|
134
|
+
</style>
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { useDarkMode } from '@theme/useDarkMode'
|
|
3
|
+
import { useThemeLocaleData } from '@theme/useThemeData'
|
|
3
4
|
import type { FunctionalComponent } from 'vue'
|
|
5
|
+
import { computed, h } from 'vue'
|
|
4
6
|
import {
|
|
5
7
|
ClientOnly,
|
|
8
|
+
RouteLink,
|
|
6
9
|
useRouteLocale,
|
|
7
10
|
useSiteLocaleData,
|
|
8
11
|
withBase,
|
|
9
12
|
} from 'vuepress/client'
|
|
10
|
-
import { useDarkMode, useThemeLocaleData } from '../composables/index.js'
|
|
11
13
|
|
|
12
14
|
const routeLocale = useRouteLocale()
|
|
13
15
|
const siteLocale = useSiteLocaleData()
|
|
@@ -35,7 +37,7 @@ const navBarLogoAltMatchesTitle = computed(
|
|
|
35
37
|
const NavbarBrandLogo: FunctionalComponent = () => {
|
|
36
38
|
if (!navbarBrandLogo.value) return null
|
|
37
39
|
const img = h('img', {
|
|
38
|
-
class: 'logo',
|
|
40
|
+
class: 'vp-site-logo',
|
|
39
41
|
src: withBase(navbarBrandLogo.value),
|
|
40
42
|
alt: navbarBrandLogoAlt.value,
|
|
41
43
|
})
|
|
@@ -49,16 +51,47 @@ const NavbarBrandLogo: FunctionalComponent = () => {
|
|
|
49
51
|
</script>
|
|
50
52
|
|
|
51
53
|
<template>
|
|
52
|
-
<
|
|
54
|
+
<RouteLink :to="navbarBrandLink">
|
|
53
55
|
<NavbarBrandLogo />
|
|
54
56
|
|
|
55
57
|
<span
|
|
56
58
|
v-if="navbarBrandTitle"
|
|
57
|
-
class="site-name"
|
|
58
|
-
:class="{ '
|
|
59
|
+
class="vp-site-name"
|
|
60
|
+
:class="{ 'vp-hide-mobile': navbarBrandLogo }"
|
|
59
61
|
:aria-hidden="navBarLogoAltMatchesTitle"
|
|
60
62
|
>
|
|
61
63
|
{{ navbarBrandTitle }}
|
|
62
64
|
</span>
|
|
63
|
-
</
|
|
65
|
+
</RouteLink>
|
|
64
66
|
</template>
|
|
67
|
+
|
|
68
|
+
<style lang="scss">
|
|
69
|
+
@use '../styles/variables' as *;
|
|
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(--vp-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 SearchBox
|
|
90
|
+
// 1rem for gap
|
|
91
|
+
width: calc(100vw - 11rem);
|
|
92
|
+
|
|
93
|
+
text-overflow: ellipsis;
|
|
94
|
+
white-space: nowrap;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
</style>
|