Skip to content

@jsvision/ui / RenderRoot

Interface: RenderRoot

Defined in: ui/src/view/render-root.ts:36

Mounts a view tree and renders it to a screen buffer. This is the seam a host (or the higher-level app shell / event loop) wires the terminal to.

Methods

buffer()

buffer(): ScreenBuffer

Defined in: ui/src/view/render-root.ts:46

The live composed screen buffer — for host integration and tests.

Returns

ScreenBuffer


flush()

flush(): void

Defined in: ui/src/view/render-root.ts:42

Force a synchronous frame now, running any pending scheduled repaint immediately.

Returns

void


mount()

mount(root): void

Defined in: ui/src/view/render-root.ts:38

Mount a view tree: wire its scopes, run the first layout, and compose the first frame.

Parameters

root

View

Returns

void


originOf()

originOf(view): Point | null

Defined in: ui/src/view/render-root.ts:57

The view's absolute top-left cell as of the last time it was composed, or null if it was never composed (unmounted / not visible). The event loop uses this to translate a focused view's desiredCaret() into an absolute terminal cell. An origin survives partial repaints — a view unchanged this frame keeps its last origin — so the caret is never lost just because the focused view was outside the changed region.

Parameters

view

View

The view to locate (typically the focused leaf).

Returns

Point | null

The absolute origin { x, y }, or null if never composed.


resize()

resize(size): void

Defined in: ui/src/view/render-root.ts:40

Resize the viewport, triggering a full re-layout and recompose.

Parameters

size

Size2D

Returns

void


serialize()

serialize(): string

Defined in: ui/src/view/render-root.ts:44

The last frame's damage-diff output (the escape sequences to apply); forces a flush if one is pending.

Returns

string


setRevealAccelerators()

setRevealAccelerators(on, scope?): void

Defined in: ui/src/view/render-root.ts:68

Reveal (or hide) the hotkey-accelerator overlay for the next frame. While on, every widget that draws a ~X~ hotkey underlines its hot glyph. scope limits the reveal to a subtree (e.g. the active modal dialog); null/omitted reveals the whole tree. A change forces one coalesced full recompose on the next frame so the underlines appear/disappear together. Underlining does not change any cell width, so geometry never shifts.

Parameters

on

boolean

Whether the overlay is revealed.

scope?

View | null

The subtree to limit the reveal to, or null for the whole tree.

Returns

void


setTheme()

setTheme(theme): void

Defined in: ui/src/view/render-root.ts:80

Replace the active theme and force one coalesced full recompose, so every view repaints with the new colors on the next frame. A theme swap changes no geometry, so origins are preserved and the caret is not lost. Under the event loop's no-op schedule this only marks the frame dirty — call it through EventLoop.setTheme (or flush() directly) to actually push the frame.

Parameters

theme

Theme

The theme to switch to.

Returns

void

Example

ts
renderRoot.setTheme(nordTheme);
renderRoot.flush(); // push the repainted frame