Compare commits

...
24 Commits
Author SHA1 Message Date
qiqi e827f47d04 fix: 封面 PNG→JPEG 兜底 + 停靠栏/小地图补测 + 主题契约扩围 v3.26.21
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m11s
2026-11-22 00:16:30 +08:00
qiqi 9847373964 docs: 锚点回退到版本 bump 提交(4491b71) 2026-11-22 00:09:56 +08:00
qiqi 178cda830a chore(plugins): 同步 gallery 1.6.9 微任务绘制修复
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m32s
2026-11-22 00:09:13 +08:00
qiqi 38ec7465bf docs: 事故复盘锚点对齐发布提交 2026-11-22 00:05:57 +08:00
qiqi 1ddf89d2c3 docs: 插件样式事故复盘 + 回滚/定位/发布纪律 2026-11-22 00:05:12 +08:00
qiqi 4491b71abf fix(theme): 插件灰跟随主题 v3.26.20
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m2s
2026-11-22 00:01:38 +08:00
qiqi b1d8f4e080 docs: 基线锚点更新到 96e8cc2 2026-11-21 23:51:21 +08:00
qiqi 540eed04cc fix(plugins): gallery 1.6.9 缩略图共享/坏图兜底;顶栏更浅 v3.26.19
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m33s
2026-11-21 23:50:36 +08:00
qiqi 96e8cc2d7d fix(plugins): gallery 1.6.9 缩略图缓存共享(重排不重复取图)+ 顶栏更浅
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 43s
2026-11-21 23:48:14 +08:00
qiqi 2082ced720 fix(plugins): gallery 1.6.7 首帧后多次重测宽度(可见即重排)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 46s
2026-11-21 23:44:36 +08:00
qiqi 2c94401d45 feat(canvas): 小地图与工具栏同排 + 挤压自动隐藏 v3.26.18
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 1m40s
2026-11-21 23:42:55 +08:00
qiqi 93deea4f5e fix(canvas): 小地图缩小并上移,避开底部工具栏 v3.26.17
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m46s
2026-11-21 23:35:19 +08:00
qiqi f35ecb1790 chore(plugins): gallery 1.6.6 列宽铺满 + 外层宽度测量
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m49s
2026-11-21 23:28:11 +08:00
qiqi 6435d9e4c3 style(dock): 选中态 11%/悬停 4%;图库 1.6.4 首屏与边距 v3.26.16
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m8s
2026-11-21 23:23:22 +08:00
qiqi 0d42ebb9ae style(dock): 选中态淡底 + 去掉下划线 v3.26.15
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m15s
2026-11-21 23:18:35 +08:00
qiqi a26fb2d64d style(dock): 提示词库/节点组底色与图库一致 v3.26.14 / promptlib 1.4.8
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m33s
2026-11-21 23:12:23 +08:00
qiqi 1d0b6d2168 fix(dock): 拖宽实时更新变量 + 默认面板跨侧去重 v3.26.13
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 3m38s
2026-11-21 23:07:51 +08:00
qiqi 202f7b81de fix(dock): 面板去重(同侧+跨侧),修重复注册残留 v3.26.12
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m52s
2026-11-21 23:01:17 +08:00
qiqi d16f3434dd fix(plugins): promptlib 1.4.7 恢复瀑布流列规则(回退后单列问题)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 3m33s
2026-11-21 22:52:54 +08:00
qiqi 9c0d3b1221 revert: 回退到 v3.26.5 插件行为(v3.26.10),promptlib 回退 1.4.0 内容
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 53s
2026-11-21 22:50:21 +08:00
qiqi 5f8f4d229f fix: CSP nonce 导致动态 style 全丢(插件样式失效)v3.26.9 / promptlib 1.4.5
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m52s
2026-11-21 22:43:41 +08:00
qiqi a3edc81f55 chore(plugins): promptlib 1.4.2 自带样式(不依赖宿主注入)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 52s
2026-11-21 22:21:13 +08:00
qiqi 774b980f69 feat: 市场缓存回退 + 启动层恢复 + 卡片键盘可达(v3.26.6 / promptlib 1.4.1)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m28s
2026-11-21 22:17:46 +08:00
qiqi a993d44f4e chore: 体检清理(死代码/截图/封面瘦身/测试)(v3.26.5 / promptlib 1.4.0)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m3s
2026-11-21 22:12:01 +08:00
60 changed files with 977 additions and 298 deletions

No files matched your search

+4
View File
@@ -22,3 +22,7 @@ release/
# 插件市场产物(由 scripts/gen-market.js 生成,发布时 scp 上传)
market/
# 临时截图/调试产物(不入库)
_*.png
_tray-preview/
+100
View File
@@ -14,6 +14,106 @@
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
## v3.26.21(2026-11-22)封面体积修复 + 停靠栏/小地图补测 + 主题契约扩围
### 修复
- **封面 300KB 的根因**:WebP 编码不可用时 `compressDataUrl` 回退成 **448px PNG**,照片仍 300KB+(3 张共 1.1MB)→ `putCover` 增加 JPEG 兜底(webp → jpeg → 原图,取更小者)。
- promptlib 1.4.9:瘦身迁移范围扩到「PNG 封面」(不只看 >60KB),老封面会自动重压并保存一次。
### 测试
- 新增 `tests/ui-dock-sanitize-test.js`:同侧去重 / 跨侧只保留左侧 / 未注册剔除 / 默认回填规则 / 幂等。
- 新增 `tests/ui-minimap-fit-test.js`:不重叠显示 / 临界隐藏 / 回位恢复。
- 停靠栏整理逻辑抽到 `src/ui-dock-sanitize.js`(纯函数,可单测)。
### 守门
- 插件主题契约测试**扩围**:以前只扫 `.js` 且只统计“含颜色声明”的文件(实际 2 个),现在扫 `.js + .css` 全量(实际 8 个);补回“白字压在图上”例外。
## v3.26.20(2026-11-21)插件灰跟随主题(修暗色下节点组发白)
### 修复
- `--iwb-plugin-surface/card/inset/hover` 改为由 `theme-tokens` **按当前主题派生**(亮色=中性灰、暗色=深灰),不再固定浅色。
- 亮色下去掉蓝调:以灰阶混合生成(`mix(panel,#000,3.5%~11%)`)。
- 效果:暗色模式下节点组卡片条、插件内嵌块不再是白块。
## v3.26.19(2026-11-21)停靠栏顶栏底色更浅
### 样式
- 左右插件顶栏(图标条)底色由「停靠栏压暗 6%」改为「向面板白靠 55%」:比原来浅一档,与面板层次更连贯。
- 自动配色(theme-tokens)同步该规则。
## v3.26.18(2026-11-21)小地图回到工具栏一排,挤压时自动隐藏
### 布局
- 小地图恢复 `bottom: 14`(与悬浮工具栏同一排),尺寸保持 132×88。
- 新增 `src/ui-minimap-fit.js`:右栏拉宽把工具栏往左挤,二者横向将要重叠(间距 < 8px)时,小地图**淡出隐藏**;腾出空间后自动恢复。
- 监听窗口 resize、工具栏/小地图尺寸变化、停靠栏拖宽事件,拖动过程中实时判断。
## v3.26.17(2026-11-21)小地图缩小并上移,避免与底部工具栏重叠
### 布局
- 小地图 168×112 → **132×88**(内部点阵同步缩放)。
- 位置从 `bottom: 14` → **`bottom: 76`**:整体移到悬浮工具栏上方,窄窗口下不再压住工具按钮。
## v3.26.16(2026-11-21)停靠栏选中态加深 + 图库首屏空白/边距
### 样式
- 面板图标:选中底 7%→**11%**,悬停底从实心白降到 **4%**(不再发白)。
### 插件
- 图库 1.6.4:面板刚挂载时量不到宽度导致**首屏空白**(只有改窗口大小才出图)→ 改为读取外层可用宽度 + rAF 重试;列表内边距 8→6,去掉居中留白。
## v3.26.15(2026-11-21)停靠栏选中态收敛
### 样式
- 面板图标选中态不再用实心白底:改为 7% 文字色淡底 + 图标提亮;去掉下方 2px 品牌色横线。
## v3.26.14(2026-11-21)提示词库/节点组底色与图库一致
### 调整
- 提示词库、节点组面板不再铺 `--iwb-plugin-surface` 灰底,改为透明(与图库一致,直接显示停靠栏底色)。
### 插件
- promptlib 1.4.8。
## v3.26.13(2026-11-21)停靠栏拖宽实时跟手 + 幽灵图标
### 修复
- 拖宽过程中同步更新 `--iwb-dock-l` / `--iwb-dock-r`:工具栏、小地图等随之实时让位,不再松手才"飘"过去。
- 默认面板回填时跳过另一侧已存在的 id:右侧栏不再偶尔冒出一个没有实际窗口的提示词库图标。
## v3.26.12(2026-11-21)停靠栏面板去重(左右各自 + 跨侧)
### 修复
- 老数据里同一插件面板 id 重复出现(历史注册残留)→ 打开时**同侧去重**;同一 id 同时出现在左右两侧时**只保留左侧**,右侧那一个自动消失。
## v3.26.11(2026-11-21)修插件面板重复注册
### 修复
- 插件 `registerPanel` 同一插件重复注册同一 id 时**替换**旧条目,而不是追加(以前每重载/每拖拽一次就多一个停靠栏图标,且旧的不消失)。
## v3.26.10(2026-11-21)回退:恢复到 v3.26.5 的插件样式行为
### 回退
- 代码整体回退到 **v3.26.5**(客户端),插件 promptlib 回退到 **1.4.0** 的内容(市场版本号 1.4.6)。
- 移除 v3.26.6~3.26.9 期间的改动:市场缓存回退、启动层、卡片键盘可达、CSP nonce 兜底(`src/runtime-style-nonce.js`)、封面 448/瘦身迁移、封面内联存 dataURL 等。
- 目的:先让左右栏插件恢复正常可用,后续再逐项、单独验证地重做。
## v3.26.5(2026-11-21)代码体检后的清理与瘦身
### 清理
- promptlib 删除死代码(旧 openEditor / renderDetail / view / expanded 与失效 CSS):866 → 702 行。
- 仓库根目录 8 张临时截图 + `_tray-preview/` 移出并加入 `.gitignore`(约 1MB)。
### 瘦身
- 封面上限 768 → **448px**(WebP 0.8)。
- 新增一次性迁移:插件启动时把 >60KB 的老封面重新压缩并保存一次(`prompts.json` 1.7MB → 明显下降)。
### 测试
- 新增 3 组覆盖:封面渲染、插入封面图片(并关闭弹窗)、弹窗拖动/缩放(含最小宽度)。
### 插件
- promptlib 1.4.0。
## v3.26.4(2026-11-21)插件灰再压一档 + 无封面方形占位
### 调整
+1 -1
View File
@@ -41,7 +41,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 109 个单测文件(jsdom 契约测试;2026-11-07 新增 sync-facts-guard(事实一致性)/ _helpers/source(统一源文本);2026-11-12 新增 provider-ping(测速 no-cors 兜底))
test:unit 111 个单测文件(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)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

+19 -3
View File
@@ -11,6 +11,9 @@
await window.IWBStorageFile.ready()
}
} catch (e) { console.error('[iwb][file-store] 启动装载失败,回退浏览器存储', e) }
// v3.26.18:小地图与底部工具栏避让(右栏挤压时自动隐藏,实现在 src/ui-minimap-fit.js)
try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'function') window.IWBMiniMapFit.install() } catch (e) { /* ignore */ }
const el = React.createElement
const { useState, useEffect, useLayoutEffect, useRef } = React
// 生成结果精简/合并模块(src/generation-results-store.js)。⚠️ 必须在 IIFE 最顶部取:
@@ -2420,12 +2423,20 @@
try {
const src = String(dataUrl || '')
if (src.indexOf('data:') !== 0) return { ok: false, error: '封面上传失败' }
const out = await new Promise((resolve) => {
const enc = (fmt, q) => new Promise((resolve) => {
try {
compressDataUrl(src, { enabled: true, force: true, maxMB: 0, maxEdge: 768, quality: 0.85, format: 'webp' }, (o) => resolve(o || ''))
compressDataUrl(src, { enabled: true, force: true, maxMB: 0, maxEdge: 448, quality: q, format: fmt }, (o) => resolve(o || ''))
} catch (e) { resolve('') }
})
const final = out || src
// v3.26.21:优先 WebP;编码器不可用时 compressDataUrl 会退回 PNG,
// 448px 照片的 PNG 仍有 300KB+(实测 3 张共 1.1MB)→ 再兜一次 JPEG。
let final = await enc('webp', 0.8)
if (!final) final = await enc('jpeg', 0.82)
if (!final) final = src
if (final.indexOf('data:image/webp') !== 0 && final.indexOf('data:image/jpeg') !== 0) {
const j = await enc('jpeg', 0.82)
if (j && j.length < final.length) final = j
}
if (String(final).indexOf('data:') !== 0) return { ok: false, error: '封面上传失败' }
return { ok: true, ref: final }
} catch (e) { return { ok: false, error: '封面上传失败' } }
@@ -8939,6 +8950,11 @@ items.push(el('button', { key: 'bgc', className: 'iwb-ctx-item', onClick: (e) =>
return {
registerPanel: (panel) => {
if (!panel || !panel.id || !panel.title || typeof panel.mount !== 'function') return false
// v3.26.11:同一插件重复注册同一 id 时**替换**而不是追加(否则停靠栏会越点越多)
for (let i = wPluginPanels.length - 1; i >= 0; i--) {
const e = wPluginPanels[i]
if (e && e.pluginId === ctx.id && e.id === String(panel.id)) wPluginPanels.splice(i, 1)
}
const entry = { id: String(panel.id), title: String(panel.title), icon: pluginIconOf(ctx.id) || panel.icon, mount: panel.mount, pluginId: ctx.id }
wPluginPanels.push(entry)
owned.push(entry)
+5 -5
View File
@@ -1,7 +1,7 @@
# 现状架构与性能事实基线(image-workbench-web)
> **本文档是什么**:现状**事实快照**,不是规范。用途:任何性能 / 内存 / 存储相关改动,先对齐这里的现实,避免把已经调好的东西改坏。
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = 9db4c15`(线上 `v3.26.4+9db4c15` —— **未上线**(本地测试中):左右停靠栏配色对齐主色调(新增 `--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()` 注入 ⇒ 从存档直接进画布时节点无样式、缩略图按原图铺满)。上一条 v3.24.82 同批:提示词/文本节点**显示上游继承文本**(自己 `data.text` 为空时把上游那段话显示在框里,改一个字即接管,另有「恢复跟随」清空回跟随;多路上游按 Y 轴取第一条)+ 修 `nodeRefsOf` 的 textout 分支只认 llm/batch/combine 上游导致「样式 → 文本 → 分层」丢参考图;再上一条 v3.24.81:① 插件节点可自定义节点体(`render(node, props, host)` 画真实 DOM,宿主不每帧重建 ⇒ 输入框不失焦);② 节点自带参考图(`data.refOn/refUrl` ⇒ 任务图里补伪参考图,坐标取节点自身 ⇒ 仍参与「图片按 X 轴排序」);③ 连线白名单按 `data.outKind === 'prompt'` 归一化,7 条规则一次放行,内置节点行为逐字不变。上一条 v3.24.80 = 离开页面的兜底保存不递增 rev(2026-11-14 07:20 补发 —— 首发 11-13 23:25 撞 Cloudflare Workers API 事故 `503 no healthy upstream`,期间正式站保持在 `v3.24.79+8598a57` 未动)。v3.24.83 的 bump 提交即 `0a27a42`(v3.24.82 为 `ef6cf42`、v3.24.81 为 `dba71e3`);主干 HEAD 会继续前进,见 [`RELEASES.md`](../RELEASES.md))| 历史分支 `refactor/architecture` / `feat/multi-canvas-tabs` / `refactor/state-store` 已于 2026-10-20 清理(内容均已并入 main,归档标签 `archive/*`),本文**计数类事实**已按 main HEAD 复算。
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = 9847373`(线上 `v3.26.21+9847373` —— **未上线**(本地测试中):左右停靠栏配色对齐主色调(新增 `--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()` 注入 ⇒ 从存档直接进画布时节点无样式、缩略图按原图铺满)。上一条 v3.24.82 同批:提示词/文本节点**显示上游继承文本**(自己 `data.text` 为空时把上游那段话显示在框里,改一个字即接管,另有「恢复跟随」清空回跟随;多路上游按 Y 轴取第一条)+ 修 `nodeRefsOf` 的 textout 分支只认 llm/batch/combine 上游导致「样式 → 文本 → 分层」丢参考图;再上一条 v3.24.81:① 插件节点可自定义节点体(`render(node, props, host)` 画真实 DOM,宿主不每帧重建 ⇒ 输入框不失焦);② 节点自带参考图(`data.refOn/refUrl` ⇒ 任务图里补伪参考图,坐标取节点自身 ⇒ 仍参与「图片按 X 轴排序」);③ 连线白名单按 `data.outKind === 'prompt'` 归一化,7 条规则一次放行,内置节点行为逐字不变。上一条 v3.24.80 = 离开页面的兜底保存不递增 rev(2026-11-14 07:20 补发 —— 首发 11-13 23:25 撞 Cloudflare Workers API 事故 `503 no healthy upstream`,期间正式站保持在 `v3.24.79+8598a57` 未动)。v3.24.83 的 bump 提交即 `0a27a42`(v3.24.82 为 `ef6cf42`、v3.24.81 为 `dba71e3`);主干 HEAD 会继续前进,见 [`RELEASES.md`](../RELEASES.md))| 历史分支 `refactor/architecture` / `feat/multi-canvas-tabs` / `refactor/state-store` 已于 2026-10-20 清理(内容均已并入 main,归档标签 `archive/*`),本文**计数类事实**已按 main HEAD 复算。
<!-- 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 迁出)
@@ -22,7 +22,7 @@
- 图片**新写入主通道 = IndexedDB Blob `{__blob}` / key `imgblob_<hash>_<len>`** (A) `app.js:2143`;`{__cache}`(Cache Storage)为兜底;\`ref_\`(`app.js` 内定义的 `IDB_REF_PREFIX = 'ref_'`)为 legacy 形态 (A)。
- 大图判定:`isBigDataUrl` = `data:` 且 `length > 3000` (A) `app.js:2018`;**画布保存保留阈值** `< 16384` 才原样保留 (A) `app.js:2182`。**两处阈值并存,含义不同**。
- 单测是**源码契约测试**:`tests/` 目录共 **493** 处源码文本钉点(`source.includes` / `source.indexOf` / `/re/.test(source)`),分布在 **20** 个文件(其中 `iwb-v32-web-test.js` 一个就占 **407**)→ **结构性重构会先打红测试**。**该数字已由 `tests/source-text-ratchet-test.js` 的「只减不增」棘轮守门**(2026-10-20 起守卫范围从 1 个文件扩到全目录:新增任何一处源码文本钉点都会打红)。**2026-11-12 复算**(`npm run audit:pins`,v3.24.76):二分 STRUCT **417** / NAME **76**;形态 **POS 403 / NEG 87 / COUNT 3**;难度 **易 62 / 中 316 / 难 115**。钉点减法第一批(v3.24.72)把 **537 → 505**:8 条探针钉点改为「门禁内 spec 是否真的读该计数器」、5 条改为运行时断言(生产态 `window` 上无探针)、10 条改为 DOM 断言(质量档位禁用 / 传输页无三模式按钮 / 模型项 title)、4 条改为运行时对象断言(健康检查两域、策略对象冻结)、其余 9 条有同文件 DOM 等价断言或仅剩 NEG。第二批(v3.24.76)把 **505 → 493**:94-5~7 三条「多标签释放语义」(10 处正则)换成 `tests/iwb-tabs-release.spec.js` 的 3 条真 e2e,剩 1 条「消费方契约」(断言该 spec 在门禁内且 spec 源码真的读两个探针);另 2 条 `wPurgeIntent.add` 钉点改为读 `src/workspace-purge.js`。**这一批一换就查出 3 个真缺陷**(objectURL 从未释放 / 彻底删除留孤儿标签 · session / 刷新后误回收打开标签的图)—— 见 CHANGELOG v3.24.76。
- `app.js` = 单 IIFE **8,508 行**(**双层预算**:绝对上限 8,700 / 占总源码 ≤ 40%,现 **36.8%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **2,998 行**(上限 **3,030**,余量 32;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **102** 个模块 / 14,607 行,`sourceModules` 102 项;v3.24.68 新增 `clipboard-graph.js`,v3.24.74 新增 `image-admit.js`,v3.24.75 新增 `image-dedupe.js`,v3.24.76 新增 `workspace-purge.js`,v3.24.79 新增 `generation-provider-ping.js`,v3.24.80 删除无调用的 `createWBFlushViewport` 17 行)。
- `app.js` = 单 IIFE **8,508 行**(**双层预算**:绝对上限 8,700 / 占总源码 ≤ 40%,现 **36.8%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **2,998 行**(上限 **3,030**,余量 32;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **104** 个模块 / 14,607 行,`sourceModules` 104 项;v3.24.68 新增 `clipboard-graph.js`,v3.24.74 新增 `image-admit.js`,v3.24.75 新增 `image-dedupe.js`,v3.24.76 新增 `workspace-purge.js`,v3.24.79 新增 `generation-provider-ping.js`,v3.24.80 删除无调用的 `createWBFlushViewport` 17 行)。
- 门禁:`npm run verify` = `verify:ci`(`build` → `node --check app.js` → `node --check dist/app.js` → `check-dist.js` → `lint`(ESLint 正确性规则,`src/` + `app.js`,P4-16a)→ `test:unit` → `test` → `test:facts`)+ `test:e2e` (A) `package.json`。
## 2. 门禁与环境现状
@@ -167,7 +167,7 @@
- 同一张图被 3 个节点引用、hydrate 成 3 个不同 objectURL 时,preview/display 缓存各自 miss → 重复解码(与 F2 相邻)。
- **F10|`refs.genScheduler` 是桩** (A) → 未接线,暂无运行时影响(P3)。
- **F11|已建但未接线的模块层(2026-10-17 接线审计;2026-10-18 复核更正)** (A)
- **判定法**:`global.X =` / `root.X =` 判「导出」;跨文件裸引用判「读」;排除自合并(`src/runtime-constants.js:9`)。`app.js` 是**唯一生产消费者**(无 HTML 入口;`sw.js` 不引用模块全局)。**102 个模块中 59 个导出**被 `app.js` 读取;其余为未接线 / 仅测试 / 零引用(见下)。
- **判定法**:`global.X =` / `root.X =` 判「导出」;跨文件裸引用判「读」;排除自合并(`src/runtime-constants.js:9`)。`app.js` 是**唯一生产消费者**(无 HTML 入口;`sw.js` 不引用模块全局)。**104 个模块中 59 个导出**被 `app.js` 读取;其余为未接线 / 仅测试 / 零引用(见下)。
- **仅被测试引用(9 模块 + 2 导出)**:`canvas-domain`、`generation-retry`、`generation-service`、`runtime-recovery-runner`、`runtime-state-bridge`、`runtime-store`、`storage-reconcile`、`storage-result`、`workspace-service`;导出 `IWBStorageHealthFactory`、`IWBPluginHostFactory`。(`storage-result` 是**存储层共享结果类型**,被 6 个存储模块读取,**非死代码**;`runtime-store` 为状态模型 epic 地基。)
- **app.js 零引用(1 模块 + 3 导出)**:模块 `generation-controller`;导出 `IWBRuntimeMetricsFactory`、`IWBStorageRuntimeFactory`、`IWBUIComponents`。`canvas-relations` 已随 `06cf211` 删除(本文档早前把它列为"唯一可删者",实际已删)。零引用证据 = `grep -rn "<名字>" .`(排除 `node_modules|dist|vendor|test-results`)**只命中其自身赋值行**。
- **半接线 / 未接线**:`IWBRuntimeStateBridge` **无 app.js 引用(仅测试)**;`IWBRuntimeRunContext` **已接线**(`runNode` 读取运行上下文);`IWBGenerationController` 是完整但**从未被调用**的工厂;`ModularWorkspaceStore`(`app.js` 内)是 `storage-workspace` 的**预留接线 seam**(当前无下游使用,保留);`window.IWBImageFolder` 自注册后读回(装载路径)。
@@ -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 耦合面(**84** 项)与 `sourceModules` 顺序(**102** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。
- **耦合面已冻结**:`tests/architecture-boundary-guard-test.js`(进 `npm run test:unit` 末环)冻结 app.js↔src 耦合面(**85** 项)与 `sourceModules` 顺序(**104** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。
## 12. 易踩的坑
@@ -254,7 +254,7 @@
**信任模型(必须明示)**:形态 A 的插件是**可信代码**(与核心同权限、无沙箱);启停与设置是 UX 与可维护性手段,**不是安全边界**(同 §13.27 教训:前端开关一定可被绕过)。
**守门与快照**:`tests/architecture-boundary-guard-test.js` 冻结「app.js ↔ src 耦合面」(**84** 项)与 `sourceModules` 顺序(**102** 项);新增模块、新增耦合、新增 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 耦合面」(**85** 项)与 `sourceModules` 顺序(**104** 项);新增模块、新增耦合、新增 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 规则三的同一失败模式)。
@@ -0,0 +1,124 @@
# 插件样式 / 停靠栏 / 图库:2026-11-21 事故复盘与经验
> 适用版本:v3.25.9x → v3.26.20;涉及插件:promptlib / gallery / grouplib / style-source。
> 这份文档记录「为什么会坏、怎么定位、怎么修、回滚要注意什么」,下次遇到同类现象先读它。
## 1. 事故时间线(浓缩)
| 版本 | 做了什么 | 结果 |
|---|---|---|
| 3.25.97 | 提示词封面改用 `{__blob}` 引用 | 编辑里能看到、列表看不到,重启可能丢 |
| 3.26.0 | 封面改为内联压缩 dataURL | 封面可见了,`prompts.json` 涨到 1.7MB |
| 3.26.5 | 清理死代码 + 删失效 CSS | 误删 `.iwb-lib-cards` 瀑布流列规则(单列化) |
| 3.26.6~3.26.9 | 市场缓存、启动层、键盘可达、CSP nonce 兜底 | **插件样式全丢**(提示词库/风格库/图库变裸 HTML) |
| 3.26.10 | **整体回滚到 v3.26.5** + promptlib 回 1.4.0 内容(版本号 1.4.6) | 功能恢复,但回滚带回了 1.4.0 的单列 bug |
| 3.26.11~3.26.14 | 面板去重、拖宽跟手、底色调平、图库铺满 | 逐步收敛 |
| 3.26.15~3.26.20 | 选中态收敛、小地图避让、图库缩略图缓存、插件灰跟随主题 | 稳定 |
## 2. 五个真实根因(都验证过)
### 2.1 CSP nonce 会整段丢弃动态 `<style>`
- 桌面端 CSP 带 nonce;CSP3 下 `unsafe-inline` 被忽略。
- 宿主/插件用 `document.createElement('style')` 注入样式时**没有 nonce** → `style.sheet === null`,`document.styleSheets` 里也没有它。
- 症状极具迷惑性:插件 DOM 正常、宿主外链 CSS 正常,唯独插件样式全丢(卡片塌成色条、图片按原始尺寸铺满)。
- 判定方法:页面里执行
```js
const s = document.createElement('style'); s.textContent = '.x{color:red}'; document.head.appendChild(s);
s.sheet === null // true ⇒ 被 CSP 丢弃
```
- 修复:给动态 `<style>` 复制页面上已有 nonce:`node.setAttribute('nonce', document.querySelector('style[nonce],link[nonce]').nonce)`。
- **注意**:后来 3.26.10 回滚后,用 v3.26.5 那套样式注入在 1.4.7 插件下显示正常——说明**并非所有注入路径都会触发**,与注入时机/上下文有关。结论:不要依赖单一假设,先用上面的判定法验证。
### 2.2 插件样式注入与激活存在竞态
- 宿主在 load 时把 CSS 暂存到 `pendingStyles[id]`,**激活插件时**才 `applyStyleFor(id)`。
- 若插件已处于激活状态(热更新、切面板、拖拽重载),`applyStyleFor` 不会再执行 → 有 DOM 无样式。
- 修复方向(二选一,最终都用了):
1. 插件**自带样式**(把 CSS 内联进 bundle,脚本执行时注入);
2. 宿主在激活时若 `pendingStyles` 为空,从磁盘补读一次再注入。
### 2.3 `registerPanel` 只 push 不替换 → 面板图标越拖越多
- 插件每次重新加载都会注册一次面板,宿主直接 `wPluginPanels.push(entry)`。
- 重复 id 进入停靠栏状态 `iwb.dock.v1` 后,**重启也还在**;把右侧那份拖到左侧只会移动其中一份,所以“右边的不会消失”。
- 修复(两层都要做,缺一不可):
- 注册层:同 `pluginId + id` 先删除旧条目再插入;
- 持久层:打开时同侧去重;同一 id 同时出现在左右两侧时只保留左侧;默认面板回填时跳过另一侧已存在的 id。
### 2.4 图库“要拖一下窗口才显示图片”
- 图库列宽由测得的面板宽度算出,而 `grid` 自身宽度又由列宽决定(`flex-start` + 内容宽度)。
- 于是 `grid.clientWidth` 首帧为 0,之后**永远不会变化** → `ResizeObserver` 不触发 → 一直空白。
- 修复:量**会随面板拉伸的外层容器**(`wrap` / 父节点),并加三重兜底:
- 挂载后 rAF 连续重试(最多 40 帧);
- 可见后(IntersectionObserver 命中)重测重排;
- 120/400/900ms 各补一次。
- 副作用:重排会重建 DOM,导致缩略图重复请求(每张图请求 N 次、部分一直“加载中”)。**必须配缩略图缓存 + 进行中 Promise 共享**(gallery 1.6.9)。
### 2.5 封面:引用 vs 内联
- `{__blob}`(IndexedDB 引用)跨会话/跨解析时序不可靠:编辑弹窗能看到(自己刚写的),列表与重启后丢失。
- 内联 dataURL 可靠但撑大 `prompts.json`(33 条 1.7MB)。
- 取舍:先用内联(≤448px WebP)保证“任何时候都看得见”,体积问题单独做迁移/文件型 ref 解决——**不要一次改动同时解决“可靠性 + 体积”**。
## 3. 回滚细节(最容易踩)
这次最终靠“回滚到 v3.26.5”才恢复,过程中有 4 个坑:
1. `git checkout v3.26.5 -- .` **只覆盖已存在的文件,不会删除新增文件**。必须补:
```bash
comm -13 <(git ls-tree -r --name-only v3.26.5 | sort) <(git ls-tree -r --name-only HEAD | sort) | xargs rm -f
```
2. **插件版本号必须大于线上版本**,否则市场“检查更新”不会降级。做法:内容回退到 1.4.0,但版本号标 **1.4.6**。
3. **回滚会带回旧 bug**:1.4.0 清理 CSS 时误删过 `.iwb-lib-cards` 瀑布流规则,回滚后列表变单列。回滚后必须跑一遍 UI 冒烟(列表/图库/面板图标)。
4. **回滚也要走完整发布仪式**:CHANGELOG 条目、`docs/standards/architecture-current-state.md` 的 `main = <sha>` 与 `线上 vX.Y.Z+<sha>` 锚点,否则 `verify:ci` 直接挂。
## 4. 定位工具(可复用)
宿主写一行探针,外部用 sqlite 读,不依赖 devtools:
```js
// app.js 临时 effect(排查完必须删)
localStorage.setItem('iwb_dbg', JSON.stringify({
cards: document.querySelectorAll('.iwb-plp-card').length,
sheets: document.styleSheets.length,
styles: [...document.querySelectorAll('style')].map(n => (n.getAttribute('data-plugin') || 'host') + '|sheet=' + !!n.sheet),
computed: (() => { const el = document.querySelector('.iwb-plp-card'); const st = el && getComputedStyle(el)
return st ? { display: st.display, aspect: st.aspectRatio, border: st.borderTopWidth, w: el.getBoundingClientRect().width } : null })(),
}))
```
```bash
python3 - <<'PY'
import sqlite3, glob
for d in glob.glob('/Users/qiqi/Library/WebKit/com.malongan.imageworkbench/WebsiteData/Default/*/*/LocalStorage/localstorage.sqlite3'):
con = sqlite3.connect(d)
for k, v in con.execute("select key,value from ItemTable where key='iwb_dbg'"):
print(bytes(v).decode('utf-16-le','ignore'))
PY
```
关键判据:`sheet=false` ⇒ 样式没参与计算;`computed` 里 `display/aspect/border` 与预期不符 ⇒ 规则未命中;`w` 为 0 或明显大于容器 ⇒ 宽度测量问题。
## 5. 发布纪律(这次最大的教训)
| 规则 | 原因 |
|---|---|
| **一次发布只改一件事** | 3.26.6~3.26.9 把 5 个改动塞进连续 4 个版本,坏掉后无法二分定位,只能整体回滚 |
| 改插件样式/布局后**先本机截图自检**,再请用户确认 | 很多问题在截图里一眼可见(单列、色条、白块) |
| 改完跑 `npm run verify:ci`(exit 0 才算完) | ratchet / 耦合快照 / 文档锚点 / 插件主题契约都在里面 |
| 保底手段是“小步回滚”,不是“继续叠加修复” | 连续 2 次猜错就停手回滚,别再加变量 |
## 6. 守门与快照清单(新增代码时容易忘)
- `MAX_APP_JS_LINES`:app.js 行数棘轮,新逻辑放 `src/<domain>-*.js`;确需增长要同步上调并写明理由。
- `MAX_WORKBENCH_LINES`:`Workbench()` 行数上限。
- 耦合面快照:新增 `window.IWB*` 导出后要 `IWB_WRITE_BOUNDARY_SNAPSHOT=1 node tests/architecture-boundary-guard-test.js`,并同步文档里的“耦合面 N 项”。
- 插件主题契约:插件里禁止写死颜色;`color: #fff`(压在图片/渐变上的白字)已列入例外。
- 文档锚点:每次 bump 版本后更新 `main = <sha>` 与 `线上 vX.Y.Z+<sha>`。
## 7. 一句话结论
> 插件样式出问题,先分清「CSS 没生效」还是「规则写错了」——用 `style.sheet` + `getComputedStyle` 两个判据,一次就能定位;
> 发布时一次只动一件事,坏了好回滚;回滚后必须跑 UI 冒烟,因为回滚会带回旧 bug。
+7
View File
@@ -51,3 +51,10 @@
- [ ] 输入框/内嵌块:`background: var(--iwb-plugin-inset)`
- [ ] hover:`background: var(--iwb-plugin-hover)`
- [ ] 没有任何 `#` 开头的颜色字面量(`var(--x, #hex)` 的兜底除外)
## 事故复盘(必读)
插件“有 DOM 没样式”、面板重复、图库首屏空白这一类问题的完整根因与定位方法见:`docs/standards/plugin-dock-incident-2026-11.md`。
- 先判断「CSS 没生效」还是「规则写错」:`style.sheet === null` ⇒ 没生效(CSP nonce / 注入时机)。
- 插件只引用 `--iwb-plugin-*`,这些 token 由 `theme-tokens` 按主题派生(亮/暗自动切换)。
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "image-workbench-web",
"private": true,
"version": "3.26.4",
"version": "3.26.21",
"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/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/ui-workbench-hooks-test.js",
"test:unit": "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/ui-dock-sanitize-test.js && node tests/ui-minimap-fit-test.js && node tests/ui-workbench-hooks-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",
+58 -8
View File
@@ -80,6 +80,8 @@
var cfg = Object.assign({}, DEF)
var items = []
var thumbCache = {}
var thumbPending = {} // 进行中的缩略图请求(v1.6.9)
var total = 0
var limit = 100
var picked = {}
@@ -300,8 +302,9 @@
var gap = 6
var tileW = Math.max(40, Number(cfg.tile) || 110)
var n = Math.max(1, Math.floor((gridW + gap) / (tileW + gap)))
// 列宽 = min(图幅, 均分宽度):图幅是「显示宽度上限」,不再把单列拉满面板
var colW = Math.min(tileW, (gridW - gap * (n - 1)) / n)
// v1.6.6:列宽 = 均分宽度(铺满面板),图幅只决定「列数」——
// 以前 min(图幅, 均分) 会留下右侧空白,看起来像没补齐。
var colW = Math.max(40, (gridW - gap * (n - 1)) / n)
var cols = []
var heights = []
for (var c = 0; c < n; c++) { cols.push([]); heights.push(0) }
@@ -337,6 +340,7 @@
box.appendChild(holder)
var tries = 0
function fail (text) {
tries = 999
holder.textContent = text || '缩略图加载失败(点击重试)'
holder.style.cursor = 'pointer'
holder.onclick = function () { failed[it.name] = 1; tries = 0; boot() }
@@ -344,10 +348,24 @@
updateFail()
}
function boot () {
if (tries >= 999) return
holder.style.cursor = ''
holder.onclick = null
holder.textContent = '加载中…'
Promise.resolve(ctx.gallery.thumb(it.name)).then(function (url) {
// v1.6.9:缩略图地址按名字缓存,且进行中的请求共享同一 Promise ——
// 重排/重测会重建 DOM,不共享就会对同一张图重复取 N 次。
var key = it.name
if (thumbCache[key]) { var u0 = thumbCache[key]; Promise.resolve().then(function () { paint(u0) }).catch(function () { /* ignore */ }); return }
if (!thumbPending[key]) {
thumbPending[key] = Promise.resolve(ctx.gallery.thumb(key)).then(function (url) {
if (url && typeof url === 'string') thumbCache[key] = url
delete thumbPending[key]
return url
}, function (e) { delete thumbPending[key]; throw e })
}
thumbPending[key].then(paint).catch(function () { fail('缩略图加载失败(点击重试)') })
}
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' })
@@ -381,10 +399,18 @@
})
img.style.display = 'none'
box.appendChild(img)
// v1.6.9:坏图/超时兜底 —— 某些坏字节既不触发 load 也不触发 error,700ms 后直接判定失败(可点击重试)
setTimeout(function () {
try {
if (!img.parentNode) return
if (img.naturalWidth > 0) return
if (img.parentNode === box) box.replaceChild(holder, img)
fail('缩略图加载失败(点击重试)')
} catch (e) { /* ignore */ }
}, 700)
// 加载成功后再替换占位(避免破图标 + 长 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('缩略图加载失败(点击重试)') } }
}).catch(function () { fail('缩略图加载失败(点击重试)') })
}
boot()
box.addEventListener('contextmenu', function (e) { openMenu(e, it) })
@@ -443,13 +469,31 @@
}
// 宽度测量:列数只由「面板宽 / 图幅」决定
// v1.6.5:面板刚挂载时 grid 宽度可能是 0,而 grid 宽度又取决于列宽 → RO 不会触发,图库一直空白。
function availableW () {
// v1.6.6:优先量「会随面板拉伸的外层容器」,而不是 grid 自身
// (grid 现在是 flex-start + 内容宽度,面板变宽它不会变宽 → RO 不触发 → 列数永不补齐)
var w = wrap ? wrap.clientWidth : 0
if (!w && wrap && wrap.parentNode) w = wrap.parentNode.clientWidth
if (!w) w = grid.clientWidth
return w || 0
}
function measure () {
var w = grid.clientWidth
var w = availableW()
if (w > 0 && Math.abs(w - gridW) > 1) { gridW = w; renderGrid() }
}
var ro = typeof ResizeObserver === 'function' ? new ResizeObserver(function () { measure() }) : null
if (ro) ro.observe(grid)
if (ro) { if (wrap) ro.observe(wrap); if (wrap && wrap.parentNode) ro.observe(wrap.parentNode); ro.observe(grid) }
measure()
var tries = 0
function retry () {
if (gridW > 0 || tries++ > 40) { if (gridW <= 0) { gridW = Math.max(160, Number(cfg.tile) || 110) * 2; renderGrid() } return }
measure()
if (gridW <= 0) global.requestAnimationFrame(retry)
}
global.requestAnimationFrame(retry)
// v1.6.7:再补几次延时重测(停靠栏展开动画、首帧布局未完成时能在 1s 内自愈)
;[120, 400, 900].forEach(function (ms) { setTimeout(function () { try { measure(); if (gridW > 0) renderGrid() } catch (e) { /* ignore */ } }, ms) })
// v1.3.0:自动恢复 —— 面板重新可见(切回 tab / 窗口聚焦 / 后台回来)且距上次拉取 >5s 时重拉一次,
// 这样图床恢复、后台补图后不必手动刷新;同时保留底部「刷新」按钮做即时重试。
@@ -461,7 +505,13 @@
try {
if (typeof IntersectionObserver === 'function') {
var io = new IntersectionObserver(function (entries) {
for (var i = 0; i < entries.length; i++) if (entries[i].isIntersecting) autoRefresh()
for (var i = 0; i < entries.length; i++) {
if (entries[i].isIntersecting) {
// v1.6.7:面板真正可见后再量一次宽度并重排(首帧可能还是 0 宽)
try { measure(); renderGrid() } catch (e) { /* ignore */ }
autoRefresh()
}
}
}, { threshold: 0.15 })
io.observe(wrap)
}
@@ -488,7 +538,7 @@
global.IWBPluginHost.register({
id: 'gallery',
name: '图库',
version: '1.6.3',
version: '1.6.9',
apiVersion: 1,
capabilities: ['panels', 'gallery'],
data: { schemaVersion: 1, maxBytes: 65536 },
+3 -3
View File
@@ -1,7 +1,7 @@
{
"id": "gallery",
"name": "图库",
"version": "1.6.3",
"version": "1.6.9",
"apiVersion": 1,
"main": "main.js",
"style": "styles.css",
@@ -13,7 +13,7 @@
"图库"
],
"files": {
"main.js": "6628f9aa5be68e0ed798244a1fd4405e50801181e6c0779b22a0723f84309865",
"styles.css": "81b23c43b0308c678bf95e00d6663abcb8b300242ab952ca56b1390fd74bb53e"
"main.js": "26c7e64b3a0021c6b9514dfb84d4d2580276698222b4791cfa99f22ead66ff52",
"styles.css": "9d5b4ab1343761e51ef0c479cab96a94d3d6eaa27f0fdb500bff789ec81d70e0"
}
}
+2 -2
View File
@@ -5,8 +5,8 @@
*/
/* ---- 面板留白:边缘收小,避免窄栏里浪费空间 ---- */
.iwb-history-embedded { padding: 8px 8px 6px; gap: 6px; }
.iwb-history-embedded .iwb-history-grid { gap: 6px; padding: 0 0 4px; justify-content: center; }
.iwb-history-embedded { padding: 6px 6px 4px; gap: 6px; }
.iwb-history-embedded .iwb-history-grid { gap: 6px; padding: 0 0 2px; justify-content: flex-start; }
/* 列宽由插件按「图幅」写死(style width),这里禁用宿主的 flex:1 拉伸 */
.iwb-history-embedded .iwb-history-col { flex: 0 0 auto; gap: 6px; }
+6 -6
View File
@@ -22,10 +22,10 @@
"dir": "gallery",
"main": "main.js",
"style": "styles.css",
"version": "1.6.3",
"version": "1.6.9",
"files": {
"main.js": "6628f9aa5be68e0ed798244a1fd4405e50801181e6c0779b22a0723f84309865",
"styles.css": "81b23c43b0308c678bf95e00d6663abcb8b300242ab952ca56b1390fd74bb53e"
"main.js": "26c7e64b3a0021c6b9514dfb84d4d2580276698222b4791cfa99f22ead66ff52",
"styles.css": "9d5b4ab1343761e51ef0c479cab96a94d3d6eaa27f0fdb500bff789ec81d70e0"
}
},
{
@@ -44,10 +44,10 @@
"dir": "promptlib",
"main": "main.js",
"style": "styles.css",
"version": "1.3.5",
"version": "1.4.9",
"files": {
"main.js": "4a6168ddd574648e85f0407a8fb5796edb376ab851f7957a06cdbd00cfacd902",
"styles.css": "fc9cce0bc14b241f5293bd7685c409c1ee63cb31a9726dfd3c9b530ea9b0fc63"
"main.js": "f8003074e51b6e1e7302d89eebe3e88574089db3aff518c50f419072e6350a42",
"styles.css": "cc71e071379c84131e525afeaa5757674f499da195ccb42536c019a3ef5d8473"
}
},
{
+36 -166
View File
@@ -66,8 +66,6 @@
var groups = []
var query = ''
var filter = 'all'
var expanded = {}
var view = { mode: 'list', id: '' } // v1.1.0:列表 / 详情两态
var coverCache = {}
var managerOpen = false
var modalHost = null
@@ -103,10 +101,44 @@
prompts = (r && r.prompts) || []
groups = (r && r.groups) || []
render()
slimCovers()
return true
}).catch(function (e) { loadError = '读取失败:' + ((e && e.message) || e); prompts = []; render(); return false })
}
// v1.4.0:一次性瘦身 —— 老版本把封面存成 768px(≈50KB/张)。
// 现在上限 448px,检测到超大封面就重新压一遍并保存一次(每个会话最多一次)。
var slimDone = false
function slimCovers () {
if (slimDone) return
slimDone = true
// v1.4.9:除了 >60KB 的,也把老版本存成 PNG 的封面重压一次(448px PNG 仍有 300KB+)
var big = prompts.filter(function (p) {
var c = p && p.cover
if (typeof c !== 'string' || c.indexOf('data:') !== 0) return false
return c.length > 60000 || c.indexOf('data:image/png') === 0
})
if (!big.length) return
var next = prompts.slice()
var i = 0
var changed = false
function step () {
if (i >= big.length) {
if (changed) save(next).then(function () { notify('已压缩 ' + big.length + ' 张封面') }).catch(function () { /* ignore */ })
return
}
var p = big[i++]
Promise.resolve(api.putCover(p.cover)).then(function (r) {
if (r && r.ok && r.ref && String(r.ref).length < p.cover.length) {
next = next.map(function (x) { return x.id === p.id ? Object.assign({}, x, { cover: r.ref }) : x })
changed = true
}
step()
}).catch(function () { step() })
}
step()
}
// ---- 搜索 / 过滤 ----
function words () { return query.trim().toLowerCase().split(/\s+/).filter(Boolean) }
function matches (p) {
@@ -149,134 +181,7 @@
// ---- 编辑面板(窄栏用浮层,宽栏并排无必要;统一浮层,行为可预测) ----
var editor = null
function openEditor (p) {
closeEditor()
var isNew = !p
var draft = p ? Object.assign({}, p) : { id: uid('q'), name: '', text: '', tags: [], group: (filter === 'all' || filter === '__none__') ? '' : filter }
var mask = el('div', { class: 'iwb-modal-mask iwb-promptlib-editor-mask' })
var card = el('div', { class: 'iwb-modal iwb-promptlib-editor' })
var head = el('div', { class: 'iwb-modal-head' })
head.appendChild(el('span', { class: 'iwb-toolbar-title', text: isNew ? '新建提示词' : '编辑提示词' }))
var x = el('button', { class: 'iwb-btn iwb-btn-sm', title: '关闭', text: '✕' })
x.addEventListener('click', closeEditor)
head.appendChild(x)
var bodyEl = el('div', { class: 'iwb-modal-body' })
// v1.1.0:封面(3:4,自动裁切;图片走宿主图片库,条目只存 ref)
var coverBox = el('div', { class: 'iwb-plp-editor-thumb' })
var coverRow = el('div', { class: 'iwb-plp-editor-cover' })
var paintCover = function () {
var url = draft.cover ? coverOf({ id: draft.id, cover: draft.cover, group: draft.group }) : ''
coverBox.textContent = ''
coverBox.style.background = url ? 'var(--iwb-plugin-inset)' : gradOf(draft)
if (url) coverBox.appendChild(el('img', { class: 'iwb-plp-cover', src: url, alt: '' }))
}
paintCover()
var fileIn = el('input', { type: 'file', accept: 'image/*', style: 'display:none' })
var upBtn = el('button', { class: 'iwb-btn iwb-btn-sm', text: '上传图片' })
var delCover = el('button', { class: 'iwb-btn iwb-btn-sm', text: '删除封面' })
upBtn.addEventListener('click', function () { try { fileIn.click() } catch (e) { /* ignore */ } })
fileIn.addEventListener('change', function () {
var f = fileIn.files && fileIn.files[0]
if (!f) return
var rd = new FileReader()
rd.onload = function () {
Promise.resolve(api.putCover(String(rd.result || ''))).then(function (r) {
if (r && r.ok && r.ref) { draft.cover = r.ref; delete coverCache[draft.id]; render(); paintCover(); notify('封面已更新') }
else notify('封面上传失败', 'err')
}).catch(function () { notify('封面上传失败', 'err') })
}
rd.readAsDataURL(f)
})
delCover.addEventListener('click', function () { draft.cover = ''; delete coverCache[draft.id]; render(); paintCover() })
coverRow.appendChild(coverBox)
coverRow.appendChild(el('div', { class: 'iwb-plp-editor-coverops' },
el('div', { class: 'iwb-hint', text: '封面 3:4(自动裁切)' }),
el('div', { class: 'iwb-row' }, upBtn, delCover), fileIn))
bodyEl.appendChild(coverRow)
var nameIn = el('input', { class: 'iwb-input', placeholder: '名称(留空自动取正文前 8 字)', value: draft.name || '' })
var dlId = 'iwb-pl-groups-' + Math.random().toString(36).slice(2, 7)
var groupIn = el('input', { class: 'iwb-input', placeholder: '分组(可留空)', value: draft.group || '' })
groupIn.setAttribute('list', dlId)
var tagsIn = el('input', { class: 'iwb-input', placeholder: '标签,逗号分隔', value: (draft.tags || []).join(', ') })
var textIn = el('textarea', { class: 'iwb-input iwb-promptlib-text', placeholder: '提示词正文' })
textIn.value = draft.text || ''
var dl = el('datalist')
dl.setAttribute('id', dlId)
groupsOf().forEach(function (g) { dl.appendChild(el('option', { value: g.name })) })
bodyEl.appendChild(el('label', { class: 'iwb-promptlib-row' }, el('span', { text: '名称' }), nameIn))
bodyEl.appendChild(el('label', { class: 'iwb-promptlib-row' }, el('span', { text: '分组' }), groupIn))
bodyEl.appendChild(el('label', { class: 'iwb-promptlib-row' }, el('span', { text: '标签' }), tagsIn))
bodyEl.appendChild(textIn)
bodyEl.appendChild(dl)
var foot = el('div', { class: 'iwb-row iwb-promptlib-foot' })
var delBtn = isNew ? null : el('button', { class: 'iwb-btn iwb-btn-sm iwb-btn-danger', title: '删除这条提示词', text: '删除' })
var dupBtn = isNew ? null : el('button', { class: 'iwb-btn iwb-btn-sm', title: '以当前内容另存一条', text: '另存副本' })
var insertBtn = el('button', { class: 'iwb-btn iwb-btn-sm', title: '插入到画布', text: '插入画布' })
var saveBtn = el('button', { class: 'iwb-btn iwb-btn-primary', text: isNew ? '创建' : '保存' })
if (delBtn) {
delBtn.addEventListener('click', function () {
ask('删除提示词「' + (draft.name || '未命名') + '」?', { title: '删除提示词', okText: '删除' }).then(function (ok) {
if (!ok) return
closeEditor()
var list = prompts.filter(function (x) { return x.id !== draft.id })
save(list).then(function () { notify('已删除') })
})
})
foot.appendChild(delBtn)
}
if (dupBtn) {
dupBtn.addEventListener('click', function () {
var copy = Object.assign({}, collect(), { id: uid('q'), name: ((nameIn.value || draft.name || '提示词').trim()) + ' 副本' })
closeEditor()
save(prompts.concat([copy])).then(function () { notify('已另存副本') })
})
foot.appendChild(dupBtn)
}
insertBtn.addEventListener('click', function () {
var c = collect()
var text = String(c.text || '').trim()
if (!text) { notify('提示词内容不能为空', 'err'); return }
Promise.resolve(api.insert(text, c.name)).then(function () { notify('已插入画布:' + (c.name || '提示词')) }).catch(function () { notify('插入画布失败', 'err') })
})
saveBtn.addEventListener('click', function () {
var c = collect()
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 || '' }
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({ id: item.group, name: item.group })
closeEditor()
save(list, gs).then(function () { notify(isNew ? '已创建' : '已保存') })
})
foot.appendChild(el('span', { class: 'iwb-drawer-spacer' }))
foot.appendChild(insertBtn)
foot.appendChild(saveBtn)
bodyEl.appendChild(foot)
function collect () {
return {
id: draft.id,
name: nameIn.value,
group: groupIn.value,
tags: String(tagsIn.value || '').split(',').map(function (s) { return s.trim() }).filter(Boolean),
text: textIn.value,
cover: draft.cover || '',
}
}
mask.addEventListener('pointerdown', function (e) { if (e.target === mask) closeEditor() })
mask.addEventListener('wheel', function (e) { e.stopPropagation() })
card.appendChild(head); card.appendChild(bodyEl)
mask.appendChild(card)
document.body.appendChild(mask)
editor = { mask: mask }
setTimeout(function () { try { (isNew ? textIn : nameIn).focus() } catch (e) { /* ignore */ } }, 0)
}
function closeEditor () {
if (editor && editor.mask && editor.mask.parentNode) editor.mask.parentNode.removeChild(editor.mask)
editor = null
@@ -454,41 +359,7 @@
}
function openDetail (id) { view.mode = 'detail'; view.id = String(id || ''); render(); try { scrollBox.scrollTop = 0 } catch (e) { /* ignore */ } }
function backToList () { view.mode = 'list'; view.id = ''; render() }
function renderDetail () {
var p = null
for (var i = 0; i < prompts.length; i++) if (prompts[i].id === view.id) { p = prompts[i]; break }
if (!p) { view.mode = 'list'; return }
var url = coverOf(p)
var thumb = el('div', { class: 'iwb-plp-dthumb' })
thumb.style.background = url ? 'var(--iwb-plugin-inset)' : gradOf(p)
if (url) thumb.appendChild(el('img', { class: 'iwb-plp-cover', src: url, alt: '' }))
var meta = el('div', { class: 'iwb-plp-dmeta' },
el('div', { class: 'iwb-plp-dtitle', text: p.name || '未命名' }),
el('div', { class: 'iwb-hint', text: [p.group || '未分组'].concat(p.tags || []).join(' · ') + ' · ' + String(p.text || '').length + ' 字' }))
var textEl = el('div', { class: 'iwb-plp-dtext' })
textEl.appendChild(document.createTextNode(p.text || ''))
var head = el('div', { class: 'iwb-plp-dhead' })
var back = el('button', { class: 'iwb-btn iwb-btn-sm', text: '‹ 返回' })
back.addEventListener('click', backToList)
var edit = el('button', { class: 'iwb-btn iwb-btn-sm', text: '编辑' })
edit.addEventListener('click', function () { openEditModal(p, false) })
head.appendChild(back); head.appendChild(el('span', { class: 'iwb-drawer-spacer' })); head.appendChild(edit)
var foot = el('div', { class: 'iwb-plp-dfoot' })
var ins = el('button', { class: 'iwb-btn iwb-btn-sm', text: '插入画布' })
ins.addEventListener('click', function () { Promise.resolve(api.insert(p.text || '', p.name || '')).then(function () { notify('已插入画布:' + (p.name || '提示词')) }).catch(function () { notify('插入画布失败', 'err') }) })
var cp = el('button', { class: 'iwb-btn iwb-btn-sm', text: '复制全文' })
cp.addEventListener('click', function () { Promise.resolve(api.copy(p.text || '')).then(function (r) { if (r && r.ok === false) notify('复制失败', 'err'); else notify('已复制全文') }) })
var del = el('button', { class: 'iwb-btn iwb-btn-sm iwb-btn-danger', text: '删除' })
del.addEventListener('click', function () {
ask('删除提示词「' + (p.name || '未命名') + '」?', { title: '删除提示词', okText: '删除' }).then(function (ok) {
if (!ok) return
backToList()
save(prompts.filter(function (x) { return x.id !== p.id })).then(function () { notify('已删除') })
})
})
foot.appendChild(ins); foot.appendChild(cp); foot.appendChild(el('span', { class: 'iwb-drawer-spacer' })); foot.appendChild(del)
scrollBox.appendChild(head); scrollBox.appendChild(el('div', { class: 'iwb-row iwb-plp-dtop' }, thumb, meta)); scrollBox.appendChild(textEl); scrollBox.appendChild(foot)
}
// ===== v1.2.0:可拖动 / 可缩放弹窗(详情 & 编辑)=====
@@ -719,7 +590,6 @@
}
function render () {
clear(fixed); clear(scrollBox)
if (view.mode === 'detail') { renderDetail(); return }
var gs = groupsOf()
// 搜索行
@@ -850,7 +720,7 @@
global.IWBPluginHost.register({
id: 'promptlib',
name: '提示词库',
version: '1.3.5',
version: '1.4.9',
apiVersion: 1,
capabilities: ['panels', 'promptlib'],
data: { schemaVersion: 1, maxBytes: 65536 },
+3 -3
View File
@@ -1,7 +1,7 @@
{
"id": "promptlib",
"name": "提示词库",
"version": "1.3.5",
"version": "1.4.9",
"apiVersion": 1,
"main": "main.js",
"style": "styles.css",
@@ -13,7 +13,7 @@
"提示词"
],
"files": {
"main.js": "4a6168ddd574648e85f0407a8fb5796edb376ab851f7957a06cdbd00cfacd902",
"styles.css": "fc9cce0bc14b241f5293bd7685c409c1ee63cb31a9726dfd3c9b530ea9b0fc63"
"main.js": "f8003074e51b6e1e7302d89eebe3e88574089db3aff518c50f419072e6350a42",
"styles.css": "cc71e071379c84131e525afeaa5757674f499da195ccb42536c019a3ef5d8473"
}
}
+7 -13
View File
@@ -17,8 +17,6 @@
/* v1.0.2(2026-11-21):卡片化 —— 白卡 + 悬停 + 文本三行截断。
颜色一律走宿主 --iwb-plugin-* / --iwb-* token,不在插件里写死。 */
.iwb-promptlib .iwb-pcard { transition: background .12s ease, border-color .12s ease; }
.iwb-promptlib .iwb-pcard:hover { border-color: var(--iwb-border2, #b9bfca); }
.iwb-promptlib .iwb-pname { font-weight: 600; }
.iwb-promptlib .iwb-ptext {
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
@@ -28,10 +26,6 @@
/* v1.1.0(2026-11-21):封面网格 + 长文详情 + 宽编辑弹窗。
颜色全部走宿主 token,不写死。 */
.iwb-promptlib .iwb-lib-cards {
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 8px;
}
.iwb-plp-card {
position: relative; border-radius: 10px; overflow: hidden; cursor: pointer;
aspect-ratio: 1 / 1; border: 1px solid var(--iwb-border, #d5d9e0);
@@ -125,12 +119,6 @@
.iwb-plp-card .iwb-plp-cover { object-fit: cover; object-position: center; }
/* v1.3.4:瀑布流(列式)+ 卡片定宽不随面板拉伸;面板底色统一走 --iwb-plugin-surface */
.iwb-promptlib .iwb-lib-cards {
display: block;
column-width: 122px; /* 面板越宽 → 列数越多;卡片宽度基本不变 */
column-gap: 8px;
grid-template-columns: none;
}
.iwb-promptlib .iwb-plp-card {
display: inline-block; width: 100%; margin: 0 0 8px;
break-inside: avoid; -webkit-column-break-inside: avoid;
@@ -138,8 +126,14 @@
}
.iwb-promptlib .iwb-plp-cover { width: 100%; height: auto; object-fit: contain; }
/* 统一插件灰:面板底(宿主会给 --iwb-plugin-surface,这里只留兜底) */
.iwb-promptlib { background: var(--iwb-plugin-surface, #f2f4f6); }
.iwb-promptlib { background: transparent; }
/* v1.3.5:无封面的提示词也给一个方形占位(否则瀑布流里会塌成一条线) */
.iwb-promptlib .iwb-plp-card.no-cover { aspect-ratio: 1 / 1; }
.iwb-promptlib .iwb-plp-card.no-cover .iwb-plp-t { max-height: 60%; }
/* v1.4.7:恢复瀑布流列规则(1.4.0 清理 CSS 时把这组规则一起删掉了,列表退化成单列、卡片被拉满宽) */
.iwb-promptlib .iwb-lib-cards { display: block; column-width: 122px; column-gap: 8px; grid-template-columns: none; }
.iwb-promptlib .iwb-plp-card { display: inline-block; width: 100%; margin: 0 0 8px; break-inside: avoid; -webkit-column-break-inside: avoid; aspect-ratio: auto; }
.iwb-promptlib .iwb-plp-cover { width: 100%; height: auto; object-fit: contain; }
.iwb-promptlib .iwb-plp-card.no-cover { aspect-ratio: 1 / 1; }
+2
View File
@@ -91,7 +91,9 @@ const sourceModules = [
'canvas-text.js',
'generation-task-graph.js',
'generation-results-store.js',
'ui-dock-sanitize.js',
'ui-dock.js',
'ui-minimap-fit.js',
'ui-dock-panels.js',
'theme-tokens.js',
'canvas-grid.js',
+48 -4
View File
@@ -54,13 +54,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.4 · 8.4 MB · .dmg<div class="hash">sha256 b3a19df4a178f94f…</div></div>
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.26.4_aarch64.dmg?h=b3a19df4a178">下载</a>
<div class="meta">版本 3.26.21 · 8.4 MB · .dmg<div class="hash">sha256 b90b44339a2c14ae…</div></div>
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.26.21_aarch64.dmg?h=b90b44339a2c">下载</a>
</div>
<div class="row">
<div class="name">macOS · Intel<div class="hint">x86_64</div></div>
<div class="meta">版本 3.26.4 · 8.8 MB · .dmg<div class="hash">sha256 21ecb123ed6f9e8d…</div></div>
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.26.4_x64.dmg?h=21ecb123ed6f">下载</a>
<div class="meta">版本 3.26.21 · 8.8 MB · .dmg<div class="hash">sha256 11a84de069e7b89b…</div></div>
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.26.21_x64.dmg?h=11a84de069e7">下载</a>
</div>
<div class="row">
<div class="name">Windows · x64<div class="hint">需要 WebView2</div></div>
@@ -94,6 +94,50 @@
</ol>
<h2>历史版本</h2>
<div class="row">
<div class="name">3.26.21<div class="hint">Intel 版:同一修复</div></div>
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.20<div class="hint">Intel 版:同一修复</div></div>
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.18<div class="hint">Intel 版:同一布局逻辑</div></div>
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.17<div class="hint">Intel 版:同一布局修复</div></div>
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.16<div class="hint">Intel 版:同一修复</div></div>
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.15<div class="hint">Intel 版:同一调整</div></div>
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.14<div class="hint">Intel 版:同一调整</div></div>
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.13<div class="hint">Intel 版:同一修复</div></div>
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.12<div class="hint">Intel 版:同一修复</div></div>
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.10<div class="hint">Intel 版:同一回退</div></div>
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.5<div class="hint">Intel 版:同一改动</div></div>
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.26.4<div class="hint">Intel 版:同一改动</div></div>
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
+9 -9
View File
@@ -2,7 +2,7 @@
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Image Workbench · 本地优先的 AI 生图工作台</title>
<meta name="description" content="本地优先的 AI 生图无限画布:节点式工作流、插件按需安装、数据全部留在本机。">
<link rel="stylesheet" href="/assets/style.css?v=3.26.4-mwqh8amk">
<link rel="stylesheet" href="/assets/style.css?v=3.26.21-mwqm1k7u">
</head><body>
<nav><div class="wrap inner">
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
@@ -14,19 +14,19 @@
</div>
<div class="right">
<a class="btn" href="/plugins/">插件市场</a>
<a class="btn primary" href="/download/">下载 v3.26.4</a>
<a class="btn primary" href="/download/">下载 v3.26.21</a>
</div>
</div></nav>
<main>
<section class="hero hero-art">
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.26.4-mwqh8amk" alt=""></div>
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.26.21-mwqm1k7u" alt=""></div>
<div class="hero-veil"></div>
<div class="wrap">
<span class="kicker">v3.26.4 · macOS / Windows · 数据在本地</span>
<span class="kicker">v3.26.21 · macOS / Windows · 数据在本地</span>
<h1>本地优先的<br>AI 生图无限画布</h1>
<p class="sub">用节点把「参考图 → 提示词 → 批量生成 → 图库」串成一条生产线。<br>图片、提示词、模型配置全部留在你自己的电脑里,插件按需安装。</p>
<div class="cta">
<a class="btn primary lg" href="/download/">下载 v3.26.4</a>
<a class="btn primary lg" href="/download/">下载 v3.26.21</a>
<a class="btn lg" href="/plugins/">浏览 11 个插件</a>
</div>
<div class="meta">支持 macOS 12+ 与 Windows 10 1803+ · 安装包约 7 MB · 无需登录</div>
@@ -70,7 +70,7 @@
</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.3 · 官方</div></div></div>
<div><div class="nm">图库</div><div class="ver">v1.6.9 · 官方</div></div></div>
<div class="desc">右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供)</div>
<div class="tags"><span class="tag">资源</span><span class="tag">图库</span></div>
</div>
@@ -82,7 +82,7 @@
</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.3.5 · 官方</div></div></div>
<div><div class="nm">提示词库</div><div class="ver">v1.4.9 · 官方</div></div></div>
<div class="desc">右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供)</div>
<div class="tags"><span class="tag">资源</span><span class="tag">提示词</span></div>
</div>
@@ -93,8 +93,8 @@
<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.4_aarch64.dmg?h=b3a19df4a178"><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.4_x64.dmg?h=21ecb123ed6f"><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.21_aarch64.dmg?h=b90b44339a2c"><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.21_x64.dmg?h=11a84de069e7"><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>
+19 -19
View File
@@ -1,6 +1,6 @@
{
"version": 2,
"updatedAt": "2026-11-21T13:58:17.979Z",
"updatedAt": "2026-11-21T16:12:55.040Z",
"plugins": [
{
"id": "batch-export",
@@ -112,26 +112,26 @@
"资源",
"图库"
],
"version": "1.6.3",
"version": "1.6.9",
"apiVersion": 1,
"bundle": "plugins/gallery-1.6.3.zip",
"bundleSize": 31433,
"bundleSha256": "3ed53c236f48b945b514db42980383eb10f6f8a78f83d1abd64f0dc5807317c1",
"bundle": "plugins/gallery-1.6.9.zip",
"bundleSize": 34272,
"bundleSha256": "9588b28fd2b2b3cc0f38ecd06fee05873474ca98867ce5b2dc5d6cc5948cf383",
"files": [
{
"path": "manifest.json",
"sha256": "8800f1270ac20625b9837752c0b45c1a3a48ebdaeb633245a313209b97dc9937",
"sha256": "0523a370d28132dcca912894929e402e9e7bac4a611be146ee075d073f26276c",
"size": 526
},
{
"path": "main.js",
"sha256": "6628f9aa5be68e0ed798244a1fd4405e50801181e6c0779b22a0723f84309865",
"size": 25406
"sha256": "26c7e64b3a0021c6b9514dfb84d4d2580276698222b4791cfa99f22ead66ff52",
"size": 28241
},
{
"path": "styles.css",
"sha256": "81b23c43b0308c678bf95e00d6663abcb8b300242ab952ca56b1390fd74bb53e",
"size": 5191
"sha256": "9d5b4ab1343761e51ef0c479cab96a94d3d6eaa27f0fdb500bff789ec81d70e0",
"size": 5195
}
]
},
@@ -180,26 +180,26 @@
"资源",
"提示词"
],
"version": "1.3.5",
"version": "1.4.9",
"apiVersion": 1,
"bundle": "plugins/promptlib-1.3.5.zip",
"bundleSize": 58530,
"bundleSha256": "ec4997316fcbbb3bab28fbe84a9b165d4d20efeed0f99d6fc7c3f7046f84dd5c",
"bundle": "plugins/promptlib-1.4.9.zip",
"bundleSize": 49537,
"bundleSha256": "f37a315e401f944467ed6464ff9186bd84e833ce901e38ad2857b0e8e03b26d9",
"files": [
{
"path": "manifest.json",
"sha256": "ebd25dea9a76b5a71fe5c90faef0f121c880b7149b342b815afe31231b62662d",
"sha256": "e5a01b544c6d7557d503112b10e2d1761a6d90207fc3705efb6938bc5aee312e",
"size": 540
},
{
"path": "main.js",
"sha256": "4a6168ddd574648e85f0407a8fb5796edb376ab851f7957a06cdbd00cfacd902",
"size": 48242
"sha256": "f8003074e51b6e1e7302d89eebe3e88574089db3aff518c50f419072e6350a42",
"size": 39163
},
{
"path": "styles.css",
"sha256": "fc9cce0bc14b241f5293bd7685c409c1ee63cb31a9726dfd3c9b530ea9b0fc63",
"size": 9438
"sha256": "cc71e071379c84131e525afeaa5757674f499da195ccb42536c019a3ef5d8473",
"size": 9524
}
]
},
+4 -4
View File
@@ -1,7 +1,7 @@
<!doctype html>
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>插件市场 · Image Workbench</title>
<link rel="stylesheet" href="/assets/style.css?v=3.26.4-mwqh8amk">
<link rel="stylesheet" href="/assets/style.css?v=3.26.21-mwqm1k7u">
</head><body>
<nav><div class="wrap inner">
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
@@ -13,7 +13,7 @@
</div>
<div class="right">
<a class="btn" href="/plugins/">插件市场</a>
<a class="btn primary" href="/download/">下载 v3.26.4</a>
<a class="btn primary" href="/download/">下载 v3.26.21</a>
</div>
</div></nav>
<main>
@@ -64,7 +64,7 @@
</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.3 · 官方</div></div></div>
<div><div class="nm">图库</div><div class="ver">v1.6.9 · 官方</div></div></div>
<div class="desc">右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供)</div>
<div class="tags"><span class="tag">资源</span><span class="tag">图库</span></div>
</div>
@@ -76,7 +76,7 @@
</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.3.5 · 官方</div></div></div>
<div><div class="nm">提示词库</div><div class="ver">v1.4.9 · 官方</div></div></div>
<div class="desc">右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供)</div>
<div class="tags"><span class="tag">资源</span><span class="tag">提示词</span></div>
</div>
+232 -1
View File
@@ -1,8 +1,239 @@
{
"app": "Image Workbench",
"subtitle": "本地优先的 AI 生图无限画布 · 桌面版(Tauri v2)",
"updatedAt": "2026-11-21T14:01:45.822Z",
"updatedAt": "2026-11-21T16:16:29.756Z",
"releases": [
{
"version": "3.26.21",
"date": "2026-11-22",
"notes": "Intel 版:同一修复",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.21_aarch64.dmg",
"size": 8779485,
"sha256": "b90b44339a2c14ae48a73cbbd4db67c6cb973f680f2d88ec6372eb712515598d",
"h": "b90b44339a2c",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.21_x64.dmg",
"size": 9180736,
"sha256": "11a84de069e7b89b662d5ae8e8d4fe11928abd168b5c09cdd614f29ceddb7906",
"h": "11a84de069e7",
"kind": "dmg"
}
}
},
{
"version": "3.26.20",
"date": "2026-11-22",
"notes": "Intel 版:同一修复",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.20_aarch64.dmg",
"size": 8779972,
"sha256": "d55587aa75ed700145ca0ccbbe5bb9ed9232e9d01223e3cec895d7a3f8b0b895",
"h": "d55587aa75ed",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.20_x64.dmg",
"size": 9180611,
"sha256": "b6a5d3e5e6ea2b46bbe2012deeeda7af7e284ce38ef731dac15d1ad881873c9c",
"h": "b6a5d3e5e6ea",
"kind": "dmg"
}
}
},
{
"version": "3.26.18",
"date": "2026-11-21",
"notes": "Intel 版:同一布局逻辑",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.18_aarch64.dmg",
"size": 8777308,
"sha256": "d15a3c51d94965f1fd60e7fbbfd58fffa6720d29b93cb56530e6475043dc0c09",
"h": "d15a3c51d949",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.18_x64.dmg",
"size": 9184474,
"sha256": "8bc4116c6306935afbc94908db19e7dfe863eda7a7c1a1a028f5a49f062aa703",
"h": "8bc4116c6306",
"kind": "dmg"
}
}
},
{
"version": "3.26.17",
"date": "2026-11-21",
"notes": "Intel 版:同一布局修复",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.17_aarch64.dmg",
"size": 8779085,
"sha256": "8a0ce45f5d3e77338ef15ef58ba848b23bc0027fed0a017a4c041050d894a25c",
"h": "8a0ce45f5d3e",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.17_x64.dmg",
"size": 9180521,
"sha256": "a8cff28cbc428cc5ef25c4c520ca38cfce6d3c8661e5d7e46ab20cc146452437",
"h": "a8cff28cbc42",
"kind": "dmg"
}
}
},
{
"version": "3.26.16",
"date": "2026-11-21",
"notes": "Intel 版:同一修复",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.16_aarch64.dmg",
"size": 8777222,
"sha256": "5f6e15bb854e48b8f7fbe3d640bfc9add72fc519c1ffecfcbf4638188874a620",
"h": "5f6e15bb854e",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.16_x64.dmg",
"size": 9183580,
"sha256": "a00bd308e3e2fab4ca5634ebc10e7ae957beed0ebdc54bd77732a917828a7108",
"h": "a00bd308e3e2",
"kind": "dmg"
}
}
},
{
"version": "3.26.15",
"date": "2026-11-21",
"notes": "Intel 版:同一调整",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.15_aarch64.dmg",
"size": 8776641,
"sha256": "2e1e9e31e186194d2482c33df585daeb6762cd9d98a5fe5ac57ed3ccaf2cec22",
"h": "2e1e9e31e186",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.15_x64.dmg",
"size": 9181353,
"sha256": "b9263c7a72b27d0ebdcc4c955a6cd9e3254951a173228e49100bc6d2c9b0ed54",
"h": "b9263c7a72b2",
"kind": "dmg"
}
}
},
{
"version": "3.26.14",
"date": "2026-11-21",
"notes": "Intel 版:同一调整",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.14_aarch64.dmg",
"size": 8779158,
"sha256": "8f1cd52d58485a42012b7b1ca3272f281dd45d07ec49d22280ab902d4483f52b",
"h": "8f1cd52d5848",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.14_x64.dmg",
"size": 9185158,
"sha256": "3d8cffd282742df80dfc27ae7770090d7cf8217fabe70e378954e7795eb03449",
"h": "3d8cffd28274",
"kind": "dmg"
}
}
},
{
"version": "3.26.13",
"date": "2026-11-21",
"notes": "Intel 版:同一修复",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.13_aarch64.dmg",
"size": 8777257,
"sha256": "f16f3701e26a78a8952439d22588e461904690d124e8d146f7d8d382364f6315",
"h": "f16f3701e26a",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.13_x64.dmg",
"size": 9182535,
"sha256": "aeae23a2725fbfaeda12372faf6ec2b1eb016d5f19ad2c8d595471c6e70cfeaa",
"h": "aeae23a2725f",
"kind": "dmg"
}
}
},
{
"version": "3.26.12",
"date": "2026-11-21",
"notes": "Intel 版:同一修复",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.12_aarch64.dmg",
"size": 8782148,
"sha256": "92804727934e9d7dc4ba4e555db0e70d77fc537b2d8fa9504679802eef3a5c10",
"h": "92804727934e",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.12_x64.dmg",
"size": 9183379,
"sha256": "ecbc56ca38ad0ac6577f4901d4fd025d5b659f70745efe94c0ec8e0203d47b17",
"h": "ecbc56ca38ad",
"kind": "dmg"
}
}
},
{
"version": "3.26.10",
"date": "2026-11-21",
"notes": "Intel 版:同一回退",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.10_aarch64.dmg",
"size": 8780299,
"sha256": "e4599b96a640734b4703870ff475cc6b1ffff307b89732b3db57dbf286e31260",
"h": "e4599b96a640",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.10_x64.dmg",
"size": 9181870,
"sha256": "fee997f2042cc237a442408926674c40ad09f24bd475c6959ba3456b22479f10",
"h": "fee997f2042c",
"kind": "dmg"
}
}
},
{
"version": "3.26.5",
"date": "2026-11-21",
"notes": "Intel 版:同一改动",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.26.5_aarch64.dmg",
"size": 8780166,
"sha256": "3a92b0ab330a4fff72c2c20654010e7f250b0d2dc3f383bfec9eeb8e00017f9d",
"h": "3a92b0ab330a",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.26.5_x64.dmg",
"size": 9182578,
"sha256": "86322e874c0d92e68926989f80f7c71cc500404fc8392c20846f86b2da6fe4e8",
"h": "86322e874c0d",
"kind": "dmg"
}
}
},
{
"version": "3.26.4",
"date": "2026-11-21",
+1 -1
View File
@@ -1983,7 +1983,7 @@ dependencies = [
[[package]]
name = "image-workbench"
version = "3.26.4"
version = "3.26.21"
dependencies = [
"arboard",
"base64 0.22.1",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "image-workbench"
version = "3.26.4"
version = "3.26.21"
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.4",
"version": "3.26.21",
"identifier": "com.malongan.imageworkbench",
"build": {
"frontendDist": "../dist",
+11 -1
View File
@@ -105,7 +105,8 @@
chrome: mix(surface0, canvas, 0.4),
homeBg: mix(surface0, canvas, 0.35),
dockBg: mix(surface3, canvas, 0.45),
dockHeadBg: mix(mix(surface3, canvas, 0.45), '#000000', 0.06),
// v3.26.19:顶栏比停靠栏更浅(向面板色靠 55%),不再压暗
dockHeadBg: mix(mix(surface3, canvas, 0.45), surface0, 0.55),
border,
border2,
text,
@@ -115,6 +116,11 @@
edge: border2,
edgeHot,
gridDot,
// v3.26.20:插件通用灰(中性灰,不带蓝调;暗色模式跟随主题,不再固定浅色)
pluginSurface: d ? mix(surface0, '#ffffff', 0.07) : mix(surface1, '#000000', 0.035),
pluginCard: d ? mix(surface0, '#ffffff', 0.11) : surface1,
pluginInset: d ? mix(surface0, '#000000', 0.12) : mix(surface1, '#000000', 0.075),
pluginHover: d ? mix(surface0, '#ffffff', 0.16) : mix(surface1, '#000000', 0.11),
}
}
@@ -131,6 +137,10 @@
s('--iwb-layer', tokens.layer)
s('--iwb-layer2', tokens.layer2)
s('--iwb-node-bg', tokens.nodeBg)
s('--iwb-plugin-surface', tokens.pluginSurface)
s('--iwb-plugin-card', tokens.pluginCard)
s('--iwb-plugin-inset', tokens.pluginInset)
s('--iwb-plugin-hover', tokens.pluginHover)
s('--iwb-border', tokens.border)
s('--iwb-border2', tokens.border2)
s('--iwb-text', tokens.text)
+2 -1
View File
@@ -44,7 +44,8 @@ function I(name, cls) {
function Minimap(props) {
const { nodes, viewport, canvasSize, measuredH, measuredT, onJump } = props
const hOf = (n) => (measuredH && measuredH[n.id]) || n.h || nodeTypeH(n.type)
const MW = 168, MH = 112, PAD = 6
// v3.26.17:小地图缩小一档(132×88),并整体上移到工具栏之上
const MW = 132, MH = 88, PAD = 5
let minX = 0, minY = 0, maxX = 1, maxY = 1
for (const n of nodes) {
minX = Math.min(minX, n.x); minY = Math.min(minY, n.y)
+46
View File
@@ -0,0 +1,46 @@
/* ui-dock-sanitize.js —— 停靠栏状态的纯函数整理(v3.26.21)
*
* 从 ui-dock.js 抽出来,便于单测(jsdom 里跑 React + 拖拽太重)。规则:
* 1. 只保留当前存在(plugins 有注册)的面板;
* 2. 同侧去重(历史重复注册残留);
* 3. 默认面板回填:removed 里的不补、另一侧已有的不补;
* 4. 同一面板同时出现在左右两侧 → 只保留左侧。
*/
;(function (global) {
'use strict'
function sanitize (dock, panels, defaults) {
if (!dock || !panels) return dock
var changed = false
var next = { left: Object.assign({}, dock.left), right: Object.assign({}, dock.right) }
;['left', 'right'].forEach(function (side) {
var s0 = dock[side] || {}
var removed = Array.isArray(s0.removed) ? s0.removed : []
var defList = (defaults && defaults[side] && defaults[side].list) || []
var list = (s0.list || []).filter(function (id) { return !!panels[id] })
list = list.filter(function (id, i) { return list.indexOf(id) === i })
defList.forEach(function (id) {
if (!panels[id]) return
if (removed.indexOf(id) >= 0) return
var other = side === 'left' ? 'right' : 'left'
var otherList = (dock[other] && dock[other].list) || []
if (otherList.indexOf(id) >= 0) return
if (list.indexOf(id) >= 0) return
list.push(id)
})
var active = panels[s0.active] ? s0.active : (list[0] || '')
// 用内容比较而不是长度:去重(减 1) + 默认回填(加 1) 时长度可能不变,但内容已不同
if (list.join('|') !== (s0.list || []).join('|') || active !== s0.active) {
next[side] = Object.assign({}, s0, { list: list, active: active })
changed = true
}
})
var dup = (next.left.list || []).filter(function (id) { return (next.right.list || []).indexOf(id) >= 0 })
if (dup.length) {
next.right = Object.assign({}, next.right, { list: next.right.list.filter(function (id) { return dup.indexOf(id) < 0 }) })
if (dup.indexOf(next.right.active) >= 0) next.right.active = next.right.list[0] || ''
changed = true
}
return changed ? next : dock
}
global.IWBUiDockSanitize = { sanitize: sanitize }
})(typeof window !== 'undefined' ? window : globalThis)
+20 -24
View File
@@ -129,7 +129,14 @@
if (first) { s.active = first; changed = true }
}
})
return changed ? next : d
// v3.26.12:同一面板同时出现在左右两侧 → 只保留左侧(老数据重复注册的残留)
const dup = next.left.list.filter(function (id) { return next.right.list.indexOf(id) >= 0 })
if (dup.length) {
next.right = Object.assign({}, next.right, { list: next.right.list.filter(function (id) { return dup.indexOf(id) < 0 }) })
if (dup.indexOf(next.right.active) >= 0) next.right.active = next.right.list[0] || ''
changed = true
}
return changed ? next : d
})
}, 1200)
return function () { clearTimeout(t) }
@@ -141,31 +148,11 @@
return function () { clearTimeout(t) }
}, [dock])
// v3.25.84:插件启停后面板集合会变 —— 清掉已不存在的 id,active 失效时回退到第一个可用面板
// v3.26.21:整理逻辑抽到 src/ui-dock-sanitize.js(纯函数,带单测)
useEffect(function () {
setDock(function (d) {
let changed = false
const next = Object.assign({}, d)
for (const side of ['left', 'right']) {
const s0 = d[side]
// v3.25.87:插件关闭时会从 list 里剔除;重新启用后要把默认面板补回来。
// 只有「用户手动拖出栏」的(记在 removed 里)不补,尊重手动排序/移除。
const removed = Array.isArray(s0.removed) ? s0.removed : []
const defList = (props.defaults && props.defaults[side] && props.defaults[side].list) || []
let list = (s0.list || []).filter(function (id) { return !!panels[id] })
for (const id of defList) {
if (!panels[id]) continue
if (removed.indexOf(id) >= 0) continue
if (list.indexOf(id) >= 0) continue
list = list.concat([id])
}
const active = panels[s0.active] ? s0.active : (list[0] || '')
if (list.length !== (s0.list || []).length || active !== s0.active) {
next[side] = Object.assign({}, s0, { list: list, active: active })
changed = true
}
}
return changed ? next : d
const S = global.IWBUiDockSanitize
return (S && typeof S.sanitize === 'function') ? S.sanitize(d, panels, props.defaults) : d
})
}, [panels])
@@ -230,9 +217,18 @@
const dockEl = (rootRef.current && rootRef.current.querySelector) ? rootRef.current.querySelector('.iwb-dock[data-side="' + side + '"]') : null
let pendingW = startW
let raf = 0
const NAV_W = 52
const flush = function () {
raf = 0
if (dockEl) { try { dockEl.style.width = pendingW + 'px' } catch (err) { /* ignore */ } }
// v3.26.13:拖动过程中同步 --iwb-dock-l/r,工具栏/小地图实时跟着让位(以前只在松手时提交,图标会"飘"过去)
try {
const r = global.document && global.document.documentElement
if (r) {
if (side === 'left') r.style.setProperty('--iwb-dock-l', (NAV_W + pendingW) + 'px')
else r.style.setProperty('--iwb-dock-r', pendingW + 'px')
}
} catch (err) { /* ignore */ }
}
const move = function (ev) {
const dx = ev.clientX - startX
+51
View File
@@ -0,0 +1,51 @@
/* ui-minimap-fit.js —— 小地图与底部工具栏的避让(v3.26.18)
*
* 小地图与悬浮工具栏同一排(都在底部)。右栏拉宽会压缩画布可用宽度,
* 当两者横向重叠时,把小地图淡出隐藏(而不是硬挤或改布局)。
* 触发:窗口 resize / 工具栏或小地图尺寸变化 / 停靠栏拖宽(iwb:dock-resizing)。
*/
;(function (global) {
'use strict'
var GAP = 8
function install () {
try {
var doc = global.document
if (!doc || global.IWBMiniMapFitInstalled) return
global.IWBMiniMapFitInstalled = true
var raf = 0
function fit () {
raf = 0
try {
var bar = doc.querySelector('.iwb-toolbar-wrap .iwb-toolbar')
var mm = doc.querySelector('.iwb-minimap')
if (!bar || !mm) return
var a = bar.getBoundingClientRect()
var b = mm.getBoundingClientRect()
var tight = b.left < a.right + GAP
if (mm.classList.contains('iwb-minimap-tight') !== tight) mm.classList.toggle('iwb-minimap-tight', tight)
} catch (e) { /* ignore */ }
}
function schedule () { if (!raf) raf = global.requestAnimationFrame(fit) }
var ro = null
try {
if (typeof global.ResizeObserver === 'function') {
ro = new global.ResizeObserver(schedule)
var observe = function () {
try {
var nodes = doc.querySelectorAll('.iwb-toolbar-wrap, .iwb-toolbar, .iwb-minimap')
for (var i = 0; i < nodes.length; i++) ro.observe(nodes[i])
} catch (e) { /* ignore */ }
}
observe()
try {
new global.MutationObserver(function () { observe(); schedule() }).observe(doc.body, { childList: true, subtree: true })
} catch (e) { /* ignore */ }
}
} catch (e) { /* ignore */ }
global.addEventListener('resize', schedule)
global.addEventListener('iwb:dock-resizing', schedule)
schedule()
} catch (e) { /* ignore */ }
}
global.IWBMiniMapFit = { install: install }
})(typeof window !== 'undefined' ? window : globalThis)
+15 -13
View File
@@ -21,7 +21,8 @@
头部再深一档用「栏身 + 6% 黑」而不是往画布色混:暗色整条灰阶只有 #6F–#75,
混画布色实测 ΔL 仅 0.006(看不见),黑色叠加在亮/暗下都能看出头部带(1.14:1 / 1.11:1)。 */
--iwb-dock-bg: color-mix(in srgb, var(--iwb-chrome) 55%, var(--iwb-canvas-bg) 45%);
--iwb-dock-head-bg: color-mix(in srgb, var(--iwb-dock-bg) 94%, #000);
/* v3.26.19:顶栏底色比停靠栏更浅一档(原来是压暗 6%,现在向面板色靠 55%) */
--iwb-dock-head-bg: color-mix(in srgb, var(--iwb-panel) 55%, var(--iwb-dock-bg));
--iwb-panel: #ffffff;
--iwb-layer: #f0f1f4;
--iwb-layer2: #ffffff;
@@ -38,10 +39,10 @@
--iwb-plugin-text: var(--iwb-text);
--iwb-plugin-text2: var(--iwb-text2);
/* 插件面板四层(v3.25.96):只提供取值,不做任何变量重指(3.25.89 的事故不再重演) */
--iwb-plugin-surface: #eceff2;
--iwb-plugin-surface: #f1f1f1;
--iwb-plugin-card: #ffffff;
--iwb-plugin-inset: #e3e7ea;
--iwb-plugin-hover: #dde2e6;
--iwb-plugin-inset: #e9e9e9;
--iwb-plugin-hover: #dfdfdf;
--iwb-plugin-brand: var(--iwb-brand);
--iwb-plugin-on-brand: var(--iwb-on-brand);
--iwb-plugin-err: var(--iwb-err);
@@ -292,7 +293,9 @@ button { font-family: inherit; }
@keyframes iwb-pulse { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }
.iwb-hint-bottom { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); font-size: 10px; color: var(--iwb-text2); background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: 8px; padding: 3px 10px; z-index: 9; opacity: 0.8; white-space: nowrap; }
.iwb-boxsel { position: absolute; border: 1px dashed var(--iwb-brand); background: color-mix(in srgb, var(--iwb-brand) 12%, transparent); z-index: 3; pointer-events: none; }
.iwb-minimap { position: absolute; right: 62px; bottom: 14px; width: 168px; height: 112px; background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: 8px; z-index: 11; cursor: crosshair; overflow: hidden; touch-action: none; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
/* v3.26.18:右栏挤压到工具栏时自动隐藏(避免两者重叠) */
.iwb-minimap.iwb-minimap-tight { opacity: 0; transform: translateY(6px); pointer-events: none; }
.iwb-minimap { transition: opacity .16s ease, transform .16s ease; position: absolute; right: 62px; bottom: 14px; width: 132px; height: 88px; background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: 8px; z-index: 11; cursor: crosshair; overflow: hidden; touch-action: none; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.iwb-mini-node { position: absolute; border-radius: 2px; opacity: 0.85; }
.iwb-mini-view { position: absolute; border: 1px solid var(--iwb-brand); border-radius: 2px; pointer-events: none; }
.iwb-modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 300; display: flex; align-items: center; justify-content: center; }
@@ -2196,12 +2199,10 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
border: 0; border-radius: 7px; background: transparent; color: var(--iwb-text2); cursor: pointer;
position: relative; padding: 0;
}
.iwb-dock-btn:hover { background: var(--iwb-layer); color: var(--iwb-text); }
.iwb-dock-btn.on { background: var(--iwb-layer); color: var(--iwb-text); }
.iwb-dock-btn.on::after {
content: ''; position: absolute; left: 7px; right: 7px; bottom: 1px; height: 2px;
border-radius: 2px; background: var(--iwb-brand);
}
.iwb-dock-btn:hover { background: color-mix(in srgb, var(--iwb-text) 4%, transparent); color: var(--iwb-text); }
/* v3.26.15:选中态更克制 —— 只提亮图标 + 极淡底,不再用实心白块和下划线 */
.iwb-dock-btn.on { background: color-mix(in srgb, var(--iwb-text) 11%, transparent); color: var(--iwb-text); }
.iwb-dock-btn.on:hover { background: color-mix(in srgb, var(--iwb-text) 14%, transparent); }
.iwb-dock-toggle { color: var(--iwb-text2); }
.iwb-dock-body { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; overscroll-behavior: contain; }
.iwb-dock-body > * { min-height: 0; }
@@ -2234,7 +2235,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
.iwb-tab-actions .iwb-top-nav-icon { width: 28px; height: 28px; min-height: 28px; }
/* 其它浮层让位(画布不动) */
.iwb-toolbar-wrap { left: var(--iwb-dock-l, 0px); right: calc(60px + var(--iwb-dock-r, 0px)); }
.iwb-minimap { right: calc(62px + var(--iwb-dock-r, 0px)); }
.iwb-minimap { right: calc(62px + var(--iwb-dock-r, 0px)); bottom: 14px; }
.iwb-statusbar { right: calc(62px + var(--iwb-dock-r, 0px)); }
.iwb-hint-bottom { left: calc(var(--iwb-dock-l, 0px) + (100% - var(--iwb-dock-l, 0px) - var(--iwb-dock-r, 0px)) / 2); }
@@ -2368,8 +2369,9 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
/* ── 库面板(提示词库 / 节点组)视觉层(v3.25.96)────────────────────────────
只作用于这两个面板容器(.iwb-dock-body[data-panel=...]),其他插件零影响:
面板浅灰底;提示词库白卡、节点组灰卡(用户裁定:节点组不要白卡)。 */
/* v3.26.14:提示词库 / 节点组 与图库一致 —— 不额外铺底色(透明,直接显示停靠栏底) */
.iwb-dock-body[data-panel="prompts"],
.iwb-dock-body[data-panel="groups"] { background: var(--iwb-plugin-surface); }
.iwb-dock-body[data-panel="groups"] { background: transparent; }
.iwb-dock-body[data-panel="prompts"] .iwb-pcard,
.iwb-dock-body[data-panel="groups"] .iwb-pcard { border-radius: 10px; transition: background .12s ease, border-color .12s ease; }
.iwb-dock-body[data-panel="prompts"] .iwb-pcard { background: var(--iwb-plugin-card); }
+1
View File
@@ -23,6 +23,7 @@
"IWBImageRemoteCache",
"IWBImageThumbPick",
"IWBMetricsSwallow",
"IWBMiniMapFit",
"IWBNativeClipboard",
"IWBNodeBodies",
"IWBPluginData",
+2
View File
@@ -63,7 +63,9 @@
"canvas-text.js",
"generation-task-graph.js",
"generation-results-store.js",
"ui-dock-sanitize.js",
"ui-dock.js",
"ui-minimap-fit.js",
"ui-dock-panels.js",
"theme-tokens.js",
"canvas-grid.js",
+7 -4
View File
@@ -142,8 +142,11 @@ async function boot (opts) {
thumb: () => GOOD,
})
const widths = () => Array.from(env.host.querySelectorAll('.iwb-history-col')).map((c) => c.style.width)
// 默认「中」=110px:列宽应为 110(而不是被 flex 拉满)
assert.ok(widths().every((w) => w === '110px'), '默认列宽应为 110px,实际 ' + widths().join(','))
// v1.6.6:列宽改为「均分铺满」——图幅只决定列数;各列宽度应一致且总宽 ≈ 容器宽
const wNums = widths().map((w) => parseInt(w, 10))
assert.ok(wNums.length >= 2, '应至少 2 列,实际 ' + wNums.length)
assert.ok(wNums.every((w) => w === wNums[0]), '各列宽度应一致,实际 ' + wNums.join(','))
assert.ok(wNums[0] > 40, '列宽应铺满可用宽度,实际 ' + wNums[0])
const cols = env.host.querySelectorAll('.iwb-history-col').length
assert.ok(cols >= 2, '应至少 2 列,实际 ' + cols)
@@ -154,13 +157,13 @@ async function boot (opts) {
tileSel.value = '200'
tileSel.dispatchEvent(new env.window.Event('change'))
await wait(60)
assert.ok(widths().every((w) => w === '200px'), '切到特大后列宽应为 200px,实际 ' + widths().join(','))
{ const big = widths().map((w) => parseInt(w, 10)); assert.ok(big.every((w) => w === big[0] && w > 40), '切到特大后各列仍应等宽铺满,实际 ' + big.join(',')) }
// v1.6.3 新增「极小」=64px:列宽 64,且列数比「特大」更多(图幅小 = 一行看更多)
tileSel.value = '64'
tileSel.dispatchEvent(new env.window.Event('change'))
await wait(60)
assert.ok(widths().every((w) => w === '64px'), '切到极小后列宽应为 64px,实际 ' + widths().join(','))
assert.ok(widths().length >= 3, '极小图幅应该更多列,实际 ' + widths().join(','))
assert.ok(env.host.querySelectorAll('.iwb-history-col').length > cols, '极小的列数应多于默认列数')
}
+45
View File
@@ -125,5 +125,50 @@ const wait = (ms) => new Promise((r) => setTimeout(r, ms))
await wait(50)
assert.strictEqual(calls.insert.length, 1, '插入应调用 ctx.promptlib.insert')
// ---- v1.4.0 新增覆盖:封面渲染 / 插入封面图片 / 弹窗拖动缩放 ----
// 1) 封面:mock coverUrl 返回一张 dataURL,卡片应出现 <img class=iwb-plp-cover>
prompts[0].cover = 'data:image/webp;base64,AAAA'
ctx.promptlib.coverUrl = async () => ({ ok: true, url: 'data:image/webp;base64,BBBB' })
await (panel.mount ? Promise.resolve() : Promise.resolve())
// 重新挂载一份(mount 只跑一次,直接重建 host)
window.document.getElementById('host').innerHTML = ''
panel.mount(window.document.getElementById('host'))
await wait(80)
const coverImg = window.document.querySelector('#host .iwb-plp-cover')
assert.ok(coverImg, '有封面的卡片应渲染封面 <img>')
// 2) 插入封面图片:详情底部出现「插入图片」,点击后调用 insertImage 并关闭弹窗
const inserted = []
ctx.promptlib.insertImage = async (cover, name) => { inserted.push([cover, name]); return { ok: true } }
window.document.querySelector('#host .iwb-plp-card').dispatchEvent(new window.MouseEvent('click', { bubbles: true }))
await wait(40)
const dlgA = window.document.querySelector('.iwb-plp-dialog')
const imgBtn = dlgA && Array.from(dlgA.querySelectorAll('.iwb-plp-dfooter button')).find((b) => b.textContent === '插入图片')
assert.ok(imgBtn, '有封面时详情应有「插入图片」按钮')
imgBtn.dispatchEvent(new window.MouseEvent('click', { bubbles: true }))
await wait(60)
assert.strictEqual(inserted.length, 1, '应调用 promptlib.insertImage')
assert.strictEqual(window.document.querySelector('.iwb-plp-dialog'), null, '插入图片后弹窗应关闭')
// 3) 弹窗拖动 + 缩放:标题栏拖动改变 left,右下角拖拽改变 width(且不小于 640)
window.document.querySelector('#host .iwb-plp-card').dispatchEvent(new window.MouseEvent('click', { bubbles: true }))
await wait(40)
const dlgB = window.document.querySelector('.iwb-plp-dialog')
assert.ok(dlgB, '应打开详情弹窗')
const head = dlgB.querySelector('.iwb-plp-dhead')
const left0 = parseInt(dlgB.style.left, 10)
head.dispatchEvent(new window.MouseEvent('pointerdown', { bubbles: true, clientX: 400, clientY: 200 }))
window.dispatchEvent(new window.MouseEvent('pointermove', { bubbles: true, clientX: 460, clientY: 240 }))
window.dispatchEvent(new window.MouseEvent('pointerup', { bubbles: true }))
const left1 = parseInt(dlgB.style.left, 10)
assert.ok(left1 > left0, '拖动标题栏应改变弹窗位置(' + left0 + ' → ' + left1 + ')')
const grip = dlgB.querySelector('.iwb-plp-resize')
const w0 = parseInt(dlgB.style.width, 10)
grip.dispatchEvent(new window.MouseEvent('pointerdown', { bubbles: true, clientX: 800, clientY: 600 }))
window.dispatchEvent(new window.MouseEvent('pointermove', { bubbles: true, clientX: 900, clientY: 700 }))
window.dispatchEvent(new window.MouseEvent('pointerup', { bubbles: true }))
const w1 = parseInt(dlgB.style.width, 10)
assert.ok(w1 > w0, '右下角拖拽应放大弹窗(' + w0 + ' → ' + w1 + ')')
console.log('promptlib render checks passed(渲染/跨分组搜索+范围提示/拖拽 payload/编辑落盘/插入)')
})().catch((e) => { console.error(e); process.exit(1) })
+3 -2
View File
@@ -26,7 +26,7 @@ function walk (dir, out) {
for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
const p = path.join(dir, e.name)
if (e.isDirectory()) walk(p, out)
else if (/\.js$/i.test(e.name)) out.push(p)
else if (/\.(js|css)$/i.test(e.name)) out.push(p)
}
return out
}
@@ -44,7 +44,6 @@ for (const f of files) {
if (ALLOW_FILES.has(base)) continue
// 已知 plugin-batch-export 的导出按钮色写死(#1d9e75 等),留给插件源码仓库修。
const src = fs.readFileSync(f, 'utf8')
if (!/(background|border)|\bcolor\s*:/.test(src)) continue // 没有样式声明的插件跳过
checked++
// 找 background/color/border 声明里直接写 hex(排除 var(--x,#hex) 的 fallback)
const re = /(background(?:-color)?|color|border(?:-color)?)\s*:\s*([^;'"]{0,80})/gi
@@ -53,6 +52,8 @@ for (const f of files) {
const val = m[2]
if (!/#[0-9a-f]{3,8}/i.test(val)) continue
if (/var\(--[a-z0-9-]+\s*,\s*#[0-9a-f]{3,8}/i.test(val)) continue // fallback
// 白字(压在图片/渐变上的标题)属于内容对比,不算主题表面色
if (/^color$/i.test(m[1]) && /^#(?:fff|ffffff)$/i.test(val)) continue
bad.push(base + ' → ' + m[1] + ': ' + val.trim().slice(0, 60))
}
}
+1 -1
View File
@@ -149,7 +149,7 @@ const MAX_SRC_COMPONENT_LINES = 531
// ② 同时守「app.js 占总源码 ≤ 40%」(2026-11-12 实测 38.4%)—— app.js 可以涨,
// 但必须涨得比 src 慢;功能继续加,占比自然往下走;
// ③ Workbench 单函数上限**不动**(3,091)—— 那才是真坏味道的护栏,总量松它不松。
const MAX_APP_JS_LINES = 9085 // 2026-11-21 v3.26.2:封面比例探测/节点宽度映射(模块级 helper)
const MAX_APP_JS_LINES = 9095 // 2026-11-21 v3.26.18:小地图避让 install 调用(逻辑在 src/ui-minimap-fit.js)
const MAX_APP_JS_SHARE = 0.40
// ── 历史记账(供回溯,逐条保留)──────────────────────────────────────────────
+40
View File
@@ -0,0 +1,40 @@
// 停靠栏状态整理(v3.26.21):同侧去重 / 跨侧只保留左侧 / 默认回填规则
const assert = require('assert')
const fs = require('fs')
const path = require('path')
const src = fs.readFileSync(path.join(__dirname, '..', 'src', 'ui-dock-sanitize.js'), 'utf8')
const sandbox = {}
new Function('window', src)(sandbox)
const { sanitize } = sandbox.IWBUiDockSanitize
const panels = { prompts: {}, gallery: {}, groups: {}, styles: {} }
const noDefaults = { left: { list: [] }, right: { list: [] } }
const defaults = { left: { list: ['styles', 'groups'] }, right: { list: ['gallery', 'prompts'] } }
const mk = (l, r) => ({ left: { list: l, active: l[0] || '', open: true, w: 300, removed: [] }, right: { list: r, active: r[0] || '', open: true, w: 300, removed: [] } })
// 1) 同侧重复 → 去重(关掉默认回填,单独验证去重)
let d = sanitize(mk(['prompts', 'prompts', 'groups'], ['gallery']), panels, noDefaults)
assert.deepStrictEqual(d.left.list, ['prompts', 'groups'], '同侧应去重,实际 ' + JSON.stringify(d.left.list))
// 2) 同一 id 同时出现在两侧 → 只保留左侧
d = sanitize(mk(['prompts'], ['gallery', 'prompts']), panels, noDefaults)
assert.deepStrictEqual(d.right.list, ['gallery'], '右侧重复 id 应移除,实际 ' + JSON.stringify(d.right.list))
assert.strictEqual(d.left.list.indexOf('prompts') >= 0, true, '左侧应保留')
// 3) 未注册的面板 → 剔除,active 回退到第一个可用
d = sanitize(mk(['ghost', 'groups'], ['gallery']), panels, noDefaults)
assert.deepStrictEqual(d.left.list, ['groups'], '未注册面板应剔除,实际 ' + JSON.stringify(d.left.list))
assert.strictEqual(d.left.active, 'groups', 'active 应回退到可用面板')
// 4) 默认回填:另一侧已有的不补;removed 里的不补
d = sanitize({ left: { list: ['prompts'], active: 'prompts', removed: ['styles'] }, right: { list: ['gallery'], active: 'gallery', removed: [] } }, panels, defaults)
assert.ok(d.left.list.indexOf('styles') < 0, 'removed 的 styles 不该被回填,实际 ' + JSON.stringify(d.left.list))
assert.deepStrictEqual(d.left.list, ['prompts', 'groups'], '其余默认面板应回填,实际 ' + JSON.stringify(d.left.list))
assert.ok(d.right.list.indexOf('prompts') < 0, '左侧已有的 prompts 不该回填到右侧,实际 ' + JSON.stringify(d.right.list))
// 5) 已干净的状态 → 原样返回(引用相等,避免无谓重渲染)
const clean = mk(['prompts'], ['gallery'])
assert.strictEqual(sanitize(clean, panels, noDefaults), clean, '干净状态应返回原对象')
console.log('ui-dock-sanitize checks passed(同侧去重 / 跨侧保留左侧 / 未注册剔除 / 默认回填规则 / 幂等)')
+39
View File
@@ -0,0 +1,39 @@
// 小地图与底部工具栏避让(v3.26.21):重叠时加 iwb-minimap-tight,腾出空间后移除
const assert = require('assert')
const fs = require('fs')
const path = require('path')
const { JSDOM } = require('jsdom')
const dom = new JSDOM('<!doctype html><html><body><div class="iwb-toolbar-wrap"><div class="iwb-toolbar"></div></div><div class="iwb-minimap"></div></body></html>')
const { window } = dom
window.requestAnimationFrame = (fn) => setTimeout(() => fn(Date.now()), 0)
window.cancelAnimationFrame = (id) => clearTimeout(id)
const bar = window.document.querySelector('.iwb-toolbar')
const mm = window.document.querySelector('.iwb-minimap')
let barRight = 900
let mmLeft = 950
bar.getBoundingClientRect = () => ({ left: 300, right: barRight, top: 800, bottom: 860, width: barRight - 300, height: 60 })
mm.getBoundingClientRect = () => ({ left: mmLeft, right: mmLeft + 132, top: 800, bottom: 888, width: 132, height: 88 })
const src = fs.readFileSync(path.join(__dirname, '..', 'src', 'ui-minimap-fit.js'), 'utf8')
new Function('window', src)(window)
window.IWBMiniMapFit.install()
const wait = (ms) => new Promise((r) => setTimeout(r, ms))
async function check (label, expectTight) {
window.dispatchEvent(new window.Event('resize'))
await wait(30)
const tight = mm.classList.contains('iwb-minimap-tight')
assert.strictEqual(tight, expectTight, label + ':期望 tight=' + expectTight + ',实际 ' + tight)
}
;(async () => {
await check('间距充足(950 > 900+8)不应隐藏', false)
mmLeft = 890
await check('即将重叠(890 < 908)应隐藏', true)
mmLeft = 1200
await check('空间回来(1200 > 908)应恢复', false)
console.log('ui-minimap-fit checks passed(不重叠显示 / 临界隐藏 / 回位恢复)')
})()