#ui #dom #app #reactive #frontend

mogwai-html-macro

Declare mogwai views with RSX

4 releases

0.2.2 Dec 10, 2020
0.2.1 Nov 8, 2020
0.2.0 Nov 5, 2020
0.1.0 Aug 9, 2020

#220 in GUI

Download history 15/week @ 2021-06-28 12/week @ 2021-07-05 12/week @ 2021-07-12 34/week @ 2021-07-19 23/week @ 2021-07-26 47/week @ 2021-08-02 32/week @ 2021-08-09 23/week @ 2021-08-16 27/week @ 2021-08-23 7/week @ 2021-08-30 11/week @ 2021-09-06 11/week @ 2021-09-13 6/week @ 2021-09-20 5/week @ 2021-09-27 10/week @ 2021-10-04 17/week @ 2021-10-11

87 downloads per month
Used in 2 crates (via mogwai)

MIT license

14KB
249 lines

mogwai-html-macro

Provides procedural macros builder! and view!, which allow the use of RSX to declare mogwai views.

Example - this RSX:

    view!(
        <footer class="info">
            <p>"Double click to edit a todo"</p>
            <p>
                "Written by "
                <a href="https://github.com/schell">"Schell Scivally"</a>
            </p>
            <p>
                "Part of "
                <a href="http://todomvc.com">"TodoMVC"</a>
            </p>
        </footer>
    ).run()

will roughly generate this rust code:

    (mogwai::gizmo::dom::View::element("footer") as View<web_sys::HtmlElement>)
        .attribute("class", "info")
        .with(
            (mogwai::gizmo::dom::View::element("p") as View<web_sys::HtmlElement>)
                .with("Double click to edit a todo"),
        )
        .with(
            (mogwai::gizmo::dom::View::element("p") as View<web_sys::HtmlElement>)
                .with("Written by ")
                .with(
                    (mogwai::gizmo::dom::View::element("a")
                        as View<web_sys::HtmlElement>)
                        .attribute("href", "https://github.com/schell")
                        .with("Schell Scivally"),
                ),
        )
        .with(
            (mogwai::gizmo::dom::View::element("p") as View<web_sys::HtmlElement>)
                .with("Part of ")
                .with(
                    (mogwai::gizmo::dom::View::element("a")
                        as View<web_sys::HtmlElement>)
                        .attribute("href", "http://todomvc.com")
                        .with("TodoMVC"),
                ),
        )
        .run()

Dependencies

~340–760KB
~19K SLoC