Parent: #126
Corresponds to EN-030 in docs/tickets.md
Problem
Bloom has drawing/text/input primitives but no reusable runtime UI layer. Each game must reimplement layout, focus, clipping, input routing, text editing, scaling, and widget state. Unity-like simplicity requires a supported game UI—not necessarily an editor UI.
Outcome
A retained/immediate-hybrid runtime UI module with deterministic layout, batched rendering, pointer/keyboard/gamepad navigation, text input, clipping, styling, accessibility metadata, and platform-safe scaling.
Architecture
Tree and identity
- Stable widget IDs and parent/child tree.
- Reconciliation/update model that works within Perry's supported TypeScript and avoids per-frame object churn.
- Explicit retained state for focus, scroll, selection, text edit, animation, and user data.
- Safe destruction/reparenting during event handling.
Layout
- Minimum flex row/column, absolute overlay, padding/margin/gap, min/max/fixed/percent sizing, alignment, and scroll containers.
- Measure/layout pass handles text and images without recursive instability.
- DPI/safe-area/logical-pixel model is consistent across desktop, mobile, web, TV, and watch constraints.
- Pixel snapping and fractional scale behavior are defined.
Input/events
- Hit testing respects transform, clip, z-order, visibility, and disabled state.
- Capture/bubble or another documented deterministic propagation model.
- Pointer capture, hover/press/click/drag/scroll.
- Keyboard focus, tab order, gamepad/remote directional navigation.
- UTF-8 text entry, composition/IME where platform support exists, selection, clipboard capability, and password-safe display behavior.
Rendering
- Batch quads/images/glyphs; nested clipping uses scissor and bounded stencil only when needed.
- UI composition point relative to HDR/tonemap/post-FX is explicit; default HUD text remains crisp and color-correct.
- Support atlas/font/image residency changes without stale handles.
- Debug overlay shows bounds, clips, focus, event target, batch count, and overdraw.
Accessibility
- Widget role, label, value, state, and action metadata in the core model.
- Implement native accessibility bridges where feasible; capability-report unsupported targets rather than discarding metadata.
Minimum widgets
Panel/stack, image, text, button, toggle, slider, progress, text field, scroll view/list, and focus/navigation container. Complex data grids/editor widgets are out of scope.
Acceptance criteria
Likely files
- new
src/ui/ module
- batched UI renderer/native hooks under
native/shared/src/
- text/input/platform bridge modules
- examples and golden tests
Non-goals
- Unreal/Unity editor UI.
- HTML/CSS compatibility.
- Shipping every native accessibility bridge in the first PR; metadata and capability contract are required.
Dependencies
Parent: #126
Corresponds to EN-030 in
docs/tickets.mdProblem
Bloom has drawing/text/input primitives but no reusable runtime UI layer. Each game must reimplement layout, focus, clipping, input routing, text editing, scaling, and widget state. Unity-like simplicity requires a supported game UI—not necessarily an editor UI.
Outcome
A retained/immediate-hybrid runtime UI module with deterministic layout, batched rendering, pointer/keyboard/gamepad navigation, text input, clipping, styling, accessibility metadata, and platform-safe scaling.
Architecture
Tree and identity
Layout
Input/events
Rendering
Accessibility
Minimum widgets
Panel/stack, image, text, button, toggle, slider, progress, text field, scroll view/list, and focus/navigation container. Complex data grids/editor widgets are out of scope.
Acceptance criteria
Likely files
src/ui/modulenative/shared/src/Non-goals
Dependencies