1#![cfg_attr(docsrs, feature(doc_cfg))]
65
66pub mod primitives;
68
69pub mod widgets;
70
71pub mod services;
73
74pub use primitives::button::render_title_with_buttons::render_title_with_buttons;
76pub use primitives::button::Button;
77pub use primitives::pane::Pane;
78pub use widgets::ai_chat::{AIChat, AIChatEvent, InputState, Message, MessageRole, MessageStore};
79pub use widgets::code_diff::{CodeDiff, DiffConfig, DiffHunk, DiffLine, DiffLineKind, DiffStyle};
80pub use widgets::split_layout::SplitLayoutWidget;
81pub use widgets::split_layout::SplitLayoutWidgetState;
82
83#[cfg(feature = "dialog")]
85pub use primitives::dialog::widget::DialogWidget;
86#[cfg(feature = "dialog")]
87pub use primitives::dialog::{Dialog, DialogType};
88
89#[cfg(feature = "toast")]
90pub use primitives::toast::methods::render_toasts::render_toasts;
91#[cfg(feature = "toast")]
92pub use primitives::toast::{Toast, ToastLevel, ToastManager};
93
94#[cfg(feature = "split")]
95pub use primitives::resizable_split::{ResizableSplit, SplitDirection};
96#[cfg(feature = "split")]
97pub use primitives::split_layout::{PaneId, PaneLayout, SplitAxis, SplitLayout};
98
99#[cfg(feature = "tree")]
100pub use primitives::tree_view::{
101 get_visible_paths, matches_filter, NodeState, TreeKeyBindings, TreeNavigator, TreeNode,
102 TreeView, TreeViewRef, TreeViewState,
103};
104
105#[cfg(feature = "menu")]
106pub use primitives::menu_bar::{MenuBar, MenuItem};
107
108#[cfg(feature = "statusline")]
109pub use primitives::statusline::{
110 OperationalMode, StatusLineStacked, StyledStatusLine, SLANT_BL_TR, SLANT_TL_BR,
111};
112
113#[cfg(feature = "hotkey")]
114pub use widgets::hotkey_footer::{HotkeyFooter, HotkeyFooterBuilder, HotkeyItem};
115
116#[cfg(feature = "hotkey")]
117#[cfg(feature = "markdown")]
118pub use widgets::markdown_widget::{
119 render_markdown, render_markdown_with_style, CacheState, CodeBlockTheme, CollapseState,
120 DisplaySettings, DoubleClickState, ExpandableState, GitStats, GitStatsState,
121 MarkdownDoubleClickEvent, MarkdownEvent, MarkdownState, MarkdownStyle, MarkdownWidget,
122 MarkdownWidgetMode, ScrollState, SelectionPos, SelectionState, SourceState, VimState,
123};
124
125#[cfg(feature = "terminal")]
126pub use primitives::termtui::{TermTui, TermTuiKeyBindings};
127
128#[cfg(feature = "file-tree")]
129pub use widgets::file_system_tree::{FileSystemEntry, FileSystemTree, FileSystemTreeConfig};
130
131#[cfg(feature = "theme")]
132pub use services::theme::{AppTheme, DiffColors, MarkdownColors, SyntaxColors, ThemeVariant};
133
134pub use services::file_watcher::{FileWatcher, WatchConfig, WatchMode};
136
137pub mod prelude {
145 pub use crate::primitives::button::render_title_with_buttons::render_title_with_buttons;
147 pub use crate::primitives::button::Button;
148 pub use crate::primitives::pane::Pane;
149 pub use crate::widgets::ai_chat::{
150 AIChat, AIChatEvent, InputState, Message, MessageRole, MessageStore,
151 };
152 pub use crate::widgets::code_diff::{
153 CodeDiff, DiffConfig, DiffHunk, DiffLine, DiffLineKind, DiffStyle,
154 };
155
156 #[cfg(feature = "dialog")]
158 pub use crate::primitives::dialog::widget::DialogWidget;
159 #[cfg(feature = "dialog")]
160 pub use crate::primitives::dialog::{Dialog, DialogType};
161
162 #[cfg(feature = "toast")]
163 pub use crate::primitives::toast::methods::render_toasts::render_toasts;
164 #[cfg(feature = "toast")]
165 pub use crate::primitives::toast::{Toast, ToastLevel, ToastManager};
166
167 #[cfg(feature = "split")]
168 pub use crate::primitives::resizable_split::{ResizableSplit, SplitDirection};
169 #[cfg(feature = "split")]
170 pub use crate::primitives::split_layout::{PaneId, PaneLayout, SplitAxis, SplitLayout};
171 #[cfg(feature = "split")]
172 pub use crate::widgets::split_layout::{SplitLayoutWidget, SplitLayoutWidgetState};
173
174 #[cfg(feature = "tree")]
175 pub use crate::primitives::tree_view::{
176 get_visible_paths, matches_filter, NodeState, TreeKeyBindings, TreeNavigator, TreeNode,
177 TreeView, TreeViewRef, TreeViewState,
178 };
179
180 #[cfg(feature = "menu")]
181 pub use crate::primitives::menu_bar::{MenuBar, MenuItem};
182
183 #[cfg(feature = "statusline")]
184 pub use crate::primitives::statusline::{
185 OperationalMode, StatusLineStacked, StyledStatusLine, SLANT_BL_TR, SLANT_TL_BR,
186 };
187
188 #[cfg(feature = "hotkey")]
189 pub use crate::widgets::hotkey_footer::{HotkeyFooter, HotkeyFooterBuilder, HotkeyItem};
190
191 #[cfg(feature = "markdown")]
192 pub use crate::widgets::markdown_widget::{
193 render_markdown, render_markdown_with_style, CacheState, CollapseState, DisplaySettings,
194 DoubleClickState, ExpandableState, GitStatsState, MarkdownState, MarkdownStyle,
195 MarkdownWidget, ScrollState, SelectionState, SourceState, VimState,
196 };
197
198 #[cfg(feature = "terminal")]
199 pub use crate::primitives::termtui::{TermTui, TermTuiKeyBindings};
200
201 #[cfg(feature = "file-tree")]
202 pub use crate::widgets::file_system_tree::{
203 FileSystemEntry, FileSystemTree, FileSystemTreeConfig,
204 };
205
206 #[cfg(feature = "theme")]
207 pub use crate::services::theme::{
208 AppTheme, DiffColors, MarkdownColors, SyntaxColors, ThemeVariant,
209 };
210
211 pub use crate::services::file_watcher::{FileWatcher, WatchConfig, WatchMode};
213}
214
215#[derive(Debug, thiserror::Error)]
217pub enum Error {
218 #[error("IO error: {0}")]
220 Io(#[from] std::io::Error),
221
222 #[error("Terminal error: {0}")]
224 Terminal(String),
225
226 #[error("Parse error: {0}")]
228 Parse(String),
229}
230
231pub type Result<T> = std::result::Result<T, Error>;