|
|
|
@ -1,4 +1,18 @@
|
|
|
|
listRow = config \
|
|
|
|
palette = config \
|
|
|
|
|
|
|
|
focusedIndex = 0;
|
|
|
|
|
|
|
|
windowHeight = 400;
|
|
|
|
|
|
|
|
windowWidth = 600;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
results = take 10 (config.search config.state.query);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
padding = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
textInputHeight = 40;
|
|
|
|
|
|
|
|
contentWidth = windowWidth - (padding * 2);
|
|
|
|
|
|
|
|
contentHeight = windowHeight - (padding * 2);
|
|
|
|
|
|
|
|
listHeight = contentHeight - 40;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
paletteRow = config \
|
|
|
|
color = (config.selected | True \ "rgba(255,255,255,0.2)" | False \ "transparent");
|
|
|
|
color = (config.selected | True \ "rgba(255,255,255,0.2)" | False \ "transparent");
|
|
|
|
|
|
|
|
|
|
|
|
Clickable {
|
|
|
|
Clickable {
|
|
|
|
@ -17,20 +31,6 @@ listRow = config \
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
palette = config \
|
|
|
|
|
|
|
|
focusedIndex = 0;
|
|
|
|
|
|
|
|
windowHeight = 400;
|
|
|
|
|
|
|
|
windowWidth = 600;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
results = take 10 (config.search config.state.query);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
padding = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
textInputHeight = 40;
|
|
|
|
|
|
|
|
contentWidth = windowWidth - (padding * 2);
|
|
|
|
|
|
|
|
contentHeight = windowHeight - (padding * 2);
|
|
|
|
|
|
|
|
listHeight = contentHeight - 40;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Positioned {
|
|
|
|
Positioned {
|
|
|
|
x = (config.viewport.width - windowWidth) / 2,
|
|
|
|
x = (config.viewport.width - windowWidth) / 2,
|
|
|
|
y = (config.viewport.height - windowHeight) / 2,
|
|
|
|
y = (config.viewport.height - windowHeight) / 2,
|
|
|
|
@ -44,7 +44,7 @@ palette = config \
|
|
|
|
gap = 0,
|
|
|
|
gap = 0,
|
|
|
|
children = [
|
|
|
|
children = [
|
|
|
|
textInput {
|
|
|
|
textInput {
|
|
|
|
key = "query",
|
|
|
|
key = "palette-query",
|
|
|
|
initialValue = config.state.query,
|
|
|
|
initialValue = config.state.query,
|
|
|
|
initialFocus = True,
|
|
|
|
initialFocus = True,
|
|
|
|
color = "white",
|
|
|
|
color = "white",
|
|
|
|
@ -55,6 +55,7 @@ palette = config \
|
|
|
|
onKeyDown = key \ key
|
|
|
|
onKeyDown = key \ key
|
|
|
|
| ArrowUp \ config.state.focusedIndex := max 0 (config.state.focusedIndex - 1)
|
|
|
|
| ArrowUp \ config.state.focusedIndex := max 0 (config.state.focusedIndex - 1)
|
|
|
|
| ArrowDown \ config.state.focusedIndex := (config.state.focusedIndex + 1)
|
|
|
|
| ArrowDown \ config.state.focusedIndex := (config.state.focusedIndex + 1)
|
|
|
|
|
|
|
|
| Enter \ (\ config.onSelect (unwrapOr "" (nth config.state.focusedIndex results)))
|
|
|
|
| _ \ NoOp
|
|
|
|
| _ \ NoOp
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Clip {
|
|
|
|
Clip {
|
|
|
|
@ -62,7 +63,13 @@ palette = config \
|
|
|
|
h = listHeight,
|
|
|
|
h = listHeight,
|
|
|
|
child = Column {
|
|
|
|
child = Column {
|
|
|
|
gap = 1,
|
|
|
|
gap = 1,
|
|
|
|
children = mapWithIndex (t i \ listRow { child = t, w = contentWidth, h = textInputHeight, selected = (config.state.focusedIndex == i), onClick = NoOp }) results
|
|
|
|
children = mapWithIndex (t i \ paletteRow {
|
|
|
|
|
|
|
|
child = t,
|
|
|
|
|
|
|
|
w = contentWidth,
|
|
|
|
|
|
|
|
h = textInputHeight,
|
|
|
|
|
|
|
|
selected = (config.state.focusedIndex == i),
|
|
|
|
|
|
|
|
onClick = \ config.onSelect t
|
|
|
|
|
|
|
|
}) results
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|