weavetui/
lib.rs

1//! # weavetui
2//!
3//! A simple TUI framework for building elegant and responsive terminal applications.
4//!
5//! `weavetui` is built on top of `ratatui` and `tokio`, providing a component-based
6//! architecture that simplifies the development of complex TUIs.
7//!
8//! ## Features
9//!
10//! *   **Component-Based:** Build your UI from reusable components.
11//! *   **Declarative Macros:** Use the `#[component]` macro to reduce boilerplate.
12//! *   **Async Event Handling:** Powered by `tokio` for non-blocking event processing.
13//! *   **Keybinding System:** A simple and flexible keybinding system.
14//!
15//! ## Getting Started
16//!
17//! To get started, add `weavetui` to your `Cargo.toml`:
18//!
19//! ```toml
20//! [dependencies]
21//! weavetui = "0.1.0"
22//! ```
23//!
24//! Then, create a simple application:
25//!
26//! ```rust,no_run
27//! use weavetui::prelude::*;
28//!
29//! #[component(default)]
30//! struct MyComponent;
31//!
32//! #[tokio::main]
33//! async fn main() -> anyhow::Result<()> {
34//!     let mut app = App::new([("<q>", "app:quit")], vec![Box::new(MyComponent::default())]);
35//!     app.run().await?;
36//!     Ok(())
37//! }
38//! ```
39
40/// A prelude for `weavetui` applications.
41///
42/// This prelude re-exports the most commonly used traits and types from the `weavetui` ecosystem.
43pub mod prelude {
44    pub use weavetui_core::{
45        Component, ComponentAccessor,
46        app::App,
47        components,
48        event::{Action, Event},
49        kb,
50        keyboard::{KeyBindings, key_event_to_string},
51        tui::Tui,
52    };
53    pub use weavetui_derive::component;
54}
55
56pub use weavetui_core::{Component, ComponentAccessor, app, components, event, kb, keyboard, tui};
57pub use weavetui_derive::component;