feat(slhx): prefer render methods for views

Move view rendering onto Slot::render and KeyedSlot append/prepend/replace extension methods, leaving explicit text/html methods for non-view escape hatches.

req: codegen/002

req: view/001
This commit is contained in:
slhx agent
2026-05-26 01:31:58 +02:00
parent ba3f40a3f0
commit 5972785c3c
10 changed files with 61 additions and 40 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ mod tests {
#[test]
fn kanban_board_updates_generated_slot() {
fn render_board() -> impl IntoEffect {
ui::board::slots::board.render_view(&empty_board())
ui::board::slots::board.render(&empty_board())
}
let effect = inspect(render_board());
+3 -3
View File
@@ -131,13 +131,13 @@ async fn interact(
// req: push/001 req: push/003 req: examples/001
async fn events(Query(params): Query<BTreeMap<String, String>>) -> impl IntoResponse {
if params.contains_key("once") {
let effect = ui::board::slots::presence.render_view(&Presence { count: 1 });
let effect = ui::board::slots::presence.render(&Presence { count: 1 });
return sse(stream::iter([Ok::<_, Infallible>(effect.into_batch(ui::BUILD_FINGERPRINT))]).boxed());
}
let batches = stream::unfold(1_u64, |count| async move {
tokio::time::sleep(Duration::from_secs(4)).await;
let effect = ui::board::slots::presence.render_view(&Presence { count });
let effect = ui::board::slots::presence.render(&Presence { count });
Some((Ok::<_, Infallible>(effect.into_batch(ui::BUILD_FINGERPRINT)), count + 1))
})
.boxed();
@@ -199,7 +199,7 @@ fn registry(state: Arc<AppState>) -> HandlerRegistry {
fn board_effects(board: &BoardState, notice: &'static str) -> impl IntoEffect {
(
ui::board::slots::board.render_view(&board_view(board)),
ui::board::slots::board.render(&board_view(board)),
ui::board::slots::notice.text(notice),
ui::board::forms::create_card.clear("title"),
)