SurfaceModel

data class SurfaceModel(val surfaceId: String, val catalogId: String? = null, val sendDataModel: Boolean = false, val metadata: SurfaceMetadata? = null, val components: Map<ComponentId, Component> = emptyMap(), val dataModel: JsonObject = JsonObject(emptyMap()))

The renderer's state for one surface: its components, its data model, and the settings the createSurface message fixed.

Components are held as the flat map the specification's adjacency-list model calls for, not as a tree. The tree is rebuilt at render time from id references, which is what lets the agent send definitions in any order and lets rendering start as soon as root arrives — see ChildResolver for why the rebuild needs the catalog.

Constructors

Link copied to clipboard
constructor(surfaceId: String, catalogId: String? = null, sendDataModel: Boolean = false, metadata: SurfaceMetadata? = null, components: Map<ComponentId, Component> = emptyMap(), dataModel: JsonObject = JsonObject(emptyMap()))

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val dataModel: JsonObject
Link copied to clipboard

True once root has arrived and the surface can be drawn.

Link copied to clipboard
Link copied to clipboard

The component mounted as the child of the surface's canonical Surface container, or null until it arrives.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

The component id names, or null when it has not been defined (yet, or at all).

Link copied to clipboard
fun read(pointer: JsonPointer, scope: EvaluationScope = EvaluationScope.Root): JsonElement?

The value pointer addresses in this surface's data model, resolved in scope.

Link copied to clipboard
fun SurfaceModel.renderCost(resolver: ChildResolver, limits: RenderLimits = RenderLimits.DEFAULT, from: ComponentId = Surface.ROOT_ID): RenderCost

What drawing this surface from from would cost, without drawing any of it.

Link copied to clipboard
fun SurfaceModel.walk(resolver: ChildResolver, limit: Int = DEFAULT_WALK_LIMIT, maxDepth: Int = DEFAULT_MAX_DEPTH): List<Pair<Component, EvaluationScope>>

Every component instance reachable from SurfaceModel.root, depth first, each paired with the scope it renders in.

Link copied to clipboard

This surface with incoming merged in, keyed by id.

Link copied to clipboard
fun withDataModel(pointer: JsonPointer, value: JsonElement): SurfaceModel

This surface with value written into its data model at pointer.