@@ -16,7 +16,6 @@ module Internal.Model exposing
16 , LayoutContext(..)
16 , LayoutContext(..)
17 , Length(..)
17 , Length(..)
18 , Location(..)
18 , Location(..)
20 , NodeName(..)
19 , NodeName(..)
21 , Option(..)
20 , Option(..)
22 , OptionRecord
21 , OptionRecord
@@ -42,7 +41,7 @@ module Internal.Model exposing
42 , asParagraph
41 , asParagraph
44 , asTextColumn
43 , asTextColumn
45− , boxShadowClass
44+ , boxShadowName
46 , columnClass
45 , columnClass
47 , composeTransformation
46 , composeTransformation
48 , contextClasses
47 , contextClasses
@@ -79,30 +78,31 @@ module Internal.Model exposing
79 , onlyStyles
78 , onlyStyles
80 , optionsToRecord
79 , optionsToRecord
81 , paddingName
80 , paddingName
83 , pageClass
81 , pageClass
84 , paragraphClass
82 , paragraphClass
85 , reduceRecursive
83 , reduceRecursive
86 , reduceStyles
84 , reduceStyles
87 , reduceStylesRecursive
85 , reduceStylesRecursive
88 , removeNever
86 , removeNever
89 , renderFontClassName
90 , renderFontClassName
90 , renderHeight
91 , renderHeight
91 , renderRoot
92 , renderRoot
93 , renderWidth
93 , renderWidth
94 , rootStyle
94 , rootStyle
95 , rowClass
95 , rowClass
96 , singleClass
96 , singleClass
97 , spacingName
97 , spacingName
99− , textShadowClass
100+ , textShadowName
101 , toStyleSheet
102 , toStyleSheet
102 , transformClass
103 , transformClass
103 , unstyled
104 , unstyled
104 , unwrapDecorations
105 , unwrapDecorations
@@ -112,7 +112,7 @@ import Html.Attributes
112import Html.Keyed
112import Html.Keyed
113import Internal.Flag as Flag exposing (Flag)
113import Internal.Flag as Flag exposing (Flag)
114import Internal.Style exposing (classes, dot)
114import Internal.Style exposing (classes, dot)
115−import Json.Encode as Encode
115+import Json.Encode as Json
116import Set exposing (Set)
116import Set exposing (Set)
117import VirtualDom
117import VirtualDom
@@ -174,7 +174,7 @@ type Style
174 | Colored String String Color
174 | Colored String String Color
175 | SpacingStyle String Int Int
175 | SpacingStyle String Int Int
176 | BorderWidth String Int Int Int Int
176 | BorderWidth String Int Int Int Int
177− | PaddingStyle String Float Float Float Float
177+ | PaddingStyle String Int Int Int Int
178 | GridTemplateStyle
178 | GridTemplateStyle
179 { spacing : ( Length, Length )
179 { spacing : ( Length, Length )
180 , columns : List Length
180 , columns : List Length
@@ -222,7 +222,8 @@ type Font
222 | ImportFont String String
222 | ImportFont String String
223 | FontWith
223 | FontWith
224 { name : String
224 { name : String
225+ , url : Maybe String
225− , adjustment : Maybe Adjustment
226+ , adjustment : Adjustment
226 , variants : List Variant
227 , variants : List Variant
@@ -245,18 +246,6 @@ renderVariant var =
245 "\"" ++ name ++ "\" " ++ String.fromInt index
246 "\"" ++ name ++ "\" " ++ String.fromInt index
250− VariantActive name ->
256− VariantIndexed name index ->
257− name ++ "-" ++ String.fromInt index
260renderVariants typeface =
249renderVariants typeface =
261 case typeface of
250 case typeface of
262 FontWith font ->
251 FontWith font ->
@@ -372,13 +361,6 @@ type NodeName
372 | Embedded String String
361 | Embedded String String
375−type NearbyChildren msg
377− | ChildrenBehind (List (Html.Html msg))
378− | ChildrenInFront (List (Html.Html msg))
379− | ChildrenBehindAndInFront (List (Html.Html msg)) (List (Html.Html msg))
@@ -387,7 +369,7 @@ type alias Gathered msg =
387 { node : NodeName
369 { node : NodeName
388 , attributes : List (VirtualDom.Attribute msg)
370 , attributes : List (VirtualDom.Attribute msg)
389 , styles : List Style
371 , styles : List Style
390− , children : NearbyChildren msg
372+ , children : List (VirtualDom.Node msg)
391 , has : Flag.Field
373 , has : Flag.Field
@@ -455,10 +437,7 @@ finalizeNode has node attributes children embedMode parentContext =
455 Embedded nodeName internal ->
437 Embedded nodeName internal ->
456 VirtualDom.node nodeName
438 VirtualDom.node nodeName
457 attributes
439 attributes
458− [ createNode internal
459− [ Html.Attributes.class
460− (classes.any ++ " " ++ classes.single)
440+ [ createNode internal [ Html.Attributes.class (classes.any ++ " " ++ classes.single) ]
464 case parentContext of
443 case parentContext of
@@ -535,45 +514,49 @@ finalizeNode has node attributes children embedMode parentContext =
537embedWith static opts styles children =
516embedWith static opts styles children =
541− |> List.foldl reduceStyles ( Set.empty, renderFocusStyle opts.focus )
543− -- |> reduceStylesRecursive Set.empty [ ]) --renderFocusStyle opts.focus ]
545− |> toStyleSheet opts
547 if static then
517 if static then
548− staticRoot opts
518+ staticRoot
549− :: dynamicStyleSheet
519+ :: (styles
520+ |> List.foldl reduceStyles ( Set.empty, [ renderFocusStyle opts.focus ] )
522+ -- |> reduceStylesRecursive Set.empty [ ]) --renderFocusStyle opts.focus ]
524+ |> toStyleSheet opts
550 :: children
526 :: children
553− dynamicStyleSheet
529+ (styles
530+ |> List.foldl reduceStyles ( Set.empty, [ renderFocusStyle opts.focus ] )
532+ -- |> reduceStylesRecursive Set.empty [ ]) --renderFocusStyle opts.focus ]
534+ |> toStyleSheet opts
554 :: children
536 :: children
557embedKeyed static opts styles children =
539embedKeyed static opts styles children =
561− |> List.foldl reduceStyles ( Set.empty, renderFocusStyle opts.focus )
563− -- |> reduceStylesRecursive Set.empty [ ]) --renderFocusStyle opts.focus ]
565− |> toStyleSheet opts
567 if static then
540 if static then
568− ( "static-stylesheet", staticRoot opts )
541+ ( "static-stylesheet", staticRoot )
569 :: ( "dynamic-stylesheet"
542 :: ( "dynamic-stylesheet"
570− , dynamicStyleSheet
543+ , styles
544+ |> List.foldl reduceStyles ( Set.empty, [ renderFocusStyle opts.focus ] )
546+ -- |> reduceStylesRecursive Set.empty [ ]) --renderFocusStyle opts.focus ]
548+ |> toStyleSheet opts
572 :: children
550 :: children
575 ( "dynamic-stylesheet"
553 ( "dynamic-stylesheet"
576− , dynamicStyleSheet
554+ , styles
555+ |> List.foldl reduceStyles ( Set.empty, [ renderFocusStyle opts.focus ] )
557+ -- |> reduceStylesRecursive Set.empty [ ]) --renderFocusStyle opts.focus ]
559+ |> toStyleSheet opts
578 :: children
561 :: children
@@ -889,16 +872,7 @@ skippable flag style =
892−gatherAttrRecursive :
875+gatherAttrRecursive : String -> NodeName -> Flag.Field -> Transformation -> List Style -> List (VirtualDom.Attribute msg) -> List (VirtualDom.Node msg) -> List (Attribute aligned msg) -> Gathered msg
898− -> List (VirtualDom.Attribute msg)
899− -> NearbyChildren msg
900− -> List (Attribute aligned msg)
902gatherAttrRecursive classes node has transform styles attrs children elementAttrs =
876gatherAttrRecursive classes node has transform styles attrs children elementAttrs =
903 case elementAttrs of
877 case elementAttrs of
@@ -1032,7 +1006,7 @@ gatherAttrRecursive classes node has transform styles attrs children elementAttr
1033 gatherAttrRecursive (classes ++ " " ++ newClass)
1007 gatherAttrRecursive (classes ++ " " ++ newClass)
1035− (Flag.merge addToFlags (Flag.add Flag.width has))
1009+ (Flag.merge addToFlags has)
1036 transform
1010 transform
1037 (newStyles ++ styles)
1011 (newStyles ++ styles)
@@ -1053,7 +1027,7 @@ gatherAttrRecursive classes node has transform styles attrs children elementAttr
1054 "height-px-" ++ val
1028 "height-px-" ++ val
1056− gatherAttrRecursive (Internal.Style.classes.heightExact ++ " " ++ name ++ " " ++ classes)
1030+ gatherAttrRecursive (name ++ " " ++ classes)
1058 (Flag.add Flag.height has)
1032 (Flag.add Flag.height has)
1059 transform
1033 transform
@@ -1110,7 +1084,7 @@ gatherAttrRecursive classes node has transform styles attrs children elementAttr
1111 gatherAttrRecursive (classes ++ " " ++ newClass)
1085 gatherAttrRecursive (classes ++ " " ++ newClass)
1113− (Flag.merge addToFlags (Flag.add Flag.height has))
1087+ (Flag.merge addToFlags has)
1114 transform
1088 transform
1115 (newStyles ++ styles)
1089 (newStyles ++ styles)
@@ -1142,15 +1116,20 @@ gatherAttrRecursive classes node has transform styles attrs children elementAttr
1142 gatherAttrRecursive classes (addNodeName "h6" node) has transform styles attrs children remaining
1116 gatherAttrRecursive classes (addNodeName "h6" node) has transform styles attrs children remaining
1144 Paragraph ->
1118 Paragraph ->
1145− -- previously we rendered a <p> tag, though apparently this invalidates the html if it has <div>s inside.
1119+ let
1146− -- Since we can't guaranteee that there are no divs, we need another strategy.
1120+ newNode =
1147− -- While it's not documented in many places, there apparently is a paragraph aria role
1121+ case node of
1148− -- https://github.com/w3c/aria/blob/11f85f41a5b621fdbe85fc9bcdcd270e653a48ba/common/script/roleInfo.js
1122+ Generic ->
1149− -- Though we'll need to wait till it gets released in an official wai-aria spec to use it.
1123+ NodeName "p"
1150− -- If it's used at the moment, then Lighthouse complains (likely rightfully) that role paragraph is not recognized.
1124+
1151− gatherAttrRecursive
1131+ gatherAttrRecursive classes
1152− classes
1132+ newNode
1155 transform
1134 transform
@@ -1185,16 +1164,75 @@ gatherAttrRecursive classes node has transform styles attrs children elementAttr
1186 Styled styled ->
1165 Styled styled ->
1187 styles ++ styled.styles
1166 styles ++ styled.styles
1170+ [ Html.Attributes.class <|
1174+ [ Internal.Style.classes.nearby
1175+ , Internal.Style.classes.single
1176+ , Internal.Style.classes.above
1181+ [ Internal.Style.classes.nearby
1182+ , Internal.Style.classes.single
1183+ , Internal.Style.classes.below
1188+ [ Internal.Style.classes.nearby
1189+ , Internal.Style.classes.single
1190+ , Internal.Style.classes.onRight
1195+ [ Internal.Style.classes.nearby
1196+ , Internal.Style.classes.single
1197+ , Internal.Style.classes.onLeft
1202+ [ Internal.Style.classes.nearby
1203+ , Internal.Style.classes.single
1204+ , Internal.Style.classes.inFront
1209+ [ Internal.Style.classes.nearby
1210+ , Internal.Style.classes.single
1211+ , Internal.Style.classes.behind
1225+ styled.html NoStyleSheet asEl
1229+ if location == Behind then
1230+ Internal.Style.classes.hasBehind ++ " " ++ classes
1189− gatherAttrRecursive
1235+ gatherAttrRecursive newClasses node has transform newStyles attrs (nearbyElement :: children) remaining
1196− (addNearbyElement location elem children)
1199 AlignX x ->
1237 AlignX x ->
1200 if Flag.present Flag.xAlign has then
1238 if Flag.present Flag.xAlign has then
@@ -1250,106 +1288,6 @@ gatherAttrRecursive classes node has transform styles attrs children elementAttr
1250 remaining
1288 remaining
1253−addNearbyElement location elem existing =
1256− nearbyElement location elem
1259− NoNearbyChildren ->
1262− ChildrenBehind [ nearby ]
1265− ChildrenInFront [ nearby ]
1267− ChildrenBehind existingBehind ->
1270− ChildrenBehind (nearby :: existingBehind)
1273− ChildrenBehindAndInFront existingBehind [ nearby ]
1275− ChildrenInFront existingInFront ->
1278− ChildrenBehindAndInFront [ nearby ] existingInFront
1281− ChildrenInFront (nearby :: existingInFront)
1283− ChildrenBehindAndInFront existingBehind existingInFront ->
1286− ChildrenBehindAndInFront (nearby :: existingBehind) existingInFront
1289− ChildrenBehindAndInFront existingBehind (nearby :: existingInFront)
1292−nearbyElement location elem =
1294− [ Html.Attributes.class <|
1298− [ Internal.Style.classes.nearby
1299− , Internal.Style.classes.single
1300− , Internal.Style.classes.above
1305− [ Internal.Style.classes.nearby
1306− , Internal.Style.classes.single
1307− , Internal.Style.classes.below
1312− [ Internal.Style.classes.nearby
1313− , Internal.Style.classes.single
1314− , Internal.Style.classes.onRight
1319− [ Internal.Style.classes.nearby
1320− , Internal.Style.classes.single
1321− , Internal.Style.classes.onLeft
1326− [ Internal.Style.classes.nearby
1327− , Internal.Style.classes.single
1328− , Internal.Style.classes.inFront
1333− [ Internal.Style.classes.nearby
1334− , Internal.Style.classes.single
1335− , Internal.Style.classes.behind
1349− styled.html NoStyleSheet asEl
1353renderWidth w =
1291renderWidth w =
1354 case w of
1292 case w of
1355 Px px ->
1293 Px px ->
@@ -1436,7 +1374,7 @@ renderHeight h =
1436 "height-px-" ++ val
1374 "height-px-" ++ val
1438 ( Flag.none
1376 ( Flag.none
1439− , Internal.Style.classes.heightExact ++ " " ++ name
1377+ , name
1440 , [ Single name "height" (val ++ "px") ]
1378 , [ Single name "height" (val ++ "px") ]
@@ -1459,7 +1397,7 @@ renderHeight h =
1459 , [ Single
1397 , [ Single
1460 (Internal.Style.classes.any
1398 (Internal.Style.classes.any
1462− ++ Internal.Style.classes.column
1400+ ++ Internal.Style.classes.row
1463 ++ " > "
1401 ++ " > "
1464 ++ (Internal.Style.dot <| "height-fill-" ++ String.fromInt portion)
1402 ++ (Internal.Style.dot <| "height-fill-" ++ String.fromInt portion)
@@ -1478,9 +1416,7 @@ renderHeight h =
1480 "min-height"
1418 "min-height"
1481− -- This needs to be !important because we're using `min-height: min-content`
1482− -- to correct for safari's incorrect implementation of flexbox.
1483− (String.fromInt minSize ++ "px !important")
1419+ (String.fromInt minSize ++ "px")
1485 ( newFlag, newAttrs, newStyle ) =
1421 ( newFlag, newAttrs, newStyle ) =
1486 renderHeight len
1422 renderHeight len
@@ -1558,7 +1494,7 @@ element : LayoutContext -> NodeName -> List (Attribute aligned msg) -> Children
1558element context node attributes children =
1494element context node attributes children =
1559 attributes
1495 attributes
1560 |> List.reverse
1496 |> List.reverse
1561− |> gatherAttrRecursive (contextClasses context) node Flag.none untransformed [] [] NoNearbyChildren
1497+ |> gatherAttrRecursive (contextClasses context) node Flag.none untransformed [] [] []
1562 |> createElement context children
1498 |> createElement context children
@@ -1625,12 +1561,13 @@ createElement context children rendered =
1625 -- , existingStyles
1561 -- , existingStyles
1628− ( (if context == asEl then
1565+ (if context == asParagraph then
1629− textElementFill str
1566+ str
1632− textElement str
1569+ str
1634 :: htmls
1571 :: htmls
1635 , existingStyles
1572 , existingStyles
@@ -1690,11 +1627,8 @@ createElement context children rendered =
1693− , if context == asEl then
1694− textElementFill str
1697− textElement str
1630+ , textElement
1699 :: htmls
1633 :: htmls
1700 , existingStyles
1634 , existingStyles
@@ -1721,8 +1655,13 @@ createElement context children rendered =
1721 (finalizeNode rendered.has
1655 (finalizeNode rendered.has
1722 rendered.node
1656 rendered.node
1723 rendered.attributes
1657 rendered.attributes
1724− (Keyed
1658+ (Keyed <|
1662+ ( "nearby-elements-pls", x )
1725− (addKeyedChildren "nearby-element-pls" keyed rendered.children)
1664+ rendered.children
1727 NoStyleSheet
1666 NoStyleSheet
@@ -1736,7 +1675,13 @@ createElement context children rendered =
1736 rendered.node
1675 rendered.node
1737 rendered.attributes
1676 rendered.attributes
1681+ ( "nearby-elements-pls", x )
1739− (addKeyedChildren "nearby-element-pls" keyed rendered.children)
1683+ rendered.children
@@ -1758,7 +1703,7 @@ createElement context children rendered =
1758 rendered.has
1703 rendered.has
1759 rendered.node
1704 rendered.node
1760 rendered.attributes
1705 rendered.attributes
1761− (Unkeyed (addChildren unkeyed rendered.children))
1706+ (Unkeyed <| unkeyed ++ rendered.children)
1762 NoStyleSheet
1707 NoStyleSheet
@@ -1770,42 +1715,10 @@ createElement context children rendered =
1770 rendered.has
1715 rendered.has
1771 rendered.node
1716 rendered.node
1772 rendered.attributes
1717 rendered.attributes
1773− (Unkeyed (addChildren unkeyed rendered.children))
1718+ (Unkeyed (unkeyed ++ rendered.children))
1777−addChildren existing nearbyChildren =
1778− case nearbyChildren of
1779− NoNearbyChildren ->
1782− ChildrenBehind behind ->
1785− ChildrenInFront inFront ->
1786− existing ++ inFront
1788− ChildrenBehindAndInFront behind inFront ->
1789− behind ++ existing ++ inFront
1792−addKeyedChildren key existing nearbyChildren =
1793− case nearbyChildren of
1794− NoNearbyChildren ->
1797− ChildrenBehind behind ->
1798− List.map (\x -> ( key, x )) behind ++ existing
1800− ChildrenInFront inFront ->
1801− existing ++ List.map (\x -> ( key, x )) inFront
1803− ChildrenBehindAndInFront behind inFront ->
1804− List.map (\x -> ( key, x )) behind
1806− ++ List.map (\x -> ( key, x )) inFront
@@ -1817,20 +1730,8 @@ defaultOptions =
1820−staticRoot : OptionRecord -> VirtualDom.Node msg
1733+staticRoot =
1824− -- wrap the style node in a div to prevent `Dark Reader` from blowin up the dom.
1825− VirtualDom.node "div"
1827− [ VirtualDom.node "style" [] [ VirtualDom.text Internal.Style.rules ] ]
1734+ VirtualDom.node "style" [] [ VirtualDom.text Internal.Style.rules ]
1829− NoStaticStyleSheet ->
1833− VirtualDom.node "elm-ui-static-rules" [ VirtualDom.property "rules" (Encode.string Internal.Style.rules) ] []
1836addWhen ifThis x to =
1737addWhen ifThis x to =
@@ -1948,7 +1849,7 @@ type Spacing
1950type Padding
1851type Padding
1951− = Padding String Float Float Float Float
1852+ = Padding String Int Int Int Int
1954extractSpacingAndPadding : List (Attribute aligned msg) -> ( Maybe Padding, Maybe Spacing )
1855extractSpacingAndPadding : List (Attribute aligned msg) -> ( Maybe Padding, Maybe Spacing )
@@ -2044,44 +1945,35 @@ getHeight attrs =
2047−textElementClasses : String
2048−textElementClasses =
2053− ++ classes.widthContent
2055− ++ classes.heightContent
2058textElement : String -> VirtualDom.Node msg
1948textElement : String -> VirtualDom.Node msg
2059textElement str =
1949textElement str =
2060 Html.div
1950 Html.div
2061 [ Html.Attributes.class
1951 [ Html.Attributes.class
2062− textElementClasses
1952+ (String.join " "
1955+ , classes.widthContent
1956+ , classes.heightContent
2064 [ Html.text str ]
1960 [ Html.text str ]
2067−textElementFillClasses : String
2068−textElementFillClasses =
2073− ++ classes.widthFill
2075− ++ classes.heightFill
2078textElementFill : String -> VirtualDom.Node msg
1963textElementFill : String -> VirtualDom.Node msg
2079textElementFill str =
1964textElementFill str =
2080− Html.div
1965+ VirtualDom.node "div"
2081− [ Html.Attributes.class
1966+ [ VirtualDom.property "className"
2082− textElementFillClasses
1967+ (Json.string <|
1971+ , classes.widthFill
1972+ , classes.heightFill
2084− [ Html.text str ]
1976+ [ VirtualDom.text str ]
2087type Children x
1979type Children x
@@ -2089,6 +1981,10 @@ type Children x
2089 | Keyed (List ( String, x ))
1981 | Keyed (List ( String, x ))
1985+-- toHtml : OptionRecord -> Element msg -> VirtualDom.Node msg
2092toHtml mode el =
1988toHtml mode el =
2093 case el of
1989 case el of
2094 Unstyled html ->
1990 Unstyled html ->
@@ -2124,7 +2020,8 @@ renderRoot optionList attributes child =
2126type RenderMode
2022type RenderMode
2127− = Layout
2024+ | Layout
2128 | NoStaticStyleSheet
2025 | NoStaticStyleSheet
2129 | WithVirtualCss
2026 | WithVirtualCss
@@ -2173,8 +2070,8 @@ rootStyle =
2173 , SansSerif
2070 , SansSerif
2176− [ StyleClass Flag.bgColor (Colored ("bg-" ++ formatColorClass (Rgba 1 1 1 0)) "background-color" (Rgba 1 1 1 0))
2073+ [ StyleClass Flag.bgColor (Colored ("bg-color-" ++ formatColorClass (Rgba 1 1 1 0)) "background-color" (Rgba 1 1 1 0))
2177− , StyleClass Flag.fontColor (Colored ("fc-" ++ formatColorClass (Rgba 0 0 0 1)) "color" (Rgba 0 0 0 1))
2074+ , StyleClass Flag.fontColor (Colored ("font-color-" ++ formatColorClass (Rgba 0 0 0 1)) "color" (Rgba 0 0 0 1))
2178 , StyleClass Flag.fontSize (FontSize 20)
2075 , StyleClass Flag.fontSize (FontSize 20)
2179 , StyleClass Flag.fontFamily <|
2076 , StyleClass Flag.fontFamily <|
2180 FontFamily (List.foldl renderFontClassName "font-" families)
2077 FontFamily (List.foldl renderFontClassName "font-" families)
@@ -2217,38 +2114,9 @@ renderFontClassName font current =
2218renderFocusStyle :
2115renderFocusStyle :
2219 FocusStyle
2116 FocusStyle
2220− -> List Style
2117+ -> Style
2221renderFocusStyle focus =
2118renderFocusStyle focus =
2222− [ Style (Internal.Style.dot classes.focusedWithin ++ ":focus-within")
2223− (List.filterMap identity
2224− [ Maybe.map (\color -> Property "border-color" (formatColor color)) focus.borderColor
2225− , Maybe.map (\color -> Property "background-color" (formatColor color)) focus.backgroundColor
2228− Property "box-shadow"
2230− { color = shadow.color
2233− |> Tuple.mapFirst toFloat
2234− |> Tuple.mapSecond toFloat
2237− toFloat shadow.blur
2239− toFloat shadow.size
2244− , Just <| Property "outline" "none"
2248− ((Internal.Style.dot classes.any ++ ":focus .focusable, ")
2249− ++ (Internal.Style.dot classes.any ++ ".focusable:focus, ")
2119+ Style (Internal.Style.dot classes.any ++ ":focus .focusable, " ++ Internal.Style.dot classes.any ++ ".focusable:focus")
2250− ++ (".ui-slide-bar:focus + " ++ Internal.Style.dot classes.any ++ " .focusable-thumb")
2252 (List.filterMap identity
2120 (List.filterMap identity
2253 [ Maybe.map (\color -> Property "border-color" (formatColor color)) focus.borderColor
2121 [ Maybe.map (\color -> Property "border-color" (formatColor color)) focus.borderColor
2254 , Maybe.map (\color -> Property "background-color" (formatColor color)) focus.backgroundColor
2122 , Maybe.map (\color -> Property "background-color" (formatColor color)) focus.backgroundColor
@@ -2271,7 +2139,6 @@ renderFocusStyle focus =
2271 , Just <| Property "outline" "none"
2139 , Just <| Property "outline" "none"
2277focusDefaultStyle : { backgroundColor : Maybe Color, borderColor : Maybe Color, shadow : Maybe Shadow }
2144focusDefaultStyle : { backgroundColor : Maybe Color, borderColor : Maybe Color, shadow : Maybe Shadow }
@@ -2283,7 +2150,7 @@ focusDefaultStyle =
2283 { color =
2150 { color =
2284 Rgba (155 / 255) (203 / 255) 1 1
2151 Rgba (155 / 255) (203 / 255) 1 1
2285 , offset = ( 0, 0 )
2152 , offset = ( 0, 0 )
2286− , blur = 0
2153+ , blur = 3
2287 , size = 3
2154 , size = 3
@@ -2353,31 +2220,7 @@ optionsToRecord options =
2354toStyleSheet : OptionRecord -> List Style -> VirtualDom.Node msg
2221toStyleSheet : OptionRecord -> List Style -> VirtualDom.Node msg
2355toStyleSheet options styleSheet =
2222toStyleSheet options styleSheet =
2356− case options.mode of
2358− -- wrap the style node in a div to prevent `Dark Reader` from blowin up the dom.
2359− VirtualDom.node "div"
2361− [ VirtualDom.node "style"
2363− [ VirtualDom.text (toStyleSheetString options styleSheet) ]
2366− NoStaticStyleSheet ->
2367− -- wrap the style node in a div to prevent `Dark Reader` from blowin up the dom.
2368− VirtualDom.node "div"
2370− [ VirtualDom.node "style"
2372− [ VirtualDom.text (toStyleSheetString options styleSheet) ]
2223+ VirtualDom.node "style" [] [ VirtualDom.text (toStyleSheetString options styleSheet) ]
2376− VirtualDom.node "elm-ui-rules"
2377− [ VirtualDom.property "rules"
2378− (encodeStyles options styleSheet)
2383renderTopLevelValues rules =
2226renderTopLevelValues rules =
@@ -2387,12 +2230,14 @@ renderTopLevelValues rules =
2387 ImportFont _ url ->
2230 ImportFont _ url ->
2388 Just ("@import url('" ++ url ++ "');")
2231 Just ("@import url('" ++ url ++ "');")
2390− -- FontWith with ->
2233+ FontWith with ->
2391− -- case with.url of
2234+ case with.url of
2392− -- Just x ->
2235+ Just x ->
2393− -- Just ("@import url('" ++ x ++ "');")
2236+ Just ("@import url('" ++ x ++ "');")
2394− -- Nothing ->
2238+ Nothing ->
2395− -- Nothing
2239+ Nothing
@@ -2463,38 +2308,7 @@ renderNullAdjustmentRule fontToAdjust otherFontName =
2466−fontRule name modifier ( parentAdj, textAdjustment ) =
2485− ++ Internal.Style.classes.text
2491− ++ Internal.Style.classes.text
2497−renderFontAdjustmentRule fontToAdjust ( full, capital ) otherFontName =
2311+renderFontAdjustmentRule fontToAdjust ( parentAdj, textAdjustment ) otherFontName =
2500 if fontToAdjust == otherFontName then
2314 if fontToAdjust == otherFontName then
@@ -2504,7 +2318,34 @@ renderFontAdjustmentRule fontToAdjust ( full, capital ) otherFontName =
2504 otherFontName ++ " ." ++ fontToAdjust
2318 otherFontName ++ " ." ++ fontToAdjust
2506 String.join " "
2320 String.join " "
2507− (fontRule name classes.sizeByCapital capital ++ fontRule name classes.fullSize full)
2325+ ++ classes.sizeByCapital
2330+ ++ classes.sizeByCapital
2337+ ++ classes.sizeByCapital
2339+ ++ Internal.Style.classes.text
2343+ ++ classes.sizeByCapital
2345+ ++ Internal.Style.classes.text
2510bracket selector rules =
2351bracket selector rules =
@@ -2517,12 +2358,17 @@ bracket selector rules =
2518fontAdjustmentRules converted =
2359fontAdjustmentRules converted =
2519 ( [ ( "display", "block" )
2360 ( [ ( "display", "block" )
2362+ -- , ( "line-height", String.fromFloat converted.height )
2363+ -- , ( "font-size", String.fromFloat (1 + converted.height + converted.vertical) ++ "em" )
2521 , [ ( "display", "inline-block" )
2365 , [ ( "display", "inline-block" )
2522 , ( "line-height", String.fromFloat converted.height )
2366 , ( "line-height", String.fromFloat converted.height )
2523 , ( "vertical-align", String.fromFloat converted.vertical ++ "em" )
2367 , ( "vertical-align", String.fromFloat converted.vertical ++ "em" )
2524 , ( "font-size", String.fromFloat converted.size ++ "em" )
2368 , ( "font-size", String.fromFloat converted.size ++ "em" )
2370+ -- , [ ( "font-size", String.fromFloat converted.size ++ "em" )
@@ -2533,17 +2379,10 @@ typefaceAdjustment typefaces =
2533 Nothing ->
2379 Nothing ->
2534 case face of
2380 case face of
2535 FontWith with ->
2381 FontWith with ->
2536− case with.adjustment of
2540− Just adjustment ->
2382+ Just
2542− ( fontAdjustmentRules
2383+ (fontAdjustmentRules
2543− (.full (convertAdjustment adjustment))
2544− , fontAdjustmentRules
2545− (.capital (convertAdjustment adjustment))
2384+ (.capital (convertAdjustment with.adjustment))
@@ -2593,492 +2432,489 @@ renderProps force (Property key val) existing =
2593 existing ++ "\n " ++ key ++ ": " ++ val ++ ";"
2432 existing ++ "\n " ++ key ++ ": " ++ val ++ ";"
2596−encodeStyles options stylesheet =
2602− renderStyleRule options style Nothing
2604− ( getStyleName style, Encode.list Encode.string styled )
2609toStyleSheetString : OptionRecord -> List Style -> String
2435toStyleSheetString : OptionRecord -> List Style -> String
2610toStyleSheetString options stylesheet =
2436toStyleSheetString options stylesheet =
2612− combine style rendered =
2438+ renderStyle maybePseudo selector props =
2613− { rules = rendered.rules ++ renderStyleRule options style Nothing
2439+ case maybePseudo of
2615− case topLevelValue style of
2616− Nothing ->
2440+ Nothing ->
2617− rendered.topLevel
2441+ selector ++ "{" ++ List.foldl (renderProps False) "" props ++ "\n}"
2619− Just topLevel ->
2443+ Just pseudo ->
2620− topLevel :: rendered.topLevel
2444+ case pseudo of
2622− in
2446+ case options.hover of
2623− case List.foldl combine { topLevel = [], rules = [] } stylesheet of
2447+ NoHover ->
2624− { topLevel, rules } ->
2448+ ""
2625− renderTopLevelValues topLevel ++ String.concat rules
2451+ selector ++ "-hv {" ++ List.foldl (renderProps True) "" props ++ "\n}"
2628−renderStyle : OptionRecord -> Maybe PseudoClass -> String -> List Property -> List String
2453+ AllowHover ->
2629−renderStyle options maybePseudo selector props =
2630− case maybePseudo of
2632− [ selector ++ "{" ++ List.foldl (renderProps False) "" props ++ "\n}" ]
2454+ selector ++ "-hv:hover {" ++ List.foldl (renderProps False) "" props ++ "\n}"
2634− Just pseudo ->
2456+ Focus ->
2635− case pseudo of
2457+ let
2636− Hover ->
2458+ renderedProps =
2637− case options.hover of
2459+ List.foldl (renderProps False) "" props
2470+ ++ "-fs:not(.focus) {"
2480+ , ".focusable-parent:focus ~ "
2641− ForceHover ->
2490+ Active ->
2642− [ selector ++ "-hv {" ++ List.foldl (renderProps True) "" props ++ "\n}" ]
2491+ selector ++ "-act:active {" ++ List.foldl (renderProps False) "" props ++ "\n}"
2644− AllowHover ->
2493+ renderStyleRule rule maybePseudo =
2645− [ selector ++ "-hv:hover {" ++ List.foldl (renderProps False) "" props ++ "\n}" ]
2494+ case rule of
2495+ Style selector props ->
2496+ renderStyle maybePseudo selector props
2647− Focus ->
2498+ Shadows name prop ->
2502+ [ Property "box-shadow" prop
2505+ Transparency name transparency ->
2649− renderedProps =
2507+ opacity =
2650− List.foldl (renderProps False) "" props
2508+ (1 - transparency)
2652− [ selector ++ "-fs:focus {" ++ renderedProps ++ "\n}"
2512+ renderStyle
2653− , ("." ++ classes.any ++ ":focus " ++ selector ++ "-fs {")
2513+ maybePseudo
2656− , (selector ++ "-fs:focus-within {")
2659− , (".ui-slide-bar:focus + " ++ Internal.Style.dot classes.any ++ " .focusable-thumb" ++ selector ++ "-fs {")
2665− [ selector ++ "-act:active {" ++ List.foldl (renderProps False) "" props ++ "\n}" ]
2668−renderStyleRule : OptionRecord -> Style -> Maybe PseudoClass -> List String
2669−renderStyleRule options rule maybePseudo =
2671− Style selector props ->
2672− renderStyle options maybePseudo selector props
2674− Shadows name prop ->
2675− renderStyle options
2677− ("." ++ name)
2514+ ("." ++ name)
2678− [ Property "box-shadow" prop
2681− Transparency name transparency ->
2688− renderStyle options
2691− [ Property "opacity" (String.fromFloat opacity)
2515+ [ Property "opacity" (String.fromFloat opacity)
2695− renderStyle options
2697− (".font-size-" ++ String.fromInt i)
2698− [ Property "font-size" (String.fromInt i ++ "px")
2701− FontFamily name typefaces ->
2705− |> List.filterMap renderVariants
2706− |> String.join ", "
2709− [ Property "font-family"
2711− |> List.map fontName
2712− |> String.join ", "
2714− , Property "font-feature-settings" features
2715− , Property "font-variant"
2716− (if List.any hasSmallCaps typefaces then
2724− renderStyle options
2729− Single class prop val ->
2730− renderStyle options
2733− [ Property prop val
2736− Colored class prop color ->
2518+ FontSize i ->
2737− renderStyle options
2519+ renderStyle
2738− maybePseudo
2520+ maybePseudo
2739− ("." ++ class)
2521+ (".font-size-" ++ String.fromInt i)
2740− [ Property prop (formatColor color)
2522+ [ Property "font-size" (String.fromInt i ++ "px")
2743− SpacingStyle cls x y ->
2525+ FontFamily name typefaces ->
2745− class =
2527+ features =
2746− "." ++ cls
2528+ typefaces
2529+ |> List.filterMap renderVariants
2530+ |> String.join ", "
2533+ [ Property "font-family"
2535+ |> List.map fontName
2536+ |> String.join ", "
2538+ , Property "font-feature-settings" features
2539+ , Property "font-variant"
2540+ (if List.any hasSmallCaps typefaces then
2749− String.fromFloat (toFloat x / 2) ++ "px"
2544+ "normal"
2751− halfY =
2555+ Single class prop val ->
2752− String.fromFloat (toFloat y / 2) ++ "px"
2556+ renderStyle
2559+ [ Property prop val
2754− xPx =
2562+ Colored class prop color ->
2755− String.fromInt x ++ "px"
2563+ renderStyle
2566+ [ Property prop (formatColor color)
2757− yPx =
2569+ SpacingStyle cls x y ->
2758− String.fromInt y ++ "px"
2570+ let
2761− "." ++ Internal.Style.classes.row
2575+ String.fromFloat (toFloat x / 2) ++ "px"
2763− wrappedRow =
2577+ halfY =
2764− "." ++ Internal.Style.classes.wrapped ++ row
2578+ String.fromFloat (toFloat y / 2) ++ "px"
2766− column =
2580+ xPx =
2767− "." ++ Internal.Style.classes.column
2581+ String.fromInt x ++ "px"
2770− "." ++ Internal.Style.classes.page
2584+ String.fromInt y ++ "px"
2772− paragraph =
2586+ row =
2773− "." ++ Internal.Style.classes.paragraph
2587+ "." ++ Internal.Style.classes.row
2775− left =
2589+ wrappedRow =
2776− "." ++ Internal.Style.classes.alignLeft
2590+ "." ++ Internal.Style.classes.wrapped ++ row
2778− right =
2592+ column =
2779− "." ++ Internal.Style.classes.alignRight
2593+ "." ++ Internal.Style.classes.column
2782− "." ++ Internal.Style.classes.any
2596+ "." ++ Internal.Style.classes.page
2784− single =
2598+ paragraph =
2785− "." ++ Internal.Style.classes.single
2599+ "." ++ Internal.Style.classes.paragraph
2788− [ renderStyle options maybePseudo (class ++ row ++ " > " ++ any ++ " + " ++ any) [ Property "margin-left" xPx ]
2790− -- margins don't apply to last element of normal, unwrapped rows
2791− -- , renderStyle options maybePseudo (class ++ row ++ " > " ++ any ++ ":first-child") [ Property "margin" "0" ]
2792− -- For wrapped rows, margins always apply because we handle "canceling out" the other margins manually in the element.
2793− , renderStyle options
2795− (class ++ wrappedRow ++ " > " ++ any)
2796− [ Property "margin" (halfY ++ " " ++ halfX)
2799− -- , renderStyle options maybePseudo
2601+ left =
2800− -- (class ++ wrappedRow ++ " > " ++ any ++ ":last-child")
2602+ "." ++ Internal.Style.classes.alignLeft
2801− -- [ Property "margin-right" "0"
2804− , renderStyle options maybePseudo (class ++ column ++ " > " ++ any ++ " + " ++ any) [ Property "margin-top" yPx ]
2805− , renderStyle options maybePseudo (class ++ page ++ " > " ++ any ++ " + " ++ any) [ Property "margin-top" yPx ]
2806− , renderStyle options maybePseudo (class ++ page ++ " > " ++ left) [ Property "margin-right" xPx ]
2807− , renderStyle options maybePseudo (class ++ page ++ " > " ++ right) [ Property "margin-left" xPx ]
2808− , renderStyle options
2810− (class ++ paragraph)
2811− [ Property "line-height" ("calc(1em + " ++ String.fromInt y ++ "px)")
2813− , renderStyle options
2815− ("textarea" ++ any ++ class)
2816− [ Property "line-height" ("calc(1em + " ++ String.fromInt y ++ "px)")
2817− , Property "height" ("calc(100% + " ++ String.fromInt y ++ "px)")
2820− -- , renderStyle options
2604+ right =
2821− -- maybePseudo
2605+ "." ++ Internal.Style.classes.alignRight
2822− -- (class ++ paragraph ++ " > " ++ any)
2823− -- [ Property "margin-right" xPx
2824− -- , Property "margin-bottom" yPx
2826− , renderStyle options
2828− (class ++ paragraph ++ " > " ++ left)
2829− [ Property "margin-right" xPx
2831− , renderStyle options
2833− (class ++ paragraph ++ " > " ++ right)
2834− [ Property "margin-left" xPx
2836− , renderStyle options
2838− (class ++ paragraph ++ "::after")
2839− [ Property "content" "''"
2840− , Property "display" "block"
2841− , Property "height" "0"
2842− , Property "width" "0"
2843− , Property "margin-top" (String.fromInt (-1 * (y // 2)) ++ "px")
2845− , renderStyle options
2847− (class ++ paragraph ++ "::before")
2848− [ Property "content" "''"
2849− , Property "display" "block"
2850− , Property "height" "0"
2851− , Property "width" "0"
2852− , Property "margin-bottom" (String.fromInt (-1 * (y // 2)) ++ "px")
2856− PaddingStyle cls top right bottom left ->
2607+ any =
2857− let
2608+ "." ++ Internal.Style.classes.any
2862− renderStyle options
2865− [ Property "padding"
2866− (String.fromFloat top
2868− ++ String.fromFloat right
2870− ++ String.fromFloat bottom
2872− ++ String.fromFloat left
2877− BorderWidth cls top right bottom left ->
2610+ single =
2878− let
2611+ "." ++ Internal.Style.classes.single
2883− renderStyle options
2886− [ Property "border-width"
2887− (String.fromInt top
2889− ++ String.fromInt right
2891− ++ String.fromInt bottom
2893− ++ String.fromInt left
2898− GridTemplateStyle template ->
2902− ++ String.join "-" (List.map lengthClassName template.rows)
2904− ++ String.join "-" (List.map lengthClassName template.columns)
2906− ++ lengthClassName (Tuple.first template.spacing)
2908− ++ lengthClassName (Tuple.second template.spacing)
2911− toGridLength (Tuple.second template.spacing)
2914− toGridLength (Tuple.first template.spacing)
2917− toGridLengthHelper Nothing Nothing x
2919− toGridLengthHelper minimum maximum x =
2922− String.fromInt px ++ "px"
2613+ String.concat
2923−
2614+ [ renderStyle maybePseudo (class ++ row ++ " > " ++ any ++ " + " ++ any) [ Property "margin-left" xPx ]
2925− case ( minimum, maximum ) of
2616+ -- margins don't apply to last element of normal, unwrapped rows
2926− ( Nothing, Nothing ) ->
2617+ -- , renderStyle maybePseudo (class ++ row ++ " > " ++ any ++ ":first-child") [ Property "margin" "0" ]
2927− "max-content"
2618+ -- For wrapped rows, margins always apply because we handle "canceling out" the other margins manually in the element.
2928−
2619+ , renderStyle maybePseudo
2929− ( Just minSize, Nothing ) ->
2620+ (class ++ wrappedRow ++ " > " ++ any)
2930− "minmax(" ++ String.fromInt minSize ++ "px, " ++ "max-content)"
2621+ [ Property "margin" (halfY ++ " " ++ halfX)
2932− ( Nothing, Just maxSize ) ->
2933− "minmax(max-content, " ++ String.fromInt maxSize ++ "px)"
2935− ( Just minSize, Just maxSize ) ->
2936− "minmax(" ++ String.fromInt minSize ++ "px, " ++ String.fromInt maxSize ++ "px)"
2939− case ( minimum, maximum ) of
2940− ( Nothing, Nothing ) ->
2941− String.fromInt i ++ "fr"
2943− ( Just minSize, Nothing ) ->
2944− "minmax(" ++ String.fromInt minSize ++ "px, " ++ String.fromInt i ++ "fr" ++ "fr)"
2946− ( Nothing, Just maxSize ) ->
2947− "minmax(max-content, " ++ String.fromInt maxSize ++ "px)"
2949− ( Just minSize, Just maxSize ) ->
2950− "minmax(" ++ String.fromInt minSize ++ "px, " ++ String.fromInt maxSize ++ "px)"
2953− toGridLengthHelper (Just m) maximum len
2956− toGridLengthHelper minimum (Just m) len
2960− |> List.map toGridLength
2961− |> String.join ySpacing
2962− |> (\x -> "-ms-grid-columns: " ++ x ++ ";")
2966− |> List.map toGridLength
2967− |> String.join ySpacing
2968− |> (\x -> "-ms-grid-rows: " ++ x ++ ";")
2971− class ++ "{" ++ msColumns ++ msRows ++ "}"
2975− |> List.map toGridLength
2977− |> (\x -> "grid-template-columns: " ++ x ++ ";")
2981− |> List.map toGridLength
2983− |> (\x -> "grid-template-rows: " ++ x ++ ";")
2986− "grid-column-gap:" ++ toGridLength (Tuple.first template.spacing) ++ ";"
2988− gapY =
2624+ -- , renderStyle maybePseudo
2989− "grid-row-gap:" ++ toGridLength (Tuple.second template.spacing) ++ ";"
2625+ -- (class ++ wrappedRow ++ " > " ++ any ++ ":last-child")
2626+ -- [ Property "margin-right" "0"
2629+ , renderStyle maybePseudo (class ++ column ++ " > " ++ any ++ " + " ++ any) [ Property "margin-top" yPx ]
2630+ , renderStyle maybePseudo (class ++ page ++ " > " ++ any ++ " + " ++ any) [ Property "margin-top" yPx ]
2631+ , renderStyle maybePseudo (class ++ page ++ " > " ++ left) [ Property "margin-right" xPx ]
2632+ , renderStyle maybePseudo (class ++ page ++ " > " ++ right) [ Property "margin-left" xPx ]
2635+ (class ++ paragraph)
2636+ [ Property "line-height" ("calc(1em + " ++ String.fromInt y ++ "px)")
2640+ ("textarea" ++ class)
2641+ [ Property "line-height" ("calc(1em + " ++ String.fromInt y ++ "px)")
2991− modernGrid =
2644+ -- , renderStyle
2992− class ++ "{" ++ columns ++ rows ++ gapX ++ gapY ++ "}"
2645+ -- maybePseudo
2646+ -- (class ++ paragraph ++ " > " ++ any)
2647+ -- [ Property "margin-right" xPx
2648+ -- , Property "margin-bottom" yPx
2652+ (class ++ paragraph ++ " > " ++ left)
2653+ [ Property "margin-right" xPx
2657+ (class ++ paragraph ++ " > " ++ right)
2658+ [ Property "margin-left" xPx
2662+ (class ++ paragraph ++ "::after")
2663+ [ Property "content" "''"
2664+ , Property "display" "block"
2665+ , Property "height" "0"
2666+ , Property "width" "0"
2667+ , Property "margin-top" (String.fromInt (-1 * (y // 2)) ++ "px")
2671+ (class ++ paragraph ++ "::before")
2672+ [ Property "content" "''"
2673+ , Property "display" "block"
2674+ , Property "height" "0"
2675+ , Property "width" "0"
2676+ , Property "margin-bottom" (String.fromInt (-1 * (y // 2)) ++ "px")
2994− supports =
2680+ PaddingStyle cls top right bottom left ->
2995− "@supports (display:grid) {" ++ modernGrid ++ "}"
2681+ let
2997− [ base
2686+ renderStyle
2998− , supports
2687+ maybePseudo
2689+ [ Property "padding"
2690+ (String.fromInt top
2692+ ++ String.fromInt right
2694+ ++ String.fromInt bottom
2696+ ++ String.fromInt left
3001− GridPosition position ->
2701+ BorderWidth cls top right bottom left ->
3003− class =
2703+ class =
3004− ".grid-pos-"
2704+ "."
3005− ++ String.fromInt position.row
2705+ ++ cls
3007− ++ String.fromInt position.col
2707+ renderStyle
3008− ++ "-"
2708+ maybePseudo
3009− ++ String.fromInt position.width
2709+ class
3010− ++ "-"
2710+ [ Property "border-width"
3011− ++ String.fromInt position.height
3016− ++ String.fromInt position.row
2711+ (String.fromInt top
3017− ++ ";"
2712+ ++ "px "
3018− , "-ms-grid-row-span: "
3019− ++ String.fromInt position.height
2713+ ++ String.fromInt right
3020− ++ ";"
2714+ ++ "px "
3021− , "-ms-grid-column: "
3022− ++ String.fromInt position.col
2715+ ++ String.fromInt bottom
3023− ++ ";"
2716+ ++ "px "
3024− , "-ms-grid-column-span: "
3025− ++ String.fromInt position.width
2717+ ++ String.fromInt left
3026− ++ ";"
2718+ ++ "px"
2722+ GridTemplateStyle template ->
2726+ ++ String.join "-" (List.map lengthClassName template.rows)
2728+ ++ String.join "-" (List.map lengthClassName template.columns)
2730+ ++ lengthClassName (Tuple.first template.spacing)
2732+ ++ lengthClassName (Tuple.second template.spacing)
2735+ toGridLength (Tuple.second template.spacing)
2738+ toGridLength (Tuple.first template.spacing)
2741+ toGridLengthHelper Nothing Nothing x
2743+ toGridLengthHelper minimum maximum x =
2746+ String.fromInt px ++ "px"
2749+ case ( minimum, maximum ) of
2750+ ( Nothing, Nothing ) ->
2753+ ( Just minSize, Nothing ) ->
2754+ "minmax(" ++ String.fromInt minSize ++ "px, " ++ "max-content)"
2756+ ( Nothing, Just maxSize ) ->
2757+ "minmax(max-content, " ++ String.fromInt maxSize ++ "px)"
2759+ ( Just minSize, Just maxSize ) ->
2760+ "minmax(" ++ String.fromInt minSize ++ "px, " ++ String.fromInt maxSize ++ "px)"
2763+ case ( minimum, maximum ) of
2764+ ( Nothing, Nothing ) ->
2765+ String.fromInt i ++ "fr"
2767+ ( Just minSize, Nothing ) ->
2768+ "minmax(" ++ String.fromInt minSize ++ "px, " ++ String.fromInt i ++ "fr" ++ "fr)"
2770+ ( Nothing, Just maxSize ) ->
2771+ "minmax(max-content, " ++ String.fromInt maxSize ++ "px)"
2773+ ( Just minSize, Just maxSize ) ->
2774+ "minmax(" ++ String.fromInt minSize ++ "px, " ++ String.fromInt maxSize ++ "px)"
2777+ toGridLengthHelper (Just m) maximum len
2780+ toGridLengthHelper minimum (Just m) len
2784+ |> List.map toGridLength
2785+ |> String.join ySpacing
2786+ |> (\x -> "-ms-grid-columns: " ++ x ++ ";")
2790+ |> List.map toGridLength
2791+ |> String.join ySpacing
2792+ |> (\x -> "-ms-grid-rows: " ++ x ++ ";")
3030− class ++ "{" ++ msPosition ++ "}"
2795+ class ++ "{" ++ msColumns ++ msRows ++ "}"
2799+ |> List.map toGridLength
2801+ |> (\x -> "grid-template-columns: " ++ x ++ ";")
2805+ |> List.map toGridLength
2807+ |> (\x -> "grid-template-rows: " ++ x ++ ";")
2810+ "grid-column-gap:" ++ toGridLength (Tuple.first template.spacing) ++ ";"
2813+ "grid-row-gap:" ++ toGridLength (Tuple.second template.spacing) ++ ";"
2816+ class ++ "{" ++ columns ++ rows ++ gapX ++ gapY ++ "}"
2819+ "@supports (display:grid) {" ++ modernGrid ++ "}"
2823+ GridPosition position ->
2827+ ++ String.fromInt position.row
2829+ ++ String.fromInt position.col
2831+ ++ String.fromInt position.width
2833+ ++ String.fromInt position.height
2838+ ++ String.fromInt position.row
2840+ , "-ms-grid-row-span: "
2841+ ++ String.fromInt position.height
2843+ , "-ms-grid-column: "
2844+ ++ String.fromInt position.col
2846+ , "-ms-grid-column-span: "
2847+ ++ String.fromInt position.width
2852+ class ++ "{" ++ msPosition ++ "}"
3032− modernPosition =
2854+ modernPosition =
3033− String.join " "
2855+ String.join " "
3034− [ "grid-row: "
2856+ [ "grid-row: "
3035− ++ String.fromInt position.row
2857+ ++ String.fromInt position.row
3036− ++ " / "
2858+ ++ " / "
3037− ++ String.fromInt (position.row + position.height)
2859+ ++ String.fromInt (position.row + position.height)
3039− , "grid-column: "
2861+ , "grid-column: "
3040− ++ String.fromInt position.col
2862+ ++ String.fromInt position.col
3041− ++ " / "
2863+ ++ " / "
3042− ++ String.fromInt (position.col + position.width)
2864+ ++ String.fromInt (position.col + position.width)
2869+ class ++ "{" ++ modernPosition ++ "}"
2872+ "@supports (display:grid) {" ++ modernGrid ++ "}"
3046− modernGrid =
2876+ PseudoSelector class styles ->
3047− class ++ "{" ++ modernPosition ++ "}"
2877+ let
2878+ renderPseudoRule style =
2879+ renderStyleRule style (Just class)
2881+ List.map renderPseudoRule styles
3049− supports =
2884+ Transform transform ->
3050− "@supports (display:grid) {" ++ modernGrid ++ "}"
2885+ let
3052− [ base
2887+ transformValue transform
3056− PseudoSelector class styles ->
2889+ class =
3057− let
2890+ transformClass transform
3058− renderPseudoRule style =
3059− renderStyleRule options style (Just class)
3061− List.concatMap renderPseudoRule styles
2892+ case ( class, val ) of
2893+ ( Just cls, Just v ) ->
2897+ [ Property "transform"
3063− Transform transform ->
2901+ _ ->
3066− transformValue transform
3068− class =
2904+ combine style rendered =
3069− transformClass transform
2905+ { rules = rendered.rules ++ renderStyleRule style Nothing
3070− in
2906+ , topLevel =
3071− case ( class, val ) of
2907+ case topLevelValue style of
3072− ( Just cls, Just v ) ->
2908+ Nothing ->
3073− renderStyle options
2909+ rendered.topLevel
3076− [ Property "transform"
3080− _ ->
2911+ Just topLevel ->
3081− []
2912+ topLevel :: rendered.topLevel
2915+ case List.foldl combine { topLevel = [], rules = "" } stylesheet of
2916+ { topLevel, rules } ->
2917+ renderTopLevelValues topLevel ++ rules
3084lengthClassName : Length -> String
2920lengthClassName : Length -> String
@@ -3118,12 +2954,12 @@ formatTextShadow shadow =
3121−textShadowClass shadow =
2957+textShadowName shadow =
3122 String.concat
2958 String.concat
3124− , floatClass (Tuple.first shadow.offset) ++ "px"
2960+ , String.fromFloat (Tuple.first shadow.offset) ++ "px"
3125− , floatClass (Tuple.second shadow.offset) ++ "px"
2961+ , String.fromFloat (Tuple.second shadow.offset) ++ "px"
3126− , floatClass shadow.blur ++ "px"
2962+ , String.fromFloat shadow.blur ++ "px"
3127 , formatColorClass shadow.color
2963 , formatColorClass shadow.color
@@ -3144,17 +2980,17 @@ formatBoxShadow shadow =
3147−boxShadowClass shadow =
2983+boxShadowName shadow =
3148 String.concat <|
2984 String.concat <|
3149 [ if shadow.inset then
2985 [ if shadow.inset then
3150 "box-inset"
2986 "box-inset"
3154− , floatClass (Tuple.first shadow.offset) ++ "px"
2990+ , String.fromFloat (Tuple.first shadow.offset) ++ "px"
3155− , floatClass (Tuple.second shadow.offset) ++ "px"
2991+ , String.fromFloat (Tuple.second shadow.offset) ++ "px"
3156− , floatClass shadow.blur ++ "px"
2992+ , String.fromFloat shadow.blur ++ "px"
3157− , floatClass shadow.size ++ "px"
2993+ , String.fromFloat shadow.size ++ "px"
3158 , formatColorClass shadow.color
2994 , formatColorClass shadow.color
@@ -3199,17 +3035,6 @@ paddingName top right bottom left =
3199 ++ String.fromInt left
3035 ++ String.fromInt left
3202−paddingNameFloat top right bottom left =
3206− ++ floatClass right
3208− ++ floatClass bottom
3213getStyleName : Style -> String
3038getStyleName : Style -> String
3214getStyleName style =
3039getStyleName style =
3215 case style of
3040 case style of
@@ -3527,16 +3352,16 @@ convertAdjustment adjustment =
3527 capitalSize =
3352 capitalSize =
3528 1 / (ascender - newBaseline)
3353 1 / (ascender - newBaseline)
3531− 1 / (ascender - descender)
3533 fullVertical =
3355 fullVertical =
3536− -- (oldMiddle - newFullMiddle) * 2
3356+ (oldMiddle - newFullMiddle) * 2
3538 { full =
3358 { full =
3359+ { vertical = fullVertical
3539− adjust fullSize (ascender - descender) fullVertical
3361+ (ascender - descender)
3540 , capital =
3365 , capital =
3541 adjust capitalSize (ascender - newBaseline) capitalVertical
3366 adjust capitalSize (ascender - newBaseline) capitalVertical
@@ -3546,5 +3371,7 @@ adjust size height vertical =
3546 { vertical = vertical
3371 { vertical = vertical
3547 , height =
3372 , height =
3548 height / size
3373 height / size
3549 , size = size
3376 , size = size