sx-http: header island working, stepper partial, CSSX source included

Include cssx.sx source in component-defs for client CSSX runtime.
Island placeholders now contain SX call expression for client hydration.
escape_sx_string only escapes </script, not all </ sequences.
serialize_value: no (list) wrapper, matching Python serialize() exactly.

Homepage: header renders (<sx>, tagline, copyright), stepper shows
raw SX (cssx/tw not expanding client-side). Geography fully rendered
including island hydration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-28 19:23:44 +00:00
parent 31ae9b5110
commit dc5da2f5ed
2 changed files with 46 additions and 27 deletions

View File

@@ -258,8 +258,12 @@ and render_list_to_html head args env =
| Component c when c.c_affinity = "client" -> "" (* skip client-only *)
| Component _ -> render_component v args env
| Island _i ->
(* Islands are client-rendered — emit placeholder for hydration *)
Printf.sprintf "<span data-sx-island=\"%s\"></span>" _i.i_name
let call_sx = "(" ^ String.concat " " (List.map (fun v ->
match v with
| Symbol s -> s | Keyword k -> ":" ^ k | String s -> "\"" ^ s ^ "\""
| _ -> Sx_runtime.value_to_str v
) (Symbol name :: args)) ^ ")" in
Printf.sprintf "<span data-sx-island=\"%s\">%s</span>" _i.i_name call_sx
| Macro m ->
let expanded = expand_macro m args env in
do_render_to_html expanded env
@@ -501,10 +505,15 @@ and render_list_buf buf head args env =
| Component c when c.c_affinity = "client" -> ()
| Component _ -> render_component_buf buf v args env
| Island _i ->
(* Islands are client-rendered — emit placeholder for hydration.
SSR of island bodies is unreliable (client-only symbols like
signals, DOM refs) and can cascade errors. *)
Buffer.add_string buf (Printf.sprintf "<span data-sx-island=\"%s\"></span>" _i.i_name)
(* Islands are client-rendered — emit placeholder with SX call
expression so the client can hydrate from source. *)
let call_sx = "(" ^ String.concat " " (List.map (fun v ->
match v with
| Symbol s -> s | Keyword k -> ":" ^ k | String s -> "\"" ^ s ^ "\""
| _ -> Sx_runtime.value_to_str v
) (Symbol name :: args)) ^ ")" in
Buffer.add_string buf (Printf.sprintf "<span data-sx-island=\"%s\">%s</span>"
_i.i_name call_sx)
| Macro m ->
let expanded = expand_macro m args env in
render_to_buf buf expanded env