@fmidev/smartmet-alert-client 4.0.0 → 4.0.5

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@fmidev/smartmet-alert-client",
3
- "version": "4.0.0",
3
+ "version": "4.0.5",
4
4
  "description": "Web application for viewing weather and flood alerts",
5
5
  "author": "Finnish Meteorological Institute",
6
6
  "license": "MIT",
@@ -29,6 +29,7 @@
29
29
  "svgpath": "2.6.0",
30
30
  "url-search-params-polyfill": "8.2.5",
31
31
  "vue": "3.4.19",
32
+ "vue-web-component-wrapper": "1.4.0",
32
33
  "xpath": "0.0.33"
33
34
  },
34
35
  "devDependencies": {
@@ -50,8 +51,7 @@
50
51
  "unplugin-vue-components": "0.26.0",
51
52
  "vite": "5.1.4",
52
53
  "vite-plugin-banner": "0.7.1",
53
- "vitest": "0.34.4",
54
- "vue-adopted-stylesheets": "0.0.7"
54
+ "vitest": "0.34.4"
55
55
  },
56
56
  "eslintConfig": {
57
57
  "env": {
@@ -64,7 +64,9 @@
64
64
  "plugin:sonarjs/recommended",
65
65
  "plugin:prettier/recommended"
66
66
  ],
67
- "plugins": ["simple-import-sort"],
67
+ "plugins": [
68
+ "simple-import-sort"
69
+ ],
68
70
  "rules": {
69
71
  "simple-import-sort/imports": "error",
70
72
  "simple-import-sort/exports": "error"
@@ -89,5 +91,10 @@
89
91
  "npm": ">=8.0.0",
90
92
  "node": ">=14.0.0"
91
93
  },
92
- "keywords": ["smartmet", "weather", "alert", "wfs"]
94
+ "keywords": [
95
+ "smartmet",
96
+ "weather",
97
+ "alert",
98
+ "wfs"
99
+ ]
93
100
  }
@@ -620,7 +620,7 @@ export default {
620
620
  mounted() {
621
621
  if (this.isClientSide()) {
622
622
  const finlandLarge = this.$el.querySelector('svg#finland-large')
623
- if (finlandLarge != null) {
623
+ if (this.isAttached(finlandLarge)) {
624
624
  this.panzoom = Panzoom(finlandLarge, {
625
625
  disableZoom: true,
626
626
  panOnlyWhenZoomed: true,
@@ -886,6 +886,18 @@ export default {
886
886
  this.panzoom.pan(pan.x, pan.y)
887
887
  }
888
888
  },
889
+ isAttached(node) {
890
+ let currentNode = node
891
+ while (currentNode != null && currentNode.parentNode != null) {
892
+ if (currentNode.parentNode === document) {
893
+ return true
894
+ }
895
+ currentNode = currentNode.parentNode instanceof ShadowRoot
896
+ ? currentNode.parentNode.host
897
+ : currentNode.parentNode
898
+ }
899
+ return false
900
+ }
889
901
  },
890
902
  }
891
903
  </script>
@@ -1077,14 +1089,12 @@ div.day-map-large
1077
1089
 
1078
1090
  .light-theme .fmi-warnings-popup {
1079
1091
  background-color: $light-popup-background-color;
1080
- -webkit-filter: drop-shadow(0 1px 4px $light-popup-filter-color);
1081
- filter: drop-shadow(0 1px 4px $light-popup-filter-color);
1092
+ box-shadow: 0 0 0 1px $light-gray;
1082
1093
  }
1083
1094
 
1084
1095
  .dark-theme .fmi-warnings-popup {
1085
1096
  background-color: $dark-popup-background-color;
1086
- -webkit-filter: drop-shadow(0 1px 4px $dark-popup-filter-color);
1087
- filter: drop-shadow(0 1px 4px $dark-popup-filter-color);
1097
+ box-shadow: 0 0 0 1px $light-gray;
1088
1098
  }
1089
1099
 
1090
1100
  :deep(.tooltip.bs-tooltip-top) {
@@ -212,10 +212,7 @@ export default {
212
212
  : []
213
213
  },
214
214
  isFullMode() {
215
- if (!this.isClientSide()) {
216
- return true
217
- }
218
- return this.$el != null && this.$el.offsetParent !== null
215
+ return true;
219
216
  },
220
217
  },
221
218
  }
@@ -109,20 +109,12 @@ div.warning-image {
109
109
  background-position: center;
110
110
  }
111
111
 
112
- .light-theme div.warning-image {
113
- box-shadow: 0 0 0 1px transparent;
114
- }
115
-
116
- .dark-theme div.warning-image {
117
- box-shadow: 0 0 0 1px transparent;
118
- }
119
-
120
112
  .light-gray-theme div.warning-image {
121
- box-shadow: 0 0 0 1px $black;
113
+ border: 1px solid $black;
122
114
  }
123
115
 
124
116
  .dark-gray-theme div.warning-image {
125
- box-shadow: 0 0 0 1px $white;
117
+ border: 1px solid $white;
126
118
  }
127
119
 
128
120
  div.symbol-list-cell-text {
@@ -294,20 +294,12 @@ div.warning-image {
294
294
  background-position: center;
295
295
  }
296
296
 
297
- .light-theme div.warning-image {
298
- box-shadow: 0 0 0 1px transparent;
299
- }
300
-
301
- .dark-theme div.warning-image {
302
- box-shadow: 0 0 0 1px transparent;
303
- }
304
-
305
297
  .light-gray-theme div.warning-image {
306
- box-shadow: 0 0 0 1px $black;
298
+ border: 1px solid $black;
307
299
  }
308
300
 
309
301
  .dark-gray-theme div.warning-image {
310
- box-shadow: 0 0 0 1px $white;
302
+ border: 1px solid $white;
311
303
  }
312
304
 
313
305
  div.symbol-list-cell-text {
package/src/main.js CHANGED
@@ -1,18 +1,17 @@
1
- import { createApp } from 'vue'
2
- import App from './App.vue'
1
+ import {
2
+ createApp,
3
+ defineCustomElement as VueDefineCustomElement,
4
+ getCurrentInstance,
5
+ h,
6
+ } from 'vue'
7
+ import { createWebComponent } from 'vue-web-component-wrapper'
8
+ import app from './App.vue'
3
9
 
4
- class SmartMetAlertClient extends HTMLElement {
5
- constructor() {
6
- super()
7
- const app = createApp(
8
- App,
9
- [...this.attributes].reduce((newObject, item) => {
10
- newObject[item.nodeName] = item.nodeValue
11
- return newObject
12
- }, {})
13
- )
14
- app.mount(this.attachShadow({ mode: 'open' }))
15
- }
16
- }
17
-
18
- customElements.define('smartmet-alert-client', SmartMetAlertClient)
10
+ createWebComponent({
11
+ rootComponent: app,
12
+ elementName: 'smartmet-alert-client',
13
+ VueDefineCustomElement,
14
+ h,
15
+ createApp,
16
+ getCurrentInstance,
17
+ })
package/vite.config.js CHANGED
@@ -6,7 +6,6 @@ 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 { vueAdoptedStylesheetsPlugin } from 'vue-adopted-stylesheets'
10
9
 
11
10
  import pkg from './package.json'
12
11
 
@@ -19,7 +18,6 @@ export default defineConfig({
19
18
  Components({
20
19
  resolvers: [BootstrapVueNextResolver()],
21
20
  }),
22
- vueAdoptedStylesheetsPlugin(),
23
21
  banner(
24
22
  `/**\n * name: ${pkg.name}\n * version: v${pkg.version}\n * description: ${pkg.description}\n * author: ${pkg.author}\n * homepage: ${pkg.homepage}\n */`
25
23
  ),