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

@@ -1,7 +1,5 @@
(define _preload-cache (dict))
(define _css-hash "")
(define
dispatch-trigger-events
:effects (mutation io)
@@ -26,19 +24,6 @@
(dom-dispatch el trimmed (dict)))))
(split header-val ",")))))))
(define
init-css-tracking
:effects (mutation io)
(fn
()
(let
((meta (dom-query "meta[name=\"sx-css-classes\"]")))
(when
meta
(let
((content (dom-get-attr meta "content")))
(when content (set! _css-hash content)))))))
(define
execute-request
:effects (mutation io)
@@ -115,8 +100,7 @@
(final-url (get body-info "url"))
(body (get body-info "body"))
(ct (get body-info "content-type"))
(headers
(build-request-headers el (loaded-component-names) _css-hash))
(headers (build-request-headers el (loaded-component-names)))
(csrf (csrf-token)))
(when
extraParams
@@ -214,9 +198,6 @@
(text :as string))
(let
((resp-headers (process-response-headers get-header)))
(let
((new-hash (get resp-headers "css-hash")))
(when new-hash (set! _css-hash new-hash)))
(dispatch-trigger-events el (get resp-headers "trigger"))
(process-cache-directives el resp-headers text)
(cond
@@ -1146,8 +1127,7 @@
pathname
(build-request-headers
target
(loaded-component-names)
_css-hash))
(loaded-component-names)))
true)
(if
(get match "has-data")
@@ -1183,8 +1163,7 @@
pathname
(build-request-headers
target
(loaded-component-names)
_css-hash)
(loaded-component-names))
0))
(swap-rendered-content
target
@@ -1242,8 +1221,7 @@
pathname
(build-request-headers
target
(loaded-component-names)
_css-hash)
(loaded-component-names))
0))
(swap-rendered-content
target
@@ -1264,8 +1242,7 @@
pathname
(build-request-headers
target
(loaded-component-names)
_css-hash)
(loaded-component-names))
0))
(swap-rendered-content
target
@@ -1295,8 +1272,7 @@
pathname
(build-request-headers
target
(loaded-component-names)
_css-hash)
(loaded-component-names))
0))
(swap-rendered-content
target
@@ -1473,10 +1449,7 @@
info
(do-preload
(get info "url")
(build-request-headers
el
(loaded-component-names)
_css-hash)))))))))))
(build-request-headers el (loaded-component-names))))))))))))
(define
do-preload
@@ -1597,8 +1570,4 @@
:effects (mutation io)
(fn
()
(do
(init-css-tracking)
(sx-process-scripts nil)
(sx-hydrate nil)
(process-elements nil))))
(do (sx-process-scripts nil) (sx-hydrate nil) (process-elements nil))))