ezal-theme-example 0.0.1
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 +21 -0
- package/assets/scripts/404.ts +353 -0
- package/assets/scripts/_article.ts +290 -0
- package/assets/scripts/_base.ts +65 -0
- package/assets/scripts/_pagefind.d.ts +424 -0
- package/assets/scripts/_search.ts +88 -0
- package/assets/scripts/_utils.ts +74 -0
- package/assets/scripts/archive.ts +143 -0
- package/assets/scripts/article.ts +18 -0
- package/assets/scripts/category.ts +4 -0
- package/assets/scripts/home.ts +73 -0
- package/assets/scripts/links.ts +14 -0
- package/assets/scripts/main.ts +11 -0
- package/assets/scripts/page.ts +11 -0
- package/assets/scripts/tag.ts +4 -0
- package/assets/scripts/tsconfig.json +10 -0
- package/assets/styles/404.styl +31 -0
- package/assets/styles/_article/fold.styl +15 -0
- package/assets/styles/_article/footnote.styl +12 -0
- package/assets/styles/_article/heading.styl +29 -0
- package/assets/styles/_article/image.styl +30 -0
- package/assets/styles/_article/kbd.styl +10 -0
- package/assets/styles/_article/links.styl +31 -0
- package/assets/styles/_article/list.styl +19 -0
- package/assets/styles/_article/note.styl +18 -0
- package/assets/styles/_article/other.styl +44 -0
- package/assets/styles/_article/table.styl +29 -0
- package/assets/styles/_article/tabs.styl +25 -0
- package/assets/styles/_code.styl +83 -0
- package/assets/styles/_index/contact.styl +20 -0
- package/assets/styles/_index/footer.styl +5 -0
- package/assets/styles/_index/header.styl +40 -0
- package/assets/styles/_index/nav.styl +59 -0
- package/assets/styles/_index/search.styl +64 -0
- package/assets/styles/_index.styl +91 -0
- package/assets/styles/_var.styl +96 -0
- package/assets/styles/archive.styl +35 -0
- package/assets/styles/article.styl +138 -0
- package/assets/styles/category.styl +4 -0
- package/assets/styles/home.styl +124 -0
- package/assets/styles/links.styl +121 -0
- package/assets/styles/page.styl +12 -0
- package/assets/styles/tag.styl +4 -0
- package/dist/config.d.ts +128 -0
- package/dist/feed.d.ts +4 -0
- package/dist/image/asset.d.ts +22 -0
- package/dist/image/db.d.ts +18 -0
- package/dist/image/index.d.ts +10 -0
- package/dist/image/metadata.d.ts +2 -0
- package/dist/image/utils.d.ts +1 -0
- package/dist/index-now.d.ts +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2066 -0
- package/dist/index.js.map +1 -0
- package/dist/layout.d.ts +2 -0
- package/dist/markdown/codeblock/data.d.ts +1 -0
- package/dist/markdown/codeblock/index.d.ts +6 -0
- package/dist/markdown/codeblock/style.d.ts +2 -0
- package/dist/markdown/fold.d.ts +6 -0
- package/dist/markdown/footnote.d.ts +15 -0
- package/dist/markdown/image.d.ts +12 -0
- package/dist/markdown/index.d.ts +2 -0
- package/dist/markdown/kbd.d.ts +6 -0
- package/dist/markdown/link.d.ts +2 -0
- package/dist/markdown/links.d.ts +12 -0
- package/dist/markdown/note.d.ts +8 -0
- package/dist/markdown/table.d.ts +3 -0
- package/dist/markdown/tabs.d.ts +7 -0
- package/dist/markdown/tex.d.ts +9 -0
- package/dist/page/404.d.ts +1 -0
- package/dist/page/archive.d.ts +1 -0
- package/dist/page/category.d.ts +1 -0
- package/dist/page/home.d.ts +2 -0
- package/dist/page/tag.d.ts +1 -0
- package/dist/pagefind.d.ts +20 -0
- package/dist/sitemap.d.ts +2 -0
- package/dist/transform/script.d.ts +2 -0
- package/dist/transform/stylus.d.ts +2 -0
- package/dist/utils.d.ts +2 -0
- package/layouts/404.tsx +8 -0
- package/layouts/archive.tsx +81 -0
- package/layouts/article.tsx +145 -0
- package/layouts/base.tsx +20 -0
- package/layouts/category.tsx +18 -0
- package/layouts/components/ArchiveArticleList.tsx +14 -0
- package/layouts/components/Article.tsx +46 -0
- package/layouts/components/Contact.tsx +14 -0
- package/layouts/components/Footer.tsx +44 -0
- package/layouts/components/Head.tsx +119 -0
- package/layouts/components/Image.tsx +42 -0
- package/layouts/components/Nav.tsx +33 -0
- package/layouts/components/Search.tsx +20 -0
- package/layouts/components/Waline.tsx +22 -0
- package/layouts/context.d.ts +54 -0
- package/layouts/home.tsx +74 -0
- package/layouts/links.tsx +53 -0
- package/layouts/page.tsx +19 -0
- package/layouts/tag.tsx +18 -0
- package/layouts/tsconfig.json +11 -0
- package/package.json +47 -0
- package/readme.md +17 -0
- package/readme_zh.md +17 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
@import '_index'
|
|
2
|
+
|
|
3
|
+
// MARK: Header
|
|
4
|
+
header
|
|
5
|
+
img
|
|
6
|
+
filter blur(4px)
|
|
7
|
+
scale 1.05
|
|
8
|
+
|
|
9
|
+
.cates
|
|
10
|
+
display flex
|
|
11
|
+
flex-wrap wrap
|
|
12
|
+
font-weight bold
|
|
13
|
+
gap 4px 16px
|
|
14
|
+
|
|
15
|
+
.tag
|
|
16
|
+
&:before
|
|
17
|
+
content '#'
|
|
18
|
+
opacity .5
|
|
19
|
+
|
|
20
|
+
.article-info
|
|
21
|
+
display flex
|
|
22
|
+
flex-wrap wrap
|
|
23
|
+
gap 8px
|
|
24
|
+
:before
|
|
25
|
+
margin-right 4px
|
|
26
|
+
|
|
27
|
+
// MARK: Main
|
|
28
|
+
main
|
|
29
|
+
display flex
|
|
30
|
+
flex-direction row-reverse
|
|
31
|
+
|
|
32
|
+
article
|
|
33
|
+
flex 1
|
|
34
|
+
padding 8px
|
|
35
|
+
width 0
|
|
36
|
+
text-wrap pretty
|
|
37
|
+
|
|
38
|
+
.sticky
|
|
39
|
+
position sticky
|
|
40
|
+
top var(--sticky)
|
|
41
|
+
z-index 4
|
|
42
|
+
background var(--panel)
|
|
43
|
+
backdrop-filter blur(4px)
|
|
44
|
+
--sticky 0px
|
|
45
|
+
|
|
46
|
+
.sticky-content
|
|
47
|
+
.sticky
|
|
48
|
+
z-index 3
|
|
49
|
+
--sticky 40px
|
|
50
|
+
.sticky-content
|
|
51
|
+
.sticky
|
|
52
|
+
z-index 2
|
|
53
|
+
--sticky 80px
|
|
54
|
+
.sticky-content
|
|
55
|
+
.sticky
|
|
56
|
+
z-index 1
|
|
57
|
+
--sticky 80px
|
|
58
|
+
.sticky-content
|
|
59
|
+
.sticky
|
|
60
|
+
z-index 0
|
|
61
|
+
--sticky 80px
|
|
62
|
+
|
|
63
|
+
if linksStyle('heading')
|
|
64
|
+
@import '_article/heading'
|
|
65
|
+
|
|
66
|
+
@import '_article/other'
|
|
67
|
+
|
|
68
|
+
if linksStyle('image')
|
|
69
|
+
@import '_article/image'
|
|
70
|
+
|
|
71
|
+
if linksStyle('table')
|
|
72
|
+
@import '_article/table'
|
|
73
|
+
|
|
74
|
+
if linksStyle('list')
|
|
75
|
+
@import '_article/list'
|
|
76
|
+
|
|
77
|
+
if linksStyle('footnote')
|
|
78
|
+
@import '_article/footnote'
|
|
79
|
+
|
|
80
|
+
if linksStyle('tabs')
|
|
81
|
+
@import '_article/tabs'
|
|
82
|
+
|
|
83
|
+
if linksStyle('note')
|
|
84
|
+
@import '_article/note'
|
|
85
|
+
|
|
86
|
+
if linksStyle('fold')
|
|
87
|
+
@import '_article/fold'
|
|
88
|
+
|
|
89
|
+
if linksStyle('kbd')
|
|
90
|
+
@import '_article/kbd'
|
|
91
|
+
|
|
92
|
+
// MARK: Links
|
|
93
|
+
.links
|
|
94
|
+
margin 16px 0
|
|
95
|
+
text-align center
|
|
96
|
+
text-wrap balance
|
|
97
|
+
a
|
|
98
|
+
position relative
|
|
99
|
+
display inline-block
|
|
100
|
+
margin 8px
|
|
101
|
+
padding 16px
|
|
102
|
+
max-width 300px
|
|
103
|
+
width 100%
|
|
104
|
+
border 1px solid var(--border)
|
|
105
|
+
background var(--panel)
|
|
106
|
+
color var(--text)
|
|
107
|
+
text-align left
|
|
108
|
+
text-decoration none
|
|
109
|
+
transition .1s
|
|
110
|
+
&:hover
|
|
111
|
+
border-color var(--theme)
|
|
112
|
+
color var(--text)
|
|
113
|
+
&:after
|
|
114
|
+
opacity .5
|
|
115
|
+
img
|
|
116
|
+
width 48px
|
|
117
|
+
height 48px
|
|
118
|
+
object-fit cover
|
|
119
|
+
|
|
120
|
+
.link-title
|
|
121
|
+
font-weight bold
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
@import '_index'
|
|
2
|
+
@import '_article/other'
|
|
3
|
+
@import '_article/heading'
|
|
4
|
+
@import '_article/image'
|
|
5
|
+
@import '_article/table'
|
|
6
|
+
@import '_article/list'
|
|
7
|
+
@import '_article/footnote'
|
|
8
|
+
@import '_article/tabs'
|
|
9
|
+
@import '_article/note'
|
|
10
|
+
@import '_article/fold'
|
|
11
|
+
@import '_article/kbd'
|
|
12
|
+
@import '_article/links'
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
import type { ArrayOr } from 'ezal';
|
|
3
|
+
import type { TokenizeOptions } from 'ezal-markdown';
|
|
4
|
+
import type { RawTheme } from 'shiki';
|
|
5
|
+
export interface NavItem {
|
|
6
|
+
name: string;
|
|
7
|
+
link: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Contact {
|
|
10
|
+
url: string;
|
|
11
|
+
name: string;
|
|
12
|
+
icon: string;
|
|
13
|
+
color: string;
|
|
14
|
+
}
|
|
15
|
+
export interface Link {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
link: string;
|
|
19
|
+
avatar: string;
|
|
20
|
+
color: string;
|
|
21
|
+
}
|
|
22
|
+
export interface LinkGroup {
|
|
23
|
+
title: string;
|
|
24
|
+
description: string;
|
|
25
|
+
items: Link[];
|
|
26
|
+
}
|
|
27
|
+
export type LinkPageStyles = 'image' | 'table' | 'heading' | 'list' | 'footnote' | 'tabs' | 'note' | 'fold' | 'kbd';
|
|
28
|
+
export interface ThemeConfig {
|
|
29
|
+
/** 导航栏 */
|
|
30
|
+
nav?: NavItem[];
|
|
31
|
+
/** 站点图标 */
|
|
32
|
+
favicon?: ArrayOr<string>;
|
|
33
|
+
/** 主题色 */
|
|
34
|
+
color?: {
|
|
35
|
+
/** @default '#006000' */
|
|
36
|
+
light?: string;
|
|
37
|
+
/** @default '#00BB00' */
|
|
38
|
+
dark?: string;
|
|
39
|
+
};
|
|
40
|
+
/** 建站时间 */
|
|
41
|
+
since?: Temporal.ZonedDateTime;
|
|
42
|
+
/** 联系方式 */
|
|
43
|
+
contact?: Contact[];
|
|
44
|
+
/** 友情链接 */
|
|
45
|
+
links?: LinkGroup[];
|
|
46
|
+
/**
|
|
47
|
+
* 友情链接页面启用的样式
|
|
48
|
+
* @default 全部启用
|
|
49
|
+
*/
|
|
50
|
+
linkPageStyles?: LinkPageStyles[];
|
|
51
|
+
/** Markdown 配置 */
|
|
52
|
+
markdown?: {
|
|
53
|
+
/**
|
|
54
|
+
* 换行规则
|
|
55
|
+
* @description
|
|
56
|
+
* - `common-mark`:CommonMark 规范,行尾 2+ 空格渲染为换行
|
|
57
|
+
* - `soft`:软换行,换行符 `\n` 渲染为换行
|
|
58
|
+
* @default `common-mark`
|
|
59
|
+
*/
|
|
60
|
+
lineBreak?: TokenizeOptions['lineBreak'];
|
|
61
|
+
/**
|
|
62
|
+
* 代码块主题
|
|
63
|
+
* @default {light:'light-plus',dark:'dark-plus'}
|
|
64
|
+
*/
|
|
65
|
+
codeBlockTheme?: {
|
|
66
|
+
light: RawTheme;
|
|
67
|
+
dark: RawTheme;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
/** 主页设置 */
|
|
71
|
+
home?: {
|
|
72
|
+
/**
|
|
73
|
+
* 每页文章数量
|
|
74
|
+
* @default 10
|
|
75
|
+
*/
|
|
76
|
+
articlesPrePage?: number;
|
|
77
|
+
logo?: {
|
|
78
|
+
viewBox: string;
|
|
79
|
+
g: string;
|
|
80
|
+
};
|
|
81
|
+
slogan?: string;
|
|
82
|
+
};
|
|
83
|
+
imageCache?: {
|
|
84
|
+
/**
|
|
85
|
+
* 图像元数据缓存路径
|
|
86
|
+
* @description
|
|
87
|
+
* 支持绝对路径和相对路径,相对路径将以工作目录为起点。
|
|
88
|
+
* 默认为工作目录下 `image-metadata.sqlite`。
|
|
89
|
+
*/
|
|
90
|
+
metadata?: string;
|
|
91
|
+
/**
|
|
92
|
+
* 优化版图像缓存路径
|
|
93
|
+
* @description
|
|
94
|
+
* 支持绝对路径和相对路径,相对路径将以工作目录为起点。
|
|
95
|
+
* 默认为工作目录下 `cache`。
|
|
96
|
+
*/
|
|
97
|
+
optimized?: string;
|
|
98
|
+
};
|
|
99
|
+
cdn?: {
|
|
100
|
+
/** @default 'https://unpkg.com/katex@0.16.21/dist/katex.min.css' */
|
|
101
|
+
katex?: string;
|
|
102
|
+
/** @default 'https://unpkg.com/@waline/client@v3/dist/waline.css' */
|
|
103
|
+
walineCSS?: string;
|
|
104
|
+
/** @default 'https://unpkg.com/@waline/client@v3/dist/waline.js' */
|
|
105
|
+
walineJS?: string;
|
|
106
|
+
};
|
|
107
|
+
/** HTML 头部插入内容 */
|
|
108
|
+
inject?: string;
|
|
109
|
+
/** IndexNow 配置 */
|
|
110
|
+
indexNow?: {
|
|
111
|
+
/** Bing IndexNow 密钥 */
|
|
112
|
+
bing?: string;
|
|
113
|
+
/** Yandex IndexNow 密钥 */
|
|
114
|
+
yandex?: string;
|
|
115
|
+
};
|
|
116
|
+
/** Waline 评论配置 */
|
|
117
|
+
waline?: {
|
|
118
|
+
/** 后端地址 */
|
|
119
|
+
serverURL: string;
|
|
120
|
+
visitor?: boolean;
|
|
121
|
+
commentCount?: boolean;
|
|
122
|
+
pageview?: boolean;
|
|
123
|
+
emoji?: string[];
|
|
124
|
+
reaction?: string[];
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
export declare function setThemeConfig(cfg?: ThemeConfig): void;
|
|
128
|
+
export declare function getThemeConfig(): ThemeConfig;
|
package/dist/feed.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Asset, VirtualAssets } from 'ezal';
|
|
2
|
+
import Sharp from 'sharp';
|
|
3
|
+
declare const OPTIMIZE: {
|
|
4
|
+
readonly '.avif': (sharp: Sharp.Sharp) => Promise<Buffer<ArrayBufferLike>>;
|
|
5
|
+
readonly '.webp': (sharp: Sharp.Sharp) => Promise<Buffer<ArrayBufferLike>>;
|
|
6
|
+
readonly '.jxl': (sharp: Sharp.Sharp) => Promise<Buffer<ArrayBufferLike>>;
|
|
7
|
+
readonly '.jpg': (sharp: Sharp.Sharp) => Promise<Buffer<ArrayBufferLike>>;
|
|
8
|
+
readonly '.png': (sharp: Sharp.Sharp) => Promise<Buffer<ArrayBufferLike>>;
|
|
9
|
+
readonly '.gif': (sharp: Sharp.Sharp) => Promise<Buffer<ArrayBufferLike>>;
|
|
10
|
+
};
|
|
11
|
+
export type OptimizedImageExt = keyof typeof OPTIMIZE;
|
|
12
|
+
export declare class OptimizedImage extends VirtualAssets {
|
|
13
|
+
#private;
|
|
14
|
+
/**
|
|
15
|
+
* @param asset 源资源
|
|
16
|
+
* @param target 目标优化格式
|
|
17
|
+
*/
|
|
18
|
+
constructor(asset: Asset, ext: OptimizedImageExt);
|
|
19
|
+
build(): Promise<Buffer<ArrayBufferLike> | import("fs").ReadStream>;
|
|
20
|
+
protected onDependenciesChanged(): void;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface ImageMetadata {
|
|
2
|
+
path: string;
|
|
3
|
+
hash: string;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
color: string | null;
|
|
7
|
+
}
|
|
8
|
+
declare function getMetadata(url: string): ImageMetadata | null;
|
|
9
|
+
declare function updateMetadata(data: ImageMetadata): boolean;
|
|
10
|
+
declare function deleteMetadata(url: string): boolean;
|
|
11
|
+
declare function initImageMetadataDB(): void;
|
|
12
|
+
export declare const imageDB: {
|
|
13
|
+
init: typeof initImageMetadataDB;
|
|
14
|
+
get: typeof getMetadata;
|
|
15
|
+
update: typeof updateMetadata;
|
|
16
|
+
delete: typeof deleteMetadata;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Asset } from 'ezal';
|
|
2
|
+
import { type ImageMetadata } from './db';
|
|
3
|
+
export interface ImageInfo {
|
|
4
|
+
metadata: ImageMetadata | null;
|
|
5
|
+
rule?: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function getImageInfo(url: string): ImageInfo | null;
|
|
8
|
+
export declare function imageAddHook(asset: Asset): Promise<void>;
|
|
9
|
+
export declare function imageUpdateHook(asset: Asset): Promise<void>;
|
|
10
|
+
export declare function imageRemoveHook(asset: Asset): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getOptimizedPath(filepath: string, ext: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function exeIndexNow(): Promise<void>;
|
package/dist/index.d.ts
ADDED