ryannhg/elm-spa/3.0.1

NOTE: the latest version is 6.0.0

Renamed to ryan-haskell/elm-spa. It is published under that name, and new versions come out there.

Versions published as ryannhg/elm-spa still install under that name. 13 versions of 13 come from the new location (see their notes).

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/ryan-haskell/elm-spa.

What we checked: The repo moved to github.com/ryan-haskell/elm-spa. Rebuilt with git archive from commit d4517fdd0d21 of https://github.com/ryan-haskell/elm-spa (zip prefix ryannhg-elm-spa-a1cd9c1/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 7f9d9d9ae8c43b76a789a680d27edbcda446bb62.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/ryannhg/elm-spa/zipball/3.0.1/

Spa.Transition

Create transitions from page to page!

A huge benefit to doing client-side rendering is the ability to seamlessly navigate from one page to another!

This package is designed to make creating page transitions a breeze!

type alias Transition ui_msg =
Transition ui_msg

Describes how to move from one page to another.

transition : Transition (Html msg)
transition =
    Transition.none


otherTransition : Transition (Element msg)
otherTransition =
    Transition.fadeElmUi 300

Use one of these transitions

none : Transition ui_msg

Don't transition from one page to another.

Can be used with Html msg or Element msg (or another view library)

transitions : Transitions (Html msg)
transitions =
    { layout = Transition.none -- page loads instantly
    , page = Transition.fadeHtml 300
    , pages = []
    }


otherTransitions : Transitions (Element msg)
otherTransitions =
    { layout = Transition.none -- page loads instantly
    , page = Transition.fadeElmUi 300
    , pages = []
    }
fadeElmUi : Int -> Transition (Element msg)

Fade one page out and another one in. (For use with mdgriffith/elm-ui)

Animation duration is represented in milliseconds

transitions : Spa.Types.Transitions (Element msg)
transitions =
    { layout = Transition.none
    , page = Transition.fadeElmUi 300 -- 300 milliseconds
    , pages = []
    }
fadeHtml : Int -> Transition (Html msg)

Fade one page out and another one in. (For use with elm/html)

Animation duration is represented in milliseconds

transitions : Spa.Types.Transitions (Html msg)
transitions =
    { layout = Transition.none
    , page = Transition.fadeHtml 300 -- 300 milliseconds
    , pages = []
    }

Or create your own

{ duration : Int
, invisible : ui_msg -> ui_msg
, visible : ui_msg -> ui_msg
}
-> Transition ui_msg

Create your own custom transition!

Just provide three things:

  • duration – how long (in milliseconds) the transition should last.

  • invisible – what the page looks like when invisible.

  • visible – what the page looks like when visible.

batmanNewspaper : Int -> Transition (Element msg)
batmanNewspaper duration =
    Transition.custom
        { duration = duration
        , invisible =
            \page ->
                el
                    [ alpha 0
                    , width fill
                    , rotate (4 * pi)
                    , scale 0
                    , Styles.transition
                        { property = "all"
                        , duration = duration
                        }
                    ]
                    page
        , visible =
            \page ->
                el
                    [ alpha 1
                    , width fill
                    , Styles.transition
                        { property = "all"
                        , duration = duration
                        }
                    ]
                    page
        }

--
-- using it later on
--
transitions : Spa.Types.Transitions (Element msg)
transitions =
    { layout = batmanNewspaper 500 -- 🦇
    , page = Transition.none
    , pages = []
    }