pub use crate::core::{
AlignItems, BorderStyle, Color, Display, Element, ElementId, FlexDirection, JustifyContent,
Overflow, Position, Style, TextWrap,
};
pub use crate::components::{Box, Box as LayoutBox, Spacer, Static, Transform};
pub use crate::components::{
Cursor, CursorShape, CursorState, CursorStyle, Gradient, Hyperlink, HyperlinkBuilder, Line,
Message, MessageRole, Newline, Span, Text, ThinkingBlock, ToolCall, set_hyperlinks_supported,
supports_hyperlinks,
};
pub use crate::components::{
Bar, BarChart, BarChartOrientation, Cell, Constraint, List, ListColors, ListItem, ListState,
Row, Sparkline, Tab, Table, TableState, Tabs, Tree, TreeNode, TreeState, TreeStyle,
calculate_visible_range, handle_list_navigation, handle_tree_input, virtual_scroll_view,
};
pub use crate::components::{
ColorPalette, ColorPicker, ColorPickerState, ColorPickerStyle, Command, CommandPalette,
CommandPaletteState, CommandPaletteStyle, Confirm, ConfirmState, ConfirmStyle, FileEntry,
FileFilter, FilePicker, FilePickerState, FilePickerStyle, FileType, InteractionMode,
InteractionOutcome, MultiSelect, MultiSelectItem, MultiSelectState, MultiSelectStyle,
SelectInput, SelectInputState, SelectInputStyle, SelectItem, SelectionState, TextInputHandle,
TextInputOptions, TextInputState, handle_color_picker_input, handle_command_palette_input,
handle_confirm_input, handle_confirm_input_with_mode, handle_file_picker_input,
handle_multi_select_input, handle_select_input, handle_text_input, use_text_input,
};
pub use crate::components::{
TextArea, TextAreaAction, TextAreaKeyMap, TextAreaPosition, TextAreaSelection, TextAreaState,
TextAreaStyle, Viewport, ViewportAction, ViewportKeyMap, ViewportState, ViewportStyle,
apply_textarea_action, apply_viewport_action, handle_textarea_input,
handle_textarea_input_with_mode, handle_viewport_input, handle_viewport_input_with_mode,
};
pub use crate::components::{
Dialog, DialogState, Gauge, Modal, ModalAlign, Notification, NotificationBorder,
NotificationItem, NotificationLevel, NotificationPosition, NotificationState,
NotificationStyle, Progress, ProgressColors, ProgressSymbols, Spinner, SpinnerBuilder,
StopwatchState, TimerState, Toast,
};
pub use crate::components::{
Help, HelpMode, HelpStyle, KeyBinding, NavigationConfig, NavigationResult, Paginator,
PaginatorState, PaginatorStyle, PaginatorType, ScrollableBox, Scrollbar, ScrollbarOrientation,
ScrollbarSymbols, editor_help, fixed_bottom_layout, handle_paginator_input, navigation_help,
vim_navigation_help,
};
pub use crate::components::{
BackgroundColors, BorderColors, ButtonColors, ButtonStyle, ComponentColors, InputColors,
SemanticColor, TextColors, Theme, ThemeBuilder, get_theme, set_theme, with_theme,
};
pub use crate::components::{
format_duration_hhmmss, format_duration_mmss, format_duration_precise,
};
pub use crate::renderer::{
AppBuilder,
AppOptions,
IntoPrintable,
ModeSwitch,
Printable,
RenderHandle,
RenderOptions,
enter_alt_screen,
exit_alt_screen,
is_alt_screen,
println,
println_trimmed,
render,
render_fullscreen,
render_handle,
render_inline,
render_to_string,
render_to_string_auto,
render_to_string_no_trim,
render_to_string_raw,
render_to_string_with_options,
request_render,
};
pub use crate::hooks::{
Context, Deps, DepsHash, MemoizedCallback, RefHandle, Signal, StateSetter, create_context,
use_callback, use_context, use_memo, use_ref, use_signal, use_state, with_context,
};
pub use crate::hooks::{
use_cmd, use_cmd_once, use_effect, use_effect_once, use_layout_effect, use_layout_effect_once,
};
pub use crate::hooks::{
AnimationHandle, TransitionHandle, use_animation, use_animation_auto, use_transition,
use_transition_with_easing,
};
pub use crate::hooks::{
BracketedPasteGuard, Key, KeyCodeKind, MediaKeyKind, Mouse, MouseAction, MouseButton,
PasteEvent, disable_bracketed_paste, dispatch_paste, enable_bracketed_paste,
is_bracketed_paste_enabled, is_mouse_enabled, use_input, use_mouse, use_paste,
};
pub use crate::hooks::{
FocusManagerHandle, FocusState, ScopedFocusOptions, UseFocusOptions, use_focus,
use_focus_manager, use_focus_traversal, use_focus_traversal_in_scope, use_scoped_focus,
};
pub use crate::{AccessibilityProps, AccessibilityRole};
pub use crate::hooks::{
Dimensions, MeasureContext, MeasureRef, ScrollHandle, ScrollState, measure_element,
measure_element_by_key, use_measure, use_scroll,
};
pub use crate::hooks::{
AppContext, StderrHandle, StdinHandle, StdoutHandle, WindowTitleGuard,
clear_screen_reader_cache, clear_window_title, set_screen_reader_enabled, set_window_title,
use_app, use_frame_rate, use_is_screen_reader_enabled, use_stderr, use_stdin, use_stdout,
use_window_title, use_window_title_fn,
};
pub mod lite {
pub use crate::components::{Box as LayoutBox, Spacer, Text};
pub use crate::core::{
AccessibilityProps, AccessibilityRole, Color, Element, FlexDirection, Style,
};
pub use crate::hooks::{Key, use_app, use_effect, use_input, use_signal};
pub use crate::renderer::{render, render_to_string};
}
pub mod widgets {
pub use crate::components::{
Box, Box as LayoutBox, Command, CommandPalette, CommandPaletteState, CommandPaletteStyle,
InteractionMode, InteractionOutcome, NavigationConfig, SelectInput, SelectInputState,
SelectInputStyle, SelectItem, Text, TextArea, TextAreaKeyMap, TextAreaState, TextAreaStyle,
TextInputHandle, TextInputOptions, TextInputState, handle_command_palette_input,
handle_select_input, handle_text_input, handle_textarea_input_with_mode, use_text_input,
};
pub use crate::core::{
AccessibilityProps, AccessibilityRole, BorderStyle, Color, Element, FlexDirection, Style,
};
pub use crate::hooks::{Key, use_app, use_input, use_signal};
pub use crate::renderer::{render, render_to_string};
}
pub mod testing {
pub use crate::testing::*;
pub use crate::{assert_snapshot, golden_test, inline_snapshot};
}
#[cfg(test)]
mod tests {
#[test]
fn test_layout_box_alias_compiles() {
use super::*;
let _element = LayoutBox::new()
.child(Text::new("ok").into_element())
.into_element();
}
#[test]
fn test_lite_prelude_compiles() {
use super::lite::*;
let _element = LayoutBox::new()
.child(Text::new("lite").into_element())
.into_element();
let _style = Style::new().fg(Color::Green);
}
#[test]
fn test_widgets_prelude_compiles() {
use super::widgets::*;
let mut state = TextInputState::default();
let outcome = handle_text_input(
&mut state,
"x",
&Key::default(),
&TextInputOptions::default(),
);
assert_eq!(outcome, InteractionOutcome::Changed("x".to_string()));
let _element = LayoutBox::new()
.child(Text::new("widgets").into_element())
.into_element();
}
#[test]
fn test_testing_prelude_compiles() {
use super::testing::*;
let renderer = TestRenderer::new(20, 5);
assert_eq!(renderer.width(), 20);
}
}