Skip to main content

euv_docs/
lib.rs

1//! euv-docs
2//!
3//! The documentation-site crate for the euv UI framework, built by
4//! `docs/build.rs` from the example app's locale markdown so the
5//! generated pages stay in sync with the source tree.
6
7mod app;
8mod component;
9mod data;
10mod router;
11
12mod generated {
13    include!(concat!(env!("OUT_DIR"), "/docs_gen.rs"));
14}
15
16pub use std::{cell::RefCell, fmt::Debug, rc::Rc};
17
18pub(crate) use {
19    app::*,
20    component::*,
21    data::*,
22    js_sys::{Promise, decode_uri_component, eval},
23    router::*,
24    web_sys::{Event, HtmlInputElement, KeyboardEvent, Location},
25};
26
27use {
28    euv::{wasm_bindgen::prelude::*, web_sys::*, *},
29    euv_ui::*,
30    wasm_bindgen_futures::{JsFuture, spawn_local},
31};
32
33/// Wasm entry point: injects the global stylesheet, mounts the docs
34/// shell into the host page, and installs the two DOM side effects the
35/// router cannot express declaratively (image load marking and the
36/// table-of-contents scroll spy).
37#[wasm_bindgen]
38pub fn main() {
39    console_error_panic_hook::set_once();
40    inject_app_global_css();
41    Css::inject_css(EUV_MD_CSS);
42    Css::inject_css(APP_GLOBAL_CSS);
43    App::mount(APP_MOUNT_SELECTOR, app);
44    let _: Result<JsValue, JsValue> = js_sys::eval(IMAGE_LOAD_WATCHER_JS);
45    let _: Result<JsValue, JsValue> = js_sys::eval(TOC_SCROLL_SPY_JS);
46}