Move sx docs page helpers from Python to pure SX composition (Phase 6)
Nav data, section nav, example content, reference table builders, and all slug dispatch now live in .sx files. Python helpers reduced to data-only returns (highlight, primitives-data, reference-data, attr-detail-data). Deleted essays.py and utils.py entirely. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -63,3 +63,49 @@
|
||||
(button :onclick "localStorage.removeItem('sx-components-hash');localStorage.removeItem('sx-components-src');var e=Sx.getEnv();Object.keys(e).forEach(function(k){if(k.charAt(0)==='~')delete e[k]});var b=this;b.textContent='Cleared!';setTimeout(function(){b.textContent='Clear component cache'},2000)"
|
||||
:class "text-xs text-stone-400 hover:text-stone-600 border border-stone-200 rounded px-2 py-1 transition-colors"
|
||||
"Clear component cache"))
|
||||
|
||||
;; ---------------------------------------------------------------------------
|
||||
;; Data-driven table builders — replace Python sx_call() composition
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
||||
;; Build attr table from a list of {name, desc, exists, href} dicts.
|
||||
;; Replaces _attr_table_sx() in utils.py.
|
||||
(defcomp ~doc-attr-table-from-data (&key title attrs)
|
||||
(~doc-attr-table :title title
|
||||
:rows (<> (map (fn (a)
|
||||
(~doc-attr-row
|
||||
:attr (get a "name")
|
||||
:description (get a "desc")
|
||||
:exists (get a "exists")
|
||||
:href (get a "href")))
|
||||
attrs))))
|
||||
|
||||
;; Build headers table from a list of {name, value, desc} dicts.
|
||||
;; Replaces _headers_table_sx() in utils.py.
|
||||
(defcomp ~doc-headers-table-from-data (&key title headers)
|
||||
(~doc-headers-table :title title
|
||||
:rows (<> (map (fn (h)
|
||||
(~doc-headers-row
|
||||
:name (get h "name")
|
||||
:value (get h "value")
|
||||
:description (get h "desc")))
|
||||
headers))))
|
||||
|
||||
;; Build two-col table from a list of {name, desc} dicts.
|
||||
;; Replaces the _reference_events_sx / _reference_js_api_sx builders.
|
||||
(defcomp ~doc-two-col-table-from-data (&key title intro col1 col2 items)
|
||||
(~doc-two-col-table :title title :intro intro :col1 col1 :col2 col2
|
||||
:rows (<> (map (fn (item)
|
||||
(~doc-two-col-row
|
||||
:name (get item "name")
|
||||
:description (get item "desc")))
|
||||
items))))
|
||||
|
||||
;; Build all primitives category tables from a {category: [prim, ...]} dict.
|
||||
;; Replaces _primitives_section_sx() in utils.py.
|
||||
(defcomp ~doc-primitives-tables (&key primitives)
|
||||
(<> (map (fn (cat)
|
||||
(~doc-primitives-table
|
||||
:category cat
|
||||
:primitives (get primitives cat)))
|
||||
(keys primitives))))
|
||||
|
||||
Reference in New Issue
Block a user