Files
mono/sx/sxc/home.sx
giles 13bcf755f6 Add OOB header swaps for sx docs navigation + enable OAuth + fragments
- OOB nav updates: AJAX navigation now swaps both menu bar levels
  (main nav highlighting + sub-nav with current page) using the same
  oob_header_sx/oob_page_sx pattern as blog/market/events
- Enable OAuth for sx and test apps (removed from _NO_OAUTH, added sx
  to ALLOWED_CLIENTS, added app_urls for sx/test/orders)
- Fetch real cross-service fragments (cart-mini, auth-menu, nav-tree)
  instead of hardcoding empty values
- Add :selected param to ~menu-row-sx for white text current-page label
- Fix duplicate element IDs: use menu-row-sx child_id/child mechanism
  instead of manual header_child_sx wrappers
- Fix home page copy: "Server-rendered DOM over the wire (no HTML)"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 23:22:01 +00:00

65 lines
3.7 KiB
Plaintext

;; SX docs — home page components
(defcomp ~sx-hero (&key &rest children)
(div :class "max-w-4xl mx-auto px-6 py-16 text-center"
(h1 :class "text-5xl font-bold text-stone-900 mb-4"
(span :class "text-violet-600" "sx"))
(p :class "text-2xl text-stone-600 mb-8"
"High power tools for HTML — with s-expressions")
(p :class "text-lg text-stone-500 max-w-2xl mx-auto mb-12"
"A hypermedia-driven UI engine that combines htmx's server-first philosophy "
"with React's component model. All rendered via s-expressions over the wire.")
(div :class "bg-stone-50 border border-stone-200 rounded-lg p-6 text-left font-mono text-sm overflow-x-auto"
(pre :class "leading-relaxed" children))))
(defcomp ~sx-philosophy ()
(div :class "max-w-4xl mx-auto px-6 py-12"
(h2 :class "text-3xl font-bold text-stone-900 mb-8" "Design philosophy")
(div :class "grid md:grid-cols-2 gap-8"
(div :class "space-y-4"
(h3 :class "text-xl font-semibold text-violet-700" "From htmx")
(ul :class "space-y-2 text-stone-600"
(li "Server-rendered DOM over the wire (no HTML)")
(li "Hypermedia attributes on any element (sx-get, sx-post, ...)")
(li "Target/swap model for partial page updates")
(li "No client-side routing, no virtual DOM")
(li "Progressive enhancement — works without JS (mostly)")))
(div :class "space-y-4"
(h3 :class "text-xl font-semibold text-violet-700" "From React")
(ul :class "space-y-2 text-stone-600"
(li "Composable components with defcomp")
(li "Client-side rendering from s-expression source")
(li "Component caching via localStorage + hash invalidation")
(li "On-demand CSS — only ship what's used")
(li "DOM morphing for smooth history navigation"))))))
(defcomp ~sx-how-it-works ()
(div :class "max-w-4xl mx-auto px-6 py-12"
(h2 :class "text-3xl font-bold text-stone-900 mb-8" "How it works")
(div :class "space-y-6"
(div :class "flex items-start gap-4"
(div :class "flex-shrink-0 w-8 h-8 rounded-full bg-violet-100 text-violet-700 flex items-center justify-center font-bold" "1")
(div
(h3 :class "font-semibold text-stone-900" "Server renders sx")
(p :class "text-stone-600" "Python builds s-expression trees. Components, HTML elements, data — all in one format.")))
(div :class "flex items-start gap-4"
(div :class "flex-shrink-0 w-8 h-8 rounded-full bg-violet-100 text-violet-700 flex items-center justify-center font-bold" "2")
(div
(h3 :class "font-semibold text-stone-900" "Wire sends text/sx")
(p :class "text-stone-600" "Responses are s-expression source code with content type text/sx. Component definitions cached client-side.")))
(div :class "flex items-start gap-4"
(div :class "flex-shrink-0 w-8 h-8 rounded-full bg-violet-100 text-violet-700 flex items-center justify-center font-bold" "3")
(div
(h3 :class "font-semibold text-stone-900" "Client evaluates + renders")
(p :class "text-stone-600" "sx.js parses, evaluates, and renders to DOM. Same evaluator runs server-side (Python) and client-side (JS)."))))))
(defcomp ~sx-credits ()
(div :class "max-w-4xl mx-auto px-6 py-12 border-t border-stone-200"
(p :class "text-stone-500 text-sm"
"sx is heavily inspired by "
(a :href "https://htmx.org" :class "text-violet-600 hover:underline" "htmx")
" by Carson Gross. This documentation site is modelled on "
(a :href "https://four.htmx.org" :class "text-violet-600 hover:underline" "four.htmx.org")
". htmx showed that HTML is the right hypermedia format. "
"sx takes that idea and wraps it in parentheses.")))