5 releases (3 breaking)
0.4.1 | Nov 17, 2024 |
---|---|
0.4.0 | Jul 13, 2024 |
0.3.0 | Jun 29, 2024 |
0.2.0 | Jun 6, 2024 |
0.1.0 | Jun 3, 2024 |
#606 in GUI
284 downloads per month
65KB
2K
SLoC
Ravel
Ravel is an experimental approach to UI in Rust with a focus on ergonomics, efficiency, and simplicity.
Semantically, it's in the same family as Elm and React. Like Xilem and SwiftUI, it uses strongly typed view objects with monomorphization to produce efficient code. Operationally, unlike all of these, view objects are never diffed against each other. Instead, views have an associated retained state type, which they update directly.
Similar to Xilem, Ravel tries very hard to play nicely with Rust:
- Macros are entirely optional
- Easily write views over borrowed data
- Event handlers can have direct mutable access to state
Currently we only target DOM with WebAssembly. The design easily generalizes to any retained mode backend framework, and I'd like to support other platforms eventually (especially TUI and mobile).
Examples
To run the examples, you'll need to install Trunk.
cargo install --locked trunk
Tutorial
The tutorial provides a pedagogically ordered overview of basic features and application structure.
trunk serve examples/tutorial/index.html
TodoMVC
The implementation of TodoMVC is a slightly more realistic demo.
trunk serve examples/todomvc/index.html
Roadmap
Features
- Local state
- Memoization
-
async
actions - Support "message"/"reducer" architecture rather than direct model mutation
- More collection types
- DOM builder macro for convenience/performance
- Prerendering/hydration
- Integration with some web framework
- Modular CSS (export to CSS after dead code elimination with linker hacks)
Optimization
- No string serialization for defined elements/attributes
- Dynamic views without marker DOM comment nodes
- Fully static string types (no pointer storage/comparison)
Infrastructure
- Tests
- Benchmarks
- js-framework-benchmark
- Performance API integration
lib.rs
:
A web/DOM/HTML backend for ravel
.
Dependencies
~7–10MB
~189K SLoC