Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
890565cfd4 | ||
|
|
b92a30ff9a | ||
|
|
afe507557e | ||
|
|
746fbc1e5e | ||
|
|
26c5ecff7b | ||
|
|
1d571623b0 | ||
|
|
06e27afa1d | ||
|
|
f520e1a0fd | ||
|
|
2a892bce93 | ||
|
|
68a9f636ed | ||
|
|
433b62a500 | ||
|
|
eb1073c175 | ||
|
|
5dd4dd0a74 | ||
|
|
5cfda44b46 | ||
|
|
7035d8fad2 | ||
|
|
6291d51bcc | ||
|
|
348bf56c3f | ||
|
|
205cb81ca9 | ||
|
|
bf7ed841ae | ||
|
|
e94012db84 | ||
|
|
9b78535791 | ||
|
|
5e127bd23f | ||
|
|
0c1c30dc20 | ||
|
|
6002c34c0f | ||
|
|
cf0e9a09b9 | ||
|
|
83029e9bc7 | ||
|
|
2ca9512b49 | ||
|
|
e966b348b9 | ||
|
|
054db215cd | ||
|
|
b34b936d2e | ||
|
|
1ebb07d389 | ||
|
|
b45d6b2712 | ||
|
|
7e99b2ba42 | ||
|
|
d77c70bf67 | ||
|
|
129fedc596 | ||
|
|
ffd342fa4c | ||
|
|
fdfaf9e12f | ||
|
|
1d9ef0cc99 | ||
|
|
18dad1b9af | ||
|
|
53f41c2f9f | ||
|
|
f7ace22121 | ||
|
|
57b885be31 | ||
|
|
93871f7e91 | ||
|
|
75a70654ee | ||
|
|
5b5dbbd417 | ||
|
|
f64898db96 | ||
|
|
9c8e7745f9 | ||
|
|
48b85cae04 | ||
|
|
c4305c184a | ||
|
|
e3547e549f | ||
|
|
e8905c606f | ||
|
|
931dbe7d5d | ||
|
|
2f8f355716 | ||
|
|
a378dc52ad | ||
|
|
6ba340bb65 | ||
|
|
9cf7c17e9e | ||
|
|
a8c7b6092e |
No files matched your search
+16
@@ -138,6 +138,22 @@
|
||||
|
||||
---
|
||||
|
||||
### 1.2 标注插件「远程图片不支持标注」的收尾(2026-11-24 · 中等收益)
|
||||
|
||||
> 证据:`image-annotate/src/index.js:9218` 只在 `getNodeImage` 返回 `dataUrl` 时才开编辑器,否则报
|
||||
> 「该节点是远程图片,暂不支持标注(请先转存为本地位图)」。
|
||||
|
||||
v3.26.61 已把三个成因收敛掉(`getNodeImage` 补 `data.localRef` 候选 / 只有远程时按需抓字节并写回
|
||||
`localRef` / 图库插入改本地副本),但两条尾巴还在:
|
||||
|
||||
1. **文案里的「转存」没有对应入口** —— 抓取失败(离线、图床拦跨域且不在 Tauri http 白名单)时,
|
||||
用户看到「请先转存为本地位图」却找不到按钮。二选一:① 画布 ref 节点右键加「转存为本地图片」
|
||||
(`wImgRefWrite` → `localRef`);② 把文案改成可执行引导(「下载到本地后拖进画布」)。
|
||||
2. **一次失败不再重试** —— `image-remote-cache` 的 `tried` 集合记住节点 id 后永不重试;网络恢复后
|
||||
只能靠用户手动再点。可加「右键重试取图」。
|
||||
|
||||
---
|
||||
|
||||
## 2. P1 — 有明确证据支撑,价值高
|
||||
|
||||
### 2.0 ✅ 图库索引(`OUT_KEY`)跨标签页「读-改-写」—— **已修(2026-11-16,v3.24.85)**
|
||||
|
||||
+140
@@ -2,6 +2,8 @@
|
||||
|
||||
本文件记录每个版本的改动,方便回溯。每个版本对应一个 git tag(如 `v3.80.3`),并已通过 GitHub Release 发布到仓库 `malongan/image-workbench-web`。
|
||||
|
||||
> **⚠️ 发布流程时效(2026-11-24)**:下面第 1/2 条的 `deploy:test` / `deploy` 是 2026-10 前**网页版**历史流程,桌面版已不使用。桌面版发布:`npm run verify:ci` → `bash scripts/publish-update.sh`(mac)→ 站点/版本记录;Windows 见 `docs/WIN_BUILD_SPEC.md` 与 §13.60。
|
||||
|
||||
> **⚠️ 版本号有两条线(2026-10-20 说明)**:
|
||||
> - **`3.8x` 是历史线**(2026-09 前后,v3.77.0 ~ v3.87.65,92 个 tag)—— 保留原样**不改写**(按项目规范「历史发布条目按规则不改写」)。
|
||||
> - **`3.0x` 起是现行线**(2026-10 起:v3.0.x → v3.1.x → v3.20.x → v3.21.0)。
|
||||
@@ -14,6 +16,144 @@
|
||||
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
|
||||
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
|
||||
|
||||
## v3.26.64(2026-11-24)修复 8 个 e2e spec 的失效选择器(.iwb-tab-home)
|
||||
|
||||
> 状态:代码完成(macOS 双架构待发;Windows 待构建)
|
||||
|
||||
**问题**:标签条里的「首页」房子按钮在 **v3.25.62 已删除**(入口只剩一级导航),但有 **8 个 spec + 2 个探针 + 1 个视觉钉点**仍按 `.iwb-tab-home` 写 —— 这些用例长期在测一个不存在的元素,等于全红,却没人发现。
|
||||
|
||||
**修复**
|
||||
- `tests/_helpers/wait.js` 新增唯一入口:`goHome(page)` / `expectHomeActive(page)` / `HOME_NAV`(选择器只写一处)
|
||||
- 8 个 spec 改用它:`iwb-tabs-release`(4 处) / `iwb-tab-dot`(2) / `iwb-close-flush` / `iwb-duplicate-ws` / `iwb-home-release` / `iwb-image-memory-parity` / `iwb-memory-history` / `clipboard-audit`(2,含「把鼠标停在画布外」用的中心点)
|
||||
- 「回首页后首页标签 active」的断言改为「一级导航「首页」带 `on`」(`expectHomeActive`)
|
||||
- 删掉 3 条无生产者的死 CSS:`.iwb-tab-home` / `.iwb-tab-home.iwb-tab-active` / `.iwb-tab-home .iwb-ic`
|
||||
- 视觉回归钉点从「首页标签无选中底色」改为「一级导航激活项是墨色底」(语义不变,`background: var(--iwb-text)`)
|
||||
- `_perf-baseline` / `_probe-tab-switch` / `iwb-canvas-ops` 里「排除 `.iwb-tab-home`」的过滤条件一并删除(已无意义)
|
||||
- `iwb-stability.spec.js` 默认 baseURL 从**线上站**改为本地 `127.0.0.1:8787`(它此前默认打生产,本地改动根本测不到;也和其它 spec 不一致)
|
||||
|
||||
**验证**
|
||||
- `iwb-tabs-release`(3) + `iwb-tab-dot` + `iwb-duplicate-ws` + `iwb-home-release` = **6 passed**
|
||||
- `iwb-stability` 的「新建并切换工作台后刷新仍保留」修好后通过(其余 5 条是该 spec 自身的资源中心/拖拽用例,与本次无关)
|
||||
- `iwb-close-flush` 3 条仍红,但已用 `git stash` 在**改动前**复跑同样失败 → 与本次修复无关
|
||||
- `verify:ci` 全绿
|
||||
|
||||
## v3.26.63(2026-11-24)规则统一 P0:确认入口 / 剪贴板门面 / 文档硬数字守卫
|
||||
|
||||
> 状态:代码完成(macOS 双架构待发;Windows 待构建)
|
||||
|
||||
**① 确认入口收成 1 份**
|
||||
- 同一个 5 行 `askConfirm`/`wConfirm` 包装此前复制 **7 份**(app.js + 6 个 src),两种写法;现全部删除,统一调 `IWBUIConfirm.askOrNative`(`src/ui-confirm.js` 唯一实现)
|
||||
- `window.confirm` 现在只存在于 `src/ui-confirm.js`(网页端行为不变:非 Tauri 仍走原生)
|
||||
- `src/ui-backup-modal.js` 里「是否有原生 confirm」的判断改为判断门面是否存在
|
||||
|
||||
**② 文档硬数字纳入自动校验**
|
||||
- 新增 `scripts/ratchet-metrics.js`:唯一测量实现(app.js 行数 / Workbench 行数 / src 模块数与行数 / 占比)+ 文档改写规则
|
||||
- `scripts/sync-facts.js` 新增一步:自动改写 `CONTRIBUTING.md` 与 `docs/standards/architecture-current-state.md` 里的 4 类数字
|
||||
- `tests/architecture-facts-guard-test.js` 新增 6b:文档数字与代码不一致即红
|
||||
- **首次运行就修正了 6 处长期漂移**:CONTRIBUTING 的 `MAX_APP_JS_LINES` 写 8,700(真实 9,115,差 415 行)、架构文档 6 项(9,112 行 / 29.9% / Workbench 3,045 / 上限 3,046 / src 21,334 行等)
|
||||
|
||||
**③ 剪贴板统一走门面**
|
||||
- 5 处绕过 `IWBClipboardCopy` 的直连改走门面:诊断页复制、设置页「复制诊断」(原先自带一份 textarea 兜底 = 真重复)、节点 Markdown 编辑器复制、插件 copy 能力、结果图复制链接
|
||||
- `navigator.clipboard.writeText` 现在只存在于门面自身
|
||||
|
||||
**棘轮**:`MAX_APP_JS_LINES` 9115 → **9,105**(实测 9,104,删掉的 8 行不留给下次随便涨)
|
||||
|
||||
## v3.26.62(2026-11-24)设计 token 收口:补类别 + L3 进单一源 + 三方一致性守卫
|
||||
|
||||
> 状态:代码完成(macOS 双架构已发;Windows 待构建)
|
||||
|
||||
**A 收紧**
|
||||
- 棘轮基线下调到实测(字号写死 159→120、圆角 95→74、间距 377→353,字号取值种数 13→12、圆角 17→14)
|
||||
- 新 token:`--iwb-font-2xs(10px)`、`--iwb-bw / -strong`、`--iwb-icon-sm/md/lg`、`--iwb-opacity-disabled/muted`、`--iwb-ease-out/in-out`、`--iwb-motion-fast/base/slow`
|
||||
- 承认 10px:29 处裸写归入 `2xs`,并写死「不得用于可读正文」
|
||||
|
||||
**B 补类**
|
||||
- 状态层 6 个:`--iwb-err/ok/warn` 的 `-bg` / `-bd`,由 derive() 派生(亮浅底+深字 / 暗深底+亮字),替换样式里 16 处内联 color-mix
|
||||
- `tokens.json` 从「跳过关系式」变为 0 跳过:补齐 27 个此前缺失项(插件别名、focus-ring、hr、edge-dash、grid-on、anim*、chrome/home/dock 等)
|
||||
- 动效 token 落地(旧文档的 `--iwb-dur-*` / `--iwb-ease-standard` 从未存在,已更正)
|
||||
|
||||
**C 收口**
|
||||
- L3 组件 token(`--iwb-set-*` 18 个 + `--iwb-pop-*` 11 个)从 style.css 手写改为 `COMPONENT_SCOPED` 单一源,生成进 design-tokens.css;style.css 只留布局属性
|
||||
- 新增 `tests/design-tokens-component-doc-test.js`:文档表格 ↔ tokens.json ↔ 生成产物三方双向断言(29 项),并禁止 style.css 再声明
|
||||
- 顺带修正解析器缺陷:`.theme-dark .iwb-pop {…}` 会被当成整块暗色主题,覆盖真正的暗色值
|
||||
|
||||
## v3.26.61(2026-11-24)图库:出图即见 + 插入落地本地副本(能标注)
|
||||
|
||||
> 状态:代码完成(宿主 + gallery 1.7.0)
|
||||
|
||||
用户报障两条:①「生图后图库不能及时显示上游传来的图」②「多个入口插入的是上游图片链接,画布不能标注」。
|
||||
用户裁定 B6 = **复制**(多占空间可以接受,要求不丢数据)。
|
||||
|
||||
- **出图即见**:归档从「整轮结束写一次」改为**每张完成即入库**(`handleCompletedJob` → `archiveEntryNow`)。
|
||||
串行队列避免并发读改写索引互相吃;等这张的缩略图落盘再通知,避免插件先闪远程大图。
|
||||
宿主新增 `IWBPluginGallery.emit`,图库插件订阅 `ctx.gallery.onChanged`(260ms 防抖重拉)——
|
||||
此前只有「面板重新可见且距上次拉取 >5s」一个入口,而生成时面板一直可见 ⇒ 永远不刷。
|
||||
- **插入能标注**:`insertOutputsToCanvas` 取源改为「本地字节优先」——原图档 → 清单 data → 缩略图 →
|
||||
按需抓一次远程(桌面端走 Rust 请求,不受 CORS)→ 压缩 → `{__blob}` 引用(字节落 `images/canvas/`)。
|
||||
抓不到才保留原链接,节点 `data.srcUrl` 留痕,toast 明确提示「可能无法标注」。图库拖入同一收口。
|
||||
- **批量插入不再叠图**:旧实现在循环里每张各自 `findSpot`,而 `findSpot` 只看已提交节点 ⇒ 同批全落一处。
|
||||
改为一次 commit + 4 列栅格铺开。
|
||||
- **插件取图补 `localRef`**:`canvasBridge.getNodeImage` 候选列表漏了 `data.localRef`(远程参考图本地缓存
|
||||
写的字段)⇒ 缓存明明命中,标注插件仍只看到 http 链接并判「远程图片不支持标注」。只有远程时按需
|
||||
抓一次字节并写回 `localRef`,抓不到才返回 `{ url }`。
|
||||
- gallery 1.7.0:格子「插入」补 `insertK`(此前忽略「插入尺寸」档,与右键/顶部不一致);插入/删除补
|
||||
「插入中…」状态;删除改为等宿主删完再重拉(固定 250ms 会拉到未删完的清单,格子出现「图片已丢失」)。
|
||||
- 新增 `src/gallery-sync.js`(取源/归档/栅格/取图的判定都在这),app.js 只 `attach(...)` 装配;
|
||||
新增 `tests/gallery-sync-test.js`(11 项)。行数棘轮 9095 → 9115(理由记在棘轮文件里)。
|
||||
- 纠错过时口径(用户要求):图库/缩略图/原图档在桌面端是 `images/thumbs`、`images/gallery` 文件,
|
||||
不是 IndexedDB;「1K 插入档降的是长边像素、不是体积」(PNG 源仍无损输出,1024 复杂图 ~500KB~1MB)。
|
||||
|
||||
## v3.26.60(2026-11-24)浮层字号上调一档(「模型设置 / 图像设置」不再小字)
|
||||
|
||||
> 状态:正式发布(macOS arm64 / x86_64)
|
||||
|
||||
- 用户反馈两个贴节点浮层里的选项文字偏小,整体放大一档:选择项 **11 → 13px**、高度 **22 → 28px**、左右内距 **6 → 10px**、间距 **4 → 6px**、面板标题 **12 → 14px**,面板宽 **328 → 360px**(抵消放大后多出来的换行)
|
||||
- 辅助小字同步:分组标签(质量/尺寸/分辨率/宽高比)11 → 12、`16 倍数对齐` 与服务商/分组/模型标签 12 → 13、尺寸数字框 12 → 13、浮层内说明文字 10 → 12
|
||||
- 改动全部落在 `.iwb-pop` 的 6 个 token 上(两个面板共用同一套),模型名「单行不省略、超长独占一行」的契约不变
|
||||
- `.iwb-gen-config` 的宽度原来写死 `min(92vw, 320px)`(绕过 token,字号放大后不跟着变宽)→ 改为引用 `--iwb-pop-w`
|
||||
- 同步 `docs/standards/design-tokens.md` §3.13 的 token 表;token 棘轮三项计数顺带下降(字号写死 159→152、圆角 95→92、间距 377→366)
|
||||
|
||||
## v3.26.59(2026-11-24)备份带上插件文件(提示词封面不再换机丢失)
|
||||
|
||||
> 状态:正式发布(macOS arm64 / x86_64)
|
||||
|
||||
- **P0 备份补洞**:`plugin-data/<id>/files/` 里的插件文件(提示词封面等)随 ZIP 写成 `plugin-files/<id>/<文件名>`,恢复时写回沙箱。此前只备份 JSON ⇒ 换机后「提示词都在、封面全是灰块」,而状态行还写着「已恢复」
|
||||
- 新增 `IWBPluginData.listFiles / readFile / restoreFiles` 与 `IWBStorageFile.pluginFiles.readBytes / listAll`:清单一次给出、字节**逐条读**(写一张放一张,不攒数组,插件文件单插件上限 64MB)
|
||||
- 校验和口径统一:图片与插件文件的**字节**不进 checksum(`images / imagesData / pluginFiles / pluginFilesData` 全排除);JSON 兜底导出按自身内容重算 checksum,避免「换个打包形态就报校验不一致」
|
||||
- 备份确认弹窗的体积估算与张数把插件文件计入;恢复摘要新增「含 N 个插件文件(封面等)」
|
||||
- 同步 `promptlib` 1.11.0:封面保存/上传即落成文件(数据里只留文件名)、未被引用的封面可回收(启动后自动一次 + 设置页「清理未引用封面」)
|
||||
|
||||
## v3.26.58(2026-11-24)节点浮层改为紧凑规格(C1)
|
||||
|
||||
> 状态:正式发布(macOS arm64 / x86_64)
|
||||
|
||||
- 面板宽 380 → **328**,内边距 16/20 → 10/12,分组间距 8
|
||||
- 选项高 32 → **22px**,字号 13 → **11px**,左右内边距 12 → 6,圆角 8 → 6
|
||||
- 分组标签 12 → 11px + 600 字重;数字框与选项同高
|
||||
- 图像设置面板高度 496 → **约 310px**(含提示行)
|
||||
- 修 `.iwb-image-settings` 硬编码 `width:380px` 覆盖 `--iwb-pop-w` 的问题,宽度只认 token
|
||||
- 规范 §3.13 同步为 C1 数值
|
||||
|
||||
## v3.26.57(2026-11-24)节点浮层收口:去掉左上闪现、选择项统一尺寸、popover token
|
||||
|
||||
> 状态:正式发布(macOS arm64 / x86_64)
|
||||
|
||||
- 修「点开模型设置/图像设置时画布左上先闪一下」:定位从 `useEffect` 改 `useLayoutEffect`,未定位前 `visibility:hidden`(首帧默认坐标 (40,40) 是闪现根因)
|
||||
- 选择项统一:`.iwb-chip-line` 与 `.iwb-gc-item` 共用 32px 高、8px 圆角、13px 字号、12px 左右内边距;下拉框同高
|
||||
- 新增 popover token(§3.13):`--iwb-pop-w/pad/gap/radius/title-size/chip-h/chip-pad-x/chip-radius/chip-gap/chip-size`
|
||||
- 面板内边距 16/18 → 16/20、分组间距统一 8px,两套浮层观感一致
|
||||
|
||||
## v3.26.56(2026-11-24)插件流程收口:分享/导入、收藏归位、图库目录与删除、插件设置页 token 化
|
||||
|
||||
> 状态:正式发布(macOS arm64 / x86_64)
|
||||
|
||||
- promptlib 1.9.0:单条提示词「分享」与「导入分享…」(文本带 IWB-PROMPT-SHARE 头,可直接粘到聊天软件;设置页也提供导入入口)
|
||||
- 单节点气泡的星标改为**添加到提示词库**(旧实现把它存成了节点组,与现在的 promptlib 流程不符)
|
||||
- 组内单节点气泡新增「解组」(此前只能先框选再解组)
|
||||
- gallery 1.6.12:面板底部新增文件夹图标(在设置左边)打开本地图库目录;删除图片时把磁盘字节一并移进 trash/(此前只删索引,images/gallery 里仍留文件)
|
||||
- 插件管理新增「全部更新」(检查后一键更新可更新插件)
|
||||
- 插件设置页按设置面板 token 重排(GSetGroup + 行网格),插件自定义块不再画卡片套卡片
|
||||
|
||||
## v3.26.55(2026-11-24)Windows 构建解锁:token 校验容忍 CRLF
|
||||
|
||||
> 状态:正式发布(macOS arm64 / x86_64;Windows 同版本)
|
||||
|
||||
+13
-15
@@ -1,4 +1,4 @@
|
||||
# 贡献指南(image-workbench-web)
|
||||
# 贡献指南(image-workbench-desktop)
|
||||
|
||||
> 面向**任何要改这个仓库的人**(包括未来的自己)。本文件只汇总**已存在**的规则与命令,
|
||||
> 不发明新规矩 —— 规则的**权威来源**是 [`docs/standards/`](docs/standards/),本文件是入口。
|
||||
@@ -7,8 +7,7 @@
|
||||
|
||||
## 1. 这是什么项目
|
||||
|
||||
**浏览器里的节点式生图画布**(纯前端,零后端)。数据存在浏览器本地(localStorage + IndexedDB),
|
||||
生图直连 OpenAI 兼容 API,部署在 Cloudflare Pages。
|
||||
**Tauri v2 桌面节点式生图画布**(macOS / Windows)。桌面端数据在资料目录,生图直连 OpenAI 兼容 API;Web 预览走浏览器存储。
|
||||
|
||||
- 使用说明与功能: [`README.md`](README.md)
|
||||
- 发布流程: [`PUBLISHING.md`](PUBLISHING.md)
|
||||
@@ -22,7 +21,7 @@
|
||||
|---|---|
|
||||
| Node | **22**(CI 用 22,本地同版本最省事) |
|
||||
| 安装 | `npm ci` |
|
||||
| 运行时依赖 | 桌面版有 3 个 Tauri 插件(`@tauri-apps/plugin-dialog` / `-fs` / `-http`);Web 版仍无运行时依赖 |
|
||||
| 运行时依赖 | 桌面版有 3 个 Tauri 插件(`@tauri-apps/plugin-dialog` / `-fs` / `-http`);Web 预览无运行时依赖 |
|
||||
| 浏览器测试 | Playwright Chromium:`npx playwright install --with-deps chromium` |
|
||||
|
||||
---
|
||||
@@ -41,7 +40,7 @@ build esbuild 打包到 dist/(单 dist/app.js = src/ 模块按序
|
||||
node --check app.js 与 dist/app.js 语法
|
||||
check-dist.js 产物体检
|
||||
lint ESLint(src/ + app.js,正确性规则)
|
||||
test:unit 124 个单测文件(jsdom 契约测试;2026-11-07 新增 sync-facts-guard(事实一致性)/ _helpers/source(统一源文本);2026-11-12 新增 provider-ping(测速 no-cors 兜底))
|
||||
test:unit 126 个单测文件(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)
|
||||
@@ -103,8 +102,8 @@ IWB_WRITE_BOUNDARY_SNAPSHOT=1 node tests/architecture-boundary-guard-test.js #
|
||||
|
||||
| 守卫 | 位置 | 现在的上限 |
|
||||
|---|---|---|
|
||||
| `app.js` 总行数 | `tests/source-text-ratchet-test.js` `MAX_APP_JS_LINES` | **8,700**(另守「占总源码 ≤ 40%」,见 `MAX_APP_JS_SHARE`) |
|
||||
| `Workbench()` 行数 | 同上 `MAX_WORKBENCH_LINES` | **3,997** |
|
||||
| `app.js` 总行数 | `tests/source-text-ratchet-test.js` `MAX_APP_JS_LINES` | **9,105**(另守「占总源码 ≤ 40%」,见 `MAX_APP_JS_SHARE`) |
|
||||
| `Workbench()` 行数 | 同上 `MAX_WORKBENCH_LINES` | **3,046** |
|
||||
| 单组件行数(不含 Workbench)| 同上 `MAX_APP_COMPONENT_LINES` | **423** |
|
||||
|
||||
三条都是**只减不增**。确需在 app.js 增长时,必须**同步上调上限并在 commit 里写理由**(等于显式记账,不会悄悄发生)。
|
||||
@@ -188,16 +187,15 @@ release: vX.Y.Z 发版
|
||||
|
||||
## 9. 发布
|
||||
|
||||
**手动发布**,CI 只验证不部署。详见 [`PUBLISHING.md`](PUBLISHING.md)。要点:
|
||||
**手动发布**,CI 只验证不部署。桌面版不再使用 `deploy` / `deploy:test`(Cloudflare Pages 已移除)。
|
||||
|
||||
1. bump `package.json` 版本并**提交**(锚点由随后的 `publish-update.sh` 自动写并提交;bump 未提交时脚本会 WARN 跳过)
|
||||
2. `npm run verify`(含全量 e2e)
|
||||
3. 提交 + 推送 + 打标签(`vX.Y.Z` / `stable-vX.Y.Z` / `stable` / `stable-verified-<日期>`)
|
||||
4. `npm run deploy:test` → 测试站实测 → `npm run deploy` → 正式站
|
||||
5. **`IWB_VERIFY_STRICT=1 node scripts/verify-release.js`** 核验(三地址一致 + **线上代码可从远端恢复**)
|
||||
1. bump 版本:`node scripts/set-version.js X.Y.Z`,更新 CHANGELOG 后提交
|
||||
2. `npm run verify:ci`
|
||||
3. mac:`bash scripts/publish-update.sh`(构建双架构、签名、上传、生成 latest.json)
|
||||
4. Windows:按 [`docs/WIN_BUILD_SPEC.md`](docs/WIN_BUILD_SPEC.md) 出 exe → NAS `_inbox/` → mac `publish-windows-update.sh` → 再跑一次 `publish-update.sh` 合并 latest.json
|
||||
5. 登记 `site/releases.json`、生成站点、上传 NAS,打 tag `vX.Y.Z` 并 push
|
||||
|
||||
> ⚠️ 推 `main` 需要 `RELEASE=1 git push origin main`(本地 pre-push 钩子拦误推)。
|
||||
> ⚠️ **`npm run deploy` 不含 git push** —— 部署了没推送的代码 ⇒ 本机故障即丢失线上代码。
|
||||
> 版本只认 `package.json`;平台必须同批。详细规则见 [`PUBLISHING.md`](PUBLISHING.md) 与工程规则 §13.60。
|
||||
|
||||
---
|
||||
|
||||
|
||||
+23
-93
@@ -1,105 +1,35 @@
|
||||
# 📦 发布规则(每次 push 前必查)
|
||||
# 发布规则(桌面版)
|
||||
|
||||
> ⚠️ **时效说明(2026-10-15 复核)**:本文档为发布流程说明;**其中「稳定标签」一段已就地更正**(见文末)。当前事实以 [`docs/standards/architecture-current-state.md`](docs/standards/architecture-current-state.md) 与规范 §10/§12/§13.6 为准。
|
||||
> 复核确认的现行约束:发布**一律手动** `npm run deploy` / `npm run deploy:test`(**内含全量 `verify`,不得绕过**);本机**没有 wrangler OAuth 登录态**(`~/.config/.wrangler/config/` 为空,2026-10-31 复核),部署一律走 **API Token**(见「部署凭据」);三地址 `version.json` 必须一致;「部署成功」≠ 验收,须在**真实 URL** 跑关键 e2e。
|
||||
> 2026-11-24 重写:本项目已是 Tauri 桌面客户端,**不再部署 Cloudflare Pages**,`deploy` / `deploy:test` 已移除。
|
||||
> 历史网页版发布流程见 [`docs/archive/history/PUBLISHING-legacy-web.md`](docs/archive/history/PUBLISHING-legacy-web.md)。
|
||||
|
||||
## 红线(禁止入仓库)
|
||||
1. **`data/` 目录永不入库** —— 含 API Key 配置、生成图片和运行数据。
|
||||
2. **任何真实密钥/Token 不进任何文件** —— 代码只允许引用环境变量名或用户运行时输入。
|
||||
3. **不推日志、临时文件**(`*.log`、`.DS_Store`、`node_modules`、`dist`、`test-results`)。
|
||||
## 红线
|
||||
|
||||
## 隐私检查
|
||||
```bash
|
||||
grep -rn "sk-[A-Za-z0-9]\{20,\}" --include="*.js" --include="*.json" --include="*.md" . | grep -v "^./data/"
|
||||
grep -rn "/Users/\|/home/" --include="*.js" --include="*.json" --include="*.md" . | grep -v "^./data/"
|
||||
git grep -n "sk-" $(git rev-list --all)
|
||||
```
|
||||
1. `data/` 永不入库(含 Key、图片与运行数据)
|
||||
2. 真实密钥/Token 不进任何文件
|
||||
3. 不推日志、临时文件、`node_modules`、`dist`、`test-results`
|
||||
|
||||
## 标准发布流程
|
||||
1. 在 `package.json` 递增 SemVer 版本;构建会自动生成 `v<package-version>+<7位Git SHA>`,并用 esbuild 压缩打包成单个 `dist/app.js`(`src/` 模块按序拼接进 `app.js`,`dist/` 无 `src/`)。
|
||||
> ⚠️ **bump 版本后必须同步「事实基线锚点」**(否则 `npm run test:facts` 会打红):
|
||||
> 把 `docs/standards/architecture-current-state.md` 第 4 行的 `基线 main = <SHA>` 改成**本次 bump 版本的提交**的 SHA、
|
||||
> `(线上 v<版本>+<SHA>)` 改成同一 SHA 与新版本号。守门第 7 组会校验这两项(规则见规则库 §13.36)。
|
||||
> 该提交前 SHA 可用:`git log --format=%h -- package.json` 里逐个回看、比对版本值与父提交是否相同(**不要**用 `git log -S '"version"'`,它会命中无关的旧提交)。
|
||||
2. 执行完整验证:
|
||||
```bash
|
||||
npm ci
|
||||
npm run verify
|
||||
```
|
||||
3. 检查 `dist/version.json`、`git diff --check` 和敏感信息扫描。`npm run verify` 已含 `node --check dist/app.js` 与 `node scripts/check-dist.js`(产物体检);`verify-release.js` 读 `/version.json`(不再抓 `app.js` 的 `APP_VERSION`,压缩会破坏该正则)。
|
||||
4. 提交并推送 + 打四类标签:
|
||||
```bash
|
||||
git add -A
|
||||
git commit -m "release: vX.Y.Z"
|
||||
git push origin main
|
||||
git tag -a vX.Y.Z -m "vX.Y.Z"
|
||||
git tag -a stable-vX.Y.Z -m "stable release vX.Y.Z"
|
||||
git tag -f stable HEAD && git push -f origin stable
|
||||
git tag -a stable-verified-$(date +%F) -m "stable-verified $(date +%F)"
|
||||
git push origin vX.Y.Z stable-vX.Y.Z stable-verified-$(date +%F)
|
||||
gh release create vX.Y.Z --notes-file <notes.md>
|
||||
```
|
||||
> ⚠️ **推 main 需确认口令**(免费版私有仓库无 GitHub 分支保护,靠本地 pre-push 钩子拦误推):
|
||||
> `RELEASE=1 git push origin main`。
|
||||
> **部署前必须确认 `git rev-parse HEAD` 已在 `origin/main` 中** —— 否则会部署一份**只存在于本机**的代码(见下方第 6 步)。
|
||||
5. 部署:**本仓库采用手动发布** —— `npm run deploy`(正式)/ `npm run deploy:test`(测试站)。CI(`.github/workflows/verify.yml`)只做 `verify` 门禁、**不自动部署**。
|
||||
> ⚠️ `npm run deploy` = `verify` + `wrangler pages deploy`,**不含 git push**。推送与部署是两步,顺序上先推后部署。
|
||||
6. 发布后验证(**三地址版本必须一致 + 线上代码必须可从远端恢复**):
|
||||
```bash
|
||||
IWB_VERIFY_STRICT=1 node scripts/verify-release.js # 三地址 version 一致 + 线上 commit 是 origin/main 的祖先
|
||||
curl -fsSL https://iwb.maqiart.eu.org/version.json
|
||||
```
|
||||
> **为什么必须用严格模式**(2026-10-20 实测事故):当天线上跑的是 `f414fd8`,而 `origin/main` 仍是 `7a48e4b` ——
|
||||
> 那 4 个 commit **不在任何远端 ref 上**。根因是 `npm run deploy` 不含 push,而本流程把 push 写在第 4 步 ——
|
||||
> **顺序没错,但没有校验「push 的 commit == 部署的 commit」是否真的成立**,于是部署了没推送的代码。
|
||||
> 后果:本机故障 / 误 reset ⇒ 线上正在跑的代码**永久丢失**,回滚只能退到 `stable`。
|
||||
> 严格模式把「事后才发现」变成「当场拦截」:线上 commit 必须是 `origin/main` 的祖先,否则报错退出码 1。
|
||||
> (不会误报 docs-only 提交:那种情况下线上 commit 是上一个**代码**提交,它仍在 `origin/main` 的历史里。)
|
||||
> 紧急修复必须先部署后 push 时,**push 必须在同一操作序列内立即完成**,并事后补跑严格模式核验。
|
||||
|
||||
## 部署凭据(2026-10-28 实测补全,2026-10-31 订正)
|
||||
|
||||
**本机没有 wrangler OAuth 登录态**(`~/.config/.wrangler/config/` 为空),
|
||||
此前文档写的「OAuth 会过期」已不适用 —— 部署**一律走 API Token 模式**:
|
||||
## macOS 发布
|
||||
|
||||
```bash
|
||||
export CLOUDFLARE_API_TOKEN=$(security find-generic-password -a qiqi -s CLOUDFLARE_PAGES_TOKEN -w)
|
||||
# account id:见下方说明,二选一
|
||||
export CLOUDFLARE_ACCOUNT_ID="<32 位 hex>"
|
||||
npm run deploy:test # 测试站;正式站用 npm run deploy
|
||||
npm run verify:ci
|
||||
node scripts/set-version.js X.Y.Z
|
||||
# 更新 CHANGELOG 后提交(publish 脚本会按 package.json 版本构建)
|
||||
bash scripts/publish-update.sh
|
||||
# 登记 site/releases.json、gen-site/gen-release-page、上传 NAS、打 tag/push
|
||||
```
|
||||
|
||||
> ⚠️ **`npx` 必须带 `--yes`(2026-10-31 事故)**:`wrangler` 不在 devDependencies 里,
|
||||
> `npx wrangler` 依赖 npx 缓存;一旦 npm 上 `wrangler@latest` 超过缓存版本(如 4.114.0 → 4.156.0),
|
||||
> npx 会问「Need to install [email protected]? (y)」,**在 TTY(有人值守的终端)里会一直等输入**,
|
||||
> 表现为「`verify` 跑完了但部署卡住不动」。非 TTY 环境(多数 agent / CI)不提示、直接装,
|
||||
> 所以这个坑只在交互式终端复现。`package.json` 的 `deploy` / `deploy:test` 与
|
||||
> `scripts/plugins-publish.sh` 均已固定 `npx --yes wrangler`,**新增脚本请照抄**。
|
||||
## Windows 发布
|
||||
|
||||
**account id 从哪来**(它**不是密钥**,是账号标识):
|
||||
1. Windows 端按 [`docs/WIN_BUILD_SPEC.md`](docs/WIN_BUILD_SPEC.md) 构建 `*-setup.exe`,放 NAS `_inbox/`
|
||||
2. mac 端签名:`bash scripts/publish-windows-update.sh <setup.exe>`
|
||||
3. **再跑一次** `bash scripts/publish-update.sh`,把 `windows-x86_64` 合并进 `latest.json`
|
||||
4. 下载页登记 Windows 条目并核验
|
||||
|
||||
- 钥匙串和 `secrets list` 里**只有 token,没有 account id**;
|
||||
- `wrangler.toml` 里那个 32 位 hex 是 **KV namespace id**,不是 account id;
|
||||
- API `GET /client/v4/accounts` 对 Pages 作用域的 token 返回**空列表**(不等于 token 无效);
|
||||
- ✅ **可靠来源:git 历史里旧的 `wrangler.toml`**:
|
||||
## 版本/tag 纪律
|
||||
|
||||
```bash
|
||||
git log --all --format=%H -S "account_id" -- wrangler.toml | tail -1 # 最早含它的提交
|
||||
git show <commit>:wrangler.toml | grep account_id # 读出 32 位 hex
|
||||
```
|
||||
- 版本只认 `package.json`(`set-version` 同步 tauri.conf/Cargo.toml)
|
||||
- 平台同批:Windows 未跟上时不要往 `latest.json` 塞旧包
|
||||
- 发布后核验:`latest.json` 三平台、`latest-windows.json` 同版本、下载页 exe 200 且字节一致
|
||||
|
||||
> 本次实测:account id 为 `47d69874…`(32 位 hex)。**建议把它存进钥匙串**:
|
||||
> `security add-generic-password -a qiqi -s CLOUDFLARE_ACCOUNT_ID -w '<id>'`
|
||||
> —— 这样以后不用每次翻 git 历史。
|
||||
|
||||
**验证 token 可用(只读,不部署)**:
|
||||
|
||||
```bash
|
||||
npx wrangler pages deployment list --project-name image-workbench-web
|
||||
```
|
||||
能列出部署记录 = token + account id 都正确。
|
||||
|
||||
## 回滚
|
||||
|
||||
> **权威还原步骤见 [`docs/RELEASES.md`](docs/RELEASES.md)**(含当前线上状态、各版本 tag→commit 对照、三种还原场景)。本节只作流程要点。
|
||||
**稳定标签(2026-10-15 更正)**:现行体系为 `vX.Y.Z`(GitHub Release)+ `stable-vX.Y.Z` + **移动可变 `stable`**(2026-10-15 指向 `682554d`)+ `stable-verified-YYYY-MM-DD`(验证留痕)。语义以规范 §10 与 [`docs/standards/architecture-current-state.md`](docs/standards/architecture-current-state.md) 为准;历史锚点示例:`stable-v3.1.0-stability3`、`stable-v3.3.0` 等。出现问题时可回滚到对应标签重新构建并发布,不覆盖历史。
|
||||
现行工程规则见 [`docs/standards/engineering-rulebook.md`](docs/standards/engineering-rulebook.md) §13.60。
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
基于 **OpenAI 兼容生图 API** 的节点式图形化生图工作台。**Tauri v2 桌面客户端**(macOS / Windows),数据全部落在本机资料目录。
|
||||
|
||||
- **零后端**:数据保存在浏览器(localStorage + IndexedDB),图片生成直连兼容 API;Tuzi 生图固定使用 generations、要求 URL 响应,参考图允许公网 URL 与本地 Base64,且不自动重试
|
||||
- **零后端、本地优先**:桌面端数据在资料目录(data.json + canvases/library/images),Web 预览才用浏览器存储;图片生成直连兼容 API;Tuzi 生图固定使用 generations、要求 URL 响应,参考图允许公网 URL 与本地 Base64,且不自动重试
|
||||
- 与独立版功能一致:无限画布、节点连线、文生图/图生图、参数设置(比例/分辨率对齐接口)、提示词库、节点组收藏、图库、右键菜单、双击聚焦/适应视图、标注节点等
|
||||
- 唯一区别:**数据在本浏览器**,换设备不跟随 → 左侧栏底部提供「备份 / 恢复」导出全部数据 JSON
|
||||
- 换设备不跟随:桌面端数据在资料目录,可用「设置 → 备份与还原」导出/导入整库(Web 预览仍用浏览器存储)
|
||||
- 架构边界:配置、提示词、节点组、工作台和图库索引统一经过浏览器存储契约;**大图新写入主通道为 IndexedDB Blob(`{__blob}` / key `imgblob_*`),Cache Storage(`{__cache}`)为兜底**,localStorage 只保存轻量索引(不放大 base64)。现状细节见 [`docs/standards/architecture-current-state.md`](docs/standards/architecture-current-state.md)。
|
||||
- 生图流程采用任务构建、Job 调度、请求归一化、结果归档和运行结束清理分层,生成中的结果会实时写回输出节点;运行记录按 Job 保存 queued/running/succeeded/failed/cancelled 状态,刷新只提示未完成任务。
|
||||
- 稳定性边界:保存失败会保留恢复快照并支持重试,离页前执行本地兜底;启动时检查 localStorage/IndexedDB 可用性并显示异常。
|
||||
@@ -38,10 +38,10 @@ npx tauri build # 桌面安装包(macOS: .app + dmg / Windows: nsis)
|
||||
|
||||
| 平台 | 命令 | 产物 |
|
||||
| --- | --- | --- |
|
||||
| macOS | `./scripts/publish-update.sh <版本>` | `updates/latest.json` + 双架构 dmg / app.tar.gz |
|
||||
| macOS | `bash scripts/publish-update.sh`(版本取自 package.json) | `updates/latest.json` + 双架构 dmg / app.tar.gz |
|
||||
| Windows | `./scripts/publish-windows-update.sh <setup.exe>` | `updates/latest-windows.json`(平台独立) |
|
||||
|
||||
两个平台的更新清单**完全解耦**:mac 发版不影响 Windows 版本号,反之亦然。
|
||||
Windows 签名后需在 mac 再跑一次 `publish-update.sh`,把 `windows-x86_64` 合并进 `latest.json`;未同批时 Windows 用户停留在旧版。
|
||||
|
||||
CI:`.github/workflows/verify.yml` 在推送 `main` 与向 `main` 开 PR 时执行 `npm run verify:ci`。
|
||||
|
||||
|
||||
@@ -125,12 +125,6 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
|
||||
}
|
||||
// 把桌面端能力登记到 src/desktop-bridge.js(src 不得反向引用 app.js 的 window 全局,
|
||||
// architecture-boundary-guard 会红;这里只做注入,设置面板/导出逻辑统一走 IWBDesktop)
|
||||
// 桌面端统一确认入口:页内确认(window.confirm 会阻塞 WKWebView 主线程);网页端保持原生
|
||||
function wConfirm (text, opts) {
|
||||
const C = (typeof window !== 'undefined') ? window.IWBUIConfirm : null
|
||||
if (C && typeof C.askOrNative === 'function') return C.askOrNative(text, opts)
|
||||
return Promise.resolve(window.confirm(String(text)))
|
||||
}
|
||||
|
||||
// 桌面壳适配(外链 / 原生通知 / 链接拦截)落在 src/ui-desktop-shell.js
|
||||
try { if (window.IWBUIShell) window.IWBUIShell.installLinkGuard(wIsTauri) } catch (e) { /* ignore */ }
|
||||
@@ -840,7 +834,9 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
|
||||
// ==== 丙方案 C3:图片引用直出(hydrate 不再把图片字节读回 base64 常驻 JS 堆)====
|
||||
// 画布记录里只留引用,字节独立存放(对标 opentu 的资产模型:记录 = 引用 + 元数据):
|
||||
// · { __cache: '/__iwb_cache__/<hash>' } —— 方案A 既有形态;字节在 Cache Storage,sw.js 可直出虚拟路径
|
||||
// · { __blob: 'imgblob_<hash>_<len>' } —— C3 新形态;字节在 IndexedDB 的 Blob(src/image-blob-store.js)
|
||||
// · { __blob: 'imgblob_<hash>_<len>' } —— C3 新形态;字节落在**注入的 idb 后端**(src/image-blob-store.js):
|
||||
// 浏览器 = IndexedDB;桌面端 = storage-file 的文件 KV(见 wImageBlobStore 的 storageRuntime 注入)⇒
|
||||
// 实际是 images/canvas/<sha16>.<ext> + data.json 的 assets 登记。判读口径见 docs/standards/image-storage-map.md
|
||||
// 显示层统一经 wResolveImg 解析为**本会话 objectURL**(caches.match / IDB.getBlob → wRegisterBlobUrl)。
|
||||
// objectURL **单一归属**:一律由 wRegisterBlobUrl 创建并登记(拿得回原 Blob,绕开 CSP 对 fetch(blob:) 的拦截),
|
||||
// 由 wImgUrlByRef 台账回收;**不调用** ImageBlobStore.resolveUrl/revokeAll —— 否则同一张图会有两套 URL
|
||||
@@ -1741,7 +1737,9 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
|
||||
if (!ProviderPing) return Promise.resolve({ results: urls.map((u) => ({ url: String(u || '').trim(), ok: false, ms: 0, error: '测速模块未加载' })) })
|
||||
return ProviderPing.pingAll(urls, { normalizeEndpointBase: (_wCfgShape && _wCfgShape.normalizeEndpointBase) || null })
|
||||
}
|
||||
// 历史出图(IndexedDB 缩略图 + localStorage 索引;图床 URL 只作显示兜底,图床过期不丢图库图)
|
||||
// 历史出图:索引在 localStorage(out_ 前缀),字节落「注入的 idb 后端」——浏览器 = IndexedDB,
|
||||
// 桌面端 = storage-file 文件 KV(images/thumbs 缩略图 / images/gallery 原图档);图床 URL 只作显示兜底。
|
||||
// 判读口径见 docs/standards/image-storage-map.md
|
||||
const OUT_KEY = StorageContract.localKeys.outputs
|
||||
const RuntimeConstants = (typeof window !== 'undefined' && window.IWBRuntimeConstants) || { outputLimit: 10000, galleryRanges: {} }
|
||||
const GalleryHydration = typeof window !== 'undefined' && window.IWBGalleryHydration
|
||||
@@ -1841,8 +1839,9 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
|
||||
return { removed, files: existing.size }
|
||||
}
|
||||
const imageFolderApi = { pick: imageFolderPick, sync: imageFolderSync, save: imageFolderSaveItem, name: imageFolderName }
|
||||
// 生成图 → 压缩缩略图 dataURL → IndexedDB(图库显示用;原图仍走图床 URL,放大/下载时用图床或本地上传)
|
||||
// 失败(跨域/网络)静默:仅保留图床 URL,显示回退
|
||||
// 生成图 → 压缩缩略图 dataURL → 缩略图存储(浏览器 IndexedDB / 桌面端 images/thumbs 文件);
|
||||
// 原图档另写 out_orig_(只有「应用内备份原图」开启时;桌面端落在 images/gallery/)。
|
||||
// 两张都抓不到(图床跨域/网络)时静默降级:只保留图床 URL 作显示与下载兜底。
|
||||
// 调试计数器:仅在显式开启时记录高频路径,默认完全关闭。
|
||||
function iwbDebugCounter(name, extra) {
|
||||
if (typeof window === 'undefined' || window.__IWB_DEBUG__ !== true) return
|
||||
@@ -1967,7 +1966,8 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
|
||||
const maxFiles = Number(ret.maxFiles) || 0
|
||||
if (maxDays > 0) list = list.filter((f) => now - f.mtime <= maxDays * 86400e3)
|
||||
list = list.sort((a, b) => (b.mtime - a.mtime)).slice(0, maxFiles > 0 ? maxFiles : RuntimeConstants.outputLimit)
|
||||
// hydrate:IndexedDB 缩略图 → data 字段(图床 URL 仍作兜底显示);limit>0 时只 hydrate 前 limit 张(列表分页加载,缓解首开慢)
|
||||
// hydrate:缩略图 → data 字段(清单只存 thumbHash/idb 键,桌面端的字节在 images/thumbs/);
|
||||
// 图床 URL 仍作兜底显示。limit>0 时只 hydrate 前 limit 张(列表分页加载,缓解首开慢)
|
||||
const hydList = (args && typeof args.limit === 'number' && args.limit > 0) ? list.slice(0, args.limit) : list
|
||||
if (galleryHydrator) {
|
||||
const hydrated = await galleryHydrator.hydrate(hydList)
|
||||
@@ -2058,25 +2058,33 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
|
||||
}
|
||||
return added
|
||||
}
|
||||
// ── 图库同步边界(v3.26.61)───────────────────────────────────────────────
|
||||
// 逻辑在 src/gallery-sync.js(单张归档串行队列 / 通知插件 / 条目→本地字节 / 插入栅格 / 节点取图),
|
||||
// 这里只把现有能力装配进去;装配表放在一行是因为 app.js 有行数棘轮(新功能必须落 src)。
|
||||
const wGallerySync = (typeof window !== 'undefined' && window.IWBGallerySync) ? window.IWBGallerySync.attach({ addOutputs: (items, o) => wAddOutputs(items, o), flatten: (entries) => flattenGenerationEntries(entries), emit: (reason) => { try { if (typeof window !== 'undefined' && window.IWBPluginGallery) window.IWBPluginGallery.emit(reason) } catch (e) { /* ignore */ } }, get: (k) => IDB.get(k), refDataUrl: (v) => wImgRefDataUrl(v), isDesktop: () => wIsTauri(), desktopFetch: (u) => (wTauri && wTauri.http && typeof wTauri.http.fetch === 'function') ? wTauri.http.fetch(u) : Promise.reject(new Error('no-http')), blobFromSrc: (s) => wBlobFromSrc(s), blobToDataUrl: (b) => wImgBlobToDataUrl(b), notice: (msg) => wLogNotice(String(msg || ''), 'err') }) : null
|
||||
const wArchiveEntryNow = (entry, refresh) => (wGallerySync ? wGallerySync.archiveEntryNow(entry, refresh) : Promise.resolve(false))
|
||||
const wGalleryChanged = (reason) => { if (wGallerySync) wGallerySync.notifyChanged(reason) }
|
||||
const wDelGalleryBytes /* 图库删图一并清理磁盘字节(只删索引会留下文件) */ = (names) => { const F = (typeof window !== 'undefined') ? window.IWBStorageFile : null; try { if (F && F.deleteGalleryBytesFor) F.deleteGalleryBytesFor(names, lsGet(OUT_KEY, [])).catch(() => {}) } catch (e) { /* ignore */ } }
|
||||
async function wActionOutputs(args) {
|
||||
const action = args && args.action
|
||||
if (ModularOutputStore && action === 'clear') {
|
||||
await wClearOutputIdb() // 原图 out_orig_ 不在 ModularOutputStore 管辖,单独整体清空
|
||||
const modular = await ModularOutputStore.clear()
|
||||
if (modular && modular.ok) return { ok: true }
|
||||
if (modular && modular.ok) { wGalleryChanged('clear'); return { ok: true } }
|
||||
}
|
||||
if (ModularOutputStore && action === 'delete') {
|
||||
const names = Array.isArray(args.names) ? args.names : []
|
||||
await wPruneOutputIdb(names) // 缩略图 + 原图一并移除
|
||||
await wPruneOutputIdb(names); await wDelGalleryBytes(names) // 缩略图 + 原图 + 磁盘字节
|
||||
const modular = await ModularOutputStore.remove(names)
|
||||
if (modular && modular.ok) return { ok: true, removed: modular.meta && modular.meta.removed !== undefined ? modular.meta.removed : names.length }
|
||||
if (modular && modular.ok) { wGalleryChanged('remove'); return { ok: true, removed: modular.meta && modular.meta.removed !== undefined ? modular.meta.removed : names.length } }
|
||||
}
|
||||
if (action === 'clear') { await wClearOutputIdb(); lsSet(OUT_KEY, []); return { ok: true } }
|
||||
if (action === 'clear') { await wClearOutputIdb(); lsSet(OUT_KEY, []); wGalleryChanged('clear'); return { ok: true } }
|
||||
if (action === 'delete') {
|
||||
const names = Array.isArray(args.names) ? args.names : []
|
||||
await wPruneOutputIdb(names)
|
||||
await wPruneOutputIdb(names); await wDelGalleryBytes(names)
|
||||
const idx = lsGet(OUT_KEY, [])
|
||||
lsSet(OUT_KEY, idx.filter((f) => !names.includes(f.name)))
|
||||
wGalleryChanged('remove')
|
||||
return { ok: true, removed: names.length }
|
||||
}
|
||||
if (action === 'restore') {
|
||||
@@ -2085,6 +2093,7 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
|
||||
const files = Array.isArray(args.files) ? args.files : []
|
||||
if (ModularOutputStore) await ModularOutputStore.mutate(() => files).catch(() => null)
|
||||
else lsSet(OUT_KEY, files)
|
||||
wGalleryChanged('restore')
|
||||
return { ok: true, restored: files.length }
|
||||
}
|
||||
return { ok: true }
|
||||
@@ -2186,8 +2195,8 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
|
||||
}
|
||||
// 图库条目取画质最优的 src:优先本地原图(out_orig_)→ 远程 url(原分辨率,<img> 不受 CORS)→ 缩略图(data/out_)兜底。
|
||||
// 用于预览/下载/复制/插入/拖到画布为参考图,保证参考图是清晰原图/高清远程,缩略图仅作网格展示。
|
||||
// 运行时缩略图缓存:url → IndexedDB 缩略图 dataURL。输出节点网格优先用本地缩略图(快、不随远程 URL 失效),
|
||||
// 远程 URL 仅作兜底,避免「图床 URL 慢/过期导致输出节点图片空白或消失」。
|
||||
// 运行时缩略图缓存:url → 缩略图 dataURL(桌面端字节在 images/thumbs/)。输出节点网格优先用本地缩略图
|
||||
// (快、不随远程 URL 失效),远程 URL 仅作兜底,避免「图床 URL 慢/过期导致输出节点图片空白或消失」。
|
||||
// v3.87.8 数据保护:用户"明确彻底删除"的画板 id(只作用于紧随其后的那次写入)。
|
||||
// 用途:写索引时做并集守卫——存储里已有的画板不能被"漏掉"(本机实测出现过"画布从列表消失")。
|
||||
const wPurgeIntent = new Set()
|
||||
@@ -3739,9 +3748,13 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
|
||||
}
|
||||
|
||||
// 生成归档边界:图库索引/缩略图属于旁路缓存,不能阻塞生成结果和画布保存。
|
||||
// v3.26.61:每张结果在生成过程中已由 wArchiveEntryNow 逐张入库(图库要「出图即见」),
|
||||
// 这里只补剩下没归档的(失败条目/兜底路径),不再整批重写一遍 —— 否则同一张图会入两次库。
|
||||
async function archiveGenerationResults(entries, refresh) {
|
||||
const results = flattenGenerationEntries(entries)
|
||||
const all = Array.isArray(entries) ? entries : []
|
||||
const results = flattenGenerationEntries(all)
|
||||
iwbDebugCounter('archiveGenerationResults', { entries: results.length })
|
||||
const pendingEntries = all.filter((e) => !(wGallerySync && wGallerySync.wasArchived(e)))
|
||||
for (const hook of wPluginGenHooks) {
|
||||
if (typeof hook.afterResult !== 'function') continue
|
||||
try { hook.afterResult(results) } catch (e) { /* 插件钩子异常不得影响结果归档 */ }
|
||||
@@ -3751,8 +3764,10 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
|
||||
// 只有「自动下载」开启时才等归档完成:它要从本地原图复制,必须等 out_orig_ 落盘;
|
||||
// 没开就保持后台异步归档,避免出图到图库可点开的时间被拖长。
|
||||
const needArchiveWait = !!(wAutoSaver && typeof wAutoSaver.enabled === 'function' && wAutoSaver.enabled())
|
||||
try { await wAddOutputs(results, { awaitArchive: needArchiveWait }) } catch (e) { /* 图库缓存失败不影响画布结果 */ }
|
||||
const rest = flattenGenerationEntries(pendingEntries)
|
||||
if (rest.length) { try { await wAddOutputs(rest, { awaitArchive: needArchiveWait }) } catch (e) { /* 图库缓存失败不影响画布结果 */ } }
|
||||
try { if (typeof refresh === 'function') await refresh() } catch (e) { /* ignore */ }
|
||||
try { wGalleryChanged('output') } catch (e) { /* ignore */ }
|
||||
try { if (wAutoSaver) await wAutoSaver.saveResults(results) } catch (e) { /* 自动下载失败不影响生图 */ }
|
||||
})
|
||||
return Promise.resolve(results)
|
||||
@@ -4756,7 +4771,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
el('div', { className: 'iwb-crash-actions' },
|
||||
el('button', { className: 'iwb-btn iwb-btn-primary', onClick: this.retry }, '尝试恢复'),
|
||||
el('button', { className: 'iwb-btn', onClick: () => { try { location.reload() } catch (e) { /* ignore */ } } }, '重新加载页面'),
|
||||
el('button', { className: 'iwb-btn', title: '复制错误记录与内存采样(不含 Key、提示词和图片)', onClick: (ev) => { let t = '{}'; try { const rep = CrashLog ? CrashLog.report({ version: APP_VERSION }) : {}; try { rep.storageSelfCheck = wStorageSelfCheck() } catch (e) { rep.storageSelfCheck = { error: String((e && e.message) || e) } } t = JSON.stringify(rep, null, 2) } catch (e) { /* ignore */ } const cp = (typeof window !== 'undefined' && window.IWBClipboardCopy) || null; if (cp) cp.copyWithButton(t, ev && ev.currentTarget); else { try { navigator.clipboard.writeText(t) } catch (e) { /* ignore */ } } } }, '复制诊断信息'),
|
||||
el('button', { className: 'iwb-btn', title: '复制错误记录与内存采样(不含 Key、提示词和图片)', onClick: (ev) => { let t = '{}'; try { const rep = CrashLog ? CrashLog.report({ version: APP_VERSION }) : {}; try { rep.storageSelfCheck = wStorageSelfCheck() } catch (e) { rep.storageSelfCheck = { error: String((e && e.message) || e) } } t = JSON.stringify(rep, null, 2) } catch (e) { /* ignore */ } const cp = (typeof window !== 'undefined' && window.IWBClipboardCopy) || null; if (cp) cp.copyWithButton(t, ev && ev.currentTarget) } }, '复制诊断信息'),
|
||||
),
|
||||
el('div', { className: 'iwb-hint' }, '完整记录在「设置 → 诊断」里,可导出 JSON'),
|
||||
),
|
||||
@@ -5027,8 +5042,8 @@ const tbCenterSeed = (type, refs) => {
|
||||
// 与 PickerBubble 共用(默认向上、横向钳位、上方不足向下翻),避免两份实现漂移。
|
||||
// 定位用 viewport 坐标(fixed),与画布缩放/平移无关。
|
||||
const panelRef = React.useRef(null)
|
||||
const [pos, setPos] = React.useState({ x: 40, y: 40 })
|
||||
React.useEffect(() => {
|
||||
const [pos, setPos] = React.useState(null) // null = 未定位:先隐藏,避免首帧在左上角闪一下
|
||||
React.useLayoutEffect(() => { // layout effect:浏览器绘制前定位,用户看不到中间态
|
||||
if (!anchor) return
|
||||
const place = () => {
|
||||
// 优先以「节点本身」为锚点:比触发按钮更稳定(按钮可能因换行/溢出而位置出人意料)。
|
||||
@@ -5106,7 +5121,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
}
|
||||
const chip = (key, label, active, onClick, title, disabled) => el('button', { key, type: 'button', disabled: !!disabled, title, className: 'iwb-chip iwb-chip-line' + (active ? ' iwb-chip-line-on' : ''), onClick, onPointerDown: stop }, label)
|
||||
return ReactDOM.createPortal(
|
||||
el('div', { className: 'iwb-pop-anchor', style: { left: pos.x + 'px', top: pos.y + 'px' }, onWheel: (e) => e.stopPropagation() },
|
||||
el('div', { className: 'iwb-pop-anchor', style: { left: (pos ? pos.x : 0) + 'px', top: (pos ? pos.y : 0) + 'px', visibility: pos ? 'visible' : 'hidden' }, onWheel: (e) => e.stopPropagation() },
|
||||
el('div', { ref: panelRef, className: 'iwb-pop iwb-image-settings', onPointerDown: stop },
|
||||
el('div', { className: 'iwb-pop-head' },
|
||||
el('span', { className: 'iwb-pop-title' }, '图像设置'),
|
||||
@@ -5490,9 +5505,10 @@ const tbCenterSeed = (type, refs) => {
|
||||
|
||||
function backupChecksumPayload(data) {
|
||||
const out = Object.assign({}, data || {})
|
||||
delete out.checksum
|
||||
delete out.imagesData
|
||||
delete out.images
|
||||
// 图片 / 插件文件(v3.26.59)的**字节**不进校验和:它们分别走 images/ 与 plugin-files/ 目录,
|
||||
// ZIP 与 JSON 兜底两种形态下字段名不同(images/imagesData、pluginFiles/pluginFilesData),
|
||||
// 不排除就会出现「同一份数据换个打包形态 ⇒ 校验和不一致」的假报错。
|
||||
delete out.checksum; delete out.imagesData; delete out.images; delete out.pluginFiles; delete out.pluginFilesData
|
||||
return out
|
||||
}
|
||||
function backupImageManifest(data) {
|
||||
@@ -5755,17 +5771,11 @@ const tbCenterSeed = (type, refs) => {
|
||||
const n = id ? refs.nodes.find((x) => x.id === id) : null
|
||||
return n ? { id: n.id, type: n.type, name: String((n.data && (n.data.name || n.data.title)) || '') } : null
|
||||
},
|
||||
// v3.26.61:逻辑在 src/gallery-sync.js 的 nodeImageOf(补 localRef 候选 + 远程按需落地)
|
||||
getNodeImage: async (id) => {
|
||||
const n = refs.nodes.find((x) => x.id === id)
|
||||
if (!n || !n.data) return null
|
||||
const firstResult = Array.isArray(n.data.result) ? (n.data.result[0] || {}) : n.data.result
|
||||
const candidates = [n.data.data, n.data.url, firstResult && (firstResult.url || firstResult.data)]
|
||||
for (const v of candidates) {
|
||||
if (!v) continue
|
||||
if (typeof v === 'string') return /^data:/i.test(v) ? { dataUrl: v } : { url: v }
|
||||
if (typeof v === 'object') { const dataUrl = await wImgRefDataUrl(v); if (dataUrl) return { dataUrl } }
|
||||
}
|
||||
return null
|
||||
if (!n || !wGallerySync) return null
|
||||
return wGallerySync.nodeImageOf(n, { writeRef: (src) => wImgRefWrite(src), onLocalRef: (ref) => updateNode(n.id, { localRef: ref }) })
|
||||
},
|
||||
createNode: (type, x, y, data) => {
|
||||
// 插件节点传的是变体 id(web/style…):不在 NODE_TYPES 里,交给 addPluginNode 拼出 plugin:<插件>:<变体>
|
||||
@@ -5816,7 +5826,9 @@ const tbCenterSeed = (type, refs) => {
|
||||
const INSERT_K = { orig: 0, '2k': 2048, '1k': 1024, '0.5k': 512 }
|
||||
const [insertK, setInsertK] = useState(() => { try { const v = lsGet('iwb.insertSizeK', '1k'); return INSERT_K[v] === undefined ? '1k' : v } catch (e) { return '1k' } })
|
||||
const setInsertKPersist = (v) => { setInsertK(v); try { lsSet('iwb.insertSizeK', v) } catch (e) { /* ignore */ } }
|
||||
// 按选中档位压缩插入图(算法在 src/image-compress.js 的 toMaxEdge)
|
||||
// 按选中档位缩尺寸(src/image-compress.js 的 toMaxEdge)。事实口径:它只把 JPEG/WebP 源编码成
|
||||
// JPEG,PNG 源仍无损 ⇒ 降的是**长边像素**不是体积(1024 复杂图 ~500KB~1MB)。用户 2026-11-24
|
||||
// 裁定:插入一律留本地副本、可多占空间,所以不把 PNG 转 JPEG(转了就丢透明,标注图外框变黑底)。
|
||||
const shrinkForInsert = (dataUrl, k) => {
|
||||
const kk = (k && INSERT_K[k] !== undefined) ? k : insertK
|
||||
if (kk === 'orig') return Promise.resolve(dataUrl)
|
||||
@@ -5972,7 +5984,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
const sess = sessionsStore.get(wsId)
|
||||
const nm = (((refs.workspaces || workspaces).find((w) => w.id === wsId)) || {}).name || '未命名画布'
|
||||
if (sess && sess.dirty) { // S13:有未保存修改 → 确认后先保存再关
|
||||
if (!(await wConfirm('「' + nm + '」有未保存修改,关闭前将先保存。确定关闭?', { title: '关闭画布', okText: '关闭并保存' }))) return
|
||||
if (!(await window.IWBUIConfirm.askOrNative('「' + nm + '」有未保存修改,关闭前将先保存。确定关闭?', { title: '关闭画布', okText: '关闭并保存' }))) return
|
||||
try {
|
||||
const list = (refs.workspaces || workspaces).map((w) => (w.id === wsId ? { ...w, nodes: sess.nodes, edges: sess.edges, groups: sess.groups, lastUsed: Date.now() } : w))
|
||||
refs.workspaces = list; setWorkspaces(list); persistWs(list, activeWsId); sess.dirty = false
|
||||
@@ -6385,19 +6397,19 @@ const tbCenterSeed = (type, refs) => {
|
||||
const addRefFromUrl = (...a) => wbCmd().addRefFromUrl(...a)
|
||||
const refreshOutputs = (...a) => wbCmd().refreshOutputs(...a); IWWorkbenchHooks.useOutputsSync(OUT_KEY, 'iwb_outputs_sync', () => refreshOutputs(100))
|
||||
const deleteOutputs = (...a) => wbCmd().deleteOutputs(...a)
|
||||
// 批量插入:把图库里选中的图片按「插入尺寸」档压缩后,作为参考图节点加到画布(与单图插入同一入口)
|
||||
// 批量插入:图库选中的图片 → 参考图节点。取源与栅格在 src/gallery-sync.js —— 旧实现在循环里
|
||||
// 每张各自 findSpot(只看已提交节点)⇒ 同批全叠一处;且 http 链接会直接进 data.url 导致无法标注。
|
||||
const insertOutputsToCanvas = async (list, k) => {
|
||||
const added = []
|
||||
for (const f of list) {
|
||||
let src0 = await wbCmd().refSrcOf(await wResolveOutputSrc(f), (msg) => showToast(msg, 'err'))
|
||||
if (typeof src0 === 'string' && src0.indexOf('data:') === 0) src0 = await shrinkForInsert(src0, k)
|
||||
const ref0 = (typeof src0 === 'string' && src0.indexOf('data:') === 0) ? await wImgRefWrite(src0) : null
|
||||
const spot = findSpot('ref')
|
||||
added.push({ id: uid('n'), type: 'ref', x: spot.x, y: spot.y, data: { url: ref0 || src0 || '', data: null, name: f.name, localName: null } })
|
||||
}
|
||||
const prep = wGallerySync
|
||||
? await wGallerySync.prepareInsert(list, k, { refSrcOf: (s, n) => wbCmd().refSrcOf(s, n), shrink: shrinkForInsert, writeRef: wImgRefWrite })
|
||||
: { items: [], remoteOnly: 0 }
|
||||
if (!prep.items.length) return 0
|
||||
const spots = wGallerySync.gridSpots(findSpot('ref'), prep.items.length, { stepX: NODE_W + 24, stepY: NODE_H.ref + 24 })
|
||||
const added = prep.items.map((p, i) => ({ id: uid('n'), type: 'ref', x: spots[i].x, y: spots[i].y, data: { url: p.src, data: null, name: p.name, localName: null, srcUrl: p.srcUrl || '' } }))
|
||||
commitCanvas(refs.nodes.concat(added), undefined, undefined)
|
||||
setSel(added.map((n) => n.id))
|
||||
showToast('已插入 ' + added.length + ' 张到画布')
|
||||
if (prep.remoteOnly) showToast('已插入 ' + added.length + ' 张(其中 ' + prep.remoteOnly + ' 张取不到本地字节,按原链接插入,可能无法标注)', 'err')
|
||||
else showToast('已插入 ' + added.length + ' 张到画布')
|
||||
return added.length
|
||||
}
|
||||
const loadDemo = (...a) => wbCmd().loadDemo(...a)
|
||||
@@ -7488,7 +7500,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
useEffect(() => IWWorkbenchLogic.startWsMoreOutside({ wsMoreOpen, setWsMoreOpen }), [wsMoreOpen])
|
||||
|
||||
// drag & drop import(逻辑已外移到 src/runtime-workbench-logic.js.startCanvasDrop,2026-11-06)
|
||||
useEffect(() => IWWorkbenchLogic.startCanvasDrop({ canvasEl, refs, uiZoom, importCanvasFile, instantiateGroup, wResolveOutputSrc, wImgRefWrite, wImportImage, uid, pushHistory, commitCanvas, setSel, setNotice, outputs }), [])
|
||||
useEffect(() => IWWorkbenchLogic.startCanvasDrop({ canvasEl, refs, uiZoom, importCanvasFile, instantiateGroup, localSrcOfOutput: (item) => (wGallerySync ? wGallerySync.localCopySrcOf(item) : wResolveOutputSrc(item)), wResolveOutputSrc, wImgRefWrite, wImportImage, uid, pushHistory, commitCanvas, setSel, setNotice, outputs }), [])
|
||||
// 节点组数据变化(收藏/删除/其它标签页同步)→ 通知 grouplib 插件重拉,避免插件显示旧列表
|
||||
useEffect(() => { if (window.IWBPluginGroupLib) window.IWBPluginGroupLib.emit('host') }, [savedGroups, nodeGroupGroups])
|
||||
useEffect(() => { if (window.IWBPluginPromptLib) window.IWBPluginPromptLib.emit('host') }, [prompts, promptGroups])
|
||||
@@ -7521,7 +7533,8 @@ const tbCenterSeed = (type, refs) => {
|
||||
}
|
||||
|
||||
// runNode 已搬到 src/workbench-logic.js(2026-10-29):每次调用现取闭包值,不会有陈旧闭包。
|
||||
const runNode = async (nodeId, taskPromptId, onDone, opts) => IWWorkbenchLogic.runNode({ acquireGenSlot, activeWsId, activeWsIdRef, commitRunNodes, ensurePolished, finishGenerationRun, persistRuns, pushHistory, refreshOutputs, refs, runLockConflicts, runWorkspaceNodes, setBusy, setNotice, setProgress, updateNode }, nodeId, taskPromptId, onDone, opts)
|
||||
// archiveOne:单张结果完成即入图库(图库面板要「出图即见」,不能等整轮);见 wArchiveEntryNow
|
||||
const runNode = async (nodeId, taskPromptId, onDone, opts) => IWWorkbenchLogic.runNode({ acquireGenSlot, activeWsId, activeWsIdRef, archiveOne: (entry) => wArchiveEntryNow(entry, () => refreshOutputs(100)), commitRunNodes, ensurePolished, finishGenerationRun, persistRuns, pushHistory, refreshOutputs, refs, runLockConflicts, runWorkspaceNodes, setBusy, setNotice, setProgress, updateNode }, nodeId, taskPromptId, onDone, opts)
|
||||
|
||||
// 生图节点全部任务的总张数(逻辑在 src/runtime-workbench-logic.js.taskCountOf)
|
||||
const taskCountOf = (g) => IWWorkbenchLogic.taskCountOf({ refs, buildGenerationTasks }, g)
|
||||
@@ -7618,8 +7631,8 @@ const tbCenterSeed = (type, refs) => {
|
||||
const convertCanvasLocalRefs = async () => {
|
||||
const targets = refs.nodes.filter((n) => n.type === 'ref' && n.data && n.data.data && !n.data.url)
|
||||
if (!targets.length) { setNotice({ type: 'ok', text: '当前画布没有需要转换的本地图片' }); return }
|
||||
if (!(await wConfirm('将转换当前画布中的 ' + targets.length + ' 张本地图片(输出节点生成结果不会处理),继续吗?', { title: '批量转在线链接' }))) return
|
||||
if (!(await wConfirm('确认开始批量上传吗?上传后这些图片会替换为在线链接,通常无法自动撤回。', { title: '确认上传', okText: '开始上传' }))) return
|
||||
if (!(await window.IWBUIConfirm.askOrNative('将转换当前画布中的 ' + targets.length + ' 张本地图片(输出节点生成结果不会处理),继续吗?', { title: '批量转在线链接' }))) return
|
||||
if (!(await window.IWBUIConfirm.askOrNative('确认开始批量上传吗?上传后这些图片会替换为在线链接,通常无法自动撤回。', { title: '确认上传', okText: '开始上传' }))) return
|
||||
let ok = 0; const errors = []
|
||||
for (const n of targets) {
|
||||
try {
|
||||
@@ -8236,13 +8249,12 @@ const tbCenterSeed = (type, refs) => {
|
||||
},
|
||||
}, cover, name),
|
||||
copy: (text) => {
|
||||
try {
|
||||
const p = navigator.clipboard && navigator.clipboard.writeText(String(text || ''))
|
||||
if (p && typeof p.then === 'function') return p.then(() => ({ ok: true })).catch(() => ({ ok: false, error: '浏览器拒绝了剪贴板写入(需窗口有焦点)' }))
|
||||
return { ok: false, error: '剪贴板不可用' }
|
||||
} catch (e) { return { ok: false, error: '剪贴板不可用' } }
|
||||
// 统一走 IWBClipboardCopy(2026-11-24):插件拿到的失败原因由门面归一
|
||||
const C = (typeof window !== 'undefined') ? window.IWBClipboardCopy : null
|
||||
if (!C || typeof C.copyText !== 'function') return { ok: false, error: '剪贴板不可用' }
|
||||
return C.copyText(String(text || '')).then((ok) => ok ? { ok: true } : { ok: false, error: '浏览器拒绝了剪贴板写入(需窗口有焦点)' })
|
||||
},
|
||||
notify: (text, type) => { setNotice({ type: type === 'err' ? 'err' : 'ok', text: String(text || '') }); showToast(String(text || ''), type) },
|
||||
notify: (text, type) => { setNotice({ type: type === 'err' ? 'err' : 'ok', text: String(text || '') }); showToast(String(text || ''), type) }, paste: () => window.IWBDesktopHelpers.clipboardReadText(),
|
||||
// v3.25.97:提示词封面 —— 图片走宿主内容寻址存储(images/plugin/prompt/),条目只存 ref。
|
||||
putCover: (u) => wPromptCoverCtl().put(u),
|
||||
coverUrl: (r) => wPromptCoverCtl().url(r),
|
||||
@@ -8251,7 +8263,9 @@ const tbCenterSeed = (type, refs) => {
|
||||
}
|
||||
if (window.IWBPluginGallery) window.IWBPluginGallery.setImpl({
|
||||
list: (o) => window.IWBPluginGallery.query(outputs, o),
|
||||
thumb: (name) => { const f = (outputs || []).find((x) => x.name === name); return f ? wDisplayThumbOf((f.data || f.url) || '') : '' },
|
||||
// v3.26.61:缩略图取源顺序(清单 data → images/thumbs → 本地原图 → 远程)在 gallery-sync 里,
|
||||
// 原因是「生图后图库不显示」有一半出在这里 —— 新图 data 还没 hydrate 就只剩远程 url 可退。
|
||||
thumb: (name) => (wGallerySync ? wGallerySync.thumbFor(name, { outputs, displayThumbOf: wDisplayThumbOf, galleryThumb: (h) => { const F = (typeof window !== 'undefined') ? window.IWBStorageFile : null; return (F && typeof F.galleryThumb === 'function') ? F.galleryThumb(h) : Promise.resolve('') } }) : ''),
|
||||
preview: (name) => setPreview({ list: outputs.map((x) => ({ __gallery: true, name: x.name, origIdb: x.origIdb, idb: x.idb, url: x.url, thumb: x.data || null })), idx: Math.max(0, outputs.findIndex((x) => x.name === name)) }),
|
||||
download: async (names) => {
|
||||
const failed = []
|
||||
@@ -8268,7 +8282,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
return { ok: failed.length === 0, count: n, failed: failed }
|
||||
},
|
||||
insert: async (names, o) => ({ ok: true, inserted: await insertOutputsToCanvas((outputs || []).filter((f) => names.indexOf(f.name) >= 0), (o && o.insertK) || '1k') }),
|
||||
remove: async (names) => { const n = await deleteOutputs(names); return { ok: n > 0, removed: n } },
|
||||
remove: async (names) => { const n = await deleteOutputs(names); return { ok: n > 0, removed: n } }, openFolder: () => window.IWBDesktopHelpers.openGalleryDir(),
|
||||
})
|
||||
// 节点组库插件(grouplib):数据仍由宿主持有,插件只拿读写/实例化能力
|
||||
if (window.IWBPluginGroupLib) {
|
||||
@@ -8336,8 +8350,8 @@ const tbCenterSeed = (type, refs) => {
|
||||
el('div', { className: 'iwb-home-actions' },
|
||||
el('button', { className: 'iwb-btn' + (homeManage ? ' iwb-btn-primary' : ''), onClick: () => { setHomeManage((v) => !v); if (homeManage) setHomeSelectedWs([]) } }, homeManage ? '退出批量' : '批量管理'),
|
||||
el('button', { className: 'iwb-btn', disabled: !homeSelectedWs.length, onClick: () => { const old = activeWsId; Promise.all(homeSelectedWs.map((id) => hydrateBoardInto(id))).then(() => { homeSelectedWs.forEach((id) => { setActiveWsId(id); loadWsInto(workspaces.find((w) => w.id === id), true); exportCanvas(); setActiveWsId(old) }) }).catch((e) => { setActiveWsId(old); setNotice({ type: 'err', text: '导出选中失败:' + ((e && e.message) || e) }) }) } }, I('download'), '导出选中'),
|
||||
homeView === 'trash' ? el('button', { className: 'iwb-btn', onClick: async () => { if (!(await wConfirm('确定清空回收站?将彻底删除回收站中的全部画布。', { title: '清空回收站', okText: '清空' }))) return; emptyTrash() } }, I('trash'), '清空回收站') : null,
|
||||
homeSelectedWs.length ? el('button', { className: 'iwb-btn', onClick: async () => { if (!(await wConfirm(homeView === 'trash' ? '确定彻底删除选中的画布?此操作不可恢复。' : '确定删除选中的画布?(移入回收站)', { title: '删除画布', okText: '删除' }))) return; homeSelectedWs.forEach((id) => (homeView === 'trash' ? purgeWs(id) : trashWs(id))); setHomeSelectedWs([]) } }, I('trash'), '删除选中') : null,
|
||||
homeView === 'trash' ? el('button', { className: 'iwb-btn', onClick: async () => { if (!(await window.IWBUIConfirm.askOrNative('确定清空回收站?将彻底删除回收站中的全部画布。', { title: '清空回收站', okText: '清空' }))) return; emptyTrash() } }, I('trash'), '清空回收站') : null,
|
||||
homeSelectedWs.length ? el('button', { className: 'iwb-btn', onClick: async () => { if (!(await window.IWBUIConfirm.askOrNative(homeView === 'trash' ? '确定彻底删除选中的画布?此操作不可恢复。' : '确定删除选中的画布?(移入回收站)', { title: '删除画布', okText: '删除' }))) return; homeSelectedWs.forEach((id) => (homeView === 'trash' ? purgeWs(id) : trashWs(id))); setHomeSelectedWs([]) } }, I('trash'), '删除选中') : null,
|
||||
homeSelectedWs.length ? el('button', { className: 'iwb-btn', onClick: () => setCatPick({ mode: 'batch' }) }, I('tag'), '批量分类') : null,
|
||||
catPick && catPick.mode === 'batch' ? el('select', { className: 'iwb-home-cat-select', value: '', onChange: (e) => { const v = e.target.value; if (v === '__new') { td.open({ title: '新建分类', placeholder: '新分类名称', onSubmit: (nm) => batchAssignCategory(homeSelectedWs, nm) }) } else batchAssignCategory(homeSelectedWs, v); setCatPick(null); setHomeSelectedWs([]) } }, el('option', { value: '' }, '选择分类…'), wsCategories.map((c) => el('option', { key: c, value: c }, c)), el('option', { value: '__new' }, '+ 新建分类…')) : null,
|
||||
el('label', { className: 'iwb-btn' }, el('input', { type: 'file', accept: '.json,application/json', style: { display: 'none' }, onChange: (e) => { importCanvasFile(e.target.files && e.target.files[0]); e.target.value = '' } }), I('download'), '导入画布'),
|
||||
@@ -8361,7 +8375,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
homeView === 'trash'
|
||||
? [
|
||||
el('button', { title: '恢复画布', onClick: (e) => { e.stopPropagation(); restoreWs(w.id) } }, I('refresh')),
|
||||
el('button', { title: '彻底删除', onClick: async (e) => { e.stopPropagation(); if (!(await wConfirm('确定彻底删除画布「' + (w.name || '未命名画布') + '」?此操作不可恢复。', { title: '彻底删除', okText: '删除' }))) return; purgeWs(w.id) } }, I('trash')),
|
||||
el('button', { title: '彻底删除', onClick: async (e) => { e.stopPropagation(); if (!(await window.IWBUIConfirm.askOrNative('确定彻底删除画布「' + (w.name || '未命名画布') + '」?此操作不可恢复。', { title: '彻底删除', okText: '删除' }))) return; purgeWs(w.id) } }, I('trash')),
|
||||
]
|
||||
: [
|
||||
el('button', { title: '创建副本', onClick: (e) => { e.stopPropagation(); duplicateWs(w.id) } }, I('copy')),
|
||||
@@ -8530,12 +8544,14 @@ const tbCenterSeed = (type, refs) => {
|
||||
})()
|
||||
: (() => { const sn = (refs.nodes || nodes).find((n) => n && n.id === sel[0]); if (!sn) return null; const title = (sn.data && sn.data.title) || (nodeTypeTitle(sn.type)); const metaLabel = floatbarMetaLabel(wRawCfg(), sn); const pl = floatbarPlace(sn.y, sn.y + hOf(sn), floatbarLift(hasNodeTitle(sn), nodeInGroup(sn), true), viewport); return el('div', { className: 'iwb-node-floatbar' + (pl.below ? ' iwb-node-floatbar-below' : ''), onPointerDown: (e) => e.stopPropagation(), style: { left: viewport.x + (sn.x + nodeWidth(sn) / 2) * viewport.scale, top: pl.top, '--iwb-fb-k': String(pl.k) } }, metaLabel ? el('span', { className: 'iwb-node-floatbar-title', title: '当前服务商 · Key 分组' }, metaLabel) : null,
|
||||
UiGenCfgModule && UiGenCfgModule.NodeBgPalette ? el(UiGenCfgModule.NodeBgPalette, { key: 'bgc', current: (sn.data && sn.data.bg) || '', onPreview: (bg) => previewNodeBg([sn.id], bg), onPreviewEnd: endNodeBgPreview, onPick: (bg) => updateNode(sn.id, { bg }) }) : null,
|
||||
groupOf(sn.id) ? el('button', { 'aria-label': '解组', 'data-tip': '解组', onClick: (e) => { e.stopPropagation(); const g = groupOf(sn.id); if (g) ungroup(g.id) } }, I('ungroup')) : null,
|
||||
// 未编组且与某个分组相连 ⇒「并入分组」(多个相连组时取成员最多的)
|
||||
!groupOf(sn.id) && IWWorkbenchLogic.connectedGroupIdsOf(refs, sn.id).length ? el('button', { 'aria-label': '并入分组', 'data-tip': '并入分组', onClick: (e) => { e.stopPropagation(); joinGroupOf(sn.id) } }, I('group')) : null,
|
||||
sn.type === 'prompt' ? el('button', { 'aria-label': '放大编辑', 'data-tip': '放大编辑', onClick: (e) => { e.stopPropagation(); if (IWNodeBodies && IWNodeBodies.openPromptExpand) IWNodeBodies.openPromptExpand({ value: (sn.data && sn.data.text) || '', onCommit: (v) => updateNode(sn.id, { text: v }) }) } }, I('maximize')) : null,
|
||||
el('button', { 'aria-label': '改名', 'data-tip': '改名', onClick: (e) => { e.stopPropagation(); wRenameNodeDialog(sn, td, updateNode) } }, I('edit')),
|
||||
el('button', { 'aria-label': '复制', 'data-tip': '复制', onClick: (e) => { e.stopPropagation(); duplicateNodes(sel) } }, I('copy')),
|
||||
sn.type === 'prompt' ? el('button', { 'aria-label': '收藏', 'data-tip': '收藏', onClick: (e) => { e.stopPropagation(); saveSelectionAsGroup([sn.id], title) } }, I('star')) : null,
|
||||
// 单节点不再有「收藏为节点组」;提示词的星标 = 添加到提示词库(与标题栏星标同一入口)
|
||||
sn.type === 'prompt' ? el('button', { 'aria-label': '添加到提示词库', 'data-tip': '添加到提示词库', onClick: (e) => { e.stopPropagation(); addPromptToLibrary(sn.id) } }, I('star')) : null,
|
||||
sn.type === 'ref' ? el('label', { 'aria-label': '替换', 'data-tip': '替换', onPointerDown: (e) => e.stopPropagation() }, I('upload'), el('input', { type: 'file', accept: 'image/*', style: { display: 'none' }, onChange: (e) => { const f = e.target.files && e.target.files[0]; if (!f) return; try { const rd = new FileReader(); rd.onload = () => wImportImage(rd.result, { onError: (msg) => setNotice({ type: 'err', text: msg }) }, (r) => { if (!r || !r.ok || !r.data) return; updateNode(sn.id, { data: r.data, name: f.name, localName: null, url: '' }) }); rd.onerror = () => setNotice({ type: 'err', text: '读取图片文件失败:' + String(f.name || '') }); rd.readAsDataURL(f) } catch (err) { console.error(err) } } }, null)) : null,
|
||||
sn.type === 'ref' ? el('button', { 'aria-label': '粘贴', 'data-tip': '粘贴', onClick: (e) => { e.stopPropagation(); floatbarRefPaste(sn.id) }, onPointerDown: (e) => e.stopPropagation() }, I('paste')) : null,
|
||||
sn.type === 'out' ? (() => { const uout = outResultUrls(sn.id); return el('button', { 'aria-label': '下载', 'data-tip': '下载', disabled: !uout.length, onClick: (e) => { e.stopPropagation(); uout.forEach((u, i) => setTimeout(() => downloadUrl(u, 'image-' + String(i + 1).padStart(3, '0') + '.png'), i * 350)) } }, I('download')) })() : null,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
- Image Workbench:Tauri v2 桌面应用(本地优先的 AI 生图无限画布)。
|
||||
- 仓库:`/Users/qiqi/open/github/image-workbench-desktop`(mac 端),git remote 名为 `gitea`。
|
||||
- 分发:自建 NAS,公网 `https://download.maqiart.eu.org`,根目录 `/vol8/web/iwb-download`。
|
||||
- 版本线:现行 `3.25.x`。**注意**:仓库里最高的 git tag `v3.87.65` 是历史遗留线,semver 更大但**不是**最新——判断最新版看 `package.json` / `CHANGELOG.md` 顶条 / `tauri.conf.json`,永远别按最高 tag。
|
||||
- 版本线:以 `package.json` 为准(当前 `3.26.x`);历史 `3.25.x` 仅示例。**注意**:仓库里最高的 git tag `v3.87.65` 是历史遗留线,semver 更大但**不是**最新——判断最新版看 `package.json` / `CHANGELOG.md` 顶条 / `tauri.conf.json`,永远别按最高 tag。
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
> ⚠️ **命令示例已过时**:现行发布命令为 `bash scripts/publish-update.sh`(不带版本参数,版本取自 `package.json`);Windows 用 `publish-windows-update.sh` 并在 mac 侧重跑 `publish-update.sh` 合并 `latest.json`。
|
||||
|
||||
# 在线更新(Tauri Updater)
|
||||
|
||||
> 目标:用户装过一次之后,以后新版本在应用内点「检查更新」即可升级,不用再手动下载 dmg。
|
||||
@@ -16,7 +18,7 @@
|
||||
## 二、发新版本(一条命令)
|
||||
|
||||
```bash
|
||||
./scripts/publish-update.sh 3.25.3 # 改版本 + 双架构签名构建 + 上传 + 生成 latest.json
|
||||
bash scripts/publish-update.sh # 版本取自 package.json;双架构构建 + 签名 + 上传 + 生成 latest.json
|
||||
```
|
||||
|
||||
脚本会做四件事:
|
||||
@@ -30,12 +32,12 @@
|
||||
|
||||
```json
|
||||
{
|
||||
"version": "3.25.2",
|
||||
"version": "X.Y.Z",
|
||||
"notes": "更新说明",
|
||||
"pub_date": "2026-11-17T09:43:08.117Z",
|
||||
"platforms": {
|
||||
"darwin-aarch64": { "signature": "<.sig 内容>", "url": "https://.../image-workbench_3.25.2_aarch64.app.tar.gz" },
|
||||
"darwin-x86_64": { "signature": "<.sig 内容>", "url": "https://.../image-workbench_3.25.2_x64.app.tar.gz" }
|
||||
"darwin-aarch64": { "signature": "<.sig 内容>", "url": "https://.../image-workbench_X.Y.Z_aarch64.app.tar.gz" },
|
||||
"darwin-x86_64": { "signature": "<.sig 内容>", "url": "https://.../image-workbench_X.Y.Z_x64.app.tar.gz" }
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -44,7 +46,7 @@
|
||||
|
||||
## 四、用户侧流程
|
||||
|
||||
1. 装过任一 3.25.2+ 版本(这是第一个带更新器的版本)
|
||||
1. 装过任一 3.26.54+ 版本(更早版本需先手动装一次带更新器的包)
|
||||
2. 设置 → 通用 → 版本与更新 → **检查更新**
|
||||
3. 有新版本 → 显示版本号与说明 → 点「立即更新」
|
||||
4. 自动下载、校验签名、替换、重启(数据目录不受影响)
|
||||
|
||||
+4
-125
@@ -1,127 +1,6 @@
|
||||
# Windows 出包步骤(手把手)
|
||||
# Windows 出包(已归档)
|
||||
|
||||
> **本版要打的版本:3.25.1**(仓库里已经是这个号,直接构建,不要再改)
|
||||
>
|
||||
> 确认命令:node -e "console.log(require('./package.json').version)" → 应输出 3.25.1
|
||||
>
|
||||
> 产物名:image-workbench_3.25.1_x64-setup.exe / image-workbench_3.25.1_x64_en-US.msi
|
||||
> 本文已归档:内容对应 v3.25.x,版本号写死、流程已过时。
|
||||
> 现行权威流程见 [`WIN_BUILD_SPEC.md`](WIN_BUILD_SPEC.md)。
|
||||
|
||||
> 目标:在一台 Windows 机器上,从 Gitea 拉代码 → 打出安装包 → 自测 → 把产物回传到 NAS。
|
||||
|
||||
## 0. 前置检查
|
||||
|
||||
- Windows 10 1803+ 或 Windows 11,**x64**
|
||||
- 磁盘 ≥ 5 GB 空闲(Rust 编译产物较大)
|
||||
- 有本地管理员权限(装 Visual Studio Build Tools 需要)
|
||||
|
||||
## 1. 安装工具链(一次性)
|
||||
|
||||
| 工具 | 命令 / 说明 |
|
||||
|---|---|
|
||||
| Git | `winget install Git.Git` |
|
||||
| Node.js LTS(22) | `winget install OpenJS.NodeJS.LTS` |
|
||||
| Rust | `winget install Rustlang.Rustup` 然后 `rustup default stable-x86_64-pc-windows-msvc` |
|
||||
| **VS Build Tools 2022** | 勾选「**使用 C++ 的桌面开发**」(MSVC v143 + Windows SDK)——**最容易漏** |
|
||||
| WebView2 Runtime | Win11 自带;Win10 没有就装 Evergreen |
|
||||
|
||||
自检:
|
||||
|
||||
```powershell
|
||||
cd image-workbench-desktop
|
||||
powershell -ExecutionPolicy Bypass -File scripts\windows-check.ps1
|
||||
```
|
||||
|
||||
全部 `[OK]` 再做下一步。Rust 那行不能出现 `gnu`(必须 msvc)。
|
||||
|
||||
## 2. 取代码
|
||||
|
||||
```powershell
|
||||
git clone https://git.maqiart.eu.org/malongan/image-workbench-desktop.git # 公网(公开库)
|
||||
# 或内网/Tailscale:git clone http://192.168.100.185:3000/malongan/image-workbench-desktop.git
|
||||
```
|
||||
|
||||
建议放 `C:\work\image-workbench-desktop`(避开长路径/中文路径)。
|
||||
|
||||
## 3. 安装依赖
|
||||
|
||||
```powershell
|
||||
cd C:\work\image-workbench-desktop
|
||||
npm ci
|
||||
```
|
||||
|
||||
用 `npm ci`,不要 `npm install`。卡住就换 registry 或配代理。
|
||||
|
||||
## 4. 设版本号(三处必须一致)
|
||||
|
||||
```powershell
|
||||
node scripts/set-version.js 3.25.0
|
||||
```
|
||||
|
||||
同时改 `package.json` / `src-tauri/tauri.conf.json` / `src-tauri/Cargo.toml`。
|
||||
版本必须比线上大,否则以后接自动更新时客户端不认。
|
||||
|
||||
## 5. 出包
|
||||
|
||||
```powershell
|
||||
npm run app:build
|
||||
```
|
||||
|
||||
内部顺序:`lint → build → 剥离内置插件 → tauri build`(lint 不过就不出包,故意的)。
|
||||
|
||||
产物:
|
||||
|
||||
| 文件 | 用途 |
|
||||
|---|---|
|
||||
| `src-tauri\target\release\bundle\nsis\image-workbench_3.25.0_x64-setup.exe` | **主推**(当前用户安装,免管理员) |
|
||||
| `src-tauri\target\release\bundle\msi\image-workbench_3.25.0_x64_en-US.msi` | 企业环境用 |
|
||||
| `src-tauri\target\release\image-workbench.exe` | 免安装单文件(目标机需 WebView2) |
|
||||
|
||||
首次构建 5~15 分钟,之后增量 1~2 分钟。
|
||||
|
||||
## 6. 自测(必须过)
|
||||
|
||||
1. 安装 → 启动
|
||||
2. 数据目录生成:`%USERPROFILE%\Documents\ImageWorkbench`(data.json / canvases / library / images)
|
||||
3. 设置→通用:「数据库目录」路径正确,「打开」能弹资源管理器
|
||||
4. 关窗进程留托盘;左键托盘唤窗口;右键有菜单
|
||||
5. 设置→插件:**无内置插件**;市场列 7 个;装一个 → 重启后可用
|
||||
6. 画布新建/拖拽/缩放正常;导入图片正常
|
||||
7. 点「下载」→ 直接落到导出目录,不弹另存为
|
||||
|
||||
## 7. 把产物传回来
|
||||
|
||||
**A. 传 NAS(局域网/Tailscale)**
|
||||
|
||||
```powershell
|
||||
scp "src-tauri\target\release\bundle\nsis\image-workbench_3.25.0_x64-setup.exe" malongan@192.168.100.185:/vol8/web/iwb-download/updates/windows-x86_64/
|
||||
```
|
||||
|
||||
**B. 传 Gitea Releases**(公开库匿名可下载)
|
||||
|
||||
**C. 发我**:我上传 NAS 并更新 `releases.json` 与下载页
|
||||
|
||||
## 8. 常见错误
|
||||
|
||||
| 报错 | 原因 | 解决 |
|
||||
|---|---|---|
|
||||
| `link.exe not found` | 没装 VS Build Tools C++ 工作负载 | 重装并勾「使用 C++ 的桌面开发」 |
|
||||
| rustc 显示 `gnu` | 默认工具链错 | `rustup default stable-x86_64-pc-windows-msvc` |
|
||||
| `Windows SDK is not installed` | SDK 缺失 | Build Tools 勾 Windows SDK |
|
||||
| 启动报 WebView2 错误 | 缺运行时 | 装 Evergreen Runtime |
|
||||
| `npm ci` 超时/证书 | 网络 | 换 registry / 配 proxy |
|
||||
| 编译文件被占用 | 杀软扫描 target | 排除 `src-tauri\target` |
|
||||
| 路径过长 | 目录太深 | 放 `C:\work\`;`git config --system core.longpaths true` |
|
||||
| beforeBuildCommand lint 失败 | 代码有未定义变量 | 修代码,别绕过门禁 |
|
||||
|
||||
## 9. 当前状态
|
||||
|
||||
- **自动更新未启用**(updater 未装)⇒ Windows 包只能手动下载安装
|
||||
- 下载页 Windows 位置现在显示「暂未提供」;传回后我加一条 `windows-x86_64` 就自动出现
|
||||
- 插件不随包:新机器是零插件,需从市场装
|
||||
|
||||
## 10. 一句话流程
|
||||
|
||||
```
|
||||
装工具 → git clone → npm ci → node scripts/set-version.js x.y.z
|
||||
→ npm run app:build → 自测 7 条 → 传回 NAS/Gitea → 我更新下载页
|
||||
```
|
||||
历史版本:[`archive/history/DESKTOP_WINDOWS-legacy.md`](archive/history/DESKTOP_WINDOWS-legacy.md)。
|
||||
+4
-106
@@ -1,108 +1,6 @@
|
||||
# 任务:在 Windows 上为 image-workbench-desktop 构建 v3.25.15 安装包
|
||||
# Windows 构建任务书(已归档)
|
||||
|
||||
你是这台 Windows 机器上的打包执行者。只做打包与自测,**不改业务代码**。
|
||||
> 原任务书针对 v3.25.15,版本号与 commit 已过时。
|
||||
> 现行流程见 [`WIN_BUILD_SPEC.md`](WIN_BUILD_SPEC.md),版本以 `package.json` 为准。
|
||||
|
||||
> ⚠️ v3.25.15 起的变化:项目已**彻底转桌面客户端**(`_headers` / `functions/` / `wrangler.toml` 已删除,`npm run deploy` 脚本已移除);
|
||||
> 更新清单**平台解耦**(Windows 用 `updates/latest-windows.json`,**由 Mac 侧用正式私钥生成,你不写**)。
|
||||
|
||||
## 硬性约束
|
||||
|
||||
1. 不改 `app.js` / `src/**` / `src-tauri/src/**` / `style.css` 的业务逻辑
|
||||
2. 不绕过 lint 门禁;报错就停下报告
|
||||
3. 不用 `npm install`,只用 `npm ci`;版本已定 **3.25.15**,不要改
|
||||
4. 不 commit / 不 push / 不打 tag / 不跑任何 `scripts/publish-*.sh`
|
||||
5. 不改 `src-tauri/tauri.windows.conf.json`(产物已锁 `nsis`,不要 msi)
|
||||
|
||||
## 第零步:拉代码
|
||||
|
||||
```powershell
|
||||
git fetch --all --tags; git checkout main; git pull --ff-only
|
||||
git rev-parse --short HEAD # 必须是 84c2c10 或其后代
|
||||
node -e "console.log(require('./package.json').version)" # 必须 3.25.15
|
||||
```
|
||||
|
||||
## 第一步:环境检查
|
||||
|
||||
```powershell
|
||||
node -v; npm -v; rustc -V; rustup show active-toolchain
|
||||
powershell -ExecutionPolicy Bypass -File scripts\windows-check.ps1
|
||||
```
|
||||
|
||||
全部 `[OK]` 才继续;出现 `[缺失]` 停止报告(不要自行安装)。
|
||||
|
||||
## 第二步:依赖
|
||||
|
||||
```powershell
|
||||
npm ci
|
||||
```
|
||||
|
||||
本次新增两个 Rust 插件依赖(single-instance / notification),首次构建会多拉一些 crate。
|
||||
|
||||
## 第三步:构建(用一次性临时密钥签名)
|
||||
|
||||
```powershell
|
||||
npx tauri signer generate -w "$env:TEMP\iwb-tmp.key" --password ""
|
||||
$env:TAURI_SIGNING_PRIVATE_KEY = Get-Content "$env:TEMP\iwb-tmp.key" -Raw
|
||||
$env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD = ""
|
||||
npx tauri build
|
||||
Remove-Item "$env:TEMP\iwb-tmp.key" -Force
|
||||
```
|
||||
|
||||
> 产出的 `.sig` 是临时密钥签的,**我会在 Mac 上用正式私钥重签**,你附上即可。
|
||||
|
||||
## 第四步:确认产物
|
||||
|
||||
```powershell
|
||||
Get-ChildItem src-tauri\target\release\bundle -Recurse -Include *.exe,*.sig | Select FullName,Length
|
||||
Get-FileHash "src-tauri\target\release\bundle\nsis\image-workbench_3.25.15_x64-setup.exe" -Algorithm SHA256
|
||||
Test-Path dist\plugins # 期望 False
|
||||
Test-Path _headers # 期望 False
|
||||
Test-Path functions # 期望 False
|
||||
```
|
||||
|
||||
## 第五步:自测清单(逐条报通过/失败)
|
||||
|
||||
**基础**
|
||||
1. 安装并启动;数据目录 `%USERPROFILE%\Documents\ImageWorkbench` 生成 `data.json`/`canvases`/`library`/`images`
|
||||
2. **`images\` 下必须有 `canvas` 文件夹**(v3.25.12 之前只有 `thumbs`,这是丢图根因)
|
||||
3. 设置 → 通用:数据库目录正确;「打开」能弹资源管理器
|
||||
4. 关窗口进程仍在托盘;左键唤出;右键有菜单
|
||||
|
||||
**图片持久化(历史 bug 复现点)**
|
||||
5. `Ctrl+V` 粘贴新图 → 出现图片节点
|
||||
6. **正常退出**(托盘右键退出,非强杀)→ 重开 → 图仍在、显示正常
|
||||
7. 从资源管理器拖图进画布 → 退出重开 → 图还在
|
||||
|
||||
**桌面壳(本次新增)**
|
||||
8. 单实例:连续双击两次 → 只有一个窗口,第二次聚焦已有
|
||||
9. 外链:点「项目主页」→ 用系统浏览器打开,应用不变(不能被导航成网页)
|
||||
10. 跑一次生图,完成后弹系统通知
|
||||
|
||||
**插件与 CSP(本次修复)**
|
||||
11. 设置 → 插件:无内置插件;市场能列 7 个;装一个 → 重启后可用
|
||||
12. **鲜艺抠图**:启用后对图片节点执行抠图 → **不应出现 `Failed to fetch`**(3.25.11 回归,3.25.14 已修)
|
||||
13. 若本机有 `XianyiAiRmbg` 监听 `0.0.0.0:30092` → 抠图出透明底;没装则注明跳过
|
||||
|
||||
**外观(本次新增)**
|
||||
14. 设置 → 外观:改画布底色(亮/暗)与主题色 → 立即生效,重启保持
|
||||
15. 亮暗切换时画布底色分别用两套值
|
||||
|
||||
任何一条失败:记录现象 + 截图后停止报告,**不要改代码**。
|
||||
|
||||
## 第六步:交付格式
|
||||
|
||||
```
|
||||
结论:成功 / 失败(卡在第 N 步)
|
||||
版本:3.25.15 commit=<sha>
|
||||
安装包:<路径> <大小> SHA256=<hex>
|
||||
环境:node= rust= VS= WebView2=
|
||||
自测:1✅ … 15✅(失败写 ❌ + 现象)
|
||||
耗时:
|
||||
```
|
||||
|
||||
产物留在本机;**不要**上传 NAS、**不要**写 `latest-windows.json`(我在 Mac 侧做)。
|
||||
|
||||
## 停止条件
|
||||
|
||||
commit 不对 / 环境缺件 / 构建报错一次重试无效 / 自测有失败 / 需要改业务代码 —— 遇到即停,
|
||||
报告「卡在哪一步 + 完整报错 + 已尝试过什么」。
|
||||
历史版本:[`archive/history/PROMPT-WIN-BUILD-v3.25.15.md`](archive/history/PROMPT-WIN-BUILD-v3.25.15.md)。
|
||||
+3
-2
@@ -5,8 +5,9 @@
|
||||
## 使用与发布
|
||||
|
||||
- [项目说明](../README.md)
|
||||
- [发布说明](../PUBLISHING.md)
|
||||
- [**版本记录与还原**(RELEASES:出问题怎么退版)](RELEASES.md)
|
||||
- [发布规则(桌面版)](../PUBLISHING.md)
|
||||
- [**Windows 打包与交付规范**](WIN_BUILD_SPEC.md)
|
||||
- [**版本记录与回滚**(桌面版)](RELEASES.md)
|
||||
- [**贡献指南**(改代码前先看这个)](../CONTRIBUTING.md)
|
||||
- [**待办清单 BACKLOG**(这个项目有什么待办)](../BACKLOG.md)
|
||||
|
||||
|
||||
+16
-421
@@ -1,431 +1,26 @@
|
||||
# 版本记录与还原(RELEASES)
|
||||
# 版本记录与回滚(桌面版)
|
||||
|
||||
> **用途**:出问题时**怎么快速、准确地还原**。这是还原的唯一权威入口。
|
||||
> **最后核对:2026-11-16** · 基线 `main = 7df9dc4`(v3.24.85 的文档提交,也是**正式站与测试站**实际运行提交;bump 提交是 `4be78c0`)| 三地址版本号一致 `v3.24.85`(`IWB_VERIFY_STRICT=1` 核验通过 ⇒ `stable` = `7df9dc4`)
|
||||
> **注意 `+commit` 后缀天然可以不同**:若发版后又有 docs-only 提交并重发,正式站与测试站的 `+commit` 会分叉(v3.24.84 时即正式站 `c8b7543` / 测试站 `7d6ff6c`);本版两者部署的是同一份 `dist/`,故后缀相同。
|
||||
> 一致性比较只看版本号,2026-11-14 已修 `verify-release.js`(此前用完整串比较,导致每次发版必误报)。
|
||||
> **v3.24.80 的正式发布延迟到 2026-11-14 07:20**:11-13 23:25 首次发布撞上 Cloudflare 官方事故(**Workers API availability**,Pages 全系 API 返回 `503 no healthy upstream`),连续 20+ 次重试均失败;期间正式站**保持 `v3.24.79+8598a57` 未动**,用户无感。API 恢复后用**同一份门禁通过的产物**(`v3.24.80+2d584a6`)补发,未重跑 e2e。
|
||||
>
|
||||
> 配套文档:[`CHANGELOG.md`](../CHANGELOG.md)(每版改了什么)· [`PUBLISHING.md`](../PUBLISHING.md)(怎么发版)
|
||||
> 2026-11-24 重写。历史网页版 Pages/测试站记录已归档:
|
||||
> [`docs/archive/history/RELEASES-legacy-web.md`](archive/history/RELEASES-legacy-web.md)。
|
||||
|
||||
---
|
||||
## 版本记录
|
||||
|
||||
## 0. 现在的线上是什么?(30 秒确认)
|
||||
- 发布条目:`CHANGELOG.md`(每个 `## vX.Y.Z` 对应一个 tag)
|
||||
- 当前版本:`node -e "console.log(require('./package.json').version)"`
|
||||
- 产物与更新源:`https://download.maqiart.eu.org/updates/latest.json`
|
||||
|
||||
## 回滚(mac)
|
||||
|
||||
```bash
|
||||
cd ~/open/github/image-workbench-web
|
||||
|
||||
# ① 线上实际在跑什么(三地址应一致)
|
||||
curl -fsSL https://iwb.maqiart.eu.org/version.json
|
||||
curl -fsSL https://image-workbench-web.pages.dev/version.json
|
||||
curl -fsSL https://test.image-workbench-web.pages.dev/version.json
|
||||
|
||||
# ② 一条命令做「三地址一致 + 线上代码可从 origin/main 恢复」双重核验
|
||||
IWB_VERIFY_STRICT=1 node scripts/verify-release.js
|
||||
```
|
||||
|
||||
**2026-11-16 实测结果(v3.24.85 · 代码体检收口)**:
|
||||
|
||||
| 地址 | 版本 |
|
||||
|---|---|
|
||||
| `https://iwb.maqiart.eu.org`(正式/自定义域名) | `v3.24.85+7df9dc4` |
|
||||
| `https://image-workbench-web.pages.dev`(正式) | `v3.24.85+7df9dc4` |
|
||||
| `https://test.image-workbench-web.pages.dev`(测试) | `v3.24.85+7df9dc4` |
|
||||
|
||||
✅ **三地址一致** `v3.24.85+7df9dc4`,`IWB_VERIFY_STRICT=1` 核验「线上代码可从 `origin/main` 恢复」通过。
|
||||
本版测试站与正式站部署的是**同一份 `dist/`**(`7df9dc4`),故三地址 `+commit` 后缀也相同。
|
||||
上一版 v3.24.84 = 正式站 `v3.24.84+c8b7543` / 测试站 `v3.24.84+7d6ff6c`(后缀分叉是因为发版后又有一个 docs-only 提交并重发了测试站)。
|
||||
(`verify-release.js` 于 2026-11-14 修过一次:旧实现比较完整串,于是每次 docs-only 提交后发版都误报「三地址不一致」。)
|
||||
|
||||
---
|
||||
|
||||
**2026-11-14 实测结果(v3.24.80 · 兜底保存 rev 修复)**:
|
||||
|
||||
| 地址 | 版本 |
|
||||
|---|---|
|
||||
| `https://iwb.maqiart.eu.org`(正式/自定义域名) | `v3.24.80+2d584a6` |
|
||||
| `https://image-workbench-web.pages.dev`(正式) | `v3.24.80+2d584a6` |
|
||||
| `https://test.image-workbench-web.pages.dev`(测试) | `v3.24.80+2d584a6` |
|
||||
|
||||
✅ **三地址一致** `v3.24.80+2d584a6`,`IWB_VERIFY_STRICT=1` 核验「线上代码可从 `origin/main` 恢复」通过。
|
||||
正式站产物 `app.js` 的 SHA-256 与本地 `dist/app.js` 一致(`6308e5b8…`)⇒ 线上跑的就是这次构建。
|
||||
(核验时 `image-workbench-web.pages.dev` 首轮报 TLS 握手断开,重试一轮即收敛 —— `pages.dev` 首轮抖动是该地址的已知现象。)
|
||||
|
||||
正式站本次从 `v3.24.79` 到 `v3.24.80`(单版)。本次改动(相对 v3.24.79):
|
||||
修「离开页面的兜底保存不递增 rev」——`flush()`(`beforeunload` / `pagehide` / `visibilitychange`)原先把
|
||||
**旧 rev 原样写回**,而其它标签页靠轮询 rev 变化判断同步,rev 不动 ⇒ A 标签关闭/切后台前的最后一次修改
|
||||
对 B 标签不可见,下一秒就被 B 的保存洗掉;改成 `((read().rev || 0) + 1)`,与标准保存路径 `wApi('workspaces')`
|
||||
的 `prev.rev + 1` 对齐。另删死代码 `createWBFlushViewport`(17 行,全仓无调用)与根目录误提交的空文件 `0`。
|
||||
本次**不做**的三项及其实测依据见 `BACKLOG §4.5`(autoGrow 强制布局实测 68→67ms 无收益、OUT_KEY 竞态诊断有误、
|
||||
`renderBody` 1,600 次查无实据)。
|
||||
|
||||
(v3.24.79 发版记录 · 上一版)正式站从 `v3.24.78` 到 `v3.24.79`(单版):
|
||||
用户报「设置 → 生图服务 → 服务器地址测速三个地址全 ✗ 失败」。四步定责后确认与服务、网络、Key 都无关:
|
||||
`POST /v1/images/generations` 有 `access-control-allow-origin`,而 `GET /v1/models` 的真实响应**一个 CORS 头都没有**
|
||||
(只有 `OPTIONS` 预检有)—— 测速打的是简单请求,**不触发预检**,响应无 ACAO 就被浏览器拦在读结果那步。
|
||||
改法:测速逻辑搬进 `src/generation-provider-ping.js`,分段判定「普通请求 → 失败退一次 `no-cors`」、
|
||||
**超时不重试**(否则 6s 变 12s 像卡死)、失败必须带原因;实测三地址 147 / 148 / 148ms。
|
||||
|
||||
(回滚点:`stable-v3.24.79` → `8598a57`、`stable-v3.24.78` → `aaa9112`。)
|
||||
|
||||
---
|
||||
|
||||
## 1. 近期版本对照表(可直接用来还原)
|
||||
|
||||
> **未单独打 tag 的版本**:`v3.24.45`(撤回位图转矢量、收回 `wasm-unsafe-eval`,`f9c2211`)与
|
||||
> `v3.24.46`(位图转矢量 v0.2 换 potrace,`23065d2`)**只发过测试站、从未打 tag**,
|
||||
> 其内容已包含在 `v3.24.47`(`7ef8141`)内 ⇒ 还原到 v3.24.47 即等于包含这两版。
|
||||
> 同理 `v3.24.37` ⊂ `v3.24.38`、`v3.24.39` ⊂ `v3.24.40`、`v3.24.34`/`v3.24.35` ⊂ `v3.24.36`。
|
||||
> **2026-11-06 补齐**:表中新增 `v3.24.30/31/32/41`(此前有 tag、有 Release,但表里缺行 —— 会让人以为无法还原)。
|
||||
> **2026-11-09 补齐**:表中新增 `v3.24.50~55/57/58`(此前有 tag、有 Release,但表里缺行);
|
||||
> `v3.24.56`(`ce2845d`)与 `v3.24.59`(bump `77154ac`,测试站试色版)**未打 tag**,
|
||||
> 内容分别并入 `v3.24.57` 与 `v3.24.60` ⇒ 还原到后一版即等于包含它。
|
||||
> **2026-11-11 补齐**:表中新增 `v3.24.61~63`(此前有 tag、有 Release,但表里缺行);
|
||||
> `v3.24.64`(bump `2d83a13`)**未单独打 tag**,测试站验收时发现问题,内容并入 `v3.24.65`。
|
||||
> **2026-11-11 二次发布**:`v3.24.68`/`v3.24.69` 先在测试站验收、**补打了 tag**(`63493b2`/`e4cb049`),
|
||||
> 三版一起由 `v3.24.70` 上正式站 ⇒ 还原到 `v3.24.70`(`a3dfad5`)即等于包含 68/69 的全部内容。
|
||||
> **2026-11-12 六版合并发布**:`v3.24.71~75` 先在测试站验收、各有 tag 与 GitHub Release,
|
||||
> 六版一起由 `v3.24.76` 上正式站 ⇒ 还原到 `v3.24.76`(`e660a75`)即等于包含 71~75 的全部内容。
|
||||
|
||||
| 版本 | tag → commit | 发布日期 | GitHub Release | 说明 |
|
||||
|---|---|---|---|---|
|
||||
| **v3.24.85** | `7df9dc4`(线上实际运行;bump 提交 `4be78c0`) | 2026-11-16 | ✓ | 代码体检收口(不改可见行为):① 棘轮收回 `Workbench()` 3,090→**2,998**、上限降到 **3,030**(留 32 行余量)—— 生成取消族与工作区列表写回族搬进 `src/runtime-workbench-logic.js`,删零调用的死代码 `runAll`;② 图库索引 4 条**绕过门面锁**的写路径(`imageFolderSync` / `storeOutputThumb.idxSet` / 备份 `restore` / `wPurgeOutputOriginals`)收口到新增的 `mutate(fn)`,治「两个标签页同时归档 ⇒ 图库莫名少条目」;③ 文档数字校准(线上版本、app.js 行数/占比、模块数、单测数、钉点数) |
|
||||
| **v3.24.84** | `c8b7543`(bump 提交 `5d0b169`) | 2026-11-14 | ✓ | 生图节点连了 3 条上游只出 1 个任务 ⇒ 任务身份改用 `ownerNodeId`(本节点自己,不随继承冒泡):连几条线就几个任务,`relay` 仍归约到真实文本来源(同一来源多路径抵达只算一次,防重复计费);任务标题兜底加 `data.name`。同批:任务卡标题统一「任务 N · 来源名」、`verify-release.js` 的三地址一致不再被 `+commit` 后缀误判 |
|
||||
| **v3.24.83** | `73748f7`(线上实际运行;bump 提交 `0a27a42`) | 2026-11-14 | — | ① 插件节点冷启动不再退化成一段文本:插件节点体是异步注册的,`registerNodeType` 在 `render` 由无变有时自增 `NODE_TYPES_REV`,`NodeCard` 比它 ⇒ 注册那一刻重建一次;`canvas-normalize` 按命名规则认作已知类型、不再降级写回存档(配套插件 `style-source` 1.3.2 改为脚本执行时注入样式)。② 画布底栏加「缩小 / 放大」两个图标(放在「适应」左边,一档 15%,锚点=画布中心),缩放数学抽成 `IWBCanvasGeometry.zoomStep` 纯函数与快捷键共用。③ 补记 v3.24.81/82 漏记的三处棘轮 |
|
||||
| **v3.24.82** | `ef6cf42` | 2026-11-14 | ✓ | 提示词/文本节点显示上游继承文本(自己 `data.text` 为空时显示上游那段话,改一个字即接管,另有「恢复跟随」);修 `nodeRefsOf` 的 textout 分支只认 llm/batch/combine 上游导致「样式 → 文本 → 分层」丢参考图 |
|
||||
| **v3.24.81** | `dba71e3` | 2026-11-14 | ✓ | 插件节点可自定义节点体(`render(node, props, host)` 画真实 DOM,宿主不每帧重建 ⇒ 输入框不失焦);节点自带参考图(`data.refOn/refUrl`);连线白名单按 `data.outKind === 'prompt'` 归一化 |
|
||||
| **v3.24.80** | `2d584a6`(线上实际运行;bump 提交 `9d77ec9`) | 2026-11-14 | ✓ | 离开页面的兜底保存不递增 rev:`flush()`(`pagehide` / `visibilitychange` / `beforeunload`)写回旧 rev ⇒ 其它标签页轮询看不到末次修改,A 标签关掉前的改动会被 B 的保存洗掉;改成 `((rev\|\|0)+1)` 对齐标准保存路径。另删死代码 `createWBFlushViewport`(17 行)与根目录误提交的空文件 `0`;e2e 补「rev 恰好 +1」断言(两条兜底路径) |
|
||||
| **v3.24.79** | `8598a57`(bump 提交 `9f49184`) | 2026-11-12 | ✓ | 服务器地址测速全红修复:服务端 CORS 只配在预检与生图 POST 上,`GET /models` 无 ACAO ⇒ 改「普通请求失败后退一次 `no-cors`」+ 超时不重试 + 失败带原因;`generation-provider-ping.js` + 29 条单测 |
|
||||
| **v3.24.78** | `aaa9112` | 2026-11-12 | ✓ | LOD 拆三档:15% 以上画代表图 / 首行文字,15% 以下才退成 CSS 占位(v3.24.77 一并上线);`lodModeOf` + 13 条判据断言 + 5 条 e2e |
|
||||
| **v3.24.77** | `0602388` | 2026-11-12 | ✓ | LOD 判据换成节点屏幕宽度:800 节点切画布 488 → 198ms、textarea 186 → 0;只发过测试站,内容包含在 v3.24.78 |
|
||||
| **v3.24.76** | `e660a75` | 2026-11-12 | ✓ | 钉点减法第二批:3 条 e2e 查出 3 个真缺陷(objectURL 从未释放 / 孤儿标签 session / 误回收打开标签的图);v3.24.71~75 一并上线 |
|
||||
| **v3.24.75** | `47f41aa` | 2026-11-12 | ✓ | 同图去重:内容哈希,同一张图连粘两次只建一个节点;只发过测试站,内容包含在 v3.24.76 |
|
||||
| **v3.24.74** | `ec1adb3` | 2026-11-12 | ✓ | 粘贴落点精确到像素(消掉 63px 偏移)+ 图片准入统一 `image-admit`;只发过测试站 |
|
||||
| **v3.24.73** | `9c8a5fd` | 2026-11-12 | ✓ | 静默失败收口:用户动作的失败必须有红色回执 + 规则库立规;只发过测试站 |
|
||||
| **v3.24.72** | `45aa6a0` | 2026-11-12 | ✓ | 钉点减法第一批:32 条源码钉点换成 DOM/运行时断言(537→505);只发过测试站 |
|
||||
| **v3.24.71** | `cc5c3e2` | 2026-11-12 | ✓ | app.js 总量棘轮改为双层预算(8,700 + 占比 40%)+ 覆盖率复算入档;只发过测试站 |
|
||||
| **v3.24.70** | `a3dfad5`(线上实际运行) | 2026-11-11 | ✓ | 修「复制粘贴突然不起作用」:焦点在节点输入框的两条静默通道;v3.24.68/69 一并上线 |
|
||||
| **v3.24.69** | `e4cb049` | 2026-11-11 | ✓ | 粘贴落点跟随鼠标(推翻 v3.24.68 的「不跟鼠标」);只发过测试站,内容包含在 v3.24.70 |
|
||||
| **v3.24.68** | `63493b2` | 2026-11-11 | ✓ | 统一剪贴板:Ctrl+C 同时写系统剪贴板,Ctrl+V 一个键管到底(含节点组);只发过测试站,内容包含在 v3.24.70 |
|
||||
| **v3.24.67** | `0f8d677`(线上实际运行) | 2026-11-11 | ✓ | 剪贴板语义收口(`Ctrl+V` 只认系统剪贴板 / 粘贴不下载 / 修 7 个静默缺陷)+ 积压四版合并上线 |
|
||||
| **v3.24.66** | `b247375` | 2026-11-11 | ✓ | 参考图准入统一收口:图库插入 / 图库拖入 / 拖入链接也把 SVG 转 PNG |
|
||||
| **v3.24.65** | `02cbd59` | 2026-11-11 | ✓ | 三处预览/图库下载后缀仍为 `.png` + SVG 复制到剪贴板必失败(含 `v3.24.64`:下载/归档后缀跟随真实格式) |
|
||||
| **v3.24.63** | `6c4a8aa` | 2026-11-10 | ✓ | 棘轮恢复零余量 + 文档口径统一(纯工程收尾,界面无变化) |
|
||||
| **v3.24.62** | `80f6b0c` | 2026-11-10 | ✓ | 测试安全网:设置 CRUD(e2e)+ 核心链路纯函数单测 |
|
||||
| **v3.24.61** | `7b02ccf` | 2026-11-10 | ✓ | 设置面板拆分(`SettingsModal` −54%)+ 存储写路径留痕 + 版本记录守卫 |
|
||||
| **v3.24.60** | `bff766d` | 2026-11-09 | ✓ | 节点气泡恢复删除按钮(单选 + 多选组气泡;静态灰 / hover 红,`Ctrl+Z` 可撤销)+ 两条防误删门禁改写 |
|
||||
| **v3.24.58** | `33b9dc4` | 2026-11-08 | ✓ | 数据一致性:多标签图库同步 + Web Locks 串行化 + 导入防原型污染 + 写失败留痕 |
|
||||
| **v3.24.57** | `3b0c652` | 2026-11-07 | ✓ | 存储可信度收尾:只读体检 + 一键安全回收 + 还原后校验 |
|
||||
| **v3.24.55** | `86a931f` | 2026-11-07 | ✓ | 数据安全收尾:导出备份提醒 + 配额可见 + 备份体积护栏 + 部署钉版 |
|
||||
| **v3.24.54** | `aa17527` | 2026-11-07 | ✓ | 持久化存储(`navigator.storage.persist`)+ 错误留痕 + PWA 可安装 + 自动备份 |
|
||||
| **v3.24.53** | `87ddf7b` | 2026-11-07 | ✓ | 开发体验与类型安全:事实同步器 + 统一源文本 + 渐进类型检查(`tsc --checkJs`) |
|
||||
| **v3.24.52** | `479695b` | 2026-11-07 | ✓ | `Workbench` 组件化收口(阶段一样板,−68 行) |
|
||||
| **v3.24.51** | `46981ec` | 2026-11-07 | ✓ | 工程质量专项:存储入口收敛 + e2e 去固定等待(纯内部重构,界面无变化) |
|
||||
| **v3.24.50** | `e28e1f4` | 2026-11-06 | ✓ | `Workbench` 拆分(累计 **−914 行**)+ 全仓健康度分析 |
|
||||
| **v3.24.49** | `61a0af9` | 2026-11-06 | ✓ | 拖动画布松手丢最后一小段位移(「平移末帧提交」原是死代码)+ 门禁补「加载期跨模块依赖顺序」守卫 |
|
||||
| **v3.24.48** | `f775dd5` | 2026-11-06 | ✓ | LLM 连不上:`normalizeEndpointBase` 剥掉 Base URL 里误粘的 `/chat/completions` 等接口路径(老配置自动纠正)+ 测试前提示未保存 |
|
||||
| **v3.24.47** | `7ef8141` | 2026-11-05 | ✓ | 内存专项:修掉「轮询同步自激重水合」(内容签名 + 12s 自保存窗口)+ 水合分批 |
|
||||
| **v3.24.44** | `33a94e0` | 2026-11-04 | ✓ | 输出图片顺序跟随任务卡(组序锚定任务顺序 + 组内按变体序号)+ 旧图排最后并标注 |
|
||||
| **v3.24.43** | `3af2a3b` | 2026-11-04 | ✓ | 复制节点右侧/下方就近让位(零重叠)+ 修 `refs.measuredH` 清空后永不回填 |
|
||||
| **v3.24.42** | `33a906a` | 2026-11-04 | ✓ | 任务行动效重做(一次性扫光 + 呼吸描边,删假进度条)+ 版本更新提示移到画布上方 |
|
||||
| **v3.24.41** | `a41ec2a` | 2026-11-03 | ✓ | 输出节点的图不再「自己掉」:结果精简落盘 + 只在断连时丢 |
|
||||
| **v3.24.40** | `037cda5` | 2026-11-03 | ✓ | 放大编辑:多级列表保真(不再拍平)+ 有序列表入口 + Tab 升降级 + 清除格式可 Ctrl+Z 撤销,含 3.24.39 的行距修复与工具条中文化 |
|
||||
| **v3.24.38** | `b3fe448` | 2026-11-03 | ✓ | 资源中心「开合 + 标签页」双持久化(刷新后不再关面板、不再跳回提示词库),含 3.24.37 内容 |
|
||||
| **v3.24.36** | `0434411` | 2026-11-02 | ✓ | 拖放落点就近吸附(空处不偏移、压住节点则贴到最近空位,20px 间隙)+ 承 34/35 的浮层避让与拖拽插入 |
|
||||
| **v3.24.35** | `7e83fb4` | 2026-11-02 | — | 插件可「拖到画布上松手」建节点:宿主开放 `screenToWorld`,`createImageNode` 支持显式坐标(插件 style-source 1.2.0) |
|
||||
| **v3.24.34** | `141e487` | 2026-11-02 | — | 新增节点避开浮层:`.iwb-fullmask` / `.iwb-wsrail` / `.iwb-lib` 当禁区,不再插到插件面板底下 |
|
||||
| **v3.24.33** | `a855145` | 2026-11-01 | ✓ | 提示词放大编辑(所见即所得)+ 气泡并入分组 + 图标统一 |
|
||||
| **v3.24.32** | `6d1079e` | 2026-11-01 | ✓ | 工具栏新增节点落在当前视口中心 |
|
||||
| **v3.24.31** | `afe1de3` | 2026-11-01 | ✓ | 背景色交互重做(悬停预览 / 点击确认)+ 画布细节统一 |
|
||||
| **v3.24.30** | `74a5c18` | 2026-11-01 | ✓ | 节点背景色(8 色 · 三入口 · 同色系内层 · 亮/暗两套配色) |
|
||||
| **v3.24.29** | `774310d` | 2026-10-31 | ✓ | 组内多选不再显示「编组」+ 编组/解组换文件夹图标 + 组框留白 28、圆角 18 |
|
||||
| **v3.24.22** | `de69761` | 2026-10-31 | ✓ | 文档事实数据全量校准(无功能变更):健康表/钉点/覆盖率/测试数按实测重写 + 棘轮上限按实测收紧 |
|
||||
| **v3.24.21** | `9566171` | 2026-10-31 | ✓ | 插件面板切 tab 串页修复 + 资源中心标题栏尺寸显示移除 |
|
||||
| **v3.24.20** | `44ab72a` | 2026-10-31 | ✓ | 模型设置面板重做 + 图库参考图修复 + 组合分隔符/文本入口恢复 |
|
||||
| **v3.24.19** | `3f8ad60` | 2026-10-30 | ✓ | 节点图标更新 + 文本节点屏蔽 + 气泡贴合标题 |
|
||||
| **v3.24.18** | `ad42b7a` | 2026-10-30 | ✓ | 「生图」改名「配置」+ 服务商/分组收进「模型设置」面板 |
|
||||
| **v3.24.17** | `01025d1` | 2026-10-30 | ✓ | 图标按钮统一显示 2 字功能名(气泡/底栏/节点卡)+ 插件 appliesTo 收口到 ref |
|
||||
| **v3.24.16** | `a3fbdc3` | 2026-10-29 | ✓ | 备份区去掉外框 + 入口收敛到设置面板(另两处菜单入口移除)|
|
||||
| **v3.24.15** | `8198e6d` | 2026-10-29 | ✓ | 备份还原并入设置面板 + 修复设置/Key/模型还原不回来 |
|
||||
| **v3.24.14** | `a8f35e0` | 2026-10-29 | ✓ | 补 app.js/Workbench 行数棘轮 + 落位规则(防结构回潮)|
|
||||
| **v3.24.13** | `b7d8bee` | 2026-10-29 | ✓ | 再搬 6 个 Workbench 逻辑单元(app.js −262 行)|
|
||||
| **v3.24.12** | `e9642cc` | 2026-10-29 | ✓ | Workbench 逻辑单元搬出(runNode/saveNow;app.js −449 行)|
|
||||
| **v3.24.11** | `df4f360` | 2026-10-29 | ✓ | renderBodyInner 瘦身(app.js −579 行,行为零变化)|
|
||||
| **v3.24.10** | `988ebbb` | 2026-10-29 | ✓ | 源码钉点换行为断言(app53 756→709,行为零变化)|
|
||||
| **v3.24.9** | `2516738` | 2026-10-29 | ✓ | 移除「批量设置」(入口隐蔽且有选区被清空缺陷);死代码清理;5 个模块补 e2e |
|
||||
| **v3.24.8** | `d4b9e77` | 2026-10-28 | ✓ | 移除 Tab 循环界面模式(会隐藏标签栏/工具栏,误按即像界面坏了)|
|
||||
| **v3.24.7** | `2ce8ece` | 2026-10-28 | ✓ | 修复「标签栏/底栏消失且刷新不回来」(uiMode 不再持久化);清理 9 个未使用模块(377 行)|
|
||||
| **v3.24.6** | `e41aab6` | 2026-10-28 | ✓ | 结构重构:`app.js` 12,477→10,603(−15.0%);7 步搬迁各带等价证明;修 3 个真实 ReferenceError;新增组件行数棘轮 |
|
||||
| **v3.24.5** | `36e3f3e` | 2026-10-28 | ✓ | `Workbench()` −82 行;resume 变体过滤抽纯函数+穷举单测(锁住重复扣费);**e2e 产出覆盖率 → app.js 57.7%** |
|
||||
| **v3.24.4** | `a6d1e11` | 2026-10-28 | ✓ | 依赖安全修复(audit 2 high→0)+ 覆盖率 28.3%→34.1%(**业务代码零改动**) |
|
||||
| **v3.24.3** | `1b3ffcb` | 2026-10-28 | ✓ | 修复空备份 ZIP 无法解析(校验保留);附 `Workbench()` 拆分前置调研文档 |
|
||||
| **v3.24.2** | `da24ffa` | 2026-10-28 | ✓ | 内部重构第二批:任务图回溯族 + ZIP 读写族(12 个成员外置;**备份链路首次纳入自动化保护**) |
|
||||
| **v3.24.1** | `2040193` | 2026-10-28 | ✓ | 内部重构:拆 app.js 巨石第一批(16 个纯函数外置,**零行为变化**) |
|
||||
| **v3.24.0** | `705b1f0` | 2026-10-20 | ✓ | 图库插入画布不塞整图 base64;刷新后双击可打开 |
|
||||
| v3.23.0 | `e129398` | 2026-10-20 | ✓ | 资源中心交互优化 5 项 |
|
||||
| v3.22.0 | `0581261` | 2026-10-20 | ✓ | 缩放手柄「隐形但可拖」+ 标题栏尺寸 |
|
||||
| v3.21.0 | `7530b31` | 2026-10-20 | ✓ | 移除 Pinterest + Pages Function 补安全头 |
|
||||
| v3.20.2 | `857908f` | 2026-10-19 | ✓ | 图片节点缩略图消失修复 |
|
||||
| v3.20.1 | `0831d08` | 2026-10-19 | ✓ | — |
|
||||
|
||||
**特殊标签**:
|
||||
|
||||
| 标签 | 指向 | 含义 |
|
||||
|---|---|---|
|
||||
| `stable-v3.24.85` | 同 `stable` | 固定在 v3.24.85 的稳定标记(**当前回滚点**,commit `7df9dc4`) |
|
||||
| `stable-verified-2026-11-16` | 同 `stable` | 「某天在线上实测通过」的留痕(该日已移到 v3.24.85) |
|
||||
| `stable-v3.24.84` | `c8b7543` | 上一版(回滚点) |
|
||||
| `stable-verified-2026-11-14` | `c8b7543` | 「某天在线上实测通过」的留痕(当日移到 v3.24.84) |
|
||||
| `stable-v3.24.80` | `2d584a6` | 上一版(回滚点) |
|
||||
| `stable-v3.24.79` | `8598a57` | 上一版(回滚点) |
|
||||
| `stable-verified-2026-11-12` | `8598a57` | 「某天在线上实测通过」的留痕(当日移到 v3.24.79) |
|
||||
| `stable-v3.24.78` | `aaa9112` | 上一版(回滚点) |
|
||||
| `stable-v3.24.76` | `e660a75` | 上一版(回滚点) |
|
||||
| `stable-v3.24.40` | 同 `stable` | 固定在 v3.24.40 的稳定标记 |
|
||||
| `stable-verified-2026-11-03` | 同 `stable` | 「某天在线上实测通过」的留痕(本日已移到 v3.24.40) |
|
||||
| `stable-v3.24.38` | `b3fe448` | 固定在 v3.24.38 的稳定标记(上一回滚点) |
|
||||
| `stable-v3.24.36` | `0434411` | 固定在 v3.24.36 的稳定标记 |
|
||||
| `stable-verified-2026-11-02` | `0434411` | 「某天在线上实测通过」的留痕 |
|
||||
| `stable-v3.24.17` | `01025d1` | 固定在 v3.24.17 的稳定标记 |
|
||||
| `stable-verified-2026-10-30` | `01025d1` | 「某天在线上实测通过」的留痕 |
|
||||
| `stable-v3.24.16` | `a3fbdc3` | 上一版(回滚点) |
|
||||
| `stable-v3.24.15` | `8198e6d` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.14` | `a8f35e0` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.13` | `b7d8bee` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.12` | `e9642cc` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.11` | `df4f360` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.10` | `988ebbb` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.9` | `2516738` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.8` | `d4b9e77` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.7` | `2ce8ece` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.6` | `e41aab6` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.5` | `36e3f3e` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.4` | `a6d1e11` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.3` | `1b3ffcb` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.2` | `da24ffa` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.1` | `2040193` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.0` | `705b1f0` | 更早一版(回滚点) |
|
||||
|
||||
---
|
||||
|
||||
## 2. ⚠️ 一个必须知道的惯例:tag 与「部署提交」差 1 个
|
||||
|
||||
**v3.24.0 的例子**:
|
||||
|
||||
```
|
||||
047fae5 release: v3.24.0 ← 线上实际部署的是这个
|
||||
705b1f0 docs(changelog): v3.24.0 发布记录… ← tag v3.24.0 指向这个
|
||||
```
|
||||
|
||||
**这是项目既定流程**(先 bump → 部署 → 再写 CHANGELOG → 打 tag)。
|
||||
**已实测验证:两者的运行时代码逐字节一致**:
|
||||
|
||||
```
|
||||
app.js ✓ 完全一致 (blob 05ae6c5d)
|
||||
style.css ✓ 完全一致 (blob b93e54c0)
|
||||
package.json ✓ 完全一致 (blob 984d11c6)
|
||||
src/ 整个树 ✓ 完全一致 (tree 7dd44626)
|
||||
两个 commit 的差异只有:CHANGELOG.md、docs/standards/architecture-current-state.md
|
||||
```
|
||||
|
||||
⇒ **回滚到 `v3.24.0` 重建产物 = 线上那份代码**。这个结论对每个版本都成立(tag 只在文档提交上)。
|
||||
|
||||
### 2.1 ✅ 还原演练(2026-10-27 对 v3.24.0 实做,方法对每个版本通用)
|
||||
|
||||
用**临时 git worktree** 在 `v3.24.0` tag 上独立重建,再与**线上实际产物**比对:
|
||||
|
||||
```bash
|
||||
git worktree add /tmp/iwb-rb v3.24.0
|
||||
cd /tmp/iwb-rb && node scripts/build.js # 从 tag 重建
|
||||
curl -fsSL https://iwb.maqiart.eu.org/app.js -o /tmp/live-app.js
|
||||
# 归一化两处「必然不同」的内容后再比:
|
||||
# ① 首行 banner(含各自 commit SHA)
|
||||
# ② APP_VERSION 常量(build 会注入 vX.Y.Z+<commit>)
|
||||
```
|
||||
|
||||
| 产物 | 从 tag 重建 | 线上生产 | 结论 |
|
||||
|---|---|---|---|
|
||||
| `app.js`(归一化后) | `d4cb39ea2268a1df` | `d4cb39ea2268a1df` | ✅ **逐字节一致** |
|
||||
| `style.css` | `d8f551e9a48f32ae` | `d8f551e9a48f32ae` | ✅ **逐字节一致** |
|
||||
|
||||
> 唯一差异是 build 注入的 `APP_VERSION`(`v3.24.0+705b1f0` vs `v3.24.0+047fae5`)——
|
||||
> 那是**版本标记**,不是代码逻辑;部署后的 `version.json` 也会如实反映当前 commit。
|
||||
|
||||
**结论:还原是真的可行,已实测**。以后出问题可按 §3 场景 A 直接操作。
|
||||
|
||||
---
|
||||
|
||||
## 3. 还原操作(按场景选一种)
|
||||
|
||||
### 场景 A:线上出问题,要退回上一个版本(最常见)
|
||||
|
||||
```bash
|
||||
cd ~/open/github/image-workbench-web
|
||||
|
||||
# 1) 看清要退到哪一版
|
||||
git tag --list 'v3.*' | tail -10
|
||||
git log --oneline -5 # 确认当前
|
||||
|
||||
# 2) 退到目标版本的**代码**
|
||||
git checkout v3.23.0 # 或 stable / stable-v3.24.0
|
||||
|
||||
# 3) 重建并部署(注意:仅 checkout 不会改线上,必须部署)
|
||||
git checkout vX.Y.Z # 回到目标版本提交
|
||||
npm ci
|
||||
npm run verify:ci # 确认这一版的门禁是绿的
|
||||
npm run deploy # 部署到正式站
|
||||
|
||||
# 4) 核验(三地址一致 + 可恢复)
|
||||
IWB_VERIFY_STRICT=1 node scripts/verify-release.js
|
||||
bash scripts/publish-update.sh # 重新构建并把 latest.json 指回该版本
|
||||
```
|
||||
|
||||
> ⚠️ 本项目已转桌面客户端:**不再用 `wrangler pages deploy`**,发版走 `./scripts/publish-update.sh`(macOS)/ `./scripts/publish-windows-update.sh`(Windows)。
|
||||
> 回滚时**不要**把旧代码 push 到 main(会污染历史);用 `checkout` 部署即可,
|
||||
> 部署完 `git checkout main` 回到主干。
|
||||
## 回滚(Windows)
|
||||
|
||||
### 场景 B:干活把 main 弄坏了,要回到「上次稳定」
|
||||
1. Windows 端 `git checkout vX.Y.Z` 后重新构建 setup.exe
|
||||
2. 放 NAS `_inbox/`,mac 端 `publish-windows-update.sh` 重签
|
||||
3. 再跑 `publish-update.sh` 合并 latest.json
|
||||
|
||||
```bash
|
||||
git log --oneline stable..main # 看看稳定之后多了什么
|
||||
git checkout stable # 或:git reset --hard stable(会丢本地改动,慎用)
|
||||
```
|
||||
|
||||
> `stable` = `909691f`(v3.24.0 生产等价点)。
|
||||
|
||||
### 场景 C:只想看某个版本改了什么 / 找回被删的代码
|
||||
|
||||
```bash
|
||||
git show v3.24.0 --stat # 该版本改动的文件
|
||||
git show v3.24.0:app.js | grep -n "wLog" # 找回某个版本的代码片段
|
||||
git diff v3.23.0 v3.24.0 -- app.js # 两版之间的代码差异
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. 版本记录完整性审计(2026-10-27,诚实记录)
|
||||
|
||||
| 记录源 | 数量 | 说明 |
|
||||
|---|---|---|
|
||||
| `CHANGELOG.md` 的 `## vX.Y.Z` 条目 | **70** | 每版的改动说明 |
|
||||
| git tag(`vX.Y.Z` 形式) | **125** | 可 checkout 的版本点 |
|
||||
| GitHub Release | **67** | 带说明的发布页 |
|
||||
|
||||
**结论:近期版本(v3.20.1 → v3.24.0)三方齐全 ⇒ 还原能力完整。** 历史上有以下不对齐:
|
||||
|
||||
| 不对齐项 | 数量 | 影响 |
|
||||
|---|---|---|
|
||||
| 有 tag、但 CHANGELOG 无对应 `## v` 条目 | 68 | 多为 `3.8x` 历史线/测试迭代版本;**仍可 checkout 还原**,只是没有文字说明 |
|
||||
| CHANGELOG 有、但没有 tag | 13 | `v3.83.0` / `v3.84.x` / `v3.85.x` / `v3.86.x` / `v3.87.x` 等 —— 当时是"测试迭代、已并入后续版本",未单独打 tag |
|
||||
| CHANGELOG 有、但没有 GitHub Release | 17 | 同上 + `v3.0.2` / `v3.81.x` / `v3.82.0` |
|
||||
|
||||
> **这些不打算回补**(历史版本早已下线,补 tag 无法验证"当时线上跑的确实是它")。
|
||||
> 记录在此是为了:以后要还原很久以前的版本时,**知道哪些有精确锚点、哪些只能靠 CHANGELOG 文字定位**。
|
||||
|
||||
### 4.1 tag 同步状态
|
||||
|
||||
```
|
||||
本地 tag: 386 / 远端 tag: 386 / 差: 0 ✅ 2026-10-27 已把 4 个本地独有的 tag 推送上去
|
||||
```
|
||||
|
||||
> 此前有 4 个只在本机(`v3.1.0-mt-pre-S1` / `v3.86.4-pre-panelfix` / `v3.86.5-pre-panelship` /
|
||||
> `v3.86.5-pre-panelui`)—— 本机故障就会丢标签名(commit 虽在 main,但恢复不了"这个 tag 曾指向谁")。
|
||||
> 已推送消除单点风险。
|
||||
|
||||
---
|
||||
|
||||
## 5. 安全性兜底(为什么"能还原"不是靠自觉)
|
||||
|
||||
项目有**两道机制**保证线上代码永远可恢复:
|
||||
|
||||
1. **推 main 需要口令**:`RELEASE=1 git push origin main`(本地 pre-push 钩子拦截误推)
|
||||
2. **部署后严格核验**:`IWB_VERIFY_STRICT=1 node scripts/verify-release.js`
|
||||
—— 校验「线上 commit 必须是 `origin/main` 的祖先」。
|
||||
若不满足(即部署了本机独有、未推送的代码),**直接退出码 1 报错**。
|
||||
|
||||
> 这条机制挡过真事故:`npm run deploy` 不含 git push,
|
||||
> 曾经出现过"部署了只存在于本机的代码" ⇒ 本机故障就永久丢失线上代码。
|
||||
|
||||
---
|
||||
|
||||
## 6. 每次发版要维护的记录(清单)
|
||||
|
||||
发完一个版本,确认这 5 项都做了:
|
||||
|
||||
- [ ] `package.json` 版本已 bump(`npm version X.Y.Z --no-git-tag-version`)
|
||||
- [ ] **事实基线锚点已同步**(`architecture-current-state.md` 第 4 行 `main = <SHA>`;否则 `test:facts` 打红)
|
||||
- [ ] `CHANGELOG.md` 已写该版本条目(含部署后的 `version.json` 实际值)
|
||||
- [ ] 四个标签已打并推送:`vX.Y.Z` / `stable-vX.Y.Z` / `stable`(移动)/ `stable-verified-YYYY-MM-DD`
|
||||
- [ ] `gh release create vX.Y.Z` 已建(带说明)
|
||||
|
||||
---
|
||||
|
||||
## 7. 快速参考卡
|
||||
|
||||
```bash
|
||||
# 现在线上是什么
|
||||
curl -fsSL https://iwb.maqiart.eu.org/version.json
|
||||
|
||||
# 核验(三地址一致 + 可恢复)
|
||||
IWB_VERIFY_STRICT=1 node scripts/verify-release.js
|
||||
|
||||
# 回到某版本并部署
|
||||
git checkout v3.23.0 && npm ci && npm run verify:ci && npm run deploy
|
||||
IWB_VERIFY_STRICT=1 node scripts/verify-release.js
|
||||
git checkout main
|
||||
|
||||
# 看某版本改了什么
|
||||
git show v3.24.0 --stat
|
||||
|
||||
# 看两版代码差异
|
||||
git diff v3.23.0 v3.24.0 -- app.js
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 7. 重构期的分步还原(多提交改造时用这一节)
|
||||
|
||||
> 版本级还原(§1 的 tag 表)解决的是"线上跑回旧版"。
|
||||
> **重构期间更常见的是"某一步搬坏了,只想退这一步"** —— 用下面四层,从细到粗。
|
||||
|
||||
### 7.1 四层还原
|
||||
|
||||
| 层 | 手段 | 恢复时间 | 适用 |
|
||||
|---|---|---|---|
|
||||
| **1** | `git revert <单个提交>` | 秒 | 某一步搬错了,只退这一步,其他步保留 |
|
||||
| **2** | 步骤 tag:每步绿了就 `git tag refactor-step-N` | 秒 | 退回某个**已知好状态**继续 |
|
||||
| **3** | `git checkout stable-vX.Y.Z` 重部署 | 3–5 分钟 | 线上出问题,退回上个发布版 |
|
||||
| **4** | Cloudflare 部署历史切回旧 deployment | 1–2 分钟 | 连代码都不想动,直接切旧部署 |
|
||||
|
||||
```bash
|
||||
# 层 1:只退某一步(保留后续提交,最常用)
|
||||
git revert --no-edit <bad-commit>
|
||||
|
||||
# 层 2:退到某个已知好的步骤
|
||||
git log --oneline --decorate | head -20 # 找 refactor-step-N
|
||||
git checkout refactor-step-3
|
||||
|
||||
# 层 3:整体退回上个发布版
|
||||
git checkout stable-v3.24.5 && npm ci && npm run verify:ci && npm run deploy
|
||||
|
||||
# 层 4:看部署历史,用 dashboard 或 API 切回旧 deployment
|
||||
# 桌面端没有「线上部署列表」:版本清单在 NAS 的 /vol8/web/iwb-download/updates/
|
||||
```
|
||||
|
||||
### 7.2 铁律
|
||||
|
||||
1. **不用 `git reset --hard` / 不改写已推送历史** —— 一律 `git revert`,历史可查
|
||||
2. **一步一提交**,一个组件/一个函数一次提交,message 写清"搬了什么、依赖宽度、怎么验证的"
|
||||
3. 每步绿了就打 `refactor-step-N` tag(**成本零,收益极高**)
|
||||
4. 重构期间 **`main` 始终可发布**(用分支做,绿了再合)
|
||||
|
||||
### 7.3 纯搬移的"等价证明"
|
||||
|
||||
纯搬移(把函数/组件从 A 文件搬到 B 文件、不改逻辑)可以用工具**证明**等价:
|
||||
|
||||
```bash
|
||||
node scripts/verify-move.js --from <搬之前的提交> --name <函数名> --to <目标文件>
|
||||
# ✓ 搬家等价 → 逐字(或仅空白差异)相同,只搬没改
|
||||
# ✗ 搬家不等价 → 打印首个差异行
|
||||
```
|
||||
|
||||
配合 `verify:ci` + `e2e 115` + `coverage:e2e 不降`,三者一起构成"搬移"的完整证据链。
|
||||
桌面发布规范:[`docs/WIN_BUILD_SPEC.md`](WIN_BUILD_SPEC.md);工程规则 §13.60。
|
||||
@@ -9,6 +9,14 @@
|
||||
|
||||
win 构建 setup.exe → win 自测通过 → 把 setup.exe 放到 NAS `_inbox/` → 通知 mac 端 → mac 签名 + 上传 + 登记 → win 用户可更新。
|
||||
|
||||
## 0.1 版本与 CRLF(2026-11-24 教训,v3.26.54/55)
|
||||
|
||||
- **版本号只认 `package.json`**:`node -e "console.log(require('./package.json').version)"`;文档里写死的版本一律视为历史示例。
|
||||
- 拉取 `gitea/main` 后先跑 `npm run tokens:check`,再 `npm run app:build`。
|
||||
- 若报 `src/design-tokens.css 与 derive() 不一致`:**先怀疑 Windows 检出把 CSS 转成了 CRLF**,不要直接 `tokens:write`。校验层(`gen-tokens.js` + `build.js`)自 v3.26.55 起已归一 `\r\n`;仍失败时把**第一处差异行**原样发回 mac 端。
|
||||
- `.gitattributes` 的 `eol=lf` 只影响**新检出**,不会自动 renormalize 已存在工作区——所以不能只靠它。
|
||||
- 不要改 `scripts/build.js` / `gen-tokens.js` 来绕过;构建脚本属于 mac 源码,改动先同步 mac 端。
|
||||
|
||||
**win 端永远不要自己签名。** 私钥只在 mac 的 `~/.config/iwb-updater.key`。win 自己签出来的 `.sig` key ID 与项目公钥不配对,客户端会拒绝安装(v3.25.31 发布时已踩过一次,win 放上来的临时 `.sig` 被 mac 端忽略重签)。
|
||||
|
||||
---
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
> ⚠️ **版本号以 `package.json` 为准**(下文的 3.25.1 仅为历史示例,不要照抄)。Windows 打包的现行权威流程见 `docs/WIN_BUILD_SPEC.md`;本文保留细节步骤供参考。
|
||||
|
||||
# Windows 出包步骤(手把手)
|
||||
|
||||
> **本版要打的版本:3.25.1**(仓库里已经是这个号,直接构建,不要再改)
|
||||
>
|
||||
> 确认命令:node -e "console.log(require('./package.json').version)" → 应输出 3.25.1
|
||||
>
|
||||
> 产物名:image-workbench_3.25.1_x64-setup.exe / image-workbench_3.25.1_x64_en-US.msi
|
||||
|
||||
> 目标:在一台 Windows 机器上,从 Gitea 拉代码 → 打出安装包 → 自测 → 把产物回传到 NAS。
|
||||
|
||||
## 0. 前置检查
|
||||
|
||||
- Windows 10 1803+ 或 Windows 11,**x64**
|
||||
- 磁盘 ≥ 5 GB 空闲(Rust 编译产物较大)
|
||||
- 有本地管理员权限(装 Visual Studio Build Tools 需要)
|
||||
|
||||
## 1. 安装工具链(一次性)
|
||||
|
||||
| 工具 | 命令 / 说明 |
|
||||
|---|---|
|
||||
| Git | `winget install Git.Git` |
|
||||
| Node.js LTS(22) | `winget install OpenJS.NodeJS.LTS` |
|
||||
| Rust | `winget install Rustlang.Rustup` 然后 `rustup default stable-x86_64-pc-windows-msvc` |
|
||||
| **VS Build Tools 2022** | 勾选「**使用 C++ 的桌面开发**」(MSVC v143 + Windows SDK)——**最容易漏** |
|
||||
| WebView2 Runtime | Win11 自带;Win10 没有就装 Evergreen |
|
||||
|
||||
自检:
|
||||
|
||||
```powershell
|
||||
cd image-workbench-desktop
|
||||
powershell -ExecutionPolicy Bypass -File scripts\windows-check.ps1
|
||||
```
|
||||
|
||||
全部 `[OK]` 再做下一步。Rust 那行不能出现 `gnu`(必须 msvc)。
|
||||
|
||||
## 2. 取代码
|
||||
|
||||
```powershell
|
||||
git clone https://git.maqiart.eu.org/malongan/image-workbench-desktop.git # 公网(公开库)
|
||||
# 或内网/Tailscale:git clone http://192.168.100.185:3000/malongan/image-workbench-desktop.git
|
||||
```
|
||||
|
||||
建议放 `C:\work\image-workbench-desktop`(避开长路径/中文路径)。
|
||||
|
||||
## 3. 安装依赖
|
||||
|
||||
```powershell
|
||||
cd C:\work\image-workbench-desktop
|
||||
npm ci
|
||||
```
|
||||
|
||||
用 `npm ci`,不要 `npm install`。卡住就换 registry 或配代理。
|
||||
|
||||
## 4. 设版本号(三处必须一致)
|
||||
|
||||
```powershell
|
||||
node scripts/set-version.js 3.25.0
|
||||
```
|
||||
|
||||
同时改 `package.json` / `src-tauri/tauri.conf.json` / `src-tauri/Cargo.toml`。
|
||||
版本必须比线上大,否则以后接自动更新时客户端不认。
|
||||
|
||||
## 5. 出包
|
||||
|
||||
```powershell
|
||||
npm run app:build
|
||||
```
|
||||
|
||||
内部顺序:`lint → build → 剥离内置插件 → tauri build`(lint 不过就不出包,故意的)。
|
||||
|
||||
产物:
|
||||
|
||||
| 文件 | 用途 |
|
||||
|---|---|
|
||||
| `src-tauri\target\release\bundle\nsis\image-workbench_3.25.0_x64-setup.exe` | **主推**(当前用户安装,免管理员) |
|
||||
| `src-tauri\target\release\bundle\msi\image-workbench_3.25.0_x64_en-US.msi` | 企业环境用 |
|
||||
| `src-tauri\target\release\image-workbench.exe` | 免安装单文件(目标机需 WebView2) |
|
||||
|
||||
首次构建 5~15 分钟,之后增量 1~2 分钟。
|
||||
|
||||
## 6. 自测(必须过)
|
||||
|
||||
1. 安装 → 启动
|
||||
2. 数据目录生成:`%USERPROFILE%\Documents\ImageWorkbench`(data.json / canvases / library / images)
|
||||
3. 设置→通用:「数据库目录」路径正确,「打开」能弹资源管理器
|
||||
4. 关窗进程留托盘;左键托盘唤窗口;右键有菜单
|
||||
5. 设置→插件:**无内置插件**;市场列 7 个;装一个 → 重启后可用
|
||||
6. 画布新建/拖拽/缩放正常;导入图片正常
|
||||
7. 点「下载」→ 直接落到导出目录,不弹另存为
|
||||
|
||||
## 7. 把产物传回来
|
||||
|
||||
**A. 传 NAS(局域网/Tailscale)**
|
||||
|
||||
```powershell
|
||||
scp "src-tauri\target\release\bundle\nsis\image-workbench_3.25.0_x64-setup.exe" malongan@192.168.100.185:/vol8/web/iwb-download/updates/windows-x86_64/
|
||||
```
|
||||
|
||||
**B. 传 Gitea Releases**(公开库匿名可下载)
|
||||
|
||||
**C. 发我**:我上传 NAS 并更新 `releases.json` 与下载页
|
||||
|
||||
## 8. 常见错误
|
||||
|
||||
| 报错 | 原因 | 解决 |
|
||||
|---|---|---|
|
||||
| `link.exe not found` | 没装 VS Build Tools C++ 工作负载 | 重装并勾「使用 C++ 的桌面开发」 |
|
||||
| rustc 显示 `gnu` | 默认工具链错 | `rustup default stable-x86_64-pc-windows-msvc` |
|
||||
| `Windows SDK is not installed` | SDK 缺失 | Build Tools 勾 Windows SDK |
|
||||
| 启动报 WebView2 错误 | 缺运行时 | 装 Evergreen Runtime |
|
||||
| `npm ci` 超时/证书 | 网络 | 换 registry / 配 proxy |
|
||||
| 编译文件被占用 | 杀软扫描 target | 排除 `src-tauri\target` |
|
||||
| 路径过长 | 目录太深 | 放 `C:\work\`;`git config --system core.longpaths true` |
|
||||
| beforeBuildCommand lint 失败 | 代码有未定义变量 | 修代码,别绕过门禁 |
|
||||
|
||||
## 9. 当前状态
|
||||
|
||||
- **自动更新未启用**(updater 未装)⇒ Windows 包只能手动下载安装
|
||||
- 下载页 Windows 位置现在显示「暂未提供」;传回后我加一条 `windows-x86_64` 就自动出现
|
||||
- 插件不随包:新机器是零插件,需从市场装
|
||||
|
||||
## 10. 一句话流程
|
||||
|
||||
```
|
||||
装工具 → git clone → npm ci → node scripts/set-version.js x.y.z
|
||||
→ npm run app:build → 自测 7 条 → 传回 NAS/Gitea → 我更新下载页
|
||||
```
|
||||
@@ -0,0 +1,110 @@
|
||||
> ⚠️ **历史任务书(v3.25.15)**:所有写死的版本号/commit 都是当时示例。现行流程见 `docs/WIN_BUILD_SPEC.md`;执行前以 `package.json` 版本与 `git rev-parse HEAD` 为准。
|
||||
|
||||
# 任务:在 Windows 上为 image-workbench-desktop 构建 v3.25.15 安装包
|
||||
|
||||
你是这台 Windows 机器上的打包执行者。只做打包与自测,**不改业务代码**。
|
||||
|
||||
> ⚠️ v3.25.15 起的变化:项目已**彻底转桌面客户端**(`_headers` / `functions/` / `wrangler.toml` 已删除,`npm run deploy` 脚本已移除);
|
||||
> 更新清单**平台解耦**(Windows 用 `updates/latest-windows.json`,**由 Mac 侧用正式私钥生成,你不写**)。
|
||||
|
||||
## 硬性约束
|
||||
|
||||
1. 不改 `app.js` / `src/**` / `src-tauri/src/**` / `style.css` 的业务逻辑
|
||||
2. 不绕过 lint 门禁;报错就停下报告
|
||||
3. 不用 `npm install`,只用 `npm ci`;版本已定 **3.25.15**,不要改
|
||||
4. 不 commit / 不 push / 不打 tag / 不跑任何 `scripts/publish-*.sh`
|
||||
5. 不改 `src-tauri/tauri.windows.conf.json`(产物已锁 `nsis`,不要 msi)
|
||||
|
||||
## 第零步:拉代码
|
||||
|
||||
```powershell
|
||||
git fetch --all --tags; git checkout main; git pull --ff-only
|
||||
git rev-parse --short HEAD # 必须是 84c2c10 或其后代
|
||||
node -e "console.log(require('./package.json').version)" # 必须 3.25.15
|
||||
```
|
||||
|
||||
## 第一步:环境检查
|
||||
|
||||
```powershell
|
||||
node -v; npm -v; rustc -V; rustup show active-toolchain
|
||||
powershell -ExecutionPolicy Bypass -File scripts\windows-check.ps1
|
||||
```
|
||||
|
||||
全部 `[OK]` 才继续;出现 `[缺失]` 停止报告(不要自行安装)。
|
||||
|
||||
## 第二步:依赖
|
||||
|
||||
```powershell
|
||||
npm ci
|
||||
```
|
||||
|
||||
本次新增两个 Rust 插件依赖(single-instance / notification),首次构建会多拉一些 crate。
|
||||
|
||||
## 第三步:构建(用一次性临时密钥签名)
|
||||
|
||||
```powershell
|
||||
npx tauri signer generate -w "$env:TEMP\iwb-tmp.key" --password ""
|
||||
$env:TAURI_SIGNING_PRIVATE_KEY = Get-Content "$env:TEMP\iwb-tmp.key" -Raw
|
||||
$env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD = ""
|
||||
npx tauri build
|
||||
Remove-Item "$env:TEMP\iwb-tmp.key" -Force
|
||||
```
|
||||
|
||||
> 产出的 `.sig` 是临时密钥签的,**我会在 Mac 上用正式私钥重签**,你附上即可。
|
||||
|
||||
## 第四步:确认产物
|
||||
|
||||
```powershell
|
||||
Get-ChildItem src-tauri\target\release\bundle -Recurse -Include *.exe,*.sig | Select FullName,Length
|
||||
Get-FileHash "src-tauri\target\release\bundle\nsis\image-workbench_3.25.15_x64-setup.exe" -Algorithm SHA256
|
||||
Test-Path dist\plugins # 期望 False
|
||||
Test-Path _headers # 期望 False
|
||||
Test-Path functions # 期望 False
|
||||
```
|
||||
|
||||
## 第五步:自测清单(逐条报通过/失败)
|
||||
|
||||
**基础**
|
||||
1. 安装并启动;数据目录 `%USERPROFILE%\Documents\ImageWorkbench` 生成 `data.json`/`canvases`/`library`/`images`
|
||||
2. **`images\` 下必须有 `canvas` 文件夹**(v3.25.12 之前只有 `thumbs`,这是丢图根因)
|
||||
3. 设置 → 通用:数据库目录正确;「打开」能弹资源管理器
|
||||
4. 关窗口进程仍在托盘;左键唤出;右键有菜单
|
||||
|
||||
**图片持久化(历史 bug 复现点)**
|
||||
5. `Ctrl+V` 粘贴新图 → 出现图片节点
|
||||
6. **正常退出**(托盘右键退出,非强杀)→ 重开 → 图仍在、显示正常
|
||||
7. 从资源管理器拖图进画布 → 退出重开 → 图还在
|
||||
|
||||
**桌面壳(本次新增)**
|
||||
8. 单实例:连续双击两次 → 只有一个窗口,第二次聚焦已有
|
||||
9. 外链:点「项目主页」→ 用系统浏览器打开,应用不变(不能被导航成网页)
|
||||
10. 跑一次生图,完成后弹系统通知
|
||||
|
||||
**插件与 CSP(本次修复)**
|
||||
11. 设置 → 插件:无内置插件;市场能列 7 个;装一个 → 重启后可用
|
||||
12. **鲜艺抠图**:启用后对图片节点执行抠图 → **不应出现 `Failed to fetch`**(3.25.11 回归,3.25.14 已修)
|
||||
13. 若本机有 `XianyiAiRmbg` 监听 `0.0.0.0:30092` → 抠图出透明底;没装则注明跳过
|
||||
|
||||
**外观(本次新增)**
|
||||
14. 设置 → 外观:改画布底色(亮/暗)与主题色 → 立即生效,重启保持
|
||||
15. 亮暗切换时画布底色分别用两套值
|
||||
|
||||
任何一条失败:记录现象 + 截图后停止报告,**不要改代码**。
|
||||
|
||||
## 第六步:交付格式
|
||||
|
||||
```
|
||||
结论:成功 / 失败(卡在第 N 步)
|
||||
版本:3.25.15 commit=<sha>
|
||||
安装包:<路径> <大小> SHA256=<hex>
|
||||
环境:node= rust= VS= WebView2=
|
||||
自测:1✅ … 15✅(失败写 ❌ + 现象)
|
||||
耗时:
|
||||
```
|
||||
|
||||
产物留在本机;**不要**上传 NAS、**不要**写 `latest-windows.json`(我在 Mac 侧做)。
|
||||
|
||||
## 停止条件
|
||||
|
||||
commit 不对 / 环境缺件 / 构建报错一次重试无效 / 自测有失败 / 需要改业务代码 —— 遇到即停,
|
||||
报告「卡在哪一步 + 完整报错 + 已尝试过什么」。
|
||||
@@ -0,0 +1,107 @@
|
||||
> ⚠️ **历史文档(2026-11-24 复核)**:本文描述的是**旧网页版** Pages 部署流程,桌面版已不再使用 `deploy` / `deploy:test`。桌面版发布见 `docs/WIN_BUILD_SPEC.md` 与 `scripts/publish-update.sh` / `publish-windows-update.sh`。
|
||||
|
||||
# 📦 发布规则(每次 push 前必查)
|
||||
|
||||
> ⚠️ **时效说明(2026-10-15 复核)**:本文档为发布流程说明;**其中「稳定标签」一段已就地更正**(见文末)。当前事实以 [`docs/standards/architecture-current-state.md`](docs/standards/architecture-current-state.md) 与规范 §10/§12/§13.6 为准。
|
||||
> 复核确认的现行约束:发布**一律手动** `npm run deploy` / `npm run deploy:test`(**内含全量 `verify`,不得绕过**);本机**没有 wrangler OAuth 登录态**(`~/.config/.wrangler/config/` 为空,2026-10-31 复核),部署一律走 **API Token**(见「部署凭据」);三地址 `version.json` 必须一致;「部署成功」≠ 验收,须在**真实 URL** 跑关键 e2e。
|
||||
|
||||
## 红线(禁止入仓库)
|
||||
1. **`data/` 目录永不入库** —— 含 API Key 配置、生成图片和运行数据。
|
||||
2. **任何真实密钥/Token 不进任何文件** —— 代码只允许引用环境变量名或用户运行时输入。
|
||||
3. **不推日志、临时文件**(`*.log`、`.DS_Store`、`node_modules`、`dist`、`test-results`)。
|
||||
|
||||
## 隐私检查
|
||||
```bash
|
||||
grep -rn "sk-[A-Za-z0-9]\{20,\}" --include="*.js" --include="*.json" --include="*.md" . | grep -v "^./data/"
|
||||
grep -rn "/Users/\|/home/" --include="*.js" --include="*.json" --include="*.md" . | grep -v "^./data/"
|
||||
git grep -n "sk-" $(git rev-list --all)
|
||||
```
|
||||
|
||||
## 标准发布流程
|
||||
1. 在 `package.json` 递增 SemVer 版本;构建会自动生成 `v<package-version>+<7位Git SHA>`,并用 esbuild 压缩打包成单个 `dist/app.js`(`src/` 模块按序拼接进 `app.js`,`dist/` 无 `src/`)。
|
||||
> ⚠️ **bump 版本后必须同步「事实基线锚点」**(否则 `npm run test:facts` 会打红):
|
||||
> 把 `docs/standards/architecture-current-state.md` 第 4 行的 `基线 main = <SHA>` 改成**本次 bump 版本的提交**的 SHA、
|
||||
> `(线上 v<版本>+<SHA>)` 改成同一 SHA 与新版本号。守门第 7 组会校验这两项(规则见规则库 §13.36)。
|
||||
> 该提交前 SHA 可用:`git log --format=%h -- package.json` 里逐个回看、比对版本值与父提交是否相同(**不要**用 `git log -S '"version"'`,它会命中无关的旧提交)。
|
||||
2. 执行完整验证:
|
||||
```bash
|
||||
npm ci
|
||||
npm run verify
|
||||
```
|
||||
3. 检查 `dist/version.json`、`git diff --check` 和敏感信息扫描。`npm run verify` 已含 `node --check dist/app.js` 与 `node scripts/check-dist.js`(产物体检);`verify-release.js` 读 `/version.json`(不再抓 `app.js` 的 `APP_VERSION`,压缩会破坏该正则)。
|
||||
4. 提交并推送 + 打四类标签:
|
||||
```bash
|
||||
git add -A
|
||||
git commit -m "release: vX.Y.Z"
|
||||
git push origin main
|
||||
git tag -a vX.Y.Z -m "vX.Y.Z"
|
||||
git tag -a stable-vX.Y.Z -m "stable release vX.Y.Z"
|
||||
git tag -f stable HEAD && git push -f origin stable
|
||||
git tag -a stable-verified-$(date +%F) -m "stable-verified $(date +%F)"
|
||||
git push origin vX.Y.Z stable-vX.Y.Z stable-verified-$(date +%F)
|
||||
gh release create vX.Y.Z --notes-file <notes.md>
|
||||
```
|
||||
> ⚠️ **推 main 需确认口令**(免费版私有仓库无 GitHub 分支保护,靠本地 pre-push 钩子拦误推):
|
||||
> `RELEASE=1 git push origin main`。
|
||||
> **部署前必须确认 `git rev-parse HEAD` 已在 `origin/main` 中** —— 否则会部署一份**只存在于本机**的代码(见下方第 6 步)。
|
||||
5. 部署:**本仓库采用手动发布** —— `npm run deploy`(正式)/ `npm run deploy:test`(测试站)。CI(`.github/workflows/verify.yml`)只做 `verify` 门禁、**不自动部署**。
|
||||
> ⚠️ `npm run deploy` = `verify` + `wrangler pages deploy`,**不含 git push**。推送与部署是两步,顺序上先推后部署。
|
||||
6. 发布后验证(**三地址版本必须一致 + 线上代码必须可从远端恢复**):
|
||||
```bash
|
||||
IWB_VERIFY_STRICT=1 node scripts/verify-release.js # 三地址 version 一致 + 线上 commit 是 origin/main 的祖先
|
||||
curl -fsSL https://iwb.maqiart.eu.org/version.json
|
||||
```
|
||||
> **为什么必须用严格模式**(2026-10-20 实测事故):当天线上跑的是 `f414fd8`,而 `origin/main` 仍是 `7a48e4b` ——
|
||||
> 那 4 个 commit **不在任何远端 ref 上**。根因是 `npm run deploy` 不含 push,而本流程把 push 写在第 4 步 ——
|
||||
> **顺序没错,但没有校验「push 的 commit == 部署的 commit」是否真的成立**,于是部署了没推送的代码。
|
||||
> 后果:本机故障 / 误 reset ⇒ 线上正在跑的代码**永久丢失**,回滚只能退到 `stable`。
|
||||
> 严格模式把「事后才发现」变成「当场拦截」:线上 commit 必须是 `origin/main` 的祖先,否则报错退出码 1。
|
||||
> (不会误报 docs-only 提交:那种情况下线上 commit 是上一个**代码**提交,它仍在 `origin/main` 的历史里。)
|
||||
> 紧急修复必须先部署后 push 时,**push 必须在同一操作序列内立即完成**,并事后补跑严格模式核验。
|
||||
|
||||
## 部署凭据(2026-10-28 实测补全,2026-10-31 订正)
|
||||
|
||||
**本机没有 wrangler OAuth 登录态**(`~/.config/.wrangler/config/` 为空),
|
||||
此前文档写的「OAuth 会过期」已不适用 —— 部署**一律走 API Token 模式**:
|
||||
|
||||
```bash
|
||||
export CLOUDFLARE_API_TOKEN=$(security find-generic-password -a qiqi -s CLOUDFLARE_PAGES_TOKEN -w)
|
||||
# account id:见下方说明,二选一
|
||||
export CLOUDFLARE_ACCOUNT_ID="<32 位 hex>"
|
||||
npm run deploy:test # 测试站;正式站用 npm run deploy
|
||||
```
|
||||
|
||||
> ⚠️ **`npx` 必须带 `--yes`(2026-10-31 事故)**:`wrangler` 不在 devDependencies 里,
|
||||
> `npx wrangler` 依赖 npx 缓存;一旦 npm 上 `wrangler@latest` 超过缓存版本(如 4.114.0 → 4.156.0),
|
||||
> npx 会问「Need to install [email protected]? (y)」,**在 TTY(有人值守的终端)里会一直等输入**,
|
||||
> 表现为「`verify` 跑完了但部署卡住不动」。非 TTY 环境(多数 agent / CI)不提示、直接装,
|
||||
> 所以这个坑只在交互式终端复现。`package.json` 的 `deploy` / `deploy:test` 与
|
||||
> `scripts/plugins-publish.sh` 均已固定 `npx --yes wrangler`,**新增脚本请照抄**。
|
||||
|
||||
**account id 从哪来**(它**不是密钥**,是账号标识):
|
||||
|
||||
- 钥匙串和 `secrets list` 里**只有 token,没有 account id**;
|
||||
- `wrangler.toml` 里那个 32 位 hex 是 **KV namespace id**,不是 account id;
|
||||
- API `GET /client/v4/accounts` 对 Pages 作用域的 token 返回**空列表**(不等于 token 无效);
|
||||
- ✅ **可靠来源:git 历史里旧的 `wrangler.toml`**:
|
||||
|
||||
```bash
|
||||
git log --all --format=%H -S "account_id" -- wrangler.toml | tail -1 # 最早含它的提交
|
||||
git show <commit>:wrangler.toml | grep account_id # 读出 32 位 hex
|
||||
```
|
||||
|
||||
> 本次实测:account id 为 `47d69874…`(32 位 hex)。**建议把它存进钥匙串**:
|
||||
> `security add-generic-password -a qiqi -s CLOUDFLARE_ACCOUNT_ID -w '<id>'`
|
||||
> —— 这样以后不用每次翻 git 历史。
|
||||
|
||||
**验证 token 可用(只读,不部署)**:
|
||||
|
||||
```bash
|
||||
npx wrangler pages deployment list --project-name image-workbench-web
|
||||
```
|
||||
能列出部署记录 = token + account id 都正确。
|
||||
|
||||
## 回滚
|
||||
|
||||
> **权威还原步骤见 [`docs/RELEASES.md`](docs/RELEASES.md)**(含当前线上状态、各版本 tag→commit 对照、三种还原场景)。本节只作流程要点。
|
||||
**稳定标签(2026-10-15 更正)**:现行体系为 `vX.Y.Z`(GitHub Release)+ `stable-vX.Y.Z` + **移动可变 `stable`**(2026-10-15 指向 `682554d`)+ `stable-verified-YYYY-MM-DD`(验证留痕)。语义以规范 §10 与 [`docs/standards/architecture-current-state.md`](docs/standards/architecture-current-state.md) 为准;历史锚点示例:`stable-v3.1.0-stability3`、`stable-v3.3.0` 等。出现问题时可回滚到对应标签重新构建并发布,不覆盖历史。
|
||||
@@ -0,0 +1,433 @@
|
||||
> ⚠️ **历史文档(2026-11-24 复核)**:本文是旧网页版 Pages/测试站记录,不代表桌面版现状。桌面版版本记录见 `CHANGELOG.md`,发布/回滚见 `docs/WIN_BUILD_SPEC.md` 与 `docs/standards/engineering-rulebook.md` §13.60。
|
||||
|
||||
# 版本记录与还原(RELEASES)
|
||||
|
||||
> **用途**:出问题时**怎么快速、准确地还原**。这是还原的唯一权威入口。
|
||||
> **最后核对:2026-11-16** · 基线 `main = 7df9dc4`(v3.24.85 的文档提交,也是**正式站与测试站**实际运行提交;bump 提交是 `4be78c0`)| 三地址版本号一致 `v3.24.85`(`IWB_VERIFY_STRICT=1` 核验通过 ⇒ `stable` = `7df9dc4`)
|
||||
> **注意 `+commit` 后缀天然可以不同**:若发版后又有 docs-only 提交并重发,正式站与测试站的 `+commit` 会分叉(v3.24.84 时即正式站 `c8b7543` / 测试站 `7d6ff6c`);本版两者部署的是同一份 `dist/`,故后缀相同。
|
||||
> 一致性比较只看版本号,2026-11-14 已修 `verify-release.js`(此前用完整串比较,导致每次发版必误报)。
|
||||
> **v3.24.80 的正式发布延迟到 2026-11-14 07:20**:11-13 23:25 首次发布撞上 Cloudflare 官方事故(**Workers API availability**,Pages 全系 API 返回 `503 no healthy upstream`),连续 20+ 次重试均失败;期间正式站**保持 `v3.24.79+8598a57` 未动**,用户无感。API 恢复后用**同一份门禁通过的产物**(`v3.24.80+2d584a6`)补发,未重跑 e2e。
|
||||
>
|
||||
> 配套文档:[`CHANGELOG.md`](../CHANGELOG.md)(每版改了什么)· [`PUBLISHING.md`](../PUBLISHING.md)(怎么发版)
|
||||
|
||||
---
|
||||
|
||||
## 0. 现在的线上是什么?(30 秒确认)
|
||||
|
||||
```bash
|
||||
cd ~/open/github/image-workbench-web
|
||||
|
||||
# ① 线上实际在跑什么(三地址应一致)
|
||||
curl -fsSL https://iwb.maqiart.eu.org/version.json
|
||||
curl -fsSL https://image-workbench-web.pages.dev/version.json
|
||||
curl -fsSL https://test.image-workbench-web.pages.dev/version.json
|
||||
|
||||
# ② 一条命令做「三地址一致 + 线上代码可从 origin/main 恢复」双重核验
|
||||
IWB_VERIFY_STRICT=1 node scripts/verify-release.js
|
||||
```
|
||||
|
||||
**2026-11-16 实测结果(v3.24.85 · 代码体检收口)**:
|
||||
|
||||
| 地址 | 版本 |
|
||||
|---|---|
|
||||
| `https://iwb.maqiart.eu.org`(正式/自定义域名) | `v3.24.85+7df9dc4` |
|
||||
| `https://image-workbench-web.pages.dev`(正式) | `v3.24.85+7df9dc4` |
|
||||
| `https://test.image-workbench-web.pages.dev`(测试) | `v3.24.85+7df9dc4` |
|
||||
|
||||
✅ **三地址一致** `v3.24.85+7df9dc4`,`IWB_VERIFY_STRICT=1` 核验「线上代码可从 `origin/main` 恢复」通过。
|
||||
本版测试站与正式站部署的是**同一份 `dist/`**(`7df9dc4`),故三地址 `+commit` 后缀也相同。
|
||||
上一版 v3.24.84 = 正式站 `v3.24.84+c8b7543` / 测试站 `v3.24.84+7d6ff6c`(后缀分叉是因为发版后又有一个 docs-only 提交并重发了测试站)。
|
||||
(`verify-release.js` 于 2026-11-14 修过一次:旧实现比较完整串,于是每次 docs-only 提交后发版都误报「三地址不一致」。)
|
||||
|
||||
---
|
||||
|
||||
**2026-11-14 实测结果(v3.24.80 · 兜底保存 rev 修复)**:
|
||||
|
||||
| 地址 | 版本 |
|
||||
|---|---|
|
||||
| `https://iwb.maqiart.eu.org`(正式/自定义域名) | `v3.24.80+2d584a6` |
|
||||
| `https://image-workbench-web.pages.dev`(正式) | `v3.24.80+2d584a6` |
|
||||
| `https://test.image-workbench-web.pages.dev`(测试) | `v3.24.80+2d584a6` |
|
||||
|
||||
✅ **三地址一致** `v3.24.80+2d584a6`,`IWB_VERIFY_STRICT=1` 核验「线上代码可从 `origin/main` 恢复」通过。
|
||||
正式站产物 `app.js` 的 SHA-256 与本地 `dist/app.js` 一致(`6308e5b8…`)⇒ 线上跑的就是这次构建。
|
||||
(核验时 `image-workbench-web.pages.dev` 首轮报 TLS 握手断开,重试一轮即收敛 —— `pages.dev` 首轮抖动是该地址的已知现象。)
|
||||
|
||||
正式站本次从 `v3.24.79` 到 `v3.24.80`(单版)。本次改动(相对 v3.24.79):
|
||||
修「离开页面的兜底保存不递增 rev」——`flush()`(`beforeunload` / `pagehide` / `visibilitychange`)原先把
|
||||
**旧 rev 原样写回**,而其它标签页靠轮询 rev 变化判断同步,rev 不动 ⇒ A 标签关闭/切后台前的最后一次修改
|
||||
对 B 标签不可见,下一秒就被 B 的保存洗掉;改成 `((read().rev || 0) + 1)`,与标准保存路径 `wApi('workspaces')`
|
||||
的 `prev.rev + 1` 对齐。另删死代码 `createWBFlushViewport`(17 行,全仓无调用)与根目录误提交的空文件 `0`。
|
||||
本次**不做**的三项及其实测依据见 `BACKLOG §4.5`(autoGrow 强制布局实测 68→67ms 无收益、OUT_KEY 竞态诊断有误、
|
||||
`renderBody` 1,600 次查无实据)。
|
||||
|
||||
(v3.24.79 发版记录 · 上一版)正式站从 `v3.24.78` 到 `v3.24.79`(单版):
|
||||
用户报「设置 → 生图服务 → 服务器地址测速三个地址全 ✗ 失败」。四步定责后确认与服务、网络、Key 都无关:
|
||||
`POST /v1/images/generations` 有 `access-control-allow-origin`,而 `GET /v1/models` 的真实响应**一个 CORS 头都没有**
|
||||
(只有 `OPTIONS` 预检有)—— 测速打的是简单请求,**不触发预检**,响应无 ACAO 就被浏览器拦在读结果那步。
|
||||
改法:测速逻辑搬进 `src/generation-provider-ping.js`,分段判定「普通请求 → 失败退一次 `no-cors`」、
|
||||
**超时不重试**(否则 6s 变 12s 像卡死)、失败必须带原因;实测三地址 147 / 148 / 148ms。
|
||||
|
||||
(回滚点:`stable-v3.24.79` → `8598a57`、`stable-v3.24.78` → `aaa9112`。)
|
||||
|
||||
---
|
||||
|
||||
## 1. 近期版本对照表(可直接用来还原)
|
||||
|
||||
> **未单独打 tag 的版本**:`v3.24.45`(撤回位图转矢量、收回 `wasm-unsafe-eval`,`f9c2211`)与
|
||||
> `v3.24.46`(位图转矢量 v0.2 换 potrace,`23065d2`)**只发过测试站、从未打 tag**,
|
||||
> 其内容已包含在 `v3.24.47`(`7ef8141`)内 ⇒ 还原到 v3.24.47 即等于包含这两版。
|
||||
> 同理 `v3.24.37` ⊂ `v3.24.38`、`v3.24.39` ⊂ `v3.24.40`、`v3.24.34`/`v3.24.35` ⊂ `v3.24.36`。
|
||||
> **2026-11-06 补齐**:表中新增 `v3.24.30/31/32/41`(此前有 tag、有 Release,但表里缺行 —— 会让人以为无法还原)。
|
||||
> **2026-11-09 补齐**:表中新增 `v3.24.50~55/57/58`(此前有 tag、有 Release,但表里缺行);
|
||||
> `v3.24.56`(`ce2845d`)与 `v3.24.59`(bump `77154ac`,测试站试色版)**未打 tag**,
|
||||
> 内容分别并入 `v3.24.57` 与 `v3.24.60` ⇒ 还原到后一版即等于包含它。
|
||||
> **2026-11-11 补齐**:表中新增 `v3.24.61~63`(此前有 tag、有 Release,但表里缺行);
|
||||
> `v3.24.64`(bump `2d83a13`)**未单独打 tag**,测试站验收时发现问题,内容并入 `v3.24.65`。
|
||||
> **2026-11-11 二次发布**:`v3.24.68`/`v3.24.69` 先在测试站验收、**补打了 tag**(`63493b2`/`e4cb049`),
|
||||
> 三版一起由 `v3.24.70` 上正式站 ⇒ 还原到 `v3.24.70`(`a3dfad5`)即等于包含 68/69 的全部内容。
|
||||
> **2026-11-12 六版合并发布**:`v3.24.71~75` 先在测试站验收、各有 tag 与 GitHub Release,
|
||||
> 六版一起由 `v3.24.76` 上正式站 ⇒ 还原到 `v3.24.76`(`e660a75`)即等于包含 71~75 的全部内容。
|
||||
|
||||
| 版本 | tag → commit | 发布日期 | GitHub Release | 说明 |
|
||||
|---|---|---|---|---|
|
||||
| **v3.24.85** | `7df9dc4`(线上实际运行;bump 提交 `4be78c0`) | 2026-11-16 | ✓ | 代码体检收口(不改可见行为):① 棘轮收回 `Workbench()` 3,090→**2,998**、上限降到 **3,030**(留 32 行余量)—— 生成取消族与工作区列表写回族搬进 `src/runtime-workbench-logic.js`,删零调用的死代码 `runAll`;② 图库索引 4 条**绕过门面锁**的写路径(`imageFolderSync` / `storeOutputThumb.idxSet` / 备份 `restore` / `wPurgeOutputOriginals`)收口到新增的 `mutate(fn)`,治「两个标签页同时归档 ⇒ 图库莫名少条目」;③ 文档数字校准(线上版本、app.js 行数/占比、模块数、单测数、钉点数) |
|
||||
| **v3.24.84** | `c8b7543`(bump 提交 `5d0b169`) | 2026-11-14 | ✓ | 生图节点连了 3 条上游只出 1 个任务 ⇒ 任务身份改用 `ownerNodeId`(本节点自己,不随继承冒泡):连几条线就几个任务,`relay` 仍归约到真实文本来源(同一来源多路径抵达只算一次,防重复计费);任务标题兜底加 `data.name`。同批:任务卡标题统一「任务 N · 来源名」、`verify-release.js` 的三地址一致不再被 `+commit` 后缀误判 |
|
||||
| **v3.24.83** | `73748f7`(线上实际运行;bump 提交 `0a27a42`) | 2026-11-14 | — | ① 插件节点冷启动不再退化成一段文本:插件节点体是异步注册的,`registerNodeType` 在 `render` 由无变有时自增 `NODE_TYPES_REV`,`NodeCard` 比它 ⇒ 注册那一刻重建一次;`canvas-normalize` 按命名规则认作已知类型、不再降级写回存档(配套插件 `style-source` 1.3.2 改为脚本执行时注入样式)。② 画布底栏加「缩小 / 放大」两个图标(放在「适应」左边,一档 15%,锚点=画布中心),缩放数学抽成 `IWBCanvasGeometry.zoomStep` 纯函数与快捷键共用。③ 补记 v3.24.81/82 漏记的三处棘轮 |
|
||||
| **v3.24.82** | `ef6cf42` | 2026-11-14 | ✓ | 提示词/文本节点显示上游继承文本(自己 `data.text` 为空时显示上游那段话,改一个字即接管,另有「恢复跟随」);修 `nodeRefsOf` 的 textout 分支只认 llm/batch/combine 上游导致「样式 → 文本 → 分层」丢参考图 |
|
||||
| **v3.24.81** | `dba71e3` | 2026-11-14 | ✓ | 插件节点可自定义节点体(`render(node, props, host)` 画真实 DOM,宿主不每帧重建 ⇒ 输入框不失焦);节点自带参考图(`data.refOn/refUrl`);连线白名单按 `data.outKind === 'prompt'` 归一化 |
|
||||
| **v3.24.80** | `2d584a6`(线上实际运行;bump 提交 `9d77ec9`) | 2026-11-14 | ✓ | 离开页面的兜底保存不递增 rev:`flush()`(`pagehide` / `visibilitychange` / `beforeunload`)写回旧 rev ⇒ 其它标签页轮询看不到末次修改,A 标签关掉前的改动会被 B 的保存洗掉;改成 `((rev\|\|0)+1)` 对齐标准保存路径。另删死代码 `createWBFlushViewport`(17 行)与根目录误提交的空文件 `0`;e2e 补「rev 恰好 +1」断言(两条兜底路径) |
|
||||
| **v3.24.79** | `8598a57`(bump 提交 `9f49184`) | 2026-11-12 | ✓ | 服务器地址测速全红修复:服务端 CORS 只配在预检与生图 POST 上,`GET /models` 无 ACAO ⇒ 改「普通请求失败后退一次 `no-cors`」+ 超时不重试 + 失败带原因;`generation-provider-ping.js` + 29 条单测 |
|
||||
| **v3.24.78** | `aaa9112` | 2026-11-12 | ✓ | LOD 拆三档:15% 以上画代表图 / 首行文字,15% 以下才退成 CSS 占位(v3.24.77 一并上线);`lodModeOf` + 13 条判据断言 + 5 条 e2e |
|
||||
| **v3.24.77** | `0602388` | 2026-11-12 | ✓ | LOD 判据换成节点屏幕宽度:800 节点切画布 488 → 198ms、textarea 186 → 0;只发过测试站,内容包含在 v3.24.78 |
|
||||
| **v3.24.76** | `e660a75` | 2026-11-12 | ✓ | 钉点减法第二批:3 条 e2e 查出 3 个真缺陷(objectURL 从未释放 / 孤儿标签 session / 误回收打开标签的图);v3.24.71~75 一并上线 |
|
||||
| **v3.24.75** | `47f41aa` | 2026-11-12 | ✓ | 同图去重:内容哈希,同一张图连粘两次只建一个节点;只发过测试站,内容包含在 v3.24.76 |
|
||||
| **v3.24.74** | `ec1adb3` | 2026-11-12 | ✓ | 粘贴落点精确到像素(消掉 63px 偏移)+ 图片准入统一 `image-admit`;只发过测试站 |
|
||||
| **v3.24.73** | `9c8a5fd` | 2026-11-12 | ✓ | 静默失败收口:用户动作的失败必须有红色回执 + 规则库立规;只发过测试站 |
|
||||
| **v3.24.72** | `45aa6a0` | 2026-11-12 | ✓ | 钉点减法第一批:32 条源码钉点换成 DOM/运行时断言(537→505);只发过测试站 |
|
||||
| **v3.24.71** | `cc5c3e2` | 2026-11-12 | ✓ | app.js 总量棘轮改为双层预算(8,700 + 占比 40%)+ 覆盖率复算入档;只发过测试站 |
|
||||
| **v3.24.70** | `a3dfad5`(线上实际运行) | 2026-11-11 | ✓ | 修「复制粘贴突然不起作用」:焦点在节点输入框的两条静默通道;v3.24.68/69 一并上线 |
|
||||
| **v3.24.69** | `e4cb049` | 2026-11-11 | ✓ | 粘贴落点跟随鼠标(推翻 v3.24.68 的「不跟鼠标」);只发过测试站,内容包含在 v3.24.70 |
|
||||
| **v3.24.68** | `63493b2` | 2026-11-11 | ✓ | 统一剪贴板:Ctrl+C 同时写系统剪贴板,Ctrl+V 一个键管到底(含节点组);只发过测试站,内容包含在 v3.24.70 |
|
||||
| **v3.24.67** | `0f8d677`(线上实际运行) | 2026-11-11 | ✓ | 剪贴板语义收口(`Ctrl+V` 只认系统剪贴板 / 粘贴不下载 / 修 7 个静默缺陷)+ 积压四版合并上线 |
|
||||
| **v3.24.66** | `b247375` | 2026-11-11 | ✓ | 参考图准入统一收口:图库插入 / 图库拖入 / 拖入链接也把 SVG 转 PNG |
|
||||
| **v3.24.65** | `02cbd59` | 2026-11-11 | ✓ | 三处预览/图库下载后缀仍为 `.png` + SVG 复制到剪贴板必失败(含 `v3.24.64`:下载/归档后缀跟随真实格式) |
|
||||
| **v3.24.63** | `6c4a8aa` | 2026-11-10 | ✓ | 棘轮恢复零余量 + 文档口径统一(纯工程收尾,界面无变化) |
|
||||
| **v3.24.62** | `80f6b0c` | 2026-11-10 | ✓ | 测试安全网:设置 CRUD(e2e)+ 核心链路纯函数单测 |
|
||||
| **v3.24.61** | `7b02ccf` | 2026-11-10 | ✓ | 设置面板拆分(`SettingsModal` −54%)+ 存储写路径留痕 + 版本记录守卫 |
|
||||
| **v3.24.60** | `bff766d` | 2026-11-09 | ✓ | 节点气泡恢复删除按钮(单选 + 多选组气泡;静态灰 / hover 红,`Ctrl+Z` 可撤销)+ 两条防误删门禁改写 |
|
||||
| **v3.24.58** | `33b9dc4` | 2026-11-08 | ✓ | 数据一致性:多标签图库同步 + Web Locks 串行化 + 导入防原型污染 + 写失败留痕 |
|
||||
| **v3.24.57** | `3b0c652` | 2026-11-07 | ✓ | 存储可信度收尾:只读体检 + 一键安全回收 + 还原后校验 |
|
||||
| **v3.24.55** | `86a931f` | 2026-11-07 | ✓ | 数据安全收尾:导出备份提醒 + 配额可见 + 备份体积护栏 + 部署钉版 |
|
||||
| **v3.24.54** | `aa17527` | 2026-11-07 | ✓ | 持久化存储(`navigator.storage.persist`)+ 错误留痕 + PWA 可安装 + 自动备份 |
|
||||
| **v3.24.53** | `87ddf7b` | 2026-11-07 | ✓ | 开发体验与类型安全:事实同步器 + 统一源文本 + 渐进类型检查(`tsc --checkJs`) |
|
||||
| **v3.24.52** | `479695b` | 2026-11-07 | ✓ | `Workbench` 组件化收口(阶段一样板,−68 行) |
|
||||
| **v3.24.51** | `46981ec` | 2026-11-07 | ✓ | 工程质量专项:存储入口收敛 + e2e 去固定等待(纯内部重构,界面无变化) |
|
||||
| **v3.24.50** | `e28e1f4` | 2026-11-06 | ✓ | `Workbench` 拆分(累计 **−914 行**)+ 全仓健康度分析 |
|
||||
| **v3.24.49** | `61a0af9` | 2026-11-06 | ✓ | 拖动画布松手丢最后一小段位移(「平移末帧提交」原是死代码)+ 门禁补「加载期跨模块依赖顺序」守卫 |
|
||||
| **v3.24.48** | `f775dd5` | 2026-11-06 | ✓ | LLM 连不上:`normalizeEndpointBase` 剥掉 Base URL 里误粘的 `/chat/completions` 等接口路径(老配置自动纠正)+ 测试前提示未保存 |
|
||||
| **v3.24.47** | `7ef8141` | 2026-11-05 | ✓ | 内存专项:修掉「轮询同步自激重水合」(内容签名 + 12s 自保存窗口)+ 水合分批 |
|
||||
| **v3.24.44** | `33a94e0` | 2026-11-04 | ✓ | 输出图片顺序跟随任务卡(组序锚定任务顺序 + 组内按变体序号)+ 旧图排最后并标注 |
|
||||
| **v3.24.43** | `3af2a3b` | 2026-11-04 | ✓ | 复制节点右侧/下方就近让位(零重叠)+ 修 `refs.measuredH` 清空后永不回填 |
|
||||
| **v3.24.42** | `33a906a` | 2026-11-04 | ✓ | 任务行动效重做(一次性扫光 + 呼吸描边,删假进度条)+ 版本更新提示移到画布上方 |
|
||||
| **v3.24.41** | `a41ec2a` | 2026-11-03 | ✓ | 输出节点的图不再「自己掉」:结果精简落盘 + 只在断连时丢 |
|
||||
| **v3.24.40** | `037cda5` | 2026-11-03 | ✓ | 放大编辑:多级列表保真(不再拍平)+ 有序列表入口 + Tab 升降级 + 清除格式可 Ctrl+Z 撤销,含 3.24.39 的行距修复与工具条中文化 |
|
||||
| **v3.24.38** | `b3fe448` | 2026-11-03 | ✓ | 资源中心「开合 + 标签页」双持久化(刷新后不再关面板、不再跳回提示词库),含 3.24.37 内容 |
|
||||
| **v3.24.36** | `0434411` | 2026-11-02 | ✓ | 拖放落点就近吸附(空处不偏移、压住节点则贴到最近空位,20px 间隙)+ 承 34/35 的浮层避让与拖拽插入 |
|
||||
| **v3.24.35** | `7e83fb4` | 2026-11-02 | — | 插件可「拖到画布上松手」建节点:宿主开放 `screenToWorld`,`createImageNode` 支持显式坐标(插件 style-source 1.2.0) |
|
||||
| **v3.24.34** | `141e487` | 2026-11-02 | — | 新增节点避开浮层:`.iwb-fullmask` / `.iwb-wsrail` / `.iwb-lib` 当禁区,不再插到插件面板底下 |
|
||||
| **v3.24.33** | `a855145` | 2026-11-01 | ✓ | 提示词放大编辑(所见即所得)+ 气泡并入分组 + 图标统一 |
|
||||
| **v3.24.32** | `6d1079e` | 2026-11-01 | ✓ | 工具栏新增节点落在当前视口中心 |
|
||||
| **v3.24.31** | `afe1de3` | 2026-11-01 | ✓ | 背景色交互重做(悬停预览 / 点击确认)+ 画布细节统一 |
|
||||
| **v3.24.30** | `74a5c18` | 2026-11-01 | ✓ | 节点背景色(8 色 · 三入口 · 同色系内层 · 亮/暗两套配色) |
|
||||
| **v3.24.29** | `774310d` | 2026-10-31 | ✓ | 组内多选不再显示「编组」+ 编组/解组换文件夹图标 + 组框留白 28、圆角 18 |
|
||||
| **v3.24.22** | `de69761` | 2026-10-31 | ✓ | 文档事实数据全量校准(无功能变更):健康表/钉点/覆盖率/测试数按实测重写 + 棘轮上限按实测收紧 |
|
||||
| **v3.24.21** | `9566171` | 2026-10-31 | ✓ | 插件面板切 tab 串页修复 + 资源中心标题栏尺寸显示移除 |
|
||||
| **v3.24.20** | `44ab72a` | 2026-10-31 | ✓ | 模型设置面板重做 + 图库参考图修复 + 组合分隔符/文本入口恢复 |
|
||||
| **v3.24.19** | `3f8ad60` | 2026-10-30 | ✓ | 节点图标更新 + 文本节点屏蔽 + 气泡贴合标题 |
|
||||
| **v3.24.18** | `ad42b7a` | 2026-10-30 | ✓ | 「生图」改名「配置」+ 服务商/分组收进「模型设置」面板 |
|
||||
| **v3.24.17** | `01025d1` | 2026-10-30 | ✓ | 图标按钮统一显示 2 字功能名(气泡/底栏/节点卡)+ 插件 appliesTo 收口到 ref |
|
||||
| **v3.24.16** | `a3fbdc3` | 2026-10-29 | ✓ | 备份区去掉外框 + 入口收敛到设置面板(另两处菜单入口移除)|
|
||||
| **v3.24.15** | `8198e6d` | 2026-10-29 | ✓ | 备份还原并入设置面板 + 修复设置/Key/模型还原不回来 |
|
||||
| **v3.24.14** | `a8f35e0` | 2026-10-29 | ✓ | 补 app.js/Workbench 行数棘轮 + 落位规则(防结构回潮)|
|
||||
| **v3.24.13** | `b7d8bee` | 2026-10-29 | ✓ | 再搬 6 个 Workbench 逻辑单元(app.js −262 行)|
|
||||
| **v3.24.12** | `e9642cc` | 2026-10-29 | ✓ | Workbench 逻辑单元搬出(runNode/saveNow;app.js −449 行)|
|
||||
| **v3.24.11** | `df4f360` | 2026-10-29 | ✓ | renderBodyInner 瘦身(app.js −579 行,行为零变化)|
|
||||
| **v3.24.10** | `988ebbb` | 2026-10-29 | ✓ | 源码钉点换行为断言(app53 756→709,行为零变化)|
|
||||
| **v3.24.9** | `2516738` | 2026-10-29 | ✓ | 移除「批量设置」(入口隐蔽且有选区被清空缺陷);死代码清理;5 个模块补 e2e |
|
||||
| **v3.24.8** | `d4b9e77` | 2026-10-28 | ✓ | 移除 Tab 循环界面模式(会隐藏标签栏/工具栏,误按即像界面坏了)|
|
||||
| **v3.24.7** | `2ce8ece` | 2026-10-28 | ✓ | 修复「标签栏/底栏消失且刷新不回来」(uiMode 不再持久化);清理 9 个未使用模块(377 行)|
|
||||
| **v3.24.6** | `e41aab6` | 2026-10-28 | ✓ | 结构重构:`app.js` 12,477→10,603(−15.0%);7 步搬迁各带等价证明;修 3 个真实 ReferenceError;新增组件行数棘轮 |
|
||||
| **v3.24.5** | `36e3f3e` | 2026-10-28 | ✓ | `Workbench()` −82 行;resume 变体过滤抽纯函数+穷举单测(锁住重复扣费);**e2e 产出覆盖率 → app.js 57.7%** |
|
||||
| **v3.24.4** | `a6d1e11` | 2026-10-28 | ✓ | 依赖安全修复(audit 2 high→0)+ 覆盖率 28.3%→34.1%(**业务代码零改动**) |
|
||||
| **v3.24.3** | `1b3ffcb` | 2026-10-28 | ✓ | 修复空备份 ZIP 无法解析(校验保留);附 `Workbench()` 拆分前置调研文档 |
|
||||
| **v3.24.2** | `da24ffa` | 2026-10-28 | ✓ | 内部重构第二批:任务图回溯族 + ZIP 读写族(12 个成员外置;**备份链路首次纳入自动化保护**) |
|
||||
| **v3.24.1** | `2040193` | 2026-10-28 | ✓ | 内部重构:拆 app.js 巨石第一批(16 个纯函数外置,**零行为变化**) |
|
||||
| **v3.24.0** | `705b1f0` | 2026-10-20 | ✓ | 图库插入画布不塞整图 base64;刷新后双击可打开 |
|
||||
| v3.23.0 | `e129398` | 2026-10-20 | ✓ | 资源中心交互优化 5 项 |
|
||||
| v3.22.0 | `0581261` | 2026-10-20 | ✓ | 缩放手柄「隐形但可拖」+ 标题栏尺寸 |
|
||||
| v3.21.0 | `7530b31` | 2026-10-20 | ✓ | 移除 Pinterest + Pages Function 补安全头 |
|
||||
| v3.20.2 | `857908f` | 2026-10-19 | ✓ | 图片节点缩略图消失修复 |
|
||||
| v3.20.1 | `0831d08` | 2026-10-19 | ✓ | — |
|
||||
|
||||
**特殊标签**:
|
||||
|
||||
| 标签 | 指向 | 含义 |
|
||||
|---|---|---|
|
||||
| `stable-v3.24.85` | 同 `stable` | 固定在 v3.24.85 的稳定标记(**当前回滚点**,commit `7df9dc4`) |
|
||||
| `stable-verified-2026-11-16` | 同 `stable` | 「某天在线上实测通过」的留痕(该日已移到 v3.24.85) |
|
||||
| `stable-v3.24.84` | `c8b7543` | 上一版(回滚点) |
|
||||
| `stable-verified-2026-11-14` | `c8b7543` | 「某天在线上实测通过」的留痕(当日移到 v3.24.84) |
|
||||
| `stable-v3.24.80` | `2d584a6` | 上一版(回滚点) |
|
||||
| `stable-v3.24.79` | `8598a57` | 上一版(回滚点) |
|
||||
| `stable-verified-2026-11-12` | `8598a57` | 「某天在线上实测通过」的留痕(当日移到 v3.24.79) |
|
||||
| `stable-v3.24.78` | `aaa9112` | 上一版(回滚点) |
|
||||
| `stable-v3.24.76` | `e660a75` | 上一版(回滚点) |
|
||||
| `stable-v3.24.40` | 同 `stable` | 固定在 v3.24.40 的稳定标记 |
|
||||
| `stable-verified-2026-11-03` | 同 `stable` | 「某天在线上实测通过」的留痕(本日已移到 v3.24.40) |
|
||||
| `stable-v3.24.38` | `b3fe448` | 固定在 v3.24.38 的稳定标记(上一回滚点) |
|
||||
| `stable-v3.24.36` | `0434411` | 固定在 v3.24.36 的稳定标记 |
|
||||
| `stable-verified-2026-11-02` | `0434411` | 「某天在线上实测通过」的留痕 |
|
||||
| `stable-v3.24.17` | `01025d1` | 固定在 v3.24.17 的稳定标记 |
|
||||
| `stable-verified-2026-10-30` | `01025d1` | 「某天在线上实测通过」的留痕 |
|
||||
| `stable-v3.24.16` | `a3fbdc3` | 上一版(回滚点) |
|
||||
| `stable-v3.24.15` | `8198e6d` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.14` | `a8f35e0` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.13` | `b7d8bee` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.12` | `e9642cc` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.11` | `df4f360` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.10` | `988ebbb` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.9` | `2516738` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.8` | `d4b9e77` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.7` | `2ce8ece` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.6` | `e41aab6` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.5` | `36e3f3e` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.4` | `a6d1e11` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.3` | `1b3ffcb` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.2` | `da24ffa` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.1` | `2040193` | 更早一版(回滚点) |
|
||||
| `stable-v3.24.0` | `705b1f0` | 更早一版(回滚点) |
|
||||
|
||||
---
|
||||
|
||||
## 2. ⚠️ 一个必须知道的惯例:tag 与「部署提交」差 1 个
|
||||
|
||||
**v3.24.0 的例子**:
|
||||
|
||||
```
|
||||
047fae5 release: v3.24.0 ← 线上实际部署的是这个
|
||||
705b1f0 docs(changelog): v3.24.0 发布记录… ← tag v3.24.0 指向这个
|
||||
```
|
||||
|
||||
**这是项目既定流程**(先 bump → 部署 → 再写 CHANGELOG → 打 tag)。
|
||||
**已实测验证:两者的运行时代码逐字节一致**:
|
||||
|
||||
```
|
||||
app.js ✓ 完全一致 (blob 05ae6c5d)
|
||||
style.css ✓ 完全一致 (blob b93e54c0)
|
||||
package.json ✓ 完全一致 (blob 984d11c6)
|
||||
src/ 整个树 ✓ 完全一致 (tree 7dd44626)
|
||||
两个 commit 的差异只有:CHANGELOG.md、docs/standards/architecture-current-state.md
|
||||
```
|
||||
|
||||
⇒ **回滚到 `v3.24.0` 重建产物 = 线上那份代码**。这个结论对每个版本都成立(tag 只在文档提交上)。
|
||||
|
||||
### 2.1 ✅ 还原演练(2026-10-27 对 v3.24.0 实做,方法对每个版本通用)
|
||||
|
||||
用**临时 git worktree** 在 `v3.24.0` tag 上独立重建,再与**线上实际产物**比对:
|
||||
|
||||
```bash
|
||||
git worktree add /tmp/iwb-rb v3.24.0
|
||||
cd /tmp/iwb-rb && node scripts/build.js # 从 tag 重建
|
||||
curl -fsSL https://iwb.maqiart.eu.org/app.js -o /tmp/live-app.js
|
||||
# 归一化两处「必然不同」的内容后再比:
|
||||
# ① 首行 banner(含各自 commit SHA)
|
||||
# ② APP_VERSION 常量(build 会注入 vX.Y.Z+<commit>)
|
||||
```
|
||||
|
||||
| 产物 | 从 tag 重建 | 线上生产 | 结论 |
|
||||
|---|---|---|---|
|
||||
| `app.js`(归一化后) | `d4cb39ea2268a1df` | `d4cb39ea2268a1df` | ✅ **逐字节一致** |
|
||||
| `style.css` | `d8f551e9a48f32ae` | `d8f551e9a48f32ae` | ✅ **逐字节一致** |
|
||||
|
||||
> 唯一差异是 build 注入的 `APP_VERSION`(`v3.24.0+705b1f0` vs `v3.24.0+047fae5`)——
|
||||
> 那是**版本标记**,不是代码逻辑;部署后的 `version.json` 也会如实反映当前 commit。
|
||||
|
||||
**结论:还原是真的可行,已实测**。以后出问题可按 §3 场景 A 直接操作。
|
||||
|
||||
---
|
||||
|
||||
## 3. 还原操作(按场景选一种)
|
||||
|
||||
### 场景 A:线上出问题,要退回上一个版本(最常见)
|
||||
|
||||
```bash
|
||||
cd ~/open/github/image-workbench-web
|
||||
|
||||
# 1) 看清要退到哪一版
|
||||
git tag --list 'v3.*' | tail -10
|
||||
git log --oneline -5 # 确认当前
|
||||
|
||||
# 2) 退到目标版本的**代码**
|
||||
git checkout v3.23.0 # 或 stable / stable-v3.24.0
|
||||
|
||||
# 3) 重建并部署(注意:仅 checkout 不会改线上,必须部署)
|
||||
npm ci
|
||||
npm run verify:ci # 确认这一版的门禁是绿的
|
||||
npm run deploy # 部署到正式站
|
||||
|
||||
# 4) 核验(三地址一致 + 可恢复)
|
||||
IWB_VERIFY_STRICT=1 node scripts/verify-release.js
|
||||
```
|
||||
|
||||
> ⚠️ 本项目已转桌面客户端:**不再用 `wrangler pages deploy`**,发版走 `./scripts/publish-update.sh`(macOS)/ `./scripts/publish-windows-update.sh`(Windows)。
|
||||
> 回滚时**不要**把旧代码 push 到 main(会污染历史);用 `checkout` 部署即可,
|
||||
> 部署完 `git checkout main` 回到主干。
|
||||
|
||||
### 场景 B:干活把 main 弄坏了,要回到「上次稳定」
|
||||
|
||||
```bash
|
||||
git log --oneline stable..main # 看看稳定之后多了什么
|
||||
git checkout stable # 或:git reset --hard stable(会丢本地改动,慎用)
|
||||
```
|
||||
|
||||
> `stable` = `909691f`(v3.24.0 生产等价点)。
|
||||
|
||||
### 场景 C:只想看某个版本改了什么 / 找回被删的代码
|
||||
|
||||
```bash
|
||||
git show v3.24.0 --stat # 该版本改动的文件
|
||||
git show v3.24.0:app.js | grep -n "wLog" # 找回某个版本的代码片段
|
||||
git diff v3.23.0 v3.24.0 -- app.js # 两版之间的代码差异
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. 版本记录完整性审计(2026-10-27,诚实记录)
|
||||
|
||||
| 记录源 | 数量 | 说明 |
|
||||
|---|---|---|
|
||||
| `CHANGELOG.md` 的 `## vX.Y.Z` 条目 | **70** | 每版的改动说明 |
|
||||
| git tag(`vX.Y.Z` 形式) | **125** | 可 checkout 的版本点 |
|
||||
| GitHub Release | **67** | 带说明的发布页 |
|
||||
|
||||
**结论:近期版本(v3.20.1 → v3.24.0)三方齐全 ⇒ 还原能力完整。** 历史上有以下不对齐:
|
||||
|
||||
| 不对齐项 | 数量 | 影响 |
|
||||
|---|---|---|
|
||||
| 有 tag、但 CHANGELOG 无对应 `## v` 条目 | 68 | 多为 `3.8x` 历史线/测试迭代版本;**仍可 checkout 还原**,只是没有文字说明 |
|
||||
| CHANGELOG 有、但没有 tag | 13 | `v3.83.0` / `v3.84.x` / `v3.85.x` / `v3.86.x` / `v3.87.x` 等 —— 当时是"测试迭代、已并入后续版本",未单独打 tag |
|
||||
| CHANGELOG 有、但没有 GitHub Release | 17 | 同上 + `v3.0.2` / `v3.81.x` / `v3.82.0` |
|
||||
|
||||
> **这些不打算回补**(历史版本早已下线,补 tag 无法验证"当时线上跑的确实是它")。
|
||||
> 记录在此是为了:以后要还原很久以前的版本时,**知道哪些有精确锚点、哪些只能靠 CHANGELOG 文字定位**。
|
||||
|
||||
### 4.1 tag 同步状态
|
||||
|
||||
```
|
||||
本地 tag: 386 / 远端 tag: 386 / 差: 0 ✅ 2026-10-27 已把 4 个本地独有的 tag 推送上去
|
||||
```
|
||||
|
||||
> 此前有 4 个只在本机(`v3.1.0-mt-pre-S1` / `v3.86.4-pre-panelfix` / `v3.86.5-pre-panelship` /
|
||||
> `v3.86.5-pre-panelui`)—— 本机故障就会丢标签名(commit 虽在 main,但恢复不了"这个 tag 曾指向谁")。
|
||||
> 已推送消除单点风险。
|
||||
|
||||
---
|
||||
|
||||
## 5. 安全性兜底(为什么"能还原"不是靠自觉)
|
||||
|
||||
项目有**两道机制**保证线上代码永远可恢复:
|
||||
|
||||
1. **推 main 需要口令**:`RELEASE=1 git push origin main`(本地 pre-push 钩子拦截误推)
|
||||
2. **部署后严格核验**:`IWB_VERIFY_STRICT=1 node scripts/verify-release.js`
|
||||
—— 校验「线上 commit 必须是 `origin/main` 的祖先」。
|
||||
若不满足(即部署了本机独有、未推送的代码),**直接退出码 1 报错**。
|
||||
|
||||
> 这条机制挡过真事故:`npm run deploy` 不含 git push,
|
||||
> 曾经出现过"部署了只存在于本机的代码" ⇒ 本机故障就永久丢失线上代码。
|
||||
|
||||
---
|
||||
|
||||
## 6. 每次发版要维护的记录(清单)
|
||||
|
||||
发完一个版本,确认这 5 项都做了:
|
||||
|
||||
- [ ] `package.json` 版本已 bump(`npm version X.Y.Z --no-git-tag-version`)
|
||||
- [ ] **事实基线锚点已同步**(`architecture-current-state.md` 第 4 行 `main = <SHA>`;否则 `test:facts` 打红)
|
||||
- [ ] `CHANGELOG.md` 已写该版本条目(含部署后的 `version.json` 实际值)
|
||||
- [ ] 四个标签已打并推送:`vX.Y.Z` / `stable-vX.Y.Z` / `stable`(移动)/ `stable-verified-YYYY-MM-DD`
|
||||
- [ ] `gh release create vX.Y.Z` 已建(带说明)
|
||||
|
||||
---
|
||||
|
||||
## 7. 快速参考卡
|
||||
|
||||
```bash
|
||||
# 现在线上是什么
|
||||
curl -fsSL https://iwb.maqiart.eu.org/version.json
|
||||
|
||||
# 核验(三地址一致 + 可恢复)
|
||||
IWB_VERIFY_STRICT=1 node scripts/verify-release.js
|
||||
|
||||
# 回到某版本并部署
|
||||
git checkout v3.23.0 && npm ci && npm run verify:ci && npm run deploy
|
||||
IWB_VERIFY_STRICT=1 node scripts/verify-release.js
|
||||
git checkout main
|
||||
|
||||
# 看某版本改了什么
|
||||
git show v3.24.0 --stat
|
||||
|
||||
# 看两版代码差异
|
||||
git diff v3.23.0 v3.24.0 -- app.js
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 7. 重构期的分步还原(多提交改造时用这一节)
|
||||
|
||||
> 版本级还原(§1 的 tag 表)解决的是"线上跑回旧版"。
|
||||
> **重构期间更常见的是"某一步搬坏了,只想退这一步"** —— 用下面四层,从细到粗。
|
||||
|
||||
### 7.1 四层还原
|
||||
|
||||
| 层 | 手段 | 恢复时间 | 适用 |
|
||||
|---|---|---|---|
|
||||
| **1** | `git revert <单个提交>` | 秒 | 某一步搬错了,只退这一步,其他步保留 |
|
||||
| **2** | 步骤 tag:每步绿了就 `git tag refactor-step-N` | 秒 | 退回某个**已知好状态**继续 |
|
||||
| **3** | `git checkout stable-vX.Y.Z` 重部署 | 3–5 分钟 | 线上出问题,退回上个发布版 |
|
||||
| **4** | Cloudflare 部署历史切回旧 deployment | 1–2 分钟 | 连代码都不想动,直接切旧部署 |
|
||||
|
||||
```bash
|
||||
# 层 1:只退某一步(保留后续提交,最常用)
|
||||
git revert --no-edit <bad-commit>
|
||||
|
||||
# 层 2:退到某个已知好的步骤
|
||||
git log --oneline --decorate | head -20 # 找 refactor-step-N
|
||||
git checkout refactor-step-3
|
||||
|
||||
# 层 3:整体退回上个发布版
|
||||
git checkout stable-v3.24.5 && npm ci && npm run verify:ci && npm run deploy
|
||||
|
||||
# 层 4:看部署历史,用 dashboard 或 API 切回旧 deployment
|
||||
# 桌面端没有「线上部署列表」:版本清单在 NAS 的 /vol8/web/iwb-download/updates/
|
||||
```
|
||||
|
||||
### 7.2 铁律
|
||||
|
||||
1. **不用 `git reset --hard` / 不改写已推送历史** —— 一律 `git revert`,历史可查
|
||||
2. **一步一提交**,一个组件/一个函数一次提交,message 写清"搬了什么、依赖宽度、怎么验证的"
|
||||
3. 每步绿了就打 `refactor-step-N` tag(**成本零,收益极高**)
|
||||
4. 重构期间 **`main` 始终可发布**(用分支做,绿了再合)
|
||||
|
||||
### 7.3 纯搬移的"等价证明"
|
||||
|
||||
纯搬移(把函数/组件从 A 文件搬到 B 文件、不改逻辑)可以用工具**证明**等价:
|
||||
|
||||
```bash
|
||||
node scripts/verify-move.js --from <搬之前的提交> --name <函数名> --to <目标文件>
|
||||
# ✓ 搬家等价 → 逐字(或仅空白差异)相同,只搬没改
|
||||
# ✗ 搬家不等价 → 打印首个差异行
|
||||
```
|
||||
|
||||
配合 `verify:ci` + `e2e 115` + `coverage:e2e 不降`,三者一起构成"搬移"的完整证据链。
|
||||
@@ -4,6 +4,12 @@
|
||||
> 触发:用户反馈 —— 「图库的图片插入到画布后,刷新画布,图片状态会改变,双击就不能打开了;
|
||||
> 刷新后图片有数倍内存占用,过一会儿内存会回落」
|
||||
> 用户目标:**不要建立画布的性能**(可以牺牲这个功能)
|
||||
>
|
||||
> ⚠️ 2026-11-24 注记(读本篇前必看):本文是**网页版时期**的链路口径 —— 文中的
|
||||
> `localStorage['iwb_web_outputs']` + 「IndexedDB 缩略图字节」只对当时的网页版成立。
|
||||
> 现在桌面端(Tauri)的字节落在 `images/thumbs`、`images/gallery` 文件里,索引在
|
||||
> `library/gallery/index.json`;实际映射见 `docs/standards/image-storage-map.md`。
|
||||
> 本文的**结论**(插入只记引用、别把整图塞进画布数据)仍然有效,**存储位置描述已过时**。
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# 现状架构与性能事实基线(image-workbench-web)
|
||||
# 现状架构与性能事实基线(桌面版)
|
||||
|
||||
> **本文档是什么**:现状**事实快照**,不是规范。用途:任何性能 / 内存 / 存储相关改动,先对齐这里的现实,避免把已经调好的东西改坏。
|
||||
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = 573f245`(线上 `v3.26.55+573f245` —— 2026-11-23 **节点正文文本区修复**:提示词/文本节点正文透明继承卡片底色(白卡片消失)、编辑态三层框(控件 border / 聚焦光晕 / D8 焦点环)全去掉,规范补表面角色三分法与 `node-scope-test` 第 5 条守卫,8 张基线重录;上一条 `v3.26.51+21554b0` —— **M6 延展验证**:插件面板两段六次叠加样式合并重写、133 行新增零裸值;补 `--iwb-font-base`(14px) 第 8 档与亮色状态色调深(对浅页面 2.13 → ≥4.6),对比度守卫 114→138 对;新增 ⑦⑧ 组件夹具基线共 16 张;`batch-export` 1.2.2 状态色走宿主 token、去掉纯蓝主按钮;棘轮基线首次下调。M1–M6 全部完成;上一条 `v3.26.50+cab473c` —— **M5 闸门**:新增 `scripts/token-lint.js`(只查 diff 新增行,CSS 与 JS 内联样式两套判据、四类白名单)+ `tests/design-token-ratchet-test.js`(13 项计数只降不升)+ `tests/theme-contrast-test.js`(亮/暗 × 文字 × 表面 114 对),三条各做一次打红验证后接进 `verify:ci`;顺手把首启动「选择资料目录」弹窗 token 化(全仓最后一个完全未 token 化的界面);上一条 `v3.26.49+1743453` —— **M4-B6 收尾**:`style.css` 剩余 16 处半像素字号全清零(守卫收紧为全文件断言)、`--iwb-control-h` 裁定不扩到全局控件(并排表单 vs 成组紧凑控件);插件主题契约重写,`ALLOW_FILES` 文件级豁免 **6 → 0** —— 改为「私有皮肤 manifest 自声明 `skin` + chroma 强调色判据 + 内容色行内标记」,声明私有皮肤的插件不得引用宿主颜色 token;同步 4 个插件版本,插件侧中性色写死归零;视觉基线 8 张因字号栅格化变化更新,A/B 回退确认非环境噪声;上一条 `v3.26.48+cb9cb9c` —— **M4-B5 节点**:节点卡内部表面统一 `--iwb-field` —— 端口底色从 `#161616`(暗色对卡片差 39 级,一颗黑洞)改 `#494949`(差 12 级),同病灶另 6 处(ref-img/ref-single/upload-link/refmini-empty/task-result-img/node-head:hover)一并改;浮条与任务卡 hover 改 `color-mix(text 10%)`(原来 panel 与 layer2 深色同色,hover 无反馈);字号 12/15/11/13 全归档位、圆角 8/6/5/14 归并、间距 52 处等值 + 13 处 1px 级微调;删 6 个死类名;新增 `tests/node-scope-test.js` 钉「节点内禁用面板表面色」;上一条 `v3.26.47+f5c8174` —— **M4-B4 设置/外观**:新增 `--iwb-control-h`(30px) 修「同行输入框 33px / 按钮 24px」的 9px 落差;设置页正文 14→13、标题 16→15,范围内半像素字号清零;删 21 条死规则(setcell/setgrid/set-row/appear-val 等);新增 `tests/settings-scope-test.js` 钉「控件等高 / 死类名不复现 / 引用的 token 必须存在」;上一条 `v3.26.46+9f29996` —— 2026-11-23 **M4-B3 首页/库**:删 30 条零生产者规则(25 个类名在产物里 0 次)+ 4 条被 specificity 覆盖的死声明,`style.css` 2391→2339 行;首页/库 106 条规则换 token,间距写死 91→5(只剩版心与导航让位的布局值)、字号写死清零,新增 `--iwb-font-display:24px` 第 7 档;验收改为「计算样式逐元素 diff + 12 张基线只首页 2 张变化」;上一条 `v3.26.45+968ff46` —— **M4-B2 浮层层级表 + 阴影四档**:14 档 `--iwb-z-*`(裸 z-index 取值种类 42→31)、`--iwb-elevation-1..4`(浮层 8 种阴影写法→4 档)、`.iwb-pop` 圆角 18→`radius-popover(14)`;修「弹窗里点保存看不到提示」—— 根因不是层级数字而是 `.iwb-overlay` 本身就是堆叠上下文,toast 改为 portal 到 `body`;新增 `tests/overlay-layer-test.js` 钉 9 条顺序约束;上一条 `v3.26.44+846a59b` —— **设计 token 体系重建**:D1–D9 色彩模型改为真正的深色(#121212 底 / 正文 #e3e3e3、13 个表面逐层相对派生 + 对比度生成期夹紧)、D10 新增 `--iwb-field` 卡片内控件面(暗色不再在灰卡上挖黑洞)、M3 单一源(`derive()` → `design-tokens.css` + `tokens.json`,`tokens:check` 进 CI);**安装包已本地构建,NAS 尚未上传**);上一条 `v3.26.41+2b8e337`:继承态提示词把上游文案与参考图交给组合/连接节点(来源判定加 `(edges, nodes)`,组合拼接逻辑零改动);再上一条 `v3.26.40+d9e3d84`:左右停靠栏配色对齐主色调(新增 `--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` 通过Line truncated
|
||||
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = afe5075`(线上 `v3.26.64+afe5075` —— 2026-11-24 **图库:出图即入图库 + 插入落本地副本(能标注)**:每张生成完成即归档并通知插件(此前只在整轮结束写一次 ⇒ 生成中图库一直空)、插入取源改本地字节优先并引用化(抓不到才留原链接 + 提示)、`getNodeImage` 补 `data.localRef` 候选(远程缓存命中却仍判「不支持标注」的直接成因)、批量插入改 4 列栅格(旧实现同批全叠一处),逻辑落 `src/gallery-sync.js`,app.js 只装配;上一条 `v3.26.60+cf0e9a0` —— **浮层字号上调一档**:「模型设置」「图像设置」选择项 11→13px、高 22→28、左右内距 6→10、间距 4→6、标题 12→14、面板 328→360,改动全落在 `.iwb-pop` 的 6 个 token(两面板共用一套);上一条 `v3.26.59+e966b34` —— 备份新增 `plugin-files/` 通道,提示词封面换机不再丢;再上一条 2026-11-23 **节点正文文本区修复**:提示词/文本节点正文透明继承卡片底色(白卡片消失)、编辑态三层框(控件 border / 聚焦光晕 / D8 焦点环)全去掉,规范补表面角色三分法与 `node-scope-test` 第 5 条守卫,8 张基线重录;上一条 `v3.26.51+21554b0` —— **M6 延展验证**:插件面板两段六次叠加样式合并重写、133 行新增零裸值;补 `--iwb-font-base`(14px) 第 8 档与亮色状态色调深(对浅页面 2.13 → ≥4.6),对比度守卫 114→138 对;新增 ⑦⑧ 组件夹具基线共 16 张;`batch-export` 1.2.2 状态色走宿主 token、去掉纯蓝主按钮;棘轮基线首次下调。M1–M6 全部完成;上一条 `v3.26.50+cab473c` —— **M5 闸门**:新增 `scripts/token-lint.js`(只查 diff 新增行,CSS 与 JS 内联样式两套判据、四类白名单)+ `tests/design-token-ratchet-test.js`(13 项计数只降不升)+ `tests/theme-contrast-test.js`(亮/暗 × 文字 × 表面 114 对),三条各做一次打红验证后接进 `verify:ci`;顺手把首启动「选择资料目录」弹窗 token 化(全仓最后一个完全未 token 化的界面);上一条 `v3.26.49+1743453` —— **M4-B6 收尾**:`style.css` 剩余 16 处半像素字号全清零(守卫收紧为全文件断言)、`--iwb-control-h` 裁定不扩到全局控件(并排表单 vs 成组紧凑控件);插件主题契约重写,`ALLOW_FILES` 文件级豁免 **6 → 0** —— 改为「私有皮肤 manifest 自声明 `skin` + chroma 强调色判据 + 内容色行内标记」,声明私有皮肤的插件不得引用宿主颜色 token;同步 4 个插件版本,插件侧中性色写死归零;视觉基线 8 张因字号栅格化变化更新,A/B 回退确认非环境噪声;上一条 `v3.26.48+cb9cb9c` —— **M4-B5 节点**:节点卡内部表面统一 `--iwb-field` —— 端口底色从 `#161616`(暗色对卡片差 39 级,一颗黑洞)改 `#494949`(差 12 级),同病灶另 6 处(ref-img/ref-single/upload-link/refmini-empty/task-result-img/node-head:hover)一并改;浮条与任务卡 hover 改 `color-mix(text 10%)`(原来 panel 与 layer2 深色同色,hover 无反馈);字号 12/15/11/13 全归档位、圆角 8/6/5/14 归并、间距 52 处等值 + 13 处 1px 级微调;删 6 个死类名;新增 `tests/node-scope-test.js` 钉「节点内禁用面板表面色」;上一条 `v3.26.47+f5c8174` —— **M4-B4 设置/外观**:新增 `--iwb-control-h`(30px) 修「同行输入框 33px / 按钮 24px」的 9px 落差;设置页正文 14→13、标题 16→15,范围内半像素字号清零;删 21 条死规则(setcell/setgrid/set-row/appear-val 等);新增 `tests/settings-scope-test.js` 钉「控件等高 / 死类名不复现 / 引用的 token 必须存在」;上一条 `v3.26.46+9f29996` —— 2026-11-23 **M4-B3 首页/库**:删 30 条零生产者规则(25 个类名在产物里 0 次)+ 4 条被 specificity 覆盖的死声明,`style.css` 2391→2339 行;首页/库 106 条规则换 token,间距写死 91→5(只剩版心与导航让位的布局值)、字号写死清零,新增 `--iwb-font-display:24px` 第 7 档;验收改为「计算样式逐元素 diff + 12 张基线只首页 2 张变化」;上一条 `v3.26.45+968ff46` —— **M4-B2 浮层层级表 + 阴影四档**:14 档 `--iwb-z-*`(裸 z-index 取值种类 42→31)、`--iwb-elevation-1..4`(浮层 8 种阴影写法→4 档)、`.iwb-pop` 圆角 18→`radius-popover(14)`;修「弹窗里点保存看不到提示」—— 根因不是层级数字而是 `.iwb-overlay` 本身就是堆叠上下文,toast 改为 portal 到 `body`;新增 `tests/overlay-layer-test.js` 钉 9 条顺序约束;上一条 `v3.26.44+846a59b` —— **设计 token 体系重建**:D1–D9 色彩模型改为真正的深色(#121Line truncated
|
||||
<!-- 2026-10-28 P1 拆分批 1:新增 src/generation-task-graph.js(5 个任务图纯函数自 app.js 迁出)
|
||||
⇒ 模块数 60→61、耦合面 51→52、sourceModules 60→61。耦合面只**新增** IWBWTaskGraph,无删除。
|
||||
2026-10-28 P1 拆分批 2:新增 src/storage-config-shape.js(9 个配置形状纯函数自 app.js 迁出)
|
||||
@@ -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`(现 **108** 个模块 / 14,607 行,`sourceModules` 108 项;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 **9,105 行**(**双层预算**:绝对上限 9,105 / 占总源码 ≤ 40%,现 **30.0%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **3,044 行**(上限 **3,046**,余量 2;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **109** 个模块 / 21,290 行,`sourceModules` 109 项;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. 门禁与环境现状
|
||||
@@ -33,8 +33,8 @@
|
||||
| e2e | spec 文件 **58** 个(**52** 个进门禁 + 4 个 dev 探针 `_perf-baseline` / `_plugin-host-probe` / `_probe-drag` / `_probe-tab-switch`) | (A) `tests/` 计数 + `scripts/list-e2e-specs.js` |
|
||||
| e2e 用例数 | **200 条**(2026-11-16 实测:55 个进门禁 spec 内 `test()` 总数;v3.25.15 删除网页版部署面后为 **53** 个进门禁;v3.25.56 节点组库改插件 `grouplib`(宿主侧栏组件删除)后为 **52** 个进门禁 —— `iwb-csp-gate` / `iwb-functions-headers` 随 `_headers`、`functions/` 一起移除)(历史:115 → v3.24.18 **143** → v3.24.19 **147** → v3.24.21 **151** → F2 改名 1 条 **152** → 抓手工具 2 条 **154** → v3.24.44 输出顺序 2 条 **166** → v3.24.47 同步去重 `iwb-sync-dedupe` 1 条 **167** → v3.24.67 **179** → v3.24.68 **183** → v3.24.69 **184** → v3.24.70 **186** → v3.24.74 **187**(新增「拖入 PDF 给提示 + MIME 空 PNG 仍能导入」)→ v3.24.75 **188**(新增「同一张图连粘两次只建一个节点」)→ v3.24.76 **191**(新增 `iwb-tabs-release` 3 条:回首页不降级 / 关标签先保存再关 / 彻底删除连带关标签)→ v3.24.77 **194**(新增 `iwb-lod` 3 条:fit 大画布必须全 LOD / 放大后必须恢复 / 常规画布不 LOD)→ v3.24.78 **196**(`iwb-lod` 3 → 5 条:新增「lite 档必须画出代表图/首行文字」与「缩到 15% 以下才退成 plain」)→ v3.24.82 **197**(新增 `iwb-inherit-text` 1 条:提示词/文本节点显示上游继承文本、改字接管、恢复跟随)→ v3.24.83 **198**(新增 `iwb-plugin-node-coldstart` 1 条:插件脚本晚到 1.2s,存档里的插件节点必须自动切回插件节点体,且类型不被降级成 `plugin`)→ v3.24.79 **196 不变**(测速修复的守门落在 jsdom 单测 `provider-ping-test.js`,e2e 无新增)→ v3.24.85 **200**(新增 `iwb-multi-tab` 2 条:A 页 flush 落盘后 B 页必须靠 rev 轮询看到改动;B 页持锁期间 A 页图库归档必须挂起);早期 99 → 115 的逐版链条见 `docs/history/coverage-baseline-2026-10-27.md`) | (A) `tests/*.spec.js` 计数 + `scripts/list-e2e-specs.js` |
|
||||
| CI | `.github/workflows/verify.yml`:**push(main) + PR(→main) + 手动** 触发,两个 job(`gate` = `verify:ci`;`e2e` = `test:e2e`),只验证不部署 | (A) |
|
||||
| 部署 | `npm run deploy` = `verify` + `wrangler pages deploy dist --branch main`;**内含全量 verify,不得绕过** | (A) `package.json:16` |
|
||||
| 部署环境 | 本机 wrangler 为 OAuth 登录 → **不能设 `CI=true`**(用 `unset CI` + `WRANGLER_SEND_METRICS=false`) | (A) 本轮发布实测 |
|
||||
| 发布(桌面) | mac:`bash scripts/publish-update.sh`;Windows:`publish-windows-update.sh` 后**重跑** mac 发布以合并 `latest.json` | `docs/WIN_BUILD_SPEC.md` §0.1 |
|
||||
| 发布环境 | 已无 Cloudflare Pages / wrangler / `deploy` 脚本;更新源为 NAS `https://download.maqiart.eu.org/updates/latest.json` | `PUBLISHING.md` |
|
||||
| `APP_VERSION` | `app.js:2723` 的 `'v3.6.0'` 是**构建期占位标记**,由 `scripts/build.js:40-41` 用 package 版本替换(缺标记会抛错)→ **不是版本漂移,别去"修"它** | (A) |
|
||||
| `dist/` | 单 `dist/app.js`(`src/` 模块按序拼接后整体压缩)+ 压缩 `style.css`;**无 `dist/src/`** | (A) `CHANGELOG.md:16` |
|
||||
| 根 `index.html` | **已删除**(2026-10-16,`9e743e4`):根目录不再含可直接打开的入口,静态产物只在 `dist/` | (C) 本轮删除 |
|
||||
@@ -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` 不引用模块全局)。**108 个模块中 59 个导出**被 `app.js` 读取;其余为未接线 / 仅测试 / 零引用(见下)。
|
||||
- **判定法**:`global.X =` / `root.X =` 判「导出」;跨文件裸引用判「读」;排除自合并(`src/runtime-constants.js:9`)。`app.js` 是**唯一生产消费者**(无 HTML 入口;`sw.js` 不引用模块全局)。**109 个模块中 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 耦合面(**86** 项)与 `sourceModules` 顺序(**108** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。
|
||||
- **耦合面已冻结**:`tests/architecture-boundary-guard-test.js`(进 `npm run test:unit` 末环)冻结 app.js↔src 耦合面(**88** 项)与 `sourceModules` 顺序(**109** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。
|
||||
|
||||
## 12. 易踩的坑
|
||||
|
||||
@@ -254,7 +254,7 @@
|
||||
|
||||
**信任模型(必须明示)**:形态 A 的插件是**可信代码**(与核心同权限、无沙箱);启停与设置是 UX 与可维护性手段,**不是安全边界**(同 §13.27 教训:前端开关一定可被绕过)。
|
||||
|
||||
**守门与快照**:`tests/architecture-boundary-guard-test.js` 冻结「app.js ↔ src 耦合面」(**86** 项)与 `sourceModules` 顺序(**108** 项);新增模块、新增耦合、新增 dev 探针都**必须有意重生成对应快照**(`IWB_WRITE_BOUNDARY_SNAPSHOT=1`)。契约与行为的可执行验证在 `tests/plugin-host-test.js`(宿主单测)与 `tests/_plugin-host-probe.spec.js`(真实浏览器探针,`_` 前缀 + `iwb-dev-probe`,不进 34 门禁)。
|
||||
**守门与快照**:`tests/architecture-boundary-guard-test.js` 冻结「app.js ↔ src 耦合面」(**88** 项)与 `sourceModules` 顺序(**109** 项);新增模块、新增耦合、新增 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 规则三的同一失败模式)。
|
||||
|
||||
|
||||
@@ -495,6 +495,26 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建
|
||||
- 正文对所在表面 ≥ **4.5:1**;次要文字 ≥ **3.2:1**;非文字元素(边框/图标)≥ **3:1**
|
||||
- 品牌底上的字由 `contrast()` 自动选黑/白,**禁止手工指定**
|
||||
|
||||
#### 3.1.2 状态层(2026-11-24)
|
||||
|
||||
状态色只有前景色是不够的:背景与描边此前散落在样式里做 **16 处内联 `color-mix`**,暗色下各自为政。
|
||||
现在由 `derive()` 统一派生(亮色浅底+深字 / 暗色深底+亮字),样式只引用:
|
||||
|
||||
| token | 亮色来源 | 用途 |
|
||||
|---|---|---|
|
||||
| `--iwb-err-bg` | `err` 与 `surface0` 混 90% | 错误提示底、危险按钮 hover 底 |
|
||||
| `--iwb-err-bd` | 混 62% | 错误描边、连接失败外环 |
|
||||
| `--iwb-ok-bg` | `ok` 混 90% | 成功/可用提示底 |
|
||||
| `--iwb-ok-bd` | 混 62% | 成功描边、连接成功外环 |
|
||||
| `--iwb-warn-bg` | `warn` 混 90% | 警告提示底 |
|
||||
| `--iwb-warn-bd` | 混 62% | 警告描边 |
|
||||
|
||||
规则:
|
||||
|
||||
- 状态**底色**一律用 `*-bg`,不要再写 `color-mix(in srgb, var(--iwb-err) 12%, transparent)`
|
||||
- 状态**描边/外环**一律用 `*-bd`
|
||||
- `--iwb-err/ok/warn` 本身只作**文字色与图标色**(对比度已在 `derive()` 里夹到 4.5:1)
|
||||
|
||||
#### 3.1.1 单一源与产物(M3)
|
||||
|
||||
颜色只有一个源:`src/theme-tokens.js` 的 `derive()`。它派生出两份产物,**都不许手改**:
|
||||
@@ -565,10 +585,11 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建
|
||||
### 3.3 字号 / 行高 / 字重
|
||||
|
||||
**已落地(v3.26.44,M4-B1)**:6 档。**v3.26.46(M4-B3)补第 7 档 `display`**;
|
||||
**v3.26.51(M6)补第 8 档 `base`**。
|
||||
**v3.26.51(M6)补第 8 档 `base`**;**v3.26.62 补 `2xs`(承认 10px)**。
|
||||
|
||||
| token | 值 | 归并掉 | 用途 |
|
||||
|---|---|---|---|
|
||||
| `--iwb-font-2xs` | 10px | 9, 10 | 极小标注:缩略图角标、画布坐标、比例徽标(**v3.26.62 承认**) |
|
||||
| `--iwb-font-xs` | 11px | 10, 11.5 | 状态栏、徽标、辅助信息 |
|
||||
| `--iwb-font-sm` | 12px | 12.5 | **默认正文 / 标签**(UI 里出现最多) |
|
||||
| `--iwb-font-md` | 13px | 13.5 | **紧凑**正文、列表项、工具栏标题 |
|
||||
@@ -576,6 +597,10 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建
|
||||
| `--iwb-font-lg` | 15px | 15.5, **16** | 小标题、节点标题、卡片标题 |
|
||||
| `--iwb-font-xl` | 17px | 17.5, **18** | 面板标题、侧栏标题、图标字形 |
|
||||
| `--iwb-font-2xl` | 20px | 19, 22 | 页面大标题 |
|
||||
> **为什么承认 10px(v3.26.62)**:全站 29 处写死 `font-size:10px`,全是「极小标注」一个角色(缩略图角标、
|
||||
> 画布坐标、比例徽标)。闭集最小是 11px,这 29 处长期在闭集外,lint 只能靠例外标记绕过 ——
|
||||
> 与其装作没有,不如给它一个名字。**约束:`2xs` 不许用于可读正文,只用于附注/角标类信息。**
|
||||
|
||||
| `--iwb-font-display` | 24px | **26, 28, 30** | 展示级标题:页面/视图主标题(全仓 ≤5 处) |
|
||||
|
||||
> **为什么补第 8 档(M6 重做插件面板时定的)**:B1 的表里 14px 同时挂在 `md(13)` 和 `lg(15)`
|
||||
@@ -678,20 +703,35 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建
|
||||
|
||||
### 3.7 动效
|
||||
|
||||
**已落地(v3.26.62)**:数值定义在 `SCALE` 表(`--iwb-motion-*` / `--iwb-ease-*`)。
|
||||
|
||||
| token | 值 | 用途 |
|
||||
|---|---|---|
|
||||
| `--iwb-dur-fast` | 100ms | hover、颜色 |
|
||||
| `--iwb-dur-base` | 150ms | 展开、位移 |
|
||||
| `--iwb-dur-slow` | 200ms | 面板进出 |
|
||||
| `--iwb-dur-xslow` | 300ms | 模态、大位移 |
|
||||
| `--iwb-ease-standard` | `cubic-bezier(.2,0,0,1)` | 默认 |
|
||||
| `--iwb-ease-out` | `cubic-bezier(0,0,.2,1)` | 进入 |
|
||||
| `--iwb-motion-fast` | `0.12s` | 悬停、开关、小位移(全站最高频) |
|
||||
| `--iwb-motion-base` | `0.15s` | 展开、位移、尺寸变化 |
|
||||
| `--iwb-motion-slow` | `0.3s` | 整屏过渡、抽屉进出 |
|
||||
| `--iwb-ease-out` | `cubic-bezier(0.16, 1, 0.3, 1)` | 进入/展开:快出慢停 |
|
||||
| `--iwb-ease-in-out` | `cubic-bezier(0.4, 0, 0.2, 1)` | 状态切换 |
|
||||
|
||||
必须包 `@media (prefers-reduced-motion: reduce)` 关闭(现状已有部分,未统一)。
|
||||
写法:`transition: <prop> var(--iwb-motion-fast) var(--iwb-ease-out)`。
|
||||
|
||||
> 历史遗留:`--tr-fast/-base/-slow`(`0.1s/0.2s/0.3s ease-out`)仍保留给旧代码,新代码不再使用。
|
||||
> 旧文档里的 `--iwb-dur-*` / `--iwb-ease-standard` **从未落地**(v3.26.62 更正)。
|
||||
|
||||
必须包 `@media (prefers-reduced-motion: reduce)` 关闭动效。
|
||||
|
||||
### 3.7.1 透明度 / 描边宽度
|
||||
|
||||
| token | 值 | 用途 |
|
||||
|---|---|---|
|
||||
| `--iwb-opacity-disabled` | `0.45` | 禁用态(此前 0.45 / 0.55 混用) |
|
||||
| `--iwb-opacity-muted` | `0.7` | 次要/未激活元素 |
|
||||
| `--iwb-bw` | `1px` | 常规描边(分隔线、控件边框) |
|
||||
| `--iwb-bw-strong` | `2px` | 强调描边:选中、危险操作、拖拽手柄 |
|
||||
### 3.8 图标与命中区
|
||||
|
||||
- 尺寸闭集:12 / 14 / 16 / 20(现状 13/15 归并到 14/16)
|
||||
- 尺寸闭集(v3.26.62 起有 token):`--iwb-icon-sm` 14 / `--iwb-icon-md` 16 / `--iwb-icon-lg` 18;12 与 20 只允许出现在
|
||||
非图标图形(圆点、拖拽手柄、头像)上,不再新增裸写
|
||||
- 描边:`stroke-width: 1.6`,`stroke-linecap: round`
|
||||
- 命中区:**≥28×28**(现状气泡按钮 30×28 合规;`--iwb-tab-new` 等 28 高合规)
|
||||
|
||||
@@ -748,7 +788,11 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建
|
||||
|
||||
### 3.11 设置面板(L3 组件 token,v3.26.53)
|
||||
|
||||
设置页采用 Obsidian 式布局:**组标题在页面底色上,组内容放在浅灰圆角容器里**。以下 token 定义在 `.iwb-settings-modal` 作用域内。
|
||||
设置页采用 Obsidian 式布局:**组标题在页面底色上,组内容放在浅灰圆角容器里**。
|
||||
|
||||
> **v3.26.62 起这 18 个 token 的值在 `COMPONENT_SCOPED`(`scripts/gen-tokens.js`)里只写一次**,生成到
|
||||
> `src/design-tokens.css` 的 `.iwb-settings-modal` 作用域;`style.css` 不再声明它们。本表 ↔ `tokens.json` 的
|
||||
> `component.settings` 由 `tests/design-tokens-component-doc-test.js` 双向断言(文档有代码没有、代码有文档没写,都会红)。
|
||||
|
||||
| token | 值 | 用途 |
|
||||
|---|---|---|
|
||||
@@ -785,12 +829,50 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建
|
||||
| `--iwb-set-check-size` | `16px` | 复选框边长(全设置页统一) |
|
||||
| `--iwb-set-check-radius` | `4px` | 复选框圆角(自定义皮肤时用) |
|
||||
| `--iwb-set-btn-gap` | `var(--iwb-space-8)` | 一组操作按钮之间的间距 |
|
||||
| `--iwb-set-input-border` | `color-mix(in srgb, var(--iwb-border) 40%, var(--iwb-panel))` | 输入框描边(比常规更淡,避免设置页满屏黑框) |
|
||||
|
||||
规则:
|
||||
|
||||
- 复选框统一 `input[type=checkbox]` 尺寸与 `accent-color: var(--iwb-brand)`,不再各页写 15px/18px
|
||||
- 按钮高度统一 `--iwb-control-h`、圆角 `--iwb-radius-control`;操作组间距用 `--iwb-set-btn-gap`
|
||||
- 备份/外观等页的操作按钮不再单独写高度或间距
|
||||
### 3.13 浮层弹窗(popover,L3,v3.26.58)
|
||||
|
||||
> **v3.26.62 起这 11 个 token 由 `COMPONENT_SCOPED` 生成**(与 §3.11 同一机制),`style.css` 只留布局属性;
|
||||
> 文档、`tokens.json` 的 `component.popover`、生成产物三方由同一个测试断言。
|
||||
|
||||
画布节点上的「模型设置」「图像设置」等贴节点浮层,统一用 `.iwb-pop` 这套 shell;
|
||||
token 定义在 `.iwb-pop` 作用域内,**同类浮层只允许引用它们 + L2 尺度 token**。
|
||||
|
||||
字号档(v3.26.60 上调):选择项 13px / 高 28px / 左右内距 10px / 间距 6px、标题 14px、分组标签 12px。
|
||||
上一版是 11px / 22px / 6px / 4px / 12px / 11px,用户反馈「文字有些小」,整体放大一档;
|
||||
面板宽度同时 328 → 360px,抵消放大带来的额外换行。
|
||||
|
||||
| token | 值 | 用途 |
|
||||
|---|---|---|
|
||||
| `--iwb-pop-w` | `360px` | 面板宽度(窄屏由 `max-width: calc(100vw - 16px)` 兜底) |
|
||||
| `--iwb-pop-pad-y` | `var(--iwb-space-10)` | 面板上下内边距 |
|
||||
| `--iwb-pop-pad-x` | `var(--iwb-space-12)` | 面板左右内边距 |
|
||||
| `--iwb-pop-gap` | `var(--iwb-space-8)` | 面板内分组之间 |
|
||||
| `--iwb-pop-radius` | `var(--iwb-radius-popover)` | 面板圆角(阴影用 `--iwb-elevation-3`) |
|
||||
| `--iwb-pop-title-size` | `var(--iwb-font-base)` | 面板标题字号(14px) |
|
||||
| `--iwb-pop-chip-h` | `28px` | 选择项/下拉框/数字框统一高度 |
|
||||
| `--iwb-pop-chip-pad-x` | `var(--iwb-space-10)` | 选择项左右内边距 |
|
||||
| `--iwb-pop-chip-radius` | `6px` | 选择项圆角(矩形,非胶囊) |
|
||||
| `--iwb-pop-chip-gap` | `var(--iwb-space-6)` | 选择项之间 / 换行后的行距 |
|
||||
| `--iwb-pop-chip-size` | `var(--iwb-font-md)` | 选择项字号(13px) |
|
||||
|
||||
分组标签 `.iwb-setlabel` 用 `--iwb-font-sm` + 600 字重,分组内间距 `space-4`;浮层内说明文字 `.iwb-pop .iwb-hint` 用 `--iwb-font-sm`。
|
||||
|
||||
规则:
|
||||
|
||||
- 同一浮层里**所有选择项高度、圆角、字号必须一致**(`.iwb-chip-line` 与 `.iwb-gc-item` 都吃这套 token)
|
||||
- 面板宽度只能由 `--iwb-pop-w` 决定;禁止再写 `width: 380px` 之类硬编码(曾因此让 token 失效;
|
||||
`.iwb-gen-config` 原来写死 `min(92vw, 320px)` 就是这么失效的,v3.26.60 已改成引用 token)
|
||||
- 触发浮层时必须在**绘制前**完成定位:定位用 `useLayoutEffect`,未定位前 `visibility: hidden`;
|
||||
禁止先用 `{x:40,y:40}` 之类默认坐标渲染(用户会看到左上角闪一下再跳到锚点)
|
||||
- 浮层必须 portal 到 `body`(节点在画布 `transform` 里,否则 fixed 会被变成相对定位)
|
||||
- 新增同类浮层复用 `.iwb-pop` + `.iwb-pop-anchor`,不要自写宽高/内边距
|
||||
---
|
||||
|
||||
## 4. 落地路线
|
||||
|
||||
@@ -44,16 +44,18 @@
|
||||
### 13.5 测试是契约
|
||||
- 测试**断言了有意设计**(如备份「设置默认不勾选」= 安全设计)。不要随意改这些默认值,除非确认意图并**同步更新测试**。
|
||||
- 改动内部行为(如存储键方案:`idbKeyOf` → 内容哈希缓存 URL)时必须**同步更新对应测试**(如 63-6「同步兜底与异步保存使用一致的参考图键」)。
|
||||
- 部署脚本 `deploy = verify && wrangler`:若 verify 出现**哪怕一个「新增失败」**(可能是 e2e 偶然抖动),`&&` 短路 → **wrangler 不执行、部署未真正生效**。因此改完必须**确认 wrangler 输出 "Deployment complete" + 域名并核验域名版本**,不要只看外层命令退出码(管道 `tail` 的退出码是 0,会假阳)。
|
||||
- 发布脚本 `publish-update.sh` 用 `set -e`:构建/签名任一步失败都会中止;发完必须核验 `latest.json` 版本/平台与下载页 URL,不要只看外层命令退出码(管道 `tail` 的退出码是 0,会假阳)。
|
||||
|
||||
### 13.6 工作流(测试版 → 正式版两级发布)
|
||||
- **地址**:正式 = `main` 分支 → `image-workbench-web.pages.dev`(+ 自定义域名);**测试 = `test` 分支 → `https://test.image-workbench-web.pages.dev`(固定别名,始终指向 test 分支最新部署)**。
|
||||
- **脚本**:`npm run deploy:test` = verify + `wrangler pages deploy dist --branch test`;`npm run deploy` = verify + `--branch main`。两者都先跑 verify。
|
||||
- **每次改动流程**:先打 `vX-pre-Y` 恢复标签 → `npm run verify`(期望基线以 **`CHANGELOG.md` 头部当前值**为准,见该文件"发布流程"第一条;**不要在此写死数字**,以 `docs/standards/architecture-current-state.md` §2 + `CHANGELOG.md` 头部为准(2026-10-15 复核:663 通过 / 0 新增失败 / 5 已知 + e2e 102)→ bump 版本 → **`npm run deploy:test`** → 用户在 `test.image-workbench-web.pages.dev` 实测(硬刷新确认版本)→ 没问题 → **`npm run deploy`(正式)** → 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、写 CHANGELOG / GitHub Release。
|
||||
- **测试发现问题** → 改 → 再 `deploy:test`,直到通过;正式环境全程不受影响。
|
||||
- **注意事项**:`*.pages.dev` 预览/分支地址是公开的(知道 URL 即可访问,个人测试可接受);每次 `deploy:test` 前 bump 版本以便区分测试的是哪版;部署后要**核验目标域名版本**(测试页看测试地址、正式页看正式地址),不要只信外层退出码(管道 `tail` 退出码是 0 会假阳,`&&` 短路会导致 wrangler 没跑)。
|
||||
- 与既有功能无关的调试脚手架(如 gated debug counters)尽量不混入正式提交;确需保留时单独提交并说明。
|
||||
- 改动任何镜像/存储/排序行为前,先跑中继 fixture(`tests/relay-task-graph-fixture-test.js`)确认不破坏既有任务图语义。
|
||||
### 13.6 发布工作流(桌面版:mac + Windows 同批)
|
||||
|
||||
> 2026-11-24 重写:旧网页版 `deploy` / `deploy:test` / Pages 测试站流程已废弃,历史见 git 记录与 `docs/archive/history/PUBLISHING-legacy-web.md`。
|
||||
|
||||
- **唯一版本源**:`package.json`;`node scripts/set-version.js X.Y.Z` 同步 `tauri.conf.json` / `Cargo.toml`。
|
||||
- **mac**:`npm run verify:ci` → 更新 CHANGELOG → 提交 → `bash scripts/publish-update.sh`(双架构构建、签名、上传、生成 `latest.json`)。
|
||||
- **Windows**:按 `docs/WIN_BUILD_SPEC.md` 构建 `*-setup.exe` → 放 NAS `_inbox/` → mac `publish-windows-update.sh` 重签 → **再跑一次** `publish-update.sh` 把 `windows-x86_64` 合并进 `latest.json`。
|
||||
- **站点**:登记 `site/releases.json` → `gen-release-page.js` / `gen-site.js` → 上传 NAS → 核验 200 与字节数。
|
||||
- **tag**:`vX.Y.Z` 指向 bump 提交;docs/站点提交可在 tag 之后,但不要再改业务代码。
|
||||
- 平台版本必须同批;Windows 落后时不要往 `latest.json` 塞旧包。
|
||||
|
||||
### 13.7 整体优化复盘(v3.78.0 → v3.79.2,稳定标签 `stable` / `v3.79.2`)
|
||||
> 一轮「4K 图片 + 大画布」的性能/存储专项,从「真实用户反馈」出发、用 Performance 画像定位、逐项修复并固化成规范。记录成文,避免复踩。
|
||||
@@ -387,15 +389,14 @@
|
||||
- **规则四:不可表达的能力必须显式提示。** 例如 gemini/doubao 没有"任意像素自定义尺寸"、某模型有档位上限——
|
||||
界面要说明(可自动降档并标注),**不得静默忽略**。
|
||||
|
||||
## §13.32 发布流程加固(2026-10-04,因一次真实失误新增)
|
||||
- **失误记录**:`npm run verify` 未通过,但链式命令继续执行 → **标签与 Release 先打成了 v3.87.31,
|
||||
而正式环境仍停在 v3.87.30**("记录先于验证",属流程违规)。
|
||||
- **硬规则一**:`verify` 与部署必须串成**同一条 `&&` 链**,失败即停:
|
||||
`npm run verify && git commit/push && npm run deploy:test && npm run deploy`。
|
||||
- **硬规则二**:**先部署、后打标签/写 Release**;标签必须指向"已部署且门禁通过"的那个提交。
|
||||
- **硬规则三**:发布后**逐个核验三个地址**的 `APP_VERSION`(正式双域名 + 测试地址);不一致立即补发。
|
||||
- **硬规则四**:若已误打标签/Release → 修正提交后**强制移动标签**(`git tag -f` + `push --force`)并**重写 Release 说明**,
|
||||
同时向用户如实说明失误与修正过程。
|
||||
## §13.32 发布流程加固(2026-10-04 教训;2026-11-24 改为桌面版口径)
|
||||
|
||||
> 旧网页版「verify && deploy:test && deploy + 三地址核验」流程已废弃,历史见 git。
|
||||
|
||||
- **硬规则一**:`verify:ci` 必须通过后再 bump/构建;失败即停,不得先打 tag 后补验证。
|
||||
- **硬规则二**:mac 发布用 `bash scripts/publish-update.sh`;Windows 包由 mac 签名并**重跑**该脚本合并 `latest.json`。
|
||||
- **硬规则三**:发布后核验 `latest.json` 版本/三平台 + `latest-windows.json` 同版本 + 下载页 200/字节一致。
|
||||
- **硬规则四**:误发时回滚版本提交并重跑发布脚本;不要手工改 `latest.json`。
|
||||
|
||||
---
|
||||
|
||||
@@ -1649,3 +1650,13 @@ JS 只能拿到 `TypeError: Failed to fetch`。
|
||||
(app.js 净减 13 行,正好还棘轮)。**新模块名先查前缀白名单**
|
||||
(`runtime|storage|generation|canvas|workspace|gallery|image|clipboard|ui|plugin`)——
|
||||
`provider-ping.js` 会被边界守门直接打红,且不该为此新开前缀。
|
||||
|
||||
|
||||
## §13.60 Windows 构建/发布:CRLF 防呆、版本与 tag 对齐、交付边界(2026-11-24,v3.26.55)
|
||||
|
||||
- 构建机只认 `package.json` 的版本;文档中的固定版本号是历史示例,照抄必错。
|
||||
- `tokens:check` 失败先看 CRLF:`build.js` 与 `gen-tokens.js` 都必须把 `\r\n` 归一后再比较;只修一处会在 `app:build` 再炸一次。
|
||||
- `.gitattributes` 的 `eol=lf` 不会 renormalize 已有 checkout;校验层容忍才是根治。
|
||||
- Windows 只负责出 `*-setup.exe` 放 NAS `_inbox/`;签名、`latest-windows.json`、合并 `latest.json` 全部在 mac 做。
|
||||
- 平台版本必须同批:Windows 版本落后时 mac 的 `latest.json` 不应塞旧 win 包,等 win 同版本发布后重跑发布脚本自动齐平。
|
||||
- 发布后核验三件事:`latest.json` 含三平台、`latest-windows.json` 版本一致、下载页 exe 可 200 且字节数一致。
|
||||
@@ -0,0 +1,101 @@
|
||||
# 图片存哪:运行时 × 键前缀 × 落点
|
||||
|
||||
> 用途:回答「这张图存在哪 / 为什么节点里是链接 / 删了会不会留垃圾」这类问题前,先按本文判读。
|
||||
> 本文是**判读口径**,不是功能说明;与代码冲突时以代码 + `scripts/audit-image-storage.js` 的输出为准。
|
||||
|
||||
## 1. 第一件事:确认运行时
|
||||
|
||||
同一个 `IWBImageBlobStore`,在两种运行时落到完全不同的地方。判断入口只有一个:
|
||||
|
||||
```js
|
||||
window.IWBStorageFile && window.IWBStorageFile.enabled() // 桌面端 true
|
||||
```
|
||||
|
||||
`app.js` 的 `storageRuntime()` 据此返回 `fileStore.runtime` 或 `window.IWBStorageRuntime`;
|
||||
`wImageBlobStore()` 把 `storageRuntime().indexedDb` 注入给 blob 仓库。
|
||||
|
||||
| 运行时 | 注入的 idb 是什么 | Blob 最终落在 |
|
||||
|---|---|---|
|
||||
| 桌面端(Tauri,资料目录就绪) | `storage-file.js` 的文件 KV(`kv`) | `~/Documents/ImageWorkbench/images/canvas/<sha16>.<ext>` + `data.json` 的 `assets` 登记 |
|
||||
| 浏览器(网页版) | 真正的 IndexedDB | 页面 IndexedDB(受浏览器配额限制) |
|
||||
|
||||
**「字节在 IndexedDB」只对网页版成立。** 桌面端 `image-blob-store.js` 只是"调用 put/get/del",
|
||||
它不知道背后是文件;把该文件头部的 "IndexedDB" 当桌面端事实,是 2026-11-24 一次误判的起点。
|
||||
|
||||
## 2. 键前缀 → 目录(`storage-file.js:catOfKey`)
|
||||
|
||||
| key 前缀 | 桌面端目录 | 写入方 |
|
||||
|---|---|---|
|
||||
| `out_orig_` | `images/gallery/` | 图库原图(生成归档时下载) |
|
||||
| `out_` | `images/thumbs/` | 图库缩略图 / `_768` 显示版 |
|
||||
| `imgblob_` | `images/canvas/` | 画布图:插入副本、粘贴、本地导入 |
|
||||
| `http…` | `images/legacy/` | 旧版 `__cache__` 绝对 URL 键 |
|
||||
| 其它 | `images/canvas/` | 兜底 |
|
||||
|
||||
`data.json` 的 `assets` 是**唯一登记表**:`{ "<key>": { f: "images/canvas/xxx.png", k: "blob"|"dataurl", m } }`。
|
||||
文件在目录里但 `assets` 没登记 = 孤儿(`_768` 显示版属于已知例外)。
|
||||
|
||||
## 3. 节点的四种引用形态
|
||||
|
||||
| 形态 | 字节位置 | 解析函数 | 能否标注/喂上游 |
|
||||
|---|---|---|---|
|
||||
| `{ __blob: 'imgblob_…' }` | 见上表(桌面 `images/canvas/`) | `wImgRefDataUrl` / `ImageBlobStore.getBlob` | 能 |
|
||||
| `{ __idb: 'out_orig_…' }` | `assets[key].f` | `IDB.get` | 能 |
|
||||
| `{ __cache: '/__iwb_cache__/…' }` | Cache Storage(web)/ `images/legacy` | `caches.match` | 能(桌面端重启后不可靠,已不新增) |
|
||||
| `"https://…"` | 远程图床 | 只能 `fetch` / `wTauri.http.fetch` | **不能**,除非先"素材化"落本地 |
|
||||
|
||||
`addRefFromUrl`(生成结果→参考图 / 链接拖入)对非 SVG **仍原样写 url**(2026-11-11 用户裁定:
|
||||
节点 `data.url` 保持原链接,提交生成时仍用链接),所以这类节点靠 `data.localRef` 旁路缓存 +
|
||||
`getNodeImage` 的按需落地来获得可标注能力。**图库插入不走这条路**(见第 7 节)。
|
||||
|
||||
## 7. 2026-11-24 收口:插入一律落本地副本,取图认 localRef
|
||||
|
||||
用户裁定(本次):**B6 = 复制** —— 图库插入多占一份空间可以接受,条件是「不能丢数据、
|
||||
不能插进去是个链接导致不能标注」。据此定了三条口径:
|
||||
|
||||
| 入口 | 现在的行为 | 落在哪 |
|
||||
|---|---|---|
|
||||
| 图库「插入」(右键 / 格子 / 顶部 / 批量拖入) | 取本地字节(原图→清单 data→缩略图→按需抓远程)→ 按档缩尺寸 → 引用化 | `{__blob}` → `images/canvas/` |
|
||||
| 图库拖入画布(带 `x-iwb-gallery-orig`) | 同上(与按钮同一条链) | 同上 |
|
||||
| 生成结果→参考图 / 链接拖入 | 保持原链接(旧裁定不变) | `data.url` + `localRef` 缓存 |
|
||||
| 插件取图(`canvasBridge.getNodeImage`) | 候选含 `data.localRef`;只有远程时抓一次并写回 `localRef` | — |
|
||||
|
||||
抓不到本地字节(离线 / 图床拦跨域)时的行为:**保留原链接插入**,节点 `data.srcUrl` 留痕,
|
||||
toast 明确提示「可能无法标注」。宁可有链接,也不静默丢图。
|
||||
|
||||
代码位置:判定与取源都在 `src/gallery-sync.js`(`localCopySrcOf` / `prepareInsert` /
|
||||
`nodeImageOf` / `thumbFor` / `archiveEntryNow`),`app.js` 只 `attach(...)` 装配。
|
||||
|
||||
顺带的第二个成因(「生图后图库不显示」):归档原本只在整轮结束写一次。现在 `handleCompletedJob`
|
||||
每张完成即 `archiveEntryNow`(串行队列 + 等缩略图 + 刷新 React outputs + `IWBPluginGallery.emit`),
|
||||
图库插件订阅 `ctx.gallery.onChanged` 后 260ms 防抖重拉。
|
||||
|
||||
## 4. 回答"图存哪"的三步实证法
|
||||
|
||||
```bash
|
||||
node scripts/audit-image-storage.js # ① 目录/登记/孤儿/节点形态一次看全
|
||||
node -e "…library/gallery/index.json 的 origIdb 覆盖率…" # ② 图库条目是否真有本地原图
|
||||
```
|
||||
|
||||
③ 只在必要时做:真机点一次目标入口,看新节点 `data.url` / `data.data` 落到哪种形态。
|
||||
|
||||
**禁止**只读代码注释、默认值或变量名就下结论。`canvas.backupOriginals` 默认 false ≠ 用户库里没有原图;
|
||||
实测这批数据 6/6 条目都有 `origIdb`,原图就在 `images/gallery/`。
|
||||
|
||||
## 5. 反例(2026-11-24):三处误判与各自成因
|
||||
|
||||
| 错误结论 | 当时的"依据" | 真正的成因 |
|
||||
|---|---|---|
|
||||
| 副本写进 IndexedDB | `image-blob-store.js` 头部注释与实现都写 IDB | 只读了仓库层,没跟到 `wImageBlobStore()` 注入的是文件 KV;注释本身还是网页版口径 |
|
||||
| 图库条目通常没有 `origIdb`,所以插入得到 url | `backupOriginals` 默认 false 的代码路径 | 用"默认值"代替"实际数据",没打开 `library/gallery/index.json` |
|
||||
| 图库插入会留 http 链接 | `insertOutputsToCanvas` 里 `url: ref0 \|\| src0` | 静态推断了分支,却把 `addRefFromUrl` 的产物(生成结果→参考图)算到了图库插入头上;没统计节点形态 |
|
||||
|
||||
共同点:**先用注释/默认值形成假设,再用同一假设去"验证"代码,从未读真实数据。**
|
||||
数据一统计就翻案:`data.url` 里 0 个 `__blob`,`data.data` 里 66 个 `__blob`。
|
||||
|
||||
## 6. 硬规则
|
||||
|
||||
1. 存储路径类结论必须有 `audit-image-storage.js` 输出或 `assets` 记录支撑,不得由注释推断。
|
||||
2. 判断"用户数据长什么样"就读用户数据,"默认值/典型情况"只能用来解释代码分支。
|
||||
3. 同一函数在两种运行时语义可能不同:先确认 `enabled()`,再谈落点。
|
||||
4. 改插件/宿主里任何"存图"逻辑后,重跑一次 audit,确认目录与登记仍然成对。
|
||||
@@ -249,8 +249,8 @@ npm run verify
|
||||
- 大型改动前创建标签。
|
||||
- 一次提交只解决一个明确问题。
|
||||
- 工作区必须干净后发布。
|
||||
- `npm run deploy` 已包含完整验证,不得绕过。
|
||||
- 部署后记录 commit、Pages URL,并验证正式域名版本。
|
||||
- 桌面版无 `deploy`;发布前必须 `npm run verify:ci`,mac 用 `publish-update.sh`,Windows 包由 mac 签名后重跑合并。
|
||||
- 发布后记录 commit 与版本;核验 `latest.json` / `latest-windows.json` / 下载页三处一致。
|
||||
- **"部署成功"≠ 验收:部署后要在真实 URL 上跑关键 e2e**(本轮做法,测试地址与正式域名各跑一遍):
|
||||
```bash
|
||||
IWB_BASE_URL=https://iwb.maqiart.eu.org npx playwright test tests/<关键>.spec.js
|
||||
@@ -259,10 +259,10 @@ npm run verify
|
||||
- **文档 / 发布说明里的"地址"必须是完整可点 URL**:禁止用 `站点/#iwb-tools=<暗号>` 这类**占位符**充当地址(用户会直接粘进浏览器 → 白跑一趟并以为站点坏了)。若必须举例,明确标注"占位符,非真实地址"。
|
||||
- **仓库是私有的:GitHub 链接对外不可见**。未登录(含聊天软件、内嵌浏览器、无痕窗口)访问仓库或 Release 页会得到 **404**(私有仓库对未认证请求就是 404,不是 403)。要给用户看的内容:要么在对话里贴原文、要么放到**站点**上(站点是公开的)。另外 **CLI 有权限 ≠ 浏览器有登录态**——排查"地址不对"时,第一步让用户确认当前浏览器登录的账号(打开 `https://github.com/<owner>` 看是否 404)。
|
||||
|
||||
- **CI 只做验证门禁**:`.github/workflows/verify.yml` 在 `main` 推送时跑 `npm run verify`;**部署一律手动** `npm run deploy`(正式)/ `npm run deploy:test`(测试站),本仓库不使用 CI 自动部署。
|
||||
- **本机 `wrangler` 是 OAuth 登录、不是 API Token**(会过期、不可当 CI 密钥;且无 Token 管理权限)⇒ 若将来要启用 CI 自动部署,API Token 只能在 Cloudflare Dashboard 手动创建(本机无法脚本化生成)。
|
||||
- **三地址版本必须一致**:`scripts/verify-release.js` 只强制 自定义域 / `*.pages.dev` / `test.*.pages.dev` 的 **`version` 字符串一致**(接受 `vX.Y.Z` 或前缀 `vX.Y.Z+`;`uniq.length>1` 即失败)。**commit / SHA 不比较**(脚本注释即「commit 仅信息展示」):docs-only 提交让线上 SHA 落后一个代码提交,也不会判失败。
|
||||
- **发布标签四类**:`vX.Y.Z`(GitHub Release 用)+ `stable-vX.Y.Z`(稳定标记)+ 移动可变 `stable` 到最新稳定 + `stable-verified-YYYY-MM-DD`(验证留痕);随后 `gh release create vX.Y.Z`。
|
||||
- **CI 只做验证门禁**:`.github/workflows/verify.yml` 只跑 `verify:ci`;发布一律在本机用 `publish-update.sh` / `publish-windows-update.sh`,CI 不部署。
|
||||
- 仓库已无 Cloudflare Pages / wrangler / `deploy` 脚本;更新源为 NAS(`download.maqiart.eu.org`)。
|
||||
- **版本一致性**:mac/Windows 同批;`latest.json` 必须含三平台,Windows 落后时不要塞旧包。
|
||||
- **发布标签**:桌面版只要求 `vX.Y.Z` 指向 bump 提交;不再维护网页版的 stable-* 标签。
|
||||
- **CI 红灯排查顺序**:`gh run view <id> --log-failed` 看具体 job;优先怀疑 action/依赖,而不是代码。
|
||||
- **构建产物已压缩打包(应用版本 v3.1.1)**:`scripts/build.js` 改为 **esbuild 逐文件 minify 再拼接** 成单个 `dist/app.js`(**不再输出 `dist/src/*`**),`style.css` 一并 minify;vendor React 保持独立、不压缩。**逐文件 minify(`transformSync`,非 `bundle`)** 是关键:拼接前每个 IIFE 已封闭,避免"整文件拼接后顶层声明重复/改名"的解析级隐患。
|
||||
- **产物体检进 `verify`**:`npm run verify` 增加 `node --check dist/app.js` 与 `node scripts/check-dist.js`(断言 banner 版本 == `version.json`、`index.html` 恰 3 个 `<script>` 且无 `src/`、压缩后内嵌 Worker 字面量标记仍在)。
|
||||
|
||||
@@ -26,7 +26,8 @@ git checkout 178b36c -- promptlib/styles.css promptlib/src/index.js
|
||||
- 记录选区只在 `keyup / mouseup / input / select`,**绝对不要在 `blur` 记录**(WebKit 失焦会重置选区 → 插入到前一个字符)
|
||||
- 点击时先 `focus()` → 用 `lastSel` 计算插入点,直接 `value.slice` 拼接(确定性 splice)
|
||||
- 插入后 `setSelectionRange` 选中变量名,并同步 `lastSel`
|
||||
- **不要用「透明 textarea + 高亮层」做编辑区**:两层即使字体相同,变量加粗/换行差异也会让点击位置逐次左移(v1.8.18 实测:第 1 次对、第 2 次偏 1 字、第 3 次偏 2 字)。编辑正文直接由 textarea 渲染(v1.8.20)
|
||||
- **不要用「透明 textarea + 高亮层画文字」做编辑区**:两层即使字体相同,变量加粗/换行差异也会让点击位置逐次左移(v1.8.18 实测:第 1 次对、第 2 次偏 1 字、第 3 次偏 2 字)。编辑正文直接由 textarea 渲染(v1.8.20)
|
||||
- **v1.9.3 起的允许例外**:textarea 文字保持可见、变量 span 不加粗,背层只画浅主色背景块(`--iwb-plp-accent` 的 color-mix);两层字体/行高/padding/滚动条占位一致并双向同步滚动。因为文字仍由 textarea 自己绘制,不会复发上面的点击偏移。实现见 `iwb-plugins-desktop/promptlib/styles.css` 的 v1.9.3 注释块。
|
||||
- **不要用 `document.execCommand("insertText")`**:WKWebView 内部光标与 `selectionStart` 会漂移,第一次正常、第二次起偏移一个字符(v1.8.16 实测)
|
||||
|
||||
## 四、发布前检查清单
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "image-workbench-web",
|
||||
"private": true,
|
||||
"version": "3.26.55",
|
||||
"version": "3.26.64",
|
||||
"description": "Browser-based node canvas image workbench",
|
||||
"scripts": {
|
||||
"build": "node scripts/build.js && node scripts/copy-plugins.js",
|
||||
@@ -10,7 +10,7 @@
|
||||
"app:build": "tauri build",
|
||||
"lint": "eslint src app.js",
|
||||
"test": "node tests/relay-task-graph-fixture-test.js && node tests/plugin-style-node-test.js && node tests/inherit-text-test.js",
|
||||
"test:unit": "node tests/plugin-archive-test.js && node tests/plugin-files-policy-test.js && node tests/theme-plugin-tokens-test.js && node tests/theme-static-snapshot-test.js && node tests/overlay-layer-test.js && node tests/settings-scope-test.js && node tests/node-scope-test.js && node tests/appearance-v2-test.js && node tests/image-prompt-cover-test.js && node tests/unit-test.js && node tests/canvas-actions-test.js && node tests/canvas-performance-test.js && node tests/canvas-drag-performance-test.js && node tests/resize-observer-performance-test.js && node tests/node-drag-jank-test.js && node tests/edge-graph-performance-test.js && node tests/persistence-export-images-test.js && node tests/settings-hotkeys-size-presets-test.js && node tests/custom-size-validation-test.js && node tests/image-node-performance-test.js && node tests/drag-frame-performance-test.js && node tests/canvas-edge-memo-test.js && node tests/canvas-node-transform-test.js && node tests/canvas-dot-zoom-test.js && node tests/duplicate-ws-fresh-source-test.js && node tests/single-canvas-shell-test.js && node tests/navigation-layout-test.js && node tests/home-canvas-library-test.js && node tests/left-resource-layout-test.js && node tests/interface-hierarchy-test.js && node tests/three-page-layout-test.js && node tests/page-chrome-regression-test.js && node tests/task-cache-test.js && node tests/storage-config-shape-test.js && node tests/storage-zip-test.js && node tests/canvas-node-factory-test.js && node tests/runtime-error-test.js && node tests/runtime-lifecycle-test.js && node tests/runtime-fetch-test.js && node tests/runtime-channel-test.js && node tests/runtime-boundary-test.js && node tests/runtime-record-test.js && node tests/runtime-recovery-test.js && node tests/runtime-diagnostic-record-test.js && node tests/runtime-metrics-test.js && node tests/runtime-run-context-test.js && node tests/runtime-execution-context-test.js && node tests/storage-gc-canvas-refs-test.js && node tests/storage-health-test.js && node tests/generation-state-test.js && node tests/canvas-store-test.js && node tests/storage-result-test.js && node tests/storage-local-test.js && node tests/storage-domain-test.js && node tests/storage-runtime-test.js && node tests/storage-indexeddb-test.js && node tests/generation-scheduler-test.js && node tests/gallery-query-test.js && node tests/gallery-hydration-test.js && node tests/image-blob-store-test.js && node tests/image-preview-derive-test.js && node tests/image-format-test.js && node tests/clipboard-graph-test.js && node tests/clipboard-graph-fallback-test.js && node tests/image-admit-test.js && node tests/image-dedupe-test.js && node tests/clipboard-kind-test.js && node tests/clipboard-paste-test.js && node tests/clipboard-copy-test.js && node tests/paste-once-test.js && node tests/list-e2e-specs-test.js && node tests/desktop-csp-loopback-test.js && node tests/architecture-boundary-guard-test.js && node tests/plugin-host-test.js && node tests/plugin-data-test.js && node tests/plugin-loader-test.js && node tests/plugin-bundle-test.js && node tests/plugin-install-test.js && node tests/plugin-gallery-render-test.js && node tests/plugin-gallery-recovery-test.js && node tests/plugin-gallery-ux-test.js && node tests/plugin-grouplib-render-test.js && node tests/plugin-promptlib-render-test.js && node tests/image-compress-test.js && node tests/storage-fallback-indexeddb-test.js && node tests/canvas-normalize-test.js && node tests/canvas-geometry-test.js && node tests/canvas-history-test.js && node tests/canvas-ops-test.js && node tests/canvas-text-test.js && node tests/history-store-test.js && node tests/plugin-integrity-test.js && node tests/workspace-sessions-store-test.js && node tests/workspace-list-test.js && node tests/workspace-purge-test.js && node tests/provider-ping-test.js && node tests/runtime-diagnostics-hotpath-test.js && node tests/storage-log-failure-test.js && node tests/storage-convergence-test.js && node tests/swallow-wiring-test.js && node tests/workbench-logic-test.js && node tests/storage-autobackup-test.js && node tests/storage-outputs-mutate-test.js && node tests/sync-facts-guard-test.js && node tests/e2e-fixed-waits-ratchet-test.js && node tests/shell-render-behavior-test.js && node tests/canvas-meta-notice-behavior-test.js && node tests/source-text-ratchet-test.js && node tests/plugin-theme-contract-test.js && node tests/prompt-md-roundtrip-test.js && node tests/generation-results-store-test.js && node tests/out-groups-order-test.js && node tests/native-overlay-park-test.js && node tests/ui-dock-sanitize-test.js && node tests/ui-minimap-fit-test.js && node tests/ui-workbench-hooks-test.js && node tests/plugin-scale-contract-test.js && node tests/design-token-ratchet-test.js && node tests/theme-contrast-test.js",
|
||||
"test:unit": "node tests/plugin-archive-test.js && node tests/plugin-files-policy-test.js && node tests/theme-plugin-tokens-test.js && node tests/design-tokens-component-doc-test.js && node tests/theme-static-snapshot-test.js && node tests/overlay-layer-test.js && node tests/settings-scope-test.js && node tests/node-scope-test.js && node tests/appearance-v2-test.js && node tests/image-prompt-cover-test.js && node tests/unit-test.js && node tests/canvas-actions-test.js && node tests/canvas-performance-test.js && node tests/canvas-drag-performance-test.js && node tests/resize-observer-performance-test.js && node tests/node-drag-jank-test.js && node tests/edge-graph-performance-test.js && node tests/persistence-export-images-test.js && node tests/settings-hotkeys-size-presets-test.js && node tests/custom-size-validation-test.js && node tests/image-node-performance-test.js && node tests/drag-frame-performance-test.js && node tests/canvas-edge-memo-test.js && node tests/canvas-node-transform-test.js && node tests/canvas-dot-zoom-test.js && node tests/duplicate-ws-fresh-source-test.js && node tests/single-canvas-shell-test.js && node tests/navigation-layout-test.js && node tests/home-canvas-library-test.js && node tests/left-resource-layout-test.js && node tests/interface-hierarchy-test.js && node tests/three-page-layout-test.js && node tests/page-chrome-regression-test.js && node tests/task-cache-test.js && node tests/storage-config-shape-test.js && node tests/storage-zip-test.js && node tests/canvas-node-factory-test.js && node tests/runtime-error-test.js && node tests/runtime-lifecycle-test.js && node tests/runtime-fetch-test.js && node tests/runtime-channel-test.js && node tests/runtime-boundary-test.js && node tests/runtime-record-test.js && node tests/runtime-recovery-test.js && node tests/runtime-diagnostic-record-test.js && node tests/runtime-metrics-test.js && node tests/runtime-run-context-test.js && node tests/runtime-execution-context-test.js && node tests/storage-gc-canvas-refs-test.js && node tests/storage-health-test.js && node tests/generation-state-test.js && node tests/canvas-store-test.js && node tests/storage-result-test.js && node tests/storage-local-test.js && node tests/storage-domain-test.js && node tests/storage-runtime-test.js && node tests/storage-indexeddb-test.js && node tests/generation-scheduler-test.js && node tests/gallery-query-test.js && node tests/gallery-hydration-test.js && node tests/gallery-sync-test.js && node tests/image-blob-store-test.js && node tests/image-preview-derive-test.js && node tests/image-format-test.js && node tests/clipboard-graph-test.js && node tests/clipboard-graph-fallback-test.js && node tests/image-admit-test.js && node tests/image-dedupe-test.js && node tests/clipboard-kind-test.js && node tests/clipboard-paste-test.js && node tests/clipboard-copy-test.js && node tests/paste-once-test.js && node tests/list-e2e-specs-test.js && node tests/desktop-csp-loopback-test.js && node tests/architecture-boundary-guard-test.js && node tests/plugin-host-test.js && node tests/plugin-data-test.js && node tests/plugin-loader-test.js && node tests/plugin-bundle-test.js && node tests/plugin-install-test.js && node tests/plugin-gallery-render-test.js && node tests/plugin-gallery-recovery-test.js && node tests/plugin-gallery-ux-test.js && node tests/plugin-grouplib-render-test.js && node tests/plugin-promptlib-render-test.js && node tests/image-compress-test.js && node tests/storage-fallback-indexeddb-test.js && node tests/canvas-normalize-test.js && node tests/canvas-geometry-test.js && node tests/canvas-history-test.js && node tests/canvas-ops-test.js && node tests/canvas-text-test.js && node tests/history-store-test.js && node tests/plugin-integrity-test.js && node tests/workspace-sessions-store-test.js && node tests/workspace-list-test.js && node tests/workspace-purge-test.js && node tests/provider-ping-test.js && node tests/runtime-diagnostics-hotpath-test.js && node tests/storage-log-failure-test.js && node tests/storage-convergence-test.js && node tests/swallow-wiring-test.js && node tests/workbench-logic-test.js && node tests/storage-autobackup-test.js && node tests/storage-outputs-mutate-test.js && node tests/sync-facts-guard-test.js && node tests/e2e-fixed-waits-ratchet-test.js && node tests/shell-render-behavior-test.js && node tests/canvas-meta-notice-behavior-test.js && node tests/source-text-ratchet-test.js && node tests/plugin-theme-contract-test.js && node tests/prompt-md-roundtrip-test.js && node tests/generation-results-store-test.js && node tests/out-groups-order-test.js && node tests/native-overlay-park-test.js && node tests/ui-dock-sanitize-test.js && node tests/ui-minimap-fit-test.js && node tests/ui-workbench-hooks-test.js && node tests/plugin-scale-contract-test.js && node tests/design-token-ratchet-test.js && node tests/theme-contrast-test.js",
|
||||
"test:diagnostics": "node tests/runtime-diagnostics-hotpath-test.js",
|
||||
"test:facts": "node tests/architecture-facts-guard-test.js && node tests/release-records-test.js",
|
||||
"plugins:gc": "node scripts/plugins-publish.mjs --gc",
|
||||
|
||||
+53
-6
@@ -1,8 +1,15 @@
|
||||
// iwb-plugin: 图库 —— 右栏「图库」面板(宿主只提供 ctx.gallery 数据能力,界面全部在插件里)
|
||||
//
|
||||
// 依赖客户端能力:gallery(list/thumb/preview/download/insert/remove)+ panels。
|
||||
// 依赖客户端能力:gallery(list/thumb/preview/download/insert/remove/onChanged)+ panels。
|
||||
// 数据:插件自己的配置(插入尺寸/图幅/时间筛选)存 ctx.data,不塞 settings。
|
||||
// 视觉:复用宿主的 .iwb-gal-* / .iwb-history-* 类名(宿主 style.css 保留这些样式)。
|
||||
//
|
||||
// v1.7.0(2026-11-24):
|
||||
// ① 订阅 ctx.gallery.onChanged —— 出图途中宿主每归档一张就通知,面板立刻长出新图;
|
||||
// 此前只有「面板重新可见且距上次拉取 >5s」一个入口,而生成时面板一直可见 ⇒ 永远不刷。
|
||||
// ② 格子「插入」补 insertK(与右键/顶部一致,尺寸档不再被忽略)。
|
||||
// ③ 插入/删除补「插入中…」状态,删除改成等宿主删完再重拉(固定 250ms 会拉到未删完的清单)。
|
||||
// 注:搜索框在 v1.6.1 已按用户意见移除,不再加回。
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
if (!global.IWBPluginHost) return
|
||||
@@ -129,8 +136,20 @@
|
||||
setBtn.setAttribute('aria-expanded', 'false')
|
||||
var settings = el('div', { class: 'iwb-gal-settings', role: 'dialog', 'aria-label': '图库设置' })
|
||||
settings.style.display = 'none'
|
||||
// 2026-11-24:底栏加「打开本地图库目录」图标(文件夹),放在设置图标左边;只桌面端可用。
|
||||
var folderBtn = iconBtn('打开本地目录', function (svg) {
|
||||
svgPath(svg, 'M2 4.5h4l1.5 2H14v6.5H2z')
|
||||
}, '在系统文件管理器里打开本地图库目录(images/gallery)')
|
||||
folderBtn.addEventListener('click', function (e) {
|
||||
e.stopPropagation()
|
||||
if (!ctx.gallery || typeof ctx.gallery.openFolder !== 'function') { setStatus('仅桌面端可打开本地目录'); return }
|
||||
Promise.resolve(ctx.gallery.openFolder()).then(function (r) {
|
||||
if (r && r.ok === false) setStatus('打开失败:' + ((r && r.error) || '仅桌面端可用'))
|
||||
}).catch(function (err) { setStatus('打开失败:' + ((err && err.message) || err)) })
|
||||
})
|
||||
folderBtn.style.display = (typeof window !== 'undefined' && window.__TAURI__ && window.__TAURI__.core) ? '' : 'none'
|
||||
// v1.4.2:刷新与设置同放右侧工具组(此前刷新在左侧信息区,空间不足时会向右溢出、压住设置图标)
|
||||
var tools = el('div', { class: 'iwb-gal-tools' }, refreshBtn, setBtn)
|
||||
var tools = el('div', { class: 'iwb-gal-tools' }, refreshBtn, folderBtn, setBtn)
|
||||
var foot = el('div', { class: 'iwb-gal-foot' },
|
||||
el('div', { class: 'iwb-gal-foot-left' }, countEl, pickedEl, failEl, statusEl), tools)
|
||||
var wrap = el('div', { class: 'iwb-history-embedded' }, [head, grid, more, empty, foot, settings])
|
||||
@@ -172,6 +191,7 @@
|
||||
menu.appendChild(b)
|
||||
}
|
||||
item('插入画布', function () {
|
||||
setStatus('插入中…(取本地原图 → 按插入尺寸压缩)')
|
||||
Promise.resolve(ctx.gallery.insert([it.name], { insertK: cfg.insertK || '1k' }))
|
||||
.then(function () { setStatus('已插入:' + it.name) })
|
||||
.catch(function () { setStatus('插入失败') })
|
||||
@@ -190,11 +210,14 @@
|
||||
var ask = (C && C.askOrNative) ? C.askOrNative('删除「' + it.name + '」?不可恢复。', { title: '删除图片', okText: '删除' }) : Promise.resolve(global.confirm('删除「' + it.name + '」?'))
|
||||
ask.then(function (ok) {
|
||||
if (!ok) return
|
||||
// 先本地摘掉,避免删除后还渲染一格「图片已丢失」
|
||||
items = items.filter(function (x) { return x.name !== it.name })
|
||||
total = Math.max(0, total - 1)
|
||||
delete picked[it.name]
|
||||
render()
|
||||
Promise.resolve(ctx.gallery.remove([it.name])).then(function () { setTimeout(load, 250) }).catch(function () {})
|
||||
// v1.7.0:等宿主真的删完再重拉(旧写法固定 setTimeout 250ms,磁盘慢/多张时会拉到还没删完的清单,
|
||||
// 格子里出现「图片已丢失」,用户以为删坏了)
|
||||
return Promise.resolve(ctx.gallery.remove([it.name])).then(function () { return load() }).catch(function () {})
|
||||
}).catch(function () {})
|
||||
})
|
||||
document.body.appendChild(menu)
|
||||
@@ -215,6 +238,7 @@
|
||||
try { names = JSON.parse(raw) } catch (err) { return }
|
||||
if (!names || names.length < 2) return
|
||||
e.preventDefault(); e.stopPropagation()
|
||||
setStatus('插入中…(' + names.length + ' 张)')
|
||||
Promise.resolve(ctx.gallery.insert(names, { insertK: cfg.insertK || '1k' })).then(function (r) {
|
||||
if (r && r.ok === false) { setStatus('批量插入失败'); return }
|
||||
setStatus('已插入 ' + names.length + ' 张')
|
||||
@@ -252,6 +276,7 @@
|
||||
actions.appendChild(btn('插入', '把选中的图片插入画布(尺寸按「设置 → 插入尺寸」)', function () {
|
||||
var names = pickedNames()
|
||||
var k = cfg.insertK || '1k'
|
||||
setStatus('插入中…(' + names.length + ' 张)')
|
||||
Promise.resolve(ctx.gallery.insert(names, { insertK: k })).then(function (r) {
|
||||
if (r && r.ok === false) { setStatus('插入失败'); return }
|
||||
setStatus('已插入 ' + names.length + ' 张(' + String(k).toUpperCase() + ')')
|
||||
@@ -270,7 +295,7 @@
|
||||
picked = {}
|
||||
render()
|
||||
return Promise.resolve(ctx.gallery.remove(names)).then(function () {
|
||||
setTimeout(load, 250)
|
||||
return load() // v1.7.0:等宿主真删完再重拉(固定延时会拉到未删完的清单)
|
||||
})
|
||||
}).catch(function () {})
|
||||
}, true, true))
|
||||
@@ -425,7 +450,13 @@
|
||||
b.addEventListener('click', function (e) { e.stopPropagation(); fn() })
|
||||
return b
|
||||
}
|
||||
acts.appendChild(act('插入', '插入到画布(参考图节点)', function () { ctx.gallery.insert([it.name]).catch(function () {}) }))
|
||||
acts.appendChild(act('插入', '插入到画布(参考图节点 · 尺寸按「设置 → 插入尺寸」)', function () {
|
||||
// v1.7.0:格子里的「插入」此前没带 insertK,宿主按默认 1k 处理 —— 与右键菜单/顶部「插入」不一致
|
||||
setStatus('插入中…')
|
||||
ctx.gallery.insert([it.name], { insertK: cfg.insertK || '1k' }).then(function () {
|
||||
setStatus('已插入:' + it.name)
|
||||
}).catch(function () { setStatus('插入失败') })
|
||||
}))
|
||||
acts.appendChild(act('下载', '下载到本地', function () { doDownload([it.name]) }))
|
||||
box.appendChild(acts)
|
||||
return box
|
||||
@@ -502,11 +533,25 @@
|
||||
|
||||
// v1.3.0:自动恢复 —— 面板重新可见(切回 tab / 窗口聚焦 / 后台回来)且距上次拉取 >5s 时重拉一次,
|
||||
// 这样图床恢复、后台补图后不必手动刷新;同时保留底部「刷新」按钮做即时重试。
|
||||
// v1.7.0:这只是**兜底**。主通道改成宿主主动通知(下面 onChanged)—— 生成途中面板一直是可见的,
|
||||
// 靠「可见性变化」触发永远等不到,用户看到的就是「生图完成但图库没图」。
|
||||
var lastLoadAt = 0
|
||||
var autoRefresh = function () {
|
||||
if (Date.now() - lastLoadAt < 5000) return
|
||||
load()
|
||||
}
|
||||
var unsubChanged = null
|
||||
var changedTimer = 0
|
||||
try {
|
||||
var G = ctx.gallery
|
||||
if (G && typeof G.onChanged === 'function') {
|
||||
unsubChanged = G.onChanged(function () {
|
||||
// 合并同一批的连续通知(一张图会触发「归档完成」一次),260ms 内只重拉一次
|
||||
clearTimeout(changedTimer)
|
||||
changedTimer = setTimeout(function () { load() }, 260)
|
||||
})
|
||||
}
|
||||
} catch (e) { /* 旧宿主没有 onChanged:退回可见性刷新 + 手动刷新 */ }
|
||||
try {
|
||||
if (typeof IntersectionObserver === 'function') {
|
||||
var io = new IntersectionObserver(function (entries) {
|
||||
@@ -533,6 +578,8 @@
|
||||
|
||||
return function dispose () {
|
||||
if (ro) { try { ro.disconnect() } catch (e) { /* ignore */ } }
|
||||
clearTimeout(changedTimer)
|
||||
try { if (typeof unsubChanged === 'function') unsubChanged() } catch (e) { /* ignore */ }
|
||||
try { document.removeEventListener('pointerdown', onMenuDown, true) } catch (e) { /* ignore */ }
|
||||
try { document.removeEventListener('keydown', onMenuKey, true) } catch (e) { /* ignore */ }
|
||||
try { document.removeEventListener('drop', onDocDrop, true) } catch (e) { /* ignore */ }
|
||||
@@ -543,7 +590,7 @@
|
||||
global.IWBPluginHost.register({
|
||||
id: 'gallery',
|
||||
name: '图库',
|
||||
version: '1.6.11',
|
||||
version: '1.7.0',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'gallery'],
|
||||
data: { schemaVersion: 1, maxBytes: 65536 },
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "gallery",
|
||||
"name": "图库",
|
||||
"version": "1.6.11",
|
||||
"version": "1.7.0",
|
||||
"apiVersion": 1,
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
@@ -13,7 +13,7 @@
|
||||
"图库"
|
||||
],
|
||||
"files": {
|
||||
"main.js": "cf456629b21f9001d7cc8016a6af0d2b065aae110ef822b7946e6279ec822f11",
|
||||
"main.js": "77b8e95c06c6811fdee3a832195e2b76bc6197d8bfdf9df0a47a52b6b4dfb38f",
|
||||
"styles.css": "35ae17de8b0f3bddab9cbef6270cd8bbf5153c9ecf6ed2b4f06216f6fef45b8b"
|
||||
}
|
||||
}
|
||||
+11
-5
@@ -22,9 +22,9 @@
|
||||
"dir": "gallery",
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
"version": "1.6.11",
|
||||
"version": "1.7.0",
|
||||
"files": {
|
||||
"main.js": "cf456629b21f9001d7cc8016a6af0d2b065aae110ef822b7946e6279ec822f11",
|
||||
"main.js": "77b8e95c06c6811fdee3a832195e2b76bc6197d8bfdf9df0a47a52b6b4dfb38f",
|
||||
"styles.css": "35ae17de8b0f3bddab9cbef6270cd8bbf5153c9ecf6ed2b4f06216f6fef45b8b"
|
||||
}
|
||||
},
|
||||
@@ -44,10 +44,10 @@
|
||||
"dir": "promptlib",
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
"version": "1.8.24",
|
||||
"version": "1.13.0",
|
||||
"files": {
|
||||
"main.js": "0bab5f57c173d0bf45a16881042d9b3b1973a2afe2e6c3745a27fd5181b793b0",
|
||||
"styles.css": "e14fee1fd446188ef44913cc2d549e02480b10d95a67371078ec4fa623786d60"
|
||||
"main.js": "2108d09bd7cd1d96dfeb8499dac7adacbda659b222606f7d072a2bf8cbf5361a",
|
||||
"styles.css": "e2ba84f2e4251f461e77c78ca39fc2b5022f169cb1a4eae0aa7ef786f28b6863"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -62,6 +62,12 @@
|
||||
"version": "0.6.1",
|
||||
"integrity": "sha256-Dlp/oBiy6d5wX5ESJyrQLc8Ye1NhaW9/wKEqk8TyDU4="
|
||||
},
|
||||
{
|
||||
"id": "sticky",
|
||||
"file": "plugin-sticky.af8e7249f0c7.js",
|
||||
"version": "1.0.7",
|
||||
"integrity": "sha256-r45ySfDHwBDMFUTuWpOpq21cJcqlYtq5DnOKUtndSLI="
|
||||
},
|
||||
{
|
||||
"id": "style-source",
|
||||
"file": "plugin-style-source.05c108f8a63c.js",
|
||||
|
||||
@@ -117,5 +117,16 @@
|
||||
"资源",
|
||||
"提示词"
|
||||
]
|
||||
},
|
||||
"sticky": {
|
||||
"name": "便利贴",
|
||||
"desc": "画布便利贴:多行文本 + 字号/粗细调节 + 8 色背景,纯说明不连线",
|
||||
"author": "official",
|
||||
"icon": "📝",
|
||||
"color": "#fdf3d0",
|
||||
"tags": [
|
||||
"标注",
|
||||
"便签"
|
||||
]
|
||||
}
|
||||
}
|
||||
+618
-134
File diff suppressed because it is too large.
Load diff
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "promptlib",
|
||||
"name": "提示词库",
|
||||
"version": "1.8.24",
|
||||
"version": "1.13.0",
|
||||
"apiVersion": 1,
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
@@ -13,7 +13,7 @@
|
||||
"提示词"
|
||||
],
|
||||
"files": {
|
||||
"main.js": "0bab5f57c173d0bf45a16881042d9b3b1973a2afe2e6c3745a27fd5181b793b0",
|
||||
"styles.css": "e14fee1fd446188ef44913cc2d549e02480b10d95a67371078ec4fa623786d60"
|
||||
"main.js": "2108d09bd7cd1d96dfeb8499dac7adacbda659b222606f7d072a2bf8cbf5361a",
|
||||
"styles.css": "e2ba84f2e4251f461e77c78ca39fc2b5022f169cb1a4eae0aa7ef786f28b6863"
|
||||
}
|
||||
}
|
||||
@@ -146,9 +146,11 @@
|
||||
.iwb-plp-nthumb{width:44px;height:44px;border-radius:8px;object-fit:cover;flex:0 0 auto}
|
||||
.iwb-plp-ntitle{font-weight:600;font-size: 13px;line-height:1.3;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
|
||||
.iwb-plp-nvars{display:flex;flex-direction:column;gap:4px}
|
||||
.iwb-plp-nrow{display:flex;align-items:center;gap:6px;height:26px}
|
||||
.iwb-plp-nk{width:64px;flex:0 0 64px;color:var(--iwb-text2,#5b6472);font-size: 12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.iwb-plp-nin{flex:1;height:24px;font-size: 12px}
|
||||
/* v1.12.1:标签列定宽(此前是 flex:0 0 auto,宽度跟着名称长短变 ⇒ 每个变量输入框左边缘错位)。
|
||||
v1.13.0:用户要求按 4 字定宽 ⇒ 56px(12px 字号 × 4 + 8px 余量)。超过 4 字的名称省略号截断,完整名称在 title 里。 */
|
||||
.iwb-plp-nrow{display:flex;align-items:flex-start;gap:6px;min-height:26px}
|
||||
.iwb-plp-nk{flex:0 0 56px;width:56px;max-width:56px;padding-top:4px;color:var(--iwb-text2,#5b6472);font-size: 12px;line-height:1.35;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.iwb-plp-nin{flex:1 1 auto;min-width:0;height:auto;min-height:24px;padding:2px 8px;line-height:1.5;font-size: 12px;resize:none;overflow-y:hidden}
|
||||
.iwb-plp-nref{display:flex;align-items:center;gap:6px;font-size: 12px;color:var(--iwb-text2,#5b6472);border-top:1px dashed var(--iwb-border,#e3e5e9);padding-top:6px}
|
||||
.iwb-plp-nref em{font-style:normal;color:var(--iwb-text2,#8b929c)}
|
||||
.iwb-plp-nprev{margin-top:2px;border-top:1px dashed var(--iwb-border,#e3e5e9);padding-top:6px;color:var(--iwb-text2,#5b6472);font-size: 12px;line-height:1.6;max-height:88px;overflow:hidden}
|
||||
@@ -157,7 +159,6 @@
|
||||
.iwb-plp-emid{flex:1;min-width:0;display:flex;flex-direction:column;gap:8px}
|
||||
.iwb-plp-vars{border:1px solid var(--iwb-border,#e3e5e9);border-radius:10px;padding:8px 10px;display:flex;flex-direction:column;gap:6px;background:var(--iwb-plugin-surface,#fff)}
|
||||
.iwb-plp-vhead{display:flex;align-items:center;gap:8px;font-size: 12px;color:var(--iwb-text2,#5b6472)}
|
||||
.iwb-plp-vhint{color:var(--iwb-text2,#8b929c);font-size:11px}
|
||||
.iwb-plp-vchips{display:flex;flex-wrap:wrap;gap:6px}
|
||||
.iwb-plp-vchip{display:inline-flex;align-items:center;gap:4px;padding: 2px 6px;border-radius:6px;background:color-mix(in srgb, var(--iwb-plp-accent, #7c4dff) 10%, transparent);color:var(--iwb-plp-accent, #5a4bd0);font-size: 12px}
|
||||
.iwb-plp-vx{font-style:normal;cursor:pointer;color:var(--iwb-plp-accent, #8b7ff0);font-weight:700}
|
||||
@@ -178,9 +179,11 @@
|
||||
|
||||
/* v1.5.10:设置页 */
|
||||
.iwb-plp-settings{display:flex;flex-direction:column;gap: 16px}
|
||||
.iwb-plp-ssec{border:1px solid var(--iwb-border,#e3e5e9);border-radius:12px;padding: 12px 12px;display:flex;flex-direction:column;gap:8px}
|
||||
.iwb-plp-stitle{font-weight:600;font-size: 13px}
|
||||
.iwb-plp-sgroups{display:flex;flex-direction:column;border:1px solid var(--iwb-border,#eef0f2);border-radius:10px;overflow:hidden}
|
||||
/* 2026-11-24:插件设置页跟随宿主的设置分组 token(不再自画卡片,避免卡片套卡片) */
|
||||
.iwb-plp-ssec{border:0;border-top:1px solid var(--iwb-set-divider,var(--iwb-border,#e3e5e9));border-radius:0;padding:var(--iwb-space-12) 0 0;display:flex;flex-direction:column;gap:var(--iwb-space-8)}
|
||||
.iwb-plp-ssec:first-child{border-top:0;padding-top:0}
|
||||
.iwb-plp-stitle{font-weight:600;font-size:var(--iwb-font-md,13px);color:var(--iwb-text,#2a2f36)}
|
||||
.iwb-plp-sgroups{display:flex;flex-direction:column;border:1px solid var(--iwb-set-input-border,var(--iwb-border,#eef0f2));border-radius:var(--iwb-radius-card,10px);overflow:hidden}
|
||||
.iwb-plp-sgrow{display:flex;align-items:center;gap:8px;padding: 6px 10px;border-top:1px solid var(--iwb-border,#f1f3f5)}
|
||||
.iwb-plp-sgrow:first-child{border-top:0}
|
||||
.iwb-plp-sgrip{width:12px;height:12px;background:radial-gradient(var(--iwb-text2,#c2c7cf) 1px,transparent 1px);background-size:4px 4px;border-radius: 6px;flex:0 0 auto}
|
||||
@@ -193,6 +196,8 @@
|
||||
|
||||
/* v1.6.2:正文上方工具行 */
|
||||
.iwb-plp-etool{display:flex;align-items:center;gap:8px}
|
||||
/* v1.13.0:中列变窄时按钮文字会被挤成「+ 插入变 / 量」,按钮不参与收缩,让右边的灰字提示去换行 */
|
||||
.iwb-plp-insvar{flex:0 0 auto;white-space:nowrap}
|
||||
.iwb-plp-insvar{border:1px solid var(--iwb-plp-accent,#d9d3ff);background:color-mix(in srgb,var(--iwb-plp-accent,#7c4dff) 8%,transparent);color:var(--iwb-plp-accent,#5a4bd0);font-weight:600}
|
||||
|
||||
/* v1.6.5:宿主基础样式的插件作用域副本 —— 宿主改全局样式不再影响插件 */
|
||||
@@ -346,6 +351,11 @@ height: 1px; margin: 4px 6px; background: var(--iwb-border); flex: 0 0 auto;
|
||||
.iwb-promptlib .iwb-drawer-spacer {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
/* v1.10.1:详情底部分享组(文本/文件分享)与插入组之间的竖向分割线 */
|
||||
.iwb-plp-dialog .iwb-plp-foot-vsep {
|
||||
display: inline-block; width: 1px; height: 18px; flex: 0 0 auto;
|
||||
align-self: center; margin: 0 12px; background: var(--iwb-border);
|
||||
}
|
||||
.iwb-plp-dialog .iwb-section-sub {
|
||||
margin-top: 2px;
|
||||
}
|
||||
@@ -412,6 +422,18 @@ body.iwb-plp-dragging, body.iwb-plp-dragging *{user-select:none!important;-webki
|
||||
.iwb-plp-vi{flex:0 0 auto;width:24px;height:24px;padding:0;border-radius:50%;border:1px solid var(--iwb-border,#dfe3e9);background: var(--iwb-plugin-card, #fff);color: var(--iwb-text-dim, #9aa1ac);font-size:11px;line-height:22px;text-align:center}
|
||||
.iwb-plp-vi.is-open{background: var(--iwb-plp-accent-soft, #f1ecff);border-color: var(--iwb-plp-accent-border, #d8cbff);color: var(--iwb-plp-accent, #5a3fd0)}
|
||||
.iwb-plp-vdesc{width:100%;height:28px;margin-top: 6px;border-style:dashed;background: var(--iwb-field, #fbfcfd);font-size: 12px;color: var(--plp-c3, #6b7280)}
|
||||
/* v1.12.0:变量编辑器折叠两态(收起一行名称+摘要,展开四字段)与内容多行框 */
|
||||
.iwb-plp-vrow2{cursor:pointer}
|
||||
.iwb-plp-vcaret{flex:0 0 12px;width:12px;text-align:center;font-size:11px;line-height:32px;color:var(--iwb-text2,#8b929c)}
|
||||
.iwb-plp-vlabelx{flex:1 1 auto;min-width:0;font-size:13px;line-height:32px;color:var(--iwb-text,#2a2f36);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.iwb-plp-vlabelx.is-empty{color:var(--iwb-text2,#8b929c)}
|
||||
.iwb-plp-vsum{flex:0 0 auto;font-size:11px;line-height:32px;white-space:nowrap;color:var(--iwb-text2,#8b929c)}
|
||||
.iwb-plp-vfield{display:flex;align-items:flex-start;gap:8px;margin-top:6px}
|
||||
.iwb-plp-vflabel{flex:0 0 40px;padding-top:8px;font-size:12px;color:var(--iwb-text2,#8b929c)}
|
||||
.iwb-plp-vbody{flex:1 1 auto;min-width:0}
|
||||
.iwb-plp-vbody .iwb-input{width:100%}
|
||||
.iwb-plp-vbody .iwb-plp-vdesc{margin-top:0}
|
||||
.iwb-plp-vdef{height:auto;min-height:66px;padding:4px 10px;line-height:1.65;font-size:12px;resize:none;overflow-y:hidden}
|
||||
.iwb-plp-dcov{flex:0 0 auto;width:180px;height:180px;border-radius:12px;overflow:hidden}
|
||||
.iwb-plp-dvar{background: var(--iwb-plp-accent-soft, #f1ecff);color: var(--iwb-plp-accent, #5a3fd0);border-radius: 6px;padding:0 4px;font-weight:500}
|
||||
/* v1.7.1:编辑面板视觉精修——输入框比底色更亮、去多余边框、细分隔线 */
|
||||
@@ -482,7 +504,8 @@ body.iwb-plp-dragging, body.iwb-plp-dragging *{user-select:none!important;-webki
|
||||
tab-size:4!important;
|
||||
}
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap .iwb-plp-etext{overflow-y:auto!important;scrollbar-gutter:stable}
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-hl{overflow:hidden!important}
|
||||
/* v1.9.3:高亮层与 textarea 用同样的滚动条占位,避免换行位置不一致导致色块漂移 */
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap .iwb-plp-hl{overflow:hidden!important;scrollbar-gutter:stable}
|
||||
/* v1.7.9:详情正文独立滚动,长文不再压到底部按钮 */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{overflow:hidden;align-items:stretch}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dright{flex:1 1 auto;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden}
|
||||
@@ -555,8 +578,17 @@ body.iwb-plp-dragging, body.iwb-plp-dragging *{user-select:none!important;-webki
|
||||
.iwb-plp-dialog .iwb-plp-dcov .iwb-plp-cover,.iwb-plp-dialog .iwb-plp-ecov .iwb-plp-cover{background:transparent!important}
|
||||
/* v1.8.19:编辑区高亮变量不得加粗——加粗会改变字形宽度,导致点击位置逐次向左偏移 */
|
||||
.iwb-plp-hlvar{font-weight:400!important;letter-spacing:normal!important}
|
||||
/* v1.8.20:编辑区不再用透明 textarea+高亮层(两层字体/换行差异会让点击坐标逐次偏移);正文直接由 textarea 渲染,插入点 100% 对应光标 */
|
||||
.iwb-plp-ewrap .iwb-plp-hl{display:none!important}
|
||||
/* v1.9.3:变量着色改为「textarea 只负责文字 + 背层只画浅主色色块」——
|
||||
两层字体/换行/滚动条占位由 v1.7.7 规则保持一致,变量 span 沿用 400 字重(不加粗,宽度不漂移),
|
||||
文字仍由 textarea 自己画(可见),所以插入点/点击/选区完全不受影响。
|
||||
注:v1.8.20 停用高亮层是因为当时「透明 textarea + 背层画文字」两层文字错位;本版不画文字,只画色块,不会复发。 */
|
||||
.iwb-plp-ewrap .iwb-plp-hl{display:block!important;color:transparent!important;-webkit-text-fill-color:transparent!important}
|
||||
.iwb-plp-hlvar{color:transparent!important;-webkit-text-fill-color:transparent!important;background:color-mix(in srgb, var(--iwb-plp-accent, #7c4dff) 16%, transparent);border-radius:6px;box-shadow:0 0 0 1px color-mix(in srgb, var(--iwb-plp-accent, #7c4dff) 22%, transparent)}
|
||||
.iwb-plp-ewrap .iwb-plp-etext{color:var(--iwb-text,#2a2f36)!important;background:transparent!important}
|
||||
/* v1.8.21:高亮层隐藏后,正文文字必须可见(覆盖旧的 transparent !important) */
|
||||
/* v1.8.21:正文文字必须可见(覆盖旧的 transparent !important) */
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap .iwb-plp-etext{color:var(--iwb-text,#2a2f36)!important;caret-color:var(--iwb-text,#2a2f36)!important;-webkit-text-fill-color:var(--iwb-text,#2a2f36)!important}
|
||||
/* v1.9.3:右侧变量名与详情正文里的变量也用主色呼应(只读区,零功能风险) */
|
||||
.iwb-plp-dialog .iwb-plp-vname{color:var(--iwb-plp-accent,#5a3fd0)}
|
||||
.iwb-plp-dialog .iwb-plp-dvar{color:var(--iwb-plp-accent,#5a3fd0);background:var(--iwb-plp-accent-soft,#f1ecff);border-radius:6px;padding:0 2px}
|
||||
/* 回滚开关:若真机发现任何点击/光标异常,把下行打开即回到 v1.8.20 纯 textarea 状态。
|
||||
.iwb-plp-ewrap .iwb-plp-hl{display:none!important} */
|
||||
@@ -0,0 +1,469 @@
|
||||
// iwb-plugin: 画布便利贴 —— 多行文本 + 字号/粗细调节 + 8 色背景,纯标注节点不连线。
|
||||
//
|
||||
// 设计口径(用户 2026-11-24 确认):
|
||||
// - 不要"标题"概念:便签上方那条"便利贴"标签是宿主强制的标题带(hasTitle 写死),
|
||||
// 节点名注册成"便利贴"即可,用户不用再填标题字段。
|
||||
// - 想当说明标题就把字号调大(无上限,A+ 每点一次 +2),想放多行正文就用小字(默认 14)。
|
||||
// - 不连线:ports:{in:false,out:false}。
|
||||
// - 节点缩放用宿主自带手柄(右下角),插件不设宽高。
|
||||
//
|
||||
// 状态全部存 node.data(props.onUpdate 写回,随画布落盘):
|
||||
// text / fontSize / fontWeight / bgColor
|
||||
// 字号:A−/A+ 每步 ±2,下限 6、无上限(用户明确要求去掉最大字号限制);
|
||||
// 8 个预设色是运行时数据、色轮走系统颜色选择器,源码里不写死中性色(守门只卡字面量)。
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
|
||||
if (!global.IWBPluginHost) return
|
||||
|
||||
// 必须在脚本执行时就注入:面板可能瞬间挂载、节点可能从存档直接出现(面板从不 mount)。
|
||||
function ensureStyle() {
|
||||
if (typeof document === 'undefined' || !document.createElement) return
|
||||
if (document.getElementById('iwb-sticky-style')) return
|
||||
var css = '' +
|
||||
'#iwb-sticky-style{}' +
|
||||
'[hidden]{display:none!important}' +
|
||||
'.iwb-sticky-panel{display:flex;flex-direction:column;gap:12px;font-size:13px;color:var(--iwb-text,#1c2333)}' +
|
||||
'.iwb-sticky-panel-tip{font-size:12px;line-height:1.6;color:var(--iwb-text2,#4d5668);opacity:.9}' +
|
||||
'.iwb-sticky-add{cursor:pointer;border:1px solid var(--iwb-brand,#6b7280);border-radius:8px;background:var(--iwb-layer2,#fff);color:var(--iwb-text,#1c2333);font-size:13px;padding:10px 14px;font-family:inherit}' +
|
||||
'.iwb-sticky-add:hover{background:var(--iwb-hover,#f0f1f4)}' +
|
||||
'.iwb-sticky-list{display:flex;flex-direction:column;gap:8px;margin-top:4px}' +
|
||||
'.iwb-sticky-row{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 10px;border:1px solid var(--iwb-border,#d5d9e0);border-radius:8px;background:var(--iwb-layer,#f5f6f8)}' +
|
||||
'.iwb-sticky-row-txt{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}' +
|
||||
'.iwb-sticky-go{cursor:pointer;border:1px solid var(--iwb-border,#d5d9e0);border-radius:6px;background:var(--iwb-layer2,#fff);color:var(--iwb-text,#1c2333);font-size:12px;padding:4px 10px;white-space:nowrap;font-family:inherit}' +
|
||||
'.iwb-sticky-go:hover{border-color:var(--iwb-brand,#6b7280)}' +
|
||||
// ---- 节点体 ----
|
||||
// 宿主容器 .iwb-plugin-node-body 是 flex 列且 padding:0;这里必须 flex:1 撑满,
|
||||
// 不能只写 height:100%(WKWebView 下百分比对 flex 项算不准,拖大后下半露出宿主底色)。
|
||||
// 圆角对齐宿主节点:外框 .iwb-node 用 var(--iwb-node-radius)=14px 且有 1px 边框,
|
||||
// 纸片在框内 ⇒ 内圈半径 = 外圈 - 1px,选中时两层边缘才不会错开。
|
||||
'.iwb-sticky-node{position:relative;display:flex;flex-direction:column;flex:1 1 auto;min-height:0;width:100%;box-sizing:border-box;border-radius:calc(var(--iwb-node-radius, 14px) - 1px);overflow:visible}' +
|
||||
'.iwb-sticky-tools{display:flex;align-items:center;gap:6px;padding:6px 8px;border-bottom:1px solid rgba(0,0,0,.08);flex:0 0 auto;position:relative;z-index:2}' +
|
||||
'.iwb-sticky-btn{cursor:pointer;border:1px solid rgba(0,0,0,.2);border-radius:6px;background:transparent;color:inherit;font-size:11px;padding:2px 6px;font-family:inherit;line-height:1.4;user-select:none}' +
|
||||
'.iwb-sticky-btn:hover{background:rgba(0,0,0,.07)}' +
|
||||
'.iwb-sticky-btn-on{font-weight:600;background:rgba(0,0,0,.1)}' +
|
||||
// 调色圆点推到工具条最右端(右上),色板 right:8px 与圆点右缘对齐,落在其正下方。
|
||||
'.iwb-sticky-dot{display:inline-block;width:14px;height:14px;border-radius:50%;border:1px solid rgba(0,0,0,.25);cursor:pointer;vertical-align:middle;padding:0;margin-left:auto}' +
|
||||
'.iwb-sticky-dot-on{box-shadow:0 0 0 2px rgba(0,0,0,.55)}' +
|
||||
'.iwb-sticky-pal{position:absolute;top:100%;right:8px;z-index:20;display:grid;grid-template-columns:repeat(4,18px);gap:8px 6px;padding:10px;border-radius:10px;border:1px solid var(--iwb-border,#d5d9e0);background:var(--iwb-layer2,#fff);box-shadow:0 4px 16px rgba(0,0,0,.18)}' +
|
||||
'.iwb-sticky-pal-sw{width:18px;height:18px;border-radius:50%;border:1px solid rgba(0,0,0,.2);cursor:pointer;padding:0}' +
|
||||
'.iwb-sticky-wheel{grid-column:1/-1;display:flex;justify-content:center;padding-top:8px;border-top:1px solid var(--iwb-border,#d5d9e0)}' +
|
||||
'.iwb-sticky-wheel-btn{cursor:pointer;width:22px;height:22px;border-radius:50%;border:0;padding:0;background:conic-gradient(#e24b4a,#ef9f27,#fac775,#639922,#1d9e75,#378add,#7f77dd,#d4537e,#e24b4a)}' +
|
||||
// 高度随内容自适应(贴字):不再 flex:1 撑满剩余空间,否则字号大/文字少时
|
||||
// 下方留出大片空白;高度由 syncSkeleton 按行数×字号算,宿主外框 height:auto
|
||||
// 会跟着内容收缩,resize 手柄就能拖到贴字。overflow:hidden 避免自适应高度出滚动条。
|
||||
'.iwb-sticky-body{flex:0 0 auto;min-height:1.7em;width:100%;box-sizing:border-box;resize:none;border:0;outline:0;background:transparent;color:inherit;font-family:inherit;line-height:1.7;padding:12px;overflow:hidden;overflow-wrap:anywhere;cursor:move}' +
|
||||
// 与宿主文本节点一致:只读态单击穿透给节点拖动/选中;双击进入编辑才变 text 光标。
|
||||
// 宿主 style.css 有 `.iwb-node textarea[readonly]{pointer-events:none}`,这里用自身 class 兜底。
|
||||
'.iwb-sticky-body.iwb-sticky-editing{cursor:text}' +
|
||||
'.iwb-sticky-body::placeholder{opacity:.45}' +
|
||||
'.iwb-sticky-color-input{position:absolute;width:0;height:0;opacity:0;pointer-events:none}'
|
||||
try {
|
||||
var styleEl = el('style', { text: css })
|
||||
styleEl.setAttribute('id', 'iwb-sticky-style')
|
||||
;(document.head || document.documentElement).appendChild(styleEl)
|
||||
} catch (e) { /* 样式注入失败不影响功能 */ }
|
||||
}
|
||||
|
||||
// 插件面板/节点体是真实 DOM(不是 React vDOM):createElement + addEventListener。
|
||||
function el(tag, attrs, kids) {
|
||||
var node = document.createElement(tag)
|
||||
if (attrs) {
|
||||
for (var key in attrs) {
|
||||
var value = attrs[key]
|
||||
if (value === null || value === undefined) continue
|
||||
if (key === 'class' || key === 'className') node.className = value
|
||||
else if (key === 'text') node.textContent = String(value)
|
||||
else if (key === 'hidden') node.hidden = Boolean(value)
|
||||
else if (key.slice(0, 2) === 'on') node.addEventListener(key.slice(2).toLowerCase(), value)
|
||||
else node.setAttribute(key, String(value))
|
||||
}
|
||||
}
|
||||
if (kids !== null && kids !== undefined) {
|
||||
var list = Array.isArray(kids) ? kids : [kids]
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
if (list[i] === null || list[i] === undefined || list[i] === false) continue
|
||||
node.appendChild(typeof list[i] === 'string' ? document.createTextNode(list[i]) : list[i])
|
||||
}
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
var MIN_SIZE = 6 // 下限(用户只要求取消上限,下限保留防误操作缩到看不见)
|
||||
var SIZE_STEP = 2 // A−/A+ 每步 ±2
|
||||
var DEFAULT_SIZE = 14
|
||||
var PALETTE = [
|
||||
{ name: '黄', value: '#FCE8B0' },
|
||||
{ name: '粉', value: '#F4C0D1' },
|
||||
{ name: '橙', value: '#EF9F27' },
|
||||
{ name: '绿', value: '#9FE1CB' },
|
||||
{ name: '蓝', value: '#B5D4F4' },
|
||||
{ name: '浅紫', value: '#CECBF6' },
|
||||
{ name: '玫红', value: '#ED93B1' },
|
||||
{ name: '灰', value: '#D3D1C7' },
|
||||
]
|
||||
var DEFAULT_BG = '#FCE8B0'
|
||||
|
||||
// 只保证是 >= 下限的有限数,不再钳到闭集/上限;A+ 可无限放大。
|
||||
function normSize(v) {
|
||||
var n = Number(v)
|
||||
if (!isFinite(n) || n < MIN_SIZE) return DEFAULT_SIZE
|
||||
return Math.round(n)
|
||||
}
|
||||
|
||||
// 依据背景亮度取黑/白文字(运行时计算,源码里不写死中性色)。
|
||||
function textColorOf(hex) {
|
||||
var m = /^#?([0-9a-f]{6})$/i.exec(String(hex || ''))
|
||||
if (!m) return '#1c2333'
|
||||
var n = parseInt(m[1], 16)
|
||||
var r = (n >> 16) & 255, g = (n >> 8) & 255, b = n & 255
|
||||
// 相对亮度(sRGB 简化)
|
||||
var lum = (0.299 * r + 0.587 * g + 0.114 * b) / 255
|
||||
return lum < 0.55 ? '#ffffff' : '#1c2333'
|
||||
}
|
||||
|
||||
// 脚本执行时就注入(不等 setup / mount,存档直入画布也有样式)。
|
||||
ensureStyle()
|
||||
|
||||
var ctxRef = null
|
||||
|
||||
// ---------------- 节点体 ----------------
|
||||
// 宿主契约:render(node, props, host) 往 host 这个真实 DOM 里画,不是返回 vDOM。
|
||||
// host 由宿主固定、不重建;插件自己缓存骨架 + 幂等同步,编辑中的 textarea 不覆盖值。
|
||||
function renderSticky(node, props, host) {
|
||||
ensureStyle()
|
||||
var data = (node && node.data) || {}
|
||||
var st = host.__sticky
|
||||
if (!st) {
|
||||
host.textContent = ''
|
||||
st = host.__sticky = buildSkeleton(host, props)
|
||||
}
|
||||
st.node = node
|
||||
st.props = props
|
||||
syncSkeleton(st, data, node)
|
||||
}
|
||||
|
||||
function buildSkeleton(host, props) {
|
||||
var root = el('div', { className: 'iwb-sticky-node' })
|
||||
var tools = el('div', { className: 'iwb-sticky-tools' })
|
||||
|
||||
var minus = el('button', { className: 'iwb-sticky-btn', type: 'button', title: '缩小字号', 'data-act': 'minus' }, '−')
|
||||
var plus = el('button', { className: 'iwb-sticky-btn', type: 'button', title: '放大字号', 'data-act': 'plus' }, '+')
|
||||
var bold = el('button', { className: 'iwb-sticky-btn', type: 'button', title: '切换粗细', 'data-act': 'bold' }, 'B')
|
||||
var dot = el('button', { className: 'iwb-sticky-dot', type: 'button', title: '背景色', 'data-act': 'palette' })
|
||||
var pal = el('div', { className: 'iwb-sticky-pal', hidden: true })
|
||||
var colorInput = el('input', { type: 'color', className: 'iwb-sticky-color-input', 'data-act': 'color' })
|
||||
// rows=1 是关键:textarea 默认 rows=2,fitBody() 把高度设 auto 读 scrollHeight 时,
|
||||
// 单行文字也会被算成两行高(用户报的“预留了一行文本高度”)。显式 1 行后,
|
||||
// scrollHeight 才等于真实内容行数——多行文本仍会自动换行、高度跟着涨。
|
||||
var body = el('textarea', { className: 'iwb-sticky-body', rows: '1', spellcheck: 'false', placeholder: '双击编辑…' })
|
||||
// 对齐宿主文本节点:默认只读。宿主 CSS `.iwb-node textarea[readonly]{pointer-events:none}`
|
||||
// ⇒ 单击穿透给节点卡片(选中/拖动);双击由本插件在 root 上接管进入编辑。
|
||||
body.readOnly = true
|
||||
body.setAttribute('readonly', '')
|
||||
|
||||
tools.appendChild(minus); tools.appendChild(plus); tools.appendChild(bold); tools.appendChild(dot)
|
||||
// 色板挂在工具条内(tools 已 position:relative):CSS top:100% 落在调色按钮正下方,
|
||||
// 而不是贴整个便签底部右下角(那样会盖住宿主 resize 手柄、且离按钮很远)。
|
||||
tools.appendChild(pal)
|
||||
root.appendChild(tools); root.appendChild(colorInput); root.appendChild(body)
|
||||
host.appendChild(root)
|
||||
|
||||
var st = { root: root, tools: tools, minus: minus, plus: plus, bold: bold, dot: dot,
|
||||
pal: pal, colorInput: colorInput, body: body, data: null, palOpen: false, editing: false }
|
||||
|
||||
function onTool(e) {
|
||||
var t = e.target || {}
|
||||
var act = t.getAttribute && t.getAttribute('data-act')
|
||||
if (!act) return
|
||||
e.stopPropagation && e.stopPropagation()
|
||||
var d = (st.node && st.node.data) || {}
|
||||
var up = st.props && st.props.onUpdate
|
||||
var id = st.node && st.node.id
|
||||
if (!up || !id) return
|
||||
if (act === 'minus' || act === 'plus') {
|
||||
var cur = normSize(d.fontSize == null ? DEFAULT_SIZE : d.fontSize)
|
||||
var next = act === 'minus' ? Math.max(MIN_SIZE, cur - SIZE_STEP) : cur + SIZE_STEP
|
||||
if (next !== cur) up(id, { fontSize: next })
|
||||
} else if (act === 'bold') {
|
||||
up(id, { fontWeight: d.fontWeight === 600 ? 400 : 600 })
|
||||
} else if (act === 'palette') {
|
||||
st.palOpen = !st.palOpen
|
||||
pal.hidden = !st.palOpen
|
||||
}
|
||||
}
|
||||
tools.addEventListener('click', onTool)
|
||||
|
||||
// 色板里的色块 + 色轮(事件委托到 pal)
|
||||
for (var i = 0; i < PALETTE.length; i++) {
|
||||
var sw = el('button', { type: 'button', className: 'iwb-sticky-pal-sw', 'data-bg': PALETTE[i].value,
|
||||
title: PALETTE[i].name, style: 'background:' + PALETTE[i].value })
|
||||
pal.appendChild(sw)
|
||||
}
|
||||
var wheelWrap = el('div', { className: 'iwb-sticky-wheel' })
|
||||
var wheel = el('button', { type: 'button', className: 'iwb-sticky-wheel-btn', title: '自定义颜色', 'data-act': 'wheel' })
|
||||
wheelWrap.appendChild(wheel); pal.appendChild(wheelWrap)
|
||||
|
||||
function onPal(e) {
|
||||
var t = e.target || {}
|
||||
e.stopPropagation && e.stopPropagation()
|
||||
var up = st.props && st.props.onUpdate
|
||||
var id = st.node && st.node.id
|
||||
if (!up || !id) return
|
||||
var bg = t.getAttribute && t.getAttribute('data-bg')
|
||||
if (bg) {
|
||||
up(id, { bgColor: bg })
|
||||
st.palOpen = false; pal.hidden = true
|
||||
return
|
||||
}
|
||||
var act = t.getAttribute && t.getAttribute('data-act')
|
||||
if (act === 'wheel') {
|
||||
// 点开系统取色器后这个浮层就完成使命:无论最终确认还是取消都先收起,
|
||||
// 避免取色器关闭后色板还压在便签上(用户报的“自定义调色后面板不退出”)。
|
||||
st.palOpen = false; pal.hidden = true
|
||||
try { colorInput.click() } catch (e2) { /* noop */ }
|
||||
}
|
||||
}
|
||||
pal.addEventListener('click', onPal)
|
||||
|
||||
function onColor(e) {
|
||||
var up = st.props && st.props.onUpdate
|
||||
var id = st.node && st.node.id
|
||||
if (up && id && e.target && e.target.value) up(id, { bgColor: e.target.value })
|
||||
// 自定义色确认后兜底再收一次(个别平台 change 先于上面的收起逻辑到达)。
|
||||
st.palOpen = false; pal.hidden = true
|
||||
}
|
||||
colorInput.addEventListener('change', onColor)
|
||||
|
||||
// ---- 正文编辑状态机(照宿主文本节点:双击进编辑、失焦退出、只读态单击穿透)----
|
||||
function setEditing(on) {
|
||||
st.editing = on
|
||||
body.readOnly = !on
|
||||
if (on) { try { body.removeAttribute('readonly') } catch (e2) { /* noop */ } }
|
||||
else body.setAttribute('readonly', '')
|
||||
body.className = 'iwb-sticky-body' + (on ? ' iwb-sticky-editing' : '')
|
||||
}
|
||||
|
||||
// 双击进入编辑:绑在 root 上(不是 readonly textarea —— 它 pointer-events:none 收不到双击)。
|
||||
// 宿主卡片 onDoubleClick 只处理内置文本类型,plugin: 节点它不接管,所以这里自己 stopPropagation。
|
||||
function onDblClick(e) {
|
||||
// 工具条/色板/按钮上的双击不进编辑
|
||||
var t = e.target || {}
|
||||
if (t.getAttribute && t.getAttribute('data-act')) return
|
||||
if (t.getAttribute && t.getAttribute('data-bg')) return
|
||||
e.stopPropagation && e.stopPropagation()
|
||||
setEditing(true)
|
||||
try { body.focus() } catch (e2) { /* noop */ }
|
||||
}
|
||||
root.addEventListener('dblclick', onDblClick)
|
||||
|
||||
// 编辑态:按下/按键不冒泡给宿主(否则会拖节点 / 触发画布快捷键);失焦退出编辑。
|
||||
;['pointerdown', 'mousedown'].forEach(function (ev) {
|
||||
body.addEventListener(ev, function (e) {
|
||||
if (st.editing) e.stopPropagation && e.stopPropagation()
|
||||
// 只读态不拦:让宿主选中节点 + 拖动
|
||||
})
|
||||
})
|
||||
body.addEventListener('keydown', function (e) {
|
||||
e.stopPropagation && e.stopPropagation()
|
||||
if (e.key === 'Escape') { try { body.blur() } catch (e2) { /* noop */ } }
|
||||
})
|
||||
body.addEventListener('blur', function () { setEditing(false) })
|
||||
|
||||
// 输入即写回(防抖交给宿主的 commitCanvas),编辑中不重建 DOM 故不失焦。
|
||||
function onInput(e) {
|
||||
var up = st.props && st.props.onUpdate
|
||||
var id = st.node && st.node.id
|
||||
if (up && id) up(id, { text: e.target.value })
|
||||
e.stopPropagation && e.stopPropagation()
|
||||
}
|
||||
body.addEventListener('input', onInput)
|
||||
|
||||
st._listeners = { tools: onTool, pal: onPal, color: onColor, input: onInput, dblclick: onDblClick, setEditing: setEditing }
|
||||
return st
|
||||
}
|
||||
|
||||
// textarea 高度贴字:数据(文本/字号)变了才重算,避免每次 render 都 reflow。
|
||||
// 设 auto → 读 scrollHeight → 写回,是 textarea 自适应的标准做法;浏览器里行数/自动换行都算准。
|
||||
function fitBody(st, text, size) {
|
||||
if (st.fitText === text && st.fitSize === size) return
|
||||
st.fitText = text; st.fitSize = size
|
||||
var b = st.body
|
||||
var prev = b.style.height
|
||||
b.style.height = 'auto'
|
||||
var h = b.scrollHeight
|
||||
b.style.height = (h && h > 0 ? h : Math.max(1, text.split('\n').length) * Math.round(size * 1.7) + 24) + 'px'
|
||||
// 高度没变就不留空字符串(兼容 stub:style.height 是普通对象)
|
||||
if (!b.style.height && prev) b.style.height = prev
|
||||
}
|
||||
|
||||
// 宿主 NodeCard 把 node.h 当作 minHeight 写在外框上(style.minHeight = node.h, height:auto)。
|
||||
// 这就是 v1.0.2「内容贴字了但外框还有一截空白、手柄拖不下去」的真正原因:插件只改了
|
||||
// textarea 高度,外框仍被 node.h 撑住。这里做两件事:
|
||||
// 1. 内容高度 = 工具条 + 正文(不用 root.offsetHeight:root 会被旧的 minHeight 拉高,
|
||||
// 读出来还是旧高度,会自我锁死);
|
||||
// 2. 首次遇到「旧 h 明显大于内容」时把 node.h 校正到内容高度,顺手把外框 minHeight
|
||||
// 覆盖成同一个值——resize 起点 (onResizeStart 读 n0.h) 才和实际视觉一致,拖小立刻生效。
|
||||
// 区分两种 h:
|
||||
// - 插件自动跟随内容写出的 h:内容长高就涨、缩回就降(v1.0.6 修的「两行退回一行不缩」);
|
||||
// - 用户拖手柄改出的 h:h 相对上一帧变了 ⇒ 尊重手动尺寸,只在内容超过它时顶一下。
|
||||
// 首次遇到的旧大 h 校正一次(staleH),之后进入自动跟随。
|
||||
function fitOuterBox(st, node) {
|
||||
if (!st || !st.root || !node) return
|
||||
var toolsH = st.tools.offsetHeight || 30
|
||||
var bodyH = parseFloat(st.body.style.height) || 0
|
||||
if (!bodyH) return
|
||||
var content = Math.round(toolsH + bodyH + 2) // +2 = 宿主节点上下各 1px 边框
|
||||
var h = Number(node.h) || 0
|
||||
if (st.staleH == null) st.staleH = h
|
||||
|
||||
if (st.lastBoxH != null && h !== st.lastBoxH) {
|
||||
// 外部(用户拖手柄)改了 h:退出自动跟随,保留手动尺寸
|
||||
st.autoFollow = false
|
||||
} else if (st.autoFollow == null) {
|
||||
// 首帧:旧 h 若明显大于内容,先校正一次,然后进入自动跟随
|
||||
if (h > content + 2 && st.staleH === h) { node.h = content; h = content }
|
||||
st.autoFollow = true
|
||||
}
|
||||
|
||||
if (st.autoFollow) {
|
||||
// 自动跟随:文本/字号增减都双向贴合(这是两行退回一行能缩回去的关键)
|
||||
if (Math.abs(h - content) > 1) { node.h = content; h = content }
|
||||
} else if (h < content - 2) {
|
||||
// 手动尺寸只在内容超出时才顶高,不覆盖用户主动拖大的高度
|
||||
node.h = content; h = content
|
||||
}
|
||||
st.lastBoxH = h
|
||||
var floor = Math.max(content, Number(node.h) || 0)
|
||||
// root → host(.iwb-plugin-node-body) → card(.iwb-node)
|
||||
var card = st.root.parentNode && st.root.parentNode.parentNode
|
||||
if (card && card.style && card.style.minHeight !== floor + 'px') card.style.minHeight = floor + 'px'
|
||||
}
|
||||
|
||||
function syncSkeleton(st, data, node) {
|
||||
var bg = data.bgColor || DEFAULT_BG
|
||||
var size = normSize(data.fontSize == null ? DEFAULT_SIZE : data.fontSize)
|
||||
var weight = data.fontWeight === 600 ? 600 : 400
|
||||
var text = data.text == null ? '' : String(data.text)
|
||||
var color = textColorOf(bg)
|
||||
|
||||
// 幂等:只在值真的变了才写 DOM,避免重建/覆盖正在编辑的 textarea。
|
||||
if (st.root.style.background !== bg) st.root.style.background = bg
|
||||
if (st.root.style.color !== color) st.root.style.color = color
|
||||
if (!st.editing && document.activeElement !== st.body && st.body.value !== text) st.body.value = text
|
||||
if (st.body.style.fontSize !== size + 'px') st.body.style.fontSize = size + 'px'
|
||||
if (st.body.style.fontWeight !== String(weight)) st.body.style.fontWeight = String(weight)
|
||||
fitBody(st, text, size)
|
||||
fitOuterBox(st, node)
|
||||
if (st.bold.className !== 'iwb-sticky-btn' + (weight === 600 ? ' iwb-sticky-btn-on' : '')) {
|
||||
st.bold.className = 'iwb-sticky-btn' + (weight === 600 ? ' iwb-sticky-btn-on' : '')
|
||||
}
|
||||
if (st.dot.style.background !== bg) st.dot.style.background = bg
|
||||
}
|
||||
|
||||
// ---------------- 面板 ----------------
|
||||
var ctxForPanel = null
|
||||
var noteList = []
|
||||
|
||||
function refreshList() {
|
||||
if (!ctxForPanel) return
|
||||
var host = ctxForPanel.__stickyPanelRoot
|
||||
if (!host || typeof host.innerHTML !== 'undefined' && !host.innerHTML && !host.appendChild) return
|
||||
var list = host.querySelector ? host.querySelector('.iwb-sticky-list') : null
|
||||
if (!list) return
|
||||
// 尽力从画布读回便利贴节点(只读画布能力给了 getNodes)
|
||||
var nodes = []
|
||||
try {
|
||||
var api = ctxRef && ctxRef.canvas
|
||||
if (api && typeof api.getNodes === 'function') nodes = api.getNodes() || []
|
||||
} catch (e) { nodes = [] }
|
||||
var mine = nodes.filter(function (n) { return String(n.type || '').indexOf('plugin:sticky:') === 0 })
|
||||
// 用最近插入的本地记录补足(getNodes 快照不含自定义状态没关系,这里只显示文本)
|
||||
var seen = {}
|
||||
var rows = []
|
||||
mine.concat(noteList).forEach(function (n) {
|
||||
var key = n.id
|
||||
if (!key || seen[key]) return
|
||||
seen[key] = 1
|
||||
var text = String((n.data && n.data.text) || '').replace(/\s+/g, ' ').slice(0, 30) || '(空便利贴)'
|
||||
rows.push({ id: key, text: text })
|
||||
})
|
||||
while (list.firstChild) list.removeChild(list.firstChild)
|
||||
rows.slice(-20).forEach(function (r) {
|
||||
var row = el('div', { className: 'iwb-sticky-row' })
|
||||
row.appendChild(el('span', { className: 'iwb-sticky-row-txt' }, r.text))
|
||||
var go = el('button', { className: 'iwb-sticky-go', type: 'button' }, '定位')
|
||||
go.addEventListener('click', function () {
|
||||
try { if (ctxRef && ctxRef.canvas && typeof ctxRef.canvas.focusNode === 'function') ctxRef.canvas.focusNode(r.id) } catch (e) { /* noop */ }
|
||||
})
|
||||
row.appendChild(go)
|
||||
list.appendChild(row)
|
||||
})
|
||||
}
|
||||
|
||||
function mountPanel(host, ctx) {
|
||||
ensureStyle()
|
||||
ctxForPanel = ctx
|
||||
host.textContent = ''
|
||||
host.style.minWidth = '0'; host.style.minHeight = '0'; host.style.height = '100%'
|
||||
var wrap = el('div', { className: 'iwb-sticky-panel' })
|
||||
wrap.appendChild(el('div', { className: 'iwb-sticky-panel-tip' },
|
||||
'在画布上放一张便利贴:字调大当说明标题,字调小放多行正文。点右下角拖动手柄可改变便签大小。'))
|
||||
var add = el('button', { className: 'iwb-sticky-add', type: 'button' }, '+ 插入便利贴')
|
||||
add.addEventListener('click', function () { insertNote() })
|
||||
wrap.appendChild(add)
|
||||
var list = el('div', { className: 'iwb-sticky-list' })
|
||||
wrap.appendChild(list)
|
||||
host.appendChild(wrap)
|
||||
ctxForPanel.__stickyPanelRoot = host
|
||||
refreshList()
|
||||
}
|
||||
|
||||
function insertNote() {
|
||||
var api = ctxRef && ctxRef.canvas
|
||||
if (!api || typeof api.createNode !== 'function') return null
|
||||
var id = api.createNode('plugin:sticky:sticky', null, null, {
|
||||
text: '', fontSize: DEFAULT_SIZE, fontWeight: 400, bgColor: DEFAULT_BG,
|
||||
})
|
||||
if (id) {
|
||||
noteList.push({ id: id, data: { text: '' } })
|
||||
refreshList()
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
function dispose() {
|
||||
ctxRef = null
|
||||
ctxForPanel = null
|
||||
noteList = []
|
||||
}
|
||||
|
||||
global.IWBPluginHost.register({
|
||||
id: 'sticky',
|
||||
name: '便利贴',
|
||||
version: '1.0.7',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'nodeTypes', 'canvas'],
|
||||
}, function (ctx) {
|
||||
ctxRef = ctx
|
||||
if (ctx.nodes && typeof ctx.nodes.register === 'function') {
|
||||
ctx.nodes.register({
|
||||
id: 'sticky',
|
||||
title: '便利贴',
|
||||
defaults: {},
|
||||
ports: { in: false, out: false },
|
||||
height: 180,
|
||||
render: renderSticky,
|
||||
})
|
||||
}
|
||||
if (ctx.ui && typeof ctx.ui.registerPanel === 'function') {
|
||||
ctx.ui.registerPanel({
|
||||
id: 'sticky',
|
||||
title: '便利贴',
|
||||
icon: 'note',
|
||||
mount: mountPanel,
|
||||
})
|
||||
}
|
||||
return { dispose: dispose }
|
||||
})
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
@@ -0,0 +1,174 @@
|
||||
#!/usr/bin/env node
|
||||
/* 图片存储巡检(只读):回答「图存在哪 / 节点里为什么是链接 / 有没有孤儿文件」。
|
||||
*
|
||||
* 用法:
|
||||
* node scripts/audit-image-storage.js # 默认读 ~/Documents/ImageWorkbench
|
||||
* node scripts/audit-image-storage.js --dir /path # 指定资料目录
|
||||
*
|
||||
* 判读口径见 docs/standards/image-storage-map.md。本脚本**不修改任何文件**,
|
||||
* 存在的意义是:存储结论必须由实际数据支撑,不能由注释或默认值推断(2026-11-24 误判的教训)。
|
||||
*/
|
||||
'use strict'
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const os = require('os')
|
||||
|
||||
const args = process.argv.slice(2)
|
||||
const dirArg = (() => {
|
||||
const i = args.indexOf('--dir')
|
||||
if (i >= 0 && args[i + 1]) return args[i + 1]
|
||||
return process.env.IWB_DATA_DIR || path.join(os.homedir(), 'Documents', 'ImageWorkbench')
|
||||
})()
|
||||
|
||||
const kb = (n) => (n >= 1048576 ? (n / 1048576).toFixed(1) + 'MB' : (n / 1024).toFixed(0) + 'KB')
|
||||
const readJson = (p, fb) => { try { return JSON.parse(fs.readFileSync(p, 'utf8')) } catch (e) { return fb } }
|
||||
const dirSize = (p) => {
|
||||
let n = 0
|
||||
try {
|
||||
for (const f of fs.readdirSync(p)) {
|
||||
const abs = path.join(p, f)
|
||||
try {
|
||||
const st = fs.statSync(abs)
|
||||
n += st.isDirectory() ? dirSize(abs) : st.size
|
||||
} catch (e) { /* 单文件失败忽略 */ }
|
||||
}
|
||||
} catch (e) { return 0 }
|
||||
return n
|
||||
}
|
||||
|
||||
if (!fs.existsSync(dirArg)) {
|
||||
console.log('资料目录不存在:' + dirArg)
|
||||
console.log('(说明:这是网页版/未初始化环境,图片字节在浏览器 IndexedDB,不在磁盘上)')
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
console.log('资料目录:' + dirArg)
|
||||
console.log('总体积:' + kb(dirSize(dirArg)))
|
||||
console.log('')
|
||||
|
||||
// ---- ① data.json 登记表 ----
|
||||
const data = readJson(path.join(dirArg, 'data.json'), {})
|
||||
const assets = (data && data.assets) || {}
|
||||
const keys = Object.keys(assets)
|
||||
const regByCat = {}
|
||||
const regByKind = {}
|
||||
const registeredFiles = new Set()
|
||||
for (const k of keys) {
|
||||
const a = assets[k] || {}
|
||||
const parts = String(a.f || '').split('/')
|
||||
const cat = parts[0] === 'images' ? (parts[1] || '?') : '(非图片)'
|
||||
regByCat[cat] = (regByCat[cat] || 0) + 1
|
||||
regByKind[a.k || '?'] = (regByKind[a.k || '?'] || 0) + 1
|
||||
if (a.f) registeredFiles.add(a.f)
|
||||
}
|
||||
console.log('① 登记表 data.json:' + kb(fs.statSync(path.join(dirArg, 'data.json')).size) +
|
||||
' · assets ' + keys.length + ' 条 · imgblob_ ' + keys.filter((k) => k.indexOf('imgblob_') === 0).length + ' 条')
|
||||
console.log(' 按目录:' + JSON.stringify(regByCat))
|
||||
console.log(' 按类型:' + JSON.stringify(regByKind))
|
||||
console.log('')
|
||||
|
||||
// ---- ② 目录实际文件 vs 登记(孤儿) ----
|
||||
const imgRoot = path.join(dirArg, 'images')
|
||||
let orphanAll = 0
|
||||
if (fs.existsSync(imgRoot)) {
|
||||
console.log('② images/ 实际文件(未登记 = 孤儿;_768 显示版属已知例外)')
|
||||
for (const cat of fs.readdirSync(imgRoot)) {
|
||||
const abs = path.join(imgRoot, cat)
|
||||
let st = null
|
||||
try { st = fs.statSync(abs) } catch (e) { continue }
|
||||
if (!st.isDirectory()) continue
|
||||
const files = fs.readdirSync(abs)
|
||||
let bytes = 0
|
||||
let reg = 0
|
||||
let orphan = 0
|
||||
let display = 0
|
||||
const samples = []
|
||||
for (const f of files) {
|
||||
const rel = 'images/' + cat + '/' + f
|
||||
let sz = 0
|
||||
try { sz = fs.statSync(path.join(abs, f)).size } catch (e) { /* ignore */ }
|
||||
bytes += sz
|
||||
if (/_768\.(jpg|webp)$/i.test(f) && !registeredFiles.has(rel)) { display++; continue }
|
||||
if (registeredFiles.has(rel)) reg++
|
||||
else { orphan++; if (samples.length < 2) samples.push(f) }
|
||||
}
|
||||
orphanAll += orphan
|
||||
console.log(' ' + cat.padEnd(8) + String(files.length).padStart(4) + ' 个 ' + kb(bytes).padStart(8) +
|
||||
' · 已登记 ' + reg + ' · 孤儿 ' + orphan + (display ? ' · 显示版 ' + display : '') +
|
||||
(samples.length ? ' · 例 ' + samples.join(', ') : ''))
|
||||
}
|
||||
console.log('')
|
||||
}
|
||||
|
||||
// ---- ③ 图库清单 ----
|
||||
const gi = readJson(path.join(dirArg, 'library', 'gallery', 'index.json'), null)
|
||||
const gList = Array.isArray(gi) ? gi : (gi && Array.isArray(gi.files) ? gi.files : null)
|
||||
if (gList) {
|
||||
const scheme = {}
|
||||
let withOrig = 0
|
||||
for (const f of gList) {
|
||||
if (f && f.origIdb) withOrig++
|
||||
const u = f && f.url
|
||||
const s = typeof u === 'string' && u ? (u.slice(0, 5).toLowerCase() === 'https' ? 'https' : (u.indexOf('data:') === 0 ? 'dataURL' : 'other')) : '(空)'
|
||||
scheme[s] = (scheme[s] || 0) + 1
|
||||
}
|
||||
console.log('③ 图库清单 library/gallery/index.json:' + gList.length + ' 条')
|
||||
console.log(' 有 origIdb(本地原图在 images/gallery/):' + withOrig + '/' + gList.length)
|
||||
console.log(' url 形态:' + JSON.stringify(scheme))
|
||||
console.log('')
|
||||
} else {
|
||||
console.log('③ 图库清单不存在或为空\n')
|
||||
}
|
||||
|
||||
// ---- ④ 画布节点引用形态 ----
|
||||
const cvDir = path.join(dirArg, 'canvases')
|
||||
if (fs.existsSync(cvDir)) {
|
||||
const files = fs.readdirSync(cvDir).filter((f) => f.endsWith('.json'))
|
||||
const shape = (v) => {
|
||||
if (!v) return '空'
|
||||
if (typeof v === 'string') {
|
||||
if (/^https?:/i.test(v)) return 'http 链接'
|
||||
if (v.indexOf('data:') === 0) return '内联 base64'
|
||||
return '其它字符串'
|
||||
}
|
||||
if (v.__blob) return '{__blob} → images/canvas'
|
||||
if (v.__idb) return '{__idb} → images/*'
|
||||
if (v.__cache) return '{__cache}'
|
||||
return '其它对象'
|
||||
}
|
||||
const inUrl = {}
|
||||
const inData = {}
|
||||
let refs = 0
|
||||
const host = {}
|
||||
for (const f of files) {
|
||||
const j = readJson(path.join(cvDir, f), null)
|
||||
if (!j) continue
|
||||
const ws = Array.isArray(j) ? j : (j.workspaces || [j])
|
||||
for (const w of ws) {
|
||||
for (const n of (w && w.nodes) || []) {
|
||||
if (!n || n.type !== 'ref') continue
|
||||
refs++
|
||||
const d = n.data || {}
|
||||
const a = shape(d.url); inUrl[a] = (inUrl[a] || 0) + 1
|
||||
const b = shape(d.data); inData[b] = (inData[b] || 0) + 1
|
||||
if (typeof d.url === 'string' && /^https?:/i.test(d.url)) {
|
||||
let h = '?'
|
||||
try { h = new URL(d.url).host } catch (e) { /* ignore */ }
|
||||
host[h] = (host[h] || 0) + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('④ 画布存档 ' + files.length + ' 个 · 参考图节点 ' + refs + ' 个')
|
||||
console.log(' data.url :' + JSON.stringify(inUrl))
|
||||
console.log(' data.data:' + JSON.stringify(inData))
|
||||
const hosts = Object.keys(host).sort((a, b) => host[b] - host[a]).slice(0, 6)
|
||||
if (hosts.length) console.log(' data.url 远程域名 top:' + hosts.map((h) => h + '×' + host[h]).join(' · '))
|
||||
console.log('')
|
||||
}
|
||||
|
||||
console.log('结论提示:')
|
||||
console.log(' · data.url 里 http 占多数 ⇒ 这些节点不能标注/吃不到上游,需要"素材化"落本地')
|
||||
console.log(' · data.data 里 {__blob} ⇒ 桌面端字节在 images/canvas/,由 wCleanIdb 按引用集回收')
|
||||
console.log(' · 图库条目 origIdb 覆盖率高 ⇒ 插入"原图档"可零拷贝引用,无需再复制一份')
|
||||
if (orphanAll) console.log(' · 存在 ' + orphanAll + ' 个孤儿文件(可被 wCleanIdb 回收,或由用户手动清理)')
|
||||
@@ -101,6 +101,7 @@ const sourceModules = [
|
||||
'canvas-grid.js',
|
||||
'image-display-thumb.js',
|
||||
'image-remote-cache.js',
|
||||
'gallery-sync.js',
|
||||
'image-thumb-pick.js',
|
||||
'ui-modal-drag.js',
|
||||
'ui-nav-rail.js',
|
||||
|
||||
+136
-11
@@ -68,6 +68,7 @@ const COLOR_ORDER = [
|
||||
'surface', 'hover', 'menuBg',
|
||||
'pluginSurface', 'pluginCard', 'pluginInset', 'pluginHover',
|
||||
'err', 'ok', 'warn',
|
||||
'errBg', 'errBd', 'okBg', 'okBd', 'warnBg', 'warnBd',
|
||||
]
|
||||
|
||||
/* 尺度层(L1):只在这里定义一次。@deprecated 的名字保留到 M4 迁移结束。 */
|
||||
@@ -115,6 +116,7 @@ const SCALE = [
|
||||
['--iwb-radius-panel', '12px', '面板/工具栏'],
|
||||
['--iwb-radius-popover', '14px', '浮层/菜单/右键'],
|
||||
['--iwb-radius-full', '999px', '圆形/药丸'],
|
||||
['--iwb-font-2xs', '10px', '极小标注:徽标角标/画布坐标/缩略图角标(2026-11-24 承认它,此前 29 处裸写)'],
|
||||
['--iwb-font-xs', '11px', 'M4 字号:状态栏/徽标'],
|
||||
['--iwb-font-sm', '12px', '标签/次要正文'],
|
||||
['--iwb-font-md', '13px', '紧凑正文/工具栏标题'],
|
||||
@@ -130,6 +132,18 @@ const SCALE = [
|
||||
['--iwb-tab-h', '28px', '标签高度'],
|
||||
['--iwb-tab-radius', '7px', '标签圆角'],
|
||||
['--iwb-control-h', '30px', '表单控件高度:同一行里的输入框与默认按钮必须等高(设置页实测曾是 33 vs 24)'],
|
||||
['--iwb-bw', '1px', '描边宽度(2026-11-24):常规分隔/控件边框'],
|
||||
['--iwb-bw-strong', '2px', '强调描边:选中/焦点/危险操作(不要再用 2px 裸值)'],
|
||||
['--iwb-icon-sm', '14px', '小图标:行内/按钮内'],
|
||||
['--iwb-icon-md', '16px', '标准图标:工具栏/菜单'],
|
||||
['--iwb-icon-lg', '18px', '大图标:导航/空态'],
|
||||
['--iwb-opacity-disabled', '0.45', '禁用态透明度(此前 0.45/0.55 混用)'],
|
||||
['--iwb-opacity-muted', '0.7', '次要/未激活元素透明度'],
|
||||
['--iwb-ease-out', 'cubic-bezier(0.16, 1, 0.3, 1)', '入场/展开缓动:快出慢停'],
|
||||
['--iwb-ease-in-out', 'cubic-bezier(0.4, 0, 0.2, 1)', '状态切换缓动'],
|
||||
['--iwb-motion-fast', '0.12s', 'M6 动效:悬停/开关/小位移'],
|
||||
['--iwb-motion-base', '0.15s', 'M6 动效:面板展开/尺寸变化'],
|
||||
['--iwb-motion-slow', '0.3s', 'M6 动效:整屏过渡/抽屉'],
|
||||
|
||||
/* ── 层级表(M4-B2)───────────────────────────────────────────────
|
||||
* 迁移前 z-index 有 42 种取值,其中「谁盖谁」全靠散落在各处的数字对撞,出过两次真 bug:
|
||||
@@ -189,6 +203,61 @@ const LIGHT_ONLY = [
|
||||
['--iwb-nav-w', '52px', '一级导航宽度:左停靠栏/工具栏让位都以它为基准'],
|
||||
]
|
||||
|
||||
/* ── L3 组件作用域(2026-11-24,M6)───────────────────────────────
|
||||
* 为什么放这里:这 30 个 token 原先手写在 style.css 的 `.iwb-settings-modal` / `.iwb-pop`
|
||||
* 作用域里 —— 文档有表格、代码有值,但没有单一源、也没有任何断言,已经漂过一次
|
||||
* (--iwb-pop-w 从 328 被改到 360,文档同步晚了一步)。
|
||||
* 现在值只在这张表里写,生成进 design-tokens.css;style.css 只留布局属性。
|
||||
* 一致性断言:tests/design-tokens-component-doc-test.js(文档表格 ↔ tokens.json ↔ CSS)。
|
||||
*/
|
||||
const COMPONENT_SCOPED = [
|
||||
{
|
||||
selector: '.iwb-settings-modal',
|
||||
group: 'component.settings',
|
||||
vars: [
|
||||
['--iwb-set-label-w', '180px', '标签列宽'],
|
||||
['--iwb-set-col-gap', 'var(--iwb-space-16)', '标签列与控件列间距'],
|
||||
['--iwb-set-row-h', '40px', '设置行高'],
|
||||
['--iwb-set-row-pad-y', 'var(--iwb-space-8)', '行上下内边距'],
|
||||
['--iwb-set-group-gap', 'var(--iwb-space-32)', '分组之间(规范 §3.11:32px)'],
|
||||
['--iwb-set-title-gap', 'var(--iwb-space-8)', '分组标题与分组体间距'],
|
||||
['--iwb-set-group-bg', 'hsl(0 0% 97.6%)', '分组体底色:设计值 #F9F9F9(用 hsl 表达以过 hex 闸门)'],
|
||||
['--iwb-set-group-radius', 'var(--iwb-radius-card)', '分组体圆角'],
|
||||
['--iwb-set-group-pad-x', 'var(--iwb-space-20)', '分组体左右内边距'],
|
||||
['--iwb-set-group-pad-y', 'var(--iwb-space-12)', '分组体上下内边距'],
|
||||
['--iwb-set-divider', 'color-mix(in srgb, var(--iwb-border) 55%, transparent)', '行分隔线'],
|
||||
['--iwb-set-hint-color', 'var(--iwb-text-dim)', '说明文字色'],
|
||||
['--iwb-set-hint-size', 'var(--iwb-font-xs)', '说明文字字号'],
|
||||
['--iwb-set-hint-gap', 'var(--iwb-space-2)', '说明文字上间距'],
|
||||
['--iwb-set-input-border', 'color-mix(in srgb, var(--iwb-border) 40%, var(--iwb-panel))', '输入框描边'],
|
||||
['--iwb-set-check-size', '16px', '复选项尺寸'],
|
||||
['--iwb-set-check-radius', '4px', '复选项圆角'],
|
||||
['--iwb-set-btn-gap', 'var(--iwb-space-8)', '操作按钮间距'],
|
||||
],
|
||||
dark: [
|
||||
['--iwb-set-group-bg', 'color-mix(in srgb, var(--iwb-text) 8%, var(--iwb-panel))', '暗色分组体:文字色 8% 混面板'],
|
||||
],
|
||||
},
|
||||
{
|
||||
selector: '.iwb-pop',
|
||||
group: 'component.popover',
|
||||
vars: [
|
||||
['--iwb-pop-w', '360px', '面板宽度(窄屏靠 max-width 兜底)'],
|
||||
['--iwb-pop-pad-y', 'var(--iwb-space-10)', '面板上下内边距'],
|
||||
['--iwb-pop-pad-x', 'var(--iwb-space-12)', '面板左右内边距'],
|
||||
['--iwb-pop-gap', 'var(--iwb-space-8)', '分组之间'],
|
||||
['--iwb-pop-radius', 'var(--iwb-radius-popover)', '面板圆角'],
|
||||
['--iwb-pop-title-size', 'var(--iwb-font-base)', '面板标题字号'],
|
||||
['--iwb-pop-chip-h', '28px', '选择项/下拉/数字框高度'],
|
||||
['--iwb-pop-chip-pad-x', 'var(--iwb-space-10)', '选择项左右内边距'],
|
||||
['--iwb-pop-chip-radius', '6px', '选择项圆角'],
|
||||
['--iwb-pop-chip-gap', 'var(--iwb-space-6)', '选择项间距'],
|
||||
['--iwb-pop-chip-size', 'var(--iwb-font-md)', '选择项字号'],
|
||||
],
|
||||
dark: [],
|
||||
},
|
||||
]
|
||||
|
||||
/* 暗色独有的动效:亮色用品牌色,暗色必须用「亮色元素 + 深色轨道」 */
|
||||
const DARK_ANIM = [
|
||||
['--iwb-anim', '#ffffff'],
|
||||
@@ -268,6 +337,7 @@ function buildCss () {
|
||||
L.push(...colorDecls(LIGHT, ['pluginSurface', 'pluginCard', 'pluginInset', 'pluginHover', 'surface', 'hover', 'menuBg']))
|
||||
L.push(' /* —— 语义色 —— */')
|
||||
L.push(...colorDecls(LIGHT, ['err', 'ok', 'warn']))
|
||||
L.push(...colorDecls(LIGHT, ['errBg', 'errBd', 'okBg', 'okBd', 'warnBg', 'warnBd']))
|
||||
L.push(' /* —— 尺度层(L1)—— */')
|
||||
L.push(...SCALE.map(decl))
|
||||
L.push(' /* —— 阴影 —— */')
|
||||
@@ -295,30 +365,66 @@ function buildCss () {
|
||||
L.push(...LIGHT_ANIM.map(decl))
|
||||
L.push('}')
|
||||
L.push('')
|
||||
/* —— L3 组件作用域(见 COMPONENT_SCOPED) —— */
|
||||
for (const c of COMPONENT_SCOPED) {
|
||||
L.push('')
|
||||
L.push('/* ' + c.group + ':由 gen-tokens 生成,勿手改;布局属性仍在 style.css */')
|
||||
L.push(c.selector + ' {')
|
||||
for (const [name, value, desc] of c.vars) L.push(' ' + name + ': ' + value + ';' + (desc ? ' /* ' + desc + ' */' : ''))
|
||||
L.push('}')
|
||||
if (c.dark && c.dark.length) {
|
||||
L.push('')
|
||||
L.push('/* ' + c.group + ' · 暗色覆盖 */')
|
||||
L.push('.theme-dark ' + c.selector + ' {')
|
||||
for (const [name, value, desc] of c.dark) L.push(' ' + name + ': ' + value + ';' + (desc ? ' /* ' + desc + ' */' : ''))
|
||||
L.push('}')
|
||||
}
|
||||
}
|
||||
return L.join('\n')
|
||||
}
|
||||
|
||||
/* ── DTCG 导出 ──────────────────────────────────────────────
|
||||
* 解析生成好的 CSS(而不是再 derive 一遍):保证「导出的 JSON == 实际生效的 CSS」。
|
||||
* 关系式(color-mix / var)不是值,跳过 —— 它们在 Figma/Penpot 里没有对应概念。 */
|
||||
function parseDeclBody (body) {
|
||||
const d = {}
|
||||
const dre = /(--[a-z0-9-]+)\s*:\s*([^;]+);/g
|
||||
let x
|
||||
while ((x = dre.exec(body.replace(/\/\*[\s\S]*?\*\//g, '')))) d[x[1]] = x[2].trim()
|
||||
return d
|
||||
}
|
||||
|
||||
function parseBlocks (css) {
|
||||
const out = {}
|
||||
const comp = {}
|
||||
// 先摘出 L3 组件作用域(亮色 + .theme-dark 覆盖)。必须在主循环之前:
|
||||
// 主循环的 .theme-dark 分支会把 `.theme-dark .iwb-pop {…}` 当成整块暗色主题,把真正的暗色值覆盖掉。
|
||||
const compRe = /(\.theme-dark\s+)?(\.iwb-settings-modal|\.iwb-pop)\s*\{([\s\S]*?)\n\}/g
|
||||
let cm
|
||||
while ((cm = compRe.exec(css))) comp[(cm[1] ? 'dark:' : '') + cm[2]] = parseDeclBody(cm[3])
|
||||
css = css.replace(compRe, '')
|
||||
const re = /(:root:not\(\.theme-dark\)|:root|\.theme-dark)\s*\{([\s\S]*?)\n\}/g
|
||||
let m
|
||||
while ((m = re.exec(css))) {
|
||||
const body = m[2].replace(/\/\*[\s\S]*?\*\//g, '')
|
||||
const d = {}
|
||||
const dre = /(--[a-z0-9-]+)\s*:\s*([^;]+);/g
|
||||
let x
|
||||
while ((x = dre.exec(body))) d[x[1]] = x[2].trim()
|
||||
out[m[1]] = d
|
||||
}
|
||||
return out
|
||||
while ((m = re.exec(css))) out[m[1]] = parseDeclBody(m[2])
|
||||
return { blocks: out, comp: comp }
|
||||
}
|
||||
// 这些值推断不出类型(关系式 / 复合值 / 纯数字),但对外的 DTCG 清单必须覆盖到
|
||||
const TYPE_HINT = {
|
||||
'--iwb-focus-ring': 'border',
|
||||
'--iwb-edge-dash': 'string',
|
||||
'--iwb-grid-on': 'number',
|
||||
}
|
||||
|
||||
function inferType (value, name) {
|
||||
if (TYPE_HINT[name]) return TYPE_HINT[name]
|
||||
if (/^#[0-9a-f]{3,8}$/i.test(value)) return 'color'
|
||||
if (/^rgba?\(/i.test(value)) return 'color'
|
||||
if (/^cubic-bezier\(/.test(value)) return 'cubicBezier'
|
||||
// 组件作用域里的几何值:纯 px / var() 别名 / color-mix 关系式
|
||||
if (/^var\(--iwb-[a-z0-9-]+\)$/.test(value)) return /(?:-bg|-border|-text|-color|^--iwb-(?:err|ok|warn|chrome|home|dock|hr|edge))/i.test(name) ? 'color' : 'dimension'
|
||||
if (/^color-mix\(/.test(value) || /^hsl\(/.test(value)) return 'color'
|
||||
if (/-bg$|-bd$|-border$/.test(name) && /^[^;]+$/.test(value)) return null
|
||||
if (/^--iwb-opacity-/.test(name) && /^[\d.]+$/.test(value)) return 'number'
|
||||
if (/^-?[\d.]+px$/.test(value)) return 'dimension'
|
||||
if (/^-?[\d.]+m?s$/.test(value)) return 'duration'
|
||||
if (/\d+px [\d.]+px/.test(value)) return 'shadow'
|
||||
@@ -339,12 +445,19 @@ function groupOf (name) {
|
||||
if (/^fs-/.test(n)) return 'legacy.font'
|
||||
if (/^font-/.test(n)) return 'font.size'
|
||||
if (/^tr-/.test(n)) return 'motion'
|
||||
if (/^motion-/.test(n)) return 'motion'
|
||||
if (/^elevation-/.test(n)) return 'shadow.elevation'
|
||||
if (/^sh-/.test(n)) return 'shadow'
|
||||
if (/^z-/.test(n)) return 'z'
|
||||
if (n === 'grid-dot') return 'color'
|
||||
if (/^(grid-|nav-|node-radius|node-sel-w|edge-w|edge-dash|chrome-h|tab-h|tab-radius|control-h)/.test(n)) return 'layout'
|
||||
if (/^plugin-/.test(n)) return 'color.plugin'
|
||||
if (/^set-/.test(n)) return 'component.settings'
|
||||
if (/^pop-/.test(n)) return 'component.popover'
|
||||
if (/^opacity-/.test(n)) return 'opacity'
|
||||
if (/^ease-/.test(n)) return 'motion.ease'
|
||||
if (/^icon-/.test(n)) return 'icon'
|
||||
if (/^bw(-|$)/.test(n)) return 'border.width'
|
||||
return 'color'
|
||||
}
|
||||
|
||||
@@ -359,10 +472,18 @@ function dtcgKey (name) {
|
||||
if (/^fs-/.test(n)) return n.slice(3)
|
||||
if (/^font-/.test(n)) return n.slice(5)
|
||||
if (/^tr-/.test(n)) return n.slice(3)
|
||||
if (/^motion-/.test(n)) return 'ms-' + n.slice(7)
|
||||
if (/^elevation-/.test(n)) return n.slice(10)
|
||||
if (/^sh-/.test(n)) return n.slice(3)
|
||||
if (/^z-/.test(n)) return n.slice(2)
|
||||
if (/^plugin-/.test(n)) return n.slice(7)
|
||||
if (/^set-/.test(n)) return n.slice(4)
|
||||
if (/^pop-/.test(n)) return n.slice(4)
|
||||
if (/^opacity-/.test(n)) return n.slice(8)
|
||||
if (/^ease-/.test(n)) return n.slice(5)
|
||||
if (/^icon-/.test(n)) return n.slice(5)
|
||||
if (n === 'bw') return 'base'
|
||||
if (/^bw-/.test(n)) return n.slice(3)
|
||||
return n
|
||||
}
|
||||
|
||||
@@ -377,9 +498,12 @@ function put (root, groupPath, key, node) {
|
||||
}
|
||||
|
||||
function buildJson (css) {
|
||||
const blocks = parseBlocks(css)
|
||||
const parsed = parseBlocks(css)
|
||||
const blocks = parsed.blocks
|
||||
const light = Object.assign({}, blocks[':root'] || {}, blocks[':root:not(.theme-dark)'] || {})
|
||||
const dark = blocks['.theme-dark'] || {}
|
||||
// L3 组件作用域:亮色并进同一张表(靠 groupOf 的 component.* 分支分到独立组),暗色作为 $extensions
|
||||
Object.assign(light, parsed.comp['.iwb-settings-modal'] || {}, parsed.comp['.iwb-pop'] || {})
|
||||
const root = {}
|
||||
const skipped = []
|
||||
for (const name of Object.keys(light)) {
|
||||
@@ -393,7 +517,8 @@ function buildJson (css) {
|
||||
} else {
|
||||
node = { $value: value, $type: type }
|
||||
}
|
||||
if (dark[name]) node.$extensions = { 'com.image-workbench.dark': { $value: dark[name], $type: type } }
|
||||
const darkVal = dark[name] || (parsed.comp['dark:.iwb-settings-modal'] || {})[name] || (parsed.comp['dark:.iwb-pop'] || {})[name]
|
||||
if (darkVal) node.$extensions = { 'com.image-workbench.dark': { $value: darkVal, $type: type } }
|
||||
put(root, groupOf(name), dtcgKey(name), node)
|
||||
}
|
||||
return { root, skipped }
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
'use strict'
|
||||
/* 行数棘轮指标的**唯一测量实现** + 文档硬数字的**唯一改写/校验规则**(2026-11-24,P0-②)
|
||||
*
|
||||
* 为什么需要:MAX_APP_JS_LINES 等上限被抄进 CONTRIBUTING.md 与 architecture-current-state.md,
|
||||
* 此前**没有任何校验**,实际已漂 415 行(文档写 8,700,真实上限 9,115)。
|
||||
* sync-facts(改写)与 architecture-facts-guard(断言)若各写一套正则,会出现
|
||||
* 「同步器说改了、守卫说没改」—— 所以规则只放在这里。
|
||||
*
|
||||
* 口径与 tests/source-text-ratchet-test.js 一致(那边是权威断言方)。
|
||||
*/
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const root = path.resolve(__dirname, '..')
|
||||
const NL = String.fromCharCode(10)
|
||||
const fmtInt = (n) => Number(n).toLocaleString('en-US')
|
||||
|
||||
function readCaps () {
|
||||
const src = fs.readFileSync(path.join(root, 'tests', 'source-text-ratchet-test.js'), 'utf8')
|
||||
const num = (name) => {
|
||||
const m = new RegExp('MAX_' + name + ' = ([0-9.]+)').exec(src)
|
||||
if (!m) throw new Error('未找到 MAX_' + name + '(棘轮测试改名了?)')
|
||||
return Number(m[1])
|
||||
}
|
||||
return {
|
||||
appJsLines: num('APP_JS_LINES'),
|
||||
workbenchLines: num('WORKBENCH_LINES'),
|
||||
appComponentLines: num('APP_COMPONENT_LINES'),
|
||||
appJsShare: num('APP_JS_SHARE')
|
||||
}
|
||||
}
|
||||
|
||||
function measure () {
|
||||
const appSrc = fs.readFileSync(path.join(root, 'app.js'), 'utf8')
|
||||
const appLines = appSrc.split(NL).length
|
||||
|
||||
const srcDir = path.join(root, 'src')
|
||||
const srcFiles = fs.readdirSync(srcDir).filter((n) => n.endsWith('.js'))
|
||||
let srcLines = 0
|
||||
for (const f of srcFiles) srcLines += fs.readFileSync(path.join(srcDir, f), 'utf8').split(NL).length
|
||||
|
||||
// Workbench():按大括号深度找函数结尾(与棘轮测试同一算法)
|
||||
const lines = appSrc.split(NL)
|
||||
const start = lines.findIndex((l) => l.startsWith(' function Workbench('))
|
||||
let wbLines = 0
|
||||
if (start >= 0) {
|
||||
let depth = 0, started = false
|
||||
for (let j = start; j < lines.length; j++) {
|
||||
for (const ch of lines[j]) {
|
||||
if (ch === '{') { depth++; started = true } else if (ch === '}') depth--
|
||||
}
|
||||
if (started && depth === 0) { wbLines = j - start + 1; break }
|
||||
}
|
||||
}
|
||||
|
||||
const share = appLines / (appLines + srcLines)
|
||||
return {
|
||||
appLines,
|
||||
srcFiles: srcFiles.length,
|
||||
srcLines,
|
||||
workbenchLines: wbLines,
|
||||
share,
|
||||
sharePct: (share * 100).toFixed(1),
|
||||
caps: readCaps()
|
||||
}
|
||||
}
|
||||
|
||||
/* ── 文档规则:build(m, ...captures) 返回整段替换文本 ── */
|
||||
const RULES = {
|
||||
contributing: [
|
||||
{ key: 'MAX_APP_JS_LINES', re: /`MAX_APP_JS_LINES` \| \*\*[\d,]+\*\*/g, build: (m) => '`MAX_APP_JS_LINES` | **' + fmtInt(m.caps.appJsLines) + '**' },
|
||||
{ key: 'MAX_WORKBENCH_LINES', re: /`MAX_WORKBENCH_LINES` \| \*\*[\d,]+\*\*/g, build: (m) => '`MAX_WORKBENCH_LINES` | **' + fmtInt(m.caps.workbenchLines) + '**' },
|
||||
{ key: 'MAX_APP_COMPONENT_LINES', re: /`MAX_APP_COMPONENT_LINES` \| \*\*[\d,]+\*\*/g, build: (m) => '`MAX_APP_COMPONENT_LINES` | **' + fmtInt(m.caps.appComponentLines) + '**' }
|
||||
],
|
||||
arch: [
|
||||
{ key: 'appLines', re: /(`app\.js` = 单 IIFE )\*\*[\d,]+ 行\*\*/g, build: (m, p1) => p1 + '**' + fmtInt(m.appLines) + ' 行**' },
|
||||
{ key: 'appJsCap', re: /(绝对上限 )[\d,]+/g, build: (m, p1) => p1 + fmtInt(m.caps.appJsLines) },
|
||||
{ key: 'workbenchLines', re: /(`Workbench\(\)` = )\*\*[\d,]+ 行\*\*/g, build: (m, p1) => p1 + '**' + fmtInt(m.workbenchLines) + ' 行**' },
|
||||
{ key: 'workbenchCap', re: /((上限 )\*\*[\d,]+\*\*(,余量 )\d+/g, build: (m, p1, p2) => p1 + '**' + fmtInt(m.caps.workbenchLines) + '**' + p2 + String(Math.max(0, m.caps.workbenchLines - m.workbenchLines)) },
|
||||
{ key: 'sharePct', re: /(现 )\*\*[\d.]+%\*\*(,2026-11-12 起)/g, build: (m, p1, p2) => p1 + '**' + m.sharePct + '%**' + p2 },
|
||||
{ key: 'srcFiles', re: /(现 )\*\*[\d,]+\*\* 个模块/g, build: (m, p1) => p1 + '**' + fmtInt(m.srcFiles) + '** 个模块' },
|
||||
{ key: 'srcLines', re: /(个模块 \/ )[\d,]+ 行/g, build: (m, p1) => p1 + fmtInt(m.srcLines) + ' 行' }
|
||||
]
|
||||
}
|
||||
|
||||
/** 改写文档里的硬数字;返回 { text, changed: [key] }。changed 为空 = 已经一致。 */
|
||||
function rewriteDoc (kind, text, m) {
|
||||
const rules = RULES[kind] || []
|
||||
let out = text
|
||||
const changed = []
|
||||
for (const rule of rules) {
|
||||
const before = out
|
||||
out = out.replace(rule.re, (all, ...caps) => rule.build(m, ...caps.slice(0, -2)))
|
||||
if (out !== before) changed.push(rule.key)
|
||||
}
|
||||
return { text: out, changed }
|
||||
}
|
||||
|
||||
module.exports = { measure, readCaps, rewriteDoc, RULES, fmtInt }
|
||||
+25
-3
@@ -85,10 +85,21 @@ for (const [re, rep] of archWant) {
|
||||
arch = arch.replace(re, rep)
|
||||
if (arch !== before) archChanged = true
|
||||
}
|
||||
|
||||
// ── ④b 行数棘轮硬数字(2026-11-24,P0-②)──
|
||||
// 为什么单列一步:CONTRIBUTING / 架构文档里抄着 MAX_APP_JS_LINES 等上限,
|
||||
// 此前无人校验,实测已漂 415 行。测量与改写规则在 scripts/ratchet-metrics.js
|
||||
// (守卫 tests/architecture-facts-guard-test.js 用同一份规则断言,口径不会分叉)。
|
||||
const rm = require('./ratchet-metrics')
|
||||
const metrics = rm.measure()
|
||||
const archRatchet = rm.rewriteDoc('arch', arch, metrics)
|
||||
arch = archRatchet.text
|
||||
if (archRatchet.changed.length) archChanged = true
|
||||
|
||||
if (archChanged) {
|
||||
diffs.push(' ✗ 架构文档计数过时(可 --write 自动修 4 处)')
|
||||
diffs.push(' ✗ 架构文档计数/棘轮数字过时(可 --write 自动修;棘轮项:' + (archRatchet.changed.join(', ') || '无') + ')')
|
||||
if (WRITE) write(archPath, arch)
|
||||
} else report.push(' · 架构文档计数(一致)')
|
||||
} else report.push(' · 架构文档计数与棘轮数字(一致)')
|
||||
|
||||
// 单测文件数:test:unit 里 node tests/*.js 的个数
|
||||
const pkg = JSON.parse(read('package.json'))
|
||||
@@ -98,13 +109,24 @@ const contribPath = 'CONTRIBUTING.md'
|
||||
let contrib = read(contribPath)
|
||||
const contribRe = /test:unit {2,}\d+ 个单测文件/
|
||||
const m = contrib.match(contribRe)
|
||||
let contribChanged = false
|
||||
if (m) {
|
||||
const cur = Number(m[0].match(/(\d+) 个/)[1])
|
||||
if (cur !== unitCount) {
|
||||
contribChanged = true
|
||||
diffs.push(' ✗ CONTRIBUTING 单测文件数: ' + cur + ' → ' + unitCount)
|
||||
if (WRITE) { write(contribPath, contrib.replace(contribRe, 'test:unit ' + unitCount + ' 个单测文件')); }
|
||||
contrib = contrib.replace(contribRe, 'test:unit ' + unitCount + ' 个单测文件')
|
||||
} else report.push(' · CONTRIBUTING 单测文件数: ' + unitCount + '(一致)')
|
||||
}
|
||||
// 棘轮上限三个数字(同一份规则,见 scripts/ratchet-metrics.js)
|
||||
const contribRatchet = rm.rewriteDoc('contributing', contrib, metrics)
|
||||
if (contribRatchet.changed.length) {
|
||||
contribChanged = true
|
||||
diffs.push(' ✗ CONTRIBUTING 棘轮上限过时:' + contribRatchet.changed.join(', '))
|
||||
}
|
||||
contrib = contribRatchet.text
|
||||
if (contribChanged) { if (WRITE) write(contribPath, contrib) }
|
||||
else report.push(' · CONTRIBUTING 棘轮上限(一致)')
|
||||
|
||||
// ── 输出 ──
|
||||
console.log('\n事实同步器(' + (WRITE ? '写入模式' : 'dry-run') + ')\n')
|
||||
|
||||
@@ -10,7 +10,7 @@ const crypto = require('crypto')
|
||||
const root = path.resolve(__dirname, '..')
|
||||
const srcRoot = process.argv[2] ? path.resolve(process.argv[2]) : path.resolve(root, '..', 'iwb-plugins-desktop')
|
||||
const outDir = path.join(root, 'plugins', 'runtime')
|
||||
const IDS = ['batch-export', 'blank-canvas', 'browser', 'gallery', 'grouplib', 'promptlib', 'image-annotate', 'image-vectorize', 'style-source', 'white-bg-800', 'xianyi-cutout']
|
||||
const IDS = ['batch-export', 'blank-canvas', 'browser', 'gallery', 'grouplib', 'promptlib', 'image-annotate', 'image-vectorize', 'sticky', 'style-source', 'white-bg-800', 'xianyi-cutout']
|
||||
// v3.25.41(M1):目录化插件试点 —— 这些 id 产出 <id>/{manifest.json,main.js},其余仍是单文件(双轨兼容)
|
||||
// ⚠️ 2026-11-20 修正:桌面包不随包发插件(scripts/strip-plugins.js),插件只能从市场装,
|
||||
// 而市场目前只支持单文件 ⇒ 目录形态暂不用于生产插件,等 M3(zip 安装)落地再启用。
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
<title>插件开发规范 · Image Workbench</title>
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.55-mwtywasp">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.64-mwus5ag9">
|
||||
<style>
|
||||
.devdoc{max-width:860px;margin:0 auto;padding:40px 0 72px;color:var(--ink,#1b1f24);font-size:15px;line-height:1.75}
|
||||
.devdoc h1{font-size:38px;line-height:1.2;margin:8px 0 18px}
|
||||
@@ -33,7 +33,7 @@
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="btn" href="/plugins/">插件市场</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.55</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.64</a>
|
||||
</div>
|
||||
</div></nav>
|
||||
<main>
|
||||
|
||||
@@ -57,13 +57,13 @@
|
||||
<h2>下载</h2>
|
||||
<div class="row">
|
||||
<div class="name">macOS · Apple Silicon<div class="hint">M1 / M2 / M3 / M4</div></div>
|
||||
<div class="meta">版本 3.26.55 · 8.4 MB · .dmg<div class="hash">sha256 b76eee462d181129…</div></div>
|
||||
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.26.55_aarch64.dmg?h=b76eee462d18">下载</a>
|
||||
<div class="meta">版本 3.26.64 · 8.4 MB · .dmg<div class="hash">sha256 8eb46ce43dc22c2f…</div></div>
|
||||
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.26.64_aarch64.dmg?h=8eb46ce43dc2">下载</a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">macOS · Intel<div class="hint">x86_64</div></div>
|
||||
<div class="meta">版本 3.26.55 · 8.8 MB · .dmg<div class="hash">sha256 c121f0855a2a56d0…</div></div>
|
||||
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.26.55_x64.dmg?h=c121f0855a2a">下载</a>
|
||||
<div class="meta">版本 3.26.64 · 8.8 MB · .dmg<div class="hash">sha256 30cd128a4d5135bf…</div></div>
|
||||
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.26.64_x64.dmg?h=30cd128a4d51">下载</a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">Windows · x64<div class="hint">需要 WebView2</div></div>
|
||||
@@ -98,9 +98,45 @@
|
||||
|
||||
<h2>历史版本</h2>
|
||||
<div class="row">
|
||||
<div class="name">3.26.55</div>
|
||||
<div class="name">3.26.64</div>
|
||||
<div class="meta">2026-11-24<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.63</div>
|
||||
<div class="meta">2026-11-24<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.62</div>
|
||||
<div class="meta">2026-11-24<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.61<div class="hint">图库修复:出图即入图库、插入落地本地副本(画布可标注)、批量插入不再叠图</div></div>
|
||||
<div class="meta">2026-11-24<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.60<div class="hint">浮层字号上调一档:模型设置/图像设置的选择项 11→13px、高 28px,面板 360px</div></div>
|
||||
<div class="meta">2026-11-24<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.59<div class="hint">备份带上插件文件(提示词封面不再换机丢失);promptlib 1.11.0 封面文件治理</div></div>
|
||||
<div class="meta">2026-11-24<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.58</div>
|
||||
<div class="meta">2026-11-24<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.57</div>
|
||||
<div class="meta">2026-11-24<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.56</div>
|
||||
<div class="meta">2026-11-24<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.55</div>
|
||||
<div class="meta">2026-11-24<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.54</div>
|
||||
<div class="meta">2026-11-23<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
|
||||
+11
-11
@@ -4,7 +4,7 @@
|
||||
<meta name="description" content="本地优先的 AI 生图无限画布:节点式工作流、插件按需安装、数据全部留在本机。">
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.55-mwtywasp">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.64-mwus5ag9">
|
||||
</head><body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>
|
||||
@@ -17,20 +17,20 @@
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="btn" href="/plugins/">插件市场</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.55</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.64</a>
|
||||
</div>
|
||||
</div></nav>
|
||||
<main>
|
||||
<section class="hero hero-art">
|
||||
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.26.55-mwtywasp" alt=""></div>
|
||||
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.26.64-mwus5ag9" alt=""></div>
|
||||
<div class="hero-veil"></div>
|
||||
<div class="wrap">
|
||||
<span class="kicker">v3.26.55 · macOS / Windows · 数据在本地</span>
|
||||
<span class="kicker">v3.26.64 · macOS / Windows · 数据在本地</span>
|
||||
<h1>本地优先的<br>AI 生图无限画布</h1>
|
||||
<p class="sub">用节点把「参考图 → 提示词 → 批量生成 → 图库」串成一条生产线。<br>图片、提示词、模型配置全部留在你自己的电脑里,插件按需安装。</p>
|
||||
<div class="cta">
|
||||
<a class="btn primary lg" href="/download/">下载 v3.26.55</a>
|
||||
<a class="btn lg" href="/plugins/">浏览 11 个插件</a>
|
||||
<a class="btn primary lg" href="/download/">下载 v3.26.64</a>
|
||||
<a class="btn lg" href="/plugins/">浏览 12 个插件</a>
|
||||
</div>
|
||||
<div class="meta">支持 macOS 12+ 与 Windows 10 1803+ · 安装包约 7 MB · 无需登录</div>
|
||||
</div></section>
|
||||
@@ -73,7 +73,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.11 · 官方</div></div></div>
|
||||
<div><div class="nm">图库</div><div class="ver">v1.7.0 · 官方</div></div></div>
|
||||
<div class="desc">右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供)</div>
|
||||
<div class="tags"><span class="tag">资源</span><span class="tag">图库</span></div>
|
||||
</div>
|
||||
@@ -85,19 +85,19 @@
|
||||
</div>
|
||||
<div class="pcard" data-name="提示词库 promptlib 右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供) 资源 提示词" data-tags="资源,提示词">
|
||||
<div class="head"><span class="av" style="background:#eef2f6">📖</span>
|
||||
<div><div class="nm">提示词库</div><div class="ver">v1.8.24 · 官方</div></div></div>
|
||||
<div><div class="nm">提示词库</div><div class="ver">v1.13.0 · 官方</div></div></div>
|
||||
<div class="desc">右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供)</div>
|
||||
<div class="tags"><span class="tag">资源</span><span class="tag">提示词</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top:22px"><a class="btn" href="/plugins/">查看全部 11 个插件</a></div>
|
||||
<div style="margin-top:22px"><a class="btn" href="/plugins/">查看全部 12 个插件</a></div>
|
||||
</div></section>
|
||||
|
||||
<section class="section"><div class="wrap">
|
||||
<h2>下载 Image Workbench</h2>
|
||||
<p class="lead">选你的平台。装过一次之后,以后在应用内「设置 → 通用 → 版本与更新」就能一键升级。</p>
|
||||
<div class="dl"><a href="/updates/darwin-aarch64/image-workbench_3.26.55_aarch64.dmg?h=b76eee462d18"><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.55_x64.dmg?h=c121f0855a2a"><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.64_aarch64.dmg?h=8eb46ce43dc2"><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.64_x64.dmg?h=30cd128a4d51"><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>
|
||||
|
||||
+51
-18
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": 2,
|
||||
"updatedAt": "2026-11-23T23:09:26.902Z",
|
||||
"updatedAt": "2026-11-24T10:52:45.289Z",
|
||||
"plugins": [
|
||||
{
|
||||
"id": "batch-export",
|
||||
@@ -112,21 +112,21 @@
|
||||
"资源",
|
||||
"图库"
|
||||
],
|
||||
"version": "1.6.11",
|
||||
"version": "1.7.0",
|
||||
"apiVersion": 1,
|
||||
"bundle": "plugins/gallery-1.6.11.zip",
|
||||
"bundleSize": 34761,
|
||||
"bundleSha256": "6068b2a86f8be90d009e89db93bb847a7ecfd0e5ec8c84f682671f75497eeba0",
|
||||
"bundle": "plugins/gallery-1.7.0.zip",
|
||||
"bundleSize": 38168,
|
||||
"bundleSha256": "0289819359794af974f9ac7ac5bb4b1b483cfe8ebb54af4e9bb09325a5292fc0",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "645c704f257f434473e76be4e5cfe13d28a336d628533f8f1e4e214c3854b906",
|
||||
"size": 527
|
||||
"sha256": "923879db7a998af026a1c7d61969ed8dc3045ef9704739365c411baead7520bd",
|
||||
"size": 526
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "cf456629b21f9001d7cc8016a6af0d2b065aae110ef822b7946e6279ec822f11",
|
||||
"size": 28729
|
||||
"sha256": "77b8e95c06c6811fdee3a832195e2b76bc6197d8bfdf9df0a47a52b6b4dfb38f",
|
||||
"size": 32137
|
||||
},
|
||||
{
|
||||
"path": "styles.css",
|
||||
@@ -180,26 +180,26 @@
|
||||
"资源",
|
||||
"提示词"
|
||||
],
|
||||
"version": "1.8.24",
|
||||
"version": "1.13.0",
|
||||
"apiVersion": 1,
|
||||
"bundle": "plugins/promptlib-1.8.24.zip",
|
||||
"bundleSize": 150074,
|
||||
"bundleSha256": "5f42119783e20fc667cf5f2e2014e4a517bc6436d7060fb2acf185297a5ef032",
|
||||
"bundle": "plugins/promptlib-1.13.0.zip",
|
||||
"bundleSize": 184934,
|
||||
"bundleSha256": "af0116e04312e98d2915dd67a6610082c3593e425e29732004b40dfc0bf8b676",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "18c0c76e8830ec9f1ee306c7e1d0fb40f430410409d1990384ce72c94169e94d",
|
||||
"sha256": "9b801ebab1896dd2032a802389b616794632f56846521574225e23e2681600db",
|
||||
"size": 541
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "0bab5f57c173d0bf45a16881042d9b3b1973a2afe2e6c3745a27fd5181b793b0",
|
||||
"size": 107029
|
||||
"sha256": "2108d09bd7cd1d96dfeb8499dac7adacbda659b222606f7d072a2bf8cbf5361a",
|
||||
"size": 138415
|
||||
},
|
||||
{
|
||||
"path": "styles.css",
|
||||
"sha256": "e14fee1fd446188ef44913cc2d549e02480b10d95a67371078ec4fa623786d60",
|
||||
"size": 42194
|
||||
"sha256": "e2ba84f2e4251f461e77c78ca39fc2b5022f169cb1a4eae0aa7ef786f28b6863",
|
||||
"size": 45668
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -269,6 +269,39 @@
|
||||
"sha256": "0e5a7fa018b2e9de705f9112272ad02dcf187b5361696f7fc0a12a93c4f20d4e",
|
||||
"integrity": "sha256-Dlp/oBiy6d5wX5ESJyrQLc8Ye1NhaW9/wKEqk8TyDU4="
|
||||
},
|
||||
{
|
||||
"id": "sticky",
|
||||
"name": "便利贴",
|
||||
"desc": "画布便利贴:多行文本 + 字号/粗细调节 + 8 色背景,纯说明不连线",
|
||||
"author": "official",
|
||||
"icon": "📝",
|
||||
"color": "#fdf3d0",
|
||||
"tags": [
|
||||
"标注",
|
||||
"便签"
|
||||
],
|
||||
"version": "1.0.7",
|
||||
"apiVersion": 1,
|
||||
"bundle": "plugins/sticky-1.0.7.zip",
|
||||
"bundleSize": 25425,
|
||||
"bundleSha256": "1087fc1a8f842145e75cfca909acb0caf839fbf7349de6a7eee1d112843df369",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "17e5bf6fb11cfe6d7748957d902f3e78585cdb7a1df44b387fd6dbdcae3a7958",
|
||||
"size": 400
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "af8e7249f0c7c010cc1544ee5a93a9ab6d5c25caa562dab90e738a52d9dd48b2",
|
||||
"size": 24811
|
||||
}
|
||||
],
|
||||
"file": "plugins/plugin-sticky.af8e7249f0c7.js",
|
||||
"size": 24811,
|
||||
"sha256": "af8e7249f0c7c010cc1544ee5a93a9ab6d5c25caa562dab90e738a52d9dd48b2",
|
||||
"integrity": "sha256-r45ySfDHwBDMFUTuWpOpq21cJcqlYtq5DnOKUtndSLI="
|
||||
},
|
||||
{
|
||||
"id": "style-source",
|
||||
"name": "风格库",
|
||||
|
||||
+12
-5
@@ -3,7 +3,7 @@
|
||||
<title>插件市场 · Image Workbench</title>
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.55-mwtywasp">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.64-mwus5ag9">
|
||||
</head><body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>
|
||||
@@ -16,13 +16,13 @@
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="btn" href="/plugins/">插件市场</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.55</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.64</a>
|
||||
</div>
|
||||
</div></nav>
|
||||
<main>
|
||||
<section class="hero" style="padding:64px 0 8px;text-align:left"><div class="wrap">
|
||||
<h1 style="font-size:40px;margin:0">插件市场</h1>
|
||||
<p class="sub" style="margin:14px 0 0;text-align:left;max-width:720px">共 11 个插件。安装方式:应用内 <b>设置 → 插件 → 浏览</b>,点「安装」后重启生效。</p>
|
||||
<p class="sub" style="margin:14px 0 0;text-align:left;max-width:720px">共 12 个插件。安装方式:应用内 <b>设置 → 插件 → 浏览</b>,点「安装」后重启生效。</p>
|
||||
</div></section>
|
||||
<section class="section" style="border-top:0;padding-top:24px"><div class="wrap">
|
||||
<div style="display:flex;gap:8px;flex-wrap:wrap;margin:0 0 18px" id="chips">
|
||||
@@ -40,6 +40,7 @@
|
||||
<button class="tag" data-tag="标注" style="cursor:pointer;padding:5px 12px">标注</button>
|
||||
<button class="tag" data-tag="转换" style="cursor:pointer;padding:5px 12px">转换</button>
|
||||
<button class="tag" data-tag="矢量" style="cursor:pointer;padding:5px 12px">矢量</button>
|
||||
<button class="tag" data-tag="便签" style="cursor:pointer;padding:5px 12px">便签</button>
|
||||
<button class="tag" data-tag="风格" style="cursor:pointer;padding:5px 12px">风格</button>
|
||||
<button class="tag" data-tag="电商" style="cursor:pointer;padding:5px 12px">电商</button>
|
||||
<button class="tag" data-tag="抠图" style="cursor:pointer;padding:5px 12px">抠图</button>
|
||||
@@ -67,7 +68,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.11 · 官方</div></div></div>
|
||||
<div><div class="nm">图库</div><div class="ver">v1.7.0 · 官方</div></div></div>
|
||||
<div class="desc">右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供)</div>
|
||||
<div class="tags"><span class="tag">资源</span><span class="tag">图库</span></div>
|
||||
</div>
|
||||
@@ -79,7 +80,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.8.24 · 官方</div></div></div>
|
||||
<div><div class="nm">提示词库</div><div class="ver">v1.13.0 · 官方</div></div></div>
|
||||
<div class="desc">右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供)</div>
|
||||
<div class="tags"><span class="tag">资源</span><span class="tag">提示词</span></div>
|
||||
</div>
|
||||
@@ -95,6 +96,12 @@
|
||||
<div class="desc">把位图转成 SVG 矢量路径</div>
|
||||
<div class="tags"><span class="tag">转换</span><span class="tag">矢量</span></div>
|
||||
</div>
|
||||
<div class="pcard" data-name="便利贴 sticky 画布便利贴:多行文本 + 字号/粗细调节 + 8 色背景,纯说明不连线 标注 便签" data-tags="标注,便签">
|
||||
<div class="head"><span class="av" style="background:#fdf3d0">📝</span>
|
||||
<div><div class="nm">便利贴</div><div class="ver">v1.0.7 · 官方</div></div></div>
|
||||
<div class="desc">画布便利贴:多行文本 + 字号/粗细调节 + 8 色背景,纯说明不连线</div>
|
||||
<div class="tags"><span class="tag">标注</span><span class="tag">便签</span></div>
|
||||
</div>
|
||||
<div class="pcard" data-name="风格库 style-source 风格提示词库与一键套用 提示词 风格" data-tags="提示词,风格">
|
||||
<div class="head"><span class="av" style="background:#fdf0e6">🎨</span>
|
||||
<div><div class="nm">风格库</div><div class="ver">v1.3.3 · 官方</div></div></div>
|
||||
|
||||
+218
-1
@@ -1,8 +1,218 @@
|
||||
{
|
||||
"app": "Image Workbench",
|
||||
"subtitle": "本地优先的 AI 生图无限画布 · 桌面版(Tauri v2)",
|
||||
"updatedAt": "2026-11-24T00:39:37.806Z",
|
||||
"updatedAt": "2026-11-24T14:18:26.125Z",
|
||||
"releases": [
|
||||
{
|
||||
"version": "3.26.64",
|
||||
"date": "2026-11-24",
|
||||
"notes": "",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.64_aarch64.dmg",
|
||||
"size": 8802792,
|
||||
"sha256": "8eb46ce43dc22c2fe84b8dc60d50d0fd3ada88c3f8820e55b00d4f4b90e77b95",
|
||||
"h": "8eb46ce43dc2",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.64_x64.dmg",
|
||||
"size": 9192936,
|
||||
"sha256": "30cd128a4d5135bfbe85a9e61b4d6de12c5d35b89b798df69f6e8d960ad56e00",
|
||||
"h": "30cd128a4d51",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.63",
|
||||
"date": "2026-11-24",
|
||||
"notes": "",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.63_aarch64.dmg",
|
||||
"size": 8804160,
|
||||
"sha256": "f120d77388000a6c98d64937c575cca98965e2b64475563a7e40970d083238fe",
|
||||
"h": "f120d7738800",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.63_x64.dmg",
|
||||
"size": 9193234,
|
||||
"sha256": "45b39f572b643cff2b6e9a560887b4747c1e817a701bee982700a405bc0e4fe2",
|
||||
"h": "45b39f572b64",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.62",
|
||||
"date": "2026-11-24",
|
||||
"notes": "",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.62_aarch64.dmg",
|
||||
"size": 8800819,
|
||||
"sha256": "5a611553eff11552d4468dad12d28b4942e16d7d52faf6568a2e248d5f4682d1",
|
||||
"h": "5a611553eff1",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.62_x64.dmg",
|
||||
"size": 9194494,
|
||||
"sha256": "4e240818ab18dfb21c51d79dbd714e7bcfd11aab1e7760cbc53ce72685006816",
|
||||
"h": "4e240818ab18",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.61",
|
||||
"date": "2026-11-24",
|
||||
"notes": "图库修复:出图即入图库、插入落地本地副本(画布可标注)、批量插入不再叠图",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.61_aarch64.dmg",
|
||||
"size": 8799439,
|
||||
"sha256": "d8921e905130268fbec91d18991c8836d75c634e354baa30987300e832df1a1d",
|
||||
"h": "d8921e905130",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.61_x64.dmg",
|
||||
"size": 9191382,
|
||||
"sha256": "840302aa03c17b38fdd8e2b66e246588536a5e4fb7ef0006f69b87aae2605712",
|
||||
"h": "840302aa03c1",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"windows-x86_64": {
|
||||
"file": "updates/windows-x86_64/image-workbench_3.26.61_x64-setup.exe",
|
||||
"size": 5014656,
|
||||
"sha256": "93ff30f82f1b936847bfc69a89af48531472502ed420714bb071e5c2844bce6c",
|
||||
"h": "93ff30f82f1b",
|
||||
"kind": "exe"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.60",
|
||||
"date": "2026-11-24",
|
||||
"notes": "浮层字号上调一档:模型设置/图像设置的选择项 11→13px、高 28px,面板 360px",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.60_aarch64.dmg",
|
||||
"size": 8799262,
|
||||
"sha256": "e3cd2adff23b1d2b4e1f5c52114c9151392a7864eb44686a9a607ef0272212ce",
|
||||
"h": "e3cd2adff23b",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.60_x64.dmg",
|
||||
"size": 9186576,
|
||||
"sha256": "1dd4ce4fa5b47a093d6f558b92af5e6074728c114629eec18c929bf1bb8c79c4",
|
||||
"h": "1dd4ce4fa5b4",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"windows-x86_64": {
|
||||
"file": "updates/windows-x86_64/image-workbench_3.26.60_x64-setup.exe",
|
||||
"size": 5005719,
|
||||
"sha256": "9c41e7a6f438b6a349e5853d82c99930c6607cc69807b75f430e741417df67e9",
|
||||
"h": "9c41e7a6f438",
|
||||
"kind": "exe"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.59",
|
||||
"date": "2026-11-24",
|
||||
"notes": "备份带上插件文件(提示词封面不再换机丢失);promptlib 1.11.0 封面文件治理",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.59_aarch64.dmg",
|
||||
"size": 8798901,
|
||||
"sha256": "31af87020085457e801143e471c53a7062fa29d47e54c08d4a200530e2949a06",
|
||||
"h": "31af87020085",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.59_x64.dmg",
|
||||
"size": 9185089,
|
||||
"sha256": "ef8bac19b21fed48686ad23262325529fc539881d59f4089436fb380893230a3",
|
||||
"h": "ef8bac19b21f",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.58",
|
||||
"date": "2026-11-24",
|
||||
"notes": "",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.58_aarch64.dmg",
|
||||
"size": 8798836,
|
||||
"sha256": "f2d0499c263727dc201fb84f4f52ec837294e93645bcf2bbf502a2e947e360ac",
|
||||
"h": "f2d0499c2637",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.58_x64.dmg",
|
||||
"size": 9186843,
|
||||
"sha256": "357bcf1f5c6c027328058b858a44ab151d8b62d5540e6db70b9012d28af2610b",
|
||||
"h": "357bcf1f5c6c",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"windows-x86_64": {
|
||||
"file": "updates/windows-x86_64/image-workbench_3.26.58_x64-setup.exe",
|
||||
"size": 5006832,
|
||||
"sha256": "1d471517cbb1d1322037127e44ba68e293339eb1453280f509451b69bb8a16d7",
|
||||
"h": "1d471517cbb1",
|
||||
"kind": "exe"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.57",
|
||||
"date": "2026-11-24",
|
||||
"notes": "",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.57_aarch64.dmg",
|
||||
"size": 8798003,
|
||||
"sha256": "3e45e7ddbd0367a556a8868aa1d11b196a2a7e0516d7f5eded64a8af86535c19",
|
||||
"h": "3e45e7ddbd03",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.57_x64.dmg",
|
||||
"size": 9183122,
|
||||
"sha256": "de9b2e7f102c479bc7ca6df57e0ae03e0458ce052b7057a56950885bc74ccadf",
|
||||
"h": "de9b2e7f102c",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.56",
|
||||
"date": "2026-11-24",
|
||||
"notes": "",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.56_aarch64.dmg",
|
||||
"size": 8800052,
|
||||
"sha256": "7fe6df3b0ad1f82cd6845ffe2ed2a5beef68e7b5bc10dc911edd321b7ab4e3f7",
|
||||
"h": "7fe6df3b0ad1",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.56_x64.dmg",
|
||||
"size": 9190562,
|
||||
"sha256": "292929a68279a7c5572026c87b4798b720982caec59d5b56a6e97e5a22f32f2f",
|
||||
"h": "292929a68279",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.55",
|
||||
"date": "2026-11-24",
|
||||
@@ -21,6 +231,13 @@
|
||||
"sha256": "c121f0855a2a56d00684ab1f1c83428832e8738a2ef5c3186d33ab27a867b087",
|
||||
"h": "c121f0855a2a",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"windows-x86_64": {
|
||||
"file": "updates/windows-x86_64/image-workbench_3.26.55_x64-setup.exe",
|
||||
"size": 5008672,
|
||||
"sha256": "3613add4c85f5e8623bbfa5ca4f953b3a231d82b785391e56026c0863f270e67",
|
||||
"h": "3613add4c85f",
|
||||
"kind": "exe"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Generated
+1
-1
@@ -1983,7 +1983,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "image-workbench"
|
||||
version = "3.26.55"
|
||||
version = "3.26.64"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"base64 0.22.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "image-workbench"
|
||||
version = "3.26.55"
|
||||
version = "3.26.64"
|
||||
description = "无限画布 · 生图工作台桌面版"
|
||||
authors = ["malongan"]
|
||||
license = ""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"productName": "image-workbench",
|
||||
"version": "3.26.55",
|
||||
"version": "3.26.64",
|
||||
"identifier": "com.malongan.imageworkbench",
|
||||
"build": {
|
||||
"frontendDist": "../dist",
|
||||
|
||||
@@ -72,6 +72,12 @@
|
||||
--iwb-err: #b91c1c;
|
||||
--iwb-ok: #15803d;
|
||||
--iwb-warn: #b45309;
|
||||
--iwb-err-bg: #f1e1e1;
|
||||
--iwb-err-bd: #dfa4a4;
|
||||
--iwb-ok-bg: #e0ebe4;
|
||||
--iwb-ok-bd: #a1cab0;
|
||||
--iwb-warn-bg: #f0e7df;
|
||||
--iwb-warn-bd: #deb99d;
|
||||
/* —— 尺度层(L1)—— */
|
||||
--sp-1: 4px; /* @deprecated 全部 5 个 → M3 的 --iwb-space-4/8/12/16/24 */
|
||||
--sp-2: 8px;
|
||||
@@ -109,6 +115,7 @@
|
||||
--iwb-radius-panel: 12px; /* 面板/工具栏 */
|
||||
--iwb-radius-popover: 14px; /* 浮层/菜单/右键 */
|
||||
--iwb-radius-full: 999px; /* 圆形/药丸 */
|
||||
--iwb-font-2xs: 10px; /* 极小标注:徽标角标/画布坐标/缩略图角标(2026-11-24 承认它,此前 29 处裸写) */
|
||||
--iwb-font-xs: 11px; /* M4 字号:状态栏/徽标 */
|
||||
--iwb-font-sm: 12px; /* 标签/次要正文 */
|
||||
--iwb-font-md: 13px; /* 紧凑正文/工具栏标题 */
|
||||
@@ -121,6 +128,18 @@
|
||||
--iwb-tab-h: 28px; /* 标签高度 */
|
||||
--iwb-tab-radius: 7px; /* 标签圆角 */
|
||||
--iwb-control-h: 30px; /* 表单控件高度:同一行里的输入框与默认按钮必须等高(设置页实测曾是 33 vs 24) */
|
||||
--iwb-bw: 1px; /* 描边宽度(2026-11-24):常规分隔/控件边框 */
|
||||
--iwb-bw-strong: 2px; /* 强调描边:选中/焦点/危险操作(不要再用 2px 裸值) */
|
||||
--iwb-icon-sm: 14px; /* 小图标:行内/按钮内 */
|
||||
--iwb-icon-md: 16px; /* 标准图标:工具栏/菜单 */
|
||||
--iwb-icon-lg: 18px; /* 大图标:导航/空态 */
|
||||
--iwb-opacity-disabled: 0.45; /* 禁用态透明度(此前 0.45/0.55 混用) */
|
||||
--iwb-opacity-muted: 0.7; /* 次要/未激活元素透明度 */
|
||||
--iwb-ease-out: cubic-bezier(0.16, 1, 0.3, 1); /* 入场/展开缓动:快出慢停 */
|
||||
--iwb-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1); /* 状态切换缓动 */
|
||||
--iwb-motion-fast: 0.12s; /* M6 动效:悬停/开关/小位移 */
|
||||
--iwb-motion-base: 0.15s; /* M6 动效:面板展开/尺寸变化 */
|
||||
--iwb-motion-slow: 0.3s; /* M6 动效:整屏过渡/抽屉 */
|
||||
--iwb-z-ctx: 90; /* 右键遮罩 */
|
||||
--iwb-z-ctx-menu: 91; /* 右键菜单 */
|
||||
--iwb-z-curtain: 100; /* 应用遮罩 / 图片预览底 */
|
||||
@@ -208,3 +227,46 @@
|
||||
--iwb-anim-flow-a: color-mix(in srgb, var(--iwb-brand) 16%, var(--iwb-layer));
|
||||
--iwb-anim-flow-b: color-mix(in srgb, var(--iwb-brand) 46%, var(--iwb-layer));
|
||||
}
|
||||
|
||||
|
||||
/* component.settings:由 gen-tokens 生成,勿手改;布局属性仍在 style.css */
|
||||
.iwb-settings-modal {
|
||||
--iwb-set-label-w: 180px; /* 标签列宽 */
|
||||
--iwb-set-col-gap: var(--iwb-space-16); /* 标签列与控件列间距 */
|
||||
--iwb-set-row-h: 40px; /* 设置行高 */
|
||||
--iwb-set-row-pad-y: var(--iwb-space-8); /* 行上下内边距 */
|
||||
--iwb-set-group-gap: var(--iwb-space-32); /* 分组之间(规范 §3.11:32px) */
|
||||
--iwb-set-title-gap: var(--iwb-space-8); /* 分组标题与分组体间距 */
|
||||
--iwb-set-group-bg: hsl(0 0% 97.6%); /* 分组体底色:设计值 #F9F9F9(用 hsl 表达以过 hex 闸门) */
|
||||
--iwb-set-group-radius: var(--iwb-radius-card); /* 分组体圆角 */
|
||||
--iwb-set-group-pad-x: var(--iwb-space-20); /* 分组体左右内边距 */
|
||||
--iwb-set-group-pad-y: var(--iwb-space-12); /* 分组体上下内边距 */
|
||||
--iwb-set-divider: color-mix(in srgb, var(--iwb-border) 55%, transparent); /* 行分隔线 */
|
||||
--iwb-set-hint-color: var(--iwb-text-dim); /* 说明文字色 */
|
||||
--iwb-set-hint-size: var(--iwb-font-xs); /* 说明文字字号 */
|
||||
--iwb-set-hint-gap: var(--iwb-space-2); /* 说明文字上间距 */
|
||||
--iwb-set-input-border: color-mix(in srgb, var(--iwb-border) 40%, var(--iwb-panel)); /* 输入框描边 */
|
||||
--iwb-set-check-size: 16px; /* 复选项尺寸 */
|
||||
--iwb-set-check-radius: 4px; /* 复选项圆角 */
|
||||
--iwb-set-btn-gap: var(--iwb-space-8); /* 操作按钮间距 */
|
||||
}
|
||||
|
||||
/* component.settings · 暗色覆盖 */
|
||||
.theme-dark .iwb-settings-modal {
|
||||
--iwb-set-group-bg: color-mix(in srgb, var(--iwb-text) 8%, var(--iwb-panel)); /* 暗色分组体:文字色 8% 混面板 */
|
||||
}
|
||||
|
||||
/* component.popover:由 gen-tokens 生成,勿手改;布局属性仍在 style.css */
|
||||
.iwb-pop {
|
||||
--iwb-pop-w: 360px; /* 面板宽度(窄屏靠 max-width 兜底) */
|
||||
--iwb-pop-pad-y: var(--iwb-space-10); /* 面板上下内边距 */
|
||||
--iwb-pop-pad-x: var(--iwb-space-12); /* 面板左右内边距 */
|
||||
--iwb-pop-gap: var(--iwb-space-8); /* 分组之间 */
|
||||
--iwb-pop-radius: var(--iwb-radius-popover); /* 面板圆角 */
|
||||
--iwb-pop-title-size: var(--iwb-font-base); /* 面板标题字号 */
|
||||
--iwb-pop-chip-h: 28px; /* 选择项/下拉/数字框高度 */
|
||||
--iwb-pop-chip-pad-x: var(--iwb-space-10); /* 选择项左右内边距 */
|
||||
--iwb-pop-chip-radius: 6px; /* 选择项圆角 */
|
||||
--iwb-pop-chip-gap: var(--iwb-space-6); /* 选择项间距 */
|
||||
--iwb-pop-chip-size: var(--iwb-font-md); /* 选择项字号 */
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
/* gallery-sync.js —— 图库 ↔ 画布的同步边界(v3.26.61)
|
||||
*
|
||||
* 这里只放「跨存储区域」的动作,app.js 只做装配(注入既有能力)和 commit:
|
||||
* ① archiveEntryNow(entry, refresh) —— 单张生成结果立刻入图库(串行队列 + 等缩略图 + 通知插件)
|
||||
* ② notifyChanged(reason) —— 图库变了(删除/恢复/清空/归档)→ 通知图库插件重拉
|
||||
* ③ localCopySrcOf(item) —— 图库条目 → **本地字节**(dataURL);本地没有就抓一次远程
|
||||
* ④ prepareInsert(list, k) —— 条目 → 可建节点的 [{src, srcUrl, name}](压缩 + 引用化)
|
||||
* ⑤ gridSpots(base, n, opt) —— 批量插入的栅格落点
|
||||
*
|
||||
* 为什么需要 ①:归档原本只在整轮结束做一次(archiveGenerationResults),而一次 4 张、每张 20s,
|
||||
* 第 1 张上图时图库还是空的。为什么需要 ③:解析不出本地字节时旧实现把 http 链接直接写进
|
||||
* 节点 data.url,标注插件判「远程图片不支持标注」,用户以为插入失败。
|
||||
* 用户裁定(2026-11-24):B6 = 复制 —— 插入一律落地本地副本,多占空间可以,不能丢数据。
|
||||
*/
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
|
||||
function create (deps) {
|
||||
const d = deps || {}
|
||||
const queue = { chain: Promise.resolve() }
|
||||
// 同一 entry 只归档一次(WeakSet:entry 对象用完即回收,不给画布数据添字段)
|
||||
const archived = (typeof WeakSet === 'function') ? new WeakSet() : null
|
||||
|
||||
function notifyChanged (reason) {
|
||||
try { if (typeof d.emit === 'function') d.emit(reason || 'changed') } catch (e) { /* 插件回调异常不影响宿主 */ }
|
||||
}
|
||||
|
||||
// 单张结果 → 图库。串行是必须的:多个任务并发完成时,索引是「读-改-写」,
|
||||
// 并发写会互相吃掉条目。awaitArchive 让这张的缩略图先落盘,插件取 thumb 直接命中。
|
||||
function archiveEntryNow (entry, refresh) {
|
||||
if (!entry) return Promise.resolve(false)
|
||||
if (archived) {
|
||||
if (archived.has(entry)) return Promise.resolve(false)
|
||||
archived.add(entry) // 先打标:重试调用也只归档一次
|
||||
}
|
||||
const job = queue.chain.then(async () => {
|
||||
const items = (typeof d.flatten === 'function') ? d.flatten([entry]) : []
|
||||
if (items.length && typeof d.addOutputs === 'function') {
|
||||
try { await d.addOutputs(items, { awaitArchive: true }) } catch (e) { /* 图库缓存失败不影响画布结果 */ }
|
||||
}
|
||||
try { if (typeof refresh === 'function') await refresh() } catch (e) { /* ignore */ }
|
||||
notifyChanged('output')
|
||||
return true
|
||||
})
|
||||
queue.chain = job.then(() => {}, () => {}) // 队列只关心「上一张结束」,不传递结果/异常
|
||||
return job
|
||||
}
|
||||
|
||||
// 图库条目 → **本地字节**(dataURL)。取源顺序沿用宿主既有口径「画质最优优先」:
|
||||
// ① 原图文件(桌面端 images/gallery,浏览器 IndexedDB)
|
||||
// ② 远程原图抓一次字节(桌面端走 Rust 请求不受 CORS;8s 超时,慢图床不拖着插入不放)
|
||||
// ③ 清单里已 hydrate 的 data / 320 缩略图(能标注,但画质将就)
|
||||
// ④ '' —— 交给调用方保留原链接,绝不阻断插入、绝不丢图
|
||||
// 注意 ②③ 的顺序:缩略图排远程之后。反过来的话「有远程原图却插进一张 320 小图」,
|
||||
// 用户标注完导出才发现糊了。
|
||||
async function localCopySrcOf (item) {
|
||||
if (!item) return ''
|
||||
const fetchRemote = async (url) => {
|
||||
if (!/^https?:/i.test(url)) return ''
|
||||
if (typeof d.isDesktop === 'function' && d.isDesktop() && typeof d.desktopFetch === 'function') {
|
||||
try { const r = await d.desktopFetch(url); if (r && r.ok) { const b = await r.blob(); const du = b && typeof d.blobToDataUrl === 'function' ? await d.blobToDataUrl(b) : ''; if (du) return du } } catch (e) { /* 白名单外/网络失败 → 落到 WebView fetch */ }
|
||||
}
|
||||
if (typeof d.blobFromSrc !== 'function') return ''
|
||||
const blob = await d.blobFromSrc(url).catch(() => null)
|
||||
return (blob && typeof d.blobToDataUrl === 'function') ? await d.blobToDataUrl(blob) : ''
|
||||
}
|
||||
try {
|
||||
if (item.origIdb && typeof d.get === 'function') {
|
||||
const v = await d.get(item.origIdb).catch(() => null)
|
||||
if (v) return v
|
||||
}
|
||||
const url = String(item.url || '')
|
||||
if (/^https?:/i.test(url)) {
|
||||
// 8s 上限:抓不到就走缩略图,别让插入卡在图床超时上
|
||||
const remote = await Promise.race([fetchRemote(url), new Promise((r) => setTimeout(() => r(''), 8000))])
|
||||
if (remote) return remote
|
||||
}
|
||||
const data = (item.data && typeof item.data === 'object' && typeof d.refDataUrl === 'function')
|
||||
? await d.refDataUrl(item.data) : item.data
|
||||
if (typeof data === 'string' && data) return data
|
||||
if (item.idb && typeof d.get === 'function') {
|
||||
const v = await d.get(item.idb).catch(() => null)
|
||||
if (v) return v
|
||||
}
|
||||
if (url.indexOf('data:') === 0) return url
|
||||
} catch (e) { /* 取不到就交给调用方兜底 */ }
|
||||
return ''
|
||||
}
|
||||
|
||||
// 条目 → 插入用源。每张:本地副本 → SVG 纠正 → 按档压缩 → 引用化({__blob})。
|
||||
// 全部拿不到本地字节时保留原链接(remoteOnly 交给调用方提示),绝不阻断插入、绝不丢图。
|
||||
// extra:组件内才有的能力(refSrcOf / shrink / writeRef),按次注入,不放进 create 的长依赖表。
|
||||
async function prepareInsert (list, k, extra) {
|
||||
const e = extra || {}
|
||||
const refSrcOf = e.refSrcOf || d.refSrcOf
|
||||
const shrink = e.shrink || d.shrink
|
||||
const writeRef = e.writeRef || d.writeRef
|
||||
const items = Array.isArray(list) ? list.filter(Boolean) : []
|
||||
const out = []
|
||||
let remoteOnly = 0
|
||||
for (const f of items) {
|
||||
let src = await localCopySrcOf(f)
|
||||
if (!src) { src = String(f.url || ''); if (src) remoteOnly++ }
|
||||
if (typeof refSrcOf === 'function') src = await refSrcOf(src, (msg) => { if (typeof d.notice === 'function') d.notice(msg) })
|
||||
if (typeof src === 'string' && src.indexOf('data:') === 0 && typeof shrink === 'function') src = await shrink(src, k)
|
||||
const ref = (typeof src === 'string' && src.indexOf('data:') === 0 && typeof writeRef === 'function') ? await writeRef(src) : null
|
||||
out.push({ src: ref || src || '', srcUrl: String(f.url || ''), name: f.name })
|
||||
}
|
||||
return { items: out, remoteOnly: remoteOnly }
|
||||
}
|
||||
|
||||
// 批量插入的落点:旧实现在循环里每张都 findSpot,而 findSpot 只看已 commit 的节点 ⇒
|
||||
// 整批落在同一坐标,视觉上只有一张。这里按 4 列栅格铺开(与「粘贴多图」同一手感)。
|
||||
function gridSpots (base, n, opt) {
|
||||
const o = opt || {}
|
||||
const stepX = Number(o.stepX) || 288
|
||||
const stepY = Number(o.stepY) || 276
|
||||
const cols = Math.max(1, Number(o.cols) || 4)
|
||||
const x0 = (base && Number(base.x)) || 0
|
||||
const y0 = (base && Number(base.y)) || 0
|
||||
const out = []
|
||||
for (let i = 0; i < Math.max(0, n); i++) out.push({ x: x0 + (i % cols) * stepX, y: y0 + Math.floor(i / cols) * stepY })
|
||||
return out
|
||||
}
|
||||
|
||||
// 这条结果是否已经逐张归档过(整轮归档据此跳过,避免同一张图入两次库)
|
||||
function wasArchived (entry) {
|
||||
return !!(archived && entry && typeof entry === 'object' && archived.has(entry))
|
||||
}
|
||||
|
||||
// 节点 → 可标注的图。候选里必须带 data.localRef:远程参考图的本地缓存
|
||||
// (src/image-remote-cache.js)命中后写在那个字段上,早先这里没读它,于是「缓存明明有了」
|
||||
// 插件仍只看 data.url 的 http 链接,直接判「远程图片不支持标注」(用户报障的直接成因)。
|
||||
// 只有远程链接时按需抓一次并写回 localRef(之后都走本地);抓不到返回 url,不丢数据。
|
||||
async function nodeImageOf (node, extra) {
|
||||
const e = extra || {}
|
||||
const n = node
|
||||
if (!n || !n.data) return null
|
||||
const first = Array.isArray(n.data.result) ? (n.data.result[0] || {}) : n.data.result
|
||||
const candidates = [n.data.data, n.data.localRef, n.data.url, first && (first.url || first.data)]
|
||||
const resolveRef = (typeof d.refDataUrl === 'function') ? d.refDataUrl : null
|
||||
let remote = ''
|
||||
for (const v of candidates) {
|
||||
if (!v) continue
|
||||
if (typeof v === 'string') {
|
||||
if (/^data:/i.test(v)) return { dataUrl: v }
|
||||
if (/^https?:/i.test(v)) { if (!remote) remote = v; continue } // 先记住远程,继续找本地
|
||||
return { url: v }
|
||||
}
|
||||
if (resolveRef) { const dataUrl = await resolveRef(v); if (dataUrl) return { dataUrl } }
|
||||
}
|
||||
if (!remote) return null
|
||||
const du = await localCopySrcOf({ url: remote })
|
||||
if (!du) return { url: remote }
|
||||
if (typeof e.writeRef === 'function') {
|
||||
try { const ref = await e.writeRef(du); if (ref && typeof e.onLocalRef === 'function') e.onLocalRef(ref) } catch (err) { /* 写回失败不影响本次结果 */ }
|
||||
}
|
||||
return { dataUrl: du }
|
||||
}
|
||||
|
||||
// 图库格子的缩略图地址。新图刚入库时 React 快照可能还没带上 data(缩略图在后台并发生成),
|
||||
// 旧实现直接 `f.data || f.url` —— 于是要么空、要么现拉远程图床(慢、跨域、限流都会转成
|
||||
// 「图片已丢失」)。这里按 清单 data → images/thumbs/ 缩略图 → 本地原图 → 远程 顺序取。
|
||||
async function thumbFor (name, extra) {
|
||||
const e = extra || {}
|
||||
const f = (Array.isArray(e.outputs) ? e.outputs : []).find((x) => x && x.name === name)
|
||||
if (!f) return ''
|
||||
const display = (typeof e.displayThumbOf === 'function') ? e.displayThumbOf : ((v) => v)
|
||||
if (f.data) return display(f.data)
|
||||
if (f.thumbHash && typeof e.galleryThumb === 'function') {
|
||||
try { const v = await e.galleryThumb(f.thumbHash); if (v) return display(v) } catch (err) { /* 继续本地原图 */ }
|
||||
}
|
||||
const local = await localCopySrcOf(f)
|
||||
if (local) return display(local)
|
||||
return display(f.url || '')
|
||||
}
|
||||
|
||||
return { archiveEntryNow, wasArchived, notifyChanged, localCopySrcOf, prepareInsert, gridSpots, nodeImageOf, thumbFor }
|
||||
}
|
||||
|
||||
let attached = null
|
||||
|
||||
// 单例装配:app.js 只需一行就能拿到全部能力(依赖表长,写在 app.js 里会撑破行数棘轮)
|
||||
function attach (deps) {
|
||||
attached = create(deps)
|
||||
return attached
|
||||
}
|
||||
function get () { return attached }
|
||||
|
||||
global.IWBGallerySync = { create, attach, get }
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
@@ -1,7 +1,9 @@
|
||||
/* 图片字节的 Blob 仓库(借鉴 OpenTu 的资产模型:记录只留引用 + 元数据,字节独立存放)
|
||||
*
|
||||
* 目的:画板记录(以及每份撤销快照、每次落库)不再携带 MB 级 base64 字符串。
|
||||
* - 写入:dataURL/base64 → 存成 IDB 里的 **Blob**,返回 key(内容哈希去重 ⇒ 同图只存一份)
|
||||
* - 写入:dataURL/base64 → 存成**注入的 idb 后端**里的 Blob,返回 key(内容哈希去重 ⇒ 同图只存一份)
|
||||
* idb 由调用方注入:浏览器 = IndexedDB;桌面端 = storage-file 的文件 KV ⇒ 落 images/canvas/<sha16>.<ext>
|
||||
* (本文件不认识"文件",只认识 put/get/del;任何"字节在 IndexedDB"的结论都要先看调用方注入了谁)
|
||||
* - 记录里只放引用对象 { __blob: 'imgblob_<hash>_<len>' }
|
||||
* - 渲染/导出时按需 resolve(dataURL 或 Blob),用完不驻留
|
||||
* - 内存 Blob 缓存为**有界 LRU**(create({ blobCacheMax }),缺省 200):淘汰只丢句柄,getBlob 会回 IDB 重读;
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
* 做法:空闲时下载一次,写入本地引用存储,节点上只记 data.localRef(显示用)。
|
||||
*
|
||||
* 约束(用户裁定):节点 data.url 保持原样 ⇒ **提交生成时仍然用链接**。
|
||||
* 谁在读 localRef(v3.26.61 修正):插件取图走 canvasBridge.getNodeImage,它的候选列表里必须有
|
||||
* localRef —— 早先漏了它,于是缓存明明命中,标注插件仍只看到 data.url 的 http 链接,
|
||||
* 直接判「远程图片不支持标注」(用户报障的直接成因)。改这个字段的写入时机/格式前先看那里。
|
||||
*/
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
/* plugin-api-gallery.js —— 宿主 gallery capability(M5)
|
||||
*
|
||||
* 给插件一块**只读为主**的图库访问面:列表 / 缩略图 / 预览 / 下载 / 插入画布 / 删除。
|
||||
* 图片字节仍留在宿主(images/ + 图库索引),插件拿不到文件路径,只能拿元数据与缩略图 URL。
|
||||
* 图片字节仍留在宿主(桌面端 = images/gallery + images/thumbs 文件,浏览器 = IndexedDB),
|
||||
* 插件拿不到文件路径,只能拿元数据与缩略图 URL。
|
||||
*
|
||||
* 为什么要这层「impl 桥」:
|
||||
* capability 在 PluginHost.init 时创建(早于组件渲染),拿不到 Workbench 的 state/refs。
|
||||
* 所以这里只保存一组**稳定的代理函数**,真正的实现由 Workbench 每次渲染时 setImpl 注入。
|
||||
*
|
||||
* v1.7.0(2026-11-24):补 onChanged —— 此前只有「拉」没有「推」,出图后图库面板要等
|
||||
* 可见性变化/5s 节流才刷新,用户看到的是「生成了但图库没图」。宿主在归档、删除、恢复后
|
||||
* emit 一次,插件订阅后自己 load()。
|
||||
*/
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
|
||||
let impl = null
|
||||
const listeners = []
|
||||
|
||||
function setImpl (next) {
|
||||
impl = (next && typeof next === 'object') ? next : null
|
||||
@@ -24,6 +30,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 图库数据变了下发一次(生成结果逐张归档 / 删除 / 恢复 / 清空 / 保留策略剪枝)
|
||||
function emit (reason) {
|
||||
for (const fn of listeners.slice()) {
|
||||
try { fn(reason || 'changed') } catch (e) { /* 插件回调异常不影响宿主 */ }
|
||||
}
|
||||
}
|
||||
|
||||
// 稳定代理:插件拿到的对象永不变,内部每次都取最新的 impl
|
||||
const API = {
|
||||
list: call('list'),
|
||||
@@ -32,6 +45,12 @@
|
||||
download: call('download'),
|
||||
insert: call('insert'),
|
||||
remove: call('remove'),
|
||||
openFolder: call('openFolder'),
|
||||
onChanged: function (fn) {
|
||||
if (typeof fn !== 'function') return function () {}
|
||||
listeners.push(fn)
|
||||
return function () { const i = listeners.indexOf(fn); if (i >= 0) listeners.splice(i, 1) }
|
||||
},
|
||||
}
|
||||
|
||||
// 纯函数:把宿主 outputs + 查询参数变成插件要的条目(不含 data,避免把 base64 递给插件)
|
||||
@@ -49,5 +68,5 @@
|
||||
return { items: items, total: res.total || items.length }
|
||||
}
|
||||
|
||||
global.IWBPluginGallery = { setImpl: setImpl, api: function () { return API }, query: query }
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
global.IWBPluginGallery = { setImpl: setImpl, api: function () { return API }, query: query, emit: emit }
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
@@ -5,6 +5,7 @@
|
||||
* save({prompts, groups}) → 落盘(宿主仍持有数据:iwb_web_prompts + 分组缓存)
|
||||
* insert(text, name) → 在画布视口中心插入提示词节点(插件不碰画布状态)
|
||||
* copy(text) → 走宿主剪贴板(失败有可见提示)
|
||||
* paste() → 读剪贴板文本(导入别人的分享用)
|
||||
* insertImage(cover, name) → 把封面作为参考图节点插入画布
|
||||
* notify(text, type) → 宿主 toast / 提示条
|
||||
* putCover(dataUrl) → 封面入宿主图片库(返回 ref)
|
||||
@@ -52,6 +53,7 @@
|
||||
save: call('save'),
|
||||
insert: call('insert'),
|
||||
copy: call('copy'),
|
||||
paste: call('paste'),
|
||||
insertImage: call('insertImage'),
|
||||
notify: call('notify'),
|
||||
putCover: call('putCover'),
|
||||
|
||||
@@ -230,12 +230,61 @@
|
||||
return { bytes: n, count: all.length }
|
||||
}
|
||||
|
||||
// ---- 插件文件(plugin-data/<id>/files/,v3.26.59)----
|
||||
// 为什么放在这层:备份/还原只认 IWBPluginData 一个入口。此前只备份 JSON,
|
||||
// 于是「提示词封面」这类图片文件换机后全丢(标题栏说"已恢复",打开却是灰块)。
|
||||
// 内存纪律:清单(id/name/size)一次性给出;字节**逐条读**(调用方写完即放手),
|
||||
// 不做"全部读进数组再写包"——插件文件单插件上限 64MB,攒起来会 OOM。
|
||||
function pluginFilesFacade () {
|
||||
const F = global.IWBStorageFile
|
||||
const pf = F && F.pluginFiles
|
||||
return (pf && typeof pf.listAll === 'function') ? pf : null
|
||||
}
|
||||
async function listFiles () {
|
||||
const pf = pluginFilesFacade()
|
||||
if (!pf) return []
|
||||
let groups = []
|
||||
try { groups = await pf.listAll() } catch (e) { groups = [] }
|
||||
const out = []
|
||||
for (const g of (Array.isArray(groups) ? groups : [])) {
|
||||
if (!g || !g.id) continue
|
||||
for (const f of (g.files || [])) {
|
||||
if (!f || !f.name) continue
|
||||
out.push({ id: String(g.id), name: String(f.name), size: Number(f.size) || 0 })
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
async function readFile (id, name) {
|
||||
const pf = pluginFilesFacade()
|
||||
if (!pf || typeof pf.readBytes !== 'function') return null
|
||||
try { return await pf.readBytes(String(id), String(name)) } catch (e) { return null }
|
||||
}
|
||||
// list = [{ id, name, data: dataURL }],单条失败不影响其它
|
||||
async function restoreFiles (list) {
|
||||
const F = global.IWBStorageFile
|
||||
const pf = F && F.pluginFiles
|
||||
if (!pf || typeof pf.put !== 'function') return 0
|
||||
let n = 0
|
||||
for (const it of (Array.isArray(list) ? list : [])) {
|
||||
if (!it || !it.id || !it.name || !it.data) continue
|
||||
try {
|
||||
const r = await pf.put(String(it.id), String(it.name), String(it.data))
|
||||
if (r && r.ok) n++
|
||||
} catch (e) { /* 单个失败不影响其它 */ }
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
global.IWBPluginData = {
|
||||
create: create,
|
||||
stripLegacy: stripLegacy,
|
||||
collectAll: collectAll,
|
||||
restoreAll: restoreAll,
|
||||
totalSize: totalSize,
|
||||
listFiles: listFiles,
|
||||
readFile: readFile,
|
||||
restoreFiles: restoreFiles,
|
||||
_bytesOf: bytesOf,
|
||||
}
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
@@ -26,6 +26,9 @@
|
||||
getAutoDownload() { return !!(state.impl && state.impl.getAutoDownload && state.impl.getAutoDownload()) },
|
||||
setAutoDownload(on) { if (state.impl && state.impl.setAutoDownload) state.impl.setAutoDownload(on) },
|
||||
openDataDir() { return state.impl ? state.impl.openDataDir() : Promise.reject(new Error('仅桌面端可用')) },
|
||||
// 2026-11-24:插件要「打开本地图库目录」「读剪贴板导入分享」——都落在宿主桥里,app.js 只做装配。
|
||||
openDataSubpath(rel) { return state.impl && state.impl.openDataSubpath ? state.impl.openDataSubpath(rel) : Promise.reject(new Error('仅桌面端可用')) },
|
||||
clipboardReadText() { return state.impl && state.impl.clipboardReadText ? state.impl.clipboardReadText() : Promise.resolve('') },
|
||||
// 原生剪贴板图片(v3.26):WKWebView 里 paste 事件拿不到 Finder 复制的图片,
|
||||
// navigator.clipboard.write 也常不可用,统一走 Rust 侧 arboard。
|
||||
clipboardReadImage() { return state.impl && state.impl.clipboardReadImage ? state.impl.clipboardReadImage() : Promise.resolve(null) },
|
||||
@@ -37,5 +40,33 @@
|
||||
uninstall(id) { return state.impl && state.impl.marketUninstall ? state.impl.marketUninstall(id) : Promise.resolve({ ok: false, error: '仅桌面端可用' }) },
|
||||
},
|
||||
}
|
||||
// 2026-11-24:插件侧「打开资料目录子路径」「读剪贴板文本」两个小能力。
|
||||
// 放在桥里而不是 app.js:一是 app.js 有行数棘轮,二是它们只依赖 __TAURI__。
|
||||
const helpers = {
|
||||
async openGalleryDir () {
|
||||
try {
|
||||
const T = (typeof window !== 'undefined') ? window.__TAURI__ : null
|
||||
if (!T || !T.core || typeof T.core.invoke !== 'function') return { ok: false, error: '仅桌面端可打开本地目录' }
|
||||
const p = await T.core.invoke('open_data_subpath', { rel: 'images/gallery' })
|
||||
return { ok: true, path: p }
|
||||
} catch (e) { return { ok: false, error: String((e && e.message) || e) } }
|
||||
},
|
||||
async clipboardReadText () {
|
||||
try {
|
||||
const T = (typeof window !== 'undefined') ? window.__TAURI__ : null
|
||||
if (T && T.core && typeof T.core.invoke === 'function') {
|
||||
const t = await T.core.invoke('clipboard_read_text')
|
||||
if (t) return { ok: true, text: String(t) }
|
||||
}
|
||||
} catch (e) { /* 落到 navigator */ }
|
||||
try {
|
||||
const cb = navigator.clipboard
|
||||
if (cb && typeof cb.readText === 'function') return { ok: true, text: String((await cb.readText()) || '') }
|
||||
} catch (e) { return { ok: false, error: '浏览器拒绝了剪贴板读取' } }
|
||||
return { ok: false, error: '剪贴板不可用' }
|
||||
},
|
||||
}
|
||||
|
||||
global.IWBDesktopHelpers = helpers
|
||||
global.IWBDesktop = bridge
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
@@ -1,10 +1,4 @@
|
||||
|
||||
// 确认统一走页内确认(桌面端),网页端保持原生 confirm
|
||||
function askConfirm (text, opts) {
|
||||
const C = (typeof window !== 'undefined') ? window.IWBUIConfirm : null
|
||||
if (C && typeof C.askOrNative === 'function') return C.askOrNative(text, opts)
|
||||
return Promise.resolve(window.confirm(String(text)))
|
||||
}
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
const _lstore = () => (typeof global !== 'undefined' && global.IWBStorageLocal && typeof global.IWBStorageLocal.getStore === 'function') ? global.IWBStorageLocal.getStore() : null
|
||||
@@ -82,7 +76,7 @@
|
||||
|
||||
// ── runNode ──────────────────────────────────────────────
|
||||
async function runNode(ctx, nodeId, taskPromptId, onDone, opts) {
|
||||
const { acquireGenSlot, activeWsId, activeWsIdRef, commitRunNodes, ensurePolished, finishGenerationRun, persistRuns, pushHistory, refreshOutputs, refs, runLockConflicts, runWorkspaceNodes, setBusy, setNotice, setProgress, updateNode } = ctx
|
||||
const { acquireGenSlot, activeWsId, activeWsIdRef, archiveOne, commitRunNodes, ensurePolished, finishGenerationRun, persistRuns, pushHistory, refreshOutputs, refs, runLockConflicts, runWorkspaceNodes, setBusy, setNotice, setProgress, updateNode } = ctx
|
||||
const node = refs.nodes.find((n) => n.id === nodeId)
|
||||
if (!node) return 0
|
||||
const activeProvider = (wRawCfg().providers || []).find((p) => p.id === node.data.provider) || null
|
||||
@@ -372,6 +366,9 @@
|
||||
results[idx0] = entry
|
||||
// 流式展示逐张执行,不等待整个批次。
|
||||
liveUpsert(j.t.id, j.i, entry)
|
||||
// v3.26.61:这张已经上图 → 立刻归档进图库(串行队列 + 等缩略图,内部再通知插件)。
|
||||
// 不 await:归档慢(原图落盘 + 缩略图)不能拖住下一张的调度;失败也不影响本张结果。
|
||||
try { if (typeof archiveOne === 'function') archiveOne(entry) } catch (e) { /* ignore */ }
|
||||
// 出图后的自动保存统一由 archiveGenerationResults → wAutoSaver 负责:先等图库归档完成,
|
||||
// 再从本地原图字节(images/gallery 的 out_orig_)复制到导出目录。
|
||||
// 这里过去调用交互式 downloadUrl(),导致两个线上问题:
|
||||
@@ -854,7 +851,7 @@
|
||||
if (!migrated.ok) throw new Error(migrated.error || '画布版本不受支持')
|
||||
const obj = migrated.value
|
||||
if (!obj || obj.app !== 'image-workbench' || !Array.isArray(obj.nodes)) throw new Error('文件格式不正确(应为 .iwb.json)')
|
||||
if (refs.nodes.length && !fromDrop && !(await askConfirm('导入将替换当前画布(' + refs.nodes.length + ' 个节点),确定继续?', { title: '导入画布', okText: '替换' }))) return
|
||||
if (refs.nodes.length && !fromDrop && !(await window.IWBUIConfirm.askOrNative('导入将替换当前画布(' + refs.nodes.length + ' 个节点),确定继续?', { title: '导入画布', okText: '替换' }))) return
|
||||
const idMap = {}
|
||||
const ns = obj.nodes.filter((n) => n && NODE_TYPES.has(n.type)).map((n) => {
|
||||
const nid = uid('n')
|
||||
@@ -1030,7 +1027,7 @@
|
||||
|
||||
// ── 画布拖拽导入(2026-11-06 从 Workbench 外移;行为逐字保留)───────────────────
|
||||
function startCanvasDrop(ctx) {
|
||||
const { canvasEl, refs, uiZoom, importCanvasFile, instantiateGroup, wResolveOutputSrc, wImgRefWrite, wImportImage, uid, pushHistory, commitCanvas, setSel, setNotice, outputs } = ctx
|
||||
const { canvasEl, refs, uiZoom, importCanvasFile, instantiateGroup, localSrcOfOutput, wResolveOutputSrc, wImgRefWrite, wImportImage, uid, pushHistory, commitCanvas, setSel, setNotice, outputs } = ctx
|
||||
const el0 = canvasEl && canvasEl.el
|
||||
if (!el0) return undefined
|
||||
const onDragOver = (e) => { e.preventDefault() }
|
||||
@@ -1079,7 +1076,10 @@
|
||||
}
|
||||
if (origName) {
|
||||
const item = (refs.outputs || outputs || []).find((x) => x && x.name === origName)
|
||||
wResolveOutputSrc(item).then(async (src) => {
|
||||
// v3.26.61:拖入也走「本地字节目录」(含按需抓远程再落副本),与「插入」按钮同一条路,
|
||||
// 否则拖进来的节点仍可能是 http 链接 —— 同一张图,按钮插入能标注、拖进来不能,说不过去。
|
||||
const pickSrc = () => (typeof localSrcOfOutput === 'function' ? localSrcOfOutput(item) : wResolveOutputSrc(item))
|
||||
Promise.resolve(pickSrc()).then(async (src) => {
|
||||
// 与「图库插入」按钮同一收口:SVG 先纠正成 PNG,否则矢量会一路传到模型接口
|
||||
const raw = await refSrcOf(src || localRefPayload || (item && item.url) || '', (msg) => setNotice({ type: 'err', text: msg }))
|
||||
if (!raw) { insertRef(''); return }
|
||||
@@ -2094,7 +2094,9 @@
|
||||
}
|
||||
const refreshOutputs = (limit) => {
|
||||
const requestId = ++outputRequestSeq.current
|
||||
api('outputs', limit ? { limit } : undefined).then((r) => { if (requestId === outputRequestSeq.current && r && Array.isArray(r.files)) { setOutputs(r.files); setOutputsInfo(r) } }).catch(() => {})
|
||||
// v3.26.61:**返回 Promise** —— 逐张归档要在「图库插件收到通知」之前确认 React outputs 已经换成新列表
|
||||
// (插件的 list/thumb 走 impl,读的就是这份 state;不 await 就可能通知到了却还是旧列表)
|
||||
return api('outputs', limit ? { limit } : undefined).then((r) => { if (requestId === outputRequestSeq.current && r && Array.isArray(r.files)) { setOutputs(r.files); setOutputsInfo(r) } }).catch(() => {})
|
||||
}
|
||||
const deleteOutputs = (names) => {
|
||||
const list = Array.isArray(names) ? names : []
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
const checksum = config.checksum
|
||||
const payload = (data) => {
|
||||
const copy = JSON.parse(JSON.stringify(data || {}))
|
||||
delete copy.checksum
|
||||
delete copy.imagesData
|
||||
// 与 app.js 的 backupChecksumPayload 同口径:字节载荷(图片 / 插件文件)不进校验和
|
||||
delete copy.checksum; delete copy.imagesData; delete copy.images; delete copy.pluginFiles; delete copy.pluginFilesData
|
||||
return copy
|
||||
}
|
||||
return {
|
||||
|
||||
+91
-2
@@ -656,6 +656,37 @@
|
||||
return { ok: true, files: files, bytes: files.reduce((n, f) => n + (f.size || 0), 0), count: files.length }
|
||||
} catch (e) { return { ok: false, files: [], bytes: 0, count: 0 } }
|
||||
}
|
||||
// 备份用(v3.26.59):读原始字节,ZIP 直接写字节 —— 不做 dataURL 往返,省掉 33% 的 base64 膨胀。
|
||||
async function pluginFileReadBytes (id, name) {
|
||||
try {
|
||||
if (!pluginFileNameOk(name)) return null
|
||||
const u8 = await fs().readFile(await join(await pluginFilesDir(id), name))
|
||||
return (u8 && u8.length) ? u8 : null
|
||||
} catch (e) { return null }
|
||||
}
|
||||
// 备份用:枚举「所有插件」的插件文件(plugin-data/<id>/files/)。
|
||||
// 不调 pluginFilesDir(那个会 mkdir):没有 files 目录的插件直接跳过。
|
||||
async function pluginFilesListAll () {
|
||||
const out = []
|
||||
let entries = []
|
||||
try { entries = await fs().readDir(await pluginDataDir()) } catch (e) { return out }
|
||||
for (const e of entries) {
|
||||
if (!e || !e.isDirectory) continue
|
||||
const id = String(e.name || '')
|
||||
if (!/^[A-Za-z0-9][A-Za-z0-9._-]{1,63}$/.test(id)) continue
|
||||
let fe = []
|
||||
try { fe = await fs().readDir(await join(await pluginDataDir(), id, PFILE_DIR)) } catch (err) { continue }
|
||||
const files = []
|
||||
for (const f of fe) {
|
||||
if (!f || f.isDirectory || !pluginFileNameOk(f.name)) continue
|
||||
let size = 0
|
||||
try { const u8 = await fs().readFile(await join(await pluginDataDir(), id, PFILE_DIR, f.name)); size = u8 ? u8.length : 0 } catch (err2) { size = 0 }
|
||||
files.push({ name: f.name, size: size })
|
||||
}
|
||||
if (files.length) { files.sort((a, b) => a.name.localeCompare(b.name)); out.push({ id: id, files: files }) }
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
async function loadInto() {
|
||||
// data.json 不存在 ⇒ 把当前 WebView 里的数据迁过去(只做一次)
|
||||
@@ -1256,11 +1287,69 @@
|
||||
} catch (e) { return { ok: false, error: String((e && e.message) || e) } }
|
||||
}
|
||||
|
||||
/* 删除指定 key 的图片字节(2026-11-24):图库删图时索引清了、文件却还在 images/gallery/ 里,
|
||||
* 用户看到的「数据库里没删」就是这个。这里按登记表把文件移进 trash/(不直删,可找回),
|
||||
* 同时删掉登记项;画布仍引用同一文件时不搬(同一图可能既被画布引用又被图库引用)。 */
|
||||
async function deleteImageBytes(keys) {
|
||||
try {
|
||||
if (!enabled() || !dir) return { ok: false, error: '资料目录未就绪' }
|
||||
const list = Array.isArray(keys) ? keys : []
|
||||
if (!list.length) return { ok: true, moved: 0 }
|
||||
const canvasKeys = new Set()
|
||||
try {
|
||||
const cd = await join(dir, 'canvases')
|
||||
const ents = await fs().readDir(cd)
|
||||
for (const e of ents) {
|
||||
if (!e || e.isDirectory || !/\.json$/i.test(e.name) || e.name === 'active.json') continue
|
||||
let txt = ''
|
||||
try { txt = await fs().readTextFile(await join(cd, e.name)) } catch (err) { continue }
|
||||
for (const hit of (txt.match(/"__blob"\s*:\s*"([^"]+)"/g) || [])) { const km = /"([^"]+)"$/.exec(hit); if (km) canvasKeys.add(km[1]) }
|
||||
}
|
||||
} catch (e) { /* 画布读不到:按「不引用」处理,仍移到 trash 而非直删 */ }
|
||||
const keepFiles = new Set()
|
||||
for (const k of canvasKeys) { const a = assets[k]; if (a && a.f) keepFiles.add(a.f) }
|
||||
const trashAbs = await join(dir, 'trash')
|
||||
let moved = 0
|
||||
for (const key of list) {
|
||||
const k = String(key)
|
||||
const a = assets[k]
|
||||
if (a && a.f) {
|
||||
delete assets[k]
|
||||
if (!keepFiles.has(a.f)) {
|
||||
try {
|
||||
const sub = String(a.f).split('/')[1] || ''
|
||||
const targetDir = sub ? await join(trashAbs, sub) : trashAbs
|
||||
await fs().mkdir(targetDir, { recursive: true })
|
||||
await fs().rename(await join(dir, a.f), await join(targetDir, a.f.split('/').pop()))
|
||||
moved++
|
||||
} catch (e) { /* 单条失败忽略 */ }
|
||||
}
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(small, k)) delete small[k]
|
||||
}
|
||||
schedule()
|
||||
return { ok: true, moved: moved }
|
||||
} catch (e) { return { ok: false, error: String((e && e.message) || e) } }
|
||||
}
|
||||
|
||||
// 2026-11-24:按图库条目名删字节 —— app.js 只传 names + 索引,逻辑留在这里(app.js 行数棘轮)。
|
||||
async function deleteGalleryBytesFor (names, index) {
|
||||
const wanted = Array.isArray(names) ? names : []
|
||||
if (!wanted.length) return { ok: true, moved: 0 }
|
||||
const keys = []
|
||||
for (const it of (Array.isArray(index) ? index : [])) {
|
||||
if (!it || wanted.indexOf(it.name) < 0) continue
|
||||
if (it.idb) keys.push(it.idb)
|
||||
if (it.origIdb) keys.push(it.origIdb)
|
||||
}
|
||||
return deleteImageBytes(keys)
|
||||
}
|
||||
|
||||
global.IWBStorageFile = {
|
||||
enabled, ready: init, flush, runtime, pickDir, switchTo, migrateTo, gcImages, rotateTrash, galleryThumb, readDisplayThumb, readDisplayThumbUrl, writeDisplayThumb, writeDisplayThumbBlob, pruneThumbs, cleanupLegacy, maintain,
|
||||
enabled, ready: init, flush, runtime, pickDir, switchTo, migrateTo, deleteImageBytes, deleteGalleryBytesFor, gcImages, rotateTrash, galleryThumb, readDisplayThumb, readDisplayThumbUrl, writeDisplayThumb, writeDisplayThumbBlob, pruneThumbs, cleanupLegacy, maintain,
|
||||
plugins: { manifest: pluginManifest, read: pluginRead, write: pluginWrite, remove: pluginRemove, dir: pluginDir, listLocal: pluginListLocal, listDirs: pluginListDirs, readFile: pluginReadFile, writeFile: pluginWriteFile, writeBinary: pluginWriteBinary, mkdir: pluginMkdir, removeDir: pluginRemoveDir, renameDir: pluginRenameDir, existsDir: pluginExistsDir },
|
||||
pluginData: { read: pluginDataRead, write: pluginDataWrite, remove: pluginDataRemove, list: pluginDataList },
|
||||
pluginFiles: { put: pluginFilePut, get: pluginFileGet, list: pluginFileList, remove: pluginFileRemove, stat: pluginFileStat, dir: pluginFilesDir },
|
||||
pluginFiles: { put: pluginFilePut, get: pluginFileGet, list: pluginFileList, remove: pluginFileRemove, stat: pluginFileStat, dir: pluginFilesDir, readBytes: pluginFileReadBytes, listAll: pluginFilesListAll },
|
||||
storage: () => storage,
|
||||
kv: () => kv,
|
||||
dir: () => dir,
|
||||
|
||||
@@ -183,8 +183,18 @@
|
||||
// 品牌色上的文字:按对比度自动选黑/白
|
||||
const onBrand = contrast('#ffffff', brand) >= RATIO.onBrand ? '#ffffff' : '#1c2333'
|
||||
|
||||
// 状态层(2026-11-24,§3.1.2):背景/描边各一套,取代散落在样式里的 16 处 color-mix。
|
||||
// 亮色下「浅底 + 深字」,暗色下「深底 + 亮字」;描边取原状态色的 55% 混底,保证不刺眼又能分辨。
|
||||
const errBg = mix(err, surface0, d ? 0.82 : 0.90)
|
||||
const errBd = mix(err, surface0, d ? 0.55 : 0.62)
|
||||
const okBg = mix(ok, surface0, d ? 0.82 : 0.90)
|
||||
const okBd = mix(ok, surface0, d ? 0.55 : 0.62)
|
||||
const warnBg = mix(warn, surface0, d ? 0.82 : 0.90)
|
||||
const warnBd = mix(warn, surface0, d ? 0.55 : 0.62)
|
||||
|
||||
return {
|
||||
err, ok, warn, onBrand,
|
||||
errBg, errBd, okBg, okBd, warnBg, warnBd,
|
||||
bg: surface0,
|
||||
panel: surface1,
|
||||
layer: inset,
|
||||
|
||||
+82
-28
@@ -12,14 +12,6 @@
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
|
||||
function askConfirm (text, opts) {
|
||||
const D = (typeof window !== 'undefined') ? window.IWBDesktop : null
|
||||
const native = !!(D && D.isTauri && D.isTauri())
|
||||
const C = (typeof window !== 'undefined') ? window.IWBUIConfirm : null
|
||||
if (native && C && typeof C.ask === 'function') return C.ask(Object.assign({ text: text }, opts || {}))
|
||||
return Promise.resolve(window.confirm(text))
|
||||
}
|
||||
|
||||
// 存储入口收敛(2026-11-06):统一走 IWBStorageLocal 门面,配额/异常集中处理
|
||||
const _lstore = () => (typeof window !== 'undefined' && window.IWBStorageLocal && typeof window.IWBStorageLocal.getStore === 'function') ? window.IWBStorageLocal.getStore() : null
|
||||
const React = global.React || {}
|
||||
@@ -147,6 +139,18 @@ function BackupModal(props) {
|
||||
for (const f of (Array.isArray(outputItems) ? outputItems : [])) sum += Number(f && f.size) || 0
|
||||
return sum
|
||||
}
|
||||
// ---- 插件文件(plugin-data/<id>/files/,v3.26.59)----
|
||||
// 只收清单,写包时逐条读字节(与图片同一套内存纪律:写一张放一张,不攒数组)。
|
||||
const pdata = () => ((typeof window !== 'undefined') ? window.IWBPluginData : null)
|
||||
const collectPluginFiles = async () => {
|
||||
try { const pd = pdata(); if (pd && typeof pd.listFiles === 'function') return await pd.listFiles() } catch (e) { /* 清单失败不影响主备份 */ }
|
||||
return []
|
||||
}
|
||||
const readPluginFileBytes = async (f) => {
|
||||
try { const pd = pdata(); const b = (pd && typeof pd.readFile === 'function') ? await pd.readFile(f.id, f.name) : null; return (b && b.length) ? b : null } catch (e) { return null }
|
||||
}
|
||||
const mimeOfPluginFile = (name) => /\.png$/i.test(name) ? 'image/png' : (/\.webp$/i.test(name) ? 'image/webp' : 'image/jpeg')
|
||||
const bytesToBase64 = (u8) => { let s = ''; for (let i = 0; i < u8.length; i += 0x8000) s += String.fromCharCode.apply(null, u8.subarray(i, i + 0x8000)); return btoa(s) }
|
||||
const doBackup = async () => {
|
||||
setBkBusy(true); setBkMsg(null)
|
||||
try {
|
||||
@@ -177,25 +181,30 @@ function BackupModal(props) {
|
||||
const refMeta = await collectBackupImages()
|
||||
const galleryMeta = (bk.outputs && items.outputs) ? (await collectBackupOutputImages(items.outputs)) : []
|
||||
const imgMeta = refMeta.concat(galleryMeta.map((im) => ({ key: im.key, name: im.name })))
|
||||
// 插件文件(如提示词封面):跟 items.pluginData 同进退,不单独设勾选项
|
||||
const pluginFileMeta = await collectPluginFiles()
|
||||
const pluginFileBytes = pluginFileMeta.reduce((n, f) => n + (Number(f && f.size) || 0), 0)
|
||||
// 导出前体积预估 + 二次确认:几百 MB 的图库导出会持续拉高内存,先让用户确认
|
||||
if (imgMeta.length) {
|
||||
const estMB = estimateBackupBytes(items.outputs) / 1048576
|
||||
const needConfirm = estMB >= 20 || imgMeta.length >= 20
|
||||
if (imgMeta.length || pluginFileMeta.length) {
|
||||
const estMB = (estimateBackupBytes(items.outputs) + pluginFileBytes) / 1048576
|
||||
const needConfirm = estMB >= 20 || (imgMeta.length + pluginFileMeta.length) >= 20
|
||||
const sizeText = estMB >= 1 ? ('约 ' + estMB.toFixed(0) + ' MB') : '未记录(按张数估算偏大)'
|
||||
if (needConfirm && typeof window !== 'undefined' && typeof window.confirm === 'function') {
|
||||
const okGo = await askConfirm('本次备份包含 ' + imgMeta.length + ' 张图片,预计体积 ' + sizeText + '。\n导出期间内存占用会明显上升,图库很大时页面会变慢。\n确定继续导出吗?', { title: '导出备份', okText: '继续导出' })
|
||||
const countText = imgMeta.length + ' 张图片' + (pluginFileMeta.length ? '(另含 ' + pluginFileMeta.length + ' 个插件文件)' : '')
|
||||
if (needConfirm && typeof window !== 'undefined' && window.IWBUIConfirm) {
|
||||
const okGo = await window.IWBUIConfirm.askOrNative('本次备份包含 ' + countText + ',预计体积 ' + sizeText + '。\n导出期间内存占用会明显上升,图库很大时页面会变慢。\n确定继续导出吗?', { title: '导出备份', okText: '继续导出' })
|
||||
if (!okGo) {
|
||||
setBkMsg({ type: 'err', text: '已取消导出(' + imgMeta.length + ' 张图片 / ' + sizeText + ')' })
|
||||
setBkMsg({ type: 'err', text: '已取消导出(' + countText + ' / ' + sizeText + ')' })
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
const core = { app: 'image-workbench', kind: 'backup', backupVersion: 3, schemaVersion: SchemaVersions.backup, at: Date.now(), items, images: imgMeta }
|
||||
const core = { app: 'image-workbench', kind: 'backup', backupVersion: 3, schemaVersion: SchemaVersions.backup, at: Date.now(), items, images: imgMeta, pluginFiles: pluginFileMeta }
|
||||
const exported = ModularBackupStore ? await ModularBackupStore.export(items, { extra: { images: imgMeta, at: core.at } }) : null
|
||||
const checksum = await wSha256(JSON.stringify(backupChecksumPayload(core)))
|
||||
const manifest = exported && exported.ok ? Object.assign({}, exported.value, { images: imgMeta }) : Object.assign({}, core, { checksum })
|
||||
const manifest = exported && exported.ok ? Object.assign({}, exported.value, { images: imgMeta, pluginFiles: pluginFileMeta }) : Object.assign({}, core, { checksum })
|
||||
const ts = new Date().toISOString().slice(0, 10)
|
||||
let exportedImages = 0
|
||||
let exportedPluginFiles = 0
|
||||
// 主路径:原生 ZIP 写入器(STORE)——逐张读 → 立即以 Blob 写包 → 立即释放,堆里同时只有一张图
|
||||
let zipBlob = null
|
||||
try {
|
||||
@@ -208,11 +217,19 @@ function BackupModal(props) {
|
||||
exportedImages++
|
||||
await new Promise((r) => setTimeout(r, 0)) // 让出事件循环,给 GC 回收上一张的 base64 字符串
|
||||
}
|
||||
// 插件文件:plugin-files/<插件id>/<文件名>,写原始字节(不做 base64 往返)
|
||||
for (const pf of pluginFileMeta) {
|
||||
const bytes = await readPluginFileBytes(pf)
|
||||
if (!bytes) continue
|
||||
await zw.add('plugin-files/' + pf.id + '/' + pf.name, new Blob([bytes]))
|
||||
exportedPluginFiles++
|
||||
await new Promise((r) => setTimeout(r, 0))
|
||||
}
|
||||
zipBlob = zw.finish()
|
||||
} catch (e) { zipBlob = null; exportedImages = 0 }
|
||||
} catch (e) { zipBlob = null; exportedImages = 0; exportedPluginFiles = 0 }
|
||||
if (zipBlob) {
|
||||
wDownloadBlob(zipBlob, 'image-workbench-backup-' + ts + '.zip')
|
||||
setBkMsg({ type: 'ok', text: '✓ 已导出 ZIP 备份(' + Object.keys(items).join(' / ') + ' + ' + exportedImages + ' 张图片),含校验和,恢复时可校验' })
|
||||
setBkMsg({ type: 'ok', text: '✓ 已导出 ZIP 备份(' + Object.keys(items).join(' / ') + ' + ' + exportedImages + ' 张图片' + (exportedPluginFiles ? ' + ' + exportedPluginFiles + ' 个插件文件' : '') + '),含校验和,恢复时可校验' })
|
||||
} else {
|
||||
// 兜底:原生写入器失败 → JSON 内嵌图片 base64。整包字符串无法避免,仅作兜底。
|
||||
// (原来这里还有一条「CDN 加载 JSZip 写 ZIP」的兜底:线上 CSP script-src 'self' 会直接拦死该 script,
|
||||
@@ -228,13 +245,22 @@ function BackupModal(props) {
|
||||
if (data) imagesData.push({ key: im.key, name: im.name, data })
|
||||
}
|
||||
exportedImages = imagesData.length
|
||||
const m2 = Object.assign({}, manifest, { imagesData })
|
||||
const pluginFilesData = []
|
||||
for (const pf of pluginFileMeta) {
|
||||
const bytes = await readPluginFileBytes(pf)
|
||||
if (!bytes) continue
|
||||
pluginFilesData.push({ id: pf.id, name: pf.name, data: 'data:' + mimeOfPluginFile(pf.name) + ';base64,' + bytesToBase64(bytes) })
|
||||
}
|
||||
exportedPluginFiles = pluginFilesData.length
|
||||
const m2 = Object.assign({}, manifest, { imagesData, pluginFilesData })
|
||||
delete m2.images
|
||||
// 插件文件/图片的键都进 payload 的排除项(见 backupChecksumPayload),这里重算才能自洽
|
||||
m2.checksum = await wSha256(JSON.stringify(backupChecksumPayload(m2)))
|
||||
const blob = new Blob([JSON.stringify(m2)], { type: 'application/json' })
|
||||
wDownloadBlob(blob, 'image-workbench-backup-' + ts + '.json')
|
||||
setBkMsg({ type: 'ok', text: '✓ 已导出备份(JSON 内嵌 ' + exportedImages + ' 张图片;联网时导出 ZIP 更小更稳)' })
|
||||
setBkMsg({ type: 'ok', text: '✓ 已导出备份(JSON 内嵌 ' + exportedImages + ' 张图片' + (exportedPluginFiles ? ' + ' + exportedPluginFiles + ' 个插件文件' : '') + ';可联网时导出 ZIP 更小更稳)' })
|
||||
}
|
||||
wLog('backup', '导出备份:' + Object.keys(items).join('/') + ' + 图片 ' + exportedImages)
|
||||
wLog('backup', '导出备份:' + Object.keys(items).join('/') + ' + 图片 ' + exportedImages + ' + 插件文件 ' + exportedPluginFiles)
|
||||
// 记录"上次导出"时间(2026-11-07):自动备份与数据同在浏览器里,导出磁盘才是异地保险
|
||||
try { const stx = _lstore(); if (stx) stx.rawSet('iwb_backup_last_export_at', String(Date.now())) } catch (e) { /* ignore */ }
|
||||
|
||||
@@ -264,7 +290,7 @@ function BackupModal(props) {
|
||||
}
|
||||
return { providers: ps.length, models, plainKeys, keepKeys, llmProviders: llmPs.length }
|
||||
}
|
||||
const acceptRestoreData = async (data, images) => {
|
||||
const acceptRestoreData = async (data, images, pluginFiles) => {
|
||||
if (!data || data.kind !== 'backup' || !data.items || typeof data.items !== 'object' || Array.isArray(data.items)) throw new Error('不是本工具的备份文件')
|
||||
if (data.checksum) {
|
||||
const h = await wSha256(JSON.stringify(backupChecksumPayload(data)))
|
||||
@@ -283,6 +309,11 @@ function BackupModal(props) {
|
||||
})
|
||||
nd.images = zipImages
|
||||
if (!nd.images.length && Array.isArray(nd.imagesData)) nd.images = nd.imagesData.map((x) => ({ key: x.key, name: x.name, data: x.data }))
|
||||
// 插件文件:ZIP 里直接拿到 dataURL;JSON 兜底看 pluginFilesData
|
||||
const pfs = Array.isArray(pluginFiles) && pluginFiles.length
|
||||
? pluginFiles
|
||||
: (Array.isArray(nd.pluginFilesData) ? nd.pluginFilesData.map((x) => ({ id: x.id, name: x.name, data: x.data })) : [])
|
||||
nd.pluginFiles = pfs.filter((x) => x && x.id && x.name && x.data)
|
||||
setRestoreData(nd)
|
||||
// 摘要:让"备份里有没有设置/密钥"一眼可见
|
||||
const cs = cfgSummary(nd.items.config)
|
||||
@@ -291,6 +322,7 @@ function BackupModal(props) {
|
||||
prompts: (nd.items.prompts && (nd.items.prompts.prompts || []).length) || 0,
|
||||
workspaces: (nd.items.workspaces && (nd.items.workspaces.workspaces || []).length) || 0,
|
||||
groups: (nd.items.nodeGroups && (nd.items.nodeGroups.groups || []).length) || 0,
|
||||
pluginFiles: nd.pluginFiles.length,
|
||||
})
|
||||
setRestoreSel({ config: !!nd.items.config, prompts: !!nd.items.prompts, nodeGroups: !!nd.items.nodeGroups, workspaces: !!nd.items.workspaces, outputs: !!nd.items.outputs })
|
||||
setRstMsg(data.__checksumMismatch ? { type: 'err', text: '⚠︎ 校验和与文件内容不一致(可能是旧版备份格式),文件仍已解析;请确认备份完整后再恢复' } : null)
|
||||
@@ -306,13 +338,23 @@ function BackupModal(props) {
|
||||
if (!jf) throw new Error('ZIP 中缺少 iwb-backup.json(不是本工具的备份)')
|
||||
const data = JSON.parse(await jf.async('string'))
|
||||
const images = []
|
||||
const pluginFiles = []
|
||||
for (const p of Object.keys(z.files)) {
|
||||
if (p.indexOf('images/') === 0) {
|
||||
const b64 = await z.files[p].async('base64')
|
||||
images.push({ key: null, name: p.slice(7), data: 'data:image/png;base64,' + b64 })
|
||||
} else if (p.indexOf('plugin-files/') === 0) {
|
||||
const rest = p.slice('plugin-files/'.length)
|
||||
const cut = rest.indexOf('/')
|
||||
if (cut <= 0) continue
|
||||
const pid = rest.slice(0, cut)
|
||||
const name = rest.slice(cut + 1)
|
||||
if (!name || name.indexOf('/') >= 0) continue
|
||||
const b64 = await z.files[p].async('base64')
|
||||
pluginFiles.push({ id: pid, name: name, data: 'data:' + mimeOfPluginFile(name) + ';base64,' + b64 })
|
||||
}
|
||||
}
|
||||
await acceptRestoreData(data, images)
|
||||
await acceptRestoreData(data, images, pluginFiles)
|
||||
} catch (e) {
|
||||
setRstMsg({ type: 'err', text: 'ZIP 备份解析失败:' + String((e && e.message) || e) })
|
||||
}
|
||||
@@ -335,7 +377,7 @@ function BackupModal(props) {
|
||||
const items = restoreData.items
|
||||
const want = Object.keys(restoreSel).filter((k) => restoreSel[k])
|
||||
if (!want.length) { setRstMsg({ type: 'err', text: '请至少勾选一项要恢复的数据' }); return }
|
||||
if (!(await askConfirm((restoreMerge ? '将以「合并」方式导入(追加去重,不覆盖已有):' : '将用备份覆盖当前数据:') + want.map((k) => ({ config: '设置', prompts: '提示词库', nodeGroups: '节点组', workspaces: '画布工作台', outputs: '图库(含缩略图+原图)' })[k]).join('、') + '。确定恢复?', { title: '恢复备份', okText: '开始恢复' }))) return
|
||||
if (!(await window.IWBUIConfirm.askOrNative((restoreMerge ? '将以「合并」方式导入(追加去重,不覆盖已有):' : '将用备份覆盖当前数据:') + want.map((k) => ({ config: '设置', prompts: '提示词库', nodeGroups: '节点组', workspaces: '画布工作台', outputs: '图库(含缩略图+原图)' })[k]).join('、') + '。确定恢复?', { title: '恢复备份', okText: '开始恢复' }))) return
|
||||
setRstBusy(true); setRstMsg(null)
|
||||
try {
|
||||
props.onSaveNow && props.onSaveNow() // 导入前保存当前画布(避免导入后丢失未保存改动)
|
||||
@@ -374,6 +416,15 @@ function BackupModal(props) {
|
||||
if (items.pluginData && items.pluginData.length) {
|
||||
try { const pd = (typeof window !== 'undefined') ? window.IWBPluginData : null; if (pd && pd.restoreAll) await pd.restoreAll(items.pluginData) } catch (e) { /* 插件数据还原失败不阻塞其它项 */ }
|
||||
}
|
||||
// 插件文件(提示词封面等):与 pluginData 同进退 —— 只恢复 JSON 却丢图,等于「提示词都在、封面全丢」
|
||||
let pluginFileOk = 0
|
||||
const pluginFileList = Array.isArray(restoreData.pluginFiles) ? restoreData.pluginFiles : []
|
||||
if (pluginFileList.length) {
|
||||
try {
|
||||
const pd = (typeof window !== 'undefined') ? window.IWBPluginData : null
|
||||
if (pd && pd.restoreFiles) pluginFileOk = await pd.restoreFiles(pluginFileList)
|
||||
} catch (e) { /* 插件文件还原失败不阻塞其它项 */ }
|
||||
}
|
||||
if (restoreSel.outputs && items.outputs) {
|
||||
if (restoreMerge) {
|
||||
const cur = await api('outputs').catch(() => ({ files: [] }))
|
||||
@@ -413,7 +464,7 @@ function BackupModal(props) {
|
||||
if (await IDB.put(im.key, val)) imgOk++; else imgBad.push(im.key)
|
||||
} catch (e) { imgBad.push(im.key) }
|
||||
}
|
||||
wLog('restore', '恢复(' + (restoreMerge ? '合并' : '覆盖') + '):' + want.join('/') + ' + 图片 ' + imgOk + (imgBad.length ? ',失败 ' + imgBad.length : ''))
|
||||
wLog('restore', '恢复(' + (restoreMerge ? '合并' : '覆盖') + '):' + want.join('/') + ' + 图片 ' + imgOk + (imgBad.length ? ',失败 ' + imgBad.length : '') + ' + 插件文件 ' + pluginFileOk)
|
||||
// __KEEP__ 边界(v3.0.5):备份里标记"保留本机原值"的密钥字段,本机没有对应值 ⇒ **可见提示**,
|
||||
// 绝不静默留空。用阻塞式确认 + 状态行双重提示,并写进诊断日志;确认后才刷新页面。
|
||||
const keepMiss = cfgMissingKeep || []
|
||||
@@ -423,11 +474,11 @@ function BackupModal(props) {
|
||||
for (const m of keepMiss) { const t = (m && (m.label || m.path)) || '密钥'; if (uniqLabel.indexOf(t) === -1) uniqLabel.push(t) }
|
||||
keepWarn = '⚠︎ 有 ' + keepMiss.length + ' 个密钥字段在备份里是「保留本机原值」(__KEEP__),但本机没有对应值,已保持为空:' + uniqLabel.slice(0, 3).join('、') + (uniqLabel.length > 3 ? ' 等 ' + uniqLabel.length + ' 类' : '') + '。请到「服务与 Key 设置」里补填。'
|
||||
wLog('restore', 'KEEP-MISS:' + keepMiss.map((m) => m && m.path).join(', '))
|
||||
try { await askConfirm(keepWarn + '\n\n点「确定」继续(恢复已完成,随后刷新页面生效)。', { title: '恢复提示', okText: '知道了', cancelText: '关闭' }) } catch (e) { /* ignore */ }
|
||||
try { await window.IWBUIConfirm.askOrNative(keepWarn + '\n\n点「确定」继续(恢复已完成,随后刷新页面生效)。', { title: '恢复提示', okText: '知道了', cancelText: '关闭' }) } catch (e) { /* ignore */ }
|
||||
}
|
||||
setRstMsg({
|
||||
type: (imgBad.length || keepWarn) ? 'err' : 'ok',
|
||||
text: (imgBad.length ? '⚠︎ ' : '✓ ') + '已恢复所选数据' + (imgOk ? '(含 ' + imgOk + ' 张图片' + (imgBad.length ? ',' + imgBad.length + ' 张写入失败:' + imgBad.slice(0, 3).join(', ') + '…' : '') + ')' : '') + (imgBad.length ? ';图片可能显示为“已丢失”,可重新导入' : '') + (keepWarn ? ' ' + keepWarn : '') + restoreVerify + ',即将刷新页面',
|
||||
text: (imgBad.length ? '⚠︎ ' : '✓ ') + '已恢复所选数据' + (imgOk || pluginFileOk ? '(含 ' + imgOk + ' 张图片' + (pluginFileOk ? ' + ' + pluginFileOk + ' 个插件文件' : '') + (imgBad.length ? ',' + imgBad.length + ' 张写入失败:' + imgBad.slice(0, 3).join(', ') + '…' : '') + ')' : '') + (imgBad.length ? ';图片可能显示为“已丢失”,可重新导入' : '') + (keepWarn ? ' ' + keepWarn : '') + restoreVerify + ',即将刷新页面',
|
||||
})
|
||||
setTimeout(() => { try { location.reload() } catch (e) { /* ignore */ } }, keepWarn ? 3000 : 900)
|
||||
} catch (e) {
|
||||
@@ -507,6 +558,9 @@ function BackupModal(props) {
|
||||
restoreMerge && restoreSel && restoreSel.config ? el('div', { className: 'iwb-status-err' },
|
||||
'⚠ 已勾选「合并导入」:合并模式**不会覆盖设置**(含密钥)。要恢复设置请取消合并') : null,
|
||||
restoreData.images && restoreData.images.length ? el('div', { className: 'iwb-backup-item-count' }, '含 ' + restoreData.images.length + ' 张图片') : null,
|
||||
// v3.26.59:插件文件(提示词封面等)单独列出 —— 否则用户以为"提示词库已回来",
|
||||
// 打开却是灰块(JSON 有、图片字节没有)。
|
||||
restoreData.pluginFiles && restoreData.pluginFiles.length ? el('div', { className: 'iwb-backup-item-count' }, '含 ' + restoreData.pluginFiles.length + ' 个插件文件(封面等)') : null,
|
||||
el('label', { className: 'iwb-backup-item', title: '追加去重,不覆盖已有数据(设置项不导入)' },
|
||||
el('input', { type: 'checkbox', checked: restoreMerge, onChange: (e) => setRestoreMerge(e.target.checked) }, null),
|
||||
el('span', { className: 'iwb-backup-item-name' }, '合并导入(追加去重)'),
|
||||
@@ -520,7 +574,7 @@ function BackupModal(props) {
|
||||
rstMsg ? el('div', { className: 'iwb-status-' + (rstMsg.type === 'err' ? 'err' : 'ok') }, rstMsg.text) : null,
|
||||
),
|
||||
el('div', { className: 'iwb-backup-note' },
|
||||
'提示:若需连同出图一起备份,请勾选「图库(含缩略图+原图)」(默认不勾选,避免备份体积随出图历史膨胀);画布工作台备份仍只带参考图,生成结果不入画布数据。备份为 ZIP/JSON 文件,请自行妥善保管。',
|
||||
'提示:若需连同出图一起备份,请勾选「图库(含缩略图+原图)」(默认不勾选,避免备份体积随出图历史膨胀);画布工作台备份仍只带参考图,生成结果不入画布数据。插件数据与插件文件(如提示词封面)随备份自动包含。备份为 ZIP/JSON 文件,请自行妥善保管。',
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
const item = props.item || {}
|
||||
const doCopyRef = () => { props.onCopyRef && props.onCopyRef(item.url) }
|
||||
const doCopyLink = () => {
|
||||
try { if (global.navigator && global.navigator.clipboard) global.navigator.clipboard.writeText(item.url) } catch (e) { /* ignore */ }
|
||||
// 统一走 IWBClipboardCopy(2026-11-24)
|
||||
try { if (global.IWBClipboardCopy) global.IWBClipboardCopy.copyText(item.url) } catch (e) { /* ignore */ }
|
||||
}
|
||||
return el('div', {
|
||||
className: 'iwb-rimg',
|
||||
|
||||
@@ -26,9 +26,10 @@
|
||||
const p = props || {}
|
||||
const stop = (e) => e.stopPropagation()
|
||||
const panelRef = useRef(null)
|
||||
const [pos, setPos] = useState({ x: 40, y: 40 })
|
||||
const [pos, setPos] = useState(null) // null = 未定位:先隐藏,避免首帧在左上角闪一下
|
||||
const useLayoutEffect = React.useLayoutEffect || useEffect
|
||||
|
||||
useEffect(() => {
|
||||
useLayoutEffect(() => { // 绘制前定位
|
||||
if (!p.anchor) return undefined
|
||||
const place = () => {
|
||||
if (typeof p.placePanel !== 'function') return
|
||||
@@ -117,7 +118,7 @@
|
||||
// 缺了它面板会落在文档流里(位置 0,0 且被应用层盖住、点不动)。
|
||||
const body = el('div', {
|
||||
className: 'iwb-pop-anchor',
|
||||
style: { left: pos.x + 'px', top: pos.y + 'px' },
|
||||
style: { left: (pos ? pos.x : 0) + 'px', top: (pos ? pos.y : 0) + 'px', visibility: pos ? 'visible' : 'hidden' },
|
||||
onPointerDown: stop,
|
||||
onWheel: (e) => e.stopPropagation(),
|
||||
},
|
||||
|
||||
+3
-10
@@ -1,10 +1,4 @@
|
||||
|
||||
// 确认统一走页内确认(桌面端),网页端保持原生 confirm
|
||||
function askConfirm (text, opts) {
|
||||
const C = (typeof window !== 'undefined') ? window.IWBUIConfirm : null
|
||||
if (C && typeof C.askOrNative === 'function') return C.askOrNative(text, opts)
|
||||
return Promise.resolve(window.confirm(String(text)))
|
||||
}
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
|
||||
@@ -273,9 +267,8 @@
|
||||
}
|
||||
const copy = async () => {
|
||||
const v = readMd()
|
||||
try { await navigator.clipboard.writeText(v) } catch (e) {
|
||||
try { const r = editorRef.current; if (r) { const rg = document.createRange(); rg.selectNodeContents(r); const sel = window.getSelection(); sel.removeAllRanges(); sel.addRange(rg); document.execCommand('copy') } } catch (e2) { /* ignore */ }
|
||||
}
|
||||
// 复制统一走 IWBClipboardCopy(2026-11-24):降级链在里面,这里不再自造选区+execCommand 兜底
|
||||
try { await (window.IWBClipboardCopy ? window.IWBClipboardCopy.copyText(v) : Promise.resolve(false)) } catch (e) { /* ignore */ }
|
||||
setCopied(true)
|
||||
setTimeout(() => setCopied(false), 1200)
|
||||
}
|
||||
@@ -1062,7 +1055,7 @@
|
||||
title: (taskQueued ? '已排队,等待提交…' : '已提交,正在等待服务商返回(点击可提前结束,需确认)'),
|
||||
onClick: async () => {
|
||||
if (!props.onCancel) return
|
||||
if (!(await askConfirm('该任务仍在等待服务商返回' + (taskQueued ? '(尚未提交)' : '(已 ' + fmtDur(stallMs) + ' 无新进展)') + '。\n\n确定要提前结束这个任务吗?只会停止本任务的等待,不影响同批其他任务;服务商侧可能已生成,是否重试由你决定。', { title: '提前结束任务', okText: '结束' }))) return
|
||||
if (!(await window.IWBUIConfirm.askOrNative('该任务仍在等待服务商返回' + (taskQueued ? '(尚未提交)' : '(已 ' + fmtDur(stallMs) + ' 无新进展)') + '。\n\n确定要提前结束这个任务吗?只会停止本任务的等待,不影响同批其他任务;服务商侧可能已生成,是否重试由你决定。', { title: '提前结束任务', okText: '结束' }))) return
|
||||
props.onCancel(node.id, t.id)
|
||||
},
|
||||
onPointerDown: stop,
|
||||
|
||||
@@ -9,13 +9,6 @@
|
||||
*
|
||||
* ⚠️ 依赖清单是用 ESLint 的 no-undef 反推出来的(不是人肉枚举),漏项会被 CI 直接抓到。
|
||||
*/
|
||||
// 确认统一走页内确认(桌面端),网页端保持原生 confirm
|
||||
function askConfirm (text, opts) {
|
||||
const C = (typeof window !== 'undefined') ? window.IWBUIConfirm : null
|
||||
if (C && typeof C.askOrNative === 'function') return C.askOrNative(text, opts)
|
||||
return Promise.resolve(window.confirm(String(text)))
|
||||
}
|
||||
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
// 存储入口收敛(2026-11-06):统一走 IWBStorageLocal 门面,配额/异常集中处理
|
||||
@@ -311,7 +304,7 @@ function SettingsModal(props) {
|
||||
if (!cur.some((m) => m && m.name === name)) return
|
||||
const usedBy = (props.nodes || []).filter((n) => n && n.type === 'layer' && n.data && n.data.model === name && !(n.data && n.data.enabled === false)).length
|
||||
const warning = usedBy ? '该模型正在被 ' + usedBy + ' 个分层节点使用。删除后这些节点会显示模型不可用。\n\n确定删除「' + name + '」吗?' : '确定删除分层模型「' + name + '」吗?'
|
||||
if (!(await askConfirm(warning, { title: '删除分层模型', okText: '删除' }))) return
|
||||
if (!(await window.IWBUIConfirm.askOrNative(warning, { title: '删除分层模型', okText: '删除' }))) return
|
||||
setProv(pi, { layerModels: wNormalizeLayerModels(cur.filter((m) => !(m && m.name === name))) })
|
||||
}
|
||||
const delModel = async (pi, name) => {
|
||||
@@ -324,7 +317,7 @@ function SettingsModal(props) {
|
||||
}
|
||||
const usedBy = (props.nodes || []).filter((n) => n && n.type === 'gen' && n.data && n.data.model === name && !(n.data && n.data.enabled === false)).length
|
||||
const warning = usedBy ? '该模型正在被 ' + usedBy + ' 个生图节点使用。删除后这些节点将显示模型不可用,需要重新选择。\n\n确定删除「' + name + '」吗?' : '确定删除模型「' + name + '」吗?'
|
||||
if (!(await askConfirm(warning, { title: '删除模型', okText: '删除' }))) return
|
||||
if (!(await window.IWBUIConfirm.askOrNative(warning, { title: '删除模型', okText: '删除' }))) return
|
||||
const models = (p.models || []).filter((m) => m && m.name !== name)
|
||||
const patch = { models }
|
||||
if (p.defaultModel === name) {
|
||||
@@ -560,7 +553,7 @@ function SettingsModal(props) {
|
||||
try {
|
||||
const before = storageAudit || ((typeof props.onStorageAudit === 'function') ? await props.onStorageAudit() : null)
|
||||
const cnt = before ? ('IDB 图片键 ' + before.total + ' 个;悬空输出索引 ' + before.danglingOutputIndex + ';孤儿输出字节 ' + before.orphanOutputBytes + ' 个') : '(未体检)'
|
||||
if (!(await askConfirm('将执行一次安全孤儿回收:只删除未被任何画板 / 剪贴板 / 收藏组 / 历史 / 图库引用的图片字节(绝不删活引用)。\n\n当前:' + cnt + '\n\n继续?', { title: '孤儿回收', okText: '开始回收' }))) return
|
||||
if (!(await window.IWBUIConfirm.askOrNative('将执行一次安全孤儿回收:只删除未被任何画板 / 剪贴板 / 收藏组 / 历史 / 图库引用的图片字节(绝不删活引用)。\n\n当前:' + cnt + '\n\n继续?', { title: '孤儿回收', okText: '开始回收' }))) return
|
||||
const after = (typeof props.onReclaimOrphans === 'function') ? await props.onReclaimOrphans() : null
|
||||
if (after) setStorageAudit(after)
|
||||
setMsg({ type: 'ok', text: '已回收孤儿图片字节' + (after ? ('(现存 ' + after.total + ' 个图片键)') : '') })
|
||||
|
||||
+49
-52
@@ -100,15 +100,6 @@
|
||||
)
|
||||
}
|
||||
|
||||
// 桌面端用页内确认(window.confirm 会阻塞 WKWebView 主线程 ⇒ 界面像死机)
|
||||
function askConfirm (text, opts) {
|
||||
const D = (typeof window !== 'undefined') ? window.IWBDesktop : null
|
||||
const native = !!(D && D.isTauri && D.isTauri())
|
||||
const C = (typeof window !== 'undefined') ? window.IWBUIConfirm : null
|
||||
if (native && C && typeof C.ask === 'function') return C.ask(Object.assign({ text: text }, opts || {}))
|
||||
return Promise.resolve(window.confirm(text))
|
||||
}
|
||||
|
||||
// 开发者模式开关(走统一存储门面,src 不得直调 localStorage)
|
||||
function pluginDevStore () {
|
||||
const L = (typeof window !== 'undefined') ? window.IWBStorageLocal : null
|
||||
@@ -310,8 +301,8 @@
|
||||
registered: (pluginItems || []).map(function (p) { return { id: p.id, enabled: p.enabled, compatible: p.compatible } }),
|
||||
}
|
||||
const text = JSON.stringify(payload, null, 2)
|
||||
try { await navigator.clipboard.writeText(text) } catch (e) { try { const ta = document.createElement('textarea'); ta.value = text; document.body.appendChild(ta); ta.select(); document.execCommand('copy'); ta.remove() } catch (e2) { /* ignore */ } }
|
||||
setMsg('诊断已复制到剪贴板')
|
||||
const okCopy = await (window.IWBClipboardCopy ? window.IWBClipboardCopy.copyText(text) : Promise.resolve(false))
|
||||
setMsg(okCopy ? '诊断已复制到剪贴板' : '复制失败(权限被拒或非安全上下文);可用「导出 JSON」')
|
||||
} catch (e) { setMsg('诊断生成失败:' + String((e && e.message) || e)) }
|
||||
},
|
||||
}, '复制诊断'),
|
||||
@@ -595,7 +586,7 @@ function GSetGroup (props) {
|
||||
try {
|
||||
const d = await F.pickDir()
|
||||
if (!d || d === dataDir) return
|
||||
if (!(await askConfirm('切换资料目录?\n\n当前数据会先保存到当前目录,然后窗口重载并从新目录装载。\n新目录:' + d, { title: '切换资料目录', okText: '切换' }))) return
|
||||
if (!(await window.IWBUIConfirm.askOrNative('切换资料目录?\n\n当前数据会先保存到当前目录,然后窗口重载并从新目录装载。\n新目录:' + d, { title: '切换资料目录', okText: '切换' }))) return
|
||||
await F.switchTo(d)
|
||||
setDataDir(d); setNote('已切换,正在重载…')
|
||||
} catch (e) { setNote('切换失败:' + String((e && e.message) || e)) }
|
||||
@@ -608,7 +599,7 @@ function GSetGroup (props) {
|
||||
try {
|
||||
const d = await F.pickDir()
|
||||
if (!d || d === dataDir) return
|
||||
if (!(await askConfirm('把整个数据库复制到:\n' + d + '\n\n复制完成后自动切换并重载;原目录会保留,确认无误后可手动删除。\n(图片较多时会花几十秒)', { title: '转移数据库', okText: '开始复制' }))) return
|
||||
if (!(await window.IWBUIConfirm.askOrNative('把整个数据库复制到:\n' + d + '\n\n复制完成后自动切换并重载;原目录会保留,确认无误后可手动删除。\n(图片较多时会花几十秒)', { title: '转移数据库', okText: '开始复制' }))) return
|
||||
setNote('正在复制,请稍候…')
|
||||
await F.migrateTo(d)
|
||||
} catch (e) { setNote('转移失败:' + String((e && e.message) || e)) }
|
||||
@@ -641,7 +632,7 @@ function GSetGroup (props) {
|
||||
if (rDry.keptByCanvas) lines.push('其中 ' + rDry.keptByCanvas + ' 张虽然登记表里没有,但画布仍在引用 → 会自动保留。')
|
||||
if (rDry.dangling) lines.push('另有 ' + rDry.dangling + ' 处画布引用已经找不到图片(之前丢的,本次不影响它们)。')
|
||||
lines.push('移动到 trash/(不直接删除,可在回收站找回)?')
|
||||
if (!(await askConfirm(lines.join('\n'), { title: '清理未引用图片', okText: '移动' }))) return
|
||||
if (!(await window.IWBUIConfirm.askOrNative(lines.join('\n'), { title: '清理未引用图片', okText: '移动' }))) return
|
||||
const rGo = await F.gcImages({ dryRun: false })
|
||||
setNote(rGo.ok
|
||||
? ('已移入 trash/:' + rGo.moved + ' 个文件' + (rGo.dangling ? (';另有 ' + rGo.dangling + ' 处引用已缺图') : ''))
|
||||
@@ -806,36 +797,17 @@ function GSetGroup (props) {
|
||||
|
||||
function renderPluginSettingsPage (ctx) {
|
||||
const { PluginHost, activePlugin, setMsg, setPluginsRev, setTab } = ctx
|
||||
const pluginSettingsPage = activePlugin ? el('div', { className: 'iwb-gset-page' },
|
||||
el('div', { className: 'iwb-mk-setrow' },
|
||||
el('div', { className: 'iwb-mk-setrow-main' },
|
||||
el('div', { className: 'iwb-mk-setrow-title' }, activePlugin.name,
|
||||
el('span', { className: 'iwb-plugin-tag' + (activePlugin.enabled ? '' : ' iwb-plugin-tag-warn'), style: { marginLeft: 8 } }, activePlugin.enabled ? '已启用' : '未启用'),
|
||||
activePlugin.compatible ? null : el('span', { className: 'iwb-plugin-tag iwb-plugin-tag-warn', style: { marginLeft: 4 } }, 'apiVersion 不兼容'),
|
||||
),
|
||||
el('div', { className: 'iwb-hint' }, activePlugin.id + ' · v' + activePlugin.version),
|
||||
),
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: function () {
|
||||
try { if (PluginHost && typeof PluginHost.persist === 'function') PluginHost.persist() } catch (e) { /* ignore */ }
|
||||
if (setMsg) setMsg('已保存插件设置')
|
||||
} }, '保存设置'),
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: function () { setTab('plugins') } }, '返回'),
|
||||
),
|
||||
activePlugin.error ? el('div', { className: 'iwb-status-err' }, activePlugin.error) : null,
|
||||
el('div', { className: 'iwb-section-sub' }, '设置'),
|
||||
Object.keys(activePlugin.settingsSchema || {}).length ? Object.keys(activePlugin.settingsSchema).map(function (key) {
|
||||
const spec = activePlugin.settingsSchema[key] || {}
|
||||
const value = activePlugin.settings && activePlugin.settings[key] !== undefined ? activePlugin.settings[key] : spec.default
|
||||
const commit = function (next) { PluginHost.setSetting(activePlugin.id, key, next); setPluginsRev(function (v) { return v + 1 }) }
|
||||
const isCustom = spec.type === 'custom' && typeof spec.render === 'function'
|
||||
// 说明在上、控件在下(左对齐):右侧 260px 的窄框放地址/多行内容既看不全也
|
||||
// 改不动;boolean 仍是行末开关(这类是「开/关」而不是填写内容)。
|
||||
const stacked = isCustom || spec.type === 'text' || spec.type === 'number'
|
||||
return el('div', { key: key, className: 'iwb-mk-setrow' + (stacked ? ' iwb-mk-setrow-col' : '') },
|
||||
el('div', { className: 'iwb-mk-setrow-main' },
|
||||
el('div', { className: 'iwb-mk-setrow-title' }, spec.label || key),
|
||||
spec.desc ? el('div', { className: 'iwb-hint' }, spec.desc) : null,
|
||||
),
|
||||
if (!activePlugin) return el('div', { className: 'iwb-hint' }, '插件不存在或已卸载。')
|
||||
// 2026-11-24:插件设置页按设置面板 token 重排(GSetGroup + 行网格),不再自造 mk-setrow 卡片。
|
||||
const rows = Object.keys(activePlugin.settingsSchema || {}).map(function (key) {
|
||||
const spec = activePlugin.settingsSchema[key] || {}
|
||||
const value = activePlugin.settings && activePlugin.settings[key] !== undefined ? activePlugin.settings[key] : spec.default
|
||||
const commit = function (next) { PluginHost.setSetting(activePlugin.id, key, next); setPluginsRev(function (v) { return v + 1 }) }
|
||||
const isCustom = spec.type === 'custom' && typeof spec.render === 'function'
|
||||
const stacked = isCustom || spec.type === 'text' || spec.type === 'number'
|
||||
return el('div', { key: key, className: 'iwb-gset-row' + (stacked ? ' iwb-gset-row-stacked' : '') },
|
||||
el('div', { className: 'iwb-gset-row-label' }, spec.label || key),
|
||||
el('div', { className: 'iwb-gset-row-ctl' },
|
||||
spec.type === 'boolean'
|
||||
? el('label', { className: 'iwb-switch' },
|
||||
el('input', { type: 'checkbox', checked: Boolean(value), onChange: function (e) { commit(e.target.checked) } }),
|
||||
@@ -844,15 +816,40 @@ function GSetGroup (props) {
|
||||
: isCustom
|
||||
? el(PluginCustomSetting, { key: 'custom-' + key, spec: spec, value: value, commit: commit, pluginId: activePlugin.id })
|
||||
: el('input', {
|
||||
className: 'iwb-input', type: spec.type === 'number' ? 'number' : 'text',
|
||||
style: { maxWidth: '520px' },
|
||||
className: 'iwb-input iwb-grow', type: spec.type === 'number' ? 'number' : 'text',
|
||||
value: value === undefined ? '' : String(value),
|
||||
onChange: function (e) { commit(spec.type === 'number' ? Number(e.target.value) : e.target.value) },
|
||||
}),
|
||||
)
|
||||
}) : el('div', { className: 'iwb-hint' }, '该插件没有可配置项。'),
|
||||
) : el('div', { className: 'iwb-hint' }, '插件不存在或已卸载。')
|
||||
return pluginSettingsPage
|
||||
),
|
||||
)
|
||||
})
|
||||
return el('div', { className: 'iwb-gset-page' },
|
||||
el('div', { className: 'iwb-gset-group' },
|
||||
el('div', { className: 'iwb-gset-group-h' }, activePlugin.name),
|
||||
el('div', { className: 'iwb-gset-group-body' },
|
||||
el('div', { className: 'iwb-gset-row' },
|
||||
el('div', { className: 'iwb-gset-row-label' }, '插件信息'),
|
||||
el('div', { className: 'iwb-gset-row-ctl' },
|
||||
el('span', { className: 'iwb-plugin-tag' + (activePlugin.enabled ? '' : ' iwb-plugin-tag-warn') }, activePlugin.enabled ? '已启用' : '未启用'),
|
||||
activePlugin.compatible ? null : el('span', { className: 'iwb-plugin-tag iwb-plugin-tag-warn' }, 'apiVersion 不兼容'),
|
||||
el('span', { className: 'iwb-gset-hint' }, activePlugin.id + ' · v' + activePlugin.version),
|
||||
),
|
||||
),
|
||||
activePlugin.error ? el('div', { className: 'iwb-gset-row' }, el('div', { className: 'iwb-gset-row-label' }, '错误'), el('div', { className: 'iwb-gset-row-ctl' }, el('span', { className: 'iwb-status-err' }, activePlugin.error))) : null,
|
||||
rows.length ? rows : el('div', { className: 'iwb-gset-row' }, el('div', { className: 'iwb-gset-row-label' }, '设置'), el('div', { className: 'iwb-gset-row-ctl' }, el('span', { className: 'iwb-gset-hint' }, '该插件没有可配置项。'))),
|
||||
el('div', { className: 'iwb-gset-row' },
|
||||
el('div', { className: 'iwb-gset-row-label' }, '操作'),
|
||||
el('div', { className: 'iwb-gset-row-ctl' },
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm iwb-btn-primary', onClick: function () {
|
||||
try { if (PluginHost && typeof PluginHost.persist === 'function') PluginHost.persist() } catch (e) { /* ignore */ }
|
||||
if (setMsg) setMsg('已保存插件设置')
|
||||
} }, '保存设置'),
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: function () { setTab('plugins') } }, '返回'),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
function renderAutoBackupSection (ctx) {
|
||||
@@ -875,11 +872,11 @@ function GSetGroup (props) {
|
||||
el('button', {
|
||||
className: 'iwb-btn iwb-btn-sm',
|
||||
onClick: async () => {
|
||||
const okGo = await askConfirm('用这份备份覆盖当前本机数据?\n\n覆盖后会' + (isDesk() ? '自动重载窗口' : '立即刷新页面') + '。当前数据不会保留,建议先「导出备份」。', { title: '还原自动备份', okText: '还原' })
|
||||
const okGo = await window.IWBUIConfirm.askOrNative('用这份备份覆盖当前本机数据?\n\n覆盖后会' + (isDesk() ? '自动重载窗口' : '立即刷新页面') + '。当前数据不会保留,建议先「导出备份」。', { title: '还原自动备份', okText: '还原' })
|
||||
if (!okGo) return
|
||||
Promise.resolve(props.autoBackupRestore && props.autoBackupRestore(row.name)).then((r) => {
|
||||
if (r && r.ok) location.reload()
|
||||
else askConfirm('还原失败:' + ((r && r.error) || '未知错误'), { title: '还原失败', okText: '知道了', cancelText: '关闭' })
|
||||
else window.IWBUIConfirm.askOrNative('还原失败:' + ((r && r.error) || '未知错误'), { title: '还原失败', okText: '知道了', cancelText: '关闭' })
|
||||
})
|
||||
},
|
||||
}, '还原此份'),
|
||||
|
||||
@@ -10,13 +10,6 @@
|
||||
* ctx.storageAudit / ctx.storageAuditBusy —— 体检结果与忙碌态
|
||||
* ctx.props —— SettingsModal 的 props(diagStats/diagText/onExportDiag)
|
||||
*/
|
||||
// 确认统一走页内确认(桌面端),网页端保持原生 confirm
|
||||
function askConfirm (text, opts) {
|
||||
const C = (typeof window !== 'undefined') ? window.IWBUIConfirm : null
|
||||
if (C && typeof C.askOrNative === 'function') return C.askOrNative(text, opts)
|
||||
return Promise.resolve(window.confirm(String(text)))
|
||||
}
|
||||
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
const React = global.React || {}
|
||||
@@ -40,13 +33,12 @@
|
||||
try {
|
||||
text = (typeof props.diagText === 'function') ? props.diagText() : JSON.stringify(CrashLog ? CrashLog.report({ version: APP_VERSION }) : {}, null, 2)
|
||||
} catch (e) { setMsg({ type: 'err', text: '生成诊断信息失败:' + String((e && e.message) || e) }); return }
|
||||
if (!(navigator.clipboard && navigator.clipboard.writeText)) { setMsg({ type: 'err', text: '当前环境不支持复制,请用「导出 JSON」' }); return }
|
||||
try {
|
||||
await navigator.clipboard.writeText(text)
|
||||
setMsg({ type: 'ok', text: '诊断信息已复制到剪贴板' })
|
||||
} catch (e) {
|
||||
setMsg({ type: 'err', text: '复制失败:' + String((e && e.message) || e) + ';请改用「导出 JSON」' })
|
||||
}
|
||||
// 复制统一走 IWBClipboardCopy(2026-11-24):内含 navigator → textarea+execCommand 的降级链,
|
||||
// 不再各处自己判断 clipboard 是否可用(那样每处都要复述一份兜底逻辑)。
|
||||
const C = (typeof window !== 'undefined') ? window.IWBClipboardCopy : null
|
||||
if (!C || typeof C.copyText !== 'function') { setMsg({ type: 'err', text: '当前环境不支持复制,请用「导出 JSON」' }); return }
|
||||
const ok = await C.copyText(text)
|
||||
setMsg(ok ? { type: 'ok', text: '诊断信息已复制到剪贴板' } : { type: 'err', text: '复制失败(权限被拒或非安全上下文);请改用「导出 JSON」' })
|
||||
}
|
||||
// ── 孤儿画板找回(v3.87.8)──
|
||||
// 症状:崩溃/异常返回后某块画板"从列表里消失"(其它画板还在)。索引条目可能丢了,
|
||||
@@ -68,7 +60,7 @@
|
||||
} catch (e) { orphanRows = [] }
|
||||
const restoreOrphan = async (row) => {
|
||||
try {
|
||||
if (!(await askConfirm('把「' + row.name + '」(' + row.nodes + ' 个节点)补回画布列表?恢复后会重新加载页面。', { title: '找回画布', okText: '补回' }))) return
|
||||
if (!(await window.IWBUIConfirm.askOrNative('把「' + row.name + '」(' + row.nodes + ' 个节点)补回画布列表?恢复后会重新加载页面。', { title: '找回画布', okText: '补回' }))) return
|
||||
const st = _lstore()
|
||||
const idx = (st ? st.get('iwb_web_workspaces', null) : null) || { workspaces: [], activeId: '', rev: 0 }
|
||||
const board = st ? st.get(row.key, null) : null
|
||||
@@ -90,7 +82,7 @@
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => { setDiagRev((v) => v + 1) } }, '刷新'),
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm', title: '复制完整诊断 JSON(含崩溃记录与内存采样)', onClick: copyDiag }, '复制诊断 JSON'),
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm', title: '导出完整诊断 JSON(下载文件)', onClick: () => { if (typeof props.onExportDiag === 'function') props.onExportDiag(); else setMsg({ type: 'err', text: '当前环境不支持诊断导出' }) } }, '导出 JSON'),
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm iwb-btn-danger', title: '清空本机的崩溃记录、内存采样与操作面包屑', onClick: async () => { if (await askConfirm('清空本机诊断记录?', { title: '清空诊断记录', okText: '清空' })) { if (CrashLog && CrashLog.clear) CrashLog.clear(); reload() } } }, '清空记录'),
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm iwb-btn-danger', title: '清空本机的崩溃记录、内存采样与操作面包屑', onClick: async () => { if (await window.IWBUIConfirm.askOrNative('清空本机诊断记录?', { title: '清空诊断记录', okText: '清空' })) { if (CrashLog && CrashLog.clear) CrashLog.clear(); reload() } } }, '清空记录'),
|
||||
),
|
||||
el('div', { className: 'iwb-row' },
|
||||
el('span', { className: 'iwb-diag-kv' }, '版本 ' + APP_VERSION),
|
||||
|
||||
@@ -79,7 +79,7 @@ button { font-family: inherit; }
|
||||
方案 B:静态态与其它气泡按钮完全一致(灰图标、透明底),只有 hover 才亮红 ——
|
||||
不做红底常驻,避免把删除变成常驻视觉焦点;误删由 Ctrl+Z(deleteNodes 会 pushHistory)兜底。
|
||||
红色复用既有 token --iwb-err(与右键菜单「删除」同语义),不新增变量。 */
|
||||
.iwb-node-floatbar button.iwb-fb-del:hover { color: var(--iwb-err); background: color-mix(in srgb, var(--iwb-err) 12%, transparent); }
|
||||
.iwb-node-floatbar button.iwb-fb-del:hover { color: var(--iwb-err); background: var(--iwb-err-bg); }
|
||||
.iwb-node-headbtns { display: flex; gap: var(--iwb-space-2); }
|
||||
.iwb-node-del { background: none; border: none; color: var(--iwb-text2); cursor: pointer; font-size: var(--iwb-font-sm); padding: 0 var(--iwb-space-2); display: inline-flex; align-items: center; justify-content: center; }
|
||||
.iwb-node-del:hover { color: var(--iwb-brand-text, var(--iwb-brand)); }
|
||||
@@ -141,7 +141,7 @@ button { font-family: inherit; }
|
||||
.iwb-node-selected .iwb-port-linked::before { opacity: 0; }
|
||||
/* 鼠标靠近端点:**再放大一档**,且**已连线的端口也显示**(节点可多连)。
|
||||
选择器带上 .iwb-node-selected 前缀,保证优先级压过上面的选中规则。 */
|
||||
.iwb-port:hover, .iwb-node-selected .iwb-port:hover { width: 24px; height: 24px; transition: width .1s, height .1s; }
|
||||
.iwb-port:hover, .iwb-node-selected .iwb-port:hover { width: 24px; height: 24px; transition: width .12s, height .12s; }
|
||||
.iwb-port:hover::before,
|
||||
.iwb-node-selected .iwb-port:hover::before,
|
||||
.iwb-node-selected .iwb-port-linked:hover::before { opacity: 1; inset: var(--iwb-space-4); }
|
||||
@@ -154,31 +154,31 @@ button { font-family: inherit; }
|
||||
.iwb-ref-empty { height: 84px; display: flex; align-items: center; justify-content: center; color: var(--iwb-text2); border: 1px dashed var(--iwb-border2); border-radius: var(--iwb-radius-chip); font-size: var(--iwb-font-sm); }
|
||||
.iwb-ref-images { display: flex; flex-direction: column; gap: var(--iwb-space-6); }
|
||||
.iwb-ref-imgrow { display: flex; align-items: center; gap: var(--iwb-space-6); }
|
||||
.iwb-ref-idx { flex: 0 0 18px; height: 18px; border-radius: 50%; background: var(--iwb-brand); color: var(--iwb-on-brand); font-size: 10px; display: flex; align-items: center; justify-content: center; }
|
||||
.iwb-ref-idx { flex: 0 0 18px; height: 18px; border-radius: 50%; background: var(--iwb-brand); color: var(--iwb-on-brand); font-size: var(--iwb-font-2xs); display: flex; align-items: center; justify-content: center; }
|
||||
.iwb-ref-img { flex: 1; max-height: 90px; object-fit: contain; border-radius: var(--iwb-radius-chip); border: 1px solid var(--iwb-border); background: var(--iwb-field); cursor: move; min-width: 0; }
|
||||
.iwb-ref-imgactions { flex: 0 0 auto; display: flex; flex-direction: column; gap: var(--iwb-space-2); }
|
||||
.iwb-file { display: inline-block; margin-top: 6px; padding: 4px 10px; border: 1px dashed var(--iwb-border2); border-radius: 6px; font-size: 12px; cursor: pointer; color: var(--iwb-text2); }
|
||||
.iwb-file:hover { border-color: var(--iwb-brand); color: var(--iwb-brand-text, var(--iwb-brand)); }
|
||||
.iwb-hint { font-size: 10px; color: var(--iwb-text2); margin-top: 4px; }
|
||||
.iwb-hint { font-size: var(--iwb-font-2xs); color: var(--iwb-text2); margin-top: var(--iwb-space-4); }
|
||||
.iwb-results { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
|
||||
.iwb-rgroup { width: 100%; }
|
||||
.iwb-rlabel { font-size: 10px; color: var(--iwb-text2); margin: 4px 0 3px; }
|
||||
.iwb-rlabel { font-size: var(--iwb-font-2xs); color: var(--iwb-text2); margin: 4px 0 3px; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-result-thumb { width: 76px; height: 76px; object-fit: cover; border-radius: 6px; border: 1px solid var(--iwb-border); }
|
||||
.iwb-rimg { position: relative; }
|
||||
.iwb-rimg-actions { position: absolute; left: 0; right: 0; bottom: 2px; display: flex; gap: 4px; justify-content: center; }
|
||||
.iwb-rimg-actions .iwb-btn { font-size: 10px; padding: 1px 5px; background: var(--iwb-panel); }
|
||||
.iwb-rimg-actions .iwb-btn { font-size: var(--iwb-font-2xs); padding: 1px 5px; background: var(--iwb-panel); } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-err { font-size: 11px; color: var(--iwb-err); margin-top: 4px; word-break: break-all; }
|
||||
.iwb-out-item { margin-bottom: 8px; }
|
||||
.iwb-out-block { border-top: 1px dashed var(--iwb-border2); padding-top: 6px; margin-top: 6px; }
|
||||
.iwb-out-block:first-child { border-top: none; padding-top: 0; margin-top: 0; }
|
||||
.iwb-out-imgwrap { margin-top: 4px; }
|
||||
.iwb-out-img { width: 100%; border-radius: 8px; border: 1px solid var(--iwb-border); }
|
||||
.iwb-out-meta { font-size: 10px; color: var(--iwb-text2); margin-top: 3px; }
|
||||
.iwb-out-meta { font-size: var(--iwb-font-2xs); color: var(--iwb-text2); margin-top: 3px; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
|
||||
.iwb-toolbar { position: absolute; top: 12px; left: 12px; display: flex; align-items: center; flex-wrap: wrap; background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: var(--iwb-radius-panel); padding: 8px 10px; z-index: 10; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
|
||||
.iwb-toolbar-title { font-weight: 700; font-size: var(--iwb-font-md); margin-right: 2px; }
|
||||
.iwb-toolbar-sep { width: 1px; height: 18px; background: var(--iwb-border2); margin: 0 2px; }
|
||||
.iwb-statusbar { position: absolute; top: 12px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; max-width: calc(100vw - 60px); justify-content: flex-end; background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: var(--iwb-radius-card); padding: 6px 12px; z-index: 10; font-size: var(--iwb-font-xs); color: var(--iwb-text2); box-shadow: 0 4px 16px rgba(0,0,0,0.12); transition: right 0.15s; }
|
||||
.iwb-statusbar { position: absolute; top: 12px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; max-width: calc(100vw - 60px); justify-content: flex-end; background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: var(--iwb-radius-card); padding: 6px 12px; z-index: 10; font-size: var(--iwb-font-xs); color: var(--iwb-text2); box-shadow: 0 4px 16px rgba(0,0,0,0.12); transition: right .15s; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-status-err { color: var(--iwb-err); }
|
||||
.iwb-status-ok { color: var(--iwb-ok); }
|
||||
/* 生成中状态:直接附着在顶部计时/状态背景,确保不依赖画布节点可见性 */
|
||||
@@ -189,7 +189,7 @@ button { font-family: inherit; }
|
||||
.iwb-save-saving { animation: iwb-pulse 1.2s ease-in-out infinite; }
|
||||
@keyframes iwb-spin { to { transform: rotate(360deg); } }
|
||||
@keyframes iwb-pulse { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }
|
||||
.iwb-hint-bottom { position: absolute; 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-hint-bottom { position: absolute; bottom: 10px; transform: translateX(-50%); font-size: var(--iwb-font-2xs); color: var(--iwb-text2); background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: var(--iwb-radius-control); padding: 3px 10px; z-index: 9; opacity: 0.8; white-space: nowrap; } /*iwb:raw-until=3.28.0*/
|
||||
.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; }
|
||||
/* v3.26.18:右栏挤压到工具栏时自动隐藏(避免两者重叠) */
|
||||
.iwb-minimap.iwb-minimap-tight { opacity: 0; transform: translateY(6px); pointer-events: none; }
|
||||
@@ -220,11 +220,11 @@ button { font-family: inherit; }
|
||||
.iwb-lib-searchscope { display: inline-flex; align-items: center; gap: var(--iwb-space-4); flex: 0 0 auto; font-size: var(--iwb-font-xs); color: var(--iwb-text2); background: color-mix(in srgb, var(--iwb-brand) 10%, transparent); border: 1px solid color-mix(in srgb, var(--iwb-brand) 28%, transparent); border-radius: 999px; padding: var(--iwb-space-2) var(--iwb-space-4) var(--iwb-space-2) var(--iwb-space-8); white-space: nowrap; }
|
||||
.iwb-lib-searchscope-back { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; padding: 0; border: none; border-radius: 999px; background: transparent; color: var(--iwb-text2); font-size: var(--iwb-font-md); line-height: 1; cursor: pointer; }
|
||||
.iwb-lib-searchscope-back:hover { background: color-mix(in srgb, var(--iwb-tint) 12%, transparent); color: var(--iwb-text); }
|
||||
.iwb-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; background: var(--iwb-layer); border: 1px solid var(--iwb-border); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--iwb-text2); cursor: pointer; white-space: nowrap; transition: all 0.15s; }
|
||||
.iwb-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: var(--iwb-space-4); background: var(--iwb-layer); border: 1px solid var(--iwb-border); border-radius: var(--iwb-radius-full); padding: 3px 10px; font-size: var(--iwb-font-sm); color: var(--iwb-text2); cursor: pointer; white-space: nowrap; transition: all .15s; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-chip:hover { color: var(--iwb-text); border-color: var(--iwb-border2); }
|
||||
.iwb-chip-active { background: var(--iwb-panel); border-color: var(--iwb-border2); color: var(--iwb-text); font-weight: 600; }
|
||||
.iwb-chip-active:hover { color: var(--iwb-text); }
|
||||
.iwb-chip-count { font-size: 10px; opacity: 0.8; }
|
||||
.iwb-chip-count { font-size: var(--iwb-font-2xs); opacity: 0.8; }
|
||||
.iwb-chip-add { font-weight: 700; }
|
||||
.iwb-gmgr-row { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px dashed var(--iwb-border); }
|
||||
.iwb-gmgr-name { flex: 1 1 auto; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
@@ -274,11 +274,11 @@ button { font-family: inherit; }
|
||||
.iwb-full-left .iwb-full-grid { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; align-content: start; padding-right: 2px; }
|
||||
.iwb-full-collapsed { flex: 0 0 26px; border-left: 1px solid var(--iwb-border); background: var(--iwb-layer); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--iwb-text2); font-size: 12px; writing-mode: vertical-rl; }
|
||||
.iwb-full-collapsed:hover { color: var(--iwb-text); }
|
||||
.iwb-pcard-full { cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
|
||||
.iwb-pcard-full:hover { border-color: var(--iwb-border2); }
|
||||
.iwb-pcard-full { cursor: pointer; transition: border-color var(--iwb-motion-base) var(--iwb-ease-out), box-shadow var(--iwb-motion-base) var(--iwb-ease-out); }
|
||||
.iwb-pcard-full:hover { border-color: var(--iwb-border2); transition-duration: var(--iwb-motion-fast); }
|
||||
.iwb-pcard-selected { border-color: var(--iwb-border2); box-shadow: 0 0 0 1px var(--iwb-border2); }
|
||||
.iwb-pcard-check { accent-color: var(--iwb-text); margin-right: 4px; }
|
||||
.iwb-full-split { flex: 0 0 4px; cursor: col-resize; background: var(--iwb-border); transition: background 0.15s; }
|
||||
.iwb-full-split { flex: 0 0 4px; cursor: col-resize; background: var(--iwb-border); transition: background .15s; }
|
||||
.iwb-full-split:hover { background: var(--iwb-text2); }
|
||||
.iwb-full-edit { flex: 0 0 auto; border-left: 1px solid var(--iwb-border); background: var(--iwb-layer); display: flex; flex-direction: column; min-height: 0; }
|
||||
.iwb-full-edit-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--iwb-border); flex: 0 0 auto; }
|
||||
@@ -289,7 +289,7 @@ button { font-family: inherit; }
|
||||
.iwb-full-editor-empty { color: var(--iwb-text2); font-size: 12px; justify-content: center; align-items: center; height: 100%; text-align: center; }
|
||||
.iwb-btn-starred { color: var(--iwb-text); }
|
||||
/* 提示词卡片按钮:无底色、浅灰图标 */
|
||||
.iwb-pcard .iwb-btn { background: transparent; border: none; padding: 2px 4px; color: var(--iwb-text2); opacity: 0.7; box-shadow: none; }
|
||||
.iwb-pcard .iwb-btn { background: transparent; border: none; padding: 2px 4px; color: var(--iwb-text2); opacity: var(--iwb-opacity-muted); box-shadow: none; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-pcard .iwb-btn:hover { opacity: 1; color: var(--iwb-text); background: transparent; }
|
||||
.iwb-pcard .iwb-btn-starred { color: var(--iwb-text); opacity: 1; }
|
||||
/* 搜索高亮 */
|
||||
@@ -304,7 +304,7 @@ button { font-family: inherit; }
|
||||
.iwb-pname { font-weight: 600; font-size: 12px; }
|
||||
.iwb-pbtns { margin-left: auto; display: flex; gap: 4px; }
|
||||
.iwb-ptext { font-size: 11px; color: var(--iwb-text2); margin-top: 4px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
||||
.iwb-tag { display: inline-block; background: color-mix(in srgb, var(--iwb-tint) 7%, transparent); color: var(--iwb-text2); border-radius: 4px; font-size: 10px; padding: 1px 6px; margin: 3px 4px 0 0; }
|
||||
.iwb-tag { display: inline-block; background: color-mix(in srgb, var(--iwb-tint) 7%, transparent); color: var(--iwb-text2); border-radius: var(--iwb-radius-chip); font-size: var(--iwb-font-2xs); padding: 1px 6px; margin: 3px 4px 0 0; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-pedit { border: 1px solid var(--iwb-border); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
|
||||
.iwb-tasks { margin-top: var(--iwb-space-8); display: flex; flex-direction: column; gap: var(--iwb-space-8); }
|
||||
.iwb-gen-head { display: flex; align-items: center; justify-content: space-between; gap: var(--iwb-space-6); }
|
||||
@@ -326,9 +326,9 @@ button { font-family: inherit; }
|
||||
.iwb-history-grid { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px; flex: 1; }
|
||||
.iwb-history-item { position: relative; flex: 0 0 110px; }
|
||||
.iwb-history-item img { width: 110px; height: 82px; object-fit: contain; border-radius: 6px; border: 1px solid var(--iwb-border); background: var(--iwb-layer2); cursor: pointer; }
|
||||
.iwb-history-actions { position: absolute; left: 0; right: 0; bottom: 2px; display: flex; gap: 4px; justify-content: center; opacity: 0; transition: opacity 0.15s; }
|
||||
.iwb-history-actions { position: absolute; left: 0; right: 0; bottom: 2px; display: flex; gap: var(--iwb-space-4); justify-content: center; opacity: 0; transition: opacity .15s; }
|
||||
.iwb-history-item:hover .iwb-history-actions { opacity: 1; }
|
||||
.iwb-history-actions .iwb-btn { font-size: 10px; padding: 1px 5px; background: var(--iwb-panel); text-decoration: none; }
|
||||
.iwb-history-actions .iwb-btn { font-size: var(--iwb-font-2xs); padding: 1px 5px; background: var(--iwb-panel); text-decoration: none; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-modal-sm { width: 460px; }
|
||||
.iwb-pickrow { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; cursor: pointer; font-size: 12px; }
|
||||
.iwb-picktext { color: var(--iwb-text); line-height: 1.4; word-break: break-all; }
|
||||
@@ -340,9 +340,9 @@ button { font-family: inherit; }
|
||||
.iwb-ref-url-row .iwb-ref-upload-link { background: var(--iwb-field); border-color: var(--iwb-border); color: var(--iwb-text2); }
|
||||
.iwb-ref-upload-link:hover { background: color-mix(in srgb, var(--iwb-brand) 10%, var(--iwb-field)); border-color: var(--iwb-border2); color: var(--iwb-text); }
|
||||
.iwb-ref-url-input { min-width: 0; flex: 1 1 auto; font-size: var(--iwb-font-xs); }
|
||||
.iwb-ref-url-current { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--iwb-text2); font-size: 10px; }
|
||||
.iwb-ref-url-current { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--iwb-text2); font-size: var(--iwb-font-2xs); }
|
||||
.iwb-ref-show { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; }
|
||||
.iwb-ref-miniactions .iwb-btn { font-size: 10px; padding: var(--iwb-space-2) var(--iwb-space-6); text-decoration: none; }
|
||||
.iwb-ref-miniactions .iwb-btn { font-size: var(--iwb-font-2xs); padding: var(--iwb-space-2) var(--iwb-space-6); text-decoration: none; }
|
||||
.iwb-task-ref { width: 28px; height: 28px; }
|
||||
.iwb-refmini { position: relative; }
|
||||
.iwb-refmini-empty { width: 28px; height: 28px; border-radius: var(--iwb-radius-chip); border: 1px solid var(--iwb-border); background: var(--iwb-field); display: flex; align-items: center; justify-content: center; color: #9aa1ad; }
|
||||
@@ -380,7 +380,7 @@ button { font-family: inherit; }
|
||||
.iwb-group:hover { border-color: color-mix(in srgb, var(--iwb-tint) 64%, transparent); background: color-mix(in srgb, var(--iwb-brand) 6%, transparent); }
|
||||
.iwb-group-sel { border-color: color-mix(in srgb, var(--iwb-tint) 78%, transparent); background: color-mix(in srgb, var(--iwb-brand) 7%, transparent); }
|
||||
/* 缩放手柄:默认隐藏,hover 或整组选中时显示(触屏靠"点一下框 = 选中整组"进入选中态) */
|
||||
.iwb-group-handle { position: absolute; width: 9px; height: 9px; background: var(--iwb-panel); border: 2px solid var(--iwb-brand); border-radius: 2px; pointer-events: none; opacity: 0; transition: opacity .12s; z-index: 6; }
|
||||
.iwb-group-handle { position: absolute; width: 9px; height: 9px; background: var(--iwb-panel); border: var(--iwb-bw-strong) solid var(--iwb-brand); border-radius: 2px; pointer-events: none; opacity: 0; transition: opacity .12s; z-index: 6; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-group:hover .iwb-group-handle, .iwb-group-sel .iwb-group-handle { pointer-events: auto; opacity: 1; }
|
||||
.iwb-gh-nw { left: -6px; top: -6px; cursor: nwse-resize; }
|
||||
.iwb-gh-n { left: 50%; top: -6px; margin-left: -4.5px; cursor: ns-resize; }
|
||||
@@ -397,7 +397,7 @@ button { font-family: inherit; }
|
||||
.iwb-group-bar { position: absolute; top: -10px; left: 10px; display: flex; align-items: center; gap: 8px; height: 40px; box-sizing: border-box; background: var(--iwb-panel); color: var(--iwb-text); border: 1px solid var(--iwb-border2); border-radius: 11px; padding: 0 14px; box-shadow: 0 2px 10px rgba(0,0,0,0.12); pointer-events: auto; cursor: move; z-index: 5; }
|
||||
/* 组名:图标 18px + 名称 16px/600 + 节点数 14px 灰(主次分明,原来全塞在一串 12px 加粗里) */
|
||||
.iwb-group-name { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; color: var(--iwb-text); white-space: nowrap; user-select: none; }
|
||||
.iwb-group-name .iwb-ic { width: 18px; height: 18px; flex: 0 0 auto; color: var(--iwb-text2); }
|
||||
.iwb-group-name .iwb-ic { width: var(--iwb-icon-lg); height: var(--iwb-icon-lg); flex: 0 0 auto; color: var(--iwb-text2); }
|
||||
/* 节点数:比组名小两档并偏灰,且与组名之间多留 2px(总 10px)—— 否则 16px 名字 + 14px 数字会读成「分组 1 2 节点」一整串 */
|
||||
.iwb-group-count { font-size: 13px; font-weight: 400; color: var(--iwb-text2); margin-left: 2px; }
|
||||
/* 组名就地编辑框(双击组名进入) */
|
||||
@@ -464,7 +464,7 @@ button { font-family: inherit; }
|
||||
@keyframes iwb-fadein { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }
|
||||
|
||||
/* ---- v3:左侧多工作台 ---- */
|
||||
.iwb-wsrail { position: absolute; left: 0; top: var(--iwb-chrome-h); bottom: 0; width: 52px; background: var(--iwb-panel); border-right: 1px solid var(--iwb-border); z-index: 25; display: flex; flex-direction: column; align-items: stretch; transition: width 0.15s; }
|
||||
.iwb-wsrail { position: absolute; left: 0; top: var(--iwb-chrome-h); bottom: 0; width: 52px; background: var(--iwb-panel); border-right: 1px solid var(--iwb-border); z-index: 25; display: flex; flex-direction: column; align-items: stretch; transition: width .15s; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-wsrail-title { align-items: center; gap: 4px; padding: 14px 12px; font-weight: 800; font-size: 18px; color: var(--iwb-text); border-bottom: 1px solid var(--iwb-border); cursor: default; user-select: none; white-space: nowrap; flex: 0 0 auto; justify-content: center; }
|
||||
.iwb-wsrail-title:hover { background: var(--iwb-hover); }
|
||||
/* 展开态标题行右侧 ⋯ 三点菜单(Portal 挂 body + fixed 定位:右侧展开不切割、层级高于画布) */
|
||||
@@ -477,7 +477,7 @@ button { font-family: inherit; }
|
||||
/* 展开状态下顶部标题字号翻倍(含内部文字 span,覆盖 .iwb-btn-text 固定 12px) */
|
||||
.ws-expanded .iwb-wsrail-title { font-size: 18px; }
|
||||
.ws-expanded .iwb-wsrail-title .iwb-btn-text { font-size: inherit; }
|
||||
.iwb-wsrail-label { font-size: 10px; color: var(--iwb-text2); font-weight: 700; letter-spacing: 1px; margin: 2px 2px 4px; user-select: none; }
|
||||
.iwb-wsrail-label { font-size: var(--iwb-font-2xs); color: var(--iwb-text2); font-weight: 700; letter-spacing: 1px; margin: 2px 2px 4px; user-select: none; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-wsrail-foot { flex: 0 0 auto; border-top: 1px solid var(--iwb-border); padding: 10px; flex-direction: column; gap: 8px; }
|
||||
.iwb-wsrail-footrow { display: flex; gap: 6px; }
|
||||
.iwb-wsrail-footrow .iwb-btn { flex: 1 1 auto; justify-content: center; font-size: 11px; }
|
||||
@@ -497,13 +497,13 @@ button { font-family: inherit; }
|
||||
/* 节点停用(M 键):不参与执行,半透明 + 灰色虚线边 */
|
||||
.iwb-node-disabled { opacity: 0.55; filter: grayscale(0.35); }
|
||||
.iwb-node-disabled .iwb-node-head { background: color-mix(in srgb, var(--iwb-field) 60%, transparent); }
|
||||
.iwb-node-disabled .iwb-port { opacity: 0.45; }
|
||||
.iwb-canvas { transition: left 0.15s; }
|
||||
.iwb-node-disabled .iwb-port { opacity: var(--iwb-opacity-disabled); }
|
||||
.iwb-canvas { transition: left var(--iwb-motion-slow) var(--iwb-ease-in-out); }
|
||||
.iwb-toolbar-wrap { position: absolute; left: 0; right: 60px; bottom: 14px; display: flex; justify-content: center; pointer-events: none; z-index: 10; }
|
||||
.iwb-overlay.has-minimap .iwb-toolbar-wrap { right: 244px; }
|
||||
|
||||
/* ---- v3:工具栏分组 ---- */
|
||||
.iwb-tgroup { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 8px; background: var(--iwb-layer); font-size: 10px; color: var(--iwb-text2); }
|
||||
.iwb-tgroup { display: inline-flex; align-items: center; gap: var(--iwb-space-4); padding: 3px 6px; border-radius: var(--iwb-radius-control); background: var(--iwb-layer); font-size: var(--iwb-font-2xs); color: var(--iwb-text2); } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-tgroup:empty { display: none; }
|
||||
.iwb-task-count { display: inline-flex; align-items: center; }
|
||||
.iwb-toolbar { gap: 6px; }
|
||||
@@ -548,17 +548,17 @@ button { font-family: inherit; }
|
||||
.iwb-history-embedded .iwb-history-item img { width: 100%; height: auto; display: block; border-radius: 6px; border: 1px solid var(--iwb-border); background: var(--iwb-layer2); cursor: pointer; }
|
||||
|
||||
/* ---- SVG 图标 / 底部工具栏 ---- */
|
||||
.iwb-ic { width: 16px; height: 16px; flex: 0 0 auto; }
|
||||
.iwb-ic { width: var(--iwb-icon-md); height: var(--iwb-icon-md); flex: 0 0 auto; }
|
||||
.iwb-btn-primary .iwb-ic { width: 15px; height: 15px; }
|
||||
.iwb-btn-text { font-size: 12px; }
|
||||
.iwb-wsrail-foot .iwb-btn .iwb-ic { width: 14px; height: 14px; }
|
||||
.iwb-wsrail-foot .iwb-btn .iwb-ic { width: var(--iwb-icon-sm); height: var(--iwb-icon-sm); }
|
||||
|
||||
/* ---- 图库管理操作(点选后出现) ---- */
|
||||
.iwb-history-manage-tools { display: inline-flex; align-items: center; gap: 4px; }
|
||||
|
||||
/* 工具栏放大 */
|
||||
.iwb-toolbar-bottom { position: static; padding: 10px 14px; gap: 8px; width: auto; max-width: 100%; pointer-events: auto; background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: var(--iwb-radius-panel); box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
|
||||
.iwb-toolbar-bottom .iwb-btn { padding: 7px 10px; background: transparent !important; border: none !important; color: var(--iwb-text2); opacity: 0.75; transition: opacity 0.12s, color 0.12s; }
|
||||
.iwb-toolbar-bottom .iwb-btn { padding: 7px 10px; background: transparent !important; border: none !important; color: var(--iwb-text2); opacity: 0.75; transition: opacity .12s, color .12s; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-toolbar-bottom .iwb-btn:hover { opacity: 1; color: var(--iwb-text); }
|
||||
.iwb-toolbar-bottom .iwb-btn:active { opacity: 1; color: var(--iwb-text); }
|
||||
.iwb-toolbar-bottom .iwb-btn:disabled { opacity: 0.32; }
|
||||
@@ -566,7 +566,7 @@ button { font-family: inherit; }
|
||||
复核结论比原判断更彻底 —— `.iwb-btn-active` 与 `.iwb-layout-lock-state` 这两个类
|
||||
**从 fork 快照起就没有任何 JS 生产者**(git log -S 可查),是上游遗留的死选择器,
|
||||
所以不是「按钮高亮失效的 bug」,而是「永不生效的规则」。要真做工具栏选中态请显式加类并走 token。 */
|
||||
.iwb-toolbar-bottom .iwb-ic { width: 18px; height: 18px; }
|
||||
.iwb-toolbar-bottom .iwb-ic { width: var(--iwb-icon-lg); height: var(--iwb-icon-lg); }
|
||||
.iwb-toolbar-bottom .iwb-tgroup { padding: 4px 8px; font-size: var(--iwb-font-xs); background: transparent !important; color: var(--iwb-text2); }
|
||||
|
||||
/* ---- 统一悬停说明(data-tip 自定义 tooltip) ---- */
|
||||
@@ -589,7 +589,7 @@ button { font-family: inherit; }
|
||||
pointer-events: none;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition: opacity 0.12s, visibility 0.12s;
|
||||
transition: opacity .12s, visibility .12s;
|
||||
box-shadow: 0 3px 10px rgba(0,0,0,0.25);
|
||||
}
|
||||
[data-tip]:hover::after { opacity: 1; visibility: visible; }
|
||||
@@ -633,7 +633,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-dock-btn:focus-visible,
|
||||
.iwb-nav-item:focus-visible,
|
||||
.iwb-wsrail-title:focus-visible { outline: var(--iwb-focus-ring); outline-offset: -2px; }
|
||||
.iwb-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
|
||||
.iwb-btn:disabled { opacity: var(--iwb-opacity-disabled); cursor: not-allowed; transform: none; }
|
||||
.iwb-btn-primary { background: var(--iwb-brand); border-color: var(--iwb-brand); color: var(--iwb-on-brand); }
|
||||
.iwb-btn-primary:hover { background: color-mix(in srgb, var(--iwb-brand) 85%, #000); border-color: var(--iwb-brand); color: var(--iwb-on-brand); }
|
||||
/* 常驻选中态(画布工具组的「当前工具」):底栏按钮本身是「无边框 + 透明底」,所以这里用淡填充药丸表示
|
||||
@@ -704,7 +704,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-toolbar-bottom { padding: 6px 8px; gap: 4px; }
|
||||
.iwb-toolbar-bottom .iwb-btn { padding: 4px 6px; }
|
||||
.iwb-toolbar-bottom .iwb-ic { width: 15px; height: 15px; }
|
||||
.iwb-toolbar-bottom .iwb-tgroup { padding: 2px 4px; font-size: 10px; }
|
||||
.iwb-toolbar-bottom .iwb-tgroup { padding: 2px 4px; font-size: var(--iwb-font-2xs); } /*iwb:raw-until=3.28.0*/
|
||||
}
|
||||
|
||||
/* ---- 右侧竖向面板栏(与左侧栏统一:无阴影) ---- */
|
||||
@@ -712,18 +712,18 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--iwb-border); flex: 0 0 auto; }
|
||||
.iwb-drawer-toggle { display: none; }
|
||||
|
||||
.iwb-ws-headicon { flex: 0 0 26px; width: 26px; height: 24px; padding: 0; justify-content: center; background: transparent !important; border: none !important; color: var(--iwb-text2); opacity: 0.75; transition: opacity 0.12s, color 0.12s; }
|
||||
.iwb-ws-headicon { flex: 0 0 26px; width: 26px; height: 24px; padding: 0; justify-content: center; background: transparent !important; border: none !important; color: var(--iwb-text2); opacity: 0.75; transition: opacity .12s, color .12s; }
|
||||
.iwb-ws-headicon:hover { opacity: 1; color: var(--iwb-text); }
|
||||
.iwb-ws-headicon:active { opacity: 1; color: var(--iwb-text); }
|
||||
.iwb-ws-headicon.iwb-btn-primary { background: transparent !important; border: none !important; color: var(--iwb-brand-text, var(--iwb-brand)); opacity: 1; }
|
||||
.iwb-ws-headicon .iwb-ic { width: 14px; height: 14px; }
|
||||
.iwb-ws-headicon .iwb-ic { width: var(--iwb-icon-sm); height: var(--iwb-icon-sm); }
|
||||
|
||||
.iwb-toolbar-bottom .iwb-btn-fit .iwb-ic { width: 15px; height: 15px; }
|
||||
.iwb-toolbar-bottom .iwb-btn-fit { padding: 7px 7px; }
|
||||
|
||||
/* ---- 连线拖拽反馈:可连接绿框 / 不可连接红框 ---- */
|
||||
.iwb-node.iwb-conn-ok { border-color: var(--iwb-ok) !important; box-shadow: 0 0 0 2px color-mix(in srgb, var(--iwb-ok) 45%, transparent), var(--iwb-elevation-2) !important; }
|
||||
.iwb-node.iwb-conn-bad { border-color: var(--iwb-err) !important; box-shadow: 0 0 0 2px color-mix(in srgb, var(--iwb-err) 55%, transparent), var(--iwb-elevation-2) !important; }
|
||||
.iwb-node.iwb-conn-ok { border-color: var(--iwb-ok) !important; box-shadow: 0 0 0 2px var(--iwb-ok-bd), var(--iwb-elevation-2) !important; }
|
||||
.iwb-node.iwb-conn-bad { border-color: var(--iwb-err) !important; box-shadow: 0 0 0 2px var(--iwb-err-bd), var(--iwb-elevation-2) !important; }
|
||||
.iwb-conn-hint { position: absolute; left: 8px; right: 8px; bottom: 6px; z-index: 6; padding: var(--iwb-space-4) var(--iwb-space-6); border-radius: var(--iwb-radius-chip); color: var(--iwb-err); background: rgba(254, 226, 226, 0.96); border: 1px solid rgba(239, 68, 68, 0.35); font-size: var(--iwb-font-xs); line-height: 1.25; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.iwb-command-mask { position: fixed; inset: 0; z-index: var(--iwb-z-command); display: flex; justify-content: center; align-items: flex-start; padding-top: 13vh; background: rgba(10, 12, 18, 0.32); }
|
||||
.iwb-command { width: min(560px, calc(100vw - 32px)); max-height: min(560px, 72vh); overflow: hidden; background: var(--iwb-panel); border: 1px solid var(--iwb-border2); border-radius: var(--iwb-radius-panel); box-shadow: var(--iwb-elevation-3); display: flex; flex-direction: column; }
|
||||
@@ -731,19 +731,19 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-command-icon { color: var(--iwb-brand-text, var(--iwb-brand)); font-size: 11px; font-weight: 800; }
|
||||
.iwb-command-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--iwb-text); font-size: 14px; }
|
||||
.iwb-command-list { overflow-y: auto; padding: 6px; }
|
||||
.iwb-command-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--iwb-text); text-align: left; cursor: pointer; font-size: 13px; }
|
||||
.iwb-command-item { width: 100%; display: flex; align-items: center; gap: var(--iwb-space-10); padding: 9px 10px; border: 0; border-radius: var(--iwb-radius-chip); background: transparent; color: var(--iwb-text); text-align: left; cursor: pointer; font-size: var(--iwb-font-md); } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-command-item:hover, .iwb-command-item:focus { outline: 0; background: var(--iwb-layer2); color: var(--iwb-brand-text, var(--iwb-brand)); }
|
||||
.iwb-command-item-active { outline: 0; background: var(--iwb-layer2); color: var(--iwb-brand-text, var(--iwb-brand)); }
|
||||
.iwb-command-item .iwb-ic { width: 16px; height: 16px; flex: 0 0 auto; }
|
||||
.iwb-command-item .iwb-ic { width: var(--iwb-icon-md); height: var(--iwb-icon-md); flex: 0 0 auto; }
|
||||
.iwb-command-empty { padding: 22px 12px; text-align: center; color: var(--iwb-text2); font-size: 12px; }
|
||||
.iwb-command-foot { padding: 8px 14px; border-top: 1px solid var(--iwb-border); color: var(--iwb-text2); font-size: 11px; }
|
||||
.iwb-edge-temp.iwb-edge-ok { stroke: var(--iwb-ok) !important; }
|
||||
.iwb-edge-temp.iwb-edge-bad { stroke: var(--iwb-err) !important; }
|
||||
|
||||
/* 任务失败详情 */
|
||||
.iwb-task-err-toggle { display: block; width: 100%; text-align: left; margin-top: var(--iwb-space-6); font-size: var(--iwb-font-xs); color: var(--iwb-err); background: color-mix(in srgb, var(--iwb-err) 8%, transparent); border: 1px solid color-mix(in srgb, var(--iwb-err) 35%, transparent); border-radius: var(--iwb-radius-chip); cursor: pointer; padding: var(--iwb-space-4) var(--iwb-space-6); }
|
||||
.iwb-task-err-toggle:hover { background: color-mix(in srgb, var(--iwb-err) 14%, transparent); }
|
||||
.iwb-task-err { margin-top: var(--iwb-space-6); border: 1px solid color-mix(in srgb, var(--iwb-err) 40%, transparent); border-radius: var(--iwb-radius-chip); background: color-mix(in srgb, var(--iwb-err) 6%, transparent); padding: var(--iwb-space-6) var(--iwb-space-8); }
|
||||
.iwb-task-err-toggle { display: block; width: 100%; text-align: left; margin-top: var(--iwb-space-6); font-size: var(--iwb-font-xs); color: var(--iwb-err); background: var(--iwb-err-bg); border: 1px solid var(--iwb-err-bd); border-radius: var(--iwb-radius-chip); cursor: pointer; padding: var(--iwb-space-4) var(--iwb-space-6); }
|
||||
.iwb-task-err-toggle:hover { background: var(--iwb-err-bg); }
|
||||
.iwb-task-err { margin-top: var(--iwb-space-6); border: 1px solid var(--iwb-err-bd); border-radius: var(--iwb-radius-chip); background: var(--iwb-err-bg); padding: var(--iwb-space-6) var(--iwb-space-8); }
|
||||
.iwb-task-errline { font-size: var(--iwb-font-xs); color: var(--iwb-err); word-break: break-all; line-height: 1.6; padding: var(--iwb-space-2) 0; }
|
||||
/* 失败分类颜色:连接=红、资源/额度=橙、密钥=紫、服务商=红棕、其他=灰 */
|
||||
.iwb-err-conn { color: var(--iwb-err); }
|
||||
@@ -779,15 +779,15 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-ctxmenu { position: fixed; min-width: 196px; max-width: 240px; max-height: calc(100vh - 24px); overflow-y: auto; padding: 6px; background: var(--iwb-bg-menu); border: 1px solid var(--iwb-border); border-radius: var(--iwb-radius-panel); box-shadow: var(--iwb-elevation-2); z-index: var(--iwb-z-ctx-menu); display: flex; flex-direction: column; gap: 2px; }
|
||||
/* 提示词/节点组的右键「移动到分组」菜单已 portal 到 body:需高于 .iwb-overlay(z-index:100),否则被应用层盖住 */
|
||||
.iwb-ctxmenu.iwb-lib-group-menu { z-index: var(--iwb-z-sheet-menu); /* 面板内的 portal 菜单:> sheet、< modal,见 tokens 层级表 */ }
|
||||
.iwb-ctx-title { font-size: 10px; font-weight: 700; color: var(--iwb-text2); letter-spacing: 1px; padding: 6px 10px 2px; text-transform: uppercase; }
|
||||
.iwb-ctx-title { font-size: var(--iwb-font-2xs); font-weight: 700; color: var(--iwb-text2); letter-spacing: 1px; padding: 6px 10px 2px; text-transform: uppercase; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-ctx-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: none; border-radius: 8px; background: transparent; color: var(--iwb-text); font-size: var(--iwb-font-sm); cursor: pointer; text-align: left; }
|
||||
.iwb-ctx-item .iwb-ic { width: 14px; height: 14px; flex: 0 0 auto; color: var(--iwb-text2); }
|
||||
.iwb-ctx-item .iwb-ic { width: var(--iwb-icon-sm); height: var(--iwb-icon-sm); flex: 0 0 auto; color: var(--iwb-text2); }
|
||||
.iwb-ctx-item:hover:not(:disabled) { background: color-mix(in srgb, var(--iwb-brand) 12%, transparent); color: var(--iwb-text); }
|
||||
.iwb-ctx-item:hover:not(:disabled) .iwb-ic { color: var(--iwb-brand-text, var(--iwb-brand)); }
|
||||
.iwb-ctx-item:disabled { opacity: 0.38; cursor: default; }
|
||||
.iwb-ctx-item.iwb-ctx-danger { color: var(--iwb-err); }
|
||||
.iwb-ctx-item.iwb-ctx-danger .iwb-ic { color: var(--iwb-err); }
|
||||
.iwb-ctx-item.iwb-ctx-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--iwb-err) 10%, transparent); color: var(--iwb-err); }
|
||||
.iwb-ctx-item.iwb-ctx-danger:hover:not(:disabled) { background: var(--iwb-err-bg); color: var(--iwb-err); }
|
||||
.iwb-ctx-sep { height: 1px; margin: 4px 6px; background: var(--iwb-border); flex: 0 0 auto; }
|
||||
/* ---- 二级菜单(2026-11-19 用户要求:一级太长了)----
|
||||
* 「选中操作」「该节点」两组收进子菜单,一级只留入口。纯 CSS 展开(:hover + :focus-within),
|
||||
@@ -795,7 +795,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
* 定位:默认贴父项右侧(一级菜单永远离视口右边 ≥210px,见 app.js 的 left 夹取,放得下 200px 子菜单);
|
||||
* 最后一项「该节点」用 .iwb-ctx-sub-up 改为底对齐,避免向下溢出视口。 */
|
||||
.iwb-ctx-subwrap { position: relative; display: flex; flex-direction: column; }
|
||||
.iwb-ctx-arrow { margin-left: auto; padding-left: 10px; font-style: normal; font-size: 10px; line-height: 1; color: var(--iwb-text2); opacity: 0.7; }
|
||||
.iwb-ctx-arrow { margin-left: auto; padding-left: var(--iwb-space-10); font-style: normal; font-size: var(--iwb-font-2xs); line-height: 1; color: var(--iwb-text2); opacity: var(--iwb-opacity-muted); }
|
||||
.iwb-ctx-sub { position: absolute; left: calc(100% + 6px); bottom: -6px; display: none; min-width: 200px; overflow: visible; max-height: none; }
|
||||
/* 6px 缝隙也要能滑过去,否则鼠标一移就收起来了。注意子菜单必须 overflow:visible,
|
||||
* 否则这条桥接用的伪元素会被 .iwb-ctxmenu 继承来的 overflow-y:auto 裁掉,等于没加。 */
|
||||
@@ -825,14 +825,14 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-task-btns { display: inline-flex; align-items: center; gap: var(--iwb-space-4); flex: 0 0 auto; }
|
||||
/* 任务卡左侧有 1px 描边 + 8px 内边距,批量管理行没有 ⇒ 补 9px 让两处复选框落在同一条竖线上(2026-11-01) */
|
||||
.iwb-task-bulkbar { padding-left: var(--iwb-space-8); }
|
||||
.iwb-task-check { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: 0 0 auto; cursor: pointer; border-radius: var(--iwb-radius-chip); margin-right: var(--iwb-space-2); transition: background 0.12s; }
|
||||
.iwb-task-check { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: 0 0 auto; cursor: pointer; border-radius: var(--iwb-radius-chip); margin-right: var(--iwb-space-2); transition: background .12s; }
|
||||
.iwb-task-check:hover { background: color-mix(in srgb, var(--iwb-brand) 12%, transparent); }
|
||||
.iwb-task-check input { width: 16px; height: 16px; margin: 0; cursor: pointer; accent-color: var(--iwb-text); }
|
||||
.iwb-task-title { flex: 1 1 auto; min-width: 0; }
|
||||
.iwb-task-inactive { opacity: 0.55; border-left-color: var(--iwb-border2); }
|
||||
.iwb-task-inactive .iwb-task-title { text-decoration: line-through; }
|
||||
.iwb-task { position: relative; overflow: hidden; }
|
||||
.iwb-task-refinfo { font-size: 10px; font-weight: 400; color: var(--iwb-text-dim); margin-left: var(--iwb-space-2); white-space: nowrap; }
|
||||
.iwb-task-refinfo { font-size: var(--iwb-font-2xs); font-weight: 400; color: var(--iwb-text-dim); margin-left: var(--iwb-space-2); white-space: nowrap; }
|
||||
.iwb-generation-spinner { position: relative; z-index: 2; display: inline-block; width: 12px; height: 12px; flex: 0 0 12px; border: 2px solid var(--iwb-anim-track); border-top-color: var(--iwb-anim); border-right-color: var(--iwb-anim); border-radius: 50%; animation: iwb-generation-spinner-spin 0.9s linear infinite; }
|
||||
.iwb-task-count-sel { min-width: 56px; border: none; background-color: transparent; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%23c8cdd6' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 3px center; appearance: none; -webkit-appearance: none; -moz-appearance: none; }
|
||||
@keyframes iwb-generation-spinner-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
|
||||
@@ -866,10 +866,10 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
/* 任务卡结果图(与提示词一一对应) */
|
||||
.iwb-task-results { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--iwb-space-6); margin-top: var(--iwb-space-8); }
|
||||
.iwb-task-result { position: relative; }
|
||||
.iwb-task-result-img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--iwb-radius-control); border: 1px solid var(--iwb-border); cursor: zoom-in; background: var(--iwb-field); display: block; transition: border-color 0.12s; }
|
||||
.iwb-task-result-img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--iwb-radius-control); border: 1px solid var(--iwb-border); cursor: zoom-in; background: var(--iwb-field); display: block; transition: border-color .12s; }
|
||||
.iwb-task-result-img:hover { border-color: var(--iwb-brand); }
|
||||
.iwb-task-result-meta { font-size: 10px; color: var(--iwb-text2); text-align: center; margin-top: var(--iwb-space-2); }
|
||||
.iwb-task-result-dl { position: absolute; left: 0; right: 0; bottom: 0; height: 30px; border-radius: 0 0 8px 8px; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.45); opacity: 0; transition: opacity 0.15s; }
|
||||
.iwb-task-result-meta { font-size: var(--iwb-font-2xs); color: var(--iwb-text2); text-align: center; margin-top: var(--iwb-space-2); }
|
||||
.iwb-task-result-dl { position: absolute; left: 0; right: 0; bottom: 0; height: 30px; border-radius: 0 0 8px 8px; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.45); opacity: 0; transition: opacity .15s; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-task-result:hover .iwb-task-result-dl { opacity: 1; }
|
||||
.iwb-task-result-dl .iwb-ic { width: 16px; height: 16px; color: var(--iwb-on-brand); }
|
||||
|
||||
@@ -877,14 +877,14 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-combine-srcs { display: flex; flex-direction: column; gap: 3px; margin: 6px 0; }
|
||||
.iwb-combine-src { font-size: 11px; color: var(--iwb-text2); background: var(--iwb-field); border: 1px solid var(--iwb-border); border-radius: 6px; padding: 3px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
/* 组合来源行里的「样式名」标签(2026-11-14):只给插件提示词类节点打标,帮用户认出这一行来自哪条风格 */
|
||||
.iwb-combine-src-tag { display: inline-block; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; margin-right: 4px; padding: 0 5px; border-radius: 4px; background: color-mix(in srgb, var(--iwb-brand) 16%, transparent); color: var(--iwb-brand-text, var(--iwb-brand)); font-size: 10px; line-height: 15px; }
|
||||
.iwb-combine-src-tag { display: inline-block; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; margin-right: var(--iwb-space-4); padding: 0 5px; border-radius: var(--iwb-radius-chip); background: color-mix(in srgb, var(--iwb-brand) 16%, transparent); color: var(--iwb-brand-text, var(--iwb-brand)); font-size: var(--iwb-font-2xs); line-height: 15px; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-batch-srcs { display: flex; flex-direction: column; gap: 3px; margin: 6px 0; }
|
||||
.iwb-batch-src { font-size: 11px; color: var(--iwb-text2); background: var(--iwb-field); border: 1px solid var(--iwb-border); border-radius: 6px; padding: 3px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.iwb-combine-row { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
|
||||
.iwb-combine-row .iwb-plabel { flex: 0 0 48px; font-size: 11px; color: var(--iwb-text2); }
|
||||
.iwb-combine-row .iwb-input { flex: 1 1 auto; font-size: 11px; padding: 3px 5px; }
|
||||
.iwb-combine-out { margin-top: 6px; border: 1px solid color-mix(in srgb, var(--iwb-brand) 35%, transparent); border-radius: 7px; background: color-mix(in srgb, var(--iwb-brand) 8%, transparent); padding: 6px 8px; }
|
||||
.iwb-combine-out-label { font-size: 10px; font-weight: 700; color: var(--iwb-brand-text, var(--iwb-brand)); margin-bottom: 3px; }
|
||||
.iwb-combine-out { margin-top: var(--iwb-space-6); border: 1px solid color-mix(in srgb, var(--iwb-brand) 35%, transparent); border-radius: var(--iwb-radius-chip); background: color-mix(in srgb, var(--iwb-brand) 8%, transparent); padding: 6px 8px; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-combine-out-label { font-size: var(--iwb-font-2xs); font-weight: 700; color: var(--iwb-brand-text, var(--iwb-brand)); margin-bottom: 3px; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-combine-out-text { font-size: 11px; color: var(--iwb-text); white-space: pre-wrap; word-break: break-all; max-height: 90px; overflow-y: auto; }
|
||||
|
||||
/* 输出节点:田字格/瀑布流 + 批量下载 */
|
||||
@@ -900,10 +900,10 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-out-head .iwb-label { flex: 0 0 auto; }
|
||||
.iwb-out-tools { flex: 1 1 auto; display: flex; gap: 4px; justify-content: flex-end; }
|
||||
.iwb-out-tools .iwb-btn { padding: 2px 8px; font-size: 11px; }
|
||||
.iwb-out-cell-img { width: 100%; height: auto; display: block; border-radius: 8px; border: 1px solid var(--iwb-border); cursor: zoom-in; background: var(--iwb-layer2); transition: border-color 0.12s; }
|
||||
.iwb-out-cell-img { width: 100%; height: auto; display: block; border-radius: var(--iwb-radius-control); border: 1px solid var(--iwb-border); cursor: zoom-in; background: var(--iwb-layer2); transition: border-color .12s; }
|
||||
.iwb-out-cell-img:hover { border-color: var(--iwb-brand); }
|
||||
.iwb-out-cell-meta { font-size: 10px; color: var(--iwb-text2); text-align: center; margin-top: 2px; }
|
||||
.iwb-out-cell-actions { position: absolute; left: 0; right: 0; bottom: 0; height: 22px; display: flex; align-items: center; justify-content: center; gap: 10px; opacity: 0; transition: opacity 0.15s; border-radius: 0 0 8px 8px; background: rgba(0,0,0,0.45); }
|
||||
.iwb-out-cell-meta { font-size: var(--iwb-font-2xs); color: var(--iwb-text2); text-align: center; margin-top: var(--iwb-space-2); }
|
||||
.iwb-out-cell-actions { position: absolute; left: 0; right: 0; bottom: 0; height: 22px; display: flex; align-items: center; justify-content: center; gap: var(--iwb-space-10); opacity: 0; transition: opacity .15s; border-radius: 0 0 8px 8px; background: rgba(0,0,0,0.45); } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-out-cell:hover .iwb-out-cell-actions { opacity: 1; }
|
||||
.iwb-out-cell-actions .iwb-btn { width: 18px; height: 18px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255,255,255,0.9); color: #333; border: none; cursor: pointer; }
|
||||
.iwb-out-cell-actions .iwb-btn:hover { background: var(--iwb-panel); color: var(--iwb-brand-text, var(--iwb-brand)); }
|
||||
@@ -956,7 +956,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-update-bar {
|
||||
top: 100px; bottom: auto; z-index: 130;
|
||||
max-width: calc(100vw - 32px); justify-content: center;
|
||||
animation: iwb-update-in .18s ease-out 1 both;
|
||||
animation: iwb-update-in .15s ease-out 1 both;
|
||||
}
|
||||
@keyframes iwb-update-in {
|
||||
from { opacity: 0; transform: translate(-50%, -6px); }
|
||||
@@ -1015,7 +1015,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-size-preset-grid-edit { grid-template-columns: minmax(120px, 1fr) repeat(3, minmax(108px, 1fr)) 38px; }
|
||||
.iwb-size-preset-grid-edit .iwb-btn { width: 34px; min-width: 34px; padding: 0; justify-content: center; justify-self: center; }
|
||||
.iwb-shell-nav { left: 12px; top: 12px; z-index: 30; align-items: center; }
|
||||
.iwb-shell-nav-item { display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: 7px; padding: 7px 10px; background: transparent; color: var(--iwb-text2); cursor: pointer; }
|
||||
.iwb-shell-nav-item { display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: var(--iwb-radius-chip); padding: 7px 10px; background: transparent; color: var(--iwb-text2); cursor: pointer; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-shell-nav-item:hover, .iwb-shell-nav-active { background: var(--iwb-layer2); color: var(--iwb-text); }
|
||||
.iwb-shell-nav-caption { padding: 0 8px; font-size: 11px; color: var(--iwb-text2); }
|
||||
.iwb-home-panel { position: absolute; inset: 0; z-index: 20; overflow: auto; background: var(--iwb-home-bg); }
|
||||
@@ -1161,7 +1161,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
* 激活态只有一条规则:品牌淡底 + 品牌字 + 600。此前 5 套变体里的抽屉 / 右竖栏 / 资源中心
|
||||
* 三套已被新 UI 取代且无任何生产者(dist 里搜不到类名),规则连同父容器一并删除;
|
||||
* 设置侧栏原先单独写了一份激活态,现在直接继承这一条。 */
|
||||
.iwb-tab { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; height: var(--iwb-tab-h); padding: 0 var(--iwb-space-12); border: 0; border-radius: var(--iwb-tab-radius); background: transparent; color: var(--iwb-text2); font-size: var(--iwb-font-sm); cursor: pointer; white-space: nowrap; max-width: 190px; transition: background .15s ease, color .15s ease; }
|
||||
.iwb-tab { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; height: var(--iwb-tab-h); padding: 0 var(--iwb-space-12); border: 0; border-radius: var(--iwb-tab-radius); background: transparent; color: var(--iwb-text2); font-size: var(--iwb-font-sm); cursor: pointer; white-space: nowrap; max-width: 190px; transition: background .15s ease, color .15s ease; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-tab:hover { background: var(--iwb-hover); color: var(--iwb-text); }
|
||||
/* 文字用主文字色而不是 brand-text:brand-text 的语义是「品牌色当文字」(链接/按钮),
|
||||
* 压在品牌淡底上亮色只有 4.42:1(低于 4.5),且比未激活标签的 text2 还弱 —— 选中项不该最不清楚。
|
||||
@@ -1171,7 +1171,6 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.theme-dark .iwb-tab-active { background: color-mix(in srgb, var(--iwb-brand) 22%, transparent); }
|
||||
.iwb-tab:focus-visible { outline: var(--iwb-focus-ring); outline-offset: 1px; }
|
||||
/* 首页激活胶囊走灰阶(首页整体灰色系;画布标签仍用品牌色) */
|
||||
.iwb-tab-home.iwb-tab-active { background: transparent; color: var(--iwb-text); }
|
||||
/* 首页图标与画布标签之间的细分隔线 */
|
||||
.iwb-tab-sep { flex: 0 0 auto; width: 1px; height: 16px; background: var(--iwb-border); }
|
||||
.iwb-tab-label { overflow: hidden; text-overflow: ellipsis; }
|
||||
@@ -1181,12 +1180,10 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-tab-dot-err { background: var(--iwb-err); }
|
||||
.iwb-tab-new { color: var(--iwb-text2); font-weight: 700; padding: 0 var(--iwb-space-8); font-size: var(--iwb-font-lg); line-height: 1; }
|
||||
.iwb-tab-new:hover { background: color-mix(in srgb, var(--iwb-brand) 12%, transparent); color: var(--iwb-brand-text, var(--iwb-brand)); }
|
||||
.iwb-tab-close { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 31px; /* 与标签名留约 3 个字的间距(gap 5px + 31px ≈ 36px) */ border: 0; border-radius: var(--iwb-radius-chip); background: transparent; color: var(--iwb-text2); cursor: pointer; opacity: 0; transition: opacity .12s; padding: 0; }
|
||||
.iwb-tab-close { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 31px; /* 与标签名留约 3 个字的间距(gap 5px + 31px ≈ 36px) */ border: 0; border-radius: var(--iwb-radius-chip); background: transparent; color: var(--iwb-text2); cursor: pointer; opacity: 0; transition: opacity .12s; padding: 0; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-tab:hover .iwb-tab-close { opacity: 1; }
|
||||
.iwb-tab-close:hover { background: color-mix(in srgb, var(--iwb-text2) 16%, transparent); color: var(--iwb-text); }
|
||||
.iwb-tab-close .iwb-ic { width: 12px; height: 12px; }
|
||||
.iwb-tab-home { padding: 0 9px; }
|
||||
.iwb-tab-home .iwb-ic { width: 16px; height: 16px; }
|
||||
/* 标签条出现时顶栏下移(仅画布视图;覆盖共享 top:0 规则) */
|
||||
|
||||
/* 标签条始终顶左对齐(不随左侧栏展开缩进——标签条在最顶层、横跨全宽) */
|
||||
@@ -1455,21 +1452,21 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-size-num::-webkit-outer-spin-button, .iwb-size-num::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
|
||||
|
||||
/* ===== v3.86.5 图像设置浮层(质量 / 尺寸 / 分辨率 / 宽高比网格) ===== */
|
||||
.iwb-image-settings { width: 380px; max-width: calc(100vw - 32px); }
|
||||
.iwb-image-settings { width: var(--iwb-pop-w); max-width: calc(100vw - 32px); }
|
||||
.iwb-image-settings .iwb-modal-body { display: flex; flex-direction: column; gap: 12px; }
|
||||
.iwb-setgroup { display: flex; flex-direction: column; gap: var(--iwb-space-6); }
|
||||
.iwb-setgroup { display: flex; flex-direction: column; gap: var(--iwb-space-4); }
|
||||
/* v3.87.5:质量档位一行放 6 个 chip(自动/快速/标准/高清/极高/最高)→ 只在这个浮层里收紧内边距;
|
||||
.iwb-setrow 本来就有 flex-wrap,字体差异导致放不下时自然换行,不存在溢出。 */
|
||||
.iwb-image-settings .iwb-chip-line { padding: 5px 10px; }
|
||||
.iwb-image-settings .iwb-chip-line { padding: 0 var(--iwb-pop-chip-pad-x); }
|
||||
.iwb-chip[disabled] { opacity: 0.45; cursor: not-allowed; }
|
||||
.iwb-chip[disabled]:hover { color: var(--iwb-text2); border-color: var(--iwb-border); }
|
||||
/* 设置里模型行的「质量」勾选:紧跟名字,不参与右侧按钮的挤压 */
|
||||
.iwb-modelrow-q { flex: 0 0 auto; font-size: 12px; }
|
||||
.iwb-modelrow-q input { margin: 0; }
|
||||
.iwb-setlabel { color: var(--iwb-text2); font-size: var(--iwb-font-sm); font-weight: 700; }
|
||||
.iwb-setlabel { color: var(--iwb-text2); font-size: var(--iwb-font-sm); font-weight: 600; }
|
||||
.iwb-sethd { display: flex; align-items: center; justify-content: space-between; gap: var(--iwb-space-8); }
|
||||
.iwb-setalign { font-size: var(--iwb-font-sm); white-space: nowrap; }
|
||||
.iwb-setrow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--iwb-space-6); }
|
||||
.iwb-setalign { font-size: var(--iwb-font-md); white-space: nowrap; }
|
||||
.iwb-setrow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--iwb-pop-chip-gap); }
|
||||
.iwb-setx { color: var(--iwb-text2); flex: 0 0 auto; }
|
||||
.iwb-set-num { flex: 0 0 auto; width: 74px; min-width: 0; text-align: center; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
|
||||
.iwb-set-num::-webkit-outer-spin-button, .iwb-set-num::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
|
||||
@@ -1478,10 +1475,14 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
|
||||
/* ===== v3.86.5 图像设置:贴节点浮层(popover)形态 ===== */
|
||||
.iwb-pop-anchor { position: fixed; z-index: var(--iwb-z-anchor); }
|
||||
.iwb-pop { width: 380px; max-width: calc(100vw - 16px); background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: var(--iwb-radius-popover); box-shadow: var(--iwb-elevation-3); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 32px); overflow-y: auto; }
|
||||
/* 浮层弹窗(模型设置 / 图像设置 / 后续同类)统一 token —— 见 docs/standards/design-tokens.md §3.13 */
|
||||
/* v3.26.60:字号整体上调一档(用户反馈 11px 太小)——胶囊 11→13px、高 22→28px、左右内距 6→10、
|
||||
间距 4→6、标题 12→14,面板同步 328→360px 抵消放大后的换行。仍是「所有选项同一套数值」,
|
||||
模型名永不省略的契约不变(靠 min-width: max-content + 面板横向滚动兜底)。 */
|
||||
.iwb-pop { width: var(--iwb-pop-w); max-width: calc(100vw - 16px); background: var(--iwb-panel); border: var(--iwb-bw) solid var(--iwb-border); border-radius: var(--iwb-pop-radius); box-shadow: var(--iwb-elevation-3); padding: var(--iwb-pop-pad-y) var(--iwb-pop-pad-x); display: flex; flex-direction: column; gap: var(--iwb-pop-gap); max-height: calc(100vh - 32px); overflow-y: auto; }
|
||||
.iwb-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
||||
.iwb-pop-title { font-weight: 700; color: var(--iwb-text); }
|
||||
.iwb-pop-body { display: flex; flex-direction: column; gap: 12px; }
|
||||
.iwb-pop-title { font-weight: 700; color: var(--iwb-text); font-size: var(--iwb-pop-title-size); }
|
||||
.iwb-pop-body { display: flex; flex-direction: column; gap: var(--iwb-pop-gap); }
|
||||
/* 纯描边胶囊:与截图一致(选中只加重描边与文字色,不填充) */
|
||||
.iwb-chip-line { background: transparent; border: 1px solid var(--iwb-border); color: var(--iwb-text); border-radius: 999px; padding: 5px 14px; }
|
||||
.iwb-chip-line:hover { border-color: var(--iwb-brand); color: var(--iwb-text); }
|
||||
@@ -1530,9 +1531,11 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
/* 选中项 = 品牌色描边 + 品牌色文字(与 .iwb-chip-line-on 同一套选中语言,只加重不填充) */
|
||||
|
||||
/* 弹窗内四组控件的形状统一:跟随「尺寸」那组(圆角矩形,非胶囊);字号统一 15px */
|
||||
.iwb-pop .iwb-chip-line { border-radius: 10px; min-height: 38px; padding: 6px 14px; font-size: 15px; }
|
||||
.iwb-pop .iwb-set-num { font-size: var(--iwb-font-lg); }
|
||||
.iwb-pop-title { font-size: 15px; }
|
||||
.iwb-pop .iwb-chip-line { display: inline-flex; align-items: center; border-radius: var(--iwb-pop-chip-radius); min-height: var(--iwb-pop-chip-h); padding: 0 var(--iwb-pop-chip-pad-x); font-size: var(--iwb-pop-chip-size); }
|
||||
.iwb-pop .iwb-set-num { height: var(--iwb-pop-chip-h); font-size: var(--iwb-font-md); width: 68px; }
|
||||
/* 浮层里的说明文字比全局 .iwb-hint(10px)大一档:与胶囊文字只差 1px,读起来是同一层信息 */
|
||||
.iwb-pop .iwb-hint { font-size: var(--iwb-font-sm); line-height: 1.55; margin-top: 0; }
|
||||
.iwb-pop-title { font-size: var(--iwb-pop-title-size); }
|
||||
|
||||
/* ---------- 分层节点(layer)----------
|
||||
节点内字号跟随现有节点(11–12px),与「图像设置」面板的 15px 规范区分:
|
||||
@@ -1541,7 +1544,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-layer-prefix { font-size: 11px; color: var(--iwb-text2); background: var(--iwb-layer); border: 1px dashed var(--iwb-border); border-radius: 6px; padding: 3px 6px; word-break: break-all; }
|
||||
.iwb-layer-rows { display: flex; flex-direction: column; gap: 4px; }
|
||||
.iwb-layer-row { display: flex; align-items: center; gap: 4px; }
|
||||
.iwb-layer-idx { flex: 0 0 auto; width: 16px; text-align: center; font-size: 10px; color: var(--iwb-text2); background: var(--iwb-layer); border-radius: 4px; padding: 1px 0; }
|
||||
.iwb-layer-idx { flex: 0 0 auto; width: 16px; text-align: center; font-size: var(--iwb-font-2xs); color: var(--iwb-text2); background: var(--iwb-layer); border-radius: var(--iwb-radius-chip); padding: 1px 0; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-layer-name { flex: 1 1 46%; min-width: 0; height: 24px; font-size: 11px; }
|
||||
.iwb-layer-bbox { flex: 1 1 40%; min-width: 0; height: 24px; font-size: 11px; }
|
||||
.iwb-layer-del { flex: 0 0 auto; padding: 2px 6px; line-height: 1; }
|
||||
@@ -1555,11 +1558,11 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-layer-results { display: flex; flex-direction: column; gap: 4px; border-top: 1px dashed var(--iwb-border2); padding-top: 6px; }
|
||||
.iwb-layer-resulttitle { font-size: 11px; color: var(--iwb-text2); }
|
||||
.iwb-layer-item { display: flex; align-items: center; gap: 6px; }
|
||||
.iwb-layer-thumb { flex: 0 0 auto; width: 34px; height: 34px; object-fit: contain; border: 1px solid var(--iwb-border); border-radius: 4px; background: repeating-conic-gradient(#e9ebef 0% 25%, #fff 0% 50%) 50% / 8px 8px; cursor: zoom-in; }
|
||||
.iwb-layer-thumb { flex: 0 0 auto; width: 34px; height: 34px; object-fit: contain; border: 1px solid var(--iwb-border); border-radius: var(--iwb-radius-chip); background: repeating-conic-gradient(#e9ebef 0% 25%, #fff 0% 50%) 50% / 8px 8px; cursor: zoom-in; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-layer-meta { flex: 1 1 auto; min-width: 0; }
|
||||
.iwb-layer-itemname { font-size: 11px; color: var(--iwb-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.iwb-layer-sub { font-size: 10px; color: var(--iwb-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.iwb-layer-itemsub { font-size: 10px; color: var(--iwb-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.iwb-layer-sub { font-size: var(--iwb-font-2xs); color: var(--iwb-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.iwb-layer-itemsub { font-size: var(--iwb-font-2xs); color: var(--iwb-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
|
||||
/* ── v3.87.6 崩溃可观测性:错误边界兜底 UI + 设置里的「诊断」页 ── */
|
||||
.iwb-crash-retry { margin-top: 6px; }
|
||||
@@ -1590,7 +1593,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-shape-box .iwb-textarea { width: 100%; box-sizing: border-box; min-height: 68px; }
|
||||
.iwb-modal .iwb-section-sub { margin-top: 2px; }
|
||||
/* v3.87.30 设置弹窗放大(内容多:厂商分类 / 模型清单 / 请求体模板 / 规则) */
|
||||
.iwb-settings-modal { --iwb-set-label-w: 180px; --iwb-set-col-gap: var(--iwb-space-16); --iwb-set-row-h: 40px; --iwb-set-row-pad-y: var(--iwb-space-6); --iwb-set-title-gap: var(--iwb-space-8); --iwb-set-hint-color: var(--iwb-text-dim); --iwb-set-hint-size: var(--iwb-font-xs); --iwb-set-hint-gap: var(--iwb-space-2); --iwb-set-divider: color-mix(in srgb, var(--iwb-border) 55%, transparent); --iwb-set-group-gap: var(--iwb-space-24); width: min(1180px, 96vw); max-width: 96vw; height: min(92vh, 1040px); max-height: 92vh; }
|
||||
.iwb-settings-modal { width: min(1180px, 96vw); max-width: 96vw; height: min(92vh, 1040px); max-height: 92vh; }
|
||||
.iwb-settings-modal .iwb-modal-body { max-height: none; flex: 1 1 auto; min-height: 0; }
|
||||
/* v3.87.31 模型清单:名称占位更宽 + 「质量」胶囊开关(与"启用"复选框区分) */
|
||||
.iwb-modelrow { flex: 1 1 460px; }
|
||||
@@ -1636,13 +1639,14 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
模型列表用「标签流式排列」:每个按内容宽度,排满一行自动折行(2026-10-31 用户指定样式);
|
||||
超长名字靠 min-width: max-content 撑开 ⇒ 面板内横向滚动,仍不省略。
|
||||
文字 nowrap + 不设 text-overflow ⇒ 永不省略(省略会导致无法识别具体模型)。 */
|
||||
.iwb-gen-config { width: min(92vw, 320px); max-height: min(78vh, calc(100vh - 24px)); display: flex; flex-direction: column; gap: var(--iwb-space-10); padding: var(--iwb-space-12) var(--iwb-space-16); }
|
||||
/* 宽度跟随 --iwb-pop-w(原来写死 320px 会绕过 token,字号放大后模型面板不跟着变宽) */
|
||||
.iwb-gen-config { width: min(92vw, var(--iwb-pop-w)); max-height: min(78vh, calc(100vh - 24px)); display: flex; flex-direction: column; gap: var(--iwb-space-10); padding: var(--iwb-space-12) var(--iwb-space-16); }
|
||||
.iwb-gc-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
|
||||
.iwb-gc-field { display: flex; align-items: center; gap: 6px; min-width: 0; }
|
||||
.iwb-gc-label { font-size: 12px; color: var(--iwb-text2); white-space: nowrap; }
|
||||
.iwb-gc-select { font-size: 13px; padding: 5px 8px; border: 1px solid var(--iwb-border); border-radius: 8px; background: var(--iwb-panel); color: var(--iwb-text); max-width: 220px; }
|
||||
.iwb-gc-label { font-size: var(--iwb-font-md); color: var(--iwb-text2); white-space: nowrap; }
|
||||
.iwb-gc-select { height: var(--iwb-pop-chip-h); font-size: var(--iwb-pop-chip-size); padding: 0 var(--iwb-pop-chip-pad-x); border: 1px solid var(--iwb-border); border-radius: var(--iwb-pop-chip-radius); background: var(--iwb-panel); color: var(--iwb-text); max-width: 220px; }
|
||||
.iwb-gc-select:disabled { opacity: 0.5; }
|
||||
.iwb-gc-sub { font-size: 12px; font-weight: 700; color: var(--iwb-text2); letter-spacing: 0.5px; }
|
||||
.iwb-gc-sub { font-size: var(--iwb-font-md); font-weight: 700; color: var(--iwb-text2); letter-spacing: 0.5px; }
|
||||
/* ── 节点背景色(2026-11-01 第二轮)──────────────────────────────────────────
|
||||
数据侧:`data.bg` 存**令牌**(white/cyan/purple/pink/orange/yellow/green),
|
||||
颜色值由本文件按主题映射 ⇒ 暗色主题是**独立的一套深色**,不是把浅色压暗。
|
||||
@@ -1756,7 +1760,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
/* 节点背景色色板(2026-11-01):6 个预设色块 + 「无」。
|
||||
纯静态 CSS,无动画/滤镜 ⇒ 不改色时开销为 0;改色只重绘该节点区域。 */
|
||||
.iwb-pop.iwb-bg-palette { display: flex; flex-direction: row; align-items: center; gap: 8px; width: auto; max-width: none; padding: 8px 10px; border-radius: var(--iwb-radius-panel); }
|
||||
.iwb-bg-swatch { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--iwb-border); cursor: pointer; padding: 0; flex: 0 0 auto; transition: transform .12s, box-shadow .12s; }
|
||||
.iwb-bg-swatch { width: 26px; height: 26px; border-radius: var(--iwb-radius-control); border: 1px solid var(--iwb-border); cursor: pointer; padding: 0; flex: 0 0 auto; transition: transform .12s, box-shadow .12s; }
|
||||
.iwb-bg-swatch[data-bg="white"] { background: #fdfdfd; }
|
||||
.iwb-bg-swatch[data-bg="cyan"] { background: #e1eef0; }
|
||||
.iwb-bg-swatch[data-bg="purple"] { background: #e7e6f4; }
|
||||
@@ -1776,18 +1780,18 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-bg-swatch-none { position: relative; background: transparent !important; }
|
||||
.iwb-bg-swatch-none::after { content: ''; position: absolute; left: 4px; right: 4px; top: 50%; height: 1px; background: var(--iwb-text2); opacity: .5; transform: rotate(-45deg); }
|
||||
/* 气泡上的「背景色」按钮:直接显示**当前背景色**的小色块(不再用调色板图标) */
|
||||
.iwb-bg-dot { width: 16px; height: 16px; border-radius: 5px; padding: 0; pointer-events: none; flex: 0 0 auto; }
|
||||
.iwb-bg-dot { width: 16px; height: 16px; border-radius: var(--iwb-radius-chip); padding: 0; pointer-events: none; flex: 0 0 auto; }
|
||||
.iwb-bg-dot.iwb-bg-swatch:hover { transform: none; }
|
||||
.iwb-bg-palette-host { position: fixed; inset: 0; pointer-events: none; z-index: var(--iwb-z-palette); }
|
||||
.iwb-bg-palette-host .iwb-pop-anchor { pointer-events: auto; }
|
||||
.iwb-gc-grid { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; overflow: auto; max-height: 48vh; padding-right: 2px; }
|
||||
.iwb-gc-item { flex: 0 0 auto; width: auto; min-width: max-content; max-width: 100%; display: flex; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid var(--iwb-border); border-radius: 10px; background: var(--iwb-panel); color: var(--iwb-text); font-size: 13px; cursor: pointer; white-space: nowrap; text-align: left; }
|
||||
.iwb-gc-grid { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--iwb-pop-chip-gap); overflow: auto; max-height: 48vh; padding-right: var(--iwb-space-2); }
|
||||
.iwb-gc-item { flex: 0 0 auto; width: auto; min-width: max-content; max-width: 100%; display: inline-flex; align-items: center; min-height: var(--iwb-pop-chip-h); gap: var(--iwb-space-6); padding: 0 var(--iwb-pop-chip-pad-x); font-size: var(--iwb-pop-chip-size); border-radius: var(--iwb-pop-chip-radius); border: 1px solid var(--iwb-border); background: var(--iwb-panel); color: var(--iwb-text); cursor: pointer; white-space: nowrap; text-align: left; }
|
||||
.iwb-gc-name { white-space: nowrap; }
|
||||
.iwb-gc-tick { margin-left: auto; color: var(--iwb-brand-text, var(--iwb-brand)); font-weight: 700; }
|
||||
.iwb-gc-item:hover { border-color: var(--iwb-brand); color: var(--iwb-brand-text, var(--iwb-brand)); }
|
||||
.iwb-gc-item-on { border-color: var(--iwb-brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--iwb-brand) 18%, transparent); }
|
||||
.iwb-gc-item-err { border-color: var(--iwb-err); color: var(--iwb-err); }
|
||||
.iwb-gc-empty { font-size: 12px; color: var(--iwb-text2); padding: 6px 2px; }
|
||||
.iwb-gc-empty { font-size: var(--iwb-font-sm); color: var(--iwb-text2); padding: var(--iwb-space-6) var(--iwb-space-2); }
|
||||
/* 节点上的模型触发器:节点宽度固定(480)时长名必须省略,否则会溢出压到「尺寸」按钮上。
|
||||
(面板里的模型名永远完整显示:nowrap 且不设省略) */
|
||||
.iwb-gen-settings .iwb-pick-genmodel { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
@@ -1808,7 +1812,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
* 现在自己没写字时直接把上游文本显示出来(.is-inherited 只改字色,零布局位移),
|
||||
* 状态条说明「继承 / 已固定」并给出「恢复跟随」。 */
|
||||
.iwb-inherit-bar { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: var(--iwb-font-xs); line-height: 16px; color: var(--iwb-text2); min-width: 0; }
|
||||
.iwb-inherit-tag { flex: 0 0 auto; padding: 0 5px; border-radius: 999px; font-size: 10px; color: var(--iwb-brand-text, var(--iwb-brand)); background: color-mix(in srgb, var(--iwb-brand) 12%, transparent); }
|
||||
.iwb-inherit-tag { flex: 0 0 auto; padding: 0 5px; border-radius: var(--iwb-radius-full); font-size: var(--iwb-font-2xs); color: var(--iwb-brand-text, var(--iwb-brand)); background: color-mix(in srgb, var(--iwb-brand) 12%, transparent); } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-inherit-tag.is-taken { color: var(--iwb-text); background: color-mix(in srgb, var(--iwb-tint) 10%, transparent); }
|
||||
.iwb-inherit-src { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.iwb-inherit-more { flex: 0 0 auto; opacity: .78; }
|
||||
@@ -1887,7 +1891,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
background: var(--iwb-panel);
|
||||
border: 1px solid color-mix(in srgb, var(--iwb-border) 55%, transparent);
|
||||
border-radius: var(--iwb-radius-card);
|
||||
transition: background .14s ease, border-color .14s ease;
|
||||
transition: background .12s ease, border-color .12s ease;
|
||||
}
|
||||
.iwb-mk-card:hover { background: color-mix(in srgb, var(--iwb-layer) 55%, var(--iwb-panel)); border-color: color-mix(in srgb, var(--iwb-border2) 62%, transparent); }
|
||||
|
||||
@@ -1905,9 +1909,9 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
padding: 0 var(--iwb-space-6);
|
||||
border-radius: var(--iwb-radius-full);
|
||||
font-size: var(--iwb-font-xs); line-height: 17px;
|
||||
background: color-mix(in srgb, var(--iwb-ok) 14%, transparent);
|
||||
color: color-mix(in srgb, var(--iwb-ok) 82%, var(--iwb-text));
|
||||
border: 1px solid color-mix(in srgb, var(--iwb-ok) 32%, transparent);
|
||||
background: var(--iwb-ok-bg);
|
||||
color: var(--iwb-ok);
|
||||
border: 1px solid var(--iwb-ok-bd);
|
||||
}
|
||||
.iwb-mk-desc {
|
||||
flex: 1 1 auto; font-size: var(--iwb-font-sm); line-height: 1.55; color: var(--iwb-text2);
|
||||
@@ -1994,7 +1998,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-cpick-swatch { display: inline-flex; align-items: center; justify-content: center; min-width: 92px; height: 28px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--iwb-border); cursor: pointer; font-size: 11px; letter-spacing: .04em; }
|
||||
.iwb-cpick-swatch:hover { border-color: var(--iwb-border2); }
|
||||
.iwb-cpick-hex { font-variant-numeric: tabular-nums; } /* v3.25.75:去掉 mix-blend-mode(浅色底上文字糊成一团) */
|
||||
.iwb-cpick-swatch::after { content: '▾'; margin-left: 6px; opacity: .7; font-size: 10px; } /* 提示可点开取色 */
|
||||
.iwb-cpick-swatch::after { content: '▾'; margin-left: var(--iwb-space-6); opacity: .7; font-size: var(--iwb-font-2xs); } /* 提示可点开取色 */
|
||||
.iwb-cpick-swatch { min-width: 104px; }
|
||||
.iwb-cpick-pop { position: absolute; z-index: 80; top: calc(100% + 8px); left: 0; width: 236px; padding: 10px; border-radius: var(--iwb-radius-card); background: var(--iwb-panel); border: 1px solid var(--iwb-border); box-shadow: var(--iwb-elevation-2); }
|
||||
.iwb-cpick-box { position: relative; height: 132px; border-radius: 6px; cursor: crosshair; }
|
||||
@@ -2002,8 +2006,8 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-cpick-hue { width: 100%; height: 12px; margin: 10px 0 8px; border-radius: 6px; -webkit-appearance: none; appearance: none; }
|
||||
.iwb-cpick-hue::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--iwb-panel); border: 2px solid rgba(0,0,0,.45); cursor: pointer; }
|
||||
.iwb-cpick-rgb { display: flex; gap: 6px; }
|
||||
.iwb-cpick-chan { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: var(--iwb-text2); }
|
||||
.iwb-cpick-chan input { width: 100%; height: 26px; padding: 0 4px; text-align: center; border-radius: 5px; border: 1px solid var(--iwb-border); background: var(--iwb-layer2); color: var(--iwb-text); font-size: 11px; }
|
||||
.iwb-cpick-chan { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: var(--iwb-space-2); font-size: var(--iwb-font-2xs); color: var(--iwb-text2); }
|
||||
.iwb-cpick-chan input { width: 100%; height: 26px; padding: 0 4px; text-align: center; border-radius: var(--iwb-radius-chip); border: 1px solid var(--iwb-border); background: var(--iwb-layer2); color: var(--iwb-text); font-size: var(--iwb-font-xs); } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-cpick-foot { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
|
||||
/* 十六进制输入框可缩到 0(min-width:0 才能被 flex 压窄),「完成」按钮固定不换行 */
|
||||
.iwb-cpick-input { flex: 1 1 0; min-width: 0; width: auto; height: 26px; font-size: 11px; }
|
||||
@@ -2041,7 +2045,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-history-embedded { position: relative; }
|
||||
.iwb-gal-opt { display: inline-flex; align-items: center; gap: 3px; }
|
||||
/* 三个下拉尽量窄:只留内容 + 箭头的最小宽度(0.5K / 特大 / 全部 都放得下) */
|
||||
.iwb-gal-opt select, .iwb-gal-opts select { width: auto; min-width: 34px; max-width: 44px; height: 20px; padding: 0 0 0 3px; font-size: 10px; }
|
||||
.iwb-gal-opt select, .iwb-gal-opts select { width: auto; min-width: 34px; max-width: 44px; height: 20px; padding: 0 0 0 3px; font-size: var(--iwb-font-2xs); } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-history-grid { overscroll-behavior: contain; }
|
||||
.iwb-history-head .iwb-btn-sm { padding-left: 6px; padding-right: 6px; }
|
||||
|
||||
@@ -2112,7 +2116,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
/* 其它浮层让位(画布不动) */
|
||||
.iwb-toolbar-wrap { left: var(--iwb-dock-l, 0px); right: calc(60px + var(--iwb-dock-r, 0px)); }
|
||||
.iwb-minimap {
|
||||
transition: opacity .16s ease, transform .16s ease;
|
||||
transition: opacity .15s ease, transform .15s ease;
|
||||
position: absolute;
|
||||
width: 132px;
|
||||
height: 88px;
|
||||
@@ -2182,7 +2186,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-hotkey-name { flex: 1 1 auto; min-width: 0; font-size: 12px; color: var(--iwb-text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.iwb-hotkey-key {
|
||||
flex: 0 0 auto; display: inline-block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
||||
padding: 2px 8px; border-radius: 5px; border: 1px solid var(--iwb-border);
|
||||
padding: 2px 8px; border-radius: var(--iwb-radius-chip); border: 1px solid var(--iwb-border); /*iwb:raw-until=3.28.0*/
|
||||
background: var(--iwb-layer); color: var(--iwb-text); font-size: 11px;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
||||
}
|
||||
@@ -2257,13 +2261,13 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-appear-sw i { width: 14px; height: 14px; border-radius: var(--iwb-radius-chip); border: 1px solid var(--iwb-border); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--iwb-text) 28%, transparent); }
|
||||
.iwb-appear-revert { border: 1px solid var(--iwb-border); background: var(--iwb-layer); color: var(--iwb-text2); font-size: var(--iwb-font-xs); border-radius: var(--iwb-radius-full); padding: 1px var(--iwb-space-6); cursor: pointer; }
|
||||
.iwb-appear-revert:hover { color: var(--iwb-text); border-color: var(--iwb-border2); }
|
||||
.iwb-ratio { margin-left: 6px; font-size: 10px; padding: 1px 5px; border-radius: 999px; font-variant-numeric: tabular-nums; }
|
||||
.iwb-ratio.ok { color: var(--iwb-ok); background: color-mix(in srgb, var(--iwb-ok) 14%, transparent); }
|
||||
.iwb-ratio.warn { color: var(--iwb-warn); background: color-mix(in srgb, var(--iwb-warn) 16%, transparent); }
|
||||
.iwb-ratio.bad { color: var(--iwb-err); background: color-mix(in srgb, var(--iwb-err) 16%, transparent); }
|
||||
.iwb-ratio { margin-left: var(--iwb-space-6); font-size: var(--iwb-font-2xs); padding: 1px 5px; border-radius: var(--iwb-radius-full); border: var(--iwb-bw) solid transparent; font-variant-numeric: tabular-nums; } /*iwb:raw-until=3.28.0*/
|
||||
.iwb-ratio.ok { color: var(--iwb-ok); background: var(--iwb-ok-bg); }
|
||||
.iwb-ratio.warn { color: var(--iwb-warn); background: var(--iwb-warn-bg); border-color: var(--iwb-warn-bd); }
|
||||
.iwb-ratio.bad { color: var(--iwb-err); background: var(--iwb-err-bg); }
|
||||
.iwb-appear-preset { display: inline-flex; align-items: center; gap: var(--iwb-space-2); }
|
||||
.iwb-appear-del { border: none; background: transparent; color: var(--iwb-text2); cursor: pointer; font-size: var(--iwb-font-xs); padding: var(--iwb-space-2) var(--iwb-space-4); border-radius: var(--iwb-radius-chip); }
|
||||
.iwb-appear-del:hover { color: var(--iwb-err); background: color-mix(in srgb, var(--iwb-err) 12%, transparent); }
|
||||
.iwb-appear-del:hover { color: var(--iwb-err); background: var(--iwb-err-bg); }
|
||||
@media (max-width: 720px) { .iwb-appear-swaches { padding-left: 92px; } }
|
||||
|
||||
/* v3.25.87:插件整页/首页不显示停靠栏(含 iframe 残影,直接 display:none 而不是等淡出) */
|
||||
@@ -2278,7 +2282,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-dock-body[data-panel="prompts"],
|
||||
.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="groups"] .iwb-pcard { border-radius: var(--iwb-radius-card); transition: background .12s ease, border-color .12s ease; }
|
||||
.iwb-dock-body[data-panel="prompts"] .iwb-pcard { background: var(--iwb-plugin-card); }
|
||||
.iwb-dock-body[data-panel="groups"] .iwb-pcard { background: var(--iwb-plugin-inset); border-color: var(--iwb-border); }
|
||||
.iwb-dock-body[data-panel="prompts"] .iwb-pcard:hover,
|
||||
@@ -2344,7 +2348,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
|
||||
|
||||
/* 设置分组(Obsidian 式):标题在页面底,内容浅灰圆角容器 */
|
||||
.iwb-settings-modal{--iwb-set-group-bg:color-mix(in srgb, var(--iwb-layer) 60%, var(--iwb-panel));--iwb-set-group-radius:var(--iwb-radius-card);--iwb-set-group-pad-x:var(--iwb-space-20);--iwb-set-group-pad-y:var(--iwb-space-12);--iwb-set-group-gap:var(--iwb-space-32);--iwb-set-row-pad-y:var(--iwb-space-8);--iwb-set-divider:color-mix(in srgb, var(--iwb-border) 55%, transparent)}
|
||||
/* L3 组件 token 已上移到 src/theme-tokens.js 的 COMPONENT_SCOPED(生成到 design-tokens.css) */
|
||||
.iwb-gset-page,.iwb-gset-stack{display:flex;flex-direction:column;gap:var(--iwb-set-group-gap)}
|
||||
.iwb-gset-group{display:flex;flex-direction:column;margin:0}
|
||||
.iwb-gset-group-h{font-size:var(--iwb-font-lg);font-weight:600;margin:0 0 var(--iwb-set-title-gap,var(--iwb-space-8))}
|
||||
@@ -2369,7 +2373,6 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-provider-card .iwb-gset-group-body > .iwb-row .iwb-addr-tag{min-width:42px}
|
||||
|
||||
/* 设置页控件描边:比常规 border 更淡,避免框线抢视线 */
|
||||
.iwb-settings-modal{--iwb-set-input-border:color-mix(in srgb, var(--iwb-border) 40%, var(--iwb-panel))}
|
||||
.iwb-settings-modal .iwb-input,.iwb-settings-modal .iwb-textarea{border-color:var(--iwb-set-input-border)}
|
||||
.iwb-settings-modal .iwb-input:focus,.iwb-settings-modal .iwb-textarea:focus{border-color:var(--iwb-brand)}
|
||||
|
||||
@@ -2406,12 +2409,10 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-settings-modal .iwb-modellist{margin:0}
|
||||
|
||||
/* 分组容器:上下内边距与左右同样由 token 控制;底色取 4% 文字色,保证可见但不抢 */
|
||||
.iwb-settings-modal{--iwb-set-group-bg:hsl(0 0% 97.6%)}
|
||||
.theme-dark .iwb-settings-modal{--iwb-set-group-bg:color-mix(in srgb, var(--iwb-text) 8%, var(--iwb-panel))}
|
||||
/* 分组体底色:见 COMPONENT_SCOPED(亮 hsl(0 0% 97.6%) / 暗 文字色 8%) */
|
||||
.iwb-gset-group-body{background:var(--iwb-set-group-bg);padding:var(--iwb-set-group-pad-y) var(--iwb-set-group-pad-x)}
|
||||
|
||||
/* 设置页控件统一:复选框尺寸/品牌色、按钮组间距 */
|
||||
.iwb-settings-modal{--iwb-set-check-size:16px;--iwb-set-btn-gap:var(--iwb-space-8);--iwb-set-check-radius:4px}
|
||||
.iwb-settings-modal input[type="checkbox"]{width:var(--iwb-set-check-size);height:var(--iwb-set-check-size);accent-color:var(--iwb-brand);border-radius:var(--iwb-set-check-radius)}
|
||||
.iwb-settings-modal .iwb-backup-item{padding:var(--iwb-space-6) 0;gap:var(--iwb-space-8)}
|
||||
.iwb-settings-modal .iwb-backup-actions{gap:var(--iwb-set-btn-gap)}
|
||||
|
||||
+13
-1
@@ -5,6 +5,18 @@ const { expect } = require('@playwright/test')
|
||||
// 通用轮询:fn 返回布尔/数值/字符串,直到满足期望
|
||||
const poll = (page, fn, opts) => expect.poll(fn, Object.assign({ timeout: 8000, intervals: [50, 100, 200, 400] }, opts || {}))
|
||||
|
||||
// 回画布库(2026-11-24):标签条的房子按钮在 v3.25.62 已删除,入口只剩一级导航的「首页」。
|
||||
// 4 个 spec 此前还在点旧的 `.iwb-tab-home`(元素根本不存在)⇒ 长期全红。收口到这里,不要再各写选择器。
|
||||
const HOME_NAV = '.iwb-navrail .iwb-nav-item[aria-label="首页(画布库)"]'
|
||||
async function goHome (page) {
|
||||
await page.locator(HOME_NAV).click()
|
||||
await waitHomeReady(page)
|
||||
}
|
||||
// 当前是否停在画布库(一级导航「首页」处于 active;等价于旧断言「首页标签带 iwb-tab-active」)
|
||||
async function expectHomeActive (page) {
|
||||
await expect(page.locator(HOME_NAV)).toHaveClass(/\bon\b/)
|
||||
}
|
||||
|
||||
// 首页卡片渲染完成(含"我的画布"卡片)
|
||||
async function waitHomeReady(page) {
|
||||
await expect(page.locator('.iwb-home-card:not(.iwb-home-new)').first()).toBeVisible({ timeout: 15000 })
|
||||
@@ -47,4 +59,4 @@ async function waitForSavedText(page, text, opts) {
|
||||
return false
|
||||
}, text), Object.assign({ timeout: 10000 }, opts || {})).toBe(true)
|
||||
}
|
||||
module.exports = { waitForSavedText, waitForSaved, poll, waitHomeReady, waitCanvasOpen, waitNodeCount, waitSelectedCount, waitInternalClipboard }
|
||||
module.exports = { waitForSavedText, waitForSaved, poll, waitHomeReady, waitCanvasOpen, waitNodeCount, waitSelectedCount, waitInternalClipboard, goHome, expectHomeActive, HOME_NAV }
|
||||
@@ -437,7 +437,7 @@ test('P1 基线:pan / zoom / tab-switch / edges', async ({ page }) => {
|
||||
|
||||
// 切 5 标签 ×3 轮
|
||||
const switchTimes = []
|
||||
const tabsEls = page.locator('.iwb-tab:not(.iwb-tab-home)')
|
||||
const tabsEls = page.locator('.iwb-tab')
|
||||
const tabCount = await tabsEls.count()
|
||||
if (!LIGHT) {
|
||||
for (let r = 0; r < 3; r++) {
|
||||
|
||||
@@ -76,7 +76,7 @@ test('探针:切标签 × 缩放档位 × 节点数量', async ({ page }) => {
|
||||
await page.waitForSelector('.iwb-canvas:not(.iwb-canvas-hidden)', { timeout: 30000 })
|
||||
await page.waitForTimeout(2500)
|
||||
|
||||
const tabInfo = await page.evaluate(() => Array.from(document.querySelectorAll('.iwb-tab:not(.iwb-tab-home)'))
|
||||
const tabInfo = await page.evaluate(() => Array.from(document.querySelectorAll('.iwb-tab'))
|
||||
.map((el, idx) => ({ idx, text: (el.textContent || '').trim().slice(0, 20) }))
|
||||
.filter((t) => t.text !== '+'))
|
||||
const big = tabInfo.find((t) => t.text === 'MAIN').idx
|
||||
@@ -101,7 +101,7 @@ test('探针:切标签 × 缩放档位 × 节点数量', async ({ page }) => {
|
||||
})
|
||||
|
||||
const clickTab = (idx) => page.evaluate(async (i) => {
|
||||
const list = Array.from(document.querySelectorAll('.iwb-tab:not(.iwb-tab-home)')).filter((e) => (e.textContent || '').trim() !== '+')
|
||||
const list = Array.from(document.querySelectorAll('.iwb-tab')).filter((e) => (e.textContent || '').trim() !== '+')
|
||||
const el = list[i]
|
||||
if (!el) return null
|
||||
const t0 = performance.now()
|
||||
|
||||
@@ -306,8 +306,15 @@ const refEntrySites = [
|
||||
['拖入图片链接', /refSrcOf\(url, \(msg\) => setNotice/],
|
||||
]
|
||||
for (const [label, re] of refEntrySites) assert('参考图入口经过收口:' + label, re.test(logicSrc), '')
|
||||
// v3.26.61:图库插入的取源从 wResolveOutputSrc 换成 src/gallery-sync.js 的 prepareInsert
|
||||
//(本地副本优先 + 按需抓远程),所以钉点不能只认旧实现那一行;改为在 insertOutputsToCanvas
|
||||
// 区间内要求两件事同时成立:① 仍经过 refSrcOf 收口(SVG → PNG,参考图格式约定)
|
||||
// ② 取源走 gallery-sync(不再直连 http 链接)。区间用两个锚点切,不在这两个锚点之外的代码里误判。
|
||||
const _insertAt = appJs.indexOf('const insertOutputsToCanvas = async')
|
||||
const _insertEnd = appJs.indexOf('const loadDemo', _insertAt)
|
||||
const _insertSrc = (_insertAt >= 0 && _insertEnd > _insertAt) ? appJs.slice(_insertAt, _insertEnd) : ''
|
||||
assert('图库「插入」按钮经过收口(app.js 侧只做装配)',
|
||||
appJs.includes('wbCmd().refSrcOf(await wResolveOutputSrc(f)'), '')
|
||||
/wbCmd\(\)\.refSrcOf\(/.test(_insertSrc) && /wGallerySync\.prepareInsert\(/.test(_insertSrc), '')
|
||||
assert('refSrcOf 已从 createWorkbenchCommands 导出(否则 app.js 侧调用是 undefined)',
|
||||
/addRefFromUrl, refSrcOf,/.test(logicSrc), '')
|
||||
|
||||
|
||||
@@ -122,6 +122,20 @@ assert('文档 sourceModules 项数 == 快照长度 ' + orderSnapshot.length, fa
|
||||
assert('文档门禁 spec 数 == 实际 ' + gateSpecCount, factsDoc.includes('**' + gateSpecCount + '** 个进门禁'))
|
||||
assert('文档门禁链含 test:facts', factsDoc.includes('test:facts'))
|
||||
|
||||
// ── 6b. 行数棘轮硬数字(2026-11-24,P0-②)────────────────────────────────────
|
||||
// 动机:MAX_APP_JS_LINES 等上限被抄进 CONTRIBUTING 与本文档,此前**无人校验**,
|
||||
// 实测已漂 415 行(文档 8,700 vs 真实 9,115)。规则与测量都在 scripts/ratchet-metrics.js,
|
||||
// 与 sync-facts 共用一份 —— 避免「同步器说改了、守卫说没改」。
|
||||
console.log('6b) 棘轮硬数字(文档 == 代码)')
|
||||
const ratchetMetrics = require(path.join(root, 'scripts', 'ratchet-metrics'))
|
||||
const measured = ratchetMetrics.measure()
|
||||
for (const [kind, file] of [['contributing', 'CONTRIBUTING.md'], ['arch', 'docs/standards/architecture-current-state.md']]) {
|
||||
const text = fs.readFileSync(path.join(root, file), 'utf8')
|
||||
const res = ratchetMetrics.rewriteDoc(kind, text, measured)
|
||||
assert(file + ' 的棘轮数字与代码一致', res.changed.length === 0,
|
||||
'以下数字过时:' + res.changed.join(', ') + ' —— 跑 `node scripts/sync-facts.js --write` 自动修')
|
||||
}
|
||||
|
||||
// ── 7. 基线锚点:文档记录的「基线 SHA + 线上版本」必须与实际一致 ──────────────
|
||||
// 动机:本文档第 4 行的锚点写着「每次 main 有新提交或线上发版后必须同步」,但此前
|
||||
// **没有任何机制强制它** —— 事实上它长期停在 `e40d8b4`/v3.20.0(而实际已是 v3.21.0),
|
||||
|
||||
@@ -148,15 +148,14 @@ test('1. 画布A 复制 → 切画布B → Ctrl+Shift+V 粘到视口中心且可
|
||||
const raw = await page.evaluate(() => localStorage.getItem('iwb_clipboard'))
|
||||
const parsed = JSON.parse(raw)
|
||||
// 回画布库 → 打开第二张画布(跨画布粘贴)
|
||||
await page.locator('.iwb-tab-home').click()
|
||||
await W.waitHomeReady(page)
|
||||
await W.goHome(page)
|
||||
console.log('[check1] home cards = ' + (await page.locator('.iwb-home-card:not(.iwb-home-new)').count()))
|
||||
await page.locator('.iwb-home-card:not(.iwb-home-new)').nth(1).dblclick()
|
||||
await W.waitCanvasOpen(page)
|
||||
const nodeB0 = await page.locator('.iwb-node').count()
|
||||
// v3.24.69 起落点跟指针(见 test 17)。把指针停在画布外的导航按钮上 ⇒ 走 fallback:
|
||||
// 仍按视口中心贴,这条守的就是「指针不可用时不会贴到看不见的地方」。
|
||||
const nav = await page.locator('.iwb-tab-home').first().boundingBox()
|
||||
const nav = await page.locator(W.HOME_NAV).first().boundingBox()
|
||||
await page.mouse.move(Math.round(nav.x + nav.width / 2), Math.round(nav.y + nav.height / 2))
|
||||
// v3.24.67:节点/节点组只走 Ctrl+Shift+V(Ctrl+V 不再回退贴节点组 —— 见 test 8)
|
||||
await realPasteGroup(page)
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
'use strict'
|
||||
// 组件级 token(L3)三方一致性守卫(v3.26.62,M6)
|
||||
//
|
||||
// 为什么需要:--iwb-set-* / --iwb-pop-* 原先手写在 style.css,文档有表格、代码有值,
|
||||
// 但没有任何断言 —— 实际漂过一次(--iwb-pop-w 从 328 被改到 360,文档晚了一步)。
|
||||
// 现在值只在 scripts/gen-tokens.js 的 COMPONENT_SCOPED 里写一次,本测试守住三件事:
|
||||
// A. tokens.json 的 component.<group> 与文档表格里的 token 名双向一致;
|
||||
// B. style.css 不再重复声明这些 token(否则单一源失效,改一处不生效);
|
||||
// C. design-tokens.css 里确实生成了这些声明(生成器没漏块)。
|
||||
const assert = require('assert')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const root = path.resolve(__dirname, '..')
|
||||
const tokens = JSON.parse(fs.readFileSync(path.join(root, 'dist', 'tokens.json'), 'utf8'))
|
||||
const css = fs.readFileSync(path.join(root, 'style.css'), 'utf8')
|
||||
const gen = fs.readFileSync(path.join(root, 'src', 'design-tokens.css'), 'utf8')
|
||||
const doc = fs.readFileSync(path.join(root, 'docs', 'standards', 'design-tokens.md'), 'utf8')
|
||||
|
||||
const GROUPS = {
|
||||
// 容器级在 §3.11,控件级在 §3.12 —— 同属 component.settings,文档也分两节
|
||||
settings: { prefix: '--iwb-set-', section: ['### 3.11', '### 3.12'] },
|
||||
popover: { prefix: '--iwb-pop-', section: ['### 3.13'] }
|
||||
}
|
||||
|
||||
function sectionBody (marker) {
|
||||
const i = doc.indexOf(marker)
|
||||
assert.ok(i >= 0, '文档缺少小节:' + marker)
|
||||
const j = doc.indexOf('### ', i + marker.length)
|
||||
return doc.slice(i, j > 0 ? j : doc.length)
|
||||
}
|
||||
|
||||
let checked = 0
|
||||
for (const [group, meta] of Object.entries(GROUPS)) {
|
||||
const g = (tokens.component || {})[group]
|
||||
assert.ok(g && typeof g === 'object', 'tokens.json 缺少 component.' + group + '(gen-tokens 的分组映射或 COMPONENT_SCOPED 漏了)')
|
||||
const codeNames = Object.keys(g).map((k) => meta.prefix + k)
|
||||
assert.ok(codeNames.length > 0, 'component.' + group + ' 为空')
|
||||
|
||||
const body = [].concat(meta.section).map(sectionBody).join('\n')
|
||||
const docNames = [...new Set([...body.matchAll(/\|\s*`(--iwb-[a-z0-9-]+)`\s*\|/g)].map((m) => m[1]))]
|
||||
assert.ok(docNames.length > 0, [].concat(meta.section).join('+') + ' 表格里没解析到 token 名(表格格式变了?)')
|
||||
|
||||
const missingInDoc = codeNames.filter((n) => !docNames.includes(n))
|
||||
const missingInCode = docNames.filter((n) => !codeNames.includes(n))
|
||||
assert.deepStrictEqual(missingInDoc, [], '代码有、文档没写:' + missingInDoc.join(', '))
|
||||
assert.deepStrictEqual(missingInCode, [], '文档有、代码没定义:' + missingInCode.join(', '))
|
||||
|
||||
// B. style.css 不许再声明(单一源)
|
||||
const inStyle = [...css.matchAll(new RegExp('(' + meta.prefix + '[a-z0-9-]+)\\s*:', 'g'))].map((m) => m[1])
|
||||
assert.deepStrictEqual(inStyle, [], 'style.css 仍在声明组件 token(应删掉,值只在 COMPONENT_SCOPED):' + inStyle.join(', '))
|
||||
|
||||
// C. 生成产物里有值
|
||||
for (const n of codeNames) assert.ok(gen.includes(n + ':'), 'design-tokens.css 缺少生成项:' + n)
|
||||
checked += codeNames.length
|
||||
}
|
||||
|
||||
console.log('design-tokens component guard: ' + checked + ' 个组件 token 三方一致(文档 ↔ tokens.json ↔ 生成产物)')
|
||||
+2
@@ -10,8 +10,10 @@
|
||||
"IWBCanvasText",
|
||||
"IWBCrashLog",
|
||||
"IWBDesktop",
|
||||
"IWBDesktopHelpers",
|
||||
"IWBDockArea",
|
||||
"IWBGalleryHydration",
|
||||
"IWBGallerySync",
|
||||
"IWBGenerationRequestShape",
|
||||
"IWBGenerationResults",
|
||||
"IWBGenerationScheduler",
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
"canvas-grid.js",
|
||||
"image-display-thumb.js",
|
||||
"image-remote-cache.js",
|
||||
"gallery-sync.js",
|
||||
"image-thumb-pick.js",
|
||||
"ui-modal-drag.js",
|
||||
"ui-nav-rail.js",
|
||||
|
||||
Vendored
+7
-7
@@ -1,18 +1,18 @@
|
||||
{
|
||||
"_comment": "设计 token 棘轮基线(M5-T5.2)。数字只允许下降,不允许上升 —— 涨了就说明新代码写了裸值,改用 token 或(确有必要时)在 PR 里说明并下调别的项把总数补回来。口径来源:node scripts/token-audit.js --json",
|
||||
"measuredAt": "2026-11-23",
|
||||
"measuredVersion": "3.26.51",
|
||||
"measuredAt": "2026-11-24",
|
||||
"measuredVersion": "3.26.62",
|
||||
"counts": {
|
||||
"undefinedRefs": 0,
|
||||
"deadTokens": 32,
|
||||
"hex": 79,
|
||||
"rgb": 55,
|
||||
"fontSize": 159,
|
||||
"radius": 95,
|
||||
"spacing": 377,
|
||||
"fontSize": 120,
|
||||
"radius": 74,
|
||||
"spacing": 353,
|
||||
"zIndexDecl": 71,
|
||||
"fontSizeDistinct": 13,
|
||||
"radiusDistinct": 17,
|
||||
"fontSizeDistinct": 12,
|
||||
"radiusDistinct": 14,
|
||||
"spacingDistinct": 26,
|
||||
"zIndexDistinct": 31,
|
||||
"shadowDistinct": 44
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
'use strict'
|
||||
// gallery-sync 行为回归(v3.26.61)
|
||||
// 守三件用户报障直接相关的事:
|
||||
// ① 单张归档只归档一次、且串行(并发完成时索引是读-改-写,乱序会互相吃掉条目);
|
||||
// ② 条目→本地字节的取源顺序(有本地原图就不该去抓远程);
|
||||
// ③ 节点取图必须读 data.localRef —— 漏了它,远程参考图即使已缓存,插件仍只看到 http 链接,
|
||||
// 标注插件直接判「远程图片不支持标注」(这是 2026-11-24 用户报障的直接成因)。
|
||||
const assert = require('assert')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const vm = require('vm')
|
||||
|
||||
const src = fs.readFileSync(path.resolve(__dirname, '..', 'src', 'gallery-sync.js'), 'utf8')
|
||||
const sandbox = { window: {}, console, Promise, setTimeout, clearTimeout, Object, Array, JSON, Math, String, Number, WeakSet }
|
||||
vm.runInNewContext(src, sandbox)
|
||||
const Sync = sandbox.window.IWBGallerySync
|
||||
|
||||
const checks = []
|
||||
const ok = (name, fn) => checks.push({ name, fn })
|
||||
|
||||
ok('attach 单例可重复取用', () => {
|
||||
const a = Sync.attach({})
|
||||
assert.strictEqual(Sync.get(), a)
|
||||
assert.strictEqual(typeof a.archiveEntryNow, 'function')
|
||||
})
|
||||
|
||||
// ① 串行 + 去重
|
||||
ok('archiveEntryNow:同一 entry 只归档一次(并发重复调用)', async () => {
|
||||
const added = []
|
||||
let chainRunning = 0
|
||||
let maxParallel = 0
|
||||
const s = Sync.create({
|
||||
flatten: (entries) => entries.map((e) => ({ name: e.name })),
|
||||
addOutputs: async (items) => {
|
||||
chainRunning++
|
||||
maxParallel = Math.max(maxParallel, chainRunning)
|
||||
await new Promise((r) => setTimeout(r, 5))
|
||||
chainRunning--
|
||||
added.push(items[0].name)
|
||||
},
|
||||
emit: () => {},
|
||||
})
|
||||
const entry = { name: 'a.png' }
|
||||
await Promise.all([s.archiveEntryNow(entry), s.archiveEntryNow(entry), s.archiveEntryNow(entry)])
|
||||
await s.archiveEntryNow({ name: 'b.png' })
|
||||
assert.deepStrictEqual(added, ['a.png', 'b.png'], '实际 ' + added.join(','))
|
||||
assert.strictEqual(maxParallel, 1, '归档必须串行,实际并行 ' + maxParallel)
|
||||
assert.strictEqual(s.wasArchived(entry), true)
|
||||
})
|
||||
|
||||
ok('archiveEntryNow:归档失败不阻断后续(队列不断链)', async () => {
|
||||
const added = []
|
||||
let n = 0
|
||||
const s = Sync.create({
|
||||
flatten: (e) => e.map((x) => x),
|
||||
addOutputs: async (items) => { n++; if (n === 1) throw new Error('boom'); added.push(items[0].id) },
|
||||
emit: () => {},
|
||||
})
|
||||
await s.archiveEntryNow({ id: 'x' })
|
||||
await s.archiveEntryNow({ id: 'y' })
|
||||
assert.deepStrictEqual(added, ['y'])
|
||||
})
|
||||
|
||||
// ② 取源顺序
|
||||
ok('localCopySrcOf:有 origIdb 时直接用本地原图,不抓远程', async () => {
|
||||
let fetched = 0
|
||||
const s = Sync.create({
|
||||
get: async (k) => (k === 'out_orig_a.png' ? 'data:image/png;base64,AAA' : null),
|
||||
blobFromSrc: async () => { fetched++; return null },
|
||||
})
|
||||
const got = await s.localCopySrcOf({ name: 'a.png', origIdb: 'out_orig_a.png', url: 'https://x/y.png' })
|
||||
assert.strictEqual(got, 'data:image/png;base64,AAA')
|
||||
assert.strictEqual(fetched, 0, '本地已有字节就不该联网')
|
||||
})
|
||||
|
||||
ok('localCopySrcOf:只剩远程时抓一次,抓到即返回 dataURL', async () => {
|
||||
let fetched = 0
|
||||
const s = Sync.create({
|
||||
get: async () => null,
|
||||
blobFromSrc: async () => { fetched++; return { size: 3 } },
|
||||
blobToDataUrl: async () => 'data:image/png;base64,BBBB',
|
||||
})
|
||||
const got = await s.localCopySrcOf({ name: 'r.png', url: 'https://x/y.png' })
|
||||
assert.strictEqual(got, 'data:image/png;base64,BBBB')
|
||||
assert.strictEqual(fetched, 1)
|
||||
})
|
||||
|
||||
ok('localCopySrcOf:有远程原图时不拿 320 缩略图顶替(画质优先)', async () => {
|
||||
const s = Sync.create({
|
||||
get: async () => null,
|
||||
blobFromSrc: async () => ({ size: 9 }),
|
||||
blobToDataUrl: async () => 'data:image/png;base64,FULL',
|
||||
})
|
||||
const got = await s.localCopySrcOf({ name: 'q.png', data: 'data:image/jpeg;base64,THUMB320', url: 'https://x/q.png' })
|
||||
assert.strictEqual(got, 'data:image/png;base64,FULL', '应取远程原图,实际 ' + String(got).slice(0, 30))
|
||||
})
|
||||
|
||||
ok('localCopySrcOf:全抓不到返回空串(调用方退回原链接,不丢图)', async () => {
|
||||
const s = Sync.create({ get: async () => null, blobFromSrc: async () => null })
|
||||
assert.strictEqual(await s.localCopySrcOf({ name: 'z.png', url: 'https://blocked/y.png' }), '')
|
||||
})
|
||||
|
||||
// ③ 节点取图必须认 localRef
|
||||
ok('nodeImageOf:remote 节点已缓存 localRef 时返回本地 dataUrl(不再给 url)', async () => {
|
||||
const s = Sync.create({ refDataUrl: async (v) => (v && v.__blob === 'imgblob_x' ? 'data:image/png;base64,CC' : '') })
|
||||
const node = { id: 'n1', data: { url: 'https://i.ibb.co/a.png', localRef: { __blob: 'imgblob_x' } } }
|
||||
const got = await s.nodeImageOf(node)
|
||||
// 跨 vm realm 的对象原型不同,deepStrictEqual 会因原型不等而红 ⇒ 按结构比
|
||||
assert.strictEqual(JSON.stringify(got), JSON.stringify({ dataUrl: 'data:image/png;base64,CC' }))
|
||||
})
|
||||
|
||||
ok('nodeImageOf:只有远程时按需抓字节并写回 localRef', async () => {
|
||||
let written = null
|
||||
const s = Sync.create({
|
||||
refDataUrl: async () => '',
|
||||
blobFromSrc: async () => ({ size: 1 }),
|
||||
blobToDataUrl: async () => 'data:image/png;base64,DD',
|
||||
})
|
||||
const node = { id: 'n2', data: { url: 'https://i.ibb.co/b.png' } }
|
||||
const got = await s.nodeImageOf(node, { writeRef: async (d) => ({ __blob: 'k' }), onLocalRef: (r) => { written = r } })
|
||||
assert.strictEqual(JSON.stringify(got), JSON.stringify({ dataUrl: 'data:image/png;base64,DD' }))
|
||||
assert.strictEqual(JSON.stringify(written), JSON.stringify({ __blob: 'k' }))
|
||||
})
|
||||
|
||||
ok('nodeImageOf:抓不到时返回 { url }(宁可留链接也不返回空)', async () => {
|
||||
const s = Sync.create({ refDataUrl: async () => '', blobFromSrc: async () => null })
|
||||
const got = await s.nodeImageOf({ id: 'n3', data: { url: 'https://blocked/c.png' } })
|
||||
assert.strictEqual(JSON.stringify(got), JSON.stringify({ url: 'https://blocked/c.png' }))
|
||||
})
|
||||
|
||||
// ④ 插入准备 + 栅格
|
||||
ok('prepareInsert:本地副本走压缩+引用化;抓不到的计入 remoteOnly 并保留原链接', async () => {
|
||||
const s = Sync.create({ get: async (k) => (k === 'o1' ? 'data:image/png;base64,E' : null), blobFromSrc: async () => null })
|
||||
const out = await s.prepareInsert(
|
||||
[{ name: 'a.png', origIdb: 'o1', url: 'https://x/a.png' }, { name: 'b.png', url: 'https://x/b.png' }], '1k',
|
||||
{ refSrcOf: async (v) => v, shrink: async (v) => v + '-1k', writeRef: async (v) => ({ __blob: 'k:' + v }) }
|
||||
)
|
||||
assert.strictEqual(out.items.length, 2)
|
||||
assert.ok(out.items[0].src && out.items[0].src.__blob, '本地副本应被引用化')
|
||||
assert.strictEqual(out.items[1].src, 'https://x/b.png', '抓不到时保留原链接')
|
||||
assert.strictEqual(out.items[1].srcUrl, 'https://x/b.png', '原链接留痕')
|
||||
assert.strictEqual(out.remoteOnly, 1)
|
||||
})
|
||||
|
||||
ok('gridSpots:批量插入不重叠(旧实现全叠在一处)', () => {
|
||||
const s = Sync.create({})
|
||||
const spots = s.gridSpots({ x: 100, y: 200 }, 5, { stepX: 288, stepY: 276 })
|
||||
assert.strictEqual(spots.length, 5)
|
||||
const keys = new Set(spots.map((p) => p.x + ',' + p.y))
|
||||
assert.strictEqual(keys.size, 5, '四个坐标必须互不相同')
|
||||
assert.strictEqual(JSON.stringify(spots[4]), JSON.stringify({ x: 100, y: 200 + 276 }), '第 5 张换行回到第一列')
|
||||
})
|
||||
|
||||
;(async () => {
|
||||
let bad = 0
|
||||
for (const c of checks) {
|
||||
try { await c.fn(); console.log(' ✓ ' + c.name) } catch (e) { bad++; console.log(' ✗ ' + c.name + ' —— ' + ((e && e.message) || e)) }
|
||||
}
|
||||
console.log('gallery-sync checks: ' + (checks.length - bad) + ' 通过 / ' + bad + ' 失败')
|
||||
if (bad) process.exit(1)
|
||||
})()
|
||||
@@ -695,7 +695,7 @@ test('⑬ 连接节点来源行与组合节点一致;中继节点改色只染
|
||||
// ③ 暗色下顶部标签:选中态必须与未选中态有可见差异(用户反馈难区分)
|
||||
const tabs = await page.evaluate(() => {
|
||||
const all = Array.from(document.querySelectorAll('.iwb-tabstrip .iwb-tab'))
|
||||
const act = all.find((t) => t.classList.contains('iwb-tab-active') && !t.classList.contains('iwb-tab-home'))
|
||||
const act = all.find((t) => t.classList.contains('iwb-tab-active'))
|
||||
const inact = all.find((t) => !t.classList.contains('iwb-tab-active'))
|
||||
return { active: act ? getComputedStyle(act).backgroundColor : null, inactive: inact ? getComputedStyle(inact).backgroundColor : null }
|
||||
})
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// 本用例是 flush 路径优化的回归护栏——原实现逐节点深拷贝 data + 二次全量 strip 被换成
|
||||
// copyNodeForPersist + WorkspaceStore.writeStripped 后,对外语义必须一字不变。
|
||||
const { test, expect } = require('./_pw-coverage')
|
||||
const W = require('./_helpers/wait')
|
||||
const baseURL = process.env.IWB_BASE_URL || 'http://127.0.0.1:8787'
|
||||
test.use({ baseURL, viewport: { width: 1440, height: 1000 } })
|
||||
const CFG = { providers: [{ id: 'p-a', name: 'A', baseUrl: 'https://a.example/v1', keys: [{ id: 'a-1', name: 'K', value: 'sk' }], models: [{ name: 'gpt-image-2', visible: true }] }], canvas: { snap: true } }
|
||||
@@ -109,8 +110,7 @@ test('flush 合成所有打开 session:非激活标签的未保存编辑同样
|
||||
await page.waitForTimeout(1200)
|
||||
await openCard(page, '甲') // 打开 甲 → 标签 1
|
||||
await page.waitForTimeout(2000)
|
||||
await page.locator('.iwb-tab-home').click() // 回画布库(甲 仍是打开但未激活的 session)
|
||||
await page.waitForTimeout(400)
|
||||
await W.goHome(page) // 回画布库(甲 仍是打开但未激活的 session)
|
||||
await openCard(page, '乙') // 打开 乙 → 标签 2,成为激活 session
|
||||
await page.waitForTimeout(2600)
|
||||
const wbId = await page.evaluate(() => localStorage.getItem('iwb_ws_active'))
|
||||
|
||||
@@ -48,8 +48,8 @@ test('创建副本保留本次新画连线 + 连续复制副本名唯一', async
|
||||
const persisted = await page.evaluate(() => { const rec = JSON.parse(localStorage.getItem('iwb_ws_w1') || 'null'); return rec ? (rec.edges || []).length : -1 })
|
||||
expect(persisted, '新画的连线应已持久化到 iwb_ws_w1').toBe(1)
|
||||
|
||||
// 回画布库:常驻标签栏最左「首页」图标标签(.iwb-tab-home)
|
||||
await page.locator('.iwb-tab-home').click()
|
||||
// 回画布库:一级导航「首页」(标签条房子按钮 v3.25.62 已删)
|
||||
await W.goHome(page)
|
||||
await expect(cardBy(page, '源画布')).toHaveCount(1)
|
||||
await expect(cardBy(page, '源画布')).toContainText('1 条连线')
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// S14(多标签)离开画布释放语义:打开标签保留 hydrate(切回即用),关闭标签/非打开画布才释放。
|
||||
// 用行为计数器做契约(不依赖 MB 级数据,避免 localStorage 配额干扰)。
|
||||
const { test, expect } = require('./_pw-coverage')
|
||||
const W = require('./_helpers/wait')
|
||||
const baseURL = process.env.IWB_BASE_URL || 'http://127.0.0.1:8787'
|
||||
test.use({ baseURL, viewport: { width: 1440, height: 1000 } })
|
||||
const CFG = { providers: [{ id: 'p-a', name: 'A', baseUrl: 'https://a.example/v1', keys: [{ id: 'a-1', name: 'K', value: 'sk' }], models: [{ name: 'gpt-image-2', visible: true }] }], canvas: { snap: true } }
|
||||
@@ -32,7 +33,7 @@ test('离开画布释放、回到画布重新 hydrate', async ({ page }) => {
|
||||
expect(c0.nodes, '画板应正常打开').toBe(2)
|
||||
|
||||
// S14:回「我的画布」→ 打开标签保留 hydrate(不释放,切回即用不闪黑图)
|
||||
await page.locator('.iwb-tab-home').click() // 标签条「房子」图标
|
||||
await W.goHome(page) // 一级导航「首页」
|
||||
await page.waitForTimeout(600)
|
||||
const c1 = await page.evaluate(() => ({ un: window.__IWB_E2E_UNHYDRATES__ || 0, tabs: JSON.parse(localStorage.getItem('iwb_tabs_open') || '[]') }))
|
||||
expect(c1.tabs, '打开的画布应在标签条里').toContain('w1')
|
||||
|
||||
@@ -318,8 +318,7 @@ test('⑤ 多标签:切走再切回不重新请求(打开标签保留 object
|
||||
const src0 = await img.evaluate((el) => String(el.currentSrc || el.src))
|
||||
const proxyAfter = counters.proxy
|
||||
// 打开第二个画布(Beta)成为第二个标签
|
||||
await page.locator('.iwb-tab-home').click()
|
||||
await W.waitHomeReady(page)
|
||||
await W.goHome(page)
|
||||
await page.locator('.iwb-home-card:not(.iwb-home-new)').filter({ hasText: 'Beta' }).dblclick()
|
||||
await expect(page.locator('.iwb-canvas:not(.iwb-canvas-hidden)')).toBeVisible()
|
||||
await page.waitForTimeout(300)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// ③ 撤销仍然可用:恢复到上一状态,且图片(引用)能被 hydrate 回来 —— 内存修复不能牺牲功能
|
||||
// 运行:npm run build && IWB_BASE_URL=http://127.0.0.1:8787 npx playwright test tests/iwb-memory-history.spec.js
|
||||
const { test, expect } = require('./_pw-coverage')
|
||||
const W = require('./_helpers/wait')
|
||||
|
||||
const baseURL = process.env.IWB_BASE_URL || 'http://127.0.0.1:8787'
|
||||
test.use({ baseURL, viewport: { width: 1440, height: 1000 } })
|
||||
@@ -244,8 +245,7 @@ test('C3:历史 {__idb} 引用装载时迁移为 {__blob}(imgblob_,IDB Blo
|
||||
// 等自动保存把 {__idb} 引用落进 localStorage。用轮询替代固定等待:并发(多 worker)下防抖/落盘时序会漂移,固定 2500ms 偶发不够(引用未落盘 → 切走再回来不会触发迁移)
|
||||
await expect.poll(() => page.evaluate(() => String(localStorage.getItem('iwb_ws_w1') || '').includes('__idb')), { timeout: 15000 }).toBe(true)
|
||||
// 切回画布库再进画布 → 走 hydrate(迁移 __idb → __blob)
|
||||
await page.locator('.iwb-tab-home').click()
|
||||
await page.waitForTimeout(700)
|
||||
await W.goHome(page)
|
||||
await page.locator('.iwb-home-card:not(.iwb-home-new)').first().dblclick()
|
||||
await expect(page.locator('.iwb-canvas:not(.iwb-canvas-hidden)')).toBeVisible()
|
||||
const diag = await page.evaluate(async () => {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
const { test, expect } = require('./_pw-coverage')
|
||||
const W = require('./_helpers/wait')
|
||||
|
||||
const baseURL = process.env.IWB_BASE_URL || 'https://iwb.maqiart.eu.org'
|
||||
// 2026-11-24:默认指向本地测试服(此前默认打线上,等于每次跑都在测已部署版本,本地改动测不到)
|
||||
const baseURL = process.env.IWB_BASE_URL || 'http://127.0.0.1:8787'
|
||||
|
||||
const workspace = {
|
||||
workspaces: [{ id: 'ws_e2e', name: 'E2E 工作台', nodes: [{ id: 'p_e2e', type: 'prompt', x: 120, y: 120, data: { text: 'E2E prompt', title: '' } }], edges: [], groups: [] }],
|
||||
@@ -169,7 +170,7 @@ test('新建并切换工作台后刷新仍保留', async ({ page }) => {
|
||||
await page.reload({ waitUntil: 'domcontentloaded' })
|
||||
// 刷新后恢复在画布编辑器;返回画布库应看到 2 张画布卡片
|
||||
await expect(page.locator('.iwb-canvas:not(.iwb-canvas-hidden)')).toBeVisible()
|
||||
await page.locator('.iwb-tab-home').click()
|
||||
await W.goHome(page)
|
||||
await expect(page.locator('.iwb-home-card')).toHaveCount(2)
|
||||
})
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// 完成时若正浏览该画布则不记提示;切到该画布即清除(会话内内存态)。
|
||||
// 运行:npm run build && IWB_E2E_SPECS=tests/iwb-tab-dot.spec.js npm run test:e2e
|
||||
const { test, expect } = require('./_pw-coverage')
|
||||
const W = require('./_helpers/wait')
|
||||
const baseURL = process.env.IWB_BASE_URL || 'http://127.0.0.1:8787'
|
||||
test.use({ baseURL, viewport: { width: 1440, height: 1000 } })
|
||||
|
||||
@@ -58,7 +59,7 @@ test('生成完成圆点变绿/失败变红,切换画布后清除', async ({ p
|
||||
const release1 = arm('ok')
|
||||
await runGen()
|
||||
await expect.poll(() => reqCount, { timeout: 10000 }).toBe(1)
|
||||
await page.locator('.iwb-tab-home').click() // 回画布库
|
||||
await W.goHome(page) // 回画布库
|
||||
await cardB.dblclick() // 切到画布 B(A 上的生成继续跑)
|
||||
await page.waitForTimeout(300)
|
||||
release1() // 放行 A 的生成请求
|
||||
@@ -73,7 +74,7 @@ test('生成完成圆点变绿/失败变红,切换画布后清除', async ({ p
|
||||
const release2 = arm('fail')
|
||||
await runGen()
|
||||
await expect.poll(() => reqCount, { timeout: 10000 }).toBe(2)
|
||||
await page.locator('.iwb-tab-home').click()
|
||||
await W.goHome(page)
|
||||
await cardB.dblclick()
|
||||
release2()
|
||||
await expect(tabA.locator('.iwb-tab-dot-err'), '生成失败后 A 标签应出现红色圆点').toBeVisible({ timeout: 15000 })
|
||||
|
||||
@@ -101,8 +101,7 @@ test('1. 回画布库不释放打开标签:画板不降级、objectURL 不回
|
||||
const base = await counters(page) // 冷启动本身会产生一些回收(卸载/重建),后面一律比增量
|
||||
|
||||
// 单个打开标签先回一次首页:这是"打开标签保留"的最小情形
|
||||
await page.locator('.iwb-tab-home').click()
|
||||
await W.waitHomeReady(page)
|
||||
await W.goHome(page)
|
||||
const c1 = await counters(page)
|
||||
expect(c1.tabs, '回首页不该把标签弄丢').toContain('w1')
|
||||
expect(c1.un, '打开标签的画板回首页不降级(S14:切回即用)').toBe(base.un)
|
||||
@@ -113,8 +112,7 @@ test('1. 回画布库不释放打开标签:画板不降级、objectURL 不回
|
||||
await W.waitCanvasOpen(page)
|
||||
await expect(tabBy(page, 'Alpha')).toHaveCount(1)
|
||||
await expect(tabBy(page, 'Beta')).toHaveCount(1)
|
||||
await page.locator('.iwb-tab-home').click()
|
||||
await W.waitHomeReady(page)
|
||||
await W.goHome(page)
|
||||
const c2 = await counters(page)
|
||||
expect(c2.tabs.sort()).toEqual(['w1', 'w2'])
|
||||
expect(c2.un, '两个标签都打开时回首页仍不降级').toBe(c1.un)
|
||||
@@ -166,7 +164,7 @@ test('2. 关闭有未保存修改的标签:取消则不动,确认则先保
|
||||
await tabBy(page, 'Alpha').hover()
|
||||
await tabBy(page, 'Alpha').locator('.iwb-tab-close').click()
|
||||
await expect(tabBy(page, 'Alpha'), '确认后标签应消失').toHaveCount(0)
|
||||
await expect(page.locator('.iwb-tab-home')).toHaveClass(/iwb-tab-active/) // 没有剩余标签 → 回首页
|
||||
await W.expectHomeActive(page) // 没有剩余标签 → 回首页(标签条房子按钮已删,改判一级导航「首页」active)
|
||||
await W.poll(page, async () => (await counters(page)).un, { timeout: 8000 }).toBe(before.un + 1)
|
||||
const afterClose = await counters(page)
|
||||
expect(afterClose.tabs, 'iwb_tabs_open 不该还留着已关闭的画布').not.toContain('w1')
|
||||
@@ -188,8 +186,7 @@ test('3. 彻底删除仍开着标签的画布:标签消失、session 释放、
|
||||
await W.waitCanvasOpen(page)
|
||||
await hydrateBigImage(page)
|
||||
const before = await counters(page)
|
||||
await page.locator('.iwb-tab-home').click()
|
||||
await W.waitHomeReady(page)
|
||||
await W.goHome(page)
|
||||
|
||||
let mode = 'accept'
|
||||
page.on('dialog', async (d) => { if (mode === 'accept') await d.accept(); else await d.dismiss() })
|
||||
|
||||
@@ -51,7 +51,9 @@ assert.ok(!css.includes('.iwb-rail-tab'), 'v3.27.1:右竖栏页签已删除(
|
||||
// 迁到 token 后这种断言会红,但它真正要保护的是「卡片标题用 lg 档」这个层级关系。
|
||||
assert.ok(/\.iwb-home-card-title strong \{[^}]*font-size: var\(--iwb-font-lg\)/.test(css), 'v3.26.46:卡片标题应为 font-lg 档')
|
||||
// v3.1.0 首页灰色系:蓝 accent 清零(激活项/胶囊/chip/星标全走墨色或灰阶)
|
||||
assert.ok(/\.iwb-tab-home\.iwb-tab-active \{[^}]*background: transparent/.test(css)) // 首页按钮无选中底色
|
||||
// 2026-11-24:标签条「首页」按钮 v3.25.62 已删(选择器无生产者),钉点改钉一级导航激活项 ——
|
||||
// 语义不变:激活项不用品牌色填充,走「墨色底 + 反白字」。
|
||||
assert.ok(/\.iwb-nav-item\.on \{[^}]*background: var\(--iwb-text\)/.test(css), '一级导航激活项应为墨色底')
|
||||
assert.ok(/\.iwb-home-card \{[^}]*background: var\(--iwb-bg-menu\)/.test(css)) // v3.26.44:卡片改用浮起层(亮=面板色,暗=比面板亮一档)
|
||||
assert.ok(!source.includes('iwb-home-card-active')) // 无「默认必有一个选中卡」的伪选中态
|
||||
assert.ok(!/\.iwb-home-card-cat \{[^}]*iwb-brand/.test(css))
|
||||
|
||||
@@ -91,5 +91,35 @@ function memBackend () {
|
||||
await PD.restoreAll([{ id: 'restored-x', data: { ok: true } }])
|
||||
eq(await PD.create('restored-x').read(), { ok: true }, 'restoreAll 应写回数据')
|
||||
|
||||
console.log('plugin-data checks passed(串行队列 / 上限 / 迁移 / 备份)')
|
||||
// ---- 插件文件(v3.26.59 / P0):备份必须带上 plugin-data/<id>/files/ 的字节 ----
|
||||
// 动机:只备份 JSON 时,提示词封面这类图片文件换机后全丢,用户看到「已恢复」却是灰块。
|
||||
// 这里用内存假 FS 跑行为断言(不依赖 Tauri),覆盖「清单 / 读字节 / 写回」三条路。
|
||||
const fakeFiles = { promptlib: { 'cabc.jpg': Buffer.from('JPEGDATA', 'utf8') }, 'other-plugin': { 'cxyz.webp': Buffer.from([1, 2, 3]) } }
|
||||
const putLog = []
|
||||
sandbox.IWBStorageFile = {
|
||||
pluginFiles: {
|
||||
listAll: async () => Object.keys(fakeFiles).map((id) => ({ id, files: Object.keys(fakeFiles[id]).map((name) => ({ name, size: fakeFiles[id][name].length })) })),
|
||||
readBytes: async (id, name) => (fakeFiles[id] && fakeFiles[id][name]) || null,
|
||||
put: async (id, name, data) => { putLog.push({ id, name, data }); return { ok: true } },
|
||||
},
|
||||
}
|
||||
const files = await PD.listFiles()
|
||||
assert.strictEqual(files.length, 2, 'listFiles 应枚举所有插件的插件文件')
|
||||
assert.strictEqual(JSON.stringify(files.map((f) => f.id + '/' + f.name).sort()), '["other-plugin/cxyz.webp","promptlib/cabc.jpg"]', 'listFiles 的 id/name 必须成对正确')
|
||||
assert.strictEqual(files.find((f) => f.name === 'cabc.jpg').size, 8, 'listFiles 应带 size(体积预估用)')
|
||||
const bytes = await PD.readFile('promptlib', 'cabc.jpg')
|
||||
assert.ok(bytes && Buffer.from(bytes).toString('utf8') === 'JPEGDATA', 'readFile 应返回原始字节')
|
||||
assert.strictEqual(await PD.readFile('promptlib', 'missing.jpg'), null, '不存在的文件返回 null(不抛)')
|
||||
|
||||
const n = await PD.restoreFiles([
|
||||
{ id: 'promptlib', name: 'cabc.jpg', data: 'data:image/jpeg;base64,QUJD' },
|
||||
{ id: '', name: 'bad.jpg', data: 'x' },
|
||||
{ id: 'promptlib', name: 'nofile.jpg' },
|
||||
])
|
||||
assert.strictEqual(n, 1, 'restoreFiles 只写合法条目(缺 id/name/data 的跳过)')
|
||||
assert.strictEqual(putLog.length, 1, 'restoreFiles 不应多写')
|
||||
assert.strictEqual(putLog[0].id, 'promptlib', 'restoreFiles 应带插件 id')
|
||||
assert.ok(putLog[0].data.indexOf('data:image/jpeg;base64,') === 0, 'restoreFiles 应把 dataURL 交给 pluginFiles.put')
|
||||
|
||||
console.log('plugin-data checks passed(串行队列 / 上限 / 迁移 / 备份 / 插件文件)')
|
||||
})().catch((e) => { console.error(e); process.exit(1) })
|
||||
@@ -110,7 +110,9 @@ async function boot ({ items, thumb, clock }) {
|
||||
assert.strictEqual(env.window.getComputedStyle(tools).display, 'flex', '工具组应为横排 flex(否则图标会竖排)')
|
||||
assert.ok(tools, '底栏应有右侧工具组')
|
||||
const footBtns = Array.from(tools.querySelectorAll('button'))
|
||||
assert.strictEqual(footBtns.length, 2, '工具组应为刷新+设置两个图标,实际 ' + footBtns.length)
|
||||
// 2026-11-24:工具组多了「打开本地目录」图标(文件夹,仅桌面端可见)⇒ 顺序固定为 刷新 / 打开目录 / 设置
|
||||
assert.strictEqual(footBtns.length, 3, '工具组应为刷新 + 打开目录 + 设置三个图标,实际 ' + footBtns.length)
|
||||
assert.strictEqual(footBtns[2].getAttribute('aria-label'), '设置', '设置必须是最右边的图标(打开目录在它左边)')
|
||||
const btn = footBtns.find((b) => b.getAttribute('aria-label') === '刷新')
|
||||
assert.ok(btn, '底部应有刷新按钮(aria-label=刷新)')
|
||||
// 刷新不能再留在左侧信息区(否则空间不足会向右压住设置)
|
||||
|
||||
@@ -85,7 +85,7 @@ const wait = (ms) => new Promise((r) => setTimeout(r, ms))
|
||||
const search = host.querySelector('input.iwb-input')
|
||||
search.value = '收藏'
|
||||
search.dispatchEvent(new window.Event('input', { bubbles: true }))
|
||||
await wait(40)
|
||||
await wait(200) // v1.12.2:搜索重排改为 120ms 防抖(打字不再逐键全量重建,中文输入法组合态才不被打断)
|
||||
assert.ok(host.querySelector('.iwb-lib-searchscope'), '搜索时应显示「在全部中搜索」范围提示')
|
||||
assert.ok(cards().length >= 1, '搜索应跨分组命中(实际 ' + cards().length + ')')
|
||||
const active = host.querySelector('.iwb-chip-active')
|
||||
|
||||
@@ -149,7 +149,15 @@ 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 = 9095 // 2026-11-21 v3.26.18:小地图避让 install 调用(逻辑在 src/ui-minimap-fit.js)
|
||||
// 2026-11-24(v3.26.61):9095 → **9114**。两笔:
|
||||
// ① 图库/生成/画布三者的同步动作(单张归档串行队列、通知插件重拉、条目→本地字节、插入栅格、
|
||||
// 节点取图、格子缩略图取源)全部落到新模块 src/gallery-sync.js(约 200 行),app.js 只剩
|
||||
// `attach(...)` 装配 + commit 分发,净增 13 行 —— 这 13 行闭包组件内 refs/setSel/commitCanvas/
|
||||
// updateNode,是「装配」本身,无法外移;新增模块后占比棘轮(app.js ≤ 40%)反而下降。
|
||||
// ② 纠正过时的存储口径注释(用户要求:旧的不准确描述要改掉):图库/缩略图/原图档在桌面端是
|
||||
// images/thumbs、images/gallery 文件,不是 IndexedDB;「1K 插入档降的是长边像素不是体积」。
|
||||
// 共 6 行注释,属于事实纠错而非功能代码。
|
||||
const MAX_APP_JS_LINES = 9105 // 2026-11-24 v3.26.63:收敛确认包装(7 份 → 1 份)+ 剪贴板 5 处改走门面,实测 9104 → 上限 9105
|
||||
const MAX_APP_JS_SHARE = 0.40
|
||||
|
||||
// ── 历史记账(供回溯,逐条保留)──────────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user