xilem/xilem_web
Daniel McNab d4d48d80a5
Make the environment and element available in `View::message` (#1220)
See [#xilem > Environment
System](https://xi.zulipchat.com/#narrow/channel/354396-xilem/topic/Environment.20System/with/529496085)
and [#xilem > Giving `message` access to the
Element](https://xi.zulipchat.com/#narrow/channel/354396-xilem/topic/Giving.20.60message.60.20access.20to.20the.20Element/with/529436165)
for motivation.

This is a massive refactor, to significant improve the capabilities of
Xilem.
The main difficulty so far has been sequences, as we need to skip the
right amount of items.
This will either require storing large amounts of item, or restoring the
`count` method on sequences.

Obviously Xilem and Xilem Web are not yet done in this PR.

---------

Co-authored-by: Philipp Mildenberger <philipp@mildenberger.me>
2025-07-29 11:05:10 +00:00
..
src Make the environment and element available in `View::message` (#1220) 2025-07-29 11:05:10 +00:00
web_examples Suppress doc in web examples (#1243) 2025-07-25 17:46:10 +00:00
.gitignore Move crates to the repository root (#302) 2024-05-11 21:59:03 +00:00
Cargo.toml Remove the package `homepage` (#991) 2025-05-26 14:05:14 +00:00
LICENSE Remove appendix from `LICENSE` files. (#970) 2025-05-09 18:53:13 +00:00
README.md Remove detail sections of MSRV notices. (#1180) 2025-07-18 16:52:00 +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> + use<> {
    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.88 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.

Community

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

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

License

Licensed under the Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)