From 75f1c0455964270a5de6e59bdccd45d173d29135 Mon Sep 17 00:00:00 2001 From: giles Date: Mon, 13 Apr 2026 11:19:08 +0000 Subject: [PATCH] =?UTF-8?q?HS:=20show=20command=20handles=20dialogs/detail?= =?UTF-8?q?s=20=E2=80=94=20dialog=2010/10=20complete,=20435=E2=86=92437?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - show compiler: emit hs-show! runtime call instead of direct dom-set-style - hs-show! runtime: dialog → showModal(), details → open=true, else display/opacity/visibility - dialog category fully passing (was 1/10) Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/hyperscript/compiler.sx | 7 +------ lib/hyperscript/runtime.sx | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/hyperscript/compiler.sx b/lib/hyperscript/compiler.sx index 62cc8074..15abbccc 100644 --- a/lib/hyperscript/compiler.sx +++ b/lib/hyperscript/compiler.sx @@ -936,12 +936,7 @@ (let ((tgt (hs-to-sx (nth ast 1))) (strategy (if (> (len ast) 2) (nth ast 2) "display"))) - (cond - ((= strategy "opacity") - (list (quote dom-set-style) tgt "opacity" "1")) - ((= strategy "visibility") - (list (quote dom-set-style) tgt "visibility" "visible")) - (true (list (quote dom-set-style) tgt "display" ""))))) + (list (quote hs-show!) tgt strategy))) ((= head (quote transition)) (emit-transition ast)) ((= head (quote transition-from)) (let diff --git a/lib/hyperscript/runtime.sx b/lib/hyperscript/runtime.sx index 06d40be3..25450134 100644 --- a/lib/hyperscript/runtime.sx +++ b/lib/hyperscript/runtime.sx @@ -497,6 +497,20 @@ (host-call el "close") (dom-set-prop el "open" false))))) +(define + hs-show! + (fn + (el strategy) + (let + ((tag (dom-get-prop el "tagName"))) + (cond + ((= tag "DIALOG") + (when (not (dom-has-attr? el "open")) (host-call el "showModal"))) + ((= tag "DETAILS") (dom-set-prop el "open" true)) + ((= strategy "opacity") (dom-set-style el "opacity" "1")) + ((= strategy "visibility") (dom-set-style el "visibility" "visible")) + (true (dom-set-style el "display" "")))))) + (define hs-first (fn (lst) (first lst))) (define hs-last (fn (lst) (last lst)))