diff --git a/shared/sx/templates/cssx.sx b/shared/sx/templates/cssx.sx index 11c5714..8080a9f 100644 --- a/shared/sx/templates/cssx.sx +++ b/shared/sx/templates/cssx.sx @@ -1,68 +1,22 @@ ;; @client — send all define forms to browser for client-side use. ;; CSSX — computed CSS from s-expressions. ;; -;; Generic mechanism: cssx is a macro that groups CSS property declarations. -;; The vocabulary (property mappings, value functions) is pluggable — the -;; Tailwind-inspired defaults below are just one possible style system. +;; Tailwind-style utility component. Write styling as utility tokens: ;; -;; Usage: -;; (cssx (:text (colour "violet" 699) (size "4xl") (weight "bold") (family "mono")) -;; (:bg (colour "stone" 50))) +;; (~cssx/tw "bg-yellow-199 text-violet-700 p-4 font-bold" +;; (div "content")) ;; -;; Each group is (:keyword value ...modifiers): -;; - keyword maps to a CSS property via cssx-properties dict -;; - value is the CSS value for that property -;; - modifiers are extra CSS declaration strings, concatenated in +;; (~cssx/tw "hover:bg-rose-500 md:text-xl" +;; (button "click me")) ;; -;; Single group: -;; (cssx (:text (colour "violet" 699))) -;; -;; Modifiers without a colour: -;; (cssx (:text nil (size "4xl") (weight "bold"))) -;; -;; Unknown keywords pass through as raw CSS property names: -;; (cssx (:outline (colour "red" 500))) → "outline:hsl(0,72%,53%);" -;; -;; Standalone modifiers work outside cssx too: -;; :style (size "4xl") -;; :style (str (weight "bold") (family "mono")) +;; Each token becomes a deterministic class + JIT