[package]
name = "eulumdat-wasm"
version.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
description = "WebAssembly Eulumdat (LDT/IES) Editor - Browser-based photometric file editor"

[package.metadata.bevy_cli.web.release]
wasm-opt = ["-Oz", "-all"]

[lib]
crate-type = ["cdylib", "rlib"]

[[bin]]
name = "eulumdat-wasm"
path = "src/main.rs"

[features]
default = ["csr"]
csr = ["leptos/csr"]
ssr = ["leptos/ssr"]
hydrate = ["leptos/hydrate"]
bevy-viewer = ["eulumdat-bevy"]

[dependencies]
# Core library
eulumdat.workspace = true
gloo.workspace = true
gloo-file.workspace = true
js-sys.workspace = true
console_error_panic_hook.workspace = true

# Web framework (Leptos)
leptos.workspace = true
leptos_router.workspace = true

# WASM bindings
wasm-bindgen.workspace = true
wasm-bindgen-futures.workspace = true

# Utilities
base64.workspace = true

# 3D Scene Viewer (Bevy) - optional for larger WASM bundle
eulumdat-bevy = { workspace = true, optional = true }

[dependencies.web-sys]
version = "0.3"
features = [
    "File",
    "FileList",
    "FileReader",
    "Blob",
    "BlobPropertyBag",
    "Url",
    "DragEvent",
    "DataTransfer",
    "HtmlInputElement",
    "HtmlSelectElement",
    "HtmlTextAreaElement",
    "HtmlAnchorElement",
    "Window",
    "Document",
    "Element",
    "HtmlElement",
    "MouseEvent",
    "WheelEvent",
    "DomRect",
    "console",
    "Navigator",
    "Clipboard",
    "HtmlCanvasElement",
    "CanvasRenderingContext2d",
    "WebGlRenderingContext",
    "WebGl2RenderingContext",
    "WebGlProgram",
    "WebGlShader",
    "WebGlBuffer",
    "WebGlUniformLocation",
    "Performance",
    "Storage",
]

[dev-dependencies]
wasm-bindgen-test.workspace = true

# Optimized web release profile
[profile.web-release]
inherits = "release"
opt-level = 'z'
lto = "fat"
codegen-units = 1
strip = true
debug = false
