From 3a002d61cad111b97d7565773d03f3dfe9bc1933 Mon Sep 17 00:00:00 2001 From: radishzzz Date: Sun, 13 Apr 2025 11:18:47 +0100 Subject: [PATCH] perf: change listener from after-swap to page-load to improve view transition smoothness - fix theme guide error - update readme --- README.md | 3 ++- README.zh.md | 3 ++- pnpm-lock.yaml | 8 ++++---- src/components/Button.astro | 2 +- src/components/Comments/Waline.astro | 2 +- src/components/Widgets/GoBack.astro | 2 +- src/components/Widgets/TOC.astro | 2 +- src/content/posts/guides/Theme Guide-en.md | 2 +- src/content/posts/guides/Theme Guide-es.md | 2 +- src/content/posts/guides/Theme Guide-ja.md | 2 +- src/content/posts/guides/Theme Guide-ru.md | 2 +- src/content/posts/guides/Theme Guide-zh-tw.md | 2 +- src/content/posts/guides/Theme Guide-zh.md | 2 +- 13 files changed, 18 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index f9b99dc..1d15519 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,8 @@ For other platforms, please refer to the [Astro Deployment Guides](https://docs. ## Documentation - [Theme Guide](https://retypeset.radishzz.cc/en/posts/theme-guide/) -- [Theme Configuration File](https://github.com/radishzzz/astro-theme-retypeset/blob/master/src/config.ts) +- [Markdown Style Guide](https://retypeset.radishzz.cc/en/posts/markdown-style-guide/) +- [Theme Color Schemes](https://retypeset.radishzz.cc/en/posts/theme-color-schemes/) ## Credits diff --git a/README.zh.md b/README.zh.md index 592904d..b28c1cf 100644 --- a/README.zh.md +++ b/README.zh.md @@ -69,7 +69,8 @@ Retypeset 是一款基于 [Astro](https://astro.build/) 框架的静态博客主 ## 文档 - [主题上手指南](https://retypeset.radishzz.cc/posts/theme-guide/) -- [主题配置文件](https://github.com/radishzzz/astro-theme-retypeset/blob/master/src/config.ts) +- [Markdown 样式指南](https://retypeset.radishzz.cc/posts/markdown-style-guide/) +- [主题配色指南](https://retypeset.radishzz.cc/posts/theme-color-schemes/) ## 鸣谢 diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c63c1f4..a2a5f12 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1963,8 +1963,8 @@ packages: peerDependencies: eslint: '>=8' - eslint-plugin-import-x@4.10.2: - resolution: {integrity: sha512-jO3Y6+zBUyTX5MVbbLSzoz6fe65t+WEBaXStRLM4EBhZWbuSwAH3cLwARtM0Yp4zRtZGp9sL2zzK7G9JkHR8LA==} + eslint-plugin-import-x@4.10.3: + resolution: {integrity: sha512-Q7yx76tlOfzLGtXDt/sppdYrGNcbr9CrRXqJXTNIpM/7hfX9lRp1noE+PkYgN+xvW47TEeGZ0pgy29hlX9Y7UQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -4060,7 +4060,7 @@ snapshots: eslint-merge-processors: 2.0.0(eslint@9.24.0(jiti@2.4.2)) eslint-plugin-antfu: 3.1.1(eslint@9.24.0(jiti@2.4.2)) eslint-plugin-command: 3.2.0(eslint@9.24.0(jiti@2.4.2)) - eslint-plugin-import-x: 4.10.2(eslint@9.24.0(jiti@2.4.2))(typescript@5.8.3) + eslint-plugin-import-x: 4.10.3(eslint@9.24.0(jiti@2.4.2))(typescript@5.8.3) eslint-plugin-jsdoc: 50.6.9(eslint@9.24.0(jiti@2.4.2)) eslint-plugin-jsonc: 2.20.0(eslint@9.24.0(jiti@2.4.2)) eslint-plugin-n: 17.17.0(eslint@9.24.0(jiti@2.4.2)) @@ -6097,7 +6097,7 @@ snapshots: eslint: 9.24.0(jiti@2.4.2) eslint-compat-utils: 0.5.1(eslint@9.24.0(jiti@2.4.2)) - eslint-plugin-import-x@4.10.2(eslint@9.24.0(jiti@2.4.2))(typescript@5.8.3): + eslint-plugin-import-x@4.10.3(eslint@9.24.0(jiti@2.4.2))(typescript@5.8.3): dependencies: '@pkgr/core': 0.2.2 '@types/doctrine': 0.0.9 diff --git a/src/components/Button.astro b/src/components/Button.astro index 57c8014..9e89d05 100644 --- a/src/components/Button.astro +++ b/src/components/Button.astro @@ -116,5 +116,5 @@ function setupThemeToggle() { // Initialize click event (on first load or page transition) setupThemeToggle() -document.addEventListener('astro:after-swap', setupThemeToggle) +document.addEventListener('astro:page-load', setupThemeToggle) diff --git a/src/components/Comments/Waline.astro b/src/components/Comments/Waline.astro index 2aa0741..606ef6a 100644 --- a/src/components/Comments/Waline.astro +++ b/src/components/Comments/Waline.astro @@ -61,7 +61,7 @@ function initWaline() { } initWaline() -document.addEventListener('astro:after-swap', initWaline) +document.addEventListener('astro:page-load', initWaline) diff --git a/src/components/Widgets/GoBack.astro b/src/components/Widgets/GoBack.astro index c5e2e95..73b6edc 100644 --- a/src/components/Widgets/GoBack.astro +++ b/src/components/Widgets/GoBack.astro @@ -32,5 +32,5 @@ function setupBackButton() { } setupBackButton() -document.addEventListener('astro:after-swap', setupBackButton) +document.addEventListener('astro:page-load', setupBackButton) diff --git a/src/components/Widgets/TOC.astro b/src/components/Widgets/TOC.astro index a573683..ee5d903 100644 --- a/src/components/Widgets/TOC.astro +++ b/src/components/Widgets/TOC.astro @@ -232,6 +232,6 @@ function setupTOCHighlight() { } setupTOCHighlight() -document.addEventListener('astro:after-swap', setupTOCHighlight) +document.addEventListener('astro:page-load', setupTOCHighlight) diff --git a/src/content/posts/guides/Theme Guide-en.md b/src/content/posts/guides/Theme Guide-en.md index 167f67c..c73d136 100644 --- a/src/content/posts/guides/Theme Guide-en.md +++ b/src/content/posts/guides/Theme Guide-en.md @@ -288,7 +288,7 @@ Beyond the configuration file `src/config.ts`, there are some configuration opti Code block syntax highlighting themes. ```ts -// src/astro.config.ts +// astro.config.ts shikiConfig: { // available themes: https://shiki.style/themes diff --git a/src/content/posts/guides/Theme Guide-es.md b/src/content/posts/guides/Theme Guide-es.md index 2198744..ec57422 100644 --- a/src/content/posts/guides/Theme Guide-es.md +++ b/src/content/posts/guides/Theme Guide-es.md @@ -288,7 +288,7 @@ Más allá del archivo de configuración `src/config.ts`, hay algunas opciones d Temas de resaltado de sintaxis para bloques de código. ```ts -// src/astro.config.ts +// astro.config.ts shikiConfig: { // temas disponibles: https://shiki.style/themes diff --git a/src/content/posts/guides/Theme Guide-ja.md b/src/content/posts/guides/Theme Guide-ja.md index 9c1b4e1..99c43b7 100644 --- a/src/content/posts/guides/Theme Guide-ja.md +++ b/src/content/posts/guides/Theme Guide-ja.md @@ -288,7 +288,7 @@ src/content/posts/2025/03/apple.md -> example.com/es/posts/banana/ コードブロックのシンタックスハイライトテーマ。 ```ts -// src/astro.config.ts +// astro.config.ts shikiConfig: { // 利用可能なテーマ: https://shiki.style/themes diff --git a/src/content/posts/guides/Theme Guide-ru.md b/src/content/posts/guides/Theme Guide-ru.md index 95fd4e2..95f48ae 100644 --- a/src/content/posts/guides/Theme Guide-ru.md +++ b/src/content/posts/guides/Theme Guide-ru.md @@ -288,7 +288,7 @@ src/content/posts/2025/03/apple.md -> example.com/es/posts/banana/ Темы подсветки синтаксиса для блоков кода. ```ts -// src/astro.config.ts +// astro.config.ts shikiConfig: { // доступные темы: https://shiki.style/themes diff --git a/src/content/posts/guides/Theme Guide-zh-tw.md b/src/content/posts/guides/Theme Guide-zh-tw.md index 01051d3..89f9e9e 100644 --- a/src/content/posts/guides/Theme Guide-zh-tw.md +++ b/src/content/posts/guides/Theme Guide-zh-tw.md @@ -288,7 +288,7 @@ src/content/posts/2025/03/apple.md -> example.com/es/posts/banana/ 代碼塊的語法高亮主題。 ```ts -// src/astro.config.ts +// astro.config.ts shikiConfig: { // 可選主題:https://shiki.style/themes diff --git a/src/content/posts/guides/Theme Guide-zh.md b/src/content/posts/guides/Theme Guide-zh.md index fdefc64..159bb07 100644 --- a/src/content/posts/guides/Theme Guide-zh.md +++ b/src/content/posts/guides/Theme Guide-zh.md @@ -288,7 +288,7 @@ src/content/posts/2025/03/apple.md -> example.com/es/posts/banana/ 代码块的语法高亮主题。 ```ts -// src/astro.config.ts +// astro.config.ts shikiConfig: { // 可选主题:https://shiki.style/themes