HS: open/close commands for dialog/details — 428→435

- Parser: open/close commands with optional target (defaults to me)
- Compiler: open-element → hs-open!, close-element → hs-close!
- Runtime: hs-open! calls showModal() for dialogs, sets open=true for details
- Runtime: hs-close! calls close() for dialogs, sets open=false for details
- dialog: 1/10 → 8/10

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-13 11:10:17 +00:00
parent 49afef6eef
commit fb93aaaa8c
4 changed files with 50 additions and 2 deletions

View File

@@ -475,8 +475,30 @@
((= tag "FORM") (dom-set-inner-html target ""))
(true (dom-set-inner-html target ""))))))))
;; Collection: split by
(define hs-first (fn (lst) (first lst)))
(define
hs-open!
(fn
(el)
(let
((tag (dom-get-prop el "tagName")))
(if
(= tag "DIALOG")
(host-call el "showModal")
(dom-set-prop el "open" true)))))
;; Collection: joined by
(define
hs-close!
(fn
(el)
(let
((tag (dom-get-prop el "tagName")))
(if
(= tag "DIALOG")
(host-call el "close")
(dom-set-prop el "open" false)))))
(define hs-first (fn (lst) (first lst)))
(define hs-last (fn (lst) (last lst)))
(define