dreamstack/examples/router.ds
enzotar adff40d47f feat: hash-based router + keyed list reconciliation
Phase 7 features:
- route "/path" -> body declarations with hash-based routing
- navigate "/path" built-in function
- DS.route signal tracks current hash path
- DS.matchRoute() with :param pattern matching
- DS.keyedList() for keyed DOM reconciliation
- Route-aware mounting: views + routes compose
- examples/router.ds: 3-page app (home/about/counter)
- State persists across route changes (10818 bytes)
2026-02-25 07:54:00 -08:00

35 lines
788 B
Text

-- DreamStack Router Example
-- Multi-page app with hash-based routing
let page_title = "DreamStack Router"
view nav = row [
button "Home" { click: navigate "/" }
button "About" { click: navigate "/about" }
button "Counter" { click: navigate "/counter" }
]
let count = 0
route "/" ->
column [
text "Welcome to DreamStack!"
text "Use the nav bar above to explore pages."
]
route "/about" ->
column [
text "About DreamStack"
text "A reactive UI language with fine-grained signals."
text "No virtual DOM. No dependency arrays. No re-renders."
]
route "/counter" ->
column [
text "Interactive Counter"
text count
button "+" { click: count += 1 }
button "-" { click: count -= 1 }
when count > 10 ->
text "Double digits!"
]