@sugarat/theme 0.5.11 → 0.5.12-beta.0
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 -14
- package/src/components/Alert.vue +308 -0
- package/src/components/Avatar.vue +66 -0
- package/src/components/BlogAlert.vue +4 -4
- package/src/components/BlogApp.vue +4 -0
- package/src/components/BlogArticleAnalyze.vue +70 -32
- package/src/components/BlogButtonAfterArticle.vue +4 -4
- package/src/components/BlogFriendLink.vue +54 -27
- package/src/components/BlogHomeInfo.vue +1 -3
- package/src/components/BlogHomeTags.vue +8 -14
- package/src/components/BlogHotArticle.vue +3 -3
- package/src/components/BlogImagePreview.vue +3 -3
- package/src/components/BlogList.vue +7 -8
- package/src/components/BlogRecommendArticle.vue +3 -3
- package/src/components/Button.vue +165 -0
- package/src/components/Carousel.vue +254 -0
- package/src/components/CarouselItem.vue +154 -0
- package/src/components/Image.vue +34 -0
- package/src/components/ImageViewer.vue +406 -0
- package/src/components/Pagination.vue +397 -0
- package/src/components/Tag.vue +163 -0
- package/src/components/UserWorks.vue +19 -22
- package/src/composables/config/blog.ts +6 -1
- package/src/composables/config/index.ts +2 -2
- package/src/index.ts +10 -17
- package/src/node.ts +0 -3
- package/src/styles/el-base.css +340 -0
- 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
|
@@ -0,0 +1,308 @@
|
|
|
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 lang="scss" 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
|
+
|
|
138
|
+
display: flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
transition: opacity .2s;
|
|
141
|
+
|
|
142
|
+
&.is-center {
|
|
143
|
+
justify-content: center;
|
|
144
|
+
|
|
145
|
+
.sugar-alert__content {
|
|
146
|
+
text-align: center;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
&--success {
|
|
151
|
+
background-color: #f0f9eb;
|
|
152
|
+
color: #67c23a;
|
|
153
|
+
|
|
154
|
+
.sugar-alert__description {
|
|
155
|
+
color: #67c23a;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
&--info {
|
|
161
|
+
background-color: #f4f4f5;
|
|
162
|
+
color: #909399;
|
|
163
|
+
|
|
164
|
+
.sugar-alert__description {
|
|
165
|
+
color: #909399;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&--warning {
|
|
171
|
+
background-color: #fdf6ec;
|
|
172
|
+
color: #e6a23c;
|
|
173
|
+
|
|
174
|
+
.sugar-alert__description {
|
|
175
|
+
color: #e6a23c;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&--error {
|
|
181
|
+
background-color: #fef0f0;
|
|
182
|
+
color: #f56c6c;
|
|
183
|
+
|
|
184
|
+
.sugar-alert__description {
|
|
185
|
+
color: #f56c6c;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&--primary {
|
|
191
|
+
background-color: var(--vp-c-brand-soft);
|
|
192
|
+
color: var(--vp-c-brand-1);
|
|
193
|
+
|
|
194
|
+
.sugar-alert__description {
|
|
195
|
+
color: var(--vp-c-brand-1);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&__content {
|
|
200
|
+
display: table-cell;
|
|
201
|
+
padding: 0 8px;
|
|
202
|
+
width: 100%; // Ensure content takes available space
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&__icon {
|
|
206
|
+
font-size: 16px;
|
|
207
|
+
width: 16px;
|
|
208
|
+
display: table-cell;
|
|
209
|
+
color: inherit;
|
|
210
|
+
vertical-align: middle;
|
|
211
|
+
|
|
212
|
+
&.is-big {
|
|
213
|
+
font-size: 28px;
|
|
214
|
+
width: 28px;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
&__title {
|
|
219
|
+
font-size: 13px;
|
|
220
|
+
line-height: 18px;
|
|
221
|
+
vertical-align: text-top;
|
|
222
|
+
|
|
223
|
+
&.is-bold {
|
|
224
|
+
font-weight: 700;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
&__description {
|
|
229
|
+
font-size: 12px;
|
|
230
|
+
margin: 5px 0 0 0;
|
|
231
|
+
line-height: 1.5;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
&__close-btn {
|
|
235
|
+
font-size: 12px;
|
|
236
|
+
opacity: 1;
|
|
237
|
+
position: absolute;
|
|
238
|
+
top: 12px;
|
|
239
|
+
right: 15px;
|
|
240
|
+
cursor: pointer;
|
|
241
|
+
color: var(--vp-c-text-2); // Use element colors if light
|
|
242
|
+
|
|
243
|
+
&.is-customed {
|
|
244
|
+
font-style: normal;
|
|
245
|
+
font-size: 11px;
|
|
246
|
+
line-height: 18px;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
&:hover {
|
|
250
|
+
opacity: 0.7;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.sugar-alert-fade-enter-from,
|
|
256
|
+
.sugar-alert-fade-leave-to {
|
|
257
|
+
opacity: 0;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
html.dark {
|
|
261
|
+
.sugar-alert {
|
|
262
|
+
&--success {
|
|
263
|
+
background-color: #1c2518;
|
|
264
|
+
color: #67c23a;
|
|
265
|
+
|
|
266
|
+
.sugar-alert__description {
|
|
267
|
+
color: #67c23a;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
&--info {
|
|
272
|
+
background-color: #202121;
|
|
273
|
+
color: #909399;
|
|
274
|
+
|
|
275
|
+
.sugar-alert__description {
|
|
276
|
+
color: #909399;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
&--warning {
|
|
281
|
+
background-color: #292218;
|
|
282
|
+
color: #e6a23c;
|
|
283
|
+
|
|
284
|
+
.sugar-alert__description {
|
|
285
|
+
color: #e6a23c;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
&--error {
|
|
290
|
+
background-color: #2b1d1d;
|
|
291
|
+
color: #f56c6c;
|
|
292
|
+
|
|
293
|
+
.sugar-alert__description {
|
|
294
|
+
color: #f56c6c;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
&--primary {
|
|
299
|
+
background-color: var(--vp-c-brand-soft);
|
|
300
|
+
color: var(--vp-c-brand-1);
|
|
301
|
+
|
|
302
|
+
.sugar-alert__description {
|
|
303
|
+
color: var(--vp-c-brand-1);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
</style>
|
|
@@ -0,0 +1,66 @@
|
|
|
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 lang="scss" 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
|
+
> img {
|
|
56
|
+
display: block;
|
|
57
|
+
height: 100%;
|
|
58
|
+
width: 100%;
|
|
59
|
+
object-fit: cover;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.blog-avatar--circle {
|
|
64
|
+
border-radius: 50%;
|
|
65
|
+
}
|
|
66
|
+
</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,7 +59,7 @@ 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
|
|
|
@@ -73,7 +73,7 @@ function handleClose() {
|
|
|
73
73
|
left: 50%;
|
|
74
74
|
transform: translateX(-50%);
|
|
75
75
|
width: auto;
|
|
76
|
-
:deep(.
|
|
76
|
+
:deep(.sugar-alert__content) {
|
|
77
77
|
padding-right: 20px;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -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" />
|
|
@@ -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>
|
|
@@ -218,10 +249,6 @@ const timeTitle = computed(() =>
|
|
|
218
249
|
margin-right: 16px;
|
|
219
250
|
display: flex;
|
|
220
251
|
align-items: center;
|
|
221
|
-
|
|
222
|
-
.el-icon {
|
|
223
|
-
margin-right: 4px;
|
|
224
|
-
}
|
|
225
252
|
}
|
|
226
253
|
}
|
|
227
254
|
|
|
@@ -240,8 +267,19 @@ const timeTitle = computed(() =>
|
|
|
240
267
|
align-items: center;
|
|
241
268
|
flex-wrap: wrap;
|
|
242
269
|
|
|
243
|
-
.
|
|
270
|
+
.icon {
|
|
244
271
|
margin-right: 4px;
|
|
272
|
+
--color: inherit;
|
|
273
|
+
align-items: center;
|
|
274
|
+
display: inline-flex;
|
|
275
|
+
height: 1em;
|
|
276
|
+
justify-content: center;
|
|
277
|
+
line-height: 1em;
|
|
278
|
+
position: relative;
|
|
279
|
+
width: 1em;
|
|
280
|
+
fill: currentColor;
|
|
281
|
+
color: var(--color) inherit;
|
|
282
|
+
font-size: inherit;
|
|
245
283
|
}
|
|
246
284
|
}
|
|
247
285
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { ElButton } from 'element-plus'
|
|
3
2
|
import { computed, ref, watch } from 'vue'
|
|
4
3
|
import { useButtonAfterConfig } from '../composables/config/blog'
|
|
5
4
|
import { aliPaySVG, weChatPaySVG } from '../constants/svg'
|
|
5
|
+
import Button from './Button.vue'
|
|
6
6
|
|
|
7
7
|
const buttonAfterArticleConfig = useButtonAfterConfig()
|
|
8
8
|
|
|
@@ -36,10 +36,10 @@ function toggleContent() {
|
|
|
36
36
|
|
|
37
37
|
<template>
|
|
38
38
|
<div v-if="buttonAfterArticleConfig" class="appreciation-container">
|
|
39
|
-
<
|
|
39
|
+
<Button :size="buttonAfterArticleConfig.size || 'default'" class="content-button" :type="showContent ? 'danger' : 'primary'" @click="toggleContent">
|
|
40
40
|
<span class="content-icon" v-html="svg" />
|
|
41
41
|
{{ showContent ? buttonAfterArticleConfig.closeTitle : buttonAfterArticleConfig.openTitle }}
|
|
42
|
-
</
|
|
42
|
+
</Button>
|
|
43
43
|
<transition name="content">
|
|
44
44
|
<div v-if="showContent" class="content-container" v-html="buttonAfterArticleConfig.content" />
|
|
45
45
|
</transition>
|
|
@@ -53,7 +53,7 @@ function toggleContent() {
|
|
|
53
53
|
font-size: 14px;
|
|
54
54
|
color: #606266;
|
|
55
55
|
|
|
56
|
-
:deep(.
|
|
56
|
+
:deep(.sugar-button.sugar-button--primary){
|
|
57
57
|
background-color: var(--vp-c-brand-2);
|
|
58
58
|
border-color: var(--vp-c-brand-2);
|
|
59
59
|
}
|