<div align="center">
# Euv
<img src="https://devhub.vip/pages/docs/img/euv.png" alt="Euv logo" height="160">
**High-Performance Cross-Platform Native UI Framework, 3D Engine & Markdown Studio for Pure Rust**
_Zero WebView · Zero Virtual DOM · Direct OS APIs · 13 Target Platforms · Bit-Identical Rendering_
[](https://crates.io/crates/euv)
[](https://crates.io/crates/euv)
[](https://docs.rs/euv)
[](https://github.com/euv-dev/euv/actions)
[](./LICENSE)
[](https://www.rust-lang.org)
[API Docs](https://docs.rs/euv/latest/) · [Guide](./docs/docs/en/guide/getting-started.md) · [Component Catalog](./docs/docs/en/components/README.md) · [Markdown & Eva Theme Showcase](./docs/docs/en/guide/markdown-syntax.md) · [Agent Engineering Rules](./AGENTS.md)
</div>
---
## Overview
**Euv** is a full-stack native Rust UI framework designed for production desktop, mobile, tablet, and WebAssembly applications. Rather than wrapping a browser engine or diffing a virtual DOM, `euv` compiles declarative Rust macros directly into a flat retained scene graph powered by fine-grained push-pull reactivity, deterministic Flexbox/Grid layout, native OS typography, and a unified CPU/GPU/Hybrid rendering pipeline.
```mermaid
flowchart LR
Macros["Declarative Macros\nview! · style! · #[component]"] --> Core["euv-core\nArena Signals · Freeze Router · EventBus"]
Core --> Layout["Deterministic Layout\nFlexbox · Grid · O(1) Subtree Cache"]
Layout --> Render["Multi-Mode Renderer\nAuto · Software SDF · Metal/Vulkan/D3D12/WebGL2"]
Render --> Targets["13 Platform Targets\nWeb · Mobile · Desktop · HarmonyOS · Wearables · MiniApp · TUI/CLI"]
Core --> UI["euv-ui\n60+ Components · 17 Compiled Themes · Eva Bold Markdown"]
```
---
## Key Capabilities
| Pillar | Highlights |
| :----------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **13 Platform Targets (Zero WebView)** | Direct OS/host backends with native 240/360/480Hz+ VSync across **Web** (WASM WebGPU/WebGL2 + demand-driven `rAF`), **Android** (NDK `ANativeWindow` + GLES3/Vulkan + NDK FreeType), **iOS & iPadOS** (`libobjc` UIKit + `CAMetalLayer` + ProMotion `CADisplayLink` + SafeArea), **macOS** (AppKit + CoreText + `CAMetalLayer` + `CVDisplayLink`/`CADisplayLink`), **Windows** (Win32 + D3D12/DXGI waitable swapchain + high-res timer), **Linux** (`dlopen` Wayland primary + Vulkan WSI / X11 `MIT-SHM` + FreeType), **HarmonyOS / OpenHarmony** (Stage-Model XComponent + `OH_NativeVSync`), **Wearables** (9 ecosystems: Wear OS, watchOS, HarmonyOS Watch, HyperOS Vela, vivo BlueOS Watch, OPPO ColorOS Watch, Garmin, Zepp OS, Generic), **MiniApps & QuickApps** (7 super-app vendors + QuickApp), and **Terminal TUI & Static/Pipe CLI**. |
| **Single-Word Declarative Macros + IDE Go-to-Definition** | Zero-cost minimal-codegen `view!` (pre-bound `style: card_style` only; inline `style` is a compile error), keyless strongly-typed `style!` (one typed rule per line, no `;`), `var!`, `state!`, `#[store]`, `watch!`, `computed!`, `#[component(retention = Freeze)]`, `#[event]`, `emit!`, `on!`, `#[euv]`, plus `#[derive(Props)]`. Built-in tags and properties resolve directly to exported schema structs (`euv::ViewElement`, `euv::ColumnElement`, `euv::StyleProps`, etc.), and custom components jump straight to their struct definitions in rust-analyzer. |
| **Full-Platform Adaptive Rendering, Direct GPU & Composite Scroll** | GPU-first 5-stage `AdaptiveRenderRouter` (`RecommendOnly` default / `AutoSwitch` live) + `HandoffCoordinator` + truthful `AdaptiveFrameMetrics` (`ObservableMetric` serializing unobservable values as `null`, never fake zeros) + sparse-effect `HybridRenderer` (auto-disqualified when net gain `<= 0`), single-backend lazy `Renderer::new` with zero-CPU-mirror direct GPU present across Android GLES 3.0 `EGLSurface`, iOS/macOS `CAMetalDrawable`, Windows DXGI, Linux Vulkan WSI + real double-buffered Wayland `wl_shm` & X11 multi-rect fallbacks, and Web stacked dual-canvas handoff (`SubmissionProxy` rAF), bounded 16-rect `DirtyRectSet` + surgical portal/backdrop `effect_dependency_damage`, route pre-warm + retained scroll layer reuse, 64B `GpuPrimitiveInstance` uber-shader (WGSL/MSL/GLSL ES 3.0/HLSL + Dual-Kawase `BackdropBlur`), hardware-fenced `GpuResourceRing`, 1000Hz ceiling & 9-tier non-degrading `FallbackPolicyEngine`, SoA `SceneTree` + `Component::NEEDS_LIFECYCLE`, `CanvasCaching::RetainedStatic`, Taffy-style `SplitLayoutCache`, `AppFrameArena`/`DisplayListFrameArena`, and universal scroll chaining. |
| **24B SBO O(1) Reactivity & Freeze Routing** | 24-byte SBO `SignalSlot` + O(1) intrusive edge-slab `Signal`, `Memo`, `Effect`, `Selector`, `Scope`, `Signal::with_ref`, `with_current_context`, and `batch`. Inactive pages default to `PageRetention::Freeze` — suspending effects and embedded 2D/3D engines at 0% CPU while coalescing cross-page writes for an atomic flush upon resume — paired with cross-platform `SystemEvent` hooks and full 0% CPU / 0% GPU background freeze & lossless foreground restore. |
| **Lazy Native Typography & Exact Input Caret** | Zero-sync-probe OS-native proportional, monospace, bold, and italic glyph rasterization (CoreText LRU, Android NDK FreeType, Linux persistent FreeType, Win32 GDI, Web batched glyph strip) paired with single-probe `TextShapingCache`, `GlyphAtlas`, exact glyph-advance `DrawCommand::TextCaret` alignment, and zero text overflow across `360px` to `4K`. |
| **`euv-ui` Design System (60+ Components · 17 Themes)** | Color-only compile-time Light & Dark tokens across 17 presets sharing canonical geometry + 3-layer WCAG contrast (`SurfaceRole`/`ThemeBaseline`/`mark_theme_owned`) + `RADIUS_PILL`, unified global motion tokens (`motion_duration`/`set_reduced_motion`), fluid full-width `EuvPage`, `EuvAppShell` (`SHELL_TOPBAR_CONTROL_HEIGHT = 32.0`, `auto_hide_chrome_on_scroll`/`auto_hide_chrome_signal`, reactive topbar theming), equal-inset zero-drift `EuvBottomNav` + horizontal swipe routing, live navbar FPS telemetry, symmetric close animations & zero-overshoot gesture-draggable `EuvDrawer` & `EuvSheet`, unified 1:1 width dropdowns, `doc_kit` (`EuvDocToc`/`EuvDocPager`/`EuvDocSectionNav`/`EuvDocMetaBar`), `EuvEChart` (20+ series + fullscreen + inset DataView), and full GFM `EuvMarkdown` (11-family vector Mermaid with fullscreen + 2D scroll, Math/LaTeX, GitHub Alerts, Footnotes, no-ellipsis wrapped tables) + VS Code **Eva Light Bold** / **Eva Dark Bold** `EuvCodeBlock` (`EuvCodeBlockSizeMode::AutoExpand` default, `TextSelectMode::SelectAndCopy` partial drag-select excluding gutters). |
| **BVH4/BVH8 SIMD 2D/3D Engine, 6-DOF Liquid Physics, Real Media, TUI & Dynamic OTA** | `Bvh4Node` (NEON/SSE2/WASM `simd128`) & `Bvh8Node` (AVX2) 4-ray packet traversal with checkerboard temporal RT probe reuse (60 FPS in browser WASM), object-space inverse-interpolated dynamic RT (0 per-VSync BVH rebuilds), 6-DOF `DeviceMotionSample` (`SystemEvent::DeviceMotion` + `use_device_motion()`) powering SI PBF `GyroLiquidGameScene` (`/water` with fullscreen), zero-alloc `DoubleBufferedSnapshot` + `Copy` bitset `InputState` + `u64` ns `FrameClock`, `RenderBufferPool`/`GpuCompositeTarget`, double-buffered grapheme-aware Terminal TUI / piped CLI renderer, pure-Rust LZW GIF89a & ISOBMFF MP4 / hardware zero-copy video pipelines, and FIPS SHA-256 / HMAC-SHA256 signed per-route pinned dynamic OTA backed by `euv update` (embedded Hyperlane HTTP + SSE server). |
| **Developer Tooling, Docs Showcase & Live Pages CI** | `euv fmt` layered formatter, 27-target `euv build`/`euv doctor` (incl. `vivo-watch`/`blueos`, `oppo-watch`, `garmin`, `zeppos`), embedded Hyperlane `euv update` OTA server, showcase `euv-docs` (`build_multilocale_wasm_site` with EUVZ Brotli compression + browser `popstate`/`hashchange` history sync), live SSE hot-reload dev server (`euv dev`), 9-rule `UiAnomalyAuditor` + dev-only async AI Schema v2 / `euv.ui-e2e.v1` JSON+YAML+HTML5 automation bridge (0 bytes in release), `euv-performance` (`CountingAllocator`, `--ttff`, 240/360/480Hz `p99.9` `--stress-matrix`, `--observability-json`), and `euv-dev/euv` GitHub Pages deployment (`.github/workflows/pages.yml`). |
---
## Cross-Platform Target Matrix
| Platform | Target Triple | Window & Surface API | Native Font Engine | GPU Shader Backend |
| :--------------- | :------------------------------ | :--------------------------------------------------------------------------- | :----------------------------- | :--------------------------- |
| **Web** | `wasm32-unknown-unknown` | Zero-JS HTML5 Canvas / WebGPU / WebGL2 | Web Canvas2D | WGSL / GLSL ES 3.0 |
| **Android** | `aarch64-linux-android` | NDK `ANativeWindow` + JNI | Android Skia Paint / FreeType | SPIR-V / GLES |
| **iOS / iPadOS** | `aarch64-apple-ios` | Direct `libobjc` UIKit + `CAMetalLayer` | CoreText + CoreGraphics | MSL (Metal) |
| **macOS** | `aarch64-apple-darwin` | Direct `libobjc` AppKit + `CAMetalLayer` | CoreText + CoreGraphics | MSL (Metal) |
| **Windows** | `x86_64-pc-windows-msvc` | Direct Win32 `user32` / `gdi32` | Win32 GDI (`GGO_GRAY8_BITMAP`) | HLSL (Direct3D 12) |
| **Linux** | `x86_64-unknown-linux-gnu` | Runtime `dlopen` Wayland & X11 | FreeType + Fontconfig | SPIR-V (Vulkan) / GLSL |
| **HarmonyOS** | `aarch64-unknown-linux-ohos` | Stage-Model `OH_NativeXComponent` NDK | OpenHarmony Native / FreeType | SPIR-V (Vulkan) / GLES |
| **Wearables** | Android / watchOS / OHOS / WASM | Wear OS / watchOS / HarmonyOS / Vela / vivo BlueOS / OPPO / Garmin / Zepp OS | Native OS / Compact Scaled | Metal / Vulkan / GLES / WASM |
| **Mini / Quick** | `wasm32-unknown-unknown` | Super-app Canvas2D/WebGL2 + QuickApp bridge | Host Canvas / System Font | WebGL2 / Canvas2D |
| **Terminal** | Native POSIX / Win32 | Double-buffered ANSI TUI + zero-ANSI pipe CLI | Terminal Grapheme Grid | ANSI Truecolor / Pipe |
---
## Quick Start
### 1. Add Dependencies
```shell
cargo add euv euv-ui
```
### 2. Build a Declarative Reactive Component
Follow the clean macro authoring pattern (see [AGENTS.md](./AGENTS.md)): define handlers and reactive closures as sibling `let` bindings or outer helper `fn`s, and write one style rule per line inside `style!`.
```rust
use {euv::*, euv_ui::*};
#[derive(Clone)]
pub struct CounterCard {
tokens: ThemeTokens,
}
#[component(retention = Freeze)]
impl CounterCard {
fn render(&self) -> NodeId {
let count: LocalState<i32> = state!(0);
let tokens: ThemeTokens = self.tokens;
let p: ThemePalette = tokens.get_palette();
let g: ThemeGeometry = tokens.get_geometry();
let container_style: Style = style! {
FlexDirection::Column
Overflow::Hidden
Width(Length::Percent(100.0))
Padding(Edges::all(SPACE_XL))
Gap(SPACE_MD)
Background(p.get_card())
Border::new(g.get_border_width(), p.get_border())
Radius(g.get_radius_lg())
};
let count_text = move || -> String { format!("Count: {}", count.get()) };
let on_inc = move |_: &UiEvent| {
let _: bool = count.set(count.get_untracked() + 1);
};
let text_style: Style = style! {
Width(Length::Percent(100.0))
FontSize(20.0)
FontWeight::Bold
TextColor(p.get_foreground())
};
view! {
view {
style: container_style
text {
style: text_style
{ count_text }
}
EuvButton {
label: "Increment (+1)"
tokens: tokens
on_click: on_inc
}
}
}
}
}
```
---
## Verified Performance Highlights
Reproducible benchmarks live in [`euv-performance`](./performance/README.md) (`./scripts/bench/stress-bench.sh --runs 5 --write-report`), with the canonical latest verified snapshot published at [`performance/BENCHMARK_REPORT.md`](./performance/BENCHMARK_REPORT.md):
| Benchmark | Measured Result | Notes |
| :---------------------------------------------- | :-------------------------: | :------------------------------------------------------------------------ |
| Reactive diamond signal propagation | **52.9 ns** | Glitch-free topological push-pull (`18.91M ops/s`) |
| `Selector` O(1) active row switch | **26.3 ns** | Only previous & next keys notified (`38.03M ops/s`) |
| Retained layout clean-subtree cache | **5.0 ns** | Skips unchanged subtrees in O(1) (`198.33M ops/s`) |
| 100,000-row virtualized scroll frame | **80.5 us (p99 90.2us)** | Mounts only visible viewport + overscan (`0` frames > 6.94ms) |
| Single-row partial-layout damage (1280×720) | **158.2 us (-99.2% dirty)** | Interleaved A/B `+49.6%` p50 / `+47.3%` p99, bit-exact RGBA parity |
| 3D Cinematic Max RT (`125%`, `FullPathTraced`) | **3.93 ms (254 FPS)** | Split static/dynamic BVH, 16-thread lock-free pool, parallel bloom & TAA |
| Terminal TUI 1-cell incremental diff (`120×40`) | **11.4 us (32 B / diff)** | O(1) `0.0us` / `0`-byte idle short-circuit verified across 200/200 frames |
---
## Workspace Architecture
| Crate | Path | Responsibility |
| :-------------------- | :---------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **`euv`** | [`src/`](./src/) | Umbrella crate re-exporting core runtime & procedural macros |
| **`euv-core`** | [`core/`](./core/README.md) | 24B SBO O(1) reactivity, Taffy-style `SplitLayoutCache`, SoA `SceneTree`, single-backend 64B `GpuPrimitiveInstance` uber-shader + Dual-Kawase `BackdropBlur`, `StartupTelemetry`, 6-DOF `DeviceMotionSample` / `use_device_motion()`, BVH4/BVH8 SIMD RT, GIF/MP4 codecs, dynamic OTA, and 13 native VSync backends |
| **`euv-macros`** | [`macros/`](./macros/README.md) | Single-word proc-macro suite: `view!`, `style!`, `var!`, `state!`, `#[store]`, `watch!`, `computed!`, `#[component]`, `#[event]`, `emit!`, `on!`, `#[euv]`, plus `#[derive(Props)]` |
| **`euv-ui`** | [`ui/`](./ui/README.md) | 60+ adaptive components, color-only 17 zero-CSS themes + 3-layer WCAG contrast (`SurfaceRole`/`ThemeBaseline`/`mark_theme_owned`), Freeze router, fluid `EuvPage`, `EuvAppShell` (`32px` topbar controls, `auto_hide_chrome_on_scroll`), equal-inset `EuvBottomNav`, symmetric close motion, `doc_kit`, `EuvEChart`, 11-family vector Mermaid, Eva Bold `EuvCodeBlock` (`AutoExpand`), and fullscreen 2D-scroll Markdown tables |
| **`euv-cli`** | [`cli/`](./cli/README.md) | `euv doctor`, `euv new`, `euv dev`, 27-target `euv build`, `euv docs`, embedded Hyperlane `euv update` server, parallel `euv fmt` |
| **`euv-docs`** | [`docs/`](./docs/README.md) | Showcase zero-JS static & multi-locale WASM (`build_multilocale_wasm_site`) docs generator with `doc_kit`, Eva Bold syntax highlighting, 11-family inline Mermaid SVGs & live search |
| **`euv-automation`** | [`automation/`](./automation/README.md) | Headless `UiAutomator`, `euv.ui-e2e.v1` JSON/YAML/HTML5 recorder/replayer + multi-platform adapters & dev-only async AI Schema v2 bridge (0 bytes in release) |
| **`euv-performance`** | [`performance/`](./performance/README.md) | Reproducible release suite with `CountingAllocator`, `--ttff`, 240/360/480Hz `p99.9` `--stress-matrix`, `--observability-json` emitter & canonical [`BENCHMARK_REPORT.md`](./performance/BENCHMARK_REPORT.md) |
| **`euv-example`** | [`example/`](./example/README.md) | Full 22-route modular cross-platform showcase (Bottom Nav + Swipe Routing + BVH4/BVH8 SIMD 2D/3D RT + SI PBF `GyroLiquidGameScene` `/water` + GIF/MP4 Media + 11-family Mermaid & Markdown Studio + Stress Lab) deployed to `euv-dev/euv` GitHub Pages via `.github/workflows/pages.yml` |
---
## Developer Workflow & Commands
```shell
# Verify all 7 target toolchains & connected simulators/emulators
cargo run -p euv-cli -- doctor
# Format workspace Rust code and normalize all view!/style!/var!/watch!/computed!/on!/emit!/state! macro blocks
cargo run -p euv-cli -- fmt
cargo fmt --all
# Run the full test suite and zero-warning clippy gate
cargo clippy --all-features --workspace --all-targets -- -D warnings
cargo test --all-features --workspace
# Run interactive showcase, static docs generator, or benchmark/TTFF/stress gates
cargo run -p euv-example -- --headless --software
cargo run -p euv-docs -- --generate docs/docs/en target/docs-preview
cargo run --release -p euv-performance -- --ttff
cargo run --release -p euv-performance -- --stress-matrix
# Platform build & packaging scripts (see scripts/README.md)
./scripts/build/build-web.sh
./scripts/build/build-theme-variants.sh
./scripts/build/build-android-apk.sh --install
./scripts/build/build-ios-sim.sh
```
---
## Documentation & Engineering Standards
- **[Getting Started](./docs/docs/en/guide/getting-started.md)** — Install, compose components, and target all 7 platforms.
- **[Architecture & Backends](./docs/docs/en/guide/architecture.md)** — Scene tree, Freeze routing, and render modes.
- **[Native GPU Drivers & System Fonts](./docs/docs/en/guide/native-gpu-and-fonts.md)** — Metal/Vulkan/D3D12/WebGL2 and OS glyph rasterization.
- **[Markdown Syntax & Eva Theme Showcase](./docs/docs/en/guide/markdown-syntax.md)** — Full GFM + VS Code Eva Light/Dark Bold verification page.
- **[Workspace Engineering Guidelines](./AGENTS.md)** — Mandatory macro authoring, UI gesture/layout, formatting, and Rust module standards.
- **[Project Agent Workflow Skill](./.agents/skills/euv/SKILL.md)** — Standards, verification gates, release cascade, and documentation triggers.
- **[Scripts Directory](./scripts/README.md)** — Environment setup, cross-platform builds, theme variants, and E2E gates.
## Contributing
Contributions are welcome! Please read [AGENTS.md](./AGENTS.md) and ensure `euv fmt --check`, `cargo fmt --all -- --check`, `cargo clippy --all-features --workspace --all-targets -- -D warnings`, and `cargo test --all-features --workspace` pass before opening a pull request.
## License
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
## Contact
For inquiries, please reach out to [root@devhub.vip](mailto:root@devhub.vip).