engine

Submodules

Structs

Globals

Engine-wide reactive globals exposed to every component frame.

Properties

elapsed_frames

Type: Property<u64>

elapsed_millis

Type: Property<u64>

viewport

Type: Property<TransformAndBounds<NodeLocal, Window>>

gyro

Type: Property<Gyro>

accel

Type: Property<Accel>

route_location

Type: Property<RouteLocation>

browser_allows_scroller_vector_layers

Type: Property<bool>

browser_allows_nested_scroller_vector_layers

Type: Property<bool>

platform

Type: Platform

os

Type: OS

target

Type: TargetInfo

get_elapsed_millis

Type: Rc<dyn Fn() -> u128>

Implementations

stack_frame
pub fn stack_frame(&self) -> Rc<RuntimePropertiesStackFrame>

Build the root stack frame containing built-in globals plus internal engine state.


Handler

Runtime event handler thunk generated from template bindings.

Properties

function

Type: fn()

location

Type: HandlerLocation

Implementations

new_component_handler
pub fn new_component_handler(function: fn()) -> Self

Build a handler whose self argument is the containing component.

new_inline_handler
pub fn new_inline_handler(function: fn()) -> Self

Build a handler whose self argument is the inline primitive/component.


HandlerRegistry

Map from event key to one or more handlers registered on an instance node.

Properties

handlers

Type: HashMap<String, Vec<Handler>>


PaxEngine

Singleton struct storing everything related to properties computation & rendering

Properties

runtime_context

Type: Rc<RuntimeContext>

root_expanded_node

Type: Option<Rc<ExpandedNode>>

scroller_tiling_policy

Type: ScrollerTilingPolicy

Implementations

Central instance of the PaxEngine and runtime, intended to be created by a particular chassis. Contains all rendering and runtime logic.

mount_root_component
pub fn mount_root_component(&mut self, main_component_instance: Rc<ComponentInstance>) -> Rc<ExpandedNode>

Mount a root component tree into an existing runtime kernel.

set_viewport_size
pub fn set_viewport_size(&mut self, new_viewport_size: (f64, f64))

Called by chassis when viewport size changes, e.g. with native window resizes

tick
pub fn tick(&mut self) -> Vec<NativeMessage>

Workhorse methods of every tick. Will be executed up to 240 Hz. Three phases:

  1. Expand nodes & compute properties; recurse entire instance tree and evaluate ExpandedNodes, stitching together parent/child relationships between ExpandedNodes along the way.
  2. Compute layout (z-index & TransformAndBounds) by visiting ExpandedNode tree in rendering order, writing computed rendering-specific values to ExpandedNodes
  3. Render: a. find lowest node (last child of last node) b. start rendering, from lowest node on-up, throughout tree
unmount
pub fn unmount(&mut self)

Detach the mounted root component tree, leaving the runtime kernel empty.

Enums

HandlerLocation

Indicates whether a handler should receive inline-node or containing-component properties.

Variants

Inline
Component