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::bordered_text_field::BorderedTextField;
36pub use components::checkbox::Checkbox;
37pub use components::form::{Form, FormField, FormFieldKind, FormMessage};
38pub use components::gallery::{Gallery, GalleryMessage};
39pub use components::multi_select::MultiSelect;
40pub use components::number_field::NumberField;
41pub use components::panel::{BORDER_H_PAD, Panel};
42pub use components::radio_select::RadioSelect;
43pub use components::select_list::{SelectItem, SelectList, SelectListMessage};
44pub use components::select_option::SelectOption;
45pub use components::spinner::{BRAILLE_FRAMES, Spinner};
46pub use components::split_panel::{Either, SplitLayout, SplitPanel, SplitWidths};
47pub use components::stepper::{StepVisualState, Stepper, StepperItem};
48pub use components::text_field::TextField;
49
50pub use components::{Component, Cursor, Event, PickerMessage, ViewContext, merge, wrap_selection};
51pub use diffs::diff_types::{DiffLine, DiffPreview, DiffTag, SplitDiffCell, SplitDiffRow};
52pub use focus::{FocusOutcome, FocusRing};
53pub use rendering::frame::{FitOptions, Frame, FramePart, Overflow};
54pub use rendering::gutter::{digit_count, wrap_with_gutter};
55pub use rendering::line::Line;
56pub use rendering::render_context::{Insets, Size};
57pub use rendering::style::Style;
58pub use theme::{Theme, ThemeBuildError};
59
60// Rendering (always available - no runtime dependency)
61pub use rendering::renderer::{Renderer, RendererCommand};
62
63// Runtime
64pub use crossterm::event::Event as CrosstermEvent;
65pub use runtime::terminal::terminal_size;
66pub use runtime::{MouseCapture, TerminalConfig, TerminalRuntime, TerminalSession};
67
68// &str text utilities
69pub use rendering::soft_wrap::{display_width_text, pad_text_to_width, soft_wrap_line, truncate_line, truncate_text};
70
71// Span type
72pub use rendering::span::Span;
73
74// Markdown
75#[cfg(feature = "syntax")]
76pub use markdown::{
77    MarkdownBlock, MarkdownHeading, MarkdownRenderResult, SourceMappedLine, parse_markdown_headings,
78    render_markdown_result,
79};
80
81// Feature-gated re-exports
82#[cfg(feature = "syntax")]
83pub use diffs::diff::highlight_diff;
84
85#[cfg(feature = "syntax")]
86pub use diffs::split_diff::render_diff;
87#[cfg(feature = "syntax")]
88pub use diffs::split_diff::{
89    MIN_GUTTER_WIDTH, SEPARATOR, SEPARATOR_WIDTH, Side as SplitDiffSide, gutter_width_for_preview,
90    render_cell as split_render_cell,
91};
92
93#[cfg(feature = "syntax")]
94pub use syntax_highlighting::SyntaxHighlighter;
95
96#[cfg(feature = "picker")]
97pub use combobox::{Combobox, PickerKey, classify_key};
98#[cfg(feature = "picker")]
99pub use fuzzy_matcher::Searchable;
100
101#[cfg(feature = "picker")]
102pub use fuzzy_matcher::FuzzyMatcher;
103
104// Terminal event types (re-exported from crossterm)
105pub use crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyEventState, KeyModifiers, MouseEvent, MouseEventKind};
106pub use crossterm::style::Color;