Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5fc09c2382 | ||
|
|
2b8e337db8 | ||
|
|
9225a76895 | ||
|
|
01c922d7e4 | ||
|
|
aa05efe536 | ||
|
|
7c0896ed97 | ||
|
|
fcb429772e | ||
|
|
03f74629a4 | ||
|
|
de1a38e211 | ||
|
|
983eb511b4 | ||
|
|
3abe96d389 | ||
|
|
8c87ae2743 | ||
|
|
5ca6cda7a5 | ||
|
|
edc0b1f916 | ||
|
|
9a011dc825 | ||
|
|
f1462a5862 | ||
|
|
cd7d478782 | ||
|
|
071f7f44d6 | ||
|
|
980481a897 | ||
|
|
e017f8733f | ||
|
|
b28cc2d183 | ||
|
|
d7fdae8877 | ||
|
|
bc77f007a0 | ||
|
|
d2bef9f348 | ||
|
|
06d2a8bc5b | ||
|
|
d9e3d84c0c | ||
|
|
af3a9cdf8f | ||
|
|
92a8b6af0d | ||
|
|
f6c66fcd89 | ||
|
|
262bcc037b | ||
|
|
2cc5126f70 | ||
|
|
5d68e0249a | ||
|
|
bb0b3f3e8f | ||
|
|
204f9103aa | ||
|
|
8e40ba2870 | ||
|
|
d45065101b | ||
|
|
702fbf5132 | ||
|
|
8944f2a78f | ||
|
|
7335f59288 | ||
|
|
16109a39f4 | ||
|
|
b25ba45872 | ||
|
|
b8f5d4d8eb | ||
|
|
fb69d17615 | ||
|
|
98f7f8e6d4 | ||
|
|
0e80c55adf | ||
|
|
dd58e4a7b5 | ||
|
|
e9435a5cfe | ||
|
|
054aec958e | ||
|
|
96c786e8ca | ||
|
|
3792081ddd | ||
|
|
b1e3fea494 | ||
|
|
81c520fe52 | ||
|
|
1277a4398a | ||
|
|
a0a696a2e6 | ||
|
|
5e2f9dd876 | ||
|
|
9739764d2f | ||
|
|
3483cc4174 | ||
|
|
61dbd0abe8 | ||
|
|
95ccb8ec29 | ||
|
|
843291cd66 | ||
|
|
e2b7c9919a | ||
|
|
de85aff6df | ||
|
|
10d97e74d8 | ||
|
|
cce51e6ccd | ||
|
|
3565b5aec2 | ||
|
|
a4550d5654 | ||
|
|
76115bcce8 | ||
|
|
ea219d92c4 | ||
|
|
84df19fb59 | ||
|
|
af1070ec78 | ||
|
|
f2be2a7a9f | ||
|
|
b597ee4d69 | ||
|
|
e60c2798db | ||
|
|
0bd85f24cc | ||
|
|
7700a4a26a | ||
|
|
a40c038785 | ||
|
|
64d40b7ac6 | ||
|
|
c9c07e340c | ||
|
|
3b304b3e3c | ||
|
|
8e19e7322f | ||
|
|
61597deb2b | ||
|
|
35c8e725c4 | ||
|
|
3cb25875b3 | ||
|
|
404aa08cc6 | ||
|
|
4bdf6d0313 | ||
|
|
0c11b45af5 | ||
|
|
3e28796a15 | ||
|
|
39f123c5f3 | ||
|
|
636582bba6 | ||
|
|
5ccc6c879e | ||
|
|
a46d874d33 | ||
|
|
c9b8bdf27c | ||
|
|
be982e4027 | ||
|
|
412b907126 | ||
|
|
0489d94461 | ||
|
|
d6271cde14 | ||
|
|
eda67df9bf | ||
|
|
f55f9403f5 | ||
|
|
23df59188e | ||
|
|
e5d0b5171b | ||
|
|
fca7b856d4 | ||
|
|
df3de3ce91 | ||
|
|
b3cbfe82f8 | ||
|
|
4b70e4029f | ||
|
|
5830dda6ad | ||
|
|
83d42969f0 | ||
|
|
ef7cdf424f | ||
|
|
9d6cda9cf4 | ||
|
|
7a2199c09f | ||
|
|
2f6047d9eb | ||
|
|
77170a987a | ||
|
|
d4fde0dbb5 | ||
|
|
2e4a7aa720 | ||
|
|
ebb8467590 | ||
|
|
67b3a6c557 | ||
|
|
b6865fb703 | ||
|
|
c3bf8357b0 | ||
|
|
b801198d36 | ||
|
|
b3bf16f52e | ||
|
|
6b3ba48d08 | ||
|
|
0e69ead075 | ||
|
|
dd38d7b663 | ||
|
|
72f0bb2aec | ||
|
|
dd498a1cf7 | ||
|
|
49a91991be | ||
|
|
e827f47d04 | ||
|
|
9847373964 | ||
|
|
178cda830a | ||
|
|
38ec7465bf | ||
|
|
1ddf89d2c3 | ||
|
|
4491b71abf | ||
|
|
b1d8f4e080 | ||
|
|
540eed04cc | ||
|
|
96e8cc2d7d | ||
|
|
2082ced720 | ||
|
|
2c94401d45 | ||
|
|
93deea4f5e | ||
|
|
f35ecb1790 | ||
|
|
6435d9e4c3 | ||
|
|
0d42ebb9ae | ||
|
|
a26fb2d64d | ||
|
|
1d0b6d2168 | ||
|
|
202f7b81de | ||
|
|
d16f3434dd | ||
|
|
9c0d3b1221 | ||
|
|
5f8f4d229f | ||
|
|
a3edc81f55 | ||
|
|
774b980f69 | ||
|
|
a993d44f4e | ||
|
|
a8a416fa7a | ||
|
|
9db4c15e7a | ||
|
|
2fb0a6941f | ||
|
|
0b20c5597c | ||
|
|
9f69f73443 | ||
|
|
f8635d4e19 | ||
|
|
8aac499e11 | ||
|
|
6ee5a37d68 | ||
|
|
1342613ab9 | ||
|
|
754c0a39da | ||
|
|
97ed57714a | ||
|
|
036b2926ed | ||
|
|
0439e8b743 | ||
|
|
ad4c177e55 | ||
|
|
22f4d7adb0 | ||
|
|
ad1bb6016e | ||
|
|
8dc01708dc | ||
|
|
f4e4ca5649 | ||
|
|
35ac37fb45 | ||
|
|
2a1fa03132 | ||
|
|
78519b56d8 | ||
|
|
19c95ef6b1 | ||
|
|
bbb763c2cf | ||
|
|
611cd8f1b9 | ||
|
|
73a7126e30 | ||
|
|
34269f9770 | ||
|
|
7a4204d0a9 | ||
|
|
2860faacbb | ||
|
|
f02b3dcec2 | ||
|
|
f6d104fd95 | ||
|
|
94680fd127 | ||
|
|
b37a1ffe78 | ||
|
|
17fbbd284d | ||
|
|
fb3a3f3623 | ||
|
|
7e544b9e10 | ||
|
|
e79095e848 | ||
|
|
0baeda2abd | ||
|
|
1b1bcbb2cd | ||
|
|
e7de1ab415 | ||
|
|
675239f6d1 | ||
|
|
efb885ef91 | ||
|
|
7b2f07bdad | ||
|
|
6db5a143a8 | ||
|
|
c2c208f5ce | ||
|
|
411a7c9572 | ||
|
|
1738027da6 | ||
|
|
99496a530e | ||
|
|
318a7a2980 | ||
|
|
440c4d6590 | ||
|
|
f8ecb2cfba | ||
|
|
999dbf7fd9 | ||
|
|
b955812658 | ||
|
|
bd138b7a7e | ||
|
|
1d308377a5 | ||
|
|
cc9b4d8a09 | ||
|
|
72043e4df4 | ||
|
|
d8153f24d2 | ||
|
|
23f82dc728 | ||
|
|
a4aaa547a7 | ||
|
|
f02f18863a | ||
|
|
1ddfa7f601 | ||
|
|
03c79bf5e8 | ||
|
|
59a90325a3 | ||
|
|
393d83550c | ||
|
|
fb654844bf | ||
|
|
c7dd2c3763 | ||
|
|
d5449e8b71 | ||
|
|
5c378c3d73 | ||
|
|
163e62f5a3 | ||
|
|
9d92059aac | ||
|
|
9ad6f7230f | ||
|
|
2e5ac0d144 | ||
|
|
744d109da3 | ||
|
|
e8d782b4da | ||
|
|
2594623c09 | ||
|
|
502b85d8b1 | ||
|
|
9b9ad5cc37 | ||
|
|
210d6c5290 | ||
|
|
4d1d05aaa0 | ||
|
|
03347ef7e4 | ||
|
|
a21a73b370 | ||
|
|
fb8d13bf5c | ||
|
|
94820d4d7f | ||
|
|
e4bd818e15 | ||
|
|
ac6e59982c | ||
|
|
e08fdb6271 | ||
|
|
56e64decd3 | ||
|
|
d98580065f | ||
|
|
496e4b8562 | ||
|
|
3211beb706 | ||
|
|
f6e4441504 | ||
|
|
f69b7e5a85 | ||
|
|
14fb0f489a | ||
|
|
7b1164febb | ||
|
|
07d1715993 | ||
|
|
7ed3ba6738 | ||
|
|
8dbc0c0603 | ||
|
|
8fe29f21c4 | ||
|
|
64d42d1a56 | ||
|
|
de5c175c5e | ||
|
|
7b34a1c0f6 | ||
|
|
cbafd38780 | ||
|
|
db066f8769 | ||
|
|
540da6deba | ||
|
|
1d44e04d96 | ||
|
|
6d66b260e0 | ||
|
|
3cfe9cb128 | ||
|
|
9425c74b2f | ||
|
|
d42752c0f4 | ||
|
|
6e7c22123d | ||
|
|
640591fda3 | ||
|
|
fe34a881fa |
No files matched your search
@@ -22,3 +22,7 @@ release/
|
||||
|
||||
# 插件市场产物(由 scripts/gen-market.js 生成,发布时 scp 上传)
|
||||
market/
|
||||
|
||||
# 临时截图/调试产物(不入库)
|
||||
_*.png
|
||||
_tray-preview/
|
||||
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 151 KiB |
|
After Width: | Height: | Size: 152 KiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 242 KiB |
|
After Width: | Height: | Size: 119 KiB |
|
After Width: | Height: | Size: 702 KiB |
|
After Width: | Height: | Size: 748 KiB |
|
After Width: | Height: | Size: 566 KiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 286 KiB |
|
After Width: | Height: | Size: 116 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 307 KiB |
|
After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 155 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 141 KiB |
|
After Width: | Height: | Size: 2.4 MiB |
|
After Width: | Height: | Size: 174 KiB |
|
After Width: | Height: | Size: 393 KiB |
|
After Width: | Height: | Size: 185 KiB |
|
After Width: | Height: | Size: 247 KiB |
|
After Width: | Height: | Size: 316 KiB |
|
After Width: | Height: | Size: 863 KiB |
|
After Width: | Height: | Size: 32 KiB |
@@ -14,6 +14,941 @@
|
||||
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
|
||||
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
|
||||
|
||||
## v3.26.41(2026-11-23)继承态提示词把文案与参考图交给组合/连接节点
|
||||
|
||||
- 修「提示词接风格库变量节点后,组合节点读不到文案、也不往下带参考图」(出图一直正常,所以表现为「能出图、组合是空的」)。
|
||||
- 根因:来源判定只看节点自身 `data.text`,提示词处于「继承 · 来自 上一级」时自己没存字,被当成无文本来源整路丢弃 —— 组合取行、组合写入 `combined`、组合→文本/分层节点的图片汇总同时失效。
|
||||
- 修复只动来源判定层(`batchSrcText` / `isBatchSrc` 支持 `(edges, nodes)`),自身无文案时按节点体显示的同一套顺序取上游第一条(提示词不拼合多路);组合节点的拼接、分隔符、附加文案、排序逻辑零改动。
|
||||
- 连接(batch)节点同步修好:继承态提示词现在能进来源列表、生成输出端口、推送正确文案。
|
||||
- 穿透范围限定为提示词/文本/中继/连接,组合、LLM、插件节点不越过;上游停用不参与;环不死循环。
|
||||
|
||||
## v3.26.40(2026-11-23)Windows:修复 PowerShell 弹窗
|
||||
|
||||
- Windows 状态栏内存探测改用 CREATE_NO_WINDOW 启动 PowerShell,不再每 4 秒弹出控制台窗口。
|
||||
- macOS 行为不变(Unix 分支仍用 ps)。
|
||||
|
||||
## v3.26.39(2026-11-22)修正插件插入落点与封面插入
|
||||
|
||||
- promptlib 1.6.18:拖拽落点按节点宽高居中到鼠标;详情「插入模板节点/插入画布/插入图片」落到画布可视中心;拖拽期间禁用文本选择。
|
||||
- 宿主:新增 CanvasGeometry.promptCenterSpot,提示词/封面插入不再被左侧面板遮挡。
|
||||
- 修复详情「插入图片」:封面文件先解析为 dataURL 再插入。
|
||||
|
||||
## v3.26.38(2026-11-22)插件节点交互修复 + 标注覆盖保留原图
|
||||
|
||||
### 提示词库(promptlib 1.6.16)
|
||||
- 拖拽改为指针拖拽(对齐风格库):不再用原生 HTML5 DnD,修掉“拖入后第一次点不动/选中文本、需先点空白”的顽疾。
|
||||
- 拖拽跟手幽灵卡片(封面 + 名称 + 模板/文本节点提示)。
|
||||
- 节点创建走 canvasWrite.createNode + canvas.screenToWorld,落地即选中、可直接拖动。
|
||||
- 双击卡片查看详情;详情 → 编辑 → 保存回到详情。
|
||||
- 封面卡高度恢复;悬停缩放改内层背景层(不再闪烁);封面不拦截指针。
|
||||
- 未选中时模板变量输入框不拦截指针;只读正文不拦截指针(单击=选中节点,双击=编辑)。
|
||||
|
||||
### 宿主
|
||||
- canvasWrite.setNodeImage 覆盖前备份原图到 data.orig;节点右键新增「还原替换前原图」。
|
||||
- 新增 docs/standards/plugin-node-drag.md:插件节点拖入/能力/指针交互踩坑记录。
|
||||
|
||||
### 已知问题
|
||||
- 标注插件「覆盖」后原图需通过右键「还原替换前原图」找回;若旧节点在本次更新前已被覆盖,无备份。
|
||||
|
||||
## v3.26.37(2026-11-22)提示词库 1.6.6:变量 / 模板节点 / 备份 / 设置内嵌
|
||||
|
||||
### 提示词库(promptlib 1.6.6)
|
||||
- 变量:`{变量}` 自动检测、编辑器可改标签/默认值/说明、实时预览;正文上方「+ 插入变量」按光标插入并选中变量名。
|
||||
- 模板节点:封面缩略图 + 变量行 + 未填提示 + 「封面作参考图」开关;拖拽卡片按是否有变量自动分流(模板节点 / 文本节点)。
|
||||
- 设置内嵌到「设置 → 插件 → 提示词库」:分组管理(改名/排序/删除)、数据备份(导出/导入 JSON)、数据位置。
|
||||
- 封面文件化:封面从 JSON 内联迁移到 `plugin-data/promptlib/files/`(262KB → 约 15KB)。
|
||||
- 插件 CSS 自包含:宿主基础样式按作用域复制进插件,宿主改全局样式不再覆盖插件。
|
||||
|
||||
### 客户端
|
||||
- 修复 `pluginFilePut` 解包 dataURL 时取错字段(封面转文件一直失败)。
|
||||
- 新增 `open_data_subpath` 命令(仅允许打开资料目录下的子路径)。
|
||||
|
||||
## v3.26.36(2026-11-22)插件文件能力(为提示词插件自持数据铺路)
|
||||
|
||||
### 新增
|
||||
- `files` 能力:`plugin-data/<id>/files/` 沙箱,单文件 8MB / 总量 64MB,文件名白名单 + 原子写;策略独立成 `src/plugin-files-policy.js` 并有单测。
|
||||
- zip 打包/解包模块 `src/plugin-archive.js`(路径白名单、解压上限、重名拒绝),含行为测试。
|
||||
|
||||
### 说明
|
||||
- 仅新增能力,不改现有插件行为;提示词插件 1.5.0 将用它把数据迁到插件目录。
|
||||
|
||||
## v3.26.35(2026-11-22)发版脚本自动对齐文档锚点
|
||||
|
||||
### 工程
|
||||
- 新增 `scripts/set-doc-anchor.js`:把 `main = <sha>` 与 `线上 vX.Y.Z+<sha>` 写成「最近一次 bump 版本的提交」。
|
||||
- `publish-update.sh` 收尾自动执行:写锚点 → `sync-facts` → 本地提交(推送仍随版本)。以后不再需要手工改两次锚点。
|
||||
- 安全护栏:HEAD 里的版本号与本地不一致(即 bump 未提交)时**跳过**并提示,避免写错提交。
|
||||
|
||||
## v3.26.34(2026-11-22)缩略图瘦身 + app.js 减负 + 两条守护测试
|
||||
|
||||
### 性能/磁盘
|
||||
- 显示缩略图参数:768px / WebP 0.86 → **640px / 0.72**(原来单张 500~900KB,49 张 24MB)。
|
||||
- 一次性清理旧的 `*_768.*` 缩略图(缓存可再生,只删带 `_768` 后缀的,保留图库缩略图)。
|
||||
|
||||
### 结构
|
||||
- 封面编码/解析/比例定宽抽到 `src/image-prompt-cover.js`(app.js 9094 → 9067 行,恢复约 28 行余量)。
|
||||
|
||||
### 测试
|
||||
- 新增 `image-prompt-cover-test`(WebP 优先 / JPEG 兜底 / PNG 回退取小 / 原图兜底 / 直出与引用 / 比例定宽)。
|
||||
- 新增 `theme-plugin-tokens-test`(亮暗派生、暗色更暗、中性灰、层次)。
|
||||
|
||||
## v3.26.33(2026-11-22)切换面板后浏览器画面滞留约 1 秒
|
||||
|
||||
### 根因
|
||||
- 面板里的原生 webview 锚点随插件卸载从 DOM 消失后,宿主只是**排了 900ms 宽限期的 close**,没有先隐藏;原生层永远在最上层,于是旧网页盖住新面板约 1 秒。
|
||||
|
||||
### 修复
|
||||
- `detach()` 在排 close 之前**立即 park**(visible=false)。宽限期保留,用于节点体短暂重建(LOD/React 重建)时不重载网页。
|
||||
|
||||
## v3.26.32(2026-11-22)CSS 合并(T2 第四批:顶层 chrome)
|
||||
|
||||
### 合并
|
||||
- `.iwb-canvas-topbar`:7 条基础规则 → **1 条**(保留 `left/right/background/border-bottom` 的 `!important` 与 `pointer-events:none`)。
|
||||
- `.iwb-home-grid`:4 条 → **1 条**(最终列宽 230px)。
|
||||
- 等价性校验:5623 条生效声明 0 差异;括号平衡。
|
||||
|
||||
### 测试
|
||||
- `page-chrome-regression` 两处源码钉改成正则:不再依赖旧值(300px 列宽、字面空格)。
|
||||
|
||||
## v3.26.31(2026-11-22)CSS 合并(T2 第三批)
|
||||
|
||||
### 合并
|
||||
- `.iwb-home-card-meta` 6 条 → 1。
|
||||
- `.iwb-home-card-foot` 4 条 → 1。
|
||||
- `.iwb-home-card-actions` 4 条 → 1。
|
||||
- `.iwb-mk-row` 2 条 → 1;`.iwb-mk-tag` 2 条 → 1。
|
||||
- 等价性校验:5623 条生效声明,0 差异;括号平衡。
|
||||
|
||||
## v3.26.30(2026-11-22)CSS 合并(T2 第二批)
|
||||
|
||||
### 合并
|
||||
- `.iwb-home-card`:8 条 → **1 条**。
|
||||
- `.iwb-top-nav-icon`:3 条 → **1 条**。
|
||||
- `.iwb-mk-chip`:3 条 → **1 条**。
|
||||
- 这三个选择器的状态变体(`:hover`、`.on`、`:first-of-type`)特异性更高,合并位置不影响层叠。
|
||||
- 等价性校验:5623 条生效声明,0 处差异;括号平衡。
|
||||
|
||||
### 累计
|
||||
- 行数 2504 → 约 2370;重复(选择器,上下文)组合 174 → **145**;死声明 367 → **107**。
|
||||
|
||||
## v3.26.29(2026-11-22)CSS 合并(T2):.iwb-mk-card 与 .iwb-minimap
|
||||
|
||||
### 合并
|
||||
- `.iwb-mk-card`:4 条基础规则 → **1 条**(保留最终生效的全部声明)。
|
||||
- `.iwb-minimap`:2 条(基础 + 停靠栏避让)→ **1 条**。
|
||||
- 这两个选择器的状态/变体(`:hover`、`.is-installed`、`.iwb-overlay.drawer-open .iwb-minimap`)特异性更高,位置不影响层叠。
|
||||
- 等价性校验:清理前后生效声明集合一致(5623 条,0 处差异)。
|
||||
|
||||
## v3.26.28(2026-11-22)CSS 去重(T1):删除死声明 + 修一处游离括号
|
||||
|
||||
### 清理
|
||||
- 按「选择器 + 媒体上下文」解析 style.css:删除 **242 条已被后续同选择器覆盖的死声明**(逐条校验:后者非 !important 才删;同一规则多选择器时要求每个选择器都被覆盖才删)。
|
||||
- 修复一处**游离 `}`** 与它的孤立声明块(`.iwb-picklist` 已无任何 JS 引用,属历史残留)。
|
||||
- 等价性校验:清理前后「生效声明集合」完全一致(5630 条,0 处值差异)。
|
||||
|
||||
### 结果
|
||||
- style.css 2504 → 2431 行(-73);删除死声明 **242 条**、空规则 **58 条**、游离声明块 1 处。
|
||||
- 等价性校验:清理前后生效声明集合完全一致(0 处值差异);仅把 `interface-hierarchy` 测试里“钉住已死文本”的断言改为钉住最终生效的 0 偏移。
|
||||
|
||||
## v3.26.27(2026-11-22)插件市场交互回退为「只变色」
|
||||
|
||||
### 交互
|
||||
- 卡片、标签、管理页行**取消上浮/阴影**,只保留背景与描边颜色变化。
|
||||
- 卡片上的「移除/安装」按钮加**浅灰底**,不再只有文字;悬停略深、按下更深(安装仍是深色主按钮)。
|
||||
- 管理页改回**横线分隔**行,悬停只轻微变色。
|
||||
|
||||
## v3.26.26(2026-11-22)插件市场补回悬停浮动触感
|
||||
|
||||
### 交互
|
||||
- 卡片悬停上浮 3px(按下回落 1px),带阴影过渡。
|
||||
- 操作按钮悬停上浮 1px + 投影;主按钮(安装)阴影更深;按下回到原位。
|
||||
- 标签胶囊、管理页行也补了相同的轻浮动反馈。
|
||||
|
||||
## v3.26.25(2026-11-22)插件市场二次优化:全宽自适应 + 淡描边 + 已安装徽标
|
||||
|
||||
### 版式
|
||||
- 去掉页面 1180px 限宽,卡片网格随窗口自适应(多出空间就多排卡片)。
|
||||
- 卡片恢复**很淡的描边**(55% 边框色)+ 轻投影,悬停加深;不再是纯色块。
|
||||
- 已安装不再用绿色底,改为名字后的 **「已安装」小徽标**(淡绿描边胶囊);绿点方案取消。
|
||||
- 管理页列表改为块面行(圆角浅底、间距 8px),操作列仍右对齐。
|
||||
|
||||
## v3.26.24(2026-11-22)插件市场版式重设计
|
||||
|
||||
### 版式
|
||||
- 顶部合并为一块「工具条」(搜索 + 标签)浅底块面,去掉逐行线框。
|
||||
- 卡片:无描边,改浅色块面;悬停提亮;已安装卡片带极淡的成功色底。
|
||||
- 页脚一行:左侧标签、右侧操作按钮;安装=深色主按钮,移除=无边框浅底按钮。
|
||||
|
||||
### 交互收敛
|
||||
- 去掉「重装」按钮(无实际意义),已安装只保留「移除」。
|
||||
- 「已安装」文字标签改为 **绿色圆点**(带 title 提示)。
|
||||
|
||||
## v3.26.23(2026-11-22)停靠栏“当前面板”重启后被切走
|
||||
|
||||
### 修复
|
||||
- 保存的 `active` 只要还在列表里就保持;插件尚未加载完时不再回退到别的面板(之前重启会把当前面板从提示词库切到浏览器)。
|
||||
|
||||
## v3.26.22(2026-11-22)停靠栏摆放会被重置的根因修复
|
||||
|
||||
### 修复
|
||||
- **根因**:应用启动瞬间插件面板还没注册,停靠栏整理逻辑把「当前不存在的 id」从列表里删掉,然后 180ms 后的节流写盘把**空/默认列表覆盖了用户的摆放** → 每次更新/重启后要重新拖。
|
||||
- 整理逻辑不再丢弃未知 id(渲染层本来就过滤,不会出现幽灵图标);`active` 仅在原值不可用时回退到“当前可用”的面板。
|
||||
- 写盘加守卫:插件面板集合为空时**不写**。
|
||||
|
||||
### 测试
|
||||
- `ui-dock-sanitize-test` 增加/更新断言:未注册 id 必须保留、active 回退到可用面板。
|
||||
|
||||
## v3.26.21(2026-11-22)封面体积修复 + 停靠栏/小地图补测 + 主题契约扩围
|
||||
|
||||
### 修复
|
||||
- **封面 300KB 的根因**:WebP 编码不可用时 `compressDataUrl` 回退成 **448px PNG**,照片仍 300KB+(3 张共 1.1MB)→ `putCover` 增加 JPEG 兜底(webp → jpeg → 原图,取更小者)。
|
||||
- promptlib 1.4.9:瘦身迁移范围扩到「PNG 封面」(不只看 >60KB),老封面会自动重压并保存一次。
|
||||
|
||||
### 测试
|
||||
- 新增 `tests/ui-dock-sanitize-test.js`:同侧去重 / 跨侧只保留左侧 / 未注册剔除 / 默认回填规则 / 幂等。
|
||||
- 新增 `tests/ui-minimap-fit-test.js`:不重叠显示 / 临界隐藏 / 回位恢复。
|
||||
- 停靠栏整理逻辑抽到 `src/ui-dock-sanitize.js`(纯函数,可单测)。
|
||||
|
||||
### 守门
|
||||
- 插件主题契约测试**扩围**:以前只扫 `.js` 且只统计“含颜色声明”的文件(实际 2 个),现在扫 `.js + .css` 全量(实际 8 个);补回“白字压在图上”例外。
|
||||
|
||||
## v3.26.20(2026-11-21)插件灰跟随主题(修暗色下节点组发白)
|
||||
|
||||
### 修复
|
||||
- `--iwb-plugin-surface/card/inset/hover` 改为由 `theme-tokens` **按当前主题派生**(亮色=中性灰、暗色=深灰),不再固定浅色。
|
||||
- 亮色下去掉蓝调:以灰阶混合生成(`mix(panel,#000,3.5%~11%)`)。
|
||||
- 效果:暗色模式下节点组卡片条、插件内嵌块不再是白块。
|
||||
|
||||
## v3.26.19(2026-11-21)停靠栏顶栏底色更浅
|
||||
|
||||
### 样式
|
||||
- 左右插件顶栏(图标条)底色由「停靠栏压暗 6%」改为「向面板白靠 55%」:比原来浅一档,与面板层次更连贯。
|
||||
- 自动配色(theme-tokens)同步该规则。
|
||||
|
||||
## v3.26.18(2026-11-21)小地图回到工具栏一排,挤压时自动隐藏
|
||||
|
||||
### 布局
|
||||
- 小地图恢复 `bottom: 14`(与悬浮工具栏同一排),尺寸保持 132×88。
|
||||
- 新增 `src/ui-minimap-fit.js`:右栏拉宽把工具栏往左挤,二者横向将要重叠(间距 < 8px)时,小地图**淡出隐藏**;腾出空间后自动恢复。
|
||||
- 监听窗口 resize、工具栏/小地图尺寸变化、停靠栏拖宽事件,拖动过程中实时判断。
|
||||
|
||||
## v3.26.17(2026-11-21)小地图缩小并上移,避免与底部工具栏重叠
|
||||
|
||||
### 布局
|
||||
- 小地图 168×112 → **132×88**(内部点阵同步缩放)。
|
||||
- 位置从 `bottom: 14` → **`bottom: 76`**:整体移到悬浮工具栏上方,窄窗口下不再压住工具按钮。
|
||||
|
||||
## v3.26.16(2026-11-21)停靠栏选中态加深 + 图库首屏空白/边距
|
||||
|
||||
### 样式
|
||||
- 面板图标:选中底 7%→**11%**,悬停底从实心白降到 **4%**(不再发白)。
|
||||
|
||||
### 插件
|
||||
- 图库 1.6.4:面板刚挂载时量不到宽度导致**首屏空白**(只有改窗口大小才出图)→ 改为读取外层可用宽度 + rAF 重试;列表内边距 8→6,去掉居中留白。
|
||||
|
||||
## v3.26.15(2026-11-21)停靠栏选中态收敛
|
||||
|
||||
### 样式
|
||||
- 面板图标选中态不再用实心白底:改为 7% 文字色淡底 + 图标提亮;去掉下方 2px 品牌色横线。
|
||||
|
||||
## v3.26.14(2026-11-21)提示词库/节点组底色与图库一致
|
||||
|
||||
### 调整
|
||||
- 提示词库、节点组面板不再铺 `--iwb-plugin-surface` 灰底,改为透明(与图库一致,直接显示停靠栏底色)。
|
||||
|
||||
### 插件
|
||||
- promptlib 1.4.8。
|
||||
|
||||
## v3.26.13(2026-11-21)停靠栏拖宽实时跟手 + 幽灵图标
|
||||
|
||||
### 修复
|
||||
- 拖宽过程中同步更新 `--iwb-dock-l` / `--iwb-dock-r`:工具栏、小地图等随之实时让位,不再松手才"飘"过去。
|
||||
- 默认面板回填时跳过另一侧已存在的 id:右侧栏不再偶尔冒出一个没有实际窗口的提示词库图标。
|
||||
|
||||
## v3.26.12(2026-11-21)停靠栏面板去重(左右各自 + 跨侧)
|
||||
|
||||
### 修复
|
||||
- 老数据里同一插件面板 id 重复出现(历史注册残留)→ 打开时**同侧去重**;同一 id 同时出现在左右两侧时**只保留左侧**,右侧那一个自动消失。
|
||||
|
||||
## v3.26.11(2026-11-21)修插件面板重复注册
|
||||
|
||||
### 修复
|
||||
- 插件 `registerPanel` 同一插件重复注册同一 id 时**替换**旧条目,而不是追加(以前每重载/每拖拽一次就多一个停靠栏图标,且旧的不消失)。
|
||||
|
||||
## v3.26.10(2026-11-21)回退:恢复到 v3.26.5 的插件样式行为
|
||||
|
||||
### 回退
|
||||
- 代码整体回退到 **v3.26.5**(客户端),插件 promptlib 回退到 **1.4.0** 的内容(市场版本号 1.4.6)。
|
||||
- 移除 v3.26.6~3.26.9 期间的改动:市场缓存回退、启动层、卡片键盘可达、CSP nonce 兜底(`src/runtime-style-nonce.js`)、封面 448/瘦身迁移、封面内联存 dataURL 等。
|
||||
- 目的:先让左右栏插件恢复正常可用,后续再逐项、单独验证地重做。
|
||||
|
||||
## v3.26.5(2026-11-21)代码体检后的清理与瘦身
|
||||
|
||||
### 清理
|
||||
- promptlib 删除死代码(旧 openEditor / renderDetail / view / expanded 与失效 CSS):866 → 702 行。
|
||||
- 仓库根目录 8 张临时截图 + `_tray-preview/` 移出并加入 `.gitignore`(约 1MB)。
|
||||
|
||||
### 瘦身
|
||||
- 封面上限 768 → **448px**(WebP 0.8)。
|
||||
- 新增一次性迁移:插件启动时把 >60KB 的老封面重新压缩并保存一次(`prompts.json` 1.7MB → 明显下降)。
|
||||
|
||||
### 测试
|
||||
- 新增 3 组覆盖:封面渲染、插入封面图片(并关闭弹窗)、弹窗拖动/缩放(含最小宽度)。
|
||||
|
||||
### 插件
|
||||
- promptlib 1.4.0。
|
||||
|
||||
## v3.26.4(2026-11-21)插件灰再压一档 + 无封面方形占位
|
||||
|
||||
### 调整
|
||||
- 插件统一灰再压一档:`--iwb-plugin-surface: #ECEFF2`(面板)、`--iwb-plugin-inset: #E3E7EA`、`--iwb-plugin-hover: #DDE2E6`。
|
||||
- promptlib 1.3.5:**无封面的提示词也给 1:1 方形占位**(渐变 + 压图标题),瀑布流里不再塌成一条线。
|
||||
|
||||
## v3.26.3(2026-11-21)插件统一灰 + 提示词瀑布流
|
||||
|
||||
### 统一定义
|
||||
- 新增/明确「插件灰」单一来源:`--iwb-plugin-surface: #F2F4F6`(面板底)、`--iwb-plugin-inset: #E9ECEF`(内嵌)、`--iwb-plugin-hover: #E4E8EC`。所有插件面板只引用这三个值,不再各自定灰。
|
||||
|
||||
### 插件
|
||||
- promptlib 1.3.4:列表改**瀑布流**(`column-width: 122px`)—— 卡片定宽、图片按原始比例排布;面板拉宽 → 列数自动变多(不是把卡片拉大)。
|
||||
|
||||
## v3.26.2(2026-11-21)封面支持任意比例
|
||||
|
||||
### 改动
|
||||
- 上传封面:最长边 512 → **768**(WebP 0.85),保持原图比例(不裁切)。
|
||||
- 详情 / 编辑弹窗里的封面改为 `object-fit: contain`:**完整显示**,长图/宽图不再被裁。
|
||||
- 列表仍按方形裁切(网格整齐)。
|
||||
- 「插入图片」按**原图长宽比**给节点宽度(宽图 340~420、竖图 200~230),不再统一 264 宽。
|
||||
|
||||
### 插件
|
||||
- promptlib 1.3.3。
|
||||
|
||||
## v3.26.1(2026-11-21)提示词详情加「插入图片」
|
||||
|
||||
### 新增
|
||||
- 详情弹窗底部在「插入画布(节点)」前增加 **「插入图片」**:把该提示词的封面作为参考图节点插入画布(无封面时不显示该按钮)。
|
||||
- 宿主 `promptlib` 能力新增 `insertImage(cover, name)`:dataURL 先转引用再建 ref 节点,落在视口附近空位。
|
||||
|
||||
### 插件
|
||||
- promptlib 1.3.2:插入成功后自动关闭详情。
|
||||
|
||||
## v3.26.0(2026-11-21)提示词封面改为内联压缩图(彻底修“上传不显示”)
|
||||
|
||||
### 根因
|
||||
- 3.25.97 起封面走 `wImgRefWrite` → 存成 `{__blob}` 引用(IndexedDB)。提示词条目写进 `library/prompts.json`,而引用要等 IDB 解析;实测表现为“编辑弹窗能看到、列表不显示/重启后丢失”。
|
||||
- 另外 `putCover` 返回的是**对象**,条目里存成了 `{__blob:...}` 而不是字符串,缓存键也被拼成 `[object Object]`。
|
||||
|
||||
### 修复
|
||||
- `putCover` 改为**压缩后内联 dataURL**(≤512px WebP 0.82,约 20~60KB),随 `prompts.json` 落盘,跨会话必可见;不再依赖 IDB 解析时序。
|
||||
- `coverUrl` 对 dataURL 直接返回;对老数据里的 `{__blob}` 引用继续异步解析(兼容)。
|
||||
- 插件缓存键改用 `id|s:<尾部32位>`,上传后立即写入临时 URL 并重绘(编辑弹窗 + 列表同时更新)。
|
||||
|
||||
### 插件
|
||||
- promptlib 1.3.0。
|
||||
|
||||
## v3.25.99(2026-11-21)提示词封面即时同步 + 弹窗线框简化
|
||||
|
||||
### 修复
|
||||
- **列表不同步封面**:`coverOf` 只缓存成功结果(之前把「未解析到」的空串也缓存了,之后永远不再重试);编辑里上传后按 `id|ref` 写缓存,列表下一次渲染就能拿到。
|
||||
|
||||
### 样式
|
||||
- 弹窗内去掉多余线框:封面框无描边、头/尾分隔线降到 45% 透明度、输入框改「无边框 + 浅底,聚焦才描边」、正文区无边框无底色、左栏按钮弱化为浅底文字按钮。
|
||||
|
||||
### 插件
|
||||
- promptlib 1.2.1。
|
||||
|
||||
## v3.25.98(2026-11-21)提示词弹窗化(详情/编辑同宽可拖动可缩放)
|
||||
|
||||
### 插件 promptlib 1.2.0
|
||||
- 卡片点击 → **详情弹窗**(不再面板内翻页);编辑也在弹窗;两窗默认 880×640,同宽同高。
|
||||
- 标题栏拖动移动、右下角拖拽缩放(最小 640×420,无上限),位置/尺寸本地记忆。
|
||||
- 透明遮罩:点外部关闭,画布可见;Esc 关闭,编辑 Cmd/Ctrl+Enter 保存。
|
||||
- 编辑弹窗左栏 240:封面 + 名称/分组/标签;右侧大文本框吃满剩余高度。
|
||||
- 输入框边框柔化(用户反馈过深)。
|
||||
|
||||
### 宿主
|
||||
- `coverUrl` 改为异步解析(`wResolveImgAsync`):新写入的封面首帧就能显示,不用退出重进。
|
||||
|
||||
## v3.25.97(2026-11-21)提示词封面能力(宿主侧)
|
||||
|
||||
### 新增
|
||||
- `promptlib` 能力新增 `putCover(dataUrl) → ref`、`coverUrl(ref)`、`removeCover(ref)`:封面进宿主内容寻址图片库(`images/plugin/prompt/`),提示词条目只存 ref。
|
||||
- 图片由宿主缩略管线出图(`wImgSrcForNode`),插件不需要自己解码/存文件。
|
||||
|
||||
### 配套插件
|
||||
- promptlib 1.1.0:3 列方形封面网格(标题压图)、长文详情页、760px 宽编辑弹窗(大文本框 + 封面选择器)。
|
||||
|
||||
## v3.25.96(2026-11-21)库面板配色(P1+P2 重做,顺序修正)
|
||||
|
||||
### 宿主(P1)
|
||||
- 新增 `--iwb-plugin-surface/card/inset/hover`(**只加默认值,不重指任何旧变量**)。
|
||||
- `.iwb-dock-body` 带 `data-panel`;样式只作用于 `[data-panel=prompts|groups]`。
|
||||
- 提示词库:浅灰面板底 + 白卡
|
||||
- 节点组:浅灰面板底 + 灰卡 + hover/选中态
|
||||
|
||||
### 插件(P2)
|
||||
- promptlib 1.0.2:卡片 hover、名称加粗、摘要三行截断、间距。
|
||||
|
||||
### 流程修正
|
||||
- 这次严格按「改插件 → 插件仓 validate → 桌面仓 sync → gen-market → 再构建客户端 → 先发客户端再传市场」执行,避免上版插件清单与市场不一致。
|
||||
|
||||
## v3.25.94(2026-11-21)回滚到 3.25.88 的插件渲染
|
||||
|
||||
### 说明
|
||||
- 3.25.89~3.25.93 的配色改造导致风格库/浏览器面板渲染异常,用户裁定回滚。
|
||||
- 本版代码整体回到 v3.25.88(已知良好状态),仅版本号前进以便覆盖安装。
|
||||
- 不含:启动静态层(3.25.90)、插件独立底色(3.25.89+)、自动配色覆盖表面色。
|
||||
|
||||
## v3.25.88(2026-11-21)浏览器面板切页/拖宽延迟(同一根因)
|
||||
|
||||
### 调查结论
|
||||
- 浏览器面板不是 iframe,而是宿主用 Tauri `add_child` 建的原生子 webview,盖在锚点上;位置由 `src/canvas-webview.js` 每 32ms(`TICK_MS`)通过 IPC 同步
|
||||
### 根因
|
||||
- 原生视图永远在主 webview 之上:切页/拖宽时 DOM 已变,但原生层要等下一帧 tick + 一次 IPC 才移动,看起来就是「慢一秒」
|
||||
- 拖宽时每个 `pointermove` 都 `setState` → 整棵停靠栏(含插件 DOM)重渲染 → 每帧一次 IPC + 原生 resize → 卡顿
|
||||
### 修复
|
||||
- 新增 `IWBCanvasWebview.parkAll()` / `setSuspended()`:切页时立刻把原生视图 park 出窗口(不销毁),拖宽期间暂停同步
|
||||
- `ui-dock` 拖宽改为「只改 DOM 宽度 + rAF 合并,松手才 setState」,并派发 `iwb:dock-resizing` 让宿主暂停原生视图
|
||||
- 覆盖层离开 `iwb-view-canvas` 时自动 parkAll(MutationObserver 监听 class)
|
||||
|
||||
## v3.25.87(2026-11-21)面板重启用补回 + 插件页停靠栏立即隐藏
|
||||
|
||||
### 修复
|
||||
- **重新启用插件后面板不回来(节点组/提示词库)**:上一版只在「该侧列表为空」时兜底;实际关插件只剔掉那一个 id,列表非空所以永远补不回。现在清洗时按**默认面板列表逐项补回**(`panels[id]` 存在且未手动移出),插件的 `removed` 记录继续生效。
|
||||
- **插件市场页还会闪出浏览器面板**:除条件渲染外,补 CSS `.iwb-view-plugins/.iwb-view-home/.iwb-view-landing .iwb-dockarea { display:none }` —— 直接不画,不等淡出动画。
|
||||
|
||||
## v3.25.86(2026-11-21)停靠栏作用域 / 插件重启用 / 保存按钮
|
||||
|
||||
### 修复
|
||||
- **浏览器插进插件页**:停靠栏改为只在 `shellView === 'canvas'` 时渲染(插件整页/首页不再带左右栏)。
|
||||
- **重新启用提词库/节点组后左栏不显示**:之前关插件时把面板列表清空了,重新启用只恢复面板对象、列表还是空的。现在列表为空时回落到默认面板列表(`props.defaults`)。
|
||||
|
||||
### 新增
|
||||
- 插件设置页增加「保存设置」按钮:调用 `PluginHost.persist()` 显式落盘并提示(`setSetting` 本身已即时保存,这里是用户要的明确出口)。
|
||||
|
||||
## v3.25.85(2026-11-21)P3 收尾 + P4 插件主题契约
|
||||
|
||||
### P3 收尾(表面色/语义色全部走 token)
|
||||
- `#b91c1c` → `var(--iwb-err)`;设置面板的紫色开关(`#6b5ce7`)→ `var(--iwb-brand)`;`#d9dbde`/`#d5d9e0` → `--iwb-canvas-bg`/`--iwb-border`。
|
||||
- 品牌/深色底上的白字统一 `var(--iwb-on-brand)`(自动配色按对比度选黑/白)。
|
||||
- `background: #fff/#ffffff` 批量收口到 `var(--iwb-panel)`。
|
||||
- style.css 硬编码 hex:165 → 117(剩余为 token 定义、暗色 ramp、节点自定义色卡、阴影/蒙版纯黑)。
|
||||
|
||||
### P4 插件主题契约
|
||||
- 新增别名 `--iwb-plugin-{bg,panel,layer,border,text,text2,brand,on-brand,err,ok,warn}`(`:root` 里全部指向 `--iwb-*`),插件跟随主题/自动配色只需用别名。
|
||||
- 新增 `tests/plugin-theme-contract-test.js`:扫描 `plugins/**`,样式里写死颜色即失败;5 个历史插件(浏览器/批量导出/风格库/位图转矢量/白底画布)以白名单 + 原因暂留,待插件源码仓库改造。
|
||||
|
||||
## v3.25.84(2026-11-21)取色板自动确认 + 停靠栏图标残留
|
||||
|
||||
### 调整
|
||||
- **取色板不再需要点「完成」**:在色板/色相条上松手后 120ms 自动收起并生效;点面板外部也会关闭;正在输入 hex/RGB 时不自动关。
|
||||
|
||||
### 修复
|
||||
- **插件关闭后停靠栏仍有图标残留**:头部图标列表改为只画「当前可用面板」(`panels[id]` 存在);同时新增状态清洗 —— 插件启停后自动剔除已不存在的 id,active 失效回退到第一个可用面板。
|
||||
|
||||
## v3.25.83(2026-11-21)P3 第一批:语义色收口到 token
|
||||
|
||||
### 改动
|
||||
- 语义色错误/成功/警告 收口:`#ef4444`/`#dc2626` → `var(--iwb-err)`;`#22c55e` → `var(--iwb-ok)`;`#d97706`/`#b45309` → `var(--iwb-warn)`;`#6b7280` → `var(--iwb-text2)`(共 30 处)。
|
||||
- 新增 `--iwb-on-brand`:自动配色按对比度选黑/白,替换品牌底上的写死 `#fff`。
|
||||
- theme-tokens 同步派生 err/ok/warn(暗色自动提亮一档)+ onBrand。
|
||||
|
||||
### 结果
|
||||
- style.css 硬编码 hex 165 → 132(剩余为 token 定义、暗色 ramp、节点自定义底色、阴影/蒙版用黑)。
|
||||
|
||||
## v3.25.82(2026-11-21)底栏/停靠栏与插件开关联动
|
||||
|
||||
### 调整
|
||||
- 底栏「资源库」按钮(archive 图标)删除:右侧栏/提示词库面板已覆盖该入口(用户裁定)。
|
||||
- 停靠栏面板清单抽到 `src/ui-dock-panels.js` 并按**插件启用状态**过滤:插件关掉后左右栏不再出现该面板;某侧一个可用面板都没有时**整侧不渲染**(连折叠窄条也不画)。
|
||||
- 插件宿主未就绪(空列表,jsdom/首次启动)时不做过滤,避免误藏全部面板。
|
||||
|
||||
### 修复
|
||||
- 右侧栏「图库旁边偶尔冒出提示词库」:之前宿主用 `drawerTab` 强行指定 active(`history→gallery` 否则 `prompts`)。现在改为:右侧栏自己记住 active,仅在显式切换 tab 时派发 `iwb:dock-activate` 事件。
|
||||
|
||||
## v3.25.81(2026-11-21)配色自动适配 P1+P2
|
||||
|
||||
### 新增
|
||||
- 新增 src/theme-tokens.js:只定 4 个种子(中性基调 / 画布深浅 / 强调色 / 模式),派生 18 个语义色并写入现有 --iwb-* 变量;文本对表面自动做 4.5:1 对比度夹紧。
|
||||
- 外观面板新增「自动配色」(默认开启):改中性基调或画布深浅,整机配色实时跟着变;关闭后才显示原来的逐项手动调节(老配置自动视为手动)。
|
||||
|
||||
### 待办
|
||||
- P3:把 style.css 里 165 个 hex + 84 个 rgba 收口到 token;P4:插件只允许用 --iwb-*。
|
||||
|
||||
## v3.25.80(2026-11-21)图片链路收口 1-4
|
||||
|
||||
### 1 合并两套预览
|
||||
- 删除 1024 派生预览(`IWBImagePreviewDerive` 链路),统一用 768 显示缩略图;`wPreviewUrlOf` 改为直通(调用点不变)。
|
||||
|
||||
### 2 远程参考图本地缓存
|
||||
- 新增 `src/image-remote-cache.js`:空闲时下载远程参考图一次,写入本地引用存储,节点只加 `data.localRef`(仅显示)。
|
||||
- **`data.url` 原样保留**:提交生成仍然用链接(用户约束)。
|
||||
|
||||
### 3 legacy 目录清理
|
||||
- `cleanupLegacy(keep)`:只删除「未被任何画布引用 + 超过 7 天」的 `images/legacy/*`,引用中的永不删。
|
||||
|
||||
### 4 图库缩略图纳入回收
|
||||
- `pruneThumbs(300MB)` 的匹配范围扩到 `images/thumbs/<hash>.jpg`(图库缩略图),超限删最老 20%。
|
||||
|
||||
## v3.25.79(2026-11-21)修缩略图 MIME 错配导致的黑块
|
||||
|
||||
### 根因
|
||||
- 3.25.73 起的缩略图写盘把 **WebP 字节写进 `_768.jpg`**,读回时按扩展名声明成 `image/jpeg`。WebKit 对 MIME 与内容不符的 blob 有时直接渲染成黑块,双击看原图又正常。
|
||||
|
||||
### 修复
|
||||
- 读缩略图时用**魔数**判断真实格式(JPEG/PNG/WebP/GIF),不再只看扩展名;写盘按真实类型选择 `.webp` / `.jpg`。
|
||||
- 缩略图 objectURL 的 LRU 不再 `revoke`(可能正在被画布上的 `<img>` 使用,撤销即黑块)。
|
||||
|
||||
## v3.25.78(2026-11-21)修图片节点偶发黑块
|
||||
|
||||
### 问题
|
||||
- 画布上部分图片节点显示为**黑块**,双击后才出现图片。
|
||||
|
||||
### 根因
|
||||
- 参考图/出图格用了 `loading="lazy"`。画布是 transform 缩放的超大图层,WebKit 对容器内「懒加载」图片的触发条件不稳定 ⇒ 图片一直没发起加载,节点只剩占位底色;双击触发重渲染/滚动后才加载。
|
||||
|
||||
### 修复
|
||||
- 画布内图片改为**立即加载**(节点本身已有视口裁剪,不需要浏览器级懒加载);保留 `decoding="async"`。
|
||||
- 参考图 `<img>` 增加 `onError` 回退原图(缩略图坏了不至于空白)。
|
||||
|
||||
## v3.25.77(2026-11-21)修外观实时预览 + 设置遮罩透明
|
||||
|
||||
### 修复
|
||||
- **实时预览没生效**:预览调用 `A.apply(appearance)`,但 `normalize()` 只认整份配置(`config.canvas.appearance`)⇒ 每次改控件实际应用的是**默认外观**。现改为传整份 draft。
|
||||
- **设置遮罩挡住画布**:设置面板的遮罩改为透明(`.iwb-mask-ghost`),调外观能直接看到画布变化;点空白处仍可关闭。
|
||||
|
||||
## v3.25.76(2026-11-21)设置窗口可拖动 + 外观实时预览
|
||||
|
||||
### 新增
|
||||
- 设置窗口支持**拖动标题栏移动**(不脱出屏幕),不再固定居中挡住画布。
|
||||
- 外观页调整**实时反映到画布**:改颜色/网格样式/间距/圆角等立刻可见;关闭未保存会自动回滚到已保存外观。
|
||||
|
||||
### 说明
|
||||
- 实时预览只写 CSS 变量 + 通知画布重渲染(网格贴图按新参数重建),不改配置文件;点「保存配置」才落盘。
|
||||
|
||||
## v3.25.75(2026-11-21)外观面板重构 + 网格线样式
|
||||
|
||||
### 新增
|
||||
- 背景网格支持**点 / 线 / 空白**三选一(参考 infinite-canvas 的「网格样式」);线型下颜色/粗细标签自动改名。
|
||||
- 主题下拉合并了配色模式与全部预设(默认 / 护眼深色 / 高对比 / 纸质 / 自定义),一处切换。
|
||||
|
||||
### 重构(用户裁定:保留节点组、合并主题、恢复按钮放组头)
|
||||
- 外观分成 4 组:主题 / 画布 / 连线 / 节点;每组组头右侧「恢复本组默认」。
|
||||
- 统一两栏网格:标签 120px 右对齐 + 控件左对齐,行高 40px、组间距 22px。
|
||||
- 颜色行统一为「色块 + hex + ▾」,对比度警告收进行尾(不再整行黄字)。
|
||||
- 配置新增 `canvas.appearance.gridStyle`(dots/lines/blank,老配置 gridOn=false 自动视为 blank)。
|
||||
|
||||
## v3.25.74(2026-11-21)状态栏内存显示 + 网格设置修复
|
||||
|
||||
### 新增
|
||||
- 画布顶栏状态区显示**当前进程内存**(`内存 xxxMB`,4s 轮询;窗口隐藏时降到 8s)。Rust 新增命令 `app_memory_mb`(macOS/Linux 读 ps RSS,Windows 读 WorkingSet64)。
|
||||
|
||||
### 修复
|
||||
- **外观设置里的网格三项失效**:网格点大小 / 网格间距 / 显示网格 之前不生效(3.25.70 改贴图网格时把参数写死成 28px/1.2)。现在网格每次渲染读取 CSS 变量(`--iwb-grid-gap/-size/-dot/-on`),与外观面板联动。
|
||||
|
||||
## v3.25.73(2026-11-21)缩略图三改(参考 basketikun/infinite-canvas)
|
||||
|
||||
### 背景
|
||||
- 读了对标项目源码:它把「预览图」当一等公民:入库时生成 768 WebP、存 Blob、按屏幕像素需求切原图。
|
||||
|
||||
### 改动
|
||||
- **稳定 key**:引用图缩略图 key 改为 `ref:<b:sha|c:key>`(blob URL 反查引用)。原来 key 是每次启动都变的 objectURL ⇒ **跨会话永远不命中**,所以每次打开画布都在重新解码原图。
|
||||
- **入库预热**:图片写入引用存储(blob/cache)时立即排队生成缩略图(字节还在内存),渲染期不再触发解码。
|
||||
- **Blob + objectURL**:缩略图生成改用 `createImageBitmap` → canvas → `toBlob(webp 0.86)`,产物是 objectURL(不进 JS 堆);落盘走 `writeDisplayThumbBlob`,读回用 `readDisplayThumbUrl`(objectURL 缓存 + 回收)。老 dataURL 文件仍兼容读取。
|
||||
- **按需切原图** `wImgSrcForNode`:屏幕需要长边 = 渲染长边 × 缩放 × dpr,超过 768 才用原图(原来有缩略图就一直用 → 放大糊;低缩放首帧又用原图 → 卡)。
|
||||
|
||||
### 新增模块
|
||||
- `src/image-thumb-pick.js`(key/选择/预热规则,依赖注入)
|
||||
|
||||
## v3.25.72(2026-11-20)修节点端口被裁切
|
||||
|
||||
### 问题
|
||||
- 节点左右端口的连接点显示不全(只剩半个圆)。
|
||||
|
||||
### 根因
|
||||
- 3.25.69 的试验样式 `.iwb-node { content-visibility: auto }` 没删干净:content-visibility 隐含 **paint 包含**,而端口是 `position:absolute` + `translate(-50%,-50%)` 逸出节点边框的,于是被浏览器裁掉。
|
||||
|
||||
### 修复
|
||||
- 彻底移除该规则,并在原处写明原因,防止以后再加回。
|
||||
|
||||
## v3.25.71(2026-11-20)低缩放 LOD 可关闭
|
||||
|
||||
### 新增
|
||||
- 设置 → 通用新增「缩放到 15% 以下时简化节点(不显示图片,更省资源)」,默认开启;关掉后任何缩放都渲染完整节点。
|
||||
- 配置字段 `canvas.lodLowZoom`(默认 true,老配置自动视为开启)。
|
||||
|
||||
## v3.25.70(2026-11-20)网格贴图化 + LOD 阈值滞回
|
||||
|
||||
### 用户反馈
|
||||
- 15% 以下出现「简化显示」时卡一下;拖动仍偏顿。
|
||||
- 澄清:15% 那一档是 **3.24.78 就有的 lodModeOf(LOD_PLAIN_SCALE=0.15)**,不是 3.25.68 新加的 iwb-zoom-far(已移除)。
|
||||
|
||||
### 改动
|
||||
- **网格改贴图 + transform 位移**(新增 src/canvas-grid.js):点阵预生成 gap×gap PNG 并缓存;平移只移动贴图层(合成),不再每帧改 background-position 重绘整屏点阵。
|
||||
- **LOD 加滞回**:plain 在 <15% 进入、>18% 才退出,阈值附近抖动不再整批换体。
|
||||
|
||||
## v3.25.69(2026-11-20)移除低缩放 LOD(跨阈值卡顿)
|
||||
|
||||
### 用户反馈
|
||||
- 缩放跨过简化阈值时卡一下;拖动仍有顿感。
|
||||
|
||||
### 改动
|
||||
- **移除** 3.25.68 的 `iwb-zoom-far` 简化:切类瞬间 148 个节点同时重算样式/重绘,跨阈值必卡。
|
||||
- 节点投影改为无阴影(用边框体现层次):这是大图层重栅格化的主要成本,且**不做开关**,不会出现跨阈值抖动。
|
||||
- 实测(内置探针):内容稳定时 p50 17ms / p95 18ms / 长帧 0;拖动期间 p95 约 89ms(集中在起手与松手)。
|
||||
- 试验并**放弃**:content-visibility(平移 p50 17→81ms,容器持续 transform 时布局包含反复失效)。
|
||||
- 缩放 debounce 与「平移只改 DOM transform」保留(3.25.68 的成果)。
|
||||
|
||||
## v3.25.68(2026-11-20)画布交互性能:相机手势走 DOM(借鉴 tldraw)
|
||||
|
||||
### 实测(内置帧率探针,小红书封面图 148 节点/205 连线)
|
||||
- 优化前:平移 p95 **211ms** / max 248ms
|
||||
- 优化后:p95 **52ms** / max 193ms(p50 恒 17ms)
|
||||
|
||||
### 机制(对照 tldraw / excalidraw)
|
||||
- **平移不再 setViewport**:手势期间只改 .iwb-world 的 transform,松手提交一次 —— 与节点拖动同款快路径。
|
||||
- **缩放 debounce 110ms**:滚轮只改 DOM transform,停手后提交 state(tldraw 的 debounced zoom)。
|
||||
- **远视距 LOD**:缩放 < 40% 去掉节点阴影与标题,减少整层重栅格化(tldraw 低缩放去阴影同思路)。
|
||||
|
||||
### 已知剩余瓶颈
|
||||
- 首帧图片解码(27 张 2160×2880 远程图)仍会产生单次 ~200ms 长帧;下次做 LOD 分级缩略图与本地缓存。
|
||||
|
||||
## v3.25.67(2026-11-20)画布大图性能:缩略图生成限流
|
||||
|
||||
### 背景(实测)
|
||||
- 小红书封面图画布 148 节点 / 205 连线,其中 27 张参考图是 **2160×2880 远程 PNG(单张约 2MB,解码后约 25MB 位图)**。
|
||||
- 旧实现每张图在渲染时立即 new Image() 解码整图 → 27 张并发 ≈ 670MB 位图,主线程被解码/缩放占满。
|
||||
|
||||
### 改动
|
||||
- 新增 src/image-display-thumb.js:缩略图生成**并发上限 2 + requestIdleCallback 空闲启动**,失败/小图照旧负缓存。
|
||||
- 参考图 img 增加 fetchPriority=low;画布内大图加 contain: paint(缩小重绘范围)。
|
||||
- 只影响**显示路径**:节点里的 data.url 原样保留,提交生成时仍用链接。
|
||||
|
||||
## v3.25.66(2026-11-20)标签条品牌标记改为浅色「IW」
|
||||
|
||||
### 调整(用户裁定)
|
||||
- 标签条最左的品牌标记不再用黑底应用图标,改为**浅色「IW」字标**(无底色、无边框);深色主题自动提亮。
|
||||
|
||||
## v3.25.65(2026-11-20)品牌 logo 移到顶部标签条
|
||||
|
||||
### 调整(用户裁定)
|
||||
- 应用图标从一级导航顶部移到**画布标签条最左**(纯展示,不参与点击);导航直接从「首页 / 列表 / 插件」开始。
|
||||
|
||||
## v3.25.64(2026-11-20)插件页去返回按钮 / logo 24px
|
||||
|
||||
### 调整
|
||||
- 插件整页页头去掉「返回画布」按钮(左侧导航「列表」已是回画布入口,重复)。
|
||||
|
||||
- 一级导航 logo 缩到 **24px**(外框 26px)。
|
||||
- 一级导航底色由纯白改为 `--iwb-home-bg`,与首页侧栏/标签条同一族,不再比画面更白。
|
||||
|
||||
## v3.25.63(2026-11-20)插件页恢复画布标签条
|
||||
|
||||
### 调整(用户裁定)
|
||||
- 插件整页顶部**保留下画布标签条**,与首页/画布页保持一致;页头靠 `padding-top` 让位,不会被标签条压住。
|
||||
|
||||
- 旧的顶部产品导航(无限画布/首页/我的画布 + 齿轮问号月亮)在插件页仍不渲染。
|
||||
|
||||
## v3.25.62(2026-11-20)导航收尾二:旧首页按钮下掉 / logo 缩小 / 插件页去旧顶栏
|
||||
|
||||
### 修正(上一版去错了地方)
|
||||
- **保留一级导航的「首页」**(这是新入口);删掉的是**顶部标签条**里那个旧的房子按钮(`iwb-tab-home`)。
|
||||
|
||||
- 导航 logo 尺寸 38px → **28px**(图片 + 容器同步缩小)。
|
||||
|
||||
### 修复
|
||||
- 插件整页还会露出旧的顶部产品导航(`ProductNav`:无限画布/首页/我的画布 + 齿轮问号月亮):`iwb-view-plugins` 下不再渲染它。
|
||||
|
||||
## v3.25.61(2026-11-20)导航收尾:去掉首页项 / 真图标 / 插件页去标签条
|
||||
|
||||
### 调整
|
||||
- 一级导航主组去掉「首页」:画布库入口本来就在顶部标签条最左的房子图标里,不再重复。主组只剩「列表 / 插件」。
|
||||
|
||||
- 导航左上角 logo 改用**真实应用图标图片**(`nav-logo.png`,构建时从 `src-tauri/icons/icon.png` 拷入 dist;加载失败回落品牌 W 路径)。
|
||||
|
||||
### 修复
|
||||
- **插件整页顶部残留画布标签条**:`iwb-view-plugins` 下隐藏 `.iwb-tabstrip`,页面上内边距收到 12px,不会再出现「市场顶部还有旧导航」。
|
||||
|
||||
## v3.25.60(2026-11-20)去重 + 插件页重叠修复 + 品牌图标 + 帮助/快捷键分开
|
||||
|
||||
### 去重(导航已覆盖,删掉旧入口)
|
||||
- 首页侧栏底部「设置 / 帮助 / 皮肤」删除;首页头部重复的调色板 logo 与「更多(≡)」菜单按钮删除。
|
||||
|
||||
- 画布顶栏右侧「主题 / 设置 / 更多」三连删除,只保留右栏开关。
|
||||
|
||||
### 修复
|
||||
- **插件整页页头被标签条压住**:布局由 `top:36/left:52` 改为「整屏 + 内边距 `padding:42px 0 0 52px`」,
|
||||
|
||||
标签条高度或导航宽度以后再变也不会压住页头;设置里的插件 Tab 不受影响(同一组件、不同容器)。
|
||||
|
||||
### 调整
|
||||
- 一级导航顶部 logo 改用**品牌 W 标记**(新增 `ICONS.brand`,与应用图标一致)。
|
||||
|
||||
- **帮助与快捷键彻底分开**:帮助只显示操作说明(不再重复键位表),快捷键只显示键位表。
|
||||
|
||||
## v3.25.59(2026-11-20)一级导航(竖向图标栏)+ 插件整页 + 快捷键弹窗重构
|
||||
|
||||
### 新增
|
||||
- **最左 52px 一级导航**(替换原 wsrail 槽位,纯图标、悬停提示):
|
||||
|
||||
顶部软件 logo;主组 首页(画布库)/ 列表(画布工作区)/ 插件;底部组 帮助 / 快捷键 / 皮肤 / 设置 / 更多。
|
||||
|
||||
选中态=深色圆底 + 白色图标;左右停靠栏与工具栏的让位基准同步加上 52px(`--iwb-nav-w`)。
|
||||
|
||||
- **插件整页**:点主组「插件」进入整页(返回按钮 + 与「设置 → 插件管理」同一份数据),实现 `src/ui-plugin-page.js`。
|
||||
|
||||
### 改造
|
||||
- **快捷键弹窗**改为分区罗列(视图 / 编辑 / 界面 / 文件,键位等宽标签右对齐),长句说明收进「更多操作说明」折叠区;
|
||||
|
||||
键位取自 `config.canvas.hotkeys`(改键后自动跟随)。实现 `src/ui-hotkey-help.js`。
|
||||
|
||||
### 兼容
|
||||
- 顶部画布标签条**保留**;左右停靠栏、画布 inset:0 不位移、dock 记忆全部不变。
|
||||
|
||||
## v3.25.58(2026-11-20)左右停靠栏配色与主色调对齐
|
||||
|
||||
- 停靠栏底色不再用 `--iwb-panel`(纯白):新增 `--iwb-dock-bg = color-mix(chrome 55%, canvas 45%)`,
|
||||
把它排进既有灰阶 ramp(bg → chrome → home → canvas)。实测(浏览器解析 color-mix 后取色):
|
||||
亮色 栏身 `#E2E4E6`(与画布 1.09:1、与标签条 1.07:1)/暗色 `#717171`(1.03:1)。
|
||||
改前亮色栏身 `#FFFFFF` 比画布 1.39:1、暗色 `#A5A5A5` 比画布 **2.04:1**,两侧像亮度泄漏。
|
||||
- 头部深一档 `--iwb-dock-head-bg = color-mix(dock-bg 94%, #000)`:亮 `#D4D6D8` / 暗 `#6A6A6A`。
|
||||
不用「往画布色混」—— 暗色整条灰阶只有 `#6F–#75`,那种混法在暗色下 ΔL 仅 0.006(看不见)。
|
||||
- `.iwb-pcard` 补 `background: var(--iwb-panel)`:原先无底色,白栏上白卡糊成一片;现在灰栏上
|
||||
卡片浮出(亮 1.28:1 / 暗 1.98:1)。该类只被 promptlib、grouplib 两个插件使用(宿主已无引用),
|
||||
不影响弹窗、首页、工具栏。
|
||||
- **不动 `--iwb-panel`**(56 条规则引用,含底部工具栏 / 状态栏 / 小地图 / 模态框 —— 那些是「该浮起来的白」)。
|
||||
- 修复版本一致性遗留:`src-tauri/Cargo.toml` 与 `Cargo.lock` 停在 3.25.55(v3.25.56 / v3.25.57 两次 bump
|
||||
漏改 Rust 侧)。四处现已对齐 3.25.58,并改用项目自带的 `scripts/set-version.js`(一次改三处)避免再漏。
|
||||
影响面核查:无代码读取 `CARGO_PKG_VERSION`,`tauri.conf.json` 显式写 version,故界面/包内版本一直正确
|
||||
(上一版 dmg 的 `CFBundleShortVersionString` 实测为 3.25.57)。
|
||||
- 插件零改动(gallery 1.6.3 / grouplib 1.0.3 / promptlib 1.0.1 的样式都用 `--iwb-layer` / `--iwb-layer2`
|
||||
等 token,在新栏底上对比自动成立)。
|
||||
|
||||
## v3.25.57(2026-11-20)提示词库插件化
|
||||
|
||||
- 新增宿主 capability `promptlib`(`src/plugin-api-promptlib.js`):`list / save / insert / copy / notify / onChanged`。
|
||||
提示词与分组仍由宿主持有(`iwb_web_prompts` + `iwb_lib_groups_cache`),插件不留副本;插入画布走宿主 `commitCanvas`。
|
||||
- 删除宿主提示词界面 `src/ui-lib-sidebar.js`(668 行,含资源中心浮层与提示词编辑器)及其单测;dock 改为
|
||||
`pluginId:'promptlib'`,未装插件时提示去市场安装。资源中心浮层(`.iwb-fullmask` / `.iwb-res-tabs`)随之下线。
|
||||
- 新插件 `promptlib` 1.0.0:搜索(名称/内容/标签,跨分组 + 「在全部中搜索」范围提示与一键回原分组)、分组胶囊
|
||||
(单行横向滚动,+/⚙ 固定右侧)、收藏、新建/编辑浮层(名称/分组/标签/正文,另存副本、删除、插入画布)、
|
||||
复制全文、右键移动分组、拖到画布插入(`application/x-iwb-prompt` + `x-iwb-promptid` 契约不变)、分组管理(重命名/排序/删除)。
|
||||
- 回归:新增 `tests/plugin-promptlib-render-test.js`(mount(node) 契约、跨分组搜索 + 范围提示、拖拽 payload、
|
||||
编辑落盘、插入调用);`tests/left-resource-layout-test.js` 与 `single-canvas-shell-test.js` 的宿主提示词钉点改为「已下线」。
|
||||
|
||||
## v3.25.56(2026-11-20)节点组库插件化 + 插件自带样式
|
||||
|
||||
- 新增宿主 capability `grouplib`(`src/plugin-api-grouplib.js`):`list / save / remove / instantiate / notify / onChanged`。
|
||||
数据仍由宿主持有(`iwb_web_groups`),插件不留副本;实例化走宿主 `instantiateGroup`(插件不碰画布状态)。
|
||||
- 删除宿主侧栏组件 `src/ui-groups-sidebar.js`(含单测与 `iwb-groups-sidebar` e2e spec),dock 改为 `pluginId:'grouplib'`,
|
||||
未装插件时提示去市场安装 —— 不再保留第二份节点组界面。
|
||||
- 新插件 `grouplib` 1.0.0:分组胶囊(全部/未分组/各分组/+/⚙)、卡片双击改名、删除确认、右键或拖拽移动分组、
|
||||
拖到画布实例化(payload 沿用 `application/x-iwb-group` 契约)、管理分组弹窗、宿主数据变化自动重拉。
|
||||
- 插件可自带 `styles.css`:`.zip` 内 `manifest.style` 声明,加载时注入 `<style>`、停用即移除(`sync-plugins-from-repo.js`
|
||||
支持目录插件拷贝样式并计入逐文件 sha256)。宿主 `style.css` 里的图库视觉规则迁出,避免"改宿主 CSS 要发客户端"的假失败。
|
||||
- gallery 1.5.0:三个下拉收进「设置」浮层、底栏刷新/设置改无框图标、面板间距收紧(12→8px)。
|
||||
- 回归:新增 `tests/plugin-grouplib-render-test.js`(列表/筛选/拖拽 payload/改名落盘/删除走宿主/空态);
|
||||
`tests/plugin-gallery-recovery-test.js` 增加设置浮层与"图标无框无底色"断言。
|
||||
|
||||
## v3.25.55(2026-11-20)修:删除图片后残留「图片已丢失」格子
|
||||
|
||||
- 症状:图库删图后,被删位置仍渲染一格「图片已丢失」,不会自动补齐。
|
||||
- 原因:`deleteOutputs` 是 fire-and-forget,`ctx.gallery.remove` 立刻返回 ok,插件随即重拉到的还是**旧列表**(宿主 state 尚未刷新),旧条目取不到缩略图 ⇒ 显示丢失格。
|
||||
- 修复:
|
||||
- `deleteOutputs` 返回 Promise(删除 + `refreshOutputs` 完成后才 resolve);
|
||||
- `ctx.gallery.remove` 等它完成再返回 `{ok, removed}`;
|
||||
- gallery 插件 1.2.1:删除后**先本地摘掉**这些条目并重排(立刻补齐),250ms 后再向宿主重拉校正。
|
||||
- 回归:`tests/plugin-gallery-render-test.js` 增加「删除后只剩 1 张、无丢失格」断言。
|
||||
|
||||
## v3.25.54(2026-11-20)图库:缩略图失败重试 + 下载失败可重试
|
||||
|
||||
- 宿主 `ctx.gallery.download`:每张最多尝试 3 次(间隔 300/700/1100ms),返回 `{ok, count, failed[]}`;
|
||||
之前是 fire-and-forget 且恒返回 ok,网络慢/图床抖动时用户完全不知道有没有下成功。
|
||||
- gallery 插件 1.2.0:
|
||||
- 缩略图 `onerror` 自动重试 2 次;仍失败显示「缩略图加载失败(点击重试)」,点击重新向宿主取图。
|
||||
- `img` 的 `alt` 置空、长说明挪到卡片 `title`——不再出现截图里"破图标 + 一长串提示文字撑满格子"。
|
||||
- 底部状态位显示「下载中… / 已下载 N 张 / N 张下载失败,可再点一次重试」。
|
||||
|
||||
## v3.25.53(2026-11-20)图库面板改版:无标题 + 底部横栏(张数左 / 设定右)
|
||||
|
||||
- 去掉顶部「图库」标题,顶部只留 全选 / 反选 / 下载 / 删除(「插入」移到图片悬浮操作,避免重复)。
|
||||
- 新增底部横栏 `.iwb-gal-foot`:**左侧**「N / M 张 + 已选」,**右侧**三个设定(插入尺寸 / 图幅 / 时间)右对齐。
|
||||
- 三个下拉再窄约 1/3:62px → **34–44px**(字号 10、高度 20)。
|
||||
- gallery 插件 1.1.0(已上架市场),宿主只调 `style.css` 里图库相关类。
|
||||
|
||||
## v3.25.52(2026-11-20)M5:图库改为**只由插件提供**,宿主删除第二份界面
|
||||
|
||||
- **宿主不再保留图库面板**(`src/ui-gallery-panel.js` / `src/ui-gallery-head.js` 删除):`app.js` 8879 行(原 8951),
|
||||
只保留 `gallery` capability(`list/thumb/preview/download/insert/remove`)与数据/索引。
|
||||
- 右栏图库固定走插件(`pluginId:'gallery'`);未安装时面板显示「图库插件未安装 · 设置 → 插件 → 市场安装」。
|
||||
- 插件仓新增 **gallery 1.0.0**:头部三行(标题/全选反选下载插入删除/三个窄下拉)、瀑布流、Shift 多选、双击预览、拖到画布;
|
||||
配置存 `ctx.data`,图片数据走 `ctx.gallery`。已发布到市场(9 个插件)。
|
||||
- `insert` 支持按插件选择的尺寸档(`insertK`)压缩后再引用化。
|
||||
- 说明:图库数据(`images/` + 索引)始终在宿主;不装插件只是**看不到**图库界面,生图仍会自动归档。
|
||||
|
||||
## v3.25.51(2026-11-20)M5 第二步:宿主 gallery capability(插件可读图库)
|
||||
|
||||
- 新增 `src/plugin-api-gallery.js`:给插件稳定的 `ctx.gallery` 代理(`list / thumb / preview / download / insert / remove`)。
|
||||
- 图片字节仍留宿主(`images/` + 图库索引),插件只拿元数据与缩略图 URL;`list` 复用 `IWBGalleryQuery`(同筛选/分页口径)。
|
||||
- 实现由 Workbench 每次渲染 `setImpl()` 注入(capability 在 init 期创建,拿不到组件闭包)。
|
||||
- `plugin-host` 能力表新增 `gallery`(`capabilities:['gallery']` 才可调用)。
|
||||
- 右栏图库改为 **A 方案**:装了 gallery 插件(且 registerPanel 成功)走插件,否则/挂载失败**自动回落宿主面板**
|
||||
(`ui-dock` 的 `PluginBox` 新增 `fallback`)。
|
||||
- 验证:浏览器实测 `ctx.gallery.list()` 返回 `{items,total}`、`thumb(未知)` 返回空串、无报错;宿主面板照常渲染。
|
||||
|
||||
## v3.25.50(2026-11-20)M5 第一步:图库面板抽成独立模块(行为零变化)
|
||||
|
||||
- 新增 `src/ui-gallery-panel.js`:图库面板(头部三行 + 瀑布流网格 + 单项操作)从 `app.js` 移出,改为 props 驱动的纯组件。
|
||||
- `app.js` 8951 → 8937 行,为下一步接入 `gallery` capability 腾出空间(硬上限 8952)。
|
||||
- 顺带把「插入到画布」抽成 `insertOutputsToCanvas(list)`,单图/批量共用一个入口(行为不变)。
|
||||
- 验证:图库面板照常渲染(头部/网格/空态),无报错;单测与边界快照同步。
|
||||
|
||||
## v3.25.49(2026-11-20)修:打开「插件管理」整页崩溃(TDZ)
|
||||
|
||||
- 症状:更新到 3.25.48 后打开 设置 → 插件管理,整页报「Cannot access 'z' before initialization」(压缩后的 TDZ)。
|
||||
- 原因:3.25.48 新增的 `cmpV` 写成 `const`,但 `installedRows`(在上方几行)渲染时就会调用它 ⇒ 块级作用域未初始化。
|
||||
- 修复:改为**函数声明**(提升),并在注释里写明「此处不得改回 const」。
|
||||
- 验证:本地脚本伪造「已安装 1.7.0(目录格式)」后打开插件页,无报错、无「界面出错了」。
|
||||
- 教训:这类错误只有「已安装插件非空」时才会触发——空列表时 map 回调不执行,所以空环境冒烟测不出来。
|
||||
|
||||
## v3.25.48(2026-11-20)修:插件全部误报「可更新」
|
||||
|
||||
- 症状:3.25.47 里 7 个已装插件全部显示「可更新」,点「更新」其实没有新版本。
|
||||
- 原因:v3.25.47 为区分「旧格式」把已安装映射从「版本字符串」改成 `{version, dir, file}`,
|
||||
但「可更新」判断仍写 `m.version !== inst[id]` —— 拿字符串比对象,恒为 true。
|
||||
- 修复:比较 `inst[id].version`,并统一改用 `IWBRuntimePluginLoader.compareVersions(a,b) > 0`,
|
||||
市场版本回退时也不会误报。
|
||||
- 回归钉点:`tests/left-resource-layout-test.js` 禁止再出现 `m.version !== inst[id]`。
|
||||
|
||||
## v3.25.47(2026-11-20)插件市场:可「转为新格式」重装(单文件 → 目录)
|
||||
|
||||
- 症状:已装 1.7.0(单文件)后,市场里同一版本只显示「移除外部副本」,**没有入口装成新的目录格式**;市场卡片页更是只剩「移除」。
|
||||
- 修复:设置 → 插件 → 市场,行内按钮改为按状态显示 `安装 / 更新 / 转为新格式 / 重新安装`,并单独提供「移除」;
|
||||
市场卡片页给已安装插件补「重装」按钮。
|
||||
- 状态文案区分「已安装」与「已安装(旧格式)」:`plugins/index.json` 里的条目有 `dir` 才是 M3 的目录格式,只有 `file` 就是 M3 前的单文件。
|
||||
- 装成新格式后旧单文件会变成孤儿文件(不加载、仅占空间),可手动删除或等后续「清理残留」。
|
||||
|
||||
## v3.25.46(2026-11-20)插件市场 M3:zip 整包 + 逐文件 sha256 + 桌面解包安装
|
||||
|
||||
- 市场产物升级:每个插件同时产出 `plugins/<id>-<version>.zip`(STORE 不压缩),条目新增 `bundle / bundleSize / bundleSha256 / files[]`;
|
||||
旧的单文件 `file + integrity` 保留一个版本,老客户端照常可装。
|
||||
- 桌面安装器改走 zip:下载(30s)→ 整包 sha256 → 解包(复用 `src/storage-zip.js`)→ **逐文件 sha256** → 路径白名单
|
||||
(只允许 `manifest.json / main.js / styles.css / assets/*`)→ 体积/数量上限(≤200 文件、单文件 ≤2MB、总 ≤10MB)→
|
||||
`.new` 落地 → 旧目录改名 `.old` → rename 就位 → 删 `.old`(失败回滚,Windows 覆盖不再报错)。
|
||||
- 新增 `plugins.renameDir / existsDir`;卸载目录插件走 `removeDir`,**插件数据(plugin-data)默认保留**。
|
||||
- 新增 `scripts/plugin-zip.js`(Node STORE 写入器)与两组测试:
|
||||
`tests/plugin-bundle-test.js`(写入↔解包往返、路径白名单、上限常量)、
|
||||
`tests/plugin-install-test.js`(首装 / 覆盖升级 / 逐文件校验拒绝 / manifest id 校验 / 卸载)。
|
||||
- 关键取舍:包统一 STORE —— 客户端 DEFLATE 依赖 `DecompressionStream`,旧 macOS(<13)WKWebView 没有该 API。
|
||||
|
||||
## v3.25.45(2026-11-20)纠正:插件只能来自市场(桌面包不内置插件)
|
||||
|
||||
- 事实纠正:`beforeBuildCommand` 跑 `scripts/strip-plugins.js`,打包前把 `dist/plugins` 移出 —— **桌面包里没有任何内置插件**;
|
||||
删除 `<资料目录>/plugins/` 后插件全部消失属预期,不是 bug。
|
||||
- 因此 `image-annotate` 的目录化试点**回退为单文件**:市场只支持单文件,目录插件无处可装,等 M3(zip 安装)再切回。
|
||||
- 市场已发布 **browser 1.7.0**(最近访问走 `ctx.data`),公网校验:index 版本 1.7.0、文件 HTTP 200、sha256 一致。
|
||||
|
||||
## v3.25.44(2026-11-20)修:资料目录里的旧外置插件会盖住内置升级
|
||||
|
||||
- 症状:客户端升到 3.25.43,设置里浏览器插件仍显示 **1.6.0**;资料目录 `plugins/` 下残留的外置 1.6.0 覆盖了随包的内置 1.7.0,且**没有任何更新入口**。
|
||||
- 原因:v3.25.41 的合并规则是「外置无条件覆盖内置」(同 id 直接 `set`),旧外置副本永久压制内置升级。
|
||||
- 修复:改为**高版本胜**;同版本时外置胜(允许用户本地打补丁)。目录插件扫描同理。
|
||||
- 新增 `compareVersions`(数字分段比较、缺段补 0)与 `tests/plugin-loader-test.js`(1.6<1.7、1.10>1.9、1.20.6>1.9.0、空版本等)。
|
||||
- 说明:不做自动删除——资料目录里的旧文件保留,只是不再生效;用户可自行清理。
|
||||
|
||||
## v3.25.43(2026-11-20)插件数据层首个真实用例:浏览器「最近访问」
|
||||
|
||||
- 浏览器插件 1.7.0:面板地址栏挂 `<datalist>`,提交地址时记录**最近 12 条**(去重、新的在前),下拉可直接选。
|
||||
- 数据走 M2 的 `ctx.data`:桌面落 `<资料目录>/plugin-data/browser.json`,**不塞进 settings**;数据不可用时静默降级,不影响浏览。
|
||||
- manifest 声明 `data: { schemaVersion: 1, maxBytes: 65536 }`。
|
||||
- 插件仓提交 `7119dcf` + `df5361c`(面板回车走 `onUrl`,最近访问在两条提交路径都要记)。
|
||||
|
||||
## v3.25.42(2026-11-20)插件数据层 M2:ctx.data(原子写 + 串行队列 + 旧数据迁移)
|
||||
|
||||
- 新增 `src/plugin-data.js`,插件拿到异步数据 API:`ctx.data.read/write/patch/remove/size`。
|
||||
- 桌面落 `<资料目录>/plugin-data/<id>.json`(写 `.tmp` 再 rename,避免半截 JSON);与插件代码目录分离,卸载默认保留数据。
|
||||
- 同一插件的读写**串行排队**,`patch` 的「读-改-写」不会被并发覆盖。
|
||||
- 单文件上限 `maxBytes`(默认 2MiB,最高 16MiB),超限抛 `plugin-data-too-large` 且**不破坏已有数据**。
|
||||
- 旧数据迁移:`stripLegacy()` 在宿主 init 前同步把 `iwb_plugins[id].data` 暂存,插件首次 `read()` 时才落盘并清暂存(启动不等 IO)。
|
||||
- 备份包含插件数据(`items.pluginData`),恢复时写回;存储体检新增「插件数据 N 个 / X KB」。
|
||||
- 非桌面环境(jsdom / playwright)走 `IWBStorageLocal` 门面 → 内存兜底,仅供测试。
|
||||
- 新增 `tests/plugin-data-test.js`(串行队列 / 上限 / 迁移 / 备份 4 组断言)。
|
||||
|
||||
## v3.25.41(2026-11-20)插件目录化 M1:目录插件加载 + 兼容旧单文件
|
||||
|
||||
- 插件支持**目录形态**:`<plugins>/<id>/{manifest.json,main.js[,styles.css]}`;内置 `image-annotate` 转为目录做试点,其余 7 个仍是单文件(双轨兼容)。
|
||||
- 加载器新增 `loadFolder()`:读 manifest → 逐文件 **sha256 校验**(内置以随包 index.json 为准)→ blob 注入 → 样式文本暂存,**激活时才注入**、停用时移除。
|
||||
- 目录插件失败隔离:单个插件 manifest 损坏/hash 不符只记 `error`,不中断其余插件加载;加载顺序按 id 稳定排序。
|
||||
- 新增磁盘能力:`plugins.listDirs/readFile/writeFile/writeBinary/mkdir/removeDir`(路径按段校验,禁 `..`)。
|
||||
- 修复历史 bug:**首次安装(`iwb_plugins` 无记录)时所有插件都不会激活**,表现为面板显示「xxx 未加载」;现在无记录即默认启用。
|
||||
- 插件备份(`runtime-plugin-backup`)兼容目录形态(收集 main+style,恢复写回目录)。
|
||||
- 市场索引暂时跳过目录插件(zip 打包在 M3 落地后恢复)。
|
||||
- 同步脚本 `sync-plugins-from-repo.js` / `copy-plugins.js` 支持产出与打包目录插件。
|
||||
|
||||
## v3.25.40(2026-11-20)图库设定行去掉文字标签,只留三个窄下拉
|
||||
|
||||
- 去掉「插入 / 显示 / 时间」三个文字标签(按用户选择),三个下拉直接并排:`0.5K | 特大 | 全部`。
|
||||
- 含义改为 `title` + `aria-label` 承载(悬停可看说明,读屏不丢语义)。
|
||||
- 宽度不变(46–51px),260px 窄面板仍单行;不使用图标。
|
||||
|
||||
## v3.25.39(2026-11-20)图库头部重排:标题独占一行 + 操作行 + 设定行
|
||||
|
||||
- 图库头部改三行:**标题行**(图库 + 计数 + 已选数)、**操作行**(全选 / 反选 / 下载 / 插入 / 删除)、**设定行**(插入尺寸 / 显示大小 / 时间筛选),不再把按钮和下拉挤在标题同一行。
|
||||
- 补齐图库「插入」按钮:批量把选中图片按「插入」档压缩后插入画布(与单图插入同一入口 `refSrcOf` + 引用化)。
|
||||
- 下载 / 插入 / 删除改为常驻(未选中时半透明提示「先在图库里选中图片」),去掉语义重复的「清除」。
|
||||
- 去掉底部「自动清理:…」文案与不再使用的 `retentionText`。
|
||||
- 三个下拉各带 2 字标签并压缩到 46–51px(min 46 / max 60、行高 22、字号 11),260px 宽面板也能三件同行、不换行不裁字。
|
||||
- 头部独立成组件 `src/ui-gallery-head.js`(app.js 只做装配,行数从 8947 → 8936)。
|
||||
|
||||
## v3.25.38(2026-11-20)图库自适应重做、左右栏快捷键与面板层级修正
|
||||
|
||||
- **图库图片尺寸重做**:列数改为 `floor((面板宽+8)/(图幅+8))`,图幅固定 ⇒ 同一图幅下列宽稳定(不再忽大忽小),只靠增减列数适应面板宽度;新增「图幅」选择(小 110 / 中 130 / 大 170 / 特大 220,默认中,本地持久化)。
|
||||
- **图片完整显示**:去掉内嵌图库的 `max-width/max-height:460px`(它让宽列里的图被 letterbox 缩成小图、竖图被压出空白)。
|
||||
- **窄栏按钮不再挤压**:图库头部 `flex-wrap: wrap`(去掉强制 nowrap 与撑开的 spacer),窄面板自动排成两行。
|
||||
- **快捷键**:`n` = 右侧栏开合、`t` = 左侧栏开合(均只开关、不改当前面板);顶栏旧「图库」按钮下线,其快捷键一并解绑(帮助面板与设置页文案同步)。
|
||||
- **层级修正**:左右栏只从顶部标签条下方开始(`top:36px`),标签条恢复满宽并压在面板之上 —— 首页/画布切换栏不再被面板盖住;画布顶栏仍在两栏之间(保留名称/缩放/节点数)。
|
||||
- **首页遮挡修复**:首页/落地页整块隐藏停靠栏(`--iwb-dock-*` 归零 + `display:none`),原生子 webview 因 rect 归零被 park,不再糊住首页。
|
||||
- **滚轮修正**:停靠栏在 DOM 上属于 `.iwb-canvas`,滚轮/指针事件会冒泡触发画布缩放与框选 —— 面板根节点吞掉 wheel/pointerdown/contextmenu,画布 wheel 命中白名单补 `.iwb-dock`;图库网格 `overscroll-behavior: contain`。顺带修了图库宽度测量只在首次挂载生效(ref 未挂上就放弃,导致列宽按 300 算)。
|
||||
|
||||
## v3.25.37(2026-11-19)去掉边缘竖条,左右开关移到画布顶栏
|
||||
|
||||
- 移除折叠后左右边缘的 14px 竖条:折叠 = 完全让位(画布可视宽度恢复,标签条/标题左移)。
|
||||
- 左右开关改为画布顶栏上的两个图标:**左开关在标题前**、**右开关在功能图标之后(最右)**。
|
||||
- 功能图标(主题 / 设置 / 图库 / 更多)从标签条移回**画布顶栏右上**;标签条只留首页 + 画布标签 + `+`。
|
||||
- 停靠栏头部只保留面板图标(不再放折叠按钮)。
|
||||
|
||||
## v3.25.36(2026-11-19)停靠栏置顶、折叠按钮归位、顶部功能图标上移
|
||||
|
||||
**界面修正(按用户截图反馈)**
|
||||
- 左右停靠栏改为**从窗口最顶端开始**(`top: 0`),消除顶栏上方那条“缺口”;标签条与画布状态行改为随侧栏宽度内缩(`left/right = --iwb-dock-l/--iwb-dock-r`),标题跟着缩进。
|
||||
- 左栏折叠图标从头部最左移到**头部最右**(贴近画布);右栏折叠图标保持在面板最右(贴近窗口)。
|
||||
- 折叠后各自在窗口边缘保留 **14px 窄条 + 展开图标**(左折叠时标题自动左移贴到窄条右侧,右折叠时右侧只留一个图标条)。
|
||||
- 画布仍 `inset:0` 不位移;底部工具栏/小地图继续按 `--iwb-dock-*` 让位。
|
||||
|
||||
**顶部图标**
|
||||
- 原画布状态行右侧的功能图标(主题 / 设置 / 图库 / 更多)**上移到画布标签条最右**;保存按钮去掉(自动保存,状态行仍有“保存成功”)。
|
||||
|
||||
**未验证**:Windows/Linux 与插件网页面板停靠表现需真机实测。
|
||||
|
||||
## v3.25.35(2026-11-19)左右停靠栏(P1 布局 + P2 图标拖拽),图库独立右栏
|
||||
|
||||
**新增布局**
|
||||
- 左右两条**停靠栏**(Obsidian 式):左 = 节点组 / 浏览器 / 风格库,右 = 提示词库 / 图库;默认左「浏览器」、右「图库」,两侧默认展开。
|
||||
- 每栏顶部横排图标:**点击切换**当前面板;**拖动排序**;**拖到另一栏**按鼠标位置插入移动;每栏至少保留一个面板(拖走最后一个会拒绝并提示)。
|
||||
- 每栏独立开合(左栏开关在头部最左、右栏开关在头部最右),折叠后窗口边缘保留 14px 窄条作为展开入口。
|
||||
- 宽度自由拖动、**不设上限**,最小 100px;开合 / 宽度 / 面板顺序 / 当前面板全部持久化(`iwb.dock.v1`)。
|
||||
- 画布**不位移**;底部工具栏、小地图、底部提示按 `--iwb-dock-l` / `--iwb-dock-r` 让位。停靠栏从画布顶栏下方开始,避免盖住名称/状态。
|
||||
- 顶部「资源中心」按钮与 `Esc` 继续控制右栏开合;右栏默认落在「图库」。
|
||||
|
||||
**工程**
|
||||
- 新增 `src/ui-dock.js`(`IWBDockArea`),并在 `scripts/build.js` 模块清单登记;`app.js` 只保留面板装配(行数仍在 8952 上限内)。
|
||||
- 图库 / 节点组 / 提示词面板改由停靠栏承载(提示词仍可「⛶ 全屏」打开原有资源中心窗口编辑)。
|
||||
- `tests/architecture-boundary-guard-test.js` 快照与架构文档计数同步(新增 1 个模块 / 1 个耦合项);`left-resource-layout` / `single-canvas-shell` / `shell-render-behavior` 断言改为停靠栏结构。
|
||||
|
||||
**已知限制**
|
||||
- 浏览器 / 风格库是插件面板:插件未注册时显示「未加载」,注册后自动可用(左栏默认仍优先「浏览器」)。
|
||||
- 网页面板是**原生子 webview**:停靠栏内为直角、无圆角裁剪;切换面板/折叠时依赖插件自身的 park 逻辑,需在客户端实测。
|
||||
|
||||
## v3.25.34(2026-11-19)自动下载只在该等的时候等归档;清理废弃字段
|
||||
|
||||
### 优化
|
||||
|
||||
@@ -41,7 +41,7 @@ build esbuild 打包到 dist/(单 dist/app.js = src/ 模块按序
|
||||
node --check app.js 与 dist/app.js 语法
|
||||
check-dist.js 产物体检
|
||||
lint ESLint(src/ + app.js,正确性规则)
|
||||
test:unit 101 个单测文件(jsdom 契约测试;2026-11-07 新增 sync-facts-guard(事实一致性)/ _helpers/source(统一源文本);2026-11-12 新增 provider-ping(测速 no-cors 兜底))
|
||||
test:unit 116 个单测文件(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)
|
||||
@@ -137,7 +137,7 @@ IWB_WRITE_BOUNDARY_SNAPSHOT=1 node tests/architecture-boundary-guard-test.js #
|
||||
| **新增模块必须登记** `scripts/build.js` 的 `sourceModules`(顺序即加载序,别排序) | `tests/architecture-boundary-guard-test.js` | 打红 |
|
||||
| **`src/` 不得反向依赖 app.js 的 window 全局** | 同上 | 打红 |
|
||||
| **改动计数类事实**(模块数 / 耦合面项数 / spec 数)**必须同步**事实基线文档 | `tests/architecture-facts-guard-test.js` | 打红 |
|
||||
| **发版后必须同步事实基线锚点**(第 4 行的 `main = <SHA>`) | 同上 | 打红。查 SHA 的正确方法见 `PUBLISHING.md` 第 1 步 |
|
||||
| **事实基线锚点**(第 4 行 `main = <SHA>`)由 `publish-update.sh` **自动对齐并提交**(`scripts/set-doc-anchor.js`);手工改仍可用 | 同上 | 打红(若 bump 未提交,脚本会 WARN 跳过) |
|
||||
| **新增测试文件必须真的进门禁**(否则是「孤儿测试」= 假覆盖率) | `tests/architecture-facts-guard-test.js` 第 9 组 | 打红。确需手工探针请登记 `ALLOW_ORPHAN` 并写原因 |
|
||||
| **插件运行时完整性 fail-closed**:缺 `integrity` 即拒绝加载 | `tests/plugin-integrity-test.js` | 打红 |
|
||||
| **新增节点类型必须先登记 `NODE_H`** | `tests/architecture-boundary-guard-test.js` | 节点**刷新即消失**(静默!) |
|
||||
@@ -190,7 +190,7 @@ release: vX.Y.Z 发版
|
||||
|
||||
**手动发布**,CI 只验证不部署。详见 [`PUBLISHING.md`](PUBLISHING.md)。要点:
|
||||
|
||||
1. bump `package.json` 版本 → **同步事实基线锚点**(否则 `test:facts` 打红)
|
||||
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` → 正式站
|
||||
|
||||
|
Before Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 593 B |
|
Before Width: | Height: | Size: 507 B |
|
Before Width: | Height: | Size: 717 B |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,364 @@
|
||||
# 插件目录化 + 三个库插件化 · 完整方案
|
||||
|
||||
> v2(2026-11-20)· 已并入「桌面端定位」「展示页例外」「不做分类」三项裁定
|
||||
> 范围:插件从「单文件」改为「文件夹」;随后把 **图库 / 提示词库 / 节点组库** 改为插件
|
||||
> 非目标:分类插件(画布分类维持现状);插件安全沙箱;画布内核重构
|
||||
>
|
||||
> **重要前提(2026-11-20 实测纠正)**:桌面包**不随包发布任何插件** —— `beforeBuildCommand` 里的
|
||||
> `scripts/strip-plugins.js` 会在打包前把 `dist/plugins` 移走,插件一律从市场装到 `<资料目录>/plugins/`。
|
||||
> 因此本仓的 `plugins/`(index.json + runtime + 目录插件)是**市场构建输入**,不是应用内置资源;
|
||||
> 「内置插件」在桌面上并不存在。目录插件要真正可用,必须先有 M3 的 zip 安装能力。
|
||||
|
||||
---
|
||||
|
||||
## 0. 决策摘要(本方案按这 10 条执行)
|
||||
|
||||
| # | 决策 | 状态 |
|
||||
|---|---|---|
|
||||
| 1 | 应用本体 = 独立桌面端(Tauri);产品代码不加浏览器降级分支 | 已定 |
|
||||
| 2 | **例外**:插件展示页 / 市场页 / 下载页仍是静态网页,继续维护 | 已定 |
|
||||
| 3 | 插件格式 = 目录(`manifest.json + main.js + styles.css + data.json + assets/`) | 本方案 |
|
||||
| 4 | 插件数据落 `<资料目录>/plugin-data/<id>.json`(与代码目录分离,卸载默认保留) | 建议默认 |
|
||||
| 5 | 市场安装 = zip 整包 + 逐文件 sha256;安装仅桌面 | 建议默认 |
|
||||
| 6 | 旧单文件插件保留一个版本周期的双轨兼容 | 本方案 |
|
||||
| 7 | **不做**分类插件(`iwb_home_cats` + `workspace.category` 维持现状) | 已定 |
|
||||
| 8 | 插件不得直接改画布:插入/实例化一律走宿主 capability | 本方案 |
|
||||
| 9 | 市场包用 **ZIP STORE(不压缩)**,绕开旧 WebView 无 `DecompressionStream` 的兼容坑 | 复查新增 |
|
||||
| 10 | 图库/提示词/节点组插件化后,**保留宿主面板一个版本周期**可一键退回(`iwb_panels_mode`) | 复查新增 |
|
||||
|
||||
---
|
||||
|
||||
## 1. 现状(代码核对过的事实)
|
||||
|
||||
| 环节 | 现状 | 位置 |
|
||||
|---|---|---|
|
||||
| 插件产物 | 单个 IIFE `<id>.<hash>.js`,内容寻址 | `plugins/runtime/` |
|
||||
| 清单 | `index.json`:`{id,file,version,integrity}`;展示信息在 `meta.json` | `plugins/index.json` |
|
||||
| 注册契约 | 插件自注册 `IWBPluginHost.register(manifest, factory)` | 各插件末尾 |
|
||||
| 内置加载 | `<script src="/plugins/x.js" integrity=…>`(SRI) | `runtime-plugin-loader.js:54` |
|
||||
| 外部加载 | 读文本 → sha256 → blob 注入 | `:71` |
|
||||
| 开发模式 | **已是目录**:`<资料目录>/plugins/local/<id>/plugin.js` | `storage-file.js:441` |
|
||||
| 市场安装 | 下载单文件 → sha256 → 写盘 → 重启 | `runtime-plugin-market.js:65` |
|
||||
| 插件数据 | `ctx.storage.namespace(ns)` → 全量落 `localStorage['iwb_plugins']`(≈5MB) | `plugin-host.js:100` |
|
||||
| 能力面 | panels/commands/nodeTypes/generationHooks/providers/canvas/canvasWrite/nodeActions | `plugin-host.js:8` |
|
||||
| CSP | `script-src 'self' blob:`;`style-src 'self' 'unsafe-inline'` | `tauri.conf.json` |
|
||||
| 图库规模 | 上限 500 张 | `runtime-constants.js:6` |
|
||||
| 展示页 | `site/plugins/index.html` ← `gen-site.js` ← `market/index.json` | 静态站 |
|
||||
|
||||
三条判断:
|
||||
|
||||
1. **目录形态已有先例**(dev 模式),只是没推广到正式插件 → 改动可控。
|
||||
2. **瓶颈是数据不是形态**:所有插件共用一个 localStorage 键,图库/提示词一大就爆。
|
||||
3. **展示页与桌面端共享 `market/index.json`**:新字段只能加、不能改,原有 `name/desc/tags/version/icon/author` 必须保留。
|
||||
|
||||
---
|
||||
|
||||
## 2. 目标形态
|
||||
|
||||
### 2.1 目录结构
|
||||
|
||||
```
|
||||
<插件根>/<id>/
|
||||
manifest.json 唯一真源
|
||||
main.js IIFE,自注册(沿用现有 register)
|
||||
styles.css 可选,注入 <style data-plugin="<id>">
|
||||
data.json 可选,插件数据(由宿主代理读写,见 2.3)
|
||||
assets/ 可选,图标/图片(ctx.asset → data URL)
|
||||
```
|
||||
|
||||
与 Obsidian 完全同构(`manifest.json/main.js/styles.css/data.json`),差异只有 `minAppVersion→apiVersion` 与可选 `assets/`。
|
||||
|
||||
### 2.2 manifest 字段
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"id": "gallery", "name": "图库", "version": "1.0.0", "apiVersion": 1,
|
||||
"main": "main.js", "style": "styles.css",
|
||||
"description": "…", "author": "official", "icon": "🖼️", "tags": ["资源"],
|
||||
"capabilities": ["panels", "gallery"],
|
||||
"permissions": ["gallery.read", "gallery.delete", "canvas.insertRef"],
|
||||
"settings": {},
|
||||
"data": { "schemaVersion": 1, "maxBytes": 2097152 }
|
||||
}
|
||||
```
|
||||
|
||||
- `description/author/icon/tags` 接管原 `meta.json`,展示页从构建期汇总读取。
|
||||
- 旧单文件插件的内嵌清单继续有效;同 id 时**目录优先**。
|
||||
|
||||
### 2.3 数据层(核心)
|
||||
|
||||
| 层 | 用途 | 落点 | API |
|
||||
|---|---|---|---|
|
||||
| settings | 少量配置 | `localStorage['iwb_plugins'][id].settings`(现状) | `ctx.settings`(同步,不变) |
|
||||
| **data** | 业务数据 | `<资料目录>/plugin-data/<id>.json` | **`ctx.data`(异步,新增)** |
|
||||
| assets | 图标/图片 | `<插件目录>/assets/` | `ctx.asset(name)` → data URL |
|
||||
|
||||
```js
|
||||
ctx.data.read() // → object(不存在返回 {})
|
||||
ctx.data.write(obj) // 全量覆盖;原子写:<id>.json.tmp → rename
|
||||
ctx.data.patch(fn|obj) // 读-改-写,内部串行队列
|
||||
ctx.data.remove() // 清空
|
||||
ctx.data.size() // 字节数(设置页展示占用)
|
||||
ctx.data.schemaVersion
|
||||
```
|
||||
|
||||
约束:单文件上限 `maxBytes`(默认 2MiB,最高 16MiB),超限写失败并提示,不静默截断;同一插件的写串行化;**图片字节不进 data.json**(图库图仍在宿主 `images/`,data.json 只存元数据)。
|
||||
|
||||
三件必须同时做的事(复查补充):
|
||||
|
||||
- **备份/还原**:`plugin-data/` 纳入备份(新增 `items.pluginData`,体积小、默认勾选);同时改造 `runtime-plugin-backup.js`——它现在只备份单文件插件的 `code`,目录插件会丢。
|
||||
- **存储审计**:`wStorageAudit` 增加「插件数据」占用,设置页可见、可清空。
|
||||
- **双写禁令**:`ctx.storage`(同步、落 localStorage)从 M2 起只允许存 settings 级小值;业务数据一律 `ctx.data`。迁移后把 `iwb_plugins[id].data` 清空只留 `migratedAt`,避免两份真源。
|
||||
|
||||
> 唯一例外:jsdom / playwright 测试在非 Tauri 环境跑应用,`ctx.data` 保留内存兜底,标注"仅供测试",不得据此在产品代码加浏览器分支。
|
||||
|
||||
### 2.4 加载流程
|
||||
|
||||
```
|
||||
内置: /plugins/index.json(构建生成的目录索引,含逐文件 sha256) + /plugins/<id>/manifest.json
|
||||
外部: <资料目录>/plugins/index.json + <资料目录>/plugins/<id>/manifest.json
|
||||
扫描: 桌面额外扫描 <资料目录>/plugins/*/manifest.json(手工放入、无索引也能识别)
|
||||
开发: <资料目录>/plugins/local/<id>/plugin.js(免签名)
|
||||
```
|
||||
|
||||
`loadFolder(record)`:读 manifest → 校验(apiVersion/capabilities/permissions)→ 读 main.js 并校验 hash → 注入 `__IWB_PLUGIN_MANIFEST__` → blob 注入 → 注入 styles.css → 等自注册。
|
||||
|
||||
> Tauri 资源协议**不能列目录** ⇒ 内置索引必须构建期生成;外部目录才可扫描。
|
||||
|
||||
复查补充的 4 条硬规则:
|
||||
|
||||
1. **信任模型**:内置插件只信**随包的** `plugins/index.json`(里面的逐文件 sha256 写死在包里);manifest 里的 hash 只用于"外部/市场安装"校验,不能拿它自证。
|
||||
2. **确定性顺序**:两路合并后按 `id` 升序加载;不依赖文件系统返回顺序。
|
||||
3. **失败隔离**:单个插件 manifest 损坏 / 脚本抛错 → 记 `record.error` 并跳过,**不得中断整轮加载**。
|
||||
4. **注册去重**:`registerPanel/registerNodeType` 按 `pluginId + 自身 id` 去重,防止热启停导致面板重复。
|
||||
|
||||
### 2.5 安装(仅桌面)
|
||||
|
||||
市场条目:
|
||||
|
||||
```jsonc
|
||||
{ "id":"gallery","version":"1.0.0","minApiVersion":1,
|
||||
"bundle":"gallery-1.0.0.zip",
|
||||
"files":[{"path":"manifest.json","sha256":"…","size":812}, …] }
|
||||
```
|
||||
|
||||
流程:下载 zip(30s 超时)→ `wZipParseEntries` 解析 → 校验 path(禁 `../`/绝对路径)+ sha256 + size → 解到 `plugins/.staging/<id>/` → 校验 manifest 可解析且 id 匹配 → 替换目录 → 更新 index.json → 提示重启。
|
||||
|
||||
复查补充:
|
||||
|
||||
- **压缩方式固定 STORE**:`wZipReadEntry` 对 DEFLATE 依赖 `DecompressionStream('deflate-raw')`,而项目未设 `minimumSystemVersion`(默认 10.13),旧 macOS 的 WKWebView 没有该 API ⇒ 安装直接失败。插件包只有几十 KB,用 STORE 不压缩,顺带消除这个依赖。
|
||||
- **Windows 覆盖替换**:`fs().rename` 在 Windows 对"已存在的目标目录"会报错。改为 `<id>.new` 就位 → 旧目录改名 `<id>.old` → rename `<id>.new` → 成功后删 `<id>.old`;失败则把 `<id>.old` 改回,保证可回滚。
|
||||
- **安装限额**:解压后 ≤ 10MB、文件数 ≤ 200、单文件 ≤ 2MB;超限拒装(防 zip 炸弹与超大 assets)。
|
||||
卸载:删目录 + **询问是否连数据一起删**(默认保留 `plugin-data/<id>.json`)。
|
||||
|
||||
### 2.6 展示页(唯一保留的网页)
|
||||
|
||||
`site/plugins/index.html` 与 `site/plugins-index.json` 由 `gen-site.js` 从 `market/index.json` 生成,部署在 `download.maqiart.eu.org/plugins/`。
|
||||
|
||||
- 页面只渲染卡片(图标/名称/版本/作者/描述/标签)+ 安装说明,**不直接读插件目录**(静态站没有文件系统)。
|
||||
- 目录化后无需改页面结构;只需保证 `market/index.json` 字段可加性。
|
||||
|
||||
### 2.7 权限(advisory)
|
||||
|
||||
`permissions` 在 manifest 声明,宿主按声明放行 capability(无 `gallery.read` 就拿不到 `ctx.gallery`)。
|
||||
诚实边界:插件仍运行在主页面上下文,**不是安全沙箱**;权限只是 API 门禁 + 安装时展示。
|
||||
|
||||
---
|
||||
|
||||
## 3. 里程碑
|
||||
|
||||
每阶段可独立发布/回滚。
|
||||
|
||||
### M1 目录插件加载(兼容旧单文件)
|
||||
|
||||
> 实施状态(2026-11-20):加载器与数据层已完成并入库;但**生产插件暂不目录化** ——
|
||||
> 桌面包不内置插件、市场只支持单文件,目录插件无处可装。`image-annotate` 试点已回退为单文件,
|
||||
> 等 M3 落地后再切回目录。
|
||||
|
||||
| 改动 | 文件 | 关键点 |
|
||||
|---|---|---|
|
||||
| 目录读写 API | `src/storage-file.js` | `listDirs/readFile/writeFile/writeBinary/mkdir/removeDir`;路径按段校验,禁 `..` |
|
||||
| `loadFolder()` | `src/runtime-plugin-loader.js` | 见 2.4 |
|
||||
| 三路合并 | `app.js` `wLoadRuntimePlugins` | 索引 + 扫描 + dev;目录优先 |
|
||||
| 清单校验 | `src/plugin-host.js` `validate()` | 增 `main/style/permissions/data` |
|
||||
| 构建产物 | `scripts/sync-plugins-from-repo.js` | 产出 `plugins/<id>/` + 升级版 index.json;单文件产物保留一版用于回滚 |
|
||||
|
||||
**验收**:`image-annotate` 转目录形态后台可加载、面板正常;其余 7 个单文件插件行为零变化。
|
||||
|
||||
### M2 数据层 `ctx.data`
|
||||
|
||||
| 改动 | 文件 |
|
||||
|---|---|
|
||||
| 数据适配器(Tauri 文件;非桌面内存兜底) | 新 `src/plugin-data.js` |
|
||||
| `ctx.data` 注入 + 串行队列 | `src/plugin-host.js` |
|
||||
| `iwb_plugins[id].data` 一次性迁移 | `app.js`(幂等,带 migrated 标记) |
|
||||
| 设置页显示占用 + 清空 | `src/ui-settings-sections.js` |
|
||||
|
||||
**验收**:annotate 记住笔刷/颜色,重启仍在;旧数据迁移后保留一版原值。
|
||||
|
||||
### M3 市场 zip 安装
|
||||
|
||||
| 改动 | 文件 |
|
||||
|---|---|
|
||||
| 安装/卸载/校验/原子替换 | `src/runtime-plugin-market.js` |
|
||||
| zip 读取复用 | `src/storage-zip.js`(现有 `wZipParseEntries`) |
|
||||
| 市场索引生成(bundle + files)+ **Node 侧 STORE zip 打包** | `scripts/gen-market.js` + 发布脚本(复用 STORE 写法,勿引入压缩) |
|
||||
|
||||
**验收**:装到 `<资料目录>/plugins/<id>/` 且逐文件 hash 全对;改坏一个文件即拒装、旧版本不受影响;**Windows 上覆盖升级成功**、旧 macOS(无 DecompressionStream)也能装(因为包是 STORE)。
|
||||
|
||||
### M4 插件源仓构建目录化
|
||||
|
||||
| 改动 | 文件(iwb-plugins-desktop) |
|
||||
|---|---|
|
||||
| 产物改为目录(`manifest.json` + `main.js`),**CSS 仍内联** | `scripts/build-plugin.mjs` |
|
||||
| 校验 manifest 完整性 | `scripts/validate.mjs` |
|
||||
| 脚手架 | `template/` |
|
||||
|
||||
**验收**:任一插件 build + validate 后产出的目录可被 M1 直接消费;8 个插件迁移后功能一致。
|
||||
|
||||
> 复查修正:现有 8 个插件都是**运行时 `createElement('style')` 注入 CSS**(已实测 annotate),
|
||||
> 因此 `styles.css` 只作为「手写插件」的可选项,**不改 esbuild 的 CSS 处理**,省掉一轮构建改造。
|
||||
|
||||
### M5 图库插件(第一个业务插件)
|
||||
|
||||
宿主新增 `gallery` capability(新 `src/plugin-api-gallery.js`):
|
||||
|
||||
```js
|
||||
ctx.gallery = {
|
||||
list({query, range, limit, offset}), thumb(name), original(name),
|
||||
remove(names), download(names), insertToCanvas(names, {sizeK}),
|
||||
on('changed', fn)
|
||||
}
|
||||
```
|
||||
|
||||
插件侧搬迁:`src/ui-gallery-head.js` + 图库网格 JSX(约 200 行)→ `gallery/main.js`;`app.js` 只留 `dockPanels` 一行注册。
|
||||
|
||||
**验收**:滚动/选中/全选反选/下载/插入/删除/双击预览/拖入画布 全一致;宿主删掉图库 JSX(app.js 行数下降)。
|
||||
|
||||
### M6 提示词库插件
|
||||
|
||||
宿主新增 `ctx.library.prompts`:
|
||||
|
||||
```js
|
||||
list(), save({prompts, groups}), canvasPrompts(), insert(text, name)
|
||||
```
|
||||
|
||||
数据搬进 `plugins/prompts/data.json`;插入画布走 `canvas.insertPrompt`(宿主实现,插件不碰画布状态)。
|
||||
|
||||
**验收**:增删改/分组/搜索/插入/导入导出全通;迁移前备份 `iwb_prompts`。
|
||||
|
||||
### M7 节点组库插件
|
||||
|
||||
宿主补齐 `canvasWrite`:
|
||||
|
||||
```js
|
||||
saveSelectionAsGroup(name), instantiateGroup(snapshot), previewGroup(id)
|
||||
```
|
||||
|
||||
**验收**:保存/应用/预览/删除全通;应用后位置不重叠、连线正确、可撤销。
|
||||
|
||||
---
|
||||
|
||||
## 4. 三个库的边界(插件化后)
|
||||
|
||||
| 关注点 | 归属 |
|
||||
|---|---|
|
||||
| 面板 UI、列表/筛选/按钮 | 插件 |
|
||||
| 提示词/分组/节点组快照数据 | 插件 `data.json` |
|
||||
| 图片字节 | **宿主** `images/`(不搬) |
|
||||
| 图库索引 | 宿主(`out_*` + IDB),插件只读 |
|
||||
| 画布插入/实例化 | 宿主 capability |
|
||||
|
||||
好处:卸载「图库插件」不删用户图片;卸载「提示词插件」可选连带数据。
|
||||
|
||||
---
|
||||
|
||||
## 5. 迁移与兼容
|
||||
|
||||
| 对象 | 策略 |
|
||||
|---|---|
|
||||
| 旧单文件插件 | 继续加载,给一个版本周期的双轨期 |
|
||||
| 老市场单文件包 | 仍可安装(索引同时保留 `file` 与 `bundle`) |
|
||||
| `localStorage['iwb_plugins']` | 一次性迁到新数据层,原值保留一版 |
|
||||
| 提示词/分组 | 迁到插件 data.json,先写 `iwb_prompts_backup_<date>` |
|
||||
| 图库 | **不迁移**,仍走宿主存储 |
|
||||
| 测试快照 | 插件顺序/边界守门/市场测试同步;快照重生成须写理由 |
|
||||
|
||||
---
|
||||
|
||||
## 6. 回归清单(每个里程碑都跑)
|
||||
|
||||
1. 8 个内置插件全部加载,面板/节点/命令可用;设置页开关生效。
|
||||
2. 开发者模式 `local/<id>/plugin.js` 仍可覆盖内置。
|
||||
3. 同 id 的目录插件与单文件插件共存时,目录优先且只有一个实例。
|
||||
4. 卸载后:面板/命令/节点类型/CSS 全部消失,无残留。
|
||||
5. 数据:写→重启→读一致;并发两次写不丢(串行队列)。
|
||||
6. 非桌面测试环境:插件可加载、`ctx.data` 内存兜底不抛错。
|
||||
7. 桌面手工放 `<资料目录>/plugins/<id>/` 可被识别(无索引)。
|
||||
8. `lint / typecheck / test:unit / test:facts` 全绿。
|
||||
|
||||
---
|
||||
|
||||
## 7. 风险
|
||||
|
||||
| 风险 | 缓解 |
|
||||
|---|---|
|
||||
| 插件无沙箱,权限只是门禁 | 安装时展示 permissions;只从官方市场安装;文档明确声明 |
|
||||
| 目录形态失去 SRI | 逐文件 sha256 写进 index/manifest,加载前校验,不符拒载 |
|
||||
| **桌面包无内置插件** | 删掉资料目录 `plugins/` 后所有插件消失(2026-11-20 真实反馈);目录化必须等 M3 | 文档/设置页文案明确「插件来自市场」;M3 前不发布目录插件 |
|
||||
| 双后端(文件/内存兜底)行为差异 | 同一套契约测试跑两遍;兜底只在无 Tauri 时启用 |
|
||||
| UI 搬迁期宿主与插件双份代码 | 每个里程碑"搬完即删",不留双轨 |
|
||||
| 画布写入 API 设计不当 | capability 内部复用 `commitCanvas` + 历史栈,插件只提交声明式快照 |
|
||||
| 展示页与安装器共用索引,字段冲突 | 新字段可加性;`gen-site.js` 只读已知字段 |
|
||||
|
||||
---
|
||||
|
||||
## 8. 顺序
|
||||
|
||||
```
|
||||
M1 目录加载 ──┬─→ M2 数据层 ──→ M5 图库插件 ──→ M6 提示词插件 ──→ M7 节点组插件
|
||||
└─→ M4 源仓构建
|
||||
M3 市场 zip ←(依赖 M1 的文件写入)
|
||||
```
|
||||
|
||||
M1 与 M4 可并行;M3 与 M2 可并行;M5 之后每步都复用同一种 capability 模式。
|
||||
|
||||
---
|
||||
|
||||
## 9. 复查修订(2026-11-20 · 逐项核对代码后)
|
||||
|
||||
复查方法:把方案里每个"技术依赖"回到代码验证(zip 解压、fs 能力、备份范围、插件 CSS 注入方式、CSP、系统版本)。
|
||||
|
||||
| # | 复查发现 | 影响 | 处置 | 落点 |
|
||||
|---|---|---|---|---|
|
||||
| R1 | `wZipReadEntry` 的 DEFLATE 依赖 `DecompressionStream`,而 `tauri.conf` 未设 `minimumSystemVersion`(默认 10.13) | 旧 macOS 市场安装直接失败 | 市场包固定 **ZIP STORE** | M3 |
|
||||
| R2 | `fs().rename` 在 Windows 覆盖已存在目录会报错 | 升级安装失败、无法回滚 | `<id>.new` → 旧目录改 `<id>.old` → rename → 删 old;失败回滚 | M3 |
|
||||
| R3 | `runtime-plugin-backup.js` 只 collect 单文件 `code` | 目录插件**备份后恢复不回来** | collect/restore 改为按目录收集(不含 `data.json`) | M2/M3 |
|
||||
| R4 | 备份 `items` 与 `wStorageAudit` 都不含插件数据 | 换机丢插件数据、占用看不见 | 备份加 `pluginData`;审计加「插件数据」项 | M2 |
|
||||
| R5 | `ctx.storage`(localStorage)与 `ctx.data` 并存 → 双真源 | 迁移后同一数据两份、互相覆盖 | storage 只留 settings;迁移后清空 `iwb_plugins[id].data` 只留 `migratedAt` | M2 |
|
||||
| R6 | 方案原要求构建产出 `styles.css`,但现有插件是运行时 `createElement('style')` 注入(annotate 实测) | 白改一轮 esbuild 管线 | `styles.css` 降为**手写插件可选项**,不改 CSS 构建 | M4 |
|
||||
| R7 | 注入的 `<style>` 是全局的,停用/卸载不清理 | 插件 CSS 污染宿主 UI | 注入打 `data-plugin`,deactivate 时移除;手写插件强制 `.iwb-p-<id>-` 前缀(validate 校验) | M1 |
|
||||
| R8 | 目录插件若只靠 manifest 自带的 hash 校验,等于自证 | 篡改可绕过 | 内置只信随包 `index.json`;manifest hash 只用于外部/市场 | 2.4 |
|
||||
| R9 | 目录扫描顺序由文件系统决定;单插件异常可能中断整轮 | 加载不稳定 | 按 id 排序 + 单插件失败隔离 | M1 |
|
||||
| R10 | 每次启动对 8 个插件做 sha256 + 读盘 | 冷启动变慢 | 内置按 `mtime+size` 缓存校验结果;外部每次校验 | M1 |
|
||||
| R11 | 无解压体积/文件数限制 | zip 炸弹、超大 assets | 解压后 ≤10MB、≤200 文件、单文件 ≤2MB | M3 |
|
||||
| R12 | 热启停可能重复注册面板/节点类型 | 面板出现两份 | `pluginId + id` 去重 | M1 |
|
||||
| R13 | `ctx.asset` 每次读字节转 data URL | 图标频繁 IO | 内置走 `/plugins/<id>/assets/…` URL;外部读一次进缓存,停用清空 | M1 |
|
||||
| R14 | 图库 500 张每次全量 `list` | 面板卡顿 | 分页 + `on('changed')` 节流 + 宿主侧索引缓存 | M5 |
|
||||
| R15 | 插件化后若出问题只能发版回退 | 风险高 | 保留宿主面板一版,`iwb_panels_mode = legacy \| plugin` 开关 | M5–M7 |
|
||||
| R16 | 第三方缺开发文档 | 只有你能写插件 | 产出 `docs/PLUGIN-DEV-GUIDE.md`(manifest/ctx/样式前缀/调试) | M4 |
|
||||
|
||||
### 顺带的 4 个优化(不改结构,但省事)
|
||||
|
||||
1. **先空跑**:M1 只把 annotate 转目录、行为零变化,用来验证加载链;不动任何业务面板。
|
||||
2. **内置不扫描**:内置只读随包索引(快且安全),只有外部目录才扫描——省掉每次启动的文件系统遍历。
|
||||
3. **图库插件首版只读**:先做「列表 + 预览 + 下载 + 插入」,删除/批量操作放到第二版,缩小首个业务插件的爆炸半径。
|
||||
4. **双轨只保留一个版本**:目录插件稳定后,一次性删掉单文件产物与旧市场包,避免长期两套产物。
|
||||
|
||||
---
|
||||
|
||||
## 10. 明确不做
|
||||
|
||||
- 分类插件(画布分类维持 `iwb_home_cats` + `workspace.category`)。
|
||||
- 插件沙箱、跨插件依赖声明、热重载(安装后仍要求重启)。
|
||||
- 网页版应用:只有展示页/市场页/下载页是网页。
|
||||
@@ -1,7 +1,7 @@
|
||||
# 现状架构与性能事实基线(image-workbench-web)
|
||||
|
||||
> **本文档是什么**:现状**事实快照**,不是规范。用途:任何性能 / 内存 / 存储相关改动,先对齐这里的现实,避免把已经调好的东西改坏。
|
||||
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = 7b8d755`(线上 `v3.25.34+7b8d755` —— **未上线**:mac 侧 cargo check --release 已通过;DESKTOP_BUILD.md 第四章「Tauri 不支持从 macOS 交叉编译 Windows 产物」,所以还需把代码推 gitea → win 拉代码构建 v3.25.32 win 包 + 跑测试矩阵 + mac 同批重打 arm64/intel,三平台齐平才能切线上。上一条 3.25.30:线上实际运行提交是 docs 提交 `7df9dc4`,bump 提交为 `4be78c0`;2026-11-16 已发**测试站 + 正式站**,三地址一致 + `IWB_VERIFY_STRICT=1` 通过。v3.24.85 是「代码体检收口」(棘轮收回 Workbench 3090→2998 + 图库索引 4 条绕过锁的写路径收口到 `mutate` + 文档数字校准),`stable` / `stable-v3.24.85` / `stable-verified-2026-11-16` 均指向 `7df9dc4`。上一条 —— 2026-11-14 发**测试站 + 正式站** `https://test.image-workbench-web.pages.dev`:**v3.24.84 修「生图节点连了 3 条上游只出 1 个任务」**(任务 id 与去重基准改用新字段 `ownerNodeId`=本节点自己,不再用随继承冒泡的 `sourceNodeId` ⇒ 连几条线就几个任务;`relay` 仍归约到真实文本来源,同一来源多路径抵达只算一次)。上一条 v3.24.83:**修「插件节点冷启动退化成一段文本」**(插件节点体是异步注册的,`registerNodeType` 在 `render` 由无变有时自增 `NODE_TYPES_REV`,`NodeCard` 比它 ⇒ 注册那一刻重建一次;`canvas-normalize` 按命名规则把 `plugin:<id>:<variant>` 认作已知类型,不再降级成 `plugin` 并写回存档);配套插件 `style-source` 1.3.2 把节点体样式改为**脚本执行时注入**(此前只在面板 `mount()` 注入 ⇒ 从存档直接进画布时节点无样式、缩略图按原图铺满)。上一条 v3.24.82 同批:提示词/文本节点**显示上游继承文本**(自己 `data.text` 为空时把上游那段话显示在框里,改一个字即接管,另有「恢复跟随」清空回跟随;多路上游按 Y 轴取第一条)+ 修 `nodeRefsOf` 的 textout 分支只认 llm/batch/combine 上游导致「样式 → 文本 → 分层」丢参考图;再上一条 v3.24.81:① 插件节点可自定义节点体(`render(node, props, host)` 画真实 DOM,宿主不每帧重建 ⇒ 输入框不失焦);② 节点自带参考图(`data.refOn/refUrl` ⇒ 任务图里补伪参考图,坐标取节点自身 ⇒ 仍参与「图片按 X 轴排序」);③ 连线白名单按 `data.outKind === 'prompt'` 归一化,7 条规则一次放行,内置节点行为逐字不变。上一条 v3.24.80 = 离开页面的兜底保存不递增 rev(2026-11-14 07:20 补发 —— 首发 11-13 23:25 撞 Cloudflare Workers API 事故 `503 no healthy upstream`,期间正式站保持在 `v3.24.79+8598a57` 未动)。v3.24.83 的 bump 提交即 `0a27a42`(v3.24.82 为 `ef6cf42`、v3.24.81 为 `dba71e3`);主干 HEAD 会继续前进,见 [`RELEASES.md`](../RELEASES.md))| 历史分支 `refactor/architecture` / `feat/multi-canvas-tabs` / `refactor/state-store` 已于 2026-10-20 清理(内容均已并入 main,归档标签 `archive/*`),本文**计数类事实**已按 main HEAD 复算。
|
||||
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = 2b8e337`(线上 `v3.26.41+2b8e337` —— 2026-11-23 发**正式线**:继承态提示词把上游文案与参考图交给组合/连接节点(来源判定加 `(edges, nodes)`,组合拼接逻辑零改动));上一条 `v3.26.40+d9e3d84`:左右停靠栏配色对齐主色调(新增 `--iwb-dock-bg` 进灰阶 ramp + 头部深一档 + `.iwb-pcard` 补白底)+ 修 `Cargo.toml`/`Cargo.lock` 版本漂移,四处统一到 3.25.58)。上一条 3.25.30:线上实际运行提交是 docs 提交 `7df9dc4`,bump 提交为 `4be78c0`;2026-11-16 已发**测试站 + 正式站**,三地址一致 + `IWB_VERIFY_STRICT=1` 通过。v3.24.85 是「代码体检收口」(棘轮收回 Workbench 3090→2998 + 图库索引 4 条绕过锁的写路径收口到 `mutate` + 文档数字校准),`stable` / `stable-v3.24.85` / `stable-verified-2026-11-16` 均指向 `7df9dc4`。上一条 —— 2026-11-14 发**测试站 + 正式站** `https://test.image-workbench-web.pages.dev`:**v3.24.84 修「生图节点连了 3 条上游只出 1 个任务」**(任务 id 与去重基准改用新字段 `ownerNodeId`=本节点自己,不再用随继承冒泡的 `sourceNodeId` ⇒ 连几条线就几个任务;`relay` 仍归约到真实文本来源,同一来源多路径抵达只算一次)。上一条 v3.24.83:**修「插件节点冷启动退化成一段文本」**(插件节点体是异步注册的,`registerNodeType` 在 `render` 由无变有时自增 `NODE_TYPES_REV`,`NodeCard` 比它 ⇒ 注册那一刻重建一次;`canvas-normalize` 按命名规则把 `plugin:<id>:<variant>` 认作已知类型,不再降级成 `plugin` 并写回存档);配套插件 `style-source` 1.3.2 把节点体样式改为**脚本执行时注入**(此前只在面板 `mount()` 注入 ⇒ 从存档直接进画布时节点无样式、缩略图按原图铺满)。上一条 v3.24.82 同批:提示词/文本节点**显示上游继承文本**(自己 `data.text` 为空时把上游那段话显示在框里,改一个字即接管,另有「恢复跟随」清空回跟随;多路上游按 Y 轴取第一条)+ 修 `nodeRefsOf` 的 textout 分支只认 llm/batch/combine 上游导致「样式 → 文本 → 分层」丢参考图;再上一条 v3.24.81:① 插件节点可自定义节点体(`render(node, props, host)` 画真实 DOM,宿主不每帧重建 ⇒ 输入框不失焦);② 节点自带参考图(`data.refOn/refUrl` ⇒ 任务图里补伪参考图,坐标取节点自身 ⇒ 仍参与「图片按 X 轴排序」);③ 连线白名单按 `data.outKind === 'prompt'` 归一化,7 条规则一次放行,内置节点行为逐字不变。上一条 v3.24.80 = 离开页面的兜底保存不递增 rev(2026-11-14 07:20 补发 —— 首发 11-13 23:25 撞 Cloudflare Workers API 事故 `503 no healthy upstream`,期间正式站保持在 `v3.24.79+8598a57` 未动)。v3.24.83 的 bump 提交即 `0a27a42`(v3.24.82 为 `ef6cf42`、v3.24.81 为 `dba71e3`);主干 HEAD 会继续前进,见 [`RELEASES.md`](../RELEASES.md))| 历史分支 `refactor/architecture` / `feat/multi-canvas-tabs` / `refactor/state-store` 已于 2026-10-20 清理(内容均已并入 main,归档标签 `archive/*`),本文**计数类事实**已按 main HEAD 复算。
|
||||
<!-- 2026-10-28 P1 拆分批 1:新增 src/generation-task-graph.js(5 个任务图纯函数自 app.js 迁出)
|
||||
⇒ 模块数 60→61、耦合面 51→52、sourceModules 60→61。耦合面只**新增** IWBWTaskGraph,无删除。
|
||||
2026-10-28 P1 拆分批 2:新增 src/storage-config-shape.js(9 个配置形状纯函数自 app.js 迁出)
|
||||
@@ -22,7 +22,7 @@
|
||||
- 图片**新写入主通道 = IndexedDB Blob `{__blob}` / key `imgblob_<hash>_<len>`** (A) `app.js:2143`;`{__cache}`(Cache Storage)为兜底;\`ref_\`(`app.js` 内定义的 `IDB_REF_PREFIX = 'ref_'`)为 legacy 形态 (A)。
|
||||
- 大图判定:`isBigDataUrl` = `data:` 且 `length > 3000` (A) `app.js:2018`;**画布保存保留阈值** `< 16384` 才原样保留 (A) `app.js:2182`。**两处阈值并存,含义不同**。
|
||||
- 单测是**源码契约测试**:`tests/` 目录共 **493** 处源码文本钉点(`source.includes` / `source.indexOf` / `/re/.test(source)`),分布在 **20** 个文件(其中 `iwb-v32-web-test.js` 一个就占 **407**)→ **结构性重构会先打红测试**。**该数字已由 `tests/source-text-ratchet-test.js` 的「只减不增」棘轮守门**(2026-10-20 起守卫范围从 1 个文件扩到全目录:新增任何一处源码文本钉点都会打红)。**2026-11-12 复算**(`npm run audit:pins`,v3.24.76):二分 STRUCT **417** / NAME **76**;形态 **POS 403 / NEG 87 / COUNT 3**;难度 **易 62 / 中 316 / 难 115**。钉点减法第一批(v3.24.72)把 **537 → 505**:8 条探针钉点改为「门禁内 spec 是否真的读该计数器」、5 条改为运行时断言(生产态 `window` 上无探针)、10 条改为 DOM 断言(质量档位禁用 / 传输页无三模式按钮 / 模型项 title)、4 条改为运行时对象断言(健康检查两域、策略对象冻结)、其余 9 条有同文件 DOM 等价断言或仅剩 NEG。第二批(v3.24.76)把 **505 → 493**:94-5~7 三条「多标签释放语义」(10 处正则)换成 `tests/iwb-tabs-release.spec.js` 的 3 条真 e2e,剩 1 条「消费方契约」(断言该 spec 在门禁内且 spec 源码真的读两个探针);另 2 条 `wPurgeIntent.add` 钉点改为读 `src/workspace-purge.js`。**这一批一换就查出 3 个真缺陷**(objectURL 从未释放 / 彻底删除留孤儿标签 · session / 刷新后误回收打开标签的图)—— 见 CHANGELOG v3.24.76。
|
||||
- `app.js` = 单 IIFE **8,508 行**(**双层预算**:绝对上限 8,700 / 占总源码 ≤ 40%,现 **36.8%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **2,998 行**(上限 **3,030**,余量 32;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **89** 个模块 / 14,607 行,`sourceModules` 89 项;v3.24.68 新增 `clipboard-graph.js`,v3.24.74 新增 `image-admit.js`,v3.24.75 新增 `image-dedupe.js`,v3.24.76 新增 `workspace-purge.js`,v3.24.79 新增 `generation-provider-ping.js`,v3.24.80 删除无调用的 `createWBFlushViewport` 17 行)。
|
||||
- `app.js` = 单 IIFE **8,508 行**(**双层预算**:绝对上限 8,700 / 占总源码 ≤ 40%,现 **36.8%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **2,998 行**(上限 **3,030**,余量 32;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **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 行)。
|
||||
- 门禁:`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. 门禁与环境现状
|
||||
@@ -30,8 +30,8 @@
|
||||
| 项 | 现值 | 依据 |
|
||||
|---|---|---|
|
||||
| 单测基线 | **658 通过 / 0 新增失败 / 2 已知环境差异**(2026-11-12 v3.24.76 实测;660 −2 = 94-5~7 三条钉点换成一条消费方契约) | (A) `npm test` 实测(`tests/iwb-v32-web-test.js`) |
|
||||
| e2e | spec 文件 **59** 个(**55** 个进门禁 + 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** 个进门禁 —— `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` |
|
||||
| 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) 本轮发布实测 |
|
||||
@@ -58,7 +58,7 @@
|
||||
|---|---|---|
|
||||
| objectURL 缓存 | `W_OBJURL_MAX = 50`(FIFO,驱逐即 revoke) | (A) `app.js:4105` |
|
||||
| blob 引用缓存 | `W_BLOBREF_MAX = 50` | (A) `app.js:4111` |
|
||||
| 显示缩略图缓存 | `DISPLAY_THUMB_CACHE_MAX = 300`;`DISPLAY_THUMB_MAX = 768` | (A) `app.js:4573 / 4572` |
|
||||
| 显示缩略图缓存 | `DISPLAY_THUMB_CACHE_MAX = 300`;`DISPLAY_THUMB_MAX = 640` | (A) `app.js:4573 / 4572` |
|
||||
| 预览派生缓存 | `PREVIEW_CACHE_MAX = 200`(FIFO,**淘汰即 revoke**);`PREVIEW_MAX_EDGE = 1024` | (A) `app.js:4592 / 4591`;淘汰 revoke `4595-4599` |
|
||||
| 图库缩略图缓存 | `outThumbCacheMax = 400` | (A) `app.js:1980` |
|
||||
| Blob 仓库内存 LRU | `DEFAULT_BLOB_CACHE_MAX = 200` | (A) `src/image-blob-store.js:51` |
|
||||
@@ -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` 不引用模块全局)。**89 个模块中 59 个导出**被 `app.js` 读取;其余为未接线 / 仅测试 / 零引用(见下)。
|
||||
- **判定法**:`global.X =` / `root.X =` 判「导出」;跨文件裸引用判「读」;排除自合并(`src/runtime-constants.js:9`)。`app.js` 是**唯一生产消费者**(无 HTML 入口;`sw.js` 不引用模块全局)。**108 个模块中 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 耦合面(**74** 项)与 `sourceModules` 顺序(**89** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。
|
||||
- **耦合面已冻结**:`tests/architecture-boundary-guard-test.js`(进 `npm run test:unit` 末环)冻结 app.js↔src 耦合面(**86** 项)与 `sourceModules` 顺序(**108** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。
|
||||
|
||||
## 12. 易踩的坑
|
||||
|
||||
@@ -254,7 +254,7 @@
|
||||
|
||||
**信任模型(必须明示)**:形态 A 的插件是**可信代码**(与核心同权限、无沙箱);启停与设置是 UX 与可维护性手段,**不是安全边界**(同 §13.27 教训:前端开关一定可被绕过)。
|
||||
|
||||
**守门与快照**:`tests/architecture-boundary-guard-test.js` 冻结「app.js ↔ src 耦合面」(**74** 项)与 `sourceModules` 顺序(**89** 项);新增模块、新增耦合、新增 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 耦合面」(**86** 项)与 `sourceModules` 顺序(**108** 项);新增模块、新增耦合、新增 dev 探针都**必须有意重生成对应快照**(`IWB_WRITE_BOUNDARY_SNAPSHOT=1`)。契约与行为的可执行验证在 `tests/plugin-host-test.js`(宿主单测)与 `tests/_plugin-host-probe.spec.js`(真实浏览器探针,`_` 前缀 + `iwb-dev-probe`,不进 34 门禁)。
|
||||
|
||||
**关键陷阱**:`normalizeNodes`(现位于 `src/canvas-normalize.js`)会**静默丢弃**不在 `NODE_H` 里的节点类型 ⇒ 新增节点类型必须先登记 `NODE_H`,否则节点一刷新就消失(§13.27 规则三的同一失败模式)。
|
||||
|
||||
|
||||
@@ -644,6 +644,8 @@ B-② 撤销/重做后图片真能解码显示,`naturalWidth=768`)· e2e `te
|
||||
5. **守门若依赖 git 历史(父提交 / 多提交比对),CI 必须用 `fetch-depth: 0`**。GitHub Actions 默认 `depth=1`(浅克隆)⇒ 父提交不可读 ⇒ 门禁要么崩、要么给出**错误的期望值**(实测踩过:`git show HEAD^` 报 `invalid object name`,守门误报失败)。本仓 CI 两个 job 均已设 `fetch-depth: 0`(仓库打包后仅 ~3MB,取全历史成本可忽略)。
|
||||
另:门禁自身**仍要做浅克隆检测**(`git rev-parse --is-shallow-repository`)并**降级为只校验版本**、打印 SKIP 而非打红 —— 这样在别处的浅克隆环境不会产生「无法解释的红」。(2026-10-20 实测:守门上线后 CI 首次运行即因浅克隆失败,改用 `fetch-depth: 0` + 降级判据后恢复。)
|
||||
|
||||
6. **锚点同步已自动化(2026-11-22)**:`scripts/publish-update.sh` 收尾调用 `scripts/set-doc-anchor.js`,把锚点写成「最近一次 bump 版本的提交」并**本地提交**(`docs: 锚点对齐 vX.Y.Z+<sha>(publish 自动)`)。护栏:`git show HEAD:package.json` 的版本与本地不一致(bump 未提交)时打印 WARN 并跳过,避免写错提交。手工改锚点仍然有效。
|
||||
|
||||
**验证方式**:`tests/architecture-facts-guard-test.js` 第 7 组(`npm run test:facts`)· 负例:把锚点改回旧 SHA ⇒ 打红并给出应填的 SHA。
|
||||
|
||||
## §13.37 源码文本钉点:全目录只减不增(2026-10-20)
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
# 原生浮层(子 WebView)的生命周期规范
|
||||
|
||||
> 适用:`src/canvas-webview.js` 以及任何“原生层永远在 DOM 之上”的视图(面板内嵌浏览器、画布网页节点、未来的原生覆盖层)。
|
||||
> 触发这份规范的事故:v3.26.33 —— 切换停靠栏面板后,旧网页画面滞留约 1 秒,盖住新面板。
|
||||
|
||||
## 1. 事故根因(一句话)
|
||||
|
||||
**DOM 锚点被移除后,宿主只安排了“900ms 后 close”,却没有先把原生层隐藏**;原生层始终在 DOM 之上,于是旧画面继续可见,直到 close 生效。
|
||||
|
||||
## 2. 三条硬规则
|
||||
|
||||
### R1 可见性跟着锚点走,当帧生效
|
||||
|
||||
- 锚点从 DOM 消失(组件卸载、面板切换、React 重建)⇒ **立即 park**(`visible:false`),不等任何定时器。
|
||||
- 锚点仍在但落在视口/画布/面板之外 ⇒ 同样 park(现有 tick 已覆盖)。
|
||||
|
||||
### R2 先隐藏,再延迟销毁
|
||||
|
||||
```
|
||||
锚点消失 → ① 立即 park(≤1 帧)
|
||||
→ ② 900ms 宽限后 close(仅在锚点确实没回来时)
|
||||
```
|
||||
|
||||
**禁止**把 ① 也放进定时器里。宽限期只用于避免“节点体短暂重建导致网页重载/丢滚动位置”,不能用于可见性。
|
||||
|
||||
### R3 视图/面板切换要整体 park
|
||||
|
||||
离开画布、切停靠栏面板、隐藏停靠栏、打开全屏遮罩时,都应对**所有**已打开视图调用 `parkAll()`。
|
||||
|
||||
## 3. 新增原生层时的检查清单
|
||||
|
||||
| 检查项 | 说明 |
|
||||
|---|---|
|
||||
| park on detach | 锚点移除路径里有**同步** park(不是 setTimeout 内) |
|
||||
| park on view change | 视图/面板切换时有整体 park |
|
||||
| park on overlay | 全屏遮罩/弹窗打开时 park |
|
||||
| close on unload | `beforeunload` 调 `close_all` |
|
||||
| 恢复不重载 | 宽限期内的重建复用同一视图 |
|
||||
| 坐标裁剪 | 面板/画布 overflow 对原生层无效,必须按矩形裁剪 |
|
||||
|
||||
## 4. 守门测试
|
||||
|
||||
`tests/native-overlay-park-test.js` 静态校验:
|
||||
|
||||
1. `detach()` 在 `setTimeout(... close ...)` **之前**存在 `push(..., false, ...)`;
|
||||
2. `setSuspended(true)` 会调用 `parkAll()`;
|
||||
3. 视图变化(离开 canvas)的 MutationObserver 里调用 `parkAll()`。
|
||||
|
||||
任何一条被破坏,`npm run verify:ci` 直接失败。
|
||||
|
||||
## 5. 自检话术(review 时问自己)
|
||||
|
||||
> “如果此刻锚点被移除,下一帧用户看到的会是什么?”
|
||||
> 答案必须是“立刻看不到”。
|
||||
@@ -0,0 +1,166 @@
|
||||
# Image Workbench 插件开发规范
|
||||
|
||||
> 版本:v1(2026-11-22)。面向官方与第三方插件;示例以 promptlib(提示词库)与 style-source(风格库)为准。
|
||||
> 相关文档:plugin-node-drag.md(节点拖入/指针交互踩坑)、plugin-node-outkind.md(下游连线声明)、plugin-theme.md(主题契约)。
|
||||
|
||||
## 1. 目录与基本结构
|
||||
|
||||
插件是「一个目录 + 一个 IIFE 入口」,由宿主在启用时动态加载并调用 register。
|
||||
|
||||
my-plugin/
|
||||
package.json # 版本 + ibwPlugin 元数据
|
||||
src/index.js # 入口(IIFE,末尾 IWBPluginHost.register)
|
||||
styles.css # 样式(必须自包含)
|
||||
README.md
|
||||
|
||||
package.json:
|
||||
|
||||
{
|
||||
"name": "@iwb-plugin/my-plugin",
|
||||
"version": "1.0.0",
|
||||
"ibwPlugin": { "id": "my-plugin", "entry": "src/index.js", "apiVersion": 1 }
|
||||
}
|
||||
|
||||
入口骨架:
|
||||
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
if (!global.IWBPluginHost) return
|
||||
global.IWBPluginHost.register({
|
||||
id: 'my-plugin',
|
||||
name: '我的插件',
|
||||
version: '1.0.0',
|
||||
capabilities: ['panels', 'canvas', 'canvasWrite'],
|
||||
settings: { panel: { type: 'custom', label: '设置', render: renderSettings } },
|
||||
mount: mount,
|
||||
unmount: unmount,
|
||||
}, function (ctx) {
|
||||
// setup:注册面板/节点/命令
|
||||
return { dispose () {} }
|
||||
})
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
|
||||
## 2. 能力(capabilities)与 ctx 映射
|
||||
|
||||
只申请用到的能力;能力名与 ctx 键不同:
|
||||
|
||||
| capability | ctx 键 | 用途 |
|
||||
|---|---|---|
|
||||
| panels | ctx.ui | 侧栏/独立面板注册 |
|
||||
| promptlib | ctx.promptlib | 提示词库数据 + 文件 + 备份 |
|
||||
| nodeTypes | ctx.nodes | 画布节点类型注册 |
|
||||
| canvas | ctx.canvas | 只读:getNodes / getSelectedNode / screenToWorld |
|
||||
| canvasWrite | ctx.canvasWrite | 写入:createNode / createImageNode / setNodeImage |
|
||||
| nodeActions | ctx.nodeActions | 节点右键/气泡动作 |
|
||||
| commands | ctx.commands | 命令面板 |
|
||||
| settings | ctx.settings | KV 配置 |
|
||||
| data | ctx.data | 插件数据文件 |
|
||||
|
||||
**注意**:createNode 在 ctx.canvasWrite,不在 ctx.canvas。调错只会提示“宿主不支持”。
|
||||
|
||||
## 3. 面板
|
||||
|
||||
ctx.ui.registerPanel({
|
||||
id: 'my-panel',
|
||||
title: '我的插件',
|
||||
mount (host) { /* 渲染到 host */ },
|
||||
unmount (host) { /* 清理定时器/监听 */ }
|
||||
})
|
||||
|
||||
- mount 只调用一次,内部自己管理重渲染。
|
||||
- 面板宽度可变:使用栅格/瀑布流,不要写死 px 宽度。
|
||||
- 面板内所有 DOM 事件在 unmount 时移除。
|
||||
|
||||
## 4. 节点类型
|
||||
|
||||
ctx.nodes.register({
|
||||
id: 'tpl',
|
||||
title: '模板节点',
|
||||
defaults: { outKind: 'prompt' },
|
||||
ports: { in: false, out: true },
|
||||
height: 360,
|
||||
render (node, props, host) { /* 首次建 DOM,之后 sync */ }
|
||||
})
|
||||
|
||||
宿主会生成类型 plugin:<插件id>:<变体id>。
|
||||
|
||||
**必须遵守**:
|
||||
|
||||
1. 输出文本/提示词 → data.outKind = 'prompt'(注册默认值、拖入数据、旧节点在 render 里自愈)。
|
||||
2. 拖入画布用指针拖拽,不用原生 HTML5 DnD:
|
||||
|
||||
pointerdown → pointermove(>5px) 幽灵卡片
|
||||
→ pointerup → ctx.canvas.screenToWorld(x,y)
|
||||
→ ctx.canvasWrite.createNode('tpl', wx, wy, data)
|
||||
|
||||
3. 输入框:未选中时 pointer-events: none,选中后才可编辑;只读 textarea 同样处理。
|
||||
4. 单击 = 选中/拖动,双击 = 编辑;不要用单击打开详情。
|
||||
5. 节点 render 必须可增量 sync,避免整块重建(输入框会丢焦点)。
|
||||
|
||||
## 5. 数据与文件
|
||||
|
||||
- 小数据:ctx.promptlib(或 ctx.data)JSON,单文件 < 1MB。
|
||||
- 大文件(封面/图片):ctx.promptlib.filePut/fileGet/fileList,落地在 plugin-data/<id>/files/。
|
||||
- dataUrlToBytes() 返回 { mime, bytes },不是 Uint8Array。
|
||||
- 备份:提供导出/导入 JSON;导入按 id 合并,提供“覆盖同 id”选项。
|
||||
- 迁移:旧格式在 setup 里做一次性迁移,失败要提示而不是静默丢数据。
|
||||
|
||||
## 6. 设置页面
|
||||
|
||||
宿主设置页内嵌渲染,不弹独立页面:
|
||||
|
||||
settings: {
|
||||
panel: { type: 'custom', label: '分组与备份', render: renderSettings }
|
||||
}
|
||||
|
||||
render 返回 DOM;宿主负责挂载/卸载。设置页适合放:
|
||||
|
||||
- 分组管理(新建/改名/排序/删除)
|
||||
- 数据备份(导出/导入)
|
||||
- 数据位置(打开数据目录)
|
||||
- 插件级开关/默认值
|
||||
|
||||
## 7. 样式规范
|
||||
|
||||
1. **自包含**:宿主基础样式会变;用到的宿主类按作用域复制一份(.iwb-myplugin …)。
|
||||
2. 统一前缀:面板/节点类名 my-plugin-*,避免与宿主 .iwb-* 冲突。
|
||||
3. 颜色走 CSS 变量:var(--iwb-text)、--iwb-panel、--iwb-border、--iwb-plugin-accent。
|
||||
4. 动画克制:只做 hover/press 反馈;不使用持续浮动动画。
|
||||
5. 深色主题:不写死 #fff/#000;主题契约测试会扫描。
|
||||
6. 悬停放大只缩放内层背景,不缩放卡片本体(避免命中区域漂移/闪烁)。
|
||||
7. 图片/封面 pointer-events: none,点击永远落到卡片。
|
||||
|
||||
## 8. 错误处理与提示
|
||||
|
||||
- 所有用户可见错误用 ctx.promptlib.notify / ctx.ui.toast,文案给“下一步怎么办”。
|
||||
- 异步链必须有 catch;不要吞掉错误后静默。
|
||||
- 崩溃日志:window.onerror 由宿主统一采集,插件不要自己覆盖。
|
||||
- 定时器/监听在 unmount/dispose 清理,避免面板切换后重复执行。
|
||||
|
||||
## 9. 测试与门禁
|
||||
|
||||
提交前至少:
|
||||
|
||||
node scripts/validate-plugins.js # manifest/能力/入口校验
|
||||
node scripts/theme-contract-test.js # 主题变量
|
||||
node tests/plugin-<id>-render-test.js # jsdom 渲染/交互
|
||||
|
||||
jsdom 可覆盖:面板渲染、节点 render/sync、拖拽插入(stub screenToWorld/createNode)、双击详情、保存回详情、封面 img。
|
||||
|
||||
## 10. 发布与市场
|
||||
|
||||
1. 改 package.json version 与入口 version(两处一致)。
|
||||
2. node scripts/sync-plugins-from-repo.js(同步到客户端 plugins/)
|
||||
3. node scripts/gen-market.js(生成 market/ 与 zip)
|
||||
4. 上传 market 到 NAS(tar + scp + 解压)
|
||||
5. 客户端发版:set-version → CHANGELOG → 锚点 → verify:ci → build → publish-update → releases/site → tag/push
|
||||
|
||||
## 11. 常见坑(务必先读)
|
||||
|
||||
- 原生 HTML5 拖放:WKWebView 吞 pointerup,节点落地后第一次点击异常 → 用指针拖拽。
|
||||
- ctx.canvas 没有 createNode → 用 ctx.canvasWrite。
|
||||
- 输入框拦截拖动 → 未选中时 pointer-events:none。
|
||||
- 只读 textarea 仍可选中文本 → pointer-events:none。
|
||||
- dataUrlToBytes 返回对象 → 取 .bytes。
|
||||
- 封面直接存 dataURL 会让 JSON 膨胀 → 迁移到文件,只存 { img }。
|
||||
- 插件节点不声明 outKind → 只能中继,无法直连生图。
|
||||
@@ -0,0 +1,151 @@
|
||||
# 插件样式 / 停靠栏 / 图库:2026-11-21 事故复盘与经验
|
||||
|
||||
> 适用版本:v3.25.9x → v3.26.20;涉及插件:promptlib / gallery / grouplib / style-source。
|
||||
> 这份文档记录「为什么会坏、怎么定位、怎么修、回滚要注意什么」,下次遇到同类现象先读它。
|
||||
|
||||
## 1. 事故时间线(浓缩)
|
||||
|
||||
| 版本 | 做了什么 | 结果 |
|
||||
|---|---|---|
|
||||
| 3.25.97 | 提示词封面改用 `{__blob}` 引用 | 编辑里能看到、列表看不到,重启可能丢 |
|
||||
| 3.26.0 | 封面改为内联压缩 dataURL | 封面可见了,`prompts.json` 涨到 1.7MB |
|
||||
| 3.26.5 | 清理死代码 + 删失效 CSS | 误删 `.iwb-lib-cards` 瀑布流列规则(单列化) |
|
||||
| 3.26.6~3.26.9 | 市场缓存、启动层、键盘可达、CSP nonce 兜底 | **插件样式全丢**(提示词库/风格库/图库变裸 HTML) |
|
||||
| 3.26.10 | **整体回滚到 v3.26.5** + promptlib 回 1.4.0 内容(版本号 1.4.6) | 功能恢复,但回滚带回了 1.4.0 的单列 bug |
|
||||
| 3.26.11~3.26.14 | 面板去重、拖宽跟手、底色调平、图库铺满 | 逐步收敛 |
|
||||
| 3.26.15~3.26.20 | 选中态收敛、小地图避让、图库缩略图缓存、插件灰跟随主题 | 稳定 |
|
||||
|
||||
## 2. 五个真实根因(都验证过)
|
||||
|
||||
### 2.1 CSP nonce 会整段丢弃动态 `<style>`
|
||||
|
||||
- 桌面端 CSP 带 nonce;CSP3 下 `unsafe-inline` 被忽略。
|
||||
- 宿主/插件用 `document.createElement('style')` 注入样式时**没有 nonce** → `style.sheet === null`,`document.styleSheets` 里也没有它。
|
||||
- 症状极具迷惑性:插件 DOM 正常、宿主外链 CSS 正常,唯独插件样式全丢(卡片塌成色条、图片按原始尺寸铺满)。
|
||||
- 判定方法:页面里执行
|
||||
```js
|
||||
const s = document.createElement('style'); s.textContent = '.x{color:red}'; document.head.appendChild(s);
|
||||
s.sheet === null // true ⇒ 被 CSP 丢弃
|
||||
```
|
||||
- 修复:给动态 `<style>` 复制页面上已有 nonce:`node.setAttribute('nonce', document.querySelector('style[nonce],link[nonce]').nonce)`。
|
||||
- **注意**:后来 3.26.10 回滚后,用 v3.26.5 那套样式注入在 1.4.7 插件下显示正常——说明**并非所有注入路径都会触发**,与注入时机/上下文有关。结论:不要依赖单一假设,先用上面的判定法验证。
|
||||
|
||||
### 2.2 插件样式注入与激活存在竞态
|
||||
|
||||
- 宿主在 load 时把 CSS 暂存到 `pendingStyles[id]`,**激活插件时**才 `applyStyleFor(id)`。
|
||||
- 若插件已处于激活状态(热更新、切面板、拖拽重载),`applyStyleFor` 不会再执行 → 有 DOM 无样式。
|
||||
- 修复方向(二选一,最终都用了):
|
||||
1. 插件**自带样式**(把 CSS 内联进 bundle,脚本执行时注入);
|
||||
2. 宿主在激活时若 `pendingStyles` 为空,从磁盘补读一次再注入。
|
||||
|
||||
### 2.3 `registerPanel` 只 push 不替换 → 面板图标越拖越多
|
||||
|
||||
- 插件每次重新加载都会注册一次面板,宿主直接 `wPluginPanels.push(entry)`。
|
||||
- 重复 id 进入停靠栏状态 `iwb.dock.v1` 后,**重启也还在**;把右侧那份拖到左侧只会移动其中一份,所以“右边的不会消失”。
|
||||
- 修复(两层都要做,缺一不可):
|
||||
- 注册层:同 `pluginId + id` 先删除旧条目再插入;
|
||||
- 持久层:打开时同侧去重;同一 id 同时出现在左右两侧时只保留左侧;默认面板回填时跳过另一侧已存在的 id。
|
||||
|
||||
### 2.4 图库“要拖一下窗口才显示图片”
|
||||
|
||||
- 图库列宽由测得的面板宽度算出,而 `grid` 自身宽度又由列宽决定(`flex-start` + 内容宽度)。
|
||||
- 于是 `grid.clientWidth` 首帧为 0,之后**永远不会变化** → `ResizeObserver` 不触发 → 一直空白。
|
||||
- 修复:量**会随面板拉伸的外层容器**(`wrap` / 父节点),并加三重兜底:
|
||||
- 挂载后 rAF 连续重试(最多 40 帧);
|
||||
- 可见后(IntersectionObserver 命中)重测重排;
|
||||
- 120/400/900ms 各补一次。
|
||||
- 副作用:重排会重建 DOM,导致缩略图重复请求(每张图请求 N 次、部分一直“加载中”)。**必须配缩略图缓存 + 进行中 Promise 共享**(gallery 1.6.9)。
|
||||
|
||||
### 2.5 封面:引用 vs 内联
|
||||
|
||||
- `{__blob}`(IndexedDB 引用)跨会话/跨解析时序不可靠:编辑弹窗能看到(自己刚写的),列表与重启后丢失。
|
||||
- 内联 dataURL 可靠但撑大 `prompts.json`(33 条 1.7MB)。
|
||||
- 取舍:先用内联(≤448px WebP)保证“任何时候都看得见”,体积问题单独做迁移/文件型 ref 解决——**不要一次改动同时解决“可靠性 + 体积”**。
|
||||
|
||||
## 3. 回滚细节(最容易踩)
|
||||
|
||||
这次最终靠“回滚到 v3.26.5”才恢复,过程中有 4 个坑:
|
||||
|
||||
1. `git checkout v3.26.5 -- .` **只覆盖已存在的文件,不会删除新增文件**。必须补:
|
||||
```bash
|
||||
comm -13 <(git ls-tree -r --name-only v3.26.5 | sort) <(git ls-tree -r --name-only HEAD | sort) | xargs rm -f
|
||||
```
|
||||
2. **插件版本号必须大于线上版本**,否则市场“检查更新”不会降级。做法:内容回退到 1.4.0,但版本号标 **1.4.6**。
|
||||
3. **回滚会带回旧 bug**:1.4.0 清理 CSS 时误删过 `.iwb-lib-cards` 瀑布流规则,回滚后列表变单列。回滚后必须跑一遍 UI 冒烟(列表/图库/面板图标)。
|
||||
4. **回滚也要走完整发布仪式**:CHANGELOG 条目、`docs/standards/architecture-current-state.md` 的 `main = <sha>` 与 `线上 vX.Y.Z+<sha>` 锚点,否则 `verify:ci` 直接挂。
|
||||
|
||||
## 4. 定位工具(可复用)
|
||||
|
||||
宿主写一行探针,外部用 sqlite 读,不依赖 devtools:
|
||||
|
||||
```js
|
||||
// app.js 临时 effect(排查完必须删)
|
||||
localStorage.setItem('iwb_dbg', JSON.stringify({
|
||||
cards: document.querySelectorAll('.iwb-plp-card').length,
|
||||
sheets: document.styleSheets.length,
|
||||
styles: [...document.querySelectorAll('style')].map(n => (n.getAttribute('data-plugin') || 'host') + '|sheet=' + !!n.sheet),
|
||||
computed: (() => { const el = document.querySelector('.iwb-plp-card'); const st = el && getComputedStyle(el)
|
||||
return st ? { display: st.display, aspect: st.aspectRatio, border: st.borderTopWidth, w: el.getBoundingClientRect().width } : null })(),
|
||||
}))
|
||||
```
|
||||
|
||||
```bash
|
||||
python3 - <<'PY'
|
||||
import sqlite3, glob
|
||||
for d in glob.glob('/Users/qiqi/Library/WebKit/com.malongan.imageworkbench/WebsiteData/Default/*/*/LocalStorage/localstorage.sqlite3'):
|
||||
con = sqlite3.connect(d)
|
||||
for k, v in con.execute("select key,value from ItemTable where key='iwb_dbg'"):
|
||||
print(bytes(v).decode('utf-16-le','ignore'))
|
||||
PY
|
||||
```
|
||||
|
||||
关键判据:`sheet=false` ⇒ 样式没参与计算;`computed` 里 `display/aspect/border` 与预期不符 ⇒ 规则未命中;`w` 为 0 或明显大于容器 ⇒ 宽度测量问题。
|
||||
|
||||
## 5. 发布纪律(这次最大的教训)
|
||||
|
||||
| 规则 | 原因 |
|
||||
|---|---|
|
||||
| **一次发布只改一件事** | 3.26.6~3.26.9 把 5 个改动塞进连续 4 个版本,坏掉后无法二分定位,只能整体回滚 |
|
||||
| 改插件样式/布局后**先本机截图自检**,再请用户确认 | 很多问题在截图里一眼可见(单列、色条、白块) |
|
||||
| 改完跑 `npm run verify:ci`(exit 0 才算完) | ratchet / 耦合快照 / 文档锚点 / 插件主题契约都在里面 |
|
||||
| 保底手段是“小步回滚”,不是“继续叠加修复” | 连续 2 次猜错就停手回滚,别再加变量 |
|
||||
|
||||
## 6. 守门与快照清单(新增代码时容易忘)
|
||||
|
||||
- `MAX_APP_JS_LINES`:app.js 行数棘轮,新逻辑放 `src/<domain>-*.js`;确需增长要同步上调并写明理由。
|
||||
- `MAX_WORKBENCH_LINES`:`Workbench()` 行数上限。
|
||||
- 耦合面快照:新增 `window.IWB*` 导出后要 `IWB_WRITE_BOUNDARY_SNAPSHOT=1 node tests/architecture-boundary-guard-test.js`,并同步文档里的“耦合面 N 项”。
|
||||
- 插件主题契约:插件里禁止写死颜色;`color: #fff`(压在图片/渐变上的白字)已列入例外。
|
||||
- 文档锚点:每次 bump 版本后更新 `main = <sha>` 与 `线上 vX.Y.Z+<sha>`。
|
||||
|
||||
## 7. 一句话结论
|
||||
|
||||
> 插件样式出问题,先分清「CSS 没生效」还是「规则写错了」——用 `style.sheet` + `getComputedStyle` 两个判据,一次就能定位;
|
||||
> 发布时一次只动一件事,坏了好回滚;回滚后必须跑 UI 冒烟,因为回滚会带回旧 bug。
|
||||
|
||||
## 8. 第二批问题(3.26.21 – 3.26.27)
|
||||
|
||||
| # | 现象 | 根因 | 修法 |
|
||||
|---|---|---|---|
|
||||
| 1 | 封面单张 300KB,`prompts.json` 1.1MB | WebP 编码不可用时回退成 448px PNG | putCover 增加 JPEG 兜底(webp→jpeg→原图取小);实测 261KB |
|
||||
| 2 | 每次切面板都弹「已压缩 N 张封面」 | 迁移阈值按体积 60KB,JPEG 封面 75KB 永远命中 | 条件改为 PNG 或 >150KB,且只有内容变化才保存/提示 |
|
||||
| 3 | 更新/重启后左右栏摆放被打回默认 | 启动瞬间 panels 为空,整理逻辑删掉未注册 id 并写盘 | 不丢未注册 id;active 在 list 内则保持;面板为空不写盘 |
|
||||
| 4 | 重启后当前面板从提示词库变浏览器 | active 在未加载时被回退成 list[0] | 同上(保持 active) |
|
||||
| 5 | 图库部分格子永远“加载中…” | 重测会重建 DOM,缩略图被重复请求 | 缓存 URL + 共享 Promise + 微任务绘制 + 700ms 坏图快速失败 |
|
||||
| 6 | 插件主题契约“看起来全,实际只查 2 个文件” | 只扫 .js 且只统计含颜色声明的文件 | 扫 .js + .css 全量(8 个),补白字例外 |
|
||||
|
||||
### 8.1 停靠栏持久化的通用教训
|
||||
|
||||
持久化状态 + 异步依赖(插件/面板注册)组合时:
|
||||
|
||||
1. 清理只作用于渲染,不回写存储;未注册的 id 必须保留,等它加载。
|
||||
2. 写盘要有「依赖就绪」守卫,否则会用空集合覆盖用户数据。
|
||||
3. 变更检测用内容比较而不是长度比较——去重(-1) 与回填(+1) 同时发生时长度不变,旧实现会漏检。
|
||||
|
||||
### 8.2 插件市场设计约束(用户裁定)
|
||||
|
||||
- 卡片:淡描边可,不要位移/上浮;只允许颜色变化。
|
||||
- 已安装:名字后徽标;不要绿底、不要绿点。
|
||||
- 按钮:浅色底;已安装只保留移除,不要重装。
|
||||
- 管理页:横线分隔,不要块面卡片与浮动。
|
||||
- 设置页不要限宽,网格随窗口自适应。
|
||||
@@ -0,0 +1,55 @@
|
||||
# 插件节点:拖入、渲染与指针交互踩坑记录(promptlib 实战)
|
||||
|
||||
> 来源:提示词库 1.6.x 接入画布节点时连续踩到的问题。新增「带变量的插件节点」前先读一遍。
|
||||
|
||||
## 1. 拖入画布:不要用原生 HTML5 drag&drop
|
||||
|
||||
**现象**:节点拖进画布后,第一次点击要么选中文本、要么拖不动;点一下空白再点节点才正常。
|
||||
|
||||
**原因**:WKWebView 在原生拖放期间吞掉 pointerup/mouseup,落点节点带着焦点/手势残留。宿主很难在 drop 后完全复位。
|
||||
|
||||
**正确做法**(对齐风格库):自己实现指针拖拽:
|
||||
|
||||
pointerdown → pointermove(>5px) → 出现跟手幽灵卡片
|
||||
pointerup → ctx.canvas.screenToWorld(x, y) → ctx.canvasWrite.createNode(type, x, y, data)
|
||||
|
||||
- 不要 draggable=true,不要 dataTransfer
|
||||
- 不要 preventDefault() pointerdown(会吞掉 click/dblclick)
|
||||
- 卡片加 user-select:none,避免拖拽选中标题文字
|
||||
|
||||
## 2. 宿主能力是拆开的:canvas / canvasWrite
|
||||
|
||||
| 能力 | 方法 |
|
||||
|---|---|
|
||||
| ctx.canvas | 只读:getNodes / getSelectedNode / screenToWorld |
|
||||
| ctx.canvasWrite | 写入:createNode / createImageNode / setNodeImage |
|
||||
|
||||
createNode **不在** ctx.canvas 上;调错只会得到“宿主不支持”的提示。manifest 的 capabilities 要同时声明 canvas 与 canvasWrite。
|
||||
|
||||
## 3. 新建节点交给宿主创建,不要手工 commit
|
||||
|
||||
宿主 addPluginNode 会:拼 plugin:<id>:<variant> 类型、按变体宽度、**先选中再提交**。手工 commitCanvas 容易漏选中/漏默认值,还会让第一次点击变成“先选中”。
|
||||
|
||||
## 4. 连线能力:声明 outKind
|
||||
|
||||
节点要直连生图/润色/文本/组合,必须 data.outKind = 'prompt'(注册默认值 + 拖入数据 + 旧节点自愈三处),详见 plugin-node-outkind.md。
|
||||
|
||||
## 5. 输入框与拖动
|
||||
|
||||
- 节点内的 <input> 会让宿主只选中、不拖动(宿主把 input 视为可交互控件)
|
||||
- 未选中时给输入框 pointer-events: none,让点击/拖动落到节点本体;选中后再允许输入
|
||||
- 只读 <textarea> 也要 pointer-events: none,否则单击会选中文本
|
||||
|
||||
## 6. 插件样式必须自包含
|
||||
|
||||
宿主基础样式会变。插件需要把用到的宿主类按作用域复制一份(.iwb-promptlib …),不要假设宿主类名/结构长期稳定。
|
||||
|
||||
## 7. 文件与 dataURL
|
||||
|
||||
- dataUrlToBytes() 返回 { mime, bytes },不是 Uint8Array
|
||||
- 封面等大字段迁移到 plugin-data/<id>/files/,JSON 只留 { img: 文件名 }
|
||||
- 读文件走 ctx.promptlib.fileGet(能力声明 promptlib),不要依赖 ctx.files
|
||||
|
||||
## 8. 图片被覆盖后如何保留原图
|
||||
|
||||
宿主 canvasWrite.setNodeImage 覆盖前会把原图备份到 data.orig;右键节点可「还原替换前原图」。插件侧覆盖时不要自己清除 data.orig。
|
||||
@@ -0,0 +1,34 @@
|
||||
# 插件节点的下游连线声明(outKind)
|
||||
|
||||
> 适用:任何需要在画布上输出「一段文本/提示词」的插件节点(示例:风格库样式节点、提示词库模板节点)。
|
||||
|
||||
## 1. 为什么需要声明
|
||||
|
||||
宿主的连线白名单(`src/canvas-geometry.js`)按**节点语义**判断能否连到下游(生图 / 润色 / 文本 / 组合 / 连接)。
|
||||
插件节点的 `type` 是运行时注册的 `plugin:<插件id>:<变体id>`,宿主静态表里没有,无法预知它输出什么。
|
||||
|
||||
因此约定一个显式声明:
|
||||
|
||||
```js
|
||||
node.data.outKind = 'prompt' // 这一路输出的是提示词
|
||||
```
|
||||
|
||||
声明后,该节点在连线规则里**等同内置提示词节点**:可直接连到生图 / 润色 / 文本 / 组合 / 连接;
|
||||
不声明则只能通过「中继」节点转接。
|
||||
|
||||
## 2. 怎么声明(插件侧)
|
||||
|
||||
三处都要覆盖,缺一处就会出现「新拖的能连、旧节点不能连」:
|
||||
|
||||
1. **注册默认值**(所有 `ctx.canvas.createNode` 路径生效):
|
||||
```js
|
||||
ctx.nodes.register({ id: 'ptpl', defaults: { outKind: 'prompt' }, … })
|
||||
```
|
||||
2. **宿主拖拽落点**:拖拽 payload 里带 `outKind`,宿主创建节点时写入 `data.outKind`。
|
||||
3. **旧节点自愈**:节点 `render` 时若 `data.outKind !== 'prompt'`,调 `props.onUpdate(id, { outKind: 'prompt' })` 补一次。
|
||||
|
||||
## 3. 宿主侧约束
|
||||
|
||||
- 白名单数组(`canvas-geometry.js` 的 7 条规则)是**宿主所有**,插件不得修改;插件只声明语义。
|
||||
- `outKind` 目前只支持 `'prompt'`;新增语义(如图片、分组)需先在宿主补规则并写测试。
|
||||
- 声明缺失时行为保持旧状(只能中继),不会破坏已有画布。
|
||||
@@ -0,0 +1,68 @@
|
||||
# 插件主题契约(plugin-theme)
|
||||
|
||||
> 版本:v3.25.89 起。宿主与插件的**唯一**配色接口。
|
||||
> 目的:插件不再自己决定颜色,改一处(种子/滑块)全部插件跟着变。
|
||||
|
||||
## 1. 四层语义(插件面板必须分层)
|
||||
|
||||
| 语义 | Token | 亮色默认 | 用在哪 |
|
||||
|---|---|---|---|
|
||||
| 结构层 | `--iwb-dock-bg` | `#E2E4E6` | 停靠栏 / 标签条 / 状态栏(宿主自己的层) |
|
||||
| 插件面板 | `--iwb-plugin-surface` | `#FAFAFB` | 面板根容器(**不要用纯白**) |
|
||||
| 卡片 | `--iwb-plugin-card` | `#FFFFFF` | 面板里的卡片 / 列表项 |
|
||||
| 内嵌 | `--iwb-plugin-inset` | `#F6F7F8` | 输入框底 / 分组底 / 斑马纹 |
|
||||
| 悬停 | `--iwb-plugin-hover` | `#EEF1F4` | 行 / 卡片 hover |
|
||||
|
||||
## 2. 规则
|
||||
|
||||
1. **只用变量**:`--iwb-plugin-*` 或 `--iwb-*`,禁止写死 `#hex` / `rgba()`。
|
||||
(守门测试 `tests/plugin-theme-contract-test.js` 会卡)
|
||||
2. **面板根不画底色**:宿主已给 `--iwb-plugin-surface`;插件根容器只写 `background: var(--iwb-plugin-surface)`。
|
||||
3. **卡片才用 card**:列表项/卡片用 `--iwb-plugin-card`,这样「浅灰底 + 白卡片」的层次才成立。
|
||||
4. **文字层级**:主文字 `--iwb-plugin-text`,次要 `--iwb-plugin-text2`,品牌 `--iwb-plugin-brand`(底色上的字用 `--iwb-plugin-on-brand`,宿主按对比度自动黑/白)。
|
||||
5. **语义色**:错误 `--iwb-plugin-err`、成功 `--iwb-plugin-ok`、警告 `--iwb-plugin-warn`。
|
||||
|
||||
## 3. 作用域重映射(为什么插件不用改代码)
|
||||
|
||||
宿主在插件容器内把旧变量重指到插件层:
|
||||
|
||||
```css
|
||||
.iwb-dock-body, .iwb-node-body .iwb-plugin-body, .iwb-cwv-panel-body {
|
||||
--iwb-panel: var(--iwb-plugin-surface);
|
||||
--iwb-layer2: var(--iwb-plugin-card);
|
||||
--iwb-layer: var(--iwb-plugin-inset);
|
||||
--iwb-hover: var(--iwb-plugin-hover);
|
||||
}
|
||||
```
|
||||
|
||||
所以插件里已有的 `background: var(--iwb-layer2, #fff)` 会自动变成「卡片白」,
|
||||
`var(--iwb-layer, #f5f6f8)` 自动变成「内嵌灰」——**不需要重新打包插件**。
|
||||
|
||||
## 4. 批量调节
|
||||
|
||||
- 外观 → **插件面板 → 底色深浅**(0~30,默认 12)
|
||||
- 该值进入 `theme-tokens.js` 的 `pluginTint`,与 4 个种子一起派生
|
||||
- 改这一个滑块 = 所有插件面板同时变化
|
||||
|
||||
## 5. 新增插件时的自查
|
||||
|
||||
- [ ] 面板根:`background: var(--iwb-plugin-surface)`
|
||||
- [ ] 卡片:`background: var(--iwb-plugin-card)`
|
||||
- [ ] 输入框/内嵌块:`background: var(--iwb-plugin-inset)`
|
||||
- [ ] hover:`background: var(--iwb-plugin-hover)`
|
||||
- [ ] 没有任何 `#` 开头的颜色字面量(`var(--x, #hex)` 的兜底除外)
|
||||
|
||||
## 事故复盘(必读)
|
||||
|
||||
插件“有 DOM 没样式”、面板重复、图库首屏空白这一类问题的完整根因与定位方法见:`docs/standards/plugin-dock-incident-2026-11.md`。
|
||||
|
||||
- 先判断「CSS 没生效」还是「规则写错」:`style.sheet === null` ⇒ 没生效(CSP nonce / 注入时机)。
|
||||
- 插件只引用 `--iwb-plugin-*`,这些 token 由 `theme-tokens` 按主题派生(亮/暗自动切换)。
|
||||
|
||||
## 相关规范
|
||||
|
||||
- 原生浮层(面板内嵌浏览器 / 画布网页节点)的生命周期见 `docs/standards/native-overlay-lifecycle.md`(先 park 再 close,禁止把隐藏放进定时器)。
|
||||
|
||||
## 相关规范
|
||||
|
||||
- 插件节点要直连下游(生图/润色/文本…)需声明 `data.outKind = 'prompt'`,见 `docs/standards/plugin-node-outkind.md`。
|
||||
@@ -0,0 +1,53 @@
|
||||
# promptlib 迭代复盘(2026-11-22)
|
||||
|
||||
> 记录本轮提示词库 1.6.6 → 1.8.8 迭代中遇到的问题、根因与必须遵守的做法。
|
||||
|
||||
## 1. 发布纪律(最大教训)
|
||||
|
||||
- 每次改动同时做三件事:插件 package.json version、入口 version、市场发布(gen-market + 上传 NAS)。
|
||||
- 只在本机手工替换 manifest 不上市场,用户端永远是旧版本。
|
||||
- 发布前必须 node --check;1.8.5 曾因转义把正则写成真实换行,语法损坏。
|
||||
- 上市场后让用户「刷新市场 → 更新」,必要时重启。
|
||||
|
||||
## 2. 拖入画布(不要用原生 HTML5 DnD)
|
||||
|
||||
- 原生 drag&drop 在 WKWebView 吞掉 pointerup,落点节点带焦点残留。
|
||||
- 用 pointerdown → pointermove(>5px) 幽灵 → pointerup → canvas.screenToWorld → canvasWrite.createNode。
|
||||
- 落点 = 鼠标位置 = 节点左上角(对齐风格库),不要居中偏移。
|
||||
- 拖拽期间 body 加 user-select:none。
|
||||
|
||||
## 3. 详情插入:两步放置
|
||||
|
||||
- 点插入后关闭详情 → 跟手灰色小方框(112×112,左上角对齐鼠标)→ 点击画布落点;Esc 取消。
|
||||
|
||||
## 4. 编辑面板
|
||||
|
||||
- 三栏:左 236 固定 / 中自适应 / 右可变(默认 300,190–460),分割条 6px。
|
||||
- 正文 flex:1 到底;变量区独立滚动。
|
||||
- 变量 = 单个输入框,与正文双向同步;重名阻止并回退。
|
||||
- i 按钮展开说明,可多开、各自收起;说明透明背景 + 虚线框。
|
||||
- 正文变量高亮覆盖层与 textarea 的字体/行高/内边距必须一致,否则光标错位;程序改 value 后手动重绘。
|
||||
- 标签用输入框 + 加号生成 chips,可删除。
|
||||
|
||||
## 5. 详情面板
|
||||
|
||||
- 左卡片:封面 contain 完整展示 → 标题 14px → 分割线 → 分组/标签/字数(去底色、带冒号、行间浅线)。
|
||||
- 右卡片:标题 + 正文独立滚动(flex + min-height:0 + overflow:auto)。
|
||||
- 左右卡片等距等高,align-items: stretch,否则右侧没有滚动条。
|
||||
- 右上角编辑 + 关闭;底部插入沿用两步放置;编辑取消回到详情。
|
||||
|
||||
## 6. 节点与输出
|
||||
|
||||
- 变量输入框 placeholder = 说明文字。
|
||||
- 节点保存 tpl(含变量,供编辑)与 text(填值后剔除未填占位,供下游/生图)。
|
||||
- 旧节点 render 时自愈 text。
|
||||
|
||||
## 7. 样式
|
||||
|
||||
- 输入框比底色更亮 + 极浅描边,聚焦纯白 + 淡紫光圈;不要深灰条。
|
||||
- 变量行不要套边框;说明透明 + 虚线。
|
||||
- 插件样式自包含;参考 docs/standards/plugin-development.md 与 plugin-node-drag.md。
|
||||
|
||||
## 8. 版本记录
|
||||
|
||||
1.6.6 封面文件化 / 1.6.7 outKind / 1.6.15 指针拖拽 / 1.6.18–19 落点 / 1.6.20 封面插入 / 1.6.21 两步放置 / 1.6.22–23 放置框 / 1.7.0 三栏编辑 / 1.7.1 视觉精修 / 1.7.2 变量黑粗 / 1.7.3 正文显示 / 1.7.4 名称可拖高 / 1.7.5–1.7.6 封面 contain + 取消回详情 / 1.7.7 字体度量 / 1.7.8 重绘 / 1.7.9 滚动 / 1.8.0 标题下移 + 标签编辑器 / 1.8.1 元信息 / 1.8.2 卡片化 / 1.8.3–1.8.4 布局 / 1.8.5–1.8.6 输出剔除变量 / 1.8.7–1.8.8 细节。
|
||||
@@ -0,0 +1,38 @@
|
||||
# promptlib 样式基线与插入变量规则(2026-11-23 定稿)
|
||||
|
||||
## 一、正确的样式基线
|
||||
|
||||
- **样式基线 = promptlib v1.8.8**(插件仓 commit `178b36c`)
|
||||
- 当前版本 v1.8.17 的 `styles.css` 与 1.8.8 视觉一致,仅在颜色值外做了无副作用的 `var(--plp-cN, #原色)` 兜底包装
|
||||
- 以后任何 UI 调整都以此基线为起点,先 `git diff 178b36c -- promptlib/styles.css` 看差异
|
||||
|
||||
回滚命令:
|
||||
|
||||
```bash
|
||||
cd iwb-plugins-desktop
|
||||
git checkout 178b36c -- promptlib/styles.css promptlib/src/index.js
|
||||
```
|
||||
|
||||
## 二、这次错误的根因(禁止重犯)
|
||||
|
||||
1. **不要批量替换颜色 token**:为了过主题契约,曾用脚本把 `color/border/background` 统一替换成 `--iwb-plugin-*`,结果把文字色换成了边框色 → 变量/输入框文字不可见、灰块。
|
||||
2. **不要用脚本重写 CSS 声明**:多声明一行、伪类(`:focus`)都会被破坏;曾出现 `: focus` 导致焦点样式全失效。
|
||||
3. **修改后必须先做视觉验证**:静态 HTML + Playwright 截图,或真机截图,再上市场;不要连续猜着发版。
|
||||
4. **主题契约的安全做法**:只把颜色包成 `var(--plp-cN, #原色)`(不定义变量,保留原色),或 `var(--iwb-*, #原色)` 且确保语义正确;禁止改变视觉。
|
||||
|
||||
## 三、插入变量的正确实现
|
||||
|
||||
- 工具栏按钮 `pointerdown` 必须 `preventDefault()`,避免抢走 textarea 焦点/选区
|
||||
- 记录选区只在 `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)
|
||||
- **不要用 `document.execCommand("insertText")`**:WKWebView 内部光标与 `selectionStart` 会漂移,第一次正常、第二次起偏移一个字符(v1.8.16 实测)
|
||||
|
||||
## 四、发布前检查清单
|
||||
|
||||
1. `node --check src/index.js`
|
||||
2. 同步客户端后跑 `tests/plugin-theme-contract-test.js`
|
||||
3. 静态渲染截图核对:编辑弹窗 / 详情弹窗(颜色、滚动、输入框描边)
|
||||
4. 再 bump 版本 + 上市场(gen-market + 上传 NAS)
|
||||
5. 版本号三处一致;市场 index.json 版本正确
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "image-workbench-web",
|
||||
"private": true,
|
||||
"version": "3.25.34",
|
||||
"version": "3.26.41",
|
||||
"description": "Browser-based node canvas image workbench",
|
||||
"scripts": {
|
||||
"build": "node scripts/build.js && node scripts/copy-plugins.js",
|
||||
@@ -10,7 +10,7 @@
|
||||
"app:build": "tauri build",
|
||||
"lint": "eslint src app.js",
|
||||
"test": "node tests/relay-task-graph-fixture-test.js && node tests/plugin-style-node-test.js && node tests/inherit-text-test.js",
|
||||
"test:unit": "node tests/unit-test.js && node tests/canvas-actions-test.js && node tests/canvas-performance-test.js && node tests/canvas-drag-performance-test.js && node tests/resize-observer-performance-test.js && node tests/node-drag-jank-test.js && node tests/edge-graph-performance-test.js && node tests/persistence-export-images-test.js && node tests/settings-hotkeys-size-presets-test.js && node tests/custom-size-validation-test.js && node tests/image-node-performance-test.js && node tests/drag-frame-performance-test.js && node tests/canvas-edge-memo-test.js && node tests/canvas-node-transform-test.js && node tests/canvas-dot-zoom-test.js && node tests/duplicate-ws-fresh-source-test.js && node tests/single-canvas-shell-test.js && node tests/navigation-layout-test.js && node tests/home-canvas-library-test.js && node tests/left-resource-layout-test.js && node tests/interface-hierarchy-test.js && node tests/three-page-layout-test.js && node tests/page-chrome-regression-test.js && node tests/task-cache-test.js && node tests/storage-config-shape-test.js && node tests/storage-zip-test.js && node tests/canvas-node-factory-test.js && node tests/runtime-error-test.js && node tests/runtime-lifecycle-test.js && node tests/runtime-fetch-test.js && node tests/runtime-channel-test.js && node tests/runtime-boundary-test.js && node tests/runtime-record-test.js && node tests/runtime-recovery-test.js && node tests/runtime-diagnostic-record-test.js && node tests/runtime-metrics-test.js && node tests/runtime-run-context-test.js && node tests/runtime-execution-context-test.js && node tests/storage-gc-canvas-refs-test.js && node tests/storage-health-test.js && node tests/generation-state-test.js && node tests/canvas-store-test.js && node tests/storage-result-test.js && node tests/storage-local-test.js && node tests/storage-domain-test.js && node tests/storage-runtime-test.js && node tests/storage-indexeddb-test.js && node tests/generation-scheduler-test.js && node tests/gallery-query-test.js && node tests/gallery-hydration-test.js && node tests/image-blob-store-test.js && node tests/image-preview-derive-test.js && node tests/image-format-test.js && node tests/clipboard-graph-test.js && node tests/clipboard-graph-fallback-test.js && node tests/image-admit-test.js && node tests/image-dedupe-test.js && node tests/clipboard-kind-test.js && node tests/clipboard-paste-test.js && node tests/clipboard-copy-test.js && node tests/paste-once-test.js && node tests/list-e2e-specs-test.js && node tests/desktop-csp-loopback-test.js && node tests/architecture-boundary-guard-test.js && node tests/plugin-host-test.js && node tests/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/ui-groups-sidebar-test.js && node tests/ui-lib-sidebar-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/prompt-md-roundtrip-test.js && node tests/generation-results-store-test.js && node tests/out-groups-order-test.js && node tests/ui-workbench-hooks-test.js",
|
||||
"test:unit": "node tests/plugin-archive-test.js && node tests/plugin-files-policy-test.js && node tests/theme-plugin-tokens-test.js && node tests/image-prompt-cover-test.js && node tests/unit-test.js && node tests/canvas-actions-test.js && node tests/canvas-performance-test.js && node tests/canvas-drag-performance-test.js && node tests/resize-observer-performance-test.js && node tests/node-drag-jank-test.js && node tests/edge-graph-performance-test.js && node tests/persistence-export-images-test.js && node tests/settings-hotkeys-size-presets-test.js && node tests/custom-size-validation-test.js && node tests/image-node-performance-test.js && node tests/drag-frame-performance-test.js && node tests/canvas-edge-memo-test.js && node tests/canvas-node-transform-test.js && node tests/canvas-dot-zoom-test.js && node tests/duplicate-ws-fresh-source-test.js && node tests/single-canvas-shell-test.js && node tests/navigation-layout-test.js && node tests/home-canvas-library-test.js && node tests/left-resource-layout-test.js && node tests/interface-hierarchy-test.js && node tests/three-page-layout-test.js && node tests/page-chrome-regression-test.js && node tests/task-cache-test.js && node tests/storage-config-shape-test.js && node tests/storage-zip-test.js && node tests/canvas-node-factory-test.js && node tests/runtime-error-test.js && node tests/runtime-lifecycle-test.js && node tests/runtime-fetch-test.js && node tests/runtime-channel-test.js && node tests/runtime-boundary-test.js && node tests/runtime-record-test.js && node tests/runtime-recovery-test.js && node tests/runtime-diagnostic-record-test.js && node tests/runtime-metrics-test.js && node tests/runtime-run-context-test.js && node tests/runtime-execution-context-test.js && node tests/storage-gc-canvas-refs-test.js && node tests/storage-health-test.js && node tests/generation-state-test.js && node tests/canvas-store-test.js && node tests/storage-result-test.js && node tests/storage-local-test.js && node tests/storage-domain-test.js && node tests/storage-runtime-test.js && node tests/storage-indexeddb-test.js && node tests/generation-scheduler-test.js && node tests/gallery-query-test.js && node tests/gallery-hydration-test.js && node tests/image-blob-store-test.js && node tests/image-preview-derive-test.js && node tests/image-format-test.js && node tests/clipboard-graph-test.js && node tests/clipboard-graph-fallback-test.js && node tests/image-admit-test.js && node tests/image-dedupe-test.js && node tests/clipboard-kind-test.js && node tests/clipboard-paste-test.js && node tests/clipboard-copy-test.js && node tests/paste-once-test.js && node tests/list-e2e-specs-test.js && node tests/desktop-csp-loopback-test.js && node tests/architecture-boundary-guard-test.js && node tests/plugin-host-test.js && node tests/plugin-data-test.js && node tests/plugin-loader-test.js && node tests/plugin-bundle-test.js && node tests/plugin-install-test.js && node tests/plugin-gallery-render-test.js && node tests/plugin-gallery-recovery-test.js && node tests/plugin-gallery-ux-test.js && node tests/plugin-grouplib-render-test.js && node tests/plugin-promptlib-render-test.js && node tests/image-compress-test.js && node tests/storage-fallback-indexeddb-test.js && node tests/canvas-normalize-test.js && node tests/canvas-geometry-test.js && node tests/canvas-history-test.js && node tests/canvas-ops-test.js && node tests/canvas-text-test.js && node tests/history-store-test.js && node tests/plugin-integrity-test.js && node tests/workspace-sessions-store-test.js && node tests/workspace-list-test.js && node tests/workspace-purge-test.js && node tests/provider-ping-test.js && node tests/runtime-diagnostics-hotpath-test.js && node tests/storage-log-failure-test.js && node tests/storage-convergence-test.js && node tests/swallow-wiring-test.js && node tests/workbench-logic-test.js && node tests/storage-autobackup-test.js && node tests/storage-outputs-mutate-test.js && node tests/sync-facts-guard-test.js && node tests/e2e-fixed-waits-ratchet-test.js && node tests/shell-render-behavior-test.js && node tests/canvas-meta-notice-behavior-test.js && node tests/source-text-ratchet-test.js && node tests/plugin-theme-contract-test.js && node tests/prompt-md-roundtrip-test.js && node tests/generation-results-store-test.js && node tests/out-groups-order-test.js && node tests/native-overlay-park-test.js && node tests/ui-dock-sanitize-test.js && node tests/ui-minimap-fit-test.js && node tests/ui-workbench-hooks-test.js",
|
||||
"test: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",
|
||||
|
||||
@@ -0,0 +1,554 @@
|
||||
// iwb-plugin: 图库 —— 右栏「图库」面板(宿主只提供 ctx.gallery 数据能力,界面全部在插件里)
|
||||
//
|
||||
// 依赖客户端能力:gallery(list/thumb/preview/download/insert/remove)+ panels。
|
||||
// 数据:插件自己的配置(插入尺寸/图幅/时间筛选)存 ctx.data,不塞 settings。
|
||||
// 视觉:复用宿主的 .iwb-gal-* / .iwb-history-* 类名(宿主 style.css 保留这些样式)。
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
if (!global.IWBPluginHost) return
|
||||
|
||||
var PANEL_ID = 'gallery-panel'
|
||||
var DEF = { insertK: '1k', tile: 110, range: '' }
|
||||
// v1.6.2:图幅=**实际显示宽度上限**(此前只当「算列数」用,独列时会被拉到撑满面板,选「小」也很大)
|
||||
// v1.6.3:新增「极小」64px 档(面板窄时想一行看更多图)
|
||||
var TILES = [[64, '极小'], [80, '小'], [110, '中'], [150, '大'], [200, '特大']]
|
||||
var KS = [['orig', '原图'], ['2k', '2K'], ['1k', '1K'], ['0.5k', '0.5K']]
|
||||
var RANGES = [['', '全部'], ['today', '今天'], ['7d', '7 天'], ['30d', '30 天']]
|
||||
|
||||
function el (tag, attrs) {
|
||||
var node = document.createElement(tag)
|
||||
if (attrs) {
|
||||
for (var k in attrs) {
|
||||
if (!Object.prototype.hasOwnProperty.call(attrs, k)) continue
|
||||
var v = attrs[k]
|
||||
if (v === null || v === undefined) continue
|
||||
if (k === 'class') node.className = v
|
||||
else if (k === 'text') node.textContent = v
|
||||
else if (k === 'style') node.setAttribute('style', v)
|
||||
else node.setAttribute(k, v)
|
||||
}
|
||||
}
|
||||
// 变参子节点(第三位起),支持数组与字符串
|
||||
for (var i = 2; i < arguments.length; i++) append(node, arguments[i])
|
||||
return node
|
||||
}
|
||||
function append (node, v) {
|
||||
if (v === null || v === undefined || v === false) return
|
||||
if (Array.isArray(v)) { for (var i = 0; i < v.length; i++) append(node, v[i]); return }
|
||||
node.appendChild(typeof v === 'string' ? document.createTextNode(v) : v)
|
||||
}
|
||||
function clear (node) { while (node.firstChild) node.removeChild(node.firstChild) }
|
||||
|
||||
// v1.4.1:底栏按钮改用图标(窄栏里「刷新/设置」会被挤成竖排两行)
|
||||
var SVG_NS = 'http://www.w3.org/2000/svg'
|
||||
function iconBtn (label, build, title) {
|
||||
var b = el('button', { class: 'iwb-btn iwb-btn-sm iwb-gal-icobtn', title: title || label, 'aria-label': label })
|
||||
var svg = document.createElementNS(SVG_NS, 'svg')
|
||||
svg.setAttribute('viewBox', '0 0 16 16')
|
||||
svg.setAttribute('width', '14')
|
||||
svg.setAttribute('height', '14')
|
||||
svg.setAttribute('fill', 'none')
|
||||
svg.setAttribute('stroke', 'currentColor')
|
||||
svg.setAttribute('stroke-width', '1.5')
|
||||
svg.setAttribute('stroke-linecap', 'round')
|
||||
svg.setAttribute('stroke-linejoin', 'round')
|
||||
svg.setAttribute('aria-hidden', 'true')
|
||||
build(svg)
|
||||
b.appendChild(svg)
|
||||
return b
|
||||
}
|
||||
function svgPath (svg, d) {
|
||||
var p = document.createElementNS(SVG_NS, 'path')
|
||||
p.setAttribute('d', d)
|
||||
svg.appendChild(p)
|
||||
return p
|
||||
}
|
||||
function sel (options, value) {
|
||||
var s = el('select', { class: 'iwb-input iwb-select-compact' })
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
var o = el('option', { value: String(options[i][0]), text: options[i][1] })
|
||||
if (String(options[i][0]) === String(value)) o.selected = true
|
||||
s.appendChild(o)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
function mount (host, ctx) {
|
||||
clear(host)
|
||||
host.classList.add('iwb-plugin-node-body')
|
||||
host.style.minHeight = '0'
|
||||
|
||||
var cfg = Object.assign({}, DEF)
|
||||
var items = []
|
||||
var thumbCache = {}
|
||||
var thumbPending = {} // 进行中的缩略图请求(v1.6.9)
|
||||
var total = 0
|
||||
var limit = 100
|
||||
var picked = {}
|
||||
var gridW = 320
|
||||
var raf = 0
|
||||
var failed = {} // v1.6.0:缩略图仍失败的 name 集合(据此显示「N 张失败」+ 全部重试)
|
||||
|
||||
var head = el('div', { class: 'iwb-gal-head' })
|
||||
var actions = el('div', { class: 'iwb-gal-actions' })
|
||||
head.appendChild(actions)
|
||||
|
||||
var grid = el('div', { class: 'iwb-history-grid' })
|
||||
var empty = el('div', { class: 'iwb-hint', text: '暂无图片 · 运行生图后会出现在这里' })
|
||||
var more = el('div', { class: 'iwb-history-more' })
|
||||
// v1.1.0:底部横栏 —— 左边张数/已选,右边三个设定(右对齐)
|
||||
var countEl = el('span', { class: 'iwb-gal-count', text: '0 / 0 张' })
|
||||
var pickedEl = el('span', { class: 'iwb-gal-sel', text: '' })
|
||||
var statusEl = el('span', { class: 'iwb-gal-status', text: '' })
|
||||
var failEl = el('span', { class: 'iwb-gal-fail', text: '' })
|
||||
failEl.style.display = 'none'
|
||||
failEl.addEventListener('click', function () { retryAll() })
|
||||
var refreshBtn = iconBtn('刷新', function (svg) {
|
||||
svgPath(svg, 'M13.2 6.4A5.4 5.4 0 1 0 13.4 9.4')
|
||||
svgPath(svg, 'M13.2 2.6v3.8H9.4')
|
||||
}, '刷新:重新向宿主拉取图库(图床恢复/外部改动后点这里)')
|
||||
refreshBtn.addEventListener('click', function () { load(true) })
|
||||
// v1.4.0:三个下拉不再占用前台(窄栏放不下、也显乱)——收进「设置」浮层,点按钮才展开。
|
||||
var setBtn = iconBtn('设置', function (svg) {
|
||||
var c1 = document.createElementNS(SVG_NS, 'circle')
|
||||
c1.setAttribute('cx', '8'); c1.setAttribute('cy', '8'); c1.setAttribute('r', '4.2')
|
||||
svg.appendChild(c1)
|
||||
var c2 = document.createElementNS(SVG_NS, 'circle')
|
||||
c2.setAttribute('cx', '8'); c2.setAttribute('cy', '8'); c2.setAttribute('r', '1.6')
|
||||
svg.appendChild(c2)
|
||||
for (var i = 0; i < 8; i++) {
|
||||
var a = i * Math.PI / 4
|
||||
var x1 = (8 + Math.cos(a) * 4.2).toFixed(2)
|
||||
var y1 = (8 + Math.sin(a) * 4.2).toFixed(2)
|
||||
var x2 = (8 + Math.cos(a) * 5.6).toFixed(2)
|
||||
var y2 = (8 + Math.sin(a) * 5.6).toFixed(2)
|
||||
svgPath(svg, 'M' + x1 + ' ' + y1 + 'L' + x2 + ' ' + y2)
|
||||
}
|
||||
}, '图库设置:插入尺寸 / 图幅 / 时间范围')
|
||||
setBtn.classList.add('iwb-gal-setbtn')
|
||||
setBtn.setAttribute('aria-expanded', 'false')
|
||||
var settings = el('div', { class: 'iwb-gal-settings', role: 'dialog', 'aria-label': '图库设置' })
|
||||
settings.style.display = 'none'
|
||||
// v1.4.2:刷新与设置同放右侧工具组(此前刷新在左侧信息区,空间不足时会向右溢出、压住设置图标)
|
||||
var tools = el('div', { class: 'iwb-gal-tools' }, refreshBtn, 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])
|
||||
|
||||
function setOpen (open) {
|
||||
settings.style.display = open ? '' : 'none'
|
||||
setBtn.setAttribute('aria-expanded', open ? 'true' : 'false')
|
||||
setBtn.classList.toggle('iwb-gal-setbtn-on', !!open)
|
||||
if (open) document.addEventListener('pointerdown', onDocDown, true)
|
||||
else document.removeEventListener('pointerdown', onDocDown, true)
|
||||
}
|
||||
function onDocDown (e) {
|
||||
if (settings.contains(e.target) || setBtn.contains(e.target)) return
|
||||
setOpen(false)
|
||||
}
|
||||
setBtn.addEventListener('click', function (e) { e.stopPropagation(); setOpen(settings.style.display === 'none') })
|
||||
host.appendChild(wrap)
|
||||
|
||||
function count () { return Object.keys(picked).length }
|
||||
|
||||
// ---- v1.6.0 右键菜单:单张操作(插入 / 下载 / 预览 / 复制文件名 / 删除)----
|
||||
var menuEl = null
|
||||
function closeMenu () {
|
||||
if (menuEl && menuEl.parentNode) menuEl.parentNode.removeChild(menuEl)
|
||||
menuEl = null
|
||||
document.removeEventListener('pointerdown', onMenuDown, true)
|
||||
document.removeEventListener('keydown', onMenuKey, true)
|
||||
}
|
||||
function onMenuDown (e) { if (menuEl && !menuEl.contains(e.target)) closeMenu() }
|
||||
function onMenuKey (e) { if (e.key === 'Escape') closeMenu() }
|
||||
function openMenu (e, it) {
|
||||
e.preventDefault(); e.stopPropagation()
|
||||
closeMenu()
|
||||
var menu = el('div', { class: 'iwb-ctxmenu iwb-gal-menu', style: 'left:' + e.clientX + 'px;top:' + e.clientY + 'px' })
|
||||
menu.appendChild(el('div', { class: 'iwb-ctx-title', text: it.name }))
|
||||
function item (label, fn) {
|
||||
var b = el('button', { class: 'iwb-ctx-item', text: label })
|
||||
b.addEventListener('click', function (ev) { ev.stopPropagation(); closeMenu(); fn() })
|
||||
menu.appendChild(b)
|
||||
}
|
||||
item('插入画布', function () {
|
||||
Promise.resolve(ctx.gallery.insert([it.name], { insertK: cfg.insertK || '1k' }))
|
||||
.then(function () { setStatus('已插入:' + it.name) })
|
||||
.catch(function () { setStatus('插入失败') })
|
||||
})
|
||||
item('下载', function () { doDownload([it.name]) })
|
||||
item('预览大图', function () { try { ctx.gallery.preview(it.name) } catch (err) { /* ignore */ } })
|
||||
item('复制文件名', function () {
|
||||
try {
|
||||
var p = global.navigator && global.navigator.clipboard && global.navigator.clipboard.writeText(it.name)
|
||||
if (p && p.then) p.then(function () { setStatus('已复制文件名') }).catch(function () { setStatus('复制失败(剪贴板不可用)') })
|
||||
else setStatus('复制失败(剪贴板不可用)')
|
||||
} catch (err) { setStatus('复制失败(剪贴板不可用)') }
|
||||
})
|
||||
item('删除这张', function () {
|
||||
var C = global.IWBUIConfirm
|
||||
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 () {})
|
||||
}).catch(function () {})
|
||||
})
|
||||
document.body.appendChild(menu)
|
||||
menuEl = menu
|
||||
setTimeout(function () {
|
||||
document.addEventListener('pointerdown', onMenuDown, true)
|
||||
document.addEventListener('keydown', onMenuKey, true)
|
||||
}, 0)
|
||||
}
|
||||
|
||||
// ---- v1.6.0 多选拖入画布:宿主 drop 只认单张,这里在捕获阶段接管整批 ----
|
||||
// 仅当 dataTransfer 带 application/x-iwb-gallery-batch 时生效,其余拖放行为完全不变。
|
||||
function onDocDrop (e) {
|
||||
var raw = ''
|
||||
try { raw = (e.dataTransfer && e.dataTransfer.getData('application/x-iwb-gallery-batch')) || '' } catch (err) { return }
|
||||
if (!raw) return
|
||||
var names = []
|
||||
try { names = JSON.parse(raw) } catch (err) { return }
|
||||
if (!names || names.length < 2) return
|
||||
e.preventDefault(); e.stopPropagation()
|
||||
Promise.resolve(ctx.gallery.insert(names, { insertK: cfg.insertK || '1k' })).then(function (r) {
|
||||
if (r && r.ok === false) { setStatus('批量插入失败'); return }
|
||||
setStatus('已插入 ' + names.length + ' 张')
|
||||
}).catch(function () { setStatus('批量插入失败') })
|
||||
}
|
||||
document.addEventListener('drop', onDocDrop, true)
|
||||
// v1.6.0:失败计数集中在底栏;点它 = 全部重试(整墙重挂,重新向宿主取缩略图)
|
||||
function updateFail () {
|
||||
var n = Object.keys(failed).length
|
||||
if (!n) { failEl.style.display = 'none'; failEl.textContent = ''; return }
|
||||
failEl.style.display = ''
|
||||
failEl.textContent = n + ' 张失败 · 重试'
|
||||
failEl.title = '点击重新加载这 ' + n + ' 张的缩略图'
|
||||
}
|
||||
function retryAll () {
|
||||
failed = {}
|
||||
updateFail()
|
||||
setStatus('重试中…')
|
||||
render()
|
||||
}
|
||||
function pickedNames () { return Object.keys(picked) }
|
||||
|
||||
function renderHead () {
|
||||
clear(actions)
|
||||
countEl.textContent = items.length + ' / ' + total + ' 张'
|
||||
pickedEl.textContent = count() ? ('已选 ' + count()) : ''
|
||||
var n = count()
|
||||
function btn (label, title0, fn, need, danger) {
|
||||
var b = el('button', { class: 'iwb-btn iwb-btn-sm' + (danger ? ' iwb-btn-danger' : '') + (need && !n ? ' iwb-gal-off' : ''), text: label, title: need && !n ? '先选中图片' : title0 })
|
||||
b.addEventListener('click', function () { if (need && !n) return; fn() })
|
||||
return b
|
||||
}
|
||||
actions.appendChild(btn('全选', '全选当前筛选结果', function () { for (var i = 0; i < items.length; i++) picked[items[i].name] = 1; render() }))
|
||||
actions.appendChild(btn('反选', '反选当前筛选结果', function () { for (var i = 0; i < items.length; i++) { var k = items[i].name; if (picked[k]) delete picked[k]; else picked[k] = 1 } render() }))
|
||||
actions.appendChild(btn('插入', '把选中的图片插入画布(尺寸按「设置 → 插入尺寸」)', function () {
|
||||
var names = pickedNames()
|
||||
var k = cfg.insertK || '1k'
|
||||
Promise.resolve(ctx.gallery.insert(names, { insertK: k })).then(function (r) {
|
||||
if (r && r.ok === false) { setStatus('插入失败'); return }
|
||||
setStatus('已插入 ' + names.length + ' 张(' + String(k).toUpperCase() + ')')
|
||||
}).catch(function () { setStatus('插入失败') })
|
||||
}, true))
|
||||
actions.appendChild(btn('下载', '下载选中的图片', function () { doDownload(pickedNames()) }, true))
|
||||
actions.appendChild(btn('删除', '删除选中的图片(不可恢复)', function () {
|
||||
var C = global.IWBUIConfirm
|
||||
var ask = C && C.askOrNative ? C.askOrNative('删除选中的 ' + n + ' 张图片?不可恢复。', { title: '删除图片', okText: '删除' }) : Promise.resolve(global.confirm('删除选中的 ' + n + ' 张图片?'))
|
||||
var names = pickedNames()
|
||||
ask.then(function (ok) {
|
||||
if (!ok) return
|
||||
// 先本地摘掉,避免删除后还渲染一格「图片已丢失」;随后再向宿主重拉(等它删完+刷新)
|
||||
items = items.filter(function (x) { return names.indexOf(x.name) < 0 })
|
||||
total = Math.max(0, total - names.length)
|
||||
picked = {}
|
||||
render()
|
||||
return Promise.resolve(ctx.gallery.remove(names)).then(function () {
|
||||
setTimeout(load, 250)
|
||||
})
|
||||
}).catch(function () {})
|
||||
}, true, true))
|
||||
|
||||
}
|
||||
|
||||
// 设置浮层内容只建一次(不随每次 render 重建,避免下拉被重置)
|
||||
function buildSettings () {
|
||||
clear(settings)
|
||||
settings.appendChild(el('div', { class: 'iwb-gal-settings-title', text: '图库设置' }))
|
||||
function row (key, options, label, hint) {
|
||||
var s = sel(options, cfg[key])
|
||||
s.title = hint || label
|
||||
s.setAttribute('aria-label', label)
|
||||
s.addEventListener('change', function () {
|
||||
cfg[key] = s.value
|
||||
saveCfg()
|
||||
if (key === 'range') { limit = 100; load() } else if (key === 'tile') render()
|
||||
})
|
||||
return el('label', { class: 'iwb-gal-setrow' }, el('span', { class: 'iwb-gal-setlabel', text: label }), s)
|
||||
}
|
||||
settings.appendChild(row('insertK', KS, '插入尺寸', '插入画布时的图片尺寸'))
|
||||
settings.appendChild(row('tile', TILES, '图幅', '图库图片显示宽度'))
|
||||
settings.appendChild(row('range', RANGES, '时间范围', '按生成时间筛选'))
|
||||
}
|
||||
|
||||
function renderGrid () {
|
||||
clear(grid)
|
||||
var gap = 6
|
||||
var tileW = Math.max(40, Number(cfg.tile) || 110)
|
||||
var n = Math.max(1, Math.floor((gridW + gap) / (tileW + gap)))
|
||||
// v1.6.6:列宽 = 均分宽度(铺满面板),图幅只决定「列数」——
|
||||
// 以前 min(图幅, 均分) 会留下右侧空白,看起来像没补齐。
|
||||
var colW = Math.max(40, (gridW - gap * (n - 1)) / n)
|
||||
var cols = []
|
||||
var heights = []
|
||||
for (var c = 0; c < n; c++) { cols.push([]); heights.push(0) }
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var it = items[i]
|
||||
var ratio = (it.w && it.h) ? (it.h / it.w) : 1
|
||||
var min = 0
|
||||
for (var j = 1; j < n; j++) if (heights[j] < heights[min]) min = j
|
||||
cols[min].push(it)
|
||||
heights[min] += colW * ratio + gap
|
||||
}
|
||||
for (var ci = 0; ci < cols.length; ci++) {
|
||||
var col = el('div', { class: 'iwb-history-col', style: 'width:' + Math.round(colW) + 'px;flex:0 0 auto' })
|
||||
for (var k = 0; k < cols[ci].length; k++) col.appendChild(itemNode(cols[ci][k]))
|
||||
grid.appendChild(col)
|
||||
}
|
||||
empty.style.display = items.length ? 'none' : ''
|
||||
clear(more)
|
||||
if (total > items.length) {
|
||||
var b = el('button', { class: 'iwb-btn iwb-btn-sm', text: '显示更多(' + (total - items.length) + ' 张)' })
|
||||
b.addEventListener('click', function () { limit += 100; load() })
|
||||
more.appendChild(b)
|
||||
}
|
||||
}
|
||||
|
||||
function itemNode (it) {
|
||||
var on = !!picked[it.name]
|
||||
var box = el('div', { class: 'iwb-history-item' + (count() ? ' iwb-history-managed' : '') + (on ? ' iwb-history-selected' : '') })
|
||||
// 缩略图是**异步**的(ctx.gallery.thumb 返回 Promise):先占位,拿到地址再挂 img。
|
||||
// v1.2.0:加载失败自动重试 2 次(图片还没落盘/临时不可读),仍失败才显示可点击重试的占位。
|
||||
box.title = it.name + '(单击单选 · Shift+单击多选 · 双击放大 · 拖到画布=参考图节点)'
|
||||
var holder = el('div', { class: 'iwb-history-missing', text: '加载中…' })
|
||||
box.appendChild(holder)
|
||||
var tries = 0
|
||||
function fail (text) {
|
||||
tries = 999
|
||||
holder.textContent = text || '缩略图加载失败(点击重试)'
|
||||
holder.style.cursor = 'pointer'
|
||||
holder.onclick = function () { failed[it.name] = 1; tries = 0; boot() }
|
||||
failed[it.name] = 1
|
||||
updateFail()
|
||||
}
|
||||
function boot () {
|
||||
if (tries >= 999) return
|
||||
holder.style.cursor = ''
|
||||
holder.onclick = null
|
||||
holder.textContent = '加载中…'
|
||||
// v1.6.9:缩略图地址按名字缓存,且进行中的请求共享同一 Promise ——
|
||||
// 重排/重测会重建 DOM,不共享就会对同一张图重复取 N 次。
|
||||
var key = it.name
|
||||
if (thumbCache[key]) { var u0 = thumbCache[key]; Promise.resolve().then(function () { paint(u0) }).catch(function () { /* ignore */ }); return }
|
||||
if (!thumbPending[key]) {
|
||||
thumbPending[key] = Promise.resolve(ctx.gallery.thumb(key)).then(function (url) {
|
||||
if (url && typeof url === 'string') thumbCache[key] = url
|
||||
delete thumbPending[key]
|
||||
return url
|
||||
}, function (e) { delete thumbPending[key]; throw e })
|
||||
}
|
||||
thumbPending[key].then(paint).catch(function () { fail('缩略图加载失败(点击重试)') })
|
||||
}
|
||||
function paint (url) {
|
||||
if (!url || typeof url !== 'string') { fail('图片已丢失'); return }
|
||||
if (!box.isConnected) return
|
||||
var img = el('img', { src: url, alt: '', loading: 'lazy', draggable: 'true' })
|
||||
if (it.w && it.h) img.setAttribute('style', 'aspect-ratio:' + it.w + ' / ' + it.h)
|
||||
img.addEventListener('load', function () {
|
||||
// naturalWidth=0 说明拿到的是坏图(空 data URL / 截断文件):按失败处理,别留白块
|
||||
if (!img.naturalWidth) { tries++; if (tries <= 2) { setTimeout(boot, 400 * tries); return } if (img.parentNode === box) box.replaceChild(holder, img); fail('缩略图加载失败(点击重试)'); return }
|
||||
if (holder.parentNode === box) box.replaceChild(img, holder)
|
||||
if (failed[it.name]) { delete failed[it.name]; updateFail() }
|
||||
})
|
||||
img.addEventListener('error', function () {
|
||||
tries++
|
||||
if (tries <= 2) { setTimeout(boot, 400 * tries); return }
|
||||
if (img.parentNode === box) box.replaceChild(holder, img)
|
||||
fail('缩略图加载失败(点击重试)')
|
||||
})
|
||||
img.addEventListener('click', function (e) { pick(it.name, !!(e && e.shiftKey)) })
|
||||
img.addEventListener('dblclick', function () { ctx.gallery.preview(it.name) })
|
||||
img.addEventListener('dragstart', function (e) {
|
||||
try {
|
||||
var names = (picked[it.name] && count() > 1) ? pickedNames() : [it.name]
|
||||
e.dataTransfer.setData('application/x-iwb-localref', names[0])
|
||||
e.dataTransfer.setData('application/x-iwb-gallery-orig', names[0])
|
||||
// 多选:额外带一批名字,由本插件在 document 捕获阶段接管(宿主 drop 只认单张)
|
||||
if (names.length > 1) {
|
||||
e.dataTransfer.setData('application/x-iwb-gallery-batch', JSON.stringify(names))
|
||||
setStatus('拖动 ' + names.length + ' 张')
|
||||
}
|
||||
e.dataTransfer.effectAllowed = 'copy'
|
||||
} catch (err) { /* ignore */ }
|
||||
})
|
||||
img.style.display = 'none'
|
||||
box.appendChild(img)
|
||||
// v1.6.9:坏图/超时兜底 —— 某些坏字节既不触发 load 也不触发 error,700ms 后直接判定失败(可点击重试)
|
||||
setTimeout(function () {
|
||||
try {
|
||||
if (!img.parentNode) return
|
||||
if (img.naturalWidth > 0) return
|
||||
if (img.parentNode === box) box.replaceChild(holder, img)
|
||||
fail('缩略图加载失败(点击重试)')
|
||||
} catch (e) { /* ignore */ }
|
||||
}, 700)
|
||||
// 加载成功后再替换占位(避免破图标 + 长 title 占满格子)
|
||||
if (img.complete && img.naturalWidth > 0) { img.style.display = ''; if (holder.parentNode === box) box.replaceChild(img, holder) }
|
||||
else if (img.complete && !img.naturalWidth) { /* 立即失败(坏图)*/ tries++; if (tries <= 2) setTimeout(boot, 400 * tries); else { if (img.parentNode === box) box.replaceChild(holder, img); fail('缩略图加载失败(点击重试)') } }
|
||||
}
|
||||
boot()
|
||||
box.addEventListener('contextmenu', function (e) { openMenu(e, it) })
|
||||
var acts = el('div', { class: 'iwb-history-actions' })
|
||||
function act (label, title, fn) {
|
||||
var b = el('button', { class: 'iwb-btn iwb-btn-sm', text: label, title: title })
|
||||
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 () { doDownload([it.name]) }))
|
||||
box.appendChild(acts)
|
||||
return box
|
||||
}
|
||||
|
||||
var statusTimer = 0
|
||||
function setStatus (text) {
|
||||
statusEl.textContent = text || ''
|
||||
clearTimeout(statusTimer)
|
||||
if (text) statusTimer = setTimeout(function () { statusEl.textContent = '' }, 4000)
|
||||
}
|
||||
function doDownload (names) {
|
||||
setStatus('下载中…')
|
||||
return Promise.resolve(ctx.gallery.download(names)).then(function (r) {
|
||||
var failed = (r && r.failed) || []
|
||||
var ok = (r && r.count) || 0
|
||||
if (failed.length) setStatus(failed.length + ' 张下载失败,可再点一次重试')
|
||||
else setStatus(ok ? ('已下载 ' + ok + ' 张') : '没有可下载的图片')
|
||||
}).catch(function () { setStatus('下载失败,可再点一次重试') })
|
||||
}
|
||||
|
||||
function pick (name, shift) {
|
||||
if (shift) { if (picked[name]) delete picked[name]; else picked[name] = 1 } else { picked = {}; picked[name] = 1 }
|
||||
render()
|
||||
}
|
||||
|
||||
function render () { renderHead(); renderGrid() }
|
||||
|
||||
function load (force) {
|
||||
if (force) setStatus('刷新中…')
|
||||
return Promise.resolve(ctx.gallery.list({ range: cfg.range, limit: limit })).then(function (r) {
|
||||
items = (r && r.items) || []
|
||||
total = (r && r.total) || items.length
|
||||
lastLoadAt = Date.now()
|
||||
failed = {}
|
||||
render()
|
||||
}).catch(function () { items = []; total = 0; render() })
|
||||
}
|
||||
|
||||
var saveTimer = 0
|
||||
function saveCfg () {
|
||||
clearTimeout(saveTimer)
|
||||
saveTimer = setTimeout(function () {
|
||||
try { var p = ctx.data && ctx.data.patch({ cfg: cfg }); if (p && p.catch) p.catch(function () {}) } catch (e) { /* 配置存不下不影响使用 */ }
|
||||
}, 200)
|
||||
}
|
||||
|
||||
// 宽度测量:列数只由「面板宽 / 图幅」决定
|
||||
// v1.6.5:面板刚挂载时 grid 宽度可能是 0,而 grid 宽度又取决于列宽 → RO 不会触发,图库一直空白。
|
||||
function availableW () {
|
||||
// v1.6.6:优先量「会随面板拉伸的外层容器」,而不是 grid 自身
|
||||
// (grid 现在是 flex-start + 内容宽度,面板变宽它不会变宽 → RO 不触发 → 列数永不补齐)
|
||||
var w = wrap ? wrap.clientWidth : 0
|
||||
if (!w && wrap && wrap.parentNode) w = wrap.parentNode.clientWidth
|
||||
if (!w) w = grid.clientWidth
|
||||
return w || 0
|
||||
}
|
||||
function measure () {
|
||||
var w = availableW()
|
||||
if (w > 0 && Math.abs(w - gridW) > 1) { gridW = w; renderGrid() }
|
||||
}
|
||||
var ro = typeof ResizeObserver === 'function' ? new ResizeObserver(function () { measure() }) : null
|
||||
if (ro) { if (wrap) ro.observe(wrap); if (wrap && wrap.parentNode) ro.observe(wrap.parentNode); ro.observe(grid) }
|
||||
measure()
|
||||
var tries = 0
|
||||
function retry () {
|
||||
if (gridW > 0 || tries++ > 40) { if (gridW <= 0) { gridW = Math.max(160, Number(cfg.tile) || 110) * 2; renderGrid() } return }
|
||||
measure()
|
||||
if (gridW <= 0) global.requestAnimationFrame(retry)
|
||||
}
|
||||
global.requestAnimationFrame(retry)
|
||||
// v1.6.7:再补几次延时重测(停靠栏展开动画、首帧布局未完成时能在 1s 内自愈)
|
||||
;[120, 400, 900].forEach(function (ms) { setTimeout(function () { try { measure(); if (gridW > 0) renderGrid() } catch (e) { /* ignore */ } }, ms) })
|
||||
|
||||
// v1.3.0:自动恢复 —— 面板重新可见(切回 tab / 窗口聚焦 / 后台回来)且距上次拉取 >5s 时重拉一次,
|
||||
// 这样图床恢复、后台补图后不必手动刷新;同时保留底部「刷新」按钮做即时重试。
|
||||
var lastLoadAt = 0
|
||||
var autoRefresh = function () {
|
||||
if (Date.now() - lastLoadAt < 5000) return
|
||||
load()
|
||||
}
|
||||
try {
|
||||
if (typeof IntersectionObserver === 'function') {
|
||||
var io = new IntersectionObserver(function (entries) {
|
||||
for (var i = 0; i < entries.length; i++) {
|
||||
if (entries[i].isIntersecting) {
|
||||
// v1.6.7:面板真正可见后再量一次宽度并重排(首帧可能还是 0 宽)
|
||||
try { measure(); renderGrid() } catch (e) { /* ignore */ }
|
||||
autoRefresh()
|
||||
}
|
||||
}
|
||||
}, { threshold: 0.15 })
|
||||
io.observe(wrap)
|
||||
}
|
||||
document.addEventListener('visibilitychange', function () { if (!document.hidden) autoRefresh() })
|
||||
window.addEventListener('focus', autoRefresh)
|
||||
} catch (e) { /* 环境不支持则只保留手动刷新 */ }
|
||||
|
||||
// 先读配置,再拉列表
|
||||
Promise.resolve(ctx.data && ctx.data.read ? ctx.data.read() : {}).then(function (d) {
|
||||
if (d && d.cfg) cfg = Object.assign({}, DEF, d.cfg)
|
||||
buildSettings() // 设置浮层里的下拉要反映读到的配置
|
||||
return load()
|
||||
}).catch(function () { buildSettings(); load() })
|
||||
|
||||
return function dispose () {
|
||||
if (ro) { try { ro.disconnect() } 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 */ }
|
||||
closeMenu()
|
||||
}
|
||||
}
|
||||
|
||||
global.IWBPluginHost.register({
|
||||
id: 'gallery',
|
||||
name: '图库',
|
||||
version: '1.6.9',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'gallery'],
|
||||
data: { schemaVersion: 1, maxBytes: 65536 },
|
||||
}, function (ctx) {
|
||||
ctx.ui.registerPanel({
|
||||
id: PANEL_ID,
|
||||
title: '图库',
|
||||
icon: 'ref',
|
||||
mount: function (host) { return mount(host, ctx) },
|
||||
})
|
||||
return {}
|
||||
})
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"id": "gallery",
|
||||
"name": "图库",
|
||||
"version": "1.6.9",
|
||||
"apiVersion": 1,
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
"description": "右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供)",
|
||||
"author": "official",
|
||||
"icon": "🖼️",
|
||||
"tags": [
|
||||
"资源",
|
||||
"图库"
|
||||
],
|
||||
"files": {
|
||||
"main.js": "26c7e64b3a0021c6b9514dfb84d4d2580276698222b4791cfa99f22ead66ff52",
|
||||
"styles.css": "9d5b4ab1343761e51ef0c479cab96a94d3d6eaa27f0fdb500bff789ec81d70e0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/* 图库插件样式(v1.5.0)
|
||||
* 为什么放插件里:宿主 style.css 只在客户端发版时更新,而这里是「设置浮层/图标按钮/紧凑间距」这类
|
||||
* 高频视觉调整——随插件更新即可生效,不必重发桌面端。选择器均带 .iwb-gal-* / .iwb-history-* 前缀,
|
||||
* 且比宿主同名规则更具体(.iwb-gal-foot .iwb-gal-icobtn),宿主旧样式不会盖回来。
|
||||
*/
|
||||
|
||||
/* ---- 面板留白:边缘收小,避免窄栏里浪费空间 ---- */
|
||||
.iwb-history-embedded { padding: 6px 6px 4px; gap: 6px; }
|
||||
.iwb-history-embedded .iwb-history-grid { gap: 6px; padding: 0 0 2px; justify-content: flex-start; }
|
||||
/* 列宽由插件按「图幅」写死(style width),这里禁用宿主的 flex:1 拉伸 */
|
||||
.iwb-history-embedded .iwb-history-col { flex: 0 0 auto; gap: 6px; }
|
||||
|
||||
/* ---- 顶栏 ---- */
|
||||
.iwb-gal-head { display: flex; align-items: center; gap: 6px; min-height: 0; }
|
||||
.iwb-gal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
|
||||
.iwb-gal-actions .iwb-btn-sm { padding: 2px 7px; }
|
||||
|
||||
/* ---- 底栏:左信息 / 右工具组 ---- */
|
||||
.iwb-gal-foot {
|
||||
display: flex; align-items: center; justify-content: space-between; gap: 6px;
|
||||
min-width: 0; padding-top: 6px; border-top: 1px solid var(--iwb-border);
|
||||
}
|
||||
.iwb-gal-foot-left { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 0 1 auto; overflow: hidden; }
|
||||
.iwb-gal-count { font-size: 11px; color: var(--iwb-text2); white-space: nowrap; }
|
||||
.iwb-gal-sel { font-size: 11px; color: var(--iwb-brand); white-space: nowrap; }
|
||||
.iwb-gal-status { font-size: 11px; color: var(--iwb-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; max-width: none; }
|
||||
.iwb-gal-tools { display: flex; align-items: center; gap: 0; flex: 0 0 auto; margin-left: auto; }
|
||||
|
||||
/* ---- 图标按钮:无外框、无底色,只在悬停时给一点反馈 ---- */
|
||||
.iwb-gal-foot .iwb-gal-icobtn,
|
||||
.iwb-gal-foot .iwb-gal-icobtn:hover,
|
||||
.iwb-gal-foot .iwb-gal-icobtn:active {
|
||||
width: 20px; height: 20px; min-width: 20px; padding: 0; box-sizing: border-box;
|
||||
display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
|
||||
border: 0; box-shadow: none; background: transparent; border-radius: 4px;
|
||||
color: var(--iwb-text2); line-height: 1; transform: none;
|
||||
}
|
||||
.iwb-gal-foot .iwb-gal-icobtn svg { display: block; pointer-events: none; }
|
||||
.iwb-gal-foot .iwb-gal-icobtn:hover { background: var(--iwb-layer2); color: var(--iwb-text); }
|
||||
.iwb-gal-foot .iwb-gal-icobtn:focus-visible { outline: 2px solid color-mix(in srgb, var(--iwb-brand) 60%, transparent); outline-offset: 1px; }
|
||||
.iwb-gal-setbtn-on { color: var(--iwb-brand); background: var(--iwb-layer2); }
|
||||
|
||||
/* ---- 设置浮层(三个下拉不占前台) ---- */
|
||||
.iwb-gal-settings {
|
||||
position: absolute; right: 8px; bottom: 34px; z-index: 30; width: 176px; max-width: calc(100% - 16px);
|
||||
display: flex; flex-direction: column; gap: 8px; padding: 9px 10px;
|
||||
background: var(--iwb-layer); border: 1px solid var(--iwb-border); border-radius: 8px;
|
||||
box-shadow: 0 6px 18px rgba(0, 0, 0, .14);
|
||||
}
|
||||
.iwb-gal-settings-title { font-size: 11px; font-weight: 600; color: var(--iwb-text2); }
|
||||
.iwb-gal-setrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--iwb-text2); }
|
||||
.iwb-gal-setlabel { flex: 0 0 auto; }
|
||||
.iwb-gal-setrow select { flex: 1 1 auto; width: auto; min-width: 58px; max-width: 92px; height: 22px; font-size: 11px; padding: 0 2px 0 4px; }
|
||||
|
||||
/* ---- 图片墙 ---- */
|
||||
.iwb-history-grid { overscroll-behavior: contain; }
|
||||
.iwb-history-embedded .iwb-history-item { position: relative; flex: none; width: 100%; }
|
||||
.iwb-history-embedded .iwb-history-item img {
|
||||
width: 100%; height: auto; display: block; object-fit: contain; margin: 0 auto;
|
||||
border-radius: 6px; border: 1px solid var(--iwb-border); background: var(--iwb-layer2); cursor: pointer;
|
||||
}
|
||||
.iwb-history-missing {
|
||||
display: flex; align-items: center; justify-content: center; text-align: center;
|
||||
min-height: 84px; padding: 8px; border-radius: 6px; border: 1px dashed var(--iwb-border);
|
||||
font-size: 11px; color: var(--iwb-text2); background: var(--iwb-layer2); word-break: break-all;
|
||||
}
|
||||
.iwb-history-actions { display: flex; gap: 4px; padding: 4px 2px 0; }
|
||||
.iwb-history-actions .iwb-btn-sm { padding: 1px 6px; font-size: 10px; }
|
||||
.iwb-history-more { display: flex; justify-content: center; padding: 4px 0 2px; }
|
||||
/* 只作用于图库自己的空态提示:不加前缀会泄漏到设置页等使用 .iwb-hint 的地方(文字被居中) */
|
||||
.iwb-history-embedded .iwb-hint { font-size: 11px; color: var(--iwb-text2); text-align: center; padding: 12px 6px; }
|
||||
/* ---- v1.6.0:失败统计 / 右键菜单标题(v1.6.1 去掉搜索框)---- */
|
||||
.iwb-gal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
|
||||
.iwb-gal-fail {
|
||||
font-size: 11px; color: var(--iwb-err); cursor: pointer; white-space: nowrap;
|
||||
text-decoration: underline dotted; text-underline-offset: 2px;
|
||||
}
|
||||
.iwb-gal-fail:hover { color: var(--iwb-err); opacity: .85; }
|
||||
.iwb-gal-menu .iwb-ctx-title { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
@@ -0,0 +1,455 @@
|
||||
// iwb-plugin: 节点组库 —— 左侧「节点组」面板(宿主只提供 ctx.grouplib 数据能力,界面全部在插件里)
|
||||
//
|
||||
// 依赖客户端能力:grouplib(list/save/remove/instantiate/notify/onChanged)+ panels。
|
||||
// 数据仍在宿主持有(收藏的节点组快照 + 分组),插件不存副本,避免两份真相。
|
||||
// 视觉:复用宿主 .iwb-lib-* / .iwb-pcard / .iwb-chip / .iwb-gmgr-* 类名(style.css 已有)。
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
if (!global.IWBPluginHost) return
|
||||
|
||||
var PANEL_ID = 'grouplib-panel'
|
||||
|
||||
function el (tag, attrs) {
|
||||
var node = document.createElement(tag)
|
||||
if (attrs) {
|
||||
for (var k in attrs) {
|
||||
if (!Object.prototype.hasOwnProperty.call(attrs, k)) continue
|
||||
var v = attrs[k]
|
||||
if (v === null || v === undefined) continue
|
||||
if (k === 'class') node.className = v
|
||||
else if (k === 'text') node.textContent = v
|
||||
else if (k === 'style') node.setAttribute('style', v)
|
||||
else node.setAttribute(k, v)
|
||||
}
|
||||
}
|
||||
for (var i = 2; i < arguments.length; i++) append(node, arguments[i])
|
||||
return node
|
||||
}
|
||||
function append (node, v) {
|
||||
if (v === null || v === undefined || v === false) return
|
||||
if (Array.isArray(v)) { for (var i = 0; i < v.length; i++) append(node, v[i]); return }
|
||||
node.appendChild(typeof v === 'string' ? document.createTextNode(v) : v)
|
||||
}
|
||||
function clear (node) { while (node.firstChild) node.removeChild(node.firstChild) }
|
||||
|
||||
function ask (text, opts) {
|
||||
var C = global.IWBUIConfirm
|
||||
if (C && typeof C.askOrNative === 'function') return C.askOrNative(text, opts)
|
||||
return Promise.resolve(global.confirm(String(text)))
|
||||
}
|
||||
|
||||
function mount (host, ctx) {
|
||||
clear(host)
|
||||
host.classList.add('iwb-plugin-node-body')
|
||||
host.style.minHeight = '0'
|
||||
|
||||
var list = [] // [{id, name, group, ...snapshot}]
|
||||
var ggroups = [] // [{id, name}]
|
||||
var filter = 'all'
|
||||
var manage = false
|
||||
var picked = {} // id -> 1(管理模式多选)
|
||||
var editing = '' // 正在改名的 id
|
||||
var newOpen = false
|
||||
var managerOpen = false
|
||||
|
||||
var api = ctx.grouplib || {}
|
||||
|
||||
function notify (text, type) { try { api.notify && api.notify(text, type || 'ok') } catch (e) { /* ignore */ } }
|
||||
function groupsOf () {
|
||||
if (ggroups && ggroups.length) return ggroups
|
||||
var seen = []
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var g = String((list[i] && list[i].group) || '').trim()
|
||||
if (g && !seen.some(function (x) { return x.name === g })) seen.push({ id: g, name: g })
|
||||
}
|
||||
return seen
|
||||
}
|
||||
function save (next, nextGroups) {
|
||||
var groups = next || list
|
||||
var gs = nextGroups || groupsOf()
|
||||
list = groups
|
||||
ggroups = gs
|
||||
render()
|
||||
return Promise.resolve(api.save({ groups: groups, groupGroups: gs })).then(function (r) {
|
||||
if (r && r.ok === false) { notify(r.error || '节点组保存失败,请重试', 'err'); return r }
|
||||
return r || { ok: true }
|
||||
}).catch(function () { notify('节点组保存失败,请重试', 'err') })
|
||||
}
|
||||
|
||||
var body = el('div', { class: 'iwb-lib-body' })
|
||||
var fixed = el('div', { class: 'iwb-lib-fixed' })
|
||||
var scrollBox = el('div', { class: 'iwb-lib-scroll' })
|
||||
var wrap = el('div', { class: 'iwb-groups-embedded' }, body)
|
||||
body.appendChild(fixed)
|
||||
body.appendChild(scrollBox)
|
||||
host.appendChild(wrap)
|
||||
|
||||
var loadError = '' // '' = 正常;否则是给用户看的原因(据此区分「真没收藏」和「能力没拿到」)
|
||||
function load () {
|
||||
if (typeof api.list !== 'function') {
|
||||
loadError = '节点组能力未就绪(客户端需 ≥ 3.25.56)'
|
||||
list = []; ggroups = []
|
||||
render()
|
||||
return Promise.resolve(false)
|
||||
}
|
||||
return Promise.resolve(api.list()).then(function (r) {
|
||||
loadError = ''
|
||||
list = (r && r.groups) || []
|
||||
ggroups = (r && r.groupGroups) || []
|
||||
render()
|
||||
return true
|
||||
}).catch(function (e) {
|
||||
loadError = '读取失败:' + ((e && e.message) || e || '未知错误')
|
||||
list = []; ggroups = []
|
||||
render()
|
||||
return false
|
||||
})
|
||||
}
|
||||
|
||||
function countOf (name) {
|
||||
if (name === 'all') return list.length
|
||||
if (name === '__none__') return list.filter(function (g) { return !String((g && g.group) || '').trim() }).length
|
||||
return list.filter(function (g) { return (g && g.group) === name }).length
|
||||
}
|
||||
function visible () {
|
||||
if (filter === '__none__') return list.filter(function (g) { return !String((g && g.group) || '').trim() })
|
||||
if (filter !== 'all') return list.filter(function (g) { return (g && g.group) === filter })
|
||||
return list.slice()
|
||||
}
|
||||
|
||||
function assignGroup (ids, group) {
|
||||
return save(list.map(function (x) { return ids.indexOf(x.id) >= 0 ? Object.assign({}, x, { group: group || '' }) : x }))
|
||||
.then(function () { notify('已移动到' + (group || '未分组')) })
|
||||
}
|
||||
|
||||
function openMenu (e, g) {
|
||||
e.preventDefault(); e.stopPropagation()
|
||||
closeMenu()
|
||||
var menu = el('div', { class: 'iwb-ctxmenu iwb-lib-group-menu', style: 'left:' + e.clientX + 'px;top:' + e.clientY + 'px' })
|
||||
menu.appendChild(el('div', { class: 'iwb-ctx-title', text: '移动到分组' }))
|
||||
var mk = function (label, value) {
|
||||
var b = el('button', { class: 'iwb-ctx-item', text: label })
|
||||
b.addEventListener('click', function () { closeMenu(); assignGroup([g.id], value) })
|
||||
menu.appendChild(b)
|
||||
}
|
||||
mk('未分组', '')
|
||||
groupsOf().forEach(function (gr) { mk(gr.name, gr.name) })
|
||||
document.body.appendChild(menu)
|
||||
menu._iwbOwner = wrap
|
||||
setTimeout(function () { document.addEventListener('pointerdown', onDocDown, true) }, 0)
|
||||
}
|
||||
var openMenuEl = null
|
||||
function closeMenu () {
|
||||
if (openMenuEl && openMenuEl.parentNode) openMenuEl.parentNode.removeChild(openMenuEl)
|
||||
openMenuEl = null
|
||||
document.removeEventListener('pointerdown', onDocDown, true)
|
||||
var old = document.querySelector('.iwb-lib-group-menu')
|
||||
if (old && old.parentNode) old.parentNode.removeChild(old)
|
||||
}
|
||||
function onDocDown (e) {
|
||||
var m = document.querySelector('.iwb-lib-group-menu')
|
||||
if (m && m.contains(e.target)) return
|
||||
closeMenu()
|
||||
}
|
||||
|
||||
// ---- 分组管理弹窗 ----
|
||||
var modalHost = null
|
||||
function openManager () {
|
||||
closeManager()
|
||||
managerOpen = true
|
||||
var mask = el('div', { class: 'iwb-modal-mask' })
|
||||
var modal = el('div', { class: 'iwb-modal iwb-modal-sm' })
|
||||
var head = el('div', { class: 'iwb-modal-head' })
|
||||
var title = el('span', { class: 'iwb-toolbar-title' })
|
||||
var closeBtn = el('button', { class: 'iwb-btn iwb-btn-sm', title: '关闭', text: '✕' })
|
||||
closeBtn.addEventListener('click', closeManager)
|
||||
head.appendChild(title); head.appendChild(closeBtn)
|
||||
var bodyEl = el('div', { class: 'iwb-modal-body' })
|
||||
modal.appendChild(head); modal.appendChild(bodyEl)
|
||||
mask.appendChild(modal)
|
||||
mask.addEventListener('wheel', function (e) { e.stopPropagation() })
|
||||
mask.addEventListener('pointerdown', function (e) { if (e.target === mask) closeManager() })
|
||||
document.body.appendChild(mask)
|
||||
modalHost = mask
|
||||
renderManager(title, bodyEl)
|
||||
}
|
||||
function closeManager () {
|
||||
managerOpen = false
|
||||
if (modalHost && modalHost.parentNode) modalHost.parentNode.removeChild(modalHost)
|
||||
modalHost = null
|
||||
render()
|
||||
}
|
||||
function renderManager (title, bodyEl) {
|
||||
var gs = groupsOf()
|
||||
title.textContent = '管理节点组分组(' + gs.length + ')'
|
||||
clear(bodyEl)
|
||||
if (!gs.length) bodyEl.appendChild(el('div', { class: 'iwb-hint', text: '暂无分组。可在下方新建。' }))
|
||||
gs.forEach(function (g, i) {
|
||||
var row = el('div', { class: 'iwb-gmgr-row' })
|
||||
var nameEl = el('span', { class: 'iwb-gmgr-name', text: g.name })
|
||||
row.appendChild(nameEl)
|
||||
row.appendChild(el('span', { class: 'iwb-gmgr-count', text: countOf(g.name) + ' 组' }))
|
||||
var rn = el('button', { class: 'iwb-btn iwb-btn-sm', title: '重命名', text: '重命名' })
|
||||
rn.addEventListener('click', function () {
|
||||
var input = el('input', { class: 'iwb-input iwb-grow', value: g.name })
|
||||
row.replaceChild(input, nameEl)
|
||||
input.focus(); input.select()
|
||||
var commit = function () {
|
||||
var n = String(input.value || '').trim()
|
||||
if (!n || n === g.name) { renderManager(title, bodyEl); return }
|
||||
if (groupsOf().some(function (x) { return x.name === n })) { renderManager(title, bodyEl); return }
|
||||
var ng = groupsOf().map(function (x) { return x.name === g.name ? { id: n, name: n } : x })
|
||||
var nl = list.map(function (x) { return x.group === g.name ? Object.assign({}, x, { group: n }) : x })
|
||||
if (filter === g.name) filter = n
|
||||
save(nl, ng).then(function () { if (managerOpen) openManager() })
|
||||
}
|
||||
input.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Enter') { e.preventDefault(); commit() }
|
||||
if (e.key === 'Escape') renderManager(title, bodyEl)
|
||||
})
|
||||
input.addEventListener('blur', commit)
|
||||
})
|
||||
row.appendChild(rn)
|
||||
var up = el('button', { class: 'iwb-btn iwb-btn-sm', title: '上移', text: '↑' })
|
||||
up.disabled = i === 0
|
||||
up.addEventListener('click', function () { swap(i, -1) })
|
||||
row.appendChild(up)
|
||||
var down = el('button', { class: 'iwb-btn iwb-btn-sm', title: '下移', text: '↓' })
|
||||
down.disabled = i === gs.length - 1
|
||||
down.addEventListener('click', function () { swap(i, 1) })
|
||||
row.appendChild(down)
|
||||
var del = el('button', { class: 'iwb-btn iwb-btn-sm iwb-btn-danger', title: '删除分组(组内节点组移至未分组)', text: '删除' })
|
||||
del.addEventListener('click', function () {
|
||||
ask('删除节点组分组「' + g.name + '」?组内节点组将移至「未分组」(不删除节点组)。', { title: '删除分组', okText: '删除' }).then(function (ok) {
|
||||
if (!ok) return
|
||||
var ng = groupsOf().filter(function (x) { return x.name !== g.name })
|
||||
var nl = list.map(function (x) { return x.group === g.name ? Object.assign({}, x, { group: '' }) : x })
|
||||
if (filter === g.name) filter = 'all'
|
||||
save(nl, ng).then(function () { if (managerOpen) openManager() })
|
||||
})
|
||||
})
|
||||
row.appendChild(del)
|
||||
bodyEl.appendChild(row)
|
||||
})
|
||||
var addRow = el('div', { class: 'iwb-row' })
|
||||
var input = el('input', { class: 'iwb-input iwb-grow', placeholder: '新分组名称' })
|
||||
var addBtn = el('button', { class: 'iwb-btn', text: '+ 添加' })
|
||||
var doAdd = function () {
|
||||
var n = String(input.value || '').trim()
|
||||
if (!n) return
|
||||
if (groupsOf().some(function (x) { return x.name === n })) { input.value = ''; return }
|
||||
input.value = ''
|
||||
save(list, groupsOf().concat([{ id: n, name: n }])).then(function () { if (managerOpen) openManager() })
|
||||
}
|
||||
input.addEventListener('keydown', function (e) { if (e.key === 'Enter') doAdd() })
|
||||
addBtn.addEventListener('click', doAdd)
|
||||
addRow.appendChild(input); addRow.appendChild(addBtn)
|
||||
bodyEl.appendChild(addRow)
|
||||
}
|
||||
function swap (i, dir) {
|
||||
var gs = groupsOf().slice()
|
||||
var ni = i + dir
|
||||
if (ni < 0 || ni >= gs.length) return
|
||||
var t = gs[i]; gs[i] = gs[ni]; gs[ni] = t
|
||||
save(list, gs).then(function () { if (managerOpen) openManager() })
|
||||
}
|
||||
|
||||
// ---- 渲染 ----
|
||||
function render () {
|
||||
clear(fixed); clear(scrollBox)
|
||||
var gs = groupsOf()
|
||||
|
||||
var topRow = el('div', { class: 'iwb-row' })
|
||||
var mgBtn = el('button', { class: 'iwb-btn iwb-btn-sm' + (manage ? ' iwb-btn-primary' : ''), text: manage ? '退出管理' : '管理' })
|
||||
mgBtn.addEventListener('click', function () { manage = !manage; picked = {}; render() })
|
||||
topRow.appendChild(mgBtn)
|
||||
var refresh = el('button', { class: 'iwb-btn iwb-btn-sm', title: '重新向宿主拉取节点组', text: '↻' })
|
||||
refresh.addEventListener('click', function () { load() })
|
||||
topRow.appendChild(refresh)
|
||||
if (manage && Object.keys(picked).length) {
|
||||
var mv = el('select', { class: 'iwb-input' })
|
||||
mv.appendChild(el('option', { value: '__move__', text: '移动到分组…' }))
|
||||
mv.appendChild(el('option', { value: '', text: '未分组' }))
|
||||
gs.forEach(function (g) { mv.appendChild(el('option', { value: g.name, text: g.name })) })
|
||||
mv.addEventListener('change', function () {
|
||||
if (mv.value === '__move__') return
|
||||
var ids = Object.keys(picked)
|
||||
picked = {}
|
||||
assignGroup(ids, mv.value)
|
||||
})
|
||||
topRow.appendChild(mv)
|
||||
}
|
||||
fixed.appendChild(topRow)
|
||||
|
||||
// 分类胶囊:宿主 .iwb-lib-chips 是 nowrap(配 .iwb-lib-chips-scroll 才单行滚动),
|
||||
// 分组多时右侧胶囊会被面板宽度裁掉看不见 ⇒ 这里改成「适应面板宽度自动换行」,
|
||||
// 换行规则在插件自带 styles.css 的 .iwb-glp-chips 里(样式随插件发,不用等客户端发版)
|
||||
var chips = el('div', { class: 'iwb-lib-chips iwb-glp-chips' })
|
||||
function chip (label, value, count, extra) {
|
||||
var b = el('button', { class: 'iwb-chip' + (filter === value ? ' iwb-chip-active' : '') + (extra || ''), title: value === '__none__' ? '未分组;拖拽节点组卡片到此 = 移出分组' : (value === 'all' ? '' : '拖拽节点组卡片到此 = 移动到该分组') })
|
||||
b.appendChild(document.createTextNode(label))
|
||||
b.appendChild(el('span', { class: 'iwb-chip-count', text: String(count) }))
|
||||
b.addEventListener('click', function () { newOpen = false; filter = value; render() })
|
||||
b.addEventListener('dragover', function (e) { e.preventDefault(); e.stopPropagation() })
|
||||
b.addEventListener('drop', function (e) {
|
||||
e.preventDefault(); e.stopPropagation()
|
||||
var gid = e.dataTransfer && e.dataTransfer.getData('application/x-iwb-groupid')
|
||||
if (!gid) return
|
||||
assignGroup([gid], value === 'all' || value === '__none__' ? '' : value)
|
||||
})
|
||||
return b
|
||||
}
|
||||
chips.appendChild(chip('全部', 'all', list.length))
|
||||
chips.appendChild(chip('未分组', '__none__', countOf('__none__'), ' iwb-chip-drop'))
|
||||
gs.forEach(function (g) { chips.appendChild(chip(g.name, g.name, countOf(g.name), ' iwb-chip-drop')) })
|
||||
var addChip = el('button', { class: 'iwb-chip iwb-glp-add iwb-chip-add', title: '新建分组', text: '+' })
|
||||
addChip.addEventListener('click', function () { newOpen = !newOpen; render() })
|
||||
chips.appendChild(addChip)
|
||||
var mgChip = el('button', { class: 'iwb-chip iwb-glp-add iwb-chip-add', title: '管理分组(重命名 / 排序 / 删除)', text: '⚙' })
|
||||
mgChip.addEventListener('click', openManager)
|
||||
chips.appendChild(mgChip)
|
||||
fixed.appendChild(chips)
|
||||
|
||||
if (newOpen) {
|
||||
var row = el('div', { class: 'iwb-row' })
|
||||
var inp = el('input', { class: 'iwb-input iwb-grow', placeholder: '新分组名称' })
|
||||
var ok = el('button', { class: 'iwb-btn iwb-btn-primary', text: '确定' })
|
||||
var no = el('button', { class: 'iwb-btn', text: '取消' })
|
||||
ok.addEventListener('click', function () {
|
||||
var n = String(inp.value || '').trim()
|
||||
if (n && !groupsOf().some(function (x) { return x.name === n })) save(list, groupsOf().concat([{ id: n, name: n }]))
|
||||
filter = n || filter
|
||||
newOpen = false
|
||||
render()
|
||||
})
|
||||
no.addEventListener('click', function () { newOpen = false; render() })
|
||||
inp.addEventListener('keydown', function (e) { if (e.key === 'Enter') ok.click() })
|
||||
row.appendChild(inp); row.appendChild(ok); row.appendChild(no)
|
||||
fixed.appendChild(row)
|
||||
setTimeout(function () { try { inp.focus() } catch (e) { /* ignore */ } }, 0)
|
||||
}
|
||||
|
||||
// 卡片
|
||||
var cards = el('div', { class: 'iwb-lib-cards' })
|
||||
var items = visible()
|
||||
items.forEach(function (g) {
|
||||
var isEditing = editing === g.id
|
||||
var card = el('div', {
|
||||
class: 'iwb-glp-card iwb-pcard' + (isEditing ? ' iwb-pcard-editing' : '') + (manage && picked[g.id] ? ' iwb-pcard-selected' : ''),
|
||||
'data-manage': manage ? '1' : '0',
|
||||
draggable: isEditing ? 'false' : 'true',
|
||||
title: manage ? '单击选中 · 右上「移动到分组」' : '双击改名 · 拖到画布实例化 · 右键移动到分组',
|
||||
})
|
||||
card.addEventListener('dragstart', function (e) {
|
||||
if (isEditing) return
|
||||
try { card.classList.add('iwb-glp-dragging') } catch (err) { /* ignore */ }
|
||||
try {
|
||||
e.stopPropagation()
|
||||
e.dataTransfer.setData('application/x-iwb-group', JSON.stringify(g.id))
|
||||
e.dataTransfer.setData('application/x-iwb-groupid', g.id)
|
||||
e.dataTransfer.effectAllowed = 'copy'
|
||||
} catch (err) { /* ignore */ }
|
||||
})
|
||||
card.addEventListener('dragend', function () {
|
||||
try { card.classList.remove('iwb-glp-dragging') } catch (err) { /* ignore */ }
|
||||
})
|
||||
card.addEventListener('contextmenu', function (e) {
|
||||
if (manage) { e.preventDefault(); picked[g.id] = picked[g.id] ? 0 : 1; render(); return }
|
||||
openMenu(e, g)
|
||||
})
|
||||
card.addEventListener('dblclick', function (e) {
|
||||
e.stopPropagation()
|
||||
if (manage) return
|
||||
editing = g.id
|
||||
render()
|
||||
})
|
||||
|
||||
var rowEl = el('div', { class: 'iwb-row' })
|
||||
if (isEditing) {
|
||||
var input = el('input', { class: 'iwb-input iwb-grow iwb-pname-input', value: g.name || '', placeholder: '组名' })
|
||||
var cancel = false
|
||||
var commit = function () {
|
||||
if (cancel) return
|
||||
editing = ''
|
||||
var n = String(input.value || '').trim() || g.name
|
||||
if (n !== g.name) save(list.map(function (x) { return x.id === g.id ? Object.assign({}, x, { name: n }) : x }))
|
||||
else render()
|
||||
}
|
||||
input.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Enter') { e.stopPropagation(); commit() }
|
||||
if (e.key === 'Escape') { e.stopPropagation(); cancel = true; editing = ''; render() }
|
||||
})
|
||||
input.addEventListener('blur', commit)
|
||||
rowEl.appendChild(input)
|
||||
setTimeout(function () { try { input.focus(); input.select() } catch (e) { /* ignore */ } }, 0)
|
||||
} else {
|
||||
var nameEl = el('span', { class: 'iwb-pname', title: '双击改名', text: g.name || '分组' })
|
||||
rowEl.appendChild(nameEl)
|
||||
var btns = el('span', { class: 'iwb-pbtns' })
|
||||
var del = el('button', { class: 'iwb-btn iwb-btn-sm iwb-btn-danger', title: '删除节点组', text: '✕' })
|
||||
del.addEventListener('click', function (e) {
|
||||
e.stopPropagation()
|
||||
ask('删除节点组「' + (g.name || '') + '」?', { title: '删除节点组', okText: '删除' }).then(function (ok) {
|
||||
if (!ok) return
|
||||
list = list.filter(function (x) { return x.id !== g.id })
|
||||
render()
|
||||
Promise.resolve(api.remove(g.id)).catch(function () {})
|
||||
})
|
||||
})
|
||||
btns.appendChild(del)
|
||||
rowEl.appendChild(btns)
|
||||
}
|
||||
card.appendChild(rowEl)
|
||||
if (manage) {
|
||||
card.addEventListener('click', function () {
|
||||
picked[g.id] = picked[g.id] ? 0 : 1
|
||||
if (!picked[g.id]) delete picked[g.id]
|
||||
render()
|
||||
})
|
||||
} else {
|
||||
card.addEventListener('click', function (e) { e.stopPropagation() })
|
||||
}
|
||||
cards.appendChild(card)
|
||||
})
|
||||
scrollBox.appendChild(cards)
|
||||
if (!items.length) {
|
||||
var hint = loadError
|
||||
? loadError
|
||||
: (list.length
|
||||
? '当前分组下没有节点组(共 ' + list.length + ' 个,切到「全部」查看)'
|
||||
: '宿主返回 0 个收藏节点组。画布编组后点组右上角「收藏」,或用右键菜单「收藏选中节点」。')
|
||||
scrollBox.appendChild(el('div', { class: 'iwb-hint iwb-glp-empty', text: hint }))
|
||||
}
|
||||
}
|
||||
|
||||
// 宿主侧变化(画布收藏节点组 / 其它标签页同步)→ 重拉
|
||||
var off = null
|
||||
try { off = api.onChanged && api.onChanged(function () { load() }) } catch (e) { /* ignore */ }
|
||||
|
||||
load()
|
||||
|
||||
return function dispose () {
|
||||
try { if (typeof off === 'function') off() } catch (e) { /* ignore */ }
|
||||
closeMenu()
|
||||
if (modalHost && modalHost.parentNode) modalHost.parentNode.removeChild(modalHost)
|
||||
modalHost = null
|
||||
}
|
||||
}
|
||||
|
||||
global.IWBPluginHost.register({
|
||||
id: 'grouplib',
|
||||
name: '节点组',
|
||||
version: '1.0.4',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'grouplib'],
|
||||
data: { schemaVersion: 1, maxBytes: 65536 },
|
||||
}, function (ctx) {
|
||||
ctx.ui.registerPanel({
|
||||
id: PANEL_ID,
|
||||
title: '节点组',
|
||||
icon: 'group',
|
||||
// 宿主只调用 mount(node)(一个参数):必须在这里把工厂 ctx 注入,否则面板里 ctx 是 undefined ⇒ 首渲染抛异常 ⇒ 整块空白
|
||||
mount: function (host) { return mount(host, ctx) },
|
||||
})
|
||||
})
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"id": "grouplib",
|
||||
"name": "节点组",
|
||||
"version": "1.0.4",
|
||||
"apiVersion": 1,
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
"description": "左栏收藏的节点组:分组/改名/删除,拖到画布实例化(数据由客户端提供)",
|
||||
"author": "official",
|
||||
"icon": "📦",
|
||||
"tags": [
|
||||
"资源",
|
||||
"节点组"
|
||||
],
|
||||
"files": {
|
||||
"main.js": "8cb2e39f9880d49c9b9c15a1f7d62d9772170c8d0eac0faaa237bb7056af34ff",
|
||||
"styles.css": "ee6e292ffebdcc1351651bf7937399128ae06e0b364624792f34111866f9355b"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/* grouplib(节点组)自带样式
|
||||
作用域全部带 .iwb-glp-*,不影响宿主与其他插件;样式随插件发布,不必等客户端发版。 */
|
||||
|
||||
/* 分类胶囊「适应面板宽度」自动换行。
|
||||
宿主的 .iwb-lib-chips 是 flex-wrap: nowrap(配合 .iwb-lib-chips-scroll 才做单行横向滚动),
|
||||
分组多时右侧胶囊会被面板宽度裁掉、看不见也用不了。
|
||||
这里用双类选择器提高优先级(不依赖样式注入顺序),让它按宽度折行。 */
|
||||
.iwb-lib-chips.iwb-glp-chips {
|
||||
flex-wrap: wrap;
|
||||
row-gap: 6px;
|
||||
}
|
||||
|
||||
/* + / ⚙ 是动作按钮,不是分组名:不参与压缩,并与最后一个分组稍作分隔 */
|
||||
.iwb-glp-chips .iwb-glp-add {
|
||||
flex: 0 0 auto;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
/* v1.0.4(2026-11-21):卡片交互态 + 空态 + 拖拽反馈。
|
||||
颜色只走宿主 token(--iwb-plugin-* / --iwb-*),不写死。 */
|
||||
.iwb-glp-card { transition: background .12s ease, border-color .12s ease; }
|
||||
.iwb-glp-card .iwb-pname { font-weight: 600; }
|
||||
/* 删除按钮:平时隐藏,悬停/键盘聚焦才出现,减少视觉噪音 */
|
||||
.iwb-glp-card .iwb-pbtns { opacity: 0; transition: opacity .12s ease; }
|
||||
.iwb-glp-card:hover .iwb-pbtns,
|
||||
.iwb-glp-card:focus-within .iwb-pbtns { opacity: 1; }
|
||||
/* 管理模式的选中标记:右上角圆点 */
|
||||
.iwb-glp-card[data-manage="1"]::after {
|
||||
content: ''; position: absolute; right: 8px; top: 8px; width: 12px; height: 12px;
|
||||
border-radius: 50%; border: 1.5px solid var(--iwb-border2, #b9bfca); background: transparent;
|
||||
}
|
||||
.iwb-glp-card[data-manage="1"].iwb-pcard-selected::after {
|
||||
background: var(--iwb-brand, #6b7280); border-color: var(--iwb-brand, #6b7280);
|
||||
}
|
||||
/* 拖拽中:半透明 + 轻微缩放,明确"正在搬运" */
|
||||
.iwb-glp-dragging { opacity: .55; }
|
||||
/* 空态:虚线框 */
|
||||
.iwb-glp-empty {
|
||||
margin: 4px 0; padding: 14px 12px; border-radius: 10px; text-align: center;
|
||||
border: 1px dashed var(--iwb-border2, #b9bfca); color: var(--iwb-text2, #4d5668);
|
||||
font-size: 12px; line-height: 1.7;
|
||||
}
|
||||
@@ -13,9 +13,42 @@
|
||||
},
|
||||
{
|
||||
"id": "browser",
|
||||
"file": "plugin-browser.9e9fa4cdb25d.js",
|
||||
"version": "1.6.0",
|
||||
"integrity": "sha256-np+kzbJdFwMtstq90ATtFv0BoNCtCBKknNY2lXYBEQ8="
|
||||
"file": "plugin-browser.8161a82890d9.js",
|
||||
"version": "1.7.0",
|
||||
"integrity": "sha256-gWGoKJDZZyTZCirpyJSdN6+S+UuUTNUlrcB7ZbXqtPQ="
|
||||
},
|
||||
{
|
||||
"id": "gallery",
|
||||
"dir": "gallery",
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
"version": "1.6.9",
|
||||
"files": {
|
||||
"main.js": "26c7e64b3a0021c6b9514dfb84d4d2580276698222b4791cfa99f22ead66ff52",
|
||||
"styles.css": "9d5b4ab1343761e51ef0c479cab96a94d3d6eaa27f0fdb500bff789ec81d70e0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "grouplib",
|
||||
"dir": "grouplib",
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
"version": "1.0.4",
|
||||
"files": {
|
||||
"main.js": "8cb2e39f9880d49c9b9c15a1f7d62d9772170c8d0eac0faaa237bb7056af34ff",
|
||||
"styles.css": "ee6e292ffebdcc1351651bf7937399128ae06e0b364624792f34111866f9355b"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "promptlib",
|
||||
"dir": "promptlib",
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
"version": "1.8.21",
|
||||
"files": {
|
||||
"main.js": "125e02a618e37505836f964dbe21a3637e3043ee355d9606c538a54eed4243ad",
|
||||
"styles.css": "84ad2314d016c7d2351eb7cf2044ee8cc703992d40a76002ff644d34eb48838a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "image-annotate",
|
||||
@@ -31,9 +64,9 @@
|
||||
},
|
||||
{
|
||||
"id": "style-source",
|
||||
"file": "plugin-style-source.ee7168565a44.js",
|
||||
"version": "1.3.2",
|
||||
"integrity": "sha256-7nFoVlpE1J2q8wD2LVx6EG5g+6KankiI/4v9mr0uMXg="
|
||||
"file": "plugin-style-source.05c108f8a63c.js",
|
||||
"version": "1.3.3",
|
||||
"integrity": "sha256-BcEI+KY8wcXrscHRi0reEOlxoO50+xNUgtt1l+ZzH4Q="
|
||||
},
|
||||
{
|
||||
"id": "white-bg-800",
|
||||
|
||||
@@ -86,5 +86,36 @@
|
||||
"浏览器",
|
||||
"效率"
|
||||
]
|
||||
},
|
||||
"gallery": {
|
||||
"name": "图库",
|
||||
"desc": "右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供)",
|
||||
"author": "official",
|
||||
"icon": "🖼️",
|
||||
"color": "#eef2f6",
|
||||
"tags": [
|
||||
"资源",
|
||||
"图库"
|
||||
]
|
||||
},
|
||||
"grouplib": {
|
||||
"name": "节点组",
|
||||
"desc": "左栏收藏的节点组:分组/改名/删除,拖到画布实例化(数据由客户端提供)",
|
||||
"author": "official",
|
||||
"icon": "📦",
|
||||
"tags": [
|
||||
"资源",
|
||||
"节点组"
|
||||
]
|
||||
},
|
||||
"promptlib": {
|
||||
"name": "提示词库",
|
||||
"desc": "右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供)",
|
||||
"author": "official",
|
||||
"icon": "📖",
|
||||
"tags": [
|
||||
"资源",
|
||||
"提示词"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"id": "promptlib",
|
||||
"name": "提示词库",
|
||||
"version": "1.8.21",
|
||||
"apiVersion": 1,
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
"description": "右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供)",
|
||||
"author": "official",
|
||||
"icon": "📖",
|
||||
"tags": [
|
||||
"资源",
|
||||
"提示词"
|
||||
],
|
||||
"files": {
|
||||
"main.js": "125e02a618e37505836f964dbe21a3637e3043ee355d9606c538a54eed4243ad",
|
||||
"styles.css": "84ad2314d016c7d2351eb7cf2044ee8cc703992d40a76002ff644d34eb48838a"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,561 @@
|
||||
/* promptlib(提示词库)自带样式
|
||||
作用域全部带 .iwb-plp-*,不影响宿主与其他插件;样式随插件发布,不必等客户端发版。 */
|
||||
|
||||
/* 分组胶囊「适应面板宽度」自动换行。
|
||||
宿主的 .iwb-lib-chips 是 flex-wrap: nowrap(配 .iwb-lib-chips-scroll 做单行横向滚动 + 右侧渐隐),
|
||||
分组多时靠后的分类看不见也点不到。双类选择器提高优先级(不依赖样式注入顺序)。 */
|
||||
.iwb-lib-chips.iwb-plp-chips {
|
||||
flex-wrap: wrap;
|
||||
row-gap: 6px;
|
||||
}
|
||||
|
||||
/* + / ⚙ 是动作按钮,不是分组名:不参与压缩,并与最后一个分组稍作分隔 */
|
||||
.iwb-plp-chips .iwb-plp-add {
|
||||
flex: 0 0 auto;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
/* v1.0.2(2026-11-21):卡片化 —— 白卡 + 悬停 + 文本三行截断。
|
||||
颜色一律走宿主 --iwb-plugin-* / --iwb-* token,不在插件里写死。 */
|
||||
.iwb-promptlib .iwb-pname { font-weight: 600; }
|
||||
.iwb-promptlib .iwb-ptext {
|
||||
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
|
||||
overflow: hidden; color: var(--iwb-text2, #4d5668);
|
||||
}
|
||||
.iwb-promptlib .iwb-lib-cards { gap: 8px; }
|
||||
|
||||
/* v1.1.0(2026-11-21):封面网格 + 长文详情 + 宽编辑弹窗。
|
||||
颜色全部走宿主 token,不写死。 */
|
||||
.iwb-plp-card {
|
||||
position: relative; border-radius: 10px; overflow: hidden; cursor: pointer;
|
||||
aspect-ratio: 1 / 1; border: 1px solid var(--iwb-border, #d5d9e0);
|
||||
transition: border-color .12s ease, transform .12s ease;
|
||||
}
|
||||
.iwb-plp-card:hover { border-color: var(--iwb-border2, #b9bfca); }
|
||||
.iwb-plp-cover { width: 100%; height: 100%; object-fit: cover; display: block; }
|
||||
.iwb-plp-t {
|
||||
position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 7px 6px;
|
||||
background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,.66));
|
||||
color: var(--plp-c1, #fff); font-size: 10.5px; line-height: 1.35; max-height: 48%;
|
||||
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
|
||||
text-shadow: 0 1px 2px rgba(0,0,0,.35);
|
||||
}
|
||||
/* 详情:长文阅读 */
|
||||
.iwb-plp-dhead { display: flex; align-items: center; gap: 6px; padding: 2px 0 8px; position: sticky; top: 0; z-index: 2; background: var(--iwb-plugin-surface, #fafafb); }
|
||||
.iwb-plp-dtop { align-items: flex-start; gap: 10px; margin-bottom: 8px; }
|
||||
.iwb-plp-dthumb { flex: 0 0 84px; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; border: 1px solid var(--iwb-border, #d5d9e0); }
|
||||
.iwb-plp-dmeta { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
|
||||
.iwb-plp-dtitle { font-size: 13px; font-weight: 600; color: var(--iwb-text, #1c2333); line-height: 1.45; }
|
||||
.iwb-plp-dtext {
|
||||
font-size: 12px; line-height: 1.75; color: var(--iwb-text2, #4d5668);
|
||||
white-space: pre-wrap; word-break: break-word; padding: 4px 0 12px;
|
||||
}
|
||||
.iwb-plp-dfoot { display: flex; align-items: center; gap: 6px; padding: 8px 0 2px; position: sticky; bottom: 0; background: var(--iwb-plugin-surface, #fafafb); }
|
||||
/* 编辑弹窗:760 宽 + 大文本框 */
|
||||
.iwb-promptlib-editor { width: 760px; max-width: 94vw; }
|
||||
.iwb-promptlib-editor .iwb-modal-body { max-height: 78vh; }
|
||||
.iwb-promptlib-text { min-height: 360px; height: 44vh; font-size: 12.5px; line-height: 1.9; resize: vertical; }
|
||||
.iwb-plp-editor-cover { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
|
||||
.iwb-plp-editor-thumb { flex: 0 0 96px; width: 96px; height: 128px; border-radius: 8px; overflow: hidden; border: 1px solid var(--iwb-border, #d5d9e0); }
|
||||
.iwb-plp-editor-coverops { display: flex; flex-direction: column; gap: 8px; }
|
||||
|
||||
/* v1.2.0:可拖动 / 可缩放的详情与编辑弹窗(同宽 880×640,最小 640×420) */
|
||||
.iwb-plp-mask { background: transparent; display: block; }
|
||||
.iwb-plp-dialog { display: flex; flex-direction: column; overflow: hidden; border-radius: 16px;
|
||||
box-shadow: 0 24px 60px rgba(0,0,0,.28); }
|
||||
.iwb-plp-dhead { display: flex; align-items: center; gap: 6px; padding: 10px 14px;
|
||||
border-bottom: 1px solid var(--iwb-border, #d5d9e0); cursor: move; user-select: none; }
|
||||
.iwb-plp-grip { display: grid; grid-template-columns: repeat(3, 3px); gap: 2px; margin-right: 6px; }
|
||||
.iwb-plp-grip i { width: 3px; height: 3px; border-radius: 50%; background: var(--iwb-border2, #b9bfca); display: block; }
|
||||
.iwb-plp-dbody { flex: 1 1 auto; min-height: 0; display: flex; gap: 14px; padding: 14px; }
|
||||
.iwb-plp-dcov { flex: 0 0 210px; width: 210px; height: 280px; border-radius: 10px; overflow: hidden;
|
||||
border: 1px solid var(--iwb-border, #d5d9e0); background: var(--iwb-plugin-inset, #f5f6f7); }
|
||||
.iwb-plp-dright { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
|
||||
.iwb-plp-dtext { flex: 1 1 auto; min-height: 0; overflow: auto; white-space: pre-wrap; word-break: break-word;
|
||||
font-size: 12px; line-height: 1.9; color: var(--iwb-text2, #4d5668); }
|
||||
.iwb-plp-dfooter { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 10px 14px;
|
||||
border-top: 1px solid var(--iwb-border, #d5d9e0); }
|
||||
.iwb-plp-resize { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize;
|
||||
background: linear-gradient(135deg, transparent 0 45%, var(--iwb-border2, #b9bfca) 45% 50%, transparent 50% 62%, var(--iwb-border2, #b9bfca) 62% 67%, transparent 67%); }
|
||||
/* 编辑:左栏固定 240,右栏大文本框 */
|
||||
.iwb-plp-eleft { flex: 0 0 240px; width: 240px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
|
||||
.iwb-plp-ecov { width: 240px; height: 300px; border-radius: 10px; overflow: hidden;
|
||||
border: 1px solid var(--iwb-border, #d5d9e0); background: var(--iwb-plugin-inset, #f5f6f7); }
|
||||
.iwb-plp-lrow { display: flex; flex-direction: column; gap: 4px; font-size: 10px; color: var(--iwb-text2, #4d5668); }
|
||||
.iwb-plp-etext { flex: 1 1 auto; min-height: 0; height: auto; resize: none; font-size: 12px; line-height: 1.9; }
|
||||
/* 输入框边框柔化(用户反馈现在的边框太深) */
|
||||
.iwb-plp-dialog .iwb-input { border-color: color-mix(in srgb, var(--iwb-border, #d5d9e0) 72%, transparent); }
|
||||
.iwb-plp-dialog .iwb-input:focus { border-color: var(--iwb-brand, #6b7280); box-shadow: 0 0 0 2px color-mix(in srgb, var(--iwb-brand, #6b7280) 14%, transparent); }
|
||||
|
||||
/* v1.2.1:去掉弹窗里多余的线框(用户反馈“线框太多、太明显”) */
|
||||
.iwb-plp-dialog .iwb-plp-dcov,
|
||||
.iwb-plp-dialog .iwb-plp-ecov { border-color: transparent; }
|
||||
.iwb-plp-dialog .iwb-plp-dhead { border-bottom-color: color-mix(in srgb, var(--iwb-border, #d5d9e0) 45%, transparent); }
|
||||
.iwb-plp-dialog .iwb-plp-dfooter { border-top-color: color-mix(in srgb, var(--iwb-border, #d5d9e0) 45%, transparent); }
|
||||
/* 输入框:默认无边框,用浅底区分;聚焦才出现细描边 */
|
||||
.iwb-plp-dialog .iwb-input {
|
||||
border-color: transparent;
|
||||
background: var(--iwb-plugin-inset, #f5f6f7);
|
||||
box-shadow: none;
|
||||
}
|
||||
.iwb-plp-dialog .iwb-input:hover { background: var(--iwb-plugin-hover, #eef1f4); }
|
||||
.iwb-plp-dialog .iwb-input:focus {
|
||||
background: var(--iwb-panel, #fff);
|
||||
border-color: color-mix(in srgb, var(--iwb-brand, #6b7280) 55%, transparent);
|
||||
box-shadow: 0 0 0 2px color-mix(in srgb, var(--iwb-brand, #6b7280) 12%, transparent);
|
||||
}
|
||||
/* 正文编辑区:无边框、无底色,像一张纸 */
|
||||
.iwb-plp-dialog .iwb-plp-etext { border-color: transparent; background: transparent; box-shadow: none; }
|
||||
.iwb-plp-dialog .iwb-plp-etext:focus { border-color: transparent; box-shadow: none; background: transparent; }
|
||||
/* 左侧封面区的两个按钮:去掉按钮描边,弱化成文字按钮 */
|
||||
.iwb-plp-dialog .iwb-plp-eleft .iwb-btn { border-color: transparent; background: var(--iwb-plugin-inset, #f5f6f7); }
|
||||
.iwb-plp-dialog .iwb-plp-eleft .iwb-btn:hover { background: var(--iwb-plugin-hover, #eef1f4); }
|
||||
|
||||
/* v1.3.3:封面比例不定 —— 详情/编辑里完整显示(contain,不裁切);列表保持方形裁切(网格整齐) */
|
||||
.iwb-plp-dialog .iwb-plp-dcov img,
|
||||
.iwb-plp-dialog .iwb-plp-ecov img { object-fit: contain; background: var(--iwb-plugin-inset, #f5f6f7); }
|
||||
.iwb-plp-dialog .iwb-plp-dcov,
|
||||
.iwb-plp-dialog .iwb-plp-ecov { background: var(--iwb-plugin-inset, #f5f6f7); }
|
||||
.iwb-plp-card .iwb-plp-cover { object-fit: cover; object-position: center; }
|
||||
|
||||
/* v1.3.4:瀑布流(列式)+ 卡片定宽不随面板拉伸;面板底色统一走 --iwb-plugin-surface */
|
||||
.iwb-promptlib .iwb-plp-card {
|
||||
display: inline-block; width: 100%; margin: 0 0 8px;
|
||||
break-inside: avoid; -webkit-column-break-inside: avoid;
|
||||
aspect-ratio: auto; /* 高度交给图片原始比例 */
|
||||
}
|
||||
.iwb-promptlib .iwb-plp-cover { width: 100%; height: auto; object-fit: contain; }
|
||||
/* 统一插件灰:面板底(宿主会给 --iwb-plugin-surface,这里只留兜底) */
|
||||
.iwb-promptlib { background: transparent; }
|
||||
|
||||
/* v1.3.5:无封面的提示词也给一个方形占位(否则瀑布流里会塌成一条线) */
|
||||
.iwb-promptlib .iwb-plp-card.no-cover { aspect-ratio: 1 / 1; }
|
||||
.iwb-promptlib .iwb-plp-card.no-cover .iwb-plp-t { max-height: 60%; }
|
||||
|
||||
/* v1.4.7:恢复瀑布流列规则(1.4.0 清理 CSS 时把这组规则一起删掉了,列表退化成单列、卡片被拉满宽) */
|
||||
.iwb-promptlib .iwb-lib-cards { display: block; column-width: 122px; column-gap: 8px; grid-template-columns: none; }
|
||||
.iwb-promptlib .iwb-plp-card { display: inline-block; width: 100%; margin: 0 0 8px; break-inside: avoid; -webkit-column-break-inside: avoid; aspect-ratio: auto; }
|
||||
.iwb-promptlib .iwb-plp-cover { width: 100%; height: auto; object-fit: contain; }
|
||||
.iwb-promptlib .iwb-plp-card.no-cover { aspect-ratio: 1 / 1; }
|
||||
|
||||
/* v1.5.0:模板节点 + 变量标记 */
|
||||
.iwb-plp-vdot{position:absolute;right:8px;top:8px;width:7px;height:7px;border-radius:50%;background:var(--iwb-plp-accent, #7c4dff);box-shadow:0 0 0 2px var(--iwb-plp-dot-ring, rgba(255,255,255,.75))}
|
||||
.iwb-plp-node{display:flex;flex-direction:column;gap:6px;padding:8px 10px;font-size:12px;color:var(--iwb-text,#1c2333)}
|
||||
.iwb-plp-nhead{display:flex;align-items:center;gap:8px}
|
||||
.iwb-plp-nthumb{width:44px;height:44px;border-radius:8px;object-fit:cover;flex:0 0 auto}
|
||||
.iwb-plp-ntitle{font-weight:600;font-size:12.5px;line-height:1.3;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
|
||||
.iwb-plp-nvars{display:flex;flex-direction:column;gap:4px}
|
||||
.iwb-plp-nrow{display:flex;align-items:center;gap:6px;height:26px}
|
||||
.iwb-plp-nk{width:64px;flex:0 0 64px;color:var(--iwb-text2,#5b6472);font-size:11.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.iwb-plp-nin{flex:1;height:24px;font-size:11.5px}
|
||||
.iwb-plp-nref{display:flex;align-items:center;gap:6px;font-size:11.5px;color:var(--iwb-text2,#5b6472);border-top:1px dashed var(--iwb-border,#e3e5e9);padding-top:6px}
|
||||
.iwb-plp-nref em{font-style:normal;color:var(--iwb-text2,#8b929c)}
|
||||
.iwb-plp-nprev{margin-top:2px;border-top:1px dashed var(--iwb-border,#e3e5e9);padding-top:6px;color:var(--iwb-text2,#5b6472);font-size:11.5px;line-height:1.6;max-height:88px;overflow:hidden}
|
||||
|
||||
/* v1.5.0:变量编辑器 / 详情变量 */
|
||||
.iwb-plp-emid{flex:1;min-width:0;display:flex;flex-direction:column;gap:8px}
|
||||
.iwb-plp-vars{border:1px solid var(--iwb-border,#e3e5e9);border-radius:10px;padding:8px 10px;display:flex;flex-direction:column;gap:6px;background:var(--iwb-plugin-surface,#fff)}
|
||||
.iwb-plp-vhead{display:flex;align-items:center;gap:8px;font-size:11.5px;color:var(--iwb-text2,#5b6472)}
|
||||
.iwb-plp-vhint{color:var(--iwb-text2,#8b929c);font-size:11px}
|
||||
.iwb-plp-vchips{display:flex;flex-wrap:wrap;gap:6px}
|
||||
.iwb-plp-vchip{display:inline-flex;align-items:center;gap:4px;padding:1px 7px;border-radius:6px;background:color-mix(in srgb, var(--iwb-plp-accent, #7c4dff) 10%, transparent);color:var(--iwb-plp-accent, #5a4bd0);font-size:11.5px}
|
||||
.iwb-plp-vx{font-style:normal;cursor:pointer;color:var(--iwb-plp-accent, #8b7ff0);font-weight:700}
|
||||
.iwb-plp-vrows{display:flex;flex-direction:column;gap:5px}
|
||||
.iwb-plp-vrow{display:flex;align-items:center;gap:8px}
|
||||
.iwb-plp-vk{width:92px;flex:0 0 92px;font-size:11.5px;color:var(--iwb-text2,#5b6472);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.iwb-plp-vin{flex:1;height:26px;font-size:11.5px}
|
||||
.iwb-plp-vprev{margin-top:2px;border-top:1px dashed var(--iwb-border,#e3e5e9);padding-top:6px;font-size:11.5px;line-height:1.6;color:var(--iwb-text2,#5b6472);max-height:72px;overflow:auto;white-space:pre-wrap}
|
||||
.iwb-plp-dvars{display:flex;flex-direction:column;gap:5px;border:1px solid var(--iwb-border,#e3e5e9);border-radius:10px;padding:8px 10px}
|
||||
|
||||
/* v1.5.6:模板节点参照风格节点 —— 封面 + 名称 + 变量,正文不再铺开 */
|
||||
.iwb-plp-nthumb{width:56px;height:56px;border-radius:8px;object-fit:cover;flex:0 0 auto}
|
||||
.iwb-plp-ntitlebox{min-width:0;display:flex;flex-direction:column;gap:2px}
|
||||
.iwb-plp-ntitle{font-weight:600;font-size:12.5px;line-height:1.3;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
|
||||
.iwb-plp-nmeta{font-size:10.5px;color:var(--iwb-text2,#8b929c)}
|
||||
.iwb-plp-nempty{font-size:11px;color:var(--iwb-text2,#8b929c);padding:2px 0}
|
||||
.iwb-plp-nwarn{font-size:11px;line-height:1.5;color:var(--iwb-warn,#d97706)}
|
||||
|
||||
/* v1.5.10:设置页 */
|
||||
.iwb-plp-settings{display:flex;flex-direction:column;gap:18px}
|
||||
.iwb-plp-ssec{border:1px solid var(--iwb-border,#e3e5e9);border-radius:12px;padding:12px 14px;display:flex;flex-direction:column;gap:8px}
|
||||
.iwb-plp-stitle{font-weight:600;font-size:12.5px}
|
||||
.iwb-plp-sgroups{display:flex;flex-direction:column;border:1px solid var(--iwb-border,#eef0f2);border-radius:10px;overflow:hidden}
|
||||
.iwb-plp-sgrow{display:flex;align-items:center;gap:8px;padding:7px 10px;border-top:1px solid var(--iwb-border,#f1f3f5)}
|
||||
.iwb-plp-sgrow:first-child{border-top:0}
|
||||
.iwb-plp-sgrip{width:12px;height:12px;background:radial-gradient(var(--iwb-text2,#c2c7cf) 1px,transparent 1px);background-size:4px 4px;border-radius:3px;flex:0 0 auto}
|
||||
.iwb-plp-sgname{width:170px;height:26px;font-size:12px}
|
||||
.iwb-plp-sgcount{font-size:11.5px;color:var(--iwb-text2,#8b929c);width:56px}
|
||||
.iwb-plp-sadd{display:flex;gap:8px;align-items:center}
|
||||
.iwb-plp-sbtns{display:flex;gap:8px;align-items:center}
|
||||
.iwb-plp-sopt{display:flex;gap:8px;align-items:center;font-size:12px;color:var(--iwb-text2,#4d5668)}
|
||||
.iwb-plp-settings{max-height:calc(100vh - 230px);overflow:auto;padding-right:4px}
|
||||
|
||||
/* v1.6.2:正文上方工具行 */
|
||||
.iwb-plp-etool{display:flex;align-items:center;gap:8px}
|
||||
.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:宿主基础样式的插件作用域副本 —— 宿主改全局样式不再影响插件 */
|
||||
.iwb-promptlib .iwb-grow {
|
||||
flex: 1;
|
||||
}
|
||||
.iwb-promptlib .iwb-row {
|
||||
display: flex; gap: 6px; align-items: center;
|
||||
}
|
||||
.iwb-promptlib .iwb-hint {
|
||||
font-size: 10px; color: var(--iwb-text2); margin-top: 4px;
|
||||
}
|
||||
.iwb-promptlib .iwb-toolbar-title {
|
||||
font-weight: 700; font-size: 13px; margin-right: 2px;
|
||||
}
|
||||
.iwb-plp-mask {
|
||||
position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 300; display: flex; align-items: center; justify-content: center;
|
||||
}
|
||||
.iwb-plp-dialog {
|
||||
width: 680px; max-width: calc(100vw - 60px); max-height: 82vh; background: var(--iwb-panel); border: 1px solid var(--iwb-border2); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden;
|
||||
}
|
||||
.iwb-plp-dialog-head {
|
||||
display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--iwb-border);
|
||||
}
|
||||
.iwb-plp-dialog-body {
|
||||
padding: 14px 16px; overflow: auto; display: flex; flex-direction: column; gap: 10px; max-height: 62vh;
|
||||
}
|
||||
.iwb-promptlib .iwb-lib-body {
|
||||
flex: 1; overflow: hidden; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
|
||||
}
|
||||
.iwb-promptlib .iwb-lib-fixed {
|
||||
flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px;
|
||||
}
|
||||
.iwb-promptlib .iwb-lib-scroll {
|
||||
flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 2px;
|
||||
}
|
||||
.iwb-promptlib .iwb-lib-chips-scroll::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
.iwb-promptlib .iwb-lib-chips-scroll > .iwb-chip:last-child {
|
||||
margin-right: 18px;
|
||||
}
|
||||
.iwb-promptlib .iwb-lib-searchscope-back {
|
||||
display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; padding: 0; border: none; border-radius: 999px; background: transparent; color: var(--iwb-text2); font-size: 13px; line-height: 1; cursor: pointer;
|
||||
}
|
||||
.iwb-promptlib .iwb-lib-searchscope-back:hover {
|
||||
background: color-mix(in srgb, var(--iwb-text) 12%, transparent); color: var(--iwb-text);
|
||||
}
|
||||
.iwb-promptlib .iwb-chip {
|
||||
flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; background: var(--iwb-layer); border: 1px solid var(--iwb-border); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--iwb-text2); cursor: pointer; white-space: nowrap; transition: all 0.15s;
|
||||
}
|
||||
.iwb-promptlib .iwb-chip:hover {
|
||||
color: var(--iwb-text); border-color: var(--iwb-border2);
|
||||
}
|
||||
.iwb-promptlib .iwb-chip-active {
|
||||
background: var(--iwb-panel); border-color: var(--iwb-border2); color: var(--iwb-text); font-weight: 600;
|
||||
}
|
||||
.iwb-promptlib .iwb-chip-active:hover {
|
||||
color: var(--iwb-text);
|
||||
}
|
||||
.iwb-promptlib .iwb-chip-count {
|
||||
font-size: 10px; opacity: 0.8;
|
||||
}
|
||||
.iwb-promptlib .iwb-chip-add {
|
||||
font-weight: 700;
|
||||
}
|
||||
.iwb-promptlib .iwb-pcard .iwb-btn:hover {
|
||||
opacity: 1; color: var(--iwb-text); background: transparent;
|
||||
}
|
||||
.iwb-promptlib .iwb-pcard .iwb-btn-starred {
|
||||
color: var(--iwb-text); opacity: 1;
|
||||
}
|
||||
.iwb-promptlib .iwb-pcard {
|
||||
border: 1px solid var(--iwb-border); border-radius: 8px; padding: 8px 10px; background: var(--iwb-panel);
|
||||
}
|
||||
.iwb-promptlib .iwb-tag {
|
||||
display: inline-block; background: color-mix(in srgb, var(--iwb-text) 7%, transparent); color: var(--iwb-text2); border-radius: 4px; font-size: 10px; padding: 1px 6px; margin: 3px 4px 0 0;
|
||||
}
|
||||
.iwb-plp-dialog-sm {
|
||||
width: 460px;
|
||||
}
|
||||
.iwb-promptlib .iwb-pcard {
|
||||
cursor: grab;
|
||||
}
|
||||
.iwb-promptlib .iwb-pcard:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
.iwb-promptlib .iwb-btn-primary .iwb-ic {
|
||||
width: 15px; height: 15px;
|
||||
}
|
||||
.iwb-promptlib .iwb-btn:hover {
|
||||
border-color: var(--iwb-brand); color: var(--iwb-brand);
|
||||
}
|
||||
.iwb-promptlib .iwb-btn:active {
|
||||
transform: translateY(1px);
|
||||
}
|
||||
.iwb-promptlib .iwb-btn:focus-visible {
|
||||
outline: 2px solid color-mix(in srgb, var(--iwb-brand) 60%, transparent); outline-offset: 1px;
|
||||
}
|
||||
.iwb-promptlib .iwb-btn:disabled {
|
||||
opacity: 0.45; cursor: not-allowed; transform: none;
|
||||
}
|
||||
.iwb-promptlib .iwb-btn-primary {
|
||||
background: var(--iwb-brand); border-color: var(--iwb-brand); color: var(--iwb-on-brand);
|
||||
}
|
||||
.iwb-promptlib .iwb-btn-primary:hover {
|
||||
background: color-mix(in srgb, var(--iwb-brand) 85%, var(--iwb-text)); border-color: var(--iwb-brand); color: var(--iwb-on-brand);
|
||||
}
|
||||
.iwb-promptlib .iwb-btn-sm {
|
||||
padding: 3px 7px; font-size: 11px;
|
||||
}
|
||||
.iwb-promptlib .iwb-btn-danger {
|
||||
color: var(--iwb-err);
|
||||
}
|
||||
.iwb-promptlib .iwb-btn-danger:hover {
|
||||
border-color: var(--iwb-err); color: var(--iwb-err);
|
||||
}
|
||||
.iwb-promptlib .iwb-ctxmenu {
|
||||
position: fixed; min-width: 196px; max-width: 240px; max-height: calc(100vh - 24px); overflow-y: auto; padding: 6px; background: var(--iwb-layer); border: 1px solid var(--iwb-border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.16); z-index: 91; display: flex; flex-direction: column; gap: 2px;
|
||||
}
|
||||
.iwb-promptlib .iwb-ctx-title {
|
||||
font-size: 10px; font-weight: 700; color: var(--iwb-text2); letter-spacing: 1px; padding: 6px 10px 2px; text-transform: uppercase;
|
||||
}
|
||||
.iwb-promptlib .iwb-ctx-item {
|
||||
display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: none; border-radius: 8px; background: transparent; color: var(--iwb-text); font-size: 12.5px; cursor: pointer; text-align: left;
|
||||
}
|
||||
.iwb-promptlib .iwb-ctx-item .iwb-ic {
|
||||
width: 14px; height: 14px; flex: 0 0 auto; color: var(--iwb-text2);
|
||||
}
|
||||
.iwb-promptlib .iwb-ctx-item:hover:not(:disabled) {
|
||||
background: color-mix(in srgb, var(--iwb-brand) 12%, transparent); color: var(--iwb-text);
|
||||
}
|
||||
.iwb-promptlib .iwb-ctx-item:hover:not(:disabled) .iwb-ic {
|
||||
color: var(--iwb-brand);
|
||||
}
|
||||
.iwb-promptlib .iwb-ctx-item:disabled {
|
||||
opacity: 0.38; cursor: default;
|
||||
}
|
||||
.iwb-promptlib .iwb-ctx-item.iwb-ctx-danger {
|
||||
color: var(--iwb-err);
|
||||
}
|
||||
.iwb-promptlib .iwb-ctx-item.iwb-ctx-danger .iwb-ic {
|
||||
color: var(--iwb-err);
|
||||
}
|
||||
.iwb-promptlib .iwb-ctx-item.iwb-ctx-danger:hover:not(:disabled) {
|
||||
background: color-mix(in srgb, var(--iwb-err) 10%, transparent); color: var(--iwb-err);
|
||||
}
|
||||
.iwb-promptlib .iwb-ctx-sep {
|
||||
height: 1px; margin: 4px 6px; background: var(--iwb-border); flex: 0 0 auto;
|
||||
}
|
||||
.iwb-promptlib .iwb-drawer-spacer {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.iwb-plp-dialog .iwb-section-sub {
|
||||
margin-top: 2px;
|
||||
}
|
||||
.iwb-plp-mask.iwb-mask-ghost .iwb-settings-modal {
|
||||
box-shadow: 0 24px 60px rgba(0,0,0,.32);
|
||||
}
|
||||
|
||||
/* v1.6.7:卡片长按可拖的视觉反馈 */
|
||||
.iwb-plp-card{cursor:grab}
|
||||
.iwb-plp-card.is-armed{border-color:var(--iwb-plp-accent,#7c4dff);box-shadow:0 0 0 2px color-mix(in srgb,var(--iwb-plp-accent,#7c4dff) 20%,transparent)}
|
||||
.iwb-plp-card.is-dragging{opacity:.55;transform:scale(.98);cursor:grabbing}
|
||||
|
||||
/* v1.6.8:卡片悬停放大 + 按下/拖拽反馈 */
|
||||
.iwb-plp-card{transition:transform .14s ease, box-shadow .14s ease, border-color .14s ease, opacity .14s ease}
|
||||
.iwb-plp-card:hover{transform:scale(1.03);box-shadow:0 8px 22px rgba(0,0,0,.14);z-index:2}
|
||||
.iwb-plp-card.is-pressed{border-color:var(--iwb-plp-accent,#7c4dff);box-shadow:0 0 0 2px color-mix(in srgb,var(--iwb-plp-accent,#7c4dff) 22%,transparent)}
|
||||
.iwb-plp-card.is-dragging{opacity:.55;transform:scale(.98)}
|
||||
|
||||
/* v1.6.9:拖拽虚拟卡片(跟手预览) */
|
||||
.iwb-plp-dragghost{width:168px;display:flex;align-items:center;gap:8px;padding:8px 10px;background:var(--iwb-panel,#fff);border:2px solid var(--iwb-plp-accent,#7c4dff);border-radius:11px;box-shadow:0 12px 28px rgba(0,0,0,.22);font-size:12px;pointer-events:none;z-index:99999}
|
||||
.iwb-plp-ghostcov{width:38px;height:38px;border-radius:8px;object-fit:cover;flex:0 0 auto;background:var(--iwb-plugin-inset,#eef0f2)}
|
||||
.iwb-plp-ghosttxt{min-width:0;display:flex;flex-direction:column;gap:2px}
|
||||
.iwb-plp-ghostname{font-weight:600;color:var(--iwb-text,#1c2333);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.iwb-plp-ghosthint{font-size:10.5px;color:var(--iwb-plp-accent,#5a4bd0)}
|
||||
|
||||
/* v1.6.10:悬停放大改为「内层背景层缩放」——卡片命中区域不变,渐变卡不再闪烁 */
|
||||
.iwb-plp-bg{position:absolute;inset:0;overflow:hidden;border-radius:inherit;transition:transform .16s ease;will-change:transform;backface-visibility:hidden}
|
||||
.iwb-plp-card:hover .iwb-plp-bg{transform:scale(1.045)}
|
||||
.iwb-plp-card:hover{border-color:var(--iwb-border2,#b9bfca);box-shadow:0 8px 22px rgba(0,0,0,.14)}
|
||||
/* 取消卡片本体的缩放/层级切换(闪烁与边缘点击丢失的来源) */
|
||||
.iwb-plp-card{transform:none}
|
||||
.iwb-plp-card:hover{transform:none;z-index:auto}
|
||||
.iwb-plp-card.is-dragging{opacity:.55}
|
||||
.iwb-plp-bg,.iwb-plp-cover{pointer-events:none}
|
||||
|
||||
/* v1.6.11:封面卡瀑布流高度由图片决定 —— 背景层必须是普通流,不能绝对定位(否则卡塌成一条线) */
|
||||
.iwb-plp-bg{position:relative;inset:auto;width:100%}
|
||||
.iwb-plp-card.no-cover .iwb-plp-bg{position:absolute;inset:0}
|
||||
.iwb-plp-bg .iwb-plp-cover{width:100%;height:auto;object-fit:contain;display:block}
|
||||
|
||||
/* v1.6.13:未选中时变量输入框不拦截指针 —— 单击节点=选中/可拖动;选中后再点输入框编辑 */
|
||||
.iwb-plp-node:not(.is-selected) input{pointer-events:none}
|
||||
.iwb-plp-card{user-select:none}
|
||||
body.iwb-plp-dragging, body.iwb-plp-dragging *{user-select:none!important;-webkit-user-select:none!important}
|
||||
.iwb-plp-placeghost{border-style:dashed!important;pointer-events:none}
|
||||
.iwb-plp-placehint{font-size:10.5px;color:var(--iwb-plp-accent,#5a4bd0);margin-top:2px}
|
||||
.iwb-plp-placebox{position:fixed;left:-9999px;top:0;z-index:99999;pointer-events:none;border:2px dashed var(--iwb-plp-accent,#6b4dff);border-radius:12px;background:color-mix(in srgb,var(--iwb-plp-accent,#6b4dff) 9%,transparent);display:flex;align-items:center;justify-content:center;box-shadow:0 10px 26px rgba(30,20,80,.10)}
|
||||
.iwb-plp-placebox-t{font-size:12px;color:var(--iwb-plp-accent,#5a3fd0);background:rgba(255,255,255,.82);border-radius:999px;padding:3px 10px}
|
||||
/* v1.6.23:放置指示改为灰色小方框 */
|
||||
.iwb-plp-placebox{border: 2px dashed var(--plp-c2, #9aa3ad);border-radius:10px;background:rgba(122,130,142,.10);box-shadow:none}
|
||||
.iwb-plp-placebox-t{font-size:11px;color: var(--plp-c3, #6b7280);background:rgba(255,255,255,.75);padding:2px 8px}
|
||||
/* v1.7.0:编辑面板三栏 + 可拖宽;详情封面放大、变量高亮 */
|
||||
.iwb-plp-eleft{flex:0 0 236px;width:236px}
|
||||
.iwb-plp-emid{flex:1 1 auto;min-width:220px;display:flex;flex-direction:column;min-height:0}
|
||||
.iwb-plp-emid .iwb-plp-etext{flex:1 1 auto;min-height:0;resize:none}
|
||||
.iwb-plp-esplit{flex:0 0 10px;cursor:col-resize;display:flex;align-items:center;justify-content:center;border-radius:6px;background:var(--iwb-plugin-inset,#f3f4f7)}
|
||||
.iwb-plp-esplit:hover{background:var(--iwb-plugin-hover,#e9ecf1)}
|
||||
.iwb-plp-eright{flex:0 0 auto;width:300px;min-width:190px;max-width:460px;display:flex;flex-direction:column;min-height:0;background:var(--iwb-plugin-surface,#fafbfc);border:1px solid var(--iwb-border,#e6e8ec);border-radius:10px;padding:8px}
|
||||
.iwb-plp-vars{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
|
||||
.iwb-plp-vrows{flex:1 1 auto;min-height:0;overflow:auto}
|
||||
.iwb-plp-vitem{padding:4px 0;border-bottom:1px dashed var(--iwb-border,#eceef2)}
|
||||
.iwb-plp-vrow2{display:flex;align-items:center;gap:6px}
|
||||
.iwb-plp-vname{flex:1 1 auto;min-width:0;height:32px}
|
||||
.iwb-plp-vi{flex:0 0 auto;width:24px;height:24px;padding:0;border-radius:50%;border:1px solid var(--iwb-border,#dfe3e9);background: var(--plp-c1, #fff);color: var(--plp-c4, #9aa1ac);font-size:11px;line-height:22px;text-align:center}
|
||||
.iwb-plp-vi.is-open{background: var(--plp-c5, #f1ecff);border-color: var(--plp-c6, #d8cbff);color: var(--plp-c7, #5a3fd0)}
|
||||
.iwb-plp-vdesc{width:100%;height:28px;margin-top:5px;border-style:dashed;background: var(--plp-c8, #fbfcfd);font-size:11.5px;color: var(--plp-c3, #6b7280)}
|
||||
.iwb-plp-dcov{flex:0 0 auto;width:180px;height:180px;border-radius:12px;overflow:hidden}
|
||||
.iwb-plp-dvar{background: var(--plp-c5, #f1ecff);color: var(--plp-c7, #5a3fd0);border-radius:4px;padding:0 4px;font-weight:500}
|
||||
/* v1.7.1:编辑面板视觉精修——输入框比底色更亮、去多余边框、细分隔线 */
|
||||
.iwb-plp-dialog .iwb-plp-dbody{gap:10px;padding:12px;background: var(--plp-c9, #f4f5f7)}
|
||||
.iwb-plp-dialog .iwb-plp-eleft{flex:0 0 236px;width:236px;background: var(--plp-c1, #fff);border: 1px solid var(--plp-c10, #e6e8ec);border-radius:12px;padding:12px}
|
||||
.iwb-plp-dialog .iwb-plp-emid{background: var(--plp-c1, #fff);border: 1px solid var(--plp-c10, #e6e8ec);border-radius:12px;padding:10px 12px 12px}
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-etext{border: 1px solid var(--plp-c11, #eef0f3);background: var(--plp-c8, #fbfcfd);border-radius:9px;padding:10px 12px}
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-etext:focus{background: var(--plp-c1, #fff);border-color: var(--plp-c12, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)}
|
||||
.iwb-plp-dialog .iwb-plp-esplit{flex:0 0 6px;background:transparent;border-radius:4px}
|
||||
.iwb-plp-dialog .iwb-plp-esplit:hover{background: var(--plp-c13, #e7e9ee)}
|
||||
.iwb-plp-dialog .iwb-plp-esplit::before{content:'';display:block;width:2px;height:30px;border-radius:2px;background: var(--plp-c14, #d7dbe2)}
|
||||
.iwb-plp-dialog .iwb-plp-eright{background:transparent;border:0;padding:2px 0 0}
|
||||
.iwb-plp-dialog .iwb-plp-vitem{border:0;padding:2px 0}
|
||||
.iwb-plp-dialog .iwb-plp-vrow2{gap:6px}
|
||||
.iwb-plp-dialog .iwb-plp-vname{background: var(--plp-c8, #fbfcfd);border: 1px solid var(--plp-c15, #eceef2);border-radius:8px;height:32px;padding:0 10px;font-size:12.5px;color: var(--plp-c16, #33383f)}
|
||||
.iwb-plp-dialog .iwb-plp-vname:focus{background: var(--plp-c1, #fff);border-color: var(--plp-c12, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)}
|
||||
.iwb-plp-dialog .iwb-plp-vi{background:transparent;border:0;color: var(--plp-c17, #aab0ba);width:22px;height:22px;line-height:20px}
|
||||
.iwb-plp-dialog .iwb-plp-vi:hover{background: var(--plp-c18, #eef0f4);color: var(--plp-c3, #6b7280)}
|
||||
.iwb-plp-dialog .iwb-plp-vi.is-open{background: var(--plp-c5, #f1ecff);color: var(--plp-c7, #5a3fd0)}
|
||||
.iwb-plp-dialog .iwb-plp-vdesc{background: var(--plp-c8, #fbfcfd);border: 1px dashed var(--plp-c19, #e2e6ec);border-radius:7px;height:28px;margin-top:4px}
|
||||
.iwb-plp-dialog .iwb-plp-lrow span{color: var(--plp-c20, #8a919c);font-size:11.5px}
|
||||
.iwb-plp-dialog .iwb-plp-lrow .iwb-input{background: var(--plp-c8, #fbfcfd);border: 1px solid var(--plp-c15, #eceef2);border-radius:8px;height:32px}
|
||||
.iwb-plp-dialog .iwb-plp-lrow .iwb-input:focus{background: var(--plp-c1, #fff);border-color: var(--plp-c12, #cfc3ff)}
|
||||
/* v1.7.2:正文变量高亮(黑粗)+ 说明灰按钮 + 说明背景回归面板底 */
|
||||
.iwb-plp-ewrap{position:relative;flex:1 1 auto;min-height:0;display:flex;border-radius:9px;background: var(--plp-c8, #fbfcfd);border: 1px solid var(--plp-c11, #eef0f3)}
|
||||
.iwb-plp-ewrap:focus-within{background: var(--plp-c1, #fff);border-color: var(--plp-c12, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)}
|
||||
.iwb-plp-ewrap .iwb-plp-etext{flex:1 1 auto;min-height:0;border:0;background:transparent;box-shadow:none;color:transparent;caret-color:var(--plp-c22, #1d2129);position:relative;z-index:1;resize:none}
|
||||
.iwb-plp-ewrap .iwb-plp-etext:focus{background:transparent;border:0;box-shadow:none}
|
||||
.iwb-plp-hl{position:absolute;inset:0;padding:10px 12px;overflow:hidden;white-space:pre-wrap;word-wrap:break-word;font-size:13px;line-height:1.9;color: var(--plp-c21, #5b6472);pointer-events:none;z-index:0}
|
||||
.iwb-plp-hlvar{color: var(--plp-c22, #1d2129);font-weight:600}
|
||||
.iwb-plp-dialog .iwb-plp-vi.is-open{background: var(--plp-c11, #eef0f3);color: var(--plp-c21, #5b6472)}
|
||||
.iwb-plp-dialog .iwb-plp-vdesc{background:transparent;border: 1px dashed var(--plp-c23, #dfe3e9)}
|
||||
.iwb-plp-dvar{background:transparent;color: var(--plp-c22, #1d2129);font-weight:600;padding:0}
|
||||
.iwb-plp-hres{height:6px;margin:-3px 0 0;cursor:ns-resize;flex:0 0 auto;border-radius:3px}
|
||||
.iwb-plp-hres:hover{background: var(--plp-c13, #e7e9ee)}
|
||||
/* 正文可见性:textarea 透明,显示下方高亮层 */
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap{flex:1 1 auto;min-height:0;position:relative;display:flex;background: var(--plp-c8, #fbfcfd);border: 1px solid var(--plp-c11, #eef0f3);border-radius:9px}
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap .iwb-plp-etext{background:transparent!important;color:transparent!important;border:0!important;box-shadow:none!important;padding:10px 12px}
|
||||
.iwb-plp-dialog .iwb-plp-hl{padding:10px 12px;font-size:13px;line-height:1.9}
|
||||
.iwb-plp-namebox{min-height:34px;height:34px;line-height:1.45;padding:7px 10px;resize:vertical;overflow:auto;font-size:12.5px}
|
||||
.iwb-plp-insvar{color: var(--plp-c22, #1d2129)!important;background: var(--plp-c1, #fff)!important;border-color: var(--plp-c19, #e2e6ec)!important}
|
||||
.iwb-plp-insvar:hover{background: var(--plp-c24, #f4f6f9)!important}
|
||||
/* v1.7.5:编辑封面卡在框内;详情封面放大 */
|
||||
.iwb-plp-dialog .iwb-plp-ecov{width:100%;height:250px;overflow:hidden;border-radius:12px;background:var(--iwb-plugin-inset,#f3f4f7)}
|
||||
.iwb-plp-dialog .iwb-plp-ecov .iwb-plp-cover{width:100%;height:100%;object-fit:cover;object-position:center;display:block;border-radius:12px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{align-items:flex-start}
|
||||
.iwb-plp-dialog .iwb-plp-dcov{width:264px;height:264px;flex:0 0 auto;overflow:hidden;border-radius:12px;background:var(--iwb-plugin-inset,#f3f4f7)}
|
||||
.iwb-plp-dialog .iwb-plp-dcov .iwb-plp-cover{width:100%;height:100%;object-fit:cover;object-position:center;display:block;border-radius:12px}
|
||||
/* v1.7.6:封面完整展示(contain),不裁剪 */
|
||||
.iwb-plp-dialog .iwb-plp-ecov .iwb-plp-cover{object-fit:contain;background:transparent}
|
||||
.iwb-plp-dialog .iwb-plp-dcov .iwb-plp-cover{object-fit:contain;background:transparent}
|
||||
.iwb-plp-dialog .iwb-plp-ecov{background:var(--iwb-plugin-inset,#f3f4f7)}
|
||||
.iwb-plp-dialog .iwb-plp-dcov{background:var(--iwb-plugin-inset,#f3f4f7)}
|
||||
/* v1.7.7:编辑区文字层与高亮层使用完全一致的字体度量,修复光标/选区错位 */
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap .iwb-plp-etext,
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-hl{
|
||||
font-family:-apple-system,BlinkMacSystemFont,'PingFang SC','Helvetica Neue',system-ui,sans-serif!important;
|
||||
font-size:13px!important;
|
||||
line-height:1.85!important;
|
||||
letter-spacing:0!important;
|
||||
padding:10px 12px!important;
|
||||
margin:0!important;
|
||||
border:0!important;
|
||||
box-sizing:border-box!important;
|
||||
white-space:pre-wrap!important;
|
||||
overflow-wrap:break-word!important;
|
||||
word-break:break-word!important;
|
||||
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.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}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtext{flex:1 1 auto;min-height:0;overflow:auto;padding-right:10px;margin-bottom:6px}
|
||||
/* v1.8.0:详情标题/分组/标签移到封面下方;编辑标签改为输入+加号 */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{align-items:flex-start}
|
||||
.iwb-plp-dleftcol{flex:0 0 264px;width:264px;display:flex;flex-direction:column;min-width:0}
|
||||
.iwb-plp-dtitle{font-size:18px;font-weight:650;line-height:1.35;margin-top:14px;color:var(--iwb-text,#1d2129)}
|
||||
.iwb-plp-dmeta{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:8px}
|
||||
.iwb-plp-dgroup{font-size:11.5px;background: var(--plp-c18, #eef0f4);color: var(--plp-c21, #5b6472);border-radius:999px;padding:2px 9px}
|
||||
.iwb-plp-dtag{font-size:11.5px;background: var(--plp-c25, #f4f0ff);color: var(--plp-c7, #5a3fd0);border-radius:999px;padding:2px 9px}
|
||||
.iwb-plp-dlen{font-size:11.5px;color: var(--plp-c4, #9aa1ac)}
|
||||
.iwb-plp-tagwrap{display:flex;flex-direction:column;gap:6px;flex:1;min-width:0}
|
||||
.iwb-plp-tagchips{display:flex;flex-wrap:wrap;gap:5px}
|
||||
.iwb-plp-tagchip{display:inline-flex;align-items:center;gap:4px;font-size:11.5px;background: var(--plp-c18, #eef0f4);border-radius:999px;padding:2px 8px;color: var(--plp-c26, #3f4450)}
|
||||
.iwb-plp-tagx{cursor:pointer;color: var(--plp-c4, #9aa1ac);font-style:normal}
|
||||
.iwb-plp-tagx:hover{color: var(--plp-c27, #c0392b)}
|
||||
.iwb-plp-tagrow{display:flex;gap:6px}
|
||||
.iwb-plp-tagin{flex:1;min-width:0;height:30px}
|
||||
.iwb-plp-lrow-tags{align-items:flex-start}
|
||||
.iwb-plp-tagadd{flex:0 0 auto;width:30px;height:30px;padding:0;font-size:15px;line-height:28px}
|
||||
/* v1.8.1:详情标题/分组/标签左对齐并带标题;标签加号对齐修复 */
|
||||
.iwb-plp-dtitle{font-size:20px;font-weight:650;line-height:1.35;margin-top:16px;color:var(--iwb-text,#1d2129)}
|
||||
.iwb-plp-dmeta{display:flex;flex-direction:column;gap:7px;margin-top:12px;align-items:flex-start}
|
||||
.iwb-plp-dmrow{display:flex;align-items:center;gap:10px;width:100%}
|
||||
.iwb-plp-dmk{flex:0 0 30px;width:30px;font-size:11.5px;color: var(--plp-c4, #9aa1ac)}
|
||||
.iwb-plp-dmv{display:flex;flex-wrap:wrap;align-items:center;gap:5px;min-width:0}
|
||||
.iwb-plp-dgroup{font-size:12px;color: var(--plp-c26, #3f4450);background: var(--plp-c28, #f2f4f7);border-radius:6px;padding:2px 9px}
|
||||
.iwb-plp-dtag{font-size:11.5px;color: var(--plp-c7, #5a3fd0);background: var(--plp-c25, #f4f0ff);border-radius:6px;padding:2px 9px}
|
||||
.iwb-plp-dempty{font-size:12px;color: var(--plp-c29, #b3b9c2)}
|
||||
.iwb-plp-dlen{font-size:12px;color: var(--plp-c20, #8a919c)}
|
||||
.iwb-plp-tagrow{display:flex;align-items:center;gap:6px}
|
||||
.iwb-plp-tagin{height:30px;border-radius:8px}
|
||||
.iwb-plp-tagadd{flex:0 0 auto;width:30px;height:30px;padding:0;border-radius:8px;background: var(--plp-c28, #f2f4f7);border: 1px solid var(--plp-c19, #e2e6ec);color: var(--plp-c21, #5b6472);font-size:16px;line-height:1;display:inline-flex;align-items:center;justify-content:center}
|
||||
.iwb-plp-tagadd:hover{background: var(--plp-c30, #e9ecf1)}
|
||||
/* v1.8.2:详情左右两栏卡片化 + 分割线 */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{gap:14px;padding:16px;background: var(--plp-c9, #f4f5f7)}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dleftcol{flex:0 0 300px;width:300px;padding:12px;border: 1px solid var(--plp-c31, #e8eaee);border-radius:14px;background: var(--plp-c1, #fff);align-self:flex-start}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dcov{width:100%;height:270px;border-radius:10px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtitle{font-size:20px;font-weight:650;line-height:1.35;margin-top:14px;color:var(--iwb-text,#1d2129)}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmeta{margin-top:12px;padding-top:12px;border-top: 1px solid var(--plp-c11, #eef0f3);gap:8px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dright{flex:1 1 auto;min-width:0;min-height:0;display:flex;flex-direction:column;padding:14px 16px;border: 1px solid var(--plp-c31, #e8eaee);border-radius:14px;background: var(--plp-c1, #fff);overflow:hidden}
|
||||
.iwb-plp-dsec{font-size:11.5px;font-weight:600;color: var(--plp-c20, #8a919c);letter-spacing:.04em;padding-bottom:8px;margin-bottom:8px;border-bottom: 1px solid var(--plp-c11, #eef0f3);flex:0 0 auto}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtext{flex:1 1 auto;min-height:0;overflow:auto;padding-right:10px;font-size:13.5px;line-height:2;color: var(--plp-c32, #3a4048)}
|
||||
/* v1.8.3:详情左卡片撑到底、四边等距;正文恢复滚动不被底部遮挡 */
|
||||
.iwb-plp-dialog-detail{display:flex;flex-direction:column;overflow:hidden}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{display:flex;flex:1 1 auto;min-height:0;overflow:hidden;gap:14px;padding:16px;background: var(--plp-c9, #f4f5f7)}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dleftcol{align-self:stretch;display:flex;flex-direction:column;overflow:auto;padding:12px;border: 1px solid var(--plp-c31, #e8eaee);border-radius:14px;background: var(--plp-c1, #fff)}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dright{flex:1 1 auto;min-width:0;min-height:0;overflow:hidden;display:flex;flex-direction:column;padding:14px 16px;border: 1px solid var(--plp-c31, #e8eaee);border-radius:14px;background: var(--plp-c1, #fff)}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtext{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;padding-right:8px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dfooter{flex:0 0 auto}
|
||||
/* v1.8.4:右卡片纵向拉伸填满,正文出现滚动条 */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{align-items:stretch!important}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dright{align-self:stretch!important;height:100%;max-height:100%;overflow:hidden!important}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtext{flex:1 1 0;min-height:0;overflow-y:auto!important;overflow-x:hidden}
|
||||
/* v1.8.7:详情标题缩小;分组/标签去底色;元信息加分割线与行高 */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtitle{font-size:17px!important;font-weight:650;margin-top:12px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmeta{margin-top:12px;padding-top:14px;border-top: 1px solid var(--plp-c11, #eef0f3);gap:10px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmrow{gap:6px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmk{flex:0 0 auto;width:auto;font-size:12px;line-height:1.6;color: var(--plp-c4, #9aa1ac)}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dgroup,.iwb-plp-dialog-detail .iwb-plp-dtag{background:transparent!important;padding:0!important;border-radius:0!important;font-size:12.5px;line-height:1.6;color: var(--plp-c33, #2f3540)}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtag{color: var(--plp-c7, #5a3fd0);}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dlen{font-size:12.5px;line-height:1.6;color: var(--plp-c33, #2f3540)}
|
||||
/* v1.8.8:详情标题 14px;元信息行间浅分割线;封面底色更接近白色(编辑/详情统一) */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtitle{font-size:14px!important;font-weight:650;line-height:1.5;margin-top:12px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmeta{gap:0}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmrow{padding:7px 0;border-bottom: 1px solid var(--plp-c34, #f3f5f8)}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmrow:last-child{border-bottom:0}
|
||||
.iwb-plp-dialog .iwb-plp-dcov,.iwb-plp-dialog .iwb-plp-ecov{background: var(--plp-c35, #fcfcfd)!important}
|
||||
.iwb-plp-dialog .iwb-plp-dcov .iwb-plp-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}
|
||||
.iwb-plp-ewrap .iwb-plp-etext{color:var(--iwb-text,#2a2f36)!important;background: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}
|
||||
@@ -653,7 +653,49 @@
|
||||
else if (!hasEngine) st.empty.textContent = '当前客户端还没有面板内浏览能力(需要 v3.25.30 及以上)。\n请先更新客户端。'
|
||||
// 面板关掉就没了,「✕ 关闭这个网页」在面板里没有意义
|
||||
st.close.style.display = 'none'
|
||||
st.onUrl = function (url) { try { ctx.settings.set('lastUrl', url) } catch (e) { /* 忽略 */ } }
|
||||
st.onUrl = function (url) {
|
||||
try { ctx.settings.set('lastUrl', url) } catch (e) { /* 忽略 */ }
|
||||
remember(url) // 面板里回车提交走这条(不走 goTo),最近访问要在这里记
|
||||
}
|
||||
|
||||
// ── 最近访问(v1.7.0)────────────────────────────────────────────────
|
||||
// 存 ctx.data(桌面:<资料目录>/plugin-data/browser.json),与 settings 分开:
|
||||
// 这是会增长的列表,不该塞进配置;数据层有 2MiB 上限与串行写,够用且安全。
|
||||
var recent = []
|
||||
var recentList = el('datalist', {})
|
||||
recentList.id = 'iwb-br-recent' // 不用 {id:...} 字面量:validate 取首个 id 字面量判插件 id
|
||||
recentList.style.display = 'none'
|
||||
host.appendChild(recentList)
|
||||
if (st.input) st.input.setAttribute('list', 'iwb-br-recent')
|
||||
function renderRecent() {
|
||||
recentList.innerHTML = ''
|
||||
for (var ri = 0; ri < recent.length; ri++) recentList.appendChild(el('option', { value: recent[ri] }))
|
||||
}
|
||||
function remember(u) {
|
||||
if (!u) return
|
||||
var next = [u]
|
||||
for (var ri = 0; ri < recent.length && next.length < 12; ri++) if (recent[ri] !== u) next.push(recent[ri])
|
||||
recent = next
|
||||
renderRecent()
|
||||
var d = ctx.data
|
||||
if (!d || typeof d.patch !== 'function') return
|
||||
try { var pr = d.patch({ recent: recent }); if (pr && pr.catch) pr.catch(function () { /* 数据不可用不影响浏览 */ }) } catch (e) { /* ignore */ }
|
||||
}
|
||||
function loadRecent() {
|
||||
var d = ctx.data
|
||||
if (!d || typeof d.read !== 'function') return
|
||||
try {
|
||||
var pr = d.read()
|
||||
if (!pr || !pr.then) return
|
||||
pr.then(function (obj) {
|
||||
var list = obj && Array.isArray(obj.recent) ? obj.recent : []
|
||||
recent = list.filter(function (x) { return typeof x === 'string' && x }).slice(0, 12)
|
||||
renderRecent()
|
||||
}).catch(function () { /* 首次没有数据属正常 */ })
|
||||
} catch (e) { /* ignore */ }
|
||||
}
|
||||
loadRecent()
|
||||
|
||||
bindWebNode(st, ctx)
|
||||
|
||||
function goTo(raw) {
|
||||
@@ -667,6 +709,7 @@
|
||||
st.input.value = u
|
||||
for (var i = 0; i < st.acts.length; i++) st.acts[i].disabled = false
|
||||
try { ctx.settings.set('lastUrl', u) } catch (e) { /* 忽略 */ }
|
||||
remember(u)
|
||||
}
|
||||
|
||||
// 书签:分组行 + 书签行。两行都单行横向滚动,尽量不占网页的高度。
|
||||
@@ -1090,10 +1133,12 @@
|
||||
global.IWBPluginHost.register({
|
||||
id: 'browser',
|
||||
name: '应用内浏览器',
|
||||
version: '1.6.0',
|
||||
version: '1.7.0',
|
||||
apiVersion: 1,
|
||||
// canvasWrite:面板里的「↗」用它把当前页变成画布上的网页节点(需要客户端 v3.25.30+)
|
||||
capabilities: ['panels', 'nodeTypes', 'canvasWrite'],
|
||||
// 最近访问列表(v1.7.0):走宿主 ctx.data(桌面落 plugin-data/browser.json),不塞进 settings
|
||||
data: { schemaVersion: 1, maxBytes: 65536 },
|
||||
settings: {
|
||||
bookmarks: {
|
||||
// 宿主 v3.25.30 起支持 type:'custom':调用 render 拿到一整块 DOM 直接挂进
|
||||
@@ -138,7 +138,7 @@
|
||||
position: fixed; z-index: 2147483000; left: 0; top: 0; pointer-events: none;
|
||||
padding: 5px 10px; border-radius: 6px; font-size: 12px; line-height: 1.2;
|
||||
font-family: inherit; white-space: nowrap;
|
||||
background: rgba(22, 26, 34, .88); color: #fff;
|
||||
background: color-mix(in srgb, var(--iwb-text, #1c2333) 88%, transparent); color: var(--iwb-on-brand, #fff);
|
||||
border: 1px dashed rgba(255, 255, 255, .55);
|
||||
transform: translate(-2px, -2px);
|
||||
}
|
||||
@@ -283,7 +283,7 @@
|
||||
position: absolute; left: 50%; bottom: 46px; z-index: 20;
|
||||
transform: translateX(-50%) translateY(6px);
|
||||
max-width: 88%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
||||
background: rgba(22, 26, 34, .9); color: #fff;
|
||||
background: color-mix(in srgb, var(--iwb-text, #1c2333) 90%, transparent); color: var(--iwb-on-brand, #fff);
|
||||
font-size: var(--fs-md, 12px); padding: 6px 12px; border-radius: 14px;
|
||||
opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
|
||||
}
|
||||
@@ -338,7 +338,7 @@
|
||||
.iwb-ssn-row > input:focus { outline: none; border-color: var(--iwb-brand, #1677ff); }
|
||||
.iwb-ssn-row > input::placeholder { color: var(--iwb-text2, #6b7280); opacity: .6; }
|
||||
.iwb-ssn-foot { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--iwb-text2, #6b7280); }
|
||||
.iwb-ssn-warn { color: #d97706; }
|
||||
.iwb-ssn-warn { color: var(--iwb-warn, #d97706); }
|
||||
.iwb-ssn-empty { padding: 6px 2px; font-size: 11px; color: var(--iwb-text2, #6b7280); line-height: 1.6; }
|
||||
`
|
||||
|
||||
@@ -1384,7 +1384,7 @@
|
||||
global.IWBPluginHost.register({
|
||||
id: 'style-source',
|
||||
name: '风格库',
|
||||
version: '1.3.2',
|
||||
version: '1.3.3',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'canvas', 'canvasWrite', 'nodeTypes'],
|
||||
settings: {
|
||||
@@ -69,6 +69,8 @@ const sourceModules = [
|
||||
'storage-outputs.js',
|
||||
'storage-backup.js',
|
||||
'storage-zip.js',
|
||||
'plugin-archive.js',
|
||||
'plugin-promptlib-backup.js',
|
||||
'runtime-constants.js',
|
||||
'canvas-store.js',
|
||||
'generation-scheduler.js',
|
||||
@@ -77,6 +79,10 @@ const sourceModules = [
|
||||
'gallery-query.js',
|
||||
'gallery-hydration.js',
|
||||
'ui-components.js',
|
||||
'plugin-data.js',
|
||||
'plugin-api-gallery.js',
|
||||
'plugin-api-grouplib.js',
|
||||
'plugin-api-promptlib.js',
|
||||
'plugin-host.js',
|
||||
'image-compress.js',
|
||||
'storage-fallback-indexeddb.js',
|
||||
@@ -87,8 +93,19 @@ const sourceModules = [
|
||||
'canvas-text.js',
|
||||
'generation-task-graph.js',
|
||||
'generation-results-store.js',
|
||||
'ui-groups-sidebar.js',
|
||||
'ui-lib-sidebar.js',
|
||||
'ui-dock-sanitize.js',
|
||||
'ui-dock.js',
|
||||
'ui-minimap-fit.js',
|
||||
'ui-dock-panels.js',
|
||||
'theme-tokens.js',
|
||||
'canvas-grid.js',
|
||||
'image-display-thumb.js',
|
||||
'image-remote-cache.js',
|
||||
'image-thumb-pick.js',
|
||||
'ui-modal-drag.js',
|
||||
'ui-nav-rail.js',
|
||||
'ui-plugin-page.js',
|
||||
'ui-hotkey-help.js',
|
||||
'ui-desktop-shell.js',
|
||||
'ui-appearance.js',
|
||||
'runtime-download-auto.js',
|
||||
@@ -116,6 +133,8 @@ const sourceModules = [
|
||||
'ui-connect-menu.js',
|
||||
'ui-gen-config-panel.js',
|
||||
'canvas-webview.js',
|
||||
'plugin-files-policy.js',
|
||||
'image-prompt-cover.js',
|
||||
]
|
||||
|
||||
// 插件自动发现(2026-10-17):src/plugin-*.js 中**未被上面显式登记**的,按文件名排序追加到末尾。
|
||||
@@ -211,6 +230,8 @@ const html = `<!DOCTYPE html>
|
||||
`
|
||||
fs.writeFileSync(path.join(dist, 'index.html'), html)
|
||||
fs.writeFileSync(path.join(dist, 'version.json'), JSON.stringify({ version, packageVersion: pkg.version, commit: gitSha }, null, 2) + '\n')
|
||||
// 导航 logo 用真实应用图标(v3.25.61;缺失不阻塞构建)
|
||||
try { fs.copyFileSync(path.join(root, 'src-tauri', 'icons', 'icon.png'), path.join(dist, 'nav-logo.png')) } catch (e) { /* ignore */ }
|
||||
|
||||
const appBytes = fs.statSync(path.join(dist, 'app.js')).size
|
||||
const cssBytes = fs.statSync(path.join(dist, 'style.css')).size
|
||||
|
||||
@@ -21,6 +21,17 @@ for (const name of fs.readdirSync(src)) {
|
||||
fs.copyFileSync(path.join(src, name), path.join(dst, name))
|
||||
count++
|
||||
}
|
||||
// 索引与插件文件必须同源同包:应用按 index.json 里的 filename 去 /plugins/ 取
|
||||
// v3.25.41(M1):目录插件 <plugins>/<id>/{manifest.json,main.js} 一并进包(应用按 /plugins/<id>/… 取)
|
||||
let folders = 0
|
||||
const pluginsRoot = path.join(root, 'plugins')
|
||||
for (const name of fs.readdirSync(pluginsRoot)) {
|
||||
const abs = path.join(pluginsRoot, name)
|
||||
if (!fs.statSync(abs).isDirectory()) continue
|
||||
if (name === 'runtime' || name === 'local') continue
|
||||
if (!fs.existsSync(path.join(abs, 'manifest.json'))) continue
|
||||
fs.cpSync(abs, path.join(dst, name), { recursive: true })
|
||||
folders++
|
||||
}
|
||||
// 索引与插件文件必须同源同包:应用按 index.json 里的 filename / dir 去 /plugins/ 取
|
||||
fs.copyFileSync(path.join(root, 'plugins', 'index.json'), path.join(dst, 'index.json'))
|
||||
console.log('[copy-plugins] 已拷入 ' + count + ' 个插件 → dist/plugins/')
|
||||
console.log('[copy-plugins] 已拷入 ' + count + ' 个文件 + ' + folders + ' 个目录插件 → dist/plugins/')
|
||||
@@ -1,33 +1,108 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict'
|
||||
// 生成插件市场索引:plugins/index.json + plugins/meta.json → market/index.json + market/plugins/*
|
||||
// 产物用于 market.maqiart.eu.org(纯静态)。
|
||||
// 生成插件市场索引(M3):plugins/index.json + plugins/meta.json(+ 目录插件)→ market/
|
||||
//
|
||||
// 产物(纯静态,供 market.maqiart.eu.org 与桌面端安装器共用):
|
||||
// market/index.json 市场条目:bundle(zip) + files[逐文件 sha256] + 兼容字段 file
|
||||
// market/plugins/<id>-<version>.zip 目录插件包:manifest.json + main.js [+ styles.css / assets]
|
||||
// market/plugins/plugin-<id>.<hash>.js 单文件产物(旧客户端仍可安装,保持向后兼容)
|
||||
//
|
||||
// 包里统一用 STORE(不压缩):客户端 src/storage-zip.js 对 DEFLATE 依赖 DecompressionStream,
|
||||
// 旧 macOS 的 WKWebView 没有该 API;插件包只有几十 KB,不压缩没有实际损失。
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const crypto = require('crypto')
|
||||
const { zipStore } = require('./plugin-zip')
|
||||
|
||||
const root = path.resolve(__dirname, '..')
|
||||
const man = JSON.parse(fs.readFileSync(path.join(root, 'plugins', 'index.json'), 'utf8'))
|
||||
const meta = JSON.parse(fs.readFileSync(path.join(root, 'plugins', 'meta.json'), 'utf8'))
|
||||
const out = path.join(root, 'market')
|
||||
fs.mkdirSync(path.join(out, 'plugins'), { recursive: true })
|
||||
const sha = (buf) => crypto.createHash('sha256').update(buf)
|
||||
const plugins = []
|
||||
for (const e of man) {
|
||||
const src = path.join(root, 'plugins', 'runtime', e.file)
|
||||
if (!fs.existsSync(src)) { console.warn('缺少产物:' + e.file); continue }
|
||||
const buf = fs.readFileSync(src)
|
||||
fs.writeFileSync(path.join(out, 'plugins', e.file), buf)
|
||||
const m = meta[e.id] || {}
|
||||
plugins.push({
|
||||
id: e.id, name: m.name || e.id, desc: m.desc || '', author: m.author || 'official', icon: m.icon || '', color: m.color || '', tags: Array.isArray(m.tags) ? m.tags : [],
|
||||
version: e.version, apiVersion: 1,
|
||||
file: 'plugins/' + e.file,
|
||||
size: buf.length,
|
||||
sha256: sha(buf).digest('hex'),
|
||||
integrity: 'sha256-' + sha(buf).digest('base64'),
|
||||
})
|
||||
const shaHex = (buf) => sha(buf).digest('hex')
|
||||
|
||||
function readFolderFiles (id) {
|
||||
// 目录插件:manifest.json + main.js + 可选 styles.css + assets/**(限两级)
|
||||
const dir = path.join(root, 'plugins', id)
|
||||
const files = []
|
||||
const manifestPath = path.join(dir, 'manifest.json')
|
||||
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
|
||||
files.push({ name: 'manifest.json', data: fs.readFileSync(manifestPath) })
|
||||
const main = String(manifest.main || 'main.js')
|
||||
files.push({ name: main, data: fs.readFileSync(path.join(dir, main)) })
|
||||
if (manifest.style && fs.existsSync(path.join(dir, manifest.style))) files.push({ name: String(manifest.style), data: fs.readFileSync(path.join(dir, String(manifest.style))) })
|
||||
const assetsDir = path.join(dir, 'assets')
|
||||
if (fs.existsSync(assetsDir)) {
|
||||
for (const name of fs.readdirSync(assetsDir)) {
|
||||
const abs = path.join(assetsDir, name)
|
||||
if (fs.statSync(abs).isFile()) files.push({ name: 'assets/' + name, data: fs.readFileSync(abs) })
|
||||
}
|
||||
}
|
||||
return { files, manifest }
|
||||
}
|
||||
const index = { version: 1, updatedAt: new Date().toISOString(), plugins: plugins }
|
||||
|
||||
const plugins = []
|
||||
let zipped = 0
|
||||
for (const e of man) {
|
||||
const m = meta[e.id] || {}
|
||||
const base = {
|
||||
id: e.id, name: m.name || e.id, desc: m.desc || '', author: m.author || 'official',
|
||||
icon: m.icon || '', color: m.color || '', tags: Array.isArray(m.tags) ? m.tags : [],
|
||||
version: e.version, apiVersion: 1,
|
||||
}
|
||||
|
||||
// ---- 目录形态:打包 manifest + main(+style/assets) ----
|
||||
let files = null
|
||||
if (e.dir) {
|
||||
const got = readFolderFiles(e.dir)
|
||||
files = got.files
|
||||
} else {
|
||||
const src = path.join(root, 'plugins', 'runtime', e.file)
|
||||
if (!fs.existsSync(src)) { console.warn('缺少产物:' + e.file); continue }
|
||||
const js = fs.readFileSync(src)
|
||||
// 单文件插件也打成目录包:manifest.json 由市场索引生成,main.js 就是原产物
|
||||
// manifest 里带 files(main.js 的 sha256):手工把 zip 解到 <plugins>/<id>/ 时,
|
||||
// 加载器扫描目录也能校验入口文件(manifest 自身不参与,避免自引用)。
|
||||
const manifestJson = {
|
||||
id: e.id, name: base.name, version: e.version, apiVersion: 1, main: 'main.js',
|
||||
description: base.desc, author: base.author, icon: base.icon, tags: base.tags,
|
||||
files: { 'main.js': shaHex(js) },
|
||||
}
|
||||
files = [
|
||||
{ name: 'manifest.json', data: Buffer.from(JSON.stringify(manifestJson, null, 2) + '\n', 'utf8') },
|
||||
{ name: 'main.js', data: js },
|
||||
]
|
||||
}
|
||||
|
||||
const fileList = files.map((f) => ({ path: f.name, sha256: shaHex(f.data), size: f.data.length }))
|
||||
const zip = zipStore(files)
|
||||
const zipName = e.id + '-' + e.version + '.zip'
|
||||
fs.writeFileSync(path.join(out, 'plugins', zipName), zip)
|
||||
zipped++
|
||||
|
||||
const item = Object.assign({}, base, {
|
||||
bundle: 'plugins/' + zipName,
|
||||
bundleSize: zip.length,
|
||||
bundleSha256: shaHex(zip),
|
||||
files: fileList,
|
||||
})
|
||||
|
||||
// 兼容:单文件插件继续提供裸 .js(旧客户端 install 只认 file/integrity)
|
||||
if (!e.dir) {
|
||||
const src = path.join(root, 'plugins', 'runtime', e.file)
|
||||
const buf = fs.readFileSync(src)
|
||||
fs.writeFileSync(path.join(out, 'plugins', e.file), buf)
|
||||
item.file = 'plugins/' + e.file
|
||||
item.size = buf.length
|
||||
item.sha256 = shaHex(buf)
|
||||
item.integrity = 'sha256-' + sha(buf).digest('base64')
|
||||
}
|
||||
|
||||
plugins.push(item)
|
||||
}
|
||||
|
||||
const index = { version: 2, updatedAt: new Date().toISOString(), plugins: plugins }
|
||||
fs.writeFileSync(path.join(out, 'index.json'), JSON.stringify(index, null, 2) + '\n')
|
||||
console.log('market/index.json:' + plugins.length + ' 个插件')
|
||||
for (const p of plugins) console.log(' ' + p.id.padEnd(16) + p.version.padEnd(8) + (p.size + ' B'))
|
||||
console.log('market/index.json:' + plugins.length + ' 个插件 / ' + zipped + ' 个 zip 包')
|
||||
for (const p of plugins) console.log(' ' + p.id.padEnd(16) + String(p.version).padEnd(8) + (p.bundleSize + ' B zip'))
|
||||
@@ -55,6 +55,8 @@ const html = `<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>${esc(data.app)} · 下载</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=" + encodeURIComponent(latest.version + '-' + Date.now().toString(36)) + "">
|
||||
<style>
|
||||
*{box-sizing:border-box}
|
||||
@@ -85,11 +87,12 @@ const html = `<!doctype html>
|
||||
</head>
|
||||
<body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
|
||||
<a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>
|
||||
<div class="links">
|
||||
<a href="/">首页</a>
|
||||
<a href="/download/" class="on">下载</a>
|
||||
<a href="/plugins/">插件</a>
|
||||
<a href="/dev/">开发</a>
|
||||
<a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码</a>
|
||||
</div>
|
||||
<div class="right">
|
||||
|
||||
@@ -23,11 +23,12 @@ const plugins = Array.isArray(market.plugins) ? market.plugins : []
|
||||
|
||||
const nav = (active) => [
|
||||
'<nav><div class="wrap inner">',
|
||||
' <a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>',
|
||||
' <a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>',
|
||||
' <div class="links">',
|
||||
' <a href="/"' + (active === 'home' ? ' class="on"' : '') + '>首页</a>',
|
||||
' <a href="/download/"' + (active === 'download' ? ' class="on"' : '') + '>下载</a>',
|
||||
' <a href="/plugins/"' + (active === 'plugins' ? ' class="on"' : '') + '>插件</a>',
|
||||
' <a href="/dev/"' + (active === 'dev' ? ' class="on"' : '') + '>开发</a>',
|
||||
' <a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码</a>',
|
||||
' </div>',
|
||||
' <div class="right">',
|
||||
@@ -83,6 +84,69 @@ const tags = []
|
||||
for (const p of plugins) for (const t of (p.tags || [])) if (tags.indexOf(t) < 0) tags.push(t)
|
||||
const tagChips = tags.map((t) => '<button class="tag" data-tag="' + esc(t) + '" style="cursor:pointer;padding:5px 12px">' + esc(t) + '</button>').join('\n ')
|
||||
|
||||
function mdToHtml (md) {
|
||||
const esc2 = (s) => String(s).replace(/[&<>]/g, (c) => ({ '&': '&', '<': '<', '>': '>' }[c]))
|
||||
const inline = (s) => esc2(s)
|
||||
.replace(/`([^`]+)`/g, '<code>$1</code>')
|
||||
.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
|
||||
.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>')
|
||||
const lines = String(md).split('\n')
|
||||
const out = []
|
||||
let i = 0
|
||||
let inCode = false
|
||||
let code = []
|
||||
let inList = ''
|
||||
const closeList = () => { if (inList) { out.push('</' + inList + '>'); inList = '' } }
|
||||
while (i < lines.length) {
|
||||
const line = lines[i]
|
||||
if (line.trim().indexOf('```') === 0) {
|
||||
if (!inCode) { inCode = true; code = [] } else {
|
||||
inCode = false
|
||||
out.push('<pre><code>' + esc2(code.join('\n')) + '</code></pre>')
|
||||
}
|
||||
i++; continue
|
||||
}
|
||||
if (inCode) { code.push(line); i++; continue }
|
||||
if (!line.trim()) { closeList(); i++; continue }
|
||||
if (/^---+$/.test(line.trim())) { closeList(); out.push('<hr>'); i++; continue }
|
||||
const h = line.match(/^(#{1,4})\s+(.*)$/)
|
||||
if (h) { closeList(); out.push('<h' + h[1].length + '>' + inline(h[2]) + '</h' + h[1].length + '>'); i++; continue }
|
||||
if (line.trim().indexOf('|') === 0) {
|
||||
const rows = []
|
||||
while (i < lines.length && lines[i].trim().indexOf('|') === 0) rows.push(lines[i++])
|
||||
const cells = rows.map((r) => r.trim().replace(/^\||\|$/g, '').split('|').map((c) => c.trim()))
|
||||
if (cells.length > 1) {
|
||||
out.push('<table><thead><tr>' + cells[0].map((c) => '<th>' + inline(c) + '</th>').join('') + '</tr></thead><tbody>')
|
||||
for (let r = 2; r < cells.length; r++) out.push('<tr>' + cells[r].map((c) => '<td>' + inline(c) + '</td>').join('') + '</tr>')
|
||||
out.push('</tbody></table>')
|
||||
}
|
||||
continue
|
||||
}
|
||||
if (/^ \S/.test(line)) {
|
||||
closeList()
|
||||
const block = []
|
||||
while (i < lines.length && (/^ /.test(lines[i]) || !lines[i].trim())) { block.push(lines[i].replace(/^ /, '')); i++ }
|
||||
while (block.length && !block[block.length - 1].trim()) block.pop()
|
||||
out.push('<pre><code>' + esc2(block.join('\n')) + '</code></pre>')
|
||||
continue
|
||||
}
|
||||
const li = line.match(/^\s*[-*]\s+(.*)$/)
|
||||
if (li) {
|
||||
if (inList !== 'ul') { closeList(); out.push('<ul>'); inList = 'ul' }
|
||||
out.push('<li>' + inline(li[1]) + '</li>'); i++; continue
|
||||
}
|
||||
const ol = line.match(/^\s*\d+\.\s+(.*)$/)
|
||||
if (ol) {
|
||||
if (inList !== 'ol') { closeList(); out.push('<ol>'); inList = 'ol' }
|
||||
out.push('<li>' + inline(ol[1]) + '</li>'); i++; continue
|
||||
}
|
||||
closeList(); out.push('<p>' + inline(line) + '</p>'); i++
|
||||
}
|
||||
closeList()
|
||||
if (inCode) out.push('<pre><code>' + esc2(code.join('\n')) + '</code></pre>')
|
||||
return out.join('\n')
|
||||
}
|
||||
|
||||
function render(tpl, map) {
|
||||
let out = fs.readFileSync(path.join(site, tpl), 'utf8')
|
||||
for (const k of Object.keys(map)) out = out.split('<!--' + k + '-->').join(map[k])
|
||||
@@ -113,4 +177,16 @@ pluginsPage = pluginsPage.replace('/assets/style.css', '/assets/style.css?v=' +
|
||||
fs.writeFileSync(path.join(site, 'plugins', 'index.html'), pluginsPage)
|
||||
fs.writeFileSync(path.join(site, 'plugins-index.json'), JSON.stringify(market, null, 2) + '\n')
|
||||
|
||||
// 插件开发规范(由 docs/standards/plugin-development.md 生成)
|
||||
const devMdPath = path.join(root, 'docs', 'standards', 'plugin-development.md')
|
||||
if (fs.existsSync(devMdPath)) {
|
||||
const devPage = render('_dev.tpl.html', {
|
||||
NAV: nav('dev'),
|
||||
FOOTER: footer,
|
||||
DEV_CONTENT: mdToHtml(fs.readFileSync(devMdPath, 'utf8')),
|
||||
}).replace('/assets/style.css', '/assets/style.css?v=' + STAMP)
|
||||
fs.mkdirSync(path.join(site, 'dev'), { recursive: true })
|
||||
fs.writeFileSync(path.join(site, 'dev', 'index.html'), devPage)
|
||||
}
|
||||
|
||||
console.log('站点已生成:首页 / 插件页(' + plugins.length + ' 个插件,' + tags.length + ' 个标签,版本 v' + V + ')')
|
||||
@@ -0,0 +1,89 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict'
|
||||
// 插件包 ZIP 写入器(M3,2026-11-20)
|
||||
//
|
||||
// 为什么自己写:插件包很小(几十 KB),只需要 STORE(不压缩);
|
||||
// 而客户端解包走 src/storage-zip.js —— 它对 DEFLATE 依赖 DecompressionStream,
|
||||
// 旧 macOS(<13)的 WKWebView 没有该 API。用 STORE 可以彻底绕开这个兼容坑。
|
||||
//
|
||||
// 输出:标准 ZIP(local header + central directory + EOCD),UTF-8 文件名(flag 0x0800)。
|
||||
const CRC_TABLE = (() => {
|
||||
const t = new Uint32Array(256)
|
||||
for (let i = 0; i < 256; i++) {
|
||||
let c = i
|
||||
for (let k = 0; k < 8; k++) c = (c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)
|
||||
t[i] = c >>> 0
|
||||
}
|
||||
return t
|
||||
})()
|
||||
|
||||
function crc32 (buf) {
|
||||
let c = 0xFFFFFFFF
|
||||
for (let i = 0; i < buf.length; i++) c = (CRC_TABLE[(c ^ buf[i]) & 0xFF] ^ (c >>> 8)) >>> 0
|
||||
return (c ^ 0xFFFFFFFF) >>> 0
|
||||
}
|
||||
|
||||
// files: [{ name: string, data: Buffer|string }]
|
||||
function zipStore (files) {
|
||||
const locals = []
|
||||
const centrals = []
|
||||
let offset = 0
|
||||
const DOS_TIME = 0
|
||||
const DOS_DATE = 0x21 // 1980-01-01
|
||||
for (const f of files || []) {
|
||||
const name = String(f.name || '')
|
||||
if (!name || name.indexOf('..') >= 0 || name.charAt(0) === '/') throw new Error('非法文件名:' + name)
|
||||
const nameBuf = Buffer.from(name, 'utf8')
|
||||
const data = Buffer.isBuffer(f.data) ? f.data : Buffer.from(String(f.data == null ? '' : f.data), 'utf8')
|
||||
const crc = crc32(data)
|
||||
|
||||
const local = Buffer.alloc(30)
|
||||
local.writeUInt32LE(0x04034b50, 0)
|
||||
local.writeUInt16LE(20, 4) // version needed
|
||||
local.writeUInt16LE(0x0800, 6) // UTF-8 文件名
|
||||
local.writeUInt16LE(0, 8) // method = STORE
|
||||
local.writeUInt16LE(DOS_TIME, 10)
|
||||
local.writeUInt16LE(DOS_DATE, 12)
|
||||
local.writeUInt32LE(crc, 14)
|
||||
local.writeUInt32LE(data.length, 18)
|
||||
local.writeUInt32LE(data.length, 22)
|
||||
local.writeUInt16LE(nameBuf.length, 26)
|
||||
local.writeUInt16LE(0, 28)
|
||||
locals.push(local, nameBuf, data)
|
||||
|
||||
const cd = Buffer.alloc(46)
|
||||
cd.writeUInt32LE(0x02014b50, 0)
|
||||
cd.writeUInt16LE(20, 4) // made by
|
||||
cd.writeUInt16LE(20, 6) // version needed
|
||||
cd.writeUInt16LE(0x0800, 8)
|
||||
cd.writeUInt16LE(0, 10) // method
|
||||
cd.writeUInt16LE(DOS_TIME, 12)
|
||||
cd.writeUInt16LE(DOS_DATE, 14)
|
||||
cd.writeUInt32LE(crc, 16)
|
||||
cd.writeUInt32LE(data.length, 20)
|
||||
cd.writeUInt32LE(data.length, 24)
|
||||
cd.writeUInt16LE(nameBuf.length, 28)
|
||||
cd.writeUInt16LE(0, 30) // extra len
|
||||
cd.writeUInt16LE(0, 32) // comment len
|
||||
cd.writeUInt16LE(0, 34) // disk start
|
||||
cd.writeUInt16LE(0, 36) // internal attrs
|
||||
cd.writeUInt32LE(0, 38) // external attrs
|
||||
cd.writeUInt32LE(offset, 42) // local header offset
|
||||
centrals.push(cd, nameBuf)
|
||||
|
||||
offset += local.length + nameBuf.length + data.length
|
||||
}
|
||||
const cdBuf = Buffer.concat(centrals)
|
||||
const end = Buffer.alloc(22)
|
||||
end.writeUInt32LE(0x06054b50, 0)
|
||||
end.writeUInt16LE(0, 4)
|
||||
end.writeUInt16LE(0, 6)
|
||||
end.writeUInt16LE(files.length, 8)
|
||||
end.writeUInt16LE(files.length, 10)
|
||||
end.writeUInt32LE(cdBuf.length, 12)
|
||||
end.writeUInt32LE(offset, 16)
|
||||
end.writeUInt16LE(0, 20)
|
||||
return Buffer.concat(locals.concat([cdBuf, end]))
|
||||
}
|
||||
|
||||
module.exports = { zipStore, crc32 }
|
||||
@@ -110,5 +110,26 @@ console.log("latest.json -> v" + v + " platforms: " + Object.keys(j.platforms).
|
||||
$SCP /tmp/iwb-latest.json "$NAS_HOST:$NAS_DIR/updates/latest.json"
|
||||
ssh -i "$SSH_KEY" -o BatchMode=yes "$NAS_HOST" "chmod -R a+rX $NAS_DIR"
|
||||
|
||||
# == 自动对齐文档锚点 ==
|
||||
# 规则:main = <sha> 必须是「最近一次 bump 版本的提交」。以前每次发版要手工改两次锚点,
|
||||
# 现在由发布脚本收尾:写锚点 + 同步 facts + 本地提交(推送仍随版本一起做)。
|
||||
if git rev-parse --git-dir >/dev/null 2>&1; then
|
||||
HEAD_V=$(git show HEAD:package.json 2>/dev/null | node -e 'let t="";process.stdin.on("data",d=>t+=d).on("end",()=>{try{console.log(JSON.parse(t).version)}catch(e){console.log("")}})') || true
|
||||
if [ "$HEAD_V" != "$V" ]; then
|
||||
echo "WARN 版本号尚未提交(HEAD=${HEAD_V} 本地=${V}):跳过锚点自动对齐,请先提交再发布"
|
||||
else
|
||||
BUMP_SHA=$(git log -1 --format=%h -- package.json || true)
|
||||
if [ -n "$BUMP_SHA" ]; then
|
||||
node scripts/set-doc-anchor.js "$V" "$BUMP_SHA" || true
|
||||
node scripts/sync-facts.js --write >/dev/null 2>&1 || true
|
||||
if ! git diff --quiet -- docs/standards/architecture-current-state.md CONTRIBUTING.md 2>/dev/null; then
|
||||
git add docs/standards/architecture-current-state.md CONTRIBUTING.md 2>/dev/null || true
|
||||
GIT_AUTHOR_NAME=qiqi GIT_AUTHOR_EMAIL=qiqi@local GIT_COMMITTER_NAME=qiqi GIT_COMMITTER_EMAIL=qiqi@local git commit -q -m "docs: 锚点对齐 v${V}+${BUMP_SHA}(publish 自动)" || true
|
||||
echo "== 文档锚点已自动对齐并本地提交:${BUMP_SHA}(随版本一起 push)"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "== 完成:https://download.maqiart.eu.org/updates/latest.json"
|
||||
curl -s -m 15 https://download.maqiart.eu.org/updates/latest.json | head -c 200; echo
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env node
|
||||
/* set-doc-anchor.js —— 把架构文档的基线锚点写成「最近一次 bump 版本的提交」
|
||||
*
|
||||
* 用法:node scripts/set-doc-anchor.js <version> <sha>
|
||||
* 只改 docs/standards/architecture-current-state.md 的两处:
|
||||
* main = <sha>
|
||||
* 线上 `vX.Y.Z+<sha>`
|
||||
* 返回:0=已更新 / 2=没有变化 / 1=文件缺失
|
||||
*/
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const ver = String(process.argv[2] || '')
|
||||
const sha = String(process.argv[3] || '')
|
||||
const file = path.join(__dirname, '..', 'docs', 'standards', 'architecture-current-state.md')
|
||||
if (!ver || !sha) { console.error('用法: set-doc-anchor.js <version> <sha>'); process.exit(1) }
|
||||
if (!fs.existsSync(file)) { console.error('缺少 ' + file); process.exit(1) }
|
||||
|
||||
const bt = String.fromCharCode(96)
|
||||
const before = fs.readFileSync(file, 'utf8')
|
||||
let after = before.replace(
|
||||
new RegExp(bt + 'main = [0-9a-f]+' + bt),
|
||||
bt + 'main = ' + sha + bt,
|
||||
)
|
||||
after = after.replace(
|
||||
new RegExp('线上 ' + bt + 'v[0-9.]+[^' + bt + ']*' + bt),
|
||||
'线上 ' + bt + 'v' + ver + '+' + sha + bt,
|
||||
)
|
||||
if (after === before) { console.log('anchor unchanged (' + sha + ')'); process.exit(2) }
|
||||
fs.writeFileSync(file, after)
|
||||
console.log('anchor -> ' + sha + ' (v' + ver + ')')
|
||||
@@ -10,7 +10,19 @@ 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', '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', '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 安装)落地再启用。
|
||||
// 目录形态(plugins/<id>/{manifest.json,main.js[,styles.css]})的手写插件。
|
||||
// 注意:源仓里存在 <id>/styles.css 的插件会**自动**走目录形态 —— 单文件产物带不走样式,
|
||||
// 若不同步成目录,插件自带样式会被静默忽略(v1.0.3 grouplib 换行样式的坑)。
|
||||
const FOLDER_IDS = ['gallery']
|
||||
|
||||
// 刻意不随客户端/市场发布的插件(开发者直装):
|
||||
// ai-chat —— 依赖本机 Magpie(3425) + 需宿主 CSP 放行,上架会让多数用户装上连不上。
|
||||
// 详见 ../iwb-plugins-desktop/ai-chat/README.md「状态」一节。
|
||||
const DEV_ONLY_IDS = ['ai-chat']
|
||||
|
||||
const sha = (buf) => crypto.createHash('sha256').update(buf).digest()
|
||||
const shaHex = (buf) => sha(buf).toString('hex')
|
||||
@@ -21,12 +33,56 @@ fs.mkdirSync(outDir, { recursive: true })
|
||||
|
||||
const manifest = []
|
||||
let copied = 0, changed = 0
|
||||
const metaAll = (() => { try { return JSON.parse(fs.readFileSync(path.join(root, 'plugins', 'meta.json'), 'utf8')) } catch (e) { return {} } })()
|
||||
for (const id of IDS) {
|
||||
const artifact = path.join(srcRoot, id, 'src', 'index.js')
|
||||
if (!fs.existsSync(artifact)) { console.warn('跳过 ' + id + '(无 ' + artifact + ')'); continue }
|
||||
const buf = fs.readFileSync(artifact)
|
||||
const name = 'plugin-' + id + '.' + shaHex(buf).slice(0, 12) + '.js'
|
||||
const pkg = JSON.parse(fs.readFileSync(path.join(srcRoot, id, 'package.json'), 'utf8'))
|
||||
|
||||
const folderMode = FOLDER_IDS.indexOf(id) >= 0 || fs.existsSync(path.join(srcRoot, id, 'styles.css'))
|
||||
if (folderMode) {
|
||||
// 目录形态:plugins/<id>/{manifest.json,main.js}
|
||||
const dir = path.join(root, 'plugins', id)
|
||||
fs.mkdirSync(dir, { recursive: true })
|
||||
const mainPath = path.join(dir, 'main.js')
|
||||
if (!fs.existsSync(mainPath) || shaHex(fs.readFileSync(mainPath)) !== shaHex(buf)) { fs.writeFileSync(mainPath, buf); copied++ }
|
||||
const meta = metaAll[id] || {}
|
||||
// 可选 styles.css:插件自带样式(宿主 CSS 只在客户端发版时更新,视觉调整走插件更灵活)
|
||||
const files = { 'main.js': shaHex(buf) }
|
||||
let styleName = ''
|
||||
const styleSrc = path.join(srcRoot, id, 'styles.css')
|
||||
if (fs.existsSync(styleSrc)) {
|
||||
const sbuf = fs.readFileSync(styleSrc)
|
||||
const styleDest = path.join(dir, 'styles.css')
|
||||
if (!fs.existsSync(styleDest) || shaHex(fs.readFileSync(styleDest)) !== shaHex(sbuf)) { fs.writeFileSync(styleDest, sbuf); copied++ }
|
||||
styleName = 'styles.css'
|
||||
files['styles.css'] = shaHex(sbuf)
|
||||
}
|
||||
const manifestJson = {
|
||||
id: id,
|
||||
name: meta.name || id,
|
||||
version: pkg.version,
|
||||
apiVersion: Number((pkg.ibwPlugin && pkg.ibwPlugin.apiVersion) || 1),
|
||||
main: 'main.js',
|
||||
...(styleName ? { style: styleName } : {}),
|
||||
description: meta.desc || '',
|
||||
author: meta.author || 'official',
|
||||
icon: meta.icon || '',
|
||||
tags: Array.isArray(meta.tags) ? meta.tags : [],
|
||||
files: files,
|
||||
}
|
||||
fs.writeFileSync(path.join(dir, 'manifest.json'), JSON.stringify(manifestJson, null, 2) + '\n')
|
||||
// 同 id 的旧单文件产物清理(目录优先,留着会造成两份)
|
||||
for (const old of fs.readdirSync(outDir)) {
|
||||
if (old.indexOf('plugin-' + id + '.') === 0) { fs.unlinkSync(path.join(outDir, old)); changed++ }
|
||||
}
|
||||
manifest.push({ id: id, dir: id, main: 'main.js', style: manifestJson.style || '', version: pkg.version, files: manifestJson.files })
|
||||
console.log(id.padEnd(16), pkg.version.padEnd(8), 'dir/' + id + '/main.js')
|
||||
continue
|
||||
}
|
||||
|
||||
const name = 'plugin-' + id + '.' + shaHex(buf).slice(0, 12) + '.js'
|
||||
for (const old of fs.readdirSync(outDir)) {
|
||||
if (old.indexOf('plugin-' + id + '.') === 0 && old !== name) { fs.unlinkSync(path.join(outDir, old)); changed++ }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>插件开发规范 · Image Workbench</title>
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<link rel="stylesheet" href="/assets/style.css">
|
||||
<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}
|
||||
.devdoc h2{font-size:24px;margin:38px 0 10px;padding-top:10px;border-top:1px solid var(--line,#e6e8ec)}
|
||||
.devdoc h3{font-size:18px;margin:26px 0 8px}
|
||||
.devdoc p{margin:10px 0}
|
||||
.devdoc ul,.devdoc ol{margin:10px 0 10px 22px}
|
||||
.devdoc li{margin:4px 0}
|
||||
.devdoc code{background:#f3f4f6;border-radius:5px;padding:1px 5px;font-size:13px}
|
||||
.devdoc pre{background:#111418;color:#e6e8ec;border-radius:10px;padding:14px 16px;overflow:auto;font-size:13px;line-height:1.6}
|
||||
.devdoc pre code{background:none;color:inherit;padding:0}
|
||||
.devdoc table{border-collapse:collapse;width:100%;margin:14px 0;font-size:14px}
|
||||
.devdoc th,.devdoc td{border:1px solid var(--line,#e6e8ec);padding:7px 10px;text-align:left;vertical-align:top}
|
||||
.devdoc th{background:#f7f8fa}
|
||||
.devdoc blockquote{border-left:3px solid #d6dae1;margin:12px 0;padding:2px 14px;color:#5b6472}
|
||||
.devdoc a{color:#2b6cff}
|
||||
</style>
|
||||
</head><body>
|
||||
<!--NAV-->
|
||||
<main>
|
||||
<div class="wrap"><article class="devdoc">
|
||||
<!--DEV_CONTENT-->
|
||||
</article></div>
|
||||
</main>
|
||||
<!--FOOTER-->
|
||||
</body></html>
|
||||
@@ -2,6 +2,8 @@
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Image Workbench · 本地优先的 AI 生图工作台</title>
|
||||
<meta name="description" content="本地优先的 AI 生图无限画布:节点式工作流、插件按需安装、数据全部留在本机。">
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<link rel="stylesheet" href="/assets/style.css">
|
||||
</head><body>
|
||||
<!--NAV-->
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>插件市场 · Image Workbench</title>
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<link rel="stylesheet" href="/assets/style.css">
|
||||
</head><body>
|
||||
<!--NAV-->
|
||||
|
||||
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 85 KiB |
@@ -139,3 +139,4 @@ pre.cmd code{font-size:12.5px}
|
||||
.hero-veil{background:
|
||||
radial-gradient(62% 58% at 50% 40%, rgba(255,255,255,.86) 0%, rgba(255,255,255,.70) 46%, rgba(255,255,255,.16) 100%),
|
||||
linear-gradient(180deg, rgba(255,255,255,.84) 0%, rgba(255,255,255,.52) 50%, rgba(255,255,255,.20) 76%, #fff 100%)}
|
||||
nav .brand .logo{width:26px;height:26px;border-radius:7px;object-fit:cover;display:block;flex:0 0 auto}
|
||||
@@ -0,0 +1,196 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>插件开发规范 · Image Workbench</title>
|
||||
<link rel="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.40-mwsgavpk">
|
||||
<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}
|
||||
.devdoc h2{font-size:24px;margin:38px 0 10px;padding-top:10px;border-top:1px solid var(--line,#e6e8ec)}
|
||||
.devdoc h3{font-size:18px;margin:26px 0 8px}
|
||||
.devdoc p{margin:10px 0}
|
||||
.devdoc ul,.devdoc ol{margin:10px 0 10px 22px}
|
||||
.devdoc li{margin:4px 0}
|
||||
.devdoc code{background:#f3f4f6;border-radius:5px;padding:1px 5px;font-size:13px}
|
||||
.devdoc pre{background:#111418;color:#e6e8ec;border-radius:10px;padding:14px 16px;overflow:auto;font-size:13px;line-height:1.6}
|
||||
.devdoc pre code{background:none;color:inherit;padding:0}
|
||||
.devdoc table{border-collapse:collapse;width:100%;margin:14px 0;font-size:14px}
|
||||
.devdoc th,.devdoc td{border:1px solid var(--line,#e6e8ec);padding:7px 10px;text-align:left;vertical-align:top}
|
||||
.devdoc th{background:#f7f8fa}
|
||||
.devdoc blockquote{border-left:3px solid #d6dae1;margin:12px 0;padding:2px 14px;color:#5b6472}
|
||||
.devdoc a{color:#2b6cff}
|
||||
</style>
|
||||
</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>
|
||||
<div class="links">
|
||||
<a href="/">首页</a>
|
||||
<a href="/download/">下载</a>
|
||||
<a href="/plugins/">插件</a>
|
||||
<a href="/dev/" class="on">开发</a>
|
||||
<a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码</a>
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="btn" href="/plugins/">插件市场</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.40</a>
|
||||
</div>
|
||||
</div></nav>
|
||||
<main>
|
||||
<div class="wrap"><article class="devdoc">
|
||||
<h1>Image Workbench 插件开发规范</h1>
|
||||
<p>> 版本:v1(2026-11-22)。面向官方与第三方插件;示例以 promptlib(提示词库)与 style-source(风格库)为准。</p>
|
||||
<p>> 相关文档:plugin-node-drag.md(节点拖入/指针交互踩坑)、plugin-node-outkind.md(下游连线声明)、plugin-theme.md(主题契约)。</p>
|
||||
<h2>1. 目录与基本结构</h2>
|
||||
<p>插件是「一个目录 + 一个 IIFE 入口」,由宿主在启用时动态加载并调用 register。</p>
|
||||
<pre><code>my-plugin/
|
||||
package.json # 版本 + ibwPlugin 元数据
|
||||
src/index.js # 入口(IIFE,末尾 IWBPluginHost.register)
|
||||
styles.css # 样式(必须自包含)
|
||||
README.md</code></pre>
|
||||
<p>package.json:</p>
|
||||
<pre><code>{
|
||||
"name": "@iwb-plugin/my-plugin",
|
||||
"version": "1.0.0",
|
||||
"ibwPlugin": { "id": "my-plugin", "entry": "src/index.js", "apiVersion": 1 }
|
||||
}</code></pre>
|
||||
<p>入口骨架:</p>
|
||||
<pre><code>;(function (global) {
|
||||
'use strict'
|
||||
if (!global.IWBPluginHost) return
|
||||
global.IWBPluginHost.register({
|
||||
id: 'my-plugin',
|
||||
name: '我的插件',
|
||||
version: '1.0.0',
|
||||
capabilities: ['panels', 'canvas', 'canvasWrite'],
|
||||
settings: { panel: { type: 'custom', label: '设置', render: renderSettings } },
|
||||
mount: mount,
|
||||
unmount: unmount,
|
||||
}, function (ctx) {
|
||||
// setup:注册面板/节点/命令
|
||||
return { dispose () {} }
|
||||
})
|
||||
})(typeof window !== 'undefined' ? window : globalThis)</code></pre>
|
||||
<h2>2. 能力(capabilities)与 ctx 映射</h2>
|
||||
<p>只申请用到的能力;能力名与 ctx 键不同:</p>
|
||||
<table><thead><tr><th>capability</th><th>ctx 键</th><th>用途</th></tr></thead><tbody>
|
||||
<tr><td>panels</td><td>ctx.ui</td><td>侧栏/独立面板注册</td></tr>
|
||||
<tr><td>promptlib</td><td>ctx.promptlib</td><td>提示词库数据 + 文件 + 备份</td></tr>
|
||||
<tr><td>nodeTypes</td><td>ctx.nodes</td><td>画布节点类型注册</td></tr>
|
||||
<tr><td>canvas</td><td>ctx.canvas</td><td>只读:getNodes / getSelectedNode / screenToWorld</td></tr>
|
||||
<tr><td>canvasWrite</td><td>ctx.canvasWrite</td><td>写入:createNode / createImageNode / setNodeImage</td></tr>
|
||||
<tr><td>nodeActions</td><td>ctx.nodeActions</td><td>节点右键/气泡动作</td></tr>
|
||||
<tr><td>commands</td><td>ctx.commands</td><td>命令面板</td></tr>
|
||||
<tr><td>settings</td><td>ctx.settings</td><td>KV 配置</td></tr>
|
||||
<tr><td>data</td><td>ctx.data</td><td>插件数据文件</td></tr>
|
||||
</tbody></table>
|
||||
<p><strong>注意</strong>:createNode 在 ctx.canvasWrite,不在 ctx.canvas。调错只会提示“宿主不支持”。</p>
|
||||
<h2>3. 面板</h2>
|
||||
<pre><code>ctx.ui.registerPanel({
|
||||
id: 'my-panel',
|
||||
title: '我的插件',
|
||||
mount (host) { /* 渲染到 host */ },
|
||||
unmount (host) { /* 清理定时器/监听 */ }
|
||||
})</code></pre>
|
||||
<ul>
|
||||
<li>mount 只调用一次,内部自己管理重渲染。</li>
|
||||
<li>面板宽度可变:使用栅格/瀑布流,不要写死 px 宽度。</li>
|
||||
<li>面板内所有 DOM 事件在 unmount 时移除。</li>
|
||||
</ul>
|
||||
<h2>4. 节点类型</h2>
|
||||
<pre><code>ctx.nodes.register({
|
||||
id: 'tpl',
|
||||
title: '模板节点',
|
||||
defaults: { outKind: 'prompt' },
|
||||
ports: { in: false, out: true },
|
||||
height: 360,
|
||||
render (node, props, host) { /* 首次建 DOM,之后 sync */ }
|
||||
})</code></pre>
|
||||
<p>宿主会生成类型 plugin:<插件id>:<变体id>。</p>
|
||||
<p><strong>必须遵守</strong>:</p>
|
||||
<ol>
|
||||
<li>输出文本/提示词 → data.outKind = 'prompt'(注册默认值、拖入数据、旧节点在 render 里自愈)。</li>
|
||||
<li>拖入画布用指针拖拽,不用原生 HTML5 DnD:</li>
|
||||
</ol>
|
||||
<pre><code>pointerdown → pointermove(>5px) 幽灵卡片
|
||||
→ pointerup → ctx.canvas.screenToWorld(x,y)
|
||||
→ ctx.canvasWrite.createNode('tpl', wx, wy, data)</code></pre>
|
||||
<ol>
|
||||
<li>输入框:未选中时 pointer-events: none,选中后才可编辑;只读 textarea 同样处理。</li>
|
||||
<li>单击 = 选中/拖动,双击 = 编辑;不要用单击打开详情。</li>
|
||||
<li>节点 render 必须可增量 sync,避免整块重建(输入框会丢焦点)。</li>
|
||||
</ol>
|
||||
<h2>5. 数据与文件</h2>
|
||||
<ul>
|
||||
<li>小数据:ctx.promptlib(或 ctx.data)JSON,单文件 < 1MB。</li>
|
||||
<li>大文件(封面/图片):ctx.promptlib.filePut/fileGet/fileList,落地在 plugin-data/<id>/files/。</li>
|
||||
<li>dataUrlToBytes() 返回 { mime, bytes },不是 Uint8Array。</li>
|
||||
<li>备份:提供导出/导入 JSON;导入按 id 合并,提供“覆盖同 id”选项。</li>
|
||||
<li>迁移:旧格式在 setup 里做一次性迁移,失败要提示而不是静默丢数据。</li>
|
||||
</ul>
|
||||
<h2>6. 设置页面</h2>
|
||||
<p>宿主设置页内嵌渲染,不弹独立页面:</p>
|
||||
<pre><code>settings: {
|
||||
panel: { type: 'custom', label: '分组与备份', render: renderSettings }
|
||||
}</code></pre>
|
||||
<p>render 返回 DOM;宿主负责挂载/卸载。设置页适合放:</p>
|
||||
<ul>
|
||||
<li>分组管理(新建/改名/排序/删除)</li>
|
||||
<li>数据备份(导出/导入)</li>
|
||||
<li>数据位置(打开数据目录)</li>
|
||||
<li>插件级开关/默认值</li>
|
||||
</ul>
|
||||
<h2>7. 样式规范</h2>
|
||||
<ol>
|
||||
<li><strong>自包含</strong>:宿主基础样式会变;用到的宿主类按作用域复制一份(.iwb-myplugin …)。</li>
|
||||
<li>统一前缀:面板/节点类名 my-plugin-*,避免与宿主 .iwb-* 冲突。</li>
|
||||
<li>颜色走 CSS 变量:var(--iwb-text)、--iwb-panel、--iwb-border、--iwb-plugin-accent。</li>
|
||||
<li>动画克制:只做 hover/press 反馈;不使用持续浮动动画。</li>
|
||||
<li>深色主题:不写死 #fff/#000;主题契约测试会扫描。</li>
|
||||
<li>悬停放大只缩放内层背景,不缩放卡片本体(避免命中区域漂移/闪烁)。</li>
|
||||
<li>图片/封面 pointer-events: none,点击永远落到卡片。</li>
|
||||
</ol>
|
||||
<h2>8. 错误处理与提示</h2>
|
||||
<ul>
|
||||
<li>所有用户可见错误用 ctx.promptlib.notify / ctx.ui.toast,文案给“下一步怎么办”。</li>
|
||||
<li>异步链必须有 catch;不要吞掉错误后静默。</li>
|
||||
<li>崩溃日志:window.onerror 由宿主统一采集,插件不要自己覆盖。</li>
|
||||
<li>定时器/监听在 unmount/dispose 清理,避免面板切换后重复执行。</li>
|
||||
</ul>
|
||||
<h2>9. 测试与门禁</h2>
|
||||
<p>提交前至少:</p>
|
||||
<pre><code>node scripts/validate-plugins.js # manifest/能力/入口校验
|
||||
node scripts/theme-contract-test.js # 主题变量
|
||||
node tests/plugin-<id>-render-test.js # jsdom 渲染/交互</code></pre>
|
||||
<p>jsdom 可覆盖:面板渲染、节点 render/sync、拖拽插入(stub screenToWorld/createNode)、双击详情、保存回详情、封面 img。</p>
|
||||
<h2>10. 发布与市场</h2>
|
||||
<ol>
|
||||
<li>改 package.json version 与入口 version(两处一致)。</li>
|
||||
<li>node scripts/sync-plugins-from-repo.js(同步到客户端 plugins/)</li>
|
||||
<li>node scripts/gen-market.js(生成 market/ 与 zip)</li>
|
||||
<li>上传 market 到 NAS(tar + scp + 解压)</li>
|
||||
<li>客户端发版:set-version → CHANGELOG → 锚点 → verify:ci → build → publish-update → releases/site → tag/push</li>
|
||||
</ol>
|
||||
<h2>11. 常见坑(务必先读)</h2>
|
||||
<ul>
|
||||
<li>原生 HTML5 拖放:WKWebView 吞 pointerup,节点落地后第一次点击异常 → 用指针拖拽。</li>
|
||||
<li>ctx.canvas 没有 createNode → 用 ctx.canvasWrite。</li>
|
||||
<li>输入框拦截拖动 → 未选中时 pointer-events:none。</li>
|
||||
<li>只读 textarea 仍可选中文本 → pointer-events:none。</li>
|
||||
<li>dataUrlToBytes 返回对象 → 取 .bytes。</li>
|
||||
<li>封面直接存 dataURL 会让 JSON 膨胀 → 迁移到文件,只存 { img }。</li>
|
||||
<li>插件节点不声明 outKind → 只能中继,无法直连生图。</li>
|
||||
</ul>
|
||||
</article></div>
|
||||
</main>
|
||||
<footer><div class="wrap">
|
||||
<div class="cols">
|
||||
<div><div style="color:#fff;font-weight:640;margin-bottom:8px">Image Workbench</div>
|
||||
<div style="font-size:13px;line-height:1.8">本地优先的 AI 生图无限画布。图片、提示词与模型配置全部留在你自己的电脑里。</div></div>
|
||||
<div><h4>产品</h4><a href="/">首页</a><a href="/download/">下载</a><a href="/plugins/">插件市场</a></div>
|
||||
<div><h4>资源</h4><a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码仓库</a><a href="https://git.maqiart.eu.org/malongan/iwb-plugins-desktop" target="_blank" rel="noopener">插件仓库</a><a href="/updates/latest.json" target="_blank" rel="noopener">更新源</a></div>
|
||||
<div><h4>说明</h4><a href="/download/">安装步骤</a><a href="/plugins/">插件安装</a></div>
|
||||
</div>
|
||||
<div class="copy"><span>© 2026 Image Workbench</span><span>数据保存在本地 · 不上传任何图片</span></div>
|
||||
</div></footer>
|
||||
</body></html>
|
||||
@@ -4,6 +4,8 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<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=" + encodeURIComponent(latest.version + '-' + Date.now().toString(36)) + "">
|
||||
<style>
|
||||
*{box-sizing:border-box}
|
||||
@@ -34,11 +36,12 @@
|
||||
</head>
|
||||
<body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
|
||||
<a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>
|
||||
<div class="links">
|
||||
<a href="/">首页</a>
|
||||
<a href="/download/" class="on">下载</a>
|
||||
<a href="/plugins/">插件</a>
|
||||
<a href="/dev/">开发</a>
|
||||
<a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码</a>
|
||||
</div>
|
||||
<div class="right">
|
||||
@@ -54,18 +57,18 @@
|
||||
<h2>下载</h2>
|
||||
<div class="row">
|
||||
<div class="name">macOS · Apple Silicon<div class="hint">M1 / M2 / M3 / M4</div></div>
|
||||
<div class="meta">版本 3.25.34 · 8.4 MB · .dmg<div class="hash">sha256 3107284da68e2c5b…</div></div>
|
||||
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.25.34_aarch64.dmg?h=3107284da68e">下载</a>
|
||||
<div class="meta">版本 3.26.40 · 8.4 MB · .dmg<div class="hash">sha256 165f48fa6c2d874f…</div></div>
|
||||
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.26.40_aarch64.dmg?h=165f48fa6c2d">下载</a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">macOS · Intel<div class="hint">x86_64</div></div>
|
||||
<div class="meta">版本 3.25.34 · 8.7 MB · .dmg<div class="hash">sha256 888cf42081964760…</div></div>
|
||||
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.25.34_x64.dmg?h=888cf4208196">下载</a>
|
||||
<div class="meta">版本 3.26.40 · 8.8 MB · .dmg<div class="hash">sha256 6890b428aee6233c…</div></div>
|
||||
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.26.40_x64.dmg?h=6890b428aee6">下载</a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">Windows · x64<div class="hint">需要 WebView2</div></div>
|
||||
<div class="meta"></div>
|
||||
<span class="muted">暂未提供</span>
|
||||
<div class="meta">版本 3.26.40 · 4.8 MB · .exe<div class="hash">sha256 c82010565b339520…</div></div>
|
||||
<a class="btn" href="/updates/windows-x86_64/image-workbench_3.26.40_x64-setup.exe?h=c82010565b33">下载</a>
|
||||
</div>
|
||||
|
||||
<h2>系统要求</h2>
|
||||
@@ -95,8 +98,260 @@
|
||||
|
||||
<h2>历史版本</h2>
|
||||
<div class="row">
|
||||
<div class="name">3.25.34<div class="hint">Intel 版:归档等待按需</div></div>
|
||||
<div class="meta">2026-11-19<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
<div class="name">3.26.40<div class="hint">Windows:修复 PowerShell 弹窗(改用 GetProcessMemoryInfo)</div></div>
|
||||
<div class="meta">2026-11-23<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.39<div class="hint">v3.26.39:修正插件插入落点与封面插入(拖拽落点按节点宽高居中到鼠标、插入落到画布可视中心、封面先解析为 dataURL 再插入)</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.38<div class="hint">Intel 版:同一版本</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.37<div class="hint">Intel 版:同一版本</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.35<div class="hint">Intel 版:同一改进</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.34<div class="hint">Intel 版:同一优化</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.33<div class="hint">Intel 版:同一修复</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.32<div class="hint">Intel 版:同一合并</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.31<div class="hint">Intel 版:同一合并</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.30<div class="hint">Intel 版:同一合并</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.29<div class="hint">Intel 版:同一合并</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.28<div class="hint">Intel 版:同一清理</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.27<div class="hint">Intel 版:同一交互</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.26<div class="hint">Intel 版:同一交互</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.25<div class="hint">Intel 版:同一优化</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.24<div class="hint">Intel 版:同一设计</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.23<div class="hint">Intel 版:同一修复</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.22<div class="hint">Intel 版:同一修复</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.21<div class="hint">Intel 版:同一修复</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.20<div class="hint">Intel 版:同一修复</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.18<div class="hint">Intel 版:同一布局逻辑</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.17<div class="hint">Intel 版:同一布局修复</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.16<div class="hint">Intel 版:同一修复</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.15<div class="hint">Intel 版:同一调整</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.14<div class="hint">Intel 版:同一调整</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.13<div class="hint">Intel 版:同一修复</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.12<div class="hint">Intel 版:同一修复</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.10<div class="hint">Intel 版:同一回退</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.5<div class="hint">Intel 版:同一改动</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.4<div class="hint">Intel 版:同一改动</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.3<div class="hint">Intel 版:同一改动</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.2<div class="hint">Intel 版:同一改动</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.1<div class="hint">Intel 版:同一改动</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.0<div class="hint">Intel 版:同一改动</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.99<div class="hint">Intel 版:同一改动</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.98<div class="hint">Intel 版:同一改动</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.97<div class="hint">Intel 版:同一改动</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.96<div class="hint">Intel 版:同一改动</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.94<div class="hint">Intel 版:同一回滚</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.88<div class="hint">Intel 版:同一批修复</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.87<div class="hint">Intel 版:同一批修复</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.86<div class="hint">Intel 版:同一批修复</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.85<div class="hint">Intel 版:同一批改动</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.84<div class="hint">Intel 版:同一批修复</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.83<div class="hint">Intel 版:同一改动</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.82<div class="hint">Intel 版:同一批调整</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.81<div class="hint">Intel 版:同一改动</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.80<div class="hint">Intel 版:同一批改动</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.79<div class="hint">Intel 版:同一修复</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.76<div class="hint">Intel 版:同一批改动</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.74<div class="hint">Intel 版:同一批改动</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.73<div class="hint">Intel 版:同一批缩略图改造</div></div>
|
||||
<div class="meta">2026-11-21<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.72<div class="hint">Intel 版:同一修复</div></div>
|
||||
<div class="meta">2026-11-20<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.71<div class="hint">Intel 版:同一改动</div></div>
|
||||
<div class="meta">2026-11-20<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.70<div class="hint">Intel 版:同一批优化</div></div>
|
||||
<div class="meta">2026-11-20<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.69<div class="hint">Intel 版:同一批调整</div></div>
|
||||
<div class="meta">2026-11-20<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.68<div class="hint">Intel 版:同一批交互性能优化</div></div>
|
||||
<div class="meta">2026-11-20<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.67<div class="hint">Intel 版:同一批性能优化</div></div>
|
||||
<div class="meta">2026-11-20<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.66<div class="hint">Intel 版:同一批修复</div></div>
|
||||
<div class="meta">2026-11-20<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.64<div class="hint">Intel 版:同一批修复</div></div>
|
||||
<div class="meta">2026-11-20<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.62<div class="hint">Intel 版:同一批修复</div></div>
|
||||
<div class="meta">2026-11-20<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.60<div class="hint">Intel 版:去重 + 插件页修复 + 品牌 logo</div></div>
|
||||
<div class="meta">2026-11-20<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.59<div class="hint">Intel 版:一级导航 + 插件页 + 快捷键弹窗</div></div>
|
||||
<div class="meta">2026-11-20<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.34<div class="hint">v3.25.34:自动下载仅在开启时才等待图库归档(未开启不拖慢出图);清理废弃字段。</div></div>
|
||||
<div class="meta">2026-11-19<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.25.32<div class="hint">v3.25.32:修全屏工具打开时浏览器网页遮挡;win 托盘图标深色任务栏可见;三平台齐平</div></div>
|
||||
@@ -236,7 +491,7 @@
|
||||
</div>
|
||||
|
||||
<div class="foot">
|
||||
本页由 <code>scripts/gen-release-page.js</code> 从 releases.json 生成 · 源码 <a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop">git.maqiart.eu.org</a> · 更新于 2026-11-19
|
||||
本页由 <code>scripts/gen-release-page.js</code> 从 releases.json 生成 · 源码 <a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop">git.maqiart.eu.org</a> · 更新于 2026-11-22
|
||||
</div>
|
||||
</div></div>
|
||||
|
||||
|
||||
@@ -2,32 +2,35 @@
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Image Workbench · 本地优先的 AI 生图工作台</title>
|
||||
<meta name="description" content="本地优先的 AI 生图无限画布:节点式工作流、插件按需安装、数据全部留在本机。">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.25.34-mwnbt40t">
|
||||
<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.40-mwsgavpk">
|
||||
</head><body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
|
||||
<a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>
|
||||
<div class="links">
|
||||
<a href="/" class="on">首页</a>
|
||||
<a href="/download/">下载</a>
|
||||
<a href="/plugins/">插件</a>
|
||||
<a href="/dev/">开发</a>
|
||||
<a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码</a>
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="btn" href="/plugins/">插件市场</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.25.34</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.40</a>
|
||||
</div>
|
||||
</div></nav>
|
||||
<main>
|
||||
<section class="hero hero-art">
|
||||
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.25.34-mwnbt40t" alt=""></div>
|
||||
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.26.40-mwsgavpk" alt=""></div>
|
||||
<div class="hero-veil"></div>
|
||||
<div class="wrap">
|
||||
<span class="kicker">v3.25.34 · macOS / Windows · 数据在本地</span>
|
||||
<span class="kicker">v3.26.40 · macOS / Windows · 数据在本地</span>
|
||||
<h1>本地优先的<br>AI 生图无限画布</h1>
|
||||
<p class="sub">用节点把「参考图 → 提示词 → 批量生成 → 图库」串成一条生产线。<br>图片、提示词、模型配置全部留在你自己的电脑里,插件按需安装。</p>
|
||||
<div class="cta">
|
||||
<a class="btn primary lg" href="/download/">下载 v3.25.34</a>
|
||||
<a class="btn lg" href="/plugins/">浏览 8 个插件</a>
|
||||
<a class="btn primary lg" href="/download/">下载 v3.26.40</a>
|
||||
<a class="btn lg" href="/plugins/">浏览 11 个插件</a>
|
||||
</div>
|
||||
<div class="meta">支持 macOS 12+ 与 Windows 10 1803+ · 安装包约 7 MB · 无需登录</div>
|
||||
</div></section>
|
||||
@@ -64,38 +67,38 @@
|
||||
</div>
|
||||
<div class="pcard" data-name="应用内浏览器 browser 库面板内置真实浏览器:书签按分组管理、拖动排序;地址栏 ↗ 可把当前页放到画布节点 浏览器 效率" data-tags="浏览器,效率">
|
||||
<div class="head"><span class="av" style="background:#eaf1fb">🌐</span>
|
||||
<div><div class="nm">应用内浏览器</div><div class="ver">v1.6.0 · 官方</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>
|
||||
<div class="pcard" data-name="标注 / 修图 image-annotate 在画布内标注、涂抹、局部重绘 修图 标注" data-tags="修图,标注">
|
||||
<div class="head"><span class="av" style="background:#fdeaea">🖌️</span>
|
||||
<div><div class="nm">标注 / 修图</div><div class="ver">v1.20.6 · 官方</div></div></div>
|
||||
<div class="desc">在画布内标注、涂抹、局部重绘</div>
|
||||
<div class="tags"><span class="tag">修图</span><span class="tag">标注</span></div>
|
||||
<div class="pcard" data-name="图库 gallery 右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供) 资源 图库" data-tags="资源,图库">
|
||||
<div class="head"><span class="av" style="background:#eef2f6">🖼️</span>
|
||||
<div><div class="nm">图库</div><div class="ver">v1.6.9 · 官方</div></div></div>
|
||||
<div class="desc">右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供)</div>
|
||||
<div class="tags"><span class="tag">资源</span><span class="tag">图库</span></div>
|
||||
</div>
|
||||
<div class="pcard" data-name="位图转矢量 image-vectorize 把位图转成 svg 矢量路径 转换 矢量" data-tags="转换,矢量">
|
||||
<div class="head"><span class="av" style="background:#eaf3ea">✒️</span>
|
||||
<div><div class="nm">位图转矢量</div><div class="ver">v0.6.0 · 官方</div></div></div>
|
||||
<div class="desc">把位图转成 SVG 矢量路径</div>
|
||||
<div class="tags"><span class="tag">转换</span><span class="tag">矢量</span></div>
|
||||
<div class="pcard" data-name="节点组 grouplib 左栏收藏的节点组:分组/改名/删除,拖到画布实例化(数据由客户端提供) 资源 节点组" data-tags="资源,节点组">
|
||||
<div class="head"><span class="av" style="background:#eef2f6">📦</span>
|
||||
<div><div class="nm">节点组</div><div class="ver">v1.0.4 · 官方</div></div></div>
|
||||
<div class="desc">左栏收藏的节点组:分组/改名/删除,拖到画布实例化(数据由客户端提供)</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.2 · 官方</div></div></div>
|
||||
<div class="desc">风格提示词库与一键套用</div>
|
||||
<div class="tags"><span class="tag">提示词</span><span class="tag">风格</span></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.8 · 官方</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/">查看全部 8 个插件</a></div>
|
||||
<div style="margin-top:22px"><a class="btn" href="/plugins/">查看全部 11 个插件</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.25.34_aarch64.dmg?h=3107284da68e"><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.25.34_x64.dmg?h=888cf4208196"><div class="n">macOS · Intel</div><div class="s">x86_64 · 8.7 MB · .dmg</div></a>
|
||||
<div class="none"><div class="n">Windows · x64</div><div class="s">暂未提供</div></div></div>
|
||||
<div class="dl"><a href="/updates/darwin-aarch64/image-workbench_3.26.40_aarch64.dmg?h=165f48fa6c2d"><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.40_x64.dmg?h=6890b428aee6"><div class="n">macOS · Intel</div><div class="s">x86_64 · 8.8 MB · .dmg</div></a>
|
||||
<a href="/updates/windows-x86_64/image-workbench_3.26.40_x64-setup.exe?h=c82010565b33"><div class="n">Windows · x64</div><div class="s">需要 WebView2 · 4.8 MB · .exe</div></a></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>
|
||||
</main>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": 1,
|
||||
"updatedAt": "2026-11-19T07:01:36.259Z",
|
||||
"version": 2,
|
||||
"updatedAt": "2026-11-22T15:51:05.074Z",
|
||||
"plugins": [
|
||||
{
|
||||
"id": "batch-export",
|
||||
@@ -15,6 +15,21 @@
|
||||
],
|
||||
"version": "1.2.0",
|
||||
"apiVersion": 1,
|
||||
"bundle": "plugins/batch-export-1.2.0.zip",
|
||||
"bundleSize": 44936,
|
||||
"bundleSha256": "338cfbe8fe00e92771f60f996d6a4baeb3c3b4954dfe774cfe83879639234552",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "163e5de559a6907982749cdf5fbf7372b492ab30096a5bb935315e002fb1c7a5",
|
||||
"size": 393
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "b7d13ba66cf97ff65e94305328183a1a3b5a45b0393f3a63f77f6b7b46795389",
|
||||
"size": 44329
|
||||
}
|
||||
],
|
||||
"file": "plugins/plugin-batch-export.b7d13ba66cf9.js",
|
||||
"size": 44329,
|
||||
"sha256": "b7d13ba66cf97ff65e94305328183a1a3b5a45b0393f3a63f77f6b7b46795389",
|
||||
@@ -33,6 +48,21 @@
|
||||
],
|
||||
"version": "1.0.0",
|
||||
"apiVersion": 1,
|
||||
"bundle": "plugins/blank-canvas-1.0.0.zip",
|
||||
"bundleSize": 6674,
|
||||
"bundleSha256": "b6bb7f37d7ae1ed5c0e19dacbae0050cf42b88dcdb6151385fd799443176ed7d",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "4ce80b37f07f900efaeddd68ef5379b755433555e4bdab222adbac509c2a21a6",
|
||||
"size": 366
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "67763893fa99c8fe1d8bcf640426f5bbc576abd35bcdc84c910b7b08f79964f9",
|
||||
"size": 6094
|
||||
}
|
||||
],
|
||||
"file": "plugins/plugin-blank-canvas.67763893fa99.js",
|
||||
"size": 6094,
|
||||
"sha256": "67763893fa99c8fe1d8bcf640426f5bbc576abd35bcdc84c910b7b08f79964f9",
|
||||
@@ -49,12 +79,129 @@
|
||||
"浏览器",
|
||||
"效率"
|
||||
],
|
||||
"version": "1.6.0",
|
||||
"version": "1.7.0",
|
||||
"apiVersion": 1,
|
||||
"file": "plugins/plugin-browser.9e9fa4cdb25d.js",
|
||||
"size": 58003,
|
||||
"sha256": "9e9fa4cdb25d17032db2dabdd004ed16fd01a0d0ad0812a49cd636957601110f",
|
||||
"integrity": "sha256-np+kzbJdFwMtstq90ATtFv0BoNCtCBKknNY2lXYBEQ8="
|
||||
"bundle": "plugins/browser-1.7.0.zip",
|
||||
"bundleSize": 60839,
|
||||
"bundleSha256": "8a802986f075774c941a7309eeb0f36e870c318aa9535d263da523c12f37d975",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "4dc8e8d883e900779932310c74947bcb2e505ac91167275becbf9f1685afdc48",
|
||||
"size": 445
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "8161a82890d96724d90a2ae9c8949d37af92f94b944cd525adc07b65b5eab4f4",
|
||||
"size": 60180
|
||||
}
|
||||
],
|
||||
"file": "plugins/plugin-browser.8161a82890d9.js",
|
||||
"size": 60180,
|
||||
"sha256": "8161a82890d96724d90a2ae9c8949d37af92f94b944cd525adc07b65b5eab4f4",
|
||||
"integrity": "sha256-gWGoKJDZZyTZCirpyJSdN6+S+UuUTNUlrcB7ZbXqtPQ="
|
||||
},
|
||||
{
|
||||
"id": "gallery",
|
||||
"name": "图库",
|
||||
"desc": "右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供)",
|
||||
"author": "official",
|
||||
"icon": "🖼️",
|
||||
"color": "#eef2f6",
|
||||
"tags": [
|
||||
"资源",
|
||||
"图库"
|
||||
],
|
||||
"version": "1.6.9",
|
||||
"apiVersion": 1,
|
||||
"bundle": "plugins/gallery-1.6.9.zip",
|
||||
"bundleSize": 34272,
|
||||
"bundleSha256": "9588b28fd2b2b3cc0f38ecd06fee05873474ca98867ce5b2dc5d6cc5948cf383",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "0523a370d28132dcca912894929e402e9e7bac4a611be146ee075d073f26276c",
|
||||
"size": 526
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "26c7e64b3a0021c6b9514dfb84d4d2580276698222b4791cfa99f22ead66ff52",
|
||||
"size": 28241
|
||||
},
|
||||
{
|
||||
"path": "styles.css",
|
||||
"sha256": "9d5b4ab1343761e51ef0c479cab96a94d3d6eaa27f0fdb500bff789ec81d70e0",
|
||||
"size": 5195
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "grouplib",
|
||||
"name": "节点组",
|
||||
"desc": "左栏收藏的节点组:分组/改名/删除,拖到画布实例化(数据由客户端提供)",
|
||||
"author": "official",
|
||||
"icon": "📦",
|
||||
"color": "",
|
||||
"tags": [
|
||||
"资源",
|
||||
"节点组"
|
||||
],
|
||||
"version": "1.0.4",
|
||||
"apiVersion": 1,
|
||||
"bundle": "plugins/grouplib-1.0.4.zip",
|
||||
"bundleSize": 24479,
|
||||
"bundleSha256": "842fd7d519bf8378b205c1c35894b8b2925e40595792fed99b1d456a2563404d",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "b35b748d9e76380f8c02d04ca10e93e280d1b6386c6e0a3b55f5be2448a3c65f",
|
||||
"size": 530
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "8cb2e39f9880d49c9b9c15a1f7d62d9772170c8d0eac0faaa237bb7056af34ff",
|
||||
"size": 21601
|
||||
},
|
||||
{
|
||||
"path": "styles.css",
|
||||
"sha256": "ee6e292ffebdcc1351651bf7937399128ae06e0b364624792f34111866f9355b",
|
||||
"size": 2038
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "promptlib",
|
||||
"name": "提示词库",
|
||||
"desc": "右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供)",
|
||||
"author": "official",
|
||||
"icon": "📖",
|
||||
"color": "",
|
||||
"tags": [
|
||||
"资源",
|
||||
"提示词"
|
||||
],
|
||||
"version": "1.8.8",
|
||||
"apiVersion": 1,
|
||||
"bundle": "plugins/promptlib-1.8.8.zip",
|
||||
"bundleSize": 146066,
|
||||
"bundleSha256": "af91d59add3df05c390c6ead566663545acaf1200461185668750422360a2f6f",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "667ddf6ddedab0ce3abbccbe3dfaa34c56bfa90179369c1c013e736ee5eb15e7",
|
||||
"size": 540
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "91fde4bcfa888b04ee2b0e79a05d951a56247bc76ecd11b5d9500131df11d542",
|
||||
"size": 106422
|
||||
},
|
||||
{
|
||||
"path": "styles.css",
|
||||
"sha256": "82bdae857b0c6e66c0e1c9fa0ea47b269dcbde51cdfacd552e4b919cfa4576c7",
|
||||
"size": 38794
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "image-annotate",
|
||||
@@ -69,6 +216,21 @@
|
||||
],
|
||||
"version": "1.20.6",
|
||||
"apiVersion": 1,
|
||||
"bundle": "plugins/image-annotate-1.20.6.zip",
|
||||
"bundleSize": 462110,
|
||||
"bundleSha256": "2653d2219d036342bc6768beb0936101e44a99d6635822d376cba3a6d663a28e",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "8bdba81a4d5c5aea085699679bb7f8be8fee81cbe07ac9a7b83cdb47fc05fff0",
|
||||
"size": 373
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "7a865c7c353c3fbcaac551a8aeb5acd1bf624ca25f104db96fce493c3084b24f",
|
||||
"size": 461523
|
||||
}
|
||||
],
|
||||
"file": "plugins/plugin-image-annotate.7a865c7c353c.js",
|
||||
"size": 461523,
|
||||
"sha256": "7a865c7c353c3fbcaac551a8aeb5acd1bf624ca25f104db96fce493c3084b24f",
|
||||
@@ -87,6 +249,21 @@
|
||||
],
|
||||
"version": "0.6.0",
|
||||
"apiVersion": 1,
|
||||
"bundle": "plugins/image-vectorize-0.6.0.zip",
|
||||
"bundleSize": 145682,
|
||||
"bundleSha256": "c6c36bbc56b36f19e4b91b2e8d9db62046804490a790a01b09a052adc6dec096",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "4378b397d8954e3f4522c53bfff970b4d4d29ba8234501ac998bb552af03b30d",
|
||||
"size": 362
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "7014982f60e605e34909986ac0c372195e6130129e29a927d6d41a1405579e9f",
|
||||
"size": 145106
|
||||
}
|
||||
],
|
||||
"file": "plugins/plugin-image-vectorize.7014982f60e6.js",
|
||||
"size": 145106,
|
||||
"sha256": "7014982f60e605e34909986ac0c372195e6130129e29a927d6d41a1405579e9f",
|
||||
@@ -103,12 +280,27 @@
|
||||
"提示词",
|
||||
"风格"
|
||||
],
|
||||
"version": "1.3.2",
|
||||
"version": "1.3.3",
|
||||
"apiVersion": 1,
|
||||
"file": "plugins/plugin-style-source.ee7168565a44.js",
|
||||
"size": 69925,
|
||||
"sha256": "ee7168565a44d49daaf300f62d5c7a106e60fba29a9e4888ff8bfd9abd2e3178",
|
||||
"integrity": "sha256-7nFoVlpE1J2q8wD2LVx6EG5g+6KankiI/4v9mr0uMXg="
|
||||
"bundle": "plugins/style-source-1.3.3.zip",
|
||||
"bundleSize": 70634,
|
||||
"bundleSha256": "a727fa70f7b195f11a4daed2febb3c5ad073da016ed292856b24127b2ba4d8c6",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "d864e4943ae14764a0dcca27ebe89d877f90ff0350663a86f4d91470ed1cf2e2",
|
||||
"size": 355
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "05c108f8a63cc1c5ebb1c1d18b4ade10e971a0ee74fb135482db7597e6731f84",
|
||||
"size": 70065
|
||||
}
|
||||
],
|
||||
"file": "plugins/plugin-style-source.05c108f8a63c.js",
|
||||
"size": 70065,
|
||||
"sha256": "05c108f8a63cc1c5ebb1c1d18b4ade10e971a0ee74fb135482db7597e6731f84",
|
||||
"integrity": "sha256-BcEI+KY8wcXrscHRi0reEOlxoO50+xNUgtt1l+ZzH4Q="
|
||||
},
|
||||
{
|
||||
"id": "white-bg-800",
|
||||
@@ -123,6 +315,21 @@
|
||||
],
|
||||
"version": "1.2.1",
|
||||
"apiVersion": 1,
|
||||
"bundle": "plugins/white-bg-800-1.2.1.zip",
|
||||
"bundleSize": 15528,
|
||||
"bundleSha256": "cf1c8223b0361fd362cca21af373dc0d8de95d1c58345438a3f795b0912935d1",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "8347db72950a686bdb3a205906858f6f9d3f7ede6aa7c98f5cc4c159d580df06",
|
||||
"size": 357
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "a5a92f045c0d4046b205562019b2a6354afd14aa92375b78559d48f2ce9b74ee",
|
||||
"size": 14957
|
||||
}
|
||||
],
|
||||
"file": "plugins/plugin-white-bg-800.a5a92f045c0d.js",
|
||||
"size": 14957,
|
||||
"sha256": "a5a92f045c0d4046b205562019b2a6354afd14aa92375b78559d48f2ce9b74ee",
|
||||
@@ -141,6 +348,21 @@
|
||||
],
|
||||
"version": "1.0.3",
|
||||
"apiVersion": 1,
|
||||
"bundle": "plugins/xianyi-cutout-1.0.3.zip",
|
||||
"bundleSize": 5072,
|
||||
"bundleSha256": "381383fdeda9a2e72f09489ecc319b7facd6236d32f82b9544fc0cd29ae0f5c1",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "0bffc47c33e058b614882cb7fce41c201a5340c0f05c4f58ba28eb26dfbbc627",
|
||||
"size": 370
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "79c8c47dfc6187b8af2688763e7f63034bb26867ccefbf135ed76d3745d6e24d",
|
||||
"size": 4488
|
||||
}
|
||||
],
|
||||
"file": "plugins/plugin-xianyi-cutout.79c8c47dfc61.js",
|
||||
"size": 4488,
|
||||
"sha256": "79c8c47dfc6187b8af2688763e7f63034bb26867ccefbf135ed76d3745d6e24d",
|
||||
|
||||
@@ -1,25 +1,28 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>插件市场 · Image Workbench</title>
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.25.34-mwnbt40t">
|
||||
<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.40-mwsgavpk">
|
||||
</head><body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
|
||||
<a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>
|
||||
<div class="links">
|
||||
<a href="/">首页</a>
|
||||
<a href="/download/">下载</a>
|
||||
<a href="/plugins/" class="on">插件</a>
|
||||
<a href="/dev/">开发</a>
|
||||
<a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码</a>
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="btn" href="/plugins/">插件市场</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.25.34</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.40</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">共 8 个插件。安装方式:应用内 <b>设置 → 插件 → 浏览</b>,点「安装」后重启生效。</p>
|
||||
<p class="sub" style="margin:14px 0 0;text-align:left;max-width:720px">共 11 个插件。安装方式:应用内 <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">
|
||||
@@ -29,11 +32,14 @@
|
||||
<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>
|
||||
<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>
|
||||
<button class="tag" data-tag="抠图" style="cursor:pointer;padding:5px 12px">抠图</button>
|
||||
@@ -55,10 +61,28 @@
|
||||
</div>
|
||||
<div class="pcard" data-name="应用内浏览器 browser 库面板内置真实浏览器:书签按分组管理、拖动排序;地址栏 ↗ 可把当前页放到画布节点 浏览器 效率" data-tags="浏览器,效率">
|
||||
<div class="head"><span class="av" style="background:#eaf1fb">🌐</span>
|
||||
<div><div class="nm">应用内浏览器</div><div class="ver">v1.6.0 · 官方</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>
|
||||
<div class="pcard" data-name="图库 gallery 右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供) 资源 图库" data-tags="资源,图库">
|
||||
<div class="head"><span class="av" style="background:#eef2f6">🖼️</span>
|
||||
<div><div class="nm">图库</div><div class="ver">v1.6.9 · 官方</div></div></div>
|
||||
<div class="desc">右栏图片墙:筛选/多选/双击预览/插入画布/下载/删除(数据由客户端提供)</div>
|
||||
<div class="tags"><span class="tag">资源</span><span class="tag">图库</span></div>
|
||||
</div>
|
||||
<div class="pcard" data-name="节点组 grouplib 左栏收藏的节点组:分组/改名/删除,拖到画布实例化(数据由客户端提供) 资源 节点组" data-tags="资源,节点组">
|
||||
<div class="head"><span class="av" style="background:#eef2f6">📦</span>
|
||||
<div><div class="nm">节点组</div><div class="ver">v1.0.4 · 官方</div></div></div>
|
||||
<div class="desc">左栏收藏的节点组:分组/改名/删除,拖到画布实例化(数据由客户端提供)</div>
|
||||
<div class="tags"><span class="tag">资源</span><span class="tag">节点组</span></div>
|
||||
</div>
|
||||
<div class="pcard" data-name="提示词库 promptlib 右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供) 资源 提示词" data-tags="资源,提示词">
|
||||
<div class="head"><span class="av" style="background:#eef2f6">📖</span>
|
||||
<div><div class="nm">提示词库</div><div class="ver">v1.8.8 · 官方</div></div></div>
|
||||
<div class="desc">右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供)</div>
|
||||
<div class="tags"><span class="tag">资源</span><span class="tag">提示词</span></div>
|
||||
</div>
|
||||
<div class="pcard" data-name="标注 / 修图 image-annotate 在画布内标注、涂抹、局部重绘 修图 标注" data-tags="修图,标注">
|
||||
<div class="head"><span class="av" style="background:#fdeaea">🖌️</span>
|
||||
<div><div class="nm">标注 / 修图</div><div class="ver">v1.20.6 · 官方</div></div></div>
|
||||
@@ -73,7 +97,7 @@
|
||||
</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.2 · 官方</div></div></div>
|
||||
<div><div class="nm">风格库</div><div class="ver">v1.3.3 · 官方</div></div></div>
|
||||
<div class="desc">风格提示词库与一键套用</div>
|
||||
<div class="tags"><span class="tag">提示词</span><span class="tag">风格</span></div>
|
||||
</div>
|
||||
|
||||
@@ -1983,7 +1983,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "image-workbench"
|
||||
version = "3.25.34"
|
||||
version = "3.26.40"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"base64 0.22.1",
|
||||
@@ -2002,6 +2002,7 @@ dependencies = [
|
||||
"tauri-plugin-single-instance",
|
||||
"tauri-plugin-updater",
|
||||
"url",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "image-workbench"
|
||||
version = "3.25.34"
|
||||
version = "3.26.41"
|
||||
description = "无限画布 · 生图工作台桌面版"
|
||||
authors = ["malongan"]
|
||||
license = ""
|
||||
@@ -44,3 +44,7 @@ base64 = "0.22"
|
||||
# (Cargo.lock 里是同一个 0.6.x),这里显式依赖不会多编译一份。
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
objc2 = "0.6"
|
||||
|
||||
# Windows:直接读进程工作集(GetProcessMemoryInfo),不再启动 PowerShell 子进程
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
windows-sys = { version = "0.52", features = ["Win32_Foundation", "Win32_System_ProcessStatus", "Win32_System_Threading"] }
|
||||
@@ -149,6 +149,44 @@ fn build_tray(app: &AppHandle) -> tauri::Result<()> {
|
||||
// 把「资料目录」加进本次运行的 fs scope。
|
||||
// 为什么需要它:tauri-plugin-fs 的路径白名单是**运行时**的,重启就没了;而资料目录是用户
|
||||
// 在设置里选的、存在应用配置里 ⇒ 启动时由这里重新授权一次,之后 fs 插件的读写才允许。
|
||||
/// 当前进程的常驻内存(MB)。用于状态栏显示,方便对比性能改动前后的内存占用。
|
||||
/// macOS/Linux 用 ps 读 RSS;Windows 用 PowerShell 读 WorkingSet64(作为兜底,轮询间隔 4s 可接受)。
|
||||
#[tauri::command]
|
||||
fn app_memory_mb() -> u64 {
|
||||
let pid = std::process::id();
|
||||
#[cfg(unix)]
|
||||
{
|
||||
let out = std::process::Command::new("ps")
|
||||
.args(["-o", "rss=", "-p", &pid.to_string()])
|
||||
.output();
|
||||
if let Ok(o) = out {
|
||||
if o.status.success() {
|
||||
let txt = String::from_utf8_lossy(&o.stdout);
|
||||
if let Ok(kb) = txt.trim().parse::<u64>() {
|
||||
return kb / 1024;
|
||||
}
|
||||
}
|
||||
}
|
||||
0
|
||||
}
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use windows_sys::Win32::System::ProcessStatus::{GetProcessMemoryInfo, PROCESS_MEMORY_COUNTERS};
|
||||
use windows_sys::Win32::System::Threading::GetCurrentProcess;
|
||||
let mut pmc: PROCESS_MEMORY_COUNTERS = unsafe { std::mem::zeroed() };
|
||||
pmc.cb = std::mem::size_of::<PROCESS_MEMORY_COUNTERS>() as u32;
|
||||
let ok = unsafe { GetProcessMemoryInfo(GetCurrentProcess(), &mut pmc, pmc.cb) };
|
||||
if ok != 0 {
|
||||
return (pmc.WorkingSetSize as u64) / (1024 * 1024);
|
||||
}
|
||||
0
|
||||
}
|
||||
#[cfg(not(any(unix, windows)))]
|
||||
{
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn grant_dir(app: AppHandle, dir: String, record: Option<bool>) -> Result<String, String> {
|
||||
let p = std::path::PathBuf::from(&dir);
|
||||
@@ -199,6 +237,39 @@ fn copy_tree(src: String, dst: String) -> Result<u64, String> {
|
||||
}
|
||||
|
||||
// 打开应用数据目录(设置里的「打开数据目录」按钮用;macOS 访达 / Windows 资源管理器 / Linux xdg-open)
|
||||
#[tauri::command]
|
||||
fn open_data_subpath(app: AppHandle, rel: String) -> Result<String, String> {
|
||||
// 只允许打开「资料目录」下的子路径:rel 由宿主/插件传入,必须做规范化 + 前缀校验,
|
||||
// 否则等于给插件一个任意路径的打开权限。
|
||||
let recorded = app
|
||||
.path()
|
||||
.app_config_dir()
|
||||
.ok()
|
||||
.and_then(|c| std::fs::read_to_string(c.join("data-dir.txt")).ok())
|
||||
.map(|s| s.trim().to_string())
|
||||
.filter(|s| !s.is_empty());
|
||||
let base = match recorded {
|
||||
Some(p) => std::path::PathBuf::from(p),
|
||||
None => app.path().app_data_dir().map_err(|e| e.to_string())?,
|
||||
};
|
||||
let base = base.canonicalize().map_err(|e| e.to_string())?;
|
||||
let target = base.join(rel.trim_start_matches('/')).canonicalize().map_err(|e| e.to_string())?;
|
||||
if !target.starts_with(&base) { return Err("路径不在资料目录内".into()); }
|
||||
std::fs::create_dir_all(&target).map_err(|e| e.to_string())?;
|
||||
let path = target.to_string_lossy().to_string();
|
||||
#[cfg(target_os = "macos")]
|
||||
let cmd = "open";
|
||||
#[cfg(target_os = "windows")]
|
||||
let cmd = "explorer";
|
||||
#[cfg(target_os = "linux")]
|
||||
let cmd = "xdg-open";
|
||||
std::process::Command::new(cmd)
|
||||
.arg(&path)
|
||||
.spawn()
|
||||
.map_err(|e| e.to_string())?;
|
||||
Ok(path)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn open_app_data_dir(app: AppHandle) -> Result<String, String> {
|
||||
// 资料目录(用户选的那个)优先;没设置过才退回应用私有目录
|
||||
@@ -847,7 +918,8 @@ pub fn run() {
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_updater::Builder::new().build())
|
||||
.invoke_handler(tauri::generate_handler![open_app_data_dir, grant_dir, copy_tree, check_update, install_update, clipboard_read_image, clipboard_write_image, clipboard_write_text, clipboard_read_text, open_external_url, open_browser_window, browser_control, browser_state, canvas_webview_ensure, canvas_webview_bounds, canvas_webview_navigate, canvas_webview_action, canvas_webview_state, canvas_webview_close_all, canvas_webview_metrics, notify_desktop])
|
||||
.invoke_handler(tauri::generate_handler![open_app_data_dir, open_data_subpath, grant_dir, copy_tree, check_update, install_update, clipboard_read_image, clipboard_write_image, clipboard_write_text, clipboard_read_text, open_external_url, open_browser_window, browser_control, browser_state, canvas_webview_ensure, canvas_webview_bounds, canvas_webview_navigate, canvas_webview_action, canvas_webview_state, canvas_webview_close_all, canvas_webview_metrics, notify_desktop,
|
||||
app_memory_mb])
|
||||
.setup(|app| {
|
||||
if cfg!(debug_assertions) {
|
||||
app.handle().plugin(
|
||||
|
||||