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
//! # tui-world
//!
//! A state and event management library for TUIs built with [ratatui](https://github.com/ratatui/ratatui).
//!
//! ## Core Concepts
//!
//! - [`World`] - A container that holds application state
//! - [`Keybindings`] - Key binding registry with built-in help display
//! - [`Focus`] - Tracks which widget currently has keyboard focus
//! - [`Pointer`] - Tracks widget areas and handles mouse click/drag/up events
//! - [`InputEvent`] - Unified input event handling for keyboard and mouse
//!
//! ## Example
//!
//! ```ignore
//! use tui_world::prelude::*;
//! use crossterm::event::KeyCode;
//!
//! const WIDGET_ID: WidgetId = WidgetId("MyWidget");
//!
//! let mut world = World::default();
//!
//! // Store state in world
//! world.insert(MyAppState::default());
//!
//! // Register keybindings
//! world.get_mut::<Keybindings>().bind(WIDGET_ID, KeyCode::Enter, "Select", |world| {
//! world.get_mut::<MyAppState>().select();
//! });
//!
//! // Check focus
//! if world.get::<Focus>().is_focused(WIDGET_ID) {
//! // widget has focus
//! }
//!
//! // Handle key events
//! InputEvent::Key(key).handle(&mut world, &[WIDGET_ID]);
//! ```
pub use Focus;
pub use InputEvent;
pub use ;
pub use ;
pub use World;
/// A unique identifier for a widget in the application.
///
/// `WidgetId` is used to associate keybindings, focus state, and pointer areas
/// with specific widgets. It wraps a static string slice for efficient comparison
/// and hashing.
///
/// # Example
/// ```ignore
/// const MY_WIDGET: WidgetId = WidgetId("my_widget");
/// ```
;