mobility-toolbox-js 3.0.0-beta.35 → 3.0.0-beta.36

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.
@@ -1,9 +1,8 @@
1
1
  import { MapLibreLayer } from '@geoblocks/ol-maplibre-layer';
2
2
  import OlMap from 'ol/Map';
3
3
  import { MobilityLayerOptions } from '../mixins/MobilityLayerMixin';
4
- import type { MapLibreOptions } from '@geoblocks/ol-maplibre-layer/lib/types/MapLibreLayer';
4
+ import type { MapLibreLayerOptions, MapLibreOptions } from '@geoblocks/ol-maplibre-layer/lib/types/MapLibreLayer';
5
5
  import type { QueryRenderedFeaturesOptions } from 'maplibre-gl';
6
- import type { Options as LayerOptions } from 'ol/layer/Layer';
7
6
  export type MaplibreLayerOptions = {
8
7
  apiKey?: string;
9
8
  apiKeyName?: string;
@@ -11,7 +10,7 @@ export type MaplibreLayerOptions = {
11
10
  queryRenderedFeaturesOptions?: QueryRenderedFeaturesOptions | undefined;
12
11
  style?: maplibregl.StyleSpecification | null | string;
13
12
  url?: string;
14
- } & LayerOptions & MobilityLayerOptions;
13
+ } & MapLibreLayerOptions & MobilityLayerOptions;
15
14
  declare const MaplibreLayer_base: {
16
15
  new (...args: any[]): {
17
16
  olEventsKeys: import("ol/events").EventsKey[];
@@ -19,9 +18,9 @@ declare const MaplibreLayer_base: {
19
18
  attachToMap(map: OlMap): void;
20
19
  detachFromMap(): void;
21
20
  flat(): any[];
22
- onChildrenChange(oldValue: import("ol/layer/Layer").default[]): void;
21
+ onChildrenChange(oldValue: import("ol/layer").Layer[]): void;
23
22
  setMapInternal: ((map: OlMap) => void) & ((map: import("ol/Map").default | null) => void);
24
- children: import("ol/layer/Layer").default<import("ol/source").Source, import("ol/renderer/Layer").default<any>>[];
23
+ children: import("ol/layer").Layer<import("ol/source").Source, import("ol/renderer/Layer").default<any>>[];
25
24
  get copyrights(): string;
26
25
  set copyrights(newCopyrights: string | string[]);
27
26
  disabled: boolean;
@@ -30,8 +29,8 @@ declare const MaplibreLayer_base: {
30
29
  readonly key: string;
31
30
  readonly map: OlMap;
32
31
  readonly name: string;
33
- olLayer: import("ol/layer/Layer").default;
34
- parent: import("ol/layer/Layer").default<import("ol/source").Source, import("ol/renderer/Layer").default<any>>;
32
+ olLayer: import("ol/layer").Layer;
33
+ parent: import("ol/layer").Layer<import("ol/source").Source, import("ol/renderer/Layer").default<any>>;
35
34
  visible: boolean;
36
35
  on: import("ol/layer/Layer").LayerOnSignature<import("ol/events").EventsKey>;
37
36
  once: import("ol/layer/Layer").LayerOnSignature<import("ol/events").EventsKey>;
@@ -55,7 +54,7 @@ declare const MaplibreLayer_base: {
55
54
  getBackground: () => import("ol/layer/Base").BackgroundColor | false;
56
55
  getClassName: () => string;
57
56
  getLayerState: (managed?: boolean | undefined) => import("ol/layer/Layer").State;
58
- getLayersArray: (array?: import("ol/layer/Layer").default<import("ol/source").default, import("ol/renderer/Layer").default<any>>[] | undefined) => Array<import("ol/layer/Layer").default>;
57
+ getLayersArray: (array?: import("ol/layer").default<import("ol/source").default, import("ol/renderer/Layer").default<any>>[] | undefined) => Array<import("ol/layer").default>;
59
58
  getLayerStatesArray: (states?: import("ol/layer/Layer").State[] | undefined) => Array<import("ol/layer/Layer").State>;
60
59
  getExtent: () => import("ol/extent").Extent | undefined;
61
60
  getMaxResolution: () => number;
@@ -158,7 +157,7 @@ declare class MaplibreLayer extends MaplibreLayer_base {
158
157
  * @public
159
158
  */
160
159
  clone(newOptions: MaplibreLayerOptions): MaplibreLayer;
161
- getStyle(): string;
160
+ getStyle(): any;
162
161
  updateMaplibreMap(): void;
163
162
  set apiKey(newValue: string);
164
163
  get apiKey(): string;
@@ -105,6 +105,7 @@ class MaplibreLayer extends MobilityLayerMixin(MapLibreLayer) {
105
105
  return new MaplibreLayer(Object.assign(Object.assign({}, (this.options || {})), (newOptions || {})));
106
106
  }
107
107
  getStyle() {
108
+ var _a;
108
109
  // If the style is a complete style object, use it directly.
109
110
  if (this.style &&
110
111
  typeof this.style === 'object' &&
@@ -116,6 +117,10 @@ class MaplibreLayer extends MobilityLayerMixin(MapLibreLayer) {
116
117
  if (this.url.includes('style.json')) {
117
118
  return this.url;
118
119
  }
120
+ // If the style is defined by the maplibreOptions, we use it directly
121
+ if ((_a = this.get('mapLibreOptions')) === null || _a === void 0 ? void 0 : _a.style) {
122
+ return this.get('mapLibreOptions').style;
123
+ }
119
124
  /// Otherwise build the complete style url.
120
125
  return buildStyleUrl(this.url, this.style, this.apiKey, this.apiKeyName);
121
126
  }
@@ -84,7 +84,7 @@ declare function PropertiesLayerMixin<TBase extends Layerable>(Base: TBase): {
84
84
  getBackground: () => import("ol/layer/Base").BackgroundColor | false;
85
85
  getClassName: () => string;
86
86
  getLayerState: (managed?: boolean | undefined) => import("ol/layer/Layer").State;
87
- getLayersArray: (array?: import("ol/layer/Layer").default<import("ol/source").default, import("ol/renderer/Layer").default<any>>[] | undefined) => Array<import("ol/layer/Layer" /** @deprecated */).default>;
87
+ getLayersArray: (array?: import("ol/layer/Layer").default<import("ol/source").default, import("ol/renderer/Layer").default<any>>[] | undefined) => Array<import("ol/layer/Layer").default>;
88
88
  getLayerStatesArray: (states?: import("ol/layer/Layer").State[] | undefined) => Array<import("ol/layer/Layer").State>;
89
89
  getExtent: () => import("ol/extent").Extent | undefined;
90
90
  getMaxResolution: () => number;
@@ -1,6 +1,5 @@
1
1
  // eslint-disable-next-line max-classes-per-file
2
2
  import debounce from 'lodash.debounce';
3
- import { getUid } from 'ol';
4
3
  import { unByKey } from 'ol/Observable';
5
4
  import getLayersAsFlatArray from '../../common/utils/getLayersAsFlatArray';
6
5
  let deprecated = () => { };
@@ -134,7 +133,7 @@ function PropertiesLayerMixin(Base) {
134
133
  this.set('hitTolerance', newValue);
135
134
  }
136
135
  get key() {
137
- return this.get('key') || this.get('name') || getUid(this);
136
+ return this.get('key') || this.get('name');
138
137
  }
139
138
  get map() {
140
139
  return this.getMapInternal();
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.35",
5
+ "version": "3.0.0-beta.36",
6
6
  "homepage": "https://mobility-toolbox-js.geops.io/",
7
7
  "exports": {
8
8
  ".": "./index.js",