;; SX docs app — declarative page definitions ;; All content dispatched via case + direct component references. ;; Navigation is in-page via (~sx-doc :path "..." content...). ;; --------------------------------------------------------------------------- ;; Home page ;; --------------------------------------------------------------------------- (defpage home :path "/" :auth :public :layout :sx-docs :content (~sx-doc :path "/" (~sx-home-content))) ;; --------------------------------------------------------------------------- ;; Docs section ;; --------------------------------------------------------------------------- (defpage docs-index :path "/docs/" :auth :public :layout :sx-docs :content (~sx-doc :path "/docs/" (~docs-introduction-content))) (defpage docs-page :path "/docs/" :auth :public :layout :sx-docs :content (~sx-doc :path (str "/docs/" slug) (case slug "introduction" (~docs-introduction-content) "getting-started" (~docs-getting-started-content) "components" (~docs-components-content) "evaluator" (~docs-evaluator-content) "primitives" (~docs-primitives-content :prims (~doc-primitives-tables :primitives (primitives-data))) "special-forms" (~docs-special-forms-content :forms (~doc-special-forms-tables :forms (special-forms-data))) "server-rendering" (~docs-server-rendering-content) :else (~docs-introduction-content)))) ;; --------------------------------------------------------------------------- ;; Reference section ;; --------------------------------------------------------------------------- (defpage hypermedia-index :path "/hypermedia/" :auth :public :layout :sx-docs :content (~sx-doc :path "/hypermedia/")) (defpage reference-index :path "/hypermedia/reference/" :auth :public :layout :sx-docs :content (~sx-doc :path "/hypermedia/reference/" (~reference-index-content))) (defpage reference-page :path "/hypermedia/reference/" :auth :public :layout :sx-docs :data (reference-data slug) :content (~sx-doc :path (str "/hypermedia/reference/" slug) (case slug "attributes" (~reference-attrs-content :req-table (~doc-attr-table-from-data :title "Request Attributes" :attrs req-attrs) :beh-table (~doc-attr-table-from-data :title "Behavior Attributes" :attrs beh-attrs) :uniq-table (~doc-attr-table-from-data :title "Unique to sx" :attrs uniq-attrs)) "headers" (~reference-headers-content :req-table (~doc-headers-table-from-data :title "Request Headers" :headers req-headers) :resp-table (~doc-headers-table-from-data :title "Response Headers" :headers resp-headers)) "events" (~reference-events-content :table (~doc-two-col-table-from-data :intro "sx fires custom DOM events at various points in the request lifecycle." :col1 "Event" :col2 "Description" :items events-list)) "js-api" (~reference-js-api-content :table (~doc-two-col-table-from-data :intro "The client-side sx.js library exposes a public API for programmatic use." :col1 "Method" :col2 "Description" :items js-api-list)) :else (~reference-attrs-content :req-table (~doc-attr-table-from-data :title "Request Attributes" :attrs req-attrs) :beh-table (~doc-attr-table-from-data :title "Behavior Attributes" :attrs beh-attrs) :uniq-table (~doc-attr-table-from-data :title "Unique to sx" :attrs uniq-attrs))))) (defpage reference-attr-detail :path "/hypermedia/reference/attributes/" :auth :public :layout :sx-docs :data (attr-detail-data slug) :content (~sx-doc :path "/hypermedia/reference/attributes" (if attr-not-found (~reference-attr-not-found :slug slug) (~reference-attr-detail-content :title attr-title :description attr-description :demo attr-demo :example-code attr-example :handler-code attr-handler :wire-placeholder-id attr-wire-id)))) (defpage reference-header-detail :path "/hypermedia/reference/headers/" :auth :public :layout :sx-docs :data (header-detail-data slug) :content (~sx-doc :path "/hypermedia/reference/headers" (if header-not-found (~reference-attr-not-found :slug slug) (~reference-header-detail-content :title header-title :direction header-direction :description header-description :example-code header-example :demo header-demo)))) (defpage reference-event-detail :path "/hypermedia/reference/events/" :auth :public :layout :sx-docs :data (event-detail-data slug) :content (~sx-doc :path "/hypermedia/reference/events" (if event-not-found (~reference-attr-not-found :slug slug) (~reference-event-detail-content :title event-title :description event-description :example-code event-example :demo event-demo)))) ;; --------------------------------------------------------------------------- ;; Protocols section ;; --------------------------------------------------------------------------- (defpage protocols-index :path "/protocols/" :auth :public :layout :sx-docs :content (~sx-doc :path "/protocols/" (~protocol-wire-format-content))) (defpage protocol-page :path "/protocols/" :auth :public :layout :sx-docs :content (~sx-doc :path (str "/protocols/" slug) (case slug "wire-format" (~protocol-wire-format-content) "fragments" (~protocol-fragments-content) "resolver-io" (~protocol-resolver-io-content) "internal-services" (~protocol-internal-services-content) "activitypub" (~protocol-activitypub-content) "future" (~protocol-future-content) :else (~protocol-wire-format-content)))) ;; --------------------------------------------------------------------------- ;; Examples section ;; --------------------------------------------------------------------------- (defpage examples-index :path "/hypermedia/examples/" :auth :public :layout :sx-docs :content (~sx-doc :path "/hypermedia/examples/")) (defpage examples-page :path "/hypermedia/examples/" :auth :public :layout :sx-docs :content (~sx-doc :path (str "/hypermedia/examples/" slug) (case slug "click-to-load" (~example-click-to-load) "form-submission" (~example-form-submission) "polling" (~example-polling) "delete-row" (~example-delete-row) "inline-edit" (~example-inline-edit) "oob-swaps" (~example-oob-swaps) "lazy-loading" (~example-lazy-loading) "infinite-scroll" (~example-infinite-scroll) "progress-bar" (~example-progress-bar) "active-search" (~example-active-search) "inline-validation" (~example-inline-validation) "value-select" (~example-value-select) "reset-on-submit" (~example-reset-on-submit) "edit-row" (~example-edit-row) "bulk-update" (~example-bulk-update) "swap-positions" (~example-swap-positions) "select-filter" (~example-select-filter) "tabs" (~example-tabs) "animations" (~example-animations) "dialogs" (~example-dialogs) "keyboard-shortcuts" (~example-keyboard-shortcuts) "put-patch" (~example-put-patch) "json-encoding" (~example-json-encoding) "vals-and-headers" (~example-vals-and-headers) "loading-states" (~example-loading-states) "sync-replace" (~example-sync-replace) "retry" (~example-retry) :else (~example-click-to-load)))) ;; --------------------------------------------------------------------------- ;; Essays section ;; --------------------------------------------------------------------------- (defpage essays-index :path "/essays/" :auth :public :layout :sx-docs :content (~sx-doc :path "/essays/" (~essays-index-content))) (defpage essay-page :path "/essays/" :auth :public :layout :sx-docs :content (~sx-doc :path (str "/essays/" slug) (case slug "sx-sucks" (~essay-sx-sucks) "why-sexps" (~essay-why-sexps) "htmx-react-hybrid" (~essay-htmx-react-hybrid) "on-demand-css" (~essay-on-demand-css) "client-reactivity" (~essay-client-reactivity) "sx-native" (~essay-sx-native) "tail-call-optimization" (~essay-tail-call-optimization) "continuations" (~essay-continuations) "reflexive-web" (~essay-reflexive-web) "server-architecture" (~essay-server-architecture) "separation-of-concerns" (~essay-separation-of-concerns) "sx-and-ai" (~essay-sx-and-ai) "no-alternative" (~essay-no-alternative) "zero-tooling" (~essay-zero-tooling) "react-is-hypermedia" (~essay-react-is-hypermedia) "hegelian-synthesis" (~essay-hegelian-synthesis) :else (~essays-index-content)))) ;; --------------------------------------------------------------------------- ;; Philosophy section ;; --------------------------------------------------------------------------- (defpage philosophy-index :path "/philosophy/" :auth :public :layout :sx-docs :content (~sx-doc :path "/philosophy/" (~philosophy-index-content))) (defpage philosophy-page :path "/philosophy/" :auth :public :layout :sx-docs :content (~sx-doc :path (str "/philosophy/" slug) (case slug "sx-manifesto" (~essay-sx-manifesto) "godel-escher-bach" (~essay-godel-escher-bach) "wittgenstein" (~essay-sx-and-wittgenstein) "dennett" (~essay-sx-and-dennett) "existentialism" (~essay-s-existentialism) :else (~philosophy-index-content)))) ;; --------------------------------------------------------------------------- ;; CSSX section ;; --------------------------------------------------------------------------- (defpage cssx-index :path "/cssx/" :auth :public :layout :sx-docs :content (~sx-doc :path "/cssx/" (~cssx-overview-content))) (defpage cssx-page :path "/cssx/" :auth :public :layout :sx-docs :content (~sx-doc :path (str "/cssx/" slug) (case slug "patterns" (~cssx-patterns-content) "delivery" (~cssx-delivery-content) "async" (~cssx-async-content) "live" (~cssx-live-content) "comparisons" (~cssx-comparison-content) "philosophy" (~cssx-philosophy-content) :else (~cssx-overview-content)))) ;; --------------------------------------------------------------------------- ;; Specs section ;; --------------------------------------------------------------------------- (defpage specs-index :path "/specs/" :auth :public :layout :sx-docs :content (~sx-doc :path "/specs/" (~spec-architecture-content))) (defpage specs-page :path "/specs/" :auth :public :layout :sx-docs :content (~sx-doc :path (str "/specs/" slug) (case slug "core" (~spec-overview-content :spec-title "Core Language" :spec-files (map (fn (item) (dict :title (get item "title") :desc (get item "desc") :prose (get item "prose") :filename (get item "filename") :href (str "/specs/" (get item "slug")) :source (read-spec-file (get item "filename")))) core-spec-items)) "adapters" (~spec-overview-content :spec-title "Adapters & Engine" :spec-files (map (fn (item) (dict :title (get item "title") :desc (get item "desc") :prose (get item "prose") :filename (get item "filename") :href (str "/specs/" (get item "slug")) :source (read-spec-file (get item "filename")))) adapter-spec-items)) "browser" (~spec-overview-content :spec-title "Browser" :spec-files (map (fn (item) (dict :title (get item "title") :desc (get item "desc") :prose (get item "prose") :filename (get item "filename") :href (str "/specs/" (get item "slug")) :source (read-spec-file (get item "filename")))) browser-spec-items)) "extensions" (~spec-overview-content :spec-title "Extensions" :spec-files (map (fn (item) (dict :title (get item "title") :desc (get item "desc") :prose (get item "prose") :filename (get item "filename") :href (str "/specs/" (get item "slug")) :source (read-spec-file (get item "filename")))) extension-spec-items)) :else (let ((spec (find-spec slug))) (if spec (~spec-detail-content :spec-title (get spec "title") :spec-desc (get spec "desc") :spec-filename (get spec "filename") :spec-source (read-spec-file (get spec "filename")) :spec-prose (get spec "prose")) (~spec-not-found :slug slug)))))) ;; --------------------------------------------------------------------------- ;; Bootstrappers section ;; --------------------------------------------------------------------------- (defpage bootstrappers-index :path "/bootstrappers/" :auth :public :layout :sx-docs :content (~sx-doc :path "/bootstrappers/" (~bootstrappers-index-content))) (defpage bootstrapper-page :path "/bootstrappers/" :auth :public :layout :sx-docs :data (bootstrapper-data slug) :content (~sx-doc :path (str "/bootstrappers/" slug) (if bootstrapper-not-found (~spec-not-found :slug slug) (case slug "self-hosting" (~bootstrapper-self-hosting-content :py-sx-source py-sx-source :g0-output g0-output :g1-output g1-output :defines-matched defines-matched :defines-total defines-total :g0-lines g0-lines :g0-bytes g0-bytes :verification-status verification-status) "self-hosting-js" (~bootstrapper-self-hosting-js-content :js-sx-source js-sx-source :defines-matched defines-matched :defines-total defines-total :js-sx-lines js-sx-lines :verification-status verification-status) "python" (~bootstrapper-py-content :bootstrapper-source bootstrapper-source :bootstrapped-output bootstrapped-output) :else (~bootstrapper-js-content :bootstrapper-source bootstrapper-source :bootstrapped-output bootstrapped-output))))) ;; --------------------------------------------------------------------------- ;; Isomorphism section ;; --------------------------------------------------------------------------- (defpage isomorphism-index :path "/isomorphism/" :auth :public :layout :sx-docs :content (~sx-doc :path "/isomorphism/" (~plan-isomorphic-content))) (defpage bundle-analyzer :path "/isomorphism/bundle-analyzer" :auth :public :layout :sx-docs :data (bundle-analyzer-data) :content (~sx-doc :path "/isomorphism/bundle-analyzer" (~bundle-analyzer-content :pages pages :total-components total-components :total-macros total-macros :pure-count pure-count :io-count io-count))) (defpage routing-analyzer :path "/isomorphism/routing-analyzer" :auth :public :layout :sx-docs :data (routing-analyzer-data) :content (~sx-doc :path "/isomorphism/routing-analyzer" (~routing-analyzer-content :pages pages :total-pages total-pages :client-count client-count :server-count server-count :registry-sample registry-sample))) (defpage data-test :path "/isomorphism/data-test" :auth :public :layout :sx-docs :data (data-test-data) :content (~sx-doc :path "/isomorphism/data-test" (~data-test-content :server-time server-time :items items :phase phase :transport transport))) (defpage async-io-demo :path "/isomorphism/async-io" :auth :public :layout :sx-docs :content (~sx-doc :path "/isomorphism/async-io" (~async-io-demo-content))) (defpage streaming-demo :path "/isomorphism/streaming" :auth :public :stream true :layout :sx-docs :shell (~sx-doc :path "/isomorphism/streaming" (~streaming-demo-layout (~suspense :id "stream-fast" :fallback (~stream-skeleton)) (~suspense :id "stream-medium" :fallback (~stream-skeleton)) (~suspense :id "stream-slow" :fallback (~stream-skeleton)))) :data (streaming-demo-data) :content (~streaming-demo-chunk :stream-label stream-label :stream-color stream-color :stream-message stream-message :stream-time stream-time)) (defpage affinity-demo :path "/isomorphism/affinity" :auth :public :layout :sx-docs :data (affinity-demo-data) :content (~sx-doc :path "/isomorphism/affinity" (~affinity-demo-content :components components :page-plans page-plans))) (defpage optimistic-demo :path "/isomorphism/optimistic" :auth :public :layout :sx-docs :data (optimistic-demo-data) :content (~sx-doc :path "/isomorphism/optimistic" (~optimistic-demo-content :items items :server-time server-time))) (defpage offline-demo :path "/isomorphism/offline" :auth :public :layout :sx-docs :data (offline-demo-data) :content (~sx-doc :path "/isomorphism/offline" (~offline-demo-content :notes notes :server-time server-time))) ;; Wildcard must come AFTER specific routes (first-match routing) (defpage isomorphism-page :path "/isomorphism/" :auth :public :layout :sx-docs :content (~sx-doc :path (str "/isomorphism/" slug) (case slug "bundle-analyzer" (~bundle-analyzer-content :pages pages :total-components total-components :total-macros total-macros :pure-count pure-count :io-count io-count) "routing-analyzer" (~routing-analyzer-content :pages pages :total-pages total-pages :client-count client-count :server-count server-count :registry-sample registry-sample) :else (~plan-isomorphic-content)))) ;; --------------------------------------------------------------------------- ;; Plans section ;; --------------------------------------------------------------------------- (defpage plans-index :path "/plans/" :auth :public :layout :sx-docs :content (~sx-doc :path "/plans/" (~plans-index-content))) (defpage plan-page :path "/plans/" :auth :public :layout :sx-docs :data (case slug "theorem-prover" (prove-data) :else nil) :content (~sx-doc :path (str "/plans/" slug) (case slug "status" (~plan-status-content) "reader-macros" (~plan-reader-macros-content) "reader-macro-demo" (~plan-reader-macro-demo-content) "theorem-prover" (~plan-theorem-prover-content) "self-hosting-bootstrapper" (~plan-self-hosting-bootstrapper-content) "js-bootstrapper" (~plan-js-bootstrapper-content) "sx-activity" (~plan-sx-activity-content) "predictive-prefetch" (~plan-predictive-prefetch-content) "content-addressed-components" (~plan-content-addressed-components-content) "environment-images" (~plan-environment-images-content) "runtime-slicing" (~plan-runtime-slicing-content) "typed-sx" (~plan-typed-sx-content) "nav-redesign" (~plan-nav-redesign-content) "fragment-protocol" (~plan-fragment-protocol-content) "glue-decoupling" (~plan-glue-decoupling-content) "social-sharing" (~plan-social-sharing-content) "sx-ci" (~plan-sx-ci-content) "live-streaming" (~plan-live-streaming-content) "sx-web-platform" (~plan-sx-web-platform-content) "sx-forge" (~plan-sx-forge-content) "sx-swarm" (~plan-sx-swarm-content) "sx-proxy" (~plan-sx-proxy-content) "async-eval-convergence" (~plan-async-eval-convergence-content) "wasm-bytecode-vm" (~plan-wasm-bytecode-vm-content) "generative-sx" (~plan-generative-sx-content) "art-dag-sx" (~plan-art-dag-sx-content) :else (~plans-index-content)))) ;; --------------------------------------------------------------------------- ;; Reactive Islands section ;; --------------------------------------------------------------------------- (defpage reactive-islands-index :path "/reactive/" :auth :public :layout :sx-docs :content (~sx-doc :path "/reactive/" (~reactive-islands-index-content))) (defpage reactive-islands-page :path "/reactive/" :auth :public :layout :sx-docs :content (~sx-doc :path (str "/reactive/" slug) (case slug "demo" (~reactive-islands-demo-content) "event-bridge" (~reactive-islands-event-bridge-content) "named-stores" (~reactive-islands-named-stores-content) "plan" (~reactive-islands-plan-content) "marshes" (~reactive-islands-marshes-content) "phase2" (~reactive-islands-phase2-content) :else (~reactive-islands-index-content)))) ;; --------------------------------------------------------------------------- ;; Bootstrapped page helpers demo ;; --------------------------------------------------------------------------- (defpage page-helpers-demo :path "/bootstrappers/page-helpers" :auth :public :layout :sx-docs :data (page-helpers-demo-data) :content (~sx-doc :path "/bootstrappers/page-helpers" (~page-helpers-demo-content :sf-categories sf-categories :sf-total sf-total :sf-ms sf-ms :ref-sample ref-sample :ref-ms ref-ms :attr-result attr-result :attr-ms attr-ms :comp-source comp-source :comp-ms comp-ms :routing-result routing-result :routing-ms routing-ms :server-total-ms server-total-ms :sf-source sf-source :attr-detail attr-detail :req-attrs req-attrs :attr-keys attr-keys))) ;; --------------------------------------------------------------------------- ;; Testing section ;; --------------------------------------------------------------------------- (defpage testing-index :path "/testing/" :auth :public :layout :sx-docs :data (run-modular-tests "all") :content (~sx-doc :path "/testing/" (~testing-overview-content :server-results server-results :framework-source framework-source :eval-source eval-source :parser-source parser-source :router-source router-source :render-source render-source :deps-source deps-source :engine-source engine-source))) (defpage testing-page :path "/testing/" :auth :public :layout :sx-docs :data (case slug "eval" (run-modular-tests "eval") "parser" (run-modular-tests "parser") "router" (run-modular-tests "router") "render" (run-modular-tests "render") "deps" (run-modular-tests "deps") "engine" (run-modular-tests "engine") "orchestration" (run-modular-tests "orchestration") :else (dict)) :content (~sx-doc :path (str "/testing/" slug) (case slug "eval" (~testing-spec-content :spec-name "eval" :spec-title "Evaluator Tests" :spec-desc "81 tests covering the core evaluator and all primitives — literals, arithmetic, comparison, strings, lists, dicts, predicates, special forms, lambdas, higher-order functions, components, macros, threading, and edge cases." :spec-source spec-source :framework-source framework-source :server-results server-results) "parser" (~testing-spec-content :spec-name "parser" :spec-title "Parser Tests" :spec-desc "39 tests covering tokenization and parsing — integers, floats, strings, escape sequences, booleans, nil, keywords, symbols, lists, dicts, whitespace, comments, quote sugar, serialization, and round-trips." :spec-source spec-source :framework-source framework-source :server-results server-results) "router" (~testing-spec-content :spec-name "router" :spec-title "Router Tests" :spec-desc "18 tests covering client-side route matching — path splitting, pattern parsing, segment matching, parameter extraction, and route table search." :spec-source spec-source :framework-source framework-source :server-results server-results) "render" (~testing-spec-content :spec-name "render" :spec-title "Renderer Tests" :spec-desc "23 tests covering HTML rendering — elements, attributes, void elements, boolean attributes, fragments, escaping, control flow, and component rendering." :spec-source spec-source :framework-source framework-source :server-results server-results) "deps" (~testing-spec-content :spec-name "deps" :spec-title "Dependency Analysis Tests" :spec-desc "33 tests covering component dependency analysis — scan-refs, scan-components-from-source, transitive-deps, components-needed, scan-io-refs, and component-pure? classification." :spec-source spec-source :framework-source framework-source :server-results server-results) "engine" (~testing-spec-content :spec-name "engine" :spec-title "Engine Tests" :spec-desc "37 tests covering engine pure functions — parse-time, parse-trigger-spec, default-trigger, parse-swap-spec, parse-retry-spec, next-retry-ms, and filter-params." :spec-source spec-source :framework-source framework-source :server-results server-results) "orchestration" (~testing-spec-content :spec-name "orchestration" :spec-title "Orchestration Tests" :spec-desc "17 tests covering Phase 7c+7d orchestration — page data cache, optimistic cache update/revert/confirm, offline connectivity, offline queue mutation, and offline-aware routing." :spec-source spec-source :framework-source framework-source :server-results server-results) "runners" (~testing-runners-content) :else (~testing-overview-content :server-results server-results))))