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

/// Supported QuickApp runtime distributions (QuickApp Alliance standard and Huawei QuickApp).
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum QuickAppVendor {
    /// QuickApp Alliance standard runtime (`@system.*` across Xiaomi, OPPO, vivo, Lenovo, Meizu, ZTE, Honor).
    #[default]
    Alliance,
    /// Huawei QuickApp runtime (`@system.*` + `@service.*` AppGallery QuickApp).
    Huawei,
}

/// Standard QuickApp `manifest.json` `features` module declarations.
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum QuickAppFeatureModule {
    /// `@system.router` page navigation.
    Router,
    /// `@system.storage` sandboxed key-value persistence.
    Storage,
    /// `@system.clipboard` system clipboard read/write.
    Clipboard,
    /// `@system.device` screen, safe-area, and device metadata.
    Device,
    /// `@system.network` connectivity reachability observer.
    Network,
    /// `@system.vibrator` haptic vibration feedback.
    Vibrator,
    /// `@system.prompt` toast and dialog bridge.
    Prompt,
    /// `@system.share` OS share sheet integration.
    Share,
}

/// Normalized QuickApp UX application and page lifecycle hooks mapped into EUV `SystemEvent`s.
#[derive(Clone, Debug, PartialEq)]
pub enum QuickAppLifecycleHook {
    /// `app.ux` `onCreate` initialization with optional `hap://app/` deep link.
    OnCreate {
        /// Optional incoming `hap://app/` deep link URI.
        deep_link: Option<String>,
    },
    /// `page.ux` `onShow` foreground visibility.
    OnShow,
    /// `page.ux` `onHide` background suspension (0% CPU/GPU freeze).
    OnHide,
    /// `app.ux` / `page.ux` `onDestroy` teardown.
    OnDestroy,
    /// `page.ux` `onBackPress` hardware/gesture back interception.
    OnBackPress,
    /// `page.ux` `onConfigurationChanged` updating theme or locale.
    OnConfigurationChanged {
        /// Updated Light/Dark appearance mode.
        theme: ThemeMode,
        /// Updated BCP-47 locale tag.
        locale: String,
    },
    /// Host memory trim notification (`level`: `1`=warning, `2`=critical).
    OnMemoryWarning(i32),
    /// Soft keyboard height update in physical pixels.
    OnKeyboardChanged {
        /// Whether soft keyboard is shown.
        visible: bool,
        /// Covered keyboard height in physical pixels.
        height_px: u32,
    },
}

/// Outbound `@system.*` host bridge command drained by the generated QuickApp UX shell.
#[derive(Clone, Debug, PartialEq)]
pub enum QuickAppHostCommand {
    /// `@system.router.push({ uri })`.
    RouterPush(String),
    /// `@system.router.back()`.
    RouterBack(u32),
    /// `@system.storage.set({ key, value })`.
    StorageSet {
        /// Storage key.
        key: String,
        /// Storage value.
        value: String,
    },
    /// `@system.storage.delete({ key })`.
    StorageDelete(String),
    /// `@system.storage.clear()`.
    StorageClear,
    /// `@system.clipboard.set({ text })`.
    ClipboardSet(String),
    /// `this.$page.setTitleBar({ text })`.
    SetTitleBar(String),
    /// `@system.vibrator.vibrate({ mode: 'short' })`.
    VibrateShort,
    /// Signals `<canvas>` 2D/WebGL frame presentation for `(width, height)`.
    PresentCanvas {
        /// Physical canvas width in pixels.
        width: u32,
        /// Physical canvas height in pixels.
        height: u32,
    },
}