Fix ~cssx/tw positional calling + move flush after content

layouts.sx: change all (~ cssx/tw :tokens "...") to (~cssx/tw "...")
matching the documented positional calling convention.

Move (~cssx/flush) after children so page content rules are also
collected before the server-side <style data-cssx> flush.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 04:41:14 +00:00
parent 0847824935
commit 2fd64351d0

View File

@@ -21,20 +21,20 @@
(shade (signal 500)) (shade (signal 500))
(current-family (computed (fn () (current-family (computed (fn ()
(nth families (mod (deref idx) (len families))))))) (nth families (mod (deref idx) (len families)))))))
(div (~cssx/tw :tokens "block max-w-3xl mx-auto px-4 pt-8 pb-4 text-center") (div (~cssx/tw "block max-w-3xl mx-auto px-4 pt-8 pb-4 text-center")
;; Logo — only this navigates home ;; Logo — only this navigates home
(a :href "/sx/" (a :href "/sx/"
:sx-get "/sx/" :sx-target "#main-panel" :sx-select "#main-panel" :sx-get "/sx/" :sx-target "#main-panel" :sx-select "#main-panel"
:sx-swap "outerHTML" :sx-push-url "true" :sx-swap "outerHTML" :sx-push-url "true"
(~cssx/tw :tokens "block no-underline") (~cssx/tw "block no-underline")
(lake :id "logo" (lake :id "logo"
(span (~cssx/tw :tokens "block mb-2 text-violet-699 text-4xl font-bold font-mono") (span (~cssx/tw "block mb-2 text-violet-699 text-4xl font-bold font-mono")
"(<sx>)"))) "(<sx>)")))
;; Tagline — clicking "reactive" cycles colour. ;; Tagline — clicking "reactive" cycles colour.
(p (~cssx/tw :tokens "mb-1 text-stone-500 text-lg") (p (~cssx/tw "mb-1 text-stone-500 text-lg")
"The framework-free " "The framework-free "
(span (span
(~cssx/tw :tokens "font-bold") (~cssx/tw "font-bold")
:style (str "color:" (colour (deref current-family) (deref shade)) ";" :style (str "color:" (colour (deref current-family) (deref shade)) ";"
"cursor:pointer;transition:color 0.3s,font-weight 0.3s;") "cursor:pointer;transition:color 0.3s,font-weight 0.3s;")
:on-click (fn (e) :on-click (fn (e)
@@ -45,10 +45,10 @@
" hypermedium") " hypermedium")
;; Lake: server morphs copyright on navigation without disturbing signals. ;; Lake: server morphs copyright on navigation without disturbing signals.
(lake :id "copyright" (lake :id "copyright"
(p (~cssx/tw :tokens "text-stone-400 text-xs") (p (~cssx/tw "text-stone-400 text-xs")
"© Giles Bradshaw 2026" "© Giles Bradshaw 2026"
(when path (when path
(span (~cssx/tw :tokens "text-stone-300 text-xs") :style "margin-left:0.5em;" (span (~cssx/tw "text-stone-300 text-xs") :style "margin-left:0.5em;"
(str "· " path)))))))) (str "· " path))))))))
@@ -143,10 +143,10 @@
;; Children as button links ;; Children as button links
(when (get nav-state "children") (when (get nav-state "children")
(~layouts/nav-children :items (get nav-state "children")))) (~layouts/nav-children :items (get nav-state "children"))))
;; Flush CSSX rules collected during header/nav rendering ;; Page content
(~cssx/flush) children
;; Page content follows ;; Flush CSSX rules after all content has rendered
children))) (~cssx/flush))))
;; --------------------------------------------------------------------------- ;; ---------------------------------------------------------------------------
;; SX docs layouts — root header only (nav is in page content via ~layouts/doc) ;; SX docs layouts — root header only (nav is in page content via ~layouts/doc)