@wot-ui/vitepress-theme 2.0.0-alpha.10

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.
Files changed (57) hide show
  1. package/README.md +153 -0
  2. package/dist/config.js +118 -0
  3. package/dist/index.js +68 -0
  4. package/dist/locales/md-component-links.js +15 -0
  5. package/dist/plugins/md-component-links.js +34 -0
  6. package/dist/plugins/md-scss-vars.js +73 -0
  7. package/dist/plugins/md-version-badge.js +51 -0
  8. package/dist/plugins/virtual-version-data.js +83 -0
  9. package/dist/src/config.d.ts +3 -0
  10. package/dist/src/index.d.ts +21 -0
  11. package/dist/src/locales/md-component-links.d.ts +13 -0
  12. package/dist/src/plugins/md-component-links.d.ts +3 -0
  13. package/dist/src/plugins/md-scss-vars.d.ts +3 -0
  14. package/dist/src/plugins/md-version-badge.d.ts +6 -0
  15. package/dist/src/plugins/virtual-version-data.d.ts +3 -0
  16. package/dist/src/theme/composables/adSponsor.d.ts +30 -0
  17. package/dist/src/theme/composables/adsData.d.ts +16 -0
  18. package/dist/src/theme/composables/banner.d.ts +16 -0
  19. package/dist/src/theme/composables/cases.d.ts +16 -0
  20. package/dist/src/theme/composables/friendly.d.ts +19 -0
  21. package/dist/src/theme/composables/sponsor.d.ts +3 -0
  22. package/dist/src/theme/composables/team.d.ts +28 -0
  23. package/dist/src/theme/options.d.ts +3 -0
  24. package/dist/src/types.d.ts +86 -0
  25. package/dist/theme/Layout.vue +45 -0
  26. package/dist/theme/components/AsideSponsors.vue +105 -0
  27. package/dist/theme/components/Banner.vue +377 -0
  28. package/dist/theme/components/CustomFooter.vue +123 -0
  29. package/dist/theme/components/ExternalLink.vue +36 -0
  30. package/dist/theme/components/HomeCases.vue +122 -0
  31. package/dist/theme/components/HomeFriendly.vue +96 -0
  32. package/dist/theme/components/HomeTeam.vue +250 -0
  33. package/dist/theme/components/QrCode.vue +45 -0
  34. package/dist/theme/components/SidebarAds.vue +86 -0
  35. package/dist/theme/components/SpecialSponsor.vue +115 -0
  36. package/dist/theme/components/SvgImage.vue +22 -0
  37. package/dist/theme/components/VPContent.vue +92 -0
  38. package/dist/theme/components/VPDoc.vue +222 -0
  39. package/dist/theme/components/VPFeature.vue +150 -0
  40. package/dist/theme/components/VPIframe.vue +445 -0
  41. package/dist/theme/components/VPLocalNav.vue +151 -0
  42. package/dist/theme/components/VPNavBar.vue +253 -0
  43. package/dist/theme/components/VPSidebar.vue +120 -0
  44. package/dist/theme/components/VPSidebarItem.vue +271 -0
  45. package/dist/theme/components/WwAds.vue +74 -0
  46. package/dist/theme/composables/adSponsor.js +29 -0
  47. package/dist/theme/composables/adsData.js +35 -0
  48. package/dist/theme/composables/banner.js +35 -0
  49. package/dist/theme/composables/cases.js +43 -0
  50. package/dist/theme/composables/friendly.js +35 -0
  51. package/dist/theme/composables/sponsor.js +35 -0
  52. package/dist/theme/composables/team.js +48 -0
  53. package/dist/theme/options.js +4 -0
  54. package/dist/theme/styles/custom.css +206 -0
  55. package/dist/theme/styles/vars.css +136 -0
  56. package/dist/types.js +0 -0
  57. package/package.json +41 -0
@@ -0,0 +1,96 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import { useFriendly } from '../composables/friendly'
4
+ import { useData } from 'vitepress'
5
+
6
+ const { data } = useFriendly()
7
+ const { lang } = useData()
8
+
9
+ const links = computed(() => {
10
+ return lang.value === 'en-US' ? [] : data.value.length ? data.value : []
11
+ })
12
+ </script>
13
+
14
+ <template>
15
+ <div v-if="links && links.length" class="VPFriendly">
16
+ <div class="container">
17
+ <h2 class="friendly-title">友情链接</h2>
18
+ <div class="links">
19
+ <a v-for="link in links" :key="link.title" :href="link.link" target="_blank" rel="noopener noreferrer" class="link-item">
20
+ <img v-if="link.icon" :src="link.icon" :alt="link.title" class="link-icon" />
21
+ <span class="link-title">{{ link.title }}</span>
22
+ </a>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </template>
27
+
28
+ <style scoped>
29
+ .VPFriendly {
30
+ padding: 0 24px;
31
+ }
32
+
33
+ @media (min-width: 640px) {
34
+ .VPFriendly {
35
+ padding: 0 48px;
36
+ }
37
+ }
38
+
39
+ @media (min-width: 960px) {
40
+ .VPFriendly {
41
+ padding: 0 64px;
42
+ }
43
+ }
44
+
45
+ .container {
46
+ margin: 0 auto;
47
+ max-width: 1152px;
48
+ }
49
+
50
+ .friendly-title {
51
+ text-align: center;
52
+ margin: 32px 0 20px;
53
+ font-size: 18px;
54
+ font-weight: 600;
55
+ color: var(--vp-c-text-2);
56
+ }
57
+
58
+ .links {
59
+ display: flex;
60
+ flex-wrap: wrap;
61
+ justify-content: center;
62
+ gap: 10px;
63
+ }
64
+
65
+ .link-item {
66
+ display: inline-flex;
67
+ align-items: center;
68
+ gap: 6px;
69
+ padding: 6px 14px;
70
+ border: 1px solid var(--vp-c-divider);
71
+ border-radius: 20px;
72
+ background: var(--vp-c-bg-soft);
73
+ color: var(--vp-c-text-2);
74
+ font-size: 13px;
75
+ font-weight: 500;
76
+ text-decoration: none;
77
+ transition: all 0.2s ease;
78
+ white-space: nowrap;
79
+ }
80
+
81
+ .link-item:hover {
82
+ border-color: var(--vp-c-brand-1);
83
+ color: var(--vp-c-brand-1);
84
+ background: var(--vp-c-brand-soft);
85
+ transform: translateY(-1px);
86
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
87
+ }
88
+
89
+ .link-icon {
90
+ width: 18px;
91
+ height: 18px;
92
+ object-fit: contain;
93
+ border-radius: 3px;
94
+ flex-shrink: 0;
95
+ }
96
+ </style>
@@ -0,0 +1,250 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import { useTeam } from '../composables/team'
4
+ import { useData } from 'vitepress'
5
+
6
+ const { data } = useTeam()
7
+ const { lang } = useData()
8
+
9
+ const members = computed(() => {
10
+ return lang.value === 'en-US' ? [] : data.value.length ? data.value : []
11
+ })
12
+
13
+ const tagVariants = ['theme-primary', 'theme-success', 'theme-warning', 'theme-danger', 'theme-pink', 'theme-cyan', 'theme-purple', 'theme-volcano']
14
+
15
+ const hashString = (text: string) => {
16
+ let hash = 0
17
+ for (let i = 0; i < text.length; i++) {
18
+ hash = (hash << 5) - hash + text.charCodeAt(i)
19
+ hash |= 0
20
+ }
21
+ return Math.abs(hash)
22
+ }
23
+
24
+ const getTagClass = (memberName: string, tag: string, index: number) => {
25
+ const variantIndex = hashString(`${memberName}-${tag}-${index}`) % tagVariants.length
26
+ return `status-tag ${tagVariants[variantIndex]}`
27
+ }
28
+ </script>
29
+
30
+ <template>
31
+ <div v-if="members && members.length" class="VPTeam">
32
+ <div class="container">
33
+ <h1 class="team-title">团队成员</h1>
34
+ <div class="items">
35
+ <div v-for="member in members" :key="member.name" class="item grid-3">
36
+ <div class="VPFeature">
37
+ <article class="box">
38
+ <img :src="member.avatar" :alt="member.name" class="avatar" />
39
+ <h2 class="title">{{ member.name }}</h2>
40
+ <p class="subtitle">{{ member.title }}</p>
41
+ <div v-if="member.tags && member.tags.length" class="tags">
42
+ <span v-for="(tag, index) in member.tags" :key="`${member.name}-${tag}-${index}`" :class="getTagClass(member.name, tag, index)">
43
+ {{ tag }}
44
+ </span>
45
+ </div>
46
+ <p v-if="member.desc" class="details">{{ member.desc }}</p>
47
+ <div class="socials">
48
+ <a v-if="member.github" :href="member.github" target="_blank" rel="noopener noreferrer" class="social-link" aria-label="GitHub">
49
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor">
50
+ <path
51
+ d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.008-.866-.013-1.7-2.782.604-3.369-1.34-3.369-1.34-.454-1.155-1.11-1.463-1.11-1.463-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.831.092-.646.35-1.086.636-1.336-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0 1 12 6.836a9.59 9.59 0 0 1 2.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.202 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.743 0 .267.18.578.688.48C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z"
52
+ />
53
+ </svg>
54
+ </a>
55
+ </div>
56
+ </article>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </div>
62
+ </template>
63
+
64
+ <style scoped>
65
+ .VPTeam {
66
+ position: relative;
67
+ padding: 0 24px;
68
+ }
69
+
70
+ @media (min-width: 640px) {
71
+ .VPTeam {
72
+ padding: 0 48px;
73
+ }
74
+ }
75
+
76
+ @media (min-width: 960px) {
77
+ .VPTeam {
78
+ padding: 0 64px;
79
+ }
80
+ }
81
+
82
+ .container {
83
+ margin: 0 auto;
84
+ max-width: 1152px;
85
+ }
86
+
87
+ .team-title {
88
+ text-align: center;
89
+ margin-bottom: 50px;
90
+ margin-top: 50px;
91
+ font-size: 24px;
92
+ }
93
+
94
+ /* 与 HomeCases 完全相同的网格体系 */
95
+ .items {
96
+ display: flex;
97
+ flex-wrap: wrap;
98
+ margin: -8px;
99
+ }
100
+
101
+ .item {
102
+ padding: 8px;
103
+ width: 100%;
104
+ }
105
+
106
+ @media (min-width: 640px) {
107
+ .item.grid-3 {
108
+ width: calc(100% / 2);
109
+ }
110
+ }
111
+
112
+ @media (min-width: 768px) {
113
+ .item.grid-3 {
114
+ width: calc(100% / 3);
115
+ }
116
+ }
117
+
118
+ /* 与 VPFeature 完全相同的卡片样式 */
119
+ .VPFeature {
120
+ display: block;
121
+ border: 1px solid var(--vp-c-bg-soft);
122
+ border-radius: 12px;
123
+ height: 100%;
124
+ background-color: var(--vp-c-bg-soft);
125
+ transition: border-color 0.25s, background-color 0.25s;
126
+ }
127
+
128
+ .VPFeature:hover {
129
+ border-color: var(--vp-c-brand-1);
130
+ }
131
+
132
+ .box {
133
+ display: flex;
134
+ flex-direction: column;
135
+ align-items: center;
136
+ padding: 24px;
137
+ height: 100%;
138
+ text-align: center;
139
+ }
140
+
141
+ .avatar {
142
+ width: 72px;
143
+ height: 72px;
144
+ border-radius: 50%;
145
+ object-fit: cover;
146
+ margin-bottom: 20px;
147
+ }
148
+
149
+ .title {
150
+ line-height: 24px;
151
+ font-size: 16px;
152
+ font-weight: 600;
153
+ margin: 0 0 4px;
154
+ }
155
+
156
+ .subtitle {
157
+ font-size: 13px;
158
+ font-weight: 500;
159
+ color: var(--vp-c-text-2);
160
+ margin: 0 0 8px;
161
+ }
162
+
163
+ .tags {
164
+ display: flex;
165
+ flex-wrap: wrap;
166
+ justify-content: center;
167
+ gap: 6px;
168
+ margin: 0 0 12px;
169
+ }
170
+
171
+ .status-tag {
172
+ display: inline-flex;
173
+ align-items: center;
174
+ justify-content: center;
175
+ padding: 2px 10px;
176
+ border-radius: 4px;
177
+ font-size: 12px;
178
+ line-height: 18px;
179
+ font-weight: 500;
180
+ border: 1px solid transparent;
181
+ }
182
+
183
+ .theme-primary {
184
+ color: #4d80f0;
185
+ background: #eaf1fa;
186
+ }
187
+
188
+ .theme-success {
189
+ color: #34d19d;
190
+ background: #e1f7f0;
191
+ }
192
+
193
+ .theme-warning {
194
+ color: #f0883a;
195
+ background: #fdf2eb;
196
+ }
197
+
198
+ .theme-danger {
199
+ color: #fa4350;
200
+ background: #fee9e7;
201
+ }
202
+
203
+ .theme-pink {
204
+ color: #e44386;
205
+ background: #fcecf3;
206
+ }
207
+
208
+ .theme-cyan {
209
+ color: #1a9fb8;
210
+ background: #e4f5f8;
211
+ }
212
+
213
+ .theme-purple {
214
+ color: #8c5ff2;
215
+ background: #f1ecfe;
216
+ }
217
+
218
+ .theme-volcano {
219
+ color: #e5603a;
220
+ background: #fceeea;
221
+ }
222
+
223
+ .details {
224
+ flex-grow: 1;
225
+ padding-top: 4px;
226
+ line-height: 24px;
227
+ font-size: 14px;
228
+ font-weight: 500;
229
+ color: var(--vp-c-text-2);
230
+ margin: 0 0 16px;
231
+ }
232
+
233
+ .socials {
234
+ display: flex;
235
+ gap: 12px;
236
+ margin-top: auto;
237
+ }
238
+
239
+ .social-link {
240
+ display: flex;
241
+ align-items: center;
242
+ justify-content: center;
243
+ color: var(--vp-c-text-3);
244
+ transition: color 0.2s ease;
245
+ }
246
+
247
+ .social-link:hover {
248
+ color: var(--vp-c-brand-1);
249
+ }
250
+ </style>
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <div @mouseenter="showQRCode = true" @mouseleave="showQRCode = false">
3
+ <el-tooltip
4
+ placement="bottom"
5
+ effect="light"
6
+ :visible="showQRCode"
7
+ :popper-options="{ modifiers: [{ name: 'offset', options: { offset: [0, 20] } }] }"
8
+ >
9
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
10
+ <path
11
+ fill="currentColor"
12
+ d="M2 2h9v9H2zm2 2v5h5V4zm9-2h9v9h-9zm2 2v5h5V4zM5.5 5.5h2.004v2.004H5.5zm11 0h2.004v2.004H16.5zm-3.504 7.496H15V15h-2.004zm7 0H22V15h-2.004zM2 13h9v9H2zm2 2v5h5v-5zm11.996.996H18v2h2v2h2V22h-2.004v-2h-2v-2h-2zM5.5 16.5h2.004v2.004H5.5zm7.496 3.496H15V22h-2.004z"
13
+ ></path>
14
+ </svg>
15
+ <template #content>
16
+ <div class="qr-code">
17
+ <img :src="src" alt="二维码" />
18
+ </div>
19
+ </template>
20
+ </el-tooltip>
21
+ </div>
22
+ </template>
23
+
24
+ <script lang="ts" setup>
25
+ import { ref } from 'vue'
26
+ import { ElTooltip } from 'element-plus'
27
+ interface Props {
28
+ /** 二维码资源 */
29
+ src: string
30
+ }
31
+
32
+ const props = withDefaults(defineProps<Props>(), {
33
+ src: ''
34
+ })
35
+
36
+ const showQRCode = ref(false)
37
+ </script>
38
+
39
+ <style scoped>
40
+ .qr-code {
41
+ width: 130px; /* 设置二维码的宽度 */
42
+ height: auto; /* 高度自适应 */
43
+ transition: opacity 0.3s ease; /* 添加过渡效果 */
44
+ }
45
+ </style>
@@ -0,0 +1,86 @@
1
+ <script lang="ts" setup>
2
+ import { ElImageViewer } from 'element-plus'
3
+ import { ref } from 'vue'
4
+ import { useAds } from '../composables/adsData'
5
+
6
+ const { data } = useAds()
7
+
8
+ const showViewer = ref(false)
9
+ const previewUrl = ref('')
10
+
11
+ const handleClick = (ad: any) => {
12
+ if (ad.link) {
13
+ window.open(ad.link, '_blank')
14
+ } else if (ad.image) {
15
+ previewUrl.value = ad.image
16
+ showViewer.value = true
17
+ }
18
+ }
19
+ </script>
20
+
21
+ <template>
22
+ <div class="sidebar-ad-container" v-if="data && data.length">
23
+ <slot name="sidebar-ad-content">
24
+ <!-- 默认广告内容 -->
25
+ <div class="sidebar-ad-list">
26
+ <div v-for="(ad, index) in data" :key="index" class="sidebar-ad-item">
27
+ <div class="sidebar-ad-link" @click="handleClick(ad)">
28
+ <img :src="ad.image" :alt="ad.title" class="sidebar-ad-img" />
29
+ </div>
30
+ </div>
31
+ </div>
32
+ </slot>
33
+ <el-image-viewer v-if="showViewer" :url-list="[previewUrl]" @close="showViewer = false" hide-on-click-modal teleported />
34
+ </div>
35
+ </template>
36
+
37
+ <style scoped>
38
+ .sidebar-ad-container {
39
+ margin: 6px 0;
40
+ padding: 6px;
41
+ border-radius: 6px;
42
+ background-color: var(--vp-c-bg-soft);
43
+ box-sizing: border-box;
44
+ width: calc(100% - 6px);
45
+ margin-left: 3px;
46
+ margin-right: 3px;
47
+ }
48
+
49
+ .sidebar-ad-list {
50
+ display: flex;
51
+ flex-direction: column;
52
+ gap: 6px;
53
+ }
54
+
55
+ .sidebar-ad-item {
56
+ width: 100%;
57
+ }
58
+
59
+ .sidebar-ad-link {
60
+ display: flex;
61
+ flex-direction: column;
62
+ align-items: center;
63
+ text-decoration: none;
64
+ color: var(--vp-c-text-1);
65
+ cursor: pointer;
66
+ }
67
+
68
+ .sidebar-ad-img {
69
+ width: 100%;
70
+ height: auto;
71
+ max-height: 120px;
72
+ border-radius: 8px;
73
+ object-fit: cover;
74
+ transition: transform 0.3s ease;
75
+ }
76
+
77
+ .sidebar-ad-img:hover {
78
+ transform: translateY(-2px);
79
+ }
80
+
81
+ .sidebar-ad-title {
82
+ margin-top: 4px;
83
+ font-size: 14px;
84
+ text-align: center;
85
+ }
86
+ </style>
@@ -0,0 +1,115 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import { useAdSponsor } from '../composables/adSponsor'
4
+
5
+ interface Props {
6
+ title?: string
7
+ }
8
+
9
+ withDefaults(defineProps<Props>(), {
10
+ title: '铂金赞助商'
11
+ })
12
+
13
+ const { data } = useAdSponsor()
14
+
15
+ // 获取第一个铂金赞助商
16
+ const platinumSponsor = computed(() => {
17
+ const platinum = data.value?.find((sponsor) => sponsor.tier === 'Platinum')
18
+ return platinum?.items?.[0] || null
19
+ })
20
+ </script>
21
+
22
+ <template>
23
+ <section v-if="platinumSponsor" class="special-sponsor">
24
+ <h3>{{ title }}</h3>
25
+ <div class="special-sponsor-container">
26
+ <a class="logo" :href="platinumSponsor.url" target="_blank" rel="sponsored noopener">
27
+ <picture>
28
+ <img :src="platinumSponsor.img" :alt="platinumSponsor.name" style="height: 72px" />
29
+ </picture>
30
+ </a>
31
+ <span>{{ platinumSponsor.name }}</span>
32
+ </div>
33
+ </section>
34
+ </template>
35
+
36
+ <style scoped>
37
+ .special-sponsor {
38
+ border-top: 1px solid var(--vp-c-gray-soft);
39
+ border-bottom: 1px solid var(--vp-c-gray-soft);
40
+ padding: 12px 24px;
41
+ display: flex;
42
+ justify-content: center;
43
+ align-items: center;
44
+ margin-bottom: 64px;
45
+ }
46
+
47
+ .special-sponsor h3 {
48
+ text-align: center;
49
+ font-size: 13px;
50
+ font-weight: 500;
51
+ }
52
+
53
+ .special-sponsor-container {
54
+ display: flex;
55
+ justify-content: center;
56
+ align-items: center;
57
+ }
58
+
59
+ .special-sponsor .logo {
60
+ display: flex;
61
+ justify-content: center;
62
+ padding: 0 20px;
63
+ }
64
+
65
+ .special-sponsor span {
66
+ color: var(--vp-c-text-2);
67
+ font-weight: 500;
68
+ font-size: 13px;
69
+ vertical-align: middle;
70
+ flex: 1;
71
+ }
72
+
73
+ .special-sponsor a {
74
+ display: flex;
75
+ justify-content: center;
76
+ padding: 0 24px;
77
+ }
78
+
79
+ .special-sponsor-empty {
80
+ border-top: 1px solid var(--vp-c-gray-soft);
81
+ border-bottom: 1px solid var(--vp-c-gray-soft);
82
+ padding: 12px 24px;
83
+ display: flex;
84
+ justify-content: center;
85
+ align-items: center;
86
+ margin-bottom: 64px;
87
+ }
88
+
89
+ .special-sponsor-empty span:first-child {
90
+ text-align: right;
91
+ }
92
+
93
+ .special-sponsor-empty img {
94
+ height: 42px;
95
+ margin: -6px 0;
96
+ }
97
+
98
+ .dark .special-sponsor-empty img {
99
+ filter: grayscale(1) invert(1);
100
+ }
101
+
102
+ @media (max-width: 576px) {
103
+ .special-sponsor-empty {
104
+ flex-direction: column;
105
+ height: auto;
106
+ }
107
+ .special-sponsor-empty img {
108
+ height: 36px;
109
+ margin: 8px 0;
110
+ }
111
+ .special-sponsor-empty span {
112
+ text-align: center !important;
113
+ }
114
+ }
115
+ </style>
@@ -0,0 +1,22 @@
1
+ <script setup lang="ts">
2
+ defineProps<{ svg: string }>()
3
+ </script>
4
+
5
+ <template>
6
+ <figure class="svg-image-root" v-html="svg" />
7
+ </template>
8
+
9
+ <style>
10
+ .svg-image-root {
11
+ background-color: var(--vp-c-bg-soft);
12
+ border-radius: 8px;
13
+ padding: 1ch;
14
+ margin: 1ch 0;
15
+ }
16
+ html.dark .svg-image-root {
17
+ background-color: var(--vp-c-bg-soft);
18
+ }
19
+ .svg-image-root svg text {
20
+ font-family: var(--vp-font-family-base);
21
+ }
22
+ </style>
@@ -0,0 +1,92 @@
1
+ <script setup lang="ts">
2
+ import { useData } from 'vitepress'
3
+ import NotFound from 'vitepress/dist/client/theme-default//NotFound.vue'
4
+ import VPDoc from './VPDoc.vue'
5
+ import VPHome from 'vitepress/dist/client/theme-default/components/VPHome.vue'
6
+ import VPPage from 'vitepress/dist/client/theme-default/components/VPPage.vue'
7
+ import { useLayout } from 'vitepress/theme'
8
+
9
+ const { page, frontmatter }: any = useData()
10
+ const { hasSidebar } = useLayout()
11
+ </script>
12
+
13
+ <template>
14
+ <div
15
+ class="VPContent"
16
+ id="VPContent"
17
+ :class="{
18
+ 'has-sidebar': hasSidebar,
19
+ 'is-home': frontmatter.layout === 'home'
20
+ }"
21
+ >
22
+ <slot name="not-found" v-if="page.isNotFound"><NotFound /></slot>
23
+
24
+ <VPPage v-else-if="frontmatter.layout === 'page'">
25
+ <template #page-top><slot name="page-top" /></template>
26
+ <template #page-bottom><slot name="page-bottom" /></template>
27
+ </VPPage>
28
+
29
+ <VPHome v-else-if="frontmatter.layout === 'home'">
30
+ <template #home-hero-before><slot name="home-hero-before" /></template>
31
+ <template #home-hero-info-before><slot name="home-hero-info-before" /></template>
32
+ <template #home-hero-info><slot name="home-hero-info" /></template>
33
+ <template #home-hero-info-after><slot name="home-hero-info-after" /></template>
34
+ <template #home-hero-actions-after><slot name="home-hero-actions-after" /></template>
35
+ <template #home-hero-image><slot name="home-hero-image" /></template>
36
+ <template #home-hero-after><slot name="home-hero-after" /></template>
37
+ <template #home-features-before><slot name="home-features-before" /></template>
38
+ <template #home-features-after><slot name="home-features-after" /></template>
39
+ </VPHome>
40
+
41
+ <component v-else-if="frontmatter.layout && frontmatter.layout !== 'doc'" :is="frontmatter.layout" />
42
+
43
+ <VPDoc v-else>
44
+ <template #doc-top><slot name="doc-top" /></template>
45
+ <template #doc-bottom><slot name="doc-bottom" /></template>
46
+
47
+ <template #doc-footer-before><slot name="doc-footer-before" /></template>
48
+ <template #doc-before><slot name="doc-before" /></template>
49
+ <template #doc-after><slot name="doc-after" /></template>
50
+
51
+ <template #aside-top><slot name="aside-top" /></template>
52
+ <template #aside-outline-before><slot name="aside-outline-before" /></template>
53
+ <template #aside-outline-after><slot name="aside-outline-after" /></template>
54
+ <template #aside-ads-before><slot name="aside-ads-before" /></template>
55
+ <template #aside-ads-after><slot name="aside-ads-after" /></template>
56
+ <template #aside-bottom><slot name="aside-bottom" /></template>
57
+ </VPDoc>
58
+ </div>
59
+ </template>
60
+
61
+ <style scoped>
62
+ .VPContent {
63
+ flex-grow: 1;
64
+ flex-shrink: 0;
65
+ margin: var(--vp-layout-top-height, 0px) auto 0;
66
+ width: 100%;
67
+ }
68
+
69
+ .VPContent.is-home {
70
+ width: 100%;
71
+ max-width: 100%;
72
+ }
73
+
74
+ .VPContent.has-sidebar {
75
+ margin: 0;
76
+ }
77
+
78
+ .VPNavBar.container {
79
+ max-width: none;
80
+ }
81
+
82
+ @media (min-width: 960px) {
83
+ .VPContent {
84
+ padding-top: var(--vp-nav-height);
85
+ }
86
+
87
+ .VPContent.has-sidebar {
88
+ margin: var(--vp-layout-top-height, 0px) 0 0;
89
+ padding-left: var(--vp-sidebar-width);
90
+ }
91
+ }
92
+ </style>