Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/Css.elm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Css exposing
, Color, all, important, solid, transparent, rgb, rgba, hsl, hsla, hex
, featureTag, featureTag2, featureOn, featureOff
, borderCollapse, borderColor, borderColor2, borderColor3, borderColor4, borderBottomLeftRadius, borderBottomLeftRadius2, borderBottomRightRadius, borderBottomRightRadius2, borderTopLeftRadius, borderTopLeftRadius2, borderTopRightRadius, borderTopRightRadius2, borderRadius, borderRadius2, borderRadius3, borderRadius4, borderWidth, borderWidth2, borderWidth3, borderWidth4, borderBottomWidth, borderLeftWidth, borderRightWidth, borderTopWidth, borderBottomStyle, borderLeftStyle, borderRightStyle, borderTopStyle, borderStyle, borderBottomColor, borderLeftColor, borderRightColor, borderTopColor, borderBox, contentBox, border, border2, border3, borderTop, borderTop2, borderTop3, borderBottom, borderBottom2, borderBottom3, borderLeft, borderLeft2, borderLeft3, borderRight, borderRight2, borderRight3, borderImageOutset, borderImageOutset2, borderImageOutset3, borderImageOutset4, borderImageWidth, borderImageWidth2, borderImageWidth3, borderImageWidth4, scroll, visible, block, inlineBlock, inlineFlex, inline, none, auto, inherit, unset, initial, noWrap, top, static, fixed, sticky, relative, absolute, position, float, bottom, middle, baseline, sub, super, textTop, textBottom, hidden, wavy, dotted, dashed, double, groove, ridge, inset, outset, matrix, matrix3d, perspective, rotate3d, rotateX, rotateY, rotateZ, scale, scale2, scale3d, scaleX, scaleY, skew, skew2, skewX, skewY, translate, translate2, translate3d, translateX, translateY, translateZ, rotate, fillBox, viewBox, flat, preserve3d, content, wrapReverse, wrap, flexStart, flexEnd, stretch, row, rowReverse, column, columnReverse, serif, sansSerif, monospace, cursive, fantasy, xxSmall, xSmall, small, large, xLarge, xxLarge, smaller, larger, normal, italic, oblique, bold, lighter, bolder, smallCaps, allSmallCaps, petiteCaps, allPetiteCaps, unicase, titlingCaps, commonLigatures, noCommonLigatures, discretionaryLigatures, noDiscretionaryLigatures, historicalLigatures, noHistoricalLigatures, contextual, noContextual, liningNums, oldstyleNums, proportionalNums, tabularNums, diagonalFractions, stackedFractions, ordinal, slashedZero, default, pointer, crosshair, contextMenu, help, progress, wait, cell, text_, verticalText, cursorAlias, copy, move, noDrop, notAllowed, eResize, nResize, neResize, nwResize, sResize, seResize, swResize, wResize, ewResize, nsResize, neswResize, nwseResize, colResize, rowResize, allScroll, zoomIn, zoomOut, grab, grabbing, visiblePainted, visibleFill, visibleStroke, painted, stroke
, Length, pct, px, em, pt, ex, ch, rem, vh, vw, vmin, vmax, mm, cm, inches, pc, int, num, zero, calc, plus, minus
, Length, pct, px, em, pt, ex, ch, rem, vh, vw, vmin, vmax, mm, cm, inches, pc, int, num, zero, calc, plus, minus, mult, dividedBy
, Px, Em, Rem, Pct, Ex, Ch, Vh, Vw, Vmin, Vmax, Mm, Cm, In, Pt, Pc
, deg, rad, grad, turn
, Duration, sec, ms
Expand Down Expand Up @@ -867,6 +867,8 @@ type alias CalculatedLength =
type CalcExpression
= Addition
| Subtraction
| Multiplication
| Division


calcExpressionToString : CalcExpression -> String
Expand All @@ -878,6 +880,12 @@ calcExpressionToString expression =
Subtraction ->
"-"

Multiplication ->
"*"

Division ->
"/"


{-| <https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action?v=control#Values>
-}
Expand Down Expand Up @@ -967,6 +975,13 @@ minus : CalcExpression
minus =
Subtraction

mult : CalcExpression
mult =
Multiplication

dividedBy : CalcExpression
dividedBy =
Division

combineLengths :
(Float -> Float -> Float)
Expand Down
4 changes: 4 additions & 0 deletions tests/Properties.elm
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ all =
, ( lineHeight (num 0), "0" )
, ( lineHeight (calc (px 5) plus (pct 1)), "calc(5px + 1%)" )
, ( lineHeight (calc (em 5.5) minus (pt 1)), "calc(5.5em - 1pt)" )
, ( lineHeight (calc (em 1.5) mult (pct 1)), "calc(1.5em * 1%)")
, ( lineHeight (calc (px 3.25) mult (rem 2)), "calc(3.25px * 2rem)")
, ( lineHeight (calc (em 1.5) dividedBy (pct 1)), "calc(1.5em / 1%)")
, ( lineHeight (calc (px 3.25) dividedBy (rem 2)), "calc(3.25px / 2rem)")
, ( lineHeight (calc (px 5) plus (calc (pct 5) plus (vh 3))), "calc(5px + (5% + 3vh))" )
, ( lineHeight (calc (px 5) plus (calc (pct 5) minus (vh 3))), "calc(5px + (5% - 3vh))" )
, ( lineHeight (calc (px 5) minus (calc (pct 5) plus (vh 3))), "calc(5px - (5% + 3vh))" )
Expand Down