perf: v3.26.152 简化卡片 hover 效果 + 可见空闲回收

This commit is contained in:
qiqi committed 2026-12-01 01:51:10 +08:00
1 parent 359ad97329
commit 9ef5218856
12 files changed
+43 -29

No files matched your search

+6
View File
@@ -16,6 +16,12 @@
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
## v3.26.152(2026-12-01)内存优化:简化卡片效果 + 可见空闲回收
- 图库卡片去掉 hover 放大/投影,只保留描边反馈;相册 cell 同样去掉 hover scale/双层阴影。
- 提示词库卡片移除 `.iwb-plp-bg` 的常驻 `will-change: transform`,并去掉 hover 阴影/放大;减少每卡片合成层。
- 自动回收折中:应用不可见时回收;可见但连续 5 分钟无输入时做轻量回收(保留显示缩略图)。
- 插件版本:gallery 1.9.9 / promptlib 1.14.11 / album 1.2.5。
## v3.26.151(2026-12-01)修复节点/浮层盖住顶部 tab 栏
- `.iwb-world` 增加 `z-index: 1` 形成画布内部 stacking context;
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "image-workbench-web",
"private": true,
"version": "3.26.151",
"version": "3.26.152",
"description": "Browser-based node canvas image workbench",
"scripts": {
"build": "node scripts/build.js && node scripts/copy-plugins.js",
+2 -2
View File
@@ -1,7 +1,7 @@
{
"id": "album",
"name": "相册",
"version": "1.2.4",
"version": "1.2.5",
"apiVersion": 1,
"main": "main.js",
"style": "styles.css",
@@ -15,6 +15,6 @@
],
"files": {
"main.js": "79ac746f0065103a32b083e2d79f16fb09fcf9032709952ba256887db1bedb4a",
"styles.css": "40623c831620d0082dde956300461b29b9256aab98da86c7ab5e3495214f8d49"
"styles.css": "63f70828151481ee96fd102e3c18baecbf51999d8fd96044aabbefdd5c2d2225"
}
}
+2 -2
View File
@@ -29,12 +29,12 @@
竖图撑到 167px,和 capacityOf() 按方形算的容量是两套账(最后一行常被裁一半)。
aspect-ratio 让每一格高 = 宽,容量因此可精确预测,宫格也终于整齐。
padding:0 必须显式写:<button> 的 UA 默认内边距会把图顶出边框。 */
.iwb-album-cell { position: relative; aspect-ratio: 1 / 1; padding: 0; border-radius: var(--iwb-radius-chip); overflow: hidden; background: color-mix(in srgb, var(--iwb-border) 55%, transparent); border: 1px solid var(--iwb-border); cursor: grab; transition: transform var(--iwb-motion-hover, .15s) var(--iwb-ease-hover, ease-out), box-shadow var(--iwb-motion-hover, .15s) var(--iwb-ease-hover, ease-out); }
.iwb-album-cell { position: relative; aspect-ratio: 1 / 1; padding: 0; border-radius: var(--iwb-radius-chip); overflow: hidden; background: color-mix(in srgb, var(--iwb-border) 55%, transparent); border: 1px solid var(--iwb-border); cursor: grab; transition: border-color var(--iwb-motion-hover, .15s) var(--iwb-ease-hover, ease-out); }
/* 1.1.4(用户:1.06 太不明显):放大到 1.08 + 更深的投影 + 2px 品牌描边。
网格内**不做位移**(translateY 会让相邻格的 hover 判定抖动);描边用 outline 而不是加粗 border,
避免图片内容被 1px 的 border 变化挤动。z-index 走宿主层级 token(插件禁止裸值),
且被 .iwb-album-grid 的 overflow:hidden 限制在节点内。 */
.iwb-album-cell:hover { transform: scale(1.08); outline: 2px solid var(--iwb-hover-border, var(--iwb-brand)); outline-offset: -2px; box-shadow: 0 10px 26px rgba(0, 0, 0, .42), 0 2px 6px rgba(0, 0, 0, .28); z-index: var(--iwb-z-ctx, 90); }
.iwb-album-cell:hover { outline: 2px solid var(--iwb-hover-border, var(--iwb-brand)); outline-offset: -2px; border-color: var(--iwb-hover-border, var(--iwb-brand)); z-index: var(--iwb-z-ctx, 90); }
@media (prefers-reduced-motion: reduce) { .iwb-album-cell { transition: none; } .iwb-album-cell:hover { transform: none; } }
.iwb-album-cell img { width: 100%; height: 100%; object-fit: cover; display: block; -webkit-user-drag: none; }
/* v1.2.0:来源徽标 + 文件夹模式说明/路径 */
+2 -2
View File
@@ -1,7 +1,7 @@
{
"id": "gallery",
"name": "图库",
"version": "1.9.8",
"version": "1.9.9",
"apiVersion": 1,
"main": "main.js",
"style": "styles.css",
@@ -14,6 +14,6 @@
],
"files": {
"main.js": "8586409417599dec4b0f229e88eaf937f991f1942db49df97ce9a27e16a35d9f",
"styles.css": "c7db0f9d78b98c1b5bb9782c45dfc2274673c1c7d34fdf676aae41680866eb3d"
"styles.css": "07ca657d2e5f5d9406e6c7f7306906e34f2ee10a2fa4c2165358451f5461c6a4"
}
}
+2 -5
View File
@@ -69,16 +69,13 @@
.iwb-history-embedded .iwb-history-item img {
width: 100%; height: auto; display: block; object-fit: contain; margin: 0 auto;
border-radius: 6px; border: 1px solid var(--iwb-border); background: var(--iwb-layer2); cursor: pointer;
transition: transform var(--iwb-motion-hover, .15s) var(--iwb-ease-hover, ease-out),
border-color var(--iwb-motion-hover, .15s) var(--iwb-ease-hover, ease-out),
box-shadow var(--iwb-motion-hover, .15s) var(--iwb-ease-hover, ease-out);
/* 2026-12-01:卡片不再做 hover 放大/投影;只保留描边反馈,减少悬停时的合成/raster 成本。 */
transition: border-color var(--iwb-motion-hover, .15s) var(--iwb-ease-hover, ease-out);
}
/* v1.7.3:卡片悬停上浮 + 阴影 + 品牌描边(与输出节点共用宿主 L2 token)。
用 item:hover 而不是 img:hover:指针移到下载浮层按钮上时卡片仍保持浮起,不抖。 */
.iwb-history-embedded .iwb-history-item:hover img {
transform: translateY(var(--iwb-hover-lift, -2px)) scale(var(--iwb-hover-scale, 1.02));
border-color: var(--iwb-hover-border, var(--iwb-brand));
box-shadow: var(--iwb-hover-shadow, 0 5px 16px rgba(0, 0, 0, .22));
}
/* v1.9.4:卡片按宽高比占位后,占位层要铺满卡片 —— 否则缩略图出现时仍会有一次高度跳变(滚动时表现为闪动) */
.iwb-history-embedded .iwb-history-item .iwb-history-missing { position: absolute; inset: 0; min-height: 0; }
+6 -6
View File
@@ -4,10 +4,10 @@
"dir": "album",
"main": "main.js",
"style": "styles.css",
"version": "1.2.4",
"version": "1.2.5",
"files": {
"main.js": "79ac746f0065103a32b083e2d79f16fb09fcf9032709952ba256887db1bedb4a",
"styles.css": "40623c831620d0082dde956300461b29b9256aab98da86c7ab5e3495214f8d49"
"styles.css": "63f70828151481ee96fd102e3c18baecbf51999d8fd96044aabbefdd5c2d2225"
}
},
{
@@ -33,10 +33,10 @@
"dir": "gallery",
"main": "main.js",
"style": "styles.css",
"version": "1.9.8",
"version": "1.9.9",
"files": {
"main.js": "8586409417599dec4b0f229e88eaf937f991f1942db49df97ce9a27e16a35d9f",
"styles.css": "c7db0f9d78b98c1b5bb9782c45dfc2274673c1c7d34fdf676aae41680866eb3d"
"styles.css": "07ca657d2e5f5d9406e6c7f7306906e34f2ee10a2fa4c2165358451f5461c6a4"
}
},
{
@@ -55,10 +55,10 @@
"dir": "promptlib",
"main": "main.js",
"style": "styles.css",
"version": "1.14.10",
"version": "1.14.11",
"files": {
"main.js": "a05ce22ad8ab2e079e313dd31d8fe34f2e2e07e017bfb782afcd08047e0b485b",
"styles.css": "86f73b4d1c7b827f97ec1135c9130c7da6898537b2ed2ab815e282618232f56b"
"styles.css": "182783b15335895b5a40822bf137a7b4872ca0c6ee72434bfa61a97b37453a07"
}
},
{
+2 -2
View File
@@ -1,7 +1,7 @@
{
"id": "promptlib",
"name": "提示词库",
"version": "1.14.10",
"version": "1.14.11",
"apiVersion": 1,
"main": "main.js",
"style": "styles.css",
@@ -14,6 +14,6 @@
],
"files": {
"main.js": "a05ce22ad8ab2e079e313dd31d8fe34f2e2e07e017bfb782afcd08047e0b485b",
"styles.css": "86f73b4d1c7b827f97ec1135c9130c7da6898537b2ed2ab815e282618232f56b"
"styles.css": "182783b15335895b5a40822bf137a7b4872ca0c6ee72434bfa61a97b37453a07"
}
}
+3 -3
View File
@@ -379,7 +379,7 @@ box-shadow: 0 24px 60px rgba(0,0,0,.32);
/* v1.6.8:卡片悬停放大 + 按下/拖拽反馈 */
.iwb-plp-card{transition:transform .14s ease, box-shadow .14s ease, border-color .14s ease, opacity .14s ease}
.iwb-plp-card:hover{transform:scale(1.03);box-shadow:0 8px 22px rgba(0,0,0,.14);z-index:2}
.iwb-plp-card:hover{border-color:var(--iwb-border2,#b9bfca)}
.iwb-plp-card.is-pressed{border-color:var(--iwb-plp-accent,#7c4dff);box-shadow:0 0 0 2px color-mix(in srgb,var(--iwb-plp-accent,#7c4dff) 22%,transparent)}
.iwb-plp-card.is-dragging{opacity:.55;transform:scale(.98)}
@@ -391,9 +391,9 @@ box-shadow: 0 24px 60px rgba(0,0,0,.32);
.iwb-plp-ghosthint{font-size: 11px;color:var(--iwb-plp-accent,#5a4bd0)}
/* v1.6.10:悬停放大改为「内层背景层缩放」——卡片命中区域不变,渐变卡不再闪烁 */
.iwb-plp-bg{position:absolute;inset:0;overflow:hidden;border-radius:inherit;transition:transform .16s ease;will-change:transform;backface-visibility:hidden}
.iwb-plp-bg{position:absolute;inset:0;overflow:hidden;border-radius:inherit;transition:transform .16s ease;backface-visibility:hidden}
.iwb-plp-card:hover .iwb-plp-bg{transform:scale(1.045)}
.iwb-plp-card:hover{border-color:var(--iwb-border2,#b9bfca);box-shadow:0 8px 22px rgba(0,0,0,.14)}
.iwb-plp-card:hover{border-color:var(--iwb-border2,#b9bfca)}
/* 取消卡片本体的缩放/层级切换(闪烁与边缘点击丢失的来源) */
.iwb-plp-card{transform:none}
.iwb-plp-card:hover{transform:none;z-index:auto}
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "image-workbench"
version = "3.26.151"
version = "3.26.152"
description = "无限画布 · 生图工作台桌面版"
authors = ["malongan"]
license = ""
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "image-workbench",
"version": "3.26.151",
"version": "3.26.152",
"identifier": "com.malongan.imageworkbench",
"build": {
"frontendDist": "../dist",
+15 -4
View File
@@ -181,6 +181,15 @@
// performance.memory 只有 Chromium 系提供,Safari/Firefox 下静默降级不报错。
let memWarnAt = 0
let memReclaimAt = 0 // v3.26.117:绝对占用护栏的冷却时间(与 75% 那条链互不影响)
let lastUserAt = Date.now() // 2026-12-01:可见但空闲时的轻量回收判断
try {
if (typeof window !== 'undefined' && typeof window.addEventListener === 'function') {
const markUser = () => { lastUserAt = Date.now() }
window.addEventListener('pointerdown', markUser, { passive: true })
window.addEventListener('keydown', markUser, { passive: true })
window.addEventListener('wheel', markUser, { passive: true })
}
} catch (e) { /* ignore */ }
let memDegradeAt = 0
let memDegradeStage = 0 // S15:0=首触(只降级"非打开标签"画板);1=再触(压到活动标签 + 提示关标签)
const memTimer = setInterval(() => {
@@ -223,11 +232,13 @@
const estNow = (compNow && compNow.procEstMB > 0) ? compNow.procEstMB : 0
const procEst = rssNow > 0 ? rssNow : (estNow > 0 ? estNow : ((mem && mem.usedMB) || 0))
const procLimit = rssNow > 0 ? 1100 : 800
// v3.26.143(用户裁定):只在应用不可见时自动回收。以前在可见时每 2 分钟清缓存,
// 会触发图片重新解码/缩略图重载,表现为周期性卡顿;参考项目也没有运行中自动清缓存。
if (procEst >= procLimit && nowMs - memReclaimAt > 120000 && !(refs && refs.saving) && !(refs && refs.genRuns && refs.genRuns.size) && (typeof document === 'undefined' || document.hidden)) {
// v3.26.143:运行中不每 2 分钟清缓存(会触发图片重解码)。2026-12-01 折中:
// 不可见立即回收;可见但连续 5 分钟没有任何输入时,也只做轻量回收(保留显示缩略图)。
const idleMs = nowMs - lastUserAt
const canVisibleIdleReclaim = !(typeof document !== 'undefined' && document.hidden) && idleMs > 300000
if (procEst >= procLimit && nowMs - memReclaimAt > 120000 && !(refs && refs.saving) && !(refs && refs.genRuns && refs.genRuns.size) && ((typeof document === 'undefined' || document.hidden) || canVisibleIdleReclaim)) {
memReclaimAt = nowMs
Promise.resolve().then(() => wReclaimMemoryNow('auto ' + (rssNow > 0 ? 'rss ' : 'est ') + procEst + 'MB', { keepThumbs: true })).catch(() => { /* ignore */ })
Promise.resolve().then(() => wReclaimMemoryNow('auto ' + (canVisibleIdleReclaim ? 'idle ' : '') + (rssNow > 0 ? 'rss ' : 'est ') + procEst + 'MB', { keepThumbs: true })).catch(() => { /* ignore */ })
}
// 下面这条是「堆占比 ≥75%」的老护栏,只有 Chromium 系(Windows)才有意义
if (!mem || !mem.ratio) return