diff --git a/docs/standards/architecture-current-state.md b/docs/standards/architecture-current-state.md index 65d719e..a0ca5d5 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,508 行**(**双层预算**:绝对上限 8,700 / 占总源码 ≤ 40%,现 **36.8%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **2,998 行**(上限 **3,030**,余量 32;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **80** 个模块 / 14,607 行,`sourceModules` 80 项;v3.24.68 新增 `clipboard-graph.js`,v3.24.74 新增 `image-admit.js`,v3.24.75 新增 `image-dedupe.js`,v3.24.76 新增 `workspace-purge.js`,v3.24.79 新增 `generation-provider-ping.js`,v3.24.80 删除无调用的 `createWBFlushViewport` 17 行)。 +- `app.js` = 单 IIFE **8,508 行**(**双层预算**:绝对上限 8,700 / 占总源码 ≤ 40%,现 **36.8%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **2,998 行**(上限 **3,030**,余量 32;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **81** 个模块 / 14,607 行,`sourceModules` 81 项;v3.24.68 新增 `clipboard-graph.js`,v3.24.74 新增 `image-admit.js`,v3.24.75 新增 `image-dedupe.js`,v3.24.76 新增 `workspace-purge.js`,v3.24.79 新增 `generation-provider-ping.js`,v3.24.80 删除无调用的 `createWBFlushViewport` 17 行)。 - 门禁:`npm run verify` = `verify:ci`(`build` → `node --check app.js` → `node --check dist/app.js` → `check-dist.js` → `lint`(ESLint 正确性规则,`src/` + `app.js`,P4-16a)→ `test:unit` → `test` → `test:facts`)+ `test:e2e` (A) `package.json`。 ## 2. 门禁与环境现状 @@ -167,7 +167,7 @@ - 同一张图被 3 个节点引用、hydrate 成 3 个不同 objectURL 时,preview/display 缓存各自 miss → 重复解码(与 F2 相邻)。 - **F10|`refs.genScheduler` 是桩** (A) → 未接线,暂无运行时影响(P3)。 - **F11|已建但未接线的模块层(2026-10-17 接线审计;2026-10-18 复核更正)** (A) - - **判定法**:`global.X =` / `root.X =` 判「导出」;跨文件裸引用判「读」;排除自合并(`src/runtime-constants.js:9`)。`app.js` 是**唯一生产消费者**(无 HTML 入口;`sw.js` 不引用模块全局)。**80 个模块中 59 个导出**被 `app.js` 读取;其余为未接线 / 仅测试 / 零引用(见下)。 + - **判定法**:`global.X =` / `root.X =` 判「导出」;跨文件裸引用判「读」;排除自合并(`src/runtime-constants.js:9`)。`app.js` 是**唯一生产消费者**(无 HTML 入口;`sw.js` 不引用模块全局)。**81 个模块中 59 个导出**被 `app.js` 读取;其余为未接线 / 仅测试 / 零引用(见下)。 - **仅被测试引用(9 模块 + 2 导出)**:`canvas-domain`、`generation-retry`、`generation-service`、`runtime-recovery-runner`、`runtime-state-bridge`、`runtime-store`、`storage-reconcile`、`storage-result`、`workspace-service`;导出 `IWBStorageHealthFactory`、`IWBPluginHostFactory`。(`storage-result` 是**存储层共享结果类型**,被 6 个存储模块读取,**非死代码**;`runtime-store` 为状态模型 epic 地基。) - **app.js 零引用(1 模块 + 3 导出)**:模块 `generation-controller`;导出 `IWBRuntimeMetricsFactory`、`IWBStorageRuntimeFactory`、`IWBUIComponents`。`canvas-relations` 已随 `06cf211` 删除(本文档早前把它列为"唯一可删者",实际已删)。零引用证据 = `grep -rn "<名字>" .`(排除 `node_modules|dist|vendor|test-results`)**只命中其自身赋值行**。 - **半接线 / 未接线**:`IWBRuntimeStateBridge` **无 app.js 引用(仅测试)**;`IWBRuntimeRunContext` **已接线**(`runNode` 读取运行上下文);`IWBGenerationController` 是完整但**从未被调用**的工厂;`ModularWorkspaceStore`(`app.js` 内)是 `storage-workspace` 的**预留接线 seam**(当前无下游使用,保留);`window.IWBImageFolder` 自注册后读回(装载路径)。 @@ -183,7 +183,7 @@ | `storage-reconcile` | 存储对账(`createReconciler`/`check`) | 内联对账 | 存储层收口 | | `runtime-recovery-runner` | 执行恢复候选(`candidate`/`valid`/`run`) | 内联恢复 | 断点恢复 | | `canvas-domain` | 画布域模型(`commit`/`updateNode`/`deleteNodes`…) | `CanvasStore` 那一套 | Workbench 解耦(P2-9) | - - **耦合面已冻结**:`tests/architecture-boundary-guard-test.js`(进 `npm run test:unit` 末环)冻结 app.js↔src 耦合面(**70** 项)与 `sourceModules` 顺序(**80** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。 + - **耦合面已冻结**:`tests/architecture-boundary-guard-test.js`(进 `npm run test:unit` 末环)冻结 app.js↔src 耦合面(**70** 项)与 `sourceModules` 顺序(**81** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。 ## 12. 易踩的坑 @@ -254,7 +254,7 @@ **信任模型(必须明示)**:形态 A 的插件是**可信代码**(与核心同权限、无沙箱);启停与设置是 UX 与可维护性手段,**不是安全边界**(同 §13.27 教训:前端开关一定可被绕过)。 -**守门与快照**:`tests/architecture-boundary-guard-test.js` 冻结「app.js ↔ src 耦合面」(**70** 项)与 `sourceModules` 顺序(**80** 项);新增模块、新增耦合、新增 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 耦合面」(**70** 项)与 `sourceModules` 顺序(**81** 项);新增模块、新增耦合、新增 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/scripts/build.js b/scripts/build.js index 1fc8c1d..844fa9f 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -98,6 +98,7 @@ const sourceModules = [ 'workspace-purge.js', 'generation-provider-ping.js', 'ui-canvas-view.js', + 'ui-confirm.js', 'ui-settings-sections.js', 'ui-settings-tab-diag.js', 'ui-settings-modal.js', diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 0da4d94..cd7e84b 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -6,7 +6,7 @@ "build": { "frontendDist": "../dist", "beforeDevCommand": "npm run build", - "beforeBuildCommand": "npm run build && node scripts/strip-plugins.js" + "beforeBuildCommand": "npm run lint && npm run build && node scripts/strip-plugins.js" }, "app": { "withGlobalTauri": true, diff --git a/src/ui-backup-modal.js b/src/ui-backup-modal.js index 20cd495..bd2a024 100644 --- a/src/ui-backup-modal.js +++ b/src/ui-backup-modal.js @@ -11,6 +11,15 @@ */ ;(function (global) { 'use strict' + + function askConfirm (text, opts) { + const D = (typeof window !== 'undefined') ? window.IWBDesktop : null + const native = !!(D && D.isTauri && D.isTauri()) + const C = (typeof window !== 'undefined') ? window.IWBUIConfirm : null + if (native && C && typeof C.ask === 'function') return C.ask(Object.assign({ text: text }, opts || {})) + return Promise.resolve(window.confirm(text)) + } + // 存储入口收敛(2026-11-06):统一走 IWBStorageLocal 门面,配额/异常集中处理 const _lstore = () => (typeof window !== 'undefined' && window.IWBStorageLocal && typeof window.IWBStorageLocal.getStore === 'function') ? window.IWBStorageLocal.getStore() : null const React = global.React || {} @@ -170,7 +179,7 @@ function BackupModal(props) { const needConfirm = estMB >= 20 || imgMeta.length >= 20 const sizeText = estMB >= 1 ? ('约 ' + estMB.toFixed(0) + ' MB') : '未记录(按张数估算偏大)' if (needConfirm && typeof window !== 'undefined' && typeof window.confirm === 'function') { - const okGo = window.confirm('本次备份包含 ' + imgMeta.length + ' 张图片,预计体积 ' + sizeText + '。\n导出期间浏览器内存占用会明显上升,图库很大时页面会变慢。\n确定继续导出吗?') + const okGo = await askConfirm('本次备份包含 ' + imgMeta.length + ' 张图片,预计体积 ' + sizeText + '。\n导出期间内存占用会明显上升,图库很大时页面会变慢。\n确定继续导出吗?', { title: '导出备份', okText: '继续导出' }) if (!okGo) { setBkMsg({ type: 'err', text: '已取消导出(' + imgMeta.length + ' 张图片 / ' + sizeText + ')' }) return @@ -322,7 +331,7 @@ function BackupModal(props) { const items = restoreData.items const want = Object.keys(restoreSel).filter((k) => restoreSel[k]) if (!want.length) { setRstMsg({ type: 'err', text: '请至少勾选一项要恢复的数据' }); return } - if (!window.confirm((restoreMerge ? '将以「合并」方式导入(追加去重,不覆盖已有):' : '将用备份覆盖当前数据:') + want.map((k) => ({ config: '设置', prompts: '提示词库', nodeGroups: '节点组', workspaces: '画布工作台', outputs: '图库(含缩略图+原图)' })[k]).join('、') + '。确定恢复?')) return + if (!(await askConfirm((restoreMerge ? '将以「合并」方式导入(追加去重,不覆盖已有):' : '将用备份覆盖当前数据:') + want.map((k) => ({ config: '设置', prompts: '提示词库', nodeGroups: '节点组', workspaces: '画布工作台', outputs: '图库(含缩略图+原图)' })[k]).join('、') + '。确定恢复?', { title: '恢复备份', okText: '开始恢复' }))) return setRstBusy(true); setRstMsg(null) try { props.onSaveNow && props.onSaveNow() // 导入前保存当前画布(避免导入后丢失未保存改动) @@ -398,7 +407,7 @@ function BackupModal(props) { for (const m of keepMiss) { const t = (m && (m.label || m.path)) || '密钥'; if (uniqLabel.indexOf(t) === -1) uniqLabel.push(t) } keepWarn = '⚠︎ 有 ' + keepMiss.length + ' 个密钥字段在备份里是「保留本机原值」(__KEEP__),但本机没有对应值,已保持为空:' + uniqLabel.slice(0, 3).join('、') + (uniqLabel.length > 3 ? ' 等 ' + uniqLabel.length + ' 类' : '') + '。请到「服务与 Key 设置」里补填。' wLog('restore', 'KEEP-MISS:' + keepMiss.map((m) => m && m.path).join(', ')) - try { window.confirm(keepWarn + '\n\n点「确定」继续(恢复已完成,随后刷新页面生效)。') } catch (e) { /* ignore */ } + try { await askConfirm(keepWarn + '\n\n点「确定」继续(恢复已完成,随后刷新页面生效)。', { title: '恢复提示', okText: '知道了', cancelText: '关闭' }) } catch (e) { /* ignore */ } } setRstMsg({ type: (imgBad.length || keepWarn) ? 'err' : 'ok', @@ -428,7 +437,7 @@ function BackupModal(props) { ) // 清理本地数据:清空 localStorage(iwb_*) + IndexedDB(iwb_web),不可撤销 const doClear = async () => { - if (!window.confirm('确定清空本机的全部本地数据吗?\n\n将删除:设置、提示词库、节点组、画布工作台、图库索引与本机图片(IndexedDB)。\n此操作不可撤销。\n\n建议先「导出备份」再清理。')) return + if (!(await askConfirm('确定清空本机的全部本地数据吗?\n\n将删除:设置、提示词库、节点组、画布工作台、图库索引与本机图片。\n此操作不可撤销。\n\n建议先「导出备份」再清理。', { title: '清空本地数据', okText: '全部清空' }))) return setClearBusy(true); setClearMsg(null) try { const st = _lstore() diff --git a/src/ui-confirm.js b/src/ui-confirm.js new file mode 100644 index 0000000..b230e11 --- /dev/null +++ b/src/ui-confirm.js @@ -0,0 +1,60 @@ +/* ui-confirm.js —— 页内确认框(桌面端替代 window.confirm) + * + * 为什么需要:Tauri(WKWebView)里 window.confirm 会弹 macOS 原生框并**阻塞 WebView 主线程**, + * 用户点了按钮界面像死机(实测复现)。这里用 DOM 覆盖层实现同样的"确认/取消", + * 用 Promise 返回结果,调用方 await 即可。 + * + * 网页端仍然用 window.confirm(行为零变化)。 + */ +;(function (global) { + 'use strict' + + function ask (opts) { + const o = opts || {} + if (typeof document === 'undefined' || !document.body) return Promise.resolve(false) + return new Promise(function (resolve) { + const overlay = document.createElement('div') + overlay.className = 'iwb-confirm-overlay' + const box = document.createElement('div') + box.className = 'iwb-confirm-box' + const title = document.createElement('div') + title.className = 'iwb-confirm-title' + title.textContent = o.title || '确认' + const text = document.createElement('div') + text.className = 'iwb-confirm-text' + text.textContent = String(o.text || '') + const row = document.createElement('div') + row.className = 'iwb-confirm-actions' + const cancel = document.createElement('button') + cancel.className = 'iwb-btn iwb-btn-sm' + cancel.textContent = o.cancelText || '取消' + const ok = document.createElement('button') + ok.className = 'iwb-btn iwb-btn-sm iwb-btn-primary' + ok.textContent = o.okText || '确定' + let settled = false + function done (value) { + if (settled) return + settled = true + try { overlay.remove() } catch (e) { /* ignore */ } + resolve(value) + } + cancel.addEventListener('click', function () { done(false) }) + ok.addEventListener('click', function () { done(true) }) + overlay.addEventListener('click', function (e) { if (e.target === overlay) done(false) }) + overlay.addEventListener('keydown', function (e) { + if (e.key === 'Escape') done(false) + if (e.key === 'Enter') done(true) + }) + row.appendChild(cancel) + row.appendChild(ok) + box.appendChild(title) + box.appendChild(text) + box.appendChild(row) + overlay.appendChild(box) + document.body.appendChild(overlay) + setTimeout(function () { try { ok.focus() } catch (e) { /* ignore */ } }, 0) + }) + } + + global.IWBUIConfirm = { ask: ask } +})(typeof window !== 'undefined' ? window : globalThis) diff --git a/src/ui-settings-sections.js b/src/ui-settings-sections.js index 3b310e6..b9f7325 100644 --- a/src/ui-settings-sections.js +++ b/src/ui-settings-sections.js @@ -101,6 +101,15 @@ ) } + // 桌面端用页内确认(window.confirm 会阻塞 WKWebView 主线程 ⇒ 界面像死机) + function askConfirm (text, opts) { + const D = (typeof window !== 'undefined') ? window.IWBDesktop : null + const native = !!(D && D.isTauri && D.isTauri()) + const C = (typeof window !== 'undefined') ? window.IWBUIConfirm : null + if (native && C && typeof C.ask === 'function') return C.ask(Object.assign({ text: text }, opts || {})) + return Promise.resolve(window.confirm(text)) + } + // 桌面端插件管理(参考 Obsidian):搜索 + 已安装(开关/设置)+ 可安装(市场) function DesktopPluginsTab (props) { const { PluginHost, pluginItems, setPluginsRev, setTab, wRuntimePlugins } = props @@ -351,7 +360,7 @@ try { const d = await F.pickDir() if (!d || d === dataDir) return - if (!window.confirm('切换资料目录?\n\n当前数据会先保存到当前目录,然后窗口重载并从新目录装载。\n新目录:' + d)) return + if (!(await askConfirm('切换资料目录?\n\n当前数据会先保存到当前目录,然后窗口重载并从新目录装载。\n新目录:' + d, { title: '切换资料目录', okText: '切换' }))) return await F.switchTo(d) setDataDir(d); setNote('已切换,正在重载…') } catch (e) { setNote('切换失败:' + String((e && e.message) || e)) } @@ -364,7 +373,7 @@ try { const d = await F.pickDir() if (!d || d === dataDir) return - if (!window.confirm('把整个数据库复制到:\n' + d + '\n\n复制完成后自动切换并重载;原目录会保留,确认无误后可手动删除。\n(图片较多时会花几十秒)')) return + if (!(await askConfirm('把整个数据库复制到:\n' + d + '\n\n复制完成后自动切换并重载;原目录会保留,确认无误后可手动删除。\n(图片较多时会花几十秒)', { title: '转移数据库', okText: '开始复制' }))) return setNote('正在复制,请稍候…') await F.migrateTo(d) } catch (e) { setNote('转移失败:' + String((e && e.message) || e)) } @@ -386,7 +395,7 @@ const rDry = await F.gcImages({ dryRun: true }) if (!rDry.ok) { setNote('检查失败:' + rDry.error); return } if (!rDry.orphans) { setNote('没有未引用的图片'); return } - if (!window.confirm('发现 ' + rDry.orphans + ' 个文件没有被画布/图库引用。移动到 trash/(不直接删除)?')) return + if (!(await askConfirm('发现 ' + rDry.orphans + ' 个文件没有被画布/图库引用。移动到 trash/(不直接删除)?', { title: '清理未引用图片', okText: '移动' }))) return const rGo = await F.gcImages({ dryRun: false }) setNote(rGo.ok ? ('已移入 trash/:' + rGo.moved + ' 个文件') : ('清理失败:' + rGo.error)) } catch (e) { setNote('清理失败:' + String((e && e.message) || e)) } @@ -551,11 +560,12 @@ el('div', { className: 'iwb-diag-head' }, new Date(row.at).toLocaleString() + ' · ' + row.keyCount + ' 个键 · ' + Math.round((row.bytes || 0) / 1024) + 'KB'), el('button', { className: 'iwb-btn iwb-btn-sm', - onClick: () => { - if (!window.confirm('用这份备份覆盖当前本机数据?\n\n覆盖后会' + (isDesk() ? '自动重载窗口' : '立即刷新页面') + '。当前数据不会保留,建议先「导出备份」。')) return + onClick: async () => { + const okGo = await askConfirm('用这份备份覆盖当前本机数据?\n\n覆盖后会' + (isDesk() ? '自动重载窗口' : '立即刷新页面') + '。当前数据不会保留,建议先「导出备份」。', { title: '还原自动备份', okText: '还原' }) + if (!okGo) return Promise.resolve(props.autoBackupRestore && props.autoBackupRestore(row.name)).then((r) => { if (r && r.ok) location.reload() - else window.alert('还原失败:' + ((r && r.error) || '未知错误')) + else askConfirm('还原失败:' + ((r && r.error) || '未知错误'), { title: '还原失败', okText: '知道了', cancelText: '关闭' }) }) }, }, '还原此份'), diff --git a/style.css b/style.css index bc3ec19..a3014f0 100644 --- a/style.css +++ b/style.css @@ -1959,4 +1959,10 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s .iwb-plugin-main { flex: 1 1 auto; min-width: 0; } .iwb-plugin-title { display: flex; align-items: center; gap: 8px; font-weight: 550; } .iwb-plugin-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; } -.iwb-plugin-desc { color: var(--iwb-text2); font-size: 13px; line-height: 1.5; margin-top: 2px; } \ No newline at end of file +.iwb-plugin-desc { color: var(--iwb-text2); font-size: 13px; line-height: 1.5; margin-top: 2px; } +/* 页内确认框(替代原生 confirm,避免 WKWebView 主线程阻塞) */ +.iwb-confirm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.38); display: flex; align-items: center; justify-content: center; z-index: 9999; } +.iwb-confirm-box { width: min(460px, calc(100vw - 48px)); background: var(--iwb-layer); color: var(--iwb-text); border-radius: 12px; padding: 18px 20px 14px; box-shadow: 0 12px 40px rgba(0,0,0,.28); } +.iwb-confirm-title { font-weight: 650; font-size: 15px; margin-bottom: 8px; } +.iwb-confirm-text { font-size: 13.5px; line-height: 1.65; color: var(--iwb-text2); white-space: pre-wrap; word-break: break-word; } +.iwb-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; } \ No newline at end of file diff --git a/tests/fixtures/iwb-source-modules-order.json b/tests/fixtures/iwb-source-modules-order.json index aaecd2c..fa068a3 100644 --- a/tests/fixtures/iwb-source-modules-order.json +++ b/tests/fixtures/iwb-source-modules-order.json @@ -70,6 +70,7 @@ "workspace-purge.js", "generation-provider-ping.js", "ui-canvas-view.js", + "ui-confirm.js", "ui-settings-sections.js", "ui-settings-tab-diag.js", "ui-settings-modal.js", diff --git a/tests/iwb-v32-web-test.js b/tests/iwb-v32-web-test.js index 64b02bc..d13293b 100644 --- a/tests/iwb-v32-web-test.js +++ b/tests/iwb-v32-web-test.js @@ -2780,7 +2780,8 @@ const nodeXY = (el0) => { && missPaths.some((m) => /口令|Token/.test(m.label || '')) && missPaths.every((m) => typeof m.path === 'string' && m.path && typeof m.label === 'string' && m.label) && /cfgMissingKeep = \(r && r\.missingKeep\) \|\| \[\]/.test(appAllSrc) - && /window\.confirm\(keepWarn/.test(appAllSrc) + // 2026-11-17:keepWarn 提示改走页内确认(askConfirm);桌面端不再用阻塞式 window.confirm + && /askConfirm\(keepWarn/.test(appAllSrc) && /keepWarn \? 3000 : 900/.test(appAllSrc)) // --- 150-13 "设置还原不回来"的**第二个**独立根因:normalizeBackup 白名单式拷贝 items.*, // items.config 从来没被带进 out.items ⇒ 还原界面根本解析不出「设置」, diff --git a/tests/plugin-host-test.js b/tests/plugin-host-test.js index a8a6301..5fa9337 100644 --- a/tests/plugin-host-test.js +++ b/tests/plugin-host-test.js @@ -34,7 +34,8 @@ assert.strictEqual(registry.register(manifest({ id: 'bad-caps', capabilities: [' assert.strictEqual(registry.register(manifest({ id: 'bad-caps2', capabilities: 'panels' }), () => ({})).ok, false, 'capabilities 必须是数组') assert.strictEqual(registry.register(manifest({ id: 'no-factory' }), 'nope').ok, false, '工厂必须是函数') assert.strictEqual(registry.list().length, 1, '被拒绝的注册不得进入注册表') -assert.strictEqual(registry.isEnabled('demo-plugin'), false) +// 2026-11-17:默认启用(插件随市场安装即可用;只有用户显式关掉才写 enabled:false) +assert.strictEqual(registry.isEnabled('demo-plugin'), true) let persisted = { 'demo-plugin': { enabled: true, settings: { theme: 'dark' }, data: {} } } const writes = [] diff --git a/types/iwb-globals.d.ts b/types/iwb-globals.d.ts index 6f2d701..7721398 100644 --- a/types/iwb-globals.d.ts +++ b/types/iwb-globals.d.ts @@ -24,6 +24,7 @@ interface Window { IWBStorageFile?: any __TAURI__?: any __IWB_UPDATE__?: any + IWBUIConfirm?: any IWBDesktop?: any IWBStorageFallbackIndexedDb?: any // 画布 / 工作台