Skip to main content

AppRuntime

Struct AppRuntime 

Source
pub struct AppRuntime {
Show 57 fields pub root_blueprint: NodeBlueprint, pub ir_graph: UiIrGraph, pub layout_root: LayoutNode, pub display_list: DisplayList, pub spatial_index: SpatialIndex, pub viewport_width: f32, pub viewport_height: f32, pub dpr: f32, pub frame_count: u64, pub active_focus: Option<ActiveInput>, pub input_states: HashMap<String, TextInputState>, pub caret_blink_epoch: Instant, pub last_caret_blink_state: bool, pub current_cursor: CursorIcon, pub drag_selection_active: bool, pub last_click_info: Option<(Instant, f32, f32, usize)>, pub pending_window_drag: Option<(f32, f32)>, pub last_drag_click: Option<(Instant, f32, f32)>, pub current_hover_path: Option<Vec<usize>>, pub current_focus_path: Option<Vec<usize>>, pub is_mouse_down: bool, pub is_dark_mode: bool, pub last_mouse_pos: (f32, f32), pub hover_tooltip_text: Option<String>, pub hover_tooltip_path: Option<Vec<usize>>, pub hover_tooltip_anchor: (f32, f32), pub hover_tooltip_since: Option<Instant>, pub hover_tooltip_visible: bool, pub hover_tooltip_delay: Duration, pub hover_tooltip_style: HoverTooltipStyle, pub scroll_offsets: HashMap<Vec<usize>, (f32, f32)>, pub scroll_offsets_by_id: HashMap<String, (f32, f32)>, pub active_scrollbars: Vec<ActiveScrollbar>, pub scrollbar_drag: Option<ScrollbarDrag>, pub active_smooth_scroll: Option<SmoothScrollTracker>, pub last_scroll_interaction: Option<Instant>, pub applied_scroll_offsets: HashMap<Vec<usize>, (f32, f32)>, pub applied_portal_offsets: HashMap<Vec<usize>, (f32, f32)>, pub runtime_start_epoch: Instant, pub transition_manager: TransitionManager, pub animation_manager: AnimationManager, pub base_node_styles: HashMap<u64, ComputedStyle>, pub previous_node_styles: HashMap<u64, ComputedStyle>, pub node_paths: HashMap<u64, Vec<usize>>, pub path_node_ids: HashMap<Vec<usize>, u64>, pub view_transition_manager: ViewTransitionManager, pub had_active_animations: bool, pub gpu_path_pipeline: GpuPathPipeline, pub mcp_cursor: Option<McpCursorState>, pub a11y_bridge: A11yBridge, pub a11y_tree: Option<A11yTree>, pub a11y_updates_count: u64, pub dynamic_text_bindings: Vec<DynamicTextBinding>, pub dom_mutation_receiver: Option<Receiver<DomMutationRecord>>, pub csd_controller: CsdController, pub pointer_capture_target: Option<(Vec<usize>, bool)>, pub observed_element_sizes: HashMap<u64, (f32, f32)>, /* private fields */
}
Expand description

Live running application instance holding active state, layout tree, and display list.

Fields§

§root_blueprint: NodeBlueprint§ir_graph: UiIrGraph§layout_root: LayoutNode§display_list: DisplayList§spatial_index: SpatialIndex§viewport_width: f32§viewport_height: f32§dpr: f32§frame_count: u64§active_focus: Option<ActiveInput>§input_states: HashMap<String, TextInputState>§caret_blink_epoch: Instant§last_caret_blink_state: bool§current_cursor: CursorIcon§drag_selection_active: bool§last_click_info: Option<(Instant, f32, f32, usize)>§pending_window_drag: Option<(f32, f32)>

Press origin of a possible window drag started on a data-app-region="drag" surface.

§last_drag_click: Option<(Instant, f32, f32)>

Time and position of the previous drag-region press, for double-click maximize toggling.

§current_hover_path: Option<Vec<usize>>

Hierarchical index path of the currently hovered element node.

§current_focus_path: Option<Vec<usize>>

Hierarchical index path of the currently focused element node.

§is_mouse_down: bool

Whether pointer primary button is currently held down.

§is_dark_mode: bool

Whether dark mode is active for theme-dependent utility styling.

§last_mouse_pos: (f32, f32)

Last recorded pointer coordinates.

§hover_tooltip_text: Option<String>

Resolved native tooltip text (title or button/image alt) for the hovered element.

§hover_tooltip_path: Option<Vec<usize>>

Tree path of the element that owns hover_tooltip_text.

§hover_tooltip_anchor: (f32, f32)

Pointer coordinates used to anchor the native hover tooltip.

§hover_tooltip_since: Option<Instant>

Timestamp when pointer dwell began on the current tooltip target.

§hover_tooltip_visible: bool

Whether the native hover tooltip popup is currently displayed.

§hover_tooltip_delay: Duration

Dwell delay before a native hover tooltip becomes visible.

§hover_tooltip_style: HoverTooltipStyle

Visual styling and offset configuration for native hover tooltips.

§scroll_offsets: HashMap<Vec<usize>, (f32, f32)>

Scroll offsets keyed by hierarchical tree path (e.g. [0, 1, 0]).

§scroll_offsets_by_id: HashMap<String, (f32, f32)>

Scroll offsets keyed by element string ID (e.g. “browser-viewport-tab-1”).

§active_scrollbars: Vec<ActiveScrollbar>

Active scrollbars currently visible on screen.

§scrollbar_drag: Option<ScrollbarDrag>

Active drag operation on a scrollbar thumb.

§active_smooth_scroll: Option<SmoothScrollTracker>

Active kinetic smooth scroll animation tracker.

§last_scroll_interaction: Option<Instant>

Timestamp of the last scroll interaction (for animated scrollbar thumb fade).

§applied_scroll_offsets: HashMap<Vec<usize>, (f32, f32)>

Scroll offsets currently applied via translation to the layout tree, keyed by hierarchical tree path.

§applied_portal_offsets: HashMap<Vec<usize>, (f32, f32)>

Anchored top-layer <Portal> translations currently applied to the layout tree, keyed by path.

§runtime_start_epoch: Instant

Continuous presentation epoch for animation and transition timing.

§transition_manager: TransitionManager

Coordinator for CSS transition properties across elements.

§animation_manager: AnimationManager

Coordinator for CSS keyframe animations across elements.

§base_node_styles: HashMap<u64, ComputedStyle>

Base un-animated computed styles for all layout tree nodes keyed by deterministic node ID.

§previous_node_styles: HashMap<u64, ComputedStyle>

Previous frame’s computed styles for transition diffing.

§node_paths: HashMap<u64, Vec<usize>>

Mapping from deterministic node ID to its hierarchical tree path.

§path_node_ids: HashMap<Vec<usize>, u64>

Mapping from hierarchical tree path to its identity-aware animation node ID.

§view_transition_manager: ViewTransitionManager

Coordinator for CSS View Transitions Module snapshots and element morphing.

§had_active_animations: bool

Whether animations or transitions were active in the prior frame (to allow clean final state settlement).

§gpu_path_pipeline: GpuPathPipeline

Hardware GPU path compilation pipeline for direct compute shader execution.

§mcp_cursor: Option<McpCursorState>

Active MCP emulated cursor state (smooth interpolation, hotspot, fade timer).

§a11y_bridge: A11yBridge

Accessibility tree bridge connecting Strata layout and reactive DOM with AccessKit and screen readers.

§a11y_tree: Option<A11yTree>

Latest snapshot of the accessible hierarchy.

§a11y_updates_count: u64

Number of accessibility tree synchronizations performed.

§dynamic_text_bindings: Vec<DynamicTextBinding>

Fine-grained dynamic text bindings mapped directly to layout node paths.

§dom_mutation_receiver: Option<Receiver<DomMutationRecord>>

Background channel receiver for live DOM mutations from scripts or browser tabs.

§csd_controller: CsdController

Client-Side Decorations (CSD) controller managing titlebar geometry and drag tracking.

§pointer_capture_target: Option<(Vec<usize>, bool)>

Active pointer capture or drag target (tree_path, explicit_capture).

§observed_element_sizes: HashMap<u64, (f32, f32)>

Last observed (width, height) for elements with onresize listeners, keyed by node ID.

Implementations§

Source§

impl AppRuntime

Source

pub fn apply_edit_command(&mut self, cmd: EditCommand) -> bool

Applies one editing command to the focused text input. Returns true when something changed.

Source

pub fn drain_edit_commands(&mut self) -> bool

Runs every edit command queued through queue_edit_command (e.g. from a context menu).

Source§

impl AppRuntime

Source

pub fn compute_idle_sleep(&self, was_active: bool) -> Duration

Dynamically computes the appropriate thread sleep duration based on runtime activity state. Returns:

  • 16ms if animations, smooth scrolling, scrollbar dragging, window dragging, active interactions, or dirty signals are active.
  • 50ms if a text input currently has active focus (to service responsive caret blinking).
  • 200ms if the runtime is completely idle (dropping CPU consumption to ~0%).
Source§

impl AppRuntime

Source

pub fn extract_text_content(bp: &NodeBlueprint) -> String

Recursively extracts concatenated text content from a blueprint subtree.

Source

pub fn update_accessibility_tree(&mut self) -> A11yTreeUpdate

Re-evaluates accessibility tree matching current blueprint and layout, emitting incremental diffs to the bridge.

Source

pub fn full_accessibility_update(&self) -> A11yTreeUpdate

Returns a full accessibility tree update snapshot containing all current nodes.

Source

pub fn dispatch_accessibility_action( &mut self, target_node: A11yNodeId, action: A11yAction, ) -> bool

Dispatches an assistive technology action (e.g. from screen reader) to the target node.

Source§

impl AppRuntime

Source

pub fn sync_tree_animations(&mut self, now_ms: f64)

Synchronizes running animations and transitions with the current layout tree.

Source

pub fn apply_animations_to_layout_tree(&mut self)

Applies active transition and animation values directly onto the layout tree.

Source

pub fn evaluate_scroll_animations( &mut self, anim_events: &mut Vec<AnimationLifecycleEvent>, )

Evaluates all active scroll-driven animations based on current container scroll positions.

Source

pub fn sync_scroll_animations(&mut self)

Evaluates scroll-driven animations synchronously during container scroll, consuming 0% CPU when stationary.

Source

pub fn capture_view_transitions(&mut self)

Captures element layout bounding boxes for elements with view-transition-name before DOM mutation.

Source

pub fn start_view_transition(&mut self, duration_ms: f32)

Triggers a view transition after DOM mutation, pairing old bounds with new layout bounds.

Source

pub fn has_active_transitions(&self) -> bool

Returns true if any CSS property transitions or view transitions are currently active.

Source

pub fn has_active_animations(&self) -> bool

Returns true if there are any active transitions or keyframe animations running.

Source

pub fn poll_animations(&mut self) -> bool

Advances active animations and transitions by current clock time. Returns true if any animation stepped and a redraw is needed.

Source

pub fn dispatch_animation_event(&self, event: AnimationLifecycleEvent)

Dispatches a synthetic W3C animation lifecycle event to matching RSX element event listeners.

Source

pub fn dispatch_transition_event(&self, event: TransitionLifecycleEvent)

Dispatches a synthetic W3C transition lifecycle event to matching RSX element event listeners.

Source

pub fn register_keyframes_stylesheet(&mut self, sheet: &StyleSheet)

Registers all parsed @keyframes rules from a stylesheet into the runtime animation registry.

Source

pub fn register_keyframe_rule(&mut self, rule: &KeyframeRule)

Registers a single compiled @keyframes rule into the runtime animation registry.

Source§

impl AppRuntime

Source

pub fn render_canvas_3d_scenes(&mut self)

Extracts declarative or programmatic 3D canvas viewports when not already emitted by [Compositor].

Source§

impl AppRuntime

Source

pub fn register_dom_mutation_channel(&mut self) -> Sender<DomMutationRecord>

Registers a background channel receiver for DOM mutations and returns the transmitting sender.

Source

pub fn poll_dom_mutations(&mut self, document: Option<&Document>) -> bool

Polls pending DOM mutations from the registered channel and hydrates them into the presentation tree. Returns true if any mutations were processed and a frame redraw is required.

Source

pub fn hydrate_dom_mutations( &mut self, records: &[DomMutationRecord], document: Option<&Document>, ) -> bool

Hydrates a sequence of fine-grained DOM mutation records directly into the live layout tree.

Source

pub fn hydrate_dom_mutation( &mut self, record: &DomMutationRecord, document: Option<&Document>, ) -> bool

Hydrates an individual DOM mutation record in-place without triggering a full page transpile.

Source

pub fn incremental_relayout(&mut self, dirty_path: &[usize]) -> bool

Performs incremental layout recomputation along a dirty tree path, leveraging layout boundaries or ancestor cache invalidation.

Source§

impl AppRuntime

Source

pub fn current_cursor(&self) -> CursorIcon

Returns the currently active platform mouse cursor icon.

Source

pub fn dispatch_pointer_down_action( &mut self, px: f32, py: f32, ) -> PointerDownAction

Dispatches pointer down at (px, py) coordinates with default modifiers. Returns the detailed action result (CaretMoved, FocusChanged, DomListenerInvoked, or Ignored).

Source

pub fn dispatch_pointer_down(&mut self, px: f32, py: f32) -> bool

Dispatches pointer down at (px, py) coordinates with no active modifier keys. Returns true if focus or selection state changed.

Source

pub fn dispatch_pointer_down_with_modifiers( &mut self, px: f32, py: f32, modifiers: Modifiers, ) -> bool

Dispatches pointer down at (px, py) coordinates to manage native input element focus, multi-click, Shift+click range extension, and text selection. Returns true if focus or selection state changed.

Source

pub fn dispatch_pointer_down_action_with_modifiers( &mut self, px: f32, py: f32, modifiers: Modifiers, ) -> PointerDownAction

Dispatches pointer down with modifier keys, returning whether the interaction only moved the caret in the already-active input, changed focus, or invoked a DOM listener.

Source

pub fn dispatch_pointer_down_action_with_button_and_modifiers( &mut self, px: f32, py: f32, button: i16, modifiers: Modifiers, ) -> PointerDownAction

Dispatches pointer down with explicit mouse button (0 = Left, 1 = Middle, 2 = Right) and modifier keys, managing text input focus/caret on primary clicks and invoking DOM PointerDown / MouseDown listeners with accurate button / buttons metadata.

Source

pub fn dispatch_pointer_move_action( &mut self, px: f32, py: f32, ) -> PointerMoveAction

Dispatches pointer move at (px, py), returning detailed action result.

Source

pub fn dispatch_pointer_move(&mut self, px: f32, py: f32) -> bool

Dispatches pointer move at (px, py) to update mouse drag text selection and DOM move listeners.

Source

pub fn dispatch_pointer_up_action( &mut self, px: f32, py: f32, ) -> PointerUpAction

Dispatches pointer up with primary button (0), returning detailed action result.

Source

pub fn dispatch_pointer_up_action_with_button( &mut self, px: f32, py: f32, button: i16, ) -> PointerUpAction

Dispatches pointer up with explicit mouse button (0 = Left, 1 = Middle, 2 = Right).

Source

pub fn dispatch_pointer_up(&mut self, px: f32, py: f32) -> bool

Dispatches pointer up to finalize mouse drag text selection and notify DOM up listeners.

Source

pub fn dispatch_key_event(&mut self, event: &PlatformEvent) -> KeyDispatchResult

Dispatches keyboard events to the active focused input element, returning a fine-grained KeyDispatchResult.

Source

pub fn handle_key_event(&mut self, event: &PlatformEvent) -> bool

Dispatches keyboard events to the active focused input element. Returns true if the key event was consumed by the focused input.

Source

pub fn create_mouse_event( &self, event_type: EventType, px: f32, py: f32, button: i16, detail: i32, target_box: Option<&Rect>, ) -> Event

Creates a fully populated synthetic W3C DOM Event for mouse and pointer interactions, with client, page, screen, and offset coordinates, button identifiers, click detail, and keyboard modifier flags.

Source

pub fn target_is_retained_canvas3d(&self, px: f32, py: f32) -> bool

Returns true when the active pointer capture target or element at (px, py) belongs to a retained <Canvas3D> viewport tracked by this runtime.

Source

pub fn dispatch_click(&self, px: f32, py: f32) -> bool

Dispatches a pointer click event at (x, y) coordinates into the application blueprint tree. Returns true if an event listener was invoked.

Source

pub fn dispatch_mouse_click( &self, px: f32, py: f32, button: i16, detail: i32, ) -> bool

Dispatches a mouse click event with specific button (0 = Left, 1 = Middle, 2 = Right) and detail.

Source

pub fn dispatch_dblclick(&self, px: f32, py: f32) -> bool

Dispatches a standard W3C dblclick event at (x, y) coordinates to the nearest element with an ondblclick listener.

Source

pub fn dispatch_context_menu(&self, px: f32, py: f32) -> bool

Dispatches a W3C contextmenu event at (x, y) to the nearest element that registered an oncontextmenu listener. Returns false (and leaves the platform default untouched) when nothing at that point listens, so a context menu never appears on arbitrary surfaces.

Source

pub fn begin_window_drag_candidate(&mut self, px: f32, py: f32) -> bool

Records a possible window drag when a primary press lands on a data-app-region="drag" surface (the equivalent of -webkit-app-region: drag). Interactive children opt out with data-app-region="no-drag". A quick second press toggles maximize, as native title bars do.

Source

pub fn poll_window_drag(&mut self, px: f32, py: f32) -> bool

Starts a native window move once the pointer travelled past the drag threshold. Returns true when the window’s maximized state changed (such as unmaximizing on drag).

Source

pub fn dispatch_file_drop(&mut self, paths: Vec<PathBuf>) -> bool

Dispatches an OS file drop (PlatformEvent::FileDrop) to the drop target under last_mouse_pos (or the primary ondrop listener in the tree), populating event.files and event.data.

Source§

impl AppRuntime

Source

pub fn unproject_point(layout: &LayoutNode, px: f32, py: f32) -> (f32, f32)

Unprojects a world pointer coordinate into an element’s local coordinate system if transformed.

Source

pub fn establishes_stacking_context(node: &LayoutNode, is_root: bool) -> bool

Returns true if node establishes an atomic stacking context for paint and hit-testing.

Source

pub fn establishes_stacking_context_in( node: &LayoutNode, parent_display: Option<Display>, is_root: bool, ) -> bool

Returns true if node establishes an atomic stacking context given parent_display.

Source

pub fn hit_test_event_with_box_and_entity<'a>( blueprint: &'a NodeBlueprint, layout: &'a LayoutNode, px: f32, py: f32, event_type: EventType, ) -> Option<(Rc<dyn Fn(Event)>, &'a Rect, EntityId)>

Recursively hit tests a coordinate point against the blueprint and computed layout hierarchy, returning the nearest listener registered for event_type, its element border box, and its EntityId.

Source

pub fn hit_test_event_with_box<'a>( blueprint: &'a NodeBlueprint, layout: &'a LayoutNode, px: f32, py: f32, event_type: EventType, ) -> Option<(Rc<dyn Fn(Event)>, &'a Rect)>

Recursively hit tests a coordinate point against the blueprint and computed layout hierarchy, returning the nearest listener registered for event_type and its element border box.

Source

pub fn find_event_at_or_above_path<'a>( blueprint: &'a NodeBlueprint, layout: &'a LayoutNode, path: &[usize], event_type: EventType, ) -> Option<(Rc<dyn Fn(Event)>, &'a Rect, EntityId)>

Walks from path up toward the root to find the nearest ancestor (or self) registering a listener for event_type, returning (handler, border_box, entity_id).

Source

pub fn hit_test_event( blueprint: &NodeBlueprint, layout: &LayoutNode, px: f32, py: f32, event_type: EventType, ) -> Option<Rc<dyn Fn(Event)>>

Recursively hit tests a coordinate point against the blueprint and computed layout hierarchy, returning the nearest (deepest, front-most) listener registered for event_type.

Source

pub fn hit_test_click( blueprint: &NodeBlueprint, layout: &LayoutNode, px: f32, py: f32, ) -> Option<Rc<dyn Fn(Event)>>

Hit tests for the nearest onclick listener at a coordinate point.

Source

pub fn hit_test_cursor( blueprint: &NodeBlueprint, layout: &LayoutNode, px: f32, py: f32, ) -> CursorIcon

Recursively hit tests a coordinate point against the blueprint and computed layout hierarchy to determine cursor style.

Source

pub fn hit_test_property( blueprint: &NodeBlueprint, layout: &LayoutNode, px: f32, py: f32, key: &str, ) -> Option<String>

Finds the value of the deepest element property key whose border box contains the point. Elements are tested front-to-back according to CSS stacking contexts so overlays win over what they cover.

Source§

impl AppRuntime

Source

pub fn find_node_by_path<'a>( blueprint: &'a NodeBlueprint, layout: &'a LayoutNode, path: &[usize], ) -> Option<(&'a NodeBlueprint, &'a LayoutNode)>

Locates the blueprint and layout node at a hierarchical index path in the tree.

Source

pub fn hit_test_node_path( blueprint: &NodeBlueprint, layout: &LayoutNode, px: f32, py: f32, ) -> Option<Vec<usize>>

Recursively hit tests a coordinate point against the blueprint and computed layout hierarchy, returning the hierarchical index path of the deepest matching element node.

Source

pub fn dispatch_boundary_events( &self, old_path: Option<&[usize]>, new_path: Option<&[usize]>, px: f32, py: f32, )

Dispatches W3C boundary events (mouseout, mouseleave, mouseover, mouseenter) between the previous hover path and the newly active hover path.

Source

pub fn node_path_has_hover_effects( blueprint: &NodeBlueprint, path: &[usize], ) -> bool

Checks whether any element along the index path has active hover styles (Tailwind or <style>) or boundary handlers.

Source

pub fn node_has_hover_effects(node: &NodeBlueprint) -> bool

Checks if a single blueprint node has hover utility classes (including chained modifiers like dark:hover:*), .group descendants with group-hover:*, or boundary event listeners.

Source

pub fn update_hover(&mut self, px: f32, py: f32) -> bool

Continuously updates hover state from pointer coordinates. Dispatches boundary events and rebuilds layout tree if the hovered element changed and has hover effects. Returns true if the hover target changed and an interactive frame rebuild is required.

Source

pub fn restyle_for_hover_paint(&mut self)

Re-applies hover/active styles, synchronizes CSS transitions, and recompiles paint commands without re-running layout when paint-only.

Paint-only hover variants (hover:bg-*, hover:text-*, hover:underline, shadows, opacity, <style> :hover color/background rules) do not change box geometry. Rebuilding the tree carries the new styles; the previous geometry, line boxes, and inline item streams are transplanted so the display list can be recompiled immediately.

Source

pub fn restyle_for_active_change(&mut self) -> bool

Re-applies :active styles only when the hovered path can visually react to pointer press/release, returning true if a repaint is needed.

Source

pub fn clear_hover(&mut self) -> bool

Clears any active hover state when the pointer departs the window surface.

Source

pub fn dismiss_hover_tooltip(&mut self) -> bool

Clears all pending/visible native hover tooltip state. Returns true if a visible tooltip was dismissed.

Source

pub fn dismiss_hover_tooltip_and_repaint(&mut self) -> bool

Dismisses any visible or pending native hover tooltip and recompiles the display list if the tooltip was visible on screen.

Source

pub fn next_hover_tooltip_due_in(&self) -> Option<Duration>

Returns the remaining duration until a pending native hover tooltip should appear.

Source

pub fn poll_hover_tooltip(&mut self) -> bool

Advances the native hover tooltip dwell timer. Returns true when the tooltip transitions to visible and updates the display list.

Source

pub fn render_hover_tooltip(&mut self)

Appends native hover tooltip draw commands on top of the compiled display list when active.

Source§

impl AppRuntime

Source

pub fn mcp_capture_screenshot_png(&mut self) -> Result<Vec<u8>, String>

Captures a high-resolution PNG screenshot with the active MCP cursor composited.

Source§

impl AppRuntime

Source

pub fn hit_test_input( blueprint: &NodeBlueprint, layout: &LayoutNode, px: f32, py: f32, ) -> Option<InputHitTarget>

Recursively hit tests a coordinate point against the blueprint to find clickable text input elements.

Source

pub fn find_input_layout<'a>( blueprint: &NodeBlueprint, layout: &'a LayoutNode, target_index: usize, target_id: Option<&str>, counter: &mut usize, ) -> Option<&'a LayoutNode>

Locates the LayoutNode corresponding to a target input index or id in document order.

Source

pub fn find_input_layout_mut<'a>( blueprint: &NodeBlueprint, layout: &'a mut LayoutNode, target_index: usize, target_id: Option<&str>, counter: &mut usize, ) -> Option<&'a mut LayoutNode>

Locates the mutable LayoutNode corresponding to a target input index or id in document order.

Source

pub fn find_input_blueprint<'a>( blueprint: &'a NodeBlueprint, target_index: usize, target_id: Option<&str>, counter: &mut usize, ) -> Option<&'a NodeBlueprint>

Locates the blueprint element corresponding to a target input index or ID.

Source§

impl AppRuntime

Source

pub fn find_blueprint_at_path<'a>( blueprint: &'a NodeBlueprint, path: &[usize], ) -> Option<&'a NodeBlueprint>

Locates a blueprint node given its hierarchical index path.

Source

pub fn build_ir_graph(blueprint: &NodeBlueprint) -> UiIrGraph

Compiles a reactive blueprint tree into a 64-byte cache-aligned UiIrGraph.

Source

pub fn sync_layout_to_ir(layout_root: &LayoutNode, ir_graph: &mut UiIrGraph)

Synchronizes computed 2D geometry from LayoutNode hierarchy to UiIrGraph FixedRect coordinates.

Source

pub fn build_layout_from_ir(graph: &UiIrGraph, node_id: NodeId) -> LayoutNode

Reconstructs a LayoutNode hierarchy directly from a UiIrGraph.

Source

pub fn build_layout_tree(blueprint: &NodeBlueprint) -> LayoutNode

Recursively transforms an RSX NodeBlueprint into a LayoutNode hierarchy with styling and inheritance.

Source

pub fn build_layout_tree_with_interaction( blueprint: &NodeBlueprint, ctx: &InteractionContext<'_>, ) -> LayoutNode

Recursively transforms an RSX NodeBlueprint into a LayoutNode hierarchy with styling, inheritance, and interaction state.

Source

pub fn build_layout_tree_with_hover( blueprint: &NodeBlueprint, hovered_path: Option<&[usize]>, ) -> LayoutNode

Recursively transforms an RSX NodeBlueprint into a LayoutNode hierarchy with styling, inheritance, and hover state.

Source

pub fn build_layout_tree_with_parent( blueprint: &NodeBlueprint, parent_style: Option<&ComputedStyle>, ) -> LayoutNode

Internal recursive tree builder passing parent ComputedStyle for W3C CSS property inheritance.

Source

pub fn build_layout_tree_with_context( blueprint: &NodeBlueprint, parent_style: Option<&ComputedStyle>, current_path: &mut Vec<usize>, hovered_path: Option<&[usize]>, ) -> LayoutNode

Internal recursive tree builder passing parent style, node path, and active hover state.

Source

pub fn build_layout_tree_with_interaction_context( blueprint: &NodeBlueprint, parent_style: Option<&ComputedStyle>, current_path: &mut Vec<usize>, ctx: &InteractionContext<'_>, ) -> LayoutNode

Internal recursive tree builder passing parent style, node path, and full interaction context.

Source

pub fn append_child_layout_nodes( blueprint: &NodeBlueprint, parent_style: Option<&ComputedStyle>, out: &mut Vec<LayoutNode>, )

Recursively flattens Fragment blueprints so child elements splice directly into parent layout contexts.

Source

pub fn rebuild_layout_tree(&mut self)

Re-evaluates styling with the current interaction state, recomputes layout, and compiles display list.

Source

pub fn layout_compute_count(&self) -> u64

Number of full layout computations performed by this runtime.

Source

pub fn find_layout_node_mut<'a>( root: &'a mut LayoutNode, path: &[usize], ) -> Option<&'a mut LayoutNode>

Locates a mutable LayoutNode in the layout hierarchy by its hierarchical tree path.

Source

pub fn collect_dynamic_text_bindings( blueprint: &NodeBlueprint, parent_path: &mut Vec<usize>, bindings: &mut Vec<DynamicTextBinding>, )

Recursively collects dynamic text node bindings with their exact hierarchical paths.

Source§

impl AppRuntime

Source

pub fn ensure_mcp_cursor(&mut self) -> &mut McpCursorState

Ensures that an emulated MCP cursor state is active, initializing it at center viewport if needed.

Source

pub fn mcp_move_pointer(&mut self, x: f32, y: f32, smooth: bool) -> bool

Emulates AI pointer movement to (x, y). Smooth interpolation is enabled by default.

Automatically resolves and applies the element’s CSS cursor style (e.g. pointer, text). Returns true if a view rebuild or display list redraw is required.

Source

pub fn mcp_mouse_down( &mut self, button: MouseButton, x: Option<f32>, y: Option<f32>, ) -> bool

Emulates AI mouse button down event.

Source

pub fn mcp_mouse_up( &mut self, _button: MouseButton, x: Option<f32>, y: Option<f32>, ) -> bool

Emulates AI mouse button release up event.

Source

pub fn mcp_mouse_click( &mut self, button: MouseButton, x: Option<f32>, y: Option<f32>, count: usize, ) -> bool

Emulates AI mouse click (press down and release).

Source

pub fn mcp_mouse_scroll( &mut self, delta_x: f32, delta_y: f32, x: Option<f32>, y: Option<f32>, ) -> bool

Emulates AI mouse wheel scroll event.

Source

pub fn mcp_keyboard_type(&mut self, text: &str) -> bool

Emulates AI keyboard character input.

Source

pub fn mcp_keyboard_key(&mut self, key: KeyCode, modifiers: Modifiers) -> bool

Emulates AI key combination or non-character navigation key.

Source

pub fn mcp_inspect_element( &self, x: f32, y: f32, ) -> (String, Vec<String>, Rect, String, CursorIcon)

Inspects the layout element at coordinates (x, y) returning tag, CSS classes, bounds, text, and cursor style.

Source§

impl AppRuntime

Source

pub fn apply_viewport_clamps(&mut self)

Shifts every data-clamp-viewport element (popups such as context menus) back inside the viewport with an 8px margin, using the live viewport size rather than any hardcoded value.

Source

pub fn get_layout_node_mut<'a>( root: &'a mut LayoutNode, path: &[usize], ) -> Option<&'a mut LayoutNode>

Traverses the LayoutNode hierarchy down a slice of child indices in O(depth).

Source

pub fn get_layout_node<'a>( root: &'a LayoutNode, path: &[usize], ) -> Option<&'a LayoutNode>

Traverses the LayoutNode hierarchy down a slice of child indices in O(depth).

Source

pub fn unapply_scroll_offsets(&mut self)

Restores any scrollable containers and anchored <Portal> nodes previously translated by apply_scroll_offsets back to their baseline unshifted coordinates so layout computations and metric measurements remain invariant.

Source

pub fn apply_scroll_offsets(&mut self)

Discovers scrollable containers, clamps offsets, translates children, computes scrollbars, and anchors top-layer <Portal> overlays to their trigger elements’ live post-scroll bounds.

Source

pub fn resolve_top_layer_portals(&mut self)

Resolves anchored <Portal> / CSS position-anchor nodes against their trigger elements’ live post-scroll bounding boxes with automatic viewport collision flipping (bottom-end <-> top-end) and viewport margin shifting.

Source

pub fn dispatch_scroll( &mut self, px: f32, py: f32, delta_x: f32, delta_y: f32, ) -> bool

Dispatches an immediate synchronous scroll wheel delta to the innermost scrollable container under (px, py). Cancels any active kinetic smooth scroll animation. Returns true if a scroll offset changed or a DOM wheel listener handled the event.

Source

pub fn dispatch_smooth_scroll_action( &mut self, px: f32, py: f32, delta_x: f32, delta_y: f32, ) -> (bool, bool)

Dispatches a smooth kinetic scroll impulse to the innermost scrollable container under (px, py). Accumulates velocity for rapid consecutive wheel events and initiates a critically damped kinetic transition curve with Chromium Blink parity. Dispatches a smooth scroll or DOM wheel event, returning (wheel_handled, scroll_changed).

Source

pub fn dispatch_smooth_scroll( &mut self, px: f32, py: f32, delta_x: f32, delta_y: f32, ) -> bool

Dispatches a smooth kinetic scroll impulse to the innermost scrollable container under (px, py). Returns true if either a DOM wheel listener handled the event or a scroll animation updated.

Source

pub fn poll_smooth_scroll_at(&mut self, now: Instant) -> bool

Polls and updates active kinetic smooth scroll animation at a specific timestamp. Returns true if a position changed and a redraw is required.

Source

pub fn poll_smooth_scroll(&mut self) -> bool

Evaluates active smooth scroll animation at the current instant.

Source

pub fn scroll_to_top(&mut self, px: f32, py: f32) -> bool

Scrolls the innermost scroll container under (px, py) to the very top.

Source

pub fn scroll_to_bottom(&mut self, px: f32, py: f32) -> bool

Scrolls the innermost scroll container under (px, py) to the very bottom.

Source

pub fn scroll_offset_by_id(&self, id: &str) -> (f32, f32)

Returns the live (scroll_left, scroll_top) offset for a scrollable element id.

Source

pub fn scroll_to_by_id( &mut self, id: &str, scroll_x: f32, scroll_y: f32, ) -> bool

Scrolls the scroll container with element id (or the primary scroll container if id is empty) to (scroll_x, scroll_y), clamping to the container’s maximum scroll bounds and firing EventType::Scroll.

Source

pub fn scroll_to_top_by_id(&mut self, id: &str) -> bool

Scrolls the scroll container with element id (or the primary scroll container if id is empty) to the top.

Source

pub fn scroll_to_bottom_by_id(&mut self, id: &str) -> bool

Scrolls the scroll container with element id (or the primary scroll container if id is empty) to the bottom.

Source

pub fn scroll_into_view(&mut self, target_id: &str) -> bool

Scrolls the nearest enclosing scroll container so that the descendant element with target_id is visible.

Source

pub fn flush_pending_scroll_commands(&mut self) -> bool

Drains and executes any programmatic scroll commands queued via strata_dom::scroll_to, scroll_to_top, scroll_to_bottom, or scroll_into_view.

Source§

impl AppRuntime

Source

pub fn render_scrollbars(&mut self)

Renders sleek semi-transparent scrollbar thumbs for all overflowing scroll containers.

Source

pub fn check_scrollbar_thumb_press(&mut self, px: f32, py: f32) -> bool

Checks if a pointer press landed on any active scrollbar thumb or track and starts dragging.

Source

pub fn poll_scrollbar_drag(&mut self, _px: f32, py: f32) -> bool

Updates active scrollbar thumb drag during pointer movement.

Source§

impl AppRuntime

Resets the caret blink cycle so the insertion caret is immediately solid and visible.

Polls caret blink cycle and returns true if blink state toggled (requiring a redraw).

Source

pub fn sync_active_input_layout(&mut self)

Synchronizes the active focused text input’s live buffer and styling into the layout tree.

Source

pub fn calculate_exact_char_index_at_offset( text: &str, rel_x: f32, font_size: f32, line_height: f32, is_mono: bool, font_family: AtomId, ) -> usize

Calculates the exact character index from an x offset within an input using active font metrics and character advances.

Source

pub fn render_active_input_caret(&mut self)

Renders the visible insertion caret cursor and selection highlight for the currently focused text input.

Source

pub fn active_caret_rect(&self) -> Option<Rect>

Computes the exact bounding box of the active text caret if an input is currently focused.

Source

pub fn sync_ime_cursor_location<W: PlatformWindow>(&self, window: &mut W)

Synchronizes the IME candidate window location with the active caret position.

Source

pub fn update_gtk_ime_location(&self)

Directly updates GTK IME context with current caret location if running on Linux GTK.

Source§

impl AppRuntime

Source

pub fn apply_tailwind_classes( style: &mut ComputedStyle, classes: &ClassList, is_hovered: bool, is_focused: bool, is_dark: bool, )

Full Tailwind CSS class parser supporting hover, focus, and dark mode variants.

Source

pub fn apply_tailwind_classes_with_pseudo_state( style: &mut ComputedStyle, classes: &ClassList, state: &PseudoState, )

Full Tailwind CSS class parser supporting hover, focus, active, disabled, dark, and group-* variants.

Source

pub fn apply_base_tailwind_classes( style: &mut ComputedStyle, classes: &ClassList, state: &PseudoState, )

Applies only non-interactive (base + dark: + disabled:) Tailwind classes.

Source

pub fn apply_interactive_tailwind_classes( style: &mut ComputedStyle, classes: &ClassList, state: &PseudoState, )

Applies only active interactive (hover:, group-hover:, focus:, active:) Tailwind classes.

Source

pub fn hover_is_paint_only(&self) -> bool

Returns true when the last hover transition was resolved by a paint-only restyle.

Source§

impl AppRuntime

Source

pub fn find_all(&self, query: &NodeQuery) -> Vec<Vec<usize>>

Returns the tree paths of every element matching query, in document order.

Source

pub fn find(&self, query: &NodeQuery) -> Option<Vec<usize>>

First (bottom-most in paint order) element matching query.

Source

pub fn find_last(&self, query: &NodeQuery) -> Option<Vec<usize>>

Last (top-most in paint order) element matching query, e.g. a modal’s button when the same label also exists on the page behind it.

Source

pub fn find_by_text(&self, text: &str) -> Option<Vec<usize>>

Shorthand for find(&NodeQuery::text(text)).

Source

pub fn find_last_by_text(&self, text: &str) -> Option<Vec<usize>>

Shorthand for find_last(&NodeQuery::text(text)).

Source

pub fn find_by_title(&self, title: &str) -> Option<Vec<usize>>

Shorthand for find(&NodeQuery::title(title)).

Source

pub fn find_last_by_title(&self, title: &str) -> Option<Vec<usize>>

Shorthand for find_last(&NodeQuery::title(title)).

Source

pub fn node_text(&self, path: &[usize]) -> Option<String>

Rendered text content of the element at path, whitespace-normalized.

Source

pub fn node_center(&self, path: &[usize]) -> Option<(f32, f32)>

Border-box center of the element at path in window coordinates.

Source

pub fn click_node(&self, path: &[usize]) -> bool

Clicks the center of the element at path through the normal hit-test path (so an occluding element receives the click, as for a real pointer). Returns true if a click listener ran.

Source

pub fn click(&self, query: &NodeQuery) -> bool

Clicks the first element matching query. Returns false if none matched or no listener ran.

Source

pub fn click_last(&self, query: &NodeQuery) -> bool

Clicks the last (top-most) element matching query.

Source

pub fn click_text(&self, text: &str) -> bool

Clicks the first element whose text equals text.

Source

pub fn click_last_text(&self, text: &str) -> bool

Clicks the last (top-most) element whose text equals text.

Source

pub fn click_title(&self, title: &str) -> bool

Clicks the first element whose title or (on button/img) alt equals title; either attribute may match. See NodeQuery::title.

Source

pub fn click_last_title(&self, title: &str) -> bool

Clicks the last (top-most) element whose title or (on button/img) alt equals title; either attribute may match. See NodeQuery::title.

Source§

impl AppRuntime

Source

pub fn new( root_view: View, viewport_width: f32, viewport_height: f32, dpr: f32, ) -> Self

Creates and mounts a new application runtime from a root view.

Source

pub fn apply_window_config(&mut self, config: &WindowConfig) -> &mut Self

Applies runtime-relevant preferences from a WindowConfig (such as native hover tooltip dwell delay and styling).

Source

pub fn set_hover_tooltip_delay(&mut self, delay: Duration) -> &mut Self

Sets the pointer dwell delay before native hover tooltips (title / alt) become visible.

Source

pub fn set_hover_tooltip_delay_ms(&mut self, delay_ms: u64) -> &mut Self

Sets the pointer dwell delay in milliseconds before native hover tooltips become visible.

Source

pub fn hover_tooltip_delay(&self) -> Duration

Returns the configured pointer dwell delay for native hover tooltips.

Source

pub fn set_hover_tooltip_style(&mut self, style: HoverTooltipStyle) -> &mut Self

Sets visual styling and offset configuration for native hover tooltips.

Source

pub fn hover_tooltip_style(&self) -> HoverTooltipStyle

Returns the active visual styling configuration for native hover tooltips.

Source

pub fn tick_frame(&mut self) -> &DisplayList

Re-evaluates layout and compiles display commands for the current frame.

Source

pub fn interaction_context(&self) -> InteractionContext<'_>

Returns the current interaction context.

Source

pub fn set_dark_mode(&mut self, is_dark: bool) -> bool

Sets the active dark mode state and triggers a layout and style recomputation if changed.

Source

pub fn set_focus_path(&mut self, path: Option<Vec<usize>>) -> bool

Sets the active focused element path and triggers a layout and style recomputation if changed.

Source

pub fn rebuild_spatial_index(&mut self)

Clears and rebuilds the spatial acceleration index.

Source

pub fn query_entity_at_point(&self, px: f32, py: f32) -> Option<EntityId>

Queries the front-most EntityId at point (px, py).

Source

pub fn query_event_at_point( &self, px: f32, py: f32, event_type: EventType, ) -> Option<(EntityId, Rc<dyn Fn(Event)>, Rect)>

Queries the front-most event listener registered for event_type at point (px, py).

Source

pub fn find_layout_by_entity(&self, entity_id: EntityId) -> Option<&LayoutNode>

Recursively locates a layout node by its EntityId.

Source

pub fn find_layout_mut_by_entity( &mut self, entity_id: EntityId, ) -> Option<&mut LayoutNode>

Recursively locates a mutable layout node by its EntityId.

Source

pub fn find_blueprint_by_entity( &self, entity_id: EntityId, ) -> Option<&NodeBlueprint>

Recursively locates a blueprint node by its EntityId.

Source

pub fn query_element_rect(&self, element_id: &str) -> Option<Rect>

Queries the laid-out border-box rectangle (x, y, width, height) for an element by id.

Source

pub fn warp_cursor(&mut self, x: f32, y: f32)

Warps the OS pointer to window-local (x, y) and records the target so the resulting synthetic motion delta is filtered from movement_x / movement_y.

Source

pub fn set_cursor_position(&mut self, x: f32, y: f32)

Source

pub fn update_element_flex( &mut self, element_id: &str, flex_grow: f32, flex_shrink: f32, flex_basis: Option<Dimension>, ) -> bool

Updates flex_grow, flex_shrink, and optional flex_basis on the layout node matching element_id in-place, invalidating only its ancestor chain’s layout cache.

Source

pub fn update_split_ratios(&mut self, updates: &[(&str, f32)]) -> bool

Updates flex_grow ratios for multiple element_ids in-place and runs an isolated layout-only pass without rebuilding the DOM, stylesheets, or IR graph.

Source

pub fn relayout_in_place(&mut self)

Recomputes layout, scroll/viewport clamps, resize observers, spatial index, and display list in-place without rebuilding layout_root or ir_graph.

Source

pub fn dispatch_resize_observers(&mut self) -> bool

Dispatches EventType::Resize (onresize) callbacks for any element whose laid-out (width, height) changed since the last observation. Returns true if any callback fired.

Source

pub fn update_view(&mut self, new_view: View)

Updates the application root view, incrementally reconciling unchanged subtrees and compiling a new display list.

Source

pub fn sync_dynamic_text(&mut self) -> bool

Evaluates registered fine-grained dynamic text closures and updates target layout nodes directly in-place without rebuilding the blueprint tree or calling root view functions. Returns true if any text value changed and triggered a frame update.

Source

pub fn cursor_theme(&self) -> &CursorTheme

System cursor theme, loaded on first use. Reading cursor files from disk costs several milliseconds and only the MCP cursor overlay needs it.

Source

pub fn mark_viewport_3d_dirty(&mut self)

Marks only 3D viewports dirty without invalidating 2D layout or recompiling the display list.

Source

pub fn poll_retained_3d_dirty(&self) -> bool

Returns true when any retained 3D viewport has newer camera/geometry/overlay generations than what was last presented, or when viewport_3d_dirty was set explicitly.

Source

pub fn acknowledge_retained_3d_presented(&mut self)

Records the current generations of all tracked [RetainedScene3D] handles as presented.

Source

pub fn has_uncapped_canvas3d(&self) -> bool

Returns true if any <Canvas3D> in the current blueprint opted into uncapped presentation.

Source

pub fn mark_paint_dirty(&mut self)

Marks the compiled display list stale so the next dirty-gated compile rebuilds it.

Source

pub fn is_paint_dirty(&self) -> bool

Whether the display list is stale relative to runtime state.

Source

pub fn compiles_skipped(&self) -> u64

Number of dirty-gated compiles that were skipped as unchanged.

Source

pub fn compile_display_list_if_dirty(&mut self) -> bool

Compiles the display list only when something changed since the last compile. Returns true when a compile ran.

Source

pub fn compile_display_list(&mut self)

Generates draw commands for all computed layout rectangles using the 7-layer CSS compositor with spatial viewport scissoring.

Source

pub fn gpu_path_segments(&self) -> &[GpuPathSegment]

Returns the compiled GPU path segments from the latest frame.

Source

pub fn gpu_path_uniform_bytes(&self) -> &[u8] ⓘ

Returns the raw uniform bytes for the GPU path compute pipeline.

Source

pub fn step_event(&mut self, event: &PlatformEvent) -> bool

Processes an incoming platform event, updating viewport/scale or dispatching synthetic events. Returns true if a dirty layout or presentation redraw was triggered.

Source

pub fn layout_computations(&self) -> u64

Number of full layout computations performed by this runtime.

Source

pub fn last_update_reconciled(&self) -> bool

True when the most recent update_view reconciled the existing layout tree in place.

Source

pub fn frame_profile(&self) -> FrameProfile

Phase timings accumulated since the last presented frame.

Source

pub fn set_frame_profile_hook( &mut self, hook: Option<Box<dyn FnMut(&FrameProfile)>>, )

Registers an observer called with each completed FrameProfile.

Source

pub fn record_raster_time(&mut self, elapsed: Duration)

Adds time spent rasterizing, for presenting backends that rasterize outside the runtime.

Source

pub fn record_present_time(&mut self, elapsed: Duration)

Adds time spent presenting, for backends that present outside the runtime.

Source

pub fn finish_frame_profile(&mut self) -> FrameProfile

Publishes the accumulated profile to the hook and starts a fresh frame. Returns the profile that was completed.

Source

pub fn render_frame<P: SurfacePresenter>( &mut self, compositor: &mut SwapchainCompositor, presenter: &mut P, force_redraw: bool, ) -> Result<bool, PresentError>

Renders the current frame and presents it to the given surface presenter via the swapchain compositor.

Source

pub fn run_with_window<W, E, P>( &mut self, window: &mut W, event_loop: &mut E, compositor: &mut SwapchainCompositor, presenter: &mut P, )

Runs the reactive event loop against a live platform window and surface presenter.

Source

pub fn render_to_framebuffer(&mut self) -> FrameBuffer

Rasterizes the current application frame to an offscreen headless FrameBuffer.

Source

pub fn export_png<P: AsRef<Path>>(&mut self, path: P) -> Result<(), String>

Captures a headless screenshot of the current application state and writes it to a PNG file.

Trait Implementations§

Source§

impl Debug for AppRuntime

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoInitialState<T> for T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>