RuntimeUiSession

Narrow owner-thread bridge for a retained runtime UI session.

The construction thread owns this session, and lifecycle and frame operations are synchronous on that thread. Operations reject reentrancy except that recursive close from its own cleanup is an idempotent no-op. The first successful frame gates pointer dispatch. This synchronous bridge does not expose local-state declarations, source bindings, or task launch. Its content is evaluated during the first attach and reevaluated before a later frame when caller-owned observed state changes. The bridge retains the content lambda while created, attached, or detached and releases it before cleanup callbacks after failure or close.

Content, reconciliation, pipeline, input, and cleanup failures preserve the exact primary Throwable and suppression order defined by the core session. A failed session has already performed cleanup; closing it records the closed terminal state without repeating cleanup.

Properties

Link copied to clipboard

Detached identity of the current editable focus interval in the most recently committed attached tree.

Functions

Link copied to clipboard
abstract fun attach()

Attaches this session on its owner thread.

Link copied to clipboard
abstract override fun close()

Closes this session synchronously on its owner thread.

Link copied to clipboard
abstract fun detach()

Detaches this attached session on its owner thread while retaining its tree and content ownership.

Link copied to clipboard
abstract fun dispatchAction(action: () -> Unit)

Runs an authenticated remote action on the session owner thread. The adapter must validate connection ownership, endpoint generation, and event data first. State mutations are allowed; failures poison the session and preserve cleanup failure ordering.

Link copied to clipboard

Dispatches one keyboard event synchronously to the focused component in the most recently committed frame. When focused handlers ignore a Tab press, the retained tree traverses visible accepting owners in cyclic paint order, with Shift reversing direction. Pending geometry uses the same pre-input synchronization as dispatchPointer.

Link copied to clipboard

Dispatches one pointer event synchronously through the most recently committed attached tree on the owner thread.

Link copied to clipboard

Dispatches one committed-character or preedit event synchronously to the focused component in the most recently committed frame. Pending geometry uses the same pre-input synchronization as dispatchPointer.

Link copied to clipboard
abstract fun frame(constraints: Constraints): RuntimeUiFrame

Produces one immutable frame synchronously on the owner thread.

abstract fun frame(constraints: Constraints, time: FrameTime): RuntimeUiFrame

Produces one immutable frame after delivering an explicit monotonic timestamp to time-aware nodes.

Link copied to clipboard
abstract fun <T> projectDeclarations(project: (RuntimeDeclaration) -> T): T

Commits the shared declaration cutoff and calls project without measuring or painting. The callback is owner-thread confined, read-only, and cannot reenter session operations. Its failure poisons and cleans the session exactly like a frame failure. This operation does not enable geometry-based pointer or keyboard dispatch.

Link copied to clipboard
abstract fun resetInputState()

Cancels pointer capture and clears hover and focused input after window blur or an explicit platform input reset.

Link copied to clipboard

Starts owner-thread monitoring at an operation boundary with existing nodes as the baseline. A second active monitor, reentrant access, or an unavailable tree is rejected without changing the screen. The caller closes the monitor; terminal tree cleanup also releases it automatically.