@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,26 @@
|
|
|
1
|
+
import type { AutoLinkOptions, NavItemOptions } from './nav.js';
|
|
2
|
+
export type SidebarLinkOptions = AutoLinkOptions;
|
|
3
|
+
export interface SidebarGroupOptions extends NavItemOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Link prefix of current group
|
|
6
|
+
*/
|
|
7
|
+
prefix?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Link of current group
|
|
10
|
+
*/
|
|
11
|
+
link?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether current group is collapsible
|
|
14
|
+
*
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
collapsible?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Children of current group
|
|
20
|
+
*/
|
|
21
|
+
children: SidebarItemOptions[];
|
|
22
|
+
}
|
|
23
|
+
export type SidebarItemOptions = SidebarGroupOptions | SidebarLinkOptions | string;
|
|
24
|
+
export type SidebarArrayOptions = SidebarItemOptions[];
|
|
25
|
+
export type SidebarObjectOptions = Record<string, SidebarArrayOptions | 'heading' | false>;
|
|
26
|
+
export type SidebarOptions = SidebarArrayOptions | SidebarObjectOptions | 'heading';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
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.102",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"author": "meteorlxy",
|
|
22
|
+
"sideEffects": [
|
|
23
|
+
"./lib/client/components/**/*.vue",
|
|
24
|
+
"./lib/client/layouts/*.vue",
|
|
25
|
+
"./lib/client/styles/*.scss"
|
|
26
|
+
],
|
|
22
27
|
"type": "module",
|
|
23
28
|
"exports": {
|
|
24
29
|
".": "./lib/node/index.js",
|
|
@@ -36,36 +41,38 @@
|
|
|
36
41
|
"lib",
|
|
37
42
|
"templates"
|
|
38
43
|
],
|
|
39
|
-
"scripts": {
|
|
40
|
-
"build": "tsc -b tsconfig.build.json",
|
|
41
|
-
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
|
|
42
|
-
"copy": "cpx \"src/**/*.{d.ts,vue,scss}\" lib"
|
|
43
|
-
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@vuepress/helper": "
|
|
46
|
-
"@vuepress/plugin-active-header-links": "2.0.0-rc.
|
|
47
|
-
"@vuepress/plugin-back-to-top": "2.0.0-rc.
|
|
48
|
-
"@vuepress/plugin-
|
|
49
|
-
"@vuepress/plugin-
|
|
50
|
-
"@vuepress/plugin-
|
|
51
|
-
"@vuepress/plugin-
|
|
52
|
-
"@vuepress/plugin-
|
|
53
|
-
"@vuepress/plugin-
|
|
54
|
-
"@vuepress/plugin-
|
|
55
|
-
"@vuepress/plugin-
|
|
56
|
-
"@vuepress/plugin-
|
|
57
|
-
"@vuepress/plugin-
|
|
58
|
-
"@vuepress/plugin-
|
|
59
|
-
"@
|
|
60
|
-
"
|
|
61
|
-
"vue": "^3.
|
|
62
|
-
"vue-router": "^4.2.5"
|
|
45
|
+
"@vuepress/helper": "2.0.0-rc.102",
|
|
46
|
+
"@vuepress/plugin-active-header-links": "2.0.0-rc.98",
|
|
47
|
+
"@vuepress/plugin-back-to-top": "2.0.0-rc.102",
|
|
48
|
+
"@vuepress/plugin-copy-code": "2.0.0-rc.102",
|
|
49
|
+
"@vuepress/plugin-git": "2.0.0-rc.102",
|
|
50
|
+
"@vuepress/plugin-links-check": "2.0.0-rc.102",
|
|
51
|
+
"@vuepress/plugin-markdown-hint": "2.0.0-rc.102",
|
|
52
|
+
"@vuepress/plugin-markdown-tab": "2.0.0-rc.102",
|
|
53
|
+
"@vuepress/plugin-medium-zoom": "2.0.0-rc.102",
|
|
54
|
+
"@vuepress/plugin-nprogress": "2.0.0-rc.102",
|
|
55
|
+
"@vuepress/plugin-palette": "2.0.0-rc.102",
|
|
56
|
+
"@vuepress/plugin-prismjs": "2.0.0-rc.102",
|
|
57
|
+
"@vuepress/plugin-seo": "2.0.0-rc.102",
|
|
58
|
+
"@vuepress/plugin-sitemap": "2.0.0-rc.102",
|
|
59
|
+
"@vuepress/plugin-theme-data": "2.0.0-rc.102",
|
|
60
|
+
"@vueuse/core": "^13.1.0",
|
|
61
|
+
"vue": "^3.5.13"
|
|
63
62
|
},
|
|
64
63
|
"peerDependencies": {
|
|
65
|
-
"sass
|
|
66
|
-
"
|
|
64
|
+
"sass": "^1.86.3",
|
|
65
|
+
"sass-embedded": "^1.86.3",
|
|
66
|
+
"sass-loader": "^16.0.5",
|
|
67
|
+
"vuepress": "2.0.0-rc.22"
|
|
67
68
|
},
|
|
68
69
|
"peerDependenciesMeta": {
|
|
70
|
+
"sass": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"sass-embedded": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
69
76
|
"sass-loader": {
|
|
70
77
|
"optional": true
|
|
71
78
|
}
|
|
@@ -73,5 +80,5 @@
|
|
|
73
80
|
"publishConfig": {
|
|
74
81
|
"access": "public"
|
|
75
82
|
},
|
|
76
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "f5eea8cc78924696580c659e738d7f4b6409faee"
|
|
77
84
|
}
|
package/templates/build.html
CHANGED
|
@@ -6,23 +6,29 @@
|
|
|
6
6
|
<meta name="generator" content="VuePress {{ version }}" />
|
|
7
7
|
<style>
|
|
8
8
|
:root {
|
|
9
|
-
--c-bg: #fff;
|
|
9
|
+
--vp-c-bg: #fff;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
|
|
12
|
+
[data-theme='dark'] {
|
|
13
|
+
--vp-c-bg: #1b1b1f;
|
|
13
14
|
}
|
|
15
|
+
|
|
14
16
|
html,
|
|
15
17
|
body {
|
|
16
|
-
background-color: var(--c-bg);
|
|
18
|
+
background-color: var(--vp-c-bg);
|
|
17
19
|
}
|
|
18
20
|
</style>
|
|
19
21
|
<script>
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const useChoice = localStorage.getItem('vuepress-color-scheme')
|
|
23
|
+
const systemStatus =
|
|
24
|
+
'matchMedia' in window
|
|
25
|
+
? window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
26
|
+
: false
|
|
27
|
+
|
|
28
|
+
if (useChoice === 'light') {
|
|
29
|
+
document.documentElement.dataset.theme = 'light'
|
|
30
|
+
} else if (useChoice === 'dark' || systemStatus) {
|
|
31
|
+
document.documentElement.dataset.theme = 'dark'
|
|
26
32
|
}
|
|
27
33
|
</script>
|
|
28
34
|
<!--vuepress-ssr-head-->
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, toRefs } from 'vue'
|
|
3
|
-
import type { PropType } from 'vue'
|
|
4
|
-
import { useRoute } from 'vue-router'
|
|
5
|
-
import { useSiteData } from 'vuepress/client'
|
|
6
|
-
import { isLinkHttp, isLinkWithProtocol } from 'vuepress/shared'
|
|
7
|
-
import type { NavLink } from '../../shared/index.js'
|
|
8
|
-
|
|
9
|
-
defineOptions({
|
|
10
|
-
inheritAttrs: false,
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
const props = defineProps({
|
|
14
|
-
item: {
|
|
15
|
-
type: Object as PropType<NavLink>,
|
|
16
|
-
required: true,
|
|
17
|
-
},
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
defineSlots<{
|
|
21
|
-
before?: (props: Record<never, never>) => any
|
|
22
|
-
after?: (props: Record<never, never>) => any
|
|
23
|
-
}>()
|
|
24
|
-
|
|
25
|
-
const route = useRoute()
|
|
26
|
-
const site = useSiteData()
|
|
27
|
-
const { item } = toRefs(props)
|
|
28
|
-
|
|
29
|
-
// if the link has http protocol
|
|
30
|
-
const hasHttpProtocol = computed(() => isLinkHttp(item.value.link))
|
|
31
|
-
// if the link has non-http protocol
|
|
32
|
-
const hasNonHttpProtocol = computed(
|
|
33
|
-
() => !hasHttpProtocol.value && isLinkWithProtocol(item.value.link),
|
|
34
|
-
)
|
|
35
|
-
// resolve the `target` attr
|
|
36
|
-
const linkTarget = computed(() => {
|
|
37
|
-
if (hasNonHttpProtocol.value) return undefined
|
|
38
|
-
if (item.value.target) return item.value.target
|
|
39
|
-
if (hasHttpProtocol.value) return '_blank'
|
|
40
|
-
return undefined
|
|
41
|
-
})
|
|
42
|
-
// if the `target` attr is '_blank'
|
|
43
|
-
const isBlankTarget = computed(() => linkTarget.value === '_blank')
|
|
44
|
-
// is `<RouteLink>` or not
|
|
45
|
-
const isRouteLink = computed(
|
|
46
|
-
() =>
|
|
47
|
-
!hasHttpProtocol.value && !hasNonHttpProtocol.value && !isBlankTarget.value,
|
|
48
|
-
)
|
|
49
|
-
// resolve the `rel` attr
|
|
50
|
-
const linkRel = computed(() => {
|
|
51
|
-
if (hasNonHttpProtocol.value) return undefined
|
|
52
|
-
if (item.value.rel) return item.value.rel
|
|
53
|
-
if (isBlankTarget.value) return 'noopener noreferrer'
|
|
54
|
-
return undefined
|
|
55
|
-
})
|
|
56
|
-
// resolve the `aria-label` attr
|
|
57
|
-
const linkAriaLabel = computed(() => item.value.ariaLabel || item.value.text)
|
|
58
|
-
|
|
59
|
-
// should be active when current route is a subpath of this link
|
|
60
|
-
const shouldBeActiveInSubpath = computed(() => {
|
|
61
|
-
const localeKeys = Object.keys(site.value.locales)
|
|
62
|
-
if (localeKeys.length) {
|
|
63
|
-
return !localeKeys.some((key) => key === item.value.link)
|
|
64
|
-
}
|
|
65
|
-
return item.value.link !== '/'
|
|
66
|
-
})
|
|
67
|
-
// if this link is active in subpath
|
|
68
|
-
const isActiveInSubpath = computed(() => {
|
|
69
|
-
if (!shouldBeActiveInSubpath.value) {
|
|
70
|
-
return false
|
|
71
|
-
}
|
|
72
|
-
return route.path.startsWith(item.value.link)
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
// if this link is active
|
|
76
|
-
const isActive = computed(() => {
|
|
77
|
-
if (!isRouteLink.value) {
|
|
78
|
-
return false
|
|
79
|
-
}
|
|
80
|
-
if (item.value.activeMatch) {
|
|
81
|
-
return new RegExp(item.value.activeMatch).test(route.path)
|
|
82
|
-
}
|
|
83
|
-
return isActiveInSubpath.value
|
|
84
|
-
})
|
|
85
|
-
</script>
|
|
86
|
-
|
|
87
|
-
<template>
|
|
88
|
-
<RouteLink
|
|
89
|
-
v-if="isRouteLink"
|
|
90
|
-
:active="isActive"
|
|
91
|
-
:to="item.link"
|
|
92
|
-
:aria-label="linkAriaLabel"
|
|
93
|
-
v-bind="$attrs"
|
|
94
|
-
>
|
|
95
|
-
<slot name="before" />
|
|
96
|
-
{{ item.text }}
|
|
97
|
-
<slot name="after" />
|
|
98
|
-
</RouteLink>
|
|
99
|
-
<a
|
|
100
|
-
v-else
|
|
101
|
-
class="external-link"
|
|
102
|
-
:href="item.link"
|
|
103
|
-
:rel="linkRel"
|
|
104
|
-
:target="linkTarget"
|
|
105
|
-
:aria-label="linkAriaLabel"
|
|
106
|
-
v-bind="$attrs"
|
|
107
|
-
>
|
|
108
|
-
<slot name="before" />
|
|
109
|
-
{{ item.text }}
|
|
110
|
-
<AutoLinkExternalIcon v-if="isBlankTarget" />
|
|
111
|
-
<slot name="after" />
|
|
112
|
-
</a>
|
|
113
|
-
</template>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
defineSlots<{
|
|
3
|
-
default?: (props: Record<never, never>) => any
|
|
4
|
-
}>()
|
|
5
|
-
|
|
6
|
-
const setHeight = (items): void => {
|
|
7
|
-
// explicitly set height so that it can be transitioned
|
|
8
|
-
items.style.height = items.scrollHeight + 'px'
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const unsetHeight = (items): void => {
|
|
12
|
-
items.style.height = ''
|
|
13
|
-
}
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<template>
|
|
17
|
-
<Transition
|
|
18
|
-
name="dropdown"
|
|
19
|
-
@enter="setHeight"
|
|
20
|
-
@after-enter="unsetHeight"
|
|
21
|
-
@before-leave="setHeight"
|
|
22
|
-
>
|
|
23
|
-
<slot />
|
|
24
|
-
</Transition>
|
|
25
|
-
</template>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import HomeContent from '@theme/HomeContent.vue'
|
|
3
|
-
import HomeFeatures from '@theme/HomeFeatures.vue'
|
|
4
|
-
import HomeFooter from '@theme/HomeFooter.vue'
|
|
5
|
-
import HomeHero from '@theme/HomeHero.vue'
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<template>
|
|
9
|
-
<main class="home">
|
|
10
|
-
<HomeHero />
|
|
11
|
-
<HomeFeatures />
|
|
12
|
-
<HomeContent />
|
|
13
|
-
<HomeFooter />
|
|
14
|
-
</main>
|
|
15
|
-
</template>
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
const features = computed(() => {
|
|
8
|
-
if (Array.isArray(frontmatter.value.features)) {
|
|
9
|
-
return frontmatter.value.features
|
|
10
|
-
}
|
|
11
|
-
return []
|
|
12
|
-
})
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<template>
|
|
16
|
-
<div v-if="features.length" class="features">
|
|
17
|
-
<div v-for="feature in features" :key="feature.title" class="feature">
|
|
18
|
-
<h2>{{ feature.title }}</h2>
|
|
19
|
-
<p>{{ feature.details }}</p>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</template>
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
const footer = computed(() => frontmatter.value.footer)
|
|
8
|
-
const footerHtml = computed(() => frontmatter.value.footerHtml)
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<template>
|
|
12
|
-
<template v-if="footer">
|
|
13
|
-
<!-- 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
|
-
</template>
|
|
17
|
-
</template>
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import AutoLink from '@theme/AutoLink.vue'
|
|
3
|
-
import type { FunctionalComponent } from 'vue'
|
|
4
|
-
import { computed, h } from 'vue'
|
|
5
|
-
import {
|
|
6
|
-
ClientOnly,
|
|
7
|
-
usePageFrontmatter,
|
|
8
|
-
useSiteLocaleData,
|
|
9
|
-
withBase,
|
|
10
|
-
} from 'vuepress/client'
|
|
11
|
-
import type { DefaultThemeHomePageFrontmatter } from '../../shared/index.js'
|
|
12
|
-
import { useDarkMode } from '../composables/index.js'
|
|
13
|
-
|
|
14
|
-
const frontmatter = usePageFrontmatter<DefaultThemeHomePageFrontmatter>()
|
|
15
|
-
const siteLocale = useSiteLocaleData()
|
|
16
|
-
const isDarkMode = useDarkMode()
|
|
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
|
-
const heroText = computed(() => {
|
|
30
|
-
if (frontmatter.value.heroText === null) {
|
|
31
|
-
return null
|
|
32
|
-
}
|
|
33
|
-
return frontmatter.value.heroText || siteLocale.value.title || 'Hello'
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
const tagline = computed(() => {
|
|
37
|
-
if (frontmatter.value.tagline === null) {
|
|
38
|
-
return null
|
|
39
|
-
}
|
|
40
|
-
return (
|
|
41
|
-
frontmatter.value.tagline ||
|
|
42
|
-
siteLocale.value.description ||
|
|
43
|
-
'Welcome to your VuePress site'
|
|
44
|
-
)
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
const actions = computed(() => {
|
|
48
|
-
if (!Array.isArray(frontmatter.value.actions)) {
|
|
49
|
-
return []
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return frontmatter.value.actions.map(({ text, link, type = 'primary' }) => ({
|
|
53
|
-
text,
|
|
54
|
-
link,
|
|
55
|
-
type,
|
|
56
|
-
}))
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
const HomeHeroImage: FunctionalComponent = () => {
|
|
60
|
-
if (!heroImage.value) return null
|
|
61
|
-
const img = h('img', {
|
|
62
|
-
src: withBase(heroImage.value),
|
|
63
|
-
alt: heroAlt.value,
|
|
64
|
-
height: heroHeight.value,
|
|
65
|
-
})
|
|
66
|
-
if (frontmatter.value.heroImageDark === undefined) {
|
|
67
|
-
return img
|
|
68
|
-
}
|
|
69
|
-
// wrap hero image with <ClientOnly> to avoid ssr-mismatch
|
|
70
|
-
// when using a different hero image in dark mode
|
|
71
|
-
return h(ClientOnly, () => img)
|
|
72
|
-
}
|
|
73
|
-
</script>
|
|
74
|
-
|
|
75
|
-
<template>
|
|
76
|
-
<header class="hero">
|
|
77
|
-
<HomeHeroImage />
|
|
78
|
-
|
|
79
|
-
<h1 v-if="heroText" id="main-title">
|
|
80
|
-
{{ heroText }}
|
|
81
|
-
</h1>
|
|
82
|
-
|
|
83
|
-
<p v-if="tagline" class="description">
|
|
84
|
-
{{ tagline }}
|
|
85
|
-
</p>
|
|
86
|
-
|
|
87
|
-
<p v-if="actions.length" class="actions">
|
|
88
|
-
<AutoLink
|
|
89
|
-
v-for="action in actions"
|
|
90
|
-
:key="action.text"
|
|
91
|
-
class="action-button"
|
|
92
|
-
:class="[action.type]"
|
|
93
|
-
:item="action"
|
|
94
|
-
/>
|
|
95
|
-
</p>
|
|
96
|
-
</header>
|
|
97
|
-
</template>
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import NavbarBrand from '@theme/NavbarBrand.vue'
|
|
3
|
-
import NavbarItems from '@theme/NavbarItems.vue'
|
|
4
|
-
import ToggleColorModeButton from '@theme/ToggleColorModeButton.vue'
|
|
5
|
-
import ToggleSidebarButton from '@theme/ToggleSidebarButton.vue'
|
|
6
|
-
import { computed, ref } from 'vue'
|
|
7
|
-
import {
|
|
8
|
-
DeviceType,
|
|
9
|
-
useThemeLocaleData,
|
|
10
|
-
useUpdateDeviceStatus,
|
|
11
|
-
} from '../composables/index.js'
|
|
12
|
-
|
|
13
|
-
defineEmits<(e: 'toggle-sidebar') => void>()
|
|
14
|
-
|
|
15
|
-
defineSlots<{
|
|
16
|
-
before?: (props: Record<never, never>) => any
|
|
17
|
-
after?: (props: Record<never, never>) => any
|
|
18
|
-
}>()
|
|
19
|
-
|
|
20
|
-
const themeLocale = useThemeLocaleData()
|
|
21
|
-
|
|
22
|
-
const navbar = ref<HTMLElement | null>(null)
|
|
23
|
-
const navbarBrand = ref<HTMLElement | null>(null)
|
|
24
|
-
|
|
25
|
-
const linksWrapperMaxWidth = ref(0)
|
|
26
|
-
const linksWrapperStyle = computed(() => {
|
|
27
|
-
if (!linksWrapperMaxWidth.value) {
|
|
28
|
-
return {}
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
maxWidth: linksWrapperMaxWidth.value + 'px',
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
useUpdateDeviceStatus(
|
|
36
|
-
DeviceType.MOBILE,
|
|
37
|
-
(mobileDesktopBreakpoint: number): void => {
|
|
38
|
-
// avoid overlapping of long title and long navbar links
|
|
39
|
-
const navbarHorizontalPadding =
|
|
40
|
-
getCssValue(navbar.value, 'paddingLeft') +
|
|
41
|
-
getCssValue(navbar.value, 'paddingRight')
|
|
42
|
-
if (window.innerWidth < mobileDesktopBreakpoint) {
|
|
43
|
-
linksWrapperMaxWidth.value = 0
|
|
44
|
-
} else {
|
|
45
|
-
linksWrapperMaxWidth.value =
|
|
46
|
-
navbar.value!.offsetWidth -
|
|
47
|
-
navbarHorizontalPadding -
|
|
48
|
-
(navbarBrand.value?.offsetWidth || 0)
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
function getCssValue(el: HTMLElement | null, property: string): number {
|
|
54
|
-
// NOTE: Known bug, will return 'auto' if style value is 'auto'
|
|
55
|
-
const val = el?.ownerDocument?.defaultView?.getComputedStyle(el, null)?.[
|
|
56
|
-
property
|
|
57
|
-
]
|
|
58
|
-
const num = Number.parseInt(val, 10)
|
|
59
|
-
return Number.isNaN(num) ? 0 : num
|
|
60
|
-
}
|
|
61
|
-
</script>
|
|
62
|
-
|
|
63
|
-
<template>
|
|
64
|
-
<header ref="navbar" class="navbar">
|
|
65
|
-
<ToggleSidebarButton @toggle="$emit('toggle-sidebar')" />
|
|
66
|
-
|
|
67
|
-
<span ref="navbarBrand">
|
|
68
|
-
<NavbarBrand />
|
|
69
|
-
</span>
|
|
70
|
-
|
|
71
|
-
<div class="navbar-items-wrapper" :style="linksWrapperStyle">
|
|
72
|
-
<slot name="before" />
|
|
73
|
-
<NavbarItems class="can-hide" />
|
|
74
|
-
<slot name="after" />
|
|
75
|
-
<ToggleColorModeButton v-if="themeLocale.colorModeSwitch" />
|
|
76
|
-
<NavbarSearch />
|
|
77
|
-
</div>
|
|
78
|
-
</header>
|
|
79
|
-
</template>
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import AutoLink from '@theme/AutoLink.vue'
|
|
3
|
-
import DropdownTransition from '@theme/DropdownTransition.vue'
|
|
4
|
-
import { computed, ref, toRefs, watch } from 'vue'
|
|
5
|
-
import type { PropType } from 'vue'
|
|
6
|
-
import { useRoute } from 'vue-router'
|
|
7
|
-
import type { NavbarItem, ResolvedNavbarItem } from '../../shared/index.js'
|
|
8
|
-
|
|
9
|
-
const props = defineProps({
|
|
10
|
-
item: {
|
|
11
|
-
type: Object as PropType<Exclude<ResolvedNavbarItem, NavbarItem>>,
|
|
12
|
-
required: true,
|
|
13
|
-
},
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
const { item } = toRefs(props)
|
|
17
|
-
|
|
18
|
-
const dropdownAriaLabel = computed(
|
|
19
|
-
() => item.value.ariaLabel || item.value.text,
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
const open = ref(false)
|
|
23
|
-
const route = useRoute()
|
|
24
|
-
watch(
|
|
25
|
-
() => route.path,
|
|
26
|
-
() => {
|
|
27
|
-
open.value = false
|
|
28
|
-
},
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Open the dropdown when user tab and click from keyboard.
|
|
33
|
-
*
|
|
34
|
-
* Use event.detail to detect tab and click from keyboard.
|
|
35
|
-
* The Tab + Click is UIEvent > KeyboardEvent, so the detail is 0.
|
|
36
|
-
*
|
|
37
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
|
|
38
|
-
*/
|
|
39
|
-
const handleDropdown = (e): void => {
|
|
40
|
-
const isTriggerByTab = e.detail === 0
|
|
41
|
-
if (isTriggerByTab) {
|
|
42
|
-
open.value = !open.value
|
|
43
|
-
} else {
|
|
44
|
-
open.value = false
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const isLastItemOfArray = (item: unknown, arr: unknown[]): boolean =>
|
|
49
|
-
arr[arr.length - 1] === item
|
|
50
|
-
</script>
|
|
51
|
-
|
|
52
|
-
<template>
|
|
53
|
-
<div class="navbar-dropdown-wrapper" :class="{ open }">
|
|
54
|
-
<button
|
|
55
|
-
class="navbar-dropdown-title"
|
|
56
|
-
type="button"
|
|
57
|
-
:aria-label="dropdownAriaLabel"
|
|
58
|
-
@click="handleDropdown"
|
|
59
|
-
>
|
|
60
|
-
<span class="title">{{ item.text }}</span>
|
|
61
|
-
<span class="arrow down" />
|
|
62
|
-
</button>
|
|
63
|
-
|
|
64
|
-
<button
|
|
65
|
-
class="navbar-dropdown-title-mobile"
|
|
66
|
-
type="button"
|
|
67
|
-
:aria-label="dropdownAriaLabel"
|
|
68
|
-
@click="open = !open"
|
|
69
|
-
>
|
|
70
|
-
<span class="title">{{ item.text }}</span>
|
|
71
|
-
<span class="arrow" :class="open ? 'down' : 'right'" />
|
|
72
|
-
</button>
|
|
73
|
-
|
|
74
|
-
<DropdownTransition>
|
|
75
|
-
<ul v-show="open" class="navbar-dropdown">
|
|
76
|
-
<li
|
|
77
|
-
v-for="child in item.children"
|
|
78
|
-
:key="child.text"
|
|
79
|
-
class="navbar-dropdown-item"
|
|
80
|
-
>
|
|
81
|
-
<template v-if="child.children">
|
|
82
|
-
<h4 class="navbar-dropdown-subtitle">
|
|
83
|
-
<AutoLink
|
|
84
|
-
v-if="child.link"
|
|
85
|
-
:item="child"
|
|
86
|
-
@focusout="
|
|
87
|
-
isLastItemOfArray(child, item.children) &&
|
|
88
|
-
child.children.length === 0 &&
|
|
89
|
-
(open = false)
|
|
90
|
-
"
|
|
91
|
-
/>
|
|
92
|
-
|
|
93
|
-
<span v-else>{{ child.text }}</span>
|
|
94
|
-
</h4>
|
|
95
|
-
|
|
96
|
-
<ul class="navbar-dropdown-subitem-wrapper">
|
|
97
|
-
<li
|
|
98
|
-
v-for="grandchild in child.children"
|
|
99
|
-
:key="grandchild.link"
|
|
100
|
-
class="navbar-dropdown-subitem"
|
|
101
|
-
>
|
|
102
|
-
<AutoLink
|
|
103
|
-
:item="grandchild"
|
|
104
|
-
@focusout="
|
|
105
|
-
isLastItemOfArray(grandchild, child.children) &&
|
|
106
|
-
isLastItemOfArray(child, item.children) &&
|
|
107
|
-
(open = false)
|
|
108
|
-
"
|
|
109
|
-
/>
|
|
110
|
-
</li>
|
|
111
|
-
</ul>
|
|
112
|
-
</template>
|
|
113
|
-
|
|
114
|
-
<template v-else>
|
|
115
|
-
<AutoLink
|
|
116
|
-
:item="child"
|
|
117
|
-
@focusout="
|
|
118
|
-
isLastItemOfArray(child, item.children) && (open = false)
|
|
119
|
-
"
|
|
120
|
-
/>
|
|
121
|
-
</template>
|
|
122
|
-
</li>
|
|
123
|
-
</ul>
|
|
124
|
-
</DropdownTransition>
|
|
125
|
-
</div>
|
|
126
|
-
</template>
|