clay-0.15.0: CSS preprocessor as embedded Haskell.

Safe Haskell | None
Language | Haskell2010

Clay.Size

Contents

- Size type.
- Size constructors.
- Calculation operators for calc
- Shorthands for properties that can be applied separately to each box side.
- Angle type.
- Constructing angles.

Synopsis

- data Size a
- data LengthUnit
- data Percentage
- nil :: Size a
- unitless :: Number -> Size a
- cm :: Number -> Size LengthUnit
- mm :: Number -> Size LengthUnit
- inches :: Number -> Size LengthUnit
- px :: Number -> Size LengthUnit
- pt :: Number -> Size LengthUnit
- pc :: Number -> Size LengthUnit
- em :: Number -> Size LengthUnit
- ex :: Number -> Size LengthUnit
- ch :: Number -> Size LengthUnit
- pct :: Number -> Size Percentage
- rem :: Number -> Size LengthUnit
- lh :: Number -> Size LengthUnit
- rlh :: Number -> Size LengthUnit
- vw :: Number -> Size LengthUnit
- vh :: Number -> Size LengthUnit
- vmin :: Number -> Size LengthUnit
- vmax :: Number -> Size LengthUnit
- vb :: Number -> Size LengthUnit
- vi :: Number -> Size LengthUnit
- svw :: Number -> Size LengthUnit
- svh :: Number -> Size LengthUnit
- lvw :: Number -> Size LengthUnit
- lvh :: Number -> Size LengthUnit
- dvw :: Number -> Size LengthUnit
- dvh :: Number -> Size LengthUnit
- fr :: Number -> Size LengthUnit
- maxContent :: Size LengthUnit
- minContent :: Size LengthUnit
- available :: Size LengthUnit
- fitContent :: Size LengthUnit
- (@+@) :: Size a -> Size b -> Size (SizeCombination a b)
- (@-@) :: Size a -> Size b -> Size (SizeCombination a b)
- (@*) :: Size a -> Number -> Size a
- (*@) :: Number -> Size a -> Size a
- (@/) :: Size a -> Number -> Size a
- sym :: (a -> a -> a -> a -> Css) -> a -> Css
- sym2 :: (tb -> lr -> tb -> lr -> Css) -> tb -> lr -> Css
- sym3 :: (tb -> l -> tb -> r -> Css) -> tb -> l -> r -> Css
- data Angle a
- data Deg
- data Rad
- data Grad
- data Turn
- deg :: Number -> Angle Deg
- rad :: Number -> Angle Rad
- grad :: Number -> Angle Grad
- turn :: Number -> Angle Turn

# Size type.

data Size a #

#### Instances

Instances details

Loc (Size a) # |
Instance details Defined in Clay.Background Methods location :: Size a -> Location #
Auto (Size a) # |
Instance details Defined in Clay.Size Methods auto :: Size a #
Inherit (Size a) # |
Instance details Defined in Clay.Size Methods inherit :: Size a #
None (Size a) # |
Instance details Defined in Clay.Size Methods none :: Size a #
Normal (Size a) # |
Instance details Defined in Clay.Size Methods normal :: Size a #
Other (Size a) # |
Instance details Defined in Clay.Size Methods other :: Value -> Size a #
VerticalAlign (Size a) # |
Instance details Defined in Clay.Display Methods verticalAlign :: Size a -> Css #
Val (Size a) # |
Instance details Defined in Clay.Size Methods value :: Size a -> Value #
Num (Size LengthUnit) # |
Instance details Defined in Clay.Size Methods (+) :: Size LengthUnit -> Size LengthUnit -> Size LengthUnit # (-) :: Size LengthUnit -> Size LengthUnit -> Size LengthUnit # (*) :: Size LengthUnit -> Size LengthUnit -> Size LengthUnit # negate :: Size LengthUnit -> Size LengthUnit # abs :: Size LengthUnit -> Size LengthUnit # signum :: Size LengthUnit -> Size LengthUnit # fromInteger :: Integer -> Size LengthUnit #
Num (Size Percentage) # |
Instance details Defined in Clay.Size Methods (+) :: Size Percentage -> Size Percentage -> Size Percentage # (-) :: Size Percentage -> Size Percentage -> Size Percentage # (*) :: Size Percentage -> Size Percentage -> Size Percentage # negate :: Size Percentage -> Size Percentage # abs :: Size Percentage -> Size Percentage # signum :: Size Percentage -> Size Percentage # fromInteger :: Integer -> Size Percentage #
Fractional (Size LengthUnit) # |
Instance details Defined in Clay.Size Methods (/) :: Size LengthUnit -> Size LengthUnit -> Size LengthUnit # recip :: Size LengthUnit -> Size LengthUnit # fromRational :: Rational -> Size LengthUnit #
Fractional (Size Percentage) # |
Instance details Defined in Clay.Size Methods (/) :: Size Percentage -> Size Percentage -> Size Percentage # recip :: Size Percentage -> Size Percentage # fromRational :: Rational -> Size Percentage #
Show (Size a) # |
Instance details Defined in Clay.Size Methods showsPrec :: Int -> Size a -> ShowS # show :: Size a -> String # showList :: [Size a] -> ShowS #

data LengthUnit #

Sizes can be given using a length unit (e.g. em, px).

#### Instances

Instances details

Num (Size LengthUnit) # |
Instance details Defined in Clay.Size Methods (+) :: Size LengthUnit -> Size LengthUnit -> Size LengthUnit # (-) :: Size LengthUnit -> Size LengthUnit -> Size LengthUnit # (*) :: Size LengthUnit -> Size LengthUnit -> Size LengthUnit # negate :: Size LengthUnit -> Size LengthUnit # abs :: Size LengthUnit -> Size LengthUnit # signum :: Size LengthUnit -> Size LengthUnit # fromInteger :: Integer -> Size LengthUnit #
Fractional (Size LengthUnit) # |
Instance details Defined in Clay.Size Methods (/) :: Size LengthUnit -> Size LengthUnit -> Size LengthUnit # recip :: Size LengthUnit -> Size LengthUnit # fromRational :: Rational -> Size LengthUnit #

data Percentage #

Sizes can be given in percentages.

#### Instances

Instances details

Num (Size Percentage) # |
Instance details Defined in Clay.Size Methods (+) :: Size Percentage -> Size Percentage -> Size Percentage # (-) :: Size Percentage -> Size Percentage -> Size Percentage # (*) :: Size Percentage -> Size Percentage -> Size Percentage # negate :: Size Percentage -> Size Percentage # abs :: Size Percentage -> Size Percentage # signum :: Size Percentage -> Size Percentage # fromInteger :: Integer -> Size Percentage #
Fractional (Size Percentage) # |
Instance details Defined in Clay.Size Methods (/) :: Size Percentage -> Size Percentage -> Size Percentage # recip :: Size Percentage -> Size Percentage # fromRational :: Rational -> Size Percentage #

nil :: Size a #

Zero size.

unitless :: Number -> Size a #

Unitless size (as recommended for line-height).

# Size constructors.

cm :: Number -> Size LengthUnit #

Size in centimeters.

mm :: Number -> Size LengthUnit #

Size in millimeters.

inches :: Number -> Size LengthUnit #

Size in inches (1in = 2.54 cm).

px :: Number -> Size LengthUnit #

Size in pixels.

pt :: Number -> Size LengthUnit #

Size in points (1pt = 1/72 of 1in).

pc :: Number -> Size LengthUnit #

Size in picas (1pc = 12pt).

em :: Number -> Size LengthUnit #

Size in em's (computed cssNumberText of the font-size).

ex :: Number -> Size LengthUnit #

SimpleSize in ex'es (x-height of the first avaliable font).

ch :: Number -> Size LengthUnit #

SimpleSize in ch's (The width of the glyph "0" of the element's font).

pct :: Number -> Size Percentage #

SimpleSize in percents.

rem :: Number -> Size LengthUnit #

SimpleSize in rem's (em's, but always relative to the root element).

lh :: Number -> Size LengthUnit #

SimpleSize in lh's (Line height of the element).

rlh :: Number -> Size LengthUnit #

SimpleSize in rlh's (lh's, but always relative to the root element).

vw :: Number -> Size LengthUnit #

SimpleSize in vw's (1vw = 1% of viewport width).

vh :: Number -> Size LengthUnit #

SimpleSize in vh's (1vh = 1% of viewport height).

vmin :: Number -> Size LengthUnit #

SimpleSize in vmin's (the smaller of vw or vh).

vmax :: Number -> Size LengthUnit #

SimpleSize in vmax's (the larger of vw or vh).

vb :: Number -> Size LengthUnit #

SimpleSize in vb's (1vb = 1% of the parent's size in the direction of the root element's block axis).

vi :: Number -> Size LengthUnit #

SimpleSize in vi's (1vi = 1% of the parent's size in the direction of the root element's inline axis).

svw :: Number -> Size LengthUnit #

SimpleSize in svw's (1svw = 1% of the small viewport's width).

svh :: Number -> Size LengthUnit #

SimpleSize in svh's (1svh = 1% of the small viewport's height).

lvw :: Number -> Size LengthUnit #

SimpleSize in lvw's (1lvw = 1% of the large viewport's width).

lvh :: Number -> Size LengthUnit #

SimpleSize in lvh's (1lvh = 1% of the large viewport's height).

dvw :: Number -> Size LengthUnit #

SimpleSize in dvw's (1dvw = 1% of the dynamic viewport's width).

dvh :: Number -> Size LengthUnit #

SimpleSize in dvh's (1dvh = 1% of the dynamic viewport's height).

fr :: Number -> Size LengthUnit #

`SimpleSize` in fr's (a fractional unit and 1fr is for 1 part of the available space in grid areas).

maxContent :: Size LengthUnit #

SimpleSize for the intrinsic preferred width.

minContent :: Size LengthUnit #

SimpleSize for the intrinsic minimum width.

available :: Size LengthUnit #

SimpleSize for the containing block width minus horizontal margin, border, and padding.

fitContent :: Size LengthUnit #

The larger of the intrinsic minimum width or the smaller of the intrinsic preferred width and the available width.

# Calculation operators for calc

(@+@) :: Size a -> Size b -> Size (SizeCombination a b) infixl 6 #

Plus operator to combine sizes into calc function

(@-@) :: Size a -> Size b -> Size (SizeCombination a b) infixl 6 #

Minus operator to combine sizes into calc function

(@*) :: Size a -> Number -> Size a infixl 7 #

Reversed times operator to combine sizes into calc function

(*@) :: Number -> Size a -> Size a infixl 7 #

Times operator to combine sizes into calc function

(@/) :: Size a -> Number -> Size a infixl 7 #

Division operator to combine sizes into calc function

# Shorthands for properties that can be applied separately to each box side.

sym :: (a -> a -> a -> a -> Css) -> a -> Css #

sym2 :: (tb -> lr -> tb -> lr -> Css) -> tb -> lr -> Css #

sym3 :: (tb -> l -> tb -> r -> Css) -> tb -> l -> r -> Css #

# Angle type.

data Angle a #

#### Instances

Instances details

Auto (Angle a) # |
Instance details Defined in Clay.Size Methods auto :: Angle a #
Inherit (Angle a) # |
Instance details Defined in Clay.Size Methods inherit :: Angle a #
Other (Angle a) # |
Instance details Defined in Clay.Size Methods other :: Value -> Angle a #
Val (Angle a) # |
Instance details Defined in Clay.Size Methods value :: Angle a -> Value #
Num (Angle Deg) # |
Instance details Defined in Clay.Size Methods (+) :: Angle Deg -> Angle Deg -> Angle Deg # (-) :: Angle Deg -> Angle Deg -> Angle Deg # (*) :: Angle Deg -> Angle Deg -> Angle Deg # negate :: Angle Deg -> Angle Deg # abs :: Angle Deg -> Angle Deg # signum :: Angle Deg -> Angle Deg # fromInteger :: Integer -> Angle Deg #
Num (Angle Grad) # |
Instance details Defined in Clay.Size Methods (+) :: Angle Grad -> Angle Grad -> Angle Grad # (-) :: Angle Grad -> Angle Grad -> Angle Grad # (*) :: Angle Grad -> Angle Grad -> Angle Grad # negate :: Angle Grad -> Angle Grad # abs :: Angle Grad -> Angle Grad # signum :: Angle Grad -> Angle Grad # fromInteger :: Integer -> Angle Grad #
Num (Angle Rad) # |
Instance details Defined in Clay.Size Methods (+) :: Angle Rad -> Angle Rad -> Angle Rad # (-) :: Angle Rad -> Angle Rad -> Angle Rad # (*) :: Angle Rad -> Angle Rad -> Angle Rad # negate :: Angle Rad -> Angle Rad # abs :: Angle Rad -> Angle Rad # signum :: Angle Rad -> Angle Rad # fromInteger :: Integer -> Angle Rad #
Num (Angle Turn) # |
Instance details Defined in Clay.Size Methods (+) :: Angle Turn -> Angle Turn -> Angle Turn # (-) :: Angle Turn -> Angle Turn -> Angle Turn # (*) :: Angle Turn -> Angle Turn -> Angle Turn # negate :: Angle Turn -> Angle Turn # abs :: Angle Turn -> Angle Turn # signum :: Angle Turn -> Angle Turn # fromInteger :: Integer -> Angle Turn #
Fractional (Angle Deg) # |
Instance details Defined in Clay.Size Methods (/) :: Angle Deg -> Angle Deg -> Angle Deg # recip :: Angle Deg -> Angle Deg # fromRational :: Rational -> Angle Deg #
Fractional (Angle Grad) # |
Instance details Defined in Clay.Size Methods (/) :: Angle Grad -> Angle Grad -> Angle Grad # recip :: Angle Grad -> Angle Grad # fromRational :: Rational -> Angle Grad #
Fractional (Angle Rad) # |
Instance details Defined in Clay.Size Methods (/) :: Angle Rad -> Angle Rad -> Angle Rad # recip :: Angle Rad -> Angle Rad # fromRational :: Rational -> Angle Rad #
Fractional (Angle Turn) # |
Instance details Defined in Clay.Size Methods (/) :: Angle Turn -> Angle Turn -> Angle Turn # recip :: Angle Turn -> Angle Turn # fromRational :: Rational -> Angle Turn #

data Deg #

#### Instances

Instances details

Num (Angle Deg) # |
Instance details Defined in Clay.Size Methods (+) :: Angle Deg -> Angle Deg -> Angle Deg # (-) :: Angle Deg -> Angle Deg -> Angle Deg # (*) :: Angle Deg -> Angle Deg -> Angle Deg # negate :: Angle Deg -> Angle Deg # abs :: Angle Deg -> Angle Deg # signum :: Angle Deg -> Angle Deg # fromInteger :: Integer -> Angle Deg #
Fractional (Angle Deg) # |
Instance details Defined in Clay.Size Methods (/) :: Angle Deg -> Angle Deg -> Angle Deg # recip :: Angle Deg -> Angle Deg # fromRational :: Rational -> Angle Deg #

data Rad #

#### Instances

Instances details

Num (Angle Rad) # |
Instance details Defined in Clay.Size Methods (+) :: Angle Rad -> Angle Rad -> Angle Rad # (-) :: Angle Rad -> Angle Rad -> Angle Rad # (*) :: Angle Rad -> Angle Rad -> Angle Rad # negate :: Angle Rad -> Angle Rad # abs :: Angle Rad -> Angle Rad # signum :: Angle Rad -> Angle Rad # fromInteger :: Integer -> Angle Rad #
Fractional (Angle Rad) # |
Instance details Defined in Clay.Size Methods (/) :: Angle Rad -> Angle Rad -> Angle Rad # recip :: Angle Rad -> Angle Rad # fromRational :: Rational -> Angle Rad #

data Grad #

#### Instances

Instances details

Num (Angle Grad) # |
Instance details Defined in Clay.Size Methods (+) :: Angle Grad -> Angle Grad -> Angle Grad # (-) :: Angle Grad -> Angle Grad -> Angle Grad # (*) :: Angle Grad -> Angle Grad -> Angle Grad # negate :: Angle Grad -> Angle Grad # abs :: Angle Grad -> Angle Grad # signum :: Angle Grad -> Angle Grad # fromInteger :: Integer -> Angle Grad #
Fractional (Angle Grad) # |
Instance details Defined in Clay.Size Methods (/) :: Angle Grad -> Angle Grad -> Angle Grad # recip :: Angle Grad -> Angle Grad # fromRational :: Rational -> Angle Grad #

data Turn #

#### Instances

Instances details

Num (Angle Turn) # |
Instance details Defined in Clay.Size Methods (+) :: Angle Turn -> Angle Turn -> Angle Turn # (-) :: Angle Turn -> Angle Turn -> Angle Turn # (*) :: Angle Turn -> Angle Turn -> Angle Turn # negate :: Angle Turn -> Angle Turn # abs :: Angle Turn -> Angle Turn # signum :: Angle Turn -> Angle Turn # fromInteger :: Integer -> Angle Turn #
Fractional (Angle Turn) # |
Instance details Defined in Clay.Size Methods (/) :: Angle Turn -> Angle Turn -> Angle Turn # recip :: Angle Turn -> Angle Turn # fromRational :: Rational -> Angle Turn #

# Constructing angles.

deg :: Number -> Angle Deg #

Angle in degrees.

rad :: Number -> Angle Rad #

Angle in radians.

grad :: Number -> Angle Grad #

Angle in gradians (also knows as gons or grades).

turn :: Number -> Angle Turn #

Angle in turns.