feat: 4-app signal composition demo with explicit outputs
Add 3 new streaming apps with explicit output declarations:
- streaming-clock.ds: output hours, minutes, seconds (tick private)
- streaming-stats.ds: output total, average, max (sum private)
- streaming-mood.ds: output mood, energy, color (clicks private)
Add compose-dashboard.ds that receives all 4 streams via unique
relay channels (/stream/default, /stream/clock, /stream/stats,
/stream/mood) into a single dashboard view.
Each app demonstrates selective signal registration — only declared
outputs are streamed, internal state remains private.
2026-02-26 09:04:22 -08:00
|
|
|
-- DreamStack 4-App Composition Dashboard
|
|
|
|
|
-- Composes signals from 4 independent streaming apps.
|
|
|
|
|
-- Each app has explicit output declarations:
|
|
|
|
|
-- counter: count, doubled (NOT message)
|
|
|
|
|
-- clock: hours, minutes, seconds (NOT tick)
|
|
|
|
|
-- stats: total, average, max (NOT sum, last_sample)
|
|
|
|
|
-- mood: mood, energy, color (NOT clicks)
|
|
|
|
|
--
|
|
|
|
|
-- Run with:
|
|
|
|
|
-- Tab 1: cargo run -p ds-stream
|
|
|
|
|
-- Tab 2: dreamstack stream examples/streaming-counter.ds --port 3000
|
|
|
|
|
-- Tab 3: dreamstack stream examples/streaming-clock.ds --port 3002
|
|
|
|
|
-- Tab 4: dreamstack stream examples/streaming-stats.ds --port 3003
|
|
|
|
|
-- Tab 5: dreamstack stream examples/streaming-mood.ds --port 3004
|
|
|
|
|
-- Tab 6: dreamstack build examples/compose-dashboard.ds
|
|
|
|
|
--
|
|
|
|
|
-- Open the built file in a browser.
|
|
|
|
|
|
2026-02-26 09:45:07 -08:00
|
|
|
let counter = stream from "ws://localhost:9100/stream/counter"
|
feat: 4-app signal composition demo with explicit outputs
Add 3 new streaming apps with explicit output declarations:
- streaming-clock.ds: output hours, minutes, seconds (tick private)
- streaming-stats.ds: output total, average, max (sum private)
- streaming-mood.ds: output mood, energy, color (clicks private)
Add compose-dashboard.ds that receives all 4 streams via unique
relay channels (/stream/default, /stream/clock, /stream/stats,
/stream/mood) into a single dashboard view.
Each app demonstrates selective signal registration — only declared
outputs are streamed, internal state remains private.
2026-02-26 09:04:22 -08:00
|
|
|
let clock = stream from "ws://localhost:9100/stream/clock"
|
|
|
|
|
let stats = stream from "ws://localhost:9100/stream/stats"
|
|
|
|
|
let mood = stream from "ws://localhost:9100/stream/mood"
|
|
|
|
|
|
|
|
|
|
view main =
|
|
|
|
|
column [
|
|
|
|
|
text "🎛️ DreamStack Signal Composition"
|
|
|
|
|
text "4 apps → 1 dashboard"
|
|
|
|
|
row [
|
|
|
|
|
column [
|
|
|
|
|
text "── 🔢 Counter ──"
|
|
|
|
|
text "Count: {counter.count}"
|
|
|
|
|
text "Doubled: {counter.doubled}"
|
|
|
|
|
]
|
|
|
|
|
column [
|
|
|
|
|
text "── 🕐 Clock ──"
|
|
|
|
|
text "{clock.hours}:{clock.minutes}:{clock.seconds}"
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
row [
|
|
|
|
|
column [
|
|
|
|
|
text "── 📊 Stats ──"
|
|
|
|
|
text "Samples: {stats.total}"
|
|
|
|
|
text "Average: {stats.average}"
|
|
|
|
|
text "Max: {stats.max}"
|
|
|
|
|
]
|
|
|
|
|
column [
|
|
|
|
|
text "── 😊 Mood ──"
|
|
|
|
|
text "Mood: {mood.mood}"
|
|
|
|
|
text "Energy: {mood.energy}%"
|
|
|
|
|
text "Color: {mood.color}"
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
]
|