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