Right now we are using with-style to compose styles, but I believe the interface can be improved. For one, it should be able to accept any arity of styles. @jeroenvandijk wrote a merge-styles function but I'm not if we need two separate functions.
Another thing is that with-style returns a curried function, whereas with-attributes returns a map directly. I'm not sure we need to return a function unless the returned function could be called again as if it were with-style.
Anyway, here is the general specification I would like for with-style:
text
;; All cases should evaluate to the the following vanilla cljs
[:div {:style {:display "flex"}}]
;; map
[:div (with-style {:display "flex"})]
;; nested map
[:div (with-style {:style {:display "flex"}})]
;; using functions
(def +flex (with-style {:display "flex"}))
[:div (+flex)]
[:div (with-style +flex)]
[:div (with-style (+flex))]
;; Now let's try composing
(def +justify-center (with-style {:justify-content "center"}))
(def +align-center (with-style {:align-center "center"}))
(def +flex-center (with-style +flex +justify-center +align-center))
[:div (with-style +flex +justify-center +align-center)]
[:div (with-style (+flex) (+justify-center) (+align-center))]
[:div (+flex-center)]
;; Mix and Match
;; 1 - function
;; 2 - called function
;; 3 - map
;; 4 - nested map
[:div (with-style +flex (+align-center) {:justify-content "center"} {:style {:text-align "center"}})]
;; Output
[:div {:style {:display "flex" :align-items "center" :justify-content "center" :text-align "center"}}]