tui: app-level event loop and state machine #16
Labels
No labels
area:agents
area:ai
area:config
area:dashboard
area:design
area:design-review
area:devtools
area:entities
area:gallery
area:generate
area:image
area:infra
area:meta
area:model-browser
area:navigation
area:presets
area:security
area:sessions
area:settings
area:sharing
area:test
area:ux
area:webhook
area:workdir
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/loom#16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
User story
As a developer adding new screens to loom-tui, I want a unified event loop, a top-level
Appstate machine, and a routing system between screens, so that every screen plugs into the same event and render pipeline without reinventing it.Acceptance criteria
Event enum
loom_tui::event::Eventunifies input and async sources:Key(KeyEvent),Mouse(MouseEvent),Paste(String),Resize(u16, u16),FocusGained,FocusLost,Tick,CoreMsg(loom_core::CoreEvent),QuitEventStreammerges crossterm events, a 250 ms tick, and aloom-corebroadcast/mpsc subscription into a singleStream<Item = Event>App state machine
Appowns aScreenenum (Generate,Gallery,ModelBrowser,Entities,Presets,Settings) and an optional stack ofOverlays (help, palette, queue, share, image viewer)App::handle_event(&mut self, event: Event)dispatches in order: overlay stack (top-first), current screen, then global bindingstrait Screen { fn handle(&mut self, ctx: &mut AppCtx, event: &Event); fn render(&mut self, ctx: &AppCtx, frame: &mut Frame, area: Rect); }AppCtxcarriesArc<loom_core::PluginBridge>, anmpsc::Sender<AppAction>, the chosenBox<dyn ImageRenderer>, and the loadedAppSettingsRouting
AppAction::Navigate(Screen::Gallery)andAppAction::PushOverlay(Overlay::Help)fire through the shared sender; the main loop applies them before the next renderTests
App::currentand preserves scroll state on returnEscwithout forwarding the event to the underlying screenOut of scope
References