The core definition of the UI.
{ version : String
, root : List (Property a)
}
version : String
Current version, to be accessible from code.
{ def : Def a
, name : String
, property : Maybe String
, live : Basics.Bool
, shape : Maybe CellShape
, triggerOn : Maybe Path
, statePath : Maybe Path
}
( PropertyRec a, a )
root : a -> Property a
Truly optional to use. If you want to attach the controls to some common parrent, this is the way to do it. Don't use it anywhere in the tree except as in the root.
ghost : String -> a -> Property a
Create ghost with given name
List String
A path to the property in the tree. So, all the first-level properties have the path of [0]
.
The second property that lies in the folder at index 3
has a path [0, 3, 1]
.
List Basics.Int
A path to the property in the tree. So, all the first-level properties have the path of [0]
.
The second property that lies in the folder at index 3
has a path [0, 3, 1]
.
get : Property a -> a
Get value of the property
{ min : Basics.Int
, max : Basics.Int
, step : Basics.Int
, current : Basics.Int
}
{ min : Basics.Float
, max : Basics.Float
, step : Basics.Float
, current : Basics.Float
}
{ x : FloatDef
, y : FloatDef
}
{ current : Basics.Bool }
{ current : Color }
{ current : String }
{ face : Face }
{ current : Gradient
, presets : List Color
}
{ api : Url }
{ current : Basics.Float
, kind : ZoomKind
}
{ current : String
, values : List SelectItem
, nestAt : Maybe String
, kind : SelectKind
}
{ children : List (Property a)
, nestAt : Maybe String
, panel : Panel
}
fold : (Property a -> x -> x) -> x -> GenUI a -> x
Fold the interface structure from top to bottom.
foldWithParent : (Maybe (Property a) -> Property a -> x -> x) -> x -> GenUI a -> x
Fold the interface structure from top to bottom. The first argument is the parent property and the second one is the property being folded itselfs.
foldWithPath : (Path -> Maybe (Property a) -> Property a -> x -> x) -> x -> GenUI a -> x
Fold the interface structure from top to bottom. The function gets property-path and the parent property and the second argument and the third one is the property being folded itself.
foldWithIndexPath : (IndexPath -> Maybe (Property a) -> Property a -> x -> x) -> x -> GenUI a -> x
Fold the interface structure from top to bottom. The function gets path and the parent property and the second argument and the third one is the property being folded itself.
foldWithPaths : (( IndexPath, Path ) -> Maybe (Property a) -> Property a -> x -> x) -> x -> GenUI a -> x
Fold the interface structure from top to bottom. The function gets index-path, property-name-path and the parent property and the second argument and the third one is the property being folded itself.
find : Path -> GenUI a -> Maybe (Property a)
Find property by property-based path. Traverses/folds the tree, so could be slow for a complex structure
findByIndices : Path -> GenUI a -> Maybe (Property a)
Find property by index-based path. Traverses/folds the tree, so could be slow for a complex structure
update : (( IndexPath, Path ) -> Property a -> Maybe (Property b)) -> GenUI a -> GenUI b
Update every property in the tree by applying the given function to it. If the function returns Nothing
, the property is removed, even if it's a nesting.
updateAt : Path -> (Property a -> Maybe (Property a)) -> GenUI a -> GenUI a
Find property by property-based path and update it with given function.
The function gets Nothing
if the property wasn't found at path.
Traverses/folds the tree, so could be slow for a complex structure
withPath : GenUI a -> GenUI ( ( IndexPath, Path ), a )
Add path information to every property
withIndices : GenUI a -> GenUI ( Basics.Int, a )
Add unique numeric index to every property / control.
defToString : Def a -> String
Convert kind of the property to string, i.e. returns "int" for integer control and "xy" for XY control.
The face of the UI cell, used for Tron UI.
How much space takes the control in the Tron units
{ horz : Unit, vert : Unit }
How many space takes the cell itself, used for Tron UI.
How the select switch looks and acts, used for Tron UI.
{ value : String
, face : Face
, name : Maybe String
}
The item in the select box, a.k.a. option
. value
can be different from name
, so if name
exists, name
should be shown to the user, but the value
should be sent
{ theme : Theme, url : Url }
Icon: its theme and URL
Icon theme: Light or Dark
Icon URL: Remote or local
Which page should be selected on the panel, if there's paging enabled
How to distribute items over pages:
Single
page to fit them into page no matter what;Distribute
is for custom distribution using maxInRow
and maxInColumn
(both in Cells, integer number);Auto
to use the default paging algorithm == Distribute { maxInRow = 3, maxInColumn = 3 }
;Exact
for the exact number of pages and skipping the items that don't fit or having blank pages if they do;{ form : Form
, button : Face
, allOf : Maybe CellShape
, page : Page
, pages : Pages
}
Basics.Int
The number of cells as the dimension of the panel
map : (a -> b) -> GenUI a -> GenUI b
mapProperty : (a -> b) -> Property a -> Property b
mapDef : (a -> b) -> Def a -> Def b