elm-pages 3.0.16 → 3.0.18
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.
- package/codegen/elm-pages-codegen.cjs +7017 -6455
- package/generator/review/elm.json +1 -1
- package/generator/template/codegen/elm.codegen.json +1 -1
- package/generator/template/elm-pages.config.mjs +1 -1
- package/package.json +26 -27
- package/src/ApiRoute.elm +19 -19
- package/src/Scaffold/Form.elm +113 -116
- package/src/Scaffold/Route.elm +40 -52
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
},
|
|
13
13
|
preloadTagForFile(file) {
|
|
14
14
|
// add preload directives for JS assets and font assets, etc., skip for CSS files
|
|
15
|
-
// this function will be called with each file that is
|
|
15
|
+
// this function will be called with each file that is processed by Vite, including any files in your headTagsTemplate in your config
|
|
16
16
|
return !file.endsWith(".css");
|
|
17
17
|
},
|
|
18
18
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "elm-pages",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.18",
|
|
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.",
|
|
@@ -25,49 +25,48 @@
|
|
|
25
25
|
"author": "Dillon Kearns",
|
|
26
26
|
"license": "BSD-3-Clause",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@sindresorhus/merge-streams": "^
|
|
28
|
+
"@sindresorhus/merge-streams": "^4.0.0",
|
|
29
29
|
"busboy": "^1.6.0",
|
|
30
|
-
"chokidar": "^
|
|
31
|
-
"cli-cursor": "^
|
|
32
|
-
"commander": "^
|
|
30
|
+
"chokidar": "^4.0.1",
|
|
31
|
+
"cli-cursor": "^5.0.0",
|
|
32
|
+
"commander": "^12.1.0",
|
|
33
33
|
"connect": "^3.7.0",
|
|
34
|
-
"cookie-signature": "^1.2.
|
|
35
|
-
"cross-spawn": "7.0.
|
|
34
|
+
"cookie-signature": "^1.2.2",
|
|
35
|
+
"cross-spawn": "7.0.6",
|
|
36
36
|
"devcert": "^1.2.2",
|
|
37
37
|
"elm-doc-preview": "^5.0.5",
|
|
38
38
|
"elm-hot": "^1.1.6",
|
|
39
|
-
"esbuild": "^0.
|
|
39
|
+
"esbuild": "^0.24.0",
|
|
40
40
|
"fs-extra": "^11.2.0",
|
|
41
|
-
"globby": "14.0.
|
|
41
|
+
"globby": "14.0.2",
|
|
42
42
|
"gray-matter": "^4.0.3",
|
|
43
43
|
"jsesc": "^3.0.2",
|
|
44
44
|
"kleur": "^4.1.5",
|
|
45
|
-
"make-fetch-happen": "^
|
|
46
|
-
"memfs": "^4.
|
|
47
|
-
"micromatch": "^4.0.
|
|
48
|
-
"serve-static": "^1.
|
|
49
|
-
"terser": "^5.
|
|
50
|
-
"
|
|
51
|
-
"which": "^4.0.0"
|
|
45
|
+
"make-fetch-happen": "^14.0.3",
|
|
46
|
+
"memfs": "^4.14.0",
|
|
47
|
+
"micromatch": "^4.0.8",
|
|
48
|
+
"serve-static": "^1.16.2",
|
|
49
|
+
"terser": "^5.36.0",
|
|
50
|
+
"which": "^5.0.0"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
53
|
"@types/cross-spawn": "^6.0.6",
|
|
55
54
|
"@types/fs-extra": "^11.0.4",
|
|
56
55
|
"@types/make-fetch-happen": "^10.0.4",
|
|
57
|
-
"@types/micromatch": "^4.0.
|
|
58
|
-
"@types/node": "^
|
|
59
|
-
"@types/serve-static": "^1.15.
|
|
60
|
-
"cypress": "^13.
|
|
61
|
-
"elm-codegen": "^0.
|
|
56
|
+
"@types/micromatch": "^4.0.9",
|
|
57
|
+
"@types/node": "^22.10.0",
|
|
58
|
+
"@types/serve-static": "^1.15.7",
|
|
59
|
+
"cypress": "^13.16.0",
|
|
60
|
+
"elm-codegen": "^0.6.1",
|
|
62
61
|
"elm-optimize-level-2": "^0.3.5",
|
|
63
62
|
"elm-review": "^2.12.0",
|
|
64
63
|
"elm-test": "^0.19.1-revision12",
|
|
65
|
-
"elm-tooling": "^1.15.
|
|
66
|
-
"elm-verify-examples": "^
|
|
67
|
-
"lamdera": "^0.19.1-1.2
|
|
68
|
-
"typescript": "^5.
|
|
69
|
-
"vite": "^
|
|
70
|
-
"vitest": "^
|
|
64
|
+
"elm-tooling": "^1.15.1",
|
|
65
|
+
"elm-verify-examples": "^6.0.3",
|
|
66
|
+
"lamdera": "^0.19.1-1.3.2",
|
|
67
|
+
"typescript": "^5.7.2",
|
|
68
|
+
"vite": "^6.0.0",
|
|
69
|
+
"vitest": "^2.1.6"
|
|
71
70
|
},
|
|
72
71
|
"files": [
|
|
73
72
|
"adapter/",
|
package/src/ApiRoute.elm
CHANGED
|
@@ -189,7 +189,7 @@ You define your ApiRoute's in `app/Api.elm`. Here's a simple example:
|
|
|
189
189
|
import BackendTask exposing (BackendTask)
|
|
190
190
|
import FatalError exposing (FatalError)
|
|
191
191
|
import Head
|
|
192
|
-
import Internal.ApiRoute
|
|
192
|
+
import Internal.ApiRoute
|
|
193
193
|
import Internal.Request
|
|
194
194
|
import Json.Encode
|
|
195
195
|
import Pattern
|
|
@@ -214,8 +214,8 @@ single handler =
|
|
|
214
214
|
|
|
215
215
|
{-| -}
|
|
216
216
|
serverRender : ApiRouteBuilder (Server.Request.Request -> BackendTask FatalError (Server.Response.Response Never Never)) constructor -> ApiRoute Response
|
|
217
|
-
serverRender ((ApiRouteBuilder patterns pattern _ _ _) as fullHandler) =
|
|
218
|
-
ApiRoute
|
|
217
|
+
serverRender ((Internal.ApiRoute.ApiRouteBuilder patterns pattern _ _ _) as fullHandler) =
|
|
218
|
+
Internal.ApiRoute.ApiRoute
|
|
219
219
|
{ regex = Regex.fromString ("^" ++ pattern ++ "$") |> Maybe.withDefault Regex.never
|
|
220
220
|
, matchesToResponse =
|
|
221
221
|
\serverRequest path ->
|
|
@@ -246,14 +246,14 @@ serverRender ((ApiRouteBuilder patterns pattern _ _ _) as fullHandler) =
|
|
|
246
246
|
|
|
247
247
|
{-| -}
|
|
248
248
|
preRenderWithFallback : (constructor -> BackendTask FatalError (List (List String))) -> ApiRouteBuilder (BackendTask FatalError (Server.Response.Response Never Never)) constructor -> ApiRoute Response
|
|
249
|
-
preRenderWithFallback buildUrls ((ApiRouteBuilder patterns pattern _ toString constructor) as fullHandler) =
|
|
249
|
+
preRenderWithFallback buildUrls ((Internal.ApiRoute.ApiRouteBuilder patterns pattern _ toString constructor) as fullHandler) =
|
|
250
250
|
let
|
|
251
251
|
buildTimeRoutes__ : BackendTask FatalError (List String)
|
|
252
252
|
buildTimeRoutes__ =
|
|
253
253
|
buildUrls (constructor [])
|
|
254
254
|
|> BackendTask.map (List.map toString)
|
|
255
255
|
in
|
|
256
|
-
ApiRoute
|
|
256
|
+
Internal.ApiRoute.ApiRoute
|
|
257
257
|
{ regex = Regex.fromString ("^" ++ pattern ++ "$") |> Maybe.withDefault Regex.never
|
|
258
258
|
, matchesToResponse =
|
|
259
259
|
\_ path ->
|
|
@@ -335,7 +335,7 @@ Note: `dist` is the output folder for `elm-pages build`, so this will be accessi
|
|
|
335
335
|
|
|
336
336
|
-}
|
|
337
337
|
preRender : (constructor -> BackendTask FatalError (List (List String))) -> ApiRouteBuilder (BackendTask FatalError String) constructor -> ApiRoute Response
|
|
338
|
-
preRender buildUrls ((ApiRouteBuilder patterns pattern _ toString constructor) as fullHandler) =
|
|
338
|
+
preRender buildUrls ((Internal.ApiRoute.ApiRouteBuilder patterns pattern _ toString constructor) as fullHandler) =
|
|
339
339
|
let
|
|
340
340
|
buildTimeRoutes__ : BackendTask FatalError (List String)
|
|
341
341
|
buildTimeRoutes__ =
|
|
@@ -346,7 +346,7 @@ preRender buildUrls ((ApiRouteBuilder patterns pattern _ toString constructor) a
|
|
|
346
346
|
preBuiltMatches =
|
|
347
347
|
buildUrls (constructor [])
|
|
348
348
|
in
|
|
349
|
-
ApiRoute
|
|
349
|
+
Internal.ApiRoute.ApiRoute
|
|
350
350
|
{ regex = Regex.fromString ("^" ++ pattern ++ "$") |> Maybe.withDefault Regex.never
|
|
351
351
|
, matchesToResponse =
|
|
352
352
|
\_ path ->
|
|
@@ -403,13 +403,13 @@ type alias Response =
|
|
|
403
403
|
-}
|
|
404
404
|
succeed : a -> ApiRouteBuilder a (List String)
|
|
405
405
|
succeed a =
|
|
406
|
-
ApiRouteBuilder Pattern.empty "" (\_ -> a) (\_ -> "") (\list -> list)
|
|
406
|
+
Internal.ApiRoute.ApiRouteBuilder Pattern.empty "" (\_ -> a) (\_ -> "") (\list -> list)
|
|
407
407
|
|
|
408
408
|
|
|
409
409
|
{-| Turn the route into a pattern in JSON format. For internal uses.
|
|
410
410
|
-}
|
|
411
411
|
toJson : ApiRoute response -> Json.Encode.Value
|
|
412
|
-
toJson ((ApiRoute { kind }) as apiRoute) =
|
|
412
|
+
toJson ((Internal.ApiRoute.ApiRoute { kind }) as apiRoute) =
|
|
413
413
|
Json.Encode.object
|
|
414
414
|
[ ( "pathPattern", apiRoute |> Internal.ApiRoute.toPattern |> Pattern.toJson )
|
|
415
415
|
, ( "kind", Json.Encode.string kind )
|
|
@@ -419,8 +419,8 @@ toJson ((ApiRoute { kind }) as apiRoute) =
|
|
|
419
419
|
{-| A literal String segment of a route.
|
|
420
420
|
-}
|
|
421
421
|
literal : String -> ApiRouteBuilder a constructor -> ApiRouteBuilder a constructor
|
|
422
|
-
literal segment (ApiRouteBuilder patterns pattern handler toString constructor) =
|
|
423
|
-
ApiRouteBuilder
|
|
422
|
+
literal segment (Internal.ApiRoute.ApiRouteBuilder patterns pattern handler toString constructor) =
|
|
423
|
+
Internal.ApiRoute.ApiRouteBuilder
|
|
424
424
|
(Pattern.addLiteral segment patterns)
|
|
425
425
|
(pattern ++ segment)
|
|
426
426
|
handler
|
|
@@ -431,8 +431,8 @@ literal segment (ApiRouteBuilder patterns pattern handler toString constructor)
|
|
|
431
431
|
{-| A path separator within the route.
|
|
432
432
|
-}
|
|
433
433
|
slash : ApiRouteBuilder a constructor -> ApiRouteBuilder a constructor
|
|
434
|
-
slash (ApiRouteBuilder patterns pattern handler toString constructor) =
|
|
435
|
-
ApiRouteBuilder (patterns |> Pattern.addSlash) (pattern ++ "/") handler (\arg -> toString arg ++ "/") constructor
|
|
434
|
+
slash (Internal.ApiRoute.ApiRouteBuilder patterns pattern handler toString constructor) =
|
|
435
|
+
Internal.ApiRoute.ApiRouteBuilder (patterns |> Pattern.addSlash) (pattern ++ "/") handler (\arg -> toString arg ++ "/") constructor
|
|
436
436
|
|
|
437
437
|
|
|
438
438
|
{-| Captures a dynamic segment from the route.
|
|
@@ -440,8 +440,8 @@ slash (ApiRouteBuilder patterns pattern handler toString constructor) =
|
|
|
440
440
|
capture :
|
|
441
441
|
ApiRouteBuilder (String -> a) constructor
|
|
442
442
|
-> ApiRouteBuilder a (String -> constructor)
|
|
443
|
-
capture (ApiRouteBuilder patterns pattern previousHandler toString constructor) =
|
|
444
|
-
ApiRouteBuilder
|
|
443
|
+
capture (Internal.ApiRoute.ApiRouteBuilder patterns pattern previousHandler toString constructor) =
|
|
444
|
+
Internal.ApiRoute.ApiRouteBuilder
|
|
445
445
|
(patterns |> Pattern.addCapture)
|
|
446
446
|
(pattern ++ "(.*)")
|
|
447
447
|
(\matches ->
|
|
@@ -469,19 +469,19 @@ capture (ApiRouteBuilder patterns pattern previousHandler toString constructor)
|
|
|
469
469
|
{-| For internal use by generated code. Not so useful in user-land.
|
|
470
470
|
-}
|
|
471
471
|
getBuildTimeRoutes : ApiRoute response -> BackendTask FatalError (List String)
|
|
472
|
-
getBuildTimeRoutes (ApiRoute handler) =
|
|
472
|
+
getBuildTimeRoutes (Internal.ApiRoute.ApiRoute handler) =
|
|
473
473
|
handler.buildTimeRoutes
|
|
474
474
|
|
|
475
475
|
|
|
476
476
|
{-| Include head tags on every page's HTML.
|
|
477
477
|
-}
|
|
478
478
|
withGlobalHeadTags : BackendTask FatalError (List Head.Tag) -> ApiRoute response -> ApiRoute response
|
|
479
|
-
withGlobalHeadTags globalHeadTags (ApiRoute handler) =
|
|
480
|
-
ApiRoute { handler | globalHeadTags = Just globalHeadTags }
|
|
479
|
+
withGlobalHeadTags globalHeadTags (Internal.ApiRoute.ApiRoute handler) =
|
|
480
|
+
Internal.ApiRoute.ApiRoute { handler | globalHeadTags = Just globalHeadTags }
|
|
481
481
|
|
|
482
482
|
|
|
483
483
|
{-| For internal use.
|
|
484
484
|
-}
|
|
485
485
|
getGlobalHeadTagsBackendTask : ApiRoute response -> Maybe (BackendTask FatalError (List Head.Tag))
|
|
486
|
-
getGlobalHeadTagsBackendTask (ApiRoute handler) =
|
|
486
|
+
getGlobalHeadTagsBackendTask (Internal.ApiRoute.ApiRoute handler) =
|
|
487
487
|
handler.globalHeadTags
|
package/src/Scaffold/Form.elm
CHANGED
|
@@ -28,6 +28,7 @@ with the wiring form a `Form`.
|
|
|
28
28
|
import Cli.Option
|
|
29
29
|
import Elm
|
|
30
30
|
import Elm.Annotation as Type
|
|
31
|
+
import Elm.Arg
|
|
31
32
|
import Elm.Declare
|
|
32
33
|
import Elm.Op
|
|
33
34
|
import List.Extra
|
|
@@ -55,113 +56,111 @@ type alias Context =
|
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
|
|
58
|
-
formWithFields : Bool -> List ( String, Kind ) -> ({ formState : { errors : Elm.Expression, submitting : Elm.Expression, submitAttempted : Elm.Expression, data : Elm.Expression, expression : Elm.Expression }, params : List { name : String, kind : Kind, param : Elm.Expression } } -> Elm.Expression) ->
|
|
59
|
+
formWithFields : Bool -> List ( String, Kind ) -> ({ formState : { errors : Elm.Expression, submitting : Elm.Expression, submitAttempted : Elm.Expression, data : Elm.Expression, expression : Elm.Expression }, params : List { name : String, kind : Kind, param : Elm.Expression } } -> Elm.Expression) -> Elm.Declare.Value
|
|
59
60
|
formWithFields elmCssView fields viewFn =
|
|
60
|
-
Elm.Declare.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
{ rows = Elm.nothing
|
|
84
|
-
, cols = Elm.nothing
|
|
85
|
-
}
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
FieldFloat ->
|
|
89
|
-
formFieldFloat { invalid = \_ -> Elm.string "" }
|
|
90
|
-
|> Elm.Op.pipe (formFieldRequired (Elm.string "Required"))
|
|
91
|
-
|
|
92
|
-
FieldTime ->
|
|
93
|
-
formFieldTime { invalid = \_ -> Elm.string "" }
|
|
94
|
-
|> Elm.Op.pipe (formFieldRequired (Elm.string "Required"))
|
|
95
|
-
|
|
96
|
-
FieldDate ->
|
|
97
|
-
formFieldDate { invalid = \_ -> Elm.string "" }
|
|
98
|
-
|> Elm.Op.pipe (formFieldRequired (Elm.string "Required"))
|
|
99
|
-
|
|
100
|
-
FieldCheckbox ->
|
|
101
|
-
formFieldCheckbox
|
|
102
|
-
)
|
|
103
|
-
)
|
|
104
|
-
)
|
|
105
|
-
(Elm.function (List.map fieldToParam fields)
|
|
106
|
-
(\params ->
|
|
107
|
-
Elm.record
|
|
108
|
-
[ ( "combine"
|
|
109
|
-
, params
|
|
110
|
-
|> List.foldl
|
|
111
|
-
(\fieldExpression chain ->
|
|
112
|
-
chain
|
|
113
|
-
|> Elm.Op.pipe (validationAndMap fieldExpression)
|
|
114
|
-
)
|
|
115
|
-
(Elm.val "ParsedForm"
|
|
116
|
-
|> Elm.Op.pipe validationSucceed
|
|
117
|
-
)
|
|
118
|
-
)
|
|
119
|
-
, ( "view"
|
|
120
|
-
, Elm.fn ( "formState", Nothing )
|
|
121
|
-
(\formState ->
|
|
122
|
-
let
|
|
123
|
-
mappedParams : List { name : String, kind : Kind, param : Elm.Expression }
|
|
124
|
-
mappedParams =
|
|
125
|
-
params
|
|
126
|
-
|> List.Extra.zip fields
|
|
127
|
-
|> List.map
|
|
128
|
-
(\( ( name, kind ), param ) ->
|
|
129
|
-
{ name = name
|
|
130
|
-
, kind = kind
|
|
131
|
-
, param = param
|
|
132
|
-
}
|
|
133
|
-
)
|
|
134
|
-
in
|
|
135
|
-
viewFn
|
|
136
|
-
{ formState =
|
|
137
|
-
{ errors = formState |> Elm.get "errors"
|
|
138
|
-
, submitting = formState |> Elm.get "submitting"
|
|
139
|
-
, submitAttempted = formState |> Elm.get "submitAttempted"
|
|
140
|
-
, data = formState |> Elm.get "data"
|
|
141
|
-
, expression = formState
|
|
61
|
+
Elm.Declare.value "form"
|
|
62
|
+
(fields
|
|
63
|
+
|> List.foldl
|
|
64
|
+
(\( fieldName, kind ) chain ->
|
|
65
|
+
chain
|
|
66
|
+
|> Elm.Op.pipe
|
|
67
|
+
(formField fieldName
|
|
68
|
+
(case kind of
|
|
69
|
+
FieldText ->
|
|
70
|
+
formFieldText
|
|
71
|
+
|> Elm.Op.pipe (formFieldRequired (Elm.string "Required"))
|
|
72
|
+
|
|
73
|
+
FieldInt ->
|
|
74
|
+
formFieldInt { invalid = \_ -> Elm.string "" }
|
|
75
|
+
|> Elm.Op.pipe (formFieldRequired (Elm.string "Required"))
|
|
76
|
+
|
|
77
|
+
FieldTextarea ->
|
|
78
|
+
formFieldText
|
|
79
|
+
|> Elm.Op.pipe (formFieldRequired (Elm.string "Required"))
|
|
80
|
+
|> Elm.Op.pipe
|
|
81
|
+
(formFieldTextarea
|
|
82
|
+
{ rows = Elm.nothing
|
|
83
|
+
, cols = Elm.nothing
|
|
142
84
|
}
|
|
143
|
-
|
|
144
|
-
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
FieldFloat ->
|
|
88
|
+
formFieldFloat { invalid = \_ -> Elm.string "" }
|
|
89
|
+
|> Elm.Op.pipe (formFieldRequired (Elm.string "Required"))
|
|
90
|
+
|
|
91
|
+
FieldTime ->
|
|
92
|
+
formFieldTime { invalid = \_ -> Elm.string "" }
|
|
93
|
+
|> Elm.Op.pipe (formFieldRequired (Elm.string "Required"))
|
|
94
|
+
|
|
95
|
+
FieldDate ->
|
|
96
|
+
formFieldDate { invalid = \_ -> Elm.string "" }
|
|
97
|
+
|> Elm.Op.pipe (formFieldRequired (Elm.string "Required"))
|
|
98
|
+
|
|
99
|
+
FieldCheckbox ->
|
|
100
|
+
formFieldCheckbox
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
)
|
|
104
|
+
(Elm.function (List.map fieldToParam fields)
|
|
105
|
+
(\params ->
|
|
106
|
+
Elm.record
|
|
107
|
+
[ ( "combine"
|
|
108
|
+
, params
|
|
109
|
+
|> List.foldl
|
|
110
|
+
(\fieldExpression chain ->
|
|
111
|
+
chain
|
|
112
|
+
|> Elm.Op.pipe (validationAndMap fieldExpression)
|
|
145
113
|
)
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
114
|
+
(Elm.val "ParsedForm"
|
|
115
|
+
|> Elm.Op.pipe validationSucceed
|
|
116
|
+
)
|
|
117
|
+
)
|
|
118
|
+
, ( "view"
|
|
119
|
+
, Elm.fn (Elm.Arg.var "formState")
|
|
120
|
+
(\formState ->
|
|
121
|
+
let
|
|
122
|
+
mappedParams : List { name : String, kind : Kind, param : Elm.Expression }
|
|
123
|
+
mappedParams =
|
|
124
|
+
params
|
|
125
|
+
|> List.Extra.zip fields
|
|
126
|
+
|> List.map
|
|
127
|
+
(\( ( name, kind ), param ) ->
|
|
128
|
+
{ name = name
|
|
129
|
+
, kind = kind
|
|
130
|
+
, param = param
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
in
|
|
134
|
+
viewFn
|
|
135
|
+
{ formState =
|
|
136
|
+
{ errors = formState |> Elm.get "errors"
|
|
137
|
+
, submitting = formState |> Elm.get "submitting"
|
|
138
|
+
, submitAttempted = formState |> Elm.get "submitAttempted"
|
|
139
|
+
, data = formState |> Elm.get "data"
|
|
140
|
+
, expression = formState
|
|
141
|
+
}
|
|
142
|
+
, params = mappedParams
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
)
|
|
146
|
+
]
|
|
150
147
|
)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
148
|
+
|> Elm.Op.pipe formInit
|
|
149
|
+
)
|
|
150
|
+
|> Elm.withType
|
|
151
|
+
(Type.namedWith [ "Form" ]
|
|
152
|
+
(if elmCssView then
|
|
153
|
+
"StyledHtmlForm"
|
|
155
154
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
)
|
|
159
|
-
[ Type.string
|
|
160
|
-
, Type.named [] "ParsedForm"
|
|
161
|
-
, Type.var "input"
|
|
162
|
-
, Type.namedWith [ "PagesMsg" ] "PagesMsg" [ Type.named [] "Msg" ]
|
|
163
|
-
]
|
|
155
|
+
else
|
|
156
|
+
"HtmlForm"
|
|
164
157
|
)
|
|
158
|
+
[ Type.string
|
|
159
|
+
, Type.named [] "ParsedForm"
|
|
160
|
+
, Type.var "input"
|
|
161
|
+
, Type.namedWith [ "PagesMsg" ] "PagesMsg" [ Type.named [] "Msg" ]
|
|
162
|
+
]
|
|
163
|
+
)
|
|
165
164
|
)
|
|
166
165
|
|
|
167
166
|
|
|
@@ -246,29 +245,27 @@ provide { fields, view, elmCssView } =
|
|
|
246
245
|
|
|
247
246
|
else
|
|
248
247
|
let
|
|
249
|
-
form :
|
|
248
|
+
form : Elm.Declare.Value
|
|
250
249
|
form =
|
|
251
250
|
formWithFields elmCssView fields view
|
|
252
251
|
|
|
253
|
-
formHandlersDeclaration :
|
|
252
|
+
formHandlersDeclaration : Elm.Declare.Value
|
|
254
253
|
formHandlersDeclaration =
|
|
255
254
|
-- TODO customizable formHandlers name?
|
|
256
|
-
Elm.Declare.
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
]
|
|
266
|
-
)
|
|
255
|
+
Elm.Declare.value "formHandlers"
|
|
256
|
+
(initCombined (Elm.val "Action") form.value
|
|
257
|
+
|> Elm.withType
|
|
258
|
+
(Type.namedWith [ "Form", "Handler" ]
|
|
259
|
+
"Handler"
|
|
260
|
+
[ Type.string
|
|
261
|
+
, Type.named [] "Action"
|
|
262
|
+
]
|
|
263
|
+
)
|
|
267
264
|
)
|
|
268
265
|
in
|
|
269
266
|
Just
|
|
270
|
-
{ formHandlers = formHandlersDeclaration.
|
|
271
|
-
, form = form.
|
|
267
|
+
{ formHandlers = formHandlersDeclaration.value
|
|
268
|
+
, form = form.value
|
|
272
269
|
, declarations =
|
|
273
270
|
[ formWithFields elmCssView fields view |> .declaration
|
|
274
271
|
, Elm.customType "Action"
|