euv-ui 0.50.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::*;

/// Immutable input snapshot describing live viewport dimensions, safe-area insets, and shell visibility flags.
#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
pub struct ShellViewportMetrics {
    /// Logical viewport width in dp.
    #[get(type(copy))]
    pub(crate) viewport_width: f32,
    /// Logical viewport height in dp.
    #[get(type(copy))]
    pub(crate) viewport_height: f32,
    /// Hardware safe-area insets reported by the active OS host.
    #[get(type(copy))]
    pub(crate) safe_area: SafeAreaInsets,
    /// Whether the shell was configured with an adaptive `EuvBottomNav` dock.
    #[get(type(copy))]
    pub(crate) has_bottom_nav: bool,
    /// Whether an immersive fullscreen portal is currently active.
    #[get(type(copy))]
    pub(crate) is_fullscreen: bool,
    /// Whether scroll-driven chrome auto-hide is currently requesting chrome hide.
    #[get(type(copy))]
    pub(crate) is_chrome_hidden: bool,
    /// Whether the active breakpoint is compact (`< 640dp`).
    #[get(type(copy))]
    pub(crate) is_compact_bp: bool,
}

/// Compact reactive presentation contract consumed by `EuvBottomNav` to mirror `EuvAppShell`'s active dock orientation.
#[derive(Clone, Copy, Data, Debug, Default, Eq, PartialEq)]
pub struct NavDockPresentation {
    /// Selected dock placement edge.
    #[get(type(copy))]
    pub(crate) placement: NavDockPlacement,
    /// Axis orientation (`Horizontal` vs `Vertical`).
    #[get(type(copy))]
    pub(crate) orientation: NavDockOrientation,
    /// When `true`, renders crisp icon-only tabs without overflowing text labels (watches or tight vertical rails).
    #[get(type(copy))]
    pub(crate) icon_only: bool,
}

/// Shared floating horizontal bottom-dock box geometry computed for standard mobile and top-safe postures.
#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
pub(crate) struct BottomFloatingDockBox {
    /// Logical X offset of the floating bottom dock (`Position::Fixed` `left`).
    #[get(type(copy))]
    pub(crate) dock_left: f32,
    /// Logical bottom offset above the viewport bottom edge (`Position::Fixed` `bottom`).
    #[get(type(copy))]
    pub(crate) dock_bottom: f32,
    /// Logical dock width in dp.
    #[get(type(copy))]
    pub(crate) dock_width: f32,
    /// Logical dock height in dp.
    #[get(type(copy))]
    pub(crate) dock_height: f32,
    /// Additional bottom content scroll padding clearing the bottom dock.
    #[get(type(copy))]
    pub(crate) content_extra_bottom_pad: f32,
}

/// Complete, deterministic chrome geometry resolved by `EuvChromeLayoutPolicy` for `EuvAppShell` and `EuvRouterOutlet`.
#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
pub struct ResolvedChromeLayout {
    /// Detected device posture driving layout decisions.
    #[get(type(copy))]
    pub(crate) posture: ChromePosture,
    /// Selected navigation dock placement.
    #[get(type(copy))]
    pub(crate) dock_placement: NavDockPlacement,
    /// Active navigation dock axis orientation.
    #[get(type(copy))]
    pub(crate) dock_orientation: NavDockOrientation,
    /// Whether the navigation dock uses icon-only compact tabs.
    #[get(type(copy))]
    pub(crate) dock_icon_only: bool,
    /// Whether the navigation dock renders frameless (no outer card border, background fill, or drop shadow) directly inside a safe-area rail.
    #[get(type(copy))]
    pub(crate) dock_frameless: bool,
    /// Whether scroll-driven auto-hide is permitted to hide the navigation dock (`false` inside dedicated hardware safe areas).
    #[get(type(copy))]
    pub(crate) dock_allow_auto_hide: bool,
    /// Whether the page top bar is hosted directly inside a tall top hardware safe-area strip (avoiding top-right cutout/signal icons).
    #[get(type(copy))]
    pub(crate) top_bar_in_safe_area: bool,
    /// Whether scroll-driven auto-hide is permitted to hide the page top bar (`false` when hosted inside the top safe area).
    #[get(type(copy))]
    pub(crate) top_bar_allow_auto_hide: bool,
    /// Whether the floating/rail navigation dock is visible in this frame.
    #[get(type(copy))]
    pub(crate) show_dock: bool,
    /// Logical X offset of the navigation dock (`Position::Fixed` `left`).
    #[get(type(copy))]
    pub(crate) dock_left: f32,
    /// Optional logical Y offset from viewport top (`Position::Fixed` `top`) for side safe-area rails.
    #[get(type(copy))]
    pub(crate) dock_top: Option<f32>,
    /// Optional logical Y offset from viewport bottom (`Position::Fixed` `bottom`) for bottom docks.
    #[get(type(copy))]
    pub(crate) dock_bottom: Option<f32>,
    /// Logical width of the navigation dock in dp.
    #[get(type(copy))]
    pub(crate) dock_width: f32,
    /// Logical height of the navigation dock in dp.
    #[get(type(copy))]
    pub(crate) dock_height: f32,
    /// Horizontal slide-out delta applied when auto-hiding a side rail.
    #[get(type(copy))]
    pub(crate) dock_hide_dx: f32,
    /// Vertical slide-out delta applied when auto-hiding a bottom horizontal dock.
    #[get(type(copy))]
    pub(crate) dock_hide_dy: f32,
    /// Effective top inset applied to the mobile top header bar (compact on watches, full safe strip on top-safe postures).
    #[get(type(copy))]
    pub(crate) mobile_header_top_inset: f32,
    /// Total logical height of the mobile top bar in dp.
    #[get(type(copy))]
    pub(crate) mobile_header_height: f32,
    /// Exact `(top, right, bottom, left)` padding applied inside the mobile top bar, avoiding side and top-right hardware safe areas.
    #[get(type(copy))]
    pub(crate) mobile_header_padding: Edges,
    /// Safe-area exclusion insets applied around `EuvAppShell`'s content stage so route transitions clip strictly inside non-safe areas and NEVER cross cutouts, signal rails, or docked navigation.
    #[get(type(copy))]
    pub(crate) route_stage_insets: Edges,
    /// Additional bottom content scroll padding inside pages so scrolling clears bottom docks cleanly.
    #[get(type(copy))]
    pub(crate) content_extra_bottom_pad: f32,
    /// Horizontal left divider inset keeping topbar borders out of left hardware safe areas.
    #[get(type(copy))]
    pub(crate) top_divider_left_inset: f32,
    /// Horizontal right divider inset keeping topbar borders out of right signal safe-area rails.
    #[get(type(copy))]
    pub(crate) top_divider_right_inset: f32,
}

/// Unified safe-area and display corner-radius padding plan consumed by every fullscreen component and portal.
#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
pub struct FullscreenSafeLayout {
    /// Safe header/toolbar padding keeping close buttons, titles, and action pills cleanly inside large curved corners and cutouts.
    #[get(type(copy))]
    pub(crate) header_padding: Edges,
    /// Safe bottom overlay/action-bar padding clearing home indicators and bottom display corners.
    #[get(type(copy))]
    pub(crate) footer_padding: Edges,
    /// Minimal safe content padding for scrollable fullscreen bodies (tables, code, diagrams) while keeping outer canvases edge-to-edge.
    #[get(type(copy))]
    pub(crate) body_padding: Edges,
    /// Computed display corner-radius clearance floor in logical dp (`0.0` on rectangular desktops).
    #[get(type(copy))]
    pub(crate) corner_clearance: f32,
}

/// Facade entrypoint coordinating all stateless `ChromeLayoutStrategy` implementations.
#[derive(Clone, Copy, Debug, Default)]
pub struct EuvChromeLayoutPolicy;

/// Strategy resolving Desktop / PC / wide landscape tablet layouts (`>= 960dp`).
#[derive(Clone, Copy, Debug, Default)]
pub(crate) struct DesktopSidebarStrategy;

/// Strategy resolving compact smartwatch layouts (`< 300dp`).
#[derive(Clone, Copy, Debug, Default)]
pub(crate) struct WatchCompactStrategy;

/// Strategy docking borderless persistent vertical navigation inside an asymmetric left or right hardware safe-area strip (iPhone Duo folded/unfolded/rotated/split).
#[derive(Clone, Copy, Debug, Default)]
pub(crate) struct SideSafeRailStrategy;

/// Strategy hosting the page top bar directly inside a tall top hardware safe-area strip (avoiding the top-right signal zone) while keeping tab navigation docked at the bottom.
#[derive(Clone, Copy, Debug, Default)]
pub(crate) struct TopSafeHeaderStrategy;

/// Default mobile/tablet/MiniApp/QuickApp/left-safe landscape strategy preserving the canonical floating bottom dock.
#[derive(Clone, Copy, Debug, Default)]
pub(crate) struct BottomFloatingDockStrategy;