@sugarat/theme 0.5.5 → 0.5.6
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
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sugarat/theme",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "简约风的 Vitepress 博客主题,sugarat vitepress blog theme",
|
|
5
5
|
"author": "sugar",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"vitepress-plugin-mermaid": "2.0.13",
|
|
55
55
|
"vitepress-plugin-tabs": "0.2.0",
|
|
56
56
|
"@sugarat/theme-shared": "0.0.5",
|
|
57
|
-
"vitepress-plugin-pagefind": "0.4.14",
|
|
58
57
|
"vitepress-plugin-announcement": "0.1.5",
|
|
58
|
+
"vitepress-plugin-pagefind": "0.4.14",
|
|
59
59
|
"vitepress-plugin-rss": "0.3.1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
@@ -3,7 +3,7 @@ import Theme from 'vitepress/theme'
|
|
|
3
3
|
import { useData } from 'vitepress'
|
|
4
4
|
import { computed } from 'vue'
|
|
5
5
|
import { useDarkTransition } from '../hooks/useDarkTransition'
|
|
6
|
-
import { useBlogThemeMode, useDarkTransitionConfig } from '../composables/config/blog'
|
|
6
|
+
import { useBlogInfoCollapsible, useBlogThemeMode, useDarkTransitionConfig } from '../composables/config/blog'
|
|
7
7
|
import BlogHomeInfo from './BlogHomeInfo.vue'
|
|
8
8
|
import BlogHomeBanner from './BlogHomeBanner.vue'
|
|
9
9
|
import BlogList from './BlogList.vue'
|
|
@@ -26,6 +26,8 @@ const layout = computed(() => frontmatter.value.layout)
|
|
|
26
26
|
const isBlogTheme = useBlogThemeMode()
|
|
27
27
|
const { Layout } = Theme
|
|
28
28
|
|
|
29
|
+
const blogInfoCollapsible = useBlogInfoCollapsible()
|
|
30
|
+
|
|
29
31
|
// 切换深色模式过渡
|
|
30
32
|
// https://vitepress.dev/zh/guide/extending-default-theme#on-appearance-toggle
|
|
31
33
|
useDarkTransition()
|
|
@@ -67,7 +69,11 @@ const openTransition = useDarkTransitionConfig()
|
|
|
67
69
|
<div class="blog-list-wrapper">
|
|
68
70
|
<BlogList />
|
|
69
71
|
</div>
|
|
70
|
-
<div
|
|
72
|
+
<div
|
|
73
|
+
:class="{
|
|
74
|
+
'normal-mode': blogInfoCollapsible,
|
|
75
|
+
}" class="blog-info-wrapper"
|
|
76
|
+
>
|
|
71
77
|
<BlogHomeInfo />
|
|
72
78
|
</div>
|
|
73
79
|
</div>
|
|
@@ -108,6 +114,9 @@ const openTransition = useDarkTransitionConfig()
|
|
|
108
114
|
<slot name="nav-screen-content-before" />
|
|
109
115
|
</template>
|
|
110
116
|
<template #nav-screen-content-after>
|
|
117
|
+
<div v-if="blogInfoCollapsible" class="minify-mode blog-info-wrapper">
|
|
118
|
+
<BlogHomeInfo />
|
|
119
|
+
</div>
|
|
111
120
|
<slot name="nav-screen-content-after" />
|
|
112
121
|
</template>
|
|
113
122
|
|
|
@@ -226,6 +235,24 @@ const openTransition = useDarkTransitionConfig()
|
|
|
226
235
|
margin: 20px 0;
|
|
227
236
|
width: 100%;
|
|
228
237
|
}
|
|
238
|
+
|
|
239
|
+
.normal-mode {
|
|
240
|
+
display: none;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.minify-mode {
|
|
244
|
+
display: block;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
@media screen and (min-width: 768px) {
|
|
249
|
+
.minify-mode {
|
|
250
|
+
display: none;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.normal-mode {
|
|
254
|
+
display: block;
|
|
255
|
+
}
|
|
229
256
|
}
|
|
230
257
|
</style>
|
|
231
258
|
|
|
@@ -131,24 +131,25 @@ const timeTitle = computed(() =>
|
|
|
131
131
|
<template>
|
|
132
132
|
<div v-if="showAnalyze && readingTimePosition === 'top'" class="doc-analyze" data-pagefind-ignore="all">
|
|
133
133
|
<span>
|
|
134
|
-
<ElIcon
|
|
134
|
+
<ElIcon>
|
|
135
|
+
<EditPen />
|
|
136
|
+
</ElIcon>
|
|
135
137
|
{{ topWordCount }}
|
|
136
138
|
</span>
|
|
137
139
|
<span>
|
|
138
|
-
<ElIcon
|
|
140
|
+
<ElIcon>
|
|
141
|
+
<AlarmClock />
|
|
142
|
+
</ElIcon>
|
|
139
143
|
{{ topReadTime }}
|
|
140
144
|
</span>
|
|
141
145
|
</div>
|
|
142
146
|
<div id="hack-article-des" ref="$des" class="meta-des">
|
|
143
147
|
<!-- TODO:是否需要原创?转载等标签,理论上可以添加标签解决,可以参考 charles7c -->
|
|
144
148
|
<span v-if="author && !hiddenAuthor" class="author" :title="authorTitle">
|
|
145
|
-
<ElIcon
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
:href="currentAuthorInfo.url"
|
|
150
|
-
:title="currentAuthorInfo.des"
|
|
151
|
-
>
|
|
149
|
+
<ElIcon>
|
|
150
|
+
<UserFilled />
|
|
151
|
+
</ElIcon>
|
|
152
|
+
<a v-if="currentAuthorInfo" class="link" :href="currentAuthorInfo.url" :title="currentAuthorInfo.des">
|
|
152
153
|
{{ currentAuthorInfo.nickname }}
|
|
153
154
|
</a>
|
|
154
155
|
<template v-else>
|
|
@@ -156,36 +157,48 @@ const timeTitle = computed(() =>
|
|
|
156
157
|
</template>
|
|
157
158
|
</span>
|
|
158
159
|
<span v-if="publishDate && !hiddenTime" class="publishDate" :title="timeTitle + hoverDate">
|
|
159
|
-
<ElIcon
|
|
160
|
+
<ElIcon>
|
|
161
|
+
<Clock />
|
|
162
|
+
</ElIcon>
|
|
160
163
|
{{ publishDate }}
|
|
161
164
|
</span>
|
|
162
|
-
<span v-if="tags.length" class="tags" :title="tagTitle">
|
|
163
|
-
<ElIcon><CollectionTag /></ElIcon>
|
|
164
|
-
<a v-for="tag in tags" :key="tag" class="link" :href="`/?tag=${tag}`">{{ tag }}
|
|
165
|
-
</a>
|
|
166
|
-
</span>
|
|
167
165
|
<template v-if="readingTimePosition === 'inline' && showAnalyze">
|
|
168
166
|
<span :title="wordCountTitle">
|
|
169
|
-
<ElIcon
|
|
167
|
+
<ElIcon>
|
|
168
|
+
<EditPen />
|
|
169
|
+
</ElIcon>
|
|
170
170
|
{{ inlineWordCount }}
|
|
171
171
|
</span>
|
|
172
172
|
<span :title="readTimeTitle">
|
|
173
|
-
<ElIcon
|
|
173
|
+
<ElIcon>
|
|
174
|
+
<AlarmClock />
|
|
175
|
+
</ElIcon>
|
|
174
176
|
{{ inlineReadTime }}
|
|
175
177
|
</span>
|
|
176
178
|
</template>
|
|
177
179
|
<template v-if="readingTimePosition === 'newLine' && showAnalyze">
|
|
178
180
|
<div style="width: 100%;" class="new-line-meta-des">
|
|
179
181
|
<span :title="wordCountTitle">
|
|
180
|
-
<ElIcon
|
|
182
|
+
<ElIcon>
|
|
183
|
+
<EditPen />
|
|
184
|
+
</ElIcon>
|
|
181
185
|
{{ inlineWordCount }}
|
|
182
186
|
</span>
|
|
183
187
|
<span :title="readTimeTitle">
|
|
184
|
-
<ElIcon
|
|
188
|
+
<ElIcon>
|
|
189
|
+
<AlarmClock />
|
|
190
|
+
</ElIcon>
|
|
185
191
|
{{ inlineReadTime }}
|
|
186
192
|
</span>
|
|
187
193
|
</div>
|
|
188
194
|
</template>
|
|
195
|
+
<span v-if="tags.length" class="tags" :title="tagTitle">
|
|
196
|
+
<ElIcon>
|
|
197
|
+
<CollectionTag />
|
|
198
|
+
</ElIcon>
|
|
199
|
+
<a v-for="tag in tags" :key="tag" class="link" :href="`/?tag=${tag}`">{{ tag }}
|
|
200
|
+
</a>
|
|
201
|
+
</span>
|
|
189
202
|
<!-- 封面展示 -->
|
|
190
203
|
<ClientOnly>
|
|
191
204
|
<BlogDocCover />
|
|
@@ -200,26 +213,33 @@ const timeTitle = computed(() =>
|
|
|
200
213
|
margin-bottom: 20px;
|
|
201
214
|
display: flex;
|
|
202
215
|
justify-content: center;
|
|
216
|
+
|
|
203
217
|
span {
|
|
204
218
|
margin-right: 16px;
|
|
205
219
|
display: flex;
|
|
206
220
|
align-items: center;
|
|
221
|
+
|
|
207
222
|
.el-icon {
|
|
208
223
|
margin-right: 4px;
|
|
209
224
|
}
|
|
210
225
|
}
|
|
211
226
|
}
|
|
212
|
-
|
|
227
|
+
|
|
228
|
+
.meta-des,
|
|
229
|
+
.new-line-meta-des {
|
|
213
230
|
text-align: left;
|
|
214
231
|
color: var(--vp-c-text-2);
|
|
215
232
|
font-size: 14px;
|
|
216
233
|
margin-top: 6px;
|
|
217
234
|
display: flex;
|
|
218
235
|
flex-wrap: wrap;
|
|
236
|
+
|
|
219
237
|
>span {
|
|
220
238
|
margin-right: 16px;
|
|
221
239
|
display: flex;
|
|
222
240
|
align-items: center;
|
|
241
|
+
flex-wrap: wrap;
|
|
242
|
+
|
|
223
243
|
.el-icon {
|
|
224
244
|
margin-right: 4px;
|
|
225
245
|
}
|
|
@@ -227,12 +247,14 @@ const timeTitle = computed(() =>
|
|
|
227
247
|
|
|
228
248
|
.link {
|
|
229
249
|
color: var(--vp-c-text-2);
|
|
250
|
+
|
|
230
251
|
&:hover {
|
|
231
252
|
color: var(--vp-c-brand-1);
|
|
232
253
|
cursor: pointer;
|
|
233
254
|
}
|
|
234
255
|
}
|
|
235
256
|
}
|
|
257
|
+
|
|
236
258
|
.tags {
|
|
237
259
|
a.link:not(:last-child) {
|
|
238
260
|
&::after {
|
|
@@ -186,6 +186,10 @@ export function useBlogThemeMode() {
|
|
|
186
186
|
return inject(configSymbol)!.value?.blog?.blog ?? true
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
export function useBlogInfoCollapsible() {
|
|
190
|
+
return inject(configSymbol)!.value?.blog?.home?.blogInfoCollapsible ?? false
|
|
191
|
+
}
|
|
192
|
+
|
|
189
193
|
export function useArticles() {
|
|
190
194
|
const blogConfig = useConfig()
|
|
191
195
|
const { localeIndex, site } = useData()
|
|
@@ -357,7 +361,7 @@ export function useHomeAnalysis() {
|
|
|
357
361
|
}
|
|
358
362
|
|
|
359
363
|
export function useAnalyzeTitles(wordCount: Ref<number>, readTime: ComputedRef<number>) {
|
|
360
|
-
const article =
|
|
364
|
+
const article = useArticleConfig()
|
|
361
365
|
|
|
362
366
|
const topWordCount = computed(() =>
|
|
363
367
|
replaceValue(article.value?.analyzeTitles?.topWordCount || '字数:{{value}} 个字', wordCount.value)
|