feat(axum): add interaction registry alias

Add an interactions()/on() registration path and move canonical examples off explicit register_handle naming while keeping low-level registry types available underneath.

req: axum_integration/003

req: ceremony/001

req: dx/003

req: examples/003
This commit is contained in:
slhx agent
2026-06-02 00:24:32 +02:00
parent f388fa7d91
commit df4b4cc649
7 changed files with 41 additions and 25 deletions
+6 -6
View File
@@ -6,7 +6,7 @@ use futures_util::{stream, StreamExt};
use hemplate::Hemplate;
use slhx::{IntoEffect, RenderSlotExt, SafeHtml};
use slhx_axum::{
handlers, runtime_js, sse, DispatchRegistry, DispatchRejection, EffectResponse,
interactions, runtime_js, sse, DispatchRegistry, DispatchRejection, EffectResponse,
InteractionRequest, PageRequest,
};
use slhx_kanban_example::ui::{self, board as board_ui};
@@ -152,8 +152,8 @@ async fn events(Query(params): Query<BTreeMap<String, String>>) -> impl IntoResp
}
fn registry(state: Arc<AppState>) -> impl DispatchRegistry {
handlers(ui::BUILD_FINGERPRINT)
.register_handle(handles::create_card, {
interactions(ui::BUILD_FINGERPRINT)
.on(handles::create_card, {
let state = state.clone();
move |form| {
// req: examples/001 req: form/002
@@ -168,7 +168,7 @@ fn registry(state: Arc<AppState>) -> impl DispatchRegistry {
board_effects(&board, "Card added")
}
})
.register_handle(card_handles::move_left, {
.on(card_handles::move_left, {
let state = state.clone();
move |form| {
// req: examples/001 req: list/003
@@ -179,7 +179,7 @@ fn registry(state: Arc<AppState>) -> impl DispatchRegistry {
board_effects(&board, if moved { "Card moved left" } else { "Card not found" })
}
})
.register_handle(card_handles::move_right, {
.on(card_handles::move_right, {
let state = state.clone();
move |form| {
// req: examples/001 req: list/003
@@ -190,7 +190,7 @@ fn registry(state: Arc<AppState>) -> impl DispatchRegistry {
board_effects(&board, if moved { "Card moved right" } else { "Card not found" })
}
})
.register_handle(card_handles::delete_card, {
.on(card_handles::delete_card, {
let state = state.clone();
move |form| {
// req: examples/001 req: list/003