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.
Files changed (102) hide show
  1. package/LICENSE +21 -0
  2. package/assets/scripts/404.ts +353 -0
  3. package/assets/scripts/_article.ts +290 -0
  4. package/assets/scripts/_base.ts +65 -0
  5. package/assets/scripts/_pagefind.d.ts +424 -0
  6. package/assets/scripts/_search.ts +88 -0
  7. package/assets/scripts/_utils.ts +74 -0
  8. package/assets/scripts/archive.ts +143 -0
  9. package/assets/scripts/article.ts +18 -0
  10. package/assets/scripts/category.ts +4 -0
  11. package/assets/scripts/home.ts +73 -0
  12. package/assets/scripts/links.ts +14 -0
  13. package/assets/scripts/main.ts +11 -0
  14. package/assets/scripts/page.ts +11 -0
  15. package/assets/scripts/tag.ts +4 -0
  16. package/assets/scripts/tsconfig.json +10 -0
  17. package/assets/styles/404.styl +31 -0
  18. package/assets/styles/_article/fold.styl +15 -0
  19. package/assets/styles/_article/footnote.styl +12 -0
  20. package/assets/styles/_article/heading.styl +29 -0
  21. package/assets/styles/_article/image.styl +30 -0
  22. package/assets/styles/_article/kbd.styl +10 -0
  23. package/assets/styles/_article/links.styl +31 -0
  24. package/assets/styles/_article/list.styl +19 -0
  25. package/assets/styles/_article/note.styl +18 -0
  26. package/assets/styles/_article/other.styl +44 -0
  27. package/assets/styles/_article/table.styl +29 -0
  28. package/assets/styles/_article/tabs.styl +25 -0
  29. package/assets/styles/_code.styl +83 -0
  30. package/assets/styles/_index/contact.styl +20 -0
  31. package/assets/styles/_index/footer.styl +5 -0
  32. package/assets/styles/_index/header.styl +40 -0
  33. package/assets/styles/_index/nav.styl +59 -0
  34. package/assets/styles/_index/search.styl +64 -0
  35. package/assets/styles/_index.styl +91 -0
  36. package/assets/styles/_var.styl +96 -0
  37. package/assets/styles/archive.styl +35 -0
  38. package/assets/styles/article.styl +138 -0
  39. package/assets/styles/category.styl +4 -0
  40. package/assets/styles/home.styl +124 -0
  41. package/assets/styles/links.styl +121 -0
  42. package/assets/styles/page.styl +12 -0
  43. package/assets/styles/tag.styl +4 -0
  44. package/dist/config.d.ts +128 -0
  45. package/dist/feed.d.ts +4 -0
  46. package/dist/image/asset.d.ts +22 -0
  47. package/dist/image/db.d.ts +18 -0
  48. package/dist/image/index.d.ts +10 -0
  49. package/dist/image/metadata.d.ts +2 -0
  50. package/dist/image/utils.d.ts +1 -0
  51. package/dist/index-now.d.ts +1 -0
  52. package/dist/index.d.ts +3 -0
  53. package/dist/index.js +2066 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/layout.d.ts +2 -0
  56. package/dist/markdown/codeblock/data.d.ts +1 -0
  57. package/dist/markdown/codeblock/index.d.ts +6 -0
  58. package/dist/markdown/codeblock/style.d.ts +2 -0
  59. package/dist/markdown/fold.d.ts +6 -0
  60. package/dist/markdown/footnote.d.ts +15 -0
  61. package/dist/markdown/image.d.ts +12 -0
  62. package/dist/markdown/index.d.ts +2 -0
  63. package/dist/markdown/kbd.d.ts +6 -0
  64. package/dist/markdown/link.d.ts +2 -0
  65. package/dist/markdown/links.d.ts +12 -0
  66. package/dist/markdown/note.d.ts +8 -0
  67. package/dist/markdown/table.d.ts +3 -0
  68. package/dist/markdown/tabs.d.ts +7 -0
  69. package/dist/markdown/tex.d.ts +9 -0
  70. package/dist/page/404.d.ts +1 -0
  71. package/dist/page/archive.d.ts +1 -0
  72. package/dist/page/category.d.ts +1 -0
  73. package/dist/page/home.d.ts +2 -0
  74. package/dist/page/tag.d.ts +1 -0
  75. package/dist/pagefind.d.ts +20 -0
  76. package/dist/sitemap.d.ts +2 -0
  77. package/dist/transform/script.d.ts +2 -0
  78. package/dist/transform/stylus.d.ts +2 -0
  79. package/dist/utils.d.ts +2 -0
  80. package/layouts/404.tsx +8 -0
  81. package/layouts/archive.tsx +81 -0
  82. package/layouts/article.tsx +145 -0
  83. package/layouts/base.tsx +20 -0
  84. package/layouts/category.tsx +18 -0
  85. package/layouts/components/ArchiveArticleList.tsx +14 -0
  86. package/layouts/components/Article.tsx +46 -0
  87. package/layouts/components/Contact.tsx +14 -0
  88. package/layouts/components/Footer.tsx +44 -0
  89. package/layouts/components/Head.tsx +119 -0
  90. package/layouts/components/Image.tsx +42 -0
  91. package/layouts/components/Nav.tsx +33 -0
  92. package/layouts/components/Search.tsx +20 -0
  93. package/layouts/components/Waline.tsx +22 -0
  94. package/layouts/context.d.ts +54 -0
  95. package/layouts/home.tsx +74 -0
  96. package/layouts/links.tsx +53 -0
  97. package/layouts/page.tsx +19 -0
  98. package/layouts/tag.tsx +18 -0
  99. package/layouts/tsconfig.json +11 -0
  100. package/package.json +47 -0
  101. package/readme.md +17 -0
  102. package/readme_zh.md +17 -0
@@ -0,0 +1,53 @@
1
+ import { type Page, URL } from 'ezal';
2
+ import base from './base';
3
+
4
+ const page = context.page as Page;
5
+
6
+ const groups: JSX.Element[] = [];
7
+
8
+ function shuffle<T>(array: T[]): T[] {
9
+ for (let i = array.length - 1; i > 0; i--) {
10
+ const j = Math.trunc(Math.random() * (i + 1));
11
+ if (i === j) continue;
12
+ [array[i], array[j]] = [array[j], array[i]];
13
+ }
14
+ return array;
15
+ }
16
+
17
+ for (const group of context.theme.links ?? []) {
18
+ const links: JSX.Element[] = [];
19
+ for (const item of group.items) {
20
+ links.push(
21
+ <a
22
+ class="rounded link"
23
+ href={URL.for(item.link)}
24
+ style={{ $theme: item.color }}
25
+ >
26
+ <img class="rounded loaded" src={URL.for(item.avatar)} alt={item.name} />
27
+ <div class="link-title">{item.name}</div>
28
+ <div>{item.description}</div>
29
+ </a>,
30
+ );
31
+ }
32
+ groups.push(
33
+ <hgroup>
34
+ <h2>{group.title}</h2>
35
+ <p>{group.description}</p>
36
+ </hgroup>,
37
+ <div class="links">{shuffle(links)}</div>,
38
+ );
39
+ }
40
+
41
+ export default base(
42
+ <header>
43
+ <div class="wrap">
44
+ <h1>{page.title}</h1>
45
+ </div>
46
+ </header>,
47
+ <main>
48
+ <article>
49
+ <RawHTML html={page.content}></RawHTML>
50
+ {groups}
51
+ </article>
52
+ </main>,
53
+ );
@@ -0,0 +1,19 @@
1
+ import type { Page } from 'ezal';
2
+ import base from './base';
3
+ import Image from './components/Image';
4
+
5
+ const page = context.page as Page;
6
+
7
+ export default base(
8
+ <header>
9
+ {page.data.cover ? <Image url={page.data.cover} alt={page.title} /> : null}
10
+ <div class="wrap">
11
+ <h1>{page.title}</h1>
12
+ </div>
13
+ </header>,
14
+ <main>
15
+ <article>
16
+ <RawHTML html={page.content} />
17
+ </article>
18
+ </main>,
19
+ );
@@ -0,0 +1,18 @@
1
+ import base from './base';
2
+ import ArchiveArticleList from './components/ArchiveArticleList';
3
+ import type { TagPage } from './context';
4
+
5
+ const page = context.page as TagPage;
6
+
7
+ export default base(
8
+ <header>
9
+ <div class="wrap">
10
+ <h1>{page.title}</h1>
11
+ </div>
12
+ </header>,
13
+ <main>
14
+ <ArchiveArticleList
15
+ articles={page.data.tag.getArticles().sort(context.compareByDate)}
16
+ />
17
+ </main>,
18
+ );
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "../node_modules/ezal-layout/tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "types": ["../node_modules/ezal-layout/runtime.d.ts", "./context.d.ts"]
5
+ },
6
+ "include": [
7
+ "./**/*",
8
+ "../node_modules/ezal-layout/runtime.d.ts",
9
+ "./context.d.ts"
10
+ ]
11
+ }
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "ezal-theme-example",
3
+ "version": "0.0.1",
4
+ "author": "jonnyjong",
5
+ "license": "MIT",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "peerDependencies": {
9
+ "ezal": "^3.0.0"
10
+ },
11
+ "engines": {
12
+ "node": ">=22"
13
+ },
14
+ "dependencies": {
15
+ "@js-temporal/polyfill": "^0.5.1",
16
+ "@shikijs/colorized-brackets": "^3.15.0",
17
+ "@shikijs/transformers": "^3.15.0",
18
+ "@vscode/vscode-languagedetection": "^1.0.22",
19
+ "better-sqlite3": "^12.4.1",
20
+ "clean-css": "^5.3.3",
21
+ "d3-cloud": "^1.2.7",
22
+ "d3-hierarchy": "^3.1.2",
23
+ "esbuild": "^0.27.0",
24
+ "ezal-markdown": "^0.4.4",
25
+ "feed": "^5.1.0",
26
+ "hammerjs": "^2.0.8",
27
+ "indexnow": "^0.1.0",
28
+ "katex": "^0.16.25",
29
+ "mime-types": "^3.0.1",
30
+ "node-vibrant": "^4.0.3",
31
+ "pagefind": "^1.4.0",
32
+ "sharp": "^0.34.5",
33
+ "shiki": "^3.15.0",
34
+ "sitemap": "^9.0.0",
35
+ "stylus": "^0.64.0",
36
+ "ezal-layout": "^0.0.1"
37
+ },
38
+ "devDependencies": {
39
+ "@types/better-sqlite3": "^7.6.13",
40
+ "@types/clean-css": "^4.2.11",
41
+ "@types/d3-cloud": "^1.2.9",
42
+ "@types/d3-hierarchy": "^3.1.7",
43
+ "@types/hammerjs": "^2.0.46",
44
+ "@types/mime-types": "^3.0.1",
45
+ "@types/stylus": "^0.48.43"
46
+ }
47
+ }
package/readme.md ADDED
@@ -0,0 +1,17 @@
1
+ English | [中文](./readme_zh.md)
2
+
3
+ # ezal-theme-example
4
+
5
+ Sample theme for the ezal blog framework.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ pnpm install ezal-layout
11
+ yarn add ezal-layout
12
+ pnpm add ezal-layout
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ [docs](https://jonnyjong.github.io/ezal/docs/en/theme/)
package/readme_zh.md ADDED
@@ -0,0 +1,17 @@
1
+ [English](./readme.md) | 中文
2
+
3
+ # ezal-theme-example
4
+
5
+ ezal 博客框架的示例主题。
6
+
7
+ ## 安装
8
+
9
+ ```sh
10
+ pnpm install ezal-layout
11
+ yarn add ezal-layout
12
+ pnpm add ezal-layout
13
+ ```
14
+
15
+ ## 使用
16
+
17
+ [文档](https://jonnyjong.github.io/ezal/docs/zh/theme/)