feat(ref): 上传图库移到气泡(图标 ref);移除气泡改名;本地图隐藏 URL 行
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 54s
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 54s
This commit is contained in:
1 parent
87bb2f9c19
commit
719b810091
12 files changed
+78
-57
No files matched your search
+2
-2
@@ -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` | **9,502**(另守「占总源码 ≤ 40%」,见 `MAX_APP_JS_SHARE`) |
|
||||
| `Workbench()` 行数 | 同上 `MAX_WORKBENCH_LINES` | **2,701** |
|
||||
| `app.js` 总行数 | `tests/source-text-ratchet-test.js` `MAX_APP_JS_LINES` | **9,529**(另守「占总源码 ≤ 40%」,见 `MAX_APP_JS_SHARE`) |
|
||||
| `Workbench()` 行数 | 同上 `MAX_WORKBENCH_LINES` | **2,706** |
|
||||
| 单组件行数(不含 Workbench)| 同上 `MAX_APP_COMPONENT_LINES` | **423** |
|
||||
|
||||
三条都是**只减不增**。确需在 app.js 增长时,必须**同步上调上限并在 commit 里写理由**(等于显式记账,不会悄悄发生)。
|
||||
|
||||
@@ -2559,6 +2559,14 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
|
||||
return await wTauri.core.invoke('cancel_fetch', { reqId: String(reqId) })
|
||||
} catch (e) { return false }
|
||||
}
|
||||
// 2026-12-04:参考图「上传到图库」动作(逻辑在 src/ref-upload.js;气泡只负责调)
|
||||
const wRefUpload = (typeof window !== 'undefined' && window.IWBRefUpload) ? window.IWBRefUpload.create({
|
||||
fetchBlob: (u) => wRustFetchBlob(u),
|
||||
fetch: (u, init) => fetch(u, init),
|
||||
blobToDataUrl: (b) => wImgBlobToDataUrl(b),
|
||||
uploadRef: (p, c, n) => uploadRefToImageHost(p, c, n),
|
||||
config: () => wRawCfg(),
|
||||
}) : null
|
||||
async function wIngestWriteFile (file) {
|
||||
try {
|
||||
const F = wStoreMod()
|
||||
@@ -8874,10 +8882,15 @@ const tbCenterSeed = (type, refs) => {
|
||||
// 未编组且与某个分组相连 ⇒「并入分组」(多个相连组时取成员最多的)
|
||||
!groupOf(sn.id) && IWWorkbenchLogic.connectedGroupIdsOf(refs, sn.id).length ? el('button', { 'aria-label': '并入分组', 'data-tip': '并入分组', onClick: (e) => { e.stopPropagation(); joinGroupOf(sn.id) } }, I('group')) : null,
|
||||
sn.type === 'prompt' ? el('button', { 'aria-label': '放大编辑', 'data-tip': '放大编辑', onClick: (e) => { e.stopPropagation(); if (IWNodeBodies && IWNodeBodies.openPromptExpand) IWNodeBodies.openPromptExpand({ value: (sn.data && sn.data.text) || '', onCommit: (v) => updateNode(sn.id, { text: v }) }) } }, I('maximize')) : null,
|
||||
el('button', { 'aria-label': '改名', 'data-tip': '改名', onClick: (e) => { e.stopPropagation(); wRenameNodeDialog(sn, td, updateNode) } }, I('edit')),
|
||||
el('button', { 'aria-label': '复制', 'data-tip': '复制', onClick: (e) => { e.stopPropagation(); duplicateNodes(sel) } }, I('copy')),
|
||||
sn.type === 'ref' ? el('label', { 'aria-label': '替换', 'data-tip': '替换', onPointerDown: (e) => e.stopPropagation() }, I('upload'), el('input', { type: 'file', accept: 'image/*', style: { display: 'none' }, onChange: (e) => { const f = e.target.files && e.target.files[0]; if (!f) return; try { const rd = new FileReader(); rd.onload = () => wImportImage(rd.result, { onError: (msg) => setNotice({ type: 'err', text: msg }) }, (r) => { if (!r || !r.ok || !r.data) return; updateNode(sn.id, { data: r.data, name: f.name, localName: null, url: '' }) }); rd.onerror = () => setNotice({ type: 'err', text: '读取图片文件失败:' + String(f.name || '') }); rd.readAsDataURL(f) } catch (err) { console.error(err) } } }, null)) : null,
|
||||
sn.type === 'ref' ? el('button', { 'aria-label': '粘贴', 'data-tip': '粘贴', onClick: (e) => { e.stopPropagation(); floatbarRefPaste(sn.id) }, onPointerDown: (e) => e.stopPropagation() }, I('paste')) : null,
|
||||
// 2026-12-04:上传到图库移到气泡(逻辑在 src/ref-upload.js);图标 ref(图片+号),与「替换」的 upload 区分。
|
||||
sn.type === 'ref' && sn.data && wRefUpload && (sn.data.data || sn.data.localRef || (typeof sn.data.url === 'string' && sn.data.url)) ? el('button', {
|
||||
'aria-label': '上传到图库', 'data-tip': '上传到图库(转成在线链接)',
|
||||
onPointerDown: (e) => e.stopPropagation(),
|
||||
onClick: (e) => { e.stopPropagation(); wRefUpload.run(sn, { updateNode: updateNode, notice: (t, ty) => setNotice({ type: ty === 'err' ? 'err' : 'ok', text: t }) }) },
|
||||
}, I('ref')) : null,
|
||||
sn.type === 'out' ? (() => { const uout = outResultUrls(sn.id); return el('button', { 'aria-label': '下载', 'data-tip': '下载', disabled: !uout.length, onClick: (e) => { e.stopPropagation(); uout.forEach((u, i) => setTimeout(() => downloadUrl(u, wOutNameOf(u) || ('image-' + String(i + 1).padStart(3, '0') + '.png')), i * 350)) } }, I('download')) })() : null,
|
||||
...pluginNodeActionItems.filter((a) => !a.appliesTo || a.appliesTo({ id: sn.id, type: sn.type, data: sn.data || {} })).map((a) => el('button', {
|
||||
key: 'plug_' + a.id, className: 'iwb-node-floatbar-plugin', title: a.title, 'data-tip': a.title,
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
- 图片**新写入主通道 = IndexedDB Blob `{__blob}` / key `imgblob_<hash>_<len>`** (A) `app.js:2143`;`{__cache}`(Cache Storage)为兜底;\`ref_\`(`app.js` 内定义的 `IDB_REF_PREFIX = 'ref_'`)为 legacy 形态 (A)。
|
||||
- 大图判定:`isBigDataUrl` = `data:` 且 `length > 3000` (A) `app.js:2018`;**画布保存保留阈值** `< 16384` 才原样保留 (A) `app.js:2182`。**两处阈值并存,含义不同**。
|
||||
- 单测是**源码契约测试**:`tests/` 目录共 **493** 处源码文本钉点(`source.includes` / `source.indexOf` / `/re/.test(source)`),分布在 **20** 个文件(其中 `iwb-v32-web-test.js` 一个就占 **407**)→ **结构性重构会先打红测试**。**该数字已由 `tests/source-text-ratchet-test.js` 的「只减不增」棘轮守门**(2026-10-20 起守卫范围从 1 个文件扩到全目录:新增任何一处源码文本钉点都会打红)。**2026-11-12 复算**(`npm run audit:pins`,v3.24.76):二分 STRUCT **417** / NAME **76**;形态 **POS 403 / NEG 87 / COUNT 3**;难度 **易 62 / 中 316 / 难 115**。钉点减法第一批(v3.24.72)把 **537 → 505**:8 条探针钉点改为「门禁内 spec 是否真的读该计数器」、5 条改为运行时断言(生产态 `window` 上无探针)、10 条改为 DOM 断言(质量档位禁用 / 传输页无三模式按钮 / 模型项 title)、4 条改为运行时对象断言(健康检查两域、策略对象冻结)、其余 9 条有同文件 DOM 等价断言或仅剩 NEG。第二批(v3.24.76)把 **505 → 493**:94-5~7 三条「多标签释放语义」(10 处正则)换成 `tests/iwb-tabs-release.spec.js` 的 3 条真 e2e,剩 1 条「消费方契约」(断言该 spec 在门禁内且 spec 源码真的读两个探针);另 2 条 `wPurgeIntent.add` 钉点改为读 `src/workspace-purge.js`。**这一批一换就查出 3 个真缺陷**(objectURL 从未释放 / 彻底删除留孤儿标签 · session / 刷新后误回收打开标签的图)—— 见 CHANGELOG v3.24.76。
|
||||
- `app.js` = 单 IIFE **9,502 行**(**双层预算**:绝对上限 9,502 / 占总源码 ≤ 40%,现 **26.4%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **2,701 行**(上限 **2,701**,余量 0;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **128** 个模块 / 26,518 行,`sourceModules` 128 项;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 **9,515 行**(**双层预算**:绝对上限 9,529 / 占总源码 ≤ 40%,现 **26.4%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **2,706 行**(上限 **2,706**,余量 0;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **129** 个模块 / 26,519 行,`sourceModules` 129 项;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` 不引用模块全局)。**128 个模块中 59 个导出**被 `app.js` 读取;其余为未接线 / 仅测试 / 零引用(见下)。
|
||||
- **判定法**:`global.X =` / `root.X =` 判「导出」;跨文件裸引用判「读」;排除自合并(`src/runtime-constants.js:9`)。`app.js` 是**唯一生产消费者**(无 HTML 入口;`sw.js` 不引用模块全局)。**129 个模块中 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 耦合面(**107** 项)与 `sourceModules` 顺序(**128** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。
|
||||
- **耦合面已冻结**:`tests/architecture-boundary-guard-test.js`(进 `npm run test:unit` 末环)冻结 app.js↔src 耦合面(**108** 项)与 `sourceModules` 顺序(**129** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。
|
||||
|
||||
## 12. 易踩的坑
|
||||
|
||||
@@ -279,7 +279,7 @@
|
||||
|
||||
**信任模型(必须明示)**:形态 A 的插件是**可信代码**(与核心同权限、无沙箱);启停与设置是 UX 与可维护性手段,**不是安全边界**(同 §13.27 教训:前端开关一定可被绕过)。
|
||||
|
||||
**守门与快照**:`tests/architecture-boundary-guard-test.js` 冻结「app.js ↔ src 耦合面」(**107** 项)与 `sourceModules` 顺序(**128** 项);新增模块、新增耦合、新增 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 耦合面」(**108** 项)与 `sourceModules` 顺序(**129** 项);新增模块、新增耦合、新增 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 规则三的同一失败模式)。
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@ const sourceModules = [
|
||||
'storage-outputs.js',
|
||||
'storage-backup.js',
|
||||
'storage-zip.js',
|
||||
'runtime-ref-upload.js',
|
||||
'plugin-promptlib-backup.js',
|
||||
'runtime-constants.js',
|
||||
'canvas-store.js',
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/* ref-upload.js —— 参考图节点「上传到图库」动作(2026-12-04)
|
||||
*
|
||||
* 从 app.js 的节点气泡里抽出:气泡是装配层,逻辑放模块里(app.js 行数棘轮)。
|
||||
* 依赖全部注入:fetchBlob(Rust 优先)/ blobToDataUrl / uploadRef / config / updateNode / notice。
|
||||
*/
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
function create (deps) {
|
||||
const d = deps || {}
|
||||
const uploading = new Set()
|
||||
const run = async (node, opts) => {
|
||||
if (!node || node.type !== 'ref' || uploading.has(node.id)) return false
|
||||
const data = node.data || {}
|
||||
const hasLocal = !!(data.data || data.localRef)
|
||||
const hasUrl = typeof data.url === 'string' && data.url
|
||||
if (!hasLocal && !hasUrl) return false
|
||||
const o = opts || {}
|
||||
uploading.add(node.id)
|
||||
try {
|
||||
let payload = data.data || data.localRef || null
|
||||
if (!payload) {
|
||||
let blob = await d.fetchBlob(data.url)
|
||||
if (!blob || !blob.size) {
|
||||
try { const r = await d.fetch(data.url, { credentials: 'same-origin' }); if (r && r.ok) blob = await r.blob() } catch (e) { /* ignore */ }
|
||||
}
|
||||
if (!blob || !blob.size) throw new Error('图片下载失败')
|
||||
payload = await d.blobToDataUrl(blob)
|
||||
}
|
||||
if (typeof o.notice === 'function') o.notice('正在上传到图库…')
|
||||
const url = await d.uploadRef(payload, d.config(), data.name)
|
||||
if (typeof o.updateNode === 'function') o.updateNode(node.id, { url: url, data: null, localRef: null, localName: null, name: String(url).split('/').pop() || '在线图片' })
|
||||
if (typeof o.notice === 'function') o.notice('已上传到图库并填入链接')
|
||||
return true
|
||||
} catch (e) {
|
||||
if (typeof o.notice === 'function') o.notice('上传失败:' + String((e && e.message) || e), 'err')
|
||||
return false
|
||||
} finally { uploading.delete(node.id) }
|
||||
}
|
||||
return { run: run, isUploading: (id) => uploading.has(id) }
|
||||
}
|
||||
global.IWBRefUpload = { create: create }
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
@@ -35,7 +35,7 @@
|
||||
['拖拽 / 框选', '拖动画布空白 = 框选节点(Shift 追加、Alt 反选);拖动节点 = 移动;Ctrl/Cmd + 点击 = 多选'],
|
||||
['空格 / 鼠标中键', '按住拖动平移画布;抓手工具(H)等效,V 切回选择'],
|
||||
['滚轮', '缩放画布;节点右下角可拖拽改尺寸'],
|
||||
['双击节点标题', '居中放大该节点;重命名走气泡铅笔 / 右键菜单 / F2'],
|
||||
['双击节点标题', '双击标题文字改名;双击标题栏其它处居中放大;也可右键菜单或 F2'],
|
||||
['右键', '自定义菜单:添加节点 / 复制选中 / 导出节点组 / 收藏 / 删除 / 该节点操作'],
|
||||
['连线', '从出端口拖到目标区域自动连接(绿框可连、红框不可连);点选连线 Delete 断开,双击直接断开'],
|
||||
['Alt + 拖到连线', '插入:节点吸附到连线中间并拆成两条;链中间单入单出的节点 Alt 拖出 = 脱离'],
|
||||
|
||||
+3
-45
@@ -756,58 +756,16 @@
|
||||
el('span', { className: 'iwb-ref-broken-t' }, '图片源已失效'),
|
||||
el('span', { className: 'iwb-ref-broken-s' }, '双击重新导入'),
|
||||
),
|
||||
(typeof d.url === 'string' && d.url) ? el('div', { className: 'iwb-ref-url-current', title: d.url }, 'URL 图片') : null,
|
||||
)
|
||||
: el('div', { className: 'iwb-ref-emptybox', title: '单击选中 · 双击上传图片', onDoubleClick: (e) => { e.stopPropagation(); if (refFileInput) refFileInput.click() } },
|
||||
el('span', { className: 'iwb-ref-upload' }, '点击上传参考图'),
|
||||
fileInput,
|
||||
),
|
||||
el('div', { className: 'iwb-ref-url-row' },
|
||||
// 「上传到图库」:本地图片直接上传;只有 URL 的节点先取字节再上传(2026-11-01 用户要求常驻)
|
||||
(d.data || (typeof d.url === 'string' && d.url)) ? el('button', {
|
||||
className: 'iwb-btn iwb-btn-sm iwb-ref-upload-link',
|
||||
disabled: props.uploadingRefId === node.id,
|
||||
title: props.uploadingRefId === node.id ? '正在上传…' : '上传到图库:把这张图传到图库并填入链接',
|
||||
'aria-label': '上传到图库',
|
||||
onClick: async (e) => {
|
||||
stop(e)
|
||||
if (props.uploadingRefId === node.id) return
|
||||
props.setUploadingRefId && props.setUploadingRefId(node.id)
|
||||
try {
|
||||
let payload = d.data
|
||||
// 只有 URL 时:先取回字节。2026-12-04(审计 P1):优先 Rust(不受 CORS/白名单限制),
|
||||
// 失败再回退 WebView fetch(同源/允许跨域才成功)。
|
||||
if (!payload) {
|
||||
let blob = (typeof wRustFetchBlob === 'function') ? await wRustFetchBlob(d.url) : null
|
||||
if (!blob || !blob.size) {
|
||||
const res = await fetch(d.url, { credentials: 'same-origin' })
|
||||
if (!res || !res.ok) throw new Error('图片下载失败(HTTP ' + (res && res.status) + ')')
|
||||
blob = await res.blob()
|
||||
}
|
||||
payload = await new Promise((done, fail) => {
|
||||
const fr = new FileReader()
|
||||
fr.onload = () => done(String(fr.result || ''))
|
||||
fr.onerror = () => fail(new Error('读取图片失败'))
|
||||
fr.readAsDataURL(blob)
|
||||
})
|
||||
}
|
||||
const url = await uploadRefToImageHost(payload, wRawCfg(), d.name)
|
||||
onUpdate(node.id, { url, data: null, localName: null, name: url.split('/').pop() || '在线图片' })
|
||||
props.onNotice && props.onNotice('已上传到图库并填入链接')
|
||||
} catch (err) {
|
||||
props.onNotice && props.onNotice('上传失败:' + String((err && err.message) || err))
|
||||
} finally {
|
||||
props.setUploadingRefId && props.setUploadingRefId(null)
|
||||
}
|
||||
},
|
||||
onPointerDown: stop,
|
||||
}, el('svg', { viewBox: '0 0 24 24', width: 15, height: 15, 'aria-hidden': 'true' },
|
||||
el('path', { d: 'M12 16V4m0 0L8 8m4-4 4 4M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2', fill: 'none', stroke: 'currentColor', 'stroke-width': 1.8, 'stroke-linecap': 'round', 'stroke-linejoin': 'round' }),
|
||||
)) : null,
|
||||
// 使用链接改为**按回车**(原来右侧还有一个 ✎ 按钮,用户要求去掉)
|
||||
// 2026-12-04:本地图默认隐藏这一行(hover/选中才显示);空节点与网络图常驻。
|
||||
// 「上传到图库」已移到选中气泡,行内不再放按钮。
|
||||
el('div', { className: 'iwb-ref-url-row' + ((d.data || d.localRef || d.localName) ? ' iwb-ref-url-row-subtle' : '') },
|
||||
el('input', { className: 'iwb-input iwb-ref-url-input', defaultValue: (typeof d.url === 'string' && !d.data) ? d.url : '', placeholder: '输入图片 URL(回车使用)', onKeyDown: (e) => { if (e.key === 'Enter') commitRefUrl(e) }, onPointerDown: stop }),
|
||||
),
|
||||
|
||||
el('div', { className: 'iwb-ref-foot' }, null),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -352,7 +352,8 @@ body .iwb-history-embedded .iwb-history-actions .iwb-gal-dl:hover { background:
|
||||
.iwb-ref-url-row .iwb-ref-upload-link { background: var(--iwb-field); border-color: var(--iwb-border); color: var(--iwb-text2); }
|
||||
.iwb-ref-upload-link:hover { background: color-mix(in srgb, var(--iwb-brand) 10%, var(--iwb-field)); border-color: var(--iwb-border2); color: var(--iwb-text); }
|
||||
.iwb-ref-url-input { min-width: 0; flex: 1 1 auto; font-size: var(--iwb-font-xs); }
|
||||
.iwb-ref-url-current { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--iwb-text2); font-size: var(--iwb-font-2xs); }
|
||||
/* 2026-12-04:本地图片默认隐藏 URL 行(hover 或选中才出现);空节点/网络图常驻 */
|
||||
.iwb-node:not(:hover):not(.iwb-node-selected) .iwb-ref-url-row-subtle { display: none; }
|
||||
.iwb-ref-show { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; }
|
||||
/* v3.26.111:图片源失效的明确占位(破图图标会被误认为渲染 bug) */
|
||||
.iwb-ref-broken { display: none; flex-direction: column; align-items: center; justify-content: center; gap: var(--iwb-space-4); width: 100%; min-height: 120px; border: 1px dashed var(--iwb-border); border-radius: var(--iwb-radius-chip); background: var(--iwb-field); color: var(--iwb-text2); }
|
||||
|
||||
+1
@@ -54,6 +54,7 @@
|
||||
"IWBPluginQueue",
|
||||
"IWBPromptCover",
|
||||
"IWBProviderPing",
|
||||
"IWBRefUpload",
|
||||
"IWBResultImg",
|
||||
"IWBRuntimeBoundary",
|
||||
"IWBRuntimeChannel",
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
"storage-outputs.js",
|
||||
"storage-backup.js",
|
||||
"storage-zip.js",
|
||||
"runtime-ref-upload.js",
|
||||
"plugin-promptlib-backup.js",
|
||||
"runtime-constants.js",
|
||||
"canvas-store.js",
|
||||
|
||||
@@ -33,6 +33,10 @@ ok(/not-local/.test(qBlock), '任务队列预览在本地无图时给出「未
|
||||
ok(!/wTauri\.http\.fetch/.test(app), '图片取字节不再走 http 插件(受域名白名单限制),统一用 fetch_image_b64')
|
||||
ok(/mime0\.indexOf\('image\/'\) !== 0/.test(app), 'wRustFetchBlob 校验 Content-Type(拒绝把 HTML 错误页当图片)')
|
||||
ok(read('src/image-display-thumb.js').indexOf('^https?:') >= 0 && read('src/image-display-thumb.js').indexOf('fetchBlob') >= 0, '显示缩略图只对远程地址走 Rust(data:/blob: 不浪费 IPC)')
|
||||
ok(/上传到图库(转成在线链接)/.test(app) && /IWBRefUpload/.test(app), 'ref 气泡提供「上传到图库」')
|
||||
ok(!/'aria-label': '改名'/.test(app), '气泡不再显示改名按钮(F2/双击标题/右键仍可改名)')
|
||||
ok(/iwb-ref-url-row-subtle/.test(read('style.css')), '本地图片默认隐藏 URL 行(hover/选中才显示)')
|
||||
ok(/runtime-ref-upload\.js/.test(read('scripts/build.js')), 'ref-upload 模块已进构建清单')
|
||||
ok(/async function wRustFetchBlob \(url\)/.test(app), '宿主提供统一 Rust 取字节入口 wRustFetchBlob')
|
||||
ok(/wRustFetchBlob\(fkEarly\)/.test(app) && /wRustFetchBlob\(su\)/.test(app), 'storeOutputThumb / downloadUrl 走系统网络栈兜底')
|
||||
ok(/desktopFetch: async \(u\) => \{ const b = await wRustFetchBlob/.test(app), 'gallery-sync desktopFetch 走 Rust(不再用白名单 http.fetch)')
|
||||
|
||||
@@ -130,7 +130,7 @@ const MAX_SRC_COMPONENT_LINES = 531 // 2026-12-02 纳入记账基线(此前
|
||||
// −1(122→121)2026-12-02:插件画布桥新增 IWBPluginCanvasBridge(+1),同时删掉两个从未被引用的工厂导出
|
||||
// IWBStorageRuntimeFactory / IWBRuntimeMetricsFactory(−2,实例导出 IWBStorageRuntime / IWBRuntimeMetrics 仍在用)。
|
||||
// 新增模块请先看能不能挂到已有命名空间;确需新增则同批下调基线。
|
||||
const MAX_SRC_GLOBALS = 124 // 2026-12-03 +1(123→124):新增 IWBPluginQueue(任务队列能力桥,与 gallery 同构)。之后只减不增。
|
||||
const MAX_SRC_GLOBALS = 125 // 2026-12-04 +1(124→125):新增 IWBRefUpload(参考图上传到图库动作,从 app.js 气泡抽出)。2026-12-03 +1:IWBPluginQueue。之后只减不增。
|
||||
// ── app.js 总行数 & Workbench 行数棘轮(只减不增)────────────────────────────
|
||||
// 动机(2026-10-29 用户提问"以后新功能会不会还往 app.js 里加"):
|
||||
// 上面的 MAX_APP_COMPONENT_LINES **明确跳过 Workbench**,而且此前**没有** app.js 总行数守卫
|
||||
@@ -175,7 +175,7 @@ const MAX_SRC_GLOBALS = 124 // 2026-12-03 +1(123→124):新增 IWBPlugin
|
||||
// · 图标解析统一(右键菜单 + 设置页走同一解析器,2 行) +2
|
||||
// 通用件(pick/grant/stat/readDataUrl/readBlob/参数校验)全部在 src/image-file-ref.js
|
||||
// 与 src/plugin-api-images.js,app.js 只做装配。
|
||||
const MAX_APP_JS_LINES = 9502 // +49(9,453→9,502)2026-12-04:文件版下载加固 —— reqId 透传 + cancel_fetch 取消 + 一次性 base64 回退接线。之前 +42 文件版接线/预热;+36 文件版;+6 缓存闭包;+4 mime;+56 原生审计;+19 缩略图兜底;+11 预览;+3 并发;+9 命名;+199 队列装配。之后只减不增。
|
||||
const MAX_APP_JS_LINES = 9529 // +76(9,453→9,529)2026-12-04:ref 气泡「上传到图库」(含守卫 Set)+ 移除气泡改名。之前 +49 文件版加固;+42 文件版;+36 文件版;+6 缓存闭包;+4 mime;+56 原生审计;+19 缩略图兜底;+11 预览;+3 并发;+9 命名;+199 队列装配。之后只减不增。
|
||||
const MAX_APP_JS_SHARE = 0.40
|
||||
|
||||
// ── 历史记账(供回溯,逐条保留)──────────────────────────────────────────────
|
||||
@@ -218,7 +218,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 = 2701 // +5(2,696→2,701)2026-12-04:文件版下载接线(useFile/fetchFile/writeFileRef/cancelFile 四个依赖)。之前 +4 文件版;+6 缓存闭包;+3 系统网络栈/并发;+1 队列预览;+153 任务队列装配。之后只减不增。
|
||||
const MAX_WORKBENCH_LINES = 2706 // +10(2,696→2,706)2026-12-04:ref 气泡上传按钮(调用 src/ref-upload)+ 移除气泡改名。之前 +5 文件版接线;+4 文件版;+6 缓存闭包;+3 网络栈/并发;+1 队列预览;+153 队列装配。之后只减不增。
|
||||
// 2026-11-18 v3.25.21:模态层指针守卫(2 行)
|
||||
// 实测 3090 → 2998(省 92):① 生成取消族 cancelRunsFor/cancelRun/cancelTaskJobs
|
||||
// → src/runtime-workbench-logic.js 的 createCancelActions(−53);② 工作区列表写回族
|
||||
|
||||
Reference in new issue
Block a user