Skip to main content

euv_example/state/
struct.rs

1use super::*;
2
3/// Reactive application state powering every interactive page of the cross-platform showcase.
4#[derive(Clone, Getter)]
5pub struct ShowcaseState {
6    /// Active route path signal.
7    #[get(type(copy))]
8    pub(crate) route: Signal<String>,
9    /// Interactive counter signal for fine-grained reactivity demos.
10    #[get(type(copy))]
11    pub(crate) counter: Signal<i32>,
12    /// Derived memo computing `counter * 2` without redundant notifications.
13    #[get(type(copy))]
14    pub(crate) doubled: Memo<i32>,
15    /// Active render mode selector index (`0 = Auto`, `1 = Software`, `2 = Hardware`, `3 = Hybrid`).
16    #[get(type(copy))]
17    pub(crate) render_mode_index: Signal<usize>,
18    /// Active reactive theme state across all 17 design schemes and light/dark modes.
19    pub(crate) theme: UiThemeState,
20    /// Controlled form text input value.
21    #[get(type(copy))]
22    pub(crate) username: Signal<String>,
23    /// Controlled multi-line textarea value.
24    #[get(type(copy))]
25    pub(crate) bio: Signal<String>,
26    /// Controlled numeric stepper value.
27    #[get(type(copy))]
28    pub(crate) stepper_value: Signal<i64>,
29    /// Controlled radio group selection index.
30    #[get(type(copy))]
31    pub(crate) radio_index: Signal<usize>,
32    /// Controlled continuous slider value.
33    #[get(type(copy))]
34    pub(crate) slider_value: Signal<f32>,
35    /// Controlled select dropdown index.
36    #[get(type(copy))]
37    pub(crate) select_index: Signal<usize>,
38    /// Controlled select dropdown open state.
39    #[get(type(copy))]
40    pub(crate) select_open: Signal<bool>,
41    /// Controlled star rating value.
42    #[get(type(copy))]
43    pub(crate) rating_value: Signal<usize>,
44    /// Controlled toggle pill pressed state.
45    #[get(type(copy))]
46    pub(crate) pin_toggled: Signal<bool>,
47    /// Controlled toggle switch for hardware acceleration preference.
48    #[get(type(copy))]
49    pub(crate) hardware_accel: Signal<bool>,
50    /// Controlled checkbox for terms acknowledgment.
51    #[get(type(copy))]
52    pub(crate) agree_terms: Signal<bool>,
53    /// Controlled modal visibility flag.
54    #[get(type(copy))]
55    pub(crate) modal_open: Signal<bool>,
56    /// Controlled drawer visibility flag.
57    #[get(type(copy))]
58    pub(crate) drawer_open: Signal<bool>,
59    /// Controlled bottom sheet visibility flag.
60    #[get(type(copy))]
61    pub(crate) sheet_open: Signal<bool>,
62    /// Controlled popover visibility flag.
63    #[get(type(copy))]
64    pub(crate) popover_open: Signal<bool>,
65    /// Controlled dropdown menu open flag.
66    #[get(type(copy))]
67    pub(crate) dropdown_open: Signal<bool>,
68    /// Controlled dropdown last selected index.
69    #[get(type(copy))]
70    pub(crate) dropdown_selected: Signal<Option<usize>>,
71    /// Controlled toast banner visibility flag.
72    #[get(type(copy))]
73    pub(crate) toast_visible: Signal<bool>,
74    /// Controlled corner notification visibility flag.
75    #[get(type(copy))]
76    pub(crate) notif_visible: Signal<bool>,
77    /// Controlled loading overlay active flag.
78    #[get(type(copy))]
79    pub(crate) loading_active: Signal<bool>,
80    /// Controlled tab bar index.
81    #[get(type(copy))]
82    pub(crate) active_tab: Signal<usize>,
83    /// Controlled pagination page number.
84    #[get(type(copy))]
85    pub(crate) page_index: Signal<usize>,
86    /// Controlled steps indicator active index.
87    #[get(type(copy))]
88    pub(crate) step_index: Signal<usize>,
89    /// Controlled accordion expanded item index.
90    #[get(type(copy))]
91    pub(crate) accordion_open: Signal<Option<usize>>,
92    /// Controlled fullscreen window toggle state.
93    #[get(type(copy))]
94    pub(crate) fullscreen: Signal<bool>,
95    /// Reactive vertical scroll offset driving the 10,000-row virtualized list.
96    #[get(type(copy))]
97    pub(crate) list_scroll_y: Signal<f32>,
98    /// Live Dynamic Island / Live Activity active state.
99    #[get(type(copy))]
100    pub(crate) island_active: Signal<bool>,
101    /// Live Dynamic Island progress percentage (`0..=100`).
102    #[get(type(copy))]
103    pub(crate) island_progress: Signal<u8>,
104    /// Live Camera system permission status text.
105    #[get(type(copy))]
106    pub(crate) camera_perm_status: Signal<String>,
107    /// Live protocol registration and deep link telemetry text.
108    #[get(type(copy))]
109    pub(crate) protocol_status: Signal<String>,
110    /// Total accessibility live announcements emitted interactively.
111    #[get(type(copy))]
112    pub(crate) a11y_announcements: Signal<u32>,
113    /// Total haptic pulses emitted interactively.
114    #[get(type(copy))]
115    pub(crate) haptic_pulses: Signal<u32>,
116    /// Embedded deterministic 2D physics game host rendered directly inside `euv`.
117    pub(crate) game_host: GameEngineHost,
118    /// Embedded AAA 3D open-world PBR + BVH ray-tracing game host.
119    pub(crate) game3d_host: GameEngineHost,
120    /// Shared mutable runtime 3D graphics/ray-tracing configuration adjusted live from UI controls.
121    #[get(type(copy))]
122    pub(crate) engine3d_quality: Signal<RenderQualityConfig>,
123    /// Reactive 3D quality preset index (`0=Low, 1=Medium, 2=High, 3=Ultra, 4=Cinematic`).
124    #[get(type(copy))]
125    pub(crate) engine3d_preset_idx: Signal<usize>,
126    /// Reactive 3D ray-tracing mode index (`0=Off, 1=Shadows, 2=Shadows+Refl, 3=Full GI`).
127    #[get(type(copy))]
128    pub(crate) engine3d_rt_idx: Signal<usize>,
129    /// Reactive 3D internal resolution scale percentage (`40.0..=125.0`).
130    #[get(type(copy))]
131    pub(crate) engine3d_res_scale: Signal<f32>,
132    /// Reactive 3D open-world time of day (`6.0..=23.0` hours).
133    #[get(type(copy))]
134    pub(crate) engine3d_time_of_day: Signal<f32>,
135    /// Pending live 3D model import request `(format, label, source)` consumed on the next 3D tick.
136    #[get(type(copy))]
137    pub(crate) engine3d_import_queue: Signal<u64>,
138    /// Human-readable status of the most recent 3D model import.
139    #[get(type(copy))]
140    pub(crate) engine3d_import_status: Signal<String>,
141    /// Active 3D camera perspective mode (`0=Chase, 1=Hood, 2=Orbit, 3=Aerial`).
142    #[get(type(copy))]
143    pub(crate) engine3d_camera_mode: Signal<u8>,
144    /// Shared hub managing live component-level and page-level dynamic OTA updates.
145    pub(crate) dynamic_hub: DynamicUpdateHub,
146    /// Sibling counter preserved untouched during surgical component-level dynamic updates.
147    #[get(type(copy))]
148    pub(crate) sibling_counter: Signal<i32>,
149    /// Human-readable log of the most recent action dispatched from a dynamically updated control.
150    #[get(type(copy))]
151    pub(crate) dynamic_action_log: Signal<String>,
152    /// Controlled shadcn `EuvAlertDialog` open state.
153    #[get(type(copy))]
154    pub(crate) alert_dialog_open: Signal<bool>,
155    /// Controlled shadcn `EuvAlertDialog` confirmed status.
156    #[get(type(copy))]
157    pub(crate) alert_dialog_confirmed: Signal<bool>,
158    /// Controlled shadcn `EuvCollapsible` expanded state.
159    #[get(type(copy))]
160    pub(crate) collapsible_open: Signal<bool>,
161    /// Controlled shadcn `EuvToggleGroup` active option index.
162    #[get(type(copy))]
163    pub(crate) toggle_group_index: Signal<usize>,
164    /// Controlled shadcn `EuvInputOtp` passcode string.
165    #[get(type(copy))]
166    pub(crate) otp_code: Signal<String>,
167    /// Controlled shadcn `EuvCommand` search filter text.
168    #[get(type(copy))]
169    pub(crate) command_query: Signal<String>,
170    /// Controlled shadcn `EuvCommand` selected action index.
171    #[get(type(copy))]
172    pub(crate) command_selected: Signal<Option<usize>>,
173    /// Controlled shadcn `EuvHoverCard` open flag.
174    #[get(type(copy))]
175    pub(crate) hover_card_open: Signal<bool>,
176    /// Controlled shadcn `EuvCalendar` selected day of month.
177    #[get(type(copy))]
178    pub(crate) calendar_day: Signal<u32>,
179    /// Controlled shadcn `EuvMenubar` active menu index.
180    #[get(type(copy))]
181    pub(crate) menubar_active: Signal<Option<usize>>,
182    /// Controlled shadcn `EuvCarousel` active slide index.
183    #[get(type(copy))]
184    pub(crate) carousel_index: Signal<usize>,
185    /// Reactive animated GIF playback state for the Media Studio showcase.
186    #[get(type(copy))]
187    pub(crate) media_gif: Signal<GifAnimation>,
188    /// Reactive LIVE Photo motion state for the Media Studio showcase.
189    #[get(type(copy))]
190    pub(crate) media_live: Signal<LivePhotoAsset>,
191    /// Reactive cross-platform video track state for the Media Studio showcase.
192    #[get(type(copy))]
193    pub(crate) media_video: Signal<VideoTrack>,
194    /// Reactive WAV audio track and waveform state for the Media Studio showcase.
195    #[get(type(copy))]
196    pub(crate) media_audio: Signal<AudioTrack>,
197    /// Reactive multi-page PDF document state for the Media Studio showcase.
198    #[get(type(copy))]
199    pub(crate) media_pdf: Signal<PdfDocument>,
200    /// Most recently clicked native HTML hyperlink URI in the Media Studio showcase.
201    #[get(type(copy))]
202    pub(crate) media_html_link_log: Signal<String>,
203    /// Simulated target platform index for cross-platform Dynamic Island & permissions matrix (`0..7`).
204    #[get(type(copy))]
205    pub(crate) os_target_platform_idx: Signal<usize>,
206    /// Active Dynamic Island presentation mode index (`0..6`).
207    #[get(type(copy))]
208    pub(crate) island_mode_idx: Signal<usize>,
209    /// Live notification delivery stack displayed via `EuvSonner`.
210    #[get(type(copy))]
211    pub(crate) system_notifications: Signal<Vec<(String, String)>>,
212    /// Per-permission status map across all 14 `SystemPermission` categories.
213    #[get(type(copy))]
214    pub(crate) permission_statuses: Signal<Vec<PermissionStatus>>,
215    /// Controlled search query for `EuvCombobox` in the UI & Edge Lab.
216    #[get(type(copy))]
217    pub(crate) lab_combobox_query: Signal<String>,
218    /// Controlled selected index for `EuvCombobox`.
219    #[get(type(copy))]
220    pub(crate) lab_combobox_selected: Signal<usize>,
221    /// Controlled open flag for `EuvCombobox`.
222    #[get(type(copy))]
223    pub(crate) lab_combobox_open: Signal<bool>,
224    /// Controlled filter string for `EuvDataTable`.
225    #[get(type(copy))]
226    pub(crate) lab_table_filter: Signal<String>,
227    /// Controlled sort order for `EuvDataTable`.
228    #[get(type(copy))]
229    pub(crate) lab_table_sort_asc: Signal<bool>,
230    /// Controlled selected row index for `EuvDataTable`.
231    #[get(type(copy))]
232    pub(crate) lab_table_selected: Signal<Option<usize>>,
233    /// Controlled selected day for `EuvDatePicker`.
234    #[get(type(copy))]
235    pub(crate) lab_date_day: Signal<u32>,
236    /// Controlled open flag for `EuvDatePicker`.
237    #[get(type(copy))]
238    pub(crate) lab_date_open: Signal<bool>,
239    /// Controlled domain input value for `EuvInputGroup`.
240    #[get(type(copy))]
241    pub(crate) lab_input_group_val: Signal<String>,
242    /// Controlled selected index for `EuvNativeSelect`.
243    #[get(type(copy))]
244    pub(crate) lab_native_select_idx: Signal<usize>,
245    /// Controlled active dropdown index for `EuvNavigationMenu`.
246    #[get(type(copy))]
247    pub(crate) lab_nav_menu_active: Signal<Option<usize>>,
248    /// Controlled split ratio for `EuvResizable`.
249    #[get(type(copy))]
250    pub(crate) lab_split_ratio: Signal<f32>,
251    /// Toggle controlling whether the nested edge-case box blocks scroll penetration (`true`) or allows chaining (`false`).
252    #[get(type(copy))]
253    pub(crate) lab_block_scroll_chain: Signal<bool>,
254    /// Toggle controlling whether the nested edge-case box stops click event bubbling (`true`) or allows bubbling (`false`).
255    #[get(type(copy))]
256    pub(crate) lab_stop_click_bubble: Signal<bool>,
257    /// Counter tracking clicks received by the outer parent card in the event bubbling test.
258    #[get(type(copy))]
259    pub(crate) lab_parent_clicks: Signal<u32>,
260    /// Counter tracking clicks received by the inner button in the event bubbling test.
261    #[get(type(copy))]
262    pub(crate) lab_child_clicks: Signal<u32>,
263    /// Persistent counter proving live resize never destroys or resets page state.
264    #[get(type(copy))]
265    pub(crate) lab_resize_preserve_count: Signal<u32>,
266    /// Controlled direction mode toggle (`false=LTR, true=RTL`).
267    #[get(type(copy))]
268    pub(crate) lab_rtl_mode: Signal<bool>,
269    /// Cross-platform in-memory WASM CDN registry serving real `.wasm` binaries and fault scenarios.
270    pub(crate) wasm_registry: RegistryWasmFetcher,
271    /// Dynamic WASM download, verification, sandbox execution, cache, and rollback manager.
272    pub(crate) wasm_manager: WasmDynamicManager,
273    /// Simulated offline network mode toggle for verifying verified offline WASM cache hits.
274    #[get(type(copy))]
275    pub(crate) wasm_offline: Signal<bool>,
276    /// Live human-readable readout of the latest dynamic WASM download or fault verification case.
277    #[get(type(copy))]
278    pub(crate) wasm_fault_status: Signal<String>,
279    /// Controlled global `⌘K` Command Palette modal visibility flag.
280    #[get(type(copy))]
281    pub(crate) cmd_palette_open: Signal<bool>,
282    /// Controlled global `⌘K` Command Palette filter query.
283    #[get(type(copy))]
284    pub(crate) cmd_palette_query: Signal<String>,
285    /// Controlled accent color selection for `EuvColorPicker`.
286    #[get(type(copy))]
287    pub(crate) picker_color: Signal<Color>,
288    /// Controlled 24-hour `(hour, minute)` selection for `EuvTimePicker`.
289    #[get(type(copy))]
290    pub(crate) picker_time: Signal<(u8, u8)>,
291    /// Controlled dynamic tag list for `EuvTagInput`.
292    #[get(type(copy))]
293    pub(crate) tag_items: Signal<Vec<String>>,
294    /// Controlled selected node label for interactive `EuvTree`.
295    #[get(type(copy))]
296    pub(crate) tree_selected: Signal<Option<String>>,
297    /// Controlled active breadcrumb index for interactive `EuvBreadcrumb`.
298    #[get(type(copy))]
299    pub(crate) breadcrumb_active: Signal<usize>,
300    /// Live interactive UI stress benchmark results for `/stress`.
301    #[get(type(copy))]
302    pub(crate) stress_results: Signal<Vec<StressCaseResult>>,
303    /// Latest interactive UI stress benchmark status readout for `/stress`.
304    #[get(type(copy))]
305    pub(crate) stress_summary: Signal<String>,
306    /// Persistent lazy-loading page-lifecycle router shared across the showcase shell.
307    pub(crate) router: EuvRouter,
308    /// Guard flag ensuring routes are registered on `router` once.
309    pub(crate) router_ready: Rc<Cell<bool>>,
310    /// Total lazy page `on_mount` lifecycle hooks executed.
311    #[get(type(copy))]
312    pub(crate) lifecycle_mounts: Signal<u32>,
313    /// Total `PageRetention::Freeze` `on_freeze` hooks executed on route leave.
314    #[get(type(copy))]
315    pub(crate) lifecycle_freezes: Signal<u32>,
316    /// Total `on_resume` hooks executed when returning to a frozen page.
317    #[get(type(copy))]
318    pub(crate) lifecycle_resumes: Signal<u32>,
319    /// Total `on_destroy` hooks executed on page disposal.
320    #[get(type(copy))]
321    pub(crate) lifecycle_destroys: Signal<u32>,
322    /// Latest human-readable page lifecycle transition log line.
323    #[get(type(copy))]
324    pub(crate) lifecycle_last_event: Signal<String>,
325    /// Latest copied code block telemetry readout on `/markdown`.
326    #[get(type(copy))]
327    pub(crate) markdown_copy_log: Signal<String>,
328    /// Latest clicked Markdown hyperlink URL readout on `/markdown`.
329    #[get(type(copy))]
330    pub(crate) markdown_link_log: Signal<String>,
331    /// Total GFM checklist tasks toggled interactively on `/markdown`.
332    #[get(type(copy))]
333    pub(crate) markdown_tasks_toggled: Signal<u32>,
334    /// Selected code example language tab index on `/markdown` (`0=Rust, 1=TS, 2=JSON, 3=Diff`).
335    #[get(type(copy))]
336    pub(crate) markdown_lang_tab: Signal<usize>,
337    /// Toggle controlling whether text inside the Markdown & Code Studio is selectable.
338    #[get(type(copy))]
339    pub(crate) markdown_selectable: Signal<bool>,
340    /// Rolling log of recent normalized cross-platform `SystemEvent` entries.
341    #[get(type(copy))]
342    pub(crate) system_event_log: Signal<Vec<String>>,
343    /// Total count of normalized `SystemEvent` notifications observed in this session.
344    #[get(type(copy))]
345    pub(crate) system_event_count: Signal<u32>,
346    /// Reactive flag indicating whether showcase pages are currently frozen in background.
347    #[get(type(copy))]
348    pub(crate) bg_frozen: Signal<bool>,
349    /// Total count of background freeze transitions executed across showcase pages.
350    #[get(type(copy))]
351    pub(crate) bg_freeze_count: Signal<u32>,
352    /// Total count of lossless foreground restore transitions executed across showcase pages.
353    #[get(type(copy))]
354    pub(crate) bg_restore_count: Signal<u32>,
355    /// Snapshot of whether the 2D physics game host was running immediately before entering background.
356    pub(crate) bg_snap_game2d_running: Rc<Cell<bool>>,
357    /// Snapshot of whether the 3D ray-tracing host was running immediately before entering background.
358    pub(crate) bg_snap_game3d_running: Rc<Cell<bool>>,
359    /// Snapshot of whether Media Studio animated GIF playback was playing before background.
360    pub(crate) bg_snap_gif_playing: Rc<Cell<bool>>,
361    /// Snapshot of whether Media Studio LIVE Photo motion burst was playing before background.
362    pub(crate) bg_snap_live_playing: Rc<Cell<bool>>,
363    /// Snapshot of whether Media Studio video playback was playing before background.
364    pub(crate) bg_snap_video_playing: Rc<Cell<bool>>,
365    /// Snapshot of whether Media Studio audio playback was playing before background.
366    pub(crate) bg_snap_audio_playing: Rc<Cell<bool>>,
367}
368
369/// Full-featured 2D arcade arena scene powered by `GameWorld`, `PhysicsWorld2D`, `Camera2D`, `ParticleSystem`, `TileMap`, `ActionMap`, and `AudioBus`.
370#[derive(Clone, Data, Debug)]
371pub struct DemoPhysicsScene {
372    /// Generational ECS entity arena holding player, drones, projectiles, and obstacles.
373    pub(crate) world: GameWorld,
374    /// Spatial-hash 2D rigid-body physics and raycast solver.
375    pub(crate) physics: PhysicsWorld2D,
376    /// 2D follow camera with trauma-based screen shake and frustum culling.
377    #[get(type(copy))]
378    pub(crate) camera: Camera2D,
379    /// Zero-allocation pooled neon particle engine.
380    pub(crate) particles: ParticleSystem,
381    /// Frustum-culled tiled arena map with solid corner pillars.
382    pub(crate) tilemap: TileMap,
383    /// Declarative arcade input bindings (WASD, Arrows, Space/Click fire, E dash, R wave).
384    pub(crate) actions: ActionMap,
385    /// Deterministic cross-platform sound cue bus.
386    pub(crate) audio: AudioBus,
387    /// Player ship entity handle.
388    #[get(type(copy))]
389    pub(crate) player_id: EntityId,
390    /// Remaining weapon cooldown in seconds.
391    #[get(type(copy))]
392    pub(crate) fire_cooldown: f32,
393    /// Remaining dash cooldown in seconds.
394    #[get(type(copy))]
395    pub(crate) dash_cooldown: f32,
396    /// Current player arcade score.
397    #[get(type(copy))]
398    pub(crate) score: u32,
399    /// Current wave counter.
400    #[get(type(copy))]
401    pub(crate) wave: u32,
402    /// Toggle for wireframe collider debug visualization.
403    #[get(type(copy))]
404    pub(crate) show_colliders: bool,
405    /// Smoothed real-time frames-per-second telemetry.
406    #[get(type(copy))]
407    pub(crate) smoothed_fps: f32,
408    /// Total fixed physics ticks simulated.
409    #[get(type(copy))]
410    pub(crate) ticks: u64,
411    /// Last rendered viewport size in logical pixels for responsive camera framing in inline and fullscreen modes.
412    #[get(type(copy))]
413    pub(crate) viewport_size: Size,
414}
415
416/// Interactive AAA 3D open-world city scene with PBR shading, BVH ray tracing, model importing, and runtime settings.
417#[derive(Clone, Data, Debug)]
418pub struct DemoOpenWorld3DScene {
419    /// Open-world 3D city scene graph with instanced towers, reflective wet boulevard, and drivable GT car.
420    pub(crate) world: World3D,
421    /// Zero-allocation PBR + BVH ray-tracing renderer.
422    pub(crate) renderer: Renderer3D,
423    /// Shared arcade action bindings for driving/flying the 3D scene.
424    pub(crate) actions: ActionMap,
425    /// Reactive runtime quality, resolution scale, and ray-tracing configuration.
426    #[get(type(copy))]
427    pub(crate) quality_signal: Signal<RenderQualityConfig>,
428    /// Reactive time-of-day sun slider signal.
429    #[get(type(copy))]
430    pub(crate) time_signal: Signal<f32>,
431    /// Monotonic import trigger signal (`odd = OBJ`, `even = glTF`).
432    #[get(type(copy))]
433    pub(crate) import_signal: Signal<u64>,
434    /// Last processed import counter.
435    #[get(type(copy))]
436    pub(crate) last_import_seq: u64,
437    /// Status text signal reporting imported vertices/triangles/BVH count.
438    #[get(type(copy))]
439    pub(crate) status_signal: Signal<String>,
440    /// Reactive 3D camera mode signal (`0=Chase, 1=Hood, 2=Orbit, 3=Aerial`).
441    #[get(type(copy))]
442    pub(crate) camera_mode_signal: Signal<u8>,
443    /// Smoothed real-time FPS telemetry.
444    #[get(type(copy))]
445    pub(crate) smoothed_fps: f32,
446}