/
Box.purs
64 lines (46 loc) · 1.75 KB
/
Box.purs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
module CSS.Box
( BoxType
, paddingBox, borderBox, contentBox
, boxSizing
, boxShadow
, insetBoxShadow
)
where
import Prelude
import Data.Generic (class Generic)
import CSS.Border (Stroke)
import CSS.Color (Color)
import CSS.Common (class Inherit, browsers)
import CSS.Property (class Val, Value, (!))
import CSS.Size (Size)
import CSS.String (class IsString, fromString)
import CSS.Stylesheet (CSS, prefixed, key)
-------------------------------------------------------------------------------
newtype BoxType = BoxType Value
derive instance eqBoxType :: Eq BoxType
derive instance ordBoxType :: Ord BoxType
derive instance genericBoxType :: Generic BoxType
instance isStringBoxType :: IsString BoxType where
fromString = BoxType <<< fromString
instance valBoxType :: Val BoxType where
value (BoxType v) = v
instance inheritBoxType :: Inherit BoxType where
inherit = fromString "inherit"
-- | *DEPRECATED*
paddingBox :: BoxType
paddingBox = BoxType $ fromString "padding-box"
borderBox :: BoxType
borderBox = BoxType $ fromString "border-box"
contentBox :: BoxType
contentBox = BoxType $ fromString "content-box"
-------------------------------------------------------------------------------
boxSizing :: BoxType -> CSS
boxSizing = key $ fromString "box-sizing"
-------------------------------------------------------------------------------
boxShadow :: forall a. Size a -> Size a -> Size a -> Color -> CSS
boxShadow x y w c =
prefixed (browsers <> fromString "box-shadow") (x ! y ! w ! c)
-------------------------------------------------------------------------------
insetBoxShadow ::
forall a. Stroke -> Size a -> Size a -> Size a -> Color -> CSS
insetBoxShadow x y w c z = prefixed (browsers <> fromString "box-shadow") (x ! y ! w ! c ! z)