Skip to content

Commit

Permalink
Merge pull request #18 from unisonweb/vendor-splitpane
Browse files Browse the repository at this point in the history
Fix split resize in release builds by vendoring SplitPane
  • Loading branch information
hojberg authored Dec 11, 2024
2 parents 3a2e725 + ab2af49 commit cb8dff5
Show file tree
Hide file tree
Showing 7 changed files with 824 additions and 12 deletions.
5 changes: 2 additions & 3 deletions elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
"rtfeldman/elm-iso8601-date-strings": "1.1.4",
"ryan-haskell/date-format": "1.0.0",
"stoeffel/set-extra": "1.2.3",
"wernerdegroot/listzipper": "4.0.0",
"whale9490/elm-split-pane": "1.0.0"
"wernerdegroot/listzipper": "4.0.0"
},
"indirect": {
"elm/bytes": "1.0.8",
Expand All @@ -46,4 +45,4 @@
"direct": {},
"indirect": {}
}
}
}
66 changes: 66 additions & 0 deletions src/SplitPane/Bound.elm
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
module SplitPane.Bound exposing (Bound, Bounded, getValue, putValue, updateValue, putBound, createBound, createBounded)

{-| This module defines a value that is between two other values.
@docs Bound, Bounded, getValue, putValue, updateValue, putBound, createBound, createBounded
-}


{-| Type that defines a border of values
-}
type alias Bound a =
( a, a )


{-| Type that defines a value that is within a border of two other values
-}
type alias Bounded a =
( a, Bound a )


{-| Create a new bounded value.
-}
getValue : Bounded comparable -> comparable
getValue value =
Tuple.first value


{-| Create a new bounded value.
-}
createBounded : comparable -> Bound comparable -> Bounded comparable
createBounded value bound =
putValue ( value, bound ) value


{-| Change the value that is bounded.
-}
putValue : Bounded comparable -> comparable -> Bounded comparable
putValue ( _, bound ) value =
( boundTo bound value, bound )


{-| Update the value that is bounded.
-}
updateValue : (comparable -> comparable) -> Bounded comparable -> Bounded comparable
updateValue f ( value, bound ) =
( boundTo bound (f value), bound )


{-| Change the bound of the bounded value.
-}
putBound : Bounded comparable -> Bound comparable -> Bounded comparable
putBound ( value, _ ) bound =
( value, bound )


{-| Create a new bound that can be used to restrict a value.
-}
createBound : comparable -> comparable -> Bound comparable
createBound a b =
( min a b, max a b )


boundTo : Bound comparable -> comparable -> comparable
boundTo ( a, b ) =
min b << max a
9 changes: 9 additions & 0 deletions src/SplitPane/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SplitPane

To support Elm 0.19.1 (and crucially to support optimize mode), this is
vendored version of [quentin/elm-split-pane](https://github.com/quentin/elm-split-pane) which builds on a series of forks:


* The original: [doodledood/elm-split-pane](https://github.com/doodledood/elm-split-pane)
* 0.19.0 support: [whale9490/elm-split-pane](https://github.com/whale9490/elm-split-pane)
* 0.19.1 support: [quentin/elm-split-pane](https://github.com/quentin/elm-split-pane)
Loading

0 comments on commit cb8dff5

Please sign in to comment.