euv-core 0.48.3

Core cross-platform runtime for euv featuring arena-based fine-grained reactivity, deterministic layout, flat scene graph, multi-mode rendering, and direct OS platform adapters.
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
use super::*;

/// Top-level cross-platform application configuration.
#[derive(Clone, Data, Debug, PartialEq)]
pub struct AppConfig {
    /// Primary window creation settings.
    pub(crate) window: WindowConfig,
    /// Clear background color drawn beneath the root scene node.
    #[get(type(copy))]
    pub(crate) clear_color: Color,
}

/// Opt-in per-phase microsecond breakdown for a single `App::step_frame` execution.
#[derive(Clone, Copy, Data, Debug, Default, Eq, Hash, PartialEq)]
pub struct FramePhaseMetrics {
    /// Window command flushing, event polling, and input dispatch duration in microseconds.
    #[get(type(copy))]
    pub(crate) input_us: u64,
    /// Reactive effect flushing, animation/gesture/scroll ticking, and damage collection duration in microseconds.
    #[get(type(copy))]
    pub(crate) reactive_us: u64,
    /// `LayoutEngine::compute` pass duration in microseconds.
    #[get(type(copy))]
    pub(crate) layout_us: u64,
    /// Display-list compilation duration in microseconds when timed separately (`0` when combined into `raster_us`).
    #[get(type(copy))]
    pub(crate) paint_list_us: u64,
    /// Unified render pass (`Renderer::render_frame`) duration in microseconds.
    #[get(type(copy))]
    pub(crate) raster_us: u64,
    /// Native surface / framebuffer region presentation duration in microseconds.
    #[get(type(copy))]
    pub(crate) present_us: u64,
}

/// Unified per-frame diagnostic telemetry covering phase timings, damage ratio, redraw cause, and idle-aware FPS.
#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
pub struct FrameTelemetry {
    /// Monotonic frame identifier matching `FrameStats::get_frame_index()`.
    #[get(type(copy))]
    pub(crate) frame_id: u64,
    /// Microsecond breakdown across pipeline phases (zeroed when telemetry timing is disabled).
    #[get(type(copy))]
    pub(crate) phases: FramePhaseMetrics,
    /// Fraction of physical viewport area rasterized (`0.0` when idle, `(0.0..=1.0]` when rendered).
    #[get(type(copy))]
    pub(crate) dirty_area_ratio: f32,
    /// Diagnostic reason when the frame promoted to full-viewport redraw (`FullRedrawReason::None` for partial or idle).
    #[get(type(copy))]
    pub(crate) full_redraw_reason: FullRedrawReason,
    /// Effective target cadence in Hertz (`min(fps_limit, display_refresh_rate_hz)` or `display_refresh_rate_hz`).
    #[get(type(copy))]
    pub(crate) target_hz: f32,
    /// Active presented frames per second (`0.0` while idle, smoothed active present cadence while rendering).
    #[get(type(copy))]
    pub(crate) present_fps: f32,
    /// Whether this frame skipped rendering because the scene was clean or rate-capped.
    #[get(type(copy))]
    pub(crate) is_idle: bool,
    /// Number of scene nodes recomputed during layout.
    #[get(type(copy))]
    pub(crate) layout_nodes: usize,
    /// Number of display-list draw commands executed.
    #[get(type(copy))]
    pub(crate) draw_commands: usize,
    /// Number of physical pixels shaded.
    #[get(type(copy))]
    pub(crate) pixels_shaded: usize,
    /// Native display target refresh mode in Hertz (distinct from callback and completed frame rates).
    #[get(type(copy))]
    pub(crate) target_refresh_mode_hz: f32,
    /// Measured host frame-callback tick rate in Hertz when `has_callback_sample` is `true`.
    #[get(type(copy))]
    pub(crate) callback_rate_hz: f32,
    /// True when `callback_rate_hz` reflects an active measured sample rather than idle no-sample.
    #[get(type(copy))]
    pub(crate) has_callback_sample: bool,
    /// Measured completed & presented frame rate in Hertz when `has_completed_sample` is `true` (`0.0` / idle when skipped).
    #[get(type(copy))]
    pub(crate) completed_frame_rate_hz: f32,
    /// True when `completed_frame_rate_hz` holds a live non-idle completed frame sample.
    #[get(type(copy))]
    pub(crate) has_completed_sample: bool,
    /// Monotonic presentation timestamp in nanoseconds when `has_present_timestamp` is `true`.
    #[get(type(copy))]
    pub(crate) present_timestamp_ns: u64,
    /// True when this frame completed submission with a valid monotonic presentation timestamp.
    #[get(type(copy))]
    pub(crate) has_present_timestamp: bool,
    /// Explicit frame submission outcome separating idle skip, submitted, and retryable submit failure.
    #[get(type(copy))]
    pub(crate) submit_outcome: FrameSubmitOutcome,
    /// True when this frame took the composite-only fast path without layout or full repaint.
    #[get(type(copy))]
    pub(crate) composite_only: bool,
    /// Cumulative layout telemetry snapshot (`invalidations`, `passes`, `changed_passes`, `changed_nodes_total`).
    #[get(type(copy))]
    pub(crate) layout_telemetry: LayoutTelemetry,
}

/// Unified cross-platform application runtime orchestrating platform events, reactivity, layout, and rendering.
#[derive(CustomDebug, Data)]
pub struct App {
    /// Application configuration.
    pub(crate) config: AppConfig,
    /// Active direct OS or headless platform backend.
    #[debug(skip)]
    #[get(skip)]
    pub(crate) platform: Box<dyn PlatformBackend>,
    /// Primary window live state.
    #[get(type(copy))]
    pub(crate) window_state: WindowState,
    /// Shared scene tree handle.
    pub(crate) scene: SceneHandle,
    /// Framework context carrying reactive breakpoint, theme, gesture, and safe-area signals.
    pub(crate) context: Context,
    /// Deterministic cross-platform layout engine.
    pub(crate) layout_engine: LayoutEngine,
    /// Multi-mode rendering pipeline (`Auto`, `Software`, `Hardware`, `Hybrid`).
    pub(crate) renderer: Renderer,
    /// Queued imperative window commands awaiting dispatch.
    pub(crate) command_queue: WindowCommandQueue,
    /// Local key-value storage service.
    pub(crate) storage: StorageStore,
    /// Flag indicating whether the application loop should keep running.
    #[get(type(copy))]
    pub(crate) running: bool,
    /// Pending damage region for the next rendered frame.
    #[get(type(copy))]
    pub(crate) pending_damage: DamageRegion,
    /// Real-time polled keyboard, pointer, and scroll state for game loops and interactive viewports.
    pub(crate) input_state: InputState,
    /// Fixed-timestep accumulator and FPS telemetry clock for real-time game rendering.
    #[get(type(copy))]
    pub(crate) frame_clock: FrameClock,
    /// Platform-native services hub (permissions, protocol registration, Dynamic Island, haptics, tray, A11y).
    pub(crate) services: PlatformServiceHub,
    /// Reactive signal carrying the most recently received custom-scheme or universal deep link.
    #[get(type(copy))]
    pub(crate) deep_link: Signal<Option<DeepLinkEvent>>,
    /// Shared dynamic update hub for live component-level and page-level OTA updates.
    pub(crate) dynamic_hub: DynamicUpdateHub,
    /// Last scene revision that was rasterized and presented, enabling zero-cost idle frame skipping.
    #[get(type(copy))]
    pub(crate) last_rendered_revision: u64,
    /// Most recently submitted OS/Web cursor icon to avoid redundant platform cursor calls.
    #[get(type(copy))]
    pub(crate) last_cursor: CursorIcon,
    /// Attached real-time game engine hosts receiving automatic OS input forwarding.
    #[debug(skip)]
    pub(crate) game_hosts: Vec<GameEngineHost>,
    /// Active touch pointer identifier currently driving single-finger pan scrolling.
    #[get(skip)]
    pub(crate) touch_drag_pointer_id: Option<u64>,
    /// Starting touch coordinate for mobile pan-to-scroll detection.
    #[get(skip)]
    pub(crate) touch_drag_origin: Option<Point>,
    /// Previous touch coordinate for incremental mobile scroll deltas.
    #[get(skip)]
    pub(crate) touch_drag_last: Option<Point>,
    /// Whether the active touch gesture has crossed tap slop into pan-scrolling.
    #[get(type(copy))]
    pub(crate) touch_dragging: bool,
    /// Cumulative post-slop drag displacement in logical pixels for the active touch scroll gesture.
    #[get(type(copy))]
    pub(crate) touch_drag_travel: f32,
    /// Locked scroll axis for the active touch drag (`0` = unlocked, `1` = vertical, `2` = horizontal, `3` = free).
    #[get(type(copy))]
    pub(crate) touch_scroll_axis: u8,
    /// Touch pan displacement accumulated during the current frame for jitter-free velocity estimation.
    #[get(type(copy))]
    pub(crate) touch_vel_accum_delta: Point,
    /// Fixed 8-entry stack ring buffer of `(dt_secs, dx, dy)` frame samples preventing thumb-lift backward fling reversals.
    #[get(skip)]
    #[get_mut(skip)]
    #[set(skip)]
    pub(crate) touch_vel_ring: [(f32, f32, f32); 8],
    /// Ring buffer index of the oldest live velocity sample in `0..8`.
    #[get(type(copy))]
    pub(crate) touch_vel_head: usize,
    /// Number of live samples currently stored in `touch_vel_ring` (`0..=8`).
    #[get(type(copy))]
    pub(crate) touch_vel_len: usize,
    /// Elapsed idle seconds since the last touch pan movement while a finger remains held down.
    #[get(type(copy))]
    pub(crate) touch_vel_idle_secs: f32,
    /// Whether the active pointer press grabbed a scrollbar track for thumb dragging.
    #[get(type(copy))]
    pub(crate) scrollbar_dragging: bool,
    /// Active scrollbar thumb drag axis (`0` = none, `1` = vertical, `2` = horizontal).
    #[get(type(copy))]
    pub(crate) scrollbar_drag_axis: u8,
    /// Active selectable `NodeKind::Text` node currently undergoing pointer drag selection.
    #[get(skip)]
    pub(crate) text_selecting_node: Option<NodeId>,
    /// Starting character index anchored at pointer-down for drag text selection.
    #[get(type(copy))]
    pub(crate) text_select_anchor_char: usize,
    /// Consecutive click count on the same selectable text node (`1` = caret, `2` = word, `3` = full node).
    #[get(type(copy))]
    pub(crate) text_click_count: u8,
    /// Most recently clicked selectable text node for multi-click detection.
    #[get(skip)]
    pub(crate) text_last_click_node: Option<NodeId>,
    /// Coordinates of the most recent click on a selectable text node.
    #[get(skip)]
    pub(crate) text_last_click_pos: Option<Point>,
    /// Elapsed seconds since the most recent click on a selectable text node.
    #[get(type(copy))]
    pub(crate) text_last_click_age_secs: f32,
    /// Active multi-touch / pointer contact map keyed by `pointer_id` for pinch & swipe recognition.
    pub(crate) active_pointers: HashMap<u64, Point>,
    /// Device kind recorded per active `pointer_id` for deterministic touch vs mouse separation.
    pub(crate) active_pointer_devices: HashMap<u64, PointerDevice>,
    /// Initial contact point of the active single-pointer gesture stroke.
    #[get(skip)]
    pub(crate) gesture_origin: Option<Point>,
    /// Baseline two-finger distance recorded when a pinch gesture starts.
    #[get(type(copy))]
    pub(crate) pinch_base_dist: f32,
    /// Accumulated hold duration in seconds for long-press gesture detection.
    #[get(type(copy))]
    pub(crate) gesture_hold_secs: f32,
    /// Whether `GestureEventKind::LongPress` has already fired for the current press.
    #[get(type(copy))]
    pub(crate) long_press_fired: bool,
    /// Coordinates of the most recent completed clean tap for double-tap detection.
    #[get(skip)]
    pub(crate) last_tap_pos: Option<Point>,
    /// Elapsed seconds since the most recent completed clean tap.
    #[get(type(copy))]
    pub(crate) last_tap_age_secs: f32,
    /// Monotonic gesture event sequence counter.
    #[get(type(copy))]
    pub(crate) gesture_seq: u64,
    /// Inertial touch-scroll fling velocity in logical pixels per second.
    #[get(type(copy))]
    pub(crate) scroll_velocity: Point,
    /// Pointer coordinates where inertial touch-scroll fling originated for hit-target resolution.
    #[get(type(copy))]
    pub(crate) scroll_fling_pos: Point,
    /// Locked innermost scrollable node captured at touch-down to prevent nested scroll penetration.
    #[get(skip)]
    pub(crate) touch_scroll_target: Option<NodeId>,
    /// Remaining smooth-scroll interpolation delta for discrete mouse-wheel notches.
    #[get(type(copy))]
    pub(crate) smooth_scroll_pending: Point,
    /// Pointer coordinates captured when smooth wheel scrolling started.
    #[get(type(copy))]
    pub(crate) smooth_scroll_pos: Point,
    /// Locked scroll container target for active smooth wheel interpolation.
    #[get(skip)]
    pub(crate) smooth_scroll_target: Option<NodeId>,
    /// Re-entrancy guard preventing nested `step_frame` execution during macOS live-resize callbacks.
    #[get(type(copy))]
    pub(crate) in_step_frame: bool,
    /// Accumulated blink phase timer in seconds for the focused `NodeKind::Input` caret.
    #[get(type(copy))]
    pub(crate) caret_blink_secs: f32,
    /// When `true`, global swipe gestures are suppressed because the active stroke started in a canvas, slider, or isolated region.
    #[get(type(copy))]
    pub(crate) gesture_suppressed: bool,
    /// Elapsed seconds accumulated for smoothed live FPS telemetry publication.
    #[get(type(copy))]
    pub(crate) fps_accum_secs: f32,
    /// Rendered frame count accumulated inside the current FPS sampling window.
    #[get(type(copy))]
    pub(crate) fps_accum_frames: u32,
    /// Accumulated frame time in seconds used to pace frames when an explicit FPS cap is configured.
    #[get(type(copy))]
    pub(crate) fps_budget_accum: f32,
    /// Whether an editable `NodeKind::Input` currently holds focus and requests the system IME keyboard.
    #[get(type(copy))]
    pub(crate) last_ime_active: bool,
    /// Handle of the `NodeKind::Input` that most recently activated the system IME keyboard.
    #[get(skip)]
    pub(crate) last_ime_node: Option<NodeId>,
    /// Damage region rasterized during the most recent rendered frame for partial native surface presentation.
    #[get(type(copy))]
    pub(crate) last_frame_damage: DamageRegion,
    /// Detected native hardware display refresh rate in Hertz (`60.0` fallback, `120.0`/`144.0`/`180.0`+ on high-refresh screens).
    #[get(type(copy))]
    pub(crate) display_refresh_rate_hz: f32,
    /// Whether motion animations, smooth scrolling, inertia, or active games were running on the previous frame.
    #[get(type(copy))]
    pub(crate) was_animating: bool,
    /// Cross-platform lifecycle and system event normalizer deduplicating OS notifications.
    pub(crate) system_event_normalizer: SystemEventNormalizer,
    /// Opt-in flag enabling per-phase microsecond timing instrumentation inside `step_frame` (zero syscall overhead when `false`).
    #[get(type(copy))]
    #[set(skip)]
    pub(crate) telemetry_enabled: bool,
    /// Most recently recorded `FrameTelemetry` snapshot.
    #[get(type(copy))]
    pub(crate) last_frame_telemetry: FrameTelemetry,
    /// Pending diagnostic reason associated with `pending_damage` when full-viewport damage was queued before `step_frame`.
    #[get(type(copy))]
    pub(crate) pending_full_redraw_reason: FullRedrawReason,
    /// Logical viewport size rasterized during the most recent rendered frame.
    #[get(type(copy))]
    pub(crate) last_rendered_viewport: Size,
    /// Display DPI scale factor rasterized during the most recent rendered frame.
    #[get(type(copy))]
    pub(crate) last_rendered_scale: f32,
    /// Active presented frames-per-second rate (`0.0` once idle beyond the sampling window).
    #[get(type(copy))]
    pub(crate) active_present_fps: f32,
    /// Continuous idle seconds elapsed since the most recent rendered frame.
    #[get(type(copy))]
    pub(crate) idle_secs_since_present: f32,
    /// Whether the most recent `step_frame` call skipped rendering due to a clean idle scene.
    #[get(type(copy))]
    pub(crate) is_idle_frame: bool,
    /// Toggle enabling surgical pre/post-layout conservative bounds diffing instead of full-screen layout fallback (default `true`).
    #[get(type(copy))]
    #[set(skip)]
    pub(crate) partial_layout_damage: bool,
    /// Root reactive scope created by `App::mount` so root effects freeze cleanly in background.
    #[get(skip)]
    #[get_mut(skip)]
    #[set(skip)]
    pub(crate) mount_scope: Option<Scope>,
    /// True while the application is frozen in background (zero CPU ticks, zero layout/paint/GPU work).
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    pub(crate) background_frozen: bool,
    /// True on the first frame after returning from background so elapsed sleep time clamps to `dt = 0.0`.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    pub(crate) resume_zero_dt_pending: bool,
    /// Reactive scope handles frozen exclusively by background entry (leaving pre-frozen router pages untouched).
    #[get(pub(crate))]
    #[get_mut(pub(crate))]
    #[set(pub(crate))]
    pub(crate) background_frozen_scopes: Vec<ScopeId>,
    /// Deterministic gesture arbitration arena enforcing priority tiers and touch-slop disambiguation.
    #[get(pub(crate))]
    #[get_mut(pub(crate))]
    #[set(pub(crate))]
    pub(crate) gesture_arena: GestureArena,
    /// Last immersive fullscreen state synchronized with the platform backend.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    pub(crate) last_immersive_fullscreen: bool,
    /// Surface presentation generation and automatic same-generation submit-failure retry tracker.
    pub(crate) surface_present: SurfacePresentState,
    /// Bounded, cancellable, context-validated route pre-warming pipeline.
    pub(crate) route_prewarmer: RoutePrewarmer,
    /// Unified deterministic page lifecycle controller (`Freeze`, `Resume`, `Evict`, `Destroy`, generation guards).
    pub(crate) page_lifecycle: PageLifecycleController,
    /// Low-overhead single-owner framework resource ownership and leak accountant.
    pub(crate) resource_accountant: ResourceAccountant,
    /// Accumulated elapsed seconds inside the current callback-rate measurement window.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    pub(crate) callback_accum_secs: f32,
    /// Callback invocations counted inside the current callback-rate measurement window.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    pub(crate) callback_accum_ticks: u32,
    /// Most recently measured host callback cadence in Hertz.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    pub(crate) last_callback_rate_hz: f32,
    /// Whether `last_callback_rate_hz` holds a fresh measured callback rate sample.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    pub(crate) has_callback_rate_sample: bool,
    /// Monotonic application clock in nanoseconds used for deterministic present timestamps and accounting grace periods.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    pub(crate) monotonic_clock_ns: u64,
    /// Persistent per-frame scratch buffers reused across `step_frame` and input dispatch for zero steady-state heap allocations.
    #[debug(skip)]
    #[get(skip)]
    #[get_mut(skip)]
    #[set(skip)]
    pub(crate) frame_arena: AppFrameArena,
    /// Fixed 4-sample monotonic input timestamp ring `(ts_ns, x, y)` for phase-aligned resampling toward `target_present_time_ns`.
    #[get(skip)]
    #[get_mut(skip)]
    #[set(skip)]
    pub(crate) input_resample_ring: [(u64, f32, f32); 4],
    /// Next write index into `input_resample_ring` in `0..4`.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    pub(crate) input_resample_head: usize,
    /// Number of valid monotonic samples currently stored in `input_resample_ring` (`0..=4`).
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    pub(crate) input_resample_len: usize,
    /// Monotonic timestamp in nanoseconds of the previous scroll event for precision-trackpad vs discrete-wheel classification.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    pub(crate) last_scroll_ts_ns: u64,
    /// Bounded multi-rect dirty set computed during the most recent rendered frame.
    #[get(type(copy))]
    pub(crate) last_dirty_rect_set: DirtyRectSet,
    /// Adaptive dirty-region submission strategy selected for the most recent rendered frame.
    #[get(type(copy))]
    pub(crate) last_dirty_strategy: DirtyRectStrategy,
    /// Bounded retained page/scroll layer registry preserving scroll offsets, focus, and animation timelines across route switches.
    pub(crate) retained_layers: RetainedLayerRegistry,
}

/// Persistent reusable scratch vectors owned by `App` so steady-state frames allocate zero heap buffers.
#[derive(CustomDebug, Default)]
pub(crate) struct AppFrameArena {
    /// Reusable visible portal and backdrop-blur descriptor scratch list.
    pub(crate) visible_portals: Vec<PortalBackdropRegion>,
    /// Reusable active game viewport dirty rect scratch list.
    pub(crate) game_damage_rects: Vec<Rect>,
    /// Reusable active `GameEngineHost` index scratch list.
    pub(crate) active_host_indices: Vec<usize>,
    /// Reusable clipped scroll container `(node_id, old_bounds)` list whose `DIRTY_SUBTREE_LAYOUT` bit is temporarily stashed during paint-damage collection.
    pub(crate) stashed_scroll_nodes: Vec<(NodeId, Rect)>,
    /// Reusable UI event callback queue avoiding per-pointer-move and per-scroll `Vec` allocations.
    #[debug(skip)]
    pub(crate) callbacks: Vec<(UiEventHandler, UiEvent)>,
}

/// Per-node scroll-chain evaluation step separating standard scroll, virtual scroll, parent traversal, and chaining blocks.
#[derive(Clone, Copy, Debug, Default)]
pub(crate) struct ScrollStepOutcome {
    /// Standard scroll update `(next_offset, consumed_x, consumed_y)`.
    pub(crate) std_update: Option<(Point, f32, f32)>,
    /// Virtual scroll update `(next_virtual_y, total_virtual_h, consumed_y)`.
    pub(crate) virtual_update: Option<(f32, f32, f32)>,
    /// True when `next_parent_id` holds a valid ancestor along the scroll chain.
    pub(crate) has_next_parent: bool,
    /// Next ancestor node handle along the scroll chain when `has_next_parent` is `true`.
    pub(crate) next_parent_id: NodeId,
    /// True when this node blocks scroll chaining to outer ancestors.
    pub(crate) blocks_scroll: bool,
}

/// Fused single-borrow pre-tick snapshot collected at the start of `App::step_frame`.
#[derive(Clone, Copy, Debug, Default)]
pub(crate) struct FramePreTick {
    /// Whether a live `NodeKind::Input` currently holds keyboard focus.
    pub(crate) has_focused_input: bool,
    /// Whether `ime_node_id` holds a visible non-disabled input node requesting OS IME presentation.
    pub(crate) has_ime_node: bool,
    /// Focused input node handle requesting OS IME presentation when `has_ime_node` is `true`.
    pub(crate) ime_node_id: NodeId,
    /// Screen-space logical bounds of `ime_node_id`.
    pub(crate) ime_rect: Rect,
    /// Resolved frame animation timestep in seconds.
    pub(crate) step_dt: f32,
    /// Whether one or more `NodeTransition`s ticked inside the fused borrow.
    pub(crate) anim_ticked: bool,
    /// Whether active transitions were deferred until after `GameEngineHost::step`.
    pub(crate) pending_game_transitions: bool,
}

/// Stack-first ancestor chain buffer avoiding heap allocations up to 32 tree levels deep.
#[derive(Debug)]
pub(crate) struct AncestorChain {
    /// Inline stack buffer holding the first 32 ancestors (leaf first).
    pub(crate) inline: [NodeId; 32],
    /// Number of valid entries in `inline` when `spill` is empty.
    pub(crate) len: usize,
    /// Heap overflow buffer used only when ancestor depth exceeds 32.
    pub(crate) spill: Vec<NodeId>,
}