@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.
- package/README.md +153 -0
- package/dist/config.js +118 -0
- package/dist/index.js +68 -0
- package/dist/locales/md-component-links.js +15 -0
- package/dist/plugins/md-component-links.js +34 -0
- package/dist/plugins/md-scss-vars.js +73 -0
- package/dist/plugins/md-version-badge.js +51 -0
- package/dist/plugins/virtual-version-data.js +83 -0
- package/dist/src/config.d.ts +3 -0
- package/dist/src/index.d.ts +21 -0
- package/dist/src/locales/md-component-links.d.ts +13 -0
- package/dist/src/plugins/md-component-links.d.ts +3 -0
- package/dist/src/plugins/md-scss-vars.d.ts +3 -0
- package/dist/src/plugins/md-version-badge.d.ts +6 -0
- package/dist/src/plugins/virtual-version-data.d.ts +3 -0
- package/dist/src/theme/composables/adSponsor.d.ts +30 -0
- package/dist/src/theme/composables/adsData.d.ts +16 -0
- package/dist/src/theme/composables/banner.d.ts +16 -0
- package/dist/src/theme/composables/cases.d.ts +16 -0
- package/dist/src/theme/composables/friendly.d.ts +19 -0
- package/dist/src/theme/composables/sponsor.d.ts +3 -0
- package/dist/src/theme/composables/team.d.ts +28 -0
- package/dist/src/theme/options.d.ts +3 -0
- package/dist/src/types.d.ts +86 -0
- package/dist/theme/Layout.vue +45 -0
- package/dist/theme/components/AsideSponsors.vue +105 -0
- package/dist/theme/components/Banner.vue +377 -0
- package/dist/theme/components/CustomFooter.vue +123 -0
- package/dist/theme/components/ExternalLink.vue +36 -0
- package/dist/theme/components/HomeCases.vue +122 -0
- package/dist/theme/components/HomeFriendly.vue +96 -0
- package/dist/theme/components/HomeTeam.vue +250 -0
- package/dist/theme/components/QrCode.vue +45 -0
- package/dist/theme/components/SidebarAds.vue +86 -0
- package/dist/theme/components/SpecialSponsor.vue +115 -0
- package/dist/theme/components/SvgImage.vue +22 -0
- package/dist/theme/components/VPContent.vue +92 -0
- package/dist/theme/components/VPDoc.vue +222 -0
- package/dist/theme/components/VPFeature.vue +150 -0
- package/dist/theme/components/VPIframe.vue +445 -0
- package/dist/theme/components/VPLocalNav.vue +151 -0
- package/dist/theme/components/VPNavBar.vue +253 -0
- package/dist/theme/components/VPSidebar.vue +120 -0
- package/dist/theme/components/VPSidebarItem.vue +271 -0
- package/dist/theme/components/WwAds.vue +74 -0
- package/dist/theme/composables/adSponsor.js +29 -0
- package/dist/theme/composables/adsData.js +35 -0
- package/dist/theme/composables/banner.js +35 -0
- package/dist/theme/composables/cases.js +43 -0
- package/dist/theme/composables/friendly.js +35 -0
- package/dist/theme/composables/sponsor.js +35 -0
- package/dist/theme/composables/team.js +48 -0
- package/dist/theme/options.js +4 -0
- package/dist/theme/styles/custom.css +206 -0
- package/dist/theme/styles/vars.css +136 -0
- package/dist/types.js +0 -0
- package/package.json +41 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useRoute } from 'vitepress'
|
|
3
|
+
import { computed, ref, inject } from 'vue'
|
|
4
|
+
import VPDocAside from 'vitepress/dist/client/theme-default/components/VPDocAside.vue'
|
|
5
|
+
import VPDocFooter from 'vitepress/dist/client/theme-default/components/VPDocFooter.vue'
|
|
6
|
+
import { useData } from 'vitepress'
|
|
7
|
+
import { useLayout } from 'vitepress/theme'
|
|
8
|
+
import VPIframe from './VPIframe.vue'
|
|
9
|
+
import { wotThemeOptionsKey } from '../options.js'
|
|
10
|
+
|
|
11
|
+
const { theme }: any = useData()
|
|
12
|
+
|
|
13
|
+
const route = useRoute()
|
|
14
|
+
const { hasSidebar, hasAside, leftAside } = useLayout()
|
|
15
|
+
const themeOptions = inject(wotThemeOptionsKey)
|
|
16
|
+
const demoIframeOptions = themeOptions?.demoIframe
|
|
17
|
+
|
|
18
|
+
const pageName = computed(() => route.path.replace(/[./]+/g, '_').replace(/_html$/, ''))
|
|
19
|
+
const isComponent = computed(
|
|
20
|
+
() =>
|
|
21
|
+
(route.path.startsWith('/component') || route.path.startsWith('/en-US/component')) && !route.path.includes('/use-') && demoIframeOptions !== false
|
|
22
|
+
)
|
|
23
|
+
const expanded = ref(true)
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<div class="VPDoc" :class="{ 'has-sidebar': hasSidebar, 'has-aside': hasAside, 'is-component': isComponent, 'is-expanded': expanded }">
|
|
28
|
+
<slot name="doc-top" />
|
|
29
|
+
<div class="container">
|
|
30
|
+
<div v-if="hasAside" class="aside" :class="{ 'left-aside': leftAside }">
|
|
31
|
+
<div class="aside-curtain" />
|
|
32
|
+
<div class="aside-container">
|
|
33
|
+
<div class="aside-content">
|
|
34
|
+
<VPDocAside>
|
|
35
|
+
<template #aside-top>
|
|
36
|
+
<slot name="aside-top" />
|
|
37
|
+
</template>
|
|
38
|
+
<template #aside-bottom>
|
|
39
|
+
<slot name="aside-bottom" />
|
|
40
|
+
</template>
|
|
41
|
+
<template #aside-outline-before>
|
|
42
|
+
<slot name="aside-outline-before" />
|
|
43
|
+
</template>
|
|
44
|
+
<template #aside-outline-after>
|
|
45
|
+
<slot name="aside-outline-after" />
|
|
46
|
+
</template>
|
|
47
|
+
<template #aside-ads-before>
|
|
48
|
+
<slot name="aside-ads-before" />
|
|
49
|
+
</template>
|
|
50
|
+
<template #aside-ads-after>
|
|
51
|
+
<slot name="aside-ads-after" />
|
|
52
|
+
</template>
|
|
53
|
+
</VPDocAside>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<div class="content">
|
|
59
|
+
<div class="content-container">
|
|
60
|
+
<slot name="doc-before" />
|
|
61
|
+
<main class="main">
|
|
62
|
+
<Content class="vp-doc" :class="[pageName, theme.externalLinkIcon && 'external-link-icon-enabled']" />
|
|
63
|
+
<VPIframe v-if="isComponent" v-model:expanded="expanded" />
|
|
64
|
+
</main>
|
|
65
|
+
<VPDocFooter>
|
|
66
|
+
<template #doc-footer-before>
|
|
67
|
+
<slot name="doc-footer-before" />
|
|
68
|
+
</template>
|
|
69
|
+
</VPDocFooter>
|
|
70
|
+
<slot name="doc-after" />
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
<slot name="doc-bottom" />
|
|
75
|
+
</div>
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<style scoped>
|
|
79
|
+
.VPDoc {
|
|
80
|
+
padding: 32px 24px 96px;
|
|
81
|
+
width: 100%;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@media (min-width: 768px) {
|
|
85
|
+
.VPDoc {
|
|
86
|
+
padding: 48px 32px 128px;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@media (min-width: 960px) {
|
|
91
|
+
.VPDoc {
|
|
92
|
+
padding: 48px 32px 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.VPDoc:not(.has-sidebar) .container {
|
|
96
|
+
display: flex;
|
|
97
|
+
justify-content: center;
|
|
98
|
+
max-width: 992px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.VPDoc:not(.has-sidebar) .content {
|
|
102
|
+
max-width: 752px;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@media (min-width: 1280px) {
|
|
107
|
+
.VPDoc .container {
|
|
108
|
+
display: flex;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.VPDoc .aside {
|
|
113
|
+
display: block;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@media (min-width: 1440px) {
|
|
118
|
+
.VPDoc:not(.has-sidebar) .content {
|
|
119
|
+
max-width: 784px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.VPDoc:not(.has-sidebar) .container {
|
|
123
|
+
max-width: 1104px;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.container {
|
|
128
|
+
margin: 0 auto;
|
|
129
|
+
width: 100%;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.aside {
|
|
133
|
+
position: relative;
|
|
134
|
+
display: none;
|
|
135
|
+
order: 2;
|
|
136
|
+
flex-grow: 1;
|
|
137
|
+
padding-left: 32px;
|
|
138
|
+
width: 100%;
|
|
139
|
+
max-width: 256px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.left-aside {
|
|
143
|
+
order: 1;
|
|
144
|
+
padding-left: unset;
|
|
145
|
+
padding-right: 32px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.aside-container {
|
|
149
|
+
position: fixed;
|
|
150
|
+
top: 0;
|
|
151
|
+
padding-top: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + var(--vp-doc-top-height, 0px) + 48px);
|
|
152
|
+
width: 224px;
|
|
153
|
+
height: 100vh;
|
|
154
|
+
overflow-x: hidden;
|
|
155
|
+
overflow-y: auto;
|
|
156
|
+
scrollbar-width: none;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.aside-container::-webkit-scrollbar {
|
|
160
|
+
display: none;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.aside-curtain {
|
|
164
|
+
position: fixed;
|
|
165
|
+
bottom: 0;
|
|
166
|
+
z-index: 10;
|
|
167
|
+
width: 224px;
|
|
168
|
+
height: 32px;
|
|
169
|
+
background: linear-gradient(transparent, var(--vp-c-bg) 70%);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.aside-content {
|
|
173
|
+
display: flex;
|
|
174
|
+
flex-direction: column;
|
|
175
|
+
min-height: calc(100vh - (var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 48px));
|
|
176
|
+
padding-bottom: 32px;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.content {
|
|
180
|
+
position: relative;
|
|
181
|
+
margin: 0 auto;
|
|
182
|
+
width: 100%;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
@media (min-width: 960px) {
|
|
186
|
+
.content {
|
|
187
|
+
padding: 0 32px 128px;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
@media (min-width: 1280px) {
|
|
192
|
+
.content {
|
|
193
|
+
order: 1;
|
|
194
|
+
margin: 0;
|
|
195
|
+
min-width: 600px;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
@media (min-width: 1280px) {
|
|
200
|
+
.VPDoc.is-component.is-expanded .container {
|
|
201
|
+
padding-right: 358px;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.VPDoc.is-component:not(.is-expanded) .container {
|
|
205
|
+
padding-right: 48px;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
@media (min-width: 1440px) {
|
|
210
|
+
.VPDoc.is-component.is-expanded .container {
|
|
211
|
+
padding-right: 424px;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.VPDoc.is-component:not(.is-expanded) .container {
|
|
215
|
+
padding-right: 64px;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.content-container {
|
|
220
|
+
margin: 0 auto;
|
|
221
|
+
}
|
|
222
|
+
</style>
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { DefaultTheme } from 'vitepress/theme'
|
|
3
|
+
import { ref, computed } from 'vue'
|
|
4
|
+
import VPImage from 'vitepress/dist/client/theme-default/components/VPImage.vue'
|
|
5
|
+
import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue'
|
|
6
|
+
import { ElImageViewer } from 'element-plus'
|
|
7
|
+
import { useData } from 'vitepress'
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
icon?: DefaultTheme.FeatureIcon
|
|
11
|
+
title: string
|
|
12
|
+
details?: string
|
|
13
|
+
link?: string
|
|
14
|
+
linkText?: string
|
|
15
|
+
rel?: string
|
|
16
|
+
target?: string
|
|
17
|
+
imagePreview?: boolean
|
|
18
|
+
}>()
|
|
19
|
+
|
|
20
|
+
const { isDark } = useData()
|
|
21
|
+
|
|
22
|
+
const showViewer = ref(false)
|
|
23
|
+
const currentImageUrl = ref('')
|
|
24
|
+
|
|
25
|
+
const getImageSrc = computed(() => {
|
|
26
|
+
if (!props.icon || typeof props.icon !== 'object') return ''
|
|
27
|
+
|
|
28
|
+
if ('src' in props.icon) {
|
|
29
|
+
return props.icon.src
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if ('light' in props.icon && 'dark' in props.icon) {
|
|
33
|
+
return isDark.value ? props.icon.dark : props.icon.light
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return ''
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const handleImageClick = (event: Event) => {
|
|
40
|
+
if (props.imagePreview && getImageSrc.value) {
|
|
41
|
+
event.preventDefault()
|
|
42
|
+
event.stopPropagation()
|
|
43
|
+
currentImageUrl.value = getImageSrc.value
|
|
44
|
+
showViewer.value = true
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const handleCloseViewer = () => {
|
|
49
|
+
showViewer.value = false
|
|
50
|
+
}
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<template>
|
|
54
|
+
<VPLink class="VPFeature" :href="link" :rel="rel" :target="target" :no-icon="true" :tag="link ? 'a' : 'div'">
|
|
55
|
+
<article class="box">
|
|
56
|
+
<div v-if="typeof icon === 'object' && icon.wrap" class="icon">
|
|
57
|
+
<VPImage :image="icon" :alt="icon.alt" :height="icon.height || 48" :width="icon.width || 48" />
|
|
58
|
+
</div>
|
|
59
|
+
<VPImage
|
|
60
|
+
v-else-if="typeof icon === 'object'"
|
|
61
|
+
:image="icon"
|
|
62
|
+
:alt="icon.alt"
|
|
63
|
+
:height="icon.height || 48"
|
|
64
|
+
:width="icon.width || 48"
|
|
65
|
+
@click="handleImageClick"
|
|
66
|
+
/>
|
|
67
|
+
<div v-else-if="icon" class="icon" v-html="icon"></div>
|
|
68
|
+
<h2 class="title" v-html="title"></h2>
|
|
69
|
+
<p v-if="details" class="details" v-html="details"></p>
|
|
70
|
+
|
|
71
|
+
<div v-if="linkText" class="link-text">
|
|
72
|
+
<p class="link-text-value">
|
|
73
|
+
{{ linkText }}
|
|
74
|
+
<span class="vpi-arrow-right link-text-icon" />
|
|
75
|
+
</p>
|
|
76
|
+
</div>
|
|
77
|
+
</article>
|
|
78
|
+
</VPLink>
|
|
79
|
+
<el-image-viewer v-if="showViewer" :url-list="[currentImageUrl]" :initial-index="0" :close-on-press-escape="true" @close="handleCloseViewer" />
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
<style scoped>
|
|
83
|
+
.VPFeature {
|
|
84
|
+
display: block;
|
|
85
|
+
border: 1px solid var(--vp-c-bg-soft);
|
|
86
|
+
border-radius: 12px;
|
|
87
|
+
height: 100%;
|
|
88
|
+
background-color: var(--vp-c-bg-soft);
|
|
89
|
+
transition: border-color 0.25s, background-color 0.25s;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.VPFeature.link:hover {
|
|
93
|
+
border-color: var(--vp-c-brand-1);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.box {
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
padding: 24px;
|
|
100
|
+
height: 100%;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.box > :deep(.VPImage) {
|
|
104
|
+
margin-bottom: 20px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.icon {
|
|
108
|
+
display: flex;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
align-items: center;
|
|
111
|
+
margin-bottom: 20px;
|
|
112
|
+
border-radius: 6px;
|
|
113
|
+
background-color: var(--vp-c-default-soft);
|
|
114
|
+
width: 48px;
|
|
115
|
+
height: 48px;
|
|
116
|
+
font-size: 24px;
|
|
117
|
+
transition: background-color 0.25s;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.title {
|
|
121
|
+
line-height: 24px;
|
|
122
|
+
font-size: 16px;
|
|
123
|
+
font-weight: 600;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.details {
|
|
127
|
+
flex-grow: 1;
|
|
128
|
+
padding-top: 8px;
|
|
129
|
+
line-height: 24px;
|
|
130
|
+
font-size: 14px;
|
|
131
|
+
font-weight: 500;
|
|
132
|
+
color: var(--vp-c-text-2);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.link-text {
|
|
136
|
+
padding-top: 8px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.link-text-value {
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
font-size: 14px;
|
|
143
|
+
font-weight: 500;
|
|
144
|
+
color: var(--vp-c-brand-1);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.link-text-icon {
|
|
148
|
+
margin-left: 6px;
|
|
149
|
+
}
|
|
150
|
+
</style>
|