clay 0.13.0 → 0.13.1
raw patch · 10 files changed
+58/−40 lines, 10 filesdep +hspec-discoverdep +semigroupsdep −hspec-expectationsdep ~basedep ~hspecPVP ok
version bump matches the API change (PVP)
Dependencies added: hspec-discover, semigroups
Dependencies removed: hspec-expectations
Dependency ranges changed: base, hspec
API changes (from Hackage documentation)
+ Clay.Display: sticky :: Position
+ Clay.Property: instance Data.Semigroup.Semigroup (Clay.Property.Key a)
+ Clay.Property: instance Data.Semigroup.Semigroup Clay.Property.Literal
+ Clay.Property: instance Data.Semigroup.Semigroup Clay.Property.Prefixed
+ Clay.Property: instance Data.Semigroup.Semigroup Clay.Property.Value
+ Clay.Selector: instance Data.Semigroup.Semigroup Clay.Selector.Refinement
+ Clay.Stylesheet: instance Data.Semigroup.Semigroup Clay.Stylesheet.Css
Files
- clay.cabal +18/−8
- src/Clay/Color.hs +1/−1
- src/Clay/Comments.hs +4/−0
- src/Clay/Display.hs +7/−6
- src/Clay/List.hs +1/−1
- src/Clay/Mask.hs +1/−1
- src/Clay/Property.hs +9/−6
- src/Clay/Selector.hs +5/−13
- src/Clay/Stylesheet.hs +8/−3
- src/Clay/Transition.hs +4/−1
clay.cabal view
@@ -1,5 +1,5 @@ Name: clay-Version: 0.13.0+Version: 0.13.1 Synopsis: CSS preprocessor as embedded Haskell. Description: Clay is a CSS preprocessor like LESS and Sass, but implemented as an embedded@@ -24,9 +24,10 @@ Build-Type: Simple Tested-With:- GHC==7.8.4, GHC==7.10.3,- GHC==8.0.1+ GHC==8.0.2,+ GHC==8.2.2,+ GHC==8.4.1 Source-Repository head Type: git@@ -70,19 +71,28 @@ GHC-Options: -Wall Build-Depends:- base >= 4.5 && < 5,+ base >= 4.7 && < 5, mtl >= 1 && < 2.3, text >= 0.11 && < 1.3+ if impl(ghc < 8.0)+ Build-Depends:+ semigroups+ else+ GHC-Options: -Wcompat Test-Suite Test-Clay Type: exitcode-stdio-1.0 HS-Source-Dirs: spec, src main-is: Spec.hs Build-Depends:- base >= 4.5 && < 5,- base >= 4 && < 5,+ base >= 4.7 && < 5, mtl >= 1 && < 2.3, text >= 0.11 && < 1.3,- hspec-expectations >= 0.7.2 && < 0.9,- hspec >= 2.2.0 && < 2.5+ hspec >= 2.2.0 && < 2.6,+ hspec-discover >= 2.2.0 && < 2.6+ if impl(ghc < 8.0)+ Build-Depends:+ semigroups+ else+ GHC-Options: -Wcompat Ghc-Options: -Wall
src/Clay/Color.hs view
@@ -4,9 +4,9 @@ import Data.Char (isHexDigit) import Data.Monoid import Data.String-import Data.Text (Text) import Text.Printf +import Data.Text (Text) import qualified Data.Text as Text import Data.Text.Read as Text
src/Clay/Comments.hs view
@@ -1,8 +1,10 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE OverloadedStrings #-} module Clay.Comments where +import Data.Foldable (foldMap) import Data.Monoid ((<>)) import Data.Maybe (isNothing) import Data.List (partition)@@ -26,5 +28,7 @@ addComment c (Property ms k v ) = Property (Comment c : ms) k v addComment _ r = r +#if __GLASGOW_HASKELL__ >= 710 pattern PartitionComments :: [Modifier] -> Maybe CommentText -> [Modifier]+#endif pattern PartitionComments xs cs <- (fmap (foldMap _Comment) . partition (isNothing . _Comment) -> (xs, cs))
src/Clay/Display.hs view
@@ -17,7 +17,7 @@ , Position , position-, static, absolute, fixed, relative+, static, absolute, fixed, relative, sticky -- * Display @@ -82,7 +82,7 @@ import Clay.Property import Clay.Stylesheet import Clay.Common-import Data.Text (Text) +import Data.Text (Text) ------------------------------------------------------------------------------- @@ -116,12 +116,13 @@ newtype Position = Position Value deriving (Val, Other, Inherit) -static, absolute, fixed, relative :: Position+static, absolute, fixed, relative, sticky :: Position static = Position "static" absolute = Position "absolute" fixed = Position "fixed" relative = Position "relative"+sticky = Position "sticky" position :: Position -> Css position = key "position"@@ -239,7 +240,7 @@ instance VerticalAlign VerticalAlignValue instance VerticalAlign (Size a) -middle,vAlignSub,vAlignSuper,textTop,textBottom,vAlignTop,vAlignBottom,vAlignBaseline :: VerticalAlignValue +middle,vAlignSub,vAlignSuper,textTop,textBottom,vAlignTop,vAlignBottom,vAlignBaseline :: VerticalAlignValue middle = VerticalAlignValue "middle" vAlignSub = VerticalAlignValue "sub"@@ -250,7 +251,7 @@ vAlignTop = VerticalAlignValue "top" vAlignBottom = VerticalAlignValue "bottom" -------------------------------------------------------------------------------- +------------------------------------------------------------------------------- class (Val a) => Cursor a where cursor :: a -> Css@@ -261,7 +262,7 @@ instance Cursor (CursorValue a) crosshair,cursorDefault,pointer,move,eResize,neResize,nwResize,nResize,seResize,swResize,sResize,wResize,cursorText,wait,cursorProgress,help :: CursorValue Value- + crosshair = CursorValue "crosshair" cursorDefault = CursorValue "default" pointer = CursorValue "pointer"
src/Clay/List.hs view
@@ -36,7 +36,7 @@ ) where -import Data.Monoid+import Data.Semigroup import Data.Text (Text) import Clay.Common
src/Clay/Mask.hs view
@@ -57,7 +57,7 @@ ) where -import Data.Monoid+import Data.Semigroup import Clay.Background import Clay.Common
src/Clay/Property.hs view
@@ -2,11 +2,11 @@ module Clay.Property where import Control.Arrow (second)-import Control.Monad.Writer import Data.Fixed (Fixed, HasResolution (resolution), showFixed) import Data.List (partition, sort) import Data.List.NonEmpty (NonEmpty, toList) import Data.Maybe+import Data.Semigroup import Data.String import Data.Text (Text, replace) @@ -16,9 +16,12 @@ instance IsString Prefixed where fromString s = Plain (fromString s) +instance Semigroup Prefixed where+ (<>) = merge+ instance Monoid Prefixed where mempty = ""- mappend = merge+ mappend = (<>) merge :: Prefixed -> Prefixed -> Prefixed merge (Plain x ) (Plain y ) = Plain (x <> y)@@ -41,7 +44,7 @@ ------------------------------------------------------------------------------- newtype Key a = Key { unKeys :: Prefixed }- deriving (Show, Monoid, IsString)+ deriving (Show, Semigroup, Monoid, IsString) cast :: Key a -> Key () cast (Key k) = Key k@@ -49,7 +52,7 @@ ------------------------------------------------------------------------------- newtype Value = Value { unValue :: Prefixed }- deriving (Show, Monoid, IsString, Eq)+ deriving (Show, Semigroup, Monoid, IsString, Eq) class Val a where value :: a -> Value@@ -58,7 +61,7 @@ value t = Value (Plain t) newtype Literal = Literal Text- deriving (Show, Monoid, IsString)+ deriving (Show, Semigroup, Monoid, IsString) instance Val Literal where value (Literal t) = Value (Plain (quote t))@@ -100,7 +103,7 @@ intercalate :: Monoid a => a -> [a] -> a intercalate _ [] = mempty-intercalate s (x:xs) = foldl (\a b -> a <> s <> b) x xs+intercalate s (x:xs) = foldl (\a b -> a `mappend` s `mappend` b) x xs -------------------------------------------------------------------------------
src/Clay/Selector.hs view
@@ -11,15 +11,10 @@ module Clay.Selector where import Control.Applicative-import Data.Monoid+import Data.Semigroup import Data.String import Data.Text (Text)-import Prelude hiding (foldl) -#if MIN_VERSION_base(4,9,0)-import Data.Semigroup-#endif- import qualified Data.Text as Text -- | The star selector applies to all elements. Maps to @*@ in CSS.@@ -157,7 +152,7 @@ deriving (Eq, Ord, Show) newtype Refinement = Refinement { unFilter :: [Predicate] }- deriving (Show, Monoid)+ deriving (Show, Semigroup, Monoid) instance IsString Refinement where fromString = refinementFromText . fromString@@ -204,12 +199,9 @@ -> with star (refinementFromText t) _ -> In $ SelectorF (Refinement []) (Elem t) -#if MIN_VERSION_base(4,9,0) instance Semigroup (Fix SelectorF) where- (<>) = mappend-#endif+ a <> b = In (SelectorF (Refinement []) (Combined a b)) instance Monoid (Fix SelectorF) where- mempty = error "Selector is a semigroup"- mappend a b = In (SelectorF (Refinement []) (Combined a b))-+ mempty = error "Selector is a semigroup"+ mappend = (<>)
src/Clay/Stylesheet.hs view
@@ -6,9 +6,11 @@ import Control.Applicative import Control.Arrow (second)-import Control.Monad.Writer hiding (All)+import Control.Monad.Writer (Writer, execWriter, tell)+import Data.Foldable (foldMap) import Data.Maybe (isJust)-import Data.Semigroup (Semigroup)+import Data.Monoid (Monoid(..))+import Data.Semigroup (Semigroup(..)) import Data.String (IsString) import Data.Text (Text) @@ -83,9 +85,12 @@ type Css = StyleM () +instance Semigroup Css where+ (<>) = liftA2 (<>)+ instance Monoid Css where mempty = pure ()- mappend = liftA2 mappend+ mappend = (<>) -- | Add a new style property to the stylesheet with the specified `Key` and -- value. The value can be any type that is in the `Val' typeclass, with other
src/Clay/Transition.hs view
@@ -83,7 +83,10 @@ easeInOut = other "ease-in-out" linear = other "linear" stepStart = other "step-start"-stepStop = other "step-stop"+stepEnd = other "step-end"++stepStop = stepEnd+{-# DEPRECATED stepStop "Use `stepEnd` instead." #-} stepsStart, stepsStop :: Integer -> TimingFunction