Files
jiu/tools/screens.mjs
T
wangjia 05203a9b5b
Design Source Checks / design-source (push) Failing after 14m23s
refactor: 原型迁移 .superpowers/prototype → design/prototype(与 CONTRACT 同目录)
- git mv 全目录(历史保留);.gitignore 收敛为整个 .superpowers/ 忽略
- 全仓 16 处引用同步(CI checks.yml / l1-sync / screens.mjs / hooks /
  CLAUDE.md / CONTRACT / SSR 模板注释 / docs / web 注释)
- 修 pre-commit 路径正则残留;5180 评审服务已切新路径
- 验证:check-ds 12 道 / l1-sync 6 道 / fidelity 抽查全过

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JJ1g8XV1YhhmHRzhwWEW7o
2026-07-07 18:47:31 +08:00

142 lines
6.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// tools/screens.mjs — 还原验收「屏注册表」单一真源
//
// fidelity.mjs(自动 diff 闸)与 ds-compare.mjs(人工 montage 目检)共用此表,
// 保证「每一屏 + 外壳都跟原型比」(规则 2)。屏随 Phase 1/2 照原型重建后逐个入册。
//
// 本表只登记 design/CONTRACT.md 块 4 中「真相源 = 同步」的屏,两处互为镜像;
// 快照 / 代码先行 态屏不入册(分层规则见 CLAUDE.md「设计真相源分层」)。
//
// 字段:
// html 原型 html(仓库根相对路径)
// prefix Flutter golden 文件前缀 → client/test/golden/goldens/<prefix>_<theme>.png
// width/height golden「逻辑」尺寸(golden 物理像素 = 逻辑 × dpr);两边须一致
// dpr devicePixelRatio(默认 2
// waitFor 原型截图前等待的选择器
// threshold fidelity 该屏校准阈值(差异像素比例上限);人工目检「像」后定
// shell true=外壳(顶栏/侧栏/状态栏整框),与普通屏一同对比
// zones 分区域阈值(逻辑坐标):把屏切带各自判定,抓「全屏百分比淹没」的局部错位
// (如顶栏元素水平偏移)。x/y/w/h 为逻辑像素,fidelity 按 dpr 换算。
export const SCREENS = {
// 外壳:顶栏(两级品牌+主题器+通知) + 侧栏(分组) + 状态栏。
// 全屏阈值松(内容区空白 vs 原型满表),真正判定看 zones(顶栏带收紧到 4%)。
shell: {
html: 'design/prototype/screens/inventory.html', // 外壳含在每个全框屏里,借库存页取整框
prefix: 'app_shell',
width: 1280, height: 900, dpr: 2,
waitFor: '.app',
threshold: 0.20, // 全屏仅参考;判定以 zones 为准
shell: true,
zones: [
{ name: 'top', x: 0, y: 0, w: 1280, h: 56, threshold: 0.04 },
{ name: 'side', x: 0, y: 56, w: 218, h: 810, threshold: 0.14 },
{ name: 'status', x: 0, y: 866, w: 1280, h: 34, threshold: 0.10 },
],
},
inventory: {
html: 'design/prototype/screens/inventory.html',
prefix: 'inventory_list',
width: 1280, height: 900, dpr: 2,
waitFor: '.app',
// Phase 2 重建后校准:实测 a 3.8% / b 2.9% / c 4.2%(残差=跨渲染器行高漂移
// + 状态徽章已知语义差),收紧到 8% 抓结构性回归。
threshold: 0.07, // 实测 4.7% + 2pp2026-07-07 收紧,原 0.08
},
partners: {
html: 'design/prototype/screens/partners.html',
prefix: 'partners',
width: 1280, height: 900, dpr: 2,
waitFor: '.app',
// 重建后校准:实测 a 3.2 / b 2.5 / c 3.5%(残差=列宽分布+文字度量+保留的导出按钮)
threshold: 0.06, // 实测 3.6% + 2pp2026-07-07 收紧,原 0.08
},
products: {
html: 'design/prototype/screens/products.html',
prefix: 'products_archive',
width: 1280, height: 900, dpr: 2,
waitFor: '.app',
// 重建后校准:实测 a 3.2 / b 2.4 / c 3.5%。残差含已知数据驱动差
// (见 design/CONTRACT.md):档案无 分类/状态 列、无香型 chips、
// seg 第 5 tab 香型→仓库、无「新增商品」、pager 带翻页控件。
threshold: 0.06, // 实测 3.7% + 2pp2026-07-07 收紧,原 0.08
},
devices: {
html: 'design/prototype/screens/devices.html',
prefix: 'device_management',
width: 1280, height: 900, dpr: 2,
waitFor: '.app',
// 重建后校准:实测 2.4–3.0%(残差=会话表列宽分布+外设卡按钮文字省略)
threshold: 0.06, // 实测 3.5% + 2pp2026-07-07 收紧,原 0.08
},
settings: {
html: 'design/prototype/screens/settings.html',
prefix: 'settings',
width: 1280, height: 900, dpr: 2,
waitFor: '.app',
// 已知差异:子导航多「编号规则」项、门店卡多 Logo 行。实测 1.72.3%
threshold: 0.04, // 实测 2.4% + 2pp2026-07-07 收紧,原 0.08
},
users: {
html: 'design/prototype/screens/users.html',
prefix: 'users',
width: 1280, height: 900, dpr: 2,
waitFor: '.app',
// 已知差异:角色口径拉平为后端四级(原型 KPI 初值/角色混用三级)。实测 1.3–2.1%
threshold: 0.04, // 实测 1.9% + 2pp2026-07-07 收紧,原 0.08
},
about: {
html: 'design/prototype/screens/about.html',
prefix: 'about',
width: 1280, height: 900, dpr: 2,
waitFor: '.app',
threshold: 0.05, // 实测 2.7% + 2pp2026-07-07 收紧,原 0.08
},
'stock-in': {
html: 'design/prototype/screens/stock-in-list.html',
prefix: 'stock_in_list',
width: 1280, height: 900, dpr: 2,
waitFor: '.app',
// 2026-07-03 补注册(此前漏注册导致单元格样式偏差长期未被闸住)。
// 页面留白/单元格对齐后校准:实测 a 3.6 / b 2.6 / c 3.9%
//(残差=真实数据 vs 原型演示数据 + 状态列口径/placeholder 文案已知差异)。
threshold: 0.06, // 实测 4.0% + 2pp2026-07-07 收紧,原 0.08
},
'stock-out': {
html: 'design/prototype/screens/stock-out-list.html',
prefix: 'stock_out_list',
width: 1280, height: 900, dpr: 2,
waitFor: '.app',
// 页面留白/单元格对齐后校准:实测 a 3.6 / b 2.6 / c 3.9%
threshold: 0.06, // 实测 4.0% + 2pp2026-07-07 收紧,原 0.08
},
login: {
html: 'design/prototype/screens/login.html',
prefix: 'login',
width: 1280, height: 900, dpr: 2,
waitFor: '.auth',
// 2026-07-03 重建后校准:实测 a 1.9 / b 1.4 / c 2.1%。已知差异
// design/CONTRACT.md):密码框空值 hint vs 原型 8 dots、
// 历史下拉/密码可见后缀箭头(功能位)、ds-fab 仅原型有。
threshold: 0.04, // 实测 2.4% + 2pp2026-07-07 收紧,原 0.08
},
// register:暂不入闸(2026-07-03 用户拍板)。原型多「门店编号/授权兑换券」
// 两字段,后端 RegisterInput 暂不支持 → 表单少两行,整卡结构性错位
// (实测 a 15.5 / b 6.2 / c 26%),像素闸无意义。golden 测试仍锁三主题回归;
// 后端补 shop_code/voucher 支持后恢复此注册并收紧到 ~8%:
// register: {
// html: 'design/prototype/screens/register.html',
// prefix: 'register',
// width: 1280, height: 900, dpr: 2,
// waitFor: '.auth',
// threshold: 0.08,
// },
finance: {
html: 'design/prototype/screens/finance.html',
prefix: 'finance',
width: 1280, height: 900, dpr: 2,
waitFor: '.app',
// 重建后校准:实测 a 3.9 / b 3.0 / c 4.2%(残差=柱高比例+文字度量+
// KPI 应收为实算汇总 vs 原型硬编码,见 CONTRACT 已知差异)
threshold: 0.06, // 实测 4.3% + 2pp2026-07-07 收紧,原 0.08
},
};