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
//! # limit-tui
//!
//! [](https://crates.io/crates/limit-tui)
//! [](https://docs.rs/limit-tui)
//! [](https://opensource.org/licenses/MIT)
//!
//! **Terminal UI components with Virtual DOM rendering for Rust applications.**
//!
//! Build rich terminal interfaces with a component model, powered by
//! [Ratatui](https://ratatui.rs/). Features declarative rendering, diff-based
//! updates, and built-in syntax highlighting.
//!
//! ## Features
//!
//! - **Virtual DOM**: Component model with diff-based rendering
//! - **Pre-built components**: Chat views, inputs, spinners, progress bars, select menus
//! - **Syntax highlighting**: Built-in support for 150+ languages via Syntect
//! - **Event handling**: Keyboard, mouse, and resize events
//!
//! ## Virtual DOM
//!
//! Build UIs with `VNode`:
//!
//! ```rust
//! use limit_tui::vdom::VNode;
//! use std::collections::HashMap;
//!
//! let ui = VNode::Element {
//! tag: "div".to_string(),
//! attrs: HashMap::new(),
//! children: vec![
//! VNode::Text("Hello, World!".to_string()),
//! ],
//! };
//! ```
//!
//! ### Diff-Based Updates
//!
//! The Virtual DOM computes minimal changes:
//!
//! ```rust
//! use limit_tui::vdom::{diff, apply, VNode};
//!
//! let old_tree = VNode::Text("Hello".to_string());
//! let new_tree = VNode::Text("Hello, World!".to_string());
//!
//! let patches = diff(&old_tree, &new_tree);
//! // patches contains minimal changes to transform old → new
//! ```
//!
//! ## Components
//!
//! | Component | Description |
//! |-----------|-------------|
//! | [`ChatView`] | Conversation display with role-based styling |
//! | [`InputPrompt`] | Interactive text input with placeholder |
//! | [`SelectPrompt`] | Single/multi-select menus |
//! | [`Spinner`] | Loading spinner with label |
//! | [`ProgressBar`] | Progress indicator |
//!
//! ## Syntax Highlighting
//!
//! ```rust,no_run
//! use limit_tui::SyntaxHighlighter;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let highlighter = SyntaxHighlighter::new()?;
//!
//! let code = highlighter.highlight_to_spans(r#"
//! fn main() {
//! println!("Hello, World!");
//! }
//! "#, "rust")?;
//!
//! // Returns styled spans with syntax colors
//! # Ok(())
//! # }
//! ```
pub use ;
pub use ;
pub use ;
pub use ;
pub use SyntaxHighlighter;
pub use ;