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:
@@ -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 {"))
|
||||
|
||||
Reference in New Issue
Block a user