-
Notifications
You must be signed in to change notification settings - Fork 10
/
utils.cljc
26 lines (24 loc) · 1.05 KB
/
utils.cljc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(ns stylefy.impl.utils
(:require [garden.core :refer [css]]
[garden.color :as color]
[garden.types :as types]
[garden.stylesheet :refer [at-media at-keyframes at-font-face]]
[clojure.string :as str])
(:import #?@(:clj
[(garden.types CSSFunction)
(garden.types CSSUnit)
(garden.color CSSColor)])))
(defn remove-special-keywords
"Removes stylefy's namespaced keywords from the given map."
[props]
(apply dissoc props (filter #(and (namespace %)
(str/starts-with? (namespace %) "stylefy"))
(keys props))))
(defn is-garden-value? [value]
; Note: types/CSSAtRule is not included since it is a selector, not a valid CSS value.
#?(:cljs (or (instance? types/CSSUnit value)
(instance? color/CSSColor value)
(instance? types/CSSFunction value))
:clj (or (instance? CSSUnit value)
(instance? CSSColor value)
(instance? CSSFunction value))))