euv-core 0.48.0

Core cross-platform runtime for euv featuring arena-based fine-grained reactivity, deterministic layout, flat scene graph, multi-mode rendering, and direct OS platform adapters.
Documentation
use super::*;

/// Device display metrics reported by QuickApp `@system.device.getInfo()`.
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct QuickAppDeviceMetrics {
    /// Active QuickApp runtime vendor (`Alliance` or `Huawei`).
    #[get(type(copy))]
    pub(crate) vendor: QuickAppVendor,
    /// Physical screen width in pixels.
    #[get(type(copy))]
    pub(crate) screen_width_px: u32,
    /// Physical screen height in pixels.
    #[get(type(copy))]
    pub(crate) screen_height_px: u32,
    /// Device display density (`px / dp`).
    #[get(type(copy))]
    pub(crate) screen_density: f32,
    /// QuickApp manifest `designWidth` reference (`750.0` default).
    #[get(type(copy))]
    pub(crate) design_width: f32,
    /// OS status bar height in physical pixels.
    #[get(type(copy))]
    pub(crate) status_bar_height_px: u32,
    /// OS bottom gesture/navigation bar height in physical pixels.
    #[get(type(copy))]
    pub(crate) nav_bar_height_px: u32,
    /// Active system theme mode.
    #[get(type(copy))]
    pub(crate) theme: ThemeMode,
}

/// Active QuickApp `<canvas>` window record held by `QuickAppPlatform`.
#[derive(Clone, Data, Debug)]
pub struct QuickAppWindowRecord {
    /// Window configuration snapshot.
    pub(crate) config: WindowConfig,
    /// Live window metrics in logical dp.
    #[get(type(copy))]
    pub(crate) state: WindowState,
    /// Canvas element identifier.
    #[get(type(copy))]
    pub(crate) canvas_id: u32,
    /// Last presented RGBA8 framebuffer snapshot.
    pub(crate) last_frame: Framebuffer,
    /// Total presented frames.
    #[get(type(copy))]
    pub(crate) present_count: u64,
}

/// Unified QuickApp runtime host adapter abstracting QuickApp Alliance (`@system.*`) and Huawei QuickApp.
#[derive(Clone, Data, Debug)]
pub struct QuickAppPlatform {
    /// Device screen, density, design-width, and status-bar metrics.
    #[get(type(copy))]
    pub(crate) device_metrics: QuickAppDeviceMetrics,
    /// Resolved logical safe-area insets.
    #[get(type(copy))]
    pub(crate) safe_area: SafeAreaInsets,
    /// Monotonic window identifier allocator.
    #[get(pub(crate), type(copy))]
    #[get_mut(pub(crate))]
    #[set(pub(crate))]
    pub(crate) next_id: u64,
    /// Primary QuickApp canvas window identifier, if created.
    #[get(skip)]
    pub(crate) primary_window: Option<WindowId>,
    /// Active QuickApp canvas windows.
    pub(crate) windows: HashMap<WindowId, QuickAppWindowRecord>,
    /// Multi-touch contact lifecycle tracker.
    pub(crate) touch_tracker: TouchPointerTracker,
    /// Queued normalized EUV `WindowEvent` and `SystemEvent`s.
    pub(crate) pending_events: Vec<WindowEvent>,
    /// Outbound `@system.*` host commands drained by the UX shell.
    pub(crate) outbound_commands: Vec<QuickAppHostCommand>,
    /// Mirrored `@system.storage` key-value cache.
    pub(crate) storage: HashMap<String, String>,
    /// Active `@system.router` navigation stack.
    pub(crate) route_stack: Vec<String>,
    /// Mirrored `@system.clipboard` text buffer.
    #[get(skip)]
    pub(crate) clipboard: Option<String>,
    /// Whether the QuickApp frame pump is paused (`onHide`/`onDestroy`).
    #[get(type(copy))]
    pub(crate) pump_paused: bool,
}