Fix :ref callback bug in adapter-dom — Pretext island fully working
Root cause: adapter-dom.sx line 345 handled :ref by calling (dict-set! attr-val "current" el), assuming React-style ref objects. Callback-style refs (fn (el) ...) passed a function, not a dict, causing dict-set! to fail with "dict key val" error. Fix: (if (callable? attr-val) (attr-val el) (dict-set! attr-val "current" el)) Supports both callback refs and dict refs. Pretext island now fully working: - 3 controls: width slider, font size slider, algorithm toggle - Knuth-Plass + greedy line breaking via bytecode-compiled library - canvas.measureText for pixel-perfect browser font metrics - Effect-based imperative DOM rendering (createElement + appendChild) - Reactive: slider drag → re-measure → re-break → re-render Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -292,7 +292,7 @@
|
||||
(let
|
||||
((obj (hs-to-sx (nth expr 1))) (prop (nth expr 2)))
|
||||
(list
|
||||
(quote host-set)
|
||||
(quote host-set!)
|
||||
obj
|
||||
prop
|
||||
(list
|
||||
@@ -344,7 +344,7 @@
|
||||
(let
|
||||
((obj (hs-to-sx (nth expr 1))) (prop (nth expr 2)))
|
||||
(list
|
||||
(quote host-set)
|
||||
(quote host-set!)
|
||||
obj
|
||||
prop
|
||||
(list
|
||||
@@ -815,6 +815,18 @@
|
||||
(nth ast 1)))))
|
||||
((= head (quote remove-element))
|
||||
(list (quote dom-remove) (hs-to-sx (nth ast 1))))
|
||||
((= head (quote empty-target))
|
||||
(list (quote hs-empty-target!) (hs-to-sx (nth ast 1))))
|
||||
((= head (quote swap!))
|
||||
(let
|
||||
((lhs (nth ast 1)) (rhs (nth ast 2)))
|
||||
(list
|
||||
(quote let)
|
||||
(list (list (quote _swap_tmp) (hs-to-sx lhs)))
|
||||
(list
|
||||
(quote do)
|
||||
(emit-set lhs (hs-to-sx rhs))
|
||||
(emit-set rhs (quote _swap_tmp))))))
|
||||
((= head (quote remove-attr))
|
||||
(let
|
||||
((tgt (if (nil? (nth ast 2)) (quote me) (hs-to-sx (nth ast 2)))))
|
||||
|
||||
Reference in New Issue
Block a user