HS: collectionExpressions +4 (then on click, undefined where, component template)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 11m0s

- parser: nil return in parse-cmd for feature keywords (on/init/def/behavior/live)
  so "then on click" correctly hands off to outer coll-feats loop
- compiler: cek-try wrap for undefined variable refs in coll-where compilation
  so "doesNotExist where it > 1" returns nil instead of throwing
- integration: hs-activate! detects script[type=text/hyperscript-template] and
  applies handler to DOM instances via hs-query-all(component attr) not to script el

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-04 13:31:29 +00:00
parent 51bc075da5
commit 73e86fa8e8
6 changed files with 333 additions and 279 deletions

View File

@@ -1107,13 +1107,21 @@
(hs-to-sx (nth ast 1))
(nth ast 2)))
((= head (quote coll-where))
(list
(quote filter)
(let
((raw-coll (hs-to-sx (nth ast 1))))
(list
(quote fn)
(list (quote it))
(hs-to-sx (nth ast 2)))
(hs-to-sx (nth ast 1))))
(quote filter)
(list
(quote fn)
(list (quote it))
(hs-to-sx (nth ast 2)))
(if
(symbol? raw-coll)
(list
(quote cek-try)
(list (quote fn) (list) raw-coll)
(list (quote fn) (list (quote _e)) nil))
raw-coll))))
((= head (quote coll-sorted))
(list
(quote hs-sorted-by)

View File

@@ -115,7 +115,15 @@
(dom-set-data el "hs-script" src)
(dom-set-data el "hs-active" true)
(dom-set-attr el "data-hyperscript-powered" "true")
(let ((handler (hs-handler src))) (handler el))
(let
((handler (hs-handler src)))
(let
((el-type (dom-get-attr el "type"))
(comp-name (dom-get-attr el "component")))
(if
(= el-type "text/hyperscript-template")
(for-each handler (hs-query-all (or comp-name "")))
(handler el))))
(dom-dispatch el "hyperscript:after:init" nil)))))))
;; ── Boot subtree: for dynamic content ───────────────────────────

View File

@@ -2783,6 +2783,8 @@
((body (parse-cmd-list)))
(match-kw "end")
(list (quote view-transition!) using body)))))
((and (= typ "keyword") (or (= val "on") (= val "init") (= val "def") (= val "behavior") (= val "live")))
nil)
(true (parse-expr))))))
(define
parse-cmd-list