Merge worktree-typed into macros: defcomp type annotations

This commit is contained in:
2026-03-11 21:02:12 +00:00
parent 477ce766ff
commit 95ffc0ecb7
6 changed files with 98 additions and 45 deletions

View File

@@ -2,7 +2,9 @@
(defcomp ~sx-home-content ()
(div :id "main-content" :class "max-w-3xl mx-auto px-4 py-6"
(~doc-code :code (highlight (component-source "~sx-header") "lisp"))))
(~doc-code :code (highlight (component-source "~sx-header") "lisp"))
(~doc-code :code (highlight (component-source "~video-player") "lisp"))
(~doc-code :code (highlight (component-source "~video-embed") "lisp"))))
(defcomp ~docs-introduction-content ()
(~doc-page :title "Introduction"

View File

@@ -45,8 +45,8 @@
(reset! shade (+ 400 (* (mod (* (deref idx) 137) 5) 50)))))
;; Only fetch video if none loaded (marsh: reactive + conditional hypermedia)
(let ((embed (dom-query-by-id "video-embed")))
(when (not (dom-first-child embed))
(dom-dispatch (get e "currentTarget") "fetch-video" (dict)))))
(when (not (dom-get-prop embed "firstChild"))
(dom-dispatch (dom-get-prop e "currentTarget") "fetch-video" {}))))
:sx-get "/api/random-video"
:sx-target "#video-embed"
:sx-swap "innerHTML"
@@ -66,9 +66,8 @@
;; navigations. Content swapped in via sx-get from the reactive word click.
;; Empty initially (zero height). Iframe provides height when loaded.
(defisland ~video-player ()
(div :style "display:flex;justify-content:center;"
(div :id "video-embed"
:style "position:relative;width:66%;max-width:20rem;")))
(div :id "video-embed"
:style "position:relative;width:20rem;max-width:66vw;"))
;; @css grid grid-cols-3
@@ -151,7 +150,8 @@
;; Video island — preserved across navigation morphs (like ~sx-header).
;; Outside logo-opacity so it doesn't fade.
;; Marsh demo: reactive click triggers hypermedia fetch, result lands here.
(~video-player)
;; Island renders as inline <span>; force it to block so margin:auto centers.
(div :style "display:flex;justify-content:center;" (~video-player))
;; Sibling arrows for EVERY level in the trail
;; Trail row i is level (i+2) of depth — opacity = (i+2)/depth
;; Last row (leaf) gets is-leaf for larger current page title