mobility-toolbox-js 3.0.0-beta.22 → 3.0.0-beta.24

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.
@@ -150,6 +150,10 @@ declare class MaplibreLayer extends MaplibreLayer_base {
150
150
  clone(newOptions: MaplibreLayerOptions): MaplibreLayer;
151
151
  getStyle(): string;
152
152
  updateMaplibreMap(): void;
153
+ set apiKey(newValue: string);
154
+ get apiKey(): string;
155
+ set apiKeyName(newValue: string);
156
+ get apiKeyName(): string;
153
157
  get maplibreMap(): maplibregl.Map | undefined;
154
158
  get mbMap(): maplibregl.Map | undefined;
155
159
  get style(): string;
@@ -71,7 +71,7 @@ class MaplibreLayer extends MobilityLayerMixin(MapLibreLayer) {
71
71
  const updateMaplibreMapDebounced = debounce(this.updateMaplibreMap.bind(this), 150);
72
72
  updateMaplibreMapDebounced();
73
73
  this.olEventsKeys.push(this.on('propertychange', (evt) => {
74
- if (/(url|style)/.test(evt.key)) {
74
+ if (/(url|style|apiKey|apiKeyName)/.test(evt.key)) {
75
75
  updateMaplibreMapDebounced();
76
76
  }
77
77
  }));
@@ -105,7 +105,7 @@ class MaplibreLayer extends MobilityLayerMixin(MapLibreLayer) {
105
105
  return this.url;
106
106
  }
107
107
  /// Otherwise build the complete style url.
108
- return buildStyleUrl(this.url, this.style, this.get('apiKey'), this.get('apiKeyName'));
108
+ return buildStyleUrl(this.url, this.style, this.apiKey, this.apiKeyName);
109
109
  }
110
110
  updateMaplibreMap() {
111
111
  var _a;
@@ -117,6 +117,18 @@ class MaplibreLayer extends MobilityLayerMixin(MapLibreLayer) {
117
117
  console.error('Error while updating MaplibreMap', e);
118
118
  }
119
119
  }
120
+ set apiKey(newValue) {
121
+ this.set('apiKey', newValue);
122
+ }
123
+ get apiKey() {
124
+ return this.get('apiKey');
125
+ }
126
+ set apiKeyName(newValue) {
127
+ this.set('apiKeyName', newValue);
128
+ }
129
+ get apiKeyName() {
130
+ return this.get('apiKeyName');
131
+ }
120
132
  get maplibreMap() {
121
133
  deprecated('MaplibreLayer.maplibreMap is deprecated. Use layer.mapLibreMap.');
122
134
  return this.mapLibreMap;
@@ -77,12 +77,13 @@ function PropertiesLayerMixin(Base) {
77
77
  }
78
78
  // @ts-expect-error - this is a mixin
79
79
  setMapInternal(map) {
80
- super.setMapInternal(map);
81
80
  if (map) {
81
+ super.setMapInternal(map);
82
82
  this.attachToMap(map);
83
83
  }
84
84
  else {
85
85
  this.detachFromMap();
86
+ super.setMapInternal(map);
86
87
  }
87
88
  }
88
89
  /** @deprecated */
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "mobility-toolbox-js",
3
3
  "license": "MIT",
4
4
  "description": "Toolbox for JavaScript applications in the domains of mobility and logistics.",
5
- "version": "3.0.0-beta.22",
5
+ "version": "3.0.0-beta.24",
6
6
  "homepage": "https://mobility-toolbox-js.geops.io/",
7
7
  "exports": {
8
8
  ".": "./index.js",