vitepress-theme-element-plus 0.0.1 → 0.0.3
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/client/components/A11yTag.vue +29 -0
- package/client/components/ApiTyping.vue +54 -0
- package/client/components/Backdrop.vue +41 -0
- package/client/components/Bili.vue +94 -0
- package/client/components/Content.vue +150 -0
- package/client/components/DeprecatedTag.vue +19 -0
- package/client/components/Doc.vue +181 -0
- package/client/components/DocAside.vue +46 -0
- package/client/components/DocAsideOutline.vue +82 -0
- package/client/components/DocFooter.vue +159 -0
- package/client/components/Footer.vue +77 -0
- package/client/components/FooterCopyright.vue +27 -0
- package/client/components/Layout.vue +156 -0
- package/client/components/Link.vue +41 -0
- package/client/components/LocalNav.vue +160 -0
- package/client/components/Nav.vue +69 -0
- package/client/components/NavBar.vue +203 -0
- package/client/components/NavBarTitle.vue +75 -0
- package/client/components/Sidebar.vue +129 -0
- package/client/components/SidebarGroup.vue +51 -0
- package/client/components/SidebarItem.vue +302 -0
- package/client/components/Tag.vue +25 -0
- package/client/components/VPNavBarSearch.vue +23 -0
- package/client/components/VersionTag.vue +18 -0
- package/client/hooks/useBackTop.ts +74 -0
- package/client/hooks/useLangs.ts +50 -0
- package/client/hooks/useSidebar.ts +105 -0
- package/client/hooks/useSidebarControl.ts +78 -0
- package/client/hooks/useSize.ts +69 -0
- package/client/utils/client/common.ts +49 -0
- package/client/utils/client/outline.ts +113 -0
- package/client/utils/common.ts +90 -0
- package/client/utils/throttle.ts +46 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +6 -0
- package/dist/markdown/plugins/external-link-icon.d.mts +6 -0
- package/dist/markdown/plugins/external-link-icon.mjs +26 -0
- package/dist/markdown/plugins/table-wrapper.d.mts +6 -0
- package/dist/markdown/plugins/table-wrapper.mjs +8 -0
- package/dist/markdown/plugins/tag.d.mts +6 -0
- package/dist/markdown/plugins/tag.mjs +25 -0
- package/dist/markdown/plugins/tooltip.d.mts +6 -0
- package/dist/markdown/plugins/tooltip.mjs +24 -0
- package/package.json +8 -7
- package/shared/constants.ts +3 -0
- package/styles/base.scss +37 -0
- package/styles/code.scss +283 -0
- package/styles/doc-content.scss +161 -0
- package/styles/index.scss +69 -0
- package/styles/tag-content.scss +30 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ElTag } from 'element-plus'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<ElTag
|
|
7
|
+
size="small"
|
|
8
|
+
effect="plain"
|
|
9
|
+
hit
|
|
10
|
+
round
|
|
11
|
+
>
|
|
12
|
+
a11y
|
|
13
|
+
</ElTag>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<style lang="scss" scoped>
|
|
17
|
+
.el-tag {
|
|
18
|
+
color: #6222c2;
|
|
19
|
+
}
|
|
20
|
+
.el-tag.is-hit {
|
|
21
|
+
border-color: #9065db;
|
|
22
|
+
}
|
|
23
|
+
.dark .el-tag {
|
|
24
|
+
color: #9065db;
|
|
25
|
+
}
|
|
26
|
+
.dark .el-tag.is-hit {
|
|
27
|
+
border-color: #6222c2;
|
|
28
|
+
}
|
|
29
|
+
</style>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Warning } from '@element-plus/icons-vue'
|
|
3
|
+
import { ElButton, ElTooltip } from 'element-plus'
|
|
4
|
+
|
|
5
|
+
defineProps({
|
|
6
|
+
type: String,
|
|
7
|
+
details: String,
|
|
8
|
+
})
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<span class="api-typing-container">
|
|
13
|
+
<code class="api-typing">
|
|
14
|
+
{{ type }}
|
|
15
|
+
</code>
|
|
16
|
+
<ClientOnly>
|
|
17
|
+
<ElTooltip v-if="details" effect="light" trigger="click">
|
|
18
|
+
<ElButton
|
|
19
|
+
text
|
|
20
|
+
:icon="Warning"
|
|
21
|
+
aria-label="Type details"
|
|
22
|
+
class="api-typing__warning-icon"
|
|
23
|
+
/>
|
|
24
|
+
<template #content>
|
|
25
|
+
<slot>
|
|
26
|
+
<div class="m-1" style="max-width: 600px">
|
|
27
|
+
<code
|
|
28
|
+
style="
|
|
29
|
+
color: var(--code-tooltip-color);
|
|
30
|
+
background-color: var(--code-tooltip-bg-color);
|
|
31
|
+
"
|
|
32
|
+
>
|
|
33
|
+
{{ details }}
|
|
34
|
+
</code>
|
|
35
|
+
</div>
|
|
36
|
+
</slot>
|
|
37
|
+
</template>
|
|
38
|
+
</ElTooltip>
|
|
39
|
+
</ClientOnly>
|
|
40
|
+
</span>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<style scoped lang="scss">
|
|
44
|
+
.api-typing-container {
|
|
45
|
+
display: inline-flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
}
|
|
48
|
+
.api-typing {
|
|
49
|
+
margin-right: 4px;
|
|
50
|
+
}
|
|
51
|
+
.api-typing__warning-icon {
|
|
52
|
+
padding: 8px;
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useSidebar } from '../hooks/useSidebar'
|
|
3
|
+
|
|
4
|
+
const { isOpen, close } = useSidebar()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<transition name="fade">
|
|
9
|
+
<div v-if="isOpen" class="VPBackdrop" @click="close()" />
|
|
10
|
+
</transition>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<style scoped lang="scss">
|
|
14
|
+
.VPBackdrop {
|
|
15
|
+
position: fixed;
|
|
16
|
+
top: 0;
|
|
17
|
+
/*rtl:ignore*/
|
|
18
|
+
right: 0;
|
|
19
|
+
bottom: 0;
|
|
20
|
+
/*rtl:ignore*/
|
|
21
|
+
left: 0;
|
|
22
|
+
z-index: var(--vp-z-index-backdrop);
|
|
23
|
+
background: var(--vp-backdrop-bg-color);
|
|
24
|
+
transition: opacity 0.5s;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.VPBackdrop.fade-enter-from,
|
|
28
|
+
.VPBackdrop.fade-leave-to {
|
|
29
|
+
opacity: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.VPBackdrop.fade-leave-active {
|
|
33
|
+
transition-duration: 0.25s;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@media (min-width: 1440px) {
|
|
37
|
+
.VPBackdrop {
|
|
38
|
+
display: none;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
import { useSize } from '../hooks/useSize'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
/**
|
|
7
|
+
* aid
|
|
8
|
+
*/
|
|
9
|
+
aid?: string
|
|
10
|
+
/**
|
|
11
|
+
* bvid
|
|
12
|
+
*/
|
|
13
|
+
bvid?: string
|
|
14
|
+
/**
|
|
15
|
+
* cid
|
|
16
|
+
*/
|
|
17
|
+
cid?: string
|
|
18
|
+
/**
|
|
19
|
+
* 是否开启自动播放
|
|
20
|
+
*/
|
|
21
|
+
autoplay?: boolean
|
|
22
|
+
/**
|
|
23
|
+
* 指定播放时间
|
|
24
|
+
*/
|
|
25
|
+
time?: number | string
|
|
26
|
+
/**
|
|
27
|
+
* 指定视频分p
|
|
28
|
+
*/
|
|
29
|
+
page?: number
|
|
30
|
+
/**
|
|
31
|
+
* 宽度
|
|
32
|
+
*/
|
|
33
|
+
width?: number
|
|
34
|
+
/**
|
|
35
|
+
* 高度
|
|
36
|
+
*/
|
|
37
|
+
height?: number
|
|
38
|
+
/**
|
|
39
|
+
* 尺寸比例
|
|
40
|
+
*/
|
|
41
|
+
ratio?: number
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 是否展示封面
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
poster?: boolean
|
|
48
|
+
}
|
|
49
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
50
|
+
ratio: 16 / 9,
|
|
51
|
+
poster: true,
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const VIDEO_LINK = 'https://player.bilibili.com/player.html'
|
|
55
|
+
const { el, width, height, resize } = useSize<HTMLIFrameElement>(props)
|
|
56
|
+
const loaded = ref(false)
|
|
57
|
+
|
|
58
|
+
const videoLink = computed(() => {
|
|
59
|
+
const { aid, bvid, cid, autoplay, time, page, poster } = props
|
|
60
|
+
|
|
61
|
+
return aid && cid
|
|
62
|
+
? `${VIDEO_LINK}?aid=${aid}&cid=${cid}&t=${time}&autoplay=${
|
|
63
|
+
autoplay ? 1 : 0
|
|
64
|
+
}&p=${page}&poster=${poster ? 1 : 0}`
|
|
65
|
+
: bvid
|
|
66
|
+
? `${VIDEO_LINK}?bvid=${bvid}&t=${time}&autoplay=${autoplay ? 1 : 0}&poster=${poster ? 1 : 0}`
|
|
67
|
+
: ''
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
function handleLoad() {
|
|
71
|
+
loaded.value = true
|
|
72
|
+
resize()
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<template>
|
|
77
|
+
<iframe
|
|
78
|
+
ref="el"
|
|
79
|
+
class="bili-iframe"
|
|
80
|
+
:src="videoLink"
|
|
81
|
+
:style="{ width, height }"
|
|
82
|
+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture"
|
|
83
|
+
@load="handleLoad"
|
|
84
|
+
/>
|
|
85
|
+
</template>
|
|
86
|
+
|
|
87
|
+
<style lang="scss" scoped>
|
|
88
|
+
.bili-iframe {
|
|
89
|
+
border-radius: 8px;
|
|
90
|
+
border: none;
|
|
91
|
+
background-color: #000;
|
|
92
|
+
transition: all 0.3s;
|
|
93
|
+
}
|
|
94
|
+
</style>
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ElTag } from 'element-plus'
|
|
3
|
+
import { useData } from 'vitepress'
|
|
4
|
+
import VPHome from 'vitepress/dist/client/theme-default/components/VPHome.vue'
|
|
5
|
+
import VPPage from 'vitepress/dist/client/theme-default/components/VPPage.vue'
|
|
6
|
+
import NotFound from 'vitepress/dist/client/theme-default/NotFound.vue'
|
|
7
|
+
import { useLayout } from 'vitepress/theme'
|
|
8
|
+
import { getCurrentInstance } from 'vue'
|
|
9
|
+
import ApiTyping from './ApiTyping.vue'
|
|
10
|
+
import VPDoc from './Doc.vue'
|
|
11
|
+
import Footer from './Footer.vue'
|
|
12
|
+
import FooterCopyright from './FooterCopyright.vue'
|
|
13
|
+
|
|
14
|
+
const { page, frontmatter } = useData()
|
|
15
|
+
const { isHome, hasSidebar } = useLayout()
|
|
16
|
+
const { appContext } = getCurrentInstance()
|
|
17
|
+
|
|
18
|
+
appContext.app.component('ApiTyping', ApiTyping)
|
|
19
|
+
appContext.app.component('ElTag', ElTag)
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<div id="VPContent" class="VPContent" :class="{ 'has-sidebar': hasSidebar, 'is-home': isHome }">
|
|
24
|
+
<slot v-if="page.isNotFound" name="not-found">
|
|
25
|
+
<NotFound />
|
|
26
|
+
</slot>
|
|
27
|
+
|
|
28
|
+
<VPPage v-else-if="frontmatter.layout === 'page'">
|
|
29
|
+
<template #page-top>
|
|
30
|
+
<slot name="page-top" />
|
|
31
|
+
</template>
|
|
32
|
+
<template #page-bottom>
|
|
33
|
+
<slot name="page-bottom" />
|
|
34
|
+
</template>
|
|
35
|
+
</VPPage>
|
|
36
|
+
|
|
37
|
+
<VPHome v-else-if="frontmatter.layout === 'home'">
|
|
38
|
+
<template #home-hero-before>
|
|
39
|
+
<slot name="home-hero-before" />
|
|
40
|
+
</template>
|
|
41
|
+
<template #home-hero-info-before>
|
|
42
|
+
<slot name="home-hero-info-before" />
|
|
43
|
+
</template>
|
|
44
|
+
<template #home-hero-info>
|
|
45
|
+
<slot name="home-hero-info" />
|
|
46
|
+
</template>
|
|
47
|
+
<template #home-hero-info-after>
|
|
48
|
+
<slot name="home-hero-info-after" />
|
|
49
|
+
</template>
|
|
50
|
+
<template #home-hero-actions-after>
|
|
51
|
+
<slot name="home-hero-actions-after" />
|
|
52
|
+
</template>
|
|
53
|
+
<template #home-hero-image>
|
|
54
|
+
<slot name="home-hero-image" />
|
|
55
|
+
</template>
|
|
56
|
+
<template #home-hero-after>
|
|
57
|
+
<slot name="home-hero-after" />
|
|
58
|
+
</template>
|
|
59
|
+
<template #home-features-before>
|
|
60
|
+
<slot name="home-features-before" />
|
|
61
|
+
</template>
|
|
62
|
+
<template #home-features-after>
|
|
63
|
+
<slot name="home-features-after" />
|
|
64
|
+
</template>
|
|
65
|
+
</VPHome>
|
|
66
|
+
|
|
67
|
+
<component :is="frontmatter.layout" v-else-if="frontmatter.layout && frontmatter.layout !== 'doc'" />
|
|
68
|
+
|
|
69
|
+
<VPDoc v-else>
|
|
70
|
+
<template #doc-top>
|
|
71
|
+
<slot name="doc-top" />
|
|
72
|
+
</template>
|
|
73
|
+
<template #doc-bottom>
|
|
74
|
+
<slot name="doc-bottom" />
|
|
75
|
+
</template>
|
|
76
|
+
|
|
77
|
+
<template #doc-footer-before>
|
|
78
|
+
<slot name="doc-footer-before" />
|
|
79
|
+
</template>
|
|
80
|
+
<template #doc-before>
|
|
81
|
+
<slot name="doc-before" />
|
|
82
|
+
</template>
|
|
83
|
+
<template #doc-after>
|
|
84
|
+
<slot name="doc-after" />
|
|
85
|
+
</template>
|
|
86
|
+
|
|
87
|
+
<template #aside-top>
|
|
88
|
+
<slot name="aside-top" />
|
|
89
|
+
</template>
|
|
90
|
+
<template #aside-outline-before>
|
|
91
|
+
<slot name="aside-outline-before" />
|
|
92
|
+
</template>
|
|
93
|
+
<template #aside-outline-after>
|
|
94
|
+
<slot name="aside-outline-after" />
|
|
95
|
+
</template>
|
|
96
|
+
<template #aside-ads-before>
|
|
97
|
+
<slot name="aside-ads-before" />
|
|
98
|
+
</template>
|
|
99
|
+
<template #aside-ads-after>
|
|
100
|
+
<slot name="aside-ads-after" />
|
|
101
|
+
</template>
|
|
102
|
+
<template #aside-bottom>
|
|
103
|
+
<slot name="aside-bottom" />
|
|
104
|
+
</template>
|
|
105
|
+
</VPDoc>
|
|
106
|
+
<Footer />
|
|
107
|
+
<FooterCopyright v-if="isHome" />
|
|
108
|
+
</div>
|
|
109
|
+
</template>
|
|
110
|
+
|
|
111
|
+
<style scoped>
|
|
112
|
+
.VPContent {
|
|
113
|
+
flex-grow: 1;
|
|
114
|
+
flex-shrink: 0;
|
|
115
|
+
margin: var(--vp-layout-top-height, 0px) auto 0;
|
|
116
|
+
width: 100%;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.VPContent.is-home {
|
|
120
|
+
width: 100%;
|
|
121
|
+
max-width: 100%;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.VPContent.has-sidebar {
|
|
125
|
+
margin: 0;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@media (min-width: 960px) {
|
|
129
|
+
.VPContent {
|
|
130
|
+
padding-top: calc(var(--vp-nav-height) + 47px);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.VPContent.has-sidebar {
|
|
134
|
+
margin: var(--vp-layout-top-height, 0px) 0 0;
|
|
135
|
+
padding-left: var(--vp-sidebar-width-small);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@media screen and (min-width: 1440px) {
|
|
140
|
+
.VPContent.has-sidebar {
|
|
141
|
+
padding-left: calc(var(--vp-sidebar-width-small) + 39px)
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@media screen and (min-width: 1680px) {
|
|
146
|
+
.VPContent.has-sidebar {
|
|
147
|
+
padding-left: calc(var(--vp-sidebar-width-small) + 48px)
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { ElTag } from 'element-plus'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
version: string
|
|
6
|
+
}>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<ElTag
|
|
11
|
+
size="small"
|
|
12
|
+
type="warning"
|
|
13
|
+
effect="plain"
|
|
14
|
+
hit
|
|
15
|
+
round
|
|
16
|
+
>
|
|
17
|
+
deprecated
|
|
18
|
+
</ElTag>
|
|
19
|
+
</template>
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useData, useRoute } from 'vitepress'
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
import { useSidebar } from '../hooks/useSidebar'
|
|
5
|
+
import VPDocAside from './DocAside.vue'
|
|
6
|
+
import VPDocFooter from './DocFooter.vue'
|
|
7
|
+
|
|
8
|
+
const { theme } = useData()
|
|
9
|
+
|
|
10
|
+
const route = useRoute()
|
|
11
|
+
const { hasAside, leftAside, hasSidebar } = useSidebar()
|
|
12
|
+
|
|
13
|
+
const pageName = computed(() =>
|
|
14
|
+
route.path.replace(/[./]+/g, '_').replace(/_html$/, ''),
|
|
15
|
+
)
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<div class="VPDoc" :class="{ 'has-sidebar': hasSidebar, 'has-aside': hasAside }">
|
|
20
|
+
<slot name="doc-top" />
|
|
21
|
+
<div class="container">
|
|
22
|
+
<div v-if="hasAside" class="aside" :class="{ 'left-aside': leftAside }">
|
|
23
|
+
<div class="aside-container">
|
|
24
|
+
<div class="aside-content">
|
|
25
|
+
<VPDocAside>
|
|
26
|
+
<template #aside-top>
|
|
27
|
+
<slot name="aside-top" />
|
|
28
|
+
</template>
|
|
29
|
+
<template #aside-bottom>
|
|
30
|
+
<slot name="aside-bottom" />
|
|
31
|
+
</template>
|
|
32
|
+
<template #aside-outline-before>
|
|
33
|
+
<slot name="aside-outline-before" />
|
|
34
|
+
</template>
|
|
35
|
+
<template #aside-outline-after>
|
|
36
|
+
<slot name="aside-outline-after" />
|
|
37
|
+
</template>
|
|
38
|
+
<template #aside-ads-before>
|
|
39
|
+
<slot name="aside-ads-before" />
|
|
40
|
+
</template>
|
|
41
|
+
<template #aside-ads-after>
|
|
42
|
+
<slot name="aside-ads-after" />
|
|
43
|
+
</template>
|
|
44
|
+
</VPDocAside>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div class="content">
|
|
50
|
+
<div class="content-container">
|
|
51
|
+
<slot name="doc-before" />
|
|
52
|
+
<main class="main">
|
|
53
|
+
<Content
|
|
54
|
+
class="doc-content" :class="[
|
|
55
|
+
pageName,
|
|
56
|
+
theme.externalLinkIcon && 'external-link-icon-enabled',
|
|
57
|
+
]"
|
|
58
|
+
/>
|
|
59
|
+
</main>
|
|
60
|
+
<VPDocFooter>
|
|
61
|
+
<template #doc-footer-before>
|
|
62
|
+
<slot name="doc-footer-before" />
|
|
63
|
+
</template>
|
|
64
|
+
</VPDocFooter>
|
|
65
|
+
<slot name="doc-after" />
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
<slot name="doc-bottom" />
|
|
70
|
+
</div>
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<style scoped lang="scss">
|
|
74
|
+
.VPDoc {
|
|
75
|
+
padding: 32px 24px 96px;
|
|
76
|
+
width: 100%;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@media (min-width: 768px) {
|
|
80
|
+
.VPDoc {
|
|
81
|
+
padding: 48px 32px;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@media (min-width: 960px) {
|
|
86
|
+
.VPDoc {
|
|
87
|
+
padding: 48px 32px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.VPDoc:not(.has-sidebar) .container {
|
|
91
|
+
display: flex;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
max-width: 992px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.VPDoc:not(.has-sidebar) .content {
|
|
97
|
+
max-width: 752px;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@media (min-width: 1440px) {
|
|
102
|
+
.VPDoc {
|
|
103
|
+
padding: 64px 0 48px 64px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.VPDoc .container {
|
|
107
|
+
display: flex;
|
|
108
|
+
justify-content: center;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.VPDoc .aside {
|
|
112
|
+
display: block;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@media (min-width: 1440px) {
|
|
117
|
+
.VPDoc:not(.has-sidebar) .content {
|
|
118
|
+
max-width: 784px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.VPDoc:not(.has-sidebar) .container {
|
|
122
|
+
max-width: 1104px;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.container {
|
|
127
|
+
margin: 0 auto;
|
|
128
|
+
width: 100%;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.aside {
|
|
132
|
+
position: relative;
|
|
133
|
+
display: none;
|
|
134
|
+
order: 2;
|
|
135
|
+
flex-grow: 1;
|
|
136
|
+
padding-left: 64px;
|
|
137
|
+
padding-right: 32px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.left-aside {
|
|
141
|
+
order: 1;
|
|
142
|
+
padding-left: unset;
|
|
143
|
+
padding-right: 32px;
|
|
144
|
+
padding-left: 16px;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.aside-container {
|
|
148
|
+
position: sticky;
|
|
149
|
+
top: calc(var(--vp-nav-height) + 32px);
|
|
150
|
+
margin-top: 0;
|
|
151
|
+
margin-bottom: 32px;
|
|
152
|
+
width: 200px;
|
|
153
|
+
height: calc(100vh - var(--vp-nav-height) - 32px);
|
|
154
|
+
overflow-y: auto;
|
|
155
|
+
scrollbar-width: none;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.aside-content {
|
|
159
|
+
display: flex;
|
|
160
|
+
flex-direction: column;
|
|
161
|
+
padding-bottom: 32px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.content {
|
|
165
|
+
position: relative;
|
|
166
|
+
margin: 0 auto;
|
|
167
|
+
width: 100%;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@media (min-width: 1440px) {
|
|
171
|
+
.content {
|
|
172
|
+
order: 1;
|
|
173
|
+
margin: 0;
|
|
174
|
+
min-width: 640px;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.content-container {
|
|
179
|
+
margin: 0 auto;
|
|
180
|
+
}
|
|
181
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useData } from 'vitepress'
|
|
3
|
+
import VPDocAsideCarbonAds from 'vitepress/dist/client/theme-default/components/VPDocAsideCarbonAds.vue'
|
|
4
|
+
import VPDocAsideOutline from './DocAsideOutline.vue'
|
|
5
|
+
|
|
6
|
+
const { theme } = useData()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<div class="VPDocAside">
|
|
11
|
+
<slot name="aside-top" />
|
|
12
|
+
|
|
13
|
+
<slot name="aside-outline-before" />
|
|
14
|
+
<VPDocAsideOutline />
|
|
15
|
+
<slot name="aside-outline-after" />
|
|
16
|
+
|
|
17
|
+
<div class="spacer" />
|
|
18
|
+
|
|
19
|
+
<slot name="aside-ads-before" />
|
|
20
|
+
<VPDocAsideCarbonAds v-if="theme.carbonAds" :carbon-ads="theme.carbonAds" />
|
|
21
|
+
<slot name="aside-ads-after" />
|
|
22
|
+
|
|
23
|
+
<slot name="aside-bottom" />
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<style scoped lang="scss">
|
|
28
|
+
.VPDocAside {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
flex-grow: 1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.spacer {
|
|
35
|
+
flex-grow: 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.VPDocAside :deep(.spacer + .VPDocAsideSponsors),
|
|
39
|
+
.VPDocAside :deep(.spacer + .VPDocAsideCarbonAds) {
|
|
40
|
+
margin-top: 24px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.VPDocAside :deep(.VPDocAsideSponsors + .VPDocAsideCarbonAds) {
|
|
44
|
+
margin-top: 16px;
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { MenuItem } from '../utils/client/outline'
|
|
3
|
+
import { ElAnchor, ElAnchorLink } from 'element-plus'
|
|
4
|
+
import { onContentUpdated, useData } from 'vitepress'
|
|
5
|
+
import { shallowRef } from 'vue'
|
|
6
|
+
import {
|
|
7
|
+
getHeaders,
|
|
8
|
+
|
|
9
|
+
resolveTitle,
|
|
10
|
+
} from '../utils/client/outline'
|
|
11
|
+
import 'element-plus/dist/index.css'
|
|
12
|
+
|
|
13
|
+
const { frontmatter, theme } = useData()
|
|
14
|
+
|
|
15
|
+
const headers = shallowRef<MenuItem[]>([])
|
|
16
|
+
|
|
17
|
+
onContentUpdated(() => {
|
|
18
|
+
headers.value = getHeaders(frontmatter.value.outline ?? theme.value.outline)
|
|
19
|
+
})
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<nav
|
|
24
|
+
aria-labelledby="doc-outline-aria-label"
|
|
25
|
+
class="VPDocAsideOutline"
|
|
26
|
+
:class="{ 'has-outline': headers.length > 0 }"
|
|
27
|
+
>
|
|
28
|
+
<div class="content">
|
|
29
|
+
<div
|
|
30
|
+
id="doc-outline-aria-label"
|
|
31
|
+
aria-level="2"
|
|
32
|
+
class="outline-title"
|
|
33
|
+
role="heading"
|
|
34
|
+
>
|
|
35
|
+
{{ resolveTitle(theme) }}
|
|
36
|
+
</div>
|
|
37
|
+
<ElAnchor :offset="70" :bound="120">
|
|
38
|
+
<ElAnchorLink
|
|
39
|
+
v-for="{ link, title, children } in headers"
|
|
40
|
+
:key="link"
|
|
41
|
+
:href="link"
|
|
42
|
+
:title="title"
|
|
43
|
+
>
|
|
44
|
+
<template v-if="children" #sub-link>
|
|
45
|
+
<ElAnchorLink
|
|
46
|
+
v-for="{ link: childLink, title: childTitle } in children"
|
|
47
|
+
:key="childLink"
|
|
48
|
+
:href="childLink"
|
|
49
|
+
:title="childTitle"
|
|
50
|
+
/>
|
|
51
|
+
</template>
|
|
52
|
+
</ElAnchorLink>
|
|
53
|
+
</ElAnchor>
|
|
54
|
+
</div>
|
|
55
|
+
</nav>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<style scoped lang="scss">
|
|
59
|
+
.VPDocAsideOutline {
|
|
60
|
+
display: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.VPDocAsideOutline.has-outline {
|
|
64
|
+
display: block;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.content {
|
|
68
|
+
position: relative;
|
|
69
|
+
font-size: 13px;
|
|
70
|
+
font-weight: 500;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.outline-title {
|
|
74
|
+
font-size: 12px;
|
|
75
|
+
line-height: 30px;
|
|
76
|
+
padding-left: 14px;
|
|
77
|
+
color: var(--text-color-light);
|
|
78
|
+
font-weight: 600;
|
|
79
|
+
text-transform: uppercase;
|
|
80
|
+
margin-top: 0px;
|
|
81
|
+
}
|
|
82
|
+
</style>
|