Skip to content
This repository was archived by the owner on Nov 17, 2024. It is now read-only.
/ dmat Public archive

Functional reactive component libraries based on the dominator and futures-signals rust crates. For making high performance single page web applications in rust using wasm!

License

Notifications You must be signed in to change notification settings

JedimEmO/dmat

Repository files navigation

dmat

These crates aim to provide basic functional reactive components to be used for writing single page UI applications using the dominator framework. It loosely follows the material design guidelines, but are not bound by them

The example app is hosted on github pages here: https://jedimemo.github.io/dmat/examples

Docs are hosted here: https://jedimemo.github.io/dmat/doc/dmat_components/index.html

dmat-components

For instructions on how to use DMAT, see the tutorial

This crate provides a collection of common interface components for the dominator framework. Here's a small counter example:

fn my_counter() -> Dom {
    let counter = Mutable::new(0);
    
    list!({
        .rows(vec![
            button!({
                .label("Increment")
                .click_handler(clone!(counter => move |_| {
                    let v = *counter.lock_ref();
                    *counter.lock_mut() = v + 1;
                }))
            }),
            html!("span", {
                .text_signal(counter.signal_cloned().map(|v| format!("Counter: {}", v)))
            })
        ])
    })
}

dmat-components-style

The dmat-components-style crate provides a themeable default style implementation, which can be generated compile time in your build.rs file:

use dmat_components_style::render_dmat_scss;
use dmat_components_style::theme::{Colors, DmatTheme};
use std::fs;

fn main() {
    let theme = DmatTheme {
        colors: Colors {
            ..Default::default()
        },
    };

    let scss_file_content = render_dmat_scss("example-app", theme);

    fs::write("style/dmat.generated.scss", scss_file_content.as_str()).unwrap();
}

Examples

To run the showcase application locally, go to the examples/component_showcase directory, and do the following:

Requires

  • rust 1.70.0+
  • wasm32-unknown-unknown toolchain (rustup target add wasm32-unknown-unknown)
  • node and npm installed
npm install
npm start

Tests

To run tests in chrome, you need

  • chromedriver installed

now do CHROMEDRIVER=/path/to/chromedriver cargo test --target wasm32-unknown-unknown --exclude farmers-market-backend --workspace --exclude lightweight-dmat --exclude farmers-market-web

About

Functional reactive component libraries based on the dominator and futures-signals rust crates. For making high performance single page web applications in rust using wasm!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages