vitepress-theme-element-plus 0.0.3 → 0.0.4
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/README.md +3 -3
- package/client/components/A11yTag.vue +29 -29
- package/client/components/ApiTyping.vue +54 -54
- package/client/components/Backdrop.vue +41 -41
- package/client/components/Bili.vue +94 -94
- package/client/components/Content.vue +148 -150
- package/client/components/DeprecatedTag.vue +19 -19
- package/client/components/Doc.vue +181 -181
- package/client/components/DocAside.vue +46 -46
- package/client/components/DocAsideOutline.vue +82 -82
- package/client/components/DocFooter.vue +159 -159
- package/client/components/Footer.vue +77 -77
- package/client/components/FooterCopyright.vue +27 -27
- package/client/components/Layout.vue +156 -156
- package/client/components/Link.vue +41 -41
- package/client/components/LocalNav.vue +160 -160
- package/client/components/Nav.vue +69 -69
- package/client/components/NavBar.vue +203 -203
- package/client/components/NavBarTitle.vue +75 -75
- package/client/components/Sidebar.vue +129 -129
- package/client/components/SidebarGroup.vue +51 -51
- package/client/components/SidebarItem.vue +302 -302
- package/client/components/Tag.vue +25 -25
- package/client/components/VPNavBarSearch.vue +23 -23
- package/client/components/VersionTag.vue +18 -18
- package/client/hooks/useBackTop.ts +71 -71
- package/client/hooks/useLangs.ts +50 -50
- package/client/hooks/useSidebar.ts +93 -18
- package/client/hooks/useSidebarControl.ts +78 -78
- package/client/hooks/useSize.ts +69 -69
- package/client/utils/client/common.ts +49 -49
- package/client/utils/client/outline.ts +113 -113
- package/client/utils/common.ts +90 -90
- package/index.ts +26 -26
- package/package.json +73 -73
- package/shared/constants.ts +3 -3
- package/styles/base.scss +37 -37
- package/styles/code.scss +282 -282
- package/styles/doc-content.scss +161 -161
- package/styles/index.scss +69 -69
- package/styles/tag-content.scss +30 -30
|
@@ -1,181 +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>
|
|
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>
|
|
@@ -1,46 +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>
|
|
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>
|
|
@@ -1,82 +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>
|
|
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>
|