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
+6 -6
View File
@@ -90,9 +90,9 @@ FormSurface {
slhx reads this from hemplate Surface facts and generates scoped typed resources:
```rust
use ui::board::{forms, slots};
use ui::board::{forms, targets};
ui::board::replace(slots::card, card.id, &CardView::from(card));
targets::card.replace(card.id, &CardView::from(card));
forms::create_card.clear("title");
ui::render(&BoardView::from(board));
```
@@ -135,7 +135,7 @@ pub fn create_card(
app.board.update(|board| board.insert_card(form.column, card.clone()));
(
ui::board::append(slots::card, card.id, &CardView::from(card)),
targets::card.append(card.id, &CardView::from(card)),
forms::create_card.clear("title"),
// slhx-sync: queue atomic board state diff for sync
SyncEffect::send_patch(atoms::board, Patch::insert_card(form.column, card)),
@@ -233,14 +233,14 @@ pub fn apply_board_patch(
Effect::broadcast(
Channel::Board(app.board.id()),
Effect::batch(changed_cards.into_iter().map(|c|
ui::board::replace(slots::card, c.id, &CardView::from(c))
targets::card.replace(c.id, &CardView::from(c))
)),
),
)),
PatchResult::Conflict { canonical_board } => Effect::batch((
Effect::set(atoms::BOARD, canonical_board.clone()),
ui::put(slots::board, &BoardView::from(canonical_board)),
targets::board.put(&BoardView::from(canonical_board)),
)),
}
}
@@ -255,7 +255,7 @@ Server-authoritative on conflict. No Redux sagas. No React Query cache fades.
```rust
#[slhx_sync::presence]
pub fn user_joined(user: UserPresence) -> impl IntoEffect {
ui::board::append(slots::presence_user, user.id, &PresenceBadge::from(user))
targets::presence_user.append(user.id, &PresenceBadge::from(user))
}
```