-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | CSS Minifier -- -- A CSS minifier which not only aims at reducing the amount of bytes of -- the output, but also at improving gzip compression. It may be used as -- a library, or a stand-alone executable. For the library, refer to the -- Hasmin module documentation. For the program: the output is the -- minified CSS file, but hasmin allows also its compression into gzip -- using Google's Zopfli library. -- -- To use it: ./hasmin input.css > output.css -- -- By default, most minification techniques are enabled. For a list of -- available flags, do: ./hasmin --help @package hasmin @version 1.0.2 module Hasmin.Config -- | The configuration used for minifying. data Config Config :: ColorSettings -> DimensionSettings -> GradientSettings -> Bool -> Bool -> Bool -> Bool -> Bool -> FontWeightSettings -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> LetterCase -> SortingMethod -> SortingMethod -> RulesMergeSettings -> Config [colorSettings] :: Config -> ColorSettings [dimensionSettings] :: Config -> DimensionSettings [gradientSettings] :: Config -> GradientSettings [shouldUsePropertyTraits] :: Config -> Bool [shouldCleanRules] :: Config -> Bool [shouldMinifyTimingFunctions] :: Config -> Bool [shouldMinifyFilterFunctions] :: Config -> Bool [shouldRemoveQuotes] :: Config -> Bool [fontweightSettings] :: Config -> FontWeightSettings [shouldMinifyTransformOrigin] :: Config -> Bool [shouldMinifyMicrosyntax] :: Config -> Bool [shouldMinifyKeyframeSelectors] :: Config -> Bool [shouldMinifyTransformFunction] :: Config -> Bool [shouldConvertEscaped] :: Config -> Bool [shouldConvertNullPercentages] :: Config -> Bool [shouldRemoveEmptyBlocks] :: Config -> Bool [shouldRemoveDuplicateSelectors] :: Config -> Bool [shouldNormalizeQuotes] :: Config -> Bool [letterCase] :: Config -> LetterCase [selectorSorting] :: Config -> SortingMethod [declarationSorting] :: Config -> SortingMethod [rulesMergeSettings] :: Config -> RulesMergeSettings data ColorSettings ColorMinOff :: ColorSettings ColorMinOn :: ColorSettings data DimensionSettings DimMinOff :: DimensionSettings DimMinOn :: DimensionSettings data GradientSettings GradientMinOff :: GradientSettings GradientMinOn :: GradientSettings data FontWeightSettings FontWeightMinOff :: FontWeightSettings FontWeightMinOn :: FontWeightSettings data LetterCase -- | Leave letter casing as is. Original :: LetterCase -- | Lowercase whatever possible to improve gzip compression. Lowercase :: LetterCase data SortingMethod NoSorting :: SortingMethod Lexicographical :: SortingMethod -- | A default config with most settings enabled. Used by the minify -- function, mainly for testing purposes. defaultConfig :: Config data RulesMergeSettings MergeRulesOn :: RulesMergeSettings MergeRulesOff :: RulesMergeSettings instance GHC.Show.Show Hasmin.Config.Config instance GHC.Classes.Eq Hasmin.Config.RulesMergeSettings instance GHC.Show.Show Hasmin.Config.RulesMergeSettings instance GHC.Classes.Eq Hasmin.Config.FontWeightSettings instance GHC.Show.Show Hasmin.Config.FontWeightSettings instance GHC.Classes.Eq Hasmin.Config.SortingMethod instance GHC.Show.Show Hasmin.Config.SortingMethod instance GHC.Classes.Eq Hasmin.Config.LetterCase instance GHC.Show.Show Hasmin.Config.LetterCase instance GHC.Classes.Eq Hasmin.Config.GradientSettings instance GHC.Show.Show Hasmin.Config.GradientSettings instance GHC.Classes.Eq Hasmin.Config.DimensionSettings instance GHC.Show.Show Hasmin.Config.DimensionSettings instance GHC.Classes.Eq Hasmin.Config.ColorSettings instance GHC.Show.Show Hasmin.Config.ColorSettings module Hasmin.Class -- | Class for types that can be converted to Text. Used for printing the -- minified results. class ToText a toText :: ToText a => a -> Text toBuilder :: ToText a => a -> Builder -- | Class for types that can be minified class Minifiable a minify :: Minifiable a => a -> Reader Config a instance Hasmin.Class.ToText GHC.Word.Word8 instance Hasmin.Class.ToText GHC.Types.Int instance Hasmin.Class.ToText Data.Text.Internal.Text instance (Hasmin.Class.ToText a, Hasmin.Class.ToText b) => Hasmin.Class.ToText (Data.Either.Either a b) -- | Parsers for very basic CSS grammar tokens. module Hasmin.Parser.Primitives ident :: Parser Text escape :: Parser Builder unicode :: Parser Builder nmstart :: Parser Builder nmchar :: Parser Builder -- | Parser for <integer>: [+|-][0-9]+ int :: Parser Int -- | <integer> data type parser, but into a String instead of an Int, -- for other parsers to use (e.g.: see the parsers int, or rational) int' :: Parser String -- | Parser one or more digits. digits :: Parser String module Hasmin.Types.RepeatStyle -- | CSS <repeat-style> data type, used in the properties -- background-repeat and background. data RepeatStyle RepeatX :: RepeatStyle RepeatY :: RepeatStyle RepeatStyle1 :: RSKeyword -> RepeatStyle RepeatStyle2 :: RSKeyword -> RSKeyword -> RepeatStyle data RSKeyword RsRepeat :: RSKeyword RsSpace :: RSKeyword RsRound :: RSKeyword RsNoRepeat :: RSKeyword instance GHC.Show.Show Hasmin.Types.RepeatStyle.RepeatStyle instance GHC.Enum.Bounded Hasmin.Types.RepeatStyle.RSKeyword instance GHC.Enum.Enum Hasmin.Types.RepeatStyle.RSKeyword instance GHC.Classes.Eq Hasmin.Types.RepeatStyle.RSKeyword instance GHC.Show.Show Hasmin.Types.RepeatStyle.RSKeyword instance Hasmin.Class.ToText Hasmin.Types.RepeatStyle.RepeatStyle instance Hasmin.Class.Minifiable Hasmin.Types.RepeatStyle.RepeatStyle instance GHC.Classes.Eq Hasmin.Types.RepeatStyle.RepeatStyle instance Hasmin.Class.ToText Hasmin.Types.RepeatStyle.RSKeyword module Hasmin.Types.String removeQuotes :: StringType -> Either Text StringType unquoteUrl :: StringType -> Either Text StringType unquoteFontFamily :: StringType -> Either Text StringType -- | Parse and convert any escaped unicode to its underlying Char. convertEscaped :: Parser Text mapString :: (Text -> Reader Config Text) -> StringType -> Reader Config StringType -- | The <string> data type. It represents a string, formed by -- Unicode characters, delimited by either double (") or single (') -- quotes. data StringType DoubleQuotes :: Text -> StringType SingleQuotes :: Text -> StringType instance GHC.Classes.Eq Hasmin.Types.String.StringType instance GHC.Show.Show Hasmin.Types.String.StringType instance Hasmin.Class.ToText Hasmin.Types.String.StringType instance Hasmin.Class.Minifiable Hasmin.Types.String.StringType -- | Parsers for CSS <string> values. module Hasmin.Parser.String -- | Parse and convert any escaped unicode to its underlying Char. convertEscaped :: Parser Text stringtype :: Parser StringType module Hasmin.Utils epsilon :: Rational eps :: Rational fromLeft' :: Either a b -> a fromRight' :: Either a b -> b mconcatIntersperse :: Monoid b => (a -> b) -> b -> [a] -> b restrict :: Ord a => a -> a -> a -> a textualLength :: ToText a => a -> Int replaceAt :: Int -> a -> [a] -> [a] mzip :: Applicative f => f a -> f b -> f (a, b) reduceTRBL :: Eq a => NonEmpty a -> NonEmpty a -- | CSS Numeric data types: <number>, <percentage>, and -- <alphavalue>. All Rational newtypes to ensure dimension -- conversion precision. module Hasmin.Types.Numeric -- | The <percentage> data type. Many CSS properties can take -- percentage values, often to define sizes in terms of parent objects. -- Percentages are formed by a <number> immediately followed by the -- percentage sign %. There is no space between the % and the -- number. Specification: -- --
    --
  1. <https://drafts.csswg.org/css-values-3/#percentages CSS -- Value and Units Module Level 3 (§4.3)
  2. -- --
  3. <https://www.w3.org/TR/CSS2/syndata.html#percentage-units -- CSS2.1 (§4.3.3)
  4. --
  5. <https://www.w3.org/TR/CSS1/#percentage-units CSS1 -- (§6.2)
  6. --
newtype Percentage Percentage :: Rational -> Percentage toPercentage :: Real a => a -> Percentage -- | The <number> data type. Real numbers, possibly with a fractional -- component. When written literally, a number is either an integer, or -- zero or more decimal digits followed by a dot (.) followed by one or -- more decimal digits and optionally an exponent composed of "e" or -- E and an integer. It corresponds to the <number-token> -- production in the CSS Syntax Module [CSS3SYN]. As with integers, the -- first character of a number may be immediately preceded by - or + to -- indicate the number’s sign. Specifications: -- --
    --
  1. CSS Values and Units Module Level 3 (§4.2)
  2. --
  3. CSS2.1 (§4.3.1)
  4. --
  5. CSS1 (6 Units)
  6. --
newtype Number Number :: Rational -> Number [getRational] :: Number -> Rational toNumber :: Real a => a -> Number fromNumber :: Fractional a => Number -> a -- | The <alphavalue> data type. Syntactically a <number>. It -- is the uniform opacity setting to be applied across an entire object. -- Any values outside the range 0.0 (fully transparent) to 1.0 (fully -- opaque) are clamped to this range. Specification: -- --
    --
  1. <https://www.w3.org/TR/css3-color/#transparency CSS -- Color Module Level 3 (§3.2)
  2. --
newtype Alphavalue Alphavalue :: Rational -> Alphavalue toAlphavalue :: Real a => a -> Alphavalue mkAlphavalue :: Rational -> Alphavalue instance GHC.Real.RealFrac Hasmin.Types.Numeric.Percentage instance GHC.Real.Real Hasmin.Types.Numeric.Percentage instance GHC.Real.Fractional Hasmin.Types.Numeric.Percentage instance GHC.Num.Num Hasmin.Types.Numeric.Percentage instance GHC.Classes.Ord Hasmin.Types.Numeric.Percentage instance GHC.Show.Show Hasmin.Types.Numeric.Percentage instance GHC.Classes.Eq Hasmin.Types.Numeric.Percentage instance GHC.Real.RealFrac Hasmin.Types.Numeric.Alphavalue instance GHC.Real.Real Hasmin.Types.Numeric.Alphavalue instance GHC.Classes.Ord Hasmin.Types.Numeric.Alphavalue instance GHC.Show.Show Hasmin.Types.Numeric.Alphavalue instance GHC.Classes.Eq Hasmin.Types.Numeric.Alphavalue instance GHC.Real.RealFrac Hasmin.Types.Numeric.Number instance GHC.Real.Real Hasmin.Types.Numeric.Number instance GHC.Real.Fractional Hasmin.Types.Numeric.Number instance GHC.Num.Num Hasmin.Types.Numeric.Number instance GHC.Classes.Ord Hasmin.Types.Numeric.Number instance GHC.Show.Show Hasmin.Types.Numeric.Number instance GHC.Classes.Eq Hasmin.Types.Numeric.Number instance Hasmin.Class.ToText Hasmin.Types.Numeric.Percentage instance GHC.Num.Num Hasmin.Types.Numeric.Alphavalue instance Hasmin.Class.ToText Hasmin.Types.Numeric.Alphavalue instance GHC.Enum.Bounded Hasmin.Types.Numeric.Alphavalue instance GHC.Real.Fractional Hasmin.Types.Numeric.Alphavalue instance Hasmin.Class.ToText Hasmin.Types.Numeric.Number module Hasmin.Types.TimingFunction -- | CSS <single-transition-timing-function> data type. data TimingFunction CubicBezier :: Number -> Number -> Number -> Number -> TimingFunction Steps :: Int -> (Maybe StepPosition) -> TimingFunction Ease :: TimingFunction EaseIn :: TimingFunction EaseInOut :: TimingFunction EaseOut :: TimingFunction Linear :: TimingFunction StepEnd :: TimingFunction StepStart :: TimingFunction -- | A step position, as used by the step timing function. data StepPosition Start :: StepPosition End :: StepPosition instance GHC.Show.Show Hasmin.Types.TimingFunction.TimingFunction instance GHC.Enum.Bounded Hasmin.Types.TimingFunction.StepPosition instance GHC.Enum.Enum Hasmin.Types.TimingFunction.StepPosition instance GHC.Classes.Eq Hasmin.Types.TimingFunction.StepPosition instance GHC.Show.Show Hasmin.Types.TimingFunction.StepPosition instance GHC.Classes.Eq Hasmin.Types.TimingFunction.TimingFunction instance Hasmin.Class.ToText Hasmin.Types.TimingFunction.TimingFunction instance Hasmin.Class.Minifiable Hasmin.Types.TimingFunction.TimingFunction instance Hasmin.Class.ToText Hasmin.Types.TimingFunction.StepPosition module Hasmin.Parser.Numeric alphavalue :: Parser Alphavalue -- | Real number parser. <number>: integer | [0-9]*.[0-9]+ rational :: Parser Rational -- | Parser for <integer>: [+|-][0-9]+ int :: Parser Int -- | Parser for <percentage>. percentage :: Parser Percentage -- | Parser for <number>. number :: Parser Number -- | Parsers for <single-timing-function> values. module Hasmin.Parser.TimingFunction -- | Parser for <single-timing-function>. timingFunction :: Parser TimingFunction -- | Parses what's between parenthesis in the "cubic-bezier()" function. cubicbezier :: Parser TimingFunction -- | Parses what's between parenthesis in the "steps()" function. steps :: Parser TimingFunction -- | CSS Dimension data types: <length>, <angle>, <time>, -- <frequency>, and <resolution>. Provides conversion of -- absolute dimensions into other equivalent dimensions. module Hasmin.Types.Dimension -- | The <length> CSS data type data Length Length :: Number -> LengthUnit -> Length NullLength :: Length data LengthUnit IN :: LengthUnit CM :: LengthUnit MM :: LengthUnit PC :: LengthUnit PT :: LengthUnit PX :: LengthUnit Q :: LengthUnit EM :: LengthUnit EX :: LengthUnit CH :: LengthUnit VH :: LengthUnit VW :: LengthUnit VMIN :: LengthUnit VMAX :: LengthUnit REM :: LengthUnit -- | The <angle> CSS data type data Angle Angle :: Number -> AngleUnit -> Angle NullAngle :: Angle data AngleUnit Turn :: AngleUnit Grad :: AngleUnit Rad :: AngleUnit Deg :: AngleUnit -- | The <time> CSS data type data Time Time :: Number -> TimeUnit -> Time data TimeUnit S :: TimeUnit Ms :: TimeUnit -- | The <frequency> CSS data type data Frequency Frequency :: Number -> FrequencyUnit -> Frequency data FrequencyUnit Hz :: FrequencyUnit Khz :: FrequencyUnit -- | The <resolution> CSS data type data Resolution Resolution :: Number -> ResolutionUnit -> Resolution data ResolutionUnit Dpcm :: ResolutionUnit Dppx :: ResolutionUnit Dpi :: ResolutionUnit toInches :: Number -> LengthUnit -> Number toPixels :: Number -> LengthUnit -> Number toRadians :: Number -> AngleUnit -> Number isRelative :: LengthUnit -> Bool isRelativeLength :: Length -> Bool isZeroLen :: Length -> Bool isZeroAngle :: Angle -> Bool instance GHC.Show.Show Hasmin.Types.Dimension.Resolution instance GHC.Enum.Bounded Hasmin.Types.Dimension.ResolutionUnit instance GHC.Enum.Enum Hasmin.Types.Dimension.ResolutionUnit instance GHC.Classes.Eq Hasmin.Types.Dimension.ResolutionUnit instance GHC.Show.Show Hasmin.Types.Dimension.ResolutionUnit instance GHC.Show.Show Hasmin.Types.Dimension.Frequency instance GHC.Enum.Bounded Hasmin.Types.Dimension.FrequencyUnit instance GHC.Enum.Enum Hasmin.Types.Dimension.FrequencyUnit instance GHC.Classes.Eq Hasmin.Types.Dimension.FrequencyUnit instance GHC.Show.Show Hasmin.Types.Dimension.FrequencyUnit instance GHC.Show.Show Hasmin.Types.Dimension.Time instance GHC.Enum.Bounded Hasmin.Types.Dimension.TimeUnit instance GHC.Enum.Enum Hasmin.Types.Dimension.TimeUnit instance GHC.Classes.Eq Hasmin.Types.Dimension.TimeUnit instance GHC.Show.Show Hasmin.Types.Dimension.TimeUnit instance GHC.Show.Show Hasmin.Types.Dimension.Angle instance GHC.Enum.Bounded Hasmin.Types.Dimension.AngleUnit instance GHC.Enum.Enum Hasmin.Types.Dimension.AngleUnit instance GHC.Classes.Eq Hasmin.Types.Dimension.AngleUnit instance GHC.Show.Show Hasmin.Types.Dimension.AngleUnit instance GHC.Show.Show Hasmin.Types.Dimension.Length instance GHC.Enum.Bounded Hasmin.Types.Dimension.LengthUnit instance GHC.Enum.Enum Hasmin.Types.Dimension.LengthUnit instance GHC.Classes.Eq Hasmin.Types.Dimension.LengthUnit instance GHC.Show.Show Hasmin.Types.Dimension.LengthUnit instance GHC.Classes.Eq Hasmin.Types.Dimension.Resolution instance Hasmin.Class.Minifiable Hasmin.Types.Dimension.Resolution instance Hasmin.Class.ToText Hasmin.Types.Dimension.Resolution instance Hasmin.Class.ToText Hasmin.Types.Dimension.ResolutionUnit instance Hasmin.Types.Dimension.Unit Hasmin.Types.Dimension.ResolutionUnit instance GHC.Classes.Eq Hasmin.Types.Dimension.Frequency instance Hasmin.Class.Minifiable Hasmin.Types.Dimension.Frequency instance Hasmin.Class.ToText Hasmin.Types.Dimension.Frequency instance Hasmin.Class.ToText Hasmin.Types.Dimension.FrequencyUnit instance Hasmin.Types.Dimension.Unit Hasmin.Types.Dimension.FrequencyUnit instance GHC.Classes.Eq Hasmin.Types.Dimension.Time instance Hasmin.Class.Minifiable Hasmin.Types.Dimension.Time instance Hasmin.Class.ToText Hasmin.Types.Dimension.Time instance Hasmin.Class.ToText Hasmin.Types.Dimension.TimeUnit instance Hasmin.Types.Dimension.Unit Hasmin.Types.Dimension.TimeUnit instance GHC.Classes.Eq Hasmin.Types.Dimension.Angle instance Hasmin.Class.Minifiable Hasmin.Types.Dimension.Angle instance Hasmin.Class.ToText Hasmin.Types.Dimension.Angle instance Hasmin.Class.ToText Hasmin.Types.Dimension.AngleUnit instance Hasmin.Types.Dimension.Unit Hasmin.Types.Dimension.AngleUnit instance GHC.Classes.Eq Hasmin.Types.Dimension.Length instance Hasmin.Class.Minifiable Hasmin.Types.Dimension.Length instance Hasmin.Class.ToText Hasmin.Types.Dimension.Length instance Hasmin.Class.ToText Hasmin.Types.Dimension.LengthUnit instance Hasmin.Types.Dimension.Unit Hasmin.Types.Dimension.LengthUnit module Hasmin.Types.PercentageLength -- | CSS length-percentage data type, i.e.: [length | percentage] -- Though because of the name it would be more intuitive to define: type -- LengthPercentage = Either Length Percentage, they are inverted here to -- make use of Either's Functor instance, because it makes no sense to -- minify a Percentage. type PercentageLength = Either Percentage Length isZero :: (Num a, Eq a) => Either a Length -> Bool isNonZeroPercentage :: PercentageLength -> Bool minifyPL :: PercentageLength -> Reader Config PercentageLength module Hasmin.Types.TransformFunction -- | CSS <transform-function> data type. data TransformFunction Mat :: (Matrix Number) -> TransformFunction Mat3d :: (Matrix Number) -> TransformFunction Perspective :: Length -> TransformFunction Rotate :: Angle -> TransformFunction RotateX :: Angle -> TransformFunction RotateY :: Angle -> TransformFunction RotateZ :: Angle -> TransformFunction Rotate3d :: Number -> Number -> Number -> Angle -> TransformFunction Scale :: Number -> (Maybe Number) -> TransformFunction ScaleX :: Number -> TransformFunction ScaleY :: Number -> TransformFunction ScaleZ :: Number -> TransformFunction Scale3d :: Number -> Number -> Number -> TransformFunction Skew :: Angle -> (Maybe Angle) -> TransformFunction SkewX :: Angle -> TransformFunction SkewY :: Angle -> TransformFunction Translate :: PercentageLength -> (Maybe PercentageLength) -> TransformFunction TranslateX :: PercentageLength -> TransformFunction TranslateY :: PercentageLength -> TransformFunction TranslateZ :: Length -> TransformFunction Translate3d :: PercentageLength -> PercentageLength -> Length -> TransformFunction mkMat :: [Number] -> TransformFunction mkMat3d :: [Number] -> TransformFunction -- | Combines consecutive <transform-functions> whenever -- possible, leaving translate functions that can't be converted to a -- matrix (because they use percentages or relative units) as they are, -- in the position they are in the list (since matrix multiplication -- isn't commutative) Example: -- --
--   >>> import Control.Monad.Reader
--   
--   >>> let t10 = Translate (Right (Length 10 PX)) Nothing
--   
--   >>> let s45 = Skew (Angle 45 Deg) Nothing
--   
--   >>> let sx5 = ScaleX 5
--   
--   >>> let f x = runReader (combine x) defaultConfig
--   
-- --
--   >>> fmap toText $ f [t10, s45, sx5]
--   ["matrix(5,0,1,1,10,0)"]
--   
-- --
--   >>> let tp  = Translate (Left (Percentage 100)) Nothing
--   
--   >>> fmap toText $ f [s45,tp,sx5,sx5,sx5]
--   ["skew(45deg)","translate(100%)","scale(125)"]
--   
combine :: [TransformFunction] -> Reader Config [TransformFunction] -- | Simplifies a <transform-function> without converting it to a 4x4 -- matrix, by doing some simple conversions between the different -- functions, or minifying the dimension arguments (<length> and -- <angle> values) simplify :: TransformFunction -> Reader Config TransformFunction instance GHC.Show.Show Hasmin.Types.TransformFunction.TransformFunction instance GHC.Classes.Eq Hasmin.Types.TransformFunction.TransformFunction instance Hasmin.Class.Minifiable Hasmin.Types.TransformFunction.TransformFunction instance Hasmin.Class.ToText Hasmin.Types.TransformFunction.TransformFunction module Hasmin.Types.Position data Position Position :: Maybe PosKeyword -> Maybe PercentageLength -> Maybe PosKeyword -> Maybe PercentageLength -> Position [origin1] :: Position -> Maybe PosKeyword [offset1] :: Position -> Maybe PercentageLength [origin2] :: Position -> Maybe PosKeyword [offset2] :: Position -> Maybe PercentageLength data PosKeyword PosCenter :: PosKeyword PosLeft :: PosKeyword PosRight :: PosKeyword PosTop :: PosKeyword PosBottom :: PosKeyword minifyPosition :: Position -> Position p50 :: Maybe PercentageLength l0 :: Maybe PercentageLength centerpos :: Position instance GHC.Show.Show Hasmin.Types.Position.Position instance GHC.Enum.Bounded Hasmin.Types.Position.PosKeyword instance GHC.Enum.Enum Hasmin.Types.Position.PosKeyword instance GHC.Classes.Eq Hasmin.Types.Position.PosKeyword instance GHC.Show.Show Hasmin.Types.Position.PosKeyword instance Hasmin.Class.Minifiable Hasmin.Types.Position.Position instance Hasmin.Class.ToText Hasmin.Types.Position.Position instance GHC.Classes.Eq Hasmin.Types.Position.Position instance Hasmin.Class.ToText Hasmin.Types.Position.PosKeyword module Hasmin.Types.BgSize -- | CSS <bg-size> data type, used by the -- background-size and background properties. data BgSize Cover :: BgSize Contain :: BgSize BgSize1 :: (Either PercentageLength Auto) -> BgSize BgSize2 :: (Either PercentageLength Auto) -> (Either PercentageLength Auto) -> BgSize -- | The CSS auto keyword. data Auto Auto :: Auto instance GHC.Show.Show Hasmin.Types.BgSize.BgSize instance GHC.Show.Show Hasmin.Types.BgSize.Auto instance GHC.Classes.Eq Hasmin.Types.BgSize.Auto instance GHC.Classes.Eq Hasmin.Types.BgSize.BgSize instance Hasmin.Class.ToText Hasmin.Types.BgSize.BgSize instance Hasmin.Class.Minifiable Hasmin.Types.BgSize.BgSize instance Hasmin.Class.ToText Hasmin.Types.BgSize.Auto -- | Parsers for CSS dimensions, i.e. <length>, <time>, etc. module Hasmin.Parser.Dimension distance :: Parser Length angle :: Parser Angle time :: Parser Time timeConstructorsList :: [(Text, Number -> Time)] angleConstructorsList :: [(Text, Number -> Angle)] distanceConstructorsList :: [(Text, Number -> Length)] dimensionParser :: Map Text (Number -> a) -> a -> Parser a module Hasmin.Parser.PercentageLength percentageLength :: Parser PercentageLength -- | Parsers for CSS values. module Hasmin.Parser.TransformFunction matrix :: Parser TransformFunction matrix3d :: Parser TransformFunction rotate3d :: Parser TransformFunction -- | Parser of scale() function. Assumes "scale(" has been already parsed scale :: Parser TransformFunction scale3d :: Parser TransformFunction skew :: Parser TransformFunction -- | Assumes "translate(" has been already parsed translate :: Parser TransformFunction translate3d :: Parser TransformFunction -- | Parsers for CSS <position> values. module Hasmin.Parser.Position -- | Parser for <position>. position :: Parser Position module Hasmin.Types.Color -- | CSS <color> data type. data Color Named :: Text -> Color mkHex3 :: Char -> Char -> Char -> Color mkHex4 :: Char -> Char -> Char -> Char -> Color mkHex6 :: String -> String -> String -> Color mkHex8 :: String -> String -> String -> String -> Color mkNamed :: Text -> Maybe Color mkHSL :: Int -> Percentage -> Percentage -> Color mkHSLA :: Int -> Percentage -> Percentage -> Alphavalue -> Color mkRGBInt :: Word8 -> Word8 -> Word8 -> Color mkRGBPer :: Percentage -> Percentage -> Percentage -> Color mkRGBAInt :: Word8 -> Word8 -> Word8 -> Alphavalue -> Color mkRGBAPer :: Percentage -> Percentage -> Percentage -> Alphavalue -> Color -- | Pairs of color keywords, and their equivalent hexadecimal value. keywordColors :: [(Text, Color)] minifyColor :: Color -> Color instance GHC.Show.Show Hasmin.Types.Color.Color instance GHC.Classes.Eq Hasmin.Types.Color.Color instance GHC.Classes.Ord Hasmin.Types.Color.Color instance Hasmin.Class.Minifiable Hasmin.Types.Color.Color instance Hasmin.Class.ToText Hasmin.Types.Color.Color module Hasmin.Types.FilterFunction -- | CSS <filter-function> data type. data FilterFunction Blur :: Length -> FilterFunction Brightness :: Amount -> FilterFunction Contrast :: Amount -> FilterFunction Grayscale :: Amount -> FilterFunction Invert :: Amount -> FilterFunction Opacity :: Amount -> FilterFunction Saturate :: Amount -> FilterFunction Sepia :: Amount -> FilterFunction HueRotate :: Angle -> FilterFunction DropShadow :: Length -> Length -> (Maybe Length) -> (Maybe Color) -> FilterFunction minifyPseudoShadow :: (Minifiable b, Minifiable t1, Minifiable t2, Traversable t) => (t2 -> t1 -> Maybe Length -> t b -> b1) -> t2 -> t1 -> Maybe Length -> t b -> Reader Config b1 instance GHC.Show.Show Hasmin.Types.FilterFunction.FilterFunction instance GHC.Classes.Eq Hasmin.Types.FilterFunction.FilterFunction instance Hasmin.Class.ToText Hasmin.Types.FilterFunction.FilterFunction instance Hasmin.Class.Minifiable Hasmin.Types.FilterFunction.FilterFunction -- | Parsers for CSS <color> values. module Hasmin.Parser.Color hex :: Parser Color rgb :: Parser Color rgba :: Parser Color hsl :: Parser Color hsla :: Parser Color -- | Parser for <color>. color :: Parser Color namedColorsParsersMap :: Map Text (Parser Color) colorFunctionsParsers :: [(Text, Parser Color)] functionPar :: Map Text (Parser a) -> Text -> Parser a colorFunctionParser :: Text -> Parser Color module Hasmin.Types.BorderRadius data BorderRadius BorderRadius :: (NonEmpty PercentageLength) -> [PercentageLength] -> BorderRadius isZeroBR :: BorderRadius -> Bool instance GHC.Show.Show Hasmin.Types.BorderRadius.BorderRadius instance GHC.Classes.Eq Hasmin.Types.BorderRadius.BorderRadius instance Hasmin.Class.Minifiable Hasmin.Types.BorderRadius.BorderRadius instance Hasmin.Class.ToText Hasmin.Types.BorderRadius.BorderRadius -- | Parsers for CSS values. module Hasmin.Parser.BorderRadius borderRadius :: Parser BorderRadius module Hasmin.Types.BasicShape -- | CSS <basic-shape> data type. data BasicShape Inset :: (NonEmpty ShapeArg) -> (Maybe BorderRadius) -> BasicShape Circle :: (Maybe ShapeRadius) -> (Maybe Position) -> BasicShape Ellipse :: (AtMost2 ShapeRadius) -> (Maybe Position) -> BasicShape Polygon :: (Maybe FillRule) -> (NonEmpty (ShapeArg, ShapeArg)) -> BasicShape data ShapeRadius SRLength :: Length -> ShapeRadius SRPercentage :: Percentage -> ShapeRadius SRClosestSide :: ShapeRadius SRFarthestSide :: ShapeRadius data AtMost2 a None :: AtMost2 a One :: a -> AtMost2 a Two :: a -> a -> AtMost2 a data FillRule NonZero :: FillRule EvenOdd :: FillRule instance GHC.Show.Show Hasmin.Types.BasicShape.BasicShape instance Data.Traversable.Traversable Hasmin.Types.BasicShape.AtMost2 instance Data.Foldable.Foldable Hasmin.Types.BasicShape.AtMost2 instance GHC.Base.Functor Hasmin.Types.BasicShape.AtMost2 instance GHC.Classes.Eq Hasmin.Types.BasicShape.FillRule instance GHC.Show.Show Hasmin.Types.BasicShape.FillRule instance GHC.Classes.Eq Hasmin.Types.BasicShape.ShapeRadius instance GHC.Show.Show Hasmin.Types.BasicShape.ShapeRadius instance GHC.Show.Show a => GHC.Show.Show (Hasmin.Types.BasicShape.AtMost2 a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Hasmin.Types.BasicShape.AtMost2 a) instance GHC.Classes.Eq Hasmin.Types.BasicShape.BasicShape instance Hasmin.Class.Minifiable Hasmin.Types.BasicShape.BasicShape instance Hasmin.Class.ToText Hasmin.Types.BasicShape.BasicShape instance Hasmin.Class.ToText Hasmin.Types.BasicShape.FillRule instance Hasmin.Class.ToText Hasmin.Types.BasicShape.ShapeRadius module Hasmin.Types.Value -- | A CSS value. data Value Inherit :: Value Initial :: Value Unset :: Value NumberV :: Number -> Value PercentageV :: Percentage -> Value LengthV :: Length -> Value AngleV :: Angle -> Value TimeV :: Time -> Value FrequencyV :: Frequency -> Value ResolutionV :: Resolution -> Value ColorV :: Color -> Value GradientV :: Text -> Gradient -> Value GenericFunc :: Text -> Values -> Value TransformV :: TransformFunction -> Value TimingFuncV :: TimingFunction -> Value FilterV :: FilterFunction -> Value ShadowV :: Shadow -> Value ShadowText :: Length -> Length -> (Maybe Length) -> (Maybe Color) -> Value PositionV :: Position -> Value RepeatStyleV :: RepeatStyle -> Value BorderRadiusV :: BorderRadius -> Value BasicShapeV :: BasicShape -> Value BgSizeV :: BgSize -> Value BgLayer :: Maybe Value -> Maybe Position -> Maybe BgSize -> Maybe RepeatStyle -> Maybe TextV -> Maybe TextV -> Maybe TextV -> Value [_bgimage] :: Value -> Maybe Value [_bgposition] :: Value -> Maybe Position [_bgsize] :: Value -> Maybe BgSize [_bgrepeat] :: Value -> Maybe RepeatStyle [_bgattachment] :: Value -> Maybe TextV [_bgbox1] :: Value -> Maybe TextV [_bgbox2] :: Value -> Maybe TextV FinalBgLayer :: (Maybe Value) -> (Maybe Position) -> (Maybe BgSize) -> (Maybe RepeatStyle) -> (Maybe TextV) -> (Maybe TextV) -> (Maybe TextV) -> (Maybe Color) -> Value SingleTransition :: Maybe TextV -> Maybe Time -> Maybe TimingFunction -> Maybe Time -> Value [_transitionproperty] :: Value -> Maybe TextV [_time1] :: Value -> Maybe Time [_transitiontimingfunction] :: Value -> Maybe TimingFunction [_time2] :: Value -> Maybe Time SingleAnimation :: (Maybe Time) -> (Maybe TimingFunction) -> (Maybe Time) -> (Maybe Value) -> (Maybe TextV) -> (Maybe TextV) -> (Maybe TextV) -> (Maybe Value) -> Value FontV :: (Maybe TextV) -> (Maybe TextV) -> (Maybe Value) -> (Maybe TextV) -> Value -> (Maybe Value) -> [Value] -> Value StringV :: StringType -> Value UrlV :: Url -> Value Format :: [StringType] -> Value Local :: (Either Text StringType) -> Value Rect :: Length -> Length -> Length -> Length -> Value -- | Unrecognized text Other :: TextV -> Value data Values Values :: Value -> [(Separator, Value)] -> Values -- | Redefines equality to be case-insensitive, since CSS literal values -- such as "auto", "none", etc. are so. newtype TextV TextV :: Text -> TextV [getText] :: TextV -> Text -- | A value separator. data Separator Space :: Separator Slash :: Separator Comma :: Separator newtype Url Url :: (Either Text StringType) -> Url mkOther :: Text -> Value mkValues :: [Value] -> Values valuesToList :: Values -> [Value] optimizeFontFamily :: Value -> Reader Config Value lowercaseText :: Text -> Reader Config Text instance GHC.Show.Show Hasmin.Types.Value.Value instance GHC.Classes.Eq Hasmin.Types.Value.Value instance GHC.Classes.Eq Hasmin.Types.Value.Values instance GHC.Show.Show Hasmin.Types.Value.Values instance GHC.Classes.Eq Hasmin.Types.Value.Separator instance GHC.Show.Show Hasmin.Types.Value.Separator instance GHC.Show.Show Hasmin.Types.Value.Url instance GHC.Classes.Eq Hasmin.Types.Value.Url instance Data.String.IsString Hasmin.Types.Value.TextV instance GHC.Classes.Ord Hasmin.Types.Value.TextV instance GHC.Show.Show Hasmin.Types.Value.TextV instance Hasmin.Class.ToText Hasmin.Types.Value.Value instance Hasmin.Class.Minifiable Hasmin.Types.Value.Value instance Hasmin.Class.ToText Hasmin.Types.Value.Values instance Hasmin.Class.Minifiable Hasmin.Types.Value.Values instance Hasmin.Class.ToText Hasmin.Types.Value.Separator instance Hasmin.Class.ToText Hasmin.Types.Value.Url instance Hasmin.Class.Minifiable Hasmin.Types.Value.Url instance GHC.Classes.Eq Hasmin.Types.Value.TextV instance Hasmin.Class.ToText Hasmin.Types.Value.TextV module Hasmin.Parser.Selector -- | Parse a list of comma-separated selectors, ignoring whitespace and -- comments. selectors :: Parser [Selector] -- | Parser for CSS complex selectors (see Selector for more -- details). selector :: Parser Selector -- | Parsers for CSS <gradient> values. module Hasmin.Parser.Gradient radialgradient :: Parser Gradient -- | Assumes "linear-gradient(", or one of its prefixed equivalents, has -- been parsed. : [angle|to side-or-corner ,]? -- color-stop [, color-stop]+ lineargradient :: Parser Gradient sideOrCorner :: Parser (Side, Maybe Side) colorStopList :: Parser [ColorStop] colorStop :: Parser ColorStop -- | Parsers for CSS <basic-shape> values. module Hasmin.Parser.BasicShape inset :: Parser BasicShape circle :: Parser BasicShape ellipse :: Parser BasicShape polygon :: Parser BasicShape shapeRadius :: Parser ShapeRadius -- | Parsers for CSS values. module Hasmin.Parser.Value -- | Given a propery name, it returns a specific parser of values for that -- property. Fails if no specific parser is found. valuesFor :: Text -> Parser Values -- | For cases when CSS hacks are used, e.g.: margin-top: 1px \9;. valuesFallback :: Parser Values value :: Parser Value valuesInParens :: Parser Values stringOrUrl :: Parser (Either StringType Url) -- | Parser for <percentage>. percentage :: Parser Percentage -- | Parser for <url>. Assumes "url(" has already -- been parsed. url :: Parser Url stringtype :: Parser StringType stringvalue :: Parser Value -- | Parser for <shadow> values, used in the -- box-shadow property. shadowList :: Parser Values -- | Parser for <single-timing-function>. timingFunction :: Parser TimingFunction -- | Parser for <repeat-style>, used in -- background-repeat and background. repeatStyle :: Parser RepeatStyle -- | Parser for <position>. position :: Parser Position -- | Parser for <color>. color :: Parser Color -- | Parser for <number>. number :: Parser Number -- | Parser for <font-style>, used in the font-style -- and font properties. fontStyle :: Parser Value textualvalue :: Parser Value borderRadius :: Parser BorderRadius instance GHC.Show.Show Hasmin.Parser.Value.FontProperty instance GHC.Classes.Eq Hasmin.Parser.Value.FontProperty module Hasmin.Types.Declaration -- | A CSS <declaration>. data Declaration Declaration :: Text -> Values -> Bool -> Bool -> Declaration -- | Property name of the declaration. [propertyName] :: Declaration -> Text -- | Values used in the declaration. [valueList] :: Declaration -> Values -- | Whether the declaration is "!important" (i.e. ends with it). [isImportant] :: Declaration -> Bool -- | Whether the declaration ends with the "\9" IE hack. [hasIEhack] :: Declaration -> Bool -- | Removes longhand rules overwritten by their shorthand further down in -- the declaration list, and merges shorthand declarations with longhand -- properties later declared. clean :: [Declaration] -> [Declaration] instance GHC.Show.Show Hasmin.Types.Declaration.Declaration instance GHC.Classes.Eq Hasmin.Types.Declaration.Declaration instance Hasmin.Class.ToText Hasmin.Types.Declaration.Declaration instance GHC.Classes.Ord Hasmin.Types.Declaration.Declaration instance Hasmin.Class.Minifiable Hasmin.Types.Declaration.Declaration module Hasmin.Types.Stylesheet data Expression Expression :: Text -> (Maybe Value) -> Expression InvalidExpression :: Text -> Expression -- | Data type for media queries. For the syntax, see media query -- syntax. data MediaQuery -- | First possibility in the grammar MediaQuery1 :: Text -> Text -> [Expression] -> MediaQuery -- | Second possibility in the grammar MediaQuery2 :: [Expression] -> MediaQuery -- | A CSS rule, either a normal style rule, or one of the many possible -- at-rules. data Rule AtCharset :: StringType -> Rule AtImport :: (Either StringType Url) -> [MediaQuery] -> Rule AtNamespace :: Text -> (Either StringType Url) -> Rule AtMedia :: [MediaQuery] -> [Rule] -> Rule AtKeyframes :: VendorPrefix -> Text -> [KeyframeBlock] -> Rule AtSupports :: SupportsCondition -> [Rule] -> Rule AtBlockWithRules :: Text -> [Rule] -> Rule AtBlockWithDec :: Text -> [Declaration] -> Rule StyleRule :: [Selector] -> [Declaration] -> Rule data KeyframeSelector From :: KeyframeSelector To :: KeyframeSelector KFPercentage :: Percentage -> KeyframeSelector data KeyframeBlock KeyframeBlock :: [KeyframeSelector] -> [Declaration] -> KeyframeBlock data SupportsCondition Not :: SupportsCondInParens -> SupportsCondition And :: SupportsCondInParens -> (NonEmpty SupportsCondInParens) -> SupportsCondition Or :: SupportsCondInParens -> (NonEmpty SupportsCondInParens) -> SupportsCondition Parens :: SupportsCondInParens -> SupportsCondition data SupportsCondInParens ParensCond :: SupportsCondition -> SupportsCondInParens ParensDec :: Declaration -> SupportsCondInParens minifyRules :: [Rule] -> Reader Config [Rule] -- | Given a list of declarations, gathers the longhands, and if every -- longhand of a given shorthand is present, "collapses" them into the -- shorthand (i.e. replaces all the declarations for an equivalent -- shorthand). collapse :: [Declaration] -> [Declaration] mergeRules :: [Rule] -> [Rule] instance GHC.Show.Show Hasmin.Types.Stylesheet.Rule instance GHC.Classes.Eq Hasmin.Types.Stylesheet.Rule instance GHC.Show.Show Hasmin.Types.Stylesheet.SupportsCondition instance GHC.Classes.Eq Hasmin.Types.Stylesheet.SupportsCondition instance GHC.Show.Show Hasmin.Types.Stylesheet.SupportsCondInParens instance GHC.Classes.Eq Hasmin.Types.Stylesheet.SupportsCondInParens instance GHC.Show.Show Hasmin.Types.Stylesheet.KeyframeBlock instance GHC.Classes.Eq Hasmin.Types.Stylesheet.KeyframeBlock instance GHC.Show.Show Hasmin.Types.Stylesheet.KeyframeSelector instance GHC.Classes.Eq Hasmin.Types.Stylesheet.KeyframeSelector instance GHC.Classes.Eq Hasmin.Types.Stylesheet.MediaQuery instance GHC.Show.Show Hasmin.Types.Stylesheet.MediaQuery instance GHC.Classes.Eq Hasmin.Types.Stylesheet.Expression instance GHC.Show.Show Hasmin.Types.Stylesheet.Expression instance Hasmin.Class.ToText Hasmin.Types.Stylesheet.Rule instance Hasmin.Class.Minifiable Hasmin.Types.Stylesheet.Rule instance Hasmin.Class.Minifiable [Hasmin.Types.Stylesheet.Rule] instance Hasmin.Class.ToText Hasmin.Types.Stylesheet.SupportsCondition instance Hasmin.Class.Minifiable Hasmin.Types.Stylesheet.SupportsCondition instance Hasmin.Class.ToText Hasmin.Types.Stylesheet.SupportsCondInParens instance Hasmin.Class.Minifiable Hasmin.Types.Stylesheet.SupportsCondInParens instance Hasmin.Class.ToText Hasmin.Types.Stylesheet.KeyframeBlock instance Hasmin.Class.Minifiable Hasmin.Types.Stylesheet.KeyframeBlock instance Hasmin.Class.ToText Hasmin.Types.Stylesheet.KeyframeSelector instance Hasmin.Class.Minifiable Hasmin.Types.Stylesheet.KeyframeSelector instance Hasmin.Class.Minifiable Hasmin.Types.Stylesheet.MediaQuery instance Hasmin.Class.ToText Hasmin.Types.Stylesheet.MediaQuery instance Hasmin.Class.Minifiable [Hasmin.Types.Stylesheet.MediaQuery] instance Hasmin.Class.Minifiable Hasmin.Types.Stylesheet.Expression instance Hasmin.Class.ToText Hasmin.Types.Stylesheet.Expression module Hasmin.Parser.Internal -- | Parse a stylesheet, starting by the @charset, @import and @namespace -- rules, followed by the list of rules, and ignoring any unneeded -- whitespace and comments. stylesheet :: Parser [Rule] -- | Parser for CSS at-rules (e.g. @keyframes, @media) atRule :: Parser Rule atMedia :: Parser Rule -- | Parses a CSS style rule, e.g. body { padding: 0; } styleRule :: Parser Rule -- | Parser for a CSS rule, which can be either an at-rule (e.g. @charset), -- or a style rule. rule :: Parser Rule -- | Parser for CSS rules (both style rules, and at-rules), which can be -- separated by whitespace or comments. rules :: Parser [Rule] -- | Parser for a declaration, starting by the property name. declaration :: Parser Declaration -- | Parser for a list of declarations, ignoring spaces, comments, and -- empty declarations (e.g. ; ;) declarations :: Parser [Declaration] -- | Parser for CSS complex selectors (see Selector for more -- details). selector :: Parser Selector -- | Parser for a supports_condition, needed by @supports -- rules. supportsCondition :: Parser SupportsCondition -- | Recommended module to use the library. module Hasmin -- | Minify Text CSS, using a default set of configurations (with -- most minification techniques enabled). minifyCSS is equivalent -- to minifyCSSWith defaultConfig. minifyCSS :: Text -> Either String Text -- | Minify Text, based on a Config. To just use a default set of -- configurations (i.e. defaultConfig), use minifyCSS. minifyCSSWith :: Config -> Text -> Either String Text