[package]
name = "mirui"
version = "0.33.0"
edition = "2024"
authors = ["Benign X <1341398182@qq.com>"]
license = "MIT"
description = "A lightweight, no_std ECS-driven UI framework for embedded, desktop, and WebAssembly"
repository = "https://github.com/W-Mai/mirui"
homepage = "https://github.com/W-Mai/mirui"
documentation = "https://docs.rs/mirui"
readme = "README.md"
keywords = ["ui", "gui", "ecs", "embedded", "no-std"]
categories = ["gui", "embedded"]
rust-version = "1.85"

[workspace]
members = [".", "xtask", "mirui-macros", "mirx", "gallery", "gallery/web"]

[dependencies]
mirui-macros = { version = "0.33.0", path = "mirui-macros" }
mirx = { version = "0.33.0", path = "mirx" }
critical-section = { version = "1.2", default-features = false }
hashbrown = { version = "0.15", default-features = false, features = ["default-hasher"] }
rustc-hash = { version = "2", default-features = false }

[features]
default = ["quad-aa"]
std = ["critical-section/std", "dep:web-time"]
sdl = ["dep:sdl2", "std"]
sdl-gpu = ["sdl", "dep:sdl2-sys", "dep:lyon"]
wgpu = ["dep:wgpu", "dep:winit", "dep:bytemuck", "dep:lyon", "dep:pollster", "std"]
web-canvas = [
    "dep:web-sys",
    "dep:js-sys",
    "dep:wasm-bindgen",
    "dep:wasm-bindgen-futures",
    "std",
]
linux-fb = ["dep:memmap2", "dep:evdev", "dep:libc", "dep:signal-hook", "std"]
linux-drm = ["dep:drm", "dep:drm-ffi", "dep:evdev", "dep:libc", "dep:signal-hook", "std"]
nuttx = ["dep:libc", "std"]
perf = []
sync-cache = []
# Anti-aliasing for 3D-transformed quads. On `std` this uses a Fixed64
# signed-distance field for smooth coverage; on `no_std` it degrades to
# a 2×2 supersample (5 coverage steps). Disable to get the old v0.9.x
# hard-edge binary fill back — embedded targets that can't spare the
# cycles should `default-features = false`.
quad-aa = []
gallery = []

[dependencies.sdl2]
version = "0.37"
optional = true

[dependencies.sdl2-sys]
version = "0.37"
optional = true

[dependencies.lyon]
version = "1.0"
optional = true

[dependencies.wgpu]
version = "29"
optional = true

[dependencies.winit]
version = "0.30"
optional = true

[dependencies.bytemuck]
version = "1"
features = ["derive"]
optional = true

[dependencies.pollster]
version = "0.4"
optional = true

# Drop-in replacement for `std::time` on `wasm32-unknown-unknown` —
# native targets re-export `std::time` at zero cost; wasm reads
# `performance.now()` so `Instant::now()` doesn't panic.
[dependencies.web-time]
version = "1.1"
optional = true

# Linux-only deps for the fbdev / evdev backend.
[target.'cfg(target_os = "linux")'.dependencies]
memmap2 = { version = "0.9", optional = true }
evdev = { version = "0.13", optional = true }
signal-hook = { version = "0.3", optional = true }
drm = { version = "0.14", optional = true }
drm-ffi = { version = "0.9", optional = true }

# `libc` is needed on both linux (fbdev / drm) and nuttx (fb + touch +
# keyboard) backends, so it lives at the top level rather than under a
# target-specific table.
[dependencies.libc]
version = "0.2"
optional = true
default-features = false

# wasm32-only deps for the web-canvas backend.
[target.'cfg(target_arch = "wasm32")'.dependencies]
web-sys = { version = "0.3.99", optional = true, features = [
    "Window",
    "Document",
    "Element",
    "HtmlElement",
    "HtmlCanvasElement",
    "CanvasRenderingContext2d",
    "CssStyleDeclaration",
    "DomMatrix",
    "OffscreenCanvas",
    "OffscreenCanvasRenderingContext2d",
    "ImageData",
    "Path2d",
    "MouseEvent",
    "PointerEvent",
    "WheelEvent",
    "KeyboardEvent",
    "TouchEvent",
    "Touch",
    "TouchList",
    "DomRect",
    "EventTarget",
    "Event",
    "console",
] }
js-sys = { version = "0.3.99", optional = true }
wasm-bindgen = { version = "0.2.122", optional = true }
wasm-bindgen-futures = { version = "0.4.72", optional = true }

[dev-dependencies]
trybuild = "1"

[profile.release]
opt-level = "z"
lto = true
codegen-units = 1
strip = true
panic = "abort"
