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
+1 -1
View File
@@ -8,7 +8,7 @@ cargo run -p slhx-v0-examples
Open <http://127.0.0.1:3000>.
The page includes working examples for generated-resource, server-first UI commands:
The page includes working examples for generated target objects and server-first UI commands:
- counter updates
- todo form submission
+2 -6
View File
@@ -49,7 +49,7 @@ mod tests {
#[test]
fn counter_updates_a_generated_slot() {
fn increment(count: u64) -> impl IntoEffect {
counter::slots::counter_value.text(count + 1)
counter::targets::counter_value.text(count + 1)
}
let effect = inspect(increment(1));
@@ -77,11 +77,7 @@ mod tests {
fn todos_append_keyed_rows_from_form_input() {
fn add_todo(input: TodoInput) -> impl IntoEffect {
let todo = Todo { id: 7, title: input.title };
todos::append(
todos::slots::todo_row,
todo.id.to_string(),
&TodoRow { title: todo.title },
)
todos::targets::todo_row.append(todo.id.to_string(), &TodoRow { title: todo.title })
}
let effect = inspect(add_todo(TodoInput { title: "Ship v0".into() }));