dreamstack/examples/callback-demo.ds
enzotar 9d01f1b702 feat: component event callbacks + function prop forwarding
- ComponentUse wraps Assign/MethodCall/Block props as arrow functions
- Component prop wrapper preserves function props (typeof check)
- Event handler fallthrough calls function-type identifiers
- New: examples/callback-demo.ds with Button onClick callbacks
- All existing examples build successfully
2026-02-26 16:51:58 -08:00

23 lines
760 B
Text

-- DreamStack Callback Demo
-- Tests component event callbacks
import { Card } from "../registry/components/card"
import { Button } from "../registry/components/button"
let count = 0
let message = "Click a button"
view main = column [
text "🔗 Component Callbacks" { variant: "title" }
text "Components can trigger parent actions" { variant: "subtitle" }
Card { title: "Using Button Component", subtitle: "callback props" } [
text "Count: {count}" { variant: "title" }
text message { variant: "subtitle" }
row [
Button { label: "+1", onClick: count += 1, variant: "primary" }
Button { label: "-1", onClick: count -= 1, variant: "secondary" }
Button { label: "Reset", onClick: count = 0, variant: "ghost" }
]
]
]