diff --git a/gallery/package.json b/gallery/package.json index df3aec8..d81941a 100644 --- a/gallery/package.json +++ b/gallery/package.json @@ -1,7 +1,7 @@ { "name": "@iwb-plugin/gallery", "private": true, - "version": "1.9.9", + "version": "1.9.10", "description": "图库:右栏图片墙(筛选/多选/预览/插入画布/下载/删除),数据由宿主 gallery 能力提供", "ibwPlugin": { "id": "gallery", diff --git a/gallery/src/index.js b/gallery/src/index.js index c5ed9db..e371eb2 100644 --- a/gallery/src/index.js +++ b/gallery/src/index.js @@ -578,12 +578,16 @@ b.addEventListener('click', function (e) { e.stopPropagation(); fn() }) return b } - // v1.7.2:图片卡片上只留「下载」;插入仍可从顶部工具栏或右键菜单进入。 - acts.appendChild(act('下载', '下载到本地', function () { doDownload([it.name]) })) + // 2026-12-02(用户裁定):卡片上的「下载」胶囊改成右下角圆形图标 —— 矮图不再被横条压住中心; + // 只留图标不加文案(title/aria-label 兜底)。插入仍走顶部工具栏与右键菜单。 + var dlBtn = el('button', { class: 'iwb-gal-dl', title: '下载到本地', 'aria-label': '下载', text: '↓' }) + dlBtn.addEventListener('click', function (e) { e.stopPropagation(); doDownload([it.name]) }) + acts.appendChild(dlBtn) + acts.className = 'iwb-gal-dlwrap' box.appendChild(acts) // 角标/勾选最后挂:不要 z-index(插件层级闸门禁止裸值),靠 DOM 顺序盖在图片上 if (origBadge) box.appendChild(origBadge) - if (on) box.appendChild(el('span', { class: 'iwb-history-check', title: '已选中' })) + // 2026-12-02:选中只留外框,不再挂角标图标(用户裁定) box.__iwbItem = it box.__iwbBoot = boot nodeCache[it.name] = box @@ -849,7 +853,7 @@ global.IWBPluginHost.register({ id: 'gallery', name: '图库', - version: '1.9.9', + version: '1.9.10', apiVersion: 1, capabilities: ['panels', 'gallery'], data: { schemaVersion: 1, maxBytes: 65536 }, diff --git a/gallery/styles.css b/gallery/styles.css index 824c942..6f8f493 100644 --- a/gallery/styles.css +++ b/gallery/styles.css @@ -84,19 +84,27 @@ min-height: 84px; padding: 8px; border-radius: 6px; border: 1px dashed var(--iwb-border); font-size: 11px; color: var(--iwb-text2); background: var(--iwb-layer2); word-break: break-all; } -/* v1.7.3:把「下载」做成卡片底部渐变的下载浮层(与输出节点同一套语义)。 - 条本身 pointer-events:none,只有悬停后按钮可点,避免挡住卡片点击/双击预览。 */ +/* 2026-12-02(用户裁定):卡片下载从「底部横条」改为「右下角圆形图标」。 + —— 矮图(宽幅)不再被横条压住中心,除按钮外整张图都能点。 + 尺寸/圆角/间距抽成 --iwb-dl-* 变量,宿主 style.css 用同名变量(同一套 token 口径,后续可提升到主题层)。 */ .iwb-history-actions { - position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 4px; - padding: var(--iwb-space-16) var(--iwb-space-4) var(--iwb-space-4); border-radius: 0 0 6px 6px; - background-image: linear-gradient(to top, rgba(0, 0, 0, .62), transparent); + position: absolute; right: var(--iwb-dl-inset, 8px); bottom: var(--iwb-dl-inset, 8px); + display: flex; gap: var(--iwb-dl-gap, 4px); opacity: 0; transition: opacity var(--iwb-motion-hover, .15s) var(--iwb-ease-hover, ease-out); pointer-events: none; } .iwb-history-embedded .iwb-history-item:hover .iwb-history-actions, .iwb-history-embedded .iwb-history-item:focus-within .iwb-history-actions { opacity: 1; pointer-events: auto; } -.iwb-history-actions .iwb-btn-sm { padding: 2px 8px; font-size: 11px; border: none; background: var(--iwb-panel); color: var(--iwb-text); } -.iwb-history-actions .iwb-btn-sm:hover { background: var(--iwb-panel); color: var(--iwb-brand); } +.iwb-gal-dl { + width: var(--iwb-dl-size, 28px); height: var(--iwb-dl-size, 28px); + border-radius: var(--iwb-dl-radius, 999px); + border: 1px solid var(--iwb-border2); + background: var(--iwb-panel); color: var(--iwb-text); + display: grid; place-items: center; padding: 0; cursor: pointer; + font-size: var(--iwb-font-xs); line-height: 1; + box-shadow: var(--iwb-elevation-1, 0 1px 2px rgba(0,0,0,.18)); +} +.iwb-gal-dl:hover { background: var(--iwb-hover); color: var(--iwb-brand); } @media (prefers-reduced-motion: reduce) { .iwb-history-embedded .iwb-history-item img { transition: none; } .iwb-history-embedded .iwb-history-item:hover img { transform: none; } diff --git a/gallery/tools/harness.mjs b/gallery/tools/harness.mjs index 6184687..9d5122c 100644 --- a/gallery/tools/harness.mjs +++ b/gallery/tools/harness.mjs @@ -63,7 +63,9 @@ ok('左侧计数 / 选中 / 状态文字字号没被顺手改掉', // ---- v1.7.2:图片卡片只留下载;顶部/右键插入入口不回退 ---- ok('图片卡片上没有「插入」按钮', !/acts\.appendChild\(act\('插入'/.test(src)) -ok('图片卡片保留「下载」按钮', /acts\.appendChild\(act\('下载'/.test(src)) +// 2026-12-02:卡片下载改成右下角圆形图标(无文案),断言随之改为「存在 .iwb-gal-dl 且带 title」 +ok('图片卡片保留下载入口(圆形图标 + title)', /class: 'iwb-gal-dl'[^)]*title: '下载到本地'/.test(src) && /\{\s*class: 'iwb-gal-dl'[\s\S]{0,120}title: '下载到本地'/.test(src)) +ok('卡片下载不再用文字胶灸', !/acts\.appendChild\(act\('下载'/.test(src)) ok('顶部工具栏「插入」仍在', /actions\.appendChild\(btn\('插入'/.test(src)) ok('右键菜单「插入画布」仍在', /item\('插入画布'/.test(src))