From de77f6fe5412f5f370987983ebfb8443dc6d35d0 Mon Sep 17 00:00:00 2001 From: Charliechen114514 <725610365@qq.com> Date: Fri, 3 Jul 2026 23:32:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(site):=20=E9=92=A2=E8=93=9D=E8=89=B2?= =?UTF-8?q?=E9=AD=82=20+=20=E7=B2=BE=E8=87=B4=E7=BB=84=E4=BB=B6=20+=20Onli?= =?UTF-8?q?neCompilerDemo=20=E5=BC=B9=E5=87=BA=E5=BC=8F=20IDE=20=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 色魂(品牌色 identity,治"无色魂"短板): - :root 钢蓝品牌色 #2563EB 系 + 暖中性骨白底,消除 4 套散落配色 (1:1 镜像 C-Journey 已验证的 :root 模板,只把锈橙换钢蓝) - 终端硬编码色抽 var(--term-*),::selection/滚动条美化,blockquote/ HomeTipBanner/HomeRoadmap chip 配色统一到品牌色,补 theme-color meta 精致组件 + 脆弱性清理: - ReadingProgress 顶部阅读进度条(rAF 节流 + 钢蓝 glow + 路由双重重算) - .VPFeature 卡片 rail(::before 伪元素 + 三档 tier 着色) - 代码折叠按钮优化(brand-soft 容器 chevron + 行数 chip + 通知条质感) - .VPFeature .title 字号冲突修(:where 零特异性)+ !important 74→61 - OnlineCompilerDemo dup-output 修复(extractExecutionText/extractAsmText 改 || 取 first-non-empty,对齐 C-Journey f85300b) OnlineCompilerDemo 弹出式重构: - 默认只读源码 + "动手试一试" CTA,点开 Teleport 浮层(灰色遮罩 + 比页面小一圈的 1280px 卡片 + 完整 IDE),✕/遮罩/Esc 关闭 + 锁滚 - 编辑态高亮 overlay(shiki backdrop + 透明 textarea + 像素 line-height 对齐 + 边打边高亮 + 滚动同步) - 编译错误信息友好化(透出 stderr 真实诊断 + ❌ 编译失败 前缀) - 结果区 shimmer 骨架屏 修复: - sidebar 超大字体下长标题溢出视口(VitePress .text 默认 min-width:auto 不收缩,补 min-width:0 + ellipsis 优雅截断) --- README.md | 2 +- site/.vitepress/config/shared.ts | 3 + .../theme/components/HomeHeroVisual.vue | 30 +- .../theme/components/HomeRoadmap.vue | 2 +- .../theme/components/OnlineCompilerDemo.vue | 216 ++++++-- .../theme/components/ReadingProgress.vue | 72 +++ site/.vitepress/theme/custom.css | 481 ++++++++++++++++-- site/.vitepress/theme/index.ts | 3 +- 8 files changed, 730 insertions(+), 79 deletions(-) create mode 100644 site/.vitepress/theme/components/ReadingProgress.vue diff --git a/README.md b/README.md index 17c0e322b..8a965bcf3 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ --- -![English Coverage](https://img.shields.io/badge/en_coverage-89%25-green.svg) 494/552 docs translated +![English Coverage](https://img.shields.io/badge/en_coverage-97%25-green.svg) 494/510 docs translated ## 这是什么项目 diff --git a/site/.vitepress/config/shared.ts b/site/.vitepress/config/shared.ts index 88adfb5df..0e250a67c 100644 --- a/site/.vitepress/config/shared.ts +++ b/site/.vitepress/config/shared.ts @@ -66,6 +66,9 @@ export const sharedBase = { head: [ ['link', { rel: 'icon', href: '/Tutorial_AwesomeModernCPP/favicon.ico' }], + // 浏览器地址栏/壁纸融合(明暗双值,与站点暖中性底一致) + ['meta', { name: 'theme-color', content: '#F7F3EC' }], + ['meta', { name: 'theme-color', content: '#17120E', media: '(prefers-color-scheme: dark)' }], // 首屏立即应用字号档(从 localStorage 读,默认 medium),防刷新闪烁。 // 与 FontSizeSwitcher.vue 的 STORAGE_KEY('vp-font-size')保持一致。 [ diff --git a/site/.vitepress/theme/components/HomeHeroVisual.vue b/site/.vitepress/theme/components/HomeHeroVisual.vue index 7ef2586b7..cff899178 100644 --- a/site/.vitepress/theme/components/HomeHeroVisual.vue +++ b/site/.vitepress/theme/components/HomeHeroVisual.vue @@ -148,12 +148,12 @@ onBeforeUnmount(() => { .terminal { position: relative; box-sizing: border-box; - border: 1px solid rgba(99, 102, 241, 0.35); + border: 1px solid var(--term-border); border-radius: 14px; overflow: hidden; - background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%); + background: linear-gradient(135deg, var(--term-bg-from) 0%, var(--term-bg-to) 100%); box-shadow: - 0 22px 56px rgba(15, 52, 96, 0.4), + 0 22px 56px var(--term-shadow), 0 6px 14px rgba(0, 0, 0, 0.22); animation: terminal-glow 4s ease-in-out infinite; } @@ -179,7 +179,7 @@ onBeforeUnmount(() => { .terminal__title { margin-left: 10px; - color: rgba(226, 232, 240, 0.55); + color: var(--term-title); font-family: var(--vp-font-family-mono); font-size: 13px; letter-spacing: 0.3px; @@ -200,17 +200,17 @@ onBeforeUnmount(() => { min-height: 1.75em; } -.ln--code { color: #cbd5e1; } -.ln--cmd { color: #42a5f5; } /* shell prompt */ -.ln--ok { color: #009688; } /* 编译成功 / brand teal */ -.ln--save { color: #fbbf24; } /* 保存提示 */ -.ln--out { color: #e2e8f0; } /* 程序输出 */ -.ln--prompt { color: #009688; } +.ln--code { color: var(--term-code); } +.ln--cmd { color: var(--term-cmd); } /* shell prompt */ +.ln--ok { color: var(--term-ok); } /* 编译成功(语义绿) */ +.ln--save { color: var(--term-save); } /* 保存提示 */ +.ln--out { color: var(--term-out); } /* 程序输出 */ +.ln--prompt { color: var(--term-ok); } .cursor { display: inline-block; margin-left: 2px; - color: #009688; + color: var(--term-ok); animation: blink 1.05s step-end infinite; } @@ -223,15 +223,15 @@ onBeforeUnmount(() => { @keyframes terminal-glow { 0%, 100% { box-shadow: - 0 22px 56px rgba(15, 52, 96, 0.4), + 0 22px 56px var(--term-shadow), 0 6px 14px rgba(0, 0, 0, 0.22), - 0 0 0 0 rgba(99, 102, 241, 0); + 0 0 0 0 rgba(96, 165, 250, 0); } 50% { box-shadow: - 0 22px 56px rgba(15, 52, 96, 0.45), + 0 22px 56px var(--term-shadow), 0 6px 14px rgba(0, 0, 0, 0.25), - 0 0 26px 3px rgba(99, 102, 241, 0.24); + 0 0 26px 3px var(--term-glow); } } diff --git a/site/.vitepress/theme/components/HomeRoadmap.vue b/site/.vitepress/theme/components/HomeRoadmap.vue index 4aa66a7d9..18e3bdf0c 100644 --- a/site/.vitepress/theme/components/HomeRoadmap.vue +++ b/site/.vitepress/theme/components/HomeRoadmap.vue @@ -166,7 +166,7 @@ const t = computed(() => } .rm-chip--done .rm-chip__mark { color: var(--vp-c-green-1); } -.rm-chip--doing .rm-chip__mark { color: #ffc107; } +.rm-chip--doing .rm-chip__mark { color: var(--vp-c-yellow-1, #f59e0b); } .rm-chip--todo .rm-chip__mark { color: var(--vp-c-text-3); } .home-roadmap__next { diff --git a/site/.vitepress/theme/components/OnlineCompilerDemo.vue b/site/.vitepress/theme/components/OnlineCompilerDemo.vue index 4fde2dcf5..2b3c3c188 100644 --- a/site/.vitepress/theme/components/OnlineCompilerDemo.vue +++ b/site/.vitepress/theme/components/OnlineCompilerDemo.vue @@ -27,7 +27,76 @@ -
+ +
+
+ + +
+ +
+
+
{{ displaySource }}
+
+ +

+ {{ sourceLoadState === 'error' ? '源码加载失败,可点上方源码链接查看' : '加载源码中…' }} +

+ + +
+ + + +
+