Appearance
声明式菜单 Schema
系统概览
Menu Declarative Schema(ADR-093):单一数据源 + 单渲染器,消除命令式 builder 膨胀。当前状态 P0+P1+P2 全量落地(57 面板),P3 类型化增强中。
核心职责
StatePath— 类型化状态路径(env.*/render.*/light.*/ui.*/perception.*/motionModule.*),由解析器按前缀映射到 reactive state 对象MenuKind—folder/slider/colorSlider/toggle/modeSlider/modeRow/sectionTitle/divider/customControlSpec—bind(StatePath) +min/max/step/icon/options+ 衍生get/set(状态值↔控件值转换,如 windDirection→角度)+onChange副作用(如 reflectionQuality 变化后重建水体)MenuNode— 声明式菜单节点树,由单渲染器renderMenu统一渲染
对外 API(节选)
StatePath/MenuKind/ControlSpec/MenuNode类型- 状态路径解析器(前缀 → reactive state 映射)
renderMenu(统一渲染器,被各菜单消费)
关键约定
- 控件与状态双向绑定经
get/set衍生转换,避免硬编码转换逻辑散落 onChange副作用需幂等(重复触发安全)
与其他子系统关系
- 被
env-menu.ts/scene-menu.ts/settings.ts等消费的菜单声明 - 状态源来自
core/config(envState/uiState)、scene/render/lighting、scene/motion/perception、motion-modules/registry - 渲染经
render-menu.ts
UI 入口
- 菜单层级 / 入口函数 / 快捷键统一由 menu-map.md 机器生成(勿手改)。
- 运行时动态生成的菜单项(renderCustom / slideRow 等)无法静态提取,缺口由本卡正文说明。