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
//! A3S TUI - TEA (The Elm Architecture) framework for terminal user interfaces.
//!
//! This library provides a declarative way to build terminal applications using
//! The Elm Architecture pattern, with Flexbox layout powered by Taffy and
//! incremental rendering for optimal performance.
//!
//! # Quick Start
//!
//! ```rust,no_run
//! use a3s_tui::{cmd, col, text, Element, ElementModel, ElementProgramBuilder};
//! use a3s_tui::{Event, KeyCode, TextElement};
//! use a3s_tui::style::Color;
//!
//! struct Counter { count: i64 }
//!
//! enum Msg {
//! Increment,
//! Decrement,
//! Quit,
//! }
//!
//! impl From<Event> for Msg {
//! fn from(event: Event) -> Self {
//! match event {
//! Event::Key(key) if key.code == KeyCode::Up => Msg::Increment,
//! Event::Key(key) if key.code == KeyCode::Down => Msg::Decrement,
//! Event::Key(key) if key.code == KeyCode::Char('q') => Msg::Quit,
//! _ => Msg::Increment,
//! }
//! }
//! }
//!
//! impl ElementModel for Counter {
//! type Msg = Msg;
//!
//! fn update(&mut self, msg: Msg) -> Option<cmd::Cmd<Msg>> {
//! match msg {
//! Msg::Increment => { self.count += 1; None }
//! Msg::Decrement => { self.count -= 1; None }
//! Msg::Quit => Some(cmd::quit()),
//! }
//! }
//!
//! fn view(&self) -> Element<Msg> {
//! col![
//! text!(""),
//! Element::Text(
//! TextElement::new(format!("Counter: {}", self.count))
//! .bold()
//! .fg(Color::Cyan)
//! ),
//! ]
//! }
//! }
//!
//! #[tokio::main]
//! async fn main() -> std::io::Result<()> {
//! ElementProgramBuilder::new(Counter { count: 0 })
//! .with_alt_screen()
//! .with_fps(30)
//! .run()
//! .await
//! }
//! ```
pub use Cmd;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use Theme;