euv-core 0.46.1

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::*;

/// Browser canvas window record storing live DOM `HtmlCanvasElement` and 2D blit context.
#[derive(Clone, CustomDebug, Data)]
pub struct WebWindowRecord {
    /// Declarative window configuration.
    pub(crate) config: WindowConfig,
    /// Live window state and DPR metrics.
    #[get(type(copy))]
    pub(crate) state: WindowState,
    /// Assigned canvas registration identifier.
    #[get(type(copy))]
    pub(crate) canvas_id: u32,
    /// Backing DOM canvas element.
    #[debug(skip)]
    #[get(skip)]
    pub(crate) canvas: Option<HtmlCanvasElement>,
    /// Cached 2D software blit context.
    #[debug(skip)]
    #[get(skip)]
    pub(crate) ctx2d: Option<CanvasRenderingContext2d>,
}

/// Direct Browser WebAssembly (`web-sys` Canvas2D / WebGL2 / WebGPU / DOM Events) platform backend.
#[derive(Clone, Data, Debug)]
pub struct WebPlatform {
    /// Monotonic window handle allocator.
    #[get(pub(crate), type(copy))]
    #[get_mut(pub(crate))]
    #[set(pub(crate))]
    pub(crate) next_id: u64,
    /// Active web canvas windows.
    pub(crate) windows: HashMap<WindowId, WebWindowRecord>,
    /// Queued browser pointer, keyboard, wheel, and resize events.
    pub(crate) pending_events: Vec<WindowEvent>,
    /// Clipboard cache.
    #[get(skip)]
    pub(crate) clipboard_cache: Option<String>,
    /// Last observed `document.hidden` visibility state.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    pub(crate) last_hidden: bool,
    /// Last observed `navigator.onLine` connectivity state.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    pub(crate) last_online: bool,
    /// Last observed browser dark/light appearance mode.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    pub(crate) last_theme: ThemeMode,
    /// Last observed browser BCP-47 locale tag.
    #[get(pub(crate))]
    #[set(pub(crate))]
    pub(crate) last_locale: String,
    /// Last measured CSS `env(safe-area-inset-*)` insets in logical CSS pixels.
    #[get(pub(crate), type(copy))]
    #[get_mut(pub(crate))]
    #[set(pub(crate))]
    pub(crate) last_safe_area: SafeAreaInsets,
    /// Measured browser display refresh rate in Hertz (`60.0` default, updated from `requestAnimationFrame` cadence).
    #[get(pub(crate), type(copy))]
    #[get_mut(pub(crate))]
    #[set(pub(crate))]
    pub(crate) refresh_rate_hz: f32,
    /// Whether the browser `requestAnimationFrame` loop is paused while hidden/backgrounded.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    pub(crate) pump_paused: bool,
}