Skip to content

Commit c5ffa8c

Browse files
authored
Merge pull request #578 from caseyWebb/line-height-normal
Add support for `line-height: normal;`
2 parents 5f4b50b + ce1e279 commit c5ffa8c

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

src/Css.elm

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,11 @@ type alias FontVariantNumeric compatible =
624624
}
625625

626626

627+
{-| -}
628+
type alias LineHeight compatible =
629+
{ compatible | value : String, lineHeight : Compatible }
630+
631+
627632
{-| <https://developer.mozilla.org/en-US/docs/Web/CSS/visibility#Values>
628633
-}
629634
type alias Visibility compatible =
@@ -848,6 +853,7 @@ type alias CalculatedLength =
848853
, lengthOrNone : Compatible
849854
, lengthOrMinMaxDimension : Compatible
850855
, lengthOrNoneOrMinMaxDimension : Compatible
856+
, lineHeight : Compatible
851857
, textIndent : Compatible
852858
, flexBasis : Compatible
853859
, lengthOrNumberOrAutoOrNoneOrContent : Compatible
@@ -935,6 +941,7 @@ calc firstExpr expression secondExpr =
935941
, lengthOrNumberOrAutoOrNoneOrContent = Compatible
936942
, fontSize = Compatible
937943
, lengthOrAutoOrCoverOrContain = Compatible
944+
, lineHeight = Compatible
938945
, calc = Compatible
939946
}
940947

@@ -1462,6 +1469,7 @@ type alias BasicProperty =
14621469
, lengthOrMinMaxDimension : Compatible
14631470
, lengthOrNoneOrMinMaxDimension : Compatible
14641471
, lengthOrNumberOrAutoOrNoneOrContent : Compatible
1472+
, lineHeight : Compatible
14651473
, listStyleType : Compatible
14661474
, listStylePosition : Compatible
14671475
, listStyleTypeOrPositionOrImage : Compatible
@@ -1534,6 +1542,7 @@ initial =
15341542
, lengthOrMinMaxDimension = Compatible
15351543
, lengthOrNoneOrMinMaxDimension = Compatible
15361544
, listStyleType = Compatible
1545+
, lineHeight = Compatible
15371546
, listStylePosition = Compatible
15381547
, listStyleTypeOrPositionOrImage = Compatible
15391548
, flexBasis = Compatible
@@ -2467,13 +2476,14 @@ infinite =
24672476
{-| A unitless number. Useful with properties like [`flexGrow`](#flexGrow)
24682477
which accept unitless numbers.
24692478
-}
2470-
num : Float -> LengthOrNumberOrAutoOrNoneOrContent (Number (LengthOrNumber (NumberOrInfinite { numericValue : Float, unitLabel : String, units : UnitlessFloat })))
2479+
num : Float -> LengthOrNumberOrAutoOrNoneOrContent (Number (LengthOrNumber (NumberOrInfinite (LineHeight { numericValue : Float, unitLabel : String, units : UnitlessFloat }))))
24712480
num val =
24722481
{ value = String.fromFloat val
24732482
, lengthOrNumber = Compatible
24742483
, number = Compatible
24752484
, numberOrInfinite = Compatible
24762485
, lengthOrNumberOrAutoOrNoneOrContent = Compatible
2486+
, lineHeight = Compatible
24772487
, numericValue = val
24782488
, unitLabel = ""
24792489
, units = UnitlessFloat
@@ -5202,23 +5212,26 @@ larger =
52025212
-- Styles --
52035213

52045214

5205-
type alias Normal =
5206-
{ value : String
5207-
, fontStyle : Compatible
5208-
, fontWeight : Compatible
5209-
, featureTagValue : Compatible
5210-
, overflowWrap : Compatible
5211-
, whiteSpace : Compatible
5215+
type alias Normal compatible =
5216+
{ compatible
5217+
| value : String
5218+
, fontStyle : Compatible
5219+
, fontWeight : Compatible
5220+
, featureTagValue : Compatible
5221+
, lineHeight : Compatible
5222+
, overflowWrap : Compatible
5223+
, whiteSpace : Compatible
52125224
}
52135225

52145226

52155227
{-| -}
5216-
normal : Normal
5228+
normal : Normal {}
52175229
normal =
52185230
{ value = "normal"
52195231
, fontStyle = Compatible
52205232
, fontWeight = Compatible
52215233
, featureTagValue = Compatible
5234+
, lineHeight = Compatible
52225235
, overflowWrap = Compatible
52235236
, whiteSpace = Compatible
52245237
}
@@ -6608,7 +6621,7 @@ color c =
66086621
lineHeight (px 10)
66096622
66106623
-}
6611-
lineHeight : LengthOrNumber compatible -> Style
6624+
lineHeight : LineHeight compatible -> Style
66126625
lineHeight =
66136626
prop1 "line-height"
66146627

src/Css/Internal.elm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type alias ExplicitLength units =
3838
, lengthOrNone : Compatible
3939
, lengthOrMinMaxDimension : Compatible
4040
, lengthOrNoneOrMinMaxDimension : Compatible
41+
, lineHeight : Compatible
4142
, textIndent : Compatible
4243
, flexBasis : Compatible
4344
, absoluteLength : Compatible
@@ -180,5 +181,6 @@ lengthConverter units unitLabel numericValue =
180181
, fontSize = Compatible
181182
, absoluteLength = Compatible
182183
, lengthOrAutoOrCoverOrContain = Compatible
184+
, lineHeight = Compatible
183185
, calc = Compatible
184186
}

tests/Properties.elm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ all =
210210
, ( lineHeight inherit, "inherit" )
211211
, ( lineHeight initial, "initial" )
212212
, ( lineHeight unset, "unset" )
213+
, ( lineHeight normal, "normal" )
213214
]
214215
, testProperty { function = "overflowX", property = "overflow-x" }
215216
[ ( overflowX initial, "initial" )

0 commit comments

Comments
 (0)