Replace env free-variable threading with IO-primitive auto-fetch macros
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m38s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m38s
Layout components now self-resolve context (cart-mini, auth-menu, nav-tree, rights, URLs) via new IO primitives (root-header-ctx, select-colours, account-nav-ctx, app-rights) and defmacro wrappers (~root-header-auto, ~auth-header-row-auto, ~root-mobile-auto). This eliminates _ctx_to_env(), HELPER_CSS_CLASSES, and verbose :key threading across all 10 services. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -419,60 +419,46 @@ async def _reference_attrs_sx() -> str:
|
||||
)
|
||||
|
||||
|
||||
def _reference_headers_sx() -> str:
|
||||
async def _reference_headers_sx() -> str:
|
||||
from content.pages import REQUEST_HEADERS, RESPONSE_HEADERS
|
||||
req_table = await _headers_table_sx("Request Headers", REQUEST_HEADERS)
|
||||
resp_table = await _headers_table_sx("Response Headers", RESPONSE_HEADERS)
|
||||
return (
|
||||
f'(~doc-page :title "Headers"'
|
||||
f' (p :class "text-stone-600 mb-6"'
|
||||
f' "sx uses custom HTTP headers to coordinate between client and server.")'
|
||||
f' (div :class "space-y-8"'
|
||||
f' {_headers_table_sx("Request Headers", REQUEST_HEADERS)}'
|
||||
f' {_headers_table_sx("Response Headers", RESPONSE_HEADERS)}))'
|
||||
f' {req_table}'
|
||||
f' {resp_table}))'
|
||||
)
|
||||
|
||||
|
||||
def _reference_events_sx() -> str:
|
||||
async def _reference_events_sx() -> str:
|
||||
from shared.sx.helpers import render_to_sx
|
||||
from shared.sx.parser import SxExpr
|
||||
from content.pages import EVENTS
|
||||
rows = []
|
||||
for name, desc in EVENTS:
|
||||
rows.append(
|
||||
f'(tr :class "border-b border-stone-100"'
|
||||
f' (td :class "px-3 py-2 font-mono text-sm text-violet-700 whitespace-nowrap" "{name}")'
|
||||
f' (td :class "px-3 py-2 text-stone-700 text-sm" "{desc}"))'
|
||||
)
|
||||
return (
|
||||
f'(~doc-page :title "Events"'
|
||||
f' (p :class "text-stone-600 mb-6"'
|
||||
f' "sx fires custom DOM events at various points in the request lifecycle.")'
|
||||
f' (div :class "overflow-x-auto rounded border border-stone-200"'
|
||||
f' (table :class "w-full text-left text-sm"'
|
||||
f' (thead (tr :class "border-b border-stone-200 bg-stone-50"'
|
||||
f' (th :class "px-3 py-2 font-medium text-stone-600" "Event")'
|
||||
f' (th :class "px-3 py-2 font-medium text-stone-600" "Description")))'
|
||||
f' (tbody {" ".join(rows)}))))'
|
||||
)
|
||||
rows.append(await render_to_sx("doc-two-col-row", name=name, description=desc))
|
||||
rows_sx = "(<> " + " ".join(rows) + ")"
|
||||
table = await render_to_sx("doc-two-col-table",
|
||||
intro="sx fires custom DOM events at various points in the request lifecycle.",
|
||||
col1="Event", col2="Description", rows=SxExpr(rows_sx))
|
||||
return f'(~doc-page :title "Events" {table})'
|
||||
|
||||
|
||||
def _reference_js_api_sx() -> str:
|
||||
async def _reference_js_api_sx() -> str:
|
||||
from shared.sx.helpers import render_to_sx
|
||||
from shared.sx.parser import SxExpr
|
||||
from content.pages import JS_API
|
||||
rows = []
|
||||
for name, desc in JS_API:
|
||||
rows.append(
|
||||
f'(tr :class "border-b border-stone-100"'
|
||||
f' (td :class "px-3 py-2 font-mono text-sm text-violet-700 whitespace-nowrap" "{name}")'
|
||||
f' (td :class "px-3 py-2 text-stone-700 text-sm" "{desc}"))'
|
||||
)
|
||||
return (
|
||||
f'(~doc-page :title "JavaScript API"'
|
||||
f' (p :class "text-stone-600 mb-6"'
|
||||
f' "The client-side sx.js library exposes a public API for programmatic use.")'
|
||||
f' (div :class "overflow-x-auto rounded border border-stone-200"'
|
||||
f' (table :class "w-full text-left text-sm"'
|
||||
f' (thead (tr :class "border-b border-stone-200 bg-stone-50"'
|
||||
f' (th :class "px-3 py-2 font-medium text-stone-600" "Method")'
|
||||
f' (th :class "px-3 py-2 font-medium text-stone-600" "Description")))'
|
||||
f' (tbody {" ".join(rows)}))))'
|
||||
)
|
||||
rows.append(await render_to_sx("doc-two-col-row", name=name, description=desc))
|
||||
rows_sx = "(<> " + " ".join(rows) + ")"
|
||||
table = await render_to_sx("doc-two-col-table",
|
||||
intro="The client-side sx.js library exposes a public API for programmatic use.",
|
||||
col1="Method", col2="Description", rows=SxExpr(rows_sx))
|
||||
return f'(~doc-page :title "JavaScript API" {table})'
|
||||
|
||||
|
||||
def _protocol_wire_format_sx() -> str:
|
||||
|
||||
Reference in New Issue
Block a user