euv-example 0.48.0

Cross-platform native showcase application demonstrating euv fine-grained reactivity, multi-mode rendering, window controls, and euv-ui components.
Documentation
pub(crate) const MD_STUDIO_TITLE: &str = "Markdown & Code";
pub(crate) const MD_STUDIO_SUBTITLE: &str =
    "Native GFM prose, alerts, math, footnotes, no-ellipsis tables & Eva Bold code blocks.";
pub(crate) const MD_THEME_CARD_TITLE: &str = "Eva Bold Theme & Selection";
pub(crate) const MD_THEME_CARD_SUB: &str = "Toggle Eva Light/Dark Bold or mutate text selectability in-place without losing scroll position.";
pub(crate) const BTN_TOGGLE_EVA_MODE: &str = "Switch Eva Light / Dark Bold";
pub(crate) const MD_SELECTABLE_LABEL: &str = "Selectable Text";
pub(crate) const MD_CODE_CARD_TITLE: &str = "Eva Bold CodeBlock Inspector";
pub(crate) const MD_CODE_CARD_SUB: &str = "Inspect syntax highlighting, line highlights, sizing modes, fullscreen portal, and clipboard copy.";
pub(crate) const MD_SIZE_MODE_LABEL: &str = "CodeBlock Size Mode";
pub(crate) const MD_SIZE_MODE_AUTO: &str = "AutoExpand";
pub(crate) const MD_SIZE_MODE_AUTO_H: &str = "AutoExpandHeight";
pub(crate) const MD_SIZE_MODE_AUTO_W: &str = "AutoExpandWidth";
pub(crate) const MD_SIZE_MODE_FIXED: &str = "Fixed";
pub(crate) const MD_SIZE_DESC_AUTO: &str =
    "AutoExpand: full height with parent-bounded horizontal scroll.";
pub(crate) const MD_SIZE_DESC_AUTO_H: &str =
    "AutoExpandHeight: full height with constrained width and horizontal scroll.";
pub(crate) const MD_SIZE_DESC_AUTO_W: &str =
    "AutoExpandWidth: natural line width with max-height vertical scroll.";
pub(crate) const MD_SIZE_DESC_FIXED: &str =
    "Fixed: bounded width and 220px max height with 2D scrolling.";
pub(crate) const MD_TELEMETRY_CARD_TITLE: &str = "Live Document Telemetry";
pub(crate) const MD_TELEMETRY_CARD_SUB: &str =
    "Real-time copy, hyperlink, checklist, selection, and sizing state.";
pub(crate) const MD_DOC_CARD_TITLE: &str = "Native GFM, Math & Table Document";
pub(crate) const MD_DOC_CARD_SUB: &str = "Headings, inline styles, Emoji, LaTeX Math, all 5 GitHub Alerts, Definition Lists, Footnotes, no-ellipsis Fullscreen Tables, Checklists, and Disclosures.";
pub(crate) const MD_SAMPLE_RUST: &str = r#"#[component(retention = Freeze)]
impl MarkdownStudioPage {
    fn on_freeze(&self, _node: NodeId) {
        emit!(ShowcasePulseEvent { source: "markdown".into(), seq: 1 });
    }

    fn render(&self) -> NodeId {
        let count: LocalState<i32> = state!(42);
        let long_pipeline_description: &str = "Zero-WebView retained scene graph with coupled 1:1 edge-to-edge route transitions, O(1) clean-subtree caching, and 2D/3D hardware + software rendering";
        let box_style: Style = style! {
            AlignItems::Center
            Overflow::Hidden
            width: Length::Percent(100.0)
        };
        let on_copy_cb = move |copied_source: &str| {
            let _: usize = copied_source.len();
        };
        let label_fn = move || -> String {
            format!("Reactive count = {} | {}", count.get(), long_pipeline_description)
        };
        view! {
            column {
                style: box_style
                EuvCodeBlock {
                    code: source
                    tokens: tokens
                    language: "rust"
                    line_numbers: true
                    max_height: 220.0
                    selectable: true
                    on_copy: on_copy_cb
                }
                text {
                    { label_fn }
                }
            }
        }
    }
}"#;
pub(crate) const MD_SAMPLE_TS: &str = r#"// VS Code Eva Light Bold / Eva Dark Bold TypeScript sample
interface RenderPipeline {
  readonly target: "metal" | "vulkan" | "webgpu";
  maxFps: number;
  rayTracing: boolean;
}
export function createPipeline(fps: number): RenderPipeline {
  return { target: "metal", maxFps: fps, rayTracing: true };
}"#;
pub(crate) const MD_SAMPLE_JSON: &str = r##"{
  "theme": "Eva Light Bold / Eva Dark Bold",
  "background_light": "#EBEEF5",
  "background_dark": "#282C34",
  "retention": "Freeze",
  "size_mode": "AutoExpand"
}"##;
pub(crate) const MD_SAMPLE_DIFF: &str = r##"@@ -1,4 +1,5 @@
-let style = Style::empty().align(AlignItems::Center).overflow(Overflow::Hidden);
+let style = style! {
+    AlignItems::Center
+    Overflow::Hidden
+};
-impl Mountable for MyPage { fn mount(self, ctx: &mut BuildContext) -> NodeId { ... } }
+#[component(retention = Freeze)]
+impl MyPage { fn render(&self) -> NodeId { view! { ... } } }"##;
pub(crate) const MD_FULL_DOCUMENT: &str = r##"# Native Rust GFM Markdown & Typography :rocket:

Welcome to **Euv Markdown Studio** :sparkles: — featuring *zero WebView*, ***bold italic typography***, ~~DOM bloat~~, ==highlighted callouts==, exponents 2^16^, chemical H~2~O, exact `Eva Bold` syntax colors, keyboard shortcuts like <kbd>Cmd+K</kbd>, inline math $O(n \log n)$ & $\alpha + \beta = \gamma$, [Documentation Links](https://euv.ltpp.vip/docs/markdown), [Reference Links][euv-ref], autolinks <https://euv.ltpp.vip>, and footnotes[^1][^2].

First line with explicit hard break  
Second line starts directly beneath via trailing two-space break. :check:

> [!NOTE]
> :info: Every Markdown block below compiles directly to native `euv` scene nodes with bit-identical rendering across all 13 platform targets.

> [!TIP]
> :bulb: Toggle **Light / Dark** in the studio rail — the theme updates reactively in-place without tearing down pages or losing your scroll position!

> [!IMPORTANT]
> Inactive showcase routes use `PageRetention::Freeze` — reactive effects, scroll offsets, and 3D engines persist at 0% CPU until resumed.

> [!WARNING]
> :warning: Always place each style statement inside `style! { ... }` on its own line without semicolons.

> [!CAUTION]
> :fire: Legacy `Mountable` and `Style::empty()` APIs have been removed in favor of `Component`, `Lifecycle`, and `Style::default()`.

## Display Math & LaTeX Equations

$$L_o(p, \omega_o) = L_e(p, \omega_o) + \int_{\Omega} f_r(p, \omega_i, \omega_o) L_i(p, \omega_i) (\omega_i \cdot n) \, d\omega_i$$

$$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}, \quad \sum_{k=1}^{\infty} \frac{1}{k^2} = \frac{\pi^2}{6}$$

## Interactive GFM Checklist & Nested Lists

- [x] Standalone `Lifecycle` + `Component` traits and `#[component(retention = Freeze)]`
- [x] Coupled 1:1 edge-to-edge route slide transitions + sliding `EuvBottomNav` indicator
- [x] Scrollable & Fullscreen `EuvCodeBlock` with 4 sizing modes and native clipboard copy
- [ ] Tap any checkbox row to toggle completion state live

### Ordered Architecture Layers (Custom Start)

3. Fine-grained `Signal`, `LocalState`, `GlobalState`, and `EventBus`
4. Declarative `view!` & `style!` proc macros formatted by `euv fmt`
5. Persistent multi-core software + GPU direct-draw retained renderer

## Definition Lists

`PageRetention::Freeze`
: Suspends reactive effects while preserving exact per-page scroll position and scene subtree cache.

`EuvCodeBlockSizeMode`
: Controls whether inline code blocks auto-expand height and width to fit source lines or constrain scrolling inside fixed viewport dimensions.

## Cross-Platform Target Matrix (No-Ellipsis Fullscreen Table)

| Target | Graphics API | Retention Policy | Text Selection | Scrolling & Fullscreen |
| :--- | :---: | :---: | :---: | ---: |
| **iOS & macOS** | `Metal / CoreGraphics` | Freeze | Native Clipboard | 2D Scroll + Fullscreen |
| **Android** | `Vulkan / NDK` | Freeze | Native Clipboard | 2D Scroll + Fullscreen |
| **WebAssembly** | `WebGPU / Canvas2D` | Freeze | Native Clipboard | 2D Scroll + Fullscreen |
| **Windows & Linux** | `DX12 / Vulkan` | Freeze | Native Clipboard | 2D Scroll + Fullscreen |
| **HarmonyOS** | `OpenGL ES 3.0 / NAPI` | Freeze | Native Clipboard | 2D Scroll + Fullscreen |

```rust
let global: Signal<ShowcaseGlobalBanner> = state!(global ShowcaseGlobalBanner = ShowcaseGlobalBanner::default());
let _sub: Effect = on!(ShowcasePulseEvent => move |ev: &ShowcasePulseEvent| {
    let _: bool = global.update(|g: &mut ShowcaseGlobalBanner| g.set_pulses(g.get_pulses() + ev.get_seq()));
});
```

![Euv Unified Retained Scene Pipeline](https://euv.ltpp.vip/assets/pipeline-2026.svg)

<details>
<summary>Expand Lifecycle & Cross-Page Sync Details</summary>

When leaving a route, `Scope::freeze()` suspends effects while marking dirty cross-page writes and preserving exact scroll offsets.

- Zero teardown on Light/Dark or 17-scheme switches
- Atomic single-flush resume when returning to a frozen page

</details>

---

> Outer quote highlighting zero-WebView performance.
> > Nested quote: *"Fast, lossless, and idiomatic — native Rust UI from 360px touchscreens to 4K displays."*

[euv-ref]: https://euv.ltpp.vip
[^1]: Exact VS Code `Eva Light Bold` (`#EBEEF5`) and `Eva Dark Bold` (`#282C34`) syntax color tokens.
[^2]: Zero JavaScript or WebView dependencies — every paragraph, table, formula, and code block draws directly onto `euv`'s retained scene graph.
"##;
pub(crate) const MD_THEME_DESC_LIGHT: &str = "VS Code Eva Light Bold: bg #EBEEF5 | kw #7C4DFF | ctrl #C838C6 | str #53A053 | fn #437AED | ty #00BEC4";
pub(crate) const MD_THEME_DESC_DARK: &str = "VS Code Eva Dark Bold: bg #282C34 | kw #A78CFA | ctrl #CF68E1 | str #98C379 | fn #6495EE | ty #56B7C3";
pub(crate) const MD_TAB_RUST: &str = "Rust";
pub(crate) const MD_TAB_TS: &str = "TypeScript";
pub(crate) const MD_TAB_JSON: &str = "JSON";
pub(crate) const MD_TAB_DIFF: &str = "Diff";
pub(crate) const MD_LANG_RUST: &str = "rust";
pub(crate) const MD_LANG_TS: &str = "ts";
pub(crate) const MD_LANG_JSON: &str = "json";
pub(crate) const MD_LANG_DIFF: &str = "diff";
pub(crate) const MD_FILE_RUST: &str = "src/pages/markdown.rs";
pub(crate) const MD_FILE_TS: &str = "src/pipeline.ts";
pub(crate) const MD_FILE_JSON: &str = "eva-theme.json";
pub(crate) const MD_FILE_DIFF: &str = "refactor.patch";
pub(crate) const MD_CODE_MAX_HEIGHT: f32 = 220.0;