Files
jiu/tools/screens.mjs
T
wangjia 6238b86dcb feat(client): 登录/注册页照原型重建,ds 真相源组件族统一全部屏
- 登录/注册(login.html/register.html 1:1):两栏卡片+品牌渐变面板+主题小衣服
  pill(onSurface 变体)+记住我(记录并预填最近账号)+原型式 toast 校验;
  登录 fidelity 1.4–2.1% 三主题全绿;注册暂不入闸(少 门店编号/兑换券 字段,
  已记 CONTRACT,screens.mjs 留存根)
- ds 原子补齐:DsToast(.toast 单例)/DsCheck(.check/.agree)/DsButton lg 档/
  DsSelect 替换全部旧 DropdownButton/DsField label 在上/DsInput 后缀与密码形态
- 全屏统一:对话框按钮全 DsButton、盒式输入主题钉死(visualDensity.standard、
  h38、InputDecorationTheme 渗漏修复)、图标全 lucide、JetBrains Mono 三端同源、
  BrandMark 真相源 logo、只读模式写操作全量守卫(WriteGuard+DsToast)
- 出入库列表:版式对齐原型(卡片对齐+搜索框居中)、KPI 近30天滚动、结清后
  失效财务应收应付表;商品编辑抽屉介绍库改搜索下拉、图片双击全屏预览
- 删除旧 UI 死代码:DataTableCard/FormDialog/PageScaffold/SearchChip/
  SelectProductDialog/tabStateProvider
- golden/fidelity:stock-in/out 补注册(9%)、login 入册(8%)、goldens 全量重打;
  修复 pubspec flutter_web_plugins 非法声明(CI pub get 阻断)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JJ1g8XV1YhhmHRzhwWEW7o
2026-07-03 09:58:14 +08:00

139 lines
5.9 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 照原型重建后逐个入册。
//
// 字段:
// 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: '.superpowers/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: '.superpowers/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.08,
},
partners: {
html: '.superpowers/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.08,
},
products: {
html: '.superpowers/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.08,
},
devices: {
html: '.superpowers/prototype/screens/devices.html',
prefix: 'device_management',
width: 1280, height: 900, dpr: 2,
waitFor: '.app',
// 重建后校准:实测 2.4–3.0%(残差=会话表列宽分布+外设卡按钮文字省略)
threshold: 0.08,
},
settings: {
html: '.superpowers/prototype/screens/settings.html',
prefix: 'settings',
width: 1280, height: 900, dpr: 2,
waitFor: '.app',
// 已知差异:子导航多「编号规则」项、门店卡多 Logo 行。实测 1.72.3%
threshold: 0.08,
},
users: {
html: '.superpowers/prototype/screens/users.html',
prefix: 'users',
width: 1280, height: 900, dpr: 2,
waitFor: '.app',
// 已知差异:角色口径拉平为后端四级(原型 KPI 初值/角色混用三级)。实测 1.3–2.1%
threshold: 0.08,
},
about: {
html: '.superpowers/prototype/screens/about.html',
prefix: 'about',
width: 1280, height: 900, dpr: 2,
waitFor: '.app',
threshold: 0.08, // 实测 2.22.7%
},
'stock-in': {
html: '.superpowers/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.08,
},
'stock-out': {
html: '.superpowers/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.08,
},
login: {
html: '.superpowers/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.08,
},
// register:暂不入闸(2026-07-03 用户拍板)。原型多「门店编号/授权兑换券」
// 两字段,后端 RegisterInput 暂不支持 → 表单少两行,整卡结构性错位
// (实测 a 15.5 / b 6.2 / c 26%),像素闸无意义。golden 测试仍锁三主题回归;
// 后端补 shop_code/voucher 支持后恢复此注册并收紧到 ~8%:
// register: {
// html: '.superpowers/prototype/screens/register.html',
// prefix: 'register',
// width: 1280, height: 900, dpr: 2,
// waitFor: '.auth',
// threshold: 0.08,
// },
finance: {
html: '.superpowers/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.08,
},
};