clay 0.3 → 0.4
raw patch · 10 files changed
+158/−22 lines, 10 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Clay.Gradient: Extend :: Value -> Extend
- Clay.Gradient: newtype Extend
- Clay.Media: all :: MediaType
+ Clay.Common: all :: All a => a
+ Clay.Common: class All a
+ Clay.Common: instance All Value
+ Clay.Display: data FloatStyle
+ Clay.Display: floatLeft :: FloatStyle
+ Clay.Display: floatRight :: FloatStyle
+ Clay.Display: instance Inherit FloatStyle
+ Clay.Display: instance None FloatStyle
+ Clay.Display: instance Val FloatStyle
+ Clay.Dynamic: data UserFocus
+ Clay.Dynamic: data UserInput
+ Clay.Dynamic: data UserModify
+ Clay.Dynamic: data UserSelect
+ Clay.Dynamic: inputDisabled :: UserInput
+ Clay.Dynamic: inputEnabled :: UserInput
+ Clay.Dynamic: instance All UserFocus
+ Clay.Dynamic: instance All UserSelect
+ Clay.Dynamic: instance Inherit UserFocus
+ Clay.Dynamic: instance Inherit UserInput
+ Clay.Dynamic: instance Inherit UserModify
+ Clay.Dynamic: instance Inherit UserSelect
+ Clay.Dynamic: instance None UserFocus
+ Clay.Dynamic: instance None UserInput
+ Clay.Dynamic: instance None UserModify
+ Clay.Dynamic: instance None UserSelect
+ Clay.Dynamic: instance Normal UserFocus
+ Clay.Dynamic: instance Other UserFocus
+ Clay.Dynamic: instance Val UserFocus
+ Clay.Dynamic: instance Val UserInput
+ Clay.Dynamic: instance Val UserModify
+ Clay.Dynamic: instance Val UserSelect
+ Clay.Dynamic: readOnly :: UserModify
+ Clay.Dynamic: readWrite :: UserModify
+ Clay.Dynamic: selectAfter :: UserFocus
+ Clay.Dynamic: selectBefore :: UserFocus
+ Clay.Dynamic: selectElement :: UserSelect
+ Clay.Dynamic: selectElements :: UserSelect
+ Clay.Dynamic: selectMenu :: UserFocus
+ Clay.Dynamic: selectSame :: UserFocus
+ Clay.Dynamic: selectText :: UserSelect
+ Clay.Dynamic: selectToggle :: UserSelect
+ Clay.Dynamic: userFocus :: UserFocus -> Css
+ Clay.Dynamic: userInput :: UserInput -> Css
+ Clay.Dynamic: userModify :: UserModify -> Css
+ Clay.Dynamic: userSelect :: UserSelect -> Css
+ Clay.Dynamic: writeOnly :: UserModify
+ Clay.Gradient: data Extend
+ Clay.Size: nil :: Size a
+ Clay.Stylesheet: instance All MediaType
- Clay.Display: float :: Side -> Css
+ Clay.Display: float :: FloatStyle -> Css
Files
- clay.cabal +9/−8
- src/Clay.hs +7/−1
- src/Clay/Common.hs +2/−0
- src/Clay/Display.hs +11/−3
- src/Clay/Dynamic.hs +118/−0
- src/Clay/Gradient.hs +1/−4
- src/Clay/Media.hs +2/−3
- src/Clay/Property.hs +2/−1
- src/Clay/Size.hs +4/−0
- src/Clay/Stylesheet.hs +2/−2
clay.cabal view
@@ -1,5 +1,5 @@ Name: clay-Version: 0.3+Version: 0.4 Synopsis: CSS preprocessor as embedded Haskell. Description: Clay is a CSS preprocessor like LESS and Sass, but implemented as an embedded@@ -11,12 +11,13 @@ . The API documentation can be found in the top level module "Clay". .- > 0.2 -> 0.3- > - Fixed value grammar of radial gradients.- > - Added mask related properties.- > - Allow multiple box-shadows.- > - Added filter property.- > - Also render value prefix when both key and value are prefixed.+ > 0.3 -> 0.4+ > - Added dynamic presentation. (thanks to chrisdone)+ > - Float now has its own value, don't incorrectly share side. (thanks to chrisdone)+ > - Added nil size constructor.+ > - Slightly improved the gradient syntax.+ > - Expose the Propery module by default.+ > - Introduced shared 'all' value. Author: Sebastiaan Visser Maintainer: Sebastiaan Visser <code@fvisser.nl>@@ -44,6 +45,7 @@ Clay.Box Clay.Color Clay.Common+ Clay.Dynamic Clay.Display Clay.Elements Clay.Filter@@ -68,4 +70,3 @@ base >= 4 && < 5, mtl >= 1 && < 2.2, text >= 0.11 && < 0.12-
src/Clay.hs view
@@ -81,6 +81,7 @@ , module Clay.Border , module Clay.Box , module Clay.Display+, module Clay.Dynamic , module Clay.Font , module Clay.Geometry , module Clay.Gradient@@ -89,6 +90,10 @@ , module Clay.Transition , module Clay.Mask , module Clay.Filter++-- * Writing your own properties.++, module Clay.Property ) where @@ -97,6 +102,7 @@ import Clay.Render import Clay.Stylesheet import Clay.Selector+import Clay.Property import Clay.Pseudo import Clay.Elements hiding (link, em)@@ -113,6 +119,7 @@ import Clay.Time import Clay.Common import Clay.Display hiding (table)+import Clay.Dynamic import Clay.Font hiding (menu, caption, small, icon) import Clay.Geometry import Clay.Gradient@@ -128,4 +135,3 @@ -- Because a large part of the names export by "Clay.Media" clash with names -- export by other modules we don't re-export it here and recommend you to -- import the module qualified.-
src/Clay/Common.hs view
@@ -13,6 +13,7 @@ ------------------------------------------------------------------------------- +class All a where all :: a class Auto a where auto :: a class Inherit a where inherit :: a class None a where none :: a@@ -26,6 +27,7 @@ class Other a where other :: Value -> a +instance All Value where all = "all" instance Auto Value where auto = "auto" instance Inherit Value where inherit = "inherit" instance Normal Value where normal = "normal"
src/Clay/Display.hs view
@@ -4,6 +4,9 @@ -- * Float. float+, FloatStyle+, floatLeft+, floatRight , clear , Clear , both@@ -64,7 +67,6 @@ import Data.Monoid import Data.String -import Clay.Background import Clay.Size import Clay.Property import Clay.Stylesheet@@ -72,9 +74,16 @@ ------------------------------------------------------------------------------- -float :: Side -> Css+float :: FloatStyle -> Css float = key "float" +newtype FloatStyle = FloatStyle Value+ deriving (Val,None,Inherit)++floatLeft, floatRight :: FloatStyle+floatLeft = FloatStyle "left"+floatRight = FloatStyle "right"+ newtype Clear = Clear Value deriving (Val, Other, None, Inherit) @@ -202,4 +211,3 @@ pointerEvents :: PointerEvents -> Css pointerEvents = key "pointer-events"-
+ src/Clay/Dynamic.hs view
@@ -0,0 +1,118 @@+{-# LANGUAGE+ GeneralizedNewtypeDeriving+ , OverloadedStrings+ , NoImplicitPrelude+ #-}++-- | Dynamic user interface element control. This CSS3 functionality is still+-- in draft, though it is implemented in several browsers. See+-- <http://www.w3.org/TR/2000/WD-css3-userint-20000216#dynamic> and your target+-- browsers' vendor documentation for more information.++module Clay.Dynamic+(+ -- * User input+ userInput, UserInput, inputEnabled, inputDisabled++ -- * User modifiability+, userModify, UserModify, readOnly, readWrite, writeOnly++ -- * User selection+, userSelect, UserSelect, selectText, selectToggle, selectElement, selectElements++ -- * User focus+, userFocus, UserFocus, selectBefore, selectAfter, selectSame, selectMenu+)+where++import Clay.Common+import Clay.Property+import Clay.Stylesheet+import Data.Monoid hiding (All)+import Prelude (($))++--------------------------------------------------------------------------------+-- Enabling user interface elements: the 'user-input' property++-- | Enabling user interface elements.++userInput :: UserInput -> Css+userInput = prefixed (browsers <> "user-input")++-- | Selection mode.++newtype UserInput = UserInput Value+ deriving (Val, Inherit, None)++-- | Selection mode.++inputEnabled, inputDisabled :: UserInput++inputEnabled = UserInput "enabled"+inputDisabled = UserInput "disabled"++--------------------------------------------------------------------------------+-- Modifiability of an element: the 'user-modify' property++-- | Modifiability of an element.++userModify :: UserModify -> Css+userModify = prefixed (browsers <> "user-modify")++-- | Selection mode.++newtype UserModify = UserModify Value+ deriving (Val, Inherit, None)++-- | Selection mode.++readOnly, readWrite, writeOnly :: UserModify++readOnly = UserModify "readonly"+readWrite = UserModify "read-write"+writeOnly = UserModify "write-only"++--------------------------------------------------------------------------------+-- Content selection granularity: the 'user-select' property++-- | Content selection granularity.++userSelect :: UserSelect -> Css+userSelect = prefixed (browsers <> "user-select")++-- | Selection mode.++newtype UserSelect = UserSelect Value+ deriving (Val, Inherit, None, All)++-- | Selection mode.++selectText, selectToggle, selectElement, selectElements :: UserSelect++selectText = UserSelect "text"+selectToggle = UserSelect "toggle"+selectElement = UserSelect "element"+selectElements = UserSelect "elements"++--------------------------------------------------------------------------------+-- Focus selection behavior of the contents of an element: the 'user-focus' property++-- | Content focusion granularity.++userFocus :: UserFocus -> Css+userFocus = prefixed (browsers <> "user-focus")++-- | Focus behaviour.++newtype UserFocus = UserFocus Value+ deriving (Val, Inherit, None, Normal, Other, All)++-- | Focusion mode.++selectBefore, selectAfter, selectSame, selectMenu :: UserFocus++selectBefore = UserFocus "select-before"+selectAfter = UserFocus "select-after"+selectSame = UserFocus "select-same"+selectMenu = UserFocus "select-menu"+
src/Clay/Gradient.hs view
@@ -21,11 +21,8 @@ , circle, ellipse , circular, elliptical -, Extend (..)+, Extend , closestSide, closestCorner, farthestSide, farthestCorner---- , Extend--- , closestSide, closestCorner, farthestSide, farthestCorner , radialGradient
src/Clay/Media.hs view
@@ -4,7 +4,7 @@ -- * Media types. - all, aural, braille, handheld, print, projection+ aural, braille, handheld, print, projection , screen, tty, tv, embossed -- * Geometrical features.@@ -49,10 +49,9 @@ ------------------------------------------------------------------------------- -all, aural, braille, handheld, print, projection+aural, braille, handheld, print, projection , screen, tty, tv, embossed :: MediaType -all = MediaType "all" aural = MediaType "aural" braille = MediaType "braille" handheld = MediaType "handheld"
src/Clay/Property.hs view
@@ -7,6 +7,7 @@ import Data.Maybe import Data.String import Data.Text (Text, replace)+import Text.Printf data Prefixed = Prefixed [(Text, Text)] | Plain Text deriving Show@@ -62,7 +63,7 @@ value = fromString . show instance Val Double where- value = fromString . show+ value = fromString . printf "%.5f" instance Val Value where value = id
src/Clay/Size.hs view
@@ -11,6 +11,7 @@ Size , Abs , Rel+, nil -- * Size constructors. @@ -57,6 +58,9 @@ newtype Size a = Size Value deriving (Val, Auto, Normal, Inherit, None, Other)++nil :: Size a+nil = Size "0" -- | Size in pixels.
src/Clay/Stylesheet.hs view
@@ -2,7 +2,7 @@ module Clay.Stylesheet where import Data.Text (Text)-import Control.Monad.Writer+import Control.Monad.Writer hiding (All) import Clay.Selector hiding (Child) import Clay.Property@@ -11,7 +11,7 @@ ------------------------------------------------------------------------------- newtype MediaType = MediaType Value- deriving (Val, Other, Show)+ deriving (Val, Other, Show, All) data NotOrOnly = Not | Only deriving Show