Hello community, here is the log from the commit of package ghc-clay for openSUSE:Factory checked in at 2017-03-14 10:04:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-clay (Old) and /work/SRC/openSUSE:Factory/.ghc-clay.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-clay" Tue Mar 14 10:04:30 2017 rev:3 rq:461613 version:0.12.1 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-clay/ghc-clay.changes 2016-10-19 13:03:28.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-clay.new/ghc-clay.changes 2017-03-14 10:04:31.217596251 +0100 @@ -1,0 +2,5 @@ +Sun Feb 12 14:20:35 UTC 2017 - [email protected] + +- Update to version 0.12.1 with cabal2obs. + +------------------------------------------------------------------- Old: ---- clay-0.11.tar.gz New: ---- clay-0.12.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-clay.spec ++++++ --- /var/tmp/diff_new_pack.g2bErC/_old 2017-03-14 10:04:31.833509038 +0100 +++ /var/tmp/diff_new_pack.g2bErC/_new 2017-03-14 10:04:31.837508472 +0100 @@ -1,7 +1,7 @@ # # spec file for package ghc-clay # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %global pkg_name clay %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.11 +Version: 0.12.1 Release: 0 Summary: CSS preprocessor as embedded Haskell License: BSD-3-Clause @@ -46,11 +46,6 @@ The API documentation can be found in the top level module "Clay". -> 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. - %package devel Summary: Haskell %{pkg_name} library development files Group: Development/Libraries/Other ++++++ clay-0.11.tar.gz -> clay-0.12.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clay-0.11/clay.cabal new/clay-0.12.1/clay.cabal --- old/clay-0.11/clay.cabal 2016-06-25 22:38:39.000000000 +0200 +++ new/clay-0.12.1/clay.cabal 2017-01-19 10:15:52.000000000 +0100 @@ -1,5 +1,5 @@ Name: clay -Version: 0.11 +Version: 0.12.1 Synopsis: CSS preprocessor as embedded Haskell. Description: Clay is a CSS preprocessor like LESS and Sass, but implemented as an embedded @@ -10,14 +10,6 @@ The project is described on <http://fvisser.nl/clay>. . The API documentation can be found in the top level module "Clay". - . - > 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 @@ -90,6 +82,6 @@ base >= 4 && < 5, mtl >= 1 && < 2.3, text >= 0.11 && < 1.3, - hspec-expectations >= 0.7.2 && < 0.8, + hspec-expectations >= 0.7.2 && < 0.9, hspec >= 2.2.0 && < 2.3 Ghc-Options: -Wall diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clay-0.11/src/Clay/Background.hs new/clay-0.12.1/src/Clay/Background.hs --- old/clay-0.11/src/Clay/Background.hs 2016-06-25 16:01:09.000000000 +0200 +++ new/clay-0.12.1/src/Clay/Background.hs 2016-12-05 23:55:11.000000000 +0100 @@ -84,6 +84,8 @@ , Location , Loc +, Val +, location ) where diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clay-0.11/src/Clay/Border.hs new/clay-0.12.1/src/Clay/Border.hs --- old/clay-0.11/src/Clay/Border.hs 2016-06-25 16:01:09.000000000 +0200 +++ new/clay-0.12.1/src/Clay/Border.hs 2016-11-06 12:34:19.000000000 +0100 @@ -56,7 +56,7 @@ ------------------------------------------------------------------------------- -border, borderTop, borderLeft, borderBottom, borderRight :: Stroke -> Size Abs -> Color -> Css +border, borderTop, borderLeft, borderBottom, borderRight :: Stroke -> Size LengthUnit -> Color -> Css border a b c = key "border" (a ! b ! c) borderTop a b c = key "border-top" (a ! b ! c) @@ -86,10 +86,10 @@ borderTopStyle = key "border-top-style" borderBottomStyle = key "border-bottom-style" -borderWidth4 :: Size Abs -> Size Abs -> Size Abs -> Size Abs -> Css +borderWidth4 :: Size LengthUnit -> Size LengthUnit -> Size LengthUnit -> Size LengthUnit -> Css borderWidth4 a b c d = key "border-width" (a ! b ! c ! d) -borderWidth, borderLeftWidth, borderRightWidth, borderTopWidth, borderBottomWidth :: Size Abs -> Css +borderWidth, borderLeftWidth, borderRightWidth, borderTopWidth, borderBottomWidth :: Size LengthUnit -> Css borderWidth = key "border-width" borderLeftWidth = key "border-left-width" @@ -99,7 +99,7 @@ ------------------------------------------------------------------------------- -outline, outlineTop, outlineLeft, outlineBottom, outlineRight :: Stroke -> Size Abs -> Color -> Css +outline, outlineTop, outlineLeft, outlineBottom, outlineRight :: Stroke -> Size LengthUnit -> Color -> Css outline a b c = key "outline" (a ! b ! c) outlineTop a b c = key "outline-top" (a ! b ! c) @@ -129,10 +129,10 @@ outlineTopStyle = key "outline-top-style" outlineBottomStyle = key "outline-bottom-style" -outlineWidth4 :: Size Abs -> Size Abs -> Size Abs -> Size Abs -> Css +outlineWidth4 :: Size LengthUnit -> Size LengthUnit -> Size LengthUnit -> Size LengthUnit -> Css outlineWidth4 a b c d = key "outline-width" (a ! b ! c ! d) -outlineWidth, outlineLeftWidth, outlineRightWidth, outlineTopWidth, outlineBottomWidth :: Size Abs -> Css +outlineWidth, outlineLeftWidth, outlineRightWidth, outlineTopWidth, outlineBottomWidth :: Size LengthUnit -> Css outlineWidth = key "outline-width" outlineLeftWidth = key "outline-left-width" @@ -140,7 +140,7 @@ outlineTopWidth = key "outline-top-width" outlineBottomWidth = key "outline-bottom-width" -outlineOffset :: Size Abs -> Css +outlineOffset :: Size LengthUnit -> Css outlineOffset = key "outline-offset" ------------------------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clay-0.11/src/Clay/Common.hs new/clay-0.12.1/src/Clay/Common.hs --- old/clay-0.11/src/Clay/Common.hs 2016-06-25 19:38:14.000000000 +0200 +++ new/clay-0.12.1/src/Clay/Common.hs 2016-12-06 00:13:40.000000000 +0100 @@ -33,18 +33,41 @@ class Other a where other :: Value -> a -instance All Value where all = "all" -instance Auto Value where auto = "auto" -instance Baseline Value where baseline = "baseline" -instance Center Value where center = "center" -instance Inherit Value where inherit = "inherit" -instance Normal Value where normal = "normal" -instance None Value where none = "none" -instance Visible Value where visible = "visible" -instance Hidden Value where hidden = "hidden" +allValue :: Value +allValue = "all" +autoValue :: Value +autoValue = "auto" +baselineValue :: Value +baselineValue = "baseline" +centerValue :: Value +centerValue = "center" +inheritValue :: Value +inheritValue = "inherit" +normalValue :: Value +normalValue = "normal" +noneValue :: Value +noneValue = "none" +visibleValue :: Value +visibleValue = "visible" +hiddenValue :: Value +hiddenValue = "hidden" +initialValue :: Value +initialValue = "initial" +unsetValue :: Value +unsetValue = "unset" + +instance All Value where all = allValue +instance Auto Value where auto = autoValue +instance Baseline Value where baseline = baselineValue +instance Center Value where center = centerValue +instance Inherit Value where inherit = inheritValue +instance Normal Value where normal = normalValue +instance None Value where none = noneValue +instance Visible Value where visible = visibleValue +instance Hidden Value where hidden = hiddenValue instance Other Value where other = id -instance Initial Value where initial = "initial" -instance Unset Value where unset = "unset" +instance Initial Value where initial = initialValue +instance Unset Value where unset = unsetValue ------------------------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clay-0.11/src/Clay/Display.hs new/clay-0.12.1/src/Clay/Display.hs --- old/clay-0.11/src/Clay/Display.hs 2016-06-25 16:01:09.000000000 +0200 +++ new/clay-0.12.1/src/Clay/Display.hs 2016-12-05 23:22:45.000000000 +0100 @@ -23,7 +23,7 @@ , Display , display -, inline, block, listItem, runIn, inlineBlock, table, inlineTable, tableRowGroup +, inline, block, listItem, runIn, inlineBlock, table, displayTable, inlineTable, tableRowGroup , tableHeaderGroup, tableFooterGroup, tableRow, tableColumnGroup, tableColumn , tableCell, tableCaption, displayNone, displayInherit, flex , inlineFlex, grid, inlineGrid @@ -65,7 +65,7 @@ -- * Vertical align. , VerticalAlign(..) -, middle, vAlignSub, vAlignSuper, textTop, textBottom, vAlignTop, vAlignBottom +, middle, vAlignSub, vAlignSuper, textTop, textBottom, vAlignTop, vAlignBottom, vAlignBaseline -- * Cursor @@ -131,7 +131,7 @@ newtype Display = Display Value deriving (Val, Other, None, Inherit) -inline, block, listItem, runIn, inlineBlock, table, inlineTable, tableRowGroup, +inline, block, listItem, runIn, inlineBlock, table, displayTable, inlineTable, tableRowGroup, tableHeaderGroup, tableFooterGroup, tableRow, tableColumnGroup, tableColumn, tableCell, tableCaption, displayNone, displayInherit, flex, inlineFlex, grid, inlineGrid :: Display @@ -141,6 +141,8 @@ listItem = Display "list-item" runIn = Display "runIn" inlineBlock = Display "inline-block" +displayTable = Display "table" +{-# DEPRECATED table "Use `displayTable` instead." #-} table = Display "table" inlineTable = Display "inline-table" tableRowGroup = Display "table-row-Group" @@ -232,15 +234,16 @@ verticalAlign :: a -> Css verticalAlign = key "vertical-align" -newtype VerticalAlignValue a = VerticalAlignValue Value deriving (Val, Baseline) +newtype VerticalAlignValue = VerticalAlignValue Value deriving (Val, Baseline) -instance VerticalAlign (VerticalAlignValue a) +instance VerticalAlign VerticalAlignValue instance VerticalAlign (Size a) -middle,vAlignSub,vAlignSuper,textTop,textBottom,vAlignTop,vAlignBottom :: VerticalAlignValue Value +middle,vAlignSub,vAlignSuper,textTop,textBottom,vAlignTop,vAlignBottom,vAlignBaseline :: VerticalAlignValue middle = VerticalAlignValue "middle" vAlignSub = VerticalAlignValue "sub" +vAlignBaseline = baseline vAlignSuper = VerticalAlignValue "super" textTop = VerticalAlignValue "text-top" textBottom = VerticalAlignValue "text-bottom" @@ -260,7 +263,7 @@ crosshair,cursorDefault,pointer,move,eResize,neResize,nwResize,nResize,seResize,swResize,sResize,wResize,cursorText,wait,cursorProgress,help :: CursorValue Value crosshair = CursorValue "crosshair" -cursorDefault = CursorValue "cursorDefault" +cursorDefault = CursorValue "default" pointer = CursorValue "pointer" move = CursorValue "move" eResize = CursorValue "e-resize" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clay-0.11/src/Clay/Filter.hs new/clay-0.12.1/src/Clay/Filter.hs --- old/clay-0.11/src/Clay/Filter.hs 2016-06-25 16:01:09.000000000 +0200 +++ new/clay-0.12.1/src/Clay/Filter.hs 2016-11-06 12:34:19.000000000 +0100 @@ -49,33 +49,33 @@ url :: Text -> Filter url u = Filter ("url(" <> value u <> ")") -blur :: Size Abs -> Filter +blur :: Size LengthUnit -> Filter blur i = Filter ("blur(" <> value i <> ")") brightness :: Double -> Filter brightness i = Filter ("brightness(" <> value i <> ")") -contrast :: Size Rel -> Filter +contrast :: Size Percentage -> Filter contrast i = Filter ("contrast(" <> value i <> ")") -dropShadow :: Size Abs -> Size Abs -> Size Abs -> Color -> Filter +dropShadow :: Size LengthUnit -> Size LengthUnit -> Size LengthUnit -> Color -> Filter dropShadow x y s c = Filter ("drop-shadow(" <> value (x ! y ! s ! c) <> ")") -grayscale :: Size Rel -> Filter +grayscale :: Size Percentage -> Filter grayscale g = Filter ("grayscale(" <> value g <> ")") hueRotate :: Angle a -> Filter hueRotate h = Filter ("hue-rotate(" <> value h <> ")") -invert :: Size Rel -> Filter +invert :: Size Percentage -> Filter invert i = Filter ("invert(" <> value i <> ")") -opacity :: Size Rel -> Filter +opacity :: Size Percentage -> Filter opacity i = Filter ("opacity(" <> value i <> ")") -saturate :: Size Rel -> Filter +saturate :: Size Percentage -> Filter saturate i = Filter ("saturate(" <> value i <> ")") -sepia :: Size Rel -> Filter +sepia :: Size Percentage -> Filter sepia i = Filter ("sepia(" <> value i <> ")") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clay-0.11/src/Clay/Gradient.hs new/clay-0.12.1/src/Clay/Gradient.hs --- old/clay-0.11/src/Clay/Gradient.hs 2016-06-25 16:01:09.000000000 +0200 +++ new/clay-0.12.1/src/Clay/Gradient.hs 2016-11-06 12:34:19.000000000 +0100 @@ -44,7 +44,7 @@ import Clay.Size import Clay.Background -type Ramp = [(Color, Size Rel)] +type Ramp = [(Color, Size Percentage)] ------------------------------------------------------------------------------- @@ -81,7 +81,7 @@ ellipse :: Extend -> Radial ellipse ext = Radial ("ellipse " <> value ext) -circular :: Size Abs -> Radial +circular :: Size LengthUnit -> Radial circular radius = Radial (value (radius, radius)) elliptical :: Size a -> Size a -> Radial @@ -115,5 +115,5 @@ ramp xs = value (map (\(a, b) -> value (value a, value b)) xs) shortcut :: (Ramp -> BackgroundImage) -> Color -> Color -> BackgroundImage -shortcut g f t = g [(f, 0), (t, 100)] +shortcut g f t = g [(f, (pct 0)), (t, (pct 100))] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clay-0.11/src/Clay/Media.hs new/clay-0.12.1/src/Clay/Media.hs --- old/clay-0.11/src/Clay/Media.hs 2016-06-25 16:01:09.000000000 +0200 +++ new/clay-0.12.1/src/Clay/Media.hs 2016-11-06 12:34:19.000000000 +0100 @@ -72,7 +72,7 @@ width, minWidth, maxWidth, height, minHeight, maxHeight, deviceWidth , minDeviceWidth, maxDeviceWidth, deviceHeight, minDeviceHeight - , maxDeviceHeight :: Size Abs -> Feature + , maxDeviceHeight :: Size LengthUnit -> Feature width = with "width" minWidth = with "min-width" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clay-0.11/src/Clay/Property.hs new/clay-0.12.1/src/Clay/Property.hs --- old/clay-0.11/src/Clay/Property.hs 2016-06-25 18:05:26.000000000 +0200 +++ new/clay-0.12.1/src/Clay/Property.hs 2016-11-06 12:34:19.000000000 +0100 @@ -69,7 +69,10 @@ instance HasResolution E5 where resolution _ = 100000 instance Val Double where - value = fromString . showFixed' . realToFrac + value = Value . Plain . cssDoubleText + +cssDoubleText :: Double -> Text +cssDoubleText = fromString . showFixed' . realToFrac where showFixed' :: Fixed E5 -> String showFixed' = showFixed True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clay-0.11/src/Clay/Pseudo.hs new/clay-0.12.1/src/Clay/Pseudo.hs --- old/clay-0.11/src/Clay/Pseudo.hs 2016-06-25 16:01:09.000000000 +0200 +++ new/clay-0.12.1/src/Clay/Pseudo.hs 2016-11-06 12:34:19.000000000 +0100 @@ -53,10 +53,11 @@ target = ":target" valid = ":valid" -lang, nthChild, nthLastChild, nthLastOfType, nthOfType :: Text -> Refinement +lang, nthChild, nthLastChild, nthLastOfType, nthOfType, not :: Text -> Refinement lang n = func "lang" [n] nthChild n = func "nth-child" [n] nthLastChild n = func "nth-last-child" [n] nthLastOfType n = func "nth-last-of-type" [n] nthOfType n = func "nth-of-type" [n] +not n = func "not" [n] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clay-0.11/src/Clay/Render.hs new/clay-0.12.1/src/Clay/Render.hs --- old/clay-0.11/src/Clay/Render.hs 2016-06-25 19:42:48.000000000 +0200 +++ new/clay-0.12.1/src/Clay/Render.hs 2016-11-06 12:34:19.000000000 +0100 @@ -4,6 +4,7 @@ , pretty , compact , render +, htmlInline , putCss , renderWith , renderSelector @@ -36,6 +37,8 @@ { indentation :: Builder , newline :: Builder , sep :: Builder + , lbrace :: Builder + , rbrace :: Builder , finalSemicolon :: Bool , warn :: Bool , align :: Bool @@ -49,6 +52,8 @@ { indentation = " " , newline = "\n" , sep = " " + , lbrace = "{" + , rbrace = "}" , finalSemicolon = True , warn = True , align = True @@ -62,6 +67,23 @@ { indentation = "" , newline = "" , sep = "" + , lbrace = "{" + , rbrace = "}" + , finalSemicolon = False + , warn = False + , align = False + , banner = False + } + +-- | Configuration to print to a compacted unreadable CSS output for embedding inline with HTML. + +htmlInline :: Config +htmlInline = Config + { indentation = "" + , newline = "" + , sep = "" + , lbrace = "" + , rbrace = "" , finalSemicolon = False , warn = False , align = False @@ -110,10 +132,10 @@ mconcat [ "@" <> fromText browser <> "keyframes " , fromText ident , newline cfg - , "{" + , lbrace cfg , newline cfg , foldMap (frame cfg) xs - , "}" + , rbrace cfg , newline cfg , newline cfg ] @@ -133,10 +155,10 @@ mconcat [ mediaQuery q , newline cfg - , "{" + , lbrace cfg , newline cfg , rules cfg sel rs - , "}" + , rbrace cfg , newline cfg ] @@ -206,10 +228,10 @@ in mconcat [ selector cfg (merger sel) , newline cfg - , "{" + , lbrace cfg , newline cfg , properties cfg xs - , "}" + , rbrace cfg , newline cfg ] @@ -250,6 +272,8 @@ in mconcat [ind, fromText k, pad, ":", sep cfg, fromText v] selector :: Config -> Selector -> Builder +selector Config { lbrace = "", rbrace = "" } = rec + where rec _ = "" selector cfg = intersperse ("," <> newline cfg) . rec where rec (In (SelectorF (Refinement ft) p)) = (<> foldMap predicate (sort ft)) <$> case p of diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clay-0.11/src/Clay/Selector.hs new/clay-0.12.1/src/Clay/Selector.hs --- old/clay-0.11/src/Clay/Selector.hs 2016-06-25 19:05:14.000000000 +0200 +++ new/clay-0.12.1/src/Clay/Selector.hs 2016-12-06 00:00:30.000000000 +0100 @@ -1,7 +1,6 @@ {-# LANGUAGE OverloadedStrings , FlexibleInstances - , FlexibleContexts , GeneralizedNewtypeDeriving , StandaloneDeriving , UndecidableInstances diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clay-0.11/src/Clay/Size.hs new/clay-0.12.1/src/Clay/Size.hs --- old/clay-0.11/src/Clay/Size.hs 2016-06-25 16:01:09.000000000 +0200 +++ new/clay-0.12.1/src/Clay/Size.hs 2017-01-20 00:24:33.000000000 +0100 @@ -1,16 +1,19 @@ {-# LANGUAGE - EmptyDataDecls - , OverloadedStrings + OverloadedStrings , GeneralizedNewtypeDeriving , FlexibleInstances + , ExistentialQuantification + , StandaloneDeriving + , TypeFamilies + , EmptyDataDecls #-} module Clay.Size ( -- * Size type. Size -, Abs -, Rel +, LengthUnit +, Percentage , nil , unitless @@ -31,6 +34,14 @@ , vmin , vmax +-- * Calculation operators for calc + +, (@+@) +, (@-@) +, (@*) +, (*@) +, (@/) + -- * Shorthands for properties that can be applied separately to each box side. , sym @@ -57,6 +68,7 @@ import Data.Monoid import Prelude hiding (rem) +import Data.Text (Text) import Clay.Common import Clay.Property @@ -64,70 +76,100 @@ ------------------------------------------------------------------------------- --- | Sizes can be relative like percentages or rems. -data Rel +-- | Sizes can be given using a length unit (e.g. em, px). +data LengthUnit + +-- | Sizes can be given in percentages. +data Percentage --- | Sizes can be absolute like pixels, points, etc. -data Abs +-- | When combining percentages with units using calc, we get a combination +data Combination -newtype Size a = Size Value - deriving (Val, Auto, Normal, Inherit, None, Other) +data Size a = + SimpleSize Text | + forall b c. SumSize (Size b) (Size c) | + forall b c. DiffSize (Size b) (Size c) | + MultSize Double (Size a) | + DivSize Double (Size a) | + OtherSize Value + +deriving instance Show (Size a) + +sizeToText :: Size a -> Text +sizeToText (SimpleSize txt) = txt +sizeToText (SumSize a b) = mconcat ["(", sizeToText a, " + ", sizeToText b, ")"] +sizeToText (DiffSize a b) = mconcat ["(", sizeToText a, " - ", sizeToText b, ")"] +sizeToText (MultSize a b) = mconcat ["(", cssDoubleText a, " * ", sizeToText b, ")"] +sizeToText (DivSize a b) = mconcat ["(", sizeToText b, " / ", cssDoubleText a, ")"] +sizeToText (OtherSize a) = plain $ unValue a + +instance Val (Size a) where + value (SimpleSize a) = value a + value (OtherSize a) = a + value s = Value $ browsers <> Plain ("calc" <> sizeToText s) + +instance Auto (Size a) where auto = OtherSize Clay.Common.autoValue +instance Normal (Size a) where normal = OtherSize Clay.Common.normalValue +instance Inherit (Size a) where inherit = OtherSize Clay.Common.inheritValue +instance None (Size a) where none = OtherSize Clay.Common.noneValue +instance Other (Size a) where other a = OtherSize a -- | Zero size. nil :: Size a -nil = Size "0" +nil = SimpleSize "0" -- | Unitless size (as recommended for line-height). unitless :: Double -> Size a -unitless i = Size (value i) +unitless i = SimpleSize ((plain . unValue . value) i) -cm, mm, inches, px, pt, pc :: Double -> Size Abs +cm, mm, inches, px, pt, pc :: Double -> Size LengthUnit -- | Size in centimeters. -cm i = Size (value i <> "cm") +cm i = SimpleSize (cssDoubleText i <> "cm") -- | Size in millimeters. -mm i = Size (value i <> "mm") +mm i = SimpleSize (cssDoubleText i <> "mm") -- | Size in inches (1in = 2.54 cm). -inches i = Size (value i <> "in") +inches i = SimpleSize (cssDoubleText i <> "in") -- | Size in pixels. -px i = Size (value i <> "px") +px i = SimpleSize (cssDoubleText i <> "px") -- | Size in points (1pt = 1/72 of 1in). -pt i = Size (value i <> "pt") +pt i = SimpleSize (cssDoubleText i <> "pt") -- | Size in picas (1pc = 12pt). -pc i = Size (value i <> "pc") +pc i = SimpleSize (cssDoubleText i <> "pc") -em, ex, pct, rem, vw, vh, vmin, vmax :: Double -> Size Rel +em, ex, rem, vw, vh, vmin, vmax :: Double -> Size LengthUnit --- | Size in em's (computed value of the font-size). -em i = Size (value i <> "em") +-- | Size in em's (computed cssDoubleText of the font-size). +em i = SimpleSize (cssDoubleText i <> "em") --- | Size in ex'es (x-height of the first avaliable font). -ex i = Size (value i <> "ex") +-- | SimpleSize in ex'es (x-height of the first avaliable font). +ex i = SimpleSize (cssDoubleText i <> "ex") --- | Size in percents. -pct i = Size (value i <> "%") +-- | SimpleSize in rem's (em's, but always relative to the root element). +rem i = SimpleSize (cssDoubleText i <> "rem") --- | Size in rem's (em's, but always relative to the root element). -rem i = Size (value i <> "rem") +-- | SimpleSize in vw's (1vw = 1% of viewport width). +vw i = SimpleSize (cssDoubleText i <> "vw") --- | Size in vw's (1vw = 1% of viewport width). -vw i = Size (value i <> "vw") +-- | SimpleSize in vh's (1vh = 1% of viewport height). +vh i = SimpleSize (cssDoubleText i <> "vh") --- | Size in vh's (1vh = 1% of viewport height). -vh i = Size (value i <> "vh") +-- | SimpleSize in vmin's (the smaller of vw or vh). +vmin i = SimpleSize (cssDoubleText i <> "vmin") --- | Size in vmin's (the smaller of vw or vh). -vmin i = Size (value i <> "vmin") +-- | SimpleSize in vmax's (the larger of vw or vh). +vmax i = SimpleSize (cssDoubleText i <> "vmax") --- | Size in vmax's (the larger of vw or vh). -vmax i = Size (value i <> "vmax") +-- | SimpleSize in percents. +pct :: Double -> Size Percentage +pct i = SimpleSize (cssDoubleText i <> "%") -instance Num (Size Abs) where +instance Num (Size LengthUnit) where fromInteger = px . fromInteger (+) = error "plus not implemented for Size" (*) = error "times not implemented for Size" @@ -135,11 +177,11 @@ signum = error "signum not implemented for Size" negate = error "negate not implemented for Size" -instance Fractional (Size Abs) where +instance Fractional (Size LengthUnit) where fromRational = px . fromRational recip = error "recip not implemented for Size" -instance Num (Size Rel) where +instance Num (Size Percentage) where fromInteger = pct . fromInteger (+) = error "plus not implemented for Size" (*) = error "times not implemented for Size" @@ -147,10 +189,42 @@ signum = error "signum not implemented for Size" negate = error "negate not implemented for Size" -instance Fractional (Size Rel) where +instance Fractional (Size Percentage) where fromRational = pct . fromRational recip = error "recip not implemented for Size" +-- | Type family to define what is the result of a calc operation + +type family SizeCombination sa sb where + SizeCombination Percentage Percentage = Percentage + SizeCombination LengthUnit LengthUnit = LengthUnit + SizeCombination a b = Combination + +-- | Plus operator to combine sizes into calc function +infixl 6 @+@ +(@+@) :: Size a -> Size b -> Size (SizeCombination a b) +a @+@ b = SumSize a b + +-- | Minus operator to combine sizes into calc function +infixl 6 @-@ +(@-@) :: Size a -> Size b -> Size (SizeCombination a b) +a @-@ b = DiffSize a b + +-- | Times operator to combine sizes into calc function +infixl 7 *@ +(*@) :: Double -> Size a -> Size a +a *@ b = MultSize a b + +-- | Reversed times operator to combine sizes into calc function +infixl 7 @* +(@*) :: Size a -> Double -> Size a +a @* b = MultSize b a + +-- | Division operator to combine sizes into calc function +infixl 7 @/ +(@/) :: Size a -> Double -> Size a +a @/ b = DivSize b a + ------------------------------------------------------------------------------- sym :: (a -> a -> a -> a -> Css) -> a -> Css diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clay-0.11/src/Clay/Stylesheet.hs new/clay-0.12.1/src/Clay/Stylesheet.hs --- old/clay-0.11/src/Clay/Stylesheet.hs 2016-06-25 16:01:09.000000000 +0200 +++ new/clay-0.12.1/src/Clay/Stylesheet.hs 2016-12-06 00:00:50.000000000 +0100 @@ -1,5 +1,4 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} -{-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE FlexibleInstances #-} module Clay.Stylesheet where diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clay-0.11/src/Clay/Text.hs new/clay-0.12.1/src/Clay/Text.hs --- old/clay-0.11/src/Clay/Text.hs 2016-06-25 16:01:09.000000000 +0200 +++ new/clay-0.12.1/src/Clay/Text.hs 2016-11-06 12:34:19.000000000 +0100 @@ -59,6 +59,26 @@ , textTransform , capitalize, uppercase, lowercase, fullWidth +-- * Text-overflow. + +, TextOverflow +, textOverflow +, overflowClip, overflowEllipsis + +-- * Word-break. + +, WordBreak +, wordBreak +, breakAll +, keepAll + +-- * Overflow-wrap (and Word-wrap). + +, OverflowWrap +, overflowWrap +, wordWrap +, breakWord + -- * Content. , Content @@ -219,6 +239,47 @@ ------------------------------------------------------------------------------- +newtype WordBreak = WordBreak Value + deriving (Val, Inherit, Initial, Unset, Normal) + +breakAll, keepAll :: WordBreak + +breakAll = WordBreak "break-all" +keepAll = WordBreak "keep-all" + +wordBreak :: WordBreak -> Css + +wordBreak = key "word-break" + +------------------------------------------------------------------------------- + +newtype OverflowWrap = OverflowWrap Value + deriving (Val, Inherit, Initial, Unset, Normal) + +breakWord :: OverflowWrap + +breakWord = OverflowWrap "break-word" + +overflowWrap, wordWrap :: OverflowWrap -> Css + +wordWrap = key "word-wrap" +overflowWrap = key "overflow-wrap" + +------------------------------------------------------------------------------- + +newtype TextOverflow = TextOverflow Value + deriving (Val, None, Inherit, Initial) + +overflowClip, overflowEllipsis :: TextOverflow + +overflowClip = TextOverflow "clip" +overflowEllipsis = TextOverflow "ellipsis" + +textOverflow :: TextOverflow -> Css +textOverflow = key "text-overflow" + +------------------------------------------------------------------------------- + newtype Content = Content Value deriving (Val, None, Normal, Inherit, Initial) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clay-0.11/src/Clay/Transform.hs new/clay-0.12.1/src/Clay/Transform.hs --- old/clay-0.11/src/Clay/Transform.hs 2016-06-25 16:01:09.000000000 +0200 +++ new/clay-0.12.1/src/Clay/Transform.hs 2016-11-06 12:34:19.000000000 +0100 @@ -86,17 +86,18 @@ ------------------------------------------------------------------------------- -translate :: Size Abs -> Size Abs -> Transformation -translate x y = Transformation ("translate(" <> value [x, y] <> ")") +translate :: Size a -> Size b -> Transformation +translate x y = Transformation ("translate(" <> value [value x, value y] <> ")") -translateX, translateY, translateZ :: Size Abs -> Transformation +translateX, translateY :: Size LengthUnit -> Transformation +translateZ :: Size LengthUnit -> Transformation translateX x = Transformation ("translateX(" <> value x <> ")") translateY y = Transformation ("translateY(" <> value y <> ")") translateZ z = Transformation ("translateZ(" <> value z <> ")") -translate3d :: Size Abs -> Size Abs -> Size Abs -> Transformation -translate3d x y z = Transformation ("translate3d(" <> value [x, y, z] <> ")") +translate3d :: Size a -> Size b -> Size LengthUnit -> Transformation +translate3d x y z = Transformation ("translate3d(" <> value [value x, value y, value z] <> ")") ------------------------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clay-0.11/src/Clay/Transition.hs new/clay-0.12.1/src/Clay/Transition.hs --- old/clay-0.11/src/Clay/Transition.hs 2016-06-25 16:01:09.000000000 +0200 +++ new/clay-0.12.1/src/Clay/Transition.hs 2016-11-06 12:34:19.000000000 +0100 @@ -24,6 +24,7 @@ , TimingFunction , transitionTimingFunction +, transitionTimingFunctions , ease, easeIn, easeOut, easeInOut, linear, stepStart, stepStop , stepsStart, stepsStop , cubicBezier @@ -47,8 +48,9 @@ transition p d f e = prefixed (browsers <> "transition") (p ! d ! f ! e) transitions :: [(Text, Time, TimingFunction, Time)] -> Css -transitions = prefixed (browsers <> "transition") - . map (\(p, d, f, e) -> value (p ! d ! f ! e)) +transitions [] = key "transition" (none :: Value) +transitions x = prefixed (browsers <> "transition") + $ map (\(p, d, f, e) -> value (p ! d ! f ! e)) x ------------------------------------------------------------------------------- @@ -56,15 +58,17 @@ transitionProperty = key "transition-property" transitionProperties :: [Text] -> Css -transitionProperties = key "transition-property" +transitionProperties [] = key "transition-property" (none :: Value) +transitionProperties x = key "transition-property" x ------------------------------------------------------------------------------- transitionDuration :: Time -> Css transitionDuration = key "transition-duration" -transitionDurations :: [Time] -> Css -transitionDurations = key "transition-duration" +transitionDurations :: [Time] -> Css +transitionDurations [] = key "transition-duration" (none :: Value) +transitionDurations x = key "transition-duration" x ------------------------------------------------------------------------------- @@ -92,6 +96,10 @@ transitionTimingFunction :: TimingFunction -> Css transitionTimingFunction = key "transition-timing-function" +transitionTimingFunctions :: [TimingFunction] -> Css +transitionTimingFunctions [] = key "transition-timing-function" (none :: Value) +transitionTimingFunctions x = key "transition-timing-function" x + ------------------------------------------------------------------------------- transitionDelay :: Time -> Css
