Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5fc09c2382 | ||
|
|
2b8e337db8 | ||
|
|
9225a76895 | ||
|
|
01c922d7e4 | ||
|
|
aa05efe536 | ||
|
|
7c0896ed97 | ||
|
|
fcb429772e | ||
|
|
03f74629a4 | ||
|
|
de1a38e211 | ||
|
|
983eb511b4 | ||
|
|
3abe96d389 | ||
|
|
8c87ae2743 | ||
|
|
5ca6cda7a5 | ||
|
|
edc0b1f916 | ||
|
|
9a011dc825 | ||
|
|
f1462a5862 | ||
|
|
cd7d478782 | ||
|
|
071f7f44d6 | ||
|
|
980481a897 | ||
|
|
e017f8733f | ||
|
|
b28cc2d183 | ||
|
|
d7fdae8877 | ||
|
|
bc77f007a0 | ||
|
|
d2bef9f348 | ||
|
|
06d2a8bc5b | ||
|
|
d9e3d84c0c | ||
|
|
af3a9cdf8f | ||
|
|
92a8b6af0d | ||
|
|
f6c66fcd89 | ||
|
|
262bcc037b | ||
|
|
2cc5126f70 | ||
|
|
5d68e0249a | ||
|
|
bb0b3f3e8f | ||
|
|
204f9103aa | ||
|
|
8e40ba2870 | ||
|
|
d45065101b | ||
|
|
702fbf5132 | ||
|
|
8944f2a78f | ||
|
|
7335f59288 | ||
|
|
16109a39f4 | ||
|
|
b25ba45872 | ||
|
|
b8f5d4d8eb | ||
|
|
fb69d17615 | ||
|
|
98f7f8e6d4 | ||
|
|
0e80c55adf | ||
|
|
dd58e4a7b5 | ||
|
|
e9435a5cfe | ||
|
|
054aec958e | ||
|
|
96c786e8ca | ||
|
|
3792081ddd | ||
|
|
b1e3fea494 | ||
|
|
81c520fe52 |
No files matched your search
@@ -14,6 +14,19 @@
|
||||
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
|
||||
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
|
||||
|
||||
## v3.26.41(2026-11-23)继承态提示词把文案与参考图交给组合/连接节点
|
||||
|
||||
- 修「提示词接风格库变量节点后,组合节点读不到文案、也不往下带参考图」(出图一直正常,所以表现为「能出图、组合是空的」)。
|
||||
- 根因:来源判定只看节点自身 `data.text`,提示词处于「继承 · 来自 上一级」时自己没存字,被当成无文本来源整路丢弃 —— 组合取行、组合写入 `combined`、组合→文本/分层节点的图片汇总同时失效。
|
||||
- 修复只动来源判定层(`batchSrcText` / `isBatchSrc` 支持 `(edges, nodes)`),自身无文案时按节点体显示的同一套顺序取上游第一条(提示词不拼合多路);组合节点的拼接、分隔符、附加文案、排序逻辑零改动。
|
||||
- 连接(batch)节点同步修好:继承态提示词现在能进来源列表、生成输出端口、推送正确文案。
|
||||
- 穿透范围限定为提示词/文本/中继/连接,组合、LLM、插件节点不越过;上游停用不参与;环不死循环。
|
||||
|
||||
## v3.26.40(2026-11-23)Windows:修复 PowerShell 弹窗
|
||||
|
||||
- Windows 状态栏内存探测改用 CREATE_NO_WINDOW 启动 PowerShell,不再每 4 秒弹出控制台窗口。
|
||||
- macOS 行为不变(Unix 分支仍用 ps)。
|
||||
|
||||
## v3.26.39(2026-11-22)修正插件插入落点与封面插入
|
||||
|
||||
- promptlib 1.6.18:拖拽落点按节点宽高居中到鼠标;详情「插入模板节点/插入画布/插入图片」落到画布可视中心;拖拽期间禁用文本选择。
|
||||
|
||||
@@ -6891,9 +6891,9 @@ const tbCenterSeed = (type, refs) => {
|
||||
}
|
||||
continue
|
||||
}
|
||||
const bsrcs = edges.filter((e) => e.to === bn.id).map((e) => nodes.find((n) => n.id === e.from)).filter((n) => isBatchSrc(n) && !(n.data && n.data.enabled === false)).slice().sort((a, b) => (a.y - b.y) || (a.x - b.x))
|
||||
const bsrcs = edges.filter((e) => e.to === bn.id).map((e) => nodes.find((n) => n.id === e.from)).filter((n) => isBatchSrc(n, edges, nodes) && !(n.data && n.data.enabled === false)).slice().sort((a, b) => (a.y - b.y) || (a.x - b.x))
|
||||
if (!bsrcs.length) continue
|
||||
const textOf = (src) => batchJoinedText(bn.data, batchSrcText(src))
|
||||
const textOf = (src) => batchJoinedText(bn.data, batchSrcText(src, edges, nodes))
|
||||
for (const e of edges) {
|
||||
if (e.from !== bn.id) continue
|
||||
const dst = nodes.find((n) => n.id === e.to)
|
||||
@@ -7809,7 +7809,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
if (!e || !e.to) continue
|
||||
const dst = refs.nodeMap.get(e.to)
|
||||
const src = refs.nodeMap.get(e.from)
|
||||
if (!dst || !src || dst.type !== 'batch' || !isBatchSrc(src)) continue
|
||||
if (!dst || !src || dst.type !== 'batch' || !isBatchSrc(src, edges, nodes)) continue
|
||||
if (!m.has(dst.id)) m.set(dst.id, [])
|
||||
if (!m.get(dst.id).some((n) => n.id === src.id)) m.get(dst.id).push(src)
|
||||
}
|
||||
@@ -8075,7 +8075,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
const node = refs.nodes.find((n) => n.id === id)
|
||||
if (node) {
|
||||
if (batchSrcId) {
|
||||
const bsrcs = refs.edges.filter((e) => e.to === id).map((e) => refs.nodes.find((n) => n.id === e.from)).filter((n) => isBatchSrc(n)).slice().sort((a, b) => (a.y - b.y) || (a.x - b.x))
|
||||
const bsrcs = refs.edges.filter((e) => e.to === id).map((e) => refs.nodes.find((n) => n.id === e.from)).filter((n) => isBatchSrc(n, refs.edges, refs.nodes)).slice().sort((a, b) => (a.y - b.y) || (a.x - b.x))
|
||||
const idx = bsrcs.findIndex((s) => s.id === batchSrcId)
|
||||
if (idx >= 0) portPos = { x: node.x + nodeWidth(node), y: node.y + batchPortTop(idx, Math.max(1, bsrcs.length), hOf(node)) }
|
||||
} else {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# 现状架构与性能事实基线(image-workbench-web)
|
||||
|
||||
> **本文档是什么**:现状**事实快照**,不是规范。用途:任何性能 / 内存 / 存储相关改动,先对齐这里的现实,避免把已经调好的东西改坏。
|
||||
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = 5e2f9dd`(线上 `v3.26.39+5e2f9dd` —— **未上线**(本地测试中):左右停靠栏配色对齐主色调(新增 `--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 = 2b8e337`(线上 `v3.26.41+2b8e337` —— 2026-11-23 发**正式线**:继承态提示词把上游文案与参考图交给组合/连接节点(来源判定加 `(edges, nodes)`,组合拼接逻辑零改动));上一条 `v3.26.40+d9e3d84`:左右停靠栏配色对齐主色调(新增 `--iwb-dock-bg` 进灰阶 ramp + 头部深一档 + `.iwb-pcard` 补白底)+ 修 `Cargo.toml`/`Cargo.lock` 版本漂移,四处统一到 3.25.58)。上一条 3.25.30:线上实际运行提交是 docs 提交 `7df9dc4`,bump 提交为 `4be78c0`;2026-11-16 已发**测试站 + 正式站**,三地址一致 + `IWB_VERIFY_STRICT=1` 通过。v3.24.85 是「代码体检收口」(棘轮收回 Workbench 3090→2998 + 图库索引 4 条绕过锁的写路径收口到 `mutate` + 文档数字校准),`stable` / `stable-v3.24.85` / `stable-verified-2026-11-16` 均指向 `7df9dc4`。上一条 —— 2026-11-14 发**测试站 + 正式站** `https://test.image-workbench-web.pages.dev`:**v3.24.84 修「生图节点连了 3 条上游只出 1 个任务」**(任务 id 与去重基准改用新字段 `ownerNodeId`=本节点自己,不再用随继承冒泡的 `sourceNodeId` ⇒ 连几条线就几个任务;`relay` 仍归约到真实文本来源,同一来源多路径抵达只算一次)。上一条 v3.24.83:**修「插件节点冷启动退化成一段文本」**(插件节点体是异步注册的,`registerNodeType` 在 `render` 由无变有时自增 `NODE_TYPES_REV`,`NodeCard` 比它 ⇒ 注册那一刻重建一次;`canvas-normalize` 按命名规则把 `plugin:<id>:<variant>` 认作已知类型,不再降级成 `plugin` 并写回存档);配套插件 `style-source` 1.3.2 把节点体样式改为**脚本执行时注入**(此前只在面板 `mount()` 注入 ⇒ 从存档直接进画布时节点无样式、缩略图按原图铺满)。上一条 v3.24.82 同批:提示词/文本节点**显示上游继承文本**(自己 `data.text` 为空时把上游那段话显示在框里,改一个字即接管,另有「恢复跟随」清空回跟随;多路上游按 Y 轴取第一条)+ 修 `nodeRefsOf` 的 textout 分支只认 llm/batch/combine 上游导致「样式 → 文本 → 分层」丢参考图;再上一条 v3.24.81:① 插件节点可自定义节点体(`render(node, props, host)` 画真实 DOM,宿主不每帧重建 ⇒ 输入框不失焦);② 节点自带参考图(`data.refOn/refUrl` ⇒ 任务图里补伪参考图,坐标取节点自身 ⇒ 仍参与「图片按 X 轴排序」);③ 连线白名单按 `data.outKind === 'prompt'` 归一化,7 条规则一次放行,内置节点行为逐字不变。上一条 v3.24.80 = 离开页面的兜底保存不递增 rev(2026-11-14 07:20 补发 —— 首发 11-13 23:25 撞 Cloudflare Workers API 事故 `503 no healthy upstream`,期间正式站保持在 `v3.24.79+8598a57` 未动)。v3.24.83 的 bump 提交即 `0a27a42`(v3.24.82 为 `ef6cf42`、v3.24.81 为 `dba71e3`);主干 HEAD 会继续前进,见 [`RELEASES.md`](../RELEASES.md))| 历史分支 `refactor/architecture` / `feat/multi-canvas-tabs` / `refactor/state-store` 已于 2026-10-20 清理(内容均已并入 main,归档标签 `archive/*`),本文**计数类事实**已按 main HEAD 复算。
|
||||
<!-- 2026-10-28 P1 拆分批 1:新增 src/generation-task-graph.js(5 个任务图纯函数自 app.js 迁出)
|
||||
⇒ 模块数 60→61、耦合面 51→52、sourceModules 60→61。耦合面只**新增** IWBWTaskGraph,无删除。
|
||||
2026-10-28 P1 拆分批 2:新增 src/storage-config-shape.js(9 个配置形状纯函数自 app.js 迁出)
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
# promptlib 迭代复盘(2026-11-22)
|
||||
|
||||
> 记录本轮提示词库 1.6.6 → 1.8.8 迭代中遇到的问题、根因与必须遵守的做法。
|
||||
|
||||
## 1. 发布纪律(最大教训)
|
||||
|
||||
- 每次改动同时做三件事:插件 package.json version、入口 version、市场发布(gen-market + 上传 NAS)。
|
||||
- 只在本机手工替换 manifest 不上市场,用户端永远是旧版本。
|
||||
- 发布前必须 node --check;1.8.5 曾因转义把正则写成真实换行,语法损坏。
|
||||
- 上市场后让用户「刷新市场 → 更新」,必要时重启。
|
||||
|
||||
## 2. 拖入画布(不要用原生 HTML5 DnD)
|
||||
|
||||
- 原生 drag&drop 在 WKWebView 吞掉 pointerup,落点节点带焦点残留。
|
||||
- 用 pointerdown → pointermove(>5px) 幽灵 → pointerup → canvas.screenToWorld → canvasWrite.createNode。
|
||||
- 落点 = 鼠标位置 = 节点左上角(对齐风格库),不要居中偏移。
|
||||
- 拖拽期间 body 加 user-select:none。
|
||||
|
||||
## 3. 详情插入:两步放置
|
||||
|
||||
- 点插入后关闭详情 → 跟手灰色小方框(112×112,左上角对齐鼠标)→ 点击画布落点;Esc 取消。
|
||||
|
||||
## 4. 编辑面板
|
||||
|
||||
- 三栏:左 236 固定 / 中自适应 / 右可变(默认 300,190–460),分割条 6px。
|
||||
- 正文 flex:1 到底;变量区独立滚动。
|
||||
- 变量 = 单个输入框,与正文双向同步;重名阻止并回退。
|
||||
- i 按钮展开说明,可多开、各自收起;说明透明背景 + 虚线框。
|
||||
- 正文变量高亮覆盖层与 textarea 的字体/行高/内边距必须一致,否则光标错位;程序改 value 后手动重绘。
|
||||
- 标签用输入框 + 加号生成 chips,可删除。
|
||||
|
||||
## 5. 详情面板
|
||||
|
||||
- 左卡片:封面 contain 完整展示 → 标题 14px → 分割线 → 分组/标签/字数(去底色、带冒号、行间浅线)。
|
||||
- 右卡片:标题 + 正文独立滚动(flex + min-height:0 + overflow:auto)。
|
||||
- 左右卡片等距等高,align-items: stretch,否则右侧没有滚动条。
|
||||
- 右上角编辑 + 关闭;底部插入沿用两步放置;编辑取消回到详情。
|
||||
|
||||
## 6. 节点与输出
|
||||
|
||||
- 变量输入框 placeholder = 说明文字。
|
||||
- 节点保存 tpl(含变量,供编辑)与 text(填值后剔除未填占位,供下游/生图)。
|
||||
- 旧节点 render 时自愈 text。
|
||||
|
||||
## 7. 样式
|
||||
|
||||
- 输入框比底色更亮 + 极浅描边,聚焦纯白 + 淡紫光圈;不要深灰条。
|
||||
- 变量行不要套边框;说明透明 + 虚线。
|
||||
- 插件样式自包含;参考 docs/standards/plugin-development.md 与 plugin-node-drag.md。
|
||||
|
||||
## 8. 版本记录
|
||||
|
||||
1.6.6 封面文件化 / 1.6.7 outKind / 1.6.15 指针拖拽 / 1.6.18–19 落点 / 1.6.20 封面插入 / 1.6.21 两步放置 / 1.6.22–23 放置框 / 1.7.0 三栏编辑 / 1.7.1 视觉精修 / 1.7.2 变量黑粗 / 1.7.3 正文显示 / 1.7.4 名称可拖高 / 1.7.5–1.7.6 封面 contain + 取消回详情 / 1.7.7 字体度量 / 1.7.8 重绘 / 1.7.9 滚动 / 1.8.0 标题下移 + 标签编辑器 / 1.8.1 元信息 / 1.8.2 卡片化 / 1.8.3–1.8.4 布局 / 1.8.5–1.8.6 输出剔除变量 / 1.8.7–1.8.8 细节。
|
||||
@@ -0,0 +1,38 @@
|
||||
# promptlib 样式基线与插入变量规则(2026-11-23 定稿)
|
||||
|
||||
## 一、正确的样式基线
|
||||
|
||||
- **样式基线 = promptlib v1.8.8**(插件仓 commit `178b36c`)
|
||||
- 当前版本 v1.8.17 的 `styles.css` 与 1.8.8 视觉一致,仅在颜色值外做了无副作用的 `var(--plp-cN, #原色)` 兜底包装
|
||||
- 以后任何 UI 调整都以此基线为起点,先 `git diff 178b36c -- promptlib/styles.css` 看差异
|
||||
|
||||
回滚命令:
|
||||
|
||||
```bash
|
||||
cd iwb-plugins-desktop
|
||||
git checkout 178b36c -- promptlib/styles.css promptlib/src/index.js
|
||||
```
|
||||
|
||||
## 二、这次错误的根因(禁止重犯)
|
||||
|
||||
1. **不要批量替换颜色 token**:为了过主题契约,曾用脚本把 `color/border/background` 统一替换成 `--iwb-plugin-*`,结果把文字色换成了边框色 → 变量/输入框文字不可见、灰块。
|
||||
2. **不要用脚本重写 CSS 声明**:多声明一行、伪类(`:focus`)都会被破坏;曾出现 `: focus` 导致焦点样式全失效。
|
||||
3. **修改后必须先做视觉验证**:静态 HTML + Playwright 截图,或真机截图,再上市场;不要连续猜着发版。
|
||||
4. **主题契约的安全做法**:只把颜色包成 `var(--plp-cN, #原色)`(不定义变量,保留原色),或 `var(--iwb-*, #原色)` 且确保语义正确;禁止改变视觉。
|
||||
|
||||
## 三、插入变量的正确实现
|
||||
|
||||
- 工具栏按钮 `pointerdown` 必须 `preventDefault()`,避免抢走 textarea 焦点/选区
|
||||
- 记录选区只在 `keyup / mouseup / input / select`,**绝对不要在 `blur` 记录**(WebKit 失焦会重置选区 → 插入到前一个字符)
|
||||
- 点击时先 `focus()` → 用 `lastSel` 计算插入点,直接 `value.slice` 拼接(确定性 splice)
|
||||
- 插入后 `setSelectionRange` 选中变量名,并同步 `lastSel`
|
||||
- **不要用「透明 textarea + 高亮层」做编辑区**:两层即使字体相同,变量加粗/换行差异也会让点击位置逐次左移(v1.8.18 实测:第 1 次对、第 2 次偏 1 字、第 3 次偏 2 字)。编辑正文直接由 textarea 渲染(v1.8.20)
|
||||
- **不要用 `document.execCommand("insertText")`**:WKWebView 内部光标与 `selectionStart` 会漂移,第一次正常、第二次起偏移一个字符(v1.8.16 实测)
|
||||
|
||||
## 四、发布前检查清单
|
||||
|
||||
1. `node --check src/index.js`
|
||||
2. 同步客户端后跑 `tests/plugin-theme-contract-test.js`
|
||||
3. 静态渲染截图核对:编辑弹窗 / 详情弹窗(颜色、滚动、输入框描边)
|
||||
4. 再 bump 版本 + 上市场(gen-market + 上传 NAS)
|
||||
5. 版本号三处一致;市场 index.json 版本正确
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "image-workbench-web",
|
||||
"private": true,
|
||||
"version": "3.26.39",
|
||||
"version": "3.26.41",
|
||||
"description": "Browser-based node canvas image workbench",
|
||||
"scripts": {
|
||||
"build": "node scripts/build.js && node scripts/copy-plugins.js",
|
||||
|
||||
+3
-3
@@ -44,10 +44,10 @@
|
||||
"dir": "promptlib",
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
"version": "1.6.18",
|
||||
"version": "1.8.21",
|
||||
"files": {
|
||||
"main.js": "0efdfbbfe7e9318610bb94330c0a3c361a0aa38f2b3a44c243c872f0e02a09e8",
|
||||
"styles.css": "1fdad04e2ffe1c8ba2a991a88072f780b65238096f9ccd1b5adba671ff2c9cb3"
|
||||
"main.js": "125e02a618e37505836f964dbe21a3637e3043ee355d9606c538a54eed4243ad",
|
||||
"styles.css": "84ad2314d016c7d2351eb7cf2044ee8cc703992d40a76002ff644d34eb48838a"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
+255
-80
@@ -95,6 +95,12 @@
|
||||
})
|
||||
}
|
||||
|
||||
// 提交给下游/生图的文本:填完变量后,把未填的 {占位} 从输出里剔除(只在编辑器里展示)。
|
||||
function outputText (tpl, vals) {
|
||||
var s = fillTpl(tpl, vals)
|
||||
return s.replace(/[{][^{}]{1,24}[}]/g, ' ').replace(/[ ]{2,}/g, ' ').trim()
|
||||
}
|
||||
|
||||
function varsOf (p) {
|
||||
if (!p) return []
|
||||
if (Array.isArray(p.vars) && p.vars.length) {
|
||||
@@ -771,10 +777,10 @@
|
||||
if (!w) return
|
||||
var vd = varsOf(st.p)
|
||||
if (vd.length) {
|
||||
api2.createNode('ptpl', w.x - 210, w.y - 20, { promptId: '', name: st.p.name || '提示词模板', tpl: st.p.text || '', vdefs: vd, vars: {}, cover: st.p.cover || '', refOn: false, text: st.p.text || '', outKind: 'prompt' })
|
||||
api2.createNode('ptpl', w.x, w.y, { promptId: '', name: st.p.name || '提示词模板', tpl: st.p.text || '', vdefs: vd, vars: {}, cover: st.p.cover || '', refOn: false, text: outputText(st.p.text || '', {}), outKind: 'prompt' })
|
||||
notify('已插入模板节点:' + (st.p.name || ''))
|
||||
} else {
|
||||
api2.createNode('prompt', w.x - 132, w.y - 20, { text: st.p.text || '', title: st.p.name || '' })
|
||||
api2.createNode('prompt', w.x, w.y, { text: st.p.text || '', title: st.p.name || '' })
|
||||
notify('已插入提示词:' + (st.p.name || ''))
|
||||
}
|
||||
} catch (err) { notify('拖拽插入失败:' + ((err && err.message) || err), 'err') }
|
||||
@@ -790,6 +796,75 @@
|
||||
return pt ? { x: pt.x - (w || 0) / 2, y: pt.y - (h || 0) / 2 } : null
|
||||
} catch (e) { return null }
|
||||
}
|
||||
// v1.6.21:详情里的「插入」改成两步放置:先出现跟手幽灵,再点画布落点。
|
||||
var placement = null
|
||||
function cancelPlacement () {
|
||||
var st = placement
|
||||
if (!st) return
|
||||
placement = null
|
||||
try {
|
||||
global.removeEventListener('pointermove', st.move, true)
|
||||
global.removeEventListener('pointerdown', st.down, true)
|
||||
global.removeEventListener('keydown', st.key, true)
|
||||
} catch (e) { /* ignore */ }
|
||||
if (st.ghost && st.ghost.parentNode) st.ghost.parentNode.removeChild(st.ghost)
|
||||
try { document.body.style.cursor = '' } catch (e) { /* ignore */ }
|
||||
}
|
||||
// v1.6.22:放置指示改成半透明矩形框(跟手、左上角对齐落点),不再用卡片式幽灵。
|
||||
function makePlaceGhost (kind) {
|
||||
var dims = { w: 112, h: 112 }
|
||||
var box = el('div', { class: 'iwb-plp-placebox' })
|
||||
box.style.width = dims.w + 'px'
|
||||
box.style.height = dims.h + 'px'
|
||||
box.appendChild(el('div', { class: 'iwb-plp-placebox-t', text: '点击放置' }))
|
||||
return box
|
||||
}
|
||||
function beginPlacement (kind, payload) {
|
||||
cancelPlacement()
|
||||
var ghost = makePlaceGhost(kind)
|
||||
document.body.appendChild(ghost)
|
||||
var st = { ghost: ghost, kind: kind, payload: payload }
|
||||
st.move = function (e) {
|
||||
ghost.style.left = e.clientX + 'px'
|
||||
ghost.style.top = e.clientY + 'px'
|
||||
}
|
||||
st.down = function (e) {
|
||||
var c = document.querySelector('.iwb-canvas')
|
||||
if (!c || !c.contains(e.target)) return
|
||||
e.preventDefault(); e.stopPropagation()
|
||||
st.move(e)
|
||||
placeAt(st.kind, st.payload, e.clientX, e.clientY)
|
||||
}
|
||||
st.key = function (e) { if (e.key === 'Escape') { e.preventDefault(); cancelPlacement(); notify('已取消放置') } }
|
||||
global.addEventListener('pointermove', st.move, true)
|
||||
global.addEventListener('pointerdown', st.down, true)
|
||||
global.addEventListener('keydown', st.key, true)
|
||||
placement = st
|
||||
try { document.body.style.cursor = 'copy' } catch (e) { /* ignore */ }
|
||||
notify('移动鼠标到目标位置后单击放置(Esc 取消)')
|
||||
}
|
||||
function placeAt (kind, payload, cx, cy) {
|
||||
try {
|
||||
var sw = ctx.canvas && typeof ctx.canvas.screenToWorld === 'function' ? ctx.canvas.screenToWorld(cx, cy) : null
|
||||
var cw = ctx.canvasWrite || ctx.canvas
|
||||
if (!sw || !cw) { notify('当前宿主不支持放置', 'err'); cancelPlacement(); return }
|
||||
if (kind === 'img') {
|
||||
var iid = cw.createImageNode({ dataUrl: payload.dataUrl, name: payload.name || '封面图片', x: sw.x, y: sw.y })
|
||||
if (!iid) { notify('插入封面失败', 'err'); cancelPlacement(); return }
|
||||
notify('已插入封面图片')
|
||||
} else if (kind === 'ptpl') {
|
||||
var p = payload
|
||||
var id2 = cw.createNode('ptpl', sw.x, sw.y, { promptId: p.id, name: p.name || '提示词模板', tpl: p.text || '', vdefs: varsOf(p), vars: {}, outKind: 'prompt', cover: p.cover || coverNameOf(p), refOn: false, text: outputText(p.text || '', {}) })
|
||||
if (!id2) { notify('插入失败', 'err'); cancelPlacement(); return }
|
||||
notify('已插入模板节点')
|
||||
} else {
|
||||
var id3 = cw.createNode('prompt', sw.x, sw.y, { text: payload.text || '', title: payload.name || '' })
|
||||
if (!id3) { notify('插入失败', 'err'); cancelPlacement(); return }
|
||||
notify('已插入提示词')
|
||||
}
|
||||
} catch (err) { notify('插入失败:' + ((err && err.message) || err), 'err') }
|
||||
cancelPlacement()
|
||||
}
|
||||
function startCardDrag (e, p, card) {
|
||||
if (e.button !== 0) return
|
||||
// 不用 preventDefault:否则 WebKit 可能吞掉 click/dblclick(双击详情失效)
|
||||
@@ -899,54 +974,69 @@
|
||||
|
||||
// ===== v1.5.0:变量编辑器(新建/编辑弹窗用)=====
|
||||
// 变量来自正文的 {名字}:自动检测、可改标签/默认值/说明;留空时渲染保留 {原名}。
|
||||
function makeVarsEditor (text, initial) {
|
||||
function makeVarsEditor (text, initial, onTextChange) {
|
||||
var box = el('div', { class: 'iwb-plp-vars' })
|
||||
var head = el('div', { class: 'iwb-plp-vhead' })
|
||||
head.appendChild(el('span', { text: '变量' }))
|
||||
head.appendChild(el('span', { class: 'iwb-plp-vhint', text: '从正文 {…} 自动检测,可改标签 / 默认值 / 说明' }))
|
||||
var chips = el('div', { class: 'iwb-plp-vchips' })
|
||||
var head = el('div', { class: 'iwb-plp-vhead' },
|
||||
el('span', { text: '变量' }),
|
||||
el('span', { class: 'iwb-plp-vhint', text: '与正文双向同步 · 点 i 写说明' }))
|
||||
var rows = el('div', { class: 'iwb-plp-vrows' })
|
||||
var prev = el('div', { class: 'iwb-plp-vprev' })
|
||||
box.appendChild(head); box.appendChild(chips); box.appendChild(rows); box.appendChild(prev)
|
||||
box.appendChild(head); box.appendChild(rows)
|
||||
var list = []
|
||||
if (Array.isArray(initial) && initial.length) list = initial.map(function (v) { return { key: String(v.key || ''), label: String(v.label || v.key || ''), desc: String(v.desc || ''), def: String(v.def || '') } })
|
||||
var open = {}
|
||||
var norm = function (v) { return { key: String(v.key || ''), desc: String(v.desc || ''), def: String(v.def || '') } }
|
||||
if (Array.isArray(initial) && initial.length) list = initial.filter(function (v) { return v && v.key }).map(norm)
|
||||
function values () {
|
||||
var m = {}
|
||||
list.forEach(function (v) { if (v.def) m[v.key] = v.def })
|
||||
return m
|
||||
}
|
||||
function paint () {
|
||||
clear(chips); clear(rows)
|
||||
clear(rows)
|
||||
list.forEach(function (v) {
|
||||
var chip = el('span', { class: 'iwb-plp-vchip', text: v.label || v.key })
|
||||
var x = el('i', { class: 'iwb-plp-vx', text: '×', title: '忽略这个变量' })
|
||||
x.addEventListener('click', function () { list = list.filter(function (z) { return z.key !== v.key }); paint() })
|
||||
chip.appendChild(x)
|
||||
chips.appendChild(chip)
|
||||
var row = el('div', { class: 'iwb-plp-vrow' })
|
||||
row.appendChild(el('span', { class: 'iwb-plp-vk', text: '{' + v.key + '}' }))
|
||||
var def = el('input', { class: 'iwb-input iwb-plp-vin', placeholder: '默认值(可留空)' })
|
||||
def.value = v.def || ''
|
||||
def.addEventListener('input', function () { v.def = def.value; paintPrev() })
|
||||
var desc = el('input', { class: 'iwb-input iwb-plp-vin', placeholder: '说明(如:如「11.9」)' })
|
||||
desc.value = v.desc || ''
|
||||
desc.addEventListener('input', function () { v.desc = desc.value })
|
||||
row.appendChild(def); row.appendChild(desc)
|
||||
rows.appendChild(row)
|
||||
var item = el('div', { class: 'iwb-plp-vitem' })
|
||||
var row = el('div', { class: 'iwb-plp-vrow2' })
|
||||
var nameIn = el('input', { class: 'iwb-input iwb-plp-vname', placeholder: '变量名' })
|
||||
nameIn.value = v.key
|
||||
var iBtn = el('button', { class: 'iwb-plp-vi' + (open[v.key] ? ' is-open' : ''), type: 'button', title: '说明', text: 'i' })
|
||||
iBtn.addEventListener('click', function () { open[v.key] = !open[v.key]; paint() })
|
||||
nameIn.addEventListener('blur', function () { renameTo(v, nameIn.value) })
|
||||
nameIn.addEventListener('keydown', function (e) { if (e.key === 'Enter') { e.preventDefault(); nameIn.blur() } })
|
||||
row.appendChild(nameIn); row.appendChild(iBtn)
|
||||
item.appendChild(row)
|
||||
if (open[v.key]) {
|
||||
var d = el('input', { class: 'iwb-input iwb-plp-vdesc', placeholder: '说明(会作为节点输入框的占位提示)' })
|
||||
d.value = v.desc || ''
|
||||
d.addEventListener('input', function () { v.desc = d.value })
|
||||
item.appendChild(d)
|
||||
}
|
||||
rows.appendChild(item)
|
||||
})
|
||||
if (!list.length) rows.appendChild(el('div', { class: 'iwb-hint', text: '正文里没有 {变量};写入 {产品名} 这样的大括号即会被识别。' }))
|
||||
paintPrev()
|
||||
if (!list.length) rows.appendChild(el('div', { class: 'iwb-hint', text: '正文里没有 {变量};输入 {产品名} 即会被识别。' }))
|
||||
}
|
||||
function renameTo (v, raw) {
|
||||
var next = String(raw || '').replace(/[{}]/g, '').trim()
|
||||
if (!next || next === v.key) { paint(); return }
|
||||
if (list.some(function (x) { return x !== v && x.key === next })) { notify('变量名重复:' + next, 'err'); paint(); return }
|
||||
var old = v.key
|
||||
v.key = next
|
||||
if (open[old] !== undefined) { open[next] = open[old]; delete open[old] }
|
||||
var nt = String(text || '').split('{' + old + '}').join('{' + next + '}')
|
||||
text = nt
|
||||
if (typeof onTextChange === 'function') onTextChange(nt)
|
||||
paint()
|
||||
}
|
||||
function paintPrev () { prev.textContent = fillTpl(text, values()) }
|
||||
function sync (nextText) {
|
||||
text = String(nextText || '')
|
||||
var found = detectVars(text)
|
||||
var old = {}
|
||||
list.forEach(function (v) { old[v.key] = v })
|
||||
list = found.map(function (v) { return old[v.key] ? Object.assign({}, v, old[v.key]) : v })
|
||||
list = found.map(function (v) {
|
||||
var prev = old[v.key]
|
||||
return { key: v.key, desc: prev ? prev.desc : v.desc, def: prev ? prev.def : '' }
|
||||
})
|
||||
paint()
|
||||
}
|
||||
if (!list.length) list = detectVars(text)
|
||||
if (!list.length) list = detectVars(text).map(norm)
|
||||
paint()
|
||||
return { node: box, sync: sync, list: function () { return list }, values: values }
|
||||
}
|
||||
@@ -1262,48 +1352,55 @@
|
||||
var closeBtn = el('button', { class: 'iwb-btn iwb-btn-sm', title: '关闭', text: '✕' })
|
||||
var dlg = openDialog({
|
||||
key: 'detail',
|
||||
title: p.name || '未命名',
|
||||
width: 880, height: 640,
|
||||
title: '提示词详情',
|
||||
width: 1180, height: 720,
|
||||
actions: [edit, closeBtn],
|
||||
build: function (bodyEl, footEl) {
|
||||
var cov = el('div', { class: 'iwb-plp-dcov' })
|
||||
paintCoverInto(cov, p)
|
||||
var leftCol = el('div', { class: 'iwb-plp-dleftcol' })
|
||||
leftCol.appendChild(cov)
|
||||
leftCol.appendChild(el('div', { class: 'iwb-plp-dtitle', text: p.name || '未命名' }))
|
||||
var meta = el('div', { class: 'iwb-plp-dmeta' })
|
||||
function metaRow (label, nodes) {
|
||||
var row = el('div', { class: 'iwb-plp-dmrow' })
|
||||
row.appendChild(el('span', { class: 'iwb-plp-dmk', text: label }))
|
||||
var val = el('div', { class: 'iwb-plp-dmv' })
|
||||
;(Array.isArray(nodes) ? nodes : [nodes]).forEach(function (n) { val.appendChild(n) })
|
||||
row.appendChild(val)
|
||||
return row
|
||||
}
|
||||
meta.appendChild(metaRow('分组:', el('span', { class: 'iwb-plp-dgroup', text: p.group || '未分组' })))
|
||||
var tagNodes = (p.tags || []).map(function (t) { return el('span', { class: 'iwb-plp-dtag', text: '#' + t }) })
|
||||
if (!tagNodes.length) tagNodes = [el('span', { class: 'iwb-plp-dempty', text: '无' })]
|
||||
meta.appendChild(metaRow('标签:', tagNodes))
|
||||
meta.appendChild(metaRow('字数:', el('span', { class: 'iwb-plp-dlen', text: String(p.text || '').length + ' 字' })))
|
||||
leftCol.appendChild(meta)
|
||||
var right = el('div', { class: 'iwb-plp-dright' })
|
||||
right.appendChild(el('div', { class: 'iwb-hint', text: [p.group || '未分组'].concat(p.tags || []).join(' · ') + ' · ' + String(p.text || '').length + ' 字' }))
|
||||
var vlist = varsOf(p)
|
||||
var vals = {}
|
||||
var txt = el('div', { class: 'iwb-plp-dtext', text: p.text || '' })
|
||||
var txt = el('div', { class: 'iwb-plp-dtext' })
|
||||
;(function paintText () {
|
||||
var str = String(p.text || '')
|
||||
var re = /[{]([^{}]{1,24})[}]/g, last = 0, m
|
||||
while ((m = re.exec(str))) {
|
||||
if (m.index > last) txt.appendChild(document.createTextNode(str.slice(last, m.index)))
|
||||
txt.appendChild(el('span', { class: 'iwb-plp-dvar', text: m[0] }))
|
||||
last = m.index + m[0].length
|
||||
}
|
||||
if (last < str.length) txt.appendChild(document.createTextNode(str.slice(last)))
|
||||
})()
|
||||
function filled () { return vlist.length ? fillTpl(p.text, vals) : String(p.text || '') }
|
||||
if (vlist.length) {
|
||||
var vbox = el('div', { class: 'iwb-plp-dvars' })
|
||||
vlist.forEach(function (v) {
|
||||
var row = el('div', { class: 'iwb-plp-vrow' })
|
||||
row.appendChild(el('span', { class: 'iwb-plp-vk', text: v.label || v.key }))
|
||||
var inp = el('input', { class: 'iwb-input iwb-plp-vin', placeholder: v.desc || v.def || '' })
|
||||
inp.value = v.def || ''
|
||||
inp.addEventListener('input', function () { vals[v.key] = inp.value; txt.textContent = filled() })
|
||||
row.appendChild(inp)
|
||||
vbox.appendChild(row)
|
||||
})
|
||||
right.appendChild(vbox)
|
||||
right.appendChild(el('div', { class: 'iwb-hint', text: '预览(留空的变量保留 {原名})' }))
|
||||
}
|
||||
right.appendChild(el('div', { class: 'iwb-plp-dsec', text: '提示词内容' }))
|
||||
right.appendChild(txt)
|
||||
bodyEl.appendChild(cov); bodyEl.appendChild(right)
|
||||
bodyEl.appendChild(leftCol); bodyEl.appendChild(right)
|
||||
var del = el('button', { class: 'iwb-btn iwb-btn-sm iwb-btn-danger', text: '删除' })
|
||||
var cp = el('button', { class: 'iwb-btn iwb-btn-sm', text: '复制全文' })
|
||||
var insTpl = null
|
||||
var cw = ctx.canvasWrite || ctx.canvas
|
||||
if (ctx.nodes && cw && typeof cw.createNode === 'function') {
|
||||
insTpl = el('button', { class: 'iwb-btn iwb-btn-sm iwb-btn-primary', title: '插入可填变量的模板节点', text: '插入模板节点' })
|
||||
insTpl.addEventListener('click', function () {
|
||||
var ctr = canvasCenter(420, 260)
|
||||
var id = cw.createNode('ptpl', ctr ? ctr.x : null, ctr ? ctr.y : null, {
|
||||
promptId: p.id, name: p.name || '提示词模板', tpl: p.text || '', vdefs: vlist, vars: vals, outKind: 'prompt',
|
||||
cover: p.cover || coverNameOf(p), refOn: false, text: filled(),
|
||||
})
|
||||
if (id) { notify('已插入模板节点'); dlg.close() } else notify('插入失败', 'err')
|
||||
})
|
||||
insTpl.addEventListener('click', function () { dlg.close(); beginPlacement('ptpl', p) })
|
||||
}
|
||||
var ins = el('button', { class: 'iwb-btn iwb-btn-sm', text: '插入画布' })
|
||||
del.addEventListener('click', function () {
|
||||
@@ -1314,17 +1411,17 @@
|
||||
})
|
||||
})
|
||||
cp.addEventListener('click', function () { Promise.resolve(api.copy(filled())).then(function (r) { if (r && r.ok === false) notify('复制失败', 'err'); else notify('已复制全文') }) })
|
||||
ins.addEventListener('click', function () { Promise.resolve(api.insert(filled(), p.name || '')).then(function () { notify('已插入画布:' + (p.name || '提示词')); dlg.close() }).catch(function () { notify('插入画布失败', 'err') }) })
|
||||
ins.addEventListener('click', function () { dlg.close(); beginPlacement('prompt', { text: filled(), name: p.name || '' }) })
|
||||
var insImg = null
|
||||
if (p.cover) {
|
||||
insImg = el('button', { class: 'iwb-btn iwb-btn-sm', title: '把这条提示词的封面作为参考图插入画布', text: '插入图片' })
|
||||
insImg.addEventListener('click', function () {
|
||||
var covName = coverNameOf(p)
|
||||
var covData = (covName && FILEAPI) ? Promise.resolve(FILEAPI.get(covName)).then(function (x) { return x && x.ok ? x.url : '' }).catch(function () { return '' }) : Promise.resolve(typeof p.cover === 'string' ? p.cover : '')
|
||||
covData.then(function (u) { return api.insertImage(u, p.name || '') }).then(function (r) {
|
||||
if (r && r.ok === false) { notify((r && r.error) || '插入封面失败', 'err'); return }
|
||||
notify('已插入封面图片')
|
||||
covData.then(function (u) {
|
||||
if (!u) { notify('封面文件读取失败(可能文件已丢失)', 'err'); return }
|
||||
dlg.close()
|
||||
beginPlacement('img', { dataUrl: u, name: p.name || '封面图片' })
|
||||
}).catch(function () { notify('插入封面失败', 'err') })
|
||||
})
|
||||
}
|
||||
@@ -1385,43 +1482,115 @@
|
||||
})
|
||||
delCover.addEventListener('click', function () { draft.cover = ''; dirty = true; Object.keys(coverCache).forEach(function (k) { if (k.indexOf(draft.id + '|') === 0) delete coverCache[k] }); repaint() })
|
||||
left.appendChild(cov); left.appendChild(el('div', { class: 'iwb-row' }, upBtn, delCover)); left.appendChild(fileIn)
|
||||
var nameIn = el('input', { class: 'iwb-input', placeholder: '名称', value: draft.name || '' })
|
||||
var nameIn = el('textarea', { class: 'iwb-input iwb-plp-namebox', placeholder: '名称', rows: '1' })
|
||||
nameIn.value = draft.name || ''
|
||||
var groupIn = el('input', { class: 'iwb-input', placeholder: '分组', value: draft.group || '' })
|
||||
var tagsIn = el('input', { class: 'iwb-input', placeholder: '标签,逗号分隔', value: (draft.tags || []).join(', ') })
|
||||
;[nameIn, groupIn, tagsIn].forEach(function (i) { i.addEventListener('input', function () { dirty = true }) })
|
||||
var tags = (draft.tags || []).slice()
|
||||
var tagWrap = el('div', { class: 'iwb-plp-tagwrap' })
|
||||
var tagChips = el('div', { class: 'iwb-plp-tagchips' })
|
||||
var tagIn = el('input', { class: 'iwb-input iwb-plp-tagin', placeholder: '添加标签' })
|
||||
var tagAdd = el('button', { class: 'iwb-btn iwb-btn-sm iwb-plp-tagadd', type: 'button', text: '+' })
|
||||
function paintTags () {
|
||||
tagChips.textContent = ''
|
||||
tags.forEach(function (t, ti) {
|
||||
var chip = el('span', { class: 'iwb-plp-tagchip' })
|
||||
chip.appendChild(document.createTextNode(t))
|
||||
var x = el('i', { class: 'iwb-plp-tagx', text: '×', title: '移除标签' })
|
||||
x.addEventListener('click', function () { tags.splice(ti, 1); dirty = true; paintTags() })
|
||||
chip.appendChild(x)
|
||||
tagChips.appendChild(chip)
|
||||
})
|
||||
}
|
||||
function addTag () {
|
||||
var t = String(tagIn.value || '').trim()
|
||||
if (!t) return
|
||||
if (!tags.some(function (x) { return x === t })) tags.push(t)
|
||||
tagIn.value = ''
|
||||
dirty = true
|
||||
paintTags()
|
||||
}
|
||||
tagAdd.addEventListener('click', addTag)
|
||||
tagIn.addEventListener('keydown', function (e) { if (e.key === 'Enter') { e.preventDefault(); addTag() } })
|
||||
;[nameIn, groupIn, tagIn].forEach(function (i) { i.addEventListener('input', function () { dirty = true }) })
|
||||
tagWrap.appendChild(tagChips); tagWrap.appendChild(el('div', { class: 'iwb-plp-tagrow' }, tagIn, tagAdd))
|
||||
paintTags()
|
||||
left.appendChild(el('label', { class: 'iwb-plp-lrow' }, el('span', { text: '名称' }), nameIn))
|
||||
left.appendChild(el('label', { class: 'iwb-plp-lrow' }, el('span', { text: '分组' }), groupIn))
|
||||
left.appendChild(el('label', { class: 'iwb-plp-lrow' }, el('span', { text: '标签' }), tagsIn))
|
||||
left.appendChild(el('div', { class: 'iwb-plp-lrow iwb-plp-lrow-tags' }, el('span', { text: '标签' }), tagWrap))
|
||||
var textIn = el('textarea', { class: 'iwb-input iwb-plp-etext', placeholder: '提示词正文' })
|
||||
var hl = el('div', { class: 'iwb-plp-hl' })
|
||||
var textWrap = el('div', { class: 'iwb-plp-ewrap' })
|
||||
textWrap.appendChild(hl); textWrap.appendChild(textIn)
|
||||
function paintHl () {
|
||||
var v = textIn.value || ''
|
||||
hl.textContent = ''
|
||||
var re = /[{]([^{}]{1,24})[}]/g, last = 0, m
|
||||
while ((m = re.exec(v))) {
|
||||
if (m.index > last) hl.appendChild(document.createTextNode(v.slice(last, m.index)))
|
||||
hl.appendChild(el('span', { class: 'iwb-plp-hlvar', text: m[0] }))
|
||||
last = m.index + m[0].length
|
||||
}
|
||||
if (last < v.length) hl.appendChild(document.createTextNode(v.slice(last)))
|
||||
hl.appendChild(document.createTextNode('\n'))
|
||||
}
|
||||
textIn.addEventListener('scroll', function () { hl.scrollTop = textIn.scrollTop })
|
||||
textIn.value = draft.text || ''
|
||||
var varEd = makeVarsEditor(draft.text || '', draft.vars || [])
|
||||
paintHl()
|
||||
var varEd = makeVarsEditor(draft.text || '', draft.vars || [], function (nt) { textIn.value = nt; dirty = true; paintHl() })
|
||||
var syncTimer = 0
|
||||
textIn.addEventListener('input', function () {
|
||||
dirty = true
|
||||
paintHl()
|
||||
if (syncTimer) clearTimeout(syncTimer)
|
||||
syncTimer = setTimeout(function () { varEd.sync(textIn.value) }, 200)
|
||||
})
|
||||
// v1.6.2:正文上方「插入变量」——在光标处插入 {变量} 并选中变量名,直接打字即可替换
|
||||
var lastSel = { s: 0, e: 0 }
|
||||
function rememberSel () {
|
||||
lastSel.s = typeof textIn.selectionStart === 'number' ? textIn.selectionStart : 0
|
||||
lastSel.e = typeof textIn.selectionEnd === 'number' ? textIn.selectionEnd : lastSel.s
|
||||
}
|
||||
;['keyup', 'mouseup', 'input', 'select'].forEach(function (ev) { textIn.addEventListener(ev, rememberSel) })
|
||||
var insVarBtn = el('button', { class: 'iwb-btn iwb-btn-sm iwb-plp-insvar', title: '在光标处插入 {变量}', text: '+ 插入变量' })
|
||||
// 按钮按下时不要抢走 textarea 的焦点/选区(否则插入点会漂移到上一次位置)
|
||||
insVarBtn.addEventListener('pointerdown', function (e) { e.preventDefault(); rememberSel() })
|
||||
insVarBtn.addEventListener('click', function () {
|
||||
var v = textIn.value
|
||||
var s = (typeof textIn.selectionStart === 'number') ? textIn.selectionStart : v.length
|
||||
var e = (typeof textIn.selectionEnd === 'number') ? textIn.selectionEnd : v.length
|
||||
var s = Math.min(Math.max(lastSel.s || 0, 0), v.length)
|
||||
var e = Math.min(Math.max(lastSel.e == null ? s : lastSel.e, s), v.length)
|
||||
var name = s !== e ? String(v.slice(s, e)).replace(/\s+/g, '').slice(0, 24) : '新变量'
|
||||
if (!name) name = '新变量'
|
||||
var ins = '{' + name + '}'
|
||||
textIn.value = v.slice(0, s) + ins + v.slice(e)
|
||||
textIn.selectionStart = s + 1
|
||||
textIn.selectionEnd = s + 1 + name.length
|
||||
textIn.focus()
|
||||
textIn.value = v.slice(0, s) + ins + v.slice(e)
|
||||
textIn.setSelectionRange(s + 1, s + 1 + name.length)
|
||||
lastSel = { s: s + 1, e: s + 1 + name.length }
|
||||
dirty = true
|
||||
paintHl()
|
||||
varEd.sync(textIn.value)
|
||||
})
|
||||
var mid = el('div', { class: 'iwb-plp-emid' })
|
||||
mid.appendChild(el('div', { class: 'iwb-plp-etool' }, insVarBtn, el('span', { class: 'iwb-hint', text: '在光标处插入 {变量},并自动聚焦变量名' })))
|
||||
mid.appendChild(textIn)
|
||||
mid.appendChild(varEd.node)
|
||||
bodyEl.appendChild(left); bodyEl.appendChild(mid)
|
||||
mid.appendChild(textWrap)
|
||||
var split = el('div', { class: 'iwb-plp-esplit', title: '拖动调整变量列宽度' })
|
||||
var right = el('div', { class: 'iwb-plp-eright' })
|
||||
right.appendChild(varEd.node)
|
||||
split.addEventListener('pointerdown', function (e) {
|
||||
e.preventDefault()
|
||||
var startX = e.clientX
|
||||
var startW = right.getBoundingClientRect().width
|
||||
function mv (ev) {
|
||||
var w = Math.max(190, Math.min(460, startW + (startX - ev.clientX)))
|
||||
right.style.width = w + 'px'
|
||||
}
|
||||
function up () {
|
||||
document.removeEventListener('pointermove', mv, true)
|
||||
document.removeEventListener('pointerup', up, true)
|
||||
}
|
||||
document.addEventListener('pointermove', mv, true)
|
||||
document.addEventListener('pointerup', up, true)
|
||||
})
|
||||
bodyEl.appendChild(left); bodyEl.appendChild(mid); bodyEl.appendChild(split); bodyEl.appendChild(right)
|
||||
var dupBtn = el('button', { class: 'iwb-btn iwb-btn-sm', text: '另存副本' })
|
||||
var insBtn = el('button', { class: 'iwb-btn iwb-btn-sm', text: '插入画布' })
|
||||
footEl.appendChild(dupBtn); footEl.appendChild(el('span', { class: 'iwb-drawer-spacer' })); footEl.appendChild(insBtn)
|
||||
@@ -1430,7 +1599,7 @@
|
||||
id: draft.id,
|
||||
name: nameIn.value,
|
||||
group: groupIn.value,
|
||||
tags: String(tagsIn.value || '').split(',').map(function (s) { return s.trim() }).filter(Boolean),
|
||||
tags: tags.slice(),
|
||||
text: textIn.value,
|
||||
cover: draft.cover || '',
|
||||
vars: varEd.list().filter(function (v) { return v && v.key }),
|
||||
@@ -1452,7 +1621,7 @@
|
||||
})
|
||||
}
|
||||
saveBtn.addEventListener('click', doSave)
|
||||
cancelBtn.addEventListener('click', function () { close() })
|
||||
cancelBtn.addEventListener('click', function () { close(); if (!isNew && p) { try { openDetailModal(p) } catch (e) { /* ignore */ } } })
|
||||
dupBtn.addEventListener('click', function () {
|
||||
var c = collect()
|
||||
var copy = Object.assign({}, c, { id: uid('q'), name: (String(c.name || '提示词').trim()) + ' 副本' })
|
||||
@@ -1594,7 +1763,7 @@
|
||||
global.IWBPluginHost.register({
|
||||
id: 'promptlib',
|
||||
name: '提示词库',
|
||||
version: '1.6.18',
|
||||
version: '1.8.21',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'promptlib', 'nodeTypes', 'canvas', 'canvasWrite'],
|
||||
data: { schemaVersion: 3, maxBytes: 4 * 1024 * 1024 },
|
||||
@@ -1726,7 +1895,7 @@
|
||||
defs.forEach(function (v) {
|
||||
var row = el('div', { class: 'iwb-plp-nrow' })
|
||||
row.appendChild(el('span', { class: 'iwb-plp-nk', text: v.label || v.key }))
|
||||
var inp = el('input', { class: 'iwb-input iwb-plp-nin', placeholder: v.def || ('填写 ' + (v.label || v.key)) })
|
||||
var inp = el('input', { class: 'iwb-input iwb-plp-nin', placeholder: v.desc || v.def || ('填写 ' + (v.label || v.key)) })
|
||||
inp.value = String((d.vars && d.vars[v.key]) || v.def || '')
|
||||
inp.addEventListener('input', function () { scheduleUpdate(st, d) })
|
||||
st.inputs[v.key] = inp
|
||||
@@ -1734,6 +1903,12 @@
|
||||
st.vars.appendChild(row)
|
||||
})
|
||||
if (!defs.length) st.vars.appendChild(el('div', { class: 'iwb-plp-nempty', text: '正文里没有 {变量}' }))
|
||||
try {
|
||||
var vv = {}
|
||||
Object.keys(st.inputs).forEach(function (k) { vv[k] = st.inputs[k].value })
|
||||
var clean = outputText(String(d.tpl || ''), vv)
|
||||
if (d.text !== clean && props && typeof props.onUpdate === 'function') props.onUpdate(node.id, { text: clean })
|
||||
} catch (e) { /* ignore */ }
|
||||
}
|
||||
// 缩略图:封面可能是 dataURL,也可能是插件文件引用
|
||||
var cover = d.cover
|
||||
@@ -1762,7 +1937,7 @@
|
||||
st.timer = setTimeout(function () {
|
||||
var vals = {}
|
||||
Object.keys(st.inputs).forEach(function (k) { vals[k] = st.inputs[k].value })
|
||||
var patch = { vars: vals, text: fillTpl(String(d.tpl || ''), vals) }
|
||||
var patch = { vars: vals, text: outputText(String(d.tpl || ''), vals) }
|
||||
try { st.props.onUpdate(st.node.id, patch) } catch (e) { /* ignore */ }
|
||||
}, 300)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "promptlib",
|
||||
"name": "提示词库",
|
||||
"version": "1.6.18",
|
||||
"version": "1.8.21",
|
||||
"apiVersion": 1,
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
@@ -13,7 +13,7 @@
|
||||
"提示词"
|
||||
],
|
||||
"files": {
|
||||
"main.js": "0efdfbbfe7e9318610bb94330c0a3c361a0aa38f2b3a44c243c872f0e02a09e8",
|
||||
"styles.css": "1fdad04e2ffe1c8ba2a991a88072f780b65238096f9ccd1b5adba671ff2c9cb3"
|
||||
"main.js": "125e02a618e37505836f964dbe21a3637e3043ee355d9606c538a54eed4243ad",
|
||||
"styles.css": "84ad2314d016c7d2351eb7cf2044ee8cc703992d40a76002ff644d34eb48838a"
|
||||
}
|
||||
}
|
||||
@@ -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(--plp-c1, #fff); font-size: 10.5px; line-height: 1.35; max-height: 48%;
|
||||
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
|
||||
text-shadow: 0 1px 2px rgba(0,0,0,.35);
|
||||
}
|
||||
@@ -389,3 +389,173 @@ box-shadow: 0 24px 60px rgba(0,0,0,.32);
|
||||
.iwb-plp-node:not(.is-selected) input{pointer-events:none}
|
||||
.iwb-plp-card{user-select:none}
|
||||
body.iwb-plp-dragging, body.iwb-plp-dragging *{user-select:none!important;-webkit-user-select:none!important}
|
||||
.iwb-plp-placeghost{border-style:dashed!important;pointer-events:none}
|
||||
.iwb-plp-placehint{font-size:10.5px;color:var(--iwb-plp-accent,#5a4bd0);margin-top:2px}
|
||||
.iwb-plp-placebox{position:fixed;left:-9999px;top:0;z-index:99999;pointer-events:none;border:2px dashed var(--iwb-plp-accent,#6b4dff);border-radius:12px;background:color-mix(in srgb,var(--iwb-plp-accent,#6b4dff) 9%,transparent);display:flex;align-items:center;justify-content:center;box-shadow:0 10px 26px rgba(30,20,80,.10)}
|
||||
.iwb-plp-placebox-t{font-size:12px;color:var(--iwb-plp-accent,#5a3fd0);background:rgba(255,255,255,.82);border-radius:999px;padding:3px 10px}
|
||||
/* v1.6.23:放置指示改为灰色小方框 */
|
||||
.iwb-plp-placebox{border: 2px dashed var(--plp-c2, #9aa3ad);border-radius:10px;background:rgba(122,130,142,.10);box-shadow:none}
|
||||
.iwb-plp-placebox-t{font-size:11px;color: var(--plp-c3, #6b7280);background:rgba(255,255,255,.75);padding:2px 8px}
|
||||
/* v1.7.0:编辑面板三栏 + 可拖宽;详情封面放大、变量高亮 */
|
||||
.iwb-plp-eleft{flex:0 0 236px;width:236px}
|
||||
.iwb-plp-emid{flex:1 1 auto;min-width:220px;display:flex;flex-direction:column;min-height:0}
|
||||
.iwb-plp-emid .iwb-plp-etext{flex:1 1 auto;min-height:0;resize:none}
|
||||
.iwb-plp-esplit{flex:0 0 10px;cursor:col-resize;display:flex;align-items:center;justify-content:center;border-radius:6px;background:var(--iwb-plugin-inset,#f3f4f7)}
|
||||
.iwb-plp-esplit:hover{background:var(--iwb-plugin-hover,#e9ecf1)}
|
||||
.iwb-plp-eright{flex:0 0 auto;width:300px;min-width:190px;max-width:460px;display:flex;flex-direction:column;min-height:0;background:var(--iwb-plugin-surface,#fafbfc);border:1px solid var(--iwb-border,#e6e8ec);border-radius:10px;padding:8px}
|
||||
.iwb-plp-vars{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
|
||||
.iwb-plp-vrows{flex:1 1 auto;min-height:0;overflow:auto}
|
||||
.iwb-plp-vitem{padding:4px 0;border-bottom:1px dashed var(--iwb-border,#eceef2)}
|
||||
.iwb-plp-vrow2{display:flex;align-items:center;gap:6px}
|
||||
.iwb-plp-vname{flex:1 1 auto;min-width:0;height:32px}
|
||||
.iwb-plp-vi{flex:0 0 auto;width:24px;height:24px;padding:0;border-radius:50%;border:1px solid var(--iwb-border,#dfe3e9);background: var(--plp-c1, #fff);color: var(--plp-c4, #9aa1ac);font-size:11px;line-height:22px;text-align:center}
|
||||
.iwb-plp-vi.is-open{background: var(--plp-c5, #f1ecff);border-color: var(--plp-c6, #d8cbff);color: var(--plp-c7, #5a3fd0)}
|
||||
.iwb-plp-vdesc{width:100%;height:28px;margin-top:5px;border-style:dashed;background: var(--plp-c8, #fbfcfd);font-size:11.5px;color: var(--plp-c3, #6b7280)}
|
||||
.iwb-plp-dcov{flex:0 0 auto;width:180px;height:180px;border-radius:12px;overflow:hidden}
|
||||
.iwb-plp-dvar{background: var(--plp-c5, #f1ecff);color: var(--plp-c7, #5a3fd0);border-radius:4px;padding:0 4px;font-weight:500}
|
||||
/* v1.7.1:编辑面板视觉精修——输入框比底色更亮、去多余边框、细分隔线 */
|
||||
.iwb-plp-dialog .iwb-plp-dbody{gap:10px;padding:12px;background: var(--plp-c9, #f4f5f7)}
|
||||
.iwb-plp-dialog .iwb-plp-eleft{flex:0 0 236px;width:236px;background: var(--plp-c1, #fff);border: 1px solid var(--plp-c10, #e6e8ec);border-radius:12px;padding:12px}
|
||||
.iwb-plp-dialog .iwb-plp-emid{background: var(--plp-c1, #fff);border: 1px solid var(--plp-c10, #e6e8ec);border-radius:12px;padding:10px 12px 12px}
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-etext{border: 1px solid var(--plp-c11, #eef0f3);background: var(--plp-c8, #fbfcfd);border-radius:9px;padding:10px 12px}
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-etext:focus{background: var(--plp-c1, #fff);border-color: var(--plp-c12, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)}
|
||||
.iwb-plp-dialog .iwb-plp-esplit{flex:0 0 6px;background:transparent;border-radius:4px}
|
||||
.iwb-plp-dialog .iwb-plp-esplit:hover{background: var(--plp-c13, #e7e9ee)}
|
||||
.iwb-plp-dialog .iwb-plp-esplit::before{content:'';display:block;width:2px;height:30px;border-radius:2px;background: var(--plp-c14, #d7dbe2)}
|
||||
.iwb-plp-dialog .iwb-plp-eright{background:transparent;border:0;padding:2px 0 0}
|
||||
.iwb-plp-dialog .iwb-plp-vitem{border:0;padding:2px 0}
|
||||
.iwb-plp-dialog .iwb-plp-vrow2{gap:6px}
|
||||
.iwb-plp-dialog .iwb-plp-vname{background: var(--plp-c8, #fbfcfd);border: 1px solid var(--plp-c15, #eceef2);border-radius:8px;height:32px;padding:0 10px;font-size:12.5px;color: var(--plp-c16, #33383f)}
|
||||
.iwb-plp-dialog .iwb-plp-vname:focus{background: var(--plp-c1, #fff);border-color: var(--plp-c12, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)}
|
||||
.iwb-plp-dialog .iwb-plp-vi{background:transparent;border:0;color: var(--plp-c17, #aab0ba);width:22px;height:22px;line-height:20px}
|
||||
.iwb-plp-dialog .iwb-plp-vi:hover{background: var(--plp-c18, #eef0f4);color: var(--plp-c3, #6b7280)}
|
||||
.iwb-plp-dialog .iwb-plp-vi.is-open{background: var(--plp-c5, #f1ecff);color: var(--plp-c7, #5a3fd0)}
|
||||
.iwb-plp-dialog .iwb-plp-vdesc{background: var(--plp-c8, #fbfcfd);border: 1px dashed var(--plp-c19, #e2e6ec);border-radius:7px;height:28px;margin-top:4px}
|
||||
.iwb-plp-dialog .iwb-plp-lrow span{color: var(--plp-c20, #8a919c);font-size:11.5px}
|
||||
.iwb-plp-dialog .iwb-plp-lrow .iwb-input{background: var(--plp-c8, #fbfcfd);border: 1px solid var(--plp-c15, #eceef2);border-radius:8px;height:32px}
|
||||
.iwb-plp-dialog .iwb-plp-lrow .iwb-input:focus{background: var(--plp-c1, #fff);border-color: var(--plp-c12, #cfc3ff)}
|
||||
/* v1.7.2:正文变量高亮(黑粗)+ 说明灰按钮 + 说明背景回归面板底 */
|
||||
.iwb-plp-ewrap{position:relative;flex:1 1 auto;min-height:0;display:flex;border-radius:9px;background: var(--plp-c8, #fbfcfd);border: 1px solid var(--plp-c11, #eef0f3)}
|
||||
.iwb-plp-ewrap:focus-within{background: var(--plp-c1, #fff);border-color: var(--plp-c12, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)}
|
||||
.iwb-plp-ewrap .iwb-plp-etext{flex:1 1 auto;min-height:0;border:0;background:transparent;box-shadow:none;color:transparent;caret-color:var(--plp-c22, #1d2129);position:relative;z-index:1;resize:none}
|
||||
.iwb-plp-ewrap .iwb-plp-etext:focus{background:transparent;border:0;box-shadow:none}
|
||||
.iwb-plp-hl{position:absolute;inset:0;padding:10px 12px;overflow:hidden;white-space:pre-wrap;word-wrap:break-word;font-size:13px;line-height:1.9;color: var(--plp-c21, #5b6472);pointer-events:none;z-index:0}
|
||||
.iwb-plp-hlvar{color: var(--plp-c22, #1d2129);font-weight:600}
|
||||
.iwb-plp-dialog .iwb-plp-vi.is-open{background: var(--plp-c11, #eef0f3);color: var(--plp-c21, #5b6472)}
|
||||
.iwb-plp-dialog .iwb-plp-vdesc{background:transparent;border: 1px dashed var(--plp-c23, #dfe3e9)}
|
||||
.iwb-plp-dvar{background:transparent;color: var(--plp-c22, #1d2129);font-weight:600;padding:0}
|
||||
.iwb-plp-hres{height:6px;margin:-3px 0 0;cursor:ns-resize;flex:0 0 auto;border-radius:3px}
|
||||
.iwb-plp-hres:hover{background: var(--plp-c13, #e7e9ee)}
|
||||
/* 正文可见性:textarea 透明,显示下方高亮层 */
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap{flex:1 1 auto;min-height:0;position:relative;display:flex;background: var(--plp-c8, #fbfcfd);border: 1px solid var(--plp-c11, #eef0f3);border-radius:9px}
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap .iwb-plp-etext{background:transparent!important;color:transparent!important;border:0!important;box-shadow:none!important;padding:10px 12px}
|
||||
.iwb-plp-dialog .iwb-plp-hl{padding:10px 12px;font-size:13px;line-height:1.9}
|
||||
.iwb-plp-namebox{min-height:34px;height:34px;line-height:1.45;padding:7px 10px;resize:vertical;overflow:auto;font-size:12.5px}
|
||||
.iwb-plp-insvar{color: var(--plp-c22, #1d2129)!important;background: var(--plp-c1, #fff)!important;border-color: var(--plp-c19, #e2e6ec)!important}
|
||||
.iwb-plp-insvar:hover{background: var(--plp-c24, #f4f6f9)!important}
|
||||
/* v1.7.5:编辑封面卡在框内;详情封面放大 */
|
||||
.iwb-plp-dialog .iwb-plp-ecov{width:100%;height:250px;overflow:hidden;border-radius:12px;background:var(--iwb-plugin-inset,#f3f4f7)}
|
||||
.iwb-plp-dialog .iwb-plp-ecov .iwb-plp-cover{width:100%;height:100%;object-fit:cover;object-position:center;display:block;border-radius:12px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{align-items:flex-start}
|
||||
.iwb-plp-dialog .iwb-plp-dcov{width:264px;height:264px;flex:0 0 auto;overflow:hidden;border-radius:12px;background:var(--iwb-plugin-inset,#f3f4f7)}
|
||||
.iwb-plp-dialog .iwb-plp-dcov .iwb-plp-cover{width:100%;height:100%;object-fit:cover;object-position:center;display:block;border-radius:12px}
|
||||
/* v1.7.6:封面完整展示(contain),不裁剪 */
|
||||
.iwb-plp-dialog .iwb-plp-ecov .iwb-plp-cover{object-fit:contain;background:transparent}
|
||||
.iwb-plp-dialog .iwb-plp-dcov .iwb-plp-cover{object-fit:contain;background:transparent}
|
||||
.iwb-plp-dialog .iwb-plp-ecov{background:var(--iwb-plugin-inset,#f3f4f7)}
|
||||
.iwb-plp-dialog .iwb-plp-dcov{background:var(--iwb-plugin-inset,#f3f4f7)}
|
||||
/* v1.7.7:编辑区文字层与高亮层使用完全一致的字体度量,修复光标/选区错位 */
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap .iwb-plp-etext,
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-hl{
|
||||
font-family:-apple-system,BlinkMacSystemFont,'PingFang SC','Helvetica Neue',system-ui,sans-serif!important;
|
||||
font-size:13px!important;
|
||||
line-height:1.85!important;
|
||||
letter-spacing:0!important;
|
||||
padding:10px 12px!important;
|
||||
margin:0!important;
|
||||
border:0!important;
|
||||
box-sizing:border-box!important;
|
||||
white-space:pre-wrap!important;
|
||||
overflow-wrap:break-word!important;
|
||||
word-break:break-word!important;
|
||||
tab-size:4!important;
|
||||
}
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap .iwb-plp-etext{overflow-y:auto!important;scrollbar-gutter:stable}
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-hl{overflow:hidden!important}
|
||||
/* v1.7.9:详情正文独立滚动,长文不再压到底部按钮 */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{overflow:hidden;align-items:stretch}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dright{flex:1 1 auto;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtext{flex:1 1 auto;min-height:0;overflow:auto;padding-right:10px;margin-bottom:6px}
|
||||
/* v1.8.0:详情标题/分组/标签移到封面下方;编辑标签改为输入+加号 */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{align-items:flex-start}
|
||||
.iwb-plp-dleftcol{flex:0 0 264px;width:264px;display:flex;flex-direction:column;min-width:0}
|
||||
.iwb-plp-dtitle{font-size:18px;font-weight:650;line-height:1.35;margin-top:14px;color:var(--iwb-text,#1d2129)}
|
||||
.iwb-plp-dmeta{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:8px}
|
||||
.iwb-plp-dgroup{font-size:11.5px;background: var(--plp-c18, #eef0f4);color: var(--plp-c21, #5b6472);border-radius:999px;padding:2px 9px}
|
||||
.iwb-plp-dtag{font-size:11.5px;background: var(--plp-c25, #f4f0ff);color: var(--plp-c7, #5a3fd0);border-radius:999px;padding:2px 9px}
|
||||
.iwb-plp-dlen{font-size:11.5px;color: var(--plp-c4, #9aa1ac)}
|
||||
.iwb-plp-tagwrap{display:flex;flex-direction:column;gap:6px;flex:1;min-width:0}
|
||||
.iwb-plp-tagchips{display:flex;flex-wrap:wrap;gap:5px}
|
||||
.iwb-plp-tagchip{display:inline-flex;align-items:center;gap:4px;font-size:11.5px;background: var(--plp-c18, #eef0f4);border-radius:999px;padding:2px 8px;color: var(--plp-c26, #3f4450)}
|
||||
.iwb-plp-tagx{cursor:pointer;color: var(--plp-c4, #9aa1ac);font-style:normal}
|
||||
.iwb-plp-tagx:hover{color: var(--plp-c27, #c0392b)}
|
||||
.iwb-plp-tagrow{display:flex;gap:6px}
|
||||
.iwb-plp-tagin{flex:1;min-width:0;height:30px}
|
||||
.iwb-plp-lrow-tags{align-items:flex-start}
|
||||
.iwb-plp-tagadd{flex:0 0 auto;width:30px;height:30px;padding:0;font-size:15px;line-height:28px}
|
||||
/* v1.8.1:详情标题/分组/标签左对齐并带标题;标签加号对齐修复 */
|
||||
.iwb-plp-dtitle{font-size:20px;font-weight:650;line-height:1.35;margin-top:16px;color:var(--iwb-text,#1d2129)}
|
||||
.iwb-plp-dmeta{display:flex;flex-direction:column;gap:7px;margin-top:12px;align-items:flex-start}
|
||||
.iwb-plp-dmrow{display:flex;align-items:center;gap:10px;width:100%}
|
||||
.iwb-plp-dmk{flex:0 0 30px;width:30px;font-size:11.5px;color: var(--plp-c4, #9aa1ac)}
|
||||
.iwb-plp-dmv{display:flex;flex-wrap:wrap;align-items:center;gap:5px;min-width:0}
|
||||
.iwb-plp-dgroup{font-size:12px;color: var(--plp-c26, #3f4450);background: var(--plp-c28, #f2f4f7);border-radius:6px;padding:2px 9px}
|
||||
.iwb-plp-dtag{font-size:11.5px;color: var(--plp-c7, #5a3fd0);background: var(--plp-c25, #f4f0ff);border-radius:6px;padding:2px 9px}
|
||||
.iwb-plp-dempty{font-size:12px;color: var(--plp-c29, #b3b9c2)}
|
||||
.iwb-plp-dlen{font-size:12px;color: var(--plp-c20, #8a919c)}
|
||||
.iwb-plp-tagrow{display:flex;align-items:center;gap:6px}
|
||||
.iwb-plp-tagin{height:30px;border-radius:8px}
|
||||
.iwb-plp-tagadd{flex:0 0 auto;width:30px;height:30px;padding:0;border-radius:8px;background: var(--plp-c28, #f2f4f7);border: 1px solid var(--plp-c19, #e2e6ec);color: var(--plp-c21, #5b6472);font-size:16px;line-height:1;display:inline-flex;align-items:center;justify-content:center}
|
||||
.iwb-plp-tagadd:hover{background: var(--plp-c30, #e9ecf1)}
|
||||
/* v1.8.2:详情左右两栏卡片化 + 分割线 */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{gap:14px;padding:16px;background: var(--plp-c9, #f4f5f7)}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dleftcol{flex:0 0 300px;width:300px;padding:12px;border: 1px solid var(--plp-c31, #e8eaee);border-radius:14px;background: var(--plp-c1, #fff);align-self:flex-start}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dcov{width:100%;height:270px;border-radius:10px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtitle{font-size:20px;font-weight:650;line-height:1.35;margin-top:14px;color:var(--iwb-text,#1d2129)}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmeta{margin-top:12px;padding-top:12px;border-top: 1px solid var(--plp-c11, #eef0f3);gap:8px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dright{flex:1 1 auto;min-width:0;min-height:0;display:flex;flex-direction:column;padding:14px 16px;border: 1px solid var(--plp-c31, #e8eaee);border-radius:14px;background: var(--plp-c1, #fff);overflow:hidden}
|
||||
.iwb-plp-dsec{font-size:11.5px;font-weight:600;color: var(--plp-c20, #8a919c);letter-spacing:.04em;padding-bottom:8px;margin-bottom:8px;border-bottom: 1px solid var(--plp-c11, #eef0f3);flex:0 0 auto}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtext{flex:1 1 auto;min-height:0;overflow:auto;padding-right:10px;font-size:13.5px;line-height:2;color: var(--plp-c32, #3a4048)}
|
||||
/* v1.8.3:详情左卡片撑到底、四边等距;正文恢复滚动不被底部遮挡 */
|
||||
.iwb-plp-dialog-detail{display:flex;flex-direction:column;overflow:hidden}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{display:flex;flex:1 1 auto;min-height:0;overflow:hidden;gap:14px;padding:16px;background: var(--plp-c9, #f4f5f7)}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dleftcol{align-self:stretch;display:flex;flex-direction:column;overflow:auto;padding:12px;border: 1px solid var(--plp-c31, #e8eaee);border-radius:14px;background: var(--plp-c1, #fff)}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dright{flex:1 1 auto;min-width:0;min-height:0;overflow:hidden;display:flex;flex-direction:column;padding:14px 16px;border: 1px solid var(--plp-c31, #e8eaee);border-radius:14px;background: var(--plp-c1, #fff)}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtext{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;padding-right:8px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dfooter{flex:0 0 auto}
|
||||
/* v1.8.4:右卡片纵向拉伸填满,正文出现滚动条 */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{align-items:stretch!important}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dright{align-self:stretch!important;height:100%;max-height:100%;overflow:hidden!important}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtext{flex:1 1 0;min-height:0;overflow-y:auto!important;overflow-x:hidden}
|
||||
/* v1.8.7:详情标题缩小;分组/标签去底色;元信息加分割线与行高 */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtitle{font-size:17px!important;font-weight:650;margin-top:12px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmeta{margin-top:12px;padding-top:14px;border-top: 1px solid var(--plp-c11, #eef0f3);gap:10px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmrow{gap:6px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmk{flex:0 0 auto;width:auto;font-size:12px;line-height:1.6;color: var(--plp-c4, #9aa1ac)}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dgroup,.iwb-plp-dialog-detail .iwb-plp-dtag{background:transparent!important;padding:0!important;border-radius:0!important;font-size:12.5px;line-height:1.6;color: var(--plp-c33, #2f3540)}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtag{color: var(--plp-c7, #5a3fd0);}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dlen{font-size:12.5px;line-height:1.6;color: var(--plp-c33, #2f3540)}
|
||||
/* v1.8.8:详情标题 14px;元信息行间浅分割线;封面底色更接近白色(编辑/详情统一) */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtitle{font-size:14px!important;font-weight:650;line-height:1.5;margin-top:12px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmeta{gap:0}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmrow{padding:7px 0;border-bottom: 1px solid var(--plp-c34, #f3f5f8)}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmrow:last-child{border-bottom:0}
|
||||
.iwb-plp-dialog .iwb-plp-dcov,.iwb-plp-dialog .iwb-plp-ecov{background: var(--plp-c35, #fcfcfd)!important}
|
||||
.iwb-plp-dialog .iwb-plp-dcov .iwb-plp-cover,.iwb-plp-dialog .iwb-plp-ecov .iwb-plp-cover{background:transparent!important}
|
||||
/* v1.8.19:编辑区高亮变量不得加粗——加粗会改变字形宽度,导致点击位置逐次向左偏移 */
|
||||
.iwb-plp-hlvar{font-weight:400!important;letter-spacing:normal!important}
|
||||
/* v1.8.20:编辑区不再用透明 textarea+高亮层(两层字体/换行差异会让点击坐标逐次偏移);正文直接由 textarea 渲染,插入点 100% 对应光标 */
|
||||
.iwb-plp-ewrap .iwb-plp-hl{display:none!important}
|
||||
.iwb-plp-ewrap .iwb-plp-etext{color:var(--iwb-text,#2a2f36)!important;background:transparent!important}
|
||||
/* v1.8.21:高亮层隐藏后,正文文字必须可见(覆盖旧的 transparent !important) */
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap .iwb-plp-etext{color:var(--iwb-text,#2a2f36)!important;caret-color:var(--iwb-text,#2a2f36)!important;-webkit-text-fill-color:var(--iwb-text,#2a2f36)!important}
|
||||
@@ -55,6 +55,8 @@ const html = `<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>${esc(data.app)} · 下载</title>
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=" + encodeURIComponent(latest.version + '-' + Date.now().toString(36)) + "">
|
||||
<style>
|
||||
*{box-sizing:border-box}
|
||||
@@ -85,7 +87,7 @@ const html = `<!doctype html>
|
||||
</head>
|
||||
<body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
|
||||
<a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>
|
||||
<div class="links">
|
||||
<a href="/">首页</a>
|
||||
<a href="/download/" class="on">下载</a>
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ const plugins = Array.isArray(market.plugins) ? market.plugins : []
|
||||
|
||||
const nav = (active) => [
|
||||
'<nav><div class="wrap inner">',
|
||||
' <a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>',
|
||||
' <a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>',
|
||||
' <div class="links">',
|
||||
' <a href="/"' + (active === 'home' ? ' class="on"' : '') + '>首页</a>',
|
||||
' <a href="/download/"' + (active === 'download' ? ' class="on"' : '') + '>下载</a>',
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>插件开发规范 · Image Workbench</title>
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<link rel="stylesheet" href="/assets/style.css">
|
||||
<style>
|
||||
.devdoc{max-width:860px;margin:0 auto;padding:40px 0 72px;color:var(--ink,#1b1f24);font-size:15px;line-height:1.75}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Image Workbench · 本地优先的 AI 生图工作台</title>
|
||||
<meta name="description" content="本地优先的 AI 生图无限画布:节点式工作流、插件按需安装、数据全部留在本机。">
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<link rel="stylesheet" href="/assets/style.css">
|
||||
</head><body>
|
||||
<!--NAV-->
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>插件市场 · Image Workbench</title>
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<link rel="stylesheet" href="/assets/style.css">
|
||||
</head><body>
|
||||
<!--NAV-->
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 85 KiB |
@@ -139,3 +139,4 @@ pre.cmd code{font-size:12.5px}
|
||||
.hero-veil{background:
|
||||
radial-gradient(62% 58% at 50% 40%, rgba(255,255,255,.86) 0%, rgba(255,255,255,.70) 46%, rgba(255,255,255,.16) 100%),
|
||||
linear-gradient(180deg, rgba(255,255,255,.84) 0%, rgba(255,255,255,.52) 50%, rgba(255,255,255,.20) 76%, #fff 100%)}
|
||||
nav .brand .logo{width:26px;height:26px;border-radius:7px;object-fit:cover;display:block;flex:0 0 auto}
|
||||
+5
-3
@@ -1,7 +1,9 @@
|
||||
<!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.39-mwrxcd5p">
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.40-mwsgavpk">
|
||||
<style>
|
||||
.devdoc{max-width:860px;margin:0 auto;padding:40px 0 72px;color:var(--ink,#1b1f24);font-size:15px;line-height:1.75}
|
||||
.devdoc h1{font-size:38px;line-height:1.2;margin:8px 0 18px}
|
||||
@@ -21,7 +23,7 @@
|
||||
</style>
|
||||
</head><body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
|
||||
<a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>
|
||||
<div class="links">
|
||||
<a href="/">首页</a>
|
||||
<a href="/download/">下载</a>
|
||||
@@ -31,7 +33,7 @@
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="btn" href="/plugins/">插件市场</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.39</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.40</a>
|
||||
</div>
|
||||
</div></nav>
|
||||
<main>
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Image Workbench · 下载</title>
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=" + encodeURIComponent(latest.version + '-' + Date.now().toString(36)) + "">
|
||||
<style>
|
||||
*{box-sizing:border-box}
|
||||
@@ -34,7 +36,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
|
||||
<a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>
|
||||
<div class="links">
|
||||
<a href="/">首页</a>
|
||||
<a href="/download/" class="on">下载</a>
|
||||
@@ -55,18 +57,18 @@
|
||||
<h2>下载</h2>
|
||||
<div class="row">
|
||||
<div class="name">macOS · Apple Silicon<div class="hint">M1 / M2 / M3 / M4</div></div>
|
||||
<div class="meta">版本 3.26.39 · 8.4 MB · .dmg<div class="hash">sha256 15e9c10f31caea3a…</div></div>
|
||||
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.26.39_aarch64.dmg?h=15e9c10f31ca">下载</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.39 · 8.8 MB · .dmg<div class="hash">sha256 1016831ad95f21be…</div></div>
|
||||
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.26.39_x64.dmg?h=1016831ad95f">下载</a>
|
||||
<div class="meta">版本 3.26.40 · 8.8 MB · .dmg<div class="hash">sha256 6890b428aee6233c…</div></div>
|
||||
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.26.40_x64.dmg?h=6890b428aee6">下载</a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">Windows · x64<div class="hint">需要 WebView2</div></div>
|
||||
<div class="meta"></div>
|
||||
<span class="muted">暂未提供</span>
|
||||
<div class="meta">版本 3.26.40 · 4.8 MB · .exe<div class="hash">sha256 c82010565b339520…</div></div>
|
||||
<a class="btn" href="/updates/windows-x86_64/image-workbench_3.26.40_x64-setup.exe?h=c82010565b33">下载</a>
|
||||
</div>
|
||||
|
||||
<h2>系统要求</h2>
|
||||
@@ -96,8 +98,12 @@
|
||||
|
||||
<h2>历史版本</h2>
|
||||
<div class="row">
|
||||
<div class="name">3.26.39<div class="hint">Intel 版:同一版本</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
<div class="name">3.26.40<div class="hint">Windows:修复 PowerShell 弹窗(改用 GetProcessMemoryInfo)</div></div>
|
||||
<div class="meta">2026-11-23<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.39<div class="hint">v3.26.39:修正插件插入落点与封面插入(拖拽落点按节点宽高居中到鼠标、插入落到画布可视中心、封面先解析为 dataURL 再插入)</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.38<div class="hint">Intel 版:同一版本</div></div>
|
||||
|
||||
+12
-10
@@ -2,10 +2,12 @@
|
||||
<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.39-mwrxcd5p">
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.40-mwsgavpk">
|
||||
</head><body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
|
||||
<a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>
|
||||
<div class="links">
|
||||
<a href="/" class="on">首页</a>
|
||||
<a href="/download/">下载</a>
|
||||
@@ -15,19 +17,19 @@
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="btn" href="/plugins/">插件市场</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.39</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.39-mwrxcd5p" alt=""></div>
|
||||
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.26.40-mwsgavpk" alt=""></div>
|
||||
<div class="hero-veil"></div>
|
||||
<div class="wrap">
|
||||
<span class="kicker">v3.26.39 · 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.39</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>
|
||||
@@ -83,7 +85,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.6.18 · 官方</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,9 +96,9 @@
|
||||
<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.39_aarch64.dmg?h=15e9c10f31ca"><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.39_x64.dmg?h=1016831ad95f"><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 class="dl"><a href="/updates/darwin-aarch64/image-workbench_3.26.40_aarch64.dmg?h=165f48fa6c2d"><div class="n">macOS · Apple Silicon</div><div class="s">M1 / M2 / M3 / M4 · 8.4 MB · .dmg</div></a>
|
||||
<a href="/updates/darwin-x86_64/image-workbench_3.26.40_x64.dmg?h=6890b428aee6"><div class="n">macOS · Intel</div><div class="s">x86_64 · 8.8 MB · .dmg</div></a>
|
||||
<a href="/updates/windows-x86_64/image-workbench_3.26.40_x64-setup.exe?h=c82010565b33"><div class="n">Windows · x64</div><div class="s">需要 WebView2 · 4.8 MB · .exe</div></a></div>
|
||||
<div style="margin-top:20px;color:#9ca3af;font-size:12.5px">安装包未做 Apple 公证 / Windows 代码签名,首次打开需手动放行一次,细节见 <a href="/download/" style="text-decoration:underline">下载页</a>。</div>
|
||||
</div></section>
|
||||
</main>
|
||||
|
||||
+11
-11
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": 2,
|
||||
"updatedAt": "2026-11-22T14:17:37.777Z",
|
||||
"updatedAt": "2026-11-22T15:51:05.074Z",
|
||||
"plugins": [
|
||||
{
|
||||
"id": "batch-export",
|
||||
@@ -180,26 +180,26 @@
|
||||
"资源",
|
||||
"提示词"
|
||||
],
|
||||
"version": "1.6.18",
|
||||
"version": "1.8.8",
|
||||
"apiVersion": 1,
|
||||
"bundle": "plugins/promptlib-1.6.18.zip",
|
||||
"bundleSize": 122581,
|
||||
"bundleSha256": "7397f802ad45110ecdc18cefe908921a8305e46580af0cad5de379f4058817e9",
|
||||
"bundle": "plugins/promptlib-1.8.8.zip",
|
||||
"bundleSize": 146066,
|
||||
"bundleSha256": "af91d59add3df05c390c6ead566663545acaf1200461185668750422360a2f6f",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "fdcee6bb4051a656186937fdd424139c282c45d4b3c8c47c0e4d0c426ec9c0f8",
|
||||
"size": 541
|
||||
"sha256": "667ddf6ddedab0ce3abbccbe3dfaa34c56bfa90179369c1c013e736ee5eb15e7",
|
||||
"size": 540
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "0efdfbbfe7e9318610bb94330c0a3c361a0aa38f2b3a44c243c872f0e02a09e8",
|
||||
"size": 98119
|
||||
"sha256": "91fde4bcfa888b04ee2b0e79a05d951a56247bc76ecd11b5d9500131df11d542",
|
||||
"size": 106422
|
||||
},
|
||||
{
|
||||
"path": "styles.css",
|
||||
"sha256": "1fdad04e2ffe1c8ba2a991a88072f780b65238096f9ccd1b5adba671ff2c9cb3",
|
||||
"size": 23611
|
||||
"sha256": "82bdae857b0c6e66c0e1c9fa0ea47b269dcbde51cdfacd552e4b919cfa4576c7",
|
||||
"size": 38794
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
<!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.39-mwrxcd5p">
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.40-mwsgavpk">
|
||||
</head><body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
|
||||
<a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>
|
||||
<div class="links">
|
||||
<a href="/">首页</a>
|
||||
<a href="/download/">下载</a>
|
||||
@@ -14,7 +16,7 @@
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="btn" href="/plugins/">插件市场</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.39</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.40</a>
|
||||
</div>
|
||||
</div></nav>
|
||||
<main>
|
||||
@@ -77,7 +79,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.6.18 · 官方</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>
|
||||
|
||||
+37
-2
@@ -1,12 +1,40 @@
|
||||
{
|
||||
"app": "Image Workbench",
|
||||
"subtitle": "本地优先的 AI 生图无限画布 · 桌面版(Tauri v2)",
|
||||
"updatedAt": "2026-11-22T14:20:35.743Z",
|
||||
"updatedAt": "2026-11-22T17:16:21.567Z",
|
||||
"releases": [
|
||||
{
|
||||
"version": "3.26.40",
|
||||
"date": "2026-11-23",
|
||||
"notes": "Windows:修复 PowerShell 弹窗(改用 GetProcessMemoryInfo)",
|
||||
"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"
|
||||
},
|
||||
"windows-x86_64": {
|
||||
"file": "updates/windows-x86_64/image-workbench_3.26.40_x64-setup.exe",
|
||||
"size": 5003204,
|
||||
"sha256": "c82010565b339520b72d56589bbbd287334119436adf86a5b43e3c4dfb363bf0",
|
||||
"h": "c82010565b33",
|
||||
"kind": "exe"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.39",
|
||||
"date": "2026-11-22",
|
||||
"notes": "Intel 版:同一版本",
|
||||
"notes": "v3.26.39:修正插件插入落点与封面插入(拖拽落点按节点宽高居中到鼠标、插入落到画布可视中心、封面先解析为 dataURL 再插入)",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.39_aarch64.dmg",
|
||||
@@ -21,6 +49,13 @@
|
||||
"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"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Generated
+2
-1
@@ -1983,7 +1983,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "image-workbench"
|
||||
version = "3.26.39"
|
||||
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.39"
|
||||
version = "3.26.41"
|
||||
description = "无限画布 · 生图工作台桌面版"
|
||||
authors = ["malongan"]
|
||||
license = ""
|
||||
@@ -44,3 +44,7 @@ base64 = "0.22"
|
||||
# (Cargo.lock 里是同一个 0.6.x),这里显式依赖不会多编译一份。
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
objc2 = "0.6"
|
||||
|
||||
# Windows:直接读进程工作集(GetProcessMemoryInfo),不再启动 PowerShell 子进程
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
windows-sys = { version = "0.52", features = ["Win32_Foundation", "Win32_System_ProcessStatus", "Win32_System_Threading"] }
|
||||
+7
-11
@@ -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
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"productName": "image-workbench",
|
||||
"version": "3.26.39",
|
||||
"version": "3.26.41",
|
||||
"identifier": "com.malongan.imageworkbench",
|
||||
"build": {
|
||||
"frontendDist": "../dist",
|
||||
|
||||
@@ -120,12 +120,12 @@
|
||||
let x1 = src.x + nodeWidth(src), y1 = src.y + hOf(src) / 2
|
||||
let x2 = dst.x, y2 = dst.y + inY
|
||||
if (src.type === 'batch' && ed.batchSrcId) {
|
||||
const bsrcs = ((graph && graph.incomingByNode.get(src.id)) || []).map((e) => graph && graph.byId.get(e.from)).filter((n) => isBatchSrc(n)).slice().sort(compareCanvasTextOrder)
|
||||
const bsrcs = ((graph && graph.incomingByNode.get(src.id)) || []).map((e) => graph && graph.byId.get(e.from)).filter((n) => isBatchSrc(n, graph && graph.edges, graph && graph.nodes)).slice().sort(compareCanvasTextOrder)
|
||||
const idx = bsrcs.findIndex((s) => s.id === ed.batchSrcId)
|
||||
if (idx >= 0) y1 = src.y + batchPortTop(idx, Math.max(1, bsrcs.length), hOf(src))
|
||||
}
|
||||
if (dst.type === 'batch') {
|
||||
const bsrcs = ((graph && graph.incomingByNode.get(dst.id)) || []).map((e) => graph && graph.byId.get(e.from)).filter((n) => isBatchSrc(n)).slice().sort(compareCanvasTextOrder)
|
||||
const bsrcs = ((graph && graph.incomingByNode.get(dst.id)) || []).map((e) => graph && graph.byId.get(e.from)).filter((n) => isBatchSrc(n, graph && graph.edges, graph && graph.nodes)).slice().sort(compareCanvasTextOrder)
|
||||
const idx = bsrcs.findIndex((s) => s.id === ed.from)
|
||||
if (idx >= 0) y2 = dst.y + batchPortTop(idx, Math.max(1, bsrcs.length), hOf(dst))
|
||||
}
|
||||
|
||||
+41
-10
@@ -11,18 +11,49 @@
|
||||
|
||||
function compareCanvasTextOrder(a, b) { return (Number(a.y) - Number(b.y)) || (Number(a.x) - Number(b.x)) || String(a.id).localeCompare(String(b.id)) }
|
||||
|
||||
function batchSrcText(n) {
|
||||
// 节点**自身**文案(不看上游):组合取 combined/extra,LLM 取 result.text,其余取 data.text
|
||||
function selfTextOf(n) {
|
||||
if (!n || !n.data) return ''
|
||||
if (n.type === 'combine') return ((n.data.combined || n.data.extra) || '').trim()
|
||||
if (n.type === 'relay') return ((n.data.text || '')).trim()
|
||||
if (n.type === 'llm') return ((n.data.result && n.data.result.text) || '').trim()
|
||||
return (n.data.text || '').trim()
|
||||
}
|
||||
function isBatchSrc(n) {
|
||||
// 继承态(2026-11-23):提示词 / 文本节点自己没写字时,它对外输出的就是「节点体显示的那一条上游文案」。
|
||||
// 产品规则:提示词节点本身不拼合多路文案(一个提示词只承接一条上游),所以这里只取第一条,
|
||||
// 排序与 inheritedTextOf / 节点体「继承 · 来自 上一级」逐字同源(文本按 Y→X,图片按 X→Y)。
|
||||
// 不传 edges/nodes 时保持旧行为(只看自身 data.text),未及改造的调用点不会变。
|
||||
function upstreamTextOf(n, edgesArr, nodesArr) {
|
||||
const seen = new Set([n.id])
|
||||
const walk = (x) => {
|
||||
const srcs = edgesArr.filter((e) => e.to === x.id).map((e) => nodesArr.find((y) => y.id === e.from))
|
||||
.filter((y) => y && y.type !== 'ref' && !(y.data && y.data.enabled === false)).sort(compareCanvasTextOrder)
|
||||
for (const src of srcs) {
|
||||
const t = selfTextOf(src)
|
||||
if (t) return t
|
||||
// 只穿透「本身无文案、职责是转接」的节点;组合 / LLM / 插件节点有自己的语义,不越过
|
||||
if (!seen.has(src.id) && (src.type === 'prompt' || src.type === 'textout' || src.type === 'relay' || src.type === 'batch')) {
|
||||
seen.add(src.id)
|
||||
const up = walk(src)
|
||||
if (up) return up
|
||||
}
|
||||
}
|
||||
return ''
|
||||
}
|
||||
return walk(n)
|
||||
}
|
||||
function batchSrcText(n, edgesArr, nodesArr) {
|
||||
if (!n || !n.data) return ''
|
||||
const own = selfTextOf(n)
|
||||
if (own) return own
|
||||
// 继承态只有提示词 / 文本节点有(它们的节点体就显示「继承」);组合 / 连接 / LLM 不在此列
|
||||
return (n.type === 'prompt' || n.type === 'textout') && edgesArr && nodesArr ? upstreamTextOf(n, edgesArr, nodesArr) : ''
|
||||
}
|
||||
function isBatchSrc(n, edgesArr, nodesArr) {
|
||||
// outKind === 'prompt'(2026-11-14):插件节点声明「我输出的是提示词」后也算批量来源。
|
||||
// 加在这一处而不是三处:批量节点的候选来源、端口分布、组合来源行都走 isBatchSrc,
|
||||
// 认了它,「一条样式 × N 个商品图」的批量出图才成立。
|
||||
return !!n && (n.type === 'prompt' || n.type === 'textout' || n.type === 'combine' || n.type === 'llm' || n.type === 'relay' || (n.data && n.data.outKind === 'prompt')) && !!batchSrcText(n)
|
||||
return !!n && (n.type === 'prompt' || n.type === 'textout' || n.type === 'combine' || n.type === 'llm' || n.type === 'relay' || (n.data && n.data.outKind === 'prompt')) && !!batchSrcText(n, edgesArr, nodesArr)
|
||||
}
|
||||
function batchPortTop(idx, total, h) {
|
||||
const gap = Math.min(30, Math.max(20, (h - 90) / Math.max(1, total - 1)))
|
||||
@@ -48,10 +79,10 @@
|
||||
}
|
||||
if (n.data && n.data.enabled === false) return []
|
||||
if (n.type === 'batch') {
|
||||
const bsrcs = edgesArr.filter((e) => e.to === n.id).map((e) => nodesArr.find((x) => x.id === e.from)).filter((x) => isBatchSrc(x)).slice().sort((a, b) => (a.y - b.y) || (a.x - b.x))
|
||||
const bsrcs = edgesArr.filter((e) => e.to === n.id).map((e) => nodesArr.find((x) => x.id === e.from)).filter((x) => isBatchSrc(x, edgesArr, nodesArr)).slice().sort((a, b) => (a.y - b.y) || (a.x - b.x))
|
||||
const s = inEdge.batchSrcId ? bsrcs.find((x) => x.id === inEdge.batchSrcId) : bsrcs[0]
|
||||
if (!s || (s.data && s.data.enabled === false)) return []
|
||||
const st = s ? batchJoinedText(n.data, batchSrcText(s)) : ''
|
||||
const st = s ? batchJoinedText(n.data, batchSrcText(s, edgesArr, nodesArr)) : ''
|
||||
return st ? [st] : []
|
||||
}
|
||||
return combineInputTexts(n, edgesArr, nodesArr)
|
||||
@@ -60,18 +91,18 @@
|
||||
if (!n || (n.data && n.data.enabled === false)) return []
|
||||
if (n.type === 'batch') {
|
||||
const bd = n.data || {}
|
||||
const bsrcs = edgesArr.filter((e) => e.to === n.id).map((e) => nodesArr.find((x) => x.id === e.from)).filter((x) => isBatchSrc(x) && !(x.data && x.data.enabled === false)).slice().sort((a, b) => (a.y - b.y) || (a.x - b.x))
|
||||
return bsrcs.map((src) => batchJoinedText(bd, batchSrcText(src))).filter(Boolean)
|
||||
const bsrcs = edgesArr.filter((e) => e.to === n.id).map((e) => nodesArr.find((x) => x.id === e.from)).filter((x) => isBatchSrc(x, edgesArr, nodesArr) && !(x.data && x.data.enabled === false)).slice().sort((a, b) => (a.y - b.y) || (a.x - b.x))
|
||||
return bsrcs.map((src) => batchJoinedText(bd, batchSrcText(src, edgesArr, nodesArr))).filter(Boolean)
|
||||
}
|
||||
if (n.type === 'relay') { const out = []; const relaySrcs = edgesArr.filter((x) => x.to === n.id).map((e) => nodesArr.find((x) => x.id === e.from)).filter(Boolean).slice().sort(compareCanvasTextOrder); for (const src of relaySrcs) for (const t0 of combineInputTexts(src, edgesArr, nodesArr)) if (t0 && !out.includes(t0)) out.push(t0); return out }
|
||||
const t = batchSrcText(n)
|
||||
const t = batchSrcText(n, edgesArr, nodesArr)
|
||||
if (n.type === 'textout') {
|
||||
if (t) return [t]
|
||||
const bEdge = edgesArr.filter((e) => e.to === n.id).map((e) => ({ e, b: nodesArr.find((x) => x.id === e.from) })).find((o) => o.b && o.b.type === 'batch')
|
||||
if (bEdge) {
|
||||
const bsrcs = edgesArr.filter((e) => e.to === bEdge.b.id).map((e) => nodesArr.find((x) => x.id === e.from)).filter((x) => isBatchSrc(x)).slice().sort((a, b2) => (a.y - b2.y) || (a.x - b2.x))
|
||||
const bsrcs = edgesArr.filter((e) => e.to === bEdge.b.id).map((e) => nodesArr.find((x) => x.id === e.from)).filter((x) => isBatchSrc(x, edgesArr, nodesArr)).slice().sort((a, b2) => (a.y - b2.y) || (a.x - b2.x))
|
||||
const target = bEdge.e.batchSrcId ? bsrcs.find((s) => s.id === bEdge.e.batchSrcId) : bsrcs[0]
|
||||
const bt = target ? batchSrcText(target) : ''
|
||||
const bt = target ? batchSrcText(target, edgesArr, nodesArr) : ''
|
||||
return bt ? [bt] : []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
return base.map((t) => ({ ...t, sourceNodeId: own ? n.id : (t.sourceNodeId || n.id), ownerNodeId: n.id, title: ownTitle || t.title || '', text: own || t.text, refNodes: dedupeTaskRefs((t.refNodes || []).concat(refs)) }))
|
||||
}
|
||||
if (n.type === 'combine') { const orderedC = children.slice().sort((a, b) => { const na = graph.byId.get(a.sourceNodeId), nb = graph.byId.get(b.sourceNodeId); return na && nb ? compareCanvasTextOrder(na, nb) : 0 }); return [{ sourceNodeId: n.id, ownerNodeId: n.id, title: String((n.data && n.data.title) || '').trim(), text: own || orderedC.map((t) => t.text).filter(Boolean).join(String((n.data && n.data.sep) || (global.IWBRuntimeConstants && global.IWBRuntimeConstants.combineSep) || ', ')), refNodes: dedupeTaskRefs(orderedC.flatMap((t) => t.refNodes)), diagnostics: { cycles: orderedC.flatMap((t) => (t.diagnostics && t.diagnostics.cycles) || []), disabledSources: [] } }] }
|
||||
if (n.type === 'batch') { const candidates = incoming.map((e) => graph.byId.get(e.from)).filter((x) => x && isBatchSrc(x) && !(x.data && x.data.enabled === false)); const selected = ctx.selectedBatchSourceId && candidates.find((x) => x.id === ctx.selectedBatchSourceId); const sources = selected ? [selected] : candidates; return sources.flatMap((src) => resolveNodeTaskValues(src.id, graph, { ...ctx, selectedBatchSourceId: null, stack: next }).map((t) => ({ ...t, text: batchJoinedText(n.data || {}, t.text) }))) }
|
||||
if (n.type === 'batch') { const candidates = incoming.map((e) => graph.byId.get(e.from)).filter((x) => x && isBatchSrc(x, graph.edges, graph.nodes) && !(x.data && x.data.enabled === false)); const selected = ctx.selectedBatchSourceId && candidates.find((x) => x.id === ctx.selectedBatchSourceId); const sources = selected ? [selected] : candidates; return sources.flatMap((src) => resolveNodeTaskValues(src.id, graph, { ...ctx, selectedBatchSourceId: null, stack: next }).map((t) => ({ ...t, text: batchJoinedText(n.data || {}, t.text) }))) }
|
||||
if (n.type === 'relay') {
|
||||
const sharedRefs = dedupeTaskRefs(children.filter((t) => !t.text).flatMap((t) => t.refNodes || []))
|
||||
const textTasks = [], seenTasks = new Set()
|
||||
@@ -248,13 +248,13 @@
|
||||
return out
|
||||
}
|
||||
if (n.type === 'batch') {
|
||||
const bsrcs = edgesArr.filter((e) => e.to === n.id).map((e) => nodesArr.find((x) => x.id === e.from)).filter((x) => isBatchSrc(x) && !(x.data && x.data.enabled === false)).slice().sort((a, b) => (a.y - b.y) || (a.x - b.x))
|
||||
const bsrcs = edgesArr.filter((e) => e.to === n.id).map((e) => nodesArr.find((x) => x.id === e.from)).filter((x) => isBatchSrc(x, edgesArr, nodesArr) && !(x.data && x.data.enabled === false)).slice().sort((a, b) => (a.y - b.y) || (a.x - b.x))
|
||||
const sel = inEdge && inEdge.batchSrcId ? bsrcs.find((s) => s.id === inEdge.batchSrcId) : bsrcs[0]
|
||||
if (!sel) return []
|
||||
const t = batchJoinedText((n.data || {}), (batchSrcText(sel) || ''))
|
||||
const t = batchJoinedText((n.data || {}), (batchSrcText(sel, edgesArr, nodesArr) || ''))
|
||||
return t ? [{ n: sel, text: t }] : []
|
||||
}
|
||||
const t = batchSrcText(n)
|
||||
const t = batchSrcText(n, edgesArr, nodesArr)
|
||||
return t ? [{ n, text: t }] : []
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@
|
||||
const bEdge = edgesArr.filter((e) => e.to === n.id).map((e) => ({ e, b: nodesArr.find((x) => x.id === e.from) })).find((o) => o.b && o.b.type === 'batch')
|
||||
if (bEdge) {
|
||||
const b = bEdge.b
|
||||
const bsrcs = edgesArr.filter((e) => e.to === b.id).map((e) => nodesArr.find((x) => x.id === e.from)).filter((x) => isBatchSrc(x)).slice().sort((a, b2) => (a.y - b2.y) || (a.x - b2.x))
|
||||
const bsrcs = edgesArr.filter((e) => e.to === b.id).map((e) => nodesArr.find((x) => x.id === e.from)).filter((x) => isBatchSrc(x, edgesArr, nodesArr)).slice().sort((a, b2) => (a.y - b2.y) || (a.x - b2.x))
|
||||
const target = bEdge.e.batchSrcId ? bsrcs.find((s) => s.id === bEdge.e.batchSrcId) : bsrcs[0]
|
||||
if (target) {
|
||||
const seen = new Set()
|
||||
@@ -333,7 +333,7 @@
|
||||
}
|
||||
if (n.type === 'batch') {
|
||||
// 批量加文案:透传其所有输入源的参考图
|
||||
const textSrcs = edgesArr.filter((e) => e.to === n.id).map((e) => nodesArr.find((x) => x.id === e.from)).filter((x) => isBatchSrc(x))
|
||||
const textSrcs = edgesArr.filter((e) => e.to === n.id).map((e) => nodesArr.find((x) => x.id === e.from)).filter((x) => isBatchSrc(x, edgesArr, nodesArr))
|
||||
const seen = new Set()
|
||||
const out = []
|
||||
for (const st of textSrcs) for (const r of nodeRefsOf(st, edgesArr, nodesArr, visited)) if (!seen.has(r.id)) { seen.add(r.id); out.push(r) }
|
||||
@@ -344,7 +344,7 @@
|
||||
// 插件节点的入边通常为空(样式节点端口只出),所以 selfRefs 往往就是全部 ——
|
||||
// 少这一句,分层节点(走 layerInputsOf → nodeRefsOf)就看不到样式节点那张示例图。
|
||||
if (n.type !== 'combine') return dedupeTaskRefs(direct.concat(selfRefNodesOf(n)))
|
||||
const textSrcs = edgesArr.filter((e) => e.to === n.id).map((e) => nodesArr.find((x) => x.id === e.from)).filter((x) => isBatchSrc(x) || (x && x.type === 'batch'))
|
||||
const textSrcs = edgesArr.filter((e) => e.to === n.id).map((e) => nodesArr.find((x) => x.id === e.from)).filter((x) => isBatchSrc(x, edgesArr, nodesArr) || (x && x.type === 'batch'))
|
||||
const seen = new Set()
|
||||
const out = []
|
||||
for (const st of textSrcs) for (const r of nodeRefsOf(st, edgesArr, nodesArr, visited)) if (!seen.has(r.id)) { seen.add(r.id); out.push(r) }
|
||||
|
||||
@@ -468,9 +468,9 @@
|
||||
let batchSrcTxt = ''
|
||||
const bEdgeT = (props.edges || []).filter((e) => e.to === node.id).map((e) => ({ e, b: (props.nodes || []).find((n) => n.id === e.from) })).find((o) => o.b && o.b.type === 'batch')
|
||||
if (bEdgeT) {
|
||||
const bsrcsT = (props.edges || []).filter((e) => e.to === bEdgeT.b.id).map((e) => (props.nodes || []).find((n) => n.id === e.from)).filter((n) => isBatchSrc(n)).slice().sort((a, b2) => (a.y - b2.y) || (a.x - b2.x))
|
||||
const bsrcsT = (props.edges || []).filter((e) => e.to === bEdgeT.b.id).map((e) => (props.nodes || []).find((n) => n.id === e.from)).filter((n) => isBatchSrc(n, props.edges || [], props.nodes || [])).slice().sort((a, b2) => (a.y - b2.y) || (a.x - b2.x))
|
||||
const tgtT = bEdgeT.e.batchSrcId ? bsrcsT.find((s) => s.id === bEdgeT.e.batchSrcId) : bsrcsT[0]
|
||||
if (tgtT) batchSrcTxt = batchSrcText(tgtT)
|
||||
if (tgtT) batchSrcTxt = batchSrcText(tgtT, props.edges || [], props.nodes || [])
|
||||
}
|
||||
// 透传参考图展示(按来源顺序,像提示词面板)
|
||||
const tRefs = nodePreviewRefsV2(node, props.nodes || [], props.edges || [])
|
||||
@@ -604,7 +604,7 @@
|
||||
const { onUpdate, stop } = ctx
|
||||
// 连接节点:多个来源各自追加统一文案,每个来源对应一对输入/输出端口
|
||||
const d = node.data || {}
|
||||
const bsrcs = (props.edges || []).filter((e) => e.to === node.id).map((e) => (props.nodes || []).find((n) => n.id === e.from)).filter((n) => isBatchSrc(n)).slice().sort((a, b) => (a.y - b.y) || (a.x - b.x))
|
||||
const bsrcs = (props.edges || []).filter((e) => e.to === node.id).map((e) => (props.nodes || []).find((n) => n.id === e.from)).filter((n) => isBatchSrc(n, props.edges || [], props.nodes || [])).slice().sort((a, b) => (a.y - b.y) || (a.x - b.x))
|
||||
const outCount = Object.keys(d.outs || {}).filter((k) => (props.nodes || []).some((n) => n.id === d.outs[k])).length // 兼容旧数据(手动模式下不再自动创建)
|
||||
return el('div', { className: 'iwb-node-body' },
|
||||
el('div', { className: 'iwb-row iwb-gen-head' },
|
||||
|
||||
+1
-1
@@ -241,7 +241,7 @@ function NodeCard(props) {
|
||||
if (hasOut) {
|
||||
if (node.type === 'batch') {
|
||||
// 连接节点:每个输入来源一个输出端口(按来源行均匀分布);无来源时默认 1 对占位端口
|
||||
const bsrcs = (props.edges || []).filter((e) => e.to === node.id).map((e) => (props.nodes || []).find((n) => n.id === e.from)).filter((n) => isBatchSrc(n)).slice().sort((a, b) => (a.y - b.y) || (a.x - b.x))
|
||||
const bsrcs = (props.edges || []).filter((e) => e.to === node.id).map((e) => (props.nodes || []).find((n) => n.id === e.from)).filter((n) => isBatchSrc(n, props.edges || [], props.nodes || [])).slice().sort((a, b) => (a.y - b.y) || (a.x - b.x))
|
||||
const list = bsrcs.length ? bsrcs : [null]
|
||||
const n = list.length
|
||||
list.forEach((bs, bi) => {
|
||||
|
||||
@@ -55,4 +55,28 @@ const s2 = n('s2', 'prompt', { text: 'B' }); s2.y = 10
|
||||
const edges = [{ from: 's1', to: 'b' }, { from: 's2', to: 'b' }]
|
||||
assert.strictEqual(T.combineInputTexts(bs, edges, [bs, s1, s2]).join('|'), 'A-!|B-!')
|
||||
|
||||
// ── 继承态(2026-11-23):提示词承接上游文案后,对外输出就是那条文案 ────────────
|
||||
// 场景:风格库变量节点 → 提示词(自己没写字,节点体显示「继承 · 来自 上一级」)→ 组合节点。
|
||||
// 出图侧一直能拿到文案(resolveNodeTaskValues 的 own || 上游),但组合侧读的是 batchSrcText,
|
||||
// 原来只看 data.text ⇒ 组合里一行都没有。修复后两侧同口径;组合的拼接逻辑本身不动。
|
||||
const up = n('s1', 'plugin:style-source:style', { text: '上游文案', outKind: 'prompt' }); up.x = 0; up.y = 100
|
||||
const inh = n('p1', 'prompt', {}); inh.x = 300; inh.y = 100
|
||||
const inhEdges = [{ from: 's1', to: 'p1' }]
|
||||
assert.strictEqual(T.batchSrcText(inh, inhEdges, [up, inh]), '上游文案')
|
||||
assert.strictEqual(T.isBatchSrc(inh, inhEdges, [up, inh]), true)
|
||||
assert.strictEqual(T.isBatchSrc(inh), false, '不传图时保持旧行为(只看 data.text)')
|
||||
assert.strictEqual(T.combineInputTexts(inh, inhEdges, [up, inh]).join('|'), '上游文案')
|
||||
// 接管态:自己写了字就用自己的,不再透传
|
||||
inh.data.text = '自己的文案'
|
||||
assert.strictEqual(T.batchSrcText(inh, inhEdges, [up, inh]), '自己的文案')
|
||||
inh.data.text = ''
|
||||
// 多路上游:提示词节点不拼合,只取画布顺序第一条(与节点体「继承 · 来自 上一级」一致)
|
||||
const up2 = n('s2', 'plugin:style-source:style', { text: '第二路', outKind: 'prompt' }); up2.x = 0; up2.y = 600
|
||||
assert.strictEqual(T.batchSrcText(inh, [{ from: 's1', to: 'p1' }, { from: 's2', to: 'p1' }], [up, up2, inh]), '上游文案')
|
||||
// 上游停用:不参与
|
||||
const upOff = n('s3', 'plugin:style-source:style', { text: '停用', outKind: 'prompt', enabled: false })
|
||||
assert.strictEqual(T.batchSrcText(n('p2', 'prompt', {}), [{ from: 's3', to: 'p2' }], [upOff]), '')
|
||||
// 环:提示词 ↔ 中继 不死循环
|
||||
assert.strictEqual(T.batchSrcText(n('p3', 'prompt', {}), [{ from: 'r3', to: 'p3' }, { from: 'p3', to: 'r3' }], [n('r3', 'relay', {})]), '')
|
||||
|
||||
console.log('canvas text checks passed')
|
||||
@@ -99,3 +99,59 @@ test('提示词与文本节点显示上游继承文本,改字即接管、可
|
||||
|
||||
expect(errors, '全程不应有页面 JS 异常').toEqual([])
|
||||
})
|
||||
|
||||
// 2026-11-23 用户报障:提示词接了变量节点后,文案没进组合节点(出图却有)。
|
||||
// 根因是组合侧读 batchSrcText(只看 data.text),继承态提示词 data.text 为空 ⇒ 整路被丢。
|
||||
// 这里钉 DOM:组合节点要出现这一行,且上游改动要跟着变(组合功能本身不变,只是拿到来源)。
|
||||
const SRC2 = '组合里应该出现这段文案'
|
||||
const WS2 = {
|
||||
workspaces: [{
|
||||
id: 'ws_c', name: '继承进组合', groups: [],
|
||||
nodes: [
|
||||
{ id: 'p1', type: 'prompt', x: 140, y: 160, w: 300, h: 200, data: { text: SRC2 } },
|
||||
{ id: 'r1', type: 'relay', x: 520, y: 210, data: {} },
|
||||
{ id: 'p2', type: 'prompt', x: 700, y: 160, w: 300, h: 200, data: {} },
|
||||
{ id: 'cb', type: 'combine', x: 1040, y: 160, w: 300, h: 200, data: {} },
|
||||
],
|
||||
edges: [
|
||||
{ id: 'c1', from: 'p1', to: 'r1' },
|
||||
{ id: 'c2', from: 'r1', to: 'p2' },
|
||||
{ id: 'c3', from: 'p2', to: 'cb' },
|
||||
],
|
||||
}],
|
||||
activeId: 'ws_c', rev: 1,
|
||||
}
|
||||
|
||||
test('提示词(继承态)的文案会进入组合节点,并跟随上游变化', async ({ page }) => {
|
||||
const errors = []
|
||||
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)))
|
||||
await page.addInitScript((d) => {
|
||||
if (localStorage.getItem('iwb_combine_inherit_init') === '1') return
|
||||
localStorage.clear()
|
||||
localStorage.setItem('iwb_combine_inherit_init', '1')
|
||||
localStorage.setItem('iwb_web_workspaces', JSON.stringify(d.ws))
|
||||
localStorage.setItem('iwb_ws_active', 'ws_c')
|
||||
localStorage.setItem('iwb_web_cfg', JSON.stringify(d.cfg))
|
||||
}, { ws: WS2, cfg: CFG })
|
||||
|
||||
await page.goto('/', { waitUntil: 'domcontentloaded' })
|
||||
await page.waitForTimeout(700)
|
||||
await page.locator('.iwb-home-card:not(.iwb-home-new)').first().dblclick()
|
||||
await page.waitForTimeout(900)
|
||||
|
||||
// ① 组合节点里应出现继承来的那一行(不是空 + 红字提示)
|
||||
await expect(box(page, 'cb').locator('.iwb-combine-src'), '继承态提示词的文案必须进组合').toHaveCount(1)
|
||||
await expect(box(page, 'cb').locator('.iwb-combine-src')).toContainText(SRC2)
|
||||
await expect(box(page, 'cb').locator('.iwb-err'), '有来源时不应再报「请连接有文本的节点」').toHaveCount(0)
|
||||
|
||||
// ② 跟随上游:改最上游,组合行同步(提示词未接管)
|
||||
await typeInto(page, 'p1', '上游改过之后的文案')
|
||||
await expect(box(page, 'cb').locator('.iwb-combine-src')).toContainText('上游改过之后的文案')
|
||||
|
||||
// ③ 提示词接管后,组合用提示词自己的文案
|
||||
await typeInto(page, 'p2', '提示词自己写的文案')
|
||||
await expect(box(page, 'cb').locator('.iwb-combine-src')).toContainText('提示词自己写的文案')
|
||||
await expect(box(page, 'cb').locator('.iwb-combine-src')).not.toContainText('上游改过之后的文案')
|
||||
|
||||
expect(errors, '全程不应有页面 JS 异常').toEqual([])
|
||||
})
|
||||
@@ -47,6 +47,7 @@ const wait = (ms) => new Promise((r) => setTimeout(r, ms))
|
||||
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: {
|
||||
@@ -58,6 +59,10 @@ const wait = (ms) => new Promise((r) => setTimeout(r, ms))
|
||||
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)
|
||||
|
||||
@@ -133,14 +138,21 @@ const wait = (ms) => new Promise((r) => setTimeout(r, ms))
|
||||
|
||||
// 插入画布按钮(+ 图标,title 含「插入到画布」)
|
||||
// 再点一次卡片 → 详情弹窗 → 底部「插入画布」
|
||||
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>
|
||||
@@ -163,9 +175,12 @@ const wait = (ms) => new Promise((r) => setTimeout(r, ms))
|
||||
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('dblclick', { bubbles: true }))
|
||||
|
||||
@@ -191,4 +191,25 @@ ok('两张参考图按 X 轴排序:样式节点的图跟节点位置走', () =
|
||||
assert.strictEqual(tasks[0].refs[1].value, 'https://cdn.example.com/right.png')
|
||||
})
|
||||
|
||||
// ── ⑤ 组合节点:继承态提示词的文案与图都要到位(2026-11-23)──────────────
|
||||
ok('样式 → 提示词(继承) → 组合:组合行有文案、下游拿得到参考图', () => {
|
||||
const s1 = styleNode('s1', 0, 0)
|
||||
const p1 = plainPrompt('p1', 300, 0, '')
|
||||
const c1 = { id: 'c1', type: 'combine', x: 700, y: 0, data: { sep: ', ' } }
|
||||
const nodes = [s1, p1, c1, genNode]
|
||||
const edges = [edge('s1', 'p1'), edge('p1', 'c1'), edge('c1', 'g1')]
|
||||
// 组合行:来自 p1(提示词节点本身),文案是它继承的那条(组合的拼接逻辑不改)
|
||||
const pairs = []
|
||||
for (const e of edges) if (e.to === 'c1') { const src = nodes.find((n) => n.id === e.from); pairs.push.apply(pairs, TG.combineSourcePairs(src, e, edges, nodes)) }
|
||||
assert.strictEqual(pairs.length, 1)
|
||||
assert.strictEqual(pairs[0].text, 'a 银发少女 in the rain')
|
||||
// 组合 → 下游(文本节点 / 分层节点走 nodeRefsOf)不能丢图
|
||||
assert.strictEqual(TG.nodeRefsOf(c1, edges, nodes).map((r) => r.id).join(','), 's1:ref')
|
||||
// 生成任务不变:仍是 1 个任务,文案与图都在
|
||||
const tasks = TG.buildGenerationTasksV2(genNode, nodes, edges)
|
||||
assert.strictEqual(tasks.length, 1)
|
||||
assert.strictEqual(tasks[0].text, 'a 银发少女 in the rain')
|
||||
assert.strictEqual(tasks[0].refs.length, 1)
|
||||
})
|
||||
|
||||
console.log('\nplugin-style-node: ' + passed + ' passed')
|
||||
Reference in new issue
Block a user