Compare commits

..
82 Commits
Author SHA1 Message Date
qiqi 0c1c30dc20 chore(release): v3.26.60 下载站与发布记录(mac 双架构 dmg)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 46s
2026-11-24 15:35:22 +08:00
qiqi 6002c34c0f docs: 锚点对齐 v3.26.60+cf0e9a0(浮层字号上调一档) 2026-11-24 15:33:13 +08:00
qiqi cf0e9a09b9 style(popover): v3.26.60 浮层字号上调一档(模型设置/图像设置不再小字)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 46s
用户反馈两个贴节点浮层的选项文字偏小。改动集中在 .iwb-pop 的 6 个 token
(两个面板共用同一套,改一处两边同步):

- --iwb-pop-chip-size   font-xs(11) → font-md(13)
- --iwb-pop-chip-h      22px → 28px
- --iwb-pop-chip-pad-x  space-6(6) → space-10(10)
- --iwb-pop-chip-gap    space-4(4) → space-6(6)
- --iwb-pop-title-size  font-sm(12) → font-base(14)
- --iwb-pop-w           328px → 360px(抵消放大后多出来的换行)

辅助小字同步:.iwb-setlabel 11→12、.iwb-setalign/.iwb-gc-label/.iwb-gc-sub
12→13、.iwb-pop .iwb-set-num 12→13、新增 .iwb-pop .iwb-hint 10→12。

顺带修 .iwb-gen-config 宽度写死 min(92vw,320px)(绕过 token,字号放大后
不跟着变宽)→ 引用 var(--iwb-pop-w)。

契约不变:模型名仍单行不省略、超长独占一行(min-width:max-content +
面板横向滚动兜底);作用域只在 .iwb-pop,画布节点与左栏不受影响。

验证:headless Chromium 实测 面板 360 / 胶囊 28px·13px·padding10 /
标题 14 / 标签 12 / 说明 12 / 数字框 13·28·68,无文字截断、无横向滚动;
lint:tokens 0 处新增裸值;design-token-ratchet 13 项未超基线
(字号写死 159→152、圆角 95→92、间距 377→366);test:unit 全绿。
2026-11-24 15:32:55 +08:00
qiqi 83029e9bc7 chore(release): v3.26.59 下载站与发布记录(mac 双架构 dmg)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m3s
2026-11-24 15:19:19 +08:00
qiqi 2ca9512b49 docs: 锚点对齐 v3.26.59+e966b34(备份带插件文件)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m36s
2026-11-24 15:16:11 +08:00
qiqi e966b348b9 feat(backup): v3.26.59 备份带上插件文件(提示词封面不再换机丢失)
P0(宿主):
- 备份 ZIP 新增 plugin-files/<插件id>/<文件名> 通道,恢复时写回沙箱;
  此前只备份 JSON ⇒ 换机后「提示词都在、封面全是灰块」,而状态行写着「已恢复」
- IWBStorageFile.pluginFiles 增 readBytes / listAll(不 mkdir、只读字节)
- IWBPluginData 增 listFiles / readFile / restoreFiles:清单一次给出、字节逐条读写
  (插件文件单插件上限 64MB,攒数组会 OOM)
- 校验和口径统一:images / imagesData / pluginFiles / pluginFilesData 全部排除;
  JSON 兜底导出按自身内容重算 checksum,避免「换个打包形态就报校验不一致」
- 备份二次确认的体积/张数把插件文件计入;恢复摘要显示「含 N 个插件文件(封面等)」
- tests/plugin-data-test:新增插件文件清单/读字节/写回 三条行为断言

P1(插件 promptlib 1.11.0,随包同步):
- 封面保存/上传即落成文件(JSON 只留文件名)、孤儿封面可回收
  (启动后一次 + 删词条后一次 + 设置页手动入口;空集合/非插件数据来源一律不删)
- 四处内联 djb2 哈希合并为 coverFileName,同图不再存两份
- 样式散值归零(4px→6px、margin 13px→12px),插件尺度棘轮基线保持 0
2026-11-24 15:16:08 +08:00
qiqi 054db215cd feat(plugins): 同步提示词库 promptlib v1.10.1(移除封面开关 + 详情竖向分割线)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 46s
2026-11-24 14:25:17 +08:00
qiqi b34b936d2e feat(plugins): 同步提示词库 promptlib v1.10.0(文本/文件分享双路径 + 新入口布局)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m11s
2026-11-24 14:19:15 +08:00
qiqi 1ebb07d389 feat(plugins): 同步提示词库 promptlib v1.9.3(编辑区变量浅主色底色)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m3s
2026-11-24 13:36:10 +08:00
qiqi b45d6b2712 feat(plugins): 同步提示词库 promptlib v1.9.2(分享封面开关)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 45s
2026-11-24 13:25:26 +08:00
qiqi 7e99b2ba42 docs(site): v3.26.58 补 Windows x64 记录
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m7s
2026-11-24 12:46:01 +08:00
qiqi d77c70bf67 docs(site): v3.26.58
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 41s
2026-11-24 12:11:09 +08:00
qiqi 129fedc596 docs: 锚点对齐 v3.26.58+ffd342f(publish 自动) 2026-11-24 12:09:42 +08:00
qiqi ffd342fa4c release: v3.26.58 浮层紧凑规格 C1 2026-11-24 12:08:19 +08:00
qiqi fdfaf9e12f style(popover): 采用 C1 紧凑规格(328 宽 / 22px 选项 / 11px 字号),宽度改走 token 2026-11-24 12:08:19 +08:00
qiqi 1d9ef0cc99 feat(plugins): 同步便利贴 sticky v1.0.7(自定义调色后自动收起色板)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 48s
2026-11-24 11:55:08 +08:00
qiqi 18dad1b9af feat(plugins): 同步便利贴 sticky v1.0.6(文本回缩外框自动降高)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 33s
2026-11-24 11:52:28 +08:00
qiqi 53f41c2f9f docs(site): v3.26.57
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 59s
2026-11-24 11:50:16 +08:00
qiqi f7ace22121 feat(plugins): 同步便利贴 sticky v1.0.5(圆角对齐宿主节点)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 36s
2026-11-24 11:49:20 +08:00
qiqi 57b885be31 docs: 锚点对齐 v3.26.57+93871f7(publish 自动) 2026-11-24 11:48:31 +08:00
qiqi 93871f7e91 release: v3.26.57 节点浮层收口(无闪现 / 统一尺寸 / popover token) 2026-11-24 11:46:44 +08:00
qiqi 75a70654ee fix(popover): 首帧不再在左上角闪一下(定位改 useLayoutEffect + 未定位隐藏);选择项统一尺寸并加 popover token
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 34s
2026-11-24 11:46:16 +08:00
qiqi 5b5dbbd417 feat(plugins): 同步便利贴 sticky v1.0.4(rows=1 去掉预留行高)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 35s
2026-11-24 11:45:29 +08:00
qiqi f64898db96 feat(plugins): 同步便利贴 sticky v1.0.3(外框贴字+调色点右上)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 40s
2026-11-24 11:38:04 +08:00
qiqi 9c8e7745f9 feat(plugins): 同步便利贴 sticky v1.0.2(贴字自适应+色板跟随按钮)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 54s
2026-11-24 11:20:31 +08:00
qiqi 48b85cae04 chore(plugins): promptlib 1.9.1 市场同步
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 36s
2026-11-24 11:16:22 +08:00
qiqi c4305c184a feat(plugins): 同步便利贴 sticky v1.0.1(修拖动漏底/字号无上限/双击编辑)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 55s
2026-11-24 11:00:32 +08:00
qiqi e3547e549f docs(site): v3.26.56 下载页与版本记录
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 39s
2026-11-24 10:44:30 +08:00
qiqi e8905c606f docs: 锚点对齐 v3.26.56+931dbe7(publish 自动) 2026-11-24 10:42:55 +08:00
qiqi 931dbe7d5d release: v3.26.56 插件流程收口(分享/导入、收藏归位、图库目录与删除、设置页 token 化) 2026-11-24 10:40:18 +08:00
qiqi 2f8f355716 feat(plugins): 分享/导入分享、单节点收藏走提示词库、组内解组、图库打开目录与删除字节、插件设置页 token 化
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m1s
2026-11-24 10:39:25 +08:00
qiqi a378dc52ad feat(plugins): 接入便利贴 sticky v1.0.0 —— 白名单+meta+同步产物
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 37s
2026-11-24 10:37:39 +08:00
qiqi 6ba340bb65 docs: 清理过期发布/Windows 文档,统一到桌面版发布口径 2026-11-24 09:01:31 +08:00
qiqi 9cf7c17e9e docs: 记录 Windows 构建/CRLF/版本对齐教训,给历史发布文档加时效标注 2026-11-24 08:56:22 +08:00
qiqi a8c7b6092e docs(site): v3.26.55 增加 Windows x64 下载记录
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 28s
2026-11-24 08:52:27 +08:00
qiqi d504a2cfb5 docs(site): v3.26.55 下载页与版本记录
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 30s
2026-11-24 08:40:20 +08:00
qiqi 47013fb6b8 docs: 锚点对齐 v3.26.55+573f245(publish 自动) 2026-11-24 08:39:12 +08:00
qiqi 573f245460 release: v3.26.55 Windows 构建修复(CRLF token 校验) 2026-11-24 08:36:55 +08:00
qiqi f271ed014b fix(build): build.js 的 token 校验同样容忍 CRLF(与 gen-tokens 对齐)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 29s
2026-11-24 08:32:35 +08:00
qiqi f910f1c1bd fix(build): token 校验容忍 CRLF,加 .gitattributes;Windows 不再误报快照不一致
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 31s
2026-11-24 08:21:07 +08:00
qiqi bda83d5d4f docs(site): v3.26.54 下载页与版本记录
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 28s
2026-11-24 07:16:11 +08:00
qiqi 4f93dee3ef docs: 锚点对齐 v3.26.54+b6152e0(publish 自动) 2026-11-24 07:15:41 +08:00
qiqi b6152e0ac7 release: v3.26.54 设置页全量统一 + 备份/图库/插件更新修复 2026-11-24 07:11:49 +08:00
qiqi 9a94563bc4 chore(plugins): gallery 1.6.11 市场同步
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 27s
2026-11-24 07:09:27 +08:00
qiqi 8ba7811ac9 style(settings): F9F9F9 分组底色、统一复选框/按钮 token;修复还原图片范围与内层滚动
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 26s
2026-11-24 07:07:04 +08:00
qiqi c426880c8d style(settings): 新增 group-pad-y token;分组底色取 text 4% 与面板混合
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 32s
2026-11-24 07:00:13 +08:00
qiqi 4dddb09304 style(settings): 分组底色改为仅比面板灰一点;备份页并入分组
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 27s
2026-11-24 06:54:44 +08:00
qiqi 058090d60f style(settings): LLM/图片传输/尺寸/快捷键/备份/诊断改用统一分组样式
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 27s
2026-11-24 06:46:43 +08:00
qiqi 74790ffdef docs(site): v3.26.53 下载页与版本记录
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 8m56s
2026-11-23 22:25:53 +08:00
qiqi 7d1fe90c7e docs: 锚点对齐 v3.26.53+6767f04(publish 自动) 2026-11-23 22:21:56 +08:00
qiqi 6767f04df6 release: v3.26.53 设置页重构(可缩放 + Obsidian 式分组 + token 规范) 2026-11-23 22:17:22 +08:00
qiqi e6bca55983 style(settings): 统一分组块间距为 --iwb-set-group-gap(32px);去掉外观页重复标题
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m59s
2026-11-23 22:15:06 +08:00
qiqi 80366e1c70 style(settings): 移除分组标题下的说明文案,解释只留在行内提示
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m4s
2026-11-23 22:08:47 +08:00
qiqi 39cbe79ada style(settings): 模型行删除收进「⋯」菜单,描边再调淡;更新基线
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m59s
2026-11-23 22:03:49 +08:00
qiqi c0aa9c63b7 style(settings): 输入框描边改用 --iwb-set-input-border,降低框线存在感
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m25s
2026-11-23 21:52:18 +08:00
qiqi b0881bce59 style(settings): 外观与生图服务改用统一分组样式(标题在页面底 + 浅灰容器)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 3m40s
2026-11-23 21:48:08 +08:00
qiqi 2c2a4313f9 style(settings): 通用页把版本与更新移到最上方
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m1s
2026-11-23 21:41:41 +08:00
qiqi ee68c8566a style(settings): 组标题左对齐内容容器文字(padding=group-pad-x)
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 1m56s
2026-11-23 21:39:42 +08:00
qiqi f88038143e style(settings): 分组改为 Obsidian 式——标题在页面底、内容浅灰圆角容器,组内行分割线;补充分组 token
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m23s
2026-11-23 21:36:10 +08:00
qiqi 7d5ec3f5ee style(settings): 横线改为分组标题上方的二级分割线,组内行不再画线
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 3m38s
2026-11-23 21:23:51 +08:00
qiqi e5ff776c5d style(settings): 说明对齐控件列、字号/颜色走设置 token,图片与图库改为行结构
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m15s
2026-11-23 21:17:52 +08:00
qiqi 28ba14ae68 style(settings): 改为 Obsidian 式分组列表(去卡片框,行分割线),新增设置面板 token 规范
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m2s
2026-11-23 21:10:53 +08:00
qiqi 54f9acc93b fix(settings): 卡片间距改为 flex gap 20px;新增右下角缩放手柄(兼容 WKWebView)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m26s
2026-11-23 21:03:51 +08:00
qiqi 474e27f7c4 feat(settings): 窗口可缩放 + 通用页卡片化,降低说明文案层级并改用 token 间距
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m6s
2026-11-23 20:53:57 +08:00
qiqi e058b21b6e feat(settings): 生图服务改为多服务商单栏切换(chips + 单份详情),字段与保存逻辑不变
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m10s
2026-11-23 20:40:13 +08:00
qiqi 7f42860fc8 test(visual): promptlib 编辑/详情亮暗视觉基线 + 使用说明
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m0s
2026-11-23 20:22:23 +08:00
qiqi 8ef453b3b4 chore(plugins): gallery/grouplib 尺寸 token 迁移 + 插件尺度基线归零
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 56s
2026-11-23 20:15:45 +08:00
qiqi 12ed8e6cbf chore(plugins): promptlib 1.8.24 市场同步
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 41s
2026-11-23 20:13:23 +08:00
qiqi 56961d6d8a chore(plugins): promptlib 1.8.23 尺寸 token 迁移 + 基线下调
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 1m4s
2026-11-23 20:12:16 +08:00
qiqi 293c500dca chore(plugins): promptlib 1.8.22 颜色 token 迁移同步
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m51s
2026-11-23 20:06:05 +08:00
qiqi b99af53c49 feat(tokens): UI 改动约束清单 + token-audit --plugins + 插件尺度棘轮
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m7s
2026-11-23 19:59:31 +08:00
qiqi 120c85ff04 docs(facts): 架构锚点跟到 v3.26.52+3f1cab0
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m3s
2026-11-23 19:44:36 +08:00
qiqi 3f1cab0d67 chore(release): bump v3.26.52(节点正文文本区修复)
四处版本统一;CHANGELOG 记录三层 CSS 覆盖根因、表面角色三分法与 8 张视觉基线重录。本批只出本地安装包供验证,未上线。
2026-11-23 19:44:03 +08:00
qiqi ded94390ae fix(tokens): 编辑态关掉全局焦点环,节点正文彻底无框
实测聚焦时 outlineStyle 仍为 solid(D8 焦点环 2px+offset 会再画一个方框);此处焦点改由 .iwb-node-selected 表达,其余控件保留 D8 环。守卫补 outline 断言,verify:ci 与 16 张基线复跑全绿。
2026-11-23 18:51:14 +08:00
qiqi d38a359e19 fix(tokens): 节点正文文本区透明继承卡片底色,去掉编辑态控件框
field 只给节点内可交互控件;提示词/文本/插件正文透明、无边框、无聚焦光晕。规范补表面角色三分法,守卫进 node-scope-test 第 5 条,8 张画布相关视觉基线重录。
2026-11-23 18:46:10 +08:00
qiqi bf7856344b chore: Cargo.lock 版本跟到 3.26.51(构建时自动写入)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 54s
2026-11-23 18:25:44 +08:00
qiqi af9b10d1e2 test(visual): 亮色状态色调深后更新 7 张基线 + 文档校准(复核 16/16)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 43s
2026-11-23 18:23:08 +08:00
qiqi 4921fb984a docs: 架构锚点 → v3.26.51+21554b0(M6 延展验证) 2026-11-23 18:19:33 +08:00
qiqi 21554b05ae feat(tokens): M6 延展验证 —— 面板合并重写 + 三个闭集缺口回填(3.26.51)
- style.css 插件面板两段六次叠加(1819-1885 / 2194-2295)合并成一份有意图的实现;133 行新增零裸值,净减 34 行,删 3 个死类与 1 条死兜底
- 新增 --iwb-font-base: 14px(8 档):全站 10 处标准正文原本在 13→15 之间无处安放;走 gen-tokens 单一源同步 CSS/DTCG/快照
- derive() 亮色状态色调深(ok #15803d / err #b91c1c / warn #b45309,暗色不变)—— --iwb-ok 原本对浅页面仅 2.13 却一直当文字色用
- theme-contrast-test 补 3 状态色 × 4 表面 × 2 主题,114 → 138 对
- 新增 ⑦⑧ 组件夹具基线(桌面端面板在网页 e2e 不可达),夹具内禁用 transition 消除 1 级灰度随机 diff;16 张连跑两次全绿
- batch-export 1.2.2 同步(内容寻址 + SRI):状态色走宿主 token,去掉纯蓝主按钮
- 棘轮基线首次下调:字号 159 / 圆角 95 / 间距 377 / hex 79 / 圆角种数 17 / 阴影 44
- 文档:规范 §5.7 接入案例、§3.3 第 8 档、修正 §5.2 里不存在的 --iwb-dur-* 引用;计划 M6 执行结果与度量看板
2026-11-23 18:19:04 +08:00
qiqi 46008b4d8b chore: Cargo.lock 版本跟到 3.26.50(构建时自动写入,此前停在 3.26.44)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 42s
2026-11-23 17:51:44 +08:00
qiqi 746598800b docs: 架构锚点 → v3.26.50+cab473c(M5 闸门)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 43s
2026-11-23 17:49:14 +08:00
qiqi cab473c3cd feat(tokens): M5 闸门上线 —— 新增裸值拦截 + 13 项棘轮 + 114 对对比度(3.26.50)
- scripts/token-lint.js:只查 diff 新增行(默认 HEAD,--base 查已提交批次,--file 整文件)
  · 禁裸 #hex/rgba()、禁裸 px(字号/圆角/内距/间距/外边距)、禁裸 z-index(插件不得高于 --iwb-z-anchor)
  · 四类白名单:内容色 /*iwb:content*/、var() 兜底、布局尺寸不查、临时例外 /*iwb:raw-until=X*/
  · JS 两套判据:CSS 文本按 px 单位判(不误伤 { gap: 20 } 布局参数)、React 对象按 camelCase 判
- tests/design-token-ratchet-test.js + fixtures/token-baseline.json:13 项计数只降不升;var() 目标必须存在;禁自我兜底
- tests/theme-contrast-test.js:亮/暗 × 文字 × 表面 114 对,阈值取 theme-tokens.js 的 RATIO(text 7 / text2 4.5 / dim 3 / canvas 6 / onBrand 4.5)
- 三条接进 verify:ci(lint:tokens + 两个测试进 test:unit),各做一次打红验证
- 顺手堵漏:首启动「选择资料目录」弹窗是全仓唯一完全未 token 化的界面(12.5px / #fff / #2563eb),已 token 化并给每个 var() 加字面兜底;遮罩 rgba 登记为例外待 RFC
- 存量计数零变化(字号 170 / 圆角 103 / 间距 415 / z-index 31)
2026-11-23 17:47:09 +08:00
101 changed files with 4827 additions and 1607 deletions

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
* text=auto
*.css text eol=lf
*.js text eol=lf
*.json text eol=lf
*.md text eol=lf
src/design-tokens.css text eol=lf
+228
View File
@@ -2,6 +2,8 @@
本文件记录每个版本的改动,方便回溯。每个版本对应一个 git tag(如 `v3.80.3`),并已通过 GitHub Release 发布到仓库 `malongan/image-workbench-web`。
> **⚠️ 发布流程时效(2026-11-24)**:下面第 1/2 条的 `deploy:test` / `deploy` 是 2026-10 前**网页版**历史流程,桌面版已不使用。桌面版发布:`npm run verify:ci` → `bash scripts/publish-update.sh`(mac)→ 站点/版本记录;Windows 见 `docs/WIN_BUILD_SPEC.md` 与 §13.60。
> **⚠️ 版本号有两条线(2026-10-20 说明)**:
> - **`3.8x` 是历史线**(2026-09 前后,v3.77.0 ~ v3.87.65,92 个 tag)—— 保留原样**不改写**(按项目规范「历史发布条目按规则不改写」)。
> - **`3.0x` 起是现行线**(2026-10 起:v3.0.x → v3.1.x → v3.20.x → v3.21.0)。
@@ -14,6 +16,232 @@
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
## v3.26.60(2026-11-24)浮层字号上调一档(「模型设置 / 图像设置」不再小字)
> 状态:正式发布(macOS arm64 / x86_64)
- 用户反馈两个贴节点浮层里的选项文字偏小,整体放大一档:选择项 **11 → 13px**、高度 **22 → 28px**、左右内距 **6 → 10px**、间距 **4 → 6px**、面板标题 **12 → 14px**,面板宽 **328 → 360px**(抵消放大后多出来的换行)
- 辅助小字同步:分组标签(质量/尺寸/分辨率/宽高比)11 → 12、`16 倍数对齐` 与服务商/分组/模型标签 12 → 13、尺寸数字框 12 → 13、浮层内说明文字 10 → 12
- 改动全部落在 `.iwb-pop` 的 6 个 token 上(两个面板共用同一套),模型名「单行不省略、超长独占一行」的契约不变
- `.iwb-gen-config` 的宽度原来写死 `min(92vw, 320px)`(绕过 token,字号放大后不跟着变宽)→ 改为引用 `--iwb-pop-w`
- 同步 `docs/standards/design-tokens.md` §3.13 的 token 表;token 棘轮三项计数顺带下降(字号写死 159→152、圆角 95→92、间距 377→366)
## v3.26.59(2026-11-24)备份带上插件文件(提示词封面不再换机丢失)
> 状态:正式发布(macOS arm64 / x86_64)
- **P0 备份补洞**:`plugin-data/<id>/files/` 里的插件文件(提示词封面等)随 ZIP 写成 `plugin-files/<id>/<文件名>`,恢复时写回沙箱。此前只备份 JSON ⇒ 换机后「提示词都在、封面全是灰块」,而状态行还写着「已恢复」
- 新增 `IWBPluginData.listFiles / readFile / restoreFiles` 与 `IWBStorageFile.pluginFiles.readBytes / listAll`:清单一次给出、字节**逐条读**(写一张放一张,不攒数组,插件文件单插件上限 64MB)
- 校验和口径统一:图片与插件文件的**字节**不进 checksum(`images / imagesData / pluginFiles / pluginFilesData` 全排除);JSON 兜底导出按自身内容重算 checksum,避免「换个打包形态就报校验不一致」
- 备份确认弹窗的体积估算与张数把插件文件计入;恢复摘要新增「含 N 个插件文件(封面等)」
- 同步 `promptlib` 1.11.0:封面保存/上传即落成文件(数据里只留文件名)、未被引用的封面可回收(启动后自动一次 + 设置页「清理未引用封面」)
## v3.26.58(2026-11-24)节点浮层改为紧凑规格(C1)
> 状态:正式发布(macOS arm64 / x86_64)
- 面板宽 380 → **328**,内边距 16/20 → 10/12,分组间距 8
- 选项高 32 → **22px**,字号 13 → **11px**,左右内边距 12 → 6,圆角 8 → 6
- 分组标签 12 → 11px + 600 字重;数字框与选项同高
- 图像设置面板高度 496 → **约 310px**(含提示行)
- 修 `.iwb-image-settings` 硬编码 `width:380px` 覆盖 `--iwb-pop-w` 的问题,宽度只认 token
- 规范 §3.13 同步为 C1 数值
## v3.26.57(2026-11-24)节点浮层收口:去掉左上闪现、选择项统一尺寸、popover token
> 状态:正式发布(macOS arm64 / x86_64)
- 修「点开模型设置/图像设置时画布左上先闪一下」:定位从 `useEffect` 改 `useLayoutEffect`,未定位前 `visibility:hidden`(首帧默认坐标 (40,40) 是闪现根因)
- 选择项统一:`.iwb-chip-line` 与 `.iwb-gc-item` 共用 32px 高、8px 圆角、13px 字号、12px 左右内边距;下拉框同高
- 新增 popover token(§3.13):`--iwb-pop-w/pad/gap/radius/title-size/chip-h/chip-pad-x/chip-radius/chip-gap/chip-size`
- 面板内边距 16/18 → 16/20、分组间距统一 8px,两套浮层观感一致
## v3.26.56(2026-11-24)插件流程收口:分享/导入、收藏归位、图库目录与删除、插件设置页 token 化
> 状态:正式发布(macOS arm64 / x86_64)
- promptlib 1.9.0:单条提示词「分享」与「导入分享…」(文本带 IWB-PROMPT-SHARE 头,可直接粘到聊天软件;设置页也提供导入入口)
- 单节点气泡的星标改为**添加到提示词库**(旧实现把它存成了节点组,与现在的 promptlib 流程不符)
- 组内单节点气泡新增「解组」(此前只能先框选再解组)
- gallery 1.6.12:面板底部新增文件夹图标(在设置左边)打开本地图库目录;删除图片时把磁盘字节一并移进 trash/(此前只删索引,images/gallery 里仍留文件)
- 插件管理新增「全部更新」(检查后一键更新可更新插件)
- 插件设置页按设置面板 token 重排(GSetGroup + 行网格),插件自定义块不再画卡片套卡片
## v3.26.55(2026-11-24)Windows 构建解锁:token 校验容忍 CRLF
> 状态:正式发布(macOS arm64 / x86_64;Windows 同版本)
- 3.26.54 在 Windows 上 `app:build` 失败:`build.js` 的 token 快照比较对 CRLF 严格不等
- `scripts/build.js` 与 `scripts/gen-tokens.js` 均先归一 `\r\n`,再比较 token 快照
- 新增 `.gitattributes`(`*.css/*.js/*.json/*.md eol=lf`),降低跨平台检出差异
- 无 UI / 功能变化,纯构建修复
## v3.26.54(2026-11-24)设置页全量统一 + 图库稳定性修复
> 状态:正式发布(macOS arm64 / x86_64)
- 设置页全部页面统一为 Obsidian 式分组:通用 / 外观 / 生图服务 / LLM 服务 / 图片传输 / 尺寸预设 / 快捷键 / 备份与还原 / 诊断
- 分组底色取设计值 `#F9F9F9`(暗色等价混色),新增 `--iwb-set-group-pad-y`、`--iwb-set-check-size`、`--iwb-set-btn-gap` 等控件 token
- 分组标题不再附带说明文案;分组块间距统一 32px
- 备份与还原:内嵌组件融入分组、去掉内层滚动;还原时只写回与所选项目相关的图片,避免孤儿图库字节
- 插件管理新增「全部更新」:检查后一键更新全部可更新插件,完成后提示重启
- 图库插件 1.6.11:修复面板显隐/宽度变化后不刷新(重排实时量宽 + 缩略图 eager + 超时放宽)
## v3.26.53(2026-11-23)设置页重构:可缩放 + Obsidian 式分组 + 统一 token
> 状态:正式发布(macOS arm64 / x86_64)
设置窗口与主要页面按 Obsidian 的设置页重排,并沉淀为设置面板 token 规范(§3.11)。
- 设置窗口支持右下角拖拽缩放(自定义手柄,兼容 WKWebView),最小 760×480
- 通用页:卡片改为「二级标题在页面底 + 内容浅灰圆角容器」,版本与更新置顶
- 外观页:全部设置项按同一分组重排,去掉顶部重复的「外观」标题
- 生图服务:多服务商 chips 保留;详情拆为 服务 / 服务器地址 / 接口路径 / API Key / 请求分类 / 模型 / 分层模型
- 分组标题下不再放说明文案;解释只保留行内提示或「更多说明」折叠
- 分组块间距统一为 `--iwb-set-group-gap` = 32px,禁止各页自写 gap/padding
- 输入框描边新增 `--iwb-set-input-border`(40% 边框 + 面板色),比常规更淡
- 模型行删除收进「⋯」更多菜单,避免误触;内置模型提示不可删除
- 新增视觉基线 ⑪ 生图服务、⑫ 通用(亮/暗)
## v3.26.52(2026-11-23)节点正文不再套白卡片:M6 后第一个真实观感回归
> **状态:待发布**(`verify:ci` 全绿;视觉基线 8 张重录、16/16 复跑全绿;本批只出 macOS 本地安装包供安装验证,未上线)
用户截图反馈:提示词 / 文本节点卡片是灰色,正文却是一块白色矩形;进入编辑态还多一圈方框。
根因不是配色数值,是**三层 CSS 覆盖**叠出来的:
| # | 谁盖了谁 | 现象 |
|---|---|---|
| ① | `.iwb-node .iwb-textarea { background: var(--iwb-field) }`(0,2,0) 压过 `.iwb-textarea-plain`(0,1,0) 的 `transparent` | 亮色 `--iwb-field = #ffffff`,灰色卡片(`#efefef`)里套出一张白卡片;设了 `data-bg` 自定义底色的节点另有规则才恰好正常,所以现象时有时无 |
| ② | `.iwb-textarea-plain:focus` 写在 `.iwb-textarea:focus` **之前**且同权重 | 编辑时 `box-shadow: 0 0 0 2px` 光晕复活,成了「方框」 |
| ③ | 文件末尾 D8 `:focus-visible` 全局焦点环 | 真聚焦实测 `outlineStyle` 仍是 `solid`,去掉 border / shadow 后仍剩一圈 2px 矩形环 |
**修法**:控件面规则收窄为 `.iwb-textarea:not(.iwb-textarea-plain)`(只给节点内**可交互控件**);
新增 `.iwb-node .iwb-textarea-plain` —— `background: transparent` / `border: 0` / `padding: 0` /
`box-shadow: none` / `outline: none`,聚焦态再压一次且写在基础 focus 规则**之后**。
保留 `.iwb-node-selected` 节点选中框作为编辑状态的唯一反馈;其余控件的 D8 键盘焦点环不动。
**规范结论**(`docs/standards/design-tokens.md` §1.9 / §1.13 / §3.1):`--iwb-field` 是
「节点内可交互控件面」,不是「节点内一切面」。表面角色三分法=面板控件 `layer` / 节点控件 `field` /
节点正文 `transparent`(**刻意不建 token**,因为值随 `data-bg` 自定义底色变化,固定色会穿帮)。
判据分两步:先问是不是可交互控件,再问贴在哪张卡片上。
**守卫**:`tests/node-scope-test.js` 第 5 条 —— 正文必须 `transparent`、禁 `field / layer / panel`、
禁 border / box-shadow / outline、聚焦规则须在基本 focus 之后、`:not()` 必须存在;每条都做过反向验证。
**验证**:差异图红色像素只落在两个节点正文矩形内(纯颜色替换,无布局位移、无文字重排);
像素采样亮色 `(255,255,255) → (239,239,239)`、暗色 `(73,73,73) → (61,61,61)`;
编辑态计算样式 `background=transparent / borderWidth=0px / boxShadow=none / outlineStyle=none`。
视觉基线 **8 张重录**(② 画布 / ④ 图库抽屉 / ⑤ 提示词库面板 / ⑥ 右键菜单 × 亮暗,背景是同一张画布),
其余 8 张 0 diff;更新后 16/16 连跑全绿,`verify:ci` / `lint:tokens` / `tokens:check` 全绿。
## v3.26.51(2026-11-23)M6 延展验证:照着规范写一遍,撞出来的才是真问题
> **状态:待发布**(`verify:ci` 全绿;亮色状态色调深使 **7 张亮色基线更新**(每张 200–400 像素的局部状态色,无布局变化),复核 **16/16** 连跑两次全绿;本批只出本地安装包与源码提交,未上线)
M5 装完闸门,M6 的任务不是再迁移一批数字,而是**证明这套东西真的能照着写**。
选了插件管理面板(设置行 / 列表 / 开关 / 工具条 / 筛选胶囊 / 卡片墙,覆盖面够)和
`batch-export` 插件各写一遍。顺的地方不用记,**卡住的三处才是需要修的地方**——
都回去改了 token 和守卫,没有在文档里糊过去。
**① 面板合并重写(133 行新增,0 处裸值)**
这段样式原本是 v3.26.24 → v3.26.27 六次叠加:`.iwb-mk-list` 的 `gap` 写过 3 次、
`.iwb-mk-grid` 3 次、主按钮背景 4 次、`.iwb-set-page` 的 `max-width` 一改一撤,
最终值散在 `style.css` 两处相隔 300 行的位置。按当前生效值**重写成一份**,
删掉 3 个零引用类和 1 条永不生效的 `var(--iwb-ok, #1d9e75)` 死兜底。
`style.css` 净减 34 行,`lint:tokens` 对全部新增行放行。
> **亮色 7 张基线变了,不是噪声**:`--iwb-ok/err/warn` 调深后,画布状态标签、
> 插件「未加载」标签、市场「已安装」徽标等局部色块变化(每张 200–400 像素,占比 0.01),
> 暗色一张没动(暗色状态色本来就没改)。逐张看过 diff,无位移、无裁切。
**② 撞出来的三个缺口**
- **闭集缺 14px**:表单行标题、命令输入、帮助正文全站 10 处,13→15 跨 2px 无处安放。
补 `--iwb-font-base: 14px`(7→8 档),走 `gen-tokens.js` 单一源同步 CSS / DTCG / 快照。
- **状态色不能当文字色**:`--iwb-ok` 亮色 `#22c55e` 对浅页面对比只有 **2.13**,
而 `.iwb-status-ok` / `.iwb-ratio.ok` 一直直接拿它当文字色 —— M5 的 114 对守卫只查
text/text2/dim/brandText,把这类漏了。`derive()` 亮色状态色调深
(ok `#15803d` / err `#b91c1c` / warn `#b45309`,暗色不变),守卫补 24 对 → **138 对**。
- **最乱的面板没有截图保护**:`DesktopPluginsTab` 只在 `isDesk()` 时渲染,网页 e2e 走另一条分支。
新增 ⑦⑧ 组件夹具基线(同类名 + 真实 `dist/style.css` + 构造 DOM),亮暗共 **16 张**。
夹具里必须 `transition:none` —— 开关 `.15s` 收尾会让两次截图差 7 个像素 × 1 级灰度,
`threshold: 0` 就会随机红。
**③ `batch-export` 1.2.2(插件仓)**
文件级豁免那一半在 B6 已清零,本批做另一半:状态色改走宿主语义 token(保留私有值兜底,
脱离宿主不退化);去掉与「全灰阶、无蓝」冲突的纯蓝主按钮,改成 `text`/`layer` 成对反相;
热按钮从「实心绿 + 白字」改成绿描边 + 绿字 + 14% 绿底。实测亮色主按钮对比 **9.51**、暗色 **14.10**;
状态色对页面亮 5.38/6.95、暗 10.01/7.03。
**④ 存量真的降了(棘轮装好后第一次)**
字号写死 170→159、圆角 103→95、间距 415→377、hex 84→79、圆角种数 18→17、阴影 45→44,
已写回 `tests/fixtures/token-baseline.json`。闸门管增量、真实改版清存量,分工成立。
**文档**:规范新增 §5.7 接入案例(两份实现的决策表 + 三个缺口 + 照抄清单);
顺手修掉 §5.2 里「动效用 `--iwb-dur-*`」这条会让人踩空的说明 —— 该 token 根本不存在,
现改为明确标注「动效尚未 token 化」这个已知缺口。
**M1–M6 全部完成**。本批未上线:插件 `[email protected]` 与客户端 v3.26.51 的发布动作留待确认。
## v3.26.50(2026-11-23)M5 闸门:让「下次又散掉」变得不可能
> **状态:待发布**(`verify:ci` 全绿含新闸门;零观感,视觉基线应 12/12 不变)
M4 把 token 铺完了,但那时**没有任何东西阻止下一个人再写 `padding: 13px`**。
这一批只做一件事:把「token 化」从**约定**变成**构建会红**。
**三道闸门,各自打过红一次才算数**
| 闸门 | 做什么 | 反向验证(注入 → 结果) |
|---|---|---|
| `npm run lint:tokens` | 只看 diff **新增行**:裸 `#hex`/`rgba()`、裸 `px`(字号/圆角/内距/间距/外边距)、裸 `z-index` | 8 行探针文件 → 6 处全部点名,含「例外已过期 raw-until=3.26.10」 |
| `tests/design-token-ratchet-test.js` | 13 项计数**只降不升**(基线 `tests/fixtures/token-baseline.json`) | `style.css` 追加一条 `font-size: 13px` → `170 → 171(+1)` 立刻红 |
| `tests/theme-contrast-test.js` | 亮/暗 × 文字 × 表面 **114 对**,阈值取 `RATIO` | 把 `clampAgainst` 短路成 `return fg` → 100+ 对跌破阈值 |
**为什么只查新增行**:存量还有 170 处写死字号、415 处写死间距。要求一次清零只会逼人加白名单,
而白名单比债务更难发现 —— B6 刚把 `ALLOW_FILES` 拆掉,不能隔一批又造一张。
分工是:闸门管增量(立刻生效),棘轮管存量(只降不升),视觉基线管观感(改了必须看得见)。
**四条白名单**(缺一条都会逼人绕路)
- 内容色 `/*iwb:content*/`:画布内容不是主题表面色,同一个 `#fff` 在按钮上是 bug、在图片上是内容
- 变量兜底 `var(--x, 8px)`:兜底值不生效时 var 本身就会红
- 布局尺寸:`width/height/top/left` 没有闭集,强行 token 化只会发明只用一次的名字
- 临时例外 `/*iwb:raw-until=3.28.0*/`:**必须带到期版本**,到期后闸门直接失败
**一个被证伪的直觉**:本想用「调坏 mix 权重」验证对比度守卫,改完仍全绿 —— 因为 `clampAgainst`
会重新夹回阈值。这反过来证明夹紧有效,也说明守卫真正防的是「有人删掉夹紧 / 把 token 写死成常数」,
于是按这个失效模式重做了注入。
**口径不重复实现**:棘轮不自己写正则,直接跑 `token-audit.js --json`。两套口径一旦漂移,
就会出现「守卫绿、审计红」这种最难查的分歧。
**④ 顺带堵住最后一个口子:JS 内联样式**
写完闸门回头验证时发现,B6 说的「`style.css` 里半像素一个不剩」是**真的**,但 `src/*.js` 里
还留着一处 `font-size:12.5px` —— 就在**首次启动「选择资料目录」弹窗**里。那个弹窗是纯手写
`cssText` + `innerHTML`,白底 `#fff`/字色 `#111`/主按钮 `#2563eb`,**亮暗主题都不跟**,
深色模式下会跳出一个刺眼的白盒子。
于是闸门扩到 JS,判据分两种(否则会误伤布局参数):
- **CSS 文本**(`cssText` / `innerHTML` 里的 `style="…"`):必须带 `px` 单位或 `#`/`rgb` 才判,
所以 `CanvasGeometry.snapToFreeSpot({ gap: 20 })` 这种**画布布局参数**不会被误报;
- **React 内联对象**:只认无歧义的 camelCase(`fontSize` / `marginLeft` / `zIndex`…),
`gap`、`padding` 在 JS 对象里可能是任何东西,不查。
弹窗本身也 token 化了:表面/文字/圆角/间距/主按钮全部走 token,每个 `var()` 都带字面兜底
(这个弹窗在主题 CSS 生效前就要显示,token 缺席时必须退化成旧样子,而不是透明盒子)。
**遮罩色是唯一没法 token 化的**——全仓 3 处 rgba 遮罩(`.iwb-modal-mask` / `.iwb-command-mask` /
这里),既不是 `bg` 也不是 `panel`,硬凑会让亮色主题出现「浅色遮罩」。留给 RFC 决定
`--iwb-scrim` 的取值,在此之前用 `/*iwb:raw-until=3.28.0*/` 登记——这条也是例外机制的真实样本。
**存量一个没动**:`style.css` 的字号 170 / 圆角 103 / 间距 415 / z-index 31 与 B6 完全一致。
本批唯一可见变化是那个首启动弹窗:深色下不再是白盒子,主按钮从蓝色 `#2563eb` 变成品牌灰
`--iwb-brand`(与全站主按钮一致)。
## v3.26.49(2026-11-23)M4-B6 收尾:插件契约从「赦免文件」改成「声明皮肤」
> **状态:✅ 已发布**(2026-11-23)macOS 双架构 dmg + 签名更新产物 + `latest.json` 更新源已上线;
+11 -13
View File
@@ -1,4 +1,4 @@
# 贡献指南(image-workbench-web)
# 贡献指南(image-workbench-desktop)
> 面向**任何要改这个仓库的人**(包括未来的自己)。本文件只汇总**已存在**的规则与命令,
> 不发明新规矩 —— 规则的**权威来源**是 [`docs/standards/`](docs/standards/),本文件是入口。
@@ -7,8 +7,7 @@
## 1. 这是什么项目
**浏览器里的节点式生图画布**(纯前端,零后端)。数据存在浏览器本地(localStorage + IndexedDB),
生图直连 OpenAI 兼容 API,部署在 Cloudflare Pages。
**Tauri v2 桌面节点式生图画布**(macOS / Windows)。桌面端数据在资料目录,生图直连 OpenAI 兼容 API;Web 预览走浏览器存储。
- 使用说明与功能: [`README.md`](README.md)
- 发布流程: [`PUBLISHING.md`](PUBLISHING.md)
@@ -22,7 +21,7 @@
|---|---|
| Node | **22**(CI 用 22,本地同版本最省事) |
| 安装 | `npm ci` |
| 运行时依赖 | 桌面版有 3 个 Tauri 插件(`@tauri-apps/plugin-dialog` / `-fs` / `-http`);Web 版仍无运行时依赖 |
| 运行时依赖 | 桌面版有 3 个 Tauri 插件(`@tauri-apps/plugin-dialog` / `-fs` / `-http`);Web 预览无运行时依赖 |
| 浏览器测试 | Playwright Chromium:`npx playwright install --with-deps chromium` |
---
@@ -41,7 +40,7 @@ build esbuild 打包到 dist/(单 dist/app.js = src/ 模块按序
node --check app.js 与 dist/app.js 语法
check-dist.js 产物体检
lint ESLint(src/ + app.js,正确性规则)
test:unit 121 个单测文件(jsdom 契约测试;2026-11-07 新增 sync-facts-guard(事实一致性)/ _helpers/source(统一源文本);2026-11-12 新增 provider-ping(测速 no-cors 兜底))
test:unit 124 个单测文件(jsdom 契约测试;2026-11-07 新增 sync-facts-guard(事实一致性)/ _helpers/source(统一源文本);2026-11-12 新增 provider-ping(测速 no-cors 兜底))
test relay-task-graph-fixture + iwb-v32-web-test
test:facts 事实基线守门(见 §5)
typecheck 渐进类型检查(tsc --noEmit;范围 = src/*.js,不含 app.js)
@@ -188,16 +187,15 @@ release: vX.Y.Z 发版
## 9. 发布
**手动发布**,CI 只验证不部署。详见 [`PUBLISHING.md`](PUBLISHING.md)。要点:
**手动发布**,CI 只验证不部署。桌面版不再使用 `deploy` / `deploy:test`(Cloudflare Pages 已移除)。
1. bump `package.json` 版本并**提交**(锚点由随后的 `publish-update.sh` 自动写并提交;bump 未提交时脚本会 WARN 跳过)
2. `npm run verify`(含全量 e2e)
3. 提交 + 推送 + 打标签(`vX.Y.Z` / `stable-vX.Y.Z` / `stable` / `stable-verified-<日期>`)
4. `npm run deploy:test` → 测试站实测 → `npm run deploy` → 正式站
5. **`IWB_VERIFY_STRICT=1 node scripts/verify-release.js`** 核验(三地址一致 + **线上代码可从远端恢复**)
1. bump 版本:`node scripts/set-version.js X.Y.Z`,更新 CHANGELOG 后提交
2. `npm run verify:ci`
3. mac:`bash scripts/publish-update.sh`(构建双架构、签名、上传、生成 latest.json)
4. Windows:按 [`docs/WIN_BUILD_SPEC.md`](docs/WIN_BUILD_SPEC.md) 出 exe → NAS `_inbox/` → mac `publish-windows-update.sh` → 再跑一次 `publish-update.sh` 合并 latest.json
5. 登记 `site/releases.json`、生成站点、上传 NAS,打 tag `vX.Y.Z` 并 push
> ⚠️ 推 `main` 需要 `RELEASE=1 git push origin main`(本地 pre-push 钩子拦误推)。
> ⚠️ **`npm run deploy` 不含 git push** —— 部署了没推送的代码 ⇒ 本机故障即丢失线上代码。
> 版本只认 `package.json`;平台必须同批。详细规则见 [`PUBLISHING.md`](PUBLISHING.md) 与工程规则 §13.60。
---
+23 -93
View File
@@ -1,105 +1,35 @@
# 📦 发布规则(每次 push 前必查)
# 发布规则(桌面版)
> ⚠️ **时效说明(2026-10-15 复核)**:本文档为发布流程说明;**其中「稳定标签」一段已就地更正**(见文末)。当前事实以 [`docs/standards/architecture-current-state.md`](docs/standards/architecture-current-state.md) 与规范 §10/§12/§13.6 为准。
> 复核确认的现行约束:发布**一律手动** `npm run deploy` / `npm run deploy:test`(**内含全量 `verify`,不得绕过**);本机**没有 wrangler OAuth 登录态**(`~/.config/.wrangler/config/` 为空,2026-10-31 复核),部署一律走 **API Token**(见「部署凭据」);三地址 `version.json` 必须一致;「部署成功」≠ 验收,须在**真实 URL** 跑关键 e2e。
> 2026-11-24 重写:本项目已是 Tauri 桌面客户端,**不再部署 Cloudflare Pages**,`deploy` / `deploy:test` 已移除。
> 历史网页版发布流程见 [`docs/archive/history/PUBLISHING-legacy-web.md`](docs/archive/history/PUBLISHING-legacy-web.md)。
## 红线(禁止入仓库)
1. **`data/` 目录永不入库** —— 含 API Key 配置、生成图片和运行数据。
2. **任何真实密钥/Token 不进任何文件** —— 代码只允许引用环境变量名或用户运行时输入。
3. **不推日志、临时文件**(`*.log`、`.DS_Store`、`node_modules`、`dist`、`test-results`)。
## 红线
## 隐私检查
```bash
grep -rn "sk-[A-Za-z0-9]\{20,\}" --include="*.js" --include="*.json" --include="*.md" . | grep -v "^./data/"
grep -rn "/Users/\|/home/" --include="*.js" --include="*.json" --include="*.md" . | grep -v "^./data/"
git grep -n "sk-" $(git rev-list --all)
```
1. `data/` 永不入库(含 Key、图片与运行数据)
2. 真实密钥/Token 不进任何文件
3. 不推日志、临时文件、`node_modules`、`dist`、`test-results`
## 标准发布流程
1. 在 `package.json` 递增 SemVer 版本;构建会自动生成 `v<package-version>+<7位Git SHA>`,并用 esbuild 压缩打包成单个 `dist/app.js`(`src/` 模块按序拼接进 `app.js`,`dist/` 无 `src/`)。
> ⚠️ **bump 版本后必须同步「事实基线锚点」**(否则 `npm run test:facts` 会打红):
> 把 `docs/standards/architecture-current-state.md` 第 4 行的 `基线 main = <SHA>` 改成**本次 bump 版本的提交**的 SHA、
> `(线上 v<版本>+<SHA>)` 改成同一 SHA 与新版本号。守门第 7 组会校验这两项(规则见规则库 §13.36)。
> 该提交前 SHA 可用:`git log --format=%h -- package.json` 里逐个回看、比对版本值与父提交是否相同(**不要**用 `git log -S '"version"'`,它会命中无关的旧提交)。
2. 执行完整验证:
```bash
npm ci
npm run verify
```
3. 检查 `dist/version.json`、`git diff --check` 和敏感信息扫描。`npm run verify` 已含 `node --check dist/app.js` 与 `node scripts/check-dist.js`(产物体检);`verify-release.js` 读 `/version.json`(不再抓 `app.js` 的 `APP_VERSION`,压缩会破坏该正则)。
4. 提交并推送 + 打四类标签:
```bash
git add -A
git commit -m "release: vX.Y.Z"
git push origin main
git tag -a vX.Y.Z -m "vX.Y.Z"
git tag -a stable-vX.Y.Z -m "stable release vX.Y.Z"
git tag -f stable HEAD && git push -f origin stable
git tag -a stable-verified-$(date +%F) -m "stable-verified $(date +%F)"
git push origin vX.Y.Z stable-vX.Y.Z stable-verified-$(date +%F)
gh release create vX.Y.Z --notes-file <notes.md>
```
> ⚠️ **推 main 需确认口令**(免费版私有仓库无 GitHub 分支保护,靠本地 pre-push 钩子拦误推):
> `RELEASE=1 git push origin main`。
> **部署前必须确认 `git rev-parse HEAD` 已在 `origin/main` 中** —— 否则会部署一份**只存在于本机**的代码(见下方第 6 步)。
5. 部署:**本仓库采用手动发布** —— `npm run deploy`(正式)/ `npm run deploy:test`(测试站)。CI(`.github/workflows/verify.yml`)只做 `verify` 门禁、**不自动部署**。
> ⚠️ `npm run deploy` = `verify` + `wrangler pages deploy`,**不含 git push**。推送与部署是两步,顺序上先推后部署。
6. 发布后验证(**三地址版本必须一致 + 线上代码必须可从远端恢复**):
```bash
IWB_VERIFY_STRICT=1 node scripts/verify-release.js # 三地址 version 一致 + 线上 commit 是 origin/main 的祖先
curl -fsSL https://iwb.maqiart.eu.org/version.json
```
> **为什么必须用严格模式**(2026-10-20 实测事故):当天线上跑的是 `f414fd8`,而 `origin/main` 仍是 `7a48e4b` ——
> 那 4 个 commit **不在任何远端 ref 上**。根因是 `npm run deploy` 不含 push,而本流程把 push 写在第 4 步 ——
> **顺序没错,但没有校验「push 的 commit == 部署的 commit」是否真的成立**,于是部署了没推送的代码。
> 后果:本机故障 / 误 reset ⇒ 线上正在跑的代码**永久丢失**,回滚只能退到 `stable`。
> 严格模式把「事后才发现」变成「当场拦截」:线上 commit 必须是 `origin/main` 的祖先,否则报错退出码 1。
> (不会误报 docs-only 提交:那种情况下线上 commit 是上一个**代码**提交,它仍在 `origin/main` 的历史里。)
> 紧急修复必须先部署后 push 时,**push 必须在同一操作序列内立即完成**,并事后补跑严格模式核验。
## 部署凭据(2026-10-28 实测补全,2026-10-31 订正)
**本机没有 wrangler OAuth 登录态**(`~/.config/.wrangler/config/` 为空),
此前文档写的「OAuth 会过期」已不适用 —— 部署**一律走 API Token 模式**:
## macOS 发布
```bash
export CLOUDFLARE_API_TOKEN=$(security find-generic-password -a qiqi -s CLOUDFLARE_PAGES_TOKEN -w)
# account id:见下方说明,二选一
export CLOUDFLARE_ACCOUNT_ID="<32 位 hex>"
npm run deploy:test # 测试站;正式站用 npm run deploy
npm run verify:ci
node scripts/set-version.js X.Y.Z
# 更新 CHANGELOG 后提交(publish 脚本会按 package.json 版本构建)
bash scripts/publish-update.sh
# 登记 site/releases.json、gen-site/gen-release-page、上传 NAS、打 tag/push
```
> ⚠️ **`npx` 必须带 `--yes`(2026-10-31 事故)**:`wrangler` 不在 devDependencies 里,
> `npx wrangler` 依赖 npx 缓存;一旦 npm 上 `wrangler@latest` 超过缓存版本(如 4.114.0 → 4.156.0),
> npx 会问「Need to install [email protected]? (y)」,**在 TTY(有人值守的终端)里会一直等输入**,
> 表现为「`verify` 跑完了但部署卡住不动」。非 TTY 环境(多数 agent / CI)不提示、直接装,
> 所以这个坑只在交互式终端复现。`package.json` 的 `deploy` / `deploy:test` 与
> `scripts/plugins-publish.sh` 均已固定 `npx --yes wrangler`,**新增脚本请照抄**。
## Windows 发布
**account id 从哪来**(它**不是密钥**,是账号标识):
1. Windows 端按 [`docs/WIN_BUILD_SPEC.md`](docs/WIN_BUILD_SPEC.md) 构建 `*-setup.exe`,放 NAS `_inbox/`
2. mac 端签名:`bash scripts/publish-windows-update.sh <setup.exe>`
3. **再跑一次** `bash scripts/publish-update.sh`,把 `windows-x86_64` 合并进 `latest.json`
4. 下载页登记 Windows 条目并核验
- 钥匙串和 `secrets list` 里**只有 token,没有 account id**;
- `wrangler.toml` 里那个 32 位 hex 是 **KV namespace id**,不是 account id;
- API `GET /client/v4/accounts` 对 Pages 作用域的 token 返回**空列表**(不等于 token 无效);
- ✅ **可靠来源:git 历史里旧的 `wrangler.toml`**:
## 版本/tag 纪律
```bash
git log --all --format=%H -S "account_id" -- wrangler.toml | tail -1 # 最早含它的提交
git show <commit>:wrangler.toml | grep account_id # 读出 32 位 hex
```
- 版本只认 `package.json`(`set-version` 同步 tauri.conf/Cargo.toml)
- 平台同批:Windows 未跟上时不要往 `latest.json` 塞旧包
- 发布后核验:`latest.json` 三平台、`latest-windows.json` 同版本、下载页 exe 200 且字节一致
> 本次实测:account id 为 `47d69874…`(32 位 hex)。**建议把它存进钥匙串**:
> `security add-generic-password -a qiqi -s CLOUDFLARE_ACCOUNT_ID -w '<id>'`
> —— 这样以后不用每次翻 git 历史。
**验证 token 可用(只读,不部署)**:
```bash
npx wrangler pages deployment list --project-name image-workbench-web
```
能列出部署记录 = token + account id 都正确。
## 回滚
> **权威还原步骤见 [`docs/RELEASES.md`](docs/RELEASES.md)**(含当前线上状态、各版本 tag→commit 对照、三种还原场景)。本节只作流程要点。
**稳定标签(2026-10-15 更正)**:现行体系为 `vX.Y.Z`(GitHub Release)+ `stable-vX.Y.Z` + **移动可变 `stable`**(2026-10-15 指向 `682554d`)+ `stable-verified-YYYY-MM-DD`(验证留痕)。语义以规范 §10 与 [`docs/standards/architecture-current-state.md`](docs/standards/architecture-current-state.md) 为准;历史锚点示例:`stable-v3.1.0-stability3`、`stable-v3.3.0` 等。出现问题时可回滚到对应标签重新构建并发布,不覆盖历史。
现行工程规则见 [`docs/standards/engineering-rulebook.md`](docs/standards/engineering-rulebook.md) §13.60。
+4 -4
View File
@@ -2,9 +2,9 @@
基于 **OpenAI 兼容生图 API** 的节点式图形化生图工作台。**Tauri v2 桌面客户端**(macOS / Windows),数据全部落在本机资料目录。
- **零后端**:数据保存在浏览器(localStorage + IndexedDB),图片生成直连兼容 API;Tuzi 生图固定使用 generations、要求 URL 响应,参考图允许公网 URL 与本地 Base64,且不自动重试
- **零后端、本地优先**:桌面端数据在资料目录(data.json + canvases/library/images),Web 预览才用浏览器存储;图片生成直连兼容 API;Tuzi 生图固定使用 generations、要求 URL 响应,参考图允许公网 URL 与本地 Base64,且不自动重试
- 与独立版功能一致:无限画布、节点连线、文生图/图生图、参数设置(比例/分辨率对齐接口)、提示词库、节点组收藏、图库、右键菜单、双击聚焦/适应视图、标注节点等
- 唯一区别:**数据在本浏览器**,换设备不跟随 → 左侧栏底部提供「备份 / 恢复」导出全部数据 JSON
- 换设备不跟随:桌面端数据在资料目录,可用「设置 → 备份与还原」导出/导入整库(Web 预览仍用浏览器存储)
- 架构边界:配置、提示词、节点组、工作台和图库索引统一经过浏览器存储契约;**大图新写入主通道为 IndexedDB Blob(`{__blob}` / key `imgblob_*`),Cache Storage(`{__cache}`)为兜底**,localStorage 只保存轻量索引(不放大 base64)。现状细节见 [`docs/standards/architecture-current-state.md`](docs/standards/architecture-current-state.md)。
- 生图流程采用任务构建、Job 调度、请求归一化、结果归档和运行结束清理分层,生成中的结果会实时写回输出节点;运行记录按 Job 保存 queued/running/succeeded/failed/cancelled 状态,刷新只提示未完成任务。
- 稳定性边界:保存失败会保留恢复快照并支持重试,离页前执行本地兜底;启动时检查 localStorage/IndexedDB 可用性并显示异常。
@@ -38,10 +38,10 @@ npx tauri build # 桌面安装包(macOS: .app + dmg / Windows: nsis)
| 平台 | 命令 | 产物 |
| --- | --- | --- |
| macOS | `./scripts/publish-update.sh <版本>` | `updates/latest.json` + 双架构 dmg / app.tar.gz |
| macOS | `bash scripts/publish-update.sh`(版本取自 package.json) | `updates/latest.json` + 双架构 dmg / app.tar.gz |
| Windows | `./scripts/publish-windows-update.sh <setup.exe>` | `updates/latest-windows.json`(平台独立) |
两个平台的更新清单**完全解耦**:mac 发版不影响 Windows 版本号,反之亦然。
Windows 签名后需在 mac 再跑一次 `publish-update.sh`,把 `windows-x86_64` 合并进 `latest.json`;未同批时 Windows 用户停留在旧版。
CI:`.github/workflows/verify.yml` 在推送 `main` 与向 `main` 开 PR 时执行 `npm run verify:ci`。
+15 -11
View File
@@ -2058,6 +2058,7 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
}
return added
}
const wDelGalleryBytes /* 图库删图一并清理磁盘字节(只删索引会留下文件) */ = (names) => { const F = (typeof window !== 'undefined') ? window.IWBStorageFile : null; try { if (F && F.deleteGalleryBytesFor) F.deleteGalleryBytesFor(names, lsGet(OUT_KEY, [])).catch(() => {}) } catch (e) { /* ignore */ } }
async function wActionOutputs(args) {
const action = args && args.action
if (ModularOutputStore && action === 'clear') {
@@ -2067,14 +2068,14 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
}
if (ModularOutputStore && action === 'delete') {
const names = Array.isArray(args.names) ? args.names : []
await wPruneOutputIdb(names) // 缩略图 + 原图一并移除
await wPruneOutputIdb(names); await wDelGalleryBytes(names) // 缩略图 + 原图 + 磁盘字节
const modular = await ModularOutputStore.remove(names)
if (modular && modular.ok) return { ok: true, removed: modular.meta && modular.meta.removed !== undefined ? modular.meta.removed : names.length }
}
if (action === 'clear') { await wClearOutputIdb(); lsSet(OUT_KEY, []); return { ok: true } }
if (action === 'delete') {
const names = Array.isArray(args.names) ? args.names : []
await wPruneOutputIdb(names)
await wPruneOutputIdb(names); await wDelGalleryBytes(names)
const idx = lsGet(OUT_KEY, [])
lsSet(OUT_KEY, idx.filter((f) => !names.includes(f.name)))
return { ok: true, removed: names.length }
@@ -5027,8 +5028,8 @@ const tbCenterSeed = (type, refs) => {
// 与 PickerBubble 共用(默认向上、横向钳位、上方不足向下翻),避免两份实现漂移。
// 定位用 viewport 坐标(fixed),与画布缩放/平移无关。
const panelRef = React.useRef(null)
const [pos, setPos] = React.useState({ x: 40, y: 40 })
React.useEffect(() => {
const [pos, setPos] = React.useState(null) // null = 未定位:先隐藏,避免首帧在左上角闪一下
React.useLayoutEffect(() => { // layout effect:浏览器绘制前定位,用户看不到中间态
if (!anchor) return
const place = () => {
// 优先以「节点本身」为锚点:比触发按钮更稳定(按钮可能因换行/溢出而位置出人意料)。
@@ -5106,7 +5107,7 @@ const tbCenterSeed = (type, refs) => {
}
const chip = (key, label, active, onClick, title, disabled) => el('button', { key, type: 'button', disabled: !!disabled, title, className: 'iwb-chip iwb-chip-line' + (active ? ' iwb-chip-line-on' : ''), onClick, onPointerDown: stop }, label)
return ReactDOM.createPortal(
el('div', { className: 'iwb-pop-anchor', style: { left: pos.x + 'px', top: pos.y + 'px' }, onWheel: (e) => e.stopPropagation() },
el('div', { className: 'iwb-pop-anchor', style: { left: (pos ? pos.x : 0) + 'px', top: (pos ? pos.y : 0) + 'px', visibility: pos ? 'visible' : 'hidden' }, onWheel: (e) => e.stopPropagation() },
el('div', { ref: panelRef, className: 'iwb-pop iwb-image-settings', onPointerDown: stop },
el('div', { className: 'iwb-pop-head' },
el('span', { className: 'iwb-pop-title' }, '图像设置'),
@@ -5490,9 +5491,10 @@ const tbCenterSeed = (type, refs) => {
function backupChecksumPayload(data) {
const out = Object.assign({}, data || {})
delete out.checksum
delete out.imagesData
delete out.images
// 图片 / 插件文件(v3.26.59)的**字节**不进校验和:它们分别走 images/ 与 plugin-files/ 目录,
// ZIP 与 JSON 兜底两种形态下字段名不同(images/imagesData、pluginFiles/pluginFilesData),
// 不排除就会出现「同一份数据换个打包形态 ⇒ 校验和不一致」的假报错。
delete out.checksum; delete out.imagesData; delete out.images; delete out.pluginFiles; delete out.pluginFilesData
return out
}
function backupImageManifest(data) {
@@ -8242,7 +8244,7 @@ const tbCenterSeed = (type, refs) => {
return { ok: false, error: '剪贴板不可用' }
} catch (e) { return { ok: false, error: '剪贴板不可用' } }
},
notify: (text, type) => { setNotice({ type: type === 'err' ? 'err' : 'ok', text: String(text || '') }); showToast(String(text || ''), type) },
notify: (text, type) => { setNotice({ type: type === 'err' ? 'err' : 'ok', text: String(text || '') }); showToast(String(text || ''), type) }, paste: () => window.IWBDesktopHelpers.clipboardReadText(),
// v3.25.97:提示词封面 —— 图片走宿主内容寻址存储(images/plugin/prompt/),条目只存 ref。
putCover: (u) => wPromptCoverCtl().put(u),
coverUrl: (r) => wPromptCoverCtl().url(r),
@@ -8268,7 +8270,7 @@ const tbCenterSeed = (type, refs) => {
return { ok: failed.length === 0, count: n, failed: failed }
},
insert: async (names, o) => ({ ok: true, inserted: await insertOutputsToCanvas((outputs || []).filter((f) => names.indexOf(f.name) >= 0), (o && o.insertK) || '1k') }),
remove: async (names) => { const n = await deleteOutputs(names); return { ok: n > 0, removed: n } },
remove: async (names) => { const n = await deleteOutputs(names); return { ok: n > 0, removed: n } }, openFolder: () => window.IWBDesktopHelpers.openGalleryDir(),
})
// 节点组库插件(grouplib):数据仍由宿主持有,插件只拿读写/实例化能力
if (window.IWBPluginGroupLib) {
@@ -8530,12 +8532,14 @@ const tbCenterSeed = (type, refs) => {
})()
: (() => { const sn = (refs.nodes || nodes).find((n) => n && n.id === sel[0]); if (!sn) return null; const title = (sn.data && sn.data.title) || (nodeTypeTitle(sn.type)); const metaLabel = floatbarMetaLabel(wRawCfg(), sn); const pl = floatbarPlace(sn.y, sn.y + hOf(sn), floatbarLift(hasNodeTitle(sn), nodeInGroup(sn), true), viewport); return el('div', { className: 'iwb-node-floatbar' + (pl.below ? ' iwb-node-floatbar-below' : ''), onPointerDown: (e) => e.stopPropagation(), style: { left: viewport.x + (sn.x + nodeWidth(sn) / 2) * viewport.scale, top: pl.top, '--iwb-fb-k': String(pl.k) } }, metaLabel ? el('span', { className: 'iwb-node-floatbar-title', title: '当前服务商 · Key 分组' }, metaLabel) : null,
UiGenCfgModule && UiGenCfgModule.NodeBgPalette ? el(UiGenCfgModule.NodeBgPalette, { key: 'bgc', current: (sn.data && sn.data.bg) || '', onPreview: (bg) => previewNodeBg([sn.id], bg), onPreviewEnd: endNodeBgPreview, onPick: (bg) => updateNode(sn.id, { bg }) }) : null,
groupOf(sn.id) ? el('button', { 'aria-label': '解组', 'data-tip': '解组', onClick: (e) => { e.stopPropagation(); const g = groupOf(sn.id); if (g) ungroup(g.id) } }, I('ungroup')) : null,
// 未编组且与某个分组相连 ⇒「并入分组」(多个相连组时取成员最多的)
!groupOf(sn.id) && IWWorkbenchLogic.connectedGroupIdsOf(refs, sn.id).length ? el('button', { 'aria-label': '并入分组', 'data-tip': '并入分组', onClick: (e) => { e.stopPropagation(); joinGroupOf(sn.id) } }, I('group')) : null,
sn.type === 'prompt' ? el('button', { 'aria-label': '放大编辑', 'data-tip': '放大编辑', onClick: (e) => { e.stopPropagation(); if (IWNodeBodies && IWNodeBodies.openPromptExpand) IWNodeBodies.openPromptExpand({ value: (sn.data && sn.data.text) || '', onCommit: (v) => updateNode(sn.id, { text: v }) }) } }, I('maximize')) : null,
el('button', { 'aria-label': '改名', 'data-tip': '改名', onClick: (e) => { e.stopPropagation(); wRenameNodeDialog(sn, td, updateNode) } }, I('edit')),
el('button', { 'aria-label': '复制', 'data-tip': '复制', onClick: (e) => { e.stopPropagation(); duplicateNodes(sel) } }, I('copy')),
sn.type === 'prompt' ? el('button', { 'aria-label': '收藏', 'data-tip': '收藏', onClick: (e) => { e.stopPropagation(); saveSelectionAsGroup([sn.id], title) } }, I('star')) : null,
// 单节点不再有「收藏为节点组」;提示词的星标 = 添加到提示词库(与标题栏星标同一入口)
sn.type === 'prompt' ? el('button', { 'aria-label': '添加到提示词库', 'data-tip': '添加到提示词库', onClick: (e) => { e.stopPropagation(); addPromptToLibrary(sn.id) } }, I('star')) : null,
sn.type === 'ref' ? el('label', { 'aria-label': '替换', 'data-tip': '替换', onPointerDown: (e) => e.stopPropagation() }, I('upload'), el('input', { type: 'file', accept: 'image/*', style: { display: 'none' }, onChange: (e) => { const f = e.target.files && e.target.files[0]; if (!f) return; try { const rd = new FileReader(); rd.onload = () => wImportImage(rd.result, { onError: (msg) => setNotice({ type: 'err', text: msg }) }, (r) => { if (!r || !r.ok || !r.data) return; updateNode(sn.id, { data: r.data, name: f.name, localName: null, url: '' }) }); rd.onerror = () => setNotice({ type: 'err', text: '读取图片文件失败:' + String(f.name || '') }); rd.readAsDataURL(f) } catch (err) { console.error(err) } } }, null)) : null,
sn.type === 'ref' ? el('button', { 'aria-label': '粘贴', 'data-tip': '粘贴', onClick: (e) => { e.stopPropagation(); floatbarRefPaste(sn.id) }, onPointerDown: (e) => e.stopPropagation() }, I('paste')) : null,
sn.type === 'out' ? (() => { const uout = outResultUrls(sn.id); return el('button', { 'aria-label': '下载', 'data-tip': '下载', disabled: !uout.length, onClick: (e) => { e.stopPropagation(); uout.forEach((u, i) => setTimeout(() => downloadUrl(u, 'image-' + String(i + 1).padStart(3, '0') + '.png'), i * 350)) } }, I('download')) })() : null,
+1 -1
View File
@@ -10,7 +10,7 @@
- Image Workbench:Tauri v2 桌面应用(本地优先的 AI 生图无限画布)。
- 仓库:`/Users/qiqi/open/github/image-workbench-desktop`(mac 端),git remote 名为 `gitea`。
- 分发:自建 NAS,公网 `https://download.maqiart.eu.org`,根目录 `/vol8/web/iwb-download`。
- 版本线:现行 `3.25.x`。**注意**:仓库里最高的 git tag `v3.87.65` 是历史遗留线,semver 更大但**不是**最新——判断最新版看 `package.json` / `CHANGELOG.md` 顶条 / `tauri.conf.json`,永远别按最高 tag。
- 版本线:以 `package.json` 为准(当前 `3.26.x`);历史 `3.25.x` 仅示例。**注意**:仓库里最高的 git tag `v3.87.65` 是历史遗留线,semver 更大但**不是**最新——判断最新版看 `package.json` / `CHANGELOG.md` 顶条 / `tauri.conf.json`,永远别按最高 tag。
---
+7 -5
View File
@@ -1,3 +1,5 @@
> ⚠️ **命令示例已过时**:现行发布命令为 `bash scripts/publish-update.sh`(不带版本参数,版本取自 `package.json`);Windows 用 `publish-windows-update.sh` 并在 mac 侧重跑 `publish-update.sh` 合并 `latest.json`。
# 在线更新(Tauri Updater)
> 目标:用户装过一次之后,以后新版本在应用内点「检查更新」即可升级,不用再手动下载 dmg。
@@ -16,7 +18,7 @@
## 二、发新版本(一条命令)
```bash
./scripts/publish-update.sh 3.25.3 # 改版本 + 双架构签名构建 + 上传 + 生成 latest.json
bash scripts/publish-update.sh # 版本取自 package.json;双架构构建 + 签名 + 上传 + 生成 latest.json
```
脚本会做四件事:
@@ -30,12 +32,12 @@
```json
{
"version": "3.25.2",
"version": "X.Y.Z",
"notes": "更新说明",
"pub_date": "2026-11-17T09:43:08.117Z",
"platforms": {
"darwin-aarch64": { "signature": "<.sig 内容>", "url": "https://.../image-workbench_3.25.2_aarch64.app.tar.gz" },
"darwin-x86_64": { "signature": "<.sig 内容>", "url": "https://.../image-workbench_3.25.2_x64.app.tar.gz" }
"darwin-aarch64": { "signature": "<.sig 内容>", "url": "https://.../image-workbench_X.Y.Z_aarch64.app.tar.gz" },
"darwin-x86_64": { "signature": "<.sig 内容>", "url": "https://.../image-workbench_X.Y.Z_x64.app.tar.gz" }
}
}
```
@@ -44,7 +46,7 @@
## 四、用户侧流程
1. 装过任一 3.25.2+ 版本(这是第一个带更新器的版本)
1. 装过任一 3.26.54+ 版本(更早版本需先手动装一次带更新器的包)
2. 设置 → 通用 → 版本与更新 → **检查更新**
3. 有新版本 → 显示版本号与说明 → 点「立即更新」
4. 自动下载、校验签名、替换、重启(数据目录不受影响)
+4 -125
View File
@@ -1,127 +1,6 @@
# Windows 出包步骤(手把手)
# Windows 出包(已归档)
> **本版要打的版本:3.25.1**(仓库里已经是这个号,直接构建,不要再改)
>
> 确认命令:node -e "console.log(require('./package.json').version)" → 应输出 3.25.1
>
> 产物名:image-workbench_3.25.1_x64-setup.exe / image-workbench_3.25.1_x64_en-US.msi
> 本文已归档:内容对应 v3.25.x,版本号写死、流程已过时。
> 现行权威流程见 [`WIN_BUILD_SPEC.md`](WIN_BUILD_SPEC.md)。
> 目标:在一台 Windows 机器上,从 Gitea 拉代码 → 打出安装包 → 自测 → 把产物回传到 NAS。
## 0. 前置检查
- Windows 10 1803+ 或 Windows 11,**x64**
- 磁盘 ≥ 5 GB 空闲(Rust 编译产物较大)
- 有本地管理员权限(装 Visual Studio Build Tools 需要)
## 1. 安装工具链(一次性)
| 工具 | 命令 / 说明 |
|---|---|
| Git | `winget install Git.Git` |
| Node.js LTS(22) | `winget install OpenJS.NodeJS.LTS` |
| Rust | `winget install Rustlang.Rustup` 然后 `rustup default stable-x86_64-pc-windows-msvc` |
| **VS Build Tools 2022** | 勾选「**使用 C++ 的桌面开发**」(MSVC v143 + Windows SDK)——**最容易漏** |
| WebView2 Runtime | Win11 自带;Win10 没有就装 Evergreen |
自检:
```powershell
cd image-workbench-desktop
powershell -ExecutionPolicy Bypass -File scripts\windows-check.ps1
```
全部 `[OK]` 再做下一步。Rust 那行不能出现 `gnu`(必须 msvc)。
## 2. 取代码
```powershell
git clone https://git.maqiart.eu.org/malongan/image-workbench-desktop.git # 公网(公开库)
# 或内网/Tailscale:git clone http://192.168.100.185:3000/malongan/image-workbench-desktop.git
```
建议放 `C:\work\image-workbench-desktop`(避开长路径/中文路径)。
## 3. 安装依赖
```powershell
cd C:\work\image-workbench-desktop
npm ci
```
用 `npm ci`,不要 `npm install`。卡住就换 registry 或配代理。
## 4. 设版本号(三处必须一致)
```powershell
node scripts/set-version.js 3.25.0
```
同时改 `package.json` / `src-tauri/tauri.conf.json` / `src-tauri/Cargo.toml`。
版本必须比线上大,否则以后接自动更新时客户端不认。
## 5. 出包
```powershell
npm run app:build
```
内部顺序:`lint → build → 剥离内置插件 → tauri build`(lint 不过就不出包,故意的)。
产物:
| 文件 | 用途 |
|---|---|
| `src-tauri\target\release\bundle\nsis\image-workbench_3.25.0_x64-setup.exe` | **主推**(当前用户安装,免管理员) |
| `src-tauri\target\release\bundle\msi\image-workbench_3.25.0_x64_en-US.msi` | 企业环境用 |
| `src-tauri\target\release\image-workbench.exe` | 免安装单文件(目标机需 WebView2) |
首次构建 5~15 分钟,之后增量 1~2 分钟。
## 6. 自测(必须过)
1. 安装 → 启动
2. 数据目录生成:`%USERPROFILE%\Documents\ImageWorkbench`(data.json / canvases / library / images)
3. 设置→通用:「数据库目录」路径正确,「打开」能弹资源管理器
4. 关窗进程留托盘;左键托盘唤窗口;右键有菜单
5. 设置→插件:**无内置插件**;市场列 7 个;装一个 → 重启后可用
6. 画布新建/拖拽/缩放正常;导入图片正常
7. 点「下载」→ 直接落到导出目录,不弹另存为
## 7. 把产物传回来
**A. 传 NAS(局域网/Tailscale)**
```powershell
scp "src-tauri\target\release\bundle\nsis\image-workbench_3.25.0_x64-setup.exe" malongan@192.168.100.185:/vol8/web/iwb-download/updates/windows-x86_64/
```
**B. 传 Gitea Releases**(公开库匿名可下载)
**C. 发我**:我上传 NAS 并更新 `releases.json` 与下载页
## 8. 常见错误
| 报错 | 原因 | 解决 |
|---|---|---|
| `link.exe not found` | 没装 VS Build Tools C++ 工作负载 | 重装并勾「使用 C++ 的桌面开发」 |
| rustc 显示 `gnu` | 默认工具链错 | `rustup default stable-x86_64-pc-windows-msvc` |
| `Windows SDK is not installed` | SDK 缺失 | Build Tools 勾 Windows SDK |
| 启动报 WebView2 错误 | 缺运行时 | 装 Evergreen Runtime |
| `npm ci` 超时/证书 | 网络 | 换 registry / 配 proxy |
| 编译文件被占用 | 杀软扫描 target | 排除 `src-tauri\target` |
| 路径过长 | 目录太深 | 放 `C:\work\`;`git config --system core.longpaths true` |
| beforeBuildCommand lint 失败 | 代码有未定义变量 | 修代码,别绕过门禁 |
## 9. 当前状态
- **自动更新未启用**(updater 未装)⇒ Windows 包只能手动下载安装
- 下载页 Windows 位置现在显示「暂未提供」;传回后我加一条 `windows-x86_64` 就自动出现
- 插件不随包:新机器是零插件,需从市场装
## 10. 一句话流程
```
装工具 → git clone → npm ci → node scripts/set-version.js x.y.z
→ npm run app:build → 自测 7 条 → 传回 NAS/Gitea → 我更新下载页
```
历史版本:[`archive/history/DESKTOP_WINDOWS-legacy.md`](archive/history/DESKTOP_WINDOWS-legacy.md)。
+4 -106
View File
@@ -1,108 +1,6 @@
# 任务:在 Windows 上为 image-workbench-desktop 构建 v3.25.15 安装包
# Windows 构建任务书(已归档)
你是这台 Windows 机器上的打包执行者。只做打包与自测,**不改业务代码**。
> 原任务书针对 v3.25.15,版本号与 commit 已过时。
> 现行流程见 [`WIN_BUILD_SPEC.md`](WIN_BUILD_SPEC.md),版本以 `package.json` 为准。
> ⚠️ v3.25.15 起的变化:项目已**彻底转桌面客户端**(`_headers` / `functions/` / `wrangler.toml` 已删除,`npm run deploy` 脚本已移除);
> 更新清单**平台解耦**(Windows 用 `updates/latest-windows.json`,**由 Mac 侧用正式私钥生成,你不写**)。
## 硬性约束
1. 不改 `app.js` / `src/**` / `src-tauri/src/**` / `style.css` 的业务逻辑
2. 不绕过 lint 门禁;报错就停下报告
3. 不用 `npm install`,只用 `npm ci`;版本已定 **3.25.15**,不要改
4. 不 commit / 不 push / 不打 tag / 不跑任何 `scripts/publish-*.sh`
5. 不改 `src-tauri/tauri.windows.conf.json`(产物已锁 `nsis`,不要 msi)
## 第零步:拉代码
```powershell
git fetch --all --tags; git checkout main; git pull --ff-only
git rev-parse --short HEAD # 必须是 84c2c10 或其后代
node -e "console.log(require('./package.json').version)" # 必须 3.25.15
```
## 第一步:环境检查
```powershell
node -v; npm -v; rustc -V; rustup show active-toolchain
powershell -ExecutionPolicy Bypass -File scripts\windows-check.ps1
```
全部 `[OK]` 才继续;出现 `[缺失]` 停止报告(不要自行安装)。
## 第二步:依赖
```powershell
npm ci
```
本次新增两个 Rust 插件依赖(single-instance / notification),首次构建会多拉一些 crate。
## 第三步:构建(用一次性临时密钥签名)
```powershell
npx tauri signer generate -w "$env:TEMP\iwb-tmp.key" --password ""
$env:TAURI_SIGNING_PRIVATE_KEY = Get-Content "$env:TEMP\iwb-tmp.key" -Raw
$env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD = ""
npx tauri build
Remove-Item "$env:TEMP\iwb-tmp.key" -Force
```
> 产出的 `.sig` 是临时密钥签的,**我会在 Mac 上用正式私钥重签**,你附上即可。
## 第四步:确认产物
```powershell
Get-ChildItem src-tauri\target\release\bundle -Recurse -Include *.exe,*.sig | Select FullName,Length
Get-FileHash "src-tauri\target\release\bundle\nsis\image-workbench_3.25.15_x64-setup.exe" -Algorithm SHA256
Test-Path dist\plugins # 期望 False
Test-Path _headers # 期望 False
Test-Path functions # 期望 False
```
## 第五步:自测清单(逐条报通过/失败)
**基础**
1. 安装并启动;数据目录 `%USERPROFILE%\Documents\ImageWorkbench` 生成 `data.json`/`canvases`/`library`/`images`
2. **`images\` 下必须有 `canvas` 文件夹**(v3.25.12 之前只有 `thumbs`,这是丢图根因)
3. 设置 → 通用:数据库目录正确;「打开」能弹资源管理器
4. 关窗口进程仍在托盘;左键唤出;右键有菜单
**图片持久化(历史 bug 复现点)**
5. `Ctrl+V` 粘贴新图 → 出现图片节点
6. **正常退出**(托盘右键退出,非强杀)→ 重开 → 图仍在、显示正常
7. 从资源管理器拖图进画布 → 退出重开 → 图还在
**桌面壳(本次新增)**
8. 单实例:连续双击两次 → 只有一个窗口,第二次聚焦已有
9. 外链:点「项目主页」→ 用系统浏览器打开,应用不变(不能被导航成网页)
10. 跑一次生图,完成后弹系统通知
**插件与 CSP(本次修复)**
11. 设置 → 插件:无内置插件;市场能列 7 个;装一个 → 重启后可用
12. **鲜艺抠图**:启用后对图片节点执行抠图 → **不应出现 `Failed to fetch`**(3.25.11 回归,3.25.14 已修)
13. 若本机有 `XianyiAiRmbg` 监听 `0.0.0.0:30092` → 抠图出透明底;没装则注明跳过
**外观(本次新增)**
14. 设置 → 外观:改画布底色(亮/暗)与主题色 → 立即生效,重启保持
15. 亮暗切换时画布底色分别用两套值
任何一条失败:记录现象 + 截图后停止报告,**不要改代码**。
## 第六步:交付格式
```
结论:成功 / 失败(卡在第 N 步)
版本:3.25.15 commit=<sha>
安装包:<路径> <大小> SHA256=<hex>
环境:node= rust= VS= WebView2=
自测:1✅ … 15✅(失败写 ❌ + 现象)
耗时:
```
产物留在本机;**不要**上传 NAS、**不要**写 `latest-windows.json`(我在 Mac 侧做)。
## 停止条件
commit 不对 / 环境缺件 / 构建报错一次重试无效 / 自测有失败 / 需要改业务代码 —— 遇到即停,
报告「卡在哪一步 + 完整报错 + 已尝试过什么」。
历史版本:[`archive/history/PROMPT-WIN-BUILD-v3.25.15.md`](archive/history/PROMPT-WIN-BUILD-v3.25.15.md)。
+3 -2
View File
@@ -5,8 +5,9 @@
## 使用与发布
- [项目说明](../README.md)
- [发布说明](../PUBLISHING.md)
- [**版本记录与还原**(RELEASES:出问题怎么退版)](RELEASES.md)
- [发布规则(桌面版)](../PUBLISHING.md)
- [**Windows 打包与交付规范**](WIN_BUILD_SPEC.md)
- [**版本记录与回滚**(桌面版)](RELEASES.md)
- [**贡献指南**(改代码前先看这个)](../CONTRIBUTING.md)
- [**待办清单 BACKLOG**(这个项目有什么待办)](../BACKLOG.md)
+16 -421
View File
@@ -1,431 +1,26 @@
# 版本记录与还原(RELEASES)
# 版本记录与回滚(桌面版)
> **用途**:出问题时**怎么快速、准确地还原**。这是还原的唯一权威入口。
> **最后核对:2026-11-16** · 基线 `main = 7df9dc4`(v3.24.85 的文档提交,也是**正式站与测试站**实际运行提交;bump 提交是 `4be78c0`)| 三地址版本号一致 `v3.24.85`(`IWB_VERIFY_STRICT=1` 核验通过 ⇒ `stable` = `7df9dc4`)
> **注意 `+commit` 后缀天然可以不同**:若发版后又有 docs-only 提交并重发,正式站与测试站的 `+commit` 会分叉(v3.24.84 时即正式站 `c8b7543` / 测试站 `7d6ff6c`);本版两者部署的是同一份 `dist/`,故后缀相同。
> 一致性比较只看版本号,2026-11-14 已修 `verify-release.js`(此前用完整串比较,导致每次发版必误报)。
> **v3.24.80 的正式发布延迟到 2026-11-14 07:20**:11-13 23:25 首次发布撞上 Cloudflare 官方事故(**Workers API availability**,Pages 全系 API 返回 `503 no healthy upstream`),连续 20+ 次重试均失败;期间正式站**保持 `v3.24.79+8598a57` 未动**,用户无感。API 恢复后用**同一份门禁通过的产物**(`v3.24.80+2d584a6`)补发,未重跑 e2e。
>
> 配套文档:[`CHANGELOG.md`](../CHANGELOG.md)(每版改了什么)· [`PUBLISHING.md`](../PUBLISHING.md)(怎么发版)
> 2026-11-24 重写。历史网页版 Pages/测试站记录已归档:
> [`docs/archive/history/RELEASES-legacy-web.md`](archive/history/RELEASES-legacy-web.md)。
---
## 版本记录
## 0. 现在的线上是什么?(30 秒确认)
- 发布条目:`CHANGELOG.md`(每个 `## vX.Y.Z` 对应一个 tag)
- 当前版本:`node -e "console.log(require('./package.json').version)"`
- 产物与更新源:`https://download.maqiart.eu.org/updates/latest.json`
## 回滚(mac)
```bash
cd ~/open/github/image-workbench-web
# ① 线上实际在跑什么(三地址应一致)
curl -fsSL https://iwb.maqiart.eu.org/version.json
curl -fsSL https://image-workbench-web.pages.dev/version.json
curl -fsSL https://test.image-workbench-web.pages.dev/version.json
# ② 一条命令做「三地址一致 + 线上代码可从 origin/main 恢复」双重核验
IWB_VERIFY_STRICT=1 node scripts/verify-release.js
```
**2026-11-16 实测结果(v3.24.85 · 代码体检收口)**:
| 地址 | 版本 |
|---|---|
| `https://iwb.maqiart.eu.org`(正式/自定义域名) | `v3.24.85+7df9dc4` |
| `https://image-workbench-web.pages.dev`(正式) | `v3.24.85+7df9dc4` |
| `https://test.image-workbench-web.pages.dev`(测试) | `v3.24.85+7df9dc4` |
✅ **三地址一致** `v3.24.85+7df9dc4`,`IWB_VERIFY_STRICT=1` 核验「线上代码可从 `origin/main` 恢复」通过。
本版测试站与正式站部署的是**同一份 `dist/`**(`7df9dc4`),故三地址 `+commit` 后缀也相同。
上一版 v3.24.84 = 正式站 `v3.24.84+c8b7543` / 测试站 `v3.24.84+7d6ff6c`(后缀分叉是因为发版后又有一个 docs-only 提交并重发了测试站)。
(`verify-release.js` 于 2026-11-14 修过一次:旧实现比较完整串,于是每次 docs-only 提交后发版都误报「三地址不一致」。)
---
**2026-11-14 实测结果(v3.24.80 · 兜底保存 rev 修复)**:
| 地址 | 版本 |
|---|---|
| `https://iwb.maqiart.eu.org`(正式/自定义域名) | `v3.24.80+2d584a6` |
| `https://image-workbench-web.pages.dev`(正式) | `v3.24.80+2d584a6` |
| `https://test.image-workbench-web.pages.dev`(测试) | `v3.24.80+2d584a6` |
✅ **三地址一致** `v3.24.80+2d584a6`,`IWB_VERIFY_STRICT=1` 核验「线上代码可从 `origin/main` 恢复」通过。
正式站产物 `app.js` 的 SHA-256 与本地 `dist/app.js` 一致(`6308e5b8…`)⇒ 线上跑的就是这次构建。
(核验时 `image-workbench-web.pages.dev` 首轮报 TLS 握手断开,重试一轮即收敛 —— `pages.dev` 首轮抖动是该地址的已知现象。)
正式站本次从 `v3.24.79` 到 `v3.24.80`(单版)。本次改动(相对 v3.24.79):
修「离开页面的兜底保存不递增 rev」——`flush()`(`beforeunload` / `pagehide` / `visibilitychange`)原先把
**旧 rev 原样写回**,而其它标签页靠轮询 rev 变化判断同步,rev 不动 ⇒ A 标签关闭/切后台前的最后一次修改
对 B 标签不可见,下一秒就被 B 的保存洗掉;改成 `((read().rev || 0) + 1)`,与标准保存路径 `wApi('workspaces')`
的 `prev.rev + 1` 对齐。另删死代码 `createWBFlushViewport`(17 行,全仓无调用)与根目录误提交的空文件 `0`。
本次**不做**的三项及其实测依据见 `BACKLOG §4.5`(autoGrow 强制布局实测 68→67ms 无收益、OUT_KEY 竞态诊断有误、
`renderBody` 1,600 次查无实据)。
(v3.24.79 发版记录 · 上一版)正式站从 `v3.24.78` 到 `v3.24.79`(单版):
用户报「设置 → 生图服务 → 服务器地址测速三个地址全 ✗ 失败」。四步定责后确认与服务、网络、Key 都无关:
`POST /v1/images/generations` 有 `access-control-allow-origin`,而 `GET /v1/models` 的真实响应**一个 CORS 头都没有**
(只有 `OPTIONS` 预检有)—— 测速打的是简单请求,**不触发预检**,响应无 ACAO 就被浏览器拦在读结果那步。
改法:测速逻辑搬进 `src/generation-provider-ping.js`,分段判定「普通请求 → 失败退一次 `no-cors`」、
**超时不重试**(否则 6s 变 12s 像卡死)、失败必须带原因;实测三地址 147 / 148 / 148ms。
(回滚点:`stable-v3.24.79` → `8598a57`、`stable-v3.24.78` → `aaa9112`。)
---
## 1. 近期版本对照表(可直接用来还原)
> **未单独打 tag 的版本**:`v3.24.45`(撤回位图转矢量、收回 `wasm-unsafe-eval`,`f9c2211`)与
> `v3.24.46`(位图转矢量 v0.2 换 potrace,`23065d2`)**只发过测试站、从未打 tag**,
> 其内容已包含在 `v3.24.47`(`7ef8141`)内 ⇒ 还原到 v3.24.47 即等于包含这两版。
> 同理 `v3.24.37` ⊂ `v3.24.38`、`v3.24.39` ⊂ `v3.24.40`、`v3.24.34`/`v3.24.35` ⊂ `v3.24.36`。
> **2026-11-06 补齐**:表中新增 `v3.24.30/31/32/41`(此前有 tag、有 Release,但表里缺行 —— 会让人以为无法还原)。
> **2026-11-09 补齐**:表中新增 `v3.24.50~55/57/58`(此前有 tag、有 Release,但表里缺行);
> `v3.24.56`(`ce2845d`)与 `v3.24.59`(bump `77154ac`,测试站试色版)**未打 tag**,
> 内容分别并入 `v3.24.57` 与 `v3.24.60` ⇒ 还原到后一版即等于包含它。
> **2026-11-11 补齐**:表中新增 `v3.24.61~63`(此前有 tag、有 Release,但表里缺行);
> `v3.24.64`(bump `2d83a13`)**未单独打 tag**,测试站验收时发现问题,内容并入 `v3.24.65`。
> **2026-11-11 二次发布**:`v3.24.68`/`v3.24.69` 先在测试站验收、**补打了 tag**(`63493b2`/`e4cb049`),
> 三版一起由 `v3.24.70` 上正式站 ⇒ 还原到 `v3.24.70`(`a3dfad5`)即等于包含 68/69 的全部内容。
> **2026-11-12 六版合并发布**:`v3.24.71~75` 先在测试站验收、各有 tag 与 GitHub Release,
> 六版一起由 `v3.24.76` 上正式站 ⇒ 还原到 `v3.24.76`(`e660a75`)即等于包含 71~75 的全部内容。
| 版本 | tag → commit | 发布日期 | GitHub Release | 说明 |
|---|---|---|---|---|
| **v3.24.85** | `7df9dc4`(线上实际运行;bump 提交 `4be78c0`) | 2026-11-16 | ✓ | 代码体检收口(不改可见行为):① 棘轮收回 `Workbench()` 3,090→**2,998**、上限降到 **3,030**(留 32 行余量)—— 生成取消族与工作区列表写回族搬进 `src/runtime-workbench-logic.js`,删零调用的死代码 `runAll`;② 图库索引 4 条**绕过门面锁**的写路径(`imageFolderSync` / `storeOutputThumb.idxSet` / 备份 `restore` / `wPurgeOutputOriginals`)收口到新增的 `mutate(fn)`,治「两个标签页同时归档 ⇒ 图库莫名少条目」;③ 文档数字校准(线上版本、app.js 行数/占比、模块数、单测数、钉点数) |
| **v3.24.84** | `c8b7543`(bump 提交 `5d0b169`) | 2026-11-14 | ✓ | 生图节点连了 3 条上游只出 1 个任务 ⇒ 任务身份改用 `ownerNodeId`(本节点自己,不随继承冒泡):连几条线就几个任务,`relay` 仍归约到真实文本来源(同一来源多路径抵达只算一次,防重复计费);任务标题兜底加 `data.name`。同批:任务卡标题统一「任务 N · 来源名」、`verify-release.js` 的三地址一致不再被 `+commit` 后缀误判 |
| **v3.24.83** | `73748f7`(线上实际运行;bump 提交 `0a27a42`) | 2026-11-14 | — | ① 插件节点冷启动不再退化成一段文本:插件节点体是异步注册的,`registerNodeType` 在 `render` 由无变有时自增 `NODE_TYPES_REV`,`NodeCard` 比它 ⇒ 注册那一刻重建一次;`canvas-normalize` 按命名规则认作已知类型、不再降级写回存档(配套插件 `style-source` 1.3.2 改为脚本执行时注入样式)。② 画布底栏加「缩小 / 放大」两个图标(放在「适应」左边,一档 15%,锚点=画布中心),缩放数学抽成 `IWBCanvasGeometry.zoomStep` 纯函数与快捷键共用。③ 补记 v3.24.81/82 漏记的三处棘轮 |
| **v3.24.82** | `ef6cf42` | 2026-11-14 | ✓ | 提示词/文本节点显示上游继承文本(自己 `data.text` 为空时显示上游那段话,改一个字即接管,另有「恢复跟随」);修 `nodeRefsOf` 的 textout 分支只认 llm/batch/combine 上游导致「样式 → 文本 → 分层」丢参考图 |
| **v3.24.81** | `dba71e3` | 2026-11-14 | ✓ | 插件节点可自定义节点体(`render(node, props, host)` 画真实 DOM,宿主不每帧重建 ⇒ 输入框不失焦);节点自带参考图(`data.refOn/refUrl`);连线白名单按 `data.outKind === 'prompt'` 归一化 |
| **v3.24.80** | `2d584a6`(线上实际运行;bump 提交 `9d77ec9`) | 2026-11-14 | ✓ | 离开页面的兜底保存不递增 rev:`flush()`(`pagehide` / `visibilitychange` / `beforeunload`)写回旧 rev ⇒ 其它标签页轮询看不到末次修改,A 标签关掉前的改动会被 B 的保存洗掉;改成 `((rev\|\|0)+1)` 对齐标准保存路径。另删死代码 `createWBFlushViewport`(17 行)与根目录误提交的空文件 `0`;e2e 补「rev 恰好 +1」断言(两条兜底路径) |
| **v3.24.79** | `8598a57`(bump 提交 `9f49184`) | 2026-11-12 | ✓ | 服务器地址测速全红修复:服务端 CORS 只配在预检与生图 POST 上,`GET /models` 无 ACAO ⇒ 改「普通请求失败后退一次 `no-cors`」+ 超时不重试 + 失败带原因;`generation-provider-ping.js` + 29 条单测 |
| **v3.24.78** | `aaa9112` | 2026-11-12 | ✓ | LOD 拆三档:15% 以上画代表图 / 首行文字,15% 以下才退成 CSS 占位(v3.24.77 一并上线);`lodModeOf` + 13 条判据断言 + 5 条 e2e |
| **v3.24.77** | `0602388` | 2026-11-12 | ✓ | LOD 判据换成节点屏幕宽度:800 节点切画布 488 → 198ms、textarea 186 → 0;只发过测试站,内容包含在 v3.24.78 |
| **v3.24.76** | `e660a75` | 2026-11-12 | ✓ | 钉点减法第二批:3 条 e2e 查出 3 个真缺陷(objectURL 从未释放 / 孤儿标签 session / 误回收打开标签的图);v3.24.71~75 一并上线 |
| **v3.24.75** | `47f41aa` | 2026-11-12 | ✓ | 同图去重:内容哈希,同一张图连粘两次只建一个节点;只发过测试站,内容包含在 v3.24.76 |
| **v3.24.74** | `ec1adb3` | 2026-11-12 | ✓ | 粘贴落点精确到像素(消掉 63px 偏移)+ 图片准入统一 `image-admit`;只发过测试站 |
| **v3.24.73** | `9c8a5fd` | 2026-11-12 | ✓ | 静默失败收口:用户动作的失败必须有红色回执 + 规则库立规;只发过测试站 |
| **v3.24.72** | `45aa6a0` | 2026-11-12 | ✓ | 钉点减法第一批:32 条源码钉点换成 DOM/运行时断言(537→505);只发过测试站 |
| **v3.24.71** | `cc5c3e2` | 2026-11-12 | ✓ | app.js 总量棘轮改为双层预算(8,700 + 占比 40%)+ 覆盖率复算入档;只发过测试站 |
| **v3.24.70** | `a3dfad5`(线上实际运行) | 2026-11-11 | ✓ | 修「复制粘贴突然不起作用」:焦点在节点输入框的两条静默通道;v3.24.68/69 一并上线 |
| **v3.24.69** | `e4cb049` | 2026-11-11 | ✓ | 粘贴落点跟随鼠标(推翻 v3.24.68 的「不跟鼠标」);只发过测试站,内容包含在 v3.24.70 |
| **v3.24.68** | `63493b2` | 2026-11-11 | ✓ | 统一剪贴板:Ctrl+C 同时写系统剪贴板,Ctrl+V 一个键管到底(含节点组);只发过测试站,内容包含在 v3.24.70 |
| **v3.24.67** | `0f8d677`(线上实际运行) | 2026-11-11 | ✓ | 剪贴板语义收口(`Ctrl+V` 只认系统剪贴板 / 粘贴不下载 / 修 7 个静默缺陷)+ 积压四版合并上线 |
| **v3.24.66** | `b247375` | 2026-11-11 | ✓ | 参考图准入统一收口:图库插入 / 图库拖入 / 拖入链接也把 SVG 转 PNG |
| **v3.24.65** | `02cbd59` | 2026-11-11 | ✓ | 三处预览/图库下载后缀仍为 `.png` + SVG 复制到剪贴板必失败(含 `v3.24.64`:下载/归档后缀跟随真实格式) |
| **v3.24.63** | `6c4a8aa` | 2026-11-10 | ✓ | 棘轮恢复零余量 + 文档口径统一(纯工程收尾,界面无变化) |
| **v3.24.62** | `80f6b0c` | 2026-11-10 | ✓ | 测试安全网:设置 CRUD(e2e)+ 核心链路纯函数单测 |
| **v3.24.61** | `7b02ccf` | 2026-11-10 | ✓ | 设置面板拆分(`SettingsModal` −54%)+ 存储写路径留痕 + 版本记录守卫 |
| **v3.24.60** | `bff766d` | 2026-11-09 | ✓ | 节点气泡恢复删除按钮(单选 + 多选组气泡;静态灰 / hover 红,`Ctrl+Z` 可撤销)+ 两条防误删门禁改写 |
| **v3.24.58** | `33b9dc4` | 2026-11-08 | ✓ | 数据一致性:多标签图库同步 + Web Locks 串行化 + 导入防原型污染 + 写失败留痕 |
| **v3.24.57** | `3b0c652` | 2026-11-07 | ✓ | 存储可信度收尾:只读体检 + 一键安全回收 + 还原后校验 |
| **v3.24.55** | `86a931f` | 2026-11-07 | ✓ | 数据安全收尾:导出备份提醒 + 配额可见 + 备份体积护栏 + 部署钉版 |
| **v3.24.54** | `aa17527` | 2026-11-07 | ✓ | 持久化存储(`navigator.storage.persist`)+ 错误留痕 + PWA 可安装 + 自动备份 |
| **v3.24.53** | `87ddf7b` | 2026-11-07 | ✓ | 开发体验与类型安全:事实同步器 + 统一源文本 + 渐进类型检查(`tsc --checkJs`) |
| **v3.24.52** | `479695b` | 2026-11-07 | ✓ | `Workbench` 组件化收口(阶段一样板,−68 行) |
| **v3.24.51** | `46981ec` | 2026-11-07 | ✓ | 工程质量专项:存储入口收敛 + e2e 去固定等待(纯内部重构,界面无变化) |
| **v3.24.50** | `e28e1f4` | 2026-11-06 | ✓ | `Workbench` 拆分(累计 **−914 行**)+ 全仓健康度分析 |
| **v3.24.49** | `61a0af9` | 2026-11-06 | ✓ | 拖动画布松手丢最后一小段位移(「平移末帧提交」原是死代码)+ 门禁补「加载期跨模块依赖顺序」守卫 |
| **v3.24.48** | `f775dd5` | 2026-11-06 | ✓ | LLM 连不上:`normalizeEndpointBase` 剥掉 Base URL 里误粘的 `/chat/completions` 等接口路径(老配置自动纠正)+ 测试前提示未保存 |
| **v3.24.47** | `7ef8141` | 2026-11-05 | ✓ | 内存专项:修掉「轮询同步自激重水合」(内容签名 + 12s 自保存窗口)+ 水合分批 |
| **v3.24.44** | `33a94e0` | 2026-11-04 | ✓ | 输出图片顺序跟随任务卡(组序锚定任务顺序 + 组内按变体序号)+ 旧图排最后并标注 |
| **v3.24.43** | `3af2a3b` | 2026-11-04 | ✓ | 复制节点右侧/下方就近让位(零重叠)+ 修 `refs.measuredH` 清空后永不回填 |
| **v3.24.42** | `33a906a` | 2026-11-04 | ✓ | 任务行动效重做(一次性扫光 + 呼吸描边,删假进度条)+ 版本更新提示移到画布上方 |
| **v3.24.41** | `a41ec2a` | 2026-11-03 | ✓ | 输出节点的图不再「自己掉」:结果精简落盘 + 只在断连时丢 |
| **v3.24.40** | `037cda5` | 2026-11-03 | ✓ | 放大编辑:多级列表保真(不再拍平)+ 有序列表入口 + Tab 升降级 + 清除格式可 Ctrl+Z 撤销,含 3.24.39 的行距修复与工具条中文化 |
| **v3.24.38** | `b3fe448` | 2026-11-03 | ✓ | 资源中心「开合 + 标签页」双持久化(刷新后不再关面板、不再跳回提示词库),含 3.24.37 内容 |
| **v3.24.36** | `0434411` | 2026-11-02 | ✓ | 拖放落点就近吸附(空处不偏移、压住节点则贴到最近空位,20px 间隙)+ 承 34/35 的浮层避让与拖拽插入 |
| **v3.24.35** | `7e83fb4` | 2026-11-02 | — | 插件可「拖到画布上松手」建节点:宿主开放 `screenToWorld`,`createImageNode` 支持显式坐标(插件 style-source 1.2.0) |
| **v3.24.34** | `141e487` | 2026-11-02 | — | 新增节点避开浮层:`.iwb-fullmask` / `.iwb-wsrail` / `.iwb-lib` 当禁区,不再插到插件面板底下 |
| **v3.24.33** | `a855145` | 2026-11-01 | ✓ | 提示词放大编辑(所见即所得)+ 气泡并入分组 + 图标统一 |
| **v3.24.32** | `6d1079e` | 2026-11-01 | ✓ | 工具栏新增节点落在当前视口中心 |
| **v3.24.31** | `afe1de3` | 2026-11-01 | ✓ | 背景色交互重做(悬停预览 / 点击确认)+ 画布细节统一 |
| **v3.24.30** | `74a5c18` | 2026-11-01 | ✓ | 节点背景色(8 色 · 三入口 · 同色系内层 · 亮/暗两套配色) |
| **v3.24.29** | `774310d` | 2026-10-31 | ✓ | 组内多选不再显示「编组」+ 编组/解组换文件夹图标 + 组框留白 28、圆角 18 |
| **v3.24.22** | `de69761` | 2026-10-31 | ✓ | 文档事实数据全量校准(无功能变更):健康表/钉点/覆盖率/测试数按实测重写 + 棘轮上限按实测收紧 |
| **v3.24.21** | `9566171` | 2026-10-31 | ✓ | 插件面板切 tab 串页修复 + 资源中心标题栏尺寸显示移除 |
| **v3.24.20** | `44ab72a` | 2026-10-31 | ✓ | 模型设置面板重做 + 图库参考图修复 + 组合分隔符/文本入口恢复 |
| **v3.24.19** | `3f8ad60` | 2026-10-30 | ✓ | 节点图标更新 + 文本节点屏蔽 + 气泡贴合标题 |
| **v3.24.18** | `ad42b7a` | 2026-10-30 | ✓ | 「生图」改名「配置」+ 服务商/分组收进「模型设置」面板 |
| **v3.24.17** | `01025d1` | 2026-10-30 | ✓ | 图标按钮统一显示 2 字功能名(气泡/底栏/节点卡)+ 插件 appliesTo 收口到 ref |
| **v3.24.16** | `a3fbdc3` | 2026-10-29 | ✓ | 备份区去掉外框 + 入口收敛到设置面板(另两处菜单入口移除)|
| **v3.24.15** | `8198e6d` | 2026-10-29 | ✓ | 备份还原并入设置面板 + 修复设置/Key/模型还原不回来 |
| **v3.24.14** | `a8f35e0` | 2026-10-29 | ✓ | 补 app.js/Workbench 行数棘轮 + 落位规则(防结构回潮)|
| **v3.24.13** | `b7d8bee` | 2026-10-29 | ✓ | 再搬 6 个 Workbench 逻辑单元(app.js −262 行)|
| **v3.24.12** | `e9642cc` | 2026-10-29 | ✓ | Workbench 逻辑单元搬出(runNode/saveNow;app.js −449 行)|
| **v3.24.11** | `df4f360` | 2026-10-29 | ✓ | renderBodyInner 瘦身(app.js −579 行,行为零变化)|
| **v3.24.10** | `988ebbb` | 2026-10-29 | ✓ | 源码钉点换行为断言(app53 756→709,行为零变化)|
| **v3.24.9** | `2516738` | 2026-10-29 | ✓ | 移除「批量设置」(入口隐蔽且有选区被清空缺陷);死代码清理;5 个模块补 e2e |
| **v3.24.8** | `d4b9e77` | 2026-10-28 | ✓ | 移除 Tab 循环界面模式(会隐藏标签栏/工具栏,误按即像界面坏了)|
| **v3.24.7** | `2ce8ece` | 2026-10-28 | ✓ | 修复「标签栏/底栏消失且刷新不回来」(uiMode 不再持久化);清理 9 个未使用模块(377 行)|
| **v3.24.6** | `e41aab6` | 2026-10-28 | ✓ | 结构重构:`app.js` 12,477→10,603(−15.0%);7 步搬迁各带等价证明;修 3 个真实 ReferenceError;新增组件行数棘轮 |
| **v3.24.5** | `36e3f3e` | 2026-10-28 | ✓ | `Workbench()` −82 行;resume 变体过滤抽纯函数+穷举单测(锁住重复扣费);**e2e 产出覆盖率 → app.js 57.7%** |
| **v3.24.4** | `a6d1e11` | 2026-10-28 | ✓ | 依赖安全修复(audit 2 high→0)+ 覆盖率 28.3%→34.1%(**业务代码零改动**) |
| **v3.24.3** | `1b3ffcb` | 2026-10-28 | ✓ | 修复空备份 ZIP 无法解析(校验保留);附 `Workbench()` 拆分前置调研文档 |
| **v3.24.2** | `da24ffa` | 2026-10-28 | ✓ | 内部重构第二批:任务图回溯族 + ZIP 读写族(12 个成员外置;**备份链路首次纳入自动化保护**) |
| **v3.24.1** | `2040193` | 2026-10-28 | ✓ | 内部重构:拆 app.js 巨石第一批(16 个纯函数外置,**零行为变化**) |
| **v3.24.0** | `705b1f0` | 2026-10-20 | ✓ | 图库插入画布不塞整图 base64;刷新后双击可打开 |
| v3.23.0 | `e129398` | 2026-10-20 | ✓ | 资源中心交互优化 5 项 |
| v3.22.0 | `0581261` | 2026-10-20 | ✓ | 缩放手柄「隐形但可拖」+ 标题栏尺寸 |
| v3.21.0 | `7530b31` | 2026-10-20 | ✓ | 移除 Pinterest + Pages Function 补安全头 |
| v3.20.2 | `857908f` | 2026-10-19 | ✓ | 图片节点缩略图消失修复 |
| v3.20.1 | `0831d08` | 2026-10-19 | ✓ | — |
**特殊标签**:
| 标签 | 指向 | 含义 |
|---|---|---|
| `stable-v3.24.85` | 同 `stable` | 固定在 v3.24.85 的稳定标记(**当前回滚点**,commit `7df9dc4`) |
| `stable-verified-2026-11-16` | 同 `stable` | 「某天在线上实测通过」的留痕(该日已移到 v3.24.85) |
| `stable-v3.24.84` | `c8b7543` | 上一版(回滚点) |
| `stable-verified-2026-11-14` | `c8b7543` | 「某天在线上实测通过」的留痕(当日移到 v3.24.84) |
| `stable-v3.24.80` | `2d584a6` | 上一版(回滚点) |
| `stable-v3.24.79` | `8598a57` | 上一版(回滚点) |
| `stable-verified-2026-11-12` | `8598a57` | 「某天在线上实测通过」的留痕(当日移到 v3.24.79) |
| `stable-v3.24.78` | `aaa9112` | 上一版(回滚点) |
| `stable-v3.24.76` | `e660a75` | 上一版(回滚点) |
| `stable-v3.24.40` | 同 `stable` | 固定在 v3.24.40 的稳定标记 |
| `stable-verified-2026-11-03` | 同 `stable` | 「某天在线上实测通过」的留痕(本日已移到 v3.24.40) |
| `stable-v3.24.38` | `b3fe448` | 固定在 v3.24.38 的稳定标记(上一回滚点) |
| `stable-v3.24.36` | `0434411` | 固定在 v3.24.36 的稳定标记 |
| `stable-verified-2026-11-02` | `0434411` | 「某天在线上实测通过」的留痕 |
| `stable-v3.24.17` | `01025d1` | 固定在 v3.24.17 的稳定标记 |
| `stable-verified-2026-10-30` | `01025d1` | 「某天在线上实测通过」的留痕 |
| `stable-v3.24.16` | `a3fbdc3` | 上一版(回滚点) |
| `stable-v3.24.15` | `8198e6d` | 更早一版(回滚点) |
| `stable-v3.24.14` | `a8f35e0` | 更早一版(回滚点) |
| `stable-v3.24.13` | `b7d8bee` | 更早一版(回滚点) |
| `stable-v3.24.12` | `e9642cc` | 更早一版(回滚点) |
| `stable-v3.24.11` | `df4f360` | 更早一版(回滚点) |
| `stable-v3.24.10` | `988ebbb` | 更早一版(回滚点) |
| `stable-v3.24.9` | `2516738` | 更早一版(回滚点) |
| `stable-v3.24.8` | `d4b9e77` | 更早一版(回滚点) |
| `stable-v3.24.7` | `2ce8ece` | 更早一版(回滚点) |
| `stable-v3.24.6` | `e41aab6` | 更早一版(回滚点) |
| `stable-v3.24.5` | `36e3f3e` | 更早一版(回滚点) |
| `stable-v3.24.4` | `a6d1e11` | 更早一版(回滚点) |
| `stable-v3.24.3` | `1b3ffcb` | 更早一版(回滚点) |
| `stable-v3.24.2` | `da24ffa` | 更早一版(回滚点) |
| `stable-v3.24.1` | `2040193` | 更早一版(回滚点) |
| `stable-v3.24.0` | `705b1f0` | 更早一版(回滚点) |
---
## 2. ⚠️ 一个必须知道的惯例:tag 与「部署提交」差 1 个
**v3.24.0 的例子**:
```
047fae5 release: v3.24.0 ← 线上实际部署的是这个
705b1f0 docs(changelog): v3.24.0 发布记录… ← tag v3.24.0 指向这个
```
**这是项目既定流程**(先 bump → 部署 → 再写 CHANGELOG → 打 tag)。
**已实测验证:两者的运行时代码逐字节一致**:
```
app.js ✓ 完全一致 (blob 05ae6c5d)
style.css ✓ 完全一致 (blob b93e54c0)
package.json ✓ 完全一致 (blob 984d11c6)
src/ 整个树 ✓ 完全一致 (tree 7dd44626)
两个 commit 的差异只有:CHANGELOG.md、docs/standards/architecture-current-state.md
```
⇒ **回滚到 `v3.24.0` 重建产物 = 线上那份代码**。这个结论对每个版本都成立(tag 只在文档提交上)。
### 2.1 ✅ 还原演练(2026-10-27 对 v3.24.0 实做,方法对每个版本通用)
用**临时 git worktree** 在 `v3.24.0` tag 上独立重建,再与**线上实际产物**比对:
```bash
git worktree add /tmp/iwb-rb v3.24.0
cd /tmp/iwb-rb && node scripts/build.js # 从 tag 重建
curl -fsSL https://iwb.maqiart.eu.org/app.js -o /tmp/live-app.js
# 归一化两处「必然不同」的内容后再比:
# ① 首行 banner(含各自 commit SHA)
# ② APP_VERSION 常量(build 会注入 vX.Y.Z+<commit>)
```
| 产物 | 从 tag 重建 | 线上生产 | 结论 |
|---|---|---|---|
| `app.js`(归一化后) | `d4cb39ea2268a1df` | `d4cb39ea2268a1df` | ✅ **逐字节一致** |
| `style.css` | `d8f551e9a48f32ae` | `d8f551e9a48f32ae` | ✅ **逐字节一致** |
> 唯一差异是 build 注入的 `APP_VERSION`(`v3.24.0+705b1f0` vs `v3.24.0+047fae5`)——
> 那是**版本标记**,不是代码逻辑;部署后的 `version.json` 也会如实反映当前 commit。
**结论:还原是真的可行,已实测**。以后出问题可按 §3 场景 A 直接操作。
---
## 3. 还原操作(按场景选一种)
### 场景 A:线上出问题,要退回上一个版本(最常见)
```bash
cd ~/open/github/image-workbench-web
# 1) 看清要退到哪一版
git tag --list 'v3.*' | tail -10
git log --oneline -5 # 确认当前
# 2) 退到目标版本的**代码**
git checkout v3.23.0 # 或 stable / stable-v3.24.0
# 3) 重建并部署(注意:仅 checkout 不会改线上,必须部署)
git checkout vX.Y.Z # 回到目标版本提交
npm ci
npm run verify:ci # 确认这一版的门禁是绿的
npm run deploy # 部署到正式站
# 4) 核验(三地址一致 + 可恢复)
IWB_VERIFY_STRICT=1 node scripts/verify-release.js
bash scripts/publish-update.sh # 重新构建并把 latest.json 指回该版本
```
> ⚠️ 本项目已转桌面客户端:**不再用 `wrangler pages deploy`**,发版走 `./scripts/publish-update.sh`(macOS)/ `./scripts/publish-windows-update.sh`(Windows)。
> 回滚时**不要**把旧代码 push 到 main(会污染历史);用 `checkout` 部署即可,
> 部署完 `git checkout main` 回到主干。
## 回滚(Windows)
### 场景 B:干活把 main 弄坏了,要回到「上次稳定」
1. Windows 端 `git checkout vX.Y.Z` 后重新构建 setup.exe
2. 放 NAS `_inbox/`,mac 端 `publish-windows-update.sh` 重签
3. 再跑 `publish-update.sh` 合并 latest.json
```bash
git log --oneline stable..main # 看看稳定之后多了什么
git checkout stable # 或:git reset --hard stable(会丢本地改动,慎用)
```
> `stable` = `909691f`(v3.24.0 生产等价点)。
### 场景 C:只想看某个版本改了什么 / 找回被删的代码
```bash
git show v3.24.0 --stat # 该版本改动的文件
git show v3.24.0:app.js | grep -n "wLog" # 找回某个版本的代码片段
git diff v3.23.0 v3.24.0 -- app.js # 两版之间的代码差异
```
---
## 4. 版本记录完整性审计(2026-10-27,诚实记录)
| 记录源 | 数量 | 说明 |
|---|---|---|
| `CHANGELOG.md` 的 `## vX.Y.Z` 条目 | **70** | 每版的改动说明 |
| git tag(`vX.Y.Z` 形式) | **125** | 可 checkout 的版本点 |
| GitHub Release | **67** | 带说明的发布页 |
**结论:近期版本(v3.20.1 → v3.24.0)三方齐全 ⇒ 还原能力完整。** 历史上有以下不对齐:
| 不对齐项 | 数量 | 影响 |
|---|---|---|
| 有 tag、但 CHANGELOG 无对应 `## v` 条目 | 68 | 多为 `3.8x` 历史线/测试迭代版本;**仍可 checkout 还原**,只是没有文字说明 |
| CHANGELOG 有、但没有 tag | 13 | `v3.83.0` / `v3.84.x` / `v3.85.x` / `v3.86.x` / `v3.87.x` 等 —— 当时是"测试迭代、已并入后续版本",未单独打 tag |
| CHANGELOG 有、但没有 GitHub Release | 17 | 同上 + `v3.0.2` / `v3.81.x` / `v3.82.0` |
> **这些不打算回补**(历史版本早已下线,补 tag 无法验证"当时线上跑的确实是它")。
> 记录在此是为了:以后要还原很久以前的版本时,**知道哪些有精确锚点、哪些只能靠 CHANGELOG 文字定位**。
### 4.1 tag 同步状态
```
本地 tag: 386 / 远端 tag: 386 / 差: 0 ✅ 2026-10-27 已把 4 个本地独有的 tag 推送上去
```
> 此前有 4 个只在本机(`v3.1.0-mt-pre-S1` / `v3.86.4-pre-panelfix` / `v3.86.5-pre-panelship` /
> `v3.86.5-pre-panelui`)—— 本机故障就会丢标签名(commit 虽在 main,但恢复不了"这个 tag 曾指向谁")。
> 已推送消除单点风险。
---
## 5. 安全性兜底(为什么"能还原"不是靠自觉)
项目有**两道机制**保证线上代码永远可恢复:
1. **推 main 需要口令**:`RELEASE=1 git push origin main`(本地 pre-push 钩子拦截误推)
2. **部署后严格核验**:`IWB_VERIFY_STRICT=1 node scripts/verify-release.js`
—— 校验「线上 commit 必须是 `origin/main` 的祖先」。
若不满足(即部署了本机独有、未推送的代码),**直接退出码 1 报错**。
> 这条机制挡过真事故:`npm run deploy` 不含 git push,
> 曾经出现过"部署了只存在于本机的代码" ⇒ 本机故障就永久丢失线上代码。
---
## 6. 每次发版要维护的记录(清单)
发完一个版本,确认这 5 项都做了:
- [ ] `package.json` 版本已 bump(`npm version X.Y.Z --no-git-tag-version`)
- [ ] **事实基线锚点已同步**(`architecture-current-state.md` 第 4 行 `main = <SHA>`;否则 `test:facts` 打红)
- [ ] `CHANGELOG.md` 已写该版本条目(含部署后的 `version.json` 实际值)
- [ ] 四个标签已打并推送:`vX.Y.Z` / `stable-vX.Y.Z` / `stable`(移动)/ `stable-verified-YYYY-MM-DD`
- [ ] `gh release create vX.Y.Z` 已建(带说明)
---
## 7. 快速参考卡
```bash
# 现在线上是什么
curl -fsSL https://iwb.maqiart.eu.org/version.json
# 核验(三地址一致 + 可恢复)
IWB_VERIFY_STRICT=1 node scripts/verify-release.js
# 回到某版本并部署
git checkout v3.23.0 && npm ci && npm run verify:ci && npm run deploy
IWB_VERIFY_STRICT=1 node scripts/verify-release.js
git checkout main
# 看某版本改了什么
git show v3.24.0 --stat
# 看两版代码差异
git diff v3.23.0 v3.24.0 -- app.js
```
---
## 7. 重构期的分步还原(多提交改造时用这一节)
> 版本级还原(§1 的 tag 表)解决的是"线上跑回旧版"。
> **重构期间更常见的是"某一步搬坏了,只想退这一步"** —— 用下面四层,从细到粗。
### 7.1 四层还原
| 层 | 手段 | 恢复时间 | 适用 |
|---|---|---|---|
| **1** | `git revert <单个提交>` | 秒 | 某一步搬错了,只退这一步,其他步保留 |
| **2** | 步骤 tag:每步绿了就 `git tag refactor-step-N` | 秒 | 退回某个**已知好状态**继续 |
| **3** | `git checkout stable-vX.Y.Z` 重部署 | 3–5 分钟 | 线上出问题,退回上个发布版 |
| **4** | Cloudflare 部署历史切回旧 deployment | 1–2 分钟 | 连代码都不想动,直接切旧部署 |
```bash
# 层 1:只退某一步(保留后续提交,最常用)
git revert --no-edit <bad-commit>
# 层 2:退到某个已知好的步骤
git log --oneline --decorate | head -20 # 找 refactor-step-N
git checkout refactor-step-3
# 层 3:整体退回上个发布版
git checkout stable-v3.24.5 && npm ci && npm run verify:ci && npm run deploy
# 层 4:看部署历史,用 dashboard 或 API 切回旧 deployment
# 桌面端没有「线上部署列表」:版本清单在 NAS 的 /vol8/web/iwb-download/updates/
```
### 7.2 铁律
1. **不用 `git reset --hard` / 不改写已推送历史** —— 一律 `git revert`,历史可查
2. **一步一提交**,一个组件/一个函数一次提交,message 写清"搬了什么、依赖宽度、怎么验证的"
3. 每步绿了就打 `refactor-step-N` tag(**成本零,收益极高**)
4. 重构期间 **`main` 始终可发布**(用分支做,绿了再合)
### 7.3 纯搬移的"等价证明"
纯搬移(把函数/组件从 A 文件搬到 B 文件、不改逻辑)可以用工具**证明**等价:
```bash
node scripts/verify-move.js --from <搬之前的提交> --name <函数名> --to <目标文件>
# ✓ 搬家等价 → 逐字(或仅空白差异)相同,只搬没改
# ✗ 搬家不等价 → 打印首个差异行
```
配合 `verify:ci` + `e2e 115` + `coverage:e2e 不降`,三者一起构成"搬移"的完整证据链。
桌面发布规范:[`docs/WIN_BUILD_SPEC.md`](WIN_BUILD_SPEC.md);工程规则 §13.60。
+8
View File
@@ -9,6 +9,14 @@
win 构建 setup.exe → win 自测通过 → 把 setup.exe 放到 NAS `_inbox/` → 通知 mac 端 → mac 签名 + 上传 + 登记 → win 用户可更新。
## 0.1 版本与 CRLF(2026-11-24 教训,v3.26.54/55)
- **版本号只认 `package.json`**:`node -e "console.log(require('./package.json').version)"`;文档里写死的版本一律视为历史示例。
- 拉取 `gitea/main` 后先跑 `npm run tokens:check`,再 `npm run app:build`。
- 若报 `src/design-tokens.css 与 derive() 不一致`:**先怀疑 Windows 检出把 CSS 转成了 CRLF**,不要直接 `tokens:write`。校验层(`gen-tokens.js` + `build.js`)自 v3.26.55 起已归一 `\r\n`;仍失败时把**第一处差异行**原样发回 mac 端。
- `.gitattributes` 的 `eol=lf` 只影响**新检出**,不会自动 renormalize 已存在工作区——所以不能只靠它。
- 不要改 `scripts/build.js` / `gen-tokens.js` 来绕过;构建脚本属于 mac 源码,改动先同步 mac 端。
**win 端永远不要自己签名。** 私钥只在 mac 的 `~/.config/iwb-updater.key`。win 自己签出来的 `.sig` key ID 与项目公钥不配对,客户端会拒绝安装(v3.25.31 发布时已踩过一次,win 放上来的临时 `.sig` 被 mac 端忽略重签)。
---
@@ -0,0 +1,129 @@
> ⚠️ **版本号以 `package.json` 为准**(下文的 3.25.1 仅为历史示例,不要照抄)。Windows 打包的现行权威流程见 `docs/WIN_BUILD_SPEC.md`;本文保留细节步骤供参考。
# Windows 出包步骤(手把手)
> **本版要打的版本:3.25.1**(仓库里已经是这个号,直接构建,不要再改)
>
> 确认命令:node -e "console.log(require('./package.json').version)" → 应输出 3.25.1
>
> 产物名:image-workbench_3.25.1_x64-setup.exe / image-workbench_3.25.1_x64_en-US.msi
> 目标:在一台 Windows 机器上,从 Gitea 拉代码 → 打出安装包 → 自测 → 把产物回传到 NAS。
## 0. 前置检查
- Windows 10 1803+ 或 Windows 11,**x64**
- 磁盘 ≥ 5 GB 空闲(Rust 编译产物较大)
- 有本地管理员权限(装 Visual Studio Build Tools 需要)
## 1. 安装工具链(一次性)
| 工具 | 命令 / 说明 |
|---|---|
| Git | `winget install Git.Git` |
| Node.js LTS(22) | `winget install OpenJS.NodeJS.LTS` |
| Rust | `winget install Rustlang.Rustup` 然后 `rustup default stable-x86_64-pc-windows-msvc` |
| **VS Build Tools 2022** | 勾选「**使用 C++ 的桌面开发**」(MSVC v143 + Windows SDK)——**最容易漏** |
| WebView2 Runtime | Win11 自带;Win10 没有就装 Evergreen |
自检:
```powershell
cd image-workbench-desktop
powershell -ExecutionPolicy Bypass -File scripts\windows-check.ps1
```
全部 `[OK]` 再做下一步。Rust 那行不能出现 `gnu`(必须 msvc)。
## 2. 取代码
```powershell
git clone https://git.maqiart.eu.org/malongan/image-workbench-desktop.git # 公网(公开库)
# 或内网/Tailscale:git clone http://192.168.100.185:3000/malongan/image-workbench-desktop.git
```
建议放 `C:\work\image-workbench-desktop`(避开长路径/中文路径)。
## 3. 安装依赖
```powershell
cd C:\work\image-workbench-desktop
npm ci
```
用 `npm ci`,不要 `npm install`。卡住就换 registry 或配代理。
## 4. 设版本号(三处必须一致)
```powershell
node scripts/set-version.js 3.25.0
```
同时改 `package.json` / `src-tauri/tauri.conf.json` / `src-tauri/Cargo.toml`。
版本必须比线上大,否则以后接自动更新时客户端不认。
## 5. 出包
```powershell
npm run app:build
```
内部顺序:`lint → build → 剥离内置插件 → tauri build`(lint 不过就不出包,故意的)。
产物:
| 文件 | 用途 |
|---|---|
| `src-tauri\target\release\bundle\nsis\image-workbench_3.25.0_x64-setup.exe` | **主推**(当前用户安装,免管理员) |
| `src-tauri\target\release\bundle\msi\image-workbench_3.25.0_x64_en-US.msi` | 企业环境用 |
| `src-tauri\target\release\image-workbench.exe` | 免安装单文件(目标机需 WebView2) |
首次构建 5~15 分钟,之后增量 1~2 分钟。
## 6. 自测(必须过)
1. 安装 → 启动
2. 数据目录生成:`%USERPROFILE%\Documents\ImageWorkbench`(data.json / canvases / library / images)
3. 设置→通用:「数据库目录」路径正确,「打开」能弹资源管理器
4. 关窗进程留托盘;左键托盘唤窗口;右键有菜单
5. 设置→插件:**无内置插件**;市场列 7 个;装一个 → 重启后可用
6. 画布新建/拖拽/缩放正常;导入图片正常
7. 点「下载」→ 直接落到导出目录,不弹另存为
## 7. 把产物传回来
**A. 传 NAS(局域网/Tailscale)**
```powershell
scp "src-tauri\target\release\bundle\nsis\image-workbench_3.25.0_x64-setup.exe" malongan@192.168.100.185:/vol8/web/iwb-download/updates/windows-x86_64/
```
**B. 传 Gitea Releases**(公开库匿名可下载)
**C. 发我**:我上传 NAS 并更新 `releases.json` 与下载页
## 8. 常见错误
| 报错 | 原因 | 解决 |
|---|---|---|
| `link.exe not found` | 没装 VS Build Tools C++ 工作负载 | 重装并勾「使用 C++ 的桌面开发」 |
| rustc 显示 `gnu` | 默认工具链错 | `rustup default stable-x86_64-pc-windows-msvc` |
| `Windows SDK is not installed` | SDK 缺失 | Build Tools 勾 Windows SDK |
| 启动报 WebView2 错误 | 缺运行时 | 装 Evergreen Runtime |
| `npm ci` 超时/证书 | 网络 | 换 registry / 配 proxy |
| 编译文件被占用 | 杀软扫描 target | 排除 `src-tauri\target` |
| 路径过长 | 目录太深 | 放 `C:\work\`;`git config --system core.longpaths true` |
| beforeBuildCommand lint 失败 | 代码有未定义变量 | 修代码,别绕过门禁 |
## 9. 当前状态
- **自动更新未启用**(updater 未装)⇒ Windows 包只能手动下载安装
- 下载页 Windows 位置现在显示「暂未提供」;传回后我加一条 `windows-x86_64` 就自动出现
- 插件不随包:新机器是零插件,需从市场装
## 10. 一句话流程
```
装工具 → git clone → npm ci → node scripts/set-version.js x.y.z
→ npm run app:build → 自测 7 条 → 传回 NAS/Gitea → 我更新下载页
```
@@ -0,0 +1,110 @@
> ⚠️ **历史任务书(v3.25.15)**:所有写死的版本号/commit 都是当时示例。现行流程见 `docs/WIN_BUILD_SPEC.md`;执行前以 `package.json` 版本与 `git rev-parse HEAD` 为准。
# 任务:在 Windows 上为 image-workbench-desktop 构建 v3.25.15 安装包
你是这台 Windows 机器上的打包执行者。只做打包与自测,**不改业务代码**。
> ⚠️ v3.25.15 起的变化:项目已**彻底转桌面客户端**(`_headers` / `functions/` / `wrangler.toml` 已删除,`npm run deploy` 脚本已移除);
> 更新清单**平台解耦**(Windows 用 `updates/latest-windows.json`,**由 Mac 侧用正式私钥生成,你不写**)。
## 硬性约束
1. 不改 `app.js` / `src/**` / `src-tauri/src/**` / `style.css` 的业务逻辑
2. 不绕过 lint 门禁;报错就停下报告
3. 不用 `npm install`,只用 `npm ci`;版本已定 **3.25.15**,不要改
4. 不 commit / 不 push / 不打 tag / 不跑任何 `scripts/publish-*.sh`
5. 不改 `src-tauri/tauri.windows.conf.json`(产物已锁 `nsis`,不要 msi)
## 第零步:拉代码
```powershell
git fetch --all --tags; git checkout main; git pull --ff-only
git rev-parse --short HEAD # 必须是 84c2c10 或其后代
node -e "console.log(require('./package.json').version)" # 必须 3.25.15
```
## 第一步:环境检查
```powershell
node -v; npm -v; rustc -V; rustup show active-toolchain
powershell -ExecutionPolicy Bypass -File scripts\windows-check.ps1
```
全部 `[OK]` 才继续;出现 `[缺失]` 停止报告(不要自行安装)。
## 第二步:依赖
```powershell
npm ci
```
本次新增两个 Rust 插件依赖(single-instance / notification),首次构建会多拉一些 crate。
## 第三步:构建(用一次性临时密钥签名)
```powershell
npx tauri signer generate -w "$env:TEMP\iwb-tmp.key" --password ""
$env:TAURI_SIGNING_PRIVATE_KEY = Get-Content "$env:TEMP\iwb-tmp.key" -Raw
$env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD = ""
npx tauri build
Remove-Item "$env:TEMP\iwb-tmp.key" -Force
```
> 产出的 `.sig` 是临时密钥签的,**我会在 Mac 上用正式私钥重签**,你附上即可。
## 第四步:确认产物
```powershell
Get-ChildItem src-tauri\target\release\bundle -Recurse -Include *.exe,*.sig | Select FullName,Length
Get-FileHash "src-tauri\target\release\bundle\nsis\image-workbench_3.25.15_x64-setup.exe" -Algorithm SHA256
Test-Path dist\plugins # 期望 False
Test-Path _headers # 期望 False
Test-Path functions # 期望 False
```
## 第五步:自测清单(逐条报通过/失败)
**基础**
1. 安装并启动;数据目录 `%USERPROFILE%\Documents\ImageWorkbench` 生成 `data.json`/`canvases`/`library`/`images`
2. **`images\` 下必须有 `canvas` 文件夹**(v3.25.12 之前只有 `thumbs`,这是丢图根因)
3. 设置 → 通用:数据库目录正确;「打开」能弹资源管理器
4. 关窗口进程仍在托盘;左键唤出;右键有菜单
**图片持久化(历史 bug 复现点)**
5. `Ctrl+V` 粘贴新图 → 出现图片节点
6. **正常退出**(托盘右键退出,非强杀)→ 重开 → 图仍在、显示正常
7. 从资源管理器拖图进画布 → 退出重开 → 图还在
**桌面壳(本次新增)**
8. 单实例:连续双击两次 → 只有一个窗口,第二次聚焦已有
9. 外链:点「项目主页」→ 用系统浏览器打开,应用不变(不能被导航成网页)
10. 跑一次生图,完成后弹系统通知
**插件与 CSP(本次修复)**
11. 设置 → 插件:无内置插件;市场能列 7 个;装一个 → 重启后可用
12. **鲜艺抠图**:启用后对图片节点执行抠图 → **不应出现 `Failed to fetch`**(3.25.11 回归,3.25.14 已修)
13. 若本机有 `XianyiAiRmbg` 监听 `0.0.0.0:30092` → 抠图出透明底;没装则注明跳过
**外观(本次新增)**
14. 设置 → 外观:改画布底色(亮/暗)与主题色 → 立即生效,重启保持
15. 亮暗切换时画布底色分别用两套值
任何一条失败:记录现象 + 截图后停止报告,**不要改代码**。
## 第六步:交付格式
```
结论:成功 / 失败(卡在第 N 步)
版本:3.25.15 commit=<sha>
安装包:<路径> <大小> SHA256=<hex>
环境:node= rust= VS= WebView2=
自测:1✅ … 15✅(失败写 ❌ + 现象)
耗时:
```
产物留在本机;**不要**上传 NAS、**不要**写 `latest-windows.json`(我在 Mac 侧做)。
## 停止条件
commit 不对 / 环境缺件 / 构建报错一次重试无效 / 自测有失败 / 需要改业务代码 —— 遇到即停,
报告「卡在哪一步 + 完整报错 + 已尝试过什么」。
@@ -0,0 +1,107 @@
> ⚠️ **历史文档(2026-11-24 复核)**:本文描述的是**旧网页版** Pages 部署流程,桌面版已不再使用 `deploy` / `deploy:test`。桌面版发布见 `docs/WIN_BUILD_SPEC.md` 与 `scripts/publish-update.sh` / `publish-windows-update.sh`。
# 📦 发布规则(每次 push 前必查)
> ⚠️ **时效说明(2026-10-15 复核)**:本文档为发布流程说明;**其中「稳定标签」一段已就地更正**(见文末)。当前事实以 [`docs/standards/architecture-current-state.md`](docs/standards/architecture-current-state.md) 与规范 §10/§12/§13.6 为准。
> 复核确认的现行约束:发布**一律手动** `npm run deploy` / `npm run deploy:test`(**内含全量 `verify`,不得绕过**);本机**没有 wrangler OAuth 登录态**(`~/.config/.wrangler/config/` 为空,2026-10-31 复核),部署一律走 **API Token**(见「部署凭据」);三地址 `version.json` 必须一致;「部署成功」≠ 验收,须在**真实 URL** 跑关键 e2e。
## 红线(禁止入仓库)
1. **`data/` 目录永不入库** —— 含 API Key 配置、生成图片和运行数据。
2. **任何真实密钥/Token 不进任何文件** —— 代码只允许引用环境变量名或用户运行时输入。
3. **不推日志、临时文件**(`*.log`、`.DS_Store`、`node_modules`、`dist`、`test-results`)。
## 隐私检查
```bash
grep -rn "sk-[A-Za-z0-9]\{20,\}" --include="*.js" --include="*.json" --include="*.md" . | grep -v "^./data/"
grep -rn "/Users/\|/home/" --include="*.js" --include="*.json" --include="*.md" . | grep -v "^./data/"
git grep -n "sk-" $(git rev-list --all)
```
## 标准发布流程
1. 在 `package.json` 递增 SemVer 版本;构建会自动生成 `v<package-version>+<7位Git SHA>`,并用 esbuild 压缩打包成单个 `dist/app.js`(`src/` 模块按序拼接进 `app.js`,`dist/` 无 `src/`)。
> ⚠️ **bump 版本后必须同步「事实基线锚点」**(否则 `npm run test:facts` 会打红):
> 把 `docs/standards/architecture-current-state.md` 第 4 行的 `基线 main = <SHA>` 改成**本次 bump 版本的提交**的 SHA、
> `(线上 v<版本>+<SHA>)` 改成同一 SHA 与新版本号。守门第 7 组会校验这两项(规则见规则库 §13.36)。
> 该提交前 SHA 可用:`git log --format=%h -- package.json` 里逐个回看、比对版本值与父提交是否相同(**不要**用 `git log -S '"version"'`,它会命中无关的旧提交)。
2. 执行完整验证:
```bash
npm ci
npm run verify
```
3. 检查 `dist/version.json`、`git diff --check` 和敏感信息扫描。`npm run verify` 已含 `node --check dist/app.js` 与 `node scripts/check-dist.js`(产物体检);`verify-release.js` 读 `/version.json`(不再抓 `app.js` 的 `APP_VERSION`,压缩会破坏该正则)。
4. 提交并推送 + 打四类标签:
```bash
git add -A
git commit -m "release: vX.Y.Z"
git push origin main
git tag -a vX.Y.Z -m "vX.Y.Z"
git tag -a stable-vX.Y.Z -m "stable release vX.Y.Z"
git tag -f stable HEAD && git push -f origin stable
git tag -a stable-verified-$(date +%F) -m "stable-verified $(date +%F)"
git push origin vX.Y.Z stable-vX.Y.Z stable-verified-$(date +%F)
gh release create vX.Y.Z --notes-file <notes.md>
```
> ⚠️ **推 main 需确认口令**(免费版私有仓库无 GitHub 分支保护,靠本地 pre-push 钩子拦误推):
> `RELEASE=1 git push origin main`。
> **部署前必须确认 `git rev-parse HEAD` 已在 `origin/main` 中** —— 否则会部署一份**只存在于本机**的代码(见下方第 6 步)。
5. 部署:**本仓库采用手动发布** —— `npm run deploy`(正式)/ `npm run deploy:test`(测试站)。CI(`.github/workflows/verify.yml`)只做 `verify` 门禁、**不自动部署**。
> ⚠️ `npm run deploy` = `verify` + `wrangler pages deploy`,**不含 git push**。推送与部署是两步,顺序上先推后部署。
6. 发布后验证(**三地址版本必须一致 + 线上代码必须可从远端恢复**):
```bash
IWB_VERIFY_STRICT=1 node scripts/verify-release.js # 三地址 version 一致 + 线上 commit 是 origin/main 的祖先
curl -fsSL https://iwb.maqiart.eu.org/version.json
```
> **为什么必须用严格模式**(2026-10-20 实测事故):当天线上跑的是 `f414fd8`,而 `origin/main` 仍是 `7a48e4b` ——
> 那 4 个 commit **不在任何远端 ref 上**。根因是 `npm run deploy` 不含 push,而本流程把 push 写在第 4 步 ——
> **顺序没错,但没有校验「push 的 commit == 部署的 commit」是否真的成立**,于是部署了没推送的代码。
> 后果:本机故障 / 误 reset ⇒ 线上正在跑的代码**永久丢失**,回滚只能退到 `stable`。
> 严格模式把「事后才发现」变成「当场拦截」:线上 commit 必须是 `origin/main` 的祖先,否则报错退出码 1。
> (不会误报 docs-only 提交:那种情况下线上 commit 是上一个**代码**提交,它仍在 `origin/main` 的历史里。)
> 紧急修复必须先部署后 push 时,**push 必须在同一操作序列内立即完成**,并事后补跑严格模式核验。
## 部署凭据(2026-10-28 实测补全,2026-10-31 订正)
**本机没有 wrangler OAuth 登录态**(`~/.config/.wrangler/config/` 为空),
此前文档写的「OAuth 会过期」已不适用 —— 部署**一律走 API Token 模式**:
```bash
export CLOUDFLARE_API_TOKEN=$(security find-generic-password -a qiqi -s CLOUDFLARE_PAGES_TOKEN -w)
# account id:见下方说明,二选一
export CLOUDFLARE_ACCOUNT_ID="<32 位 hex>"
npm run deploy:test # 测试站;正式站用 npm run deploy
```
> ⚠️ **`npx` 必须带 `--yes`(2026-10-31 事故)**:`wrangler` 不在 devDependencies 里,
> `npx wrangler` 依赖 npx 缓存;一旦 npm 上 `wrangler@latest` 超过缓存版本(如 4.114.0 → 4.156.0),
> npx 会问「Need to install [email protected]? (y)」,**在 TTY(有人值守的终端)里会一直等输入**,
> 表现为「`verify` 跑完了但部署卡住不动」。非 TTY 环境(多数 agent / CI)不提示、直接装,
> 所以这个坑只在交互式终端复现。`package.json` 的 `deploy` / `deploy:test` 与
> `scripts/plugins-publish.sh` 均已固定 `npx --yes wrangler`,**新增脚本请照抄**。
**account id 从哪来**(它**不是密钥**,是账号标识):
- 钥匙串和 `secrets list` 里**只有 token,没有 account id**;
- `wrangler.toml` 里那个 32 位 hex 是 **KV namespace id**,不是 account id;
- API `GET /client/v4/accounts` 对 Pages 作用域的 token 返回**空列表**(不等于 token 无效);
- ✅ **可靠来源:git 历史里旧的 `wrangler.toml`**:
```bash
git log --all --format=%H -S "account_id" -- wrangler.toml | tail -1 # 最早含它的提交
git show <commit>:wrangler.toml | grep account_id # 读出 32 位 hex
```
> 本次实测:account id 为 `47d69874…`(32 位 hex)。**建议把它存进钥匙串**:
> `security add-generic-password -a qiqi -s CLOUDFLARE_ACCOUNT_ID -w '<id>'`
> —— 这样以后不用每次翻 git 历史。
**验证 token 可用(只读,不部署)**:
```bash
npx wrangler pages deployment list --project-name image-workbench-web
```
能列出部署记录 = token + account id 都正确。
## 回滚
> **权威还原步骤见 [`docs/RELEASES.md`](docs/RELEASES.md)**(含当前线上状态、各版本 tag→commit 对照、三种还原场景)。本节只作流程要点。
**稳定标签(2026-10-15 更正)**:现行体系为 `vX.Y.Z`(GitHub Release)+ `stable-vX.Y.Z` + **移动可变 `stable`**(2026-10-15 指向 `682554d`)+ `stable-verified-YYYY-MM-DD`(验证留痕)。语义以规范 §10 与 [`docs/standards/architecture-current-state.md`](docs/standards/architecture-current-state.md) 为准;历史锚点示例:`stable-v3.1.0-stability3`、`stable-v3.3.0` 等。出现问题时可回滚到对应标签重新构建并发布,不覆盖历史。
+433
View File
@@ -0,0 +1,433 @@
> ⚠️ **历史文档(2026-11-24 复核)**:本文是旧网页版 Pages/测试站记录,不代表桌面版现状。桌面版版本记录见 `CHANGELOG.md`,发布/回滚见 `docs/WIN_BUILD_SPEC.md` 与 `docs/standards/engineering-rulebook.md` §13.60。
# 版本记录与还原(RELEASES)
> **用途**:出问题时**怎么快速、准确地还原**。这是还原的唯一权威入口。
> **最后核对:2026-11-16** · 基线 `main = 7df9dc4`(v3.24.85 的文档提交,也是**正式站与测试站**实际运行提交;bump 提交是 `4be78c0`)| 三地址版本号一致 `v3.24.85`(`IWB_VERIFY_STRICT=1` 核验通过 ⇒ `stable` = `7df9dc4`)
> **注意 `+commit` 后缀天然可以不同**:若发版后又有 docs-only 提交并重发,正式站与测试站的 `+commit` 会分叉(v3.24.84 时即正式站 `c8b7543` / 测试站 `7d6ff6c`);本版两者部署的是同一份 `dist/`,故后缀相同。
> 一致性比较只看版本号,2026-11-14 已修 `verify-release.js`(此前用完整串比较,导致每次发版必误报)。
> **v3.24.80 的正式发布延迟到 2026-11-14 07:20**:11-13 23:25 首次发布撞上 Cloudflare 官方事故(**Workers API availability**,Pages 全系 API 返回 `503 no healthy upstream`),连续 20+ 次重试均失败;期间正式站**保持 `v3.24.79+8598a57` 未动**,用户无感。API 恢复后用**同一份门禁通过的产物**(`v3.24.80+2d584a6`)补发,未重跑 e2e。
>
> 配套文档:[`CHANGELOG.md`](../CHANGELOG.md)(每版改了什么)· [`PUBLISHING.md`](../PUBLISHING.md)(怎么发版)
---
## 0. 现在的线上是什么?(30 秒确认)
```bash
cd ~/open/github/image-workbench-web
# ① 线上实际在跑什么(三地址应一致)
curl -fsSL https://iwb.maqiart.eu.org/version.json
curl -fsSL https://image-workbench-web.pages.dev/version.json
curl -fsSL https://test.image-workbench-web.pages.dev/version.json
# ② 一条命令做「三地址一致 + 线上代码可从 origin/main 恢复」双重核验
IWB_VERIFY_STRICT=1 node scripts/verify-release.js
```
**2026-11-16 实测结果(v3.24.85 · 代码体检收口)**:
| 地址 | 版本 |
|---|---|
| `https://iwb.maqiart.eu.org`(正式/自定义域名) | `v3.24.85+7df9dc4` |
| `https://image-workbench-web.pages.dev`(正式) | `v3.24.85+7df9dc4` |
| `https://test.image-workbench-web.pages.dev`(测试) | `v3.24.85+7df9dc4` |
✅ **三地址一致** `v3.24.85+7df9dc4`,`IWB_VERIFY_STRICT=1` 核验「线上代码可从 `origin/main` 恢复」通过。
本版测试站与正式站部署的是**同一份 `dist/`**(`7df9dc4`),故三地址 `+commit` 后缀也相同。
上一版 v3.24.84 = 正式站 `v3.24.84+c8b7543` / 测试站 `v3.24.84+7d6ff6c`(后缀分叉是因为发版后又有一个 docs-only 提交并重发了测试站)。
(`verify-release.js` 于 2026-11-14 修过一次:旧实现比较完整串,于是每次 docs-only 提交后发版都误报「三地址不一致」。)
---
**2026-11-14 实测结果(v3.24.80 · 兜底保存 rev 修复)**:
| 地址 | 版本 |
|---|---|
| `https://iwb.maqiart.eu.org`(正式/自定义域名) | `v3.24.80+2d584a6` |
| `https://image-workbench-web.pages.dev`(正式) | `v3.24.80+2d584a6` |
| `https://test.image-workbench-web.pages.dev`(测试) | `v3.24.80+2d584a6` |
✅ **三地址一致** `v3.24.80+2d584a6`,`IWB_VERIFY_STRICT=1` 核验「线上代码可从 `origin/main` 恢复」通过。
正式站产物 `app.js` 的 SHA-256 与本地 `dist/app.js` 一致(`6308e5b8…`)⇒ 线上跑的就是这次构建。
(核验时 `image-workbench-web.pages.dev` 首轮报 TLS 握手断开,重试一轮即收敛 —— `pages.dev` 首轮抖动是该地址的已知现象。)
正式站本次从 `v3.24.79` 到 `v3.24.80`(单版)。本次改动(相对 v3.24.79):
修「离开页面的兜底保存不递增 rev」——`flush()`(`beforeunload` / `pagehide` / `visibilitychange`)原先把
**旧 rev 原样写回**,而其它标签页靠轮询 rev 变化判断同步,rev 不动 ⇒ A 标签关闭/切后台前的最后一次修改
对 B 标签不可见,下一秒就被 B 的保存洗掉;改成 `((read().rev || 0) + 1)`,与标准保存路径 `wApi('workspaces')`
的 `prev.rev + 1` 对齐。另删死代码 `createWBFlushViewport`(17 行,全仓无调用)与根目录误提交的空文件 `0`。
本次**不做**的三项及其实测依据见 `BACKLOG §4.5`(autoGrow 强制布局实测 68→67ms 无收益、OUT_KEY 竞态诊断有误、
`renderBody` 1,600 次查无实据)。
(v3.24.79 发版记录 · 上一版)正式站从 `v3.24.78` 到 `v3.24.79`(单版):
用户报「设置 → 生图服务 → 服务器地址测速三个地址全 ✗ 失败」。四步定责后确认与服务、网络、Key 都无关:
`POST /v1/images/generations` 有 `access-control-allow-origin`,而 `GET /v1/models` 的真实响应**一个 CORS 头都没有**
(只有 `OPTIONS` 预检有)—— 测速打的是简单请求,**不触发预检**,响应无 ACAO 就被浏览器拦在读结果那步。
改法:测速逻辑搬进 `src/generation-provider-ping.js`,分段判定「普通请求 → 失败退一次 `no-cors`」、
**超时不重试**(否则 6s 变 12s 像卡死)、失败必须带原因;实测三地址 147 / 148 / 148ms。
(回滚点:`stable-v3.24.79` → `8598a57`、`stable-v3.24.78` → `aaa9112`。)
---
## 1. 近期版本对照表(可直接用来还原)
> **未单独打 tag 的版本**:`v3.24.45`(撤回位图转矢量、收回 `wasm-unsafe-eval`,`f9c2211`)与
> `v3.24.46`(位图转矢量 v0.2 换 potrace,`23065d2`)**只发过测试站、从未打 tag**,
> 其内容已包含在 `v3.24.47`(`7ef8141`)内 ⇒ 还原到 v3.24.47 即等于包含这两版。
> 同理 `v3.24.37` ⊂ `v3.24.38`、`v3.24.39` ⊂ `v3.24.40`、`v3.24.34`/`v3.24.35` ⊂ `v3.24.36`。
> **2026-11-06 补齐**:表中新增 `v3.24.30/31/32/41`(此前有 tag、有 Release,但表里缺行 —— 会让人以为无法还原)。
> **2026-11-09 补齐**:表中新增 `v3.24.50~55/57/58`(此前有 tag、有 Release,但表里缺行);
> `v3.24.56`(`ce2845d`)与 `v3.24.59`(bump `77154ac`,测试站试色版)**未打 tag**,
> 内容分别并入 `v3.24.57` 与 `v3.24.60` ⇒ 还原到后一版即等于包含它。
> **2026-11-11 补齐**:表中新增 `v3.24.61~63`(此前有 tag、有 Release,但表里缺行);
> `v3.24.64`(bump `2d83a13`)**未单独打 tag**,测试站验收时发现问题,内容并入 `v3.24.65`。
> **2026-11-11 二次发布**:`v3.24.68`/`v3.24.69` 先在测试站验收、**补打了 tag**(`63493b2`/`e4cb049`),
> 三版一起由 `v3.24.70` 上正式站 ⇒ 还原到 `v3.24.70`(`a3dfad5`)即等于包含 68/69 的全部内容。
> **2026-11-12 六版合并发布**:`v3.24.71~75` 先在测试站验收、各有 tag 与 GitHub Release,
> 六版一起由 `v3.24.76` 上正式站 ⇒ 还原到 `v3.24.76`(`e660a75`)即等于包含 71~75 的全部内容。
| 版本 | tag → commit | 发布日期 | GitHub Release | 说明 |
|---|---|---|---|---|
| **v3.24.85** | `7df9dc4`(线上实际运行;bump 提交 `4be78c0`) | 2026-11-16 | ✓ | 代码体检收口(不改可见行为):① 棘轮收回 `Workbench()` 3,090→**2,998**、上限降到 **3,030**(留 32 行余量)—— 生成取消族与工作区列表写回族搬进 `src/runtime-workbench-logic.js`,删零调用的死代码 `runAll`;② 图库索引 4 条**绕过门面锁**的写路径(`imageFolderSync` / `storeOutputThumb.idxSet` / 备份 `restore` / `wPurgeOutputOriginals`)收口到新增的 `mutate(fn)`,治「两个标签页同时归档 ⇒ 图库莫名少条目」;③ 文档数字校准(线上版本、app.js 行数/占比、模块数、单测数、钉点数) |
| **v3.24.84** | `c8b7543`(bump 提交 `5d0b169`) | 2026-11-14 | ✓ | 生图节点连了 3 条上游只出 1 个任务 ⇒ 任务身份改用 `ownerNodeId`(本节点自己,不随继承冒泡):连几条线就几个任务,`relay` 仍归约到真实文本来源(同一来源多路径抵达只算一次,防重复计费);任务标题兜底加 `data.name`。同批:任务卡标题统一「任务 N · 来源名」、`verify-release.js` 的三地址一致不再被 `+commit` 后缀误判 |
| **v3.24.83** | `73748f7`(线上实际运行;bump 提交 `0a27a42`) | 2026-11-14 | — | ① 插件节点冷启动不再退化成一段文本:插件节点体是异步注册的,`registerNodeType` 在 `render` 由无变有时自增 `NODE_TYPES_REV`,`NodeCard` 比它 ⇒ 注册那一刻重建一次;`canvas-normalize` 按命名规则认作已知类型、不再降级写回存档(配套插件 `style-source` 1.3.2 改为脚本执行时注入样式)。② 画布底栏加「缩小 / 放大」两个图标(放在「适应」左边,一档 15%,锚点=画布中心),缩放数学抽成 `IWBCanvasGeometry.zoomStep` 纯函数与快捷键共用。③ 补记 v3.24.81/82 漏记的三处棘轮 |
| **v3.24.82** | `ef6cf42` | 2026-11-14 | ✓ | 提示词/文本节点显示上游继承文本(自己 `data.text` 为空时显示上游那段话,改一个字即接管,另有「恢复跟随」);修 `nodeRefsOf` 的 textout 分支只认 llm/batch/combine 上游导致「样式 → 文本 → 分层」丢参考图 |
| **v3.24.81** | `dba71e3` | 2026-11-14 | ✓ | 插件节点可自定义节点体(`render(node, props, host)` 画真实 DOM,宿主不每帧重建 ⇒ 输入框不失焦);节点自带参考图(`data.refOn/refUrl`);连线白名单按 `data.outKind === 'prompt'` 归一化 |
| **v3.24.80** | `2d584a6`(线上实际运行;bump 提交 `9d77ec9`) | 2026-11-14 | ✓ | 离开页面的兜底保存不递增 rev:`flush()`(`pagehide` / `visibilitychange` / `beforeunload`)写回旧 rev ⇒ 其它标签页轮询看不到末次修改,A 标签关掉前的改动会被 B 的保存洗掉;改成 `((rev\|\|0)+1)` 对齐标准保存路径。另删死代码 `createWBFlushViewport`(17 行)与根目录误提交的空文件 `0`;e2e 补「rev 恰好 +1」断言(两条兜底路径) |
| **v3.24.79** | `8598a57`(bump 提交 `9f49184`) | 2026-11-12 | ✓ | 服务器地址测速全红修复:服务端 CORS 只配在预检与生图 POST 上,`GET /models` 无 ACAO ⇒ 改「普通请求失败后退一次 `no-cors`」+ 超时不重试 + 失败带原因;`generation-provider-ping.js` + 29 条单测 |
| **v3.24.78** | `aaa9112` | 2026-11-12 | ✓ | LOD 拆三档:15% 以上画代表图 / 首行文字,15% 以下才退成 CSS 占位(v3.24.77 一并上线);`lodModeOf` + 13 条判据断言 + 5 条 e2e |
| **v3.24.77** | `0602388` | 2026-11-12 | ✓ | LOD 判据换成节点屏幕宽度:800 节点切画布 488 → 198ms、textarea 186 → 0;只发过测试站,内容包含在 v3.24.78 |
| **v3.24.76** | `e660a75` | 2026-11-12 | ✓ | 钉点减法第二批:3 条 e2e 查出 3 个真缺陷(objectURL 从未释放 / 孤儿标签 session / 误回收打开标签的图);v3.24.71~75 一并上线 |
| **v3.24.75** | `47f41aa` | 2026-11-12 | ✓ | 同图去重:内容哈希,同一张图连粘两次只建一个节点;只发过测试站,内容包含在 v3.24.76 |
| **v3.24.74** | `ec1adb3` | 2026-11-12 | ✓ | 粘贴落点精确到像素(消掉 63px 偏移)+ 图片准入统一 `image-admit`;只发过测试站 |
| **v3.24.73** | `9c8a5fd` | 2026-11-12 | ✓ | 静默失败收口:用户动作的失败必须有红色回执 + 规则库立规;只发过测试站 |
| **v3.24.72** | `45aa6a0` | 2026-11-12 | ✓ | 钉点减法第一批:32 条源码钉点换成 DOM/运行时断言(537→505);只发过测试站 |
| **v3.24.71** | `cc5c3e2` | 2026-11-12 | ✓ | app.js 总量棘轮改为双层预算(8,700 + 占比 40%)+ 覆盖率复算入档;只发过测试站 |
| **v3.24.70** | `a3dfad5`(线上实际运行) | 2026-11-11 | ✓ | 修「复制粘贴突然不起作用」:焦点在节点输入框的两条静默通道;v3.24.68/69 一并上线 |
| **v3.24.69** | `e4cb049` | 2026-11-11 | ✓ | 粘贴落点跟随鼠标(推翻 v3.24.68 的「不跟鼠标」);只发过测试站,内容包含在 v3.24.70 |
| **v3.24.68** | `63493b2` | 2026-11-11 | ✓ | 统一剪贴板:Ctrl+C 同时写系统剪贴板,Ctrl+V 一个键管到底(含节点组);只发过测试站,内容包含在 v3.24.70 |
| **v3.24.67** | `0f8d677`(线上实际运行) | 2026-11-11 | ✓ | 剪贴板语义收口(`Ctrl+V` 只认系统剪贴板 / 粘贴不下载 / 修 7 个静默缺陷)+ 积压四版合并上线 |
| **v3.24.66** | `b247375` | 2026-11-11 | ✓ | 参考图准入统一收口:图库插入 / 图库拖入 / 拖入链接也把 SVG 转 PNG |
| **v3.24.65** | `02cbd59` | 2026-11-11 | ✓ | 三处预览/图库下载后缀仍为 `.png` + SVG 复制到剪贴板必失败(含 `v3.24.64`:下载/归档后缀跟随真实格式) |
| **v3.24.63** | `6c4a8aa` | 2026-11-10 | ✓ | 棘轮恢复零余量 + 文档口径统一(纯工程收尾,界面无变化) |
| **v3.24.62** | `80f6b0c` | 2026-11-10 | ✓ | 测试安全网:设置 CRUD(e2e)+ 核心链路纯函数单测 |
| **v3.24.61** | `7b02ccf` | 2026-11-10 | ✓ | 设置面板拆分(`SettingsModal` −54%)+ 存储写路径留痕 + 版本记录守卫 |
| **v3.24.60** | `bff766d` | 2026-11-09 | ✓ | 节点气泡恢复删除按钮(单选 + 多选组气泡;静态灰 / hover 红,`Ctrl+Z` 可撤销)+ 两条防误删门禁改写 |
| **v3.24.58** | `33b9dc4` | 2026-11-08 | ✓ | 数据一致性:多标签图库同步 + Web Locks 串行化 + 导入防原型污染 + 写失败留痕 |
| **v3.24.57** | `3b0c652` | 2026-11-07 | ✓ | 存储可信度收尾:只读体检 + 一键安全回收 + 还原后校验 |
| **v3.24.55** | `86a931f` | 2026-11-07 | ✓ | 数据安全收尾:导出备份提醒 + 配额可见 + 备份体积护栏 + 部署钉版 |
| **v3.24.54** | `aa17527` | 2026-11-07 | ✓ | 持久化存储(`navigator.storage.persist`)+ 错误留痕 + PWA 可安装 + 自动备份 |
| **v3.24.53** | `87ddf7b` | 2026-11-07 | ✓ | 开发体验与类型安全:事实同步器 + 统一源文本 + 渐进类型检查(`tsc --checkJs`) |
| **v3.24.52** | `479695b` | 2026-11-07 | ✓ | `Workbench` 组件化收口(阶段一样板,−68 行) |
| **v3.24.51** | `46981ec` | 2026-11-07 | ✓ | 工程质量专项:存储入口收敛 + e2e 去固定等待(纯内部重构,界面无变化) |
| **v3.24.50** | `e28e1f4` | 2026-11-06 | ✓ | `Workbench` 拆分(累计 **−914 行**)+ 全仓健康度分析 |
| **v3.24.49** | `61a0af9` | 2026-11-06 | ✓ | 拖动画布松手丢最后一小段位移(「平移末帧提交」原是死代码)+ 门禁补「加载期跨模块依赖顺序」守卫 |
| **v3.24.48** | `f775dd5` | 2026-11-06 | ✓ | LLM 连不上:`normalizeEndpointBase` 剥掉 Base URL 里误粘的 `/chat/completions` 等接口路径(老配置自动纠正)+ 测试前提示未保存 |
| **v3.24.47** | `7ef8141` | 2026-11-05 | ✓ | 内存专项:修掉「轮询同步自激重水合」(内容签名 + 12s 自保存窗口)+ 水合分批 |
| **v3.24.44** | `33a94e0` | 2026-11-04 | ✓ | 输出图片顺序跟随任务卡(组序锚定任务顺序 + 组内按变体序号)+ 旧图排最后并标注 |
| **v3.24.43** | `3af2a3b` | 2026-11-04 | ✓ | 复制节点右侧/下方就近让位(零重叠)+ 修 `refs.measuredH` 清空后永不回填 |
| **v3.24.42** | `33a906a` | 2026-11-04 | ✓ | 任务行动效重做(一次性扫光 + 呼吸描边,删假进度条)+ 版本更新提示移到画布上方 |
| **v3.24.41** | `a41ec2a` | 2026-11-03 | ✓ | 输出节点的图不再「自己掉」:结果精简落盘 + 只在断连时丢 |
| **v3.24.40** | `037cda5` | 2026-11-03 | ✓ | 放大编辑:多级列表保真(不再拍平)+ 有序列表入口 + Tab 升降级 + 清除格式可 Ctrl+Z 撤销,含 3.24.39 的行距修复与工具条中文化 |
| **v3.24.38** | `b3fe448` | 2026-11-03 | ✓ | 资源中心「开合 + 标签页」双持久化(刷新后不再关面板、不再跳回提示词库),含 3.24.37 内容 |
| **v3.24.36** | `0434411` | 2026-11-02 | ✓ | 拖放落点就近吸附(空处不偏移、压住节点则贴到最近空位,20px 间隙)+ 承 34/35 的浮层避让与拖拽插入 |
| **v3.24.35** | `7e83fb4` | 2026-11-02 | — | 插件可「拖到画布上松手」建节点:宿主开放 `screenToWorld`,`createImageNode` 支持显式坐标(插件 style-source 1.2.0) |
| **v3.24.34** | `141e487` | 2026-11-02 | — | 新增节点避开浮层:`.iwb-fullmask` / `.iwb-wsrail` / `.iwb-lib` 当禁区,不再插到插件面板底下 |
| **v3.24.33** | `a855145` | 2026-11-01 | ✓ | 提示词放大编辑(所见即所得)+ 气泡并入分组 + 图标统一 |
| **v3.24.32** | `6d1079e` | 2026-11-01 | ✓ | 工具栏新增节点落在当前视口中心 |
| **v3.24.31** | `afe1de3` | 2026-11-01 | ✓ | 背景色交互重做(悬停预览 / 点击确认)+ 画布细节统一 |
| **v3.24.30** | `74a5c18` | 2026-11-01 | ✓ | 节点背景色(8 色 · 三入口 · 同色系内层 · 亮/暗两套配色) |
| **v3.24.29** | `774310d` | 2026-10-31 | ✓ | 组内多选不再显示「编组」+ 编组/解组换文件夹图标 + 组框留白 28、圆角 18 |
| **v3.24.22** | `de69761` | 2026-10-31 | ✓ | 文档事实数据全量校准(无功能变更):健康表/钉点/覆盖率/测试数按实测重写 + 棘轮上限按实测收紧 |
| **v3.24.21** | `9566171` | 2026-10-31 | ✓ | 插件面板切 tab 串页修复 + 资源中心标题栏尺寸显示移除 |
| **v3.24.20** | `44ab72a` | 2026-10-31 | ✓ | 模型设置面板重做 + 图库参考图修复 + 组合分隔符/文本入口恢复 |
| **v3.24.19** | `3f8ad60` | 2026-10-30 | ✓ | 节点图标更新 + 文本节点屏蔽 + 气泡贴合标题 |
| **v3.24.18** | `ad42b7a` | 2026-10-30 | ✓ | 「生图」改名「配置」+ 服务商/分组收进「模型设置」面板 |
| **v3.24.17** | `01025d1` | 2026-10-30 | ✓ | 图标按钮统一显示 2 字功能名(气泡/底栏/节点卡)+ 插件 appliesTo 收口到 ref |
| **v3.24.16** | `a3fbdc3` | 2026-10-29 | ✓ | 备份区去掉外框 + 入口收敛到设置面板(另两处菜单入口移除)|
| **v3.24.15** | `8198e6d` | 2026-10-29 | ✓ | 备份还原并入设置面板 + 修复设置/Key/模型还原不回来 |
| **v3.24.14** | `a8f35e0` | 2026-10-29 | ✓ | 补 app.js/Workbench 行数棘轮 + 落位规则(防结构回潮)|
| **v3.24.13** | `b7d8bee` | 2026-10-29 | ✓ | 再搬 6 个 Workbench 逻辑单元(app.js −262 行)|
| **v3.24.12** | `e9642cc` | 2026-10-29 | ✓ | Workbench 逻辑单元搬出(runNode/saveNow;app.js −449 行)|
| **v3.24.11** | `df4f360` | 2026-10-29 | ✓ | renderBodyInner 瘦身(app.js −579 行,行为零变化)|
| **v3.24.10** | `988ebbb` | 2026-10-29 | ✓ | 源码钉点换行为断言(app53 756→709,行为零变化)|
| **v3.24.9** | `2516738` | 2026-10-29 | ✓ | 移除「批量设置」(入口隐蔽且有选区被清空缺陷);死代码清理;5 个模块补 e2e |
| **v3.24.8** | `d4b9e77` | 2026-10-28 | ✓ | 移除 Tab 循环界面模式(会隐藏标签栏/工具栏,误按即像界面坏了)|
| **v3.24.7** | `2ce8ece` | 2026-10-28 | ✓ | 修复「标签栏/底栏消失且刷新不回来」(uiMode 不再持久化);清理 9 个未使用模块(377 行)|
| **v3.24.6** | `e41aab6` | 2026-10-28 | ✓ | 结构重构:`app.js` 12,477→10,603(−15.0%);7 步搬迁各带等价证明;修 3 个真实 ReferenceError;新增组件行数棘轮 |
| **v3.24.5** | `36e3f3e` | 2026-10-28 | ✓ | `Workbench()` −82 行;resume 变体过滤抽纯函数+穷举单测(锁住重复扣费);**e2e 产出覆盖率 → app.js 57.7%** |
| **v3.24.4** | `a6d1e11` | 2026-10-28 | ✓ | 依赖安全修复(audit 2 high→0)+ 覆盖率 28.3%→34.1%(**业务代码零改动**) |
| **v3.24.3** | `1b3ffcb` | 2026-10-28 | ✓ | 修复空备份 ZIP 无法解析(校验保留);附 `Workbench()` 拆分前置调研文档 |
| **v3.24.2** | `da24ffa` | 2026-10-28 | ✓ | 内部重构第二批:任务图回溯族 + ZIP 读写族(12 个成员外置;**备份链路首次纳入自动化保护**) |
| **v3.24.1** | `2040193` | 2026-10-28 | ✓ | 内部重构:拆 app.js 巨石第一批(16 个纯函数外置,**零行为变化**) |
| **v3.24.0** | `705b1f0` | 2026-10-20 | ✓ | 图库插入画布不塞整图 base64;刷新后双击可打开 |
| v3.23.0 | `e129398` | 2026-10-20 | ✓ | 资源中心交互优化 5 项 |
| v3.22.0 | `0581261` | 2026-10-20 | ✓ | 缩放手柄「隐形但可拖」+ 标题栏尺寸 |
| v3.21.0 | `7530b31` | 2026-10-20 | ✓ | 移除 Pinterest + Pages Function 补安全头 |
| v3.20.2 | `857908f` | 2026-10-19 | ✓ | 图片节点缩略图消失修复 |
| v3.20.1 | `0831d08` | 2026-10-19 | ✓ | — |
**特殊标签**:
| 标签 | 指向 | 含义 |
|---|---|---|
| `stable-v3.24.85` | 同 `stable` | 固定在 v3.24.85 的稳定标记(**当前回滚点**,commit `7df9dc4`) |
| `stable-verified-2026-11-16` | 同 `stable` | 「某天在线上实测通过」的留痕(该日已移到 v3.24.85) |
| `stable-v3.24.84` | `c8b7543` | 上一版(回滚点) |
| `stable-verified-2026-11-14` | `c8b7543` | 「某天在线上实测通过」的留痕(当日移到 v3.24.84) |
| `stable-v3.24.80` | `2d584a6` | 上一版(回滚点) |
| `stable-v3.24.79` | `8598a57` | 上一版(回滚点) |
| `stable-verified-2026-11-12` | `8598a57` | 「某天在线上实测通过」的留痕(当日移到 v3.24.79) |
| `stable-v3.24.78` | `aaa9112` | 上一版(回滚点) |
| `stable-v3.24.76` | `e660a75` | 上一版(回滚点) |
| `stable-v3.24.40` | 同 `stable` | 固定在 v3.24.40 的稳定标记 |
| `stable-verified-2026-11-03` | 同 `stable` | 「某天在线上实测通过」的留痕(本日已移到 v3.24.40) |
| `stable-v3.24.38` | `b3fe448` | 固定在 v3.24.38 的稳定标记(上一回滚点) |
| `stable-v3.24.36` | `0434411` | 固定在 v3.24.36 的稳定标记 |
| `stable-verified-2026-11-02` | `0434411` | 「某天在线上实测通过」的留痕 |
| `stable-v3.24.17` | `01025d1` | 固定在 v3.24.17 的稳定标记 |
| `stable-verified-2026-10-30` | `01025d1` | 「某天在线上实测通过」的留痕 |
| `stable-v3.24.16` | `a3fbdc3` | 上一版(回滚点) |
| `stable-v3.24.15` | `8198e6d` | 更早一版(回滚点) |
| `stable-v3.24.14` | `a8f35e0` | 更早一版(回滚点) |
| `stable-v3.24.13` | `b7d8bee` | 更早一版(回滚点) |
| `stable-v3.24.12` | `e9642cc` | 更早一版(回滚点) |
| `stable-v3.24.11` | `df4f360` | 更早一版(回滚点) |
| `stable-v3.24.10` | `988ebbb` | 更早一版(回滚点) |
| `stable-v3.24.9` | `2516738` | 更早一版(回滚点) |
| `stable-v3.24.8` | `d4b9e77` | 更早一版(回滚点) |
| `stable-v3.24.7` | `2ce8ece` | 更早一版(回滚点) |
| `stable-v3.24.6` | `e41aab6` | 更早一版(回滚点) |
| `stable-v3.24.5` | `36e3f3e` | 更早一版(回滚点) |
| `stable-v3.24.4` | `a6d1e11` | 更早一版(回滚点) |
| `stable-v3.24.3` | `1b3ffcb` | 更早一版(回滚点) |
| `stable-v3.24.2` | `da24ffa` | 更早一版(回滚点) |
| `stable-v3.24.1` | `2040193` | 更早一版(回滚点) |
| `stable-v3.24.0` | `705b1f0` | 更早一版(回滚点) |
---
## 2. ⚠️ 一个必须知道的惯例:tag 与「部署提交」差 1 个
**v3.24.0 的例子**:
```
047fae5 release: v3.24.0 ← 线上实际部署的是这个
705b1f0 docs(changelog): v3.24.0 发布记录… ← tag v3.24.0 指向这个
```
**这是项目既定流程**(先 bump → 部署 → 再写 CHANGELOG → 打 tag)。
**已实测验证:两者的运行时代码逐字节一致**:
```
app.js ✓ 完全一致 (blob 05ae6c5d)
style.css ✓ 完全一致 (blob b93e54c0)
package.json ✓ 完全一致 (blob 984d11c6)
src/ 整个树 ✓ 完全一致 (tree 7dd44626)
两个 commit 的差异只有:CHANGELOG.md、docs/standards/architecture-current-state.md
```
⇒ **回滚到 `v3.24.0` 重建产物 = 线上那份代码**。这个结论对每个版本都成立(tag 只在文档提交上)。
### 2.1 ✅ 还原演练(2026-10-27 对 v3.24.0 实做,方法对每个版本通用)
用**临时 git worktree** 在 `v3.24.0` tag 上独立重建,再与**线上实际产物**比对:
```bash
git worktree add /tmp/iwb-rb v3.24.0
cd /tmp/iwb-rb && node scripts/build.js # 从 tag 重建
curl -fsSL https://iwb.maqiart.eu.org/app.js -o /tmp/live-app.js
# 归一化两处「必然不同」的内容后再比:
# ① 首行 banner(含各自 commit SHA)
# ② APP_VERSION 常量(build 会注入 vX.Y.Z+<commit>)
```
| 产物 | 从 tag 重建 | 线上生产 | 结论 |
|---|---|---|---|
| `app.js`(归一化后) | `d4cb39ea2268a1df` | `d4cb39ea2268a1df` | ✅ **逐字节一致** |
| `style.css` | `d8f551e9a48f32ae` | `d8f551e9a48f32ae` | ✅ **逐字节一致** |
> 唯一差异是 build 注入的 `APP_VERSION`(`v3.24.0+705b1f0` vs `v3.24.0+047fae5`)——
> 那是**版本标记**,不是代码逻辑;部署后的 `version.json` 也会如实反映当前 commit。
**结论:还原是真的可行,已实测**。以后出问题可按 §3 场景 A 直接操作。
---
## 3. 还原操作(按场景选一种)
### 场景 A:线上出问题,要退回上一个版本(最常见)
```bash
cd ~/open/github/image-workbench-web
# 1) 看清要退到哪一版
git tag --list 'v3.*' | tail -10
git log --oneline -5 # 确认当前
# 2) 退到目标版本的**代码**
git checkout v3.23.0 # 或 stable / stable-v3.24.0
# 3) 重建并部署(注意:仅 checkout 不会改线上,必须部署)
npm ci
npm run verify:ci # 确认这一版的门禁是绿的
npm run deploy # 部署到正式站
# 4) 核验(三地址一致 + 可恢复)
IWB_VERIFY_STRICT=1 node scripts/verify-release.js
```
> ⚠️ 本项目已转桌面客户端:**不再用 `wrangler pages deploy`**,发版走 `./scripts/publish-update.sh`(macOS)/ `./scripts/publish-windows-update.sh`(Windows)。
> 回滚时**不要**把旧代码 push 到 main(会污染历史);用 `checkout` 部署即可,
> 部署完 `git checkout main` 回到主干。
### 场景 B:干活把 main 弄坏了,要回到「上次稳定」
```bash
git log --oneline stable..main # 看看稳定之后多了什么
git checkout stable # 或:git reset --hard stable(会丢本地改动,慎用)
```
> `stable` = `909691f`(v3.24.0 生产等价点)。
### 场景 C:只想看某个版本改了什么 / 找回被删的代码
```bash
git show v3.24.0 --stat # 该版本改动的文件
git show v3.24.0:app.js | grep -n "wLog" # 找回某个版本的代码片段
git diff v3.23.0 v3.24.0 -- app.js # 两版之间的代码差异
```
---
## 4. 版本记录完整性审计(2026-10-27,诚实记录)
| 记录源 | 数量 | 说明 |
|---|---|---|
| `CHANGELOG.md` 的 `## vX.Y.Z` 条目 | **70** | 每版的改动说明 |
| git tag(`vX.Y.Z` 形式) | **125** | 可 checkout 的版本点 |
| GitHub Release | **67** | 带说明的发布页 |
**结论:近期版本(v3.20.1 → v3.24.0)三方齐全 ⇒ 还原能力完整。** 历史上有以下不对齐:
| 不对齐项 | 数量 | 影响 |
|---|---|---|
| 有 tag、但 CHANGELOG 无对应 `## v` 条目 | 68 | 多为 `3.8x` 历史线/测试迭代版本;**仍可 checkout 还原**,只是没有文字说明 |
| CHANGELOG 有、但没有 tag | 13 | `v3.83.0` / `v3.84.x` / `v3.85.x` / `v3.86.x` / `v3.87.x` 等 —— 当时是"测试迭代、已并入后续版本",未单独打 tag |
| CHANGELOG 有、但没有 GitHub Release | 17 | 同上 + `v3.0.2` / `v3.81.x` / `v3.82.0` |
> **这些不打算回补**(历史版本早已下线,补 tag 无法验证"当时线上跑的确实是它")。
> 记录在此是为了:以后要还原很久以前的版本时,**知道哪些有精确锚点、哪些只能靠 CHANGELOG 文字定位**。
### 4.1 tag 同步状态
```
本地 tag: 386 / 远端 tag: 386 / 差: 0 ✅ 2026-10-27 已把 4 个本地独有的 tag 推送上去
```
> 此前有 4 个只在本机(`v3.1.0-mt-pre-S1` / `v3.86.4-pre-panelfix` / `v3.86.5-pre-panelship` /
> `v3.86.5-pre-panelui`)—— 本机故障就会丢标签名(commit 虽在 main,但恢复不了"这个 tag 曾指向谁")。
> 已推送消除单点风险。
---
## 5. 安全性兜底(为什么"能还原"不是靠自觉)
项目有**两道机制**保证线上代码永远可恢复:
1. **推 main 需要口令**:`RELEASE=1 git push origin main`(本地 pre-push 钩子拦截误推)
2. **部署后严格核验**:`IWB_VERIFY_STRICT=1 node scripts/verify-release.js`
—— 校验「线上 commit 必须是 `origin/main` 的祖先」。
若不满足(即部署了本机独有、未推送的代码),**直接退出码 1 报错**。
> 这条机制挡过真事故:`npm run deploy` 不含 git push,
> 曾经出现过"部署了只存在于本机的代码" ⇒ 本机故障就永久丢失线上代码。
---
## 6. 每次发版要维护的记录(清单)
发完一个版本,确认这 5 项都做了:
- [ ] `package.json` 版本已 bump(`npm version X.Y.Z --no-git-tag-version`)
- [ ] **事实基线锚点已同步**(`architecture-current-state.md` 第 4 行 `main = <SHA>`;否则 `test:facts` 打红)
- [ ] `CHANGELOG.md` 已写该版本条目(含部署后的 `version.json` 实际值)
- [ ] 四个标签已打并推送:`vX.Y.Z` / `stable-vX.Y.Z` / `stable`(移动)/ `stable-verified-YYYY-MM-DD`
- [ ] `gh release create vX.Y.Z` 已建(带说明)
---
## 7. 快速参考卡
```bash
# 现在线上是什么
curl -fsSL https://iwb.maqiart.eu.org/version.json
# 核验(三地址一致 + 可恢复)
IWB_VERIFY_STRICT=1 node scripts/verify-release.js
# 回到某版本并部署
git checkout v3.23.0 && npm ci && npm run verify:ci && npm run deploy
IWB_VERIFY_STRICT=1 node scripts/verify-release.js
git checkout main
# 看某版本改了什么
git show v3.24.0 --stat
# 看两版代码差异
git diff v3.23.0 v3.24.0 -- app.js
```
---
## 7. 重构期的分步还原(多提交改造时用这一节)
> 版本级还原(§1 的 tag 表)解决的是"线上跑回旧版"。
> **重构期间更常见的是"某一步搬坏了,只想退这一步"** —— 用下面四层,从细到粗。
### 7.1 四层还原
| 层 | 手段 | 恢复时间 | 适用 |
|---|---|---|---|
| **1** | `git revert <单个提交>` | 秒 | 某一步搬错了,只退这一步,其他步保留 |
| **2** | 步骤 tag:每步绿了就 `git tag refactor-step-N` | 秒 | 退回某个**已知好状态**继续 |
| **3** | `git checkout stable-vX.Y.Z` 重部署 | 3–5 分钟 | 线上出问题,退回上个发布版 |
| **4** | Cloudflare 部署历史切回旧 deployment | 1–2 分钟 | 连代码都不想动,直接切旧部署 |
```bash
# 层 1:只退某一步(保留后续提交,最常用)
git revert --no-edit <bad-commit>
# 层 2:退到某个已知好的步骤
git log --oneline --decorate | head -20 # 找 refactor-step-N
git checkout refactor-step-3
# 层 3:整体退回上个发布版
git checkout stable-v3.24.5 && npm ci && npm run verify:ci && npm run deploy
# 层 4:看部署历史,用 dashboard 或 API 切回旧 deployment
# 桌面端没有「线上部署列表」:版本清单在 NAS 的 /vol8/web/iwb-download/updates/
```
### 7.2 铁律
1. **不用 `git reset --hard` / 不改写已推送历史** —— 一律 `git revert`,历史可查
2. **一步一提交**,一个组件/一个函数一次提交,message 写清"搬了什么、依赖宽度、怎么验证的"
3. 每步绿了就打 `refactor-step-N` tag(**成本零,收益极高**)
4. 重构期间 **`main` 始终可发布**(用分支做,绿了再合)
### 7.3 纯搬移的"等价证明"
纯搬移(把函数/组件从 A 文件搬到 B 文件、不改逻辑)可以用工具**证明**等价:
```bash
node scripts/verify-move.js --from <搬之前的提交> --name <函数名> --to <目标文件>
# ✓ 搬家等价 → 逐字(或仅空白差异)相同,只搬没改
# ✗ 搬家不等价 → 打印首个差异行
```
配合 `verify:ci` + `e2e 115` + `coverage:e2e 不降`,三者一起构成"搬移"的完整证据链。
+66 -12
View File
@@ -305,19 +305,45 @@ hover 完全没反馈。改成 `color-mix(text 10%, transparent)` 后两个主
**回滚**:一批一个 commit,revert 即回。
### M5 闸门与治理(1d)
### M5 闸门与治理(1d)—— ✅ 已完成 2026-11-23(v3.26.50)
| ID | 任务 | 文件 | 规则 |
|---|---|---|---|
| T5.1 | `scripts/token-lint.js` | 新增 | 新增行出现裸 `#hex` / 裸 `px`(font-size、border-radius、padding、gap)→ 失败;四级白名单(内容色、布局尺寸、变量兜底、临时例外带到期版本) |
| T5.1 | `scripts/token-lint.js` | 新增 | 新增行出现裸 `#hex` / 裸 `px`(font-size、border-radius、padding、gap、margin)→ 失败;四条白名单(内容色、布局尺寸、变量兜底、临时例外带到期版本) |
| T5.2 | 棘轮基线 | `tests/fixtures/token-baseline.json` | 计数只降不升 |
| T5.3 | 完整性 + 自引用 | `tests/design-token-ratchet-test.js` | `var()` 目标必须存在;禁 `var(--x, var(--x))` |
| T5.4 | 对比度回归 | `tests/theme-contrast-test.js` | text 对 5 表面 ≥4.5;tertiary ≥3.0;on-brand ≥4.5 |
| T5.5 | 层级规则 | token-lint | 禁裸 `z-index`;插件不得超 `--iwb-z-popover` |
| T5.5 | 层级规则 | token-lint | 禁裸 `z-index`;插件不得超 `--iwb-z-anchor`(3200) |
| T5.6 | 接入 `verify:ci` | `package.json` | 三条命令失败即 CI 失败 |
| T5.7 | 流程文档落章 | `design-tokens.md` §5 | RFC 模板、9 步、弃用窗口、PR 三问 |
### M6 延展验证(0.5d)
**执行结果(2026-11-23,零观感)**:
| ID | 计划 | 实际 | 偏差与理由 |
|---|---|---|---|
| T5.1 | 新增行禁裸值 | ✅ `scripts/token-lint.js`,默认 diff HEAD、`--base` 查已提交批次、`--file` 整文件 | 加 `--file` 是因为迁移时要看整份文件;默认只看未提交改动,才符合「写的时候就知道」。**验证时发现 CSS 闸门看不见 JS 内联样式**(首启动弹窗里还留着 12.5px),遂扩到 `cssText` 与 React 内联对象两套判据 |
| T5.2 | 基线 JSON | ✅ 13 项计数(原计划只提了硬编码项,实际把「取值种数」也纳入) | 种数下降比处数下降更能反映「收敛」,且不会被「同一行写两个裸值」这种记账差异干扰 |
| T5.3 | 完整性 | ✅ 并入棘轮测试 | 同一份审计数据能同时判三件事,不必再开一个进程 |
| T5.4 | 5 表面 ≥4.5 | ✅ 实际断言 **114 对**,阈值直接取 `theme-tokens.js` 的 `RATIO`(text 7 / text2 4.5 / dim 3 / canvas 6) | 计划写的 4.5 是下限;实现里正文本来就夹到 7,按 7 断言更严且只有一个数字来源 |
| T5.5 | 插件不超 popover | ⚠️ **没有 `--iwb-z-popover` 这个 token** → 改用 `--iwb-z-anchor`(3200) | B2 的层级表里最接近的是 anchor;palette/alert 是宿主专属层,插件不该碰到 |
| T5.6 | 接 verify:ci | ✅ `tokens:check` 之后插 `lint:tokens`;两个新测试进 `test:unit` | 放进 `test:unit` 而不是单开一段,是为了让「孤儿测试」守卫自动覆盖到 |
| T5.7 | 文档 | ✅ §5.2/5.4/5.5/5.6 重写 + §1.12 执行记录 + S3 闸门表按实际命令改写 | 旧 §5 还写着 `--iwb-color-*` / `--iwb-gap-*` 这些**不存在的名字**,照着写会直接踩空 |
**反向验证**(三道闸门各自打红一次,确认不是「绿得不明不白」):
| 闸门 | 注入 | 结果 |
|---|---|---|
| token-lint | 8 行探针文件,含裸色/裸字号/裸 z-index/过期例外 | 6 处全部点名,含「例外已过期:raw-until=3.26.10」 |
| 棘轮 | `style.css` 追加 `font-size: 13px` | `font-size 写死 170 → 171(+1)` 立刻红,还原后绿 |
| 对比度 | 把 `clampAgainst` 短路成 `return fg` | 100+ 对跌破阈值(亮色 text × inset 2.97 vs 下限 7) |
**一个被证伪的直觉**:本想用「调坏某个 mix 权重」验证对比度守卫,改完却仍全绿 —— 因为 `clampAgainst` 会重新夹回阈值。这反过来证明夹紧机制有效,也说明守卫该防的是「有人删掉夹紧 / 把 token 写死成常数」,于是按这个失效模式重做了注入。
**计划外但必须现在做**:验证闸门时发现 CSS 闸门**看不见 JS 内联样式**,而 `src/storage-file.js` 的首启动「选择资料目录」弹窗是全仓唯一完全未 token 化的界面(`font-size:12.5px` / 白底 `#fff` / 主按钮 `#2563eb`,深色下是白盒子)。已一并处理:闸门扩到 JS(CSS 文本按 `px` 单位判、React 对象按 camelCase 判,避免误伤 `{ gap: 20 }` 这类布局参数),弹窗本身 token 化并给每个 `var()` 加字面兜底。
**留给 RFC 的一件事**:遮罩色 `rgba(18,20,26,.72)` 没有对应 token(全仓 3 处遮罩各写一份),硬凑 `bg`/`panel` 会让亮色主题出现浅色遮罩 —— 登记 `/*iwb:raw-until=3.28.0*/`,待 `--iwb-scrim` 的取值与消费者定案。
### M6 延展验证(0.5d)—— ✅ 已完成 2026-11-23(v3.26.51)
| ID | 任务 | 验收 |
|---|---|---|
@@ -325,6 +351,23 @@ hover 完全没反馈。改成 `color-mix(text 10%, transparent)` 后两个主
| T6.2 | 选 `plugin-batch-export`(15 处硬编码)改版并发一个 patch | 契约测试白名单移除该项;插件暗色正常 |
| T6.3 | 把这次的两份实现写成「接入案例」附在规范 §5.2 下 | 后来者照抄即可 |
**执行结果**:
| ID | 做了什么 | 验收实测 |
|---|---|---|
| T6.1 ✅ | 把 `style.css` 里 v3.26.24→27 六次叠加的两段(1819–1885 / 2194–2295)**合并重写成一份**;删 3 个零引用类与 1 条死兜底;新增 `--iwb-font-base` 承接 14px 正文 | 133 行新增 → `lint:tokens` **0 处裸值**;`style.css` 净减 34 行;新增 ⑦⑧ 两张组件夹具基线,16 张连跑两次全绿 |
| T6.2 ✅ | 文件级豁免那一半在 **B6 已提前完成**(`ALLOW_FILES` 6→0);本批改的是另一半:`batch-export` 状态色改走宿主语义 token + 保留私有值兜底,去掉与「全灰阶」冲突的纯蓝主按钮,发 **1.2.2** | 亮色主按钮对比 **9.51**、暗色 **14.10**;状态色对页面亮 5.38/6.95、暗 10.01/7.03;插件仓 `validate` 13/13、契约测试 0 文件豁免 |
| T6.3 ✅ | 规范新增 **§5.7 接入案例**(两份实现的决策表 + 三个缺口 + 照抄清单);顺手修掉 §5.2 里「引用并不存在的 `--iwb-dur-*`」这条会让人踩空的说明 | 文档与代码同批复核 |
**三个被撞出来的缺口**(这才是 M6 的产出 —— 都回去改了 token/守卫,没有改文档糊过去):
1. **闭集缺 14px**:表单行标题、命令输入、帮助正文全站 10 处,13→15 跨 2px 无处安放 → 新增 `--iwb-font-base: 14px`(7→8 档)。
2. **状态色不能当文字色**:`--iwb-ok` 亮色 `#22c55e` 对浅页面只有 **2.13**,而 `.iwb-status-ok` / `.iwb-ratio.ok` 一直这么用 → `derive()` 亮色状态色调深(暗色不变),`theme-contrast-test` 补 3 色 × 4 表面 × 2 主题,**114 → 138 对**。M5 的守卫只查 text/text2/dim/brandText,把这类漏了。
3. **面板在网页 e2e 里不可达**:`DesktopPluginsTab` 只在 `isDesk()` 时渲染,最乱的样式反而没有截图保护 → 加组件夹具基线(同类名 + 真实 `dist/style.css` + 构造 DOM),并必须在夹具里关掉 `transition`,否则开关 `.15s` 收尾会让两次截图差 7 个像素 × 1 级灰度,`threshold: 0` 随机红。
**存量计数下调并写回棘轮基线**:字号 170→159、圆角 103→95、间距 415→377、hex 84→79、圆角种数 18→17、阴影 45→44。
这是 M5 装上棘轮以来**第一次真正下降** —— 闸门管增量、真实改版清存量,分工成立。
## 5. 发布节奏
| 版本 | 内容 | 观感 | 备注 |
@@ -336,8 +379,8 @@ hover 完全没反馈。改成 `color-mix(text 10%, transparent)` 后两个主
| 3.26.47 | M4-B4 设置/外观 | **轻微** | 设置页正文 14→13、标题 16→15;同行输入框与按钮由「33 vs 24」变成都在 30。用户能感知的是「设置页更整齐」,不是「字变小」——13 与 15 仍在原层级里 |
| 3.26.48 | M4-B5 节点 | **有变化(暗色改善明显)** | 端口从「黑洞」变成可见小圆点、提示词节点高度 −4px、浮条阴影统一。用户能感知的是「深色画布上端口看得见了」,附放大对比图 |
| 3.26.49 | M4-B6 ✅ | 肉眼零,基线 8 张变化 | 收尾:16 处半像素清零、`control-h` 不扩全局(裁定)、插件契约文件级豁免 **6 → 0**。②④⑤⑥ 含画布场景因字号栅格化变化更新基线,逐张核对无错位 |
| 3.27.7 | M5 | 零 | 闸门上线 |
| 3.28.0 | M6 | 零 | 案例沉淀 |
| 3.26.50 | M5 ✅ | 零 | 闸门上线:`lint:tokens`(只查新增行)+ 13 项棘轮 + 114 对对比度;三道闸门各打红一次 |
| 3.26.51 | M6 ✅ | 亮色状态色调深(见下) | 案例沉淀:合并重写插件面板 + batch-export 1.2.2 + 补 font-base 档 + 对比度守卫 114→138 |
> 前置:3.26.42(外观 v2)需先发,本计划从 3.26.43 起。
> 插件侧:`batch-export` / `browser` / `image-vectorize` / `image-annotate` 各自在下次 patch 版本清硬编码,**不阻塞客户端**。
@@ -347,19 +390,30 @@ hover 完全没反馈。改成 `color-mix(text 10%, transparent)` 后两个主
| 指标 | 基线(实测) | M4 后目标 | M6 后目标 |
|---|---|---|---|
| 引用但未定义的变量 | 7 | 0 | 0 |
| 字号档数 | 19 | 7(B6 后散值 **13**:半像素已全部清零,剩 8/10 微缩徽标与画布区的 14/16/18/22/28/30,属 M5 棘轮范围;闭集 7 档已建) | 7 |
| 字号档数 | 19 | 7(B6 后散值 **13**;闭集 7 档已建) | **8**(M6 补 `--iwb-font-base`:14px,散值仍 13) |
| 圆角档数 | 18 | 5 | 5 |
| 间距档数 | 30 | ≤16 | ≤16 |
| 字号写死处 | 268 | ≤60(B6 后 **170**) | ≤20 |
| 圆角写死处 | 164 | ≤40(B6 后 **103**) | ≤10 |
| 间距写死处 | 629 | ≤200(B6 后 **415**) | ≤80 |
| 阴影写法种类 | 52 | ≤8 | 5 |
| 字号写死处 | 268 | ≤60(B6 后 **170**) | ≤20(**M6 后 159**) |
| 圆角写死处 | 164 | ≤40(B6 后 **103**) | ≤10(**M6 后 95**) |
| 间距写死处 | 629 | ≤200(B6 后 **415**) | ≤80(**M6 后 377**) |
| 阴影写法种类 | 52 | ≤8 | 5(**M6 后 44**,存量待清) |
| z-index 取值种类 | 42 | ≤10(B2 后 **31**) | 9 |
| `var(--iwb-layer)` 引用 | 59(一词多义) | 0(已拆) | 0 |
| 暗色硬编码色行 | 24 | 0 | 0 |
| text 对表面 <4.5 的格数 | 暗色 4 格 | 0 | 0 |
| 插件契约白名单文件 | 6(文件级豁免) | 0(B6 起按角色分类:私有皮肤自声明 + 强调色 chroma 判据 + 内容色行内标记) | 0 |
| 视觉基线 diff | 无基线 | 每批 0 | 每批 0 |
| 视觉基线 diff | 无基线 | 每批 0 | **16 张**(M6 新增 ⑦⑧ 组件夹具;亮色状态色调深使 7 张亮色更新,复核 16/16) |
| **新增裸值(增量)** | 无闸门 | **0/PR**(M5:`lint:tokens` 只查新增行) | 0 |
| **对比度达标对** | 未度量 | **114/114**(M5:亮/暗 × 文字 × 表面) | **138/138**(M6 补状态色 24 对) |
**M6 后(v3.26.51)**:**第一次真正下降** —— 字号 159 / 圆角 95 / 间距 377 / hex 79 / 圆角种数 17 / 阴影 44,
已写回棘轮基线。同时补齐两处「规范自称有、实际没有」的地方:`--iwb-font-base`(14px) 与状态色对比度守卫(138 对)。
M1–M6 全部完成,设计 token 从「铺完」走到「能照着写、有闸门、有回归」。
**M6 后修订(v3.26.52,用户截图反馈)**:收官后的第一个真实观感回归 —— 提示词 / 文本节点正文被 `--iwb-field`(亮色=纯白)铺成白矩形、编辑态冒出控件聚焦框。根因是 §1.9 的 D10 使用规则被读成「节点内**一切**表单控件」,漏了「正文文本区不是控件」这一层分类;两条 CSS 覆盖链见规范 §1.13。修法与表面角色三分法写进规范 §1.9 / §1.13 / §3.1,守卫进 `tests/node-scope-test.js` 第 5 条,受影响的 8 张画布相关基线(②④⑤⑥ × 亮/暗)重录并复核差异图(红色像素只在节点正文矩形内,无布局位移)。
> 教训:**相对派生解决的是「控件该多亮」,不解决「这里该不该有控件面」**。分类判据必须写进规范,
> 不能只靠颜色公式;否则每一批「统一节点内表面」都会把正文顺手刷成控件。
## 7. 风险登记
+6 -6
View File
@@ -1,7 +1,7 @@
# 现状架构与性能事实基线(image-workbench-web)
# 现状架构与性能事实基线(桌面版)
> **本文档是什么**:现状**事实快照**,不是规范。用途:任何性能 / 内存 / 存储相关改动,先对齐这里的现实,避免把已经调好的东西改坏。
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = c81a107`(线上 `v3.26.49+c81a107` —— 2026-11-23 **M4-B6 收尾**:`style.css` 剩余 16 处半像素字号全清零(守卫收紧为全文件断言)、`--iwb-control-h` 裁定不扩到全局控件(并排表单 vs 成组紧凑控件);插件主题契约重写,`ALLOW_FILES` 文件级豁免 **6 → 0** —— 改为「私有皮肤 manifest 自声明 `skin` + chroma 强调色判据 + 内容色行内标记」,声明私有皮肤的插件不得引用宿主颜色 token;同步 4 个插件版本,插件侧中性色写死归零;视觉基线 8 张因字号栅格化变化更新,A/B 回退确认非环境噪声;上一条 `v3.26.48+cb9cb9c` —— **M4-B5 节点**:节点卡内部表面统一 `--iwb-field` —— 端口底色从 `#161616`(暗色对卡片差 39 级,一颗黑洞)改 `#494949`(差 12 级),同病灶另 6 处(ref-img/ref-single/upload-link/refmini-empty/task-result-img/node-head:hover)一并改;浮条与任务卡 hover 改 `color-mix(text 10%)`(原来 panel 与 layer2 深色同色,hover 无反馈);字号 12/15/11/13 全归档位、圆角 8/6/5/14 归并、间距 52 处等值 + 13 处 1px 级微调;删 6 个死类名;新增 `tests/node-scope-test.js` 钉「节点内禁用面板表面色」;上一条 `v3.26.47+f5c8174` —— **M4-B4 设置/外观**:新增 `--iwb-control-h`(30px) 修「同行输入框 33px / 按钮 24px」的 9px 落差;设置页正文 14→13、标题 16→15,范围内半像素字号清零;删 21 条死规则(setcell/setgrid/set-row/appear-val 等);新增 `tests/settings-scope-test.js` 钉「控件等高 / 死类名不复现 / 引用的 token 必须存在」;上一条 `v3.26.46+9f29996` —— 2026-11-23 **M4-B3 首页/库**:删 30 条零生产者规则(25 个类名在产物里 0 次)+ 4 条被 specificity 覆盖的死声明,`style.css` 2391→2339 行;首页/库 106 条规则换 token,间距写死 91→5(只剩版心与导航让位的布局值)、字号写死清零,新增 `--iwb-font-display:24px` 第 7 档;验收改为「计算样式逐元素 diff + 12 张基线只首页 2 张变化」;上一条 `v3.26.45+968ff46` —— **M4-B2 浮层层级表 + 阴影四档**:14 档 `--iwb-z-*`(裸 z-index 取值种类 42→31)、`--iwb-elevation-1..4`(浮层 8 种阴影写法→4 档)、`.iwb-pop` 圆角 18→`radius-popover(14)`;修「弹窗里点保存看不到提示」—— 根因不是层级数字而是 `.iwb-overlay` 本身就是堆叠上下文,toast 改为 portal 到 `body`;新增 `tests/overlay-layer-test.js` 钉 9 条顺序约束;上一条 `v3.26.44+846a59b` —— **设计 token 体系重建**:D1–D9 色彩模型改为真正的深色(#121212 底 / 正文 #e3e3e3、13 个表面逐层相对派生 + 对比度生成期夹紧)、D10 新增 `--iwb-field` 卡片内控件面(暗色不再在灰卡上挖黑洞)、M3 单一源(`derive()` → `design-tokens.css` + `tokens.json`,`tokens:check` 进 CI);**安装包已本地构建,NAS 尚未上传**);上一条 `v3.26.41+2b8e337`:继承态提示词把上游文案与参考图交给组合/连接节点(来源判定加 `(edges, nodes)`,组合拼接逻辑零改动);再上一条 `v3.26.40+d9e3d84`:左右停靠栏配色对齐主色调(新增 `--iwb-dock-bg` 进灰阶 ramp + 头部深一档 + `.iwb-pcard` 补白底)+ 修 `Cargo.toml`/`Cargo.lock` 版本漂移,四处统一到 3.25.58)。上一条 3.25.30:线上实际运行提交是 docs 提交 `7df9dc4`,bump 提交为 `4be78c0`;2026-11-16 已发**测试站 + 正式站**,三地址一致 + `IWB_VERIFY_STRICT=1` 通过。v3.24.85 是「代码体检收口」(棘轮收回 Workbench 3090→2998 + 图库索引 4 条绕过锁的写路径收口到 `mutate` + 文档数字校准),`stable` / `stable-v3.24.85` / `stable-verified-2026-11-16` 均指向 `7df9dc4`。上一条 —— 2026-11-14 发**测试站 + 正式站** `https://test.image-workbench-web.pages.dev`:**v3.24.84 修「生图节点连了 3 条上游只出 1 个任务」**(任务 id 与去重基准改用新字段 `ownerNodeId`=本节点自己,不再用随继承冒泡的 `sourceNodeId` ⇒ 连几条线就几个任务;`relay` 仍归约到真实文本来源,同一来源多路径抵达只算一次)。上一条 v3.24.83:**修「插件节点冷启动退化成一段文本」**(插件节点体是异步注册的,`registerNodeType` 在 `render` 由无变有时自增 `NODE_TYPES_REV`,`NodeCard` 比它 ⇒ 注册那一刻重建一次;`canvas-normalize` 按命名规则把 `plugin:<id>:<variant>` 认作已知类型,不再降级成 `plugin` 并写回存档);配套插件 `style-source` 1.3.2 把节点体样式改为**脚本执行时注入**(此前只在面板 `mount()` 注入 ⇒ 从存档直接进画布时节点无样式、缩略图按原图铺Line truncated
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = cf0e9a0`(线上 `v3.26.60+cf0e9a0` —— 2026-11-24 **浮层字号上调一档**:「模型设置」「图像设置」选择项 11→13px、高 22→28、左右内距 6→10、间距 4→6、标题 12→14、面板 328→360,改动全落在 `.iwb-pop` 的 6 个 token(两面板共用一套);上一条 `v3.26.59+e966b34` —— 备份新增 `plugin-files/` 通道,提示词封面换机不再丢;再上一条 2026-11-23 **节点正文文本区修复**:提示词/文本节点正文透明继承卡片底色(白卡片消失)、编辑态三层框(控件 border / 聚焦光晕 / D8 焦点环)全去掉,规范补表面角色三分法与 `node-scope-test` 第 5 条守卫,8 张基线重录;上一条 `v3.26.51+21554b0` —— **M6 延展验证**:插件面板两段六次叠加样式合并重写、133 行新增零裸值;补 `--iwb-font-base`(14px) 第 8 档与亮色状态色调深(对浅页面 2.13 → ≥4.6),对比度守卫 114→138 对;新增 ⑦⑧ 组件夹具基线共 16 张;`batch-export` 1.2.2 状态色走宿主 token、去掉纯蓝主按钮;棘轮基线首次下调。M1–M6 全部完成;上一条 `v3.26.50+cab473c` —— **M5 闸门**:新增 `scripts/token-lint.js`(只查 diff 新增行,CSS 与 JS 内联样式两套判据、四类白名单)+ `tests/design-token-ratchet-test.js`(13 项计数只降不升)+ `tests/theme-contrast-test.js`(亮/暗 × 文字 × 表面 114 对),三条各做一次打红验证后接进 `verify:ci`;顺手把首启动「选择资料目录」弹窗 token 化(全仓最后一个完全未 token 化的界面);上一条 `v3.26.49+1743453` —— **M4-B6 收尾**:`style.css` 剩余 16 处半像素字号全清零(守卫收紧为全文件断言)、`--iwb-control-h` 裁定不扩到全局控件(并排表单 vs 成组紧凑控件);插件主题契约重写,`ALLOW_FILES` 文件级豁免 **6 → 0** —— 改为「私有皮肤 manifest 自声明 `skin` + chroma 强调色判据 + 内容色行内标记」,声明私有皮肤的插件不得引用宿主颜色 token;同步 4 个插件版本,插件侧中性色写死归零;视觉基线 8 张因字号栅格化变化更新,A/B 回退确认非环境噪声;上一条 `v3.26.48+cb9cb9c` —— **M4-B5 节点**:节点卡内部表面统一 `--iwb-field` —— 端口底色从 `#161616`(暗色对卡片差 39 级,一颗黑洞)改 `#494949`(差 12 级),同病灶另 6 处(ref-img/ref-single/upload-link/refmini-empty/task-result-img/node-head:hover)一并改;浮条与任务卡 hover 改 `color-mix(text 10%)`(原来 panel 与 layer2 深色同色,hover 无反馈);字号 12/15/11/13 全归档位、圆角 8/6/5/14 归并、间距 52 处等值 + 13 处 1px 级微调;删 6 个死类名;新增 `tests/node-scope-test.js` 钉「节点内禁用面板表面色」;上一条 `v3.26.47+f5c8174` —— **M4-B4 设置/外观**:新增 `--iwb-control-h`(30px) 修「同行输入框 33px / 按钮 24px」的 9px 落差;设置页正文 14→13、标题 16→15,范围内半像素字号清零;删 21 条死规则(setcell/setgrid/set-row/appear-val 等);新增 `tests/settings-scope-test.js` 钉「控件等高 / 死类名不复现 / 引用的 token 必须存在」;上一条 `v3.26.46+9f29996` —— 2026-11-23 **M4-B3 首页/库**:删 30 条零生产者规则(25 个类名在产物里 0 次)+ 4 条被 specificity 覆盖的死声明,`style.css` 2391→2339 行;首页/库 106 条规则换 token,间距写死 91→5(只剩版心与导航让位的布局值)、字号写死清零,新增 `--iwb-font-display:24px` 第 7 档;验收改为「计算样式逐元素 diff + 12 张基线只首页 2 张变化」;上一条 `v3.26.45+968ff46` —— **M4-B2 浮层层级表 + 阴影四档**:14 档 `--iwb-z-*`(裸 z-index 取值种类 42→31)、`--iwb-elevation-1..4`(浮层 8 种阴影写法→4 档)、`.iwb-pop` 圆角 18→`radius-popover(14)`;修「弹窗里点保存看不到提示」—— 根因不是层级数字而是 `.iwb-overlay` 本身就是堆叠上下文,toast 改为 portal 到 `body`;新增 `tests/overlay-layer-test.js` 钉 9 条顺序约束;上一条 `v3.26.44+846a59b` —— **设计 token 体系重建**:D1–D9 色彩模型改为真正的深色(#121212 底 / 正文 #e3e3e3、13 个表面逐层相对派生 + 对比度生成期夹紧)、D10 新增 `--iwb-field` 卡片内控件面(暗色不再在灰卡上挖黑洞)、M3 单一源(`derive()` → `design-tokens.css` + `tokens.json`,`tokens:check` 进 CI);**安装包已本地构建,NAS 尚未上传**);上一条 `v3.26.41+2b8e337`:继承态提示词把上游文案与参考图交给组合/连接节点(来源判定加 `(edges, nodes)`,组合拼接逻辑零改动);再上一条 `v3.26.40+d9e3d84`:左右停Line truncated
<!-- 2026-10-28 P1 拆分批 1:新增 src/generation-task-graph.js(5 个任务图纯函数自 app.js 迁出)
⇒ 模块数 60→61、耦合面 51→52、sourceModules 60→61。耦合面只**新增** IWBWTaskGraph,无删除。
2026-10-28 P1 拆分批 2:新增 src/storage-config-shape.js(9 个配置形状纯函数自 app.js 迁出)
@@ -33,8 +33,8 @@
| e2e | spec 文件 **58** 个(**52** 个进门禁 + 4 个 dev 探针 `_perf-baseline` / `_plugin-host-probe` / `_probe-drag` / `_probe-tab-switch`) | (A) `tests/` 计数 + `scripts/list-e2e-specs.js` |
| e2e 用例数 | **200 条**(2026-11-16 实测:55 个进门禁 spec 内 `test()` 总数;v3.25.15 删除网页版部署面后为 **53** 个进门禁;v3.25.56 节点组库改插件 `grouplib`(宿主侧栏组件删除)后为 **52** 个进门禁 —— `iwb-csp-gate` / `iwb-functions-headers` 随 `_headers`、`functions/` 一起移除)(历史:115 → v3.24.18 **143** → v3.24.19 **147** → v3.24.21 **151** → F2 改名 1 条 **152** → 抓手工具 2 条 **154** → v3.24.44 输出顺序 2 条 **166** → v3.24.47 同步去重 `iwb-sync-dedupe` 1 条 **167** → v3.24.67 **179** → v3.24.68 **183** → v3.24.69 **184** → v3.24.70 **186** → v3.24.74 **187**(新增「拖入 PDF 给提示 + MIME 空 PNG 仍能导入」)→ v3.24.75 **188**(新增「同一张图连粘两次只建一个节点」)→ v3.24.76 **191**(新增 `iwb-tabs-release` 3 条:回首页不降级 / 关标签先保存再关 / 彻底删除连带关标签)→ v3.24.77 **194**(新增 `iwb-lod` 3 条:fit 大画布必须全 LOD / 放大后必须恢复 / 常规画布不 LOD)→ v3.24.78 **196**(`iwb-lod` 3 → 5 条:新增「lite 档必须画出代表图/首行文字」与「缩到 15% 以下才退成 plain」)→ v3.24.82 **197**(新增 `iwb-inherit-text` 1 条:提示词/文本节点显示上游继承文本、改字接管、恢复跟随)→ v3.24.83 **198**(新增 `iwb-plugin-node-coldstart` 1 条:插件脚本晚到 1.2s,存档里的插件节点必须自动切回插件节点体,且类型不被降级成 `plugin`)→ v3.24.79 **196 不变**(测速修复的守门落在 jsdom 单测 `provider-ping-test.js`,e2e 无新增)→ v3.24.85 **200**(新增 `iwb-multi-tab` 2 条:A 页 flush 落盘后 B 页必须靠 rev 轮询看到改动;B 页持锁期间 A 页图库归档必须挂起);早期 99 → 115 的逐版链条见 `docs/history/coverage-baseline-2026-10-27.md`) | (A) `tests/*.spec.js` 计数 + `scripts/list-e2e-specs.js` |
| CI | `.github/workflows/verify.yml`:**push(main) + PR(→main) + 手动** 触发,两个 job(`gate` = `verify:ci`;`e2e` = `test:e2e`),只验证不部署 | (A) |
| 部署 | `npm run deploy` = `verify` + `wrangler pages deploy dist --branch main`;**内含全量 verify,不得绕过** | (A) `package.json:16` |
| 部署环境 | 本机 wrangler 为 OAuth 登录 → **不能设 `CI=true`**(用 `unset CI` + `WRANGLER_SEND_METRICS=false`) | (A) 本轮发布实测 |
| 发布(桌面) | mac:`bash scripts/publish-update.sh`;Windows:`publish-windows-update.sh` 后**重跑** mac 发布以合并 `latest.json` | `docs/WIN_BUILD_SPEC.md` §0.1 |
| 发布环境 | 已无 Cloudflare Pages / wrangler / `deploy` 脚本;更新源为 NAS `https://download.maqiart.eu.org/updates/latest.json` | `PUBLISHING.md` |
| `APP_VERSION` | `app.js:2723` 的 `'v3.6.0'` 是**构建期占位标记**,由 `scripts/build.js:40-41` 用 package 版本替换(缺标记会抛错)→ **不是版本漂移,别去"修"它** | (A) |
| `dist/` | 单 `dist/app.js`(`src/` 模块按序拼接后整体压缩)+ 压缩 `style.css`;**无 `dist/src/`** | (A) `CHANGELOG.md:16` |
| 根 `index.html` | **已删除**(2026-10-16,`9e743e4`):根目录不再含可直接打开的入口,静态产物只在 `dist/` | (C) 本轮删除 |
@@ -183,7 +183,7 @@
| `storage-reconcile` | 存储对账(`createReconciler`/`check`) | 内联对账 | 存储层收口 |
| `runtime-recovery-runner` | 执行恢复候选(`candidate`/`valid`/`run`) | 内联恢复 | 断点恢复 |
| `canvas-domain` | 画布域模型(`commit`/`updateNode`/`deleteNodes`…) | `CanvasStore` 那一套 | Workbench 解耦(P2-9) |
- **耦合面已冻结**:`tests/architecture-boundary-guard-test.js`(进 `npm run test:unit` 末环)冻结 app.js↔src 耦合面(**86** 项)与 `sourceModules` 顺序(**108** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。
- **耦合面已冻结**:`tests/architecture-boundary-guard-test.js`(进 `npm run test:unit` 末环)冻结 app.js↔src 耦合面(**87** 项)与 `sourceModules` 顺序(**108** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。
## 12. 易踩的坑
@@ -254,7 +254,7 @@
**信任模型(必须明示)**:形态 A 的插件是**可信代码**(与核心同权限、无沙箱);启停与设置是 UX 与可维护性手段,**不是安全边界**(同 §13.27 教训:前端开关一定可被绕过)。
**守门与快照**:`tests/architecture-boundary-guard-test.js` 冻结「app.js ↔ src 耦合面」(**86** 项)与 `sourceModules` 顺序(**108** 项);新增模块、新增耦合、新增 dev 探针都**必须有意重生成对应快照**(`IWB_WRITE_BOUNDARY_SNAPSHOT=1`)。契约与行为的可执行验证在 `tests/plugin-host-test.js`(宿主单测)与 `tests/_plugin-host-probe.spec.js`(真实浏览器探针,`_` 前缀 + `iwb-dev-probe`,不进 34 门禁)。
**守门与快照**:`tests/architecture-boundary-guard-test.js` 冻结「app.js ↔ src 耦合面」(**87** 项)与 `sourceModules` 顺序(**108** 项);新增模块、新增耦合、新增 dev 探针都**必须有意重生成对应快照**(`IWB_WRITE_BOUNDARY_SNAPSHOT=1`)。契约与行为的可执行验证在 `tests/plugin-host-test.js`(宿主单测)与 `tests/_plugin-host-probe.spec.js`(真实浏览器探针,`_` 前缀 + `iwb-dev-probe`,不进 34 门禁)。
**关键陷阱**:`normalizeNodes`(现位于 `src/canvas-normalize.js`)会**静默丢弃**不在 `NODE_H` 里的节点类型 ⇒ 新增节点类型必须先登记 `NODE_H`,否则节点一刷新就消失(§13.27 规则三的同一失败模式)。
+256 -30
View File
@@ -255,6 +255,12 @@
- 控件在**面板/弹窗/抽屉**里 → 用 `--iwb-layer` / `--iwb-layer2`(凹槽语义不变)。
- 控件在**节点卡片**里 → 必须用 `--iwb-field`。判据不是「凹陷还是凸起」,而是「它贴在哪张卡片上」。
- **正文文本区**(提示词 / 文本 / 插件正文等「一段文字」)**不是控件** → 不铺任何表面 token,
透明继承卡片底色,常态与编辑态都不画控件框。完整判据见 §1.13。
> 2026-11-23 修订:第二条曾被读成「节点内**一切**表单控件」,于是 `.iwb-node .iwb-textarea`
> 把纯白的 `field` 刷到了提示词 / 文本节点的正文上(§1.13)。判据要分两步:
> **先问它是不是可交互控件,再问它贴在哪张卡片上**。
### 1.10 M4-B2 浮层收敛执行记录(2026-11-23,v3.26.45)
@@ -321,6 +327,70 @@
④ 6 个死类名不复现。第 ① 条是这一批的根因,写成断言比写进文档有效 —— 下一个加节点内控件的人
会在 CI 上被拦,而不是在暗色截图里被用户发现。
### 1.12 M5 闸门执行记录(2026-11-23,v3.26.50)
三个新增文件、三道闸门,全部进 `verify:ci`。
| 闸门 | 文件 | 职责 | 反向验证 |
|---|---|---|---|
| 禁新增裸值 | `scripts/token-lint.js`(+ `npm run lint:tokens`) | 只看 diff 新增行;**CSS 与 JS 内联样式两种写法**;四条白名单 | 探针文件 8 行造出 6 处违规,全被点名(含「例外已过期」);JS 探针 8 处全中且 `{ gap: 20 }` 未被误伤 |
| 棘轮 + 完整性 | `tests/design-token-ratchet-test.js` + `tests/fixtures/token-baseline.json` | 13 项计数只降不升;`var()` 目标必须存在;禁自我兜底 | 往 `style.css` 追加一条 `font-size: 13px` → `170 → 171` 立刻红 |
| 对比度 | `tests/theme-contrast-test.js` | 亮/暗 × 文字 × 表面共 **114 对**,阈值取 `RATIO` | 把 `clampAgainst` 短路成 `return fg` → 100+ 对跌破阈值 |
**JS 内联样式必须单独定判据**(这一步是被一个真实漏网案例逼出来的):
B6 声称「`style.css` 里半像素一个不剩」属实,但 `src/storage-file.js` 的**首启动选目录弹窗**
还写着 `font-size:12.5px`、白底 `#fff`、字号 `17/13/12` 全套硬编码 —— 那是纯手写 `cssText`,
CSS 闸门看不见它,深色模式下会跳出一个白盒子。所以规则要按写法分两套:
| 写法 | 判据 | 为什么 |
|---|---|---|
| CSS 文本(`cssText` / `innerHTML` 的 `style="…"`) | 必须带 `px` 单位或 `#`/`rgb` | 只按 `prop: value` 会误伤 `{ gap: 20 }` 这类**画布布局参数**(`snapToFreeSpot` 就吃这个) |
| React 内联对象 | 只认无歧义 camelCase(`fontSize` / `marginLeft` / `zIndex`…) | `gap`、`padding` 在 JS 对象里可能是任何东西 |
**三个设计取舍**(都是踩过之后才定下来的):
1. **只查新增行,不查存量。** 存量 170 处写死字号,一次性要求清零只会逼人加白名单;白名单比债务更难发现(B6 刚把 `ALLOW_FILES` 拆掉,不能隔一批又造一张)。增量由 `token-lint` 拦,存量由棘轮慢慢降。
2. **口径不重复实现。** 棘轮不自己写正则,直接 `execFileSync` 跑 `token-audit.js --json`。两套口径一旦漂移,就会出现「守卫绿、审计红」这种最难查的分歧。
3. **例外必须到期。** `/*iwb:raw-until=3.28.0*/` 到期后由 `lint:tokens` 判失败,而不是靠人记得回来删。普通白名单的失效方式是「没人记得」,行内标记的失效方式是「构建红」。
**一个被证伪的直觉**:最初想用「调坏某个 mix 权重」来验证对比度守卫,结果改完仍然全绿 —— 因为 `clampAgainst` 会把结果重新夹回阈值以上。**这恰好说明夹紧机制有效**,也说明对比度守卫真正防的回归是「有人删掉了夹紧」或「有人把 token 值写死成常数」,而不是「有人调了调色权重」。守卫按这个真实失效模式做了反向验证。
**当前最紧的一对**:暗色 `textDim × field` = 3.12(下限 3.0)。`field` 是 B5 为节点端口新增的档(暗 `#494949`),再暗一档就会破线 —— 下一个想压深 `field` 的人会先在 CI 上撞到它。
### 1.13 节点正文文本区不是控件面(2026-11-23,v3.26.52)
用户看亮色画布截图的原话:**「这类节点的背景是灰色,然而文本区域是白色,我不要这个文本后面的白色,和这个编辑文本时候的出现的方框」**。截图里「提示词 / 文本」两个节点:卡片 `#efefef`,正文却是一块 `#ffffff` 的矩形;进入编辑态后,文字外面又多一圈方框。
**根因是两条 CSS 覆盖,都不是配色数值问题**:
| # | 覆盖链 | 后果 |
|---|---|---|
| ① | `.iwb-node .iwb-textarea { background: var(--iwb-field) }`(0,2,0)压过 `.iwb-textarea-plain { background: transparent }`(0,1,0) | 亮色 `field = #ffffff`,灰卡片里铺出白矩形;只有设了自定义底色的节点因另有 `.iwb-node-bg-custom` 规则才恰好正常 |
| ② | `.iwb-textarea-plain:focus`(0,2,0)写在 `.iwb-input:focus, .iwb-textarea:focus`(0,2,0)**之前**,同权重靠后生效 | 编辑时 `box-shadow: 0 0 0 2px color-mix(brand 20%)` 复活,成了「方框」 |
| ③ | 文件末尾 `:where(...):focus-visible { outline: var(--iwb-focus-ring); outline-offset: 2px }`(D8 键盘焦点环) | 编辑态在文字外再画一圈 2px 矩形环;实测计算样式 `outlineStyle: solid` |
三处叠加,编辑时文字外面最多能出现三层框;只有「白底」一眼可见,另外两层要到聚焦时才冒出来。
**修法(`style.css` 控件区)**:
1. 控件面规则收窄为 `.iwb-node .iwb-textarea:not(.iwb-textarea-plain)` —— `field` 只给**可交互控件**(输入 / 下拉 / 任务卡 / 端口 / 引用图占位),正文文本区退出这个集合。
2. 新增 `.iwb-node .iwb-textarea-plain`:`background: transparent`、`border: 0`、`border-radius: 0`、`padding: 0`、`box-shadow: none`;聚焦态再压一次 `border-color: transparent` / `box-shadow: none` / `outline: none`,且必须写在基础 focus 规则**之后**。
3. 保留 `.iwb-node-selected` 的节点选中框(选中 / 编辑状态的唯一反馈);**关掉 `:focus-visible` 的全局 D8 焦点环** —— 它 `2px solid` + `2px offset` 同样会在文字外画出一个方框,而此处焦点已由节点选中框表达,其余控件照旧保留 D8 环。去掉的是控件自己的三种框:`border`、`box-shadow` 光晕、`outline` 环。
**写进规范的表面角色三分法**(判据顺序:先分类,再选表面):
| 角色 | 例子 | 背景 | 边框 / 聚焦 |
|---|---|---|---|
| 面板 / 弹窗 / 抽屉里的控件 | 设置输入、搜索框 | `--iwb-layer` / `--iwb-layer2`(凹槽) | 常规控件框 |
| 节点卡片里的控件 | 参数输入、下拉、任务卡、端口、引用图占位 | `--iwb-field`(相对 `nodeBg` 派生) | 常规控件框 |
| 节点卡片里的**正文文本区** | 提示词、文本、插件正文 | **无独立 token:`transparent` 继承卡片底色**(含 `data-bg` 自定义色) | 无 `border`、无聚焦光晕、无 `outline` 环;编辑态只由节点选中框表达 |
> 为什么不给正文文本区单独建 token:它的值必须是「当前这张卡片的底色」,而卡片底色可能是用户数据(`data-bg` 自定义色)—— 任何固定色 token 都会在自定义底色下穿帮,`transparent` 才是正确表达。L3 白名单制下也不为它建组件 token(§2.1)。
**新增守卫**:`tests/node-scope-test.js` 第 5 条 —— 正文文本区必须 `transparent`、禁 `field / layer / panel`、禁边框与阴影、聚焦规则必须同时禁 `box-shadow` 与 `outline` 且在基础 focus 之后、控件面规则必须带 `:not(.iwb-textarea-plain)`。反向验证:删掉 `:not(...)`、删掉 `outline: none` 或把聚焦规则挪到基础 focus 之前,断言即红。
**验证**:差异图显示红色像素只落在提示词 / 文本两个节点的正文矩形内 —— 纯颜色替换,无布局位移、无文字重排。编辑态实测(Playwright 聚焦文本区取计算样式):`background = rgba(0,0,0,0)`、`boxShadow = none`、`borderWidth = 0px`、`outlineStyle = none`。视觉基线 **8 张重录**(② 画布 / ④ 图库抽屉 / ⑤ 提示词库面板 / ⑥ 右键菜单 × 亮暗:这四个场景背景里都有同一张画布),其余 **8 张 0 diff**;更新后 16/16 复跑全绿,`verify:ci` 全绿。
## 2. 目标架构
### 2.1 三层模型(与 Primer / Ant Design v5 / Radix 同一套骨架)
@@ -405,7 +475,8 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建
| `--iwb-color-bg-panel` | `#ffffff` | `#a5a5a5` | 面板/弹窗/菜单 | 可覆盖 |
| `--iwb-color-bg-card` | 同 panel | 同 panel | 卡片、列表项 | 可覆盖 |
| `--iwb-color-bg-inset` | `#f0f1f4` | `#9c9c9c` | 输入框、分组底 | 可覆盖 |
| `--iwb-field` | `#ffffff` | `#494949` | **卡片内**一切面:输入框/下拉/任务卡/输出组,以及节点上的端口、引用图占位、标题带 hover;卡片外用 bg-inset | 否 |
| `--iwb-field` | `#ffffff` | `#494949` | **卡片内的可交互控件面**:输入框/下拉/任务卡/输出组,以及节点上的端口、引用图占位、标题带 hover;**不含节点正文文本区**(见下);卡片外用 bg-inset | 否 |
| 节点正文文本区(无 token) | `transparent`,继承 `--iwb-node-bg` 或 `data-bg` 自定义色 | 同 | 提示词 / 文本 / 插件正文等「一段文字」;**刻意不建 token**,值随卡片变化,且常态与编辑态都无控件框(§1.13) | 否 |
| `--iwb-color-bg-hover` | `#ececec` | 派生 | 行/卡 hover | 可覆盖 |
| `--iwb-color-bg-selected` | `color-mix(brand 14%)` | 同 | 选中行 | 随品牌 |
| `--iwb-color-text-primary` | `#1c2333` | `#111111` | 主文字 | 可覆盖 |
@@ -493,18 +564,26 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建
### 3.3 字号 / 行高 / 字重
**已落地(v3.26.44,M4-B1)**:6 档。**v3.26.46(M4-B3)补第 7 档 `display`**。
**已落地(v3.26.44,M4-B1)**:6 档。**v3.26.46(M4-B3)补第 7 档 `display`**;
**v3.26.51(M6)补第 8 档 `base`**。
| token | 值 | 归并掉 | 用途 |
|---|---|---|---|
| `--iwb-font-xs` | 11px | 10, 11.5 | 状态栏、徽标、辅助信息 |
| `--iwb-font-sm` | 12px | 12.5 | **默认正文 / 标签**(UI 里出现最多) |
| `--iwb-font-md` | 13px | 13.5, **14** | 面板正文、列表项、工具栏标题 |
| `--iwb-font-lg` | 15px | 14, 15.5, **16** | 小标题、节点标题、卡片标题 |
| `--iwb-font-xl` | 17px | 16, 17.5, **18** | 面板标题、侧栏标题、图标字形 |
| `--iwb-font-2xl` | 20px | 18, 19, 22 | 页面大标题 |
| `--iwb-font-md` | 13px | 13.5 | **紧凑**正文、列表项、工具栏标题 |
| `--iwb-font-base` | 14px | 14 | **标准正文**:表单行标题、命令输入、帮助正文、尺寸数字 |
| `--iwb-font-lg` | 15px | 15.5, **16** | 小标题、节点标题、卡片标题 |
| `--iwb-font-xl` | 17px | 17.5, **18** | 面板标题、侧栏标题、图标字形 |
| `--iwb-font-2xl` | 20px | 19, 22 | 页面大标题 |
| `--iwb-font-display` | 24px | **26, 28, 30** | 展示级标题:页面/视图主标题(全仓 ≤5 处) |
> **为什么补第 8 档(M6 重做插件面板时定的)**:B1 的表里 14px 同时挂在 `md(13)` 和 `lg(15)`
> 的「归并掉」列 —— 两边都声称收了它,实际全站**还剩 10 处**(表单行标题、命令输入、帮助正文、
> 尺寸数字),角色全是「标准正文」。13 偏小、15 偏大,硬塞就是「每次改版都要重新选一个错的」。
> 14 是浏览器默认正文字号,13→15 之间跨 2px 本来就该有落脚点。补一档比继续塞诚实。
> `base` 不在 t-shirt 序列里是有意的:它表示「正文字号基准」,不是「比 md 大一点」。
> **为什么补第 7 档(B3 归并 26px 时定的)**:首页主标题原本 26px,压到 `2xl(20)` 会与面板标题同级,
> 页面层级直接塌掉(用户看到的是「标题变小了」而不是「变整齐了」)。`display` 只给**页面级**标题用,
> 与 `2xl`(区块级)隔一档;全仓当前只有 26/28/30px 三处候选,不构成新的散值来源。
@@ -667,6 +746,87 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建
---
### 3.11 设置面板(L3 组件 token,v3.26.53)
设置页采用 Obsidian 式布局:**组标题在页面底色上,组内容放在浅灰圆角容器里**。以下 token 定义在 `.iwb-settings-modal` 作用域内。
| token | 值 | 用途 |
|---|---|---|
| `--iwb-set-label-w` | `180px` | 行左侧标签列宽度 |
| `--iwb-set-col-gap` | `var(--iwb-space-16)` | 标签列与控件列的间距 |
| `--iwb-set-row-h` | `40px` | 行最小高度 |
| `--iwb-set-row-pad-y` | `var(--iwb-space-8)` | 行上下内边距 |
| `--iwb-set-group-gap` | `var(--iwb-space-32)` | 分组之间的间距 |
| `--iwb-set-title-gap` | `var(--iwb-space-8)` | 组标题与内容容器的间距 |
| `--iwb-set-group-bg` | 亮色 `#f9f9f9` / 暗色 `color-mix(in srgb, var(--iwb-text) 8%, var(--iwb-panel))` | 组内容容器底色(设计给定值) |
| `--iwb-set-group-radius` | `var(--iwb-radius-card)` | 组内容容器圆角 |
| `--iwb-set-group-pad-x` | `var(--iwb-space-20)` | 组内容容器左右内边距 |
| `--iwb-set-group-pad-y` | `var(--iwb-space-12)` | 组内容容器上下内边距(首行顶部与末行底部一致) |
| `--iwb-set-divider` | `color-mix(in srgb, var(--iwb-border) 55%, transparent)` | 容器内行与行之间的分割线 |
| `--iwb-set-hint-color` | `var(--iwb-text-dim)` | 说明文字颜色(11px 对比度下限) |
| `--iwb-set-hint-size` | `var(--iwb-font-xs)` | 说明文字字号 |
| `--iwb-set-hint-gap` | `var(--iwb-space-2)` | 说明与上方控件的间距 |
规则:
- 组标题(15px / 600)在页面底色上,不放进浅色容器;左内边距 = `--iwb-set-group-pad-x`,与容器内文字左对齐
- **组标题下不加说明/副标题**;解释性文字只放在行内说明或「更多说明」里
- 所有设置页的分组块间距 = `--iwb-set-group-gap`(32px);禁止各页再写自己的 gap/padding 覆盖(生图服务曾因旧规则 8px 与通用不一致)
- 组内容容器用 `--iwb-set-group-bg` + `--iwb-set-group-radius`,不加外边框
- 容器内行间用 `--iwb-set-divider`;首行不画线
- 说明对齐控件列(缩进 = label-w + col-gap),颜色用 hint-color,不得私自调淡
- 通用 / 外观 / 生图服务等所有设置页统一使用这些分组(不允许各页自写卡片或行样式)
- 新增设置 token 需按 §5.1 提 RFC
### 3.12 设置页控件(L3,v3.26.54)
| token | 值 | 用途 |
|---|---|---|
| `--iwb-set-check-size` | `16px` | 复选框边长(全设置页统一) |
| `--iwb-set-check-radius` | `4px` | 复选框圆角(自定义皮肤时用) |
| `--iwb-set-btn-gap` | `var(--iwb-space-8)` | 一组操作按钮之间的间距 |
规则:
- 复选框统一 `input[type=checkbox]` 尺寸与 `accent-color: var(--iwb-brand)`,不再各页写 15px/18px
- 按钮高度统一 `--iwb-control-h`、圆角 `--iwb-radius-control`;操作组间距用 `--iwb-set-btn-gap`
- 备份/外观等页的操作按钮不再单独写高度或间距
### 3.13 浮层弹窗(popover,L3,v3.26.58)
画布节点上的「模型设置」「图像设置」等贴节点浮层,统一用 `.iwb-pop` 这套 shell;
token 定义在 `.iwb-pop` 作用域内,**同类浮层只允许引用它们 + L2 尺度 token**。
字号档(v3.26.60 上调):选择项 13px / 高 28px / 左右内距 10px / 间距 6px、标题 14px、分组标签 12px。
上一版是 11px / 22px / 6px / 4px / 12px / 11px,用户反馈「文字有些小」,整体放大一档;
面板宽度同时 328 → 360px,抵消放大带来的额外换行。
| token | 值 | 用途 |
|---|---|---|
| `--iwb-pop-w` | `360px` | 面板宽度(窄屏由 `max-width: calc(100vw - 16px)` 兜底) |
| `--iwb-pop-pad-y` | `var(--iwb-space-10)` | 面板上下内边距 |
| `--iwb-pop-pad-x` | `var(--iwb-space-12)` | 面板左右内边距 |
| `--iwb-pop-gap` | `var(--iwb-space-8)` | 面板内分组之间 |
| `--iwb-pop-radius` | `var(--iwb-radius-popover)` | 面板圆角(阴影用 `--iwb-elevation-3`) |
| `--iwb-pop-title-size` | `var(--iwb-font-base)` | 面板标题字号(14px) |
| `--iwb-pop-chip-h` | `28px` | 选择项/下拉框/数字框统一高度 |
| `--iwb-pop-chip-pad-x` | `var(--iwb-space-10)` | 选择项左右内边距 |
| `--iwb-pop-chip-radius` | `6px` | 选择项圆角(矩形,非胶囊) |
| `--iwb-pop-chip-gap` | `var(--iwb-space-6)` | 选择项之间 / 换行后的行距 |
| `--iwb-pop-chip-size` | `var(--iwb-font-md)` | 选择项字号(13px) |
分组标签 `.iwb-setlabel` 用 `--iwb-font-sm` + 600 字重,分组内间距 `space-4`;浮层内说明文字 `.iwb-pop .iwb-hint` 用 `--iwb-font-sm`。
规则:
- 同一浮层里**所有选择项高度、圆角、字号必须一致**(`.iwb-chip-line` 与 `.iwb-gc-item` 都吃这套 token)
- 面板宽度只能由 `--iwb-pop-w` 决定;禁止再写 `width: 380px` 之类硬编码(曾因此让 token 失效;
`.iwb-gen-config` 原来写死 `min(92vw, 320px)` 就是这么失效的,v3.26.60 已改成引用 token)
- 触发浮层时必须在**绘制前**完成定位:定位用 `useLayoutEffect`,未定位前 `visibility: hidden`;
禁止先用 `{x:40,y:40}` 之类默认坐标渲染(用户会看到左上角闪一下再跳到锚点)
- 浮层必须 portal 到 `body`(节点在画布 `transform` 里,否则 fixed 会被变成相对定位)
- 新增同类浮层复用 `.iwb-pop` + `.iwb-pop-anchor`,不要自写宽高/内边距
---
## 4. 落地路线
四个阶段,每阶段**独立可验收、可回滚**。S0/S1 视觉零变化,S2 逐批等值替换,S3 才上闸门。
@@ -728,18 +888,18 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建
### S3 上闸门(约 0.5 天)
新增 `tests/design-token-ratchet-test.js` + `scripts/token-lint.js`,接入 `verify:ci`:
三道闸门,全部接入 `verify:ci`(M5 已落地,见 §1.12):
| 闸门 | 规则 | 失败示例 |
|---|---|---|
| **棘轮** | 硬编码计数不得超过基线(只降不升) | 基线 `font-size 写死 281`,新 PR 变成 282 → 失败 |
| **禁新增** | diff 新增行里出现裸 `#hex` / 裸 `px`(font-size、border-radius、padding、gap)→ 失败 | `padding: 13px` |
| **完整性** | 所有 `var(--iwb-*)` 必须有定义;禁止 `var(--x, var(--x))` | §1.3-②③ |
| **层级** | 禁止裸数字 `z-index`;插件不超过 40 | `z-index: 9999` |
| **插件契约** | **没有文件级豁免**。颜色按角色分三类:中性色(chroma < 24)必须用 token;强调色(chroma ≥ 24)允许写死;自带整套皮肤的在 manifest 声明 `skin: 'private'`,代价是不得引用宿主颜色 token。内容色用行内 `/*iwb:content*/` 标记 | §3.10 |
| 闸门 | 命令 | 规则 | 失败示例 |
|---|---|---|---|
| **禁新增裸值** | `npm run lint:tokens` | 只看 diff 的**新增行**:裸 `#hex` / `rgba()`(颜色属性)、裸 `px`(font-size / border-radius / padding / gap / margin)、裸数字 `z-index` → 失败 | `padding: 13px`、`color: #666`、`z-index: 9999` |
| **棘轮** | `node tests/design-token-ratchet-test.js` | 13 项硬编码计数不得超过 `tests/fixtures/token-baseline.json`(只降不升) | 基线 `font-size 写死 170`,新 PR 变成 171 → 失败 |
| **完整性 + 对比度** | 同上 + `node tests/theme-contrast-test.js` | `var(--iwb-*)` 必须有定义;禁 `var(--x, var(--x))`;亮/暗两套主题下 114 对「文字 × 表面」必须达 `RATIO` 阈值 | 拼成 `--iwb-radius-pill`;文字对 `field` 掉到 4.4 |
**棘轮是这套方案能不能活下来的关键**:没有它,三个月后又是一次 281 个字号。
**为什么闸门只查新增行**:M4 结束时仍有 170 处写死字号、415 处写死间距。要求「一次清零」只会逼人加白名单,而白名单比债务更难发现。所以分工是——**闸门管增量(立刻生效),棘轮管存量(只降不升),视觉基线管观感(改了必须看得见)**。
### S4 长期治理(流程,见 §5)
---
@@ -759,15 +919,18 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建
### 5.2 新增模块 / 插件的 9 步
1. 先翻 §3 找现成 L2,**80% 的情况不需要新 token**
2. 颜色只用 `--iwb-color-*`,不写 `#hex`/`rgba()`
3. 间距只用 `--iwb-gap-*` / `--iwb-pad-*`
4. 字号只用 `--iwb-font-*`(禁止 10.5/11.5/12.5/13.5)
5. 圆角只用 `--iwb-radius-*`
6. 浮层阴影用 `--iwb-elevation-*`,暗色另有描边
7. z-index 用 `--iwb-z-*`,插件不超 40
8. 动效用 `--iwb-dur-*` + `--iwb-ease-*`,并支持 reduced-motion
2. 颜色只用语义色(`--iwb-text` / `--iwb-text2` / `--iwb-layer2` / `--iwb-field` / `--iwb-border` / `--iwb-brand`),不写 `#hex`/`rgba()`
3. 间距只用 `--iwb-space-{2..64}`
4. 字号只用 `--iwb-font-{xs,sm,md,base,lg,xl,2xl,display}`(禁止 10.5/11.5/12.5/13.5 这类半像素)
5. 圆角只用 `--iwb-radius-{chip,control,card,panel,popover,full}`
6. 浮层阴影用 `--iwb-elevation-{1..4}`,暗色另有描边
7. z-index 用 `--iwb-z-*`,插件不得高于 `--iwb-z-anchor`(3200)
8. 动效时长(`transition`)**尚未 token 化**——这是 M6 实测后登记的已知缺口,先沿用现有 `.12s/.14s/.15s`,别去引用并不存在的 `--iwb-dur-*`
9. 亮/暗各截一张图放进 PR
第 2–7 步现在**有机器守卫兜着**:写完跑 `npm run lint:tokens`,它会指着 `file:line` 告诉你哪一行漏了。
第 8 步是唯一没有守卫的一项,因为它连闭集都还没有;不要因为「规范里写了」就以为 token 存在。
### 5.3 token 变更的版本与弃用
| 变更 | 版本位 | 要求 |
@@ -782,19 +945,82 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建
### 5.4 PR 评审清单(三问)
- [ ] 这个 PR 新增了硬编码数值吗?(有 → 为什么不能进 token)
- [ ] 亮色/暗色都看过了吗?(截图)
- [ ] 这个 PR 新增了硬编码数值吗?(`npm run lint:tokens` 绿了没?没绿就有)
- [ ] 亮色/暗色都看过了吗?(截图;改了 token 还要看 `npm run test:tokens`)
- [ ] 如果改了 token:`design-tokens.md` 同步了吗?需要弃用窗口吗?
### 5.5 例外登记
### 5.5 例外登记(行内标记,不是文件白名单)
任何 `ALLOW` 白名单条目必须写成:
**没有文件级白名单**。B6 之前 `ALLOW_FILES` 把 6 个文件整份赦免,结果其中 2 个是过期豁免、2 个是自带皮肤、2 个是混合态——三类完全不同的东西挤在同一张名单里,它只会一直长。
```js
// owner: @xxx · 到期: 3.28.0 · 原因: 画笔颜色属用户内容,不是主题表面色
```
现在只有两个行内标记,粒度到「这一条声明」:
无 owner 或无到期版本的例外,S3 闸门直接失败。
| 标记 | 用途 | 到期 |
|---|---|---|
| `/*iwb:content*/` | 画布**内容色**(图片上的纯白文字、截图底色)。同一个 `#fff` 在按钮上是 bug、在图片上是内容,值分不出来 | 不过期(内容色永远是内容色) |
| `/*iwb:raw-until=3.28.0*/` | **临时例外**,必须写到期版本。到期后 `lint:tokens` 直接判失败 | **必须填**,到期不会自动续 |
插件的私有皮肤是第三种情况,写在 manifest(`skin: 'private'`)而不是注释里——它声明的是「这个插件不跟随主题」这个**产品决定**,代价是不得引用宿主颜色 token(契约测试会检查自洽性,见 §3.10)。
### 5.6 闸门红了怎么办
| 现象 | 处理 |
|---|---|
| `lint:tokens` 指出某行裸值 | 换成对应闭集 token。如果确实是内容色 → 加 `/*iwb:content*/`;如果确实没法 token 化 → `/*iwb:raw-until=<下个 minor>*/` 并在 PR 里说明 |
| `ratchet` 说某项涨了 | 说明有裸值混进去了(先看 `npm run audit:tokens` 的分布)。**不要直接把基线数字调大**;确属必要的减法(例如删掉一批死规则)反而应该**下调**基线并提交 |
| `theme-contrast-test` 红了 | 调色改坏了某对「文字 × 表面」。改回去,或用 `clampAgainst` 重新夹紧;阈值在 `theme-tokens.js` 的 `RATIO`,别在测试里改数字 |
| 想全局看存量 | `node scripts/token-lint.js --file style.css`(整文件模式,迁移时用) |
### 5.7 接入案例(M6 实录,照抄即可)
M6 用这套 token **重做了插件管理面板**(设置行 / 列表 / 开关 / 工具条 / 筛选胶囊 / 卡片墙),
并改版了 `batch-export` 插件。目的不是再迁移一批数字,而是验证「照着规范写」到底顺不顺。
结论:**顺的地方不用记,卡住的三处才是这套系统真正需要修的地方**——都回去改了 token 和守卫,
没有在文档里糊过去。
#### 案例 A:面板样式的合并重写
原始状态是 v3.26.24 → v3.26.27 六次叠加:`.iwb-mk-list` 的 `gap` 写过 3 次、`.iwb-mk-grid` 3 次、
主按钮背景 4 次、`.iwb-set-page` 的 `max-width` 一改一撤。同一个最终值散在两处(1819–1885 / 2194–2295),
读的人要在心里跑一遍层叠。做法是**按当前生效值重写一份**,不是逐行翻译:
| 旧值 | 新写法 | 为什么 |
|---|---|---|
| `font-size: 14px`(行名 / 设置行标题) | `var(--iwb-font-base)` | 闭集原本 13→15 跨 2px,14 无处安放(见缺口 ①) |
| `gap: 10px` / `gap: 14px` / `gap: 6px` | `--iwb-space-10/12/6` | 叠加后的多个值统一按语义选一档 |
| `border-radius: 14px`(卡片) | `--iwb-radius-card`(10px) | 卡片用 card 档,14px 是 popover 档的语义 |
| `border-radius: 999px`(胶囊/开关) | `--iwb-radius-full` | 药丸统一 |
| `padding: 14px 2px` / `margin: 4px 0 10px` | `--iwb-space-12/-2` / `-4 0 -10` | 就近归并,逐条看过没有挤出容器 |
| `var(--iwb-ok, #1d9e75)` 的死兜底 | `var(--iwb-ok)` | 该 token 亮暗都有定义,兜底永不生效,只会误导 |
| 3 个零引用类 | 删除 | 全仓 JS 里没有引用(改前先做存活比对,别按 dist 计数误删) |
**验收**:`npm run lint:tokens` 对这 133 行新增报 **0 处裸值**;`style.css` 净减 34 行;
字号写死 170→159、圆角 103→95、间距 415→377。新增 ⑦⑧ 两张基线(组件夹具,见下)。
#### 案例 B:插件改版(`batch-export` 1.2.2)
插件是「宿主 token + 私有强调色」混合型,B6 已把文件级豁免清零,本批做的是**让状态色真正跟主题走**:
| 旧写法 | 新写法 | 收益 |
|---|---|---|
| 成功 `#1d9e75` / 错误 `#d85a30` | `var(--iwb-ok,…)` / `var(--iwb-err,…)`(带私有值兜底) | 暗色自动变亮,脱离宿主独立运行也不退化 |
| 主按钮纯蓝 `#2f6fed` + 白字 | `var(--iwb-text)` 底 + `var(--iwb-layer)` 字 | 去掉与「全灰阶、无蓝」冲突的蓝;亮/暗自动反相(对比 9.51 / 14.10) |
| 热按钮实心绿 + 白字 | 绿描边 + 绿字 + 14% 绿底 | 暗色下亮绿底压白字本来就不够对比 |
| 状态色直接当文字色 | `color-mix(in srgb, var(--iwb-ok) 82%, var(--iwb-text))` | 照 §3 的 `iwb-mk-badge` 范例压深,亮暗都读得清 |
`var()` 一律保留字面兜底:插件可能在宿主样式生效前渲染,也可能被单独加载。
#### 三个被撞出来的缺口(这才是延展验证的产出)
| # | 撞到什么 | 回去改了什么 |
|---|---|---|
| ① | 表单行标题是 14px,闭集只有 11/12/13/15/17/20/24;全站 10 处 14px 全是「正文/输入」角色 | `gen-tokens.js` 新增 `--iwb-font-base: 14px`(8 档)。**补档而不是把 14 塞进 13 或 15**——它不是一处特例 |
| ② | `--iwb-ok` 亮色 `#22c55e` 对浅页面对比只有 **2.13**,而 `.iwb-status-ok` / `.iwb-ratio.ok` 一直直接拿它当文字色 | `derive()` 亮色状态色调深(ok `#15803d` / err `#b91c1c` / warn `#b45309`,暗色不变);`theme-contrast-test` 补 3 色 × 4 表面 × 2 主题 = **114 → 138 对**。M5 的守卫只查 text/text2/dim/brandText,把状态色漏了 |
| ③ | 桌面端面板在网页 e2e 里不可达(`isDesk()` 走另一条分支),最乱的样式反而没有截图保护 | 加组件夹具基线:同一套类名 + 真实 `dist/style.css` + 构造 DOM。夹具里必须 `transition:none!important`——开关 `.15s` 过渡收尾会让两次截图差 1 级灰度、7 个像素,`threshold:0` 就会随机红 |
**照抄清单**:先按 §3 查现成 L2 → 写完跑 `lint:tokens` → 亮暗各截一张(组件够不到就用夹具,记得关过渡)→
如果某值在闭集里找不到落脚点,**先怀疑闭集缺了一档**,再决定是归并还是补档 → 补完档同步
`gen-tokens.js` / 快照 / 度量看板 / 对比度守卫,别只改 CSS。
---
@@ -866,7 +1092,7 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建
| # | 决定 | 裁定 | 影响与执行口径 |
|---|---|---|---|
| ① | 面板圆角 | **14px**(`radius-panel`) | 浮层(modal/fullmask/菜单/命令面板)统一 14;`popover` 用 12,`control` 用 8,`chip` 用 6,`round` 用 999。节点保持 `--iwb-node-radius`(默认 14)不受影响 |
| ② | 半像素字号 | **并入整数档**(10.5→11、11.5→12、12.5→12、13.5→13)|**已执行**:B3 清首页/库、B4 清设置/外观、**B6 清剩余 16 处** | 闭集落在 7 档:11 / 12 / 13 / 15 / 17 / 20 / 24。迁移时逐条看换行,只允许「文案变短一行」不允许「挤出容器」。B6 全部清零:备份页 2、右键菜单 1、操作日志 1、确认框 1、插件市场卡 9、资源浮标/继承条各 1;其中市场卡的 `.iwb-mk-card .iwb-mk-name/.iwb-mk-sub` 两条归并后与全局同档,作为重复声明删除 |
| ② | 半像素字号 | **并入整数档**(10.5→11、11.5→12、12.5→12、13.5→13)|**已执行**:B3 清首页/库、B4 清设置/外观、**B6 清剩余 16 处** | 闭集落在 **8 档**:11 / 12 / 13 / 14(base) / 15 / 17 / 20 / 24(M6 补 14)。迁移时逐条看换行,只允许「文案变短一行」不允许「挤出容器」。B6 全部清零:备份页 2、右键菜单 1、操作日志 1、确认框 1、插件市场卡 9、资源浮标/继承条各 1;其中市场卡的 `.iwb-mk-card .iwb-mk-name/.iwb-mk-sub` 两条归并后与全局同档,作为重复声明删除 |
| ③ | 间距迁移 | **先等值替换**,收敛另起一轮 | M4 只换写法不换值(0 diff);30 档 → 16 档的收敛放到 M4 之后单独一批,届时逐屏对照 |
| ④ | 色彩模型修复范围 | **全修 D1–D9**,但**分两版**:3.26.43 只放 D1(零观感),D3/D4/D5/D6/D7/D8/D9 放 3.26.44 | D1 = 单一写入点(消闪变、修系统转暗不生效),观感零风险;其余会改变暗色观感,单独发版并附亮/暗对比图 |
+29 -18
View File
@@ -44,16 +44,18 @@
### 13.5 测试是契约
- 测试**断言了有意设计**(如备份「设置默认不勾选」= 安全设计)。不要随意改这些默认值,除非确认意图并**同步更新测试**。
- 改动内部行为(如存储键方案:`idbKeyOf` → 内容哈希缓存 URL)时必须**同步更新对应测试**(如 63-6「同步兜底与异步保存使用一致的参考图键」)。
- 部署脚本 `deploy = verify && wrangler`:若 verify 出现**哪怕一个「新增失败」**(可能是 e2e 偶然抖动),`&&` 短路 → **wrangler 不执行、部署未真正生效**。因此改完必须**确认 wrangler 输出 "Deployment complete" + 域名并核验域名版本**,不要只看外层命令退出码(管道 `tail` 的退出码是 0,会假阳)。
- 发布脚本 `publish-update.sh` 用 `set -e`:构建/签名任一步失败都会中止;发完必须核验 `latest.json` 版本/平台与下载页 URL,不要只看外层命令退出码(管道 `tail` 的退出码是 0,会假阳)。
### 13.6 工作流(测试版 → 正式版两级发布)
- **地址**:正式 = `main` 分支 → `image-workbench-web.pages.dev`(+ 自定义域名);**测试 = `test` 分支 → `https://test.image-workbench-web.pages.dev`(固定别名,始终指向 test 分支最新部署)**。
- **脚本**:`npm run deploy:test` = verify + `wrangler pages deploy dist --branch test`;`npm run deploy` = verify + `--branch main`。两者都先跑 verify。
- **每次改动流程**:先打 `vX-pre-Y` 恢复标签 → `npm run verify`(期望基线以 **`CHANGELOG.md` 头部当前值**为准,见该文件"发布流程"第一条;**不要在此写死数字**,以 `docs/standards/architecture-current-state.md` §2 + `CHANGELOG.md` 头部为准(2026-10-15 复核:663 通过 / 0 新增失败 / 5 已知 + e2e 102)→ bump 版本 → **`npm run deploy:test`** → 用户在 `test.image-workbench-web.pages.dev` 实测(硬刷新确认版本)→ 没问题 → **`npm run deploy`(正式)** → 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、写 CHANGELOG / GitHub Release。
- **测试发现问题** → 改 → 再 `deploy:test`,直到通过;正式环境全程不受影响。
- **注意事项**:`*.pages.dev` 预览/分支地址是公开的(知道 URL 即可访问,个人测试可接受);每次 `deploy:test` 前 bump 版本以便区分测试的是哪版;部署后要**核验目标域名版本**(测试页看测试地址、正式页看正式地址),不要只信外层退出码(管道 `tail` 退出码是 0 会假阳,`&&` 短路会导致 wrangler 没跑)。
- 与既有功能无关的调试脚手架(如 gated debug counters)尽量不混入正式提交;确需保留时单独提交并说明。
- 改动任何镜像/存储/排序行为前,先跑中继 fixture(`tests/relay-task-graph-fixture-test.js`)确认不破坏既有任务图语义。
### 13.6 发布工作流(桌面版:mac + Windows 同批)
> 2026-11-24 重写:旧网页版 `deploy` / `deploy:test` / Pages 测试站流程已废弃,历史见 git 记录与 `docs/archive/history/PUBLISHING-legacy-web.md`。
- **唯一版本源**:`package.json`;`node scripts/set-version.js X.Y.Z` 同步 `tauri.conf.json` / `Cargo.toml`。
- **mac**:`npm run verify:ci` → 更新 CHANGELOG → 提交 → `bash scripts/publish-update.sh`(双架构构建、签名、上传、生成 `latest.json`)。
- **Windows**:按 `docs/WIN_BUILD_SPEC.md` 构建 `*-setup.exe` → 放 NAS `_inbox/` → mac `publish-windows-update.sh` 重签 → **再跑一次** `publish-update.sh` 把 `windows-x86_64` 合并进 `latest.json`。
- **站点**:登记 `site/releases.json` → `gen-release-page.js` / `gen-site.js` → 上传 NAS → 核验 200 与字节数。
- **tag**:`vX.Y.Z` 指向 bump 提交;docs/站点提交可在 tag 之后,但不要再改业务代码。
- 平台版本必须同批;Windows 落后时不要往 `latest.json` 塞旧包。
### 13.7 整体优化复盘(v3.78.0 → v3.79.2,稳定标签 `stable` / `v3.79.2`)
> 一轮「4K 图片 + 大画布」的性能/存储专项,从「真实用户反馈」出发、用 Performance 画像定位、逐项修复并固化成规范。记录成文,避免复踩。
@@ -387,15 +389,14 @@
- **规则四:不可表达的能力必须显式提示。** 例如 gemini/doubao 没有"任意像素自定义尺寸"、某模型有档位上限——
界面要说明(可自动降档并标注),**不得静默忽略**。
## §13.32 发布流程加固(2026-10-04,因一次真实失误新增)
- **失误记录**:`npm run verify` 未通过,但链式命令继续执行 → **标签与 Release 先打成了 v3.87.31,
而正式环境仍停在 v3.87.30**("记录先于验证",属流程违规)。
- **硬规则一**:`verify` 与部署必须串成**同一条 `&&` 链**,失败即停:
`npm run verify && git commit/push && npm run deploy:test && npm run deploy`。
- **硬规则二**:**先部署、后打标签/写 Release**;标签必须指向"已部署且门禁通过"的那个提交。
- **硬规则三**:发布后**逐个核验三个地址**的 `APP_VERSION`(正式双域名 + 测试地址);不一致立即补发。
- **硬规则四**:若已误打标签/Release → 修正提交后**强制移动标签**(`git tag -f` + `push --force`)并**重写 Release 说明**,
同时向用户如实说明失误与修正过程。
## §13.32 发布流程加固(2026-10-04 教训;2026-11-24 改为桌面版口径)
> 旧网页版「verify && deploy:test && deploy + 三地址核验」流程已废弃,历史见 git。
- **硬规则一**:`verify:ci` 必须通过后再 bump/构建;失败即停,不得先打 tag 后补验证。
- **硬规则二**:mac 发布用 `bash scripts/publish-update.sh`;Windows 包由 mac 签名并**重跑**该脚本合并 `latest.json`。
- **硬规则三**:发布后核验 `latest.json` 版本/三平台 + `latest-windows.json` 同版本 + 下载页 200/字节一致。
- **硬规则四**:误发时回滚版本提交并重跑发布脚本;不要手工改 `latest.json`。
---
@@ -1649,3 +1650,13 @@ JS 只能拿到 `TypeError: Failed to fetch`。
(app.js 净减 13 行,正好还棘轮)。**新模块名先查前缀白名单**
(`runtime|storage|generation|canvas|workspace|gallery|image|clipboard|ui|plugin`)——
`provider-ping.js` 会被边界守门直接打红,且不该为此新开前缀。
## §13.60 Windows 构建/发布:CRLF 防呆、版本与 tag 对齐、交付边界(2026-11-24,v3.26.55)
- 构建机只认 `package.json` 的版本;文档中的固定版本号是历史示例,照抄必错。
- `tokens:check` 失败先看 CRLF:`build.js` 与 `gen-tokens.js` 都必须把 `\r\n` 归一后再比较;只修一处会在 `app:build` 再炸一次。
- `.gitattributes` 的 `eol=lf` 不会 renormalize 已有 checkout;校验层容忍才是根治。
- Windows 只负责出 `*-setup.exe` 放 NAS `_inbox/`;签名、`latest-windows.json`、合并 `latest.json` 全部在 mac 做。
- 平台版本必须同批:Windows 版本落后时 mac 的 `latest.json` 不应塞旧 win 包,等 win 同版本发布后重跑发布脚本自动齐平。
- 发布后核验三件事:`latest.json` 含三平台、`latest-windows.json` 版本一致、下载页 exe 可 200 且字节数一致。
+2
View File
@@ -17,6 +17,8 @@
1. **只用变量**:`--iwb-plugin-*` 或 `--iwb-*`,禁止写死 `#hex` / `rgba()`。
(守门测试 `tests/plugin-theme-contract-test.js` 会卡)
1.5. **尺寸只许闭集**:字号 11/12/13/14/15/17/20/24、圆角 6/8/10/12/14/999、间距 0/2/4/6/8/10/12/16/20/24/32/40/48/64;散值由 `tests/plugin-scale-contract-test.js` 棘轮拦截(只降不升)。
2. **面板根不画底色**:宿主已给 `--iwb-plugin-surface`;插件根容器只写 `background: var(--iwb-plugin-surface)`。
3. **卡片才用 card**:列表项/卡片用 `--iwb-plugin-card`,这样「浅灰底 + 白卡片」的层次才成立。
4. **文字层级**:主文字 `--iwb-plugin-text`,次要 `--iwb-plugin-text2`,品牌 `--iwb-plugin-brand`(底色上的字用 `--iwb-plugin-on-brand`,宿主按对比度自动黑/白)。
@@ -249,8 +249,8 @@ npm run verify
- 大型改动前创建标签。
- 一次提交只解决一个明确问题。
- 工作区必须干净后发布。
- `npm run deploy` 已包含完整验证,不得绕过。
- 部署后记录 commit、Pages URL,并验证正式域名版本。
- 桌面版无 `deploy`;发布前必须 `npm run verify:ci`,mac 用 `publish-update.sh`,Windows 包由 mac 签名后重跑合并。
- 发布后记录 commit 与版本;核验 `latest.json` / `latest-windows.json` / 下载页三处一致。
- **"部署成功"≠ 验收:部署后要在真实 URL 上跑关键 e2e**(本轮做法,测试地址与正式域名各跑一遍):
```bash
IWB_BASE_URL=https://iwb.maqiart.eu.org npx playwright test tests/<关键>.spec.js
@@ -259,10 +259,10 @@ npm run verify
- **文档 / 发布说明里的"地址"必须是完整可点 URL**:禁止用 `站点/#iwb-tools=<暗号>` 这类**占位符**充当地址(用户会直接粘进浏览器 → 白跑一趟并以为站点坏了)。若必须举例,明确标注"占位符,非真实地址"。
- **仓库是私有的:GitHub 链接对外不可见**。未登录(含聊天软件、内嵌浏览器、无痕窗口)访问仓库或 Release 页会得到 **404**(私有仓库对未认证请求就是 404,不是 403)。要给用户看的内容:要么在对话里贴原文、要么放到**站点**上(站点是公开的)。另外 **CLI 有权限 ≠ 浏览器有登录态**——排查"地址不对"时,第一步让用户确认当前浏览器登录的账号(打开 `https://github.com/<owner>` 看是否 404)。
- **CI 只做验证门禁**:`.github/workflows/verify.yml` 在 `main` 推送时跑 `npm run verify`;**部署一律手动** `npm run deploy`(正式)/ `npm run deploy:test`(测试站),本仓库不使用 CI 自动部署。
- **本机 `wrangler` 是 OAuth 登录、不是 API Token**(会过期、不可当 CI 密钥;且无 Token 管理权限)⇒ 若将来要启用 CI 自动部署,API Token 只能在 Cloudflare Dashboard 手动创建(本机无法脚本化生成)。
- **三地址版本必须一致**:`scripts/verify-release.js` 只强制 自定义域 / `*.pages.dev` / `test.*.pages.dev` 的 **`version` 字符串一致**(接受 `vX.Y.Z` 或前缀 `vX.Y.Z+`;`uniq.length>1` 即失败)。**commit / SHA 不比较**(脚本注释即「commit 仅信息展示」):docs-only 提交让线上 SHA 落后一个代码提交,也不会判失败。
- **发布标签四类**:`vX.Y.Z`(GitHub Release 用)+ `stable-vX.Y.Z`(稳定标记)+ 移动可变 `stable` 到最新稳定 + `stable-verified-YYYY-MM-DD`(验证留痕);随后 `gh release create vX.Y.Z`。
- **CI 只做验证门禁**:`.github/workflows/verify.yml` 只跑 `verify:ci`;发布一律在本机用 `publish-update.sh` / `publish-windows-update.sh`,CI 不部署。
- 仓库已无 Cloudflare Pages / wrangler / `deploy` 脚本;更新源为 NAS(`download.maqiart.eu.org`)。
- **版本一致性**:mac/Windows 同批;`latest.json` 必须含三平台,Windows 落后时不要塞旧包。
- **发布标签**:桌面版只要求 `vX.Y.Z` 指向 bump 提交;不再维护网页版的 stable-* 标签。
- **CI 红灯排查顺序**:`gh run view <id> --log-failed` 看具体 job;优先怀疑 action/依赖,而不是代码。
- **构建产物已压缩打包(应用版本 v3.1.1)**:`scripts/build.js` 改为 **esbuild 逐文件 minify 再拼接** 成单个 `dist/app.js`(**不再输出 `dist/src/*`**),`style.css` 一并 minify;vendor React 保持独立、不压缩。**逐文件 minify(`transformSync`,非 `bundle`)** 是关键:拼接前每个 IIFE 已封闭,避免"整文件拼接后顶层声明重复/改名"的解析级隐患。
- **产物体检进 `verify`**:`npm run verify` 增加 `node --check dist/app.js` 与 `node scripts/check-dist.js`(断言 banner 版本 == `version.json`、`index.html` 恰 3 个 `<script>` 且无 `src/`、压缩后内嵌 Worker 字面量标记仍在)。
+2 -1
View File
@@ -26,7 +26,8 @@ git checkout 178b36c -- promptlib/styles.css promptlib/src/index.js
- 记录选区只在 `keyup / mouseup / input / select`,**绝对不要在 `blur` 记录**(WebKit 失焦会重置选区 → 插入到前一个字符)
- 点击时先 `focus()` → 用 `lastSel` 计算插入点,直接 `value.slice` 拼接(确定性 splice)
- 插入后 `setSelectionRange` 选中变量名,并同步 `lastSel`
- **不要用「透明 textarea + 高亮层」做编辑区**:两层即使字体相同,变量加粗/换行差异也会让点击位置逐次左移(v1.8.18 实测:第 1 次对、第 2 次偏 1 字、第 3 次偏 2 字)。编辑正文直接由 textarea 渲染(v1.8.20)
- **不要用「透明 textarea + 高亮层画文字」做编辑区**:两层即使字体相同,变量加粗/换行差异也会让点击位置逐次左移(v1.8.18 实测:第 1 次对、第 2 次偏 1 字、第 3 次偏 2 字)。编辑正文直接由 textarea 渲染(v1.8.20)
- **v1.9.3 起的允许例外**:textarea 文字保持可见、变量 span 不加粗,背层只画浅主色背景块(`--iwb-plp-accent` 的 color-mix);两层字体/行高/padding/滚动条占位一致并双向同步滚动。因为文字仍由 textarea 自己绘制,不会复发上面的点击偏移。实现见 `iwb-plugins-desktop/promptlib/styles.css` 的 v1.9.3 注释块。
- **不要用 `document.execCommand("insertText")`**:WKWebView 内部光标与 `selectionStart` 会漂移,第一次正常、第二次起偏移一个字符(v1.8.16 实测)
## 四、发布前检查清单
+73
View File
@@ -0,0 +1,73 @@
# UI 改动约束清单(Design Token 落地版)
> 适用范围:所有界面调整(宿主 `style.css` / `src/ui-*.js`、`plugins/**`、`site/**`)。
> 唯一数值来源:[design-tokens.md](./design-tokens.md);插件契约:[plugin-theme.md](./plugin-theme.md)。
## 1. 写前:先查表,不许临场编值
| 要改什么 | 必须用 | 禁止 |
| --- | --- | --- |
| 灰/表面/文字/边框色 | `--iwb-plugin-*`(插件面板)或 `--iwb-color-*`(宿主) | `#hex`、`rgba()`(`var(--x,#hex)` 兜底除外) |
| 间距 | `--iwb-space-2/4/6/8/10/12/16/20/24/32/40/48/64` | 13/14/18/22 等非档位值 |
| 字号 | `--iwb-font-xs…display`(11/12/13/14/15/17/20/24) | 半像素字号(10.5/11.5/12.5/13.5) |
| 圆角 | `--iwb-radius-chip/control/card/panel/popover/full`(6/8/10/12/14/999) | 7/9/11/13 等散值 |
| 阴影 | `--iwb-elevation-1..4` | 自定义 `0 4px 16px rgba(...)` |
| 层级 | `--iwb-z-*` | 9999/4000 等裸数字 |
| 动效 | `--iwb-dur-*` / `--iwb-ease-*` | 200ms/0.3s 混用 |
插件额外规则:
- 面板根 `--iwb-plugin-surface`、卡片 `--iwb-plugin-card`、输入框/内嵌 `--iwb-plugin-inset`、hover `--iwb-plugin-hover`
- 高饱和强调色允许写死(chroma ≥ 24);灰色必须 token
- 只有 `manifest.skin = "private"` 才可整套私有配色,且不得引用宿主颜色 token
- 内容色(画布白底、画笔色)必须行内 `/*iwb:content*/`
## 2. 写中:三条机械规则
1. **不改 token 定义**:要新值,先按 `design-tokens.md §5.1` 提 RFC(用途 / 消费者 ≥2 / 亮暗值 / 替代方案 / 弃用计划),先改规范再改代码。
2. **只引用 L2**:组件/插件只消费 L2;需要 L1 说明层选错了。
3. **例外登记,不做文件豁免**:只能行内 `/*iwb:raw-until=<版本>*/`(必须带到期版本)或 `/*iwb:content*/`,禁止整文件白名单。
## 3. 写后:四道闸门(缺一不可合并/发版)
| 闸门 | 命令 | 拦什么 |
| --- | --- | --- |
| Token 快照 | `npm run tokens:check` | `design-tokens.css` 与 `derive()` 漂移 |
| 新增行 lint | `npm run lint:tokens` | 新增行写死字号/圆角/间距/颜色/z-index |
| 插件契约 | `node tests/plugin-theme-contract-test.js` | 插件写死灰色、私有皮肤违规 |
| 插件尺度棘轮 | `node tests/plugin-scale-contract-test.js` | 插件字号/圆角/间距散值只降不升 |
| 视觉回归 | `npm run test:visual` | 亮/暗截图与基线像素 diff |
> `npm run verify:ci` 已串起前四道(构建、快照、lint、单测);`test:visual` 在改动浮层/面板时必跑。
## 4. 视觉验证流程(防止“测试过但变丑”)
1. 静态 HTML + Playwright 截图(亮/暗两套,固定视口)
2. 与上一版基线叠图对比,确认只有预期区域变化
3. 真机截图复核
4. 再 bump 版本 / 上市场
## 5. 违规处理
- CI 红 → 不合并、不发版
- **禁止“为了过测试改语义”**:不得把 `color` 换成 `border` token 糊弄测试(历史事故,见 `promptlib-style-baseline.md`)
- 测试与视觉冲突时:改测试规则或补 token,不改视觉语义
- 每版发布前跑 `node scripts/token-audit.js --json`,散值数量只能降不能升
## 6. 复核命令
```bash
node scripts/token-audit.js # 宿主 token 现状
node scripts/token-audit.js --plugins # 插件写死色/散值清单(按文件)
node scripts/token-audit.js --contrast # 对比度矩阵
node scripts/token-lint.js --file style.css
npm run test:visual
```
## 7. 视觉基线(已接入 promptlib)
- 基线文件:`tests/_visual-tokens.spec.js` 的 ⑨ 编辑弹窗 / ⑩ 详情弹窗(亮/暗各 2 张,共 4 张)
- 运行:`npm run test:visual`(比对本机基线,0 diff 才算过)
- 有意改动:`npm run test:visual:update` 后**人工确认截图**,再提交快照
- 纯重构(token 迁移、去重):必须 0 diff;若 diff 非 0,先解释变化区域再更新基线
- 该套件不挂 CI(字体/DPR/GPU 跨机器会漂移),属于发版前本地验收
+6 -4
View File
@@ -1,7 +1,7 @@
{
"name": "image-workbench-web",
"private": true,
"version": "3.26.49",
"version": "3.26.60",
"description": "Browser-based node canvas image workbench",
"scripts": {
"build": "node scripts/build.js && node scripts/copy-plugins.js",
@@ -10,7 +10,7 @@
"app:build": "tauri build",
"lint": "eslint src app.js",
"test": "node tests/relay-task-graph-fixture-test.js && node tests/plugin-style-node-test.js && node tests/inherit-text-test.js",
"test:unit": "node tests/plugin-archive-test.js && node tests/plugin-files-policy-test.js && node tests/theme-plugin-tokens-test.js && node tests/theme-static-snapshot-test.js && node tests/overlay-layer-test.js && node tests/settings-scope-test.js && node tests/node-scope-test.js && node tests/appearance-v2-test.js && node tests/image-prompt-cover-test.js && node tests/unit-test.js && node tests/canvas-actions-test.js && node tests/canvas-performance-test.js && node tests/canvas-drag-performance-test.js && node tests/resize-observer-performance-test.js && node tests/node-drag-jank-test.js && node tests/edge-graph-performance-test.js && node tests/persistence-export-images-test.js && node tests/settings-hotkeys-size-presets-test.js && node tests/custom-size-validation-test.js && node tests/image-node-performance-test.js && node tests/drag-frame-performance-test.js && node tests/canvas-edge-memo-test.js && node tests/canvas-node-transform-test.js && node tests/canvas-dot-zoom-test.js && node tests/duplicate-ws-fresh-source-test.js && node tests/single-canvas-shell-test.js && node tests/navigation-layout-test.js && node tests/home-canvas-library-test.js && node tests/left-resource-layout-test.js && node tests/interface-hierarchy-test.js && node tests/three-page-layout-test.js && node tests/page-chrome-regression-test.js && node tests/task-cache-test.js && node tests/storage-config-shape-test.js && node tests/storage-zip-test.js && node tests/canvas-node-factory-test.js && node tests/runtime-error-test.js && node tests/runtime-lifecycle-test.js && node tests/runtime-fetch-test.js && node tests/runtime-channel-test.js && node tests/runtime-boundary-test.js && node tests/runtime-record-test.js && node tests/runtime-recovery-test.js && node tests/runtime-diagnostic-record-test.js && node tests/runtime-metrics-test.js && node tests/runtime-run-context-test.js && node tests/runtime-execution-context-test.js && node tests/storage-gc-canvas-refs-test.js && node tests/storage-health-test.js && node tests/generation-state-test.js && node tests/canvas-store-test.js && node tests/storage-result-test.js && node tests/storage-local-test.js && node tests/storage-domain-test.js && node tests/storage-runtime-test.js && node tests/storage-indexeddb-test.js && node tests/generation-scheduler-test.js && node tests/gallery-query-test.js && node tests/gallery-hydration-test.js && node tests/image-blob-store-test.js && node tests/image-preview-derive-test.js && node tests/image-format-test.js && node tests/clipboard-graph-test.js && node tests/clipboard-graph-fallback-test.js && node tests/image-admit-test.js && node tests/image-dedupe-test.js && node tests/clipboard-kind-test.js && node tests/clipboard-paste-test.js && node tests/clipboard-copy-test.js && node tests/paste-once-test.js && node tests/list-e2e-specs-test.js && node tests/desktop-csp-loopback-test.js && node tests/architecture-boundary-guard-test.js && node tests/plugin-host-test.js && node tests/plugin-data-test.js && node tests/plugin-loader-test.js && node tests/plugin-bundle-test.js && node tests/plugin-install-test.js && node tests/plugin-gallery-render-test.js && node tests/plugin-gallery-recovery-test.js && node tests/plugin-gallery-ux-test.js && node tests/plugin-grouplib-render-test.js && node tests/plugin-promptlib-render-test.js && node tests/image-compress-test.js && node tests/storage-fallback-indexeddb-test.js && node tests/canvas-normalize-test.js && node tests/canvas-geometry-test.js && node tests/canvas-history-test.js && node tests/canvas-ops-test.js && node tests/canvas-text-test.js && node tests/history-store-test.js && node tests/plugin-integrity-test.js && node tests/workspace-sessions-store-test.js && node tests/workspace-list-test.js && node tests/workspace-purge-test.js && node tests/provider-ping-test.js && node tests/runtime-diagnostics-hotpath-test.js && node tests/storage-log-failure-test.js && node tests/storage-convergence-test.js && node tests/swallow-wiring-test.js && node tests/workbench-logic-test.js && node tests/storage-autobackup-test.js && node tests/storage-outputs-mutate-test.js && node tests/sync-facts-guard-test.js && node tests/e2e-fixed-waits-ratchet-test.js && node tests/shell-render-behavior-test.js && node tests/canvas-meta-notice-behavior-test.js && node tests/source-text-ratchet-test.js && node tests/plugin-theme-contract-test.js && node tests/prompt-md-roundtrip-test.js && node tests/generation-results-store-test.js && node tests/out-groups-order-test.js && node tests/native-overlay-park-test.js && node tests/ui-dock-sanitize-test.js && node tests/ui-minimap-fit-test.js && node tests/ui-workbench-hooks-test.js",
"test:unit": "node tests/plugin-archive-test.js && node tests/plugin-files-policy-test.js && node tests/theme-plugin-tokens-test.js && node tests/theme-static-snapshot-test.js && node tests/overlay-layer-test.js && node tests/settings-scope-test.js && node tests/node-scope-test.js && node tests/appearance-v2-test.js && node tests/image-prompt-cover-test.js && node tests/unit-test.js && node tests/canvas-actions-test.js && node tests/canvas-performance-test.js && node tests/canvas-drag-performance-test.js && node tests/resize-observer-performance-test.js && node tests/node-drag-jank-test.js && node tests/edge-graph-performance-test.js && node tests/persistence-export-images-test.js && node tests/settings-hotkeys-size-presets-test.js && node tests/custom-size-validation-test.js && node tests/image-node-performance-test.js && node tests/drag-frame-performance-test.js && node tests/canvas-edge-memo-test.js && node tests/canvas-node-transform-test.js && node tests/canvas-dot-zoom-test.js && node tests/duplicate-ws-fresh-source-test.js && node tests/single-canvas-shell-test.js && node tests/navigation-layout-test.js && node tests/home-canvas-library-test.js && node tests/left-resource-layout-test.js && node tests/interface-hierarchy-test.js && node tests/three-page-layout-test.js && node tests/page-chrome-regression-test.js && node tests/task-cache-test.js && node tests/storage-config-shape-test.js && node tests/storage-zip-test.js && node tests/canvas-node-factory-test.js && node tests/runtime-error-test.js && node tests/runtime-lifecycle-test.js && node tests/runtime-fetch-test.js && node tests/runtime-channel-test.js && node tests/runtime-boundary-test.js && node tests/runtime-record-test.js && node tests/runtime-recovery-test.js && node tests/runtime-diagnostic-record-test.js && node tests/runtime-metrics-test.js && node tests/runtime-run-context-test.js && node tests/runtime-execution-context-test.js && node tests/storage-gc-canvas-refs-test.js && node tests/storage-health-test.js && node tests/generation-state-test.js && node tests/canvas-store-test.js && node tests/storage-result-test.js && node tests/storage-local-test.js && node tests/storage-domain-test.js && node tests/storage-runtime-test.js && node tests/storage-indexeddb-test.js && node tests/generation-scheduler-test.js && node tests/gallery-query-test.js && node tests/gallery-hydration-test.js && node tests/image-blob-store-test.js && node tests/image-preview-derive-test.js && node tests/image-format-test.js && node tests/clipboard-graph-test.js && node tests/clipboard-graph-fallback-test.js && node tests/image-admit-test.js && node tests/image-dedupe-test.js && node tests/clipboard-kind-test.js && node tests/clipboard-paste-test.js && node tests/clipboard-copy-test.js && node tests/paste-once-test.js && node tests/list-e2e-specs-test.js && node tests/desktop-csp-loopback-test.js && node tests/architecture-boundary-guard-test.js && node tests/plugin-host-test.js && node tests/plugin-data-test.js && node tests/plugin-loader-test.js && node tests/plugin-bundle-test.js && node tests/plugin-install-test.js && node tests/plugin-gallery-render-test.js && node tests/plugin-gallery-recovery-test.js && node tests/plugin-gallery-ux-test.js && node tests/plugin-grouplib-render-test.js && node tests/plugin-promptlib-render-test.js && node tests/image-compress-test.js && node tests/storage-fallback-indexeddb-test.js && node tests/canvas-normalize-test.js && node tests/canvas-geometry-test.js && node tests/canvas-history-test.js && node tests/canvas-ops-test.js && node tests/canvas-text-test.js && node tests/history-store-test.js && node tests/plugin-integrity-test.js && node tests/workspace-sessions-store-test.js && node tests/workspace-list-test.js && node tests/workspace-purge-test.js && node tests/provider-ping-test.js && node tests/runtime-diagnostics-hotpath-test.js && node tests/storage-log-failure-test.js && node tests/storage-convergence-test.js && node tests/swallow-wiring-test.js && node tests/workbench-logic-test.js && node tests/storage-autobackup-test.js && node tests/storage-outputs-mutate-test.js && node tests/sync-facts-guard-test.js && node tests/e2e-fixed-waits-ratchet-test.js && node tests/shell-render-behavior-test.js && node tests/canvas-meta-notice-behavior-test.js && node tests/source-text-ratchet-test.js && node tests/plugin-theme-contract-test.js && node tests/prompt-md-roundtrip-test.js && node tests/generation-results-store-test.js && node tests/out-groups-order-test.js && node tests/native-overlay-park-test.js && node tests/ui-dock-sanitize-test.js && node tests/ui-minimap-fit-test.js && node tests/ui-workbench-hooks-test.js && node tests/plugin-scale-contract-test.js && node tests/design-token-ratchet-test.js && node tests/theme-contrast-test.js",
"test:diagnostics": "node tests/runtime-diagnostics-hotpath-test.js",
"test:facts": "node tests/architecture-facts-guard-test.js && node tests/release-records-test.js",
"plugins:gc": "node scripts/plugins-publish.mjs --gc",
@@ -24,14 +24,16 @@
"test:visual:update": "npx playwright test _visual-tokens --update-snapshots",
"test:e2e": "npm run build && node scripts/serve-test.js",
"test:e2e:local": "node scripts/serve-test.js",
"verify:ci": "npm run build && node --check app.js && node --check dist/app.js && node scripts/check-dist.js && npm run tokens:check && npm run lint && npm run typecheck && npm run test:unit && npm test && npm run test:facts",
"verify:ci": "npm run build && node --check app.js && node --check dist/app.js && node scripts/check-dist.js && npm run tokens:check && npm run lint:tokens && npm run lint && npm run typecheck && npm run test:unit && npm test && npm run test:facts",
"verify": "npm run verify:ci && npm run test:e2e",
"verify:release": "node scripts/verify-release.js",
"coverage:e2e": "node scripts/coverage-e2e.js",
"sync:facts": "node scripts/sync-facts.js",
"sync:facts:write": "node scripts/sync-facts.js --write",
"typecheck": "tsc -p tsconfig.json",
"release:desktop": "bash scripts/release.sh"
"release:desktop": "bash scripts/release.sh",
"lint:tokens": "node scripts/token-lint.js",
"test:tokens": "node tests/design-token-ratchet-test.js && node tests/theme-contrast-test.js"
},
"devDependencies": {
"@playwright/test": "^1.64.1",
+22 -5
View File
@@ -129,8 +129,20 @@
setBtn.setAttribute('aria-expanded', 'false')
var settings = el('div', { class: 'iwb-gal-settings', role: 'dialog', 'aria-label': '图库设置' })
settings.style.display = 'none'
// 2026-11-24:底栏加「打开本地图库目录」图标(文件夹),放在设置图标左边;只桌面端可用。
var folderBtn = iconBtn('打开本地目录', function (svg) {
svgPath(svg, 'M2 4.5h4l1.5 2H14v6.5H2z')
}, '在系统文件管理器里打开本地图库目录(images/gallery)')
folderBtn.addEventListener('click', function (e) {
e.stopPropagation()
if (!ctx.gallery || typeof ctx.gallery.openFolder !== 'function') { setStatus('仅桌面端可打开本地目录'); return }
Promise.resolve(ctx.gallery.openFolder()).then(function (r) {
if (r && r.ok === false) setStatus('打开失败:' + ((r && r.error) || '仅桌面端可用'))
}).catch(function (err) { setStatus('打开失败:' + ((err && err.message) || err)) })
})
folderBtn.style.display = (typeof window !== 'undefined' && window.__TAURI__ && window.__TAURI__.core) ? '' : 'none'
// v1.4.2:刷新与设置同放右侧工具组(此前刷新在左侧信息区,空间不足时会向右溢出、压住设置图标)
var tools = el('div', { class: 'iwb-gal-tools' }, refreshBtn, setBtn)
var tools = el('div', { class: 'iwb-gal-tools' }, refreshBtn, folderBtn, setBtn)
var foot = el('div', { class: 'iwb-gal-foot' },
el('div', { class: 'iwb-gal-foot-left' }, countEl, pickedEl, failEl, statusEl), tools)
var wrap = el('div', { class: 'iwb-history-embedded' }, [head, grid, more, empty, foot, settings])
@@ -300,6 +312,11 @@
function renderGrid () {
clear(grid)
var gap = 6
// 每次重排都重新量一次宽度:面板显隐/停靠栏展开时 gridW 可能是旧值,
// 只靠 ResizeObserver 会在「变成 0 再回来」期间漏掉,导致必须拖宽度才出图。
var liveW = availableW()
if (liveW > 0 && Math.abs(liveW - gridW) > 1) gridW = liveW
if (!gridW) gridW = 320
var tileW = Math.max(40, Number(cfg.tile) || 110)
var n = Math.max(1, Math.floor((gridW + gap) / (tileW + gap)))
// v1.6.6:列宽 = 均分宽度(铺满面板),图幅只决定「列数」——
@@ -368,7 +385,7 @@
function paint (url) {
if (!url || typeof url !== 'string') { fail('图片已丢失'); return }
if (!box.isConnected) return
var img = el('img', { src: url, alt: '', loading: 'lazy', draggable: 'true' })
var img = el('img', { src: url, alt: '', loading: 'eager', draggable: 'true' })
if (it.w && it.h) img.setAttribute('style', 'aspect-ratio:' + it.w + ' / ' + it.h)
img.addEventListener('load', function () {
// naturalWidth=0 说明拿到的是坏图(空 data URL / 截断文件):按失败处理,别留白块
@@ -407,7 +424,7 @@
if (img.parentNode === box) box.replaceChild(holder, img)
fail('缩略图加载失败(点击重试)')
} catch (e) { /* ignore */ }
}, 700)
}, 2000)
// 加载成功后再替换占位(避免破图标 + 长 title 占满格子)
if (img.complete && img.naturalWidth > 0) { img.style.display = ''; if (holder.parentNode === box) box.replaceChild(img, holder) }
else if (img.complete && !img.naturalWidth) { /* 立即失败(坏图)*/ tries++; if (tries <= 2) setTimeout(boot, 400 * tries); else { if (img.parentNode === box) box.replaceChild(holder, img); fail('缩略图加载失败(点击重试)') } }
@@ -447,7 +464,7 @@
render()
}
function render () { renderHead(); renderGrid() }
function render () { renderHead(); renderGrid(); global.requestAnimationFrame(function () { try { measure() } catch (e) {} }); setTimeout(function () { try { measure() } catch (e) {} }, 150) }
function load (force) {
if (force) setStatus('刷新中…')
@@ -538,7 +555,7 @@
global.IWBPluginHost.register({
id: 'gallery',
name: '图库',
version: '1.6.9',
version: '1.6.12',
apiVersion: 1,
capabilities: ['panels', 'gallery'],
data: { schemaVersion: 1, maxBytes: 65536 },
+3 -3
View File
@@ -1,7 +1,7 @@
{
"id": "gallery",
"name": "图库",
"version": "1.6.9",
"version": "1.6.12",
"apiVersion": 1,
"main": "main.js",
"style": "styles.css",
@@ -13,7 +13,7 @@
"图库"
],
"files": {
"main.js": "26c7e64b3a0021c6b9514dfb84d4d2580276698222b4791cfa99f22ead66ff52",
"styles.css": "9d5b4ab1343761e51ef0c479cab96a94d3d6eaa27f0fdb500bff789ec81d70e0"
"main.js": "a5fb039684937de44d1033c75d9872b9e6d1c8c2c9582cd5feee948562e9b7d1",
"styles.css": "35ae17de8b0f3bddab9cbef6270cd8bbf5153c9ecf6ed2b4f06216f6fef45b8b"
}
}
+4 -4
View File
@@ -13,7 +13,7 @@
/* ---- 顶栏 ---- */
.iwb-gal-head { display: flex; align-items: center; gap: 6px; min-height: 0; }
.iwb-gal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.iwb-gal-actions .iwb-btn-sm { padding: 2px 7px; }
.iwb-gal-actions .iwb-btn-sm { padding: 2px 6px; }
/* ---- 底栏:左信息 / 右工具组 ---- */
.iwb-gal-foot {
@@ -32,7 +32,7 @@
.iwb-gal-foot .iwb-gal-icobtn:active {
width: 20px; height: 20px; min-width: 20px; padding: 0; box-sizing: border-box;
display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
border: 0; box-shadow: none; background: transparent; border-radius: 4px;
border: 0; box-shadow: none; background: transparent; border-radius: 6px;
color: var(--iwb-text2); line-height: 1; transform: none;
}
.iwb-gal-foot .iwb-gal-icobtn svg { display: block; pointer-events: none; }
@@ -43,7 +43,7 @@
/* ---- 设置浮层(三个下拉不占前台) ---- */
.iwb-gal-settings {
position: absolute; right: 8px; bottom: 34px; z-index: 30; width: 176px; max-width: calc(100% - 16px);
display: flex; flex-direction: column; gap: 8px; padding: 9px 10px;
display: flex; flex-direction: column; gap: 8px; padding: 8px 10px;
background: var(--iwb-layer); border: 1px solid var(--iwb-border); border-radius: 8px;
box-shadow: 0 6px 18px rgba(0, 0, 0, .14);
}
@@ -65,7 +65,7 @@
font-size: 11px; color: var(--iwb-text2); background: var(--iwb-layer2); word-break: break-all;
}
.iwb-history-actions { display: flex; gap: 4px; padding: 4px 2px 0; }
.iwb-history-actions .iwb-btn-sm { padding: 1px 6px; font-size: 10px; }
.iwb-history-actions .iwb-btn-sm { padding: 2px 6px; font-size: 11px; }
.iwb-history-more { display: flex; justify-content: center; padding: 4px 0 2px; }
/* 只作用于图库自己的空态提示:不加前缀会泄漏到设置页等使用 .iwb-hint 的地方(文字被居中) */
.iwb-history-embedded .iwb-hint { font-size: 11px; color: var(--iwb-text2); text-align: center; padding: 12px 6px; }
+1 -1
View File
@@ -439,7 +439,7 @@
global.IWBPluginHost.register({
id: 'grouplib',
name: '节点组',
version: '1.0.4',
version: '1.0.5',
apiVersion: 1,
capabilities: ['panels', 'grouplib'],
data: { schemaVersion: 1, maxBytes: 65536 },
+3 -3
View File
@@ -1,7 +1,7 @@
{
"id": "grouplib",
"name": "节点组",
"version": "1.0.4",
"version": "1.0.5",
"apiVersion": 1,
"main": "main.js",
"style": "styles.css",
@@ -13,7 +13,7 @@
"节点组"
],
"files": {
"main.js": "8cb2e39f9880d49c9b9c15a1f7d62d9772170c8d0eac0faaa237bb7056af34ff",
"styles.css": "ee6e292ffebdcc1351651bf7937399128ae06e0b364624792f34111866f9355b"
"main.js": "f59e06065392d01c2e87808382d546d91bf8d57451ef81922b3204f36e6490c9",
"styles.css": "909e49d15a183ab9f36c298241fcab4506ed29e22b5a5daa47f086cbc7a65376"
}
}
+1 -1
View File
@@ -36,7 +36,7 @@
.iwb-glp-dragging { opacity: .55; }
/* 空态:虚线框 */
.iwb-glp-empty {
margin: 4px 0; padding: 14px 12px; border-radius: 10px; text-align: center;
margin: 4px 0; padding: 12px 12px; border-radius: 10px; text-align: center;
border: 1px dashed var(--iwb-border2, #b9bfca); color: var(--iwb-text2, #4d5668);
font-size: 12px; line-height: 1.7;
}
+18 -12
View File
@@ -1,9 +1,9 @@
[
{
"id": "batch-export",
"file": "plugin-batch-export.4beb9bc20c26.js",
"version": "1.2.1",
"integrity": "sha256-S+ubwgwmP+6V2GNX1sWsL/QpV3kx9+qCo5SYl4a1NFA="
"file": "plugin-batch-export.44c13ac8e6d9.js",
"version": "1.2.2",
"integrity": "sha256-RME6yObZW4tKMZmfwtaIX4iODMFlo57baLn/y0GZbfU="
},
{
"id": "blank-canvas",
@@ -22,10 +22,10 @@
"dir": "gallery",
"main": "main.js",
"style": "styles.css",
"version": "1.6.9",
"version": "1.6.12",
"files": {
"main.js": "26c7e64b3a0021c6b9514dfb84d4d2580276698222b4791cfa99f22ead66ff52",
"styles.css": "9d5b4ab1343761e51ef0c479cab96a94d3d6eaa27f0fdb500bff789ec81d70e0"
"main.js": "a5fb039684937de44d1033c75d9872b9e6d1c8c2c9582cd5feee948562e9b7d1",
"styles.css": "35ae17de8b0f3bddab9cbef6270cd8bbf5153c9ecf6ed2b4f06216f6fef45b8b"
}
},
{
@@ -33,10 +33,10 @@
"dir": "grouplib",
"main": "main.js",
"style": "styles.css",
"version": "1.0.4",
"version": "1.0.5",
"files": {
"main.js": "8cb2e39f9880d49c9b9c15a1f7d62d9772170c8d0eac0faaa237bb7056af34ff",
"styles.css": "ee6e292ffebdcc1351651bf7937399128ae06e0b364624792f34111866f9355b"
"main.js": "f59e06065392d01c2e87808382d546d91bf8d57451ef81922b3204f36e6490c9",
"styles.css": "909e49d15a183ab9f36c298241fcab4506ed29e22b5a5daa47f086cbc7a65376"
}
},
{
@@ -44,10 +44,10 @@
"dir": "promptlib",
"main": "main.js",
"style": "styles.css",
"version": "1.8.21",
"version": "1.11.0",
"files": {
"main.js": "125e02a618e37505836f964dbe21a3637e3043ee355d9606c538a54eed4243ad",
"styles.css": "84ad2314d016c7d2351eb7cf2044ee8cc703992d40a76002ff644d34eb48838a"
"main.js": "0e1bd0f235b05b3edbdccd19ffe24791f0ce82bb5180ebe5a60dcaa6b2ed3ce8",
"styles.css": "23fd4beb4f5b89be1f763ee7221e3dbdafced85afc378cd5cc1a9e03b14d7046"
}
},
{
@@ -62,6 +62,12 @@
"version": "0.6.1",
"integrity": "sha256-Dlp/oBiy6d5wX5ESJyrQLc8Ye1NhaW9/wKEqk8TyDU4="
},
{
"id": "sticky",
"file": "plugin-sticky.af8e7249f0c7.js",
"version": "1.0.7",
"integrity": "sha256-r45ySfDHwBDMFUTuWpOpq21cJcqlYtq5DnOKUtndSLI="
},
{
"id": "style-source",
"file": "plugin-style-source.05c108f8a63c.js",
+11
View File
@@ -117,5 +117,16 @@
"资源",
"提示词"
]
},
"sticky": {
"name": "便利贴",
"desc": "画布便利贴:多行文本 + 字号/粗细调节 + 8 色背景,纯说明不连线",
"author": "official",
"icon": "📝",
"color": "#fdf3d0",
"tags": [
"标注",
"便签"
]
}
}
+305 -67
View File
@@ -55,6 +55,14 @@
}
function uid (prefix) { return prefix + Date.now().toString(36) + Math.random().toString(36).slice(2, 7) }
function groupRef (name) { return { id: name, name: name } }
// v1.11.0:封面文件名 = 内容哈希(同名即同图,天然去重;不会因改名/移动分组产生新文件)。
// 抽成模块级:迁移、保存、设置面板导入三处必须用同一个算法,否则同一张图会存出两个文件。
function coverFileName (dataUrl) {
var s = String(dataUrl || '')
var h = 5381
for (var i = 0; i < s.length; i++) h = ((h << 5) + h + s.charCodeAt(i)) >>> 0
return 'c' + h.toString(36) + '.jpg'
}
// 文件沙箱:新客户端有独立 files 能力;老客户端退到 promptlib 能力上的 file* 方法。
function fileApi (ctx) {
@@ -151,6 +159,68 @@
return 'promptlib-backup-' + d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0') + '.json'
}
// 单条提示词分享(2026-11-24):文本带前缀,可直接粘到聊天软件;导入两种都认(带前缀 / 纯 JSON)。
var SHARE_TAG = 'IWB-PROMPT-SHARE'
function plpParseShare (raw) {
var t = String(raw || '').trim()
if (t.indexOf(SHARE_TAG) === 0) t = t.slice(SHARE_TAG.length).trim()
var obj = null
try { obj = JSON.parse(t) } catch (e) { return null }
var item = obj && (obj.kind === 'prompt-share' ? obj.sharing : (obj.sharing || (obj.text ? obj : null)))
if (!item || typeof item.text !== 'string' || !item.text.trim()) return null
return item
}
// v1.10.1:分享封面开关已移除——文本分享恒纯文字、文件分享恒带封面,不再有全局开关。
// (旧的 shareWithCover() / plpSharePayload() 已删除;plpCoverUrl 仍供备份导出使用。)
// ===== v1.11.0:未引用封面回收(P1)=====
// 为什么要有:封面是「内容哈希命名的图片文件」。换封面 / 删词条 / 取消编辑都会留下不再被引用的文件,
// 久了 64MB 沙箱被垃圾占满(用户看到「总量超限,请先清理」却找不到可清的东西)。
// 判定放在模块级:面板(有 prompts 作用域)与设置页(自带 state)必须用**同一套**规则,
// 否则两处各删一半,第三处又不知道谁还在用。
// 安全线:keep 为空时不删(空集合 = 把封面全删的形状,只有人工显式确认的路径才允许)。
var PLP_GC_BUSY = false
function plpGcCoverFiles (FA, keepNames, opts) {
var o = opts || {}
if (!FA || typeof FA.list !== 'function' || typeof FA.remove !== 'function') return Promise.resolve({ removed: 0, bytes: 0, skipped: 'no-fs' })
if (PLP_GC_BUSY) return Promise.resolve({ removed: 0, bytes: 0, skipped: 'busy' })
var keep = {}
var kept = 0
;(keepNames || []).forEach(function (n) {
n = String(n || '')
if (n) { keep[n] = 1; kept++ }
})
if (!kept && !o.manual) return Promise.resolve({ removed: 0, bytes: 0, skipped: 'empty' })
PLP_GC_BUSY = true
return Promise.resolve(FA.list()).then(function (list) {
var rows = Array.isArray(list) ? list : ((list && list.files) || [])
var victims = rows.filter(function (f) {
var name = String((f && f.name) || '')
if (!name || keep[name]) return false
return /\.(jpg|jpeg|png|webp)$/i.test(name)
})
var bytes = 0
victims.forEach(function (f) { bytes += Number(f && f.size) || 0 })
var removed = 0
var seq = Promise.resolve()
victims.forEach(function (f) {
seq = seq.then(function () {
return Promise.resolve(FA.remove(f.name)).then(function (r) { if (!r || r.ok !== false) removed++ }).catch(function () {})
})
})
return seq.then(function () { PLP_GC_BUSY = false; return { removed: removed, bytes: bytes } })
}).catch(function () { PLP_GC_BUSY = false; return { removed: 0, bytes: 0, skipped: 'error' } })
}
// 从词条列表里取「被引用的封面文件名」
function plpCoverNamesOf (list) {
var out = []
;(list || []).forEach(function (p) {
var c = p && p.cover
if (c && typeof c === 'object' && c.img) out.push(String(c.img))
})
return out
}
function renderPluginSettings () {
var root = el('div', { class: 'iwb-plp-settings' })
var state = { prompts: [], groups: [] }
@@ -213,7 +283,9 @@
var st = rs[1] || {}
var covers = state.prompts.filter(function (p) { return p && p.cover }).length
var size = st.bytes || 0
usage.textContent = (rs[0] || 'plugin-data/promptlib') + ' · ' + (size > 1024 ? (size / 1024).toFixed(0) + ' KB' : size + ' B') + ' · ' + state.prompts.length + ' 条 · ' + state.groups.length + ' 个分组 · ' + covers + ' 张封面'
var files = Number(st.count) || 0
// v1.11.0:封面「引用数 / 文件数」分开显示 —— 两者不等就说明有孤儿文件可清。
usage.textContent = (rs[0] || 'plugin-data/promptlib') + ' · ' + (size > 1024 ? (size / 1024).toFixed(0) + ' KB' : size + ' B') + ' · ' + state.prompts.length + ' 条 · ' + state.groups.length + ' 个分组 · 封面 ' + covers + ' 张 / 文件 ' + files + ' 个'
})
}
@@ -260,9 +332,7 @@
return Promise.all(payload.prompts.map(function (p) {
var c = p && p.cover
if (typeof c !== 'string' || c.indexOf('data:') !== 0 || !PLP_CTX.files) return Promise.resolve(p)
var h = 5381
for (var i = 0; i < c.length; i++) h = ((h << 5) + h + c.charCodeAt(i)) >>> 0
var name = 'c' + h.toString(36) + '.jpg'
var name = coverFileName(c)
return Promise.resolve(PLP_CTX.files.put(name, c)).then(function (res) { return res && res.ok ? Object.assign({}, p, { cover: { img: name } }) : p }).catch(function () { return p })
})).then(function (incoming) {
var byId = {}
@@ -283,6 +353,7 @@
})
}).catch(function (e) { impBtn.disabled = false; status.textContent = '导入失败:' + ((e && e.message) || e) })
})
// v1.10.0:设置面板不再放单条提示词导入入口,导入统一走词库面板顶部的「文件 / 文本」。
s2.appendChild(el('div', { class: 'iwb-plp-sbtns' }, expBtn, impBtn))
s2.appendChild(el('label', { class: 'iwb-plp-sopt' }, overwrite, el('span', { text: '导入时覆盖同名条目' })))
s2.appendChild(status)
@@ -291,13 +362,39 @@
var s3 = el('div', { class: 'iwb-plp-ssec' })
s3.appendChild(el('div', { class: 'iwb-plp-stitle', text: '数据位置' }))
s3.appendChild(usage)
// v1.11.0:未引用封面回收。换封面/删词条会留下孤儿文件,久了把 64MB 沙箱占满。
// 自动清理已在面板加载后跑一次;这里是「我想立刻清」的显式入口(会先读一次最新数据做引用集合)。
var gcBtn = el('button', { class: 'iwb-btn iwb-btn-sm', title: '删除已不再被任何词条引用的封面图片文件', text: '清理未引用封面' })
var openBtn = el('button', { class: 'iwb-btn iwb-btn-sm', text: '打开数据目录' })
openBtn.addEventListener('click', function () {
var ctx = PLP_CTX || {}
if (!ctx.promptlib || typeof ctx.promptlib.openPath !== 'function') { plpNotify('当前客户端不支持打开目录', 'err'); return }
Promise.resolve(ctx.promptlib.openPath('plugin-data/promptlib')).catch(function (e) { plpNotify('打开失败:' + ((e && e.message) || e), 'err') })
})
s3.appendChild(el('div', { class: 'iwb-plp-sbtns' }, openBtn))
gcBtn.addEventListener('click', function () {
var ctx = PLP_CTX || {}
var FA = fileApi(ctx)
if (!FA) { plpNotify('文件能力不可用,无法清理', 'err'); return }
gcBtn.disabled = true; status.textContent = '正在清理未引用封面…'
// 每次现读一次数据:设置页可能比面板更"新"(面板没开时用户刚删过词条)
Promise.resolve(plpLoad()).then(function (d) {
state.prompts = (d && d.prompts) || state.prompts
state.groups = (d && d.groups) || state.groups
return plpGcCoverFiles(FA, plpCoverNamesOf(state.prompts), { manual: true })
}).then(function (r) {
gcBtn.disabled = false
if (!r || !r.removed) {
status.textContent = (r && r.skipped === 'no-fs') ? '文件能力不可用,无法清理' : '没有未引用的封面(文件已经是最简状态)'
} else {
status.textContent = '✓ 已清理 ' + r.removed + ' 个未引用封面' + (r.bytes ? '(约 ' + Math.max(1, Math.round(r.bytes / 1024)) + ' KB)' : '')
}
refreshUsage(); paint(); plpNotify(status.textContent)
}).catch(function (e) {
gcBtn.disabled = false
status.textContent = '清理失败:' + ((e && e.message) || e)
})
})
s3.appendChild(el('div', { class: 'iwb-plp-sbtns' }, gcBtn, openBtn))
root.appendChild(s3)
plpLoad().then(function (d) { state.prompts = d.prompts || []; state.groups = d.groups || []; paint(); refreshUsage() })
@@ -346,11 +443,6 @@
var SCHEMA = 3
var migrateDone = false
function hashName (s) {
var h = 5381
for (var i = 0; i < s.length; i++) h = ((h << 5) + h + s.charCodeAt(i)) >>> 0
return 'c' + h.toString(36)
}
function coverNameOf (p) {
var c = p && p.cover
if (c && typeof c === 'object' && c.img) return String(c.img)
@@ -399,7 +491,7 @@
var jobs = list.map(function (p) {
var c = p && p.cover
if (!FILEAPI || typeof c !== 'string' || c.indexOf('data:') !== 0) return Promise.resolve(p)
var name = hashName(c) + '.jpg'
var name = coverFileName(c)
return Promise.resolve(FILEAPI.put(name, c)).then(function (res) {
return res && res.ok ? Object.assign({}, p, { cover: { img: name } }) : p
}).catch(function () { return p })
@@ -427,9 +519,7 @@
var failed = 0
Promise.all(need.map(function (p) {
var c = p.cover
var h = 5381
for (var i = 0; i < c.length; i++) h = ((h << 5) + h + c.charCodeAt(i)) >>> 0
var name = 'c' + h.toString(36) + '.jpg'
var name = coverFileName(c)
return Promise.resolve(FILEAPI.put(name, c)).then(function (r) {
if (r && r.ok) return { id: p.id, item: Object.assign({}, p, { cover: { img: name } }) }
failed++
@@ -454,6 +544,46 @@
}
}).catch(function () {})
}
// ===== v1.11.0:封面文件治理(P1)=====
// 背景:封面是「按内容哈希命名的图片文件」。换封面 / 删词条 / 取消编辑都会留下**不再被引用的文件**,
// 时间久了 64MB 沙箱被垃圾占满(用户看到「总量超限,请先清理」却找不到东西可清)。
// 纪律(每条都对应一次真实误删风险):
// ① 自动 GC 只在「数据确实来自插件 JSON」时跑:数据没读到 ⇒ keep 集合为空 ⇒ 会把封面全删;
// ② 库为空时自动 GC 也不跑(keep 为空同样是删光的形状);
// ③ 刚 put 进沙箱、还没被 prompts 引用的名字进 pending,GC 必须跳过;
// ④ 只删图片扩展名的文件;两张词条共用同一封面 = 同一个名字,天然保留。
var pendingCoverNames = {}
var dataFromPlugin = false
// dataURL → { img: 文件名 };失败原样返回(宁可留着内联 base64,也不丢封面)
function ensureCoverFile (cover) {
if (!FILEAPI || typeof cover !== 'string' || cover.indexOf('data:') !== 0) return Promise.resolve(cover)
var name = coverFileName(cover)
pendingCoverNames[name] = 1
return Promise.resolve(FILEAPI.put(name, cover)).then(function (r) {
if (r && r.ok) return { img: name }
delete pendingCoverNames[name]
return cover
}).catch(function () { delete pendingCoverNames[name]; return cover })
}
// 回收未被任何词条引用的封面文件(判定在模块级 plpGcCoverFiles,设置页复用同一套)。
// 返回 { removed, bytes, skipped }
function gcCoverFiles (opts) {
var o = opts || {}
// 自动路径(启动后 / 删词条后):数据不是从插件 JSON 读来的就**不删**——
// 那种情况下 prompts 可能是空数组,keep 集合同样为空,一刀下去封面全没。
if (!o.manual && !dataFromPlugin) return Promise.resolve({ removed: 0, bytes: 0, skipped: 'no-source' })
var names = []
prompts.forEach(function (p) { var n = coverNameOf(p); if (n) names.push(n) })
Object.keys(pendingCoverNames).forEach(function (n) { names.push(n) })
return plpGcCoverFiles(FILEAPI, names, o)
}
// 启动后就地跑一次:延迟到 convertInlineCovers 的写入之后,避免删掉刚落盘的封面
function scheduleCoverGc (delay) {
setTimeout(function () { gcCoverFiles() }, delay || 4000)
}
function load () { return loadOnce(0) }
try { ctx.storage && ctx.storage.set('diag', JSON.stringify({ files: !!ctx.files, keys: Object.keys(ctx.promptlib || {}).slice(0, 24), hasPut: typeof (ctx.promptlib || {}).filePut, hasData: !!ctx.data })) } catch (e) { /* ignore */ }
function loadOnce (attempt) {
@@ -471,11 +601,13 @@
loadError = ''
prompts = d.prompts.map(normalize)
groups = Array.isArray(d.groups) ? d.groups : []
dataFromPlugin = true
render()
convertInlineCovers()
scheduleCoverGc(4000)
return true
}
if (d && Array.isArray(d.prompts) && !d.prompts.length) { prompts = []; groups = []; render(); return true }
if (d && Array.isArray(d.prompts) && !d.prompts.length) { prompts = []; groups = []; dataFromPlugin = true; render(); return true }
return migrateFromHost()
}).catch(function () { return legacyLoad() })
}
@@ -641,23 +773,15 @@
e.preventDefault(); e.stopPropagation()
closeMenu()
var menu = el('div', { class: 'iwb-ctxmenu iwb-lib-group-menu', style: 'left:' + e.clientX + 'px;top:' + e.clientY + 'px' })
menu.appendChild(el('div', { class: 'iwb-ctx-title', text: '移动到分组' }))
var item = function (label, value) {
var b = el('button', { class: 'iwb-ctx-item', text: label })
b.addEventListener('click', function () {
closeMenu()
save(prompts.map(function (x) { return x.id === p.id ? Object.assign({}, x, { group: value }) : x }))
.then(function () { notify('已移动到' + (value || '未分组')) })
})
menu.appendChild(b)
}
item('未分组', '')
groupsOf().forEach(function (g) { item(g.name, g.name) })
var sep = el('div', { class: 'iwb-ctx-sep' })
menu.appendChild(sep)
var ed = el('button', { class: 'iwb-ctx-item', text: '编辑…' })
ed.addEventListener('click', function () { closeMenu(); openEditModal(p, false) })
menu.appendChild(ed)
var st = el('button', { class: 'iwb-ctx-item', text: '文本分享' })
st.addEventListener('click', function () { closeMenu(); doShareText(p) })
menu.appendChild(st)
var sf = el('button', { class: 'iwb-ctx-item', text: '文件分享' })
sf.addEventListener('click', function () { closeMenu(); doShareFile(p) })
menu.appendChild(sf)
document.body.appendChild(menu)
menuEl = menu
setTimeout(function () { document.addEventListener('pointerdown', onDocDown, true) }, 0)
@@ -1095,9 +1219,7 @@
return Promise.all(payload.prompts.map(function (p) {
var c = p && p.cover
if (typeof c !== 'string' || c.indexOf('data:') !== 0 || !FILEAPI) return Promise.resolve(p)
var h = 5381
for (var i2 = 0; i2 < c.length; i2++) h = ((h << 5) + h + c.charCodeAt(i2)) >>> 0
var name = 'c' + h.toString(36) + '.jpg'
var name = coverFileName(c)
return Promise.resolve(FILEAPI.put(name, c)).then(function (res) {
return res && res.ok ? Object.assign({}, p, { cover: { img: name } }) : p
}).catch(function () { return p })
@@ -1254,9 +1376,78 @@
if (c.img && FILEAPI) return Promise.resolve(FILEAPI.get(String(c.img))).then(function (r) { return (r && r.ok && r.url) || '' }).catch(function () { return '' })
return Promise.resolve('')
}
// ===== 2026-11-24:单条提示词分享 / 导入别人的分享 =====
// 分享格式刻意做成「可读的 JSON 文本」,直接粘到微信/QQ 也能看懂;导入时两种都认:
// ① 带 IWB-PROMPT 头的整段文本 ② 直接是 {kind:'prompt-share'} 的 JSON
// v1.10.0:withCover 显式传入——文本分享恒传 false(纯文字、短),文件分享传 true(封面放文件里不怕大)。
// v1.10.1:开关已删,只认显式布尔;未传一律按纯文字,不再回退读设置。
function sharePayload (p, withCover) {
var body = { app: 'image-workbench', kind: 'prompt-share', version: 1, sharing: { name: p.name || '', text: p.text || '', vars: varsOf(p), group: p.group || '', tags: p.tags || [] } }
var wantCover = withCover === true
if (!wantCover) return Promise.resolve(SHARE_TAG + '\n' + JSON.stringify(body))
return coverToDataUrl(p).then(function (cv) {
if (cv && cv.length < 300000) body.sharing.cover = cv
return SHARE_TAG + '\n' + JSON.stringify(body)
})
}
function shareFileName (p) {
return (String((p && p.name) || '提示词').replace(/[\\/:*?"<>|]/g, '_').trim() || '提示词').slice(0, 40) + '.json'
}
// 文本分享:复制纯文字(不带封面),内容最短,直接粘到聊天软件。
function doShareText (p) {
if (!p) return
sharePayload(p, false).then(function (text) {
return Promise.resolve(api.copy(text)).then(function (r) {
if (r && r.ok === false) { notify('分享失败:' + ((r && r.error) || '剪贴板不可用'), 'err'); return }
notify('已复制纯文字分享,粘贴给对方即可')
})
}).catch(function (e) { notify('分享失败:' + ((e && e.message) || e), 'err') })
}
// 文件分享:导出带封面的 .json 文件,作为附件发给对方(文件不怕大)。
function doShareFile (p) {
if (!p) return
sharePayload(p, true).then(function (text) {
return Promise.resolve(api.exportText(shareFileName(p), text)).then(function (r) {
if (r && r.ok) notify('已导出分享文件:' + (r.path || shareFileName(p)))
else if (r && r.canceled) notify('已取消')
else notify('导出失败:' + ((r && r.error) || '未知错误'), 'err')
})
}).catch(function (e) { notify('导出失败:' + ((e && e.message) || e), 'err') })
}
// 分享入库:剪贴板导入与文件导入共用,避免两套逻辑跑偏。
function importShareItem (item) {
var name = String(item.name || '').trim() || ('导入的提示词 ' + String(item.text).slice(0, 8) + '…')
var incoming = normalize({ id: uid('q'), name: name, text: item.text, group: String(item.group || ''), tags: item.tags || [] })
var cv = item.cover
var ready = (typeof cv === 'string' && cv.indexOf('data:') === 0 && FILEAPI)
? Promise.resolve(FILEAPI.put(coverFileName(cv), cv)).then(function (res) { return res && res.ok ? Object.assign({}, incoming, { cover: { img: coverFileName(cv) } }) : incoming }).catch(function () { return incoming })
: Promise.resolve(incoming)
return ready.then(function (p2) {
prompts = prompts.concat([p2])
return persist().then(function () { render(); notify('已导入分享:' + (p2.name || '')); return { ok: true, name: p2.name } })
})
}
function doImportShare () {
return Promise.resolve(api.paste && api.paste()).then(function (r) {
if (!r || r.ok === false) { notify('读取剪贴板失败:' + ((r && r.error) || '剪贴板不可用'), 'err'); return { ok: false } }
var item = plpParseShare(r.text)
if (!item) { notify('剪贴板里没有可识别的提示词分享', 'err'); return { ok: false, error: 'no-share' } }
return importShareItem(item)
}).catch(function (e) { notify('导入失败:' + ((e && e.message) || e), 'err'); return { ok: false } })
}
function importShareFromFile () {
return Promise.resolve(api.importText && api.importText()).then(function (r) {
if (!r || r.ok === false) { notify((r && r.canceled) ? '已取消' : ('读取文件失败:' + ((r && r.error) || '未知错误'))); return { ok: false } }
var item = plpParseShare(r.text)
if (!item) { notify('文件里没有可识别的提示词分享', 'err'); return { ok: false, error: 'no-share' } }
return importShareItem(item)
}).catch(function (e) { notify('导入失败:' + ((e && e.message) || e), 'err'); return { ok: false } })
}
function openBackup () {
var exportBtn = el('button', { class: 'iwb-btn iwb-btn-sm iwb-btn-primary', text: '导出备份…' })
var importBtn = el('button', { class: 'iwb-btn iwb-btn-sm', text: '导入备份…' })
var importShareBtn = el('button', { class: 'iwb-btn iwb-btn-sm', title: '读取剪贴板里的单条提示词分享并加入提示词库', text: '导入分享…' })
var overwrite = el('input', { type: 'checkbox' })
var status = el('div', { class: 'iwb-hint', text: '' })
openDialog({
@@ -1276,6 +1467,7 @@
bodyEl.appendChild(box)
footEl.appendChild(exportBtn)
footEl.appendChild(importBtn)
footEl.appendChild(importShareBtn)
exportBtn.addEventListener('click', function () {
exportBtn.disabled = true
status.textContent = '正在导出…'
@@ -1296,6 +1488,16 @@
else { status.textContent = '导出失败:' + ((r && r.error) || '未知错误'); notify('导出失败', 'err') }
}).catch(function (e) { exportBtn.disabled = false; status.textContent = '导出失败:' + ((e && e.message) || e); notify('导出失败', 'err') })
})
importShareBtn.addEventListener('click', function () {
importShareBtn.disabled = true
status.textContent = '读取剪贴板…'
doImportShare().then(function (r) {
importShareBtn.disabled = false
if (r && r.ok) status.textContent = '已导入分享:' + (r.name || '')
else if (r && r.error === 'no-share') status.textContent = '剪贴板里没有可识别的提示词分享'
else status.textContent = '导入失败'
}).catch(function (e) { importShareBtn.disabled = false; status.textContent = '导入失败:' + ((e && e.message) || e) })
})
importBtn.addEventListener('click', function () {
importBtn.disabled = true
status.textContent = '等待选择文件…'
@@ -1307,9 +1509,7 @@
return Promise.all(payload.prompts.map(function (p) {
var c = p && p.cover
if (typeof c !== 'string' || c.indexOf('data:') !== 0 || !FILEAPI) return Promise.resolve(p)
var h = 5381
for (var i2 = 0; i2 < c.length; i2++) h = ((h << 5) + h + c.charCodeAt(i2)) >>> 0
var name = 'c' + h.toString(36) + '.jpg'
var name = coverFileName(c)
return Promise.resolve(FILEAPI.put(name, c)).then(function (res) {
return res && res.ok ? Object.assign({}, p, { cover: { img: name } }) : p
}).catch(function () { return p })
@@ -1407,10 +1607,14 @@
ask('删除提示词「' + (p.name || '未命名') + '」?', { title: '删除提示词', okText: '删除' }).then(function (ok) {
if (!ok) return
dlg.close()
save(prompts.filter(function (x) { return x.id !== p.id })).then(function () { notify('已删除') })
save(prompts.filter(function (x) { return x.id !== p.id })).then(function () { notify('已删除'); scheduleCoverGc(1200) })
})
})
cp.addEventListener('click', function () { Promise.resolve(api.copy(filled())).then(function (r) { if (r && r.ok === false) notify('复制失败', 'err'); else notify('已复制全文') }) })
var shareText = el('button', { class: 'iwb-btn iwb-btn-sm', title: '复制纯文字分享,粘贴给对方即可导入(不含封面,内容短)', text: '文本分享' })
shareText.addEventListener('click', function () { doShareText(p) })
var shareFile = el('button', { class: 'iwb-btn iwb-btn-sm', title: '导出带封面的分享文件,作为附件发给对方', text: '文件分享' })
shareFile.addEventListener('click', function () { doShareFile(p) })
ins.addEventListener('click', function () { dlg.close(); beginPlacement('prompt', { text: filled(), name: p.name || '' }) })
var insImg = null
if (p.cover) {
@@ -1425,7 +1629,11 @@
}).catch(function () { notify('插入封面失败', 'err') })
})
}
footEl.appendChild(del); footEl.appendChild(el('span', { class: 'iwb-drawer-spacer' })); if (insTpl) footEl.appendChild(insTpl); footEl.appendChild(cp)
footEl.appendChild(del); footEl.appendChild(el('span', { class: 'iwb-drawer-spacer' }))
footEl.appendChild(shareText); footEl.appendChild(shareFile)
// v1.10.1:分享组与插入组之间加竖向分割线(替代原来的 26px 空白)。
footEl.appendChild(el('span', { class: 'iwb-plp-foot-vsep' }))
footEl.appendChild(cp); if (insTpl) footEl.appendChild(insTpl)
if (insImg) footEl.appendChild(insImg)
footEl.appendChild(ins)
},
@@ -1441,7 +1649,7 @@
var dirty = false
openDialog({
key: 'edit',
title: isNew ? '新建提示词' : '编辑提示词',
title: isNew ? '新建词例' : '编辑词例',
width: 880, height: 640,
actions: [cancelBtn, saveBtn],
onSaveKey: function () { doSave() },
@@ -1466,15 +1674,19 @@
rd.onload = function () {
Promise.resolve(api.putCover(String(rd.result || ''))).then(function (r) {
if (!(r && r.ok && r.ref)) { notify('封面上传失败', 'err'); return }
draft.cover = r.ref
dirty = true
Object.keys(coverCache).forEach(function (k) { if (k.indexOf(draft.id + '|') === 0) delete coverCache[k] })
Promise.resolve(api.coverUrl(r.ref)).then(function (u) {
if (u && u.url) {
draft._coverUrl = u.url
coverCache[draft.id + '|s:' + String(r.ref).slice(-32)] = u.url
}
repaint(); render(); notify('封面已更新')
// v1.11.0:上传即落成文件(数据里只留文件名)——
// 之前 draft.cover 存的是 dataURL,doSave 直接把它写进 JSON,一条封面就把数据文件顶大几十 KB。
return ensureCoverFile(r.ref).then(function (cover) {
draft.cover = cover
dirty = true
Object.keys(coverCache).forEach(function (k) { if (k.indexOf(draft.id + '|') === 0) delete coverCache[k] })
return resolveCoverUrl(cover).then(function (u) {
if (u) {
draft._coverUrl = u
coverCache[draft.id + '|s:' + String(cover).slice(-32)] = u
}
repaint(); render(); notify('封面已更新')
})
})
}).catch(function () { notify('封面上传失败', 'err') })
}
@@ -1533,7 +1745,8 @@
if (last < v.length) hl.appendChild(document.createTextNode(v.slice(last)))
hl.appendChild(document.createTextNode('\n'))
}
textIn.addEventListener('scroll', function () { hl.scrollTop = textIn.scrollTop })
// v1.9.3:高亮层只画变量色块,必须跟随 textarea 双向滚动(补横向,纵向沿用)
textIn.addEventListener('scroll', function () { hl.scrollTop = textIn.scrollTop; hl.scrollLeft = textIn.scrollLeft })
textIn.value = draft.text || ''
paintHl()
var varEd = makeVarsEditor(draft.text || '', draft.vars || [], function (nt) { textIn.value = nt; dirty = true; paintHl() })
@@ -1610,23 +1823,29 @@
var text = String(c.text || '').trim()
if (!text) { notify('提示词内容不能为空', 'err'); return }
var name = String(c.name || '').trim() || ('提示词 ' + text.slice(0, 8) + '…')
var item = { id: c.id, name: name, text: text, tags: c.tags, group: String(c.group || '').trim(), cover: c.cover, vars: c.vars || [] }
var list = isNew ? prompts.concat([item]) : prompts.map(function (x) { return x.id === item.id ? item : x })
var gs = groupsOf().slice()
if (item.group && !gs.some(function (g) { return g.name === item.group })) gs.push(groupRef(item.group))
close()
save(list, gs).then(function () {
notify(isNew ? '已创建' : '已保存')
if (!isNew) { try { openDetailModal(item) } catch (e) { /* ignore */ } }
})
// v1.11.0:保存前把内联封面落成文件(数据里只留 { img }),避免 base64 把 JSON 顶大
saveBtn.disabled = true
ensureCoverFile(c.cover).then(function (finalCover) {
var item = { id: c.id, name: name, text: text, tags: c.tags, group: String(c.group || '').trim(), cover: finalCover, vars: c.vars || [] }
var list = isNew ? prompts.concat([item]) : prompts.map(function (x) { return x.id === item.id ? item : x })
var gs = groupsOf().slice()
if (item.group && !gs.some(function (g) { return g.name === item.group })) gs.push(groupRef(item.group))
close()
return save(list, gs).then(function () {
notify(isNew ? '已创建' : '已保存')
if (!isNew) { try { openDetailModal(item) } catch (e) { /* ignore */ } }
})
}).catch(function () { saveBtn.disabled = false; notify('保存失败', 'err') })
}
saveBtn.addEventListener('click', doSave)
cancelBtn.addEventListener('click', function () { close(); if (!isNew && p) { try { openDetailModal(p) } catch (e) { /* ignore */ } } })
dupBtn.addEventListener('click', function () {
var c = collect()
var copy = Object.assign({}, c, { id: uid('q'), name: (String(c.name || '提示词').trim()) + ' 副本' })
close()
save(prompts.concat([copy])).then(function () { notify('已另存副本') })
ensureCoverFile(c.cover).then(function (cover) {
var copy = Object.assign({}, c, { id: uid('q'), name: (String(c.name || '提示词').trim()) + ' 副本', cover: cover })
return save(prompts.concat([copy])).then(function () { notify('已另存副本') })
}).catch(function () { notify('另存副本失败', 'err') })
})
insBtn.addEventListener('click', function () {
var c = collect()
@@ -1645,10 +1864,29 @@
var top = el('div', { class: 'iwb-row' })
var search = el('input', { class: 'iwb-input iwb-grow', placeholder: '搜索名称 / 内容 / 标签…', value: query })
search.addEventListener('input', function () { query = search.value; render(); var n = wrap.querySelector('input.iwb-input'); if (n) { n.focus(); try { n.setSelectionRange(n.value.length, n.value.length) } catch (e) { /* ignore */ } } })
var newBtn = el('button', { class: 'iwb-btn iwb-btn-sm iwb-btn-primary', title: '新建提示词', text: '+ 新建提示词' })
// v1.10.0:顶部三入口 = 文件(从分享文件导入)/ 文本(从剪贴板导入)/ 新建。
var fileBtn = el('button', { class: 'iwb-btn iwb-btn-sm', title: '从分享文件导入词例', text: '文件' })
var textBtn = el('button', { class: 'iwb-btn iwb-btn-sm', title: '从剪贴板导入词例', text: '文本' })
var newBtn = el('button', { class: 'iwb-btn iwb-btn-sm iwb-btn-primary', title: '新建词例', text: '新建' })
fileBtn.addEventListener('click', function () {
fileBtn.disabled = true
importShareFromFile().then(function (r) {
fileBtn.disabled = false
if (r && r.ok === false && r.error === 'no-share') notify('文件里没有可识别的词例分享', 'err')
else if (r && r.ok === false) notify('导入失败', 'err')
}).catch(function (e) { fileBtn.disabled = false; notify('导入失败:' + ((e && e.message) || e), 'err') })
})
textBtn.addEventListener('click', function () {
textBtn.disabled = true
doImportShare().then(function (r) {
textBtn.disabled = false
if (r && r.ok === false && r.error === 'no-share') notify('剪贴板里没有可识别的词例分享', 'err')
else if (r && r.ok === false) notify('导入失败', 'err')
}).catch(function (e) { textBtn.disabled = false; notify('导入失败:' + ((e && e.message) || e), 'err') })
})
newBtn.addEventListener('click', function () { openEditModal(null, true) })
top.appendChild(search); top.appendChild(newBtn)
top.appendChild(search); top.appendChild(fileBtn); top.appendChild(textBtn); top.appendChild(newBtn)
fixed.appendChild(top)
if (words().length) {
@@ -1721,7 +1959,7 @@
items.forEach(function (p) {
var starred = (p.group || '') === '收藏'
var coverUrl = coverOf(p)
var card = el('div', { class: 'iwb-plp-card' + (p.cover ? ' has-cover' : ' no-cover'), title: '双击查看详情 · 拖到画布插入 · 右键移动到分组' })
var card = el('div', { class: 'iwb-plp-card' + (p.cover ? ' has-cover' : ' no-cover'), title: '双击查看详情 · 拖到画布插入 · 右键编辑/分享' })
var bg = el('div', { class: 'iwb-plp-bg' })
bg.style.background = coverUrl ? 'var(--iwb-plugin-inset)' : gradOf(p)
if (coverUrl) bg.appendChild(el('img', { class: 'iwb-plp-cover', src: coverUrl, alt: '', draggable: 'false' }))
@@ -1763,11 +2001,13 @@
global.IWBPluginHost.register({
id: 'promptlib',
name: '提示词库',
version: '1.8.21',
version: '1.11.0',
apiVersion: 1,
capabilities: ['panels', 'promptlib', 'nodeTypes', 'canvas', 'canvasWrite'],
data: { schemaVersion: 3, maxBytes: 4 * 1024 * 1024 },
settings: { panel: { type: 'custom', label: '分组与备份', render: renderPluginSettings } },
settings: {
panel: { type: 'custom', label: '分组与备份', render: renderPluginSettings },
},
}, function (ctx) {
PLP_CTX = ctx
// v1.5.0:插件激活时就把旧数据迁到插件目录(不等面板打开),
@@ -1800,9 +2040,7 @@
return Promise.all(list.map(function (p) {
var c = p && p.cover
if (typeof c !== 'string' || c.indexOf('data:') !== 0) return Promise.resolve(p)
var h = 5381
for (var i2 = 0; i2 < c.length; i2++) h = ((h << 5) + h + c.charCodeAt(i2)) >>> 0
var name = 'c' + h.toString(36) + '.jpg'
var name = coverFileName(c)
return Promise.resolve(FA.put(name, c)).then(function (res) {
return res && res.ok ? Object.assign({}, p, { cover: { img: name } }) : p
}).catch(function () { return p })
+3 -3
View File
@@ -1,7 +1,7 @@
{
"id": "promptlib",
"name": "提示词库",
"version": "1.8.21",
"version": "1.11.0",
"apiVersion": 1,
"main": "main.js",
"style": "styles.css",
@@ -13,7 +13,7 @@
"提示词"
],
"files": {
"main.js": "125e02a618e37505836f964dbe21a3637e3043ee355d9606c538a54eed4243ad",
"styles.css": "84ad2314d016c7d2351eb7cf2044ee8cc703992d40a76002ff644d34eb48838a"
"main.js": "0e1bd0f235b05b3edbdccd19ffe24791f0ce82bb5180ebe5a60dcaa6b2ed3ce8",
"styles.css": "23fd4beb4f5b89be1f763ee7221e3dbdafced85afc378cd5cc1a9e03b14d7046"
}
}
+135 -117
View File
@@ -1,3 +1,4 @@
.iwb-promptlib, .iwb-plp-dialog, .iwb-plp-mask, .iwb-plp-dragghost, .iwb-plp-placebox{--iwb-plp-accent:#6b4dff;--iwb-plp-accent-soft:#f1ecff;--iwb-plp-accent-border:#d9d3ff}
/* promptlib(提示词库)自带样式
作用域全部带 .iwb-plp-*,不影响宿主与其他插件;样式随插件发布,不必等客户端发版。 */
@@ -34,9 +35,9 @@
.iwb-plp-card:hover { border-color: var(--iwb-border2, #b9bfca); }
.iwb-plp-cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.iwb-plp-t {
position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 7px 6px;
position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 6px 6px;
background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,.66));
color: var(--plp-c1, #fff); font-size: 10.5px; line-height: 1.35; max-height: 48%;
color: var(--plp-c1, #fff); font-size: 11px; line-height: 1.35; max-height: 48%;
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
@@ -54,26 +55,26 @@
/* 编辑弹窗:760 宽 + 大文本框 */
.iwb-promptlib-editor { width: 760px; max-width: 94vw; }
.iwb-promptlib-editor .iwb-modal-body { max-height: 78vh; }
.iwb-promptlib-text { min-height: 360px; height: 44vh; font-size: 12.5px; line-height: 1.9; resize: vertical; }
.iwb-promptlib-text { min-height: 360px; height: 44vh; font-size: 13px; line-height: 1.9; resize: vertical; }
.iwb-plp-editor-cover { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.iwb-plp-editor-thumb { flex: 0 0 96px; width: 96px; height: 128px; border-radius: 8px; overflow: hidden; border: 1px solid var(--iwb-border, #d5d9e0); }
.iwb-plp-editor-coverops { display: flex; flex-direction: column; gap: 8px; }
/* v1.2.0:可拖动 / 可缩放的详情与编辑弹窗(同宽 880×640,最小 640×420) */
.iwb-plp-mask { background: transparent; display: block; }
.iwb-plp-dialog { display: flex; flex-direction: column; overflow: hidden; border-radius: 16px;
.iwb-plp-dialog { display: flex; flex-direction: column; overflow: hidden; border-radius: 14px;
box-shadow: 0 24px 60px rgba(0,0,0,.28); }
.iwb-plp-dhead { display: flex; align-items: center; gap: 6px; padding: 10px 14px;
.iwb-plp-dhead { display: flex; align-items: center; gap: 6px; padding: 10px 12px;
border-bottom: 1px solid var(--iwb-border, #d5d9e0); cursor: move; user-select: none; }
.iwb-plp-grip { display: grid; grid-template-columns: repeat(3, 3px); gap: 2px; margin-right: 6px; }
.iwb-plp-grip i { width: 3px; height: 3px; border-radius: 50%; background: var(--iwb-border2, #b9bfca); display: block; }
.iwb-plp-dbody { flex: 1 1 auto; min-height: 0; display: flex; gap: 14px; padding: 14px; }
.iwb-plp-dbody { flex: 1 1 auto; min-height: 0; display: flex; gap: 12px; padding: 12px; }
.iwb-plp-dcov { flex: 0 0 210px; width: 210px; height: 280px; border-radius: 10px; overflow: hidden;
border: 1px solid var(--iwb-border, #d5d9e0); background: var(--iwb-plugin-inset, #f5f6f7); }
.iwb-plp-dright { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.iwb-plp-dtext { flex: 1 1 auto; min-height: 0; overflow: auto; white-space: pre-wrap; word-break: break-word;
font-size: 12px; line-height: 1.9; color: var(--iwb-text2, #4d5668); }
.iwb-plp-dfooter { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 10px 14px;
.iwb-plp-dfooter { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 10px 12px;
border-top: 1px solid var(--iwb-border, #d5d9e0); }
.iwb-plp-resize { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize;
background: linear-gradient(135deg, transparent 0 45%, var(--iwb-border2, #b9bfca) 45% 50%, transparent 50% 62%, var(--iwb-border2, #b9bfca) 62% 67%, transparent 67%); }
@@ -81,7 +82,7 @@
.iwb-plp-eleft { flex: 0 0 240px; width: 240px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.iwb-plp-ecov { width: 240px; height: 300px; border-radius: 10px; overflow: hidden;
border: 1px solid var(--iwb-border, #d5d9e0); background: var(--iwb-plugin-inset, #f5f6f7); }
.iwb-plp-lrow { display: flex; flex-direction: column; gap: 4px; font-size: 10px; color: var(--iwb-text2, #4d5668); }
.iwb-plp-lrow { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--iwb-text2, #4d5668); }
.iwb-plp-etext { flex: 1 1 auto; min-height: 0; height: auto; resize: none; font-size: 12px; line-height: 1.9; }
/* 输入框边框柔化(用户反馈现在的边框太深) */
.iwb-plp-dialog .iwb-input { border-color: color-mix(in srgb, var(--iwb-border, #d5d9e0) 72%, transparent); }
@@ -143,48 +144,50 @@
.iwb-plp-node{display:flex;flex-direction:column;gap:6px;padding:8px 10px;font-size:12px;color:var(--iwb-text,#1c2333)}
.iwb-plp-nhead{display:flex;align-items:center;gap:8px}
.iwb-plp-nthumb{width:44px;height:44px;border-radius:8px;object-fit:cover;flex:0 0 auto}
.iwb-plp-ntitle{font-weight:600;font-size:12.5px;line-height:1.3;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.iwb-plp-ntitle{font-weight:600;font-size: 13px;line-height:1.3;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.iwb-plp-nvars{display:flex;flex-direction:column;gap:4px}
.iwb-plp-nrow{display:flex;align-items:center;gap:6px;height:26px}
.iwb-plp-nk{width:64px;flex:0 0 64px;color:var(--iwb-text2,#5b6472);font-size:11.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.iwb-plp-nin{flex:1;height:24px;font-size:11.5px}
.iwb-plp-nref{display:flex;align-items:center;gap:6px;font-size:11.5px;color:var(--iwb-text2,#5b6472);border-top:1px dashed var(--iwb-border,#e3e5e9);padding-top:6px}
.iwb-plp-nk{width:64px;flex:0 0 64px;color:var(--iwb-text2,#5b6472);font-size: 12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.iwb-plp-nin{flex:1;height:24px;font-size: 12px}
.iwb-plp-nref{display:flex;align-items:center;gap:6px;font-size: 12px;color:var(--iwb-text2,#5b6472);border-top:1px dashed var(--iwb-border,#e3e5e9);padding-top:6px}
.iwb-plp-nref em{font-style:normal;color:var(--iwb-text2,#8b929c)}
.iwb-plp-nprev{margin-top:2px;border-top:1px dashed var(--iwb-border,#e3e5e9);padding-top:6px;color:var(--iwb-text2,#5b6472);font-size:11.5px;line-height:1.6;max-height:88px;overflow:hidden}
.iwb-plp-nprev{margin-top:2px;border-top:1px dashed var(--iwb-border,#e3e5e9);padding-top:6px;color:var(--iwb-text2,#5b6472);font-size: 12px;line-height:1.6;max-height:88px;overflow:hidden}
/* v1.5.0:变量编辑器 / 详情变量 */
.iwb-plp-emid{flex:1;min-width:0;display:flex;flex-direction:column;gap:8px}
.iwb-plp-vars{border:1px solid var(--iwb-border,#e3e5e9);border-radius:10px;padding:8px 10px;display:flex;flex-direction:column;gap:6px;background:var(--iwb-plugin-surface,#fff)}
.iwb-plp-vhead{display:flex;align-items:center;gap:8px;font-size:11.5px;color:var(--iwb-text2,#5b6472)}
.iwb-plp-vhead{display:flex;align-items:center;gap:8px;font-size: 12px;color:var(--iwb-text2,#5b6472)}
.iwb-plp-vhint{color:var(--iwb-text2,#8b929c);font-size:11px}
.iwb-plp-vchips{display:flex;flex-wrap:wrap;gap:6px}
.iwb-plp-vchip{display:inline-flex;align-items:center;gap:4px;padding:1px 7px;border-radius:6px;background:color-mix(in srgb, var(--iwb-plp-accent, #7c4dff) 10%, transparent);color:var(--iwb-plp-accent, #5a4bd0);font-size:11.5px}
.iwb-plp-vchip{display:inline-flex;align-items:center;gap:4px;padding: 2px 6px;border-radius:6px;background:color-mix(in srgb, var(--iwb-plp-accent, #7c4dff) 10%, transparent);color:var(--iwb-plp-accent, #5a4bd0);font-size: 12px}
.iwb-plp-vx{font-style:normal;cursor:pointer;color:var(--iwb-plp-accent, #8b7ff0);font-weight:700}
.iwb-plp-vrows{display:flex;flex-direction:column;gap:5px}
.iwb-plp-vrows{display:flex;flex-direction:column;gap: 6px}
.iwb-plp-vrow{display:flex;align-items:center;gap:8px}
.iwb-plp-vk{width:92px;flex:0 0 92px;font-size:11.5px;color:var(--iwb-text2,#5b6472);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.iwb-plp-vin{flex:1;height:26px;font-size:11.5px}
.iwb-plp-vprev{margin-top:2px;border-top:1px dashed var(--iwb-border,#e3e5e9);padding-top:6px;font-size:11.5px;line-height:1.6;color:var(--iwb-text2,#5b6472);max-height:72px;overflow:auto;white-space:pre-wrap}
.iwb-plp-dvars{display:flex;flex-direction:column;gap:5px;border:1px solid var(--iwb-border,#e3e5e9);border-radius:10px;padding:8px 10px}
.iwb-plp-vk{width:92px;flex:0 0 92px;font-size: 12px;color:var(--iwb-text2,#5b6472);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.iwb-plp-vin{flex:1;height:26px;font-size: 12px}
.iwb-plp-vprev{margin-top:2px;border-top:1px dashed var(--iwb-border,#e3e5e9);padding-top:6px;font-size: 12px;line-height:1.6;color:var(--iwb-text2,#5b6472);max-height:72px;overflow:auto;white-space:pre-wrap}
.iwb-plp-dvars{display:flex;flex-direction:column;gap: 6px;border:1px solid var(--iwb-border,#e3e5e9);border-radius:10px;padding:8px 10px}
/* v1.5.6:模板节点参照风格节点 —— 封面 + 名称 + 变量,正文不再铺开 */
.iwb-plp-nthumb{width:56px;height:56px;border-radius:8px;object-fit:cover;flex:0 0 auto}
.iwb-plp-ntitlebox{min-width:0;display:flex;flex-direction:column;gap:2px}
.iwb-plp-ntitle{font-weight:600;font-size:12.5px;line-height:1.3;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.iwb-plp-nmeta{font-size:10.5px;color:var(--iwb-text2,#8b929c)}
.iwb-plp-ntitle{font-weight:600;font-size: 13px;line-height:1.3;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.iwb-plp-nmeta{font-size: 11px;color:var(--iwb-text2,#8b929c)}
.iwb-plp-nempty{font-size:11px;color:var(--iwb-text2,#8b929c);padding:2px 0}
.iwb-plp-nwarn{font-size:11px;line-height:1.5;color:var(--iwb-warn,#d97706)}
/* v1.5.10:设置页 */
.iwb-plp-settings{display:flex;flex-direction:column;gap:18px}
.iwb-plp-ssec{border:1px solid var(--iwb-border,#e3e5e9);border-radius:12px;padding:12px 14px;display:flex;flex-direction:column;gap:8px}
.iwb-plp-stitle{font-weight:600;font-size:12.5px}
.iwb-plp-sgroups{display:flex;flex-direction:column;border:1px solid var(--iwb-border,#eef0f2);border-radius:10px;overflow:hidden}
.iwb-plp-sgrow{display:flex;align-items:center;gap:8px;padding:7px 10px;border-top:1px solid var(--iwb-border,#f1f3f5)}
.iwb-plp-settings{display:flex;flex-direction:column;gap: 16px}
/* 2026-11-24:插件设置页跟随宿主的设置分组 token(不再自画卡片,避免卡片套卡片) */
.iwb-plp-ssec{border:0;border-top:1px solid var(--iwb-set-divider,var(--iwb-border,#e3e5e9));border-radius:0;padding:var(--iwb-space-12) 0 0;display:flex;flex-direction:column;gap:var(--iwb-space-8)}
.iwb-plp-ssec:first-child{border-top:0;padding-top:0}
.iwb-plp-stitle{font-weight:600;font-size:var(--iwb-font-md,13px);color:var(--iwb-text,#2a2f36)}
.iwb-plp-sgroups{display:flex;flex-direction:column;border:1px solid var(--iwb-set-input-border,var(--iwb-border,#eef0f2));border-radius:var(--iwb-radius-card,10px);overflow:hidden}
.iwb-plp-sgrow{display:flex;align-items:center;gap:8px;padding: 6px 10px;border-top:1px solid var(--iwb-border,#f1f3f5)}
.iwb-plp-sgrow:first-child{border-top:0}
.iwb-plp-sgrip{width:12px;height:12px;background:radial-gradient(var(--iwb-text2,#c2c7cf) 1px,transparent 1px);background-size:4px 4px;border-radius:3px;flex:0 0 auto}
.iwb-plp-sgrip{width:12px;height:12px;background:radial-gradient(var(--iwb-text2,#c2c7cf) 1px,transparent 1px);background-size:4px 4px;border-radius: 6px;flex:0 0 auto}
.iwb-plp-sgname{width:170px;height:26px;font-size:12px}
.iwb-plp-sgcount{font-size:11.5px;color:var(--iwb-text2,#8b929c);width:56px}
.iwb-plp-sgcount{font-size: 12px;color:var(--iwb-text2,#8b929c);width:56px}
.iwb-plp-sadd{display:flex;gap:8px;align-items:center}
.iwb-plp-sbtns{display:flex;gap:8px;align-items:center}
.iwb-plp-sopt{display:flex;gap:8px;align-items:center;font-size:12px;color:var(--iwb-text2,#4d5668)}
@@ -202,7 +205,7 @@ flex: 1;
display: flex; gap: 6px; align-items: center;
}
.iwb-promptlib .iwb-hint {
font-size: 10px; color: var(--iwb-text2); margin-top: 4px;
font-size: 11px; color: var(--iwb-text2); margin-top: 4px;
}
.iwb-promptlib .iwb-toolbar-title {
font-weight: 700; font-size: 13px; margin-right: 2px;
@@ -217,10 +220,10 @@ width: 680px; max-width: calc(100vw - 60px); max-height: 82vh; background: var(-
display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--iwb-border);
}
.iwb-plp-dialog-body {
padding: 14px 16px; overflow: auto; display: flex; flex-direction: column; gap: 10px; max-height: 62vh;
padding: 12px 16px; overflow: auto; display: flex; flex-direction: column; gap: 10px; max-height: 62vh;
}
.iwb-promptlib .iwb-lib-body {
flex: 1; overflow: hidden; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
flex: 1; overflow: hidden; padding: 12px 12px; display: flex; flex-direction: column; gap: 8px;
}
.iwb-promptlib .iwb-lib-fixed {
flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px;
@@ -232,7 +235,7 @@ flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction:
display: none;
}
.iwb-promptlib .iwb-lib-chips-scroll > .iwb-chip:last-child {
margin-right: 18px;
margin-right: 16px;
}
.iwb-promptlib .iwb-lib-searchscope-back {
display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; padding: 0; border: none; border-radius: 999px; background: transparent; color: var(--iwb-text2); font-size: 13px; line-height: 1; cursor: pointer;
@@ -241,7 +244,7 @@ display: inline-flex; align-items: center; justify-content: center; width: 15px;
background: color-mix(in srgb, var(--iwb-text) 12%, transparent); color: var(--iwb-text);
}
.iwb-promptlib .iwb-chip {
flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; background: var(--iwb-layer); border: 1px solid var(--iwb-border); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--iwb-text2); cursor: pointer; white-space: nowrap; transition: all 0.15s;
flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; background: var(--iwb-layer); border: 1px solid var(--iwb-border); border-radius: 999px; padding: 4px 10px; font-size: 12px; color: var(--iwb-text2); cursor: pointer; white-space: nowrap; transition: all 0.15s;
}
.iwb-promptlib .iwb-chip:hover {
color: var(--iwb-text); border-color: var(--iwb-border2);
@@ -253,7 +256,7 @@ background: var(--iwb-panel); border-color: var(--iwb-border2); color: var(--iwb
color: var(--iwb-text);
}
.iwb-promptlib .iwb-chip-count {
font-size: 10px; opacity: 0.8;
font-size: 11px; opacity: 0.8;
}
.iwb-promptlib .iwb-chip-add {
font-weight: 700;
@@ -268,7 +271,7 @@ color: var(--iwb-text); opacity: 1;
border: 1px solid var(--iwb-border); border-radius: 8px; padding: 8px 10px; background: var(--iwb-panel);
}
.iwb-promptlib .iwb-tag {
display: inline-block; background: color-mix(in srgb, var(--iwb-text) 7%, transparent); color: var(--iwb-text2); border-radius: 4px; font-size: 10px; padding: 1px 6px; margin: 3px 4px 0 0;
display: inline-block; background: color-mix(in srgb, var(--iwb-text) 7%, transparent); color: var(--iwb-text2); border-radius: 6px; font-size: 11px; padding: 2px 6px; margin: 4px 4px 0 0;
}
.iwb-plp-dialog-sm {
width: 460px;
@@ -301,7 +304,7 @@ background: var(--iwb-brand); border-color: var(--iwb-brand); color: var(--iwb-o
background: color-mix(in srgb, var(--iwb-brand) 85%, var(--iwb-text)); border-color: var(--iwb-brand); color: var(--iwb-on-brand);
}
.iwb-promptlib .iwb-btn-sm {
padding: 3px 7px; font-size: 11px;
padding: 4px 6px; font-size: 11px;
}
.iwb-promptlib .iwb-btn-danger {
color: var(--iwb-err);
@@ -313,10 +316,10 @@ border-color: var(--iwb-err); color: var(--iwb-err);
position: fixed; min-width: 196px; max-width: 240px; max-height: calc(100vh - 24px); overflow-y: auto; padding: 6px; background: var(--iwb-layer); border: 1px solid var(--iwb-border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.16); z-index: 91; display: flex; flex-direction: column; gap: 2px;
}
.iwb-promptlib .iwb-ctx-title {
font-size: 10px; font-weight: 700; color: var(--iwb-text2); letter-spacing: 1px; padding: 6px 10px 2px; text-transform: uppercase;
font-size: 11px; font-weight: 700; color: var(--iwb-text2); letter-spacing: 1px; padding: 6px 10px 2px; text-transform: uppercase;
}
.iwb-promptlib .iwb-ctx-item {
display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: none; border-radius: 8px; background: transparent; color: var(--iwb-text); font-size: 12.5px; cursor: pointer; text-align: left;
display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 10px; border: none; border-radius: 8px; background: transparent; color: var(--iwb-text); font-size: 13px; cursor: pointer; text-align: left;
}
.iwb-promptlib .iwb-ctx-item .iwb-ic {
width: 14px; height: 14px; flex: 0 0 auto; color: var(--iwb-text2);
@@ -345,6 +348,11 @@ height: 1px; margin: 4px 6px; background: var(--iwb-border); flex: 0 0 auto;
.iwb-promptlib .iwb-drawer-spacer {
flex: 1 1 auto;
}
/* v1.10.1:详情底部分享组(文本/文件分享)与插入组之间的竖向分割线 */
.iwb-plp-dialog .iwb-plp-foot-vsep {
display: inline-block; width: 1px; height: 18px; flex: 0 0 auto;
align-self: center; margin: 0 12px; background: var(--iwb-border);
}
.iwb-plp-dialog .iwb-section-sub {
margin-top: 2px;
}
@@ -364,11 +372,11 @@ box-shadow: 0 24px 60px rgba(0,0,0,.32);
.iwb-plp-card.is-dragging{opacity:.55;transform:scale(.98)}
/* v1.6.9:拖拽虚拟卡片(跟手预览) */
.iwb-plp-dragghost{width:168px;display:flex;align-items:center;gap:8px;padding:8px 10px;background:var(--iwb-panel,#fff);border:2px solid var(--iwb-plp-accent,#7c4dff);border-radius:11px;box-shadow:0 12px 28px rgba(0,0,0,.22);font-size:12px;pointer-events:none;z-index:99999}
.iwb-plp-dragghost{width:168px;display:flex;align-items:center;gap:8px;padding:8px 10px;background:var(--iwb-panel,#fff);border:2px solid var(--iwb-plp-accent,#7c4dff);border-radius: 10px;box-shadow:0 12px 28px rgba(0,0,0,.22);font-size:12px;pointer-events:none;z-index: var(--iwb-z-anchor, 3200)}
.iwb-plp-ghostcov{width:38px;height:38px;border-radius:8px;object-fit:cover;flex:0 0 auto;background:var(--iwb-plugin-inset,#eef0f2)}
.iwb-plp-ghosttxt{min-width:0;display:flex;flex-direction:column;gap:2px}
.iwb-plp-ghostname{font-weight:600;color:var(--iwb-text,#1c2333);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.iwb-plp-ghosthint{font-size:10.5px;color:var(--iwb-plp-accent,#5a4bd0)}
.iwb-plp-ghosthint{font-size: 11px;color:var(--iwb-plp-accent,#5a4bd0)}
/* v1.6.10:悬停放大改为「内层背景层缩放」——卡片命中区域不变,渐变卡不再闪烁 */
.iwb-plp-bg{position:absolute;inset:0;overflow:hidden;border-radius:inherit;transition:transform .16s ease;will-change:transform;backface-visibility:hidden}
@@ -390,11 +398,11 @@ box-shadow: 0 24px 60px rgba(0,0,0,.32);
.iwb-plp-card{user-select:none}
body.iwb-plp-dragging, body.iwb-plp-dragging *{user-select:none!important;-webkit-user-select:none!important}
.iwb-plp-placeghost{border-style:dashed!important;pointer-events:none}
.iwb-plp-placehint{font-size:10.5px;color:var(--iwb-plp-accent,#5a4bd0);margin-top:2px}
.iwb-plp-placebox{position:fixed;left:-9999px;top:0;z-index:99999;pointer-events:none;border:2px dashed var(--iwb-plp-accent,#6b4dff);border-radius:12px;background:color-mix(in srgb,var(--iwb-plp-accent,#6b4dff) 9%,transparent);display:flex;align-items:center;justify-content:center;box-shadow:0 10px 26px rgba(30,20,80,.10)}
.iwb-plp-placebox-t{font-size:12px;color:var(--iwb-plp-accent,#5a3fd0);background:rgba(255,255,255,.82);border-radius:999px;padding:3px 10px}
.iwb-plp-placehint{font-size: 11px;color:var(--iwb-plp-accent,#5a4bd0);margin-top:2px}
.iwb-plp-placebox{position:fixed;left:-9999px;top:0;z-index: var(--iwb-z-anchor, 3200);pointer-events:none;border:2px dashed var(--iwb-plp-accent,#6b4dff);border-radius:12px;background:color-mix(in srgb,var(--iwb-plp-accent,#6b4dff) 9%,transparent);display:flex;align-items:center;justify-content:center;box-shadow:0 10px 26px rgba(30,20,80,.10)}
.iwb-plp-placebox-t{font-size:12px;color:var(--iwb-plp-accent,#5a3fd0);background:rgba(255,255,255,.82);border-radius:999px;padding: 4px 10px}
/* v1.6.23:放置指示改为灰色小方框 */
.iwb-plp-placebox{border: 2px dashed var(--plp-c2, #9aa3ad);border-radius:10px;background:rgba(122,130,142,.10);box-shadow:none}
.iwb-plp-placebox{border: 2px dashed var(--iwb-border2, #9aa3ad);border-radius:10px;background:rgba(122,130,142,.10);box-shadow:none}
.iwb-plp-placebox-t{font-size:11px;color: var(--plp-c3, #6b7280);background:rgba(255,255,255,.75);padding:2px 8px}
/* v1.7.0:编辑面板三栏 + 可拖宽;详情封面放大、变量高亮 */
.iwb-plp-eleft{flex:0 0 236px;width:236px}
@@ -408,51 +416,51 @@ body.iwb-plp-dragging, body.iwb-plp-dragging *{user-select:none!important;-webki
.iwb-plp-vitem{padding:4px 0;border-bottom:1px dashed var(--iwb-border,#eceef2)}
.iwb-plp-vrow2{display:flex;align-items:center;gap:6px}
.iwb-plp-vname{flex:1 1 auto;min-width:0;height:32px}
.iwb-plp-vi{flex:0 0 auto;width:24px;height:24px;padding:0;border-radius:50%;border:1px solid var(--iwb-border,#dfe3e9);background: var(--plp-c1, #fff);color: var(--plp-c4, #9aa1ac);font-size:11px;line-height:22px;text-align:center}
.iwb-plp-vi.is-open{background: var(--plp-c5, #f1ecff);border-color: var(--plp-c6, #d8cbff);color: var(--plp-c7, #5a3fd0)}
.iwb-plp-vdesc{width:100%;height:28px;margin-top:5px;border-style:dashed;background: var(--plp-c8, #fbfcfd);font-size:11.5px;color: var(--plp-c3, #6b7280)}
.iwb-plp-vi{flex:0 0 auto;width:24px;height:24px;padding:0;border-radius:50%;border:1px solid var(--iwb-border,#dfe3e9);background: var(--iwb-plugin-card, #fff);color: var(--iwb-text-dim, #9aa1ac);font-size:11px;line-height:22px;text-align:center}
.iwb-plp-vi.is-open{background: var(--iwb-plp-accent-soft, #f1ecff);border-color: var(--iwb-plp-accent-border, #d8cbff);color: var(--iwb-plp-accent, #5a3fd0)}
.iwb-plp-vdesc{width:100%;height:28px;margin-top: 6px;border-style:dashed;background: var(--iwb-field, #fbfcfd);font-size: 12px;color: var(--plp-c3, #6b7280)}
.iwb-plp-dcov{flex:0 0 auto;width:180px;height:180px;border-radius:12px;overflow:hidden}
.iwb-plp-dvar{background: var(--plp-c5, #f1ecff);color: var(--plp-c7, #5a3fd0);border-radius:4px;padding:0 4px;font-weight:500}
.iwb-plp-dvar{background: var(--iwb-plp-accent-soft, #f1ecff);color: var(--iwb-plp-accent, #5a3fd0);border-radius: 6px;padding:0 4px;font-weight:500}
/* v1.7.1:编辑面板视觉精修——输入框比底色更亮、去多余边框、细分隔线 */
.iwb-plp-dialog .iwb-plp-dbody{gap:10px;padding:12px;background: var(--plp-c9, #f4f5f7)}
.iwb-plp-dialog .iwb-plp-eleft{flex:0 0 236px;width:236px;background: var(--plp-c1, #fff);border: 1px solid var(--plp-c10, #e6e8ec);border-radius:12px;padding:12px}
.iwb-plp-dialog .iwb-plp-emid{background: var(--plp-c1, #fff);border: 1px solid var(--plp-c10, #e6e8ec);border-radius:12px;padding:10px 12px 12px}
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-etext{border: 1px solid var(--plp-c11, #eef0f3);background: var(--plp-c8, #fbfcfd);border-radius:9px;padding:10px 12px}
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-etext:focus{background: var(--plp-c1, #fff);border-color: var(--plp-c12, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)}
.iwb-plp-dialog .iwb-plp-esplit{flex:0 0 6px;background:transparent;border-radius:4px}
.iwb-plp-dialog .iwb-plp-esplit:hover{background: var(--plp-c13, #e7e9ee)}
.iwb-plp-dialog .iwb-plp-esplit::before{content:'';display:block;width:2px;height:30px;border-radius:2px;background: var(--plp-c14, #d7dbe2)}
.iwb-plp-dialog .iwb-plp-dbody{gap:10px;padding:12px;background: var(--iwb-plugin-inset, #f4f5f7)}
.iwb-plp-dialog .iwb-plp-eleft{flex:0 0 236px;width:236px;background: var(--iwb-plugin-card, #fff);border: 1px solid var(--iwb-plugin-border, #e6e8ec);border-radius:12px;padding:12px}
.iwb-plp-dialog .iwb-plp-emid{background: var(--iwb-plugin-card, #fff);border: 1px solid var(--iwb-plugin-border, #e6e8ec);border-radius:12px;padding:10px 12px 12px}
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-etext{border: 1px solid var(--iwb-plugin-border, #eef0f3);background: var(--iwb-field, #fbfcfd);border-radius: 8px;padding:10px 12px}
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-etext:focus{background: var(--iwb-plugin-card, #fff);border-color: var(--iwb-plp-accent-border, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)}
.iwb-plp-dialog .iwb-plp-esplit{flex:0 0 6px;background:transparent;border-radius: 6px}
.iwb-plp-dialog .iwb-plp-esplit:hover{background: var(--iwb-plugin-hover, #e7e9ee)}
.iwb-plp-dialog .iwb-plp-esplit::before{content:'';display:block;width:2px;height:30px;border-radius: 6px;background: var(--iwb-plugin-hover, #d7dbe2)}
.iwb-plp-dialog .iwb-plp-eright{background:transparent;border:0;padding:2px 0 0}
.iwb-plp-dialog .iwb-plp-vitem{border:0;padding:2px 0}
.iwb-plp-dialog .iwb-plp-vrow2{gap:6px}
.iwb-plp-dialog .iwb-plp-vname{background: var(--plp-c8, #fbfcfd);border: 1px solid var(--plp-c15, #eceef2);border-radius:8px;height:32px;padding:0 10px;font-size:12.5px;color: var(--plp-c16, #33383f)}
.iwb-plp-dialog .iwb-plp-vname:focus{background: var(--plp-c1, #fff);border-color: var(--plp-c12, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)}
.iwb-plp-dialog .iwb-plp-vi{background:transparent;border:0;color: var(--plp-c17, #aab0ba);width:22px;height:22px;line-height:20px}
.iwb-plp-dialog .iwb-plp-vi:hover{background: var(--plp-c18, #eef0f4);color: var(--plp-c3, #6b7280)}
.iwb-plp-dialog .iwb-plp-vi.is-open{background: var(--plp-c5, #f1ecff);color: var(--plp-c7, #5a3fd0)}
.iwb-plp-dialog .iwb-plp-vdesc{background: var(--plp-c8, #fbfcfd);border: 1px dashed var(--plp-c19, #e2e6ec);border-radius:7px;height:28px;margin-top:4px}
.iwb-plp-dialog .iwb-plp-lrow span{color: var(--plp-c20, #8a919c);font-size:11.5px}
.iwb-plp-dialog .iwb-plp-lrow .iwb-input{background: var(--plp-c8, #fbfcfd);border: 1px solid var(--plp-c15, #eceef2);border-radius:8px;height:32px}
.iwb-plp-dialog .iwb-plp-lrow .iwb-input:focus{background: var(--plp-c1, #fff);border-color: var(--plp-c12, #cfc3ff)}
.iwb-plp-dialog .iwb-plp-vname{background: var(--iwb-field, #fbfcfd);border: 1px solid var(--iwb-plugin-border, #eceef2);border-radius:8px;height:32px;padding:0 10px;font-size: 13px;color: var(--iwb-text, #33383f)}
.iwb-plp-dialog .iwb-plp-vname:focus{background: var(--iwb-plugin-card, #fff);border-color: var(--iwb-plp-accent-border, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)}
.iwb-plp-dialog .iwb-plp-vi{background:transparent;border:0;color: var(--iwb-text-dim, #aab0ba);width:22px;height:22px;line-height:20px}
.iwb-plp-dialog .iwb-plp-vi:hover{background: var(--iwb-plugin-inset, #eef0f4);color: var(--plp-c3, #6b7280)}
.iwb-plp-dialog .iwb-plp-vi.is-open{background: var(--iwb-plp-accent-soft, #f1ecff);color: var(--iwb-plp-accent, #5a3fd0)}
.iwb-plp-dialog .iwb-plp-vdesc{background: var(--iwb-field, #fbfcfd);border: 1px dashed var(--iwb-plugin-border, #e2e6ec);border-radius: 8px;height:28px;margin-top:4px}
.iwb-plp-dialog .iwb-plp-lrow span{color: var(--iwb-text2, #8a919c);font-size: 12px}
.iwb-plp-dialog .iwb-plp-lrow .iwb-input{background: var(--iwb-field, #fbfcfd);border: 1px solid var(--iwb-plugin-border, #eceef2);border-radius:8px;height:32px}
.iwb-plp-dialog .iwb-plp-lrow .iwb-input:focus{background: var(--iwb-plugin-card, #fff);border-color: var(--iwb-plp-accent-border, #cfc3ff)}
/* v1.7.2:正文变量高亮(黑粗)+ 说明灰按钮 + 说明背景回归面板底 */
.iwb-plp-ewrap{position:relative;flex:1 1 auto;min-height:0;display:flex;border-radius:9px;background: var(--plp-c8, #fbfcfd);border: 1px solid var(--plp-c11, #eef0f3)}
.iwb-plp-ewrap:focus-within{background: var(--plp-c1, #fff);border-color: var(--plp-c12, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)}
.iwb-plp-ewrap{position:relative;flex:1 1 auto;min-height:0;display:flex;border-radius: 8px;background: var(--iwb-field, #fbfcfd);border: 1px solid var(--iwb-plugin-border, #eef0f3)}
.iwb-plp-ewrap:focus-within{background: var(--iwb-plugin-card, #fff);border-color: var(--iwb-plp-accent-border, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)}
.iwb-plp-ewrap .iwb-plp-etext{flex:1 1 auto;min-height:0;border:0;background:transparent;box-shadow:none;color:transparent;caret-color:var(--plp-c22, #1d2129);position:relative;z-index:1;resize:none}
.iwb-plp-ewrap .iwb-plp-etext:focus{background:transparent;border:0;box-shadow:none}
.iwb-plp-hl{position:absolute;inset:0;padding:10px 12px;overflow:hidden;white-space:pre-wrap;word-wrap:break-word;font-size:13px;line-height:1.9;color: var(--plp-c21, #5b6472);pointer-events:none;z-index:0}
.iwb-plp-hlvar{color: var(--plp-c22, #1d2129);font-weight:600}
.iwb-plp-dialog .iwb-plp-vi.is-open{background: var(--plp-c11, #eef0f3);color: var(--plp-c21, #5b6472)}
.iwb-plp-dialog .iwb-plp-vdesc{background:transparent;border: 1px dashed var(--plp-c23, #dfe3e9)}
.iwb-plp-dvar{background:transparent;color: var(--plp-c22, #1d2129);font-weight:600;padding:0}
.iwb-plp-hres{height:6px;margin:-3px 0 0;cursor:ns-resize;flex:0 0 auto;border-radius:3px}
.iwb-plp-hres:hover{background: var(--plp-c13, #e7e9ee)}
.iwb-plp-hl{position:absolute;inset:0;padding:10px 12px;overflow:hidden;white-space:pre-wrap;word-wrap:break-word;font-size:13px;line-height:1.9;color: var(--iwb-text2, #5b6472);pointer-events:none;z-index:0}
.iwb-plp-hlvar{color: var(--iwb-text, #1d2129);font-weight:600}
.iwb-plp-dialog .iwb-plp-vi.is-open{background: var(--iwb-plugin-hover, #eef0f3);color: var(--iwb-text2, #5b6472)}
.iwb-plp-dialog .iwb-plp-vdesc{background:transparent;border: 1px dashed var(--iwb-plugin-border, #dfe3e9)}
.iwb-plp-dvar{background:transparent;color: var(--iwb-text, #1d2129);font-weight:600;padding:0}
.iwb-plp-hres{height:6px;margin: -4px 0 0;cursor:ns-resize;flex:0 0 auto;border-radius: 6px}
.iwb-plp-hres:hover{background: var(--iwb-plugin-hover, #e7e9ee)}
/* 正文可见性:textarea 透明,显示下方高亮层 */
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap{flex:1 1 auto;min-height:0;position:relative;display:flex;background: var(--plp-c8, #fbfcfd);border: 1px solid var(--plp-c11, #eef0f3);border-radius:9px}
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap{flex:1 1 auto;min-height:0;position:relative;display:flex;background: var(--iwb-field, #fbfcfd);border: 1px solid var(--iwb-plugin-border, #eef0f3);border-radius: 8px}
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap .iwb-plp-etext{background:transparent!important;color:transparent!important;border:0!important;box-shadow:none!important;padding:10px 12px}
.iwb-plp-dialog .iwb-plp-hl{padding:10px 12px;font-size:13px;line-height:1.9}
.iwb-plp-namebox{min-height:34px;height:34px;line-height:1.45;padding:7px 10px;resize:vertical;overflow:auto;font-size:12.5px}
.iwb-plp-insvar{color: var(--plp-c22, #1d2129)!important;background: var(--plp-c1, #fff)!important;border-color: var(--plp-c19, #e2e6ec)!important}
.iwb-plp-insvar:hover{background: var(--plp-c24, #f4f6f9)!important}
.iwb-plp-namebox{min-height:34px;height:34px;line-height:1.45;padding: 6px 10px;resize:vertical;overflow:auto;font-size: 13px}
.iwb-plp-insvar{color: var(--iwb-text, #1d2129)!important;background: var(--iwb-plugin-card, #fff)!important;border-color: var(--iwb-plugin-border, #e2e6ec)!important}
.iwb-plp-insvar:hover{background: var(--iwb-plugin-inset, #f4f6f9)!important}
/* v1.7.5:编辑封面卡在框内;详情封面放大 */
.iwb-plp-dialog .iwb-plp-ecov{width:100%;height:250px;overflow:hidden;border-radius:12px;background:var(--iwb-plugin-inset,#f3f4f7)}
.iwb-plp-dialog .iwb-plp-ecov .iwb-plp-cover{width:100%;height:100%;object-fit:cover;object-position:center;display:block;border-radius:12px}
@@ -481,7 +489,8 @@ body.iwb-plp-dragging, body.iwb-plp-dragging *{user-select:none!important;-webki
tab-size:4!important;
}
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap .iwb-plp-etext{overflow-y:auto!important;scrollbar-gutter:stable}
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-hl{overflow:hidden!important}
/* v1.9.3:高亮层与 textarea 用同样的滚动条占位,避免换行位置不一致导致色块漂移 */
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap .iwb-plp-hl{overflow:hidden!important;scrollbar-gutter:stable}
/* v1.7.9:详情正文独立滚动,长文不再压到底部按钮 */
.iwb-plp-dialog-detail .iwb-plp-dbody{overflow:hidden;align-items:stretch}
.iwb-plp-dialog-detail .iwb-plp-dright{flex:1 1 auto;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden}
@@ -489,48 +498,48 @@ body.iwb-plp-dragging, body.iwb-plp-dragging *{user-select:none!important;-webki
/* v1.8.0:详情标题/分组/标签移到封面下方;编辑标签改为输入+加号 */
.iwb-plp-dialog-detail .iwb-plp-dbody{align-items:flex-start}
.iwb-plp-dleftcol{flex:0 0 264px;width:264px;display:flex;flex-direction:column;min-width:0}
.iwb-plp-dtitle{font-size:18px;font-weight:650;line-height:1.35;margin-top:14px;color:var(--iwb-text,#1d2129)}
.iwb-plp-dtitle{font-size: 17px;font-weight:650;line-height:1.35;margin-top: 12px;color:var(--iwb-text,#1d2129)}
.iwb-plp-dmeta{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:8px}
.iwb-plp-dgroup{font-size:11.5px;background: var(--plp-c18, #eef0f4);color: var(--plp-c21, #5b6472);border-radius:999px;padding:2px 9px}
.iwb-plp-dtag{font-size:11.5px;background: var(--plp-c25, #f4f0ff);color: var(--plp-c7, #5a3fd0);border-radius:999px;padding:2px 9px}
.iwb-plp-dlen{font-size:11.5px;color: var(--plp-c4, #9aa1ac)}
.iwb-plp-dgroup{font-size: 12px;background: var(--iwb-plugin-inset, #eef0f4);color: var(--iwb-text2, #5b6472);border-radius:999px;padding: 2px 8px}
.iwb-plp-dtag{font-size: 12px;background: var(--iwb-plp-accent-soft, #f4f0ff);color: var(--iwb-plp-accent, #5a3fd0);border-radius:999px;padding: 2px 8px}
.iwb-plp-dlen{font-size: 12px;color: var(--iwb-text-dim, #9aa1ac)}
.iwb-plp-tagwrap{display:flex;flex-direction:column;gap:6px;flex:1;min-width:0}
.iwb-plp-tagchips{display:flex;flex-wrap:wrap;gap:5px}
.iwb-plp-tagchip{display:inline-flex;align-items:center;gap:4px;font-size:11.5px;background: var(--plp-c18, #eef0f4);border-radius:999px;padding:2px 8px;color: var(--plp-c26, #3f4450)}
.iwb-plp-tagx{cursor:pointer;color: var(--plp-c4, #9aa1ac);font-style:normal}
.iwb-plp-tagx:hover{color: var(--plp-c27, #c0392b)}
.iwb-plp-tagchips{display:flex;flex-wrap:wrap;gap: 6px}
.iwb-plp-tagchip{display:inline-flex;align-items:center;gap:4px;font-size: 12px;background: var(--iwb-plugin-inset, #eef0f4);border-radius:999px;padding:2px 8px;color: var(--iwb-text, #3f4450)}
.iwb-plp-tagx{cursor:pointer;color: var(--iwb-text-dim, #9aa1ac);font-style:normal}
.iwb-plp-tagx:hover{color: var(--iwb-err, #c0392b)}
.iwb-plp-tagrow{display:flex;gap:6px}
.iwb-plp-tagin{flex:1;min-width:0;height:30px}
.iwb-plp-lrow-tags{align-items:flex-start}
.iwb-plp-tagadd{flex:0 0 auto;width:30px;height:30px;padding:0;font-size:15px;line-height:28px}
/* v1.8.1:详情标题/分组/标签左对齐并带标题;标签加号对齐修复 */
.iwb-plp-dtitle{font-size:20px;font-weight:650;line-height:1.35;margin-top:16px;color:var(--iwb-text,#1d2129)}
.iwb-plp-dmeta{display:flex;flex-direction:column;gap:7px;margin-top:12px;align-items:flex-start}
.iwb-plp-dmeta{display:flex;flex-direction:column;gap: 6px;margin-top:12px;align-items:flex-start}
.iwb-plp-dmrow{display:flex;align-items:center;gap:10px;width:100%}
.iwb-plp-dmk{flex:0 0 30px;width:30px;font-size:11.5px;color: var(--plp-c4, #9aa1ac)}
.iwb-plp-dmv{display:flex;flex-wrap:wrap;align-items:center;gap:5px;min-width:0}
.iwb-plp-dgroup{font-size:12px;color: var(--plp-c26, #3f4450);background: var(--plp-c28, #f2f4f7);border-radius:6px;padding:2px 9px}
.iwb-plp-dtag{font-size:11.5px;color: var(--plp-c7, #5a3fd0);background: var(--plp-c25, #f4f0ff);border-radius:6px;padding:2px 9px}
.iwb-plp-dempty{font-size:12px;color: var(--plp-c29, #b3b9c2)}
.iwb-plp-dlen{font-size:12px;color: var(--plp-c20, #8a919c)}
.iwb-plp-dmk{flex:0 0 30px;width:30px;font-size: 12px;color: var(--iwb-text-dim, #9aa1ac)}
.iwb-plp-dmv{display:flex;flex-wrap:wrap;align-items:center;gap: 6px;min-width:0}
.iwb-plp-dgroup{font-size:12px;color: var(--iwb-text, #3f4450);background: var(--iwb-plugin-inset, #f2f4f7);border-radius:6px;padding: 2px 8px}
.iwb-plp-dtag{font-size: 12px;color: var(--iwb-plp-accent, #5a3fd0);background: var(--iwb-plp-accent-soft, #f4f0ff);border-radius:6px;padding: 2px 8px}
.iwb-plp-dempty{font-size:12px;color: var(--iwb-text-dim, #b3b9c2)}
.iwb-plp-dlen{font-size:12px;color: var(--iwb-text2, #8a919c)}
.iwb-plp-tagrow{display:flex;align-items:center;gap:6px}
.iwb-plp-tagin{height:30px;border-radius:8px}
.iwb-plp-tagadd{flex:0 0 auto;width:30px;height:30px;padding:0;border-radius:8px;background: var(--plp-c28, #f2f4f7);border: 1px solid var(--plp-c19, #e2e6ec);color: var(--plp-c21, #5b6472);font-size:16px;line-height:1;display:inline-flex;align-items:center;justify-content:center}
.iwb-plp-tagadd:hover{background: var(--plp-c30, #e9ecf1)}
.iwb-plp-tagadd{flex:0 0 auto;width:30px;height:30px;padding:0;border-radius:8px;background: var(--iwb-plugin-inset, #f2f4f7);border: 1px solid var(--iwb-plugin-border, #e2e6ec);color: var(--iwb-text2, #5b6472);font-size: 15px;line-height:1;display:inline-flex;align-items:center;justify-content:center}
.iwb-plp-tagadd:hover{background: var(--iwb-plugin-hover, #e9ecf1)}
/* v1.8.2:详情左右两栏卡片化 + 分割线 */
.iwb-plp-dialog-detail .iwb-plp-dbody{gap:14px;padding:16px;background: var(--plp-c9, #f4f5f7)}
.iwb-plp-dialog-detail .iwb-plp-dleftcol{flex:0 0 300px;width:300px;padding:12px;border: 1px solid var(--plp-c31, #e8eaee);border-radius:14px;background: var(--plp-c1, #fff);align-self:flex-start}
.iwb-plp-dialog-detail .iwb-plp-dbody{gap: 12px;padding:16px;background: var(--iwb-plugin-inset, #f4f5f7)}
.iwb-plp-dialog-detail .iwb-plp-dleftcol{flex:0 0 300px;width:300px;padding:12px;border: 1px solid var(--iwb-plugin-border, #e8eaee);border-radius:14px;background: var(--iwb-plugin-card, #fff);align-self:flex-start}
.iwb-plp-dialog-detail .iwb-plp-dcov{width:100%;height:270px;border-radius:10px}
.iwb-plp-dialog-detail .iwb-plp-dtitle{font-size:20px;font-weight:650;line-height:1.35;margin-top:14px;color:var(--iwb-text,#1d2129)}
.iwb-plp-dialog-detail .iwb-plp-dmeta{margin-top:12px;padding-top:12px;border-top: 1px solid var(--plp-c11, #eef0f3);gap:8px}
.iwb-plp-dialog-detail .iwb-plp-dright{flex:1 1 auto;min-width:0;min-height:0;display:flex;flex-direction:column;padding:14px 16px;border: 1px solid var(--plp-c31, #e8eaee);border-radius:14px;background: var(--plp-c1, #fff);overflow:hidden}
.iwb-plp-dsec{font-size:11.5px;font-weight:600;color: var(--plp-c20, #8a919c);letter-spacing:.04em;padding-bottom:8px;margin-bottom:8px;border-bottom: 1px solid var(--plp-c11, #eef0f3);flex:0 0 auto}
.iwb-plp-dialog-detail .iwb-plp-dtext{flex:1 1 auto;min-height:0;overflow:auto;padding-right:10px;font-size:13.5px;line-height:2;color: var(--plp-c32, #3a4048)}
.iwb-plp-dialog-detail .iwb-plp-dtitle{font-size:20px;font-weight:650;line-height:1.35;margin-top: 12px;color:var(--iwb-text,#1d2129)}
.iwb-plp-dialog-detail .iwb-plp-dmeta{margin-top:12px;padding-top:12px;border-top: 1px solid var(--iwb-plugin-border, #eef0f3);gap:8px}
.iwb-plp-dialog-detail .iwb-plp-dright{flex:1 1 auto;min-width:0;min-height:0;display:flex;flex-direction:column;padding: 12px 16px;border: 1px solid var(--iwb-plugin-border, #e8eaee);border-radius:14px;background: var(--iwb-plugin-card, #fff);overflow:hidden}
.iwb-plp-dsec{font-size: 12px;font-weight:600;color: var(--iwb-text2, #8a919c);letter-spacing:.04em;padding-bottom:8px;margin-bottom:8px;border-bottom: 1px solid var(--iwb-plugin-border, #eef0f3);flex:0 0 auto}
.iwb-plp-dialog-detail .iwb-plp-dtext{flex:1 1 auto;min-height:0;overflow:auto;padding-right:10px;font-size: 14px;line-height:2;color: var(--iwb-text, #3a4048)}
/* v1.8.3:详情左卡片撑到底、四边等距;正文恢复滚动不被底部遮挡 */
.iwb-plp-dialog-detail{display:flex;flex-direction:column;overflow:hidden}
.iwb-plp-dialog-detail .iwb-plp-dbody{display:flex;flex:1 1 auto;min-height:0;overflow:hidden;gap:14px;padding:16px;background: var(--plp-c9, #f4f5f7)}
.iwb-plp-dialog-detail .iwb-plp-dleftcol{align-self:stretch;display:flex;flex-direction:column;overflow:auto;padding:12px;border: 1px solid var(--plp-c31, #e8eaee);border-radius:14px;background: var(--plp-c1, #fff)}
.iwb-plp-dialog-detail .iwb-plp-dright{flex:1 1 auto;min-width:0;min-height:0;overflow:hidden;display:flex;flex-direction:column;padding:14px 16px;border: 1px solid var(--plp-c31, #e8eaee);border-radius:14px;background: var(--plp-c1, #fff)}
.iwb-plp-dialog-detail .iwb-plp-dbody{display:flex;flex:1 1 auto;min-height:0;overflow:hidden;gap: 12px;padding:16px;background: var(--iwb-plugin-inset, #f4f5f7)}
.iwb-plp-dialog-detail .iwb-plp-dleftcol{align-self:stretch;display:flex;flex-direction:column;overflow:auto;padding:12px;border: 1px solid var(--iwb-plugin-border, #e8eaee);border-radius:14px;background: var(--iwb-plugin-card, #fff)}
.iwb-plp-dialog-detail .iwb-plp-dright{flex:1 1 auto;min-width:0;min-height:0;overflow:hidden;display:flex;flex-direction:column;padding: 12px 16px;border: 1px solid var(--iwb-plugin-border, #e8eaee);border-radius:14px;background: var(--iwb-plugin-card, #fff)}
.iwb-plp-dialog-detail .iwb-plp-dtext{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;padding-right:8px}
.iwb-plp-dialog-detail .iwb-plp-dfooter{flex:0 0 auto}
/* v1.8.4:右卡片纵向拉伸填满,正文出现滚动条 */
@@ -539,23 +548,32 @@ body.iwb-plp-dragging, body.iwb-plp-dragging *{user-select:none!important;-webki
.iwb-plp-dialog-detail .iwb-plp-dtext{flex:1 1 0;min-height:0;overflow-y:auto!important;overflow-x:hidden}
/* v1.8.7:详情标题缩小;分组/标签去底色;元信息加分割线与行高 */
.iwb-plp-dialog-detail .iwb-plp-dtitle{font-size:17px!important;font-weight:650;margin-top:12px}
.iwb-plp-dialog-detail .iwb-plp-dmeta{margin-top:12px;padding-top:14px;border-top: 1px solid var(--plp-c11, #eef0f3);gap:10px}
.iwb-plp-dialog-detail .iwb-plp-dmeta{margin-top:12px;padding-top: 12px;border-top: 1px solid var(--iwb-plugin-border, #eef0f3);gap:10px}
.iwb-plp-dialog-detail .iwb-plp-dmrow{gap:6px}
.iwb-plp-dialog-detail .iwb-plp-dmk{flex:0 0 auto;width:auto;font-size:12px;line-height:1.6;color: var(--plp-c4, #9aa1ac)}
.iwb-plp-dialog-detail .iwb-plp-dgroup,.iwb-plp-dialog-detail .iwb-plp-dtag{background:transparent!important;padding:0!important;border-radius:0!important;font-size:12.5px;line-height:1.6;color: var(--plp-c33, #2f3540)}
.iwb-plp-dialog-detail .iwb-plp-dtag{color: var(--plp-c7, #5a3fd0);}
.iwb-plp-dialog-detail .iwb-plp-dlen{font-size:12.5px;line-height:1.6;color: var(--plp-c33, #2f3540)}
.iwb-plp-dialog-detail .iwb-plp-dmk{flex:0 0 auto;width:auto;font-size:12px;line-height:1.6;color: var(--iwb-text-dim, #9aa1ac)}
.iwb-plp-dialog-detail .iwb-plp-dgroup,.iwb-plp-dialog-detail .iwb-plp-dtag{background:transparent!important;padding:0!important;border-radius:0!important;font-size: 13px;line-height:1.6;color: var(--iwb-text, #2f3540)}
.iwb-plp-dialog-detail .iwb-plp-dtag{color: var(--iwb-plp-accent, #5a3fd0);}
.iwb-plp-dialog-detail .iwb-plp-dlen{font-size: 13px;line-height:1.6;color: var(--iwb-text, #2f3540)}
/* v1.8.8:详情标题 14px;元信息行间浅分割线;封面底色更接近白色(编辑/详情统一) */
.iwb-plp-dialog-detail .iwb-plp-dtitle{font-size:14px!important;font-weight:650;line-height:1.5;margin-top:12px}
.iwb-plp-dialog-detail .iwb-plp-dmeta{gap:0}
.iwb-plp-dialog-detail .iwb-plp-dmrow{padding:7px 0;border-bottom: 1px solid var(--plp-c34, #f3f5f8)}
.iwb-plp-dialog-detail .iwb-plp-dmrow{padding: 6px 0;border-bottom: 1px solid var(--iwb-plugin-border, #f3f5f8)}
.iwb-plp-dialog-detail .iwb-plp-dmrow:last-child{border-bottom:0}
.iwb-plp-dialog .iwb-plp-dcov,.iwb-plp-dialog .iwb-plp-ecov{background: var(--plp-c35, #fcfcfd)!important}
.iwb-plp-dialog .iwb-plp-dcov,.iwb-plp-dialog .iwb-plp-ecov{background: var(--iwb-field, #fcfcfd)!important}
.iwb-plp-dialog .iwb-plp-dcov .iwb-plp-cover,.iwb-plp-dialog .iwb-plp-ecov .iwb-plp-cover{background:transparent!important}
/* v1.8.19:编辑区高亮变量不得加粗——加粗会改变字形宽度,导致点击位置逐次向左偏移 */
.iwb-plp-hlvar{font-weight:400!important;letter-spacing:normal!important}
/* v1.8.20:编辑区不再用透明 textarea+高亮层(两层字体/换行差异会让点击坐标逐次偏移);正文直接由 textarea 渲染,插入点 100% 对应光标 */
.iwb-plp-ewrap .iwb-plp-hl{display:none!important}
/* v1.9.3:变量着色改为「textarea 只负责文字 + 背层只画浅主色色块」——
两层字体/换行/滚动条占位由 v1.7.7 规则保持一致,变量 span 沿用 400 字重(不加粗,宽度不漂移),
文字仍由 textarea 自己画(可见),所以插入点/点击/选区完全不受影响。
注:v1.8.20 停用高亮层是因为当时「透明 textarea + 背层画文字」两层文字错位;本版不画文字,只画色块,不会复发。 */
.iwb-plp-ewrap .iwb-plp-hl{display:block!important;color:transparent!important;-webkit-text-fill-color:transparent!important}
.iwb-plp-hlvar{color:transparent!important;-webkit-text-fill-color:transparent!important;background:color-mix(in srgb, var(--iwb-plp-accent, #7c4dff) 16%, transparent);border-radius:6px;box-shadow:0 0 0 1px color-mix(in srgb, var(--iwb-plp-accent, #7c4dff) 22%, transparent)}
.iwb-plp-ewrap .iwb-plp-etext{color:var(--iwb-text,#2a2f36)!important;background:transparent!important}
/* v1.8.21:高亮层隐藏后,正文文字必须可见(覆盖旧的 transparent !important) */
/* v1.8.21:正文文字必须可见(覆盖旧的 transparent !important) */
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap .iwb-plp-etext{color:var(--iwb-text,#2a2f36)!important;caret-color:var(--iwb-text,#2a2f36)!important;-webkit-text-fill-color:var(--iwb-text,#2a2f36)!important}
/* v1.9.3:右侧变量名与详情正文里的变量也用主色呼应(只读区,零功能风险) */
.iwb-plp-dialog .iwb-plp-vname{color:var(--iwb-plp-accent,#5a3fd0)}
.iwb-plp-dialog .iwb-plp-dvar{color:var(--iwb-plp-accent,#5a3fd0);background:var(--iwb-plp-accent-soft,#f1ecff);border-radius:6px;padding:0 2px}
/* 回滚开关:若真机发现任何点击/光标异常,把下行打开即回到 v1.8.20 纯 textarea 状态。
.iwb-plp-ewrap .iwb-plp-hl{display:none!important} */
@@ -454,37 +454,47 @@
'.iwb-bx-name{flex:1;min-width:70px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
'.iwb-bx-tag{font-size:11px;white-space:nowrap;color:var(--iwb-text2,#4d5668);',
'max-width:46%;min-width:0;overflow:hidden;text-overflow:ellipsis}',
'.iwb-bx-tag-ok{color:#1d9e75}',
'.iwb-bx-tag-err{color:#d85a30}',
// 状态色不能直接当文字色:宿主 --iwb-ok 亮色是 #22c55e,压在浅页面上对比只有 2.13。
// 照 design-tokens.md §3 的 iwb-mk-badge 范例,用 color-mix 往 --iwb-text 压 18%,亮暗两端都读得清。
'.iwb-bx-tag-ok{color:color-mix(in srgb,var(--iwb-ok,#1d9e75) 82%,var(--iwb-text,#1c2333))}',
'.iwb-bx-tag-err{color:color-mix(in srgb,var(--iwb-err,#d85a30) 82%,var(--iwb-text,#1c2333))}',
// 行内单张下载:常驻不悬浮(要一眼看出「这行能下什么」),无产物时灰掉但保留占位,
// 避免产物出现时行宽突然变化导致列表跳动。
'.iwb-bx-dl{flex:0 0 auto;padding:2px 6px;border-radius:5px;font-size:11px;line-height:1.5;',
'font-family:ui-monospace,SFMono-Regular,Menlo,monospace;border:1px solid var(--iwb-border,#d5d9e0);',
'background:transparent;color:var(--iwb-text2,#4d5668);cursor:pointer}',
'.iwb-bx-dl-on{background:var(--iwb-layer,#f0f1f4);color:var(--iwb-text,#1c2333);border-color:var(--iwb-text2,#4d5668)}',
'.iwb-bx-dl-on:hover{border-color:#2f6fed;color:#2f6fed}',
'.iwb-bx-dl-on:hover{border-color:var(--iwb-brand,#2f6fed);color:var(--iwb-brand-text,#2f6fed)}',
'.iwb-bx-dl[disabled]{opacity:.45;cursor:not-allowed;border-color:var(--iwb-border,#d5d9e0)}',
'.iwb-bx-empty{padding:24px 12px;text-align:center;color:var(--iwb-text2,#4d5668)}',
// 缩略图:小方图(30px)常驻在行首,跑完换成产物本身,一眼能对上「哪张图、出了什么」
'.iwb-bx-thumb{width:30px;height:30px;flex:0 0 auto;object-fit:contain;border-radius:5px;',
'border:1px solid var(--iwb-border,#d5d9e0);background:#fff/*iwb:content*/;cursor:zoom-in;padding:1px}',
'.iwb-bx-thumb-out{border-color:#1d9e75;cursor:zoom-in}',
'.iwb-bx-thumb-out{border-color:var(--iwb-ok,#1d9e75);cursor:zoom-in}',
'.iwb-bx-thumb-ph{background:var(--iwb-layer,#f0f1f4);cursor:default}',
'.iwb-bx-done{display:none;align-items:center;gap:6px;padding:9px 12px;font-size:11px;',
'color:#1d9e75;background:rgba(29,158,117,.08);border-top:1px solid var(--iwb-border,#d5d9e0)}',
'color:color-mix(in srgb,var(--iwb-ok,#1d9e75) 82%,var(--iwb-text,#1c2333));',
'background:color-mix(in srgb,var(--iwb-ok,#1d9e75) 8%,transparent);',
'border-top:1px solid var(--iwb-border,#d5d9e0)}',
'.iwb-bx-zoom{position:fixed;inset:0;z-index:99999;display:flex;align-items:center;justify-content:center;',
'background:rgba(0,0,0,.72);cursor:zoom-out}',
'.iwb-bx-zoom img{max-width:86vw;max-height:86vh;border-radius:8px;background:#fff/*iwb:content*/}',
// 双类选择器:单靠 .iwb-bx-btn-hot 会被后定义的 .iwb-bx-btn 背景覆盖(同特异性,后者胜)
'.iwb-bx-btn.iwb-bx-btn-hot{background:#1d9e75;border-color:#1d9e75;color:#fff}',
// 主/热按钮此前是纯蓝 #2f6fed 实心 + 白字:与项目「全灰阶、无蓝」的配色约束冲突,
// 且暗色下亮绿底压白字对比度不足。改成宿主语义色成对反相 + 状态色描边,
// var() 兜底保留私有值,脱离宿主独立运行时不退化。
'.iwb-bx-btn.iwb-bx-btn-hot{',
'background:color-mix(in srgb,var(--iwb-ok,#1d9e75) 14%,transparent);',
'border-color:color-mix(in srgb,var(--iwb-ok,#1d9e75) 82%,var(--iwb-text,#1c2333));',
'color:color-mix(in srgb,var(--iwb-ok,#1d9e75) 82%,var(--iwb-text,#1c2333))}',
'.iwb-bx-foot{display:flex;align-items:center;gap:8px;padding:10px 12px;',
'border-top:1px solid var(--iwb-border,#d5d9e0)}',
'.iwb-bx-prog{flex:1;height:4px;border-radius:2px;background:var(--iwb-border,#d5d9e0);overflow:hidden}',
'.iwb-bx-prog i{display:block;height:100%;width:0;background:#2f6fed;transition:width .15s}',
'.iwb-bx-prog i{display:block;height:100%;width:0;background:var(--iwb-brand-text,#2f6fed);transition:width .15s}',
'.iwb-bx-btn{padding:5px 10px;border-radius:6px;border:1px solid var(--iwb-border,#d5d9e0);',
'background:var(--iwb-layer,#f0f1f4);color:inherit;font:inherit;cursor:pointer;white-space:nowrap}',
'.iwb-bx-btn[disabled]{opacity:.45;cursor:not-allowed}',
'.iwb-bx-btn-primary{background:#2f6fed;border-color:#2f6fed;color:#fff}',
'.iwb-bx-btn-primary{background:var(--iwb-text,#2f6fed);border-color:var(--iwb-text,#2f6fed);',
'color:var(--iwb-layer,#fff)}',
].join('')
function ensureStyle() {
@@ -500,7 +510,7 @@
global.IWBPluginHost.register({
id: 'batch-export',
name: '批量出图',
version: '1.2.1',
version: '1.2.2',
apiVersion: 1,
capabilities: ['panels', 'canvas'],
settings: {
@@ -0,0 +1,469 @@
// iwb-plugin: 画布便利贴 —— 多行文本 + 字号/粗细调节 + 8 色背景,纯标注节点不连线。
//
// 设计口径(用户 2026-11-24 确认):
// - 不要"标题"概念:便签上方那条"便利贴"标签是宿主强制的标题带(hasTitle 写死),
// 节点名注册成"便利贴"即可,用户不用再填标题字段。
// - 想当说明标题就把字号调大(无上限,A+ 每点一次 +2),想放多行正文就用小字(默认 14)。
// - 不连线:ports:{in:false,out:false}。
// - 节点缩放用宿主自带手柄(右下角),插件不设宽高。
//
// 状态全部存 node.data(props.onUpdate 写回,随画布落盘):
// text / fontSize / fontWeight / bgColor
// 字号:A−/A+ 每步 ±2,下限 6、无上限(用户明确要求去掉最大字号限制);
// 8 个预设色是运行时数据、色轮走系统颜色选择器,源码里不写死中性色(守门只卡字面量)。
;(function (global) {
'use strict'
if (!global.IWBPluginHost) return
// 必须在脚本执行时就注入:面板可能瞬间挂载、节点可能从存档直接出现(面板从不 mount)。
function ensureStyle() {
if (typeof document === 'undefined' || !document.createElement) return
if (document.getElementById('iwb-sticky-style')) return
var css = '' +
'#iwb-sticky-style{}' +
'[hidden]{display:none!important}' +
'.iwb-sticky-panel{display:flex;flex-direction:column;gap:12px;font-size:13px;color:var(--iwb-text,#1c2333)}' +
'.iwb-sticky-panel-tip{font-size:12px;line-height:1.6;color:var(--iwb-text2,#4d5668);opacity:.9}' +
'.iwb-sticky-add{cursor:pointer;border:1px solid var(--iwb-brand,#6b7280);border-radius:8px;background:var(--iwb-layer2,#fff);color:var(--iwb-text,#1c2333);font-size:13px;padding:10px 14px;font-family:inherit}' +
'.iwb-sticky-add:hover{background:var(--iwb-hover,#f0f1f4)}' +
'.iwb-sticky-list{display:flex;flex-direction:column;gap:8px;margin-top:4px}' +
'.iwb-sticky-row{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 10px;border:1px solid var(--iwb-border,#d5d9e0);border-radius:8px;background:var(--iwb-layer,#f5f6f8)}' +
'.iwb-sticky-row-txt{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}' +
'.iwb-sticky-go{cursor:pointer;border:1px solid var(--iwb-border,#d5d9e0);border-radius:6px;background:var(--iwb-layer2,#fff);color:var(--iwb-text,#1c2333);font-size:12px;padding:4px 10px;white-space:nowrap;font-family:inherit}' +
'.iwb-sticky-go:hover{border-color:var(--iwb-brand,#6b7280)}' +
// ---- 节点体 ----
// 宿主容器 .iwb-plugin-node-body 是 flex 列且 padding:0;这里必须 flex:1 撑满,
// 不能只写 height:100%(WKWebView 下百分比对 flex 项算不准,拖大后下半露出宿主底色)。
// 圆角对齐宿主节点:外框 .iwb-node 用 var(--iwb-node-radius)=14px 且有 1px 边框,
// 纸片在框内 ⇒ 内圈半径 = 外圈 - 1px,选中时两层边缘才不会错开。
'.iwb-sticky-node{position:relative;display:flex;flex-direction:column;flex:1 1 auto;min-height:0;width:100%;box-sizing:border-box;border-radius:calc(var(--iwb-node-radius, 14px) - 1px);overflow:visible}' +
'.iwb-sticky-tools{display:flex;align-items:center;gap:6px;padding:6px 8px;border-bottom:1px solid rgba(0,0,0,.08);flex:0 0 auto;position:relative;z-index:2}' +
'.iwb-sticky-btn{cursor:pointer;border:1px solid rgba(0,0,0,.2);border-radius:6px;background:transparent;color:inherit;font-size:11px;padding:2px 6px;font-family:inherit;line-height:1.4;user-select:none}' +
'.iwb-sticky-btn:hover{background:rgba(0,0,0,.07)}' +
'.iwb-sticky-btn-on{font-weight:600;background:rgba(0,0,0,.1)}' +
// 调色圆点推到工具条最右端(右上),色板 right:8px 与圆点右缘对齐,落在其正下方。
'.iwb-sticky-dot{display:inline-block;width:14px;height:14px;border-radius:50%;border:1px solid rgba(0,0,0,.25);cursor:pointer;vertical-align:middle;padding:0;margin-left:auto}' +
'.iwb-sticky-dot-on{box-shadow:0 0 0 2px rgba(0,0,0,.55)}' +
'.iwb-sticky-pal{position:absolute;top:100%;right:8px;z-index:20;display:grid;grid-template-columns:repeat(4,18px);gap:8px 6px;padding:10px;border-radius:10px;border:1px solid var(--iwb-border,#d5d9e0);background:var(--iwb-layer2,#fff);box-shadow:0 4px 16px rgba(0,0,0,.18)}' +
'.iwb-sticky-pal-sw{width:18px;height:18px;border-radius:50%;border:1px solid rgba(0,0,0,.2);cursor:pointer;padding:0}' +
'.iwb-sticky-wheel{grid-column:1/-1;display:flex;justify-content:center;padding-top:8px;border-top:1px solid var(--iwb-border,#d5d9e0)}' +
'.iwb-sticky-wheel-btn{cursor:pointer;width:22px;height:22px;border-radius:50%;border:0;padding:0;background:conic-gradient(#e24b4a,#ef9f27,#fac775,#639922,#1d9e75,#378add,#7f77dd,#d4537e,#e24b4a)}' +
// 高度随内容自适应(贴字):不再 flex:1 撑满剩余空间,否则字号大/文字少时
// 下方留出大片空白;高度由 syncSkeleton 按行数×字号算,宿主外框 height:auto
// 会跟着内容收缩,resize 手柄就能拖到贴字。overflow:hidden 避免自适应高度出滚动条。
'.iwb-sticky-body{flex:0 0 auto;min-height:1.7em;width:100%;box-sizing:border-box;resize:none;border:0;outline:0;background:transparent;color:inherit;font-family:inherit;line-height:1.7;padding:12px;overflow:hidden;overflow-wrap:anywhere;cursor:move}' +
// 与宿主文本节点一致:只读态单击穿透给节点拖动/选中;双击进入编辑才变 text 光标。
// 宿主 style.css 有 `.iwb-node textarea[readonly]{pointer-events:none}`,这里用自身 class 兜底。
'.iwb-sticky-body.iwb-sticky-editing{cursor:text}' +
'.iwb-sticky-body::placeholder{opacity:.45}' +
'.iwb-sticky-color-input{position:absolute;width:0;height:0;opacity:0;pointer-events:none}'
try {
var styleEl = el('style', { text: css })
styleEl.setAttribute('id', 'iwb-sticky-style')
;(document.head || document.documentElement).appendChild(styleEl)
} catch (e) { /* 样式注入失败不影响功能 */ }
}
// 插件面板/节点体是真实 DOM(不是 React vDOM):createElement + addEventListener。
function el(tag, attrs, kids) {
var node = document.createElement(tag)
if (attrs) {
for (var key in attrs) {
var value = attrs[key]
if (value === null || value === undefined) continue
if (key === 'class' || key === 'className') node.className = value
else if (key === 'text') node.textContent = String(value)
else if (key === 'hidden') node.hidden = Boolean(value)
else if (key.slice(0, 2) === 'on') node.addEventListener(key.slice(2).toLowerCase(), value)
else node.setAttribute(key, String(value))
}
}
if (kids !== null && kids !== undefined) {
var list = Array.isArray(kids) ? kids : [kids]
for (var i = 0; i < list.length; i++) {
if (list[i] === null || list[i] === undefined || list[i] === false) continue
node.appendChild(typeof list[i] === 'string' ? document.createTextNode(list[i]) : list[i])
}
}
return node
}
var MIN_SIZE = 6 // 下限(用户只要求取消上限,下限保留防误操作缩到看不见)
var SIZE_STEP = 2 // A−/A+ 每步 ±2
var DEFAULT_SIZE = 14
var PALETTE = [
{ name: '黄', value: '#FCE8B0' },
{ name: '粉', value: '#F4C0D1' },
{ name: '橙', value: '#EF9F27' },
{ name: '绿', value: '#9FE1CB' },
{ name: '蓝', value: '#B5D4F4' },
{ name: '浅紫', value: '#CECBF6' },
{ name: '玫红', value: '#ED93B1' },
{ name: '灰', value: '#D3D1C7' },
]
var DEFAULT_BG = '#FCE8B0'
// 只保证是 >= 下限的有限数,不再钳到闭集/上限;A+ 可无限放大。
function normSize(v) {
var n = Number(v)
if (!isFinite(n) || n < MIN_SIZE) return DEFAULT_SIZE
return Math.round(n)
}
// 依据背景亮度取黑/白文字(运行时计算,源码里不写死中性色)。
function textColorOf(hex) {
var m = /^#?([0-9a-f]{6})$/i.exec(String(hex || ''))
if (!m) return '#1c2333'
var n = parseInt(m[1], 16)
var r = (n >> 16) & 255, g = (n >> 8) & 255, b = n & 255
// 相对亮度(sRGB 简化)
var lum = (0.299 * r + 0.587 * g + 0.114 * b) / 255
return lum < 0.55 ? '#ffffff' : '#1c2333'
}
// 脚本执行时就注入(不等 setup / mount,存档直入画布也有样式)。
ensureStyle()
var ctxRef = null
// ---------------- 节点体 ----------------
// 宿主契约:render(node, props, host) 往 host 这个真实 DOM 里画,不是返回 vDOM。
// host 由宿主固定、不重建;插件自己缓存骨架 + 幂等同步,编辑中的 textarea 不覆盖值。
function renderSticky(node, props, host) {
ensureStyle()
var data = (node && node.data) || {}
var st = host.__sticky
if (!st) {
host.textContent = ''
st = host.__sticky = buildSkeleton(host, props)
}
st.node = node
st.props = props
syncSkeleton(st, data, node)
}
function buildSkeleton(host, props) {
var root = el('div', { className: 'iwb-sticky-node' })
var tools = el('div', { className: 'iwb-sticky-tools' })
var minus = el('button', { className: 'iwb-sticky-btn', type: 'button', title: '缩小字号', 'data-act': 'minus' }, '−')
var plus = el('button', { className: 'iwb-sticky-btn', type: 'button', title: '放大字号', 'data-act': 'plus' }, '+')
var bold = el('button', { className: 'iwb-sticky-btn', type: 'button', title: '切换粗细', 'data-act': 'bold' }, 'B')
var dot = el('button', { className: 'iwb-sticky-dot', type: 'button', title: '背景色', 'data-act': 'palette' })
var pal = el('div', { className: 'iwb-sticky-pal', hidden: true })
var colorInput = el('input', { type: 'color', className: 'iwb-sticky-color-input', 'data-act': 'color' })
// rows=1 是关键:textarea 默认 rows=2,fitBody() 把高度设 auto 读 scrollHeight 时,
// 单行文字也会被算成两行高(用户报的“预留了一行文本高度”)。显式 1 行后,
// scrollHeight 才等于真实内容行数——多行文本仍会自动换行、高度跟着涨。
var body = el('textarea', { className: 'iwb-sticky-body', rows: '1', spellcheck: 'false', placeholder: '双击编辑…' })
// 对齐宿主文本节点:默认只读。宿主 CSS `.iwb-node textarea[readonly]{pointer-events:none}`
// ⇒ 单击穿透给节点卡片(选中/拖动);双击由本插件在 root 上接管进入编辑。
body.readOnly = true
body.setAttribute('readonly', '')
tools.appendChild(minus); tools.appendChild(plus); tools.appendChild(bold); tools.appendChild(dot)
// 色板挂在工具条内(tools 已 position:relative):CSS top:100% 落在调色按钮正下方,
// 而不是贴整个便签底部右下角(那样会盖住宿主 resize 手柄、且离按钮很远)。
tools.appendChild(pal)
root.appendChild(tools); root.appendChild(colorInput); root.appendChild(body)
host.appendChild(root)
var st = { root: root, tools: tools, minus: minus, plus: plus, bold: bold, dot: dot,
pal: pal, colorInput: colorInput, body: body, data: null, palOpen: false, editing: false }
function onTool(e) {
var t = e.target || {}
var act = t.getAttribute && t.getAttribute('data-act')
if (!act) return
e.stopPropagation && e.stopPropagation()
var d = (st.node && st.node.data) || {}
var up = st.props && st.props.onUpdate
var id = st.node && st.node.id
if (!up || !id) return
if (act === 'minus' || act === 'plus') {
var cur = normSize(d.fontSize == null ? DEFAULT_SIZE : d.fontSize)
var next = act === 'minus' ? Math.max(MIN_SIZE, cur - SIZE_STEP) : cur + SIZE_STEP
if (next !== cur) up(id, { fontSize: next })
} else if (act === 'bold') {
up(id, { fontWeight: d.fontWeight === 600 ? 400 : 600 })
} else if (act === 'palette') {
st.palOpen = !st.palOpen
pal.hidden = !st.palOpen
}
}
tools.addEventListener('click', onTool)
// 色板里的色块 + 色轮(事件委托到 pal)
for (var i = 0; i < PALETTE.length; i++) {
var sw = el('button', { type: 'button', className: 'iwb-sticky-pal-sw', 'data-bg': PALETTE[i].value,
title: PALETTE[i].name, style: 'background:' + PALETTE[i].value })
pal.appendChild(sw)
}
var wheelWrap = el('div', { className: 'iwb-sticky-wheel' })
var wheel = el('button', { type: 'button', className: 'iwb-sticky-wheel-btn', title: '自定义颜色', 'data-act': 'wheel' })
wheelWrap.appendChild(wheel); pal.appendChild(wheelWrap)
function onPal(e) {
var t = e.target || {}
e.stopPropagation && e.stopPropagation()
var up = st.props && st.props.onUpdate
var id = st.node && st.node.id
if (!up || !id) return
var bg = t.getAttribute && t.getAttribute('data-bg')
if (bg) {
up(id, { bgColor: bg })
st.palOpen = false; pal.hidden = true
return
}
var act = t.getAttribute && t.getAttribute('data-act')
if (act === 'wheel') {
// 点开系统取色器后这个浮层就完成使命:无论最终确认还是取消都先收起,
// 避免取色器关闭后色板还压在便签上(用户报的“自定义调色后面板不退出”)。
st.palOpen = false; pal.hidden = true
try { colorInput.click() } catch (e2) { /* noop */ }
}
}
pal.addEventListener('click', onPal)
function onColor(e) {
var up = st.props && st.props.onUpdate
var id = st.node && st.node.id
if (up && id && e.target && e.target.value) up(id, { bgColor: e.target.value })
// 自定义色确认后兜底再收一次(个别平台 change 先于上面的收起逻辑到达)。
st.palOpen = false; pal.hidden = true
}
colorInput.addEventListener('change', onColor)
// ---- 正文编辑状态机(照宿主文本节点:双击进编辑、失焦退出、只读态单击穿透)----
function setEditing(on) {
st.editing = on
body.readOnly = !on
if (on) { try { body.removeAttribute('readonly') } catch (e2) { /* noop */ } }
else body.setAttribute('readonly', '')
body.className = 'iwb-sticky-body' + (on ? ' iwb-sticky-editing' : '')
}
// 双击进入编辑:绑在 root 上(不是 readonly textarea —— 它 pointer-events:none 收不到双击)。
// 宿主卡片 onDoubleClick 只处理内置文本类型,plugin: 节点它不接管,所以这里自己 stopPropagation。
function onDblClick(e) {
// 工具条/色板/按钮上的双击不进编辑
var t = e.target || {}
if (t.getAttribute && t.getAttribute('data-act')) return
if (t.getAttribute && t.getAttribute('data-bg')) return
e.stopPropagation && e.stopPropagation()
setEditing(true)
try { body.focus() } catch (e2) { /* noop */ }
}
root.addEventListener('dblclick', onDblClick)
// 编辑态:按下/按键不冒泡给宿主(否则会拖节点 / 触发画布快捷键);失焦退出编辑。
;['pointerdown', 'mousedown'].forEach(function (ev) {
body.addEventListener(ev, function (e) {
if (st.editing) e.stopPropagation && e.stopPropagation()
// 只读态不拦:让宿主选中节点 + 拖动
})
})
body.addEventListener('keydown', function (e) {
e.stopPropagation && e.stopPropagation()
if (e.key === 'Escape') { try { body.blur() } catch (e2) { /* noop */ } }
})
body.addEventListener('blur', function () { setEditing(false) })
// 输入即写回(防抖交给宿主的 commitCanvas),编辑中不重建 DOM 故不失焦。
function onInput(e) {
var up = st.props && st.props.onUpdate
var id = st.node && st.node.id
if (up && id) up(id, { text: e.target.value })
e.stopPropagation && e.stopPropagation()
}
body.addEventListener('input', onInput)
st._listeners = { tools: onTool, pal: onPal, color: onColor, input: onInput, dblclick: onDblClick, setEditing: setEditing }
return st
}
// textarea 高度贴字:数据(文本/字号)变了才重算,避免每次 render 都 reflow。
// 设 auto → 读 scrollHeight → 写回,是 textarea 自适应的标准做法;浏览器里行数/自动换行都算准。
function fitBody(st, text, size) {
if (st.fitText === text && st.fitSize === size) return
st.fitText = text; st.fitSize = size
var b = st.body
var prev = b.style.height
b.style.height = 'auto'
var h = b.scrollHeight
b.style.height = (h && h > 0 ? h : Math.max(1, text.split('\n').length) * Math.round(size * 1.7) + 24) + 'px'
// 高度没变就不留空字符串(兼容 stub:style.height 是普通对象)
if (!b.style.height && prev) b.style.height = prev
}
// 宿主 NodeCard 把 node.h 当作 minHeight 写在外框上(style.minHeight = node.h, height:auto)。
// 这就是 v1.0.2「内容贴字了但外框还有一截空白、手柄拖不下去」的真正原因:插件只改了
// textarea 高度,外框仍被 node.h 撑住。这里做两件事:
// 1. 内容高度 = 工具条 + 正文(不用 root.offsetHeight:root 会被旧的 minHeight 拉高,
// 读出来还是旧高度,会自我锁死);
// 2. 首次遇到「旧 h 明显大于内容」时把 node.h 校正到内容高度,顺手把外框 minHeight
// 覆盖成同一个值——resize 起点 (onResizeStart 读 n0.h) 才和实际视觉一致,拖小立刻生效。
// 区分两种 h:
// - 插件自动跟随内容写出的 h:内容长高就涨、缩回就降(v1.0.6 修的「两行退回一行不缩」);
// - 用户拖手柄改出的 h:h 相对上一帧变了 ⇒ 尊重手动尺寸,只在内容超过它时顶一下。
// 首次遇到的旧大 h 校正一次(staleH),之后进入自动跟随。
function fitOuterBox(st, node) {
if (!st || !st.root || !node) return
var toolsH = st.tools.offsetHeight || 30
var bodyH = parseFloat(st.body.style.height) || 0
if (!bodyH) return
var content = Math.round(toolsH + bodyH + 2) // +2 = 宿主节点上下各 1px 边框
var h = Number(node.h) || 0
if (st.staleH == null) st.staleH = h
if (st.lastBoxH != null && h !== st.lastBoxH) {
// 外部(用户拖手柄)改了 h:退出自动跟随,保留手动尺寸
st.autoFollow = false
} else if (st.autoFollow == null) {
// 首帧:旧 h 若明显大于内容,先校正一次,然后进入自动跟随
if (h > content + 2 && st.staleH === h) { node.h = content; h = content }
st.autoFollow = true
}
if (st.autoFollow) {
// 自动跟随:文本/字号增减都双向贴合(这是两行退回一行能缩回去的关键)
if (Math.abs(h - content) > 1) { node.h = content; h = content }
} else if (h < content - 2) {
// 手动尺寸只在内容超出时才顶高,不覆盖用户主动拖大的高度
node.h = content; h = content
}
st.lastBoxH = h
var floor = Math.max(content, Number(node.h) || 0)
// root → host(.iwb-plugin-node-body) → card(.iwb-node)
var card = st.root.parentNode && st.root.parentNode.parentNode
if (card && card.style && card.style.minHeight !== floor + 'px') card.style.minHeight = floor + 'px'
}
function syncSkeleton(st, data, node) {
var bg = data.bgColor || DEFAULT_BG
var size = normSize(data.fontSize == null ? DEFAULT_SIZE : data.fontSize)
var weight = data.fontWeight === 600 ? 600 : 400
var text = data.text == null ? '' : String(data.text)
var color = textColorOf(bg)
// 幂等:只在值真的变了才写 DOM,避免重建/覆盖正在编辑的 textarea。
if (st.root.style.background !== bg) st.root.style.background = bg
if (st.root.style.color !== color) st.root.style.color = color
if (!st.editing && document.activeElement !== st.body && st.body.value !== text) st.body.value = text
if (st.body.style.fontSize !== size + 'px') st.body.style.fontSize = size + 'px'
if (st.body.style.fontWeight !== String(weight)) st.body.style.fontWeight = String(weight)
fitBody(st, text, size)
fitOuterBox(st, node)
if (st.bold.className !== 'iwb-sticky-btn' + (weight === 600 ? ' iwb-sticky-btn-on' : '')) {
st.bold.className = 'iwb-sticky-btn' + (weight === 600 ? ' iwb-sticky-btn-on' : '')
}
if (st.dot.style.background !== bg) st.dot.style.background = bg
}
// ---------------- 面板 ----------------
var ctxForPanel = null
var noteList = []
function refreshList() {
if (!ctxForPanel) return
var host = ctxForPanel.__stickyPanelRoot
if (!host || typeof host.innerHTML !== 'undefined' && !host.innerHTML && !host.appendChild) return
var list = host.querySelector ? host.querySelector('.iwb-sticky-list') : null
if (!list) return
// 尽力从画布读回便利贴节点(只读画布能力给了 getNodes)
var nodes = []
try {
var api = ctxRef && ctxRef.canvas
if (api && typeof api.getNodes === 'function') nodes = api.getNodes() || []
} catch (e) { nodes = [] }
var mine = nodes.filter(function (n) { return String(n.type || '').indexOf('plugin:sticky:') === 0 })
// 用最近插入的本地记录补足(getNodes 快照不含自定义状态没关系,这里只显示文本)
var seen = {}
var rows = []
mine.concat(noteList).forEach(function (n) {
var key = n.id
if (!key || seen[key]) return
seen[key] = 1
var text = String((n.data && n.data.text) || '').replace(/\s+/g, ' ').slice(0, 30) || '(空便利贴)'
rows.push({ id: key, text: text })
})
while (list.firstChild) list.removeChild(list.firstChild)
rows.slice(-20).forEach(function (r) {
var row = el('div', { className: 'iwb-sticky-row' })
row.appendChild(el('span', { className: 'iwb-sticky-row-txt' }, r.text))
var go = el('button', { className: 'iwb-sticky-go', type: 'button' }, '定位')
go.addEventListener('click', function () {
try { if (ctxRef && ctxRef.canvas && typeof ctxRef.canvas.focusNode === 'function') ctxRef.canvas.focusNode(r.id) } catch (e) { /* noop */ }
})
row.appendChild(go)
list.appendChild(row)
})
}
function mountPanel(host, ctx) {
ensureStyle()
ctxForPanel = ctx
host.textContent = ''
host.style.minWidth = '0'; host.style.minHeight = '0'; host.style.height = '100%'
var wrap = el('div', { className: 'iwb-sticky-panel' })
wrap.appendChild(el('div', { className: 'iwb-sticky-panel-tip' },
'在画布上放一张便利贴:字调大当说明标题,字调小放多行正文。点右下角拖动手柄可改变便签大小。'))
var add = el('button', { className: 'iwb-sticky-add', type: 'button' }, '+ 插入便利贴')
add.addEventListener('click', function () { insertNote() })
wrap.appendChild(add)
var list = el('div', { className: 'iwb-sticky-list' })
wrap.appendChild(list)
host.appendChild(wrap)
ctxForPanel.__stickyPanelRoot = host
refreshList()
}
function insertNote() {
var api = ctxRef && ctxRef.canvas
if (!api || typeof api.createNode !== 'function') return null
var id = api.createNode('plugin:sticky:sticky', null, null, {
text: '', fontSize: DEFAULT_SIZE, fontWeight: 400, bgColor: DEFAULT_BG,
})
if (id) {
noteList.push({ id: id, data: { text: '' } })
refreshList()
}
return id
}
function dispose() {
ctxRef = null
ctxForPanel = null
noteList = []
}
global.IWBPluginHost.register({
id: 'sticky',
name: '便利贴',
version: '1.0.7',
apiVersion: 1,
capabilities: ['panels', 'nodeTypes', 'canvas'],
}, function (ctx) {
ctxRef = ctx
if (ctx.nodes && typeof ctx.nodes.register === 'function') {
ctx.nodes.register({
id: 'sticky',
title: '便利贴',
defaults: {},
ports: { in: false, out: false },
height: 180,
render: renderSticky,
})
}
if (ctx.ui && typeof ctx.ui.registerPanel === 'function') {
ctx.ui.registerPanel({
id: 'sticky',
title: '便利贴',
icon: 'note',
mount: mountPanel,
})
}
return { dispose: dispose }
})
})(typeof window !== 'undefined' ? window : globalThis)
+2 -1
View File
@@ -190,7 +190,8 @@ fs.writeFileSync(path.join(dist, 'app.js'), appBundle)
const { build: buildTokens } = require('./gen-tokens')
const tokensBuilt = buildTokens()
const tokensCssPath = path.join(root, 'src/design-tokens.css')
const tokensCss = fs.readFileSync(tokensCssPath, 'utf8')
// Windows 检出可能是 CRLF(core.autocrlf=true):内容一致时不应让构建失败
const tokensCss = fs.readFileSync(tokensCssPath, 'utf8').replace(/\r\n/g, '\n')
if (tokensCss !== tokensBuilt.css) {
console.error('FAIL src/design-tokens.css 与 src/theme-tokens.js 的 derive() 不一致')
console.error(' → 先跑 npm run tokens:write(改了配色公式/种子却没重新生成快照)')
+8 -2
View File
@@ -117,7 +117,11 @@ const SCALE = [
['--iwb-radius-full', '999px', '圆形/药丸'],
['--iwb-font-xs', '11px', 'M4 字号:状态栏/徽标'],
['--iwb-font-sm', '12px', '标签/次要正文'],
['--iwb-font-md', '13px', '正文/工具栏标题'],
['--iwb-font-md', '13px', '紧凑正文/工具栏标题'],
// 14px 是浏览器默认正文字号,也是全站第四高频(M6 实测 10 处:表单行标题、命令输入、
// 帮助正文、尺寸数字)。闭集原本 13 → 15 跨 2px,中间有洞,凡是「标准正文」都无处安放,
// 只能就近塞进 13(偏小)或 15(偏大)。补这一档而不是继续塞,是因为它不是一处特例。
['--iwb-font-base', '14px', '标准正文:表单行标题/命令输入/帮助正文'],
['--iwb-font-lg', '15px', '小标题/节点标题'],
['--iwb-font-xl', '17px', '面板标题'],
['--iwb-font-2xl', '20px', '页面大标题'],
@@ -420,7 +424,9 @@ function main () {
}
const problems = []
const cur = fs.existsSync(CSS_OUT) ? fs.readFileSync(CSS_OUT, 'utf8') : ''
// Windows 默认 core.autocrlf=true 会把 CSS 检出成 CRLF;内容一致但字符串不等,
// 会误报「快照与 derive() 不一致」。比较前统一换行符(写入始终 LF,见 .gitattributes)。
const cur = (fs.existsSync(CSS_OUT) ? fs.readFileSync(CSS_OUT, 'utf8') : '').replace(/\r\n/g, '\n')
if (cur !== css) {
// 逐行指出第一处差异,别让人对着两千行找
const a = cur.split('\n')
+1 -1
View File
@@ -10,7 +10,7 @@ const crypto = require('crypto')
const root = path.resolve(__dirname, '..')
const srcRoot = process.argv[2] ? path.resolve(process.argv[2]) : path.resolve(root, '..', 'iwb-plugins-desktop')
const outDir = path.join(root, 'plugins', 'runtime')
const IDS = ['batch-export', 'blank-canvas', 'browser', 'gallery', 'grouplib', 'promptlib', 'image-annotate', 'image-vectorize', 'style-source', 'white-bg-800', 'xianyi-cutout']
const IDS = ['batch-export', 'blank-canvas', 'browser', 'gallery', 'grouplib', 'promptlib', 'image-annotate', 'image-vectorize', 'sticky', 'style-source', 'white-bg-800', 'xianyi-cutout']
// v3.25.41(M1):目录化插件试点 —— 这些 id 产出 <id>/{manifest.json,main.js},其余仍是单文件(双轨兼容)
// ⚠️ 2026-11-20 修正:桌面包不随包发插件(scripts/strip-plugins.js),插件只能从市场装,
// 而市场目前只支持单文件 ⇒ 目录形态暂不用于生产插件,等 M3(zip 安装)落地再启用。
+47
View File
@@ -33,6 +33,53 @@ function walk (dir, out) {
}
const pluginFiles = walk(path.join(ROOT, 'plugins'), [])
/* ---------- 插件专项(--plugins):写死灰 / 半像素 / 散值 ---------- */
if (process.argv.includes('--plugins')) {
const FONT = new Set([11, 12, 13, 14, 15, 17, 20, 24])
const RADIUS = new Set([6, 8, 10, 12, 14, 999])
const SPACE = new Set([0, 2, 4, 6, 8, 10, 12, 16, 20, 24, 32, 40, 48, 64])
const hexToRgb = (h) => {
let v = h.replace('#', '')
if (v.length === 3) v = v.split('').map((c) => c + c).join('')
if (v.length !== 6) return null
return [parseInt(v.slice(0, 2), 16), parseInt(v.slice(2, 4), 16), parseInt(v.slice(4, 6), 16)]
}
const chroma = (h) => { const c = hexToRgb(h); return c ? Math.max(...c) - Math.min(...c) : 0 }
const rows = []
for (const f of pluginFiles.filter((x) => /\.css$/i.test(x))) {
const src = read(f)
const rel = path.relative(ROOT, f).split(path.sep).join('/')
const r = { file: rel, font: 0, radius: 0, space: 0, color: 0, gray: 0 }
for (const m of src.matchAll(/([a-z-]+)\s*:\s*([^;{}]+)/g)) {
const prop = m[1].toLowerCase()
const val = m[2].trim()
if (val.includes('var(')) continue
if (prop === 'font-size') {
const px = /([0-9.]+)px/.exec(val); if (px && !FONT.has(Number(px[1]))) r.font++
} else if (prop === 'border-radius') {
for (const px of val.matchAll(/([0-9.]+)px/g)) if (!RADIUS.has(Number(px[1]))) r.radius++
} else if (/^(gap|row-gap|column-gap)$/.test(prop) || /^(padding|margin)/.test(prop)) {
for (const px of val.matchAll(/([0-9.]+)px/g)) if (!SPACE.has(Number(px[1]))) r.space++
} else if (/^(color|background(-color)?|border(-color)?)$/.test(prop)) {
for (const hx of val.matchAll(/#[0-9a-f]{3,8}/gi)) {
r.color++
if (chroma(hx[0]) < 24) r.gray++
}
}
}
if (r.font || r.radius || r.space || r.color) rows.push(r)
}
rows.sort((a, b) => (b.gray + b.font + b.radius + b.space) - (a.gray + a.font + a.radius + a.space))
const sum = (k) => rows.reduce((n, r) => n + r[k], 0)
console.log('## 插件样式审计(--plugins)' + '\n')
console.log('| 文件 | 中性色写死 | 半/散字号 | 散圆角 | 散间距 |' + '\n' + '|---|---|---|---|---|')
for (const r of rows.slice(0, 20)) console.log('| ' + r.file + ' | ' + r.gray + ' | ' + r.font + ' | ' + r.radius + ' | ' + r.space + ' |')
console.log('\n' + '- 合计:中性色写死 **' + sum('gray') + '** 处(另有强调色写死 ' + (sum('color') - sum('gray')) + ' 处,允许)')
console.log('- 散字号 **' + sum('font') + '** / 散圆角 **' + sum('radius') + '** / 散间距 **' + sum('space') + '**', '(棘轮:只降不升,见 tests/plugin-scale-contract-test.js)')
process.exit(0)
}
const count = (re, src) => (src.match(re) || []).length
const uniqSorted = (arr, numeric) => Array.from(new Set(arr)).sort(numeric ? (a, b) => a - b : undefined)
+234
View File
@@ -0,0 +1,234 @@
#!/usr/bin/env node
/* token-lint.js —— 设计 token 的「新增行」闸门(M5-T5.1 / T5.5)
*
* 只查**新增行**,不查存量:M4 结束时 style.css 里还有 170 处写死字号、55 处裸 z-index,
* 一次性要求全清零只会逼人加白名单。闸门的作用是**不让数字再涨**(存量交给棘轮测试慢慢降)。
*
* 四条白名单(缺一条都会逼人绕路,绕路比违规更难发现):
* ① 内容色:行内 `/*iwb:content*​/` —— 画布内容(图片上的纯白文字、截图底色)不是主题表面色,
* 同一个 #fff 在按钮上是 bug、在图片上是内容,值分不出来,只能靠标记。
* ② 变量兜底:`var(--x, 8px)` 里的 8px 不查 —— 兜底值不生效时才是问题,而那时 var 本身就会红。
* ③ 布局尺寸:只查排版属性(字号/圆角/内距/间距/外边距)。width/height/left/top 没有闭集,
* 强行 token 化只会发明一堆只用一次的名字。
* ④ 临时例外:行内 `/*iwb:raw-until=3.27.0*​/` —— **必须带到期版本**,到期后本脚本把它当失败,
* 不会像普通白名单那样悄悄变成永久免死金牌。
*
* 用法:
* node scripts/token-lint.js # 查工作区未提交的改动(diff vs HEAD)
* node scripts/token-lint.js --base origin/main # 查 base..HEAD 的改动(CI / 发版前)
* node scripts/token-lint.js --file style.css # 查整个文件(迁移时看全局)
* node scripts/token-lint.js --json
*/
'use strict'
const fs = require('fs')
const path = require('path')
const { execFileSync } = require('child_process')
const ROOT = path.join(__dirname, '..')
const VERSION = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8')).version
// 排版属性:这些值必须来自闭集。其余属性(width/height/top/left/flex/…)没有闭集,不查。
const SIZE_PROPS = new Set([
'font-size', 'border-radius', 'gap', 'row-gap', 'column-gap'
])
const SIZE_PREFIX = /^(padding|margin)(-(top|right|bottom|left|block|inline)(-(start|end))?)?$/
// 颜色属性:表面色/文字色必须来自语义 token。
// box-shadow 不在其中 —— 它已由 --iwb-elevation-* 四档收口,阴影里的 rgba 是笔画而不是表面。
const COLOR_PROPS = new Set([
'color', 'background', 'background-color',
'border-color', 'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color',
'fill', 'stroke', 'outline-color'
])
// 生成物与第三方:token 定义本身当然满地是值;站点是另一套系统(自己的 --*-变量)
const SKIP_FILE = /^(src\/design-tokens\.css|dist\/|node_modules\/|site\/|docs\/)/
// 插件产物由 tests/plugin-theme-contract-test.js 按「私有皮肤 / 强调色 / 中性色」分类治理,
// 这里只对插件查层级(插件内部若写死 9999,会盖住宿主的弹窗与确认框)。
const PLUGIN_FILE = /^plugins\//
const CONTENT_MARK = /\/\*iwb:content\*\//
const EXCEPTION_MARK = /\/\*iwb:raw-until=(\d+\.\d+\.\d+)\*\//
const argv = process.argv.slice(2)
const argOf = (name) => {
const i = argv.indexOf(name)
return i >= 0 ? argv[i + 1] : null
}
const jsonOut = argv.includes('--json')
const base = argOf('--base')
const onlyFile = argOf('--file')
/* ── 1. 取「要检查的行」:{file, line, text} ───────────────────────────── */
function linesFromDiff () {
const args = ['-C', ROOT, 'diff', '--no-color', '--unified=0', '--no-ext-diff']
// 默认 diff HEAD 会把已暂存与未暂存都算进来(工作区真实状态);--base 则是「已提交的这批」
args.push(base ? base + '...HEAD' : 'HEAD')
args.push('--', '*.css', 'app.js', 'src', 'plugins')
let out = ''
try {
out = execFileSync('git', args, { encoding: 'utf8', maxBuffer: 32 * 1024 * 1024 })
} catch (e) {
// 不是 git 仓库(或浅克隆取不到 base)时不要假装通过:直接报错,让人显式用 --file
console.error('token-lint: 无法取到 git diff(' + (e.message || e) + ')')
console.error(' 不在 git 仓库里时用 --file <path> 指定要查的文件')
process.exit(2)
}
const rows = []
let file = null
let next = 0
for (const raw of out.split('\n')) {
if (raw.startsWith('+++ b/')) { file = raw.slice(6); continue }
if (raw.startsWith('+++ /dev/null')) { file = null; continue }
const h = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/.exec(raw)
if (h) { next = Number(h[1]); continue }
if (!file) continue
if (raw.startsWith('+')) { rows.push({ file, line: next, text: raw.slice(1) }); next++ }
}
return rows
}
function linesFromFile (p) {
const abs = path.isAbsolute(p) ? p : path.join(ROOT, p)
const rel = path.relative(ROOT, abs).split(path.sep).join('/')
return fs.readFileSync(abs, 'utf8').split('\n').map((text, i) => ({ file: rel, line: i + 1, text }))
}
/* ── 2. 判定 ──────────────────────────────────────────────────────────── */
const cmpVer = (a, b) => {
const pa = a.split('.').map(Number)
const pb = b.split('.').map(Number)
for (let i = 0; i < 3; i++) if (pa[i] !== pb[i]) return pa[i] - pb[i]
return 0
}
// 把 var(...) 整段抠掉:兜底值不查(见白名单 ②),剩下的才是「裸值」
const stripVar = (v) => v.replace(/var\([^()]*\)/g, 'var')
const problems = []
const warn = []
// JS 里的样式有两种写法,判据必须分开(否则会误伤布局参数):
// ① CSS 文本:`cssText = 'padding:16px;font-size:12px'`、`innerHTML = '<div style="color:#333">'`
// —— 只有**带 px 单位**或带 #/rgb 颜色才算样式;`{ gap: 20 }` 这种是画布布局参数,不能管
// ② React 内联对象:`style={{ fontSize: 13 }}` —— 数字即 px,但键名要用**无歧义**的
// camelCase(fontSize / marginLeft / zIndex…);`gap` / `padding` 在 JS 对象里可能是
// 任何东西(CanvasGeometry 的 snapToFreeSpot 就吃 `{ gap: 20 }`),所以不查
const JS_PX = /(font-size|border-radius|padding[a-z-]*|gap|row-gap|column-gap|margin[a-z-]*)\s*:\s*(-?\d*\.?\d+)px/g
const JS_COLOR = /(color|background|border-color)\s*:\s*(#[0-9a-f]{3,8}|rgba?\([^)]*\))/gi
const JS_Z = /z-index\s*:\s*(-?\d+)/g
const JS_CAMEL = /(fontSize|borderRadius|paddingTop|paddingBottom|paddingLeft|paddingRight|marginTop|marginBottom|marginLeft|marginRight|rowGap|columnGap|zIndex)\s*:\s*(\d+)/g
function check (row) {
const { file, line, text } = row
if (!text || !text.includes(':')) return
if (SKIP_FILE.test(file)) return
const isPlugin = PLUGIN_FILE.test(file)
const isJs = /\.js$/.test(file)
const contentOk = CONTENT_MARK.test(text)
const ex = EXCEPTION_MARK.exec(text)
const expired = ex ? cmpVer(VERSION, ex[1]) >= 0 : false
const bucket = (msg, hard) => {
if (ex && !expired) {
warn.push({ file, line, msg, until: ex[1] })
return
}
if (expired) msg += '(例外已过期:raw-until=' + ex[1] + ',当前 ' + VERSION + ')'
if (hard) problems.push({ file, line, msg })
else warn.push({ file, line, msg })
}
if (isJs) {
// 纯注释行跳过:注释里写「z-index:2 是局部层级」这种说明不该被判违规
if (/^\s*(\/\/|\/\*|\*)/.test(text)) return
// 插件产物里的颜色/字号交给插件契约测试;层级照样管(见下)
const scanPx = !isPlugin
if (scanPx) {
for (const m of text.matchAll(JS_PX)) {
if (Number(m[2]) === 0) continue
bucket(m[1] + ': ' + m[2] + 'px → 用 --iwb-(font|radius|space)-* 闭集', true)
}
for (const m of text.matchAll(JS_CAMEL)) {
if (m[1] === 'zIndex') continue // 层级单独报,避免同一条重复计数
if (Number(m[2]) === 0) continue
bucket(m[1] + ': ' + m[2] + ' → 用 --iwb-(font|radius|space)-* 闭集(数字即 px)', true)
}
for (const m of text.matchAll(JS_COLOR)) {
const white = m[1].toLowerCase() === 'color' && /^#(fff|ffffff)$/i.test(m[2])
if (contentOk || white) continue
bucket(m[1] + ': ' + m[2] + ' → 用语义色 token(内容色加 /*iwb:content*/ 标记)', true)
}
}
for (const m of text.matchAll(JS_Z)) {
bucket('z-index: ' + m[1] + ' → 用 --iwb-z-*(插件不得高于 --iwb-z-anchor / 3200)', true)
}
for (const m of text.matchAll(JS_CAMEL)) {
if (m[1] !== 'zIndex') continue
bucket('zIndex: ' + m[2] + ' → 用 --iwb-z-*', true)
}
return
}
for (const m of text.matchAll(/([a-z-]+)\s*:\s*([^;{}]+)/g)) {
const prop = m[1].toLowerCase()
const value = m[2].trim()
const bare = stripVar(value)
// z-index:任何裸数字都不行(层级表见 docs/standards/design-tokens.md §3.4)
if (prop === 'z-index') {
if (/^-?\d+$/.test(bare)) {
bucket('z-index: ' + bare + ' → 用 --iwb-z-*(插件不得高于 --iwb-z-anchor / 3200)', true)
}
continue
}
// 插件内部除了层级,其余交给插件契约测试(私有皮肤是允许整套调色板的)
if (isPlugin) continue
if (SIZE_PROPS.has(prop) || SIZE_PREFIX.test(prop)) {
const hit = /(-?\d*\.?\d+)px/.exec(bare)
if (hit && Number(hit[1]) !== 0) {
bucket(prop + ': ' + value + ' → 用 --iwb-(font|radius|space)-* 闭集', true)
}
continue
}
if (COLOR_PROPS.has(prop)) {
const hex = /#[0-9a-f]{3,8}\b/i.test(bare)
const rgb = /rgba?\(/i.test(bare)
if (!hex && !rgb) continue
// 纯白文字压在图片/色块上:内容对比,不是主题表面色(与插件契约同款例外)
const whiteText = prop === 'color' && /^#(fff|ffffff)$/i.test(bare)
if (contentOk || whiteText) continue
bucket(prop + ': ' + value + ' → 用语义色 token(内容色加 /*iwb:content*/ 标记)', true)
}
}
}
/* ── 3. 跑 ────────────────────────────────────────────────────────────── */
const rows = onlyFile ? linesFromFile(onlyFile) : linesFromDiff()
for (const r of rows) check(r)
const anchor = (() => {
const css = fs.readFileSync(path.join(ROOT, 'src', 'design-tokens.css'), 'utf8')
const m = /--iwb-z-anchor:\s*(\d+)/.exec(css)
return m ? Number(m[1]) : null
})()
if (jsonOut) {
console.log(JSON.stringify({ version: VERSION, mode: onlyFile ? 'file' : (base || 'HEAD'), checked: rows.length, problems, warn, pluginZCeiling: anchor }, null, 2))
process.exit(problems.length ? 1 : 0)
}
const mode = onlyFile ? '整个文件 ' + onlyFile : (base ? base + '...HEAD' : '工作区未提交改动')
console.log('token-lint: ' + mode + ',检查 ' + rows.length + ' 行新增' + (anchor ? '(插件层级上限 ' + anchor + ')' : ''))
for (const w of warn) console.log(' · ' + w.file + ':' + w.line + ' ' + w.msg + (w.until ? ' [例外至 ' + w.until + ']' : ''))
if (problems.length) {
for (const p of problems) console.log(' ✗ ' + p.file + ':' + p.line + ' ' + p.msg)
console.log('\ntoken-lint: ' + problems.length + ' 处新增裸值 —— 失败。理由与白名单见 docs/standards/design-tokens.md §5')
process.exit(1)
}
console.log('token-lint: 通过(0 处新增裸值' + (warn.length ? ',' + warn.length + ' 条已登记的例外' : '') + ')')
+2 -2
View File
@@ -3,7 +3,7 @@
<title>插件开发规范 · Image Workbench</title>
<link rel="icon" href="/assets/favicon.png" type="image/png">
<link rel="apple-touch-icon" href="/assets/logo.png">
<link rel="stylesheet" href="/assets/style.css?v=3.26.49-mwt2i899">
<link rel="stylesheet" href="/assets/style.css?v=3.26.60-mwudqfql">
<style>
.devdoc{max-width:860px;margin:0 auto;padding:40px 0 72px;color:var(--ink,#1b1f24);font-size:15px;line-height:1.75}
.devdoc h1{font-size:38px;line-height:1.2;margin:8px 0 18px}
@@ -33,7 +33,7 @@
</div>
<div class="right">
<a class="btn" href="/plugins/">插件市场</a>
<a class="btn primary" href="/download/">下载 v3.26.49</a>
<a class="btn primary" href="/download/">下载 v3.26.60</a>
</div>
</div></nav>
<main>
+37 -5
View File
@@ -57,13 +57,13 @@
<h2>下载</h2>
<div class="row">
<div class="name">macOS · Apple Silicon<div class="hint">M1 / M2 / M3 / M4</div></div>
<div class="meta">版本 3.26.49 · 8.4 MB · .dmg<div class="hash">sha256 ce27a43c4b22505d…</div></div>
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.26.49_aarch64.dmg?h=ce27a43c4b22">下载</a>
<div class="meta">版本 3.26.60 · 8.4 MB · .dmg<div class="hash">sha256 e3cd2adff23b1d2b…</div></div>
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.26.60_aarch64.dmg?h=e3cd2adff23b">下载</a>
</div>
<div class="row">
<div class="name">macOS · Intel<div class="hint">x86_64</div></div>
<div class="meta">版本 3.26.49 · 8.8 MB · .dmg<div class="hash">sha256 cb01e10548431bfb…</div></div>
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.26.49_x64.dmg?h=cb01e1054843">下载</a>
<div class="meta">版本 3.26.60 · 8.8 MB · .dmg<div class="hash">sha256 1dd4ce4fa5b47a09…</div></div>
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.26.60_x64.dmg?h=1dd4ce4fa5b4">下载</a>
</div>
<div class="row">
<div class="name">Windows · x64<div class="hint">需要 WebView2</div></div>
@@ -97,6 +97,38 @@
</ol>
<h2>历史版本</h2>
<div class="row">
<div class="name">3.26.60<div class="hint">浮层字号上调一档:模型设置/图像设置的选择项 11→13px、高 28px,面板 360px</div></div>
<div class="meta">2026-11-24<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.59<div class="hint">备份带上插件文件(提示词封面不再换机丢失);promptlib 1.11.0 封面文件治理</div></div>
<div class="meta">2026-11-24<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.58</div>
<div class="meta">2026-11-24<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
</div>
<div class="row">
<div class="name">3.26.57</div>
<div class="meta">2026-11-24<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.56</div>
<div class="meta">2026-11-24<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.55</div>
<div class="meta">2026-11-24<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
</div>
<div class="row">
<div class="name">3.26.54</div>
<div class="meta">2026-11-23<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.53</div>
<div class="meta">2026-11-23<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.49<div class="hint">v3.26.49:设计 token 落地收尾(M4-B2~B6)——字号/间距/圆角/层级统一进闭集,暗色控件与画布端口对比度修正;插件主题契约文件级豁免清零,私有皮肤改为自声明。本版为 macOS 双架构,Windows 稍后跟进。</div></div>
<div class="meta">2026-11-23<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
@@ -499,7 +531,7 @@
</div>
<div class="foot">
本页由 <code>scripts/gen-release-page.js</code> 从 releases.json 生成 · 源码 <a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop">git.maqiart.eu.org</a> · 更新于 2026-11-23
本页由 <code>scripts/gen-release-page.js</code> 从 releases.json 生成 · 源码 <a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop">git.maqiart.eu.org</a> · 更新于 2026-11-24
</div>
</div></div>
+13 -13
View File
@@ -4,7 +4,7 @@
<meta name="description" content="本地优先的 AI 生图无限画布:节点式工作流、插件按需安装、数据全部留在本机。">
<link rel="icon" href="/assets/favicon.png" type="image/png">
<link rel="apple-touch-icon" href="/assets/logo.png">
<link rel="stylesheet" href="/assets/style.css?v=3.26.49-mwt2i899">
<link rel="stylesheet" href="/assets/style.css?v=3.26.60-mwudqfql">
</head><body>
<nav><div class="wrap inner">
<a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>
@@ -17,20 +17,20 @@
</div>
<div class="right">
<a class="btn" href="/plugins/">插件市场</a>
<a class="btn primary" href="/download/">下载 v3.26.49</a>
<a class="btn primary" href="/download/">下载 v3.26.60</a>
</div>
</div></nav>
<main>
<section class="hero hero-art">
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.26.49-mwt2i899" alt=""></div>
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.26.60-mwudqfql" alt=""></div>
<div class="hero-veil"></div>
<div class="wrap">
<span class="kicker">v3.26.49 · macOS / Windows · 数据在本地</span>
<span class="kicker">v3.26.60 · macOS / Windows · 数据在本地</span>
<h1>本地优先的<br>AI 生图无限画布</h1>
<p class="sub">用节点把「参考图 → 提示词 → 批量生成 → 图库」串成一条生产线。<br>图片、提示词、模型配置全部留在你自己的电脑里,插件按需安装。</p>
<div class="cta">
<a class="btn primary lg" href="/download/">下载 v3.26.49</a>
<a class="btn lg" href="/plugins/">浏览 11 个插件</a>
<a class="btn primary lg" href="/download/">下载 v3.26.60</a>
<a class="btn lg" href="/plugins/">浏览 12 个插件</a>
</div>
<div class="meta">支持 macOS 12+ 与 Windows 10 1803+ · 安装包约 7 MB · 无需登录</div>
</div></section>
@@ -55,7 +55,7 @@
<div class="grid c3">
<div class="pcard" data-name="批量出图 batch-export 资源中心勾选节点,串行批量生成并打包 zip 下载 出图 批处理" data-tags="出图,批处理">
<div class="head"><span class="av" style="background:#e8f0fe">🗂️</span>
<div><div class="nm">批量出图</div><div class="ver">v1.2.1 · 官方</div></div></div>
<div><div class="nm">批量出图</div><div class="ver">v1.2.2 · 官方</div></div></div>
<div class="desc">资源中心勾选节点,串行批量生成并打包 ZIP 下载</div>
<div class="tags"><span class="tag">出图</span><span class="tag">批处理</span></div>
</div>
@@ -73,31 +73,31 @@
</div>
<div class="pcard" data-name="图库 gallery 右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供) 资源 图库" data-tags="资源,图库">
<div class="head"><span class="av" style="background:#eef2f6">🖼️</span>
<div><div class="nm">图库</div><div class="ver">v1.6.9 · 官方</div></div></div>
<div><div class="nm">图库</div><div class="ver">v1.6.12 · 官方</div></div></div>
<div class="desc">右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供)</div>
<div class="tags"><span class="tag">资源</span><span class="tag">图库</span></div>
</div>
<div class="pcard" data-name="节点组 grouplib 左栏收藏的节点组:分组/改名/删除,拖到画布实例化(数据由客户端提供) 资源 节点组" data-tags="资源,节点组">
<div class="head"><span class="av" style="background:#eef2f6">📦</span>
<div><div class="nm">节点组</div><div class="ver">v1.0.4 · 官方</div></div></div>
<div><div class="nm">节点组</div><div class="ver">v1.0.5 · 官方</div></div></div>
<div class="desc">左栏收藏的节点组:分组/改名/删除,拖到画布实例化(数据由客户端提供)</div>
<div class="tags"><span class="tag">资源</span><span class="tag">节点组</span></div>
</div>
<div class="pcard" data-name="提示词库 promptlib 右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供) 资源 提示词" data-tags="资源,提示词">
<div class="head"><span class="av" style="background:#eef2f6">📖</span>
<div><div class="nm">提示词库</div><div class="ver">v1.8.21 · 官方</div></div></div>
<div><div class="nm">提示词库</div><div class="ver">v1.11.0 · 官方</div></div></div>
<div class="desc">右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供)</div>
<div class="tags"><span class="tag">资源</span><span class="tag">提示词</span></div>
</div>
</div>
<div style="margin-top:22px"><a class="btn" href="/plugins/">查看全部 11 个插件</a></div>
<div style="margin-top:22px"><a class="btn" href="/plugins/">查看全部 12 个插件</a></div>
</div></section>
<section class="section"><div class="wrap">
<h2>下载 Image Workbench</h2>
<p class="lead">选你的平台。装过一次之后,以后在应用内「设置 → 通用 → 版本与更新」就能一键升级。</p>
<div class="dl"><a href="/updates/darwin-aarch64/image-workbench_3.26.49_aarch64.dmg?h=ce27a43c4b22"><div class="n">macOS · Apple Silicon</div><div class="s">M1 / M2 / M3 / M4 · 8.4 MB · .dmg</div></a>
<a href="/updates/darwin-x86_64/image-workbench_3.26.49_x64.dmg?h=cb01e1054843"><div class="n">macOS · Intel</div><div class="s">x86_64 · 8.8 MB · .dmg</div></a>
<div class="dl"><a href="/updates/darwin-aarch64/image-workbench_3.26.60_aarch64.dmg?h=e3cd2adff23b"><div class="n">macOS · Apple Silicon</div><div class="s">M1 / M2 / M3 / M4 · 8.4 MB · .dmg</div></a>
<a href="/updates/darwin-x86_64/image-workbench_3.26.60_x64.dmg?h=1dd4ce4fa5b4"><div class="n">macOS · Intel</div><div class="s">x86_64 · 8.8 MB · .dmg</div></a>
<div class="none"><div class="n">Windows · x64</div><div class="s">暂未提供</div></div></div>
<div style="margin-top:20px;color:#9ca3af;font-size:12.5px">安装包未做 Apple 公证 / Windows 代码签名,首次打开需手动放行一次,细节见 <a href="/download/" style="text-decoration:underline">下载页</a>。</div>
</div></section>
+69 -36
View File
@@ -1,6 +1,6 @@
{
"version": 2,
"updatedAt": "2026-11-23T09:29:26.654Z",
"updatedAt": "2026-11-24T07:15:05.519Z",
"plugins": [
{
"id": "batch-export",
@@ -13,27 +13,27 @@
"出图",
"批处理"
],
"version": "1.2.1",
"version": "1.2.2",
"apiVersion": 1,
"bundle": "plugins/batch-export-1.2.1.zip",
"bundleSize": 44966,
"bundleSha256": "21225a0e49ab49d6502b8031897bfc41537b69caa93eafda03d0a8467472d367",
"bundle": "plugins/batch-export-1.2.2.zip",
"bundleSize": 45959,
"bundleSha256": "9e987bc94726ae75d1a1ad258a27cf0656b4f3253a533b36a56f5b2a61db5a56",
"files": [
{
"path": "manifest.json",
"sha256": "82baa12a06a37fea4ee1040212df13e13215a4f78eb75ca324efc632a360d560",
"sha256": "59e80e8dc3d72aa1b8970f900b4d8b4c7958210e608d3ad55d3c116a5142704f",
"size": 393
},
{
"path": "main.js",
"sha256": "4beb9bc20c263fee95d86357d6c5ac2ff429577931f7ea82a394989786b53450",
"size": 44359
"sha256": "44c13ac8e6d95b8b4a31999fc2d6885f888e0cc165a39edb68b9ffcb41996df5",
"size": 45352
}
],
"file": "plugins/plugin-batch-export.4beb9bc20c26.js",
"size": 44359,
"sha256": "4beb9bc20c263fee95d86357d6c5ac2ff429577931f7ea82a394989786b53450",
"integrity": "sha256-S+ubwgwmP+6V2GNX1sWsL/QpV3kx9+qCo5SYl4a1NFA="
"file": "plugins/plugin-batch-export.44c13ac8e6d9.js",
"size": 45352,
"sha256": "44c13ac8e6d95b8b4a31999fc2d6885f888e0cc165a39edb68b9ffcb41996df5",
"integrity": "sha256-RME6yObZW4tKMZmfwtaIX4iODMFlo57baLn/y0GZbfU="
},
{
"id": "blank-canvas",
@@ -112,25 +112,25 @@
"资源",
"图库"
],
"version": "1.6.9",
"version": "1.6.12",
"apiVersion": 1,
"bundle": "plugins/gallery-1.6.9.zip",
"bundleSize": 34272,
"bundleSha256": "9588b28fd2b2b3cc0f38ecd06fee05873474ca98867ce5b2dc5d6cc5948cf383",
"bundle": "plugins/gallery-1.6.12.zip",
"bundleSize": 35709,
"bundleSha256": "66f1a6006dec90d39db398f72311d638903a8a56c31928891d596bb5ed19a846",
"files": [
{
"path": "manifest.json",
"sha256": "0523a370d28132dcca912894929e402e9e7bac4a611be146ee075d073f26276c",
"size": 526
"sha256": "98a3d7ea8c82c674db22c95c055f4358bb31772a64bf2bf6f9af19e9570cd1c1",
"size": 527
},
{
"path": "main.js",
"sha256": "26c7e64b3a0021c6b9514dfb84d4d2580276698222b4791cfa99f22ead66ff52",
"size": 28241
"sha256": "a5fb039684937de44d1033c75d9872b9e6d1c8c2c9582cd5feee948562e9b7d1",
"size": 29677
},
{
"path": "styles.css",
"sha256": "9d5b4ab1343761e51ef0c479cab96a94d3d6eaa27f0fdb500bff789ec81d70e0",
"sha256": "35ae17de8b0f3bddab9cbef6270cd8bbf5153c9ecf6ed2b4f06216f6fef45b8b",
"size": 5195
}
]
@@ -146,25 +146,25 @@
"资源",
"节点组"
],
"version": "1.0.4",
"version": "1.0.5",
"apiVersion": 1,
"bundle": "plugins/grouplib-1.0.4.zip",
"bundle": "plugins/grouplib-1.0.5.zip",
"bundleSize": 24479,
"bundleSha256": "842fd7d519bf8378b205c1c35894b8b2925e40595792fed99b1d456a2563404d",
"bundleSha256": "d11ab6b0ce4672b90d3b117d1bcd6fe7e2000b3ce5ef52b4099b4668e12d080d",
"files": [
{
"path": "manifest.json",
"sha256": "b35b748d9e76380f8c02d04ca10e93e280d1b6386c6e0a3b55f5be2448a3c65f",
"sha256": "570365cad7b2971a6eb0d5827c4a4f988daa945ace296aab4536e9de592cb795",
"size": 530
},
{
"path": "main.js",
"sha256": "8cb2e39f9880d49c9b9c15a1f7d62d9772170c8d0eac0faaa237bb7056af34ff",
"sha256": "f59e06065392d01c2e87808382d546d91bf8d57451ef81922b3204f36e6490c9",
"size": 21601
},
{
"path": "styles.css",
"sha256": "ee6e292ffebdcc1351651bf7937399128ae06e0b364624792f34111866f9355b",
"sha256": "909e49d15a183ab9f36c298241fcab4506ed29e22b5a5daa47f086cbc7a65376",
"size": 2038
}
]
@@ -180,26 +180,26 @@
"资源",
"提示词"
],
"version": "1.8.21",
"version": "1.11.0",
"apiVersion": 1,
"bundle": "plugins/promptlib-1.8.21.zip",
"bundleSize": 149157,
"bundleSha256": "a9c11dff02e56ef3c95301e47c964d55d2b679fde1f7909a1603c62c1a4f930d",
"bundle": "plugins/promptlib-1.11.0.zip",
"bundleSize": 167890,
"bundleSha256": "66fca4b8c06b2e399383d095c92604c5c23b520238379bbf8bfa89c4c86a08ad",
"files": [
{
"path": "manifest.json",
"sha256": "114e97a4abbf3270e27fcaff3952b5fdc60f8cccd58c66fb2965af90e76efac4",
"sha256": "15212a82a8ad8bf1195598740077125dbee8f3f210d7426ec38a7bdf2abe07bc",
"size": 541
},
{
"path": "main.js",
"sha256": "125e02a618e37505836f964dbe21a3637e3043ee355d9606c538a54eed4243ad",
"size": 107029
"sha256": "0e1bd0f235b05b3edbdccd19ffe24791f0ce82bb5180ebe5a60dcaa6b2ed3ce8",
"size": 122957
},
{
"path": "styles.css",
"sha256": "84ad2314d016c7d2351eb7cf2044ee8cc703992d40a76002ff644d34eb48838a",
"size": 41277
"sha256": "23fd4beb4f5b89be1f763ee7221e3dbdafced85afc378cd5cc1a9e03b14d7046",
"size": 44082
}
]
},
@@ -269,6 +269,39 @@
"sha256": "0e5a7fa018b2e9de705f9112272ad02dcf187b5361696f7fc0a12a93c4f20d4e",
"integrity": "sha256-Dlp/oBiy6d5wX5ESJyrQLc8Ye1NhaW9/wKEqk8TyDU4="
},
{
"id": "sticky",
"name": "便利贴",
"desc": "画布便利贴:多行文本 + 字号/粗细调节 + 8 色背景,纯说明不连线",
"author": "official",
"icon": "📝",
"color": "#fdf3d0",
"tags": [
"标注",
"便签"
],
"version": "1.0.7",
"apiVersion": 1,
"bundle": "plugins/sticky-1.0.7.zip",
"bundleSize": 25425,
"bundleSha256": "1087fc1a8f842145e75cfca909acb0caf839fbf7349de6a7eee1d112843df369",
"files": [
{
"path": "manifest.json",
"sha256": "17e5bf6fb11cfe6d7748957d902f3e78585cdb7a1df44b387fd6dbdcae3a7958",
"size": 400
},
{
"path": "main.js",
"sha256": "af8e7249f0c7c010cc1544ee5a93a9ab6d5c25caa562dab90e738a52d9dd48b2",
"size": 24811
}
],
"file": "plugins/plugin-sticky.af8e7249f0c7.js",
"size": 24811,
"sha256": "af8e7249f0c7c010cc1544ee5a93a9ab6d5c25caa562dab90e738a52d9dd48b2",
"integrity": "sha256-r45ySfDHwBDMFUTuWpOpq21cJcqlYtq5DnOKUtndSLI="
},
{
"id": "style-source",
"name": "风格库",
+14 -7
View File
@@ -3,7 +3,7 @@
<title>插件市场 · Image Workbench</title>
<link rel="icon" href="/assets/favicon.png" type="image/png">
<link rel="apple-touch-icon" href="/assets/logo.png">
<link rel="stylesheet" href="/assets/style.css?v=3.26.49-mwt2i899">
<link rel="stylesheet" href="/assets/style.css?v=3.26.60-mwudqfql">
</head><body>
<nav><div class="wrap inner">
<a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>
@@ -16,13 +16,13 @@
</div>
<div class="right">
<a class="btn" href="/plugins/">插件市场</a>
<a class="btn primary" href="/download/">下载 v3.26.49</a>
<a class="btn primary" href="/download/">下载 v3.26.60</a>
</div>
</div></nav>
<main>
<section class="hero" style="padding:64px 0 8px;text-align:left"><div class="wrap">
<h1 style="font-size:40px;margin:0">插件市场</h1>
<p class="sub" style="margin:14px 0 0;text-align:left;max-width:720px">共 11 个插件。安装方式:应用内 <b>设置 → 插件 → 浏览</b>,点「安装」后重启生效。</p>
<p class="sub" style="margin:14px 0 0;text-align:left;max-width:720px">共 12 个插件。安装方式:应用内 <b>设置 → 插件 → 浏览</b>,点「安装」后重启生效。</p>
</div></section>
<section class="section" style="border-top:0;padding-top:24px"><div class="wrap">
<div style="display:flex;gap:8px;flex-wrap:wrap;margin:0 0 18px" id="chips">
@@ -40,6 +40,7 @@
<button class="tag" data-tag="标注" style="cursor:pointer;padding:5px 12px">标注</button>
<button class="tag" data-tag="转换" style="cursor:pointer;padding:5px 12px">转换</button>
<button class="tag" data-tag="矢量" style="cursor:pointer;padding:5px 12px">矢量</button>
<button class="tag" data-tag="便签" style="cursor:pointer;padding:5px 12px">便签</button>
<button class="tag" data-tag="风格" style="cursor:pointer;padding:5px 12px">风格</button>
<button class="tag" data-tag="电商" style="cursor:pointer;padding:5px 12px">电商</button>
<button class="tag" data-tag="抠图" style="cursor:pointer;padding:5px 12px">抠图</button>
@@ -49,7 +50,7 @@
<div class="grid c3" id="list">
<div class="pcard" data-name="批量出图 batch-export 资源中心勾选节点,串行批量生成并打包 zip 下载 出图 批处理" data-tags="出图,批处理">
<div class="head"><span class="av" style="background:#e8f0fe">🗂️</span>
<div><div class="nm">批量出图</div><div class="ver">v1.2.1 · 官方</div></div></div>
<div><div class="nm">批量出图</div><div class="ver">v1.2.2 · 官方</div></div></div>
<div class="desc">资源中心勾选节点,串行批量生成并打包 ZIP 下载</div>
<div class="tags"><span class="tag">出图</span><span class="tag">批处理</span></div>
</div>
@@ -67,19 +68,19 @@
</div>
<div class="pcard" data-name="图库 gallery 右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供) 资源 图库" data-tags="资源,图库">
<div class="head"><span class="av" style="background:#eef2f6">🖼️</span>
<div><div class="nm">图库</div><div class="ver">v1.6.9 · 官方</div></div></div>
<div><div class="nm">图库</div><div class="ver">v1.6.12 · 官方</div></div></div>
<div class="desc">右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供)</div>
<div class="tags"><span class="tag">资源</span><span class="tag">图库</span></div>
</div>
<div class="pcard" data-name="节点组 grouplib 左栏收藏的节点组:分组/改名/删除,拖到画布实例化(数据由客户端提供) 资源 节点组" data-tags="资源,节点组">
<div class="head"><span class="av" style="background:#eef2f6">📦</span>
<div><div class="nm">节点组</div><div class="ver">v1.0.4 · 官方</div></div></div>
<div><div class="nm">节点组</div><div class="ver">v1.0.5 · 官方</div></div></div>
<div class="desc">左栏收藏的节点组:分组/改名/删除,拖到画布实例化(数据由客户端提供)</div>
<div class="tags"><span class="tag">资源</span><span class="tag">节点组</span></div>
</div>
<div class="pcard" data-name="提示词库 promptlib 右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供) 资源 提示词" data-tags="资源,提示词">
<div class="head"><span class="av" style="background:#eef2f6">📖</span>
<div><div class="nm">提示词库</div><div class="ver">v1.8.21 · 官方</div></div></div>
<div><div class="nm">提示词库</div><div class="ver">v1.11.0 · 官方</div></div></div>
<div class="desc">右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供)</div>
<div class="tags"><span class="tag">资源</span><span class="tag">提示词</span></div>
</div>
@@ -95,6 +96,12 @@
<div class="desc">把位图转成 SVG 矢量路径</div>
<div class="tags"><span class="tag">转换</span><span class="tag">矢量</span></div>
</div>
<div class="pcard" data-name="便利贴 sticky 画布便利贴:多行文本 + 字号/粗细调节 + 8 色背景,纯说明不连线 标注 便签" data-tags="标注,便签">
<div class="head"><span class="av" style="background:#fdf3d0">📝</span>
<div><div class="nm">便利贴</div><div class="ver">v1.0.7 · 官方</div></div></div>
<div class="desc">画布便利贴:多行文本 + 字号/粗细调节 + 8 色背景,纯说明不连线</div>
<div class="tags"><span class="tag">标注</span><span class="tag">便签</span></div>
</div>
<div class="pcard" data-name="风格库 style-source 风格提示词库与一键套用 提示词 风格" data-tags="提示词,风格">
<div class="head"><span class="av" style="background:#fdf0e6">🎨</span>
<div><div class="nm">风格库</div><div class="ver">v1.3.3 · 官方</div></div></div>
+183 -1
View File
@@ -1,8 +1,190 @@
{
"app": "Image Workbench",
"subtitle": "本地优先的 AI 生图无限画布 · 桌面版(Tauri v2)",
"updatedAt": "2026-11-23T09:32:53.647Z",
"updatedAt": "2026-11-24T07:34:54.917Z",
"releases": [
{
"version": "3.26.60",
"date": "2026-11-24",
"notes": "浮层字号上调一档:模型设置/图像设置的选择项 11→13px、高 28px,面板 360px",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.60_aarch64.dmg",
"size": 8799262,
"sha256": "e3cd2adff23b1d2b4e1f5c52114c9151392a7864eb44686a9a607ef0272212ce",
"h": "e3cd2adff23b",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.60_x64.dmg",
"size": 9186576,
"sha256": "1dd4ce4fa5b47a093d6f558b92af5e6074728c114629eec18c929bf1bb8c79c4",
"h": "1dd4ce4fa5b4",
"kind": "dmg"
}
}
},
{
"version": "3.26.59",
"date": "2026-11-24",
"notes": "备份带上插件文件(提示词封面不再换机丢失);promptlib 1.11.0 封面文件治理",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.59_aarch64.dmg",
"size": 8798901,
"sha256": "31af87020085457e801143e471c53a7062fa29d47e54c08d4a200530e2949a06",
"h": "31af87020085",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.59_x64.dmg",
"size": 9185089,
"sha256": "ef8bac19b21fed48686ad23262325529fc539881d59f4089436fb380893230a3",
"h": "ef8bac19b21f",
"kind": "dmg"
}
}
},
{
"version": "3.26.58",
"date": "2026-11-24",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.58_aarch64.dmg",
"size": 8798836,
"sha256": "f2d0499c263727dc201fb84f4f52ec837294e93645bcf2bbf502a2e947e360ac",
"h": "f2d0499c2637",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.58_x64.dmg",
"size": 9186843,
"sha256": "357bcf1f5c6c027328058b858a44ab151d8b62d5540e6db70b9012d28af2610b",
"h": "357bcf1f5c6c",
"kind": "dmg"
},
"windows-x86_64": {
"file": "updates/windows-x86_64/image-workbench_3.26.58_x64-setup.exe",
"size": 5006832,
"sha256": "1d471517cbb1d1322037127e44ba68e293339eb1453280f509451b69bb8a16d7",
"h": "1d471517cbb1",
"kind": "exe"
}
}
},
{
"version": "3.26.57",
"date": "2026-11-24",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.57_aarch64.dmg",
"size": 8798003,
"sha256": "3e45e7ddbd0367a556a8868aa1d11b196a2a7e0516d7f5eded64a8af86535c19",
"h": "3e45e7ddbd03",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.57_x64.dmg",
"size": 9183122,
"sha256": "de9b2e7f102c479bc7ca6df57e0ae03e0458ce052b7057a56950885bc74ccadf",
"h": "de9b2e7f102c",
"kind": "dmg"
}
}
},
{
"version": "3.26.56",
"date": "2026-11-24",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.56_aarch64.dmg",
"size": 8800052,
"sha256": "7fe6df3b0ad1f82cd6845ffe2ed2a5beef68e7b5bc10dc911edd321b7ab4e3f7",
"h": "7fe6df3b0ad1",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.56_x64.dmg",
"size": 9190562,
"sha256": "292929a68279a7c5572026c87b4798b720982caec59d5b56a6e97e5a22f32f2f",
"h": "292929a68279",
"kind": "dmg"
}
}
},
{
"version": "3.26.55",
"date": "2026-11-24",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.55_aarch64.dmg",
"size": 8797296,
"sha256": "b76eee462d1811299cef938449669ebf873c0448b2ce293427ae683533f461c9",
"h": "b76eee462d18",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.55_x64.dmg",
"size": 9186452,
"sha256": "c121f0855a2a56d00684ab1f1c83428832e8738a2ef5c3186d33ab27a867b087",
"h": "c121f0855a2a",
"kind": "dmg"
},
"windows-x86_64": {
"file": "updates/windows-x86_64/image-workbench_3.26.55_x64-setup.exe",
"size": 5008672,
"sha256": "3613add4c85f5e8623bbfa5ca4f953b3a231d82b785391e56026c0863f270e67",
"h": "3613add4c85f",
"kind": "exe"
}
}
},
{
"version": "3.26.54",
"date": "2026-11-23",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.54_aarch64.dmg",
"size": 8797148,
"sha256": "05f3f0b858fd6fcc70481865f2226b94dd13d1b5c076eaf0f4206376bbf1aaf7",
"h": "05f3f0b858fd",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.54_x64.dmg",
"size": 9182228,
"sha256": "4241a9151b764ff010d646e97c4dc27e2f13d91105dca9e159cb70542dcb2055",
"h": "4241a9151b76",
"kind": "dmg"
}
}
},
{
"version": "3.26.53",
"date": "2026-11-23",
"notes": "",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.53_aarch64.dmg",
"size": 8795507,
"sha256": "db04dfa286719226249379ff2d8a7a6a4f313bcb39561be698d02c112c467fcf",
"h": "db04dfa28671",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.53_x64.dmg",
"size": 9189961,
"sha256": "d37f2aeca05c9b1340d66210c588c6dac2d9f3f9850680d551868198dea0f468",
"h": "d37f2aeca05c",
"kind": "dmg"
}
}
},
{
"version": "3.26.49",
"date": "2026-11-23",
+1 -1
View File
@@ -1983,7 +1983,7 @@ dependencies = [
[[package]]
name = "image-workbench"
version = "3.26.44"
version = "3.26.60"
dependencies = [
"arboard",
"base64 0.22.1",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "image-workbench"
version = "3.26.44"
version = "3.26.60"
description = "无限画布 · 生图工作台桌面版"
authors = ["malongan"]
license = ""
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "image-workbench",
"version": "3.26.49",
"version": "3.26.60",
"identifier": "com.malongan.imageworkbench",
"build": {
"frontendDist": "../dist",
+4 -2
View File
@@ -261,8 +261,10 @@
var d = document.createElement('div')
d.setAttribute('data-iwb-cwv-hint', '')
d.style.cssText = 'position:absolute;inset:0;display:flex;align-items:center;justify-content:center;'
+ 'padding:16px;text-align:center;font-size:12px;line-height:1.7;white-space:pre-line;'
+ 'background:rgba(128,128,128,.08);pointer-events:none;z-index:2'
+ 'padding:var(--iwb-space-16,16px);text-align:center;font-size:var(--iwb-font-sm,12px);line-height:1.7;white-space:pre-line;'
// z-index:2 是**组件内部**的局部层级(与宿主层级表无关,只在本容器内压住画布),
// 不是 body 级浮层,所以不走 --iwb-z-*;登记为例外,到期复核是否还需要它
+ 'background:color-mix(in srgb,var(--iwb-text) 8%,transparent);pointer-events:none;z-index:2 /*iwb:raw-until=3.28.0*/'
st.hintEl = d
el.appendChild(d)
}
+5 -4
View File
@@ -69,9 +69,9 @@
--iwb-plugin-inset: #ebebeb;
--iwb-plugin-hover: #e2e2e2;
/* —— 语义色 —— */
--iwb-err: #ef4444;
--iwb-ok: #22c55e;
--iwb-warn: #d97706;
--iwb-err: #b91c1c;
--iwb-ok: #15803d;
--iwb-warn: #b45309;
/* —— 尺度层(L1)—— */
--sp-1: 4px; /* @deprecated 全部 5 个 → M3 的 --iwb-space-4/8/12/16/24 */
--sp-2: 8px;
@@ -111,7 +111,8 @@
--iwb-radius-full: 999px; /* 圆形/药丸 */
--iwb-font-xs: 11px; /* M4 字号:状态栏/徽标 */
--iwb-font-sm: 12px; /* 标签/次要正文 */
--iwb-font-md: 13px; /* 正文/工具栏标题 */
--iwb-font-md: 13px; /* 紧凑正文/工具栏标题 */
--iwb-font-base: 14px; /* 标准正文:表单行标题/命令输入/帮助正文 */
--iwb-font-lg: 15px; /* 小标题/节点标题 */
--iwb-font-xl: 17px; /* 面板标题 */
--iwb-font-2xl: 20px; /* 页面大标题 */
+1
View File
@@ -32,6 +32,7 @@
download: call('download'),
insert: call('insert'),
remove: call('remove'),
openFolder: call('openFolder'),
}
// 纯函数:把宿主 outputs + 查询参数变成插件要的条目(不含 data,避免把 base64 递给插件)
+2
View File
@@ -5,6 +5,7 @@
* save({prompts, groups}) → 落盘(宿主仍持有数据:iwb_web_prompts + 分组缓存)
* insert(text, name) → 在画布视口中心插入提示词节点(插件不碰画布状态)
* copy(text) → 走宿主剪贴板(失败有可见提示)
* paste() → 读剪贴板文本(导入别人的分享用)
* insertImage(cover, name) → 把封面作为参考图节点插入画布
* notify(text, type) → 宿主 toast / 提示条
* putCover(dataUrl) → 封面入宿主图片库(返回 ref)
@@ -52,6 +53,7 @@
save: call('save'),
insert: call('insert'),
copy: call('copy'),
paste: call('paste'),
insertImage: call('insertImage'),
notify: call('notify'),
putCover: call('putCover'),
+49
View File
@@ -230,12 +230,61 @@
return { bytes: n, count: all.length }
}
// ---- 插件文件(plugin-data/<id>/files/,v3.26.59)----
// 为什么放在这层:备份/还原只认 IWBPluginData 一个入口。此前只备份 JSON,
// 于是「提示词封面」这类图片文件换机后全丢(标题栏说"已恢复",打开却是灰块)。
// 内存纪律:清单(id/name/size)一次性给出;字节**逐条读**(调用方写完即放手),
// 不做"全部读进数组再写包"——插件文件单插件上限 64MB,攒起来会 OOM。
function pluginFilesFacade () {
const F = global.IWBStorageFile
const pf = F && F.pluginFiles
return (pf && typeof pf.listAll === 'function') ? pf : null
}
async function listFiles () {
const pf = pluginFilesFacade()
if (!pf) return []
let groups = []
try { groups = await pf.listAll() } catch (e) { groups = [] }
const out = []
for (const g of (Array.isArray(groups) ? groups : [])) {
if (!g || !g.id) continue
for (const f of (g.files || [])) {
if (!f || !f.name) continue
out.push({ id: String(g.id), name: String(f.name), size: Number(f.size) || 0 })
}
}
return out
}
async function readFile (id, name) {
const pf = pluginFilesFacade()
if (!pf || typeof pf.readBytes !== 'function') return null
try { return await pf.readBytes(String(id), String(name)) } catch (e) { return null }
}
// list = [{ id, name, data: dataURL }],单条失败不影响其它
async function restoreFiles (list) {
const F = global.IWBStorageFile
const pf = F && F.pluginFiles
if (!pf || typeof pf.put !== 'function') return 0
let n = 0
for (const it of (Array.isArray(list) ? list : [])) {
if (!it || !it.id || !it.name || !it.data) continue
try {
const r = await pf.put(String(it.id), String(it.name), String(it.data))
if (r && r.ok) n++
} catch (e) { /* 单个失败不影响其它 */ }
}
return n
}
global.IWBPluginData = {
create: create,
stripLegacy: stripLegacy,
collectAll: collectAll,
restoreAll: restoreAll,
totalSize: totalSize,
listFiles: listFiles,
readFile: readFile,
restoreFiles: restoreFiles,
_bytesOf: bytesOf,
}
})(typeof window !== 'undefined' ? window : globalThis)
+31
View File
@@ -26,6 +26,9 @@
getAutoDownload() { return !!(state.impl && state.impl.getAutoDownload && state.impl.getAutoDownload()) },
setAutoDownload(on) { if (state.impl && state.impl.setAutoDownload) state.impl.setAutoDownload(on) },
openDataDir() { return state.impl ? state.impl.openDataDir() : Promise.reject(new Error('仅桌面端可用')) },
// 2026-11-24:插件要「打开本地图库目录」「读剪贴板导入分享」——都落在宿主桥里,app.js 只做装配。
openDataSubpath(rel) { return state.impl && state.impl.openDataSubpath ? state.impl.openDataSubpath(rel) : Promise.reject(new Error('仅桌面端可用')) },
clipboardReadText() { return state.impl && state.impl.clipboardReadText ? state.impl.clipboardReadText() : Promise.resolve('') },
// 原生剪贴板图片(v3.26):WKWebView 里 paste 事件拿不到 Finder 复制的图片,
// navigator.clipboard.write 也常不可用,统一走 Rust 侧 arboard。
clipboardReadImage() { return state.impl && state.impl.clipboardReadImage ? state.impl.clipboardReadImage() : Promise.resolve(null) },
@@ -37,5 +40,33 @@
uninstall(id) { return state.impl && state.impl.marketUninstall ? state.impl.marketUninstall(id) : Promise.resolve({ ok: false, error: '仅桌面端可用' }) },
},
}
// 2026-11-24:插件侧「打开资料目录子路径」「读剪贴板文本」两个小能力。
// 放在桥里而不是 app.js:一是 app.js 有行数棘轮,二是它们只依赖 __TAURI__。
const helpers = {
async openGalleryDir () {
try {
const T = (typeof window !== 'undefined') ? window.__TAURI__ : null
if (!T || !T.core || typeof T.core.invoke !== 'function') return { ok: false, error: '仅桌面端可打开本地目录' }
const p = await T.core.invoke('open_data_subpath', { rel: 'images/gallery' })
return { ok: true, path: p }
} catch (e) { return { ok: false, error: String((e && e.message) || e) } }
},
async clipboardReadText () {
try {
const T = (typeof window !== 'undefined') ? window.__TAURI__ : null
if (T && T.core && typeof T.core.invoke === 'function') {
const t = await T.core.invoke('clipboard_read_text')
if (t) return { ok: true, text: String(t) }
}
} catch (e) { /* 落到 navigator */ }
try {
const cb = navigator.clipboard
if (cb && typeof cb.readText === 'function') return { ok: true, text: String((await cb.readText()) || '') }
} catch (e) { return { ok: false, error: '浏览器拒绝了剪贴板读取' } }
return { ok: false, error: '剪贴板不可用' }
},
}
global.IWBDesktopHelpers = helpers
global.IWBDesktop = bridge
})(typeof window !== 'undefined' ? window : globalThis)
+2 -2
View File
@@ -7,8 +7,8 @@
const checksum = config.checksum
const payload = (data) => {
const copy = JSON.parse(JSON.stringify(data || {}))
delete copy.checksum
delete copy.imagesData
// 与 app.js 的 backupChecksumPayload 同口径:字节载荷(图片 / 插件文件)不进校验和
delete copy.checksum; delete copy.imagesData; delete copy.images; delete copy.pluginFiles; delete copy.pluginFilesData
return copy
}
return {
+114 -11
View File
@@ -656,6 +656,37 @@
return { ok: true, files: files, bytes: files.reduce((n, f) => n + (f.size || 0), 0), count: files.length }
} catch (e) { return { ok: false, files: [], bytes: 0, count: 0 } }
}
// 备份用(v3.26.59):读原始字节,ZIP 直接写字节 —— 不做 dataURL 往返,省掉 33% 的 base64 膨胀。
async function pluginFileReadBytes (id, name) {
try {
if (!pluginFileNameOk(name)) return null
const u8 = await fs().readFile(await join(await pluginFilesDir(id), name))
return (u8 && u8.length) ? u8 : null
} catch (e) { return null }
}
// 备份用:枚举「所有插件」的插件文件(plugin-data/<id>/files/)。
// 不调 pluginFilesDir(那个会 mkdir):没有 files 目录的插件直接跳过。
async function pluginFilesListAll () {
const out = []
let entries = []
try { entries = await fs().readDir(await pluginDataDir()) } catch (e) { return out }
for (const e of entries) {
if (!e || !e.isDirectory) continue
const id = String(e.name || '')
if (!/^[A-Za-z0-9][A-Za-z0-9._-]{1,63}$/.test(id)) continue
let fe = []
try { fe = await fs().readDir(await join(await pluginDataDir(), id, PFILE_DIR)) } catch (err) { continue }
const files = []
for (const f of fe) {
if (!f || f.isDirectory || !pluginFileNameOk(f.name)) continue
let size = 0
try { const u8 = await fs().readFile(await join(await pluginDataDir(), id, PFILE_DIR, f.name)); size = u8 ? u8.length : 0 } catch (err2) { size = 0 }
files.push({ name: f.name, size: size })
}
if (files.length) { files.sort((a, b) => a.name.localeCompare(b.name)); out.push({ id: id, files: files }) }
}
return out
}
async function loadInto() {
// data.json 不存在 ⇒ 把当前 WebView 里的数据迁过去(只做一次)
@@ -767,22 +798,36 @@
return new Promise((resolve) => {
try {
const mask = document.createElement('div')
mask.style.cssText = 'position:fixed;inset:0;z-index:2147483647;background:rgba(18,20,26,.72);display:flex;align-items:center;justify-content:center;font:14px/1.6 -apple-system,BlinkMacSystemFont,"PingFang SC",sans-serif'
// 这个弹窗在首启动、主题 CSS 可能尚未生效时就要显示,所以每个 var() 都带字面兜底:
// token 缺席时退化成本版改动前的样子(白底深字),而不是透明盒子。
mask.style.cssText = 'position:fixed;inset:0;z-index:var(--iwb-z-alert,4000);'
// 遮罩色是全仓唯一没有 token 的表面色(.iwb-modal-mask / .iwb-command-mask 也各写了一份 rgba)。
// 它既不是 bg 也不是 panel,硬凑会让亮色主题出现「浅色遮罩」。留给 RFC 决定 --iwb-scrim
// 的取值与消费者(现有 3 处),在此之前登记为例外,不让它悄悄变成永久的裸值。
+ 'background:rgba(18,20,26,.72) /*iwb:raw-until=3.28.0*/;'
+ 'display:flex;align-items:center;justify-content:center;'
+ 'font-family:-apple-system,BlinkMacSystemFont,"PingFang SC",sans-serif;'
+ 'font-size:var(--iwb-font-md,14px);line-height:1.6'
const box = document.createElement('div')
box.style.cssText = 'background:#fff;color:#111;border-radius:14px;padding:24px 26px;max-width:580px;box-shadow:0 24px 60px rgba(0,0,0,.35)'
box.style.cssText = 'background:var(--iwb-panel,#fff);color:var(--iwb-text,#111);'
+ 'border-radius:var(--iwb-radius-popover,14px);padding:var(--iwb-space-24,24px);'
+ 'max-width:580px;box-shadow:var(--iwb-elevation-4,0 24px 60px rgba(0,0,0,.35))'
const btn = (t, primary) => {
const b = document.createElement('button')
b.textContent = t
b.style.cssText = 'padding:8px 16px;border-radius:8px;font-size:13px;cursor:pointer;border:1px solid ' +
(primary ? '#2563eb' : '#d0d4dc') + ';background:' + (primary ? '#2563eb' : '#fff') + ';color:' + (primary ? '#fff' : '#111')
b.style.cssText = 'padding:var(--iwb-space-8,8px) var(--iwb-space-16,16px);'
+ 'border-radius:var(--iwb-radius-control,8px);font-size:var(--iwb-font-md,13px);cursor:pointer;'
+ 'border:1px solid ' + (primary ? 'var(--iwb-brand,#2563eb)' : 'var(--iwb-border,#d0d4dc)') + ';'
+ 'background:' + (primary ? 'var(--iwb-brand,#2563eb)' : 'var(--iwb-panel,#fff)') + ';'
+ 'color:' + (primary ? 'var(--iwb-on-brand,#fff)' : 'var(--iwb-text,#111)')
return b
}
box.innerHTML = '<div style="font-size:17px;font-weight:600;margin-bottom:10px">首次启动:选择资料目录</div>' +
'<div style="color:#333;margin-bottom:6px">设置、提示词、画布和所有图片都会存在这个目录里。</div>' +
'<div style="color:#333;margin-bottom:14px">换机器/重装时,把目录指到<b>旧的资料目录</b>就能直接继续用。</div>' +
'<div style="color:#666;font-size:12.5px;margin-bottom:18px">默认位置:' + defaultDir + '</div>'
box.innerHTML = '<div style="font-size:var(--iwb-font-xl,17px);font-weight:600;margin-bottom:var(--iwb-space-10,10px)">首次启动:选择资料目录</div>' +
'<div style="color:var(--iwb-text2,#333);margin-bottom:var(--iwb-space-6,6px)">设置、提示词、画布和所有图片都会存在这个目录里。</div>' +
'<div style="color:var(--iwb-text2,#333);margin-bottom:var(--iwb-space-12,14px)">换机器/重装时,把目录指到<b>旧的资料目录</b>就能直接继续用。</div>' +
'<div style="color:var(--iwb-text2,#666);font-size:var(--iwb-font-sm,12px);margin-bottom:var(--iwb-space-16,18px)">默认位置:' + defaultDir + '</div>'
const row = document.createElement('div')
row.style.cssText = 'display:flex;gap:10px;justify-content:flex-end'
row.style.cssText = 'display:flex;gap:var(--iwb-space-10,10px);justify-content:flex-end'
const bDefault = btn('用默认目录', true)
const bPick = btn('选择已有目录…', false)
const done = (v) => { try { mask.remove() } catch (e) { /* ignore */ } resolve(v) }
@@ -1242,11 +1287,69 @@
} catch (e) { return { ok: false, error: String((e && e.message) || e) } }
}
/* 删除指定 key 的图片字节(2026-11-24):图库删图时索引清了、文件却还在 images/gallery/ 里,
* 用户看到的「数据库里没删」就是这个。这里按登记表把文件移进 trash/(不直删,可找回),
* 同时删掉登记项;画布仍引用同一文件时不搬(同一图可能既被画布引用又被图库引用)。 */
async function deleteImageBytes(keys) {
try {
if (!enabled() || !dir) return { ok: false, error: '资料目录未就绪' }
const list = Array.isArray(keys) ? keys : []
if (!list.length) return { ok: true, moved: 0 }
const canvasKeys = new Set()
try {
const cd = await join(dir, 'canvases')
const ents = await fs().readDir(cd)
for (const e of ents) {
if (!e || e.isDirectory || !/\.json$/i.test(e.name) || e.name === 'active.json') continue
let txt = ''
try { txt = await fs().readTextFile(await join(cd, e.name)) } catch (err) { continue }
for (const hit of (txt.match(/"__blob"\s*:\s*"([^"]+)"/g) || [])) { const km = /"([^"]+)"$/.exec(hit); if (km) canvasKeys.add(km[1]) }
}
} catch (e) { /* 画布读不到:按「不引用」处理,仍移到 trash 而非直删 */ }
const keepFiles = new Set()
for (const k of canvasKeys) { const a = assets[k]; if (a && a.f) keepFiles.add(a.f) }
const trashAbs = await join(dir, 'trash')
let moved = 0
for (const key of list) {
const k = String(key)
const a = assets[k]
if (a && a.f) {
delete assets[k]
if (!keepFiles.has(a.f)) {
try {
const sub = String(a.f).split('/')[1] || ''
const targetDir = sub ? await join(trashAbs, sub) : trashAbs
await fs().mkdir(targetDir, { recursive: true })
await fs().rename(await join(dir, a.f), await join(targetDir, a.f.split('/').pop()))
moved++
} catch (e) { /* 单条失败忽略 */ }
}
}
if (Object.prototype.hasOwnProperty.call(small, k)) delete small[k]
}
schedule()
return { ok: true, moved: moved }
} catch (e) { return { ok: false, error: String((e && e.message) || e) } }
}
// 2026-11-24:按图库条目名删字节 —— app.js 只传 names + 索引,逻辑留在这里(app.js 行数棘轮)。
async function deleteGalleryBytesFor (names, index) {
const wanted = Array.isArray(names) ? names : []
if (!wanted.length) return { ok: true, moved: 0 }
const keys = []
for (const it of (Array.isArray(index) ? index : [])) {
if (!it || wanted.indexOf(it.name) < 0) continue
if (it.idb) keys.push(it.idb)
if (it.origIdb) keys.push(it.origIdb)
}
return deleteImageBytes(keys)
}
global.IWBStorageFile = {
enabled, ready: init, flush, runtime, pickDir, switchTo, migrateTo, gcImages, rotateTrash, galleryThumb, readDisplayThumb, readDisplayThumbUrl, writeDisplayThumb, writeDisplayThumbBlob, pruneThumbs, cleanupLegacy, maintain,
enabled, ready: init, flush, runtime, pickDir, switchTo, migrateTo, deleteImageBytes, deleteGalleryBytesFor, gcImages, rotateTrash, galleryThumb, readDisplayThumb, readDisplayThumbUrl, writeDisplayThumb, writeDisplayThumbBlob, pruneThumbs, cleanupLegacy, maintain,
plugins: { manifest: pluginManifest, read: pluginRead, write: pluginWrite, remove: pluginRemove, dir: pluginDir, listLocal: pluginListLocal, listDirs: pluginListDirs, readFile: pluginReadFile, writeFile: pluginWriteFile, writeBinary: pluginWriteBinary, mkdir: pluginMkdir, removeDir: pluginRemoveDir, renameDir: pluginRenameDir, existsDir: pluginExistsDir },
pluginData: { read: pluginDataRead, write: pluginDataWrite, remove: pluginDataRemove, list: pluginDataList },
pluginFiles: { put: pluginFilePut, get: pluginFileGet, list: pluginFileList, remove: pluginFileRemove, stat: pluginFileStat, dir: pluginFilesDir },
pluginFiles: { put: pluginFilePut, get: pluginFileGet, list: pluginFileList, remove: pluginFileRemove, stat: pluginFileStat, dir: pluginFilesDir, readBytes: pluginFileReadBytes, listAll: pluginFilesListAll },
storage: () => storage,
kv: () => kv,
dir: () => dir,
+6 -3
View File
@@ -174,9 +174,12 @@
const gridDot = mix(N, t, d ? 0.36 : 0.30)
// 语义色:色相固定,明度随主题调整(暗色提亮一档,避免发闷)
const err = d ? mix('#ef4444', '#ffffff', 0.18) : '#ef4444'
const ok = d ? mix('#22c55e', '#ffffff', 0.18) : '#22c55e'
const warn = d ? mix('#d97706', '#ffffff', 0.22) : '#d97706'
// 亮色状态色必须能**直接当文字色**(.iwb-status-ok / .iwb-ratio.ok / 插件状态标签都这么用)。
// 原先 #22c55e / #ef4444 / #d97706 对浅页面只有 2.1 / 3.5 / 3.0,M6 给 batch-export
// 接 token 时实测撞到;暗色仍用原来的亮色版本(对深页面本来就够)。
const err = d ? mix('#ef4444', '#ffffff', 0.18) : '#b91c1c'
const ok = d ? mix('#22c55e', '#ffffff', 0.18) : '#15803d'
const warn = d ? mix('#d97706', '#ffffff', 0.22) : '#b45309'
// 品牌色上的文字:按对比度自动选黑/白
const onBrand = contrast('#ffffff', brand) >= RATIO.onBrand ? '#ffffff' : '#1c2333'
+12 -10
View File
@@ -444,11 +444,9 @@
el('span', { className: 'iwb-appear-note' }, String(value.sizes[key]) + (unit || '')))
}
const Group = function (title, rows, note) {
return el('section', { className: 'iwb-appear-group' },
el('div', { className: 'iwb-appear-ghead' },
el('span', { className: 'iwb-appear-gtitle' }, title),
note ? el('span', { className: 'iwb-appear-gnote' }, note) : null),
rows)
return el('section', { className: 'iwb-gset-group' },
el('div', { className: 'iwb-gset-group-h' }, title),
el('div', { className: 'iwb-gset-group-body' }, rows))
}
const Seg = function (val, onChange, items) {
return el('div', { className: 'iwb-seg' }, (items || []).map((item) => el('button', {
@@ -530,11 +528,15 @@
]
return el('div', { className: 'iwb-appear' },
el('div', { className: 'iwb-appear-mode' },
Seg(theme, (v) => { setTheme(v); applyTheme(v) }, [
{ value: 'light', label: '亮色' }, { value: 'dark', label: '暗色' }, { value: 'system', label: '跟随系统' },
]),
el('span', { className: 'iwb-appear-modehint' }, '正在微调:' + (isDark ? '暗色' : '亮色'))),
Group('主题', [
el('div', { className: 'iwb-appear-row' },
el('span', { className: 'iwb-appear-label' }, '外观模式'),
el('div', { className: 'iwb-appear-ctrl' },
Seg(theme, (v) => { setTheme(v); applyTheme(v) }, [
{ value: 'light', label: '亮色' }, { value: 'dark', label: '暗色' }, { value: 'system', label: '跟随系统' },
])),
el('span', { className: 'iwb-appear-note' }, '正在微调:' + (isDark ? '暗色' : '亮色'))),
]),
Group('配色来源', [
el('div', { className: 'iwb-appear-row' },
+86 -18
View File
@@ -147,6 +147,18 @@ function BackupModal(props) {
for (const f of (Array.isArray(outputItems) ? outputItems : [])) sum += Number(f && f.size) || 0
return sum
}
// ---- 插件文件(plugin-data/<id>/files/,v3.26.59)----
// 只收清单,写包时逐条读字节(与图片同一套内存纪律:写一张放一张,不攒数组)。
const pdata = () => ((typeof window !== 'undefined') ? window.IWBPluginData : null)
const collectPluginFiles = async () => {
try { const pd = pdata(); if (pd && typeof pd.listFiles === 'function') return await pd.listFiles() } catch (e) { /* 清单失败不影响主备份 */ }
return []
}
const readPluginFileBytes = async (f) => {
try { const pd = pdata(); const b = (pd && typeof pd.readFile === 'function') ? await pd.readFile(f.id, f.name) : null; return (b && b.length) ? b : null } catch (e) { return null }
}
const mimeOfPluginFile = (name) => /\.png$/i.test(name) ? 'image/png' : (/\.webp$/i.test(name) ? 'image/webp' : 'image/jpeg')
const bytesToBase64 = (u8) => { let s = ''; for (let i = 0; i < u8.length; i += 0x8000) s += String.fromCharCode.apply(null, u8.subarray(i, i + 0x8000)); return btoa(s) }
const doBackup = async () => {
setBkBusy(true); setBkMsg(null)
try {
@@ -177,25 +189,30 @@ function BackupModal(props) {
const refMeta = await collectBackupImages()
const galleryMeta = (bk.outputs && items.outputs) ? (await collectBackupOutputImages(items.outputs)) : []
const imgMeta = refMeta.concat(galleryMeta.map((im) => ({ key: im.key, name: im.name })))
// 插件文件(如提示词封面):跟 items.pluginData 同进退,不单独设勾选项
const pluginFileMeta = await collectPluginFiles()
const pluginFileBytes = pluginFileMeta.reduce((n, f) => n + (Number(f && f.size) || 0), 0)
// 导出前体积预估 + 二次确认:几百 MB 的图库导出会持续拉高内存,先让用户确认
if (imgMeta.length) {
const estMB = estimateBackupBytes(items.outputs) / 1048576
const needConfirm = estMB >= 20 || imgMeta.length >= 20
if (imgMeta.length || pluginFileMeta.length) {
const estMB = (estimateBackupBytes(items.outputs) + pluginFileBytes) / 1048576
const needConfirm = estMB >= 20 || (imgMeta.length + pluginFileMeta.length) >= 20
const sizeText = estMB >= 1 ? ('约 ' + estMB.toFixed(0) + ' MB') : '未记录(按张数估算偏大)'
const countText = imgMeta.length + ' 张图片' + (pluginFileMeta.length ? '(另含 ' + pluginFileMeta.length + ' 个插件文件)' : '')
if (needConfirm && typeof window !== 'undefined' && typeof window.confirm === 'function') {
const okGo = await askConfirm('本次备份包含 ' + imgMeta.length + ' 张图片,预计体积 ' + sizeText + '。\n导出期间内存占用会明显上升,图库很大时页面会变慢。\n确定继续导出吗?', { title: '导出备份', okText: '继续导出' })
const okGo = await askConfirm('本次备份包含 ' + countText + ',预计体积 ' + sizeText + '。\n导出期间内存占用会明显上升,图库很大时页面会变慢。\n确定继续导出吗?', { title: '导出备份', okText: '继续导出' })
if (!okGo) {
setBkMsg({ type: 'err', text: '已取消导出(' + imgMeta.length + ' 张图片 / ' + sizeText + ')' })
setBkMsg({ type: 'err', text: '已取消导出(' + countText + ' / ' + sizeText + ')' })
return
}
}
}
const core = { app: 'image-workbench', kind: 'backup', backupVersion: 3, schemaVersion: SchemaVersions.backup, at: Date.now(), items, images: imgMeta }
const core = { app: 'image-workbench', kind: 'backup', backupVersion: 3, schemaVersion: SchemaVersions.backup, at: Date.now(), items, images: imgMeta, pluginFiles: pluginFileMeta }
const exported = ModularBackupStore ? await ModularBackupStore.export(items, { extra: { images: imgMeta, at: core.at } }) : null
const checksum = await wSha256(JSON.stringify(backupChecksumPayload(core)))
const manifest = exported && exported.ok ? Object.assign({}, exported.value, { images: imgMeta }) : Object.assign({}, core, { checksum })
const manifest = exported && exported.ok ? Object.assign({}, exported.value, { images: imgMeta, pluginFiles: pluginFileMeta }) : Object.assign({}, core, { checksum })
const ts = new Date().toISOString().slice(0, 10)
let exportedImages = 0
let exportedPluginFiles = 0
// 主路径:原生 ZIP 写入器(STORE)——逐张读 → 立即以 Blob 写包 → 立即释放,堆里同时只有一张图
let zipBlob = null
try {
@@ -208,11 +225,19 @@ function BackupModal(props) {
exportedImages++
await new Promise((r) => setTimeout(r, 0)) // 让出事件循环,给 GC 回收上一张的 base64 字符串
}
// 插件文件:plugin-files/<插件id>/<文件名>,写原始字节(不做 base64 往返)
for (const pf of pluginFileMeta) {
const bytes = await readPluginFileBytes(pf)
if (!bytes) continue
await zw.add('plugin-files/' + pf.id + '/' + pf.name, new Blob([bytes]))
exportedPluginFiles++
await new Promise((r) => setTimeout(r, 0))
}
zipBlob = zw.finish()
} catch (e) { zipBlob = null; exportedImages = 0 }
} catch (e) { zipBlob = null; exportedImages = 0; exportedPluginFiles = 0 }
if (zipBlob) {
wDownloadBlob(zipBlob, 'image-workbench-backup-' + ts + '.zip')
setBkMsg({ type: 'ok', text: '✓ 已导出 ZIP 备份(' + Object.keys(items).join(' / ') + ' + ' + exportedImages + ' 张图片),含校验和,恢复时可校验' })
setBkMsg({ type: 'ok', text: '✓ 已导出 ZIP 备份(' + Object.keys(items).join(' / ') + ' + ' + exportedImages + ' 张图片' + (exportedPluginFiles ? ' + ' + exportedPluginFiles + ' 个插件文件' : '') + '),含校验和,恢复时可校验' })
} else {
// 兜底:原生写入器失败 → JSON 内嵌图片 base64。整包字符串无法避免,仅作兜底。
// (原来这里还有一条「CDN 加载 JSZip 写 ZIP」的兜底:线上 CSP script-src 'self' 会直接拦死该 script,
@@ -228,13 +253,22 @@ function BackupModal(props) {
if (data) imagesData.push({ key: im.key, name: im.name, data })
}
exportedImages = imagesData.length
const m2 = Object.assign({}, manifest, { imagesData })
const pluginFilesData = []
for (const pf of pluginFileMeta) {
const bytes = await readPluginFileBytes(pf)
if (!bytes) continue
pluginFilesData.push({ id: pf.id, name: pf.name, data: 'data:' + mimeOfPluginFile(pf.name) + ';base64,' + bytesToBase64(bytes) })
}
exportedPluginFiles = pluginFilesData.length
const m2 = Object.assign({}, manifest, { imagesData, pluginFilesData })
delete m2.images
// 插件文件/图片的键都进 payload 的排除项(见 backupChecksumPayload),这里重算才能自洽
m2.checksum = await wSha256(JSON.stringify(backupChecksumPayload(m2)))
const blob = new Blob([JSON.stringify(m2)], { type: 'application/json' })
wDownloadBlob(blob, 'image-workbench-backup-' + ts + '.json')
setBkMsg({ type: 'ok', text: '✓ 已导出备份(JSON 内嵌 ' + exportedImages + ' 张图片;联网时导出 ZIP 更小更稳)' })
setBkMsg({ type: 'ok', text: '✓ 已导出备份(JSON 内嵌 ' + exportedImages + ' 张图片' + (exportedPluginFiles ? ' + ' + exportedPluginFiles + ' 个插件文件' : '') + ';可联网时导出 ZIP 更小更稳)' })
}
wLog('backup', '导出备份:' + Object.keys(items).join('/') + ' + 图片 ' + exportedImages)
wLog('backup', '导出备份:' + Object.keys(items).join('/') + ' + 图片 ' + exportedImages + ' + 插件文件 ' + exportedPluginFiles)
// 记录"上次导出"时间(2026-11-07):自动备份与数据同在浏览器里,导出磁盘才是异地保险
try { const stx = _lstore(); if (stx) stx.rawSet('iwb_backup_last_export_at', String(Date.now())) } catch (e) { /* ignore */ }
@@ -264,7 +298,7 @@ function BackupModal(props) {
}
return { providers: ps.length, models, plainKeys, keepKeys, llmProviders: llmPs.length }
}
const acceptRestoreData = async (data, images) => {
const acceptRestoreData = async (data, images, pluginFiles) => {
if (!data || data.kind !== 'backup' || !data.items || typeof data.items !== 'object' || Array.isArray(data.items)) throw new Error('不是本工具的备份文件')
if (data.checksum) {
const h = await wSha256(JSON.stringify(backupChecksumPayload(data)))
@@ -283,6 +317,11 @@ function BackupModal(props) {
})
nd.images = zipImages
if (!nd.images.length && Array.isArray(nd.imagesData)) nd.images = nd.imagesData.map((x) => ({ key: x.key, name: x.name, data: x.data }))
// 插件文件:ZIP 里直接拿到 dataURL;JSON 兜底看 pluginFilesData
const pfs = Array.isArray(pluginFiles) && pluginFiles.length
? pluginFiles
: (Array.isArray(nd.pluginFilesData) ? nd.pluginFilesData.map((x) => ({ id: x.id, name: x.name, data: x.data })) : [])
nd.pluginFiles = pfs.filter((x) => x && x.id && x.name && x.data)
setRestoreData(nd)
// 摘要:让"备份里有没有设置/密钥"一眼可见
const cs = cfgSummary(nd.items.config)
@@ -291,6 +330,7 @@ function BackupModal(props) {
prompts: (nd.items.prompts && (nd.items.prompts.prompts || []).length) || 0,
workspaces: (nd.items.workspaces && (nd.items.workspaces.workspaces || []).length) || 0,
groups: (nd.items.nodeGroups && (nd.items.nodeGroups.groups || []).length) || 0,
pluginFiles: nd.pluginFiles.length,
})
setRestoreSel({ config: !!nd.items.config, prompts: !!nd.items.prompts, nodeGroups: !!nd.items.nodeGroups, workspaces: !!nd.items.workspaces, outputs: !!nd.items.outputs })
setRstMsg(data.__checksumMismatch ? { type: 'err', text: '⚠︎ 校验和与文件内容不一致(可能是旧版备份格式),文件仍已解析;请确认备份完整后再恢复' } : null)
@@ -306,13 +346,23 @@ function BackupModal(props) {
if (!jf) throw new Error('ZIP 中缺少 iwb-backup.json(不是本工具的备份)')
const data = JSON.parse(await jf.async('string'))
const images = []
const pluginFiles = []
for (const p of Object.keys(z.files)) {
if (p.indexOf('images/') === 0) {
const b64 = await z.files[p].async('base64')
images.push({ key: null, name: p.slice(7), data: 'data:image/png;base64,' + b64 })
} else if (p.indexOf('plugin-files/') === 0) {
const rest = p.slice('plugin-files/'.length)
const cut = rest.indexOf('/')
if (cut <= 0) continue
const pid = rest.slice(0, cut)
const name = rest.slice(cut + 1)
if (!name || name.indexOf('/') >= 0) continue
const b64 = await z.files[p].async('base64')
pluginFiles.push({ id: pid, name: name, data: 'data:' + mimeOfPluginFile(name) + ';base64,' + b64 })
}
}
await acceptRestoreData(data, images)
await acceptRestoreData(data, images, pluginFiles)
} catch (e) {
setRstMsg({ type: 'err', text: 'ZIP 备份解析失败:' + String((e && e.message) || e) })
}
@@ -374,6 +424,15 @@ function BackupModal(props) {
if (items.pluginData && items.pluginData.length) {
try { const pd = (typeof window !== 'undefined') ? window.IWBPluginData : null; if (pd && pd.restoreAll) await pd.restoreAll(items.pluginData) } catch (e) { /* 插件数据还原失败不阻塞其它项 */ }
}
// 插件文件(提示词封面等):与 pluginData 同进退 —— 只恢复 JSON 却丢图,等于「提示词都在、封面全丢」
let pluginFileOk = 0
const pluginFileList = Array.isArray(restoreData.pluginFiles) ? restoreData.pluginFiles : []
if (pluginFileList.length) {
try {
const pd = (typeof window !== 'undefined') ? window.IWBPluginData : null
if (pd && pd.restoreFiles) pluginFileOk = await pd.restoreFiles(pluginFileList)
} catch (e) { /* 插件文件还原失败不阻塞其它项 */ }
}
if (restoreSel.outputs && items.outputs) {
if (restoreMerge) {
const cur = await api('outputs').catch(() => ({ files: [] }))
@@ -394,8 +453,14 @@ function BackupModal(props) {
const imgs = (restoreData.images || []).concat(Array.isArray(restoreData.imagesData) ? restoreData.imagesData.map((x) => ({ key: x.key, data: x.data })) : [])
let imgOk = 0
const imgBad = []
const restoreGallery = !!restoreSel.outputs
const restoreRefs = !!(restoreSel.nodeGroups || restoreSel.workspaces)
for (const im of imgs) {
if (!im.key || !im.data) continue
// 只恢复与所选项目相关的图片:未选图库时跳过 gallery_*(避免写回孤儿字节),
// 只恢复设置/提示词时也不写任何图片。
if (!restoreGallery && String(im.name || '').indexOf('gallery_') === 0) continue
if (!restoreGallery && !restoreRefs) continue
try {
// C3:Blob 仓库的键必须写 Blob(备份里是 dataURL/字节)——否则 image-blob-store 读出来不是 Blob
let val = im.data
@@ -407,7 +472,7 @@ function BackupModal(props) {
if (await IDB.put(im.key, val)) imgOk++; else imgBad.push(im.key)
} catch (e) { imgBad.push(im.key) }
}
wLog('restore', '恢复(' + (restoreMerge ? '合并' : '覆盖') + '):' + want.join('/') + ' + 图片 ' + imgOk + (imgBad.length ? ',失败 ' + imgBad.length : ''))
wLog('restore', '恢复(' + (restoreMerge ? '合并' : '覆盖') + '):' + want.join('/') + ' + 图片 ' + imgOk + (imgBad.length ? ',失败 ' + imgBad.length : '') + ' + 插件文件 ' + pluginFileOk)
// __KEEP__ 边界(v3.0.5):备份里标记"保留本机原值"的密钥字段,本机没有对应值 ⇒ **可见提示**,
// 绝不静默留空。用阻塞式确认 + 状态行双重提示,并写进诊断日志;确认后才刷新页面。
const keepMiss = cfgMissingKeep || []
@@ -421,7 +486,7 @@ function BackupModal(props) {
}
setRstMsg({
type: (imgBad.length || keepWarn) ? 'err' : 'ok',
text: (imgBad.length ? '⚠︎ ' : '✓ ') + '已恢复所选数据' + (imgOk ? '(含 ' + imgOk + ' 张图片' + (imgBad.length ? ',' + imgBad.length + ' 张写入失败:' + imgBad.slice(0, 3).join(', ') + '…' : '') + ')' : '') + (imgBad.length ? ';图片可能显示为“已丢失”,可重新导入' : '') + (keepWarn ? ' ' + keepWarn : '') + restoreVerify + ',即将刷新页面',
text: (imgBad.length ? '⚠︎ ' : '✓ ') + '已恢复所选数据' + (imgOk || pluginFileOk ? '(含 ' + imgOk + ' 张图片' + (pluginFileOk ? ' + ' + pluginFileOk + ' 个插件文件' : '') + (imgBad.length ? ',' + imgBad.length + ' 张写入失败:' + imgBad.slice(0, 3).join(', ') + '…' : '') + ')' : '') + (imgBad.length ? ';图片可能显示为“已丢失”,可重新导入' : '') + (keepWarn ? ' ' + keepWarn : '') + restoreVerify + ',即将刷新页面',
})
setTimeout(() => { try { location.reload() } catch (e) { /* ignore */ } }, keepWarn ? 3000 : 900)
} catch (e) {
@@ -454,7 +519,7 @@ function BackupModal(props) {
el('div', { className: 'iwb-backup-sec-title' }, '① 备份(导出所选数据)'),
el('label', { className: 'iwb-backup-item iwb-backup-all' },
el('input', { type: 'checkbox', checked: bkAll, onChange: (e) => setBkAll(e.target.checked) }, null),
el('span', { className: 'iwb-backup-item-name' }, '全部数据'),
el('span', { className: 'iwb-backup-item-name' }, '全部基础数据'),
el('span', { className: 'iwb-backup-item-count' }, bkAll ? '已全选' : '全选'),
),
bkCheck('prompts', '提示词库(含分组)', counts.prompts + ' 条'),
@@ -501,6 +566,9 @@ function BackupModal(props) {
restoreMerge && restoreSel && restoreSel.config ? el('div', { className: 'iwb-status-err' },
'⚠ 已勾选「合并导入」:合并模式**不会覆盖设置**(含密钥)。要恢复设置请取消合并') : null,
restoreData.images && restoreData.images.length ? el('div', { className: 'iwb-backup-item-count' }, '含 ' + restoreData.images.length + ' 张图片') : null,
// v3.26.59:插件文件(提示词封面等)单独列出 —— 否则用户以为"提示词库已回来",
// 打开却是灰块(JSON 有、图片字节没有)。
restoreData.pluginFiles && restoreData.pluginFiles.length ? el('div', { className: 'iwb-backup-item-count' }, '含 ' + restoreData.pluginFiles.length + ' 个插件文件(封面等)') : null,
el('label', { className: 'iwb-backup-item', title: '追加去重,不覆盖已有数据(设置项不导入)' },
el('input', { type: 'checkbox', checked: restoreMerge, onChange: (e) => setRestoreMerge(e.target.checked) }, null),
el('span', { className: 'iwb-backup-item-name' }, '合并导入(追加去重)'),
@@ -514,7 +582,7 @@ function BackupModal(props) {
rstMsg ? el('div', { className: 'iwb-status-' + (rstMsg.type === 'err' ? 'err' : 'ok') }, rstMsg.text) : null,
),
el('div', { className: 'iwb-backup-note' },
'提示:若需连同出图一起备份,请勾选「图库(含缩略图+原图)」(默认不勾选,避免备份体积随出图历史膨胀);画布工作台备份仍只带参考图,生成结果不入画布数据。备份为 ZIP/JSON 文件,请自行妥善保管。',
'提示:若需连同出图一起备份,请勾选「图库(含缩略图+原图)」(默认不勾选,避免备份体积随出图历史膨胀);画布工作台备份仍只带参考图,生成结果不入画布数据。插件数据与插件文件(如提示词封面)随备份自动包含。备份为 ZIP/JSON 文件,请自行妥善保管。',
),
),
)
+4 -3
View File
@@ -26,9 +26,10 @@
const p = props || {}
const stop = (e) => e.stopPropagation()
const panelRef = useRef(null)
const [pos, setPos] = useState({ x: 40, y: 40 })
const [pos, setPos] = useState(null) // null = 未定位:先隐藏,避免首帧在左上角闪一下
const useLayoutEffect = React.useLayoutEffect || useEffect
useEffect(() => {
useLayoutEffect(() => { // 绘制前定位
if (!p.anchor) return undefined
const place = () => {
if (typeof p.placePanel !== 'function') return
@@ -117,7 +118,7 @@
// 缺了它面板会落在文档流里(位置 0,0 且被应用层盖住、点不动)。
const body = el('div', {
className: 'iwb-pop-anchor',
style: { left: pos.x + 'px', top: pos.y + 'px' },
style: { left: (pos ? pos.x : 0) + 'px', top: (pos ? pos.y : 0) + 'px', visibility: pos ? 'visible' : 'hidden' },
onPointerDown: stop,
onWheel: (e) => e.stopPropagation(),
},
+78 -27
View File
@@ -72,6 +72,71 @@
return true
}
// 生图服务:多服务商单栏切换的选中态与新增/设默认逻辑(抽到组件外,避免 SettingsModal 行数棘轮)
function useProviderSelection (setDraft, uid) {
const [provSel, setProvSel] = React.useState('')
const addProvider = () => {
const id = uid('p')
setDraft((d) => ({ ...d, providers: (d.providers || []).concat([{
id, name: '新服务', baseUrl: '', fallbacks: [], genPath: '/images/generations', editPath: '/images/edits',
keys: [{ id: uid('k'), name: 'Key 分组', source: 'literal', value: '' }], models: [], layerModels: [],
}]) }))
setProvSel(id)
}
// 默认项由数组顺序决定:设为默认 = 移到第一位(与地址「设默认」同一语义)
const makeProviderDefault = (pi) => setDraft((d) => {
const list = (d.providers || []).slice()
if (pi <= 0 || pi >= list.length) return d
const item = list.splice(pi, 1)[0]
return { ...d, providers: [item].concat(list) }
})
return { provSel, setProvSel, addProvider, makeProviderDefault }
}
// 设置窗口右下角缩放手柄(WKWebView 对 CSS resize 手柄支持不一致,用 pointer 事件兜底)
function attachSettingsResize (e) {
e.preventDefault(); e.stopPropagation()
const modal = e.currentTarget.closest('.iwb-settings-modal')
if (!modal) return
const r = modal.getBoundingClientRect()
const sx = e.clientX; const sy = e.clientY; const sw = r.width; const sh = r.height
const move = (ev) => {
modal.style.width = Math.max(760, Math.min(sw + ev.clientX - sx, window.innerWidth - 40)) + 'px'
modal.style.height = Math.max(480, Math.min(sh + ev.clientY - sy, window.innerHeight - 40)) + 'px'
}
const up = () => { window.removeEventListener('pointermove', move); window.removeEventListener('pointerup', up) }
window.addEventListener('pointermove', move); window.addEventListener('pointerup', up)
}
// 图片与图库分组(从 SettingsModal 抽出,避免组件行数棘轮)
function makeImageLibSection (draft, setDraft, backfillOutputOriginals) {
return el('div', null,
el('div', { className: 'iwb-gset-row' },
el('div', { className: 'iwb-gset-row-label' }, '原图'),
el('div', { className: 'iwb-gset-row-ctl' },
el('label', { className: 'iwb-check' },
el('input', { type: 'checkbox', checked: draft.canvas.backupOriginals === true, onChange: (e) => setDraft((d) => ({ ...d, canvas: { ...d.canvas, backupOriginals: e.target.checked } })) }, null),
' 入库时同时保留原图',
),
),
),
el('div', { className: 'iwb-gset-hint' }, '不保留则只存缩略图,导出时可能只剩远程链接;桌面端取原图走原生 HTTP,不受图床跨域限制。'),
el('div', { className: 'iwb-gset-row' },
el('div', { className: 'iwb-gset-row-label' }, '补存'),
el('div', { className: 'iwb-gset-row-ctl' },
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: backfillOutputOriginals }, '补存缺失的原图'),
),
),
)
}
// 设置分组(与 sections 里的 GSetGroup 同一套类名)
function SetGroup (props) {
return el('div', { className: 'iwb-gset-group' },
el('div', { className: 'iwb-gset-group-h' }, props.title),
el('div', { className: 'iwb-gset-group-body' }, props.children))
}
function SettingsModal(props) {
const [tab, setTab] = useState(props.initialTab || 'gen')
// 诊断页「刷新」:重读崩溃记录后需要一个自增值触发重渲染。
@@ -102,6 +167,7 @@ function SettingsModal(props) {
const [msg, setMsg] = useState(null)
const [folderMsg, setFolderMsg] = useState('未选择文件夹(生成图片仍保存到浏览器图库)')
const [speed, setSpeed] = useState(null)
const { provSel, setProvSel, addProvider, makeProviderDefault } = useProviderSelection(setDraft, uid)
const [modelInput, setModelInput] = useState({})
const [layerModelInput, setLayerModelInput] = useState({})
const [llmWarn, setLlmWarn] = useState('')
@@ -147,12 +213,6 @@ function SettingsModal(props) {
return { ...d, providers }
})
}
const addProvider = () => {
setDraft((d) => ({ ...d, providers: (d.providers || []).concat([{
id: uid('p'), name: '新服务', baseUrl: '', fallbacks: [], genPath: '/images/generations', editPath: '/images/edits',
keys: [{ id: uid('k'), name: 'Key 分组', source: 'literal', value: '' }], models: [], layerModels: [],
}]) }))
}
const addKey = (pi) => {
setKey(pi, (draft.providers[pi].keys || []).length, { id: uid('k'), name: 'Key 分组', source: 'literal', value: '' })
}
@@ -416,25 +476,14 @@ function SettingsModal(props) {
} catch (e) { setFolderMsg('补存失败:' + String((e && e.message) || e)) }
}
// 「图片与图库」:并入「通用」页;定时清理已去掉(桌面端不需要按天数自动删图)
const imageLibSection = el('div', null,
el('label', { className: 'iwb-check' },
el('input', { type: 'checkbox', checked: draft.canvas.backupOriginals === true, onChange: (e) => setDraft((d) => ({ ...d, canvas: { ...d.canvas, backupOriginals: e.target.checked } })) }, null),
' 入库时同时保留原图(否则只存缩略图,导出时可能只剩远程链接)'),
el('div', { className: 'iwb-hint' }, isDesk()
? '桌面端取原图走原生 HTTP,不受图床跨域限制;只有图床需要登录、链接过期或图片被删除时才拿不到原图。'
: '远程图床若不允许跨域读取(CORS),则无法本地抓取,仍只用其链接兜底展示。'),
el('div', { className: 'iwb-row' },
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: backfillOutputOriginals }, '补存缺失的原图'),
),
)
const imageLibSection = makeImageLibSection(draft, setDraft, backfillOutputOriginals)
// ---- 生图服务 provider 卡片 ----
const provCards = Sections ? Sections.renderProvCards({
DEFAULT_SHAPE_TPL, I, W_SHAPE_KINDS, addAddr, addKey, addLayerModel, addModel, api, delAddr, delKey, delLayerModel, delModel, delProv, draft, layerModelInput, modelInput, modelSupportsQuality, setAddr, setDefault, setKey, setLayerModelInput, setModelInput, setModelKind, setModelQuality, setProv, setShapeText, shapeText, speed, speedTest, toggleLayerModel, toggleModel, wNormalizeLayerModels, wPrivateToolsOn,
DEFAULT_SHAPE_TPL, I, W_SHAPE_KINDS, addAddr, addKey, addLayerModel, addModel, addProvider, api, delAddr, delKey, delLayerModel, delModel, delProv, draft, layerModelInput, makeProviderDefault, modelInput, modelSupportsQuality, provSel, setAddr, setDefault, setKey, setLayerModelInput, setModelInput, setModelKind, setModelQuality, setProv, setProvSel, setShapeText, shapeText, speed, speedTest, toggleLayerModel, toggleModel, wNormalizeLayerModels, wPrivateToolsOn,
}) : null
const genTab = el('div', null,
el('div', { className: 'iwb-hint' }, '支持任意 OpenAI 兼容接口(/v1/images/generations 与 /v1/images/edits)。Key 保存在服务端 data/config.json(本地文件)。'),
provCards,
el('button', { className: 'iwb-btn', onClick: addProvider }, '+ 添加服务'),
)
const llmTab = Sections ? Sections.renderLlmTab({
addLlmAddr, addLlmKey, addLlmModel, addLlmProvider, api, delLlmAddr, delLlmKey, delLlmModel, delLlmProvider, draft, llmAddrInput, llmAddrRes, llmAddrTesting, llmKeyInput, llmModelInput, llmTestMsg, llmTestSel, llmTesting, llmWarn, msg, setLlm, setLlmAddr, setLlmAddrDefault, setLlmAddrInput, setLlmDefaultModel, setLlmKey, setLlmKeyInput, setLlmModelInput, setLlmProv, setLlmTestSel, testLlm, testLlmAddrs,
@@ -445,7 +494,6 @@ function SettingsModal(props) {
const A = (typeof window !== 'undefined') ? window.IWBUIApearance : null
if (!A || !A.AppearanceTab) return el('div', { className: 'iwb-hint' }, '外观模块未就绪(请刷新页面)')
return el('div', { className: 'iwb-section' },
el('div', { className: 'iwb-section-title' }, '外观'),
el(A.AppearanceTab, { draft, setDraft, theme, setTheme, applyTheme }),
)
})()
@@ -550,13 +598,15 @@ function SettingsModal(props) {
const autoBackupSection = Sections ? Sections.renderAutoBackupSection({
ab, fmtAgo, props,
}) : el('div', { className: 'iwb-hint' }, 'autoBackupSection 未就绪(请刷新页面)')
const backupTab = el('div', { className: 'iwb-section' },
el('div', { className: 'iwb-backup-inline-hint' }, '备份会导出所选数据;还原会覆盖当前数据并自动刷新页面。'),
BackupModalComp
? el(BackupModalComp, { embedded: true, onClose: props.onClose, onSaveNow: props.onSaveNow })
: el('div', { className: 'iwb-hint' }, '备份组件未就绪(请刷新页面)'),
// 桌面版没有这套「localStorage 快照」:真实数据在资料目录,快照价值近零 ⇒ 只在网页版显示
isDesk() ? null : autoBackupSection,
const backupTab = el('div', { className: 'iwb-gset-page' },
el(SetGroup, { title: '备份与还原' },
el('div', { className: 'iwb-gset-hint' }, '备份会导出所选数据;还原会覆盖当前数据并自动刷新页面。'),
BackupModalComp
? el(BackupModalComp, { embedded: true, onClose: props.onClose, onSaveNow: props.onSaveNow })
: el('div', { className: 'iwb-hint' }, '备份组件未就绪(请刷新页面)'),
// 桌面版没有这套「localStorage 快照」:真实数据在资料目录,快照价值近零 ⇒ 只在网页版显示
isDesk() ? null : autoBackupSection,
),
)
// 可拖动窗口 + 外观实时预览(实现见 src/ui-modal-drag.js)
@@ -592,6 +642,7 @@ function SettingsModal(props) {
el('div', { className: 'iwb-modal-foot' },
el('button', { className: 'iwb-btn iwb-btn-primary', disabled: saving, onClick: () => { try { if (appearanceKit) appearanceKit.markSaved() } catch (e) { /* ignore */ } ; if (save) save() } }, saving ? '保存中…' : '保存配置'),
),
el('div', { className: 'iwb-settings-resize', title: '拖动调整窗口大小', onPointerDown: attachSettingsResize }),
),
)
}
+263 -161
View File
@@ -163,6 +163,25 @@
if (kind === 'install') setRestart(true)
} finally { setBusy('') }
}
// 全部更新:按已安装清单逐个安装市场里的可更新版本;逐个失败不阻断其余
const updateAll = async function () {
if (!D || !D.market) return
const ids = Object.keys(inst).filter(function (id) {
const m = findM(id); const iv = inst[id] && inst[id].version
return !!(m.version && iv && cmpV(m.version, iv) > 0)
})
if (!ids.length) { setMsg('没有可更新的插件'); return }
setBusy('__updateall__')
let ok = 0; const fail = []
for (const id of ids) {
try { const r = await D.market.install(id); if (r && r.ok) ok++; else fail.push(id) } catch (e) { fail.push(id) }
}
setBusy('')
await refresh()
if (ok) setRestart(true)
setMsg('已更新 ' + ok + '/' + ids.length + ' 个插件' + (fail.length ? (';失败:' + fail.join('、')) : '') + (ok ? ',重启应用后生效' : ''))
}
// 用 src 模块加载脚本(不引 app.js 全局),成功后再写启用状态
const loadRuntimePlugin = async function (id) {
const rec = (wRuntimePlugins || []).find(function (r) { return r && r.id === id })
@@ -234,8 +253,8 @@
// ── 管理页:横向列表(名称/版本/作者 + 描述 + 操作 + 开关),像 Obsidian「第三方插件」 ──
const manageView = function () {
return el('div', { className: 'iwb-set-page' },
el('div', { className: 'iwb-set-page-title' }, '插件'),
return el('div', { className: 'iwb-gset-page' },
el('div', { className: 'iwb-gset-page-title' }, '插件'),
el('div', { className: 'iwb-mk-setrow' },
el('div', { className: 'iwb-mk-setrow-main' },
el('div', { className: 'iwb-mk-setrow-title' }, '插件市场'),
@@ -249,6 +268,7 @@
el('div', { className: 'iwb-hint' }, (installedRows.length ? ('你目前已经安装了 ' + installedRows.length + ' 个插件') : '还没有安装插件') + (updatable ? (',其中 ' + updatable + ' 个可更新') : '')),
),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: refresh }, '检查更新'),
updatable ? el('button', { className: 'iwb-btn iwb-btn-sm iwb-btn-primary', disabled: !!busy, title: '更新全部可更新的插件', onClick: function () { updateAll() } }, busy === '__updateall__' ? '更新中…' : '全部更新') : null,
),
el('div', { className: 'iwb-mk-setrow' },
el('div', { className: 'iwb-mk-setrow-main' },
@@ -359,8 +379,8 @@
// ── 市场页:卡片墙 + 安装(与 market.maqiart.eu.org 同一套数据/视觉)──
const marketView = function () {
return el('div', { className: 'iwb-set-page' },
el('div', { className: 'iwb-set-page-title' },
return el('div', { className: 'iwb-gset-page' },
el('div', { className: 'iwb-gset-page-title' },
el('button', { className: 'iwb-btn iwb-btn-sm', style: { marginRight: 10 }, onClick: function () { setView('manage') } }, '返回'),
'插件市场',
),
@@ -440,8 +460,8 @@
const remoteIdle = wRuntimePlugins.filter((r) => !pluginItems.some((p) => p.id === r.id) && r.status === 'idle')
const remoteFailed = wRuntimePlugins.filter((r) => !pluginItems.some((p) => p.id === r.id) && r.status !== 'idle')
if (!pluginItems.length && !remoteIdle.length && !remoteFailed.length) return el('div', { className: 'iwb-hint' }, '暂无已注册插件。插件随应用一起发布,启用后其面板 / 命令 / 节点类型才会出现。')
return el('div', { className: 'iwb-set-page' },
el('div', { className: 'iwb-set-page-title' }, '插件管理'),
return el('div', { className: 'iwb-gset-page' },
el('div', { className: 'iwb-gset-page-title' }, '插件管理'),
isDesk() && (() => {
const F = (typeof window !== 'undefined') ? window.IWBStorageFile : null
const extCount = (wRuntimePlugins || []).filter((r) => r && r.source === 'external').length
@@ -509,6 +529,14 @@
}
// 版本与更新(独立组件:自己持有提示状态,不污染 generalTab 的 hook 顺序)
// 设置分组:标题在页面底色上,内容放在浅色圆角容器里(Obsidian 式)
function GSetGroup (props) {
return el('div', { className: 'iwb-gset-group' },
el('div', { className: 'iwb-gset-group-h' }, props.title),
props.children ? el('div', { className: 'iwb-gset-group-body' }, props.children) : null,
)
}
function VersionBlock (props) {
const version = props && props.version ? String(props.version) : ''
const [msg, setMsg] = React.useState('')
@@ -534,16 +562,16 @@
setMsg('安装完成,正在重启…')
} catch (e) { setMsg('更新失败:' + String((e && e.message) || e)) }
}
return el('div', null,
el('div', { className: 'iwb-section-sub' }, '版本与更新'),
el('div', { className: 'iwb-row' },
el('span', { className: 'iwb-label' }, '版本'),
el('span', { className: 'iwb-hint', style: { flex: '1 1 auto' } }, version || '未知'),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: check }, '检查更新'),
found ? el('button', { className: 'iwb-btn iwb-btn-sm iwb-btn-primary', onClick: install }, '立即更新') : null,
return el(GSetGroup, { title: '版本与更新' }, el('div', { className: 'iwb-gset-row' },
el('span', { className: 'iwb-gset-row-label' }, '版本'),
el('div', { className: 'iwb-gset-row-ctl' },
el('span', { className: 'iwb-hint' }, version || '未知'),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: check }, '检查更新'),
found ? el('button', { className: 'iwb-btn iwb-btn-sm iwb-btn-primary', onClick: install }, '立即更新') : null,
),
),
el('div', { className: 'iwb-hint' }, '更新源:download.maqiart.eu.org/updates/latest.json(签名校验通过才会安装)'),
msg ? el('div', { className: 'iwb-hint' }, msg) : null,
el('div', { className: 'iwb-gset-hint' }, '更新源:download.maqiart.eu.org/updates/latest.json(签名校验通过才会安装)'),
msg ? el('div', { className: 'iwb-gset-hint' }, msg) : null,
)
}
// 桌面端专属:默认下载文件夹。独立组件持有 useState ⇒ 不干扰 generalTab 的 hook 顺序。
@@ -585,48 +613,65 @@
await F.migrateTo(d)
} catch (e) { setNote('转移失败:' + String((e && e.message) || e)) }
}
return el('div', null,
el('div', { className: 'iwb-section-sub' }, '数据库目录'),
el('div', { className: 'iwb-row' },
el('input', { className: 'iwb-input iwb-grow', readOnly: true, value: dataDir, title: dataDir }),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: openData }, '打开'),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: pickDataDir }, '切换…'),
el('button', { className: 'iwb-btn iwb-btn-sm', title: '把整库复制到新目录后再切换(原目录保留)', onClick: migrateData }, '转移…'),
return el('div', { className: 'iwb-gset-stack' },
el(GSetGroup, { title: '数据与目录', desc: '设置、提示词、画布、图库清单与所有图片都存在资料目录。' }, el('div', { className: 'iwb-gset-row' },
el('span', { className: 'iwb-gset-row-label' }, '数据库目录'),
el('div', { className: 'iwb-gset-row-ctl' },
el('input', { className: 'iwb-input iwb-grow', readOnly: true, value: dataDir, title: dataDir }),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: openData }, '打开'),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: pickDataDir }, '切换…'),
el('button', { className: 'iwb-btn iwb-btn-sm', title: '把整库复制到新目录后再切换(原目录保留)', onClick: migrateData }, '转移…'),
),
),
el('div', { className: 'iwb-gset-hint' }, 'data.json / canvases / library / images 都是普通文件。',
el('details', { className: 'iwb-more' },
el('summary', null, '切换与转移的区别'),
el('div', null, '「切换」只换指针,指到已有旧目录即可搬家换机;「转移」把整库复制到新位置再切换,原目录不动。'),
),
),
el('div', { className: 'iwb-gset-row' },
el('span', { className: 'iwb-gset-row-label' }, '维护'),
el('div', { className: 'iwb-gset-row-ctl' },
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: async () => {
try {
const rDry = await F.gcImages({ dryRun: true })
if (!rDry.ok) { setNote('检查失败:' + rDry.error); return }
if (!rDry.orphans) { setNote('没有未引用的图片'); return }
const lines = ['发现 ' + rDry.orphans + ' 个文件没有被画布/图库引用。']
if (rDry.keptByCanvas) lines.push('其中 ' + rDry.keptByCanvas + ' 张虽然登记表里没有,但画布仍在引用 → 会自动保留。')
if (rDry.dangling) lines.push('另有 ' + rDry.dangling + ' 处画布引用已经找不到图片(之前丢的,本次不影响它们)。')
lines.push('移动到 trash/(不直接删除,可在回收站找回)?')
if (!(await askConfirm(lines.join('\n'), { title: '清理未引用图片', okText: '移动' }))) return
const rGo = await F.gcImages({ dryRun: false })
setNote(rGo.ok
? ('已移入 trash/:' + rGo.moved + ' 个文件' + (rGo.dangling ? (';另有 ' + rGo.dangling + ' 处引用已缺图') : ''))
: ('清理失败:' + rGo.error))
} catch (e) { setNote('清理失败:' + String((e && e.message) || e)) }
} }, '清理未引用图片'),
el('span', { className: 'iwb-hint' }, '移到 trash/,可在回收站找回'),
),
),
),
el('div', { className: 'iwb-hint' }, '设置、提示词、画布、图库清单与所有图片都在这里(data.json / canvases / library / images)。'),
el('div', { className: 'iwb-hint' }, '「切换」只换指针(指到已有的旧目录即可搬家换机);「转移」把整库复制到新位置再切换,原目录不动。'),
el('div', { className: 'iwb-section-sub' }, '维护'),
el('div', { className: 'iwb-row' },
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: async () => {
try {
const rDry = await F.gcImages({ dryRun: true })
if (!rDry.ok) { setNote('检查失败:' + rDry.error); return }
if (!rDry.orphans) { setNote('没有未引用的图片'); return }
// 确认弹窗必须把「会不会动到在用的图」讲清楚:这是破坏性动作,不能只报一个数字。
const lines = ['发现 ' + rDry.orphans + ' 个文件没有被画布/图库引用。']
if (rDry.keptByCanvas) lines.push('其中 ' + rDry.keptByCanvas + ' 张虽然登记表里没有,但画布仍在引用 → 会自动保留。')
if (rDry.dangling) lines.push('另有 ' + rDry.dangling + ' 处画布引用已经找不到图片(之前丢的,本次不影响它们)。')
lines.push('移动到 trash/(不直接删除,可在回收站找回)?')
if (!(await askConfirm(lines.join('\n'), { title: '清理未引用图片', okText: '移动' }))) return
const rGo = await F.gcImages({ dryRun: false })
setNote(rGo.ok
? ('已移入 trash/:' + rGo.moved + ' 个文件' + (rGo.dangling ? (';另有 ' + rGo.dangling + ' 处引用已缺图') : ''))
: ('清理失败:' + rGo.error))
} catch (e) { setNote('清理失败:' + String((e && e.message) || e)) }
} }, '清理未引用图片'),
el(GSetGroup, { title: '图片导出' }, el('div', { className: 'iwb-gset-row' },
el('span', { className: 'iwb-gset-row-label' }, '导出目录'),
el('div', { className: 'iwb-gset-row-ctl' },
el('input', { className: 'iwb-input iwb-grow', readOnly: true, placeholder: '未设置:每次弹系统另存为', value: dir }),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: pick }, '选择…'),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: clear }, '清除'),
),
),
el('div', { className: 'iwb-gset-row' },
el('span', { className: 'iwb-gset-row-label' }, '自动下载'),
el('div', { className: 'iwb-gset-row-ctl' },
el('label', { className: 'iwb-check', title: dir ? '勾选后出图完成自动保存到上面的目录' : '需先选择导出目录才能开启自动下载' },
el('input', { type: 'checkbox', checked: autoDl, disabled: !dir, onChange: (e) => toggleAutoDl(e.target.checked) }, null),
' 出图完成后自动保存',
),
),
),
el('div', { className: 'iwb-gset-hint' }, '未设置目录时,点「下载」弹系统另存为;设置后直接存到该目录。'),
),
el('div', { className: 'iwb-section-sub' }, '图片导出目录'),
el('div', { className: 'iwb-row' },
el('input', { className: 'iwb-input iwb-grow', readOnly: true, placeholder: '未设置:每次弹系统另存为', value: dir }),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: pick }, '选择…'),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: clear }, '清除'),
),
el('label', { className: 'iwb-check', title: dir ? '勾选后出图完成自动保存到上面的目录' : '需先选择导出目录才能开启自动下载' },
el('input', { type: 'checkbox', checked: autoDl, disabled: !dir, onChange: (e) => toggleAutoDl(e.target.checked) }, null),
' 自动下载'),
el('div', { className: 'iwb-hint' }, '设了目录:点「下载」直接存到这里,不弹框;没设目录:点「下载」时弹选择框。'),
el('div', { className: 'iwb-hint' }, '勾选「自动下载」:出图完成后自动保存到上面的目录(需先选目录)。'),
note ? el('div', { className: 'iwb-hint' }, note) : null,
note ? el('div', { className: 'iwb-gset-hint' }, note) : null,
)
}
// 桌面端:数据位置说明 + 「打开数据目录」(网页版退回原来的浏览器文案)
@@ -651,43 +696,52 @@
function renderGeneralTab (ctx) {
const { TASK_STALL_END_MAX, TASK_STALL_END_MIN, appVersion, draft, imageLibSection, setDraft } = ctx
const generalTab = el('div', { className: 'iwb-section' },
el('div', { className: 'iwb-section-title' }, '数据与目录'),
// 桌面端才有目录概念;网页版退回原来的浏览器说明
isDesk() ? el(DownloadDirBlock, null) : el(DataDirRow, null),
el('div', { style: { height: 16 } }),
el('div', { className: 'iwb-section-sub' }, '生成'),
el('div', { className: 'iwb-row' },
el('label', { className: 'iwb-label' }, '等待多久后允许提前结束(分钟)'),
el('input', { className: 'iwb-input', type: 'number', min: 1, max: 60, step: 1, value: Math.round((draft.canvas.taskStallEndMs || 300000) / 60000), onChange: (e) => setDraft((d) => ({ ...d, canvas: { ...d.canvas, taskStallEndMs: Math.max(TASK_STALL_END_MIN, Math.min(TASK_STALL_END_MAX, (Number(e.target.value) || 5) * 60000)) } })) }),
return el('div', { className: 'iwb-gset-page' },
el(VersionBlock, { version: appVersion }),
isDesk() ? el(DownloadDirBlock, null) : el(GSetGroup, { title: '数据与目录' }, el(DataDirRow, null),
),
el('div', { className: 'iwb-hint' }, '任务条按钮:未开始时「生成」→ 已提交后「等待」→ 超过该时长仍无新进展才出现「结束」,可在不误触的前提下提前结束该任务(不影响同批其他任务)。'),
el('div', { className: 'iwb-row' },
el('label', { className: 'iwb-check' },
el('input', { type: 'checkbox', checked: draft.canvas.lodLowZoom !== false, onChange: (e) => setDraft((d) => ({ ...d, canvas: { ...d.canvas, lodLowZoom: !!e.target.checked } })) }),
'缩放到 15% 以下时简化节点(不显示图片,更省资源)',
el(GSetGroup, { title: '图片与图库' }, imageLibSection || null,
),
el(GSetGroup, { title: '生成' }, el('div', { className: 'iwb-gset-row' },
el('span', { className: 'iwb-gset-row-label' }, '提前结束等待'),
el('div', { className: 'iwb-gset-row-ctl' },
el('input', { className: 'iwb-input iwb-num', type: 'number', min: 1, max: 60, step: 1, value: Math.round((draft.canvas.taskStallEndMs || 300000) / 60000), onChange: (e) => setDraft((d) => ({ ...d, canvas: { ...d.canvas, taskStallEndMs: Math.max(TASK_STALL_END_MIN, Math.min(TASK_STALL_END_MAX, (Number(e.target.value) || 5) * 60000)) } })) }),
el('span', { className: 'iwb-hint' }, '分钟'),
),
),
el('div', { className: 'iwb-gset-hint' }, '任务条:生成 → 等待 → 超过该时长仍无进展才出现「结束」。',
el('details', { className: 'iwb-more' },
el('summary', null, '更多说明'),
el('div', null, '可在不误触的前提下提前结束该任务,不影响同批其他任务。'),
),
),
el('div', { className: 'iwb-gset-row' },
el('span', { className: 'iwb-gset-row-label' }, '低缩放简化'),
el('div', { className: 'iwb-gset-row-ctl' },
el('label', { className: 'iwb-check' },
el('input', { type: 'checkbox', checked: draft.canvas.lodLowZoom !== false, onChange: (e) => setDraft((d) => ({ ...d, canvas: { ...d.canvas, lodLowZoom: !!e.target.checked } })) }),
'缩放到 15% 以下时简化节点(不显示图片)',
),
),
),
el('div', { className: 'iwb-gset-hint' }, '关闭后任何缩放都渲染完整节点,节点多的大画布会更吃资源。'),
el('div', { className: 'iwb-gset-row' },
el('span', { className: 'iwb-gset-row-label' }, '提示音'),
el('div', { className: 'iwb-gset-row-ctl' },
el('label', { className: 'iwb-check' },
el('input', { type: 'checkbox', checked: draft.canvas.soundEnabled === true, onChange: (e) => setDraft((d) => ({ ...d, canvas: { ...d.canvas, soundEnabled: e.target.checked } })) }, null),
'生成完成时提示音',
),
),
),
),
el('div', { className: 'iwb-hint' }, '关掉后任何缩放比例都渲染完整节点(含图片)。节点很多的大画布缩得很小时,关掉会明显更吃资源。'),
el('div', { className: 'iwb-row' },
el('label', { className: 'iwb-check' }, el('input', { type: 'checkbox', checked: draft.canvas.soundEnabled === true, onChange: (e) => setDraft((d) => ({ ...d, canvas: { ...d.canvas, soundEnabled: e.target.checked } })) }, null), ' 生成完成提示音'),
),
el('div', { style: { height: 16 } }),
// 原「图片保存」页并入这里(定时清理已去掉)
imageLibSection || null,
el('div', { style: { height: 16 } }),
el(VersionBlock, { version: appVersion }),
// 桌面端没有服务端、也没有「浏览器本地模式」这回事 ⇒ 整段不渲染
isDesk() ? null : el('div', { className: 'iwb-section-sub' }, '访问口令'),
isDesk() ? null : el('div', { className: 'iwb-hint' }, '口令是服务端(Node 版 image-workbench-app)的 Basic Auth 功能;当前为浏览器本地模式(数据存在你的浏览器),页面与数据本就只在本机,无需设置口令。'),
)
return generalTab
}
function renderTransferSection (ctx) {
const { comp, hostFields, ih, it, setComp, setIH, setIt } = ctx
const transferSection = el('div', { className: 'iwb-section' },
el('div', { className: 'iwb-section-title' }, '传输方式(参考图如何发送)'),
const transferSection = el('div', { className: 'iwb-gset-page' },
el(GSetGroup, { title: '传输方式' },
el('div', { className: 'iwb-row' },
el('span', { className: 'iwb-label' }, '参考图上限'),
el('input', { className: 'iwb-input iwb-num', type: 'number', min: 1, max: 12, value: Number(it.maxRefs) || 3, title: '单次参考图数量上限(接口默认 1-3,自定义接口可调大)', onChange: (e) => setIt({ maxRefs: Number(e.target.value) }) }, null),
@@ -702,7 +756,8 @@
),
),
hostFields,
el('div', { className: 'iwb-section-sub' }, '压缩(超阈值自动压缩后发送)'),
),
el(GSetGroup, { title: '压缩' },
el('div', { className: 'iwb-row' },
el('label', { className: 'iwb-check' }, el('input', { type: 'checkbox', checked: comp.enabled !== false, onChange: (e) => setComp({ enabled: e.target.checked }) }, null), ' 启用'),
el('input', { className: 'iwb-input iwb-num', type: 'number', min: 1, value: comp.maxMB || 8, title: '超过该大小(MB)才压缩', onChange: (e) => setComp({ maxMB: Number(e.target.value) }) }, null),
@@ -716,6 +771,7 @@
el('select', { className: 'iwb-input iwb-grow', value: comp.format || 'keep', onChange: (e) => setComp({ format: e.target.value }) },
el('option', { value: 'keep' }, '保持原格式'), el('option', { value: 'jpeg' }, '统一转 JPEG')),
),
),
)
return transferSection
}
@@ -750,36 +806,17 @@
function renderPluginSettingsPage (ctx) {
const { PluginHost, activePlugin, setMsg, setPluginsRev, setTab } = ctx
const pluginSettingsPage = activePlugin ? el('div', { className: 'iwb-set-page' },
el('div', { className: 'iwb-mk-setrow' },
el('div', { className: 'iwb-mk-setrow-main' },
el('div', { className: 'iwb-mk-setrow-title' }, activePlugin.name,
el('span', { className: 'iwb-plugin-tag' + (activePlugin.enabled ? '' : ' iwb-plugin-tag-warn'), style: { marginLeft: 8 } }, activePlugin.enabled ? '已启用' : '未启用'),
activePlugin.compatible ? null : el('span', { className: 'iwb-plugin-tag iwb-plugin-tag-warn', style: { marginLeft: 4 } }, 'apiVersion 不兼容'),
),
el('div', { className: 'iwb-hint' }, activePlugin.id + ' · v' + activePlugin.version),
),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: function () {
try { if (PluginHost && typeof PluginHost.persist === 'function') PluginHost.persist() } catch (e) { /* ignore */ }
if (setMsg) setMsg('已保存插件设置')
} }, '保存设置'),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: function () { setTab('plugins') } }, '返回'),
),
activePlugin.error ? el('div', { className: 'iwb-status-err' }, activePlugin.error) : null,
el('div', { className: 'iwb-section-sub' }, '设置'),
Object.keys(activePlugin.settingsSchema || {}).length ? Object.keys(activePlugin.settingsSchema).map(function (key) {
const spec = activePlugin.settingsSchema[key] || {}
const value = activePlugin.settings && activePlugin.settings[key] !== undefined ? activePlugin.settings[key] : spec.default
const commit = function (next) { PluginHost.setSetting(activePlugin.id, key, next); setPluginsRev(function (v) { return v + 1 }) }
const isCustom = spec.type === 'custom' && typeof spec.render === 'function'
// 说明在上、控件在下(左对齐):右侧 260px 的窄框放地址/多行内容既看不全也
// 改不动;boolean 仍是行末开关(这类是「开/关」而不是填写内容)。
const stacked = isCustom || spec.type === 'text' || spec.type === 'number'
return el('div', { key: key, className: 'iwb-mk-setrow' + (stacked ? ' iwb-mk-setrow-col' : '') },
el('div', { className: 'iwb-mk-setrow-main' },
el('div', { className: 'iwb-mk-setrow-title' }, spec.label || key),
spec.desc ? el('div', { className: 'iwb-hint' }, spec.desc) : null,
),
if (!activePlugin) return el('div', { className: 'iwb-hint' }, '插件不存在或已卸载。')
// 2026-11-24:插件设置页按设置面板 token 重排(GSetGroup + 行网格),不再自造 mk-setrow 卡片。
const rows = Object.keys(activePlugin.settingsSchema || {}).map(function (key) {
const spec = activePlugin.settingsSchema[key] || {}
const value = activePlugin.settings && activePlugin.settings[key] !== undefined ? activePlugin.settings[key] : spec.default
const commit = function (next) { PluginHost.setSetting(activePlugin.id, key, next); setPluginsRev(function (v) { return v + 1 }) }
const isCustom = spec.type === 'custom' && typeof spec.render === 'function'
const stacked = isCustom || spec.type === 'text' || spec.type === 'number'
return el('div', { key: key, className: 'iwb-gset-row' + (stacked ? ' iwb-gset-row-stacked' : '') },
el('div', { className: 'iwb-gset-row-label' }, spec.label || key),
el('div', { className: 'iwb-gset-row-ctl' },
spec.type === 'boolean'
? el('label', { className: 'iwb-switch' },
el('input', { type: 'checkbox', checked: Boolean(value), onChange: function (e) { commit(e.target.checked) } }),
@@ -788,15 +825,40 @@
: isCustom
? el(PluginCustomSetting, { key: 'custom-' + key, spec: spec, value: value, commit: commit, pluginId: activePlugin.id })
: el('input', {
className: 'iwb-input', type: spec.type === 'number' ? 'number' : 'text',
style: { maxWidth: '520px' },
className: 'iwb-input iwb-grow', type: spec.type === 'number' ? 'number' : 'text',
value: value === undefined ? '' : String(value),
onChange: function (e) { commit(spec.type === 'number' ? Number(e.target.value) : e.target.value) },
}),
)
}) : el('div', { className: 'iwb-hint' }, '该插件没有可配置项。'),
) : el('div', { className: 'iwb-hint' }, '插件不存在或已卸载。')
return pluginSettingsPage
),
)
})
return el('div', { className: 'iwb-gset-page' },
el('div', { className: 'iwb-gset-group' },
el('div', { className: 'iwb-gset-group-h' }, activePlugin.name),
el('div', { className: 'iwb-gset-group-body' },
el('div', { className: 'iwb-gset-row' },
el('div', { className: 'iwb-gset-row-label' }, '插件信息'),
el('div', { className: 'iwb-gset-row-ctl' },
el('span', { className: 'iwb-plugin-tag' + (activePlugin.enabled ? '' : ' iwb-plugin-tag-warn') }, activePlugin.enabled ? '已启用' : '未启用'),
activePlugin.compatible ? null : el('span', { className: 'iwb-plugin-tag iwb-plugin-tag-warn' }, 'apiVersion 不兼容'),
el('span', { className: 'iwb-gset-hint' }, activePlugin.id + ' · v' + activePlugin.version),
),
),
activePlugin.error ? el('div', { className: 'iwb-gset-row' }, el('div', { className: 'iwb-gset-row-label' }, '错误'), el('div', { className: 'iwb-gset-row-ctl' }, el('span', { className: 'iwb-status-err' }, activePlugin.error))) : null,
rows.length ? rows : el('div', { className: 'iwb-gset-row' }, el('div', { className: 'iwb-gset-row-label' }, '设置'), el('div', { className: 'iwb-gset-row-ctl' }, el('span', { className: 'iwb-gset-hint' }, '该插件没有可配置项。'))),
el('div', { className: 'iwb-gset-row' },
el('div', { className: 'iwb-gset-row-label' }, '操作'),
el('div', { className: 'iwb-gset-row-ctl' },
el('button', { className: 'iwb-btn iwb-btn-sm iwb-btn-primary', onClick: function () {
try { if (PluginHost && typeof PluginHost.persist === 'function') PluginHost.persist() } catch (e) { /* ignore */ }
if (setMsg) setMsg('已保存插件设置')
} }, '保存设置'),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: function () { setTab('plugins') } }, '返回'),
),
),
),
),
)
}
function renderAutoBackupSection (ctx) {
@@ -835,9 +897,7 @@
function renderLlmTab (ctx) {
const { addLlmAddr, addLlmKey, addLlmModel, addLlmProvider, api, delLlmAddr, delLlmKey, delLlmModel, delLlmProvider, draft, llmAddrInput, llmAddrRes, llmAddrTesting, llmKeyInput, llmModelInput, llmTestMsg, llmTestSel, llmTesting, llmWarn, msg, setLlm, setLlmAddr, setLlmAddrDefault, setLlmAddrInput, setLlmDefaultModel, setLlmKey, setLlmKeyInput, setLlmModelInput, setLlmProv, setLlmTestSel, testLlm, testLlmAddrs } = ctx
const llmTab = el('div', { className: 'iwb-section' },
el('div', { className: 'iwb-section-title' }, 'LLM 渠道(可选,用于提示词润色)'),
el('div', { className: 'iwb-hint' }, '可选 · 用于提示词润色;润色使用「默认渠道」。'),
const llmTab = el('div', { className: 'iwb-gset-page' },
(draft.llm.providers || []).length
? draft.llm.providers.map((p, pi) => {
const isDef = p.id === draft.llm.defaultProviderId
@@ -905,19 +965,35 @@
el('div', { className: 'iwb-row' },
el('button', { className: 'iwb-btn', onClick: addLlmProvider }, '+ 添加渠道'),
),
el('div', { className: 'iwb-label', title: '全局模板;LLM 节点内可覆盖' }, '默认润色指令'),
el('textarea', { className: 'iwb-input iwb-hdrbox', style: { minHeight: '40px', maxHeight: '64px', overflowY: 'auto' }, value: draft.llm.defaultInstruction || '', onChange: (e) => setLlm({ defaultInstruction: e.target.value }) }, null),
llmWarn ? el('div', { className: 'iwb-hint', style: { color: '#b91c1c' } }, llmWarn) : null,
el('div', { className: 'iwb-hint' }, '流程可不经过 LLM(直接连生图);节点未填指令时用此模板。'),
el(GSetGroup, { title: '默认润色指令' },
el('textarea', { className: 'iwb-input iwb-hdrbox', style: { minHeight: '40px', maxHeight: '64px', overflowY: 'auto' }, value: draft.llm.defaultInstruction || '', onChange: (e) => setLlm({ defaultInstruction: e.target.value }) }, null),
llmWarn ? el('div', { className: 'iwb-hint', style: { color: '#b91c1c' } }, llmWarn) : null,
el('div', { className: 'iwb-gset-hint' }, '流程可不经过 LLM(直接连生图);节点未填指令时用此模板。'),
),
)
return llmTab
}
function renderProvCards (ctx) {
const { DEFAULT_SHAPE_TPL, I, W_SHAPE_KINDS, addAddr, addKey, addLayerModel, addModel, api, delAddr, delKey, delLayerModel, delModel, delProv, draft, layerModelInput, modelInput, modelSupportsQuality, setAddr, setDefault, setKey, setLayerModelInput, setModelInput, setModelKind, setModelQuality, setProv, setShapeText, shapeText, speed, speedTest, toggleLayerModel, toggleModel, wNormalizeLayerModels, wPrivateToolsOn } = ctx
const { DEFAULT_SHAPE_TPL, I, W_SHAPE_KINDS, addAddr, addKey, addLayerModel, addModel, addProvider, api, delAddr, delKey, delLayerModel, delModel, delProv, draft, layerModelInput, makeProviderDefault, modelInput, modelSupportsQuality, provSel, setAddr, setDefault, setKey, setLayerModelInput, setModelInput, setModelKind, setModelQuality, setProv, setProvSel, setShapeText, shapeText, speed, speedTest, toggleLayerModel, toggleModel, wNormalizeLayerModels, wPrivateToolsOn } = ctx
const provCards = []
for (let pi = 0; pi < (draft.providers || []).length; pi++) {
const p = draft.providers[pi]
const providersAll = draft.providers || []
const selectedId = provSel && providersAll.some((p) => p.id === provSel) ? provSel : ((providersAll[0] && providersAll[0].id) || '')
const chips = el('div', { className: 'iwb-prov-chips', role: 'tablist', 'aria-label': '服务商' },
providersAll.map((p, i) => el('button', {
key: p.id, type: 'button', role: 'tab', 'aria-selected': p.id === selectedId ? 'true' : 'false',
className: 'iwb-prov-chip' + (p.id === selectedId ? ' on' : ''),
title: (p.name || '未命名服务') + ':' + (1 + (p.fallbacks || []).length) + ' 个地址 · ' + (p.models || []).length + ' 个模型',
onClick: () => setProvSel && setProvSel(p.id),
},
el('span', { className: 'iwb-prov-chip-name' }, p.name || '未命名服务'),
i === 0 ? el('span', { className: 'iwb-prov-chip-badge' }, '主') : null,
)),
el('button', { type: 'button', className: 'iwb-btn iwb-btn-sm iwb-prov-add', onClick: addProvider, title: '添加一个生图服务商' }, '+ 添加服务商'),
)
for (let pi = 0; pi < providersAll.length; pi++) {
const p = providersAll[pi]
if (p.id !== selectedId) continue
const keyRows = []
for (let ki = 0; ki < (p.keys || []).length; ki++) {
const k = p.keys[ki]
@@ -951,19 +1027,8 @@
const rulesVal = (shapeText[rulesKey] !== undefined)
? shapeText[rulesKey]
: JSON.stringify(p.modelRules || ((typeof window !== 'undefined' && window.IWBGenerationRequestShape && window.IWBGenerationRequestShape.DEFAULT_RULES) || []), null, 1)
const shapeBox = el('div', { className: 'iwb-shape-box' },
el('div', { className: 'iwb-row' },
el('span', { className: 'iwb-hint iwb-addr-tag' }, '厂商'),
el('select', {
className: 'iwb-input iwb-grow', 'aria-label': '厂商类型', value: shapeKind,
onChange: (e) => setProv(pi, { kind: e.target.value }),
},
el('option', { value: 'openai' }, 'OpenAI 兼容(像素 size,默认)'),
el('option', { value: 'gemini' }, 'Google Gemini / Nano Banana(比例 + K 档)'),
el('option', { value: 'doubao' }, '豆包 / Seedream(K 档或像素)'),
el('option', { value: 'custom' }, '自定义(请求体模板)'),
),
),
const shapeMore = el('details', { className: 'iwb-shape-more', open: shapeKind === 'custom' || !!shapeText[pi + ':err'] },
el('summary', null, '模型名规则(JSON,高级)'),
shapeKind === 'custom' ? el('div', null,
el('div', { className: 'iwb-hint' }, '请求体模板(JSON)。占位符:$model $prompt $n $size $ratio $ratio_x $res $res_k $width $height'),
el('textarea', {
@@ -989,6 +1054,21 @@
}, null),
shapeText[pi + ':err'] ? el('div', { className: 'iwb-hint' }, shapeText[pi + ':err']) : null,
)
const shapeBox = el('div', { className: 'iwb-shape-box' },
el('div', { className: 'iwb-row' },
el('span', { className: 'iwb-hint iwb-addr-tag' }, '厂商'),
el('select', {
className: 'iwb-input iwb-grow', 'aria-label': '厂商类型', value: shapeKind,
onChange: (e) => setProv(pi, { kind: e.target.value }),
},
el('option', { value: 'openai' }, 'OpenAI 兼容(像素 size,默认)'),
el('option', { value: 'gemini' }, 'Google Gemini / Nano Banana(比例 + K 档)'),
el('option', { value: 'doubao' }, '豆包 / Seedream(K 档或像素)'),
el('option', { value: 'custom' }, '自定义(请求体模板)'),
),
),
shapeMore,
)
const sp = speed && speed.providerId === p.id ? speed : null
const modelRows = (p.models || []).map((m) => el('div', { key: m.name, className: 'iwb-modelrow' },
el('label', { className: 'iwb-check iwb-modelrow-main', title: m.name + '(勾选=在生图节点下拉里可见)' },
@@ -1020,9 +1100,14 @@
el('option', { value: 'doubao' }, 'doubao'),
el('option', { value: 'custom' }, 'custom'),
),
m.source !== 'builtin'
? el('button', { className: 'iwb-btn iwb-btn-xs iwb-btn-danger', title: '删除模型', 'aria-label': '删除模型 ' + m.name, onClick: () => delModel(pi, m.name) }, I('trash'))
: el('span', { className: 'iwb-hint', title: '内置模型只能隐藏,不能删除' }, '内置'),
el('details', { className: 'iwb-model-more' },
el('summary', { className: 'iwb-model-more-btn', title: '更多操作', 'aria-label': '更多操作 ' + m.name }, '⋯'),
el('div', { className: 'iwb-ctxmenu iwb-model-more-menu' },
m.source !== 'builtin'
? el('button', { className: 'iwb-model-more-del', title: '删除模型', 'aria-label': '删除模型 ' + m.name, onClick: () => delModel(pi, m.name) }, '删除模型')
: el('div', { className: 'iwb-model-more-hint' }, '内置模型不可删除'),
),
),
))
// 分层模型行:结构与生图模型行一致(同一套 .iwb-modellist/.iwb-modelrow 样式);
// 内置项既不能删也不能隐藏(隐藏会让分层节点没有模型可选)。
@@ -1031,16 +1116,25 @@
el('input', { type: 'checkbox', checked: true, disabled: m.source === 'builtin', onChange: (e) => toggleLayerModel(pi, m.name, e.target.checked) }, null),
el('span', null, m.name),
),
m.source !== 'builtin'
? el('button', { className: 'iwb-btn iwb-btn-xs iwb-btn-danger', title: '删除分层模型', 'aria-label': '删除分层模型 ' + m.name, onClick: () => delLayerModel(pi, m.name) }, I('trash'))
: el('span', { className: 'iwb-hint', title: '内置分层模型:唯一实测可用的图层分离模型,不可删除也不可隐藏' }, '内置'),
el('details', { className: 'iwb-model-more' },
el('summary', { className: 'iwb-model-more-btn', title: '更多操作', 'aria-label': '更多操作 ' + m.name }, '⋯'),
el('div', { className: 'iwb-ctxmenu iwb-model-more-menu' },
m.source !== 'builtin'
? el('button', { className: 'iwb-model-more-del', title: '删除分层模型', 'aria-label': '删除分层模型 ' + m.name, onClick: () => delLayerModel(pi, m.name) }, '删除分层模型')
: el('div', { className: 'iwb-model-more-hint' }, '内置分层模型不可删除'),
),
),
))
provCards.push(el('div', { key: p.id, className: 'iwb-provider-card' },
el('div', { className: 'iwb-row' },
el('input', { className: 'iwb-input iwb-grow', value: p.name || '', placeholder: '服务名称', onChange: (e) => setProv(pi, { name: e.target.value }) }),
el(GSetGroup, { title: '服务' },
el('div', { className: 'iwb-prov-head' },
el('input', { className: 'iwb-input iwb-prov-name', value: p.name || '', placeholder: '服务名称', 'aria-label': '服务名称', onChange: (e) => setProv(pi, { name: e.target.value }) }),
el('span', { className: 'iwb-prov-badge' }, pi === 0 ? '主服务' : '备用服务'),
el('span', { className: 'iwb-prov-sum' }, (1 + (p.fallbacks || []).length) + ' 地址 · ' + (p.models || []).length + ' 模型'),
pi > 0 ? el('button', { className: 'iwb-btn iwb-btn-sm', title: '移到第一位,作为默认服务', onClick: () => makeProviderDefault && makeProviderDefault(pi) }, '设为默认') : null,
el('button', { className: 'iwb-btn iwb-btn-sm iwb-btn-danger', onClick: () => delProv(pi) }, '删除服务'),
),
el('div', { className: 'iwb-section-sub' }, '服务器地址(多条自动切换)'),
)),
el(GSetGroup, { title: '服务器地址', desc: '多条自动切换' },
addrRows,
el('div', { className: 'iwb-row' },
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => addAddr(pi) }, '+ 添加地址'),
@@ -1059,34 +1153,42 @@
sp.results.some((r) => r.ok && r.cors === false) ? el('div', { className: 'iwb-hint' }, '有地址未开放跨域读状态码:显示的耗时是「连得上」的估算值,按它排序选最快即可,不影响生图。') : null,
sp.results.length && sp.results.every((r) => !r.ok) && sp.results[0].error ? el('div', { className: 'iwb-hint' }, '全部失败 · ' + String(sp.results[0].error)) : null,
) : null,
el('div', { className: 'iwb-row' },
),
el(GSetGroup, { title: '接口路径' },
el('div', { className: 'iwb-gset-row' },
el('div', { className: 'iwb-gset-row-label' }, '生图 / 编辑'),
el('div', { className: 'iwb-gset-row-ctl' },
el('input', { className: 'iwb-input iwb-grow', value: p.genPath || '', placeholder: '生图路径,默认 /images/generations', onChange: (e) => setProv(pi, { genPath: e.target.value }) }),
el('input', { className: 'iwb-input iwb-grow', value: p.editPath || '', placeholder: '编辑路径,默认 /images/edits', onChange: (e) => setProv(pi, { editPath: e.target.value }) }),
)),
),
el('div', { className: 'iwb-label' }, 'API Key 分组'),
el(GSetGroup, { title: 'API Key' },
keyRows,
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => addKey(pi) }, '+ 添加 Key 分组'),
el('div', { className: 'iwb-section-sub' }, '厂商分类(决定请求体怎么发尺寸)'),
),
el(GSetGroup, { title: '请求分类', desc: '决定请求体怎么发尺寸' },
shapeBox,
el('div', { className: 'iwb-section-sub' }, '模型显隐(生图节点下拉只显示可见项)'),
),
el(GSetGroup, { title: '模型', desc: '生图节点下拉只显示可见项' },
el('div', { className: 'iwb-modellist' }, modelRows.length ? modelRows : el('div', { className: 'iwb-hint' }, '暂无模型 · 手动添加')),
el('div', { className: 'iwb-row' },
el('input', { className: 'iwb-input iwb-grow', placeholder: '手动添加模型名', value: modelInput[pi] || '', onChange: (e) => setModelInput((m) => ({ ...m, [pi]: e.target.value })) }),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => { addModel(pi, (modelInput[pi] || '').trim()); setModelInput((m) => ({ ...m, [pi]: '' })) } }, '+ 添加'),
),
),
// 分层模型区块属于私有功能:开关关闭时整段不渲染(普通用户看不到任何痕迹)
...(wPrivateToolsOn ? [
el('div', { className: 'iwb-section-sub' }, '分层模型(分层节点下拉只显示可见项,与生图模型清单互不影响)'),
el(GSetGroup, { title: '分层模型', desc: '分层节点下拉只显示可见项,与生图模型清单互不影响' },
el('div', { className: 'iwb-modellist' }, layerModelRows.length ? layerModelRows : el('div', { className: 'iwb-hint' }, '暂无分层模型')),
el('div', { className: 'iwb-row' },
el('input', { className: 'iwb-input iwb-grow', placeholder: '手动添加分层模型名(如 doubao-seedream-5-0-pro-260628)', value: layerModelInput[pi] || '', onChange: (e) => setLayerModelInput((m) => ({ ...m, [pi]: e.target.value })) }),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => { addLayerModel(pi, (layerModelInput[pi] || '').trim()); setLayerModelInput((m) => ({ ...m, [pi]: '' })) } }, '+ 添加'),
),
)),
] : []),
))
}
// ---- Tab 内容 ----
return provCards
return [chips].concat(provCards)
}
function renderHostFields (ctx) {
+307 -187
View File
@@ -660,10 +660,32 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
.iwb-input:focus, .iwb-textarea:focus { border-color: var(--iwb-brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--iwb-brand) 20%, transparent); }
/* 输入框提示文字统一淡色(层级:placeholder < 输入值 < 标签) */
.iwb-input::placeholder, .iwb-textarea::placeholder { color: color-mix(in srgb, var(--iwb-text) 34%, transparent); opacity: 1; }
/* 节点卡里的一切表单控件都吃「卡片内控件面」(D10)。
/* 节点卡里的**控件**吃「卡片内控件面」(D10);正文文本区例外,见下一条。
基础 .iwb-input 用的是 --iwb-layer2,在暗色等于面板色:铺在 #3d 的节点上就是一块近黑方框。
弹窗/抽屉里的输入框不受影响(它们不在 .iwb-node 内,仍用 layer2)。 */
.iwb-node .iwb-input, .iwb-node .iwb-textarea { background: var(--iwb-field); }
.iwb-node .iwb-input, .iwb-node .iwb-textarea:not(.iwb-textarea-plain) { background: var(--iwb-field); }
/* 节点正文文本区(提示词 / 文本 / 插件正文):**不是控件面**,不铺 --iwb-field。
它只是画在卡片上的一段文字,必须透明继承卡片底色(包括 data-bg 自定义底色);
常态、聚焦、编辑态都不画控件边框/圆角/聚焦光晕 —— 编辑状态由 .iwb-node-selected 的
选中框表达,控件框会在灰色卡片里再套出一张白卡片和一个方框(用户 2026-11-23 反馈)。
:focus-visible 的全局 D8 焦点环(2px solid + 2px offset)也必须在这里关掉 —— 它同样会
画成一个方框;此处的焦点反馈由 .iwb-node-selected 承担,其余控件照旧保留 D8 环。
必须带 .iwb-node 前缀且放在基础 .iwb-textarea:focus 之后:旧写法
.iwb-textarea-plain:focus(0,2,0) 被后面的 .iwb-textarea:focus 同优先级覆盖,
于是编辑时 2px 聚焦光晕又冒出来成了「方框」。 */
.iwb-node .iwb-textarea-plain {
background: transparent;
border: 0;
border-radius: 0;
padding: 0;
box-shadow: none;
}
.iwb-node .iwb-textarea-plain:focus,
.iwb-node .iwb-textarea-plain:focus-visible {
outline: none;
border-color: transparent;
box-shadow: none;
}
/* 设置面板:单行输入框/选择框限宽,不横向布满(表单化);行内组合(grow/num/keyname)与多行文本保持弹性 */
.iwb-settings-modal .iwb-input:not(.iwb-grow):not(.iwb-num):not(.iwb-keyname):not(.iwb-llm-keyname):not(.iwb-hdrbox) { max-width: 460px; }
/* 宽度/弹性覆盖(必须在 .iwb-input 定义之后,否则 width:100% 覆盖固定宽度类导致排版错位) */
@@ -959,7 +981,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
/* LLM 多渠道设置卡片 */
.iwb-llm-card { border: 1px solid var(--iwb-border); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: var(--iwb-layer); }
.iwb-llm-card-def { border-color: var(--iwb-border2); box-shadow: 0 0 0 1px var(--iwb-border2); }
.iwb-llm-card-def { border-color: var(--iwb-border2); }
.iwb-llm-cardhead { margin-bottom: 6px; }
.iwb-llm-keyname { flex: 0 0 96px; min-width: 96px; max-width: 96px; }
.iwb-llm-testrow { margin-top: 8px; align-items: center; }
@@ -1433,21 +1455,21 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
.iwb-size-num::-webkit-outer-spin-button, .iwb-size-num::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
/* ===== v3.86.5 图像设置浮层(质量 / 尺寸 / 分辨率 / 宽高比网格) ===== */
.iwb-image-settings { width: 380px; max-width: calc(100vw - 32px); }
.iwb-image-settings { width: var(--iwb-pop-w); max-width: calc(100vw - 32px); }
.iwb-image-settings .iwb-modal-body { display: flex; flex-direction: column; gap: 12px; }
.iwb-setgroup { display: flex; flex-direction: column; gap: var(--iwb-space-6); }
.iwb-setgroup { display: flex; flex-direction: column; gap: var(--iwb-space-4); }
/* v3.87.5:质量档位一行放 6 个 chip(自动/快速/标准/高清/极高/最高)→ 只在这个浮层里收紧内边距;
.iwb-setrow 本来就有 flex-wrap,字体差异导致放不下时自然换行,不存在溢出。 */
.iwb-image-settings .iwb-chip-line { padding: 5px 10px; }
.iwb-image-settings .iwb-chip-line { padding: 0 var(--iwb-pop-chip-pad-x); }
.iwb-chip[disabled] { opacity: 0.45; cursor: not-allowed; }
.iwb-chip[disabled]:hover { color: var(--iwb-text2); border-color: var(--iwb-border); }
/* 设置里模型行的「质量」勾选:紧跟名字,不参与右侧按钮的挤压 */
.iwb-modelrow-q { flex: 0 0 auto; font-size: 12px; }
.iwb-modelrow-q input { margin: 0; }
.iwb-setlabel { color: var(--iwb-text2); font-size: var(--iwb-font-sm); font-weight: 700; }
.iwb-setlabel { color: var(--iwb-text2); font-size: var(--iwb-font-sm); font-weight: 600; }
.iwb-sethd { display: flex; align-items: center; justify-content: space-between; gap: var(--iwb-space-8); }
.iwb-setalign { font-size: var(--iwb-font-sm); white-space: nowrap; }
.iwb-setrow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--iwb-space-6); }
.iwb-setalign { font-size: var(--iwb-font-md); white-space: nowrap; }
.iwb-setrow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--iwb-pop-chip-gap); }
.iwb-setx { color: var(--iwb-text2); flex: 0 0 auto; }
.iwb-set-num { flex: 0 0 auto; width: 74px; min-width: 0; text-align: center; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.iwb-set-num::-webkit-outer-spin-button, .iwb-set-num::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
@@ -1456,10 +1478,14 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
/* ===== v3.86.5 图像设置:贴节点浮层(popover)形态 ===== */
.iwb-pop-anchor { position: fixed; z-index: var(--iwb-z-anchor); }
.iwb-pop { width: 380px; max-width: calc(100vw - 16px); background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: var(--iwb-radius-popover); box-shadow: var(--iwb-elevation-3); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 32px); overflow-y: auto; }
/* 浮层弹窗(模型设置 / 图像设置 / 后续同类)统一 token —— 见 docs/standards/design-tokens.md §3.13 */
/* v3.26.60:字号整体上调一档(用户反馈 11px 太小)——胶囊 11→13px、高 22→28px、左右内距 6→10、
间距 4→6、标题 12→14,面板同步 328→360px 抵消放大后的换行。仍是「所有选项同一套数值」,
模型名永不省略的契约不变(靠 min-width: max-content + 面板横向滚动兜底)。 */
.iwb-pop { --iwb-pop-w: 360px; --iwb-pop-pad-y: var(--iwb-space-10); --iwb-pop-pad-x: var(--iwb-space-12); --iwb-pop-gap: var(--iwb-space-8); --iwb-pop-radius: var(--iwb-radius-popover); --iwb-pop-title-size: var(--iwb-font-base); --iwb-pop-chip-h: 28px; --iwb-pop-chip-pad-x: var(--iwb-space-10); --iwb-pop-chip-radius: 6px; --iwb-pop-chip-gap: var(--iwb-space-6); --iwb-pop-chip-size: var(--iwb-font-md); width: var(--iwb-pop-w); max-width: calc(100vw - 16px); background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: var(--iwb-pop-radius); box-shadow: var(--iwb-elevation-3); padding: var(--iwb-pop-pad-y) var(--iwb-pop-pad-x); display: flex; flex-direction: column; gap: var(--iwb-pop-gap); max-height: calc(100vh - 32px); overflow-y: auto; }
.iwb-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.iwb-pop-title { font-weight: 700; color: var(--iwb-text); }
.iwb-pop-body { display: flex; flex-direction: column; gap: 12px; }
.iwb-pop-title { font-weight: 700; color: var(--iwb-text); font-size: var(--iwb-pop-title-size); }
.iwb-pop-body { display: flex; flex-direction: column; gap: var(--iwb-pop-gap); }
/* 纯描边胶囊:与截图一致(选中只加重描边与文字色,不填充) */
.iwb-chip-line { background: transparent; border: 1px solid var(--iwb-border); color: var(--iwb-text); border-radius: 999px; padding: 5px 14px; }
.iwb-chip-line:hover { border-color: var(--iwb-brand); color: var(--iwb-text); }
@@ -1508,9 +1534,11 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
/* 选中项 = 品牌色描边 + 品牌色文字(与 .iwb-chip-line-on 同一套选中语言,只加重不填充) */
/* 弹窗内四组控件的形状统一:跟随「尺寸」那组(圆角矩形,非胶囊);字号统一 15px */
.iwb-pop .iwb-chip-line { border-radius: 10px; min-height: 38px; padding: 6px 14px; font-size: 15px; }
.iwb-pop .iwb-set-num { font-size: var(--iwb-font-lg); }
.iwb-pop-title { font-size: 15px; }
.iwb-pop .iwb-chip-line { display: inline-flex; align-items: center; border-radius: var(--iwb-pop-chip-radius); min-height: var(--iwb-pop-chip-h); padding: 0 var(--iwb-pop-chip-pad-x); font-size: var(--iwb-pop-chip-size); }
.iwb-pop .iwb-set-num { height: var(--iwb-pop-chip-h); font-size: var(--iwb-font-md); width: 68px; }
/* 浮层里的说明文字比全局 .iwb-hint(10px)大一档:与胶囊文字只差 1px,读起来是同一层信息 */
.iwb-pop .iwb-hint { font-size: var(--iwb-font-sm); line-height: 1.55; margin-top: 0; }
.iwb-pop-title { font-size: var(--iwb-pop-title-size); }
/* ---------- 分层节点(layer)----------
节点内字号跟随现有节点(11–12px),与「图像设置」面板的 15px 规范区分:
@@ -1568,7 +1596,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
.iwb-shape-box .iwb-textarea { width: 100%; box-sizing: border-box; min-height: 68px; }
.iwb-modal .iwb-section-sub { margin-top: 2px; }
/* v3.87.30 设置弹窗放大(内容多:厂商分类 / 模型清单 / 请求体模板 / 规则) */
.iwb-settings-modal { width: min(1180px, 96vw); max-width: 96vw; height: min(92vh, 1040px); max-height: 92vh; }
.iwb-settings-modal { --iwb-set-label-w: 180px; --iwb-set-col-gap: var(--iwb-space-16); --iwb-set-row-h: 40px; --iwb-set-row-pad-y: var(--iwb-space-6); --iwb-set-title-gap: var(--iwb-space-8); --iwb-set-hint-color: var(--iwb-text-dim); --iwb-set-hint-size: var(--iwb-font-xs); --iwb-set-hint-gap: var(--iwb-space-2); --iwb-set-divider: color-mix(in srgb, var(--iwb-border) 55%, transparent); --iwb-set-group-gap: var(--iwb-space-24); width: min(1180px, 96vw); max-width: 96vw; height: min(92vh, 1040px); max-height: 92vh; }
.iwb-settings-modal .iwb-modal-body { max-height: none; flex: 1 1 auto; min-height: 0; }
/* v3.87.31 模型清单:名称占位更宽 + 「质量」胶囊开关(与"启用"复选框区分) */
.iwb-modelrow { flex: 1 1 460px; }
@@ -1608,19 +1636,20 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
.iwb-set-nav { width: 232px; flex: 0 0 232px; display: flex; flex-direction: column; gap: var(--iwb-space-2); padding: var(--iwb-space-12) var(--iwb-space-10); overflow: auto; border-right: 1px solid var(--iwb-border); background: var(--iwb-layer); }
.iwb-set-nav-group { font-size: var(--iwb-font-sm); font-weight: 600; color: var(--iwb-text2); margin: var(--iwb-space-10) var(--iwb-space-8) var(--iwb-space-4); }
.iwb-set-nav-item { width: 100%; height: auto; justify-content: flex-start; text-align: left; gap: var(--iwb-space-8); }
.iwb-set-page-title { font-size: var(--iwb-font-lg); font-weight: 700; margin: var(--iwb-space-2) 0 var(--iwb-space-4); }
.iwb-gset-page-title { font-size: var(--iwb-font-lg); font-weight: 700; margin: var(--iwb-space-2) 0 var(--iwb-space-4); }
/* ── 「模型设置」面板(2026-10-30):服务商 / 分组 / 模型 ─────────────────────
模型列表用「标签流式排列」:每个按内容宽度,排满一行自动折行(2026-10-31 用户指定样式);
超长名字靠 min-width: max-content 撑开 ⇒ 面板内横向滚动,仍不省略。
文字 nowrap + 不设 text-overflow ⇒ 永不省略(省略会导致无法识别具体模型)。 */
.iwb-gen-config { width: min(92vw, 320px); max-height: min(78vh, calc(100vh - 24px)); display: flex; flex-direction: column; gap: var(--iwb-space-10); padding: var(--iwb-space-12) var(--iwb-space-16); }
/* 宽度跟随 --iwb-pop-w(原来写死 320px 会绕过 token,字号放大后模型面板不跟着变宽) */
.iwb-gen-config { width: min(92vw, var(--iwb-pop-w)); max-height: min(78vh, calc(100vh - 24px)); display: flex; flex-direction: column; gap: var(--iwb-space-10); padding: var(--iwb-space-12) var(--iwb-space-16); }
.iwb-gc-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.iwb-gc-field { display: flex; align-items: center; gap: 6px; min-width: 0; }
.iwb-gc-label { font-size: 12px; color: var(--iwb-text2); white-space: nowrap; }
.iwb-gc-select { font-size: 13px; padding: 5px 8px; border: 1px solid var(--iwb-border); border-radius: 8px; background: var(--iwb-panel); color: var(--iwb-text); max-width: 220px; }
.iwb-gc-label { font-size: var(--iwb-font-md); color: var(--iwb-text2); white-space: nowrap; }
.iwb-gc-select { height: var(--iwb-pop-chip-h); font-size: var(--iwb-pop-chip-size); padding: 0 var(--iwb-pop-chip-pad-x); border: 1px solid var(--iwb-border); border-radius: var(--iwb-pop-chip-radius); background: var(--iwb-panel); color: var(--iwb-text); max-width: 220px; }
.iwb-gc-select:disabled { opacity: 0.5; }
.iwb-gc-sub { font-size: 12px; font-weight: 700; color: var(--iwb-text2); letter-spacing: 0.5px; }
.iwb-gc-sub { font-size: var(--iwb-font-md); font-weight: 700; color: var(--iwb-text2); letter-spacing: 0.5px; }
/* ── 节点背景色(2026-11-01 第二轮)──────────────────────────────────────────
数据侧:`data.bg` 存**令牌**(white/cyan/purple/pink/orange/yellow/green),
颜色值由本文件按主题映射 ⇒ 暗色主题是**独立的一套深色**,不是把浅色压暗。
@@ -1758,14 +1787,14 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
.iwb-bg-dot.iwb-bg-swatch:hover { transform: none; }
.iwb-bg-palette-host { position: fixed; inset: 0; pointer-events: none; z-index: var(--iwb-z-palette); }
.iwb-bg-palette-host .iwb-pop-anchor { pointer-events: auto; }
.iwb-gc-grid { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; overflow: auto; max-height: 48vh; padding-right: 2px; }
.iwb-gc-item { flex: 0 0 auto; width: auto; min-width: max-content; max-width: 100%; display: flex; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid var(--iwb-border); border-radius: 10px; background: var(--iwb-panel); color: var(--iwb-text); font-size: 13px; cursor: pointer; white-space: nowrap; text-align: left; }
.iwb-gc-grid { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--iwb-pop-chip-gap); overflow: auto; max-height: 48vh; padding-right: var(--iwb-space-2); }
.iwb-gc-item { flex: 0 0 auto; width: auto; min-width: max-content; max-width: 100%; display: inline-flex; align-items: center; min-height: var(--iwb-pop-chip-h); gap: var(--iwb-space-6); padding: 0 var(--iwb-pop-chip-pad-x); font-size: var(--iwb-pop-chip-size); border-radius: var(--iwb-pop-chip-radius); border: 1px solid var(--iwb-border); background: var(--iwb-panel); color: var(--iwb-text); cursor: pointer; white-space: nowrap; text-align: left; }
.iwb-gc-name { white-space: nowrap; }
.iwb-gc-tick { margin-left: auto; color: var(--iwb-brand-text, var(--iwb-brand)); font-weight: 700; }
.iwb-gc-item:hover { border-color: var(--iwb-brand); color: var(--iwb-brand-text, var(--iwb-brand)); }
.iwb-gc-item-on { border-color: var(--iwb-brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--iwb-brand) 18%, transparent); }
.iwb-gc-item-err { border-color: var(--iwb-err); color: var(--iwb-err); }
.iwb-gc-empty { font-size: 12px; color: var(--iwb-text2); padding: 6px 2px; }
.iwb-gc-empty { font-size: var(--iwb-font-sm); color: var(--iwb-text2); padding: var(--iwb-space-6) var(--iwb-space-2); }
/* 节点上的模型触发器:节点宽度固定(480)时长名必须省略,否则会溢出压到「尺寸」按钮上。
(面板里的模型名永远完整显示:nowrap 且不设省略) */
.iwb-gen-settings .iwb-pick-genmodel { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@@ -1816,73 +1845,145 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
.iwb-confirm-title { font-weight: 650; font-size: 15px; margin-bottom: 8px; }
.iwb-confirm-text { font-size: var(--iwb-font-md); line-height: 1.65; color: var(--iwb-text2); white-space: pre-wrap; word-break: break-word; }
.iwb-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
/* 插件市场卡片(设置 → 插件 / 与 market.maqiart.eu.org 同一套视觉) */
.iwb-mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 4px 0 6px; }
.iwb-mk-head { display: flex; }
.iwb-mk-avatar { display: flex; align-items: center; justify-content: center; flex: 0 0 36px; }
.iwb-mk-name { display: flex; align-items: center; flex-wrap: wrap; }
.iwb-mk-desc { flex: 1 1 auto; }
.iwb-mk-tags { display: flex; flex-wrap: wrap; }
/* ── 插件管理 / 插件市场(M6 重做)───────────────────────────────────────
* 这一段原本是 v3.26.24 → v3.26.27 六次叠加的结果,读者要先在心里跑一遍层叠才知道最终值:
* .iwb-mk-list gap 写过 3 次(无 → 8 → 0) .iwb-mk-grid gap 写过 3 次(10 → 14 → 12)
* .iwb-mk-actions .iwb-btn 背景改过 4 次 .iwb-gset-page max-width 一改一撤
* M6 把它合成一份:布局写一次、视觉写一次,排版属性全部落闭集(M5 的 lint:tokens 对新增行
* 生效,这一段是按闸门要求写出来的第一个完整面板——案例见 docs/standards/design-tokens.md §5.2)。
* 顺带删掉 3 个全仓零引用的类(筛选条旧容器、绿色状态点、旧分隔条)。
*/
.iwb-gset-page { max-width: none; }
.iwb-gset-page-title { margin-bottom: var(--iwb-space-2); }
.iwb-mk-actions { display: flex; justify-content: flex-end; margin-top: 2px; }
/* 开关 */
/* 工具条:搜索框 + 标签筛选。用块面底色分区,不画线框 */
.iwb-mk-toolbar {
display: flex; flex-wrap: wrap; align-items: center; gap: var(--iwb-space-8);
background: var(--iwb-layer);
border: 1px solid color-mix(in srgb, var(--iwb-border) 45%, transparent);
border-radius: var(--iwb-radius-panel);
padding: var(--iwb-space-8) var(--iwb-space-10);
margin: var(--iwb-space-6) 0 var(--iwb-space-12);
}
.iwb-mk-toolbar .iwb-input { border: 0; background: var(--iwb-layer2); box-shadow: none; }
.iwb-mk-toolbar .iwb-input:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--iwb-brand) 22%, transparent); }
.iwb-mk-subtitle { font-size: var(--iwb-font-sm); color: var(--iwb-text2); margin: var(--iwb-space-2) 0 var(--iwb-space-10); }
/* 筛选胶囊:底色比工具条深一档,否则 layer 叠 layer 等于没有边界 */
.iwb-mk-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--iwb-space-6); margin: 0; }
.iwb-mk-chip {
cursor: pointer; border: 0;
background: var(--iwb-layer2); color: var(--iwb-text2);
padding: var(--iwb-space-4) var(--iwb-space-12);
border-radius: var(--iwb-radius-full);
font-size: var(--iwb-font-sm); line-height: 18px;
transition: background .12s ease, color .12s ease;
}
.iwb-mk-chip:hover { background: var(--iwb-hover); color: var(--iwb-text); }
.iwb-mk-chip.on { background: var(--iwb-text); color: var(--iwb-layer); }
/* 卡片墙:等高、底部对齐。悬停只变色不位移(同一屏里还有列表,两种形态靠形状区分) */
.iwb-mk-grid {
display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
gap: var(--iwb-space-12); margin: var(--iwb-space-4) 0 var(--iwb-space-6);
align-items: stretch;
}
.iwb-mk-card {
display: flex; flex-direction: column; gap: var(--iwb-space-10);
min-height: 168px; padding: var(--iwb-space-12);
background: var(--iwb-panel);
border: 1px solid color-mix(in srgb, var(--iwb-border) 55%, transparent);
border-radius: var(--iwb-radius-card);
transition: background .14s ease, border-color .14s ease;
}
.iwb-mk-card:hover { background: color-mix(in srgb, var(--iwb-layer) 55%, var(--iwb-panel)); border-color: color-mix(in srgb, var(--iwb-border2) 62%, transparent); }
/* 卡片头部:头像 + 名称/元信息,操作按钮落在 foot 右侧 */
.iwb-mk-head { display: flex; align-items: flex-start; gap: var(--iwb-space-8); }
.iwb-mk-avatar {
display: flex; align-items: center; justify-content: center;
flex: 0 0 32px; width: 32px; height: 32px;
border-radius: var(--iwb-radius-card); font-size: var(--iwb-font-xl);
}
.iwb-mk-titles { flex: 1 1 auto; min-width: 0; }
.iwb-mk-name { display: flex; align-items: center; flex-wrap: wrap; gap: var(--iwb-space-6); font-weight: 600; font-size: var(--iwb-font-md); line-height: 1.35; }
.iwb-mk-sub { font-size: var(--iwb-font-sm); color: var(--iwb-text2); margin-top: var(--iwb-space-2); }
.iwb-mk-badge {
padding: 0 var(--iwb-space-6);
border-radius: var(--iwb-radius-full);
font-size: var(--iwb-font-xs); line-height: 17px;
background: color-mix(in srgb, var(--iwb-ok) 14%, transparent);
color: color-mix(in srgb, var(--iwb-ok) 82%, var(--iwb-text));
border: 1px solid color-mix(in srgb, var(--iwb-ok) 32%, transparent);
}
.iwb-mk-desc {
flex: 1 1 auto; font-size: var(--iwb-font-sm); line-height: 1.55; color: var(--iwb-text2);
display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.iwb-mk-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--iwb-space-8); margin-top: auto; }
.iwb-mk-tags { display: flex; flex-wrap: wrap; align-items: center; gap: var(--iwb-space-4); }
.iwb-mk-tag {
border-radius: var(--iwb-radius-full);
background: var(--iwb-layer2); color: var(--iwb-text2);
font-size: var(--iwb-font-xs); line-height: 16px;
padding: 0 var(--iwb-space-6);
}
.iwb-mk-card .iwb-plugin-tag { font-size: var(--iwb-font-xs); padding: 0 var(--iwb-space-6); line-height: 16px; }
.iwb-mk-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--iwb-space-6); }
/* 卡片按钮:浅底无边框 —— panel 上的「按钮感」靠底色,不靠线框 */
.iwb-mk-actions .iwb-btn {
border: 0; box-shadow: none;
background: color-mix(in srgb, var(--iwb-tint) 6%, var(--iwb-panel));
transition: background .12s ease, color .12s ease;
}
.iwb-mk-actions .iwb-btn:hover { background: color-mix(in srgb, var(--iwb-tint) 11%, var(--iwb-panel)); }
.iwb-mk-actions .iwb-btn:active { background: color-mix(in srgb, var(--iwb-tint) 16%, var(--iwb-panel)); }
.iwb-mk-actions .iwb-btn-primary { background: var(--iwb-text); color: var(--iwb-layer); }
.iwb-mk-actions .iwb-btn-primary:hover { background: color-mix(in srgb, var(--iwb-tint) 86%, var(--iwb-layer)); }
/* 已安装列表:横线分隔、不套卡片(与卡片墙同屏并存时靠形态区分) */
.iwb-mk-list { display: flex; flex-direction: column; }
.iwb-mk-row {
display: flex; align-items: center; gap: var(--iwb-space-12);
padding: var(--iwb-space-12) var(--iwb-space-6);
border-bottom: 1px solid color-mix(in srgb, var(--iwb-border) 62%, transparent);
transition: background .12s ease;
}
.iwb-mk-row:last-child { border-bottom: 0; }
.iwb-mk-row:hover { background: color-mix(in srgb, var(--iwb-tint) 3%, transparent); }
.iwb-mk-row-main { flex: 1 1 auto; min-width: 0; }
.iwb-mk-row-title { display: flex; align-items: center; flex-wrap: wrap; gap: var(--iwb-space-8); }
.iwb-mk-row-name { font-weight: 600; font-size: var(--iwb-font-base); }
.iwb-mk-row-ver, .iwb-mk-row-author { color: var(--iwb-text2); font-size: var(--iwb-font-sm); }
.iwb-mk-row-desc { color: var(--iwb-text2); font-size: var(--iwb-font-sm); margin-top: var(--iwb-space-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iwb-mk-row-actions { display: flex; align-items: center; flex: 0 0 auto; gap: var(--iwb-space-6); }
.iwb-mk-row-actions .iwb-btn { box-shadow: none; transition: background .12s ease; }
.iwb-mk-row-actions .iwb-btn:hover { background: color-mix(in srgb, var(--iwb-tint) 10%, var(--iwb-panel)); }
/* 插件设置行:无外框只有分隔线;控件在上/在下由 stacked 决定整行竖排 */
.iwb-mk-setrow {
display: flex; align-items: center; gap: var(--iwb-space-16);
padding: var(--iwb-space-12) var(--iwb-space-2);
border: 0; border-bottom: 1px solid var(--iwb-border);
background: transparent; border-radius: 0; margin: 0;
}
.iwb-mk-setrow:last-of-type { border-bottom: 0; }
.iwb-mk-setrow-main { flex: 1 1 auto; min-width: 0; }
.iwb-mk-setrow-title { font-weight: 600; font-size: var(--iwb-font-base); line-height: 1.4; }
.iwb-mk-setrow .iwb-hint { margin-top: var(--iwb-space-4); line-height: 1.55; }
.iwb-mk-setrow-col { display: block; }
.iwb-mk-setrow-col > .iwb-mk-setrow-main { width: 100%; }
.iwb-mk-setrow-col > .iwb-input, .iwb-mk-setrow-col > .iwb-plugin-setting-custom { margin-top: var(--iwb-space-10); }
.iwb-plugin-setting-custom { display: block; min-width: 0; max-width: 100%; }
/* 开关:38×22 与滑块 18 是组件自身几何,没有闭集(width/height 本来就不在 lint 范围) */
.iwb-switch { display: inline-flex; align-items: center; cursor: pointer; flex: 0 0 auto; }
.iwb-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.iwb-switch-track { width: 38px; height: 22px; border-radius: 999px; background: var(--iwb-border); position: relative; transition: background .15s; }
.iwb-switch-dot { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--iwb-panel); transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.iwb-switch-track { width: 38px; height: 22px; border-radius: var(--iwb-radius-full); background: var(--iwb-border); position: relative; transition: background .15s; }
.iwb-switch-dot { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--iwb-panel); transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.iwb-switch input:checked + .iwb-switch-track { background: var(--iwb-brand); }
.iwb-switch input:checked + .iwb-switch-track .iwb-switch-dot { transform: translateX(16px); }
.iwb-switch input:disabled + .iwb-switch-track { opacity: .45; }
/* 已安装插件:横向列表 */
.iwb-mk-list { display: flex; flex-direction: column; }
.iwb-mk-row-main { flex: 1 1 auto; min-width: 0; }
.iwb-mk-row-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.iwb-mk-row-name { font-weight: 600; font-size: 14px; }
.iwb-mk-row-ver { color: var(--iwb-text2); font-size: 12px; }
.iwb-mk-row-author { color: var(--iwb-text2); font-size: 12px; }
.iwb-mk-row-desc { color: var(--iwb-text2); font-size: var(--iwb-font-sm); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iwb-mk-row-actions { display: flex; align-items: center; flex: 0 0 auto; }
.iwb-mk-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.iwb-mk-chip.on { border-color: var(--iwb-text); }
/* 插件设置:行(无边框盒子,只有细分隔线) */
.iwb-mk-setrow { display: flex; align-items: center; gap: 16px; padding: 14px 2px; border: 0; border-bottom: 1px solid var(--iwb-border); background: transparent; border-radius: 0; margin: 0; }
.iwb-mk-setrow:last-of-type { border-bottom: 0; }
.iwb-mk-setrow-main { flex: 1 1 auto; min-width: 0; }
.iwb-mk-setrow-title { font-weight: 600; font-size: 14px; line-height: 1.4; }
.iwb-mk-setrow .iwb-hint { margin-top: 3px; line-height: 1.55; }
/* 插件设置项:说明在上、控件在下(左对齐,2026-11-19)。
* 原来 label 在左、输入框挤在右边 260px,地址/书签这类内容既看不全也改不动;
* 布尔开关仍留在行末 —— 那是「开/关」,不是要填写的内容。 */
.iwb-mk-setrow-col { display: block; }
.iwb-mk-setrow-col > .iwb-mk-setrow-main { width: 100%; }
.iwb-mk-setrow-col > .iwb-input, .iwb-mk-setrow-col > .iwb-plugin-setting-custom { margin-top: 10px; }
.iwb-plugin-setting-custom { display: block; min-width: 0; max-width: 100%; }
/* 市场页筛选条 */
.iwb-mk-filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 12px; align-items: center; }
.iwb-mk-filters .iwb-mk-sep { width: 1px; height: 16px; background: var(--iwb-border); margin: 0 4px; }
/* 市场卡片:等高、底部按钮对齐 */
.iwb-mk-grid { align-items: stretch; }
.iwb-mk-card .iwb-mk-desc { flex: 1 1 auto; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.iwb-mk-card .iwb-mk-tags { align-items: center; }
.iwb-mk-card .iwb-mk-actions { margin-top: auto; display: flex; align-items: center; justify-content: flex-end; min-height: 30px; }
.iwb-mk-card .iwb-mk-name { line-height: 1.35; }
.iwb-mk-card .iwb-plugin-tag { font-size: 11px; padding: 0 6px; line-height: 16px; }
/* 市场卡片:紧凑版(按钮在右上角,去掉底部空档) */
.iwb-mk-head { align-items: flex-start; gap: 8px; }
.iwb-mk-titles { flex: 1 1 auto; min-width: 0; }
.iwb-mk-head .iwb-mk-actions { flex: 0 0 auto; margin: 0; padding: 0; min-height: 0; }
.iwb-mk-card .iwb-mk-avatar { width: 32px; height: 32px; flex: 0 0 32px; font-size: 17px; border-radius: 9px; }
/* 字号已与下方 .iwb-mk-name/.iwb-mk-sub 同档(13/12),原来这里用 13.5/11.5 覆盖,归并后是重复声明 */
.iwb-mk-card .iwb-mk-desc { font-size: 12px; line-height: 1.45; min-height: 0; margin-top: 2px; }
.iwb-mk-card .iwb-mk-tags { min-height: 0; margin-top: 2px; gap: 5px; }
.iwb-mk-card .iwb-mk-tag { font-size: var(--iwb-font-xs); padding: 0 7px; line-height: 16px; }
.iwb-mk-card .iwb-btn-sm { padding: 3px 10px; font-size: 12px; }
/* LLM 渠道:去掉外框,改成分区 + 细分隔线;默认渠道用左侧色条标记 */
.iwb-settings-modal .iwb-llm-card { border: 0; border-top: 1px solid var(--iwb-border); border-radius: 0; background: transparent; padding: var(--iwb-space-12) 0 var(--iwb-space-8); margin: 0; }
.iwb-settings-modal .iwb-llm-card:first-of-type { border-top: 0; }
@@ -2191,108 +2292,6 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
.iwb-dock-body[data-panel="groups"] .iwb-pcard:hover { background: var(--iwb-plugin-hover); border-color: var(--iwb-border2); }
.iwb-dock-body[data-panel="groups"] .iwb-pcard-selected { border-color: var(--iwb-brand); box-shadow: 0 0 0 1px var(--iwb-brand); }
/* ── v3.26.24 插件市场重设计:去线框、块面分区、按钮收敛 ───────────────── */
.iwb-set-page { max-width: 1180px; }
.iwb-mk-toolbar {
display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
background: var(--iwb-layer); border-radius: 12px; padding: 8px 10px; margin: 6px 0 12px;
}
.iwb-mk-toolbar .iwb-input { border: 0; background: var(--iwb-layer2); box-shadow: none; }
.iwb-mk-toolbar .iwb-input:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--iwb-brand) 22%, transparent); }
.iwb-mk-filters { margin: 0; gap: 6px; }
.iwb-mk-chip:hover { background: var(--iwb-layer2); color: var(--iwb-text); }
.iwb-mk-chip.on { background: var(--iwb-text); color: var(--iwb-layer); }
.iwb-mk-avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 17px; }
.iwb-mk-name { font-weight: 600; font-size: var(--iwb-font-md); }
.iwb-mk-sub { font-size: var(--iwb-font-sm); color: var(--iwb-text2); margin-top: 1px; }
.iwb-mk-desc { font-size: 12px; line-height: 1.55; color: var(--iwb-text2); }
.iwb-mk-dot {
width: 7px; height: 7px; border-radius: 50%; margin-left: 6px; flex: 0 0 auto;
background: var(--iwb-ok, #1d9e75); box-shadow: 0 0 0 2px color-mix(in srgb, var(--iwb-ok, #1d9e75) 22%, transparent);
}
.iwb-mk-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.iwb-mk-tags { gap: 4px; }
.iwb-mk-tag { border-radius: 999px; background: var(--iwb-layer2); color: var(--iwb-text2); font-size: var(--iwb-font-xs); padding: 1px 7px; }
.iwb-mk-actions { gap: 6px; }
.iwb-mk-actions .iwb-btn { border: 0; background: var(--iwb-layer2); box-shadow: none; }
.iwb-mk-subtitle { font-size: var(--iwb-font-sm); color: var(--iwb-text2); margin: 2px 0 10px; }
.iwb-set-page-title { margin-bottom: var(--iwb-space-2); }
/* ── v3.26.25 插件市场二次优化:自适应全宽 + 淡描边 + 已安装徽标(去绿色底) ── */
.iwb-set-page { max-width: none; }
.iwb-mk-card.is-installed { background: var(--iwb-panel); }
.iwb-mk-badge {
margin-left: 7px; padding: 0 7px; border-radius: 999px; font-size: var(--iwb-font-xs); line-height: 17px;
background: color-mix(in srgb, var(--iwb-ok, #1d9e75) 14%, transparent);
color: color-mix(in srgb, var(--iwb-ok, #1d9e75) 82%, var(--iwb-text));
border: 1px solid color-mix(in srgb, var(--iwb-ok, #1d9e75) 32%, transparent);
}
.iwb-mk-grid { grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 14px; }
.iwb-mk-toolbar { border: 1px solid color-mix(in srgb, var(--iwb-border) 45%, transparent); }
/* 管理页:行块面化、宽度自适应、操作列右对齐 */
.iwb-mk-list { display: flex; flex-direction: column; gap: 8px; }
.iwb-mk-row-actions { gap: 6px; }
/* ── v3.26.26 插件市场:补回按钮/卡片的“浮动”触感 ───────────────── */
.iwb-mk-actions .iwb-btn { transition: transform .12s ease, box-shadow .12s ease, background .12s ease; }
.iwb-mk-chip {
cursor: pointer;
border: 0;
background: var(--iwb-layer);
color: var(--iwb-text2);
padding: 4px 12px;
border-radius: 999px;
font-size: 12px;
line-height: 18px;
transition: transform .12s ease, background .12s ease, color .12s ease;
}
/* ── v3.26.27 插件市场/管理:去掉浮动,只保留颜色反馈;移除按钮给浅底;管理页回到横线分隔 ── */
.iwb-mk-card, .iwb-mk-card:hover, .iwb-mk-card:active { transform: none; }
.iwb-mk-card {
display: flex;
flex-direction: column;
border-radius: 14px;
padding: 14px;
gap: 10px;
min-height: 168px;
background: var(--iwb-panel);
border: 1px solid color-mix(in srgb, var(--iwb-border) 55%, transparent);
transition: background .14s ease, border-color .14s ease, box-shadow .14s ease;
box-shadow: none;
}
.iwb-mk-card:hover {
background: color-mix(in srgb, var(--iwb-layer) 55%, var(--iwb-panel));
border-color: color-mix(in srgb, var(--iwb-border2) 62%, transparent);
box-shadow: none;
}
/* 操作按钮:默认给浅底,看起来像按钮 */
.iwb-mk-actions .iwb-btn {
transform: none; box-shadow: none;
background: color-mix(in srgb, var(--iwb-tint) 6%, var(--iwb-panel));
transition: background .12s ease, color .12s ease;
}
.iwb-mk-actions .iwb-btn:hover {
transform: none; box-shadow: none;
background: color-mix(in srgb, var(--iwb-tint) 11%, var(--iwb-panel));
}
.iwb-mk-actions .iwb-btn:active { transform: none; box-shadow: none; background: color-mix(in srgb, var(--iwb-tint) 16%, var(--iwb-panel)); }
.iwb-mk-actions .iwb-btn-primary {
background: var(--iwb-text); color: var(--iwb-layer);
}
.iwb-mk-actions .iwb-btn-primary:hover { background: color-mix(in srgb, var(--iwb-tint) 86%, var(--iwb-layer)); box-shadow: none; }
.iwb-mk-chip, .iwb-mk-chip:hover, .iwb-mk-chip:active { transform: none; }
/* 管理页:横线分隔 + 悬停变色,不浮动 */
.iwb-mk-list { gap: 0; }
.iwb-mk-row { display: flex; align-items: center; gap: 12px; background: transparent; border-radius: 0; padding: 12px 6px; border-bottom: 1px solid color-mix(in srgb, var(--iwb-border) 62%, transparent); transform: none; box-shadow: none; transition: background .12s ease; }
.iwb-mk-row:last-child { border-bottom: 0; }
.iwb-mk-row:hover { background: color-mix(in srgb, var(--iwb-tint) 3%, transparent); transform: none; box-shadow: none; }
.iwb-mk-row-actions .iwb-btn { transform: none; box-shadow: none; transition: background .12s ease; }
.iwb-mk-row-actions .iwb-btn:hover { transform: none; box-shadow: none; background: color-mix(in srgb, var(--iwb-tint) 10%, var(--iwb-panel)); }
/* v3.26.38:未进入编辑态的节点正文不参与指针/文本选择 —— 单击=选中节点,双击=编辑 */
.iwb-node textarea[readonly], .iwb-node input[readonly] { pointer-events: none; }
@@ -2306,3 +2305,124 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
outline: var(--iwb-focus-ring);
outline-offset: 2px;
}
/* 生图服务:单栏多服务商(chips + 单份详情) */
.iwb-prov-chips{display:flex;flex-wrap:wrap;align-items:center;gap:var(--iwb-space-6);padding:var(--iwb-space-8);border:1px solid var(--iwb-border);border-radius:var(--iwb-radius-panel);background:var(--iwb-panel);margin-bottom:var(--iwb-space-12)}
.iwb-prov-chip{display:inline-flex;align-items:center;gap:var(--iwb-space-6);height:30px;padding:0 var(--iwb-space-10);border:1px solid transparent;border-radius:var(--iwb-radius-control);background:transparent;color:var(--iwb-text2);font-size:var(--iwb-font-sm);max-width:240px;cursor:pointer}
.iwb-prov-chip:hover{background:var(--iwb-layer)}
.iwb-prov-chip.on{background:color-mix(in srgb,var(--iwb-brand) 12%,transparent);border-color:color-mix(in srgb,var(--iwb-brand) 30%,var(--iwb-border));color:var(--iwb-text);font-weight:600}
.iwb-prov-chip-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.iwb-prov-chip-badge{font-size:var(--iwb-font-xs);line-height:16px;padding:0 var(--iwb-space-6);border-radius:var(--iwb-radius-full);background:var(--iwb-layer);color:var(--iwb-text2)}
.iwb-prov-add{margin-left:auto}
.iwb-prov-head{display:flex;align-items:center;gap:var(--iwb-space-8);flex-wrap:wrap}
.iwb-prov-name{flex:1 1 180px;min-width:140px;font-weight:600}
.iwb-prov-badge{font-size:var(--iwb-font-xs);line-height:18px;padding:0 var(--iwb-space-8);border-radius:var(--iwb-radius-full);background:color-mix(in srgb,var(--iwb-brand) 12%,transparent);color:var(--iwb-text)}
.iwb-prov-sum{font-size:var(--iwb-font-xs);color:var(--iwb-text2)}
.iwb-provider-card > .iwb-section-sub{margin-top:var(--iwb-space-8);padding-top:var(--iwb-space-8);border-top:1px solid var(--iwb-border)}
.iwb-shape-more{margin-top:var(--iwb-space-6)}
.iwb-shape-more > summary{cursor:pointer;font-size:var(--iwb-font-sm);color:var(--iwb-text2);padding:var(--iwb-space-6) 0}
@media (max-width:760px){.iwb-prov-add{margin-left:0}.iwb-prov-name{flex-basis:100%}}
/* 设置:窗口可缩放 + 通用页卡片化(主次文案分级) */
.iwb-settings-modal{position:relative;overflow:hidden;min-width:min(760px,96vw);min-height:480px}
.iwb-settings-modal .iwb-modal-body{overflow:auto}
.iwb-settings-modal .iwb-hint{font-size:var(--iwb-font-sm);line-height:1.45}
.iwb-gset-group{margin-top:var(--iwb-set-group-gap,var(--iwb-space-24))}
.iwb-gset-group:first-child{margin-top:0}
.iwb-gset-group-h{font-size:var(--iwb-font-lg);font-weight:600;margin:0 0 var(--iwb-space-8)}
.iwb-gset-row{display:grid;grid-template-columns:var(--iwb-set-label-w,180px) minmax(0,1fr);gap:var(--iwb-set-col-gap,var(--iwb-space-16));align-items:start;min-height:var(--iwb-set-row-h,40px);padding:var(--iwb-set-row-pad-y,var(--iwb-space-6)) 0}
.iwb-gset-row:first-of-type{border-top:0}
.iwb-gset-row-label{display:flex;flex-direction:column;gap:var(--iwb-space-2);font-size:var(--iwb-font-md);color:var(--iwb-text);padding-top:var(--iwb-space-2)}
.iwb-gset-row-ctl{display:flex;align-items:center;gap:var(--iwb-space-8);min-width:0;flex-wrap:wrap}
.iwb-gset-hint{font-size:var(--iwb-set-hint-size,var(--iwb-font-xs));color:var(--iwb-set-hint-color,var(--iwb-text-dim));line-height:1.45;margin:var(--iwb-set-hint-gap,var(--iwb-space-2)) 0 0 calc(var(--iwb-set-label-w,180px) + var(--iwb-set-col-gap,var(--iwb-space-16)))}
.iwb-gset-hint .iwb-more>div{margin-top:var(--iwb-space-4)}
.iwb-more>summary{cursor:pointer;font-size:var(--iwb-font-xs);color:var(--iwb-text2)}
@media (max-width:760px){.iwb-gset-row{grid-template-columns:1fr;gap:var(--iwb-space-4)}.iwb-gset-hint{margin-left:0}}
/* 设置窗口右下角缩放手柄(自定义,兼容 WKWebView) */
.iwb-settings-resize{position:absolute;right:4px;bottom:4px;width:16px;height:16px;cursor:nwse-resize;color:var(--iwb-text2);opacity:.55}
.iwb-settings-resize::after{content:'';position:absolute;right:2px;bottom:2px;width:10px;height:10px;border-right:2px solid currentColor;border-bottom:2px solid currentColor}
/* Obsidian 式设置列表:组标题 + 行分割线,无卡片框 */
.iwb-gset-page,.iwb-gset-stack{display:flex;flex-direction:column;gap:var(--iwb-set-group-gap)}
.iwb-gset-page > .iwb-gset-stack + .iwb-gset-card, .iwb-gset-page > .iwb-gset-card + .iwb-gset-card, .iwb-gset-stack > .iwb-gset-card + .iwb-gset-card{border-top:1px solid var(--iwb-set-divider);padding-top:var(--iwb-space-8)}
.iwb-gset-card{background:transparent;border:0;border-radius:0;padding:0;margin:0}
.iwb-gset-card-h{font-size:var(--iwb-font-lg);font-weight:600;margin:0 0 var(--iwb-set-title-gap,var(--iwb-space-8))}
.iwb-gset-card-desc{font-size:var(--iwb-set-hint-size,var(--iwb-font-xs));color:var(--iwb-set-hint-color,var(--iwb-text-dim));margin:0 0 var(--iwb-set-title-gap,var(--iwb-space-8))}
/* 设置分组(Obsidian 式):标题在页面底,内容浅灰圆角容器 */
.iwb-settings-modal{--iwb-set-group-bg:color-mix(in srgb, var(--iwb-layer) 60%, var(--iwb-panel));--iwb-set-group-radius:var(--iwb-radius-card);--iwb-set-group-pad-x:var(--iwb-space-20);--iwb-set-group-pad-y:var(--iwb-space-12);--iwb-set-group-gap:var(--iwb-space-32);--iwb-set-row-pad-y:var(--iwb-space-8);--iwb-set-divider:color-mix(in srgb, var(--iwb-border) 55%, transparent)}
.iwb-gset-page,.iwb-gset-stack{display:flex;flex-direction:column;gap:var(--iwb-set-group-gap)}
.iwb-gset-group{display:flex;flex-direction:column;margin:0}
.iwb-gset-group-h{font-size:var(--iwb-font-lg);font-weight:600;margin:0 0 var(--iwb-set-title-gap,var(--iwb-space-8))}
.iwb-gset-group-desc{font-size:var(--iwb-set-hint-size,var(--iwb-font-xs));color:var(--iwb-set-hint-color,var(--iwb-text-dim));margin:calc(var(--iwb-set-title-gap,var(--iwb-space-8)) * -1) 0 var(--iwb-set-title-gap,var(--iwb-space-8))}
.iwb-gset-group-body{background:var(--iwb-set-group-bg,var(--iwb-layer));border-radius:var(--iwb-set-group-radius,var(--iwb-radius-card));padding:0 var(--iwb-set-group-pad-x,var(--iwb-space-20)) var(--iwb-space-4)}
.iwb-gset-row{display:grid;grid-template-columns:var(--iwb-set-label-w,180px) minmax(0,1fr);gap:var(--iwb-set-col-gap,var(--iwb-space-16));align-items:start;min-height:var(--iwb-set-row-h,40px);padding:var(--iwb-set-row-pad-y,var(--iwb-space-8)) 0;border-top:1px solid var(--iwb-set-divider,var(--iwb-border));margin:0}
.iwb-gset-group-body > .iwb-gset-row:first-child,.iwb-gset-group-body > div > .iwb-gset-row:first-child{border-top:0}
.iwb-gset-hint{font-size:var(--iwb-set-hint-size,var(--iwb-font-xs));color:var(--iwb-set-hint-color,var(--iwb-text-dim));line-height:1.45;margin:var(--iwb-set-hint-gap,var(--iwb-space-2)) 0 var(--iwb-space-6) calc(var(--iwb-set-label-w,180px) + var(--iwb-set-col-gap,var(--iwb-space-16)))}
/* 组标题与内容容器内的文字左对齐 */
.iwb-gset-group-h,.iwb-gset-group-desc{padding-left:var(--iwb-set-group-pad-x,var(--iwb-space-20))}
/* 外观页:沿用设置面板分组 token */
.iwb-appear{display:flex;flex-direction:column;gap:var(--iwb-set-group-gap)}
.iwb-appear .iwb-gset-group-body .iwb-appear-row{display:grid;grid-template-columns:var(--iwb-set-label-w,180px) minmax(0,1fr) auto;gap:var(--iwb-set-col-gap,var(--iwb-space-16));align-items:center;min-height:var(--iwb-set-row-h,40px);padding:var(--iwb-set-row-pad-y,var(--iwb-space-8)) 0;border-top:1px solid var(--iwb-set-divider);margin:0}
.iwb-appear .iwb-gset-group-body .iwb-appear-row:first-child{border-top:0}
.iwb-appear-label{font-size:var(--iwb-font-md);color:var(--iwb-text);text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* 生图服务:详情不再用卡片,改为多组 gray body */
.iwb-provider-card{background:transparent!important;border:0!important;border-radius:0!important;padding:0!important;display:flex;flex-direction:column;gap:var(--iwb-set-group-gap)}
.iwb-provider-card .iwb-gset-group-body > .iwb-row{padding:var(--iwb-set-row-pad-y,var(--iwb-space-8)) 0;margin:0}
.iwb-provider-card .iwb-gset-group-body > .iwb-row .iwb-addr-tag{min-width:42px}
/* 设置页控件描边:比常规 border 更淡,避免框线抢视线 */
.iwb-settings-modal{--iwb-set-input-border:color-mix(in srgb, var(--iwb-border) 40%, var(--iwb-panel))}
.iwb-settings-modal .iwb-input,.iwb-settings-modal .iwb-textarea{border-color:var(--iwb-set-input-border)}
.iwb-settings-modal .iwb-input:focus,.iwb-settings-modal .iwb-textarea:focus{border-color:var(--iwb-brand)}
/* 模型行:删除收进「⋯」更多菜单,防误触 */
.iwb-model-more{position:relative;display:inline-flex;flex:0 0 auto}
.iwb-model-more>summary{list-style:none;cursor:pointer;width:24px;height:24px;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--iwb-radius-control);color:var(--iwb-text2);font-size:var(--iwb-font-lg);line-height:1}
.iwb-model-more>summary::-webkit-details-marker{display:none}
.iwb-model-more>summary:hover{background:var(--iwb-hover)}
.iwb-model-more-menu{position:absolute!important;right:0;left:auto;top:calc(100% + var(--iwb-space-4));min-width:132px;max-width:none;max-height:none;overflow:visible;padding:var(--iwb-space-4);border-radius:var(--iwb-radius-control)}
.iwb-model-more-del{width:100%;text-align:left;border:0;background:transparent;color:var(--iwb-err);font-size:var(--iwb-font-sm);padding:var(--iwb-space-6) var(--iwb-space-8);border-radius:var(--iwb-radius-chip);cursor:pointer}
.iwb-model-more-del:hover{background:color-mix(in srgb,var(--iwb-err) 10%,transparent)}
.iwb-model-more-hint{padding:var(--iwb-space-6) var(--iwb-space-8);font-size:var(--iwb-font-xs);color:var(--iwb-text2)}
/* 设置页统一:所有分组块间距只允许用 --iwb-set-group-gap */
.iwb-settings-modal .iwb-provider-card{gap:var(--iwb-set-group-gap)}
/* 设置页通用:灰色容器内的行分隔与 LLM 渠道块 */
.iwb-gset-group-body > .iwb-row{padding:var(--iwb-set-row-pad-y,var(--iwb-space-8)) 0;margin:0;border-top:1px solid var(--iwb-set-divider,var(--iwb-border))}
.iwb-gset-group-body > .iwb-row:first-child{border-top:0}
.iwb-settings-modal .iwb-llm-card{background:var(--iwb-set-group-bg);border:0;border-radius:var(--iwb-set-group-radius);padding:var(--iwb-space-16)}
.iwb-settings-modal .iwb-llm-card + .iwb-llm-card{margin-top:var(--iwb-set-group-gap)}
/* 备份页:内嵌组件融入设置分组,不再自己画卡片 */
.iwb-settings-modal .iwb-backup-embedded{max-width:none}
.iwb-settings-modal .iwb-backup-embedded .iwb-modal-body{gap:0}
.iwb-settings-modal .iwb-backup-sec{border:0;border-radius:0;background:transparent;padding:0}
.iwb-settings-modal .iwb-backup-sec + .iwb-backup-sec{margin-top:var(--iwb-space-8);padding-top:var(--iwb-space-8);border-top:1px solid var(--iwb-set-divider)}
.iwb-settings-modal .iwb-backup-sec-title{font-size:var(--iwb-font-sm);color:var(--iwb-text2);font-weight:600;margin-bottom:var(--iwb-space-4)}
.iwb-settings-modal .iwb-gset-group-body > .iwb-section{border:0;padding:0;margin:0}
/* 分组容器内首/末元素不吃外边距,上下内边距由 --iwb-set-group-pad-y 统一 */
.iwb-gset-group-body > :first-child{margin-top:0}
.iwb-gset-group-body > :last-child{margin-bottom:0}
.iwb-settings-modal .iwb-modellist{margin:0}
/* 分组容器:上下内边距与左右同样由 token 控制;底色取 4% 文字色,保证可见但不抢 */
.iwb-settings-modal{--iwb-set-group-bg:hsl(0 0% 97.6%)}
.theme-dark .iwb-settings-modal{--iwb-set-group-bg:color-mix(in srgb, var(--iwb-text) 8%, var(--iwb-panel))}
.iwb-gset-group-body{background:var(--iwb-set-group-bg);padding:var(--iwb-set-group-pad-y) var(--iwb-set-group-pad-x)}
/* 设置页控件统一:复选框尺寸/品牌色、按钮组间距 */
.iwb-settings-modal{--iwb-set-check-size:16px;--iwb-set-btn-gap:var(--iwb-space-8);--iwb-set-check-radius:4px}
.iwb-settings-modal input[type="checkbox"]{width:var(--iwb-set-check-size);height:var(--iwb-set-check-size);accent-color:var(--iwb-brand);border-radius:var(--iwb-set-check-radius)}
.iwb-settings-modal .iwb-backup-item{padding:var(--iwb-space-6) 0;gap:var(--iwb-space-8)}
.iwb-settings-modal .iwb-backup-actions{gap:var(--iwb-set-btn-gap)}
.iwb-settings-modal .iwb-backup-actions .iwb-btn,.iwb-settings-modal .iwb-backup-sec .iwb-btn{height:var(--iwb-control-h)}
/* 备份页嵌在设置里:去掉内层弹窗的滚动/最大高度,统一由设置 body 滚动 */
.iwb-settings-modal .iwb-backup-embedded .iwb-modal-body{max-height:none;overflow:visible}
+326 -1
View File
@@ -10,7 +10,9 @@
// npx playwright test _visual-tokens --update-snapshots # 首次生成/确认变更
// npx playwright test _visual-tokens # 比对(0 diff 才算过)
//
// 6 个场景 × 亮/暗 = 12 张,覆盖「壳层 / 画布 / 浮层 / 抽屉 / 插件面板 / 右键菜单」六类界面。
// 8 个场景 × 亮/暗 = 16 张,覆盖「壳层 / 画布 / 浮层 / 抽屉 / 插件面板 / 右键菜单 /
// 插件管理 / 插件市场」八类界面。⑦⑧ 是 M6 重做插件面板时补的:那一整段样式此前**没有基线**,
// 六次叠加的改动全靠人眼看,等于最乱的地方最没保护。
// 稳定化:固定 1280×800 + deviceScaleFactor 1、animations disabled、caret hide、等字体与两帧。
const { test, expect } = require('./_pw-coverage')
@@ -110,6 +112,188 @@ async function openRightDock(page) {
await page.waitForTimeout(400) // 插件面板挂载是异步的(pluginMount effect)
}
// ── ⑦⑧ 组件夹具 ────────────────────────────────────────────────────────
// 为什么不用整页截图:插件管理/市场这一屏由 DesktopPluginsTab 渲染,而它在
// `isDesk()` 为 false 时(网页 e2e 环境)走的是另一条分支(.iwb-plugin-row 清单),
// 这条最乱的样式反而截不到。夹具用同一套类名 + 真实 dist/style.css 渲染,
// 覆盖「设置行 / 列表行 / 开关 / 工具条 / 筛选胶囊 / 卡片」六种形态。
const PANEL_HTML = `
<div id="stage" style="background:var(--iwb-bg);padding:20px 24px">
<div class="iwb-modal-body" style="max-width:none">
<div class="iwb-set-page">
<div class="iwb-set-page-title">插件</div>
<div class="iwb-mk-setrow">
<div class="iwb-mk-setrow-main">
<div class="iwb-mk-setrow-title">插件市场</div>
<div class="iwb-hint">浏览并安装由官方 / 社区制作的插件</div>
</div>
<button class="iwb-btn iwb-btn-sm">浏览</button>
</div>
<div class="iwb-mk-setrow">
<div class="iwb-mk-setrow-main">
<div class="iwb-mk-setrow-title">插件安装情况</div>
<div class="iwb-hint">你目前已经安装了 8 个插件,其中 2 个可更新</div>
</div>
<button class="iwb-btn iwb-btn-sm">检查更新</button>
</div>
<div class="iwb-mk-setrow">
<div class="iwb-mk-setrow-main">
<div class="iwb-mk-setrow-title">开发者模式</div>
<div class="iwb-hint">加载 plugins/local/&lt;id&gt;/plugin.js(未签名,仅本地调试)</div>
</div>
<label class="iwb-switch"><input type="checkbox" checked><span class="iwb-switch-track"><span class="iwb-switch-dot"></span></span></label>
</div>
<div class="iwb-section-sub">已安装插件</div>
<div class="iwb-mk-list">
<div class="iwb-mk-row">
<span class="iwb-mk-avatar" style="background:#dbeafe">✎</span>
<div class="iwb-mk-row-main">
<div class="iwb-mk-row-title">
<span class="iwb-mk-row-name">标注 / 修图</span>
<span class="iwb-mk-row-ver">v1.20.7</span>
<span class="iwb-mk-row-author">官方</span>
<span class="iwb-plugin-tag">已加载</span>
</div>
<div class="iwb-mk-row-desc">在图片上画箭头、文字、马赛克,支持批量导出</div>
</div>
<div class="iwb-mk-row-actions">
<button class="iwb-btn iwb-btn-sm">设置</button>
<button class="iwb-btn iwb-btn-sm">移除</button>
<label class="iwb-switch"><input type="checkbox" checked disabled><span class="iwb-switch-track"><span class="iwb-switch-dot"></span></span></label>
</div>
</div>
<div class="iwb-mk-row">
<span class="iwb-mk-avatar" style="background:#dcfce7">◈</span>
<div class="iwb-mk-row-main">
<div class="iwb-mk-row-title">
<span class="iwb-mk-row-name">位图转矢量</span>
<span class="iwb-mk-row-ver">v0.6.1</span>
<span class="iwb-mk-row-author">官方</span>
<span class="iwb-plugin-tag iwb-plugin-tag-warn">未加载</span>
</div>
<div class="iwb-mk-row-desc">把位图描成 SVG,可调颜色数量与平滑度</div>
</div>
<div class="iwb-mk-row-actions">
<button class="iwb-btn iwb-btn-sm">设置</button>
<button class="iwb-btn iwb-btn-sm">移除</button>
<label class="iwb-switch"><input type="checkbox"><span class="iwb-switch-track"><span class="iwb-switch-dot"></span></span></label>
</div>
</div>
<div class="iwb-mk-row">
<span class="iwb-mk-avatar" style="background:#fef3c7">⇩</span>
<div class="iwb-mk-row-main">
<div class="iwb-mk-row-title">
<span class="iwb-mk-row-name">批量导出</span>
<span class="iwb-mk-row-ver">v1.2.1</span>
<span class="iwb-mk-row-author">官方</span>
<span class="iwb-plugin-tag">可更新</span>
</div>
<div class="iwb-mk-row-desc">按预设尺寸批量导出,支持透明 PNG 与白底 JPG 双版本</div>
</div>
<div class="iwb-mk-row-actions">
<button class="iwb-btn iwb-btn-sm">更新</button>
<button class="iwb-btn iwb-btn-sm">设置</button>
<button class="iwb-btn iwb-btn-sm">移除</button>
<label class="iwb-switch"><input type="checkbox" checked><span class="iwb-switch-track"><span class="iwb-switch-dot"></span></span></label>
</div>
</div>
</div>
</div>
</div>
</div>`
const MARKET_HTML = `
<div id="stage" style="background:var(--iwb-bg);padding:20px 24px">
<div class="iwb-modal-body" style="max-width:none">
<div class="iwb-set-page">
<div class="iwb-set-page-title">插件市场</div>
<div class="iwb-mk-subtitle">共 4 个插件 · 资料目录/plugins/</div>
<div class="iwb-mk-toolbar">
<input class="iwb-input iwb-grow" placeholder="搜索插件,例如:出图、抠图、矢量…">
<div class="iwb-mk-filters">
<button class="iwb-mk-chip on">标注</button>
<button class="iwb-mk-chip">修图</button>
<button class="iwb-mk-chip">矢量</button>
<button class="iwb-mk-chip">导出</button>
</div>
</div>
<div class="iwb-mk-filters">
<button class="iwb-mk-chip on">全部 4</button>
<button class="iwb-mk-chip">已安装 2</button>
<button class="iwb-mk-chip">未安装 2</button>
</div>
<div class="iwb-mk-grid">
<div class="iwb-mk-card">
<div class="iwb-mk-head">
<span class="iwb-mk-avatar" style="background:#dbeafe">✎</span>
<div class="iwb-mk-titles">
<div class="iwb-mk-name">标注 / 修图<span class="iwb-mk-badge">已安装</span></div>
<div class="iwb-mk-sub">官方 · v1.20.7 · 442 KB</div>
</div>
</div>
<div class="iwb-mk-desc">在图片上画箭头、文字、马赛克,支持批量导出</div>
<div class="iwb-mk-foot">
<div class="iwb-mk-tags"><span class="iwb-mk-tag">标注</span><span class="iwb-mk-tag">修图</span></div>
<div class="iwb-mk-actions"><button class="iwb-btn iwb-btn-sm">移除</button></div>
</div>
</div>
<div class="iwb-mk-card">
<div class="iwb-mk-head">
<span class="iwb-mk-avatar" style="background:#dcfce7">◈</span>
<div class="iwb-mk-titles">
<div class="iwb-mk-name">位图转矢量</div>
<div class="iwb-mk-sub">官方 · v0.6.1 · 143 KB</div>
</div>
</div>
<div class="iwb-mk-desc">把位图描成 SVG,可调颜色数量与平滑度</div>
<div class="iwb-mk-foot">
<div class="iwb-mk-tags"><span class="iwb-mk-tag">矢量</span></div>
<div class="iwb-mk-actions"><button class="iwb-btn iwb-btn-sm iwb-btn-primary">安装</button></div>
</div>
</div>
<div class="iwb-mk-card">
<div class="iwb-mk-head">
<span class="iwb-mk-avatar" style="background:#fef3c7">⇩</span>
<div class="iwb-mk-titles">
<div class="iwb-mk-name">批量导出</div>
<div class="iwb-mk-sub">官方 · v1.2.1 · 44 KB</div>
</div>
</div>
<div class="iwb-mk-desc">按预设尺寸批量导出,支持透明 PNG 与白底 JPG 双版本</div>
<div class="iwb-mk-foot">
<div class="iwb-mk-tags"><span class="iwb-mk-tag">导出</span><span class="iwb-mk-tag">批处理</span></div>
<div class="iwb-mk-actions"><button class="iwb-btn iwb-btn-sm">移除</button></div>
</div>
</div>
<div class="iwb-mk-card">
<div class="iwb-mk-head">
<span class="iwb-mk-avatar" style="background:#f3e8ff">◐</span>
<div class="iwb-mk-titles">
<div class="iwb-mk-name">风格来源</div>
<div class="iwb-mk-sub">社区 · v1.3.3 · 69 KB</div>
</div>
</div>
<div class="iwb-mk-desc">从参考图提取配色与风格关键词</div>
<div class="iwb-mk-foot">
<div class="iwb-mk-tags"><span class="iwb-mk-tag">风格</span></div>
<div class="iwb-mk-actions"><button class="iwb-btn iwb-btn-sm iwb-btn-primary">安装</button></div>
</div>
</div>
</div>
</div>
</div>
</div>`
async function bootPanel(page, theme, html) {
await page.goto('about:blank')
await page.setContent(html, { waitUntil: 'domcontentloaded' })
await page.addStyleTag({ path: require('node:path').join(__dirname, '..', 'dist', 'style.css') })
// 夹具里所有过渡必须彻底关掉:开关的 .15s 背景过渡在截图时可能停在最后一帧,
// 两次截图差 1~3 级灰度、只有几个像素,却会让 threshold:0 的基线变成随机红灯。
await page.addStyleTag({ content: '*,*::before,*::after{transition:none!important;animation:none!important}' })
await page.evaluate((t) => { document.documentElement.classList.toggle('theme-dark', t === 'dark') }, theme)
}
for (const theme of ['light', 'dark']) {
test.describe('视觉基线 · ' + theme, () => {
test('① 首页', async ({ page }) => {
@@ -151,5 +335,146 @@ for (const theme of ['light', 'dark']) {
await expect(page.locator('.iwb-ctxmenu').first()).toBeVisible()
await shot(page, '06-ctxmenu-' + theme)
})
test('⑦ 插件管理(设置行 + 列表 + 开关)', async ({ page }) => {
await bootPanel(page, theme, PANEL_HTML)
await shot(page, '07-plugins-manage-' + theme)
})
test('⑧ 插件市场(工具条 + 筛选 + 卡片墙)', async ({ page }) => {
await bootPanel(page, theme, MARKET_HTML)
await shot(page, '08-plugins-market-' + theme)
})
})
}
// ── ⑨⑩ 提示词库弹窗夹具 ───────────────────────────────────────────────
// 真实对话框由插件 JS 生成、依赖 Tauri 宿主,网页环境点不出来;这里用同一套类名 +
// 真实 dist/style.css + plugins/promptlib/styles.css 渲染,做「编辑 / 详情」两屏基线。
// 只覆盖静态外观:不测交互逻辑(交互由 tests/plugin-promptlib-render-test.js 守)。
const PLP_EDIT_HTML = `
<div id="stage" style="background:var(--iwb-bg);padding:24px;display:flex;justify-content:center">
<div class="iwb-plp-dialog iwb-plp-dialog-edit" style="position:relative;margin:0;width:1180px;height:700px;display:flex;flex-direction:column">
<div class="iwb-plp-dhead"><span class="iwb-plp-grip"></span><span class="iwb-toolbar-title">编辑提示词</span><span class="iwb-drawer-spacer"></span><button class="iwb-btn iwb-btn-sm">取消</button><button class="iwb-btn iwb-btn-primary iwb-btn-sm">保存</button></div>
<div class="iwb-plp-dbody">
<div class="iwb-plp-eleft">
<div class="iwb-plp-ecov"></div>
<div class="iwb-plp-lrow"><span>名称</span><textarea class="iwb-input iwb-plp-namebox">女生喜欢的小红书封面</textarea></div>
<div class="iwb-plp-lrow"><span>分组</span><input class="iwb-input" value="小红书"></div>
<div class="iwb-plp-lrow iwb-plp-lrow-tags"><span>标签</span><div class="iwb-plp-tagwrap"><div class="iwb-plp-tagchips"><span class="iwb-plp-tagchip">收藏<i class="iwb-plp-tagx">×</i></span></div><div class="iwb-plp-tagrow"><input class="iwb-input iwb-plp-tagin" placeholder="添加标签"><button class="iwb-plp-tagadd">+</button></div></div></div>
</div>
<div class="iwb-plp-emid">
<div class="iwb-plp-etool"><button class="iwb-btn iwb-btn-sm iwb-plp-insvar">+ 插入变量</button><span class="iwb-hint">在光标处插入 {变量},并自动聚焦变量名</span></div>
<div class="iwb-plp-ewrap"><div class="iwb-plp-hl">参考图片内容,保持图片内容一致性,{写实摄影} 风格,符合{女生} 喜好</div><textarea class="iwb-input iwb-plp-etext">参考图片内容,保持图片内容一致性,{写实摄影} 风格,符合{女生} 喜好</textarea></div>
</div>
<div class="iwb-plp-esplit"></div>
<div class="iwb-plp-eright">
<div class="iwb-plp-vars"><div class="iwb-plp-vhead"><span>变量</span><span class="iwb-plp-vhint">与正文双向同步 · 点 i 写说明</span></div><div class="iwb-plp-vrows">
<div class="iwb-plp-vitem"><div class="iwb-plp-vrow2"><input class="iwb-input iwb-plp-vname" value="写实摄影"><button class="iwb-plp-vi is-open">i</button></div><input class="iwb-input iwb-plp-vdesc" value="写实摄影风格"></div>
<div class="iwb-plp-vitem"><div class="iwb-plp-vrow2"><input class="iwb-input iwb-plp-vname" value="女生"><button class="iwb-plp-vi">i</button></div></div>
<div class="iwb-plp-vitem"><div class="iwb-plp-vrow2"><input class="iwb-input iwb-plp-vname" value="价格与利益点"><button class="iwb-plp-vi">i</button></div></div>
</div></div>
</div>
</div>
<div class="iwb-plp-dfooter"><button class="iwb-btn iwb-btn-sm">另存副本</button><span class="iwb-drawer-spacer"></span><button class="iwb-btn iwb-btn-sm">插入画布</button><button class="iwb-btn iwb-btn-primary iwb-btn-sm">保存</button></div>
</div>
</div>`
const PLP_DETAIL_HTML = `
<div id="stage" style="background:var(--iwb-bg);padding:24px;display:flex;justify-content:center">
<div class="iwb-plp-dialog iwb-plp-dialog-detail" style="position:relative;margin:0;width:1180px;height:700px;display:flex;flex-direction:column">
<div class="iwb-plp-dhead"><span class="iwb-plp-grip"></span><span class="iwb-toolbar-title">提示词详情</span><span class="iwb-drawer-spacer"></span><button class="iwb-btn iwb-btn-sm">编辑</button><button class="iwb-btn iwb-btn-sm">✕</button></div>
<div class="iwb-plp-dbody">
<div class="iwb-plp-dleftcol">
<div class="iwb-plp-dcov"></div>
<div class="iwb-plp-dtitle">女生喜欢的小红书封面</div>
<div class="iwb-plp-dmeta">
<div class="iwb-plp-dmrow"><span class="iwb-plp-dmk">分组:</span><div class="iwb-plp-dmv"><span class="iwb-plp-dgroup">小红书</span></div></div>
<div class="iwb-plp-dmrow"><span class="iwb-plp-dmk">标签:</span><div class="iwb-plp-dmv"><span class="iwb-plp-dtag">#收藏</span></div></div>
<div class="iwb-plp-dmrow"><span class="iwb-plp-dmk">字数:</span><div class="iwb-plp-dmv"><span class="iwb-plp-dlen">119 字</span></div></div>
</div>
</div>
<div class="iwb-plp-dright">
<div class="iwb-plp-dsec">提示词内容</div>
<div class="iwb-plp-dtext">参考图片内容,保持图片内容一致性,商品图片保持包装一致,修改图片的风格为小红书封面风格,<span class="iwb-plp-dvar">{写实摄影}</span> 风格,书写标题字,手绘辅助装饰及辅助文案,符合<span class="iwb-plp-dvar">{女生}</span> 喜好的配色,突出<span class="iwb-plp-dvar">{价格与利益点}</span>,画面简洁,不需要给产品配名称,符合品牌的调性。</div>
</div>
</div>
<div class="iwb-plp-dfooter"><button class="iwb-btn iwb-btn-sm iwb-btn-danger">删除</button><span class="iwb-drawer-spacer"></span><button class="iwb-btn iwb-btn-sm">复制全文</button><button class="iwb-btn iwb-btn-sm">插入模板节点</button><button class="iwb-btn iwb-btn-sm">插入图片</button><button class="iwb-btn iwb-btn-primary iwb-btn-sm">插入画布</button></div>
</div>
</div>`
async function bootPromptlib (page, theme, html) {
await bootPanel(page, theme, html)
await page.addStyleTag({ path: require('node:path').join(__dirname, '..', 'dist', 'plugins', 'promptlib', 'styles.css') })
await page.waitForTimeout(50)
}
for (const theme of ['light', 'dark']) {
test.describe('视觉基线 · promptlib · ' + theme, () => {
test('⑨ 提示词编辑弹窗', async ({ page }) => {
await bootPromptlib(page, theme, PLP_EDIT_HTML)
await shot(page, '09-promptlib-edit-' + theme)
})
test('⑩ 提示词详情弹窗', async ({ page }) => {
await bootPromptlib(page, theme, PLP_DETAIL_HTML)
await shot(page, '10-promptlib-detail-' + theme)
})
})
}
// ── ⑪ 生图服务设置(多服务商 · 单栏切换) ─────────────────────────────
// 设置页入口在网页环境是左下角导航齿轮(.iwb-nav-item[title="设置"]);
// 这里预置两个服务商,验证 chips + 单份详情的视觉基线。
const SETTINGS_CFG = {
providers: [
{
id: 'p-visual-a', name: 'TuZi', baseUrl: 'https://apicdn.tu-zi.com/v1',
fallbacks: ['https://apius.tu-zi.com/v1'], genPath: '/images/generations', editPath: '/images/edits',
keys: [{ id: 'k1', name: 'Key', value: '', masked: 'sk-••••tCZT' }],
models: [{ name: 'gpt-image-2-1k', visible: true }, { name: 'gpt-image-2', visible: true }],
layerModels: [],
},
{ id: 'p-visual-b', name: '即梦 Dreamina', baseUrl: 'https://x.example/v1', fallbacks: [], keys: [], models: [] },
],
canvas: {},
}
async function bootSettings (page, theme) {
await page.addInitScript(({ cfg, theme }) => {
localStorage.clear()
localStorage.setItem('iwb_web_cfg', JSON.stringify(cfg))
localStorage.setItem('iwb_theme', theme)
}, { cfg: SETTINGS_CFG, theme })
await page.goto('/', { waitUntil: 'domcontentloaded' })
await page.evaluate(() => { const el = document.querySelector('.iwb-nav-item[title="设置"]'); if (el) el.click() })
await expect(page.locator('.iwb-prov-chip').first()).toBeVisible({ timeout: 15000 })
await expect(page.locator('.iwb-provider-card')).toHaveCount(1)
await settle(page)
}
for (const theme of ['light', 'dark']) {
test.describe('视觉基线 · 设置 · ' + theme, () => {
test('⑪ 生图服务(多服务商)', async ({ page }) => {
await bootSettings(page, theme)
await shot(page, '11-provider-settings-' + theme)
})
})
}
// ── ⑫ 通用设置(卡片化重排) ─────────────────────────────────────────
for (const theme of ['light', 'dark']) {
test.describe('视觉基线 · 通用设置 · ' + theme, () => {
test('⑫ 通用(数据/图片/生成/版本)', async ({ page }) => {
await bootSettings(page, theme)
await page.locator('.iwb-tab', { hasText: '通用' }).first().click()
await expect(page.locator('.iwb-gset-group-body').first()).toBeVisible({ timeout: 15000 })
await shot(page, '12-general-settings-' + theme)
})
})
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

+95
View File
@@ -0,0 +1,95 @@
'use strict'
// 设计 token 棘轮 + 完整性守卫(M5-T5.2 / T5.3)
//
// 为什么是「棘轮」而不是「全清零」:M4 结束时 style.css 里还有 170 处写死字号、415 处写死间距,
// 一次清零等于重写一遍样式表。棘轮把「数字不许涨」变成机械规则,迁移可以分版本做,
// 而**新代码**从今天起不可能再增加存量(涨一个就红)。
//
// 数字口径唯一来源是 scripts/token-audit.js --json —— 这里不重新实现一遍正则:
// 两套口径一旦漂移,就会变成「守卫绿、审计红」这种最难查的分歧。
//
// 三条断言:
// A. 每一项计数 ≤ tests/fixtures/token-baseline.json(只降不升)
// B. 引用了但从未定义的变量 = 0(`var(--iwb-radius-pill)` 这种拼错必须当场红,
// 而不是等到浏览器里那条声明静默失效)
// C. 没有 `var(--x, var(--x))` 自我兜底 —— 兜底值等于引用值,等于「失效时再失效一次」,
// 既掩盖问题又没有默认值可用
const assert = require('assert')
const fs = require('fs')
const path = require('path')
const { execFileSync } = require('child_process')
const root = path.resolve(__dirname, '..')
const baseline = JSON.parse(fs.readFileSync(path.join(root, 'tests', 'fixtures', 'token-baseline.json'), 'utf8'))
const audit = JSON.parse(execFileSync(process.execPath, [path.join(root, 'scripts', 'token-audit.js'), '--json'], { cwd: root, encoding: 'utf8', maxBuffer: 32 * 1024 * 1024 }))
const now = {
undefinedRefs: audit.undefinedRefs.length,
deadTokens: audit.deadTokens.length,
hex: audit.hard['十六进制色值'],
rgb: audit.hard['rgba()/rgb()'],
fontSize: audit.hard['font-size 写死'],
radius: audit.hard['border-radius 写死'],
spacing: audit.hard['padding/margin/gap 写死'],
zIndexDecl: audit.hard['z-index 声明'],
fontSizeDistinct: audit.fontSizes.distinct.length,
radiusDistinct: audit.radii.distinct.length,
spacingDistinct: audit.spacings.distinct.length,
zIndexDistinct: audit.zindex.distinct.length,
shadowDistinct: audit.shadows.distinct
}
// ── A. 只降不升 ──
// 基线里有的项必须都在(防手滑删项让某项「凭空消失」),当前也必须有同名项(防改名后静默跳过)
assert.deepStrictEqual(
Object.keys(now).sort(),
Object.keys(baseline.counts).sort(),
'棘轮口径与基线键不一致:审计脚本加了/改了指标却没更新基线(或反之)'
)
const LABEL = {
undefinedRefs: '引用未定义变量',
deadTokens: '定义了没用的变量',
hex: '十六进制色值',
rgb: 'rgba()/rgb()',
fontSize: 'font-size 写死',
radius: 'border-radius 写死',
spacing: 'padding/margin/gap 写死',
zIndexDecl: 'z-index 声明',
fontSizeDistinct: '字号取值种数',
radiusDistinct: '圆角取值种数',
spacingDistinct: '间距取值种数',
zIndexDistinct: 'z-index 取值种数',
shadowDistinct: '阴影写法种数'
}
const grew = []
for (const k of Object.keys(now)) {
if (now[k] > baseline.counts[k]) grew.push(LABEL[k] + ':' + baseline.counts[k] + ' → ' + now[k] + '(+' + (now[k] - baseline.counts[k]) + ')')
}
assert.deepStrictEqual(grew, [],
'以下计数涨了 —— 新增样式请用 token(--iwb-font-* / --iwb-radius-* / --iwb-space-* / --iwb-z-* / 语义色):\n ' + grew.join('\n ') +
'\n确属必要的例外:用行内 /*iwb:raw-until=<版本>*/(会到期)或 /*iwb:content*/(画布内容色),不要直接把基线数字调大。')
// ── B. 引用必须存在 ──
assert.deepStrictEqual(audit.undefinedRefs, [],
'有 var() 引用了从未定义的变量:' + audit.undefinedRefs.join(' ') + '(拼错的 token 名会让整条声明静默失效)')
// ── C. 自我兜底 ──
const cssFiles = ['style.css'].concat(
fs.readdirSync(path.join(root, 'src')).filter((f) => f.endsWith('.css') && f !== 'design-tokens.css').map((f) => 'src/' + f)
)
const selfFallback = []
for (const f of cssFiles) {
const src = fs.readFileSync(path.join(root, f), 'utf8')
src.split('\n').forEach((line, i) => {
const m = /var\(\s*(--[a-z0-9-]+)\s*,\s*var\(\s*(--[a-z0-9-]+)/i.exec(line)
if (m && m[1] === m[2]) selfFallback.push(f + ':' + (i + 1) + ' ' + m[1])
})
}
assert.deepStrictEqual(selfFallback, [], 'var() 用自己做兜底(等于没有兜底):' + selfFallback.join(' | '))
const drop = Object.keys(now).filter((k) => now[k] < baseline.counts[k])
console.log('token-ratchet: ' + Object.keys(now).length + ' 项计数均未超过基线'
+ (drop.length ? '(可下调基线:' + drop.map((k) => LABEL[k] + ' ' + baseline.counts[k] + '→' + now[k]).join(',') + ')' : ''))
console.log('token-ratchet: 引用未定义变量 0、自我兜底 0')
+1
View File
@@ -10,6 +10,7 @@
"IWBCanvasText",
"IWBCrashLog",
"IWBDesktop",
"IWBDesktopHelpers",
"IWBDockArea",
"IWBGalleryHydration",
"IWBGenerationRequestShape",
+3
View File
@@ -0,0 +1,3 @@
{
"files": {}
}
+20
View File
@@ -0,0 +1,20 @@
{
"_comment": "设计 token 棘轮基线(M5-T5.2)。数字只允许下降,不允许上升 —— 涨了就说明新代码写了裸值,改用 token 或(确有必要时)在 PR 里说明并下调别的项把总数补回来。口径来源:node scripts/token-audit.js --json",
"measuredAt": "2026-11-23",
"measuredVersion": "3.26.51",
"counts": {
"undefinedRefs": 0,
"deadTokens": 32,
"hex": 79,
"rgb": 55,
"fontSize": 159,
"radius": 95,
"spacing": 377,
"zIndexDecl": 71,
"fontSizeDistinct": 13,
"radiusDistinct": 17,
"spacingDistinct": 26,
"zIndexDistinct": 31,
"shadowDistinct": 44
}
}
+22 -12
View File
@@ -24,13 +24,16 @@ const CFG = {
}
async function openSettings (page) {
const cands = [
page.locator('.iwb-home-side-item', { hasText: '设置' }),
page.locator('.iwb-home-menu-item', { hasText: '设置' }),
page.locator('[title="服务与 Key 设置"]'),
]
for (const c of cands) if (await c.count() > 0) { await c.first().click(); break }
await expect(page.locator('button', { hasText: '+ 添加服务' }).first()).toBeVisible({ timeout: 10000 })
const nav = page.locator('.iwb-nav-item[title="设置"]')
if (await nav.count() > 0) { await nav.first().click() } else {
const cands = [
page.locator('.iwb-home-side-item', { hasText: '设置' }),
page.locator('.iwb-home-menu-item', { hasText: '设置' }),
page.locator('[title="服务与 Key 设置"]'),
]
for (const c of cands) if (await c.count() > 0) { await c.first().click(); break }
}
await expect(page.locator('.iwb-prov-chip').first()).toBeVisible({ timeout: 10000 })
}
const readCfg = (page) => page.evaluate(() => {
@@ -52,14 +55,20 @@ test('① 渠道可新增与删除,且改动会写入配置', async ({ page })
await openSettings(page)
const cards = page.locator('.iwb-provider-card')
const chips = page.locator('.iwb-prov-chip')
await expect(cards).toHaveCount(1, { timeout: 8000 })
await expect(chips).toHaveCount(1, { timeout: 8000 })
await page.locator('button', { hasText: '+ 添加服务' }).first().click()
await expect(cards).toHaveCount(2, { timeout: 8000 })
// 删最后一个(不动种子渠道)
await page.locator('.iwb-provider-card button', { hasText: '删除服务' }).last().click()
await page.locator('button', { hasText: '+ 添加服务商' }).first().click()
await expect(chips).toHaveCount(2, { timeout: 8000 })
// 单栏设计:同时只渲染一份详情(新服务自动选中)
await expect(cards).toHaveCount(1, { timeout: 8000 })
await expect(page.locator('.iwb-prov-name')).toHaveValue('新服务')
// 删当前(新加的)服务商;不删种子渠道
await page.locator('.iwb-provider-card button', { hasText: '删除服务' }).first().click()
await expect(chips).toHaveCount(1, { timeout: 8000 })
await expect(page.locator('.iwb-prov-name')).toHaveValue('CRUD 渠道')
await page.locator('button', { hasText: '保存配置' }).first().click()
await expect.poll(async () => ((await readCfg(page)).providers || []).length, { timeout: 10000 }).toBe(1)
@@ -94,6 +103,7 @@ test('② 模型可新增与删除,且改动会写入配置', async ({ page })
await expect(rows).toHaveCount(2, { timeout: 8000 })
// 删除刚加的 → 回到 1 行
await card.locator('.iwb-model-more-btn').last().click()
await card.locator('[title="删除模型"]').last().click()
await expect(rows).toHaveCount(1, { timeout: 8000 })
+11 -8
View File
@@ -13,14 +13,17 @@ test('设置里可配厂商类型 / 自定义模板 / 模型级覆盖', async ({
await page.goto('/', { waitUntil: 'domcontentloaded' })
await page.waitForTimeout(600)
// 打开设置(入口因视图而异 → 依次尝试,任一命中即可)
const cands = [
page.locator('.iwb-home-side-item', { hasText: '设置' }),
page.locator('.iwb-home-menu-item', { hasText: '设置' }),
page.locator('[title="服务与 Key 设置"]'),
]
let opened = false
for (const c of cands) { if (await c.count() > 0) { await c.first().click(); opened = true; break } }
expect(opened, '应能找到设置入口').toBe(true)
const nav = page.locator('.iwb-nav-item[title="设置"]')
if (await nav.count() > 0) { await nav.first().click() } else {
const cands = [
page.locator('.iwb-home-side-item', { hasText: '设置' }),
page.locator('.iwb-home-menu-item', { hasText: '设置' }),
page.locator('[title="服务与 Key 设置"]'),
]
let opened = false
for (const c of cands) { if (await c.count() > 0) { await c.first().click(); opened = true; break } }
expect(opened, '应能找到设置入口').toBe(true)
}
await page.waitForTimeout(700)
const kindSel = page.locator('select[aria-label="厂商类型"]').first()
await expect(kindSel).toBeVisible()
+33 -1
View File
@@ -100,4 +100,36 @@ for (const cls of DEAD) {
assert.ok(!re.test(css), cls + ' 已确认无生产者(DOM 与插件都不再产出),不该重新出现')
}
console.log('node scope checks passed(端口用 field / ' + nodeBlocks.length + ' 条节点规则字号·间距·圆角全走档位 / ' + DEAD.length + ' 个死类名不复现)')
// ── 5. 节点正文文本区不是控件面(v3.26.52,用户截图反馈)──
// 病灶:灰色提示词/文本节点里文字后面是白色,编辑时还多一个方框。
// ① `.iwb-node .iwb-textarea` 把 --iwb-field(亮色=纯白)刷到**所有**文本区,
// 优先级(0,2,0) 盖掉 `.iwb-textarea-plain`(0,1,0) 的 transparent;
// ② `.iwb-textarea:focus` 写在 plain:focus 之后且同优先级,2px 聚焦光晕又冒出来。
// 规则:正文文本区透明继承卡片底色(含 data-bg 自定义色),常态与编辑态都不画控件框;
// 全局 D8 键盘焦点环在这里也关掉(它会再画一个 2px 方框),焦点反馈改由节点选中框承担。
const prose = blocks.find((b) => b.sel === '.iwb-node .iwb-textarea-plain')
assert.ok(prose, '找不到 .iwb-node .iwb-textarea-plain 规则')
assert.ok(/background:\s*transparent/.test(prose.body), '节点正文文本区必须透明继承卡片底色')
assert.ok(
!/var\(--iwb-(?:field|layer|layer2|panel)\)/.test(prose.body),
'节点正文文本区不得铺控件面/面板色(--iwb-field 只给可交互控件)'
)
assert.ok(/border:\s*0/.test(prose.body), '节点正文文本区不得有控件边框')
assert.ok(/box-shadow:\s*none/.test(prose.body), '节点正文文本区不得有阴影')
const proseFocus = blocks.find((b) => /\.iwb-node \.iwb-textarea-plain:focus/.test(b.sel))
assert.ok(proseFocus, '找不到节点正文文本区的聚焦规则')
assert.ok(/box-shadow:\s*none/.test(proseFocus.body), '编辑态不得出现聚焦方框(2px 光晕)')
assert.ok(/outline:\s*none/.test(proseFocus.body), '编辑态不得出现全局键盘焦点环(同样是个方框)')
assert.ok(
css.indexOf('.iwb-node .iwb-textarea-plain:focus') > css.indexOf('.iwb-input:focus, .iwb-textarea:focus'),
'节点正文的聚焦规则必须写在基础 .iwb-textarea:focus 之后(同优先级靠后生效)'
)
const scopedField = blocks.find((b) => b.sel.startsWith('.iwb-node .iwb-input'))
assert.ok(scopedField, '找不到节点控件面规则')
assert.ok(
scopedField.sel.includes(':not(.iwb-textarea-plain)'),
'控件面(--iwb-field)规则必须排除正文文本区'
)
console.log('node scope checks passed(端口用 field / ' + nodeBlocks.length + ' 条节点规则字号·间距·圆角全走档位 / ' + DEAD.length + ' 个死类名不复现 / 正文文本区透明无框)')
+31 -1
View File
@@ -91,5 +91,35 @@ function memBackend () {
await PD.restoreAll([{ id: 'restored-x', data: { ok: true } }])
eq(await PD.create('restored-x').read(), { ok: true }, 'restoreAll 应写回数据')
console.log('plugin-data checks passed(串行队列 / 上限 / 迁移 / 备份)')
// ---- 插件文件(v3.26.59 / P0):备份必须带上 plugin-data/<id>/files/ 的字节 ----
// 动机:只备份 JSON 时,提示词封面这类图片文件换机后全丢,用户看到「已恢复」却是灰块。
// 这里用内存假 FS 跑行为断言(不依赖 Tauri),覆盖「清单 / 读字节 / 写回」三条路。
const fakeFiles = { promptlib: { 'cabc.jpg': Buffer.from('JPEGDATA', 'utf8') }, 'other-plugin': { 'cxyz.webp': Buffer.from([1, 2, 3]) } }
const putLog = []
sandbox.IWBStorageFile = {
pluginFiles: {
listAll: async () => Object.keys(fakeFiles).map((id) => ({ id, files: Object.keys(fakeFiles[id]).map((name) => ({ name, size: fakeFiles[id][name].length })) })),
readBytes: async (id, name) => (fakeFiles[id] && fakeFiles[id][name]) || null,
put: async (id, name, data) => { putLog.push({ id, name, data }); return { ok: true } },
},
}
const files = await PD.listFiles()
assert.strictEqual(files.length, 2, 'listFiles 应枚举所有插件的插件文件')
assert.strictEqual(JSON.stringify(files.map((f) => f.id + '/' + f.name).sort()), '["other-plugin/cxyz.webp","promptlib/cabc.jpg"]', 'listFiles 的 id/name 必须成对正确')
assert.strictEqual(files.find((f) => f.name === 'cabc.jpg').size, 8, 'listFiles 应带 size(体积预估用)')
const bytes = await PD.readFile('promptlib', 'cabc.jpg')
assert.ok(bytes && Buffer.from(bytes).toString('utf8') === 'JPEGDATA', 'readFile 应返回原始字节')
assert.strictEqual(await PD.readFile('promptlib', 'missing.jpg'), null, '不存在的文件返回 null(不抛)')
const n = await PD.restoreFiles([
{ id: 'promptlib', name: 'cabc.jpg', data: 'data:image/jpeg;base64,QUJD' },
{ id: '', name: 'bad.jpg', data: 'x' },
{ id: 'promptlib', name: 'nofile.jpg' },
])
assert.strictEqual(n, 1, 'restoreFiles 只写合法条目(缺 id/name/data 的跳过)')
assert.strictEqual(putLog.length, 1, 'restoreFiles 不应多写')
assert.strictEqual(putLog[0].id, 'promptlib', 'restoreFiles 应带插件 id')
assert.ok(putLog[0].data.indexOf('data:image/jpeg;base64,') === 0, 'restoreFiles 应把 dataURL 交给 pluginFiles.put')
console.log('plugin-data checks passed(串行队列 / 上限 / 迁移 / 备份 / 插件文件)')
})().catch((e) => { console.error(e); process.exit(1) })
+3 -1
View File
@@ -110,7 +110,9 @@ async function boot ({ items, thumb, clock }) {
assert.strictEqual(env.window.getComputedStyle(tools).display, 'flex', '工具组应为横排 flex(否则图标会竖排)')
assert.ok(tools, '底栏应有右侧工具组')
const footBtns = Array.from(tools.querySelectorAll('button'))
assert.strictEqual(footBtns.length, 2, '工具组应为刷新+设置两个图标,实际 ' + footBtns.length)
// 2026-11-24:工具组多了「打开本地目录」图标(文件夹,仅桌面端可见)⇒ 顺序固定为 刷新 / 打开目录 / 设置
assert.strictEqual(footBtns.length, 3, '工具组应为刷新 + 打开目录 + 设置三个图标,实际 ' + footBtns.length)
assert.strictEqual(footBtns[2].getAttribute('aria-label'), '设置', '设置必须是最右边的图标(打开目录在它左边)')
const btn = footBtns.find((b) => b.getAttribute('aria-label') === '刷新')
assert.ok(btn, '底部应有刷新按钮(aria-label=刷新)')
// 刷新不能再留在左侧信息区(否则空间不足会向右压住设置)
+77
View File
@@ -0,0 +1,77 @@
'use strict'
// 插件尺度契约棘轮(2026-11-23)
// 目的:插件 CSS 的字号 / 圆角 / 间距散值「只降不升」。
// 规则(docs/standards/design-tokens.md):
// 字号 11/12/13/14/15/17/20/24;圆角 6/8/10/12/14/999;间距 0/2/4/6/8/10/12/16/20/24/32/40/48/64
// 存量不一次清零(会逼人加白名单),用基线棘轮:新增文件必须干净,存量文件计数不得增加。
// 迁移时刻意下调后基线不会自动降 —— 用 --update 重新生成(人工确认)。
const fs = require('fs')
const path = require('path')
const assert = require('assert')
const ROOT = path.join(__dirname, '..')
const PLUGINS = path.join(ROOT, 'plugins')
const BASELINE = path.join(__dirname, 'fixtures', 'plugin-scale-baseline.json')
const FONT = new Set([11, 12, 13, 14, 15, 17, 20, 24])
const RADIUS = new Set([6, 8, 10, 12, 14, 999])
const SPACE = new Set([0, 2, 4, 6, 8, 10, 12, 16, 20, 24, 32, 40, 48, 64])
function walk (dir, out) {
let ents = []
try { ents = fs.readdirSync(dir, { withFileTypes: true }) } catch (e) { return out }
for (const e of ents) {
const p = path.join(dir, e.name)
if (e.isDirectory()) walk(p, out)
else if (e.name.endsWith('.css')) out.push(p)
}
return out
}
function scan () {
const res = {}
for (const f of walk(PLUGINS, [])) {
const rel = path.relative(ROOT, f).split(path.sep).join('/')
const src = fs.readFileSync(f, 'utf8')
const r = { font: 0, radius: 0, space: 0 }
for (const m of src.matchAll(/([a-z-]+)\s*:\s*([^;{}]+)/g)) {
const prop = m[1].toLowerCase()
const val = m[2].trim()
if (val.includes('var(')) continue
if (prop === 'font-size') {
const px = /([0-9.]+)px/.exec(val)
if (px && !FONT.has(Number(px[1]))) r.font++
} else if (prop === 'border-radius') {
for (const px of val.matchAll(/([0-9.]+)px/g)) if (!RADIUS.has(Number(px[1]))) r.radius++
} else if (/^(gap|row-gap|column-gap)$/.test(prop) || /^(padding|margin)/.test(prop)) {
for (const px of val.matchAll(/([0-9.]+)px/g)) if (!SPACE.has(Number(px[1]))) r.space++
}
}
if (r.font || r.radius || r.space) res[rel] = r
}
return res
}
const current = scan()
if (process.argv.includes('--update')) {
fs.mkdirSync(path.dirname(BASELINE), { recursive: true })
fs.writeFileSync(BASELINE, JSON.stringify({ files: current }, null, 2) + '\n')
console.log('plugin scale baseline updated:' + Object.keys(current).length + ' 个文件')
process.exit(0)
}
const baseline = fs.existsSync(BASELINE) ? JSON.parse(fs.readFileSync(BASELINE, 'utf8')).files || {} : {}
const bad = []
for (const [file, cur] of Object.entries(current)) {
const base = baseline[file] || { font: 0, radius: 0, space: 0 }
for (const k of ['font', 'radius', 'space']) {
if (cur[k] > (base[k] || 0)) bad.push(file + ' → ' + k + ' ' + (base[k] || 0) + ' → ' + cur[k])
}
}
if (bad.length) {
assert.fail('插件尺度散值不得增加(字号/圆角/间距用 design-tokens 闭集):\n' + bad.slice(0, 20).join('\n') +
'\n迁移完成后可运行 node tests/plugin-scale-contract-test.js --update 更新基线。')
}
const total = Object.values(current).reduce((n, r) => n + r.font + r.radius + r.space, 0)
console.log('plugin scale contract checks passed(' + Object.keys(current).length + ' 个插件样式文件,存量散值 ' + total + ' 处,未增加)')
Loaded 100 of 101 files, more files were not shown because too many files have changed in this diff. Show more