@vuepress/theme-default 2.0.0-rc.33 → 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 +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 +73 -0
- package/lib/client/composables/useSidebarItems.d.ts +10 -9
- package/lib/client/composables/useSidebarItems.js +14 -14
- package/lib/client/config.js +1 -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} +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/{getNavLink.d.ts → getAutoLink.d.ts} +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 +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 +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.js → getAutoLink.js} +0 -0
|
@@ -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.34",
|
|
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": "93df303baa6291f52e3523f136073e79d53274ea"
|
|
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>
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue'
|
|
3
|
-
import type { ComputedRef } from 'vue'
|
|
4
|
-
import { AutoLink, usePageData, usePageFrontmatter } from 'vuepress/client'
|
|
5
|
-
import type { AutoLinkConfig } from 'vuepress/client'
|
|
6
|
-
import type {
|
|
7
|
-
DefaultThemeNormalPageFrontmatter,
|
|
8
|
-
DefaultThemePageData,
|
|
9
|
-
} from '../../shared/index.js'
|
|
10
|
-
import { useThemeLocaleData } from '../composables/index.js'
|
|
11
|
-
import { resolveEditLink } from '../utils/index.js'
|
|
12
|
-
|
|
13
|
-
const useEditNavLink = (): ComputedRef<null | AutoLinkConfig> => {
|
|
14
|
-
const themeLocale = useThemeLocaleData()
|
|
15
|
-
const page = usePageData<DefaultThemePageData>()
|
|
16
|
-
const frontmatter = usePageFrontmatter<DefaultThemeNormalPageFrontmatter>()
|
|
17
|
-
|
|
18
|
-
return computed(() => {
|
|
19
|
-
const showEditLink =
|
|
20
|
-
frontmatter.value.editLink ?? themeLocale.value.editLink ?? true
|
|
21
|
-
if (!showEditLink) {
|
|
22
|
-
return null
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const {
|
|
26
|
-
repo,
|
|
27
|
-
docsRepo = repo,
|
|
28
|
-
docsBranch = 'main',
|
|
29
|
-
docsDir = '',
|
|
30
|
-
editLinkText,
|
|
31
|
-
} = themeLocale.value
|
|
32
|
-
|
|
33
|
-
if (!docsRepo) return null
|
|
34
|
-
|
|
35
|
-
const editLink = resolveEditLink({
|
|
36
|
-
docsRepo,
|
|
37
|
-
docsBranch,
|
|
38
|
-
docsDir,
|
|
39
|
-
filePathRelative: page.value.filePathRelative,
|
|
40
|
-
editLinkPattern:
|
|
41
|
-
frontmatter.value.editLinkPattern ?? themeLocale.value.editLinkPattern,
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
if (!editLink) return null
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
text: editLinkText ?? 'Edit this page',
|
|
48
|
-
link: editLink,
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const useLastUpdated = (): ComputedRef<null | string> => {
|
|
54
|
-
const themeLocale = useThemeLocaleData()
|
|
55
|
-
const page = usePageData<DefaultThemePageData>()
|
|
56
|
-
const frontmatter = usePageFrontmatter<DefaultThemeNormalPageFrontmatter>()
|
|
57
|
-
|
|
58
|
-
return computed(() => {
|
|
59
|
-
const showLastUpdated =
|
|
60
|
-
frontmatter.value.lastUpdated ?? themeLocale.value.lastUpdated ?? true
|
|
61
|
-
|
|
62
|
-
if (!showLastUpdated) return null
|
|
63
|
-
|
|
64
|
-
if (!page.value.git?.updatedTime) return null
|
|
65
|
-
|
|
66
|
-
const updatedDate = new Date(page.value.git?.updatedTime)
|
|
67
|
-
|
|
68
|
-
return updatedDate.toLocaleString()
|
|
69
|
-
})
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const useContributors = (): ComputedRef<
|
|
73
|
-
null | Required<DefaultThemePageData['git']>['contributors']
|
|
74
|
-
> => {
|
|
75
|
-
const themeLocale = useThemeLocaleData()
|
|
76
|
-
const page = usePageData<DefaultThemePageData>()
|
|
77
|
-
const frontmatter = usePageFrontmatter<DefaultThemeNormalPageFrontmatter>()
|
|
78
|
-
|
|
79
|
-
return computed(() => {
|
|
80
|
-
const showContributors =
|
|
81
|
-
frontmatter.value.contributors ?? themeLocale.value.contributors ?? true
|
|
82
|
-
|
|
83
|
-
if (!showContributors) return null
|
|
84
|
-
|
|
85
|
-
return page.value.git?.contributors ?? null
|
|
86
|
-
})
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const themeLocale = useThemeLocaleData()
|
|
90
|
-
const editNavLink = useEditNavLink()
|
|
91
|
-
const lastUpdated = useLastUpdated()
|
|
92
|
-
const contributors = useContributors()
|
|
93
|
-
</script>
|
|
94
|
-
|
|
95
|
-
<template>
|
|
96
|
-
<footer class="vp-page-meta">
|
|
97
|
-
<div v-if="editNavLink" class="vp-meta-item edit-link">
|
|
98
|
-
<AutoLink class="label" :config="editNavLink">
|
|
99
|
-
<template #before>
|
|
100
|
-
<svg class="icon" viewBox="0 0 1024 1024">
|
|
101
|
-
<g fill="currentColor">
|
|
102
|
-
<path
|
|
103
|
-
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"
|
|
104
|
-
/>
|
|
105
|
-
<path
|
|
106
|
-
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"
|
|
107
|
-
/>
|
|
108
|
-
</g>
|
|
109
|
-
</svg>
|
|
110
|
-
</template>
|
|
111
|
-
</AutoLink>
|
|
112
|
-
</div>
|
|
113
|
-
|
|
114
|
-
<div class="vp-meta-item git-info">
|
|
115
|
-
<div v-if="lastUpdated" class="vp-meta-item last-updated">
|
|
116
|
-
<span class="meta-item-label">{{ themeLocale.lastUpdatedText }}: </span>
|
|
117
|
-
<ClientOnly>
|
|
118
|
-
<span class="meta-item-info">{{ lastUpdated }}</span>
|
|
119
|
-
</ClientOnly>
|
|
120
|
-
</div>
|
|
121
|
-
|
|
122
|
-
<div
|
|
123
|
-
v-if="contributors && contributors.length"
|
|
124
|
-
class="vp-meta-item contributors"
|
|
125
|
-
>
|
|
126
|
-
<span class="meta-item-label"
|
|
127
|
-
>{{ themeLocale.contributorsText }}:
|
|
128
|
-
</span>
|
|
129
|
-
<span class="meta-item-info">
|
|
130
|
-
<template v-for="(contributor, index) in contributors" :key="index">
|
|
131
|
-
<span class="contributor" :title="`email: ${contributor.email}`">
|
|
132
|
-
{{ contributor.name }}
|
|
133
|
-
</span>
|
|
134
|
-
<template v-if="index !== contributors.length - 1">, </template>
|
|
135
|
-
</template>
|
|
136
|
-
</span>
|
|
137
|
-
</div>
|
|
138
|
-
</div>
|
|
139
|
-
</footer>
|
|
140
|
-
</template>
|
|
141
|
-
|
|
142
|
-
<style lang="scss">
|
|
143
|
-
@use '../styles/mixins';
|
|
144
|
-
@import '../styles/_variables';
|
|
145
|
-
|
|
146
|
-
.vp-page-meta {
|
|
147
|
-
@include mixins.content_wrapper;
|
|
148
|
-
|
|
149
|
-
display: flex;
|
|
150
|
-
flex-wrap: wrap;
|
|
151
|
-
justify-content: space-between;
|
|
152
|
-
|
|
153
|
-
overflow: auto;
|
|
154
|
-
|
|
155
|
-
padding-top: 0.75rem;
|
|
156
|
-
padding-bottom: 0.75rem;
|
|
157
|
-
|
|
158
|
-
@media print {
|
|
159
|
-
margin: 0 !important;
|
|
160
|
-
padding-inline: 0 !important;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
@media (max-width: $MQMobile) {
|
|
164
|
-
display: block;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.vp-meta-item {
|
|
168
|
-
flex-grow: 1;
|
|
169
|
-
|
|
170
|
-
.vp-meta-label {
|
|
171
|
-
font-weight: 500;
|
|
172
|
-
|
|
173
|
-
&:not(a) {
|
|
174
|
-
color: var(--c-text-lighter);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.vp-meta-info {
|
|
179
|
-
color: var(--c-text-quote);
|
|
180
|
-
font-weight: 400;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.git-info {
|
|
185
|
-
text-align: end;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.edit-link {
|
|
189
|
-
margin-top: 0.25rem;
|
|
190
|
-
margin-bottom: 0.25rem;
|
|
191
|
-
margin-inline-end: 0.5rem;
|
|
192
|
-
font-size: 14px;
|
|
193
|
-
|
|
194
|
-
@media print {
|
|
195
|
-
display: none;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.icon {
|
|
199
|
-
position: relative;
|
|
200
|
-
bottom: -0.125em;
|
|
201
|
-
|
|
202
|
-
width: 1em;
|
|
203
|
-
height: 1em;
|
|
204
|
-
margin-inline-end: 0.25em;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.last-updated,
|
|
209
|
-
.contributors {
|
|
210
|
-
margin-top: 0.25rem;
|
|
211
|
-
margin-bottom: 0.25rem;
|
|
212
|
-
font-size: 14px;
|
|
213
|
-
|
|
214
|
-
@media (max-width: $MQMobile) {
|
|
215
|
-
font-size: 13px;
|
|
216
|
-
text-align: start;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
</style>
|