Skip to main content

euv_example/state/
struct.rs

1use super::*;
2
3/// Decoded Media Studio sample assets assembled off the UI critical path and committed atomically.
4#[derive(Clone, Getter)]
5pub struct MediaSampleBundle {
6    /// Decoded LZW GIF89a animation sample.
7    pub(crate) gif: GifAnimation,
8    /// Sample LIVE Photo motion asset.
9    pub(crate) live: LivePhotoAsset,
10    /// Decoded ISOBMFF MP4 HDR video track.
11    pub(crate) video: VideoTrack,
12    /// Synthesized WAV audio waveform track.
13    pub(crate) audio: AudioTrack,
14    /// Multi-page native PDF sample document.
15    pub(crate) pdf: PdfDocument,
16}
17
18/// Pre-built `.wasm` OTA registry entry `(url, bytes, etag, fault)` generated off the UI critical path.
19#[derive(Clone, Getter)]
20pub struct WasmRegistryEntry {
21    /// Target CDN bundle URL.
22    pub(crate) url: String,
23    /// Encoded WebAssembly module bytes.
24    pub(crate) bytes: Vec<u8>,
25    /// Cache ETag token for conditional fetches.
26    pub(crate) etag: String,
27    /// Fault injection mode exercised by the registry fetcher.
28    #[get(type(copy))]
29    pub(crate) fault: WasmFaultKind,
30}
31
32/// Collection of pre-built `.wasm` OTA registry payloads generated off the UI critical path.
33#[derive(Clone, Getter)]
34pub struct WasmSampleBundle {
35    /// Ordered list of registry entries ready to register on the UI thread.
36    pub(crate) entries: Vec<WasmRegistryEntry>,
37}
38
39/// Lazily initialized signals powering the `/reactive` showcase page.
40#[derive(Clone, Copy, Getter)]
41pub struct ReactiveSignals {
42    /// Interactive counter signal for fine-grained reactivity demos.
43    #[get(type(copy))]
44    pub(crate) counter: Signal<i32>,
45    /// Derived memo computing `counter * 2` without redundant notifications.
46    #[get(type(copy))]
47    pub(crate) doubled: Memo<i32>,
48}
49
50/// Lazily initialized signals powering the `/render` and `/window` showcase pages.
51#[derive(Clone, Copy, Getter)]
52pub struct RenderWindowSignals {
53    /// Active component-scoped demo render pipeline preview index (`0 = Auto`, `1 = Software`, `2 = Hardware`, `3 = Hybrid`).
54    #[get(type(copy))]
55    pub(crate) render_mode_index: Signal<usize>,
56    /// Active component-scoped demo FPS cap index on `/window` (`0 = Native Uncapped` .. `6 = 360`).
57    #[get(type(copy))]
58    pub(crate) demo_fps_cap_index: Signal<usize>,
59    /// Controlled fullscreen window toggle state.
60    #[get(type(copy))]
61    pub(crate) fullscreen: Signal<bool>,
62    /// Live Dynamic Island / Live Activity active state.
63    #[get(type(copy))]
64    pub(crate) island_active: Signal<bool>,
65    /// Live Dynamic Island progress percentage (`0..=100`).
66    #[get(type(copy))]
67    pub(crate) island_progress: Signal<u8>,
68    /// Live Camera system permission status text.
69    #[get(type(copy))]
70    pub(crate) camera_perm_status: Signal<String>,
71    /// Live protocol registration and deep link telemetry text.
72    #[get(type(copy))]
73    pub(crate) protocol_status: Signal<String>,
74    /// Total accessibility live announcements emitted interactively.
75    #[get(type(copy))]
76    pub(crate) a11y_announcements: Signal<u32>,
77    /// Total haptic pulses emitted interactively.
78    #[get(type(copy))]
79    pub(crate) haptic_pulses: Signal<u32>,
80    /// Simulated target platform index for cross-platform Dynamic Island & permissions matrix (`0..7`).
81    #[get(type(copy))]
82    pub(crate) os_target_platform_idx: Signal<usize>,
83    /// Active Dynamic Island presentation mode index (`0..6`).
84    #[get(type(copy))]
85    pub(crate) island_mode_idx: Signal<usize>,
86    /// Live notification delivery stack displayed via `EuvSonner`.
87    #[get(type(copy))]
88    pub(crate) system_notifications: Signal<Vec<(String, String)>>,
89    /// Per-permission status map across all 14 `SystemPermission` categories.
90    #[get(type(copy))]
91    pub(crate) permission_statuses: Signal<Vec<PermissionStatus>>,
92}
93
94/// Lazily initialized signals powering the `/forms` showcase page.
95#[derive(Clone, Copy, Getter)]
96pub struct FormsSignals {
97    /// Controlled form text input value.
98    #[get(type(copy))]
99    pub(crate) username: Signal<String>,
100    /// Controlled multi-line textarea value.
101    #[get(type(copy))]
102    pub(crate) bio: Signal<String>,
103    /// Controlled numeric stepper value.
104    #[get(type(copy))]
105    pub(crate) stepper_value: Signal<i64>,
106    /// Controlled radio group selection index.
107    #[get(type(copy))]
108    pub(crate) radio_index: Signal<usize>,
109    /// Controlled continuous slider value.
110    #[get(type(copy))]
111    pub(crate) slider_value: Signal<f32>,
112    /// Controlled select dropdown index.
113    #[get(type(copy))]
114    pub(crate) select_index: Signal<usize>,
115    /// Controlled select dropdown open state.
116    #[get(type(copy))]
117    pub(crate) select_open: Signal<bool>,
118    /// Controlled star rating value.
119    #[get(type(copy))]
120    pub(crate) rating_value: Signal<usize>,
121    /// Controlled toggle pill pressed state.
122    #[get(type(copy))]
123    pub(crate) pin_toggled: Signal<bool>,
124    /// Controlled toggle switch for hardware acceleration preference.
125    #[get(type(copy))]
126    pub(crate) hardware_accel: Signal<bool>,
127    /// Controlled checkbox for terms acknowledgment.
128    #[get(type(copy))]
129    pub(crate) agree_terms: Signal<bool>,
130    /// Controlled tab bar index.
131    #[get(type(copy))]
132    pub(crate) active_tab: Signal<usize>,
133    /// Controlled pagination page number.
134    #[get(type(copy))]
135    pub(crate) page_index: Signal<usize>,
136    /// Controlled steps indicator active index.
137    #[get(type(copy))]
138    pub(crate) step_index: Signal<usize>,
139    /// Controlled accordion expanded item index.
140    #[get(type(copy))]
141    pub(crate) accordion_open: Signal<Option<usize>>,
142    /// Controlled accent color selection for `EuvColorPicker`.
143    #[get(type(copy))]
144    pub(crate) picker_color: Signal<Color>,
145    /// Controlled 24-hour `(hour, minute)` selection for `EuvTimePicker`.
146    #[get(type(copy))]
147    pub(crate) picker_time: Signal<(u8, u8)>,
148    /// Controlled dynamic tag list for `EuvTagInput`.
149    #[get(type(copy))]
150    pub(crate) tag_items: Signal<Vec<String>>,
151    /// Controlled selected node label for interactive `EuvTree`.
152    #[get(type(copy))]
153    pub(crate) tree_selected: Signal<Option<String>>,
154    /// Controlled active breadcrumb index for interactive `EuvBreadcrumb`.
155    #[get(type(copy))]
156    pub(crate) breadcrumb_active: Signal<usize>,
157}
158
159/// Lazily initialized signals powering the `/overlays` showcase page.
160#[derive(Clone, Copy, Getter)]
161pub struct OverlaysSignals {
162    /// Controlled modal visibility flag.
163    #[get(type(copy))]
164    pub(crate) modal_open: Signal<bool>,
165    /// Controlled drawer visibility flag.
166    #[get(type(copy))]
167    pub(crate) drawer_open: Signal<bool>,
168    /// Controlled bottom sheet visibility flag.
169    #[get(type(copy))]
170    pub(crate) sheet_open: Signal<bool>,
171    /// Controlled popover visibility flag.
172    #[get(type(copy))]
173    pub(crate) popover_open: Signal<bool>,
174    /// Controlled dropdown menu open flag.
175    #[get(type(copy))]
176    pub(crate) dropdown_open: Signal<bool>,
177    /// Controlled dropdown last selected index.
178    #[get(type(copy))]
179    pub(crate) dropdown_selected: Signal<Option<usize>>,
180    /// Controlled toast banner visibility flag.
181    #[get(type(copy))]
182    pub(crate) toast_visible: Signal<bool>,
183    /// Controlled corner notification visibility flag.
184    #[get(type(copy))]
185    pub(crate) notif_visible: Signal<bool>,
186    /// Controlled loading overlay active flag.
187    #[get(type(copy))]
188    pub(crate) loading_active: Signal<bool>,
189}
190
191/// Lazily initialized signals powering the `/data` virtualized list page.
192#[derive(Clone, Copy, Getter)]
193pub struct DataSignals {
194    /// Reactive vertical scroll offset driving the 10,000-row virtualized list.
195    #[get(type(copy))]
196    pub(crate) list_scroll_y: Signal<f32>,
197}
198
199/// Lazily initialized signals powering the `/game3d` PBR + BVH ray-tracing page.
200#[derive(Clone, Copy, Debug, Getter)]
201pub struct Engine3dSignals {
202    /// Shared mutable runtime 3D graphics/ray-tracing configuration adjusted live from UI controls.
203    #[get(type(copy))]
204    pub(crate) engine3d_quality: Signal<RenderQualityConfig>,
205    /// Reactive 3D quality preset index (`0=Low, 1=Medium, 2=High, 3=Ultra, 4=Cinematic`).
206    #[get(type(copy))]
207    pub(crate) engine3d_preset_idx: Signal<usize>,
208    /// Reactive 3D ray-tracing mode index (`0=Off, 1=Shadows, 2=Shadows+Refl, 3=Full GI`).
209    #[get(type(copy))]
210    pub(crate) engine3d_rt_idx: Signal<usize>,
211    /// Reactive 3D internal resolution scale percentage (`40.0..=125.0`).
212    #[get(type(copy))]
213    pub(crate) engine3d_res_scale: Signal<f32>,
214    /// Reactive 3D open-world time of day (`6.0..=23.0` hours).
215    #[get(type(copy))]
216    pub(crate) engine3d_time_of_day: Signal<f32>,
217    /// Pending live 3D model import request counter consumed on the next 3D tick.
218    #[get(type(copy))]
219    pub(crate) engine3d_import_queue: Signal<u64>,
220    /// Human-readable status of the most recent 3D model import.
221    #[get(type(copy))]
222    pub(crate) engine3d_import_status: Signal<String>,
223    /// Active 3D camera perspective mode (`0=Chase, 1=Hood, 2=Orbit, 3=Aerial`).
224    #[get(type(copy))]
225    pub(crate) engine3d_camera_mode: Signal<u8>,
226    /// Active 3D temporal upscaling mode (`0=Native, 1=TSR 67%, 2=TSR 50%`).
227    #[get(type(copy))]
228    pub(crate) engine3d_tsr_idx: Signal<usize>,
229    /// Active 3D atmosphere mood preset (`0=Sunset, 1=Rainy Night, 2=Noon, 3=Midnight`).
230    #[get(type(copy))]
231    pub(crate) engine3d_atmosphere_idx: Signal<usize>,
232    /// Fullscreen portal visibility flag for the 3D open-world viewport.
233    #[get(type(copy))]
234    pub(crate) engine3d_fullscreen_open: Signal<bool>,
235}
236
237/// Lazily initialized signals powering the `/dynamic` OTA & WASM showcase page.
238#[derive(Clone, Copy, Getter)]
239pub struct DynamicSignals {
240    /// Sibling counter preserved untouched during surgical component-level dynamic updates.
241    #[get(type(copy))]
242    pub(crate) sibling_counter: Signal<i32>,
243    /// Human-readable log of the most recent action dispatched from a dynamically updated control.
244    #[get(type(copy))]
245    pub(crate) dynamic_action_log: Signal<String>,
246    /// Simulated offline network mode toggle for verifying verified offline WASM cache hits.
247    #[get(type(copy))]
248    pub(crate) wasm_offline: Signal<bool>,
249    /// Live human-readable readout of the latest dynamic WASM download or fault verification case.
250    #[get(type(copy))]
251    pub(crate) wasm_fault_status: Signal<String>,
252    /// Active background worker handle building `.wasm` OTA fixtures off the UI thread.
253    #[get(type(copy))]
254    pub(crate) wasm_bg_task: Signal<Option<BackgroundTask<WasmSampleBundle>>>,
255}
256
257/// Lazily initialized signals powering the `/lab` UI & Edge Lab page.
258#[derive(Clone, Copy, Getter)]
259pub struct LabSignals {
260    /// Controlled shadcn `EuvAlertDialog` open state.
261    #[get(type(copy))]
262    pub(crate) alert_dialog_open: Signal<bool>,
263    /// Controlled shadcn `EuvAlertDialog` confirmed status.
264    #[get(type(copy))]
265    pub(crate) alert_dialog_confirmed: Signal<bool>,
266    /// Controlled shadcn `EuvCollapsible` expanded state.
267    #[get(type(copy))]
268    pub(crate) collapsible_open: Signal<bool>,
269    /// Controlled shadcn `EuvToggleGroup` active option index.
270    #[get(type(copy))]
271    pub(crate) toggle_group_index: Signal<usize>,
272    /// Controlled shadcn `EuvInputOtp` passcode string.
273    #[get(type(copy))]
274    pub(crate) otp_code: Signal<String>,
275    /// Controlled shadcn `EuvCommand` search filter text.
276    #[get(type(copy))]
277    pub(crate) command_query: Signal<String>,
278    /// Controlled shadcn `EuvCommand` selected action index.
279    #[get(type(copy))]
280    pub(crate) command_selected: Signal<Option<usize>>,
281    /// Controlled shadcn `EuvHoverCard` open flag.
282    #[get(type(copy))]
283    pub(crate) hover_card_open: Signal<bool>,
284    /// Controlled shadcn `EuvCalendar` selected day of month.
285    #[get(type(copy))]
286    pub(crate) calendar_day: Signal<u32>,
287    /// Controlled shadcn `EuvMenubar` active menu index.
288    #[get(type(copy))]
289    pub(crate) menubar_active: Signal<Option<usize>>,
290    /// Controlled shadcn `EuvCarousel` active slide index.
291    #[get(type(copy))]
292    pub(crate) carousel_index: Signal<usize>,
293    /// Controlled search query for `EuvCombobox` in the UI & Edge Lab.
294    #[get(type(copy))]
295    pub(crate) lab_combobox_query: Signal<String>,
296    /// Controlled selected index for `EuvCombobox`.
297    #[get(type(copy))]
298    pub(crate) lab_combobox_selected: Signal<usize>,
299    /// Controlled open flag for `EuvCombobox`.
300    #[get(type(copy))]
301    pub(crate) lab_combobox_open: Signal<bool>,
302    /// Controlled filter string for `EuvDataTable`.
303    #[get(type(copy))]
304    pub(crate) lab_table_filter: Signal<String>,
305    /// Controlled sort order for `EuvDataTable`.
306    #[get(type(copy))]
307    pub(crate) lab_table_sort_asc: Signal<bool>,
308    /// Controlled selected row index for `EuvDataTable`.
309    #[get(type(copy))]
310    pub(crate) lab_table_selected: Signal<Option<usize>>,
311    /// Controlled selected day for `EuvDatePicker`.
312    #[get(type(copy))]
313    pub(crate) lab_date_day: Signal<u32>,
314    /// Controlled open flag for `EuvDatePicker`.
315    #[get(type(copy))]
316    pub(crate) lab_date_open: Signal<bool>,
317    /// Controlled domain input value for `EuvInputGroup`.
318    #[get(type(copy))]
319    pub(crate) lab_input_group_val: Signal<String>,
320    /// Controlled selected index for `EuvNativeSelect`.
321    #[get(type(copy))]
322    pub(crate) lab_native_select_idx: Signal<usize>,
323    /// Controlled active dropdown index for `EuvNavigationMenu`.
324    #[get(type(copy))]
325    pub(crate) lab_nav_menu_active: Signal<Option<usize>>,
326    /// Controlled split ratio for `EuvResizable`.
327    #[get(type(copy))]
328    pub(crate) lab_split_ratio: Signal<f32>,
329    /// Toggle controlling whether the nested edge-case box blocks scroll penetration (`true`) or allows chaining (`false`).
330    #[get(type(copy))]
331    pub(crate) lab_block_scroll_chain: Signal<bool>,
332    /// Toggle controlling whether the nested edge-case box stops click event bubbling (`true`) or allows bubbling (`false`).
333    #[get(type(copy))]
334    pub(crate) lab_stop_click_bubble: Signal<bool>,
335    /// Counter tracking clicks received by the outer parent card in the event bubbling test.
336    #[get(type(copy))]
337    pub(crate) lab_parent_clicks: Signal<u32>,
338    /// Counter tracking clicks received by the inner button in the event bubbling test.
339    #[get(type(copy))]
340    pub(crate) lab_child_clicks: Signal<u32>,
341    /// Persistent counter proving live resize never destroys or resets page state.
342    #[get(type(copy))]
343    pub(crate) lab_resize_preserve_count: Signal<u32>,
344    /// Controlled direction mode toggle (`false=LTR, true=RTL`).
345    #[get(type(copy))]
346    pub(crate) lab_rtl_mode: Signal<bool>,
347}
348
349/// Lazily initialized signals powering the `/media` Media Studio page.
350#[derive(Clone, Copy, Getter)]
351pub struct MediaSignals {
352    /// Reactive animated GIF playback state for the Media Studio showcase.
353    #[get(type(copy))]
354    pub(crate) media_gif: Signal<GifAnimation>,
355    /// Reactive LIVE Photo motion state for the Media Studio showcase.
356    #[get(type(copy))]
357    pub(crate) media_live: Signal<LivePhotoAsset>,
358    /// Reactive cross-platform video track state for the Media Studio showcase.
359    #[get(type(copy))]
360    pub(crate) media_video: Signal<VideoTrack>,
361    /// Reactive WAV audio track and waveform state for the Media Studio showcase.
362    #[get(type(copy))]
363    pub(crate) media_audio: Signal<AudioTrack>,
364    /// Reactive multi-page PDF document state for the Media Studio showcase.
365    #[get(type(copy))]
366    pub(crate) media_pdf: Signal<PdfDocument>,
367    /// Most recently clicked native HTML hyperlink URI in the Media Studio showcase.
368    #[get(type(copy))]
369    pub(crate) media_html_link_log: Signal<String>,
370    /// Reactive indicator set while Media Studio codecs decode on a background worker thread.
371    #[get(type(copy))]
372    pub(crate) media_loading: Signal<bool>,
373    /// Active background worker handle decoding Media Studio sample codecs off the UI thread.
374    #[get(type(copy))]
375    pub(crate) media_bg_task: Signal<Option<BackgroundTask<MediaSampleBundle>>>,
376}
377
378/// Lazily initialized signals powering the `/markdown` Markdown & Code Studio page.
379#[derive(Clone, Copy, Getter)]
380pub struct MarkdownSignals {
381    /// Latest copied code block telemetry readout on `/markdown`.
382    #[get(type(copy))]
383    pub(crate) markdown_copy_log: Signal<String>,
384    /// Latest clicked Markdown hyperlink URL readout on `/markdown`.
385    #[get(type(copy))]
386    pub(crate) markdown_link_log: Signal<String>,
387    /// Total GFM checklist tasks toggled interactively on `/markdown`.
388    #[get(type(copy))]
389    pub(crate) markdown_tasks_toggled: Signal<u32>,
390    /// Selected code example language tab index on `/markdown` (`0=Rust, 1=TS, 2=JSON, 3=Diff`).
391    #[get(type(copy))]
392    pub(crate) markdown_lang_tab: Signal<usize>,
393    /// Toggle controlling whether text inside the Markdown & Code Studio is selectable.
394    #[get(type(copy))]
395    pub(crate) markdown_selectable: Signal<bool>,
396}
397
398/// Lazily initialized signals powering the `/stress` Stress Lab page.
399#[derive(Clone, Copy, Getter)]
400pub struct StressSignals {
401    /// Live interactive UI stress benchmark results for `/stress`.
402    #[get(type(copy))]
403    pub(crate) stress_results: Signal<Vec<StressCaseResult>>,
404    /// Latest interactive UI stress benchmark status readout for `/stress`.
405    #[get(type(copy))]
406    pub(crate) stress_summary: Signal<String>,
407}
408
409/// Lazily initialized signals powering the `/charts` ECharts Studio page.
410#[derive(Clone, Copy, Getter)]
411pub struct ChartsSignals {
412    /// Active category filter index on `/charts` (`0=All`, `1=Cartesian`, `2=Financial`, `3=Radial`, `4=Hierarchy`, `5=Geo & Flow`).
413    #[get(type(copy))]
414    pub(crate) charts_category_idx: Signal<usize>,
415    /// Live interaction readout updated when hovering, clicking, toggling legends, or dragging DataZoom on `/charts`.
416    #[get(type(copy))]
417    pub(crate) charts_event_log: Signal<String>,
418}
419
420/// Lazily initialized signals powering the `/water` gyroscope liquid physics studio page.
421#[derive(Clone, Copy, Debug, Getter)]
422pub struct WaterSignals {
423    /// Liquid tank fill ratio percentage (`25.0..=80.0`).
424    #[get(type(copy))]
425    pub(crate) fill_pct: Signal<f32>,
426    /// Active viscosity preset index (`0 = Water 1.0 mPa·s`, `1 = Light Oil`, `2 = Honey`).
427    #[get(type(copy))]
428    pub(crate) viscosity_idx: Signal<usize>,
429    /// Toggle controlling whether Archimedes buoyant bodies (orb and ice cube) are active.
430    #[get(type(copy))]
431    pub(crate) buoyant_enabled: Signal<bool>,
432    /// Fullscreen portal visibility flag for the liquid tank.
433    #[get(type(copy))]
434    pub(crate) fullscreen_open: Signal<bool>,
435    /// Status message displayed for browser/OS motion sensor permission requests.
436    #[get(type(copy))]
437    pub(crate) sensor_perm_status: Signal<String>,
438    /// Reactive live physics, gravity, and frame-timing telemetry mirrored from `GyroLiquidGameScene`.
439    #[get(type(copy))]
440    pub(crate) stats: Signal<GyroLiquidStats>,
441}
442
443/// Zero-boot-cost lazy `GameScene` wrapper deferring `GyroLiquidGameScene` allocation until `/water` is visited.
444#[derive(Clone, Debug, Getter)]
445pub struct LazyWaterScene {
446    /// Shared lazily allocated liquid scene handle (`None` at boot until `/water` is visited).
447    pub(crate) scene_cell: Rc<RefCell<Option<GyroLiquidGameScene>>>,
448    /// Shared lazy cell holding `/water` control and telemetry signals.
449    pub(crate) signals_cell: Rc<Cell<Option<WaterSignals>>>,
450    /// Frame counter throttling steady-state timing-only telemetry signal notifications to eliminate redundant per-frame UI text re-layout.
451    pub(crate) stats_throttle_tick: Rc<Cell<u8>>,
452}
453
454/// Reactive application state powering the cross-platform showcase with minimal boot signals and lazy route-scoped signal groups.
455#[derive(Clone, Getter)]
456pub struct ShowcaseState {
457    /// Active route path signal.
458    #[get(type(copy))]
459    pub(crate) route: Signal<String>,
460    /// Root ownership scope retaining lazily materialized showcase signals across route evictions and global WASM slot swaps.
461    #[get(type(copy))]
462    pub(crate) state_scope: Scope,
463    /// Active reactive theme state across all 17 design schemes and light/dark modes.
464    pub(crate) theme: UiThemeState,
465    /// Embedded deterministic 2D physics game host rendered directly inside `euv`.
466    pub(crate) game_host: GameEngineHost,
467    /// Embedded AAA 3D open-world PBR + BVH ray-tracing game host.
468    pub(crate) game3d_host: GameEngineHost,
469    /// Embedded real-time SI PBF gyroscope liquid water host (zero allocation at boot until `/water` is visited).
470    pub(crate) water_host: GameEngineHost,
471    /// Lazily materialized `GyroLiquidGameScene` handle shared between `water_host` and `/water` UI controls.
472    pub(crate) water_scene_cell: Rc<RefCell<Option<GyroLiquidGameScene>>>,
473    /// Shared hub managing live component-level and page-level dynamic OTA updates.
474    pub(crate) dynamic_hub: DynamicUpdateHub,
475    /// Cross-platform in-memory WASM CDN registry serving real `.wasm` binaries and fault scenarios.
476    pub(crate) wasm_registry: RegistryWasmFetcher,
477    /// Dynamic WASM download, verification, sandbox execution, cache, and rollback manager.
478    pub(crate) wasm_manager: WasmDynamicManager,
479    /// Controlled global Command Palette modal visibility flag.
480    #[get(type(copy))]
481    pub(crate) cmd_palette_open: Signal<bool>,
482    /// Controlled global Command Palette filter query.
483    #[get(type(copy))]
484    pub(crate) cmd_palette_query: Signal<String>,
485    /// Reactive preference controlling whether shell chrome auto-hides on content scroll.
486    #[get(type(copy))]
487    pub(crate) auto_hide_chrome: Signal<bool>,
488    /// Reactive preference controlling live FPS counter pill visibility in the topbar.
489    #[get(type(copy))]
490    pub(crate) show_fps_hud: Signal<bool>,
491    /// Reactive preference controlling horizontal swipe navigation across registered routes.
492    #[get(type(copy))]
493    pub(crate) swipe_routing: Signal<bool>,
494    /// Reactive accessibility preference minimizing non-essential animations.
495    #[get(type(copy))]
496    pub(crate) reduced_motion: Signal<bool>,
497    /// Adaptive render router switch mode (`false` = Recommend Only, `true` = Auto Switch).
498    #[get(type(copy))]
499    pub(crate) adaptive_auto_switch: Signal<bool>,
500    /// Active render backend reported honestly for the current host session.
501    #[get(type(copy))]
502    pub(crate) adaptive_active_backend: Signal<String>,
503    /// Recommended render backend selected by the adaptive router.
504    #[get(type(copy))]
505    pub(crate) adaptive_recommended_backend: Signal<String>,
506    /// Whether a CPU software mirror is currently active in the presentation path.
507    #[get(type(copy))]
508    pub(crate) adaptive_cpu_mirror_active: Signal<bool>,
509    /// Honest present timing source (`Compositor Measured`, `Submission Proxy`, or `Unobservable`).
510    #[get(type(copy))]
511    pub(crate) adaptive_present_timing_source: Signal<String>,
512    /// Active dirty-region upload strategy (`Direct GPU`, `Multi-Rect Dirty`, `Merged BBox`, `Full Frame`).
513    #[get(type(copy))]
514    pub(crate) adaptive_upload_strategy: Signal<String>,
515    /// Cumulative seamless backend handoff attempts.
516    #[get(type(copy))]
517    pub(crate) adaptive_handoff_attempts: Signal<u64>,
518    /// Cumulative seamless backend handoff successes.
519    #[get(type(copy))]
520    pub(crate) adaptive_handoff_successes: Signal<u64>,
521    /// Cumulative seamless backend handoff aborts.
522    #[get(type(copy))]
523    pub(crate) adaptive_handoff_aborts: Signal<u64>,
524    /// Persistent lazy-loading page-lifecycle router shared across the showcase shell.
525    pub(crate) router: EuvRouter,
526    /// Guard flag ensuring routes are registered on `router` once.
527    pub(crate) router_ready: Rc<Cell<bool>>,
528    /// Total lazy page `on_mount` lifecycle hooks executed.
529    #[get(type(copy))]
530    pub(crate) lifecycle_mounts: Signal<u32>,
531    /// Total `PageRetention::Freeze` `on_freeze` hooks executed on route leave.
532    #[get(type(copy))]
533    pub(crate) lifecycle_freezes: Signal<u32>,
534    /// Total `on_resume` hooks executed when returning to a frozen page.
535    #[get(type(copy))]
536    pub(crate) lifecycle_resumes: Signal<u32>,
537    /// Total `on_destroy` hooks executed on page disposal.
538    #[get(type(copy))]
539    pub(crate) lifecycle_destroys: Signal<u32>,
540    /// Latest human-readable page lifecycle transition log line.
541    #[get(type(copy))]
542    pub(crate) lifecycle_last_event: Signal<String>,
543    /// Rolling log of recent normalized cross-platform `SystemEvent` entries.
544    #[get(type(copy))]
545    pub(crate) system_event_log: Signal<Vec<String>>,
546    /// Total count of normalized `SystemEvent` notifications observed in this session.
547    #[get(type(copy))]
548    pub(crate) system_event_count: Signal<u32>,
549    /// Reactive flag indicating whether showcase pages are currently frozen in background.
550    #[get(type(copy))]
551    pub(crate) bg_frozen: Signal<bool>,
552    /// Total count of background freeze transitions executed across showcase pages.
553    #[get(type(copy))]
554    pub(crate) bg_freeze_count: Signal<u32>,
555    /// Total count of lossless foreground restore transitions executed across showcase pages.
556    #[get(type(copy))]
557    pub(crate) bg_restore_count: Signal<u32>,
558    /// Snapshot of whether the 2D physics game host was running immediately before entering background.
559    pub(crate) bg_snap_game2d_running: Rc<Cell<bool>>,
560    /// Snapshot of whether the 3D ray-tracing host was running immediately before entering background.
561    pub(crate) bg_snap_game3d_running: Rc<Cell<bool>>,
562    /// Snapshot of whether the gyroscope liquid water host was running immediately before entering background.
563    pub(crate) bg_snap_water_running: Rc<Cell<bool>>,
564    /// Snapshot of whether Media Studio animated GIF playback was playing before background.
565    pub(crate) bg_snap_gif_playing: Rc<Cell<bool>>,
566    /// Snapshot of whether Media Studio LIVE Photo motion burst was playing before background.
567    pub(crate) bg_snap_live_playing: Rc<Cell<bool>>,
568    /// Snapshot of whether Media Studio video playback was playing before background.
569    pub(crate) bg_snap_video_playing: Rc<Cell<bool>>,
570    /// Snapshot of whether Media Studio audio playback was playing before background.
571    pub(crate) bg_snap_audio_playing: Rc<Cell<bool>>,
572    /// Guard flag ensuring Media Studio sample codecs/frames hydrate lazily on first `/media` visit.
573    pub(crate) media_loaded: Rc<Cell<bool>>,
574    /// Guard flag ensuring `.wasm` OTA binaries populate lazily on first `/dynamic` visit.
575    pub(crate) wasm_registry_loaded: Rc<Cell<bool>>,
576    /// Guard flag ensuring Stress Lab workload catalog hydrates lazily on first `/stress` visit.
577    pub(crate) stress_loaded: Rc<Cell<bool>>,
578    /// Guard flag ensuring ECharts Studio 20-series catalog hydrates lazily on first `/charts` visit.
579    pub(crate) charts_loaded: Rc<Cell<bool>>,
580    /// Enables off-main-thread background workers for heavy `/media`, `/dynamic`, and `/game3d` route payloads on interactive native targets.
581    pub(crate) bg_workers_enabled: Rc<Cell<bool>>,
582    /// Default host platform index applied lazily when `/window` signals initialize.
583    pub(crate) default_host_plat_idx: Rc<Cell<usize>>,
584    /// Lazily materialized `/reactive` signals (`None` at boot).
585    pub(crate) reactive_signals: Rc<Cell<Option<ReactiveSignals>>>,
586    /// Lazily materialized `/render` and `/window` signals (`None` at boot).
587    pub(crate) render_window_signals: Rc<Cell<Option<RenderWindowSignals>>>,
588    /// Lazily materialized `/forms` signals (`None` at boot).
589    pub(crate) forms_signals: Rc<Cell<Option<FormsSignals>>>,
590    /// Lazily materialized `/overlays` signals (`None` at boot).
591    pub(crate) overlays_signals: Rc<Cell<Option<OverlaysSignals>>>,
592    /// Lazily materialized `/data` signals (`None` at boot).
593    pub(crate) data_signals: Rc<Cell<Option<DataSignals>>>,
594    /// Lazily materialized `/game3d` signals (`None` at boot).
595    pub(crate) engine3d_signals: Rc<Cell<Option<Engine3dSignals>>>,
596    /// Lazily materialized `/dynamic` signals (`None` at boot).
597    pub(crate) dynamic_signals: Rc<Cell<Option<DynamicSignals>>>,
598    /// Lazily materialized `/lab` signals (`None` at boot).
599    pub(crate) lab_signals: Rc<Cell<Option<LabSignals>>>,
600    /// Lazily materialized `/media` signals (`None` at boot).
601    pub(crate) media_signals: Rc<Cell<Option<MediaSignals>>>,
602    /// Lazily materialized `/markdown` signals (`None` at boot).
603    pub(crate) markdown_signals: Rc<Cell<Option<MarkdownSignals>>>,
604    /// Lazily materialized `/stress` signals (`None` at boot).
605    pub(crate) stress_signals: Rc<Cell<Option<StressSignals>>>,
606    /// Lazily materialized `/charts` signals (`None` at boot).
607    pub(crate) charts_signals: Rc<Cell<Option<ChartsSignals>>>,
608    /// Lazily materialized `/water` signals (`None` at boot).
609    pub(crate) water_signals: Rc<Cell<Option<WaterSignals>>>,
610    /// Lazily materialized `/game` 2D fullscreen portal visibility signal shared with `DemoPhysicsScene`.
611    pub(crate) game_fullscreen_open_cell: Rc<Cell<Option<Signal<bool>>>>,
612}
613
614/// Full-featured 2D arcade arena scene powered by `GameWorld`, `PhysicsWorld2D`, `Camera2D`, `ParticleSystem`, `TileMap`, `ActionMap`, and `AudioBus`.
615#[derive(Clone, Data, Debug)]
616pub struct DemoPhysicsScene {
617    /// Generational ECS entity arena holding player, drones, projectiles, and obstacles.
618    pub(crate) world: GameWorld,
619    /// Spatial-hash 2D rigid-body physics and raycast solver.
620    pub(crate) physics: PhysicsWorld2D,
621    /// 2D follow camera with trauma-based screen shake and frustum culling.
622    #[get(type(copy))]
623    pub(crate) camera: Camera2D,
624    /// Zero-allocation pooled neon particle engine.
625    pub(crate) particles: ParticleSystem,
626    /// Frustum-culled tiled arena map with solid corner pillars.
627    pub(crate) tilemap: TileMap,
628    /// Declarative arcade input bindings (WASD, Arrows, Space/Click fire, E dash, R wave).
629    pub(crate) actions: ActionMap,
630    /// Deterministic cross-platform sound cue bus.
631    pub(crate) audio: AudioBus,
632    /// Player ship entity handle.
633    #[get(type(copy))]
634    pub(crate) player_id: EntityId,
635    /// Remaining weapon cooldown in seconds.
636    #[get(type(copy))]
637    pub(crate) fire_cooldown: f32,
638    /// Remaining dash cooldown in seconds.
639    #[get(type(copy))]
640    pub(crate) dash_cooldown: f32,
641    /// Current player arcade score.
642    #[get(type(copy))]
643    pub(crate) score: u32,
644    /// Current wave counter.
645    #[get(type(copy))]
646    pub(crate) wave: u32,
647    /// Toggle for wireframe collider debug visualization.
648    #[get(type(copy))]
649    pub(crate) show_colliders: bool,
650    /// Smoothed real-time frames-per-second telemetry.
651    #[get(type(copy))]
652    pub(crate) smoothed_fps: f32,
653    /// Total fixed physics ticks simulated.
654    #[get(type(copy))]
655    pub(crate) ticks: u64,
656    /// Last rendered viewport size in logical pixels for responsive camera framing in inline and fullscreen modes.
657    #[get(type(copy))]
658    pub(crate) viewport_size: Size,
659    /// Whether the full arena tilemap, entities, and particle pool have been lazily initialized.
660    #[get(type(copy))]
661    pub(crate) initialized: bool,
662    /// Double-buffered immutable 2D world snapshots enabling discontinuity-safe alpha interpolation.
663    pub(crate) snapshots: DoubleBufferedSnapshot<World2DSnapshot>,
664    /// Reusable per-tick despawn buffer preventing fresh `Vec` allocation during collision resolution.
665    pub(crate) to_despawn_scratch: Vec<(EntityId, Point, bool)>,
666    /// Fixed tick counter corresponding to `cached_interp`.
667    #[get(type(copy))]
668    pub(crate) last_sampled_tick: u64,
669    /// Quantized alpha (`(alpha * 1000.0).round() as i32`) corresponding to `cached_interp`.
670    #[get(type(copy))]
671    pub(crate) last_sampled_alpha_milli: i32,
672    /// Cached interpolated snapshot preventing duplicate interpolation on HUD-only repaints.
673    pub(crate) cached_interp: Option<World2DSnapshot>,
674    /// Fixed-capacity inline explosion and dash shockwave rings `(world_x, world_y, radius, life_frac)` with zero heap allocations.
675    pub(crate) shockwaves: [(f32, f32, f32, f32); 16],
676    /// Shared lazy fullscreen toggle signal allowing the `F` keyboard shortcut to toggle `/game` fullscreen.
677    pub(crate) fullscreen_open_cell: Rc<Cell<Option<Signal<bool>>>>,
678}
679
680/// Interactive AAA 3D open-world city scene with PBR shading, BVH ray tracing, model importing, and runtime settings.
681#[derive(Clone, Data, Debug)]
682pub struct DemoOpenWorld3DScene {
683    /// Open-world 3D city scene graph with instanced towers, reflective wet boulevard, and drivable GT car.
684    pub(crate) world: World3D,
685    /// Zero-allocation PBR + BVH ray-tracing renderer.
686    pub(crate) renderer: Renderer3D,
687    /// Shared arcade action bindings for driving/flying the 3D scene.
688    pub(crate) actions: ActionMap,
689    /// Shared lazy cell holding `/game3d` control signals (`None` at boot until `/game3d` is entered).
690    pub(crate) signals_cell: Rc<Cell<Option<Engine3dSignals>>>,
691    /// Root ownership scope retaining lazily materialized `/game3d` signals across route evictions.
692    #[get(type(copy))]
693    pub(crate) state_scope: Scope,
694    /// Shared flag enabling off-main-thread `World3D::create_open_world_city()` initialization on interactive native apps.
695    pub(crate) bg_workers_enabled: Rc<Cell<bool>>,
696    /// Active background task constructing the Vice Boulevard 3D city meshes and BVH off the UI thread.
697    pub(crate) bg_city_task: Option<BackgroundTask<World3D>>,
698    /// Last processed import counter.
699    #[get(type(copy))]
700    pub(crate) last_import_seq: u64,
701    /// Smoothed real-time FPS telemetry.
702    #[get(type(copy))]
703    pub(crate) smoothed_fps: f32,
704    /// Whether the 3D city meshes, materials, and BVH acceleration structure have been lazily built.
705    #[get(type(copy))]
706    pub(crate) initialized: bool,
707    /// Double-buffered immutable 3D world snapshots for high-refresh alpha interpolation and camera-cut snapping.
708    pub(crate) snapshots: DoubleBufferedSnapshot<World3DSnapshot>,
709    /// Bounded reusable RGBA8 frame pool avoiding steady-state per-frame heap allocations on CPU fallback.
710    pub(crate) frame_pool: RenderBufferPool,
711    /// Same-device GPU composite target tracking independent world and HUD dirty revisions.
712    pub(crate) gpu_target: GpuCompositeTarget,
713    /// Monotonic frame submission fence value guarding pooled 3D frame leases.
714    #[get(type(copy))]
715    pub(crate) frame_fence: u64,
716    /// Last applied 3D camera mode for instant discontinuity-safe camera-cut detection.
717    #[get(type(copy))]
718    pub(crate) last_camera_mode: u8,
719    /// Last applied 3D atmosphere preset index so manual time-of-day slider drags are preserved.
720    #[get(type(copy))]
721    pub(crate) last_atmosphere_idx: usize,
722    /// Monotonic fixed simulation tick counter for 3D snapshot commits.
723    #[get(type(copy))]
724    pub(crate) ticks: u64,
725    /// Zero-copy cached rendered 3D world frame handle reused across HUD-only overlay updates without memcpy or re-ray-tracing.
726    #[get(skip)]
727    pub(crate) cached_world_frame: Option<PooledFrameRef>,
728    /// World revision matching `cached_world_frame`.
729    #[get(type(copy))]
730    pub(crate) cached_world_rev: u64,
731    /// Quantized interpolation alpha matching `cached_world_frame`.
732    #[get(type(copy))]
733    pub(crate) cached_alpha_milli: i32,
734    /// Internal render dimensions `(width, height)` matching `cached_world_frame`.
735    #[get(type(copy))]
736    pub(crate) cached_dims: (u32, u32),
737    /// Active quality configuration matching `cached_world_frame`.
738    #[get(type(copy))]
739    pub(crate) cached_quality: RenderQualityConfig,
740    /// Measured render duration of the most recent active 3D world frame in milliseconds for closed-loop frame pacing.
741    #[get(type(copy))]
742    pub(crate) last_render_ms: f32,
743    /// Cached immutable static GPU vertex buffer built once per mesh-library change for zero-CPU-rasterization 3D rendering.
744    #[get(skip)]
745    pub(crate) gpu_mesh_buffer: Option<Arc<GpuWorld3dMeshBuffer>>,
746    /// Per-mesh `(vertex_start, vertex_count)` table paired with `gpu_mesh_buffer`.
747    pub(crate) gpu_mesh_ranges: Vec<(u32, u32)>,
748    /// Monotonic revision counter for `gpu_mesh_buffer` VRAM upload deduplication.
749    #[get(type(copy))]
750    pub(crate) gpu_mesh_rev: u64,
751    /// Mesh library length cached in `gpu_mesh_buffer` so imported models trigger an immediate refresh.
752    #[get(type(copy))]
753    pub(crate) gpu_mesh_lib_len: usize,
754}