scrin 0.1.73

A terminal UI toolkit with panes, widgets, overlays, animations, and Aisling-powered effects/loaders.
Documentation
pub mod modal;
pub mod toast;

pub use modal::Modal;
pub use toast::Toast;

use crate::core::buffer::Buffer;
use crate::core::rect::Rect;

#[derive(Debug, Clone, Copy, PartialEq)]
pub enum OverlayPosition {
    TopLeft,
    TopCenter,
    TopRight,
    CenterLeft,
    Center,
    CenterRight,
    BottomLeft,
    BottomCenter,
    BottomRight,
}

#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Transition {
    None,
    Fade,
    SlideUp,
    SlideDown,
    SlideLeft,
    SlideRight,
    Scale,
}

pub trait Overlay {
    fn is_visible(&self) -> bool;
    fn show(&mut self);
    fn hide(&mut self);
    fn toggle(&mut self);
    fn update(&mut self, delta: std::time::Duration);
    fn render(&self, buffer: &mut Buffer, area: Rect);
    fn position(&self, screen: Rect) -> Rect;
}