Host integration
Connect the DOM, a scene graph or a native paint host to application input and resource lifetimes.
DOM
Create a mount with createDomSurface({ container, onIntent, acquireAsset }). Repeated calls to update(root) on that instance reuse DOM elements and players by node ID. An asset provider returns a lease with dispose(). Safe relative URLs also work directly. Call dispose() when unmounting. Complete TSX example
Scene graph
Call renderSceneSurface(root, parent, options) from @quajs/quaui/scene. Implement creation, placement and painting in options.nodes and connect host resources with resolveImage and presentMedia. The host tears down its nodes and leases and routes clicks to the projected intents.
Native paint
This minimal host records node IDs and paint ranks. It lets you inspect a layout before connecting a graphics device.
Rustuse quaui::prelude::*;use quaui::renderer::{NativePaintHost, PaintNode};use quaui::UiSurfaceNodeRect;#[derive(Default)]struct DrawList(Vec<(usize, String)>);impl NativePaintHost for DrawList { type Clip = UiSurfaceNodeRect; type Mark = (); fn clip(&self, bounds: UiSurfaceNodeRect) -> Self::Clip { bounds } fn paint(&mut self, entry: &PaintNode<'_, Self::Clip>) { self.0.push((entry.span.start, entry.node.id.clone())); }}fn main() -> Result<(), LayoutError> { let surface = button("next", "Continue").size(152.0, 48.0).compile(152.0, 48.0)?; let mut host = DrawList::default(); surface.paint(&mut host); host.0.sort_by_key(|(rank, _)| *rank); assert_eq!(host.0[0].1, "next"); Ok(())}
A drawing backend reads paint properties from entry.node, obtains offset bounds with entry.offset.rect(entry.node.bounds), applies ancestor entry.clips and resolves resources with entry.provenance. The finish callback can composite a subtree when it closes. Call quaui::renderer::paint_surface directly for a nonzero starting offset.
Keep state and intent handling in the application, then submit its next surface. QuaEngine's wgpu renderer is one such native consumer. QuaEngine documentation