euv-core 0.46.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::*;

/// Hardware display and input profile descriptor for a smartwatch vendor target.
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct WearableProfile {
    /// Smartwatch ecosystem vendor.
    #[get(type(copy))]
    pub(crate) vendor: WearableVendor,
    /// Physical watch face shape (`Round`, `Squircle`, or `Rectangular`).
    #[get(type(copy))]
    pub(crate) shape: WearableShape,
    /// Logical viewport width in dp.
    #[get(type(copy))]
    pub(crate) logical_width: u32,
    /// Logical viewport height in dp.
    #[get(type(copy))]
    pub(crate) logical_height: u32,
    /// Display density scale factor mapping dp to physical pixels.
    #[get(type(copy))]
    pub(crate) scale_factor: f32,
    /// Optional bottom chin inset in logical dp for flat-tire round dials.
    #[get(type(copy))]
    pub(crate) chin_height_dp: f32,
    /// Interactive refresh rate in Hertz (`30.0`..=`60.0`).
    #[get(type(copy))]
    pub(crate) refresh_rate_hz: f32,
    /// Whether the watch supports a rotary crown or rotating bezel.
    #[get(type(copy))]
    pub(crate) has_rotary_crown: bool,
    /// Whether the watch supports Always-On Display (AOD) low-power ambient mode.
    #[get(type(copy))]
    pub(crate) supports_aod: bool,
}

/// Normalized rotary crown or rotating bezel rotation event payload.
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct WearableCrownInput {
    /// Signed detent delta (`> 0.0` clockwise / scroll down, `< 0.0` counter-clockwise / scroll up).
    #[get(type(copy))]
    pub(crate) detents: f32,
    /// Instantaneous angular velocity in detents per second.
    #[get(type(copy))]
    pub(crate) velocity: f32,
    /// Semantic mapping mode (`Scroll`, `FocusStep`, or `DirectionalStep`).
    #[get(type(copy))]
    pub(crate) mode: WearableCrownMode,
    /// Whether a subtle tactile haptic detent tick should accompany this input.
    #[get(type(copy))]
    pub(crate) haptic_detent: bool,
}

/// Live window record tracked by `WearablePlatform`.
#[derive(Clone, Data, Debug)]
pub struct WearableWindowRecord {
    /// Window configuration snapshot.
    pub(crate) config: WindowConfig,
    /// Live window metrics with inscribed safe-area insets applied.
    #[get(type(copy))]
    pub(crate) state: WindowState,
    /// Opaque vendor native surface pointer (`0` in offscreen/simulated sessions).
    #[get(type(copy))]
    pub(crate) native_surface: usize,
    /// Last presented RGBA8 framebuffer snapshot.
    pub(crate) last_frame: Framebuffer,
    /// Total frames presented in interactive mode.
    #[get(type(copy))]
    pub(crate) present_count: u64,
    /// Total low-power AOD ambient ticks rendered.
    #[get(type(copy))]
    pub(crate) ambient_tick_count: u64,
}

/// Unified smartwatch host backend smoothing Wear OS, watchOS, HarmonyOS Watch, HyperOS/Vela, OPPO, vivo, Garmin, and ZeppOS.
#[derive(Clone, Data, Debug)]
pub struct WearablePlatform {
    /// Active wearable hardware and display profile.
    #[get(type(copy))]
    pub(crate) profile: WearableProfile,
    /// Current Always-On Display / screen power mode.
    #[get(type(copy))]
    pub(crate) ambient_mode: WearableAmbientMode,
    /// Computed compact viewport scale factor for adaptive UI density.
    #[get(type(copy))]
    pub(crate) compact_scale: f32,
    /// Computed shape-aware safe-area insets (inscribed square for round screens).
    #[get(type(copy))]
    pub(crate) safe_area: SafeAreaInsets,
    /// Fractional rotary crown detent accumulator for crisp discrete focus/arrow steps.
    #[get(type(copy))]
    pub(crate) crown_accumulator: f32,
    /// Logical scroll distance emitted per rotary crown detent.
    #[get(type(copy))]
    pub(crate) crown_scroll_step: f32,
    /// Monotonic window identifier allocator.
    #[get(pub(crate), type(copy))]
    #[get_mut(pub(crate))]
    #[set(pub(crate))]
    pub(crate) next_id: u64,
    /// Primary watch window handle, if created.
    #[get(skip)]
    pub(crate) primary_window: Option<WindowId>,
    /// Active watch windows indexed by `WindowId`.
    pub(crate) windows: HashMap<WindowId, WearableWindowRecord>,
    /// Touch contact lifecycle tracker ensuring palm-cover and screen-off cancel dangling touches.
    pub(crate) touch_tracker: TouchPointerTracker,
    /// Queued normalized window and system events awaiting `poll_events()`.
    pub(crate) pending_events: Vec<WindowEvent>,
    /// In-memory sandbox storage backing `PlatformStorage`.
    pub(crate) storage: HashMap<String, String>,
    /// Navigation stack backing `PlatformNavigation`.
    pub(crate) route_stack: Vec<String>,
    /// Active watch OS theme (`Dark` default for OLED power efficiency).
    #[get(type(copy))]
    pub(crate) theme: ThemeMode,
    /// Whether the watch frame pump is paused (`true` in `ScreenOff` or suspended ambient).
    #[get(type(copy))]
    pub(crate) pump_paused: bool,
    /// Count of rotary haptic detent pulses emitted.
    #[get(type(copy))]
    pub(crate) haptic_detent_count: u64,
}