feat(S6-P21): 组件族参数化(13族/44成员/导航族15文件同源/79→48概念组件)

【本次核心 · S6-P21】
- 族层数据:families.json + 44 份契约注入 family/familyRole/familyParams;
  data.json / data.js / site/details 同步。13 族 / 44 成员 / 35 独立 → 概念组件 79→48。
- 79 个 slug 全保留、集合逐一不变(铁律 5 对外承诺未破);frameworks 仍 395 文件、薄壳仍 79。
- 归族判据为契约中可核对字段(semanticTypeCandidates 重叠 / anatomy 为同一骨架子集 /
  变体维度同构 / doNotInvent 显式从属声明),每族 mergeBasis 写明依据,不按名字猜。
- 实现层合并(导航族端到端切片):tools/gen-family-impl.mjs 从 5 端模板生成
  TopMenu / SideMenu / MixedNavigation 共 15 文件,参数 direction=top|side|mixed;
  三份 CSS md5 完全相同 = 一份样式表服务三个组件。
- 新增 tools/gen-families.mjs、tools/gen-family-impl.mjs、tools/verify-families.mjs、
  tools/lib/family-model.mjs、tools/lib/family-impl/nav-menu/*.tpl。

【同时清掉此前已完成但未提交的批次】
生成物(data.json / data.js / site/sources / site/components 薄壳 / sitemap.xml / tests 报告)
跨阶段交织,无法拆成互相自洽的多个提交,故按既有批量风格合并提交:
- Package:三端可 import(S5-P18)+ 发布到私有 npm 源
- Docs site:导航语言改下拉(S5-P19)、详情页代码块默认展开、中英切换完整性
- Security:生产部署链审计修复(2026-09-19)+ 线上部署
- Theme modes 日间/夜间/自动;S1-P4 data.js 瘦身;S2-P5 暗色;S2-P6 跨端一致性;
  S2-P7 行为断言;S2-P9 FAQ;S3-P8 RTL;S3-P9 契约缺口解释层;S4-P12 发布流程
- 补入 tools/pack-deploy.mjs、run-site-smoke.mjs、verify-*.mjs,.dockerignore、
  安全审计修复与待决策项.md

【验收】
- node tools/verify-families.mjs → OK: 族层端到端一致(13 族 / 44 成员 / 79 组件不变 / 395 文件不变)
- node tools/verify-cross-platform.mjs → 79/79 identical(HEAD 基线 high 44)
- node tools/run-regression.mjs → 100%(79/79 页,1017/1017 断言,N/A 34),连跑 8 次一致,0 超时
- 逐页实测:topmenu / sidemenu / mixednavigation 各 13/13,帧内 direction 参数正确,0 JS 错误
- 零运行时依赖 OK;build-site.ps1 ASCII-only OK

【未纳入】site/components/<slug>/ 平台薄壳 316 个 —— 历史从未跟踪且属构建产物,保持现状。
This commit is contained in:
aurora-admin
2026-09-20 03:32:31 +08:00
parent 7e3d442dab
commit eb25feedaf
372 changed files with 16928 additions and 12810 deletions
+24 -11
View File
@@ -10,12 +10,13 @@
<body>
<div class="aa-page">
<h2 class="aa-h2">ThemeSwitcher 主题切换</h2>
<p class="aa-desc">明暗主题 + 品牌色切换,实时预览,可保存偏好。</p>
<p class="aa-desc">日间 / 夜间 / 自动主题 + 品牌色切换,实时预览。</p>
<div class="aa-demo">
<div class="aa-themesw" id="sw">
<div class="aa-themesw-opt" role="radio" tabindex="0" data-mode="light"><span class="aa-themesw-dot light"></span>浅色</div>
<div class="aa-themesw-opt" role="radio" tabindex="0" data-mode="dark"><span class="aa-themesw-dot dark"></span>深色</div>
<div class="aa-themesw" id="sw" role="radiogroup" aria-label="主题模式">
<div class="aa-themesw-opt" role="radio" aria-checked="false" tabindex="0" data-mode="light"><span class="aa-themesw-dot light"></span>日间</div>
<div class="aa-themesw-opt" role="radio" aria-checked="false" tabindex="0" data-mode="dark"><span class="aa-themesw-dot dark"></span>夜间</div>
<div class="aa-themesw-opt" role="radio" aria-checked="false" tabindex="0" data-mode="auto"><span class="aa-themesw-dot auto"></span>自动</div>
<div class="aa-themesw-colors" id="colors"></div>
<div class="aa-themesw-label" id="label"></div>
</div>
@@ -31,22 +32,34 @@
<script>
var brands = ['#2F54EB', '#1677FF', '#722ED1', '#13C2C2', '#FA541C', '#EB2F96'];
var mode = 'light', brand = '#2F54EB';
var media = window.matchMedia ? window.matchMedia('(prefers-color-scheme: dark)') : null;
try { mode = localStorage.getItem('aa-mode') || 'light'; } catch (e) {}
if (mode !== 'light' && mode !== 'dark' && mode !== 'auto') mode = 'light';
var colorsEl = document.getElementById('colors');
brands.forEach(function (c) {
var s = document.createElement('span');
s.className = 'aa-themesw-color'; s.setAttribute('role','radio'); s.setAttribute('tabindex','0'); s.style.background = c; s.dataset.c = c;
s.className = 'aa-themesw-color'; s.setAttribute('role','radio'); s.setAttribute('aria-label','品牌色 ' + c); s.setAttribute('aria-checked', 'false'); s.setAttribute('tabindex','0'); s.style.background = c; s.dataset.c = c;
s.onclick = function () { brand = c; render(); };
s.onkeydown = function (e) { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); brand = c; render(); } };
colorsEl.appendChild(s);
});
document.querySelectorAll('.aa-themesw-opt').forEach(function (o) {
o.onclick = function () { mode = o.dataset.mode; render(); };
o.onclick = function () { mode = o.dataset.mode; try { localStorage.setItem('aa-mode', mode); } catch (e) {} render(); };
o.onkeydown = function (e) { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); o.click(); } };
});
function effective() { return mode === 'auto' && media ? (media.matches ? 'dark' : 'light') : mode; }
function render() {
document.querySelectorAll('.aa-themesw-opt').forEach(function (o) { o.classList.toggle('is-active', o.dataset.mode === mode); });
Array.prototype.forEach.call(colorsEl.children, function (c) { c.classList.toggle('is-active', c.dataset.c === brand); });
document.documentElement.style.setProperty('--brand', brand);
document.getElementById('cur').textContent = mode === 'light' ? '浅色' : '深色';
document.getElementById('label').textContent = '品牌色:' + brand + '(点击色块可切换,应用于 CSS 变量 --brand 实时预览)';
var actual = effective();
document.documentElement.classList.toggle('aa-dark', actual === 'dark');
document.querySelectorAll('.aa-themesw-opt').forEach(function (o) { var active = o.dataset.mode === mode; o.classList.toggle('is-active', active); o.setAttribute('aria-checked', active ? 'true' : 'false'); });
Array.prototype.forEach.call(colorsEl.children, function (c) { c.classList.toggle('is-active', c.dataset.c === brand); c.setAttribute('aria-checked', c.dataset.c === brand ? 'true' : 'false'); });
document.documentElement.style.setProperty('--au-color-brand', brand);
document.getElementById('cur').textContent = mode === 'auto' ? '自动(当前:' + (actual === 'dark' ? '夜间' : '日间') + ')' : (actual === 'dark' ? '夜间' : '日间');
document.getElementById('label').textContent = '品牌色:' + brand + '(应用于 Aurora 品牌令牌实时预览)';
}
if (media) {
var onChange = function () { if (mode === 'auto') render(); };
if (media.addEventListener) media.addEventListener('change', onChange); else if (media.addListener) media.addListener(onChange);
}
render();
</script>