Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
No files matched your search
+161
@@ -14,6 +14,167 @@
|
||||
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
|
||||
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
|
||||
|
||||
## 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)停靠栏“当前面板”重启后被切走
|
||||
|
||||
### 修复
|
||||
|
||||
+3
-3
@@ -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 111 个单测文件(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` → 正式站
|
||||
|
||||
@@ -2419,62 +2419,35 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
|
||||
// v3.26.0:提示词封面 —— 直接存「压缩后的 dataURL」(≤512 WebP),随 prompts.json 落盘。
|
||||
// 为什么不用引用({__blob}):封面是**跨会话必须可见**的小图,引用要依赖 IDB + 解析时序,
|
||||
// 实测会出现“编辑里能看到、列表看不到/重启后丢失”。512px WebP 约 20~60KB,几十条完全可以接受。
|
||||
async function wPromptCoverPut (dataUrl) {
|
||||
try {
|
||||
const src = String(dataUrl || '')
|
||||
if (src.indexOf('data:') !== 0) return { ok: false, error: '封面上传失败' }
|
||||
const enc = (fmt, q) => new Promise((resolve) => {
|
||||
try {
|
||||
compressDataUrl(src, { enabled: true, force: true, maxMB: 0, maxEdge: 448, quality: q, format: fmt }, (o) => resolve(o || ''))
|
||||
} catch (e) { resolve('') }
|
||||
})
|
||||
// v3.26.21:优先 WebP;编码器不可用时 compressDataUrl 会退回 PNG,
|
||||
// 448px 照片的 PNG 仍有 300KB+(实测 3 张共 1.1MB)→ 再兜一次 JPEG。
|
||||
let final = await enc('webp', 0.8)
|
||||
if (!final) final = await enc('jpeg', 0.82)
|
||||
if (!final) final = src
|
||||
if (final.indexOf('data:image/webp') !== 0 && final.indexOf('data:image/jpeg') !== 0) {
|
||||
const j = await enc('jpeg', 0.82)
|
||||
if (j && j.length < final.length) final = j
|
||||
}
|
||||
if (String(final).indexOf('data:') !== 0) return { ok: false, error: '封面上传失败' }
|
||||
return { ok: true, ref: final }
|
||||
} catch (e) { return { ok: false, error: '封面上传失败' } }
|
||||
// v3.26.34:封面编码/解析抽到 src/image-prompt-cover.js(app.js 让出行数给功能)
|
||||
let wCoverCtl = null
|
||||
function wPromptCoverCtl () {
|
||||
if (wCoverCtl) return wCoverCtl
|
||||
const M = (typeof window !== 'undefined') ? window.IWBPromptCover : null
|
||||
if (!M) return null
|
||||
wCoverCtl = M.create({
|
||||
compress: (src, conf) => new Promise((resolve) => {
|
||||
try { compressDataUrl(src, conf, (o) => resolve(o || '')) } catch (e) { resolve('') }
|
||||
}),
|
||||
resolve: (ref) => wResolveImgAsync(ref),
|
||||
})
|
||||
return wCoverCtl
|
||||
}
|
||||
// v3.26.1:把提示词封面插入画布 —— 返回 { ok, error }
|
||||
// v3.26.2:封面比例不定 —— 按原图长宽比给节点宽度,避免统一 264 宽把长图/宽图都压成一条
|
||||
function wDataUrlAspect (dataUrl) {
|
||||
return new Promise((resolve) => {
|
||||
try {
|
||||
const img = new Image()
|
||||
img.onload = () => resolve((img.naturalWidth || 1) / (img.naturalHeight || 1) || 1)
|
||||
img.onerror = () => resolve(1)
|
||||
img.src = String(dataUrl || '')
|
||||
} catch (e) { resolve(1) }
|
||||
})
|
||||
}
|
||||
function wNodeWidthForAspect (ratio) {
|
||||
const r = Number(ratio) || 1
|
||||
if (r >= 2) return 420
|
||||
if (r >= 1.5) return 340
|
||||
if (r <= 0.5) return 200
|
||||
if (r <= 0.75) return 230
|
||||
return 280
|
||||
}
|
||||
async function wPromptInsertImage (host, cover, name) {
|
||||
try {
|
||||
let data = cover
|
||||
let ratio = 1
|
||||
if (typeof cover === 'string' && cover.indexOf('data:') === 0) {
|
||||
ratio = await wDataUrlAspect(cover)
|
||||
ratio = await (window.IWBPromptCover ? window.IWBPromptCover.dataUrlAspect(cover) : Promise.resolve(1))
|
||||
const ref = await wImgRefWrite(cover)
|
||||
if (ref) data = ref
|
||||
} else if (cover && typeof cover === 'object') {
|
||||
const url = await wResolveImgAsync(cover)
|
||||
if (url) ratio = await wDataUrlAspect(url)
|
||||
if (url) ratio = await (window.IWBPromptCover ? window.IWBPromptCover.dataUrlAspect(url) : Promise.resolve(1))
|
||||
}
|
||||
if (!data) return { ok: false, error: '这条提示词没有封面' }
|
||||
host.insertRefNode(data, name || '封面图片', wNodeWidthForAspect(ratio))
|
||||
host.insertRefNode(data, name || '封面图片', window.IWBPromptCover ? window.IWBPromptCover.nodeWidthForAspect(ratio) : 280)
|
||||
return { ok: true }
|
||||
} catch (e) { return { ok: false, error: '插入封面失败' } }
|
||||
}
|
||||
@@ -4792,7 +4765,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
// 只对**本地已有数据**(base64/dataURL)生成小图(同源,无 CORS 风险);远程 URL 原样返回
|
||||
// (跨域图无法安全缩放,浏览器也会因 canvas 污染拒绝 toDataURL)。
|
||||
// 首帧仍用原图(不会闪空图),小图就绪后由 wThumbBump 触发一次 re-render 换成小图。
|
||||
const DISPLAY_THUMB_MAX = 768
|
||||
const DISPLAY_THUMB_MAX = 640 // v3.26.34:768→640(见 image-display-thumb.js 注释)
|
||||
const DISPLAY_THUMB_CACHE_MAX = 300
|
||||
const displayThumbs = new Map()
|
||||
const displayThumbPending = new Set()
|
||||
@@ -5658,6 +5631,12 @@ const tbCenterSeed = (type, refs) => {
|
||||
return String(pr.name || pr.id || '') + ' · ' + (k ? String(k.name || k.id) : '无分组')
|
||||
} catch (e) { return '' }
|
||||
}
|
||||
// 覆盖式替换图片前备份原图:优先保留已有 orig,其次 data,最后 url。返回 updateNode patch。
|
||||
function origImagePatch(prev, dataUrl) {
|
||||
const orig = (prev && prev.orig) || (prev && typeof prev.data === 'string' && /^data:/i.test(prev.data) ? prev.data : '') || (prev && typeof prev.url === 'string' ? prev.url : '')
|
||||
return orig ? { data: String(dataUrl), url: '', orig } : { data: String(dataUrl), url: '' }
|
||||
}
|
||||
|
||||
function Workbench() {
|
||||
// runtime-workbench-logic 模块的 app.js 模块级依赖:渲染前注入一次(常量/纯函数,无陈旧值风险)
|
||||
if (IWWorkbenchLogic && !IWWorkbenchLogic.__iwbInjected) {
|
||||
@@ -5816,9 +5795,8 @@ const tbCenterSeed = (type, refs) => {
|
||||
},
|
||||
setNodeImage: (id, dataUrl) => {
|
||||
if (!/^data:/i.test(String(dataUrl || ''))) return false
|
||||
if (!refs.nodes.some((x) => x.id === id)) return false
|
||||
updateNode(id, { data: String(dataUrl), url: '' })
|
||||
return true
|
||||
const t = refs.nodes.find((x) => x.id === id); if (!t) return false
|
||||
updateNode(id, origImagePatch(t.data || {}, String(dataUrl))); return true
|
||||
},
|
||||
}
|
||||
return () => { wPluginCanvasBridge = null }
|
||||
@@ -8238,7 +8216,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
},
|
||||
insert: (text, name) => {
|
||||
const id = uid('n')
|
||||
const spot = findSpot('prompt')
|
||||
const spot = CanvasGeometry.promptCenterSpot(wPluginCanvasBridge, 280, 120) || findSpot('prompt')
|
||||
commitCanvas(refs.nodes.concat([{ id, type: 'prompt', x: spot.x, y: spot.y, data: { text: text || '', title: name || '' } }]), undefined, undefined)
|
||||
setSel([id])
|
||||
setNotice({ type: 'ok', text: '已插入提示词:' + (name || '') })
|
||||
@@ -8248,7 +8226,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
insertImage: (cover, name) => wPromptInsertImage({
|
||||
insertRefNode: (data, nm, w) => {
|
||||
const id = uid('n')
|
||||
const spot = findSpot('ref')
|
||||
const spot = CanvasGeometry.promptCenterSpot(wPluginCanvasBridge, w || 280, 180) || findSpot('ref')
|
||||
commitCanvas(refs.nodes.concat([{ id, type: 'ref', x: spot.x, y: spot.y, w: w || 280, data: { data: data, name: nm } }]), undefined, undefined)
|
||||
setSel([id])
|
||||
setNotice({ type: 'ok', text: '已插入封面图片' })
|
||||
@@ -8264,8 +8242,8 @@ const tbCenterSeed = (type, refs) => {
|
||||
},
|
||||
notify: (text, type) => { setNotice({ type: type === 'err' ? 'err' : 'ok', text: String(text || '') }); showToast(String(text || ''), type) },
|
||||
// v3.25.97:提示词封面 —— 图片走宿主内容寻址存储(images/plugin/prompt/),条目只存 ref。
|
||||
putCover: (u) => wPromptCoverPut(u),
|
||||
coverUrl: (r) => wPromptCoverUrl(r),
|
||||
putCover: (u) => wPromptCoverCtl().put(u),
|
||||
coverUrl: (r) => wPromptCoverCtl().url(r),
|
||||
removeCover: () => ({ ok: true }),
|
||||
})
|
||||
}
|
||||
@@ -8689,6 +8667,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
const items = []
|
||||
if (isImageProducer(tgt)) items.push(el('button', { key: 'run', className: 'iwb-ctx-item', onClick: () => { runProducer(tgt.id); setCtxMenu(null) } }, I('run'), el('span', { className: 'iwb-btn-text' }, tgt.type === 'layer' ? '运行该分层' : '运行该生图')))
|
||||
if (tgt.type === 'llm') items.push(el('button', { key: 'pol', className: 'iwb-ctx-item', onClick: () => { runLLM(tgt.id); setCtxMenu(null) } }, I('llm'), el('span', { className: 'iwb-btn-text' }, '▶ 润色')))
|
||||
if (tgt.type === 'ref' && tgt.data && typeof tgt.data.orig === 'string' && tgt.data.orig) items.push(el('button', { key: 'restore-orig', className: 'iwb-ctx-item', onClick: () => { pushHistory(); updateNode(tgt.id, { data: tgt.data.orig, url: '', orig: '' }); setCtxMenu(null) } }, I('undo'), el('span', { className: 'iwb-btn-text' }, '还原替换前原图')))
|
||||
if (tgt.type === 'prompt' && (tgt.data.text || '').trim()) items.push(el('button', { key: 'fav', className: 'iwb-ctx-item', onClick: () => { addPromptToLibrary(tgt.id); setCtxMenu(null) } }, I('star'), el('span', { className: 'iwb-btn-text' }, '添加该提示词')))
|
||||
items.push(el('button', { key: 'bgc', className: 'iwb-ctx-item', onClick: (e) => { const rc = e && e.currentTarget ? e.currentTarget.getBoundingClientRect() : null; setCtxMenu(null); if (UiGenCfgModule && UiGenCfgModule.openNodeBgPalette) UiGenCfgModule.openNodeBgPalette({ current: (tgt.data && tgt.data.bg) || '', anchorRect: rc, onPreview: (bg) => previewNodeBg([tgt.id], bg), onPreviewEnd: endNodeBgPreview, onPick: (bg) => updateNode(tgt.id, { bg }) }) } }, I('palette'), el('span', { className: 'iwb-btn-text' }, '背景色')), el('button', { key: 'ren', className: 'iwb-ctx-item', onClick: () => { setCtxMenu(null); wRenameNodeDialog(tgt, td, updateNode) } }, I('edit'), el('span', { className: 'iwb-btn-text' }, '重命名节点')), el('button', { key: 'del', className: 'iwb-ctx-item iwb-ctx-danger', onClick: () => { deleteNodes([tgt.id]); setCtxMenu(null) } }, I('x'), el('span', { className: 'iwb-btn-text' }, '删除该节点')))
|
||||
// 子菜单默认向上展开(底对齐入口):两组入口都在一级菜单下半区,向下会顶出视口
|
||||
@@ -8894,6 +8873,19 @@ items.push(el('button', { key: 'bgc', className: 'iwb-ctx-item', onClick: (e) =>
|
||||
gallery: () => ((typeof window !== 'undefined' && window.IWBPluginGallery) ? window.IWBPluginGallery.api() : {}),
|
||||
grouplib: () => ((typeof window !== 'undefined' && window.IWBPluginGroupLib) ? window.IWBPluginGroupLib.api() : {}),
|
||||
promptlib: () => ((typeof window !== 'undefined' && window.IWBPluginPromptLib) ? window.IWBPluginPromptLib.api() : {}),
|
||||
// 插件文件能力(v3.26.36):沙箱目录 plugin-data/<id>/files,供插件自持图片
|
||||
files: (ctx) => {
|
||||
const F = (typeof window !== 'undefined' && window.IWBStorageFile) ? window.IWBStorageFile.pluginFiles : null
|
||||
const need = () => { if (!F) throw new Error('文件能力未就绪(资料目录尚未初始化)'); return F }
|
||||
return {
|
||||
put: (name, dataUrl) => need().put(ctx.id, name, dataUrl),
|
||||
get: (name) => need().get(ctx.id, name),
|
||||
list: () => need().list(ctx.id),
|
||||
remove: (name) => need().remove(ctx.id, name),
|
||||
stat: () => need().stat(ctx.id),
|
||||
dir: () => need().dir(ctx.id),
|
||||
}
|
||||
},
|
||||
commands: (ctx) => {
|
||||
const owned = []
|
||||
return {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# 现状架构与性能事实基线(image-workbench-web)
|
||||
|
||||
> **本文档是什么**:现状**事实快照**,不是规范。用途:任何性能 / 内存 / 存储相关改动,先对齐这里的现实,避免把已经调好的东西改坏。
|
||||
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = dd498a1`(线上 `v3.26.23+dd498a1` —— **未上线**(本地测试中):左右停靠栏配色对齐主色调(新增 `--iwb-dock-bg` 进灰阶 ramp + 头部深一档 + `.iwb-pcard` 补白底)+ 修 `Cargo.toml`/`Cargo.lock` 版本漂移,四处统一到 3.25.58)。上一条 3.25.30:线上实际运行提交是 docs 提交 `7df9dc4`,bump 提交为 `4be78c0`;2026-11-16 已发**测试站 + 正式站**,三地址一致 + `IWB_VERIFY_STRICT=1` 通过。v3.24.85 是「代码体检收口」(棘轮收回 Workbench 3090→2998 + 图库索引 4 条绕过锁的写路径收口到 `mutate` + 文档数字校准),`stable` / `stable-v3.24.85` / `stable-verified-2026-11-16` 均指向 `7df9dc4`。上一条 —— 2026-11-14 发**测试站 + 正式站** `https://test.image-workbench-web.pages.dev`:**v3.24.84 修「生图节点连了 3 条上游只出 1 个任务」**(任务 id 与去重基准改用新字段 `ownerNodeId`=本节点自己,不再用随继承冒泡的 `sourceNodeId` ⇒ 连几条线就几个任务;`relay` 仍归约到真实文本来源,同一来源多路径抵达只算一次)。上一条 v3.24.83:**修「插件节点冷启动退化成一段文本」**(插件节点体是异步注册的,`registerNodeType` 在 `render` 由无变有时自增 `NODE_TYPES_REV`,`NodeCard` 比它 ⇒ 注册那一刻重建一次;`canvas-normalize` 按命名规则把 `plugin:<id>:<variant>` 认作已知类型,不再降级成 `plugin` 并写回存档);配套插件 `style-source` 1.3.2 把节点体样式改为**脚本执行时注入**(此前只在面板 `mount()` 注入 ⇒ 从存档直接进画布时节点无样式、缩略图按原图铺满)。上一条 v3.24.82 同批:提示词/文本节点**显示上游继承文本**(自己 `data.text` 为空时把上游那段话显示在框里,改一个字即接管,另有「恢复跟随」清空回跟随;多路上游按 Y 轴取第一条)+ 修 `nodeRefsOf` 的 textout 分支只认 llm/batch/combine 上游导致「样式 → 文本 → 分层」丢参考图;再上一条 v3.24.81:① 插件节点可自定义节点体(`render(node, props, host)` 画真实 DOM,宿主不每帧重建 ⇒ 输入框不失焦);② 节点自带参考图(`data.refOn/refUrl` ⇒ 任务图里补伪参考图,坐标取节点自身 ⇒ 仍参与「图片按 X 轴排序」);③ 连线白名单按 `data.outKind === 'prompt'` 归一化,7 条规则一次放行,内置节点行为逐字不变。上一条 v3.24.80 = 离开页面的兜底保存不递增 rev(2026-11-14 07:20 补发 —— 首发 11-13 23:25 撞 Cloudflare Workers API 事故 `503 no healthy upstream`,期间正式站保持在 `v3.24.79+8598a57` 未动)。v3.24.83 的 bump 提交即 `0a27a42`(v3.24.82 为 `ef6cf42`、v3.24.81 为 `dba71e3`);主干 HEAD 会继续前进,见 [`RELEASES.md`](../RELEASES.md))| 历史分支 `refactor/architecture` / `feat/multi-canvas-tabs` / `refactor/state-store` 已于 2026-10-20 清理(内容均已并入 main,归档标签 `archive/*`),本文**计数类事实**已按 main HEAD 复算。
|
||||
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = d9e3d84`(线上 `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`(现 **104** 个模块 / 14,607 行,`sourceModules` 104 项;v3.24.68 新增 `clipboard-graph.js`,v3.24.74 新增 `image-admit.js`,v3.24.75 新增 `image-dedupe.js`,v3.24.76 新增 `workspace-purge.js`,v3.24.79 新增 `generation-provider-ping.js`,v3.24.80 删除无调用的 `createWBFlushViewport` 17 行)。
|
||||
- `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. 门禁与环境现状
|
||||
@@ -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` 不引用模块全局)。**104 个模块中 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 耦合面(**85** 项)与 `sourceModules` 顺序(**104** 项);命名例外由第 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 耦合面」(**85** 项)与 `sourceModules` 顺序(**104** 项);新增模块、新增耦合、新增 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 → 只能中继,无法直连生图。
|
||||
@@ -122,3 +122,30 @@ PY
|
||||
|
||||
> 插件样式出问题,先分清「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'`;新增语义(如图片、分组)需先在宿主补规则并写测试。
|
||||
- 声明缺失时行为保持旧状(只能中继),不会破坏已有画布。
|
||||
@@ -58,3 +58,11 @@
|
||||
|
||||
- 先判断「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 细节。
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "image-workbench-web",
|
||||
"private": true,
|
||||
"version": "3.26.23",
|
||||
"version": "3.26.40",
|
||||
"description": "Browser-based node canvas image workbench",
|
||||
"scripts": {
|
||||
"build": "node scripts/build.js && node scripts/copy-plugins.js",
|
||||
@@ -10,7 +10,7 @@
|
||||
"app:build": "tauri build",
|
||||
"lint": "eslint src app.js",
|
||||
"test": "node tests/relay-task-graph-fixture-test.js && node tests/plugin-style-node-test.js && node tests/inherit-text-test.js",
|
||||
"test:unit": "node tests/unit-test.js && node tests/canvas-actions-test.js && node tests/canvas-performance-test.js && node tests/canvas-drag-performance-test.js && node tests/resize-observer-performance-test.js && node tests/node-drag-jank-test.js && node tests/edge-graph-performance-test.js && node tests/persistence-export-images-test.js && node tests/settings-hotkeys-size-presets-test.js && node tests/custom-size-validation-test.js && node tests/image-node-performance-test.js && node tests/drag-frame-performance-test.js && node tests/canvas-edge-memo-test.js && node tests/canvas-node-transform-test.js && node tests/canvas-dot-zoom-test.js && node tests/duplicate-ws-fresh-source-test.js && node tests/single-canvas-shell-test.js && node tests/navigation-layout-test.js && node tests/home-canvas-library-test.js && node tests/left-resource-layout-test.js && node tests/interface-hierarchy-test.js && node tests/three-page-layout-test.js && node tests/page-chrome-regression-test.js && node tests/task-cache-test.js && node tests/storage-config-shape-test.js && node tests/storage-zip-test.js && node tests/canvas-node-factory-test.js && node tests/runtime-error-test.js && node tests/runtime-lifecycle-test.js && node tests/runtime-fetch-test.js && node tests/runtime-channel-test.js && node tests/runtime-boundary-test.js && node tests/runtime-record-test.js && node tests/runtime-recovery-test.js && node tests/runtime-diagnostic-record-test.js && node tests/runtime-metrics-test.js && node tests/runtime-run-context-test.js && node tests/runtime-execution-context-test.js && node tests/storage-gc-canvas-refs-test.js && node tests/storage-health-test.js && node tests/generation-state-test.js && node tests/canvas-store-test.js && node tests/storage-result-test.js && node tests/storage-local-test.js && node tests/storage-domain-test.js && node tests/storage-runtime-test.js && node tests/storage-indexeddb-test.js && node tests/generation-scheduler-test.js && node tests/gallery-query-test.js && node tests/gallery-hydration-test.js && node tests/image-blob-store-test.js && node tests/image-preview-derive-test.js && node tests/image-format-test.js && node tests/clipboard-graph-test.js && node tests/clipboard-graph-fallback-test.js && node tests/image-admit-test.js && node tests/image-dedupe-test.js && node tests/clipboard-kind-test.js && node tests/clipboard-paste-test.js && node tests/clipboard-copy-test.js && node tests/paste-once-test.js && node tests/list-e2e-specs-test.js && node tests/desktop-csp-loopback-test.js && node tests/architecture-boundary-guard-test.js && node tests/plugin-host-test.js && node tests/plugin-data-test.js && node tests/plugin-loader-test.js && node tests/plugin-bundle-test.js && node tests/plugin-install-test.js && node tests/plugin-gallery-render-test.js && node tests/plugin-gallery-recovery-test.js && node tests/plugin-gallery-ux-test.js && node tests/plugin-grouplib-render-test.js && node tests/plugin-promptlib-render-test.js && node tests/image-compress-test.js && node tests/storage-fallback-indexeddb-test.js && node tests/canvas-normalize-test.js && node tests/canvas-geometry-test.js && node tests/canvas-history-test.js && node tests/canvas-ops-test.js && node tests/canvas-text-test.js && node tests/history-store-test.js && node tests/plugin-integrity-test.js && node tests/workspace-sessions-store-test.js && node tests/workspace-list-test.js && node tests/workspace-purge-test.js && node tests/provider-ping-test.js && node tests/runtime-diagnostics-hotpath-test.js && node tests/storage-log-failure-test.js && node tests/storage-convergence-test.js && node tests/swallow-wiring-test.js && node tests/workbench-logic-test.js && node tests/storage-autobackup-test.js && node tests/storage-outputs-mutate-test.js && node tests/sync-facts-guard-test.js && node tests/e2e-fixed-waits-ratchet-test.js && node tests/shell-render-behavior-test.js && node tests/canvas-meta-notice-behavior-test.js && node tests/source-text-ratchet-test.js && node tests/plugin-theme-contract-test.js && node tests/prompt-md-roundtrip-test.js && node tests/generation-results-store-test.js && node tests/out-groups-order-test.js && node tests/ui-dock-sanitize-test.js && node tests/ui-minimap-fit-test.js && node tests/ui-workbench-hooks-test.js",
|
||||
"test:unit": "node tests/plugin-archive-test.js && node tests/plugin-files-policy-test.js && node tests/theme-plugin-tokens-test.js && node tests/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",
|
||||
|
||||
+6
-6
@@ -44,10 +44,10 @@
|
||||
"dir": "promptlib",
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
"version": "1.4.10",
|
||||
"version": "1.8.8",
|
||||
"files": {
|
||||
"main.js": "75dc31dc6270aa10e73c90eeb09bb349a949d17c39940574e28f12c5e463ceaf",
|
||||
"styles.css": "cc71e071379c84131e525afeaa5757674f499da195ccb42536c019a3ef5d8473"
|
||||
"main.js": "91fde4bcfa888b04ee2b0e79a05d951a56247bc76ecd11b5d9500131df11d542",
|
||||
"styles.css": "70cc02f98bed580f70ef9c71009dde29e01a92684c28d69016438d49c1e0a95b"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -64,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",
|
||||
|
||||
+1289
-81
File diff suppressed because it is too large.
Load diff
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "promptlib",
|
||||
"name": "提示词库",
|
||||
"version": "1.4.10",
|
||||
"version": "1.8.8",
|
||||
"apiVersion": 1,
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
@@ -13,7 +13,7 @@
|
||||
"提示词"
|
||||
],
|
||||
"files": {
|
||||
"main.js": "75dc31dc6270aa10e73c90eeb09bb349a949d17c39940574e28f12c5e463ceaf",
|
||||
"styles.css": "cc71e071379c84131e525afeaa5757674f499da195ccb42536c019a3ef5d8473"
|
||||
"main.js": "91fde4bcfa888b04ee2b0e79a05d951a56247bc76ecd11b5d9500131df11d542",
|
||||
"styles.css": "70cc02f98bed580f70ef9c71009dde29e01a92684c28d69016438d49c1e0a95b"
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@
|
||||
.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: #fff; font-size: 10.5px; line-height: 1.35; max-height: 48%;
|
||||
color: var(--iwb-text, #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);
|
||||
}
|
||||
@@ -137,3 +137,418 @@
|
||||
.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(--iwb-plugin-border, #9aa3ad);border-radius:10px;background:rgba(122,130,142,.10);box-shadow:none};
|
||||
.iwb-plp-placebox-t{font-size: 11px;color:var(--iwb-plugin-border, #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(--iwb-plugin-surface, #fff);color:var(--iwb-text, #9aa1ac);font-size:11px;line-height:22px;text-align:center}
|
||||
.iwb-plp-vi.is-open{background: var(--iwb-plugin-border, #f1ecff);border-color:var(--iwb-plugin-border, #d8cbff);color:var(--iwb-plugin-border, #5a3fd0)};
|
||||
.iwb-plp-vdesc{width: 100%;height:28px;margin-top:5px;border-style:dashed;background:var(--iwb-plugin-border, #fbfcfd);font-size:11.5px;color:var(--iwb-plugin-border, #6b7280)};
|
||||
.iwb-plp-dcov{flex:0 0 auto;width:180px;height:180px;border-radius:12px;overflow:hidden}
|
||||
.iwb-plp-dvar{background: var(--iwb-plugin-border, #f1ecff);color:var(--iwb-plugin-border, #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(--iwb-plugin-border, #f4f5f7)};
|
||||
.iwb-plp-dialog .iwb-plp-eleft{flex: 0 0 236px;width:236px;background:var(--iwb-plugin-border, #fff);border:1px solid var(--iwb-plugin-border, #e6e8ec);border-radius:12px;padding:12px};
|
||||
.iwb-plp-dialog .iwb-plp-emid{background: var(--iwb-plugin-border, #fff);border:1px solid var(--iwb-plugin-border, #e6e8ec);border-radius:12px;padding:10px 12px 12px};
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-etext{border: 1px solid var(--iwb-plugin-border, #eef0f3);background:var(--iwb-plugin-border, #fbfcfd);border-radius:9px;padding:10px 12px};
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-etext: focus{background:var(--iwb-plugin-border, #fff);border-color:var(--iwb-plugin-border, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)};
|
||||
.iwb-plp-dialog .iwb-plp-esplit{flex:0 0 6px;background:transparent;border-radius:4px}
|
||||
.iwb-plp-dialog .iwb-plp-esplit: hover{background:var(--iwb-plugin-border, #e7e9ee)};
|
||||
.iwb-plp-dialog .iwb-plp-esplit: :before{content:'';display:block;width:2px;height:30px;border-radius:2px;background:var(--iwb-plugin-border, #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(--iwb-plugin-border, #fbfcfd);border:1px solid var(--iwb-plugin-border, #eceef2);border-radius:8px;height:32px;padding:0 10px;font-size:12.5px;color:var(--iwb-plugin-border, #33383f)};
|
||||
.iwb-plp-dialog .iwb-plp-vname: focus{background:var(--iwb-plugin-border, #fff);border-color:var(--iwb-plugin-border, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)};
|
||||
.iwb-plp-dialog .iwb-plp-vi{background: transparent;border:0;color:var(--iwb-plugin-border, #aab0ba);width:22px;height:22px;line-height:20px};
|
||||
.iwb-plp-dialog .iwb-plp-vi: hover{background:var(--iwb-plugin-border, #eef0f4);color:var(--iwb-plugin-border, #6b7280)};
|
||||
.iwb-plp-dialog .iwb-plp-vi.is-open{background: var(--iwb-plugin-border, #f1ecff);color:var(--iwb-plugin-border, #5a3fd0)};
|
||||
.iwb-plp-dialog .iwb-plp-vdesc{background: var(--iwb-plugin-border, #fbfcfd);border:1px dashed var(--iwb-plugin-border, #e2e6ec);border-radius:7px;height:28px;margin-top:4px};
|
||||
.iwb-plp-dialog .iwb-plp-lrow span{color: var(--iwb-plugin-border, #8a919c);font-size:11.5px};
|
||||
.iwb-plp-dialog .iwb-plp-lrow .iwb-input{background: var(--iwb-plugin-border, #fbfcfd);border:1px solid var(--iwb-plugin-border, #eceef2);border-radius:8px;height:32px};
|
||||
.iwb-plp-dialog .iwb-plp-lrow .iwb-input: focus{background:var(--iwb-plugin-border, #fff);border-color:var(--iwb-plugin-border, #cfc3ff)};
|
||||
/* v1.7.2:正文变量高亮(黑粗)+ 说明灰按钮 + 说明背景回归面板底 */
|
||||
.iwb-plp-ewrap{position: relative;flex:1 1 auto;min-height:0;display:flex;border-radius:9px;background:var(--iwb-plugin-border, #fbfcfd);border:1px solid var(--iwb-plugin-border, #eef0f3)};
|
||||
.iwb-plp-ewrap: focus-within{background:var(--iwb-plugin-border, #fff);border-color:var(--iwb-plugin-border, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)};
|
||||
.iwb-plp-ewrap .iwb-plp-etext{flex: 1 1 auto;min-height:0;border:0;background:transparent;box-shadow:none;color:transparent;caret-color:var(--iwb-plugin-border, #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(--iwb-plugin-border, #5b6472);pointer-events:none;z-index:0};
|
||||
.iwb-plp-hlvar{color: var(--iwb-plugin-border, #1d2129);font-weight:600};
|
||||
.iwb-plp-dialog .iwb-plp-vi.is-open{background: var(--iwb-plugin-border, #eef0f3);color:var(--iwb-plugin-border, #5b6472)};
|
||||
.iwb-plp-dialog .iwb-plp-vdesc{background: transparent;border:1px dashed var(--iwb-plugin-border, #dfe3e9)};
|
||||
.iwb-plp-dvar{background: transparent;color:var(--iwb-plugin-border, #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(--iwb-plugin-border, #e7e9ee)};
|
||||
/* 正文可见性:textarea 透明,显示下方高亮层 */
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap{flex: 1 1 auto;min-height:0;position:relative;display:flex;background:var(--iwb-plugin-border, #fbfcfd);border:1px solid var(--iwb-plugin-border, #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(--iwb-plugin-border, #1d2129)!important;background:var(--iwb-plugin-border, #fff)!important;border-color:var(--iwb-plugin-border, #e2e6ec)!important};
|
||||
.iwb-plp-insvar: hover{background:var(--iwb-plugin-border, #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(--iwb-plugin-border, #eef0f4);color:var(--iwb-plugin-border, #5b6472);border-radius:999px;padding:2px 9px};
|
||||
.iwb-plp-dtag{font-size: 11.5px;background:var(--iwb-plugin-border, #f4f0ff);color:var(--iwb-plugin-border, #5a3fd0);border-radius:999px;padding:2px 9px};
|
||||
.iwb-plp-dlen{font-size: 11.5px;color:var(--iwb-plugin-border, #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(--iwb-plugin-border, #eef0f4);border-radius:999px;padding:2px 8px;color:var(--iwb-plugin-border, #3f4450)};
|
||||
.iwb-plp-tagx{cursor: pointer;color:var(--iwb-plugin-border, #9aa1ac);font-style:normal};
|
||||
.iwb-plp-tagx: hover{color:var(--iwb-plugin-border, #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(--iwb-plugin-border, #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(--iwb-plugin-border, #3f4450);background:var(--iwb-plugin-border, #f2f4f7);border-radius:6px;padding:2px 9px};
|
||||
.iwb-plp-dtag{font-size: 11.5px;color:var(--iwb-plugin-border, #5a3fd0);background:var(--iwb-plugin-border, #f4f0ff);border-radius:6px;padding:2px 9px};
|
||||
.iwb-plp-dempty{font-size: 12px;color:var(--iwb-plugin-border, #b3b9c2)};
|
||||
.iwb-plp-dlen{font-size: 12px;color:var(--iwb-plugin-border, #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(--iwb-plugin-border, #f2f4f7);border:1px solid var(--iwb-plugin-border, #e2e6ec);color:var(--iwb-plugin-border, #5b6472);font-size:16px;line-height:1;display:inline-flex;align-items:center;justify-content:center};
|
||||
.iwb-plp-tagadd: hover{background:var(--iwb-plugin-border, #e9ecf1)};
|
||||
/* v1.8.2:详情左右两栏卡片化 + 分割线 */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{gap: 14px;padding:16px;background:var(--iwb-plugin-border, #f4f5f7)};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dleftcol{flex: 0 0 300px;width:300px;padding:12px;border:1px solid var(--iwb-plugin-border, #e8eaee);border-radius:14px;background:var(--iwb-plugin-border, #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(--iwb-plugin-border, #eef0f3);gap:8px};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dright{flex: 1 1 auto;min-width:0;min-height:0;display:flex;flex-direction:column;padding:14px 16px;border:1px solid var(--iwb-plugin-border, #e8eaee);border-radius:14px;background:var(--iwb-plugin-border, #fff);overflow:hidden};
|
||||
.iwb-plp-dsec{font-size: 11.5px;font-weight:600;color:var(--iwb-plugin-border, #8a919c);letter-spacing:.04em;padding-bottom:8px;margin-bottom:8px;border-bottom:1px solid var(--iwb-plugin-border, #eef0f3);flex:0 0 auto};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtext{flex: 1 1 auto;min-height:0;overflow:auto;padding-right:10px;font-size:13.5px;line-height:2;color:var(--iwb-plugin-border, #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(--iwb-plugin-border, #f4f5f7)};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dleftcol{align-self: stretch;display:flex;flex-direction:column;overflow:auto;padding:12px;border:1px solid var(--iwb-plugin-border, #e8eaee);border-radius:14px;background:var(--iwb-plugin-border, #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(--iwb-plugin-border, #e8eaee);border-radius:14px;background:var(--iwb-plugin-border, #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(--iwb-plugin-border, #eef0f3);gap:10px};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmrow{gap:6px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmk{flex: 0 0 auto;width:auto;font-size:12px;line-height:1.6;color:var(--iwb-plugin-border, #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(--iwb-plugin-border, #2f3540)};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtag{color: var(--iwb-plugin-border, #5a3fd0);};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dlen{font-size: 12.5px;line-height:1.6;color:var(--iwb-plugin-border, #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(--iwb-plugin-border, #f3f5f8)};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmrow:last-child{border-bottom:0}
|
||||
.iwb-plp-dialog .iwb-plp-dcov,.iwb-plp-dialog .iwb-plp-ecov{background: var(--iwb-plugin-border, #fcfcfd)!important};
|
||||
.iwb-plp-dialog .iwb-plp-dcov .iwb-plp-cover,.iwb-plp-dialog .iwb-plp-ecov .iwb-plp-cover{background:transparent!important}
|
||||
+4
-4
@@ -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',
|
||||
@@ -131,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 中**未被上面显式登记**的,按文件名排序追加到末尾。
|
||||
|
||||
@@ -90,6 +90,7 @@ const html = `<!doctype html>
|
||||
<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">
|
||||
|
||||
@@ -28,6 +28,7 @@ const nav = (active) => [
|
||||
' <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 + ')')
|
||||
@@ -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 + ')')
|
||||
@@ -19,6 +19,11 @@ const IDS = ['batch-export', 'blank-canvas', 'browser', 'gallery', 'grouplib', '
|
||||
// 若不同步成目录,插件自带样式会被静默忽略(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')
|
||||
const sri = (buf) => 'sha256-' + sha(buf).toString('base64')
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<!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">
|
||||
<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>
|
||||
@@ -0,0 +1,194 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>插件开发规范 · Image Workbench</title>
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.40-mws31ebx">
|
||||
<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="/"><span class="dot">IW</span>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>
|
||||
@@ -39,6 +39,7 @@
|
||||
<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,13 +55,13 @@
|
||||
<h2>下载</h2>
|
||||
<div class="row">
|
||||
<div class="name">macOS · Apple Silicon<div class="hint">M1 / M2 / M3 / M4</div></div>
|
||||
<div class="meta">版本 3.26.23 · 8.4 MB · .dmg<div class="hash">sha256 beb45e0df21d1449…</div></div>
|
||||
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.26.23_aarch64.dmg?h=beb45e0df21d">下载</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.26.23 · 8.8 MB · .dmg<div class="hash">sha256 2a83fbad20717ba7…</div></div>
|
||||
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.26.23_x64.dmg?h=2a83fbad2071">下载</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>
|
||||
@@ -94,6 +95,70 @@
|
||||
</ol>
|
||||
|
||||
<h2>历史版本</h2>
|
||||
<div class="row">
|
||||
<div class="name">3.26.40<div class="hint">Intel 版:同一版本</div></div>
|
||||
<div class="meta">2026-11-23<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.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>
|
||||
@@ -424,7 +489,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-21
|
||||
本页由 <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>
|
||||
|
||||
|
||||
+9
-8
@@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Image Workbench · 本地优先的 AI 生图工作台</title>
|
||||
<meta name="description" content="本地优先的 AI 生图无限画布:节点式工作流、插件按需安装、数据全部留在本机。">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.23-mwqmiapo">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.40-mws31ebx">
|
||||
</head><body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
|
||||
@@ -10,23 +10,24 @@
|
||||
<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.26.23</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.26.23-mwqmiapo" alt=""></div>
|
||||
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.26.40-mws31ebx" alt=""></div>
|
||||
<div class="hero-veil"></div>
|
||||
<div class="wrap">
|
||||
<span class="kicker">v3.26.23 · 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.26.23</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>
|
||||
@@ -82,7 +83,7 @@
|
||||
</div>
|
||||
<div class="pcard" data-name="提示词库 promptlib 右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供) 资源 提示词" data-tags="资源,提示词">
|
||||
<div class="head"><span class="av" style="background:#eef2f6">📖</span>
|
||||
<div><div class="nm">提示词库</div><div class="ver">v1.4.10 · 官方</div></div></div>
|
||||
<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>
|
||||
@@ -93,8 +94,8 @@
|
||||
<section class="section"><div class="wrap">
|
||||
<h2>下载 Image Workbench</h2>
|
||||
<p class="lead">选你的平台。装过一次之后,以后在应用内「设置 → 通用 → 版本与更新」就能一键升级。</p>
|
||||
<div class="dl"><a href="/updates/darwin-aarch64/image-workbench_3.26.23_aarch64.dmg?h=beb45e0df21d"><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.23_x64.dmg?h=2a83fbad2071"><div class="n">macOS · Intel</div><div class="s">x86_64 · 8.8 MB · .dmg</div></a>
|
||||
<div class="dl"><a href="/updates/darwin-aarch64/image-workbench_3.26.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>
|
||||
<div class="none"><div class="n">Windows · x64</div><div class="s">暂未提供</div></div></div>
|
||||
<div style="margin-top:20px;color:#9ca3af;font-size:12.5px">安装包未做 Apple 公证 / Windows 代码签名,首次打开需手动放行一次,细节见 <a href="/download/" style="text-decoration:underline">下载页</a>。</div>
|
||||
</div></section>
|
||||
|
||||
+22
-22
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": 2,
|
||||
"updatedAt": "2026-11-21T16:18:40.867Z",
|
||||
"updatedAt": "2026-11-22T15:51:05.074Z",
|
||||
"plugins": [
|
||||
{
|
||||
"id": "batch-export",
|
||||
@@ -180,26 +180,26 @@
|
||||
"资源",
|
||||
"提示词"
|
||||
],
|
||||
"version": "1.4.10",
|
||||
"version": "1.8.8",
|
||||
"apiVersion": 1,
|
||||
"bundle": "plugins/promptlib-1.4.10.zip",
|
||||
"bundleSize": 49682,
|
||||
"bundleSha256": "d5ffef4a9c6b5efe359e071476b76f015d6ae2e5a5982dfca461069c21cf0d96",
|
||||
"bundle": "plugins/promptlib-1.8.8.zip",
|
||||
"bundleSize": 146066,
|
||||
"bundleSha256": "af91d59add3df05c390c6ead566663545acaf1200461185668750422360a2f6f",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "4b8375d1b21bc2ffc29ea93959e7f990751351362f71ae37e1b46ed2e040d99b",
|
||||
"size": 541
|
||||
"sha256": "667ddf6ddedab0ce3abbccbe3dfaa34c56bfa90179369c1c013e736ee5eb15e7",
|
||||
"size": 540
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "75dc31dc6270aa10e73c90eeb09bb349a949d17c39940574e28f12c5e463ceaf",
|
||||
"size": 39307
|
||||
"sha256": "91fde4bcfa888b04ee2b0e79a05d951a56247bc76ecd11b5d9500131df11d542",
|
||||
"size": 106422
|
||||
},
|
||||
{
|
||||
"path": "styles.css",
|
||||
"sha256": "cc71e071379c84131e525afeaa5757674f499da195ccb42536c019a3ef5d8473",
|
||||
"size": 9524
|
||||
"sha256": "82bdae857b0c6e66c0e1c9fa0ea47b269dcbde51cdfacd552e4b919cfa4576c7",
|
||||
"size": 38794
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -280,27 +280,27 @@
|
||||
"提示词",
|
||||
"风格"
|
||||
],
|
||||
"version": "1.3.2",
|
||||
"version": "1.3.3",
|
||||
"apiVersion": 1,
|
||||
"bundle": "plugins/style-source-1.3.2.zip",
|
||||
"bundleSize": 70494,
|
||||
"bundleSha256": "d5bc793cb78c7593d6dcdacc5a8664cfc50dfc0e7c78b6094dc99cc875de9619",
|
||||
"bundle": "plugins/style-source-1.3.3.zip",
|
||||
"bundleSize": 70634,
|
||||
"bundleSha256": "a727fa70f7b195f11a4daed2febb3c5ad073da016ed292856b24127b2ba4d8c6",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "3b49a8e5eba8e5e1a247dd1cdf90a34a426ee3a4442a683369afc8bbde654099",
|
||||
"sha256": "d864e4943ae14764a0dcca27ebe89d877f90ff0350663a86f4d91470ed1cf2e2",
|
||||
"size": 355
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "ee7168565a44d49daaf300f62d5c7a106e60fba29a9e4888ff8bfd9abd2e3178",
|
||||
"size": 69925
|
||||
"sha256": "05c108f8a63cc1c5ebb1c1d18b4ade10e971a0ee74fb135482db7597e6731f84",
|
||||
"size": 70065
|
||||
}
|
||||
],
|
||||
"file": "plugins/plugin-style-source.ee7168565a44.js",
|
||||
"size": 69925,
|
||||
"sha256": "ee7168565a44d49daaf300f62d5c7a106e60fba29a9e4888ff8bfd9abd2e3178",
|
||||
"integrity": "sha256-7nFoVlpE1J2q8wD2LVx6EG5g+6KankiI/4v9mr0uMXg="
|
||||
"file": "plugins/plugin-style-source.05c108f8a63c.js",
|
||||
"size": 70065,
|
||||
"sha256": "05c108f8a63cc1c5ebb1c1d18b4ade10e971a0ee74fb135482db7597e6731f84",
|
||||
"integrity": "sha256-BcEI+KY8wcXrscHRi0reEOlxoO50+xNUgtt1l+ZzH4Q="
|
||||
},
|
||||
{
|
||||
"id": "white-bg-800",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>插件市场 · Image Workbench</title>
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.23-mwqmiapo">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.40-mws31ebx">
|
||||
</head><body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
|
||||
@@ -9,11 +9,12 @@
|
||||
<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.26.23</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.40</a>
|
||||
</div>
|
||||
</div></nav>
|
||||
<main>
|
||||
@@ -76,7 +77,7 @@
|
||||
</div>
|
||||
<div class="pcard" data-name="提示词库 promptlib 右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供) 资源 提示词" data-tags="资源,提示词">
|
||||
<div class="head"><span class="av" style="background:#eef2f6">📖</span>
|
||||
<div><div class="nm">提示词库</div><div class="ver">v1.4.10 · 官方</div></div></div>
|
||||
<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>
|
||||
@@ -94,7 +95,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>
|
||||
|
||||
+344
-1
@@ -1,8 +1,351 @@
|
||||
{
|
||||
"app": "Image Workbench",
|
||||
"subtitle": "本地优先的 AI 生图无限画布 · 桌面版(Tauri v2)",
|
||||
"updatedAt": "2026-11-21T16:29:30.596Z",
|
||||
"updatedAt": "2026-11-22T17:00:01.778Z",
|
||||
"releases": [
|
||||
{
|
||||
"version": "3.26.40",
|
||||
"date": "2026-11-23",
|
||||
"notes": "Intel 版:同一版本",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.40_aarch64.dmg",
|
||||
"size": 8790542,
|
||||
"sha256": "165f48fa6c2d874f18020b6b2e99cd3a40e0496ca3714f4d895263553896ae2b",
|
||||
"h": "165f48fa6c2d",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.40_x64.dmg",
|
||||
"size": 9177668,
|
||||
"sha256": "6890b428aee6233c6093c091ea709468abeb0fa4b30abc3744bef45c28943a55",
|
||||
"h": "6890b428aee6",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.39",
|
||||
"date": "2026-11-22",
|
||||
"notes": "v3.26.39:修正插件插入落点与封面插入(拖拽落点按节点宽高居中到鼠标、插入落到画布可视中心、封面先解析为 dataURL 再插入)",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.39_aarch64.dmg",
|
||||
"size": 8789132,
|
||||
"sha256": "15e9c10f31caea3a3d217db2d47e4cc07ed200153795cec462d02634cd35f31c",
|
||||
"h": "15e9c10f31ca",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.39_x64.dmg",
|
||||
"size": 9179272,
|
||||
"sha256": "1016831ad95f21be55b1410c16a8bb51f29fe0799c6bd8980fadf0369424f3ff",
|
||||
"h": "1016831ad95f",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"windows-x86_64": {
|
||||
"file": "updates/windows-x86_64/image-workbench_3.26.39_x64-setup.exe",
|
||||
"size": 5070508,
|
||||
"sha256": "b94166d04e5d53c3d805e6fc226a4725e1d27198d60b7947b90e4ace6a601ac1",
|
||||
"h": "b94166d04e5d",
|
||||
"kind": "exe"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.38",
|
||||
"date": "2026-11-22",
|
||||
"notes": "Intel 版:同一版本",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.38_aarch64.dmg",
|
||||
"size": 8795617,
|
||||
"sha256": "d7cce4643590125a77983264cfe895043675c66f125aa44ab7d0980ae9e43e52",
|
||||
"h": "d7cce4643590",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.38_x64.dmg",
|
||||
"size": 9179980,
|
||||
"sha256": "d2854862f7371306c0e78c54523928d08ff883cfc474939052f396f553c7ee90",
|
||||
"h": "d2854862f737",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.37",
|
||||
"date": "2026-11-22",
|
||||
"notes": "Intel 版:同一版本",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.37_aarch64.dmg",
|
||||
"size": 8790278,
|
||||
"sha256": "66abb4cfd7714ac331865d85d5dcdaa600f096045a8e92d06d8e0879b1308ea4",
|
||||
"h": "66abb4cfd771",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.37_x64.dmg",
|
||||
"size": 9184844,
|
||||
"sha256": "c560d101175247d304303b664e613fa61cef6fbcb5e7f1dab4fbac291c16dc03",
|
||||
"h": "c560d1011752",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.35",
|
||||
"date": "2026-11-22",
|
||||
"notes": "Intel 版:同一改进",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.35_aarch64.dmg",
|
||||
"size": 8780534,
|
||||
"sha256": "d01c2ea7c517d749570aa0a637a4ebdc1ad9c0db899cfb014d41961d39ae9575",
|
||||
"h": "d01c2ea7c517",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.35_x64.dmg",
|
||||
"size": 9184387,
|
||||
"sha256": "293a063d86ffe6393debae952b3a20d3198743c115229dd4a67e7cdb71d5dcd2",
|
||||
"h": "293a063d86ff",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.34",
|
||||
"date": "2026-11-22",
|
||||
"notes": "Intel 版:同一优化",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.34_aarch64.dmg",
|
||||
"size": 8778902,
|
||||
"sha256": "8107ee30acb00c46acf00f815151babb6ddd4a644bd05def0e95e12066c8e7d2",
|
||||
"h": "8107ee30acb0",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.34_x64.dmg",
|
||||
"size": 9184988,
|
||||
"sha256": "f1c49824bcbab663fbe87a0ce15f3a487a421b632fcb9ee3a4aa32f6c6f4625c",
|
||||
"h": "f1c49824bcba",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.33",
|
||||
"date": "2026-11-22",
|
||||
"notes": "Intel 版:同一修复",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.33_aarch64.dmg",
|
||||
"size": 8779829,
|
||||
"sha256": "3ef7cbd6777565eb39646d7372790b39401382a20fea61c1da5b2d2396d1934c",
|
||||
"h": "3ef7cbd67775",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.33_x64.dmg",
|
||||
"size": 9185159,
|
||||
"sha256": "e44baa8c9d5aebe5b3a648a26595fc56158933506a85a949ac2dcf8a5e04c1bc",
|
||||
"h": "e44baa8c9d5a",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.32",
|
||||
"date": "2026-11-22",
|
||||
"notes": "Intel 版:同一合并",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.32_aarch64.dmg",
|
||||
"size": 8778200,
|
||||
"sha256": "caf473d86026705fb91bbbcc0323ccf4d688add861d77c3e1ddb7bb076fe5891",
|
||||
"h": "caf473d86026",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.32_x64.dmg",
|
||||
"size": 9184024,
|
||||
"sha256": "e18c3b20c333840056d70eca94730227dc457ace866fe23f04cb2b3690b86983",
|
||||
"h": "e18c3b20c333",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.31",
|
||||
"date": "2026-11-22",
|
||||
"notes": "Intel 版:同一合并",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.31_aarch64.dmg",
|
||||
"size": 8783826,
|
||||
"sha256": "aa8bfbed06a341093f912e421af72d994fc04fe532c34f49e3e2ec558af50153",
|
||||
"h": "aa8bfbed06a3",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.31_x64.dmg",
|
||||
"size": 9182641,
|
||||
"sha256": "9ebbe328872b9ac84540c64f3b214646f730ec3328e4c980339f5442ccdd4638",
|
||||
"h": "9ebbe328872b",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.30",
|
||||
"date": "2026-11-22",
|
||||
"notes": "Intel 版:同一合并",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.30_aarch64.dmg",
|
||||
"size": 8782101,
|
||||
"sha256": "cf79ab4999afddc18bde76db8f49f730132adc8dbad39ad988e4bb86236d7101",
|
||||
"h": "cf79ab4999af",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.30_x64.dmg",
|
||||
"size": 9182524,
|
||||
"sha256": "2ff71718943c06bd5bb848fb1ef99547ed3654a4be5615b2fd99ed96c9ea7eb2",
|
||||
"h": "2ff71718943c",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.29",
|
||||
"date": "2026-11-22",
|
||||
"notes": "Intel 版:同一合并",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.29_aarch64.dmg",
|
||||
"size": 8784778,
|
||||
"sha256": "3f2ff7d708121417fb5f04dabc14240553c7a84297eb02283f16583e0e914db2",
|
||||
"h": "3f2ff7d70812",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.29_x64.dmg",
|
||||
"size": 9185981,
|
||||
"sha256": "496868a9e62b383d659f69fdd07fa561b31f180a5a486960b653b6745385d7e8",
|
||||
"h": "496868a9e62b",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.28",
|
||||
"date": "2026-11-22",
|
||||
"notes": "Intel 版:同一清理",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.28_aarch64.dmg",
|
||||
"size": 8780175,
|
||||
"sha256": "917f9c435a4bd80e0cec37d469c60ae90474944f3a88a4a545f530d590a385d1",
|
||||
"h": "917f9c435a4b",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.28_x64.dmg",
|
||||
"size": 9183561,
|
||||
"sha256": "9daa6522269953a038d9f46a006bcbf6e3d03f304ff7c4c6ef334905eeb7662e",
|
||||
"h": "9daa65222699",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.27",
|
||||
"date": "2026-11-22",
|
||||
"notes": "Intel 版:同一交互",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.27_aarch64.dmg",
|
||||
"size": 8782227,
|
||||
"sha256": "2c3d2d2ca6c9fc86e361bc1506f39bbc407e5011545c95b187c2ff2489dd740e",
|
||||
"h": "2c3d2d2ca6c9",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.27_x64.dmg",
|
||||
"size": 9187975,
|
||||
"sha256": "ed0c8ba2f9c69a2ff17b9cefe9f469fd8adc201d10e188a2bd6e58a92e55e717",
|
||||
"h": "ed0c8ba2f9c6",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.26",
|
||||
"date": "2026-11-22",
|
||||
"notes": "Intel 版:同一交互",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.26_aarch64.dmg",
|
||||
"size": 8782545,
|
||||
"sha256": "bc50a4d1bd5ef8c2f68fc5f10cf05d11dcd56c9feccdbcc4bb2308ef3bae2318",
|
||||
"h": "bc50a4d1bd5e",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.26_x64.dmg",
|
||||
"size": 9180404,
|
||||
"sha256": "3149451c46d07ad89d17399bbda6e2520931707ad1ea90f873705d7b5efa7e61",
|
||||
"h": "3149451c46d0",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.25",
|
||||
"date": "2026-11-22",
|
||||
"notes": "Intel 版:同一优化",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.25_aarch64.dmg",
|
||||
"size": 8779187,
|
||||
"sha256": "952072aa7209a5561a34e070e29c90022f15b99dcdc8d9f340d7ef46e2981f37",
|
||||
"h": "952072aa7209",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.25_x64.dmg",
|
||||
"size": 9182258,
|
||||
"sha256": "b439bf90f80e3048f127b73a63f121222472833cde044335ca561532a40293b8",
|
||||
"h": "b439bf90f80e",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.24",
|
||||
"date": "2026-11-22",
|
||||
"notes": "Intel 版:同一设计",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.24_aarch64.dmg",
|
||||
"size": 8783850,
|
||||
"sha256": "dfe5550e8d71095a1f079897691b65b580a1a873564a0659c1c611ca39fef5d9",
|
||||
"h": "dfe5550e8d71",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.24_x64.dmg",
|
||||
"size": 9183734,
|
||||
"sha256": "e5d960bde2388ebd2215a0441fd88ed4391fdd6756657ffbf4e6d7ad9e78c57f",
|
||||
"h": "e5d960bde238",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.23",
|
||||
"date": "2026-11-22",
|
||||
|
||||
Generated
+2
-1
@@ -1983,7 +1983,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "image-workbench"
|
||||
version = "3.26.23"
|
||||
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.26.23"
|
||||
version = "3.26.40"
|
||||
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"] }
|
||||
+41
-12
@@ -171,17 +171,13 @@ fn app_memory_mb() -> u64 {
|
||||
}
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let script = format!("(Get-Process -Id {}).WorkingSet64", pid);
|
||||
let out = std::process::Command::new("powershell")
|
||||
.args(["-NoProfile", "-NonInteractive", "-Command", &script])
|
||||
.output();
|
||||
if let Ok(o) = out {
|
||||
if o.status.success() {
|
||||
let txt = String::from_utf8_lossy(&o.stdout);
|
||||
if let Ok(bytes) = txt.trim().parse::<u64>() {
|
||||
return bytes / (1024 * 1024);
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
@@ -241,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> {
|
||||
// 资料目录(用户选的那个)优先;没设置过才退回应用私有目录
|
||||
@@ -889,7 +918,7 @@ 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) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"productName": "image-workbench",
|
||||
"version": "3.26.23",
|
||||
"version": "3.26.40",
|
||||
"identifier": "com.malongan.imageworkbench",
|
||||
"build": {
|
||||
"frontendDist": "../dist",
|
||||
|
||||
+11
-1
@@ -349,5 +349,15 @@
|
||||
return { x: Math.round(x), y: Math.round(y) }
|
||||
}
|
||||
|
||||
global.IWBCanvasGeometry = Object.freeze({ connectReasonOf, distToSeg, wantsDefaultSpot, parseWorldTransform, clientToWorld, snapToFreeSpot, placeBeside, pruneMeasured, seedFromTopLeft, clampIntoBounds, lodLowOf, lodModeOf, zoomStep, LOD_NODE_PX, LOD_PLAIN_SCALE, ZOOM_STEP, ZOOM_MIN, ZOOM_MAX, create })
|
||||
// 插件「插入画布」落到可视区域中心(findSpot 会把节点丢左上角,常被左侧面板遮住)。
|
||||
const promptCenterSpot = (bridge, w, h) => {
|
||||
try {
|
||||
const c = typeof document !== 'undefined' ? document.querySelector('.iwb-canvas') : null
|
||||
if (!c || !bridge || typeof bridge.screenToWorld !== 'function') return null
|
||||
const r = c.getBoundingClientRect()
|
||||
const p = bridge.screenToWorld(r.left + r.width / 2, r.top + r.height / 2)
|
||||
return p ? { x: p.x - (w || 0) / 2, y: p.y - (h || 0) / 2 } : null
|
||||
} catch (e) { return null }
|
||||
}
|
||||
global.IWBCanvasGeometry = Object.freeze({ connectReasonOf, distToSeg, wantsDefaultSpot, promptCenterSpot, parseWorldTransform, clientToWorld, snapToFreeSpot, placeBeside, pruneMeasured, seedFromTopLeft, clampIntoBounds, lodLowOf, lodModeOf, zoomStep, LOD_NODE_PX, LOD_PLAIN_SCALE, ZOOM_STEP, ZOOM_MIN, ZOOM_MAX, create })
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
@@ -361,6 +361,14 @@
|
||||
if (!st) return
|
||||
anchors.delete(id)
|
||||
if (!st.open) return
|
||||
// v3.26.33:锚点从 DOM 消失(换停靠栏面板 / React 重建节点体)时**立刻 park**,
|
||||
// 原生层永远在最上层,不先隐藏会盖住新面板约 900ms(宽限期才 close)——表现为"切换后面面滞留 1 秒"。
|
||||
if (st.shown !== false) {
|
||||
push(st,
|
||||
isFinite(st.px) ? st.px : 0, isFinite(st.py) ? st.py : 0,
|
||||
isFinite(st.pw) ? st.pw : MIN_EDGE, isFinite(st.ph) ? st.ph : MIN_EDGE,
|
||||
false, null)
|
||||
}
|
||||
var prev = pendingClose.get(id)
|
||||
if (prev) clearTimeout(prev)
|
||||
// 宽限窗口:LOD 降级 / React 重建节点体会让锚点短暂消失,立刻 close 会导致
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
|
||||
function create (opts) {
|
||||
const o = opts || {}
|
||||
const max = Math.max(64, Number(o.max) || 768)
|
||||
// v3.26.34:显示缩略图 640px / WebP 0.72 —— 原来 768px+0.86 单张 500~900KB,49 张 24MB。
|
||||
const max = Math.max(64, Number(o.max) || 640)
|
||||
const cacheMax = Math.max(16, Number(o.cacheMax) || 300)
|
||||
const concurrency = Math.max(1, Number(o.concurrency) || 2)
|
||||
const cache = o.cache
|
||||
@@ -59,7 +60,7 @@
|
||||
if (!ctx) return false
|
||||
ctx.drawImage(bitmap, 0, 0, cw, ch)
|
||||
const small = await new Promise((res) => {
|
||||
try { cv.toBlob((b) => res(b || null), 'image/webp', 0.86) } catch (e) { res(null) }
|
||||
try { cv.toBlob((b) => res(b || null), 'image/webp', 0.72) } catch (e) { res(null) }
|
||||
})
|
||||
if (!small) return false
|
||||
const url = URL.createObjectURL(small)
|
||||
@@ -90,7 +91,7 @@
|
||||
const ctx = cv.getContext('2d')
|
||||
if (!ctx) { resolve(false); return }
|
||||
ctx.drawImage(img, 0, 0, cw, ch)
|
||||
const small = cv.toDataURL('image/jpeg', 0.78)
|
||||
const small = cv.toDataURL('image/jpeg', 0.72)
|
||||
remember(key, small)
|
||||
save(key, small)
|
||||
resolve(true)
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/* image-prompt-cover.js —— 提示词封面的编码与解析(v3.26.34 从 app.js 抽出)
|
||||
*
|
||||
* 为什么单独成模块:app.js 只剩 1 行余量;这段逻辑纯 IO + 决策,天然可测。
|
||||
* 依赖注入:compress(src, conf) → Promise<dataUrl>;resolve(ref) → Promise<url>。
|
||||
*/
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
function create (deps) {
|
||||
var d = deps || {}
|
||||
var compress = typeof d.compress === 'function' ? d.compress : function () { return Promise.resolve('') }
|
||||
var resolve = typeof d.resolve === 'function' ? d.resolve : function () { return Promise.resolve('') }
|
||||
function enc (src, fmt, q) {
|
||||
return Promise.resolve()
|
||||
.then(function () { return compress(src, { enabled: true, force: true, maxMB: 0, maxEdge: 448, quality: q, format: fmt }) })
|
||||
.then(function (v) { return v || '' })
|
||||
.catch(function () { return '' })
|
||||
}
|
||||
// 优先 WebP;编码器不可用时会退回 PNG(448px 照片仍 300KB+)→ 再兜一次 JPEG,取更小者。
|
||||
async function put (dataUrl) {
|
||||
try {
|
||||
var src = String(dataUrl || '')
|
||||
if (src.indexOf('data:') !== 0) return { ok: false, error: '封面上传失败' }
|
||||
var final = await enc(src, 'webp', 0.8)
|
||||
if (!final) final = await enc(src, 'jpeg', 0.82)
|
||||
if (!final) final = src
|
||||
if (final.indexOf('data:image/webp') !== 0 && final.indexOf('data:image/jpeg') !== 0) {
|
||||
var j = await enc(src, 'jpeg', 0.82)
|
||||
if (j && j.length < final.length) final = j
|
||||
}
|
||||
if (String(final).indexOf('data:') !== 0) return { ok: false, error: '封面上传失败' }
|
||||
return { ok: true, ref: final }
|
||||
} catch (e) { return { ok: false, error: '封面上传失败' } }
|
||||
}
|
||||
// dataURL 直接可用;老的 {__blob} 引用走异步解析。
|
||||
async function url (ref) {
|
||||
try {
|
||||
if (typeof ref === 'string' && ref.indexOf('data:') === 0) return { ok: true, url: ref }
|
||||
var u = await resolve(ref)
|
||||
return { ok: !!u, url: u || '' }
|
||||
} catch (e) { return { ok: false, url: '' } }
|
||||
}
|
||||
// 封面比例不定:按原图长宽比给节点宽度(16:9 → 420,1:1 → 280,9:16 → 200)
|
||||
function dataUrlAspect (dataUrl) {
|
||||
return new Promise(function (resolve) {
|
||||
try {
|
||||
var img = new Image()
|
||||
img.onload = function () { resolve((img.naturalWidth || 1) / (img.naturalHeight || 1) || 1) }
|
||||
img.onerror = function () { resolve(1) }
|
||||
img.src = String(dataUrl || '')
|
||||
} catch (e) { resolve(1) }
|
||||
})
|
||||
}
|
||||
function nodeWidthForAspect (ratio) {
|
||||
var r = Number(ratio) || 1
|
||||
if (r >= 2) return 420
|
||||
if (r >= 1.5) return 340
|
||||
if (r <= 0.5) return 200
|
||||
if (r <= 0.75) return 230
|
||||
return 280
|
||||
}
|
||||
return { put: put, url: url, dataUrlAspect: dataUrlAspect, nodeWidthForAspect: nodeWidthForAspect }
|
||||
}
|
||||
global.IWBPromptCover = { create: create }
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
@@ -39,6 +39,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
function fileOp (name) {
|
||||
return function () {
|
||||
const F = (typeof global !== 'undefined' && global.IWBStorageFile) ? global.IWBStorageFile.pluginFiles : null
|
||||
if (!F || typeof F[name] !== 'function') return Promise.reject(new Error('文件能力未就绪'))
|
||||
const args = Array.prototype.slice.call(arguments)
|
||||
try { return Promise.resolve(F[name].apply(F, ['promptlib'].concat(args))) } catch (e) { return Promise.reject(e) }
|
||||
}
|
||||
}
|
||||
const API = {
|
||||
list: call('list'),
|
||||
save: call('save'),
|
||||
@@ -49,6 +57,18 @@
|
||||
putCover: call('putCover'),
|
||||
coverUrl: call('coverUrl'),
|
||||
removeCover: call('removeCover'),
|
||||
// v3.26.36:封面等插件文件的沙箱读写(挂在 promptlib 能力上,避免新增能力权限面)
|
||||
// 文件沙箱(v3.26.36):直接调宿主 pluginFiles,不占 app.js 行数;插件 id 固定 promptlib。
|
||||
filePut: fileOp('put'),
|
||||
fileGet: fileOp('get'),
|
||||
fileList: fileOp('list'),
|
||||
fileRemove: fileOp('remove'),
|
||||
fileStat: fileOp('stat'),
|
||||
fileDir: function () { const F = (typeof global !== 'undefined' && global.IWBStorageFile) ? global.IWBStorageFile.pluginFiles : null; return F ? F.dir('promptlib') : Promise.reject(new Error('文件能力未就绪')) },
|
||||
openPath: function (rel) { const T = (typeof global !== 'undefined') ? global.__TAURI__ : null; if (!T || !T.core) return Promise.reject(new Error('桌面能力不可用')); return T.core.invoke('open_data_subpath', { rel: String(rel || '') }) },
|
||||
// 备份文件读写(宿主的另存为/打开对话框)
|
||||
exportText: function (name, text) { const B = (typeof global !== 'undefined') ? global.IWBPromptlibBackup : null; return (B && typeof B.saveText === 'function') ? B.saveText(text, name) : Promise.reject(new Error('备份能力未就绪')) },
|
||||
importText: function () { const B = (typeof global !== 'undefined') ? global.IWBPromptlibBackup : null; return (B && typeof B.pickText === 'function') ? B.pickText() : Promise.reject(new Error('备份能力未就绪')) },
|
||||
onChanged: function (fn) {
|
||||
if (typeof fn !== 'function') return function () {}
|
||||
listeners.push(fn)
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
/* plugin-archive.js —— 插件包 ZIP 打包/解包(浏览器侧)
|
||||
*
|
||||
* 为什么要有这一层:
|
||||
* - 插件包是**外部输入**:ZIP 里可能藏 ../、绝对路径、反斜杠、超限条目(zip 炸弹)。
|
||||
* 直接把它交给 storage-zip 读写,会把「能不能解」和「该不该解」混在一起;
|
||||
* 本模块只做准入判断,ZIP 编解码仍全部复用 src/storage-zip.js。
|
||||
* - 打包与解包共用同一套校验,避免「写的时候放行、读的时候才拦」造成半成品包。
|
||||
*
|
||||
* 插件包布局(只允许这几种路径):
|
||||
* - data.json / meta.json 顶层元数据
|
||||
* - images/<name>.(jpg|jpeg|png|webp) 图片资源(images/ 下不再允许子目录)
|
||||
*
|
||||
* ⚠️ 重名检测不能只看 wOpenZipBlob 的 files 映射:它是普通对象,同名条目会被
|
||||
* 后一个静默覆盖。所以先用 wZipParseEntries 读中央目录做名字/声明大小/重名预检,
|
||||
* 再用 wOpenZipBlob 逐条读字节并复核**实际**大小(声明大小可伪造,不能当唯一防线)。
|
||||
*/
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
|
||||
const MAX_FILES = 500
|
||||
const MAX_FILE_BYTES = 16 * 1024 * 1024
|
||||
const MAX_TOTAL_BYTES = 64 * 1024 * 1024
|
||||
// 名字过长会写坏 ZIP 的 16 位名称长度字段,也超出常见文件系统上限,直接拒绝。
|
||||
// 名字被白名单限制为 ASCII,所以字符数即字节数。
|
||||
const MAX_NAME_LENGTH = 255
|
||||
const SAFE_NAME_RE = /^[A-Za-z0-9._/-]+$/
|
||||
const IMAGE_EXT_RE = /\.(?:jpe?g|png|webp)$/i
|
||||
const IMAGE_DIR = 'images/'
|
||||
const TOP_FILES = ['data.json', 'meta.json']
|
||||
|
||||
// 上限必须可被调用方/测试读取:这些数字就是信任边界,散落在函数里容易被改错。
|
||||
const limits = Object.freeze({
|
||||
maxFiles: MAX_FILES,
|
||||
maxFileBytes: MAX_FILE_BYTES,
|
||||
maxTotalBytes: MAX_TOTAL_BYTES,
|
||||
})
|
||||
|
||||
function isDirectory (name) {
|
||||
return name.charAt(name.length - 1) === '/'
|
||||
}
|
||||
|
||||
// 名字是唯一进入 ZIP 的路径,按「明显穿越 → 字符 → 路径段 → 白名单前缀」顺序校验。
|
||||
// 顺序是刻意的:先报「反斜杠 / .. / 绝对路径」,错误消息才能指向真正原因,
|
||||
// 而不是笼统地报一句"含非法字符"。
|
||||
function validateName (name) {
|
||||
if (typeof name !== 'string' || name.length === 0) throw new Error('文件名必须是非空字符串')
|
||||
if (name.indexOf('\\') !== -1) throw new Error('文件名不能包含反斜杠:' + name)
|
||||
for (let i = 0; i < name.length; i++) {
|
||||
const code = name.charCodeAt(i)
|
||||
if (code < 0x20 || code === 0x7f) throw new Error('文件名不能包含控制字符:' + JSON.stringify(name))
|
||||
}
|
||||
if (name.charAt(0) === '/') throw new Error('文件名不能是绝对路径:' + name)
|
||||
if (!SAFE_NAME_RE.test(name)) throw new Error('文件名含非法字符(只允许字母数字、-、_、.、/):' + name)
|
||||
if (name.length > MAX_NAME_LENGTH) {
|
||||
throw new Error('文件名过长(最多 ' + MAX_NAME_LENGTH + ' 个字符):' + name.slice(0, 64) + '...')
|
||||
}
|
||||
const dir = isDirectory(name)
|
||||
const body = dir ? name.slice(0, -1) : name
|
||||
if (body.length === 0) throw new Error('文件名不能为空:' + name)
|
||||
for (const part of body.split('/')) {
|
||||
if (part === '..') throw new Error('文件名不能包含 .. 路径段:' + name)
|
||||
if (part === '.' || part === '') throw new Error('文件名包含非法路径段:' + name)
|
||||
}
|
||||
if (dir) {
|
||||
// 只接受 images/ 这一种目录条目;其余目录没有业务含义,放行只会扩大攻击面。
|
||||
if (body !== 'images') throw new Error('ZIP 只允许 images/ 目录条目:' + name)
|
||||
return { name, dir: true }
|
||||
}
|
||||
if (TOP_FILES.indexOf(name) !== -1) return { name, dir: false }
|
||||
if (name.indexOf(IMAGE_DIR) !== 0) throw new Error('文件名不在允许的路径内(仅 data.json、meta.json、images/):' + name)
|
||||
const rest = name.slice(IMAGE_DIR.length)
|
||||
if (rest.indexOf('/') !== -1) throw new Error('images/ 下不允许再建子目录:' + name)
|
||||
if (!IMAGE_EXT_RE.test(rest)) throw new Error('图片只允许 .jpg/.jpeg/.png/.webp 后缀:' + name)
|
||||
return { name, dir: false }
|
||||
}
|
||||
|
||||
function encodeData (data, name) {
|
||||
if (typeof data === 'string') return new global.TextEncoder().encode(data)
|
||||
// 用 brand check 而不是 instanceof:模块可能被放在 iframe/vm 等不同 realm 里,
|
||||
// 跨 realm 的 Uint8Array 用 instanceof 判断会误杀正常输入。
|
||||
if (Object.prototype.toString.call(data) === '[object Uint8Array]') {
|
||||
return new global.Uint8Array(data.buffer, data.byteOffset, data.byteLength)
|
||||
}
|
||||
throw new Error('文件内容必须是 Uint8Array 或 string:' + name)
|
||||
}
|
||||
|
||||
function storage () {
|
||||
const S = global.IWBStorageZip
|
||||
if (!S) throw new Error('ZIP 能力不可用(IWBStorageZip 未加载)')
|
||||
return S
|
||||
}
|
||||
|
||||
function assertBlob (blob) {
|
||||
if (!blob || typeof blob.arrayBuffer !== 'function' || typeof blob.size !== 'number') {
|
||||
throw new Error('解包输入必须是 Blob')
|
||||
}
|
||||
}
|
||||
|
||||
async function zip (files) {
|
||||
if (!Array.isArray(files)) throw new Error('打包输入必须是文件数组')
|
||||
if (files.length > MAX_FILES) throw new Error('文件数超过上限(最多 ' + MAX_FILES + ' 个):' + files.length)
|
||||
const seen = new Set()
|
||||
const items = []
|
||||
let total = 0
|
||||
// 先把整批文件校验完再动写入器:校验失败时不要留下写了一半的 ZIP。
|
||||
for (const f of files) {
|
||||
if (!f || typeof f !== 'object') throw new Error('文件项必须是 { name, data } 对象')
|
||||
const checked = validateName(f.name)
|
||||
if (checked.dir) throw new Error('打包列表不能包含目录条目:' + checked.name)
|
||||
if (seen.has(checked.name)) throw new Error('ZIP 中存在重名条目:' + checked.name)
|
||||
seen.add(checked.name)
|
||||
const bytes = encodeData(f.data, checked.name)
|
||||
if (bytes.byteLength > MAX_FILE_BYTES) throw new Error('单个文件超过上限(16MB):' + checked.name)
|
||||
total += bytes.byteLength
|
||||
if (total > MAX_TOTAL_BYTES) throw new Error('文件总大小超过上限(64MB):' + checked.name)
|
||||
items.push({ name: checked.name, bytes })
|
||||
}
|
||||
const S = storage()
|
||||
if (typeof S.wCreateStoreZip !== 'function') throw new Error('ZIP 写入能力不可用(IWBStorageZip.wCreateStoreZip 缺失)')
|
||||
const zw = S.wCreateStoreZip()
|
||||
if (!zw || typeof zw.add !== 'function' || typeof zw.finish !== 'function') throw new Error('ZIP 写入器不可用')
|
||||
for (const item of items) {
|
||||
// 每个文件单独一个 Blob:storage-zip 会把 Blob 原样作为 ZIP part,字节不必堆进 JS 堆。
|
||||
await zw.add(item.name, new global.Blob([item.bytes]))
|
||||
}
|
||||
const blob = zw.finish()
|
||||
if (!blob || typeof blob.arrayBuffer !== 'function') throw new Error('ZIP 写入失败:没有产出 Blob')
|
||||
return blob
|
||||
}
|
||||
|
||||
// 中央目录预检。返回 null 表示当前客户端没有 wZipParseEntries ——
|
||||
// 此时只能退化为 files 映射校验(该映射会吞掉重名,属于已知降级)。
|
||||
async function scanEntries (S, blob) {
|
||||
if (typeof S.wZipParseEntries !== 'function') return null
|
||||
let parsed
|
||||
try {
|
||||
parsed = S.wZipParseEntries(await blob.arrayBuffer())
|
||||
} catch (e) {
|
||||
throw new Error('ZIP 解析失败:' + ((e && e.message) || e))
|
||||
}
|
||||
const entries = (parsed && parsed.entries) || []
|
||||
if (entries.length > MAX_FILES) {
|
||||
throw new Error('ZIP 条目数超过上限(最多 ' + MAX_FILES + ' 个):' + entries.length)
|
||||
}
|
||||
const names = []
|
||||
const seen = new Set()
|
||||
let declaredTotal = 0
|
||||
for (const e of entries) {
|
||||
const checked = validateName(e && e.name)
|
||||
if (checked.dir) continue
|
||||
// 声明大小先卡一道:明显超限的炸弹包不必等读出全部字节才报错。
|
||||
const rawSize = Number(e.rawSize) || 0
|
||||
if (rawSize > MAX_FILE_BYTES) throw new Error('解包后单个文件超过上限(16MB):' + checked.name)
|
||||
declaredTotal += rawSize
|
||||
if (declaredTotal > MAX_TOTAL_BYTES) throw new Error('解包后总大小超过上限(64MB):' + checked.name)
|
||||
if (seen.has(checked.name)) throw new Error('ZIP 中存在重名条目:' + checked.name)
|
||||
seen.add(checked.name)
|
||||
names.push(checked.name)
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
||||
async function unzip (blob) {
|
||||
assertBlob(blob)
|
||||
const S = storage()
|
||||
if (typeof S.wOpenZipBlob !== 'function') throw new Error('ZIP 读取能力不可用(IWBStorageZip.wOpenZipBlob 缺失)')
|
||||
const parsedNames = await scanEntries(S, blob)
|
||||
let opened
|
||||
try {
|
||||
opened = await S.wOpenZipBlob(blob)
|
||||
} catch (e) {
|
||||
throw new Error('ZIP 解析失败:' + ((e && e.message) || e))
|
||||
}
|
||||
const map = opened && opened.files
|
||||
if (!map || typeof map !== 'object') throw new Error('ZIP 打开失败:没有文件表')
|
||||
let names = parsedNames
|
||||
if (!names) {
|
||||
// 降级路径:没有中央目录解析能力时,只能按 files 映射的键校验。
|
||||
names = Object.keys(map)
|
||||
if (names.length > MAX_FILES) throw new Error('ZIP 条目数超过上限(最多 ' + MAX_FILES + ' 个):' + names.length)
|
||||
for (const name of names) validateName(name)
|
||||
}
|
||||
const out = []
|
||||
let total = 0
|
||||
for (const name of names) {
|
||||
const entry = (typeof opened.file === 'function') ? opened.file(name) : map[name]
|
||||
if (!entry || typeof entry.async !== 'function') throw new Error('ZIP 条目读取失败:' + name)
|
||||
let bytes
|
||||
try {
|
||||
bytes = await entry.async('uint8array')
|
||||
} catch (e) {
|
||||
throw new Error('ZIP 条目解压失败(' + name + '):' + ((e && e.message) || e))
|
||||
}
|
||||
if (!bytes || typeof bytes.byteLength !== 'number') throw new Error('ZIP 条目内容非法:' + name)
|
||||
// 中央目录里的 rawSize 可以伪造,真实字节数必须再复核一次(zip 炸弹的最终防线)。
|
||||
if (bytes.byteLength > MAX_FILE_BYTES) throw new Error('解包后单个文件超过上限(16MB):' + name)
|
||||
total += bytes.byteLength
|
||||
if (total > MAX_TOTAL_BYTES) throw new Error('解包后总大小超过上限(64MB):' + name)
|
||||
// 复制一份再交付,避免返回值与 ZIP 内部大 buffer 长期共享(也防止调用方改写源字节)。
|
||||
out.push({ name, data: new global.Uint8Array(bytes) })
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
global.IWBPluginArchive = Object.freeze({ zip, unzip, limits })
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
@@ -0,0 +1,40 @@
|
||||
/* plugin-files-policy.js —— 插件文件能力的纯策略(v3.26.36)
|
||||
*
|
||||
* 为什么单独成模块:文件名白名单与配额是安全边界,必须能在 Node 里单测;
|
||||
* storage-file 里只留 IO,策略在这里,避免「安全靠人工」。
|
||||
*/
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
|
||||
var LIMITS = Object.freeze({
|
||||
FILE_MAX: 8 * 1024 * 1024, // 单文件 8MB(640px 封面约 40~90KB,留足余量)
|
||||
TOTAL_MAX: 64 * 1024 * 1024, // 单插件总量 64MB
|
||||
})
|
||||
var NAME_RE = /^[a-z0-9][a-z0-9_-]{0,63}\.(jpg|jpeg|png|webp)$/i
|
||||
|
||||
// 文件名只允许:字母数字 / - / _ + 图片后缀;禁止路径分隔、点段与控制字符。
|
||||
function fileOk (name) {
|
||||
var s = String(name == null ? '' : name)
|
||||
if (!s || s.length > 72) return false
|
||||
if (!NAME_RE.test(s)) return false
|
||||
if (s.indexOf('..') >= 0) return false
|
||||
if (s.indexOf('/') >= 0) return false
|
||||
if (s.indexOf(String.fromCharCode(92)) >= 0) return false
|
||||
for (var i = 0; i < s.length; i++) { if (s.charCodeAt(i) < 32) return false }
|
||||
return true
|
||||
}
|
||||
|
||||
// 配额:total 为现有总量;replacing 为同名旧文件大小(覆盖时不重复计)。
|
||||
function quotaOk (total, incoming, replacing, limits) {
|
||||
var L = limits || LIMITS
|
||||
var inc = Number(incoming) || 0
|
||||
var rep = Number(replacing) || 0
|
||||
var cur = Math.max(0, Number(total) || 0)
|
||||
if (inc <= 0) return { ok: false, reason: 'empty' }
|
||||
if (inc > L.FILE_MAX) return { ok: false, reason: 'file-too-large', limit: L.FILE_MAX }
|
||||
if (cur - rep + inc > L.TOTAL_MAX) return { ok: false, reason: 'total-too-large', limit: L.TOTAL_MAX }
|
||||
return { ok: true }
|
||||
}
|
||||
|
||||
global.IWBPluginFilesPolicy = { LIMITS: LIMITS, fileOk: fileOk, quotaOk: quotaOk }
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
const API_VERSION = 1
|
||||
const ID_PATTERN = /^[a-z][a-z0-9-]{2,31}$/
|
||||
const REQUIRED_FIELDS = ['id', 'name', 'version', 'apiVersion', 'capabilities']
|
||||
const CAPABILITIES = ['panels', 'commands', 'nodeTypes', 'generationHooks', 'providers', 'canvas', 'canvasWrite', 'nodeActions', 'gallery', 'grouplib', 'promptlib']
|
||||
const CAPABILITY_API_KEYS = { panels: 'ui', commands: 'commands', nodeTypes: 'nodes', generationHooks: 'generation', providers: 'providers', canvas: 'canvas', canvasWrite: 'canvas', nodeActions: 'nodeActions', gallery: 'gallery', grouplib: 'grouplib', promptlib: 'promptlib' }
|
||||
const CAPABILITIES = ['panels', 'commands', 'nodeTypes', 'generationHooks', 'providers', 'canvas', 'canvasWrite', 'nodeActions', 'gallery', 'grouplib', 'promptlib', 'files']
|
||||
const CAPABILITY_API_KEYS = { panels: 'ui', commands: 'commands', nodeTypes: 'nodes', generationHooks: 'generation', providers: 'providers', canvas: 'canvas', canvasWrite: 'canvas', nodeActions: 'nodeActions', gallery: 'gallery', grouplib: 'grouplib', promptlib: 'promptlib' , files: 'files'}
|
||||
|
||||
function createPluginHost(options) {
|
||||
const opt = options || {}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/* plugin-promptlib-backup.js —— 提示词插件备份文件的读写(v3.26.37)
|
||||
*
|
||||
* 插件跑在 WebView 里没有文件权限:导出/导入必须经宿主的「另存为/打开」对话框。
|
||||
* 这里只做文件 IO,内容格式(哪些条目、如何合并)由插件决定。
|
||||
*/
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
|
||||
function tauri () { return (typeof global.__TAURI__ !== 'undefined') ? global.__TAURI__ : null }
|
||||
|
||||
async function saveText (text, name) {
|
||||
const T = tauri()
|
||||
if (!T || !T.dialog || !T.fs) return { ok: false, error: '桌面版文件对话框不可用' }
|
||||
try {
|
||||
const path = await T.dialog.save({
|
||||
defaultPath: String(name || 'promptlib-backup.json'),
|
||||
filters: [{ name: '提示词备份', extensions: ['json'] }],
|
||||
})
|
||||
if (!path) return { ok: false, canceled: true }
|
||||
await T.fs.writeTextFile(path, String(text || ''))
|
||||
return { ok: true, path: path }
|
||||
} catch (e) { return { ok: false, error: String((e && e.message) || e) } }
|
||||
}
|
||||
|
||||
async function pickText () {
|
||||
const T = tauri()
|
||||
if (!T || !T.dialog || !T.fs) return { ok: false, error: '桌面版文件对话框不可用' }
|
||||
try {
|
||||
const picked = await T.dialog.open({
|
||||
multiple: false,
|
||||
filters: [{ name: '提示词备份', extensions: ['json'] }],
|
||||
})
|
||||
const path = Array.isArray(picked) ? picked[0] : picked
|
||||
if (!path) return { ok: false, canceled: true }
|
||||
const text = await T.fs.readTextFile(path)
|
||||
return { ok: true, text: text, path: path }
|
||||
} catch (e) { return { ok: false, error: String((e && e.message) || e) } }
|
||||
}
|
||||
|
||||
global.IWBPromptlibBackup = { saveText: saveText, pickText: pickText }
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
@@ -887,6 +887,14 @@
|
||||
commitCanvas(refs.nodes.concat(moved), refs.edges.concat(es), refs.groups.concat(gs))
|
||||
} else {
|
||||
setSel([])
|
||||
// 拖入后清掉宿主的临时手势状态:原生拖放期间鼠标事件被浏览器吞掉,
|
||||
// pointerup 可能没走到画布,refs.bodyDown/box 会残留 ⇒ 第一次点击节点被当成「收尾」。
|
||||
try {
|
||||
refs.bodyDown = null; refs.groupDown = null; refs.drag = null; refs.box = null; refs.pan = null
|
||||
const ae = /** @type {any} */ (document.activeElement)
|
||||
if (ae && typeof ae.blur === 'function') ae.blur()
|
||||
if (window.getSelection) window.getSelection().removeAllRanges()
|
||||
} catch (e) { /* ignore */ }
|
||||
setNotice({ type: 'ok', text: '✓ 已导入 ' + ns.length + ' 个节点 / ' + es.length + ' 条连线' })
|
||||
commitCanvas(ns, es, gs)
|
||||
}
|
||||
@@ -1089,11 +1097,44 @@
|
||||
try {
|
||||
const obj = JSON.parse(promptPayload)
|
||||
const id = uid('n')
|
||||
const node = { id, type: 'prompt', x: Math.round(wx - 132), y: Math.round(wy - 20), data: { text: obj.text || '', title: obj.name || '' } }
|
||||
// 有变量 → 模板节点(可填值、可作参考图);没有变量 → 普通文本节点(最轻)
|
||||
const hasVars = Array.isArray(obj.vars) && obj.vars.length > 0
|
||||
const node = hasVars
|
||||
? {
|
||||
id, type: 'plugin:' + String(obj.pluginId || 'promptlib') + ':ptpl', x: Math.round(wx - 210), y: Math.round(wy - 20), w: 420,
|
||||
data: {
|
||||
promptId: '', name: obj.name || '提示词模板', tpl: obj.text || '',
|
||||
vdefs: Array.isArray(obj.vdefs) ? obj.vdefs : [],
|
||||
vars: {}, cover: obj.cover || '', refOn: false, text: obj.text || '', outKind: 'prompt',
|
||||
},
|
||||
}
|
||||
: { id, type: 'prompt', x: Math.round(wx - 132), y: Math.round(wy - 20), data: { text: obj.text || '', title: obj.name || '' } }
|
||||
pushHistory() // 拖拽入画布新增节点:入撤销历史(鼠标落点保留)
|
||||
commitCanvas(refs.nodes.concat([node]), undefined, undefined)
|
||||
// 与风格库一致:新节点直接选中(未选中时第一次点击会被当成“先选中”而拖不动)
|
||||
setSel([id])
|
||||
setNotice({ type: 'ok', text: '已插入提示词:' + (obj.name || '') })
|
||||
// 拖放结束后浏览器可能还会给新节点补一次 focus/click(落在 readonly textarea 上会进入编辑态),
|
||||
// 导致「第一次点节点」变成选文本/输入框、拖不动。延时几次强制 blur + 取消选择,覆盖这段尾巴。
|
||||
const settleDrop = () => {
|
||||
try {
|
||||
const ae = /** @type {any} */ (document.activeElement)
|
||||
if (ae && ae !== document.body && typeof ae.blur === 'function') ae.blur()
|
||||
if (window.getSelection) window.getSelection().removeAllRanges()
|
||||
setSel([id])
|
||||
} catch (e) { /* ignore */ }
|
||||
}
|
||||
setTimeout(settleDrop, 0)
|
||||
setTimeout(settleDrop, 80)
|
||||
setTimeout(settleDrop, 240)
|
||||
// 原生拖放期间浏览器的鼠标事件被吞掉,pointerup 不会走到画布:
|
||||
// refs.bodyDown/box 等临时手势会残留,导致「第一次点节点」被当成收尾(点不动/选中文本)。
|
||||
try {
|
||||
refs.bodyDown = null; refs.groupDown = null; refs.drag = null; refs.box = null; refs.pan = null
|
||||
const ae = /** @type {any} */ (document.activeElement)
|
||||
if (ae && typeof ae.blur === 'function') ae.blur()
|
||||
if (window.getSelection) window.getSelection().removeAllRanges()
|
||||
} catch (e) { /* ignore */ }
|
||||
setNotice({ type: 'ok', text: (hasVars ? '已插入提示词模板:' : '已插入提示词:') + (obj.name || '') })
|
||||
return
|
||||
} catch (err) { /* 非本应用拖入 */ }
|
||||
}
|
||||
|
||||
+113
-1
@@ -571,6 +571,92 @@
|
||||
} catch (e) { return [] }
|
||||
}
|
||||
|
||||
// ---- 插件文件(v3.26.36):<资料目录>/plugin-data/<id>/files/ ----
|
||||
// 与插件 JSON 数据分离:文件放目录、JSON 只存文件名(内容哈希命名)。
|
||||
// 安全:文件名白名单(禁路径分隔/点段)、单文件 8MB、单插件总量 64MB、原子写。
|
||||
const PFILE_DIR = 'files'
|
||||
const PFILE_MAX = 8 * 1024 * 1024
|
||||
const PFILE_TOTAL = 64 * 1024 * 1024
|
||||
const PFILE_NAME_RE = /^[a-z0-9][a-z0-9_-]{0,63}\.(jpg|jpeg|png|webp)$/i
|
||||
function pluginFileNameOk (name) {
|
||||
const P = global.IWBPluginFilesPolicy
|
||||
if (P && typeof P.fileOk === 'function') return P.fileOk(name)
|
||||
const s0 = String(name || '')
|
||||
if (!PFILE_NAME_RE.test(s0)) return false
|
||||
if (s0.indexOf('..') >= 0 || s0.indexOf('/') >= 0 || s0.indexOf(String.fromCharCode(92)) >= 0) return false
|
||||
return true
|
||||
}
|
||||
async function pluginFilesDir (id) {
|
||||
const p = await join(await pluginDataDir(), safePluginId(id), PFILE_DIR)
|
||||
try { await fs().mkdir(p, { recursive: true }) } catch (e) { /* 已存在 */ }
|
||||
return p
|
||||
}
|
||||
async function pluginFilePut (id, name, dataUrl) {
|
||||
try {
|
||||
if (!pluginFileNameOk(name)) return { ok: false, error: '非法文件名(只允许小写字母/数字/-/_ + jpg/png/webp)' }
|
||||
const decoded = dataUrlToBytes(String(dataUrl || ''))
|
||||
const bytes = decoded && decoded.bytes
|
||||
if (!bytes || !bytes.length) return { ok: false, error: '图片数据为空' }
|
||||
const stat = await pluginFileStat(id)
|
||||
const existing = stat.files.find((f) => f.name === name)
|
||||
const P = global.IWBPluginFilesPolicy
|
||||
const q = P ? P.quotaOk(stat.bytes, bytes.length, existing ? existing.size : 0) : null
|
||||
if (q && !q.ok) {
|
||||
if (q.reason === 'file-too-large') return { ok: false, error: '单张图片超过 8MB' }
|
||||
if (q.reason === 'total-too-large') return { ok: false, error: '插件数据总量超过 64MB,请先清理' }
|
||||
return { ok: false, error: '图片数据为空' }
|
||||
}
|
||||
if (!P) {
|
||||
if (bytes.length > PFILE_MAX) return { ok: false, error: '单张图片超过 8MB' }
|
||||
if (stat.bytes - (existing ? existing.size : 0) + bytes.length > PFILE_TOTAL) return { ok: false, error: '插件数据总量超过 64MB,请先清理' }
|
||||
}
|
||||
const dir0 = await pluginFilesDir(id)
|
||||
const target = await join(dir0, name)
|
||||
const tmp = target + '.tmp'
|
||||
await fs().writeFile(tmp, bytes)
|
||||
try { await fs().rename(tmp, target) } catch (e) {
|
||||
try { await fs().remove(target) } catch (e2) { /* ignore */ }
|
||||
await fs().rename(tmp, target)
|
||||
}
|
||||
return { ok: true, name: name, size: bytes.length }
|
||||
} catch (e) { return { ok: false, error: String((e && e.message) || e) } }
|
||||
}
|
||||
async function pluginFileGet (id, name) {
|
||||
try {
|
||||
if (!pluginFileNameOk(name)) return { ok: false, error: '非法文件名' }
|
||||
const u8 = await fs().readFile(await join(await pluginFilesDir(id), name))
|
||||
if (!u8 || !u8.length) return { ok: false, error: '文件不存在' }
|
||||
return { ok: true, url: bytesToDataUrl(sniffMime(u8) || 'image/jpeg', u8), size: u8.length }
|
||||
} catch (e) { return { ok: false, error: '文件不存在' } }
|
||||
}
|
||||
async function pluginFileList (id) {
|
||||
try {
|
||||
const entries = await fs().readDir(await pluginFilesDir(id))
|
||||
const out = []
|
||||
for (const e of entries) {
|
||||
if (!e || e.isDirectory || !pluginFileNameOk(e.name)) continue
|
||||
let size = 0
|
||||
try { const u8 = await fs().readFile(await join(await pluginFilesDir(id), e.name)); size = u8 ? u8.length : 0 } catch (err) { size = 0 }
|
||||
out.push({ name: e.name, size: size })
|
||||
}
|
||||
out.sort((a, b) => a.name.localeCompare(b.name))
|
||||
return out
|
||||
} catch (e) { return [] }
|
||||
}
|
||||
async function pluginFileRemove (id, name) {
|
||||
try {
|
||||
if (!pluginFileNameOk(name)) return { ok: false, error: '非法文件名' }
|
||||
await fs().remove(await join(await pluginFilesDir(id), name))
|
||||
return { ok: true }
|
||||
} catch (e) { return { ok: false, error: '删除失败' } }
|
||||
}
|
||||
async function pluginFileStat (id) {
|
||||
try {
|
||||
const files = await pluginFileList(id)
|
||||
return { ok: true, files: files, bytes: files.reduce((n, f) => n + (f.size || 0), 0), count: files.length }
|
||||
} catch (e) { return { ok: false, files: [], bytes: 0, count: 0 } }
|
||||
}
|
||||
|
||||
async function loadInto() {
|
||||
// data.json 不存在 ⇒ 把当前 WebView 里的数据迁过去(只做一次)
|
||||
const target = await join(dir, DATA_FILE)
|
||||
@@ -787,6 +873,8 @@
|
||||
try { await stripInlineGalleryThumbs() } catch (e) { /* 忽略 */ }
|
||||
// trash/ 轮转:gcImages 只是移进来,超过 30 天在这里真正删除
|
||||
try { await rotateTrash(30) } catch (e) { /* 忽略 */ }
|
||||
// 旧的 768px 显示缩略图一次性清理(缓存可再生)
|
||||
try { const dropped = await dropLegacyDisplayThumbs(); if (dropped) console.info('[iwb][file-store] 清理旧缩略图', dropped, '个') } catch (e) { /* 忽略 */ }
|
||||
// 自愈:图库清单丢了但 assets 还有 out_ 键 ⇒ 按键重建(名称/时间/idb 可推,label/远程 url 无法恢复)
|
||||
try {
|
||||
if (mem['iwb_web_outputs'] === undefined) {
|
||||
@@ -838,6 +926,29 @@
|
||||
|
||||
// 清理未引用图片:只动「没有任何 assets 条目指向」的文件,移到 trash/(不直接删)。
|
||||
// 保守策略:assets 里还有登记的键一律保留,避免误删仍在画布上引用的图。
|
||||
// v3.26.34(一次性):清掉旧的 768px 显示缩略图。
|
||||
// 为什么:旧编码 768px/WebP 0.86,单张 500~900KB,49 张就 24MB(比原图还大)。
|
||||
// 显示缩略图是**可再生缓存**(打开画布时按需重建),删掉不会丢任何用户数据;
|
||||
// 只删 `*_768.*`,保留图库缩略图(无 _768 后缀、需要清单引用,不能删)。
|
||||
async function dropLegacyDisplayThumbs() {
|
||||
try {
|
||||
if (!enabled() || !dir) return 0
|
||||
const marker = await join(dir, 'display-thumbs-reset-v1.flag')
|
||||
if (await fs().exists(marker)) return 0
|
||||
const abs = await join(dir, IMG_DIR, 'thumbs')
|
||||
let entries = []
|
||||
try { entries = await fs().readDir(abs) } catch (e) { entries = [] }
|
||||
let n = 0
|
||||
for (const e of entries) {
|
||||
if (!e || e.isDirectory) continue
|
||||
if (!/_768\.(webp|jpg|jpeg)$/i.test(String(e.name))) continue
|
||||
try { await fs().remove(await join(abs, e.name)); n++ } catch (err) { /* 单个失败忽略 */ }
|
||||
}
|
||||
try { await fs().writeTextFile(marker, String(Date.now())) } catch (e) { /* 标记失败下次再试 */ }
|
||||
return n
|
||||
} catch (e) { return 0 }
|
||||
}
|
||||
|
||||
// trash/ 轮转:超过 maxAgeDays 的文件直接删除(gcImages 只是移进来,不清)
|
||||
async function rotateTrash(maxAgeDays) {
|
||||
const days = Number(maxAgeDays) > 0 ? Number(maxAgeDays) : 30
|
||||
@@ -1135,12 +1246,13 @@
|
||||
enabled, ready: init, flush, runtime, pickDir, switchTo, migrateTo, gcImages, rotateTrash, galleryThumb, readDisplayThumb, readDisplayThumbUrl, writeDisplayThumb, writeDisplayThumbBlob, pruneThumbs, cleanupLegacy, maintain,
|
||||
plugins: { manifest: pluginManifest, read: pluginRead, write: pluginWrite, remove: pluginRemove, dir: pluginDir, listLocal: pluginListLocal, listDirs: pluginListDirs, readFile: pluginReadFile, writeFile: pluginWriteFile, writeBinary: pluginWriteBinary, mkdir: pluginMkdir, removeDir: pluginRemoveDir, renameDir: pluginRenameDir, existsDir: pluginExistsDir },
|
||||
pluginData: { read: pluginDataRead, write: pluginDataWrite, remove: pluginDataRemove, list: pluginDataList },
|
||||
pluginFiles: { put: pluginFilePut, get: pluginFileGet, list: pluginFileList, remove: pluginFileRemove, stat: pluginFileStat, dir: pluginFilesDir },
|
||||
storage: () => storage,
|
||||
kv: () => kv,
|
||||
dir: () => dir,
|
||||
setDir: async (next) => { dir = String(next || ''); await flush();},
|
||||
stats: () => ({ dir, keys: Object.keys(mem).length, images: Object.keys(assets).length }),
|
||||
__internals: { snapshot, loadInto, sha16, extOf, dataUrlToBytes, bytesToDataUrl },
|
||||
__internals: { snapshot, loadInto, sha16, extOf, dataUrlToBytes, bytesToDataUrl, pluginFileNameOk },
|
||||
}
|
||||
// 关窗/收托盘前强制刷盘(beforeunload 在桌面端不保证,但能救一次是一次)
|
||||
// 落盘兜底:桌面端点关闭是「收进托盘」,beforeunload 不一定触发;
|
||||
|
||||
+19
-18
@@ -364,17 +364,17 @@
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm', style: { marginRight: 10 }, onClick: function () { setView('manage') } }, '返回'),
|
||||
'插件市场',
|
||||
),
|
||||
el('div', { className: 'iwb-hint' }, '共 ' + mList.length + ' 个插件 · 安装在 ' + dirHint),
|
||||
el('div', { className: 'iwb-row' },
|
||||
el('div', { className: 'iwb-mk-subtitle' }, '共 ' + mList.length + ' 个插件 · ' + dirHint),
|
||||
el('div', { className: 'iwb-mk-toolbar' },
|
||||
el('input', { className: 'iwb-input iwb-grow', placeholder: '搜索插件,例如:出图、抠图、矢量…', value: q, onChange: function (e) { setQ(e.target.value) } }),
|
||||
(function () {
|
||||
const tags = []
|
||||
for (const m of mList) for (const t of (m.tags || [])) if (tags.indexOf(t) < 0) tags.push(t)
|
||||
return el('div', { className: 'iwb-mk-filters' }, tags.map(function (t) {
|
||||
return el('button', { key: t, className: 'iwb-mk-chip' + (mt === t ? ' on' : ''), onClick: function () { setMt(mt === t ? '' : t) } }, t)
|
||||
}))
|
||||
})(),
|
||||
),
|
||||
(function () {
|
||||
const tags = []
|
||||
for (const m of mList) for (const t of (m.tags || [])) if (tags.indexOf(t) < 0) tags.push(t)
|
||||
return el('div', { className: 'iwb-mk-filters' }, tags.map(function (t) {
|
||||
return el('button', { key: t, className: 'iwb-mk-chip' + (mt === t ? ' on' : ''), onClick: function () { setMt(mt === t ? '' : t) } }, t)
|
||||
}))
|
||||
})(),
|
||||
(function () {
|
||||
const all = mList.filter(function (m) { return hit(m.name, m.desc) })
|
||||
const shown = all.filter(function (m) {
|
||||
@@ -397,22 +397,23 @@
|
||||
if (m.size) bits.push(kb(m.size))
|
||||
return el('div', { key: m.id, className: 'iwb-mk-card' },
|
||||
el('div', { className: 'iwb-mk-head' },
|
||||
el('span', { className: 'iwb-mk-avatar', style: { background: m.color || '#eef2f6' } }, m.icon || '◻'),
|
||||
el('span', { className: 'iwb-mk-avatar', style: { background: m.color || 'var(--iwb-layer2)' } }, m.icon || '◻'),
|
||||
el('div', { className: 'iwb-mk-titles' },
|
||||
el('div', { className: 'iwb-mk-name' }, m.name || m.id,
|
||||
((m.id in inst) || regById[m.id]) ? el('span', { className: 'iwb-plugin-tag', style: { marginLeft: 6 } }, '已安装') : null,
|
||||
((m.id in inst) || regById[m.id]) ? el('span', { className: 'iwb-mk-badge' }, '已安装') : null,
|
||||
),
|
||||
el('div', { className: 'iwb-mk-sub' }, bits.join(' · ')),
|
||||
),
|
||||
el('div', { className: 'iwb-mk-actions' },
|
||||
((m.id in inst) || regById[m.id]) ? el('button', { className: 'iwb-btn iwb-btn-sm', disabled: !!busy, onClick: function () { act('install', m.id) } }, busy === m.id ? '处理中…' : '重装') : null,
|
||||
((m.id in inst) || regById[m.id])
|
||||
? el('button', { className: 'iwb-btn iwb-btn-sm', disabled: !!busy, onClick: function () { act('uninstall', m.id) } }, '移除')
|
||||
: el('button', { className: 'iwb-btn iwb-btn-sm iwb-btn-primary', disabled: !!busy, onClick: function () { act('install', m.id) } }, busy === m.id ? '处理中…' : '安装'),
|
||||
),
|
||||
),
|
||||
m.desc ? el('div', { className: 'iwb-mk-desc' }, m.desc) : null,
|
||||
(m.tags && m.tags.length) ? el('div', { className: 'iwb-mk-tags' }, m.tags.map(function (t) { return el('span', { key: t, className: 'iwb-mk-tag' }, t) })) : null,
|
||||
el('div', { className: 'iwb-mk-foot' },
|
||||
el('div', { className: 'iwb-mk-tags' }, (m.tags || []).slice(0, 3).map(function (t) { return el('span', { key: t, className: 'iwb-mk-tag' }, t) })),
|
||||
el('div', { className: 'iwb-mk-actions' },
|
||||
((m.id in inst) || regById[m.id])
|
||||
? el('button', { className: 'iwb-btn iwb-btn-sm', disabled: !!busy, onClick: function () { act('uninstall', m.id) } }, '移除')
|
||||
: el('button', { className: 'iwb-btn iwb-btn-sm iwb-btn-primary', disabled: !!busy, onClick: function () { act('install', m.id) } }, busy === m.id ? '安装中…' : '安装'),
|
||||
),
|
||||
),
|
||||
)
|
||||
})) : el('div', { className: 'iwb-hint' }, mList.length ? '没有匹配的插件' : '市场加载中…'),
|
||||
)
|
||||
|
||||
@@ -277,10 +277,10 @@ button { font-family: inherit; }
|
||||
.iwb-out-img { width: 100%; border-radius: 8px; border: 1px solid var(--iwb-border); }
|
||||
.iwb-out-meta { font-size: 10px; color: var(--iwb-text2); margin-top: 3px; }
|
||||
.iwb-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
|
||||
.iwb-toolbar { position: absolute; top: 12px; left: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: 12px; padding: 8px 10px; z-index: 10; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
|
||||
.iwb-toolbar { position: absolute; top: 12px; left: 12px; display: flex; align-items: center; flex-wrap: wrap; background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: 12px; padding: 8px 10px; z-index: 10; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
|
||||
.iwb-toolbar-title { font-weight: 700; font-size: 13px; margin-right: 2px; }
|
||||
.iwb-toolbar-sep { width: 1px; height: 18px; background: var(--iwb-border2); margin: 0 2px; }
|
||||
.iwb-statusbar { position: absolute; right: 62px; top: 12px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; max-width: calc(100vw - 60px); justify-content: flex-end; background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: 10px; padding: 6px 12px; z-index: 10; font-size: 11px; color: var(--iwb-text2); box-shadow: 0 4px 16px rgba(0,0,0,0.12); transition: right 0.15s; }
|
||||
.iwb-statusbar { position: absolute; top: 12px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; max-width: calc(100vw - 60px); justify-content: flex-end; background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: 10px; padding: 6px 12px; z-index: 10; font-size: 11px; color: var(--iwb-text2); box-shadow: 0 4px 16px rgba(0,0,0,0.12); transition: right 0.15s; }
|
||||
.iwb-status-err { color: var(--iwb-err); }
|
||||
.iwb-status-ok { color: var(--iwb-ok); }
|
||||
/* 生成中状态:直接附着在顶部计时/状态背景,确保不依赖画布节点可见性 */
|
||||
@@ -291,11 +291,11 @@ button { font-family: inherit; }
|
||||
.iwb-save-saving { animation: iwb-pulse 1.2s ease-in-out infinite; }
|
||||
@keyframes iwb-spin { to { transform: rotate(360deg); } }
|
||||
@keyframes iwb-pulse { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }
|
||||
.iwb-hint-bottom { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); font-size: 10px; color: var(--iwb-text2); background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: 8px; padding: 3px 10px; z-index: 9; opacity: 0.8; white-space: nowrap; }
|
||||
.iwb-hint-bottom { position: absolute; bottom: 10px; transform: translateX(-50%); font-size: 10px; color: var(--iwb-text2); background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: 8px; padding: 3px 10px; z-index: 9; opacity: 0.8; white-space: nowrap; }
|
||||
.iwb-boxsel { position: absolute; border: 1px dashed var(--iwb-brand); background: color-mix(in srgb, var(--iwb-brand) 12%, transparent); z-index: 3; pointer-events: none; }
|
||||
/* v3.26.18:右栏挤压到工具栏时自动隐藏(避免两者重叠) */
|
||||
.iwb-minimap.iwb-minimap-tight { opacity: 0; transform: translateY(6px); pointer-events: none; }
|
||||
.iwb-minimap { transition: opacity .16s ease, transform .16s ease; position: absolute; right: 62px; bottom: 14px; width: 132px; height: 88px; background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: 8px; z-index: 11; cursor: crosshair; overflow: hidden; touch-action: none; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
|
||||
|
||||
.iwb-mini-node { position: absolute; border-radius: 2px; opacity: 0.85; }
|
||||
.iwb-mini-view { position: absolute; border: 1px solid var(--iwb-brand); border-radius: 2px; pointer-events: none; }
|
||||
.iwb-modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 300; display: flex; align-items: center; justify-content: center; }
|
||||
@@ -305,7 +305,6 @@ button { font-family: inherit; }
|
||||
.iwb-modal-foot { padding: 12px 16px; border-top: 1px solid var(--iwb-border); display: flex; justify-content: flex-end; }
|
||||
.iwb-provider-card { border: 1px solid var(--iwb-border); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
|
||||
.iwb-keyrow { display: flex; gap: 6px; align-items: center; }
|
||||
.iwb-keyname { flex: 0 0 110px; }
|
||||
.iwb-lib { position: absolute; top: 0; right: 0; bottom: 0; background: var(--iwb-panel); border-left: 1px solid var(--iwb-border2); z-index: 20; display: flex; flex-direction: column; box-shadow: -8px 0 24px rgba(0,0,0,0.15); }
|
||||
.iwb-lib-handle { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; cursor: ew-resize; z-index: 3; }
|
||||
.iwb-lib-handle:hover { background: color-mix(in srgb, var(--iwb-text) 14%, transparent); }
|
||||
@@ -387,7 +386,7 @@ button { font-family: inherit; }
|
||||
.iwb-full-split:hover { background: var(--iwb-text2); }
|
||||
.iwb-full-edit { flex: 0 0 auto; border-left: 1px solid var(--iwb-border); background: var(--iwb-layer); display: flex; flex-direction: column; min-height: 0; }
|
||||
.iwb-full-edit-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--iwb-border); flex: 0 0 auto; }
|
||||
.iwb-full-editor { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; flex: 1 1 auto; }
|
||||
.iwb-full-editor { overflow-y: auto; min-height: 0; flex: 1 1 auto; }
|
||||
.iwb-full-editor { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
|
||||
.iwb-full-editor-title { font-size: 13px; font-weight: 700; color: var(--iwb-text); }
|
||||
.iwb-full-editor-text { min-height: 220px; resize: vertical; }
|
||||
@@ -423,7 +422,7 @@ button { font-family: inherit; }
|
||||
.iwb-task-title { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--iwb-text); }
|
||||
.iwb-task-title-text { font-size: 11px; font-weight: 400; color: var(--iwb-text2); margin-left: 3px; }
|
||||
.iwb-task-refs { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
|
||||
.iwb-task-ref { width: 40px; height: 40px; object-fit: cover; border-radius: 5px; border: 1px solid var(--iwb-border); cursor: zoom-in; }
|
||||
.iwb-task-ref { object-fit: cover; border-radius: 5px; border: 1px solid var(--iwb-border); cursor: zoom-in; }
|
||||
|
||||
.iwb-ref-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
|
||||
.iwb-ref-single { width: 100%; min-height: 60px; max-height: 340px; object-fit: contain; object-position: center; border-radius: 6px; border: 1px solid var(--iwb-border); background: var(--iwb-layer2); cursor: move; }
|
||||
@@ -460,16 +459,13 @@ button { font-family: inherit; }
|
||||
.iwb-section-sub { font-weight: 600; font-size: 12px; margin: 10px 0 6px; color: var(--iwb-text2); }
|
||||
.iwb-mode-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
|
||||
.iwb-check { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--iwb-text); }
|
||||
.iwb-num { width: 76px; flex: none; }
|
||||
.iwb-hdrbox { min-height: 54px; font-family: ui-monospace, Menlo, monospace; font-size: 11px; resize: vertical; }
|
||||
|
||||
/* ---- v2 P3:4-Tab 设置 ---- */
|
||||
.iwb-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--iwb-border); padding: 8px 12px 0; }
|
||||
.iwb-tab { background: transparent; border: 1px solid transparent; border-bottom: none; padding: 7px 14px; border-radius: 8px 8px 0 0; font-size: 12px; color: var(--iwb-text2); cursor: pointer; }
|
||||
.iwb-tab:hover { color: var(--iwb-text); }
|
||||
.iwb-tab-active { background: var(--iwb-panel); border-color: var(--iwb-border); color: var(--iwb-brand); font-weight: 700; }
|
||||
.iwb-tab { border-bottom: none; }
|
||||
.iwb-tab-active { border-color: var(--iwb-border); }
|
||||
.iwb-addrrow { gap: 6px; margin-bottom: 6px; }
|
||||
.iwb-addr-tag { flex: 0 0 26px; text-align: right; }
|
||||
.iwb-speed { border: 1px solid var(--iwb-border); border-radius: 8px; padding: 6px 8px; margin: 6px 0; background: var(--iwb-layer); }
|
||||
.iwb-speed-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-size: 11px; }
|
||||
.iwb-speed-ms { flex: 0 0 74px; font-weight: 600; }
|
||||
@@ -559,10 +555,10 @@ button { font-family: inherit; }
|
||||
.iwb-backup-actions .iwb-btn { font-size: 13px; }
|
||||
.iwb-backup-file { font-size: 12.5px; color: var(--iwb-text2); padding: 2px 0 4px; }
|
||||
.iwb-backup-note { font-size: 12px; color: var(--iwb-text2); line-height: 1.6; }
|
||||
.iwb-settings-modal .iwb-hint { font-size: 13.5px; line-height: 1.7; }
|
||||
.iwb-settings-modal .iwb-hint { font-size: 13.5px; }
|
||||
.iwb-settings-modal .iwb-btn { font-size: 13.5px; }
|
||||
.iwb-settings-modal .iwb-section-title { font-size: 15px; margin: 6px 0 8px; }
|
||||
.iwb-settings-modal .iwb-section-sub { font-size: 13.5px; margin: 10px 0 4px; }
|
||||
.iwb-settings-modal .iwb-section-sub { font-size: 13.5px; }
|
||||
.iwb-settings-modal .iwb-provider-card { padding: 12px 14px; gap: 8px; }
|
||||
.iwb-settings-modal .iwb-row { gap: 8px; }
|
||||
.iwb-settings-modal .iwb-keyrow, .iwb-settings-modal .iwb-speed-row, .iwb-settings-modal .iwb-mode-row { padding: 5px 0; gap: 8px; }
|
||||
@@ -580,7 +576,7 @@ button { font-family: inherit; }
|
||||
|
||||
/* ---- v3:左侧多工作台 ---- */
|
||||
.iwb-wsrail { position: absolute; left: 0; top: 36px; bottom: 0; width: 52px; background: var(--iwb-panel); border-right: 1px solid var(--iwb-border); z-index: 25; display: flex; flex-direction: column; align-items: stretch; transition: width 0.15s; }
|
||||
.iwb-wsrail-title { display: flex; align-items: center; gap: 4px; padding: 14px 12px; font-weight: 800; font-size: 18px; color: var(--iwb-text); border-bottom: 1px solid var(--iwb-border); cursor: default; user-select: none; white-space: nowrap; flex: 0 0 auto; justify-content: center; }
|
||||
.iwb-wsrail-title { align-items: center; gap: 4px; padding: 14px 12px; font-weight: 800; font-size: 18px; color: var(--iwb-text); border-bottom: 1px solid var(--iwb-border); cursor: default; user-select: none; white-space: nowrap; flex: 0 0 auto; justify-content: center; }
|
||||
.iwb-wsrail-title:hover { background: var(--iwb-layer); }
|
||||
/* 展开态标题行右侧 ⋯ 三点菜单(Portal 挂 body + fixed 定位:右侧展开不切割、层级高于画布) */
|
||||
.iwb-wsrail-title-more-wrap { position: relative; margin-left: auto; display: inline-flex; align-items: center; }
|
||||
@@ -593,7 +589,7 @@ button { font-family: inherit; }
|
||||
.ws-expanded .iwb-wsrail-title { font-size: 18px; }
|
||||
.ws-expanded .iwb-wsrail-title .iwb-btn-text { font-size: inherit; }
|
||||
.iwb-wsrail-label { font-size: 10px; color: var(--iwb-text2); font-weight: 700; letter-spacing: 1px; margin: 2px 2px 4px; user-select: none; }
|
||||
.iwb-wsrail-foot { flex: 0 0 auto; border-top: 1px solid var(--iwb-border); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
|
||||
.iwb-wsrail-foot { flex: 0 0 auto; border-top: 1px solid var(--iwb-border); padding: 10px; flex-direction: column; gap: 8px; }
|
||||
.iwb-wsrail-footrow { display: flex; gap: 6px; }
|
||||
.iwb-wsrail-footrow .iwb-btn { flex: 1 1 auto; justify-content: center; font-size: 11px; }
|
||||
/* 组合来源停用标记 */
|
||||
@@ -613,13 +609,10 @@ button { font-family: inherit; }
|
||||
.iwb-node-disabled { opacity: 0.55; filter: grayscale(0.35); }
|
||||
.iwb-node-disabled .iwb-node-head { background: color-mix(in srgb, var(--iwb-layer2) 60%, transparent); }
|
||||
.iwb-node-disabled .iwb-port { opacity: 0.45; }
|
||||
.iwb-canvas { left: 52px; transition: left 0.15s; }
|
||||
.iwb-canvas { transition: left 0.15s; }
|
||||
.iwb-toolbar-wrap { position: absolute; left: 0; right: 60px; bottom: 14px; display: flex; justify-content: center; pointer-events: none; z-index: 10; }
|
||||
.iwb-overlay.has-minimap .iwb-toolbar-wrap { right: 244px; }
|
||||
|
||||
.ws-expanded .iwb-wsrail { width: 200px; }
|
||||
.ws-expanded .iwb-canvas { left: 200px; }
|
||||
|
||||
|
||||
|
||||
/* ---- v3:工具栏分组 ---- */
|
||||
@@ -649,9 +642,8 @@ button { font-family: inherit; }
|
||||
.iwb-drawer-tab { background: none; border: 1px solid transparent; border-radius: 8px; padding: 5px 10px; font-size: 12px; color: var(--iwb-text2); cursor: pointer; white-space: nowrap; }
|
||||
.iwb-drawer-tab:hover { color: var(--iwb-text); }
|
||||
.iwb-drawer-tab-active { background: var(--iwb-layer); border-color: var(--iwb-border); color: var(--iwb-brand); font-weight: 700; }
|
||||
.iwb-drawer-spacer { flex: 1 1 auto; }
|
||||
.iwb-drawer-body { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
|
||||
.iwb-drawer-toggle { position: absolute; right: 0; top: 50%; transform: translateY(-50%); z-index: 21; background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-right: none; border-radius: 8px 0 0 8px; padding: 12px 5px; cursor: pointer; font-size: 12px; color: var(--iwb-text2); box-shadow: -4px 0 12px rgba(0,0,0,0.1); writing-mode: vertical-lr; letter-spacing: 2px; }
|
||||
.iwb-drawer-toggle { position: absolute; right: 0; top: 50%; transform: translateY(-50%); z-index: 21; background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-right: none; border-radius: 8px 0 0 8px; padding: 12px 5px; cursor: pointer; font-size: 12px; color: var(--iwb-text2); box-shadow: -4px 0 12px rgba(0,0,0,0.1); letter-spacing: 2px; }
|
||||
.iwb-drawer-toggle:hover { color: var(--iwb-brand); }
|
||||
/* 嵌入抽屉时面板填满 */
|
||||
.iwb-lib-embedded, .iwb-groups-embedded { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
|
||||
@@ -789,7 +781,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-wsrail-title .iwb-ic { width: 20px; height: 20px; }
|
||||
.iwb-wsrail-label { display: flex; align-items: center; gap: 5px; }
|
||||
.iwb-wsrail-foot .iwb-btn { border-radius: 8px; background: color-mix(in srgb, var(--iwb-layer) 42%, transparent); border-color: color-mix(in srgb, var(--iwb-border2) 40%, transparent); }
|
||||
.iwb-drawer-toggle { display: flex; align-items: center; gap: 4px; writing-mode: initial; }
|
||||
.iwb-drawer-toggle { align-items: center; gap: 4px; writing-mode: initial; }
|
||||
|
||||
/* 窄屏时压缩工具栏避免换行 */
|
||||
@media (max-width: 760px) {
|
||||
@@ -915,7 +907,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
/* ---- 生图节点:参数设置(横向一行,无标题无分类) ---- */
|
||||
.iwb-gen-row { display: flex; gap: 4px; align-items: center; }
|
||||
.iwb-gen-cell { flex: 0 1 auto; min-width: 0; display: flex; align-items: center; }
|
||||
.iwb-gen-cell .iwb-input { width: auto; max-width: 100%; font-size: 15px; padding: 3px 18px 3px 5px; background-color: var(--iwb-panel); background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%23c8cdd6' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 5px center; border: none; appearance: none; -webkit-appearance: none; -moz-appearance: none; }
|
||||
.iwb-gen-cell .iwb-input { width: auto; max-width: 100%; font-size: 15px; background-color: var(--iwb-panel); background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%23c8cdd6' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 5px center; border: none; appearance: none; -webkit-appearance: none; -moz-appearance: none; }
|
||||
.iwb-gen-cell .iwb-input:focus { outline: none; background-color: color-mix(in srgb, var(--iwb-brand) 6%, var(--iwb-panel)); }
|
||||
|
||||
/* ---- 任务卡:张数下拉移到右下角(状态在左) ---- */
|
||||
@@ -949,7 +941,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
|
||||
/* 左侧栏底部:收起态图标列 + 链接按钮 */
|
||||
.iwb-wsrail-foot-collapsed { padding-top: 6px; border-top: 1px solid var(--iwb-border); }
|
||||
.iwb-wsrail-iconcol { display: flex; flex-direction: column; align-items: center; gap: 6px; }
|
||||
.iwb-wsrail-iconcol { display: flex; flex-direction: column; align-items: center; }
|
||||
.iwb-wsrail-iconcol .iwb-ws-headicon { width: 32px; height: 30px; }
|
||||
.iwb-wsrail-foot a.iwb-btn, a.iwb-btn { text-decoration: none; }
|
||||
.iwb-wsrail-foot .iwb-ws-headicon .iwb-ic { width: 15px; height: 15px; }
|
||||
@@ -994,7 +986,6 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-out-head .iwb-label { flex: 0 0 auto; }
|
||||
.iwb-out-tools { flex: 1 1 auto; display: flex; gap: 4px; justify-content: flex-end; }
|
||||
.iwb-out-tools .iwb-btn { padding: 2px 8px; font-size: 11px; }
|
||||
.iwb-out-cell { position: relative; }
|
||||
.iwb-out-cell-img { width: 100%; height: auto; display: block; border-radius: 8px; border: 1px solid var(--iwb-border); cursor: zoom-in; background: var(--iwb-layer2); transition: border-color 0.12s; }
|
||||
.iwb-out-cell-img:hover { border-color: var(--iwb-brand); }
|
||||
.iwb-out-cell-meta { font-size: 10px; color: var(--iwb-text2); text-align: center; margin-top: 2px; }
|
||||
@@ -1065,14 +1056,14 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
|
||||
/* 生图/LLM 服务设置:模型列表 + 行内删除操作 */
|
||||
.iwb-modelrow { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 8px; border: 1px solid var(--iwb-border); border-radius: 8px; margin-bottom: 4px; background: var(--iwb-layer); }
|
||||
.iwb-modelrow-main { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1 1 auto; }
|
||||
.iwb-modelrow-main { display: flex; align-items: center; gap: 4px; }
|
||||
.iwb-modelrow-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.iwb-modelrow .iwb-btn-danger { color: var(--iwb-err); opacity: 0; pointer-events: none; transition: opacity .15s ease; }
|
||||
.iwb-modelrow:hover .iwb-btn-danger, .iwb-modelrow:focus-within .iwb-btn-danger { opacity: 1; pointer-events: auto; }
|
||||
.iwb-modelrow-main { cursor: default; }
|
||||
.iwb-modelrow-main span { cursor: default; }
|
||||
.iwb-modelrow-active { border-color: var(--iwb-border2); background: color-mix(in srgb, var(--iwb-text) 6%, transparent); }
|
||||
.iwb-modelrow-name { flex: 1 1 auto; cursor: pointer; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.iwb-modelrow-name { flex: 1 1 auto; cursor: pointer; font-size: 12px; }
|
||||
.iwb-input-err { border-color: var(--iwb-err) !important; box-shadow: 0 0 0 1px rgba(239,68,68,0.35); }
|
||||
|
||||
/* LLM 多渠道设置卡片 */
|
||||
@@ -1111,63 +1102,53 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
|
||||
.iwb-size-preset-grid-edit { grid-template-columns: minmax(120px, 1fr) repeat(3, minmax(108px, 1fr)) 38px; }
|
||||
.iwb-size-preset-grid-edit .iwb-btn { width: 34px; min-width: 34px; padding: 0; justify-content: center; justify-self: center; }
|
||||
.iwb-shell-nav { position: absolute; left: 12px; top: 12px; z-index: 30; display: flex; align-items: center; gap: 6px; padding: 5px; border: 1px solid var(--iwb-border); border-radius: 10px; background: color-mix(in srgb, var(--iwb-panel) 92%, transparent); box-shadow: 0 4px 16px rgba(0,0,0,.12); }
|
||||
.iwb-shell-nav { left: 12px; top: 12px; z-index: 30; align-items: center; }
|
||||
.iwb-shell-nav-item { display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: 7px; padding: 7px 10px; background: transparent; color: var(--iwb-text2); cursor: pointer; }
|
||||
.iwb-shell-nav-item:hover, .iwb-shell-nav-active { background: var(--iwb-layer2); color: var(--iwb-text); }
|
||||
.iwb-shell-nav-caption { padding: 0 8px; font-size: 11px; color: var(--iwb-text2); }
|
||||
.iwb-home-panel { position: absolute; inset: 0; z-index: 20; padding: 110px 9vw 40px; overflow: auto; background: var(--iwb-home-bg); }
|
||||
.iwb-home-title { font-size: 30px; font-weight: 700; color: var(--iwb-text); }
|
||||
.iwb-home-panel { position: absolute; inset: 0; z-index: 20; overflow: auto; background: var(--iwb-home-bg); }
|
||||
.iwb-home-title { font-weight: 700; color: var(--iwb-text); }
|
||||
.iwb-home-subtitle { margin-top: 8px; color: var(--iwb-text2); }
|
||||
.iwb-home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 30px; max-width: 1100px; }
|
||||
|
||||
.iwb-home-sec-head { grid-column: 1 / -1; font-size: 12px; font-weight: 700; color: var(--iwb-text2); letter-spacing: .5px; margin: 6px 0 2px; padding-top: 8px; border-top: 1px solid var(--iwb-hr); }
|
||||
.iwb-home-sec-head:first-child { border-top: none; padding-top: 0; }
|
||||
.iwb-home-card { min-height: 130px; padding: 20px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 14px; border: 1px solid var(--iwb-border); border-radius: 14px; background: color-mix(in srgb, var(--iwb-panel) 52%, var(--iwb-home-bg) 48%); color: var(--iwb-text); text-align: left; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
|
||||
.iwb-home-card:hover { border-color: var(--iwb-border2); background: color-mix(in srgb, var(--iwb-panel) 76%, var(--iwb-home-bg) 24%); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
|
||||
|
||||
.iwb-home-card span { color: var(--iwb-text2); font-size: 12px; }
|
||||
.iwb-home-new { align-items: center; justify-content: center; color: var(--iwb-brand); }
|
||||
.iwb-canvas-hidden { visibility: hidden; pointer-events: none; }
|
||||
.iwb-shell-nav { position: static; display: flex; flex-direction: column; gap: 3px; padding: 8px; border: 0; border-bottom: 1px solid var(--iwb-border); border-radius: 0; background: transparent; box-shadow: none; }
|
||||
.iwb-shell-nav { position: static; flex-direction: column; gap: 3px; padding: 8px; border: 0; border-bottom: 1px solid var(--iwb-border); border-radius: 0; background: transparent; box-shadow: none; }
|
||||
.iwb-shell-nav-item { width: 100%; justify-content: flex-start; min-height: 34px; }
|
||||
.iwb-wsrail-current { flex: 1 1 auto; min-height: 0; padding: 14px 10px; color: var(--iwb-text); }
|
||||
.iwb-wsrail-current .iwb-wsrail-label { margin: 0 0 8px; }
|
||||
.iwb-wsrail-current-name { padding: 10px; border: 1px solid var(--iwb-border); border-radius: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
|
||||
.iwb-wsrail-current .iwb-btn { margin-top: 8px; width: 100%; justify-content: center; }
|
||||
.iwb-home-panel { padding-left: max(9vw, 240px); }
|
||||
/* 顶部应用导航:不覆盖左栏,统一承载页面级入口与当前工作台 */
|
||||
.iwb-top-nav { position: absolute; left: 0; right: 0; top: 0; height: 54px; z-index: 35; display: flex; align-items: center; gap: 6px; padding: 0 14px; background: color-mix(in srgb, var(--iwb-panel) 94%, transparent); border-bottom: 1px solid var(--iwb-border); box-shadow: 0 2px 12px rgba(0,0,0,.08); }
|
||||
.iwb-top-nav-brand { display: inline-flex; align-items: center; gap: 7px; margin-right: 12px; font-weight: 800; color: var(--iwb-text); white-space: nowrap; }
|
||||
.iwb-top-nav-item, .iwb-top-nav-workspace, .iwb-top-nav-icon { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; border: 1px solid transparent; border-radius: 8px; padding: 0 10px; background: transparent; color: var(--iwb-text2); cursor: pointer; }
|
||||
.iwb-top-nav-brand { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; color: var(--iwb-text); white-space: nowrap; }
|
||||
.iwb-top-nav-item, .iwb-top-nav-workspace, .iwb-top-nav-icon { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: 8px; padding: 0 10px; background: transparent; color: var(--iwb-text2); cursor: pointer; }
|
||||
.iwb-top-nav-item:hover, .iwb-top-nav-active, .iwb-top-nav-workspace:hover, .iwb-top-nav-icon:hover { background: var(--iwb-layer2); color: var(--iwb-text); border-color: var(--iwb-border); }
|
||||
.iwb-top-nav-workspace { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.iwb-top-nav-workspace .iwb-ic { width: 13px; height: 13px; }
|
||||
.iwb-top-nav-sep { width: 1px; height: 22px; margin: 0 6px; background: var(--iwb-border); }
|
||||
.iwb-top-nav-spacer { flex: 1 1 auto; }
|
||||
.iwb-top-nav-icon { width: 34px; justify-content: center; padding: 0; }
|
||||
|
||||
.iwb-top-nav-icon .iwb-ic { width: 16px; height: 16px; }
|
||||
.iwb-wsrail { top: 54px; }
|
||||
.iwb-wsrail-title, .iwb-wsrail-current, .iwb-wsrail-foot { display: none; }
|
||||
.iwb-shell-nav { display: none; }
|
||||
.iwb-wsrail { width: 52px; }
|
||||
.ws-expanded .iwb-wsrail { width: 52px; }
|
||||
.iwb-canvas, .ws-expanded .iwb-canvas { left: 52px; }
|
||||
.iwb-home-panel { padding-left: max(9vw, 100px); padding-top: 90px; }
|
||||
.iwb-home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--iwb-hr); padding-bottom: 24px; }
|
||||
.iwb-home-kicker { color: var(--iwb-text2); font-size: 12px; margin-bottom: 8px; }
|
||||
.iwb-home-panel { padding-top: 90px; }
|
||||
.iwb-home-head { display: flex; justify-content: space-between; gap: 20px; }
|
||||
.iwb-home-kicker { color: var(--iwb-text2); font-size: 12px; }
|
||||
.iwb-home-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
|
||||
/* 仅首页用「深底浅字」;画布内的主按钮(生成 / 批量出图)保持品牌底 + 白字,避免暗色下发灰看不清 */
|
||||
.iwb-home-panel .iwb-btn-primary { background: var(--iwb-text); color: var(--iwb-bg); }
|
||||
.iwb-home-card { position: relative; padding: 18px 18px 14px; min-height: 174px; }
|
||||
|
||||
.iwb-home-card > input { position: absolute; left: 18px; top: 20px; width: 17px; height: 17px; accent-color: var(--iwb-text); z-index: 2; }
|
||||
.iwb-home-card-main { display: flex; flex: 1 1 auto; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 10px; width: 100%; min-height: 105px; padding: 26px 0 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
|
||||
.iwb-home-card-main strong { padding-left: 30px; font-size: 18px; }
|
||||
.iwb-home-card-main span, .iwb-home-card-main small { color: var(--iwb-text2); }
|
||||
.iwb-home-card-actions { display: flex; justify-content: flex-end; gap: 8px; width: 100%; }
|
||||
.iwb-home-card-actions button { width: 30px; height: 28px; border: 0; background: transparent; color: var(--iwb-text2); cursor: pointer; border-radius: 6px; }
|
||||
.iwb-home-card-actions button:hover { background: var(--iwb-layer2); color: var(--iwb-text); }
|
||||
/* 资源工具栏移至左侧:窄 rail + 可展开面板 */
|
||||
.iwb-canvas { left: 48px; top: 54px; }
|
||||
.ws-expanded .iwb-canvas { left: 48px; }
|
||||
.iwb-top-nav { height: 54px; }
|
||||
/* v4 参考布局:顶部产品导航、左侧资源区、中央画布三层分离 */
|
||||
.iwb-overlay { background: var(--iwb-bg); }
|
||||
.iwb-top-nav { height: 64px; padding: 0 max(18px, calc((100vw - 1760px) / 2)); gap: 4px; background: rgba(255,255,255,.94); backdrop-filter: blur(14px); border-bottom: 1px solid var(--iwb-border); box-shadow: 0 1px 8px rgba(20,20,20,.05); }
|
||||
@@ -1177,15 +1158,13 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-top-nav-item:hover, .iwb-top-nav-active { background: transparent; border-color: transparent; color: var(--iwb-text); }
|
||||
.iwb-top-nav-active::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; background: var(--iwb-text); }
|
||||
.iwb-top-nav-workspace { min-height: 38px; border-color: var(--iwb-border); margin-left: 8px; }
|
||||
.iwb-top-nav-icon { min-height: 38px; }
|
||||
|
||||
.iwb-top-nav-icon:first-of-type { margin-left: auto; }
|
||||
.iwb-wsrail { top: 64px; }
|
||||
.iwb-canvas, .ws-expanded .iwb-canvas { left: 52px; top: 64px; }
|
||||
.iwb-home-panel { padding: 116px max(30px, calc((100vw - 1580px) / 2)) 60px; }
|
||||
.iwb-home-head { min-height: 112px; align-items: center; }
|
||||
.iwb-home-head { align-items: center; }
|
||||
.iwb-home-title { font-size: 34px; letter-spacing: -.03em; }
|
||||
.iwb-home-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; max-width: 1580px; }
|
||||
.iwb-home-card { min-height: 210px; border-radius: 16px; background: color-mix(in srgb, var(--iwb-panel) 86%, #f3f0eb); }
|
||||
|
||||
@media (max-width: 900px) { .iwb-top-nav-brand { margin-right: 4px; } .iwb-top-nav-item span, .iwb-top-nav-workspace { display: none; } .iwb-top-nav { padding: 0 8px; } .iwb-home-head { align-items: flex-start; flex-direction: column; } }
|
||||
/* v5:三页面语义与编辑器 chrome */
|
||||
.iwb-product-nav, .iwb-canvas-topbar { position: absolute; left: 0; right: 0; top: 0; height: 64px; z-index: 35; display: flex; align-items: center; gap: 6px; padding: 0 max(18px, calc((100vw - 1760px) / 2)); background: var(--iwb-bg); border-bottom: 1px solid var(--iwb-border); }
|
||||
@@ -1195,36 +1174,29 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-product-spacer { flex: 1; }
|
||||
.iwb-product-icon, .iwb-canvas-menu, .iwb-top-nav-icon { width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--iwb-text2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
|
||||
.iwb-product-icon:hover, .iwb-canvas-menu:hover, .iwb-top-nav-icon:hover { background: var(--iwb-layer2); color: var(--iwb-text); }
|
||||
.iwb-canvas-topbar { padding-left: 10px; padding-right: 14px; box-shadow: 0 1px 8px rgba(0,0,0,.04); }
|
||||
.iwb-canvas-title { font-weight: 700; font-size: 15px; }
|
||||
.iwb-canvas-status { color: var(--iwb-text2); font-size: 12px; }
|
||||
.iwb-canvas, .ws-expanded .iwb-canvas { left: 0; top: 64px; }
|
||||
|
||||
.iwb-landing-panel { position: absolute; inset: 0; z-index: 20; padding: 64px 8vw 80px; overflow: auto; text-align: center; background-color: var(--iwb-bg); background-image: radial-gradient(circle, color-mix(in srgb, var(--iwb-border) 70%, transparent) 1px, transparent 1.5px); background-size: 28px 28px; }
|
||||
.iwb-landing-panel h1 { margin: 190px auto 22px; max-width: 850px; font-size: clamp(42px, 6vw, 84px); letter-spacing: -.06em; color: var(--iwb-text); }
|
||||
.iwb-landing-panel p { max-width: 760px; margin: 0 auto; color: var(--iwb-text2); font-size: 18px; line-height: 1.8; }
|
||||
.iwb-landing-kicker { padding-top: 74px; font-size: 14px; color: var(--iwb-text2); }
|
||||
.iwb-landing-actions { display: flex; justify-content: center; gap: 12px; margin-top: 38px; }
|
||||
.iwb-landing-divider { max-width: 1200px; margin: 210px auto 70px; border-top: 1px solid var(--iwb-border); }
|
||||
.iwb-landing-panel h2 { font-size: 32px; margin-bottom: 14px; }
|
||||
.iwb-landing-panel h1 { max-width: 850px; color: var(--iwb-text); }
|
||||
.iwb-landing-panel p { max-width: 760px; margin: 0 auto; line-height: 1.8; }
|
||||
.iwb-landing-actions { display: flex; justify-content: center; }
|
||||
.iwb-landing-divider { max-width: 1200px; border-top: 1px solid var(--iwb-border); }
|
||||
/* v6:无白色占位条,三页铺满视口;编辑器左侧只保留顶部展开把手 */
|
||||
.iwb-overlay { left: 0 !important; right: 0 !important; width: 100% !important; }
|
||||
.iwb-wsrail { display: none !important; width: 0 !important; border: 0 !important; }
|
||||
.iwb-canvas, .ws-expanded .iwb-canvas { left: 0 !important; top: 64px !important; }
|
||||
.iwb-canvas, .ws-expanded .iwb-canvas { left: 0 !important; }
|
||||
.iwb-product-nav { background: var(--iwb-bg); }
|
||||
.iwb-canvas-topbar { background: var(--iwb-bg); }
|
||||
|
||||
.iwb-home-panel, .iwb-landing-panel { left: 0 !important; right: 0 !important; padding-left: max(24px, calc((100vw - 1580px) / 2)); padding-right: max(24px, calc((100vw - 1580px) / 2)); }
|
||||
.iwb-home-card { min-width: 0; }
|
||||
|
||||
/* v7:画布卡片(参考图1)、编辑器顶栏(参考图3)、左侧展开按钮(参考图2) */
|
||||
.iwb-home-card { padding: 0; gap: 0; min-height: 172px; overflow: hidden; }
|
||||
.iwb-home-card-top { display: flex; align-items: center; gap: 12px; padding: 22px 22px 0 22px; }
|
||||
|
||||
.iwb-home-card-top { display: flex; align-items: center; gap: 12px; }
|
||||
.iwb-home-card-top > input { position: static; width: 18px; height: 18px; accent-color: var(--iwb-text); z-index: 2; }
|
||||
.iwb-home-card-title { flex: 1; min-width: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; padding: 0; display: flex; align-items: center; }
|
||||
.iwb-home-card-title strong { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.iwb-home-card-meta { padding: 14px 22px 0 52px; color: var(--iwb-text2); font-size: 13px; }
|
||||
.iwb-home-card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 22px 18px 22px; }
|
||||
.iwb-home-card-foot small { color: var(--iwb-text2); font-size: 12px; }
|
||||
.iwb-home-card-actions { display: flex; gap: 6px; }
|
||||
.iwb-home-card-actions button { width: 30px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--iwb-text2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
|
||||
.iwb-home-card-title { flex: 1; min-width: 0; border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0; display: flex; align-items: center; }
|
||||
.iwb-home-card-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
|
||||
|
||||
.iwb-home-card-actions button { border: 0; background: transparent; color: var(--iwb-text2); cursor: pointer; }
|
||||
.iwb-home-card-actions button:hover { background: var(--iwb-layer2); color: var(--iwb-text); }
|
||||
/* 进入画布加载动画 */
|
||||
.iwb-enter-loading { position: absolute; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: color-mix(in srgb, var(--iwb-bg) 92%, transparent); backdrop-filter: blur(2px); }
|
||||
@@ -1232,11 +1204,16 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-enter-text { color: var(--iwb-text2); font-size: 14px; }
|
||||
@keyframes iwb-spin { to { transform: rotate(360deg); } }
|
||||
/* 编辑器顶栏:紧凑胶囊式,参考图3 */
|
||||
.iwb-canvas-topbar { height: 56px; background: var(--iwb-bg); border-bottom: 1px solid var(--iwb-border); padding: 0 12px; box-shadow: none; gap: 2px; }
|
||||
|
||||
.iwb-canvas-menu { width: 34px; height: 34px; }
|
||||
.iwb-canvas-title { font-weight: 600; font-size: 14px; margin: 0 6px 0 2px; }
|
||||
.iwb-canvas-title { margin: 0 6px 0 2px; }
|
||||
.iwb-canvas-status { color: var(--iwb-text2); font-size: 12px; }
|
||||
.iwb-top-nav-icon { width: 32px; height: 32px; }
|
||||
.iwb-top-nav-icon {
|
||||
padding: 0;
|
||||
min-height: 38px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
/* 资源展开按钮:顶部贴左(参考图2),带 panel 图标 */
|
||||
/* 左侧资源面板:贴左边展开(参考图2) */
|
||||
/* v9:首页不留左栏按钮;优化首页文字与按钮大小;卡片重命名输入框 */
|
||||
@@ -1250,27 +1227,25 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-landing-actions .iwb-btn-primary { background: #111; color: #fff; }
|
||||
.iwb-landing-divider { margin: 90px auto 54px; }
|
||||
.iwb-landing-panel h2 { font-size: 28px; color: var(--iwb-text); margin-bottom: 10px; }
|
||||
.iwb-home-card-rename { flex: 1 1 auto; min-width: 0; height: 36px; font-size: 15px; }
|
||||
/* v10:我的画布卡片交互——默认隐藏复选框与操作图标,hover 显示;批量管理模式显示复选框 */
|
||||
.iwb-home-card-check { display: none; }
|
||||
.iwb-home-card-check-placeholder { flex: 0 0 18px; width: 18px; height: 18px; }
|
||||
.iwb-home-card.iwb-manage .iwb-home-card-check { display: inline-block; }
|
||||
.iwb-home-card.iwb-manage .iwb-home-card-check-placeholder { display: none; }
|
||||
.iwb-home-card-actions { opacity: 0; transition: opacity .15s ease; }
|
||||
|
||||
.iwb-home-card:hover .iwb-home-card-actions,
|
||||
.iwb-home-card:focus-within .iwb-home-card-actions { opacity: 1; }
|
||||
.iwb-home-card-rename { flex: 1 1 auto; min-width: 0; height: 34px; font-size: 15px; color: var(--iwb-text); background: var(--iwb-bg); border: 1px solid var(--iwb-border2); border-radius: 8px; padding: 0 10px; }
|
||||
.iwb-home-actions .iwb-btn { min-height: 36px; }
|
||||
/* v11:统一画布卡片对齐与排版 */
|
||||
.iwb-home-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; max-width: 1600px; }
|
||||
.iwb-home-card { min-height: 176px; box-sizing: border-box; background: color-mix(in srgb, var(--iwb-panel) 52%, var(--iwb-home-bg) 48%); border: 1px solid var(--iwb-border); border-radius: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
|
||||
|
||||
|
||||
.iwb-home-card:hover { border-color: var(--iwb-border2); background: color-mix(in srgb, var(--iwb-panel) 76%, var(--iwb-home-bg) 24%); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
|
||||
.iwb-home-card-top { padding: 24px 22px 0 22px; }
|
||||
.iwb-home-card-title strong { font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--iwb-text); }
|
||||
.iwb-home-card-meta { padding: 14px 22px 0 22px; color: var(--iwb-text2); font-size: 13px; line-height: 1.5; }
|
||||
.iwb-home-card-foot { padding: 0 22px 20px 22px; }
|
||||
|
||||
.iwb-home-card-foot small { color: var(--iwb-text2); font-size: 12px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; flex: 1 1 auto; }
|
||||
.iwb-home-card-actions { flex: 0 0 auto; }
|
||||
|
||||
.iwb-home-card-actions button { width: 32px; height: 32px; border-radius: 8px; }
|
||||
/* v12:世界容器提升为合成层(节点随世界一起 transform,不单独建层) */
|
||||
.iwb-world { will-change: transform; }
|
||||
@@ -1280,7 +1255,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-overlay.drawer-open .iwb-toolbar-wrap { left: var(--iwb-dock-l, 0px) !important; }
|
||||
.iwb-overlay.drawer-open .iwb-minimap { margin-left: 0 !important; }
|
||||
/* 画布顶栏:标题 + 实时通知 + 右侧图标组(padding-left 14px = 标签条 padding,标题左缘与房子图标对齐;52px 是左侧栏时代的遗留已废弃) */
|
||||
.iwb-canvas-topbar { gap: 8px; padding: 0 14px; }
|
||||
|
||||
.iwb-canvas-meta { display: flex; align-items: center; gap: 8px; overflow: hidden; }
|
||||
.iwb-canvas-meta .iwb-status-item { font-size: 11px; color: var(--iwb-text2); white-space: nowrap; }
|
||||
.iwb-canvas-meta .iwb-status-ok { color: var(--iwb-brand); }
|
||||
@@ -1314,7 +1289,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-tab-home { padding: 0 9px; }
|
||||
.iwb-tab-home .iwb-ic { width: 16px; height: 16px; }
|
||||
/* 标签条出现时顶栏下移(仅画布视图;覆盖共享 top:0 规则) */
|
||||
.iwb-canvas-topbar { top: 36px; }
|
||||
|
||||
/* 标签条始终顶左对齐(不随左侧栏展开缩进——标签条在最顶层、横跨全宽) */
|
||||
|
||||
/* 资源中心浮动窗口:自由拖动、统一白色圆角样式 */
|
||||
@@ -1340,28 +1315,25 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-full-main > .iwb-groups-embedded, .iwb-full-main > .iwb-history-embedded { width: 100%; flex: 1 1 auto; }
|
||||
|
||||
/* 我的画布卡片:文本左对齐、底部图标右对齐、批量选中高亮、重命名放大、分类 */
|
||||
.iwb-home-card { align-items: flex-start; }
|
||||
|
||||
.iwb-home-card-title { text-align: left; justify-content: flex-start; width: 100%; }
|
||||
.iwb-home-card-title strong { text-align: left; width: 100%; }
|
||||
.iwb-home-card-meta { display: flex; align-items: center; gap: 8px; text-align: left; }
|
||||
|
||||
.iwb-home-card-meta-text { color: var(--iwb-text2); font-size: 13px; }
|
||||
.iwb-home-card-cat { border: 1px solid var(--iwb-border); border-radius: 999px; padding: 2px 10px; font-size: 11px; color: var(--iwb-text2); background: color-mix(in srgb, var(--iwb-text) 6%, transparent); cursor: pointer; white-space: nowrap; }
|
||||
.iwb-home-card-cat-empty { color: var(--iwb-text2); background: transparent; border-color: var(--iwb-border2); }
|
||||
.iwb-home-card-cat:hover { border-color: var(--iwb-border2); color: var(--iwb-text); }
|
||||
.iwb-home-card-actions { margin-left: auto; justify-content: flex-end; }
|
||||
.iwb-home-card-actions button { display: inline-flex; align-items: center; justify-content: center; }
|
||||
.iwb-home-card-selected { border-color: var(--iwb-border2); box-shadow: 0 0 0 1px var(--iwb-border2), 0 6px 18px rgba(0,0,0,.10); background: color-mix(in srgb, var(--iwb-panel) 72%, var(--iwb-layer) 28%); }
|
||||
.iwb-home-card-top .iwb-home-card-rename { height: 42px; font-size: 16px; flex: 1 1 auto; min-width: 0; box-sizing: border-box; }
|
||||
.iwb-home-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
|
||||
.iwb-home-cats { display: flex; flex-wrap: wrap; gap: 8px; }
|
||||
.iwb-home-cats .iwb-chip { cursor: pointer; }
|
||||
|
||||
/* 画布库:卡片撑满、去右侧留白、卡片更紧凑 */
|
||||
.iwb-home-panel { padding-left: 24px; padding-right: 24px; }
|
||||
.iwb-home-grid { max-width: none; width: 100%; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
|
||||
.iwb-home-card { min-height: 150px; box-sizing: border-box; }
|
||||
|
||||
.iwb-home-card-top { padding-top: 18px; padding-left: 20px; padding-right: 20px; }
|
||||
.iwb-home-card-meta { padding-top: 10px; padding-left: 20px; padding-right: 20px; }
|
||||
.iwb-home-card-foot { padding: 0 20px 16px 20px; }
|
||||
|
||||
|
||||
/* 资源中心窗口四向缩放手柄 */
|
||||
|
||||
@@ -1378,12 +1350,12 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-home-cats { margin-top: 16px; margin-bottom: 4px; }
|
||||
|
||||
/* 画布卡片:底部三个图标在卡片内右对齐 */
|
||||
.iwb-home-card-foot { justify-content: flex-end; }
|
||||
.iwb-home-card-actions { width: auto; margin-left: auto; justify-content: flex-end; }
|
||||
|
||||
.iwb-home-card-actions { display: flex; gap: 6px; opacity: 0; transition: opacity .15s ease; flex: 0 0 auto; width: auto; margin-left: auto; justify-content: flex-end; }
|
||||
.iwb-home-card-foot .iwb-home-card-actions { width: auto; }
|
||||
|
||||
.iwb-home-card-foot { width: 100%; }
|
||||
.iwb-home-card-meta { width: 100%; }
|
||||
|
||||
|
||||
|
||||
/* 画布库:顶部导航与内容水平对齐(统一左 24px,撑满) */
|
||||
.iwb-product-nav { padding-left: 24px; padding-right: 24px; }
|
||||
@@ -1422,13 +1394,13 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-home-main-head .iwb-btn:hover { background: color-mix(in srgb, var(--iwb-panel) 65%, var(--iwb-home-bg) 35%); }
|
||||
.iwb-home-main-head .iwb-btn-primary { background: var(--iwb-text2); border-color: var(--iwb-text2); color: #fff; }
|
||||
.iwb-home-main-head .iwb-btn-primary:hover { background: color-mix(in srgb, var(--iwb-text2) 80%, #000); border-color: color-mix(in srgb, var(--iwb-text2) 80%, #000); color: #fff; }
|
||||
.iwb-home-grid { margin-top: 22px; max-width: none; width: 100%; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
|
||||
.iwb-home-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); max-width: none; margin-top: 22px; width: 100%; }
|
||||
|
||||
.iwb-home-empty { margin-top: 40px; color: var(--iwb-text2); font-size: 15px; text-align: center; padding: 40px 0; }
|
||||
|
||||
.iwb-home-card .iwb-home-card-top { padding: 20px 20px 0 20px; }
|
||||
.iwb-home-card-meta { padding: 12px 20px 0 20px; }
|
||||
.iwb-home-card-foot { padding: 0 20px 18px 20px; }
|
||||
|
||||
.iwb-home-card-foot { margin-top: auto; display: flex; align-items: center; justify-content: flex-end; gap: 12px; width: 100%; padding: 0 20px 18px 20px; }
|
||||
.iwb-home-card-star { border: 0; background: transparent; color: var(--iwb-text2); font-size: 18px; cursor: pointer; line-height: 1; padding: 0; }
|
||||
.iwb-home-card-star.on { color: var(--iwb-text); }
|
||||
.iwb-home-card-star:hover { color: var(--iwb-text); }
|
||||
@@ -1466,8 +1438,27 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-overlay .iwb-enter-loading { background: color-mix(in srgb, var(--iwb-bg) 97%, transparent); backdrop-filter: blur(4px); }
|
||||
|
||||
/* 卡片按参考排版:名字 / 统计 / 底部行(分类chip左+图标右) */
|
||||
.iwb-home-card { min-height: 138px; }
|
||||
.iwb-home-card-meta { min-height: 18px; }
|
||||
.iwb-home-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 0;
|
||||
color: var(--iwb-text);
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
padding: 0;
|
||||
min-width: 0;
|
||||
min-height: 138px;
|
||||
overflow: hidden;
|
||||
background: color-mix(in srgb, var(--iwb-panel) 52%, var(--iwb-home-bg) 48%);
|
||||
border: 1px solid var(--iwb-border);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 1px 4px rgba(0,0,0,.05);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.iwb-home-card-meta { color: var(--iwb-text2); font-size: 13px; line-height: 1.5; display: flex; align-items: center; gap: 8px; text-align: left; padding-top: 10px; padding-left: 20px; padding-right: 20px; width: 100%; padding: 12px 20px 0 20px; min-height: 18px; }
|
||||
.iwb-home-card .iwb-home-card-foot { justify-content: space-between; gap: 10px; align-items: center; }
|
||||
.iwb-home-card .iwb-home-card-foot .iwb-home-card-cat { flex: 0 0 auto; }
|
||||
|
||||
@@ -1483,7 +1474,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-home-menu-btn:hover { background: var(--iwb-layer2); border-color: var(--iwb-border2); color: var(--iwb-text); }
|
||||
.iwb-home-menu-btn .iwb-ic { width: 18px; height: 18px; }
|
||||
.iwb-home-menu-mask { position: fixed; inset: 0; z-index: 200; }
|
||||
.iwb-home-menu { position: fixed; width: 220px; background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: 12px; box-shadow: var(--sh-lg); padding: 6px; display: flex; flex-direction: column; gap: 2px; z-index: 201; box-sizing: border-box; }
|
||||
.iwb-home-menu { position: fixed; width: 220px; background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: 12px; box-shadow: var(--sh-lg); padding: 6px; display: flex; flex-direction: column; gap: 2px; box-sizing: border-box; }
|
||||
.iwb-home-menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; background: transparent; color: var(--iwb-text); font-size: 14px; cursor: pointer; border-radius: 8px; text-align: left; width: 100%; box-sizing: border-box; }
|
||||
.iwb-home-menu-item:hover { background: var(--iwb-layer2); }
|
||||
.iwb-home-menu-item .iwb-ic { color: var(--iwb-text2); }
|
||||
@@ -1506,7 +1497,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
/* 图库历史项图片:完整展示 + 上限尺寸(放大量大面板也不无限变大) */
|
||||
.iwb-history-embedded .iwb-history-item img { max-width: 100%; max-height: none; object-fit: contain; margin: 0 auto; }
|
||||
/* 编辑器顶栏:透明悬浮(对齐参考图样式),画布铺满视口让点阵/网格透过顶栏 */
|
||||
.iwb-canvas-topbar { background: transparent !important; border-bottom: 0 !important; box-shadow: none !important; pointer-events: none; }
|
||||
|
||||
.iwb-canvas-topbar button:not(.iwb-canvas-title), .iwb-canvas-topbar input, .iwb-canvas-topbar label { pointer-events: auto; }
|
||||
.iwb-canvas-title { pointer-events: auto; }
|
||||
.iwb-canvas, .ws-expanded .iwb-canvas { top: 0 !important; }
|
||||
@@ -1648,7 +1639,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-pop-anchor { position: fixed; z-index: 3200; }
|
||||
.iwb-pop { width: 380px; max-width: calc(100vw - 16px); background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: 18px; box-shadow: 0 18px 54px rgba(28,25,23,.16); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 32px); overflow-y: auto; }
|
||||
.iwb-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
||||
.iwb-pop-title { font-size: 14px; font-weight: 700; color: var(--iwb-text); }
|
||||
.iwb-pop-title { font-weight: 700; color: var(--iwb-text); }
|
||||
.iwb-pop-body { display: flex; flex-direction: column; gap: 12px; }
|
||||
/* 纯描边胶囊:与截图一致(选中只加重描边与文字色,不填充) */
|
||||
.iwb-chip-line { background: transparent; border: 1px solid var(--iwb-border); color: var(--iwb-text); border-radius: 999px; padding: 5px 14px; }
|
||||
@@ -1695,13 +1686,6 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
/* ===== v3.86.7 通用选择气泡(PickerBubble):与图像设置面板同一套 popover 外观 ===== */
|
||||
/* v3.87.3:面板宽度按内容自适应(原来写死 240px,长模型名被硬切且连省略号都没有)。
|
||||
max-content + 上限:常见模型名(约 30 字符 / 15px ≈ 290px)可整行显示;极端长名/窄屏退到上限并用省略号 + title。 */
|
||||
.iwb-picklist { display: flex; flex-direction: column; gap: 6px; }
|
||||
display: flex; align-items: center; width: 100%; min-width: 0; min-height: 38px;
|
||||
padding: 6px 12px; border: 1px solid var(--iwb-border); border-radius: 10px;
|
||||
background: var(--iwb-panel); color: var(--iwb-text); font-size: 15px;
|
||||
text-align: left; cursor: pointer;
|
||||
transition: border-color 0.15s, color 0.15s;
|
||||
}
|
||||
/* 文本必须包在块级子元素里,省略号才生效(flex 容器上的 text-overflow 对裸文本无效 → 原来长名是硬切) */
|
||||
/* 选中项 = 品牌色描边 + 品牌色文字(与 .iwb-chip-line-on 同一套选中语言,只加重不填充) */
|
||||
|
||||
@@ -1758,7 +1742,6 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
/* v3.87.29 厂商分类(决定请求体怎么发尺寸) */
|
||||
.iwb-shape-box { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
|
||||
.iwb-shape-box .iwb-textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
|
||||
.iwb-modelrow-kind { max-width: 104px; flex: 0 0 auto; }
|
||||
/* v3.87.30 修复设置弹窗内的挤压/换行(新增厂商分类控件后暴露) */
|
||||
.iwb-addr-tag { flex: 0 0 auto; min-width: 44px; white-space: nowrap; text-align: right; }
|
||||
.iwb-modelrow { flex: 1 1 340px; min-width: 0; display: flex; align-items: center; gap: 8px; }
|
||||
@@ -1814,7 +1797,6 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-set-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--iwb-border); border-radius: 10px; background: var(--iwb-layer); margin-top: 10px; }
|
||||
.iwb-set-row > input { justify-self: end; }
|
||||
.iwb-set-row-text { min-width: 0; }
|
||||
.iwb-set-row-title { font-size: 13.5px; }
|
||||
.iwb-set-row-desc { font-size: 12.5px; color: var(--iwb-text2); margin-top: 2px; line-height: 1.5; }
|
||||
|
||||
/* ── 「模型设置」面板(2026-10-30):服务商 / 分组 / 模型 ─────────────────────
|
||||
@@ -2025,16 +2007,13 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
|
||||
/* 插件市场卡片(设置 → 插件 / 与 market.maqiart.eu.org 同一套视觉) */
|
||||
.iwb-mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 4px 0 6px; }
|
||||
.iwb-mk-card { border: 1px solid var(--iwb-border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 132px; }
|
||||
.iwb-mk-head { display: flex; gap: 10px; align-items: center; }
|
||||
.iwb-mk-avatar { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex: 0 0 36px; }
|
||||
.iwb-mk-titles { min-width: 0; }
|
||||
.iwb-mk-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; flex-wrap: wrap; }
|
||||
.iwb-mk-sub { color: var(--iwb-text2); font-size: 12px; margin-top: 2px; }
|
||||
.iwb-mk-desc { color: var(--iwb-text2); font-size: 12.5px; line-height: 1.5; flex: 1 1 auto; }
|
||||
.iwb-mk-tags { display: flex; gap: 6px; flex-wrap: wrap; }
|
||||
.iwb-mk-tag { padding: 1px 8px; border-radius: 999px; background: var(--iwb-layer2); color: var(--iwb-text2); font-size: 11px; }
|
||||
.iwb-mk-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 2px; }
|
||||
.iwb-mk-head { display: flex; }
|
||||
.iwb-mk-avatar { display: flex; align-items: center; justify-content: center; flex: 0 0 36px; }
|
||||
.iwb-mk-name { display: flex; align-items: center; flex-wrap: wrap; }
|
||||
.iwb-mk-desc { flex: 1 1 auto; }
|
||||
.iwb-mk-tags { display: flex; flex-wrap: wrap; }
|
||||
|
||||
.iwb-mk-actions { display: flex; justify-content: flex-end; margin-top: 2px; }
|
||||
/* 设置行(Obsidian 风格:标题 + 说明 + 右侧控件) */
|
||||
.iwb-set-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--iwb-border); }
|
||||
.iwb-set-row-main { flex: 1 1 auto; min-width: 0; }
|
||||
@@ -2051,17 +2030,17 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
|
||||
/* 已安装插件:横向列表 */
|
||||
.iwb-mk-list { display: flex; flex-direction: column; }
|
||||
.iwb-mk-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--iwb-border); }
|
||||
|
||||
.iwb-mk-row-main { flex: 1 1 auto; min-width: 0; }
|
||||
.iwb-mk-row-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
||||
.iwb-mk-row-name { font-weight: 600; font-size: 14px; }
|
||||
.iwb-mk-row-ver { color: var(--iwb-text2); font-size: 12px; }
|
||||
.iwb-mk-row-author { color: var(--iwb-text2); font-size: 12px; }
|
||||
.iwb-mk-row-desc { color: var(--iwb-text2); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.iwb-mk-row-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
|
||||
.iwb-mk-row-actions { display: flex; align-items: center; flex: 0 0 auto; }
|
||||
.iwb-mk-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
|
||||
.iwb-mk-chip { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--iwb-border); background: transparent; color: var(--iwb-text2); font-size: 12px; cursor: pointer; }
|
||||
.iwb-mk-chip.on { background: var(--iwb-text); color: var(--iwb-layer); border-color: var(--iwb-text); }
|
||||
|
||||
.iwb-mk-chip.on { border-color: var(--iwb-text); }
|
||||
/* 插件设置:行(无边框盒子,只有细分隔线) */
|
||||
.iwb-mk-setrow { display: flex; align-items: center; gap: 16px; padding: 14px 2px; border: 0; border-bottom: 1px solid var(--iwb-border); background: transparent; border-radius: 0; margin: 0; }
|
||||
.iwb-mk-setrow:last-of-type { border-bottom: 0; }
|
||||
@@ -2081,14 +2060,14 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-mk-filters .iwb-mk-sep { width: 1px; height: 16px; background: var(--iwb-border); margin: 0 4px; }
|
||||
/* 市场卡片:等高、底部按钮对齐 */
|
||||
.iwb-mk-grid { align-items: stretch; }
|
||||
.iwb-mk-card { min-height: 178px; display: flex; flex-direction: column; gap: 8px; }
|
||||
.iwb-mk-card .iwb-mk-desc { flex: 1 1 auto; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
|
||||
.iwb-mk-card .iwb-mk-tags { min-height: 20px; align-items: center; }
|
||||
|
||||
.iwb-mk-card .iwb-mk-desc { flex: 1 1 auto; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
||||
.iwb-mk-card .iwb-mk-tags { align-items: center; }
|
||||
.iwb-mk-card .iwb-mk-actions { margin-top: auto; display: flex; align-items: center; justify-content: flex-end; min-height: 30px; }
|
||||
.iwb-mk-card .iwb-mk-name { line-height: 1.35; }
|
||||
.iwb-mk-card .iwb-plugin-tag { font-size: 11px; padding: 0 6px; line-height: 16px; }
|
||||
/* 市场卡片:紧凑版(按钮在右上角,去掉底部空档) */
|
||||
.iwb-mk-card { min-height: 0; padding: 10px 12px; gap: 6px; border-radius: 10px; }
|
||||
|
||||
.iwb-mk-head { align-items: flex-start; gap: 8px; }
|
||||
.iwb-mk-titles { flex: 1 1 auto; min-width: 0; }
|
||||
.iwb-mk-head .iwb-mk-actions { flex: 0 0 auto; margin: 0; padding: 0; min-height: 0; }
|
||||
@@ -2098,7 +2077,6 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-mk-card .iwb-mk-desc { font-size: 12px; line-height: 1.45; min-height: 0; margin-top: 2px; }
|
||||
.iwb-mk-card .iwb-mk-tags { min-height: 0; margin-top: 2px; gap: 5px; }
|
||||
.iwb-mk-card .iwb-mk-tag { font-size: 10.5px; padding: 0 7px; line-height: 16px; }
|
||||
.iwb-mk-grid { gap: 10px; }
|
||||
.iwb-mk-card .iwb-btn-sm { padding: 3px 10px; font-size: 12px; }
|
||||
/* LLM 渠道:去掉外框,改成分区 + 细分隔线;默认渠道用左侧色条标记 */
|
||||
.iwb-settings-modal .iwb-llm-card { border: 0; border-top: 1px solid var(--iwb-border); border-radius: 0; background: transparent; padding: 12px 0 8px; margin: 0; }
|
||||
@@ -2228,14 +2206,29 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
box-shadow: 0 8px 24px rgba(0,0,0,.18); white-space: nowrap;
|
||||
}
|
||||
/* 顶栏与标签条随左右栏内缩(标题跟着缩进;画布仍不动) */
|
||||
.iwb-canvas-topbar { left: var(--iwb-dock-l, 0px) !important; right: var(--iwb-dock-r, 0px) !important; }
|
||||
.iwb-canvas-topbar { padding-left: 10px; padding-right: 14px; box-shadow: none !important; background: transparent !important; height: 56px; border-bottom: 0 !important; padding: 0 14px; gap: 8px; top: 36px; pointer-events: none; left: var(--iwb-dock-l, 0px) !important; right: var(--iwb-dock-r, 0px) !important; }
|
||||
.iwb-tabstrip { left: 0 !important; right: 0 !important; }
|
||||
.iwb-tab-spacer { flex: 1 1 auto; }
|
||||
.iwb-tab-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; pointer-events: auto; }
|
||||
.iwb-tab-actions .iwb-top-nav-icon { width: 28px; height: 28px; min-height: 28px; }
|
||||
/* 其它浮层让位(画布不动) */
|
||||
.iwb-toolbar-wrap { left: var(--iwb-dock-l, 0px); right: calc(60px + var(--iwb-dock-r, 0px)); }
|
||||
.iwb-minimap { right: calc(62px + var(--iwb-dock-r, 0px)); bottom: 14px; }
|
||||
.iwb-minimap {
|
||||
transition: opacity .16s ease, transform .16s ease;
|
||||
position: absolute;
|
||||
width: 132px;
|
||||
height: 88px;
|
||||
background: var(--iwb-panel);
|
||||
border: 1px solid var(--iwb-border);
|
||||
border-radius: 8px;
|
||||
z-index: 11;
|
||||
cursor: crosshair;
|
||||
overflow: hidden;
|
||||
touch-action: none;
|
||||
box-shadow: 0 4px 16px rgba(0,0,0,0.12);
|
||||
right: calc(62px + var(--iwb-dock-r, 0px));
|
||||
bottom: 14px;
|
||||
}
|
||||
.iwb-statusbar { right: calc(62px + var(--iwb-dock-r, 0px)); }
|
||||
.iwb-hint-bottom { left: calc(var(--iwb-dock-l, 0px) + (100% - var(--iwb-dock-l, 0px) - var(--iwb-dock-r, 0px)) / 2); }
|
||||
|
||||
@@ -2379,3 +2372,109 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-dock-body[data-panel="prompts"] .iwb-pcard:hover,
|
||||
.iwb-dock-body[data-panel="groups"] .iwb-pcard:hover { background: var(--iwb-plugin-hover); border-color: var(--iwb-border2); }
|
||||
.iwb-dock-body[data-panel="groups"] .iwb-pcard-selected { border-color: var(--iwb-brand); box-shadow: 0 0 0 1px var(--iwb-brand); }
|
||||
|
||||
/* ── v3.26.24 插件市场重设计:去线框、块面分区、按钮收敛 ───────────────── */
|
||||
.iwb-set-page { max-width: 1180px; }
|
||||
.iwb-mk-toolbar {
|
||||
display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
|
||||
background: var(--iwb-layer); border-radius: 12px; padding: 8px 10px; margin: 6px 0 12px;
|
||||
}
|
||||
.iwb-mk-toolbar .iwb-input { border: 0; background: var(--iwb-layer2); box-shadow: none; }
|
||||
.iwb-mk-toolbar .iwb-input:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--iwb-brand) 22%, transparent); }
|
||||
.iwb-mk-filters { margin: 0; gap: 6px; }
|
||||
|
||||
.iwb-mk-chip:hover { background: var(--iwb-layer2); color: var(--iwb-text); }
|
||||
.iwb-mk-chip.on { background: var(--iwb-text); color: var(--iwb-layer); }
|
||||
|
||||
.iwb-mk-avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 17px; }
|
||||
.iwb-mk-name { font-weight: 600; font-size: 13.5px; }
|
||||
.iwb-mk-sub { font-size: 11.5px; color: var(--iwb-text2); margin-top: 1px; }
|
||||
.iwb-mk-desc { font-size: 12px; line-height: 1.55; color: var(--iwb-text2); }
|
||||
.iwb-mk-dot {
|
||||
width: 7px; height: 7px; border-radius: 50%; margin-left: 6px; flex: 0 0 auto;
|
||||
background: var(--iwb-ok, #1d9e75); box-shadow: 0 0 0 2px color-mix(in srgb, var(--iwb-ok, #1d9e75) 22%, transparent);
|
||||
}
|
||||
.iwb-mk-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
|
||||
.iwb-mk-tags { gap: 4px; }
|
||||
.iwb-mk-tag { border-radius: 999px; background: var(--iwb-layer2); color: var(--iwb-text2); font-size: 10.5px; padding: 1px 7px; }
|
||||
.iwb-mk-actions { gap: 6px; }
|
||||
.iwb-mk-actions .iwb-btn { border: 0; background: var(--iwb-layer2); box-shadow: none; }
|
||||
.iwb-mk-subtitle { font-size: 11.5px; color: var(--iwb-text2); margin: 2px 0 10px; }
|
||||
.iwb-set-page-title { margin-bottom: 2px; }
|
||||
|
||||
/* ── v3.26.25 插件市场二次优化:自适应全宽 + 淡描边 + 已安装徽标(去绿色底) ── */
|
||||
.iwb-set-page { max-width: none; }
|
||||
|
||||
.iwb-mk-card.is-installed { background: var(--iwb-panel); }
|
||||
.iwb-mk-badge {
|
||||
margin-left: 7px; padding: 0 7px; border-radius: 999px; font-size: 10.5px; line-height: 17px;
|
||||
background: color-mix(in srgb, var(--iwb-ok, #1d9e75) 14%, transparent);
|
||||
color: color-mix(in srgb, var(--iwb-ok, #1d9e75) 82%, var(--iwb-text));
|
||||
border: 1px solid color-mix(in srgb, var(--iwb-ok, #1d9e75) 32%, transparent);
|
||||
}
|
||||
.iwb-mk-grid { grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 14px; }
|
||||
.iwb-mk-toolbar { border: 1px solid color-mix(in srgb, var(--iwb-border) 45%, transparent); }
|
||||
/* 管理页:行块面化、宽度自适应、操作列右对齐 */
|
||||
.iwb-mk-list { display: flex; flex-direction: column; gap: 8px; }
|
||||
.iwb-mk-row-actions { gap: 6px; }
|
||||
|
||||
/* ── v3.26.26 插件市场:补回按钮/卡片的“浮动”触感 ───────────────── */
|
||||
|
||||
.iwb-mk-actions .iwb-btn { transition: transform .12s ease, box-shadow .12s ease, background .12s ease; }
|
||||
.iwb-mk-chip {
|
||||
cursor: pointer;
|
||||
border: 0;
|
||||
background: var(--iwb-layer);
|
||||
color: var(--iwb-text2);
|
||||
padding: 4px 12px;
|
||||
border-radius: 999px;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
transition: transform .12s ease, background .12s ease, color .12s ease;
|
||||
}
|
||||
|
||||
/* ── v3.26.27 插件市场/管理:去掉浮动,只保留颜色反馈;移除按钮给浅底;管理页回到横线分隔 ── */
|
||||
.iwb-mk-card, .iwb-mk-card:hover, .iwb-mk-card:active { transform: none; }
|
||||
.iwb-mk-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: 14px;
|
||||
padding: 14px;
|
||||
gap: 10px;
|
||||
min-height: 168px;
|
||||
background: var(--iwb-panel);
|
||||
border: 1px solid color-mix(in srgb, var(--iwb-border) 55%, transparent);
|
||||
transition: background .14s ease, border-color .14s ease, box-shadow .14s ease;
|
||||
box-shadow: none;
|
||||
}
|
||||
.iwb-mk-card:hover {
|
||||
background: color-mix(in srgb, var(--iwb-layer) 55%, var(--iwb-panel));
|
||||
border-color: color-mix(in srgb, var(--iwb-border2) 62%, transparent);
|
||||
box-shadow: none;
|
||||
}
|
||||
/* 操作按钮:默认给浅底,看起来像按钮 */
|
||||
.iwb-mk-actions .iwb-btn {
|
||||
transform: none; box-shadow: none;
|
||||
background: color-mix(in srgb, var(--iwb-text) 6%, var(--iwb-panel));
|
||||
transition: background .12s ease, color .12s ease;
|
||||
}
|
||||
.iwb-mk-actions .iwb-btn:hover {
|
||||
transform: none; box-shadow: none;
|
||||
background: color-mix(in srgb, var(--iwb-text) 11%, var(--iwb-panel));
|
||||
}
|
||||
.iwb-mk-actions .iwb-btn:active { transform: none; box-shadow: none; background: color-mix(in srgb, var(--iwb-text) 16%, var(--iwb-panel)); }
|
||||
.iwb-mk-actions .iwb-btn-primary {
|
||||
background: var(--iwb-text); color: var(--iwb-layer);
|
||||
}
|
||||
.iwb-mk-actions .iwb-btn-primary:hover { background: color-mix(in srgb, var(--iwb-text) 86%, var(--iwb-layer)); box-shadow: none; }
|
||||
.iwb-mk-chip, .iwb-mk-chip:hover, .iwb-mk-chip:active { transform: none; }
|
||||
/* 管理页:横线分隔 + 悬停变色,不浮动 */
|
||||
.iwb-mk-list { gap: 0; }
|
||||
.iwb-mk-row { display: flex; align-items: center; gap: 12px; background: transparent; border-radius: 0; padding: 12px 6px; border-bottom: 1px solid color-mix(in srgb, var(--iwb-border) 62%, transparent); transform: none; box-shadow: none; transition: background .12s ease; }
|
||||
.iwb-mk-row:last-child { border-bottom: 0; }
|
||||
.iwb-mk-row:hover { background: color-mix(in srgb, var(--iwb-text) 3%, transparent); transform: none; box-shadow: none; }
|
||||
.iwb-mk-row-actions .iwb-btn { transform: none; box-shadow: none; transition: background .12s ease; }
|
||||
.iwb-mk-row-actions .iwb-btn:hover { transform: none; box-shadow: none; background: color-mix(in srgb, var(--iwb-text) 10%, var(--iwb-panel)); }
|
||||
|
||||
/* v3.26.38:未进入编辑态的节点正文不参与指针/文本选择 —— 单击=选中节点,双击=编辑 */
|
||||
.iwb-node textarea[readonly], .iwb-node input[readonly] { pointer-events: none; }
|
||||
@@ -48,7 +48,8 @@ const NUMERIC = [
|
||||
['W_OBJURL_MAX', appJs, 50],
|
||||
['W_BLOBREF_MAX', appJs, 50],
|
||||
['DISPLAY_THUMB_CACHE_MAX', appJs, 300],
|
||||
['DISPLAY_THUMB_MAX', appJs, 768],
|
||||
// v3.26.34:缩略图 640px(768 时单张 500~900KB)
|
||||
['DISPLAY_THUMB_MAX', appJs, 640],
|
||||
['outThumbCacheMax', appJs, 400],
|
||||
['W_MAX_LOADED_BOARDS', appJs, 2],
|
||||
['W_SESSION_MAX', sessStore, 5],
|
||||
|
||||
+1
@@ -31,6 +31,7 @@
|
||||
"IWBPluginGroupLib",
|
||||
"IWBPluginHost",
|
||||
"IWBPluginPromptLib",
|
||||
"IWBPromptCover",
|
||||
"IWBProviderPing",
|
||||
"IWBResultImg",
|
||||
"IWBRuntimeBoundary",
|
||||
|
||||
+5
-1
@@ -41,6 +41,8 @@
|
||||
"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",
|
||||
@@ -102,5 +104,7 @@
|
||||
"ui-backup-modal.js",
|
||||
"ui-connect-menu.js",
|
||||
"ui-gen-config-panel.js",
|
||||
"canvas-webview.js"
|
||||
"canvas-webview.js",
|
||||
"plugin-files-policy.js",
|
||||
"image-prompt-cover.js"
|
||||
]
|
||||
@@ -0,0 +1,96 @@
|
||||
// 提示词封面编码(v3.26.34 抽到 src/image-prompt-cover.js):
|
||||
// ① WebP 可用 ⇒ 用 WebP;
|
||||
// ② WebP 不可用 ⇒ 用 JPEG(PNG 回退会导致 448px 仍 300KB);
|
||||
// ③ 两者都不可用 ⇒ 原图兜底;
|
||||
// ④ coverUrl:dataURL 直出、老引用走异步解析。
|
||||
const assert = require('assert')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const src = fs.readFileSync(path.join(__dirname, '..', 'src', 'image-prompt-cover.js'), 'utf8')
|
||||
const sandbox = {}
|
||||
new Function('window', src)(sandbox)
|
||||
const { create } = sandbox.IWBPromptCover
|
||||
|
||||
const SRC = 'data:image/png;base64,AAAA'
|
||||
const WEBP = 'data:image/webp;base64,' + 'W'.repeat(200)
|
||||
const JPEG = 'data:image/jpeg;base64,' + 'J'.repeat(300)
|
||||
const PNG = 'data:image/png;base64,' + 'P'.repeat(900)
|
||||
|
||||
;(async () => {
|
||||
// ① WebP 可用 → 一次调用即返回 webp,不再尝试 jpeg
|
||||
{
|
||||
const calls = []
|
||||
const api = create({
|
||||
compress: async (s, c) => { calls.push(c.format); return c.format === 'webp' ? WEBP : JPEG },
|
||||
resolve: async () => '',
|
||||
})
|
||||
const r = await api.put(SRC)
|
||||
assert.strictEqual(r.ok, true)
|
||||
assert.ok(r.ref.indexOf('data:image/webp') === 0, '应优先用 WebP,实际 ' + r.ref.slice(0, 24))
|
||||
assert.deepStrictEqual(calls, ['webp'], 'WebP 成功时不应再编码 JPEG,实际 ' + calls.join(','))
|
||||
}
|
||||
|
||||
// ② WebP 不可用(返回空)→ 落 JPEG
|
||||
{
|
||||
const calls = []
|
||||
const api = create({
|
||||
compress: async (s, c) => { calls.push(c.format); return c.format === 'webp' ? '' : JPEG },
|
||||
resolve: async () => '',
|
||||
})
|
||||
const r = await api.put(SRC)
|
||||
assert.ok(r.ref.indexOf('data:image/jpeg') === 0, 'WebP 不可用时应落 JPEG,实际 ' + r.ref.slice(0, 24))
|
||||
assert.deepStrictEqual(calls, ['webp', 'jpeg'])
|
||||
}
|
||||
|
||||
// ③ 编码器两种格式都退回 PNG → 若 JPEG 更小则取 JPEG(这就是 448px PNG 300KB 的修复点)
|
||||
{
|
||||
const api = create({
|
||||
compress: async (s, c) => (c.format === 'webp' ? PNG : JPEG),
|
||||
resolve: async () => '',
|
||||
})
|
||||
const r = await api.put(SRC)
|
||||
assert.ok(r.ref.indexOf('data:image/jpeg') === 0, 'PNG 回退时应改用更小的 JPEG,实际 ' + r.ref.slice(0, 24))
|
||||
assert.ok(r.ref.length < PNG.length, '结果应比 PNG 小')
|
||||
}
|
||||
|
||||
// ④ 全部编码失败 → 原图兜底(不丢封面)
|
||||
{
|
||||
const api = create({ compress: async () => '', resolve: async () => '' })
|
||||
const r = await api.put(SRC)
|
||||
assert.strictEqual(r.ok, true)
|
||||
assert.strictEqual(r.ref, SRC, '编码全失败时应保留原图')
|
||||
}
|
||||
|
||||
// ⑤ 非 dataURL 输入 → 明确失败
|
||||
{
|
||||
const api = create({ compress: async () => WEBP, resolve: async () => '' })
|
||||
const r = await api.put('https://example.com/a.png')
|
||||
assert.strictEqual(r.ok, false, '外链不应被当作封面保存')
|
||||
}
|
||||
|
||||
// ⑥ coverUrl:dataURL 直出,不触发 resolve
|
||||
{
|
||||
let resolved = 0
|
||||
const api = create({ compress: async () => '', resolve: async () => { resolved++; return 'blob:x' } })
|
||||
const r = await api.url(WEBP)
|
||||
assert.strictEqual(r.ok, true)
|
||||
assert.strictEqual(r.url, WEBP)
|
||||
assert.strictEqual(resolved, 0, 'dataURL 不应走引用解析')
|
||||
const r2 = await api.url({ __blob: 'imgblob_1' })
|
||||
assert.strictEqual(r2.url, 'blob:x', '老引用应异步解析')
|
||||
assert.strictEqual(resolved, 1)
|
||||
}
|
||||
|
||||
// ⑦ 节点宽度映射(比例不定)
|
||||
{
|
||||
const api = create({ compress: async () => '', resolve: async () => '' })
|
||||
assert.strictEqual(api.nodeWidthForAspect(2.2), 420)
|
||||
assert.strictEqual(api.nodeWidthForAspect(1.6), 340)
|
||||
assert.strictEqual(api.nodeWidthForAspect(1), 280)
|
||||
assert.strictEqual(api.nodeWidthForAspect(0.7), 230)
|
||||
assert.strictEqual(api.nodeWidthForAspect(0.45), 200)
|
||||
}
|
||||
|
||||
console.log('image-prompt-cover checks passed(WebP优先 / JPEG兜底 / PNG回退取小 / 原图兜底 / 直出与引用 / 比例定宽)')
|
||||
})()
|
||||
@@ -17,5 +17,7 @@ assert.ok(source.includes("shellView === 'home' ? el('div', { className: 'iwb-ho
|
||||
assert.ok(css.includes('.iwb-top-nav { height: 64px;'))
|
||||
assert.ok(!css.includes('.iwb-leftrail'))
|
||||
assert.ok(css.includes('.iwb-fullmask { position: fixed; z-index: 260;'))
|
||||
assert.ok(css.includes('.iwb-canvas, .ws-expanded .iwb-canvas { left: 52px; top: 64px;'))
|
||||
// v5 起画布在页面容器内,偏移由容器负责:这里钉住**最终生效**的 0 偏移(旧的 52/64 早已被 !important 覆盖)
|
||||
assert.ok(css.includes('.iwb-canvas, .ws-expanded .iwb-canvas { left: 0 !important; }'))
|
||||
assert.ok(css.includes('.iwb-canvas, .ws-expanded .iwb-canvas { top: 0 !important; }'))
|
||||
console.log('interface hierarchy checks passed')
|
||||
@@ -0,0 +1,48 @@
|
||||
// 原生浮层生命周期守门(v3.26.33 事故规范):
|
||||
// 1) detach() 必须在「延迟 close」之前同步 park;
|
||||
// 2) setSuspended(true) 必须 parkAll;
|
||||
// 3) 离开画布视图时必须 parkAll。
|
||||
// 任何一条退化,都会重新出现“切换面板后旧网页滞留”的问题。
|
||||
const assert = require('assert')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const src = fs.readFileSync(path.join(__dirname, '..', 'src', 'canvas-webview.js'), 'utf8')
|
||||
|
||||
function fnBody (name) {
|
||||
const i = src.indexOf('function ' + name)
|
||||
assert.ok(i >= 0, name + '() 不存在')
|
||||
const open = src.indexOf('{', i)
|
||||
let depth = 0
|
||||
for (let k = open; k < src.length; k++) {
|
||||
if (src[k] === '{') depth++
|
||||
else if (src[k] === '}') { depth--; if (depth === 0) return src.slice(open, k + 1) }
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
// 1) detach:park 必须在 setTimeout(close) 之前
|
||||
{
|
||||
const body = fnBody('detach')
|
||||
const parkAt = body.indexOf('shown !== false')
|
||||
const timerAt = body.indexOf('setTimeout')
|
||||
assert.ok(parkAt >= 0, 'detach() 缺少「锚点消失立即 park」分支')
|
||||
assert.ok(timerAt > parkAt, 'detach() 的 park 必须写在 setTimeout(close) 之前')
|
||||
assert.ok(/push\(\s*st[\s\S]{0,200}?false\s*,\s*null\s*\)/.test(body.slice(parkAt)), 'detach() 的 park 必须以 visible=false 调 push')
|
||||
}
|
||||
|
||||
// 2) setSuspended:暂停时 parkAll
|
||||
{
|
||||
const body = fnBody('setSuspended')
|
||||
assert.ok(/if \(suspended\) parkAll\(\)/.test(body), 'setSuspended(true) 必须调用 parkAll()')
|
||||
}
|
||||
|
||||
// 3) 视图切换:离开 canvas 时 parkAll
|
||||
{
|
||||
assert.ok(/iwb-view-canvas[\s\S]{0,200}?parkAll\(\)/.test(src), '离开画布视图时必须 parkAll()')
|
||||
}
|
||||
|
||||
// 4) 宽限期常量仍在(用于“先隐藏后销毁”,不能被改成 0/删除)
|
||||
assert.ok(/CLOSE_GRACE_MS\s*=\s*\d+/.test(src), 'CLOSE_GRACE_MS 应保留(用于避免重建时重载网页)')
|
||||
|
||||
console.log('native overlay park checks passed(detach 先 park 再 close / suspend parkAll / 离开视图 parkAll / 宽限期保留)')
|
||||
@@ -78,8 +78,10 @@ assert.ok(!source.includes("className: 'iwb-canvas-expand'"))
|
||||
assert.ok(!source.includes("title: '图库(右侧栏)'"))
|
||||
assert.ok(source.includes("title: '显示 / 隐藏左栏'") && source.includes("title: '显示 / 隐藏右栏'"))
|
||||
assert.ok(css.includes('.iwb-landing-actions .iwb-btn { min-height: 42px;'))
|
||||
assert.ok(css.includes('.iwb-home-card-actions { opacity: 0;'))
|
||||
// 合并后规则变紧凑,用正则匹配(属性顺序/空白不敏感)
|
||||
assert.ok(/\.iwb-home-card-actions\s*\{[^}]*opacity:\s*0/.test(css))
|
||||
assert.ok(css.includes('.iwb-home-card.iwb-manage .iwb-home-card-check { display: inline-block; }'))
|
||||
assert.ok(css.includes('.iwb-home-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));'))
|
||||
// 合并后规则变紧凑;且最终生效列宽是 230px(300px 的旧定义早已被覆盖)
|
||||
assert.ok(/\.iwb-home-grid\s*\{[^}]*repeat\(auto-fill,\s*minmax\(230px/.test(css))
|
||||
assert.ok(css.includes('.iwb-home-card-foot small { color: var(--iwb-text2); font-size: 12px; line-height: 1.4; white-space: nowrap;'))
|
||||
console.log('page chrome regression checks passed')
|
||||
@@ -0,0 +1,226 @@
|
||||
'use strict'
|
||||
|
||||
// src/plugin-archive.js 的行为测试。
|
||||
//
|
||||
// 为什么测试要这么细:插件包来自外部,ZIP 解包是这个功能的**信任边界**。
|
||||
// 路径穿越、非法后缀、重名条目、超限条目(zip 炸弹)只要漏一个,
|
||||
// 用户点一次"导入插件"就可能把文件写到插件目录之外,或把内存/磁盘打爆。
|
||||
//
|
||||
// 用 vm 加载真实模块(IIFE 挂 window),并先加载 src/storage-zip.js ——
|
||||
// 测试不 mock ZIP 编解码,测的就是线上真实走的那条链路。
|
||||
// ⚠️ 跨 realm:模块在 vm 里创建对象/数组,原型与本文件不同,
|
||||
// 所以内容比较统一走 JSON,不能用 deepStrictEqual。
|
||||
|
||||
const assert = require('assert')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const vm = require('vm')
|
||||
const root = path.resolve(__dirname, '..')
|
||||
|
||||
const sandbox = {
|
||||
console: { log() {}, warn() {}, error() {} },
|
||||
TextEncoder, TextDecoder, Blob, DataView, Uint8Array, Uint32Array,
|
||||
Response, DecompressionStream, Date, Error, Math, String, Number, Array, Object, JSON, Promise, Set, Map, Boolean, isNaN, parseInt,
|
||||
}
|
||||
vm.runInNewContext(fs.readFileSync(path.join(root, 'src', 'storage-zip.js'), 'utf8'), sandbox)
|
||||
vm.runInNewContext(fs.readFileSync(path.join(root, 'src', 'plugin-archive.js'), 'utf8'), sandbox)
|
||||
|
||||
const Z = sandbox.IWBStorageZip
|
||||
const A = sandbox.IWBPluginArchive
|
||||
assert.ok(Z, '应加载 IWBStorageZip(storage-zip.js 是被测模块的真实依赖)')
|
||||
assert.ok(A, '应导出 IWBPluginArchive')
|
||||
|
||||
const eqJson = (a, b, msg) => assert.strictEqual(JSON.stringify(a), JSON.stringify(b), msg)
|
||||
const eqBytes = (a, b, msg) => eqJson(Array.from(a), Array.from(b), msg)
|
||||
|
||||
// 绕过 IWBPluginArchive.zip 的校验,直接用底层写入器造"恶意 ZIP":
|
||||
// 只有这样才能验证 unzip 自身的防线(真实攻击者也不会经过我们的 zip())。
|
||||
const rawZip = async (entries) => {
|
||||
const w = Z.wCreateStoreZip()
|
||||
for (const [name, data] of entries) await w.add(name, new Blob([data]))
|
||||
return w.finish()
|
||||
}
|
||||
|
||||
const expectReject = async (fn, pattern, label) => {
|
||||
let err = null
|
||||
try { await fn() } catch (e) { err = e }
|
||||
assert.ok(err, label + ':应 reject,实际却成功了')
|
||||
assert.ok(pattern.test(String(err && err.message)),
|
||||
label + ':错误消息应匹配 ' + pattern + ',实际:' + (err && err.message))
|
||||
}
|
||||
|
||||
// 篡改中央目录里的"原始大小"字段:用一个几字节的小 ZIP 模拟声明 16MB/64MB 的炸弹包。
|
||||
// 这类包不需要真的把大字节读进内存,正好用来单独验证上限判断。
|
||||
const patchCentralRawSize = async (blob, size) => {
|
||||
const buf = await blob.arrayBuffer()
|
||||
const dv = new DataView(buf)
|
||||
const u8 = new Uint8Array(buf)
|
||||
const eocd = u8.length - 22
|
||||
const count = dv.getUint16(eocd + 10, true)
|
||||
let p = dv.getUint32(eocd + 16, true)
|
||||
for (let i = 0; i < count; i++) {
|
||||
assert.strictEqual(dv.getUint32(p, true), 0x02014b50, '中央目录签名应正确')
|
||||
dv.setUint32(p + 24, size, true) // 中央目录条目 +24 = 原始大小
|
||||
const nameLen = dv.getUint16(p + 28, true)
|
||||
const extraLen = dv.getUint16(p + 30, true)
|
||||
const commentLen = dv.getUint16(p + 32, true)
|
||||
p += 46 + nameLen + extraLen + commentLen
|
||||
}
|
||||
return new Blob([buf])
|
||||
}
|
||||
|
||||
;(async () => {
|
||||
// ── 1. 导出面与上限常量 ────────────────────────────────────────────────
|
||||
{
|
||||
assert.strictEqual(typeof A.zip, 'function', '应导出 zip')
|
||||
assert.strictEqual(typeof A.unzip, 'function', '应导出 unzip')
|
||||
assert.ok(A.limits && Object.isFrozen(A.limits), 'limits 应是冻结对象,防止运行期被改松')
|
||||
assert.strictEqual(A.limits.maxFiles, 500, '条目上限应为 500')
|
||||
assert.strictEqual(A.limits.maxFileBytes, 16 * 1024 * 1024, '单文件上限应为 16MB')
|
||||
assert.strictEqual(A.limits.maxTotalBytes, 64 * 1024 * 1024, '总大小上限应为 64MB')
|
||||
}
|
||||
|
||||
// ── 2. 往返:zip → unzip,字节逐一致(含中文内容)────────────────────
|
||||
{
|
||||
const binary = new Uint8Array(256)
|
||||
for (let i = 0; i < binary.length; i++) binary[i] = i
|
||||
const blob = await A.zip([
|
||||
{ name: 'data.json', data: JSON.stringify({ title: '中文标题', n: 1 }) },
|
||||
{ name: 'meta.json', data: '{"version":1}' },
|
||||
{ name: 'images/a.jpg', data: binary },
|
||||
])
|
||||
assert.ok(blob && typeof blob.arrayBuffer === 'function', '应产出 Blob')
|
||||
assert.strictEqual(blob.type, 'application/zip', 'ZIP 的 MIME 应为 application/zip')
|
||||
|
||||
const out = await A.unzip(blob)
|
||||
eqJson(out.map((x) => x.name), ['data.json', 'meta.json', 'images/a.jpg'], '条目名与顺序应保持')
|
||||
assert.strictEqual(new TextDecoder().decode(out[0].data), '{"title":"中文标题","n":1}',
|
||||
'字符串内容按 UTF-8 写入、应原样读回(中文不能乱码)')
|
||||
eqBytes(out[2].data, binary, '二进制内容应逐字节一致')
|
||||
assert.strictEqual(Object.prototype.toString.call(out[0].data), '[object Uint8Array]', 'data 应是 Uint8Array')
|
||||
}
|
||||
|
||||
// ── 3. 路径穿越 / 绝对路径 / 反斜杠:打包与解包都必须拒绝 ─────────────
|
||||
{
|
||||
const cases = [
|
||||
['../evil.js', /\.\.|路径段/],
|
||||
['/abs', /绝对路径/],
|
||||
['images/../../x', /\.\.|路径段/],
|
||||
['images\\a.jpg', /反斜杠/],
|
||||
]
|
||||
for (const [name, pattern] of cases) {
|
||||
await expectReject(
|
||||
() => A.zip([{ name, data: new Uint8Array([1]) }]),
|
||||
pattern, 'zip 应拒绝 ' + name
|
||||
)
|
||||
await expectReject(
|
||||
async () => A.unzip(await rawZip([[name, new Uint8Array([1])]])),
|
||||
pattern, 'unzip 应拒绝 ' + name
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// ── 4. 非法后缀 / 非白名单路径 / 中文文件名 ───────────────────────────
|
||||
// 白名单只允许 ASCII 字母数字与 - _ . /,所以中文文件名也应被拒绝
|
||||
// (中文可以出现在 data.json 的**内容**里,但不能出现在路径里)。
|
||||
{
|
||||
await expectReject(
|
||||
() => A.zip([{ name: 'images/a.gif', data: new Uint8Array([1]) }]),
|
||||
/后缀.*images\/a\.gif/, 'zip 应拒绝 .gif'
|
||||
)
|
||||
await expectReject(
|
||||
async () => A.unzip(await rawZip([['images/a.gif', new Uint8Array([1])]])),
|
||||
/后缀.*images\/a\.gif/, 'unzip 应拒绝 .gif'
|
||||
)
|
||||
for (const name of ['other/a.jpg', 'data.json.bak', 'images/nested/a.jpg', 'images/中文.jpg', 'images/a']) {
|
||||
await expectReject(
|
||||
() => A.zip([{ name, data: new Uint8Array([1]) }]),
|
||||
/允许的|子目录|后缀|非法字符/, 'zip 应拒绝白名单外名字 ' + name
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// ── 5. 重名条目:不能让后一个静默覆盖前一个 ───────────────────────────
|
||||
// wOpenZipBlob 内部用普通对象存 files,重名会覆盖;所以 unzip 必须先用
|
||||
// 中央目录预检。这条测试就是防止以后有人把预检"优化"掉。
|
||||
{
|
||||
await expectReject(
|
||||
() => A.zip([
|
||||
{ name: 'images/dup.jpg', data: new Uint8Array([1]) },
|
||||
{ name: 'images/dup.jpg', data: new Uint8Array([2]) },
|
||||
]),
|
||||
/重名.*images\/dup\.jpg/, 'zip 应拒绝重名'
|
||||
)
|
||||
const dup = await rawZip([
|
||||
['images/dup.jpg', new Uint8Array([1])],
|
||||
['images/dup.jpg', new Uint8Array([2])],
|
||||
])
|
||||
await expectReject(() => A.unzip(dup), /重名.*images\/dup\.jpg/, 'unzip 应拒绝重名条目')
|
||||
}
|
||||
|
||||
// ── 6. 条目数 > 500(打包与解包)──────────────────────────────────────
|
||||
{
|
||||
const tooMany = []
|
||||
for (let i = 0; i < 501; i++) tooMany.push({ name: 'images/n' + i + '.jpg', data: new Uint8Array([1]) })
|
||||
await expectReject(() => A.zip(tooMany), /500|文件数/, 'zip 应拒绝 501 个文件')
|
||||
|
||||
const tooManyRaw = []
|
||||
for (let i = 0; i < 501; i++) tooManyRaw.push(['images/n' + i + '.jpg', new Uint8Array([1])])
|
||||
await expectReject(
|
||||
async () => A.unzip(await rawZip(tooManyRaw)),
|
||||
/条目数.*500/, 'unzip 应拒绝 501 个条目'
|
||||
)
|
||||
}
|
||||
|
||||
// ── 7. 单文件 > 16MB:打包侧用真实长度;解包侧用伪造的声明长度 ─────────
|
||||
{
|
||||
const oversized = new Uint8Array(A.limits.maxFileBytes + 1)
|
||||
await expectReject(
|
||||
() => A.zip([{ name: 'images/big.jpg', data: oversized }]),
|
||||
/16MB.*images\/big\.jpg/, 'zip 应拒绝 >16MB 的单文件'
|
||||
)
|
||||
|
||||
const one = await rawZip([['images/a.jpg', new Uint8Array([1, 2, 3])]])
|
||||
const fakeSingle = await patchCentralRawSize(one, A.limits.maxFileBytes + 1)
|
||||
await expectReject(
|
||||
async () => A.unzip(fakeSingle),
|
||||
/16MB.*images\/a\.jpg/, 'unzip 应按声明大小拒绝 >16MB 的单条目(防 zip 炸弹)'
|
||||
)
|
||||
}
|
||||
|
||||
// ── 8. 总解压 > 64MB(声明值伪造,避免测试真的分配 64MB)─────────────
|
||||
{
|
||||
const five = []
|
||||
for (let i = 0; i < 5; i++) five.push(['images/t' + i + '.jpg', new Uint8Array([1])])
|
||||
const blob = await rawZip(five)
|
||||
// 5 × 13MB = 65MB:每个都在 16MB 以内,只有总和超限 → 专门打总大小那条判断。
|
||||
const fakeTotal = await patchCentralRawSize(blob, 13 * 1024 * 1024)
|
||||
await expectReject(() => A.unzip(fakeTotal), /总大小.*64MB/, 'unzip 应拒绝解压后总大小 >64MB')
|
||||
}
|
||||
|
||||
// ── 9. 合法目录条目被跳过;非法输入/类型要显式报错 ───────────────────
|
||||
{
|
||||
const withDir = await rawZip([
|
||||
['images/', new Uint8Array(0)],
|
||||
['images/a.png', new Uint8Array([7, 8])],
|
||||
])
|
||||
const out = await A.unzip(withDir)
|
||||
eqJson(out.map((x) => x.name), ['images/a.png'], 'images/ 目录条目应被跳过,不计入文件')
|
||||
eqBytes(out[0].data, new Uint8Array([7, 8]), '目录后的文件内容应正常读出')
|
||||
|
||||
await expectReject(() => A.zip('not-an-array'), /数组/, 'zip 应拒绝非数组输入')
|
||||
await expectReject(
|
||||
() => A.zip([{ name: 'data.json', data: 123 }]),
|
||||
/Uint8Array 或 string/, 'zip 应拒绝非 Uint8Array/string 的内容'
|
||||
)
|
||||
await expectReject(() => A.unzip('not-a-blob'), /Blob/, 'unzip 应拒绝非 Blob 输入')
|
||||
await expectReject(() => A.unzip(new Blob([new Uint8Array(32)])), /ZIP/, 'unzip 应拒绝非 ZIP 字节')
|
||||
}
|
||||
|
||||
console.log('plugin archive checks passed(往返 + 路径穿越 + 白名单后缀 + 重名 + 条目数/单文件/总大小上限)')
|
||||
// ⚠️ 显式退出:vm/Blob 可能让事件循环挂着(沿用 storage-zip-test 的处理)。
|
||||
process.exit(0)
|
||||
})().catch((e) => {
|
||||
console.error('plugin archive checks FAILED:', e && e.message)
|
||||
process.exit(1)
|
||||
})
|
||||
@@ -0,0 +1,34 @@
|
||||
// 插件文件能力的安全策略(v3.26.36):文件名白名单 + 配额。
|
||||
// 这两条是安全边界,破坏即等于允许路径穿越或塞满磁盘,必须由 CI 守住。
|
||||
const assert = require('assert')
|
||||
const path = require('path')
|
||||
|
||||
const sandbox = {}
|
||||
new Function('window', require('fs').readFileSync(path.join(__dirname, '..', 'src', 'plugin-files-policy.js'), 'utf8'))(sandbox)
|
||||
const P = sandbox.IWBPluginFilesPolicy
|
||||
assert.ok(P && typeof P.fileOk === 'function', '应导出 fileOk')
|
||||
|
||||
// ---- 文件名白名单 ----
|
||||
for (const ok of ['a.jpg', 'a1b2c3.jpg', 'cover_2026-11-22.png', 'x.webp', 'A.JPEG']) {
|
||||
assert.strictEqual(P.fileOk(ok), true, '应允许:' + ok)
|
||||
}
|
||||
for (const bad of [
|
||||
'', '.jpg', 'a.gif', 'a.txt', 'a.jpg/png', '../x.jpg', 'a/b.jpg', '../../etc/passwd',
|
||||
'a' + String.fromCharCode(92) + 'b.jpg', 'a.jpg ', ' a.jpg', 'a.jpg' + String.fromCharCode(0),
|
||||
'a'.repeat(80) + '.jpg', 'x.jpg?1', 'x.jpg#a', '图片.jpg',
|
||||
]) {
|
||||
assert.strictEqual(P.fileOk(bad), false, '应拒绝:' + JSON.stringify(bad))
|
||||
}
|
||||
|
||||
// ---- 配额 ----
|
||||
const L = P.LIMITS
|
||||
assert.ok(L.FILE_MAX > 0 && L.TOTAL_MAX >= L.FILE_MAX)
|
||||
assert.deepStrictEqual(P.quotaOk(0, 1024), { ok: true })
|
||||
assert.strictEqual(P.quotaOk(0, 0).ok, false, '空文件应拒绝')
|
||||
assert.strictEqual(P.quotaOk(0, L.FILE_MAX + 1).reason, 'file-too-large')
|
||||
assert.strictEqual(P.quotaOk(L.TOTAL_MAX - 10, 1024).reason, 'total-too-large')
|
||||
// 覆盖同名文件:旧大小不重复计
|
||||
assert.strictEqual(P.quotaOk(L.TOTAL_MAX - 100, 1024, 4096).ok, true)
|
||||
assert.strictEqual(P.quotaOk(L.TOTAL_MAX - 100, 1024, 0).ok, false)
|
||||
|
||||
console.log('plugin files policy checks passed(白名单/路径穿越/配额/覆盖计费)')
|
||||
@@ -13,7 +13,7 @@ vm.runInNewContext(source, sandbox)
|
||||
const host0 = sandbox.IWBPluginHost
|
||||
assert.ok(Number.isInteger(host0.apiVersion) && host0.apiVersion >= 1, 'apiVersion 必须是正整数')
|
||||
assert.ok(Array.isArray(host0.capabilities) && host0.capabilities.length >= 7, '能力清单应非空')
|
||||
assert.strictEqual(host0.capabilities.slice().sort().join(','), 'canvas,canvasWrite,commands,gallery,generationHooks,grouplib,nodeActions,nodeTypes,panels,promptlib,providers')
|
||||
assert.strictEqual(host0.capabilities.slice().sort().join(','), 'canvas,canvasWrite,commands,files,gallery,generationHooks,grouplib,nodeActions,nodeTypes,panels,promptlib,providers')
|
||||
|
||||
const manifest = (over) => Object.assign({ id: 'demo-plugin', name: 'Demo', version: '1.0.0', apiVersion: 1, capabilities: [] }, over)
|
||||
const stateOf = (ids) => {
|
||||
|
||||
@@ -33,7 +33,7 @@ const wait = (ms) => new Promise((r) => setTimeout(r, ms))
|
||||
{ id: 'q3', name: '未分组的一条', text: '没有分组的', tags: [], group: '' },
|
||||
]
|
||||
let groups = [{ id: '小红书', name: '小红书' }, { id: '收藏', name: '收藏' }]
|
||||
const calls = { save: 0, insert: [], copy: [], notify: [] }
|
||||
const calls = { save: 0, insert: [], copy: [], notify: [], create: [] }
|
||||
let panel = null
|
||||
|
||||
const ctx = {
|
||||
@@ -46,11 +46,23 @@ const wait = (ms) => new Promise((r) => setTimeout(r, ms))
|
||||
notify: (t, ty) => { calls.notify.push([t, ty]) },
|
||||
onChanged: () => () => {},
|
||||
},
|
||||
canvasWrite: {
|
||||
createImageNode: (payload) => { calls.create.push({ type: 'img', payload }); return 'n-img' },
|
||||
createNode: (type, x, y, data) => { calls.create.push({ type, x, y, data }); return 'n1' },
|
||||
},
|
||||
canvas: {
|
||||
screenToWorld: (x, y) => ({ x, y }),
|
||||
|
||||
},
|
||||
}
|
||||
registered.f(ctx)
|
||||
assert.ok(panel && typeof panel.mount === 'function', '应注册面板')
|
||||
|
||||
const host = window.document.getElementById('host')
|
||||
const plCanvas = window.document.createElement('div')
|
||||
plCanvas.className = 'iwb-canvas'
|
||||
window.document.body.appendChild(plCanvas)
|
||||
plCanvas.getBoundingClientRect = () => ({ left: 0, top: 0, right: 800, bottom: 600, width: 800, height: 600 })
|
||||
panel.mount(host) // 宿主只传一个参数
|
||||
await wait(60)
|
||||
|
||||
@@ -84,26 +96,33 @@ const wait = (ms) => new Promise((r) => setTimeout(r, ms))
|
||||
const back = host.querySelector('.iwb-chip-active')
|
||||
assert.ok(back && back.textContent.indexOf('小红书') === 0, '「×」清空后应回到「小红书」,实际 ' + (back && back.textContent))
|
||||
|
||||
// 拖拽 payload
|
||||
// v1.6.15:改为指针拖拽插入(与风格库一致),不再走 HTML5 dataTransfer
|
||||
const canvasEl = window.document.createElement('div')
|
||||
canvasEl.className = 'iwb-canvas'
|
||||
window.document.body.appendChild(canvasEl)
|
||||
canvasEl.getBoundingClientRect = () => ({ left: 0, top: 0, right: 800, bottom: 600, width: 800, height: 600 })
|
||||
const card = cards()[0]
|
||||
const store = {}
|
||||
const dragEvt = new window.Event('dragstart', { bubbles: true })
|
||||
dragEvt.dataTransfer = { setData: (k, v) => { store[k] = v }, effectAllowed: '' }
|
||||
card.dispatchEvent(dragEvt)
|
||||
assert.ok(store['application/x-iwb-promptid'], '拖拽应带提示词 id')
|
||||
assert.strictEqual(JSON.parse(store['application/x-iwb-prompt']).text, '生成小红书封面图', '拖拽应带正文 payload')
|
||||
card.dispatchEvent(new window.MouseEvent('pointerdown', { bubbles: true, clientX: 40, clientY: 40, button: 0 }))
|
||||
window.dispatchEvent(new window.MouseEvent('pointermove', { bubbles: true, clientX: 70, clientY: 70 }))
|
||||
window.dispatchEvent(new window.MouseEvent('pointermove', { bubbles: true, clientX: 300, clientY: 200 }))
|
||||
assert.ok(window.document.querySelector('.iwb-plp-dragghost'), '拖动时应出现幽灵卡片')
|
||||
window.dispatchEvent(new window.MouseEvent('pointerup', { bubbles: true, clientX: 300, clientY: 200 }))
|
||||
await wait(20)
|
||||
assert.strictEqual(calls.create.length, 1, '拖入画布应调用 createNode')
|
||||
assert.strictEqual(calls.create[0].type, 'prompt', '无变量应插入普通提示词节点')
|
||||
assert.strictEqual(calls.create[0].data.text, '生成小红书封面图', '插入应带正文')
|
||||
|
||||
// v1.1.0:单击卡片 → 详情(只读),再点「编辑」→ 浮层
|
||||
card.dispatchEvent(new window.MouseEvent('click', { bubbles: true }))
|
||||
// v1.6.12:双击卡片 → 详情(只读),再点「编辑」→ 浮层
|
||||
card.dispatchEvent(new window.MouseEvent('dblclick', { bubbles: true }))
|
||||
await wait(40)
|
||||
const dlg = window.document.querySelector('.iwb-plp-dialog')
|
||||
assert.ok(dlg && dlg.querySelector('.iwb-plp-dtext'), '单击卡片应打开详情弹窗(长文区)')
|
||||
assert.ok(dlg && dlg.querySelector('.iwb-plp-dtext'), '双击卡片应打开详情弹窗(长文区)')
|
||||
const editBtn = Array.from(dlg.querySelectorAll('.iwb-plp-dhead button')).find((b) => b.textContent === '编辑')
|
||||
assert.ok(editBtn, '详情页应有「编辑」按钮')
|
||||
editBtn.dispatchEvent(new window.MouseEvent('click', { bubbles: true }))
|
||||
await wait(40)
|
||||
const editor = window.document.querySelector('.iwb-plp-dialog-edit')
|
||||
assert.ok(editor, '单击卡片应打开编辑浮层')
|
||||
assert.ok(editor, '详情里点编辑应打开编辑浮层')
|
||||
const nameIn = editor.querySelector('input.iwb-input')
|
||||
nameIn.value = '小红书封面(改)'
|
||||
const saveBtn = Array.from(editor.querySelectorAll('button')).find((b) => b.textContent === '保存')
|
||||
@@ -114,16 +133,26 @@ const wait = (ms) => new Promise((r) => setTimeout(r, ms))
|
||||
assert.strictEqual(prompts.find((p) => p.id === 'q3' || p.id === 'q1').name.length > 0, true)
|
||||
assert.strictEqual(window.document.querySelector('.iwb-plp-dialog-edit'), null, '保存后编辑弹窗应关闭')
|
||||
|
||||
// v1.6.12:保存后自动回到详情(新行为)—— 关掉它,避免影响后续断言
|
||||
window.document.querySelectorAll('.iwb-modal-mask').forEach((m) => m.remove())
|
||||
|
||||
// 插入画布按钮(+ 图标,title 含「插入到画布」)
|
||||
// 再点一次卡片 → 详情弹窗 → 底部「插入画布」
|
||||
cards()[0].dispatchEvent(new window.MouseEvent('click', { bubbles: true }))
|
||||
const allChip = Array.from(host.querySelectorAll('.iwb-chip')).find((c) => c.textContent.indexOf('全部') === 0)
|
||||
if (allChip) allChip.click()
|
||||
await wait(30)
|
||||
assert.ok(cards().length > 0, '应有卡片可点')
|
||||
cards()[0].dispatchEvent(new window.MouseEvent('dblclick', { bubbles: true }))
|
||||
await wait(40)
|
||||
const dlg2 = window.document.querySelector('.iwb-plp-dialog')
|
||||
const insBtn = dlg2 ? Array.from(dlg2.querySelectorAll('.iwb-plp-dfooter button')).find((b) => b.textContent === '插入画布') : null
|
||||
assert.ok(insBtn, '卡片应有「插入到画布」按钮')
|
||||
insBtn.dispatchEvent(new window.MouseEvent('click', { bubbles: true }))
|
||||
await wait(50)
|
||||
assert.strictEqual(calls.insert.length, 1, '插入应调用 ctx.promptlib.insert')
|
||||
await wait(40)
|
||||
assert.ok(window.document.querySelector('.iwb-plp-placebox'), '插入画布应进入两步放置(出现放置框)')
|
||||
window.dispatchEvent(new window.KeyboardEvent('keydown', { key: 'Escape' }))
|
||||
await wait(20)
|
||||
assert.strictEqual(window.document.querySelector('.iwb-plp-placebox'), null, 'Esc 应取消放置')
|
||||
|
||||
// ---- v1.4.0 新增覆盖:封面渲染 / 插入封面图片 / 弹窗拖动缩放 ----
|
||||
// 1) 封面:mock coverUrl 返回一张 dataURL,卡片应出现 <img class=iwb-plp-cover>
|
||||
@@ -140,18 +169,21 @@ const wait = (ms) => new Promise((r) => setTimeout(r, ms))
|
||||
// 2) 插入封面图片:详情底部出现「插入图片」,点击后调用 insertImage 并关闭弹窗
|
||||
const inserted = []
|
||||
ctx.promptlib.insertImage = async (cover, name) => { inserted.push([cover, name]); return { ok: true } }
|
||||
window.document.querySelector('#host .iwb-plp-card').dispatchEvent(new window.MouseEvent('click', { bubbles: true }))
|
||||
window.document.querySelector('#host .iwb-plp-card').dispatchEvent(new window.MouseEvent('dblclick', { bubbles: true }))
|
||||
await wait(40)
|
||||
const dlgA = window.document.querySelector('.iwb-plp-dialog')
|
||||
const imgBtn = dlgA && Array.from(dlgA.querySelectorAll('.iwb-plp-dfooter button')).find((b) => b.textContent === '插入图片')
|
||||
assert.ok(imgBtn, '有封面时详情应有「插入图片」按钮')
|
||||
imgBtn.dispatchEvent(new window.MouseEvent('click', { bubbles: true }))
|
||||
await wait(60)
|
||||
assert.strictEqual(inserted.length, 1, '应调用 promptlib.insertImage')
|
||||
await wait(40)
|
||||
assert.strictEqual(window.document.querySelector('.iwb-plp-dialog'), null, '插入图片后弹窗应关闭')
|
||||
assert.ok(window.document.querySelector('.iwb-plp-placebox'), '插入图片应进入两步放置')
|
||||
plCanvas.dispatchEvent(new window.MouseEvent('pointerdown', { bubbles: true, clientX: 300, clientY: 200 }))
|
||||
await wait(30)
|
||||
assert.ok(calls.create.some((c) => c.type === 'img'), '点击画布应调用 createImageNode')
|
||||
|
||||
// 3) 弹窗拖动 + 缩放:标题栏拖动改变 left,右下角拖拽改变 width(且不小于 640)
|
||||
window.document.querySelector('#host .iwb-plp-card').dispatchEvent(new window.MouseEvent('click', { bubbles: true }))
|
||||
window.document.querySelector('#host .iwb-plp-card').dispatchEvent(new window.MouseEvent('dblclick', { bubbles: true }))
|
||||
await wait(40)
|
||||
const dlgB = window.document.querySelector('.iwb-plp-dialog')
|
||||
assert.ok(dlgB, '应打开详情弹窗')
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// 插件通用灰由主题派生(v3.26.20):亮/暗都要有值、暗色必须更暗、且保持中性灰(不带蓝调)。
|
||||
const assert = require('assert')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const src = fs.readFileSync(path.join(__dirname, '..', 'src', 'theme-tokens.js'), 'utf8')
|
||||
const sandbox = {}
|
||||
new Function('window', src)(sandbox)
|
||||
const T = sandbox.IWBThemeTokens
|
||||
assert.ok(T && typeof T.derive === 'function', 'theme-tokens 应导出 derive')
|
||||
|
||||
const light = T.derive(T.DEFAULTS, false)
|
||||
const dark = T.derive(T.DEFAULTS, true)
|
||||
const KEYS = ['pluginSurface', 'pluginCard', 'pluginInset', 'pluginHover']
|
||||
|
||||
function rgb (hex) {
|
||||
const s = String(hex).trim()
|
||||
assert.ok(/^#[0-9a-f]{6}$/i.test(s), '应为 6 位 hex,实际 ' + s)
|
||||
return { r: parseInt(s.slice(1, 3), 16), g: parseInt(s.slice(3, 5), 16), b: parseInt(s.slice(5, 7), 16) }
|
||||
}
|
||||
const lum = (hex) => { const c = rgb(hex); return 0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b }
|
||||
|
||||
for (const k of KEYS) {
|
||||
assert.ok(light[k], '亮色缺少 ' + k)
|
||||
assert.ok(dark[k], '暗色缺少 ' + k)
|
||||
assert.ok(lum(dark[k]) < lum(light[k]), k + ' 暗色应比亮色更暗:' + dark[k] + ' vs ' + light[k])
|
||||
// 中性灰:通道极差 <= 3(防止又混进蓝调 e3e7ea)
|
||||
const c = rgb(light[k])
|
||||
const spread = Math.max(c.r, c.g, c.b) - Math.min(c.r, c.g, c.b)
|
||||
assert.ok(spread <= 3, k + ' 亮色应为中性灰(通道差 ' + spread + '),实际 ' + light[k])
|
||||
}
|
||||
|
||||
// 卡片必须比内嵌块更亮(层次:卡片 > 面板 > 内嵌)
|
||||
assert.ok(lum(light.pluginCard) >= lum(light.pluginSurface), '卡片不应比面板更暗')
|
||||
assert.ok(lum(light.pluginSurface) >= lum(light.pluginInset), '面板不应比内嵌块更暗')
|
||||
|
||||
console.log('theme plugin tokens checks passed(亮/暗派生 / 暗色更暗 / 中性灰 / 层次正确)')
|
||||
Reference in new issue
Block a user