Hyperscript: hide/show strategy (opacity/visibility), add/remove query-all
Parser: hide/show handle `with opacity/visibility/display` strategy and properly detect target vs command boundaries. Compiler: emit correct CSS property per strategy, add-class/remove-class use for-each+query-all for class selectors. Runtime: hs-query-all uses dom-body, hs-each helper for collection iteration. Generator: inline run().toEqual() pattern for eval-only tests. 372/831 (45%) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -751,10 +751,21 @@
|
||||
(list (quote hs-last) (hs-to-sx (nth ast 2)) (nth ast 1))
|
||||
(list (quote hs-query-last) (nth ast 1))))
|
||||
((= head (quote add-class))
|
||||
(list
|
||||
(quote dom-add-class)
|
||||
(hs-to-sx (nth ast 2))
|
||||
(nth ast 1)))
|
||||
(let
|
||||
((raw-tgt (nth ast 2)))
|
||||
(if
|
||||
(and (list? raw-tgt) (= (first raw-tgt) (quote query)))
|
||||
(list
|
||||
(quote for-each)
|
||||
(list
|
||||
(quote fn)
|
||||
(list (quote _el))
|
||||
(list (quote dom-add-class) (quote _el) (nth ast 1)))
|
||||
(list (quote hs-query-all) (nth raw-tgt 1)))
|
||||
(list
|
||||
(quote dom-add-class)
|
||||
(hs-to-sx raw-tgt)
|
||||
(nth ast 1)))))
|
||||
((= head (quote multi-add-class))
|
||||
(let
|
||||
((target (hs-to-sx (nth ast 1)))
|
||||
@@ -774,10 +785,24 @@
|
||||
(fn (cls) (list (quote dom-remove-class) target cls))
|
||||
classes))))
|
||||
((= head (quote remove-class))
|
||||
(list
|
||||
(quote dom-remove-class)
|
||||
(hs-to-sx (nth ast 2))
|
||||
(nth ast 1)))
|
||||
(let
|
||||
((raw-tgt (nth ast 2)))
|
||||
(if
|
||||
(and (list? raw-tgt) (= (first raw-tgt) (quote query)))
|
||||
(list
|
||||
(quote for-each)
|
||||
(list
|
||||
(quote fn)
|
||||
(list (quote _el))
|
||||
(list
|
||||
(quote dom-remove-class)
|
||||
(quote _el)
|
||||
(nth ast 1)))
|
||||
(list (quote hs-query-all) (nth raw-tgt 1)))
|
||||
(list
|
||||
(quote dom-remove-class)
|
||||
(hs-to-sx raw-tgt)
|
||||
(nth ast 1)))))
|
||||
((= head (quote toggle-class))
|
||||
(list
|
||||
(quote hs-toggle-class!)
|
||||
|
||||
Reference in New Issue
Block a user