@fmidev/smartmet-alert-client 4.2.7 → 4.7.0-alpha.0

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.
Files changed (127) hide show
  1. package/.eslintignore +2 -14
  2. package/.github/workflows/test.yaml +26 -0
  3. package/.nvmrc +1 -0
  4. package/dist/index.dark.html +1 -1
  5. package/dist/index.en.html +1 -1
  6. package/dist/index.fi.html +1 -1
  7. package/dist/index.html +5 -0
  8. package/dist/index.js +105 -135
  9. package/dist/index.mjs +112 -135
  10. package/dist/index.sv.html +1 -1
  11. package/dist/locale-en-DCEKDw5G.js +8 -0
  12. package/dist/locale-fi-DPiOM1rB.js +8 -0
  13. package/dist/locale-sv-B0FlbgEF.js +8 -0
  14. package/dist/vendor-Cfkkvdz7.js +21 -0
  15. package/dist/vue/index.mjs +15245 -0
  16. package/dist/vue/style.css +1 -0
  17. package/dist/xml-parser-BiNO9kc-.js +13 -0
  18. package/package.json +61 -25
  19. package/public/index.dark.html +1 -1
  20. package/public/index.en.html +1 -1
  21. package/public/index.fi.html +1 -1
  22. package/public/index.sv.html +1 -1
  23. package/src/AlertClientVue.vue +170 -0
  24. package/src/App.vue +58 -176
  25. package/src/assets/img/ui/arrow-down.svg +4 -14
  26. package/src/assets/img/ui/arrow-up.svg +4 -14
  27. package/src/assets/img/ui/clear.svg +7 -21
  28. package/src/assets/img/ui/close.svg +4 -15
  29. package/src/assets/img/ui/toggle-selected.svg +12 -0
  30. package/src/assets/img/ui/toggle-unselected.svg +12 -0
  31. package/src/assets/img/warning/cold-weather.svg +3 -6
  32. package/src/assets/img/warning/flood-level-3.svg +4 -7
  33. package/src/assets/img/warning/forest-fire-weather.svg +2 -6
  34. package/src/assets/img/warning/grass-fire-weather.svg +2 -6
  35. package/src/assets/img/warning/hot-weather.svg +3 -6
  36. package/src/assets/img/warning/pedestrian-safety.svg +3 -7
  37. package/src/assets/img/warning/rain.svg +2 -7
  38. package/src/assets/img/warning/sea-icing.svg +2 -6
  39. package/src/assets/img/warning/sea-thunder-storm.svg +2 -5
  40. package/src/assets/img/warning/sea-water-height-high-water.svg +3 -8
  41. package/src/assets/img/warning/sea-water-height-shallow-water.svg +3 -7
  42. package/src/assets/img/warning/sea-wave-height.svg +4 -7
  43. package/src/assets/img/warning/sea-wind-legend.svg +2 -5
  44. package/src/assets/img/warning/sea-wind.svg +2 -5
  45. package/src/assets/img/warning/several.svg +2 -5
  46. package/src/assets/img/warning/thunder-storm.svg +2 -5
  47. package/src/assets/img/warning/traffic-weather.svg +2 -6
  48. package/src/assets/img/warning/uv-note.svg +2 -6
  49. package/src/assets/img/warning/wind.svg +2 -5
  50. package/src/components/AlertClient.vue +42 -20
  51. package/src/components/CollapsiblePanel.vue +284 -0
  52. package/src/components/DayLarge.vue +40 -32
  53. package/src/components/DaySmall.vue +17 -7
  54. package/src/components/Days.vue +77 -52
  55. package/src/components/DescriptionWarning.vue +26 -8
  56. package/src/components/GrayScaleToggle.vue +42 -35
  57. package/src/components/Legend.vue +36 -240
  58. package/src/components/MapLarge.vue +55 -50
  59. package/src/components/MapSmall.vue +48 -29
  60. package/src/components/PopupRow.vue +6 -3
  61. package/src/components/Region.vue +162 -53
  62. package/src/components/RegionWarning.vue +33 -11
  63. package/src/components/Regions.vue +59 -29
  64. package/src/components/Warning.vue +53 -49
  65. package/src/components/Warnings.vue +54 -16
  66. package/src/locales/en.json +21 -4
  67. package/src/locales/fi.json +23 -6
  68. package/src/locales/sv.json +20 -3
  69. package/src/main.js +1 -0
  70. package/src/mixins/alertClientCore.js +210 -0
  71. package/src/mixins/config.js +263 -257
  72. package/src/mixins/utils.js +46 -15
  73. package/src/plugins/index.js +1 -1
  74. package/src/scss/_utilities.scss +193 -0
  75. package/src/scss/backgrounds.scss +2 -0
  76. package/src/scss/colors.scss +5 -3
  77. package/src/scss/constants.scss +3 -2
  78. package/src/scss/themes/dark-gray.scss +3 -3
  79. package/src/scss/themes/dark.scss +1 -1
  80. package/src/scss/themes/light-gray.scss +5 -5
  81. package/src/scss/themes/light.scss +3 -3
  82. package/src/scss/warningImages.scss +9 -5
  83. package/src/vue.js +41 -0
  84. package/svgo.config.js +45 -0
  85. package/tests/README.md +430 -0
  86. package/tests/fixtures/mockWarningData.js +135 -0
  87. package/tests/integration/warning-flow.spec.js +452 -0
  88. package/tests/setup.js +41 -0
  89. package/tests/unit/components/AlertClient.spec.js +734 -0
  90. package/tests/unit/components/DayLarge.spec.js +281 -0
  91. package/tests/unit/components/DaySmall.spec.js +278 -0
  92. package/tests/unit/components/Days.spec.js +565 -0
  93. package/tests/unit/components/DescriptionWarning.spec.js +432 -0
  94. package/tests/unit/components/GrayScaleToggle.spec.js +311 -0
  95. package/tests/unit/components/Legend.spec.js +223 -0
  96. package/tests/unit/components/MapLarge.spec.js +276 -0
  97. package/tests/unit/components/MapSmall.spec.js +226 -0
  98. package/tests/unit/components/PopupRow.spec.js +261 -0
  99. package/tests/unit/components/Region.spec.js +430 -0
  100. package/tests/unit/components/RegionWarning.snapshot.spec.js +73 -0
  101. package/tests/unit/components/RegionWarning.spec.js +408 -0
  102. package/tests/unit/components/Regions.spec.js +335 -0
  103. package/tests/unit/components/Warning.snapshot.spec.js +107 -0
  104. package/tests/unit/components/Warning.spec.js +472 -0
  105. package/tests/unit/components/Warnings.spec.js +329 -0
  106. package/tests/unit/components/__snapshots__/RegionWarning.snapshot.spec.js.snap +21 -0
  107. package/tests/unit/components/__snapshots__/Warning.snapshot.spec.js.snap +199 -0
  108. package/tests/unit/mixins/config.spec.js +269 -0
  109. package/tests/unit/mixins/i18n.spec.js +115 -0
  110. package/tests/unit/mixins/keycodes.spec.js +37 -0
  111. package/tests/unit/mixins/utils.spec.js +624 -0
  112. package/vite.config.js +96 -26
  113. package/vitest.config.js +40 -0
  114. package/dist/index.mjs.map +0 -1
  115. package/dist/index.relative.html +0 -19
  116. package/dist/index.start.html +0 -20
  117. package/playwright.config.ts +0 -18
  118. package/public/index.relative.html +0 -19
  119. package/public/index.start.html +0 -20
  120. package/src/assets/img/ui/toggle-selected-blue.svg +0 -4
  121. package/src/assets/img/ui/toggle-selected-dark.svg +0 -4
  122. package/src/assets/img/ui/toggle-selected-light.svg +0 -4
  123. package/src/assets/img/ui/toggle-unselected-dark.svg +0 -4
  124. package/src/assets/img/ui/toggle-unselected-light.svg +0 -4
  125. package/src/mixins/panzoom.js +0 -900
  126. package/test/snapshot.test.ts +0 -126
  127. package/vitest.config.ts +0 -6
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <div v-if="grayScaleSelector" id="gray-scale-select-row" :class="theme">
2
+ <div
3
+ v-if="grayScaleSelector"
4
+ id="gray-scale-select-row"
5
+ :class="theme"
6
+ >
3
7
  <div id="gray-scale-select-text">{{ grayScaleText }}</div>
4
8
  <div id="gray-scale-select-container">
5
9
  <div
@@ -8,11 +12,19 @@
8
12
  'focus-ring',
9
13
  grayScale ? 'gray-scale-selected' : 'gray-scale-unselected',
10
14
  ]"
15
+ role="button"
11
16
  tabindex="0"
17
+ :aria-pressed="grayScale ? 'true' : 'false'"
18
+ :aria-label="grayScaleText"
12
19
  @mousedown="preventEvents"
13
20
  @click="toggleGrayScale"
14
21
  @keydown.enter="toggleGrayScale"
15
- @keydown.space="toggleGrayScale" />
22
+ @keydown.space="toggleGrayScale"
23
+ >
24
+ <span>
25
+ {{ toggleText }}
26
+ </span>
27
+ </div>
16
28
  </div>
17
29
  </div>
18
30
  </template>
@@ -48,6 +60,9 @@ export default {
48
60
  grayScaleText() {
49
61
  return this.t('grayScale')
50
62
  },
63
+ toggleText() {
64
+ return this.grayScale ? this.t('toggleOn') : this.t('toggleOff')
65
+ },
51
66
  },
52
67
  methods: {
53
68
  toggleGrayScale(event) {
@@ -89,54 +104,46 @@ div#gray-scale-select-text {
89
104
  padding-right: 5px;
90
105
  vertical-align: middle;
91
106
  line-height: normal;
107
+ word-break: break-word;
108
+ hyphens: auto;
92
109
  }
93
110
 
94
111
  div#gray-scale-select-container {
95
112
  display: table-cell;
96
- width: 30px;
113
+ width: 55px;
97
114
  height: $symbol-list-line-height;
98
115
  vertical-align: middle;
99
116
  }
100
117
 
101
118
  div#gray-scale-select {
119
+ display: flex;
120
+ align-items: center;
121
+ justify-content: center;
102
122
  width: 100%;
103
123
  height: $symbol-list-select-height;
104
124
  margin: 0;
105
125
  background-repeat: no-repeat;
106
126
  background-position: center;
107
127
  cursor: pointer;
108
- }
109
-
110
- .light-theme .gray-scale-selected {
111
- background-image: url($ui-image-path + 'toggle-selected-blue' + $image-extension);
112
- }
113
-
114
- .dark-theme .gray-scale-selected {
115
- background-image: url($ui-image-path + 'toggle-selected-light' + $image-extension);
116
- }
117
-
118
- .light-gray-theme .gray-scale-selected {
119
- background-image: url($ui-image-path + 'toggle-selected-dark' + $image-extension);
120
- }
121
-
122
- .dark-gray-theme .gray-scale-selected {
123
- background-image: url($ui-image-path + 'toggle-selected-light' + $image-extension);
124
- }
125
-
126
- .light-theme .gray-scale-unselected {
127
- background-image: url($ui-image-path + 'toggle-unselected-light' + $image-extension);
128
- }
129
-
130
- .dark-theme .gray-scale-unselected {
131
- background-image: url($ui-image-path + 'toggle-unselected-dark' + $image-extension);
132
- }
133
-
134
- .light-gray-theme .gray-scale-unselected {
135
- background-image: url($ui-image-path + 'toggle-unselected-light' + $image-extension);
136
- }
137
-
138
- .dark-gray-theme .gray-scale-unselected {
139
- background-image: url($ui-image-path + 'toggle-unselected-dark' + $image-extension);
128
+ &.gray-scale-selected {
129
+ padding-right: 18px;
130
+ background-image: url($ui-image-path + 'toggle-selected' + $image-extension);
131
+ span {
132
+ color: $toggle-on-text;
133
+ }
134
+ }
135
+ &.gray-scale-unselected {
136
+ padding-left: 18px;
137
+ background-image: url($ui-image-path + 'toggle-unselected' + $image-extension);
138
+ span {
139
+ color: $toggle-off-text;
140
+ }
141
+ }
142
+ span {
143
+ font-family: $symbol-font-family;
144
+ font-size: $font-size;
145
+ forced-color-adjust: none;
146
+ }
140
147
  }
141
148
 
142
149
  @media (max-width: 767px) {
@@ -1,59 +1,56 @@
1
1
  <template>
2
- <div class="sticky-top" :class="theme">
2
+ <div
3
+ class="sticky-top"
4
+ :class="theme"
5
+ >
3
6
  <GrayScaleToggle
4
7
  class="narrow-screen"
5
8
  :language="language"
6
9
  :gray-scale-selector="grayScaleSelector"
7
10
  :theme="theme"
8
- @themeChanged="onThemeChanged" />
11
+ @theme-changed="onThemeChanged"
12
+ />
9
13
  <div class="row symbol-list-header-row">
10
14
  <nav class="symbol-list-header bold-text">
11
15
  {{ warningSymbolsText }}
12
- <br v-if="input.length > 0" class="symbol-list-header-line-break" />
16
+ <br
17
+ v-if="input.length > 0"
18
+ class="symbol-list-header-line-break"
19
+ />
13
20
  </nav>
14
21
  </div>
15
- <b-card no-body class="mb-1 d-md-none legends-panel">
16
- <b-card-header header-tag="header" class="legends-heading p-1">
17
- <div class="legends-header">
18
- <span class="legends-text">
19
- {{ toggleLegendsText }}
20
- </span>
21
- </div>
22
- <b-button
23
- block
24
- :class="['legends-toggle', visible ? '' : 'collapsed']"
25
- @click="onLegendToggle" />
26
- </b-card-header>
27
- <b-collapse
28
- id="legends-collapse"
29
- v-model="visible"
30
- class="legends-collapse-item focus-ring"
31
- tabindex="0">
32
- <b-card-body body-class="p-0">
33
- <div class="legends-container">
34
- <Warnings
35
- :input="input"
36
- :visible-warnings="visibleWarnings"
37
- :theme="theme"
38
- :language="language" />
39
- </div>
40
- </b-card-body>
41
- </b-collapse>
42
- </b-card>
43
- <div ref="warningsContainer" class="d-md-block d-none">
22
+ <CollapsiblePanel
23
+ :visible="visible"
24
+ :title="toggleLegendsText"
25
+ :theme="theme"
26
+ @toggle="onLegendToggle"
27
+ >
44
28
  <Warnings
45
29
  :input="input"
46
30
  :visible-warnings="visibleWarnings"
47
31
  :theme="theme"
48
32
  :language="language"
49
- @warningsToggled="onWarningsToggled"
50
- @showAllWarnings="onShowAllWarnings" />
33
+ />
34
+ </CollapsiblePanel>
35
+ <div
36
+ ref="warningsContainer"
37
+ class="desktop-only"
38
+ >
39
+ <Warnings
40
+ :input="input"
41
+ :visible-warnings="visibleWarnings"
42
+ :theme="theme"
43
+ :language="language"
44
+ @warnings-toggled="onWarningsToggled"
45
+ @show-all-warnings="onShowAllWarnings"
46
+ />
51
47
  </div>
52
48
  <GrayScaleToggle
53
49
  :language="language"
54
50
  :gray-scale-selector="grayScaleSelector"
55
51
  :theme="theme"
56
- @themeChanged="onThemeChanged" />
52
+ @theme-changed="onThemeChanged"
53
+ />
57
54
  </div>
58
55
  </template>
59
56
 
@@ -61,11 +58,15 @@
61
58
  import { onMounted, onUnmounted, ref } from 'vue'
62
59
 
63
60
  import i18n from '../mixins/i18n'
61
+ import CollapsiblePanel from './CollapsiblePanel.vue'
62
+ import GrayScaleToggle from './GrayScaleToggle.vue'
64
63
  import Warnings from './Warnings.vue'
65
64
 
66
65
  export default {
67
66
  name: 'Legend',
68
67
  components: {
68
+ CollapsiblePanel,
69
+ GrayScaleToggle,
69
70
  Warnings,
70
71
  },
71
72
  mixins: [i18n],
@@ -166,211 +167,6 @@ div.symbol-list-header-row {
166
167
  }
167
168
  }
168
169
 
169
- .legends-panel {
170
- border-radius: 0;
171
- margin-left: 0;
172
- margin-right: 0;
173
- }
174
-
175
- .light-theme .legends-panel {
176
- border: 2px solid $light-legend-background-color;
177
- }
178
-
179
- .dark-theme .legends-panel {
180
- border: 2px solid $dark-legend-background-color;
181
- }
182
-
183
- .light-gray-theme .legends-panel {
184
- border: 2px solid $light-gray-legend-background-color;
185
- }
186
-
187
- .dark-gray-theme .legends-panel {
188
- border: 2px solid $dark-gray-legend-background-color;
189
- }
190
-
191
- .legends-heading {
192
- height: $current-warning-height;
193
- padding: 0 0 0 15px !important;
194
- line-height: $current-warning-height;
195
- border: none;
196
- border-bottom: 1px solid rgba(0, 0, 0, 0.125);
197
- }
198
-
199
- .light-theme .legends-heading {
200
- background-color: $light-legend-heading-background-color;
201
- }
202
-
203
- .dark-theme .legends-heading {
204
- background-color: $dark-legend-heading-background-color;
205
- }
206
-
207
- .light-gray-theme .legends-heading {
208
- background-color: $light-gray-legend-heading-background-color;
209
- }
210
-
211
- .dark-gray-theme .legends-heading {
212
- background-color: $dark-gray-legend-heading-background-color;
213
- }
214
-
215
- .legends-header {
216
- position: absolute;
217
- left: 0;
218
- right: 38px;
219
- }
220
-
221
- .light-theme .legends-header {
222
- background: $light-legend-heading-background-color;
223
- }
224
-
225
- .dark-theme .legends-header {
226
- background: $dark-legend-heading-background-color;
227
- }
228
-
229
- .light-gray-theme .legends-header {
230
- background: $light-gray-legend-heading-background-color;
231
- }
232
-
233
- .dark-gray-theme .legends-header {
234
- background: $dark-gray-legend-heading-background-color;
235
- }
236
-
237
- .legends-text {
238
- display: block;
239
- text-align: left;
240
- line-height: $current-warning-height;
241
- white-space: nowrap;
242
- overflow: hidden;
243
- text-overflow: ellipsis;
244
- margin-left: 15px;
245
- }
246
-
247
- .light-theme .legends-text {
248
- background-color: $light-legend-heading-background-color;
249
- }
250
-
251
- .dark-theme .legends-text {
252
- background-color: $dark-legend-heading-background-color;
253
- }
254
-
255
- .light-gray-theme .legends-text {
256
- background-color: $light-gray-legend-heading-background-color;
257
- }
258
-
259
- .dark-gray-theme .legends-text {
260
- background-color: $dark-gray-legend-heading-background-color;
261
- }
262
-
263
- .legends-toggle {
264
- position: relative;
265
- height: $current-warning-height;
266
- width: $current-warning-height;
267
- min-width: $current-warning-height;
268
- background-image: url($ui-image-path + 'arrow-up.svg');
269
- background-repeat: no-repeat;
270
- background-position: center;
271
- border-radius: 0;
272
- border-style: none;
273
- float: right;
274
- padding: $image-padding;
275
- margin-left: 5px;
276
-
277
- &.collapsed {
278
- background-image: url($ui-image-path + 'arrow-down.svg');
279
- }
280
- }
281
-
282
- .light-theme .legends-toggle {
283
- background-color: $light-legend-toggle-background-color;
284
-
285
- &:hover {
286
- background-color: $light-legend-toggle-background-color;
287
- }
288
-
289
- &:active {
290
- background-color: $light-legend-toggle-background-color;
291
- }
292
-
293
- &:not(:disabled):not(.disabled):active {
294
- background-color: $light-current-warning-toggle-active-color;
295
- }
296
- }
297
-
298
- .dark-theme .legends-toggle {
299
- background-color: $dark-legend-toggle-background-color;
300
-
301
- &:hover {
302
- background-color: $dark-legend-toggle-background-color;
303
- }
304
-
305
- &:active {
306
- background-color: $dark-legend-toggle-background-color;
307
- }
308
-
309
- &:not(:disabled):not(.disabled):active {
310
- background-color: $dark-current-warning-toggle-active-color;
311
- }
312
- }
313
-
314
- .light-gray-theme .legends-toggle {
315
- background-color: $light-gray-legend-toggle-background-color;
316
-
317
- &:hover {
318
- background-color: $light-gray-legend-toggle-background-color;
319
- }
320
-
321
- &:active {
322
- background-color: $light-gray-legend-toggle-background-color;
323
- }
324
-
325
- &:not(:disabled):not(.disabled):active {
326
- background-color: $light-gray-current-warning-toggle-active-color;
327
- }
328
- }
329
-
330
- .dark-gray-theme .legends-toggle {
331
- background-color: $dark-gray-legend-toggle-background-color;
332
-
333
- &:hover {
334
- background-color: $dark-gray-legend-toggle-background-color;
335
- }
336
-
337
- &:active {
338
- background-color: $dark-gray-legend-toggle-background-color;
339
- }
340
-
341
- &:not(:disabled):not(.disabled):active {
342
- background-color: $dark-gray-current-warning-toggle-active-color;
343
- }
344
- }
345
-
346
- .legends-container {
347
- padding: 15px;
348
- }
349
-
350
- .light-theme .legends-container {
351
- background-color: $light-legend-container-background-color;
352
- border-top: 2px solid $light-legend-background-color;
353
- }
354
-
355
- .dark-theme .legends-container {
356
- background-color: $dark-legend-container-background-color;
357
- border-top: 2px solid $dark-legend-background-color;
358
- }
359
-
360
- .light-gray-theme .legends-container {
361
- background-color: $light-gray-legend-container-background-color;
362
- border-top: 2px solid $light-gray-legend-background-color;
363
- }
364
-
365
- .dark-gray-theme .legends-container {
366
- background-color: $dark-gray-legend-container-background-color;
367
- border-top: 2px solid $dark-gray-legend-background-color;
368
- }
369
-
370
- div#legends-collapse div.card-body {
371
- padding: 0;
372
- }
373
-
374
170
  nav.symbol-list-header {
375
171
  padding-left: 0;
376
172
  text-align: left;