1pub const DOCS_FLAG_RELEASE: &str = "--release";
3pub const DOCS_FLAG_DEBUG: &str = "--debug";
5pub const DOCS_FLAG_LOCALE: &str = "--locale";
7pub const DOCS_FLAG_STATIC_HTML: &str = "--static-html";
9
10pub(crate) const BUNDLE_PKG_DIR: &str = "pkg";
11pub(crate) const BUNDLE_INDEX_HTML: &str = "index.html";
12pub(crate) const BUNDLE_NOT_FOUND_HTML: &str = "404.html";
13pub(crate) const BUNDLE_PUBLIC_DIR: &str = "public";
14pub(crate) const BUNDLE_BUILDER_DIR: &str = "euv-docs-wasm-builder";
15pub(crate) const BUNDLE_TARGET_DIR: &str = "euv-docs-wasm-target";
16pub(crate) const BUNDLE_CRATE_NAME: &str = "euv_docs_site";
17pub(crate) const BUNDLE_SHELL_JSON_FILE: &str = "site_shell.json";
18pub(crate) const BUNDLE_BODIES_BIN_FILE: &str = "site_bodies.euvz";
19pub(crate) const BUNDLE_CARGO_TOML: &str = "Cargo.toml";
20pub(crate) const BUNDLE_SRC_DIR: &str = "src";
21pub(crate) const BUNDLE_LIB_RS: &str = "lib.rs";
22pub(crate) const BUNDLE_WASM_PACK_BIN: &str = "wasm-pack";
23pub(crate) const BUNDLE_ARG_BUILD: &str = "build";
24pub(crate) const BUNDLE_ARG_TARGET: &str = "--target";
25pub(crate) const BUNDLE_ARG_WEB: &str = "web";
26pub(crate) const BUNDLE_ARG_NO_TS: &str = "--no-typescript";
27pub(crate) const BUNDLE_ARG_OUT_DIR: &str = "--out-dir";
28pub(crate) const BUNDLE_ARG_OUT_NAME: &str = "--out-name";
29pub(crate) const BUNDLE_ARG_DEV: &str = "--dev";
30pub(crate) const BUNDLE_ENV_TARGET_DIR: &str = "CARGO_TARGET_DIR";
31pub(crate) const BUNDLE_ENV_RUSTC_WRAPPER: &str = "RUSTC_WRAPPER";
32pub(crate) const BUNDLE_NAME_PREFIX: &str = "euv_docs_";
33pub(crate) const BUNDLE_BG_WASM_SUFFIX: &str = "_bg.wasm";
34pub(crate) const BUNDLE_JS_EXT: &str = ".js";
35pub(crate) const BUNDLE_MJS_EXT: &str = ".mjs";
36pub(crate) const BUNDLE_CSS_EXT: &str = ".css";
37pub(crate) const BUNDLE_FORBIDDEN_DIRS: [&str; 2] = ["js", "webfonts"];
38pub(crate) const BUNDLE_SKIP_FILES: [&str; 1] = [".DS_Store"];
39pub(crate) const BUNDLE_EXPORT_PREFIX: &str = "export ";
40pub(crate) const BUNDLE_EXPORT_BRACE: &str = "export {";
41pub(crate) const BUNDLE_EXPORT_DEFAULT: &str = "export default ";
42pub(crate) const BUNDLE_WASM_BINDGEN_VER: &str = "0.2";
43pub(crate) const BUNDLE_DIR_CORE: &str = "core";
44pub(crate) const BUNDLE_DIR_MACROS: &str = "macros";
45pub(crate) const BUNDLE_DIR_UI: &str = "ui";
46pub(crate) const BUNDLE_DEFAULT_LOCALE_SUFFIX: &str = "default";
47pub(crate) const BUNDLE_ESC_AMP: &str = "&";
48pub(crate) const BUNDLE_ESC_LT: &str = "<";
49pub(crate) const BUNDLE_ESC_GT: &str = ">";
50pub(crate) const BUNDLE_ESC_QUOT: &str = """;
51pub(crate) const BUNDLE_HTML_DOCTYPE_OPEN: &str = "<!DOCTYPE html>\n<html lang=\"";
52pub(crate) const BUNDLE_ERR_NO_LOCALES: &str =
53 "No locales declared in root README.md frontmatter for multi-locale WASM build";
54pub(crate) const BUNDLE_ERR_NO_MATCHING_LOCALE: &str =
55 "No locale matched the requested --locale filter";
56pub(crate) const BUNDLE_ERR_WASM_PACK: &str = "wasm-pack build failed";
57pub(crate) const BUNDLE_WRAPPER_LIB_RS: &str = r#"use wasm_bindgen::prelude::wasm_bindgen;
58
59const SITE_SHELL_JSON: &str = include_str!("site_shell.json");
60const SITE_BODIES_BIN: &[u8] = include_bytes!("site_bodies.euvz");
61
62#[wasm_bindgen]
63pub fn euv_docs_web_start() -> u64 {
64 euv_docs::boot_wasm_docs_compressed_bundle(SITE_SHELL_JSON, SITE_BODIES_BIN)
65}
66
67#[wasm_bindgen]
68pub fn euv_docs_render_route(route: &str) -> u64 {
69 euv_docs::wasm_docs_render_route(route)
70}
71
72#[wasm_bindgen]
73pub fn euv_docs_pointer_move(x: f32, y: f32) -> u64 {
74 euv_docs::wasm_docs_pointer_move(x, y)
75}
76
77#[wasm_bindgen]
78pub fn euv_docs_pointer_down(x: f32, y: f32) -> u64 {
79 euv_docs::wasm_docs_pointer_down(x, y)
80}
81
82#[wasm_bindgen]
83pub fn euv_docs_pointer_up(x: f32, y: f32) -> u64 {
84 euv_docs::wasm_docs_pointer_up(x, y)
85}
86
87#[wasm_bindgen]
88pub fn euv_docs_scroll(dx: f32, dy: f32) -> u64 {
89 euv_docs::wasm_docs_scroll(dx, dy)
90}
91
92#[wasm_bindgen]
93pub fn euv_docs_key_down(key: &str) -> u64 {
94 euv_docs::wasm_docs_key_down(key)
95}
96
97#[wasm_bindgen]
98pub fn euv_docs_resize(width: u32, height: u32, dpr: f32) -> u64 {
99 euv_docs::wasm_docs_resize(width, height, dpr)
100}
101
102#[wasm_bindgen]
103pub fn euv_docs_tick(dt_secs: f32) -> u64 {
104 euv_docs::wasm_docs_tick(dt_secs)
105}
106"#;
107pub(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=\"";
108pub(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>";
109pub(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";
110pub(crate) const BUNDLE_HTML_BOOT_PREFIX: &str = "\nawait __wbg_init({ module_or_path: './pkg/";
111pub(crate) const BUNDLE_HTML_BOOT_SUFFIX: &str = r#"' });
112euv_docs_web_start();
113function 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);}
114syncSize();
115window.addEventListener('resize',syncSize);
116window.addEventListener('hashchange',()=>{const h=(window.location.hash||'').replace(/^#/,'');if(h.startsWith('/'))euv_docs_render_route(h);});
117const cvs=document.querySelector('canvas');
118if(cvs){
119const pt=(ev)=>{const r=cvs.getBoundingClientRect();return [ev.clientX-r.left,ev.clientY-r.top];};
120cvs.addEventListener('pointermove',(ev)=>{const [x,y]=pt(ev);euv_docs_pointer_move(x,y);});
121cvs.addEventListener('pointerdown',(ev)=>{const [x,y]=pt(ev);euv_docs_pointer_down(x,y);});
122cvs.addEventListener('pointerup',(ev)=>{const [x,y]=pt(ev);euv_docs_pointer_up(x,y);});
123cvs.addEventListener('wheel',(ev)=>{ev.preventDefault();euv_docs_scroll(ev.deltaX,ev.deltaY);},{passive:false});
124}
125window.addEventListener('keydown',(ev)=>{euv_docs_key_down(ev.key);});
126let prevTs=performance.now();
127function frame(ts){const dt=Math.min(0.1,Math.max(0,(ts-prevTs)/1000));prevTs=ts;euv_docs_tick(dt);requestAnimationFrame(frame);}
128requestAnimationFrame(frame);
129</script>
130</body>
131</html>
132"#;