Fix stepper: restore source as string, clean def-store application

Previous sed edits corrupted the file. Restored from 5c8b05a and
applied only the def-store change cleanly via python (no sed/sx-tools).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 23:36:01 +00:00
parent 5c30dcd82c
commit e8d6aa1198

View File

@@ -3,14 +3,8 @@
()
(let
((source "(div (~cssx/tw :tokens \"text-center\")\n (h1 (~cssx/tw :tokens \"text-3xl font-bold mb-2\")\n (span (~cssx/tw :tokens \"text-rose-500\") \"the \")\n (span (~cssx/tw :tokens \"text-amber-500\") \"joy \")\n (span (~cssx/tw :tokens \"text-emerald-500\") \"of \")\n (span (~cssx/tw :tokens \"text-violet-600 text-4xl\") \"sx\")))")
(h1 (~cssx/tw :tokens "text-3xl font-bold mb-2")
(span (~cssx/tw :tokens "text-rose-500") "the ")
(span (~cssx/tw :tokens "text-amber-500") "joy ")
(span (~cssx/tw :tokens "text-emerald-500") "of ")
(span (~cssx/tw :tokens "text-violet-600 text-4xl") "sx")))")
(store
(if (client?) (def-store "home-stepper" (fn () {:step-idx (signal 9)})) nil))
(steps (signal (list)))
(store (if (client?) (def-store "home-stepper" (fn () {:step-idx (signal 9)})) nil))
(step-idx (if store (get store "step-idx") (signal 9)))
(dom-stack-sig (signal (list)))
(code-tokens (signal (list))))
@@ -271,7 +265,17 @@
((target (- (deref step-idx) 1)))
(rebuild-preview target)
(reset! step-idx target)
(update-code-highlight))))))
(update-code-highlight)
)))))
(let
((saved (get-cookie "sx-home-stepper")))
(when
saved
(thaw-from-sx saved)
(when
(or (< (deref step-idx) 0) (> (deref step-idx) 16))
(reset! step-idx 9))))
(let
((parsed (sx-parse source)))
(when
@@ -317,7 +321,10 @@
(div
:class "flex items-center justify-center gap-2 md:gap-3"
(button
:on-click (fn (e) (do-back))
:on-click (fn
(e)
(do-back)
)
:class (str
"px-2 py-1 rounded text-3xl "
(if
@@ -331,7 +338,10 @@
" / "
(len (deref steps)))
(button
:on-click (fn (e) (do-step))
:on-click (fn
(e)
(do-step)
)
:class (str
"px-2 py-1 rounded text-3xl "
(if