Phase 0: Add _ctx_to_env() and render_to_sx_with_env() to shared/sx/helpers.py, register_sx_layout() to shared/sx/layouts.py, and ~root-header/~root-mobile wrapper defcomps to layout.sx. Convert built-in "root" layout to .sx. Phases 1-3: Convert account (65→19 lines), federation (105→97 lines), and orders (88→21 lines) to use register_sx_layout with .sx defcomps that read ctx values as free variables from the evaluation environment. No more Python building SX strings via SxExpr(await root_header_sx(ctx)). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
18 lines
661 B
Plaintext
18 lines
661 B
Plaintext
;; Federation layout defcomps — read ctx values from env free variables.
|
|
;; `actor` is injected into env by the layout registration in __init__.py.
|
|
|
|
;; Full page: root header + social header in header-child
|
|
(defcomp ~social-layout-full ()
|
|
(<> (~root-header)
|
|
(~header-child-sx
|
|
:inner (~federation-social-header
|
|
:nav (~federation-social-nav :actor actor)))))
|
|
|
|
;; OOB (HTMX): social header oob + root header oob
|
|
(defcomp ~social-layout-oob ()
|
|
(<> (~oob-header-sx
|
|
:parent-id "root-header-child"
|
|
:row (~federation-social-header
|
|
:nav (~federation-social-nav :actor actor)))
|
|
(~root-header :oob true)))
|