//! Interactive demo launcher.
//!
//! Runs `ui/demo.slint` — the component-browser app showing every
//! Neon component with live controls + a dark/light toggle. The
//! demo is its own binary, structurally separate from the
//! `slint-ui-system` library: the lib exposes Rust helpers + a
//! Slint library path; this binary is one of many possible
//! consumers (the simplest one available in-tree).
//!
//! Run with: `cargo run`.

slint::include_modules!();

use slint::ComponentHandle;

// Hook the demo's `DemoWindow` + Slint `Theme` global into the
// library's generic theme helpers. After this `impl_theme_access!`
// expansion, `slint_ui_system::theme::set_dark_mode(&demo, …)`
// and friends work on `DemoWindow` exactly like they will on any
// consumer's `MainWindow`.
slint_ui_system::impl_theme_access!(DemoWindow, Theme);

fn main() -> Result<(), slint::PlatformError> {
    let demo = DemoWindow::new()?;

    // Default to dark; the demo's toolbar lets the user flip at
    // runtime via the `is-dark` two-way binding inside demo.slint.
    slint_ui_system::theme::set_dark_mode(&demo, true);

    #[cfg(debug_assertions)]
    println!("Neon Design System — demo (DEBUG)");
    #[cfg(not(debug_assertions))]
    println!("Neon Design System — demo (RELEASE)");

    demo.run()
}
