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
//! # Cauldron
//!
//! A powerful TUI framework based on The Elm Architecture.
//!
//! Cauldron is the Rust equivalent of [bubbletea](https://github.com/charmbracelet/bubbletea)
//! from Charmbracelet. It provides a simple, functional approach to building
//! terminal user interfaces.
//!
//! ## The Elm Architecture
//!
//! Cauldron follows The Elm Architecture (TEA):
//!
//! 1. **Model** - Your application state
//! 2. **Message** - Events that can update the state
//! 3. **Update** - A function that updates the model based on messages
//! 4. **View** - A function that renders the model to the terminal
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use cauldron::{App, Command, Model};
//!
//! // Define your model
//! struct Counter {
//! count: i32,
//! }
//!
//! // Define your messages
//! enum Msg {
//! Increment,
//! Decrement,
//! Quit,
//! }
//!
//! impl Model for Counter {
//! type Message = Msg;
//!
//! fn update(&mut self, msg: Self::Message) -> Command<Self::Message> {
//! match msg {
//! Msg::Increment => self.count += 1,
//! Msg::Decrement => self.count -= 1,
//! Msg::Quit => return Command::quit(),
//! }
//! Command::none()
//! }
//!
//! fn view(&self) -> String {
//! format!("Count: {}\n\nPress +/- to change, q to quit", self.count)
//! }
//! }
//!
//! fn main() {
//! let counter = Counter { count: 0 };
//! cauldron::run(counter).unwrap();
//! }
//! ```
//!
//! ## Features
//!
//! - **Simple API** - Just implement `Model` and you're done
//! - **Async Support** - Commands can spawn async tasks
//! - **Key Handling** - Built-in keyboard input handling
//! - **Mouse Support** - Optional mouse event handling
//! - **Alternate Screen** - Automatic alternate screen buffer management
pub use App;
pub use ;
pub use ;
pub use ;
pub use Model;
pub use ;
pub use Renderer;
/// Run a model as a full-screen TUI application.
///
/// This is the main entry point for most applications.
///
/// # Example
///
/// ```rust,no_run
/// use cauldron::{Model, Command};
///
/// struct MyApp;
///
/// impl Model for MyApp {
/// type Message = ();
///
/// fn update(&mut self, _msg: ()) -> Command<()> {
/// Command::quit()
/// }
///
/// fn view(&self) -> String {
/// "Hello, Cauldron!".to_string()
/// }
/// }
///
/// cauldron::run(MyApp).unwrap();
/// ```
/// Run a model with custom options.
/// Batch multiple commands together.