Expand description
A library for building reactive web apps
Overview
- Pure rust API
- Fine grained reactivity using
futures_signals
- Routing
- Tauri support
- Server Side Rendering with hydration
Quick Start
First, install the wasm32
target:
rustup target add wasm32-unknown-unknown
Then install trunk:
cargo install trunk --locked
To run the example counter:
cd examples/counter
trunk serve --open
Feature Flags
weak-refs
Use Javascript weak references to manage event callbacks. This improves
performance but must be enabled in wasm-bindgen
. See the trunk
documentation for details on how to do this using data-weak-refs
.
See caniuse for current browser support.
declarative-shadow-dom
Print Declarative Shadow DOM when server side rendering. Hydration will correctly deal with shadow DOM regardless of this flag. See caniuse for browser support. Polyfills are available.
css-transpile
Enable CSS transpilation for css!
. This can significantly increase build
time, so is presented as an opt-in feature.
Learning
There’s extensive documentation on each module in this crate, along with many other examples in the examples folder.
Reactivity is provided by futures_signals
. It would be helpful to
familiarize yourself using futures_signals::tutorial
.
Modules
- Animation time signals.
- Traits for defining attribute types.
- Document utilities.
- An abstraction for the underlying DOM.
- HTML element types.
- Hydrate the document with event handlers.
- Generic DOM types.
- Commonly used imports, all in one place.
- Tools for working with Javascript properties.
- URL based routing.
- Local and session storage.
- Microtask and render queue tools.
- Utilities for tacking time.
- Abstract over the signal/value-ness of types.
- Window utilities.
Macros
- Clone all the identifiers supplied as arguments.
- Define
&str
constants for each class in a CSS file. - Define a custom html element.
- Add
child
andtext
methods to an html element. - Implement
ShadowRootParent
for the HTML element
Functions
- Log any
panic!
s to the browser console. This should ideally be the very first thing that is called, but can be omitted safely. Seeconsole_error_panic_hook
docs for more information. - Shorthand for
DefaultDom::mount
Attribute Macros
Derive Macros
- Derive
AriaElement
- Derive the traits needed for a blanket implmenetation of
ChildElement
. - Derive
Element
. - Derive
ElementEvents
- Derive
HtmlElement
- Derive
HtmlElementEvents
- Derive
Value