@sugarat/theme 0.5.11 → 0.5.12-beta.1
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/node.d.ts +2 -4
- package/node.js +206 -156
- package/node.mjs +205 -154
- package/package.json +10 -15
- package/src/components/Alert.vue +269 -0
- package/src/components/Avatar.vue +65 -0
- package/src/components/BlogAlert.vue +8 -8
- package/src/components/BlogApp.vue +5 -8
- package/src/components/BlogArticleAnalyze.vue +99 -66
- package/src/components/BlogAuthor.vue +13 -15
- package/src/components/BlogBackToTop.vue +21 -24
- package/src/components/BlogButtonAfterArticle.vue +12 -15
- package/src/components/BlogCommentWrapper.vue +34 -41
- package/src/components/BlogDocCover.vue +1 -1
- package/src/components/BlogFooter.vue +26 -32
- package/src/components/BlogFriendLink.vue +91 -73
- package/src/components/BlogHomeBanner.vue +25 -31
- package/src/components/BlogHomeHeaderAvatar.vue +16 -23
- package/src/components/BlogHomeInfo.vue +2 -4
- package/src/components/BlogHomeOverview.vue +12 -15
- package/src/components/BlogHomeTags.vue +22 -31
- package/src/components/BlogHotArticle.vue +69 -80
- package/src/components/BlogImagePreview.vue +3 -3
- package/src/components/BlogItem.vue +14 -23
- package/src/components/BlogList.vue +15 -19
- package/src/components/BlogRecommendArticle.vue +56 -72
- package/src/components/BlogSidebar.vue +1 -1
- package/src/components/Button.vue +150 -0
- package/src/components/Carousel.vue +249 -0
- package/src/components/CarouselItem.vue +139 -0
- package/src/components/CommentArtalk.vue +1 -1
- package/src/components/Image.vue +33 -0
- package/src/components/ImageViewer.vue +407 -0
- package/src/components/Pagination.vue +369 -0
- package/src/components/Tag.vue +144 -0
- package/src/components/UserWorks.vue +132 -175
- package/src/composables/config/blog.ts +6 -1
- package/src/composables/config/index.ts +2 -2
- package/src/index.ts +12 -19
- package/src/node.ts +0 -3
- package/src/styles/el-base.css +340 -0
- package/src/styles/{index.scss → index.css} +56 -91
- package/src/utils/client/index.ts +17 -0
- package/src/utils/node/mdPlugins.ts +1 -1
- package/src/utils/node/theme.ts +5 -2
- package/src/utils/node/vitePlugins.ts +51 -18
- package/src/styles/scss/algolia.scss +0 -231
- package/src/styles/scss/global.scss +0 -156
- package/src/styles/scss/highlight.scss +0 -12
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
title: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: '',
|
|
8
|
+
},
|
|
9
|
+
type: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: 'info',
|
|
12
|
+
validator: (val: string) => ['success', 'warning', 'info', 'error', 'primary'].includes(val),
|
|
13
|
+
},
|
|
14
|
+
description: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: '',
|
|
17
|
+
},
|
|
18
|
+
closable: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: true,
|
|
21
|
+
},
|
|
22
|
+
center: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false,
|
|
25
|
+
},
|
|
26
|
+
closeText: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: '',
|
|
29
|
+
},
|
|
30
|
+
showIcon: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false,
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const emit = defineEmits(['close'])
|
|
37
|
+
|
|
38
|
+
const visible = ref(true)
|
|
39
|
+
|
|
40
|
+
function close() {
|
|
41
|
+
visible.value = false
|
|
42
|
+
emit('close')
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const typeClass = computed(() => `sugar-alert--${props.type}`)
|
|
46
|
+
const isBigIcon = computed(() => props.description || !!props.title)
|
|
47
|
+
const isBoldTitle = computed(() => props.description || !!props.title)
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<transition name="sugar-alert-fade">
|
|
52
|
+
<div v-show="visible" class="sugar-alert" :class="[typeClass, center ? 'is-center' : '']" role="alert">
|
|
53
|
+
<div v-if="showIcon" class="sugar-alert__icon" :class="[isBigIcon ? 'is-big' : '']">
|
|
54
|
+
<svg
|
|
55
|
+
v-if="type === 'success'" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="1em"
|
|
56
|
+
height="1em"
|
|
57
|
+
>
|
|
58
|
+
<path
|
|
59
|
+
fill="currentColor"
|
|
60
|
+
d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
|
|
61
|
+
/>
|
|
62
|
+
</svg>
|
|
63
|
+
<svg
|
|
64
|
+
v-else-if="type === 'warning'" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="1em"
|
|
65
|
+
height="1em"
|
|
66
|
+
>
|
|
67
|
+
<path
|
|
68
|
+
fill="currentColor"
|
|
69
|
+
d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"
|
|
70
|
+
/>
|
|
71
|
+
</svg>
|
|
72
|
+
<svg
|
|
73
|
+
v-else-if="type === 'error'" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="1em"
|
|
74
|
+
height="1em"
|
|
75
|
+
>
|
|
76
|
+
<path
|
|
77
|
+
fill="currentColor"
|
|
78
|
+
d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"
|
|
79
|
+
/>
|
|
80
|
+
</svg>
|
|
81
|
+
<svg
|
|
82
|
+
v-else-if="type === 'primary'" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="1em"
|
|
83
|
+
height="1em"
|
|
84
|
+
>
|
|
85
|
+
<path
|
|
86
|
+
fill="currentColor"
|
|
87
|
+
d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 832a384 384 0 1 0 0-768 384 384 0 0 0 0 768m48-176a48 48 0 1 1-96 0 48 48 0 0 1 96 0m-48-464a32 32 0 0 1 32 32v288a32 32 0 0 1-64 0V256a32 32 0 0 1 32-32"
|
|
88
|
+
/>
|
|
89
|
+
</svg>
|
|
90
|
+
<svg v-else viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em">
|
|
91
|
+
<path
|
|
92
|
+
fill="currentColor"
|
|
93
|
+
d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 832a384 384 0 1 0 0-768 384 384 0 0 0 0 768m48-176a48 48 0 1 1-96 0 48 48 0 0 1 96 0m-48-464a32 32 0 0 1 32 32v288a32 32 0 0 1-64 0V256a32 32 0 0 1 32-32"
|
|
94
|
+
/>
|
|
95
|
+
</svg>
|
|
96
|
+
</div>
|
|
97
|
+
<div class="sugar-alert__content">
|
|
98
|
+
<span v-if="title || $slots.title" class="sugar-alert__title" :class="[isBoldTitle ? 'is-bold' : '']">
|
|
99
|
+
<slot name="title">{{ title }}</slot>
|
|
100
|
+
</span>
|
|
101
|
+
<p v-if="$slots.default || description" class="sugar-alert__description">
|
|
102
|
+
<slot>
|
|
103
|
+
{{ description }}
|
|
104
|
+
</slot>
|
|
105
|
+
</p>
|
|
106
|
+
<div v-if="closable" class="sugar-alert__close-btn" :class="{ 'is-customed': closeText !== '' }" @click="close">
|
|
107
|
+
<template v-if="closeText">
|
|
108
|
+
{{ closeText }}
|
|
109
|
+
</template>
|
|
110
|
+
<svg v-else viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em">
|
|
111
|
+
<path
|
|
112
|
+
fill="currentColor"
|
|
113
|
+
d="M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
|
|
114
|
+
/>
|
|
115
|
+
</svg>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
</transition>
|
|
120
|
+
</template>
|
|
121
|
+
|
|
122
|
+
<style scoped>
|
|
123
|
+
html.dark .sugar-alert {
|
|
124
|
+
background-color: transparent;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.sugar-alert {
|
|
128
|
+
width: 100%;
|
|
129
|
+
padding: 8px 16px;
|
|
130
|
+
margin: 0;
|
|
131
|
+
box-sizing: border-box;
|
|
132
|
+
border-radius: 4px;
|
|
133
|
+
position: relative;
|
|
134
|
+
background-color: #fff;
|
|
135
|
+
overflow: hidden;
|
|
136
|
+
opacity: 1;
|
|
137
|
+
display: flex;
|
|
138
|
+
align-items: center;
|
|
139
|
+
transition: opacity 0.2s;
|
|
140
|
+
}
|
|
141
|
+
.sugar-alert.is-center {
|
|
142
|
+
justify-content: center;
|
|
143
|
+
}
|
|
144
|
+
.sugar-alert.is-center .sugar-alert__content {
|
|
145
|
+
text-align: center;
|
|
146
|
+
}
|
|
147
|
+
.sugar-alert--success {
|
|
148
|
+
background-color: #f0f9eb;
|
|
149
|
+
color: #67c23a;
|
|
150
|
+
}
|
|
151
|
+
.sugar-alert--success .sugar-alert__description {
|
|
152
|
+
color: #67c23a;
|
|
153
|
+
}
|
|
154
|
+
.sugar-alert--info {
|
|
155
|
+
background-color: #f4f4f5;
|
|
156
|
+
color: #909399;
|
|
157
|
+
}
|
|
158
|
+
.sugar-alert--info .sugar-alert__description {
|
|
159
|
+
color: #909399;
|
|
160
|
+
}
|
|
161
|
+
.sugar-alert--warning {
|
|
162
|
+
background-color: #fdf6ec;
|
|
163
|
+
color: #e6a23c;
|
|
164
|
+
}
|
|
165
|
+
.sugar-alert--warning .sugar-alert__description {
|
|
166
|
+
color: #e6a23c;
|
|
167
|
+
}
|
|
168
|
+
.sugar-alert--error {
|
|
169
|
+
background-color: #fef0f0;
|
|
170
|
+
color: #f56c6c;
|
|
171
|
+
}
|
|
172
|
+
.sugar-alert--error .sugar-alert__description {
|
|
173
|
+
color: #f56c6c;
|
|
174
|
+
}
|
|
175
|
+
.sugar-alert--primary {
|
|
176
|
+
background-color: var(--vp-c-brand-soft);
|
|
177
|
+
color: var(--vp-c-brand-1);
|
|
178
|
+
}
|
|
179
|
+
.sugar-alert--primary .sugar-alert__description {
|
|
180
|
+
color: var(--vp-c-brand-1);
|
|
181
|
+
}
|
|
182
|
+
.sugar-alert__content {
|
|
183
|
+
display: table-cell;
|
|
184
|
+
padding: 0 8px;
|
|
185
|
+
width: 100%;
|
|
186
|
+
}
|
|
187
|
+
.sugar-alert__icon {
|
|
188
|
+
font-size: 16px;
|
|
189
|
+
width: 16px;
|
|
190
|
+
display: table-cell;
|
|
191
|
+
color: inherit;
|
|
192
|
+
vertical-align: middle;
|
|
193
|
+
}
|
|
194
|
+
.sugar-alert__icon.is-big {
|
|
195
|
+
font-size: 28px;
|
|
196
|
+
width: 28px;
|
|
197
|
+
}
|
|
198
|
+
.sugar-alert__title {
|
|
199
|
+
font-size: 13px;
|
|
200
|
+
line-height: 18px;
|
|
201
|
+
vertical-align: text-top;
|
|
202
|
+
}
|
|
203
|
+
.sugar-alert__title.is-bold {
|
|
204
|
+
font-weight: 700;
|
|
205
|
+
}
|
|
206
|
+
.sugar-alert__description {
|
|
207
|
+
font-size: 12px;
|
|
208
|
+
margin: 5px 0 0 0;
|
|
209
|
+
line-height: 1.5;
|
|
210
|
+
}
|
|
211
|
+
.sugar-alert__close-btn {
|
|
212
|
+
font-size: 12px;
|
|
213
|
+
opacity: 1;
|
|
214
|
+
position: absolute;
|
|
215
|
+
top: 12px;
|
|
216
|
+
right: 15px;
|
|
217
|
+
cursor: pointer;
|
|
218
|
+
color: var(--vp-c-text-2);
|
|
219
|
+
}
|
|
220
|
+
.sugar-alert__close-btn.is-customed {
|
|
221
|
+
font-style: normal;
|
|
222
|
+
font-size: 11px;
|
|
223
|
+
line-height: 18px;
|
|
224
|
+
}
|
|
225
|
+
.sugar-alert__close-btn:hover {
|
|
226
|
+
opacity: 0.7;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.sugar-alert-fade-enter-from,
|
|
230
|
+
.sugar-alert-fade-leave-to {
|
|
231
|
+
opacity: 0;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
html.dark .sugar-alert--success {
|
|
235
|
+
background-color: #1c2518;
|
|
236
|
+
color: #67c23a;
|
|
237
|
+
}
|
|
238
|
+
html.dark .sugar-alert--success .sugar-alert__description {
|
|
239
|
+
color: #67c23a;
|
|
240
|
+
}
|
|
241
|
+
html.dark .sugar-alert--info {
|
|
242
|
+
background-color: #202121;
|
|
243
|
+
color: #909399;
|
|
244
|
+
}
|
|
245
|
+
html.dark .sugar-alert--info .sugar-alert__description {
|
|
246
|
+
color: #909399;
|
|
247
|
+
}
|
|
248
|
+
html.dark .sugar-alert--warning {
|
|
249
|
+
background-color: #292218;
|
|
250
|
+
color: #e6a23c;
|
|
251
|
+
}
|
|
252
|
+
html.dark .sugar-alert--warning .sugar-alert__description {
|
|
253
|
+
color: #e6a23c;
|
|
254
|
+
}
|
|
255
|
+
html.dark .sugar-alert--error {
|
|
256
|
+
background-color: #2b1d1d;
|
|
257
|
+
color: #f56c6c;
|
|
258
|
+
}
|
|
259
|
+
html.dark .sugar-alert--error .sugar-alert__description {
|
|
260
|
+
color: #f56c6c;
|
|
261
|
+
}
|
|
262
|
+
html.dark .sugar-alert--primary {
|
|
263
|
+
background-color: var(--vp-c-brand-soft);
|
|
264
|
+
color: var(--vp-c-brand-1);
|
|
265
|
+
}
|
|
266
|
+
html.dark .sugar-alert--primary .sugar-alert__description {
|
|
267
|
+
color: var(--vp-c-brand-1);
|
|
268
|
+
}
|
|
269
|
+
</style>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
src: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: '',
|
|
8
|
+
},
|
|
9
|
+
alt: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: '',
|
|
12
|
+
},
|
|
13
|
+
size: {
|
|
14
|
+
type: Number,
|
|
15
|
+
default: 50,
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const sizeStyle = computed(() => {
|
|
20
|
+
const { size } = props
|
|
21
|
+
return {
|
|
22
|
+
width: `${size}px`,
|
|
23
|
+
height: `${size}px`,
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<span
|
|
30
|
+
class="blog-avatar blog-avatar--circle"
|
|
31
|
+
:style="sizeStyle"
|
|
32
|
+
>
|
|
33
|
+
<img
|
|
34
|
+
v-if="src"
|
|
35
|
+
:src="src"
|
|
36
|
+
:alt="alt"
|
|
37
|
+
>
|
|
38
|
+
</span>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<style scoped>
|
|
42
|
+
.blog-avatar {
|
|
43
|
+
display: inline-flex;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
align-items: center;
|
|
46
|
+
box-sizing: border-box;
|
|
47
|
+
text-align: center;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
color: #fff;
|
|
50
|
+
background: #c0c4cc;
|
|
51
|
+
font-size: 14px;
|
|
52
|
+
vertical-align: middle;
|
|
53
|
+
min-width: 50px;
|
|
54
|
+
}
|
|
55
|
+
.blog-avatar > img {
|
|
56
|
+
display: block;
|
|
57
|
+
height: 100%;
|
|
58
|
+
width: 100%;
|
|
59
|
+
object-fit: cover;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.blog-avatar--circle {
|
|
63
|
+
border-radius: 50%;
|
|
64
|
+
}
|
|
65
|
+
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { ElAlert } from 'element-plus'
|
|
3
2
|
import { onMounted, ref } from 'vue'
|
|
4
3
|
import { useAlertConfig } from '../composables/config/blog'
|
|
4
|
+
import Alert from './Alert.vue'
|
|
5
5
|
|
|
6
6
|
// TODO:拆分插件,对标公告插件
|
|
7
7
|
const alertProps = useAlertConfig()
|
|
@@ -48,7 +48,7 @@ function handleClose() {
|
|
|
48
48
|
|
|
49
49
|
<template>
|
|
50
50
|
<div v-if="show" class="global-alert" data-pagefind-ignore="all">
|
|
51
|
-
<
|
|
51
|
+
<Alert
|
|
52
52
|
:title="alertProps?.title"
|
|
53
53
|
:type="alertProps?.type"
|
|
54
54
|
:show-icon="alertProps?.showIcon"
|
|
@@ -59,11 +59,11 @@ function handleClose() {
|
|
|
59
59
|
@close="handleClose"
|
|
60
60
|
>
|
|
61
61
|
<div v-if="alertProps?.html" v-html="alertProps?.html" />
|
|
62
|
-
</
|
|
62
|
+
</Alert>
|
|
63
63
|
</div>
|
|
64
64
|
</template>
|
|
65
65
|
|
|
66
|
-
<style
|
|
66
|
+
<style scoped>
|
|
67
67
|
.global-alert {
|
|
68
68
|
position: fixed;
|
|
69
69
|
z-index: 999;
|
|
@@ -73,16 +73,16 @@ function handleClose() {
|
|
|
73
73
|
left: 50%;
|
|
74
74
|
transform: translateX(-50%);
|
|
75
75
|
width: auto;
|
|
76
|
-
:deep(.el-alert__content) {
|
|
77
|
-
padding-right: 20px;
|
|
78
|
-
}
|
|
79
76
|
}
|
|
77
|
+
.global-alert :deep(.sugar-alert__content) {
|
|
78
|
+
padding-right: 20px;
|
|
79
|
+
}
|
|
80
|
+
|
|
80
81
|
@media screen and (max-width: 1100px) {
|
|
81
82
|
.global-alert {
|
|
82
83
|
width: 50%;
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
|
-
|
|
86
86
|
@media screen and (max-width: 600px) {
|
|
87
87
|
.global-alert {
|
|
88
88
|
width: 90%;
|
|
@@ -128,6 +128,10 @@ const openTransition = useDarkTransitionConfig()
|
|
|
128
128
|
<!-- content -->
|
|
129
129
|
<template #page-top>
|
|
130
130
|
<slot name="page-top" />
|
|
131
|
+
<ClientOnly>
|
|
132
|
+
<!-- 图片预览 -->
|
|
133
|
+
<BlogImagePreview />
|
|
134
|
+
</ClientOnly>
|
|
131
135
|
</template>
|
|
132
136
|
<template #page-bottom>
|
|
133
137
|
<slot name="page-bottom" />
|
|
@@ -184,7 +188,7 @@ const openTransition = useDarkTransitionConfig()
|
|
|
184
188
|
</Layout>
|
|
185
189
|
</template>
|
|
186
190
|
|
|
187
|
-
<style scoped
|
|
191
|
+
<style scoped>
|
|
188
192
|
.home {
|
|
189
193
|
margin: 0 auto;
|
|
190
194
|
padding: 20px;
|
|
@@ -196,7 +200,6 @@ const openTransition = useDarkTransitionConfig()
|
|
|
196
200
|
padding-top: var(--vp-nav-height);
|
|
197
201
|
}
|
|
198
202
|
}
|
|
199
|
-
|
|
200
203
|
.header-banner {
|
|
201
204
|
width: 100%;
|
|
202
205
|
padding: 60px 0;
|
|
@@ -225,31 +228,25 @@ const openTransition = useDarkTransitionConfig()
|
|
|
225
228
|
top: 40px;
|
|
226
229
|
}
|
|
227
230
|
}
|
|
228
|
-
|
|
229
231
|
@media screen and (max-width: 767px) {
|
|
230
232
|
.content-wrapper {
|
|
231
233
|
flex-wrap: wrap;
|
|
232
234
|
}
|
|
233
|
-
|
|
234
235
|
.blog-info-wrapper {
|
|
235
236
|
margin: 20px 0;
|
|
236
237
|
width: 100%;
|
|
237
238
|
}
|
|
238
|
-
|
|
239
239
|
.normal-mode {
|
|
240
240
|
display: none;
|
|
241
241
|
}
|
|
242
|
-
|
|
243
242
|
.minify-mode {
|
|
244
243
|
display: block;
|
|
245
244
|
}
|
|
246
245
|
}
|
|
247
|
-
|
|
248
246
|
@media screen and (min-width: 768px) {
|
|
249
247
|
.minify-mode {
|
|
250
248
|
display: none;
|
|
251
249
|
}
|
|
252
|
-
|
|
253
250
|
.normal-mode {
|
|
254
251
|
display: block;
|
|
255
252
|
}
|
|
@@ -2,19 +2,50 @@
|
|
|
2
2
|
// 阅读时间计算方式参考
|
|
3
3
|
// https://zhuanlan.zhihu.com/p/36375802
|
|
4
4
|
import { useData } from 'vitepress'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from '@element-plus/icons-vue'
|
|
5
|
+
|
|
6
|
+
// 移除外部依赖,图标内置
|
|
7
|
+
// import { ElIcon } from 'element-plus'
|
|
8
|
+
// import {
|
|
9
|
+
// UserFilled
|
|
10
|
+
// } from '@element-plus/icons-vue'
|
|
11
|
+
|
|
12
|
+
import { computed, defineComponent, h, onMounted, ref } from 'vue'
|
|
14
13
|
import { useAnalyzeTitles, useArticleConfig, useAuthorList, useCurrentArticle, useDocMetaInsertPosition, useDocMetaInsertSelector, useFormatShowDate, useGlobalAuthor } from '../composables/config/blog'
|
|
15
14
|
import countWord, { formatDate } from '../utils/client'
|
|
16
15
|
import BlogDocCover from './BlogDocCover.vue'
|
|
17
16
|
|
|
17
|
+
function createIcon(d: string | string[]) {
|
|
18
|
+
return defineComponent({
|
|
19
|
+
render: () => h('svg', {
|
|
20
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
|
21
|
+
viewBox: '0 0 1024 1024',
|
|
22
|
+
}, [d].flatMap(d => h('path', { fill: 'currentColor', d })))
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const AlarmClock = createIcon(
|
|
27
|
+
[
|
|
28
|
+
'M512 832a320 320 0 1 0 0-640 320 320 0 0 0 0 640m0 64a384 384 0 1 1 0-768 384 384 0 0 1 0 768',
|
|
29
|
+
'm292.288 824.576 55.424 32-48 83.136a32 32 0 1 1-55.424-32zm439.424 0-55.424 32 48 83.136a32 32 0 1 0 55.424-32zM512 512h160a32 32 0 1 1 0 64H480a32 32 0 0 1-32-32V320a32 32 0 0 1 64 0zM90.496 312.256A160 160 0 0 1 312.32 90.496l-46.848 46.848a96 96 0 0 0-128 128L90.56 312.256zm835.264 0A160 160 0 0 0 704 90.496l46.848 46.848a96 96 0 0 1 128 128z'
|
|
30
|
+
]
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
const Clock = createIcon([
|
|
34
|
+
'M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896',
|
|
35
|
+
'M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32',
|
|
36
|
+
'M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32'
|
|
37
|
+
])
|
|
38
|
+
|
|
39
|
+
const CollectionTag = createIcon(
|
|
40
|
+
'M256 128v698.88l196.032-156.864a96 96 0 0 1 119.936 0L768 826.816V128zm-32-64h576a32 32 0 0 1 32 32v797.44a32 32 0 0 1-51.968 24.96L531.968 720a32 32 0 0 0-39.936 0L243.968 918.4A32 32 0 0 1 192 893.44V96a32 32 0 0 1 32-32'
|
|
41
|
+
)
|
|
42
|
+
const EditPen = createIcon(
|
|
43
|
+
'm199.04 672.64 193.984 112 224-387.968-193.92-112-224 388.032zm-23.872 60.16 32.896 148.288 144.896-45.696zM455.04 229.248l193.92 112 56.704-98.112-193.984-112-56.64 98.112zM104.32 708.8l384-665.024 304.768 175.936L409.152 884.8h.064l-248.448 78.336zm384 254.272v-64h448v64h-448z'
|
|
44
|
+
)
|
|
45
|
+
const UserFilled = createIcon(
|
|
46
|
+
'M288 320a224 224 0 1 0 448 0 224 224 0 1 0-448 0m544 608H160a32 32 0 0 1-32-32v-96a160 160 0 0 1 160-160h448a160 160 0 0 1 160 160v96a32 32 0 0 1-32 32z'
|
|
47
|
+
)
|
|
48
|
+
|
|
18
49
|
const formatShowDate = useFormatShowDate()
|
|
19
50
|
const article = useArticleConfig()
|
|
20
51
|
const authorList = useAuthorList()
|
|
@@ -131,24 +162,24 @@ const timeTitle = computed(() =>
|
|
|
131
162
|
<template>
|
|
132
163
|
<div v-if="showAnalyze && readingTimePosition === 'top'" class="doc-analyze" data-pagefind-ignore="all">
|
|
133
164
|
<span>
|
|
134
|
-
<
|
|
165
|
+
<i class="icon">
|
|
135
166
|
<EditPen />
|
|
136
|
-
</
|
|
167
|
+
</i>
|
|
137
168
|
{{ topWordCount }}
|
|
138
169
|
</span>
|
|
139
170
|
<span>
|
|
140
|
-
<
|
|
171
|
+
<i class="icon">
|
|
141
172
|
<AlarmClock />
|
|
142
|
-
</
|
|
173
|
+
</i>
|
|
143
174
|
{{ topReadTime }}
|
|
144
175
|
</span>
|
|
145
176
|
</div>
|
|
146
177
|
<div id="hack-article-des" ref="$des" class="meta-des">
|
|
147
178
|
<!-- TODO:是否需要原创?转载等标签,理论上可以添加标签解决,可以参考 charles7c -->
|
|
148
179
|
<span v-if="author && !hiddenAuthor" class="author" :title="authorTitle">
|
|
149
|
-
<
|
|
180
|
+
<i class="icon">
|
|
150
181
|
<UserFilled />
|
|
151
|
-
</
|
|
182
|
+
</i>
|
|
152
183
|
<a v-if="currentAuthorInfo" class="link" :href="currentAuthorInfo.url" :title="currentAuthorInfo.des">
|
|
153
184
|
{{ currentAuthorInfo.nickname }}
|
|
154
185
|
</a>
|
|
@@ -157,45 +188,45 @@ const timeTitle = computed(() =>
|
|
|
157
188
|
</template>
|
|
158
189
|
</span>
|
|
159
190
|
<span v-if="publishDate && !hiddenTime" class="publishDate" :title="timeTitle + hoverDate">
|
|
160
|
-
<
|
|
191
|
+
<i class="icon">
|
|
161
192
|
<Clock />
|
|
162
|
-
</
|
|
193
|
+
</i>
|
|
163
194
|
{{ publishDate }}
|
|
164
195
|
</span>
|
|
165
196
|
<template v-if="readingTimePosition === 'inline' && showAnalyze">
|
|
166
197
|
<span :title="wordCountTitle">
|
|
167
|
-
<
|
|
198
|
+
<i class="icon">
|
|
168
199
|
<EditPen />
|
|
169
|
-
</
|
|
200
|
+
</i>
|
|
170
201
|
{{ inlineWordCount }}
|
|
171
202
|
</span>
|
|
172
203
|
<span :title="readTimeTitle">
|
|
173
|
-
<
|
|
204
|
+
<i class="icon">
|
|
174
205
|
<AlarmClock />
|
|
175
|
-
</
|
|
206
|
+
</i>
|
|
176
207
|
{{ inlineReadTime }}
|
|
177
208
|
</span>
|
|
178
209
|
</template>
|
|
179
210
|
<template v-if="readingTimePosition === 'newLine' && showAnalyze">
|
|
180
211
|
<div style="width: 100%;" class="new-line-meta-des">
|
|
181
212
|
<span :title="wordCountTitle">
|
|
182
|
-
<
|
|
213
|
+
<i class="icon">
|
|
183
214
|
<EditPen />
|
|
184
|
-
</
|
|
215
|
+
</i>
|
|
185
216
|
{{ inlineWordCount }}
|
|
186
217
|
</span>
|
|
187
218
|
<span :title="readTimeTitle">
|
|
188
|
-
<
|
|
219
|
+
<i class="icon">
|
|
189
220
|
<AlarmClock />
|
|
190
|
-
</
|
|
221
|
+
</i>
|
|
191
222
|
{{ inlineReadTime }}
|
|
192
223
|
</span>
|
|
193
224
|
</div>
|
|
194
225
|
</template>
|
|
195
226
|
<span v-if="tags.length" class="tags" :title="tagTitle">
|
|
196
|
-
<
|
|
227
|
+
<i class="icon">
|
|
197
228
|
<CollectionTag />
|
|
198
|
-
</
|
|
229
|
+
</i>
|
|
199
230
|
<a v-for="tag in tags" :key="tag" class="link" :href="`/?tag=${tag}`">{{ tag }}
|
|
200
231
|
</a>
|
|
201
232
|
</span>
|
|
@@ -206,23 +237,18 @@ const timeTitle = computed(() =>
|
|
|
206
237
|
</div>
|
|
207
238
|
</template>
|
|
208
239
|
|
|
209
|
-
<style
|
|
240
|
+
<style scoped>
|
|
210
241
|
.doc-analyze {
|
|
211
242
|
color: var(--vp-c-text-2);
|
|
212
243
|
font-size: 14px;
|
|
213
244
|
margin-bottom: 20px;
|
|
214
245
|
display: flex;
|
|
215
246
|
justify-content: center;
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
.el-icon {
|
|
223
|
-
margin-right: 4px;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
247
|
+
}
|
|
248
|
+
.doc-analyze span {
|
|
249
|
+
margin-right: 16px;
|
|
250
|
+
display: flex;
|
|
251
|
+
align-items: center;
|
|
226
252
|
}
|
|
227
253
|
|
|
228
254
|
.meta-des,
|
|
@@ -233,35 +259,42 @@ const timeTitle = computed(() =>
|
|
|
233
259
|
margin-top: 6px;
|
|
234
260
|
display: flex;
|
|
235
261
|
flex-wrap: wrap;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
262
|
+
}
|
|
263
|
+
.meta-des > span,
|
|
264
|
+
.new-line-meta-des > span {
|
|
265
|
+
margin-right: 16px;
|
|
266
|
+
display: flex;
|
|
267
|
+
align-items: center;
|
|
268
|
+
flex-wrap: wrap;
|
|
269
|
+
}
|
|
270
|
+
.meta-des > span .icon,
|
|
271
|
+
.new-line-meta-des > span .icon {
|
|
272
|
+
margin-right: 4px;
|
|
273
|
+
--color: inherit;
|
|
274
|
+
align-items: center;
|
|
275
|
+
display: inline-flex;
|
|
276
|
+
height: 1em;
|
|
277
|
+
justify-content: center;
|
|
278
|
+
line-height: 1em;
|
|
279
|
+
position: relative;
|
|
280
|
+
width: 1em;
|
|
281
|
+
fill: currentColor;
|
|
282
|
+
color: var(--color) inherit;
|
|
283
|
+
font-size: inherit;
|
|
284
|
+
}
|
|
285
|
+
.meta-des .link,
|
|
286
|
+
.new-line-meta-des .link {
|
|
287
|
+
color: var(--vp-c-text-2);
|
|
288
|
+
}
|
|
289
|
+
.meta-des .link:hover,
|
|
290
|
+
.new-line-meta-des .link:hover {
|
|
291
|
+
color: var(--vp-c-brand-1);
|
|
292
|
+
cursor: pointer;
|
|
256
293
|
}
|
|
257
294
|
|
|
258
|
-
.tags {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
display: inline-block;
|
|
263
|
-
padding: 0 4px;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
295
|
+
.tags a.link:not(:last-child)::after {
|
|
296
|
+
content: "·";
|
|
297
|
+
display: inline-block;
|
|
298
|
+
padding: 0 4px;
|
|
266
299
|
}
|
|
267
300
|
</style>
|