elm-pages 3.0.0-beta.27 → 3.0.0-beta.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26623,7 +26623,7 @@ var $author$project$Pages$Review$DeadCodeEliminateDataTest$all = A2(
26623
26623
  [
26624
26624
  A2(
26625
26625
  $jfmengels$elm_review$Review$Test$whenFixed,
26626
- 'module Route.Index exposing (Data, Model, Msg, route)\n\nimport Server.Request as Request\n\nimport BackendTask exposing (BackendTask)\nimport FatalError\nimport RouteBuilder exposing (Page, StaticPayload, single)\nimport Pages.PageUrl exposing (PageUrl)\nimport Pages.Url\nimport Path\nimport Route exposing (Route)\nimport Shared\nimport View exposing (View)\n\n\ntype alias Model =\n {}\n\n\ntype alias Msg =\n ()\n\n\ntype alias RouteParams =\n {}\n\n\ntype alias Data =\n ()\n\n\nroute : StatelessRoute RouteParams Data ActionData\nroute =\n single\n { head = head\n , data = BackendTask.fail (FatalError.fromString "")\n }\n |> RouteBuilder.buildNoState { view = view }\n\n\ndata : BackendTask Data\ndata =\n BackendTask.succeed ()\n',
26626
+ 'module Route.Index exposing (Data, Model, Msg, route)\n\nimport Server.Request as Request\n\nimport BackendTask exposing (BackendTask)\nimport FatalError\nimport RouteBuilder exposing (Page, App, single)\nimport Pages.PageUrl exposing (PageUrl)\nimport Pages.Url\nimport Path\nimport Route exposing (Route)\nimport Shared\nimport View exposing (View)\n\n\ntype alias Model =\n {}\n\n\ntype alias Msg =\n ()\n\n\ntype alias RouteParams =\n {}\n\n\ntype alias Data =\n ()\n\n\nroute : StatelessRoute RouteParams Data ActionData\nroute =\n single\n { head = head\n , data = BackendTask.fail (FatalError.fromString "")\n }\n |> RouteBuilder.buildNoState { view = view }\n\n\ndata : BackendTask Data\ndata =\n BackendTask.succeed ()\n',
26627
26627
  $jfmengels$elm_review$Review$Test$error(
26628
26628
  {
26629
26629
  details: _List_fromArray(
@@ -26632,7 +26632,7 @@ var $author$project$Pages$Review$DeadCodeEliminateDataTest$all = A2(
26632
26632
  under: 'data = data\n }'
26633
26633
  }))
26634
26634
  ]),
26635
- A2($jfmengels$elm_review$Review$Test$run, $author$project$Pages$Review$DeadCodeEliminateData$rule, 'module Route.Index exposing (Data, Model, Msg, route)\n\nimport Server.Request as Request\n\nimport BackendTask exposing (BackendTask)\nimport FatalError\nimport RouteBuilder exposing (Page, StaticPayload, single)\nimport Pages.PageUrl exposing (PageUrl)\nimport Pages.Url\nimport Path\nimport Route exposing (Route)\nimport Shared\nimport View exposing (View)\n\n\ntype alias Model =\n {}\n\n\ntype alias Msg =\n ()\n\n\ntype alias RouteParams =\n {}\n\n\ntype alias Data =\n ()\n\n\nroute : StatelessRoute RouteParams Data ActionData\nroute =\n single\n { head = head\n , data = data\n }\n |> RouteBuilder.buildNoState { view = view }\n\n\ndata : BackendTask Data\ndata =\n BackendTask.succeed ()\n'));
26635
+ A2($jfmengels$elm_review$Review$Test$run, $author$project$Pages$Review$DeadCodeEliminateData$rule, 'module Route.Index exposing (Data, Model, Msg, route)\n\nimport Server.Request as Request\n\nimport BackendTask exposing (BackendTask)\nimport FatalError\nimport RouteBuilder exposing (Page, App, single)\nimport Pages.PageUrl exposing (PageUrl)\nimport Pages.Url\nimport Path\nimport Route exposing (Route)\nimport Shared\nimport View exposing (View)\n\n\ntype alias Model =\n {}\n\n\ntype alias Msg =\n ()\n\n\ntype alias RouteParams =\n {}\n\n\ntype alias Data =\n ()\n\n\nroute : StatelessRoute RouteParams Data ActionData\nroute =\n single\n { head = head\n , data = data\n }\n |> RouteBuilder.buildNoState { view = view }\n\n\ndata : BackendTask Data\ndata =\n BackendTask.succeed ()\n'));
26636
26636
  }),
26637
26637
  A2(
26638
26638
  $elm_explorations$test$Test$test,
@@ -26644,7 +26644,7 @@ var $author$project$Pages$Review$DeadCodeEliminateDataTest$all = A2(
26644
26644
  [
26645
26645
  A2(
26646
26646
  $jfmengels$elm_review$Review$Test$whenFixed,
26647
- 'module Route.Index exposing (Data, Model, Msg, route)\n\nimport Server.Request as Request\nimport FatalError\nimport BackendTask as DS\nimport RouteBuilder exposing (Page, StaticPayload, single)\nimport Pages.PageUrl exposing (PageUrl)\nimport Pages.Url\nimport Path\nimport Route exposing (Route)\nimport Shared\nimport View exposing (View)\n\n\ntype alias Model =\n {}\n\n\ntype alias Msg =\n ()\n\n\ntype alias RouteParams =\n {}\n\n\ntype alias Data =\n ()\n\n\nroute : StatelessRoute RouteParams Data ActionData\nroute =\n single\n { head = head\n , data = DS.fail (FatalError.fromString "")\n }\n |> RouteBuilder.buildNoState { view = view }\n\n\ndata : BackendTask Data\ndata =\n BackendTask.succeed ()\n',
26647
+ 'module Route.Index exposing (Data, Model, Msg, route)\n\nimport Server.Request as Request\nimport FatalError\nimport BackendTask as DS\nimport RouteBuilder exposing (Page, App, single)\nimport Pages.PageUrl exposing (PageUrl)\nimport Pages.Url\nimport Path\nimport Route exposing (Route)\nimport Shared\nimport View exposing (View)\n\n\ntype alias Model =\n {}\n\n\ntype alias Msg =\n ()\n\n\ntype alias RouteParams =\n {}\n\n\ntype alias Data =\n ()\n\n\nroute : StatelessRoute RouteParams Data ActionData\nroute =\n single\n { head = head\n , data = DS.fail (FatalError.fromString "")\n }\n |> RouteBuilder.buildNoState { view = view }\n\n\ndata : BackendTask Data\ndata =\n BackendTask.succeed ()\n',
26648
26648
  $jfmengels$elm_review$Review$Test$error(
26649
26649
  {
26650
26650
  details: _List_fromArray(
@@ -26653,7 +26653,7 @@ var $author$project$Pages$Review$DeadCodeEliminateDataTest$all = A2(
26653
26653
  under: 'data = data\n }'
26654
26654
  }))
26655
26655
  ]),
26656
- A2($jfmengels$elm_review$Review$Test$run, $author$project$Pages$Review$DeadCodeEliminateData$rule, 'module Route.Index exposing (Data, Model, Msg, route)\n\nimport Server.Request as Request\nimport FatalError\nimport BackendTask as DS\nimport RouteBuilder exposing (Page, StaticPayload, single)\nimport Pages.PageUrl exposing (PageUrl)\nimport Pages.Url\nimport Path\nimport Route exposing (Route)\nimport Shared\nimport View exposing (View)\n\n\ntype alias Model =\n {}\n\n\ntype alias Msg =\n ()\n\n\ntype alias RouteParams =\n {}\n\n\ntype alias Data =\n ()\n\n\nroute : StatelessRoute RouteParams Data ActionData\nroute =\n single\n { head = head\n , data = data\n }\n |> RouteBuilder.buildNoState { view = view }\n\n\ndata : BackendTask Data\ndata =\n BackendTask.succeed ()\n'));
26656
+ A2($jfmengels$elm_review$Review$Test$run, $author$project$Pages$Review$DeadCodeEliminateData$rule, 'module Route.Index exposing (Data, Model, Msg, route)\n\nimport Server.Request as Request\nimport FatalError\nimport BackendTask as DS\nimport RouteBuilder exposing (Page, App, single)\nimport Pages.PageUrl exposing (PageUrl)\nimport Pages.Url\nimport Path\nimport Route exposing (Route)\nimport Shared\nimport View exposing (View)\n\n\ntype alias Model =\n {}\n\n\ntype alias Msg =\n ()\n\n\ntype alias RouteParams =\n {}\n\n\ntype alias Data =\n ()\n\n\nroute : StatelessRoute RouteParams Data ActionData\nroute =\n single\n { head = head\n , data = data\n }\n |> RouteBuilder.buildNoState { view = view }\n\n\ndata : BackendTask Data\ndata =\n BackendTask.succeed ()\n'));
26657
26657
  }),
26658
26658
  A2(
26659
26659
  $elm_explorations$test$Test$test,
@@ -26665,7 +26665,7 @@ var $author$project$Pages$Review$DeadCodeEliminateDataTest$all = A2(
26665
26665
  [
26666
26666
  A2(
26667
26667
  $jfmengels$elm_review$Review$Test$whenFixed,
26668
- 'module Route.Blog.Slug_ exposing (Data, Model, Msg, route)\n\nimport Server.Request as Request\n\nimport BackendTask exposing (BackendTask)\nimport FatalError\nimport RouteBuilder exposing (Page, StaticPayload)\nimport Pages.PageUrl exposing (PageUrl)\nimport Pages.Url\nimport Path\nimport Route exposing (Route)\nimport Shared\nimport View exposing (View)\n\n\ntype alias Model =\n {}\n\n\ntype alias Msg =\n ()\n\n\ntype alias RouteParams =\n { slug : String }\n\n\ntype alias Data =\n ()\n\n\nroute : StatelessRoute RouteParams Data ActionData\nroute =\n RouteBuilder.preRender\n { data = \\_ -> BackendTask.fail (FatalError.fromString "")\n , head = head\n , pages = pages\n }\n |> RouteBuilder.buildNoState { view = view }\n\n\ndata : BackendTask Data\ndata =\n BackendTask.succeed ()\n',
26668
+ 'module Route.Blog.Slug_ exposing (Data, Model, Msg, route)\n\nimport Server.Request as Request\n\nimport BackendTask exposing (BackendTask)\nimport FatalError\nimport RouteBuilder exposing (Page, App)\nimport Pages.PageUrl exposing (PageUrl)\nimport Pages.Url\nimport Path\nimport Route exposing (Route)\nimport Shared\nimport View exposing (View)\n\n\ntype alias Model =\n {}\n\n\ntype alias Msg =\n ()\n\n\ntype alias RouteParams =\n { slug : String }\n\n\ntype alias Data =\n ()\n\n\nroute : StatelessRoute RouteParams Data ActionData\nroute =\n RouteBuilder.preRender\n { data = \\_ -> BackendTask.fail (FatalError.fromString "")\n , head = head\n , pages = pages\n }\n |> RouteBuilder.buildNoState { view = view }\n\n\ndata : BackendTask Data\ndata =\n BackendTask.succeed ()\n',
26669
26669
  $jfmengels$elm_review$Review$Test$error(
26670
26670
  {
26671
26671
  details: _List_fromArray(
@@ -26674,7 +26674,7 @@ var $author$project$Pages$Review$DeadCodeEliminateDataTest$all = A2(
26674
26674
  under: 'data = data'
26675
26675
  }))
26676
26676
  ]),
26677
- A2($jfmengels$elm_review$Review$Test$run, $author$project$Pages$Review$DeadCodeEliminateData$rule, 'module Route.Blog.Slug_ exposing (Data, Model, Msg, route)\n\nimport Server.Request as Request\n\nimport BackendTask exposing (BackendTask)\nimport FatalError\nimport RouteBuilder exposing (Page, StaticPayload)\nimport Pages.PageUrl exposing (PageUrl)\nimport Pages.Url\nimport Path\nimport Route exposing (Route)\nimport Shared\nimport View exposing (View)\n\n\ntype alias Model =\n {}\n\n\ntype alias Msg =\n ()\n\n\ntype alias RouteParams =\n { slug : String }\n\n\ntype alias Data =\n ()\n\n\nroute : StatelessRoute RouteParams Data ActionData\nroute =\n RouteBuilder.preRender\n { data = data\n , head = head\n , pages = pages\n }\n |> RouteBuilder.buildNoState { view = view }\n\n\ndata : BackendTask Data\ndata =\n BackendTask.succeed ()\n'));
26677
+ A2($jfmengels$elm_review$Review$Test$run, $author$project$Pages$Review$DeadCodeEliminateData$rule, 'module Route.Blog.Slug_ exposing (Data, Model, Msg, route)\n\nimport Server.Request as Request\n\nimport BackendTask exposing (BackendTask)\nimport FatalError\nimport RouteBuilder exposing (Page, App)\nimport Pages.PageUrl exposing (PageUrl)\nimport Pages.Url\nimport Path\nimport Route exposing (Route)\nimport Shared\nimport View exposing (View)\n\n\ntype alias Model =\n {}\n\n\ntype alias Msg =\n ()\n\n\ntype alias RouteParams =\n { slug : String }\n\n\ntype alias Data =\n ()\n\n\nroute : StatelessRoute RouteParams Data ActionData\nroute =\n RouteBuilder.preRender\n { data = data\n , head = head\n , pages = pages\n }\n |> RouteBuilder.buildNoState { view = view }\n\n\ndata : BackendTask Data\ndata =\n BackendTask.succeed ()\n'));
26678
26678
  }),
26679
26679
  A2(
26680
26680
  $elm_explorations$test$Test$test,
@@ -26750,7 +26750,7 @@ var $author$project$Pages$Review$DeadCodeEliminateDataTest$all = A2(
26750
26750
  'no fix after replacement is made',
26751
26751
  function (_v6) {
26752
26752
  return $jfmengels$elm_review$Review$Test$expectNoErrors(
26753
- A2($jfmengels$elm_review$Review$Test$run, $author$project$Pages$Review$DeadCodeEliminateData$rule, 'module Route.Index exposing (Data, Model, Msg, route)\n\nimport Server.Request as Request\nimport FatalError\n\nimport BackendTask exposing (BackendTask)\nimport RouteBuilder exposing (Page, StaticPayload)\nimport Pages.PageUrl exposing (PageUrl)\nimport Pages.Url\nimport Path\nimport Route exposing (Route)\nimport Shared\nimport View exposing (View)\n\n\ntype alias Model =\n {}\n\n\ntype alias Msg =\n ()\n\n\ntype alias RouteParams =\n {}\n\n\ntype alias Data =\n ()\n\n\nroute : StatelessRoute RouteParams Data ActionData\nroute =\n RouteBuilder.single\n { head = head\n , data = BackendTask.fail (FatalError.fromString "")\n }\n |> RouteBuilder.buildNoState { view = view }\n\n\ndata : BackendTask Data\ndata =\n BackendTask.succeed ()\n'));
26753
+ A2($jfmengels$elm_review$Review$Test$run, $author$project$Pages$Review$DeadCodeEliminateData$rule, 'module Route.Index exposing (Data, Model, Msg, route)\n\nimport Server.Request as Request\nimport FatalError\n\nimport BackendTask exposing (BackendTask)\nimport RouteBuilder exposing (Page, App)\nimport Pages.PageUrl exposing (PageUrl)\nimport Pages.Url\nimport Path\nimport Route exposing (Route)\nimport Shared\nimport View exposing (View)\n\n\ntype alias Model =\n {}\n\n\ntype alias Msg =\n ()\n\n\ntype alias RouteParams =\n {}\n\n\ntype alias Data =\n ()\n\n\nroute : StatelessRoute RouteParams Data ActionData\nroute =\n RouteBuilder.single\n { head = head\n , data = BackendTask.fail (FatalError.fromString "")\n }\n |> RouteBuilder.buildNoState { view = view }\n\n\ndata : BackendTask Data\ndata =\n BackendTask.succeed ()\n'));
26754
26754
  }),
26755
26755
  A2(
26756
26756
  $elm_explorations$test$Test$test,
@@ -75,7 +75,7 @@ console.elmlog = (str) => logs.push(str + "\n");
75
75
  const { Elm } = require("./Runner.elm.js");
76
76
 
77
77
  // Start the Elm app
78
- const flags = { initialSeed: 4148740016, fuzzRuns: 100, filter: null };
78
+ const flags = { initialSeed: 2987429368, fuzzRuns: 100, filter: null };
79
79
  const app = Elm.Runner.init({ flags: flags });
80
80
 
81
81
  // Record the timing at which we received the last "runTest" message
@@ -82,7 +82,7 @@ const verbosity = 0;
82
82
  // Create a long lived reporter worker
83
83
  const { Elm } = require("./Reporter.elm.js");
84
84
  const flags = {
85
- initialSeed: 4148740016,
85
+ initialSeed: 2987429368,
86
86
  fuzzRuns: 100,
87
87
  mode: "consoleColor",
88
88
  verbosity: verbosity,
@@ -16,7 +16,7 @@ import Server.Request as Request
16
16
 
17
17
  import BackendTask exposing (BackendTask)
18
18
  import FatalError
19
- import RouteBuilder exposing (Page, StaticPayload, single)
19
+ import RouteBuilder exposing (Page, App, single)
20
20
  import Pages.PageUrl exposing (PageUrl)
21
21
  import Pages.Url
22
22
  import Path
@@ -71,7 +71,7 @@ import Server.Request as Request
71
71
 
72
72
  import BackendTask exposing (BackendTask)
73
73
  import FatalError
74
- import RouteBuilder exposing (Page, StaticPayload, single)
74
+ import RouteBuilder exposing (Page, App, single)
75
75
  import Pages.PageUrl exposing (PageUrl)
76
76
  import Pages.Url
77
77
  import Path
@@ -117,7 +117,7 @@ data =
117
117
  import Server.Request as Request
118
118
  import FatalError
119
119
  import BackendTask as DS
120
- import RouteBuilder exposing (Page, StaticPayload, single)
120
+ import RouteBuilder exposing (Page, App, single)
121
121
  import Pages.PageUrl exposing (PageUrl)
122
122
  import Pages.Url
123
123
  import Path
@@ -171,7 +171,7 @@ data =
171
171
  import Server.Request as Request
172
172
  import FatalError
173
173
  import BackendTask as DS
174
- import RouteBuilder exposing (Page, StaticPayload, single)
174
+ import RouteBuilder exposing (Page, App, single)
175
175
  import Pages.PageUrl exposing (PageUrl)
176
176
  import Pages.Url
177
177
  import Path
@@ -218,7 +218,7 @@ import Server.Request as Request
218
218
 
219
219
  import BackendTask exposing (BackendTask)
220
220
  import FatalError
221
- import RouteBuilder exposing (Page, StaticPayload)
221
+ import RouteBuilder exposing (Page, App)
222
222
  import Pages.PageUrl exposing (PageUrl)
223
223
  import Pages.Url
224
224
  import Path
@@ -273,7 +273,7 @@ import Server.Request as Request
273
273
 
274
274
  import BackendTask exposing (BackendTask)
275
275
  import FatalError
276
- import RouteBuilder exposing (Page, StaticPayload)
276
+ import RouteBuilder exposing (Page, App)
277
277
  import Pages.PageUrl exposing (PageUrl)
278
278
  import Pages.Url
279
279
  import Path
@@ -552,7 +552,7 @@ import Server.Request as Request
552
552
  import FatalError
553
553
 
554
554
  import BackendTask exposing (BackendTask)
555
- import RouteBuilder exposing (Page, StaticPayload)
555
+ import RouteBuilder exposing (Page, App)
556
556
  import Pages.PageUrl exposing (PageUrl)
557
557
  import Pages.Url
558
558
  import Path
@@ -75,7 +75,7 @@ console.elmlog = (str) => logs.push(str + "\n");
75
75
  const { Elm } = require("./Runner.elm.js");
76
76
 
77
77
  // Start the Elm app
78
- const flags = { initialSeed: 1833568720, fuzzRuns: 100, filter: null };
78
+ const flags = { initialSeed: 776409072, fuzzRuns: 100, filter: null };
79
79
  const app = Elm.Runner.init({ flags: flags });
80
80
 
81
81
  // Record the timing at which we received the last "runTest" message
@@ -82,7 +82,7 @@ const verbosity = 0;
82
82
  // Create a long lived reporter worker
83
83
  const { Elm } = require("./Reporter.elm.js");
84
84
  const flags = {
85
- initialSeed: 1833568720,
85
+ initialSeed: 776409072,
86
86
  fuzzRuns: 100,
87
87
  mode: "consoleColor",
88
88
  verbosity: verbosity,
@@ -1,6 +1,6 @@
1
1
  module RouteBuilder exposing
2
2
  ( StatelessRoute, buildNoState
3
- , StaticPayload
3
+ , App
4
4
  , withOnAction
5
5
  , buildWithLocalState, buildWithSharedState
6
6
  , preRender, single
@@ -37,7 +37,7 @@ We have the following data during pre-render:
37
37
  - `sharedData` - we can access any shared data between pages. For example, you may have fetched the name of a blog ("Jane's Blog") from the API for a Content Management System (CMS).
38
38
  - `routeParams` - this is the record that includes any Dynamic Route Segments for the given page (or an empty record if there are none)
39
39
 
40
- @docs StaticPayload
40
+ @docs App
41
41
 
42
42
  @docs withOnAction
43
43
 
@@ -97,9 +97,9 @@ import Pages.Fetcher
97
97
  import Pages.FormState
98
98
  import Pages.Internal.NotFoundReason exposing (NotFoundReason)
99
99
  import Pages.Internal.RoutePattern exposing (RoutePattern)
100
- import PagesMsg exposing (PagesMsg)
101
100
  import Pages.PageUrl exposing (PageUrl)
102
101
  import Pages.Transition
102
+ import PagesMsg exposing (PagesMsg)
103
103
  import Path exposing (Path)
104
104
  import Server.Request
105
105
  import Server.Response
@@ -113,17 +113,16 @@ type alias StatefulRoute routeParams data action model msg =
113
113
  , action : Json.Decode.Value -> routeParams -> BackendTask FatalError (Server.Response.Response action ErrorPage)
114
114
  , staticRoutes : BackendTask FatalError (List routeParams)
115
115
  , view :
116
- Maybe PageUrl
117
- -> Shared.Model
116
+ Shared.Model
118
117
  -> model
119
- -> StaticPayload data action routeParams
118
+ -> App data action routeParams
120
119
  -> View (PagesMsg msg)
121
120
  , head :
122
- StaticPayload data action routeParams
121
+ App data action routeParams
123
122
  -> List Head.Tag
124
- , init : Maybe PageUrl -> Shared.Model -> StaticPayload data action routeParams -> ( model, Effect msg )
125
- , update : PageUrl -> StaticPayload data action routeParams -> msg -> model -> Shared.Model -> ( model, Effect msg, Maybe Shared.Msg )
126
- , subscriptions : Maybe PageUrl -> routeParams -> Path -> model -> Shared.Model -> Sub msg
123
+ , init : Shared.Model -> App data action routeParams -> ( model, Effect msg )
124
+ , update : App data action routeParams -> msg -> model -> Shared.Model -> ( model, Effect msg, Maybe Shared.Msg )
125
+ , subscriptions : routeParams -> Path -> model -> Shared.Model -> Sub msg
127
126
  , handleRoute : { moduleName : List String, routePattern : RoutePattern } -> (routeParams -> List ( String, String )) -> routeParams -> BackendTask FatalError (Maybe NotFoundReason)
128
127
  , kind : String
129
128
  , onAction : Maybe (action -> msg)
@@ -136,11 +135,12 @@ type alias StatelessRoute routeParams data action =
136
135
 
137
136
 
138
137
  {-| -}
139
- type alias StaticPayload data action routeParams =
138
+ type alias App data action routeParams =
140
139
  { data : data
141
140
  , sharedData : Shared.Data
142
141
  , routeParams : routeParams
143
142
  , path : Path
143
+ , url : Maybe PageUrl
144
144
  , action : Maybe action
145
145
  , submit :
146
146
  { fields : List ( String, String ), headers : List ( String, String ) }
@@ -158,7 +158,7 @@ type Builder routeParams data action
158
158
  , action : Json.Decode.Value -> routeParams -> BackendTask FatalError (Server.Response.Response action ErrorPage)
159
159
  , staticRoutes : BackendTask FatalError (List routeParams)
160
160
  , head :
161
- StaticPayload data action routeParams
161
+ App data action routeParams
162
162
  -> List Head.Tag
163
163
  , serverless : Bool
164
164
  , handleRoute :
@@ -173,9 +173,8 @@ type Builder routeParams data action
173
173
  {-| -}
174
174
  buildNoState :
175
175
  { view :
176
- Maybe PageUrl
176
+ App data action routeParams
177
177
  -> Shared.Model
178
- -> StaticPayload data action routeParams
179
178
  -> View (PagesMsg ())
180
179
  }
181
180
  -> Builder routeParams data action
@@ -183,14 +182,14 @@ buildNoState :
183
182
  buildNoState { view } builderState =
184
183
  case builderState of
185
184
  WithData record ->
186
- { view = \maybePageUrl sharedModel _ -> view maybePageUrl sharedModel
185
+ { view = \shared model app -> view app shared
187
186
  , head = record.head
188
187
  , data = record.data
189
188
  , action = record.action
190
189
  , staticRoutes = record.staticRoutes
191
- , init = \_ _ _ -> ( {}, Effect.none )
192
- , update = \_ _ _ _ _ -> ( {}, Effect.none, Nothing )
193
- , subscriptions = \_ _ _ _ _ -> Sub.none
190
+ , init = \_ _ -> ( {}, Effect.none )
191
+ , update = \_ _ _ _ -> ( {}, Effect.none, Nothing )
192
+ , subscriptions = \_ _ _ _ -> Sub.none
194
193
  , handleRoute = record.handleRoute
195
194
  , kind = record.kind
196
195
  , onAction = Nothing
@@ -208,14 +207,13 @@ withOnAction toMsg config =
208
207
  {-| -}
209
208
  buildWithLocalState :
210
209
  { view :
211
- Maybe PageUrl
210
+ App data action routeParams
212
211
  -> Shared.Model
213
212
  -> model
214
- -> StaticPayload data action routeParams
215
213
  -> View (PagesMsg msg)
216
- , init : Maybe PageUrl -> Shared.Model -> StaticPayload data action routeParams -> ( model, Effect msg )
217
- , update : PageUrl -> Shared.Model -> StaticPayload data action routeParams -> msg -> model -> ( model, Effect msg )
218
- , subscriptions : Maybe PageUrl -> routeParams -> Path -> Shared.Model -> model -> Sub msg
214
+ , init : App data action routeParams -> Shared.Model -> ( model, Effect msg )
215
+ , update : App data action routeParams -> Shared.Model -> msg -> model -> ( model, Effect msg )
216
+ , subscriptions : routeParams -> Path -> Shared.Model -> model -> Sub msg
219
217
  }
220
218
  -> Builder routeParams data action
221
219
  -> StatefulRoute routeParams data action model msg
@@ -223,28 +221,23 @@ buildWithLocalState config builderState =
223
221
  case builderState of
224
222
  WithData record ->
225
223
  { view =
226
- \model sharedModel staticPayload ->
227
- config.view model sharedModel staticPayload
224
+ \model sharedModel app ->
225
+ config.view app model sharedModel
228
226
  , head = record.head
229
227
  , data = record.data
230
228
  , action = record.action
231
229
  , staticRoutes = record.staticRoutes
232
- , init = config.init
230
+ , init = \shared app -> config.init app shared
233
231
  , update =
234
- \pageUrl staticPayload msg model sharedModel ->
232
+ \app msg model sharedModel ->
235
233
  let
236
234
  ( updatedModel, cmd ) =
237
- config.update
238
- pageUrl
239
- sharedModel
240
- staticPayload
241
- msg
242
- model
235
+ config.update app sharedModel msg model
243
236
  in
244
237
  ( updatedModel, cmd, Nothing )
245
238
  , subscriptions =
246
- \maybePageUrl routeParams path model sharedModel ->
247
- config.subscriptions maybePageUrl routeParams path sharedModel model
239
+ \routeParams path model sharedModel ->
240
+ config.subscriptions routeParams path sharedModel model
248
241
  , handleRoute = record.handleRoute
249
242
  , kind = record.kind
250
243
  , onAction = Nothing
@@ -254,36 +247,35 @@ buildWithLocalState config builderState =
254
247
  {-| -}
255
248
  buildWithSharedState :
256
249
  { view :
257
- Maybe PageUrl
250
+ App data action routeParams
258
251
  -> Shared.Model
259
252
  -> model
260
- -> StaticPayload data action routeParams
261
253
  -> View (PagesMsg msg)
262
- , init : Maybe PageUrl -> Shared.Model -> StaticPayload data action routeParams -> ( model, Effect msg )
263
- , update : PageUrl -> Shared.Model -> StaticPayload data action routeParams -> msg -> model -> ( model, Effect msg, Maybe Shared.Msg )
264
- , subscriptions : Maybe PageUrl -> routeParams -> Path -> Shared.Model -> model -> Sub msg
254
+ , init : App data action routeParams -> Shared.Model -> ( model, Effect msg )
255
+ , update : App data action routeParams -> Shared.Model -> msg -> model -> ( model, Effect msg, Maybe Shared.Msg )
256
+ , subscriptions : routeParams -> Path -> Shared.Model -> model -> Sub msg
265
257
  }
266
258
  -> Builder routeParams data action
267
259
  -> StatefulRoute routeParams data action model msg
268
260
  buildWithSharedState config builderState =
269
261
  case builderState of
270
262
  WithData record ->
271
- { view = config.view
263
+ { view = \shared model app -> config.view app shared model
272
264
  , head = record.head
273
265
  , data = record.data
274
266
  , action = record.action
275
267
  , staticRoutes = record.staticRoutes
276
- , init = config.init
268
+ , init = \shared app -> config.init app shared
277
269
  , update =
278
- \pageUrl staticPayload msg model sharedModel ->
279
- config.update pageUrl
270
+ \app msg model sharedModel ->
271
+ config.update
272
+ app
280
273
  sharedModel
281
- staticPayload
282
274
  msg
283
275
  model
284
276
  , subscriptions =
285
- \maybePageUrl routeParams path model sharedModel ->
286
- config.subscriptions maybePageUrl routeParams path sharedModel model
277
+ \routeParams path model sharedModel ->
278
+ config.subscriptions routeParams path sharedModel model
287
279
  , handleRoute = record.handleRoute
288
280
  , kind = record.kind
289
281
  , onAction = Nothing
@@ -293,7 +285,7 @@ buildWithSharedState config builderState =
293
285
  {-| -}
294
286
  single :
295
287
  { data : BackendTask FatalError data
296
- , head : StaticPayload data action {} -> List Head.Tag
288
+ , head : App data action {} -> List Head.Tag
297
289
  }
298
290
  -> Builder {} data action
299
291
  single { data, head } =
@@ -312,7 +304,7 @@ single { data, head } =
312
304
  preRender :
313
305
  { data : routeParams -> BackendTask FatalError data
314
306
  , pages : BackendTask FatalError (List routeParams)
315
- , head : StaticPayload data action routeParams -> List Head.Tag
307
+ , head : App data action routeParams -> List Head.Tag
316
308
  }
317
309
  -> Builder routeParams data action
318
310
  preRender { data, head, pages } =
@@ -350,7 +342,7 @@ preRender { data, head, pages } =
350
342
  preRenderWithFallback :
351
343
  { data : routeParams -> BackendTask FatalError (Server.Response.Response data ErrorPage)
352
344
  , pages : BackendTask FatalError (List routeParams)
353
- , head : StaticPayload data action routeParams -> List Head.Tag
345
+ , head : App data action routeParams -> List Head.Tag
354
346
  }
355
347
  -> Builder routeParams data action
356
348
  preRenderWithFallback { data, head, pages } =
@@ -371,7 +363,7 @@ preRenderWithFallback { data, head, pages } =
371
363
  serverRender :
372
364
  { data : routeParams -> Server.Request.Parser (BackendTask FatalError (Server.Response.Response data ErrorPage))
373
365
  , action : routeParams -> Server.Request.Parser (BackendTask FatalError (Server.Response.Response action ErrorPage))
374
- , head : StaticPayload data action routeParams -> List Head.Tag
366
+ , head : App data action routeParams -> List Head.Tag
375
367
  }
376
368
  -> Builder routeParams data action
377
369
  serverRender { data, action, head } =
@@ -1,3 +1,3 @@
1
- export const compatibilityKey = 11;
1
+ export const compatibilityKey = 12;
2
2
 
3
- export const packageVersion = "3.0.0-beta.27";
3
+ export const packageVersion = "3.0.0-beta.29";
@@ -11,7 +11,7 @@ import Pages.PageUrl exposing (PageUrl)
11
11
  import Pages.Url
12
12
  import Path
13
13
  import Route
14
- import RouteBuilder exposing (StatefulRoute, StatelessRoute, StaticPayload)
14
+ import RouteBuilder exposing (StatefulRoute, StatelessRoute, App)
15
15
  import Shared
16
16
  import View exposing (View)
17
17
 
@@ -51,7 +51,7 @@ data =
51
51
 
52
52
 
53
53
  head :
54
- StaticPayload Data ActionData RouteParams
54
+ App Data ActionData RouteParams
55
55
  -> List Head.Tag
56
56
  head static =
57
57
  Seo.summary
@@ -73,7 +73,7 @@ head static =
73
73
  view :
74
74
  Maybe PageUrl
75
75
  -> Shared.Model
76
- -> StaticPayload Data ActionData RouteParams
76
+ -> App Data ActionData RouteParams
77
77
  -> View (PagesMsg Msg)
78
78
  view maybeUrl sharedModel static =
79
79
  { title = "elm-pages is running"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "elm-pages",
3
3
  "type": "module",
4
- "version": "3.0.0-beta.27",
4
+ "version": "3.0.0-beta.29",
5
5
  "homepage": "https://elm-pages.com",
6
6
  "moduleResolution": "node",
7
7
  "description": "Type-safe static sites, written in pure elm with your own custom elm-markup syntax.",
@@ -56,7 +56,7 @@
56
56
  "@types/node": "^18.11.9",
57
57
  "@types/serve-static": "^1.15.0",
58
58
  "cypress": "^12.5.1",
59
- "elm-codegen": "^0.2.0",
59
+ "elm-codegen": "^0.3.0",
60
60
  "elm-optimize-level-2": "^0.3.5",
61
61
  "elm-review": "^2.8.2",
62
62
  "elm-test": "^0.19.1-revision11",