tui_dispatch/
lib.rs

1//! tui-dispatch: Centralized state management for Rust TUI apps
2//!
3//! Like Redux/Elm, but for terminals. Components are pure functions of state,
4//! and all state mutations happen through dispatched actions.
5//!
6//! # Example
7//! ```ignore
8//! use tui_dispatch::prelude::*;
9//!
10//! #[derive(Action, Clone, Debug)]
11//! enum MyAction {
12//!     NextItem,
13//!     PrevItem,
14//! }
15//!
16//! #[derive(ComponentId, Clone, Copy, PartialEq, Eq, Hash, Debug)]
17//! enum MyComponentId {
18//!     List,
19//!     Detail,
20//! }
21//! ```
22
23// Re-export everything from core
24pub use tui_dispatch_core::*;
25
26// Re-export derive macros
27pub use tui_dispatch_macros::{Action, BindingContext, ComponentId, DebugState, FeatureFlags};
28
29/// Prelude for convenient imports
30pub mod prelude {
31    // Traits
32    pub use tui_dispatch_core::{Action, ActionCategory, BindingContext, Component, ComponentId};
33
34    // Event system
35    pub use tui_dispatch_core::{
36        process_raw_event, spawn_event_poller, Event, EventBus, EventContext, EventKind, EventType,
37        NumericComponentId, RawEvent,
38    };
39
40    // Keybindings
41    pub use tui_dispatch_core::{format_key_for_display, parse_key_string, Keybindings};
42
43    // Store
44    pub use tui_dispatch_core::{
45        ComposedMiddleware, LoggingMiddleware, Middleware, NoopMiddleware, Reducer, Store,
46        StoreWithMiddleware,
47    };
48
49    // Debug
50    pub use tui_dispatch_core::debug::{
51        ActionLoggerConfig, ActionLoggerMiddleware, DebugFreeze, DebugOverlay, DebugTableBuilder,
52    };
53
54    // Derive macros
55    pub use tui_dispatch_macros::{Action, BindingContext, ComponentId, DebugState, FeatureFlags};
56
57    // Ratatui re-exports
58    pub use tui_dispatch_core::{Color, Frame, Line, Modifier, Rect, Span, Style, Text};
59}