Logo FS-Skia-UI

ControlsElmish Module

Public contract module exposed by this FS.Skia.UI package.

Nested modules

Modules Description

Perf

Feature 108 (US3, FR-009/010): the pure, headless, deterministic frame driver. Folds an ordered `FrameInput` script over the host's pure `Update` + `RetainedRender.step`, advancing one frame per step (consecutive pointer-MOVE inputs coalesce into a single frame) and accumulating the per-frame `FrameMetrics`. Shares the message→update→retained-step + clock-advance + coalescing code path with `runInteractiveApp` (no parallel logic), so a regression that un-coalesces moves or reintroduces a per-hover full rebuild fails the byte-stable count golden (SC-003/004/005) rather than shipping. The four count/bool fields are identical across repeated runs of the same script; `FrameDuration` is not asserted.

Functions and values

Function or value Description

captureRespondsProof host state size model input

Full Usage: captureRespondsProof host state size model input

Parameters:
Returns: RespondsProof
Type parameters: 'model, 'msg

Capture an input→visible-change responds-proof for a pointer interaction on the running host (feature 090, FR-006/FR-007): render the BEFORE frame, route the interaction through the real `routeInteractivePointer` adapter path, fold the produced messages with `host.Update`, render the AFTER frame, and emit both frames + a verdict. A host whose live window is inert (an authored binding dropped) yields identical frames and an `Inert` verdict — it cannot be passed off as a responds-proof. Reuses the production render path; no live Vulkan window required.

host : InteractiveAppHost<'model, 'msg>
state : PointerState
size : Size
model : 'model
input : ViewerPointerInput
Returns: RespondsProof

diagnostic source code message

Full Usage: diagnostic source code message

Parameters:
    source : string
    code : string
    message : string

Returns: AdapterDiagnostic

Public contract function exposed by this FS.Skia.UI package.

source : string
code : string
message : string
Returns: AdapterDiagnostic

interpretControlEffect mapRuntime effect

Full Usage: interpretControlEffect mapRuntime effect

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

Public contract function exposed by this FS.Skia.UI package.

mapRuntime : ControlRuntimeMsg -> 'msg
effect : ControlRuntimeEffect
Returns: AdapterCommand<'msg>

interpretKeyboardEffect mapCommand effect

Full Usage: interpretKeyboardEffect mapCommand effect

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

Public contract function exposed by this FS.Skia.UI package.

mapCommand : CommandId -> 'msg
effect : KeyboardEffect
Returns: AdapterCommand<'msg>

interpretPointerEffect mapInteraction interaction

Full Usage: interpretPointerEffect mapInteraction interaction

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

Lower a single pointer interaction (075) into adapter commands. Diagnostics lower to `ReportAdapterDiagnostic`; every other interaction is offered to the consumer router `mapInteraction` (a `None` result is a no-op `[]`). Mirrors `interpretKeyboardEffect`/`interpretControlEffect`; no new `AdapterEffect` case is required. FR-001/FR-010/FR-011.

mapInteraction : PointerInteraction -> 'msg option
interaction : PointerInteraction
Returns: AdapterCommand<'msg>

interpretPointerOutcome mapInteraction interactions runtimeMessages

Full Usage: interpretPointerOutcome mapInteraction interactions runtimeMessages

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

Convenience: lower the `(PointerInteraction list, ControlRuntimeMsg list)` produced by `Pointer.update` in one call — runtime messages through `DispatchControlRuntimeMessage` (applied first to keep `ControlRuntime` state consistent), then interactions through `interpretPointerEffect`.

mapInteraction : PointerInteraction -> 'msg option
interactions : PointerInteraction list
runtimeMessages : ControlRuntimeMsg list
Returns: AdapterCommand<'msg>

program init update view subscriptions

Full Usage: program init update view subscriptions

Parameters:
Returns: AdapterProgram<'model, 'msg>
Type parameters: 'model, 'msg

Public contract function exposed by this FS.Skia.UI package.

init : unit -> 'model * AdapterCommand<'msg>
update : 'msg -> 'model -> 'model * AdapterCommand<'msg>
view : 'model -> Control<'msg>
subscriptions : 'model -> AdapterSubscription<'msg> list
Returns: AdapterProgram<'model, 'msg>

programOfWidget init update view subscriptions

Full Usage: programOfWidget init update view subscriptions

Parameters:
Returns: AdapterProgram<'model, 'msg>
Type parameters: 'model, 'msg

Build a program whose view is authored with the typed front door (returns `Widget<'msg>`); the adapter lowers internally via `Widget.toControl`. Equivalent to `program init update (widgetView view) subscriptions`. FR-001/FR-004.

init : unit -> 'model * AdapterCommand<'msg>
update : 'msg -> 'model -> 'model * AdapterCommand<'msg>
view : 'model -> Widget<'msg>
subscriptions : 'model -> AdapterSubscription<'msg> list
Returns: AdapterProgram<'model, 'msg>

respondsProofOf before after

Full Usage: respondsProofOf before after

Parameters:
Returns: RespondsProof

Build a responds-proof verdict from a before/after frame pair (feature 090, FR-006): `Responsive` when the frames differ, `Inert` when identical. The reusable core the pointer and text responds-proof captures share.

before : Scene
after : Scene
Returns: RespondsProof

routeInteractivePointer host state size model input

Full Usage: routeInteractivePointer host state size model input

Parameters:
Returns: PointerState * 'msg list
Type parameters: 'model, 'msg

The single pointer-routing step the interactive host performs per native pointer sample: renders `host.View size model` via `Control.renderTree host.Theme size`, hit-tests the laid-out bounds through the shipped 075 pipeline (`Pointer.update`, incl. the 4px click/drag fold), then routes each emitted interaction (feature 090, FR-001/FR-003): a hit control's authored `EventBindings` (`onClick`/`onChanged`) are dispatched — the authored control id is recovered via `Control.nearestAuthored` (so a click inside a container-keyed composite resolves to the authored container) and joined with `rendered.EventBindings` by `(ControlId, EventKind)`. An authored binding wins and consumes the interaction; `host.MapPointer` is the fallback, consulted ONLY for interactions no authored binding matched (no double-dispatch). A control with no authored binding behaves exactly as before (additive). Returns the advanced `PointerState` (threaded across samples) plus the product messages. `runInteractiveApp` wires exactly this; exposed so a headless test exercises the real adapter path without opening a window (research D6).

host : InteractiveAppHost<'model, 'msg>
state : PointerState
size : Size
model : 'model
input : ViewerPointerInput
Returns: PointerState * 'msg list

runInteractiveApp options host

Full Usage: runInteractiveApp options host

Parameters:
Returns: Result<ViewerLaunchOutcome, ViewerRunFailure>
Type parameters: 'model, 'msg

Launch `host` as a durable, pointer-routing, size-aware window (feature 085). Each frame renders `host.View size model` through `Control.renderTree host.Theme size`; native pointer samples are hit-tested through `Pointer.update` (incl. the shipped 4px click/drag fold) and routed by `routeInteractivePointer` — a hit control's authored `EventBindings` are dispatched (authored binding wins; `host.MapPointer` is the fallback for unconsumed interactions, feature 090 FR-001/FR-003), and keystrokes are routed focus-first (feature 094 / E4): each native key is offered to the E1 `routeFocusedText` seam (a focused TEXT control's printable keys), then to `routeFocusedKey` (the general activation / navigation / Tab-traversal seam over the focused control's `KeyboardOperation` and the `Focus.order` tab order), and finally falls through to `host.MapKey` for any key no focused control and no traversal consumed. A pointer press sets focus to the focusable control under it (FR-006), so a later key reaches it; a press on a non-focusable region leaves focus unchanged. Reuses `Viewer.runInteractiveViewer`; the durable `Viewer.runApp` literal is untouched. Feature 091 (E2, behavioral note — signature unchanged): the host no longer rebuilds the whole tree every frame. It holds a retained previous tree (`module internal RetainedRender`, the wired 067 reconciler) and produces each frame by `Reconcile.diff`-ing the next tree against it and reusing the unchanged subtrees' cached render fragments — O(changed-subtree), byte-for-byte identical to a full rebuild (FR-004/FR-005). Per-control state re-keys to the stable diff-conferred identity so it survives an unrelated re-render (FR-003); diff diagnostics (e.g. `KeyCollision`) surface through the host diagnostics channel, never dropped (FR-007). The consumer `Init`/`Update`/`View`/`MapKey`/`MapPointer`/`Tick`/`Theme`/ `Diagnostics` contract is unchanged — an existing consumer needs zero changes to benefit (FR-008).

options : ViewerOptions
host : InteractiveAppHost<'model, 'msg>
Returns: Result<ViewerLaunchOutcome, ViewerRunFailure>

runInteractiveAppWithWindowBehavior options behavior host

Full Usage: runInteractiveAppWithWindowBehavior options behavior host

Parameters:
Returns: Result<ViewerLaunchOutcome, ViewerRunFailure>
Type parameters: 'model, 'msg

Feature 122 (FR-003/005): as `runInteractiveApp` with an explicit `ViewerWindowBehaviorRequest` threaded into the live launch (startup-state / resize / maximize / position / backend), so a generated app's parsed `--window-startup normal` actually applies to the controls window instead of only the options report. Delegates to `Viewer.runInteractiveViewerWithWindowBehavior`; `runInteractiveApp` stays the default windowed-fullscreen path, so existing consumers are unaffected.

options : ViewerOptions
behavior : ViewerWindowBehaviorRequest
host : InteractiveAppHost<'model, 'msg>
Returns: Result<ViewerLaunchOutcome, ViewerRunFailure>

subscriptions keyboard controls

Full Usage: subscriptions keyboard controls

Parameters:
Returns: AdapterSubscription<'msg> list
Type parameters: 'msg

Public contract function exposed by this FS.Skia.UI package.

keyboard : AdapterSubscription<'msg> list
controls : AdapterSubscription<'msg> list
Returns: AdapterSubscription<'msg> list

widgetView view

Full Usage: widgetView view

Parameters:
    view : 'model -> Widget<'msg>

Returns: 'model -> Control<'msg>
Type parameters: 'model, 'msg

Adapt a typed (`Widget<'msg>`-returning) view to the `Control<'msg>` view the program record expects (= `view >> Widget.toControl`). Lets typed authoring compose through the adapter with no boundary shim in product code. FR-001/FR-004.

view : 'model -> Widget<'msg>
Returns: 'model -> Control<'msg>

Type something to start searching.