HS: viewTransition command (+9 tests)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 18s

Add 'start view transition [using EXPR] [then] BODY end' syntax.
- tokenizer: add 'view' as a keyword
- parser: add 'start' to cmd-kw? and dispatch to view-transition! AST node
- compiler: emit hs-view-transition! call from view-transition! node

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-27 05:18:38 +00:00
parent 9256719fa8
commit 1723808517
6 changed files with 32 additions and 2 deletions

View File

@@ -1832,6 +1832,9 @@
(hs-to-sx (nth ast 2))))
((= head (quote set-el!))
(list (quote hs-set-element!) (hs-to-sx (nth ast 1)) (hs-to-sx (nth ast 2))))
((= head (quote view-transition!))
(let ((body (nth ast 2)))
(list (quote hs-view-transition!) (hs-to-sx (nth ast 1)) (if (nil? body) (quote nil) (hs-to-sx body)))))
((= head (quote put!))
(let
((val (hs-to-sx (nth ast 1)))

View File

@@ -2711,6 +2711,16 @@
(do (adv!) (list (quote exit))))
((and (= typ "keyword") (= val "js"))
(do (adv!) (parse-js-block)))
((and (= typ "keyword") (= val "start"))
(do
(adv!)
(expect-kw! "view")
(expect-kw! "transition")
(let ((using (if (match-kw "using") (parse-expr) nil)))
(match-kw "then")
(let ((body (parse-cmd-list)))
(match-kw "end")
(list (quote view-transition!) using body)))))
(true (parse-expr))))))
(define
parse-cmd-list
@@ -2767,7 +2777,8 @@
(= v "pick")
(= v "ask")
(= v "answer")
(= v "js"))))
(= v "js")
(= v "start"))))
(define
cl-collect
(fn

View File

@@ -131,6 +131,7 @@
"append"
"settle"
"transition"
"view"
"over"
"closest"
"next"

View File

@@ -1832,6 +1832,9 @@
(hs-to-sx (nth ast 2))))
((= head (quote set-el!))
(list (quote hs-set-element!) (hs-to-sx (nth ast 1)) (hs-to-sx (nth ast 2))))
((= head (quote view-transition!))
(let ((body (nth ast 2)))
(list (quote hs-view-transition!) (hs-to-sx (nth ast 1)) (if (nil? body) (quote nil) (hs-to-sx body)))))
((= head (quote put!))
(let
((val (hs-to-sx (nth ast 1)))

View File

@@ -2711,6 +2711,16 @@
(do (adv!) (list (quote exit))))
((and (= typ "keyword") (= val "js"))
(do (adv!) (parse-js-block)))
((and (= typ "keyword") (= val "start"))
(do
(adv!)
(expect-kw! "view")
(expect-kw! "transition")
(let ((using (if (match-kw "using") (parse-expr) nil)))
(match-kw "then")
(let ((body (parse-cmd-list)))
(match-kw "end")
(list (quote view-transition!) using body)))))
(true (parse-expr))))))
(define
parse-cmd-list
@@ -2767,7 +2777,8 @@
(= v "pick")
(= v "ask")
(= v "answer")
(= v "js"))))
(= v "js")
(= v "start"))))
(define
cl-collect
(fn

View File

@@ -131,6 +131,7 @@
"append"
"settle"
"transition"
"view"
"over"
"closest"
"next"