pub(crate) const LIB_RS_NAME: &str = "lib.rs";
pub(crate) const DOCS_DIR_NAME: &str = "docs";
pub(crate) const DOCS_GUIDE_DIR_NAME: &str = "guide";
pub(crate) const DOCS_ZH_DIR_NAME: &str = "zh";
pub(crate) const GETTING_STARTED_MD_NAME: &str = "getting-started.md";
pub(crate) const ERR_INVALID_PROJECT_NAME: &str =
"project name must be non-empty and contain only ASCII alphanumerics, '-', or '_'";
pub(crate) const BUNDLE_ID_PREFIX: &str = "dev.euv.";
pub(crate) const SCAFFOLD_ASCII_HYPHEN: u8 = b'-';
pub(crate) const SCAFFOLD_ASCII_UNDERSCORE: u8 = b'_';
pub(crate) const SCAFFOLD_GITIGNORE: &str =
"/target\n/dist\n/.euv-updates\nCargo.lock\n.DS_Store\n";
pub(crate) const SCAFFOLD_APP_MAIN_RS: &str = r#"use {euv::*, euv_ui::*};
/// Application entry point mounting a cross-platform native `euv` window.
fn main() {
let mut win: WindowConfig = WindowConfig::default();
win.set_title("euv Native App".to_string())
.set_size(1024, 720)
.set_render(RenderConfig::default());
let mut cfg: AppConfig = AppConfig::default();
cfg.set_window(win);
if let Ok(mut app) = App::new(cfg) {
let tokens: ThemeTokens = ThemeTokens::resolve(DesignScheme::Shadcn, ThemeMode::Light);
let root_style: Style = style! {
FlexDirection::Column
Width(Length::Percent(100.0))
Padding(Edges::all(SPACE_LG))
Gap(SPACE_MD)
};
let _: NodeId = app.mount(move || {
view! {
column {
style: root_style
EuvHeader {
title: "euv Native App"
subtitle: "Cross-platform Rust UI with keyless style! and view!"
tokens: tokens
}
EuvButton {
label: "Get Started"
tokens: tokens
}
}
}
});
let _: Result<FrameStats, PlatformError> = app.run_frames(Some(1));
}
}
"#;
pub(crate) const SCAFFOLD_APP_LIB_RS: &str = r#"use {euv::*, euv_ui::*};
/// Mounts the shared root UI subtree across desktop, mobile, and Web targets.
pub fn mount_app_root(tokens: ThemeTokens) -> NodeId {
let root_style: Style = style! {
FlexDirection::Column
Width(Length::Percent(100.0))
Padding(Edges::all(SPACE_LG))
Gap(SPACE_MD)
};
view! {
column {
style: root_style
EuvHeader {
title: "euv Native App"
subtitle: "Shared cross-platform root view"
tokens: tokens
}
EuvButton {
label: "Launch"
tokens: tokens
}
}
}
}
"#;
pub(crate) const SCAFFOLD_WEB_LIB_RS: &str = r#"use {euv::*, euv_ui::*, wasm_bindgen::prelude::wasm_bindgen};
/// Zero-JS WebAssembly startup hook mounting the application canvas root.
#[wasm_bindgen(start)]
pub fn start_web_app() {
let mut win: WindowConfig = WindowConfig::default();
win.set_title("euv Web App".to_string())
.set_render(RenderConfig::default());
let mut cfg: AppConfig = AppConfig::default();
cfg.set_window(win);
if let Ok(mut app) = App::new(cfg) {
let tokens: ThemeTokens = ThemeTokens::resolve(DesignScheme::Shadcn, ThemeMode::Light);
let root_style: Style = style! {
FlexDirection::Column
Width(Length::Percent(100.0))
Padding(Edges::all(SPACE_LG))
Gap(SPACE_MD)
};
let _: NodeId = app.mount(move || {
view! {
column {
style: root_style
EuvHeader {
title: "euv WebAssembly App"
subtitle: "Zero-JS Rust UI compiled directly to wasm32"
tokens: tokens
}
EuvButton {
label: "Explore"
tokens: tokens
}
}
}
});
let _: Result<FrameStats, PlatformError> = app.run_frames(Some(1));
}
}
"#;
pub(crate) const SCAFFOLD_DYNAMIC_WIDGET_LIB_RS: &str = r##"#[link(wasm_import_module = "env")]
unsafe extern "C" {
fn euv_emit_ui(ptr: *const u8, len: usize);
}
const WIDGET_SPEC_JSON: &str = r#"{"kind":"Column","style":{"padding":16.0,"gap":8.0,"radius":12.0,"background_hex":2450411},"children":[{"kind":"Text","text":"Live OTA Dynamic Widget","style":{"font_size":16.0,"bold":true,"color_hex":16777215}},{"kind":"Text","text":"Hot-swapped via euv update build --push with zero app restart.","style":{"font_size":13.0,"color_hex":14807039}}]}"#;
#[unsafe(no_mangle)]
pub extern "C" fn euv_abi_version() -> i32 {
1
}
#[unsafe(no_mangle)]
pub extern "C" fn euv_render() -> i32 {
let bytes: &[u8] = WIDGET_SPEC_JSON.as_bytes();
unsafe {
euv_emit_ui(bytes.as_ptr(), bytes.len());
}
0
}
"##;
pub(crate) const SCAFFOLD_DOCS_ROOT_MD: &str = r#"---
site:
title: Euv Documentation
description: Zero-JS documentation site powered by euv + euv-ui.
locales:
- prefix: /
lang: en-US
label: English
dir: .
- prefix: /zh/
lang: zh-CN
label: 简体中文
dir: zh
---
# Welcome
Documentation site powered by `euv docs` with static HTML and multi-locale WebAssembly builds.
"#;
pub(crate) const SCAFFOLD_DOCS_GUIDE_MD: &str = r#"# Getting Started
Run `euv docs dev` for live SSE hot-reload or `euv docs build --wasm --release` for a zero-JS multi-locale WebAssembly site.
"#;
pub(crate) const SCAFFOLD_DOCS_ZH_MD: &str = r#"# 欢迎使用
基于 `euv docs` 构建的零 JS 文档站,支持静态 HTML 与多语言 WebAssembly 构建。
"#;