Sauron is an html web framework for building web-apps. It is heavily inspired by elm.
Sauron doesn't use macro to provide the view, instead it is using rust syntax to construct the html view.
```rust use sauron::html::attributes::; use sauron::html::events::; use sauron::html::; use sauron::Component; use sauron::Node; use sauron::Program; use wasm_bindgen::prelude::;
pub enum Msg { Click, }
pub struct App { click_count: u32, }
impl App { pub fn new() -> Self { App { click_count: 0 } } }
impl Component
fn view(&self) -> Node<Msg> {
div(
[class("some-class"), id("some-id"), attr("data-id", 1)],
[
input(
[
class("client"),
r#type("button"),
value("Click me!"),
onclick(|_| {
sauron::log("Button is clicked");
Msg::Click
}),
],
[],
),
text(format!("Clicked: {}", self.click_count)),
],
)
}
fn update(&mut self, msg: Msg) {
sauron::log!("App is updating from msg: {:?}", msg);
match msg {
Msg::Click => self.click_count += 1,
}
}
}
pub fn main() { Program::newappendto_mount(App::new(), &sauron::body()); } ``` Look at the examples code and the build script for the details.
This project is based on the existing projects: - percy - yew - willow
License: MIT