@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
@@ -0,0 +1,50 @@
1
+ ---
2
+ import styles from "@styles/components/links/linkCard.module.css";
3
+ import { getCollection } from "astro:content";
4
+ import { createTranslator } from "@utils/i18n";
5
+ import { getSiteData, getAuthorData, getHeadData, getNavsData, getLinksData, getCommentData, getFooterData, getPromoteData, getTypetextsData, getMediaLinksData } from "@utils/config-utils";
6
+
7
+ interface LinkItem {
8
+ title?: string;
9
+ name?: string;
10
+ url?: string;
11
+ link?: string;
12
+ description?: string;
13
+ icon?: string;
14
+ avatar?: string;
15
+ }
16
+
17
+ interface Props {
18
+ link: LinkItem;
19
+ }
20
+
21
+ const configEntries = await getCollection("config");
22
+ const siteConfig = getSiteData(configEntries);
23
+ const { t } = createTranslator(siteConfig.lang || "zh-CN");
24
+ const link = Astro.props.link;
25
+ const href = link.url ?? link.link ?? "#";
26
+ const title = link.title ?? link.name ?? t("links.defaultTitle");
27
+ const desc = link.description ?? "";
28
+ const icon = link.icon ?? link.avatar ?? "/favicon.ico";
29
+ ---
30
+
31
+ <a
32
+ class={styles.card + " a-none"}
33
+ href={href}
34
+ target="_blank"
35
+ rel="noopener noreferrer"
36
+ >
37
+ <div class={styles.avatar}>
38
+ <img
39
+ src={icon}
40
+ alt={t("links.iconAlt", { name: title })}
41
+ loading="lazy"
42
+ width="80"
43
+ height="80"
44
+ />
45
+ </div>
46
+ <div class={styles.content}>
47
+ <h3 class={styles.title}>{title}</h3>
48
+ {desc && <p class={styles.description}>{desc}</p>}
49
+ </div>
50
+ </a>
@@ -0,0 +1,20 @@
1
+ ---
2
+ import LinkCard from "@components/stalux/links/linkCard.astro";
3
+ import styles from "@styles/components/links/linkList.module.css";
4
+ import { getCollection } from "astro:content";
5
+ import { getLinksData } from "@utils/config-utils";
6
+
7
+ const configEntries = await getCollection("config");
8
+ const linksConfig = getLinksData(configEntries);
9
+ const links = linksConfig?.sites ?? [];
10
+ ---
11
+
12
+ <ul class={`${styles.list} stagger-children`}>
13
+ {
14
+ links.map((link) => (
15
+ <li class={styles.item}>
16
+ <LinkCard link={link} />
17
+ </li>
18
+ ))
19
+ }
20
+ </ul>
@@ -0,0 +1,102 @@
1
+ ---
2
+ // 按需导入图标 — Vite tree-shake 只打包用到的图标
3
+ import {
4
+ siGithub,
5
+ siBilibili,
6
+ siQq,
7
+ siMaildotru,
8
+ siJuejin,
9
+ siX,
10
+ type SimpleIcon,
11
+ } from "simple-icons";
12
+ import { getCollection } from "astro:content";
13
+ import styles from "@styles/components/links/socialLinks.module.css";
14
+ import { getSiteData, getMediaLinksData } from "@utils/config-utils";
15
+ const configEntries = await getCollection("config");
16
+ const siteConfig = getSiteData(configEntries);
17
+ const mediaLinksSection = getMediaLinksData(configEntries);
18
+ const mediaLinks = mediaLinksSection?.items ?? [];
19
+
20
+ const isPostPage = Astro.url.pathname.startsWith("/posts/");
21
+
22
+ // 静态图标映射表:新增图标时只需添加对应的 simple-icons 导入和映射
23
+ const iconMap: Record<string, SimpleIcon> = {
24
+ github: siGithub,
25
+ bilibili: siBilibili,
26
+ qq: siQq,
27
+ maildotru: siMaildotru,
28
+ juejin: siJuejin,
29
+ x: siX,
30
+ };
31
+
32
+ function getIconByTitle(iconName: string): SimpleIcon | undefined {
33
+ return iconMap[iconName];
34
+ }
35
+ ---
36
+
37
+ <nav class={styles["social-links"]} transition:persist-props aria-label="Social media">
38
+ <ul>
39
+ {
40
+ mediaLinks.map((item) => {
41
+ const icon = item.icon ? getIconByTitle(item.icon) : undefined;
42
+ return (
43
+ <li class="social_icon">
44
+ <a
45
+ href={item.link}
46
+ target="_blank"
47
+ aria-label={item.icon}
48
+ rel="noopener noreferrer"
49
+ title={item.icon}
50
+ class="a-none"
51
+ >
52
+ {icon ? (
53
+ <div class="icon-container">
54
+ <svg
55
+ role="img"
56
+ viewBox="0 0 24 24"
57
+ xmlns="http://www.w3.org/2000/svg"
58
+ width="24"
59
+ height="24"
60
+ fill="currentColor"
61
+ aria-hidden="true"
62
+ >
63
+ <title>{icon.title}</title>
64
+ <path d={icon.path} />
65
+ </svg>
66
+ </div>
67
+ ) : (
68
+ <span class="custom-icon">
69
+ {item.icon
70
+ ? item.icon.charAt(0).toUpperCase()
71
+ : ""}
72
+ </span>
73
+ )}
74
+ </a>
75
+ </li>
76
+ );
77
+ })
78
+ }
79
+ </ul>
80
+ </nav>
81
+
82
+ {
83
+ !isPostPage && (
84
+ <script>
85
+ import { animate } from "animejs";
86
+ animate(".social_icon", {
87
+ y: [
88
+ { to: "-2.75rem", ease: "outExpo", duration: 600 },
89
+ { to: 0, ease: "outBounce", duration: 800, delay: 100 },
90
+ ],
91
+ rotate: {
92
+ from: "-1turn",
93
+ delay: 0,
94
+ },
95
+ delay: (_, i) => i * 50,
96
+ ease: "inOutCirc",
97
+ loopDelay: 1000,
98
+ loop: true,
99
+ });
100
+ </script>
101
+ )
102
+ }
@@ -0,0 +1,3 @@
1
+ ---
2
+ import "photoswipe/dist/photoswipe.css";
3
+ ---
@@ -0,0 +1,65 @@
1
+ ---
2
+ import { fade } from "astro:transitions";
3
+ import style from "@styles/components/posts/postTaxonomy.module.css";
4
+ import { getCollection } from "astro:content";
5
+ import { getSiteData } from "@utils/config-utils";
6
+ import { createTranslator } from "@utils/i18n";
7
+
8
+ type Kind = "tag" | "category";
9
+
10
+ interface Props {
11
+ kind: Kind;
12
+ items?: string[];
13
+ title?: string;
14
+ }
15
+
16
+ const configEntries = await getCollection("config");
17
+ const siteConfig = getSiteData(configEntries);
18
+ const { t } = createTranslator(siteConfig.lang || "zh-CN");
19
+
20
+ const { kind, items = [], title } = Astro.props;
21
+
22
+ // 根据 kind 选择文案、路由前缀与样式类名,
23
+ // 避免 tag / category 两套几乎相同的组件互相复制。
24
+ const cfg = {
25
+ tag: {
26
+ prefix: "/tags/",
27
+ heading: t("taxonomy.tag"),
28
+ empty: t("taxonomy.noTags"),
29
+ containerName: "tags-container",
30
+ contentName: "tags-content",
31
+ listClass: style.listWrap,
32
+ itemClass: style.itemPill,
33
+ },
34
+ category: {
35
+ prefix: "/categories/",
36
+ heading: t("taxonomy.category"),
37
+ empty: t("taxonomy.noCategories"),
38
+ containerName: "categories-container",
39
+ contentName: "categories-content",
40
+ listClass: style.listColumn,
41
+ itemClass: style.itemColumn,
42
+ },
43
+ }[kind];
44
+ ---
45
+
46
+ <nav class={style.container} transition:name={cfg.containerName} aria-label={title ?? cfg.heading}>
47
+ {items.length > 0 && <h3 class={style.title}>{title ?? cfg.heading}</h3>}
48
+ {
49
+ items.length > 0 ? (
50
+ <div
51
+ class={cfg.listClass}
52
+ transition:name={cfg.contentName}
53
+ transition:animate={fade({ duration: "0.3s" })}
54
+ >
55
+ {items.map((item) => (
56
+ <a href={`${cfg.prefix}${item}/`} class={`${cfg.itemClass} a-none`} data-astro-prefetch>
57
+ {item}
58
+ </a>
59
+ ))}
60
+ </div>
61
+ ) : (
62
+ <div class={style.empty}>{cfg.empty}</div>
63
+ )
64
+ }
65
+ </nav>