提交记录修改www/README.md+1 −1看文件
修改www/scripts/check-site.mjs+6 −1看文件
修改www/src/components/CageHome.astro+23 −3看文件
修改www/src/styles/cage.css+12 −3看文件
| @@ -19,7 +19,7 @@ npm run build # dist/ | ||
| 19 | 19 | |
| 20 | 20 | GitHub Actions 在网站文件或 README 的普通推送与 PR 中检查和构建;公开 Release 发布或维护者手动运行时部署 GitHub Pages。Release 事件会先下载实际 macOS 安装包与对应 Mihomo 源码,验证摘要、Developer ID 签名、Apple 公证和 Gatekeeper,失败时不会部署这一轮网站。Windows、Linux 的发行验收由对应平台流程负责。发布操作见[公开发行与主页部署](../docs/public-releases.md)。 |
| 21 | 21 | |
| 22 | 删除:根目录 README 是维护者确认产品措辞的来源。README 修改触发主页重新构建;发布工作流只刷新下载版本并读取现有译文,不自动生成翻译。中文主页为 `/`,其他语言使用 `/<语言代码>/`,语言范围与根目录 README 导航一致,不提供英语。下拉框切换独立 URL;阿拉伯语、波斯语、普什图语、达里语使用从右向左布局。网页正文直接复用对应 README 译文,结构调整时构建会提示维护者同步映射。 | |
| 22 | 新增:根目录 README 是维护者确认产品措辞的来源。README 修改触发主页重新构建;发布工作流只刷新下载版本并读取现有译文,不自动生成翻译。中文主页为 `/`,其他语言使用 `/<语言代码>/`,语言范围与根目录 README 导航一致,不提供英语。语言选择器在页面内展开链接列表,占据布局空间并顺移下方内容。支持键盘展开、链接导航与 Esc 收起,禁用 JavaScript 时仍可展开和跳转。各语言使用独立 URL;阿拉伯语、波斯语、普什图语、达里语使用从右向左布局。网页正文直接复用对应 README 译文,结构调整时构建会提示维护者同步映射。 | |
| 23 | 23 | |
| 24 | 24 | GitHub Pages 是当前主页的发布目标,部署配置由仓库工作流维护。 |
| 25 | 25 | |
| @@ -16,8 +16,13 @@ const dist = path.join(root,'www/dist'); | ||
| 16 | 16 | const published = JSON.parse(fs.readFileSync(path.join(root, 'www/src/data/release.json'), 'utf8')); |
| 17 | 17 | for (const code of codes) { |
| 18 | 18 | const html = fs.readFileSync(path.join(dist,code === 'zh' ? '' : code,'index.html'),'utf8'); |
| 19 | 删除: const options = [...html.matchAll(/<option\b[^>]*value="([^"]+)"/g)].map(m=>m[1]); | |
| 19 | 新增: const picker = html.match(/<details\b[^>]*id="site-language"[^>]*>([\s\S]*?)<\/details>/)?.[1]; | |
| 20 | 新增: assert.ok(picker, `${code}: missing inline language picker`); | |
| 21 | 新增: const options = [...picker.matchAll(/<a\b[^>]*href="([^"]+)"/g)].map(m=>m[1]); | |
| 20 | 22 | assert.equal(options.length,codes.length, `${code}: language dropdown missing options`); |
| 23 | 新增: assert.deepEqual(options, codes.map(locale => `/Claude-Cage/${locale === 'zh' ? '' : locale + '/'}`), `${code}: incorrect language destinations`); | |
| 24 | 新增: assert.equal([...picker.matchAll(/aria-current="page"/g)].length, 1, `${code}: current language must be marked once`); | |
| 25 | 新增: assert.ok(!html.includes('<select'), `${code}: system popup selector remains`); | |
| 21 | 26 | assert.ok(!options.some(url=>url.endsWith('/en/')), `${code}: unexpected English route`); |
| 22 | 27 | assert.ok(html.includes('id="site-language"'), `${code}: missing language selector`); |
| 23 | 28 | assert.ok(html.includes(`dir="${['ar','fa','ps','prs'].includes(code)?'rtl':'ltr'}"`), `${code}: incorrect reading direction`); |
| @@ -51,7 +51,18 @@ const canonical = new URL(pathFor(locale), Astro.site); | ||
| 51 | 51 | <a class="brand" href={pathFor(locale)} aria-label={c.home}><img src={`${base}cage-icon.png`} width="40" height="40" alt="" /><span>Claude Cage</span></a> |
| 52 | 52 | <nav><a href="#how">{c.start}</a><a href={repo}>GitHub ↗</a><a class="nav-download" href="#download" data-download-open aria-haspopup="dialog">{c.downloadLabel} ↓</a></nav> |
| 53 | 53 | </header> |
| 54 | 删除: <div class="language-switch wrap"><label for="site-language">{c.languageLabel}</label><select id="site-language" aria-label={c.languageLabel}>{languages.map(l => <option value={pathFor(l.code)} selected={l.code === locale} lang={l.lang}>{l.name}</option>)}</select></div> | |
| 54 | 新增: <div class="language-switch wrap"> | |
| 55 | 新增: <span id="language-label">{c.languageLabel}</span> | |
| 56 | 新增: <details id="site-language" class="language-picker"> | |
| 57 | 新增: <summary aria-labelledby="language-label current-language"> | |
| 58 | 新增: <bdi id="current-language">{languages.find(l => l.code === locale)?.name}</bdi> | |
| 59 | 新增: <span class="language-chevron" aria-hidden="true">⌄</span> | |
| 60 | 新增: </summary> | |
| 61 | 新增: <nav class="language-options" aria-labelledby="language-label"> | |
| 62 | 新增: {languages.map(l => <a href={pathFor(l.code)} lang={l.lang} dir={l.dir} aria-current={l.code === locale ? 'page' : undefined}>{l.name}</a>)} | |
| 63 | 新增: </nav> | |
| 64 | 新增: </details> | |
| 65 | 新增: </div> | |
| 55 | 66 | <main id="main"> |
| 56 | 67 | <section class="story-hero wrap"> |
| 57 | 68 | <div class="story-copy"><span class="eyebrow"><span class="seed"></span>CLAUDE CAGE · v{published.version}</span><h1>{c.hero}{c.heroAccent && <><br /><em>{c.heroAccent}</em></>}</h1><p class="tagline">{c.tagline}</p><p class="hero-intro">{c.intro}</p><a class="button" href="#download" data-download-open aria-haspopup="dialog">{c.downloadLabel} ↓</a><span class="requirements" dir="ltr">{c.requirements}</span></div> |
| @@ -80,8 +91,17 @@ const canonical = new URL(pathFor(locale), Astro.site); | ||
| 80 | 91 | </article>)}</div> |
| 81 | 92 | </dialog> |
| 82 | 93 | <script> |
| 83 | 删除: const language = document.querySelector<HTMLSelectElement>('#site-language'); | |
| 84 | 删除: language?.addEventListener('change', () => { window.location.assign(language.value); }); | |
| 94 | 新增: const language = document.querySelector<HTMLDetailsElement>('#site-language'); | |
| 95 | 新增: language?.addEventListener('keydown', event => { | |
| 96 | 新增: if (event.key === 'Escape' && language.open) { | |
| 97 | 新增: event.preventDefault(); | |
| 98 | 新增: language.open = false; | |
| 99 | 新增: language.querySelector('summary')?.focus(); | |
| 100 | 新增: } | |
| 101 | 新增: }); | |
| 102 | 新增: document.addEventListener('click', event => { | |
| 103 | 新增: if (language && event.target instanceof Node && !language.contains(event.target)) language.open = false; | |
| 104 | 新增: }); | |
| 85 | 105 | const downloads = document.querySelector<HTMLDialogElement>('.download-dialog'); |
| 86 | 106 | document.querySelectorAll<HTMLAnchorElement>('[data-download-open]').forEach(link => { |
| 87 | 107 | link.addEventListener('click', event => { |
| @@ -839,9 +839,18 @@ figure { margin: 0; } | ||
| 839 | 839 | |
| 840 | 840 | .community-links { flex-wrap: wrap; } |
| 841 | 841 | } |
| 842 | 删除:.language-switch { align-items: center; } | |
| 843 | 删除:.language-switch select { color: inherit; font: inherit; background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 9px 30px 9px 12px; min-width: 140px; } | |
| 844 | 删除:.language-switch select:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; } | |
| 842 | 新增:.language-switch { align-items: flex-start; } | |
| 843 | 新增:.language-switch > span { padding-block: 10px; } | |
| 844 | 新增:.language-picker { width: 190px; max-width: 100%; min-width: 0; } | |
| 845 | 新增:.language-picker summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; color: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; list-style: none; } | |
| 846 | 新增:.language-picker summary::-webkit-details-marker { display: none; } | |
| 847 | 新增:.language-picker[open] summary { margin-bottom: 4px; } | |
| 848 | 新增:.language-chevron { flex: none; } | |
| 849 | 新增:.language-picker[open] .language-chevron { transform: rotate(180deg); } | |
| 850 | 新增:.language-options { display: grid; gap: 2px; max-height: 280px; overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: 6px; } | |
| 851 | 新增:.language-options a { display: block; padding: 8px; border-radius: 3px; overflow-wrap: anywhere; } | |
| 852 | 新增:.language-options a:hover, .language-options a[aria-current="page"] { background: #eee7dc; } | |
| 853 | 新增:.language-picker summary:focus-visible, .language-options a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; } | |
| 845 | 854 | .key-features { max-width: 850px; padding-inline-start: 22px; line-height: 1.85; } |
| 846 | 855 | .key-features li { margin-top: 12px; } |
| 847 | 856 | .doc-links { list-style: none; padding: 0; margin: 0; } |

