Expand description
Procedural macros for rok-ui: entry points only.
Parsing and code generation live in rok-ui-grammar, where they are unit-tested; each
macro here forwards its tokens and turns errors into compile_error!.
Macros§
- children
- A
Vec<AnyElement>from mixed element types, with control flow: - file_
route - Declare the route in a route file under
src/routes/(seerok_ui::routes!). - keyframes
- Define keyframe sequences for
Motion. - style
- One inline style object, for one-off or dynamic values:
style! { width: {px(width)}, background: primary/90 }. - styles
- Define StyleX-style style objects once, at module level.
- view
- JSX-like markup compiled to builder calls.
Attribute Macros§
- component
- Turn a function into a reusable component, React style.
- memoize
- Memoize an async function: calls with the same arguments share one in-flight future and its
result, until
rok_ui::query::memo::invalidateforgets it. Arguments are owned andDebug(they form the cache key); the output isClone + Send + Sync. - procedure
- Declare a typed async command: a
Procedurewith optional queries to invalidate after it succeeds.
Derive Macros§
- Form
Values - Implement
rok_ui::form::FormValuesand add a typed field constant per struct field:email: Stringbecomespub const EMAIL: Field<Self, String>. - Search
- Implement
rok_ui::router::Searchfor a struct of query parameters. - Store
- Generate
NameStore, a fine-grained store with one signal per field (statefeature):store.title()reads (and tracks) onlytitle,store.set_title(..)re-renders only its readers, andstore.get()/store.set(..)work on the whole value.