mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-28 06:05:31 +03:00
Use record for parameters in Pages.Generate to make it more manageable to keep track of names.
This commit is contained in:
parent
d6efc56152
commit
2ddd0c89e8
@ -86,13 +86,13 @@ buildFile moduleName =
|
||||
}
|
||||
|> Pages.Generate.buildWithLocalState
|
||||
{ view =
|
||||
\maybeUrl sharedModel model app ->
|
||||
\{ maybeUrl, sharedModel, model, app } ->
|
||||
Gen.View.make_.view
|
||||
{ title = moduleName |> String.join "." |> Elm.string
|
||||
, body = Elm.list [ Gen.Html.Styled.text "Here is your generated page!!!" ]
|
||||
}
|
||||
, update =
|
||||
\pageUrl sharedModel app msg model ->
|
||||
\{ pageUrl, sharedModel, app, msg, model } ->
|
||||
Elm.Case.custom msg
|
||||
(Elm.Annotation.named [] "Msg")
|
||||
[ Elm.Case.branch0 "NoOp"
|
||||
@ -103,13 +103,13 @@ buildFile moduleName =
|
||||
)
|
||||
]
|
||||
, init =
|
||||
\pageUrl sharedModel app ->
|
||||
\{ pageUrl, sharedModel, app } ->
|
||||
Elm.tuple (Elm.record [])
|
||||
(Gen.Effect.none
|
||||
|> Elm.withType effectType
|
||||
)
|
||||
, subscriptions =
|
||||
\maybePageUrl routeParams path sharedModel model ->
|
||||
\{ maybePageUrl, routeParams, path, sharedModel, model } ->
|
||||
Gen.Platform.Sub.none
|
||||
, model =
|
||||
Alias (Elm.Annotation.record [])
|
||||
|
@ -128,7 +128,7 @@ single input =
|
||||
|
||||
{-| -}
|
||||
buildNoState :
|
||||
{ view : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
||||
{ view : { maybeUrl : Elm.Expression, sharedModel : Elm.Expression, app : Elm.Expression } -> Elm.Expression
|
||||
}
|
||||
-> Builder
|
||||
-> Elm.File
|
||||
@ -136,7 +136,13 @@ buildNoState definitions builder_ =
|
||||
case builder_ of
|
||||
ServerRender builder ->
|
||||
userFunction builder.moduleName
|
||||
{ view = \_ -> definitions.view
|
||||
{ view =
|
||||
\maybeUrl sharedModel _ app ->
|
||||
definitions.view
|
||||
{ maybeUrl = maybeUrl
|
||||
, sharedModel = sharedModel
|
||||
, app = app
|
||||
}
|
||||
, localState = Nothing
|
||||
, data = builder.data |> Tuple.second
|
||||
, action = builder.action |> Tuple.second |> Action
|
||||
@ -151,7 +157,13 @@ buildNoState definitions builder_ =
|
||||
|
||||
PreRender builder ->
|
||||
userFunction builder.moduleName
|
||||
{ view = \_ -> definitions.view
|
||||
{ view =
|
||||
\maybeUrl sharedModel _ app ->
|
||||
definitions.view
|
||||
{ maybeUrl = maybeUrl
|
||||
, sharedModel = sharedModel
|
||||
, app = app
|
||||
}
|
||||
, localState = Nothing
|
||||
, data = builder.data |> Tuple.second
|
||||
, action = builder.pages |> Pages
|
||||
@ -170,10 +182,30 @@ buildNoState definitions builder_ =
|
||||
|
||||
{-| -}
|
||||
buildWithLocalState :
|
||||
{ view : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
||||
, update : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
||||
, init : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
||||
, subscriptions : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
||||
{ view :
|
||||
{ maybeUrl : Elm.Expression, sharedModel : Elm.Expression, model : Elm.Expression, app : Elm.Expression } -> Elm.Expression
|
||||
, update :
|
||||
{ pageUrl : Elm.Expression
|
||||
, sharedModel : Elm.Expression
|
||||
, app : Elm.Expression
|
||||
, msg : Elm.Expression
|
||||
, model : Elm.Expression
|
||||
}
|
||||
-> Elm.Expression
|
||||
, init :
|
||||
{ pageUrl : Elm.Expression
|
||||
, sharedModel : Elm.Expression
|
||||
, app : Elm.Expression
|
||||
}
|
||||
-> Elm.Expression
|
||||
, subscriptions :
|
||||
{ maybePageUrl : Elm.Expression
|
||||
, routeParams : Elm.Expression
|
||||
, path : Elm.Expression
|
||||
, sharedModel : Elm.Expression
|
||||
, model : Elm.Expression
|
||||
}
|
||||
-> Elm.Expression
|
||||
, msg : Type
|
||||
, model : Type
|
||||
}
|
||||
@ -183,12 +215,41 @@ buildWithLocalState definitions builder_ =
|
||||
case builder_ of
|
||||
ServerRender builder ->
|
||||
userFunction builder.moduleName
|
||||
{ view = definitions.view
|
||||
{ view =
|
||||
\maybeUrl sharedModel model app ->
|
||||
definitions.view
|
||||
{ maybeUrl = maybeUrl
|
||||
, sharedModel = sharedModel
|
||||
, model = model
|
||||
, app = app
|
||||
}
|
||||
, localState =
|
||||
Just
|
||||
{ update = definitions.update
|
||||
, init = definitions.init
|
||||
, subscriptions = definitions.subscriptions
|
||||
{ update =
|
||||
\pageUrl sharedModel app msg model ->
|
||||
definitions.update
|
||||
{ pageUrl = pageUrl
|
||||
, sharedModel = sharedModel
|
||||
, app = app
|
||||
, msg = msg
|
||||
, model = model
|
||||
}
|
||||
, init =
|
||||
\pageUrl sharedModel app ->
|
||||
definitions.init
|
||||
{ pageUrl = pageUrl
|
||||
, sharedModel = sharedModel
|
||||
, app = app
|
||||
}
|
||||
, subscriptions =
|
||||
\maybePageUrl routeParams path sharedModel model ->
|
||||
definitions.subscriptions
|
||||
{ maybePageUrl = maybePageUrl
|
||||
, routeParams = routeParams
|
||||
, path = path
|
||||
, sharedModel = sharedModel
|
||||
, model = model
|
||||
}
|
||||
, state = LocalState
|
||||
}
|
||||
, data = builder.data |> Tuple.second
|
||||
@ -204,12 +265,41 @@ buildWithLocalState definitions builder_ =
|
||||
|
||||
PreRender builder ->
|
||||
userFunction builder.moduleName
|
||||
{ view = definitions.view
|
||||
{ view =
|
||||
\maybeUrl sharedModel model app ->
|
||||
definitions.view
|
||||
{ maybeUrl = maybeUrl
|
||||
, sharedModel = sharedModel
|
||||
, model = model
|
||||
, app = app
|
||||
}
|
||||
, localState =
|
||||
Just
|
||||
{ update = definitions.update
|
||||
, init = definitions.init
|
||||
, subscriptions = definitions.subscriptions
|
||||
{ update =
|
||||
\pageUrl sharedModel app msg model ->
|
||||
definitions.update
|
||||
{ pageUrl = pageUrl
|
||||
, sharedModel = sharedModel
|
||||
, app = app
|
||||
, msg = msg
|
||||
, model = model
|
||||
}
|
||||
, init =
|
||||
\pageUrl sharedModel app ->
|
||||
definitions.init
|
||||
{ pageUrl = pageUrl
|
||||
, sharedModel = sharedModel
|
||||
, app = app
|
||||
}
|
||||
, subscriptions =
|
||||
\maybePageUrl routeParams path sharedModel model ->
|
||||
definitions.subscriptions
|
||||
{ maybePageUrl = maybePageUrl
|
||||
, routeParams = routeParams
|
||||
, path = path
|
||||
, sharedModel = sharedModel
|
||||
, model = model
|
||||
}
|
||||
, state = LocalState
|
||||
}
|
||||
, data = builder.data |> Tuple.second
|
||||
@ -229,10 +319,30 @@ buildWithLocalState definitions builder_ =
|
||||
|
||||
{-| -}
|
||||
buildWithSharedState :
|
||||
{ view : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
||||
, update : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
||||
, init : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
||||
, subscriptions : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
||||
{ view :
|
||||
{ maybeUrl : Elm.Expression, sharedModel : Elm.Expression, model : Elm.Expression, app : Elm.Expression } -> Elm.Expression
|
||||
, update :
|
||||
{ pageUrl : Elm.Expression
|
||||
, sharedModel : Elm.Expression
|
||||
, app : Elm.Expression
|
||||
, msg : Elm.Expression
|
||||
, model : Elm.Expression
|
||||
}
|
||||
-> Elm.Expression
|
||||
, init :
|
||||
{ pageUrl : Elm.Expression
|
||||
, sharedModel : Elm.Expression
|
||||
, app : Elm.Expression
|
||||
}
|
||||
-> Elm.Expression
|
||||
, subscriptions :
|
||||
{ maybePageUrl : Elm.Expression
|
||||
, routeParams : Elm.Expression
|
||||
, path : Elm.Expression
|
||||
, sharedModel : Elm.Expression
|
||||
, model : Elm.Expression
|
||||
}
|
||||
-> Elm.Expression
|
||||
, msg : Type
|
||||
, model : Type
|
||||
}
|
||||
@ -242,12 +352,41 @@ buildWithSharedState definitions builder_ =
|
||||
case builder_ of
|
||||
ServerRender builder ->
|
||||
userFunction builder.moduleName
|
||||
{ view = definitions.view
|
||||
{ view =
|
||||
\maybeUrl sharedModel model app ->
|
||||
definitions.view
|
||||
{ maybeUrl = maybeUrl
|
||||
, sharedModel = sharedModel
|
||||
, model = model
|
||||
, app = app
|
||||
}
|
||||
, localState =
|
||||
Just
|
||||
{ update = definitions.update
|
||||
, init = definitions.init
|
||||
, subscriptions = definitions.subscriptions
|
||||
{ update =
|
||||
\pageUrl sharedModel app msg model ->
|
||||
definitions.update
|
||||
{ pageUrl = pageUrl
|
||||
, sharedModel = sharedModel
|
||||
, app = app
|
||||
, msg = msg
|
||||
, model = model
|
||||
}
|
||||
, init =
|
||||
\pageUrl sharedModel app ->
|
||||
definitions.init
|
||||
{ pageUrl = pageUrl
|
||||
, sharedModel = sharedModel
|
||||
, app = app
|
||||
}
|
||||
, subscriptions =
|
||||
\maybePageUrl routeParams path sharedModel model ->
|
||||
definitions.subscriptions
|
||||
{ maybePageUrl = maybePageUrl
|
||||
, routeParams = routeParams
|
||||
, path = path
|
||||
, sharedModel = sharedModel
|
||||
, model = model
|
||||
}
|
||||
, state = SharedState
|
||||
}
|
||||
, data = builder.data |> Tuple.second
|
||||
@ -263,12 +402,41 @@ buildWithSharedState definitions builder_ =
|
||||
|
||||
PreRender builder ->
|
||||
userFunction builder.moduleName
|
||||
{ view = definitions.view
|
||||
{ view =
|
||||
\maybeUrl sharedModel model app ->
|
||||
definitions.view
|
||||
{ maybeUrl = maybeUrl
|
||||
, sharedModel = sharedModel
|
||||
, model = model
|
||||
, app = app
|
||||
}
|
||||
, localState =
|
||||
Just
|
||||
{ update = definitions.update
|
||||
, init = definitions.init
|
||||
, subscriptions = definitions.subscriptions
|
||||
{ update =
|
||||
\pageUrl sharedModel app msg model ->
|
||||
definitions.update
|
||||
{ pageUrl = pageUrl
|
||||
, sharedModel = sharedModel
|
||||
, app = app
|
||||
, msg = msg
|
||||
, model = model
|
||||
}
|
||||
, init =
|
||||
\pageUrl sharedModel app ->
|
||||
definitions.init
|
||||
{ pageUrl = pageUrl
|
||||
, sharedModel = sharedModel
|
||||
, app = app
|
||||
}
|
||||
, subscriptions =
|
||||
\maybePageUrl routeParams path sharedModel model ->
|
||||
definitions.subscriptions
|
||||
{ maybePageUrl = maybePageUrl
|
||||
, routeParams = routeParams
|
||||
, path = path
|
||||
, sharedModel = sharedModel
|
||||
, model = model
|
||||
}
|
||||
, state = SharedState
|
||||
}
|
||||
, data = builder.data |> Tuple.second
|
||||
|
Loading…
Reference in New Issue
Block a user