forked from tidbyt/pixlet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.star
43 lines (39 loc) · 1.03 KB
/
example.star
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
load("encoding/json.star", "json")
load("render.star", "render")
load("schema.star", "schema")
def main(config):
option = config.get("search", '{"display": "Blueberry", "value": "blueberry"}')
fruit = json.decode(option)
return render.Root(
child = render.Marquee(
width = 64,
child = render.Text(fruit["display"]),
),
)
def search(pattern):
if pattern.startswith("a"):
return [
schema.Option(
display = "Apple",
value = "apple",
),
schema.Option(
display = "Apricot",
value = "apricot",
),
]
else:
return []
def get_schema():
return schema.Schema(
version = "1",
fields = [
schema.Typeahead(
id = "search",
name = "Search",
desc = "A list of items that match search.",
icon = "gear",
handler = search,
),
],
)