euv-macros 0.47.1

Zero-overhead procedural macros for the cross-platform euv UI framework, providing view!, style!, var!, watch!, computed!, state!, #[store], #[component], #[event], emit!, on!, and #[euv].
Documentation

Euv-macros

Zero-Overhead Declarative UI, Style, Lifecycle & Reactive Proc Macros

Crates.io Version Crates.io Downloads Docs.rs CI Status Rust 2024 License: MIT

Workspace Overview · API Docs · Agent Engineering Rules


Overview

Zero-overhead procedural macros for euv, compiling declarative UI (view!), newline-separated styles (style!), reactive bindings, component lifecycles, global/local state, and typed cross-component events directly into retained scene operations with full rust-analyzer Go-to-Definition support and zero macro-emitted use statements.

Responsibilities & Module Layout

  • view! { ... } — Zero-context declarative scene construction requiring strict style: { ... } / style: expr encapsulation and named component props (Component { prop: value }) with IDE Go-to-Definition on exported schema structs (euv::ViewElement, euv::ColumnElement, euv::TextElement, etc.), properties, component structs, and prop fields
  • #[derive(Props)] — Implements ComponentProps and span-preserving fluent named-prop setters (with #[prop(custom)] and #[prop(default = expr)])
  • style! { ... } — Compile-time newline-separated Style builder (one rule per line, no ;) with IDE Go-to-Definition via euv::StyleProps
  • #[component(retention = Freeze)] — Splits impl MyComp into Lifecycle + Component (auto-emitting const NEEDS_LIFECYCLE: bool so stateless components skip Rc and NodeExtras allocations on mount) with configurable retention (Freeze, Destroy, Alive)
  • #[event] / emit! / on! — Typed cross-component EventBus declarations, dispatching, and scope-owned subscriptions
  • #[store] / state! — Unified scoped local state (state!(init)) and typed app-wide global state (state!(global Type) / state!(global Type = init))
  • watch! / computed! / var! / #[euv] — Concise reactive effects, memos, typed design token constants, and unified cross-platform entry points (incl. euv_web_start, euv_miniapp_entry, euv_blueos_entry, euv_android_entry, euv_ios_entry, euv_harmony_entry, euv_wearable_entry)

Installation & Usage

cargo add euv-macros

Verification

cargo run -p euv-cli -- fmt --check
cargo clippy -p euv-macros --all-features --all-targets -- -D warnings
cargo test -p euv-macros --all-features

Documentation & Governance

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For inquiries, please contact the author at root@devhub.vip.