This repository has been archived by the owner on Apr 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Bump PaackEng/paack-ui from 7.8.1 to 7.9.0 in /example Bumps [PaackEng/paack-ui](https://github.com/PaackEng/paack-ui) from 7.8.1 to 7.9.0. - [Release notes](https://github.com/PaackEng/paack-ui/releases) - [Commits](PaackEng/paack-ui@7.8.1...7.9.0) --- updated-dependencies: - dependency-name: PaackEng/paack-ui dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Bump esbuild from 0.14.0 to 0.14.1 Bumps [esbuild](https://github.com/evanw/esbuild) from 0.14.0 to 0.14.1. - [Release notes](https://github.com/evanw/esbuild/releases) - [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md) - [Commits](evanw/esbuild@v0.14.0...v0.14.1) --- updated-dependencies: - dependency-name: esbuild dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Add loadUrl effect * Add reusable code from WMS * Apply elm-format * Remove Paack.Remote * Remove legacy Paack.Basics.Extra * Add reusable code from LMO * Add indicator to what kind of request is being made * Fix review issues * Bump to 3.0.0 Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
cfef3da
commit 3b3cefb
Showing
17 changed files
with
397 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Paack.Basics.Extra exposing (flip, ifThenElse, maybePrepend) | ||
|
||
|
||
flip : (a -> b -> c) -> b -> a -> c | ||
flip applier b a = | ||
applier a b | ||
|
||
|
||
ifThenElse : Bool -> a -> a -> a | ||
ifThenElse condition ifThen ifElse = | ||
if condition then | ||
ifThen | ||
|
||
else | ||
ifElse |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
module Paack.DateFormat exposing (..) | ||
|
||
import DateFormat exposing (..) | ||
import Time | ||
|
||
|
||
fullStamp : List Token | ||
fullStamp = | ||
[ dayOfMonthFixed | ||
, DateFormat.text "/" | ||
, monthFixed | ||
, DateFormat.text "/" | ||
, yearNumberLastTwo | ||
, DateFormat.text " " | ||
, hourMilitaryFixed | ||
, DateFormat.text ":" | ||
, minuteFixed | ||
] | ||
|
||
|
||
dateOnly : List Token | ||
dateOnly = | ||
[ dayOfMonthFixed | ||
, DateFormat.text "/" | ||
, monthFixed | ||
, DateFormat.text "/" | ||
, yearNumberLastTwo | ||
] | ||
|
||
|
||
timeOnly : List Token | ||
timeOnly = | ||
[ hourMilitaryFixed | ||
, DateFormat.text ":" | ||
, minuteFixed | ||
] | ||
|
||
|
||
shortMonthDayYear : List Token | ||
shortMonthDayYear = | ||
[ monthNameAbbreviated | ||
, text " " | ||
, DateFormat.dayOfMonthFixed | ||
, text ", " | ||
, yearNumber | ||
] | ||
|
||
|
||
sortableTime : Time.Posix -> String | ||
sortableTime time = | ||
format | ||
[ yearNumber | ||
, DateFormat.text "-" | ||
, monthFixed | ||
, DateFormat.text "-" | ||
, dayOfMonthFixed | ||
, DateFormat.text "-" | ||
, hourMilitaryFixed | ||
, DateFormat.text "-" | ||
, minuteFixed | ||
] | ||
Time.utc | ||
time | ||
|
||
|
||
sortableDate : List Token | ||
sortableDate = | ||
[ yearNumber | ||
, DateFormat.text "-" | ||
, monthFixed | ||
, DateFormat.text "-" | ||
, dayOfMonthFixed | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Paack.Dict exposing (toggle) | ||
|
||
import Dict exposing (Dict) | ||
|
||
|
||
toggle : comparable -> object -> Dict comparable object -> Dict comparable object | ||
toggle key value dict = | ||
Dict.update key | ||
(\past -> | ||
case past of | ||
Just _ -> | ||
Nothing | ||
|
||
Nothing -> | ||
Just value | ||
) | ||
dict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module Paack.Either exposing (..) | ||
|
||
|
||
type Either a b | ||
= Left a | ||
| Right b | ||
|
||
|
||
fromResult : Result error value -> Either error value | ||
fromResult result = | ||
case result of | ||
Ok value -> | ||
Right value | ||
|
||
Err error -> | ||
Left error | ||
|
||
|
||
toResult : Either error value -> Result error value | ||
toResult either = | ||
case either of | ||
Right value -> | ||
Ok value | ||
|
||
Left error -> | ||
Err error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Paack.Events exposing (onEscapeKey) | ||
|
||
import Browser.Events as Events | ||
import Json.Decode as Decode | ||
|
||
|
||
onEscapeKey : msg -> Sub msg | ||
onEscapeKey msg = | ||
Decode.string | ||
|> Decode.field "key" | ||
|> Decode.andThen | ||
(\key -> | ||
case key of | ||
"Escape" -> | ||
Decode.succeed msg | ||
|
||
_ -> | ||
Decode.fail "Irrelevant key" | ||
) | ||
|> Events.onKeyUp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module Paack.Json.Encode exposing (..) | ||
|
||
import Json.Encode as Encode exposing (Value) | ||
|
||
|
||
maybeWithNull : (data -> Value) -> Maybe data -> Value | ||
maybeWithNull encoder maybeData = | ||
case maybeData of | ||
Just data -> | ||
encoder data | ||
|
||
Nothing -> | ||
Encode.null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
module Paack.List exposing (..) | ||
|
||
import UUID exposing (UUID) | ||
|
||
|
||
unique : List comparable -> List comparable | ||
unique = | ||
Set.fromList >> Set.toList | ||
|
||
|
||
find : (a -> Bool) -> List a -> Maybe a | ||
find predicate list = | ||
case list of | ||
[] -> | ||
Nothing | ||
|
||
head :: tail -> | ||
if predicate head then | ||
Just head | ||
|
||
else | ||
find predicate tail | ||
|
||
|
||
findById : UUID -> List { a | id : UUID } -> Maybe { a | id : UUID } | ||
findById uuid = | ||
find (.id >> (==) uuid) | ||
|
||
|
||
insert : { a | id : UUID } -> List { a | id : UUID } -> List { a | id : UUID } | ||
insert item list = | ||
list | ||
|> List.filter (.id >> (/=) item.id) | ||
|> (::) item | ||
|
||
|
||
updateById : UUID -> ({ a | id : UUID } -> { a | id : UUID }) -> List { a | id : UUID } -> List { a | id : UUID } | ||
updateById uuid applier list = | ||
List.map | ||
(\item -> | ||
if item.id == uuid then | ||
applier item | ||
|
||
else | ||
item | ||
) | ||
list | ||
|
||
|
||
prependMaybe : Maybe a -> List a -> List a | ||
prependMaybe maybeSomething items = | ||
case maybeSomething of | ||
Just something -> | ||
something :: items | ||
|
||
Nothing -> | ||
items | ||
|
||
|
||
mapHead : (a -> Maybe b) -> List a -> Maybe b | ||
mapHead filterMap list = | ||
case list of | ||
[] -> | ||
Nothing | ||
|
||
head :: tail -> | ||
case filterMap head of | ||
Just match -> | ||
Just match | ||
|
||
Nothing -> | ||
mapHead filterMap tail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module Paack.Maybe exposing (fallback) | ||
|
||
|
||
fallback : Maybe a -> Maybe a -> Maybe a | ||
fallback replacement primary = | ||
case primary of | ||
Just _ -> | ||
primary | ||
|
||
Nothing -> | ||
replacement |
Oops, something went wrong.