From ad8e7b9456d55de7f99a5fac185bd6d918e3c847 Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Tue, 3 May 2022 11:51:32 -0700 Subject: [PATCH] Expose ActionData types. --- examples/pokedex/app/Route/BasicAuth.elm | 13 +++++++++---- examples/pokedex/app/Route/FileUpload.elm | 13 +++++++++---- examples/pokedex/app/Route/Form.elm | 13 +++++++++---- examples/pokedex/app/Route/FormEvent.elm | 16 ++++++++++------ examples/pokedex/app/Route/Greet.elm | 13 +++++++++---- examples/pokedex/app/Route/Hex/Hex_.elm | 8 ++++++-- examples/pokedex/app/Route/Login.elm | 13 +++++++++---- examples/pokedex/app/Route/Named/Color_.elm | 8 ++++++-- examples/pokedex/app/Route/PokedexNumber_.elm | 12 ++++++++---- examples/pokedex/app/Route/PortTest.elm | 12 ++++++++---- examples/pokedex/app/Route/RedirectLinks.elm | 12 ++++++++---- .../pokedex/app/Route/Rgb/Red_/Green_/Blue_.elm | 8 ++++++-- examples/pokedex/app/Route/Secret.elm | 13 +++++++++---- examples/pokedex/app/Route/TailwindForm.elm | 13 +++++++++---- examples/pokedex/app/Route/Time.elm | 13 +++++++++---- examples/pokedex/app/Route/Todos.elm | 17 +++++++++++------ 16 files changed, 135 insertions(+), 62 deletions(-) diff --git a/examples/pokedex/app/Route/BasicAuth.elm b/examples/pokedex/app/Route/BasicAuth.elm index 6b2f531b..c9f8f39f 100644 --- a/examples/pokedex/app/Route/BasicAuth.elm +++ b/examples/pokedex/app/Route/BasicAuth.elm @@ -1,4 +1,4 @@ -module Route.BasicAuth exposing (Data, Model, Msg, route) +module Route.BasicAuth exposing (ActionData, Data, Model, Msg, route) import Base64 import DataSource exposing (DataSource) @@ -25,11 +25,12 @@ type alias RouteParams = {} -route : StatelessRoute RouteParams Data +route : StatelessRoute RouteParams Data ActionData route = RouteBuilder.serverRender { head = head , data = data + , action = \_ -> Request.skip "No action" } |> RouteBuilder.buildNoState { view = view } @@ -39,6 +40,10 @@ type alias Data = } +type alias ActionData = + {} + + data : RouteParams -> Parser (DataSource (Response Data ErrorPage)) data routeParams = withBasicAuth @@ -53,7 +58,7 @@ data routeParams = head : - StaticPayload Data RouteParams + StaticPayload Data ActionData RouteParams -> List Head.Tag head static = [] @@ -62,7 +67,7 @@ head static = view : Maybe PageUrl -> Shared.Model - -> StaticPayload Data RouteParams + -> StaticPayload Data ActionData RouteParams -> View Msg view maybeUrl sharedModel static = { title = "Basic Auth Test" diff --git a/examples/pokedex/app/Route/FileUpload.elm b/examples/pokedex/app/Route/FileUpload.elm index 509864f8..ca885858 100644 --- a/examples/pokedex/app/Route/FileUpload.elm +++ b/examples/pokedex/app/Route/FileUpload.elm @@ -1,4 +1,4 @@ -module Route.FileUpload exposing (Data, Model, Msg, route) +module Route.FileUpload exposing (ActionData, Data, Model, Msg, route) import DataSource exposing (DataSource) import ErrorPage exposing (ErrorPage) @@ -27,11 +27,12 @@ type alias RouteParams = {} -route : StatelessRoute RouteParams Data +route : StatelessRoute RouteParams Data ActionData route = RouteBuilder.serverRender { head = head , data = data + , action = \_ -> Request.skip "No action." } |> RouteBuilder.buildNoState { view = view } @@ -40,6 +41,10 @@ type alias Data = Maybe Request.File +type alias ActionData = + {} + + data : RouteParams -> Request.Parser (DataSource (Server.Response.Response Data ErrorPage)) data routeParams = Request.oneOf @@ -57,7 +62,7 @@ data routeParams = head : - StaticPayload Data RouteParams + StaticPayload Data ActionData RouteParams -> List Head.Tag head static = Seo.summary @@ -79,7 +84,7 @@ head static = view : Maybe PageUrl -> Shared.Model - -> StaticPayload Data RouteParams + -> StaticPayload Data ActionData RouteParams -> View Msg view maybeUrl sharedModel static = { title = "File Upload" diff --git a/examples/pokedex/app/Route/Form.elm b/examples/pokedex/app/Route/Form.elm index b9bc1ee7..891ee485 100644 --- a/examples/pokedex/app/Route/Form.elm +++ b/examples/pokedex/app/Route/Form.elm @@ -1,4 +1,4 @@ -module Route.Form exposing (Data, Model, Msg, route) +module Route.Form exposing (ActionData, Data, Model, Msg, route) import DataSource exposing (DataSource) import Date exposing (Date) @@ -186,11 +186,12 @@ form user = ) -route : StatelessRoute RouteParams Data +route : StatelessRoute RouteParams Data ActionData route = RouteBuilder.serverRender { head = head , data = data + , action = \_ -> Request.skip "No action." } |> RouteBuilder.buildNoState { view = view } @@ -201,6 +202,10 @@ type alias Data = } +type alias ActionData = + {} + + data : RouteParams -> Parser (DataSource (Response Data ErrorPage)) data routeParams = Request.oneOf @@ -232,7 +237,7 @@ data routeParams = head : - StaticPayload Data RouteParams + StaticPayload Data ActionData RouteParams -> List Head.Tag head static = Seo.summary @@ -254,7 +259,7 @@ head static = view : Maybe PageUrl -> Shared.Model - -> StaticPayload Data RouteParams + -> StaticPayload Data ActionData RouteParams -> View Msg view maybeUrl sharedModel static = let diff --git a/examples/pokedex/app/Route/FormEvent.elm b/examples/pokedex/app/Route/FormEvent.elm index 6ca9d330..28ba25c6 100644 --- a/examples/pokedex/app/Route/FormEvent.elm +++ b/examples/pokedex/app/Route/FormEvent.elm @@ -1,4 +1,4 @@ -module Route.FormEvent exposing (Data, Model, Msg, route) +module Route.FormEvent exposing (ActionData, Data, Model, Msg, route) import Browser.Navigation import DataSource exposing (DataSource) @@ -29,7 +29,7 @@ type alias RouteParams = {} -route : StatefulRoute RouteParams Data Model Msg +route : StatefulRoute RouteParams Data ActionData Model Msg route = RouteBuilder.single { head = head @@ -46,7 +46,7 @@ route = init : Maybe PageUrl -> Shared.Model - -> StaticPayload Data RouteParams + -> StaticPayload Data ActionData RouteParams -> ( Model, Effect Msg ) init maybePageUrl sharedModel static = ( { formAsString = Nothing }, Effect.none ) @@ -55,7 +55,7 @@ init maybePageUrl sharedModel static = update : PageUrl -> Shared.Model - -> StaticPayload Data RouteParams + -> StaticPayload Data ActionData RouteParams -> Msg -> Model -> ( Model, Effect Msg ) @@ -81,13 +81,17 @@ type alias Data = {} +type alias ActionData = + {} + + data : DataSource Data data = DataSource.succeed {} head : - StaticPayload Data RouteParams + StaticPayload Data ActionData RouteParams -> List Head.Tag head static = Seo.summary @@ -110,7 +114,7 @@ view : Maybe PageUrl -> Shared.Model -> Model - -> StaticPayload Data RouteParams + -> StaticPayload Data ActionData RouteParams -> View Msg view maybeUrl sharedModel model static = { title = "Placeholder" diff --git a/examples/pokedex/app/Route/Greet.elm b/examples/pokedex/app/Route/Greet.elm index 3bd12392..d1670694 100644 --- a/examples/pokedex/app/Route/Greet.elm +++ b/examples/pokedex/app/Route/Greet.elm @@ -1,4 +1,4 @@ -module Route.Greet exposing (Data, Model, Msg, route) +module Route.Greet exposing (ActionData, Data, Model, Msg, route) import DataSource exposing (DataSource) import Dict exposing (Dict) @@ -31,11 +31,12 @@ type alias RouteParams = {} -route : StatelessRoute RouteParams Data +route : StatelessRoute RouteParams Data ActionData route = RouteBuilder.serverRender { head = head , data = data + , action = \_ -> Request.skip "No action." } |> RouteBuilder.buildNoState { view = view } @@ -86,7 +87,7 @@ data routeParams = head : - StaticPayload Data RouteParams + StaticPayload Data ActionData RouteParams -> List Head.Tag head static = Seo.summary @@ -112,10 +113,14 @@ type alias Data = } +type alias ActionData = + {} + + view : Maybe PageUrl -> Shared.Model - -> StaticPayload Data RouteParams + -> StaticPayload Data ActionData RouteParams -> View Msg view maybeUrl sharedModel static = { title = "Hello!" diff --git a/examples/pokedex/app/Route/Hex/Hex_.elm b/examples/pokedex/app/Route/Hex/Hex_.elm index a40fea89..2f3b6d5a 100644 --- a/examples/pokedex/app/Route/Hex/Hex_.elm +++ b/examples/pokedex/app/Route/Hex/Hex_.elm @@ -1,4 +1,4 @@ -module Route.Hex.Hex_ exposing (Data, Model, Msg, route) +module Route.Hex.Hex_ exposing (ActionData, Data, Model, Msg, route) import ColorHelpers import DataSource exposing (DataSource) @@ -21,7 +21,11 @@ type alias Data = ColorHelpers.Data -route : StatelessRoute RouteParams Data +type alias ActionData = + {} + + +route : StatelessRoute RouteParams Data ActionData route = RouteBuilder.preRenderWithFallback { head = ColorHelpers.head toCssVal diff --git a/examples/pokedex/app/Route/Login.elm b/examples/pokedex/app/Route/Login.elm index 1192106a..020be1a0 100644 --- a/examples/pokedex/app/Route/Login.elm +++ b/examples/pokedex/app/Route/Login.elm @@ -1,4 +1,4 @@ -module Route.Login exposing (Data, Model, Msg, route) +module Route.Login exposing (ActionData, Data, Model, Msg, route) import DataSource exposing (DataSource) import Dict exposing (Dict) @@ -31,11 +31,12 @@ type alias RouteParams = {} -route : StatelessRoute RouteParams Data +route : StatelessRoute RouteParams Data ActionData route = RouteBuilder.serverRender { head = head , data = data + , action = \_ -> Request.skip "No action." } |> RouteBuilder.buildNoState { view = view } @@ -85,7 +86,7 @@ data routeParams = head : - StaticPayload Data RouteParams + StaticPayload Data ActionData RouteParams -> List Head.Tag head static = Seo.summary @@ -109,10 +110,14 @@ type alias Data = } +type alias ActionData = + {} + + view : Maybe PageUrl -> Shared.Model - -> StaticPayload Data RouteParams + -> StaticPayload Data ActionData RouteParams -> View Msg view maybeUrl sharedModel static = { title = "Login" diff --git a/examples/pokedex/app/Route/Named/Color_.elm b/examples/pokedex/app/Route/Named/Color_.elm index fc4c7ba9..37814976 100644 --- a/examples/pokedex/app/Route/Named/Color_.elm +++ b/examples/pokedex/app/Route/Named/Color_.elm @@ -1,4 +1,4 @@ -module Route.Named.Color_ exposing (Data, Model, Msg, route) +module Route.Named.Color_ exposing (ActionData, Data, Model, Msg, route) import ColorHelpers import DataSource exposing (DataSource) @@ -17,11 +17,15 @@ type alias RouteParams = { color : String } +type alias ActionData = + {} + + type alias Data = ColorHelpers.Data -route : StatelessRoute RouteParams Data +route : StatelessRoute RouteParams Data ActionData route = RouteBuilder.preRenderWithFallback { head = ColorHelpers.head toCssVal diff --git a/examples/pokedex/app/Route/PokedexNumber_.elm b/examples/pokedex/app/Route/PokedexNumber_.elm index c9666b5c..e0626201 100644 --- a/examples/pokedex/app/Route/PokedexNumber_.elm +++ b/examples/pokedex/app/Route/PokedexNumber_.elm @@ -1,4 +1,4 @@ -module Route.PokedexNumber_ exposing (Data, Model, Msg, route) +module Route.PokedexNumber_ exposing (ActionData, Data, Model, Msg, route) import DataSource exposing (DataSource) import DataSource.Http @@ -28,7 +28,7 @@ type alias RouteParams = { pokedexNumber : String } -route : StatelessRoute RouteParams Data +route : StatelessRoute RouteParams Data ActionData route = RouteBuilder.preRenderWithFallback { head = head @@ -79,7 +79,7 @@ type alias Pokemon = head : - StaticPayload Data RouteParams + StaticPayload Data ActionData RouteParams -> List Head.Tag head static = Seo.summary @@ -108,10 +108,14 @@ type alias Data = } +type alias ActionData = + {} + + view : Maybe PageUrl -> Shared.Model - -> StaticPayload Data RouteParams + -> StaticPayload Data ActionData RouteParams -> View Msg view maybeUrl sharedModel static = { title = static.data.pokemon.name diff --git a/examples/pokedex/app/Route/PortTest.elm b/examples/pokedex/app/Route/PortTest.elm index 59be14fb..24541f6c 100644 --- a/examples/pokedex/app/Route/PortTest.elm +++ b/examples/pokedex/app/Route/PortTest.elm @@ -1,4 +1,4 @@ -module Route.PortTest exposing (Data, Model, Msg, route) +module Route.PortTest exposing (ActionData, Data, Model, Msg, route) import DataSource exposing (DataSource) import DataSource.Port @@ -26,7 +26,7 @@ type alias RouteParams = {} -route : StatelessRoute RouteParams Data +route : StatelessRoute RouteParams Data ActionData route = RouteBuilder.single { head = head @@ -40,6 +40,10 @@ type alias Data = } +type alias ActionData = + {} + + data : DataSource Data data = DataSource.succeed Data @@ -47,7 +51,7 @@ data = head : - StaticPayload Data RouteParams + StaticPayload Data ActionData RouteParams -> List Head.Tag head static = [] @@ -56,7 +60,7 @@ head static = view : Maybe PageUrl -> Shared.Model - -> StaticPayload Data RouteParams + -> StaticPayload Data ActionData RouteParams -> View Msg view maybeUrl sharedModel static = { title = "Placeholder" diff --git a/examples/pokedex/app/Route/RedirectLinks.elm b/examples/pokedex/app/Route/RedirectLinks.elm index f22a64c6..58b53c95 100644 --- a/examples/pokedex/app/Route/RedirectLinks.elm +++ b/examples/pokedex/app/Route/RedirectLinks.elm @@ -1,4 +1,4 @@ -module Route.RedirectLinks exposing (Data, Model, Msg, route) +module Route.RedirectLinks exposing (ActionData, Data, Model, Msg, route) import DataSource exposing (DataSource) import Head @@ -24,7 +24,7 @@ type alias RouteParams = {} -route : StatelessRoute RouteParams Data +route : StatelessRoute RouteParams Data ActionData route = RouteBuilder.single { head = head @@ -37,13 +37,17 @@ type alias Data = {} +type alias ActionData = + {} + + data : DataSource Data data = DataSource.succeed {} head : - StaticPayload Data RouteParams + StaticPayload Data ActionData RouteParams -> List Head.Tag head static = Seo.summary @@ -65,7 +69,7 @@ head static = view : Maybe PageUrl -> Shared.Model - -> StaticPayload Data RouteParams + -> StaticPayload Data ActionData RouteParams -> View Msg view maybeUrl sharedModel static = { title = "Placeholder" diff --git a/examples/pokedex/app/Route/Rgb/Red_/Green_/Blue_.elm b/examples/pokedex/app/Route/Rgb/Red_/Green_/Blue_.elm index d6c15982..18b1f456 100644 --- a/examples/pokedex/app/Route/Rgb/Red_/Green_/Blue_.elm +++ b/examples/pokedex/app/Route/Rgb/Red_/Green_/Blue_.elm @@ -1,4 +1,4 @@ -module Route.Rgb.Red_.Green_.Blue_ exposing (Data, Model, Msg, route) +module Route.Rgb.Red_.Green_.Blue_ exposing (ActionData, Data, Model, Msg, route) import ColorHelpers import DataSource exposing (DataSource) @@ -17,7 +17,7 @@ type alias RouteParams = { red : String, green : String, blue : String } -route : StatelessRoute RouteParams Data +route : StatelessRoute RouteParams Data ActionData route = RouteBuilder.preRenderWithFallback { head = ColorHelpers.head toCssVal @@ -36,6 +36,10 @@ type alias Data = ColorHelpers.Data +type alias ActionData = + {} + + toCssVal : RouteParams -> String toCssVal routeParams = "rgb(" diff --git a/examples/pokedex/app/Route/Secret.elm b/examples/pokedex/app/Route/Secret.elm index cc7e1eaa..c6468198 100644 --- a/examples/pokedex/app/Route/Secret.elm +++ b/examples/pokedex/app/Route/Secret.elm @@ -1,4 +1,4 @@ -module Route.Secret exposing (Data, Model, Msg, route) +module Route.Secret exposing (ActionData, Data, Model, Msg, route) import DataSource exposing (DataSource) import DataSource.File @@ -29,11 +29,12 @@ type alias RouteParams = {} -route : StatelessRoute RouteParams Data +route : StatelessRoute RouteParams Data ActionData route = RouteBuilder.serverRender { head = head , data = data + , action = \_ -> Request.skip "No action" } |> RouteBuilder.buildNoState { view = view } @@ -43,6 +44,10 @@ type Data | NotLoggedIn +type alias ActionData = + {} + + type alias LoggedInInfo = { username : String , secretNote : String @@ -76,7 +81,7 @@ data routeParams = head : - StaticPayload Data RouteParams + StaticPayload Data ActionData RouteParams -> List Head.Tag head static = Seo.summary @@ -98,7 +103,7 @@ head static = view : Maybe PageUrl -> Shared.Model - -> StaticPayload Data RouteParams + -> StaticPayload Data ActionData RouteParams -> View Msg view maybeUrl sharedModel static = case static.data of diff --git a/examples/pokedex/app/Route/TailwindForm.elm b/examples/pokedex/app/Route/TailwindForm.elm index 2ded288c..00d915fa 100644 --- a/examples/pokedex/app/Route/TailwindForm.elm +++ b/examples/pokedex/app/Route/TailwindForm.elm @@ -1,4 +1,4 @@ -module Route.TailwindForm exposing (Data, Model, Msg, route) +module Route.TailwindForm exposing (ActionData, Data, Model, Msg, route) import Browser.Dom import Css exposing (Color) @@ -545,11 +545,12 @@ cancelButton = [ Html.text "Cancel" ] -route : StatefulRoute RouteParams Data Model Msg +route : StatefulRoute RouteParams Data ActionData Model Msg route = RouteBuilder.serverRender { head = head , data = data + , action = \_ -> Request.skip "No action." } |> RouteBuilder.buildWithLocalState { view = view @@ -610,6 +611,10 @@ type alias Data = } +type alias ActionData = + {} + + data : RouteParams -> Parser (DataSource (Response Data ErrorPage)) data routeParams = Request.oneOf @@ -632,7 +637,7 @@ data routeParams = head : - StaticPayload Data RouteParams + StaticPayload Data ActionData RouteParams -> List Head.Tag head static = Seo.summary @@ -703,7 +708,7 @@ view : Maybe PageUrl -> Shared.Model -> Model - -> StaticPayload Data RouteParams + -> StaticPayload Data ActionData RouteParams -> View Msg view maybeUrl sharedModel model static = let diff --git a/examples/pokedex/app/Route/Time.elm b/examples/pokedex/app/Route/Time.elm index 5b74ed98..d770bde3 100644 --- a/examples/pokedex/app/Route/Time.elm +++ b/examples/pokedex/app/Route/Time.elm @@ -1,4 +1,4 @@ -module Route.Time exposing (Data, Model, Msg, route) +module Route.Time exposing (ActionData, Data, Model, Msg, route) import DataSource exposing (DataSource) import Dict exposing (Dict) @@ -28,11 +28,12 @@ type alias RouteParams = {} -route : StatelessRoute RouteParams Data +route : StatelessRoute RouteParams Data ActionData route = RouteBuilder.serverRender { head = head , data = data + , action = \_ -> Request.skip "No action." } |> RouteBuilder.buildNoState { view = view } @@ -104,7 +105,7 @@ data routeParams = head : - StaticPayload Data RouteParams + StaticPayload Data ActionData RouteParams -> List Head.Tag head static = Seo.summary @@ -128,10 +129,14 @@ type alias Data = } +type alias ActionData = + {} + + view : Maybe PageUrl -> Shared.Model - -> StaticPayload Data RouteParams + -> StaticPayload Data ActionData RouteParams -> View Msg view maybeUrl sharedModel static = { title = "Time" diff --git a/examples/pokedex/app/Route/Todos.elm b/examples/pokedex/app/Route/Todos.elm index c9783c9a..c6e724c1 100644 --- a/examples/pokedex/app/Route/Todos.elm +++ b/examples/pokedex/app/Route/Todos.elm @@ -1,4 +1,4 @@ -module Route.Todos exposing (Data, Model, Msg, route) +module Route.Todos exposing (ActionData, Data, Model, Msg, route) import Api.InputObject import Api.Mutation @@ -50,11 +50,12 @@ type alias RouteParams = {} -route : StatefulRoute RouteParams Data Model Msg +route : StatefulRoute RouteParams Data ActionData Model Msg route = RouteBuilder.serverRender { head = head , data = data + , action = \_ -> Request.skip "No action." } |> RouteBuilder.buildWithLocalState { view = view @@ -67,7 +68,7 @@ route = init : Maybe PageUrl -> Shared.Model - -> StaticPayload Data RouteParams + -> StaticPayload Data ActionData RouteParams -> ( Model, Effect Msg ) init maybePageUrl sharedModel static = ( { submitting = False @@ -80,7 +81,7 @@ init maybePageUrl sharedModel static = update : PageUrl -> Shared.Model - -> StaticPayload Data RouteParams + -> StaticPayload Data ActionData RouteParams -> Msg -> Model -> ( Model, Effect Msg ) @@ -128,6 +129,10 @@ type alias Data = } +type alias ActionData = + {} + + type alias Todo = { description : String , id : String @@ -213,7 +218,7 @@ data routeParams = head : - StaticPayload Data RouteParams + StaticPayload Data ActionData RouteParams -> List Head.Tag head static = Seo.summary @@ -236,7 +241,7 @@ view : Maybe PageUrl -> Shared.Model -> Model - -> StaticPayload Data RouteParams + -> StaticPayload Data ActionData RouteParams -> View Msg view maybeUrl sharedModel model static = { title = "Todos"