Respo in Rust
tiny toy virtual DOM based framework for Rust.
Status: experimenting, unhappy without HMR.
Respo was initially designed to work in a dynamic language with persistent data and HMR(hot code replacement), which is dramatically different from Rust. So this is more like an experiment.
- Docs https://docs.rs/respo
- Live Demo https://r.tiye.me/Respo/respo.rs/
Usage
Here is some preview of DOM syntax:
Ok
CSS-in-Rust:
static_styles!;
Builtin styles, demonstrated:
| function | usages |
|---|---|
ui_global |
global styles |
ui_fullscreen |
fullscreen styles |
ui_button |
button styles |
ui_input |
input styles |
ui_textarea |
textarea styles |
ui_link |
link styles |
ui_flex |
flex:1 styles |
ui_expand |
flex:1 styles with scrolls |
ui_center |
flexbox center styles |
ui_row |
flexbox row styles |
ui_column |
flexbox column styles |
ui_row_center |
flexbox row center styles |
ui_column_center |
flexbox column center styles |
ui_row_around |
flexbox row around styles |
ui_column_around |
flexbox column around styles |
ui_row_evenly |
flexbox row evenly styles |
ui_column_evenly |
flexbox column evenly styles |
ui_row_parted |
flexbox row between styles |
ui_column_parted |
flexbox column between styles |
ui_row_middle |
flexbox row between styles |
ui_column_middle |
flexbox column between styles |
ui_font_code |
code font family |
ui_font_normal |
normal font family(Hind) |
ui_font_fancy |
fancy font family(Josefin Sans) |
There are several dialog components in the demo. Syntax is not nice enough, so I'm not advertising it. But they work relatively good.
For more components, read code in src/app/, they are just variants like RespoNode::Component(..). It may be sugared in the future, not determined yet.
Store abstraction
Declaring a store:
Declaring an app:
Mounting app:
let app = App ;
app.render_loop.expect;
License
Apache License 2.0 .