Logo FS-Skia-UI

Control Module

Core authoring and rendering verbs for `Control<'msg>` — construction, standard/custom lowering, keying, single-control preview `render` and nested `renderTree`.

Functions and values

Function or value Description

count control

Full Usage: count control

Parameters:
Returns: int
Type parameters: 'msg

Count the total nodes in a control's tree (self plus all descendants); a structural metric used by tests and tooling.

control : Control<'msg>
Returns: int

create kind attrs

Full Usage: create kind attrs

Parameters:
Returns: Control<'msg>
Type parameters: 'msg

Build a `Control<'msg>` from an arbitrary `ControlKind` and its attribute list — the general constructor the per-kind `*.create` builders are sugar over.

kind : ControlKind
attrs : Attr<'msg> list
Returns: Control<'msg>

customControl kind attrs

Full Usage: customControl kind attrs

Parameters:
    kind : string
    attrs : Attr<'msg> list

Returns: Control<'msg>
Type parameters: 'msg

Build a consumer-defined control whose kind is a free-form `kind` string, for control families outside the built-in `StandardControlKind` catalog.

kind : string
attrs : Attr<'msg> list
Returns: Control<'msg>

diagnostics control

Full Usage: diagnostics control

Parameters:
Returns: ControlDiagnostic list
Type parameters: 'msg

Collect the `ControlDiagnostic` list a control's tree reports (e.g. authoring issues), for surfacing in tooling without rendering.

control : Control<'msg>
Returns: ControlDiagnostic list

dispatch event control

Full Usage: dispatch event control

Parameters:
Returns: 'msg list
Type parameters: 'msg

Translate an incoming `ControlEvent` into the `'msg` list a control's bindings emit — the dispatch step the interactive host runs to feed the MVU update loop.

event : ControlEvent
control : Control<'msg>
Returns: 'msg list

hitTest result x y

Full Usage: hitTest result x y

Parameters:
Returns: ControlId option
Type parameters: 'msg

Resolve which rendered control (if any) contains the point (x, y), from the public `renderTree` result alone. `None` when the point lies in a gap. Layered over `Layout.hitTestComputed` against the evaluated `Bounds` (FR-012).

result : ControlRenderResult<'msg>
x : float
y : float
Returns: ControlId option

lowerCustom control

Full Usage: lowerCustom control

Parameters:
Returns: Control<'msg>
Type parameters: 'msg

Lower a `customControl` into its primitive composition; the custom-kind counterpart to `lowerStandard`.

control : Control<'msg>
Returns: Control<'msg>

lowerStandard control

Full Usage: lowerStandard control

Parameters:
Returns: Control<'msg>
Type parameters: 'msg

Lower a `standard`-kind control into its primitive composition (the expansion the renderer consumes); a control whose kind needs no expansion is returned unchanged.

control : Control<'msg>
Returns: Control<'msg>

map f control

Full Usage: map f control

Parameters:
    f : 'a -> 'b
    control : Control<'a>

Returns: Control<'b>
Type parameters: 'a, 'b

Feature 108 (US5, FR-014): change ONLY the message type of a control. `Kind`, `Key`, `Content`, `Accessibility`, and the `Children` shape are preserved exactly; every `Attr`'s `AttrValue` is rewritten so its `'a`-bearing handler (`MessageValue`, `EventValue`) maps through `f` and its nested controls (`ChildValue`/`ChildrenValue`/`SlotFillsValue`) recurse. The result lowers structurally equal to a control authored directly in `'b` (SC-007), so a page authored as a self-contained `Control` folds into a shell via one `Control.map PageMsg`. Keys / focus identity survive — only the message type changes.

f : 'a -> 'b
control : Control<'a>
Returns: Control<'b>

nearestAuthored result hit

Full Usage: nearestAuthored result hit

Parameters:
Returns: ControlId option
Type parameters: 'msg

Resolve a structural hit `ControlId` (the id a `PointerInteraction`/`hitTest` carries — a `Key` for an authored node, else the positional path `renderTree` assigns) to the nearest ancestor (incl. self) the consumer authored with a `withKey`, as that ancestor's authored `ControlId`. A click inside a container-keyed composite recovers the container's id (so the interactive host can route its binding); a directly-keyed leaf resolves to itself. `None` when no keyed ancestor exists on the hit node's path — the host then falls back to `MapPointer` with the raw interaction, never inventing an id. Pure/total/deterministic; reads the `renderTree` layout tree only, no layout-math change (FR-004/FR-004a/FR-005, feature 090).

result : ControlRenderResult<'msg>
hit : ControlId
Returns: ControlId option

render theme control

Full Usage: render theme control

Parameters:
Returns: ControlRenderResult<'msg>
Type parameters: 'msg

Render a SINGLE control to a `ControlRenderResult<'msg>` preview at intrinsic size (Feature 080); use `renderTree` to lay out and paint nested children.

theme : Theme
control : Control<'msg>
Returns: ControlRenderResult<'msg>

renderTree theme size control

Full Usage: renderTree theme size control

Parameters:
Returns: ControlRenderResult<'msg>
Type parameters: 'msg

Faithfully rasterize a NESTED control tree to a Scene using real Yoga layout and paint at the given output size (distinct from `render`, the Feature-080 single-control PREVIEW). Lays out and paints nested containers AND their children at their computed bounds, so two structurally different trees produce visibly different scenes. The returned `Layout`/`EventBindings` correlate by `ControlId` for host hit-testing. Additive: `render` and `Widget.render` are unchanged (FR-001/FR-002/FR-003). Feature 091 (behavioral note, signature unchanged): the interactive host loops no longer call `renderTree` afresh every frame — each next frame is produced by diffing the next lowered tree against a retained previous tree (`module internal RetainedRender`) and reusing the unchanged subtrees' cached render fragments. The per-node measure/paint here is factored into `ControlInternals.evaluateLayout` / `paintNode`, which the retained path reuses, so a full `renderTree` and the retained partial render are byte-for-byte identical (FR-005).

theme : Theme
size : Size
control : Control<'msg>
Returns: ControlRenderResult<'msg>

standard kind attrs

Full Usage: standard kind attrs

Parameters:
Returns: Control<'msg>
Type parameters: 'msg

Build a control from a `StandardControlKind` (the framework's built-in catalog kinds), keeping the kind on the typed enum rather than a free-form string.

kind : StandardControlKind
attrs : Attr<'msg> list
Returns: Control<'msg>

withKey key control

Full Usage: withKey key control

Parameters:
Returns: Control<'msg>
Type parameters: 'msg

Stamp a stable identity `key` onto a control so the keyed reconciler tracks it across sibling-shifting re-renders (the `withKey` anchor read by `nearestAuthored`).

key : ControlId
control : Control<'msg>
Returns: Control<'msg>

Type something to start searching.