Move spec metadata from Python to SX, add orchestration to spec viewer
Spec file registry (slugs, filenames, titles, descriptions) now lives in nav-data.sx as SX data definitions. Python helper reduced to pure file I/O (read-spec-file). Architecture page updated with engine/orchestration split and dependency graph. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -78,7 +78,32 @@
|
||||
(dict :label "DOM Adapter" :href "/specs/adapter-dom")
|
||||
(dict :label "HTML Adapter" :href "/specs/adapter-html")
|
||||
(dict :label "SX Wire Adapter" :href "/specs/adapter-sx")
|
||||
(dict :label "SxEngine" :href "/specs/engine")))
|
||||
(dict :label "SxEngine" :href "/specs/engine")
|
||||
(dict :label "Orchestration" :href "/specs/orchestration")))
|
||||
|
||||
;; Spec file registry — canonical metadata for spec viewer pages.
|
||||
;; Python only handles file I/O (read-spec-file); all metadata lives here.
|
||||
|
||||
(define core-spec-items (list
|
||||
(dict :slug "parser" :filename "parser.sx" :title "Parser" :desc "Tokenization and parsing of SX source text into AST.")
|
||||
(dict :slug "evaluator" :filename "eval.sx" :title "Evaluator" :desc "Tree-walking evaluation of SX expressions.")
|
||||
(dict :slug "primitives" :filename "primitives.sx" :title "Primitives" :desc "All built-in pure functions and their signatures.")
|
||||
(dict :slug "renderer" :filename "render.sx" :title "Renderer" :desc "Shared rendering registries and utilities used by all adapters.")))
|
||||
|
||||
(define adapter-spec-items (list
|
||||
(dict :slug "adapter-dom" :filename "adapter-dom.sx" :title "DOM Adapter" :desc "Renders SX expressions to live DOM nodes. Browser-only.")
|
||||
(dict :slug "adapter-html" :filename "adapter-html.sx" :title "HTML Adapter" :desc "Renders SX expressions to HTML strings. Server-side.")
|
||||
(dict :slug "adapter-sx" :filename "adapter-sx.sx" :title "SX Wire Adapter" :desc "Serializes SX for client-side rendering. Component calls stay unexpanded.")
|
||||
(dict :slug "engine" :filename "engine.sx" :title "SxEngine" :desc "Pure logic for fetch, swap, history, SSE, triggers, morph, and indicators.")
|
||||
(dict :slug "orchestration" :filename "orchestration.sx" :title "Orchestration" :desc "Browser wiring that binds engine logic to DOM events, fetch, and lifecycle.")))
|
||||
|
||||
(define all-spec-items (concat core-spec-items adapter-spec-items))
|
||||
|
||||
(define find-spec
|
||||
(fn (slug)
|
||||
(some (fn (item)
|
||||
(when (= (get item "slug") slug) item))
|
||||
all-spec-items)))
|
||||
|
||||
;; Find the current nav label for a slug by matching href suffix.
|
||||
;; Returns the label string or nil if no match.
|
||||
|
||||
@@ -96,7 +96,11 @@
|
||||
(p :class "text-stone-600"
|
||||
"The engine is the browser-side fetch/swap/history system. It processes "
|
||||
(code :class "text-violet-700 text-sm" "sx-*")
|
||||
" attributes on elements to make HTTP requests, swap content, manage browser history, and handle events. It depends on the core evaluator and the DOM adapter.")
|
||||
" attributes on elements to make HTTP requests, swap content, manage browser history, and handle events. It is split into two files: pure logic ("
|
||||
(code :class "text-violet-700 text-sm" "engine.sx")
|
||||
") and browser wiring ("
|
||||
(code :class "text-violet-700 text-sm" "orchestration.sx")
|
||||
").")
|
||||
(div :class "overflow-x-auto rounded border border-stone-200"
|
||||
(table :class "w-full text-left text-sm"
|
||||
(thead (tr :class "border-b border-stone-200 bg-stone-100"
|
||||
@@ -109,7 +113,14 @@
|
||||
:sx-get "/specs/engine" :sx-target "#main-panel" :sx-select "#main-panel"
|
||||
:sx-swap "outerHTML" :sx-push-url "true"
|
||||
"engine.sx"))
|
||||
(td :class "px-3 py-2 text-stone-700" "SxEngine — fetch, swap, history, SSE, triggers, indicators"))))))
|
||||
(td :class "px-3 py-2 text-stone-700" "Pure logic — trigger parsing, swap algorithms, morph, history, SSE, indicators"))
|
||||
(tr :class "border-b border-stone-100"
|
||||
(td :class "px-3 py-2 font-mono text-sm text-violet-700"
|
||||
(a :href "/specs/orchestration" :class "hover:underline"
|
||||
:sx-get "/specs/orchestration" :sx-target "#main-panel" :sx-select "#main-panel"
|
||||
:sx-swap "outerHTML" :sx-push-url "true"
|
||||
"orchestration.sx"))
|
||||
(td :class "px-3 py-2 text-stone-700" "Browser wiring — binds engine to DOM events, fetch, request lifecycle"))))))
|
||||
|
||||
(div :class "space-y-3"
|
||||
(h2 :class "text-2xl font-semibold text-stone-800" "Dependency graph")
|
||||
@@ -124,7 +135,8 @@ adapter-dom.sx depends on: render, eval
|
||||
adapter-html.sx depends on: render, eval
|
||||
adapter-sx.sx depends on: render, eval
|
||||
|
||||
engine.sx depends on: eval, adapter-dom")))
|
||||
engine.sx depends on: eval, adapter-dom
|
||||
orchestration.sx depends on: engine, adapter-dom")))
|
||||
|
||||
(div :class "space-y-3"
|
||||
(h2 :class "text-2xl font-semibold text-stone-800" "Self-hosting")
|
||||
@@ -143,14 +155,14 @@ engine.sx depends on: eval, adapter-dom")))
|
||||
;; Overview pages (Core / Adapters) — show truncated previews of each file
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
||||
(defcomp ~spec-overview-content (&key spec-files)
|
||||
(defcomp ~spec-overview-content (&key spec-title spec-files)
|
||||
(~doc-page :title (or spec-title "Specs")
|
||||
(p :class "text-stone-600 mb-6"
|
||||
(case spec-title
|
||||
"Core Language"
|
||||
"The core specification defines the language itself — parsing, evaluation, primitives, and shared rendering definitions. These four files are platform-independent and sufficient to implement SX on any target."
|
||||
"Adapters & Engine"
|
||||
"Adapters connect the core language to specific environments. Each adapter takes evaluated expression trees and produces output for its target. The engine adds browser-side fetch/swap behaviour."
|
||||
"Adapters connect the core language to specific environments. Each adapter takes evaluated expression trees and produces output for its target. The engine adds browser-side fetch/swap behaviour, split into pure logic and browser orchestration."
|
||||
:else ""))
|
||||
(div :class "space-y-8"
|
||||
(map (fn (spec)
|
||||
|
||||
Reference in New Issue
Block a user