euv-docs 0.47.1

Cross-platform documentation viewer and static site generator powered by euv and euv-ui.
Documentation
/// CLI flag enabling release profile compilation for multi-locale WASM bundles.
pub const DOCS_FLAG_RELEASE: &str = "--release";
/// CLI flag enabling debug profile compilation for multi-locale WASM bundles.
pub const DOCS_FLAG_DEBUG: &str = "--debug";
/// CLI flag selecting a single locale to build (`--locale <dir|prefix|label>`).
pub const DOCS_FLAG_LOCALE: &str = "--locale";
/// CLI flag forcing legacy single-locale static HTML output even when `locales:` is declared.
pub const DOCS_FLAG_STATIC_HTML: &str = "--static-html";

pub(crate) const BUNDLE_PKG_DIR: &str = "pkg";
pub(crate) const BUNDLE_INDEX_HTML: &str = "index.html";
pub(crate) const BUNDLE_NOT_FOUND_HTML: &str = "404.html";
pub(crate) const BUNDLE_PUBLIC_DIR: &str = "public";
pub(crate) const BUNDLE_BUILDER_DIR: &str = "euv-docs-wasm-builder";
pub(crate) const BUNDLE_TARGET_DIR: &str = "euv-docs-wasm-target";
pub(crate) const BUNDLE_CRATE_NAME: &str = "euv_docs_site";
pub(crate) const BUNDLE_SHELL_JSON_FILE: &str = "site_shell.json";
pub(crate) const BUNDLE_BODIES_BIN_FILE: &str = "site_bodies.euvz";
pub(crate) const BUNDLE_CARGO_TOML: &str = "Cargo.toml";
pub(crate) const BUNDLE_SRC_DIR: &str = "src";
pub(crate) const BUNDLE_LIB_RS: &str = "lib.rs";
pub(crate) const BUNDLE_WASM_PACK_BIN: &str = "wasm-pack";
pub(crate) const BUNDLE_ARG_BUILD: &str = "build";
pub(crate) const BUNDLE_ARG_TARGET: &str = "--target";
pub(crate) const BUNDLE_ARG_WEB: &str = "web";
pub(crate) const BUNDLE_ARG_NO_TS: &str = "--no-typescript";
pub(crate) const BUNDLE_ARG_OUT_DIR: &str = "--out-dir";
pub(crate) const BUNDLE_ARG_OUT_NAME: &str = "--out-name";
pub(crate) const BUNDLE_ARG_DEV: &str = "--dev";
pub(crate) const BUNDLE_ENV_TARGET_DIR: &str = "CARGO_TARGET_DIR";
pub(crate) const BUNDLE_ENV_RUSTC_WRAPPER: &str = "RUSTC_WRAPPER";
pub(crate) const BUNDLE_NAME_PREFIX: &str = "euv_docs_";
pub(crate) const BUNDLE_BG_WASM_SUFFIX: &str = "_bg.wasm";
pub(crate) const BUNDLE_JS_EXT: &str = ".js";
pub(crate) const BUNDLE_MJS_EXT: &str = ".mjs";
pub(crate) const BUNDLE_CSS_EXT: &str = ".css";
pub(crate) const BUNDLE_FORBIDDEN_DIRS: [&str; 2] = ["js", "webfonts"];
pub(crate) const BUNDLE_SKIP_FILES: [&str; 1] = [".DS_Store"];
pub(crate) const BUNDLE_EXPORT_PREFIX: &str = "export ";
pub(crate) const BUNDLE_EXPORT_BRACE: &str = "export {";
pub(crate) const BUNDLE_EXPORT_DEFAULT: &str = "export default ";
pub(crate) const BUNDLE_WASM_BINDGEN_VER: &str = "0.2";
pub(crate) const BUNDLE_DIR_CORE: &str = "core";
pub(crate) const BUNDLE_DIR_MACROS: &str = "macros";
pub(crate) const BUNDLE_DIR_UI: &str = "ui";
pub(crate) const BUNDLE_DEFAULT_LOCALE_SUFFIX: &str = "default";
pub(crate) const BUNDLE_ESC_AMP: &str = "&amp;";
pub(crate) const BUNDLE_ESC_LT: &str = "&lt;";
pub(crate) const BUNDLE_ESC_GT: &str = "&gt;";
pub(crate) const BUNDLE_ESC_QUOT: &str = "&quot;";
pub(crate) const BUNDLE_HTML_DOCTYPE_OPEN: &str = "<!DOCTYPE html>\n<html lang=\"";
pub(crate) const BUNDLE_ERR_NO_LOCALES: &str =
    "No locales declared in root README.md frontmatter for multi-locale WASM build";
pub(crate) const BUNDLE_ERR_NO_MATCHING_LOCALE: &str =
    "No locale matched the requested --locale filter";
pub(crate) const BUNDLE_ERR_WASM_PACK: &str = "wasm-pack build failed";
pub(crate) const BUNDLE_WRAPPER_LIB_RS: &str = r#"use wasm_bindgen::prelude::wasm_bindgen;

const SITE_SHELL_JSON: &str = include_str!("site_shell.json");
const SITE_BODIES_BIN: &[u8] = include_bytes!("site_bodies.euvz");

#[wasm_bindgen]
pub fn euv_docs_web_start() -> u64 {
    euv_docs::boot_wasm_docs_compressed_bundle(SITE_SHELL_JSON, SITE_BODIES_BIN)
}

#[wasm_bindgen]
pub fn euv_docs_render_route(route: &str) -> u64 {
    euv_docs::wasm_docs_render_route(route)
}

#[wasm_bindgen]
pub fn euv_docs_pointer_move(x: f32, y: f32) -> u64 {
    euv_docs::wasm_docs_pointer_move(x, y)
}

#[wasm_bindgen]
pub fn euv_docs_pointer_down(x: f32, y: f32) -> u64 {
    euv_docs::wasm_docs_pointer_down(x, y)
}

#[wasm_bindgen]
pub fn euv_docs_pointer_up(x: f32, y: f32) -> u64 {
    euv_docs::wasm_docs_pointer_up(x, y)
}

#[wasm_bindgen]
pub fn euv_docs_scroll(dx: f32, dy: f32) -> u64 {
    euv_docs::wasm_docs_scroll(dx, dy)
}

#[wasm_bindgen]
pub fn euv_docs_key_down(key: &str) -> u64 {
    euv_docs::wasm_docs_key_down(key)
}

#[wasm_bindgen]
pub fn euv_docs_resize(width: u32, height: u32, dpr: f32) -> u64 {
    euv_docs::wasm_docs_resize(width, height, dpr)
}

#[wasm_bindgen]
pub fn euv_docs_tick(dt_secs: f32) -> u64 {
    euv_docs::wasm_docs_tick(dt_secs)
}
"#;
pub(crate) const BUNDLE_HTML_HEAD_MID: &str = "\">\n<head>\n<meta charset=\"utf-8\"/>\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1,viewport-fit=cover\"/>\n<meta name=\"description\" content=\"";
pub(crate) const BUNDLE_HTML_DESC_END: &str = "\"/>\n<link rel=\"icon\" type=\"image/png\" href=\"https://devhub.vip/pages/docs/img/euv.png\"/>\n<title>";
pub(crate) const BUNDLE_HTML_STYLE_AND_BODY: &str = "</title>\n<style>:root{--euv-safe-top:env(safe-area-inset-top,0px);--euv-safe-right:env(safe-area-inset-right,0px);--euv-safe-bottom:env(safe-area-inset-bottom,0px);--euv-safe-left:env(safe-area-inset-left,0px);}html,body{margin:0;padding:0;width:100vw;height:100vh;height:100dvh;overflow:hidden;background:#09090b;touch-action:none;}</style>\n</head>\n<body>\n<script type=\"module\">\n";
pub(crate) const BUNDLE_HTML_BOOT_PREFIX: &str = "\nawait __wbg_init({ module_or_path: './pkg/";
pub(crate) const BUNDLE_HTML_BOOT_SUFFIX: &str = r#"' });
euv_docs_web_start();
function syncSize(){const w=Math.max(320,Math.round(window.innerWidth||1200));const h=Math.max(320,Math.round(window.innerHeight||800));euv_docs_resize(w,h,window.devicePixelRatio||1);}
syncSize();
window.addEventListener('resize',syncSize);
window.addEventListener('hashchange',()=>{const h=(window.location.hash||'').replace(/^#/,'');if(h.startsWith('/'))euv_docs_render_route(h);});
const cvs=document.querySelector('canvas');
if(cvs){
const pt=(ev)=>{const r=cvs.getBoundingClientRect();return [ev.clientX-r.left,ev.clientY-r.top];};
cvs.addEventListener('pointermove',(ev)=>{const [x,y]=pt(ev);euv_docs_pointer_move(x,y);});
cvs.addEventListener('pointerdown',(ev)=>{const [x,y]=pt(ev);euv_docs_pointer_down(x,y);});
cvs.addEventListener('pointerup',(ev)=>{const [x,y]=pt(ev);euv_docs_pointer_up(x,y);});
cvs.addEventListener('wheel',(ev)=>{ev.preventDefault();euv_docs_scroll(ev.deltaX,ev.deltaY);},{passive:false});
}
window.addEventListener('keydown',(ev)=>{euv_docs_key_down(ev.key);});
let prevTs=performance.now();
function frame(ts){const dt=Math.min(0.1,Math.max(0,(ts-prevTs)/1000));prevTs=ts;euv_docs_tick(dt);requestAnimationFrame(frame);}
requestAnimationFrame(frame);
</script>
</body>
</html>
"#;