From 0d5effd6afe8808296a01db102ca4c247cdcd1af Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sat, 26 Sep 2026 11:33:31 +0100 Subject: Show filtered lists and their shared focus A list may now be filtered (each t in tasks where !t.done), and several filtered lists over one list share one focus: the focus view names an item, so Vega asks Pure which row shows it and highlights it only in the list that holds it; the other lists have no focus (null in the web surface's JSON, and the spoken surface names the item where it is). A click or point on a row points at the item that row shows, and the wheel on a list without the focus focuses the row under it. Pure's rows now take a mutable app. examples/today.aup shows what is open and what is done; its CLI output matches a model over random adds, moves, toggles and points into either list, and the web surface leaves the other list without a focus. --- examples/today.aup | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 examples/today.aup (limited to 'examples/today.aup') diff --git a/examples/today.aup b/examples/today.aup new file mode 100644 index 0000000..e5db53b --- /dev/null +++ b/examples/today.aup @@ -0,0 +1,39 @@ +# Two lists over one list state: what is open and what is done. Each shows +# the items its where keeps; the focus (at) is one item, shown in whichever +# list holds it, and a click in either list points at that item. +use vega + +record Task { + title: text + done = 0 +} + +state tasks: list of Task +state at: index of tasks + +input add = text +input up = key ArrowUp +input down = key ArrowDown +input toggle = key Space + +on add { + tasks.append(Task { title: add }) + at = tasks.last +} +on up.down { at = at - 1 } +on down.down { at = at + 1 } +on toggle.down { at.done = !at.done } + +view title = "Today" +view left = "{count(t in tasks where !t.done)} open" + +view open = each t in tasks where !t.done { + label = t.title +} +view open_focus = at.position + +view done = each t in tasks where t.done { + label = t.title + tone = vega.muted +} +view done_focus = at.position -- cgit v1.2.3