|
|
|
@ -1,22 +1,3 @@
|
|
|
|
listRow = config \
|
|
|
|
|
|
|
|
color = (config.selected | True \ "rgba(255,255,255,0.2)" | False \ "transparent");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Clickable {
|
|
|
|
|
|
|
|
event = config.onClick,
|
|
|
|
|
|
|
|
child = Stack {
|
|
|
|
|
|
|
|
children = [
|
|
|
|
|
|
|
|
Rect { w = config.w, h = config.h, color = color },
|
|
|
|
|
|
|
|
centerV config.h (
|
|
|
|
|
|
|
|
Positioned {
|
|
|
|
|
|
|
|
x = 10,
|
|
|
|
|
|
|
|
y = 10,
|
|
|
|
|
|
|
|
child = Text { content = config.child, color = "white" }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
palette = config \
|
|
|
|
palette = config \
|
|
|
|
focusedIndex = 0;
|
|
|
|
focusedIndex = 0;
|
|
|
|
windowHeight = 400;
|
|
|
|
windowHeight = 400;
|
|
|
|
@ -31,6 +12,25 @@ palette = config \
|
|
|
|
contentHeight = windowHeight - (padding * 2);
|
|
|
|
contentHeight = windowHeight - (padding * 2);
|
|
|
|
listHeight = contentHeight - 40;
|
|
|
|
listHeight = contentHeight - 40;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
paletteRow = config \
|
|
|
|
|
|
|
|
color = (config.selected | True \ "rgba(255,255,255,0.2)" | False \ "transparent");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Clickable {
|
|
|
|
|
|
|
|
event = config.onClick,
|
|
|
|
|
|
|
|
child = Stack {
|
|
|
|
|
|
|
|
children = [
|
|
|
|
|
|
|
|
Rect { w = config.w, h = config.h, color = color },
|
|
|
|
|
|
|
|
centerV config.h (
|
|
|
|
|
|
|
|
Positioned {
|
|
|
|
|
|
|
|
x = 10,
|
|
|
|
|
|
|
|
y = 10,
|
|
|
|
|
|
|
|
child = Text { content = config.child, color = "white" }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|