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 the total nodes in a control's tree (self plus all descendants); a structural metric used by tests and tooling.
|
Full Usage:
create kind attrs
Parameters:
ControlKind
attrs : Attr<'msg> list
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.
|
|
|
Full Usage:
diagnostics control
Parameters:
Control<'msg>
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.
|
Full Usage:
dispatch event control
Parameters:
ControlEvent
control : Control<'msg>
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.
|
Full Usage:
hitTest result x y
Parameters:
ControlRenderResult<'msg>
x : float
y : float
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).
|
|
|
|
|
|
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
|
Full Usage:
nearestAuthored result hit
Parameters:
ControlRenderResult<'msg>
hit : ControlId
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).
|
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.
|
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).
|
Full Usage:
standard kind attrs
Parameters:
StandardControlKind
attrs : Attr<'msg> list
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.
|
|