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