elm-pages 3.0.19 → 3.0.21

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.
@@ -17,6 +17,7 @@ view title =
17
17
 
18
18
  mainView : String -> Html msg
19
19
  mainView title =
20
+ -- NOTE: If you make changes here, also update pre-render-html.js!
20
21
  Html.div
21
22
  [ Attr.id "elm-pages-announcer"
22
23
  , Attr.attribute "aria-live" "assertive"
@@ -1025,7 +1025,8 @@ render404Page config sharedData isDevServer path notFoundReason =
1025
1025
 
1026
1026
  bodyToString : List (Html msg) -> String
1027
1027
  bodyToString body =
1028
- body |> List.map (HtmlPrinter.htmlToString Nothing) |> String.join "\n"
1028
+ -- NOTE: Don’t join the strings with a newline here – see pre-render-html.js.
1029
+ body |> List.map (HtmlPrinter.htmlToString Nothing) |> String.concat
1029
1030
 
1030
1031
 
1031
1032
  urlToRoute : ProgramConfig userMsg userModel route pageData actionData sharedData effect mappedMsg errorPage -> Url -> route
@@ -123,6 +123,7 @@ view config model =
123
123
  in
124
124
  { title = title
125
125
  , body =
126
+ -- NOTE: If you make changes here, also update pre-render-html.js!
126
127
  [ onViewChangeElement model.url
127
128
  , AriaLiveAnnouncer.view model.ariaNavigationAnnouncement
128
129
  ]
@@ -136,9 +137,10 @@ onViewChangeElement currentUrl =
136
137
  -- it is used from the JS-side to reliably
137
138
  -- check when Elm has changed pages
138
139
  -- (and completed rendering the view)
140
+ -- NOTE: If you make changes here, also update pre-render-html.js!
139
141
  Html.div
140
142
  [ Attr.attribute "data-url" (Url.toString currentUrl)
141
- , Attr.attribute "display" "none"
143
+ , Attr.style "display" "none"
142
144
  ]
143
145
  []
144
146
 
@@ -572,8 +574,14 @@ update config appMsg model =
572
574
  )
573
575
 
574
576
  else
575
- -- TODO should the user msg still be run if the form is invalid?
576
577
  ( model, NoEffect )
578
+ |> (case fields.msg of
579
+ Just justUserMsg ->
580
+ performUserMsg justUserMsg config
581
+
582
+ Nothing ->
583
+ identity
584
+ )
577
585
 
578
586
  Pages.Internal.Msg.FormMsg formMsg ->
579
587
  -- TODO when init is called for a new page, also need to clear out client-side `pageFormState`
@@ -17,7 +17,8 @@ module TerminalText exposing
17
17
  , yellow
18
18
  )
19
19
 
20
- import Ansi
20
+ import Ansi.Color
21
+ import Ansi.Parser
21
22
  import Json.Encode as Encode
22
23
 
23
24
 
@@ -32,27 +33,27 @@ text value =
32
33
 
33
34
  cyan : String -> Text
34
35
  cyan inner =
35
- Style { blankStyle | color = Just Ansi.Cyan } inner
36
+ Style { blankStyle | color = Just Ansi.Color.Cyan } inner
36
37
 
37
38
 
38
39
  green : String -> Text
39
40
  green inner =
40
- Style { blankStyle | color = Just Ansi.Green } inner
41
+ Style { blankStyle | color = Just Ansi.Color.Green } inner
41
42
 
42
43
 
43
44
  yellow : String -> Text
44
45
  yellow inner =
45
- Style { blankStyle | color = Just Ansi.Yellow } inner
46
+ Style { blankStyle | color = Just Ansi.Color.Yellow } inner
46
47
 
47
48
 
48
49
  red : String -> Text
49
50
  red inner =
50
- Style { blankStyle | color = Just Ansi.Red } inner
51
+ Style { blankStyle | color = Just Ansi.Color.Red } inner
51
52
 
52
53
 
53
54
  blue : String -> Text
54
55
  blue inner =
55
- Style { blankStyle | color = Just Ansi.Blue } inner
56
+ Style { blankStyle | color = Just Ansi.Color.Blue } inner
56
57
 
57
58
 
58
59
  resetColors : String
@@ -70,23 +71,23 @@ ansiPrefix =
70
71
  "\u{001B}"
71
72
 
72
73
 
73
- colorToString : Ansi.Color -> String
74
+ colorToString : Ansi.Color.Color -> String
74
75
  colorToString color =
75
76
  ansi <|
76
77
  case color of
77
- Ansi.Red ->
78
+ Ansi.Color.Red ->
78
79
  "[31m"
79
80
 
80
- Ansi.Blue ->
81
+ Ansi.Color.Blue ->
81
82
  "[34m"
82
83
 
83
- Ansi.Green ->
84
+ Ansi.Color.Green ->
84
85
  "[32m"
85
86
 
86
- Ansi.Yellow ->
87
+ Ansi.Color.Yellow ->
87
88
  "[33m"
88
89
 
89
- Ansi.Cyan ->
90
+ Ansi.Color.Cyan ->
90
91
  "[36m"
91
92
 
92
93
  _ ->
@@ -104,7 +105,7 @@ toString list =
104
105
  toString_ : Text -> String
105
106
  toString_ (Style ansiStyle innerText) =
106
107
  String.concat
107
- [ ansiStyle.color |> Maybe.withDefault Ansi.White |> colorToString
108
+ [ ansiStyle.color |> Maybe.withDefault Ansi.Color.White |> colorToString
108
109
  , innerText
109
110
  , resetColors
110
111
  ]
@@ -119,7 +120,7 @@ toPlainString list =
119
120
 
120
121
  fromAnsiString : String -> List Text
121
122
  fromAnsiString ansiString =
122
- Ansi.parseInto ( blankStyle, [] ) parseInto ansiString
123
+ Ansi.Parser.parseInto ( blankStyle, [] ) parseInto ansiString
123
124
  |> Tuple.second
124
125
  |> List.reverse
125
126
 
@@ -127,7 +128,7 @@ fromAnsiString ansiString =
127
128
  type alias AnsiStyle =
128
129
  { bold : Bool
129
130
  , underline : Bool
130
- , color : Maybe Ansi.Color
131
+ , color : Maybe Ansi.Color.Color
131
132
  }
132
133
 
133
134
 
@@ -139,16 +140,16 @@ blankStyle =
139
140
  }
140
141
 
141
142
 
142
- parseInto : Ansi.Action -> ( AnsiStyle, List Text ) -> ( AnsiStyle, List Text )
143
+ parseInto : Ansi.Parser.Command -> ( AnsiStyle, List Text ) -> ( AnsiStyle, List Text )
143
144
  parseInto action ( pendingStyle, soFar ) =
144
145
  case action of
145
- Ansi.Print string ->
146
+ Ansi.Parser.Text string ->
146
147
  ( blankStyle, Style pendingStyle string :: soFar )
147
148
 
148
- Ansi.Remainder _ ->
149
+ Ansi.Parser.Remainder _ ->
149
150
  ( pendingStyle, soFar )
150
151
 
151
- Ansi.SetForeground maybeColor ->
152
+ Ansi.Parser.SetForeground maybeColor ->
152
153
  case maybeColor of
153
154
  Just newColor ->
154
155
  ( { pendingStyle
@@ -160,22 +161,22 @@ parseInto action ( pendingStyle, soFar ) =
160
161
  Nothing ->
161
162
  ( blankStyle, soFar )
162
163
 
163
- Ansi.SetBold bool ->
164
+ Ansi.Parser.SetBold bool ->
164
165
  ( { pendingStyle | bold = bool }, soFar )
165
166
 
166
- Ansi.SetFaint _ ->
167
+ Ansi.Parser.SetFaint _ ->
167
168
  ( pendingStyle, soFar )
168
169
 
169
- Ansi.SetItalic _ ->
170
+ Ansi.Parser.SetItalic _ ->
170
171
  ( pendingStyle, soFar )
171
172
 
172
- Ansi.SetUnderline bool ->
173
+ Ansi.Parser.SetUnderline bool ->
173
174
  ( { pendingStyle | underline = bool }, soFar )
174
175
 
175
- Ansi.SetBackground _ ->
176
+ Ansi.Parser.SetBackground _ ->
176
177
  ( pendingStyle, soFar )
177
178
 
178
- Ansi.Linebreak ->
179
+ Ansi.Parser.Linebreak ->
179
180
  case soFar of
180
181
  next :: rest ->
181
182
  ( pendingStyle, Style blankStyle "\n" :: next :: rest )
@@ -194,56 +195,59 @@ encoder (Style ansiStyle string) =
194
195
  , ( "underline", Encode.bool ansiStyle.underline )
195
196
  , ( "color"
196
197
  , Encode.string <|
197
- case ansiStyle.color |> Maybe.withDefault Ansi.White of
198
- Ansi.Red ->
198
+ case ansiStyle.color |> Maybe.withDefault Ansi.Color.White of
199
+ Ansi.Color.Red ->
199
200
  "red"
200
201
 
201
- Ansi.Blue ->
202
+ Ansi.Color.Blue ->
202
203
  "blue"
203
204
 
204
- Ansi.Green ->
205
+ Ansi.Color.Green ->
205
206
  "green"
206
207
 
207
- Ansi.Yellow ->
208
+ Ansi.Color.Yellow ->
208
209
  "yellow"
209
210
 
210
- Ansi.Cyan ->
211
+ Ansi.Color.Cyan ->
211
212
  "cyan"
212
213
 
213
- Ansi.Black ->
214
+ Ansi.Color.Black ->
214
215
  "black"
215
216
 
216
- Ansi.Magenta ->
217
+ Ansi.Color.Magenta ->
217
218
  "magenta"
218
219
 
219
- Ansi.White ->
220
+ Ansi.Color.White ->
220
221
  "white"
221
222
 
222
- Ansi.BrightBlack ->
223
+ Ansi.Color.BrightBlack ->
223
224
  "BLACK"
224
225
 
225
- Ansi.BrightRed ->
226
+ Ansi.Color.BrightRed ->
226
227
  "RED"
227
228
 
228
- Ansi.BrightGreen ->
229
+ Ansi.Color.BrightGreen ->
229
230
  "GREEN"
230
231
 
231
- Ansi.BrightYellow ->
232
+ Ansi.Color.BrightYellow ->
232
233
  "YELLOW"
233
234
 
234
- Ansi.BrightBlue ->
235
+ Ansi.Color.BrightBlue ->
235
236
  "BLUE"
236
237
 
237
- Ansi.BrightMagenta ->
238
+ Ansi.Color.BrightMagenta ->
238
239
  "MAGENTA"
239
240
 
240
- Ansi.BrightCyan ->
241
+ Ansi.Color.BrightCyan ->
241
242
  "CYAN"
242
243
 
243
- Ansi.BrightWhite ->
244
+ Ansi.Color.BrightWhite ->
244
245
  "WHITE"
245
246
 
246
- Ansi.Custom _ _ _ ->
247
+ Ansi.Color.Custom256 _ ->
248
+ ""
249
+
250
+ Ansi.Color.CustomTrueColor _ ->
247
251
  ""
248
252
  )
249
253
  , ( "string", Encode.string string )
File without changes
@@ -1,5 +0,0 @@
1
- export function hello(): string {
2
- console.log("HELLLO!!!!");
3
-
4
- return "Hello World!";
5
- }