Files
rose-ash/sx/sx/reference.sx
giles d40a9c6796 sx-tools: WASM kernel updates, TW/CSSX rework, content refresh, new debugging tools
Build tooling: updated OCaml bootstrapper, compile-modules, bundle.sh, sx-build-all.
WASM browser: rebuilt sx_browser.bc.js/wasm, sx-platform-2.js, .sxbc bytecode files.
CSSX/Tailwind: reworked cssx.sx templates and tw-layout, added tw-type support.
Content: refreshed essays, plans, geography, reactive islands, docs, demos, handlers.
New tools: bisect_sxbc.sh, test-spa.js, render-trace.sx, morph playwright spec.
Tests: added test-match.sx, test-examples.sx, updated test-tw.sx and web tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:31:57 +00:00

121 lines
3.8 KiB
Plaintext

(defcomp
~reference/attrs-content
(&key req-table beh-table uniq-table)
(~docs/page
:title "Attribute Reference"
(p
(~tw :tokens "text-stone-600 mb-6")
"sx attributes mirror htmx where possible. This table shows all available attributes and their status.")
(div (~tw :tokens "space-y-8") req-table beh-table uniq-table)))
(defcomp
~reference/headers-content
(&key req-table resp-table)
(~docs/page
:title "Headers"
(p
(~tw :tokens "text-stone-600 mb-6")
"sx uses custom HTTP headers to coordinate between client and server.")
(div (~tw :tokens "space-y-8") req-table resp-table)))
(defcomp
~reference/events-content
(&key table)
(~docs/page
:title "Events"
(p
(~tw :tokens "text-stone-600 mb-6")
"sx fires custom DOM events at various points in the request lifecycle. "
"Listen for them with sx-on:* attributes or addEventListener. "
"Client-side routing fires sx:clientRoute instead of request lifecycle events.")
table))
(defcomp
~reference/js-api-content
(&key table)
(~docs/page :title "JavaScript API" table))
(defcomp
~reference/attr-detail-content
(&key
(title :as string)
(description :as string)
demo
(example-code :as string)
(handler-code :as string?)
(wire-placeholder-id :as string?))
(~docs/page
:title title
(p (~tw :tokens "text-stone-600 mb-6") description)
(when demo (~examples/card :title "Demo" (~examples/demo demo)))
(h3 (~tw :tokens "text-lg font-semibold text-stone-700 mt-6") "S-expression")
(~examples/source :src-code (highlight example-code "lisp"))
(when
handler-code
(<>
(h3
(~tw :tokens "text-lg font-semibold text-stone-700 mt-6")
"Server handler")
(~examples/source :src-code (highlight handler-code "lisp"))))
(when
wire-placeholder-id
(<>
(h3 (~tw :tokens "text-lg font-semibold text-stone-700 mt-6") "Wire response")
(p
(~tw :tokens "text-stone-500 text-sm mb-2")
"Trigger the demo to see the raw response the server sends.")
(~docs/placeholder :id wire-placeholder-id)))))
(defcomp
~reference/header-detail-content
(&key
(title :as string)
(direction :as string)
(description :as string)
(example-code :as string?)
demo)
(~docs/page
:title title
(let
((badge-class (if (= direction "request") "bg-blue-100 text-blue-700" (if (= direction "response") "bg-emerald-100 text-emerald-700" "bg-amber-100 text-amber-700")))
(badge-label
(if
(= direction "request")
"Request Header"
(if
(= direction "response")
"Response Header"
"Request & Response"))))
(div
(~tw :tokens "flex items-center gap-3 mb-4")
(span
:class (str "text-xs font-medium px-2 py-1 rounded " badge-class)
badge-label)))
(p (~tw :tokens "text-stone-600 mb-6") description)
(when demo (~examples/card :title "Demo" (~examples/demo demo)))
(when
example-code
(<>
(h3 (~tw :tokens "text-lg font-semibold text-stone-700 mt-6") "Example usage")
(~examples/source :src-code (highlight example-code "lisp"))))))
(defcomp
~reference/event-detail-content
(&key title description example-code demo)
(~docs/page
:title title
(p (~tw :tokens "text-stone-600 mb-6") description)
(when demo (~examples/card :title "Demo" (~examples/demo demo)))
(when
example-code
(<>
(h3 (~tw :tokens "text-lg font-semibold text-stone-700 mt-6") "Example usage")
(~examples/source :src-code (highlight example-code "lisp"))))))
(defcomp
~reference/attr-not-found
(&key (slug :as string))
(~docs/page
:title "Not Found"
(p (~tw :tokens "text-stone-600") (str "No documentation found for \"" slug "\"."))))