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:
+30
-3
@@ -38,8 +38,14 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
function doc() { return fDoc || document; }
|
||||
function win() { return fWin || window; }
|
||||
function doc() {
|
||||
if (!fDoc) throw new Error('frame-error: 演示页尚未绑定,禁止回退到宿主测试页');
|
||||
return fDoc;
|
||||
}
|
||||
function win() {
|
||||
if (!fWin) throw new Error('frame-error: 演示页尚未绑定,禁止回退到宿主测试页');
|
||||
return fWin;
|
||||
}
|
||||
|
||||
/* 被测范围:演示页的 .demo 容器(文档页头 h1/.sub 不属于组件交付物) */
|
||||
function scope() {
|
||||
@@ -519,6 +525,19 @@
|
||||
}
|
||||
|
||||
function run() {
|
||||
if (!fDoc || !fWin) {
|
||||
var frameErr = [{ id: 'frame-error', status: 'fail', ms: 0, err: '演示页未绑定,禁止在宿主测试页上断言' }];
|
||||
renderResults(frameErr);
|
||||
var frameRes = { slug: SLUG, total: 1, pass: 0, fail: 1, skip: 0, failures: ['frame-error'], failureDetails: [{ id: 'frame-error', err: '演示页未绑定' }], ms: 0 };
|
||||
window.__aaResult = frameRes;
|
||||
setFrameState('演示页加载失败', 'fail');
|
||||
try {
|
||||
if (window.parent && window.parent !== window) {
|
||||
window.parent.postMessage({ type: 'aa-test-result', result: frameRes }, '*');
|
||||
}
|
||||
} catch (e) {}
|
||||
return frameRes;
|
||||
}
|
||||
var t0 = performance.now();
|
||||
annotate();
|
||||
var asserts = collect();
|
||||
@@ -540,6 +559,8 @@
|
||||
try {
|
||||
if (window.__aaBehaviors && window.__aaBehaviors.run) {
|
||||
asserts = asserts.concat(window.__aaBehaviors.run({ slug: SLUG, root: scope(), win: win(), doc: doc() }));
|
||||
} else if (window.__aaBehaviors && window.__aaBehaviors.pilots && window.__aaBehaviors.pilots.indexOf(SLUG) >= 0) {
|
||||
asserts.push({ id: 'matrix:behavior:engine-missing', status: 'fail', ms: 0, err: '行为引擎未加载,试点组件行为断言缺失' });
|
||||
}
|
||||
} catch (e) {
|
||||
asserts.push({ id: 'matrix:behavior:engine-error', status: 'fail', ms: 0, err: '行为引擎异常: ' + (e && e.message || e) });
|
||||
@@ -590,7 +611,13 @@
|
||||
/* ---------- 启动 ---------- */
|
||||
|
||||
var runBtn = document.getElementById('run-asserts');
|
||||
if (runBtn) runBtn.addEventListener('click', function () { if (!fDoc) bindFrame(); run(); });
|
||||
if (runBtn) runBtn.addEventListener('click', function () {
|
||||
if (!bindFrame()) {
|
||||
run();
|
||||
return;
|
||||
}
|
||||
run();
|
||||
});
|
||||
['export-log', 'export-log-2'].forEach(function (id) {
|
||||
var el = document.getElementById(id);
|
||||
if (el) el.addEventListener('click', exportLog);
|
||||
|
||||
Reference in New Issue
Block a user