Hyperscript conformance: 372→373 — hide/show strategy, generator toEqual

Parser: hide/show handle `with opacity/visibility/display` strategy,
target detection for then-less chaining (add/remove/set/put as boundary).
Generator: inline run().toEqual([...]) pattern for eval-only tests.
Compiler: hide/show emit correct CSS property per strategy.

373/831 (45%)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-12 11:42:28 +00:00
parent 3dbbe7e1d1
commit 854ed9c027
24 changed files with 1665 additions and 469 deletions

View File

@@ -847,17 +847,25 @@
(nth ast 1)
nil))
((= head (quote hide))
(list
(quote dom-set-style)
(hs-to-sx (nth ast 1))
"display"
"none"))
(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" "0"))
((= strategy "visibility")
(list (quote dom-set-style) tgt "visibility" "hidden"))
(true (list (quote dom-set-style) tgt "display" "none")))))
((= head (quote show))
(list
(quote dom-set-style)
(hs-to-sx (nth ast 1))
"display"
""))
(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" "")))))
((= head (quote transition)) (emit-transition ast))
((= head (quote repeat)) (emit-repeat ast))
((= head (quote fetch))

View File

@@ -951,15 +951,19 @@
(fn
()
(let
((tgt (if (at-end?) (list (quote me)) (if (or (= (tp-type) "id") (= (tp-type) "selector")) (parse-expr) (list (quote me))))))
(list (quote hide) tgt))))
((tgt (cond ((at-end?) (list (quote me))) ((and (= (tp-type) "keyword") (or (= (tp-val) "then") (= (tp-val) "end") (= (tp-val) "with") (= (tp-val) "add") (= (tp-val) "remove") (= (tp-val) "set") (= (tp-val) "put") (= (tp-val) "toggle") (= (tp-val) "hide") (= (tp-val) "show"))) (list (quote me))) (true (parse-expr)))))
(let
((strategy (if (match-kw "with") (if (at-end?) "display" (let ((s (tp-val))) (adv!) s)) "display")))
(list (quote hide) tgt strategy)))))
(define
parse-show-cmd
(fn
()
(let
((tgt (if (at-end?) (list (quote me)) (if (or (= (tp-type) "id") (= (tp-type) "selector")) (parse-expr) (list (quote me))))))
(list (quote show) tgt))))
((tgt (cond ((at-end?) (list (quote me))) ((and (= (tp-type) "keyword") (or (= (tp-val) "then") (= (tp-val) "end") (= (tp-val) "with") (= (tp-val) "add") (= (tp-val) "remove") (= (tp-val) "set") (= (tp-val) "put") (= (tp-val) "toggle") (= (tp-val) "hide") (= (tp-val) "show"))) (list (quote me))) (true (parse-expr)))))
(let
((strategy (if (match-kw "with") (if (at-end?) "display" (let ((s (tp-val))) (adv!) s)) "display")))
(list (quote show) tgt strategy)))))
(define
parse-transition-cmd
(fn