@record-evolution/widget-mapbox 1.5.3 → 1.5.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
@@ -3,7 +3,7 @@
3
3
  "description": "REWidget widget-mapbox",
4
4
  "license": "MIT",
5
5
  "author": "widget-mapbox",
6
- "version": "1.5.3",
6
+ "version": "1.5.5",
7
7
  "type": "module",
8
8
  "main": "dist/widget-mapbox.js",
9
9
  "types": "dist/src/widget-mapbox.d.ts",
@@ -13,51 +13,49 @@
13
13
  ],
14
14
  "scripts": {
15
15
  "analyze": "cem analyze --litelement",
16
- "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
16
+ "start": "concurrently -k -r \"npm run watch\" \"wds\"",
17
17
  "build": "rollup -c rollup.config.js",
18
18
  "watch": "rollup -w -c rollup.config.js",
19
19
  "link": "npm link && cd ../RESWARM/frontend && npm link @record-evolution/widget-mapbox",
20
20
  "unlink": "npm unlink --global && cd ../RESWARM/frontend && npm unlink @record-evolution/widget-mapbox && npm i @record-evolution/widget-mapbox",
21
21
  "types": "cat src/definition-schema.json | json2ts > src/definition-schema.d.ts",
22
- "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
23
- "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
24
22
  "release": "npm version patch --tag-version-prefix='' && git push && git push --tag",
25
23
  "cors": "gcloud storage buckets update gs://reswarm-images --cors-file=src/cors-config.json"
26
24
  },
27
25
  "dependencies": {
28
- "@types/geojson": "^7946.0.14",
29
- "@types/mapbox-gl": "^3.4.0",
30
- "lit": "^3.2.0",
31
- "mapbox-gl": "^3.7.0",
26
+ "@types/geojson": "^7946.0.16",
27
+ "@types/mapbox-gl": "^3.4.1",
28
+ "lit": "^3.3.0",
29
+ "mapbox-gl": "^3.13.0",
32
30
  "tinycolor2": "^1.6.0"
33
31
  },
34
32
  "devDependencies": {
35
- "@babel/plugin-syntax-import-assertions": "^7.25.7",
36
- "@custom-elements-manifest/analyzer": "^0.10.3",
33
+ "@babel/plugin-syntax-import-assertions": "^7.27.1",
34
+ "@custom-elements-manifest/analyzer": "^0.10.4",
37
35
  "@rollup/plugin-babel": "^6.0.4",
38
- "@rollup/plugin-commonjs": "^28.0.0",
36
+ "@rollup/plugin-commonjs": "^28.0.6",
39
37
  "@rollup/plugin-json": "^6.1.0",
40
- "@rollup/plugin-node-resolve": "^15.3.0",
41
- "@rollup/plugin-replace": "^6.0.1",
42
- "@rollup/plugin-typescript": "^12.1.0",
38
+ "@rollup/plugin-node-resolve": "^16.0.1",
39
+ "@rollup/plugin-replace": "^6.0.2",
40
+ "@rollup/plugin-typescript": "^12.1.3",
43
41
  "@types/glob": "^8.1.0",
44
42
  "@types/tinycolor2": "^1.4.6",
45
- "@typescript-eslint/eslint-plugin": "^8.8.0",
46
- "@typescript-eslint/parser": "^8.8.0",
43
+ "@typescript-eslint/eslint-plugin": "^8.34.1",
44
+ "@typescript-eslint/parser": "^8.34.1",
47
45
  "@web/dev-server": "^0.4.6",
48
- "concurrently": "^9.0.1",
49
- "eslint": "^9.12.0",
50
- "eslint-config-prettier": "^9.1.0",
51
- "glob": "^11.0.0",
52
- "husky": "^9.1.6",
53
- "json-schema-to-typescript": "^15.0.2",
54
- "lint-staged": "^15.2.10",
55
- "minimatch": "3.1.2",
56
- "prettier": "^3.3.3",
57
- "rollup": "^4.24.0",
46
+ "concurrently": "^9.1.2",
47
+ "eslint": "^9.29.0",
48
+ "eslint-config-prettier": "^10.1.5",
49
+ "glob": "^11.0.3",
50
+ "husky": "^9.1.7",
51
+ "json-schema-to-typescript": "^15.0.4",
52
+ "lint-staged": "^16.1.2",
53
+ "minimatch": "10.0.3",
54
+ "prettier": "^3.5.3",
55
+ "rollup": "^4.43.0",
58
56
  "rollup-plugin-copy": "^3.5.0",
59
- "tslib": "^2.7.0",
60
- "typescript": "5.3.2"
57
+ "tslib": "^2.8.1",
58
+ "typescript": "5.8.3"
61
59
  },
62
60
  "repository": {
63
61
  "type": "git",
@@ -1,4 +1,6 @@
1
1
  {
2
+ "title": "Test",
3
+ "subTitle": "Subtitle",
2
4
  "style": "light-v11",
3
5
  "showLegend": false,
4
6
  "follow": false,
@@ -10,10 +10,17 @@ import { LayerBaseColor, InputData } from './definition-schema.js'
10
10
 
11
11
  type Dataseries = Exclude<InputData['dataseries'], undefined>[number]
12
12
  type Point = Exclude<Dataseries['data'], undefined>[number]
13
-
13
+ type Theme = {
14
+ theme_name: string
15
+ theme_object: any
16
+ }
14
17
  export class WidgetMapbox extends LitElement {
15
18
  @property({ type: Object })
16
19
  inputData?: InputData
20
+
21
+ @property({ type: Object })
22
+ theme?: Theme
23
+
17
24
  @state()
18
25
  private map: any | undefined = undefined
19
26
 
@@ -26,6 +33,10 @@ export class WidgetMapbox extends LitElement {
26
33
  @state()
27
34
  colors: any = new Map()
28
35
 
36
+ @state() private themeBgColor?: string
37
+ @state() private themeTitleColor?: string
38
+ @state() private themeSubtitleColor?: string
39
+
29
40
  public version: string = 'versionplaceholder'
30
41
  private mapLoaded: boolean = false
31
42
  private resizeObserver: ResizeObserver
@@ -52,16 +63,31 @@ export class WidgetMapbox extends LitElement {
52
63
  if (changedProperties.has('inputData')) {
53
64
  this.transformInputData()
54
65
  }
66
+
67
+ if (changedProperties.has('theme')) {
68
+ this.registerTheme(this.theme)
69
+ }
70
+
55
71
  super.update(changedProperties)
56
72
  }
57
73
 
58
74
  firstUpdated() {
75
+ this.registerTheme(this.theme)
59
76
  this.transformInputData()
60
77
  this.createMap()
61
78
  this.resizeObserver.observe(this.map._container)
62
79
  this.fitBounds()
63
80
  }
64
81
 
82
+ registerTheme(theme?: Theme) {
83
+ const cssTextColor = getComputedStyle(this).getPropertyValue('--re-text-color').trim()
84
+ const cssBgColor = getComputedStyle(this).getPropertyValue('--re-background-color').trim()
85
+ this.themeBgColor = cssBgColor || this.theme?.theme_object?.backgroundColor
86
+ this.themeTitleColor = cssTextColor || this.theme?.theme_object?.title?.textStyle?.color
87
+ this.themeSubtitleColor =
88
+ cssTextColor || this.theme?.theme_object?.title?.subtextStyle?.color || this.themeTitleColor
89
+ }
90
+
65
91
  updateMap() {
66
92
  if (this.customDebounce) clearTimeout(this.customDebounce)
67
93
 
@@ -539,9 +565,7 @@ export class WidgetMapbox extends LitElement {
539
565
  static styles = css`
540
566
  :host {
541
567
  display: block;
542
- color: var(--re-bar-text-color, #000);
543
568
  font-family: sans-serif;
544
- padding: 16px;
545
569
  box-sizing: border-box;
546
570
  margin: auto;
547
571
  }
@@ -576,6 +600,8 @@ export class WidgetMapbox extends LitElement {
576
600
  .wrapper {
577
601
  display: flex;
578
602
  flex-direction: column;
603
+ box-sizing: border-box;
604
+ padding: 16px;
579
605
  height: 100%;
580
606
  width: 100%;
581
607
  }
@@ -606,7 +632,6 @@ export class WidgetMapbox extends LitElement {
606
632
 
607
633
  .no-data {
608
634
  font-size: 20px;
609
- color: var(--re-text-color, #000);
610
635
  display: flex;
611
636
  height: 100%;
612
637
  width: 100%;
@@ -622,11 +647,20 @@ export class WidgetMapbox extends LitElement {
622
647
  href="https://api.mapbox.com/mapbox-gl-js/v${mapboxgl.version}/mapbox-gl.css"
623
648
  rel="stylesheet"
624
649
  />
625
- <div class="wrapper">
650
+ <div
651
+ class="wrapper"
652
+ style="background-color: ${this.themeBgColor}; color: ${this.themeTitleColor}"
653
+ >
626
654
  <header class="paging" ?active=${this.inputData?.title || this.inputData?.subTitle}>
627
655
  <div class="title">
628
656
  <h3 class="paging" ?active=${this.inputData?.title}>${this.inputData?.title}</h3>
629
- <p class="paging" ?active=${this.inputData?.subTitle}>${this.inputData?.subTitle}</p>
657
+ <p
658
+ class="paging"
659
+ ?active=${this.inputData?.subTitle}
660
+ style="color: ${this.themeSubtitleColor}"
661
+ >
662
+ ${this.inputData?.subTitle}
663
+ </p>
630
664
  </div>
631
665
  <div class="legend paging" ?active=${this?.inputData?.showLegend}>
632
666
  ${repeat(