clarity-theme 0.1.0 → 0.1.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/LICENSE +20 -20
- package/README.md +70 -4
- package/README.zh-CN.md +67 -4
- package/nuxt.config.ts +217 -214
- package/package.json +35 -37
- package/{app → src}/app.config.ts +110 -110
- package/{app → src}/app.vue +5 -5
- package/{app → src}/components/blog/BlogAside.vue +25 -25
- package/{app → src}/components/blog/BlogFooter.vue +25 -25
- package/{app → src}/components/blog/BlogHeader.global.vue +48 -48
- package/{app → src}/components/blog/BlogPanel.vue +43 -43
- package/{app → src}/components/blog/BlogSidebar.vue +53 -53
- package/{app → src}/components/blog/BlogWidget.vue +42 -42
- package/{app → src}/components/blog/Mask.vue +25 -25
- package/{app → src}/components/blog/SkipToContent.vue +9 -9
- package/{app → src}/components/blog/ThemeToggle.vue +22 -22
- package/{app → src}/components/content/Badge.vue +45 -45
- package/{app → src}/components/content/Blur.vue +14 -14
- package/{app → src}/components/content/CardList.vue +8 -8
- package/{app → src}/components/content/Chat.vue +41 -41
- package/{app → src}/components/content/Copy.vue +71 -71
- package/{app → src}/components/content/EmojiClock.vue +49 -49
- package/{app → src}/components/content/FeedCard.vue +96 -96
- package/{app → src}/components/content/FeedGroup.vue +61 -61
- package/{app → src}/components/content/Folding.vue +19 -19
- package/{app → src}/components/content/Key.vue +143 -143
- package/{app → src}/components/content/LinkBanner.vue +27 -27
- package/{app → src}/components/content/LinkCard.vue +28 -28
- package/{app → src}/components/content/MdTitle.vue +8 -8
- package/{app → src}/components/content/Mermaid.vue +99 -99
- package/{app → src}/components/content/MusicScore.vue +63 -63
- package/{app → src}/components/content/Pic.vue +49 -49
- package/{app → src}/components/content/Poetry.vue +27 -27
- package/{app → src}/components/content/ProseA.vue +24 -24
- package/{app → src}/components/content/ProseCode.vue +16 -16
- package/{app → src}/components/content/ProsePre.vue +117 -117
- package/{app → src}/components/content/ProseTable.vue +23 -23
- package/{app → src}/components/content/Quote.vue +21 -21
- package/{app → src}/components/content/Tab.vue +32 -32
- package/{app → src}/components/content/Timeline.vue +33 -33
- package/{app → src}/components/content/Tip.vue +40 -40
- package/{app → src}/components/content/VideoEmbed.vue +112 -112
- package/{app → src}/components/partial/Button.vue +36 -36
- package/{app → src}/components/partial/DlGroup.vue +31 -31
- package/{app → src}/components/partial/Dropdown.vue +21 -21
- package/{app → src}/components/partial/Error.vue +39 -39
- package/{app → src}/components/partial/Expand.vue +26 -26
- package/{app → src}/components/partial/IconNavList.vue +24 -24
- package/{app → src}/components/partial/Pagination.vue +62 -62
- package/{app → src}/components/partial/RadioGroup.vue +30 -30
- package/{app → src}/components/partial/Secret.vue +11 -11
- package/{app → src}/components/partial/Slider.vue +48 -48
- package/{app → src}/components/partial/Toggle.vue +17 -17
- package/{app → src}/components/popover/Lightbox.vue +44 -44
- package/{app → src}/components/popover/Search.vue +143 -143
- package/{app → src}/components/popover/SearchItem.vue +28 -28
- package/{app → src}/components/post/Archive.vue +40 -40
- package/{app → src}/components/post/Article.vue +49 -49
- package/{app → src}/components/post/Comment.vue +119 -119
- package/{app → src}/components/post/Excerpt.vue +40 -40
- package/{app → src}/components/post/OrderToggle.vue +70 -70
- package/{app → src}/components/post/PostFooter.vue +52 -52
- package/{app → src}/components/post/PostHeader.vue +66 -66
- package/{app → src}/components/post/PostSurround.vue +51 -51
- package/{app → src}/components/post/Slide.vue +85 -85
- package/{app → src}/components/util/Date.vue +62 -62
- package/{app → src}/components/util/HydrateSafe.vue +10 -10
- package/{app → src}/components/util/Img.vue +38 -38
- package/{app → src}/components/util/Link.vue +11 -11
- package/{app → src}/components/widget/BlogLog.vue +23 -23
- package/{app → src}/components/widget/BlogStats.vue +38 -38
- package/{app → src}/components/widget/BlogTech.vue +57 -57
- package/{app → src}/components/widget/Empty.vue +3 -3
- package/{app → src}/components/widget/Toc.vue +67 -67
- package/{app → src}/composables/useArticle.ts +115 -115
- package/{app → src}/composables/useAvoid.ts +87 -87
- package/{app → src}/composables/useCopy.ts +21 -21
- package/{app → src}/composables/usePagination.ts +70 -70
- package/{app → src}/composables/useShiki.ts +129 -129
- package/{app → src}/composables/useToc.ts +57 -57
- package/{app → src}/composables/useWidgets.ts +56 -56
- package/{config → src/config}/app.ts +62 -62
- package/{config → src/config}/content.ts +75 -75
- package/{config → src/config}/define.ts +3 -3
- package/src/config/feeds.empty.ts +6 -0
- package/{config → src/config}/index.ts +1 -1
- package/{config → src/config}/schema.ts +89 -89
- package/{app → src}/error.vue +31 -31
- package/{img → src/img}/index.ts +2 -2
- package/{app → src}/layouts/default.vue +25 -25
- package/{modules → src/modules}/clarity-config/index.ts +168 -162
- package/src/modules/clarity-source-layout/index.ts +78 -0
- package/{app → src}/pages/[...slug].vue +59 -59
- package/{app → src}/pages/archive.vue +129 -129
- package/{app → src}/pages/index.vue +76 -76
- package/{app → src}/pages/link.vue +62 -62
- package/{app → src}/pages/preview.vue +46 -46
- package/{app → src}/plugins/easter-egg.ts +23 -23
- package/{app → src}/plugins/init.ts +6 -6
- package/{app → src}/plugins/tippy.ts +22 -22
- package/{public → src/public}/assets/atom.css +274 -274
- package/{public → src/public}/assets/atom.xsl +109 -109
- package/{remark-plugins → src/remark-plugins}/rehype-meta-slots.ts +58 -58
- package/{remark-plugins → src/remark-plugins}/remark-code-component.ts +41 -41
- package/{server → src/server}/api/stats.get.ts +84 -83
- package/{server → src/server}/routes/atom.xml.get.ts +85 -85
- package/{server → src/server}/routes/subscriptions.opml.get.ts +64 -64
- package/{shared → src/shared}/utils/clarity.ts +24 -24
- package/{shared → src/shared}/utils/icon.ts +218 -218
- package/{shared → src/shared}/utils/link.ts +52 -52
- package/{shared → src/shared}/utils/str.ts +88 -88
- package/{shared → src/shared}/utils/time.ts +115 -115
- package/{app → src}/shiki.config.ts +8 -8
- package/{app → src}/stores/layout.ts +34 -34
- package/{app → src}/stores/search.ts +37 -37
- package/{app → src}/types/article.ts +16 -16
- package/src/types/feed.ts +1 -0
- package/{app → src}/types/index.ts +14 -14
- package/{app → src}/types/nav.ts +11 -11
- package/{app → src}/utils/anim.ts +37 -37
- package/{app → src}/utils/img.ts +83 -83
- package/app/types/feed.ts +0 -1
- package/config/feeds.empty.ts +0 -4
- package/{app → src}/assets/css/_variable.scss +0 -0
- package/{app → src}/assets/css/animation.scss +0 -0
- package/{app → src}/assets/css/article.scss +0 -0
- package/{app → src}/assets/css/color.scss +0 -0
- package/{app → src}/assets/css/font.scss +0 -0
- package/{app → src}/assets/css/main.scss +0 -0
- package/{app → src}/assets/css/reusable.scss +0 -0
- package/{app → src}/assets/icons/solar-rewind-back-bold-duotone.svg +0 -0
- package/{app → src}/assets/icons/solar-rewind-forward-bold-duotone.svg +0 -0
- package/{app → src}/components/content/Alert.vue +0 -0
- package/{config → src/config}/content.d.mts +0 -0
- package/{config → src/config}/content.mjs +0 -0
- package/{config → src/config}/define.mjs +0 -0
- package/{config → src/config}/feed.ts +0 -0
- package/{config → src/config}/index.d.mts +0 -0
- package/{config → src/config}/index.mjs +0 -0
- package/{config → src/config}/public.ts +1 -1
- package/{config → src/config}/schema.d.mts +0 -0
- package/{config → src/config}/schema.mjs +0 -0
- package/{config → src/config}/server.ts +1 -1
- /package/{img → src/img}/index.d.mts +0 -0
- /package/{img → src/img}/index.mjs +0 -0
- /package/{modules → src/modules}/clarity-config/anti-mirror-client.ts +0 -0
- /package/{public → src/public}/fonts/AlimamaFangYuanTi.woff2 +0 -0
- /package/{remark-plugins → src/remark-plugins}/rehype-meta-slots.d.mts +0 -0
- /package/{remark-plugins → src/remark-plugins}/rehype-meta-slots.mjs +0 -0
- /package/{remark-plugins → src/remark-plugins}/remark-code-component.d.mts +0 -0
- /package/{remark-plugins → src/remark-plugins}/remark-code-component.mjs +0 -0
- /package/{server → src/server}/utils/clarity.ts +0 -0
- /package/{shared → src/shared}/types/content.ts +0 -0
- /package/{app → src}/types/modal.ts +0 -0
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import type { ReadTimeResults } from 'reading-time'
|
|
1
|
+
import type { ReadTimeResults } from 'reading-time'
|
|
2
2
|
import type { ClarityConfig } from './schema'
|
|
3
3
|
import { defineCollection, defineContentConfig } from '@nuxt/content'
|
|
4
|
-
import { defineSitemapSchema } from '@nuxtjs/sitemap/content'
|
|
4
|
+
import { defineSitemapSchema } from '@nuxtjs/sitemap/content'
|
|
5
5
|
import { z } from 'zod'
|
|
6
|
-
import { clarityConfigSchema } from './schema'
|
|
7
|
-
|
|
8
|
-
export interface ArticleSchema {
|
|
9
|
-
title?: string
|
|
10
|
-
description?: string
|
|
11
|
-
date?: string
|
|
12
|
-
updated?: string
|
|
13
|
-
published?: string
|
|
14
|
-
categories?: string[]
|
|
15
|
-
tags?: string[]
|
|
16
|
-
type?: keyof ClarityConfig['article']['types']
|
|
17
|
-
|
|
18
|
-
image?: string
|
|
19
|
-
recommend?: number
|
|
20
|
-
references?: { title?: string, link?: string }[]
|
|
21
|
-
draft?: boolean
|
|
22
|
-
permalink?: string
|
|
23
|
-
|
|
24
|
-
readingTime?: ReadTimeResults
|
|
25
|
-
}
|
|
26
|
-
|
|
6
|
+
import { clarityConfigSchema } from './schema'
|
|
7
|
+
|
|
8
|
+
export interface ArticleSchema {
|
|
9
|
+
title?: string
|
|
10
|
+
description?: string
|
|
11
|
+
date?: string
|
|
12
|
+
updated?: string
|
|
13
|
+
published?: string
|
|
14
|
+
categories?: string[]
|
|
15
|
+
tags?: string[]
|
|
16
|
+
type?: keyof ClarityConfig['article']['types']
|
|
17
|
+
|
|
18
|
+
image?: string
|
|
19
|
+
recommend?: number
|
|
20
|
+
references?: { title?: string, link?: string }[]
|
|
21
|
+
draft?: boolean
|
|
22
|
+
permalink?: string
|
|
23
|
+
|
|
24
|
+
readingTime?: ReadTimeResults
|
|
25
|
+
}
|
|
26
|
+
|
|
27
27
|
function createArticleSchema(config: ClarityConfig) {
|
|
28
28
|
// 兜底:types 为空时 z.enum([]) 非法,统一回退到默认版式
|
|
29
29
|
const articleTypes = Object.keys(config.article.types)
|
|
30
30
|
const typeValues = articleTypes.length > 0 ? articleTypes : ['tech']
|
|
31
|
-
|
|
32
|
-
return z.object({
|
|
33
|
-
title: z.string().optional(),
|
|
34
|
-
description: z.string().optional(),
|
|
35
|
-
date: z.string().optional(),
|
|
36
|
-
updated: z.string().optional(),
|
|
37
|
-
published: z.string().optional(),
|
|
38
|
-
categories: z.array(z.string()).default([config.article.defaultCategory]),
|
|
39
|
-
tags: z.array(z.string()).default([]),
|
|
31
|
+
|
|
32
|
+
return z.object({
|
|
33
|
+
title: z.string().optional(),
|
|
34
|
+
description: z.string().optional(),
|
|
35
|
+
date: z.string().optional(),
|
|
36
|
+
updated: z.string().optional(),
|
|
37
|
+
published: z.string().optional(),
|
|
38
|
+
categories: z.array(z.string()).default([config.article.defaultCategory]),
|
|
39
|
+
tags: z.array(z.string()).default([]),
|
|
40
40
|
type: z.enum(typeValues as any).optional().default(typeValues[0]),
|
|
41
|
-
|
|
42
|
-
image: z.string().optional(),
|
|
43
|
-
recommend: z.number().optional(),
|
|
44
|
-
references: z.array(z.object({
|
|
45
|
-
title: z.string().optional(),
|
|
46
|
-
link: z.string().optional(),
|
|
47
|
-
})).optional(),
|
|
48
|
-
draft: z.boolean().default(false),
|
|
49
|
-
permalink: z.string().optional(),
|
|
50
|
-
|
|
51
|
-
readingTime: z.object({
|
|
52
|
-
text: z.string(),
|
|
53
|
-
minutes: z.number(),
|
|
54
|
-
time: z.number(),
|
|
55
|
-
words: z.number(),
|
|
56
|
-
}),
|
|
57
|
-
}) satisfies z.ZodType<ArticleSchema>
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* 在消费项目 content.config.ts 中生成 Clarity Content 集合:
|
|
62
|
-
*
|
|
63
|
-
* ```ts
|
|
64
|
-
* import clarityConfig from './clarity.config'
|
|
65
|
-
* import { createClarityContentConfig } from 'clarity-theme/content'
|
|
66
|
-
* export default createClarityContentConfig(clarityConfig)
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
41
|
+
|
|
42
|
+
image: z.string().optional(),
|
|
43
|
+
recommend: z.number().optional(),
|
|
44
|
+
references: z.array(z.object({
|
|
45
|
+
title: z.string().optional(),
|
|
46
|
+
link: z.string().optional(),
|
|
47
|
+
})).optional(),
|
|
48
|
+
draft: z.boolean().default(false),
|
|
49
|
+
permalink: z.string().optional(),
|
|
50
|
+
|
|
51
|
+
readingTime: z.object({
|
|
52
|
+
text: z.string(),
|
|
53
|
+
minutes: z.number(),
|
|
54
|
+
time: z.number(),
|
|
55
|
+
words: z.number(),
|
|
56
|
+
}),
|
|
57
|
+
}) satisfies z.ZodType<ArticleSchema>
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 在消费项目 content.config.ts 中生成 Clarity Content 集合:
|
|
62
|
+
*
|
|
63
|
+
* ```ts
|
|
64
|
+
* import clarityConfig from './clarity.config'
|
|
65
|
+
* import { createClarityContentConfig } from 'clarity-theme/content'
|
|
66
|
+
* export default createClarityContentConfig(clarityConfig)
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
69
|
export function createClarityContentConfig(config: ClarityConfig) {
|
|
70
70
|
const parsed = clarityConfigSchema.parse(config)
|
|
71
71
|
return defineContentConfig({
|
|
@@ -74,18 +74,18 @@ export function createClarityContentConfig(config: ClarityConfig) {
|
|
|
74
74
|
source: '**',
|
|
75
75
|
type: 'page',
|
|
76
76
|
schema: createArticleSchema(parsed).extend({
|
|
77
|
-
sitemap: defineSitemapSchema({
|
|
78
|
-
name: 'content',
|
|
79
|
-
onUrl: (url, entry) => {
|
|
80
|
-
const lastmod = (entry.updated || entry.published || entry.date) as string | undefined
|
|
81
|
-
if (lastmod) {
|
|
82
|
-
url.lastmod = new Date(lastmod).toLocaleDateString('sv')
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
z,
|
|
86
|
-
}),
|
|
87
|
-
}),
|
|
88
|
-
}),
|
|
89
|
-
},
|
|
90
|
-
})
|
|
91
|
-
}
|
|
77
|
+
sitemap: defineSitemapSchema({
|
|
78
|
+
name: 'content',
|
|
79
|
+
onUrl: (url, entry) => {
|
|
80
|
+
const lastmod = (entry.updated || entry.published || entry.date) as string | undefined
|
|
81
|
+
if (lastmod) {
|
|
82
|
+
url.lastmod = new Date(lastmod).toLocaleDateString('sv')
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
z,
|
|
86
|
+
}),
|
|
87
|
+
}),
|
|
88
|
+
}),
|
|
89
|
+
},
|
|
90
|
+
})
|
|
91
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ClarityConfig, ClarityConfigInput } from './schema'
|
|
2
|
-
import { clarityConfigSchema } from './schema'
|
|
3
|
-
|
|
1
|
+
import type { ClarityConfig, ClarityConfigInput } from './schema'
|
|
2
|
+
import { clarityConfigSchema } from './schema'
|
|
3
|
+
|
|
4
4
|
/**
|
|
5
5
|
* 定义 Clarity Theme 站点配置
|
|
6
6
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { Nav, NavItem } from '../
|
|
1
|
+
export type { Nav, NavItem } from '../types/nav'
|
|
2
2
|
export type { ClarityAppConfig, ClarityUiConfig, ClarityUiConfigInput, NavGroup } from './app'
|
|
3
3
|
export { defineClarityConfig } from './define'
|
|
4
4
|
export type { Arch, FeedEntry, FeedGroup } from './feed'
|
|
@@ -5,50 +5,50 @@ import { z } from 'zod'
|
|
|
5
5
|
* 未知字段直接报错,而不是被静默丢弃(防止拼写错误悄悄失效)。
|
|
6
6
|
* 唯一例外:article.types 的值使用 looseObject,作为版式扩展位。
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
/** 注入到 <head> 的脚本(统计、评论等第三方脚本) */
|
|
10
|
-
export const clarityHeadScriptSchema = z.record(z.string(), z.union([
|
|
11
|
-
z.string(),
|
|
12
|
-
z.number(),
|
|
13
|
-
z.boolean(),
|
|
14
|
-
]))
|
|
15
|
-
|
|
8
|
+
|
|
9
|
+
/** 注入到 <head> 的脚本(统计、评论等第三方脚本) */
|
|
10
|
+
export const clarityHeadScriptSchema = z.record(z.string(), z.union([
|
|
11
|
+
z.string(),
|
|
12
|
+
z.number(),
|
|
13
|
+
z.boolean(),
|
|
14
|
+
]))
|
|
15
|
+
|
|
16
16
|
export const clarityAuthorSchema = z.strictObject({
|
|
17
|
-
name: z.string().min(1),
|
|
18
|
-
avatar: z.string().optional(),
|
|
19
|
-
email: z.string().optional(),
|
|
20
|
-
homepage: z.string().optional(),
|
|
21
|
-
})
|
|
22
|
-
|
|
17
|
+
name: z.string().min(1),
|
|
18
|
+
avatar: z.string().optional(),
|
|
19
|
+
email: z.string().optional(),
|
|
20
|
+
homepage: z.string().optional(),
|
|
21
|
+
})
|
|
22
|
+
|
|
23
23
|
export const claritySiteSchema = z.strictObject({
|
|
24
|
-
title: z.string().min(1),
|
|
25
|
-
subtitle: z.string().optional(),
|
|
26
|
-
description: z.string().min(1),
|
|
24
|
+
title: z.string().min(1),
|
|
25
|
+
subtitle: z.string().optional(),
|
|
26
|
+
description: z.string().min(1),
|
|
27
27
|
/** 站点规范 URL(以 / 结尾,用于 new URL() 相对路径解析) */
|
|
28
28
|
url: z.string().url().refine(
|
|
29
29
|
value => value.endsWith('/'),
|
|
30
30
|
'站点 URL 必须以 / 结尾(例如 https://example.com/)',
|
|
31
31
|
),
|
|
32
|
-
language: z.string().default('zh-CN'),
|
|
33
|
-
timezone: z.string().default('Asia/Shanghai'),
|
|
34
|
-
/** 建站日期 */
|
|
35
|
-
established: z.string().optional(),
|
|
36
|
-
favicon: z.string().default('/favicon.svg'),
|
|
37
|
-
author: clarityAuthorSchema,
|
|
32
|
+
language: z.string().default('zh-CN'),
|
|
33
|
+
timezone: z.string().default('Asia/Shanghai'),
|
|
34
|
+
/** 建站日期 */
|
|
35
|
+
established: z.string().optional(),
|
|
36
|
+
favicon: z.string().default('/favicon.svg'),
|
|
37
|
+
author: clarityAuthorSchema,
|
|
38
38
|
copyright: z.strictObject({
|
|
39
|
-
abbr: z.string().optional(),
|
|
40
|
-
name: z.string().optional(),
|
|
41
|
-
url: z.string().optional(),
|
|
42
|
-
}).optional(),
|
|
43
|
-
})
|
|
44
|
-
|
|
39
|
+
abbr: z.string().optional(),
|
|
40
|
+
name: z.string().optional(),
|
|
41
|
+
url: z.string().optional(),
|
|
42
|
+
}).optional(),
|
|
43
|
+
})
|
|
44
|
+
|
|
45
45
|
export const clarityArticleSchema = z.strictObject({
|
|
46
|
-
defaultCategory: z.string().default('未分类'),
|
|
46
|
+
defaultCategory: z.string().default('未分类'),
|
|
47
47
|
categories: z.record(z.string(), z.strictObject({
|
|
48
|
-
icon: z.string().optional(),
|
|
49
|
-
color: z.string().optional(),
|
|
50
|
-
})).default({}),
|
|
51
|
-
/** 文章版式,首个为默认版式 */
|
|
48
|
+
icon: z.string().optional(),
|
|
49
|
+
color: z.string().optional(),
|
|
50
|
+
})).default({}),
|
|
51
|
+
/** 文章版式,首个为默认版式 */
|
|
52
52
|
types: z.record(z.string(), z.looseObject({})).default({ tech: {} }),
|
|
53
53
|
/** 分类排序方式,键为排序字段,值为显示名称 */
|
|
54
54
|
order: z.record(z.string(), z.string()).default({ date: '创建日期', updated: '更新日期' }),
|
|
@@ -56,54 +56,54 @@ export const clarityArticleSchema = z.strictObject({
|
|
|
56
56
|
hidePostPrefix: z.boolean().default(true),
|
|
57
57
|
/** 禁止搜索引擎收录的路径,仅模块构建期使用 */
|
|
58
58
|
robotsNotIndex: z.array(z.string()).default([]),
|
|
59
|
-
})
|
|
60
|
-
|
|
59
|
+
})
|
|
60
|
+
|
|
61
61
|
export const clarityFeedSchema = z.strictObject({
|
|
62
|
-
/** 订阅源最大文章数量 */
|
|
63
|
-
limit: z.number().int().positive().default(50),
|
|
64
|
-
/** 订阅源是否启用 XSLT 样式 */
|
|
65
|
-
enableStyle: z.boolean().default(true),
|
|
66
|
-
})
|
|
67
|
-
|
|
62
|
+
/** 订阅源最大文章数量 */
|
|
63
|
+
limit: z.number().int().positive().default(50),
|
|
64
|
+
/** 订阅源是否启用 XSLT 样式 */
|
|
65
|
+
enableStyle: z.boolean().default(true),
|
|
66
|
+
})
|
|
67
|
+
|
|
68
68
|
export const clarityStatsSchema = z.strictObject({
|
|
69
|
-
/**
|
|
70
|
-
* 统计范围,匹配 content 下不含扩展名的路径(stem);空数组统计全部内容
|
|
71
|
-
* 使用 SQL LIKE 语法: % 匹配任意长度字符, _ 匹配单个字符
|
|
72
|
-
*/
|
|
73
|
-
includePaths: z.array(z.string()).default([]),
|
|
74
|
-
})
|
|
75
|
-
|
|
69
|
+
/**
|
|
70
|
+
* 统计范围,匹配 content 下不含扩展名的路径(stem);空数组统计全部内容
|
|
71
|
+
* 使用 SQL LIKE 语法: % 匹配任意长度字符, _ 匹配单个字符
|
|
72
|
+
*/
|
|
73
|
+
includePaths: z.array(z.string()).default([]),
|
|
74
|
+
})
|
|
75
|
+
|
|
76
76
|
export const clarityIntegrationsSchema = z.strictObject({
|
|
77
|
-
/** Twikoo 评论系统,未配置时不渲染评论区 */
|
|
77
|
+
/** Twikoo 评论系统,未配置时不渲染评论区 */
|
|
78
78
|
twikoo: z.strictObject({
|
|
79
|
-
envId: z.string(),
|
|
80
|
-
/** 预连接地址,默认使用 envId */
|
|
81
|
-
preload: z.string().optional(),
|
|
82
|
-
}).optional(),
|
|
79
|
+
envId: z.string(),
|
|
80
|
+
/** 预连接地址,默认使用 envId */
|
|
81
|
+
preload: z.string().optional(),
|
|
82
|
+
}).optional(),
|
|
83
83
|
/** 向 <head> 中添加的脚本,仅模块构建期注入,不进入 appConfig */
|
|
84
84
|
scripts: z.array(clarityHeadScriptSchema).default([]),
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
export const clarityAntiMirrorSchema = z.union([
|
|
88
|
-
z.boolean(),
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
export const clarityAntiMirrorSchema = z.union([
|
|
88
|
+
z.boolean(),
|
|
89
89
|
z.strictObject({
|
|
90
|
-
/** 需要跳转回源站的镜像站域名后缀 */
|
|
91
|
-
blacklist: z.array(z.string()).default([]),
|
|
92
|
-
}),
|
|
93
|
-
])
|
|
94
|
-
|
|
90
|
+
/** 需要跳转回源站的镜像站域名后缀 */
|
|
91
|
+
blacklist: z.array(z.string()).default([]),
|
|
92
|
+
}),
|
|
93
|
+
])
|
|
94
|
+
|
|
95
95
|
export const clarityFeaturesSchema = z.strictObject({
|
|
96
|
-
atom: z.boolean().default(true),
|
|
97
|
-
opml: z.boolean().default(true),
|
|
98
|
-
stats: z.boolean().default(true),
|
|
99
|
-
antiMirror: clarityAntiMirrorSchema.default(false),
|
|
100
|
-
})
|
|
101
|
-
|
|
96
|
+
atom: z.boolean().default(true),
|
|
97
|
+
opml: z.boolean().default(true),
|
|
98
|
+
stats: z.boolean().default(true),
|
|
99
|
+
antiMirror: clarityAntiMirrorSchema.default(false),
|
|
100
|
+
})
|
|
101
|
+
|
|
102
102
|
export const clarityChangelogEntrySchema = z.strictObject({
|
|
103
|
-
date: z.string(),
|
|
104
|
-
text: z.string(),
|
|
105
|
-
})
|
|
106
|
-
|
|
103
|
+
date: z.string(),
|
|
104
|
+
text: z.string(),
|
|
105
|
+
})
|
|
106
|
+
|
|
107
107
|
export const clarityConfigSchema = z.strictObject({
|
|
108
108
|
site: claritySiteSchema,
|
|
109
109
|
article: clarityArticleSchema.prefault({}),
|
|
@@ -111,19 +111,19 @@ export const clarityConfigSchema = z.strictObject({
|
|
|
111
111
|
stats: clarityStatsSchema.prefault({}),
|
|
112
112
|
integrations: clarityIntegrationsSchema.prefault({}),
|
|
113
113
|
features: clarityFeaturesSchema.prefault({}),
|
|
114
|
-
/** 更新日志组件数据,按时间倒序展示 */
|
|
115
|
-
changelog: z.array(clarityChangelogEntrySchema).default([]),
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
export type ClarityHeadScript = z.output<typeof clarityHeadScriptSchema>
|
|
119
|
-
export type ClarityAuthor = z.output<typeof clarityAuthorSchema>
|
|
120
|
-
export type ClaritySiteConfig = z.output<typeof claritySiteSchema>
|
|
121
|
-
export type ClarityArticleConfig = z.output<typeof clarityArticleSchema>
|
|
122
|
-
export type ClarityFeedConfig = z.output<typeof clarityFeedSchema>
|
|
123
|
-
export type ClarityStatsConfig = z.output<typeof clarityStatsSchema>
|
|
124
|
-
export type ClarityIntegrationsConfig = z.output<typeof clarityIntegrationsSchema>
|
|
125
|
-
export type ClarityAntiMirrorConfig = z.output<typeof clarityAntiMirrorSchema>
|
|
126
|
-
export type ClarityFeaturesConfig = z.output<typeof clarityFeaturesSchema>
|
|
127
|
-
export type ClarityChangelogEntry = z.output<typeof clarityChangelogEntrySchema>
|
|
128
|
-
export type ClarityConfig = z.output<typeof clarityConfigSchema>
|
|
129
|
-
export type ClarityConfigInput = z.input<typeof clarityConfigSchema>
|
|
114
|
+
/** 更新日志组件数据,按时间倒序展示 */
|
|
115
|
+
changelog: z.array(clarityChangelogEntrySchema).default([]),
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
export type ClarityHeadScript = z.output<typeof clarityHeadScriptSchema>
|
|
119
|
+
export type ClarityAuthor = z.output<typeof clarityAuthorSchema>
|
|
120
|
+
export type ClaritySiteConfig = z.output<typeof claritySiteSchema>
|
|
121
|
+
export type ClarityArticleConfig = z.output<typeof clarityArticleSchema>
|
|
122
|
+
export type ClarityFeedConfig = z.output<typeof clarityFeedSchema>
|
|
123
|
+
export type ClarityStatsConfig = z.output<typeof clarityStatsSchema>
|
|
124
|
+
export type ClarityIntegrationsConfig = z.output<typeof clarityIntegrationsSchema>
|
|
125
|
+
export type ClarityAntiMirrorConfig = z.output<typeof clarityAntiMirrorSchema>
|
|
126
|
+
export type ClarityFeaturesConfig = z.output<typeof clarityFeaturesSchema>
|
|
127
|
+
export type ClarityChangelogEntry = z.output<typeof clarityChangelogEntrySchema>
|
|
128
|
+
export type ClarityConfig = z.output<typeof clarityConfigSchema>
|
|
129
|
+
export type ClarityConfigInput = z.input<typeof clarityConfigSchema>
|
package/{app → src}/error.vue
RENAMED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { NuxtError } from '#app'
|
|
3
|
-
|
|
4
|
-
defineProps<{
|
|
5
|
-
error: NuxtError & { url?: string }
|
|
6
|
-
}>()
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<template>
|
|
10
|
-
<NuxtLayout>
|
|
11
|
-
<template #aside>
|
|
12
|
-
<WidgetBlogLog />
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<div class="app-error">
|
|
16
|
-
<ZError
|
|
17
|
-
:code="error.stack"
|
|
18
|
-
:message="error.url"
|
|
19
|
-
:title="`[${error.status}] ${error.message}`"
|
|
20
|
-
>
|
|
21
|
-
<template #operation>
|
|
22
|
-
<ZButton text="返回主页" @click="clearError({ redirect: '/' })" />
|
|
23
|
-
<ZButton text="尝试忽略" @click="clearError()" />
|
|
24
|
-
</template>
|
|
25
|
-
</ZError>
|
|
26
|
-
</div>
|
|
27
|
-
</NuxtLayout>
|
|
28
|
-
</template>
|
|
29
|
-
|
|
30
|
-
<style lang="scss" scoped>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { NuxtError } from '#app'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
error: NuxtError & { url?: string }
|
|
6
|
+
}>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<NuxtLayout>
|
|
11
|
+
<template #aside>
|
|
12
|
+
<WidgetBlogLog />
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<div class="app-error">
|
|
16
|
+
<ZError
|
|
17
|
+
:code="error.stack"
|
|
18
|
+
:message="error.url"
|
|
19
|
+
:title="`[${error.status}] ${error.message}`"
|
|
20
|
+
>
|
|
21
|
+
<template #operation>
|
|
22
|
+
<ZButton text="返回主页" @click="clearError({ redirect: '/' })" />
|
|
23
|
+
<ZButton text="尝试忽略" @click="clearError()" />
|
|
24
|
+
</template>
|
|
25
|
+
</ZError>
|
|
26
|
+
</div>
|
|
27
|
+
</NuxtLayout>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<style lang="scss" scoped>
|
|
31
31
|
.app-error {
|
|
32
32
|
margin: 1rem;
|
|
33
33
|
}
|
|
34
|
-
</style>
|
|
34
|
+
</style>
|
package/{img → src/img}/index.ts
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `clarity-theme/img` 类型真源。
|
|
3
3
|
*
|
|
4
|
-
* 类型实现复用 `
|
|
4
|
+
* 类型实现复用 `src/utils/img.ts`(Layer 内部与包导出共享同一份签名),
|
|
5
5
|
* 运行时实现在同目录 index.mjs:Node 原生 TS 剥离不允许
|
|
6
6
|
* node_modules 内的 TS 文件,因此包入口运行时必须是 .mjs。
|
|
7
7
|
*/
|
|
8
|
-
export * from '../
|
|
8
|
+
export * from '../utils/img'
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
const { slots } = inject<any>(Symbol.for('dxup:layout-slots')) || {}
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<template>
|
|
6
|
-
<NuxtLoadingIndicator />
|
|
7
|
-
<NuxtRouteAnnouncer :style="{ position: 'absolute' }" />
|
|
8
|
-
<BlogSkipToContent />
|
|
9
|
-
<BlogSidebar />
|
|
10
|
-
<div id="content">
|
|
11
|
-
<main id="main-content">
|
|
12
|
-
<slot />
|
|
13
|
-
<BlogFooter />
|
|
14
|
-
</main>
|
|
15
|
-
<BlogAside>
|
|
16
|
-
<slot name="aside" />
|
|
17
|
-
</BlogAside>
|
|
18
|
-
</div>
|
|
19
|
-
<BlogPanel :has-aside="!!slots?.aside" />
|
|
20
|
-
<BikariyaModals />
|
|
21
|
-
</template>
|
|
22
|
-
|
|
23
|
-
<!-- eslint-disable-next-line vue/enforce-style-attribute -->
|
|
24
|
-
<style lang="scss">
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { slots } = inject<any>(Symbol.for('dxup:layout-slots')) || {}
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<NuxtLoadingIndicator />
|
|
7
|
+
<NuxtRouteAnnouncer :style="{ position: 'absolute' }" />
|
|
8
|
+
<BlogSkipToContent />
|
|
9
|
+
<BlogSidebar />
|
|
10
|
+
<div id="content">
|
|
11
|
+
<main id="main-content">
|
|
12
|
+
<slot />
|
|
13
|
+
<BlogFooter />
|
|
14
|
+
</main>
|
|
15
|
+
<BlogAside>
|
|
16
|
+
<slot name="aside" />
|
|
17
|
+
</BlogAside>
|
|
18
|
+
</div>
|
|
19
|
+
<BlogPanel :has-aside="!!slots?.aside" />
|
|
20
|
+
<BikariyaModals />
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<!-- eslint-disable-next-line vue/enforce-style-attribute -->
|
|
24
|
+
<style lang="scss">
|
|
25
25
|
#blog-root {
|
|
26
26
|
display: flex;
|
|
27
27
|
justify-content: center;
|
|
@@ -63,4 +63,4 @@ const { slots } = inject<any>(Symbol.for('dxup:layout-slots')) || {}
|
|
|
63
63
|
min-width: 0;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
</style>
|
|
66
|
+
</style>
|