clay 0.10 → 0.10.1
raw patch · 7 files changed
+70/−15 lines, 7 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Clay: importUrl :: Text -> Css
+ Clay: renderSelector :: Selector -> Text
+ Clay.Border: borderCollapse :: Visibility -> Css
+ Clay.Display: separate :: Visibility
+ Clay.Display: vAlignSuper :: VerticalAlignValue Value
+ Clay.Render: renderSelector :: Selector -> Text
+ Clay.Stylesheet: Import :: Text -> Rule
+ Clay.Stylesheet: importUrl :: Text -> Css
+ Clay.Text: instance Initial Content
Files
- clay.cabal +9/−9
- src/Clay.hs +6/−0
- src/Clay/Border.hs +20/−0
- src/Clay/Display.hs +8/−4
- src/Clay/Render.hs +19/−0
- src/Clay/Stylesheet.hs +7/−0
- src/Clay/Text.hs +1/−2
clay.cabal view
@@ -1,5 +1,5 @@ Name: clay-Version: 0.10+Version: 0.10.1 Synopsis: CSS preprocessor as embedded Haskell. Description: Clay is a CSS preprocessor like LESS and Sass, but implemented as an embedded@@ -11,14 +11,14 @@ . The API documentation can be found in the top level module "Clay". .- > 0.9 -> 0.10- > - Bumped up text requirement.- > - Added cursor property.- > - Added vertical-align property.- > - Removed Abs constraint from Geometry functions.- > - Added support for rem dimensions.- > - Added support for ListStyle.- > Thanks to Lorenzo Bolla, Fraser Murray, Heather and Sergey!+ > 0.10 -> 0.10.1+ > - Expose a render function for single selectors.+ > - Added super for vertical-align.+ > - Added support for border-collapse.+ > - Allow initial for the content property.+ > - Added support for CSS import.+ > Thanks to Heather, Collin J. Doering, Fraser Murray and Jonathan Fischoff.+ Author: Sebastiaan Visser Maintainer: Sebastiaan Visser <code@fvisser.nl>
src/Clay.hs view
@@ -8,6 +8,8 @@ , pretty , compact +, renderSelector+ -- * The @Css@ monad for collecting style rules. , Css@@ -66,6 +68,10 @@ -- * Define font-faces. , fontFace++-- * Import other CSS files++, importUrl -- * Pseudo elements and classes.
src/Clay/Border.hs view
@@ -25,6 +25,9 @@ , borderRadius , borderTopLeftRadius, borderTopRightRadius , borderBottomLeftRadius, borderBottomRightRadius++-- * Collapsing borders model for a table+, borderCollapse ) where @@ -33,6 +36,7 @@ import Clay.Color import Clay.Common import Clay.Size+import Clay.Display newtype Stroke = Stroke Value deriving (Val, Other, Inherit, Auto, None)@@ -151,3 +155,19 @@ borderBottomLeftRadius a b = key "border-bottom-left-radius" (a ! b) borderBottomRightRadius a b = key "border-bottom-right-radius" (a ! b) +-------------------------------------------------------------------------------++{- newtype Collapse = Collapse Value+ deriving (Val, Initial, Inherit, Other)++collapseCollapse, collapseSeparate :: Collapse++collapseCollapse = Collapse "collapse"+collapseSeparate = Collapse "separate" -}++{- Due conflict with Visibility collapse+ Preferred just to add separate to Visibility+ Because (borderCollapse collapseCollapse) sounds bad -}++borderCollapse :: Visibility -> Css+borderCollapse = key "border-collapse"
src/Clay/Display.hs view
@@ -37,7 +37,8 @@ -- * Visibility. , Visibility-, collapse+, collapse, separate+ , visibility -- Clipping.@@ -64,7 +65,7 @@ -- * Vertical align. , VerticalAlign(..)-, baseline, middle, vAlignSub, textTop, textBottom, vAlignTop, vAlignBottom+, baseline, middle, vAlignSub, vAlignSuper, textTop, textBottom, vAlignTop, vAlignBottom -- * Cursor @@ -179,8 +180,10 @@ newtype Visibility = Visibility Value deriving (Val, Other, Auto, Inherit, Hidden, Visible) -collapse :: Visibility+separate, collapse :: Visibility+ collapse = Visibility "collapse"+separate = Visibility "separate" visibility :: Visibility -> Css visibility = key "visibility"@@ -234,11 +237,12 @@ instance VerticalAlign (VerticalAlignValue a) instance VerticalAlign (Size a) -baseline,middle,vAlignSub,textTop,textBottom,vAlignTop,vAlignBottom :: VerticalAlignValue Value+baseline,middle,vAlignSub,vAlignSuper,textTop,textBottom,vAlignTop,vAlignBottom :: VerticalAlignValue Value baseline = VerticalAlignValue "baseline" middle = VerticalAlignValue "middle" vAlignSub = VerticalAlignValue "sub"+vAlignSuper = VerticalAlignValue "super" textTop = VerticalAlignValue "text-top" textBottom = VerticalAlignValue "text-bottom" vAlignTop = VerticalAlignValue "top"
src/Clay/Render.hs view
@@ -6,6 +6,8 @@ , render , putCss , renderWith++, renderSelector ) where @@ -88,6 +90,11 @@ . rules cfg top . runS +-- | Render a single CSS `Selector`.++renderSelector :: Selector -> Lazy.Text+renderSelector = toLazyText . selector compact+ ------------------------------------------------------------------------------- renderBanner :: Config -> Lazy.Text -> Lazy.Text@@ -164,6 +171,7 @@ rules cfg sel rs = mconcat [ rule cfg sel (mapMaybe property rs) , newline cfg+ , imp cfg `foldMap` mapMaybe imports rs , kframe cfg `foldMap` mapMaybe kframes rs , face cfg `foldMap` mapMaybe faces rs , (\(a, b) -> rules cfg (a : sel) b) `foldMap` mapMaybe nested rs@@ -179,6 +187,17 @@ kframes _ = Nothing faces (Face ns ) = Just ns faces _ = Nothing+ imports (Import i ) = Just i+ imports _ = Nothing++imp :: Config -> Text -> Builder+imp cfg t =+ mconcat+ [ "@import url("+ , fromText t+ , ");"+ , newline cfg ]+ rule :: Config -> [App] -> [(Key (), Value)] -> Builder rule _ _ [] = mempty
src/Clay/Stylesheet.hs view
@@ -43,6 +43,7 @@ | Query MediaQuery [Rule] | Face [Rule] | Keyframe Keyframes+ | Import Text deriving Show newtype StyleM a = S (Writer [Rule] a)@@ -148,4 +149,10 @@ fontFace :: Css -> Css fontFace rs = rule $ Face (runS rs)+++-- | Import a CSS file from a URL++importUrl :: Text -> Css+importUrl l = rule $ Import l
src/Clay/Text.hs view
@@ -220,7 +220,7 @@ ------------------------------------------------------------------------------- newtype Content = Content Value- deriving (Val, None, Normal, Inherit)+ deriving (Val, None, Normal, Inherit, Initial) attrContent :: Text -> Content attrContent a = Content ("attr(" <> value a <> ")")@@ -248,4 +248,3 @@ contents cs = key "content" (noCommas cs) -- TODO: counters-