1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//! `ratada`: a reusable ratatui widget toolkit.
//!
//! The toolkit owns the generic terminal, navigation, rendering and modal
//! building blocks over `ratatui`/`crossterm` (plus `unicode-width`,
//! `nucleo-matcher`, `pulldown-cmark`, `chrono`, `log`) and never depends on
//! any application types. The [`theme`] layer supplies the framework-agnostic
//! styling vocabulary (a [`theme::Palette`] and [`theme::Glyphs`], bundled
//! into a [`theme::Skin`]); the host supplies lifecycle hooks (see
//! [`terminal::Tui::with_hooks`]). Theme colors are mapped to ratatui styles in
//! [`style`].
//!
//! Diagnostics for degraded conditions (a missing clipboard tool, an unreadable
//! directory, an invalid color override, a failed terminal restore on exit) are
//! emitted through the `log` facade at `warn`/`error`; install a logger to
//! surface them.
//!
//! # Example
//!
//! Implement [`Screen`] and hand it to [`run`], which owns the draw/input loop
//! inside a raw-mode [`Tui`] guard:
//!
//! ```no_run
//! use ratada::prelude::*;
//! use ratatui::{Frame, text::Line};
//! use crossterm::event::{KeyCode, KeyEvent};
//!
//! struct App {
//! count: u32,
//! }
//!
//! impl Screen for App {
//! type Error = std::io::Error;
//!
//! fn render(&self, frame: &mut Frame) {
//! frame.render_widget(Line::from(format!("count: {}", self.count)), frame.area());
//! }
//!
//! fn handle_key(&mut self, key: KeyEvent, _tui: &mut Tui) -> std::io::Result<Flow> {
//! match key.code {
//! KeyCode::Char('q') => Ok(Flow::Quit),
//! KeyCode::Char(' ') => {
//! self.count += 1;
//! Ok(Flow::Continue)
//! }
//! _ => Ok(Flow::Continue),
//! }
//! }
//! }
//!
//! let mut tui = Tui::new()?;
//! run(&mut tui, &mut App { count: 0 })?;
//! # Ok::<(), std::io::Error>(())
//! ```
// Every public item carries a doc comment (the library ships to docs.rs); the
// lint keeps that complete as the API grows.
// Terminal geometry mixes u16 (ratatui areas) and usize (indices/lengths); the
// conversions are bounded by the screen size, so these pedantic cast lints are
// allowed crate-wide rather than scattered per call.
// `#[must_use]` on every constructor/getter and a `# Errors` paragraph on every
// I/O wrapper add noise without catching real bugs; the meaningful public APIs
// already document their errors. Allowed crate-wide rather than per item.
pub use ;
pub use ModalSignal;
pub use ;
pub use ;
/// The common imports for building a TUI on `ratada`: the terminal guard, the
/// event-loop driver and the shared box decoration. Glob-import it with
/// `use ratada::prelude::*;`.