Skip to main content

euv_example/pages/
fn.rs

1use super::*;
2
3style! {
4    c_full_col {
5        FlexDirection::Column
6        width: Length::Percent(100.0)
7        height: Length::Percent(100.0)
8    }
9    c_action_row {
10        FlexDirection::Row
11        FlexWrap::Wrap
12        AlignItems::Center
13        width: Length::Percent(100.0)
14        gap: SPACE_SM
15    }
16    c_scheme_grid {
17        columns: 4
18        width: Length::Percent(100.0)
19        gap: SPACE_SM
20    }
21}
22
23/// Registers all 15 showcase routes lazily onto `router` using typed `#[component(retention = Freeze)]` pages.
24///
25/// # Arguments
26///
27/// - `&ShowcaseState` - Shared reactive showcase state.
28fn ensure_showcase_routes_registered(state: &ShowcaseState) {
29    if state.get_router_ready().replace(true) {
30        return;
31    }
32    let all_routes: [(&'static str, &'static str); 15] = [
33        (ROUTE_OVERVIEW, NAV_LABEL_OVERVIEW),
34        (ROUTE_MARKDOWN, NAV_LABEL_MARKDOWN),
35        (ROUTE_REACTIVE, NAV_LABEL_REACTIVE),
36        (ROUTE_RENDER, NAV_LABEL_RENDER),
37        (ROUTE_WINDOW, NAV_LABEL_WINDOW),
38        (ROUTE_FORMS, NAV_LABEL_FORMS),
39        (ROUTE_THEMES, NAV_LABEL_THEMES),
40        (ROUTE_DATA, NAV_LABEL_DATA),
41        (ROUTE_GAME, NAV_LABEL_GAME),
42        (ROUTE_GAME_3D, NAV_LABEL_GAME_3D),
43        (ROUTE_MEDIA, NAV_LABEL_MEDIA),
44        (ROUTE_LAB, NAV_LABEL_LAB),
45        (ROUTE_OVERLAYS, NAV_LABEL_OVERLAYS),
46        (ROUTE_DYNAMIC, NAV_LABEL_DYNAMIC),
47        (ROUTE_STRESS, NAV_LABEL_STRESS),
48    ];
49    let mut router: EuvRouter = state.get_router().clone();
50    for (path, label) in all_routes.into_iter() {
51        let st: ShowcaseState = state.clone();
52        router = router.route_component(path, label, move |_: &EuvRouteMatch| {
53            let tok: ThemeTokens = untracked(|| st.get_theme().get_tokens().get());
54            ShowcasePage::new(path, st.clone(), tok)
55        });
56    }
57    let _: EuvRouter = router;
58}
59
60/// Mounts the fully reactive showcase application shell with lazy `PageRetention::Freeze` routing and cross-component events.
61///
62/// # Arguments
63///
64/// - `&ShowcaseState` - Reactive showcase state.
65///
66/// # Returns
67///
68/// - `NodeId` - Mounted reactive root container handle.
69pub fn mount_showcase_root(state: &ShowcaseState) -> NodeId {
70    ensure_showcase_routes_registered(state);
71    let global_banner: Signal<ShowcaseGlobalBanner> =
72        global_state!(ShowcaseGlobalBanner = ShowcaseGlobalBanner::default());
73    let state_c: ShowcaseState = state.clone();
74    let (ev_scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
75        on_event!(ShowcasePulseEvent => move |ev: &ShowcasePulseEvent| {
76            let src: String = ev.get_source().clone();
77            let _: bool = global_banner.update(|b: &mut ShowcaseGlobalBanner| {
78                let next_pulses: u32 = b.get_pulses().saturating_add(1);
79                b.set_pulses(next_pulses);
80                b.set_last_source(src);
81            });
82        })
83    });
84    let root_node: NodeId = view! {
85        column {
86            width: Length::Percent(100.0)
87            height: Length::Percent(100.0)
88            bind_children: move || {
89                let tokens: ThemeTokens = state_c.get_theme().get_tokens().get();
90                let hub: DynamicUpdateHub = state_c.get_dynamic_hub().clone();
91                let _: u64 = hub.routes_signal().get();
92                let cmd_open: Signal<bool> = state_c.get_cmd_palette_open();
93                let cmd_query: Signal<String> = state_c.get_cmd_palette_query();
94                let cmd_items: Vec<String> = vec![
95                    CMD_ITEM_OVERVIEW.to_string(),
96                    CMD_ITEM_MARKDOWN.to_string(),
97                    CMD_ITEM_LAB.to_string(),
98                    CMD_ITEM_GAME_3D.to_string(),
99                    CMD_ITEM_MEDIA.to_string(),
100                    CMD_ITEM_DYNAMIC.to_string(),
101                    CMD_ITEM_STRESS.to_string(),
102                    CMD_ITEM_WINDOW.to_string(),
103                    CMD_ITEM_THEMES.to_string(),
104                    CMD_ITEM_TOGGLE_MODE.to_string(),
105                ];
106                let cmd_sel: Signal<Option<usize>> = Signal::new(None);
107                let cmd_route: Signal<String> = state_c.get_route();
108                let cmd_state: ShowcaseState = state_c.clone();
109                let cmd_list: NodeId = view! {
110                    EuvCommand {
111                        items: cmd_items
112                        selected: cmd_sel
113                        tokens: tokens
114                        query: cmd_query
115                        placeholder: CMD_PLACEHOLDER
116                    }
117                };
118                let (cmd_scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
119                    Effect::new(move || {
120                        if let Some(idx) = cmd_sel.get() {
121                            match idx {
122                                0 => {
123                                    let _: bool = cmd_route.set_if_changed(ROUTE_OVERVIEW.to_string());
124                                }
125                                1 => {
126                                    let _: bool = cmd_route.set_if_changed(ROUTE_MARKDOWN.to_string());
127                                }
128                                2 => {
129                                    let _: bool = cmd_route.set_if_changed(ROUTE_LAB.to_string());
130                                }
131                                3 => {
132                                    let _: bool = cmd_route.set_if_changed(ROUTE_GAME_3D.to_string());
133                                }
134                                4 => {
135                                    let _: bool = cmd_route.set_if_changed(ROUTE_MEDIA.to_string());
136                                }
137                                5 => {
138                                    let _: bool = cmd_route.set_if_changed(ROUTE_DYNAMIC.to_string());
139                                }
140                                6 => {
141                                    let _: bool = cmd_route.set_if_changed(ROUTE_STRESS.to_string());
142                                }
143                                7 => {
144                                    let _: bool = cmd_route.set_if_changed(ROUTE_WINDOW.to_string());
145                                }
146                                8 => {
147                                    let _: bool = cmd_route.set_if_changed(ROUTE_THEMES.to_string());
148                                }
149                                _ => {
150                                    cmd_state.toggle_theme_mode();
151                                }
152                            }
153                            let _: bool = cmd_sel.set_if_changed(None);
154                            let _: bool = cmd_open.set_if_changed(false);
155                        }
156                    })
157                });
158                let cmd_modal: NodeId = view! {
159                    EuvModal {
160                        open: cmd_open
161                        title: CMD_MODAL_TITLE.to_string()
162                        body: cmd_list
163                        tokens: tokens
164                    }
165                };
166                let rctx: Context = current_context();
167                rctx.get_scene().with_write(
168                    |tree: &mut SceneTree| {
169                        tree.attach_scope(cmd_modal, cmd_scope);
170                    },
171                    (),
172                );
173                let state_shell: ShowcaseState = state_c.clone();
174                let hub_shell: DynamicUpdateHub = hub.clone();
175                let global_wasm_slot: NodeId = view! {
176                    slot {
177                        id: WASM_GLOBAL_ROOT_SLOT
178                        hub: hub
179                        style: c_full_col()
180                        fallback: move || {
181                            let mut nav_items: Vec<EuvNavItem> = ShowcaseState::nav_items();
182                            for dyn_route in hub_shell.registered_routes().into_iter() {
183                                if dyn_route == ROUTE_DYNAMIC_PANEL {
184                                    continue;
185                                }
186                                if !nav_items
187                                .iter()
188                                .any(|item: &EuvNavItem| item.get_path().as_str() == dyn_route.as_str())
189                                {
190                                    let label: String = hub_shell
191                                    .page_title(&dyn_route)
192                                    .filter(|t: &String| !t.is_empty())
193                                    .unwrap_or_else(|| dyn_route.clone());
194                                    nav_items.push(EuvNavItem::new(dyn_route, label).section(NAV_SEC_RUNTIME));
195                                }
196                            }
197                            let nav: NodeId = view! {
198                                EuvSidebarNav {
199                                    items: nav_items
200                                    active_route: state_shell.get_route()
201                                    tokens: tokens
202                                }
203                            };
204                            let bottom_items: Vec<EuvNavItem> = vec![
205                                EuvNavItem::new(
206                                    ROUTE_OVERVIEW.to_string(),
207                                    BNAV_HOME_LABEL.to_string(),
208                                )
209                                .section(BNAV_HOME_ICON),
210                                EuvNavItem::new(
211                                    ROUTE_MARKDOWN.to_string(),
212                                    BNAV_DOCS_LABEL.to_string(),
213                                )
214                                .section(BNAV_DOCS_ICON),
215                                EuvNavItem::new(ROUTE_LAB.to_string(), BNAV_CASES_LABEL.to_string())
216                                .section(BNAV_CASES_ICON),
217                                EuvNavItem::new(
218                                    ROUTE_STRESS.to_string(),
219                                    BNAV_STRESS_LABEL.to_string(),
220                                )
221                                .section(BNAV_STRESS_ICON),
222                                EuvNavItem::new(
223                                    ROUTE_GAME_3D.to_string(),
224                                    BNAV_3D_LABEL.to_string(),
225                                )
226                                .section(BNAV_3D_ICON),
227                            ];
228                            let bottom_nav: NodeId = view! {
229                                EuvBottomNav {
230                                    items: bottom_items
231                                    active_route: state_shell.get_route()
232                                    tokens: tokens
233                                }
234                            };
235                            let swipe_order: Vec<String> = vec![
236                                ROUTE_OVERVIEW.to_string(),
237                                ROUTE_MARKDOWN.to_string(),
238                                ROUTE_LAB.to_string(),
239                                ROUTE_STRESS.to_string(),
240                                ROUTE_GAME_3D.to_string(),
241                                ROUTE_FORMS.to_string(),
242                                ROUTE_MEDIA.to_string(),
243                                ROUTE_OVERLAYS.to_string(),
244                                ROUTE_THEMES.to_string(),
245                                ROUTE_DATA.to_string(),
246                                ROUTE_REACTIVE.to_string(),
247                                ROUTE_RENDER.to_string(),
248                                ROUTE_WINDOW.to_string(),
249                                ROUTE_GAME.to_string(),
250                                ROUTE_DYNAMIC.to_string(),
251                            ];
252                            let state_for_outlet: ShowcaseState = state_shell.clone();
253                            let router: EuvRouter = state_shell
254                            .get_router()
255                            .clone()
256                            .with_dynamic_hub(hub_shell.clone());
257                            let route_sig: Signal<String> = state_shell.get_route();
258                            let cur_target: String = route_sig.get_untracked();
259                            if router.get_current_path().get_untracked() != cur_target {
260                                router.replace(&cur_target);
261                            }
262                            let breadcrumb_sig: Signal<String> = Signal::new(
263                                ShowcaseState::breadcrumb_for_route(&cur_target),
264                            );
265                            let router_sync_in: EuvRouter = router.clone();
266                            let router_path_sig: Signal<String> = router.get_current_path();
267                            let sctx: Context = current_context();
268                            let (sync_scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
269                                let _: Effect = Effect::new(move || {
270                                    let target: String = route_sig.get();
271                                    let _: bool = breadcrumb_sig
272                                    .set_if_changed(ShowcaseState::breadcrumb_for_route(&target));
273                                    if router_sync_in.get_current_path().get_untracked() != target {
274                                        router_sync_in.push(&target);
275                                    }
276                                });
277                                Effect::new(move || {
278                                    let rp: String = router_path_sig.get();
279                                    if route_sig.get_untracked() != rp {
280                                        let _: bool = route_sig.set_if_changed(rp);
281                                    }
282                                })
283                            });
284                            let page_node: NodeId = router
285                            .outlet(move |matched: &EuvRouteMatch| {
286                                let tok: ThemeTokens = untracked(|| {
287                                    state_for_outlet.get_theme().get_tokens().get()
288                                });
289                                mount_route_by_name(matched.get_path(), &state_for_outlet, tok)
290                            })
291                            .with_theme(state_shell.get_theme().clone())
292                            .with_route_order(swipe_order.clone())
293                            .with_double_back_exit(true)
294                            .mount();
295                            sctx.get_scene().with_write(
296                                |tree: &mut SceneTree| {
297                                    tree.attach_scope(page_node, sync_scope);
298                                },
299                                (),
300                            );
301                            let st_dark_top: ShowcaseState = state_shell.clone();
302                            let st_scheme_top: ShowcaseState = state_shell.clone();
303                            let st_dark_mobile: ShowcaseState = state_shell.clone();
304                            let mode_label: String =
305                            match state_shell.get_theme().get_mode().get_untracked() {
306                                ThemeMode::Dark => LABEL_MODE_LIGHT.to_string(),
307                                ThemeMode::Light => LABEL_MODE_DARK.to_string(),
308                            };
309                            let scheme_label: String =
310                            format!("{:?}", state_shell.get_theme().get_scheme().get_untracked());
311                            let top_actions: NodeId = view! {
312                                row {
313                                    gap: SPACE_SM
314                                    align: AlignItems::Center
315                                    EuvButton {
316                                        label: BTN_SEARCH_DESKTOP.to_string()
317                                        tokens: tokens
318                                        outline()
319                                        sm()
320                                        on_click: move |_: &UiEvent| {
321                                            let _: bool = cmd_open.set_if_changed(true);
322                                        }
323                                    }
324                                    EuvButton {
325                                        label: scheme_label
326                                        tokens: tokens
327                                        secondary()
328                                        sm()
329                                        on_click: move |_: &UiEvent| {
330                                            st_scheme_top.next_scheme();
331                                        }
332                                    }
333                                    EuvButton {
334                                        label: mode_label.clone()
335                                        tokens: tokens
336                                        outline()
337                                        sm()
338                                        on_click: move |_: &UiEvent| {
339                                            st_dark_top.toggle_theme_mode();
340                                        }
341                                    }
342                                }
343                            };
344                            let mobile_actions: NodeId = view! {
345                                row {
346                                    gap: SPACE_XS
347                                    align: AlignItems::Center
348                                    EuvButton {
349                                        label: BTN_SEARCH_MOBILE.to_string()
350                                        tokens: tokens
351                                        outline()
352                                        sm()
353                                        on_click: move |_: &UiEvent| {
354                                            let _: bool = cmd_open.set_if_changed(true);
355                                        }
356                                    }
357                                    EuvButton {
358                                        label: mode_label
359                                        tokens: tokens
360                                        ghost()
361                                        sm()
362                                        on_click: move |_: &UiEvent| {
363                                            st_dark_mobile.toggle_theme_mode();
364                                        }
365                                    }
366                                }
367                            };
368                            view! {
369                                EuvAppShell {
370                                    brand: SHOWCASE_BRAND.to_string()
371                                    sidebar: nav
372                                    main_content: page_node
373                                    tokens: tokens
374                                    route: state_shell.get_route()
375                                    breadcrumb: breadcrumb_sig
376                                    top_bar_actions: top_actions
377                                    mobile_header_actions: mobile_actions
378                                    bottom_nav: bottom_nav
379                                    swipe_routes: swipe_order
380                                    show_fps: true
381                                }
382                            }
383                        }
384                    }
385                };
386                vec![global_wasm_slot, cmd_modal]
387            }
388        }
389    };
390    let root_ctx: Context = current_context();
391    root_ctx.get_scene().with_write(
392        |tree: &mut SceneTree| {
393            tree.attach_scope(root_node, ev_scope);
394        },
395        (),
396    );
397    root_node
398}
399
400/// Mounts the showcase page corresponding to the active route in `state`.
401///
402/// # Arguments
403///
404/// - `&ShowcaseState` - Reactive showcase state.
405/// - `ThemeTokens` - Active resolved design tokens.
406///
407/// # Returns
408///
409/// - `NodeId` - Mounted page container handle.
410pub fn mount_active_route(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
411    let route: String = state.get_route().get_untracked();
412    mount_route_by_name(&route, state, tokens)
413}
414
415/// Dispatches a route string to its corresponding declarative showcase page builder.
416///
417/// # Arguments
418///
419/// - `&str` - Active route path.
420/// - `&ShowcaseState` - Reactive showcase state.
421/// - `ThemeTokens` - Active resolved design tokens.
422///
423/// # Returns
424///
425/// - `NodeId` - Mounted page container handle.
426pub(crate) fn mount_route_by_name(
427    route: &str,
428    state: &ShowcaseState,
429    tokens: ThemeTokens,
430) -> NodeId {
431    match route {
432        ROUTE_MARKDOWN => mount_markdown_page(state, tokens),
433        ROUTE_REACTIVE => mount_reactive_page(state, tokens),
434        ROUTE_RENDER => mount_render_page(state, tokens),
435        ROUTE_WINDOW => mount_window_page(state, tokens),
436        ROUTE_FORMS => mount_forms_page(state, tokens),
437        ROUTE_THEMES => mount_themes_page(state, tokens),
438        ROUTE_DATA => mount_data_page(state, tokens),
439        ROUTE_GAME => mount_game_page(state, tokens),
440        ROUTE_GAME_3D => mount_game3d_page(state, tokens),
441        ROUTE_MEDIA => mount_media_page(state, tokens),
442        ROUTE_LAB => mount_lab_page(state, tokens),
443        ROUTE_OVERLAYS => mount_overlays_page(state, tokens),
444        ROUTE_DYNAMIC => mount_dynamic_page(state, tokens),
445        ROUTE_STRESS => mount_stress_page(state, tokens),
446        _ => mount_overview_page(state, tokens),
447    }
448}
449
450/// Mounts the redesigned flagship overview dashboard with hero banner, KPI cards, live Freeze lifecycle monitor, cross-component event & state demo, and 7-platform matrix.
451///
452/// # Arguments
453///
454/// - `&ShowcaseState` - Reactive showcase state.
455/// - `ThemeTokens` - Active design tokens.
456///
457/// # Returns
458///
459/// - `NodeId` - Mounted overview page node.
460pub fn mount_overview_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
461    let p: ThemePalette = tokens.get_palette();
462    let g: ThemeGeometry = tokens.get_geometry();
463    let route_sig: Signal<String> = state.get_route();
464    let frozen_sig: Signal<usize> = state.get_router().get_frozen_count();
465    let mounts_sig: Signal<u32> = state.get_lifecycle_mounts();
466    let freezes_sig: Signal<u32> = state.get_lifecycle_freezes();
467    let resumes_sig: Signal<u32> = state.get_lifecycle_resumes();
468    let last_ev_sig: Signal<String> = state.get_lifecycle_last_event();
469    let entries_sig: Signal<Vec<EuvRouteLifecycleEntry>> =
470        state.get_router().get_lifecycle_entries();
471    let local_counter: LocalState<u32> = local_state!(1_u32);
472    let global_banner: Signal<ShowcaseGlobalBanner> =
473        global_state!(ShowcaseGlobalBanner = ShowcaseGlobalBanner::default());
474    let dir_items: [(&str, &str, &str, &str); 14] = [
475        (
476            ROUTE_MARKDOWN,
477            HOME_DIR_TAG_MD,
478            NAV_LABEL_MARKDOWN,
479            HOME_DIR_DESC_MD,
480        ),
481        (ROUTE_LAB, HOME_DIR_TAG_LB, NAV_LABEL_LAB, HOME_DIR_DESC_LB),
482        (
483            ROUTE_STRESS,
484            HOME_DIR_TAG_ST,
485            NAV_LABEL_STRESS,
486            HOME_DIR_DESC_ST,
487        ),
488        (
489            ROUTE_GAME_3D,
490            HOME_DIR_TAG_3D,
491            NAV_LABEL_GAME_3D,
492            HOME_DIR_DESC_3D,
493        ),
494        (
495            ROUTE_FORMS,
496            HOME_DIR_TAG_FM,
497            NAV_LABEL_FORMS,
498            HOME_DIR_DESC_FM,
499        ),
500        (
501            ROUTE_MEDIA,
502            HOME_DIR_TAG_ME,
503            NAV_LABEL_MEDIA,
504            HOME_DIR_DESC_ME,
505        ),
506        (
507            ROUTE_OVERLAYS,
508            HOME_DIR_TAG_OV,
509            NAV_LABEL_OVERLAYS,
510            HOME_DIR_DESC_OV,
511        ),
512        (
513            ROUTE_THEMES,
514            HOME_DIR_TAG_TH,
515            NAV_LABEL_THEMES,
516            HOME_DIR_DESC_TH,
517        ),
518        (
519            ROUTE_DATA,
520            HOME_DIR_TAG_DT,
521            NAV_LABEL_DATA,
522            HOME_DIR_DESC_DT,
523        ),
524        (
525            ROUTE_REACTIVE,
526            HOME_DIR_TAG_RX,
527            NAV_LABEL_REACTIVE,
528            HOME_DIR_DESC_RX,
529        ),
530        (
531            ROUTE_RENDER,
532            HOME_DIR_TAG_RN,
533            NAV_LABEL_RENDER,
534            HOME_DIR_DESC_RN,
535        ),
536        (
537            ROUTE_WINDOW,
538            HOME_DIR_TAG_OS,
539            NAV_LABEL_WINDOW,
540            HOME_DIR_DESC_OS,
541        ),
542        (
543            ROUTE_GAME,
544            HOME_DIR_TAG_2D,
545            NAV_LABEL_GAME,
546            HOME_DIR_DESC_2D,
547        ),
548        (
549            ROUTE_DYNAMIC,
550            HOME_DIR_TAG_OT,
551            NAV_LABEL_DYNAMIC,
552            HOME_DIR_DESC_OT,
553        ),
554    ];
555    let dir_rows: Vec<NodeId> = dir_items
556        .iter()
557        .map(|(path, tag, label, desc): &(&str, &str, &str, &str)| {
558            let target: String = (*path).to_string();
559            let badge_txt: String = (*tag).to_string();
560            let title_txt: String = (*label).to_string();
561            let desc_txt: String = (*desc).to_string();
562            let on_dir_click = move |_: &UiEvent| {
563                let _: bool = route_sig.set_if_changed(target.clone());
564            };
565            view! {
566                row {
567                    width: Length::Percent(100.0)
568                    padding: Edges::symmetric(SPACE_SM, SPACE_MD)
569                    align: AlignItems::Center
570                    justify: JustifyContent::SpaceBetween
571                    gap: SPACE_SM
572                    radius: g.get_radius_md()
573                    background: p.get_background()
574                    border: (g.get_border_width(), p.get_border())
575                    cursor: CursorIcon::Pointer
576                    on_click: on_dir_click
577                    row {
578                        flex_grow: 1.0
579                        flex_shrink: 1.0
580                        min_width: Length::Px(0.0)
581                        align: AlignItems::Center
582                        gap: SPACE_SM
583                        overflow: Overflow::Hidden
584                        row {
585                            width: Length::Px(34.0)
586                            height: Length::Px(34.0)
587                            flex_shrink: 0.0
588                            radius: 99.0
589                            background: p.get_primary().with_alpha(26)
590                            justify: JustifyContent::Center
591                            align: AlignItems::Center
592                            text {
593                                font_size: 11.5
594                                font_family: FontFamily::Monospace
595                                font_weight: FontWeight::Bold
596                                color: p.get_primary()
597                                text_align: TextAlign::Center
598                                text_overflow: TextOverflow::Clip
599                                { badge_txt }
600                            }
601                        }
602                        column {
603                            flex_grow: 1.0
604                            flex_shrink: 1.0
605                            min_width: Length::Px(0.0)
606                            gap: 2.0
607                            overflow: Overflow::Hidden
608                            text {
609                                width: Length::Percent(100.0)
610                                font_size: 14.0
611                                font_weight: FontWeight::SemiBold
612                                color: p.get_foreground()
613                                overflow: Overflow::Hidden
614                                text_overflow: TextOverflow::Ellipsis
615                                { title_txt }
616                            }
617                            text {
618                                width: Length::Percent(100.0)
619                                font_size: 12.0
620                                color: p.get_muted_foreground()
621                                overflow: Overflow::Hidden
622                                text_overflow: TextOverflow::Ellipsis
623                                { desc_txt }
624                            }
625                        }
626                    }
627                    text {
628                        flex_shrink: 0.0
629                        font_size: 14.0
630                        font_weight: FontWeight::Bold
631                        color: p.get_muted_foreground()
632                        text_overflow: TextOverflow::Clip
633                        { HOME_DIR_ARROW }
634                    }
635                }
636            }
637        })
638        .collect();
639    let hero_style: Style = style! {
640        FlexDirection::Column
641        Overflow::Hidden
642        width: Length::Percent(100.0)
643        padding: Edges::all(SPACE_XL)
644        gap: SPACE_MD
645        background: p.get_card()
646        border: (g.get_border_width().max(1.0), p.get_primary().with_alpha(96))
647        radius: g.get_radius_xl()
648        shadow: g.get_shadow_md()
649    };
650    let on_open_markdown = move |_: &UiEvent| {
651        let _: bool = route_sig.set_if_changed(ROUTE_MARKDOWN.to_string());
652    };
653    let on_open_3d = move |_: &UiEvent| {
654        let _: bool = route_sig.set_if_changed(ROUTE_GAME_3D.to_string());
655    };
656    let on_open_stress = move |_: &UiEvent| {
657        let _: bool = route_sig.set_if_changed(ROUTE_STRESS.to_string());
658    };
659    let on_open_reactive = move |_: &UiEvent| {
660        let _: bool = route_sig.set_if_changed(ROUTE_REACTIVE.to_string());
661    };
662    let lifecycle_stats_text = move || -> String {
663        format!(
664            "Frozen Pages: {} | Mounts: {} | Freezes: {} | Resumes: {}",
665            frozen_sig.get(),
666            mounts_sig.get(),
667            freezes_sig.get(),
668            resumes_sig.get()
669        )
670    };
671    let last_hook_text = move || -> String { format!("Last Hook: {}", last_ev_sig.get()) };
672    let cached_routes_text = move || -> String {
673        let entries: Vec<EuvRouteLifecycleEntry> = entries_sig.get();
674        let summary: Vec<String> = entries
675            .iter()
676            .map(|e: &EuvRouteLifecycleEntry| format!("{}={:?}", e.get_path(), e.get_phase()))
677            .collect();
678        if summary.is_empty() {
679            LIFECYCLE_ACTIVE_DEFAULT.to_string()
680        } else {
681            format!("Cached Routes: {}", summary.join(" | "))
682        }
683    };
684    let global_local_text = move || -> String {
685        let gb: ShowcaseGlobalBanner = global_banner.get();
686        let last_src: &str = if gb.get_last_source().is_empty() {
687            SOURCE_NONE
688        } else {
689            gb.get_last_source().as_str()
690        };
691        format!(
692            "GlobalState Pulses: {} (source: {}) | LocalState (preserved across Freeze): {}",
693            gb.get_pulses(),
694            last_src,
695            local_counter.get()
696        )
697    };
698    let on_emit_pulse = move |_: &UiEvent| {
699        let seq: u32 = local_counter.get_untracked();
700        emit!(ShowcasePulseEvent {
701            source: ROUTE_OVERVIEW.to_string(),
702            seq,
703        });
704    };
705    let on_local_inc = move |_: &UiEvent| {
706        let _: bool = local_counter.update(|v: &mut u32| *v += 1);
707    };
708    let on_open_game = move |_: &UiEvent| {
709        let _: bool = route_sig.set_if_changed(ROUTE_GAME.to_string());
710    };
711    let on_open_window = move |_: &UiEvent| {
712        let _: bool = route_sig.set_if_changed(ROUTE_WINDOW.to_string());
713    };
714    view! {
715        EuvPage {
716            title: OVERVIEW_TITLE.to_string()
717            subtitle: OVERVIEW_SUBTITLE.to_string()
718            tokens: tokens
719            EuvCard {
720                title: HOME_DIR_TITLE.to_string()
721                tokens: tokens
722                subtitle: HOME_DIR_SUBTITLE
723                column {
724                    width: Length::Percent(100.0)
725                    gap: SPACE_SM
726                    ..dir_rows
727                }
728            }
729            view {
730                style: hero_style
731                row {
732                    width: Length::Percent(100.0)
733                    flex_wrap: FlexWrap::Wrap
734                    align: AlignItems::Center
735                    gap: SPACE_XS
736                    EuvBadge {
737                        label: HERO_BADGE_VER.to_string()
738                        tone: EuvTone::Primary
739                        tokens: tokens
740                    }
741                    EuvBadge {
742                        label: HERO_BADGE_ZERO_WV.to_string()
743                        tone: EuvTone::Success
744                        tokens: tokens
745                    }
746                    EuvBadge {
747                        label: HERO_BADGE_EVA.to_string()
748                        tone: EuvTone::Neutral
749                        tokens: tokens
750                    }
751                    EuvBadge {
752                        label: HERO_BADGE_FREEZE.to_string()
753                        tone: EuvTone::Warning
754                        tokens: tokens
755                    }
756                }
757                text {
758                    width: Length::Percent(100.0)
759                    font_size: 20.0
760                    font_weight: FontWeight::Bold
761                    color: p.get_foreground()
762                    { HERO_HEADLINE }
763                }
764                text {
765                    width: Length::Percent(100.0)
766                    font_size: 13.5
767                    color: p.get_muted_foreground()
768                    { HERO_DESCRIPTION }
769                }
770                EuvActionRow {
771                    EuvButton {
772                        label: BTN_OPEN_MARKDOWN.to_string()
773                        tokens: tokens
774                        on_click: on_open_markdown
775                    }
776                    EuvButton {
777                        label: BTN_OPEN_3D_RT.to_string()
778                        tokens: tokens
779                        secondary()
780                        on_click: on_open_3d
781                    }
782                    EuvButton {
783                        label: BTN_OPEN_STRESS_LAB.to_string()
784                        tokens: tokens
785                        outline()
786                        on_click: on_open_stress
787                    }
788                    EuvButton {
789                        label: BTN_TRY_REACTIVITY.to_string()
790                        tokens: tokens
791                        outline()
792                        on_click: on_open_reactive
793                    }
794                }
795            }
796            EuvStatGrid {
797                EuvStatCard {
798                    label: STAT_PLATFORMS_LABEL.to_string()
799                    value: STAT_PLATFORMS_VAL.to_string()
800                    caption: STAT_PLATFORMS_CAP.to_string()
801                    tokens: tokens
802                }
803                EuvStatCard {
804                    label: STAT_SCHEMES_LABEL.to_string()
805                    value: STAT_SCHEMES_VAL.to_string()
806                    caption: STAT_SCHEMES_CAP.to_string()
807                    tokens: tokens
808                }
809                EuvStatCard {
810                    label: STAT_RENDER_LABEL.to_string()
811                    value: STAT_RENDER_VAL.to_string()
812                    caption: STAT_RENDER_CAP.to_string()
813                    tokens: tokens
814                }
815            }
816            EuvCard {
817                title: CARD_LIFECYCLE_TITLE.to_string()
818                tokens: tokens
819                subtitle: CARD_LIFECYCLE_SUB
820                text {
821                    width: Length::Percent(100.0)
822                    font_size: 13.5
823                    font_weight: FontWeight::SemiBold
824                    color: p.get_primary()
825                    { lifecycle_stats_text }
826                }
827                text {
828                    width: Length::Percent(100.0)
829                    font_size: 12.5
830                    font_family: FontFamily::Monospace
831                    color: p.get_muted_foreground()
832                    { last_hook_text }
833                }
834                text {
835                    width: Length::Percent(100.0)
836                    font_size: 12.5
837                    color: p.get_foreground()
838                    { cached_routes_text }
839                }
840                text {
841                    width: Length::Percent(100.0)
842                    font_size: 12.5
843                    font_weight: FontWeight::Medium
844                    color: p.get_success()
845                    { global_local_text }
846                }
847                EuvActionRow {
848                    EuvButton {
849                        label: BTN_EMIT_PULSE.to_string()
850                        tokens: tokens
851                        sm()
852                        on_click: on_emit_pulse
853                    }
854                    EuvButton {
855                        label: BTN_LOCAL_INC.to_string()
856                        tokens: tokens
857                        secondary()
858                        sm()
859                        on_click: on_local_inc
860                    }
861                    EuvButton {
862                        label: BTN_OPEN_GAME_ENGINE.to_string()
863                        tokens: tokens
864                        outline()
865                        sm()
866                        on_click: on_open_game
867                    }
868                    EuvButton {
869                        label: BTN_OPEN_OS_SERVICES.to_string()
870                        tokens: tokens
871                        outline()
872                        sm()
873                        on_click: on_open_window
874                    }
875                }
876            }
877            EuvCard {
878                title: CARD_PLATFORMS_TITLE.to_string()
879                tokens: tokens
880                subtitle: CARD_PLATFORMS_SUB
881                EuvTable {
882                    headers: vec![
883                        TABLE_COL_TARGET.to_string(),
884                        TABLE_COL_BACKEND.to_string(),
885                        TABLE_COL_GPU.to_string(),
886                    ]
887                    rows: vec![
888                        vec![ROW_WEB.to_string(), ROW_WEB_API.to_string(), ROW_WEB_GPU.to_string()],
889                        vec![ROW_MACOS.to_string(), ROW_MACOS_API.to_string(), ROW_MACOS_GPU.to_string()],
890                        vec![ROW_IOS.to_string(), ROW_IOS_API.to_string(), ROW_MACOS_GPU.to_string()],
891                        vec![ROW_ANDROID.to_string(), ROW_ANDROID_API.to_string(), ROW_ANDROID_GPU.to_string()],
892                        vec![ROW_WINDOWS.to_string(), ROW_WINDOWS_API.to_string(), ROW_WINDOWS_GPU.to_string()],
893                        vec![ROW_LINUX.to_string(), ROW_LINUX_API.to_string(), ROW_ANDROID_GPU.to_string()],
894                    ]
895                    tokens: tokens
896                }
897            }
898        }
899    }
900}
901
902/// Mounts the Markdown & Code Studio page showcasing exact VS Code `Eva Light Bold` / `Eva Dark Bold` `EuvCodeBlock` and the complete native GFM Markdown component suite.
903///
904/// # Arguments
905///
906/// - `&ShowcaseState` - Reactive showcase state.
907/// - `ThemeTokens` - Active design tokens.
908///
909/// # Returns
910///
911/// - `NodeId` - Mounted Markdown & Code Studio page handle.
912pub fn mount_markdown_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
913    let p: ThemePalette = tokens.get_palette();
914    let eva: CodeThemePalette = CodeThemePalette::resolve(tokens.get_mode());
915    let st_toggle: ShowcaseState = state.clone();
916    let lang_tab: Signal<usize> = state.get_markdown_lang_tab();
917    let copy_log: Signal<String> = state.get_markdown_copy_log();
918    let link_log: Signal<String> = state.get_markdown_link_log();
919    let tasks_toggled: Signal<u32> = state.get_markdown_tasks_toggled();
920    let copy_log_doc: Signal<String> = copy_log;
921    let link_log_doc: Signal<String> = link_log;
922    let tasks_doc: Signal<u32> = tasks_toggled;
923    let active_theme_desc: String = match tokens.get_mode() {
924        ThemeMode::Light => MD_THEME_DESC_LIGHT.to_string(),
925        ThemeMode::Dark => MD_THEME_DESC_DARK.to_string(),
926    };
927    let swatch_colors: [Color; 6] = [
928        eva.get_background(),
929        eva.get_keyword(),
930        eva.get_function(),
931        eva.get_number(),
932        eva.get_constant(),
933        eva.get_property(),
934    ];
935    let swatch_nodes: Vec<NodeId> = swatch_colors
936        .into_iter()
937        .map(|col: Color| {
938            view! {
939                view {
940                    width: Length::Px(22.0)
941                    height: Length::Px(22.0)
942                    radius: 6.0
943                    background: col
944                    border: (1.0, eva.get_border())
945                }
946            }
947        })
948        .collect();
949    view! {
950        EuvPage {
951            title: MD_STUDIO_TITLE.to_string()
952            subtitle: MD_STUDIO_SUBTITLE.to_string()
953            tokens: tokens
954            EuvCard {
955                title: MD_THEME_CARD_TITLE.to_string()
956                tokens: tokens
957                subtitle: MD_THEME_CARD_SUB
958                text {
959                    font_size: 12.5
960                    font_family: FontFamily::Monospace
961                    font_weight: FontWeight::SemiBold
962                    color: eva.get_keyword()
963                    { active_theme_desc }
964                }
965                row {
966                    width: Length::Percent(100.0)
967                    align: AlignItems::Center
968                    flex_wrap: FlexWrap::Wrap
969                    gap: SPACE_SM
970                    ..swatch_nodes
971                    EuvButton {
972                        label: BTN_TOGGLE_EVA_MODE.to_string()
973                        tokens: tokens
974                        sm()
975                        on_click: move |_: &UiEvent| {
976                            st_toggle.toggle_theme_mode();
977                        }
978                    }
979                    EuvButton {
980                        label: BTN_EMIT_PULSE.to_string()
981                        tokens: tokens
982                        outline()
983                        sm()
984                        on_click: move |_: &UiEvent| {
985                            emit!(ShowcasePulseEvent {
986                                source: ROUTE_MARKDOWN.to_string(),
987                                seq: 1,
988                            });
989                        }
990                    }
991                }
992            }
993            EuvCard {
994                title: MD_CODE_CARD_TITLE.to_string()
995                tokens: tokens
996                subtitle: MD_CODE_CARD_SUB
997                EuvSegmented {
998                    options: vec![
999                        MD_TAB_RUST.to_string(),
1000                        MD_TAB_TS.to_string(),
1001                        MD_TAB_JSON.to_string(),
1002                        MD_TAB_DIFF.to_string(),
1003                    ]
1004                    selected: lang_tab
1005                    tokens: tokens
1006                }
1007                column {
1008                    width: Length::Percent(100.0)
1009                    bind_children: move || {
1010                        let tab: usize = lang_tab.get();
1011                        let (src, lang, fname): (&str, &str, &str) = match tab {
1012                            1 => (MD_SAMPLE_TS, MD_LANG_TS, MD_FILE_TS),
1013                            2 => (MD_SAMPLE_JSON, MD_LANG_JSON, MD_FILE_JSON),
1014                            3 => (MD_SAMPLE_DIFF, MD_LANG_DIFF, MD_FILE_DIFF),
1015                            _ => (MD_SAMPLE_RUST, MD_LANG_RUST, MD_FILE_RUST),
1016                        };
1017                        let cb_log: Signal<String> = copy_log;
1018                        let block: NodeId = EuvCodeBlock::new(src.to_string(), tokens)
1019                        .language(lang)
1020                        .filename(fname)
1021                        .line_numbers(true)
1022                        .on_copy(move |txt: &str| {
1023                            let _: bool = cb_log.set(format!(
1024                                "Copied {} bytes ({lang}) via Eva Bold EuvCodeBlock",
1025                                txt.len()
1026                            ));
1027                        })
1028                        .mount();
1029                        vec![block]
1030                    }
1031                }
1032                text {
1033                    font_size: 12.0
1034                    font_family: FontFamily::Monospace
1035                    color: p.get_primary()
1036                    { move || format!("Copy: {} | Link: {} | Tasks Toggled: {}", copy_log.get(), link_log.get(), tasks_toggled.get()) }
1037                }
1038            }
1039            EuvCard {
1040                title: MD_DOC_CARD_TITLE.to_string()
1041                tokens: tokens
1042                subtitle: MD_DOC_CARD_SUB
1043                { EuvMarkdown::new(MD_FULL_DOCUMENT.to_string(), tokens)
1044                    .on_link(move |url: &str| {
1045                        let _: bool = link_log_doc.set(url.to_string());
1046                    })
1047                    .on_copy(move |code: &str| {
1048                        let _: bool = copy_log_doc.set(format!("Copied {} bytes from Markdown fence", code.len()));
1049                    })
1050                    .on_toggle_task(move |_idx: usize, _checked: bool| {
1051                        let _: bool = tasks_doc.update(|n: &mut u32| *n += 1);
1052                    })
1053                    .mount() }
1054            }
1055        }
1056    }
1057}
1058
1059/// Mounts the fine-grained reactivity showcase demonstrating `Signal`, `computed!`, `batch`, and `view!`.
1060///
1061/// # Arguments
1062///
1063/// - `&ShowcaseState` - Reactive showcase state.
1064/// - `ThemeTokens` - Active design tokens.
1065///
1066/// # Returns
1067///
1068/// - `NodeId` - Mounted reactivity page node.
1069pub fn mount_reactive_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
1070    let p: ThemePalette = tokens.get_palette();
1071    let counter: Signal<i32> = state.get_counter();
1072    let doubled: Memo<i32> = state.get_doubled();
1073    view! {
1074        EuvPage {
1075            title: REACTIVE_TITLE.to_string()
1076            subtitle: REACTIVE_SUBTITLE.to_string()
1077            tokens: tokens
1078            EuvCard {
1079                title: REACTIVE_CARD_TITLE.to_string()
1080                tokens: tokens
1081                subtitle: REACTIVE_CARD_SUB
1082                column {
1083                    gap: SPACE_MD
1084                    text {
1085                        font_size: 18.0
1086                        font_weight: FontWeight::Bold
1087                        color: p.get_foreground()
1088                        { move || format!("{PREFIX_COUNTER}{}", counter.get()) }
1089                    }
1090                    text {
1091                        font_size: 15.0
1092                        color: p.get_primary()
1093                        { move || format!("{PREFIX_DOUBLED}{}", doubled.get()) }
1094                    }
1095                    EuvActionRow {
1096                        EuvButton {
1097                            label: BTN_INCREMENT.to_string()
1098                            tokens: tokens
1099                            on_click: move |_: &UiEvent| {
1100                                let _: bool = counter.update(|v: &mut i32| *v += 1);
1101                            }
1102                        }
1103                        EuvButton {
1104                            label: BTN_BATCH_TEN.to_string()
1105                            tokens: tokens
1106                            secondary()
1107                            on_click: move |_: &UiEvent| {
1108                                batch(|| {
1109                                    for _ in 0..10 {
1110                                        let _: bool = counter.update(|v: &mut i32| *v += 1);
1111                                    }
1112                                });
1113                            }
1114                        }
1115                        EuvButton {
1116                            label: BTN_RESET.to_string()
1117                            tokens: tokens
1118                            outline()
1119                            on_click: move |_: &UiEvent| {
1120                                let _: bool = counter.set_if_changed(0);
1121                            }
1122                        }
1123                    }
1124                }
1125            }
1126        }
1127    }
1128}
1129
1130/// Mounts the multi-mode rendering inspector with live mode switcher and vector `canvas` via `view!`.
1131///
1132/// # Arguments
1133///
1134/// - `&ShowcaseState` - Reactive showcase state.
1135/// - `ThemeTokens` - Active design tokens.
1136///
1137/// # Returns
1138///
1139/// - `NodeId` - Mounted rendering page node.
1140pub fn mount_render_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
1141    let p: ThemePalette = tokens.get_palette();
1142    let g: ThemeGeometry = tokens.get_geometry();
1143    let mode_idx: Signal<usize> = state.get_render_mode_index();
1144    view! {
1145        EuvPage {
1146            title: RENDER_TITLE.to_string()
1147            subtitle: RENDER_SUBTITLE.to_string()
1148            tokens: tokens
1149            EuvCard {
1150                title: RENDER_CARD_TITLE.to_string()
1151                tokens: tokens
1152                subtitle: RENDER_CARD_SUB
1153                EuvSegmented {
1154                    options: vec![
1155                        MODE_AUTO.to_string(),
1156                        MODE_SOFTWARE.to_string(),
1157                        MODE_HARDWARE.to_string(),
1158                        MODE_HYBRID.to_string(),
1159                    ]
1160                    selected: mode_idx
1161                    tokens: tokens
1162                }
1163                column {
1164                    gap: SPACE_SM
1165                    text {
1166                        font_size: 13.0
1167                        font_weight: FontWeight::Medium
1168                        color: p.get_primary()
1169                        { move || format!("Active Pipeline Selection: {}", match mode_idx.get() { 1 => MODE_SOFTWARE, 2 => MODE_HARDWARE, 3 => MODE_HYBRID, _ => MODE_AUTO }) }
1170                    }
1171                    text {
1172                        font_size: 13.0
1173                        font_weight: FontWeight::Medium
1174                        color: p.get_muted_foreground()
1175                        { CANVAS_LABEL }
1176                    }
1177                    canvas {
1178                        width: Length::Percent(100.0)
1179                        height: Length::Px(140.0)
1180                        background: p.get_muted()
1181                        border: (g.get_border_width(), p.get_border())
1182                        radius: g.get_radius_md()
1183                        painter: move |bounds: Rect, dl: &mut DisplayList| {
1184                            let bw: f32 = bounds.get_width().max(120.0);
1185                            let rect_w: f32 = (bw * 0.28).clamp(56.0, 160.0);
1186                            let circle_r: f32 = (bw * 0.08).clamp(20.0, 42.0);
1187                            let circle_x: f32 = bounds.get_x() + 16.0 + rect_w + circle_r + 20.0;
1188                            let line_x0: f32 = (circle_x + circle_r + 16.0).min(bounds.right() - 24.0);
1189                            let line_x1: f32 = (bounds.right() - 16.0).max(line_x0);
1190                            dl.push(DrawCommand::FillRoundedRect {
1191                                rect: Rect::new(bounds.get_x() + 16.0, bounds.get_y() + 16.0, rect_w, 108.0),
1192                                color: p.get_primary(),
1193                                radius: CornerRadius::all(14.0),
1194                                border: Border::default(),
1195                            });
1196                            dl.push(DrawCommand::Circle {
1197                                center: Point::new(circle_x.min(bounds.right() - circle_r - 8.0), bounds.get_y() + 70.0),
1198                                radius: circle_r,
1199                                color: p.get_success(),
1200                            });
1201                            dl.push(DrawCommand::Line {
1202                                from: Point::new(line_x0, bounds.get_y() + 28.0),
1203                                to: Point::new(line_x1, bounds.get_y() + 112.0),
1204                                color: p.get_warning(),
1205                                width: 3.0,
1206                            });
1207                        }
1208                    }
1209                }
1210            }
1211        }
1212    }
1213}
1214
1215/// Mounts the OS capabilities page with interactive A11y, Protocol Registration, Dynamic Island, Permissions, and Haptics.
1216///
1217/// # Arguments
1218///
1219/// - `&ShowcaseState` - Reactive showcase state.
1220/// - `ThemeTokens` - Active design tokens.
1221///
1222/// # Returns
1223///
1224/// - `NodeId` - Mounted window & OS services page node.
1225pub fn mount_window_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
1226    let p: ThemePalette = tokens.get_palette();
1227    let font_info: SystemFontInfo = NativeSystemFont::system().font_info();
1228    let gpu_driver: NativeGpuDriver = NativeGpuDriver::probe(GraphicsBackend::Metal);
1229    let gpu_info: &GpuAdapterInfo = gpu_driver.get_adapter();
1230    let platform: PlatformKind = current_platform();
1231    let caps: PlatformCapabilities = PlatformCapabilities::for_platform(platform);
1232    let hub: PlatformServiceHub = PlatformServiceHub::new(platform);
1233    let cam_key: &'static str = SystemPermission::Camera.native_key(platform);
1234    let island_active: Signal<bool> = state.get_island_active();
1235    let island_progress: Signal<u8> = state.get_island_progress();
1236    let cam_status: Signal<String> = state.get_camera_perm_status();
1237    let proto_status: Signal<String> = state.get_protocol_status();
1238    let a11y_count: Signal<u32> = state.get_a11y_announcements();
1239    let haptic_count: Signal<u32> = state.get_haptic_pulses();
1240    let bp_sig: Signal<Breakpoint> = use_breakpoint();
1241    let vp_sig: Signal<Size> = use_viewport_size();
1242    let summary: String = format!(
1243        "Platform: {:?} | Font: {} ({:?}) | GPU: {} (shader_ok={})",
1244        platform,
1245        font_info.get_family_name(),
1246        font_info.get_backend(),
1247        gpu_info.get_device_name(),
1248        gpu_info.get_shader_compiled()
1249    );
1250    let native_feedback: Signal<String> = Signal::new(
1251        "Ready — tap any OS capability below to trigger native platform feedback".to_string(),
1252    );
1253    let fs_sig: Signal<bool> = state.get_fullscreen();
1254    let ctx_win: Context = current_context();
1255    let prev_fs: Rc<Cell<bool>> = Rc::new(Cell::new(fs_sig.get_untracked()));
1256    let (fs_scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
1257        Effect::new(move || {
1258            let now_fs: bool = fs_sig.get();
1259            if prev_fs.replace(now_fs) != now_fs {
1260                let arg: &str = if now_fs { "on" } else { "off" };
1261                let _: bool = dispatch_native_action(NATIVE_ACTION_FULLSCREEN, arg, "");
1262                let _: bool = native_feedback.set(format!("Immersive fullscreen mode: {arg}"));
1263            }
1264        })
1265    });
1266    let target_plat_idx: Signal<usize> = state.get_os_target_platform_idx();
1267    let island_mode_idx: Signal<usize> = state.get_island_mode_idx();
1268    let sys_notifs: Signal<Vec<(String, String)>> = state.get_system_notifications();
1269    let perm_statuses: Signal<Vec<PermissionStatus>> = state.get_permission_statuses();
1270    let all_platforms: [PlatformKind; 7] = [
1271        PlatformKind::Ios,
1272        PlatformKind::IpadOs,
1273        PlatformKind::Android,
1274        PlatformKind::MacOs,
1275        PlatformKind::Windows,
1276        PlatformKind::Linux,
1277        PlatformKind::Web,
1278    ];
1279    let all_island_modes: [IslandPresentationMode; 6] = [
1280        IslandPresentationMode::Compact,
1281        IslandPresentationMode::Minimal,
1282        IslandPresentationMode::Expanded,
1283        IslandPresentationMode::LockScreen,
1284        IslandPresentationMode::FallbackNotification,
1285        IslandPresentationMode::FallbackStatusBar,
1286    ];
1287    let all_perms: [SystemPermission; 14] = [
1288        SystemPermission::Camera,
1289        SystemPermission::Microphone,
1290        SystemPermission::LocationWhenInUse,
1291        SystemPermission::LocationAlways,
1292        SystemPermission::Notifications,
1293        SystemPermission::Photos,
1294        SystemPermission::Contacts,
1295        SystemPermission::Calendar,
1296        SystemPermission::Bluetooth,
1297        SystemPermission::Biometrics,
1298        SystemPermission::FileStorage,
1299        SystemPermission::ClipboardRead,
1300        SystemPermission::MotionSensors,
1301        SystemPermission::LocalNetwork,
1302    ];
1303    let fps_limit_sig: Signal<Option<u32>> = ctx_win.get_fps_limit();
1304    let live_fps_sig: Signal<f32> = ctx_win.get_live_fps();
1305    let native_hz_sig: Signal<f32> = ctx_win.get_display_refresh_rate();
1306    let fps_idx: Signal<usize> = Signal::new(match fps_limit_sig.get_untracked() {
1307        Some(30) => 1,
1308        Some(60) => 2,
1309        Some(120) => 3,
1310        Some(144) => 4,
1311        Some(240) => 5,
1312        _ => 0,
1313    });
1314    let (fps_scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
1315        Effect::new(move || {
1316            let next_cap: Option<u32> = match fps_idx.get() {
1317                1 => Some(30),
1318                2 => Some(60),
1319                3 => Some(120),
1320                4 => Some(144),
1321                5 => Some(240),
1322                _ => None,
1323            };
1324            let _: bool = fps_limit_sig.set_if_changed(next_cap);
1325        })
1326    });
1327    let mut body_id: NodeId = NodeId::default();
1328    let mut fps_card_id: NodeId = NodeId::default();
1329    let page: NodeId = view! {
1330        EuvPage {
1331            title: WINDOW_TITLE.to_string()
1332            subtitle: WINDOW_SUBTITLE.to_string()
1333            tokens: tokens
1334            EuvCard {
1335                title: WINDOW_CARD_TITLE.to_string()
1336                tokens: tokens
1337                subtitle: WINDOW_CARD_SUB
1338                column {
1339                    node_ref: body_id
1340                    role: A11yRole::Region
1341                    a11y_label: "Platform Telemetry"
1342                    gap: SPACE_MD
1343                    text {
1344                        font_size: 13.0
1345                        font_weight: FontWeight::SemiBold
1346                        color: p.get_success()
1347                        { move || native_feedback.get() }
1348                    }
1349                    text {
1350                        font_size: 14.0
1351                        font_weight: FontWeight::Medium
1352                        color: p.get_foreground()
1353                        { summary }
1354                    }
1355                    text {
1356                        font_size: 13.0
1357                        font_weight: FontWeight::SemiBold
1358                        color: p.get_primary()
1359                        { move || {
1360                            let vp: Size = vp_sig.get();
1361                            format!("Live Viewport: {:.0}x{:.0} | Breakpoint: {:?}", vp.get_width(), vp.get_height(), bp_sig.get())
1362                        } }
1363                    }
1364                    text {
1365                        font_size: 13.0
1366                        color: p.get_primary()
1367                        { move || format!("Dynamic Island: active={} ({}%) | Mode: {:?} | Biometrics: {:?}", island_active.get(), island_progress.get(), PlatformServiceHub::default_island_mode(platform), hub.biometric_kind()) }
1368                    }
1369                    text {
1370                        font_size: 13.0
1371                        color: p.get_muted_foreground()
1372                        { move || format!("Protocol: {} | Camera: {} ({cam_key})", proto_status.get(), cam_status.get()) }
1373                    }
1374                    text {
1375                        font_size: 13.0
1376                        color: p.get_muted_foreground()
1377                        { move || format!("A11y Bridge: {} (announcements={}) | Haptics: {} (pulses={})", caps.get_accessibility_bridge(), a11y_count.get(), caps.get_haptics(), haptic_count.get()) }
1378                    }
1379                    EuvActionRow {
1380                        EuvButton {
1381                            label: "Toggle Dynamic Island".to_string()
1382                            tokens: tokens
1383                            on_click: move |_: &UiEvent| {
1384                                let next_active: bool = !island_active.get_untracked();
1385                                let _: bool = island_active.set_if_changed(next_active);
1386                                let next_pct: u8 = if next_active {
1387                                    let cur: u8 = island_progress.get_untracked();
1388                                    if cur >= 100 { 25 } else { (cur + 25).min(100) }
1389                                } else {
1390                                    island_progress.get_untracked()
1391                                };
1392                                let _: bool = island_progress.set_if_changed(next_pct);
1393                                let mut svc: PlatformServiceHub = PlatformServiceHub::new(platform);
1394                                if next_active {
1395                                    let mut content: LiveActivityContent = LiveActivityContent::new(
1396                                        "Euv Live Activity".to_string(),
1397                                        format!("Active ({next_pct}%) on {platform:?}"),
1398                                    );
1399                                    content.set_progress_percent(Some(next_pct));
1400                                    let _ = svc.start_live_activity("euv-showcase-island".to_string(), content);
1401                                    let _: bool = native_feedback.set(format!(
1402                                        "Dynamic Island LIVE ({next_pct}%) dispatched to {platform:?}"
1403                                    ));
1404                                } else {
1405                                    let _: bool = dispatch_native_action(
1406                                        NATIVE_ACTION_ISLAND,
1407                                        "stop",
1408                                        "Dynamic Island paused",
1409                                    );
1410                                    let _: bool = native_feedback.set("Dynamic Island session ended".to_string());
1411                                }
1412                            }
1413                        }
1414                        EuvButton {
1415                            label: "Register euv:// Protocol".to_string()
1416                            tokens: tokens
1417                            secondary()
1418                            on_click: move |_: &UiEvent| {
1419                                let mut reg: ProtocolRegistry = ProtocolRegistry::new();
1420                                let spec: ProtocolRegistration = ProtocolRegistration::new(
1421                                    "euv".to_string(),
1422                                    "euv Native Showcase".to_string(),
1423                                    SHOWCASE_BUNDLE_ID.to_string(),
1424                                );
1425                                let native_ok: bool =
1426                                dispatch_native_action(NATIVE_ACTION_PROTOCOL, "euv", SHOWCASE_BUNDLE_ID);
1427                                if let Ok(desc) = reg.register(spec, platform) {
1428                                    let tag: &str = if native_ok { "OS Bridged" } else { "Verified" };
1429                                    let msg: String = format!("Registered euv:// via {} ({tag})", desc.get_mechanism());
1430                                    let _: bool = proto_status.set_if_changed(msg.clone());
1431                                    let _: bool = native_feedback.set(msg);
1432                                }
1433                            }
1434                        }
1435                        EuvButton {
1436                            label: "Request Camera Permission".to_string()
1437                            tokens: tokens
1438                            outline()
1439                            on_click: move |_: &UiEvent| {
1440                                let mut mgr: PermissionManager = PermissionManager::new();
1441                                let desc: PermissionDescriptor = mgr.request(
1442                                    SystemPermission::Camera,
1443                                    "Native camera preview".to_string(),
1444                                    platform,
1445                                );
1446                                let msg: String = format!("{:?} ({})", desc.get_status(), desc.get_native_key());
1447                                let _: bool = cam_status.set_if_changed(msg.clone());
1448                                let _: bool = native_feedback.set(format!("Permission requested: {msg}"));
1449                            }
1450                        }
1451                        EuvButton {
1452                            label: "Announce A11y + Haptic".to_string()
1453                            tokens: tokens
1454                            outline()
1455                            on_click: move |_: &UiEvent| {
1456                                let mut svc: PlatformServiceHub = PlatformServiceHub::new(platform);
1457                                let fired: bool = svc.trigger_haptic(HapticStyle::Medium);
1458                                svc.announce_a11y(
1459                                    "euv native accessibility pulse".to_string(),
1460                                    A11yLiveRegion::Polite,
1461                                );
1462                                let _: bool = a11y_count.update(|v: &mut u32| *v += 1);
1463                                let _: bool = haptic_count.update(|v: &mut u32| *v += 1);
1464                                let _: bool = native_feedback.set(format!(
1465                                    "Dispatched Haptic pulse (ok={fired}) + A11y announcement #{}",
1466                                    a11y_count.get_untracked()
1467                                ));
1468                            }
1469                        }
1470                    }
1471                    EuvSwitch {
1472                        checked: fs_sig
1473                        label: SWITCH_FULLSCREEN.to_string()
1474                        tokens: tokens
1475                    }
1476                    EuvCodeBlock {
1477                        code: CODE_WINDOW_SNIPPET.to_string()
1478                        tokens: tokens
1479                    }
1480                }
1481            }
1482            EuvCard {
1483                title: "Cross-Platform Frame Rate Limiter".to_string()
1484                tokens: tokens
1485                node_ref: fps_card_id
1486                subtitle: "Prioritizes native hardware refresh rate (120Hz/144Hz/180Hz+) across Desktop, Web, Android & iOS"
1487                EuvSegmented {
1488                    options: vec![
1489                        "Native Auto".to_string(),
1490                        "30 FPS".to_string(),
1491                        "60 FPS".to_string(),
1492                        "120 FPS".to_string(),
1493                        "144 FPS".to_string(),
1494                        "240 FPS".to_string(),
1495                    ]
1496                    selected: fps_idx
1497                    tokens: tokens
1498                }
1499                text {
1500                    font_size: 13.0
1501                    font_weight: FontWeight::SemiBold
1502                    color: p.get_primary()
1503                    { move || {
1504                        let native_hz: f32 = native_hz_sig.get();
1505                        let cap_txt: String = match fps_limit_sig.get() {
1506                            None => format!("Native Auto ({native_hz:.0} Hz)"),
1507                            Some(v) => format!("Capped at {v} FPS"),
1508                        };
1509                        format!(
1510                            "Frame Rate Policy: {cap_txt} | Live Measured: {:.1} FPS",
1511                            live_fps_sig.get()
1512                        )
1513                    } }
1514                }
1515            }
1516            EuvCard {
1517                title: "Cross-Platform Dynamic Island & Notifications".to_string()
1518                tokens: tokens
1519                subtitle: "Test Live Activities across all 7 platforms and dispatch native OS notifications"
1520                EuvSegmented {
1521                    options: vec![
1522                        "iOS".to_string(),
1523                        "iPadOS".to_string(),
1524                        LABEL_PLATFORM_ANDROID.to_string(),
1525                        LABEL_PLATFORM_MACOS.to_string(),
1526                        "Windows".to_string(),
1527                        "Linux".to_string(),
1528                        "Web".to_string(),
1529                    ]
1530                    selected: target_plat_idx
1531                    tokens: tokens
1532                }
1533                EuvSegmented {
1534                    options: vec![
1535                        "Compact".to_string(),
1536                        "Minimal".to_string(),
1537                        "Expanded".to_string(),
1538                        "LockScreen".to_string(),
1539                        "FallbackNotif".to_string(),
1540                        "StatusBar".to_string(),
1541                    ]
1542                    selected: island_mode_idx
1543                    tokens: tokens
1544                }
1545                column {
1546                    width: Length::Percent(100.0)
1547                    padding: Edges::all(SPACE_MD)
1548                    gap: SPACE_XS
1549                    background: Color::hex(0x09090B)
1550                    radius: 20.0
1551                    text {
1552                        font_size: 12.0
1553                        font_weight: FontWeight::SemiBold
1554                        color: Color::hex(0xF8FAFC)
1555                        { move || {
1556                            let tp: PlatformKind = all_platforms[target_plat_idx.get() % 7];
1557                            let im: IslandPresentationMode = all_island_modes[island_mode_idx.get() % 6];
1558                            let def_im: IslandPresentationMode = PlatformServiceHub::default_island_mode(tp);
1559                            let active: bool = island_active.get();
1560                            let pct: u8 = island_progress.get();
1561                            let state_tag: &str = if active { "LIVE" } else { "IDLE" };
1562                            format!(
1563                                "[{state_tag}] Dynamic Island ({tp:?}) | Mode: {im:?} (OS Default: {def_im:?}) | Progress: {pct}%"
1564                            )
1565                        } }
1566                    }
1567                }
1568                EuvActionRow {
1569                    EuvButton {
1570                        label: "Trigger Alert Notification".to_string()
1571                        tokens: tokens
1572                        sm()
1573                        on_click: move |_: &UiEvent| {
1574                            let tp: PlatformKind = all_platforms[target_plat_idx.get_untracked() % 7];
1575                            let mut svc: PlatformServiceHub = PlatformServiceHub::new(tp);
1576                            let n: SystemNotification = SystemNotification::new(
1577                                "euv-alert".to_string(),
1578                                format!("{tp:?} Alert Notification"),
1579                                "High-priority native OS alert dispatched cleanly".to_string(),
1580                            );
1581                            svc.send_notification(n.clone());
1582                            let _: bool = sys_notifs.update(|v: &mut Vec<(String, String)>| {
1583                                v.insert(0, (n.get_title().clone(), n.get_body().clone()));
1584                                v.truncate(5);
1585                            });
1586                        }
1587                    }
1588                    EuvButton {
1589                        label: "Trigger Silent + Badge(3)".to_string()
1590                        tokens: tokens
1591                        secondary()
1592                        sm()
1593                        on_click: move |_: &UiEvent| {
1594                            let tp: PlatformKind = all_platforms[target_plat_idx.get_untracked() % 7];
1595                            let mut svc: PlatformServiceHub = PlatformServiceHub::new(tp);
1596                            let mut n: SystemNotification = SystemNotification::new(
1597                                "euv-sync".to_string(),
1598                                format!("{tp:?} Silent Sync (Badge 3)"),
1599                                "Background OTA sync completed silently".to_string(),
1600                            );
1601                            n.set_silent(true);
1602                            n.set_badge_count(Some(3));
1603                            svc.send_notification(n.clone());
1604                            let _: bool = sys_notifs.update(|v: &mut Vec<(String, String)>| {
1605                                v.insert(0, (n.get_title().clone(), n.get_body().clone()));
1606                                v.truncate(5);
1607                            });
1608                        }
1609                    }
1610                    EuvButton {
1611                        label: "Clear Notifications".to_string()
1612                        tokens: tokens
1613                        outline()
1614                        sm()
1615                        on_click: move |_: &UiEvent| {
1616                            let _: bool = sys_notifs.set_if_changed(Vec::new());
1617                        }
1618                    }
1619                }
1620                EuvSonner {
1621                    messages: sys_notifs
1622                    tokens: tokens
1623                }
1624            }
1625            EuvCard {
1626                title: "Complete 14-Category OS Permissions Matrix".to_string()
1627                tokens: tokens
1628                subtitle: "Inspect per-platform native entitlement keys and test Grant / Deny flows"
1629                column {
1630                    width: Length::Percent(100.0)
1631                    gap: SPACE_XS
1632                    bind_children: move || {
1633                        let tp: PlatformKind = all_platforms[target_plat_idx.get() % 7];
1634                        let statuses: Vec<PermissionStatus> = perm_statuses.get();
1635                        let g: ThemeGeometry = tokens.get_geometry();
1636                        all_perms
1637                        .iter()
1638                        .copied()
1639                        .enumerate()
1640                        .map(|(idx, perm): (usize, SystemPermission)| {
1641                            let st: PermissionStatus = statuses
1642                            .get(idx)
1643                            .copied()
1644                            .unwrap_or(PermissionStatus::NotDetermined);
1645                            let native_key: &'static str = perm.native_key(tp);
1646                            view! {
1647                                column {
1648                                    width: Length::Percent(100.0)
1649                                    padding: Edges::symmetric(SPACE_SM, SPACE_SM)
1650                                    gap: SPACE_XS
1651                                    background: p.get_card()
1652                                    border: (g.get_border_width(), p.get_border())
1653                                    radius: g.get_radius_sm()
1654                                    text {
1655                                        width: Length::Percent(100.0)
1656                                        font_size: 12.0
1657                                        color: p.get_foreground()
1658                                        { format!("{perm:?} [{st:?}] · {native_key}") }
1659                                    }
1660                                    EuvActionRow {
1661                                        EuvButton {
1662                                            label: "Request".to_string()
1663                                            tokens: tokens
1664                                            outline()
1665                                            sm()
1666                                            on_click: move |_: &UiEvent| {
1667                                                let mut mgr: PermissionManager = PermissionManager::new();
1668                                                let desc: PermissionDescriptor =
1669                                                mgr.request(perm, format!("Test {perm:?} access"), platform);
1670                                                let _: bool = perm_statuses.update(|vec: &mut Vec<PermissionStatus>| {
1671                                                    if let Some(slot) = vec.get_mut(idx) {
1672                                                        *slot = desc.get_status();
1673                                                    }
1674                                                });
1675                                                let _: bool = native_feedback.set(format!(
1676                                                    "Requested {perm:?} ({}) -> {:?}",
1677                                                    perm.native_key(platform),
1678                                                    desc.get_status()
1679                                                ));
1680                                            }
1681                                        }
1682                                        EuvButton {
1683                                            label: "Deny".to_string()
1684                                            tokens: tokens
1685                                            destructive()
1686                                            sm()
1687                                            on_click: move |_: &UiEvent| {
1688                                                let _: bool = perm_statuses.update(|vec: &mut Vec<PermissionStatus>| {
1689                                                    if let Some(slot) = vec.get_mut(idx) {
1690                                                        *slot = PermissionStatus::Denied;
1691                                                    }
1692                                                });
1693                                                let _: bool = native_feedback.set(format!("Marked {perm:?} as Denied"));
1694                                            }
1695                                        }
1696                                    }
1697                                }
1698                            }
1699                        })
1700                        .collect()
1701                    }
1702                }
1703            }
1704        }
1705    };
1706    ctx_win.get_scene().with_write(
1707        |tree: &mut SceneTree| {
1708            tree.attach_scope(body_id, fs_scope);
1709            tree.attach_scope(fps_card_id, fps_scope);
1710        },
1711        (),
1712    );
1713    page
1714}
1715
1716/// Mounts the complete shadcn/ui component showcase and production edge-case regression lab.
1717///
1718/// # Arguments
1719///
1720/// - `&ShowcaseState` - Reactive showcase state.
1721/// - `ThemeTokens` - Active design tokens.
1722///
1723/// # Returns
1724///
1725/// - `NodeId` - Mounted UI & Edge Lab page node.
1726pub fn mount_lab_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
1727    let p: ThemePalette = tokens.get_palette();
1728    let g: ThemeGeometry = tokens.get_geometry();
1729    let ctx: Context = current_context();
1730    let chart_data: Vec<EuvChartPoint> = vec![
1731        EuvChartPoint::new("Mon".to_string(), 60.0),
1732        EuvChartPoint::new("Tue".to_string(), 88.0),
1733        EuvChartPoint::new("Wed".to_string(), 118.0),
1734        EuvChartPoint::new("Thu".to_string(), 104.0),
1735        EuvChartPoint::new("Fri".to_string(), 120.0),
1736        EuvChartPoint::new("Sat".to_string(), 116.0),
1737    ];
1738    let left_split: NodeId = view! {
1739        text {
1740            font_size: 13.0
1741            color: p.get_foreground()
1742            "Left Split Pane (Drag handle ->)"
1743        }
1744    };
1745    let right_split: NodeId = view! {
1746        text {
1747            font_size: 13.0
1748            color: p.get_muted_foreground()
1749            "Right Split Pane (Zero rebuild on drag)"
1750        }
1751    };
1752    let rtl_sig: Signal<bool> = state.get_lab_rtl_mode();
1753    let block_scroll: Signal<bool> = state.get_lab_block_scroll_chain();
1754    let stop_bubble: Signal<bool> = state.get_lab_stop_click_bubble();
1755    let parent_clicks: Signal<u32> = state.get_lab_parent_clicks();
1756    let child_clicks: Signal<u32> = state.get_lab_child_clicks();
1757    let preserve_cnt: Signal<u32> = state.get_lab_resize_preserve_count();
1758    let modal_open: Signal<bool> = state.get_modal_open();
1759    let drawer_open: Signal<bool> = state.get_drawer_open();
1760    let attach_vis: Signal<bool> = Signal::new(true);
1761    let q_sel: Signal<Option<usize>> = Signal::new(Some(0));
1762    let touches_sig: Signal<Vec<(u64, Point)>> = ctx.get_active_touches();
1763    let pad_bounds_cell: Rc<Cell<Rect>> = Rc::new(Cell::new(Rect::default()));
1764    let pad_bounds_memo: Rc<Cell<Rect>> = Rc::clone(&pad_bounds_cell);
1765    let pad_bounds_paint: Rc<Cell<Rect>> = Rc::clone(&pad_bounds_cell);
1766    let touch_ids_memo: Memo<Vec<u64>> = Memo::new(move || {
1767        let pad_rect: Rect = pad_bounds_memo.get();
1768        if pad_rect.get_width() <= 0.0 || pad_rect.get_height() <= 0.0 {
1769            return Vec::new();
1770        }
1771        touches_sig
1772            .get()
1773            .into_iter()
1774            .filter(|(_, pt): &(u64, Point)| pad_rect.contains(*pt))
1775            .map(|(id, _): (u64, Point)| id)
1776            .collect()
1777    });
1778    let ai_tick: Signal<u32> = Signal::new(0);
1779    let ai_fps_sig: Signal<f32> = ctx.get_live_fps();
1780    let ai_route_sig: Signal<String> = state.get_route();
1781    let ai_scheme_sig: Signal<DesignScheme> = state.get_theme().get_scheme();
1782    let mut touch_pad_id: NodeId = NodeId::default();
1783    let page: NodeId = view! {
1784        EuvPage {
1785            title: "UI & Edge-Case Lab".to_string()
1786            subtitle: "Full shadcn/ui component parity + multi-touch, propagation, overlay stack, AI Schema v1, and resize-preservation tests".to_string()
1787            tokens: tokens
1788            EuvCard {
1789                title: "Multi-Touch & Gesture Isolation Pad".to_string()
1790                tokens: tokens
1791                subtitle: "Simultaneous multi-finger tracking with pointer IDs, pinch distance line, and gesture non-penetration"
1792                row {
1793                    width: Length::Percent(100.0)
1794                    height: Length::Px(22.0)
1795                    align: AlignItems::Center
1796                    overflow: Overflow::Hidden
1797                    text {
1798                        width: Length::Percent(100.0)
1799                        font_size: 12.5
1800                        font_weight: FontWeight::Medium
1801                        color: p.get_primary()
1802                        overflow: Overflow::Hidden
1803                        text_overflow: TextOverflow::Ellipsis
1804                        { move || {
1805                            let ids: Vec<u64> = touch_ids_memo.get();
1806                            if ids.is_empty() {
1807                                TOUCH_PAD_READY_TEXT.to_string()
1808                            } else {
1809                                let labels: String = ids
1810                                .iter()
1811                                .map(|id: &u64| format!("#{id}"))
1812                                .collect::<Vec<String>>()
1813                                .join(" ");
1814                                format!("Inside Pad: {} | Pointers: {labels}", ids.len())
1815                            }
1816                        } }
1817                    }
1818                }
1819                canvas {
1820                    node_ref: touch_pad_id
1821                    width: Length::Percent(100.0)
1822                    height: Length::Px(170.0)
1823                    background: p.get_muted()
1824                    border: (g.get_border_width(), p.get_border())
1825                    radius: g.get_radius_md()
1826                    stop_scroll_propagation: true
1827                    stop_event_propagation: true
1828                    painter: move |bounds: Rect, dl: &mut DisplayList| {
1829                        pad_bounds_paint.set(bounds);
1830                        let pts: Vec<(u64, Point)> = touches_sig.get_untracked();
1831                        let palette: [Color; 5] = [
1832                            Color::hex(0x2563EB),
1833                            Color::hex(0x16A34A),
1834                            Color::hex(0xEA580C),
1835                            Color::hex(0x9333EA),
1836                            Color::hex(0xDC2626),
1837                        ];
1838                        let inside_pts: Vec<(u64, Point)> = pts
1839                        .into_iter()
1840                        .filter(|(_, pt): &(u64, Point)| bounds.contains(*pt))
1841                        .collect();
1842                        if inside_pts.is_empty() {
1843                            let mut hint_style: TextStyle = TextStyle::default();
1844                            hint_style
1845                            .set_font_size(12.0)
1846                            .set_color(p.get_muted_foreground())
1847                            .set_align(TextAlign::Center);
1848                            dl.push(DrawCommand::TextRun {
1849                                rect: Rect::new(
1850                                    bounds.get_x() + 12.0,
1851                                    bounds.get_y() + (bounds.get_height() - 18.0) * 0.5,
1852                                    (bounds.get_width() - 24.0).max(1.0),
1853                                    20.0,
1854                                ),
1855                                text: TOUCH_PAD_CANVAS_HINT.to_string(),
1856                                style: hint_style,
1857                            });
1858                            return;
1859                        }
1860                        if inside_pts.len() >= 2 {
1861                            for pair in inside_pts.windows(2) {
1862                                dl.push(DrawCommand::Line {
1863                                    from: pair[0].1,
1864                                    to: pair[1].1,
1865                                    color: p.get_primary().multiply_alpha(0.75),
1866                                    width: 2.0,
1867                                });
1868                            }
1869                        }
1870                        for (idx, (pid, pt)) in inside_pts.iter().enumerate() {
1871                            let col: Color = palette[idx % palette.len()];
1872                            dl.push(DrawCommand::Circle {
1873                                center: *pt,
1874                                radius: 26.0,
1875                                color: col.multiply_alpha(0.24),
1876                            });
1877                            dl.push(DrawCommand::Circle {
1878                                center: *pt,
1879                                radius: 10.0,
1880                                color: col,
1881                            });
1882                            let mut tag_style: TextStyle = TextStyle::default();
1883                            tag_style
1884                            .set_font_size(11.0)
1885                            .set_weight(FontWeight::Bold)
1886                            .set_color(col);
1887                            dl.push(DrawCommand::TextRun {
1888                                rect: Rect::new(pt.get_x() + 14.0, pt.get_y() - 24.0, 96.0, 16.0),
1889                                text: format!("#{pid}({:.0},{:.0})", pt.get_x(), pt.get_y()),
1890                                style: tag_style,
1891                            });
1892                        }
1893                        let mut hud_style: TextStyle = TextStyle::default();
1894                        hud_style
1895                        .set_font_size(11.5)
1896                        .set_weight(FontWeight::Medium)
1897                        .set_color(p.get_foreground());
1898                        dl.push(DrawCommand::TextRun {
1899                            rect: Rect::new(
1900                                bounds.get_x() + 10.0,
1901                                bounds.get_y() + 8.0,
1902                                (bounds.get_width() - 20.0).max(1.0),
1903                                18.0,
1904                            ),
1905                            text: format!("Live Contacts Inside Pad: {}", inside_pts.len()),
1906                            style: hud_style,
1907                        });
1908                    }
1909                }
1910            }
1911            EuvCard {
1912                title: "AI Schema v1 & Reactive Telemetry Bridge".to_string()
1913                tokens: tokens
1914                subtitle: "Live introspection of SceneTree bounds, A11y tree, reactive graph, FPS, and interactive agent actions"
1915                text {
1916                    width: Length::Percent(100.0)
1917                    font_size: 12.5
1918                    color: p.get_foreground()
1919                    { move || {
1920                        let _: u32 = ai_tick.get();
1921                        let rs: ReactiveStats = reactive_stats();
1922                        #[cfg(debug_assertions)]
1923                        let proto_label: &str = AI_SCHEMA_PROTOCOL_VERSION;
1924                        #[cfg(not(debug_assertions))]
1925                        let proto_label: &str = AI_SCHEMA_RELEASE_STRIPPED;
1926                        let bridge_label: &str = if DevAutomationBridge::is_enabled() {
1927                            AI_BRIDGE_STATUS_ACTIVE
1928                        } else {
1929                            AI_BRIDGE_STATUS_OFF
1930                        };
1931                        format!(
1932                            "Protocol: {} ({}) | Route: {} | Scheme: {} | Live FPS: {:.1} | Signals: {} | Memos: {} | Effects: {} | Scopes: {} | Clock: {}",
1933                            proto_label,
1934                            bridge_label,
1935                            ai_route_sig.get(),
1936                            ai_scheme_sig.get().as_str(),
1937                            ai_fps_sig.get(),
1938                            rs.get_live_signals(),
1939                            rs.get_live_memos(),
1940                            rs.get_live_effects(),
1941                            rs.get_live_scopes(),
1942                            rs.get_clock()
1943                        )
1944                    } }
1945                }
1946                EuvActionRow {
1947                    EuvButton {
1948                        label: "Refresh AI Telemetry".to_string()
1949                        tokens: tokens
1950                        outline()
1951                        sm()
1952                        on_click: move |_: &UiEvent| {
1953                            let _: bool = ai_tick.update(|v: &mut u32| *v = v.wrapping_add(1));
1954                        }
1955                    }
1956                }
1957                EuvCodeBlock {
1958                    code: "GET /ai/schema | /ai/snapshot | /ai/a11y | /ai/health\nPOST /ai/query | /ai/action | /ai/script (dev-only; 0B in release)".to_string()
1959                    tokens: tokens
1960                }
1961            }
1962            EuvCard {
1963                title: "Complete shadcn/ui Component Parity".to_string()
1964                tokens: tokens
1965                subtitle: "Trace, Attachment, Bubble, Marker, Questionnaire, Chart, Combobox, DataTable, DatePicker, InputGroup, Item, NativeSelect, NavigationMenu, Resizable, Separator, Direction, Avatar, Kbd, Spinner, Skeleton, Breadcrumb, Empty"
1966                row {
1967                    style: c_action_row()
1968                    EuvMarker {
1969                        code: "01".to_string()
1970                        label: "Zero WebView".to_string()
1971                        tone: EuvTone::Primary
1972                        tokens: tokens
1973                    }
1974                    EuvMarker {
1975                        code: "02".to_string()
1976                        label: "120+ FPS".to_string()
1977                        tone: EuvTone::Success
1978                        tokens: tokens
1979                    }
1980                    EuvMarker {
1981                        code: "03".to_string()
1982                        label: "Multi-Touch".to_string()
1983                        tone: EuvTone::Warning
1984                        tokens: tokens
1985                    }
1986                    EuvAvatar {
1987                        initials: "EU".to_string()
1988                        size: 32.0
1989                        tokens: tokens
1990                    }
1991                    EuvKbd {
1992                        key: "Cmd+K".to_string()
1993                        tokens: tokens
1994                    }
1995                    EuvSpinner {
1996                        size: 18.0
1997                        tokens: tokens
1998                    }
1999                }
2000                EuvTrace {
2001                    title: "Frame Pipeline Trace (1.42ms Total)".to_string()
2002                    spans: vec![
2003                        EuvTraceSpan::new("layout.compute".to_string(), 0.14, 0.0, 0.12, EuvTone::Primary),
2004                        EuvTraceSpan::new("bvh.raytrace_gi".to_string(), 0.88, 0.12, 0.60, EuvTone::Success),
2005                        EuvTraceSpan::new("fxaa.tonemap".to_string(), 0.24, 0.72, 0.16, EuvTone::Warning),
2006                        EuvTraceSpan::new("present.blit".to_string(), 0.16, 0.88, 0.12, EuvTone::Neutral),
2007                    ]
2008                    tokens: tokens
2009                }
2010                EuvAttachment {
2011                    filename: "vice-boulevard-rt.wasm".to_string()
2012                    meta: "48.2 KB · application/wasm · SHA-verified".to_string()
2013                    visible: attach_vis
2014                    tokens: tokens
2015                }
2016                EuvBubble {
2017                    author: "Euv Runtime".to_string()
2018                    content: "All 60+ shadcn/ui components rendered directly via Rust SceneTree with zero WebView.".to_string()
2019                    tokens: tokens
2020                    timestamp: "09:41"
2021                }
2022                EuvBubble {
2023                    author: "Developer".to_string()
2024                    content: "Verify multi-touch, text wrapping, blinking input caret & uncapped FPS live!".to_string()
2025                    tokens: tokens
2026                    timestamp: "09:42"
2027                    outgoing: true
2028                }
2029                EuvQuestionnaire {
2030                    prompt: "Preferred native target deployment pipeline?".to_string()
2031                    options: vec![
2032                        "Universal Native (Android + iOS + Desktop + Web)".to_string(),
2033                        "Dynamic OTA .wasm Hot-Swap Modules".to_string(),
2034                        "Embedded 3D Ray-Traced Engine Viewport".to_string(),
2035                    ]
2036                    selected: q_sel
2037                    tokens: tokens
2038                }
2039                EuvNavigationMenu {
2040                    items: vec![
2041                        (
2042                            "Architecture".to_string(),
2043                            "Arena signals + deterministic Flexbox/Grid + retained scene graph.".to_string(),
2044                        ),
2045                        (
2046                            "3D Engine".to_string(),
2047                            "PBR metallic-roughness + BVH ray-traced shadows/reflections + FXAA.".to_string(),
2048                        ),
2049                        (
2050                            "Media Suite".to_string(),
2051                            "Pure-Rust Image, SVG, GIF, LIVE Photo, Video, WAV Audio, PDF, HTML.".to_string(),
2052                        ),
2053                    ]
2054                    active: state.get_lab_nav_menu_active()
2055                    tokens: tokens
2056                }
2057                EuvChart {
2058                    title: "Frame Rate Telemetry (Bar)".to_string()
2059                    kind: EuvChartKind::Bar
2060                    data: chart_data.clone()
2061                    tokens: tokens
2062                }
2063                EuvChart {
2064                    title: "3D Ray-Tracing Throughput (Area)".to_string()
2065                    kind: EuvChartKind::Area
2066                    data: chart_data
2067                    tokens: tokens
2068                }
2069                EuvCombobox {
2070                    options: vec![
2071                        "euv Native Rust".to_string(),
2072                        "WebAssembly Zero-JS".to_string(),
2073                        "Android ARM64 JNI".to_string(),
2074                        "iOS CoreText Metal".to_string(),
2075                        "macOS AppKit Retina".to_string(),
2076                    ]
2077                    selected: state.get_lab_combobox_selected()
2078                    open: state.get_lab_combobox_open()
2079                    tokens: tokens
2080                    query: state.get_lab_combobox_query()
2081                    placeholder: "Filter frameworks..."
2082                }
2083                EuvDatePicker {
2084                    month_label: LABEL_CALENDAR_MONTH.to_string()
2085                    selected_day: state.get_lab_date_day()
2086                    open: state.get_lab_date_open()
2087                    tokens: tokens
2088                }
2089                EuvInputGroup {
2090                    value: state.get_lab_input_group_val()
2091                    tokens: tokens
2092                    prefix: "https://"
2093                    placeholder: "subdomain"
2094                    suffix: ".euv.dev"
2095                }
2096                EuvNativeSelect {
2097                    options: vec![
2098                        "60 Hz Standard".to_string(),
2099                        "120 Hz ProMotion".to_string(),
2100                        "Unlocked Benchmark".to_string(),
2101                    ]
2102                    selected: state.get_lab_native_select_idx()
2103                    tokens: tokens
2104                }
2105                EuvDataTable {
2106                    headers: vec!["Target".to_string(), "Font Engine".to_string(), "Status".to_string()]
2107                    rows: vec![
2108                        vec![LABEL_PLATFORM_ANDROID.to_string(), "Skia Paint AA".to_string(), "1:1 DPI".to_string()],
2109                        vec!["iOS / iPadOS".to_string(), "CoreText @3x".to_string(), "ProMotion".to_string()],
2110                        vec![LABEL_PLATFORM_MACOS.to_string(), "CoreText Retina".to_string(), "Live Resize".to_string()],
2111                        vec!["WebAssembly".to_string(), "Canvas2D AA".to_string(), "Zero-JS".to_string()],
2112                    ]
2113                    tokens: tokens
2114                    filter: state.get_lab_table_filter()
2115                    sort_ascending: state.get_lab_table_sort_asc()
2116                    selected_row: state.get_lab_table_selected()
2117                }
2118                EuvResizable {
2119                    left: left_split
2120                    right: right_split
2121                    split_ratio: state.get_lab_split_ratio()
2122                    tokens: tokens
2123                }
2124                EuvItem {
2125                    title: "Production shadcn/ui Alignment".to_string()
2126                    tokens: tokens
2127                    leading: "EU"
2128                    description: "Unified layout grammar across all 17 design schemes with per-theme surface/radius tokens"
2129                    trailing: LAB_ITEM_VER
2130                }
2131                column {
2132                    width: Length::Percent(100.0)
2133                    gap: SPACE_SM
2134                    EuvBreadcrumb {
2135                        segments: vec!["Euv Studio".to_string(), "Design System".to_string(), "Components".to_string()]
2136                        tokens: tokens
2137                        active: state.get_breadcrumb_active()
2138                    }
2139                    EuvTypography {
2140                        text: "Unified shadcn/ui Typography & Surface Tokens".to_string()
2141                        variant: EuvTypographyVariant::H3
2142                        tokens: tokens
2143                    }
2144                    EuvSkeleton {
2145                        width: 260.0
2146                        height: 18.0
2147                        tokens: tokens
2148                    }
2149                    EuvEmpty {
2150                        title: "No Pending Warnings".to_string()
2151                        description: "All layout, scroll, shadow and typography checks passed.".to_string()
2152                        tokens: tokens
2153                    }
2154                }
2155            }
2156            EuvCard {
2157                title: "Boundary & Event Penetration Regression Lab".to_string()
2158                tokens: tokens
2159                subtitle: "Verify scroll lock, flexible event bubbling, overlay back stack, RTL alignment, and zero-rebuild resize preservation"
2160                EuvSeparator {
2161                    label: "EDGE-CASE REGRESSION SUITE".to_string()
2162                    tokens: tokens
2163                }
2164                column {
2165                    width: Length::Percent(100.0)
2166                    bind_children: move || {
2167                        let dir: EuvTextDirection = if rtl_sig.get() {
2168                            EuvTextDirection::Rtl
2169                        } else {
2170                            EuvTextDirection::Ltr
2171                        };
2172                        vec![view! {
2173                            EuvDirection {
2174                                direction: dir
2175                                child: view! {
2176                                    text {
2177                                        font_size: 13.0
2178                                        color: p.get_foreground()
2179                                        { format!("Direction preview ({dir:?}): Unified layout alignment across LTR & RTL") }
2180                                    }
2181                                }
2182                                tokens: tokens
2183                            }
2184                        }]
2185                    }
2186                }
2187                column {
2188                    width: Length::Percent(100.0)
2189                    gap: SPACE_XS
2190                    EuvSwitch {
2191                        checked: block_scroll
2192                        label: "Lock Scroll Penetration".to_string()
2193                        tokens: tokens
2194                    }
2195                    EuvSwitch {
2196                        checked: stop_bubble
2197                        label: "Stop Click Bubbling".to_string()
2198                        tokens: tokens
2199                    }
2200                    EuvSwitch {
2201                        checked: rtl_sig
2202                        label: "RTL Direction".to_string()
2203                        tokens: tokens
2204                    }
2205                }
2206                EuvActionRow {
2207                    EuvButton {
2208                        label: "Increment Preserved Counter".to_string()
2209                        tokens: tokens
2210                        sm()
2211                        on_click: move |_: &UiEvent| {
2212                            let _: bool = preserve_cnt.update(|v: &mut u32| *v += 1);
2213                        }
2214                    }
2215                    EuvButton {
2216                        label: "Open Stacked Modal + Drawer".to_string()
2217                        tokens: tokens
2218                        secondary()
2219                        sm()
2220                        on_click: move |_: &UiEvent| {
2221                            let _: bool = modal_open.set_if_changed(true);
2222                            let _: bool = drawer_open.set_if_changed(true);
2223                        }
2224                    }
2225                    EuvButton {
2226                        label: "Dismiss Top Overlay (Back)".to_string()
2227                        tokens: tokens
2228                        outline()
2229                        sm()
2230                        on_click: move |_: &UiEvent| {
2231                            let _: bool = EuvOverlayStack::dismiss_top();
2232                        }
2233                    }
2234                }
2235                text {
2236                    font_size: 12.0
2237                    color: p.get_muted_foreground()
2238                    { move || format!(
2239                        "Inner Clicks: {} | Outer Parent Clicks: {} | Resize-Preserved Counter: {} | Overlay Stack Depth: {}",
2240                        child_clicks.get(),
2241                        parent_clicks.get(),
2242                        preserve_cnt.get(),
2243                        EuvOverlayStack::active_count()
2244                    ) }
2245                }
2246                column {
2247                    width: Length::Percent(100.0)
2248                    bind_children: move || {
2249                        let locked: bool = block_scroll.get();
2250                        let stop_clk: bool = stop_bubble.get();
2251                        vec![view! {
2252                            column {
2253                                width: Length::Percent(100.0)
2254                                padding: Edges::all(SPACE_MD)
2255                                gap: SPACE_SM
2256                                background: p.get_muted()
2257                                border: (g.get_border_width(), p.get_border())
2258                                radius: g.get_radius_md()
2259                                on_click: move |_: &UiEvent| {
2260                                    let _: bool = parent_clicks.update(|v: &mut u32| *v += 1);
2261                                }
2262                                scroll {
2263                                    width: Length::Percent(100.0)
2264                                    height: Length::Px(110.0)
2265                                    padding: Edges::all(SPACE_SM)
2266                                    gap: SPACE_XS
2267                                    background: p.get_card()
2268                                    border: (g.get_border_width(), p.get_border())
2269                                    radius: g.get_radius_sm()
2270                                    stop_scroll_propagation: locked
2271                                    stop_event_propagation: stop_clk
2272                                    for row_i in 1..=8 {
2273                                        text {
2274                                            font_size: 12.0
2275                                            color: p.get_foreground()
2276                                            { format!("Nested Scroll Row #{row_i} (scroll_lock={locked}, stop_bubble={stop_clk})") }
2277                                        }
2278                                    }
2279                                }
2280                                EuvActionRow {
2281                                    EuvButton {
2282                                        label: "Click Inner Target".to_string()
2283                                        tokens: tokens
2284                                        secondary()
2285                                        sm()
2286                                        on_click: move |_: &UiEvent| {
2287                                            let _: bool = child_clicks.update(|v: &mut u32| *v += 1);
2288                                        }
2289                                    }
2290                                }
2291                            }
2292                        }]
2293                    }
2294                }
2295            }
2296        }
2297    };
2298    let touch_handle: SceneHandle = ctx.get_scene().clone();
2299    let (touch_scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
2300        Effect::new(move || {
2301            let _: Vec<(u64, Point)> = touches_sig.get();
2302            touch_handle.mark_dirty(touch_pad_id, DIRTY_PAINT);
2303        })
2304    });
2305    ctx.get_scene().with_write(
2306        |tree: &mut SceneTree| {
2307            tree.attach_scope(touch_pad_id, touch_scope);
2308        },
2309        (),
2310    );
2311    page
2312}
2313
2314/// Mounts the comprehensive interactive forms showcase covering inputs, steppers, radios, sliders, ratings, toggles, switches, and checkboxes.
2315///
2316/// # Arguments
2317///
2318/// - `&ShowcaseState` - Reactive showcase state.
2319/// - `ThemeTokens` - Active design tokens.
2320///
2321/// # Returns
2322///
2323/// - `NodeId` - Mounted forms page node.
2324pub fn mount_forms_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
2325    let p: ThemePalette = tokens.get_palette();
2326    let username: Signal<String> = state.get_username();
2327    let stepper: Signal<i64> = state.get_stepper_value();
2328    let rating: Signal<usize> = state.get_rating_value();
2329    let cal_day: Signal<u32> = state.get_calendar_day();
2330    let picker_color: Signal<Color> = state.get_picker_color();
2331    let picker_time: Signal<(u8, u8)> = state.get_picker_time();
2332    let tag_items: Signal<Vec<String>> = state.get_tag_items();
2333    let input_node: NodeId = view! {
2334        EuvInput {
2335            value: username
2336            placeholder: PLACEHOLDER_USERNAME.to_string()
2337            tokens: tokens
2338        }
2339    };
2340    let collapsible_body: NodeId = view! {
2341        text {
2342            font_size: 13.0
2343            color: p.get_muted_foreground()
2344            "shadcn/ui Collapsible disclosure panel adapts across Mobile, Tablet, and Desktop."
2345        }
2346    };
2347    view! {
2348        EuvPage {
2349            title: FORMS_TITLE.to_string()
2350            subtitle: FORMS_SUBTITLE.to_string()
2351            tokens: tokens
2352            EuvCard {
2353                title: FORMS_CARD_TITLE.to_string()
2354                tokens: tokens
2355                subtitle: FORMS_CARD_SUB
2356                column {
2357                    gap: SPACE_MD
2358                    EuvTabs {
2359                        labels: vec![TAB_GENERAL.to_string(), TAB_GRAPHICS.to_string(), TAB_SECURITY.to_string()]
2360                        active: state.get_active_tab()
2361                        tokens: tokens
2362                    }
2363                    EuvField {
2364                        label: FIELD_USERNAME.to_string()
2365                        control: input_node
2366                        tokens: tokens
2367                    }
2368                    EuvTextarea {
2369                        value: state.get_bio()
2370                        placeholder: "Write notes...".to_string()
2371                        height: 54.0
2372                        tokens: tokens
2373                    }
2374                    row {
2375                        style: c_action_row()
2376                        EuvNumberInput {
2377                            value: stepper
2378                            tokens: tokens
2379                            range(0, 20)
2380                            step: 1
2381                        }
2382                        EuvToggle {
2383                            pressed: state.get_pin_toggled()
2384                            label: "Pin Config".to_string()
2385                            tokens: tokens
2386                        }
2387                        EuvRating {
2388                            value: rating
2389                            max_stars: 5
2390                            tokens: tokens
2391                        }
2392                    }
2393                    EuvRadioGroup {
2394                        options: vec!["Software CPU".to_string(), "Hardware GPU".to_string(), "Hybrid".to_string()]
2395                        selected: state.get_radio_index()
2396                        tokens: tokens
2397                    }
2398                    EuvSlider {
2399                        value: state.get_slider_value()
2400                        min: 0.0
2401                        max: 100.0
2402                        tokens: tokens
2403                    }
2404                    EuvSelect {
2405                        options: vec!["Metal".to_string(), "Vulkan".to_string(), "Direct3D 12".to_string(), "WebGPU".to_string()]
2406                        selected: state.get_select_index()
2407                        open: state.get_select_open()
2408                        tokens: tokens
2409                    }
2410                    EuvSwitch {
2411                        checked: state.get_hardware_accel()
2412                        label: SWITCH_HW_LABEL.to_string()
2413                        tokens: tokens
2414                    }
2415                    EuvCheckbox {
2416                        checked: state.get_agree_terms()
2417                        label: CHECKBOX_TERMS_LABEL.to_string()
2418                        tokens: tokens
2419                    }
2420                    text {
2421                        font_size: 12.0
2422                        color: p.get_muted_foreground()
2423                        { move || format!("Handle: {} | Stepper: {} | Stars: {}/5 | Day: {}", username.get(), stepper.get(), rating.get(), cal_day.get()) }
2424                    }
2425                    EuvActionRow {
2426                        EuvButton {
2427                            label: BTN_PRIMARY_LABEL.to_string()
2428                            tokens: tokens
2429                        }
2430                        EuvButton {
2431                            label: BTN_SECONDARY_LABEL.to_string()
2432                            tokens: tokens
2433                            secondary() }
2434                        EuvButton {
2435                            label: BTN_OUTLINE_LABEL.to_string()
2436                            tokens: tokens
2437                            outline() }
2438                        EuvButton {
2439                            label: BTN_DESTRUCTIVE_LABEL.to_string()
2440                            tokens: tokens
2441                            destructive()
2442                            on_click: move |_: &UiEvent| {
2443                                let _: bool = username.set_if_changed(DEFAULT_USERNAME.to_string());
2444                            }
2445                        }
2446                    }
2447                }
2448            }
2449            EuvCard {
2450                title: "shadcn/ui Extended Form Controls".to_string()
2451                tokens: tokens
2452                subtitle: FORMS_EXT_CARD_SUB
2453                column {
2454                    gap: SPACE_MD
2455                    EuvToggleGroup {
2456                        options: vec!["Bold".to_string(), "Italic".to_string(), "Underline".to_string()]
2457                        selected: state.get_toggle_group_index()
2458                        tokens: tokens
2459                    }
2460                    EuvInputOtp {
2461                        value: state.get_otp_code()
2462                        length: 6
2463                        tokens: tokens
2464                    }
2465                    EuvColorPicker {
2466                        value: picker_color
2467                        tokens: tokens
2468                    }
2469                    EuvTimePicker {
2470                        value: picker_time
2471                        tokens: tokens
2472                    }
2473                    EuvTagInput {
2474                        tags: tag_items
2475                        tokens: tokens
2476                        placeholder: TAG_INPUT_PLACEHOLDER
2477                    }
2478                    text {
2479                        font_size: 12.0
2480                        color: p.get_muted_foreground()
2481                        { move || {
2482                            let c: Color = picker_color.get();
2483                            let (hh, mm): (u8, u8) = picker_time.get();
2484                            format!(
2485                                "Color: #{:02X}{:02X}{:02X} | Time: {:02}:{:02} | Tags: {}",
2486                                c.get_r(),
2487                                c.get_g(),
2488                                c.get_b(),
2489                                hh,
2490                                mm,
2491                                tag_items.get().len()
2492                            )
2493                        } }
2494                    }
2495                    EuvCalendar {
2496                        month_label: LABEL_CALENDAR_MONTH.to_string()
2497                        days_in_month: 30
2498                        selected_day: state.get_calendar_day()
2499                        tokens: tokens
2500                    }
2501                    EuvCollapsible {
2502                        open: state.get_collapsible_open()
2503                        title: "Advanced Form Details".to_string()
2504                        content: collapsible_body
2505                        tokens: tokens
2506                    }
2507                }
2508            }
2509        }
2510    }
2511}
2512
2513/// Mounts the 17-scheme live design token gallery where every scheme button switches the active app theme live.
2514///
2515/// # Arguments
2516///
2517/// - `&ShowcaseState` - Reactive showcase state.
2518/// - `ThemeTokens` - Active design tokens.
2519///
2520/// # Returns
2521///
2522/// - `NodeId` - Mounted themes page node.
2523pub fn mount_themes_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
2524    let p: ThemePalette = tokens.get_palette();
2525    let scheme_sig: Signal<DesignScheme> = state.get_theme().get_scheme();
2526    let mode_sig: Signal<ThemeMode> = state.get_theme().get_mode();
2527    let state_for_cycle: ShowcaseState = state.clone();
2528    let state_for_mode: ShowcaseState = state.clone();
2529    let scheme_cols: u16 = match use_breakpoint().get_untracked() {
2530        Breakpoint::Compact => 2,
2531        Breakpoint::Medium => 3,
2532        Breakpoint::Expanded => 4,
2533    };
2534    let all_schemes: [DesignScheme; 17] = DesignScheme::all();
2535    let cur_mode: ThemeMode = mode_sig.get_untracked();
2536    view! {
2537        EuvPage {
2538            title: THEMES_TITLE.to_string()
2539            subtitle: THEMES_SUBTITLE.to_string()
2540            tokens: tokens
2541            EuvCard {
2542                title: THEMES_CARD_TITLE.to_string()
2543                tokens: tokens
2544                subtitle: THEMES_CARD_SUB
2545                column {
2546                    gap: SPACE_MD
2547                    text {
2548                        font_size: 15.0
2549                        font_weight: FontWeight::SemiBold
2550                        color: p.get_foreground()
2551                        { move || format!("{PREFIX_ACTIVE_SCHEME}{} ({:?})", scheme_sig.get().as_str(), mode_sig.get()) }
2552                    }
2553                    EuvActionRow {
2554                        EuvButton {
2555                            label: BTN_NEXT_SCHEME.to_string()
2556                            tokens: tokens
2557                            on_click: move |_: &UiEvent| {
2558                                state_for_cycle.next_scheme();
2559                            }
2560                        }
2561                        EuvButton {
2562                            label: BTN_TOGGLE_MODE.to_string()
2563                            tokens: tokens
2564                            outline()
2565                            on_click: move |_: &UiEvent| {
2566                                state_for_mode.toggle_theme_mode();
2567                            }
2568                        }
2569                    }
2570                    grid {
2571                        style: c_scheme_grid()
2572                        columns: scheme_cols
2573                        for scheme in all_schemes.iter().copied() {
2574                            EuvButton {
2575                                label: scheme.as_str().to_string()
2576                                tokens: ThemeTokens::resolve(scheme, cur_mode)
2577                                sm()
2578                                on_click: move |_: &UiEvent| {
2579                                    let _: bool = scheme_sig.set_if_changed(scheme);
2580                                }
2581                            }
2582                        }
2583                    }
2584                }
2585            }
2586        }
2587    }
2588}
2589
2590/// Mounts the reactive 10,000-row virtualized scrollable list plus pagination, steps, accordion, and progress.
2591///
2592/// # Arguments
2593///
2594/// - `&ShowcaseState` - Reactive showcase state.
2595/// - `ThemeTokens` - Active design tokens.
2596///
2597/// # Returns
2598///
2599/// - `NodeId` - Mounted data display page node.
2600pub fn mount_data_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
2601    let p: ThemePalette = tokens.get_palette();
2602    let g: ThemeGeometry = tokens.get_geometry();
2603    let scroll_y: Signal<f32> = state.get_list_scroll_y();
2604    let vlist: EuvVirtualList =
2605        EuvVirtualList::new(10_000, 32.0, scroll_y, tokens).viewport_height(224.0);
2606    let vlist_down: EuvVirtualList = vlist.clone();
2607    let list_node: NodeId = vlist.mount_with(move |idx: usize| {
2608        view! {
2609            row {
2610                width: Length::Percent(100.0)
2611                height: Length::Px(32.0)
2612                padding: Edges::symmetric(SPACE_XS, SPACE_MD)
2613                align: AlignItems::Center
2614                border: (g.get_border_width(), p.get_border())
2615                text {
2616                    font_size: 13.0
2617                    color: p.get_foreground()
2618                    { format!("{ROW_PREFIX}{idx}") }
2619                }
2620            }
2621        }
2622    });
2623    let aspect_inner: NodeId = view! {
2624        column {
2625            align: AlignItems::Center
2626            gap: SPACE_XS
2627            text {
2628                font_size: 14.0
2629                font_weight: FontWeight::SemiBold
2630                color: p.get_foreground()
2631                "16:9 shadcn AspectRatio"
2632            }
2633            text {
2634                font_size: 12.0
2635                color: p.get_muted_foreground()
2636                "Responsive container locked to 16:9 ratio"
2637            }
2638        }
2639    };
2640    let tree_sel: Signal<Option<String>> = state.get_tree_selected();
2641    view! {
2642        EuvPage {
2643            title: DATA_TITLE.to_string()
2644            subtitle: DATA_SUBTITLE.to_string()
2645            tokens: tokens
2646            EuvCard {
2647                title: DATA_CARD_TITLE.to_string()
2648                tokens: tokens
2649                subtitle: DATA_CARD_SUB
2650                column {
2651                    gap: SPACE_MD
2652                    EuvMenubar {
2653                        menus: vec!["File".to_string(), "Edit".to_string(), "View".to_string(), "Profiles".to_string()]
2654                        active_menu: state.get_menubar_active()
2655                        tokens: tokens
2656                    }
2657                    row {
2658                        style: c_action_row()
2659                        EuvBadge {
2660                            label: BADGE_READY.to_string()
2661                            tone: EuvTone::Success
2662                            tokens: tokens
2663                        }
2664                        EuvBadge {
2665                            label: BADGE_LIVE.to_string()
2666                            tone: EuvTone::Primary
2667                            tokens: tokens
2668                        }
2669                    }
2670                    EuvActionRow {
2671                        EuvButton {
2672                            label: BTN_SCROLL_DOWN.to_string()
2673                            tokens: tokens
2674                            on_click: move |_: &UiEvent| {
2675                                vlist_down.scroll_by(160.0);
2676                            }
2677                        }
2678                        EuvButton {
2679                            label: BTN_SCROLL_TOP.to_string()
2680                            tokens: tokens
2681                            outline()
2682                            on_click: move |_: &UiEvent| {
2683                                let _: bool = scroll_y.set_if_changed(0.0);
2684                            }
2685                        }
2686                    }
2687                    text {
2688                        font_size: 12.0
2689                        color: p.get_muted_foreground()
2690                        { move || format!("scroll_y={:.0}px | top_row=#{}", scroll_y.get(), (scroll_y.get() / 32.0).floor() as usize) }
2691                    }
2692                    EuvProgress {
2693                        value: 0.84
2694                        tokens: tokens
2695                    }
2696                    { list_node }
2697                    EuvCommand {
2698                        items: vec!["Switch to Dark Mode".to_string(), "Open OTA Updates".to_string(), "Run Physics Tick".to_string()]
2699                        selected: state.get_command_selected()
2700                        tokens: tokens
2701                        query: state.get_command_query()
2702                        placeholder: "Search commands..."
2703                    }
2704                    EuvCarousel {
2705                        slides: vec![
2706                            "Slide 1: Native Metal & Vulkan".to_string(),
2707                            "Slide 2: Complete shadcn/ui Parity".to_string(),
2708                            "Slide 3: Instant Responsive Resize".to_string(),
2709                        ]
2710                        active_slide: state.get_carousel_index()
2711                        tokens: tokens
2712                    }
2713                    column {
2714                        width: Length::Percent(100.0)
2715                        max_width: Length::Px(360.0)
2716                        EuvAspectRatio {
2717                            ratio: 16.0 / 9.0
2718                            child: aspect_inner
2719                            tokens: tokens
2720                        }
2721                    }
2722                    EuvPagination {
2723                        current: state.get_page_index()
2724                        total_pages: 12
2725                        tokens: tokens
2726                    }
2727                    EuvSteps {
2728                        labels: vec!["Layout".to_string(), "Paint".to_string(), "Present".to_string()]
2729                        active: state.get_step_index()
2730                        tokens: tokens
2731                    }
2732                    EuvTree {
2733                        roots: vec![EuvTreeNode::new(
2734                            TREE_NODE_WORKSPACE.to_string(),
2735                            vec![
2736                                EuvTreeNode::new(
2737                                    TREE_NODE_CORE.to_string(),
2738                                    vec![
2739                                        EuvTreeNode::new(TREE_NODE_RENDER.to_string(), Vec::new()),
2740                                        EuvTreeNode::new(TREE_NODE_REACTIVE.to_string(), Vec::new()),
2741                                    ],
2742                                ),
2743                                EuvTreeNode::new(TREE_NODE_UI.to_string(), Vec::new()),
2744                                EuvTreeNode::new(TREE_NODE_PERF.to_string(), Vec::new()),
2745                            ],
2746                        )]
2747                        tokens: tokens
2748                        selected: state.get_tree_selected()
2749                    }
2750                    text {
2751                        font_size: 12.0
2752                        color: p.get_muted_foreground()
2753                        { move || {
2754                            let cur: String = tree_sel
2755                            .get()
2756                            .unwrap_or_else(|| TREE_NONE_SELECTED.to_string());
2757                            format!("{TREE_SELECTED_PREFIX}: {cur}")
2758                        } }
2759                    }
2760                    EuvAccordion {
2761                        items: vec![EuvAccordionItem::new(
2762                            "Virtualization".to_string(),
2763                            "Only visible rows + overscan are materialized in O(visible).".to_string(),
2764                        )]
2765                        open_index: state.get_accordion_open()
2766                        tokens: tokens
2767                    }
2768                }
2769            }
2770        }
2771    }
2772}
2773
2774/// Mounts the embedded 2D physics game engine viewport and reactive HUD overlay page.
2775///
2776/// # Arguments
2777///
2778/// - `&ShowcaseState` - Reactive showcase state.
2779/// - `ThemeTokens` - Active design tokens.
2780///
2781/// # Returns
2782///
2783/// - `NodeId` - Mounted game engine showcase page node.
2784pub fn mount_game_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
2785    let g: ThemeGeometry = tokens.get_geometry();
2786    let p: ThemePalette = tokens.get_palette();
2787    let host: GameEngineHost = state.get_game_host().clone();
2788    let host_btn: GameEngineHost = host.clone();
2789    let host_wave: GameEngineHost = host.clone();
2790    let host_left: GameEngineHost = host.clone();
2791    let host_up: GameEngineHost = host.clone();
2792    let host_down: GameEngineHost = host.clone();
2793    let host_right: GameEngineHost = host.clone();
2794    let host_dash: GameEngineHost = host.clone();
2795    let viewport: NodeId = host.mount_viewport(
2796        Style::default()
2797            .width(Length::Percent(100.0))
2798            .height(Length::Px(340.0))
2799            .border(g.get_border_width(), p.get_border())
2800            .radius(g.get_radius_md()),
2801    );
2802    let fs_2d_open: Signal<bool> = Signal::new(false);
2803    let fs_2d_portal: NodeId = mount_game_fullscreen_portal(
2804        fs_2d_open,
2805        &host,
2806        viewport,
2807        None,
2808        "2D Physics Arena",
2809        tokens,
2810    );
2811    view! {
2812        EuvPage {
2813            title: GAME_TITLE.to_string()
2814            subtitle: GAME_SUBTITLE.to_string()
2815            tokens: tokens
2816            EuvCard {
2817                title: GAME_CARD_TITLE.to_string()
2818                tokens: tokens
2819                subtitle: GAME_CARD_SUB
2820                column {
2821                    gap: SPACE_MD
2822                    EuvActionRow {
2823                        EuvButton {
2824                            label: BTN_STEP_PHYSICS.to_string()
2825                            tokens: tokens
2826                            sm()
2827                            on_click: move |_: &UiEvent| {
2828                                let _: u32 = host_btn.step(0.051);
2829                            }
2830                        }
2831                        EuvButton {
2832                            label: "Spawn Enemy Wave".to_string()
2833                            tokens: tokens
2834                            outline()
2835                            sm()
2836                            on_click: move |_: &UiEvent| {
2837                                host_wave.ingest_event(&WindowEvent::KeyDown(
2838                                    WindowId::new(1),
2839                                    KeyEvent::new(KeyCode::Character('r'), Modifiers::default(), false),
2840                                ));
2841                                let _: u32 = host_wave.step(1.0 / 60.0);
2842                                host_wave.ingest_event(&WindowEvent::KeyUp(
2843                                    WindowId::new(1),
2844                                    KeyEvent::new(KeyCode::Character('r'), Modifiers::default(), false),
2845                                ));
2846                            }
2847                        }
2848                    }
2849                    { viewport }
2850                    EuvActionRow {
2851                        EuvButton {
2852                            label: "Left (A)".to_string()
2853                            tokens: tokens
2854                            outline()
2855                            sm()
2856                            on_click: move |_: &UiEvent| {
2857                                pulse_game_key(&host_left, KeyCode::ArrowLeft);
2858                            }
2859                        }
2860                        EuvButton {
2861                            label: "Up (W)".to_string()
2862                            tokens: tokens
2863                            outline()
2864                            sm()
2865                            on_click: move |_: &UiEvent| {
2866                                pulse_game_key(&host_up, KeyCode::ArrowUp);
2867                            }
2868                        }
2869                        EuvButton {
2870                            label: "Down (S)".to_string()
2871                            tokens: tokens
2872                            outline()
2873                            sm()
2874                            on_click: move |_: &UiEvent| {
2875                                pulse_game_key(&host_down, KeyCode::ArrowDown);
2876                            }
2877                        }
2878                        EuvButton {
2879                            label: "Right (D)".to_string()
2880                            tokens: tokens
2881                            outline()
2882                            sm()
2883                            on_click: move |_: &UiEvent| {
2884                                pulse_game_key(&host_right, KeyCode::ArrowRight);
2885                            }
2886                        }
2887                        EuvButton {
2888                            label: "Dash (E)".to_string()
2889                            tokens: tokens
2890                            secondary()
2891                            sm()
2892                            on_click: move |_: &UiEvent| {
2893                                pulse_game_key(&host_dash, KeyCode::Character('e'));
2894                            }
2895                        }
2896                        EuvButton {
2897                            label: "Fullscreen".to_string()
2898                            tokens: tokens
2899                            sm()
2900                            on_click: move |_: &UiEvent| {
2901                                let _: bool = fs_2d_open.set_if_changed(true);
2902                            }
2903                        }
2904                    }
2905                    { fs_2d_portal }
2906                }
2907            }
2908        }
2909    }
2910}
2911
2912/// Mounts a reusable fullscreen portal overlay hosting any 2D/3D `GameEngineHost` with safe exit, Back support, and touch controls.
2913///
2914/// # Arguments
2915///
2916/// - `Signal<bool>` - Fullscreen visibility toggle signal.
2917/// - `&GameEngineHost` - Target game engine host.
2918/// - `NodeId` - Embedded inline viewport hidden while fullscreen is active to avoid redundant rendering.
2919/// - `Option<Signal<u8>>` - Optional 3D camera mode signal for fullscreen camera toggling.
2920/// - `&str` - Title shown in the fullscreen HUD bar.
2921/// - `ThemeTokens` - Active design tokens.
2922///
2923/// # Returns
2924///
2925/// - `NodeId` - Mounted fullscreen portal handle.
2926fn mount_game_fullscreen_portal(
2927    open: Signal<bool>,
2928    host: &GameEngineHost,
2929    inline_viewport: NodeId,
2930    cam_mode_opt: Option<Signal<u8>>,
2931    title: &str,
2932    tokens: ThemeTokens,
2933) -> NodeId {
2934    let ctx: Context = current_context();
2935    let fs_viewport: NodeId = host.mount_viewport(
2936        Style::default()
2937            .flex_grow(1.0)
2938            .flex_shrink(1.0)
2939            .min_height(Length::Px(0.0))
2940            .width(Length::Percent(100.0))
2941            .overflow(Overflow::Hidden)
2942            .stop_scroll_propagation(true)
2943            .stop_event_propagation(true),
2944    );
2945    let ctrl_left: NodeId =
2946        mount_game_control_button(FS_CTRL_LEFT, host, KeyCode::ArrowLeft, false, tokens);
2947    let ctrl_up: NodeId = mount_game_control_button(
2948        if cam_mode_opt.is_some() {
2949            FS_CTRL_DRIVE
2950        } else {
2951            FS_CTRL_UP
2952        },
2953        host,
2954        KeyCode::ArrowUp,
2955        true,
2956        tokens,
2957    );
2958    let ctrl_down: NodeId = mount_game_control_button(
2959        if cam_mode_opt.is_some() {
2960            FS_CTRL_REVERSE
2961        } else {
2962            FS_CTRL_DOWN
2963        },
2964        host,
2965        KeyCode::ArrowDown,
2966        false,
2967        tokens,
2968    );
2969    let ctrl_right: NodeId =
2970        mount_game_control_button(FS_CTRL_RIGHT, host, KeyCode::ArrowRight, false, tokens);
2971    let extra_ctrl: NodeId = if let Some(cam_sig) = cam_mode_opt {
2972        let on_cam = move |_: &UiEvent| {
2973            let next: u8 = (cam_sig.get_untracked() + 1) % 4;
2974            let _: bool = cam_sig.set_if_changed(next);
2975        };
2976        view! {
2977            EuvButton {
2978                label: FS_CTRL_CAMERA.to_string()
2979                tokens: tokens
2980                secondary()
2981                sm()
2982                on_click: on_cam
2983            }
2984        }
2985    } else {
2986        mount_game_control_button(FS_CTRL_DASH, host, KeyCode::Character('e'), false, tokens)
2987    };
2988    let on_exit = move |_: &UiEvent| {
2989        let _: bool = open.set_if_changed(false);
2990    };
2991    let mut top_bar_id: NodeId = NodeId::default();
2992    let mut bottom_bar_id: NodeId = NodeId::default();
2993    let portal: NodeId = view! {
2994        portal {
2995            style: Style::default().column()
2996            display: Display::None
2997            position: Position::Fixed
2998            inset: (Some(0.0), Some(0.0), Some(0.0), Some(0.0))
2999            width: Length::Percent(100.0)
3000            height: Length::Percent(100.0)
3001            background: Color::hex(0x09090B)
3002            overflow: Overflow::Hidden
3003            stop_scroll_propagation: true
3004            z_index: Z_INDEX_MODAL
3005            row {
3006                node_ref: top_bar_id
3007                width: Length::Percent(100.0)
3008                flex_shrink: 0.0
3009                justify: JustifyContent::SpaceBetween
3010                align: AlignItems::Center
3011                padding: Edges::symmetric(SPACE_SM, SPACE_MD)
3012                background: Color::rgba(9, 9, 11, 236)
3013                text {
3014                    flex_shrink: 1.0
3015                    min_width: Length::Px(0.0)
3016                    font_size: 14.0
3017                    font_weight: FontWeight::SemiBold
3018                    color: Color::hex(0xFAFAFA)
3019                    text_overflow: TextOverflow::Ellipsis
3020                    { format!("{title} · Fullscreen") }
3021                }
3022                EuvButton {
3023                    label: BTN_EXIT_FULLSCREEN.to_string()
3024                    tokens: tokens
3025                    secondary()
3026                    sm()
3027                    on_click: on_exit
3028                }
3029            }
3030            { fs_viewport }
3031            row {
3032                node_ref: bottom_bar_id
3033                width: Length::Percent(100.0)
3034                flex_shrink: 0.0
3035                flex_wrap: FlexWrap::Wrap
3036                justify: JustifyContent::Center
3037                align: AlignItems::Center
3038                gap: SPACE_SM
3039                padding: Edges::symmetric(SPACE_SM, SPACE_MD)
3040                background: Color::rgba(9, 9, 11, 232)
3041                { ctrl_left }
3042                { ctrl_up }
3043                { ctrl_down }
3044                { ctrl_right }
3045                { extra_ctrl }
3046            }
3047        }
3048    };
3049    let handle: SceneHandle = ctx.get_scene().clone();
3050    let safe_sig: Signal<SafeAreaInsets> = ctx.get_safe_area();
3051    let prev_fs: Rc<Cell<bool>> = Rc::new(Cell::new(false));
3052    let (scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
3053        let _: Effect = EuvOverlayStack::bind_signal(open, FS_OVERLAY_NAME, Z_INDEX_MODAL);
3054        Effect::new(move || {
3055            let is_open: bool = open.get();
3056            let safe: SafeAreaInsets = safe_sig.get();
3057            if is_open != prev_fs.replace(is_open) {
3058                let _: bool = dispatch_native_action(
3059                    NATIVE_ACTION_FULLSCREEN,
3060                    if is_open { FS_ACTION_ON } else { FS_ACTION_OFF },
3061                    "",
3062                );
3063            }
3064            handle.with_write(
3065                |tree: &mut SceneTree| {
3066                    if let Some(n) = tree.get_node_mut(inline_viewport) {
3067                        let mut st: Style = n.get_style();
3068                        st.get_mut_layout().set_display(if is_open {
3069                            Display::None
3070                        } else {
3071                            Display::Flex
3072                        });
3073                        n.set_style(st);
3074                        tree.mark_dirty(inline_viewport, DIRTY_LAYOUT | DIRTY_PAINT);
3075                    }
3076                    if let Some(n) = tree.get_node_mut(portal) {
3077                        let mut st: Style = n.get_style();
3078                        st.get_mut_layout().set_display(if is_open {
3079                            Display::Flex
3080                        } else {
3081                            Display::None
3082                        });
3083                        n.set_style(st);
3084                    }
3085                    if let Some(n) = tree.get_node_mut(top_bar_id) {
3086                        let mut st: Style = n.get_style();
3087                        st.get_mut_layout().set_padding(Edges::new(
3088                            SPACE_SM + safe.get_top(),
3089                            SPACE_MD + safe.get_right(),
3090                            SPACE_SM,
3091                            SPACE_MD + safe.get_left(),
3092                        ));
3093                        n.set_style(st);
3094                    }
3095                    if let Some(n) = tree.get_node_mut(bottom_bar_id) {
3096                        let mut st: Style = n.get_style();
3097                        st.get_mut_layout().set_padding(Edges::new(
3098                            SPACE_SM,
3099                            SPACE_MD + safe.get_right(),
3100                            SPACE_SM + safe.get_bottom(),
3101                            SPACE_MD + safe.get_left(),
3102                        ));
3103                        n.set_style(st);
3104                    }
3105                    let dirty_l: u16 = DIRTY_LAYOUT | DIRTY_SUBTREE_LAYOUT;
3106                    tree.mark_dirty(portal, dirty_l | DIRTY_PAINT);
3107                },
3108                (),
3109            );
3110        })
3111    });
3112    ctx.get_scene().with_write(
3113        |tree: &mut SceneTree| {
3114            tree.attach_scope(portal, scope);
3115        },
3116        (),
3117    );
3118    portal
3119}
3120
3121/// Mounts a press-and-hold cross-platform touch/mouse game control button driving `code` on `host`.
3122///
3123/// # Arguments
3124///
3125/// - `&str` - Button label.
3126/// - `&GameEngineHost` - Target game host.
3127/// - `KeyCode` - Virtual key bound to this button.
3128/// - `bool` - Whether to style as primary (`true`) or outline (`false`).
3129/// - `ThemeTokens` - Active design tokens.
3130///
3131/// # Returns
3132///
3133/// - `NodeId` - Mounted holdable button node.
3134fn mount_game_control_button(
3135    label: &str,
3136    host: &GameEngineHost,
3137    code: KeyCode,
3138    primary: bool,
3139    tokens: ThemeTokens,
3140) -> NodeId {
3141    let host_down: GameEngineHost = host.clone();
3142    let host_up: GameEngineHost = host.clone();
3143    let host_click: GameEngineHost = host.clone();
3144    let node: NodeId = if primary {
3145        view! {
3146            EuvButton {
3147                label: label.to_string()
3148                tokens: tokens
3149                sm()
3150                on_click: move |_: &UiEvent| {
3151                    pulse_game_key(&host_click, code);
3152                }
3153            }
3154        }
3155    } else {
3156        view! {
3157            EuvButton {
3158                label: label.to_string()
3159                tokens: tokens
3160                outline()
3161                sm()
3162                on_click: move |_: &UiEvent| {
3163                    pulse_game_key(&host_click, code);
3164                }
3165            }
3166        }
3167    };
3168    let mut ctx: Context = current_context();
3169    ctx.on_pointer_down(node, move |_: &UiEvent| {
3170        host_down.press_key(code);
3171    });
3172    ctx.on_pointer_up(node, move |_: &UiEvent| {
3173        host_up.release_key(code);
3174    });
3175    node
3176}
3177
3178/// Pulses a single directional or action key on `host` for mobile touch/button game controls.
3179///
3180/// # Arguments
3181///
3182/// - `&GameEngineHost` - Target game engine host.
3183/// - `KeyCode` - Virtual key code to pulse.
3184fn pulse_game_key(host: &GameEngineHost, code: KeyCode) {
3185    host.press_key(code);
3186    let _: u32 = host.step(0.08);
3187    host.release_key(code);
3188}
3189
3190/// Mounts the AAA 3D Open-World Engine page with live BVH ray tracing, runtime graphics settings, and `.obj`/`.gltf` model import.
3191///
3192/// # Arguments
3193///
3194/// - `&ShowcaseState` - Reactive showcase state.
3195/// - `ThemeTokens` - Active design tokens.
3196///
3197/// # Returns
3198///
3199/// - `NodeId` - Mounted 3D engine showcase page handle.
3200pub fn mount_game3d_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
3201    let g: ThemeGeometry = tokens.get_geometry();
3202    let p: ThemePalette = tokens.get_palette();
3203    let host: GameEngineHost = state.get_game3d_host().clone();
3204    let quality_sig: Signal<RenderQualityConfig> = state.get_engine3d_quality();
3205    let preset_idx: Signal<usize> = state.get_engine3d_preset_idx();
3206    let rt_idx: Signal<usize> = state.get_engine3d_rt_idx();
3207    let res_scale: Signal<f32> = state.get_engine3d_res_scale();
3208    let time_sig: Signal<f32> = state.get_engine3d_time_of_day();
3209    let import_sig: Signal<u64> = state.get_engine3d_import_queue();
3210    let status_sig: Signal<String> = state.get_engine3d_import_status();
3211    let cam_mode_sig: Signal<u8> = state.get_engine3d_camera_mode();
3212    let viewport: NodeId = host.mount_viewport(
3213        Style::default()
3214            .width(Length::Percent(100.0))
3215            .height(Length::Px(340.0))
3216            .border(g.get_border_width(), p.get_border())
3217            .radius(g.get_radius_md()),
3218    );
3219    let fs_3d_open: Signal<bool> = Signal::new(false);
3220    let fs_3d_portal: NodeId = mount_game_fullscreen_portal(
3221        fs_3d_open,
3222        &host,
3223        viewport,
3224        Some(cam_mode_sig),
3225        "Vice Boulevard 3D RT",
3226        tokens,
3227    );
3228    let res_slider: NodeId = view! {
3229        EuvSlider {
3230            value: res_scale
3231            min: 40.0
3232            max: 125.0
3233            tokens: tokens
3234        }
3235    };
3236    let sun_slider: NodeId = view! {
3237        EuvSlider {
3238            value: time_sig
3239            min: 6.0
3240            max: 23.0
3241            tokens: tokens
3242        }
3243    };
3244    let ctx: Context = current_context();
3245    let (sync_scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
3246        Effect::new(move || {
3247            let p_idx: usize = preset_idx.get();
3248            let preset: QualityPreset = match p_idx {
3249                0 => QualityPreset::Low,
3250                1 => QualityPreset::Medium,
3251                3 => QualityPreset::Ultra,
3252                4 => QualityPreset::Cinematic,
3253                _ => QualityPreset::High,
3254            };
3255            let rt: RayTracingMode = match rt_idx.get() {
3256                0 => RayTracingMode::Off,
3257                1 => RayTracingMode::ShadowsOnly,
3258                3 => RayTracingMode::FullPathTracedGi,
3259                _ => RayTracingMode::ShadowsAndReflections,
3260            };
3261            let scale_pct: f32 = res_scale.get();
3262            let mut cfg: RenderQualityConfig = RenderQualityConfig::from_preset(preset);
3263            cfg.set_ray_tracing(rt);
3264            cfg.set_resolution_scale((scale_pct / 100.0).clamp(0.40, 1.25));
3265            let _: bool = quality_sig.set_if_changed(cfg);
3266        })
3267    });
3268    let mut sync_host_id: NodeId = NodeId::default();
3269    let page: NodeId = view! {
3270        EuvPage {
3271            title: GAME3D_TITLE.to_string()
3272            subtitle: GAME3D_SUBTITLE.to_string()
3273            tokens: tokens
3274            EuvCard {
3275                title: GAME3D_CARD_TITLE.to_string()
3276                tokens: tokens
3277                subtitle: GAME3D_CARD_SUB
3278                column {
3279                    node_ref: sync_host_id
3280                    width: Length::Percent(100.0)
3281                    gap: SPACE_MD
3282                    { viewport }
3283                    EuvActionRow {
3284                        { mount_game_control_button("Steer Left (A)", &host, KeyCode::ArrowLeft, false, tokens) }
3285                        { mount_game_control_button("Drive Fwd (W)", &host, KeyCode::ArrowUp, false, tokens) }
3286                        { mount_game_control_button("Reverse (S)", &host, KeyCode::ArrowDown, false, tokens) }
3287                        { mount_game_control_button("Steer Right (D)", &host, KeyCode::ArrowRight, false, tokens) }
3288                        EuvButton {
3289                            label: "Switch Camera".to_string()
3290                            tokens: tokens
3291                            secondary()
3292                            sm()
3293                            on_click: move |_: &UiEvent| {
3294                                let next: u8 = (cam_mode_sig.get_untracked() + 1) % 4;
3295                                let _: bool = cam_mode_sig.set_if_changed(next);
3296                            }
3297                        }
3298                        EuvButton {
3299                            label: "Fullscreen 3D".to_string()
3300                            tokens: tokens
3301                            sm()
3302                            on_click: move |_: &UiEvent| {
3303                                let _: bool = fs_3d_open.set_if_changed(true);
3304                            }
3305                        }
3306                        EuvButton {
3307                            label: "Import .OBJ Monument".to_string()
3308                            tokens: tokens
3309                            secondary()
3310                            sm()
3311                            on_click: move |_: &UiEvent| {
3312                                let cur: u64 = import_sig.get_untracked();
3313                                let next: u64 = if cur.is_multiple_of(2) { cur + 1 } else { cur + 2 };
3314                                let _: bool = import_sig.set_if_changed(next);
3315                            }
3316                        }
3317                        EuvButton {
3318                            label: "Import .glTF Tower".to_string()
3319                            tokens: tokens
3320                            outline()
3321                            sm()
3322                            on_click: move |_: &UiEvent| {
3323                                let cur: u64 = import_sig.get_untracked();
3324                                let next: u64 = if !cur.is_multiple_of(2) { cur + 1 } else { cur + 2 };
3325                                let _: bool = import_sig.set_if_changed(next);
3326                            }
3327                        }
3328                    }
3329                    text {
3330                        font_size: 12.0
3331                        color: p.get_muted_foreground()
3332                        { move || status_sig.get() }
3333                    }
3334                    EuvSegmented {
3335                        options: vec![
3336                            "Low".to_string(),
3337                            "Medium".to_string(),
3338                            "High".to_string(),
3339                            "Ultra".to_string(),
3340                            "Cinematic".to_string(),
3341                        ]
3342                        selected: preset_idx
3343                        tokens: tokens
3344                    }
3345                    EuvSegmented {
3346                        options: vec![
3347                            "RT Off".to_string(),
3348                            "RT Shadows".to_string(),
3349                            "RT Refl".to_string(),
3350                            "RT Full GI".to_string(),
3351                        ]
3352                        selected: rt_idx
3353                        tokens: tokens
3354                    }
3355                    EuvField {
3356                        label: "Runtime Render Resolution Scale (%)".to_string()
3357                        control: res_slider
3358                        tokens: tokens
3359                    }
3360                    EuvField {
3361                        label: "Time of Day / Sun Lighting (6h Dawn -> 17h Sunset -> 22h Night)".to_string()
3362                        control: sun_slider
3363                        tokens: tokens
3364                    }
3365                    { fs_3d_portal }
3366                }
3367            }
3368        }
3369    };
3370    ctx.get_scene().with_write(
3371        |tree: &mut SceneTree| {
3372            tree.attach_scope(sync_host_id, sync_scope);
3373        },
3374        (),
3375    );
3376    page
3377}
3378
3379/// Mounts the overlays page featuring interactive `EuvModal`, `EuvDrawer`, `EuvSheet`, `EuvPopover`, `EuvDropdown`, `EuvToast`, `EuvNotification`, and `EuvLoading`.
3380///
3381/// # Arguments
3382///
3383/// - `&ShowcaseState` - Reactive showcase state.
3384/// - `ThemeTokens` - Active design tokens.
3385///
3386/// # Returns
3387///
3388/// - `NodeId` - Mounted overlays page node.
3389pub fn mount_overlays_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
3390    let p: ThemePalette = tokens.get_palette();
3391    let modal_open: Signal<bool> = state.get_modal_open();
3392    let drawer_open: Signal<bool> = state.get_drawer_open();
3393    let sheet_open: Signal<bool> = state.get_sheet_open();
3394    let toast_visible: Signal<bool> = state.get_toast_visible();
3395    let notif_visible: Signal<bool> = state.get_notif_visible();
3396    let alert_open: Signal<bool> = state.get_alert_dialog_open();
3397    let ctx_sel: Signal<Option<usize>> = Signal::new(None);
3398    let tip_btn: NodeId = view! {
3399        EuvButton {
3400            label: "Hover Tooltip".to_string()
3401            tokens: tokens
3402            outline()
3403            sm()
3404        }
3405    };
3406    let modal_body: NodeId = view! {
3407        column {
3408            width: Length::Percent(100.0)
3409            gap: SPACE_MD
3410            text {
3411                font_size: 13.0
3412                color: p.get_muted_foreground()
3413                { MODAL_BODY_TEXT }
3414            }
3415            row {
3416                width: Length::Percent(100.0)
3417                justify: JustifyContent::End
3418                EuvButton {
3419                    label: BTN_CLOSE_MODAL.to_string()
3420                    tokens: tokens
3421                    outline()
3422                    on_click: move |_: &UiEvent| {
3423                        let _: bool = modal_open.set_if_changed(false);
3424                    }
3425                }
3426            }
3427        }
3428    };
3429    let drawer_body: NodeId = view! {
3430        column {
3431            width: Length::Percent(100.0)
3432            gap: SPACE_MD
3433            text {
3434                font_size: 13.0
3435                color: p.get_muted_foreground()
3436                "Native slide-over drawer surface"
3437            }
3438            row {
3439                width: Length::Percent(100.0)
3440                justify: JustifyContent::End
3441                EuvButton {
3442                    label: "Close Drawer".to_string()
3443                    tokens: tokens
3444                    outline()
3445                    on_click: move |_: &UiEvent| {
3446                        let _: bool = drawer_open.set_if_changed(false);
3447                    }
3448                }
3449            }
3450        }
3451    };
3452    let sheet_body: NodeId = view! {
3453        column {
3454            width: Length::Percent(100.0)
3455            gap: SPACE_MD
3456            text {
3457                font_size: 13.0
3458                color: p.get_muted_foreground()
3459                "Native bottom action sheet"
3460            }
3461            row {
3462                width: Length::Percent(100.0)
3463                justify: JustifyContent::End
3464                EuvButton {
3465                    label: "Close Sheet".to_string()
3466                    tokens: tokens
3467                    outline()
3468                    on_click: move |_: &UiEvent| {
3469                        let _: bool = sheet_open.set_if_changed(false);
3470                    }
3471                }
3472            }
3473        }
3474    };
3475    view! {
3476        EuvPage {
3477            title: OVERLAYS_TITLE.to_string()
3478            subtitle: OVERLAYS_SUBTITLE.to_string()
3479            tokens: tokens
3480            column {
3481                width: Length::Percent(100.0)
3482                gap: SPACE_LG
3483                EuvAlert {
3484                    title: ALERT_TITLE.to_string()
3485                    description: ALERT_DESC.to_string()
3486                    tone: EuvTone::Primary
3487                    tokens: tokens
3488                }
3489                EuvCard {
3490                    title: OVERLAYS_CARD_TITLE.to_string()
3491                    tokens: tokens
3492                    subtitle: OVERLAYS_CARD_SUB
3493                    EuvActionRow {
3494                        EuvButton {
3495                            label: BTN_OPEN_MODAL.to_string()
3496                            tokens: tokens
3497                            on_click: move |_: &UiEvent| {
3498                                let _: bool = modal_open.set_if_changed(true);
3499                            }
3500                        }
3501                        EuvButton {
3502                            label: "Alert Dialog".to_string()
3503                            tokens: tokens
3504                            destructive()
3505                            on_click: move |_: &UiEvent| {
3506                                let _: bool = alert_open.set_if_changed(true);
3507                            }
3508                        }
3509                        EuvButton {
3510                            label: BTN_TOGGLE_TOAST.to_string()
3511                            tokens: tokens
3512                            secondary()
3513                            on_click: move |_: &UiEvent| {
3514                                let _: bool = toast_visible.update(|v: &mut bool| *v = !*v);
3515                            }
3516                        }
3517                        EuvButton {
3518                            label: "Toggle Drawer".to_string()
3519                            tokens: tokens
3520                            outline()
3521                            on_click: move |_: &UiEvent| {
3522                                let _: bool = drawer_open.update(|v: &mut bool| *v = !*v);
3523                            }
3524                        }
3525                        EuvButton {
3526                            label: "Toggle Sheet".to_string()
3527                            tokens: tokens
3528                            outline()
3529                            on_click: move |_: &UiEvent| {
3530                                let _: bool = sheet_open.update(|v: &mut bool| *v = !*v);
3531                            }
3532                        }
3533                        EuvButton {
3534                            label: "Toggle Notification".to_string()
3535                            tokens: tokens
3536                            outline()
3537                            on_click: move |_: &UiEvent| {
3538                                let _: bool = notif_visible.update(|v: &mut bool| *v = !*v);
3539                            }
3540                        }
3541                    }
3542                    EuvDropdown {
3543                        label: "Quick Actions".to_string()
3544                        items: vec!["Export PNG".to_string(), "Copy DeepLink".to_string()]
3545                        tokens: tokens
3546                        open: state.get_dropdown_open()
3547                        selected: state.get_dropdown_selected()
3548                    }
3549                    EuvHoverCard {
3550                        trigger_label: "@euv-dev".to_string()
3551                        title: HOVER_CARD_ENGINE_TITLE.to_string()
3552                        tokens: tokens
3553                        open: state.get_hover_card_open()
3554                        description: "Full ui.shadcn.com component alignment across all 7 native targets."
3555                    }
3556                    EuvTooltip {
3557                        text: "Zero-WebView floating tooltip".to_string()
3558                        trigger: tip_btn
3559                        tokens: tokens
3560                    }
3561                    EuvContextMenu {
3562                        trigger_label: "Context Menu Surface".to_string()
3563                        items: vec![
3564                            "Inspect Scene Node".to_string(),
3565                            "Copy AI Selector".to_string(),
3566                            "Capture Frame Hash".to_string(),
3567                        ]
3568                        tokens: tokens
3569                        selected: ctx_sel
3570                    }
3571                }
3572                EuvModal {
3573                    open: modal_open
3574                    title: MODAL_TITLE.to_string()
3575                    body: modal_body
3576                    tokens: tokens
3577                }
3578                EuvAlertDialog {
3579                    open: alert_open
3580                    title: "Are you absolutely sure?".to_string()
3581                    confirmed: state.get_alert_dialog_confirmed()
3582                    tokens: tokens
3583                    description: "This shadcn AlertDialog confirms destructive operations cleanly."
3584                    labels("Cancel", "Continue")
3585                }
3586                EuvDrawer {
3587                    open: drawer_open
3588                    title: "Inspector Drawer".to_string()
3589                    body: drawer_body
3590                    tokens: tokens
3591                }
3592                EuvSheet {
3593                    open: sheet_open
3594                    title: "Quick Sheet".to_string()
3595                    body: sheet_body
3596                    tokens: tokens
3597                }
3598                EuvToast {
3599                    visible: toast_visible
3600                    message: TOAST_TEXT.to_string()
3601                    tone: EuvTone::Success
3602                    tokens: tokens
3603                }
3604                EuvNotification {
3605                    visible: notif_visible
3606                    title: "Native Sync".to_string()
3607                    message: "All 7 targets active.".to_string()
3608                    tokens: tokens
3609                    tone: EuvTone::Success
3610                }
3611                EuvLoading {
3612                    active: state.get_loading_active()
3613                    label: "Syncing...".to_string()
3614                    tokens: tokens
3615                }
3616            }
3617        }
3618    }
3619}
3620
3621/// Mounts the interactive component-level and page-level dynamic OTA updates showcase page.
3622///
3623/// # Arguments
3624///
3625/// - `&ShowcaseState` - Reactive showcase state.
3626/// - `ThemeTokens` - Active design tokens.
3627///
3628/// # Returns
3629///
3630/// - `NodeId` - Mounted dynamic updates page node.
3631pub fn mount_dynamic_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
3632    let p: ThemePalette = tokens.get_palette();
3633    let g: ThemeGeometry = tokens.get_geometry();
3634    let hub: DynamicUpdateHub = state.get_dynamic_hub().clone();
3635    let sibling_counter: Signal<i32> = state.get_sibling_counter();
3636    let action_log: Signal<String> = state.get_dynamic_action_log();
3637    let route_sig: Signal<String> = state.get_route();
3638    let tel_sig: Signal<DynamicTelemetry> = hub.telemetry();
3639    let banner_rev: Signal<u64> = hub.component_revision_signal(SLOT_PROMO_BANNER);
3640    let metrics_rev: Signal<u64> = hub.component_revision_signal(SLOT_METRICS_WIDGET);
3641    let panel_rev: Signal<u64> = hub.page_revision_signal(ROUTE_DYNAMIC_PANEL);
3642    let hub_v1: DynamicUpdateHub = hub.clone();
3643    let hub_v2: DynamicUpdateHub = hub.clone();
3644    let hub_rb: DynamicUpdateHub = hub.clone();
3645    let hub_m1: DynamicUpdateHub = hub.clone();
3646    let hub_mrb: DynamicUpdateHub = hub.clone();
3647    let hub_p1: DynamicUpdateHub = hub.clone();
3648    let hub_bundle: DynamicUpdateHub = hub.clone();
3649    let hub_prb: DynamicUpdateHub = hub.clone();
3650    let hub_inject: DynamicUpdateHub = hub.clone();
3651    let hub_for_status: DynamicUpdateHub = hub.clone();
3652    let wasm_mgr: WasmDynamicManager = state.get_wasm_manager().clone();
3653    let wasm_reg: RegistryWasmFetcher = state.get_wasm_registry().clone();
3654    let wasm_offline_sig: Signal<bool> = state.get_wasm_offline();
3655    let wasm_status_sig: Signal<String> = state.get_wasm_fault_status();
3656    let partial_scope: WasmDynamicScope = WasmDynamicScope::Partial {
3657        slot_id: SLOT_WASM_WIDGET.to_string(),
3658    };
3659    let partial_state_sig: Signal<WasmLoadState> = wasm_mgr.state_signal(&partial_scope);
3660    let global_state_sig: Signal<WasmLoadState> = wasm_mgr.state_signal(&WasmDynamicScope::Global);
3661    let wasm_tel_sig: Signal<WasmDynamicTelemetry> = wasm_mgr.telemetry();
3662    let m_p1: WasmDynamicManager = wasm_mgr.clone();
3663    let s_p1: Signal<String> = wasm_status_sig;
3664    let m_p2: WasmDynamicManager = wasm_mgr.clone();
3665    let s_p2: Signal<String> = wasm_status_sig;
3666    let m_prb: WasmDynamicManager = wasm_mgr.clone();
3667    let s_prb: Signal<String> = wasm_status_sig;
3668    let m_pun: WasmDynamicManager = wasm_mgr.clone();
3669    let s_pun: Signal<String> = wasm_status_sig;
3670    let r_off: RegistryWasmFetcher = wasm_reg.clone();
3671    let s_off: Signal<String> = wasm_status_sig;
3672    let m_g1: WasmDynamicManager = wasm_mgr.clone();
3673    let s_g1: Signal<String> = wasm_status_sig;
3674    let m_g2: WasmDynamicManager = wasm_mgr.clone();
3675    let s_g2: Signal<String> = wasm_status_sig;
3676    let m_gbad: WasmDynamicManager = wasm_mgr.clone();
3677    let s_gbad: Signal<String> = wasm_status_sig;
3678    let m_grb: WasmDynamicManager = wasm_mgr.clone();
3679    let s_grb: Signal<String> = wasm_status_sig;
3680    let m_f_retry: WasmDynamicManager = wasm_mgr.clone();
3681    let s_f_retry: Signal<String> = wasm_status_sig;
3682    let m_f_500: WasmDynamicManager = wasm_mgr.clone();
3683    let s_f_500: Signal<String> = wasm_status_sig;
3684    let m_f_corrupt: WasmDynamicManager = wasm_mgr.clone();
3685    let s_f_corrupt: Signal<String> = wasm_status_sig;
3686    let m_f_tamper: WasmDynamicManager = wasm_mgr.clone();
3687    let s_f_tamper: Signal<String> = wasm_status_sig;
3688    let m_f_sig: WasmDynamicManager = wasm_mgr.clone();
3689    let s_f_sig: Signal<String> = wasm_status_sig;
3690    let m_f_abi: WasmDynamicManager = wasm_mgr.clone();
3691    let s_f_abi: Signal<String> = wasm_status_sig;
3692    let m_f_exp: WasmDynamicManager = wasm_mgr.clone();
3693    let s_f_exp: Signal<String> = wasm_status_sig;
3694    let m_f_fuel: WasmDynamicManager = wasm_mgr.clone();
3695    let s_f_fuel: Signal<String> = wasm_status_sig;
3696    let m_f_trap: WasmDynamicManager = wasm_mgr.clone();
3697    let s_f_trap: Signal<String> = wasm_status_sig;
3698    let m_f_big: WasmDynamicManager = wasm_mgr.clone();
3699    let s_f_big: Signal<String> = wasm_status_sig;
3700    let m_f_cancel: WasmDynamicManager = wasm_mgr.clone();
3701    let s_f_cancel: Signal<String> = wasm_status_sig;
3702    let m_http: WasmDynamicManager = wasm_mgr.clone();
3703    let s_http: Signal<String> = wasm_status_sig;
3704    view! {
3705        EuvPage {
3706            title: DYNAMIC_TITLE.to_string()
3707            subtitle: DYNAMIC_SUBTITLE.to_string()
3708            tokens: tokens
3709            EuvCard {
3710                title: "Scoped / Partial Dynamic WASM Execution".to_string()
3711                tokens: tokens
3712                subtitle: "Download genuine .wasm binaries into a single native slot with checksum/signature verification, offline cache, interactive euv_on_event & rollback"
3713                column {
3714                    gap: SPACE_MD
3715                    EuvActionRow {
3716                        EuvButton {
3717                            label: "Download Real HTTP .wasm".to_string()
3718                            tokens: tokens
3719                            on_click: move |_: &UiEvent| {
3720                                #[cfg(not(target_arch = "wasm32"))]
3721                                {
3722                                    let bytes: Vec<u8> = build_partial_widget_wasm(
3723                                        "Live HTTP-Downloaded .wasm Module v3",
3724                                        3,
3725                                        0x059669,
3726                                    );
3727                                    let bytes_srv: Vec<u8> = bytes.clone();
3728                                    match TcpListener::bind("127.0.0.1:0") {
3729                                        Ok(listener) => {
3730                                            let port: u16 = listener
3731                                            .local_addr()
3732                                            .map(|addr: SocketAddr| addr.port())
3733                                            .unwrap_or(0);
3734                                            drop(spawn(move || {
3735                                                if let Ok((mut stream, _)) = listener.accept() {
3736                                                    let mut req_buf: [u8; 512] = [0; 512];
3737                                                    let _: Result<usize, Error> = stream.read(&mut req_buf);
3738                                                    let hdr: String = format!(
3739                                                        "HTTP/1.1 200 OK\r\nContent-Type: application/wasm\r\nContent-Length: {}\r\nConnection: close\r\n\r\n",
3740                                                        bytes_srv.len()
3741                                                    );
3742                                                    let _: Result<(), Error> = stream.write_all(hdr.as_bytes());
3743                                                    let _: Result<(), Error> = stream.write_all(&bytes_srv);
3744                                                    let _: Result<(), Error> = stream.flush();
3745                                                }
3746                                            }));
3747                                            let url: String =
3748                                            format!("http://127.0.0.1:{port}/live-module-v3.wasm");
3749                                            let req: WasmDownloadRequest = WasmDownloadRequest::partial(
3750                                                url.clone(),
3751                                                SLOT_WASM_WIDGET.to_string(),
3752                                                3,
3753                                            )
3754                                            .with_checksum(compute_wasm_checksum(&bytes))
3755                                            .with_signature(compute_wasm_signature(
3756                                                &bytes,
3757                                                3,
3758                                                WASM_SHOWCASE_SIGNING_KEY,
3759                                            ))
3760                                            .with_allow_downgrade(true);
3761                                            match m_http.load_and_mount(req, WASM_SHOWCASE_SIGNING_KEY) {
3762                                                Ok(v) => {
3763                                                    let _: bool = s_http.set(format!(
3764                                                        "Downloaded {} bytes over real HTTP ({url}) -> executed & mounted .wasm v{v} natively!",
3765                                                        bytes.len()
3766                                                    ));
3767                                                }
3768                                                Err(e) => {
3769                                                    let _: bool = s_http.set(format!("HTTP .wasm download failed: {e}"));
3770                                                }
3771                                            }
3772                                        }
3773                                        Err(err) => {
3774                                            let _: bool = s_http.set(format!("Local HTTP server bind error: {err}"));
3775                                        }
3776                                    }
3777                                }
3778                                #[cfg(target_arch = "wasm32")]
3779                                {
3780                                    let bytes: Vec<u8> = build_partial_widget_wasm(TITLE_WASM_PARTIAL_V1, 1, 0x2563EB);
3781                                    let req: WasmDownloadRequest = WasmDownloadRequest::partial(
3782                                        URL_WASM_PARTIAL_V1.to_string(),
3783                                        SLOT_WASM_WIDGET.to_string(),
3784                                        1,
3785                                    )
3786                                    .with_checksum(compute_wasm_checksum(&bytes))
3787                                    .with_signature(compute_wasm_signature(&bytes, 1, WASM_SHOWCASE_SIGNING_KEY))
3788                                    .with_allow_downgrade(true);
3789                                    match m_http.load_and_mount(req, WASM_SHOWCASE_SIGNING_KEY) {
3790                                        Ok(v) => { let _: bool = s_http.set(format!("Fetched & executed .wasm v{v} natively in browser sandbox")); }
3791                                        Err(e) => { let _: bool = s_http.set(format!("WASM fetch failed: {e}")); }
3792                                    }
3793                                }
3794                            }
3795                        }
3796                        EuvButton {
3797                            label: "Download Partial WASM v1".to_string()
3798                            tokens: tokens
3799                            secondary()
3800                            on_click: move |_: &UiEvent| {
3801                                let bytes: Vec<u8> = build_partial_widget_wasm(TITLE_WASM_PARTIAL_V1, 1, 0x2563EB);
3802                                let req: WasmDownloadRequest = WasmDownloadRequest::partial(
3803                                    URL_WASM_PARTIAL_V1.to_string(),
3804                                    SLOT_WASM_WIDGET.to_string(),
3805                                    1,
3806                                )
3807                                .with_checksum(compute_wasm_checksum(&bytes))
3808                                .with_signature(compute_wasm_signature(&bytes, 1, WASM_SHOWCASE_SIGNING_KEY))
3809                                .with_allow_downgrade(true);
3810                                match m_p1.load_and_mount(req, WASM_SHOWCASE_SIGNING_KEY) {
3811                                    Ok(v) => { let _: bool = s_p1.set(format!("Mounted Partial .wasm v{v} natively (verified checksum + signature)")); }
3812                                    Err(e) => { let _: bool = s_p1.set(format!("Partial v1 failed: {e}")); }
3813                                }
3814                            }
3815                        }
3816                        EuvButton {
3817                            label: "Hot-Swap Partial WASM v2".to_string()
3818                            tokens: tokens
3819                            secondary()
3820                            on_click: move |_: &UiEvent| {
3821                                let bytes: Vec<u8> = build_partial_widget_wasm("Hot-Swapped Partial WASM Widget v2", 2, 0x7C3AED);
3822                                let req: WasmDownloadRequest = WasmDownloadRequest::partial(
3823                                    URL_WASM_PARTIAL_V2.to_string(),
3824                                    SLOT_WASM_WIDGET.to_string(),
3825                                    2,
3826                                )
3827                                .with_checksum(compute_wasm_checksum(&bytes))
3828                                .with_signature(compute_wasm_signature(&bytes, 2, WASM_SHOWCASE_SIGNING_KEY))
3829                                .with_allow_downgrade(true);
3830                                match m_p2.load_and_mount(req, WASM_SHOWCASE_SIGNING_KEY) {
3831                                    Ok(v) => { let _: bool = s_p2.set(format!("Hot-swapped Partial .wasm v{v} natively (sibling UI untouched)")); }
3832                                    Err(e) => { let _: bool = s_p2.set(format!("Partial v2 failed: {e}")); }
3833                                }
3834                            }
3835                        }
3836                        EuvButton {
3837                            label: "Toggle Offline (Cache Hit)".to_string()
3838                            tokens: tokens
3839                            outline()
3840                            on_click: move |_: &UiEvent| {
3841                                let next: bool = !wasm_offline_sig.get_untracked();
3842                                let _: bool = wasm_offline_sig.set(next);
3843                                r_off.set_offline(next);
3844                                let _: bool = s_off.set(if next {
3845                                    "Simulated OFFLINE enabled — re-downloading v1 will serve verified offline cache!".to_string()
3846                                    } else {
3847                                        "Simulated ONLINE restored — fetching live .wasm from CDN".to_string()
3848                                });
3849                            }
3850                        }
3851                        EuvButton {
3852                            label: "Rollback Partial".to_string()
3853                            tokens: tokens
3854                            outline()
3855                            on_click: move |_: &UiEvent| {
3856                                match m_prb.rollback_partial(SLOT_WASM_WIDGET, "manual rollback") {
3857                                    Ok(v) => { let _: bool = s_prb.set(format!("Rolled back partial WASM slot to v{v}")); }
3858                                    Err(e) => { let _: bool = s_prb.set(format!("Rollback: {e}")); }
3859                                }
3860                            }
3861                        }
3862                        EuvButton {
3863                            label: "Unmount Slot".to_string()
3864                            tokens: tokens
3865                            ghost()
3866                            on_click: move |_: &UiEvent| {
3867                                m_pun.unmount_partial(SLOT_WASM_WIDGET);
3868                                let _: bool = s_pun.set("Unmounted partial WASM instance and restored compiled fallback".to_string());
3869                            }
3870                        }
3871                    }
3872                    slot {
3873                        id: SLOT_WASM_WIDGET
3874                        row {
3875                            width: Length::Percent(100.0)
3876                            padding: Edges::all(SPACE_MD)
3877                            background: p.get_muted()
3878                            border: (g.get_border_width(), p.get_border())
3879                            radius: g.get_radius_md()
3880                            text {
3881                                font_size: 13.0
3882                                color: p.get_muted_foreground()
3883                                "Compiled Native Slot (v0) — click 'Download Partial WASM v1' to fetch, verify, execute .wasm in sandbox & render natively."
3884                            }
3885                        }
3886                    }
3887                    text {
3888                        font_size: 12.0
3889                        color: p.get_muted_foreground()
3890                        { move || {
3891                            let st: WasmLoadState = partial_state_sig.get();
3892                            let gst: WasmLoadState = global_state_sig.get();
3893                            let tel: WasmDynamicTelemetry = wasm_tel_sig.get();
3894                            format!(
3895                                "Partial={st:?} | Global={gst:?} | OK={}/{} Cache={} Retries={} Rollbacks={} Traps={} FuelStops={} Rejects={} Events={}",
3896                                tel.get_downloads_succeeded(),
3897                                tel.get_downloads_started(),
3898                                tel.get_cache_hits(),
3899                                tel.get_retries_performed(),
3900                                tel.get_rollbacks_executed(),
3901                                tel.get_sandbox_traps_caught(),
3902                                tel.get_fuel_exhaustions_caught(),
3903                                tel.get_integrity_rejections(),
3904                                tel.get_events_handled()
3905                            )
3906                        } }
3907                    }
3908                }
3909            }
3910            EuvCard {
3911                title: "Global / Full-App Dynamic WASM Takeover".to_string()
3912                tokens: tokens
3913                subtitle: "Atomically replace the entire native app shell from a downloaded .wasm release with automatic Last-Known-Good (LKG) rollback on any fault"
3914                column {
3915                    gap: SPACE_MD
3916                    EuvActionRow {
3917                        EuvButton {
3918                            label: "Download Global WASM v1".to_string()
3919                            tokens: tokens
3920                            on_click: move |_: &UiEvent| {
3921                                let bytes: Vec<u8> =
3922                                build_global_app_wasm("Global Dynamic WASM App Shell v1", 1);
3923                                let req: WasmDownloadRequest =
3924                                WasmDownloadRequest::global(URL_WASM_GLOBAL_V1.to_string(), 1)
3925                                .with_checksum(compute_wasm_checksum(&bytes))
3926                                .with_signature(compute_wasm_signature(
3927                                    &bytes,
3928                                    1,
3929                                    WASM_SHOWCASE_SIGNING_KEY,
3930                                ))
3931                                .with_allow_downgrade(true);
3932                                match m_g1.load_and_mount(req, WASM_SHOWCASE_SIGNING_KEY) {
3933                                    Ok(v) => {
3934                                        let _: bool = s_g1
3935                                        .set(format!("Global .wasm v{v} took over root shell natively!"));
3936                                    }
3937                                    Err(e) => {
3938                                        let _: bool = s_g1.set(format!("Global v1 failed: {e}"));
3939                                    }
3940                                }
3941                            }
3942                        }
3943                        EuvButton {
3944                            label: "Upgrade Global WASM v2".to_string()
3945                            tokens: tokens
3946                            secondary()
3947                            on_click: move |_: &UiEvent| {
3948                                let bytes: Vec<u8> =
3949                                build_global_app_wasm("Global Dynamic WASM App Shell v2", 2);
3950                                let req: WasmDownloadRequest =
3951                                WasmDownloadRequest::global(URL_WASM_GLOBAL_V2.to_string(), 2)
3952                                .with_checksum(compute_wasm_checksum(&bytes))
3953                                .with_signature(compute_wasm_signature(
3954                                    &bytes,
3955                                    2,
3956                                    WASM_SHOWCASE_SIGNING_KEY,
3957                                ))
3958                                .with_allow_downgrade(true);
3959                                match m_g2.load_and_mount(req, WASM_SHOWCASE_SIGNING_KEY) {
3960                                    Ok(v) => {
3961                                        let _: bool =
3962                                        s_g2.set(format!("Upgraded Global .wasm to v{v} atomically"));
3963                                    }
3964                                    Err(e) => {
3965                                        let _: bool = s_g2.set(format!("Global v2 failed: {e}"));
3966                                    }
3967                                }
3968                            }
3969                        }
3970                        EuvButton {
3971                            label: "Faulty Global (Auto LKG Rollback)".to_string()
3972                            tokens: tokens
3973                            destructive()
3974                            on_click: move |_: &UiEvent| {
3975                                let req: WasmDownloadRequest =
3976                                WasmDownloadRequest::global(URL_WASM_TRAP.to_string(), 99);
3977                                match m_gbad.load_and_mount(req, WASM_SHOWCASE_SIGNING_KEY) {
3978                                    Ok(v) => {
3979                                        let _: bool = s_gbad.set(format!("Unexpected global mount v{v}"));
3980                                    }
3981                                    Err(e) => {
3982                                        let _: bool =
3983                                        s_gbad.set(format!("Global fault isolated & LKG preserved: {e}"));
3984                                    }
3985                                }
3986                            }
3987                        }
3988                        EuvButton {
3989                            label: "Restore Native Shell".to_string()
3990                            tokens: tokens
3991                            outline()
3992                            on_click: move |_: &UiEvent| {
3993                                m_grb.restore_native_global();
3994                                let _: bool = s_grb.set(STATUS_RESTORED_NATIVE_SHELL.to_string());
3995                            }
3996                        }
3997                    }
3998                }
3999            }
4000            EuvCard {
4001                title: "All-Case Security, Fault & Sandbox Verification Matrix".to_string()
4002                tokens: tokens
4003                subtitle: "Verify every edge case live: auto-retry, offline cache, integrity rejection, ABI mismatch, infinite-loop fuel cutoff, trap isolation & stale cancel guard"
4004                column {
4005                    gap: SPACE_MD
4006                    EuvActionRow {
4007                        EuvButton {
4008                            label: "Timeout -> Auto Retry".to_string()
4009                            tokens: tokens
4010                            outline()
4011                            sm()
4012                            on_click: move |_: &UiEvent| {
4013                                let req: WasmDownloadRequest = WasmDownloadRequest::partial(URL_WASM_TIMEOUT_RETRY.to_string(), SLOT_WASM_WIDGET.to_string(), 10).with_allow_downgrade(true);
4014                                match m_f_retry.load_and_mount(req, WASM_SHOWCASE_SIGNING_KEY) {
4015                                    Ok(v) => { let _: bool = s_f_retry.set(format!("PASS Timeout->Retry recovered and mounted v{v}!")); }
4016                                    Err(e) => { let _: bool = s_f_retry.set(format!("Retry failed: {e}")); }
4017                                }
4018                            }
4019                        }
4020                        EuvButton {
4021                            label: "HTTP 500".to_string()
4022                            tokens: tokens
4023                            outline()
4024                            sm()
4025                            on_click: move |_: &UiEvent| {
4026                                let req: WasmDownloadRequest = WasmDownloadRequest::partial(URL_WASM_HTTP_500.to_string(), SLOT_WASM_WIDGET.to_string(), 11).with_allow_downgrade(true);
4027                                let res: String = format!("Handled HTTP 500 -> {:?}", m_f_500.load_and_mount(req, WASM_SHOWCASE_SIGNING_KEY));
4028                                let _: bool = s_f_500.set(res);
4029                            }
4030                        }
4031                        EuvButton {
4032                            label: "Corrupted Magic".to_string()
4033                            tokens: tokens
4034                            outline()
4035                            sm()
4036                            on_click: move |_: &UiEvent| {
4037                                let req: WasmDownloadRequest = WasmDownloadRequest::partial(URL_WASM_CORRUPTED.to_string(), SLOT_WASM_WIDGET.to_string(), 12).with_allow_downgrade(true);
4038                                let res: String = format!("Blocked Corrupted Magic -> {:?}", m_f_corrupt.load_and_mount(req, WASM_SHOWCASE_SIGNING_KEY));
4039                                let _: bool = s_f_corrupt.set(res);
4040                            }
4041                        }
4042                        EuvButton {
4043                            label: "Tampered Checksum".to_string()
4044                            tokens: tokens
4045                            outline()
4046                            sm()
4047                            on_click: move |_: &UiEvent| {
4048                                let good: Vec<u8> = build_partial_widget_wasm(TITLE_WASM_PARTIAL_V1, 1, 0x2563EB);
4049                                let req: WasmDownloadRequest = WasmDownloadRequest::partial(URL_WASM_TAMPERED.to_string(), SLOT_WASM_WIDGET.to_string(), 13)
4050                                .with_checksum(compute_wasm_checksum(&good))
4051                                .with_allow_downgrade(true);
4052                                let res: String = format!("Blocked Tampered Checksum -> {:?}", m_f_tamper.load_and_mount(req, WASM_SHOWCASE_SIGNING_KEY));
4053                                let _: bool = s_f_tamper.set(res);
4054                            }
4055                        }
4056                        EuvButton {
4057                            label: "Invalid Signature".to_string()
4058                            tokens: tokens
4059                            outline()
4060                            sm()
4061                            on_click: move |_: &UiEvent| {
4062                                let req: WasmDownloadRequest = WasmDownloadRequest::partial(URL_WASM_PARTIAL_V1.to_string(), SLOT_WASM_WIDGET.to_string(), 14)
4063                                .with_signature("euv-sig-v1:forged".to_string())
4064                                .with_allow_downgrade(true);
4065                                let res: String = format!("Blocked Forged Signature -> {:?}", m_f_sig.load_and_mount(req, WASM_SHOWCASE_SIGNING_KEY));
4066                                let _: bool = s_f_sig.set(res);
4067                            }
4068                        }
4069                        EuvButton {
4070                            label: "ABI Mismatch".to_string()
4071                            tokens: tokens
4072                            outline()
4073                            sm()
4074                            on_click: move |_: &UiEvent| {
4075                                let req: WasmDownloadRequest = WasmDownloadRequest::partial(URL_WASM_BAD_ABI.to_string(), SLOT_WASM_WIDGET.to_string(), 15).with_allow_downgrade(true);
4076                                let res: String = format!("Blocked ABI Mismatch -> {:?}", m_f_abi.load_and_mount(req, WASM_SHOWCASE_SIGNING_KEY));
4077                                let _: bool = s_f_abi.set(res);
4078                            }
4079                        }
4080                        EuvButton {
4081                            label: "Missing Export".to_string()
4082                            tokens: tokens
4083                            outline()
4084                            sm()
4085                            on_click: move |_: &UiEvent| {
4086                                let req: WasmDownloadRequest = WasmDownloadRequest::partial(URL_WASM_MISSING_EXPORT.to_string(), SLOT_WASM_WIDGET.to_string(), 16).with_allow_downgrade(true);
4087                                let res: String = format!("Blocked Missing Export -> {:?}", m_f_exp.load_and_mount(req, WASM_SHOWCASE_SIGNING_KEY));
4088                                let _: bool = s_f_exp.set(res);
4089                            }
4090                        }
4091                        EuvButton {
4092                            label: "Infinite-Loop Fuel".to_string()
4093                            tokens: tokens
4094                            outline()
4095                            sm()
4096                            on_click: move |_: &UiEvent| {
4097                                let req: WasmDownloadRequest = WasmDownloadRequest::partial(URL_WASM_FUEL_BOMB.to_string(), SLOT_WASM_WIDGET.to_string(), 17).with_allow_downgrade(true);
4098                                let res: String = format!("Terminated Runaway Loop -> {:?}", m_f_fuel.load_and_mount(req, WASM_SHOWCASE_SIGNING_KEY));
4099                                let _: bool = s_f_fuel.set(res);
4100                            }
4101                        }
4102                        EuvButton {
4103                            label: "Runtime Trap".to_string()
4104                            tokens: tokens
4105                            outline()
4106                            sm()
4107                            on_click: move |_: &UiEvent| {
4108                                let req: WasmDownloadRequest = WasmDownloadRequest::partial(URL_WASM_TRAP.to_string(), SLOT_WASM_WIDGET.to_string(), 18).with_allow_downgrade(true);
4109                                let res: String = format!("Isolated Runtime Trap -> {:?}", m_f_trap.load_and_mount(req, WASM_SHOWCASE_SIGNING_KEY));
4110                                let _: bool = s_f_trap.set(res);
4111                            }
4112                        }
4113                        EuvButton {
4114                            label: "Oversized Binary".to_string()
4115                            tokens: tokens
4116                            outline()
4117                            sm()
4118                            on_click: move |_: &UiEvent| {
4119                                let req: WasmDownloadRequest = WasmDownloadRequest::partial(URL_WASM_OVERSIZED.to_string(), SLOT_WASM_WIDGET.to_string(), 19).with_allow_downgrade(true);
4120                                let res: String = format!("Blocked Oversized Binary -> {:?}", m_f_big.load_and_mount(req, WASM_SHOWCASE_SIGNING_KEY));
4121                                let _: bool = s_f_big.set(res);
4122                            }
4123                        }
4124                        EuvButton {
4125                            label: "Cancel / Stale Guard".to_string()
4126                            tokens: tokens
4127                            outline()
4128                            sm()
4129                            on_click: move |_: &UiEvent| {
4130                                let gen_id: u64 = m_f_cancel.cancel_scope(&WasmDynamicScope::Partial { slot_id: SLOT_WASM_WIDGET.to_string() });
4131                                let _: bool = s_f_cancel.set(format!("Cancelled scope request cleanly (generation #{gen_id} blocks stale responses)"));
4132                            }
4133                        }
4134                    }
4135                    text {
4136                        font_size: 12.5
4137                        font_weight: FontWeight::Medium
4138                        color: p.get_primary()
4139                        { move || wasm_status_sig.get() }
4140                    }
4141                }
4142            }
4143            EuvCard {
4144                title: DYNAMIC_COMP_CARD_TITLE.to_string()
4145                tokens: tokens
4146                subtitle: DYNAMIC_COMP_CARD_SUB
4147                column {
4148                    gap: SPACE_MD
4149                    EuvActionRow {
4150                        EuvButton {
4151                            label: BTN_INC_SIBLING.to_string()
4152                            tokens: tokens
4153                            outline()
4154                            on_click: move |_: &UiEvent| {
4155                                let _: bool = sibling_counter.update(|v: &mut i32| *v += 1);
4156                            }
4157                        }
4158                    }
4159                    text {
4160                        font_size: 13.0
4161                        font_weight: FontWeight::SemiBold
4162                        color: p.get_primary()
4163                        { move || format!("Sibling State Preserved: count={}", sibling_counter.get()) }
4164                    }
4165                    EuvActionRow {
4166                        EuvButton {
4167                            label: BTN_PUSH_BANNER_V1.to_string()
4168                            tokens: tokens
4169                            on_click: move |_: &UiEvent| {
4170                                let next_v: u64 = hub_v1
4171                                .component_version(SLOT_PROMO_BANNER)
4172                                .saturating_add(1);
4173                                let mut badge: DynamicNodeSpec =
4174                                DynamicNodeSpec::badge(format!("OTA v{next_v}"));
4175                                badge
4176                                .get_mut_style()
4177                                .set_background_hex(Some(0x1D4ED8))
4178                                .set_color_hex(Some(0xFFFFFF));
4179                                let mut title: DynamicNodeSpec = DynamicNodeSpec::text(format!(
4180                                    "Dynamic JSON Banner v{next_v}: Surgical Component Patch"
4181                                ));
4182                                title
4183                                .get_mut_style()
4184                                .set_bold(true)
4185                                .set_color_hex(Some(0x1E3A8A));
4186                                let mut offer_btn: DynamicNodeSpec = DynamicNodeSpec::button(
4187                                    BTN_CLAIM_OFFER.to_string(),
4188                                    "claim_offer".to_string(),
4189                                );
4190                                offer_btn.set_payload(format!("json-v{next_v}"));
4191                                let mut box_spec: DynamicNodeSpec = DynamicNodeSpec::row()
4192                                .child(badge)
4193                                .child(title)
4194                                .child(offer_btn);
4195                                box_spec
4196                                .get_mut_style()
4197                                .set_full_width(true)
4198                                .set_padding(Some(12.0))
4199                                .set_radius(Some(8.0))
4200                                .set_background_hex(Some(0xEFF6FF))
4201                                .set_border_width(Some(1.0))
4202                                .set_border_hex(Some(0x93C5FD));
4203                                let mut upd: DynamicComponentUpdate = DynamicComponentUpdate::new(
4204                                    SLOT_PROMO_BANNER.to_string(),
4205                                    next_v,
4206                                    box_spec,
4207                                );
4208                                upd.sign();
4209                                if let Ok(json) = upd.to_json() {
4210                                    let _: Result<u64, DynamicUpdateError> = hub_v1.apply_component_json(&json);
4211                                }
4212                            }
4213                        }
4214                        EuvButton {
4215                            label: BTN_PUSH_BANNER_V2.to_string()
4216                            tokens: tokens
4217                            secondary()
4218                            on_click: move |_: &UiEvent| {
4219                                let next_v: u64 = hub_v2.component_version(SLOT_PROMO_BANNER).saturating_add(1).max(2);
4220                                let hub_act: DynamicUpdateHub = hub_v2.clone();
4221                                let _: Result<u64, DynamicUpdateError> = hub_v2.swap_component_builder(
4222                                    SLOT_PROMO_BANNER.to_string(),
4223                                    next_v,
4224                                    move || {
4225                                        let hub_click: DynamicUpdateHub = hub_act.clone();
4226                                        view! {
4227                                            row {
4228                                                width: Length::Percent(100.0)
4229                                                flex_wrap: FlexWrap::Wrap
4230                                                padding: Edges::all(SPACE_MD)
4231                                                gap: SPACE_MD
4232                                                align: AlignItems::Center
4233                                                background: Color::hex(0x064E3B)
4234                                                radius: 8.0
4235                                                text {
4236                                                    font_size: 14.0
4237                                                    font_weight: FontWeight::Bold
4238                                                    color: Color::hex(0xECFDF5)
4239                                                    { format!("Native Hot-Swapped Banner v{next_v} (Zero Restart)") }
4240                                                }
4241                                                EuvButton {
4242                                                    label: BTN_CLAIM_OFFER.to_string()
4243                                                    tokens: tokens
4244                                                    on_click: move |_: &UiEvent| {
4245                                                        hub_click.dispatch_action(DynamicActionEvent::new(
4246                                                            SLOT_PROMO_BANNER.to_string(),
4247                                                            "claim_offer".to_string(),
4248                                                            format!("native-v{next_v}"),
4249                                                        ));
4250                                                    }
4251                                                }
4252                                            }
4253                                        }
4254                                    },
4255                                );
4256                            }
4257                        }
4258                        EuvButton {
4259                            label: BTN_ROLLBACK_BANNER.to_string()
4260                            tokens: tokens
4261                            outline()
4262                            on_click: move |_: &UiEvent| {
4263                                let _: Result<u64, DynamicUpdateError> = hub_rb.rollback_component(SLOT_PROMO_BANNER);
4264                            }
4265                        }
4266                    }
4267                    slot {
4268                        id: SLOT_PROMO_BANNER
4269                        row {
4270                            width: Length::Percent(100.0)
4271                            padding: Edges::all(SPACE_MD)
4272                            background: p.get_muted()
4273                            border: (g.get_border_width(), p.get_border())
4274                            radius: g.get_radius_md()
4275                            text {
4276                                font_size: 13.0
4277                                color: p.get_foreground()
4278                                "Compiled Fallback Banner (v0) — click a button above to hot-update only this component."
4279                            }
4280                        }
4281                    }
4282                    EuvActionRow {
4283                        EuvButton {
4284                            label: BTN_PATCH_METRICS.to_string()
4285                            tokens: tokens
4286                            on_click: move |_: &UiEvent| {
4287                                let next_v: u64 = hub_m1.component_version(SLOT_METRICS_WIDGET).saturating_add(1);
4288                                let mut card_spec: DynamicNodeSpec = DynamicNodeSpec::card(format!("Live Metrics Widget v{next_v}"))
4289                                .child(DynamicNodeSpec::text(format!("Updated independently without touching promo_banner or sibling state (rev {next_v}).")));
4290                                card_spec
4291                                .get_mut_style()
4292                                .set_background_hex(Some(0xFEFCE8))
4293                                .set_border_width(Some(1.0))
4294                                .set_border_hex(Some(0xFACC15));
4295                                let mut upd: DynamicComponentUpdate = DynamicComponentUpdate::new(
4296                                    SLOT_METRICS_WIDGET.to_string(),
4297                                    next_v,
4298                                    card_spec,
4299                                );
4300                                upd.sign();
4301                                let _: Result<u64, DynamicUpdateError> = hub_m1.apply_component(upd);
4302                            }
4303                        }
4304                        EuvButton {
4305                            label: BTN_ROLLBACK_METRICS.to_string()
4306                            tokens: tokens
4307                            outline()
4308                            on_click: move |_: &UiEvent| {
4309                                let _: Result<u64, DynamicUpdateError> =
4310                                hub_mrb.rollback_component(SLOT_METRICS_WIDGET);
4311                            }
4312                        }
4313                    }
4314                    slot {
4315                        id: SLOT_METRICS_WIDGET
4316                        row {
4317                            width: Length::Percent(100.0)
4318                            padding: Edges::all(SPACE_MD)
4319                            background: p.get_muted()
4320                            border: (g.get_border_width(), p.get_border())
4321                            radius: g.get_radius_md()
4322                            text {
4323                                font_size: 13.0
4324                                color: p.get_muted_foreground()
4325                                "Compiled Fallback Metrics Widget (v0) — independent surgical slot."
4326                            }
4327                        }
4328                    }
4329                }
4330            }
4331            EuvCard {
4332                title: DYNAMIC_PAGE_CARD_TITLE.to_string()
4333                tokens: tokens
4334                subtitle: DYNAMIC_PAGE_CARD_SUB
4335                column {
4336                    gap: SPACE_MD
4337                    EuvActionRow {
4338                        EuvButton {
4339                            label: BTN_UPDATE_PAGE_V1.to_string()
4340                            tokens: tokens
4341                            on_click: move |_: &UiEvent| {
4342                                let next_v: u64 = hub_p1.page_version(ROUTE_DYNAMIC_PANEL).saturating_add(1);
4343                                let spec: DynamicNodeSpec = DynamicNodeSpec::card(format!(
4344                                    "Hot-Updated Dynamic Page Panel v{next_v}"
4345                                ))
4346                                .child(DynamicNodeSpec::badge(format!("Page Revision v{next_v}")))
4347                                .child(DynamicNodeSpec::text(
4348                                    "Page-level layout replaced live without restarting the application."
4349                                    .to_string(),
4350                                ));
4351                                let mut upd: DynamicPageUpdate = DynamicPageUpdate::new(
4352                                    ROUTE_DYNAMIC_PANEL.to_string(),
4353                                    format!("Dynamic Panel v{next_v}"),
4354                                    next_v,
4355                                    spec,
4356                                );
4357                                upd.sign();
4358                                let _: Result<u64, DynamicUpdateError> = hub_p1.apply_page(upd);
4359                            }
4360                        }
4361                        EuvButton {
4362                            label: BTN_APPLY_BUNDLE.to_string()
4363                            tokens: tokens
4364                            secondary()
4365                            on_click: move |_: &UiEvent| {
4366                                let next_comp_v: u64 = hub_bundle
4367                                .component_version(SLOT_METRICS_WIDGET)
4368                                .saturating_add(1);
4369                                let next_page_v: u64 = hub_bundle
4370                                .page_version(ROUTE_DYNAMIC_PANEL)
4371                                .saturating_add(1);
4372                                let mut comp_upd: DynamicComponentUpdate = DynamicComponentUpdate::new(
4373                                    SLOT_METRICS_WIDGET.to_string(),
4374                                    next_comp_v,
4375                                    DynamicNodeSpec::card(format!("Atomic Bundle Metrics v{next_comp_v}")).child(
4376                                        DynamicNodeSpec::text(
4377                                            "Committed together with page panel inside one atomic transaction."
4378                                            .to_string(),
4379                                        ),
4380                                    ),
4381                                );
4382                                comp_upd.sign();
4383                                let mut page_upd: DynamicPageUpdate = DynamicPageUpdate::new(
4384                                    ROUTE_DYNAMIC_PANEL.to_string(),
4385                                    format!("Atomic Panel v{next_page_v}"),
4386                                    next_page_v,
4387                                    DynamicNodeSpec::card(format!("Atomic Bundle Page Panel v{next_page_v}")).child(
4388                                        DynamicNodeSpec::text(
4389                                            "Both component slot and page slot updated atomically via signed JSON."
4390                                            .to_string(),
4391                                        ),
4392                                    ),
4393                                );
4394                                page_upd.sign();
4395                                let bundle: DynamicUpdateBundle =
4396                                DynamicUpdateBundle::new("ota-atomic-bundle".to_string(), next_page_v)
4397                                .push_component(comp_upd)
4398                                .push_page(page_upd);
4399                                if let Ok(json) = bundle.to_json() {
4400                                    let _: Result<DynamicTelemetry, DynamicUpdateError> =
4401                                    hub_bundle.apply_bundle_json(&json);
4402                                }
4403                            }
4404                        }
4405                        EuvButton {
4406                            label: BTN_ROLLBACK_PAGE.to_string()
4407                            tokens: tokens
4408                            outline()
4409                            on_click: move |_: &UiEvent| {
4410                                let _: Result<u64, DynamicUpdateError> = hub_prb.rollback_page(ROUTE_DYNAMIC_PANEL);
4411                            }
4412                        }
4413                        EuvButton {
4414                            label: BTN_INJECT_ROUTE.to_string()
4415                            tokens: tokens
4416                            secondary()
4417                            on_click: move |_: &UiEvent| {
4418                                let next_v: u64 = hub_inject.page_version(ROUTE_PROMO_LIVE).saturating_add(1);
4419                                let mut back_btn: DynamicNodeSpec = DynamicNodeSpec::button(
4420                                    BTN_RETURN_DYNAMIC.to_string(),
4421                                    "return_dynamic".to_string(),
4422                                );
4423                                back_btn.set_payload(format!("from-promo-v{next_v}"));
4424                                let page_spec: DynamicNodeSpec = DynamicNodeSpec::column().child(
4425                                    DynamicNodeSpec::card(format!("Runtime-Injected Page /promo-live (v{next_v})"))
4426                                    .child(DynamicNodeSpec::badge("Zero Recompile Route".to_string()))
4427                                    .child(DynamicNodeSpec::text(
4428                                        "This entire route was injected dynamically at runtime via signed JSON manifest."
4429                                        .to_string(),
4430                                    ))
4431                                    .child(back_btn),
4432                                );
4433                                let mut upd: DynamicPageUpdate = DynamicPageUpdate::new(
4434                                    ROUTE_PROMO_LIVE.to_string(),
4435                                    "Flash Promo (OTA)".to_string(),
4436                                    next_v,
4437                                    page_spec,
4438                                );
4439                                upd.sign();
4440                                if let Ok(json) = upd.to_json()
4441                                && hub_inject.apply_page_json(&json).is_ok()
4442                                {
4443                                    let _: bool = route_sig.set_if_changed(ROUTE_PROMO_LIVE.to_string());
4444                                }
4445                            }
4446                        }
4447                    }
4448                    page_slot {
4449                        route: ROUTE_DYNAMIC_PANEL
4450                        column {
4451                            width: Length::Percent(100.0)
4452                            padding: Edges::all(SPACE_MD)
4453                            background: p.get_muted()
4454                            border: (g.get_border_width(), p.get_border())
4455                            radius: g.get_radius_md()
4456                            text {
4457                                font_size: 13.0
4458                                color: p.get_foreground()
4459                                "Compiled Fallback Page Panel (v0) — click Hot-Update Page or Apply Atomic Bundle."
4460                            }
4461                        }
4462                    }
4463                    text {
4464                        font_size: 12.0
4465                        color: p.get_muted_foreground()
4466                        { move || {
4467                            let _: u64 = banner_rev.get();
4468                            let _: u64 = metrics_rev.get();
4469                            let _: u64 = panel_rev.get();
4470                            let tel: DynamicTelemetry = tel_sig.get();
4471                            format!(
4472                                "Versions: banner=v{} metrics=v{} panel=v{} | Applied: comp={} page={} rollbacks={} rejected={} | Last Action: {}",
4473                                hub_for_status.component_version(SLOT_PROMO_BANNER),
4474                                hub_for_status.component_version(SLOT_METRICS_WIDGET),
4475                                hub_for_status.page_version(ROUTE_DYNAMIC_PANEL),
4476                                tel.get_components_applied(),
4477                                tel.get_pages_applied(),
4478                                tel.get_rollbacks(),
4479                                tel.get_rejected(),
4480                                action_log.get(),
4481                            )
4482                        } }
4483                    }
4484                }
4485            }
4486        }
4487    }
4488}
4489
4490/// Mounts the complete cross-platform Media Studio page demonstrating Image, SVG, GIF, LIVE Photo, Video, Audio, PDF, and native HTML5.
4491///
4492/// # Arguments
4493///
4494/// - `&ShowcaseState` - Reactive showcase state.
4495/// - `ThemeTokens` - Active design tokens.
4496///
4497/// # Returns
4498///
4499/// - `NodeId` - Mounted Media Studio page node.
4500pub fn mount_media_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
4501    let p: ThemePalette = tokens.get_palette();
4502    let link_log: Signal<String> = state.get_media_html_link_log();
4503    let link_log_cb: Signal<String> = link_log;
4504    let photo_card: NodeId = view! {
4505        EuvImage {
4506            asset: ImageAsset::sample_photo("Hero Raster Photo (PNG/BMP/WebP)")
4507            tokens: tokens
4508            height: 148.0
4509        }
4510    };
4511    let svg_card: NodeId = view! {
4512        EuvSvgView {
4513            document: SvgDocument::sample_svg()
4514            label: "Vector SVG Badge".to_string()
4515            tokens: tokens
4516        }
4517    };
4518    let gif_card: NodeId = view! {
4519        EuvGifPlayer {
4520            state: state.get_media_gif()
4521            tokens: tokens
4522        }
4523    };
4524    let live_card: NodeId = view! {
4525        EuvLivePhoto {
4526            state: state.get_media_live()
4527            tokens: tokens
4528        }
4529    };
4530    let video_card: NodeId = view! {
4531        EuvVideoPlayer {
4532            state: state.get_media_video()
4533            tokens: tokens
4534        }
4535    };
4536    let audio_card: NodeId = view! {
4537        EuvAudioPlayer {
4538            state: state.get_media_audio()
4539            tokens: tokens
4540        }
4541    };
4542    let pdf_card: NodeId = view! {
4543        EuvPdfViewer {
4544            state: state.get_media_pdf()
4545            tokens: tokens
4546        }
4547    };
4548    let html_card: NodeId = view! {
4549        EuvHtmlView {
4550            document: HtmlDocument::sample_html()
4551            tokens: tokens
4552            on_link: move |href: String| {
4553                let _: bool = link_log_cb.set_if_changed(format!("Opened native link: {href}"));
4554            }
4555        }
4556    };
4557    view! {
4558        EuvPage {
4559            title: "Full Cross-Platform Media Studio".to_string()
4560            subtitle: "Pure-Rust aspect-preserving Image, SVG, animated GIF, LIVE Photo, Video, WAV Audio waveform, multi-page PDF, and sanitized zero-JS HTML5.".to_string()
4561            tokens: tokens
4562            { mount_bento_pair(photo_card, svg_card) }
4563            { mount_bento_pair(gif_card, live_card) }
4564            { mount_bento_pair(video_card, audio_card) }
4565            { mount_bento_pair(pdf_card, html_card) }
4566            text {
4567                font_size: 12.5
4568                color: p.get_muted_foreground()
4569                { move || link_log.get() }
4570            }
4571        }
4572    }
4573}
4574
4575/// Mounts a responsive 2-column Bento card pair (2 columns on desktop `Expanded`, 1 column on tablet/mobile).
4576///
4577/// # Arguments
4578///
4579/// - `NodeId` - First card node.
4580/// - `NodeId` - Second card node.
4581///
4582/// # Returns
4583///
4584/// - `NodeId` - Mounted responsive Bento container node.
4585fn mount_bento_pair(left: NodeId, right: NodeId) -> NodeId {
4586    let bp_sig: Signal<Breakpoint> = use_breakpoint();
4587    view! {
4588        grid {
4589            bind_style: move || {
4590                let cols: u16 = if bp_sig.get() == Breakpoint::Expanded { 2 } else { 1 };
4591                Style::default()
4592                .grid(cols)
4593                .width(Length::Percent(100.0))
4594                .gap(SPACE_MD)
4595            }
4596            { left }
4597            { right }
4598        }
4599    }
4600}