Skip to main content

tui/
lib.rs

1#![doc = include_str!("../README.md")]
2
3// Core modules - always available
4pub(crate) mod components;
5pub(crate) mod diffs;
6pub(crate) mod focus;
7pub(crate) mod rendering;
8pub(crate) use rendering::line;
9pub(crate) use rendering::span;
10pub(crate) use rendering::style;
11pub(crate) mod theme;
12
13// Feature-gated modules
14#[cfg(feature = "syntax")]
15mod syntax_highlighting;
16
17#[cfg(feature = "syntax")]
18pub(crate) mod markdown;
19
20#[cfg(all(feature = "picker", feature = "testing"))]
21pub mod test_picker;
22
23#[cfg(feature = "picker")]
24pub(crate) mod combobox;
25
26#[cfg(feature = "picker")]
27pub(crate) mod fuzzy_matcher;
28
29pub(crate) mod runtime;
30
31#[cfg(feature = "testing")]
32pub mod testing;
33
34// Core re-exports - always available
35pub use components::checkbox::Checkbox;
36pub use components::form::{Form, FormField, FormFieldKind, FormMessage};
37pub use components::layout::Layout;
38pub use components::multi_select::MultiSelect;
39pub use components::number_field::NumberField;
40pub use components::panel::{BORDER_H_PAD, Panel};
41pub use components::radio_select::RadioSelect;
42pub use components::select_list::{SelectItem, SelectList, SelectListMessage};
43pub use components::select_option::SelectOption;
44pub use components::spinner::{BRAILLE_FRAMES, Spinner};
45pub use components::text_field::TextField;
46
47pub use components::{Component, Cursor, Event, PickerMessage, ViewContext, merge, wrap_selection};
48pub use diffs::diff_types::{DiffLine, DiffPreview, DiffTag, SplitDiffCell, SplitDiffRow};
49pub use focus::{FocusOutcome, FocusRing};
50pub use rendering::frame::Frame;
51pub use rendering::line::Line;
52pub use rendering::style::Style;
53pub use theme::{Theme, ThemeBuildError};
54
55// Rendering (always available - no runtime dependency)
56pub use rendering::renderer::{Renderer, RendererCommand};
57
58// Runtime
59pub use crossterm::event::Event as CrosstermEvent;
60pub use runtime::terminal::terminal_size;
61pub use runtime::{MouseCapture, TerminalSession, spawn_terminal_event_task};
62
63// &str text utilities
64pub use rendering::soft_wrap::{
65    display_width_text, pad_text_to_width, soft_wrap_line, truncate_line, truncate_text,
66};
67
68// Span type
69pub use rendering::span::Span;
70
71// Markdown
72#[cfg(feature = "syntax")]
73pub use markdown::render_markdown;
74
75// Feature-gated re-exports
76#[cfg(feature = "syntax")]
77pub use diffs::diff::highlight_diff;
78
79#[cfg(feature = "syntax")]
80pub use diffs::split_diff::render_diff;
81#[cfg(feature = "syntax")]
82pub use diffs::split_diff::{
83    GUTTER_WIDTH, SEPARATOR, SEPARATOR_WIDTH, blank_panel as split_blank_panel,
84    render_cell as split_render_cell,
85};
86
87#[cfg(feature = "syntax")]
88pub use syntax_highlighting::SyntaxHighlighter;
89
90#[cfg(feature = "picker")]
91pub use combobox::{Combobox, PickerKey, classify_key};
92#[cfg(feature = "picker")]
93pub use fuzzy_matcher::Searchable;
94
95#[cfg(feature = "picker")]
96pub use fuzzy_matcher::FuzzyMatcher;
97
98// Terminal event types (re-exported from crossterm)
99pub use crossterm::event::{
100    KeyCode, KeyEvent, KeyEventKind, KeyEventState, KeyModifiers, MouseEvent, MouseEventKind,
101};
102pub use crossterm::style::Color;