Refactor XCEditor into library-style layout

This commit is contained in:
2026-04-06 20:02:34 +08:00
parent f16620afc6
commit 2a61f0b20a
60 changed files with 524 additions and 502 deletions

View File

@@ -170,9 +170,10 @@ tests/
- `editor/` 当前视为 ImGui 版本冻结区;在 XCUI editor shell 成熟前,不直接在该目录中推进替换开发。
- `tests/UI` 是当前 `Editor` 基础层的唯一实验场;所有基础能力验证、交互试验、状态流检查都必须优先放在 `tests/UI/Editor/unit``tests/UI/Editor/integration`
- `new_editor/` 当前冻结为空壳目录,不承担实验场职责;在 `Editor` 基础层尚未通过测试体系收口前,禁止继续往其中添加新功能、新面板或新的验证入口。
- `new_editor/` 当前不作为试验场;它承载 `Editor` 基础层库与临时宿主骨架,禁止往其中追加业务面板、临时验证逻辑或与 `tests/UI` 重复的实验入口。
- `new_editor/` 当前目录结构按库式 `Editor UI` 形态维护:公共头放在 `include/XCEditor/Core|Widgets`,实现放在 `src/Core|Widgets`,宿主代码放在 `app/Application.*|Host/*`,不再把库层与宿主层揉成一套业务目录。
- `engine/UI` 当前继续只放 `Core / Runtime / shared` 部分,不再继续沉积 editor-only 代码。
-`Editor` 基础层在 `tests/UI/Editor` 中稳定收口后,如确有宿主集成需要,再单独规划 `new_editor/` 正式 `editor/` 的接入阶段。
-`Editor` 基础层在 `tests/UI/Editor` 中稳定收口后,规划 `new_editor/` 迁入正式 `editor/` 的接入阶段,而不是继续在旧 `editor/``new_editor/` 之间双线推进
#### 当前过渡期目录(自 2026-04-06 起执行)
```text
@@ -182,10 +183,11 @@ engine/
# 只承载 Core / Runtime / shared UI 基础层
new_editor/
include/XCEditor/
src/
app/
ui/
captures/
# 当前冻结为空壳,不作为基础层开发或实验入口
# Editor 基础层库 + 临时宿主骨架;不承载测试验证入口与业务面板
editor/
# 当前 ImGui 版本冻结,不作为本阶段 XCUI 主实现目录
@@ -1418,7 +1420,7 @@ tests/UI/Editor/
1. 冻结当前基于 ImGui 的 `editor/` 目录,不把它作为本阶段 XCUI 替换开发的主工作区。
2. 当前阶段所有 `Editor` 基础层实验、交互验证、状态流验证,一律放在 `tests/UI/Editor` 中完成。
3. `new_editor/` 保持空壳冻结;在基础层未成熟前,不把它当作试验场,不往里面追加功能
3. `new_editor/` 不作为试验场;当前只允许维护 `Editor` 基础层库与宿主骨架,不往里面追加业务面板或验证逻辑
4. 在具体 editor 面板之前,优先完成 editor shell 基础能力:
- Splitter / pane resize
- Tab strip
@@ -1439,7 +1441,7 @@ tests/UI/Editor/
- 凡是发现 `layout / input / style / text / render contract / shared widget` 等共享能力缺口,必须优先回补到 `Core` 或 shared UI 层。
- 禁止在 `Editor` 层硬写临时替代实现去绕过 `Core` 缺口;否则后面迁移到正式 editor 时会再次返工。
- `tests/UI/Editor` 是当前 `Editor` 基础层的唯一实验与验证入口;需要人工操作检查的内容,也必须做成这里的集成测试场景。
- `new_editor/` 当前保持空壳冻结,不作为试验场,作为基础层功能承载目录,更不允许在基础层未成熟前向其中堆任何业务或验证逻辑。
- `new_editor/` 当前不作为试验场,作为 `Editor` 基础层库与临时宿主骨架存在;允许承载迁移必需的基础层代码,不允许堆业务面板或测试验证逻辑。
- `tests/UI/Editor` 当前只验证 `Editor` 基础壳层与状态流,不提前承担具体业务面板复刻。
### 24.3 Editor基础层当前推进顺序2026-04-06
@@ -1451,6 +1453,13 @@ tests/UI/Editor/
3. 打通 `open / close / show / hide / activate` 的基础状态流,并让 tab 选择与 active panel 始终一致。
4. 先补 `tests/UI/Editor/unit` 对上述状态机与装配规则的覆盖,再补一个专注状态流的 `integration` 场景。
5. 上述基础层稳定后,再继续推进 `MenuBar / ShortcutManager / DockHost layout persistence`,最后才轮到具体业务面板迁移。
### 24.4 当前下一阶段主线2026-04-06
结合当前实现进度,下一阶段执行顺序补充固定为:
1. 先在 `tests/UI/Core` 回补共享 `popup / menu overlay primitive`,包括 `open/close`、anchor/placement、outside click dismiss、`Escape` dismiss、submenu path。
2. 再补 `popup overlay` 与现有 `focus / input / capture / shortcut scope` 的契约收口,先做 `unit`,再做一个只验证单场景的 `integration` exe。
3. 上述 Core 能力稳定后,再在 `tests/UI/Editor` 中推进 `MenuBar / MenuPopup / ContextMenu` 对这套 primitive 的复用,不在 `Editor` 层另写临时实现绕过 Core。
4. 最后继续 `TabStrip / DockHost shell / workspace compose` 的真实渲染、命中与状态联动,直到 `Editor shell` 基础层具备替换当前 ImGui shell 的必要能力。
## 25. 人力与节奏建议
若按 1 名主导工程师 + AI 辅助估算: