@vuepress/theme-default 2.0.0-rc.33 → 2.0.0-rc.35
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 +4 -0
- package/lib/client/composables/index.js +4 -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 +2 -2
- package/lib/client/composables/useNavbarConfig.js +1 -1
- package/lib/client/composables/useNavbarRepo.d.ts +2 -2
- package/lib/client/composables/useNavbarRepo.js +1 -1
- package/lib/client/composables/useNavbarSelectLanguage.d.ts +2 -2
- package/lib/client/composables/useNavbarSelectLanguage.js +2 -2
- package/lib/client/composables/useNavigate.js +4 -7
- package/lib/client/composables/useRelatedLinks.d.ts +8 -0
- package/lib/client/composables/useRelatedLinks.js +91 -0
- package/lib/client/composables/useSidebarItems.d.ts +10 -9
- package/lib/client/composables/useSidebarItems.js +14 -14
- package/lib/client/config.js +4 -2
- 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} +55 -31
- 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 +4 -3
- 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/getAutoLink.d.ts +9 -0
- package/lib/client/utils/{getNavLink.js → getAutoLink.js} +2 -2
- package/lib/client/utils/index.d.ts +1 -1
- package/lib/client/utils/index.js +1 -1
- package/lib/client/utils/isActiveSidebarItem.d.ts +2 -2
- package/lib/client/utils/isActiveSidebarItem.js +3 -3
- 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 +21 -30
- package/lib/shared/navbar.d.ts +21 -0
- package/lib/shared/navbar.js +1 -0
- package/lib/shared/options.d.ts +6 -5
- 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 +18 -18
- 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 -51
- 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 -177
- package/lib/client/styles/navbar.scss +0 -197
- package/lib/client/styles/page.scss +0 -11
- package/lib/client/styles/sidebar.scss +0 -128
- package/lib/client/styles/transitions.scss +0 -22
- package/lib/client/utils/getNavLink.d.ts +0 -9
package/lib/shared/options.d.ts
CHANGED
|
@@ -6,7 +6,8 @@ import type { SeoPluginOptions } from '@vuepress/plugin-seo';
|
|
|
6
6
|
import type { SitemapPluginOptions } from '@vuepress/plugin-sitemap';
|
|
7
7
|
import type { ThemeData } from '@vuepress/plugin-theme-data';
|
|
8
8
|
import type { LocaleData } from 'vuepress/shared';
|
|
9
|
-
import type {
|
|
9
|
+
import type { NavbarOptions } from './navbar.js';
|
|
10
|
+
import type { SidebarOptions } from './sidebar.js';
|
|
10
11
|
export interface DefaultThemePluginsOptions {
|
|
11
12
|
/**
|
|
12
13
|
* Enable @vuepress/plugin-active-header-links or not
|
|
@@ -92,7 +93,7 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
92
93
|
*
|
|
93
94
|
* Set to `false` to disable navbar in current locale
|
|
94
95
|
*/
|
|
95
|
-
navbar?: false |
|
|
96
|
+
navbar?: false | NavbarOptions;
|
|
96
97
|
/**
|
|
97
98
|
* Navbar label used for screen readers using the `aria-label` attribute
|
|
98
99
|
*/
|
|
@@ -157,7 +158,7 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
157
158
|
*
|
|
158
159
|
* Set to `false` to disable sidebar in current locale
|
|
159
160
|
*/
|
|
160
|
-
sidebar?:
|
|
161
|
+
sidebar?: false | SidebarOptions;
|
|
161
162
|
/**
|
|
162
163
|
* Sidebar depth
|
|
163
164
|
*
|
|
@@ -282,9 +283,9 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
282
283
|
/**
|
|
283
284
|
* text for prev link
|
|
284
285
|
*/
|
|
285
|
-
prev?: string;
|
|
286
|
+
prev?: string | false;
|
|
286
287
|
/**
|
|
287
288
|
* text for next link
|
|
288
289
|
*/
|
|
289
|
-
next?: string;
|
|
290
|
+
next?: string | false;
|
|
290
291
|
}
|
package/lib/shared/page.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GitPluginPageData } from '@vuepress/plugin-git';
|
|
2
2
|
import type { AutoLinkConfig } from 'vuepress/client';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SidebarArrayOptions } from './sidebar.js';
|
|
4
4
|
export interface DefaultThemePageData extends GitPluginPageData {
|
|
5
5
|
filePathRelative: string | null;
|
|
6
6
|
}
|
|
@@ -36,7 +36,7 @@ export interface DefaultThemeNormalPageFrontmatter extends DefaultThemePageFront
|
|
|
36
36
|
editLinkPattern?: string;
|
|
37
37
|
lastUpdated?: boolean;
|
|
38
38
|
contributors?: boolean;
|
|
39
|
-
sidebar?:
|
|
39
|
+
sidebar?: false | 'heading' | SidebarArrayOptions;
|
|
40
40
|
sidebarDepth?: number;
|
|
41
41
|
prev?: string | AutoLinkConfig;
|
|
42
42
|
next?: string | AutoLinkConfig;
|
|
@@ -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 = SidebarLinkOptions | SidebarGroupOptions | 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.35",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -42,27 +42,27 @@
|
|
|
42
42
|
"copy": "cpx \"src/**/*.{d.ts,vue,scss}\" lib"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@vuepress/helper": "2.0.0-rc.
|
|
46
|
-
"@vuepress/plugin-active-header-links": "2.0.0-rc.
|
|
47
|
-
"@vuepress/plugin-back-to-top": "2.0.0-rc.
|
|
48
|
-
"@vuepress/plugin-copy-code": "2.0.0-rc.
|
|
49
|
-
"@vuepress/plugin-git": "2.0.0-rc.
|
|
50
|
-
"@vuepress/plugin-links-check": "2.0.0-rc.
|
|
51
|
-
"@vuepress/plugin-markdown-container": "2.0.0-rc.
|
|
52
|
-
"@vuepress/plugin-medium-zoom": "2.0.0-rc.
|
|
53
|
-
"@vuepress/plugin-nprogress": "2.0.0-rc.
|
|
54
|
-
"@vuepress/plugin-palette": "2.0.0-rc.
|
|
55
|
-
"@vuepress/plugin-prismjs": "2.0.0-rc.
|
|
56
|
-
"@vuepress/plugin-seo": "2.0.0-rc.
|
|
57
|
-
"@vuepress/plugin-sitemap": "2.0.0-rc.
|
|
58
|
-
"@vuepress/plugin-theme-data": "2.0.0-rc.
|
|
45
|
+
"@vuepress/helper": "2.0.0-rc.34",
|
|
46
|
+
"@vuepress/plugin-active-header-links": "2.0.0-rc.34",
|
|
47
|
+
"@vuepress/plugin-back-to-top": "2.0.0-rc.34",
|
|
48
|
+
"@vuepress/plugin-copy-code": "2.0.0-rc.34",
|
|
49
|
+
"@vuepress/plugin-git": "2.0.0-rc.34",
|
|
50
|
+
"@vuepress/plugin-links-check": "2.0.0-rc.34",
|
|
51
|
+
"@vuepress/plugin-markdown-container": "2.0.0-rc.34",
|
|
52
|
+
"@vuepress/plugin-medium-zoom": "2.0.0-rc.34",
|
|
53
|
+
"@vuepress/plugin-nprogress": "2.0.0-rc.34",
|
|
54
|
+
"@vuepress/plugin-palette": "2.0.0-rc.34",
|
|
55
|
+
"@vuepress/plugin-prismjs": "2.0.0-rc.34",
|
|
56
|
+
"@vuepress/plugin-seo": "2.0.0-rc.34",
|
|
57
|
+
"@vuepress/plugin-sitemap": "2.0.0-rc.34",
|
|
58
|
+
"@vuepress/plugin-theme-data": "2.0.0-rc.34",
|
|
59
59
|
"@vueuse/core": "^10.10.0",
|
|
60
|
-
"sass": "^1.77.
|
|
60
|
+
"sass": "^1.77.4",
|
|
61
61
|
"vue": "^3.4.27"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"sass-loader": "^14.0.0",
|
|
65
|
-
"vuepress": "2.0.0-rc.
|
|
65
|
+
"vuepress": "2.0.0-rc.13"
|
|
66
66
|
},
|
|
67
67
|
"peerDependenciesMeta": {
|
|
68
68
|
"sass-loader": {
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "4d18f77ca965e0735fa2c09c73ddbc6e5b16fabc"
|
|
76
76
|
}
|
package/templates/build.html
CHANGED
|
@@ -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,80 +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
|
-
const getCssValue = (el: HTMLElement | null, property: string): number => {
|
|
36
|
-
// NOTE: Known bug, will return 'auto' if style value is 'auto'
|
|
37
|
-
const val = el?.ownerDocument?.defaultView?.getComputedStyle(el, null)?.[
|
|
38
|
-
property
|
|
39
|
-
]
|
|
40
|
-
const num = Number.parseInt(val, 10)
|
|
41
|
-
|
|
42
|
-
return Number.isNaN(num) ? 0 : num
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
useUpdateDeviceStatus(
|
|
46
|
-
DeviceType.MOBILE,
|
|
47
|
-
(mobileDesktopBreakpoint: number): void => {
|
|
48
|
-
// avoid overlapping of long title and long navbar links
|
|
49
|
-
const navbarHorizontalPadding =
|
|
50
|
-
getCssValue(navbar.value, 'paddingLeft') +
|
|
51
|
-
getCssValue(navbar.value, 'paddingRight')
|
|
52
|
-
if (window.innerWidth < mobileDesktopBreakpoint) {
|
|
53
|
-
linksWrapperMaxWidth.value = 0
|
|
54
|
-
} else {
|
|
55
|
-
linksWrapperMaxWidth.value =
|
|
56
|
-
navbar.value!.offsetWidth -
|
|
57
|
-
navbarHorizontalPadding -
|
|
58
|
-
(navbarBrand.value?.offsetWidth || 0)
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
)
|
|
62
|
-
</script>
|
|
63
|
-
|
|
64
|
-
<template>
|
|
65
|
-
<header ref="navbar" class="navbar">
|
|
66
|
-
<ToggleSidebarButton @toggle="$emit('toggle-sidebar')" />
|
|
67
|
-
|
|
68
|
-
<span ref="navbarBrand">
|
|
69
|
-
<NavbarBrand />
|
|
70
|
-
</span>
|
|
71
|
-
|
|
72
|
-
<div class="navbar-items-wrapper" :style="linksWrapperStyle">
|
|
73
|
-
<slot name="before" />
|
|
74
|
-
<NavbarItems class="can-hide" />
|
|
75
|
-
<slot name="after" />
|
|
76
|
-
<ToggleColorModeButton v-if="themeLocale.colorModeSwitch" />
|
|
77
|
-
<NavbarSearch />
|
|
78
|
-
</div>
|
|
79
|
-
</header>
|
|
80
|
-
</template>
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import DropdownTransition from '@theme/DropdownTransition.vue'
|
|
3
|
-
import { computed, ref, toRefs, watch } from 'vue'
|
|
4
|
-
import type { PropType } from 'vue'
|
|
5
|
-
import { AutoLink, useRoute } from 'vuepress/client'
|
|
6
|
-
import type { NavbarItem, ResolvedNavbarItem } from '../../shared/index.js'
|
|
7
|
-
|
|
8
|
-
const props = defineProps({
|
|
9
|
-
item: {
|
|
10
|
-
type: Object as PropType<Exclude<ResolvedNavbarItem, NavbarItem>>,
|
|
11
|
-
required: true,
|
|
12
|
-
},
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
const { item } = toRefs(props)
|
|
16
|
-
|
|
17
|
-
const dropdownAriaLabel = computed(
|
|
18
|
-
() => item.value.ariaLabel || item.value.text,
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
const open = ref(false)
|
|
22
|
-
const route = useRoute()
|
|
23
|
-
watch(
|
|
24
|
-
() => route.path,
|
|
25
|
-
() => {
|
|
26
|
-
open.value = false
|
|
27
|
-
},
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Open the dropdown when user tab and click from keyboard.
|
|
32
|
-
*
|
|
33
|
-
* Use event.detail to detect tab and click from keyboard.
|
|
34
|
-
* The Tab + Click is UIEvent > KeyboardEvent, so the detail is 0.
|
|
35
|
-
*
|
|
36
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
|
|
37
|
-
*/
|
|
38
|
-
const handleDropdown = (e): void => {
|
|
39
|
-
const isTriggerByTab = e.detail === 0
|
|
40
|
-
if (isTriggerByTab) {
|
|
41
|
-
open.value = !open.value
|
|
42
|
-
} else {
|
|
43
|
-
open.value = false
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const isLastItemOfArray = (item: unknown, arr: unknown[]): boolean =>
|
|
48
|
-
arr[arr.length - 1] === item
|
|
49
|
-
</script>
|
|
50
|
-
|
|
51
|
-
<template>
|
|
52
|
-
<div class="navbar-dropdown-wrapper" :class="{ open }">
|
|
53
|
-
<button
|
|
54
|
-
class="navbar-dropdown-title"
|
|
55
|
-
type="button"
|
|
56
|
-
:aria-label="dropdownAriaLabel"
|
|
57
|
-
@click="handleDropdown"
|
|
58
|
-
>
|
|
59
|
-
<span class="title">{{ item.text }}</span>
|
|
60
|
-
<span class="arrow down" />
|
|
61
|
-
</button>
|
|
62
|
-
|
|
63
|
-
<button
|
|
64
|
-
class="navbar-dropdown-title-mobile"
|
|
65
|
-
type="button"
|
|
66
|
-
:aria-label="dropdownAriaLabel"
|
|
67
|
-
@click="open = !open"
|
|
68
|
-
>
|
|
69
|
-
<span class="title">{{ item.text }}</span>
|
|
70
|
-
<span class="arrow" :class="open ? 'down' : 'right'" />
|
|
71
|
-
</button>
|
|
72
|
-
|
|
73
|
-
<DropdownTransition>
|
|
74
|
-
<ul v-show="open" class="navbar-dropdown">
|
|
75
|
-
<li
|
|
76
|
-
v-for="child in item.children"
|
|
77
|
-
:key="child.text"
|
|
78
|
-
class="navbar-dropdown-item"
|
|
79
|
-
>
|
|
80
|
-
<template v-if="child.children">
|
|
81
|
-
<h4 class="navbar-dropdown-subtitle">
|
|
82
|
-
<AutoLink
|
|
83
|
-
v-if="child.link"
|
|
84
|
-
:config="child"
|
|
85
|
-
@focusout="
|
|
86
|
-
isLastItemOfArray(child, item.children) &&
|
|
87
|
-
child.children.length === 0 &&
|
|
88
|
-
(open = false)
|
|
89
|
-
"
|
|
90
|
-
/>
|
|
91
|
-
|
|
92
|
-
<span v-else>{{ child.text }}</span>
|
|
93
|
-
</h4>
|
|
94
|
-
|
|
95
|
-
<ul class="navbar-dropdown-subitem-wrapper">
|
|
96
|
-
<li
|
|
97
|
-
v-for="grandchild in child.children"
|
|
98
|
-
:key="grandchild.link"
|
|
99
|
-
class="navbar-dropdown-subitem"
|
|
100
|
-
>
|
|
101
|
-
<AutoLink
|
|
102
|
-
:config="grandchild"
|
|
103
|
-
@focusout="
|
|
104
|
-
isLastItemOfArray(grandchild, child.children) &&
|
|
105
|
-
isLastItemOfArray(child, item.children) &&
|
|
106
|
-
(open = false)
|
|
107
|
-
"
|
|
108
|
-
/>
|
|
109
|
-
</li>
|
|
110
|
-
</ul>
|
|
111
|
-
</template>
|
|
112
|
-
|
|
113
|
-
<template v-else>
|
|
114
|
-
<AutoLink
|
|
115
|
-
:config="child"
|
|
116
|
-
@focusout="
|
|
117
|
-
isLastItemOfArray(child, item.children) && (open = false)
|
|
118
|
-
"
|
|
119
|
-
/>
|
|
120
|
-
</template>
|
|
121
|
-
</li>
|
|
122
|
-
</ul>
|
|
123
|
-
</DropdownTransition>
|
|
124
|
-
</div>
|
|
125
|
-
</template>
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import NavbarDropdown from '@theme/NavbarDropdown.vue'
|
|
3
|
-
import { computed, ref } from 'vue'
|
|
4
|
-
import { AutoLink } from 'vuepress/client'
|
|
5
|
-
import {
|
|
6
|
-
DeviceType,
|
|
7
|
-
useNavbarConfig,
|
|
8
|
-
useNavbarRepo,
|
|
9
|
-
useNavbarSelectLanguage,
|
|
10
|
-
useThemeLocaleData,
|
|
11
|
-
useUpdateDeviceStatus,
|
|
12
|
-
} from '../composables/index.js'
|
|
13
|
-
|
|
14
|
-
const navbarConfig = useNavbarConfig()
|
|
15
|
-
const navbarSelectLanguage = useNavbarSelectLanguage()
|
|
16
|
-
const navbarRepo = useNavbarRepo()
|
|
17
|
-
|
|
18
|
-
const isMobile = ref(false)
|
|
19
|
-
|
|
20
|
-
const navbarLabel = computed(() => {
|
|
21
|
-
const themeLocale = useThemeLocaleData()
|
|
22
|
-
return themeLocale.value.navbarLabel ?? 'site navigation'
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
const navbarLinks = computed(() => [
|
|
26
|
-
...navbarConfig.value,
|
|
27
|
-
...navbarSelectLanguage.value,
|
|
28
|
-
...navbarRepo.value,
|
|
29
|
-
])
|
|
30
|
-
|
|
31
|
-
useUpdateDeviceStatus(
|
|
32
|
-
DeviceType.MOBILE,
|
|
33
|
-
(mobileDesktopBreakpoint: number): void => {
|
|
34
|
-
// avoid overlapping of long title and long navbar links
|
|
35
|
-
isMobile.value = window.innerWidth < mobileDesktopBreakpoint
|
|
36
|
-
},
|
|
37
|
-
)
|
|
38
|
-
</script>
|
|
39
|
-
|
|
40
|
-
<template>
|
|
41
|
-
<nav v-if="navbarLinks.length" class="navbar-items" :aria-label="navbarLabel">
|
|
42
|
-
<div v-for="item in navbarLinks" :key="item.text" class="navbar-item">
|
|
43
|
-
<NavbarDropdown
|
|
44
|
-
v-if="'children' in item"
|
|
45
|
-
:class="{ mobile: isMobile }"
|
|
46
|
-
:item="item"
|
|
47
|
-
/>
|
|
48
|
-
<AutoLink v-else :config="item" />
|
|
49
|
-
</div>
|
|
50
|
-
</nav>
|
|
51
|
-
</template>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import PageMeta from '@theme/PageMeta.vue'
|
|
3
|
-
import PageNav from '@theme/PageNav.vue'
|
|
4
|
-
|
|
5
|
-
defineSlots<{
|
|
6
|
-
'top'?: (props: Record<never, never>) => any
|
|
7
|
-
'bottom'?: (props: Record<never, never>) => any
|
|
8
|
-
'content-top'?: (props: Record<never, never>) => any
|
|
9
|
-
'content-bottom'?: (props: Record<never, never>) => any
|
|
10
|
-
}>()
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<template>
|
|
14
|
-
<main class="page">
|
|
15
|
-
<slot name="top" />
|
|
16
|
-
|
|
17
|
-
<div class="theme-default-content">
|
|
18
|
-
<slot name="content-top" />
|
|
19
|
-
|
|
20
|
-
<Content />
|
|
21
|
-
|
|
22
|
-
<slot name="content-bottom" />
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
<PageMeta />
|
|
26
|
-
|
|
27
|
-
<PageNav />
|
|
28
|
-
|
|
29
|
-
<slot name="bottom" />
|
|
30
|
-
</main>
|
|
31
|
-
</template>
|