tuyere 0.1.0

A powerful TUI framework based on The Elm Architecture 🔮
Documentation
//! # 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

#![warn(missing_docs)]
#![warn(clippy::all)]
#![deny(unsafe_code)]

mod app;
mod command;
mod event;
mod key;
mod model;
mod program;
mod renderer;

pub use app::App;
pub use command::{Cmd, Command};
pub use event::{Event, MouseEvent};
pub use key::{Key, KeyModifiers};
pub use model::Model;
pub use program::{Program, ProgramOptions};
pub use renderer::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();
/// ```
pub fn run<M: Model + 'static>(model: M) -> std::io::Result<()> {
    Program::new(model).run()
}

/// Run a model with custom options.
pub fn run_with_options<M: Model + 'static>(
    model: M,
    options: ProgramOptions,
) -> std::io::Result<()> {
    Program::with_options(model, options).run()
}

/// Batch multiple commands together.
pub fn batch<M>(commands: Vec<Command<M>>) -> Command<M> {
    Command::batch(commands)
}