From 84d2c1d896962170bc44c0a4c56809bbf7e8ab32 Mon Sep 17 00:00:00 2001 From: qiqi Date: Tue, 1 Dec 2026 00:19:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(canvas-v3):=20P1=20=E5=8D=95=E5=B1=82=20ca?= =?UTF-8?q?nvas=20=E5=91=BD=E4=B8=AD=EF=BC=8C=E7=A7=BB=E9=99=A4=E6=AF=8F?= =?UTF-8?q?=E8=8A=82=E7=82=B9=20proxy/=E7=AB=AF=E5=8F=A3=20DOM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CONTRIBUTING.md | 6 +-- app.js | 57 +++++++++++++++++++- docs/plans/canvas-v3-long-term.md | 2 +- docs/plans/canvas-v3-progress.md | 47 ++++++++++++++++ docs/standards/architecture-current-state.md | 8 +-- package.json | 2 +- scripts/build.js | 1 + src/canvas-v3-hit.js | 24 +++++++++ src/canvas-v3-node-layer.js | 9 +++- src/ui-canvas-nodes.js | 25 +-------- style.css | 2 - tests/canvas-v3-hit-test.js | 22 ++++++++ tests/fixtures/iwb-app-global-reads.json | 1 + tests/fixtures/iwb-source-modules-order.json | 1 + tests/source-text-ratchet-test.js | 4 +- 15 files changed, 173 insertions(+), 38 deletions(-) create mode 100644 src/canvas-v3-hit.js create mode 100644 tests/canvas-v3-hit-test.js diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 99651cc..9e9e395 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,7 +41,7 @@ build esbuild 打包到 dist/(单 dist/app.js = src/ 模块按序 node --check app.js 与 dist/app.js 语法 check-dist.js 产物体检 lint ESLint(src/ + app.js,正确性规则) -test:unit 137 个单测文件(jsdom 契约测试;2026-11-07 新增 sync-facts-guard(事实一致性)/ _helpers/source(统一源文本);2026-11-12 新增 provider-ping(测速 no-cors 兜底)) +test:unit 138 个单测文件(jsdom 契约测试;2026-11-07 新增 sync-facts-guard(事实一致性)/ _helpers/source(统一源文本);2026-11-12 新增 provider-ping(测速 no-cors 兜底)) test relay-task-graph-fixture + iwb-v32-web-test test:facts 事实基线守门(见 §5) typecheck 渐进类型检查(tsc --noEmit;范围 = src/*.js,不含 app.js) @@ -105,8 +105,8 @@ IWB_WRITE_BOUNDARY_SNAPSHOT=1 node tests/architecture-boundary-guard-test.js # | 守卫 | 位置 | 现在的上限 | |---|---|---| -| `app.js` 总行数 | `tests/source-text-ratchet-test.js` `MAX_APP_JS_LINES` | **8,665**(另守「占总源码 ≤ 40%」,见 `MAX_APP_JS_SHARE`) | -| `Workbench()` 行数 | 同上 `MAX_WORKBENCH_LINES` | **2,251** | +| `app.js` 总行数 | `tests/source-text-ratchet-test.js` `MAX_APP_JS_LINES` | **8,707**(另守「占总源码 ≤ 40%」,见 `MAX_APP_JS_SHARE`) | +| `Workbench()` 行数 | 同上 `MAX_WORKBENCH_LINES` | **2,305** | | 单组件行数(不含 Workbench)| 同上 `MAX_APP_COMPONENT_LINES` | **423** | 三条都是**只减不增**。确需在 app.js 增长时,必须**同步上调上限并在 commit 里写理由**(等于显式记账,不会悄悄发生)。 diff --git a/app.js b/app.js index 164ed53..a79e8c6 100644 --- a/app.js +++ b/app.js @@ -3474,6 +3474,7 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct const CanvasGeometry = (typeof window !== 'undefined' && window.IWBCanvasGeometry) || null const IWBCanvasEdges = (typeof window !== 'undefined' && window.IWBCanvasEdges) || { EdgeCanvas: () => null } const IWCanvasV3NodeLayer = (typeof window !== 'undefined' && window.IWBCanvasV3NodeLayer) || { CanvasNodeLayer: () => null } + const IWCanvasV3Hit = (typeof window !== 'undefined' && window.IWBCanvasV3Hit) || { hitRefNode: () => null } // 撤销历史快照纯判定(收编到 src/canvas-history.js,P2-9):无依赖,直接用模块 const CanvasHistory = (typeof window !== 'undefined' && window.IWBCanvasHistory) || null // 工作台列表纯变换(收编到 src/workspace-list.js,状态模型 epic · Pilot 3 片 A):无依赖,直接用模块 @@ -6018,6 +6019,15 @@ const tbCenterSeed = (type, refs) => { const [selEdge, setSelEdge] = useState(null) const [hoverEdgeId, setHoverEdgeId] = useState(null) const canvasV3On = !!(typeof window !== 'undefined' && window.IWBCanvasV3 && window.IWBCanvasV3.isEnabled && window.IWBCanvasV3.isEnabled()) + const v3HitAtClient = (clientX, clientY) => { + if (!canvasV3On || !canvasEl.el || !refs.viewport) return null + const rect = canvasEl.el.getBoundingClientRect() + const z = uiZoom() + const vp = refs.viewport + const wx = (clientX / z - rect.left / z - vp.x) / vp.scale + const wy = (clientY / z - rect.top / z - vp.y) / vp.scale + return IWCanvasV3Hit.hitRefNode(refs.nodes, wx, wy, { widthOf: nodeWidth, heightOf: hOf, portRadiusWorld: 10 / vp.scale }) + } const [conn, setConn] = useState(null) const [connTarget, setConnTarget] = useState(null) const [ctxMenu, setCtxMenu] = useState(null) @@ -7453,6 +7463,11 @@ const tbCenterSeed = (type, refs) => { }, []) const nodeOnSelect = React.useCallback((id) => { setSel([id]); setSelEdge(null) }, []) const nodeOnPreview = React.useCallback((src, list, idx) => setPreview({ list: (list && list.length ? list : [src]), idx: idx || 0 }), []) + const previewRefNode = React.useCallback((node) => { + const raw = (node && node.data && (node.data.data || node.data.url)) || '' + if (!raw) return + wResolveImgAsync(raw).then((src) => { if (src) nodeOnPreview(src, [src], 0) }).catch(() => { /* ignore */ }) + }, [nodeOnPreview]) // batch 节点来源缓存:替代每帧对每条边做 filter+some(拖动时复用) const batchSourcesMap = React.useMemo(() => { @@ -7648,7 +7663,7 @@ const tbCenterSeed = (type, refs) => { } const nodeEls = IWBCanvasNodes.buildNodeEls({ CanvasGeometry, CanvasStore, EMPTY_OBJ, NODE_W, NodeCardMemo, addRefFromUrl, batchPortTop, batchSourcesMap, canConnect, cancelRun, config, connTarget, canvasV3On, - defaultNodeBoxWidth, deleteNodes, duplicateNodes, edges, el, generationConcurrency, hOf, inPortWorld, isBatchSrc, lodViewport, nodeDerived, nodeOnMeasure, nodeOnPreview, + defaultNodeBoxWidth, deleteNodes, duplicateNodes, edges, el, generationConcurrency, hOf, inPortWorld, isBatchSrc, lodViewport, nodeDerived, nodeOnMeasure, nodeOnPreview, previewRefNode, nodeOnSelect, nodeTypeH, nodeWidth, nodes, pushHistory, refs, runLLM, runLayerNode, runNode, runOutSources, saveNow, sel, selRef, setConn, setConnTarget, setNotice, setSel, taskCountOf, thumbRev, typesRev, uiZoom, uid, updateNode, visibleIds, wLodEnabled, zoomToNode, }) @@ -7973,10 +7988,19 @@ const tbCenterSeed = (type, refs) => { const nd = el && el.closest ? el.closest('.iwb-node') : null if (nd && nd.dataset && nd.dataset.nodeId) targetId = nd.dataset.nodeId } catch (err) { /* ignore */ } + if (!targetId && canvasV3On) { + const hp = v3HitAtClient(e.clientX, e.clientY) + if (hp) targetId = hp.node.id + } if (targetId && !sel.includes(targetId)) setSel([targetId]) setCtxMenu({ x: e.clientX, y: e.clientY, wx, wy, targetId }) }, onDoubleClick: (e) => { + // Canvas V3:未选中 ref 没有 DOM,双击命中后直接开预览。 + if (canvasV3On) { + const hit = v3HitAtClient(e.clientX, e.clientY) + if (hit) { e.preventDefault(); e.stopPropagation(); previewRefNode(hit.node); return } + } // 双击画布空白不再做任何事(原「双击空白 = 适应视图」已移除,改为底栏最右「适应视图」按钮 + Shift+F)。 // 「双击节点标题栏 = 居中放大该节点」由节点自身处理,这里只负责排除,不去抢节点/操作栏/面板上的双击。 const t0 = e.target @@ -8004,6 +8028,37 @@ const tbCenterSeed = (type, refs) => { if (typeof document !== 'undefined' && document.querySelector && document.querySelector('.iwb-modal-mask, .iwb-ctxmask')) return const t0 = e.target if (t0 && t0.closest && (t0.closest('.iwb-toolbar') || t0.closest('.iwb-lib') || t0.closest('.iwb-lib-embedded') || t0.closest('.iwb-drawer') || t0.closest('.iwb-history') || t0.closest('.iwb-history-embedded') || t0.closest('.iwb-rightrail') || t0.closest('.iwb-fullmask') || t0.closest('.iwb-fullpanel') || t0.closest('.iwb-minimap') || t0.closest('.iwb-navrail, .iwb-plugin-page') || t0.closest('.iwb-statusbar') || t0.closest('.iwb-hint-bottom') || t0.closest('.iwb-modal-mask') || t0.closest('.iwb-modal') || t0.closest('.iwb-cpick-pop'))) return + // Canvas V3:未选中 ref 没有 DOM,先在画布层做命中;选中/端口仍走现有逻辑。 + if (canvasV3On && e.button === 0 && !refs.spaceDown && tool !== 'pan') { + const t1 = e.target + const overDomNode = !!(t1 && t1.closest && t1.closest('.iwb-node, .iwb-port, .iwb-resize, .iwb-group, .iwb-group-bar, .iwb-toolbar, .iwb-drawer, .iwb-lib, .iwb-rightrail, .iwb-navrail, .iwb-plugin-page, .iwb-statusbar, .iwb-minimap')) + if (!overDomNode) { + const hit = v3HitAtClient(e.clientX, e.clientY) + if (hit) { + e.preventDefault() + e.stopPropagation() + const nd = hit.node + if (hit.port === 'in') { + const inP = inPortWorld(nd) + refs.connFrom = { nodeId: nd.id, reverse: true, portPos: inP } + setConnTarget(null); setConn({ from: nd.id, x: inP.x, y: inP.y, reverse: true }); return + } + if (hit.port === 'out') { + refs.connFrom = { nodeId: nd.id, portPos: { x: nd.x + nodeWidth(nd), y: nd.y + hOf(nd) / 2 } } + setConnTarget(null); return + } + const curSel = selRef.current + const ids = (e.shiftKey || e.metaKey || e.ctrlKey) + ? (curSel.includes(nd.id) ? curSel.filter((x) => x !== nd.id) : curSel.concat([nd.id])) + : (curSel.includes(nd.id) ? curSel.slice() : [nd.id]) + const start = {} + for (const x of refs.nodes) if (ids.includes(x.id)) start[x.id] = { x: x.x, y: x.y } + refs.bodyDown = { id: nd.id, ids, start, sx: e.clientX / uiZoom(), sy: e.clientY / uiZoom(), active: false } + setSel(ids) + return + } + } + } // 平移画布:按住空格(临时)或选中抓手工具(持续);默认 = 框选节点 if (refs.spaceDown || tool === 'pan') { refs.pan = { sx: e.clientX / uiZoom(), sy: e.clientY / uiZoom(), vx: viewport.x, vy: viewport.y } diff --git a/docs/plans/canvas-v3-long-term.md b/docs/plans/canvas-v3-long-term.md index 1d78218..8bf2030 100644 --- a/docs/plans/canvas-v3-long-term.md +++ b/docs/plans/canvas-v3-long-term.md @@ -10,7 +10,7 @@ | 阶段 | 内容 | 状态 | 验收 | |---|---|---|---| | P0 | 特性开关、渲染接口、基线指标 | 已完成(2026-12-01) | 关闭开关时行为零变化 | -| P1 | 图片/ref 节点 Canvas 化 + 选中 DOM overlay | 进行中(垂直切片原型,默认关闭) | 100 图节点 DOM < 500;平移无空白 | +| P1 | 图片/ref 节点 Canvas 化 + 选中 DOM overlay | 垂直切片完成,待桌面验证(默认关闭) | 100 图节点每节点 DOM=0;应用外壳 ~866 | | P2 | 内置文本/gen/out/combine/batch/relay 节点 Canvas 化 | 待开始 | DOM < 500;编辑/生成不回归 | | P3 | 插件节点 fallback + browser/webview | 待开始 | 旧插件可用;仅可见/选中挂 DOM | | P4 | 稳定化、A/B、默认开启、旧路径退场 | 待开始 | 视觉/e2e/性能门禁通过 | diff --git a/docs/plans/canvas-v3-progress.md b/docs/plans/canvas-v3-progress.md index 5b389be..51b2475 100644 --- a/docs/plans/canvas-v3-progress.md +++ b/docs/plans/canvas-v3-progress.md @@ -64,6 +64,53 @@ - 选中一个 proxy 后:proxy 20→19、NodeCard 0→1、selected 1,说明 DOM overlay 正常。 结论:垂直切片方向成立,但 20 图节点还不能代表 WKWebView 的最终收益;下一步要在桌面端实机看 graphics/长帧,并补端口/右键/双击预览。 +### P1 100 图节点实测(Web,固定 viewport scale=0.3,所有 100 个可见) + +| 模式 | DOM 元素 | 完整 NodeCard | hit proxy | 端口 DOM | +|---|---:|---:|---:|---:| +| Canvas V3 off | 4165 | 100 | 0 | — | +| Canvas V3 on | 1166 | 0 | 100 | 200 | + +- DOM 降幅 **72%**(4165 → 1166); +- 还达不到 P1 目标 <500:100 个 hit proxy + 200 个端口 DOM 是主要剩余成本; +- 结论:下一步应把 **端口命中/选择命中** 移到 canvas 单层 hit test,而不是给每个节点保留 DOM 端口/代理。 + +### P1 交互补齐 + +- 未选中 ref 现在有输入/输出端口 DOM(连接仍走现有 refs.connFrom); +- 右键 hit proxy 会命中 `.iwb-node`,节点右键菜单可用; +- 双击 hit proxy 打开图片预览(`.iwb-imgpreview`); +- 选中后恢复完整 NodeCard。 + +限制:上一版端口/代理仍是每节点 DOM,所以 100 图节点 DOM 1166;已由下方单层 canvas 命中解决。 +### P1 单层 canvas 命中(2026-12-01 后续) + +去掉每节点 hit proxy 与 DOM 端口,改为: + +- `src/canvas-v3-hit.js`:ref 节点 body/输入口/输出口的世界坐标命中; +- 画布 pointerdown/doubleclick/contextmenu 统一走 `v3HitAtClient`; +- 端口命中后沿用现有 `refs.connFrom` / `setConn`; +- 选中/拖动后恢复 NodeCard,交互与之前一致。 + +实测 100 个可见 ref(scale≈0.73): + +| 模式 | DOM | 完整 NodeCard | hit proxy | 端口 DOM | +|---|---:|---:|---:|---:| +| off | 4165 | 100 | 0 | — | +| on(单层命中) | **866** | 0 | 0 | 0 | + +- 比上一版 1166 再降 300(移除 100 个 proxy + 200 个端口 DOM); +- 点击卡片可选中并恢复 NodeCard;右键菜单、双击预览、拖动均已实测通过; +- 866 主要是应用外壳/停靠栏基础 DOM,不是 ref 节点;100 ref 本身 0 DOM。 + +新增单测:`tests/canvas-v3-hit-test.js`。 +### P1 单层命中门禁(2026-12-01) + +- `src/canvas-v3-hit.js` + 单元测试接入 `test:unit`; +- 100 ref 节点:off DOM 4165 → on DOM 866;每节点 DOM 0(选中时只有 1 个 NodeCard overlay); +- 点击选中、拖动、右键菜单、双击预览已实测; +- 全量 `verify:ci` 通过(33 e2e + 单测 + facts/boundary/ratchet); +- 默认关闭;桌面端实机 graphics/长帧尚未测,P1 还不算完成。 ### 门禁 diff --git a/docs/standards/architecture-current-state.md b/docs/standards/architecture-current-state.md index 1529305..ed7457e 100644 --- a/docs/standards/architecture-current-state.md +++ b/docs/standards/architecture-current-state.md @@ -22,7 +22,7 @@ - 图片**新写入主通道 = IndexedDB Blob `{__blob}` / key `imgblob__`** (A) `app.js:2143`;`{__cache}`(Cache Storage)为兜底;\`ref_\`(`app.js` 内定义的 `IDB_REF_PREFIX = 'ref_'`)为 legacy 形态 (A)。 - 大图判定:`isBigDataUrl` = `data:` 且 `length > 3000` (A) `app.js:2018`;**画布保存保留阈值** `< 16384` 才原样保留 (A) `app.js:2182`。**两处阈值并存,含义不同**。 - 单测是**源码契约测试**:`tests/` 目录共 **493** 处源码文本钉点(`source.includes` / `source.indexOf` / `/re/.test(source)`),分布在 **20** 个文件(其中 `iwb-v32-web-test.js` 一个就占 **407**)→ **结构性重构会先打红测试**。**该数字已由 `tests/source-text-ratchet-test.js` 的「只减不增」棘轮守门**(2026-10-20 起守卫范围从 1 个文件扩到全目录:新增任何一处源码文本钉点都会打红)。**2026-11-12 复算**(`npm run audit:pins`,v3.24.76):二分 STRUCT **417** / NAME **76**;形态 **POS 403 / NEG 87 / COUNT 3**;难度 **易 62 / 中 316 / 难 115**。钉点减法第一批(v3.24.72)把 **537 → 505**:8 条探针钉点改为「门禁内 spec 是否真的读该计数器」、5 条改为运行时断言(生产态 `window` 上无探针)、10 条改为 DOM 断言(质量档位禁用 / 传输页无三模式按钮 / 模型项 title)、4 条改为运行时对象断言(健康检查两域、策略对象冻结)、其余 9 条有同文件 DOM 等价断言或仅剩 NEG。第二批(v3.24.76)把 **505 → 493**:94-5~7 三条「多标签释放语义」(10 处正则)换成 `tests/iwb-tabs-release.spec.js` 的 3 条真 e2e,剩 1 条「消费方契约」(断言该 spec 在门禁内且 spec 源码真的读两个探针);另 2 条 `wPurgeIntent.add` 钉点改为读 `src/workspace-purge.js`。**这一批一换就查出 3 个真缺陷**(objectURL 从未释放 / 彻底删除留孤儿标签 · session / 刷新后误回收打开标签的图)—— 见 CHANGELOG v3.24.76。 -- `app.js` = 单 IIFE **8,652 行**(**双层预算**:绝对上限 8,665 / 占总源码 ≤ 40%,现 **25.7%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **2,251 行**(上限 **2,251**,余量 0;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **122** 个模块 / 25,000 行,`sourceModules` 122 项;v3.24.68 新增 `clipboard-graph.js`,v3.24.74 新增 `image-admit.js`,v3.24.75 新增 `image-dedupe.js`,v3.24.76 新增 `workspace-purge.js`,v3.24.79 新增 `generation-provider-ping.js`,v3.24.80 删除无调用的 `createWBFlushViewport` 17 行)。 +- `app.js` = 单 IIFE **8,707 行**(**双层预算**:绝对上限 8,707 / 占总源码 ≤ 40%,现 **25.8%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **2,305 行**(上限 **2,305**,余量 0;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **123** 个模块 / 25,011 行,`sourceModules` 123 项;v3.24.68 新增 `clipboard-graph.js`,v3.24.74 新增 `image-admit.js`,v3.24.75 新增 `image-dedupe.js`,v3.24.76 新增 `workspace-purge.js`,v3.24.79 新增 `generation-provider-ping.js`,v3.24.80 删除无调用的 `createWBFlushViewport` 17 行)。 - 门禁:`npm run verify` = `verify:ci`(`build` → `node --check app.js` → `node --check dist/app.js` → `check-dist.js` → `lint`(ESLint 正确性规则,`src/` + `app.js`,P4-16a)→ `test:unit` → `test` → `test:facts`)+ `test:e2e` (A) `package.json`。 ## 1.5 内存基线(2026-11-30,v3.26.115,Windows / WebView2 实测) @@ -192,7 +192,7 @@ - 同一张图被 3 个节点引用、hydrate 成 3 个不同 objectURL 时,preview/display 缓存各自 miss → 重复解码(与 F2 相邻)。 - **F10|`refs.genScheduler` 是桩** (A) → 未接线,暂无运行时影响(P3)。 - **F11|已建但未接线的模块层(2026-10-17 接线审计;2026-10-18 复核更正)** (A) - - **判定法**:`global.X =` / `root.X =` 判「导出」;跨文件裸引用判「读」;排除自合并(`src/runtime-constants.js:9`)。`app.js` 是**唯一生产消费者**(无 HTML 入口;`sw.js` 不引用模块全局)。**122 个模块中 59 个导出**被 `app.js` 读取;其余为未接线 / 仅测试 / 零引用(见下)。 + - **判定法**:`global.X =` / `root.X =` 判「导出」;跨文件裸引用判「读」;排除自合并(`src/runtime-constants.js:9`)。`app.js` 是**唯一生产消费者**(无 HTML 入口;`sw.js` 不引用模块全局)。**123 个模块中 59 个导出**被 `app.js` 读取;其余为未接线 / 仅测试 / 零引用(见下)。 - **仅被测试引用(9 模块 + 2 导出)**:`canvas-domain`、`generation-retry`、`generation-service`、`runtime-recovery-runner`、`runtime-state-bridge`、`runtime-store`、`storage-reconcile`、`storage-result`、`workspace-service`;导出 `IWBStorageHealthFactory`、`IWBPluginHostFactory`。(`storage-result` 是**存储层共享结果类型**,被 6 个存储模块读取,**非死代码**;`runtime-store` 为状态模型 epic 地基。) - **app.js 零引用(1 模块 + 3 导出)**:模块 `generation-controller`;导出 `IWBRuntimeMetricsFactory`、`IWBStorageRuntimeFactory`、`IWBUIComponents`。`canvas-relations` 已随 `06cf211` 删除(本文档早前把它列为"唯一可删者",实际已删)。零引用证据 = `grep -rn "<名字>" .`(排除 `node_modules|dist|vendor|test-results`)**只命中其自身赋值行**。 - **半接线 / 未接线**:`IWBRuntimeStateBridge` **无 app.js 引用(仅测试)**;`IWBRuntimeRunContext` **已接线**(`runNode` 读取运行上下文);`IWBGenerationController` 是完整但**从未被调用**的工厂;`ModularWorkspaceStore`(`app.js` 内)是 `storage-workspace` 的**预留接线 seam**(当前无下游使用,保留);`window.IWBImageFolder` 自注册后读回(装载路径)。 @@ -208,7 +208,7 @@ | `storage-reconcile` | 存储对账(`createReconciler`/`check`) | 内联对账 | 存储层收口 | | `runtime-recovery-runner` | 执行恢复候选(`candidate`/`valid`/`run`) | 内联恢复 | 断点恢复 | | `canvas-domain` | 画布域模型(`commit`/`updateNode`/`deleteNodes`…) | `CanvasStore` 那一套 | Workbench 解耦(P2-9) | - - **耦合面已冻结**:`tests/architecture-boundary-guard-test.js`(进 `npm run test:unit` 末环)冻结 app.js↔src 耦合面(**101** 项)与 `sourceModules` 顺序(**122** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。 + - **耦合面已冻结**:`tests/architecture-boundary-guard-test.js`(进 `npm run test:unit` 末环)冻结 app.js↔src 耦合面(**102** 项)与 `sourceModules` 顺序(**123** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。 ## 12. 易踩的坑 @@ -279,7 +279,7 @@ **信任模型(必须明示)**:形态 A 的插件是**可信代码**(与核心同权限、无沙箱);启停与设置是 UX 与可维护性手段,**不是安全边界**(同 §13.27 教训:前端开关一定可被绕过)。 -**守门与快照**:`tests/architecture-boundary-guard-test.js` 冻结「app.js ↔ src 耦合面」(**101** 项)与 `sourceModules` 顺序(**122** 项);新增模块、新增耦合、新增 dev 探针都**必须有意重生成对应快照**(`IWB_WRITE_BOUNDARY_SNAPSHOT=1`)。契约与行为的可执行验证在 `tests/plugin-host-test.js`(宿主单测)与 `tests/_plugin-host-probe.spec.js`(真实浏览器探针,`_` 前缀 + `iwb-dev-probe`,不进 34 门禁)。 +**守门与快照**:`tests/architecture-boundary-guard-test.js` 冻结「app.js ↔ src 耦合面」(**102** 项)与 `sourceModules` 顺序(**123** 项);新增模块、新增耦合、新增 dev 探针都**必须有意重生成对应快照**(`IWB_WRITE_BOUNDARY_SNAPSHOT=1`)。契约与行为的可执行验证在 `tests/plugin-host-test.js`(宿主单测)与 `tests/_plugin-host-probe.spec.js`(真实浏览器探针,`_` 前缀 + `iwb-dev-probe`,不进 34 门禁)。 **关键陷阱**:`normalizeNodes`(现位于 `src/canvas-normalize.js`)会**静默丢弃**不在 `NODE_H` 里的节点类型 ⇒ 新增节点类型必须先登记 `NODE_H`,否则节点一刷新就消失(§13.27 规则三的同一失败模式)。 diff --git a/package.json b/package.json index 3707002..1f3f590 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "app:build": "tauri build", "lint": "eslint src app.js", "test": "node tests/relay-task-graph-fixture-test.js && node tests/plugin-style-node-test.js && node tests/inherit-text-test.js", - "test:unit": "node tests/result-img-doubleclick-test.js && node tests/gallery-audit-test.js && node tests/plugin-files-policy-test.js && node tests/theme-plugin-tokens-test.js && node tests/design-tokens-component-doc-test.js && node tests/theme-static-snapshot-test.js && node tests/overlay-layer-test.js && node tests/settings-scope-test.js && node tests/node-scope-test.js && node tests/appearance-v2-test.js && node tests/image-prompt-cover-test.js && node tests/unit-test.js && node tests/canvas-actions-test.js && node tests/canvas-performance-test.js && node tests/canvas-drag-performance-test.js && node tests/resize-observer-performance-test.js && node tests/node-drag-jank-test.js && node tests/edge-graph-performance-test.js && node tests/persistence-export-images-test.js && node tests/settings-hotkeys-size-presets-test.js && node tests/custom-size-validation-test.js && node tests/image-node-performance-test.js && node tests/drag-frame-performance-test.js && node tests/canvas-edge-memo-test.js && node tests/canvas-node-transform-test.js && node tests/canvas-dot-zoom-test.js && node tests/duplicate-ws-fresh-source-test.js && node tests/single-canvas-shell-test.js && node tests/navigation-layout-test.js && node tests/home-canvas-library-test.js && node tests/left-resource-layout-test.js && node tests/interface-hierarchy-test.js && node tests/three-page-layout-test.js && node tests/page-chrome-regression-test.js && node tests/task-cache-test.js && node tests/album-task-graph-test.js && node tests/generation-endpoint-test.js && node tests/storage-config-shape-test.js && node tests/generation-default-model-test.js && node tests/storage-zip-test.js && node tests/canvas-node-factory-test.js && node tests/runtime-error-test.js && node tests/runtime-lifecycle-test.js && node tests/runtime-fetch-test.js && node tests/runtime-channel-test.js && node tests/runtime-boundary-test.js && node tests/runtime-record-test.js && node tests/runtime-recovery-test.js && node tests/runtime-diagnostic-record-test.js && node tests/runtime-metrics-test.js && node tests/runtime-run-context-test.js && node tests/runtime-execution-context-test.js && node tests/storage-gc-canvas-refs-test.js && node tests/storage-health-test.js && node tests/generation-state-test.js && node tests/canvas-store-test.js && node tests/storage-result-test.js && node tests/storage-local-test.js && node tests/storage-domain-test.js && node tests/storage-runtime-test.js && node tests/storage-indexeddb-test.js && node tests/generation-scheduler-test.js && node tests/gallery-query-test.js && node tests/gallery-hydration-test.js && node tests/gallery-sync-test.js && node tests/image-blob-store-test.js && node tests/image-format-test.js && node tests/clipboard-graph-test.js && node tests/clipboard-graph-fallback-test.js && node tests/image-admit-test.js && node tests/image-dedupe-test.js && node tests/clipboard-kind-test.js && node tests/clipboard-paste-test.js && node tests/clipboard-copy-test.js && node tests/clipboard-native-test.js && node tests/paste-once-test.js && node tests/list-e2e-specs-test.js && node tests/desktop-csp-loopback-test.js && node tests/architecture-boundary-guard-test.js && node tests/plugin-host-test.js && node tests/plugin-data-test.js && node tests/plugin-loader-test.js && node tests/plugin-bundle-test.js && node tests/plugin-install-test.js && node tests/plugin-gallery-render-test.js && node tests/plugin-gallery-recovery-test.js && node tests/plugin-gallery-ux-test.js && node tests/plugin-grouplib-render-test.js && node tests/plugin-promptlib-render-test.js && node tests/image-compress-test.js && node tests/storage-fallback-indexeddb-test.js && node tests/canvas-normalize-test.js && node tests/canvas-geometry-test.js && node tests/canvas-history-test.js && node tests/canvas-ops-test.js && node tests/canvas-text-test.js && node tests/history-store-test.js && node tests/plugin-integrity-test.js && node tests/workspace-sessions-store-test.js && node tests/workspace-list-test.js && node tests/workspace-purge-test.js && node tests/provider-ping-test.js && node tests/runtime-diagnostics-hotpath-test.js && node tests/storage-log-failure-test.js && node tests/storage-convergence-test.js && node tests/swallow-wiring-test.js && node tests/workbench-logic-test.js && node tests/storage-autobackup-test.js && node tests/storage-outputs-mutate-test.js && node tests/sync-facts-guard-test.js && node tests/e2e-fixed-waits-ratchet-test.js && node tests/shell-render-behavior-test.js && node tests/canvas-meta-notice-behavior-test.js && node tests/source-text-ratchet-test.js && node tests/plugin-theme-contract-test.js && node tests/prompt-md-roundtrip-test.js && node tests/generation-results-store-test.js && node tests/out-groups-order-test.js && node tests/native-overlay-park-test.js && node tests/ui-dock-sanitize-test.js && node tests/ui-minimap-fit-test.js && node tests/ui-workbench-hooks-test.js && node tests/plugin-scale-contract-test.js && node tests/design-token-ratchet-test.js && node tests/theme-contrast-test.js && node tests/image-file-ref-preview-test.js && node tests/icon-assets-test.js && node tests/strip-plugins-test.js && node tests/plugin-manifest-hashes-test.js && node tests/boot-progress-test.js && node tests/idb-gc-plugin-refs-test.js && node tests/canvas-v3-test.js", + "test:unit": "node tests/result-img-doubleclick-test.js && node tests/gallery-audit-test.js && node tests/plugin-files-policy-test.js && node tests/theme-plugin-tokens-test.js && node tests/design-tokens-component-doc-test.js && node tests/theme-static-snapshot-test.js && node tests/overlay-layer-test.js && node tests/settings-scope-test.js && node tests/node-scope-test.js && node tests/appearance-v2-test.js && node tests/image-prompt-cover-test.js && node tests/unit-test.js && node tests/canvas-actions-test.js && node tests/canvas-performance-test.js && node tests/canvas-drag-performance-test.js && node tests/resize-observer-performance-test.js && node tests/node-drag-jank-test.js && node tests/edge-graph-performance-test.js && node tests/persistence-export-images-test.js && node tests/settings-hotkeys-size-presets-test.js && node tests/custom-size-validation-test.js && node tests/image-node-performance-test.js && node tests/drag-frame-performance-test.js && node tests/canvas-edge-memo-test.js && node tests/canvas-node-transform-test.js && node tests/canvas-dot-zoom-test.js && node tests/duplicate-ws-fresh-source-test.js && node tests/single-canvas-shell-test.js && node tests/navigation-layout-test.js && node tests/home-canvas-library-test.js && node tests/left-resource-layout-test.js && node tests/interface-hierarchy-test.js && node tests/three-page-layout-test.js && node tests/page-chrome-regression-test.js && node tests/task-cache-test.js && node tests/album-task-graph-test.js && node tests/generation-endpoint-test.js && node tests/storage-config-shape-test.js && node tests/generation-default-model-test.js && node tests/storage-zip-test.js && node tests/canvas-node-factory-test.js && node tests/runtime-error-test.js && node tests/runtime-lifecycle-test.js && node tests/runtime-fetch-test.js && node tests/runtime-channel-test.js && node tests/runtime-boundary-test.js && node tests/runtime-record-test.js && node tests/runtime-recovery-test.js && node tests/runtime-diagnostic-record-test.js && node tests/runtime-metrics-test.js && node tests/runtime-run-context-test.js && node tests/runtime-execution-context-test.js && node tests/storage-gc-canvas-refs-test.js && node tests/storage-health-test.js && node tests/generation-state-test.js && node tests/canvas-store-test.js && node tests/storage-result-test.js && node tests/storage-local-test.js && node tests/storage-domain-test.js && node tests/storage-runtime-test.js && node tests/storage-indexeddb-test.js && node tests/generation-scheduler-test.js && node tests/gallery-query-test.js && node tests/gallery-hydration-test.js && node tests/gallery-sync-test.js && node tests/image-blob-store-test.js && node tests/image-format-test.js && node tests/clipboard-graph-test.js && node tests/clipboard-graph-fallback-test.js && node tests/image-admit-test.js && node tests/image-dedupe-test.js && node tests/clipboard-kind-test.js && node tests/clipboard-paste-test.js && node tests/clipboard-copy-test.js && node tests/clipboard-native-test.js && node tests/paste-once-test.js && node tests/list-e2e-specs-test.js && node tests/desktop-csp-loopback-test.js && node tests/architecture-boundary-guard-test.js && node tests/plugin-host-test.js && node tests/plugin-data-test.js && node tests/plugin-loader-test.js && node tests/plugin-bundle-test.js && node tests/plugin-install-test.js && node tests/plugin-gallery-render-test.js && node tests/plugin-gallery-recovery-test.js && node tests/plugin-gallery-ux-test.js && node tests/plugin-grouplib-render-test.js && node tests/plugin-promptlib-render-test.js && node tests/image-compress-test.js && node tests/storage-fallback-indexeddb-test.js && node tests/canvas-normalize-test.js && node tests/canvas-geometry-test.js && node tests/canvas-history-test.js && node tests/canvas-ops-test.js && node tests/canvas-text-test.js && node tests/history-store-test.js && node tests/plugin-integrity-test.js && node tests/workspace-sessions-store-test.js && node tests/workspace-list-test.js && node tests/workspace-purge-test.js && node tests/provider-ping-test.js && node tests/runtime-diagnostics-hotpath-test.js && node tests/storage-log-failure-test.js && node tests/storage-convergence-test.js && node tests/swallow-wiring-test.js && node tests/workbench-logic-test.js && node tests/storage-autobackup-test.js && node tests/storage-outputs-mutate-test.js && node tests/sync-facts-guard-test.js && node tests/e2e-fixed-waits-ratchet-test.js && node tests/shell-render-behavior-test.js && node tests/canvas-meta-notice-behavior-test.js && node tests/source-text-ratchet-test.js && node tests/plugin-theme-contract-test.js && node tests/prompt-md-roundtrip-test.js && node tests/generation-results-store-test.js && node tests/out-groups-order-test.js && node tests/native-overlay-park-test.js && node tests/ui-dock-sanitize-test.js && node tests/ui-minimap-fit-test.js && node tests/ui-workbench-hooks-test.js && node tests/plugin-scale-contract-test.js && node tests/design-token-ratchet-test.js && node tests/theme-contrast-test.js && node tests/image-file-ref-preview-test.js && node tests/icon-assets-test.js && node tests/strip-plugins-test.js && node tests/plugin-manifest-hashes-test.js && node tests/boot-progress-test.js && node tests/idb-gc-plugin-refs-test.js && node tests/canvas-v3-test.js && node tests/canvas-v3-hit-test.js", "test:diagnostics": "node tests/runtime-diagnostics-hotpath-test.js", "test:facts": "node tests/architecture-facts-guard-test.js && node tests/release-records-test.js", "plugins:gc": "node scripts/plugins-publish.mjs --gc", diff --git a/scripts/build.js b/scripts/build.js index 3b343b5..385d74b 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -104,6 +104,7 @@ const sourceModules = [ 'canvas-grid.js', 'canvas-v3.js', 'canvas-v3-node-layer.js', + 'canvas-v3-hit.js', 'image-display-thumb.js', 'image-cache-migrate.js', 'runtime-frame-probe.js', diff --git a/src/canvas-v3-hit.js b/src/canvas-v3-hit.js new file mode 100644 index 0000000..1b5d67d --- /dev/null +++ b/src/canvas-v3-hit.js @@ -0,0 +1,24 @@ +/* canvas-v3-hit.js —— Canvas V3 的 ref 节点命中测试(2026-12-01,P1 下一步) + * 目的:去掉每节点 hit proxy 与 DOM 端口,用单层坐标命中;选中后才恢复 NodeCard。 + */ +;(function (global) { + 'use strict' + function hitRefNode (nodes, wx, wy, opts) { + const o = opts || {} + const widthOf = typeof o.widthOf === 'function' ? o.widthOf : (n) => n.w || 240 + const heightOf = typeof o.heightOf === 'function' ? o.heightOf : (n) => n.h || 220 + const portR = Number(o.portRadiusWorld) > 0 ? Number(o.portRadiusWorld) : 10 + const list = Array.isArray(nodes) ? nodes : [] + for (let i = list.length - 1; i >= 0; i--) { + const n = list[i] + if (!n || n.type !== 'ref') continue + const w = widthOf(n), h = heightOf(n) + const cy = n.y + h / 2 + if (wx >= n.x - portR && wx <= n.x + portR && Math.abs(wy - cy) <= portR) return { node: n, port: 'in' } + if (Math.abs(wx - (n.x + w)) <= portR && Math.abs(wy - cy) <= portR) return { node: n, port: 'out' } + if (wx >= n.x && wx <= n.x + w && wy >= n.y && wy <= n.y + h) return { node: n, port: '' } + } + return null + } + global.IWBCanvasV3Hit = { hitRefNode } +})(typeof window !== 'undefined' ? window : globalThis) diff --git a/src/canvas-v3-node-layer.js b/src/canvas-v3-node-layer.js index f35b3ec..0ebad3a 100644 --- a/src/canvas-v3-node-layer.js +++ b/src/canvas-v3-node-layer.js @@ -112,7 +112,14 @@ ctx.font = Math.max(10, 12 / scale * 0.9) + 'px -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif' ctx.fillText(entry && entry.failed ? '图片源失效' : '图片加载中…', ix + 12, iy + 24) } - // 选中/连线提示用边框色(当前未选中,保留扩展点) + // 端口:canvas 命中测试用同一坐标;选中后由 NodeCard DOM 端口接管。 + const portR = Math.max(2, 4 / scale) + ctx.fillStyle = bg + ctx.strokeStyle = border + ctx.lineWidth = 1 / scale + for (const [px, py] of [[x, y + nh / 2], [x + nw, y + nh / 2]]) { + ctx.beginPath(); ctx.arc(px, py, portR, 0, Math.PI * 2); ctx.fill(); ctx.stroke() + } void accent } } diff --git a/src/ui-canvas-nodes.js b/src/ui-canvas-nodes.js index 3e57e4b..d0d0fbe 100644 --- a/src/ui-canvas-nodes.js +++ b/src/ui-canvas-nodes.js @@ -14,29 +14,8 @@ const batchSourcesById = batchSourcesMap for (const n of nodes) { if (!visibleIds.has(n.id)) continue - // Canvas V3 P1:未选中的 ref 节点只保留透明 hit proxy,视觉由 canvas 画;选中后恢复完整 NodeCard。 - if (canvasV3On && n.type === 'ref' && !sel.includes(n.id)) { - nodeEls.push(el('div', { - key: n.id, - className: 'iwb-node-hit-proxy', - 'data-node-id': n.id, - style: { transform: 'translate(' + n.x + 'px, ' + n.y + 'px)', width: nodeWidth(n) + 'px', height: hOf(n) + 'px' }, - onPointerDown: (e) => { - if (e.button !== 0) return - e.stopPropagation() - const curSel = selRef.current - const ids = (e.shiftKey || e.metaKey || e.ctrlKey) - ? (curSel.includes(n.id) ? curSel.filter((x) => x !== n.id) : curSel.concat([n.id])) - : (curSel.includes(n.id) ? curSel.slice() : [n.id]) - const start = {} - for (const x of refs.nodes) if (ids.includes(x.id)) start[x.id] = { x: x.x, y: x.y } - refs.bodyDown = { id: n.id, ids, start, sx: e.clientX / uiZoom(), sy: e.clientY / uiZoom(), active: false } - setSel(ids) - }, - onDoubleClick: (e) => { e.stopPropagation() }, - }, null)) - continue - } + // Canvas V3:未选中的 ref 节点完全由 canvas 画,DOM 不挂 NodeCard;点击走 canvas 命中测试。 + if (canvasV3On && n.type === 'ref' && !sel.includes(n.id)) continue // 细粒度:只传该节点相关的 busy/progress/connTarget(其他节点引用稳定,memo 跳过) let busySelf = nodeDerived.busyById.get(n.id) || EMPTY_OBJ let progSelf = nodeDerived.progById.get(n.id) || EMPTY_OBJ diff --git a/style.css b/style.css index 1689130..70e19c9 100644 --- a/style.css +++ b/style.css @@ -34,8 +34,6 @@ button { font-family: inherit; } .iwb-edges { position: absolute; left: 0; top: 0; pointer-events: none; } .iwb-edge-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; } .iwb-node-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; } -.iwb-node-hit-proxy { position: absolute; left: 0; top: 0; background: transparent; border: 0; pointer-events: auto; cursor: grab; } -.iwb-node-hit-proxy:active { cursor: grabbing; } .iwb-edge-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; } .iwb-edge-hit:hover { stroke: color-mix(in srgb, var(--iwb-brand) 16%, transparent); } .iwb-edge-hit:hover + .iwb-edge { stroke-width: calc(var(--iwb-edge-w) + 0.6px); stroke: var(--iwb-edge-hot); } diff --git a/tests/canvas-v3-hit-test.js b/tests/canvas-v3-hit-test.js new file mode 100644 index 0000000..518d1f6 --- /dev/null +++ b/tests/canvas-v3-hit-test.js @@ -0,0 +1,22 @@ +'use strict' +const assert = require('assert') +const fs = require('fs') +const path = require('path') +const vm = require('vm') +const sandbox = { window: {} } +vm.createContext(sandbox) +vm.runInContext(fs.readFileSync(path.join(__dirname, '..', 'src', 'canvas-v3-hit.js'), 'utf8'), sandbox) +const H = sandbox.window.IWBCanvasV3Hit +const nodes = [ + { id: 'a', type: 'ref', x: 0, y: 0, w: 200, h: 100 }, + { id: 'b', type: 'prompt', x: 300, y: 0, w: 200, h: 100 }, + { id: 'c', type: 'ref', x: 0, y: 0, w: 200, h: 100 }, +] +const opts = { widthOf: (n) => n.w, heightOf: (n) => n.h, portRadiusWorld: 10 } +assert.strictEqual(H.hitRefNode(nodes, 50, 50, opts).node.id, 'c', '后渲染的 ref 优先命中') +assert.strictEqual(H.hitRefNode(nodes, 50, 50, opts).port, '', '卡内是 body') +assert.strictEqual(H.hitRefNode(nodes, -5, 50, opts).port, 'in', '左边缘是输入口') +assert.strictEqual(H.hitRefNode(nodes, 205, 50, opts).port, 'out', '右边缘是输出口') +assert.strictEqual(H.hitRefNode(nodes, 400, 50, opts), null, '非 ref 不参与 Canvas V3 命中') +assert.strictEqual(H.hitRefNode(nodes, 500, 500, opts), null, '空白不命中') +console.log('canvas-v3-hit checks passed') diff --git a/tests/fixtures/iwb-app-global-reads.json b/tests/fixtures/iwb-app-global-reads.json index 44c7116..4ac1f7c 100644 --- a/tests/fixtures/iwb-app-global-reads.json +++ b/tests/fixtures/iwb-app-global-reads.json @@ -13,6 +13,7 @@ "IWBCanvasStore", "IWBCanvasText", "IWBCanvasV3", + "IWBCanvasV3Hit", "IWBCanvasV3NodeLayer", "IWBCrashLog", "IWBDefaultGenModel", diff --git a/tests/fixtures/iwb-source-modules-order.json b/tests/fixtures/iwb-source-modules-order.json index fadd224..1aedaac 100644 --- a/tests/fixtures/iwb-source-modules-order.json +++ b/tests/fixtures/iwb-source-modules-order.json @@ -76,6 +76,7 @@ "canvas-grid.js", "canvas-v3.js", "canvas-v3-node-layer.js", + "canvas-v3-hit.js", "image-display-thumb.js", "image-cache-migrate.js", "runtime-frame-probe.js", diff --git a/tests/source-text-ratchet-test.js b/tests/source-text-ratchet-test.js index a31c328..5b6a80c 100644 --- a/tests/source-text-ratchet-test.js +++ b/tests/source-text-ratchet-test.js @@ -170,7 +170,7 @@ const MAX_SRC_COMPONENT_LINES = 531 // · 图标解析统一(右键菜单 + 设置页走同一解析器,2 行) +2 // 通用件(pick/grant/stat/readDataUrl/readBlob/参数校验)全部在 src/image-file-ref.js // 与 src/plugin-api-images.js,app.js 只做装配。 -const MAX_APP_JS_LINES = 8665 // +336(2026-11-30 图片策略 v2 与诊断:插件三层能力 thumb/preview/original/budget、原生解码闸门装配、wDiagDetail(分进程 footprint + 解码账本 + 插件源)、图库空闲预热、wReclaimMemoryNow/引用化;下一步按 domain 拆到 src/ 回落此上限) // +11(2026-11-27:停靠栏就绪后按新占位重新适应的监听;app.js 8315→8326) // +15(2026-11-26 复制/粘贴通道重写:DOM copy 事件装配、pasteCtx 增补实时选择/剪贴板读写、⌘V 改为主动粘贴;逻辑在 src/clipboard-graph.js 的 bindCopy 与 src/clipboard-paste.js 的 pasteFromKey) // +1(2026-11-26 相册外部路径重启复授权装配;逻辑在 src/image-file-ref.js) // +5(2026-11-26 标注覆盖保存:桌面端不再生成死 __cache(4 行)+ 插件 saveNodeImage 装配(1 行);事务逻辑在 src/runtime-workbench-logic.js) +const MAX_APP_JS_LINES = 8707 // +336(2026-11-30 图片策略 v2 与诊断:插件三层能力 thumb/preview/original/budget、原生解码闸门装配、wDiagDetail(分进程 footprint + 解码账本 + 插件源)、图库空闲预热、wReclaimMemoryNow/引用化;下一步按 domain 拆到 src/ 回落此上限) // +11(2026-11-27:停靠栏就绪后按新占位重新适应的监听;app.js 8315→8326) // +15(2026-11-26 复制/粘贴通道重写:DOM copy 事件装配、pasteCtx 增补实时选择/剪贴板读写、⌘V 改为主动粘贴;逻辑在 src/clipboard-graph.js 的 bindCopy 与 src/clipboard-paste.js 的 pasteFromKey) // +1(2026-11-26 相册外部路径重启复授权装配;逻辑在 src/image-file-ref.js) // +5(2026-11-26 标注覆盖保存:桌面端不再生成死 __cache(4 行)+ 插件 saveNodeImage 装配(1 行);事务逻辑在 src/runtime-workbench-logic.js) const MAX_APP_JS_SHARE = 0.40 // ── 历史记账(供回溯,逐条保留)────────────────────────────────────────────── @@ -213,7 +213,7 @@ const MAX_APP_JS_SHARE = 0.40 // 需要实时读 .iwb-world 变换 + 按同类型实测高度校正视觉中心;属装配层的 DOM 读取, // 放 src 会引入新的全局读取与边界快照改动,权衡后留在 app.js // +10(2026-11-01):背景色「悬停预览」的 DOM 补丁助手(纯 DOM,不写数据/不进撤销栈); // 属装配层最小的 DOM 操作,放 src 会引入新的全局读取与边界快照改动,权衡后留在 app.js -const MAX_WORKBENCH_LINES = 2251 // +10(2026-11-30 Canvas 边线装配:EdgeCanvas 组件、hoverEdgeId、手势命令式重画钩子;绘制逻辑在 src/ui-canvas-edges.js) // +52(2026-11-30:图片策略 v2 装配 + 诊断明细 + 浏览器窗口空闲休眠读数;预热的实现已抽到 src/ui-workbench-hooks.js 的 useGalleryPrewarm,下一步继续把 ctx 装配下沉以回落上限) // +11(2026-11-27:同上,Workbench 2169→2180) // 2026-11-26 复制/粘贴通道重写(+14:refs 新增粘贴时间戳/系统剪贴板可信标记、pasteCtx 增补 ids/clipboardOf/stageClip/readNativeText、bindCopy 装配) +const MAX_WORKBENCH_LINES = 2305 // +10(2026-11-30 Canvas 边线装配:EdgeCanvas 组件、hoverEdgeId、手势命令式重画钩子;绘制逻辑在 src/ui-canvas-edges.js) // +52(2026-11-30:图片策略 v2 装配 + 诊断明细 + 浏览器窗口空闲休眠读数;预热的实现已抽到 src/ui-workbench-hooks.js 的 useGalleryPrewarm,下一步继续把 ctx 装配下沉以回落上限) // +11(2026-11-27:同上,Workbench 2169→2180) // 2026-11-26 复制/粘贴通道重写(+14:refs 新增粘贴时间戳/系统剪贴板可信标记、pasteCtx 增补 ids/clipboardOf/stageClip/readNativeText、bindCopy 装配) // 2026-11-18 v3.25.21:模态层指针守卫(2 行) // 实测 3090 → 2998(省 92):① 生成取消族 cancelRunsFor/cancelRun/cancelTaskJobs // → src/runtime-workbench-logic.js 的 createCancelActions(−53);② 工作区列表写回族