Files
mono/sx/sxc/pages/docs.sx
giles 0c9dbd6657 Add attribute detail pages with live demos for SX reference
Per-attribute documentation pages at /reference/attributes/<slug> with:
- Live interactive demos (demo components in reference.sx)
- S-expression source code display
- Server handler code shown as s-expressions (defhandlers in handlers/reference.sx)
- Wire response display via OOB swaps on demo interaction
- Linked attribute names in the reference table

Covers all 20 implemented attributes (sx-get/post/put/delete/patch,
sx-trigger/target/swap/swap-oob/select/confirm/push-url/sync/encoding/
headers/include/vals/media/disable/on:*, sx-retry, data-sx, data-sx-env).

Also adds sx-on:* to BEHAVIOR_ATTRS, updates REFERENCE_NAV to link
/reference/attributes, and makes /reference/ an index page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 17:12:57 +00:00

154 lines
4.4 KiB
Plaintext

;; SX docs app — declarative page definitions
;; These replace the GET route handlers in routes.py
;; ---------------------------------------------------------------------------
;; Home page
;; ---------------------------------------------------------------------------
(defpage home
:path "/"
:auth :public
:layout :sx
:content (home-content))
;; ---------------------------------------------------------------------------
;; Docs section
;; ---------------------------------------------------------------------------
(defpage docs-index
:path "/docs/"
:auth :public
:layout (:sx-section
:section "Docs"
:sub-label "Docs"
:sub-href "/docs/introduction"
:sub-nav (docs-nav "Introduction")
:selected "Introduction")
:content (docs-content "introduction"))
(defpage docs-page
:path "/docs/<slug>"
:auth :public
:layout (:sx-section
:section "Docs"
:sub-label "Docs"
:sub-href "/docs/introduction"
:sub-nav (docs-nav (find-current DOCS_NAV slug))
:selected (or (find-current DOCS_NAV slug) ""))
:content (docs-content slug))
;; ---------------------------------------------------------------------------
;; Reference section
;; ---------------------------------------------------------------------------
(defpage reference-index
:path "/reference/"
:auth :public
:layout (:sx-section
:section "Reference"
:sub-label "Reference"
:sub-href "/reference/"
:sub-nav (reference-nav "")
:selected "")
:content (reference-index-content))
(defpage reference-page
:path "/reference/<slug>"
:auth :public
:layout (:sx-section
:section "Reference"
:sub-label "Reference"
:sub-href "/reference/"
:sub-nav (reference-nav (find-current REFERENCE_NAV slug))
:selected (or (find-current REFERENCE_NAV slug) ""))
:content (reference-content slug))
(defpage reference-attr-detail
:path "/reference/attributes/<slug>"
:auth :public
:layout (:sx-section
:section "Reference"
:sub-label "Reference"
:sub-href "/reference/"
:sub-nav (reference-nav "Attributes")
:selected "Attributes")
:content (reference-attr-detail slug))
;; ---------------------------------------------------------------------------
;; Protocols section
;; ---------------------------------------------------------------------------
(defpage protocols-index
:path "/protocols/"
:auth :public
:layout (:sx-section
:section "Protocols"
:sub-label "Protocols"
:sub-href "/protocols/wire-format"
:sub-nav (protocols-nav "Wire Format")
:selected "Wire Format")
:content (protocol-content "wire-format"))
(defpage protocol-page
:path "/protocols/<slug>"
:auth :public
:layout (:sx-section
:section "Protocols"
:sub-label "Protocols"
:sub-href "/protocols/wire-format"
:sub-nav (protocols-nav (find-current PROTOCOLS_NAV slug))
:selected (or (find-current PROTOCOLS_NAV slug) ""))
:content (protocol-content slug))
;; ---------------------------------------------------------------------------
;; Examples section
;; ---------------------------------------------------------------------------
(defpage examples-index
:path "/examples/"
:auth :public
:layout (:sx-section
:section "Examples"
:sub-label "Examples"
:sub-href "/examples/click-to-load"
:sub-nav (examples-nav "Click to Load")
:selected "Click to Load")
:content (examples-content "click-to-load"))
(defpage examples-page
:path "/examples/<slug>"
:auth :public
:layout (:sx-section
:section "Examples"
:sub-label "Examples"
:sub-href "/examples/click-to-load"
:sub-nav (examples-nav (find-current EXAMPLES_NAV slug))
:selected (or (find-current EXAMPLES_NAV slug) ""))
:content (examples-content slug))
;; ---------------------------------------------------------------------------
;; Essays section
;; ---------------------------------------------------------------------------
(defpage essays-index
:path "/essays/"
:auth :public
:layout (:sx-section
:section "Essays"
:sub-label "Essays"
:sub-href "/essays/sx-sucks"
:sub-nav (essays-nav "sx sucks")
:selected "sx sucks")
:content (essay-content "sx-sucks"))
(defpage essay-page
:path "/essays/<slug>"
:auth :public
:layout (:sx-section
:section "Essays"
:sub-label "Essays"
:sub-href "/essays/sx-sucks"
:sub-nav (essays-nav (find-current ESSAYS_NAV slug))
:selected (or (find-current ESSAYS_NAV slug) ""))
:content (essay-content slug))