From 0369bf831ff643b6b2227f4f9a4fa64a2e6e5ce7 Mon Sep 17 00:00:00 2001 From: enzotar Date: Wed, 25 Feb 2026 20:51:01 -0800 Subject: [PATCH] =?UTF-8?q?feat:=20todo=20app=20demo=20=E2=80=94=20streama?= =?UTF-8?q?ble,=20showcases=20v2=20builtins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Push, len, for-in with index, array access, if/then/else in elements, string interpolation, input binding, streaming enabled. 40 lines of .ds code. Run: dreamstack stream examples/todo.ds --- examples/todo.ds | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 examples/todo.ds diff --git a/examples/todo.ds b/examples/todo.ds new file mode 100644 index 0000000..63a65c2 --- /dev/null +++ b/examples/todo.ds @@ -0,0 +1,40 @@ +-- DreamStack Todo App +-- Showcases: push, len, for-in, string interpolation, array access, streaming +-- Stream to phone: dreamstack stream examples/todo.ds --relay ws://YOUR_IP:9100 + +let todos = ["Learn DreamStack", "Build something cool", "Ship it"] +let done = [0, 0, 0] +let input_text = "" +let next_id = 3 +let filter_mode = "all" + +-- Derived counts +let total = len(todos) + +-- Stream: any device on the network can view / interact +stream todo on "ws://localhost:9100" { mode: signal } + +view app = + column [ + text "DreamStack Todos" + text "{total} items" + + -- Add new todo + row [ + input "" { bind: input_text, placeholder: "What needs to be done?" } + button "Add" { click: push(todos, input_text) } + ] + + -- Todo list + for item, i in todos -> + row [ + button (if done[i] then "✅" else "⬜") { click: done[i] = (if done[i] then 0 else 1) } + text (if done[i] then " ̶{item}̶" else item) + ] + + -- Controls + row [ + text "{total} items" + button "Clear All" { click: todos = [] } + ] + ]