euv-example 0.47.1

Cross-platform native showcase application demonstrating euv fine-grained reactivity, multi-mode rendering, window controls, and euv-ui components.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
use super::*;

/// Resolves the human-readable widget-scoped pipeline mode name from `idx`.
///
/// # Arguments
///
/// - `usize` - Pipeline mode index (`0=Auto, 1=Software, 2=Hardware, 3=Hybrid`).
///
/// # Returns
///
/// - `&'static str` - Display label for the selected preview pipeline mode.
pub(crate) fn render_mode_name(idx: usize) -> &'static str {
    match idx {
        1 => MODE_SOFTWARE,
        2 => MODE_HARDWARE,
        3 => MODE_HYBRID,
        _ => MODE_AUTO,
    }
}

/// Resolves the BackdropBlur radius in logical pixels from the segmented control index.
///
/// # Arguments
///
/// - `usize` - Blur preset index (`0=8px, 1=16px, 2=24px`).
///
/// # Returns
///
/// - `f32` - Blur radius in logical pixels.
pub(crate) fn render_blur_radius(idx: usize) -> f32 {
    match idx {
        0 => 8.0,
        2 => 24.0,
        _ => 16.0,
    }
}

/// Resolves the linear gradient angle in degrees from the segmented control index.
///
/// # Arguments
///
/// - `usize` - Angle preset index (`0=0deg, 1=45deg, 2=90deg, 3=135deg`).
///
/// # Returns
///
/// - `f32` - Gradient angle in degrees.
pub(crate) fn render_gradient_angle(idx: usize) -> f32 {
    match idx {
        0 => 0.0,
        2 => 90.0,
        3 => 135.0,
        _ => 45.0,
    }
}

/// Mounts the SDF Anti-Aliased Vector Canvas hero card responding to the widget-scoped pipeline index.
///
/// # Arguments
///
/// - `Signal<usize>` - Widget-scoped render mode index signal.
/// - `ThemeTokens` - Active design tokens.
///
/// # Returns
///
/// - `(NodeId, NodeId)` - Mounted card node and inner vector canvas node handle.
pub(crate) fn mount_render_vector_card(
    mode_idx: Signal<usize>,
    tokens: ThemeTokens,
) -> (NodeId, NodeId) {
    let p: ThemePalette = tokens.get_palette();
    let g: ThemeGeometry = tokens.get_geometry();
    let mut canvas_id: NodeId = NodeId::default();
    let pipeline_label = move || -> String {
        let mode_name: &str = render_mode_name(mode_idx.get());
        format!("Demo Preview Pipeline: {mode_name} (Widget-Scoped — Global App Unchanged)")
    };
    let paint_preview = move |bounds: Rect, dl: &mut DisplayList| {
        let live: ThemeTokens = live_tokens_untracked(tokens);
        let lp: ThemePalette = live.get_palette();
        let mode: usize = mode_idx.get_untracked();
        let bw: f32 = bounds.get_width().max(120.0);
        let bh: f32 = bounds.get_height().max(100.0);
        let grid_col: Color = lp.get_border().with_alpha(90);
        let step_x: f32 = (bw / 6.0).max(32.0);
        let mut gx: f32 = bounds.get_x() + step_x;
        while gx < bounds.right() - 8.0 {
            dl.push(DrawCommand::Line {
                from: Point::new(gx, bounds.get_y() + 8.0),
                to: Point::new(gx, bounds.bottom() - 8.0),
                color: grid_col,
                width: 1.0,
            });
            gx += step_x;
        }
        let rect_w: f32 = (bw * 0.28).clamp(64.0, 210.0);
        let rect_h: f32 = (bh - 52.0).max(60.0);
        let primary_fill: Color = match mode {
            1 => lp.get_secondary(),
            2 => lp.get_primary(),
            3 => lp.get_success(),
            _ => lp.get_primary(),
        };
        dl.push(DrawCommand::FillRoundedRect {
            rect: Rect::new(bounds.get_x() + 18.0, bounds.get_y() + 34.0, rect_w, rect_h),
            color: primary_fill,
            radius: CornerRadius::all(14.0),
            border: Border::new(1.5, lp.get_border()),
        });
        let circle_r: f32 = (bw * 0.085).clamp(22.0, 48.0);
        let circle_x: f32 = (bounds.get_x() + 18.0 + rect_w + circle_r + 24.0)
            .min(bounds.right() - circle_r - 14.0);
        let circle_y: f32 = bounds.get_y() + 34.0 + rect_h * 0.5;
        dl.push(DrawCommand::Circle {
            center: Point::new(circle_x, circle_y),
            radius: circle_r + 6.0,
            color: lp.get_success().with_alpha(52),
        });
        dl.push(DrawCommand::Circle {
            center: Point::new(circle_x, circle_y),
            radius: circle_r,
            color: lp.get_success(),
        });
        let line_x0: f32 = (circle_x + circle_r + 18.0).min(bounds.right() - 24.0);
        let line_x1: f32 = (bounds.right() - 18.0).max(line_x0);
        dl.push(DrawCommand::Line {
            from: Point::new(line_x0, bounds.get_y() + 42.0),
            to: Point::new(line_x1, bounds.bottom() - 22.0),
            color: lp.get_warning(),
            width: 3.5,
        });
        dl.push(DrawCommand::Line {
            from: Point::new(line_x0, bounds.bottom() - 22.0),
            to: Point::new(line_x1, bounds.get_y() + 42.0),
            color: lp.get_primary().with_alpha(180),
            width: 2.0,
        });
        let mut hud_style: TextStyle = TextStyle::default();
        hud_style
            .set_font_size(11.5)
            .set_weight(FontWeight::SemiBold)
            .set_color(lp.get_foreground());
        dl.push(DrawCommand::TextRun {
            rect: Rect::new(
                bounds.get_x() + 16.0,
                bounds.get_y() + 10.0,
                (bw - 32.0).max(1.0),
                18.0,
            ),
            text: format!(
                "SDF Vector Stage | Preview Mode: {} | Bounds: {:.0}x{:.0}",
                render_mode_name(mode),
                bw,
                bh
            ),
            style: hud_style,
        });
    };
    let card: NodeId = view! {
        EuvCard {
            title: RENDER_CARD_TITLE.to_string()
            tokens: tokens
            subtitle: RENDER_CARD_SUB
            column {
                style: {
                    width: Length::Percent(100.0)
                    gap: SPACE_SM
                }
                text {
                    style: {
                        width: Length::Percent(100.0)
                        font_size: 13.0
                        font_weight: FontWeight::SemiBold
                        color: p.get_primary()
                    }
                    { pipeline_label }
                }
                text {
                    style: {
                        width: Length::Percent(100.0)
                        font_size: 12.0
                        font_weight: FontWeight::Medium
                        color: p.get_muted_foreground()
                    }
                    { CANVAS_LABEL }
                }
                canvas {
                    node_ref: canvas_id
                    style: {
                        width: Length::Percent(100.0)
                        height: Length::Px(RENDER_VECTOR_CANVAS_HEIGHT)
                        background: p.get_muted()
                        border: (g.get_border_width(), p.get_border())
                        radius: g.get_radius_md()
                    }
                    painter: paint_preview
                }
            }
        }
    };
    (card, canvas_id)
}

/// Mounts the Dual-Kawase BackdropBlur showcase card with a reactive frosted glass overlay.
///
/// # Arguments
///
/// - `Signal<usize>` - Selected blur preset index signal.
/// - `ThemeTokens` - Active design tokens.
///
/// # Returns
///
/// - `(NodeId, NodeId)` - Mounted card node and the frosted glass overlay node handle.
pub(crate) fn mount_render_blur_card(
    blur_idx: Signal<usize>,
    tokens: ThemeTokens,
) -> (NodeId, NodeId) {
    let p: ThemePalette = tokens.get_palette();
    let g: ThemeGeometry = tokens.get_geometry();
    let mut glass_id: NodeId = NodeId::default();
    let paint_backdrop = move |bounds: Rect, dl: &mut DisplayList| {
        let live: ThemeTokens = live_tokens_untracked(tokens);
        let lp: ThemePalette = live.get_palette();
        let bw: f32 = bounds.get_width().max(80.0);
        let bh: f32 = bounds.get_height().max(80.0);
        dl.push(DrawCommand::Circle {
            center: Point::new(bounds.get_x() + bw * 0.24, bounds.get_y() + bh * 0.48),
            radius: (bh * 0.34).max(20.0),
            color: lp.get_primary(),
        });
        dl.push(DrawCommand::Circle {
            center: Point::new(bounds.get_x() + bw * 0.56, bounds.get_y() + bh * 0.42),
            radius: (bh * 0.30).max(18.0),
            color: lp.get_success(),
        });
        dl.push(DrawCommand::Circle {
            center: Point::new(bounds.get_x() + bw * 0.80, bounds.get_y() + bh * 0.58),
            radius: (bh * 0.28).max(16.0),
            color: lp.get_warning(),
        });
    };
    let glass_style = move || -> Style {
        let live: ThemeTokens = use_live_tokens(tokens);
        let lp: ThemePalette = live.get_palette();
        let lg: ThemeGeometry = live.get_geometry();
        Style::default()
            .width(Length::Percent(100.0))
            .flex_grow(1.0)
            .column()
            .justify(JustifyContent::Center)
            .gap(SPACE_XS)
            .padding(Edges::all(SPACE_MD))
            .background(lp.get_card().with_alpha(196))
            .border(lg.get_border_width(), lp.get_border())
            .radius(lg.get_radius_md())
            .overflow(Overflow::Hidden)
    };
    let glass_title_style = move || -> Style {
        let live: ThemeTokens = use_live_tokens(tokens);
        Style::default()
            .width(Length::Percent(100.0))
            .font_size(14.0)
            .font_weight(FontWeight::Bold)
            .color(live.get_palette().get_card_foreground())
    };
    let glass_sub_style = move || -> Style {
        let live: ThemeTokens = use_live_tokens(tokens);
        Style::default()
            .width(Length::Percent(100.0))
            .font_size(12.0)
            .font_family(FontFamily::Monospace)
            .color(live.get_palette().get_card_foreground())
    };
    let blur_caption = move || -> String {
        let radius: f32 = render_blur_radius(blur_idx.get());
        format!("Dual-Kawase radius: {radius:.0}px | alpha=196/255")
    };
    let card: NodeId = view! {
        EuvCard {
            title: RENDER_BLUR_CARD_TITLE.to_string()
            tokens: tokens
            subtitle: RENDER_BLUR_CARD_SUB
            view {
                style: {
                    width: Length::Percent(100.0)
                    height: Length::Px(RENDER_EFFECT_STAGE_HEIGHT)
                    padding: Edges::all(SPACE_LG)
                    justify: JustifyContent::Center
                    background: p.get_muted()
                    border: (g.get_border_width(), p.get_border())
                    radius: g.get_radius_md()
                    overflow: Overflow::Hidden
                }
                canvas {
                    style: {
                        position: Position::Absolute
                        inset: (Some(0.0), Some(0.0), Some(0.0), Some(0.0))
                        width: Length::Percent(100.0)
                        height: Length::Percent(100.0)
                    }
                    painter: paint_backdrop
                }
                view {
                    node_ref: glass_id
                    bind_style: glass_style
                    text {
                        bind_style: glass_title_style
                        { RENDER_BLUR_GLASS_TITLE }
                    }
                    text {
                        bind_style: glass_sub_style
                        { blur_caption }
                    }
                }
            }
        }
    };
    (card, glass_id)
}

/// Mounts the Elevation Shadow Ramp showcase card driven by the shadow preset signal.
///
/// # Arguments
///
/// - `Signal<usize>` - Selected shadow elevation preset index signal.
/// - `ThemeTokens` - Active design tokens.
///
/// # Returns
///
/// - `NodeId` - Mounted card node.
pub(crate) fn mount_render_shadow_card(shadow_idx: Signal<usize>, tokens: ThemeTokens) -> NodeId {
    let p: ThemePalette = tokens.get_palette();
    let g: ThemeGeometry = tokens.get_geometry();
    let tile_style = move || -> Style {
        let live: ThemeTokens = use_live_tokens(tokens);
        let lp: ThemePalette = live.get_palette();
        let lg: ThemeGeometry = live.get_geometry();
        let sh: Shadow = match shadow_idx.get() {
            0 => lg.get_shadow_sm(),
            2 => lg.get_shadow_lg(),
            _ => lg.get_shadow_md(),
        };
        Style::default()
            .column()
            .width(Length::Percent(100.0))
            .padding(Edges::all(SPACE_MD))
            .gap(SPACE_XS)
            .background(lp.get_card())
            .border(lg.get_border_width(), lp.get_border())
            .radius(lg.get_radius_lg())
            .shadow(sh)
            .overflow(Overflow::Hidden)
    };
    let tile_title_style = move || -> Style {
        let live: ThemeTokens = use_live_tokens(tokens);
        Style::default()
            .width(Length::Percent(100.0))
            .font_size(14.0)
            .font_weight(FontWeight::Bold)
            .color(live.get_palette().get_card_foreground())
    };
    let tile_meta_style = move || -> Style {
        let live: ThemeTokens = use_live_tokens(tokens);
        Style::default()
            .width(Length::Percent(100.0))
            .font_size(12.0)
            .font_family(FontFamily::Monospace)
            .color(live.get_palette().get_muted_foreground())
    };
    let shadow_meta = move || -> String {
        let live: ThemeTokens = use_live_tokens(tokens);
        let lg: ThemeGeometry = live.get_geometry();
        let (tier, sh): (&str, Shadow) = match shadow_idx.get() {
            0 => (RENDER_SHADOW_OPT_SM, lg.get_shadow_sm()),
            2 => (RENDER_SHADOW_OPT_LG, lg.get_shadow_lg()),
            _ => (RENDER_SHADOW_OPT_MD, lg.get_shadow_md()),
        };
        format!(
            "{tier} | offset=({:.0},{:.0}) blur={:.0}px",
            sh.get_offset_x(),
            sh.get_offset_y(),
            sh.get_blur_radius()
        )
    };
    view! {
        EuvCard {
            title: RENDER_SHADOW_CARD_TITLE.to_string()
            tokens: tokens
            subtitle: RENDER_SHADOW_CARD_SUB
            column {
                style: {
                    width: Length::Percent(100.0)
                    height: Length::Px(RENDER_EFFECT_STAGE_HEIGHT)
                    padding: Edges::all(SPACE_LG)
                    justify: JustifyContent::Center
                    background: p.get_muted()
                    border: (g.get_border_width(), p.get_border())
                    radius: g.get_radius_md()
                    overflow: Overflow::Hidden
                }
                view {
                    bind_style: tile_style
                    text {
                        bind_style: tile_title_style
                        { RENDER_SHADOW_SAMPLE_TITLE }
                    }
                    text {
                        bind_style: tile_meta_style
                        { shadow_meta }
                    }
                }
            }
        }
    }
}

/// Mounts the Linear Gradient Shader showcase card driven by the gradient angle signal.
///
/// # Arguments
///
/// - `Signal<usize>` - Selected gradient angle preset index signal.
/// - `ThemeTokens` - Active design tokens.
///
/// # Returns
///
/// - `NodeId` - Mounted card node.
pub(crate) fn mount_render_gradient_card(angle_idx: Signal<usize>, tokens: ThemeTokens) -> NodeId {
    let grad_box_style = move || -> Style {
        let live: ThemeTokens = use_live_tokens(tokens);
        let lp: ThemePalette = live.get_palette();
        let lg: ThemeGeometry = live.get_geometry();
        let angle: f32 = render_gradient_angle(angle_idx.get());
        let grad: LinearGradient = LinearGradient::new(angle, lp.get_primary(), lp.get_success());
        Style::default()
            .column()
            .width(Length::Percent(100.0))
            .height(Length::Px(RENDER_EFFECT_STAGE_HEIGHT))
            .padding(Edges::all(SPACE_MD))
            .justify(JustifyContent::End)
            .gap(SPACE_XS)
            .background(lp.get_primary())
            .gradient(grad)
            .border(lg.get_border_width(), lp.get_border())
            .radius(lg.get_radius_md())
            .overflow(Overflow::Hidden)
    };
    let grad_title_style = move || -> Style {
        let live: ThemeTokens = use_live_tokens(tokens);
        Style::default()
            .width(Length::Percent(100.0))
            .font_size(14.0)
            .font_weight(FontWeight::Bold)
            .color(live.get_palette().get_primary_foreground())
    };
    let grad_meta_style = move || -> Style {
        let live: ThemeTokens = use_live_tokens(tokens);
        Style::default()
            .width(Length::Percent(100.0))
            .font_size(12.0)
            .font_family(FontFamily::Monospace)
            .color(live.get_palette().get_primary_foreground())
    };
    let grad_meta = move || -> String {
        let angle: f32 = render_gradient_angle(angle_idx.get());
        format!("LinearGradient({angle:.0} deg, primary -> success)")
    };
    view! {
        EuvCard {
            title: RENDER_GRADIENT_CARD_TITLE.to_string()
            tokens: tokens
            subtitle: RENDER_GRADIENT_CARD_SUB
            view {
                bind_style: grad_box_style
                text {
                    bind_style: grad_title_style
                    { RENDER_GRADIENT_SAMPLE_TITLE }
                }
                text {
                    bind_style: grad_meta_style
                    { grad_meta }
                }
            }
        }
    }
}

/// Mounts the Partial-Damage Dirty-Rect Pulse showcase card demonstrating surgical `DIRTY_PAINT` updates.
///
/// # Arguments
///
/// - `Signal<u32>` - Dirty-rect pulse counter signal.
/// - `ThemeTokens` - Active design tokens.
///
/// # Returns
///
/// - `(NodeId, NodeId)` - Mounted card node and inner dirty-rect canvas node handle.
pub(crate) fn mount_render_damage_card(
    pulse_sig: Signal<u32>,
    tokens: ThemeTokens,
) -> (NodeId, NodeId) {
    let p: ThemePalette = tokens.get_palette();
    let g: ThemeGeometry = tokens.get_geometry();
    let mut damage_canvas_id: NodeId = NodeId::default();
    let paint_damage = move |bounds: Rect, dl: &mut DisplayList| {
        let live: ThemeTokens = live_tokens_untracked(tokens);
        let lp: ThemePalette = live.get_palette();
        let pulse: u32 = pulse_sig.get_untracked();
        let cols: usize = 4;
        let rows: usize = 2;
        let pad: f32 = 10.0;
        let gap: f32 = 6.0;
        let usable_w: f32 = (bounds.get_width() - pad * 2.0 - gap * ((cols - 1) as f32)).max(40.0);
        let usable_h: f32 =
            (bounds.get_height() - 28.0 - pad * 2.0 - gap * ((rows - 1) as f32)).max(24.0);
        let cell_w: f32 = usable_w / (cols as f32);
        let cell_h: f32 = usable_h / (rows as f32);
        let active_idx: usize = (pulse as usize) % (cols * rows);
        for row in 0..rows {
            for col in 0..cols {
                let idx: usize = row * cols + col;
                let rx: f32 = bounds.get_x() + pad + (col as f32) * (cell_w + gap);
                let ry: f32 = bounds.get_y() + 26.0 + pad + (row as f32) * (cell_h + gap);
                let is_dirty: bool = idx == active_idx;
                let fill: Color = if is_dirty {
                    lp.get_warning().with_alpha(96)
                } else {
                    lp.get_card()
                };
                let stroke: Color = if is_dirty {
                    lp.get_warning()
                } else {
                    lp.get_border()
                };
                dl.push(DrawCommand::FillRoundedRect {
                    rect: Rect::new(rx, ry, cell_w, cell_h),
                    color: fill,
                    radius: CornerRadius::all(6.0),
                    border: Border::new(if is_dirty { 2.0 } else { 1.0 }, stroke),
                });
            }
        }
        let mut hud_style: TextStyle = TextStyle::default();
        hud_style
            .set_font_size(11.5)
            .set_weight(FontWeight::SemiBold)
            .set_color(lp.get_foreground());
        dl.push(DrawCommand::TextRun {
            rect: Rect::new(
                bounds.get_x() + 10.0,
                bounds.get_y() + 8.0,
                (bounds.get_width() - 20.0).max(1.0),
                18.0,
            ),
            text: format!("DIRTY_PAINT Pulses: {pulse} | Active Tile: #{active_idx}"),
            style: hud_style,
        });
    };
    let card: NodeId = view! {
        EuvCard {
            title: RENDER_DAMAGE_CARD_TITLE.to_string()
            tokens: tokens
            subtitle: RENDER_DAMAGE_CARD_SUB
            canvas {
                node_ref: damage_canvas_id
                style: {
                    width: Length::Percent(100.0)
                    height: Length::Px(RENDER_EFFECT_STAGE_HEIGHT)
                    background: p.get_muted()
                    border: (g.get_border_width(), p.get_border())
                    radius: g.get_radius_md()
                }
                painter: paint_damage
            }
        }
    };
    (card, damage_canvas_id)
}

/// Mounts the Rendering & GPU Effects studio page with strictly widget-scoped controls.
///
/// # Arguments
///
/// - `&ShowcaseState` - Reactive showcase state.
/// - `ThemeTokens` - Active design tokens.
///
/// # Returns
///
/// - `NodeId` - Mounted rendering page node.
pub fn mount_render_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
    let p: ThemePalette = tokens.get_palette();
    let ctx: Context = current_context();
    let mode_idx: Signal<usize> = state.get_render_mode_index();
    let blur_idx: Signal<usize> = Signal::new(1);
    let shadow_idx: Signal<usize> = Signal::new(1);
    let angle_idx: Signal<usize> = Signal::new(1);
    let damage_pulse: Signal<u32> = Signal::new(0);
    let (vector_card, vector_canvas_id): (NodeId, NodeId) =
        mount_render_vector_card(mode_idx, tokens);
    let (blur_card, glass_id): (NodeId, NodeId) = mount_render_blur_card(blur_idx, tokens);
    let shadow_card: NodeId = mount_render_shadow_card(shadow_idx, tokens);
    let gradient_card: NodeId = mount_render_gradient_card(angle_idx, tokens);
    let (damage_card, damage_canvas_id): (NodeId, NodeId) =
        mount_render_damage_card(damage_pulse, tokens);
    let effects_grid: NodeId =
        mount_responsive_grid(vec![blur_card, shadow_card, gradient_card, damage_card], 2);
    let pulse_scene: SceneHandle = ctx.get_scene().clone();
    let on_pulse_dirty = move |_: &UiEvent| {
        let _: bool = damage_pulse.update(|n: &mut u32| *n = n.saturating_add(1));
        pulse_scene.mark_dirty(damage_canvas_id, DIRTY_PAINT);
    };
    let pulse_readout = move || -> String {
        format!(
            "Surgical DIRTY_PAINT count: {} (zero global layout rebuild)",
            damage_pulse.get()
        )
    };
    let pipeline_card: NodeId = view! {
        EuvCard {
            title: RENDER_PIPELINE_CARD_TITLE.to_string()
            tokens: tokens
            subtitle: RENDER_PIPELINE_CARD_SUB
            EuvSegmented {
                options: vec![
                    MODE_AUTO.to_string(),
                    MODE_SOFTWARE.to_string(),
                    MODE_HARDWARE.to_string(),
                    MODE_HYBRID.to_string(),
                ]
                selected: mode_idx
                tokens: tokens
            }
        }
    };
    let controls_card: NodeId = view! {
        EuvCard {
            title: RENDER_CONTROLS_CARD_TITLE.to_string()
            tokens: tokens
            subtitle: RENDER_CONTROLS_CARD_SUB
            column {
                style: {
                    width: Length::Percent(100.0)
                    gap: SPACE_SM
                }
                text {
                    style: {
                        width: Length::Percent(100.0)
                        font_size: 12.0
                        font_weight: FontWeight::Medium
                        color: p.get_muted_foreground()
                    }
                    { RENDER_LABEL_BLUR_RADIUS }
                }
                EuvSegmented {
                    options: vec![
                        RENDER_BLUR_OPT_8.to_string(),
                        RENDER_BLUR_OPT_16.to_string(),
                        RENDER_BLUR_OPT_24.to_string(),
                    ]
                    selected: blur_idx
                    tokens: tokens
                }
                text {
                    style: {
                        width: Length::Percent(100.0)
                        font_size: 12.0
                        font_weight: FontWeight::Medium
                        color: p.get_muted_foreground()
                    }
                    { RENDER_LABEL_SHADOW_TIER }
                }
                EuvSegmented {
                    options: vec![
                        RENDER_SHADOW_OPT_SM.to_string(),
                        RENDER_SHADOW_OPT_MD.to_string(),
                        RENDER_SHADOW_OPT_LG.to_string(),
                    ]
                    selected: shadow_idx
                    tokens: tokens
                }
                text {
                    style: {
                        width: Length::Percent(100.0)
                        font_size: 12.0
                        font_weight: FontWeight::Medium
                        color: p.get_muted_foreground()
                    }
                    { RENDER_LABEL_GRADIENT_ANGLE }
                }
                EuvSegmented {
                    options: vec![
                        RENDER_ANGLE_0.to_string(),
                        RENDER_ANGLE_45.to_string(),
                        RENDER_ANGLE_90.to_string(),
                        RENDER_ANGLE_135.to_string(),
                    ]
                    selected: angle_idx
                    tokens: tokens
                }
                EuvActionRow {
                    EuvButton {
                        label: RENDER_BTN_PULSE_DIRTY.to_string()
                        tokens: tokens
                        sm()
                        on_click: on_pulse_dirty
                    }
                }
                text {
                    style: {
                        width: Length::Percent(100.0)
                        font_size: 12.0
                        font_family: FontFamily::Monospace
                        color: p.get_primary()
                    }
                    { pulse_readout }
                }
            }
        }
    };
    let rail: NodeId = view! {
        column {
            style: {
                width: Length::Percent(100.0)
                gap: SPACE_MD
            }
            { pipeline_card }
            { controls_card }
        }
    };
    let main: NodeId = view! {
        column {
            style: {
                width: Length::Percent(100.0)
                gap: SPACE_MD
            }
            { vector_card }
            { effects_grid }
        }
    };
    let studio: NodeId = mount_studio_layout(main, rail);
    let page: NodeId = view! {
        EuvPage {
            title: RENDER_TITLE.to_string()
            subtitle: RENDER_SUBTITLE.to_string()
            tokens: tokens
            { studio }
        }
    };
    let scene_for_mode: SceneHandle = ctx.get_scene().clone();
    let scene_for_blur: SceneHandle = ctx.get_scene().clone();
    let (render_scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
        let _: Effect = Effect::new(move || {
            let _: usize = mode_idx.get();
            scene_for_mode.mark_dirty(vector_canvas_id, DIRTY_PAINT);
        });
        Effect::new(move || {
            let radius: f32 = render_blur_radius(blur_idx.get());
            scene_for_blur.with_write(
                |tree: &mut SceneTree| {
                    tree.set_backdrop_blur(glass_id, radius);
                    tree.mark_dirty(glass_id, DIRTY_PAINT);
                },
                (),
            );
        })
    });
    ctx.get_scene().with_write(
        |tree: &mut SceneTree| {
            tree.attach_scope(page, render_scope);
        },
        (),
    );
    page
}