[package]
name = "islands-runtime"
version.workspace = true
edition.workspace = true
description = "The shared WASM runtime for islands.rs: reactive Signal/Scope/effect primitives and idempotent island mounting, emitted as islands_core.{js,wasm}."
license.workspace = true
repository.workspace = true

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

[features]
default = ["nav"]
# Client-side navigation: same-origin link interception, manifest-driven bundle
# import, idiomorph-driven DOM morphing, and the full nav UX. Default-on; an app
# can build a nav-free, leaner core with `--no-default-features`. Pulls
# `islands-morph` with default-features off (only the morph subset nav needs) and
# the extra web-sys APIs the nav module touches, so the no-nav core stays lean.
nav = [
    "dep:islands-morph",
    "dep:serde",
    "dep:serde_json",
    "dep:wasm-bindgen-futures",
    "web-sys/MouseEvent",
    "web-sys/HtmlAnchorElement",
    "web-sys/HtmlTemplateElement",
    "web-sys/History",
    "web-sys/ScrollRestoration",
    "web-sys/PopStateEvent",
    "web-sys/Location",
    "web-sys/Url",
    "web-sys/AbortController",
    "web-sys/AbortSignal",
    "web-sys/Request",
    "web-sys/RequestInit",
    "web-sys/Response",
    "web-sys/Headers",
    "web-sys/Node",
    "web-sys/DocumentFragment",
    "web-sys/DomParser",
    "web-sys/SupportedType",
    "web-sys/ScrollToOptions",
    "web-sys/Navigator",
    "web-sys/IntersectionObserver",
    "web-sys/IntersectionObserverEntry",
]

[dependencies]
wasm-bindgen = "0.2"
js-sys = "0.3"
console_error_panic_hook = "0.1"

# nav-only dependencies (activated by the `nav` feature).
# `default-features = false` keeps `pantry` OFF: pantry-parking bypasses
# before_node_removed and would leak departing island Scopes (AC-V5/V14). See
# nav/lifecycle.rs::nav_morph_options. Do not enable it without a park-but-still-unmount path.
islands-morph = { path = "../islands-morph", version = "0.1.1", default-features = false, optional = true }
serde = { version = "1", features = ["derive"], optional = true }
serde_json = { version = "1", optional = true }
wasm-bindgen-futures = { version = "0.4", optional = true }

[dependencies.web-sys]
version = "0.3"
features = [
    "Document",
    "Element",
    "EventTarget",
    "HtmlElement",
    "NodeList",
    "Window",
    "console",
]

[dev-dependencies]
wasm-bindgen-test = "0.3"
