Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7fdae8877 | ||
|
|
bc77f007a0 | ||
|
|
d2bef9f348 | ||
|
|
06d2a8bc5b | ||
|
|
d9e3d84c0c | ||
|
|
af3a9cdf8f | ||
|
|
92a8b6af0d | ||
|
|
f6c66fcd89 | ||
|
|
262bcc037b | ||
|
|
2cc5126f70 | ||
|
|
5d68e0249a | ||
|
|
bb0b3f3e8f | ||
|
|
204f9103aa | ||
|
|
8e40ba2870 | ||
|
|
d45065101b | ||
|
|
702fbf5132 | ||
|
|
8944f2a78f | ||
|
|
7335f59288 | ||
|
|
16109a39f4 | ||
|
|
b25ba45872 | ||
|
|
b8f5d4d8eb | ||
|
|
fb69d17615 | ||
|
|
98f7f8e6d4 | ||
|
|
0e80c55adf | ||
|
|
dd58e4a7b5 | ||
|
|
e9435a5cfe | ||
|
|
054aec958e | ||
|
|
96c786e8ca | ||
|
|
3792081ddd | ||
|
|
b1e3fea494 | ||
|
|
81c520fe52 | ||
|
|
1277a4398a | ||
|
|
a0a696a2e6 | ||
|
|
5e2f9dd876 | ||
|
|
9739764d2f | ||
|
|
3483cc4174 |
No files matched your search
@@ -14,6 +14,17 @@
|
||||
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
|
||||
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
|
||||
|
||||
## v3.26.40(2026-11-23)Windows:修复 PowerShell 弹窗
|
||||
|
||||
- Windows 状态栏内存探测改用 CREATE_NO_WINDOW 启动 PowerShell,不再每 4 秒弹出控制台窗口。
|
||||
- macOS 行为不变(Unix 分支仍用 ps)。
|
||||
|
||||
## v3.26.39(2026-11-22)修正插件插入落点与封面插入
|
||||
|
||||
- promptlib 1.6.18:拖拽落点按节点宽高居中到鼠标;详情「插入模板节点/插入画布/插入图片」落到画布可视中心;拖拽期间禁用文本选择。
|
||||
- 宿主:新增 CanvasGeometry.promptCenterSpot,提示词/封面插入不再被左侧面板遮挡。
|
||||
- 修复详情「插入图片」:封面文件先解析为 dataURL 再插入。
|
||||
|
||||
## v3.26.38(2026-11-22)插件节点交互修复 + 标注覆盖保留原图
|
||||
|
||||
### 提示词库(promptlib 1.6.16)
|
||||
|
||||
@@ -8216,7 +8216,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
},
|
||||
insert: (text, name) => {
|
||||
const id = uid('n')
|
||||
const spot = findSpot('prompt')
|
||||
const spot = CanvasGeometry.promptCenterSpot(wPluginCanvasBridge, 280, 120) || findSpot('prompt')
|
||||
commitCanvas(refs.nodes.concat([{ id, type: 'prompt', x: spot.x, y: spot.y, data: { text: text || '', title: name || '' } }]), undefined, undefined)
|
||||
setSel([id])
|
||||
setNotice({ type: 'ok', text: '已插入提示词:' + (name || '') })
|
||||
@@ -8226,7 +8226,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
insertImage: (cover, name) => wPromptInsertImage({
|
||||
insertRefNode: (data, nm, w) => {
|
||||
const id = uid('n')
|
||||
const spot = findSpot('ref')
|
||||
const spot = CanvasGeometry.promptCenterSpot(wPluginCanvasBridge, w || 280, 180) || findSpot('ref')
|
||||
commitCanvas(refs.nodes.concat([{ id, type: 'ref', x: spot.x, y: spot.y, w: w || 280, data: { data: data, name: nm } }]), undefined, undefined)
|
||||
setSel([id])
|
||||
setNotice({ type: 'ok', text: '已插入封面图片' })
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# 现状架构与性能事实基线(image-workbench-web)
|
||||
|
||||
> **本文档是什么**:现状**事实快照**,不是规范。用途:任何性能 / 内存 / 存储相关改动,先对齐这里的现实,避免把已经调好的东西改坏。
|
||||
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = 843291c`(线上 `v3.26.38+843291c` —— **未上线**(本地测试中):左右停靠栏配色对齐主色调(新增 `--iwb-dock-bg` 进灰阶 ramp + 头部深一档 + `.iwb-pcard` 补白底)+ 修 `Cargo.toml`/`Cargo.lock` 版本漂移,四处统一到 3.25.58)。上一条 3.25.30:线上实际运行提交是 docs 提交 `7df9dc4`,bump 提交为 `4be78c0`;2026-11-16 已发**测试站 + 正式站**,三地址一致 + `IWB_VERIFY_STRICT=1` 通过。v3.24.85 是「代码体检收口」(棘轮收回 Workbench 3090→2998 + 图库索引 4 条绕过锁的写路径收口到 `mutate` + 文档数字校准),`stable` / `stable-v3.24.85` / `stable-verified-2026-11-16` 均指向 `7df9dc4`。上一条 —— 2026-11-14 发**测试站 + 正式站** `https://test.image-workbench-web.pages.dev`:**v3.24.84 修「生图节点连了 3 条上游只出 1 个任务」**(任务 id 与去重基准改用新字段 `ownerNodeId`=本节点自己,不再用随继承冒泡的 `sourceNodeId` ⇒ 连几条线就几个任务;`relay` 仍归约到真实文本来源,同一来源多路径抵达只算一次)。上一条 v3.24.83:**修「插件节点冷启动退化成一段文本」**(插件节点体是异步注册的,`registerNodeType` 在 `render` 由无变有时自增 `NODE_TYPES_REV`,`NodeCard` 比它 ⇒ 注册那一刻重建一次;`canvas-normalize` 按命名规则把 `plugin:<id>:<variant>` 认作已知类型,不再降级成 `plugin` 并写回存档);配套插件 `style-source` 1.3.2 把节点体样式改为**脚本执行时注入**(此前只在面板 `mount()` 注入 ⇒ 从存档直接进画布时节点无样式、缩略图按原图铺满)。上一条 v3.24.82 同批:提示词/文本节点**显示上游继承文本**(自己 `data.text` 为空时把上游那段话显示在框里,改一个字即接管,另有「恢复跟随」清空回跟随;多路上游按 Y 轴取第一条)+ 修 `nodeRefsOf` 的 textout 分支只认 llm/batch/combine 上游导致「样式 → 文本 → 分层」丢参考图;再上一条 v3.24.81:① 插件节点可自定义节点体(`render(node, props, host)` 画真实 DOM,宿主不每帧重建 ⇒ 输入框不失焦);② 节点自带参考图(`data.refOn/refUrl` ⇒ 任务图里补伪参考图,坐标取节点自身 ⇒ 仍参与「图片按 X 轴排序」);③ 连线白名单按 `data.outKind === 'prompt'` 归一化,7 条规则一次放行,内置节点行为逐字不变。上一条 v3.24.80 = 离开页面的兜底保存不递增 rev(2026-11-14 07:20 补发 —— 首发 11-13 23:25 撞 Cloudflare Workers API 事故 `503 no healthy upstream`,期间正式站保持在 `v3.24.79+8598a57` 未动)。v3.24.83 的 bump 提交即 `0a27a42`(v3.24.82 为 `ef6cf42`、v3.24.81 为 `dba71e3`);主干 HEAD 会继续前进,见 [`RELEASES.md`](../RELEASES.md))| 历史分支 `refactor/architecture` / `feat/multi-canvas-tabs` / `refactor/state-store` 已于 2026-10-20 清理(内容均已并入 main,归档标签 `archive/*`),本文**计数类事实**已按 main HEAD 复算。
|
||||
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = d9e3d84`(线上 `v3.26.40+d9e3d84` —— **未上线**(本地测试中):左右停靠栏配色对齐主色调(新增 `--iwb-dock-bg` 进灰阶 ramp + 头部深一档 + `.iwb-pcard` 补白底)+ 修 `Cargo.toml`/`Cargo.lock` 版本漂移,四处统一到 3.25.58)。上一条 3.25.30:线上实际运行提交是 docs 提交 `7df9dc4`,bump 提交为 `4be78c0`;2026-11-16 已发**测试站 + 正式站**,三地址一致 + `IWB_VERIFY_STRICT=1` 通过。v3.24.85 是「代码体检收口」(棘轮收回 Workbench 3090→2998 + 图库索引 4 条绕过锁的写路径收口到 `mutate` + 文档数字校准),`stable` / `stable-v3.24.85` / `stable-verified-2026-11-16` 均指向 `7df9dc4`。上一条 —— 2026-11-14 发**测试站 + 正式站** `https://test.image-workbench-web.pages.dev`:**v3.24.84 修「生图节点连了 3 条上游只出 1 个任务」**(任务 id 与去重基准改用新字段 `ownerNodeId`=本节点自己,不再用随继承冒泡的 `sourceNodeId` ⇒ 连几条线就几个任务;`relay` 仍归约到真实文本来源,同一来源多路径抵达只算一次)。上一条 v3.24.83:**修「插件节点冷启动退化成一段文本」**(插件节点体是异步注册的,`registerNodeType` 在 `render` 由无变有时自增 `NODE_TYPES_REV`,`NodeCard` 比它 ⇒ 注册那一刻重建一次;`canvas-normalize` 按命名规则把 `plugin:<id>:<variant>` 认作已知类型,不再降级成 `plugin` 并写回存档);配套插件 `style-source` 1.3.2 把节点体样式改为**脚本执行时注入**(此前只在面板 `mount()` 注入 ⇒ 从存档直接进画布时节点无样式、缩略图按原图铺满)。上一条 v3.24.82 同批:提示词/文本节点**显示上游继承文本**(自己 `data.text` 为空时把上游那段话显示在框里,改一个字即接管,另有「恢复跟随」清空回跟随;多路上游按 Y 轴取第一条)+ 修 `nodeRefsOf` 的 textout 分支只认 llm/batch/combine 上游导致「样式 → 文本 → 分层」丢参考图;再上一条 v3.24.81:① 插件节点可自定义节点体(`render(node, props, host)` 画真实 DOM,宿主不每帧重建 ⇒ 输入框不失焦);② 节点自带参考图(`data.refOn/refUrl` ⇒ 任务图里补伪参考图,坐标取节点自身 ⇒ 仍参与「图片按 X 轴排序」);③ 连线白名单按 `data.outKind === 'prompt'` 归一化,7 条规则一次放行,内置节点行为逐字不变。上一条 v3.24.80 = 离开页面的兜底保存不递增 rev(2026-11-14 07:20 补发 —— 首发 11-13 23:25 撞 Cloudflare Workers API 事故 `503 no healthy upstream`,期间正式站保持在 `v3.24.79+8598a57` 未动)。v3.24.83 的 bump 提交即 `0a27a42`(v3.24.82 为 `ef6cf42`、v3.24.81 为 `dba71e3`);主干 HEAD 会继续前进,见 [`RELEASES.md`](../RELEASES.md))| 历史分支 `refactor/architecture` / `feat/multi-canvas-tabs` / `refactor/state-store` 已于 2026-10-20 清理(内容均已并入 main,归档标签 `archive/*`),本文**计数类事实**已按 main HEAD 复算。
|
||||
<!-- 2026-10-28 P1 拆分批 1:新增 src/generation-task-graph.js(5 个任务图纯函数自 app.js 迁出)
|
||||
⇒ 模块数 60→61、耦合面 51→52、sourceModules 60→61。耦合面只**新增** IWBWTaskGraph,无删除。
|
||||
2026-10-28 P1 拆分批 2:新增 src/storage-config-shape.js(9 个配置形状纯函数自 app.js 迁出)
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
# Image Workbench 插件开发规范
|
||||
|
||||
> 版本:v1(2026-11-22)。面向官方与第三方插件;示例以 promptlib(提示词库)与 style-source(风格库)为准。
|
||||
> 相关文档:plugin-node-drag.md(节点拖入/指针交互踩坑)、plugin-node-outkind.md(下游连线声明)、plugin-theme.md(主题契约)。
|
||||
|
||||
## 1. 目录与基本结构
|
||||
|
||||
插件是「一个目录 + 一个 IIFE 入口」,由宿主在启用时动态加载并调用 register。
|
||||
|
||||
my-plugin/
|
||||
package.json # 版本 + ibwPlugin 元数据
|
||||
src/index.js # 入口(IIFE,末尾 IWBPluginHost.register)
|
||||
styles.css # 样式(必须自包含)
|
||||
README.md
|
||||
|
||||
package.json:
|
||||
|
||||
{
|
||||
"name": "@iwb-plugin/my-plugin",
|
||||
"version": "1.0.0",
|
||||
"ibwPlugin": { "id": "my-plugin", "entry": "src/index.js", "apiVersion": 1 }
|
||||
}
|
||||
|
||||
入口骨架:
|
||||
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
if (!global.IWBPluginHost) return
|
||||
global.IWBPluginHost.register({
|
||||
id: 'my-plugin',
|
||||
name: '我的插件',
|
||||
version: '1.0.0',
|
||||
capabilities: ['panels', 'canvas', 'canvasWrite'],
|
||||
settings: { panel: { type: 'custom', label: '设置', render: renderSettings } },
|
||||
mount: mount,
|
||||
unmount: unmount,
|
||||
}, function (ctx) {
|
||||
// setup:注册面板/节点/命令
|
||||
return { dispose () {} }
|
||||
})
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
|
||||
## 2. 能力(capabilities)与 ctx 映射
|
||||
|
||||
只申请用到的能力;能力名与 ctx 键不同:
|
||||
|
||||
| capability | ctx 键 | 用途 |
|
||||
|---|---|---|
|
||||
| panels | ctx.ui | 侧栏/独立面板注册 |
|
||||
| promptlib | ctx.promptlib | 提示词库数据 + 文件 + 备份 |
|
||||
| nodeTypes | ctx.nodes | 画布节点类型注册 |
|
||||
| canvas | ctx.canvas | 只读:getNodes / getSelectedNode / screenToWorld |
|
||||
| canvasWrite | ctx.canvasWrite | 写入:createNode / createImageNode / setNodeImage |
|
||||
| nodeActions | ctx.nodeActions | 节点右键/气泡动作 |
|
||||
| commands | ctx.commands | 命令面板 |
|
||||
| settings | ctx.settings | KV 配置 |
|
||||
| data | ctx.data | 插件数据文件 |
|
||||
|
||||
**注意**:createNode 在 ctx.canvasWrite,不在 ctx.canvas。调错只会提示“宿主不支持”。
|
||||
|
||||
## 3. 面板
|
||||
|
||||
ctx.ui.registerPanel({
|
||||
id: 'my-panel',
|
||||
title: '我的插件',
|
||||
mount (host) { /* 渲染到 host */ },
|
||||
unmount (host) { /* 清理定时器/监听 */ }
|
||||
})
|
||||
|
||||
- mount 只调用一次,内部自己管理重渲染。
|
||||
- 面板宽度可变:使用栅格/瀑布流,不要写死 px 宽度。
|
||||
- 面板内所有 DOM 事件在 unmount 时移除。
|
||||
|
||||
## 4. 节点类型
|
||||
|
||||
ctx.nodes.register({
|
||||
id: 'tpl',
|
||||
title: '模板节点',
|
||||
defaults: { outKind: 'prompt' },
|
||||
ports: { in: false, out: true },
|
||||
height: 360,
|
||||
render (node, props, host) { /* 首次建 DOM,之后 sync */ }
|
||||
})
|
||||
|
||||
宿主会生成类型 plugin:<插件id>:<变体id>。
|
||||
|
||||
**必须遵守**:
|
||||
|
||||
1. 输出文本/提示词 → data.outKind = 'prompt'(注册默认值、拖入数据、旧节点在 render 里自愈)。
|
||||
2. 拖入画布用指针拖拽,不用原生 HTML5 DnD:
|
||||
|
||||
pointerdown → pointermove(>5px) 幽灵卡片
|
||||
→ pointerup → ctx.canvas.screenToWorld(x,y)
|
||||
→ ctx.canvasWrite.createNode('tpl', wx, wy, data)
|
||||
|
||||
3. 输入框:未选中时 pointer-events: none,选中后才可编辑;只读 textarea 同样处理。
|
||||
4. 单击 = 选中/拖动,双击 = 编辑;不要用单击打开详情。
|
||||
5. 节点 render 必须可增量 sync,避免整块重建(输入框会丢焦点)。
|
||||
|
||||
## 5. 数据与文件
|
||||
|
||||
- 小数据:ctx.promptlib(或 ctx.data)JSON,单文件 < 1MB。
|
||||
- 大文件(封面/图片):ctx.promptlib.filePut/fileGet/fileList,落地在 plugin-data/<id>/files/。
|
||||
- dataUrlToBytes() 返回 { mime, bytes },不是 Uint8Array。
|
||||
- 备份:提供导出/导入 JSON;导入按 id 合并,提供“覆盖同 id”选项。
|
||||
- 迁移:旧格式在 setup 里做一次性迁移,失败要提示而不是静默丢数据。
|
||||
|
||||
## 6. 设置页面
|
||||
|
||||
宿主设置页内嵌渲染,不弹独立页面:
|
||||
|
||||
settings: {
|
||||
panel: { type: 'custom', label: '分组与备份', render: renderSettings }
|
||||
}
|
||||
|
||||
render 返回 DOM;宿主负责挂载/卸载。设置页适合放:
|
||||
|
||||
- 分组管理(新建/改名/排序/删除)
|
||||
- 数据备份(导出/导入)
|
||||
- 数据位置(打开数据目录)
|
||||
- 插件级开关/默认值
|
||||
|
||||
## 7. 样式规范
|
||||
|
||||
1. **自包含**:宿主基础样式会变;用到的宿主类按作用域复制一份(.iwb-myplugin …)。
|
||||
2. 统一前缀:面板/节点类名 my-plugin-*,避免与宿主 .iwb-* 冲突。
|
||||
3. 颜色走 CSS 变量:var(--iwb-text)、--iwb-panel、--iwb-border、--iwb-plugin-accent。
|
||||
4. 动画克制:只做 hover/press 反馈;不使用持续浮动动画。
|
||||
5. 深色主题:不写死 #fff/#000;主题契约测试会扫描。
|
||||
6. 悬停放大只缩放内层背景,不缩放卡片本体(避免命中区域漂移/闪烁)。
|
||||
7. 图片/封面 pointer-events: none,点击永远落到卡片。
|
||||
|
||||
## 8. 错误处理与提示
|
||||
|
||||
- 所有用户可见错误用 ctx.promptlib.notify / ctx.ui.toast,文案给“下一步怎么办”。
|
||||
- 异步链必须有 catch;不要吞掉错误后静默。
|
||||
- 崩溃日志:window.onerror 由宿主统一采集,插件不要自己覆盖。
|
||||
- 定时器/监听在 unmount/dispose 清理,避免面板切换后重复执行。
|
||||
|
||||
## 9. 测试与门禁
|
||||
|
||||
提交前至少:
|
||||
|
||||
node scripts/validate-plugins.js # manifest/能力/入口校验
|
||||
node scripts/theme-contract-test.js # 主题变量
|
||||
node tests/plugin-<id>-render-test.js # jsdom 渲染/交互
|
||||
|
||||
jsdom 可覆盖:面板渲染、节点 render/sync、拖拽插入(stub screenToWorld/createNode)、双击详情、保存回详情、封面 img。
|
||||
|
||||
## 10. 发布与市场
|
||||
|
||||
1. 改 package.json version 与入口 version(两处一致)。
|
||||
2. node scripts/sync-plugins-from-repo.js(同步到客户端 plugins/)
|
||||
3. node scripts/gen-market.js(生成 market/ 与 zip)
|
||||
4. 上传 market 到 NAS(tar + scp + 解压)
|
||||
5. 客户端发版:set-version → CHANGELOG → 锚点 → verify:ci → build → publish-update → releases/site → tag/push
|
||||
|
||||
## 11. 常见坑(务必先读)
|
||||
|
||||
- 原生 HTML5 拖放:WKWebView 吞 pointerup,节点落地后第一次点击异常 → 用指针拖拽。
|
||||
- ctx.canvas 没有 createNode → 用 ctx.canvasWrite。
|
||||
- 输入框拦截拖动 → 未选中时 pointer-events:none。
|
||||
- 只读 textarea 仍可选中文本 → pointer-events:none。
|
||||
- dataUrlToBytes 返回对象 → 取 .bytes。
|
||||
- 封面直接存 dataURL 会让 JSON 膨胀 → 迁移到文件,只存 { img }。
|
||||
- 插件节点不声明 outKind → 只能中继,无法直连生图。
|
||||
@@ -0,0 +1,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 细节。
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "image-workbench-web",
|
||||
"private": true,
|
||||
"version": "3.26.38",
|
||||
"version": "3.26.40",
|
||||
"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.16",
|
||||
"version": "1.8.8",
|
||||
"files": {
|
||||
"main.js": "cc303530f758e54a185710e8c47620b7e588693adeb86a421b0833aed114a445",
|
||||
"styles.css": "1d3d84220118ed97490314d2aa122126d505c9eabcf1f8bd53a627983e7d5942"
|
||||
"main.js": "91fde4bcfa888b04ee2b0e79a05d951a56247bc76ecd11b5d9500131df11d542",
|
||||
"styles.css": "70cc02f98bed580f70ef9c71009dde29e01a92684c28d69016438d49c1e0a95b"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
+254
-73
@@ -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) {
|
||||
@@ -755,6 +761,7 @@
|
||||
global.removeEventListener('pointercancel', st.onCancel, true)
|
||||
} catch (e) { /* ignore */ }
|
||||
if (st.ghost && st.ghost.parentNode) st.ghost.parentNode.removeChild(st.ghost)
|
||||
try { document.body.classList.remove('iwb-plp-dragging') } catch (e) { /* ignore */ }
|
||||
try { st.card.classList.remove('is-dragging'); st.card.classList.remove('is-pressed') } catch (e) { /* ignore */ }
|
||||
if (!commit || !st.active) return
|
||||
try {
|
||||
@@ -770,7 +777,7 @@
|
||||
if (!w) return
|
||||
var vd = varsOf(st.p)
|
||||
if (vd.length) {
|
||||
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: 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, w.y, { text: st.p.text || '', title: st.p.name || '' })
|
||||
@@ -778,10 +785,91 @@
|
||||
}
|
||||
} catch (err) { notify('拖拽插入失败:' + ((err && err.message) || err), 'err') }
|
||||
}
|
||||
// 详情里插入节点:落到画布可视区域中心,而不是被 findSpot 丢到左侧面板下面
|
||||
function canvasCenter (w, h) {
|
||||
try {
|
||||
var c = document.querySelector('.iwb-canvas')
|
||||
var sw = ctx.canvas && typeof ctx.canvas.screenToWorld === 'function' ? ctx.canvas.screenToWorld : null
|
||||
if (!c || !sw) return null
|
||||
var r = c.getBoundingClientRect()
|
||||
var pt = sw(r.left + r.width / 2, r.top + r.height / 2)
|
||||
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(双击详情失效)
|
||||
card.classList.add('is-pressed')
|
||||
try { document.body.classList.add('iwb-plp-dragging') } catch (err) { /* ignore */ }
|
||||
var st = { card: card, p: p, sx: e.clientX, sy: e.clientY, active: false, ghost: null }
|
||||
st.onMove = function (ev) {
|
||||
var dx = ev.clientX - st.sx, dy = ev.clientY - st.sy
|
||||
@@ -886,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 }
|
||||
}
|
||||
@@ -1249,47 +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 id = cw.createNode('ptpl', null, 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 () {
|
||||
@@ -1300,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') })
|
||||
})
|
||||
}
|
||||
@@ -1371,19 +1482,65 @@
|
||||
})
|
||||
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)
|
||||
})
|
||||
@@ -1401,13 +1558,31 @@
|
||||
textIn.selectionEnd = s + 1 + name.length
|
||||
textIn.focus()
|
||||
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)
|
||||
@@ -1416,7 +1591,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 }),
|
||||
@@ -1438,7 +1613,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()) + ' 副本' })
|
||||
@@ -1580,7 +1755,7 @@
|
||||
global.IWBPluginHost.register({
|
||||
id: 'promptlib',
|
||||
name: '提示词库',
|
||||
version: '1.6.16',
|
||||
version: '1.8.8',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'promptlib', 'nodeTypes', 'canvas', 'canvasWrite'],
|
||||
data: { schemaVersion: 3, maxBytes: 4 * 1024 * 1024 },
|
||||
@@ -1712,7 +1887,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
|
||||
@@ -1720,6 +1895,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
|
||||
@@ -1748,7 +1929,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.16",
|
||||
"version": "1.8.8",
|
||||
"apiVersion": 1,
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
@@ -13,7 +13,7 @@
|
||||
"提示词"
|
||||
],
|
||||
"files": {
|
||||
"main.js": "cc303530f758e54a185710e8c47620b7e588693adeb86a421b0833aed114a445",
|
||||
"styles.css": "1d3d84220118ed97490314d2aa122126d505c9eabcf1f8bd53a627983e7d5942"
|
||||
"main.js": "91fde4bcfa888b04ee2b0e79a05d951a56247bc76ecd11b5d9500131df11d542",
|
||||
"styles.css": "70cc02f98bed580f70ef9c71009dde29e01a92684c28d69016438d49c1e0a95b"
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@
|
||||
.iwb-plp-t {
|
||||
position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 7px 6px;
|
||||
background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,.66));
|
||||
color: #fff; font-size: 10.5px; line-height: 1.35; max-height: 48%;
|
||||
color: var(--iwb-text, #fff); font-size: 10.5px; line-height: 1.35; max-height: 48%;;
|
||||
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
|
||||
text-shadow: 0 1px 2px rgba(0,0,0,.35);
|
||||
}
|
||||
@@ -388,3 +388,167 @@ box-shadow: 0 24px 60px rgba(0,0,0,.32);
|
||||
/* v1.6.13:未选中时变量输入框不拦截指针 —— 单击节点=选中/可拖动;选中后再点输入框编辑 */
|
||||
.iwb-plp-node:not(.is-selected) input{pointer-events:none}
|
||||
.iwb-plp-card{user-select:none}
|
||||
body.iwb-plp-dragging, body.iwb-plp-dragging *{user-select:none!important;-webkit-user-select:none!important}
|
||||
.iwb-plp-placeghost{border-style:dashed!important;pointer-events:none}
|
||||
.iwb-plp-placehint{font-size:10.5px;color:var(--iwb-plp-accent,#5a4bd0);margin-top:2px}
|
||||
.iwb-plp-placebox{position:fixed;left:-9999px;top:0;z-index:99999;pointer-events:none;border:2px dashed var(--iwb-plp-accent,#6b4dff);border-radius:12px;background:color-mix(in srgb,var(--iwb-plp-accent,#6b4dff) 9%,transparent);display:flex;align-items:center;justify-content:center;box-shadow:0 10px 26px rgba(30,20,80,.10)}
|
||||
.iwb-plp-placebox-t{font-size:12px;color:var(--iwb-plp-accent,#5a3fd0);background:rgba(255,255,255,.82);border-radius:999px;padding:3px 10px}
|
||||
/* v1.6.23:放置指示改为灰色小方框 */
|
||||
.iwb-plp-placebox{border: 2px dashed var(--iwb-plugin-border, #9aa3ad);border-radius:10px;background:rgba(122,130,142,.10);box-shadow:none};
|
||||
.iwb-plp-placebox-t{font-size: 11px;color:var(--iwb-plugin-border, #6b7280);background:rgba(255,255,255,.75);padding:2px 8px};
|
||||
/* v1.7.0:编辑面板三栏 + 可拖宽;详情封面放大、变量高亮 */
|
||||
.iwb-plp-eleft{flex:0 0 236px;width:236px}
|
||||
.iwb-plp-emid{flex:1 1 auto;min-width:220px;display:flex;flex-direction:column;min-height:0}
|
||||
.iwb-plp-emid .iwb-plp-etext{flex:1 1 auto;min-height:0;resize:none}
|
||||
.iwb-plp-esplit{flex:0 0 10px;cursor:col-resize;display:flex;align-items:center;justify-content:center;border-radius:6px;background:var(--iwb-plugin-inset,#f3f4f7)}
|
||||
.iwb-plp-esplit:hover{background:var(--iwb-plugin-hover,#e9ecf1)}
|
||||
.iwb-plp-eright{flex:0 0 auto;width:300px;min-width:190px;max-width:460px;display:flex;flex-direction:column;min-height:0;background:var(--iwb-plugin-surface,#fafbfc);border:1px solid var(--iwb-border,#e6e8ec);border-radius:10px;padding:8px}
|
||||
.iwb-plp-vars{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
|
||||
.iwb-plp-vrows{flex:1 1 auto;min-height:0;overflow:auto}
|
||||
.iwb-plp-vitem{padding:4px 0;border-bottom:1px dashed var(--iwb-border,#eceef2)}
|
||||
.iwb-plp-vrow2{display:flex;align-items:center;gap:6px}
|
||||
.iwb-plp-vname{flex:1 1 auto;min-width:0;height:32px}
|
||||
.iwb-plp-vi{flex:0 0 auto;width:24px;height:24px;padding:0;border-radius:50%;border:1px solid var(--iwb-border,#dfe3e9);background:var(--iwb-plugin-surface, #fff);color:var(--iwb-text, #9aa1ac);font-size:11px;line-height:22px;text-align:center}
|
||||
.iwb-plp-vi.is-open{background: var(--iwb-plugin-border, #f1ecff);border-color:var(--iwb-plugin-border, #d8cbff);color:var(--iwb-plugin-border, #5a3fd0)};
|
||||
.iwb-plp-vdesc{width: 100%;height:28px;margin-top:5px;border-style:dashed;background:var(--iwb-plugin-border, #fbfcfd);font-size:11.5px;color:var(--iwb-plugin-border, #6b7280)};
|
||||
.iwb-plp-dcov{flex:0 0 auto;width:180px;height:180px;border-radius:12px;overflow:hidden}
|
||||
.iwb-plp-dvar{background: var(--iwb-plugin-border, #f1ecff);color:var(--iwb-plugin-border, #5a3fd0);border-radius:4px;padding:0 4px;font-weight:500};
|
||||
/* v1.7.1:编辑面板视觉精修——输入框比底色更亮、去多余边框、细分隔线 */
|
||||
.iwb-plp-dialog .iwb-plp-dbody{gap: 10px;padding:12px;background:var(--iwb-plugin-border, #f4f5f7)};
|
||||
.iwb-plp-dialog .iwb-plp-eleft{flex: 0 0 236px;width:236px;background:var(--iwb-plugin-border, #fff);border:1px solid var(--iwb-plugin-border, #e6e8ec);border-radius:12px;padding:12px};
|
||||
.iwb-plp-dialog .iwb-plp-emid{background: var(--iwb-plugin-border, #fff);border:1px solid var(--iwb-plugin-border, #e6e8ec);border-radius:12px;padding:10px 12px 12px};
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-etext{border: 1px solid var(--iwb-plugin-border, #eef0f3);background:var(--iwb-plugin-border, #fbfcfd);border-radius:9px;padding:10px 12px};
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-etext: focus{background:var(--iwb-plugin-border, #fff);border-color:var(--iwb-plugin-border, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)};
|
||||
.iwb-plp-dialog .iwb-plp-esplit{flex:0 0 6px;background:transparent;border-radius:4px}
|
||||
.iwb-plp-dialog .iwb-plp-esplit: hover{background:var(--iwb-plugin-border, #e7e9ee)};
|
||||
.iwb-plp-dialog .iwb-plp-esplit: :before{content:'';display:block;width:2px;height:30px;border-radius:2px;background:var(--iwb-plugin-border, #d7dbe2)};
|
||||
.iwb-plp-dialog .iwb-plp-eright{background:transparent;border:0;padding:2px 0 0}
|
||||
.iwb-plp-dialog .iwb-plp-vitem{border:0;padding:2px 0}
|
||||
.iwb-plp-dialog .iwb-plp-vrow2{gap:6px}
|
||||
.iwb-plp-dialog .iwb-plp-vname{background: var(--iwb-plugin-border, #fbfcfd);border:1px solid var(--iwb-plugin-border, #eceef2);border-radius:8px;height:32px;padding:0 10px;font-size:12.5px;color:var(--iwb-plugin-border, #33383f)};
|
||||
.iwb-plp-dialog .iwb-plp-vname: focus{background:var(--iwb-plugin-border, #fff);border-color:var(--iwb-plugin-border, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)};
|
||||
.iwb-plp-dialog .iwb-plp-vi{background: transparent;border:0;color:var(--iwb-plugin-border, #aab0ba);width:22px;height:22px;line-height:20px};
|
||||
.iwb-plp-dialog .iwb-plp-vi: hover{background:var(--iwb-plugin-border, #eef0f4);color:var(--iwb-plugin-border, #6b7280)};
|
||||
.iwb-plp-dialog .iwb-plp-vi.is-open{background: var(--iwb-plugin-border, #f1ecff);color:var(--iwb-plugin-border, #5a3fd0)};
|
||||
.iwb-plp-dialog .iwb-plp-vdesc{background: var(--iwb-plugin-border, #fbfcfd);border:1px dashed var(--iwb-plugin-border, #e2e6ec);border-radius:7px;height:28px;margin-top:4px};
|
||||
.iwb-plp-dialog .iwb-plp-lrow span{color: var(--iwb-plugin-border, #8a919c);font-size:11.5px};
|
||||
.iwb-plp-dialog .iwb-plp-lrow .iwb-input{background: var(--iwb-plugin-border, #fbfcfd);border:1px solid var(--iwb-plugin-border, #eceef2);border-radius:8px;height:32px};
|
||||
.iwb-plp-dialog .iwb-plp-lrow .iwb-input: focus{background:var(--iwb-plugin-border, #fff);border-color:var(--iwb-plugin-border, #cfc3ff)};
|
||||
/* v1.7.2:正文变量高亮(黑粗)+ 说明灰按钮 + 说明背景回归面板底 */
|
||||
.iwb-plp-ewrap{position: relative;flex:1 1 auto;min-height:0;display:flex;border-radius:9px;background:var(--iwb-plugin-border, #fbfcfd);border:1px solid var(--iwb-plugin-border, #eef0f3)};
|
||||
.iwb-plp-ewrap: focus-within{background:var(--iwb-plugin-border, #fff);border-color:var(--iwb-plugin-border, #cfc3ff);box-shadow:0 0 0 3px rgba(107,77,255,.08)};
|
||||
.iwb-plp-ewrap .iwb-plp-etext{flex: 1 1 auto;min-height:0;border:0;background:transparent;box-shadow:none;color:transparent;caret-color:var(--iwb-plugin-border, #1d2129);position:relative;z-index:1;resize:none};
|
||||
.iwb-plp-ewrap .iwb-plp-etext:focus{background:transparent;border:0;box-shadow:none}
|
||||
.iwb-plp-hl{position: absolute;inset:0;padding:10px 12px;overflow:hidden;white-space:pre-wrap;word-wrap:break-word;font-size:13px;line-height:1.9;color:var(--iwb-plugin-border, #5b6472);pointer-events:none;z-index:0};
|
||||
.iwb-plp-hlvar{color: var(--iwb-plugin-border, #1d2129);font-weight:600};
|
||||
.iwb-plp-dialog .iwb-plp-vi.is-open{background: var(--iwb-plugin-border, #eef0f3);color:var(--iwb-plugin-border, #5b6472)};
|
||||
.iwb-plp-dialog .iwb-plp-vdesc{background: transparent;border:1px dashed var(--iwb-plugin-border, #dfe3e9)};
|
||||
.iwb-plp-dvar{background: transparent;color:var(--iwb-plugin-border, #1d2129);font-weight:600;padding:0};
|
||||
.iwb-plp-hres{height:6px;margin:-3px 0 0;cursor:ns-resize;flex:0 0 auto;border-radius:3px}
|
||||
.iwb-plp-hres: hover{background:var(--iwb-plugin-border, #e7e9ee)};
|
||||
/* 正文可见性:textarea 透明,显示下方高亮层 */
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap{flex: 1 1 auto;min-height:0;position:relative;display:flex;background:var(--iwb-plugin-border, #fbfcfd);border:1px solid var(--iwb-plugin-border, #eef0f3);border-radius:9px};
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap .iwb-plp-etext{background:transparent!important;color:transparent!important;border:0!important;box-shadow:none!important;padding:10px 12px}
|
||||
.iwb-plp-dialog .iwb-plp-hl{padding:10px 12px;font-size:13px;line-height:1.9}
|
||||
.iwb-plp-namebox{min-height:34px;height:34px;line-height:1.45;padding:7px 10px;resize:vertical;overflow:auto;font-size:12.5px}
|
||||
.iwb-plp-insvar{color: var(--iwb-plugin-border, #1d2129)!important;background:var(--iwb-plugin-border, #fff)!important;border-color:var(--iwb-plugin-border, #e2e6ec)!important};
|
||||
.iwb-plp-insvar: hover{background:var(--iwb-plugin-border, #f4f6f9)!important};
|
||||
/* v1.7.5:编辑封面卡在框内;详情封面放大 */
|
||||
.iwb-plp-dialog .iwb-plp-ecov{width:100%;height:250px;overflow:hidden;border-radius:12px;background:var(--iwb-plugin-inset,#f3f4f7)}
|
||||
.iwb-plp-dialog .iwb-plp-ecov .iwb-plp-cover{width:100%;height:100%;object-fit:cover;object-position:center;display:block;border-radius:12px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{align-items:flex-start}
|
||||
.iwb-plp-dialog .iwb-plp-dcov{width:264px;height:264px;flex:0 0 auto;overflow:hidden;border-radius:12px;background:var(--iwb-plugin-inset,#f3f4f7)}
|
||||
.iwb-plp-dialog .iwb-plp-dcov .iwb-plp-cover{width:100%;height:100%;object-fit:cover;object-position:center;display:block;border-radius:12px}
|
||||
/* v1.7.6:封面完整展示(contain),不裁剪 */
|
||||
.iwb-plp-dialog .iwb-plp-ecov .iwb-plp-cover{object-fit:contain;background:transparent}
|
||||
.iwb-plp-dialog .iwb-plp-dcov .iwb-plp-cover{object-fit:contain;background:transparent}
|
||||
.iwb-plp-dialog .iwb-plp-ecov{background:var(--iwb-plugin-inset,#f3f4f7)}
|
||||
.iwb-plp-dialog .iwb-plp-dcov{background:var(--iwb-plugin-inset,#f3f4f7)}
|
||||
/* v1.7.7:编辑区文字层与高亮层使用完全一致的字体度量,修复光标/选区错位 */
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap .iwb-plp-etext,
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-hl{
|
||||
font-family:-apple-system,BlinkMacSystemFont,'PingFang SC','Helvetica Neue',system-ui,sans-serif!important;
|
||||
font-size:13px!important;
|
||||
line-height:1.85!important;
|
||||
letter-spacing:0!important;
|
||||
padding:10px 12px!important;
|
||||
margin:0!important;
|
||||
border:0!important;
|
||||
box-sizing:border-box!important;
|
||||
white-space:pre-wrap!important;
|
||||
overflow-wrap:break-word!important;
|
||||
word-break:break-word!important;
|
||||
tab-size:4!important;
|
||||
}
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-ewrap .iwb-plp-etext{overflow-y:auto!important;scrollbar-gutter:stable}
|
||||
.iwb-plp-dialog .iwb-plp-emid .iwb-plp-hl{overflow:hidden!important}
|
||||
/* v1.7.9:详情正文独立滚动,长文不再压到底部按钮 */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{overflow:hidden;align-items:stretch}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dright{flex:1 1 auto;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtext{flex:1 1 auto;min-height:0;overflow:auto;padding-right:10px;margin-bottom:6px}
|
||||
/* v1.8.0:详情标题/分组/标签移到封面下方;编辑标签改为输入+加号 */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{align-items:flex-start}
|
||||
.iwb-plp-dleftcol{flex:0 0 264px;width:264px;display:flex;flex-direction:column;min-width:0}
|
||||
.iwb-plp-dtitle{font-size:18px;font-weight:650;line-height:1.35;margin-top:14px;color:var(--iwb-text,#1d2129)}
|
||||
.iwb-plp-dmeta{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:8px}
|
||||
.iwb-plp-dgroup{font-size: 11.5px;background:var(--iwb-plugin-border, #eef0f4);color:var(--iwb-plugin-border, #5b6472);border-radius:999px;padding:2px 9px};
|
||||
.iwb-plp-dtag{font-size: 11.5px;background:var(--iwb-plugin-border, #f4f0ff);color:var(--iwb-plugin-border, #5a3fd0);border-radius:999px;padding:2px 9px};
|
||||
.iwb-plp-dlen{font-size: 11.5px;color:var(--iwb-plugin-border, #9aa1ac)};
|
||||
.iwb-plp-tagwrap{display:flex;flex-direction:column;gap:6px;flex:1;min-width:0}
|
||||
.iwb-plp-tagchips{display:flex;flex-wrap:wrap;gap:5px}
|
||||
.iwb-plp-tagchip{display: inline-flex;align-items:center;gap:4px;font-size:11.5px;background:var(--iwb-plugin-border, #eef0f4);border-radius:999px;padding:2px 8px;color:var(--iwb-plugin-border, #3f4450)};
|
||||
.iwb-plp-tagx{cursor: pointer;color:var(--iwb-plugin-border, #9aa1ac);font-style:normal};
|
||||
.iwb-plp-tagx: hover{color:var(--iwb-plugin-border, #c0392b)};
|
||||
.iwb-plp-tagrow{display:flex;gap:6px}
|
||||
.iwb-plp-tagin{flex:1;min-width:0;height:30px}
|
||||
.iwb-plp-lrow-tags{align-items:flex-start}
|
||||
.iwb-plp-tagadd{flex:0 0 auto;width:30px;height:30px;padding:0;font-size:15px;line-height:28px}
|
||||
/* v1.8.1:详情标题/分组/标签左对齐并带标题;标签加号对齐修复 */
|
||||
.iwb-plp-dtitle{font-size:20px;font-weight:650;line-height:1.35;margin-top:16px;color:var(--iwb-text,#1d2129)}
|
||||
.iwb-plp-dmeta{display:flex;flex-direction:column;gap:7px;margin-top:12px;align-items:flex-start}
|
||||
.iwb-plp-dmrow{display:flex;align-items:center;gap:10px;width:100%}
|
||||
.iwb-plp-dmk{flex: 0 0 30px;width:30px;font-size:11.5px;color:var(--iwb-plugin-border, #9aa1ac)};
|
||||
.iwb-plp-dmv{display:flex;flex-wrap:wrap;align-items:center;gap:5px;min-width:0}
|
||||
.iwb-plp-dgroup{font-size: 12px;color:var(--iwb-plugin-border, #3f4450);background:var(--iwb-plugin-border, #f2f4f7);border-radius:6px;padding:2px 9px};
|
||||
.iwb-plp-dtag{font-size: 11.5px;color:var(--iwb-plugin-border, #5a3fd0);background:var(--iwb-plugin-border, #f4f0ff);border-radius:6px;padding:2px 9px};
|
||||
.iwb-plp-dempty{font-size: 12px;color:var(--iwb-plugin-border, #b3b9c2)};
|
||||
.iwb-plp-dlen{font-size: 12px;color:var(--iwb-plugin-border, #8a919c)};
|
||||
.iwb-plp-tagrow{display:flex;align-items:center;gap:6px}
|
||||
.iwb-plp-tagin{height:30px;border-radius:8px}
|
||||
.iwb-plp-tagadd{flex: 0 0 auto;width:30px;height:30px;padding:0;border-radius:8px;background:var(--iwb-plugin-border, #f2f4f7);border:1px solid var(--iwb-plugin-border, #e2e6ec);color:var(--iwb-plugin-border, #5b6472);font-size:16px;line-height:1;display:inline-flex;align-items:center;justify-content:center};
|
||||
.iwb-plp-tagadd: hover{background:var(--iwb-plugin-border, #e9ecf1)};
|
||||
/* v1.8.2:详情左右两栏卡片化 + 分割线 */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{gap: 14px;padding:16px;background:var(--iwb-plugin-border, #f4f5f7)};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dleftcol{flex: 0 0 300px;width:300px;padding:12px;border:1px solid var(--iwb-plugin-border, #e8eaee);border-radius:14px;background:var(--iwb-plugin-border, #fff);align-self:flex-start};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dcov{width:100%;height:270px;border-radius:10px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtitle{font-size:20px;font-weight:650;line-height:1.35;margin-top:14px;color:var(--iwb-text,#1d2129)}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmeta{margin-top: 12px;padding-top:12px;border-top:1px solid var(--iwb-plugin-border, #eef0f3);gap:8px};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dright{flex: 1 1 auto;min-width:0;min-height:0;display:flex;flex-direction:column;padding:14px 16px;border:1px solid var(--iwb-plugin-border, #e8eaee);border-radius:14px;background:var(--iwb-plugin-border, #fff);overflow:hidden};
|
||||
.iwb-plp-dsec{font-size: 11.5px;font-weight:600;color:var(--iwb-plugin-border, #8a919c);letter-spacing:.04em;padding-bottom:8px;margin-bottom:8px;border-bottom:1px solid var(--iwb-plugin-border, #eef0f3);flex:0 0 auto};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtext{flex: 1 1 auto;min-height:0;overflow:auto;padding-right:10px;font-size:13.5px;line-height:2;color:var(--iwb-plugin-border, #3a4048)};
|
||||
/* v1.8.3:详情左卡片撑到底、四边等距;正文恢复滚动不被底部遮挡 */
|
||||
.iwb-plp-dialog-detail{display:flex;flex-direction:column;overflow:hidden}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{display: flex;flex:1 1 auto;min-height:0;overflow:hidden;gap:14px;padding:16px;background:var(--iwb-plugin-border, #f4f5f7)};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dleftcol{align-self: stretch;display:flex;flex-direction:column;overflow:auto;padding:12px;border:1px solid var(--iwb-plugin-border, #e8eaee);border-radius:14px;background:var(--iwb-plugin-border, #fff)};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dright{flex: 1 1 auto;min-width:0;min-height:0;overflow:hidden;display:flex;flex-direction:column;padding:14px 16px;border:1px solid var(--iwb-plugin-border, #e8eaee);border-radius:14px;background:var(--iwb-plugin-border, #fff)};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtext{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;padding-right:8px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dfooter{flex:0 0 auto}
|
||||
/* v1.8.4:右卡片纵向拉伸填满,正文出现滚动条 */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dbody{align-items:stretch!important}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dright{align-self:stretch!important;height:100%;max-height:100%;overflow:hidden!important}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtext{flex:1 1 0;min-height:0;overflow-y:auto!important;overflow-x:hidden}
|
||||
/* v1.8.7:详情标题缩小;分组/标签去底色;元信息加分割线与行高 */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtitle{font-size:17px!important;font-weight:650;margin-top:12px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmeta{margin-top: 12px;padding-top:14px;border-top:1px solid var(--iwb-plugin-border, #eef0f3);gap:10px};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmrow{gap:6px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmk{flex: 0 0 auto;width:auto;font-size:12px;line-height:1.6;color:var(--iwb-plugin-border, #9aa1ac)};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dgroup,.iwb-plp-dialog-detail .iwb-plp-dtag{background: transparent!important;padding:0!important;border-radius:0!important;font-size:12.5px;line-height:1.6;color:var(--iwb-plugin-border, #2f3540)};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtag{color: var(--iwb-plugin-border, #5a3fd0);};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dlen{font-size: 12.5px;line-height:1.6;color:var(--iwb-plugin-border, #2f3540)};
|
||||
/* v1.8.8:详情标题 14px;元信息行间浅分割线;封面底色更接近白色(编辑/详情统一) */
|
||||
.iwb-plp-dialog-detail .iwb-plp-dtitle{font-size:14px!important;font-weight:650;line-height:1.5;margin-top:12px}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmeta{gap:0}
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmrow{padding: 7px 0;border-bottom:1px solid var(--iwb-plugin-border, #f3f5f8)};
|
||||
.iwb-plp-dialog-detail .iwb-plp-dmrow:last-child{border-bottom:0}
|
||||
.iwb-plp-dialog .iwb-plp-dcov,.iwb-plp-dialog .iwb-plp-ecov{background: var(--iwb-plugin-border, #fcfcfd)!important};
|
||||
.iwb-plp-dialog .iwb-plp-dcov .iwb-plp-cover,.iwb-plp-dialog .iwb-plp-ecov .iwb-plp-cover{background:transparent!important}
|
||||
@@ -90,6 +90,7 @@ const html = `<!doctype html>
|
||||
<a href="/">首页</a>
|
||||
<a href="/download/" class="on">下载</a>
|
||||
<a href="/plugins/">插件</a>
|
||||
<a href="/dev/">开发</a>
|
||||
<a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码</a>
|
||||
</div>
|
||||
<div class="right">
|
||||
|
||||
@@ -28,6 +28,7 @@ const nav = (active) => [
|
||||
' <a href="/"' + (active === 'home' ? ' class="on"' : '') + '>首页</a>',
|
||||
' <a href="/download/"' + (active === 'download' ? ' class="on"' : '') + '>下载</a>',
|
||||
' <a href="/plugins/"' + (active === 'plugins' ? ' class="on"' : '') + '>插件</a>',
|
||||
' <a href="/dev/"' + (active === 'dev' ? ' class="on"' : '') + '>开发</a>',
|
||||
' <a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码</a>',
|
||||
' </div>',
|
||||
' <div class="right">',
|
||||
@@ -83,6 +84,69 @@ const tags = []
|
||||
for (const p of plugins) for (const t of (p.tags || [])) if (tags.indexOf(t) < 0) tags.push(t)
|
||||
const tagChips = tags.map((t) => '<button class="tag" data-tag="' + esc(t) + '" style="cursor:pointer;padding:5px 12px">' + esc(t) + '</button>').join('\n ')
|
||||
|
||||
function mdToHtml (md) {
|
||||
const esc2 = (s) => String(s).replace(/[&<>]/g, (c) => ({ '&': '&', '<': '<', '>': '>' }[c]))
|
||||
const inline = (s) => esc2(s)
|
||||
.replace(/`([^`]+)`/g, '<code>$1</code>')
|
||||
.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
|
||||
.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>')
|
||||
const lines = String(md).split('\n')
|
||||
const out = []
|
||||
let i = 0
|
||||
let inCode = false
|
||||
let code = []
|
||||
let inList = ''
|
||||
const closeList = () => { if (inList) { out.push('</' + inList + '>'); inList = '' } }
|
||||
while (i < lines.length) {
|
||||
const line = lines[i]
|
||||
if (line.trim().indexOf('```') === 0) {
|
||||
if (!inCode) { inCode = true; code = [] } else {
|
||||
inCode = false
|
||||
out.push('<pre><code>' + esc2(code.join('\n')) + '</code></pre>')
|
||||
}
|
||||
i++; continue
|
||||
}
|
||||
if (inCode) { code.push(line); i++; continue }
|
||||
if (!line.trim()) { closeList(); i++; continue }
|
||||
if (/^---+$/.test(line.trim())) { closeList(); out.push('<hr>'); i++; continue }
|
||||
const h = line.match(/^(#{1,4})\s+(.*)$/)
|
||||
if (h) { closeList(); out.push('<h' + h[1].length + '>' + inline(h[2]) + '</h' + h[1].length + '>'); i++; continue }
|
||||
if (line.trim().indexOf('|') === 0) {
|
||||
const rows = []
|
||||
while (i < lines.length && lines[i].trim().indexOf('|') === 0) rows.push(lines[i++])
|
||||
const cells = rows.map((r) => r.trim().replace(/^\||\|$/g, '').split('|').map((c) => c.trim()))
|
||||
if (cells.length > 1) {
|
||||
out.push('<table><thead><tr>' + cells[0].map((c) => '<th>' + inline(c) + '</th>').join('') + '</tr></thead><tbody>')
|
||||
for (let r = 2; r < cells.length; r++) out.push('<tr>' + cells[r].map((c) => '<td>' + inline(c) + '</td>').join('') + '</tr>')
|
||||
out.push('</tbody></table>')
|
||||
}
|
||||
continue
|
||||
}
|
||||
if (/^ \S/.test(line)) {
|
||||
closeList()
|
||||
const block = []
|
||||
while (i < lines.length && (/^ /.test(lines[i]) || !lines[i].trim())) { block.push(lines[i].replace(/^ /, '')); i++ }
|
||||
while (block.length && !block[block.length - 1].trim()) block.pop()
|
||||
out.push('<pre><code>' + esc2(block.join('\n')) + '</code></pre>')
|
||||
continue
|
||||
}
|
||||
const li = line.match(/^\s*[-*]\s+(.*)$/)
|
||||
if (li) {
|
||||
if (inList !== 'ul') { closeList(); out.push('<ul>'); inList = 'ul' }
|
||||
out.push('<li>' + inline(li[1]) + '</li>'); i++; continue
|
||||
}
|
||||
const ol = line.match(/^\s*\d+\.\s+(.*)$/)
|
||||
if (ol) {
|
||||
if (inList !== 'ol') { closeList(); out.push('<ol>'); inList = 'ol' }
|
||||
out.push('<li>' + inline(ol[1]) + '</li>'); i++; continue
|
||||
}
|
||||
closeList(); out.push('<p>' + inline(line) + '</p>'); i++
|
||||
}
|
||||
closeList()
|
||||
if (inCode) out.push('<pre><code>' + esc2(code.join('\n')) + '</code></pre>')
|
||||
return out.join('\n')
|
||||
}
|
||||
|
||||
function render(tpl, map) {
|
||||
let out = fs.readFileSync(path.join(site, tpl), 'utf8')
|
||||
for (const k of Object.keys(map)) out = out.split('<!--' + k + '-->').join(map[k])
|
||||
@@ -113,4 +177,16 @@ pluginsPage = pluginsPage.replace('/assets/style.css', '/assets/style.css?v=' +
|
||||
fs.writeFileSync(path.join(site, 'plugins', 'index.html'), pluginsPage)
|
||||
fs.writeFileSync(path.join(site, 'plugins-index.json'), JSON.stringify(market, null, 2) + '\n')
|
||||
|
||||
// 插件开发规范(由 docs/standards/plugin-development.md 生成)
|
||||
const devMdPath = path.join(root, 'docs', 'standards', 'plugin-development.md')
|
||||
if (fs.existsSync(devMdPath)) {
|
||||
const devPage = render('_dev.tpl.html', {
|
||||
NAV: nav('dev'),
|
||||
FOOTER: footer,
|
||||
DEV_CONTENT: mdToHtml(fs.readFileSync(devMdPath, 'utf8')),
|
||||
}).replace('/assets/style.css', '/assets/style.css?v=' + STAMP)
|
||||
fs.mkdirSync(path.join(site, 'dev'), { recursive: true })
|
||||
fs.writeFileSync(path.join(site, 'dev', 'index.html'), devPage)
|
||||
}
|
||||
|
||||
console.log('站点已生成:首页 / 插件页(' + plugins.length + ' 个插件,' + tags.length + ' 个标签,版本 v' + V + ')')
|
||||
@@ -0,0 +1,30 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>插件开发规范 · Image Workbench</title>
|
||||
<link rel="stylesheet" href="/assets/style.css">
|
||||
<style>
|
||||
.devdoc{max-width:860px;margin:0 auto;padding:40px 0 72px;color:var(--ink,#1b1f24);font-size:15px;line-height:1.75}
|
||||
.devdoc h1{font-size:38px;line-height:1.2;margin:8px 0 18px}
|
||||
.devdoc h2{font-size:24px;margin:38px 0 10px;padding-top:10px;border-top:1px solid var(--line,#e6e8ec)}
|
||||
.devdoc h3{font-size:18px;margin:26px 0 8px}
|
||||
.devdoc p{margin:10px 0}
|
||||
.devdoc ul,.devdoc ol{margin:10px 0 10px 22px}
|
||||
.devdoc li{margin:4px 0}
|
||||
.devdoc code{background:#f3f4f6;border-radius:5px;padding:1px 5px;font-size:13px}
|
||||
.devdoc pre{background:#111418;color:#e6e8ec;border-radius:10px;padding:14px 16px;overflow:auto;font-size:13px;line-height:1.6}
|
||||
.devdoc pre code{background:none;color:inherit;padding:0}
|
||||
.devdoc table{border-collapse:collapse;width:100%;margin:14px 0;font-size:14px}
|
||||
.devdoc th,.devdoc td{border:1px solid var(--line,#e6e8ec);padding:7px 10px;text-align:left;vertical-align:top}
|
||||
.devdoc th{background:#f7f8fa}
|
||||
.devdoc blockquote{border-left:3px solid #d6dae1;margin:12px 0;padding:2px 14px;color:#5b6472}
|
||||
.devdoc a{color:#2b6cff}
|
||||
</style>
|
||||
</head><body>
|
||||
<!--NAV-->
|
||||
<main>
|
||||
<div class="wrap"><article class="devdoc">
|
||||
<!--DEV_CONTENT-->
|
||||
</article></div>
|
||||
</main>
|
||||
<!--FOOTER-->
|
||||
</body></html>
|
||||
@@ -0,0 +1,194 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>插件开发规范 · Image Workbench</title>
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.40-mws31ebx">
|
||||
<style>
|
||||
.devdoc{max-width:860px;margin:0 auto;padding:40px 0 72px;color:var(--ink,#1b1f24);font-size:15px;line-height:1.75}
|
||||
.devdoc h1{font-size:38px;line-height:1.2;margin:8px 0 18px}
|
||||
.devdoc h2{font-size:24px;margin:38px 0 10px;padding-top:10px;border-top:1px solid var(--line,#e6e8ec)}
|
||||
.devdoc h3{font-size:18px;margin:26px 0 8px}
|
||||
.devdoc p{margin:10px 0}
|
||||
.devdoc ul,.devdoc ol{margin:10px 0 10px 22px}
|
||||
.devdoc li{margin:4px 0}
|
||||
.devdoc code{background:#f3f4f6;border-radius:5px;padding:1px 5px;font-size:13px}
|
||||
.devdoc pre{background:#111418;color:#e6e8ec;border-radius:10px;padding:14px 16px;overflow:auto;font-size:13px;line-height:1.6}
|
||||
.devdoc pre code{background:none;color:inherit;padding:0}
|
||||
.devdoc table{border-collapse:collapse;width:100%;margin:14px 0;font-size:14px}
|
||||
.devdoc th,.devdoc td{border:1px solid var(--line,#e6e8ec);padding:7px 10px;text-align:left;vertical-align:top}
|
||||
.devdoc th{background:#f7f8fa}
|
||||
.devdoc blockquote{border-left:3px solid #d6dae1;margin:12px 0;padding:2px 14px;color:#5b6472}
|
||||
.devdoc a{color:#2b6cff}
|
||||
</style>
|
||||
</head><body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
|
||||
<div class="links">
|
||||
<a href="/">首页</a>
|
||||
<a href="/download/">下载</a>
|
||||
<a href="/plugins/">插件</a>
|
||||
<a href="/dev/" class="on">开发</a>
|
||||
<a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码</a>
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="btn" href="/plugins/">插件市场</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.40</a>
|
||||
</div>
|
||||
</div></nav>
|
||||
<main>
|
||||
<div class="wrap"><article class="devdoc">
|
||||
<h1>Image Workbench 插件开发规范</h1>
|
||||
<p>> 版本:v1(2026-11-22)。面向官方与第三方插件;示例以 promptlib(提示词库)与 style-source(风格库)为准。</p>
|
||||
<p>> 相关文档:plugin-node-drag.md(节点拖入/指针交互踩坑)、plugin-node-outkind.md(下游连线声明)、plugin-theme.md(主题契约)。</p>
|
||||
<h2>1. 目录与基本结构</h2>
|
||||
<p>插件是「一个目录 + 一个 IIFE 入口」,由宿主在启用时动态加载并调用 register。</p>
|
||||
<pre><code>my-plugin/
|
||||
package.json # 版本 + ibwPlugin 元数据
|
||||
src/index.js # 入口(IIFE,末尾 IWBPluginHost.register)
|
||||
styles.css # 样式(必须自包含)
|
||||
README.md</code></pre>
|
||||
<p>package.json:</p>
|
||||
<pre><code>{
|
||||
"name": "@iwb-plugin/my-plugin",
|
||||
"version": "1.0.0",
|
||||
"ibwPlugin": { "id": "my-plugin", "entry": "src/index.js", "apiVersion": 1 }
|
||||
}</code></pre>
|
||||
<p>入口骨架:</p>
|
||||
<pre><code>;(function (global) {
|
||||
'use strict'
|
||||
if (!global.IWBPluginHost) return
|
||||
global.IWBPluginHost.register({
|
||||
id: 'my-plugin',
|
||||
name: '我的插件',
|
||||
version: '1.0.0',
|
||||
capabilities: ['panels', 'canvas', 'canvasWrite'],
|
||||
settings: { panel: { type: 'custom', label: '设置', render: renderSettings } },
|
||||
mount: mount,
|
||||
unmount: unmount,
|
||||
}, function (ctx) {
|
||||
// setup:注册面板/节点/命令
|
||||
return { dispose () {} }
|
||||
})
|
||||
})(typeof window !== 'undefined' ? window : globalThis)</code></pre>
|
||||
<h2>2. 能力(capabilities)与 ctx 映射</h2>
|
||||
<p>只申请用到的能力;能力名与 ctx 键不同:</p>
|
||||
<table><thead><tr><th>capability</th><th>ctx 键</th><th>用途</th></tr></thead><tbody>
|
||||
<tr><td>panels</td><td>ctx.ui</td><td>侧栏/独立面板注册</td></tr>
|
||||
<tr><td>promptlib</td><td>ctx.promptlib</td><td>提示词库数据 + 文件 + 备份</td></tr>
|
||||
<tr><td>nodeTypes</td><td>ctx.nodes</td><td>画布节点类型注册</td></tr>
|
||||
<tr><td>canvas</td><td>ctx.canvas</td><td>只读:getNodes / getSelectedNode / screenToWorld</td></tr>
|
||||
<tr><td>canvasWrite</td><td>ctx.canvasWrite</td><td>写入:createNode / createImageNode / setNodeImage</td></tr>
|
||||
<tr><td>nodeActions</td><td>ctx.nodeActions</td><td>节点右键/气泡动作</td></tr>
|
||||
<tr><td>commands</td><td>ctx.commands</td><td>命令面板</td></tr>
|
||||
<tr><td>settings</td><td>ctx.settings</td><td>KV 配置</td></tr>
|
||||
<tr><td>data</td><td>ctx.data</td><td>插件数据文件</td></tr>
|
||||
</tbody></table>
|
||||
<p><strong>注意</strong>:createNode 在 ctx.canvasWrite,不在 ctx.canvas。调错只会提示“宿主不支持”。</p>
|
||||
<h2>3. 面板</h2>
|
||||
<pre><code>ctx.ui.registerPanel({
|
||||
id: 'my-panel',
|
||||
title: '我的插件',
|
||||
mount (host) { /* 渲染到 host */ },
|
||||
unmount (host) { /* 清理定时器/监听 */ }
|
||||
})</code></pre>
|
||||
<ul>
|
||||
<li>mount 只调用一次,内部自己管理重渲染。</li>
|
||||
<li>面板宽度可变:使用栅格/瀑布流,不要写死 px 宽度。</li>
|
||||
<li>面板内所有 DOM 事件在 unmount 时移除。</li>
|
||||
</ul>
|
||||
<h2>4. 节点类型</h2>
|
||||
<pre><code>ctx.nodes.register({
|
||||
id: 'tpl',
|
||||
title: '模板节点',
|
||||
defaults: { outKind: 'prompt' },
|
||||
ports: { in: false, out: true },
|
||||
height: 360,
|
||||
render (node, props, host) { /* 首次建 DOM,之后 sync */ }
|
||||
})</code></pre>
|
||||
<p>宿主会生成类型 plugin:<插件id>:<变体id>。</p>
|
||||
<p><strong>必须遵守</strong>:</p>
|
||||
<ol>
|
||||
<li>输出文本/提示词 → data.outKind = 'prompt'(注册默认值、拖入数据、旧节点在 render 里自愈)。</li>
|
||||
<li>拖入画布用指针拖拽,不用原生 HTML5 DnD:</li>
|
||||
</ol>
|
||||
<pre><code>pointerdown → pointermove(>5px) 幽灵卡片
|
||||
→ pointerup → ctx.canvas.screenToWorld(x,y)
|
||||
→ ctx.canvasWrite.createNode('tpl', wx, wy, data)</code></pre>
|
||||
<ol>
|
||||
<li>输入框:未选中时 pointer-events: none,选中后才可编辑;只读 textarea 同样处理。</li>
|
||||
<li>单击 = 选中/拖动,双击 = 编辑;不要用单击打开详情。</li>
|
||||
<li>节点 render 必须可增量 sync,避免整块重建(输入框会丢焦点)。</li>
|
||||
</ol>
|
||||
<h2>5. 数据与文件</h2>
|
||||
<ul>
|
||||
<li>小数据:ctx.promptlib(或 ctx.data)JSON,单文件 < 1MB。</li>
|
||||
<li>大文件(封面/图片):ctx.promptlib.filePut/fileGet/fileList,落地在 plugin-data/<id>/files/。</li>
|
||||
<li>dataUrlToBytes() 返回 { mime, bytes },不是 Uint8Array。</li>
|
||||
<li>备份:提供导出/导入 JSON;导入按 id 合并,提供“覆盖同 id”选项。</li>
|
||||
<li>迁移:旧格式在 setup 里做一次性迁移,失败要提示而不是静默丢数据。</li>
|
||||
</ul>
|
||||
<h2>6. 设置页面</h2>
|
||||
<p>宿主设置页内嵌渲染,不弹独立页面:</p>
|
||||
<pre><code>settings: {
|
||||
panel: { type: 'custom', label: '分组与备份', render: renderSettings }
|
||||
}</code></pre>
|
||||
<p>render 返回 DOM;宿主负责挂载/卸载。设置页适合放:</p>
|
||||
<ul>
|
||||
<li>分组管理(新建/改名/排序/删除)</li>
|
||||
<li>数据备份(导出/导入)</li>
|
||||
<li>数据位置(打开数据目录)</li>
|
||||
<li>插件级开关/默认值</li>
|
||||
</ul>
|
||||
<h2>7. 样式规范</h2>
|
||||
<ol>
|
||||
<li><strong>自包含</strong>:宿主基础样式会变;用到的宿主类按作用域复制一份(.iwb-myplugin …)。</li>
|
||||
<li>统一前缀:面板/节点类名 my-plugin-*,避免与宿主 .iwb-* 冲突。</li>
|
||||
<li>颜色走 CSS 变量:var(--iwb-text)、--iwb-panel、--iwb-border、--iwb-plugin-accent。</li>
|
||||
<li>动画克制:只做 hover/press 反馈;不使用持续浮动动画。</li>
|
||||
<li>深色主题:不写死 #fff/#000;主题契约测试会扫描。</li>
|
||||
<li>悬停放大只缩放内层背景,不缩放卡片本体(避免命中区域漂移/闪烁)。</li>
|
||||
<li>图片/封面 pointer-events: none,点击永远落到卡片。</li>
|
||||
</ol>
|
||||
<h2>8. 错误处理与提示</h2>
|
||||
<ul>
|
||||
<li>所有用户可见错误用 ctx.promptlib.notify / ctx.ui.toast,文案给“下一步怎么办”。</li>
|
||||
<li>异步链必须有 catch;不要吞掉错误后静默。</li>
|
||||
<li>崩溃日志:window.onerror 由宿主统一采集,插件不要自己覆盖。</li>
|
||||
<li>定时器/监听在 unmount/dispose 清理,避免面板切换后重复执行。</li>
|
||||
</ul>
|
||||
<h2>9. 测试与门禁</h2>
|
||||
<p>提交前至少:</p>
|
||||
<pre><code>node scripts/validate-plugins.js # manifest/能力/入口校验
|
||||
node scripts/theme-contract-test.js # 主题变量
|
||||
node tests/plugin-<id>-render-test.js # jsdom 渲染/交互</code></pre>
|
||||
<p>jsdom 可覆盖:面板渲染、节点 render/sync、拖拽插入(stub screenToWorld/createNode)、双击详情、保存回详情、封面 img。</p>
|
||||
<h2>10. 发布与市场</h2>
|
||||
<ol>
|
||||
<li>改 package.json version 与入口 version(两处一致)。</li>
|
||||
<li>node scripts/sync-plugins-from-repo.js(同步到客户端 plugins/)</li>
|
||||
<li>node scripts/gen-market.js(生成 market/ 与 zip)</li>
|
||||
<li>上传 market 到 NAS(tar + scp + 解压)</li>
|
||||
<li>客户端发版:set-version → CHANGELOG → 锚点 → verify:ci → build → publish-update → releases/site → tag/push</li>
|
||||
</ol>
|
||||
<h2>11. 常见坑(务必先读)</h2>
|
||||
<ul>
|
||||
<li>原生 HTML5 拖放:WKWebView 吞 pointerup,节点落地后第一次点击异常 → 用指针拖拽。</li>
|
||||
<li>ctx.canvas 没有 createNode → 用 ctx.canvasWrite。</li>
|
||||
<li>输入框拦截拖动 → 未选中时 pointer-events:none。</li>
|
||||
<li>只读 textarea 仍可选中文本 → pointer-events:none。</li>
|
||||
<li>dataUrlToBytes 返回对象 → 取 .bytes。</li>
|
||||
<li>封面直接存 dataURL 会让 JSON 膨胀 → 迁移到文件,只存 { img }。</li>
|
||||
<li>插件节点不声明 outKind → 只能中继,无法直连生图。</li>
|
||||
</ul>
|
||||
</article></div>
|
||||
</main>
|
||||
<footer><div class="wrap">
|
||||
<div class="cols">
|
||||
<div><div style="color:#fff;font-weight:640;margin-bottom:8px">Image Workbench</div>
|
||||
<div style="font-size:13px;line-height:1.8">本地优先的 AI 生图无限画布。图片、提示词与模型配置全部留在你自己的电脑里。</div></div>
|
||||
<div><h4>产品</h4><a href="/">首页</a><a href="/download/">下载</a><a href="/plugins/">插件市场</a></div>
|
||||
<div><h4>资源</h4><a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码仓库</a><a href="https://git.maqiart.eu.org/malongan/iwb-plugins-desktop" target="_blank" rel="noopener">插件仓库</a><a href="/updates/latest.json" target="_blank" rel="noopener">更新源</a></div>
|
||||
<div><h4>说明</h4><a href="/download/">安装步骤</a><a href="/plugins/">插件安装</a></div>
|
||||
</div>
|
||||
<div class="copy"><span>© 2026 Image Workbench</span><span>数据保存在本地 · 不上传任何图片</span></div>
|
||||
</div></footer>
|
||||
</body></html>
|
||||
@@ -39,6 +39,7 @@
|
||||
<a href="/">首页</a>
|
||||
<a href="/download/" class="on">下载</a>
|
||||
<a href="/plugins/">插件</a>
|
||||
<a href="/dev/">开发</a>
|
||||
<a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码</a>
|
||||
</div>
|
||||
<div class="right">
|
||||
@@ -54,13 +55,13 @@
|
||||
<h2>下载</h2>
|
||||
<div class="row">
|
||||
<div class="name">macOS · Apple Silicon<div class="hint">M1 / M2 / M3 / M4</div></div>
|
||||
<div class="meta">版本 3.26.38 · 8.4 MB · .dmg<div class="hash">sha256 d7cce4643590125a…</div></div>
|
||||
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.26.38_aarch64.dmg?h=d7cce4643590">下载</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.38 · 8.8 MB · .dmg<div class="hash">sha256 d2854862f7371306…</div></div>
|
||||
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.26.38_x64.dmg?h=d2854862f737">下载</a>
|
||||
<div class="meta">版本 3.26.40 · 8.8 MB · .dmg<div class="hash">sha256 6890b428aee6233c…</div></div>
|
||||
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.26.40_x64.dmg?h=6890b428aee6">下载</a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">Windows · x64<div class="hint">需要 WebView2</div></div>
|
||||
@@ -94,6 +95,14 @@
|
||||
</ol>
|
||||
|
||||
<h2>历史版本</h2>
|
||||
<div class="row">
|
||||
<div class="name">3.26.40<div class="hint">Intel 版:同一版本</div></div>
|
||||
<div class="meta">2026-11-23<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.39<div class="hint">v3.26.39:修正插件插入落点与封面插入(拖拽落点按节点宽高居中到鼠标、插入落到画布可视中心、封面先解析为 dataURL 再插入)</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.38<div class="hint">Intel 版:同一版本</div></div>
|
||||
<div class="meta">2026-11-22<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
|
||||
+9
-8
@@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Image Workbench · 本地优先的 AI 生图工作台</title>
|
||||
<meta name="description" content="本地优先的 AI 生图无限画布:节点式工作流、插件按需安装、数据全部留在本机。">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.38-mwrvnu2k">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.40-mws31ebx">
|
||||
</head><body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
|
||||
@@ -10,23 +10,24 @@
|
||||
<a href="/" class="on">首页</a>
|
||||
<a href="/download/">下载</a>
|
||||
<a href="/plugins/">插件</a>
|
||||
<a href="/dev/">开发</a>
|
||||
<a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码</a>
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="btn" href="/plugins/">插件市场</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.38</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.38-mwrvnu2k" alt=""></div>
|
||||
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.26.40-mws31ebx" alt=""></div>
|
||||
<div class="hero-veil"></div>
|
||||
<div class="wrap">
|
||||
<span class="kicker">v3.26.38 · 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.38</a>
|
||||
<a class="btn primary lg" href="/download/">下载 v3.26.40</a>
|
||||
<a class="btn lg" href="/plugins/">浏览 11 个插件</a>
|
||||
</div>
|
||||
<div class="meta">支持 macOS 12+ 与 Windows 10 1803+ · 安装包约 7 MB · 无需登录</div>
|
||||
@@ -82,7 +83,7 @@
|
||||
</div>
|
||||
<div class="pcard" data-name="提示词库 promptlib 右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供) 资源 提示词" data-tags="资源,提示词">
|
||||
<div class="head"><span class="av" style="background:#eef2f6">📖</span>
|
||||
<div><div class="nm">提示词库</div><div class="ver">v1.6.16 · 官方</div></div></div>
|
||||
<div><div class="nm">提示词库</div><div class="ver">v1.8.8 · 官方</div></div></div>
|
||||
<div class="desc">右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供)</div>
|
||||
<div class="tags"><span class="tag">资源</span><span class="tag">提示词</span></div>
|
||||
</div>
|
||||
@@ -93,8 +94,8 @@
|
||||
<section class="section"><div class="wrap">
|
||||
<h2>下载 Image Workbench</h2>
|
||||
<p class="lead">选你的平台。装过一次之后,以后在应用内「设置 → 通用 → 版本与更新」就能一键升级。</p>
|
||||
<div class="dl"><a href="/updates/darwin-aarch64/image-workbench_3.26.38_aarch64.dmg?h=d7cce4643590"><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.38_x64.dmg?h=d2854862f737"><div class="n">macOS · Intel</div><div class="s">x86_64 · 8.8 MB · .dmg</div></a>
|
||||
<div class="dl"><a href="/updates/darwin-aarch64/image-workbench_3.26.40_aarch64.dmg?h=165f48fa6c2d"><div class="n">macOS · Apple Silicon</div><div class="s">M1 / M2 / M3 / M4 · 8.4 MB · .dmg</div></a>
|
||||
<a href="/updates/darwin-x86_64/image-workbench_3.26.40_x64.dmg?h=6890b428aee6"><div class="n">macOS · Intel</div><div class="s">x86_64 · 8.8 MB · .dmg</div></a>
|
||||
<div class="none"><div class="n">Windows · x64</div><div class="s">暂未提供</div></div></div>
|
||||
<div style="margin-top:20px;color:#9ca3af;font-size:12.5px">安装包未做 Apple 公证 / Windows 代码签名,首次打开需手动放行一次,细节见 <a href="/download/" style="text-decoration:underline">下载页</a>。</div>
|
||||
</div></section>
|
||||
|
||||
+11
-11
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": 2,
|
||||
"updatedAt": "2026-11-22T13:31:37.179Z",
|
||||
"updatedAt": "2026-11-22T15:51:05.074Z",
|
||||
"plugins": [
|
||||
{
|
||||
"id": "batch-export",
|
||||
@@ -180,26 +180,26 @@
|
||||
"资源",
|
||||
"提示词"
|
||||
],
|
||||
"version": "1.6.16",
|
||||
"version": "1.8.8",
|
||||
"apiVersion": 1,
|
||||
"bundle": "plugins/promptlib-1.6.16.zip",
|
||||
"bundleSize": 121608,
|
||||
"bundleSha256": "52d34c9bc0c13bf14e36a421719fda4a4366b46d8745b755e9dca6bf029d0190",
|
||||
"bundle": "plugins/promptlib-1.8.8.zip",
|
||||
"bundleSize": 146066,
|
||||
"bundleSha256": "af91d59add3df05c390c6ead566663545acaf1200461185668750422360a2f6f",
|
||||
"files": [
|
||||
{
|
||||
"path": "manifest.json",
|
||||
"sha256": "00c55c3f2be6427f2419d72efbd9e90c73c8604e15195d6f22414b9bd6fad210",
|
||||
"size": 541
|
||||
"sha256": "667ddf6ddedab0ce3abbccbe3dfaa34c56bfa90179369c1c013e736ee5eb15e7",
|
||||
"size": 540
|
||||
},
|
||||
{
|
||||
"path": "main.js",
|
||||
"sha256": "cc303530f758e54a185710e8c47620b7e588693adeb86a421b0833aed114a445",
|
||||
"size": 97256
|
||||
"sha256": "91fde4bcfa888b04ee2b0e79a05d951a56247bc76ecd11b5d9500131df11d542",
|
||||
"size": 106422
|
||||
},
|
||||
{
|
||||
"path": "styles.css",
|
||||
"sha256": "1d3d84220118ed97490314d2aa122126d505c9eabcf1f8bd53a627983e7d5942",
|
||||
"size": 23501
|
||||
"sha256": "82bdae857b0c6e66c0e1c9fa0ea47b269dcbde51cdfacd552e4b919cfa4576c7",
|
||||
"size": 38794
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>插件市场 · Image Workbench</title>
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.38-mwrvnu2k">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.40-mws31ebx">
|
||||
</head><body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
|
||||
@@ -9,11 +9,12 @@
|
||||
<a href="/">首页</a>
|
||||
<a href="/download/">下载</a>
|
||||
<a href="/plugins/" class="on">插件</a>
|
||||
<a href="/dev/">开发</a>
|
||||
<a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码</a>
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="btn" href="/plugins/">插件市场</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.38</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.40</a>
|
||||
</div>
|
||||
</div></nav>
|
||||
<main>
|
||||
@@ -76,7 +77,7 @@
|
||||
</div>
|
||||
<div class="pcard" data-name="提示词库 promptlib 右栏提示词列表:搜索/分组/收藏/新建编辑/插入画布/复制(数据由客户端提供) 资源 提示词" data-tags="资源,提示词">
|
||||
<div class="head"><span class="av" style="background:#eef2f6">📖</span>
|
||||
<div><div class="nm">提示词库</div><div class="ver">v1.6.16 · 官方</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>
|
||||
|
||||
+50
-1
@@ -1,8 +1,57 @@
|
||||
{
|
||||
"app": "Image Workbench",
|
||||
"subtitle": "本地优先的 AI 生图无限画布 · 桌面版(Tauri v2)",
|
||||
"updatedAt": "2026-11-22T13:33:31.676Z",
|
||||
"updatedAt": "2026-11-22T17:00:01.778Z",
|
||||
"releases": [
|
||||
{
|
||||
"version": "3.26.40",
|
||||
"date": "2026-11-23",
|
||||
"notes": "Intel 版:同一版本",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.40_aarch64.dmg",
|
||||
"size": 8790542,
|
||||
"sha256": "165f48fa6c2d874f18020b6b2e99cd3a40e0496ca3714f4d895263553896ae2b",
|
||||
"h": "165f48fa6c2d",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.40_x64.dmg",
|
||||
"size": 9177668,
|
||||
"sha256": "6890b428aee6233c6093c091ea709468abeb0fa4b30abc3744bef45c28943a55",
|
||||
"h": "6890b428aee6",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.39",
|
||||
"date": "2026-11-22",
|
||||
"notes": "v3.26.39:修正插件插入落点与封面插入(拖拽落点按节点宽高居中到鼠标、插入落到画布可视中心、封面先解析为 dataURL 再插入)",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.39_aarch64.dmg",
|
||||
"size": 8789132,
|
||||
"sha256": "15e9c10f31caea3a3d217db2d47e4cc07ed200153795cec462d02634cd35f31c",
|
||||
"h": "15e9c10f31ca",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.39_x64.dmg",
|
||||
"size": 9179272,
|
||||
"sha256": "1016831ad95f21be55b1410c16a8bb51f29fe0799c6bd8980fadf0369424f3ff",
|
||||
"h": "1016831ad95f",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"windows-x86_64": {
|
||||
"file": "updates/windows-x86_64/image-workbench_3.26.39_x64-setup.exe",
|
||||
"size": 5070508,
|
||||
"sha256": "b94166d04e5d53c3d805e6fc226a4725e1d27198d60b7947b90e4ace6a601ac1",
|
||||
"h": "b94166d04e5d",
|
||||
"kind": "exe"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.38",
|
||||
"date": "2026-11-22",
|
||||
|
||||
Generated
+2
-1
@@ -1983,7 +1983,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "image-workbench"
|
||||
version = "3.26.38"
|
||||
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.38"
|
||||
version = "3.26.40"
|
||||
description = "无限画布 · 生图工作台桌面版"
|
||||
authors = ["malongan"]
|
||||
license = ""
|
||||
@@ -44,3 +44,7 @@ base64 = "0.22"
|
||||
# (Cargo.lock 里是同一个 0.6.x),这里显式依赖不会多编译一份。
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
objc2 = "0.6"
|
||||
|
||||
# Windows:直接读进程工作集(GetProcessMemoryInfo),不再启动 PowerShell 子进程
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
windows-sys = { version = "0.52", features = ["Win32_Foundation", "Win32_System_ProcessStatus", "Win32_System_Threading"] }
|
||||
+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.38",
|
||||
"version": "3.26.40",
|
||||
"identifier": "com.malongan.imageworkbench",
|
||||
"build": {
|
||||
"frontendDist": "../dist",
|
||||
|
||||
+11
-1
@@ -349,5 +349,15 @@
|
||||
return { x: Math.round(x), y: Math.round(y) }
|
||||
}
|
||||
|
||||
global.IWBCanvasGeometry = Object.freeze({ connectReasonOf, distToSeg, wantsDefaultSpot, parseWorldTransform, clientToWorld, snapToFreeSpot, placeBeside, pruneMeasured, seedFromTopLeft, clampIntoBounds, lodLowOf, lodModeOf, zoomStep, LOD_NODE_PX, LOD_PLAIN_SCALE, ZOOM_STEP, ZOOM_MIN, ZOOM_MAX, create })
|
||||
// 插件「插入画布」落到可视区域中心(findSpot 会把节点丢左上角,常被左侧面板遮住)。
|
||||
const promptCenterSpot = (bridge, w, h) => {
|
||||
try {
|
||||
const c = typeof document !== 'undefined' ? document.querySelector('.iwb-canvas') : null
|
||||
if (!c || !bridge || typeof bridge.screenToWorld !== 'function') return null
|
||||
const r = c.getBoundingClientRect()
|
||||
const p = bridge.screenToWorld(r.left + r.width / 2, r.top + r.height / 2)
|
||||
return p ? { x: p.x - (w || 0) / 2, y: p.y - (h || 0) / 2 } : null
|
||||
} catch (e) { return null }
|
||||
}
|
||||
global.IWBCanvasGeometry = Object.freeze({ connectReasonOf, distToSeg, wantsDefaultSpot, promptCenterSpot, parseWorldTransform, clientToWorld, snapToFreeSpot, placeBeside, pruneMeasured, seedFromTopLeft, clampIntoBounds, lodLowOf, lodModeOf, zoomStep, LOD_NODE_PX, LOD_PLAIN_SCALE, ZOOM_STEP, ZOOM_MIN, ZOOM_MAX, create })
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
@@ -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 }))
|
||||
|
||||
Reference in new issue
Block a user