feat(core): format handles for templates

Implement Display for generated Handle<T> values and migrate example view data to carry handles directly instead of raw handle id numbers for dynamic handle attributes.

req: public_api/001

req: public_api/002
This commit is contained in:
slhx agent
2026-05-26 00:30:23 +02:00
parent bc8534a768
commit a421865852
4 changed files with 30 additions and 18 deletions
+9 -9
View File
@@ -4,7 +4,7 @@ use axum::routing::get;
use axum::Router;
use futures_util::{stream, StreamExt};
use hemplate::Hemplate;
use slhx::{CssClass, CssClasses, IntoEffect, SafeHtml};
use slhx::{CssClass, CssClasses, Handle, IntoEffect, SafeHtml};
use slhx_axum::{
runtime_js, sse, DispatchRejection, EffectResponse, HandlerRegistry, InteractionForm,
PageRequest,
@@ -102,7 +102,7 @@ struct Shared {
struct IssueLane {
class: CssClass,
lane_id: &'static str,
move_handle: u32,
move_handle: Handle<()>,
title: &'static str,
description: &'static str,
cards: Vec<IssueCard>,
@@ -116,9 +116,9 @@ struct IssueCard {
title: String,
stage: &'static str,
impact_style: String,
spotlight_handle: u32,
advance_handle: u32,
delete_handle: u32,
spotlight_handle: Handle<()>,
advance_handle: Handle<()>,
delete_handle: Handle<()>,
}
#[derive(Hemplate)]
@@ -454,7 +454,7 @@ fn render_board(demo: &DemoState) -> SafeHtml {
.map(|(idx, (lane_id, title, description))| IssueLane {
class: ui::control_center::classes::lane,
lane_id,
move_handle: ui::control_center::handles::move_to_lane.id().id,
move_handle: ui::control_center::handles::move_to_lane,
title,
description,
cards: demo
@@ -483,9 +483,9 @@ fn issue_card(item: &WorkItem, selected: bool) -> IssueCard {
title: item.title.clone(),
stage: item.stage.label(),
impact_style: format!("width:{}%", item.impact as usize * 11),
spotlight_handle: ui::control_center::handles::spotlight_work.id().id,
advance_handle: ui::control_center::handles::advance_work.id().id,
delete_handle: ui::control_center::handles::delete_work.id().id,
spotlight_handle: ui::control_center::handles::spotlight_work,
advance_handle: ui::control_center::handles::advance_work,
delete_handle: ui::control_center::handles::delete_work,
}
}