Skip to content

Commit

Permalink
fix: Try to make popovers work in debug mode (dreaded Map.! error)
Browse files Browse the repository at this point in the history
  • Loading branch information
rundis committed Jan 21, 2019
1 parent fc4e7f2 commit b92dd39
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
5 changes: 3 additions & 2 deletions elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "rundis/elm-bootstrap",
"summary": "Elm Bootstrap is a comprehensive library for working with Twitter Bootstrap 4",
"license": "BSD-3-Clause",
"version": "5.0.0",
"version": "5.1.0",
"exposed-modules": [
"Bootstrap.Accordion",
"Bootstrap.Alert",
Expand Down Expand Up @@ -41,6 +41,7 @@
"Bootstrap.Text",
"Bootstrap.Utilities.Border",
"Bootstrap.Utilities.Display",
"Bootstrap.Utilities.DomHelper",
"Bootstrap.Utilities.Flex",
"Bootstrap.Utilities.Size",
"Bootstrap.Utilities.Spacing"
Expand All @@ -57,4 +58,4 @@
"test-dependencies": {
"elm-explorations/test": "1.2.0 <= v < 2.0.0"
}
}
}
2 changes: 1 addition & 1 deletion src/Bootstrap/Card.elm
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ You can customize the look and feel of your cards using the following options
# Blocks
@docs block, listGroup
@docs block, listGroup, customListGroup
# Composing cards
Expand Down
37 changes: 24 additions & 13 deletions src/Bootstrap/Utilities/DomHelper.elm
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@ module Bootstrap.Utilities.DomHelper exposing
, parentElement
, target
)
{-| **NOTE: INTERNAL**
This module is only exposed as a temp fix for https://github.com/elm/compiler/issues/1864
Use at your own risk !
import Json.Decode as Decode
@docs Area, boundingArea, childNode, className, currentTarget, nextSibling, offsetHeight, offsetWidth, parentElement, target
-}


import Json.Decode as Decode

{-| Not intended for external use. -}
type alias Area =
{ top : Float
, left : Float
Expand All @@ -22,6 +30,7 @@ type alias Area =
}


{-| Not intended for external use. -}
boundingArea : Decode.Decoder Area
boundingArea =
Decode.map3
Expand All @@ -36,7 +45,7 @@ boundingArea =
offsetWidth
offsetHeight


{-| Not intended for external use. -}
position : Float -> Float -> Decode.Decoder ( Float, Float )
position x y =
Decode.map4
Expand All @@ -52,70 +61,72 @@ position x y =
offsetParent ( x_, y_ ) (position x_ y_)
)


{-| Not intended for external use. -}
parentElement : Decode.Decoder a -> Decode.Decoder a
parentElement decoder =
Decode.field "parentElement" decoder


{-| Not intended for external use. -}
target : Decode.Decoder a -> Decode.Decoder a
target decoder =
Decode.field "target" decoder


{-| Not intended for external use. -}
currentTarget : Decode.Decoder a -> Decode.Decoder a
currentTarget decoder =
Decode.field "currentTarget" decoder


{-| Not intended for external use. -}
offsetParent : a -> Decode.Decoder a -> Decode.Decoder a
offsetParent x decoder =
Decode.oneOf
[ Decode.field "offsetParent" <| Decode.null x
, Decode.field "offsetParent" decoder
]


{-| Not intended for external use. -}
offsetTop : Decode.Decoder Float
offsetTop =
Decode.field "offsetTop" Decode.float


{-| Not intended for external use. -}
offsetLeft : Decode.Decoder Float
offsetLeft =
Decode.field "offsetLeft" Decode.float


{-| Not intended for external use. -}
scrollLeft : Decode.Decoder Float
scrollLeft =
Decode.field "scrollLeft" Decode.float


{-| Not intended for external use. -}
scrollTop : Decode.Decoder Float
scrollTop =
Decode.field "scrollTop" Decode.float


{-| Not intended for external use. -}
offsetWidth : Decode.Decoder Float
offsetWidth =
Decode.field "offsetWidth" Decode.float


{-| Not intended for external use. -}
offsetHeight : Decode.Decoder Float
offsetHeight =
Decode.field "offsetHeight" Decode.float


{-| Not intended for external use. -}
childNode : Int -> Decode.Decoder a -> Decode.Decoder a
childNode idx =
Decode.at [ "childNodes", String.fromInt idx ]


{-| Not intended for external use. -}
nextSibling : Decode.Decoder a -> Decode.Decoder a
nextSibling decoder =
Decode.field "nextSibling" decoder


{-| Not intended for external use. -}
className : Decode.Decoder String
className =
Decode.at [ "className" ] Decode.string

0 comments on commit b92dd39

Please sign in to comment.