Files
road-compiler/.trellis/tasks/archive/2026-09/09-02-workbench-component-boundaries/implement.md
T

30 lines
1.6 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.
# 实施计划
1. 建立组件与 hook 的类型边界,提取右栏编辑器和 `WorkbenchInspector`;逐项比对现有 props、
文案和折叠默认状态。
2. 提取 `useOverrideDraft`,为 staged 合并、覆盖保存和放弃建立纯函数或聚焦测试。
3. 提取 `useDirectEditSession`,集中拥有现有 `EditSession`、manifest、preview 和 diagnostics
生命周期;手柄/lane 派生、undo/redo 与统一保存入口仍由 App 编排,以避免改变预览时序。
4. 提取 `useTrafficSignalDraft`,收拢 signal 草稿、移动、旋转、撤销/重做、放弃和保存;复用现有
距离限制与 heading 派生,不重写几何算法。
5. 将 App 缩至页面编排与命令组合,运行 map 交互回归;删除不再使用的内嵌实现。
6. 更新 `.trellis/spec/frontend/`:`directory-structure.md`、`component-guidelines.md`、
`hook-guidelines.md`、`state-management.md`、`quality-guidelines.md`。
7. 运行格式、完整服务器测试、客户端类型/单测、生产构建和 diff 检查;人工核验保存/放弃/撤销及
地图视角稳定性。
## 验证命令
- `npm run format:check`
- `npm run test`
- `npm run test:client`
- `npm run test:client:unit -- --run`
- `npm run build`
- `git diff --check`
## 高风险点
- `EditSession` 和 `PreviewRequester` 依赖稳定对象身份;提取时不可在每次渲染重建。
- 红绿灯草稿与 v2 document 都参与顶部撤销/放弃命令;优先级与现有分支必须保持。
- `MapCanvas` 的 OpenLayers effect 必须仍只在 mount 时建图,不能让 hook 或 inspector props 触发重建。