feat: add rust browser terminal prototype

This commit is contained in:
zhangheng
2026-06-08 16:34:13 +08:00
commit fd056ce502
43 changed files with 10312 additions and 0 deletions

36
app/src/shell.rs Normal file
View File

@@ -0,0 +1,36 @@
use app_config::SiteConfig;
use leptos::prelude::*;
use leptos_meta::MetaTags;
use crate::app::App;
pub fn shell(options: LeptosOptions) -> impl IntoView {
let css_href = SiteConfig::with_base_path("/pkg/base_path_demo.css");
let js_href = SiteConfig::with_base_path("/pkg/base_path_demo.js");
let wasm_href = SiteConfig::with_base_path("/pkg/base_path_demo.wasm");
let hydration_script = format!(
r#"import("{js_href}").then((mod) => {{
mod.default({{ module_or_path: "{wasm_href}" }}).then(() => mod.hydrate());
}});"#
);
view! {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content=SiteConfig::DESCRIPTION />
<link rel="stylesheet" href=css_href />
<link rel="modulepreload" href=js_href />
<link rel="preload" href=wasm_href r#as="fetch" r#type="application/wasm" crossorigin="anonymous" />
<AutoReload options=options.clone() />
<script type="module" inner_html=hydration_script></script>
<MetaTags />
</head>
<body>
<App />
</body>
</html>
}
}