Remove old CSSX system — ~tw is the sole CSS engine

Phase 1 Step 1 of the architecture roadmap. The old cssx.sx
(cssx-resolve, cssx-process-token, cssx-template, old tw function)
is superseded by the ~tw component system in tw.sx.

- Delete shared/sx/templates/cssx.sx
- Remove cssx.sx from all load lists (sx_server.ml, run_tests.ml,
  mcp_tree.ml, compile-modules.js, bundle.sh, sx-build-all.sh)
- Replace (tw "tokens") inline style calls with (~tw :tokens "tokens")
  in layouts.sx and not-found.sx
- Remove _css-hash / init-css-tracking / SX-Css header plumbing
  (dead code — ~tw/flush + flush-collected-styles handle CSS now)
- Remove sx-css-classes param and meta tag from shell template
- Update stale data-cssx references to data-sx-css in tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-02 16:18:07 +00:00
parent 670295bf01
commit a64b693a09
17 changed files with 33 additions and 379 deletions

View File

@@ -87,8 +87,7 @@
:sx-select "#sx-content"
:sx-swap "innerHTML"
:sx-push-url "true"
(~tw :tokens "text-right min-w-0 truncate")
:style (tw "text-stone-500 text-sm")
(~tw :tokens "text-right min-w-0 truncate text-stone-500 text-sm")
(str "← " (get prev-node "label")))
(a
:href (get node "href")
@@ -97,11 +96,13 @@
:sx-select "#sx-content"
:sx-swap "innerHTML"
:sx-push-url "true"
(~tw :tokens "text-center min-w-0 truncate px-1")
:style (if
is-leaf
(tw "text-violet-700 text-2xl font-bold")
(tw "text-violet-700 text-lg font-semibold"))
(~tw
:tokens (str
"text-center min-w-0 truncate px-1 "
(if
is-leaf
"text-violet-700 text-2xl font-bold"
"text-violet-700 text-lg font-semibold")))
(get node "label"))
(a
:href (get next-node "href")
@@ -110,8 +111,7 @@
:sx-select "#sx-content"
:sx-swap "innerHTML"
:sx-push-url "true"
(~tw :tokens "text-left min-w-0 truncate")
:style (tw "text-stone-500 text-sm")
(~tw :tokens "text-left min-w-0 truncate text-stone-500 text-sm")
(str (get next-node "label") " →")))))))
(defcomp
@@ -132,8 +132,8 @@
:sx-select "#sx-content"
:sx-swap "innerHTML"
:sx-push-url "true"
(~tw :tokens "px-3 py-1.5 rounded border transition-colors")
:style (tw "text-violet-700 text-sm border-violet-200")
(~tw
:tokens "px-3 py-1.5 rounded border transition-colors text-violet-700 text-sm border-violet-200")
(get item "label")))
items))))

View File

@@ -3,11 +3,11 @@
(&key (path :as string?))
(div
(~tw :tokens "max-w-3xl mx-auto px-4 py-12 text-center")
(h1 :style (tw "text-stone-800 text-3xl font-bold") "404")
(p (~tw :tokens "mt-4") :style (tw "text-stone-500 text-lg") "Page not found")
(h1 (~tw :tokens "text-stone-800 text-3xl font-bold") "404")
(p (~tw :tokens "mt-4 text-stone-500 text-lg") "Page not found")
(when
path
(p (~tw :tokens "mt-2") :style (tw "text-stone-400 text-sm font-mono") path))
(p (~tw :tokens "mt-2 text-stone-400 text-sm font-mono") path))
(a
:href "/sx/"
:sx-get "/sx/"
@@ -15,6 +15,6 @@
:sx-select "#sx-content"
:sx-swap "outerHTML"
:sx-push-url "true"
(~tw :tokens "inline-block mt-6 px-4 py-2 rounded border transition-colors")
:style (tw "text-violet-700 text-sm border-violet-200")
(~tw
:tokens "inline-block mt-6 px-4 py-2 rounded border transition-colors text-violet-700 text-sm border-violet-200")
"Back to home")))

View File

@@ -20,9 +20,9 @@
(log-info (str "cssx flush: running, rules:" (len (collected "cssx"))))
(let ((rules (collected "cssx")))
(when (not (empty? rules))
(let ((style (or (dom-query "[data-cssx]")
(let ((style (or (dom-query "[data-sx-css]")
(let ((s (dom-create-element "style" nil)))
(dom-set-attr s "data-cssx" "")
(dom-set-attr s "data-sx-css" "")
(dom-append-to-head s)
s))))
(dom-set-prop style "textContent"