Implement closed typed effect path

This commit is contained in:
tmk241
2026-09-01 00:58:29 +02:00
parent 353174604e
commit 31a0f02211
58 changed files with 4247 additions and 5933 deletions
+13
View File
@@ -0,0 +1,13 @@
[package]
name = "hemx-server-wasm-test"
version = "0.1.0"
edition.workspace = true
license.workspace = true
publish = false
[dependencies]
hemplate = { version = "0.2.0", default-features = false, features = ["derive"] }
hemx = { path = "../../hemx" }
[build-dependencies]
hemx-build = { path = "../../hemx-build" }
+6
View File
@@ -0,0 +1,6 @@
fn main() {
hemx_build::app()
.template_dir("templates")
.run()
.expect("compile server-side Wasm surfaces");
}
+23
View File
@@ -0,0 +1,23 @@
use hemplate::Hemplate;
use hemx::Effect;
#[hemx::surface]
pub mod ui {}
#[derive(Hemplate)]
pub struct Room {
pub count: i32,
}
#[derive(Hemplate)]
pub struct CounterView {
pub count: i32,
}
pub fn render_page(count: i32) -> hemx::Html {
ui::room::page(&Room { count })
}
pub fn update_counter(count: i32) -> Effect {
ui::room::put(ui::room::advanced::slots::counter, &CounterView { count })
}
@@ -0,0 +1 @@
<strong>Count: {+ self.count +}</strong>
+5
View File
@@ -0,0 +1,5 @@
<main data-hemx-root="room">
<section data-hemx-slot="counter">
<strong>Count: {+ self.count +}</strong>
</section>
</main>