docs: add Editor API documentation

This commit is contained in:
2026-03-27 14:40:29 +08:00
parent 3e2608a802
commit 94c56dd279
87 changed files with 3795 additions and 2 deletions

View File

@@ -0,0 +1,46 @@
# StyleTokens
**命名空间**: `XCEngine::Editor::UI`
**类型**: `header-helper`
**源文件**: `editor/src/UI/StyleTokens.h`
**描述**: 统一定义编辑器 UI 使用的颜色、尺寸、间距和布局 token。
## 概述
`StyleTokens.h` 是当前 UI 层的设计 token 中心。
它集中提供了大量 inline token helper例如
- Dock 标签颜色
- 工具栏高度与 padding
- 资产网格尺寸
- Inspector 标签列宽
- 弹窗按钮尺寸
- 向量控件按钮颜色
- Console 状态颜色
## 设计说明
这是商业编辑器 UI 非常推荐的做法。
不要在控件代码里到处写 `6.0f``0.24f``104.0f` 这种魔法数字,而应先抽象成 token。
收益包括:
- 调整风格时能集中修改
- 命名本身就表达设计意图
- 高层 widget 与具体数值解耦
## 当前限制
- 仍然是 header inline 常量函数,而不是数据驱动主题系统
- token 数量已经较多,后续可能需要再分层
- 当前主要围绕唯一默认主题设计
## 相关文档
- [UI](../UI.md)
- [BaseTheme](../BaseTheme/BaseTheme.md)
- [PanelChrome](../PanelChrome/PanelChrome.md)
- [Widgets](../Widgets/Widgets.md)