HS fixes: multi-property transition, take attr with-val, empty form, css-value parsing
- Parser: multi-property transition (width from 0px to 100px height from...) with collect-transitions loop. CSS value parsing uses parse-atom + manual number+unit concat to avoid greedy string-postfix chaining. - Compiler: take! passes attr-val and with-val (restored from revert) - Runtime: hs-empty-target! handles FORM by iterating child inputs, hs-starts-with-ic/hs-ends-with-ic for case-insensitive comparison Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1186,25 +1186,48 @@
|
||||
()
|
||||
(let
|
||||
((tgt (cond ((and (= (tp-type) "ident") (= (tp-val) "element")) (do (adv!) (parse-atom))) ((= (tp-type) "id") (parse-atom)) ((= (tp-type) "class") (parse-atom)) ((= (tp-type) "selector") (parse-atom)) (true nil))))
|
||||
(let
|
||||
((prop (cond ((= (tp-type) "style") (get (adv!) "value")) ((= (tp-val) "my") (do (adv!) (if (= (tp-type) "style") (get (adv!) "value") (get (adv!) "value")))) (true (get (adv!) "value")))))
|
||||
(let
|
||||
((from-val (if (match-kw "from") (parse-expr) nil)))
|
||||
(expect-kw! "to")
|
||||
(define
|
||||
parse-one-transition
|
||||
(fn
|
||||
()
|
||||
(let
|
||||
((value (parse-expr)))
|
||||
((prop (cond ((= (tp-type) "style") (get (adv!) "value")) ((= (tp-val) "my") (do (adv!) (if (= (tp-type) "style") (get (adv!) "value") (get (adv!) "value")))) (true (get (adv!) "value")))))
|
||||
(let
|
||||
((dur (if (match-kw "over") (parse-expr) nil)))
|
||||
(if
|
||||
from-val
|
||||
(list
|
||||
(quote transition-from)
|
||||
prop
|
||||
from-val
|
||||
value
|
||||
dur
|
||||
tgt)
|
||||
(list (quote transition) prop value dur tgt)))))))))
|
||||
((from-val (if (match-kw "from") (let ((v (parse-atom))) (if (and (number? v) (= (tp-type) "ident") (not (hs-keyword? (tp-val)))) (let ((unit (get (adv!) "value"))) (list (quote string-postfix) v unit)) v)) nil)))
|
||||
(expect-kw! "to")
|
||||
(let
|
||||
((value (let ((v (parse-atom))) (if (and (number? v) (= (tp-type) "ident") (not (hs-keyword? (tp-val)))) (let ((unit (get (adv!) "value"))) (list (quote string-postfix) v unit)) v))))
|
||||
(let
|
||||
((dur (if (match-kw "over") (let ((v (parse-atom))) (if (and (number? v) (= (tp-type) "ident") (not (hs-keyword? (tp-val)))) (let ((unit (get (adv!) "value"))) (list (quote string-postfix) v unit)) v)) nil)))
|
||||
(let
|
||||
((using-val (if (match-kw "using") (parse-expr) nil)))
|
||||
(if
|
||||
from-val
|
||||
(list
|
||||
(quote transition-from)
|
||||
prop
|
||||
from-val
|
||||
value
|
||||
dur
|
||||
tgt)
|
||||
(list (quote transition) prop value dur tgt)))))))))
|
||||
(let
|
||||
((first-t (parse-one-transition)))
|
||||
(define
|
||||
collect-transitions
|
||||
(fn
|
||||
(acc)
|
||||
(if
|
||||
(and
|
||||
(not (at-end?))
|
||||
(= (tp-type) "ident")
|
||||
(not (hs-keyword? (tp-val))))
|
||||
(collect-transitions
|
||||
(append acc (list (parse-one-transition))))
|
||||
acc)))
|
||||
(let
|
||||
((all (collect-transitions (list first-t))))
|
||||
(if (= (len all) 1) (first all) (cons (quote do) all)))))))
|
||||
(define
|
||||
parse-repeat-cmd
|
||||
(fn
|
||||
|
||||
Reference in New Issue
Block a user