feat: add algorithmic size and font scales

Add :scales config to tokens.edn with two generated scales:
- Size (linear): --size-1 through --size-16, base 0.25rem × N
- Font (geometric): --font-xs through --font-3xl, ratio 1.25

gen.clj computes values and emits them into :root only (not dark
theme blocks). button.css now uses scale vars instead of raw rem.
Change base or ratio in tokens.edn to recompute the entire scale.
This commit is contained in:
Florian Schroedl
2026-03-03 11:16:23 +01:00
parent 988617617c
commit 609613f4fb
5 changed files with 114 additions and 13 deletions

View File

@@ -40,6 +40,21 @@
(testing "dark media query excludes explicit light theme"
(is (str/includes? css ":root:not([data-theme=\"light\"])")))
(testing "contains size scale variables"
(doseq [n (range 1 17)]
(is (str/includes? css (str "--size-" n ":"))
(str "Missing size-" n))))
(testing "contains font scale variables"
(doseq [label ["xs" "sm" "base" "md" "lg" "xl" "2xl" "3xl"]]
(is (str/includes? css (str "--font-" label ":"))
(str "Missing font-" label))))
(testing "scales only in :root, not in dark theme blocks"
(let [dark-block (second (str/split css #"\[data-theme=\"dark\"\]"))]
(is (not (str/includes? dark-block "--size-1:")))
(is (not (str/includes? dark-block "--font-base:")))))
(testing "contains button component CSS"
(is (str/includes? css ".btn {"))
(is (str/includes? css ".btn-primary {"))