@vuepress/theme-default 2.0.0-beta.48 → 2.0.0-beta.50-pre
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/package.json +30 -23
- package/lib/client/components/AutoLink.vue +0 -114
- package/lib/client/components/DropdownTransition.vue +0 -21
- package/lib/client/components/Home.vue +0 -15
- package/lib/client/components/HomeContent.vue +0 -5
- package/lib/client/components/HomeFeatures.vue +0 -23
- package/lib/client/components/HomeFooter.vue +0 -17
- package/lib/client/components/HomeHero.vue +0 -97
- package/lib/client/components/Navbar.vue +0 -75
- package/lib/client/components/NavbarBrand.vue +0 -55
- package/lib/client/components/NavbarDropdown.vue +0 -126
- package/lib/client/components/NavbarItems.vue +0 -154
- package/lib/client/components/Page.vue +0 -24
- package/lib/client/components/PageMeta.vue +0 -124
- package/lib/client/components/PageNav.vue +0 -103
- package/lib/client/components/Sidebar.vue +0 -13
- package/lib/client/components/SidebarItem.vue +0 -80
- package/lib/client/components/SidebarItems.vue +0 -57
- package/lib/client/components/ToggleColorModeButton.vue +0 -57
- package/lib/client/components/ToggleSidebarButton.vue +0 -24
- package/lib/client/components/global/Badge.vue +0 -31
- package/lib/client/components/global/CodeGroup.d.ts +0 -4
- package/lib/client/components/global/CodeGroup.js +0 -106
- package/lib/client/components/global/CodeGroupItem.vue +0 -31
- package/lib/client/components/global/index.d.ts +0 -4
- package/lib/client/components/global/index.js +0 -4
- package/lib/client/composables/index.d.ts +0 -6
- package/lib/client/composables/index.js +0 -6
- package/lib/client/composables/useDarkMode.d.ts +0 -12
- package/lib/client/composables/useDarkMode.js +0 -57
- package/lib/client/composables/useNavLink.d.ts +0 -14
- package/lib/client/composables/useNavLink.js +0 -18
- package/lib/client/composables/useResolveRouteWithRedirect.d.ts +0 -5
- package/lib/client/composables/useResolveRouteWithRedirect.js +0 -24
- package/lib/client/composables/useScrollPromise.d.ts +0 -6
- package/lib/client/composables/useScrollPromise.js +0 -14
- package/lib/client/composables/useSidebarItems.d.ts +0 -36
- package/lib/client/composables/useSidebarItems.js +0 -117
- package/lib/client/composables/useThemeData.d.ts +0 -4
- package/lib/client/composables/useThemeData.js +0 -3
- package/lib/client/config.d.ts +0 -3
- package/lib/client/config.js +0 -38
- package/lib/client/index.d.ts +0 -4
- package/lib/client/index.js +0 -2
- package/lib/client/layouts/404.vue +0 -25
- package/lib/client/layouts/Layout.vue +0 -134
- package/lib/client/shim.d.ts +0 -5
- package/lib/client/styles/_mixins.scss +0 -20
- package/lib/client/styles/_variables.scss +0 -11
- package/lib/client/styles/arrow.scss +0 -37
- package/lib/client/styles/badge.scss +0 -31
- package/lib/client/styles/code-group.scss +0 -69
- package/lib/client/styles/code.scss +0 -266
- package/lib/client/styles/custom-container.scss +0 -88
- package/lib/client/styles/home.scss +0 -168
- package/lib/client/styles/index.scss +0 -19
- package/lib/client/styles/layout.scss +0 -198
- package/lib/client/styles/navbar-dropdown.scss +0 -187
- package/lib/client/styles/navbar.scss +0 -177
- package/lib/client/styles/normalize.scss +0 -176
- package/lib/client/styles/page.scss +0 -83
- package/lib/client/styles/sidebar.scss +0 -134
- package/lib/client/styles/toc.scss +0 -5
- package/lib/client/styles/transitions.scss +0 -22
- package/lib/client/styles/vars-dark.scss +0 -46
- package/lib/client/styles/vars.scss +0 -133
- package/lib/client/utils/index.d.ts +0 -3
- package/lib/client/utils/index.js +0 -3
- package/lib/client/utils/isActiveSidebarItem.d.ts +0 -3
- package/lib/client/utils/isActiveSidebarItem.js +0 -20
- package/lib/client/utils/resolveEditLink.d.ts +0 -9
- package/lib/client/utils/resolveEditLink.js +0 -29
- package/lib/client/utils/resolveRepoType.d.ts +0 -2
- package/lib/client/utils/resolveRepoType.js +0 -12
- package/lib/node/defaultTheme.d.ts +0 -10
- package/lib/node/defaultTheme.js +0 -119
- package/lib/node/index.d.ts +0 -5
- package/lib/node/index.js +0 -21
- package/lib/node/utils/assignDefaultLocaleOptions.d.ts +0 -7
- package/lib/node/utils/assignDefaultLocaleOptions.js +0 -60
- package/lib/node/utils/index.d.ts +0 -2
- package/lib/node/utils/index.js +0 -18
- package/lib/node/utils/resolveContainerPluginOptions.d.ts +0 -8
- package/lib/node/utils/resolveContainerPluginOptions.js +0 -21
- package/lib/shared/index.d.ts +0 -3
- package/lib/shared/index.js +0 -19
- package/lib/shared/nav.d.ts +0 -43
- package/lib/shared/nav.js +0 -2
- package/lib/shared/options.d.ts +0 -243
- package/lib/shared/options.js +0 -2
- package/lib/shared/page.d.ts +0 -40
- package/lib/shared/page.js +0 -2
- package/templates/build.html +0 -33
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import AutoLink from '@theme/AutoLink.vue'
|
|
3
|
-
import NavbarDropdown from '@theme/NavbarDropdown.vue'
|
|
4
|
-
import { useRouteLocale, useSiteLocaleData } from '@vuepress/client'
|
|
5
|
-
import { isLinkHttp, isString } from '@vuepress/shared'
|
|
6
|
-
import { computed } from 'vue'
|
|
7
|
-
import type { ComputedRef } from 'vue'
|
|
8
|
-
import { useRouter } from 'vue-router'
|
|
9
|
-
import type { NavbarGroup, NavbarItem, ResolvedNavbarItem } from '../../shared'
|
|
10
|
-
import { useNavLink, useThemeLocaleData } from '../composables'
|
|
11
|
-
import { resolveRepoType } from '../utils'
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Get navbar config of select language dropdown
|
|
15
|
-
*/
|
|
16
|
-
const useNavbarSelectLanguage = (): ComputedRef<ResolvedNavbarItem[]> => {
|
|
17
|
-
const router = useRouter()
|
|
18
|
-
const routeLocale = useRouteLocale()
|
|
19
|
-
const siteLocale = useSiteLocaleData()
|
|
20
|
-
const themeLocale = useThemeLocaleData()
|
|
21
|
-
|
|
22
|
-
return computed<ResolvedNavbarItem[]>(() => {
|
|
23
|
-
const localePaths = Object.keys(siteLocale.value.locales)
|
|
24
|
-
// do not display language selection dropdown if there is only one language
|
|
25
|
-
if (localePaths.length < 2) {
|
|
26
|
-
return []
|
|
27
|
-
}
|
|
28
|
-
const currentPath = router.currentRoute.value.path
|
|
29
|
-
const currentFullPath = router.currentRoute.value.fullPath
|
|
30
|
-
|
|
31
|
-
const languageDropdown: ResolvedNavbarItem = {
|
|
32
|
-
text: themeLocale.value.selectLanguageText ?? 'unknown language',
|
|
33
|
-
ariaLabel: themeLocale.value.selectLanguageAriaLabel ?? 'unkown language',
|
|
34
|
-
children: localePaths.map((targetLocalePath) => {
|
|
35
|
-
// target locale config of this langauge link
|
|
36
|
-
const targetSiteLocale =
|
|
37
|
-
siteLocale.value.locales?.[targetLocalePath] ?? {}
|
|
38
|
-
const targetThemeLocale =
|
|
39
|
-
themeLocale.value.locales?.[targetLocalePath] ?? {}
|
|
40
|
-
const targetLang = `${targetSiteLocale.lang}`
|
|
41
|
-
|
|
42
|
-
const text = targetThemeLocale.selectLanguageName ?? targetLang
|
|
43
|
-
let link
|
|
44
|
-
|
|
45
|
-
if (targetLang === siteLocale.value.lang) {
|
|
46
|
-
// if the target language is current language
|
|
47
|
-
// stay at current link
|
|
48
|
-
link = currentFullPath
|
|
49
|
-
} else {
|
|
50
|
-
// if the target language is not current language
|
|
51
|
-
// try to link to the corresponding page of current page
|
|
52
|
-
// or fallback to homepage
|
|
53
|
-
const targetLocalePage = currentPath.replace(
|
|
54
|
-
routeLocale.value,
|
|
55
|
-
targetLocalePath
|
|
56
|
-
)
|
|
57
|
-
if (
|
|
58
|
-
router.getRoutes().some((item) => item.path === targetLocalePage)
|
|
59
|
-
) {
|
|
60
|
-
link = targetLocalePage
|
|
61
|
-
} else {
|
|
62
|
-
link = targetThemeLocale.home ?? targetLocalePath
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return {
|
|
67
|
-
text,
|
|
68
|
-
link,
|
|
69
|
-
}
|
|
70
|
-
}),
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return [languageDropdown]
|
|
74
|
-
})
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Get navbar config of repository link
|
|
79
|
-
*/
|
|
80
|
-
const useNavbarRepo = (): ComputedRef<ResolvedNavbarItem[]> => {
|
|
81
|
-
const themeLocale = useThemeLocaleData()
|
|
82
|
-
|
|
83
|
-
const repo = computed(() => themeLocale.value.repo)
|
|
84
|
-
const repoType = computed(() =>
|
|
85
|
-
repo.value ? resolveRepoType(repo.value) : null
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
const repoLink = computed(() => {
|
|
89
|
-
if (repo.value && !isLinkHttp(repo.value)) {
|
|
90
|
-
return `https://github.com/${repo.value}`
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return repo.value
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
const repoLabel = computed(() => {
|
|
97
|
-
if (!repoLink.value) return null
|
|
98
|
-
if (themeLocale.value.repoLabel) return themeLocale.value.repoLabel
|
|
99
|
-
if (repoType.value === null) return 'Source'
|
|
100
|
-
return repoType.value
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
return computed(() => {
|
|
104
|
-
if (!repoLink.value || !repoLabel.value) {
|
|
105
|
-
return []
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return [
|
|
109
|
-
{
|
|
110
|
-
text: repoLabel.value,
|
|
111
|
-
link: repoLink.value,
|
|
112
|
-
},
|
|
113
|
-
]
|
|
114
|
-
})
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const resolveNavbarItem = (
|
|
118
|
-
item: NavbarItem | NavbarGroup | string
|
|
119
|
-
): ResolvedNavbarItem => {
|
|
120
|
-
if (isString(item)) {
|
|
121
|
-
return useNavLink(item)
|
|
122
|
-
}
|
|
123
|
-
if ((item as NavbarGroup).children) {
|
|
124
|
-
return {
|
|
125
|
-
...item,
|
|
126
|
-
children: (item as NavbarGroup).children.map(resolveNavbarItem),
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return item as ResolvedNavbarItem
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const useNavbarConfig = (): ComputedRef<ResolvedNavbarItem[]> => {
|
|
133
|
-
const themeLocale = useThemeLocaleData()
|
|
134
|
-
return computed(() => (themeLocale.value.navbar || []).map(resolveNavbarItem))
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
const navbarConfig = useNavbarConfig()
|
|
138
|
-
const navbarSelectLanguage = useNavbarSelectLanguage()
|
|
139
|
-
const navbarRepo = useNavbarRepo()
|
|
140
|
-
const navbarLinks = computed(() => [
|
|
141
|
-
...navbarConfig.value,
|
|
142
|
-
...navbarSelectLanguage.value,
|
|
143
|
-
...navbarRepo.value,
|
|
144
|
-
])
|
|
145
|
-
</script>
|
|
146
|
-
|
|
147
|
-
<template>
|
|
148
|
-
<nav v-if="navbarLinks.length" class="navbar-items">
|
|
149
|
-
<div v-for="item in navbarLinks" :key="item.text" class="navbar-item">
|
|
150
|
-
<NavbarDropdown v-if="item.children" :item="item" />
|
|
151
|
-
<AutoLink v-else :item="item" />
|
|
152
|
-
</div>
|
|
153
|
-
</nav>
|
|
154
|
-
</template>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import PageMeta from '@theme/PageMeta.vue'
|
|
3
|
-
import PageNav from '@theme/PageNav.vue'
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<template>
|
|
7
|
-
<main class="page">
|
|
8
|
-
<slot name="top" />
|
|
9
|
-
|
|
10
|
-
<div class="theme-default-content">
|
|
11
|
-
<slot name="content-top" />
|
|
12
|
-
|
|
13
|
-
<Content />
|
|
14
|
-
|
|
15
|
-
<slot name="content-bottom" />
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
<PageMeta />
|
|
19
|
-
|
|
20
|
-
<PageNav />
|
|
21
|
-
|
|
22
|
-
<slot name="bottom" />
|
|
23
|
-
</main>
|
|
24
|
-
</template>
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import AutoLink from '@theme/AutoLink.vue'
|
|
3
|
-
import { usePageData, usePageFrontmatter } from '@vuepress/client'
|
|
4
|
-
import { computed } from 'vue'
|
|
5
|
-
import type { ComputedRef } from 'vue'
|
|
6
|
-
import type {
|
|
7
|
-
DefaultThemeNormalPageFrontmatter,
|
|
8
|
-
DefaultThemePageData,
|
|
9
|
-
NavLink,
|
|
10
|
-
} from '../../shared'
|
|
11
|
-
import { useThemeLocaleData } from '../composables'
|
|
12
|
-
import { resolveEditLink } from '../utils'
|
|
13
|
-
|
|
14
|
-
const useEditNavLink = (): ComputedRef<null | NavLink> => {
|
|
15
|
-
const themeLocale = useThemeLocaleData()
|
|
16
|
-
const page = usePageData<DefaultThemePageData>()
|
|
17
|
-
const frontmatter = usePageFrontmatter<DefaultThemeNormalPageFrontmatter>()
|
|
18
|
-
|
|
19
|
-
return computed(() => {
|
|
20
|
-
const showEditLink =
|
|
21
|
-
frontmatter.value.editLink ?? themeLocale.value.editLink ?? true
|
|
22
|
-
if (!showEditLink) {
|
|
23
|
-
return null
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const {
|
|
27
|
-
repo,
|
|
28
|
-
docsRepo = repo,
|
|
29
|
-
docsBranch = 'main',
|
|
30
|
-
docsDir = '',
|
|
31
|
-
editLinkText,
|
|
32
|
-
} = themeLocale.value
|
|
33
|
-
|
|
34
|
-
if (!docsRepo) return null
|
|
35
|
-
|
|
36
|
-
const editLink = resolveEditLink({
|
|
37
|
-
docsRepo,
|
|
38
|
-
docsBranch,
|
|
39
|
-
docsDir,
|
|
40
|
-
filePathRelative: page.value.filePathRelative,
|
|
41
|
-
editLinkPattern:
|
|
42
|
-
frontmatter.value.editLinkPattern ?? themeLocale.value.editLinkPattern,
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
if (!editLink) return null
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
text: editLinkText ?? 'Edit this page',
|
|
49
|
-
link: editLink,
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const useLastUpdated = (): ComputedRef<null | string> => {
|
|
55
|
-
const themeLocale = useThemeLocaleData()
|
|
56
|
-
const page = usePageData<DefaultThemePageData>()
|
|
57
|
-
const frontmatter = usePageFrontmatter<DefaultThemeNormalPageFrontmatter>()
|
|
58
|
-
|
|
59
|
-
return computed(() => {
|
|
60
|
-
const showLastUpdated =
|
|
61
|
-
frontmatter.value.lastUpdated ?? themeLocale.value.lastUpdated ?? true
|
|
62
|
-
|
|
63
|
-
if (!showLastUpdated) return null
|
|
64
|
-
|
|
65
|
-
if (!page.value.git?.updatedTime) return null
|
|
66
|
-
|
|
67
|
-
const updatedDate = new Date(page.value.git?.updatedTime)
|
|
68
|
-
|
|
69
|
-
return updatedDate.toLocaleString()
|
|
70
|
-
})
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const useContributors = (): ComputedRef<
|
|
74
|
-
null | Required<DefaultThemePageData['git']>['contributors']
|
|
75
|
-
> => {
|
|
76
|
-
const themeLocale = useThemeLocaleData()
|
|
77
|
-
const page = usePageData<DefaultThemePageData>()
|
|
78
|
-
const frontmatter = usePageFrontmatter<DefaultThemeNormalPageFrontmatter>()
|
|
79
|
-
|
|
80
|
-
return computed(() => {
|
|
81
|
-
const showContributors =
|
|
82
|
-
frontmatter.value.contributors ?? themeLocale.value.contributors ?? true
|
|
83
|
-
|
|
84
|
-
if (!showContributors) return null
|
|
85
|
-
|
|
86
|
-
return page.value.git?.contributors ?? null
|
|
87
|
-
})
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const themeLocale = useThemeLocaleData()
|
|
91
|
-
const editNavLink = useEditNavLink()
|
|
92
|
-
const lastUpdated = useLastUpdated()
|
|
93
|
-
const contributors = useContributors()
|
|
94
|
-
</script>
|
|
95
|
-
|
|
96
|
-
<template>
|
|
97
|
-
<footer class="page-meta">
|
|
98
|
-
<div v-if="editNavLink" class="meta-item edit-link">
|
|
99
|
-
<AutoLink class="meta-item-label" :item="editNavLink" />
|
|
100
|
-
</div>
|
|
101
|
-
|
|
102
|
-
<div v-if="lastUpdated" class="meta-item last-updated">
|
|
103
|
-
<span class="meta-item-label">{{ themeLocale.lastUpdatedText }}: </span>
|
|
104
|
-
<ClientOnly>
|
|
105
|
-
<span class="meta-item-info">{{ lastUpdated }}</span>
|
|
106
|
-
</ClientOnly>
|
|
107
|
-
</div>
|
|
108
|
-
|
|
109
|
-
<div
|
|
110
|
-
v-if="contributors && contributors.length"
|
|
111
|
-
class="meta-item contributors"
|
|
112
|
-
>
|
|
113
|
-
<span class="meta-item-label">{{ themeLocale.contributorsText }}: </span>
|
|
114
|
-
<span class="meta-item-info">
|
|
115
|
-
<template v-for="(contributor, index) in contributors" :key="index">
|
|
116
|
-
<span class="contributor" :title="`email: ${contributor.email}`">
|
|
117
|
-
{{ contributor.name }}
|
|
118
|
-
</span>
|
|
119
|
-
<template v-if="index !== contributors.length - 1">, </template>
|
|
120
|
-
</template>
|
|
121
|
-
</span>
|
|
122
|
-
</div>
|
|
123
|
-
</footer>
|
|
124
|
-
</template>
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import AutoLink from '@theme/AutoLink.vue'
|
|
3
|
-
import { usePageFrontmatter } from '@vuepress/client'
|
|
4
|
-
import { isPlainObject, isString } from '@vuepress/shared'
|
|
5
|
-
import { computed } from 'vue'
|
|
6
|
-
import { useRoute } from 'vue-router'
|
|
7
|
-
import type {
|
|
8
|
-
DefaultThemeNormalPageFrontmatter,
|
|
9
|
-
NavLink,
|
|
10
|
-
ResolvedSidebarItem,
|
|
11
|
-
} from '../../shared'
|
|
12
|
-
import { useNavLink, useSidebarItems } from '../composables'
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Resolve `prev` or `next` config from frontmatter
|
|
16
|
-
*/
|
|
17
|
-
const resolveFromFrontmatterConfig = (
|
|
18
|
-
conf: unknown
|
|
19
|
-
): null | false | NavLink => {
|
|
20
|
-
if (conf === false) {
|
|
21
|
-
return null
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (isString(conf)) {
|
|
25
|
-
return useNavLink(conf)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (isPlainObject<NavLink>(conf)) {
|
|
29
|
-
return conf
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return false
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Resolve `prev` or `next` config from sidebar items
|
|
37
|
-
*/
|
|
38
|
-
const resolveFromSidebarItems = (
|
|
39
|
-
sidebarItems: ResolvedSidebarItem[],
|
|
40
|
-
currentPath: string,
|
|
41
|
-
offset: number
|
|
42
|
-
): null | NavLink => {
|
|
43
|
-
const index = sidebarItems.findIndex((item) => item.link === currentPath)
|
|
44
|
-
if (index !== -1) {
|
|
45
|
-
const targetItem = sidebarItems[index + offset]
|
|
46
|
-
if (!targetItem?.link) {
|
|
47
|
-
return null
|
|
48
|
-
}
|
|
49
|
-
return targetItem as NavLink
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
for (const item of sidebarItems) {
|
|
53
|
-
if (item.children) {
|
|
54
|
-
const childResult = resolveFromSidebarItems(
|
|
55
|
-
item.children,
|
|
56
|
-
currentPath,
|
|
57
|
-
offset
|
|
58
|
-
)
|
|
59
|
-
if (childResult) {
|
|
60
|
-
return childResult
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return null
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const frontmatter = usePageFrontmatter<DefaultThemeNormalPageFrontmatter>()
|
|
69
|
-
const sidebarItems = useSidebarItems()
|
|
70
|
-
const route = useRoute()
|
|
71
|
-
|
|
72
|
-
const prevNavLink = computed(() => {
|
|
73
|
-
const prevConfig = resolveFromFrontmatterConfig(frontmatter.value.prev)
|
|
74
|
-
if (prevConfig !== false) {
|
|
75
|
-
return prevConfig
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return resolveFromSidebarItems(sidebarItems.value, route.path, -1)
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
const nextNavLink = computed(() => {
|
|
82
|
-
const nextConfig = resolveFromFrontmatterConfig(frontmatter.value.next)
|
|
83
|
-
if (nextConfig !== false) {
|
|
84
|
-
return nextConfig
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return resolveFromSidebarItems(sidebarItems.value, route.path, 1)
|
|
88
|
-
})
|
|
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
|
-
<AutoLink :item="prevNavLink" />
|
|
96
|
-
</span>
|
|
97
|
-
|
|
98
|
-
<span v-if="nextNavLink" class="next">
|
|
99
|
-
<AutoLink :item="nextNavLink" />
|
|
100
|
-
</span>
|
|
101
|
-
</p>
|
|
102
|
-
</nav>
|
|
103
|
-
</template>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import NavbarItems from '@theme/NavbarItems.vue'
|
|
3
|
-
import SidebarItems from '@theme/SidebarItems.vue'
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<template>
|
|
7
|
-
<aside class="sidebar">
|
|
8
|
-
<NavbarItems />
|
|
9
|
-
<slot name="top" />
|
|
10
|
-
<SidebarItems />
|
|
11
|
-
<slot name="bottom" />
|
|
12
|
-
</aside>
|
|
13
|
-
</template>
|
|
@@ -1,80 +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 } from 'vue'
|
|
5
|
-
import type { PropType } from 'vue'
|
|
6
|
-
import { useRoute, useRouter } from 'vue-router'
|
|
7
|
-
import type { ResolvedSidebarItem } from '../../shared'
|
|
8
|
-
import { isActiveSidebarItem } from '../utils'
|
|
9
|
-
|
|
10
|
-
const props = defineProps({
|
|
11
|
-
item: {
|
|
12
|
-
type: Object as PropType<ResolvedSidebarItem>,
|
|
13
|
-
required: true,
|
|
14
|
-
},
|
|
15
|
-
depth: {
|
|
16
|
-
type: Number,
|
|
17
|
-
required: false,
|
|
18
|
-
default: 0,
|
|
19
|
-
},
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
const { item, depth } = toRefs(props)
|
|
23
|
-
const route = useRoute()
|
|
24
|
-
const router = useRouter()
|
|
25
|
-
|
|
26
|
-
const isActive = computed(() => isActiveSidebarItem(item.value, route))
|
|
27
|
-
const itemClass = computed(() => ({
|
|
28
|
-
'sidebar-item': true,
|
|
29
|
-
'sidebar-heading': depth.value === 0,
|
|
30
|
-
'active': isActive.value,
|
|
31
|
-
'collapsible': item.value.collapsible,
|
|
32
|
-
}))
|
|
33
|
-
|
|
34
|
-
const isOpen = ref(true)
|
|
35
|
-
const onClick = ref<(() => void) | undefined>(undefined)
|
|
36
|
-
|
|
37
|
-
if (item.value.collapsible) {
|
|
38
|
-
// active item is open by default
|
|
39
|
-
isOpen.value = isActive.value
|
|
40
|
-
// toggle open status on click
|
|
41
|
-
onClick.value = () => {
|
|
42
|
-
isOpen.value = !isOpen.value
|
|
43
|
-
}
|
|
44
|
-
// reset open status after navigation
|
|
45
|
-
router.afterEach(() => {
|
|
46
|
-
isOpen.value = isActive.value
|
|
47
|
-
})
|
|
48
|
-
}
|
|
49
|
-
</script>
|
|
50
|
-
|
|
51
|
-
<template>
|
|
52
|
-
<li>
|
|
53
|
-
<AutoLink v-if="item.link" :class="itemClass" :item="item" />
|
|
54
|
-
<p
|
|
55
|
-
v-else
|
|
56
|
-
tabindex="0"
|
|
57
|
-
:class="itemClass"
|
|
58
|
-
@click="onClick"
|
|
59
|
-
@keydown.enter="onClick"
|
|
60
|
-
>
|
|
61
|
-
{{ item.text }}
|
|
62
|
-
<span
|
|
63
|
-
v-if="item.collapsible"
|
|
64
|
-
class="arrow"
|
|
65
|
-
:class="isOpen ? 'down' : 'right'"
|
|
66
|
-
/>
|
|
67
|
-
</p>
|
|
68
|
-
|
|
69
|
-
<DropdownTransition v-if="item.children?.length">
|
|
70
|
-
<ul v-show="isOpen" class="sidebar-item-children">
|
|
71
|
-
<SidebarItem
|
|
72
|
-
v-for="child in item.children"
|
|
73
|
-
:key="`${depth}${child.text}${child.link}`"
|
|
74
|
-
:item="child"
|
|
75
|
-
:depth="depth + 1"
|
|
76
|
-
/>
|
|
77
|
-
</ul>
|
|
78
|
-
</DropdownTransition>
|
|
79
|
-
</li>
|
|
80
|
-
</template>
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import SidebarItem from '@theme/SidebarItem.vue'
|
|
3
|
-
import { onMounted, watch } from 'vue'
|
|
4
|
-
import { useRoute } from 'vue-router'
|
|
5
|
-
import { useSidebarItems } from '../composables'
|
|
6
|
-
|
|
7
|
-
const route = useRoute()
|
|
8
|
-
const sidebarItems = useSidebarItems()
|
|
9
|
-
|
|
10
|
-
onMounted(() => {
|
|
11
|
-
watch(
|
|
12
|
-
() => route.hash,
|
|
13
|
-
(hash) => {
|
|
14
|
-
// get the sidebar DOM
|
|
15
|
-
const sidebar = document.querySelector('.sidebar')
|
|
16
|
-
if (!sidebar) return
|
|
17
|
-
|
|
18
|
-
// get the active sidebar item DOM, whose href equals to the current route
|
|
19
|
-
const activeSidebarItem = document.querySelector(
|
|
20
|
-
`.sidebar a.sidebar-item[href="${route.path}${hash}"]`
|
|
21
|
-
)
|
|
22
|
-
if (!activeSidebarItem) return
|
|
23
|
-
|
|
24
|
-
// get the top and height of the sidebar
|
|
25
|
-
const { top: sidebarTop, height: sidebarHeight } =
|
|
26
|
-
sidebar.getBoundingClientRect()
|
|
27
|
-
// get the top and height of the active sidebar item
|
|
28
|
-
const { top: activeSidebarItemTop, height: activeSidebarItemHeight } =
|
|
29
|
-
activeSidebarItem.getBoundingClientRect()
|
|
30
|
-
|
|
31
|
-
// when the active sidebar item overflows the top edge of sidebar
|
|
32
|
-
if (activeSidebarItemTop < sidebarTop) {
|
|
33
|
-
// scroll to the top edge of sidebar
|
|
34
|
-
activeSidebarItem.scrollIntoView(true)
|
|
35
|
-
}
|
|
36
|
-
// when the active sidebar item overflows the bottom edge of sidebar
|
|
37
|
-
else if (
|
|
38
|
-
activeSidebarItemTop + activeSidebarItemHeight >
|
|
39
|
-
sidebarTop + sidebarHeight
|
|
40
|
-
) {
|
|
41
|
-
// scroll to the bottom edge of sidebar
|
|
42
|
-
activeSidebarItem.scrollIntoView(false)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
)
|
|
46
|
-
})
|
|
47
|
-
</script>
|
|
48
|
-
|
|
49
|
-
<template>
|
|
50
|
-
<ul v-if="sidebarItems.length" class="sidebar-items">
|
|
51
|
-
<SidebarItem
|
|
52
|
-
v-for="item in sidebarItems"
|
|
53
|
-
:key="item.link || item.text"
|
|
54
|
-
:item="item"
|
|
55
|
-
/>
|
|
56
|
-
</ul>
|
|
57
|
-
</template>
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { useDarkMode, useThemeLocaleData } from '../composables'
|
|
3
|
-
|
|
4
|
-
const themeLocale = useThemeLocaleData()
|
|
5
|
-
const isDarkMode = useDarkMode()
|
|
6
|
-
|
|
7
|
-
const toggleColorMode = (): void => {
|
|
8
|
-
isDarkMode.value = !isDarkMode.value
|
|
9
|
-
}
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<template>
|
|
13
|
-
<button
|
|
14
|
-
class="toggle-color-mode-button"
|
|
15
|
-
:title="themeLocale.toggleColorMode"
|
|
16
|
-
@click="toggleColorMode"
|
|
17
|
-
>
|
|
18
|
-
<svg
|
|
19
|
-
v-show="!isDarkMode"
|
|
20
|
-
class="icon"
|
|
21
|
-
focusable="false"
|
|
22
|
-
viewBox="0 0 32 32"
|
|
23
|
-
>
|
|
24
|
-
<path
|
|
25
|
-
d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6z"
|
|
26
|
-
fill="currentColor"
|
|
27
|
-
/>
|
|
28
|
-
<path
|
|
29
|
-
d="M5.394 6.813l1.414-1.415l3.506 3.506L8.9 10.318z"
|
|
30
|
-
fill="currentColor"
|
|
31
|
-
/>
|
|
32
|
-
<path d="M2 15.005h5v2H2z" fill="currentColor" />
|
|
33
|
-
<path
|
|
34
|
-
d="M5.394 25.197L8.9 21.691l1.414 1.415l-3.506 3.505z"
|
|
35
|
-
fill="currentColor"
|
|
36
|
-
/>
|
|
37
|
-
<path d="M15 25.005h2v5h-2z" fill="currentColor" />
|
|
38
|
-
<path
|
|
39
|
-
d="M21.687 23.106l1.414-1.415l3.506 3.506l-1.414 1.414z"
|
|
40
|
-
fill="currentColor"
|
|
41
|
-
/>
|
|
42
|
-
<path d="M25 15.005h5v2h-5z" fill="currentColor" />
|
|
43
|
-
<path
|
|
44
|
-
d="M21.687 8.904l3.506-3.506l1.414 1.415l-3.506 3.505z"
|
|
45
|
-
fill="currentColor"
|
|
46
|
-
/>
|
|
47
|
-
<path d="M15 2.005h2v5h-2z" fill="currentColor" />
|
|
48
|
-
</svg>
|
|
49
|
-
|
|
50
|
-
<svg v-show="isDarkMode" class="icon" focusable="false" viewBox="0 0 32 32">
|
|
51
|
-
<path
|
|
52
|
-
d="M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z"
|
|
53
|
-
fill="currentColor"
|
|
54
|
-
/>
|
|
55
|
-
</svg>
|
|
56
|
-
</button>
|
|
57
|
-
</template>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { useThemeLocaleData } from '../composables'
|
|
3
|
-
|
|
4
|
-
defineEmits(['toggle'])
|
|
5
|
-
|
|
6
|
-
const themeLocale = useThemeLocaleData()
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<template>
|
|
10
|
-
<div
|
|
11
|
-
class="toggle-sidebar-button"
|
|
12
|
-
:title="themeLocale.toggleSidebar"
|
|
13
|
-
aria-expanded="false"
|
|
14
|
-
role="button"
|
|
15
|
-
tabindex="0"
|
|
16
|
-
@click="$emit('toggle')"
|
|
17
|
-
>
|
|
18
|
-
<div class="icon" aria-hidden="true">
|
|
19
|
-
<span></span>
|
|
20
|
-
<span></span>
|
|
21
|
-
<span></span>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
</template>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
defineProps({
|
|
3
|
-
type: {
|
|
4
|
-
type: String,
|
|
5
|
-
required: false,
|
|
6
|
-
default: 'tip',
|
|
7
|
-
},
|
|
8
|
-
text: {
|
|
9
|
-
type: String,
|
|
10
|
-
required: false,
|
|
11
|
-
default: '',
|
|
12
|
-
},
|
|
13
|
-
vertical: {
|
|
14
|
-
type: String,
|
|
15
|
-
required: false,
|
|
16
|
-
default: undefined,
|
|
17
|
-
},
|
|
18
|
-
})
|
|
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,4 +0,0 @@
|
|
|
1
|
-
import type { VNode } from 'vue';
|
|
2
|
-
export declare const CodeGroup: import("vue").DefineComponent<{}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
3
|
-
[key: string]: any;
|
|
4
|
-
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|