2 ( Element, none, text, el
3 , row, wrappedRow, column
4 , paragraph, textColumn
5 , Column, table, IndexedColumn, indexedTable
6 , Attribute, width, height, Length, px, shrink, fill, fillPortion, maximum, minimum
8 , padding, paddingXY, paddingEach
9 , spacing, spacingXY, spaceEvenly
10 , centerX, centerY, alignLeft, alignRight, alignTop, alignBottom
11 , transparent, alpha, pointer
12 , moveUp, moveDown, moveRight, moveLeft, rotate, scale
14 , scrollbars, scrollbarX, scrollbarY
15 , layout, layoutWith, Option, noStaticStyleSheet, forceHover, noHover, focusStyle, FocusStyle
16 , link, newTabLink, download, downloadAs
18 , Color, rgba, rgb, rgb255, rgba255, fromRgb, fromRgb255, toRgb
19 , above, below, onRight, onLeft, inFront, behindContent
20 , Attr, Decoration, mouseOver, mouseDown, focused
21 , Device, DeviceClass(..), Orientation(..), classifyDevice
32@docs Element, none, text, el
37When we want more than one child on an element, we want to be _specific_ about how they will be laid out.
39So, the common ways to do that would be `row` and `column`.
41@docs row, wrappedRow, column
46Text layout needs some specific considerations.
48@docs paragraph, textColumn
53@docs Column, table, IndexedColumn, indexedTable
58@docs Attribute, width, height, Length, px, shrink, fill, fillPortion, maximum, minimum
68There's no concept of margin in `elm-ui`, instead we have padding and spacing.
70Padding is the distance between the outer edge and the content, and spacing is the space between children.
72So, if we have the following row, with some padding and spacing.
74 Element.row [ padding 10, spacing 7 ]
80Here's what we can expect:
82
84**Note** `spacing` set on a `paragraph`, will set the pixel spacing between lines.
86@docs padding, paddingXY, paddingEach
88@docs spacing, spacingXY, spaceEvenly
93Alignment can be used to align an `Element` within another `Element`.
95 Element.el [ centerX, alignTop ] (text "I'm centered and aligned top!")
97If alignment is set on elements in a layout such as `row`, then the element will push the other elements in that direction. Here's an example.
100 [ Element.el [] Element.none
101 , Element.el [ alignLeft ] Element.none
102 , Element.el [ centerX ] Element.none
103 , Element.el [ alignRight ] Element.none
106will result in a layout like
110Where there are two elements on the left, one on the right, and one in the center of the space between the elements on the left and right.
112**Note** For text alignment, check out `Element.Font`!
114@docs centerX, centerY, alignLeft, alignRight, alignTop, alignBottom
119@docs transparent, alpha, pointer
124@docs moveUp, moveDown, moveRight, moveLeft, rotate, scale
127# Clipping and Scrollbars
129Clip the content if it overflows.
131@docs clip, clipX, clipY
133Add a scrollbar if the content is larger than the element.
135@docs scrollbars, scrollbarX, scrollbarY
140@docs layout, layoutWith, Option, noStaticStyleSheet, forceHover, noHover, focusStyle, FocusStyle
145@docs link, newTabLink, download, downloadAs
155In order to use attributes like `Font.color` and `Background.color`, you'll need to make some colors!
157@docs Color, rgba, rgb, rgb255, rgba255, fromRgb, fromRgb255, toRgb
162Let's say we want a dropdown menu. Essentially we want to say: _put this element below this other element, but don't affect the layout when you do_.
166 [ Element.below (Element.text "I'm below!")
168 (Element.text "I'm normal!")
176Where `"I'm Below"` doesn't change the size of `Element.row`.
178This is very useful for things like dropdown menus or tooltips.
180@docs above, below, onRight, onLeft, inFront, behindContent
185@docs Attr, Decoration, mouseOver, mouseDown, focused
190The main technique for responsiveness is to store window size information in your model.
192Install the `Browser` package, and set up a subscription for [`Browser.Events.onResize`](https://package.elm-lang.org/packages/elm/browser/latest/Browser-Events#onResize).
194You'll also need to retrieve the initial window size. You can either use [`Browser.Dom.getViewport`](https://package.elm-lang.org/packages/elm/browser/latest/Browser-Dom#getViewport) or pass in `window.innerWidth` and `window.innerHeight` as flags to your program, which is the preferred way. This requires minor setup on the JS side, but allows you to avoid the state where you don't have window info.
196@docs Device, DeviceClass, Orientation, classifyDevice
206@docs map, mapAttribute
211@docs html, htmlAttribute
215import Html exposing (Html)
216import Html.Attributes
217import Internal.Flag as Flag exposing (Flag)
218import Internal.Model as Internal
219import Internal.Style exposing (classes)
227{-| Provide the red, green, and blue channels for the color.
229Each channel takes a value between 0 and 1.
232rgb : Float -> Float -> Float -> Color
234 Internal.Rgba r g b 1
238rgba : Float -> Float -> Float -> Float -> Color
243{-| Provide the red, green, and blue channels for the color.
245Each channel takes a value between 0 and 255.
248rgb255 : Int -> Int -> Int -> Color
249rgb255 red green blue =
252 (toFloat green / 255)
258rgba255 : Int -> Int -> Int -> Float -> Color
259rgba255 red green blue a =
262 (toFloat green / 255)
267{-| Create a color from an RGB record.
294 (toFloat clr.red / 255)
295 (toFloat clr.green / 255)
296 (toFloat clr.blue / 255)
300{-| Deconstruct a `Color` into its rgb channels.
310toRgb (Internal.Rgba r g b a) =
318{-| The basic building block of your layout.
322 Element.el [] (Element.text "Howdy!")
325type alias Element msg =
329{-| An attribute that can be attached to an `Element`
331type alias Attribute msg =
332 Internal.Attribute () msg
335{-| This is a special attribute that counts as both a `Attribute msg` and a `Decoration`.
337type alias Attr decorative msg =
338 Internal.Attribute decorative msg
343type alias Decoration =
344 Internal.Attribute Never Never
348html : Html msg -> Element msg
354htmlAttribute : Html.Attribute msg -> Attribute msg
360map : (msg -> msg1) -> Element msg -> Element msg1
366mapAttribute : (msg -> msg1) -> Attribute msg -> Attribute msg1
382{-| Shrink an element to fit its contents.
389{-| Fill the available space. The available space will be split evenly between elements that have `width fill`.
396{-| Similarly you can set a minimum boundary.
406 (text "I will stop at 300px")
409minimum : Int -> Length -> Length
414{-| Add a maximum to a length.
422 (text "I will stop at 300px")
425maximum : Int -> Length -> Length
430{-| Sometimes you may not want to split available space evenly. In this case you can use `fillPortion` to define which elements should have what portion of the available space.
432So, two elements, one with `width (fillPortion 2)` and one with `width (fillPortion 3)`. The first would get 2 portions of the available space, while the second would get 3.
434**Also:** `fill == fillPortion 1`
437fillPortion : Int -> Length
442{-| This is your top level node where you can turn `Element` into `Html`.
444layout : List (Attribute msg) -> Element msg -> Html msg
446 layoutWith { options = [] }
450layoutWith : { options : List Option } -> List (Attribute msg) -> Element msg -> Html msg
451layoutWith { options } attrs child =
452 Internal.renderRoot options
460 :: (Internal.rootStyle ++ attrs)
470{-| Elm UI embeds two StyleSheets, one that is constant, and one that changes dynamically based on styles collected from the elments being rendered.
472This option will stop the static/constant stylesheet from rendering.
474If you're embedding multiple elm-ui `layout` elements, you need to guarantee that only one is rendering the static style sheet and that it's above ll the others in the DOM tree.
477noStaticStyleSheet : Option
479 Internal.RenderModeOption Internal.NoStaticStyleSheet
484 { borderColor : Maybe Color
485 , backgroundColor : Maybe Color
489 , offset : ( Int, Int )
495 Internal.focusDefaultStyle
499type alias FocusStyle =
500 { borderColor : Maybe Color
501 , backgroundColor : Maybe Color
505 , offset : ( Int, Int )
513focusStyle : FocusStyle -> Option
515 Internal.FocusStyleOption
518{-| Disable all `mouseOver` styles.
522 Internal.HoverOption Internal.NoHover
525{-| Any `hover` styles, aka attributes with `mouseOver` in the name, will be always turned on.
527This is useful for when you're targeting a platform that has no mouse, such as mobile.
532 Internal.HoverOption Internal.ForceHover
535{-| When you want to render exactly nothing.
542{-| Create some plain text.
544 text "Hello, you stylish developer!"
546**Note** text does not wrap by default. In order to get text to wrap, check out `paragraph`!
549text : String -> Element msg
551 Internal.Text content
554{-| The basic building block of your layout.
556You can think of an `el` as a `div`, but it can only have one child.
558If you want multiple children, you'll need to use something like `row` or `column`
560 import Element exposing (Element, rgb)
561 import Element.Background as Background
562 import Element.Border as Border
564 myElement : Element msg
567 [ Background.color (rgb 0 0.5 0)
568 , Border.color (rgb 0 0.7 0)
570 (Element.text "You've made a stylish element!")
573el : List (Attribute msg) -> Element msg -> Element msg
582 (Internal.Unkeyed [ child ])
586row : List (Attribute msg) -> List (Element msg) -> Element msg
591 (Internal.htmlClass (classes.contentLeft ++ " " ++ classes.contentCenterY)
596 (Internal.Unkeyed children)
600column : List (Attribute msg) -> List (Element msg) -> Element msg
601column attrs children =
608 ++ classes.contentLeft
614 (Internal.Unkeyed children)
617{-| Same as `row`, but will wrap if it takes up too much horizontal space.
619wrappedRow : List (Attribute msg) -> List (Element msg) -> Element msg
620wrappedRow attrs children =
623 Internal.extractSpacingAndPadding attrs
633 ++ classes.contentCenterY
641 (Internal.Unkeyed children)
643 Just (Internal.Spaced spaceName x y) ->
647 Just (Internal.Padding name t r b l) ->
648 if r >= (x // 2) && b >= (y // 2) then
652 , right = r - (x // 2)
653 , bottom = b - (y // 2)
654 , left = l - (x // 2)
671 ++ classes.contentCenterY
680 (Internal.Unkeyed children)
683 -- Not enough space in padding to compensate for spacing
686 negate (toFloat x / 2)
689 negate (toFloat y / 2)
702 ++ classes.contentCenterY
707 (Html.Attributes.style "margin"
708 (String.fromFloat halfY
711 ++ String.fromFloat halfX
716 (Html.Attributes.style "width"
723 (Html.Attributes.style "height"
729 :: Internal.StyleClass Flag.spacing (Internal.SpacingStyle spaceName x y)
732 (Internal.Unkeyed children)
737{-| This is just an alias for `Debug.todo`
743{-| Highlight the borders of an element and it's children below. This can really help if you're running into some issue with your layout!
745**Note** This attribute needs to be handed `Debug.todo` in order to work, even though it won't do anything with it. This is a safety measure so you don't accidently ship code with `explain` in it, as Elm won't compile with `--optimize` if you still have a `Debug` statement in your code.
748 [ Element.explain Debug.todo
750 (text "Help, I'm being debugged!")
753explain : Todo -> Attribute msg
755 Internal.htmlClass "explain"
759type alias Column record msg =
760 { header : Element msg
762 , view : record -> Element msg
766{-| Show some tabular data.
768Start with a list of records and specify how each column should be rendered.
770So, if we have a list of `persons`:
777 persons : List Person
779 [ { firstName = "David"
782 , { firstName = "Florence"
787We could render it using
792 [ { header = Element.text "First Name"
796 Element.text person.firstName
798 , { header = Element.text "Last Name"
802 Element.text person.lastName
807**Note:** Sometimes you might not have a list of records directly in your model. In this case it can be really nice to write a function that transforms some part of your model into a list of records before feeding it into `Element.table`.
813 { data : List records
814 , columns : List (Column records msg)
821 List.map InternalColumn config.columns
826type alias IndexedColumn record msg =
827 { header : Element msg
829 , view : Int -> record -> Element msg
833{-| Same as `Element.table` except the `view` for each column will also receive the row index as well as the record.
838 { data : List records
839 , columns : List (IndexedColumn records msg)
842indexedTable attrs config =
846 List.map InternalIndexedColumn config.columns
851type alias InternalTable records msg =
852 { data : List records
853 , columns : List (InternalTableColumn records msg)
858type InternalTableColumn record msg
859 = InternalIndexedColumn (IndexedColumn record msg)
860 | InternalColumn (Column record msg)
863tableHelper : List (Attribute msg) -> InternalTable data msg -> Element msg
864tableHelper attrs config =
867 Internal.getSpacing attrs ( 0, 0 )
871 InternalIndexedColumn colConfig ->
874 InternalColumn colConfig ->
879 InternalIndexedColumn colConfig ->
882 InternalColumn colConfig ->
886 List.map columnHeader config.columns
888 if List.all ((==) Internal.Empty) headers then
892 Just (List.indexedMap (\col header -> onGrid 1 (col + 1) header) headers)
896 Internal.StyleClass Flag.gridTemplate <|
897 Internal.GridTemplateStyle
898 { spacing = ( px sX, px sY )
899 , columns = List.map columnWidth config.columns
900 , rows = List.repeat (List.length config.data) Internal.Content
903 onGrid rowLevel columnLevel elem =
907 [ Internal.StyleClass Flag.gridPosition
908 (Internal.GridPosition
916 (Internal.Unkeyed [ elem ])
918 add cell columnConfig cursor =
920 InternalIndexedColumn col ->
926 (if maybeHeaders == Nothing then
935 , column = cursor.column + 1
938 InternalColumn col ->
940 onGrid cursor.row cursor.column (col.view cell)
942 , column = cursor.column + 1
946 build columns rowData cursor =
949 List.foldl (add rowData)
953 { elements = newCursor.elements
954 , row = cursor.row + 1
959 List.foldl (build config.columns)
962 if maybeHeaders == Nothing then
979 (case maybeHeaders of
983 Just renderedHeaders ->
984 renderedHeaders ++ List.reverse children.elements
989{-| A paragraph will layout all children as wrapped, inline elements.
992 import Element.Font as Font
995 [ text "lots of text ...."
996 , el [ Font.bold ] (text "this is bold")
997 , text "lots of text ...."
1000This is really useful when you want to markup text by having some parts be bold, or some be links, or whatever you so desire.
1002Also, if a child element has `alignLeft` or `alignRight`, then it will be moved to that side and the text will flow around it, (ah yes, `float` behavior).
1004This makes it particularly easy to do something like a [dropped capital](https://en.wikipedia.org/wiki/Initial).
1007 import Element.Font as Font
1009 Element.paragraph []
1015 , text "o much text ...."
1018Which will look something like
1020
1022**Note** `spacing` on a paragraph will set the pixel spacing between lines.
1025paragraph : List (Attribute msg) -> List (Element msg) -> Element msg
1026paragraph attrs children =
1028 Internal.asParagraph
1030 (Internal.Describe Internal.Paragraph
1035 (Internal.Unkeyed children)
1038{-| Now that we have a paragraph, we need some way to attach a bunch of paragraph's together.
1040To do that we can use a `textColumn`.
1042The main difference between a `column` and a `textColumn` is that `textColumn` will flow the text around elements that have `alignRight` or `alignLeft`, just like we just saw with paragraph.
1044In the following example, we have a `textColumn` where one child has `alignLeft`.
1046 Element.textColumn [ spacing 10, padding 10 ]
1047 [ paragraph [] [ text "lots of text ...." ]
1048 , el [ alignLeft ] none
1049 , paragraph [] [ text "lots of text ...." ]
1052Which will result in something like:
1054
1057textColumn : List (Attribute msg) -> List (Element msg) -> Element msg
1058textColumn attrs children =
1060 Internal.asTextColumn
1069 (Internal.Unkeyed children)
1072{-| Both a source and a description are required for images.
1074The description is used for people using screen readers.
1076Leaving the description blank will cause the image to be ignored by assistive technology. This can make sense for images that are purely decorative and add no additional information.
1078So, take a moment to describe your image as you would to someone who has a harder time seeing.
1081image : List (Attribute msg) -> { src : String, description : String } -> Element msg
1082image attrs { src, description } =
1092 Internal.Height _ ->
1102 (Internal.htmlClass classes.imageContainer
1108 (Internal.NodeName "img")
1109 ([ Internal.Attr <| Html.Attributes.src src
1110 , Internal.Attr <| Html.Attributes.alt description
1114 (Internal.Unkeyed [])
1122 { url = "http://fruits.com"
1123 , label = text "A link to my favorite fruit provider."
1128 List (Attribute msg)
1131 , label : Element msg
1134link attrs { url, label } =
1137 (Internal.NodeName "a")
1138 (Internal.Attr (Html.Attributes.href url)
1139 :: Internal.Attr (Html.Attributes.rel "noopener noreferrer")
1142 :: Internal.htmlClass
1143 (classes.contentCenterX
1145 ++ classes.contentCenterY
1151 (Internal.Unkeyed [ label ])
1156 List (Attribute msg)
1159 , label : Element msg
1162newTabLink attrs { url, label } =
1165 (Internal.NodeName "a")
1166 (Internal.Attr (Html.Attributes.href url)
1167 :: Internal.Attr (Html.Attributes.rel "noopener noreferrer")
1168 :: Internal.Attr (Html.Attributes.target "_blank")
1171 :: Internal.htmlClass
1172 (classes.contentCenterX
1174 ++ classes.contentCenterY
1180 (Internal.Unkeyed [ label ])
1183{-| A link to download a file.
1185**Note** If you're using `Browser.application`, then this won't be enough to actually trigger a file download due to how `Browser.Navigation` works.
1187[Here's a description of what needs to happen](https://github.com/elm/html/issues/175).
1191 List (Attribute msg)
1194 , label : Element msg
1197download attrs { url, label } =
1200 (Internal.NodeName "a")
1201 (Internal.Attr (Html.Attributes.href url)
1202 :: Internal.Attr (Html.Attributes.download "")
1205 :: Internal.htmlClass classes.contentCenterX
1206 :: Internal.htmlClass classes.contentCenterY
1209 (Internal.Unkeyed [ label ])
1212{-| A link to download a file, but you can specify the filename.
1215 List (Attribute msg)
1217 { label : Element msg
1222downloadAs attrs { url, filename, label } =
1225 (Internal.NodeName "a")
1226 (Internal.Attr (Html.Attributes.href url)
1227 :: Internal.Attr (Html.Attributes.download filename)
1230 :: Internal.htmlClass classes.contentCenterX
1231 :: Internal.htmlClass classes.contentCenterY
1234 (Internal.Unkeyed [ label ])
1241createNearby : Internal.Location -> Element msg -> Attribute msg
1242createNearby loc element =
1245 Internal.NoAttribute
1248 Internal.Nearby loc element
1252below : Element msg -> Attribute msg
1254 createNearby Internal.Below element
1258above : Element msg -> Attribute msg
1260 createNearby Internal.Above element
1264onRight : Element msg -> Attribute msg
1266 createNearby Internal.OnRight element
1270onLeft : Element msg -> Attribute msg
1272 createNearby Internal.OnLeft element
1275{-| This will place an element in front of another.
1277**Note:** If you use this on a `layout` element, it will place the element as fixed to the viewport which can be useful for modals and overlays.
1280inFront : Element msg -> Attribute msg
1282 createNearby Internal.InFront element
1285{-| This will place an element between the background and the content of an element.
1287behindContent : Element msg -> Attribute msg
1288behindContent element =
1289 createNearby Internal.Behind element
1293width : Length -> Attribute msg
1299height : Length -> Attribute msg
1305scale : Float -> Attr decorative msg
1307 Internal.TransformComponent Flag.scale (Internal.Scale ( n, n, 1 ))
1310{-| Angle is given in radians. [Here are some conversion functions if you want to use another unit.](https://package.elm-lang.org/packages/elm/core/latest/Basics#degrees)
1312rotate : Float -> Attr decorative msg
1314 Internal.TransformComponent Flag.rotate (Internal.Rotate ( 0, 0, 1 ) angle)
1318moveUp : Float -> Attr decorative msg
1320 Internal.TransformComponent Flag.moveY (Internal.MoveY (negate y))
1324moveDown : Float -> Attr decorative msg
1326 Internal.TransformComponent Flag.moveY (Internal.MoveY y)
1330moveRight : Float -> Attr decorative msg
1332 Internal.TransformComponent Flag.moveX (Internal.MoveX x)
1336moveLeft : Float -> Attr decorative msg
1338 Internal.TransformComponent Flag.moveX (Internal.MoveX (negate x))
1342padding : Int -> Attribute msg
1344 Internal.StyleClass Flag.padding (Internal.PaddingStyle ("p-" ++ String.fromInt x) x x x x)
1347{-| Set horizontal and vertical padding.
1349paddingXY : Int -> Int -> Attribute msg
1352 Internal.StyleClass Flag.padding (Internal.PaddingStyle ("p-" ++ String.fromInt x) x x x x)
1355 Internal.StyleClass Flag.padding
1356 (Internal.PaddingStyle
1357 ("p-" ++ String.fromInt x ++ "-" ++ String.fromInt y)
1365{-| If you find yourself defining unique paddings all the time, you might consider defining
1376 paddingEach { edges | right = 5 }
1379paddingEach : { top : Int, right : Int, bottom : Int, left : Int } -> Attribute msg
1380paddingEach { top, right, bottom, left } =
1381 if top == right && top == bottom && top == left then
1382 Internal.StyleClass Flag.padding (Internal.PaddingStyle ("p-" ++ String.fromInt top) top top top top)
1385 Internal.StyleClass Flag.padding
1386 (Internal.PaddingStyle
1387 (Internal.paddingName top right bottom left)
1396centerX : Attribute msg
1398 Internal.AlignX Internal.CenterX
1402centerY : Attribute msg
1404 Internal.AlignY Internal.CenterY
1408alignTop : Attribute msg
1410 Internal.AlignY Internal.Top
1414alignBottom : Attribute msg
1416 Internal.AlignY Internal.Bottom
1420alignLeft : Attribute msg
1422 Internal.AlignX Internal.Left
1426alignRight : Attribute msg
1428 Internal.AlignX Internal.Right
1432spaceEvenly : Attribute msg
1434 Internal.Class Flag.spacing Internal.Style.classes.spaceEvenly
1438spacing : Int -> Attribute msg
1440 Internal.StyleClass Flag.spacing (Internal.SpacingStyle (Internal.spacingName x x) x x)
1443{-| In the majority of cases you'll just need to use `spacing`, which will work as intended.
1445However for some layouts, like `textColumn`, you may want to set a different spacing for the x axis compared to the y axis.
1448spacingXY : Int -> Int -> Attribute msg
1450 Internal.StyleClass Flag.spacing (Internal.SpacingStyle (Internal.spacingName x y) x y)
1453{-| Make an element transparent and have it ignore any mouse or touch events, though it will stil take up space.
1455transparent : Bool -> Attr decorative msg
1458 Internal.StyleClass Flag.transparency (Internal.Transparency "transparent" 1.0)
1461 Internal.StyleClass Flag.transparency (Internal.Transparency "visible" 0.0)
1464{-| A capped value between 0.0 and 1.0, where 0.0 is transparent and 1.0 is fully opaque.
1466Semantically equivalent to html opacity.
1469alpha : Float -> Attr decorative msg
1478 Internal.StyleClass Flag.transparency <| Internal.Transparency ("transparency-" ++ Internal.floatClass transparency) transparency
1483-- hidden : Bool -> Attribute msg
1486-- Internal.class "hidden"
1488-- Internal.NoAttribute
1492scrollbars : Attribute msg
1494 Internal.Class Flag.overflow classes.scrollbars
1498scrollbarY : Attribute msg
1500 Internal.Class Flag.overflow classes.scrollbarsY
1504scrollbarX : Attribute msg
1506 Internal.Class Flag.overflow classes.scrollbarsX
1512 Internal.Class Flag.overflow classes.clip
1516clipY : Attribute msg
1518 Internal.Class Flag.overflow classes.clipY
1522clipX : Attribute msg
1524 Internal.Class Flag.overflow classes.clipX
1527{-| Set the cursor to be a pointing hand when it's hovering over this element.
1529pointer : Attribute msg
1531 Internal.Class Flag.cursor classes.cursorPointer
1536 { class : DeviceClass
1537 , orientation : Orientation
1555{-| Takes in a Window.Size and returns a device profile which can be used for responsiveness.
1557If you have more detailed concerns around responsiveness, it probably makes sense to copy this function into your codebase and modify as needed.
1560classifyDevice : { window | height : Int, width : Int } -> Device
1561classifyDevice window =
1562 -- Tested in this ellie:
1563 -- https://ellie-app.com/68QM7wLW8b9a1
1567 max window.width window.height
1570 min window.width window.height
1572 if shortSide < 600 then
1575 else if longSide <= 1200 then
1578 else if longSide > 1200 && longSide <= 1920 then
1584 if window.width < window.height then
1592{-| When designing it's nice to use a modular scale to set spacial rythms.
1595 Element.modular 16 1.25
1597A modular scale starts with a number, and multiplies it by a ratio a number of times.
1598Then, when setting font sizes you can use:
1600 Font.size (scaled 1) -- results in 16
1602 Font.size (scaled 2) -- 16 * 1.25 results in 20
1604 Font.size (scaled 4) -- 16 * 1.25 ^ (4 - 1) results in 31.25
1606We can also provide negative numbers to scale below 16px.
1608 Font.size (scaled -1) -- 16 * 1.25 ^ (-1) results in 12.8
1611modular : Float -> Float -> Int -> Float
1612modular normal ratio rescale =
1613 if rescale == 0 then
1616 else if rescale < 0 then
1617 normal * ratio ^ toFloat rescale
1620 normal * ratio ^ (toFloat rescale - 1)
1624mouseOver : List Decoration -> Attribute msg
1626 Internal.StyleClass Flag.hover <|
1627 Internal.PseudoSelector Internal.Hover
1628 (Internal.unwrapDecorations decs)
1632mouseDown : List Decoration -> Attribute msg
1634 Internal.StyleClass Flag.active <|
1635 Internal.PseudoSelector Internal.Active
1636 (Internal.unwrapDecorations decs)
1640focused : List Decoration -> Attribute msg
1642 Internal.StyleClass Flag.focus <|
1643 Internal.PseudoSelector Internal.Focus
1644 (Internal.unwrapDecorations decs)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list