dreamstack/examples/multi-action.ds
enzotar 10b2717281 feat: multi-statement event handlers with semicolons
- Added Semicolon token to lexer
- Enables: click: items.push(x); input = ""
- Push-and-clear, increment-and-reset, clear-all patterns
- Browser-verified: both actions fire in one click
- All existing examples pass regression
2026-02-26 17:29:47 -08:00

28 lines
787 B
Text
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- Multi-Action Click Handler Test
-- Tests semicolon-separated actions in click handlers
let items = ["Buy milk", "Walk dog"]
let input = ""
let count = 0
view main = column [
text "Multi-Action Demo" { variant: "title" }
text "Add items AND clear input in one click" { variant: "subtitle" }
row [
input { bind: input, placeholder: "New item..." }
button "Add & Clear" { click: items.push(input); input = "", variant: "primary" }
]
each item in items ->
row [
text "• {item}"
button "×" { click: items.remove(_idx), variant: "ghost" }
]
text "Count: {count}"
row [
button "+5 & Reset Name" { click: count += 5; input = "reset!", variant: "secondary" }
button "Reset All" { click: count = 0; items = [], variant: "ghost" }
]
]