@sugarat/theme 0.1.48 → 0.1.50
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 -1
- package/node.js +27 -21
- package/package.json +23 -23
- package/src/components/BlogAlert.vue +17 -17
- package/src/components/BlogApp.vue +81 -49
- package/src/components/BlogArticleAnalyze.vue +56 -57
- package/src/components/BlogComment.vue +53 -50
- package/src/components/BlogDocCover.vue +4 -4
- package/src/components/BlogFriendLink.vue +40 -31
- package/src/components/BlogHomeBanner.vue +22 -16
- package/src/components/BlogHomeOverview.vue +20 -20
- package/src/components/BlogHomeTags.vue +49 -40
- package/src/components/BlogHotArticle.vue +43 -36
- package/src/components/BlogImagePreview.vue +7 -5
- package/src/components/BlogItem.vue +42 -43
- package/src/components/BlogList.vue +46 -42
- package/src/components/BlogPopover.vue +41 -39
- package/src/components/BlogRecommendArticle.vue +58 -48
- package/src/components/BlogSearch.vue +143 -145
- package/src/components/UserWorks.vue +214 -210
- package/src/composables/config/blog.ts +7 -5
- package/src/composables/config/index.ts +34 -31
- package/src/constants/svg.ts +2 -2
- package/src/index.ts +1 -2
- package/src/node.ts +2 -2
- package/src/styles/scss/global.scss +0 -5
- package/src/utils/client/index.ts +9 -8
- package/src/utils/node/genFeed.ts +8 -7
- package/src/utils/node/index.ts +8 -6
- package/src/utils/node/mdPlugins.ts +29 -22
- package/src/utils/node/theme.ts +21 -15
- package/src/utils/node/vitePlugins.ts +7 -6
- package/types/vue-shim.d.ts +1 -1
|
@@ -1,47 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="comment"
|
|
4
|
-
v-if="show"
|
|
5
|
-
id="giscus-comment"
|
|
6
|
-
data-pagefind-ignore="all"
|
|
7
|
-
ref="commentEl"
|
|
8
|
-
>
|
|
9
|
-
<el-affix
|
|
10
|
-
:class="{ hidden: commentIsVisible }"
|
|
11
|
-
class="comment-btn"
|
|
12
|
-
target="main"
|
|
13
|
-
position="bottom"
|
|
14
|
-
:offset="40"
|
|
15
|
-
>
|
|
16
|
-
<el-button
|
|
17
|
-
@click="handleScrollToComment"
|
|
18
|
-
plain
|
|
19
|
-
:icon="Comment"
|
|
20
|
-
type="primary"
|
|
21
|
-
>评论</el-button
|
|
22
|
-
>
|
|
23
|
-
</el-affix>
|
|
24
|
-
<component
|
|
25
|
-
v-if="showComment"
|
|
26
|
-
:is="'script'"
|
|
27
|
-
src="https://giscus.app/client.js"
|
|
28
|
-
:data-repo="commentConfig.repo"
|
|
29
|
-
:data-repo-id="commentConfig.repoId"
|
|
30
|
-
:data-category="commentConfig.category"
|
|
31
|
-
:data-category-id="commentConfig.categoryId"
|
|
32
|
-
:data-mapping="commentConfig.mapping || 'pathname'"
|
|
33
|
-
data-reactions-enabled="1"
|
|
34
|
-
data-emit-metadata="0"
|
|
35
|
-
:data-input-position="commentConfig.inputPosition || 'top'"
|
|
36
|
-
:data-theme="isDark ? 'dark' : 'light'"
|
|
37
|
-
:data-lang="commentConfig.lang || 'zh-CN'"
|
|
38
|
-
crossorigin="anonymous"
|
|
39
|
-
:data-loading="commentConfig.loading || 'eager'"
|
|
40
|
-
async
|
|
41
|
-
>
|
|
42
|
-
</component>
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|
|
45
1
|
<script setup lang="ts">
|
|
46
2
|
import { useElementVisibility } from '@vueuse/core'
|
|
47
3
|
import { useData, useRoute } from 'vitepress'
|
|
@@ -49,13 +5,13 @@ import { computed, nextTick, ref, watch } from 'vue'
|
|
|
49
5
|
import { ElAffix, ElButton } from 'element-plus'
|
|
50
6
|
import { Comment } from '@element-plus/icons-vue'
|
|
51
7
|
import { useGiscusConfig } from '../composables/config/blog'
|
|
52
|
-
import { Theme } from '../composables/config/index'
|
|
8
|
+
import type { Theme } from '../composables/config/index'
|
|
53
9
|
|
|
54
10
|
const { frontmatter } = useData()
|
|
55
11
|
const commentEl = ref(null)
|
|
56
12
|
const commentIsVisible = useElementVisibility(commentEl)
|
|
57
13
|
|
|
58
|
-
|
|
14
|
+
function handleScrollToComment() {
|
|
59
15
|
document.querySelector('#giscus-comment')?.scrollIntoView({
|
|
60
16
|
behavior: 'smooth',
|
|
61
17
|
block: 'start'
|
|
@@ -78,10 +34,10 @@ const show = computed(() => {
|
|
|
78
34
|
return giscusConfig
|
|
79
35
|
}
|
|
80
36
|
return (
|
|
81
|
-
giscusConfig.repo
|
|
82
|
-
giscusConfig.repoId
|
|
83
|
-
giscusConfig.category
|
|
84
|
-
giscusConfig.categoryId
|
|
37
|
+
giscusConfig.repo
|
|
38
|
+
&& giscusConfig.repoId
|
|
39
|
+
&& giscusConfig.category
|
|
40
|
+
&& giscusConfig.categoryId
|
|
85
41
|
)
|
|
86
42
|
})
|
|
87
43
|
|
|
@@ -110,6 +66,53 @@ watch(isDark, () => {
|
|
|
110
66
|
})
|
|
111
67
|
})
|
|
112
68
|
</script>
|
|
69
|
+
|
|
70
|
+
<template>
|
|
71
|
+
<div
|
|
72
|
+
v-if="show"
|
|
73
|
+
id="giscus-comment"
|
|
74
|
+
ref="commentEl"
|
|
75
|
+
class="comment"
|
|
76
|
+
data-pagefind-ignore="all"
|
|
77
|
+
>
|
|
78
|
+
<ElAffix
|
|
79
|
+
:class="{ hidden: commentIsVisible }"
|
|
80
|
+
class="comment-btn"
|
|
81
|
+
target="main"
|
|
82
|
+
position="bottom"
|
|
83
|
+
:offset="40"
|
|
84
|
+
>
|
|
85
|
+
<ElButton
|
|
86
|
+
plain
|
|
87
|
+
:icon="Comment"
|
|
88
|
+
type="primary"
|
|
89
|
+
@click="handleScrollToComment"
|
|
90
|
+
>
|
|
91
|
+
评论
|
|
92
|
+
</ElButton>
|
|
93
|
+
</ElAffix>
|
|
94
|
+
<!-- eslint-disable-next-line vue/require-component-is -->
|
|
95
|
+
<component
|
|
96
|
+
is="script"
|
|
97
|
+
v-if="showComment"
|
|
98
|
+
src="https://giscus.app/client.js"
|
|
99
|
+
:data-repo="commentConfig.repo"
|
|
100
|
+
:data-repo-id="commentConfig.repoId"
|
|
101
|
+
:data-category="commentConfig.category"
|
|
102
|
+
:data-category-id="commentConfig.categoryId"
|
|
103
|
+
:data-mapping="commentConfig.mapping || 'pathname'"
|
|
104
|
+
data-reactions-enabled="1"
|
|
105
|
+
data-emit-metadata="0"
|
|
106
|
+
:data-input-position="commentConfig.inputPosition || 'top'"
|
|
107
|
+
:data-theme="isDark ? 'dark' : 'light'"
|
|
108
|
+
:data-lang="commentConfig.lang || 'zh-CN'"
|
|
109
|
+
crossorigin="anonymous"
|
|
110
|
+
:data-loading="commentConfig.loading || 'eager'"
|
|
111
|
+
async
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
</template>
|
|
115
|
+
|
|
113
116
|
<style scoped lang="scss">
|
|
114
117
|
.comment {
|
|
115
118
|
width: 100%;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<img class="blog-doc-cover" v-if="cover && !hiddenCover" :src="cover" />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
1
|
<script lang="ts" setup>
|
|
6
2
|
import { useData } from 'vitepress'
|
|
7
3
|
import { computed } from 'vue'
|
|
@@ -15,6 +11,10 @@ const hiddenCover = computed(
|
|
|
15
11
|
)
|
|
16
12
|
</script>
|
|
17
13
|
|
|
14
|
+
<template>
|
|
15
|
+
<img v-if="cover && !hiddenCover" class="blog-doc-cover" :src="cover">
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
18
|
<style lang="scss" scoped>
|
|
19
19
|
img.blog-doc-cover.blog-doc-cover.blog-doc-cover {
|
|
20
20
|
width: 100%;
|
|
@@ -1,33 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="card friend-wrapper" v-if="friendList?.length">
|
|
3
|
-
<!-- 头部 -->
|
|
4
|
-
<div class="card-header">
|
|
5
|
-
<span class="title svg-icon"><svg width="512" height="512" viewBox="0 0 36 36" xmlns="http://www.w3.org/2000/svg">
|
|
6
|
-
<path fill="#EF9645"
|
|
7
|
-
d="M16.428 30.331a2.31 2.31 0 0 0 3.217-.568a.798.798 0 0 0-.197-1.114l-1.85-1.949l4.222 2.955a1.497 1.497 0 0 0 2.089-.369a1.5 1.5 0 0 0-.369-2.089l-3.596-3.305l5.375 3.763a1.497 1.497 0 0 0 2.089-.369a1.5 1.5 0 0 0-.369-2.089l-4.766-4.073l5.864 4.105a1.497 1.497 0 0 0 2.089-.369a1.5 1.5 0 0 0-.369-2.089L4.733 11.194l-3.467 5.521c-.389.6-.283 1.413.276 1.891l7.786 6.671c.355.304.724.591 1.107.859l5.993 4.195z" />
|
|
8
|
-
<path fill="#FFDC5D"
|
|
9
|
-
d="M29.802 21.752L18.5 13.601l-.059-.08l.053-.08l.053-.053l.854.469c.958.62 3.147 1.536 4.806 1.536c1.135 0 1.815-.425 2.018-1.257a1.409 1.409 0 0 0-1.152-1.622a6.788 6.788 0 0 1-2.801-1.091l-.555-.373c-.624-.421-1.331-.898-1.853-1.206c-.65-.394-1.357-.585-2.163-.585c-1.196 0-2.411.422-3.585.83l-1.266.436a5.18 5.18 0 0 1-1.696.271c-1.544 0-3.055-.586-4.516-1.152l-.147-.058a1.389 1.389 0 0 0-1.674.56L1.35 15.669a1.357 1.357 0 0 0 .257 1.761l7.785 6.672c.352.301.722.588 1.1.852l6.165 4.316a2 2 0 0 0 2.786-.491a.803.803 0 0 0-.196-1.115l-1.833-1.283a.424.424 0 0 1-.082-.618a.422.422 0 0 1 .567-.075l3.979 2.785a1.4 1.4 0 0 0 1.606-2.294l-3.724-2.606a.424.424 0 0 1-.082-.618a.423.423 0 0 1 .567-.075l5.132 3.593a1.4 1.4 0 0 0 1.606-2.294l-4.868-3.407a.42.42 0 0 1-.081-.618a.377.377 0 0 1 .506-.066l5.656 3.959a1.4 1.4 0 0 0 1.606-2.295z" />
|
|
10
|
-
<path fill="#EF9645"
|
|
11
|
-
d="M16.536 27.929c-.07.267-.207.498-.389.681l-1.004.996a1.494 1.494 0 0 1-1.437.396a1.5 1.5 0 0 1-.683-2.512l1.004-.996a1.494 1.494 0 0 1 1.437-.396a1.502 1.502 0 0 1 1.072 1.831zM5.992 23.008l1.503-1.497a1.5 1.5 0 0 0-.444-2.429a1.495 1.495 0 0 0-1.674.31l-1.503 1.497a1.5 1.5 0 0 0 .445 2.429a1.496 1.496 0 0 0 1.673-.31zm5.204.052a1.5 1.5 0 1 0-2.122-2.118L6.072 23.94a1.5 1.5 0 1 0 2.122 2.118l3.002-2.998zm2.25 3a1.5 1.5 0 0 0-.945-2.555a1.489 1.489 0 0 0-1.173.44L9.323 25.94a1.5 1.5 0 0 0 .945 2.556c.455.036.874-.141 1.173-.44l2.005-1.996zm16.555-4.137l.627-.542l-6.913-10.85l-12.27 1.985a1.507 1.507 0 0 0-1.235 1.737c.658 2.695 6.003.693 8.355-.601l11.436 8.271z" />
|
|
12
|
-
<path fill="#FFCC4D"
|
|
13
|
-
d="M16.536 26.929c-.07.267-.207.498-.389.681l-1.004.996a1.494 1.494 0 0 1-1.437.396a1.5 1.5 0 0 1-.683-2.512l1.004-.996a1.494 1.494 0 0 1 1.437-.396a1.502 1.502 0 0 1 1.072 1.831zM5.992 22.008l1.503-1.497a1.5 1.5 0 0 0-.444-2.429a1.497 1.497 0 0 0-1.674.31l-1.503 1.497a1.5 1.5 0 0 0 .445 2.429a1.496 1.496 0 0 0 1.673-.31zm5.204.052a1.5 1.5 0 1 0-2.122-2.118L6.072 22.94a1.5 1.5 0 1 0 2.122 2.118l3.002-2.998zm2.25 3a1.5 1.5 0 0 0-.945-2.555a1.489 1.489 0 0 0-1.173.44L9.323 24.94a1.5 1.5 0 0 0 .945 2.556c.455.036.874-.141 1.173-.44l2.005-1.996zm21.557-7.456a1.45 1.45 0 0 0 .269-1.885l-.003-.005l-3.467-6.521a1.488 1.488 0 0 0-1.794-.6c-1.992.771-4.174 1.657-6.292.937l-1.098-.377c-1.948-.675-4.066-1.466-6-.294c-.695.409-1.738 1.133-2.411 1.58a6.873 6.873 0 0 1-2.762 1.076a1.502 1.502 0 0 0-1.235 1.737c.613 2.512 5.3.908 7.838-.369a.968.968 0 0 1 1.002.081l11.584 8.416l4.369-3.776z" />
|
|
14
|
-
</svg> 友情链接</span>
|
|
15
|
-
</div>
|
|
16
|
-
<!-- 文章列表 -->
|
|
17
|
-
<ol class="friend-list">
|
|
18
|
-
<li v-for="v in friendList" :key="v.nickname">
|
|
19
|
-
<a :href="v.url" target="_blank">
|
|
20
|
-
<el-avatar :size="50" :src="v.avatar" :alt="v.alt" />
|
|
21
|
-
<div>
|
|
22
|
-
<span class="nickname">{{ v.nickname }}</span>
|
|
23
|
-
<p class="des">{{ v.des }}</p>
|
|
24
|
-
</div>
|
|
25
|
-
</a>
|
|
26
|
-
</li>
|
|
27
|
-
</ol>
|
|
28
|
-
</div>
|
|
29
|
-
</template>
|
|
30
|
-
|
|
31
1
|
<script lang="ts" setup>
|
|
32
2
|
import { ElAvatar } from 'element-plus'
|
|
33
3
|
import { useDark } from '@vueuse/core'
|
|
@@ -58,6 +28,44 @@ const friendList = computed(() => {
|
|
|
58
28
|
})
|
|
59
29
|
</script>
|
|
60
30
|
|
|
31
|
+
<template>
|
|
32
|
+
<div v-if="friendList?.length" class="card friend-wrapper">
|
|
33
|
+
<!-- 头部 -->
|
|
34
|
+
<div class="card-header">
|
|
35
|
+
<span class="title svg-icon"><svg width="512" height="512" viewBox="0 0 36 36" xmlns="http://www.w3.org/2000/svg">
|
|
36
|
+
<path
|
|
37
|
+
fill="#EF9645"
|
|
38
|
+
d="M16.428 30.331a2.31 2.31 0 0 0 3.217-.568a.798.798 0 0 0-.197-1.114l-1.85-1.949l4.222 2.955a1.497 1.497 0 0 0 2.089-.369a1.5 1.5 0 0 0-.369-2.089l-3.596-3.305l5.375 3.763a1.497 1.497 0 0 0 2.089-.369a1.5 1.5 0 0 0-.369-2.089l-4.766-4.073l5.864 4.105a1.497 1.497 0 0 0 2.089-.369a1.5 1.5 0 0 0-.369-2.089L4.733 11.194l-3.467 5.521c-.389.6-.283 1.413.276 1.891l7.786 6.671c.355.304.724.591 1.107.859l5.993 4.195z"
|
|
39
|
+
/>
|
|
40
|
+
<path
|
|
41
|
+
fill="#FFDC5D"
|
|
42
|
+
d="M29.802 21.752L18.5 13.601l-.059-.08l.053-.08l.053-.053l.854.469c.958.62 3.147 1.536 4.806 1.536c1.135 0 1.815-.425 2.018-1.257a1.409 1.409 0 0 0-1.152-1.622a6.788 6.788 0 0 1-2.801-1.091l-.555-.373c-.624-.421-1.331-.898-1.853-1.206c-.65-.394-1.357-.585-2.163-.585c-1.196 0-2.411.422-3.585.83l-1.266.436a5.18 5.18 0 0 1-1.696.271c-1.544 0-3.055-.586-4.516-1.152l-.147-.058a1.389 1.389 0 0 0-1.674.56L1.35 15.669a1.357 1.357 0 0 0 .257 1.761l7.785 6.672c.352.301.722.588 1.1.852l6.165 4.316a2 2 0 0 0 2.786-.491a.803.803 0 0 0-.196-1.115l-1.833-1.283a.424.424 0 0 1-.082-.618a.422.422 0 0 1 .567-.075l3.979 2.785a1.4 1.4 0 0 0 1.606-2.294l-3.724-2.606a.424.424 0 0 1-.082-.618a.423.423 0 0 1 .567-.075l5.132 3.593a1.4 1.4 0 0 0 1.606-2.294l-4.868-3.407a.42.42 0 0 1-.081-.618a.377.377 0 0 1 .506-.066l5.656 3.959a1.4 1.4 0 0 0 1.606-2.295z"
|
|
43
|
+
/>
|
|
44
|
+
<path
|
|
45
|
+
fill="#EF9645"
|
|
46
|
+
d="M16.536 27.929c-.07.267-.207.498-.389.681l-1.004.996a1.494 1.494 0 0 1-1.437.396a1.5 1.5 0 0 1-.683-2.512l1.004-.996a1.494 1.494 0 0 1 1.437-.396a1.502 1.502 0 0 1 1.072 1.831zM5.992 23.008l1.503-1.497a1.5 1.5 0 0 0-.444-2.429a1.495 1.495 0 0 0-1.674.31l-1.503 1.497a1.5 1.5 0 0 0 .445 2.429a1.496 1.496 0 0 0 1.673-.31zm5.204.052a1.5 1.5 0 1 0-2.122-2.118L6.072 23.94a1.5 1.5 0 1 0 2.122 2.118l3.002-2.998zm2.25 3a1.5 1.5 0 0 0-.945-2.555a1.489 1.489 0 0 0-1.173.44L9.323 25.94a1.5 1.5 0 0 0 .945 2.556c.455.036.874-.141 1.173-.44l2.005-1.996zm16.555-4.137l.627-.542l-6.913-10.85l-12.27 1.985a1.507 1.507 0 0 0-1.235 1.737c.658 2.695 6.003.693 8.355-.601l11.436 8.271z"
|
|
47
|
+
/>
|
|
48
|
+
<path
|
|
49
|
+
fill="#FFCC4D"
|
|
50
|
+
d="M16.536 26.929c-.07.267-.207.498-.389.681l-1.004.996a1.494 1.494 0 0 1-1.437.396a1.5 1.5 0 0 1-.683-2.512l1.004-.996a1.494 1.494 0 0 1 1.437-.396a1.502 1.502 0 0 1 1.072 1.831zM5.992 22.008l1.503-1.497a1.5 1.5 0 0 0-.444-2.429a1.497 1.497 0 0 0-1.674.31l-1.503 1.497a1.5 1.5 0 0 0 .445 2.429a1.496 1.496 0 0 0 1.673-.31zm5.204.052a1.5 1.5 0 1 0-2.122-2.118L6.072 22.94a1.5 1.5 0 1 0 2.122 2.118l3.002-2.998zm2.25 3a1.5 1.5 0 0 0-.945-2.555a1.489 1.489 0 0 0-1.173.44L9.323 24.94a1.5 1.5 0 0 0 .945 2.556c.455.036.874-.141 1.173-.44l2.005-1.996zm21.557-7.456a1.45 1.45 0 0 0 .269-1.885l-.003-.005l-3.467-6.521a1.488 1.488 0 0 0-1.794-.6c-1.992.771-4.174 1.657-6.292.937l-1.098-.377c-1.948-.675-4.066-1.466-6-.294c-.695.409-1.738 1.133-2.411 1.58a6.873 6.873 0 0 1-2.762 1.076a1.502 1.502 0 0 0-1.235 1.737c.613 2.512 5.3.908 7.838-.369a.968.968 0 0 1 1.002.081l11.584 8.416l4.369-3.776z"
|
|
51
|
+
/>
|
|
52
|
+
</svg> 友情链接</span>
|
|
53
|
+
</div>
|
|
54
|
+
<!-- 文章列表 -->
|
|
55
|
+
<ol class="friend-list">
|
|
56
|
+
<li v-for="v in friendList" :key="v.nickname">
|
|
57
|
+
<a :href="v.url" target="_blank">
|
|
58
|
+
<ElAvatar :size="50" :src="v.avatar" :alt="v.alt" />
|
|
59
|
+
<div>
|
|
60
|
+
<span class="nickname">{{ v.nickname }}</span>
|
|
61
|
+
<p class="des">{{ v.des }}</p>
|
|
62
|
+
</div>
|
|
63
|
+
</a>
|
|
64
|
+
</li>
|
|
65
|
+
</ol>
|
|
66
|
+
</div>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
61
69
|
<style lang="scss" scoped>
|
|
62
70
|
.card {
|
|
63
71
|
position: relative;
|
|
@@ -128,4 +136,5 @@ const friendList = computed(() => {
|
|
|
128
136
|
font-size: 14px;
|
|
129
137
|
}
|
|
130
138
|
}
|
|
131
|
-
}
|
|
139
|
+
}
|
|
140
|
+
</style>
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<h1>
|
|
4
|
-
<span class="name">{{ name }}</span>
|
|
5
|
-
<span class="motto" v-show="motto">{{ motto }}</span>
|
|
6
|
-
</h1>
|
|
7
|
-
<div class="inspiring-wrapper">
|
|
8
|
-
<h2 @click="changeSlogan" v-show="!!inspiring">{{ inspiring }}</h2>
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
12
1
|
<script setup lang="ts">
|
|
13
2
|
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
|
|
14
3
|
import { useData } from 'vitepress'
|
|
@@ -28,7 +17,7 @@ const inspiringList = computed<string[]>(() => {
|
|
|
28
17
|
...new Set(
|
|
29
18
|
[frontmatter.value.blog?.inspiring, home?.inspiring]
|
|
30
19
|
.flat()
|
|
31
|
-
.filter(
|
|
20
|
+
.filter(v => !!v)
|
|
32
21
|
)
|
|
33
22
|
]
|
|
34
23
|
})
|
|
@@ -41,7 +30,7 @@ watch(inspiringTimeout, () => {
|
|
|
41
30
|
startTimer()
|
|
42
31
|
})
|
|
43
32
|
const timer = ref<any>(0)
|
|
44
|
-
|
|
33
|
+
function startTimer() {
|
|
45
34
|
if (timer.value) {
|
|
46
35
|
clearTimeout(timer.value)
|
|
47
36
|
}
|
|
@@ -61,15 +50,17 @@ onUnmounted(() => {
|
|
|
61
50
|
}
|
|
62
51
|
})
|
|
63
52
|
|
|
64
|
-
|
|
53
|
+
async function changeSlogan() {
|
|
65
54
|
// 顺手启动定时器
|
|
66
55
|
startTimer()
|
|
67
56
|
|
|
68
|
-
if (inspiringList.value.length < 1)
|
|
57
|
+
if (inspiringList.value.length < 1)
|
|
58
|
+
return
|
|
69
59
|
|
|
70
60
|
inspiringIndex.value = (inspiringIndex.value + 1) % inspiringList.value.length
|
|
71
61
|
const newValue = inspiringList.value[inspiringIndex.value]
|
|
72
|
-
if (newValue === inspiring.value)
|
|
62
|
+
if (newValue === inspiring.value)
|
|
63
|
+
return
|
|
73
64
|
|
|
74
65
|
// 重新渲染数据,同时触发动画
|
|
75
66
|
inspiring.value = ''
|
|
@@ -78,6 +69,21 @@ const changeSlogan = async () => {
|
|
|
78
69
|
}, 100)
|
|
79
70
|
}
|
|
80
71
|
</script>
|
|
72
|
+
|
|
73
|
+
<template>
|
|
74
|
+
<div>
|
|
75
|
+
<h1>
|
|
76
|
+
<span class="name">{{ name }}</span>
|
|
77
|
+
<span v-show="motto" class="motto">{{ motto }}</span>
|
|
78
|
+
</h1>
|
|
79
|
+
<div class="inspiring-wrapper">
|
|
80
|
+
<h2 v-show="!!inspiring" @click="changeSlogan">
|
|
81
|
+
{{ inspiring }}
|
|
82
|
+
</h2>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</template>
|
|
86
|
+
|
|
81
87
|
<style lang="scss" scoped>
|
|
82
88
|
h1 {
|
|
83
89
|
text-align: center;
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="card overview-data">
|
|
3
|
-
<div class="overview-item">
|
|
4
|
-
<span class="count">{{ notHiddenArticles.length }}</span>
|
|
5
|
-
<span class="label">博客文章</span>
|
|
6
|
-
</div>
|
|
7
|
-
<div class="split"></div>
|
|
8
|
-
<div class="overview-item">
|
|
9
|
-
<span class="count">+{{ currentMonth?.length }}</span>
|
|
10
|
-
<span class="label">本月更新</span>
|
|
11
|
-
</div>
|
|
12
|
-
<div class="split"></div>
|
|
13
|
-
<div class="overview-item">
|
|
14
|
-
<span class="count">+{{ currentWeek?.length }}</span>
|
|
15
|
-
<span class="label">本周更新</span>
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
1
|
<script lang="ts" setup>
|
|
21
2
|
import { computed } from 'vue'
|
|
22
3
|
import { isCurrentWeek } from '../utils/client'
|
|
@@ -24,7 +5,7 @@ import { useArticles } from '../composables/config/blog'
|
|
|
24
5
|
|
|
25
6
|
const docs = useArticles()
|
|
26
7
|
const notHiddenArticles = computed(() => {
|
|
27
|
-
return docs.value.filter(
|
|
8
|
+
return docs.value.filter(v => v.meta?.publish !== false)
|
|
28
9
|
})
|
|
29
10
|
const nowMonth = new Date().getMonth()
|
|
30
11
|
const nowYear = new Date().getFullYear()
|
|
@@ -43,6 +24,25 @@ const currentWeek = computed(() => {
|
|
|
43
24
|
})
|
|
44
25
|
</script>
|
|
45
26
|
|
|
27
|
+
<template>
|
|
28
|
+
<div class="card overview-data">
|
|
29
|
+
<div class="overview-item">
|
|
30
|
+
<span class="count">{{ notHiddenArticles.length }}</span>
|
|
31
|
+
<span class="label">博客文章</span>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="split" />
|
|
34
|
+
<div class="overview-item">
|
|
35
|
+
<span class="count">+{{ currentMonth?.length }}</span>
|
|
36
|
+
<span class="label">本月更新</span>
|
|
37
|
+
</div>
|
|
38
|
+
<div class="split" />
|
|
39
|
+
<div class="overview-item">
|
|
40
|
+
<span class="count">+{{ currentWeek?.length }}</span>
|
|
41
|
+
<span class="label">本周更新</span>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
46
|
<style lang="scss" scoped>
|
|
47
47
|
.card {
|
|
48
48
|
position: relative;
|
|
@@ -1,38 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="card tags" v-if="tags.length" data-pagefind-ignore="all">
|
|
3
|
-
<!-- 头部 -->
|
|
4
|
-
<div class="card-header">
|
|
5
|
-
<span class="title svg-icon"><svg t="1695048840129" class="icon" viewBox="0 0 1024 1024" version="1.1"
|
|
6
|
-
xmlns="http://www.w3.org/2000/svg" p-id="4290" width="200" height="200">
|
|
7
|
-
<path
|
|
8
|
-
d="M810.88 245.888a118.432 118.432 0 1 0 0 236.864 118.432 118.432 0 0 0 0-236.864z m-151.008 118.432a151.008 151.008 0 1 1 302.016 0 151.008 151.008 0 0 1-302.016 0z"
|
|
9
|
-
fill="#D3D3D3" p-id="4291"></path>
|
|
10
|
-
<path
|
|
11
|
-
d="M774.08 565.6l61.76-160.64c6.4-16.64 2.56-35.84-10.24-48.64l-151.04-151.04c-12.8-12.8-31.68-16.64-48.64-10.24l-160.64 61.76c-12.16 4.8-23.36 11.84-32.64 21.12l-355.2 355.2c-17.92 17.92-17.92 46.72 0 64.32l256 256c17.92 17.92 46.72 17.92 64.32 0l355.2-355.2c9.28-9.28 16.32-20.16 21.12-32.64z m-159.36-149.12c-22.08-22.08-22.08-57.6 0-79.68 22.08-22.08 57.6-22.08 79.68 0 22.08 22.08 22.08 57.6 0 79.68-22.08 21.76-57.92 21.76-79.68 0z"
|
|
12
|
-
fill="#FCD53F" p-id="4292"></path>
|
|
13
|
-
<path
|
|
14
|
-
d="M654.4 320.48c14.4 0 28.8 5.44 39.68 16.64 22.08 22.08 22.08 57.6 0 79.68-10.88 10.88-25.28 16.64-39.68 16.64-14.4 0-28.8-5.44-39.68-16.64-22.08-22.08-22.08-57.6 0-79.68 10.88-11.2 25.28-16.64 39.68-16.64z m0-30.08c-23.04 0-44.8 8.96-61.12 25.28a86.72 86.72 0 0 0 0 122.24c16.32 16.32 38.08 25.28 61.12 25.28s44.8-8.96 61.12-25.28a86.72 86.72 0 0 0 0-122.24c-16.32-16.32-38.08-25.28-61.12-25.28z"
|
|
15
|
-
fill="#F8312F" p-id="4293"></path>
|
|
16
|
-
<path
|
|
17
|
-
d="M676.16 348.032c8.992 0 16.288 7.296 16.288 16.288a118.144 118.144 0 0 0 64.288 105.44h0.064c22.24 11.296 47.36 15.264 71.68 11.84a16.288 16.288 0 0 1 4.48 32.32 154.24 154.24 0 0 1-90.848-15.04 150.72 150.72 0 0 1-82.24-134.56c0-8.992 7.296-16.288 16.288-16.288z"
|
|
18
|
-
fill="#D3D3D3" p-id="4294"></path>
|
|
19
|
-
</svg> 标签</span>
|
|
20
|
-
<el-tag v-if="activeTag.label" :type="(activeTag.type as any)" :effect="colorMode" closable @close="handleCloseTag">
|
|
21
|
-
{{ activeTag.label }}
|
|
22
|
-
</el-tag>
|
|
23
|
-
</div>
|
|
24
|
-
<!-- 标签列表 -->
|
|
25
|
-
<ul class="tag-list">
|
|
26
|
-
<li v-for="(tag, idx) in tags" :key="tag">
|
|
27
|
-
<el-tag :type="tagType[idx % tagType.length]" @click="handleTagClick(tag, tagType[idx % tagType.length])"
|
|
28
|
-
:effect="colorMode">
|
|
29
|
-
{{ tag }}
|
|
30
|
-
</el-tag>
|
|
31
|
-
</li>
|
|
32
|
-
</ul>
|
|
33
|
-
</div>
|
|
34
|
-
</template>
|
|
35
|
-
|
|
36
1
|
<script lang="ts" setup>
|
|
37
2
|
import { computed, watch } from 'vue'
|
|
38
3
|
import { ElTag } from 'element-plus'
|
|
@@ -47,7 +12,7 @@ import {
|
|
|
47
12
|
const docs = useArticles()
|
|
48
13
|
|
|
49
14
|
const tags = computed(() => {
|
|
50
|
-
return [...new Set(docs.value.map(
|
|
15
|
+
return [...new Set(docs.value.map(v => v.meta.tag || []).flat(3))]
|
|
51
16
|
})
|
|
52
17
|
|
|
53
18
|
const activeTag = useActiveTag()
|
|
@@ -60,18 +25,18 @@ const colorMode = computed(() => (isDark.value ? 'light' : 'dark'))
|
|
|
60
25
|
|
|
61
26
|
const tagType: any = ['', 'info', 'success', 'warning', 'danger']
|
|
62
27
|
const currentPage = useCurrentPageNum()
|
|
28
|
+
const router = useRouter()
|
|
63
29
|
|
|
64
|
-
|
|
30
|
+
function handleCloseTag() {
|
|
65
31
|
activeTag.value.label = ''
|
|
66
32
|
activeTag.value.type = ''
|
|
67
33
|
currentPage.value = 1
|
|
68
34
|
router.go(`${window.location.origin}${router.route.path}`)
|
|
69
35
|
}
|
|
70
36
|
|
|
71
|
-
const router = useRouter()
|
|
72
37
|
const location = useBrowserLocation()
|
|
73
38
|
|
|
74
|
-
|
|
39
|
+
function handleTagClick(tag: string, type: string) {
|
|
75
40
|
if (tag === activeTag.value.label) {
|
|
76
41
|
handleCloseTag()
|
|
77
42
|
return
|
|
@@ -99,6 +64,49 @@ watch(
|
|
|
99
64
|
)
|
|
100
65
|
</script>
|
|
101
66
|
|
|
67
|
+
<template>
|
|
68
|
+
<div v-if="tags.length" class="card tags" data-pagefind-ignore="all">
|
|
69
|
+
<!-- 头部 -->
|
|
70
|
+
<div class="card-header">
|
|
71
|
+
<span class="title svg-icon"><svg
|
|
72
|
+
t="1695048840129" class="icon" viewBox="0 0 1024 1024" version="1.1"
|
|
73
|
+
xmlns="http://www.w3.org/2000/svg" p-id="4290" width="200" height="200"
|
|
74
|
+
>
|
|
75
|
+
<path
|
|
76
|
+
d="M810.88 245.888a118.432 118.432 0 1 0 0 236.864 118.432 118.432 0 0 0 0-236.864z m-151.008 118.432a151.008 151.008 0 1 1 302.016 0 151.008 151.008 0 0 1-302.016 0z"
|
|
77
|
+
fill="#D3D3D3" p-id="4291"
|
|
78
|
+
/>
|
|
79
|
+
<path
|
|
80
|
+
d="M774.08 565.6l61.76-160.64c6.4-16.64 2.56-35.84-10.24-48.64l-151.04-151.04c-12.8-12.8-31.68-16.64-48.64-10.24l-160.64 61.76c-12.16 4.8-23.36 11.84-32.64 21.12l-355.2 355.2c-17.92 17.92-17.92 46.72 0 64.32l256 256c17.92 17.92 46.72 17.92 64.32 0l355.2-355.2c9.28-9.28 16.32-20.16 21.12-32.64z m-159.36-149.12c-22.08-22.08-22.08-57.6 0-79.68 22.08-22.08 57.6-22.08 79.68 0 22.08 22.08 22.08 57.6 0 79.68-22.08 21.76-57.92 21.76-79.68 0z"
|
|
81
|
+
fill="#FCD53F" p-id="4292"
|
|
82
|
+
/>
|
|
83
|
+
<path
|
|
84
|
+
d="M654.4 320.48c14.4 0 28.8 5.44 39.68 16.64 22.08 22.08 22.08 57.6 0 79.68-10.88 10.88-25.28 16.64-39.68 16.64-14.4 0-28.8-5.44-39.68-16.64-22.08-22.08-22.08-57.6 0-79.68 10.88-11.2 25.28-16.64 39.68-16.64z m0-30.08c-23.04 0-44.8 8.96-61.12 25.28a86.72 86.72 0 0 0 0 122.24c16.32 16.32 38.08 25.28 61.12 25.28s44.8-8.96 61.12-25.28a86.72 86.72 0 0 0 0-122.24c-16.32-16.32-38.08-25.28-61.12-25.28z"
|
|
85
|
+
fill="#F8312F" p-id="4293"
|
|
86
|
+
/>
|
|
87
|
+
<path
|
|
88
|
+
d="M676.16 348.032c8.992 0 16.288 7.296 16.288 16.288a118.144 118.144 0 0 0 64.288 105.44h0.064c22.24 11.296 47.36 15.264 71.68 11.84a16.288 16.288 0 0 1 4.48 32.32 154.24 154.24 0 0 1-90.848-15.04 150.72 150.72 0 0 1-82.24-134.56c0-8.992 7.296-16.288 16.288-16.288z"
|
|
89
|
+
fill="#D3D3D3" p-id="4294"
|
|
90
|
+
/>
|
|
91
|
+
</svg> 标签</span>
|
|
92
|
+
<ElTag v-if="activeTag.label" :type="activeTag.type as any" :effect="colorMode" closable @close="handleCloseTag">
|
|
93
|
+
{{ activeTag.label }}
|
|
94
|
+
</ElTag>
|
|
95
|
+
</div>
|
|
96
|
+
<!-- 标签列表 -->
|
|
97
|
+
<ul class="tag-list">
|
|
98
|
+
<li v-for="(tag, idx) in tags" :key="tag">
|
|
99
|
+
<ElTag
|
|
100
|
+
:type="tagType[idx % tagType.length]" :effect="colorMode"
|
|
101
|
+
@click="handleTagClick(tag, tagType[idx % tagType.length])"
|
|
102
|
+
>
|
|
103
|
+
{{ tag }}
|
|
104
|
+
</ElTag>
|
|
105
|
+
</li>
|
|
106
|
+
</ul>
|
|
107
|
+
</div>
|
|
108
|
+
</template>
|
|
109
|
+
|
|
102
110
|
<style lang="scss" scoped>
|
|
103
111
|
.card {
|
|
104
112
|
position: relative;
|
|
@@ -145,4 +153,5 @@ watch(
|
|
|
145
153
|
margin-bottom: 10px;
|
|
146
154
|
cursor: pointer;
|
|
147
155
|
}
|
|
148
|
-
}
|
|
156
|
+
}
|
|
157
|
+
</style>
|
|
@@ -1,40 +1,11 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="card recommend" v-if="recommendList.length || empty" data-pagefind-ignore="all">
|
|
3
|
-
<!-- 头部 -->
|
|
4
|
-
<div class="card-header">
|
|
5
|
-
<span class="title" v-html="title"></span>
|
|
6
|
-
<el-button v-if="showChangeBtn" size="small" type="primary" text @click="changePage">{{ nextText }}</el-button>
|
|
7
|
-
</div>
|
|
8
|
-
<!-- 文章列表 -->
|
|
9
|
-
<ol class="recommend-container" v-if="currentWikiData.length">
|
|
10
|
-
<li v-for="(v, idx) in currentWikiData" :key="v.route">
|
|
11
|
-
<!-- 序号 -->
|
|
12
|
-
<i class="num">{{ idx + 1 }}</i>
|
|
13
|
-
<!-- 简介 -->
|
|
14
|
-
<div class="des">
|
|
15
|
-
<!-- title -->
|
|
16
|
-
<el-link type="info" class="title" :href="withBase(v.route)">{{
|
|
17
|
-
v.meta.title
|
|
18
|
-
}}</el-link>
|
|
19
|
-
<!-- 描述信息 -->
|
|
20
|
-
<div class="suffix">
|
|
21
|
-
<!-- 日期 -->
|
|
22
|
-
<span class="tag">{{ formatShowDate(v.meta.date) }}</span>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</li>
|
|
26
|
-
</ol>
|
|
27
|
-
<div class="empty-text" v-else>{{ empty }}</div>
|
|
28
|
-
</div>
|
|
29
|
-
</template>
|
|
30
|
-
|
|
31
1
|
<script lang="ts" setup>
|
|
32
|
-
import {
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
33
3
|
import { ElButton, ElLink } from 'element-plus'
|
|
34
4
|
import { withBase } from 'vitepress'
|
|
35
5
|
import { useArticles, useBlogConfig } from '../composables/config/blog'
|
|
36
6
|
import { formatShowDate } from '../utils/client'
|
|
37
7
|
import { fireSVG } from '../constants/svg'
|
|
8
|
+
|
|
38
9
|
const { hotArticle } = useBlogConfig()
|
|
39
10
|
const title = computed(() => hotArticle?.title || (`<span class="svg-icon">${fireSVG}</span>` + ' 精选文章'))
|
|
40
11
|
const nextText = computed(() => hotArticle?.nextText || '换一组')
|
|
@@ -44,15 +15,15 @@ const empty = computed(() => hotArticle?.empty ?? '暂无精选内容')
|
|
|
44
15
|
const docs = useArticles()
|
|
45
16
|
|
|
46
17
|
const recommendList = computed(() => {
|
|
47
|
-
const data = docs.value.filter(
|
|
18
|
+
const data = docs.value.filter(v => v.meta.sticky)
|
|
48
19
|
data.sort((a, b) => b.meta.sticky! - a.meta.sticky!)
|
|
49
20
|
return [...data]
|
|
50
21
|
})
|
|
51
22
|
|
|
52
23
|
const currentPage = ref(1)
|
|
53
|
-
|
|
54
|
-
const newIdx
|
|
55
|
-
currentPage.value % Math.ceil(recommendList.value.length / pageSize.value)
|
|
24
|
+
function changePage() {
|
|
25
|
+
const newIdx
|
|
26
|
+
= currentPage.value % Math.ceil(recommendList.value.length / pageSize.value)
|
|
56
27
|
currentPage.value = newIdx + 1
|
|
57
28
|
}
|
|
58
29
|
|
|
@@ -67,6 +38,42 @@ const showChangeBtn = computed(() => {
|
|
|
67
38
|
})
|
|
68
39
|
</script>
|
|
69
40
|
|
|
41
|
+
<template>
|
|
42
|
+
<div v-if="recommendList.length || empty" class="card recommend" data-pagefind-ignore="all">
|
|
43
|
+
<!-- 头部 -->
|
|
44
|
+
<div class="card-header">
|
|
45
|
+
<span class="title" v-html="title" />
|
|
46
|
+
<ElButton v-if="showChangeBtn" size="small" type="primary" text @click="changePage">
|
|
47
|
+
{{ nextText }}
|
|
48
|
+
</ElButton>
|
|
49
|
+
</div>
|
|
50
|
+
<!-- 文章列表 -->
|
|
51
|
+
<ol v-if="currentWikiData.length" class="recommend-container">
|
|
52
|
+
<li v-for="(v, idx) in currentWikiData" :key="v.route">
|
|
53
|
+
<!-- 序号 -->
|
|
54
|
+
<i class="num">{{ idx + 1 }}</i>
|
|
55
|
+
<!-- 简介 -->
|
|
56
|
+
<div class="des">
|
|
57
|
+
<!-- title -->
|
|
58
|
+
<ElLink type="info" class="title" :href="withBase(v.route)">
|
|
59
|
+
{{
|
|
60
|
+
v.meta.title
|
|
61
|
+
}}
|
|
62
|
+
</ElLink>
|
|
63
|
+
<!-- 描述信息 -->
|
|
64
|
+
<div class="suffix">
|
|
65
|
+
<!-- 日期 -->
|
|
66
|
+
<span class="tag">{{ formatShowDate(v.meta.date) }}</span>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</li>
|
|
70
|
+
</ol>
|
|
71
|
+
<div v-else class="empty-text">
|
|
72
|
+
{{ empty }}
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
</template>
|
|
76
|
+
|
|
70
77
|
<style lang="scss" scoped>
|
|
71
78
|
.card {
|
|
72
79
|
position: relative;
|
|
@@ -170,4 +177,4 @@ const showChangeBtn = computed(() => {
|
|
|
170
177
|
font-size: 14px;
|
|
171
178
|
text-align: center;
|
|
172
179
|
}
|
|
173
|
-
</style>
|
|
180
|
+
</style>
|
|
@@ -10,15 +10,15 @@ const previewImageInfo = reactive<{ url: string; list: string[]; idx: number }>(
|
|
|
10
10
|
idx: 0
|
|
11
11
|
}
|
|
12
12
|
)
|
|
13
|
-
|
|
13
|
+
function previewImage(e: Event) {
|
|
14
14
|
const target = e.target as HTMLElement
|
|
15
15
|
const currentTarget = e.currentTarget as HTMLElement
|
|
16
16
|
if (target.tagName.toLowerCase() === 'img') {
|
|
17
17
|
const imgs = currentTarget.querySelectorAll<HTMLImageElement>(
|
|
18
18
|
'.content-container .main img'
|
|
19
19
|
)
|
|
20
|
-
const idx = Array.from(imgs).findIndex(
|
|
21
|
-
const urls = Array.from(imgs).map(
|
|
20
|
+
const idx = Array.from(imgs).findIndex(el => el === target)
|
|
21
|
+
const urls = Array.from(imgs).map(el => el.src)
|
|
22
22
|
|
|
23
23
|
const url = target.getAttribute('src')
|
|
24
24
|
previewImageInfo.url = url!
|
|
@@ -45,6 +45,8 @@ onUnmounted(() => {
|
|
|
45
45
|
</script>
|
|
46
46
|
|
|
47
47
|
<template>
|
|
48
|
-
<ElImageViewer
|
|
49
|
-
|
|
48
|
+
<ElImageViewer
|
|
49
|
+
v-if="show" :infinite="false" hide-on-click-modal teleported :url-list="previewImageInfo.list"
|
|
50
|
+
:initial-index="previewImageInfo.idx" @close="show = false"
|
|
51
|
+
/>
|
|
50
52
|
</template>
|