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,37 +1,37 @@
|
|
|
1
|
-
import { toArray } from '@vueuse/core'
|
|
2
|
-
|
|
3
|
-
interface Rect {
|
|
4
|
-
left: number | string
|
|
5
|
-
top: number | string
|
|
6
|
-
width: number | string
|
|
7
|
-
height: number | string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
type MaybeArray<T> = T | T[]
|
|
11
|
-
|
|
12
|
-
function toRect(rect: Element | Rect): Rect {
|
|
13
|
-
return rect instanceof Element ? rect.getBoundingClientRect() : rect
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const ensurePx = (val: number | string) => typeof val === 'number' ? `${val}px` : val
|
|
17
|
-
|
|
18
|
-
export function animateBetweenRects(
|
|
19
|
-
el: MaybeRefOrGetter<Element>,
|
|
20
|
-
rect: MaybeArray<MaybeRefOrGetter<Element> | Rect>,
|
|
21
|
-
options?: KeyframeAnimationOptions,
|
|
22
|
-
) {
|
|
23
|
-
const rects = toArray(rect).map(r => toRect(toValue(r)))
|
|
24
|
-
|
|
25
|
-
return toValue(el).animate(rects.map(r => ({
|
|
26
|
-
left: ensurePx(r.left),
|
|
27
|
-
top: ensurePx(r.top),
|
|
28
|
-
width: ensurePx(r.width),
|
|
29
|
-
height: ensurePx(r.height),
|
|
30
|
-
})), {
|
|
31
|
-
duration: 100,
|
|
32
|
-
fill: 'forwards',
|
|
33
|
-
...options,
|
|
34
|
-
})
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export const getFixedDelay = (s: number, fixed = 2) => ({ '--delay': `${s.toFixed(fixed)}s` })
|
|
1
|
+
import { toArray } from '@vueuse/core'
|
|
2
|
+
|
|
3
|
+
interface Rect {
|
|
4
|
+
left: number | string
|
|
5
|
+
top: number | string
|
|
6
|
+
width: number | string
|
|
7
|
+
height: number | string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type MaybeArray<T> = T | T[]
|
|
11
|
+
|
|
12
|
+
function toRect(rect: Element | Rect): Rect {
|
|
13
|
+
return rect instanceof Element ? rect.getBoundingClientRect() : rect
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const ensurePx = (val: number | string) => typeof val === 'number' ? `${val}px` : val
|
|
17
|
+
|
|
18
|
+
export function animateBetweenRects(
|
|
19
|
+
el: MaybeRefOrGetter<Element>,
|
|
20
|
+
rect: MaybeArray<MaybeRefOrGetter<Element> | Rect>,
|
|
21
|
+
options?: KeyframeAnimationOptions,
|
|
22
|
+
) {
|
|
23
|
+
const rects = toArray(rect).map(r => toRect(toValue(r)))
|
|
24
|
+
|
|
25
|
+
return toValue(el).animate(rects.map(r => ({
|
|
26
|
+
left: ensurePx(r.left),
|
|
27
|
+
top: ensurePx(r.top),
|
|
28
|
+
width: ensurePx(r.width),
|
|
29
|
+
height: ensurePx(r.height),
|
|
30
|
+
})), {
|
|
31
|
+
duration: 100,
|
|
32
|
+
fill: 'forwards',
|
|
33
|
+
...options,
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const getFixedDelay = (s: number, fixed = 2) => ({ '--delay': `${s.toFixed(fixed)}s` })
|
package/{app → src}/utils/img.ts
RENAMED
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
// @keep-sorted
|
|
2
|
-
const services = {
|
|
3
|
-
baidu: 'https://image.baidu.com/search/down?url=',
|
|
4
|
-
/** https://webp.se/fly/ */
|
|
5
|
-
fly: 'https://fly.webp.se/?url=',
|
|
6
|
-
/** https://wsrv.nl/docs/ */
|
|
7
|
-
weserv: 'https://wsrv.nl/?url=',
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export type ImgService = keyof typeof services | boolean
|
|
11
|
-
|
|
12
|
-
// https://wsrv.nl/docs/quick-reference.html
|
|
13
|
-
export function getWsrvGhAvatar(name = '', options: Record<string, any> = { size: 92 }) {
|
|
14
|
-
const srcUrl = `github.com/${name}.png?size=${options.size}`
|
|
15
|
-
delete options.size
|
|
16
|
-
|
|
17
|
-
const params = new URLSearchParams(srcUrl)
|
|
18
|
-
Object.entries(options).forEach(([key, value]) => params.set(key, value))
|
|
19
|
-
return services.weserv + params.toString()
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// https://docs.webp.se/public-services/github-avatar/
|
|
23
|
-
export function getGithubAvatar(name = '', options = { size: 120 }) {
|
|
24
|
-
return `https://avatars-githubusercontent-webp.webp.se/${name}?s=${options.size}`
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const getGithubIcon = (name = '') => getWsrvGhAvatar(name, { size: 32, mask: 'circle' })
|
|
28
|
-
|
|
29
|
-
export enum OicqAvatarSize {
|
|
30
|
-
Size1080,
|
|
31
|
-
Size40,
|
|
32
|
-
Size40_,
|
|
33
|
-
Size100,
|
|
34
|
-
Size140,
|
|
35
|
-
Size640,
|
|
36
|
-
Size40__ = 40,
|
|
37
|
-
Size100_ = 100,
|
|
38
|
-
Size640_ = 640,
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// https://users.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?uins=
|
|
42
|
-
export function getOicqAvatar(qq = '', size = OicqAvatarSize.Size140) {
|
|
43
|
-
return `https://q1.qlogo.cn/g?b=qq&nk=${qq}&s=${size}`
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export enum QgroupAvatarSize {
|
|
47
|
-
Size640,
|
|
48
|
-
Size100 = 100,
|
|
49
|
-
Size640_ = 640,
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function getOciqGroupAvatar(group = '', size = QgroupAvatarSize.Size100) {
|
|
53
|
-
return `https://p.qlogo.cn/gh/${group}/${group}/${size}/`
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
interface GstaticFaviconOptions {
|
|
57
|
-
provider?: 'gstatic'
|
|
58
|
-
size?: 16 | 32 | 64 | 96 | 128 | 256 | 512
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
interface WebpseFaviconOptions {
|
|
62
|
-
provider: 'google' | 'duckduckgo' | 'microlink'
|
|
63
|
-
size?: number
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// https://github.com/microlinkhq/unavatar
|
|
67
|
-
// https://docs.webp.se/public-services/unavatar/
|
|
68
|
-
export function getFavicon(domain: string, options?: GstaticFaviconOptions | WebpseFaviconOptions) {
|
|
69
|
-
const { provider = 'gstatic', size = 32 } = options || {}
|
|
70
|
-
if (provider === 'gstatic')
|
|
71
|
-
return `https://t0.gstatic.cn/faviconV2?client=SOCIAL&fallback_opts=SIZE&url=http://${domain}&size=${size}`
|
|
72
|
-
return `https://unavatar.webp.se/${provider}/${domain}?w=${size}`
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export function getImgUrl(src: string, service?: ImgService | true) {
|
|
76
|
-
if (!service)
|
|
77
|
-
return src
|
|
78
|
-
if (service === true)
|
|
79
|
-
service = 'fly'
|
|
80
|
-
if (service in services)
|
|
81
|
-
return services[service] + src
|
|
82
|
-
return src
|
|
83
|
-
}
|
|
1
|
+
// @keep-sorted
|
|
2
|
+
const services = {
|
|
3
|
+
baidu: 'https://image.baidu.com/search/down?url=',
|
|
4
|
+
/** https://webp.se/fly/ */
|
|
5
|
+
fly: 'https://fly.webp.se/?url=',
|
|
6
|
+
/** https://wsrv.nl/docs/ */
|
|
7
|
+
weserv: 'https://wsrv.nl/?url=',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type ImgService = keyof typeof services | boolean
|
|
11
|
+
|
|
12
|
+
// https://wsrv.nl/docs/quick-reference.html
|
|
13
|
+
export function getWsrvGhAvatar(name = '', options: Record<string, any> = { size: 92 }) {
|
|
14
|
+
const srcUrl = `github.com/${name}.png?size=${options.size}`
|
|
15
|
+
delete options.size
|
|
16
|
+
|
|
17
|
+
const params = new URLSearchParams(srcUrl)
|
|
18
|
+
Object.entries(options).forEach(([key, value]) => params.set(key, value))
|
|
19
|
+
return services.weserv + params.toString()
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// https://docs.webp.se/public-services/github-avatar/
|
|
23
|
+
export function getGithubAvatar(name = '', options = { size: 120 }) {
|
|
24
|
+
return `https://avatars-githubusercontent-webp.webp.se/${name}?s=${options.size}`
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const getGithubIcon = (name = '') => getWsrvGhAvatar(name, { size: 32, mask: 'circle' })
|
|
28
|
+
|
|
29
|
+
export enum OicqAvatarSize {
|
|
30
|
+
Size1080,
|
|
31
|
+
Size40,
|
|
32
|
+
Size40_,
|
|
33
|
+
Size100,
|
|
34
|
+
Size140,
|
|
35
|
+
Size640,
|
|
36
|
+
Size40__ = 40,
|
|
37
|
+
Size100_ = 100,
|
|
38
|
+
Size640_ = 640,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// https://users.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?uins=
|
|
42
|
+
export function getOicqAvatar(qq = '', size = OicqAvatarSize.Size140) {
|
|
43
|
+
return `https://q1.qlogo.cn/g?b=qq&nk=${qq}&s=${size}`
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export enum QgroupAvatarSize {
|
|
47
|
+
Size640,
|
|
48
|
+
Size100 = 100,
|
|
49
|
+
Size640_ = 640,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function getOciqGroupAvatar(group = '', size = QgroupAvatarSize.Size100) {
|
|
53
|
+
return `https://p.qlogo.cn/gh/${group}/${group}/${size}/`
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface GstaticFaviconOptions {
|
|
57
|
+
provider?: 'gstatic'
|
|
58
|
+
size?: 16 | 32 | 64 | 96 | 128 | 256 | 512
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface WebpseFaviconOptions {
|
|
62
|
+
provider: 'google' | 'duckduckgo' | 'microlink'
|
|
63
|
+
size?: number
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// https://github.com/microlinkhq/unavatar
|
|
67
|
+
// https://docs.webp.se/public-services/unavatar/
|
|
68
|
+
export function getFavicon(domain: string, options?: GstaticFaviconOptions | WebpseFaviconOptions) {
|
|
69
|
+
const { provider = 'gstatic', size = 32 } = options || {}
|
|
70
|
+
if (provider === 'gstatic')
|
|
71
|
+
return `https://t0.gstatic.cn/faviconV2?client=SOCIAL&fallback_opts=SIZE&url=http://${domain}&size=${size}`
|
|
72
|
+
return `https://unavatar.webp.se/${provider}/${domain}?w=${size}`
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function getImgUrl(src: string, service?: ImgService | true) {
|
|
76
|
+
if (!service)
|
|
77
|
+
return src
|
|
78
|
+
if (service === true)
|
|
79
|
+
service = 'fly'
|
|
80
|
+
if (service in services)
|
|
81
|
+
return services[service] + src
|
|
82
|
+
return src
|
|
83
|
+
}
|
package/app/types/feed.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { FeedEntry, FeedGroup } from '../../config/feed'
|
package/config/feeds.empty.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|