Verify (Gitea) / gate (build · unit · facts) (push) Failing after 44s
一、预览链根因(用户报「相册的图传到组合节点显示不出内容」)
wResolveImg 是所有节点预览的唯一入口(图片节点 / 参考图 mini / 组合节点 / 插件节点),
但它只认 __blob / __cache,遇到相册写的 { __file: 绝对路径 } 就把引用对象原样返回,
上层 wThumbSrc 里 String(对象) 得到 [object Object] ⇒ img 的 src 就是个坏字符串 ⇒ 破图。
而 wEnsureImgUrl / wImgRefDataUrl 早就支持读盘 —— 只差这个入口判定,加 wIsFileRef 即可。
生成不受影响(走 wImgRefDataUrl),所以这个 bug 一直只在「预览」里可见。
二、内置 album 1.1.0(方形宫格 / 清除按钮 / 放大镜 hover 预览 + 点击全屏 / 5 个布局翻页 bug)
三、新增 tests/image-file-ref-preview-test.js(12 项,已接入 test:unit)
行为断言三种引用键互不冲突 + 源断言 wResolveImg 入口含 __file、四个读盘入口都在。
这类「入口少一个分支」的漏很难手工发现,钉成断言。
版本 3.26.69(dmg 随发布链重建)
70 lines
8.9 KiB
CSS
70 lines
8.9 KiB
CSS
/* 相册节点体(2026-11-26)
|
||
* 宿主只给一块空容器(.iwb-plugin-node-body),所有排版由这里决定。
|
||
* 尺寸全部用像素而不是 rem:节点宽度是可拖拽的(264~600),rem 会跟着宿主字号漂移。
|
||
*/
|
||
.iwb-album { position: relative; display: flex; flex-direction: column; height: 100%; overflow: hidden; font-size: 11px; color: var(--iwb-node-text); }
|
||
.iwb-album-bar, .iwb-album-tools, .iwb-album-pager, .iwb-album-onepage {
|
||
display: flex; align-items: center; gap: var(--iwb-space-6); padding: var(--iwb-space-4) var(--iwb-space-8); flex: 0 0 auto;
|
||
}
|
||
.iwb-album-bar { border-bottom: 1px solid color-mix(in srgb, var(--iwb-border) 55%, transparent); height: 26px; }
|
||
.iwb-album-tools { padding-top: var(--iwb-space-2); padding-bottom: var(--iwb-space-2); }
|
||
.iwb-album-toggle { display: inline-flex; align-items: center; gap: var(--iwb-space-4); font-size: var(--iwb-font-2xs); color: var(--iwb-node-text2); white-space: nowrap; cursor: pointer; }
|
||
.iwb-album-track { width: 22px; height: 12px; border-radius: 999px; background: var(--iwb-border); position: relative; flex: 0 0 auto; transition: background .15s; }
|
||
.iwb-album-track i { position: absolute; top: 1.5px; left: 1.5px; width: 9px; height: 9px; border-radius: 50%; background: var(--iwb-panel); transition: left .15s; }
|
||
.iwb-album-track.on { background: var(--iwb-brand); }
|
||
.iwb-album-track.on i { left: 11.5px; }
|
||
.iwb-album-count { margin-left: auto; font-size: var(--iwb-font-2xs); color: var(--iwb-node-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||
.iwb-album-count b { color: var(--iwb-node-text); font-weight: 600; }
|
||
.iwb-album-btn { height: 21px; padding: 0 var(--iwb-space-8); border: 1px solid var(--iwb-border); border-radius: var(--iwb-radius-chip); background: var(--iwb-panel); color: var(--iwb-node-text2); font-size: var(--iwb-font-2xs); display: inline-flex; align-items: center; gap: var(--iwb-space-4); cursor: pointer; white-space: nowrap; }
|
||
.iwb-album-btn:hover { border-color: var(--iwb-brand); color: var(--iwb-node-text); }
|
||
.iwb-album-btn.on { border-color: var(--iwb-brand); color: var(--iwb-node-text); }
|
||
/* 清空:常驻在顶栏最右,只有相册里有图时才出现。hover 转红是为了和「添加」一类中性操作区分开。 */
|
||
.iwb-album-clear { flex: 0 0 auto; padding: 0 var(--iwb-space-6); }
|
||
.iwb-album-clear:hover { border-color: #c0392b; color: #c0392b; }
|
||
.iwb-album-seg { margin-left: auto; display: inline-flex; border: 1px solid var(--iwb-border); border-radius: var(--iwb-radius-chip); overflow: hidden; }
|
||
.iwb-album-seg span { width: 21px; height: 21px; display: inline-flex; align-items: center; justify-content: center; font-size: var(--iwb-font-2xs); color: var(--iwb-node-text2); background: var(--iwb-panel); cursor: pointer; }
|
||
.iwb-album-seg span.on { background: var(--iwb-brand); color: var(--iwb-on-brand); }
|
||
.iwb-album-grid { display: grid; gap: var(--iwb-space-4); padding: var(--iwb-space-2) var(--iwb-space-8) var(--iwb-space-6); overflow: hidden; align-content: start; flex: 1 1 auto; min-height: 0; }
|
||
/* 格子固定正方形(2026-11-26):此前高度由图片比例决定 —— 4 张 16:9 宽图会变成 22px 细条、
|
||
竖图撑到 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; }
|
||
.iwb-album-cell img { width: 100%; height: 100%; object-fit: cover; display: block; -webkit-user-drag: none; }
|
||
.iwb-album-cell.off img { opacity: .38; }
|
||
/* 选中线 2px → 1px(用户:太粗)。1px 在浅底上仍分得清「选中」与「描边」。 */
|
||
.iwb-album-cell.sel { outline: 1px solid var(--iwb-brand); outline-offset: -1px; }
|
||
.iwb-album-cell.missing { outline: 1px dashed #c0392b; outline-offset: -1px; }
|
||
.iwb-album-cell.missing::after { content: '失联'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: var(--iwb-font-2xs); color: #c0392b; background: rgba(255,255,255,.72); }
|
||
.iwb-album-cell.dragging { opacity: .45; }
|
||
.iwb-album-cell.dropbefore { box-shadow: -3px 0 0 0 var(--iwb-brand); }
|
||
.iwb-album-idx { position: absolute; left: var(--iwb-space-2); top: var(--iwb-space-2); min-width: 14px; height: 14px; padding: 0 var(--iwb-space-4); border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; font-size: var(--iwb-font-2xs); display: flex; align-items: center; justify-content: center; }
|
||
/* 批次角标已移除(2026-11-26):顶栏「N 张 → M 个任务」已经说清楚,每格右上角再挂个「1」是重复信息。
|
||
位置让给删除按钮:右下角要留给放大镜。 */
|
||
.iwb-album-del { position: absolute; right: var(--iwb-space-2); top: var(--iwb-space-2); width: 15px; height: 15px; border-radius: 50%; background: var(--iwb-panel); color: var(--iwb-node-text2); font-size: 11px; line-height: 1; display: flex; align-items: center; justify-content: center; opacity: 0; cursor: pointer; }
|
||
.iwb-album-cell:hover .iwb-album-del { opacity: 1; }
|
||
/* 放大镜:右下角,hover 才出现(静息态不抢视觉,和 × 一致)。
|
||
18px 圆 / 12px 图标:10px 时镜片只有 5px,缩到小截图里就成一团白点了。 */
|
||
.iwb-album-zoom { position: absolute; right: var(--iwb-space-2); bottom: var(--iwb-space-2); width: 17px; height: 17px; border-radius: 50%; background: var(--iwb-panel); color: var(--iwb-node-text2); display: flex; align-items: center; justify-content: center; opacity: 0; cursor: zoom-in; transition: opacity .12s; }
|
||
.iwb-album-cell:hover .iwb-album-zoom { opacity: 1; }
|
||
.iwb-album-zoom:hover { color: var(--iwb-brand); }
|
||
.iwb-album-zoom svg { width: 12px; height: 12px; display: block; }
|
||
/* 节点内预览层:铺满节点框(用户要求「大图显示范围控制在节点框内」),绝不溢出到画布。
|
||
点放大镜后出现的浮层 —— pointer-events:none 所以不会挡住下面格子的点击(点穿到底层格子 = 切换选中,符合预期)。*/
|
||
.iwb-album-preview { position: absolute; inset: 0; z-index: 9; display: none; align-items: center; justify-content: center; background: rgba(12,16,22,.82); pointer-events: none; }
|
||
.iwb-album-preview.on { display: flex; }
|
||
.iwb-album-preview img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; }
|
||
.iwb-album-preview-name { position: absolute; left: var(--iwb-space-8); bottom: var(--iwb-space-6); right: var(--iwb-space-8); color: #fff; font-size: var(--iwb-font-2xs); opacity: .82; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||
.iwb-album-add { border: 1px dashed var(--iwb-border); background: transparent; color: var(--iwb-node-text2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--iwb-space-2); font-size: var(--iwb-font-2xs); border-radius: var(--iwb-radius-chip); cursor: pointer; }
|
||
.iwb-album-add b { font-size: 15px; line-height: 1; font-weight: 600; }
|
||
.iwb-album-pager { border-top: 1px solid color-mix(in srgb, var(--iwb-border) 55%, transparent); height: 26px; }
|
||
.iwb-album-onepage { border-top: 1px solid color-mix(in srgb, var(--iwb-border) 55%, transparent); height: 26px; color: var(--iwb-node-text2); font-size: var(--iwb-font-2xs); }
|
||
.iwb-album-pg { display: inline-flex; align-items: center; border: 1px solid var(--iwb-border); border-radius: var(--iwb-radius-chip); background: var(--iwb-panel); }
|
||
.iwb-album-pg span { width: 17px; height: 17px; display: flex; align-items: center; justify-content: center; font-size: var(--iwb-font-2xs); cursor: pointer; color: var(--iwb-node-text2); }
|
||
.iwb-album-pg b { font-weight: 600; color: var(--iwb-node-text); padding: 0 2px; font-size: var(--iwb-font-2xs); }
|
||
.iwb-album-mini { display: inline-flex; align-items: center; gap: var(--iwb-space-4); margin-left: auto; font-size: var(--iwb-font-2xs); color: var(--iwb-node-text2); white-space: nowrap; }
|
||
.iwb-album-hint { margin: 0 8px 4px; padding: 4px 6px; border-radius: var(--iwb-radius-chip); background: rgba(107,114,128,.10); border: 1px solid rgba(107,114,128,.22); color: var(--iwb-node-text2); font-size: var(--iwb-font-2xs); line-height: 1.45; }
|
||
.iwb-album-hint b { color: var(--iwb-node-text); }
|
||
.iwb-album-empty { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--iwb-space-6); color: var(--iwb-node-text2); font-size: 11px; text-align: center; padding: 0 var(--iwb-space-12); }
|
||
.iwb-album-empty .box { width: 66px; height: 50px; border: 1.5px dashed var(--iwb-border); border-radius: var(--iwb-radius-chip); display: flex; align-items: center; justify-content: center; font-size: var(--iwb-font-xl); color: var(--iwb-node-text2); }
|