11module CSS.Property where
22
33import Prelude
4-
4+ import CSS.String (class IsString , fromString )
5+ import Color (Color , cssStringHSLA )
56import Data.Foldable (intercalate )
67import Data.Generic (class Generic )
78import Data.Maybe (fromMaybe )
@@ -10,10 +11,6 @@ import Data.NonEmpty (NonEmpty, oneOf)
1011import Data.Profunctor.Strong (second )
1112import Data.Tuple (Tuple (..), lookup )
1213
13- import Color (Color , cssStringHSLA )
14-
15- import CSS.String (class IsString , fromString )
16-
1714data Prefixed
1815 = Prefixed (Array (Tuple String String ))
1916 | Plain String
@@ -72,9 +69,6 @@ instance monoidValue :: Monoid Value where
7269class Val a where
7370 value :: a -> Value
7471
75- instance valString :: Val String where
76- value = fromString
77-
7872newtype Literal = Literal String
7973
8074derive instance eqLiteral :: Eq Literal
@@ -87,6 +81,14 @@ instance valLiteral :: Val Literal where
8781instance valValue :: Val Value where
8882 value = id
8983
84+ instance valString :: Val String where
85+ value = fromString
86+
87+ instance valUnit :: Val Unit where
88+ value u = fromString " "
89+
90+ -- When `b` is Unit, the rendered value will have an extra
91+ -- space appended to end. Shouldn't hurt. I'd fix if I knew how.
9092instance valTuple :: (Val a , Val b ) => Val (Tuple a b ) where
9193 value (Tuple a b) = value a <> fromString " " <> value b
9294
0 commit comments