From 7f9999ab5c097195af9e82b94fe5e7b64285a213 Mon Sep 17 00:00:00 2001 From: afoim Date: Tue, 24 Jun 2025 22:51:40 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E4=B8=BB=E9=A2=98):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=BC=BA=E5=88=B6=E6=9A=97=E8=89=B2=E6=A8=A1=E5=BC=8F=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=B9=B6=E4=BC=98=E5=8C=96=E5=9B=BE=E7=89=87=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在主题配置中新增forceDarkMode选项强制使用暗色模式 - 根据配置隐藏主题切换器和暗色模式切换组件 - 为图片组件添加加载动画和悬停效果 - 在页脚添加暗色模式IP检测iframe - 格式化package.json文件 --- package.json | 136 ++++++++++++------------- src/components/Footer.astro | 1 + src/components/Navbar.astro | 4 +- src/components/misc/ImageWrapper.astro | 40 +++++++- src/config.ts | 1 + src/layouts/Layout.astro | 36 ++++--- src/types/config.ts | 1 + 7 files changed, 130 insertions(+), 89 deletions(-) diff --git a/package.json b/package.json index f5a2f435c..14e341d0b 100644 --- a/package.json +++ b/package.json @@ -1,70 +1,70 @@ { - "name": "fuwari", - "type": "module", - "version": "0.0.1", - "scripts": { - "dev": "astro dev", - "start": "astro dev", - "build": "astro build && pagefind --site dist", - "preview": "astro preview", - "astro": "astro", - "type-check": "tsc --noEmit --isolatedDeclarations", - "new-post": "node scripts/new-post.js", - "format": "biome format --write ./src", - "lint": "biome check --write ./src", - "preinstall": "npx only-allow pnpm" - }, - "dependencies": { - "@astrojs/check": "^0.9.4", - "@astrojs/rss": "^4.0.11", - "@astrojs/sitemap": "^3.3.1", - "@astrojs/svelte": "7.0.12", - "@astrojs/tailwind": "^6.0.2", - "@fontsource-variable/jetbrains-mono": "^5.2.5", - "@fontsource/roboto": "^5.2.5", - "@iconify-json/fa6-brands": "^1.2.5", - "@iconify-json/fa6-regular": "^1.2.3", - "@iconify-json/fa6-solid": "^1.2.3", - "@iconify-json/material-symbols": "^1.2.20", - "@iconify/svelte": "^4.2.0", - "@swup/astro": "^1.6.0", - "@tailwindcss/typography": "^0.5.16", - "astro": "5.7.9", - "astro-icon": "^1.1.5", - "hastscript": "^9.0.1", - "katex": "^0.16.22", - "markdown-it": "^14.1.0", - "mdast-util-to-string": "^4.0.0", - "overlayscrollbars": "^2.11.1", - "pagefind": "^1.3.0", - "photoswipe": "^5.4.4", - "reading-time": "^1.5.0", - "rehype-autolink-headings": "^7.1.0", - "rehype-components": "^0.3.0", - "rehype-katex": "^7.0.1", - "rehype-slug": "^6.0.0", - "remark-directive": "^3.0.1", - "remark-directive-rehype": "^0.4.2", - "remark-github-admonitions-to-directives": "^1.0.5", - "remark-math": "^6.0.0", - "remark-sectionize": "^2.1.0", - "sanitize-html": "^2.16.0", - "sharp": "^0.34.1", - "stylus": "^0.64.0", - "svelte": "^5.28.2", - "tailwindcss": "^3.4.17", - "typescript": "^5.8.3", - "unist-util-visit": "^5.0.0" - }, - "devDependencies": { - "@astrojs/ts-plugin": "^1.10.4", - "@biomejs/biome": "1.9.4", - "@rollup/plugin-yaml": "^4.1.2", - "@types/markdown-it": "^14.1.2", - "@types/mdast": "^4.0.4", - "@types/sanitize-html": "^2.15.0", - "postcss-import": "^16.1.0", - "postcss-nesting": "^13.0.1" - }, - "packageManager": "pnpm@9.14.4" + "name": "fuwari", + "type": "module", + "version": "0.0.1", + "scripts": { + "dev": "astro dev", + "start": "astro dev", + "build": "astro build && pagefind --site dist", + "preview": "astro preview", + "astro": "astro", + "type-check": "tsc --noEmit --isolatedDeclarations", + "new-post": "node scripts/new-post.js", + "format": "biome format --write ./src", + "lint": "biome check --write ./src", + "preinstall": "npx only-allow pnpm" + }, + "dependencies": { + "@astrojs/check": "^0.9.4", + "@astrojs/rss": "^4.0.11", + "@astrojs/sitemap": "^3.3.1", + "@astrojs/svelte": "7.0.12", + "@astrojs/tailwind": "^6.0.2", + "@fontsource-variable/jetbrains-mono": "^5.2.5", + "@fontsource/roboto": "^5.2.5", + "@iconify-json/fa6-brands": "^1.2.5", + "@iconify-json/fa6-regular": "^1.2.3", + "@iconify-json/fa6-solid": "^1.2.3", + "@iconify-json/material-symbols": "^1.2.20", + "@iconify/svelte": "^4.2.0", + "@swup/astro": "^1.6.0", + "@tailwindcss/typography": "^0.5.16", + "astro": "5.7.9", + "astro-icon": "^1.1.5", + "hastscript": "^9.0.1", + "katex": "^0.16.22", + "markdown-it": "^14.1.0", + "mdast-util-to-string": "^4.0.0", + "overlayscrollbars": "^2.11.1", + "pagefind": "^1.3.0", + "photoswipe": "^5.4.4", + "reading-time": "^1.5.0", + "rehype-autolink-headings": "^7.1.0", + "rehype-components": "^0.3.0", + "rehype-katex": "^7.0.1", + "rehype-slug": "^6.0.0", + "remark-directive": "^3.0.1", + "remark-directive-rehype": "^0.4.2", + "remark-github-admonitions-to-directives": "^1.0.5", + "remark-math": "^6.0.0", + "remark-sectionize": "^2.1.0", + "sanitize-html": "^2.16.0", + "sharp": "^0.34.1", + "stylus": "^0.64.0", + "svelte": "^5.28.2", + "tailwindcss": "^3.4.17", + "typescript": "^5.8.3", + "unist-util-visit": "^5.0.0" + }, + "devDependencies": { + "@astrojs/ts-plugin": "^1.10.4", + "@biomejs/biome": "1.9.4", + "@rollup/plugin-yaml": "^4.1.2", + "@types/markdown-it": "^14.1.2", + "@types/mdast": "^4.0.4", + "@types/sanitize-html": "^2.15.0", + "postcss-import": "^16.1.0", + "postcss-nesting": "^13.0.1" + }, + "packageManager": "pnpm@9.14.4" } diff --git a/src/components/Footer.astro b/src/components/Footer.astro index e07307a4e..05ab1125a 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -10,6 +10,7 @@ const currentYear = new Date().getFullYear();
+
diff --git a/src/components/Navbar.astro b/src/components/Navbar.astro index bbc31cbfd..2156b9707 100644 --- a/src/components/Navbar.astro +++ b/src/components/Navbar.astro @@ -50,7 +50,9 @@ let links: NavBarLink[] = navBarConfig.links.map( )} - + {!siteConfig.themeColor.forceDarkMode && ( + + )} diff --git a/src/components/misc/ImageWrapper.astro b/src/components/misc/ImageWrapper.astro index 1874e46bf..359ef52b1 100644 --- a/src/components/misc/ImageWrapper.astro +++ b/src/components/misc/ImageWrapper.astro @@ -10,7 +10,7 @@ interface Props { } import { Image } from "astro:assets"; import { url } from "../../utils/url-utils"; -import { imageFallbackConfig } from "../../config"; +import { imageFallbackConfig, siteConfig } from "../../config"; const { id, src, alt, position = "center", basePath = "/" } = Astro.props; const className = Astro.props.class; @@ -46,13 +46,43 @@ if (isLocal) { const imageClass = "w-full h-full object-cover"; const imageStyle = `object-position: ${position}`; --- -
+
+ +
+
+
+ +
- {isLocal && img && {alt} + {isLocal && img && {alt} {!isLocal && ( imageFallbackConfig.enable && src.includes(imageFallbackConfig.originalDomain) ? - {alt : - {alt + {alt : + {alt )}
+ + diff --git a/src/config.ts b/src/config.ts index abfa8b7a4..ab21148cd 100644 --- a/src/config.ts +++ b/src/config.ts @@ -14,6 +14,7 @@ export const siteConfig: SiteConfig = { themeColor: { hue: 360, // Default hue for the theme color, from 0 to 360. e.g. red: 0, teal: 200, cyan: 250, pink: 345 fixed: true, // Hide the theme color picker for visitors + forceDarkMode: true, // Force dark mode and hide theme switcher }, banner: { enable: false, diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 991a049f1..3c4e5392a 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -110,22 +110,28 @@ const bannerOffset = ))} -