@fmidev/smartmet-alert-client 4.0.9 → 4.1.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.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@fmidev/smartmet-alert-client",
3
- "version": "4.0.9",
3
+ "version": "4.1.0",
4
4
  "description": "Web application for viewing weather and flood alerts",
5
5
  "author": "Finnish Meteorological Institute",
6
6
  "license": "MIT",
7
- "main": "dist/index.js",
7
+ "main": "dist/index.mjs",
8
8
  "type": "module",
9
9
  "repository": {
10
10
  "type": "git",
@@ -49,8 +49,9 @@
49
49
  "prettier": "3.1.1",
50
50
  "rollup-plugin-visualizer": "5.11.0",
51
51
  "unplugin-vue-components": "0.26.0",
52
- "vite": "5.1.4",
52
+ "vite": "5.1.7",
53
53
  "vite-plugin-banner": "0.7.1",
54
+ "vite-plugin-static-copy": "1.0.2",
54
55
  "vitest": "0.34.4"
55
56
  },
56
57
  "eslintConfig": {
@@ -49,9 +49,11 @@
49
49
  <script>
50
50
  import DayLarge from './DayLarge.vue'
51
51
  import DaySmall from './DaySmall.vue'
52
+ import keycodes from '../mixins/keycodes'
52
53
 
53
54
  export default {
54
55
  name: 'Days',
56
+ mixins: [keycodes],
55
57
  components: {
56
58
  DaySmall,
57
59
  DayLarge,
@@ -117,6 +119,29 @@ export default {
117
119
  this.onDaySelected(newSelectedDay)
118
120
  },
119
121
  },
122
+ mounted() {
123
+ const button = Array.from(this.$el.querySelectorAll('button.day')).forEach(
124
+ (button) => {
125
+ button.addEventListener('keydown', this.switchDay, true)
126
+ }
127
+ )
128
+ },
129
+ beforeUnmount() {
130
+ const button = Array.from(this.$el.querySelectorAll('button.day')).forEach(
131
+ (button) => {
132
+ button.removeEventListener('keydown', this.switchDay, true)
133
+ }
134
+ )
135
+ },
136
+ updated() {
137
+ Array.from(this.$el.querySelectorAll('button.day')).forEach((button) => {
138
+ if (button.classList.contains('active')) {
139
+ button.removeAttribute('tabindex')
140
+ } else {
141
+ button.setAttribute('tabindex', -1)
142
+ }
143
+ })
144
+ },
120
145
  methods: {
121
146
  onDaySelected(newSelectedDay) {
122
147
  this.$emit('daySelected', newSelectedDay)
@@ -126,6 +151,23 @@ export default {
126
151
  this.$emit('loaded', true)
127
152
  }
128
153
  },
154
+ switchDay(event) {
155
+ switch (event.keyCode) {
156
+ case this.KEY_CODE_LEFT:
157
+ this.day = Math.max(this.day - 1, 0)
158
+ break
159
+ case this.KEY_CODE_RIGHT:
160
+ this.day = Math.min(this.day + 1, 4)
161
+ break
162
+ case this.KEY_CODE_HOME:
163
+ this.day = 0
164
+ break
165
+ case this.KEY_CODE_END:
166
+ this.day = 4
167
+ break
168
+ }
169
+ this.$el.querySelector(`button.day.day${this.day}`).focus()
170
+ },
129
171
  },
130
172
  }
131
173
  </script>
@@ -175,8 +217,9 @@ div#fmi-warnings-date-selector.tabs {
175
217
  color: transparent;
176
218
  }
177
219
 
178
- button.day div.date-selector-cell {
179
- overflow-x: hidden;
220
+ :deep(button.day div.date-selector-cell) {
221
+ height: $day-small-height;
222
+ overflow: hidden;
180
223
  }
181
224
 
182
225
  :deep(button.day) {
@@ -28,7 +28,7 @@ export default {
28
28
  props: {
29
29
  language: {
30
30
  type: String,
31
- default: import.meta.env.VUE_APP_I18N_LOCALE || 'en',
31
+ default: import.meta.env.VITE_LANGUAGE || 'fi',
32
32
  },
33
33
  grayScaleSelector: {
34
34
  type: Boolean,
@@ -76,7 +76,7 @@ export default {
76
76
  },
77
77
  language: {
78
78
  type: String,
79
- default: import.meta.env.VUE_APP_I18N_LOCALE || 'en',
79
+ default: import.meta.env.VITE_LANGUAGE || 'fi',
80
80
  },
81
81
  grayScaleSelector: {
82
82
  type: Boolean,
@@ -42,6 +42,10 @@ div.warning-image {
42
42
  background-position: center;
43
43
  }
44
44
 
45
+ .light-gray-theme div.warning-image {
46
+ border: 1px solid $light-gray-border;
47
+ }
48
+
45
49
  .current-warning-image {
46
50
  background-size: 28px 28px;
47
51
  height: $current-warning-image-height;
@@ -110,7 +110,7 @@ div.warning-image {
110
110
  }
111
111
 
112
112
  .light-gray-theme div.warning-image {
113
- border: 1px solid $black;
113
+ border: 1px solid $light-gray-border;
114
114
  }
115
115
 
116
116
  .dark-gray-theme div.warning-image {
@@ -295,7 +295,7 @@ div.warning-image {
295
295
  }
296
296
 
297
297
  .light-gray-theme div.warning-image {
298
- border: 1px solid $black;
298
+ border: 1px solid $light-gray-border;
299
299
  }
300
300
 
301
301
  .dark-gray-theme div.warning-image {
@@ -0,0 +1,10 @@
1
+ export default {
2
+ data() {
3
+ return {
4
+ KEY_CODE_END: 35,
5
+ KEY_CODE_HOME: 36,
6
+ KEY_CODE_LEFT: 37,
7
+ KEY_CODE_RIGHT: 39,
8
+ }
9
+ },
10
+ }
@@ -32,3 +32,4 @@ $light-gray-green-shadow: $light-gray;
32
32
  $light-gray-yellow-shadow: $light-gray;
33
33
  $light-gray-orange-shadow: $light-gray;
34
34
  $light-gray-red-shadow: $light-gray;
35
+ $light-gray-border: #666666;
package/vite.config.js CHANGED
@@ -6,6 +6,7 @@ import { BootstrapVueNextResolver } from 'unplugin-vue-components/resolvers'
6
6
  import Components from 'unplugin-vue-components/vite'
7
7
  import { defineConfig } from 'vite'
8
8
  import banner from 'vite-plugin-banner'
9
+ import { viteStaticCopy } from 'vite-plugin-static-copy'
9
10
 
10
11
  import pkg from './package.json'
11
12
 
@@ -22,6 +23,15 @@ export default defineConfig({
22
23
  `/**\n * name: ${pkg.name}\n * version: v${pkg.version}\n * description: ${pkg.description}\n * author: ${pkg.author}\n * homepage: ${pkg.homepage}\n */`
23
24
  ),
24
25
  visualizer(),
26
+ viteStaticCopy({
27
+ targets: [
28
+ {
29
+ src: 'dist/index.mjs',
30
+ dest: './',
31
+ rename: 'index.js',
32
+ }
33
+ ]
34
+ })
25
35
  ],
26
36
  resolve: {
27
37
  alias: {
@@ -36,9 +46,7 @@ export default defineConfig({
36
46
  minify: true,
37
47
  rollupOptions: {
38
48
  output: {
39
- entryFileNames: `[name].js`,
40
- chunkFileNames: `[name].js`,
41
- assetFileNames: `[name].[ext]`,
49
+ entryFileNames: 'index.mjs',
42
50
  },
43
51
  },
44
52
  },