Remove render_to_sx from public API: enforce sx_call for all service code
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m44s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m44s
Replace ~250 render_to_sx calls across all services with sync sx_call, converting many async functions to sync where no other awaits remained. Make render_to_sx/render_to_sx_with_env private (_render_to_sx). Add (post-header-ctx) IO primitive and shared post/post-admin defmacros. Convert built-in post/post-admin layouts from Python to register_sx_layout with .sx defcomps. Remove dead post_admin_mobile_nav_sx. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -222,8 +222,8 @@ def _docs_evaluator_sx() -> str:
|
||||
)
|
||||
|
||||
|
||||
async def _docs_primitives_sx() -> str:
|
||||
prims = await _primitives_section_sx()
|
||||
def _docs_primitives_sx() -> str:
|
||||
prims = _primitives_section_sx()
|
||||
return (
|
||||
f'(~doc-page :title "Primitives"'
|
||||
f' (~doc-section :title "Built-in functions" :id "builtins"'
|
||||
@@ -402,11 +402,11 @@ def _reference_attr_detail_sx(slug: str) -> str:
|
||||
)
|
||||
|
||||
|
||||
async def _reference_attrs_sx() -> str:
|
||||
def _reference_attrs_sx() -> str:
|
||||
from content.pages import REQUEST_ATTRS, BEHAVIOR_ATTRS, SX_UNIQUE_ATTRS
|
||||
req = await _attr_table_sx("Request Attributes", REQUEST_ATTRS)
|
||||
beh = await _attr_table_sx("Behavior Attributes", BEHAVIOR_ATTRS)
|
||||
uniq = await _attr_table_sx("Unique to sx", SX_UNIQUE_ATTRS)
|
||||
req = _attr_table_sx("Request Attributes", REQUEST_ATTRS)
|
||||
beh = _attr_table_sx("Behavior Attributes", BEHAVIOR_ATTRS)
|
||||
uniq = _attr_table_sx("Unique to sx", SX_UNIQUE_ATTRS)
|
||||
return (
|
||||
f'(~doc-page :title "Attribute Reference"'
|
||||
f' (p :class "text-stone-600 mb-6"'
|
||||
@@ -419,10 +419,10 @@ async def _reference_attrs_sx() -> str:
|
||||
)
|
||||
|
||||
|
||||
async def _reference_headers_sx() -> str:
|
||||
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)
|
||||
req_table = _headers_table_sx("Request Headers", REQUEST_HEADERS)
|
||||
resp_table = _headers_table_sx("Response Headers", RESPONSE_HEADERS)
|
||||
return (
|
||||
f'(~doc-page :title "Headers"'
|
||||
f' (p :class "text-stone-600 mb-6"'
|
||||
@@ -433,29 +433,29 @@ async def _reference_headers_sx() -> str:
|
||||
)
|
||||
|
||||
|
||||
async def _reference_events_sx() -> str:
|
||||
from shared.sx.helpers import render_to_sx
|
||||
def _reference_events_sx() -> str:
|
||||
from shared.sx.helpers import sx_call
|
||||
from shared.sx.parser import SxExpr
|
||||
from content.pages import EVENTS
|
||||
rows = []
|
||||
for name, desc in EVENTS:
|
||||
rows.append(await render_to_sx("doc-two-col-row", name=name, description=desc))
|
||||
rows.append(sx_call("doc-two-col-row", name=name, description=desc))
|
||||
rows_sx = "(<> " + " ".join(rows) + ")"
|
||||
table = await render_to_sx("doc-two-col-table",
|
||||
table = sx_call("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})'
|
||||
|
||||
|
||||
async def _reference_js_api_sx() -> str:
|
||||
from shared.sx.helpers import render_to_sx
|
||||
def _reference_js_api_sx() -> str:
|
||||
from shared.sx.helpers import sx_call
|
||||
from shared.sx.parser import SxExpr
|
||||
from content.pages import JS_API
|
||||
rows = []
|
||||
for name, desc in JS_API:
|
||||
rows.append(await render_to_sx("doc-two-col-row", name=name, description=desc))
|
||||
rows.append(sx_call("doc-two-col-row", name=name, description=desc))
|
||||
rows_sx = "(<> " + " ".join(rows) + ")"
|
||||
table = await render_to_sx("doc-two-col-table",
|
||||
table = sx_call("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})'
|
||||
|
||||
Reference in New Issue
Block a user