@xingwangzhe/stalux 1.46.1 → 1.46.5

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 (48) hide show
  1. package/package.json +3 -2
  2. package/src/components/stalux/archives/archivesList.astro +1 -1
  3. package/src/components/stalux/categories/categoriesList.astro +6 -1
  4. package/src/components/stalux/common/Weather.astro +1 -1
  5. package/src/components/stalux/common/date.astro +1 -1
  6. package/src/components/stalux/footer/FooterBeian.astro +2 -0
  7. package/src/components/stalux/layout/head.astro +1 -1
  8. package/src/components/stalux/links/linkList.astro +1 -1
  9. package/src/components/stalux/posts/postContent.astro +5 -1
  10. package/src/components/stalux/posts/postList.astro +6 -1
  11. package/src/components/stalux/posts/postRight.astro +11 -4
  12. package/src/components/stalux/words/wordList.astro +11 -8
  13. package/src/index.ts +1 -1
  14. package/src/internal/compact-styles.ts +1 -1
  15. package/src/internal/font-slices.ts +3 -3
  16. package/src/internal/page-output-cache.ts +6 -7
  17. package/src/internal/social-card-renderer.ts +3 -5
  18. package/src/pages/og/[image].[format].ts +1 -1
  19. package/src/schemas/config.ts +5 -5
  20. package/src/scripts/analytics-runtime.ts +1 -1
  21. package/src/scripts/archive-descriptions.ts +1 -1
  22. package/src/scripts/back-to-top.ts +7 -6
  23. package/src/scripts/background.ts +2 -2
  24. package/src/scripts/countdown.ts +1 -1
  25. package/src/scripts/date-time.ts +1 -1
  26. package/src/scripts/list-reveal.ts +214 -40
  27. package/src/scripts/module-motion.ts +5 -3
  28. package/src/scripts/navigation-font.ts +4 -1
  29. package/src/scripts/navigation.ts +1 -1
  30. package/src/scripts/page-runtime.ts +6 -4
  31. package/src/scripts/random-posts.ts +2 -2
  32. package/src/scripts/route-motion.ts +67 -56
  33. package/src/scripts/route-out.ts +12 -14
  34. package/src/scripts/runtime-counter.ts +1 -1
  35. package/src/scripts/shell-hydration.ts +60 -0
  36. package/src/scripts/smooth-scroll.ts +4 -4
  37. package/src/scripts/swup-internals.d.ts +31 -0
  38. package/src/scripts/swup-router.ts +53 -11
  39. package/src/scripts/waline.ts +1 -1
  40. package/src/scripts/weather.ts +148 -82
  41. package/src/scripts/webmcp.ts +24 -20
  42. package/src/utils/ai-discovery.ts +1 -1
  43. package/src/utils/cc.ts +2 -2
  44. package/src/utils/collections-stats.ts +4 -2
  45. package/src/utils/dayjs.ts +2 -2
  46. package/src/utils/i18n.ts +2 -2
  47. package/src/utils/seo-document.ts +4 -4
  48. package/src/utils/taxonomy.ts +10 -12
@@ -6,8 +6,10 @@ function countUncategorized(posts: PostEntry[]): number {
6
6
  let count = 0;
7
7
  for (const post of posts) {
8
8
  const names = post.data.categories ?? [];
9
- if (!names.length) count++;
10
- else for (const name of names) if (name === "uncategorized") count++;
9
+ if (names.length)
10
+ for (const name of names)
11
+ if (name === "uncategorized") count++;
12
+ else count++;
11
13
  }
12
14
  return count;
13
15
  }
@@ -138,7 +138,7 @@ export function format(date: Date | string | number, formatStr: string): string
138
138
  export function formatInTimeZone(
139
139
  date: Date | string | number,
140
140
  timeZone: string,
141
- formatStr: string = "yyyy-MM-dd'T'HH:mm:ssXXX",
141
+ formatStr = "yyyy-MM-dd'T'HH:mm:ssXXX",
142
142
  ): string {
143
143
  const d = date instanceof Date ? date : new Date(date);
144
144
  if (Number.isNaN(d.getTime())) return "";
@@ -160,7 +160,7 @@ export function formatInTimeZone(
160
160
  offset = "+00:00";
161
161
  } else {
162
162
  offset = offset.replace(/^GMT/, "").replace(/^UTC/, "");
163
- if (!offset.startsWith("+") && !offset.startsWith("-")) {
163
+ if (!(offset.startsWith("+") || offset.startsWith("-"))) {
164
164
  offset = `+${offset}`;
165
165
  }
166
166
  const m = offset.match(/^([+-])(\d{1,2})(?::?(\d{2}))?$/);
package/src/utils/i18n.ts CHANGED
@@ -1,5 +1,5 @@
1
- import en from "@i18n/en.json";
2
- import zhCN from "@i18n/zh-CN.json";
1
+ import en from "@i18n/en.json" with { type: "json" };
2
+ import zhCN from "@i18n/zh-CN.json" with { type: "json" };
3
3
 
4
4
  const dicts: Record<string, Record<string, unknown>> = {
5
5
  "zh-CN": zhCN as Record<string, unknown>,
@@ -145,14 +145,14 @@ export function buildSeoDocument(input: SeoDocumentInput): SeoDocument {
145
145
  { name: "generator", content: "Stalux" },
146
146
  { name: "theme", content: "Stalux" },
147
147
  { name: "stalux-version", content: version },
148
- ...(!noindex
149
- ? [
148
+ ...(noindex
149
+ ? []
150
+ : [
150
151
  {
151
152
  name: "googlebot",
152
153
  content: "max-image-preview:large, max-snippet:-1, max-video-preview:-1",
153
154
  },
154
- ]
155
- : []),
155
+ ]),
156
156
  ];
157
157
 
158
158
  const sameAs = input.mediaLinks.filter((link) => /^https?:\/\//i.test(link));
@@ -15,16 +15,14 @@ export async function buildTaxonomyStaticPaths(key: TaxonomyKey): Promise<GetSta
15
15
  const paramName = key === "tags" ? "tag" : "category";
16
16
  const taxonomy = index[key];
17
17
 
18
- return [...taxonomy].map(([name, entry]) => {
19
- return {
20
- params: { [paramName]: name },
21
- cacheKey: `${entry.cacheKey}|${getRuntimeCacheKey()}`,
22
- props: {
23
- [paramName]: name,
24
- count: entry.posts.length,
25
- posts: entry.posts,
26
- lastUpdateDate: entry.latestTime,
27
- },
28
- };
29
- });
18
+ return [...taxonomy].map(([name, entry]) => ({
19
+ params: { [paramName]: name },
20
+ cacheKey: `${entry.cacheKey}|${getRuntimeCacheKey()}`,
21
+ props: {
22
+ [paramName]: name,
23
+ count: entry.posts.length,
24
+ posts: entry.posts,
25
+ lastUpdateDate: entry.latestTime,
26
+ },
27
+ }));
30
28
  }