waterui-cli 0.1.4

Cross-platform tooling for WaterUI applications
//! Apple platform support.

/// Apple backend implementation.
pub mod backend;
/// Apple device detection and management.
pub mod device;
pub(crate) mod dynamic_runtime;
/// macOS local device gestures and screenshot.
#[cfg(target_os = "macos")]
pub mod local;
/// Non-macOS stub for local Apple automation APIs.
#[cfg(not(target_os = "macos"))]
pub mod local {
    use std::path::Path;

    use color_eyre::eyre::{self, eyre};

    /// Information about a macOS window.
    #[derive(Debug, Clone)]
    pub struct WindowInfo {
        /// The window ID (used for screencapture -l).
        pub window_id: u32,
        /// The window title/name.
        pub name: String,
        /// The owning process ID.
        pub owner_pid: i32,
        /// The owning application name.
        pub owner_name: String,
        /// Window layer (0 = normal windows).
        pub layer: i32,
    }

    fn unsupported() -> eyre::Report {
        eyre!("apple::local is only supported on macOS")
    }

    fn unsupported_async<T>() -> impl std::future::Future<Output = eyre::Result<T>> {
        std::future::ready(Err(unsupported()))
    }

    /// Stub: local window enumeration is unavailable outside macOS.
    ///
    /// # Errors
    ///
    /// Always returns an unsupported-platform error.
    pub fn list_windows_by_pid(_pid: i32) -> eyre::Result<Vec<WindowInfo>> {
        Err(unsupported())
    }

    /// Stub: local screenshot is unavailable outside macOS.
    pub fn screenshot(_output: &Path) -> impl std::future::Future<Output = eyre::Result<()>> {
        unsupported_async()
    }

    /// Stub: local screenshot is unavailable outside macOS.
    pub fn screenshot_bytes() -> impl std::future::Future<Output = eyre::Result<Vec<u8>>> {
        unsupported_async()
    }

    /// Stub: local screenshot is unavailable outside macOS.
    pub fn screenshot_window(
        _window_id: u32,
        _output: &Path,
    ) -> impl std::future::Future<Output = eyre::Result<()>> {
        unsupported_async()
    }

    /// Stub: local screenshot is unavailable outside macOS.
    pub fn screenshot_window_bytes(
        _window_id: u32,
    ) -> impl std::future::Future<Output = eyre::Result<Vec<u8>>> {
        unsupported_async()
    }

    /// Stub: local tap is unavailable outside macOS.
    pub fn tap(_x: u32, _y: u32) -> impl std::future::Future<Output = eyre::Result<()>> {
        unsupported_async()
    }

    /// Stub: local swipe is unavailable outside macOS.
    pub fn swipe(
        _from: (u32, u32),
        _to: (u32, u32),
        _duration_ms: Option<u32>,
    ) -> impl std::future::Future<Output = eyre::Result<()>> {
        unsupported_async()
    }

    /// Stub: local text input is unavailable outside macOS.
    pub fn text(_input: &str) -> impl std::future::Future<Output = eyre::Result<()>> {
        unsupported_async()
    }
}
/// Apple platform configuration.
pub mod platform;
/// Apple toolchain management.
pub mod toolchain;