pub mod accessibility;
pub mod accessibility_signal;
pub mod animation;
pub mod ansi;
pub mod border;
pub mod browser;
pub mod clipboard;
pub mod color;
pub mod debounce;
pub mod diff;
pub mod easing;
pub mod figlet;
pub mod filter;
pub mod format;
pub mod fuzzy;
pub mod gradient;
pub mod highlight;
pub mod i18n;
pub mod keymap;
pub mod layout;
pub mod lock;
pub mod once;
pub mod overlay;
pub mod path;
pub mod profiler;
pub mod selection;
pub mod shell;
pub mod sort;
pub mod syntax;
pub mod table;
pub mod terminal;
pub mod text;
pub mod text_sizing;
pub mod textbuffer;
pub mod tree;
pub mod undo;
pub mod unicode;
pub mod validation;
pub use border::{
draw_border_title, draw_border_titles, draw_title, draw_title_center, draw_title_right,
render_border, render_rounded_border, BorderChars, BorderEdge, BorderStyle, BorderTitle,
TitlePosition,
};
pub use text::{
byte_to_char_index,
center,
char_count,
char_slice,
char_to_byte_index,
char_to_byte_index_with_char,
insert_at_char,
pad_left,
pad_right,
remove_char_at,
remove_char_range,
truncate,
truncate_start,
wrap_text,
};
pub use color::{blend, contrast_color, darken, hsl_to_rgb, lighten, rgb_to_hsl};
pub use sort::{
natural_cmp, natural_cmp_case_sensitive, natural_sort, natural_sort_case_sensitive, NaturalKey,
};
pub use fuzzy::{
fuzzy_filter, fuzzy_filter_simple, fuzzy_match, fuzzy_matches, fuzzy_score, FuzzyMatch,
FuzzyMatcher,
};
pub use unicode::{
center_to_width, char_width, display_width, pad_to_width, right_align_to_width, split_at_width,
truncate_to_width, truncate_with_ellipsis, truncate_with_suffix, wrap_to_width,
};
pub use highlight::{
highlight_matches, highlight_range, highlight_ranges, highlight_substring,
highlight_substring_case, HighlightSpan, Highlighter,
};
pub use format::{
format_duration,
format_duration_compact,
format_duration_short,
format_number,
format_number_short,
format_percent,
format_percent_precise,
format_rate,
format_rate_compact,
format_relative_time,
format_relative_time_short,
format_size,
format_size_compact,
format_size_si,
format_std_duration,
format_std_duration_short,
ordinal,
pluralize,
pluralize_s,
};
pub use diff::{
diff_chars, diff_lines, diff_words, format_unified_diff, DiffChange, DiffOp, DiffStats,
};
pub use path::{
abbreviate_path, abbreviate_path_keep, common_prefix, expand_home, extension, filename,
home_dir, home_relative, is_hidden, join_paths, normalize_separators, parent, relative_to,
shorten_path, stem, validate_characters, validate_no_traversal, validate_within_base,
PathDisplay, PathError,
};
pub use ansi::{ansi_len, parse_ansi, strip_ansi, AnsiSpan};
pub use easing::{
ease_in_back, ease_in_bounce, ease_in_circ, ease_in_cubic, ease_in_elastic, ease_in_expo,
ease_in_out_back, ease_in_out_bounce, ease_in_out_circ, ease_in_out_cubic, ease_in_out_elastic,
ease_in_out_expo, ease_in_out_quad, ease_in_out_quart, ease_in_out_quint, ease_in_out_sine,
ease_in_quad, ease_in_quart, ease_in_quint, ease_in_sine, ease_out_back, ease_out_bounce,
ease_out_circ, ease_out_cubic, ease_out_elastic, ease_out_expo, ease_out_quad, ease_out_quart,
ease_out_quint, ease_out_sine, lerp, lerp_fn, linear, Easing, EasingFn, Interpolator,
};
pub use figlet::{figlet, figlet_lines, figlet_with_font, font_height, FigletFont};
pub use syntax::{
highlight, highlight_line, Language, SyntaxHighlighter, SyntaxTheme, Token, TokenType,
};
pub use clipboard::{
clear as clear_clipboard, copy, has_text as clipboard_has_text, paste, Clipboard,
ClipboardBackend, ClipboardError, ClipboardHistory, ClipboardResult, MemoryClipboard,
SystemClipboard,
};
pub use validation::{
all_of, alphabetic, alphanumeric, any_of, custom, email, length_range, lowercase, matches,
max_length, max_value, min_length, min_value, not_one_of, numeric, one_of, pattern, required,
uppercase, url, value_range, FormValidator, ValidationError, ValidationResult, Validator,
};
pub use i18n::{Direction, I18n, Locale, LocaleId, Translation};
pub use keymap::{
emacs_preset, format_key_binding, parse_key_binding, vim_preset, KeyChord, KeymapConfig,
LookupResult, Mode,
};
pub use accessibility::{
accessibility_manager, shared_accessibility, AccessibilityManager, AccessibleNode,
AccessibleState, Announcement, Priority, Role, SharedAccessibility,
};
pub use accessibility_signal::{
announce,
announce_button_clicked,
announce_checkbox_changed,
announce_dialog_closed,
announce_dialog_opened,
announce_error,
announce_focus_region,
announce_list_selection,
announce_loaded,
announce_loading,
announce_now,
announce_progress,
announce_progress_complete,
announce_success,
announce_tab_changed,
announce_validation_error,
has_announcements,
is_accessibility_enabled,
is_high_contrast,
prefers_reduced_motion,
set_accessibility_enabled,
set_high_contrast,
set_reduced_motion,
take_announcements,
};
pub use textbuffer::TextBuffer;
pub use undo::{GroupedUndoHistory, Mergeable, UndoGroup, UndoHistory, DEFAULT_MAX_HISTORY};
pub use gradient::{
presets as gradient_presets, ColorStop, Gradient, GradientDirection, InterpolationMode,
LinearGradient, RadialGradient, SpreadMode,
};
pub use animation::{
presets as animation_presets, AnimatedValue, Interpolatable, Keyframe, Keyframes, Sequence,
SequenceStep, Spring, Ticker, Timer,
};
pub use table::{align_center, align_left, align_right, align_text, Align, Column, Table};
pub use tree::{Indent, TreeIcons, TreeItem, TreeNav};
pub use selection::{wrap_next, wrap_prev, SectionedSelection, Selection};
pub use layout::BoxLayout;
pub use browser::{open_browser, open_file, open_folder, open_url, reveal_in_finder};
pub use profiler::{
profile, profiler_report, start_profile, thread_profiler, FlameNode, ProfileGuard, Profiler,
Stats, Timing,
};
pub use text_sizing::{is_supported as text_sizing_supported, TextSizing};
pub use lock::{lock_or_recover, read_or_recover, write_or_recover};
pub use shell::{escape_applescript, escape_powershell, sanitize_string};
pub use debounce::{debounce_ms, debouncer, throttle, throttle_ms, Debouncer, Edge, Throttle};
pub use once::{once, Once};
pub use filter::FilterMode;
pub use overlay::{draw_separator_overlay, draw_text_overlay};
pub use terminal::{is_sixel_capable, terminal_type, TerminalType};
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_all_modules_compile() {
let mode = FilterMode::default();
assert_eq!(mode, FilterMode::Fuzzy);
let term = terminal_type();
match term {
TerminalType::Kitty | TerminalType::Iterm2 | TerminalType::Unknown => {}
}
let mut once = Once::new();
assert!(once.call());
assert!(!once.call());
let _ = text_sizing_supported();
let escaped = escape_applescript("test");
assert_eq!(escaped, "test");
let escaped = escape_powershell("test");
assert_eq!(escaped, "test");
let sanitized = sanitize_string("test");
assert_eq!(sanitized, "test");
let size = format_size(1024);
assert!(!size.is_empty());
let duration = format_duration(60); assert!(!duration.is_empty());
let order = natural_cmp("file1", "file2");
let _ = order; let _ = NaturalKey::new("file1");
let width = display_width("hello");
assert_eq!(width, 5);
let spans = highlight_substring("hello world", "hello");
assert!(!spans.is_empty());
let stripped = strip_ansi("test");
assert_eq!(stripped, "test");
let eased = ease_in_out_quad(0.5);
assert!((0.0..=1.0).contains(&eased));
let c = crate::style::Color::rgb(100, 100, 100);
let _darker = darken(c, 0.2);
let _lighter = lighten(c, 0.2);
let border = BorderChars::ROUNDED;
let _ = border.top_left;
let _ = border.top_right;
let _ = border.bottom_left;
let _ = border.bottom_right;
let art = figlet("Hi");
assert!(!art.is_empty());
let mut i18n = I18n::new();
i18n.add_translation("en", "test", "Test");
assert_eq!(i18n.t("test"), "Test");
let validator = required();
let result = validator("value");
assert!(result.is_ok());
let name = filename("/path/to/file.txt");
assert_eq!(name, Some("file.txt".to_string()));
let diffs = diff_lines("line1\nline2", "line1\nline3");
assert!(!diffs.is_empty());
let score = fuzzy_score("hl", "hello");
assert!(score > 0);
assert!(FilterMode::Fuzzy.matches("hello", "hl"));
assert!(FilterMode::Prefix.matches("hello", "he"));
assert!(FilterMode::Contains.matches("hello", "el"));
assert!(FilterMode::Exact.matches("hello", "hello"));
assert!(FilterMode::None.matches("hello", "xyz"));
let _ = debouncer(std::time::Duration::from_millis(100));
let _ = debounce_ms(100);
let _ = throttle(std::time::Duration::from_millis(100));
let _ = throttle_ms(100);
let mutex = std::sync::Mutex::new(42);
let guard = lock_or_recover(&mutex);
assert_eq!(*guard, 42);
let rwlock = std::sync::RwLock::new(42);
let read_guard = read_or_recover(&rwlock);
assert_eq!(*read_guard, 42);
let result = open_browser("https://example.com");
let _ = result;
let _ = profiler_report();
let buffer = TextBuffer::new();
assert!(buffer.is_empty());
let history: UndoHistory<String> = UndoHistory::new();
assert!(!history.can_undo());
assert!(!history.can_redo());
let selection = Selection::new(10);
assert_eq!(selection.index, 0);
let table = Table::new();
assert_eq!(table.total_width(), 0);
let tree = TreeNav::new();
assert_eq!(tree.selected(), 0);
use crate::utils::gradient::Gradient;
let _ = LinearGradient::new(
Gradient::linear(crate::style::Color::RED, crate::style::Color::BLUE),
GradientDirection::ToRight,
);
let _ = animation_presets::fade_in(300);
let _ = Language::from_fence("rust");
let _ = SyntaxTheme::monokai();
let _ = shared_accessibility();
let _ = accessibility_manager();
announce("Test announcement");
let _ = take_announcements();
let _ = has_announcements();
set_reduced_motion(false);
let _ = prefers_reduced_motion();
set_high_contrast(false);
let _ = is_high_contrast();
set_accessibility_enabled(true);
let _ = is_accessibility_enabled();
let _ = emacs_preset();
let _ = vim_preset();
let _ = KeymapConfig::default();
let layout = BoxLayout::new(0, 0, 20, 10);
let _ = layout;
let mode1 = FilterMode::Fuzzy;
let mode2 = mode1;
assert_eq!(mode1, mode2);
let term1 = TerminalType::Kitty;
let term2 = term1;
assert_eq!(term1, term2);
let dir1 = Direction::Ltr;
let dir2 = dir1;
assert_eq!(dir1, dir2);
let id: LocaleId = "en".to_string();
assert_eq!(id, "en");
}
}