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