refactor(examples): hide workout dispatch details

Keep the workout binary to page/runtime/interaction plumbing by moving generated handle dispatch behind an app-owned interactions function, while preserving typed form adapters and full verification.

req: codegen/002

req: examples/001
This commit is contained in:
slhx agent
2026-06-11 22:19:17 +02:00
parent 189bdf5eea
commit 4254327cc7
2 changed files with 5 additions and 8 deletions
+4 -7
View File
@@ -1,6 +1,6 @@
use hemplate::Hemplate; use hemplate::Hemplate;
use hemx::{Html, IntoEffect}; use hemx::{Html, IntoEffect};
use hemx_axum::{state_interactions, Form, HandlerRegistry}; use hemx_axum::Form;
use hemx_host::{ use hemx_host::{
browser_pwa_host_profile, native_shell_host_profile, Capability, CapabilityManifest, browser_pwa_host_profile, native_shell_host_profile, Capability, CapabilityManifest,
CapabilityShape, CapabilityUse, HapticPattern, HostCall, HostCallId, HostEvent, CapabilityShape, CapabilityUse, HapticPattern, HostCall, HostCallId, HostEvent,
@@ -363,9 +363,9 @@ pub struct RecordNoteInput {
text: String, text: String,
} }
pub fn registry(state: AppState) -> HandlerRegistry { pub fn interactions(state: AppState) -> impl hemx_axum::DispatchRegistry {
// req: codegen/002 req: examples/001 // req: codegen/002 req: examples/001
state_interactions(ui::BUILD_FINGERPRINT, state) hemx_axum::state_interactions(ui::BUILD_FINGERPRINT, state)
.on_state(ui::workout::complete_set, complete_set) .on_state(ui::workout::complete_set, complete_set)
.on(ui::workout::change_weight, change_weight_form) .on(ui::workout::change_weight, change_weight_form)
.on_state(ui::workout::skip_exercise, skip_exercise) .on_state(ui::workout::skip_exercise, skip_exercise)
@@ -374,10 +374,7 @@ pub fn registry(state: AppState) -> HandlerRegistry {
.on_state(ui::workout::export_log, export_log) .on_state(ui::workout::export_log, export_log)
.on_state(ui::workout::record_share_result, record_share_result) .on_state(ui::workout::record_share_result, record_share_result)
.on_state(ui::workout::request_native_haptic, request_native_haptic) .on_state(ui::workout::request_native_haptic, request_native_haptic)
.on_state( .on_state(ui::workout::record_native_haptic_ack, record_native_haptic_ack)
ui::workout::record_native_haptic_ack,
record_native_haptic_ack,
)
.into_registry() .into_registry()
} }
+1 -1
View File
@@ -39,7 +39,7 @@ async fn interact(
State(state): State<AppState>, State(state): State<AppState>,
request: InteractionRequest, request: InteractionRequest,
) -> Result<EffectResponse, impl IntoResponse> { ) -> Result<EffectResponse, impl IntoResponse> {
request.dispatch_async(workout_app::registry(state)).await request.dispatch(workout_app::interactions(state))
} }
async fn workout_css() -> impl IntoResponse { async fn workout_css() -> impl IntoResponse {