feat(build): generate slot target objects

Add generated targets::<slot> wrapper objects so partial swaps read as target.put/append/replace while preserving existing lower-aware commands and IntoEffect wiring.

req: dx/006

req: codegen/001

req: codegen/002

req: component/003
This commit is contained in:
slhx agent
2026-06-02 07:21:23 +02:00
parent 20d1159e39
commit a138f92b33
11 changed files with 84 additions and 37 deletions
+4 -4
View File
@@ -10,7 +10,7 @@ use slhx_axum::{
InteractionRequest, PageRequest,
};
use slhx_kanban_example::ui::{self, board as board_ui};
use slhx_kanban_example::ui::board::{forms, handles, slots};
use slhx_kanban_example::ui::board::{forms, handles, slots, targets};
use slhx_kanban_example::ui::board_card::handles as card_handles;
use std::collections::BTreeMap;
use std::convert::Infallible;
@@ -138,13 +138,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::put(slots::presence, &Presence { count: 1 });
let effect = targets::presence.put(&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::put(slots::presence, &Presence { count });
let effect = targets::presence.put(&Presence { count });
Some((Ok::<_, Infallible>(effect.into_batch(ui::BUILD_FINGERPRINT)), count + 1))
})
.boxed();
@@ -206,7 +206,7 @@ fn registry(state: Arc<AppState>) -> impl DispatchRegistry {
fn board_effects(board: &BoardState, notice: &'static str) -> impl IntoEffect {
(
ui::put(slots::board, &board_view(board)),
targets::board.put(&board_view(board)),
slots::notice.text(notice),
forms::create_card.clear("title"),
)