refactor(详情页+S8): 详情页减重(导航互斥/入口去重/i18n去重) + 品牌标识入库
Regression / regression (push) Canceled after 0s

本提交含两条并行工作线,因互相咬合(package.json scripts、regression.yml、
npm run build 链)无法按文件干净拆分,故合并为一次自洽提交。

## 详情页减重(本轮主任务:修复「AI 干太重」)

- 导航收敛:宽屏只用右侧目录、≤1200px 只用页内 sticky 导航,纯 CSS 媒体查询
  实现(不引入 JS 宽度监听)。此前两套导航同时可见,active 状态互相打架。
- 入口去重:标题区由「查看示例/在线测试/契约 JSON」三个减为「在线测试」一个;
  契约 JSON 归入实现资源;删除示例底部重复的「在线测试」。
- 示例工具栏:删除与目录锚点重复的示例下拉选择器;「全部展开代码」只在
  示例数 >1 时出现(103 个组件里 49 个仅 1 个示例,此前恒显示)。
- 重复文案:示例区两句同义导语合并为一句。
- 首页 CTA 由 5 个减为 2 个(浏览组件/快速开始),测试总览入口挂到已有的
  通过率统计卡上,不再另占 Hero 按钮。
- 统一详情取数:抽出 fetchDetail/loadDetail 作为 details/*.json 的唯一路径,
  FAQ 不再自行 fetch 一遍,与组件页共用缓存与失败兜底。

## i18n

- 删除 12 组重复键(含整段 FAQ 说明),字典 604 → 585 唯一键。
- 删除本次改动产生的 6 个死键。
- verify-i18n.mjs 新增 `unique dictionary keys` 断言:重复键在对象字面量里
  是静默的后值覆盖,此前无从发现;现由门禁拦住。

## 文档事实修正(实测为准)

- TESTING/CONTRIBUTING:79 → 103 组件;旧断言数改为回指 tests/report.json。
- PLATFORMS:移动端 108 文件/18 端 → 282 文件/47 端;契约 5 → 47;
  令牌 17 → 15;uni-app SFC 21 → 50。
- AGENTS:断言 1405/18 页 → 1464/103 页(PC)、807/47 页(移动端)。
- package.json:YOUR-ACCOUNT 占位 → gitea 实址与 kole-ui.mymoyu.top。

## 品牌标识(并行会话成果,一并入库)

- brand-mark.json 收归真源,build:brand 生成 favicon 与单色 SVG;
  PC 与移动端共用资产,verify:brand 24 条断言。
- regression.yml 增加 verify:brand 步骤。

## 门禁与验收

新增工具:verify-component-page.mjs(86 条真实浏览器断言,随详情页改造同步
更新为「只允许一套导航可见」)、verify-brand-mark.mjs、lib/i18n-dead-keys.mjs
(只读诊断)。

回归:PC 100%(1464/1464,103 页,N/A 50)· 移动端 100%(807/807,47 页)。
门禁:component-page 86 · i18n 17 · brand 24 · routes all · smoke all ·
theme OK · isolation 31 · nav all · examples 9 · api-docs 10 · mobile-docs 12。

已知未做:i18n 另有约 44 条历史死键(非本次产生),已记为 ROADMAP S8-P6;
顶栏与悬浮区的两个主题入口为刻意设计(verify-theme 断言其互斥),未删。
This commit is contained in:
aurora-admin
2026-09-22 23:56:05 +08:00
parent f1fbfc2ddb
commit 5ee5d829a4
92 changed files with 1320 additions and 463 deletions
+129 -4
View File
@@ -46,11 +46,20 @@ a:hover { color: var(--kole-color-brand-hover); }
background: var(--kole-color-brand);
color: var(--kole-color-text-inverse);
display: flex; align-items: center; justify-content: center;
flex-shrink: 0;
}
/* 品牌标记是内联 SVG(几何 K):尺寸交给 SVG 的 width/height 属性,
这里只保证 flex 容器不让它被拉伸。≤1366px 时 .logo-text 隐藏,
本盒是顶栏唯一的品牌标识(style.css 的窄屏规则),故必须 flex-shrink: 0。 */
.logo-mark svg { display: block; flex-shrink: 0; }
/* 品牌标记由 brand-mark.json 生成的单色 SVG 作为 mask 提供几何,
盒子本身仍是品牌蓝,内部标记继承 currentColor。这样 PC、移动站与 favicon
不再各自维护一份路径;mask 不参与布局,≤1366px 时仍是唯一品牌标识。 */
.logo-mark[data-brand-mark="mono"]::before {
content: '';
width: 20px; height: 20px;
display: block;
background: currentColor;
-webkit-mask: url('assets/kole-mark-mono.svg') center / contain no-repeat;
mask: url('assets/kole-mark-mono.svg') center / contain no-repeat;
}
.logo-mark svg { display: none; }
.logo-text { font-size: 16px; font-weight: 600; white-space: nowrap; }
.logo-text em { font-style: normal; font-weight: 500; color: var(--kole-color-text-secondary); }
/* ---------- 顶栏版本选择器(自成一体的下拉组件)----------
@@ -1911,6 +1920,122 @@ html.kole-stage-locked { overflow: hidden; }
.content { padding: var(--kole-space-24) var(--kole-space-16); }
}
/* ---- 组件内容页:概览 / 示例 / API / 设计与资源 ---- */
.kole-component-page { min-width: 0; }
.kole-component-page [hidden] { display: none !important; }
.kole-component-page .detail-head { padding: 4px 0 28px; }
.kole-detail-breadcrumb {
display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
margin-bottom: 24px; color: var(--kole-color-text-secondary); font-size: 12px;
}
.kole-detail-breadcrumb a { color: var(--kole-color-text-secondary); }
.kole-detail-breadcrumb a:hover { color: var(--kole-color-brand); }
.kole-detail-breadcrumb [aria-current] { color: var(--kole-color-text-body); }
.kole-detail-title { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 12px; }
.kole-detail-title h1 { margin: 0; font-size: 34px; line-height: 1.35; letter-spacing: -.025em; flex-wrap: wrap; }
.kole-detail-title h1 .en { font-size: 22px; letter-spacing: -.015em; }
.kole-detail-title .chip { border: 1px solid var(--kole-color-border); background: transparent; }
.kole-component-page .detail-head .page-desc { margin-bottom: 22px; line-height: 1.8; max-width: 68ch; }
.kole-detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.kole-detail-action {
display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 7px 14px;
border: 1px solid var(--kole-color-border); border-radius: var(--kole-radius-medium);
color: var(--kole-color-text-body); background: var(--kole-color-card-bg); font-size: 13px; font-weight: 500;
}
.kole-detail-action:hover { border-color: var(--kole-color-brand); color: var(--kole-color-brand); }
.kole-detail-action-primary { color: var(--kole-color-brand); background: var(--kole-color-brand-bg); border-color: transparent; }
.kole-detail-resource { padding: 6px; font-size: 12px; color: var(--kole-color-text-secondary); }
.kole-component-nav {
display: flex; gap: 24px; position: sticky; top: 60px; z-index: 30;
min-height: 52px; margin-bottom: 28px; background: var(--kole-color-page-bg);
border-top: 1px solid var(--kole-color-border); border-bottom: 1px solid var(--kole-color-border);
}
.kole-component-nav a {
display: inline-flex; align-items: center; position: relative; padding: 13px 0;
color: var(--kole-color-text-secondary); white-space: nowrap; font-size: 13px;
}
.kole-component-nav a:hover, .kole-component-nav a.active { color: var(--kole-color-brand); }
.kole-component-nav a.active { font-weight: 600; }
.kole-component-nav a.active::after { content: ''; position: absolute; height: 2px; background: currentColor; bottom: -1px; inset-inline: 0; }
.kole-component-page .sec, .kole-component-page .ex-card { scroll-margin-top: 72px; }
/* 详情页只有一套可见导航:宽屏(>1200px)用右侧目录,页内 sticky 导航收起来;
≤1200px 右侧目录本就隐藏(见本文件 .toc 的响应式规则),改由页内导航承担。
两边都不出现「两套导航同时可见」的空档 —— 断点与滚动落点一同定义。 */
@media (min-width: 1201px) {
.kole-component-nav { display: none; }
}
@media (max-width: 1200px) {
.kole-component-page .sec, .kole-component-page .ex-card { scroll-margin-top: 124px; }
}
.kole-component-page .sec > h2 { border: 0; padding: 0; margin-bottom: 8px; font-size: 22px; line-height: 1.5; }
.kole-component-page .sec > h3 { font-size: 17px; color: var(--kole-color-text-title); margin: 0 0 14px; }
.kole-component-page .demo-intro { margin: 0 0 20px; }
.kole-component-page .demo-intro p { margin: 3px 0; color: var(--kole-color-text-secondary); }
.kole-component-page .demo-note { font-size: 12px; }
.kole-examples-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kole-example-picker {
min-width: 0; max-width: 65%; height: 34px; padding: 0 28px 0 10px;
border: 1px solid var(--kole-color-border); border-radius: var(--kole-radius-base);
background: var(--kole-color-card-bg); color: var(--kole-color-text-body); font: inherit; font-size: 12px;
text-overflow: ellipsis; cursor: pointer;
}
.kole-expand-code, .kole-example-toggle {
border: 0; background: transparent; color: var(--kole-color-text-secondary);
padding: 6px 0; font: inherit; font-size: 12px; cursor: pointer; flex-shrink: 0;
}
.kole-expand-code:hover, .kole-example-toggle:hover { color: var(--kole-color-brand); }
.kole-component-page .ex-list { gap: 24px; }
.kole-component-page .ex-head { align-items: center; padding: 18px 20px 0; }
.kole-component-page .ex-title { font-size: 16px; line-height: 1.6; }
.kole-component-page .ex-num { background: var(--kole-color-table-header-bg); color: var(--kole-color-text-secondary); font-size: 11px; }
.kole-example-link { color: var(--kole-color-text-secondary); margin-inline-start: auto; padding: 0 4px; font-size: 18px; }
.kole-component-page .ex-stage:not(.is-lifted) { margin-top: 16px; }
.kole-example-toolbar {
display: flex; align-items: center; justify-content: space-between; gap: 12px;
padding: 4px 18px; border-top: 1px solid var(--kole-color-border); background: var(--kole-color-card-bg);
}
.kole-example-preview { color: var(--kole-color-text-secondary); font-size: 11px; }
.kole-component-page .ex-code-bar { flex-wrap: wrap; row-gap: 4px; }
.kole-component-page .ex-tabs { flex-wrap: wrap; }
.kole-component-page .ex-code pre { max-height: 360px; scrollbar-width: thin; }
.kole-component-page .ex-code .code-copy { margin-left: auto; flex-shrink: 0; }
.kole-component-page .ex-foot { flex-wrap: wrap; }
.kole-component-page #api, .kole-detail-reference, .kole-component-page #related { padding-top: 30px; border-top: 1px solid var(--kole-color-border); }
.kole-doc-table { max-width: 100%; overflow-x: auto; margin-bottom: 24px; border: 1px solid var(--kole-color-border); border-radius: var(--kole-radius-medium); }
.kole-doc-table > table { margin: 0; border: 0; }
.kole-component-page .api-table { min-width: 540px; }
.kole-component-page .api-table th { white-space: nowrap; }
.kole-component-page .api-table td { overflow-wrap: anywhere; }
.kole-component-page .api-legend { margin-top: 16px; padding: 12px 14px; background: var(--kole-color-table-header-bg); border-radius: var(--kole-radius-medium); }
.kole-spec-disclosure { border: 1px solid var(--kole-color-border); border-radius: var(--kole-radius-medium); background: var(--kole-color-card-bg); }
.kole-spec-disclosure summary { cursor: pointer; padding: 14px 18px; color: var(--kole-color-text-body); font-size: 13px; }
.kole-spec-disclosure[open] summary { border-bottom: 1px solid var(--kole-color-border); }
.kole-spec-disclosure .spec-box { border: 0; background: transparent; }
.kole-detail-reference > .page-desc { margin-bottom: 28px; }
.kole-detail-resources { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 20px; font-size: 12px; color: var(--kole-color-text-secondary); }
.kole-detail-resources code { overflow-wrap: anywhere; }
.kole-component-page .rel-row { margin-top: 16px; }
.kole-component-page :is(a, button, select, summary, pre, .kole-doc-table):focus-visible { outline: 2px solid var(--kole-color-focus-ring); outline-offset: 3px; }
.toc a.kole-toc-child { padding-inline-start: 20px; font-size: 12px; }
@media (max-width: 900px) {
.kole-detail-title h1 { font-size: 30px; }
.kole-component-nav { gap: 20px; }
}
@media (max-width: 560px) {
.kole-detail-breadcrumb { margin-bottom: 18px; }
.kole-detail-title { gap: 10px; }
.kole-detail-title h1 .en { font-size: 18px; }
.kole-component-nav { gap: 18px; }
.kole-component-nav a { font-size: 12px; }
.kole-component-page .ex-head { padding: 14px 12px 0; }
.kole-component-page .ex-src { width: 100%; order: 3; padding-bottom: 6px; white-space: normal; }
.kole-component-page .ex-tabs button { padding: 6px 8px; }
.kole-component-page .ex-code pre { padding: 12px; }
.kole-component-page .kole-examples-tools { flex-wrap: wrap; }
.kole-example-picker { flex: 1; max-width: 100%; }
.kole-component-page .res-table { min-width: 460px; }
}
/* ================= 顶栏窄屏折叠:汉堡 + 导航抽屉 =================
* 折叠前实测基线(Chromium,中英双语):
* 中文 1280px 起 7 条链接全部折行;1100px 起文字顶出 60px 顶栏(5 条出血);