euv-cli 0.48.1

Cross-platform CLI tool for the euv native UI framework supporting run, build, check, fmt, doctor, new, and Hyperlane SSE dynamic updates across all supported platforms.
Documentation
pub(crate) const BIN_RUSTC: &str = "rustc";
pub(crate) const BIN_RUSTUP: &str = "rustup";
pub(crate) const BIN_XCRUN: &str = "xcrun";
pub(crate) const BIN_NODE: &str = "node";
pub(crate) const ARG_VERSION: &str = "--version";
pub(crate) const ARG_TARGET_SUB: &str = "target";
pub(crate) const ARG_LIST: &str = "list";
pub(crate) const ARG_INSTALLED: &str = "--installed";
pub(crate) const ARG_SHOW_SDK: &str = "--show-sdk-path";
pub(crate) const ARG_CHECK: &str = "check";
pub(crate) const ARG_FMT: &str = "fmt";
pub(crate) const ARG_FMT_ALL: &str = "--all";
pub(crate) const ARG_FMT_CHECK: &str = "--check";
pub(crate) const ARG_PACKAGE: &str = "--package";
pub(crate) const ARG_RUN: &str = "run";
pub(crate) const ARG_DOUBLE_DASH: &str = "--";
pub(crate) const ENV_ANDROID_NDK: &str = "ANDROID_NDK_HOME";
pub(crate) const ENV_OHOS_SDK: &str = "OHOS_SDK_HOME";
pub(crate) const ENV_DEVECO_SDK: &str = "DEVECO_SDK_HOME";
pub(crate) const STATUS_OK: &str = "ok";
pub(crate) const STATUS_MISSING: &str = "missing";
pub(crate) const CARGO_TOML_NAME: &str = "Cargo.toml";
pub(crate) const SRC_DIR_NAME: &str = "src";
pub(crate) const MAIN_RS_NAME: &str = "main.rs";
pub(crate) const README_NAME: &str = "README.md";
pub(crate) const INDEX_HTML_NAME: &str = "index.html";
pub(crate) const SUFFIX_WASM: &str = ".wasm";
pub(crate) const SUFFIX_JS: &str = ".js";
pub(crate) const SUFFIX_DTS: &str = ".d.ts";
pub(crate) const PACKAGE_JSON_NAME: &str = "package.json";
pub(crate) const GITIGNORE_NAME: &str = ".gitignore";
pub(crate) const EXPORT_BRACE_PREFIX: &str = "export {";
pub(crate) const EXPORT_DEFAULT_PREFIX: &str = "export default ";
pub(crate) const EXPORT_PREFIX: &str = "export ";
pub(crate) const FALLBACK_WBG_INIT: &str = "async function __wbg_init(p){var u=typeof p==='string'?p:p.module_or_path;if(u instanceof Uint8Array||u instanceof ArrayBuffer){await WebAssembly.instantiate(u);return;}await WebAssembly.instantiateStreaming(fetch(u));}";
pub(crate) const WEB_HTML_HEAD_OPEN: &str = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\"/>\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1,viewport-fit=cover\"/>\n<link rel=\"icon\" type=\"image/png\" href=\"https://devhub.vip/pages/docs/img/euv.png\"/>\n<link rel=\"apple-touch-icon\" href=\"https://devhub.vip/pages/docs/img/euv.png\"/>\n<title>";
pub(crate) const WEB_HTML_STYLE_AND_LOADER_OPEN: &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);--euv-bg:#09090b;--euv-fg:#fafafa;--euv-muted:#a1a1aa;--euv-track:rgba(255,255,255,0.1);--euv-ring:rgba(255,255,255,0.1);--euv-surface:rgba(24,24,27,0.78);--euv-glow:rgba(99,102,241,0.18);}@media (prefers-color-scheme:light){:root{--euv-bg:#fafafa;--euv-fg:#09090b;--euv-muted:#52525b;--euv-track:rgba(9,9,11,0.09);--euv-ring:rgba(9,9,11,0.09);--euv-surface:rgba(255,255,255,0.88);--euv-glow:rgba(99,102,241,0.12);}}html,body{margin:0;padding:0;width:100vw;height:100vh;height:100dvh;overflow:hidden;background:var(--euv-bg);touch-action:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;user-select:none;-webkit-user-select:none;outline:none;}canvas{display:block;touch-action:none;outline:none;-webkit-tap-highlight-color:transparent;}canvas:focus,canvas:focus-visible{outline:none;}#euv-wasm-loader{position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;padding:24px;box-sizing:border-box;background:radial-gradient(620px circle at 50% 42%,var(--euv-glow),transparent 68%),var(--euv-bg);color:var(--euv-fg);font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Inter,sans-serif;transition:opacity 220ms cubic-bezier(0.22,1,0.36,1);}.euv-wl-card{width:min(320px,86vw);display:flex;flex-direction:column;align-items:center;gap:14px;}.euv-wl-mark{width:48px;height:48px;border-radius:14px;display:flex;align-items:center;justify-content:center;background:var(--euv-surface);border:1px solid var(--euv-ring);box-shadow:0 8px 28px rgba(0,0,0,0.12);}.euv-wl-title{font-size:16px;font-weight:600;letter-spacing:-0.015em;text-align:center;line-height:1.3;margin:0;}.euv-wl-track{width:100%;height:4px;border-radius:999px;background:var(--euv-track);overflow:hidden;position:relative;}.euv-wl-bar{height:100%;width:0%;border-radius:999px;background:linear-gradient(90deg,#6366f1 0%,#38bdf8 55%,#22d3ee 100%);transition:width 140ms cubic-bezier(0.22,1,0.36,1);position:relative;overflow:hidden;}.euv-wl-bar::after{content:\"\";position:absolute;inset:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.45) 50%,transparent 100%);transform:translateX(-100%);animation:euv-wl-shimmer 1.3s ease-in-out infinite;}.euv-wl-meta{width:100%;display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:12px;font-weight:500;color:var(--euv-muted);font-variant-numeric:tabular-nums;}.euv-wl-err{display:none;width:100%;flex-direction:column;align-items:center;gap:10px;text-align:center;}.euv-wl-err-msg{font-size:12px;color:#ef4444;line-height:1.45;}.euv-wl-retry{appearance:none;border:1px solid var(--euv-ring);background:var(--euv-surface);color:var(--euv-fg);font:600 12px/1 -apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,sans-serif;padding:8px 16px;border-radius:999px;cursor:pointer;}@keyframes euv-wl-shimmer{0%{transform:translateX(-100%);}100%{transform:translateX(220%);}}</style>\n</head>\n<body>\n<div id=\"euv-wasm-loader\" role=\"status\" aria-live=\"polite\" aria-label=\"Loading WebAssembly\"><div class=\"euv-wl-card\"><div class=\"euv-wl-mark\" aria-hidden=\"true\"><svg width=\"26\" height=\"26\" viewBox=\"0 0 24 24\" fill=\"none\"><defs><linearGradient id=\"euv-g\" x1=\"2\" y1=\"2\" x2=\"22\" y2=\"22\" gradientUnits=\"userSpaceOnUse\"><stop stop-color=\"#6366f1\"/><stop offset=\"0.55\" stop-color=\"#38bdf8\"/><stop offset=\"1\" stop-color=\"#22d3ee\"/></linearGradient></defs><path d=\"M12 2.5L20.5 7.4V16.6L12 21.5L3.5 16.6V7.4L12 2.5Z\" stroke=\"url(#euv-g)\" stroke-width=\"1.8\" stroke-linejoin=\"round\"/><path d=\"M12 6.8L16.8 9.6V15.2L12 18L7.2 15.2V9.6L12 6.8Z\" fill=\"url(#euv-g)\" fill-opacity=\"0.22\" stroke=\"url(#euv-g)\" stroke-width=\"1.4\" stroke-linejoin=\"round\"/><circle cx=\"12\" cy=\"12.4\" r=\"2.1\" fill=\"url(#euv-g)\"/></svg></div><div class=\"euv-wl-title\">";
pub(crate) const WEB_HTML_LOADER_CLOSE_SCRIPT_OPEN: &str = "</div><div class=\"euv-wl-track\"><div class=\"euv-wl-bar\" id=\"euv-wasm-bar\"></div></div><div class=\"euv-wl-meta\"><span id=\"euv-wasm-status\">Downloading WebAssembly…</span><span id=\"euv-wasm-pct\">0%</span></div><div class=\"euv-wl-err\" id=\"euv-wasm-err\"><span class=\"euv-wl-err-msg\" id=\"euv-wasm-err-msg\"></span><button type=\"button\" class=\"euv-wl-retry\" id=\"euv-wasm-retry\">Retry</button></div></div></div>\n<script type=\"module\">\n";
pub(crate) const WEB_HTML_BOOT_PREFIX: &str = "\nconst __euvWasmUrl='./";
pub(crate) const WEB_HTML_BOOT_MID: &str = r#"';
const __euvLoader=document.getElementById('euv-wasm-loader');
const __euvBar=document.getElementById('euv-wasm-bar');
const __euvStatus=document.getElementById('euv-wasm-status');
const __euvPct=document.getElementById('euv-wasm-pct');
const __euvErr=document.getElementById('euv-wasm-err');
const __euvErrMsg=document.getElementById('euv-wasm-err-msg');
const __euvRetry=document.getElementById('euv-wasm-retry');
const __euvFmtMb=(b)=>(b/1048576).toFixed(1)+' MB';
const __euvSetProg=(p,msg)=>{const c=Math.max(0,Math.min(100,Math.round(p)));if(__euvBar)__euvBar.style.width=c+'%';if(__euvPct)__euvPct.textContent=c+'%';if(__euvStatus&&msg)__euvStatus.textContent=msg;};
async function __euvFetchWasm(url){
const resp=await fetch(url);
if(!resp.ok)throw new Error('HTTP '+resp.status);
const total=Number(resp.headers.get('content-length')||0);
if(!resp.body||typeof resp.body.getReader!=='function'){__euvSetProg(50,'Downloading WebAssembly…');return new Uint8Array(await resp.arrayBuffer());}
const reader=resp.body.getReader();
const chunks=[];let loaded=0;
for(;;){const r=await reader.read();if(r.done)break;chunks.push(r.value);loaded+=r.value.byteLength;if(total>0){__euvSetProg(Math.min(90,(loaded/total)*90),__euvFmtMb(loaded)+' / '+__euvFmtMb(total));}else{__euvSetProg(Math.min(85,85*(1-Math.exp(-loaded/3145728))),__euvFmtMb(loaded));}}
const out=new Uint8Array(loaded);let off=0;
for(const ch of chunks){out.set(ch,off);off+=ch.byteLength;}
return out;
}
async function __euvBoot(){
if(__euvErr)__euvErr.style.display='none';
__euvSetProg(0,'Downloading WebAssembly…');
try{
if(typeof fetch==='function'&&typeof ReadableStream!=='undefined'){
const bytes=await __euvFetchWasm(__euvWasmUrl);
__euvSetProg(92,'Compiling WebAssembly…');
await __wbg_init({ module_or_path: bytes });
}else{
__euvSetProg(50,'Loading WebAssembly…');
await __wbg_init({ module_or_path: './"#;
pub(crate) const WEB_HTML_BOOT_SUFFIX: &str = r#"' });
}
__euvSetProg(100,'Ready');
requestAnimationFrame(()=>{if(__euvLoader){__euvLoader.style.opacity='0';setTimeout(()=>{if(__euvLoader)__euvLoader.remove();},240);}});
}catch(err){
if(__euvStatus)__euvStatus.textContent='Load failed';
if(__euvErrMsg)__euvErrMsg.textContent=(err&&err.message)?String(err.message):'Failed to load WebAssembly module';
if(__euvErr)__euvErr.style.display='flex';
}
}
if(__euvRetry)__euvRetry.addEventListener('click',__euvBoot);
__euvBoot();
</script>
</body>
</html>
"#;
pub(crate) const WEB_BUNDLE_TITLE: &str = "euv Native WebAssembly App";
pub(crate) const ERR_WEB_WASM_MISSING: &str = "No .wasm artifact found in web output directory";
pub(crate) const ERR_STEP_FAILED: &str = "External command exited with non-zero status";
pub(crate) const HTML_ESC_AMP: &str = "&amp;";
pub(crate) const HTML_ESC_LT: &str = "&lt;";
pub(crate) const HTML_ESC_GT: &str = "&gt;";
pub(crate) const HTML_ESC_QUOT: &str = "&quot;";
pub(crate) const TEMPLATE_MAIN_RS: &str = "use {euv::*, euv_ui::*};\n\nfn main() {\n    let mut win: WindowConfig = WindowConfig::default();\n    win.set_title(\"euv Native App\".to_string())\n        .set_size(1024, 720)\n        .set_render(RenderConfig::default());\n    let mut cfg: AppConfig = AppConfig::default();\n    cfg.set_window(win);\n    if let Ok(mut app) = App::new(cfg) {\n        let tokens: ThemeTokens = ThemeTokens::resolve(DesignScheme::Shadcn, ThemeMode::Light);\n        let _: NodeId = app.mount(move || {\n            view! {\n                column {\n                    style: {\n                        width: Length::Percent(100.0)\n                        padding: Edges::all(SPACE_LG)\n                        gap: SPACE_MD\n                    }\n                    EuvHeader {\n                        title: \"euv Native App\"\n                        subtitle: \"Cross-platform Rust UI across 13 native targets\"\n                        tokens: tokens\n                    }\n                    EuvButton {\n                        label: \"Get Started\"\n                        tokens: tokens\n                    }\n                }\n            }\n        });\n        let _: Result<FrameStats, PlatformError> = app.run_frames(Some(1));\n    }\n}\n";
pub(crate) const TEMPLATE_README_SUFFIX: &str = "\n\nCross-platform native Rust UI app built with `euv` targeting Web, Android, iOS, iPadOS, macOS, Windows, and Linux.\n";