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:
@@ -3,7 +3,7 @@ pub mod ui {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::ui::control_center::{forms, handles, slots};
|
||||
use super::ui::control_center::{forms, handles, slots, targets};
|
||||
use super::ui::issue_card::handles as card_handles;
|
||||
use super::ui::issue_lane::events as lane_events;
|
||||
use hemplate::Hemplate;
|
||||
@@ -30,7 +30,7 @@ mod tests {
|
||||
fn techdemo_uses_generated_slots_for_multi_target_updates() {
|
||||
fn update() -> impl IntoEffect {
|
||||
(
|
||||
super::ui::put(slots::hero_metrics, &FastMetric { label: "fast" }),
|
||||
targets::hero_metrics.put(&FastMetric { label: "fast" }),
|
||||
slots::notice.text("typed"),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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)),
|
||||
|
||||
Reference in New Issue
Block a user