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,218 +1,218 @@
|
|
|
1
|
-
/** 友链架构图标映射 */
|
|
2
|
-
// @keep-sorted
|
|
3
|
-
const archIcons = {
|
|
4
|
-
'Astro': 'simple-icons:astro',
|
|
5
|
-
'Cloudflare': 'simple-icons:cloudflare',
|
|
6
|
-
'Deno Deploy': 'simple-icons:deno',
|
|
7
|
-
'EdgeOne': 'simple-icons:cloudnativebuild', // 不准确
|
|
8
|
-
'Express': 'simple-icons:express',
|
|
9
|
-
'Fly': 'tabler:air-balloon',
|
|
10
|
-
'Framer': 'simple-icons:framer',
|
|
11
|
-
'Ghost': 'simple-icons:ghost',
|
|
12
|
-
'GitHub Pages': 'simple-icons:github',
|
|
13
|
-
'Golang': 'simple-icons:go',
|
|
14
|
-
'Gridea': 'tabler:square-rounded-letter-g-filled', // 不准确
|
|
15
|
-
'Halo': 'material-symbols:h-mobiledata-badge', // 不准确
|
|
16
|
-
'Hexo': 'simple-icons:hexo',
|
|
17
|
-
'HTML': 'simple-icons:html5',
|
|
18
|
-
'Hugo': 'simple-icons:hugo',
|
|
19
|
-
'Jekyll': 'simple-icons:jekyll',
|
|
20
|
-
'Material for MkDocs': 'simple-icons:materialformkdocs',
|
|
21
|
-
'Netlify': 'simple-icons:netlify',
|
|
22
|
-
'Next.js': 'simple-icons:nextdotjs',
|
|
23
|
-
'Notion': 'simple-icons:notion',
|
|
24
|
-
'NotionNext': 'simple-icons:notion',
|
|
25
|
-
'Nuxt': 'simple-icons:nuxt',
|
|
26
|
-
'PHP': 'simple-icons:php',
|
|
27
|
-
'Python': 'simple-icons:python',
|
|
28
|
-
'React': 'simple-icons:react',
|
|
29
|
-
'Typecho': 'icon-park-solid:align-text-left-one', // 不准确
|
|
30
|
-
'Valaxy': 'tabler:letter-v', // 不准确
|
|
31
|
-
'Vercel': 'simple-icons:vercel',
|
|
32
|
-
'VitePress': 'simple-icons:vitepress',
|
|
33
|
-
'Vue': 'uim:vuejs',
|
|
34
|
-
'VuePress': 'uim:vuejs',
|
|
35
|
-
'WordPress': 'simple-icons:wordpress',
|
|
36
|
-
'Zeabur': 'tabler:square-letter-z-filled', // 不准确
|
|
37
|
-
'国内 CDN': 'tabler:cloud-data-connection',
|
|
38
|
-
'服务器': 'tabler:server',
|
|
39
|
-
'虚拟主机': 'tabler:cloud-upload',
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export type Arch = keyof typeof archIcons
|
|
43
|
-
|
|
44
|
-
export function getArchIcon(arch: Arch) {
|
|
45
|
-
return archIcons[arch] ?? ''
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/** BlogTech Widget 构建平台图标映射 */
|
|
49
|
-
// @keep-sorted
|
|
50
|
-
export const ciIcons: Record<string, string> = {
|
|
51
|
-
'Cloudflare Pages': 'devicon:cloudflare',
|
|
52
|
-
'Cloudflare Workers': 'devicon:cloudflareworkers',
|
|
53
|
-
'EdgeOne': 'https://edgeone.ai/favicon.ico',
|
|
54
|
-
'GitHub Actions': 'ri:github-fill',
|
|
55
|
-
'Netlify CI': 'catppuccin:netlify',
|
|
56
|
-
'Vercel': 'ri:vercel-fill',
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** 主域名图标映射 */
|
|
60
|
-
// @keep-sorted
|
|
61
|
-
const mainDomainIcons: Record<string, string> = {
|
|
62
|
-
'bilibili.com': 'ri:bilibili-fill',
|
|
63
|
-
'creativecommons.org': 'ri:creative-commons-line',
|
|
64
|
-
'feishu.cn': 'icon-park-outline:new-lark',
|
|
65
|
-
'github.com': 'ri:github-fill',
|
|
66
|
-
'github.io': 'ri:github-fill',
|
|
67
|
-
'google.cn': 'ri:google-fill',
|
|
68
|
-
'google.com': 'ri:google-fill',
|
|
69
|
-
'jd.com': 'arcticons:jd-sports',
|
|
70
|
-
'larkoffice.com': 'icon-park-outline:new-lark',
|
|
71
|
-
'microsoft.com': 'ri:microsoft-fill',
|
|
72
|
-
'netlify.app': 'simple-icons:netlify',
|
|
73
|
-
'pages.dev': 'simple-icons:cloudflare',
|
|
74
|
-
'qq.com': 'ri:qq-fill',
|
|
75
|
-
'taobao.com': 'ri:taobao-fill',
|
|
76
|
-
'thisis.host': 'tabler:star-filled',
|
|
77
|
-
'tmall.com': 'ri:taobao-fill',
|
|
78
|
-
'v2ex.com': 'simple-icons:v2ex',
|
|
79
|
-
'vercel.app': 'simple-icons:vercel',
|
|
80
|
-
'zabaur.app': 'tabler:square-letter-z-filled',
|
|
81
|
-
'zhihu.com': 'ri:zhihu-line',
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/** 专门域名图标映射,优先级高于主域名图标 */
|
|
85
|
-
// @keep-sorted
|
|
86
|
-
export const domainIcons: Record<string, string> = {
|
|
87
|
-
'developer.mozilla.org': 'simple-icons:mdnwebdocs',
|
|
88
|
-
'h5.qzone.qq.com': 'simple-icons:qzone',
|
|
89
|
-
'mp.weixin.qq.com': 'ri:wechat-fill',
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export function getDomainIcon(url: string) {
|
|
93
|
-
const domain = getDomain(url)
|
|
94
|
-
const mainDomain = getMainDomain(url, true)
|
|
95
|
-
if (domain in domainIcons)
|
|
96
|
-
return domainIcons[domain]
|
|
97
|
-
return mainDomainIcons[mainDomain]
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/** 文件名后缀图标映射,优先级高于代码块语言图标映射 */
|
|
101
|
-
// @keep-sorted
|
|
102
|
-
const file2icon: Record<string, string> = {
|
|
103
|
-
'.babelrc.js': 'catppuccin:babel',
|
|
104
|
-
'.babelrc': 'catppuccin:babel',
|
|
105
|
-
'.crt': 'catppuccin:certificate',
|
|
106
|
-
'.editorconfig': 'catppuccin:editorconfig',
|
|
107
|
-
'.env': 'catppuccin:env',
|
|
108
|
-
'.gitattributes': 'catppuccin:git',
|
|
109
|
-
'.gitconfig': 'catppuccin:git',
|
|
110
|
-
'.gitignore': 'catppuccin:git',
|
|
111
|
-
'.gitkeep': 'catppuccin:git',
|
|
112
|
-
'.gitlab-ci.yml': 'catppuccin:gitlab',
|
|
113
|
-
'.gitmodules': 'catppuccin:git',
|
|
114
|
-
'.key': 'catppuccin:key',
|
|
115
|
-
'.npmrc': 'catppuccin:npm',
|
|
116
|
-
'.patch': 'catppuccin:git',
|
|
117
|
-
'.prettierrc': 'catppuccin:prettier',
|
|
118
|
-
'astro.config.mjs': 'catppuccin:astro-config',
|
|
119
|
-
'CHANGELOG.md': 'catppuccin:changelog',
|
|
120
|
-
'CODE_OF_CONDUCT.md': 'catppuccin:code-of-conduct',
|
|
121
|
-
'CODEOWNERS': 'catppuccin:codeowners',
|
|
122
|
-
'CONTRIBUTING.md': 'catppuccin:contributing',
|
|
123
|
-
'docker-compose.yml': 'catppuccin:docker-compose',
|
|
124
|
-
'eslint.config.js': 'catppuccin:eslint',
|
|
125
|
-
'eslint.config.mjs': 'catppuccin:eslint',
|
|
126
|
-
'LICENSE': 'catppuccin:license',
|
|
127
|
-
'netlify.toml': 'catppuccin:netlify',
|
|
128
|
-
'next.config.ts': 'catppuccin:next',
|
|
129
|
-
'nuxt.config.ts': 'catppuccin:nuxt',
|
|
130
|
-
'package.json': 'catppuccin:package-json',
|
|
131
|
-
'pnpm-workspace.yaml': 'catppuccin:pnpm',
|
|
132
|
-
'postcss.config.js': 'catppuccin:postcss',
|
|
133
|
-
'prettier.config.js': 'catppuccin:prettier',
|
|
134
|
-
'pyproject.toml': 'catppuccin:python-config',
|
|
135
|
-
'README.md': 'catppuccin:readme',
|
|
136
|
-
'renovate.json': 'catppuccin:renovate',
|
|
137
|
-
'requirements.txt': 'catppuccin:python-config',
|
|
138
|
-
'robots.txt': 'catppuccin:robots',
|
|
139
|
-
'rollup.config.js': 'catppuccin:rollup',
|
|
140
|
-
'SECURITY.md': 'catppuccin:security',
|
|
141
|
-
'stylelint.config.js': 'catppuccin:stylelint',
|
|
142
|
-
'stylelint.config.mjs': 'catppuccin:stylelint',
|
|
143
|
-
'tailwind.config.js': 'catppuccin:tailwind',
|
|
144
|
-
'tsconfig.json': 'catppuccin:typescript-config',
|
|
145
|
-
'verccel.json': 'catppuccin:vercel',
|
|
146
|
-
'vite.config.js': 'catppuccin:vite',
|
|
147
|
-
'vite.config.ts': 'catppuccin:vite',
|
|
148
|
-
'webpack.config.js': 'catppuccin:webpack',
|
|
149
|
-
'yarn.lock': 'catppuccin:yarn',
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export function getFileIcon(filename?: string) {
|
|
153
|
-
if (!filename)
|
|
154
|
-
return undefined
|
|
155
|
-
const extension = Object.keys(file2icon).find(ext => filename.endsWith(ext))
|
|
156
|
-
return extension ? file2icon[extension] : undefined
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* 代码块语言简写或别名到 Catppuccin 图标库中的语言名映射
|
|
161
|
-
*
|
|
162
|
-
* 将 `blogConfig.shiki.langs` 的部分后缀名简写
|
|
163
|
-
* 转换为代码块语言对应的 Iconify Catppuccin 图标
|
|
164
|
-
*/
|
|
165
|
-
// @keep-sorted
|
|
166
|
-
const ext2lang: Record<string, string> = {
|
|
167
|
-
'bat': 'catppuccin:batch',
|
|
168
|
-
'c': 'catppuccin:c',
|
|
169
|
-
'c++': 'catppuccin:cpp',
|
|
170
|
-
'cpp': 'catppuccin:cpp',
|
|
171
|
-
'css': 'catppuccin:css',
|
|
172
|
-
'diff': 'catppuccin:diff',
|
|
173
|
-
'dockerfile': 'catppuccin:docker',
|
|
174
|
-
'gql': 'catppuccin:graphql',
|
|
175
|
-
'hs': 'catppuccin:haskell',
|
|
176
|
-
'html': 'catppuccin:html',
|
|
177
|
-
'ini': 'catppuccin:properties',
|
|
178
|
-
'java': 'catppuccin:java',
|
|
179
|
-
'js': 'catppuccin:javascript',
|
|
180
|
-
'json': 'catppuccin:json',
|
|
181
|
-
'jsonc': 'catppuccin:json',
|
|
182
|
-
'jsx': 'catppuccin:javascript-react',
|
|
183
|
-
'log': 'catppuccin:log',
|
|
184
|
-
'make': 'catppuccin:makefile',
|
|
185
|
-
'makefile': 'catppuccin:makefile',
|
|
186
|
-
'matlab': 'catppuccin:matlab',
|
|
187
|
-
'md': 'catppuccin:markdown',
|
|
188
|
-
'mdc': 'catppuccin:markdown',
|
|
189
|
-
'mdx': 'catppuccin:markdown',
|
|
190
|
-
'mermaid': 'catppuccin:mermaid',
|
|
191
|
-
'mmd': 'catppuccin:mermaid',
|
|
192
|
-
'powershell': 'catppuccin:powershell',
|
|
193
|
-
'ps': 'catppuccin:powershell',
|
|
194
|
-
'ps1': 'catppuccin:powershell',
|
|
195
|
-
'py': 'catppuccin:python',
|
|
196
|
-
'python': 'catppuccin:python',
|
|
197
|
-
'rs': 'catppuccin:rust',
|
|
198
|
-
'scss': 'catppuccin:sass',
|
|
199
|
-
'sh': 'catppuccin:bash',
|
|
200
|
-
'shell': 'catppuccin:bash',
|
|
201
|
-
'shellscript': 'catppuccin:bash',
|
|
202
|
-
'sql': 'catppuccin:database',
|
|
203
|
-
'ssh-config': 'catppuccin:properties',
|
|
204
|
-
'ssh': 'catppuccin:properties',
|
|
205
|
-
'toml': 'catppuccin:toml',
|
|
206
|
-
'ts': 'catppuccin:typescript',
|
|
207
|
-
'tsx': 'catppuccin:typescript-react',
|
|
208
|
-
'vb': 'catppuccin:visual-studio',
|
|
209
|
-
'vue': 'catppuccin:vue',
|
|
210
|
-
'xml': 'catppuccin:xml',
|
|
211
|
-
'yaml': 'catppuccin:yaml',
|
|
212
|
-
'yml': 'catppuccin:yaml',
|
|
213
|
-
'zsh': 'catppuccin:bash',
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export function getLangIcon(extension = 'file') {
|
|
217
|
-
return ext2lang[extension] ?? 'catppuccin:file'
|
|
218
|
-
}
|
|
1
|
+
/** 友链架构图标映射 */
|
|
2
|
+
// @keep-sorted
|
|
3
|
+
const archIcons = {
|
|
4
|
+
'Astro': 'simple-icons:astro',
|
|
5
|
+
'Cloudflare': 'simple-icons:cloudflare',
|
|
6
|
+
'Deno Deploy': 'simple-icons:deno',
|
|
7
|
+
'EdgeOne': 'simple-icons:cloudnativebuild', // 不准确
|
|
8
|
+
'Express': 'simple-icons:express',
|
|
9
|
+
'Fly': 'tabler:air-balloon',
|
|
10
|
+
'Framer': 'simple-icons:framer',
|
|
11
|
+
'Ghost': 'simple-icons:ghost',
|
|
12
|
+
'GitHub Pages': 'simple-icons:github',
|
|
13
|
+
'Golang': 'simple-icons:go',
|
|
14
|
+
'Gridea': 'tabler:square-rounded-letter-g-filled', // 不准确
|
|
15
|
+
'Halo': 'material-symbols:h-mobiledata-badge', // 不准确
|
|
16
|
+
'Hexo': 'simple-icons:hexo',
|
|
17
|
+
'HTML': 'simple-icons:html5',
|
|
18
|
+
'Hugo': 'simple-icons:hugo',
|
|
19
|
+
'Jekyll': 'simple-icons:jekyll',
|
|
20
|
+
'Material for MkDocs': 'simple-icons:materialformkdocs',
|
|
21
|
+
'Netlify': 'simple-icons:netlify',
|
|
22
|
+
'Next.js': 'simple-icons:nextdotjs',
|
|
23
|
+
'Notion': 'simple-icons:notion',
|
|
24
|
+
'NotionNext': 'simple-icons:notion',
|
|
25
|
+
'Nuxt': 'simple-icons:nuxt',
|
|
26
|
+
'PHP': 'simple-icons:php',
|
|
27
|
+
'Python': 'simple-icons:python',
|
|
28
|
+
'React': 'simple-icons:react',
|
|
29
|
+
'Typecho': 'icon-park-solid:align-text-left-one', // 不准确
|
|
30
|
+
'Valaxy': 'tabler:letter-v', // 不准确
|
|
31
|
+
'Vercel': 'simple-icons:vercel',
|
|
32
|
+
'VitePress': 'simple-icons:vitepress',
|
|
33
|
+
'Vue': 'uim:vuejs',
|
|
34
|
+
'VuePress': 'uim:vuejs',
|
|
35
|
+
'WordPress': 'simple-icons:wordpress',
|
|
36
|
+
'Zeabur': 'tabler:square-letter-z-filled', // 不准确
|
|
37
|
+
'国内 CDN': 'tabler:cloud-data-connection',
|
|
38
|
+
'服务器': 'tabler:server',
|
|
39
|
+
'虚拟主机': 'tabler:cloud-upload',
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type Arch = keyof typeof archIcons
|
|
43
|
+
|
|
44
|
+
export function getArchIcon(arch: Arch) {
|
|
45
|
+
return archIcons[arch] ?? ''
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** BlogTech Widget 构建平台图标映射 */
|
|
49
|
+
// @keep-sorted
|
|
50
|
+
export const ciIcons: Record<string, string> = {
|
|
51
|
+
'Cloudflare Pages': 'devicon:cloudflare',
|
|
52
|
+
'Cloudflare Workers': 'devicon:cloudflareworkers',
|
|
53
|
+
'EdgeOne': 'https://edgeone.ai/favicon.ico',
|
|
54
|
+
'GitHub Actions': 'ri:github-fill',
|
|
55
|
+
'Netlify CI': 'catppuccin:netlify',
|
|
56
|
+
'Vercel': 'ri:vercel-fill',
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** 主域名图标映射 */
|
|
60
|
+
// @keep-sorted
|
|
61
|
+
const mainDomainIcons: Record<string, string> = {
|
|
62
|
+
'bilibili.com': 'ri:bilibili-fill',
|
|
63
|
+
'creativecommons.org': 'ri:creative-commons-line',
|
|
64
|
+
'feishu.cn': 'icon-park-outline:new-lark',
|
|
65
|
+
'github.com': 'ri:github-fill',
|
|
66
|
+
'github.io': 'ri:github-fill',
|
|
67
|
+
'google.cn': 'ri:google-fill',
|
|
68
|
+
'google.com': 'ri:google-fill',
|
|
69
|
+
'jd.com': 'arcticons:jd-sports',
|
|
70
|
+
'larkoffice.com': 'icon-park-outline:new-lark',
|
|
71
|
+
'microsoft.com': 'ri:microsoft-fill',
|
|
72
|
+
'netlify.app': 'simple-icons:netlify',
|
|
73
|
+
'pages.dev': 'simple-icons:cloudflare',
|
|
74
|
+
'qq.com': 'ri:qq-fill',
|
|
75
|
+
'taobao.com': 'ri:taobao-fill',
|
|
76
|
+
'thisis.host': 'tabler:star-filled',
|
|
77
|
+
'tmall.com': 'ri:taobao-fill',
|
|
78
|
+
'v2ex.com': 'simple-icons:v2ex',
|
|
79
|
+
'vercel.app': 'simple-icons:vercel',
|
|
80
|
+
'zabaur.app': 'tabler:square-letter-z-filled',
|
|
81
|
+
'zhihu.com': 'ri:zhihu-line',
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** 专门域名图标映射,优先级高于主域名图标 */
|
|
85
|
+
// @keep-sorted
|
|
86
|
+
export const domainIcons: Record<string, string> = {
|
|
87
|
+
'developer.mozilla.org': 'simple-icons:mdnwebdocs',
|
|
88
|
+
'h5.qzone.qq.com': 'simple-icons:qzone',
|
|
89
|
+
'mp.weixin.qq.com': 'ri:wechat-fill',
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function getDomainIcon(url: string) {
|
|
93
|
+
const domain = getDomain(url)
|
|
94
|
+
const mainDomain = getMainDomain(url, true)
|
|
95
|
+
if (domain in domainIcons)
|
|
96
|
+
return domainIcons[domain]
|
|
97
|
+
return mainDomainIcons[mainDomain]
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** 文件名后缀图标映射,优先级高于代码块语言图标映射 */
|
|
101
|
+
// @keep-sorted
|
|
102
|
+
const file2icon: Record<string, string> = {
|
|
103
|
+
'.babelrc.js': 'catppuccin:babel',
|
|
104
|
+
'.babelrc': 'catppuccin:babel',
|
|
105
|
+
'.crt': 'catppuccin:certificate',
|
|
106
|
+
'.editorconfig': 'catppuccin:editorconfig',
|
|
107
|
+
'.env': 'catppuccin:env',
|
|
108
|
+
'.gitattributes': 'catppuccin:git',
|
|
109
|
+
'.gitconfig': 'catppuccin:git',
|
|
110
|
+
'.gitignore': 'catppuccin:git',
|
|
111
|
+
'.gitkeep': 'catppuccin:git',
|
|
112
|
+
'.gitlab-ci.yml': 'catppuccin:gitlab',
|
|
113
|
+
'.gitmodules': 'catppuccin:git',
|
|
114
|
+
'.key': 'catppuccin:key',
|
|
115
|
+
'.npmrc': 'catppuccin:npm',
|
|
116
|
+
'.patch': 'catppuccin:git',
|
|
117
|
+
'.prettierrc': 'catppuccin:prettier',
|
|
118
|
+
'astro.config.mjs': 'catppuccin:astro-config',
|
|
119
|
+
'CHANGELOG.md': 'catppuccin:changelog',
|
|
120
|
+
'CODE_OF_CONDUCT.md': 'catppuccin:code-of-conduct',
|
|
121
|
+
'CODEOWNERS': 'catppuccin:codeowners',
|
|
122
|
+
'CONTRIBUTING.md': 'catppuccin:contributing',
|
|
123
|
+
'docker-compose.yml': 'catppuccin:docker-compose',
|
|
124
|
+
'eslint.config.js': 'catppuccin:eslint',
|
|
125
|
+
'eslint.config.mjs': 'catppuccin:eslint',
|
|
126
|
+
'LICENSE': 'catppuccin:license',
|
|
127
|
+
'netlify.toml': 'catppuccin:netlify',
|
|
128
|
+
'next.config.ts': 'catppuccin:next',
|
|
129
|
+
'nuxt.config.ts': 'catppuccin:nuxt',
|
|
130
|
+
'package.json': 'catppuccin:package-json',
|
|
131
|
+
'pnpm-workspace.yaml': 'catppuccin:pnpm',
|
|
132
|
+
'postcss.config.js': 'catppuccin:postcss',
|
|
133
|
+
'prettier.config.js': 'catppuccin:prettier',
|
|
134
|
+
'pyproject.toml': 'catppuccin:python-config',
|
|
135
|
+
'README.md': 'catppuccin:readme',
|
|
136
|
+
'renovate.json': 'catppuccin:renovate',
|
|
137
|
+
'requirements.txt': 'catppuccin:python-config',
|
|
138
|
+
'robots.txt': 'catppuccin:robots',
|
|
139
|
+
'rollup.config.js': 'catppuccin:rollup',
|
|
140
|
+
'SECURITY.md': 'catppuccin:security',
|
|
141
|
+
'stylelint.config.js': 'catppuccin:stylelint',
|
|
142
|
+
'stylelint.config.mjs': 'catppuccin:stylelint',
|
|
143
|
+
'tailwind.config.js': 'catppuccin:tailwind',
|
|
144
|
+
'tsconfig.json': 'catppuccin:typescript-config',
|
|
145
|
+
'verccel.json': 'catppuccin:vercel',
|
|
146
|
+
'vite.config.js': 'catppuccin:vite',
|
|
147
|
+
'vite.config.ts': 'catppuccin:vite',
|
|
148
|
+
'webpack.config.js': 'catppuccin:webpack',
|
|
149
|
+
'yarn.lock': 'catppuccin:yarn',
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export function getFileIcon(filename?: string) {
|
|
153
|
+
if (!filename)
|
|
154
|
+
return undefined
|
|
155
|
+
const extension = Object.keys(file2icon).find(ext => filename.endsWith(ext))
|
|
156
|
+
return extension ? file2icon[extension] : undefined
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* 代码块语言简写或别名到 Catppuccin 图标库中的语言名映射
|
|
161
|
+
*
|
|
162
|
+
* 将 `blogConfig.shiki.langs` 的部分后缀名简写
|
|
163
|
+
* 转换为代码块语言对应的 Iconify Catppuccin 图标
|
|
164
|
+
*/
|
|
165
|
+
// @keep-sorted
|
|
166
|
+
const ext2lang: Record<string, string> = {
|
|
167
|
+
'bat': 'catppuccin:batch',
|
|
168
|
+
'c': 'catppuccin:c',
|
|
169
|
+
'c++': 'catppuccin:cpp',
|
|
170
|
+
'cpp': 'catppuccin:cpp',
|
|
171
|
+
'css': 'catppuccin:css',
|
|
172
|
+
'diff': 'catppuccin:diff',
|
|
173
|
+
'dockerfile': 'catppuccin:docker',
|
|
174
|
+
'gql': 'catppuccin:graphql',
|
|
175
|
+
'hs': 'catppuccin:haskell',
|
|
176
|
+
'html': 'catppuccin:html',
|
|
177
|
+
'ini': 'catppuccin:properties',
|
|
178
|
+
'java': 'catppuccin:java',
|
|
179
|
+
'js': 'catppuccin:javascript',
|
|
180
|
+
'json': 'catppuccin:json',
|
|
181
|
+
'jsonc': 'catppuccin:json',
|
|
182
|
+
'jsx': 'catppuccin:javascript-react',
|
|
183
|
+
'log': 'catppuccin:log',
|
|
184
|
+
'make': 'catppuccin:makefile',
|
|
185
|
+
'makefile': 'catppuccin:makefile',
|
|
186
|
+
'matlab': 'catppuccin:matlab',
|
|
187
|
+
'md': 'catppuccin:markdown',
|
|
188
|
+
'mdc': 'catppuccin:markdown',
|
|
189
|
+
'mdx': 'catppuccin:markdown',
|
|
190
|
+
'mermaid': 'catppuccin:mermaid',
|
|
191
|
+
'mmd': 'catppuccin:mermaid',
|
|
192
|
+
'powershell': 'catppuccin:powershell',
|
|
193
|
+
'ps': 'catppuccin:powershell',
|
|
194
|
+
'ps1': 'catppuccin:powershell',
|
|
195
|
+
'py': 'catppuccin:python',
|
|
196
|
+
'python': 'catppuccin:python',
|
|
197
|
+
'rs': 'catppuccin:rust',
|
|
198
|
+
'scss': 'catppuccin:sass',
|
|
199
|
+
'sh': 'catppuccin:bash',
|
|
200
|
+
'shell': 'catppuccin:bash',
|
|
201
|
+
'shellscript': 'catppuccin:bash',
|
|
202
|
+
'sql': 'catppuccin:database',
|
|
203
|
+
'ssh-config': 'catppuccin:properties',
|
|
204
|
+
'ssh': 'catppuccin:properties',
|
|
205
|
+
'toml': 'catppuccin:toml',
|
|
206
|
+
'ts': 'catppuccin:typescript',
|
|
207
|
+
'tsx': 'catppuccin:typescript-react',
|
|
208
|
+
'vb': 'catppuccin:visual-studio',
|
|
209
|
+
'vue': 'catppuccin:vue',
|
|
210
|
+
'xml': 'catppuccin:xml',
|
|
211
|
+
'yaml': 'catppuccin:yaml',
|
|
212
|
+
'yml': 'catppuccin:yaml',
|
|
213
|
+
'zsh': 'catppuccin:bash',
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export function getLangIcon(extension = 'file') {
|
|
217
|
+
return ext2lang[extension] ?? 'catppuccin:file'
|
|
218
|
+
}
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { fromUrl, parseDomain, ParseResultType } from 'parse-domain'
|
|
2
|
-
import { isPathFile } from 'site-config-stack/urls'
|
|
3
|
-
|
|
4
|
-
const domainTip: Record<string, string> = {
|
|
5
|
-
'github.io': 'GitHub Pages 域名',
|
|
6
|
-
'netlify.app': 'Netlify 域名',
|
|
7
|
-
'pages.dev': 'Cloudflare 域名',
|
|
8
|
-
'thisis.host': '纸鹿提供的域名',
|
|
9
|
-
'vercel.app': 'Vercel 域名',
|
|
10
|
-
'zeabur.app': 'Zeabur 域名',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function getDomain(url: string) {
|
|
14
|
-
const domain = fromUrl(url)
|
|
15
|
-
return typeof domain === 'symbol' ? url : domain
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function getMainDomain(url: string, useIcann?: boolean) {
|
|
19
|
-
const hostname = getDomain(url)
|
|
20
|
-
const parseResult = parseDomain(hostname)
|
|
21
|
-
if (parseResult.type !== ParseResultType.Listed)
|
|
22
|
-
return hostname
|
|
23
|
-
const { domain, topLevelDomains } = useIcann ? parseResult.icann : parseResult
|
|
24
|
-
return `${domain}.${topLevelDomains.join('.')}`
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function getDomainType(mainDomain: string) {
|
|
28
|
-
return domainTip[mainDomain]
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const githubUsernameRegex = /github\.com\/([a-zA-Z0-9-]+)(?:\/[^/]+)?(\/?)$/
|
|
32
|
-
|
|
33
|
-
export function getGithubUsername(url?: string) {
|
|
34
|
-
if (!url)
|
|
35
|
-
return ''
|
|
36
|
-
return url.match(githubUsernameRegex)?.[1] ?? ''
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function isExtLink(url?: string) {
|
|
40
|
-
return url
|
|
41
|
-
? url.includes(':') || url.startsWith('//') || !!isPathFile(url)
|
|
42
|
-
: false
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function safelyDecodeUriComponent(str: string) {
|
|
46
|
-
try {
|
|
47
|
-
return decodeURIComponent(str)
|
|
48
|
-
}
|
|
49
|
-
catch {
|
|
50
|
-
return str
|
|
51
|
-
}
|
|
52
|
-
}
|
|
1
|
+
import { fromUrl, parseDomain, ParseResultType } from 'parse-domain'
|
|
2
|
+
import { isPathFile } from 'site-config-stack/urls'
|
|
3
|
+
|
|
4
|
+
const domainTip: Record<string, string> = {
|
|
5
|
+
'github.io': 'GitHub Pages 域名',
|
|
6
|
+
'netlify.app': 'Netlify 域名',
|
|
7
|
+
'pages.dev': 'Cloudflare 域名',
|
|
8
|
+
'thisis.host': '纸鹿提供的域名',
|
|
9
|
+
'vercel.app': 'Vercel 域名',
|
|
10
|
+
'zeabur.app': 'Zeabur 域名',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function getDomain(url: string) {
|
|
14
|
+
const domain = fromUrl(url)
|
|
15
|
+
return typeof domain === 'symbol' ? url : domain
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function getMainDomain(url: string, useIcann?: boolean) {
|
|
19
|
+
const hostname = getDomain(url)
|
|
20
|
+
const parseResult = parseDomain(hostname)
|
|
21
|
+
if (parseResult.type !== ParseResultType.Listed)
|
|
22
|
+
return hostname
|
|
23
|
+
const { domain, topLevelDomains } = useIcann ? parseResult.icann : parseResult
|
|
24
|
+
return `${domain}.${topLevelDomains.join('.')}`
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function getDomainType(mainDomain: string) {
|
|
28
|
+
return domainTip[mainDomain]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const githubUsernameRegex = /github\.com\/([a-zA-Z0-9-]+)(?:\/[^/]+)?(\/?)$/
|
|
32
|
+
|
|
33
|
+
export function getGithubUsername(url?: string) {
|
|
34
|
+
if (!url)
|
|
35
|
+
return ''
|
|
36
|
+
return url.match(githubUsernameRegex)?.[1] ?? ''
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function isExtLink(url?: string) {
|
|
40
|
+
return url
|
|
41
|
+
? url.includes(':') || url.startsWith('//') || !!isPathFile(url)
|
|
42
|
+
: false
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function safelyDecodeUriComponent(str: string) {
|
|
46
|
+
try {
|
|
47
|
+
return decodeURIComponent(str)
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return str
|
|
51
|
+
}
|
|
52
|
+
}
|