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 e4b882259035 of https://github.com/ryan-haskell/elm-spa (zip prefix ryannhg-elm-spa-be230fb/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 80cdff9c192258e6cdb706da3a390cb96716d601.
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/4.1.1/
If you'd rather use something like elm-ui
or have your page's view functions return something besides Html, this module
extends the Spa.Page module's API with one additional parameter.
Instead of having all the pages in your app specify all 6 parameters every time:
import Browser exposing (Document)
import Global
import Spa
page : Spa.Page Flags Model Msg Global.Model Global.Msg (Document Msg)
page =
Spa.static
{ view = view
}It's recommended to create a single src/Page.elm file for your project, just
like the one created by elm-spa init.
The Page module exposes type aliases and functions that know which Global.Model and Global.Msg
to use, which allow the compiler to provide better error messages.
Additionally, it make your type annotations way easier to read!
import Page exposing (Document, Page)
page : Page Flags Model Msg
page =
Page.static
{ view = view
}(If you're doing things correctly you should only see import Spa or
import Spa.Advanced once in your entire project!)
Using the technique describe above means the cli tool will be able to work
These links are full src/Page.elm implementations you can drop
into your app:
import Page exposing (Page)
page : Page Flags Model Msg
page =
Page.static
{ view = view
}import Page exposing (Page)
page : Page Flags Model Msg
page =
Page.sandbox
{ init = init
, update = update
, view = view
}import Page exposing (Page)
page : Page Flags Model Msg
page =
Page.element
{ init = init
, update = update
, subscriptions = subscriptions
, view = view
}import Page exposing (Page)
page : Page Flags Model Msg
page =
Page.component
{ init = init
, update = update
, subscriptions = subscriptions
, view = view
}The Page module discussed above should also export
an upgrade function. This means providing an extra function
to map one view to another.
import Browser
import Html
type alias Document msg =
Browser.Document msg
upgrade =
Spa.Advanced.upgrade
(\fn doc ->
{ title = doc.title
, body = List.map (Html.map fn) doc.body
}
)import Element exposing (Element)
type alias Document msg =
{ title : String
, body : List (Element msg)
}
upgrade =
Spa.Advanced.upgrade
(\fn doc ->
{ title = doc.title
, body = List.map (Element.map fn) doc.body
}
)Same as Spa.upgrade, but needs an extra map function as the first argument to upgrade one view to another!
Bundle behaves the same as Spa.Bundle,
but supports more than just Browser.Document msg for the view's return type!
Just like Spa.Page, but the
viewfunction returnsview_msginstead of enforcing the use of Browser.Document msg