shakespeare-2.1.0.1: A toolkit for making compile-time interpolated templates

Safe Haskell | Safe-Inferred
Language | Haskell2010

Text.Cassius

Contents

- Datatypes
- Type class
- Rendering
- Parsing
  - Mixims
- ToCss instances
  - Color
  - Size
- Internal

Synopsis

- data Css
- type CssUrl url = (url -> [(Text, Text)] -> Text) -> Css
- class ToCss a where
  - toCss :: a -> Builder
- renderCss :: Css -> Text
- renderCssUrl :: (url -> [(Text, Text)] -> Text) -> CssUrl url -> Text
- cassius :: QuasiQuoter
- cassiusFile :: FilePath -> Q Exp
- cassiusFileDebug :: FilePath -> Q Exp
- cassiusFileReload :: FilePath -> Q Exp
- cassiusMixin :: QuasiQuoter
- data Mixin
- data Color = Color Word8 Word8 Word8
- colorRed :: Color
- colorBlack :: Color
- mkSize :: String -> ExpQ
- data AbsoluteUnit
  - = Centimeter
  - | Inch
  - | Millimeter
  - | Pica
  - | Point
- data AbsoluteSize = AbsoluteSize {
  - absoluteSizeUnit :: AbsoluteUnit
  - absoluteSizeValue :: Rational
  }
- absoluteSize :: AbsoluteUnit -> Rational -> AbsoluteSize
- data EmSize = EmSize Rational
- data ExSize = ExSize Rational
- data PercentageSize = PercentageSize {
  - percentageSizeValue :: Rational
  }
- percentageSize :: Rational -> PercentageSize
- data PixelSize = PixelSize Rational
- cassiusUsedIdentifiers :: String -> [(Deref, VarType)]

# Datatypes

data Css #

type CssUrl url = (url -> [(Text, Text)] -> Text) -> Css #

# Type class

class ToCss a where #

Methods

toCss :: a -> Builder #

#### Instances

Instances details

ToCss AbsoluteSize # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: AbsoluteSize -> Builder #
ToCss Color # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: Color -> Builder #
ToCss EmSize # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: EmSize -> Builder #
ToCss ExSize # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: ExSize -> Builder #
ToCss PercentageSize # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: PercentageSize -> Builder #
ToCss PixelSize # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: PixelSize -> Builder #
ToCss Text # |
Instance details Defined in Text.Internal.Css Methods toCss :: Text -> Builder #
ToCss Text # |
Instance details Defined in Text.Internal.Css Methods toCss :: Text -> Builder #
ToCss [Char] # |
Instance details Defined in Text.Internal.Css Methods toCss :: [Char] -> Builder #

# Rendering

renderCss :: Css -> Text #

renderCssUrl :: (url -> [(Text, Text)] -> Text) -> CssUrl url -> Text #

# Parsing

cassius :: QuasiQuoter #

cassiusFile :: FilePath -> Q Exp #

cassiusFileDebug :: FilePath -> Q Exp #

cassiusFileReload :: FilePath -> Q Exp #

## Mixims

cassiusMixin :: QuasiQuoter #

Create a mixin with Cassius syntax.

Since 2.0.3

data Mixin #

#### Instances

Instances details

Monoid Mixin # |
Instance details Defined in Text.Internal.Css Methods mempty :: Mixin mappend :: Mixin -> Mixin -> Mixin mconcat :: [Mixin] -> Mixin
Semigroup Mixin # |
Instance details Defined in Text.Internal.Css Methods (<>) :: Mixin -> Mixin -> Mixin sconcat :: NonEmpty Mixin -> Mixin stimes :: Integral b => b -> Mixin -> Mixin
Lift Mixin # |
Instance details Defined in Text.Internal.Css Methods lift :: Quote m => Mixin -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Mixin -> Code m Mixin #

# ToCss instances

## Color

data Color #

Constructors

Color Word8 Word8 Word8 |

#### Instances

Instances details

Show Color # |
Instance details Defined in Text.Internal.CssCommon Methods showsPrec :: Int -> Color -> ShowS show :: Color -> String showList :: [Color] -> ShowS
ToCss Color # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: Color -> Builder #

colorRed :: Color #

colorBlack :: Color #

## Size

mkSize :: String -> ExpQ #

Create a CSS size, e.g. $(mkSize "100px").

data AbsoluteUnit #

Absolute size units.

Constructors

Centimeter |
Inch |
Millimeter |
Pica |
Point |

#### Instances

Instances details

Show AbsoluteUnit # |
Instance details Defined in Text.Internal.CssCommon Methods showsPrec :: Int -> AbsoluteUnit -> ShowS show :: AbsoluteUnit -> String showList :: [AbsoluteUnit] -> ShowS
Eq AbsoluteUnit # |
Instance details Defined in Text.Internal.CssCommon Methods (==) :: AbsoluteUnit -> AbsoluteUnit -> Bool (/=) :: AbsoluteUnit -> AbsoluteUnit -> Bool

data AbsoluteSize #

Not intended for direct use, see `mkSize`.

Constructors

AbsoluteSize |

Fields

- absoluteSizeUnit :: AbsoluteUnit

  Units used for text formatting.

- absoluteSizeValue :: Rational

  Normalized value in centimeters.

#### Instances

Instances details

Num AbsoluteSize # |
Instance details Defined in Text.Internal.CssCommon Methods (+) :: AbsoluteSize -> AbsoluteSize -> AbsoluteSize (-) :: AbsoluteSize -> AbsoluteSize -> AbsoluteSize (*) :: AbsoluteSize -> AbsoluteSize -> AbsoluteSize negate :: AbsoluteSize -> AbsoluteSize abs :: AbsoluteSize -> AbsoluteSize signum :: AbsoluteSize -> AbsoluteSize fromInteger :: Integer -> AbsoluteSize
Fractional AbsoluteSize # |
Instance details Defined in Text.Internal.CssCommon Methods (/) :: AbsoluteSize -> AbsoluteSize -> AbsoluteSize recip :: AbsoluteSize -> AbsoluteSize fromRational :: Rational -> AbsoluteSize
Show AbsoluteSize # |
Instance details Defined in Text.Internal.CssCommon Methods showsPrec :: Int -> AbsoluteSize -> ShowS show :: AbsoluteSize -> String showList :: [AbsoluteSize] -> ShowS
Eq AbsoluteSize # |
Instance details Defined in Text.Internal.CssCommon Methods (==) :: AbsoluteSize -> AbsoluteSize -> Bool (/=) :: AbsoluteSize -> AbsoluteSize -> Bool
Ord AbsoluteSize # |
Instance details Defined in Text.Internal.CssCommon Methods compare :: AbsoluteSize -> AbsoluteSize -> Ordering (<) :: AbsoluteSize -> AbsoluteSize -> Bool (<=) :: AbsoluteSize -> AbsoluteSize -> Bool (>) :: AbsoluteSize -> AbsoluteSize -> Bool (>=) :: AbsoluteSize -> AbsoluteSize -> Bool max :: AbsoluteSize -> AbsoluteSize -> AbsoluteSize min :: AbsoluteSize -> AbsoluteSize -> AbsoluteSize
ToCss AbsoluteSize # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: AbsoluteSize -> Builder #

absoluteSize :: AbsoluteUnit -> Rational -> AbsoluteSize #

Constructs `AbsoluteSize`. Not intended for direct use, see `mkSize`.

data EmSize #

Constructors

EmSize Rational |

#### Instances

Instances details

Num EmSize # |
Instance details Defined in Text.Internal.CssCommon Methods (+) :: EmSize -> EmSize -> EmSize (-) :: EmSize -> EmSize -> EmSize (*) :: EmSize -> EmSize -> EmSize negate :: EmSize -> EmSize abs :: EmSize -> EmSize signum :: EmSize -> EmSize fromInteger :: Integer -> EmSize
Fractional EmSize # |
Instance details Defined in Text.Internal.CssCommon Methods (/) :: EmSize -> EmSize -> EmSize recip :: EmSize -> EmSize fromRational :: Rational -> EmSize
Show EmSize # |
Instance details Defined in Text.Internal.CssCommon Methods showsPrec :: Int -> EmSize -> ShowS show :: EmSize -> String showList :: [EmSize] -> ShowS
Eq EmSize # |
Instance details Defined in Text.Internal.CssCommon Methods (==) :: EmSize -> EmSize -> Bool (/=) :: EmSize -> EmSize -> Bool
Ord EmSize # |
Instance details Defined in Text.Internal.CssCommon Methods compare :: EmSize -> EmSize -> Ordering (<) :: EmSize -> EmSize -> Bool (<=) :: EmSize -> EmSize -> Bool (>) :: EmSize -> EmSize -> Bool (>=) :: EmSize -> EmSize -> Bool max :: EmSize -> EmSize -> EmSize min :: EmSize -> EmSize -> EmSize
ToCss EmSize # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: EmSize -> Builder #

data ExSize #

Constructors

ExSize Rational |

#### Instances

Instances details

Num ExSize # |
Instance details Defined in Text.Internal.CssCommon Methods (+) :: ExSize -> ExSize -> ExSize (-) :: ExSize -> ExSize -> ExSize (*) :: ExSize -> ExSize -> ExSize negate :: ExSize -> ExSize abs :: ExSize -> ExSize signum :: ExSize -> ExSize fromInteger :: Integer -> ExSize
Fractional ExSize # |
Instance details Defined in Text.Internal.CssCommon Methods (/) :: ExSize -> ExSize -> ExSize recip :: ExSize -> ExSize fromRational :: Rational -> ExSize
Show ExSize # |
Instance details Defined in Text.Internal.CssCommon Methods showsPrec :: Int -> ExSize -> ShowS show :: ExSize -> String showList :: [ExSize] -> ShowS
Eq ExSize # |
Instance details Defined in Text.Internal.CssCommon Methods (==) :: ExSize -> ExSize -> Bool (/=) :: ExSize -> ExSize -> Bool
Ord ExSize # |
Instance details Defined in Text.Internal.CssCommon Methods compare :: ExSize -> ExSize -> Ordering (<) :: ExSize -> ExSize -> Bool (<=) :: ExSize -> ExSize -> Bool (>) :: ExSize -> ExSize -> Bool (>=) :: ExSize -> ExSize -> Bool max :: ExSize -> ExSize -> ExSize min :: ExSize -> ExSize -> ExSize
ToCss ExSize # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: ExSize -> Builder #

data PercentageSize #

Not intended for direct use, see `mkSize`.

Constructors

PercentageSize |

Fields

- percentageSizeValue :: Rational

  Normalized value, 1 == 100%.

#### Instances

Instances details

Num PercentageSize # |
Instance details Defined in Text.Internal.CssCommon Methods (+) :: PercentageSize -> PercentageSize -> PercentageSize (-) :: PercentageSize -> PercentageSize -> PercentageSize (*) :: PercentageSize -> PercentageSize -> PercentageSize negate :: PercentageSize -> PercentageSize abs :: PercentageSize -> PercentageSize signum :: PercentageSize -> PercentageSize fromInteger :: Integer -> PercentageSize
Fractional PercentageSize # |
Instance details Defined in Text.Internal.CssCommon Methods (/) :: PercentageSize -> PercentageSize -> PercentageSize recip :: PercentageSize -> PercentageSize fromRational :: Rational -> PercentageSize
Show PercentageSize # |
Instance details Defined in Text.Internal.CssCommon Methods showsPrec :: Int -> PercentageSize -> ShowS show :: PercentageSize -> String showList :: [PercentageSize] -> ShowS
Eq PercentageSize # |
Instance details Defined in Text.Internal.CssCommon Methods (==) :: PercentageSize -> PercentageSize -> Bool (/=) :: PercentageSize -> PercentageSize -> Bool
Ord PercentageSize # |

Instance details

Defined in Text.Internal.CssCommon

Methods

compare :: PercentageSize -> PercentageSize -> Ordering

(<) :: PercentageSize -> PercentageSize -> Bool

(<=) :: PercentageSize -> PercentageSize -> Bool

(>) :: PercentageSize -> PercentageSize -> Bool

(>=) :: PercentageSize -> PercentageSize -> Bool

max :: PercentageSize -> PercentageSize -> PercentageSize

min :: PercentageSize -> PercentageSize -> PercentageSize

ToCss PercentageSize # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: PercentageSize -> Builder #

percentageSize :: Rational -> PercentageSize #

Constructs `PercentageSize`. Not intended for direct use, see `mkSize`.

data PixelSize #

Constructors

PixelSize Rational |

#### Instances

Instances details

Num PixelSize # |
Instance details Defined in Text.Internal.CssCommon Methods (+) :: PixelSize -> PixelSize -> PixelSize (-) :: PixelSize -> PixelSize -> PixelSize (*) :: PixelSize -> PixelSize -> PixelSize negate :: PixelSize -> PixelSize abs :: PixelSize -> PixelSize signum :: PixelSize -> PixelSize fromInteger :: Integer -> PixelSize
Fractional PixelSize # |
Instance details Defined in Text.Internal.CssCommon Methods (/) :: PixelSize -> PixelSize -> PixelSize recip :: PixelSize -> PixelSize fromRational :: Rational -> PixelSize
Show PixelSize # |
Instance details Defined in Text.Internal.CssCommon Methods showsPrec :: Int -> PixelSize -> ShowS show :: PixelSize -> String showList :: [PixelSize] -> ShowS
Eq PixelSize # |
Instance details Defined in Text.Internal.CssCommon Methods (==) :: PixelSize -> PixelSize -> Bool (/=) :: PixelSize -> PixelSize -> Bool
Ord PixelSize # |
Instance details Defined in Text.Internal.CssCommon Methods compare :: PixelSize -> PixelSize -> Ordering (<) :: PixelSize -> PixelSize -> Bool (<=) :: PixelSize -> PixelSize -> Bool (>) :: PixelSize -> PixelSize -> Bool (>=) :: PixelSize -> PixelSize -> Bool max :: PixelSize -> PixelSize -> PixelSize min :: PixelSize -> PixelSize -> PixelSize
ToCss PixelSize # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: PixelSize -> Builder #

# Internal

cassiusUsedIdentifiers :: String -> [(Deref, VarType)] #

Determine which identifiers are used by the given template, useful for creating systems like yesod devel.