@vuepress/theme-default 2.0.0-beta.29 → 2.0.0-beta.30
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/DropdownLink.vue +51 -51
- package/lib/client/components/DropdownTransition.vue +11 -11
- package/lib/client/components/Home.vue +12 -110
- package/lib/client/components/HomeContent.vue +5 -0
- package/lib/client/components/HomeFeatures.vue +23 -0
- package/lib/client/components/HomeFooter.vue +17 -0
- package/lib/client/components/HomeHero.vue +97 -0
- package/lib/client/components/NavLink.vue +29 -29
- package/lib/client/components/Navbar.vue +23 -57
- package/lib/client/components/NavbarBrand.vue +55 -0
- package/lib/client/components/NavbarLinks.vue +16 -11
- package/lib/client/components/Page.vue +5 -5
- package/lib/client/components/PageMeta.vue +30 -30
- package/lib/client/components/PageNav.vue +14 -14
- package/lib/client/components/Sidebar.vue +8 -8
- package/lib/client/components/ToggleDarkModeButton.vue +11 -11
- package/lib/client/components/ToggleSidebarButton.vue +8 -8
- package/lib/client/components/global/Badge.vue +12 -12
- package/lib/client/components/global/CodeGroupItem.vue +10 -10
- package/lib/client/components/global/ExternalLinkIcon.vue +6 -6
- package/lib/client/layouts/404.vue +12 -12
- package/lib/client/layouts/Layout.vue +54 -54
- package/lib/client/styles/page.scss +2 -2
- package/package.json +3 -3
|
@@ -1,3 +1,54 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref, toRefs, watch } from 'vue'
|
|
3
|
+
import type { PropType } from 'vue'
|
|
4
|
+
import { useRoute } from 'vue-router'
|
|
5
|
+
import type { NavGroup, NavItem } from '../../shared'
|
|
6
|
+
import DropdownTransition from './DropdownTransition.vue'
|
|
7
|
+
import NavLink from './NavLink.vue'
|
|
8
|
+
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
item: {
|
|
11
|
+
type: Object as PropType<NavGroup<NavItem>>,
|
|
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
|
+
|
|
1
52
|
<template>
|
|
2
53
|
<div class="dropdown-wrapper" :class="{ open }">
|
|
3
54
|
<button
|
|
@@ -73,54 +124,3 @@
|
|
|
73
124
|
</DropdownTransition>
|
|
74
125
|
</div>
|
|
75
126
|
</template>
|
|
76
|
-
|
|
77
|
-
<script setup lang="ts">
|
|
78
|
-
import { computed, ref, toRefs, watch } from 'vue'
|
|
79
|
-
import type { PropType } from 'vue'
|
|
80
|
-
import { useRoute } from 'vue-router'
|
|
81
|
-
import type { NavGroup, NavItem } from '../../shared'
|
|
82
|
-
import DropdownTransition from './DropdownTransition.vue'
|
|
83
|
-
import NavLink from './NavLink.vue'
|
|
84
|
-
|
|
85
|
-
const props = defineProps({
|
|
86
|
-
item: {
|
|
87
|
-
type: Object as PropType<NavGroup<NavItem>>,
|
|
88
|
-
required: true,
|
|
89
|
-
},
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
const { item } = toRefs(props)
|
|
93
|
-
|
|
94
|
-
const dropdownAriaLabel = computed(
|
|
95
|
-
() => item.value.ariaLabel || item.value.text
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
const open = ref(false)
|
|
99
|
-
const route = useRoute()
|
|
100
|
-
watch(
|
|
101
|
-
() => route.path,
|
|
102
|
-
() => {
|
|
103
|
-
open.value = false
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Open the dropdown when user tab and click from keyboard.
|
|
109
|
-
*
|
|
110
|
-
* Use event.detail to detect tab and click from keyboard.
|
|
111
|
-
* The Tab + Click is UIEvent > KeyboardEvent, so the detail is 0.
|
|
112
|
-
*
|
|
113
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
|
|
114
|
-
*/
|
|
115
|
-
const handleDropdown = (e): void => {
|
|
116
|
-
const isTriggerByTab = e.detail === 0
|
|
117
|
-
if (isTriggerByTab) {
|
|
118
|
-
open.value = !open.value
|
|
119
|
-
} else {
|
|
120
|
-
open.value = false
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const isLastItemOfArray = (item: unknown, arr: unknown[]): boolean =>
|
|
125
|
-
arr[arr.length - 1] === item
|
|
126
|
-
</script>
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Transition
|
|
3
|
-
name="dropdown"
|
|
4
|
-
@enter="setHeight"
|
|
5
|
-
@after-enter="unsetHeight"
|
|
6
|
-
@before-leave="setHeight"
|
|
7
|
-
>
|
|
8
|
-
<slot />
|
|
9
|
-
</Transition>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
1
|
<script setup lang="ts">
|
|
13
2
|
const setHeight = (items): void => {
|
|
14
3
|
// explicitly set height so that it can be transitioned
|
|
@@ -19,3 +8,14 @@ const unsetHeight = (items): void => {
|
|
|
19
8
|
items.style.height = ''
|
|
20
9
|
}
|
|
21
10
|
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<Transition
|
|
14
|
+
name="dropdown"
|
|
15
|
+
@enter="setHeight"
|
|
16
|
+
@after-enter="unsetHeight"
|
|
17
|
+
@before-leave="setHeight"
|
|
18
|
+
>
|
|
19
|
+
<slot />
|
|
20
|
+
</Transition>
|
|
21
|
+
</template>
|
|
@@ -1,113 +1,15 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<h1 v-if="heroText" id="main-title">
|
|
9
|
-
{{ heroText }}
|
|
10
|
-
</h1>
|
|
11
|
-
|
|
12
|
-
<p v-if="tagline" class="description">
|
|
13
|
-
{{ tagline }}
|
|
14
|
-
</p>
|
|
15
|
-
|
|
16
|
-
<p v-if="actions.length" class="actions">
|
|
17
|
-
<NavLink
|
|
18
|
-
v-for="action in actions"
|
|
19
|
-
:key="action.text"
|
|
20
|
-
class="action-button"
|
|
21
|
-
:class="[action.type]"
|
|
22
|
-
:item="action"
|
|
23
|
-
/>
|
|
24
|
-
</p>
|
|
25
|
-
</header>
|
|
26
|
-
|
|
27
|
-
<div v-if="features.length" class="features">
|
|
28
|
-
<div v-for="feature in features" :key="feature.title" class="feature">
|
|
29
|
-
<h2>{{ feature.title }}</h2>
|
|
30
|
-
<p>{{ feature.details }}</p>
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<div class="theme-default-content custom">
|
|
35
|
-
<Content />
|
|
36
|
-
</div>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import HomeContent from './HomeContent.vue'
|
|
3
|
+
import HomeFeatures from './HomeFeatures.vue'
|
|
4
|
+
import HomeFooter from './HomeFooter.vue'
|
|
5
|
+
import HomeHero from './HomeHero.vue'
|
|
6
|
+
</script>
|
|
37
7
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
8
|
+
<template>
|
|
9
|
+
<main class="home">
|
|
10
|
+
<HomeHero />
|
|
11
|
+
<HomeFeatures />
|
|
12
|
+
<HomeContent />
|
|
13
|
+
<HomeFooter />
|
|
43
14
|
</main>
|
|
44
15
|
</template>
|
|
45
|
-
|
|
46
|
-
<script setup lang="ts">
|
|
47
|
-
import {
|
|
48
|
-
usePageFrontmatter,
|
|
49
|
-
useSiteLocaleData,
|
|
50
|
-
withBase,
|
|
51
|
-
} from '@vuepress/client'
|
|
52
|
-
import { isArray } from '@vuepress/shared'
|
|
53
|
-
import { computed } from 'vue'
|
|
54
|
-
import type { DefaultThemeHomePageFrontmatter } from '../../shared'
|
|
55
|
-
import { useDarkMode } from '../composables'
|
|
56
|
-
import NavLink from './NavLink.vue'
|
|
57
|
-
|
|
58
|
-
const frontmatter = usePageFrontmatter<DefaultThemeHomePageFrontmatter>()
|
|
59
|
-
const siteLocale = useSiteLocaleData()
|
|
60
|
-
const isDarkMode = useDarkMode()
|
|
61
|
-
|
|
62
|
-
// hero image and title
|
|
63
|
-
const heroImage = computed(() => {
|
|
64
|
-
if (isDarkMode.value && frontmatter.value.heroImageDark !== undefined) {
|
|
65
|
-
return frontmatter.value.heroImageDark
|
|
66
|
-
}
|
|
67
|
-
return frontmatter.value.heroImage
|
|
68
|
-
})
|
|
69
|
-
const heroText = computed(() => {
|
|
70
|
-
if (frontmatter.value.heroText === null) {
|
|
71
|
-
return null
|
|
72
|
-
}
|
|
73
|
-
return frontmatter.value.heroText || siteLocale.value.title || 'Hello'
|
|
74
|
-
})
|
|
75
|
-
const heroAlt = computed(
|
|
76
|
-
() => frontmatter.value.heroAlt || heroText.value || 'hero'
|
|
77
|
-
)
|
|
78
|
-
const tagline = computed(() => {
|
|
79
|
-
if (frontmatter.value.tagline === null) {
|
|
80
|
-
return null
|
|
81
|
-
}
|
|
82
|
-
return (
|
|
83
|
-
frontmatter.value.tagline ||
|
|
84
|
-
siteLocale.value.description ||
|
|
85
|
-
'Welcome to your VuePress site'
|
|
86
|
-
)
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
// action buttons
|
|
90
|
-
const actions = computed(() => {
|
|
91
|
-
if (!isArray(frontmatter.value.actions)) {
|
|
92
|
-
return []
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return frontmatter.value.actions.map(({ text, link, type = 'primary' }) => ({
|
|
96
|
-
text,
|
|
97
|
-
link,
|
|
98
|
-
type,
|
|
99
|
-
}))
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
// feature list
|
|
103
|
-
const features = computed(() => {
|
|
104
|
-
if (isArray(frontmatter.value.features)) {
|
|
105
|
-
return frontmatter.value.features
|
|
106
|
-
}
|
|
107
|
-
return []
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
// footer
|
|
111
|
-
const footer = computed(() => frontmatter.value.footer)
|
|
112
|
-
const footerHtml = computed(() => frontmatter.value.footerHtml)
|
|
113
|
-
</script>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { usePageFrontmatter } from '@vuepress/client'
|
|
3
|
+
import { isArray } from '@vuepress/shared'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
import type { DefaultThemeHomePageFrontmatter } from '../../shared'
|
|
6
|
+
|
|
7
|
+
const frontmatter = usePageFrontmatter<DefaultThemeHomePageFrontmatter>()
|
|
8
|
+
const features = computed(() => {
|
|
9
|
+
if (isArray(frontmatter.value.features)) {
|
|
10
|
+
return frontmatter.value.features
|
|
11
|
+
}
|
|
12
|
+
return []
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div v-if="features.length" class="features">
|
|
18
|
+
<div v-for="feature in features" :key="feature.title" class="feature">
|
|
19
|
+
<h2>{{ feature.title }}</h2>
|
|
20
|
+
<p>{{ feature.details }}</p>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { usePageFrontmatter } from '@vuepress/client'
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
import type { DefaultThemeHomePageFrontmatter } from '../../shared'
|
|
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>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
ClientOnly,
|
|
4
|
+
usePageFrontmatter,
|
|
5
|
+
useSiteLocaleData,
|
|
6
|
+
withBase,
|
|
7
|
+
} from '@vuepress/client'
|
|
8
|
+
import { isArray } from '@vuepress/shared'
|
|
9
|
+
import type { FunctionalComponent } from 'vue'
|
|
10
|
+
import { computed, h } from 'vue'
|
|
11
|
+
import type { DefaultThemeHomePageFrontmatter } from '../../shared'
|
|
12
|
+
import { useDarkMode } from '../composables'
|
|
13
|
+
import NavLink from './NavLink.vue'
|
|
14
|
+
|
|
15
|
+
const frontmatter = usePageFrontmatter<DefaultThemeHomePageFrontmatter>()
|
|
16
|
+
const siteLocale = useSiteLocaleData()
|
|
17
|
+
const isDarkMode = useDarkMode()
|
|
18
|
+
|
|
19
|
+
const heroImage = computed(() => {
|
|
20
|
+
if (isDarkMode.value && frontmatter.value.heroImageDark !== undefined) {
|
|
21
|
+
return frontmatter.value.heroImageDark
|
|
22
|
+
}
|
|
23
|
+
return frontmatter.value.heroImage
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const heroText = computed(() => {
|
|
27
|
+
if (frontmatter.value.heroText === null) {
|
|
28
|
+
return null
|
|
29
|
+
}
|
|
30
|
+
return frontmatter.value.heroText || siteLocale.value.title || 'Hello'
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const heroAlt = computed(
|
|
34
|
+
() => frontmatter.value.heroAlt || heroText.value || 'hero'
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
const tagline = computed(() => {
|
|
38
|
+
if (frontmatter.value.tagline === null) {
|
|
39
|
+
return null
|
|
40
|
+
}
|
|
41
|
+
return (
|
|
42
|
+
frontmatter.value.tagline ||
|
|
43
|
+
siteLocale.value.description ||
|
|
44
|
+
'Welcome to your VuePress site'
|
|
45
|
+
)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const actions = computed(() => {
|
|
49
|
+
if (!isArray(frontmatter.value.actions)) {
|
|
50
|
+
return []
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return frontmatter.value.actions.map(({ text, link, type = 'primary' }) => ({
|
|
54
|
+
text,
|
|
55
|
+
link,
|
|
56
|
+
type,
|
|
57
|
+
}))
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const HomeHeroImage: FunctionalComponent = () => {
|
|
61
|
+
if (!heroImage.value) return null
|
|
62
|
+
const img = h('img', {
|
|
63
|
+
src: withBase(heroImage.value),
|
|
64
|
+
alt: heroAlt.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
|
+
<NavLink
|
|
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,32 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<RouterLink
|
|
3
|
-
v-if="isRouterLink"
|
|
4
|
-
class="nav-link"
|
|
5
|
-
:class="{ 'router-link-active': isActive }"
|
|
6
|
-
:to="item.link"
|
|
7
|
-
:aria-label="linkAriaLabel"
|
|
8
|
-
v-bind="$attrs"
|
|
9
|
-
>
|
|
10
|
-
<slot name="before" />
|
|
11
|
-
{{ item.text }}
|
|
12
|
-
<slot name="after" />
|
|
13
|
-
</RouterLink>
|
|
14
|
-
<a
|
|
15
|
-
v-else
|
|
16
|
-
class="nav-link external"
|
|
17
|
-
:href="item.link"
|
|
18
|
-
:rel="linkRel"
|
|
19
|
-
:target="linkTarget"
|
|
20
|
-
:aria-label="linkAriaLabel"
|
|
21
|
-
v-bind="$attrs"
|
|
22
|
-
>
|
|
23
|
-
<slot name="before" />
|
|
24
|
-
{{ item.text }}
|
|
25
|
-
<ExternalLinkIcon v-if="isBlankTarget" />
|
|
26
|
-
<slot name="after" />
|
|
27
|
-
</a>
|
|
28
|
-
</template>
|
|
29
|
-
|
|
30
1
|
<script lang="ts">
|
|
31
2
|
/* eslint-disable import/first, import/no-duplicates, import/order */
|
|
32
3
|
import { defineComponent } from 'vue'
|
|
@@ -112,3 +83,32 @@ const isActive = computed(() => {
|
|
|
112
83
|
return isActiveInSubpath.value
|
|
113
84
|
})
|
|
114
85
|
</script>
|
|
86
|
+
|
|
87
|
+
<template>
|
|
88
|
+
<RouterLink
|
|
89
|
+
v-if="isRouterLink"
|
|
90
|
+
class="nav-link"
|
|
91
|
+
:class="{ 'router-link-active': isActive }"
|
|
92
|
+
:to="item.link"
|
|
93
|
+
:aria-label="linkAriaLabel"
|
|
94
|
+
v-bind="$attrs"
|
|
95
|
+
>
|
|
96
|
+
<slot name="before" />
|
|
97
|
+
{{ item.text }}
|
|
98
|
+
<slot name="after" />
|
|
99
|
+
</RouterLink>
|
|
100
|
+
<a
|
|
101
|
+
v-else
|
|
102
|
+
class="nav-link external"
|
|
103
|
+
:href="item.link"
|
|
104
|
+
:rel="linkRel"
|
|
105
|
+
:target="linkTarget"
|
|
106
|
+
:aria-label="linkAriaLabel"
|
|
107
|
+
v-bind="$attrs"
|
|
108
|
+
>
|
|
109
|
+
<slot name="before" />
|
|
110
|
+
{{ item.text }}
|
|
111
|
+
<ExternalLinkIcon v-if="isBlankTarget" />
|
|
112
|
+
<slot name="after" />
|
|
113
|
+
</a>
|
|
114
|
+
</template>
|
|
@@ -1,70 +1,18 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<header ref="navbar" class="navbar">
|
|
3
|
-
<ToggleSidebarButton @toggle="$emit('toggle-sidebar')" />
|
|
4
|
-
|
|
5
|
-
<span ref="siteBrand">
|
|
6
|
-
<RouterLink :to="siteBrandLink">
|
|
7
|
-
<!-- logo could be different in dark mode, so we make it client-only to avoid ssr-mismatch -->
|
|
8
|
-
<ClientOnly>
|
|
9
|
-
<img
|
|
10
|
-
v-if="siteBrandLogo"
|
|
11
|
-
class="logo"
|
|
12
|
-
:src="withBase(siteBrandLogo)"
|
|
13
|
-
:alt="siteBrandTitle"
|
|
14
|
-
/>
|
|
15
|
-
</ClientOnly>
|
|
16
|
-
|
|
17
|
-
<span
|
|
18
|
-
v-if="siteBrandTitle"
|
|
19
|
-
class="site-name"
|
|
20
|
-
:class="{ 'can-hide': siteBrandLogo }"
|
|
21
|
-
>
|
|
22
|
-
{{ siteBrandTitle }}
|
|
23
|
-
</span>
|
|
24
|
-
</RouterLink>
|
|
25
|
-
</span>
|
|
26
|
-
|
|
27
|
-
<div class="navbar-links-wrapper" :style="linksWrapperStyle">
|
|
28
|
-
<slot name="before" />
|
|
29
|
-
|
|
30
|
-
<NavbarLinks class="can-hide" />
|
|
31
|
-
|
|
32
|
-
<slot name="after" />
|
|
33
|
-
|
|
34
|
-
<ToggleDarkModeButton v-if="enableDarkMode" />
|
|
35
|
-
|
|
36
|
-
<NavbarSearch />
|
|
37
|
-
</div>
|
|
38
|
-
</header>
|
|
39
|
-
</template>
|
|
40
|
-
|
|
41
1
|
<script setup lang="ts">
|
|
42
|
-
import { useRouteLocale, useSiteLocaleData, withBase } from '@vuepress/client'
|
|
43
2
|
import { computed, onMounted, ref } from 'vue'
|
|
44
|
-
import {
|
|
3
|
+
import { useThemeLocaleData } from '../composables'
|
|
4
|
+
import NavbarBrand from './NavbarBrand.vue'
|
|
45
5
|
import NavbarLinks from './NavbarLinks.vue'
|
|
46
6
|
import ToggleDarkModeButton from './ToggleDarkModeButton.vue'
|
|
47
7
|
import ToggleSidebarButton from './ToggleSidebarButton.vue'
|
|
48
8
|
|
|
49
9
|
defineEmits(['toggle-sidebar'])
|
|
50
10
|
|
|
51
|
-
const routeLocale = useRouteLocale()
|
|
52
|
-
const siteLocale = useSiteLocaleData()
|
|
53
11
|
const themeLocale = useThemeLocaleData()
|
|
54
|
-
const isDarkMode = useDarkMode()
|
|
55
12
|
|
|
56
13
|
const navbar = ref<HTMLElement | null>(null)
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
() => themeLocale.value.home || routeLocale.value
|
|
60
|
-
)
|
|
61
|
-
const siteBrandLogo = computed(() => {
|
|
62
|
-
if (isDarkMode.value && themeLocale.value.logoDark !== undefined) {
|
|
63
|
-
return themeLocale.value.logoDark
|
|
64
|
-
}
|
|
65
|
-
return themeLocale.value.logo
|
|
66
|
-
})
|
|
67
|
-
const siteBrandTitle = computed(() => siteLocale.value.title)
|
|
14
|
+
const navbarBrand = ref<HTMLElement | null>(null)
|
|
15
|
+
|
|
68
16
|
const linksWrapperMaxWidth = ref(0)
|
|
69
17
|
const linksWrapperStyle = computed(() => {
|
|
70
18
|
if (!linksWrapperMaxWidth.value) {
|
|
@@ -91,7 +39,7 @@ onMounted(() => {
|
|
|
91
39
|
linksWrapperMaxWidth.value =
|
|
92
40
|
navbar.value!.offsetWidth -
|
|
93
41
|
navbarHorizontalPadding -
|
|
94
|
-
(
|
|
42
|
+
(navbarBrand.value?.offsetWidth || 0)
|
|
95
43
|
}
|
|
96
44
|
}
|
|
97
45
|
handleLinksWrapWidth()
|
|
@@ -108,3 +56,21 @@ function getCssValue(el: HTMLElement | null, property: string): number {
|
|
|
108
56
|
return Number.isNaN(num) ? 0 : num
|
|
109
57
|
}
|
|
110
58
|
</script>
|
|
59
|
+
|
|
60
|
+
<template>
|
|
61
|
+
<header ref="navbar" class="navbar">
|
|
62
|
+
<ToggleSidebarButton @toggle="$emit('toggle-sidebar')" />
|
|
63
|
+
|
|
64
|
+
<span ref="navbarBrand">
|
|
65
|
+
<NavbarBrand />
|
|
66
|
+
</span>
|
|
67
|
+
|
|
68
|
+
<div class="navbar-links-wrapper" :style="linksWrapperStyle">
|
|
69
|
+
<slot name="before" />
|
|
70
|
+
<NavbarLinks class="can-hide" />
|
|
71
|
+
<slot name="after" />
|
|
72
|
+
<ToggleDarkModeButton v-if="enableDarkMode" />
|
|
73
|
+
<NavbarSearch />
|
|
74
|
+
</div>
|
|
75
|
+
</header>
|
|
76
|
+
</template>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
ClientOnly,
|
|
4
|
+
useRouteLocale,
|
|
5
|
+
useSiteLocaleData,
|
|
6
|
+
withBase,
|
|
7
|
+
} from '@vuepress/client'
|
|
8
|
+
import { computed, h } from 'vue'
|
|
9
|
+
import type { FunctionalComponent } from 'vue'
|
|
10
|
+
import { useDarkMode, useThemeLocaleData } from '../composables'
|
|
11
|
+
|
|
12
|
+
const routeLocale = useRouteLocale()
|
|
13
|
+
const siteLocale = useSiteLocaleData()
|
|
14
|
+
const themeLocale = useThemeLocaleData()
|
|
15
|
+
const isDarkMode = useDarkMode()
|
|
16
|
+
|
|
17
|
+
const navbarBrandLink = computed(
|
|
18
|
+
() => themeLocale.value.home || routeLocale.value
|
|
19
|
+
)
|
|
20
|
+
const navbarBrandTitle = computed(() => siteLocale.value.title)
|
|
21
|
+
const navbarBrandLogo = computed(() => {
|
|
22
|
+
if (isDarkMode.value && themeLocale.value.logoDark !== undefined) {
|
|
23
|
+
return themeLocale.value.logoDark
|
|
24
|
+
}
|
|
25
|
+
return themeLocale.value.logo
|
|
26
|
+
})
|
|
27
|
+
const NavbarBrandLogo: FunctionalComponent = () => {
|
|
28
|
+
if (!navbarBrandLogo.value) return null
|
|
29
|
+
const img = h('img', {
|
|
30
|
+
class: 'logo',
|
|
31
|
+
src: withBase(navbarBrandLogo.value),
|
|
32
|
+
alt: navbarBrandTitle.value,
|
|
33
|
+
})
|
|
34
|
+
if (themeLocale.value.logoDark === undefined) {
|
|
35
|
+
return img
|
|
36
|
+
}
|
|
37
|
+
// wrap brand logo with <ClientOnly> to avoid ssr-mismatch
|
|
38
|
+
// when using a different brand logo in dark mode
|
|
39
|
+
return h(ClientOnly, img)
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<RouterLink :to="navbarBrandLink">
|
|
45
|
+
<NavbarBrandLogo />
|
|
46
|
+
|
|
47
|
+
<span
|
|
48
|
+
v-if="navbarBrandTitle"
|
|
49
|
+
class="site-name"
|
|
50
|
+
:class="{ 'can-hide': navbarBrandLogo }"
|
|
51
|
+
>
|
|
52
|
+
{{ navbarBrandTitle }}
|
|
53
|
+
</span>
|
|
54
|
+
</RouterLink>
|
|
55
|
+
</template>
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<nav v-if="navbarLinks.length" class="navbar-links">
|
|
3
|
-
<div v-for="item in navbarLinks" :key="item.text" class="navbar-links-item">
|
|
4
|
-
<DropdownLink v-if="item.children" :item="item" />
|
|
5
|
-
|
|
6
|
-
<NavLink v-else :item="item" />
|
|
7
|
-
</div>
|
|
8
|
-
</nav>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
1
|
<script setup lang="ts">
|
|
12
2
|
import { useRouteLocale, useSiteLocaleData } from '@vuepress/client'
|
|
13
3
|
import { isLinkHttp, isString } from '@vuepress/shared'
|
|
14
4
|
import { computed } from 'vue'
|
|
15
5
|
import type { ComputedRef } from 'vue'
|
|
16
6
|
import { useRouter } from 'vue-router'
|
|
17
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
NavbarGroup,
|
|
9
|
+
NavbarItem,
|
|
10
|
+
NavGroup,
|
|
11
|
+
NavLink as NavLinkType,
|
|
12
|
+
ResolvedNavbarItem,
|
|
13
|
+
} from '../../shared'
|
|
18
14
|
import { useNavLink, useThemeLocaleData } from '../composables'
|
|
19
15
|
import { resolveRepoType } from '../utils'
|
|
20
16
|
import DropdownLink from './DropdownLink.vue'
|
|
@@ -153,3 +149,12 @@ const navbarLinks = computed(() => [
|
|
|
153
149
|
...navbarRepo.value,
|
|
154
150
|
])
|
|
155
151
|
</script>
|
|
152
|
+
|
|
153
|
+
<template>
|
|
154
|
+
<nav v-if="navbarLinks.length" class="navbar-links">
|
|
155
|
+
<div v-for="item in navbarLinks" :key="item.text" class="navbar-links-item">
|
|
156
|
+
<DropdownLink v-if="item.children" :item="item" />
|
|
157
|
+
<NavLink v-else :item="item" />
|
|
158
|
+
</div>
|
|
159
|
+
</nav>
|
|
160
|
+
</template>
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import PageMeta from './PageMeta.vue'
|
|
3
|
+
import PageNav from './PageNav.vue'
|
|
4
|
+
</script>
|
|
5
|
+
|
|
1
6
|
<template>
|
|
2
7
|
<main class="page">
|
|
3
8
|
<slot name="top" />
|
|
@@ -13,8 +18,3 @@
|
|
|
13
18
|
<slot name="bottom" />
|
|
14
19
|
</main>
|
|
15
20
|
</template>
|
|
16
|
-
|
|
17
|
-
<script setup lang="ts">
|
|
18
|
-
import PageMeta from './PageMeta.vue'
|
|
19
|
-
import PageNav from './PageNav.vue'
|
|
20
|
-
</script>
|
|
@@ -1,33 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<footer class="page-meta">
|
|
3
|
-
<div v-if="editNavLink" class="meta-item edit-link">
|
|
4
|
-
<NavLink class="meta-item-label" :item="editNavLink" />
|
|
5
|
-
</div>
|
|
6
|
-
|
|
7
|
-
<div v-if="lastUpdated" class="meta-item last-updated">
|
|
8
|
-
<span class="meta-item-label">{{ themeLocale.lastUpdatedText }}: </span>
|
|
9
|
-
<ClientOnly>
|
|
10
|
-
<span class="meta-item-info">{{ lastUpdated }}</span>
|
|
11
|
-
</ClientOnly>
|
|
12
|
-
</div>
|
|
13
|
-
|
|
14
|
-
<div
|
|
15
|
-
v-if="contributors && contributors.length"
|
|
16
|
-
class="meta-item contributors"
|
|
17
|
-
>
|
|
18
|
-
<span class="meta-item-label">{{ themeLocale.contributorsText }}: </span>
|
|
19
|
-
<span class="meta-item-info">
|
|
20
|
-
<template v-for="(contributor, index) in contributors" :key="index">
|
|
21
|
-
<span class="contributor" :title="`email: ${contributor.email}`">
|
|
22
|
-
{{ contributor.name }}
|
|
23
|
-
</span>
|
|
24
|
-
<template v-if="index !== contributors.length - 1">, </template>
|
|
25
|
-
</template>
|
|
26
|
-
</span>
|
|
27
|
-
</div>
|
|
28
|
-
</footer>
|
|
29
|
-
</template>
|
|
30
|
-
|
|
31
1
|
<script setup lang="ts">
|
|
32
2
|
import {
|
|
33
3
|
usePageData,
|
|
@@ -127,3 +97,33 @@ const editNavLink = useEditNavLink()
|
|
|
127
97
|
const lastUpdated = useLastUpdated()
|
|
128
98
|
const contributors = useContributors()
|
|
129
99
|
</script>
|
|
100
|
+
|
|
101
|
+
<template>
|
|
102
|
+
<footer class="page-meta">
|
|
103
|
+
<div v-if="editNavLink" class="meta-item edit-link">
|
|
104
|
+
<NavLink class="meta-item-label" :item="editNavLink" />
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<div v-if="lastUpdated" class="meta-item last-updated">
|
|
108
|
+
<span class="meta-item-label">{{ themeLocale.lastUpdatedText }}: </span>
|
|
109
|
+
<ClientOnly>
|
|
110
|
+
<span class="meta-item-info">{{ lastUpdated }}</span>
|
|
111
|
+
</ClientOnly>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<div
|
|
115
|
+
v-if="contributors && contributors.length"
|
|
116
|
+
class="meta-item contributors"
|
|
117
|
+
>
|
|
118
|
+
<span class="meta-item-label">{{ themeLocale.contributorsText }}: </span>
|
|
119
|
+
<span class="meta-item-info">
|
|
120
|
+
<template v-for="(contributor, index) in contributors" :key="index">
|
|
121
|
+
<span class="contributor" :title="`email: ${contributor.email}`">
|
|
122
|
+
{{ contributor.name }}
|
|
123
|
+
</span>
|
|
124
|
+
<template v-if="index !== contributors.length - 1">, </template>
|
|
125
|
+
</template>
|
|
126
|
+
</span>
|
|
127
|
+
</div>
|
|
128
|
+
</footer>
|
|
129
|
+
</template>
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<nav v-if="prevNavLink || nextNavLink" class="page-nav">
|
|
3
|
-
<p class="inner">
|
|
4
|
-
<span v-if="prevNavLink" class="prev">
|
|
5
|
-
<NavLink :item="prevNavLink" />
|
|
6
|
-
</span>
|
|
7
|
-
|
|
8
|
-
<span v-if="nextNavLink" class="next">
|
|
9
|
-
<NavLink :item="nextNavLink" />
|
|
10
|
-
</span>
|
|
11
|
-
</p>
|
|
12
|
-
</nav>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
1
|
<script setup lang="ts">
|
|
16
2
|
import { usePageFrontmatter } from '@vuepress/client'
|
|
17
3
|
import { isPlainObject, isString } from '@vuepress/shared'
|
|
@@ -101,3 +87,17 @@ const nextNavLink = computed(() => {
|
|
|
101
87
|
return resolveFromSidebarItems(sidebarItems.value, route.path, 1)
|
|
102
88
|
})
|
|
103
89
|
</script>
|
|
90
|
+
|
|
91
|
+
<template>
|
|
92
|
+
<nav v-if="prevNavLink || nextNavLink" class="page-nav">
|
|
93
|
+
<p class="inner">
|
|
94
|
+
<span v-if="prevNavLink" class="prev">
|
|
95
|
+
<NavLink :item="prevNavLink" />
|
|
96
|
+
</span>
|
|
97
|
+
|
|
98
|
+
<span v-if="nextNavLink" class="next">
|
|
99
|
+
<NavLink :item="nextNavLink" />
|
|
100
|
+
</span>
|
|
101
|
+
</p>
|
|
102
|
+
</nav>
|
|
103
|
+
</template>
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useSidebarItems } from '../composables'
|
|
3
|
+
import NavbarLinks from './NavbarLinks.vue'
|
|
4
|
+
import { SidebarChild } from './SidebarChild'
|
|
5
|
+
|
|
6
|
+
const sidebarItems = useSidebarItems()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
1
9
|
<template>
|
|
2
10
|
<aside class="sidebar">
|
|
3
11
|
<NavbarLinks />
|
|
@@ -15,11 +23,3 @@
|
|
|
15
23
|
<slot name="bottom" />
|
|
16
24
|
</aside>
|
|
17
25
|
</template>
|
|
18
|
-
|
|
19
|
-
<script setup lang="ts">
|
|
20
|
-
import { useSidebarItems } from '../composables'
|
|
21
|
-
import NavbarLinks from './NavbarLinks.vue'
|
|
22
|
-
import { SidebarChild } from './SidebarChild'
|
|
23
|
-
|
|
24
|
-
const sidebarItems = useSidebarItems()
|
|
25
|
-
</script>
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useDarkMode, useThemeLocaleData } from '../composables'
|
|
3
|
+
|
|
4
|
+
const themeLocale = useThemeLocaleData()
|
|
5
|
+
const isDarkMode = useDarkMode()
|
|
6
|
+
|
|
7
|
+
const toggleDarkMode = (): void => {
|
|
8
|
+
isDarkMode.value = !isDarkMode.value
|
|
9
|
+
}
|
|
10
|
+
</script>
|
|
11
|
+
|
|
1
12
|
<template>
|
|
2
13
|
<button
|
|
3
14
|
class="toggle-dark-button"
|
|
@@ -44,14 +55,3 @@
|
|
|
44
55
|
</svg>
|
|
45
56
|
</button>
|
|
46
57
|
</template>
|
|
47
|
-
|
|
48
|
-
<script setup lang="ts">
|
|
49
|
-
import { useDarkMode, useThemeLocaleData } from '../composables'
|
|
50
|
-
|
|
51
|
-
const themeLocale = useThemeLocaleData()
|
|
52
|
-
const isDarkMode = useDarkMode()
|
|
53
|
-
|
|
54
|
-
const toggleDarkMode = (): void => {
|
|
55
|
-
isDarkMode.value = !isDarkMode.value
|
|
56
|
-
}
|
|
57
|
-
</script>
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useThemeLocaleData } from '../composables'
|
|
3
|
+
|
|
4
|
+
defineEmits(['toggle'])
|
|
5
|
+
|
|
6
|
+
const themeLocale = useThemeLocaleData()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
1
9
|
<template>
|
|
2
10
|
<div
|
|
3
11
|
class="toggle-sidebar-button"
|
|
@@ -14,11 +22,3 @@
|
|
|
14
22
|
</div>
|
|
15
23
|
</div>
|
|
16
24
|
</template>
|
|
17
|
-
|
|
18
|
-
<script setup lang="ts">
|
|
19
|
-
import { useThemeLocaleData } from '../composables'
|
|
20
|
-
|
|
21
|
-
defineEmits(['toggle'])
|
|
22
|
-
|
|
23
|
-
const themeLocale = useThemeLocaleData()
|
|
24
|
-
</script>
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span
|
|
3
|
-
class="badge"
|
|
4
|
-
:class="type"
|
|
5
|
-
:style="{
|
|
6
|
-
verticalAlign: vertical,
|
|
7
|
-
}"
|
|
8
|
-
>
|
|
9
|
-
<slot>{{ text }}</slot>
|
|
10
|
-
</span>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
1
|
<script setup lang="ts">
|
|
14
2
|
defineProps({
|
|
15
3
|
type: {
|
|
@@ -29,3 +17,15 @@ defineProps({
|
|
|
29
17
|
},
|
|
30
18
|
})
|
|
31
19
|
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<span
|
|
23
|
+
class="badge"
|
|
24
|
+
:class="type"
|
|
25
|
+
:style="{
|
|
26
|
+
verticalAlign: vertical,
|
|
27
|
+
}"
|
|
28
|
+
>
|
|
29
|
+
<slot>{{ text }}</slot>
|
|
30
|
+
</span>
|
|
31
|
+
</template>
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="code-group-item"
|
|
4
|
-
:class="{ 'code-group-item__active': active }"
|
|
5
|
-
:aria-selected="active"
|
|
6
|
-
>
|
|
7
|
-
<slot />
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
1
|
<script lang="ts">
|
|
12
2
|
import { defineComponent } from 'vue'
|
|
13
3
|
|
|
@@ -29,3 +19,13 @@ defineProps({
|
|
|
29
19
|
},
|
|
30
20
|
})
|
|
31
21
|
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<div
|
|
25
|
+
class="code-group-item"
|
|
26
|
+
:class="{ 'code-group-item__active': active }"
|
|
27
|
+
:aria-selected="active"
|
|
28
|
+
>
|
|
29
|
+
<slot />
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<RawExternalLinkIcon>
|
|
3
|
-
<span class="sr-only">{{ themeLocale.openInNewWindow }}</span>
|
|
4
|
-
</RawExternalLinkIcon>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
1
|
<script setup lang="ts">
|
|
8
2
|
import { ExternalLinkIcon as RawExternalLinkIcon } from '@vuepress/plugin-external-link-icon/lib/client'
|
|
9
3
|
import { useThemeLocaleData } from '../../composables'
|
|
10
4
|
|
|
11
5
|
const themeLocale = useThemeLocaleData()
|
|
12
6
|
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<RawExternalLinkIcon>
|
|
10
|
+
<span class="sr-only">{{ themeLocale.openInNewWindow }}</span>
|
|
11
|
+
</RawExternalLinkIcon>
|
|
12
|
+
</template>
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="theme-container">
|
|
3
|
-
<div class="theme-default-content">
|
|
4
|
-
<h1>404</h1>
|
|
5
|
-
|
|
6
|
-
<blockquote>{{ getMsg() }}</blockquote>
|
|
7
|
-
|
|
8
|
-
<RouterLink :to="homeLink">{{ homeText }}</RouterLink>
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
1
|
<script setup lang="ts">
|
|
14
2
|
import { useRouteLocale } from '@vuepress/client'
|
|
15
3
|
import { useThemeLocaleData } from '../composables'
|
|
@@ -23,3 +11,15 @@ const getMsg = (): string =>
|
|
|
23
11
|
const homeLink = themeLocale.value.home ?? routeLocale.value
|
|
24
12
|
const homeText = themeLocale.value.backToHome ?? 'Back to home'
|
|
25
13
|
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<div class="theme-container">
|
|
17
|
+
<div class="theme-default-content">
|
|
18
|
+
<h1>404</h1>
|
|
19
|
+
|
|
20
|
+
<blockquote>{{ getMsg() }}</blockquote>
|
|
21
|
+
|
|
22
|
+
<RouterLink :to="homeLink">{{ homeText }}</RouterLink>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
@@ -1,57 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="theme-container"
|
|
4
|
-
:class="containerClass"
|
|
5
|
-
@touchstart="onTouchStart"
|
|
6
|
-
@touchend="onTouchEnd"
|
|
7
|
-
>
|
|
8
|
-
<slot name="navbar">
|
|
9
|
-
<Navbar v-if="shouldShowNavbar" @toggle-sidebar="toggleSidebar">
|
|
10
|
-
<template #before>
|
|
11
|
-
<slot name="navbar-before" />
|
|
12
|
-
</template>
|
|
13
|
-
<template #after>
|
|
14
|
-
<slot name="navbar-after" />
|
|
15
|
-
</template>
|
|
16
|
-
</Navbar>
|
|
17
|
-
</slot>
|
|
18
|
-
|
|
19
|
-
<div class="sidebar-mask" @click="toggleSidebar(false)" />
|
|
20
|
-
|
|
21
|
-
<slot name="sidebar">
|
|
22
|
-
<Sidebar>
|
|
23
|
-
<template #top>
|
|
24
|
-
<slot name="sidebar-top" />
|
|
25
|
-
</template>
|
|
26
|
-
<template #bottom>
|
|
27
|
-
<slot name="sidebar-bottom" />
|
|
28
|
-
</template>
|
|
29
|
-
</Sidebar>
|
|
30
|
-
</slot>
|
|
31
|
-
|
|
32
|
-
<slot name="page">
|
|
33
|
-
<Home v-if="frontmatter.home" />
|
|
34
|
-
|
|
35
|
-
<Transition
|
|
36
|
-
v-else
|
|
37
|
-
name="fade-slide-y"
|
|
38
|
-
mode="out-in"
|
|
39
|
-
@before-enter="onBeforeEnter"
|
|
40
|
-
@before-leave="onBeforeLeave"
|
|
41
|
-
>
|
|
42
|
-
<Page :key="page.path">
|
|
43
|
-
<template #top>
|
|
44
|
-
<slot name="page-top" />
|
|
45
|
-
</template>
|
|
46
|
-
<template #bottom>
|
|
47
|
-
<slot name="page-bottom" />
|
|
48
|
-
</template>
|
|
49
|
-
</Page>
|
|
50
|
-
</Transition>
|
|
51
|
-
</slot>
|
|
52
|
-
</div>
|
|
53
|
-
</template>
|
|
54
|
-
|
|
55
1
|
<script setup lang="ts">
|
|
56
2
|
import { usePageData, usePageFrontmatter } from '@vuepress/client'
|
|
57
3
|
import { computed, onMounted, onUnmounted, ref, Transition } from 'vue'
|
|
@@ -126,3 +72,57 @@ const scrollPromise = useScrollPromise()
|
|
|
126
72
|
const onBeforeEnter = scrollPromise.resolve
|
|
127
73
|
const onBeforeLeave = scrollPromise.pending
|
|
128
74
|
</script>
|
|
75
|
+
|
|
76
|
+
<template>
|
|
77
|
+
<div
|
|
78
|
+
class="theme-container"
|
|
79
|
+
:class="containerClass"
|
|
80
|
+
@touchstart="onTouchStart"
|
|
81
|
+
@touchend="onTouchEnd"
|
|
82
|
+
>
|
|
83
|
+
<slot name="navbar">
|
|
84
|
+
<Navbar v-if="shouldShowNavbar" @toggle-sidebar="toggleSidebar">
|
|
85
|
+
<template #before>
|
|
86
|
+
<slot name="navbar-before" />
|
|
87
|
+
</template>
|
|
88
|
+
<template #after>
|
|
89
|
+
<slot name="navbar-after" />
|
|
90
|
+
</template>
|
|
91
|
+
</Navbar>
|
|
92
|
+
</slot>
|
|
93
|
+
|
|
94
|
+
<div class="sidebar-mask" @click="toggleSidebar(false)" />
|
|
95
|
+
|
|
96
|
+
<slot name="sidebar">
|
|
97
|
+
<Sidebar>
|
|
98
|
+
<template #top>
|
|
99
|
+
<slot name="sidebar-top" />
|
|
100
|
+
</template>
|
|
101
|
+
<template #bottom>
|
|
102
|
+
<slot name="sidebar-bottom" />
|
|
103
|
+
</template>
|
|
104
|
+
</Sidebar>
|
|
105
|
+
</slot>
|
|
106
|
+
|
|
107
|
+
<slot name="page">
|
|
108
|
+
<Home v-if="frontmatter.home" />
|
|
109
|
+
|
|
110
|
+
<Transition
|
|
111
|
+
v-else
|
|
112
|
+
name="fade-slide-y"
|
|
113
|
+
mode="out-in"
|
|
114
|
+
@before-enter="onBeforeEnter"
|
|
115
|
+
@before-leave="onBeforeLeave"
|
|
116
|
+
>
|
|
117
|
+
<Page :key="page.path">
|
|
118
|
+
<template #top>
|
|
119
|
+
<slot name="page-top" />
|
|
120
|
+
</template>
|
|
121
|
+
<template #bottom>
|
|
122
|
+
<slot name="page-bottom" />
|
|
123
|
+
</template>
|
|
124
|
+
</Page>
|
|
125
|
+
</Transition>
|
|
126
|
+
</slot>
|
|
127
|
+
</div>
|
|
128
|
+
</template>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/theme-default",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.30",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@vuepress/client": "2.0.0-beta.29",
|
|
33
33
|
"@vuepress/core": "2.0.0-beta.29",
|
|
34
34
|
"@vuepress/plugin-active-header-links": "2.0.0-beta.29",
|
|
35
|
-
"@vuepress/plugin-back-to-top": "2.0.0-beta.
|
|
35
|
+
"@vuepress/plugin-back-to-top": "2.0.0-beta.30",
|
|
36
36
|
"@vuepress/plugin-container": "2.0.0-beta.29",
|
|
37
37
|
"@vuepress/plugin-external-link-icon": "2.0.0-beta.29",
|
|
38
38
|
"@vuepress/plugin-git": "2.0.0-beta.29",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "b39bb4b791c95d5c40c64198b3931f80005475ef"
|
|
56
56
|
}
|