hefesto-widgets 0.7.3

Ratatui widgets for the Hefesto TUI toolkit: popups, scrollable lists, trees, text input and spinners
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use ratatui::layout::Rect;

/// Trait for popups whose default height depends on their content and state.
///
/// When `height: PopupSize::Auto`, the popup computes its actual height via
/// [`auto_height`](Self::auto_height). This is the single source of truth
/// that both the popup's `resolve_rect()` and `render()` use, guaranteeing
/// correct centering.
pub trait AutoSized {
    type State;

    /// Returns the actual height this popup would render when its height is
    /// `PopupSize::Auto`, based on current content, state, and available area.
    fn auto_height(&self, state: &Self::State, area: Rect) -> u16;
}