xilem/xilem_web
Kaur Kuut 419f8f115e
Match CI doc testing with docs.rs. (#726)
* Treat doc warnings as errors. Historically we've not done so due to
various `rustdoc` bugs giving false positives but I got it to pass
without failure right now, so perhaps better times have arrived.
* Target only `x86_64-unknown-linux-gnu` on docs.rs as we don't have any
platform specific docs.
* Properly enable example scraping for `xilem`, `xilem_core`, and
`masonry`. Fully disable it for `xilem_web` which does not have examples
as Cargo defines them.
* Pass `--all-features` at docs.rs to match our CI and reduce the
maintenance burden of manually syncing the features list.
* Enable the `doc_auto_cfg` feature for docs.rs which will show a little
tip next to feature gated functionality informing of the crate feature
flag.
* Replaced `[!TIP]` with `💡 Tip` that was inside `<div
class="rustdoc-hidden" />`. The GitHub specific tip causes a `rustdoc`
error and [didn't even render
properly](ac2ca38785/masonry/src/doc/01_creating_app.md).
* Updated `01_creating_app.md` just enough to get `rustdoc` to pass, but
that file needs a bunch of more work, as it is outdated.
2024-11-05 11:25:36 +00:00
..
src Match CI doc testing with docs.rs. (#726) 2024-11-05 11:25:36 +00:00
web_examples xilem_web: Add a few boolean attribute modifiers for `HtmlInputElement` and factor element state flags out of these modifiers into `ElementFlags` (#717) 2024-10-28 13:20:36 +00:00
.gitignore Move crates to the repository root (#302) 2024-05-11 21:59:03 +00:00
Cargo.toml Match CI doc testing with docs.rs. (#726) 2024-11-05 11:25:36 +00:00
LICENSE Move crates to the repository root (#302) 2024-05-11 21:59:03 +00:00
README.md Correctly set `rust-version` in all `Cargo.toml`s (#438) 2024-07-19 14:42:27 +00:00

README.md

Xilem Web

Experimental implementation of the Xilem architecture for the Web

Latest published version. Documentation build status. Apache 2.0 license.
Linebender Zulip chat. GitHub Actions CI status. Dependency staleness status.

This is a prototype implementation of the Xilem architecture (through Xilem Core) using DOM elements as Xilem elements (unfortunately the two concepts have the same name).

Quickstart

The easiest way to start, is to use Trunk within some of the examples (see the web_examples/ directory). Run trunk serve, then navigate the browser to the link provided (usually http://localhost:8080).

Example

A minimal example to run an application with xilem_web:

use xilem_web::{
    document_body,
    elements::html::{button, div, p},
    interfaces::{Element as _, HtmlDivElement},
    App,
};

fn app_logic(clicks: &mut u32) -> impl HtmlDivElement<u32> {
    div((
        button(format!("clicked {clicks} times")).on_click(|clicks: &mut u32, _event| *clicks += 1),
        (*clicks >= 5).then_some(p("Huzzah, clicked at least 5 times")),
    ))
}

pub fn main() {
    let clicks = 0;
    App::new(document_body(), clicks, app_logic).run();
}

Minimum supported Rust Version (MSRV)

This version of Xilem Web has been verified to compile with Rust 1.79 and later.

Future versions of Xilem Web might increase the Rust version requirement. It will not be treated as a breaking change and as such can even happen with small patch releases.

Click here if compiling fails.

As time has passed, some of Xilem Web's dependencies could have released versions with a higher Rust requirement. If you encounter a compilation issue due to a dependency and don't want to upgrade your Rust toolchain, then you could downgrade the dependency.

# Use the problematic dependency's name and version
cargo update -p package_name --precise 0.1.1

Community

Discussion of Xilem Web development happens in the Linebender Zulip, specifically in #xilem. All public content can be read without logging in.

Contributions are welcome by pull request. The Rust code of conduct applies.

License