#![warn(clippy::return_self_not_must_use)]
pub mod caret;
pub mod chrome;
pub mod clipboard;
pub mod component;
pub mod components;
pub mod compose;
#[cfg(all(feature = "control", any(unix, windows)))]
pub mod control;
pub mod dates;
pub mod datetime;
pub mod edit;
pub mod edit_keys;
pub mod event;
pub mod event_loop;
pub mod fuzzy;
pub mod headless;
#[cfg(all(feature = "host", not(target_arch = "wasm32")))]
pub mod host;
pub mod item;
pub mod keymap;
pub mod kit;
mod names;
pub mod overlay;
pub mod paint;
pub mod plugin;
pub mod policy;
pub mod push;
pub mod session;
pub mod viewport;
#[cfg(feature = "vim")]
pub mod vim;
mod zone;
pub use chrome::{Breadcrumbs, StatusBar, StatusItem};
pub use component::{Component, Context, Flow, View};
#[cfg(feature = "data")]
pub use components::DataExplorer;
pub use components::{
Answers, ApprovalQueue, ApprovalReport, AssetKind, AssetPicker, Choice, ColorFormat,
ColorPicker, Confirm, DatePicker, DateTimePicker, Decision, FileMode, FilePicker, Form, Input,
Jump, JumpIndex, JumpSource, Jumped, LogEvent, LogView, MultiSelect, Pager, PreviewLayout,
Reorder, Select, Suggestion, TableSelect, TextArea, Theme, ThemePicker, TimePicker, TreeSelect,
Value, Verdict,
};
pub use components::{Paginator, PaginatorStyle};
pub use compose::{
Axis, Column, ComponentExt, Label, Layer, LayerHandle, Layers, Rect, Row, Size, Split, Stack,
Tabs,
};
pub use event::{
Button, Event, HeldButton, Key, KeyCode, ModifierKey, Modifiers, Mouse, MouseKind, Releases,
Subcell,
};
pub use event_loop::{
Error, EventLoop, Handle, LoopOptions, Outcome, RunOptions, degrade, run, run_with_graphics,
};
pub use item::{Action, ActionFilter, ActionTarget, Actions, Item, Preview, TargetKind};
pub use keymap::{Binding, Keymap};
pub use overlay::{Command, Help, Menu, Overlays, Palette, Shortcuts};
pub use plugin::PluginView;
pub use policy::{Fallback, LineIo, NotInteractive, Policy, Reason};
pub use push::{PushBackend, PushPort};
pub use session::{
Backend, BackendKind, Output, Session, SessionOptions, Waker, synchronized_update,
};
pub use viewport::Viewport;
macro_rules! forward_component {
() => {
type Output = C::Output;
fn start(&mut self, context: &Context<'_>) -> Flow<C::Output> {
(**self).start(context)
}
fn handle(&mut self, event: &Event, context: &Context<'_>) -> Flow<C::Output> {
(**self).handle(event, context)
}
fn render(&self, context: &Context<'_>) -> View {
(**self).render(context)
}
fn tick(&self) -> Option<std::time::Duration> {
(**self).tick()
}
fn mouse(&self) -> bool {
(**self).mouse()
}
fn keymap(&self) -> keymap::Keymap {
(**self).keymap()
}
fn focusable(&self) -> bool {
(**self).focusable()
}
fn focus_step(&mut self, forward: bool) -> bool {
(**self).focus_step(forward)
}
fn focus_enter(&mut self, forward: bool) -> bool {
(**self).focus_enter(forward)
}
fn default_value(&self) -> Option<C::Output> {
(**self).default_value()
}
fn prompt(&mut self, io: &mut dyn LineIo) -> Result<Option<C::Output>, NotInteractive> {
(**self).prompt(io)
}
};
}
impl<C: Component + ?Sized> Component for &mut C {
forward_component!();
}
impl<C: Component + ?Sized> Component for Box<C> {
forward_component!();
}
#[cfg(target_arch = "wasm32")]
pub(crate) mod crossterm_stub {
fn no<T>() -> std::io::Result<T> {
Err(std::io::Error::new(
std::io::ErrorKind::Unsupported,
"no terminal on wasm",
))
}
pub mod terminal {
pub fn enable_raw_mode() -> std::io::Result<()> {
super::no()
}
pub fn disable_raw_mode() -> std::io::Result<()> {
super::no()
}
pub fn size() -> std::io::Result<(u16, u16)> {
super::no()
}
pub fn supports_keyboard_enhancement() -> std::io::Result<bool> {
super::no()
}
pub struct WindowSize {
pub rows: u16,
pub columns: u16,
pub width: u16,
pub height: u16,
}
pub fn window_size() -> std::io::Result<WindowSize> {
super::no()
}
}
pub mod cursor {
pub fn position() -> std::io::Result<(u16, u16)> {
super::no()
}
}
pub fn from_crossterm(event: event::Event) -> Option<crate::event::Event> {
match event {}
}
pub use from_crossterm as from_crossterm_kitty;
pub mod event {
pub enum Event {}
pub fn poll(_: std::time::Duration) -> std::io::Result<bool> {
super::no()
}
pub fn read() -> std::io::Result<Event> {
super::no()
}
}
}