Clay.Box

clay-0.15.0: CSS preprocessor as embedded Haskell.

Safe Haskell | None
Language | Haskell2010

Clay.Box

Contents

- `box-shadow`
  - Deprecated

Synopsis

- data BoxType
- paddingBox :: BoxType
- borderBox :: BoxType
- contentBox :: BoxType
- boxSizing :: BoxType -> Css
- boxShadow :: NonEmpty BoxShadow -> Css
- shadow :: Size a -> Size a -> BoxShadow
- shadowWithBlur :: Size a -> Size a -> Size a -> BoxShadow
- shadowWithSpread :: Size a -> Size a -> Size a -> Size a -> BoxShadow
- bsInset :: BoxShadow -> BoxShadow
- bsColor :: Color -> BoxShadow -> BoxShadow
- boxShadow' :: Size a -> Size a -> Size a -> Color -> Css
- boxShadowWithSpread :: Size a -> Size a -> Size a -> Size a -> Color -> Css
- boxShadows :: [(Size a, Size a, Size a, Color)] -> Css
- insetBoxShadow :: Stroke -> Size a -> Size a -> Size a -> Color -> Css

# Documentation

data BoxType #

#### Instances

Instances details

Inherit BoxType # |
Instance details Defined in Clay.Box Methods inherit :: BoxType #
Val BoxType # |
Instance details Defined in Clay.Box Methods value :: BoxType -> Value #

paddingBox :: BoxType #

borderBox :: BoxType #

contentBox :: BoxType #

boxSizing :: BoxType -> Css #

# `box-shadow`

### Formal argument syntax

    none | <shadow>#
    where
    <shadow> = inset? && <length>{2,4} && <color>?

    where
    <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>

    where
    <rgb()> = rgb( [ [ <percentage>{3} | <number>{3} ] [ / <alpha-value> ]? ] | [ [ <percentage>#{3} | <number>#{3} ] , <alpha-value>? ] )
    <rgba()> = rgba( [ [ <percentage>{3} | <number>{3} ] [ / <alpha-value> ]? ] | [ [ <percentage>#{3} | <number>#{3} ] , <alpha-value>? ] )
    <hsl()> = hsl( [ <hue> <percentage> <percentage> [ / <alpha-value> ]? ] | [ <hue>, <percentage>, <percentage>, <alpha-value>? ] )
    <hsla()> = hsla( [ <hue> <percentage> <percentage> [ / <alpha-value> ]? ] | [ <hue>, <percentage>, <percentage>, <alpha-value>? ] )

    where
    <alpha-value> = <number> | <percentage>
    <hue> = <number> | <angle>

boxShadow :: NonEmpty BoxShadow -> Css #

This function will usually take a singleton list, but requiring a (non-empty) list prevents accidentally applying the modifiers (`bsInset`, `bsColor`) incorrectly.

`pure` (from Control.Applicative) creates a singleton list.

    boxShadow . pure $ none
    boxShadow . pure $ shadow (px 1) (px 1)

Use with `{-# LANGUAGE OverloadedLists #-}` for the simplest list syntax. Note that sometimes when `{-# LANGUAGE OverloadedLists #-}` is active, GHC has troubles identifying what type the list should be converted to. Examples: 1) "forM_ [0..10] $ x -> ..." 2) "[left, top, right, bottom] `forM_` ($ pct 4)"

    boxShadow [none]
    boxShadow [shadow (px 1) (px 1)]

This is recommended for supplying multiple `BoxShadow` values.

    boxShadow [shadowWithBlur (em 2) (em 1), bsInset . bsColor red $ shadow (px 1) (px 2)]

shadow #

Arguments

:: Size a | Horizontal offset
-> Size a | Vertical offset
-> BoxShadow |

shadowWithBlur #

Arguments

:: Size a | Horizontal offset
-> Size a | Vertical offset
-> Size a | Blur radius
-> BoxShadow |

shadowWithSpread #

Arguments

:: Size a | Horizontal offset
-> Size a | Vertical offset
-> Size a | Blur radius
-> Size a | Spread radius
-> BoxShadow |

While this function is the correct type to work with the `sym`, `sym2` or `sym3` functions, such applications are unlikely to be meaningful.

bsInset :: BoxShadow -> BoxShadow #

Adapt the provided `box-shadow` with the `inset` prefix.

    boxShadow . pure . bsInset

bsColor :: Color -> BoxShadow -> BoxShadow infixr 9 #

Supply a color to the provided `box-shadow`.

## Deprecated

The old implementation was both restrictive and slightly off-spec. It shall be discontinued in a future release. The `boxShadow` name has already been taken, so the functionality that used to provide is now provided by 'boxShadow''.

boxShadow' :: Size a -> Size a -> Size a -> Color -> Css #

Deprecated: This function is only present for compatibility purposes and will be removed.

This is the drop-in replacement for the old `boxShadow` function (< 0.13). It is possible to continue for now

boxShadowWithSpread :: Size a -> Size a -> Size a -> Size a -> Color -> Css #

Deprecated: This function has been replaced with shadowWithSpread and bsColor and will be removed.

Replace calls to this function as follows (using -XOverloadedLists)

    boxShadowWithSpread x y rb rs c

    boxShadow [c `bsColor` shadowWithSpread x y rb rs]

boxShadows :: [(Size a, Size a, Size a, Color)] -> Css #

Deprecated: This function is replaced with boxShadow and will be removed.

Replace calls to this function as follows (using -XOverloadedLists)

    boxShadows [(x1, y1, rb1, c1), (x2, y2, rb2, c2)]

    boxShadow
      [ c1 `bsColor` shadowWithBlur x1 y1 rb1
      , c2 `bsColor` shadowWithBlur x2 y2 rb2
      ]

insetBoxShadow :: Stroke -> Size a -> Size a -> Size a -> Color -> Css #

Deprecated: This function has been replaced with shadowWithSpread, bsInset and bsColor and will be removed.

Replace calls to this function as follows (using -XOverloadedLists)

    insetBoxShadow s x y rb c

    boxShadow [bsInset $ c `bsColor` shadowWithBlur x y rb]