Lake demo: page path in copyright updates across navigation morphs

The ~sx-header island now shows the current page path (faded, after
the copyright) inside the copyright lake. Navigate between pages:
the path text updates via server-driven lake morph while the reactive
colour-cycling signal persists. Subtle visible proof of L2-3.

Also fixes Island &key param serialization in component-source helper.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 15:05:19 +00:00
parent 9b9fc6b6a5
commit b8c5426093
2 changed files with 11 additions and 5 deletions

View File

@@ -15,7 +15,7 @@
;; The server can update these during navigation morphs without disturbing
;; the reactive colour-cycling state. This is Level 2-3: the water (server
;; content) flows through the island, around the rocks (reactive signals).
(defisland ~sx-header ()
(defisland ~sx-header (&key path)
(let ((families (list "violet" "rose" "blue" "emerald" "amber" "cyan" "red" "teal" "pink" "indigo"))
(idx (signal 0))
(shade (signal 500))
@@ -45,10 +45,16 @@
(reset! shade (+ 400 (* (mod (* (deref idx) 137) 5) 50))))))
"reactive")
" hypermedia")
;; Lake: server can update the copyright
;; Lake: server morphs this on every navigation — the path updates
;; while the reactive colour above persists. Visible proof that
;; server content flows through the island without disturbing signals.
(lake :id "copyright"
(p :style (cssx (:text (colour "stone" 400) (size "xs")))
"© Giles Bradshaw 2026")))))
"© Giles Bradshaw 2026"
(when path
(span :style (str (cssx (:text (colour "stone" 300) (size "xs")))
"margin-left:0.5em;")
(str "· " path))))))))
;; @css grid grid-cols-3
@@ -115,7 +121,7 @@
(trail-len (len trail)))
(<>
(div :id "sx-nav" :class "mb-6"
(~sx-header)
(~sx-header :path (or path "/"))
;; Sibling arrows for EVERY level in the trail
;; Last row (leaf) gets is-leaf for larger current page title
(map-indexed (fn (i crumb)

View File

@@ -44,7 +44,7 @@ def _component_source(name: str) -> str:
comp = get_component_env().get(name)
if isinstance(comp, Island):
param_strs = list(comp.params)
param_strs = (["&key"] + list(comp.params)) if comp.params else []
if comp.has_children:
param_strs.extend(["&rest", "children"])
params_sx = "(" + " ".join(param_strs) + ")"