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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
//! # Hojicha Core
//!
//! Core Elm Architecture (TEA) abstractions for building terminal user interfaces in Rust.
//!
//! This crate provides the fundamental building blocks of The Elm Architecture:
//!
//! ## The Elm Architecture
//!
//! Hojicha implements The Elm Architecture (TEA), a pattern for building interactive
//! applications with a clear separation of concerns:
//!
//! - **Model**: Your application state
//! - **Message**: Events that trigger state changes
//! - **Update**: Pure functions that handle messages and update state
//! - **View**: Pure functions that render your model to the terminal
//! - **Command**: Side effects that produce messages
//!
//! ## Core Traits
//!
//! - [`Model`]: The main trait your application must implement
//! - [`Message`]: Marker trait for your application's message types
//! - [`Cmd`]: Commands for side effects and async operations
//!
//! ## Example
//!
//! ```no_run
//! use hojicha_core::{Model, Cmd};
//!
//! struct App {
//! counter: u32,
//! }
//!
//! enum Msg {
//! Increment,
//! Decrement,
//! }
//!
//! impl Model for App {
//! type Message = Msg;
//!
//! fn update(&mut self, event: hojicha_core::Event<Self::Message>) -> Cmd<Self::Message> {
//! match event {
//! hojicha_core::Event::User(Msg::Increment) => self.counter += 1,
//! hojicha_core::Event::User(Msg::Decrement) => self.counter -= 1,
//! _ => {}
//! }
//! Cmd::noop()
//! }
//!
//! fn view(&self) -> String {
//! // Render your UI to a string
//! format!("Counter: {}", self.counter)
//! }
//! }
//! ```
// Core TEA abstractions
// Testing utilities (only in tests)
// Testing utilities (exported for use in tests and examples)
// Re-export core types
pub use ;
pub use ;
pub use ;
// Re-export command constructors
pub use ;
/// Prelude module for convenient imports
///
/// This module provides the most commonly used types and functions for building
/// Hojicha applications. Import everything with:
///
/// ```
/// use hojicha_core::prelude::*;
/// ```
///
/// ## Included Items
///
/// ### Core Traits
/// - [`Model`] - The main trait your application implements
/// - [`Message`] - Marker trait for messages
/// - [`Cmd`] - Commands for side effects
///
/// ### Events
/// - [`Event`] - All event types (Key, Mouse, User, etc.)
/// - [`Key`], [`KeyEvent`], [`KeyModifiers`] - Keyboard handling
/// - [`MouseEvent`] - Mouse events
///
/// ### Commands
/// - [`none()`] - No-op command
/// - [`batch()`] - Run commands concurrently
/// - [`sequence()`] - Run commands in order
/// - [`tick()`] - Delayed command
/// - [`every()`] - Recurring command
/// - [`quit()`] - Exit the program
///
/// ### Error Handling
/// - [`Result`] - Hojicha's Result type
/// - [`Error`] - Hojicha's Error type
///
/// ### Rendering
/// - String-based rendering with ANSI escape codes
// Users will directly import hojicha-runtime as a separate crate