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
//! Tree view widget for hierarchical data display.
//!
//! This module provides a complete tree view implementation with:
//! - `TreeNode` - Hierarchical data structure for tree nodes
//! - `NodeState` - State information for rendering nodes
//! - `TreeViewState` - Selection, expansion, and filter state
//! - `TreeView` - The main widget (takes ownership of nodes)
//! - `TreeViewRef` - Widget that borrows nodes (avoids cloning)
//! - `TreeNavigator` - Keyboard navigation with configurable keybindings
//! - `TreeKeyBindings` - Customizable keybindings for navigation
//!
//! # Example
//!
//! ```rust
//! use ratatui_toolkit::tree_view::{TreeNode, TreeView, TreeViewState};
//!
//! let nodes = vec![
//! TreeNode::with_children("Root", vec![
//! TreeNode::new("Child 1"),
//! TreeNode::new("Child 2"),
//! ]),
//! ];
//!
//! let tree = TreeView::new(nodes)
//! .render_fn(|data, state| {
//! ratatui::text::Line::from(*data)
//! });
//!
//! let mut state = TreeViewState::new();
//! ```
// Re-export keybindings
pub use TreeKeyBindings;
// Re-export helpers
pub use get_visible_paths;
pub use get_visible_paths_filtered;
pub use matches_filter;
// Re-export node_state
pub use NodeState;
// Re-export tree_navigator
pub use TreeNavigator;
// Re-export tree_node
pub use TreeNode;
// Re-export widget
pub use NodeRenderFn;
pub use TreeView;
// Re-export tree_view_ref
pub use NodeFilterFn;
pub use NodeRenderRefFn;
pub use TreeViewRef;
// Re-export tree_view_state
pub use TreeViewState;