Fix source display: add sxc mount, HTML tag forms, Playwright debug tools
- Add missing ./sx/sxc:/app/sxc:ro volume mount to dev-sx compose — container was using stale image copy of docs.sx where ~docs/code had (&key code) instead of (&key src), so highlight output was silently discarded - Register HTML tags as special forms in WASM browser kernel so keyword attrs are preserved during render-to-dom - Add trace-boot, hydrate-debug, eval-at modes to sx-inspect.js for debugging boot phases and island hydration Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -684,6 +684,34 @@ let () =
|
||||
ignore (env_bind global_env "VOID_ELEMENTS" void_elements);
|
||||
ignore (env_bind global_env "BOOLEAN_ATTRS" boolean_attrs);
|
||||
|
||||
(* --- HTML tag special forms (div, span, h1, ...) --- *)
|
||||
(* Registered as custom special forms so keywords are preserved.
|
||||
Handler receives (raw-args env), evaluates non-keyword args
|
||||
while keeping keyword names intact. *)
|
||||
let eval_tag_args raw_args env =
|
||||
let args = Sx_runtime.sx_to_list raw_args in
|
||||
let rec process = function
|
||||
| [] -> []
|
||||
| (Keyword _ as kw) :: value :: rest ->
|
||||
(* keyword + its value: keep keyword, evaluate value *)
|
||||
kw :: Sx_ref.eval_expr value env :: process rest
|
||||
| (Keyword _ as kw) :: [] ->
|
||||
(* trailing keyword with no value — boolean attr *)
|
||||
[kw]
|
||||
| expr :: rest ->
|
||||
(* non-keyword: evaluate *)
|
||||
Sx_ref.eval_expr expr env :: process rest
|
||||
in
|
||||
process args
|
||||
in
|
||||
List.iter (fun tag ->
|
||||
ignore (Sx_ref.register_special_form (String tag)
|
||||
(NativeFn ("sf:" ^ tag, fun handler_args ->
|
||||
match handler_args with
|
||||
| [raw_args; env] -> List (Symbol tag :: eval_tag_args raw_args env)
|
||||
| _ -> Nil)))
|
||||
) Sx_render.html_tags;
|
||||
|
||||
(* --- Error handling --- *)
|
||||
bind "cek-try" (fun args ->
|
||||
match args with
|
||||
|
||||
Reference in New Issue
Block a user