blinc_platform_web 0.5.1

Blinc Web platform — HtmlCanvasElement integration, browser event conversion, and fetch-based asset loading for wasm32-unknown-unknown
Documentation
[package]
name = "blinc_platform_web"
description = "Blinc Web platform — HtmlCanvasElement integration, browser event conversion, and fetch-based asset loading for wasm32-unknown-unknown"
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
documentation = "https://docs.rs/blinc_platform_web"
rust-version.workspace = true
keywords = ["ui", "gui", "web", "wasm", "blinc"]
categories = ["gui", "wasm"]
publish = true

[lib]
crate-type = ["lib", "cdylib"]  # cdylib so wasm-bindgen can build the .wasm

[dependencies]
# Core dependencies (always available — must compile on every host so
# `cargo check` from a desktop dev box doesn't error out)
blinc_core = { path = "../../crates/blinc_core", version = "0.5.1" }
blinc_platform = { path = "../../crates/blinc_platform", version = "0.5.1" }

# Logging
tracing.workspace = true

# Browser-only deps. Everything we need to talk to the browser lives
# behind this gate so the crate is a no-op (just stub types) on native
# hosts. This matches how `blinc_platform_harmony` ships placeholder
# types when not compiled for OHOS.
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
js-sys = "0.3"
web-sys = { version = "0.3", features = [
    # Window / DOM
    "Window",
    "Document",
    "Element",
    "HtmlElement",
    "HtmlCanvasElement",
    "DomRect",
    "CssStyleDeclaration",
    "VisibilityState",
    # Input
    "MouseEvent",
    "KeyboardEvent",
    "WheelEvent",
    "TouchEvent",
    "TouchList",
    "Touch",
    # Navigator (clipboard, dpr…)
    "Navigator",
    "Clipboard",
    # Performance / time
    "Performance",
    # Fetch (asset loading)
    "Request",
    "RequestInit",
    "RequestMode",
    "Response",
    # WebGPU surface (informational — wgpu owns the actual surface
    # creation; we just need the canvas)
    "Gpu",
    "GpuCanvasContext",
] }

# Drop-in `std::time::Instant` replacement that's monotonic across
# `await` points on wasm32. On native it re-exports `std::time::*` so
# desktop builds pay nothing.
web-time = "1.1"

# Browser console panic hook — invaluable when wasm panics.
console_error_panic_hook = "0.1"

# `Date::now()`-based RNG so any transitive dependency that uses
# `getrandom` works on the web.
getrandom = { version = "0.2", features = ["js"] }