Files
photo-live/docs/plans/progress/UI04-验收记录.md
T
浅念 66d1eb3e9f feat(embed,ui04): E01 v2 contract skeleton — displayMode/scrollSpeed/reactionsEnabled, v2 loader entry and fixed 195x280 shell
- contracts: EmbedSlotSettings optional v2 fields (carousel default) + SlotSettingsPayload; gen + redocly green
- api: DTO validation + normalization full-set (cn manage + ov public projection share normalizeStoredSettings)
- embed-loader: params v2 parse/merge/url family, loader-v2.js fixed shell (border/radius/#10161E/safe-area, resize ignored, stack gap 12), dual-artifact build+sync; v1 source frozen
- viewer: EmbedPage v=2 branch, EmbedStream (viewport/track/real anchors/collapse/empty), stream.ts pure fns, i18n zh/en
- admin: types + utils (create default vertical-stream, clampScrollSpeed, v1/v2 snippet selection)
- tests: loader 36 (+9 v2), viewer 222, admin 82, api unit 51, v1 embed e2e 20, v2 E01 gate 2 (195x280 desktop+mobile cross-origin, no footer)

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-22 12:50:28 +08:00

101 lines
6.0 KiB
Markdown
Raw 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.
# UI-04 验收记录:嵌入组件自动上滚照片窗
对应方案:[2026-09-22-UI04-嵌入组件上滚照片窗高保真实施方案](../2026-09-22-UI04-嵌入组件上滚照片窗高保真实施方案.md)
执行日期:2026-09-22 起
交付目录:[docs/designs/ui04-implementation/](../../designs/ui04-implementation/)
## 0 基线与保护
- 基线 commit:f435d7b(docs: UI-03 acceptance record)+ 本记录随 E00 提交。
- 工作树既有改动保护:E00 起始时工作树存在 **UI03R(App 高保真还原)未提交改动**
(apps/mobile/*、apps/mobile/android/*)——与本任务文件集(packages/embed-loader、
apps/viewer、apps/admin、packages/contracts、services/api)不相交;全程不暂存、
不 reset/clean、不 checkout 这些路径。
- 本任务新入库文件:docs/designs/embed-widget-*-2026-09-22.{png,md}(设计稿三组)、
docs/plans/2026-09-22-UI04-*.md(方案)、docs/designs/ui04-implementation/**(证据)。
## 1 E00 基线(v1 现状采集)
- 现状代码核对:loader(packages/embed-loader/src/loader.js 424 行 + params.js 197 行);
viewer 嵌入页(EmbedPage.vue + pages/embed/{EmbedCarousel,EmbedStage,EmbedFooterBar};
embed/{useEmbedFeed,feed,postMessage,images}.ts);实时(realtime/ws.ts RealtimeClient,
likes.burst 契约见 packages/contracts/src/realtime.ts);API 侧 embed(cn 管理)与
embed-ov(ov 公开数据,settings 归一化投影);admin embed-slots 五视图。
- v1 运行截图(跨源宿主 127.0.0.1:3999 ← viewer 5175,slot 绑定 6 张种子照片):
- [v1-desktop-baseline.png](../../designs/ui04-implementation/reference/v1-desktop-baseline.png)
- [v1-mobile-baseline.png](../../designs/ui04-implementation/reference/v1-mobile-baseline.png)
- v1 尺寸实测(getBoundingClientRect,viewport 1440×900 / 390×844):
| 端 | 元素 | 尺寸 |
|---|---|---|
| 桌面 | wrapper/iframe(md) | 320×339(宽度 md=320;高度为 iframe resize 上报的内容高) |
| 手机 | 收起把手 | 97×44 |
| 手机 | 展开 wrapper(sm 强制) | 280×309 |
- v1 行为登记:窄屏(<480px)默认收起 + 强制 sm;配置优先级 data-* > config 消息 >
默认;postMessage 白名单 {resize,collapse,expand,config,destroy};轮询 30s + ETag
304 + 失败退避 ×5;destroy 于 404/410。
- 采集方式:临时 Playwright 规格(复用 embed-crossorigin 夹具模式,种子经 e2e helpers
直种 cn 库 + flushSync/flushOutbox 同步 ov),采集后已删除;本地栈复用既有进程
(compose 容器已运行 26h+,cn:8080 / ov:8081 / viewer:5175 复用)。
## 2 版本与兼容策略(E01 定案登记)
- **入口形态**:新发布物 `/embed/v2/loader.js`(源 src/loader-v2.js,v1 源 loader.js 冻结
零改动,双产物同 build/sync 脚本);iframe 复用同一路由 `/embed/:slotToken` + 白名单
版本查询 `v=2`(v1 loader 不拼 v → 旧 carousel 分支,旧 v1 接入零变化)。
- **契约扩展**(全部可选、响应恒归一化全集):EmbedSlotSettings += `displayMode`
(carousel|vertical-stream,默认 carousel)、`scrollSpeed`(8..32 CSS px/s,默认 16)、
`reactionsEnabled`(默认 true);事件载荷 SlotSettingsPayload 同步可选字段。
- **缺省语义**:契约/服务端缺省 displayMode=carousel(存量记录读取归一为旧模式,
不一夜切换);管理端新建默认 vertical-stream 由表单显式提交(§8.2)。
- **v2 尺寸硬性**:loader 侧 V2_WIDTH/V2_HEIGHT=195/280 常量;size/intervalMs/imageFit
不进 v2 配置面(data-* 不解析、snippet 不生成、iframe 布局忽略);resize 消息 v2 忽略。
- **E01 证据**:v2 跨源宿主桌面/手机双端 getBoundingClientRect 实测 195×280(e2e
embed-v2.spec.ts E01 出口门 2 用例);ov 公开端点响应含新字段全集(实测 200);
v1 回归 20 e2e 全绿(EMB-A14 部分证据);loader 36 测试(+9 v2 参数面)。
## 3 任务进度
- [x] E00 基线(本记录第 1 节)
- [x] E01 契约和版本骨架(第 2 节;改动面:contracts openapi+events+gen、api dto/
embed.service(cn 管理与 ov 投影共用归一化)、embed-loader params+loader-v2+build/sync、
viewer EmbedPage v=2 分支+EmbedStream+stream.ts+i18n、admin 类型+utils+snippet v1/v2 版本选择)
- [ ] E02 静态高保真样板
- [ ] E03 连续滚动
- [ ] E04 操作和生命周期
- [ ] E05 实时气泡
- [ ] E06 管理预览与接入
- [ ] E07 验收(EMB-A01…A16 逐项见第 5 节)
## 4 测量与证据索引
(E02+ 起登记:尺寸实测、位移曲线、DOM/连接上限统计、录屏清单。)
## 5 验收矩阵 EMB-A01…A16
| 编号 | 场景 | 状态 | 证据 |
|---|---|---|---|
| EMB-A01 | 多视口固定尺寸 195×280 | 待验 | |
| EMB-A02 | 狭窄/横屏/安全区/多实例不越界 | 待验 | |
| EMB-A03 | 横/竖/全景/单图/0图/2图短循环 | 待验 | |
| EMB-A04 | decode 慢/破图/签名到期/304/失败恢复 | 待验 | |
| EMB-A05 | 循环锚定 + DOM 上限 | 待验 | |
| EMB-A06 | 隐藏/删除/关闭/换绑/停用清理 | 待验 | |
| EMB-A07 | 点击/拖动/悬停/键盘/reducedMotion | 待验 | |
| EMB-A08 | 收起展开/记忆/默认收起/后台配置更新 | 待验 | |
| EMB-A09 | 双上下文真实点赞/重复 burst/错相册/不可见归属 | 待验 | |
| EMB-A10 | WS 断线不假造气泡 | 待验 | |
| EMB-A11 | 真跨源 + 消息伪造拒绝 | 待验 | |
| EMB-A12 | 宿主全局 CSS/重复 script/SPA 移除 | 待验 | |
| EMB-A13 | 后台预览隔离 + v2 接入代码 | 待验 | |
| EMB-A14 | v1 保留 + 普通 viewer 无回归 | 待验 | |
| EMB-A15 | 不上报浏览/不提交点赞 | 待验 | |
| EMB-A16 | 证据完整、未测项如实标注 | 本记录即载体 | |
## 6 未完成项与外部资源
- 真实 CDN/发布不在本轮(方案 §1.2);本轮只产出构建产物与文档。
- E02 起静态样板需真实摄影素材(非 sharp 色块)——种子照片拟下载固定摄影样本入 MinIO;
网络不可用时降级为记录待验,不标记通过。