Files
2026-11-26 07:31:59 +08:00

34 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# gallery 插件避坑事项
> 维护:改选中态/缩略图/补存后先读本文件,并跑 `node tests/plugin-gallery-ux-test.js`。
> 版本:1.7.5(2026-11-26)
## 1. 选中态必须有形状差异
- 宿主已提供 `--iwb-selection-ring/on/bg/halo`,默认跟随强调色;
- 选中格:2px 品牌边框 + `--iwb-selection-halo` 外圈 + **勾选圆点**;勾选点必须有 DOM(`.iwb-history-check`),只写 CSS 等于没有;
- 多选禁止用 `opacity:.82` 把整墙图压黑(深色图会变黑块);最多 0.94;
- 插件 `img:hover` 的 `box-shadow` 会覆盖宿主选中环;宿主用高优先级 `body .iwb-history-embedded ... .iwb-history-selected:hover img` 兜住,改选择器时别降级。
## 2. 缩略图与选中是两层
- 缩略图异步加载 / 失败重试 / 对象 URL 缓存的逻辑不要和选中类名混在一起;
- `iwb-history-managed` 是“有选中项”的全局标记,`iwb-history-selected` 是单格;两者不能互相替代。
## 3. 落盘状态
- 条目 `orig: 'ok' | 'missing' | 'off' | 'pending'` 由宿主写入;插件只展示角标/补存入口;
- 补存用 `ctx.gallery.backfill([name])`,不要自己 fetch 远程(跨域/权限都在宿主)。
## 4. 发版
- 改 `styles.css` 时注意插件样式在宿主之后加载;宿主选中规则必须留高优先级,否则被 hover 盖掉;
- `package.json` / 入口 version / 市场同步;本文件不打包。
## 5. 最小回归清单
- [ ] 选中 1 张 / 多选 2 张:都有勾选点,边框品牌色
- [ ] 多选时缩略图不被压黑
- [ ] hover 选中格:选中环不消失
- [ ] 原图缺失角标 / 底栏补存仍工作