Expand description
Most users should not add this crate as a dependency. Use apalis-rtui’s ui feature,
which serves this crate’s web build for you, or install the standalone terminal client with
cargo install apalis-tui and run apalis-tui --api http://127.0.0.1:8080/api/v1
(docs/PLAN.md §8.4).
The apalis-rtui ratatui dashboard: one codebase, a native terminal binary and a WebAssembly
bundle, both plain HTTP clients of the apalis-rtui JSON API. A host application depends on
apalis-rtui to mount that API and ServeUI, and ServeUI already serves this crate’s web
build as a static asset (apalis-rtui/assets/tui-web-dist/, built once by CI and vendored in,
never rebuilt on a consumer’s machine). Reach for the crate itself to work on the dashboard.
Repository: https://github.com/ngriaznov/apalis-rtui.
Every module here compiles and runs on the host target with no feature enabled (cargo test -p apalis-tui), which is what makes it unit- and snapshot-testable without a browser, a wasm
target, or a running server:
app:App, the one state machine both backends drive: screens, selection, the hit-region mouse model, the confirm dialog, capability-gated actions.data: thedata::DataSourcetrait a backend implements, the pureapply_*functions that fold a fetched value intoApp’s data, and theCompact-args decode (§7.3).theme: the Phosphor Slate palette and style helpers.keymap: the keyboard referenceApp::keyand the Help overlay both read from.draw: onedrawfunction per screen.input: backend-agnostic key/mouse event types.hash: thewebbuild’s#/<screen>/…deep-link format, parsed and formatted with noweb_sysdependency so it is unit-tested here on the host target.backend: theweb(wasm32 + ratzilla) andnative(crossterm + reqwest) data/event loops. See its module docs for the wiring points a backend implementation builds against.nativeis a default feature, socargo install apalis-tuibuilds the terminal client and nothing else.webis opt-in and onlybuild-web.shasks for it.
Re-exports§
pub use app::Action;pub use app::App;pub use app::Origin;pub use app::PendingAction;pub use app::Screen;pub use app::describe_action_outcome;pub use data::Data;pub use hash::Route;pub use hash::RouteScreen;pub use input::KeyCode;pub use input::KeyEvent;pub use input::MouseButton;pub use input::MouseEvent;pub use input::MouseEventKind;pub use theme::Theme;
Modules§
- app
App: the one state machine both thewebandnativebackends drive. Owns every screen’s selection state, the hit-region mouse model, the confirm dialog and toast, and the capability-gated action pipeline. Nothing here performs I/O (docs/PLAN.md§5.2). A backend feeds it fetched/SSE data throughcrate::data’sapply_*functions andApp::data_mut, then drainsApp::take_pending_actionto actually perform a confirmed action.- backend
- The
webandnativedata/event loops.web(featureweb, wasm32) andnative(featurenative, any other target) both implement the same contract, documented once below. - data
- The data boundary: query constants, the pure functions that fold a fetched wire value into
Data, the best-effortCompactbyte-array decode (§7.3), and theDataSourcetrait theweb/nativebackends implement against. - draw
- Draw orchestration: the tab bar, statusline, and modal overlays every screen shares, plus the
button/gated_buttonhelpers every per-screen module composes from. Onedrawfunction per screen lives in the sibling modules. This file is only what wraps around all of them. - hash
- The
#/<screen>/<queue>/<status>/<page>/<task_id>hash-fragment route format (docs/PLAN.md§3.7), used byapalis-tui’swebbuild only. - input
- Backend-agnostic input types: this crate’s own small mirrors of
ratzilla::event, socrate::apphas no web dependency. Thewebbackend converts realratzillaevents into these. Thenativebackend converts realcrosstermevents into these. Native tests construct them directly. - keymap
- The keyboard reference shown by the Help overlay, as data instead of hand-typed text.
- theme
- The “Phosphor Slate” palette (
docs/design/variant-a-terminal.md§2.1) asColor::Rgbconstants, plus the eight style-helper functions everydraw_*module composes from (§2.2) and the status/level glyph tables (§2.4).