blob: f24438aae4472b26b7fa0b4a0e92fe19fe6a1c73 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
import type { ActionRef, SurfaceOption } from "@dispatch/ui-contract";
/** Normalised view-model for a toggle field. */
export interface ToggleFieldView {
readonly kind: "toggle";
readonly label: string;
readonly value: boolean;
readonly action: ActionRef;
}
/** Normalised view-model for a progress field. */
export interface ProgressFieldView {
readonly kind: "progress";
readonly label: string;
readonly value: number;
}
/** Normalised view-model for a selector field. */
export interface SelectorFieldView {
readonly kind: "selector";
readonly label: string;
readonly value: string;
readonly options: readonly SurfaceOption[];
readonly action: ActionRef;
}
/** Normalised view-model for a stat field. */
export interface StatFieldView {
readonly kind: "stat";
readonly label: string;
readonly value: string;
}
/** Normalised view-model for a button field. */
export interface ButtonFieldView {
readonly kind: "button";
readonly label: string;
readonly action: ActionRef;
}
/** A normalised field view-model — one entry per renderable field kind. */
export type FieldView =
| ToggleFieldView
| ProgressFieldView
| SelectorFieldView
| StatFieldView
| ButtonFieldView;
/** The output of `planSurface`: the ordered list of renderable fields. */
export interface SurfaceRenderPlan {
readonly fields: readonly FieldView[];
}
|