Skip to content

Commit 5bc0eab

Browse files
committed
Merge remote-tracking branch 'slamdata/master' into topic/list-style-rule
2 parents f47bd21 + 08a04d5 commit 5bc0eab

File tree

7 files changed

+190
-9
lines changed

7 files changed

+190
-9
lines changed

src/CSS/Border.purs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ outset = Stroke $ fromString "outset"
5050
border :: Stroke -> Size Abs -> Color -> CSS
5151
border a b c = key (fromString "border") $ tuple3 a b c
5252

53+
borderTop :: Stroke -> Size Abs -> Color -> CSS
54+
borderTop a b c = key (fromString "border-top") $ tuple3 a b c
55+
56+
borderBottom :: Stroke -> Size Abs -> Color -> CSS
57+
borderBottom a b c = key (fromString "border-bottom") $ tuple3 a b c
58+
59+
borderLeft :: Stroke -> Size Abs -> Color -> CSS
60+
borderLeft a b c = key (fromString "border-left") $ tuple3 a b c
61+
62+
borderRight :: Stroke -> Size Abs -> Color -> CSS
63+
borderRight a b c = key (fromString "border-right") $ tuple3 a b c
64+
5365
borderColor :: Color -> CSS
5466
borderColor = key $ fromString "border-color"
5567

src/CSS/Common.purs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ class Visible a where visible :: a
2727
class Hidden a where hidden :: a
2828
class Initial a where initial :: a
2929
class Unset a where unset :: a
30-
30+
class Top a where top :: a
31+
class Middle a where middle :: a
32+
class Bottom a where bottom :: a
3133
class URL a where url :: String -> a
3234

3335
-- | The other type class is used to escape from the type safety introduced by
@@ -48,7 +50,9 @@ instance hiddenValue :: Hidden Value where hidden = fromString "hidden"
4850
instance otherValue :: Other Value where other = id
4951
instance initialValue :: Initial Value where initial = fromString "initial"
5052
instance unsetValue :: Unset Value where unset = fromString "unset"
51-
53+
instance topValue :: Top Value where top = fromString "top"
54+
instance middleValue :: Middle Value where middle = fromString "middle"
55+
instance bottomValue :: Bottom Value where bottom = fromString "bottom"
5256
instance urlValue :: URL Value where url s = fromString ("url(\"" <> s <> "\")")
5357

5458
-------------------------------------------------------------------------------

src/CSS/Geometry.purs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,6 @@ marginLeft = key $ fromString "margin-left"
6666

6767
marginRight :: forall a. Size a -> CSS
6868
marginRight = key $ fromString "margin-right"
69+
70+
lineHeight :: forall a. Size a -> CSS
71+
lineHeight = key $ fromString "line-height"

src/CSS/Text.purs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
module CSS.Text where
22

33
import Prelude
4-
5-
import Data.Generic (class Generic)
6-
74
import CSS.Property (class Val, Value)
5+
import CSS.Size (Size)
86
import CSS.String (fromString)
97
import CSS.Stylesheet (CSS, key)
8+
import Data.Generic (class Generic)
9+
10+
letterSpacing :: forall a. Size a -> CSS
11+
letterSpacing = key $ fromString "letter-spacing"
1012

1113
newtype TextDecoration = TextDecoration Value
1214

src/CSS/Text/Shadow.purs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module CSS.Text.Shadow where
2+
3+
import CSS.Color (Color)
4+
import CSS.Common (class Inherit, class Initial, class None)
5+
import CSS.Property (class Val, value)
6+
import CSS.Size (Size)
7+
import CSS.String (fromString)
8+
import CSS.Stylesheet (CSS, key)
9+
import Data.Tuple.Nested (tuple4)
10+
11+
data TextShadow a
12+
= TextShadow (Size a) (Size a) (Size a) (Color)
13+
| None
14+
| Initial
15+
| Inherit
16+
17+
instance valTextShadow :: Val (TextShadow a) where
18+
value (TextShadow h v b c) = value (tuple4 h v b c)
19+
value (None) = fromString "none"
20+
value (Initial) = fromString "initial"
21+
value (Inherit) = fromString "inherit"
22+
23+
instance noneTextShadow :: None (TextShadow a) where
24+
none = None
25+
26+
instance initialTextShadow :: Initial (TextShadow a) where
27+
initial = Initial
28+
29+
instance inheritTextShadow :: Inherit (TextShadow a) where
30+
inherit = Inherit
31+
32+
textShadow :: forall a. Size a -> Size a -> Size a -> Color -> CSS
33+
textShadow h v b c = key (fromString "text-shadow") (TextShadow h v b c)

src/CSS/Transform.purs

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
module CSS.Transform where
22

33
import Prelude
4-
5-
import Data.Generic (class Generic)
6-
7-
import CSS.Property (class Val, Value, value, noCommas)
4+
import CSS.Common (class Inherit, class Initial, class Unset)
5+
import CSS.Property (class Val, Value, noCommas, value)
86
import CSS.Size (Angle, Abs, Size)
97
import CSS.String (fromString)
108
import CSS.Stylesheet (CSS, key)
9+
import Data.Generic (class Generic)
10+
import Data.Tuple.Nested (tuple3)
1111

1212
newtype Transformation = Transformation Value
1313

@@ -29,3 +29,61 @@ translate x y = Transformation $ fromString "translate(" <> value [x, y] <> from
2929

3030
rotate :: forall a. Angle a -> Transformation
3131
rotate a = Transformation $ fromString "rotate(" <> value a <> fromString ")"
32+
33+
data TransformOrigin a
34+
= TransformOrigin (TransformOriginOffset a) (TransformOriginOffset a) (Size a)
35+
| Initial
36+
| Inherit
37+
| Unset
38+
39+
data TransformOriginOffset a
40+
= OffsetLength (Size a)
41+
| OffsetTop
42+
| OffsetBottom
43+
| OffsetLeft
44+
| OffsetRight
45+
| OffsetCenter
46+
47+
instance valTransformOriginOffset :: Val (TransformOriginOffset a) where
48+
value (OffsetLength s) = value s
49+
value (OffsetTop) = fromString "top"
50+
value (OffsetBottom) = fromString "bottom"
51+
value (OffsetLeft) = fromString "left"
52+
value (OffsetRight) = fromString "right"
53+
value (OffsetCenter) = fromString "center"
54+
55+
instance valTransformOrigin :: Val (TransformOrigin a) where
56+
value (TransformOrigin x y z) = value (tuple3 x y z)
57+
value (Initial) = fromString "initial"
58+
value (Inherit) = fromString "inherit"
59+
value (Unset) = fromString "unset"
60+
61+
instance initialTransformOrigin :: Initial (TransformOrigin a) where
62+
initial = Initial
63+
64+
instance inheritTransformOrigin :: Inherit (TransformOrigin a) where
65+
inherit = Inherit
66+
67+
instance unsetTransformOrigin :: Unset (TransformOrigin a) where
68+
unset = Unset
69+
70+
offset :: forall a. Size a -> TransformOriginOffset a
71+
offset = OffsetLength
72+
73+
offsetTop :: forall a. TransformOriginOffset a
74+
offsetTop = OffsetTop
75+
76+
offsetBottom :: forall a. TransformOriginOffset a
77+
offsetBottom = OffsetBottom
78+
79+
offsetLeft :: forall a. TransformOriginOffset a
80+
offsetLeft = OffsetLeft
81+
82+
offsetRight :: forall a. TransformOriginOffset a
83+
offsetRight = OffsetRight
84+
85+
offsetCenter :: forall a. TransformOriginOffset a
86+
offsetCenter = OffsetCenter
87+
88+
transformOrigin :: forall a. TransformOriginOffset a -> TransformOriginOffset a -> Size a -> CSS
89+
transformOrigin x y z = key (fromString "transform-origin") (TransformOrigin x y z)

src/CSS/VerticalAlign.purs

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
module CSS.VerticalAlign where
2+
3+
import CSS.Common (class Baseline, class Inherit, class Initial, class Unset, class Top, class Middle, class Bottom)
4+
import CSS.Property (class Val)
5+
import CSS.String (fromString)
6+
import CSS.Stylesheet (CSS, key)
7+
import Data.Function (($))
8+
9+
data VerticalAlign
10+
= Baseline
11+
| Sub
12+
| Super
13+
| TextTop
14+
| TextBottom
15+
| Middle
16+
| Top
17+
| Bottom
18+
| Inherit
19+
| Initial
20+
| Unset
21+
22+
instance valVerticalAlign :: Val (VerticalAlign) where
23+
value (Baseline) = fromString "baseline"
24+
value (Sub) = fromString "sub"
25+
value (Super) = fromString "super"
26+
value (TextTop) = fromString "text-top"
27+
value (TextBottom) = fromString "text-bottom"
28+
value (Middle) = fromString "middle"
29+
value (Top) = fromString "top"
30+
value (Bottom) = fromString "bottom"
31+
value (Inherit) = fromString "inherit"
32+
value (Initial) = fromString "initial"
33+
value (Unset) = fromString "unset"
34+
35+
instance inheritVerticalAlign :: Inherit (VerticalAlign) where
36+
inherit = Inherit
37+
38+
instance initialVerticalAlign :: Initial (VerticalAlign) where
39+
initial = Initial
40+
41+
instance unsetVerticalAlign :: Unset (VerticalAlign) where
42+
unset = Unset
43+
44+
instance baselineVerticalAlign :: Baseline (VerticalAlign) where
45+
baseline = Baseline
46+
47+
instance middleVerticalAlign :: Middle (VerticalAlign) where
48+
middle = Middle
49+
50+
instance topVerticalAlign :: Top (VerticalAlign) where
51+
top = Top
52+
53+
instance bottomVerticalAlign :: Bottom (VerticalAlign) where
54+
bottom = Bottom
55+
56+
sub :: VerticalAlign
57+
sub = Sub
58+
59+
super :: VerticalAlign
60+
super = Super
61+
62+
textTop :: VerticalAlign
63+
textTop = TextTop
64+
65+
textBottom :: VerticalAlign
66+
textBottom = TextBottom
67+
68+
verticalAlign :: VerticalAlign -> CSS
69+
verticalAlign = key $ fromString "vertical-align"

0 commit comments

Comments
 (0)