All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 5m26s
init-client.sx contains browser-only code (dom-listen, collect! cssx). It was in sx/sx/ which load_sx_dir scans and evaluates server-side, causing "Undefined symbol: dom-listen". Move to sx/init-client.sx which is outside the component load path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
25 lines
1.1 KiB
Plaintext
25 lines
1.1 KiB
Plaintext
;; ---------------------------------------------------------------------------
|
|
;; SX app boot — styles and behaviors injected on page load
|
|
;;
|
|
;; Replaces inline_css and init_sx from Python app config.
|
|
;; Called as a data-init script on every page.
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
;; Framework styles — request indicators + link jiggle
|
|
(collect! "cssx" ".sx-indicator{display:none}")
|
|
(collect! "cssx" ".sx-request .sx-indicator{display:inline-flex}")
|
|
(collect! "cssx" "@keyframes sxJiggle{0%,100%{transform:translateX(0)}25%{transform:translateX(-.5px)}75%{transform:translateX(.5px)}}")
|
|
(collect! "cssx" "a.sx-request{animation:sxJiggle .3s ease-in-out infinite}")
|
|
|
|
;; Nav link aria-selected update on client-side routing
|
|
(dom-listen (dom-body) "sx:clientRoute"
|
|
(fn (e)
|
|
(let ((p (get (event-detail e) "pathname")))
|
|
(when p
|
|
(for-each
|
|
(fn (a) (dom-set-attr a "aria-selected" "false"))
|
|
(dom-query-all "nav a[aria-selected]"))
|
|
(for-each
|
|
(fn (a) (dom-set-attr a "aria-selected" "true"))
|
|
(dom-query-all (str "nav a[href=\"" p "\"]")))))))
|