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
+9 -9
View File
@@ -10,7 +10,7 @@ use slhx_axum::{
InteractionRequest, PageRequest,
};
use slhx_techdemo::ui;
use slhx_techdemo::ui::control_center::{classes, forms, handles, slots};
use slhx_techdemo::ui::control_center::{classes, forms, handles, slots, targets};
use slhx_techdemo::ui::issue_card::handles as card_handles;
use slhx_techdemo::ui::issue_lane::handles as lane_handles;
use std::collections::{BTreeMap, VecDeque};
@@ -269,13 +269,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::live_feed, &LiveFeed { tick: 1 });
let effect = targets::live_feed.put(&LiveFeed { tick: 1 });
return sse(stream::iter([Ok::<_, Infallible>(effect.into_batch(ui::BUILD_FINGERPRINT))]).boxed());
}
let batches = stream::unfold(1_u64, |tick| async move {
tokio::time::sleep(Duration::from_secs(4)).await;
let effect = ui::put(slots::live_feed, &LiveFeed { tick });
let effect = targets::live_feed.put(&LiveFeed { tick });
Some((Ok::<_, Infallible>(effect.into_batch(ui::BUILD_FINGERPRINT)), tick + 1))
})
.boxed();
@@ -384,10 +384,10 @@ fn registry(shared: Arc<Shared>) -> impl DispatchRegistry {
let mut demo = shared.demo.lock().unwrap();
demo.log("Simulated push event produced the same generated update shape");
(
ui::put(slots::live_feed, &LiveFeed {
targets::live_feed.put(&LiveFeed {
tick: demo.activity.len() as u64,
}),
ui::put(slots::activity, &activity_view(&demo)),
targets::activity.put(&activity_view(&demo)),
slots::notice.text("Push simulated · no client app code"),
slhx::event("slhx:island-orbit", island_snapshot(&demo)),
)
@@ -414,10 +414,10 @@ fn update_work(demo: &mut DemoState, id: Option<u64>, update: impl FnOnce(&mut W
fn demo_effects(demo: &DemoState, notice: &'static str) -> impl IntoEffect {
(
ui::put(slots::hero_metrics, &hero_view(demo)),
ui::put(slots::board, &board_view(demo)),
ui::put(slots::activity, &activity_view(demo)),
ui::put(slots::inspector, &inspector_view(demo)),
targets::hero_metrics.put(&hero_view(demo)),
targets::board.put(&board_view(demo)),
targets::activity.put(&activity_view(demo)),
targets::inspector.put(&inspector_view(demo)),
slots::notice.text(notice),
forms::launch_work.clear("title"),
slhx::event("slhx:island-orbit", island_snapshot(demo)),