@sugarat/theme 0.4.1 → 0.4.2
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
|
@@ -175,6 +175,11 @@ declare namespace Theme {
|
|
|
175
175
|
*/
|
|
176
176
|
style?: 'card' | 'sidebar';
|
|
177
177
|
}
|
|
178
|
+
interface HomeAnalysis {
|
|
179
|
+
articles?: {
|
|
180
|
+
title?: string[];
|
|
181
|
+
};
|
|
182
|
+
}
|
|
178
183
|
interface HomeBlog {
|
|
179
184
|
name?: string;
|
|
180
185
|
motto?: string;
|
|
@@ -187,6 +192,10 @@ declare namespace Theme {
|
|
|
187
192
|
* @default 'card'
|
|
188
193
|
*/
|
|
189
194
|
avatarMode?: 'card' | 'split';
|
|
195
|
+
/**
|
|
196
|
+
* 首页数据分析卡片
|
|
197
|
+
*/
|
|
198
|
+
analysis?: HomeAnalysis;
|
|
190
199
|
}
|
|
191
200
|
interface ArticleConfig {
|
|
192
201
|
readingTime?: boolean;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import { useData } from 'vitepress'
|
|
4
4
|
import { isCurrentWeek } from '../utils/client'
|
|
5
|
-
import { useArticles, useBlogConfig } from '../composables/config/blog'
|
|
5
|
+
import { useArticles, useBlogConfig, useHomeAnalysis } from '../composables/config/blog'
|
|
6
6
|
import BlogAuthor from './BlogAuthor.vue'
|
|
7
7
|
|
|
8
8
|
const { home } = useBlogConfig()
|
|
@@ -31,6 +31,9 @@ const currentWeek = computed(() => {
|
|
|
31
31
|
return isCurrentWeek(pubDate)
|
|
32
32
|
})
|
|
33
33
|
})
|
|
34
|
+
|
|
35
|
+
const analysis = useHomeAnalysis()
|
|
36
|
+
const titles = computed(() => (frontmatter.value?.blog?.analysis?.articles?.title || analysis?.articles?.title || []))
|
|
34
37
|
</script>
|
|
35
38
|
|
|
36
39
|
<template>
|
|
@@ -41,17 +44,17 @@ const currentWeek = computed(() => {
|
|
|
41
44
|
<div class="overview-data">
|
|
42
45
|
<div class="overview-item">
|
|
43
46
|
<span class="count">{{ notHiddenArticles.length }}</span>
|
|
44
|
-
<span class="label"
|
|
47
|
+
<span class="label">{{ titles[0] || '博客文章' }}</span>
|
|
45
48
|
</div>
|
|
46
49
|
<div class="split" />
|
|
47
50
|
<div class="overview-item">
|
|
48
51
|
<span class="count">+{{ currentMonth?.length }}</span>
|
|
49
|
-
<span class="label"
|
|
52
|
+
<span class="label">{{ titles[1] || '本月更新' }}</span>
|
|
50
53
|
</div>
|
|
51
54
|
<div class="split" />
|
|
52
55
|
<div class="overview-item">
|
|
53
56
|
<span class="count">+{{ currentWeek?.length }}</span>
|
|
54
|
-
<span class="label"
|
|
57
|
+
<span class="label">{{ titles[2] || '本周更新' }}</span>
|
|
55
58
|
</div>
|
|
56
59
|
</div>
|
|
57
60
|
</div>
|
|
@@ -233,3 +233,7 @@ export function useCleanUrls() {
|
|
|
233
233
|
export function useImageStyle() {
|
|
234
234
|
return inject(configSymbol)?.value?.blog?.imageStyle || {} as Theme.ImageStyleConfig
|
|
235
235
|
}
|
|
236
|
+
|
|
237
|
+
export function useHomeAnalysis() {
|
|
238
|
+
return inject(configSymbol)?.value?.blog?.home?.analysis
|
|
239
|
+
}
|
|
@@ -185,6 +185,12 @@ export namespace Theme {
|
|
|
185
185
|
style?: 'card' | 'sidebar'
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
+
export interface HomeAnalysis {
|
|
189
|
+
articles?: {
|
|
190
|
+
title?: string[]
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
188
194
|
export interface HomeBlog {
|
|
189
195
|
name?: string
|
|
190
196
|
motto?: string
|
|
@@ -197,6 +203,10 @@ export namespace Theme {
|
|
|
197
203
|
* @default 'card'
|
|
198
204
|
*/
|
|
199
205
|
avatarMode?: 'card' | 'split'
|
|
206
|
+
/**
|
|
207
|
+
* 首页数据分析卡片
|
|
208
|
+
*/
|
|
209
|
+
analysis?: HomeAnalysis
|
|
200
210
|
}
|
|
201
211
|
|
|
202
212
|
export interface ArticleConfig {
|