### Overview Add event propagation system for UI that handles focus, hover tracking, and input event routing to the correct widget. ### Current State _No response_ ### Scope **Goals:** - Focus management (which widget receives keyboard input) - Hover tracking for mouse enter/leave - Event bubbling (child to parent) - Event capture (parent before child) **Non-Goals:** - Custom event types - Event cancellation ### Proposed API ```rust pub struct UiContext { root: Box<dyn Widget>, focused: Option<WidgetId>, hovered: Option<WidgetId>, } impl UiContext { pub fn new(root: impl Widget + 'static) -> Self; pub fn handle_mouse_move(&mut self, x: f32, y: f32); pub fn handle_mouse_button(&mut self, button: Button, pressed: bool); pub fn handle_key(&mut self, key: Key); pub fn set_focus(&mut self, widget: WidgetId); pub fn focused(&self) -> Option<WidgetId>; pub fn render(&mut self, ctx: &mut RenderContext) -> Vec<RenderCommand>; } ``` ### Acceptance Criteria - [ ] Click sets focus to clicked widget - [ ] Tab key moves focus to next widget - [ ] Keyboard events go to focused widget - [ ] Mouse enter/leave tracked for hover states - [ ] Parent widgets can intercept events ### Affected Crates lambda-rs ### Notes - Widget IDs needed for focus tracking - Consider focus order (tab index)
Activity