@xingwangzhe/stalux 1.2.0

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 (214) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +192 -0
  3. package/package.json +108 -0
  4. package/scripts/cli.mjs +103 -0
  5. package/src/assets/BiCcCircle.svg +1 -0
  6. package/src/assets/astro.svg +1 -0
  7. package/src/assets/background/README.md +3 -0
  8. package/src/assets/background/pattern-1.min.svg +1 -0
  9. package/src/assets/background/pattern-10.min.svg +1 -0
  10. package/src/assets/background/pattern-11.min.svg +1 -0
  11. package/src/assets/background/pattern-12.min.svg +1 -0
  12. package/src/assets/background/pattern-13.min.svg +1 -0
  13. package/src/assets/background/pattern-14.min.svg +1 -0
  14. package/src/assets/background/pattern-15.min.svg +1 -0
  15. package/src/assets/background/pattern-16.min.svg +1 -0
  16. package/src/assets/background/pattern-17.min.svg +1 -0
  17. package/src/assets/background/pattern-18.min.svg +1 -0
  18. package/src/assets/background/pattern-19.min.svg +1 -0
  19. package/src/assets/background/pattern-2.min.svg +1 -0
  20. package/src/assets/background/pattern-20.min.svg +1 -0
  21. package/src/assets/background/pattern-21.min.svg +1 -0
  22. package/src/assets/background/pattern-22.min.svg +1 -0
  23. package/src/assets/background/pattern-23.min.svg +1 -0
  24. package/src/assets/background/pattern-24.min.svg +1 -0
  25. package/src/assets/background/pattern-25.min.svg +1 -0
  26. package/src/assets/background/pattern-26.min.svg +1 -0
  27. package/src/assets/background/pattern-27.min.svg +1 -0
  28. package/src/assets/background/pattern-28.min.svg +1 -0
  29. package/src/assets/background/pattern-29.min.svg +1 -0
  30. package/src/assets/background/pattern-3.min.svg +1 -0
  31. package/src/assets/background/pattern-30.min.svg +1 -0
  32. package/src/assets/background/pattern-31.min.svg +1 -0
  33. package/src/assets/background/pattern-32.min.svg +1 -0
  34. package/src/assets/background/pattern-33.min.svg +1 -0
  35. package/src/assets/background/pattern-34.min.svg +1 -0
  36. package/src/assets/background/pattern-35.min.svg +1 -0
  37. package/src/assets/background/pattern-36.min.svg +1 -0
  38. package/src/assets/background/pattern-37.min.svg +1 -0
  39. package/src/assets/background/pattern-38.min.svg +1 -0
  40. package/src/assets/background/pattern-39.min.svg +1 -0
  41. package/src/assets/background/pattern-4.min.svg +1 -0
  42. package/src/assets/background/pattern-40.min.svg +1 -0
  43. package/src/assets/background/pattern-41.min.svg +1 -0
  44. package/src/assets/background/pattern-42.min.svg +1 -0
  45. package/src/assets/background/pattern-5.min.svg +1 -0
  46. package/src/assets/background/pattern-6.min.svg +1 -0
  47. package/src/assets/background/pattern-7.min.svg +1 -0
  48. package/src/assets/background/pattern-8.min.svg +1 -0
  49. package/src/assets/background/pattern-9.min.svg +1 -0
  50. package/src/assets/background.svg +1 -0
  51. package/src/assets/cc-icon.svg +4 -0
  52. package/src/assets/fonts/GoogleSansCode-Italic.woff2 +0 -0
  53. package/src/assets/fonts/GoogleSansCode.woff2 +0 -0
  54. package/src/assets/fonts/LXGWWenKai-Regular.ttf +0 -0
  55. package/src/assets/fonts/LXGWWenKai-Regular.woff2 +0 -0
  56. package/src/components/stalux/analytics/clarity.astro +25 -0
  57. package/src/components/stalux/analytics/google.astro +31 -0
  58. package/src/components/stalux/analytics/umami.astro +16 -0
  59. package/src/components/stalux/archives/archivesList.astro +116 -0
  60. package/src/components/stalux/archives/toArchive.astro +14 -0
  61. package/src/components/stalux/categories/categoriesCard.astro +49 -0
  62. package/src/components/stalux/categories/categoriesList.astro +17 -0
  63. package/src/components/stalux/common/author.astro +35 -0
  64. package/src/components/stalux/common/date.astro +59 -0
  65. package/src/components/stalux/common/search.astro +14 -0
  66. package/src/components/stalux/common/textType.astro +16 -0
  67. package/src/components/stalux/common/verCount.astro +10 -0
  68. package/src/components/stalux/footer/FooterBadges.astro +150 -0
  69. package/src/components/stalux/footer/FooterBeian.astro +91 -0
  70. package/src/components/stalux/footer/FooterCopyright.astro +40 -0
  71. package/src/components/stalux/footer/FooterStats.astro +108 -0
  72. package/src/components/stalux/footer/FooterThemeInfo.astro +67 -0
  73. package/src/components/stalux/layout/footer.astro +87 -0
  74. package/src/components/stalux/layout/head.astro +194 -0
  75. package/src/components/stalux/layout/listPage.astro +26 -0
  76. package/src/components/stalux/layout/navs.astro +174 -0
  77. package/src/components/stalux/links/linkCard.astro +50 -0
  78. package/src/components/stalux/links/linkList.astro +20 -0
  79. package/src/components/stalux/links/socialMedia.astro +102 -0
  80. package/src/components/stalux/posts/PhotoSwipeStyle.astro +3 -0
  81. package/src/components/stalux/posts/PostTaxonomy.astro +65 -0
  82. package/src/components/stalux/posts/WalineComment.astro +609 -0
  83. package/src/components/stalux/posts/postAuthor.astro +23 -0
  84. package/src/components/stalux/posts/postCC.astro +52 -0
  85. package/src/components/stalux/posts/postCard.astro +83 -0
  86. package/src/components/stalux/posts/postContent.astro +174 -0
  87. package/src/components/stalux/posts/postLeft.astro +41 -0
  88. package/src/components/stalux/posts/postList.astro +25 -0
  89. package/src/components/stalux/posts/postNavigation.astro +137 -0
  90. package/src/components/stalux/posts/postRight.astro +33 -0
  91. package/src/components/stalux/posts/postToc.astro +88 -0
  92. package/src/components/stalux/posts/randomPost.astro +134 -0
  93. package/src/components/stalux/tags/tagHeader.astro +50 -0
  94. package/src/components/stalux/tags/tagsCloud.astro +100 -0
  95. package/src/components/stalux/words/wordCard.astro +62 -0
  96. package/src/components/stalux/words/wordList.astro +70 -0
  97. package/src/config.ts +58 -0
  98. package/src/i18n/en.json +193 -0
  99. package/src/i18n/zh-CN.json +193 -0
  100. package/src/index.ts +215 -0
  101. package/src/internal/components-plugin.ts +54 -0
  102. package/src/internal/dev-toolbar.ts +33 -0
  103. package/src/internal/override.ts +99 -0
  104. package/src/internal/pagefind.ts +40 -0
  105. package/src/layouts/PostLayout.astro +90 -0
  106. package/src/layouts/Stalux.astro +91 -0
  107. package/src/pages/404.astro +103 -0
  108. package/src/pages/about.astro +59 -0
  109. package/src/pages/about.md.ts +15 -0
  110. package/src/pages/api/post.abbrlink.json.ts +20 -0
  111. package/src/pages/archives.astro +23 -0
  112. package/src/pages/archives.md.ts +24 -0
  113. package/src/pages/atom.xml.ts +29 -0
  114. package/src/pages/categories/[category].astro +35 -0
  115. package/src/pages/categories/[category].md.ts +34 -0
  116. package/src/pages/categories/index.astro +23 -0
  117. package/src/pages/categories/index.md.ts +27 -0
  118. package/src/pages/index.astro +30 -0
  119. package/src/pages/index.md.ts +18 -0
  120. package/src/pages/links.astro +23 -0
  121. package/src/pages/links.md.ts +18 -0
  122. package/src/pages/llms-full.txt.ts +25 -0
  123. package/src/pages/llms.txt.ts +26 -0
  124. package/src/pages/posts/[post].astro +69 -0
  125. package/src/pages/posts/[post].md.ts +109 -0
  126. package/src/pages/rss.xml.ts +29 -0
  127. package/src/pages/tags/[tag].astro +37 -0
  128. package/src/pages/tags/[tag].md.ts +34 -0
  129. package/src/pages/tags/index.astro +23 -0
  130. package/src/pages/tags/index.md.ts +27 -0
  131. package/src/pages/words.astro +24 -0
  132. package/src/pages/words.md.ts +14 -0
  133. package/src/plugins/feature-flags.ts +68 -0
  134. package/src/plugins/satteri-temml.ts +81 -0
  135. package/src/schemas/collections.ts +140 -0
  136. package/src/schemas/config.ts +226 -0
  137. package/src/scripts/background.ts +59 -0
  138. package/src/styles/base/init.css +286 -0
  139. package/src/styles/base/math.css +411 -0
  140. package/src/styles/components/archives/archivesList.module.css +378 -0
  141. package/src/styles/components/archives/toArchive.module.css +3 -0
  142. package/src/styles/components/categories/categoriesCard.module.css +87 -0
  143. package/src/styles/components/categories/categoriesList.module.css +27 -0
  144. package/src/styles/components/common/author.module.css +73 -0
  145. package/src/styles/components/common/date.module.css +15 -0
  146. package/src/styles/components/common/textType.module.css +10 -0
  147. package/src/styles/components/footer/footer.module.css +44 -0
  148. package/src/styles/components/layout/navs.module.css +250 -0
  149. package/src/styles/components/links/linkCard.module.css +99 -0
  150. package/src/styles/components/links/linkList.module.css +67 -0
  151. package/src/styles/components/links/socialLinks.module.css +22 -0
  152. package/src/styles/components/markdown.css +528 -0
  153. package/src/styles/components/posts/postAuthor.module.css +32 -0
  154. package/src/styles/components/posts/postCC.module.css +138 -0
  155. package/src/styles/components/posts/postCard.module.css +156 -0
  156. package/src/styles/components/posts/postCategories.module.css +50 -0
  157. package/src/styles/components/posts/postContent.module.css +230 -0
  158. package/src/styles/components/posts/postLayout.module.css +142 -0
  159. package/src/styles/components/posts/postLeft.module.css +38 -0
  160. package/src/styles/components/posts/postList.module.css +24 -0
  161. package/src/styles/components/posts/postNavigation.module.css +187 -0
  162. package/src/styles/components/posts/postRight.module.css +60 -0
  163. package/src/styles/components/posts/postSidebar.module.css +57 -0
  164. package/src/styles/components/posts/postTags.module.css +51 -0
  165. package/src/styles/components/posts/postTaxonomy.module.css +87 -0
  166. package/src/styles/components/posts/postToc.module.css +74 -0
  167. package/src/styles/components/posts/randomPost.module.css +131 -0
  168. package/src/styles/components/tags/tagHeader.module.css +44 -0
  169. package/src/styles/components/tags/tagsCloud.module.css +124 -0
  170. package/src/styles/components/words/wordCard.module.css +130 -0
  171. package/src/styles/components/words/wordList.module.css +39 -0
  172. package/src/styles/pages/archives.module.css +18 -0
  173. package/src/styles/pages/categories.module.css +13 -0
  174. package/src/styles/pages/home.module.css +51 -0
  175. package/src/styles/pages/listPage.module.css +13 -0
  176. package/src/styles/pages/tags.module.css +12 -0
  177. package/src/styles/pages/words.module.css +13 -0
  178. package/src/styles/shared/animations.css +87 -0
  179. package/src/styles/shared/stagger.css +20 -0
  180. package/src/utils/ai-discovery.ts +547 -0
  181. package/src/utils/badge-generator.ts +68 -0
  182. package/src/utils/cc.ts +46 -0
  183. package/src/utils/collections-stats.ts +48 -0
  184. package/src/utils/config-utils.ts +107 -0
  185. package/src/utils/count-words.ts +20 -0
  186. package/src/utils/dayjs.ts +106 -0
  187. package/src/utils/feed.ts +70 -0
  188. package/src/utils/i18n.ts +64 -0
  189. package/src/utils/lucide-icons.ts +52 -0
  190. package/src/utils/semantic-time.ts +11 -0
  191. package/src/utils/taxonomy.ts +44 -0
  192. package/src/utils/toc-scrollspy.ts +95 -0
  193. package/src/utils/waline.ts +27 -0
  194. package/src/utils/word-count-utils.ts +83 -0
  195. package/template/astro.config.mjs +51 -0
  196. package/template/package.json +27 -0
  197. package/template/public/robots.txt +3 -0
  198. package/template/src/content.config.ts +11 -0
  199. package/template/stalux/about/index.md +14 -0
  200. package/template/stalux/config/ai-discovery.yml +2 -0
  201. package/template/stalux/config/author.yml +4 -0
  202. package/template/stalux/config/comment.yml +5 -0
  203. package/template/stalux/config/footer.yml +13 -0
  204. package/template/stalux/config/head.yml +7 -0
  205. package/template/stalux/config/links.yml +4 -0
  206. package/template/stalux/config/media-links.yml +8 -0
  207. package/template/stalux/config/navs.yml +23 -0
  208. package/template/stalux/config/promote.yml +2 -0
  209. package/template/stalux/config/site.yml +7 -0
  210. package/template/stalux/config/typetexts.yml +5 -0
  211. package/template/stalux/posts/hello-stalux.md +47 -0
  212. package/template/stalux/words/_template.md +12 -0
  213. package/template/stalux/words/einstein-imagination.md +8 -0
  214. package/template/tsconfig.json +9 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 王兴家 (Xingwangzhe)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,192 @@
1
+ [中文文档](./README_CN.md) | English
2
+
3
+ [![CI](https://github.com/xingwangzhe/stalux/actions/workflows/ci.yml/badge.svg?branch=newMain)](https://github.com/xingwangzhe/stalux/actions/workflows/ci.yml)
4
+
5
+ # Stalux — Modern Astro Blog Theme
6
+
7
+ **Dual-mode: Use as a template 📦 or install as a plugin 🔌**
8
+
9
+ **[stalux.needhelp.icu](https://stalux.needhelp.icu)**
10
+
11
+ Elegant, high-performance, easily configurable Astro static blog theme.
12
+
13
+ In terms of design, Stalux draws on minimalism and moderate decoration: it maintains an overall dark tone with subtle glassmorphism textures, and the background uses tiled decorative patterns to enhance visual depth without being distracting.
14
+
15
+ In terms of experience, Stalux balances SSG's high performance with the smooth feel of page transitions without full reloads. Through view transitions and handling of `astro:page-load` events, the theme keeps the header, footer, and other common components stable during navigation or main content switching.
16
+
17
+ Content-first is one of the theme's core principles: writing and presentation are considered top priority. The theme supports CommonMark, code highlighting, Mermaid flowcharts, and KaTeX math formulas out of the box.
18
+
19
+ ---
20
+
21
+ ## 🚀 Two Ways to Use
22
+
23
+ ### Option A: Clone Source Code (Template Mode)
24
+
25
+ Get the full source — modify anything, customize everything:
26
+
27
+ ```bash
28
+ git clone https://github.com/xingwangzhe/stalux.git my-blog
29
+ cd my-blog
30
+ bun install # or npm install
31
+ bun run dev # or npm run dev
32
+ ```
33
+
34
+ ### Option B: Install as Astro Integration (Plugin Mode)
35
+
36
+ Keep your project clean — install stalux as a dependency:
37
+
38
+ ```bash
39
+ npm install @xingwangzhe/stalux
40
+ ```
41
+
42
+ Then initialize the content template:
43
+
44
+ ```bash
45
+ npx @xingwangzhe/stalux init
46
+ # or: npm run init
47
+ ```
48
+
49
+ This creates the `stalux/` directory structure with example content in your project. Then add to `astro.config.mjs`:
50
+
51
+ ```ts
52
+ import { defineConfig } from "astro/config";
53
+ import stalux from "@xingwangzhe/stalux";
54
+
55
+ export default defineConfig({
56
+ integrations: [stalux({
57
+ contentDir: "./content", // customize content directory (default: "stalux")
58
+ components: { // optional: override theme components
59
+ // Navs: "./src/CustomNavs.astro",
60
+ },
61
+ })],
62
+ });
63
+ ```
64
+
65
+ Create `src/content.config.ts`:
66
+
67
+ ```ts
68
+ import { defineCollections } from "stalux/schemas";
69
+ export const collections = defineCollections({ contentDir: "./content" });
70
+ ```
71
+
72
+ Then write your content in `./content/posts/`, `./content/config/`, etc.
73
+
74
+ ---
75
+
76
+ ## 📝 Quick Start: Writing Content
77
+
78
+ Create a markdown file under `stalux/posts/`:
79
+
80
+ ```yaml
81
+ ---
82
+ title: Hello World
83
+ abbrlink: hello-world
84
+ date: 2026-07-27 10:00:00
85
+ tags: [Stalux, Getting Started]
86
+ categories: [Blog]
87
+ desc: A brief description of your post.
88
+ ---
89
+ Your content here...
90
+ ```
91
+
92
+ **Content Directory Structure:**
93
+
94
+ ```
95
+ stalux/
96
+ ├── config/ # YAML configuration files
97
+ │ ├── site.yml # Site metadata
98
+ │ ├── author.yml # Author info
99
+ │ ├── navs.yml # Navigation menu
100
+ │ ├── footer.yml # Footer badges & copyright
101
+ │ ├── links.yml # Friend links
102
+ │ ├── comment.yml # Waline comment config
103
+ │ ├── head.yml # Analytics & custom head
104
+ │ ├── media-links.yml # Social media links
105
+ │ ├── promote.yml # LLM promotion & export
106
+ │ ├── ai-discovery.yml # AI discovery file config
107
+ │ └── typetexts.yml # Typewriter text snippets
108
+ ├── posts/ # Blog posts (Markdown)
109
+ ├── about/index.md # About page
110
+ └── words/ # Quotes / short notes (Markdown)
111
+ ```
112
+
113
+ ---
114
+
115
+ ## ✨ Features
116
+
117
+ - 🌙 **Dark mode** as default, with elegant glassmorphism design
118
+ - 🔍 **Full-text search** via Pagefind (auto-indexed on build)
119
+ - 📡 **RSS & Atom feeds**
120
+ - 🖼️ **PhotoSwipe** image lightbox
121
+ - 📊 **Mermaid** diagrams & flowcharts
122
+ - 📐 **KaTeX / MathML** math rendering
123
+ - 🤖 **LLM discovery files** (llms.txt / llms-full.txt)
124
+ - 💬 **Waline** comment system
125
+ - 📱 **Fully responsive**
126
+ - ⚡ **View transitions** for smooth navigation
127
+ - 🏷️ **Tags, categories, archives**
128
+ - 🌐 **i18n** (zh-CN / en)
129
+
130
+ ---
131
+
132
+ ## 🛠️ Development
133
+
134
+ ```bash
135
+ # Install dependencies
136
+ bun install # recommended
137
+ # npm install
138
+
139
+ # Start dev server
140
+ bun run dev
141
+
142
+ # Build
143
+ bun run build
144
+
145
+ # Preview
146
+ bun run preview
147
+ ```
148
+
149
+ ---
150
+
151
+ ## 🎨 Customizing Components
152
+
153
+ Stalux supports component overrides (like Starlight):
154
+
155
+ ```ts
156
+ import { defineConfig } from "astro/config";
157
+ import stalux from "@xingwangzhe/stalux";
158
+
159
+ export default defineConfig({
160
+ integrations: [stalux({
161
+ components: {
162
+ Navs: "./src/components/CustomNavs.astro",
163
+ Footer: "./src/components/CustomFooter.astro",
164
+ // ... see full list in src/internal/override.ts
165
+ }
166
+ })],
167
+ });
168
+ ```
169
+
170
+ Use the `@stalux/component/*` import alias in your custom components:
171
+
172
+ ```astro
173
+ ---
174
+ import Navs from "@stalux/component/Navs";
175
+ ---
176
+ <Navs />
177
+ ```
178
+
179
+ ---
180
+
181
+ ## 📖 Documentation
182
+
183
+ Full documentation and live demo: **[stalux.needhelp.icu](https://stalux.needhelp.icu)**
184
+
185
+ ---
186
+
187
+ ## 📄 License
188
+
189
+ MIT License — see [LICENSE](./LICENSE).
190
+
191
+ [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/xingwangzhe/stalux)
192
+ [![Deploy with EdgeOne Pages](https://cdnstatic.tencentcs.com/edgeone/pages/deploy.svg)](https://edgeone.ai/pages/new?repository-url=https://github.com/xingwangzhe/stalux)
package/package.json ADDED
@@ -0,0 +1,108 @@
1
+ {
2
+ "name": "@xingwangzhe/stalux",
3
+ "version": "1.2.0",
4
+ "description": "A powerful, modern Astro blog theme — use as template or install as plugin",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "xingwangzhe",
8
+ "homepage": "https://stalux.needhelp.icu",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/xingwangzhe/stalux.git"
12
+ },
13
+ "bugs": "https://github.com/xingwangzhe/stalux/issues",
14
+ "keywords": [
15
+ "astro",
16
+ "astro-theme",
17
+ "astro-integration",
18
+ "blog",
19
+ "blog-theme",
20
+ "stalux",
21
+ "static-site"
22
+ ],
23
+ "files": [
24
+ "src/index.ts",
25
+ "src/config.ts",
26
+ "src/components/**/*.astro",
27
+ "src/components/**/*.ts",
28
+ "src/layouts/**/*.astro",
29
+ "src/pages/**/*.astro",
30
+ "src/pages/**/*.ts",
31
+ "src/styles/**/*.css",
32
+ "src/utils/**/*.ts",
33
+ "src/i18n/**/*.json",
34
+ "src/schemas/**/*.ts",
35
+ "src/plugins/**/*.ts",
36
+ "src/internal/**/*.ts",
37
+ "src/scripts/**/*.ts",
38
+ "src/assets/**/*",
39
+ "scripts/cli.mjs",
40
+ "template/**/*",
41
+ "!src/content.config.ts"
42
+ ],
43
+ "exports": {
44
+ ".": "./src/index.ts",
45
+ "./config": "./src/config.ts",
46
+ "./schemas": "./src/schemas/config.ts",
47
+ "./components/*": "./src/components/*",
48
+ "./layouts/*": "./src/layouts/*",
49
+ "./pages/*": "./src/pages/*",
50
+ "./styles/*": "./src/styles/*",
51
+ "./utils/*": "./src/utils/*",
52
+ "./i18n/*": "./src/i18n/*",
53
+ "./plugins/*": "./src/plugins/*",
54
+ "./internal/*": "./src/internal/*",
55
+ "./scripts/*": "./src/scripts/*",
56
+ "./assets/*": "./src/assets/*",
57
+ "./package.json": "./package.json"
58
+ },
59
+ "bin": {
60
+ "stalux": "scripts/cli.mjs"
61
+ },
62
+ "scripts": {
63
+ "dev": "astro dev ",
64
+ "prebuild": "bun run scripts/font-subset.ts",
65
+ "build": "astro build ",
66
+ "preview": "astro preview ",
67
+ "astro": "astro",
68
+ "init": "node scripts/cli.mjs init",
69
+ "fmt": "oxfmt",
70
+ "fmt:check": "oxfmt --check",
71
+ "lint": "oxlint",
72
+ "lint:fix": "oxlint --fix",
73
+ "prepare": "git config core.hooksPath scripts/git-hooks"
74
+ },
75
+ "dependencies": {
76
+ "@expressive-code/plugin-line-numbers": "^0.44.1",
77
+ "@pagefind/component-ui": "^1.5.2",
78
+ "@waline/client": "3.15.2",
79
+ "@xingwangzhe/tags-cloud": "^1.2.4",
80
+ "animejs": "^4.5.0",
81
+ "astro": "^7.1.3",
82
+ "pagefind": "^1.5.2",
83
+ "photoswipe": "^5.4.4"
84
+ },
85
+ "peerDependencies": {
86
+ "astro": "^7.0.0"
87
+ },
88
+ "devDependencies": {
89
+ "@astrojs/rss": "^4.0.19",
90
+ "@astrojs/sitemap": "^3.7.3",
91
+ "@lucide/astro": "^1.27.0",
92
+ "@types/node": "^26.1.1",
93
+ "@xingwangzhe/satteri-mermaid": "0.7.1",
94
+ "@xingwangzhe/satteri-photoswipe": "^0.2.0",
95
+ "astro-expressive-code": "^0.44.1",
96
+ "astro-seo": "^1.1.0",
97
+ "astro-typewriter": "^1.2.0",
98
+ "badge-maker": "^6.0.0",
99
+ "knip": "^6.29.0",
100
+ "license-checker-rseidelsohn": "5.0.1",
101
+ "oxfmt": "^0.60.0",
102
+ "oxlint": "^1.75.0",
103
+ "simple-icons": "^16.27.1",
104
+ "subset-font": "^2.5.0",
105
+ "temml": "^0.13.3",
106
+ "typescript": "^7.0.2"
107
+ }
108
+ }
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Stalux CLI — 主题初始化工具
5
+ *
6
+ * 用法:
7
+ * npx stalux init # 在当前目录初始化内容模板
8
+ * npx stalux init my-blog # 在子目录初始化项目
9
+ * npm run init # 或通过 npm script
10
+ */
11
+
12
+ import { existsSync, mkdirSync, cpSync, readdirSync, statSync, writeFileSync } from "node:fs";
13
+ import { join, resolve, dirname } from "node:path";
14
+ import { fileURLToPath } from "node:url";
15
+
16
+ const __dirname = dirname(fileURLToPath(import.meta.url));
17
+ const PACKAGE_ROOT = resolve(__dirname, "..");
18
+ const TEMPLATE_DIR = join(PACKAGE_ROOT, "template");
19
+
20
+ function copyDir(src, dest, overwrite = false) {
21
+ mkdirSync(dest, { recursive: true });
22
+ for (const entry of readdirSync(src)) {
23
+ const srcPath = join(src, entry);
24
+ const destPath = join(dest, entry);
25
+ if (entry === "node_modules") continue;
26
+
27
+ if (statSync(srcPath).isDirectory()) {
28
+ copyDir(srcPath, destPath, overwrite);
29
+ } else {
30
+ if (!overwrite && existsSync(destPath)) {
31
+ console.log(` ⏭ ${entry} (already exists, skipped)`);
32
+ continue;
33
+ }
34
+ cpSync(srcPath, destPath);
35
+ console.log(` ✅ ${entry}`);
36
+ }
37
+ }
38
+ }
39
+
40
+ function printHelp() {
41
+ console.log(`
42
+ Stalux — Modern Astro Blog Theme
43
+
44
+ Usage:
45
+ stalux init [dir] Initialize Stalux content template
46
+ stalux --help Show this help message
47
+
48
+ Examples:
49
+ npx stalux init Init content in current directory
50
+ npx stalux init my-blog Init content in ./my-blog
51
+ npm run init Init via npm script (after install)
52
+
53
+ Source code:
54
+ git clone https://github.com/xingwangzhe/stalux.git
55
+ `);
56
+ }
57
+
58
+ function printNextSteps(targetDir) {
59
+ console.log("");
60
+ console.log(" 📝 Next Steps:");
61
+ console.log("");
62
+ console.log(` 1. cd ${targetDir}`);
63
+ console.log(` 2. npm install stalux`);
64
+ console.log(` 3. Edit astro.config.mjs to add stalux()`);
65
+ console.log(` 4. Start writing content in ${targetDir}/stalux/posts/`);
66
+ console.log(` 5. npm run dev`);
67
+ console.log("");
68
+ console.log(" 📖 Docs: https://stalux.needhelp.icu");
69
+ console.log("");
70
+ }
71
+
72
+ // ---- Main ----
73
+ const args = process.argv.slice(2);
74
+ const command = args[0];
75
+
76
+ if (!command || command === "--help" || command === "-h") {
77
+ printHelp();
78
+ process.exit(0);
79
+ }
80
+
81
+ if (command === "init") {
82
+ const targetArg = args[1] || ".";
83
+ const targetPath = resolve(process.cwd(), targetArg);
84
+
85
+ if (!existsSync(TEMPLATE_DIR)) {
86
+ console.error("❌ Template directory not found. Ensure stalux package is properly installed.");
87
+ process.exit(1);
88
+ }
89
+
90
+ console.log(`📦 Initializing Stalux content template...`);
91
+ console.log(`📂 Target: ${targetPath}`);
92
+ console.log("");
93
+
94
+ copyDir(TEMPLATE_DIR, targetPath, false);
95
+
96
+ printNextSteps(targetArg);
97
+ process.exit(0);
98
+ }
99
+
100
+ // Unknown command
101
+ console.error(`❌ Unknown command: ${command}`);
102
+ console.error(` Use "stalux init" to initialize Stalux content.`);
103
+ process.exit(1);
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 16 16"><path fill="#cccccc" d="M1 8a7 7 0 1 0 14 0A7 7 0 0 0 1 8m15 0A8 8 0 1 1 0 8a8 8 0 0 1 16 0M5.408 5.89c-.83 0-1.318.64-1.318 1.753v.742c0 1.108.479 1.727 1.318 1.727c.69 0 1.138-.435 1.187-1.05h1.147v.114c-.058 1.147-1.029 1.938-2.343 1.938c-1.612 0-2.518-1.028-2.518-2.729v-.747c0-1.7.914-2.75 2.518-2.75c1.319 0 2.29.812 2.343 1.999v.11H6.595c-.049-.638-.506-1.108-1.187-1.108Zm5.404 0c-.831 0-1.319.64-1.319 1.753v.742c0 1.108.48 1.727 1.319 1.727c.69 0 1.138-.435 1.186-1.05h1.147v.114c-.057 1.147-1.028 1.938-2.342 1.938c-1.613 0-2.518-1.028-2.518-2.729v-.747c0-1.7.914-2.75 2.518-2.75c1.318 0 2.29.812 2.342 1.999v.11h-1.147c-.048-.638-.505-1.108-1.186-1.108Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" width="115" height="48"><path fill="#17191E" d="M7.77 36.35C6.4 35.11 6 32.51 6.57 30.62c.99 1.2 2.35 1.57 3.75 1.78 2.18.33 4.31.2 6.33-.78.23-.12.44-.27.7-.42.18.55.23 1.1.17 1.67a4.56 4.56 0 0 1-1.94 3.23c-.43.32-.9.61-1.34.91-1.38.94-1.76 2.03-1.24 3.62l.05.17a3.63 3.63 0 0 1-1.6-1.38 3.87 3.87 0 0 1-.63-2.1c0-.37 0-.74-.05-1.1-.13-.9-.55-1.3-1.33-1.32a1.56 1.56 0 0 0-1.63 1.26c0 .06-.03.12-.05.2Z"/><path fill="url(#a)" d="M7.77 36.35C6.4 35.11 6 32.51 6.57 30.62c.99 1.2 2.35 1.57 3.75 1.78 2.18.33 4.31.2 6.33-.78.23-.12.44-.27.7-.42.18.55.23 1.1.17 1.67a4.56 4.56 0 0 1-1.94 3.23c-.43.32-.9.61-1.34.91-1.38.94-1.76 2.03-1.24 3.62l.05.17a3.63 3.63 0 0 1-1.6-1.38 3.87 3.87 0 0 1-.63-2.1c0-.37 0-.74-.05-1.1-.13-.9-.55-1.3-1.33-1.32a1.56 1.56 0 0 0-1.63 1.26c0 .06-.03.12-.05.2Z"/><path fill="#17191E" d="M.02 30.31s4.02-1.95 8.05-1.95l3.04-9.4c.11-.45.44-.76.82-.76.37 0 .7.31.82.76l3.04 9.4c4.77 0 8.05 1.95 8.05 1.95L17 11.71c-.2-.56-.53-.91-.98-.91H7.83c-.44 0-.76.35-.97.9L.02 30.31Zm42.37-5.97c0 1.64-2.05 2.62-4.88 2.62-1.85 0-2.5-.45-2.5-1.41 0-1 .8-1.49 2.65-1.49 1.67 0 3.09.03 4.73.23v.05Zm.03-2.04a21.37 21.37 0 0 0-4.37-.36c-5.32 0-7.82 1.25-7.82 4.18 0 3.04 1.71 4.2 5.68 4.2 3.35 0 5.63-.84 6.46-2.92h.14c-.03.5-.05 1-.05 1.4 0 1.07.18 1.16 1.06 1.16h4.15a16.9 16.9 0 0 1-.36-4c0-1.67.06-2.93.06-4.62 0-3.45-2.07-5.64-8.56-5.64-2.8 0-5.9.48-8.26 1.19.22.93.54 2.83.7 4.06 2.04-.96 4.95-1.37 7.2-1.37 3.11 0 3.97.71 3.97 2.15v.57Zm11.37 3c-.56.07-1.33.07-2.12.07-.83 0-1.6-.03-2.12-.1l-.02.58c0 2.85 1.87 4.52 8.45 4.52 6.2 0 8.2-1.64 8.2-4.55 0-2.74-1.33-4.09-7.2-4.39-4.58-.2-4.99-.7-4.99-1.28 0-.66.59-1 3.65-1 3.18 0 4.03.43 4.03 1.35v.2a46.13 46.13 0 0 1 4.24.03l.02-.55c0-3.36-2.8-4.46-8.2-4.46-6.08 0-8.13 1.49-8.13 4.39 0 2.6 1.64 4.23 7.48 4.48 4.3.14 4.77.62 4.77 1.28 0 .7-.7 1.03-3.71 1.03-3.47 0-4.35-.48-4.35-1.47v-.13Zm19.82-12.05a17.5 17.5 0 0 1-6.24 3.48c.03.84.03 2.4.03 3.24l1.5.02c-.02 1.63-.04 3.6-.04 4.9 0 3.04 1.6 5.32 6.58 5.32 2.1 0 3.5-.23 5.23-.6a43.77 43.77 0 0 1-.46-4.13c-1.03.34-2.34.53-3.78.53-2 0-2.82-.55-2.82-2.13 0-1.37 0-2.65.03-3.84 2.57.02 5.13.07 6.64.11-.02-1.18.03-2.9.1-4.04-2.2.04-4.65.07-6.68.07l.07-2.93h-.16Zm13.46 6.04a767.33 767.33 0 0 1 .07-3.18H82.6c.07 1.96.07 3.98.07 6.92 0 2.95-.03 4.99-.07 6.93h5.18c-.09-1.37-.11-3.68-.11-5.65 0-3.1 1.26-4 4.12-4 1.33 0 2.28.16 3.1.46.03-1.16.26-3.43.4-4.43-.86-.25-1.81-.41-2.96-.41-2.46-.03-4.26.98-5.1 3.38l-.17-.02Zm22.55 3.65c0 2.5-1.8 3.66-4.64 3.66-2.81 0-4.61-1.1-4.61-3.66s1.82-3.52 4.61-3.52c2.82 0 4.64 1.03 4.64 3.52Zm4.71-.11c0-4.96-3.87-7.18-9.35-7.18-5.5 0-9.23 2.22-9.23 7.18 0 4.94 3.49 7.59 9.21 7.59 5.77 0 9.37-2.65 9.37-7.6Z"/><defs><linearGradient id="a" x1="6.33" x2="19.43" y1="40.8" y2="34.6" gradientUnits="userSpaceOnUse"><stop stop-color="#D83333"/><stop offset="1" stop-color="#F041FF"/></linearGradient></defs></svg>
@@ -0,0 +1,3 @@
1
+ # Patterns
2
+
3
+ clone from https://github.com/NeuroNexul/telegram-patterns.git