@fmidev/smartmet-alert-client 4.4.19 → 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.
- package/.eslintignore +2 -14
- package/.github/workflows/test.yaml +26 -0
- package/.nvmrc +1 -0
- package/dist/index.html +5 -0
- package/dist/index.js +105 -135
- package/dist/index.mjs +112 -135
- package/dist/locale-en-DCEKDw5G.js +8 -0
- package/dist/locale-fi-DPiOM1rB.js +8 -0
- package/dist/locale-sv-B0FlbgEF.js +8 -0
- package/dist/vendor-Cfkkvdz7.js +21 -0
- package/dist/vue/index.mjs +15245 -0
- package/dist/vue/style.css +1 -0
- package/dist/xml-parser-BiNO9kc-.js +13 -0
- package/package.json +60 -24
- package/src/AlertClientVue.vue +170 -0
- package/src/App.vue +55 -205
- package/src/assets/img/ui/arrow-down.svg +4 -11
- package/src/assets/img/ui/arrow-up.svg +4 -11
- package/src/assets/img/ui/clear.svg +7 -21
- package/src/assets/img/ui/close.svg +4 -15
- package/src/assets/img/ui/toggle-selected.svg +5 -6
- package/src/assets/img/ui/toggle-unselected.svg +5 -6
- package/src/assets/img/warning/cold-weather.svg +3 -6
- package/src/assets/img/warning/flood-level-3.svg +4 -7
- package/src/assets/img/warning/forest-fire-weather.svg +2 -6
- package/src/assets/img/warning/grass-fire-weather.svg +2 -6
- package/src/assets/img/warning/hot-weather.svg +3 -6
- package/src/assets/img/warning/pedestrian-safety.svg +3 -7
- package/src/assets/img/warning/rain.svg +2 -7
- package/src/assets/img/warning/sea-icing.svg +2 -6
- package/src/assets/img/warning/sea-thunder-storm.svg +2 -5
- package/src/assets/img/warning/sea-water-height-high-water.svg +3 -8
- package/src/assets/img/warning/sea-water-height-shallow-water.svg +3 -7
- package/src/assets/img/warning/sea-wave-height.svg +4 -7
- package/src/assets/img/warning/sea-wind-legend.svg +2 -5
- package/src/assets/img/warning/sea-wind.svg +2 -5
- package/src/assets/img/warning/several.svg +2 -5
- package/src/assets/img/warning/thunder-storm.svg +2 -5
- package/src/assets/img/warning/traffic-weather.svg +2 -6
- package/src/assets/img/warning/uv-note.svg +2 -6
- package/src/assets/img/warning/wind.svg +2 -5
- package/src/components/AlertClient.vue +41 -19
- package/src/components/CollapsiblePanel.vue +284 -0
- package/src/components/DayLarge.vue +12 -7
- package/src/components/DaySmall.vue +16 -6
- package/src/components/Days.vue +76 -51
- package/src/components/DescriptionWarning.vue +15 -8
- package/src/components/GrayScaleToggle.vue +11 -6
- package/src/components/Legend.vue +36 -248
- package/src/components/MapLarge.vue +41 -42
- package/src/components/MapSmall.vue +44 -28
- package/src/components/PopupRow.vue +6 -3
- package/src/components/Region.vue +30 -15
- package/src/components/RegionWarning.vue +6 -5
- package/src/components/Regions.vue +50 -19
- package/src/components/Warning.vue +18 -10
- package/src/components/Warnings.vue +36 -21
- package/src/main.js +1 -0
- package/src/mixins/alertClientCore.js +210 -0
- package/src/mixins/config.js +262 -256
- package/src/mixins/utils.js +40 -26
- package/src/plugins/index.js +1 -1
- package/src/scss/_utilities.scss +193 -0
- package/src/scss/constants.scss +2 -1
- package/src/scss/warningImages.scss +8 -3
- package/src/vue.js +41 -0
- package/svgo.config.js +45 -0
- package/tests/README.md +430 -0
- package/tests/fixtures/mockWarningData.js +135 -0
- package/tests/integration/warning-flow.spec.js +452 -0
- package/tests/setup.js +41 -0
- package/tests/unit/components/AlertClient.spec.js +734 -0
- package/tests/unit/components/DayLarge.spec.js +281 -0
- package/tests/unit/components/DaySmall.spec.js +278 -0
- package/tests/unit/components/Days.spec.js +565 -0
- package/tests/unit/components/DescriptionWarning.spec.js +432 -0
- package/tests/unit/components/GrayScaleToggle.spec.js +311 -0
- package/tests/unit/components/Legend.spec.js +223 -0
- package/tests/unit/components/MapLarge.spec.js +276 -0
- package/tests/unit/components/MapSmall.spec.js +226 -0
- package/tests/unit/components/PopupRow.spec.js +261 -0
- package/tests/unit/components/Region.spec.js +430 -0
- package/tests/unit/components/RegionWarning.snapshot.spec.js +73 -0
- package/tests/unit/components/RegionWarning.spec.js +408 -0
- package/tests/unit/components/Regions.spec.js +335 -0
- package/tests/unit/components/Warning.snapshot.spec.js +107 -0
- package/tests/unit/components/Warning.spec.js +472 -0
- package/tests/unit/components/Warnings.spec.js +329 -0
- package/tests/unit/components/__snapshots__/RegionWarning.snapshot.spec.js.snap +21 -0
- package/tests/unit/components/__snapshots__/Warning.snapshot.spec.js.snap +199 -0
- package/tests/unit/mixins/config.spec.js +269 -0
- package/tests/unit/mixins/i18n.spec.js +115 -0
- package/tests/unit/mixins/keycodes.spec.js +37 -0
- package/tests/unit/mixins/utils.spec.js +624 -0
- package/vite.config.js +96 -26
- package/vitest.config.js +40 -0
- package/dist/index.mjs.map +0 -1
- package/dist/index.relative.html +0 -19
- package/dist/index.start.html +0 -20
- package/playwright.config.ts +0 -18
- package/public/index.relative.html +0 -19
- package/public/index.start.html +0 -20
- package/src/mixins/panzoom.js +0 -900
- package/test/snapshot.test.ts +0 -126
- package/vitest.config.ts +0 -6
package/vite.config.js
CHANGED
|
@@ -2,54 +2,124 @@
|
|
|
2
2
|
import vue from '@vitejs/plugin-vue'
|
|
3
3
|
import { fileURLToPath, URL } from 'node:url'
|
|
4
4
|
import { visualizer } from 'rollup-plugin-visualizer'
|
|
5
|
-
import { BootstrapVueNextResolver } from 'unplugin-vue-components/resolvers'
|
|
6
|
-
import Components from 'unplugin-vue-components/vite'
|
|
7
5
|
import { defineConfig } from 'vite'
|
|
8
6
|
import banner from 'vite-plugin-banner'
|
|
9
7
|
import { viteStaticCopy } from 'vite-plugin-static-copy'
|
|
10
8
|
|
|
11
9
|
import pkg from './package.json'
|
|
12
10
|
|
|
11
|
+
// Check build mode: 'vue' for library build, default for web component
|
|
12
|
+
const buildMode = process.env.BUILD_MODE
|
|
13
|
+
|
|
13
14
|
export default defineConfig({
|
|
14
15
|
base: './',
|
|
15
16
|
plugins: [
|
|
16
17
|
vue({
|
|
17
|
-
customElement
|
|
18
|
-
|
|
19
|
-
Components({
|
|
20
|
-
resolvers: [BootstrapVueNextResolver()],
|
|
18
|
+
// Only use customElement mode for web component build
|
|
19
|
+
customElement: buildMode !== 'vue',
|
|
21
20
|
}),
|
|
22
21
|
banner(
|
|
23
22
|
`/**\n * name: ${pkg.name}\n * version: v${pkg.version}\n * description: ${pkg.description}\n * author: ${pkg.author}\n * homepage: ${pkg.homepage}\n */`
|
|
24
23
|
),
|
|
25
24
|
visualizer(),
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
...(buildMode !== 'vue'
|
|
26
|
+
? [
|
|
27
|
+
viteStaticCopy({
|
|
28
|
+
targets: [
|
|
29
|
+
{
|
|
30
|
+
src: 'dist/index.mjs',
|
|
31
|
+
dest: './',
|
|
32
|
+
rename: 'index.js',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
}),
|
|
36
|
+
]
|
|
37
|
+
: []),
|
|
38
|
+
],
|
|
39
|
+
build:
|
|
40
|
+
buildMode === 'vue'
|
|
41
|
+
? // Vue library build configuration
|
|
28
42
|
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
43
|
+
target: 'es2020',
|
|
44
|
+
outDir: 'dist/vue',
|
|
45
|
+
sourcemap: false,
|
|
46
|
+
minify: 'esbuild',
|
|
47
|
+
cssCodeSplit: false,
|
|
48
|
+
cssMinify: true,
|
|
49
|
+
copyPublicDir: false,
|
|
50
|
+
lib: {
|
|
51
|
+
entry: fileURLToPath(new URL('./src/vue.js', import.meta.url)),
|
|
52
|
+
name: 'SmartMetAlertClient',
|
|
53
|
+
formats: ['es'],
|
|
54
|
+
fileName: () => 'index.mjs',
|
|
55
|
+
},
|
|
56
|
+
rollupOptions: {
|
|
57
|
+
external: ['vue'],
|
|
58
|
+
output: {
|
|
59
|
+
globals: {
|
|
60
|
+
vue: 'Vue',
|
|
61
|
+
},
|
|
62
|
+
generatedCode: {
|
|
63
|
+
constBindings: true,
|
|
64
|
+
objectShorthand: true,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
32
68
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
69
|
+
: // Web component build configuration (default)
|
|
70
|
+
{
|
|
71
|
+
target: 'es2020',
|
|
72
|
+
outDir: 'dist',
|
|
73
|
+
assetsDir: '',
|
|
74
|
+
sourcemap: false,
|
|
75
|
+
minify: 'esbuild',
|
|
76
|
+
cssCodeSplit: false,
|
|
77
|
+
cssMinify: true,
|
|
78
|
+
chunkSizeWarningLimit: 1500,
|
|
79
|
+
rollupOptions: {
|
|
80
|
+
output: {
|
|
81
|
+
entryFileNames: 'index.mjs',
|
|
82
|
+
compact: true,
|
|
83
|
+
inlineDynamicImports: false,
|
|
84
|
+
manualChunks: (id) => {
|
|
85
|
+
// XML parsers as separate chunk
|
|
86
|
+
if (id.includes('@xmldom/xmldom') || id.includes('xpath')) {
|
|
87
|
+
return 'xml-parser'
|
|
88
|
+
}
|
|
89
|
+
// Locale files as separate chunks
|
|
90
|
+
if (id.includes('/locales/')) {
|
|
91
|
+
const match = id.match(/locales\/(\w+)\.json/)
|
|
92
|
+
if (match) {
|
|
93
|
+
return `locale-${match[1]}`
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Core vendor libraries
|
|
97
|
+
if (id.includes('node_modules')) {
|
|
98
|
+
if (id.includes('vue')) {
|
|
99
|
+
return 'vendor'
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
generatedCode: {
|
|
104
|
+
constBindings: true,
|
|
105
|
+
objectShorthand: true,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
css: {
|
|
111
|
+
preprocessorOptions: {
|
|
112
|
+
scss: {
|
|
113
|
+
api: 'modern-compiler',
|
|
114
|
+
silenceDeprecations: ['import', 'legacy-js-api'],
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
},
|
|
36
118
|
resolve: {
|
|
37
119
|
alias: {
|
|
38
120
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
39
121
|
},
|
|
40
122
|
},
|
|
41
|
-
build: {
|
|
42
|
-
target: 'es2019',
|
|
43
|
-
outDir: 'dist',
|
|
44
|
-
assetsDir: '',
|
|
45
|
-
sourcemap: true,
|
|
46
|
-
minify: true,
|
|
47
|
-
rollupOptions: {
|
|
48
|
-
output: {
|
|
49
|
-
entryFileNames: 'index.mjs',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
123
|
define: {
|
|
54
124
|
__APP_VERSION__: JSON.stringify(pkg.version),
|
|
55
125
|
},
|
package/vitest.config.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config'
|
|
2
|
+
import vue from '@vitejs/plugin-vue'
|
|
3
|
+
import path from 'path'
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: [vue()],
|
|
7
|
+
css: {
|
|
8
|
+
preprocessorOptions: {
|
|
9
|
+
scss: {
|
|
10
|
+
api: 'modern-compiler',
|
|
11
|
+
silenceDeprecations: ['import', 'legacy-js-api'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
test: {
|
|
16
|
+
globals: true,
|
|
17
|
+
environment: 'jsdom',
|
|
18
|
+
setupFiles: ['./tests/setup.js'],
|
|
19
|
+
coverage: {
|
|
20
|
+
provider: 'v8',
|
|
21
|
+
reporter: ['text', 'json', 'html'],
|
|
22
|
+
exclude: [
|
|
23
|
+
'node_modules/',
|
|
24
|
+
'tests/',
|
|
25
|
+
'dist/',
|
|
26
|
+
'public/',
|
|
27
|
+
'*.config.js',
|
|
28
|
+
'.eslintrc.js',
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
resolve: {
|
|
33
|
+
alias: {
|
|
34
|
+
'@': path.resolve(__dirname, './src'),
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
define: {
|
|
38
|
+
__APP_VERSION__: JSON.stringify('test-version'),
|
|
39
|
+
},
|
|
40
|
+
})
|