diff --git a/gallery/package.json b/gallery/package.json index f5b4c36..7923bcd 100644 --- a/gallery/package.json +++ b/gallery/package.json @@ -1,11 +1,12 @@ { "name": "@iwb-plugin/gallery", "private": true, - "version": "1.4.2", + "version": "1.5.0", "description": "图库:右栏图片墙(筛选/多选/预览/插入画布/下载/删除),数据由宿主 gallery 能力提供", "ibwPlugin": { "id": "gallery", "entry": "src/index.js", - "apiVersion": 1 + "apiVersion": 1, + "style": "styles.css" } } diff --git a/gallery/src/index.js b/gallery/src/index.js index 2f71cb0..90d8c30 100644 --- a/gallery/src/index.js +++ b/gallery/src/index.js @@ -198,7 +198,7 @@ function renderGrid () { clear(grid) - var gap = 8 + var gap = 6 var n = Math.max(1, Math.floor((gridW + gap) / (Number(cfg.tile) + gap))) var cols = [] var heights = [] @@ -372,7 +372,7 @@ global.IWBPluginHost.register({ id: 'gallery', name: '图库', - version: '1.4.2', + version: '1.5.0', apiVersion: 1, capabilities: ['panels', 'gallery'], data: { schemaVersion: 1, maxBytes: 65536 }, diff --git a/gallery/styles.css b/gallery/styles.css new file mode 100644 index 0000000..1b997f9 --- /dev/null +++ b/gallery/styles.css @@ -0,0 +1,68 @@ +/* 图库插件样式(v1.5.0) + * 为什么放插件里:宿主 style.css 只在客户端发版时更新,而这里是「设置浮层/图标按钮/紧凑间距」这类 + * 高频视觉调整——随插件更新即可生效,不必重发桌面端。选择器均带 .iwb-gal-* / .iwb-history-* 前缀, + * 且比宿主同名规则更具体(.iwb-gal-foot .iwb-gal-icobtn),宿主旧样式不会盖回来。 + */ + +/* ---- 面板留白:边缘收小,避免窄栏里浪费空间 ---- */ +.iwb-history-embedded { padding: 8px 8px 6px; gap: 6px; } +.iwb-history-embedded .iwb-history-grid { gap: 6px; padding: 0 0 4px; } + +/* ---- 顶栏 ---- */ +.iwb-gal-head { display: flex; align-items: center; gap: 6px; min-height: 0; } +.iwb-gal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; } +.iwb-gal-actions .iwb-btn-sm { padding: 2px 7px; } + +/* ---- 底栏:左信息 / 右工具组 ---- */ +.iwb-gal-foot { + display: flex; align-items: center; justify-content: space-between; gap: 6px; + min-width: 0; padding-top: 6px; border-top: 1px solid var(--iwb-border); +} +.iwb-gal-foot-left { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 0 1 auto; overflow: hidden; } +.iwb-gal-count { font-size: 11px; color: var(--iwb-text2); white-space: nowrap; } +.iwb-gal-sel { font-size: 11px; color: var(--iwb-brand); white-space: nowrap; } +.iwb-gal-status { font-size: 11px; color: var(--iwb-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; max-width: none; } +.iwb-gal-tools { display: flex; align-items: center; gap: 0; flex: 0 0 auto; margin-left: auto; } + +/* ---- 图标按钮:无外框、无底色,只在悬停时给一点反馈 ---- */ +.iwb-gal-foot .iwb-gal-icobtn, +.iwb-gal-foot .iwb-gal-icobtn:hover, +.iwb-gal-foot .iwb-gal-icobtn:active { + width: 20px; height: 20px; min-width: 20px; padding: 0; box-sizing: border-box; + display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; + border: 0; box-shadow: none; background: transparent; border-radius: 4px; + color: var(--iwb-text2); line-height: 1; transform: none; +} +.iwb-gal-foot .iwb-gal-icobtn svg { display: block; pointer-events: none; } +.iwb-gal-foot .iwb-gal-icobtn:hover { background: var(--iwb-layer2); color: var(--iwb-text); } +.iwb-gal-foot .iwb-gal-icobtn:focus-visible { outline: 2px solid color-mix(in srgb, var(--iwb-brand) 60%, transparent); outline-offset: 1px; } +.iwb-gal-setbtn-on { color: var(--iwb-brand); background: var(--iwb-layer2); } + +/* ---- 设置浮层(三个下拉不占前台) ---- */ +.iwb-gal-settings { + position: absolute; right: 8px; bottom: 34px; z-index: 30; width: 176px; max-width: calc(100% - 16px); + display: flex; flex-direction: column; gap: 8px; padding: 9px 10px; + background: var(--iwb-layer); border: 1px solid var(--iwb-border); border-radius: 8px; + box-shadow: 0 6px 18px rgba(0, 0, 0, .14); +} +.iwb-gal-settings-title { font-size: 11px; font-weight: 600; color: var(--iwb-text2); } +.iwb-gal-setrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--iwb-text2); } +.iwb-gal-setlabel { flex: 0 0 auto; } +.iwb-gal-setrow select { flex: 1 1 auto; width: auto; min-width: 58px; max-width: 92px; height: 22px; font-size: 11px; padding: 0 2px 0 4px; } + +/* ---- 图片墙 ---- */ +.iwb-history-grid { overscroll-behavior: contain; } +.iwb-history-embedded .iwb-history-item { position: relative; flex: none; width: 100%; } +.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; +} +.iwb-history-missing { + display: flex; align-items: center; justify-content: center; text-align: center; + 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; +} +.iwb-history-actions { display: flex; gap: 4px; padding: 4px 2px 0; } +.iwb-history-actions .iwb-btn-sm { padding: 1px 6px; font-size: 10px; } +.iwb-history-more { display: flex; justify-content: center; padding: 4px 0 2px; } +.iwb-hint { font-size: 11px; color: var(--iwb-text2); text-align: center; padding: 12px 6px; } \ No newline at end of file