facett-syschart 0.1.13

facett — system-map chart: free-positioned clickable nodes + edges with a per-node badge and an inline expandable detail panel
Documentation
//! **syschart_panel** — the [`facett_syschart`] architecture/topology map mounted on
//! the reusable [`facett_wasm_demo`] host: the [`SystemChart::demo`] constellation (a
//! small nordisk architecture grouped by layer — ingress `gateway` → the
//! `korp`/`nornir`/`holger` services → the `skade`/`iceberg` storage, with dependency
//! edges and per-service badges) rendered as a **native window** and a **wasm / WebGL
//! canvas** from the same source, ready for a Codeberg-Pages site (the harness recipe
//! in `facett-demo/README.md`). Click a service chip to expand its detail.
//!
//! - native: `cargo run -p facett-syschart --example syschart_panel`
//! - wasm:   `cargo build -p facett-syschart --example syschart_panel --target wasm32-unknown-unknown`
//!           then `wasm-bindgen … --target web` it and serve with the generated
//!           `index.html` ([`facett_wasm_demo::IndexHtml`]).

use facett_syschart::SystemChart;
use facett_wasm_demo::FacetApp;

/// The panel's fixture: the built-in layered constellation map.
fn panel() -> SystemChart {
    SystemChart::demo()
}

// ── native host ──────────────────────────────────────────────────────────────
#[cfg(not(target_arch = "wasm32"))]
fn main() -> eframe::Result<()> {
    facett_wasm_demo::NativeDemo::new("facett-syschart — architecture map demo")
        .run(move |_cc| FacetApp::boxed(Box::new(panel())))
}

// On wasm the entry point is `start` (below); `main` still has to exist to link.
#[cfg(target_arch = "wasm32")]
fn main() {}

// ── web host ─────────────────────────────────────────────────────────────────
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen(start)]
pub fn start() {
    facett_wasm_demo::WebDemo::new("demo_canvas").mount(move |_cc, _hash| FacetApp::boxed(Box::new(panel())));
}

/// The browser-readable state hook: `window.__syschart_state()` returns the map's
/// live `state_json` (nodes/edges/selection), so a headless drive verifies the
/// shipped bundle without a human.
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen(js_name = __syschart_state)]
pub fn syschart_state() -> String {
    facett_wasm_demo::latest_state()
}