Skip to main content

tui_pages/
lib.rs

1//! Coordination runtime for keyboard-driven, page-based TUI applications.
2//!
3//! The crate is intentionally domain-agnostic: applications own their action
4//! enum, view/page enum, and state. The library owns the coordination model —
5//! input sequences, command resolution, focus, overlays, navigation, buffers,
6//! and panes — and applies the [`TuiEffect`] values an application returns.
7//!
8//! [`TuiPages`] is the primary entry point. The submodules ([`input`],
9//! [`command`], [`focus`], [`navigation`]) expose the same primitives for
10//! advanced callers that want to wire the flow themselves.
11
12pub mod command;
13#[cfg(feature = "dialog")]
14pub mod dialog;
15pub mod focus;
16pub mod input;
17pub mod navigation;
18pub mod runtime;
19pub mod terminal;
20
21#[cfg(feature = "dialog")]
22pub use dialog::{render_dialog, DialogData, DialogKey, DialogResult, DialogTheme};
23
24pub use command::{CommandHint, CommandRegistry, CommandResolver, CommandResponse};
25pub use focus::{
26    FocusController, FocusIntent, FocusManager, FocusQuery, FocusTarget, FocusWrap, Focusable,
27    OverlayFocus, PageFocusBuilder,
28};
29pub use input::{
30    parse_binding, parse_key, try_parse_binding, try_parse_key, ChordSequenceTracker, InputHint,
31    InputPipeline, InputRegistry, KeyChord, KeyMap, ParseKeyError, PipelineResponse,
32};
33pub use navigation::{
34    BufferState, NavigationCoordinator, NavigationEvent, NavigationResult, NavigationRouter,
35    PaneId, PaneSession, PaneSplit, ViewBuffer, WorkspaceState,
36};
37pub use runtime::{
38    modes, ActionContext, ActionOutcome, ModeId, PageFn, PageProvider, PageSpec, TuiActionHandler,
39    TuiApp, TuiEffect, TuiPages, TuiPagesBuilder, TuiPagesError, TuiPagesOutput, TuiPagesResult,
40    TuiPagesStatus,
41};
42pub use terminal::{enter as enter_terminal, TerminalGuard};
43
44/// Everything a typical application needs in one glob import.
45///
46/// ```ignore
47/// use tui_pages::prelude::*;
48/// ```
49///
50/// This pulls in the runtime, the focus types, and — crucially — the
51/// [`FocusController`] trait, whose [`apply_focus_intent`](FocusController::apply_focus_intent)
52/// method is otherwise invisible until the trait is in scope. With the
53/// `dialog` feature it also brings in the dialog content, result, theme,
54/// renderer, and the `dialog::*` driver helpers.
55pub mod prelude {
56    pub use crate::terminal;
57    pub use crate::{
58        modes, parse_binding, try_parse_binding, ActionContext, ActionOutcome, FocusController,
59        FocusIntent, FocusManager, FocusQuery, FocusTarget, FocusWrap, KeyChord, ModeId, PageFn,
60        PageFocusBuilder, PageProvider, PageSpec, ParseKeyError, TerminalGuard, TuiActionHandler,
61        TuiApp, TuiEffect, TuiPages, TuiPagesOutput, TuiPagesStatus,
62    };
63
64    #[cfg(feature = "dialog")]
65    pub use crate::dialog::{self, DialogData, DialogKey, DialogResult, DialogTheme};
66    #[cfg(feature = "dialog")]
67    pub use crate::render_dialog;
68}