- Duplicate prop keys now merge into Block expressions click: a then click: b → Block([a, b]) - All actions fire in one click (was silently overwriting) - streaming-mood.ds upgraded to semicolons - streaming-stats.ds upgraded to semicolons - Browser-verified: Happy button fires 3 actions (mood+color+energy) - All 7 examples pass regression
33 lines
926 B
Text
33 lines
926 B
Text
-- DreamStack Streaming Mood
|
|
-- Interactive mood and energy tracker.
|
|
-- Only mood, energy, color are exposed (clicks is internal).
|
|
--
|
|
-- Run with:
|
|
-- dreamstack stream examples/streaming-mood.ds --port 3004
|
|
|
|
let mood = "neutral"
|
|
let energy = 50
|
|
let color = "gray"
|
|
let clicks = 0
|
|
|
|
stream mood_tracker on "ws://localhost:9100/peer/mood" {
|
|
mode: signal,
|
|
output: mood, energy, color
|
|
}
|
|
|
|
view mood_tracker =
|
|
column [
|
|
text "😊 Mood Tracker"
|
|
text "Mood: {mood}"
|
|
text "Energy: {energy}%"
|
|
text "Color: {color}"
|
|
row [
|
|
button "😄 Happy" { click: mood = "happy"; color = "green"; energy += 10 }
|
|
button "😐 Neutral" { click: mood = "neutral"; color = "gray" }
|
|
button "😤 Angry" { click: mood = "angry"; color = "red"; energy -= 10 }
|
|
]
|
|
row [
|
|
button "☕ Caffeine" { click: energy += 25; clicks += 1 }
|
|
button "😴 Rest" { click: energy -= 15; clicks += 1 }
|
|
]
|
|
]
|