euv-ui 0.51.0

Cross-platform UI component library and 17-scheme design system for the euv framework with pixel-consistent rendering across Web, Android, iOS, iPadOS, macOS, Windows, and Linux.
Documentation
use super::*;

/// Compact status pill badge component.
#[derive(Clone, Data, Debug, New, Props)]
pub struct EuvBadge {
    /// Badge text label.
    pub(crate) label: String,
    /// Semantic tone.
    #[get(type(copy))]
    #[prop(custom)]
    pub(crate) tone: EuvTone,
    /// Active theme tokens.
    #[get(type(copy))]
    pub(crate) tokens: ThemeTokens,
}

/// Semantic alert banner displaying title and message.
#[derive(Clone, Data, Debug, New, Props)]
pub struct EuvAlert {
    /// Alert heading.
    pub(crate) title: String,
    /// Supporting description.
    pub(crate) description: String,
    /// Semantic tone.
    #[get(type(copy))]
    pub(crate) tone: EuvTone,
    /// Active theme tokens.
    #[get(type(copy))]
    pub(crate) tokens: ThemeTokens,
    /// Optional style overrides merged onto the alert container (`style! { ... }`).
    #[new(skip)]
    #[get(type(copy))]
    pub(crate) style: Option<Style>,
}

/// Linear progress bar displaying normalized completion in `[0.0, 1.0]`.
#[derive(Clone, Copy, Data, Debug, New, Props)]
pub struct EuvProgress {
    /// Progress fraction clamped to `[0.0, 1.0]`.
    #[get(type(copy))]
    pub(crate) value: f32,
    /// Optional style overrides merged onto the progress track (`style: { height: Length::Px(12.0) }`).
    #[new(skip)]
    #[get(type(copy))]
    pub(crate) style: Option<Style>,
    /// Active theme tokens.
    #[get(type(copy))]
    pub(crate) tokens: ThemeTokens,
}

/// High-performance reactive virtualized scrollable list rendering only the visible window of `total_items`.
#[derive(Clone, CustomDebug, Data, New)]
pub struct EuvVirtualList {
    /// Total number of logical rows.
    #[get(type(copy))]
    pub(crate) total_items: usize,
    /// Fixed height of each row in logical pixels.
    #[get(type(copy))]
    pub(crate) item_height: f32,
    /// Viewport height in logical pixels (`0.0` defaults to `320.0`).
    #[new(skip)]
    #[get(type(copy))]
    pub(crate) viewport_height: f32,
    /// Reactive scroll Y offset signal in logical pixels.
    #[get(type(copy))]
    pub(crate) scroll_y: Signal<f32>,
    /// Extra overscan rows mounted above and below the viewport (`0` defaults to `3`).
    #[new(skip)]
    #[get(type(copy))]
    pub(crate) overscan: usize,
    /// Active theme tokens.
    #[get(type(copy))]
    pub(crate) tokens: ThemeTokens,
}

/// Mounted `EuvVirtualList` controller enabling O(1) stable-ID single-row patches and refreshes without rebuilding sibling rows.
#[derive(Clone, CustomDebug)]
pub struct EuvVirtualListHandle {
    /// Mounted scrollable container root node handle.
    pub(crate) container: NodeId,
    /// Persistent inner column hosting the materialized sliding-window rows.
    pub(crate) rows_host: NodeId,
    /// Shared scene handle for single-lock targeted row updates.
    #[debug(skip)]
    pub(crate) scene: SceneHandle,
    /// Ambient build context preserved for isolated single-row refreshes.
    #[debug(skip)]
    pub(crate) ctx: Context,
    /// Active sliding window mapping logical indices to `(scope, node)`.
    #[debug(skip)]
    pub(crate) window: Rc<RefCell<VecDeque<(usize, Scope, NodeId)>>>,
    /// Shared row factory invoked only when a specific visible row is refreshed.
    #[debug(skip)]
    pub(crate) builder: Rc<RefCell<dyn FnMut(usize) -> NodeId + 'static>>,
}

/// Simple structured cross-platform data table.
#[derive(Clone, Data, Debug, New, Props)]
pub struct EuvTable {
    /// Ordered column header labels.
    pub(crate) headers: Vec<String>,
    /// Matrix of row cell strings.
    pub(crate) rows: Vec<Vec<String>>,
    /// Active theme tokens.
    #[get(type(copy))]
    pub(crate) tokens: ThemeTokens,
    /// Optional style overrides merged onto the table container (`style! { ... }`).
    #[new(skip)]
    #[get(type(copy))]
    pub(crate) style: Option<Style>,
}