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

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,11 +1,11 @@
1
1
  import { DebouncedFunc } from 'lodash';
2
2
  import { Map, MapEvent } from 'ol';
3
+ import { EventsKey } from 'ol/events';
3
4
  import Feature, { FeatureLike } from 'ol/Feature';
4
5
  import { Vector as VectorLayer } from 'ol/layer';
5
6
  import Layer from 'ol/layer/Layer';
6
7
  import { ObjectEvent } from 'ol/Object';
7
8
  import { Vector as VectorSource } from 'ol/source';
8
- import Source from 'ol/source/Source';
9
9
  import { State } from 'ol/View';
10
10
  import { WebSocketAPIMessageEventData } from '../../api/WebSocketAPI';
11
11
  import { FilterFunction, SortFunction } from '../../common/typedefs';
@@ -18,96 +18,6 @@ export type RealtimeLayerOptions = {
18
18
  fullTrajectoryStyle?: (feature: FeatureLike, resolution: number, options: any) => void;
19
19
  maxNbFeaturesRequested?: number;
20
20
  } & RealtimeEngineOptions;
21
- declare const RealtimeLayer_base: {
22
- new (...args: any[]): {
23
- olEventsKeys: import("ol/events").EventsKey[];
24
- options?: import("../mixins/PropertiesLayerMixin").PropertiesLayerMixinOptions;
25
- attachToMap(map: Map): void;
26
- detachFromMap(): void;
27
- flat(): any[];
28
- onChildrenChange(oldValue: Layer[]): void;
29
- setMapInternal: ((map: Map) => void) & ((map: import("ol/Map").default | null) => void);
30
- children: Layer<Source, import("ol/renderer/Layer").default<any>>[];
31
- get copyrights(): string;
32
- set copyrights(newCopyrights: string | string[]);
33
- disabled: boolean;
34
- readonly group: string;
35
- hitTolerance: number;
36
- readonly key: string;
37
- readonly map: Map;
38
- readonly name: string;
39
- olLayer: Layer;
40
- parent: Layer<Source, import("ol/renderer/Layer").default<any>>;
41
- visible: boolean;
42
- on: import("ol/layer/Layer").LayerOnSignature<import("ol/events").EventsKey>;
43
- once: import("ol/layer/Layer").LayerOnSignature<import("ol/events").EventsKey>;
44
- un: import("ol/layer/Layer").LayerOnSignature<void>;
45
- render: (frameState: import("ol/Map").FrameState | null, target: HTMLElement) => HTMLElement | null;
46
- getSource: () => Source | null;
47
- getRenderSource: () => Source | null;
48
- getFeatures: (pixel: import("ol/pixel").Pixel) => Promise<Array<import("ol/Feature").FeatureLike>>;
49
- getData: (pixel: import("ol/pixel").Pixel) => Uint8ClampedArray | Uint8Array | Float32Array | DataView | null;
50
- isVisible: (view?: import("ol").View | import("ol/View").ViewStateLayerStateExtent | undefined) => boolean;
51
- getAttributions: (view?: import("ol").View | import("ol/View").ViewStateLayerStateExtent | undefined) => Array<string>;
52
- unrender: () => void;
53
- getDeclutter: () => string;
54
- renderDeclutter: (frameState: import("ol/Map").FrameState, layerState: import("ol/layer/Layer").State) => void;
55
- renderDeferred: (frameState: import("ol/Map").FrameState) => void;
56
- getMapInternal: () => import("ol/Map").default | null;
57
- setMap: (map: import("ol/Map").default | null) => void;
58
- setSource: (source: Source | null) => void;
59
- getRenderer: () => import("ol/renderer/Layer").default<any> | null;
60
- hasRenderer: () => boolean;
61
- getBackground: () => import("ol/layer/Base").BackgroundColor | false;
62
- getClassName: () => string;
63
- getLayerState: (managed?: boolean | undefined) => import("ol/layer/Layer").State;
64
- getLayersArray: (array?: import("ol/layer/Layer").default<import("ol/source/Source").default, import("ol/renderer/Layer").default<any>>[] | undefined) => Array<import("ol/layer/Layer").default>;
65
- getLayerStatesArray: (states?: import("ol/layer/Layer").State[] | undefined) => Array<import("ol/layer/Layer").State>;
66
- getExtent: () => import("ol/extent").Extent | undefined;
67
- getMaxResolution: () => number;
68
- getMinResolution: () => number;
69
- getMinZoom: () => number;
70
- getMaxZoom: () => number;
71
- getOpacity: () => number;
72
- getSourceState: () => import("ol/source/Source").State;
73
- getVisible: () => boolean;
74
- getZIndex: () => number | undefined;
75
- setBackground: (background?: import("ol/layer/Base").BackgroundColor | undefined) => void;
76
- setExtent: (extent: import("ol/extent").Extent | undefined) => void;
77
- setMaxResolution: (maxResolution: number) => void;
78
- setMinResolution: (minResolution: number) => void;
79
- setMaxZoom: (maxZoom: number) => void;
80
- setMinZoom: (minZoom: number) => void;
81
- setOpacity: (opacity: number) => void;
82
- setVisible: (visible: boolean) => void;
83
- setZIndex: (zindex: number) => void;
84
- get: (key: string) => any;
85
- getKeys: () => Array<string>;
86
- getProperties: () => {
87
- [x: string]: any;
88
- };
89
- getPropertiesInternal: () => {
90
- [x: string]: any;
91
- } | null;
92
- hasProperties: () => boolean;
93
- notify: (key: string, oldValue: any) => void;
94
- addChangeListener: (key: string, listener: import("ol/events").Listener) => void;
95
- removeChangeListener: (key: string, listener: import("ol/events").Listener) => void;
96
- set: (key: string, value: any, silent?: boolean | undefined) => void;
97
- setProperties: (values: {
98
- [x: string]: any;
99
- }, silent?: boolean | undefined) => void;
100
- unset: (key: string, silent?: boolean | undefined) => void;
101
- changed: () => void;
102
- getRevision: () => number;
103
- addEventListener: (type: string, listener: import("ol/events").Listener) => void;
104
- dispatchEvent: (event: import("ol/events/Event").default | string) => boolean | undefined;
105
- getListeners: (type: string) => Array<import("ol/events").Listener> | undefined;
106
- hasListener: (type?: string | undefined) => boolean;
107
- removeEventListener: (type: string, listener: import("ol/events").Listener) => void;
108
- dispose: () => void;
109
- };
110
- } & typeof Layer;
111
21
  /**
112
22
  * An OpenLayers layer able to display data from the [geOps Realtime API](https://developer.geops.io/apis/realtime/).
113
23
  *
@@ -131,11 +41,12 @@ declare const RealtimeLayer_base: {
131
41
  * @classproperty {boolean} allowRenderWhenAnimating - Allow rendering of the layer when the map is animating.
132
42
  * @public
133
43
  */
134
- declare class RealtimeLayer extends RealtimeLayer_base {
44
+ declare class RealtimeLayer extends Layer {
135
45
  allowRenderWhenAnimating?: boolean;
136
46
  currentZoom?: number;
137
47
  engine: RealtimeEngine;
138
48
  maxNbFeaturesRequested: number;
49
+ olEventsKeys: EventsKey[];
139
50
  onMoveEndDebounced: DebouncedFunc<(evt: MapEvent | ObjectEvent) => void>;
140
51
  onZoomEndDebounced: DebouncedFunc<(evt: MapEvent | ObjectEvent) => void>;
141
52
  renderedViewState: State | undefined;
@@ -150,7 +61,7 @@ declare class RealtimeLayer extends RealtimeLayer_base {
150
61
  * @public
151
62
  */
152
63
  constructor(options: RealtimeLayerOptions);
153
- attachToMap(map: Map): void;
64
+ attachToMap(): void;
154
65
  /**
155
66
  * Create a copy of the RealtimeLayer.
156
67
  *
@@ -206,7 +117,8 @@ declare class RealtimeLayer extends RealtimeLayer_base {
206
117
  onRealtimeEngineRender(renderState: RealtimeRenderState, viewState: ViewState): void;
207
118
  onZoomEnd(): void;
208
119
  select(feature: Feature): void;
209
- shouldRender(): boolean;
120
+ setMapInternal(map: Map): void;
121
+ shouldRender(): boolean | undefined;
210
122
  /**
211
123
  * Start the rendering.
212
124
  *
@@ -2,12 +2,13 @@ import debounce from 'lodash.debounce';
2
2
  import GeoJSON from 'ol/format/GeoJSON';
3
3
  import { Vector as VectorLayer } from 'ol/layer';
4
4
  import Layer from 'ol/layer/Layer';
5
+ import { unByKey } from 'ol/Observable';
5
6
  import { Vector as VectorSource } from 'ol/source';
6
7
  import Source from 'ol/source/Source';
7
8
  import RealtimeEngine from '../../common/utils/RealtimeEngine';
8
- import MobilityLayerMixin from '../mixins/MobilityLayerMixin';
9
9
  import RealtimeLayerRenderer from '../renderers/RealtimeLayerRenderer';
10
10
  import { fullTrajectoryStyle } from '../styles';
11
+ import defineDeprecatedProperties from '../utils/defineDeprecatedProperties';
11
12
  const format = new GeoJSON();
12
13
  /**
13
14
  * An OpenLayers layer able to display data from the [geOps Realtime API](https://developer.geops.io/apis/realtime/).
@@ -32,7 +33,7 @@ const format = new GeoJSON();
32
33
  * @classproperty {boolean} allowRenderWhenAnimating - Allow rendering of the layer when the map is animating.
33
34
  * @public
34
35
  */
35
- class RealtimeLayer extends MobilityLayerMixin(Layer) {
36
+ class RealtimeLayer extends Layer {
36
37
  /**
37
38
  * Constructor.
38
39
  *
@@ -48,6 +49,9 @@ class RealtimeLayer extends MobilityLayerMixin(Layer) {
48
49
  super(Object.assign({ source: new Source({}) }, options));
49
50
  this.allowRenderWhenAnimating = false;
50
51
  this.maxNbFeaturesRequested = 100;
52
+ this.olEventsKeys = [];
53
+ // For backward compatibility with v2
54
+ defineDeprecatedProperties(this, options);
51
55
  this.engine = new RealtimeEngine(Object.assign({ getViewState: this.getViewState.bind(this), onRender: this.onRealtimeEngineRender.bind(this) }, options));
52
56
  this.allowRenderWhenAnimating = !!options.allowRenderWhenAnimating;
53
57
  // We store the layer used to highlight the full Trajectory
@@ -62,17 +66,17 @@ class RealtimeLayer extends MobilityLayerMixin(Layer) {
62
66
  this.onZoomEndDebounced = debounce(this.onZoomEnd, 100);
63
67
  this.onMoveEndDebounced = debounce(this.onMoveEnd, 100);
64
68
  }
65
- attachToMap(map) {
66
- super.attachToMap(map);
69
+ attachToMap() {
67
70
  this.engine.attachToMap();
68
- if (this.map) {
71
+ const mapInternal = this.getMapInternal();
72
+ if (mapInternal) {
69
73
  // If the layer is visible we start the rendering clock
70
74
  if (this.getVisible()) {
71
75
  this.engine.start();
72
76
  }
73
- const index = this.map.getLayers().getArray().indexOf(this);
74
- this.map.getLayers().insertAt(index, this.vectorLayer);
75
- this.olEventsKeys.push(...this.map.on(['moveend', 'change:target'],
77
+ const index = mapInternal.getLayers().getArray().indexOf(this);
78
+ mapInternal.getLayers().insertAt(index, this.vectorLayer);
79
+ this.olEventsKeys.push(...mapInternal.on(['moveend', 'change:target'],
76
80
  // @ts-expect-error - bad ol definitions
77
81
  (evt) => {
78
82
  const view = (evt.map || evt.target).getView();
@@ -109,7 +113,7 @@ class RealtimeLayer extends MobilityLayerMixin(Layer) {
109
113
  * @public
110
114
  */
111
115
  clone(newOptions) {
112
- return new RealtimeLayer(Object.assign(Object.assign({}, this.options), newOptions));
116
+ return new RealtimeLayer(Object.assign(Object.assign({}, this.get('options')), newOptions));
113
117
  }
114
118
  createRenderer() {
115
119
  return new RealtimeLayerRenderer(this);
@@ -119,9 +123,9 @@ class RealtimeLayer extends MobilityLayerMixin(Layer) {
119
123
  */
120
124
  detachFromMap() {
121
125
  var _a;
122
- (_a = this.map) === null || _a === void 0 ? void 0 : _a.removeLayer(this.vectorLayer);
126
+ unByKey(this.olEventsKeys);
127
+ (_a = this.getMapInternal()) === null || _a === void 0 ? void 0 : _a.removeLayer(this.vectorLayer);
123
128
  this.engine.detachFromMap();
124
- super.detachFromMap();
125
129
  }
126
130
  /**
127
131
  * Get some informations about a trajectory.
@@ -135,7 +139,7 @@ class RealtimeLayer extends MobilityLayerMixin(Layer) {
135
139
  // Then we combine them in one response and send them to inherited layers.
136
140
  const promises = [
137
141
  this.engine.api.getStopSequence(id),
138
- this.engine.api.getFullTrajectory(id, this.engine.mode, this.engine.getGeneralizationLevelByZoom(Math.floor(((_b = (_a = this.map) === null || _a === void 0 ? void 0 : _a.getView()) === null || _b === void 0 ? void 0 : _b.getZoom()) || 0))),
142
+ this.engine.api.getFullTrajectory(id, this.engine.mode, this.engine.getGeneralizationLevelByZoom(Math.floor(((_b = (_a = this.getMapInternal()) === null || _a === void 0 ? void 0 : _a.getView()) === null || _b === void 0 ? void 0 : _b.getZoom()) || 0))),
139
143
  ];
140
144
  return Promise.all(promises).then(([stopSequence, fullTrajectory]) => {
141
145
  const response = {
@@ -149,18 +153,18 @@ class RealtimeLayer extends MobilityLayerMixin(Layer) {
149
153
  return this.engine.getVehicles(filterFunc);
150
154
  }
151
155
  getViewState() {
152
- var _a;
153
- if (!((_a = this.map) === null || _a === void 0 ? void 0 : _a.getView())) {
156
+ const mapInternal = this.getMapInternal();
157
+ if (!(mapInternal === null || mapInternal === void 0 ? void 0 : mapInternal.getView())) {
154
158
  return {};
155
159
  }
156
- const view = this.map.getView();
160
+ const view = mapInternal.getView();
157
161
  return {
158
162
  center: view.getCenter(),
159
163
  extent: view.calculateExtent(),
160
164
  pixelRatio: this.engine.pixelRatio,
161
165
  resolution: view.getResolution(),
162
166
  rotation: view.getRotation(),
163
- size: this.map.getSize(),
167
+ size: mapInternal.getSize(),
164
168
  visible: this.getVisible(),
165
169
  zoom: view.getZoom(),
166
170
  };
@@ -182,7 +186,7 @@ class RealtimeLayer extends MobilityLayerMixin(Layer) {
182
186
  return Promise.resolve([]);
183
187
  }
184
188
  return this.engine.api
185
- .getFullTrajectory(id, this.engine.mode, this.engine.getGeneralizationLevelByZoom(Math.floor(((_d = (_c = this.map) === null || _c === void 0 ? void 0 : _c.getView()) === null || _d === void 0 ? void 0 : _d.getZoom()) || 0)))
189
+ .getFullTrajectory(id, this.engine.mode, this.engine.getGeneralizationLevelByZoom(Math.floor(((_d = (_c = this.getMapInternal()) === null || _c === void 0 ? void 0 : _c.getView()) === null || _d === void 0 ? void 0 : _d.getZoom()) || 0)))
186
190
  .then((data) => {
187
191
  var _a, _b, _c, _d, _e;
188
192
  const fullTrajectory = data.content;
@@ -236,11 +240,22 @@ class RealtimeLayer extends MobilityLayerMixin(Layer) {
236
240
  }
237
241
  this.highlightTrajectory(id);
238
242
  }
243
+ setMapInternal(map) {
244
+ if (map) {
245
+ super.setMapInternal(map);
246
+ this.attachToMap();
247
+ }
248
+ else {
249
+ this.detachFromMap();
250
+ super.setMapInternal(map);
251
+ }
252
+ }
239
253
  shouldRender() {
254
+ var _a, _b;
240
255
  return this.allowRenderWhenAnimating
241
256
  ? false
242
- : this.map.getView().getAnimating() ||
243
- this.map.getView().getInteracting();
257
+ : ((_a = this.getMapInternal()) === null || _a === void 0 ? void 0 : _a.getView().getAnimating()) ||
258
+ ((_b = this.getMapInternal()) === null || _b === void 0 ? void 0 : _b.getView().getInteracting());
244
259
  }
245
260
  /**
246
261
  * Start the rendering.
@@ -1,7 +1,6 @@
1
1
  import { Coordinate } from 'ol/coordinate';
2
2
  import { LayerGetFeatureInfoResponse } from '../../types';
3
- import { MobilityLayerOptions } from '../mixins/MobilityLayerMixin';
4
- import Layer from './Layer';
3
+ import Layer, { MobilityLayerOptions } from './Layer';
5
4
  /**
6
5
  * @deprecated
7
6
  */
@@ -7,19 +7,20 @@ class VectorLayer extends Layer {
7
7
  * @deprecated
8
8
  */
9
9
  clone(newOptions) {
10
- return new VectorLayer(Object.assign(Object.assign({}, this.options), newOptions));
10
+ return new VectorLayer(Object.assign(Object.assign({}, this.get('options')), newOptions));
11
11
  }
12
12
  /**
13
13
  * @deprecated
14
14
  */
15
15
  getFeatureInfoAtCoordinate(coordinate) {
16
16
  let features = [];
17
- if (this.map) {
18
- const pixel = this.map.getPixelFromCoordinate(coordinate);
17
+ const mapInternal = this.getMapInternal();
18
+ if (mapInternal) {
19
+ const pixel = mapInternal.getPixelFromCoordinate(coordinate);
19
20
  features =
20
- this.map.getFeaturesAtPixel(pixel, {
21
- hitTolerance: this.hitTolerance || 5,
22
- layerFilter: (l) => l === this.olLayer,
21
+ mapInternal.getFeaturesAtPixel(pixel, {
22
+ hitTolerance: this.get('hitTolerance') || 5,
23
+ layerFilter: (l) => l === this,
23
24
  }) || [];
24
25
  }
25
26
  return Promise.resolve({
@@ -32,16 +32,24 @@ const dashedRedLine = new Style({
32
32
  }),
33
33
  });
34
34
  const routingStyle = (feature, resolution) => {
35
+ var _a;
35
36
  const minResolution = feature.get('minResolution');
36
37
  const maxResolution = feature.get('maxResolution');
37
38
  const inRange = resolution <= minResolution && resolution > maxResolution;
38
39
  if (minResolution && maxResolution && !inRange) {
39
40
  return [];
40
41
  }
42
+ const zIndex = ((_a = feature === null || feature === void 0 ? void 0 : feature.getGeometry()) === null || _a === void 0 ? void 0 : _a.getType()) === 'Point' ? 100 : 0;
43
+ let styles = [blackBorder, redLine];
41
44
  const mot = feature.get('mot');
42
- if (mot !== 'foot') {
43
- return [blackBorder, redLine];
45
+ if (mot === 'foot') {
46
+ styles = [dashedRedLine];
44
47
  }
45
- return [dashedRedLine];
48
+ styles = styles.map((style) => {
49
+ const tmp = style.clone();
50
+ tmp.setZIndex(zIndex);
51
+ return tmp;
52
+ });
53
+ return styles;
46
54
  };
47
55
  export default routingStyle;
@@ -0,0 +1,10 @@
1
+ import { Layer } from 'ol/layer';
2
+ import { MobilityLayerOptions } from '../layers/Layer';
3
+ /**
4
+ * obj function defines properties taht were used in mbt v2.
5
+ * They are all marked als deprecated.
6
+ * @param obj
7
+ * @returns
8
+ */
9
+ declare const defineDeprecatedProperties: (obj: Layer, options: MobilityLayerOptions) => void;
10
+ export default defineDeprecatedProperties;
@@ -0,0 +1,180 @@
1
+ import debounce from 'lodash.debounce';
2
+ let deprecated = () => { };
3
+ if (typeof window !== 'undefined' &&
4
+ new URLSearchParams(window.location.search).get('deprecated')) {
5
+ deprecated = debounce((message) => {
6
+ // eslint-disable-next-line no-console
7
+ console.warn(message);
8
+ }, 1000);
9
+ }
10
+ const onChildrenChange = (layer, oldValue) => {
11
+ // Set the parent property
12
+ (oldValue || []).forEach((child) => {
13
+ child.set('parent', undefined);
14
+ });
15
+ (layer.get('children') || []).forEach((child) => {
16
+ child.set('parent', this);
17
+ });
18
+ };
19
+ /**
20
+ * obj function defines properties taht were used in mbt v2.
21
+ * They are all marked als deprecated.
22
+ * @param obj
23
+ * @returns
24
+ */
25
+ const defineDeprecatedProperties = (obj, options) => {
26
+ if (options.properties) {
27
+ deprecated("Deprecated. Don't use properties options. Pass the values directly in options object.");
28
+ obj.setProperties(options.properties);
29
+ }
30
+ // Update parent property
31
+ obj.on('propertychange', (evt) => {
32
+ if (evt.key === 'children') {
33
+ onChildrenChange(evt.target, evt.oldValue);
34
+ }
35
+ if (evt.key === 'map') {
36
+ const map = evt.target.get(evt.key);
37
+ if (map) {
38
+ (evt.target.get('children') || []).forEach((child) => {
39
+ map.addLayer(child);
40
+ });
41
+ }
42
+ else if (evt.oldValue) {
43
+ (evt.target.get('children') || []).forEach((child) => {
44
+ evt.oldValue.removeLayer(child);
45
+ });
46
+ }
47
+ }
48
+ });
49
+ // Save options for cloning
50
+ obj.set('options', options);
51
+ obj.set('children', options.children || []); // Trigger the on children change event
52
+ Object.defineProperties(obj, {
53
+ children: {
54
+ /** @deprecated */
55
+ get: () => {
56
+ deprecated("Layer.children is deprecated. Use the Layer.get('children') method instead.");
57
+ return obj.get('children') || [];
58
+ },
59
+ /** @deprecated */
60
+ set: (newValue) => {
61
+ deprecated("Layer.children is deprecated. Use the Layer.set('children', children) method instead.");
62
+ obj.set('children', newValue || []);
63
+ },
64
+ },
65
+ copyrights: {
66
+ /** @deprecated */
67
+ get: () => {
68
+ deprecated('Layer.copyrights is deprecated. Get the attributions from the source object');
69
+ return obj.get('copyrights');
70
+ },
71
+ /** @deprecated */
72
+ set: (newCopyrights) => {
73
+ deprecated('Layer.copyrights is deprecated. Set the attributions to the source object.');
74
+ const arrValue = newCopyrights && !Array.isArray(newCopyrights)
75
+ ? [newCopyrights]
76
+ : newCopyrights;
77
+ obj.set('copyrights', arrValue || []);
78
+ },
79
+ },
80
+ disabled: {
81
+ /** @deprecated */
82
+ get() {
83
+ deprecated("Layer.disabled is deprecated. Use the Layer.get('disabled') method instead.");
84
+ return obj.get('disabled');
85
+ },
86
+ /** @deprecated */
87
+ set(newValue) {
88
+ deprecated("Layer.disabled is deprecated. Use the Layer.set('disabled', newValue) method instead.");
89
+ obj.set('disabled', newValue);
90
+ },
91
+ },
92
+ group: {
93
+ /** @deprecated */
94
+ get() {
95
+ deprecated("Layer.group is deprecated. Use the Layer.get('group') method instead.");
96
+ return obj.get('group');
97
+ },
98
+ },
99
+ hitTolerance: {
100
+ /** @deprecated */
101
+ get() {
102
+ deprecated('Layer.hitTolerance is deprecated. Pass the hitTolerance when you request the features.');
103
+ return obj.get('hitTolerance') || 5;
104
+ },
105
+ /** @deprecated */
106
+ set(newValue) {
107
+ deprecated('Layer.hitTolerance is deprecated. Pass the hitTolerance when you request the features.');
108
+ obj.set('hitTolerance', newValue);
109
+ },
110
+ },
111
+ key: {
112
+ /** @deprecated */
113
+ get() {
114
+ deprecated('Layer.key is deprecated. Use the Layer.get("key") method instead.');
115
+ return obj.get('key') || obj.get('name');
116
+ },
117
+ },
118
+ map: {
119
+ /** @deprecated */
120
+ get() {
121
+ deprecated('Layer.map is deprecated. Use the Layer.get("map") method instead.');
122
+ return obj.getMapInternal();
123
+ },
124
+ },
125
+ name: {
126
+ /** @deprecated */
127
+ get() {
128
+ deprecated("Layer.name is deprecated. Use the Layer.get('name') method instead.");
129
+ return obj.get('name');
130
+ },
131
+ },
132
+ olLayer: {
133
+ /** @deprecated */
134
+ get() {
135
+ deprecated("Layer.olLayer is deprecated. mobility-toolbox-js/ol layers inherits now from ol/layer/Layer class. obj getter is only a redirect to the current 'this' object.");
136
+ return obj;
137
+ },
138
+ /** @deprecated */
139
+ set() {
140
+ deprecated('Layer.olLayer is deprecated. mobility-toolbox-js/ol layers inherits now from ol/layer/Layer class. obj setter has no effect.');
141
+ },
142
+ },
143
+ options: {
144
+ /** @deprecated */
145
+ get() {
146
+ deprecated('Layer.options is deprecated. Use the Layer.get("options") method instead.');
147
+ return obj.get('options');
148
+ },
149
+ set(newValue) {
150
+ deprecated('Layer.options is deprecated. Use the Layer.set("options", newValue) method instead.');
151
+ return obj.set('options', newValue);
152
+ },
153
+ },
154
+ parent: {
155
+ /** @deprecated */
156
+ get() {
157
+ deprecated("Layer.parent is deprecated. Use the Layer.get('parent') method instead.");
158
+ return obj.get('parent');
159
+ },
160
+ /** @deprecated */
161
+ set(newValue) {
162
+ deprecated("Layer.parent is deprecated. Use the Layer.set('parent', parent) method instead.");
163
+ obj.set('parent', newValue);
164
+ },
165
+ },
166
+ visible: {
167
+ /** @deprecated */
168
+ get() {
169
+ deprecated('Layer.visible is deprecated. Use the Layer.getVisible() method instead.');
170
+ return obj.getVisible();
171
+ },
172
+ /** @deprecated */
173
+ set(newValue) {
174
+ deprecated('Layer.visible is deprecated. Use the Layer.setVisible(newValue) method instead.');
175
+ obj.setVisible(newValue);
176
+ },
177
+ },
178
+ });
179
+ };
180
+ export default defineDeprecatedProperties;
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.36",
5
+ "version": "3.0.0-beta.38",
6
6
  "homepage": "https://mobility-toolbox-js.geops.io/",
7
7
  "exports": {
8
8
  ".": "./index.js",
@@ -26,8 +26,8 @@
26
26
  "devDependencies": {
27
27
  "@babel/preset-env": "^7.26.0",
28
28
  "@babel/preset-typescript": "^7.26.0",
29
- "@commitlint/cli": "19.5.0",
30
- "@commitlint/config-conventional": "19.5.0",
29
+ "@commitlint/cli": "19.6.0",
30
+ "@commitlint/config-conventional": "19.6.0",
31
31
  "@geops/eslint-config-react": "^1.2.0",
32
32
  "@types/geojson": "7946.0.14",
33
33
  "@types/lodash": "^4.17.13",
@@ -37,9 +37,9 @@
37
37
  "@types/offscreencanvas": "2019.7.3",
38
38
  "@types/topojson": "3.2.6",
39
39
  "@types/uuid": "10.0.0",
40
- "@typescript-eslint/eslint-plugin": "8.14.0",
41
- "@typescript-eslint/parser": "8.14.0",
42
- "cypress": "13.15.2",
40
+ "@typescript-eslint/eslint-plugin": "8.15.0",
41
+ "@typescript-eslint/parser": "8.15.0",
42
+ "cypress": "13.16.0",
43
43
  "esbuild": "0.24.0",
44
44
  "esdoc": "1.1.0",
45
45
  "esdoc-ecmascript-proposal-plugin": "1.0.0",
@@ -56,7 +56,7 @@
56
56
  "eslint-plugin-prettier": "5.2.1",
57
57
  "eslint-plugin-react": "7.37.2",
58
58
  "fixpack": "4.0.0",
59
- "husky": "9.1.6",
59
+ "husky": "9.1.7",
60
60
  "is-ci": "3.0.1",
61
61
  "jest": "29.7.0",
62
62
  "jest-canvas-mock": "2.5.2",
@@ -80,9 +80,10 @@
80
80
  "stylelint": "16.10.0",
81
81
  "stylelint-config-recommended-scss": "14.1.0",
82
82
  "stylelint-config-standard": "36.0.1",
83
- "stylelint-scss": "6.9.0",
83
+ "stylelint-scss": "6.10.0",
84
84
  "ts-jest": "^29.2.5",
85
- "typescript": "5.6.3"
85
+ "typescript": "5.6.3",
86
+ "vite": "^5.4.11"
86
87
  },
87
88
  "scripts": {
88
89
  "apidoc": "esdoc && cp apidoc/index.json doc/src/components/Esdoc",
@@ -95,9 +96,10 @@
95
96
  "cy:test:chrome": "yarn build && start-server-and-test start http://localhost:3000 'cypress run --browser chrome'",
96
97
  "cy:test:edge": "yarn build && start-server-and-test start http://localhost:3000 'cypress run --browser edge'",
97
98
  "cy:test:firefox": "yarn build && start-server-and-test start http://localhost:3000 'cypress run --browser firefox'",
98
- "dev": "yarn clean && yarn build && yarn apidoc && yarn dev:examples",
99
- "dev:examples": "yarn clean && yarn build && cd doc && rm -rf node_modules/mobility-toolbox-js && yarn install --force && yarn dev",
99
+ "dev": "vite",
100
100
  "doc": "yarn build && yarn apidoc && cd doc && rm -rf node_modules/mobility-toolbox-js && yarn install --force && yarn build",
101
+ "doc:dev": "yarn clean && yarn build && yarn apidoc && yarn doc:dev:examples",
102
+ "doc:dev:examples": "yarn clean && yarn build && cd doc && rm -rf node_modules/mobility-toolbox-js && yarn install --force && yarn dev",
101
103
  "esbuild": "yarn esbuild:all && yarn esbuild:iife",
102
104
  "esbuild:all": "esbuild src/index.js src/**/*.js src/**/*.ts src/**/**/*.js src/**/**/*.ts --target=chrome100 --outdir=build/ --loader:.js=jsx",
103
105
  "esbuild:iife": "yarn esbuild:iife:unminify && yarn esbuild:iife:minify",
@@ -105,9 +107,6 @@
105
107
  "esbuild:iife:minify": "yarn esbuild:iife:base --minify --outfile=build/mbt.min.js",
106
108
  "esbuild:iife:unminify": "yarn esbuild:iife:base --outfile=build/mbt.js",
107
109
  "format": "prettier --write 'src/**/*.js' 'src/**/*.test.js' && eslint src/**/*.js src/**/*.test.js src/**/*.ts --fix && stylelint 'src/**/*.css' 'src/**/*.scss' --fix --allow-empty-input",
108
- "lib": "REACT_APP_LIB_MODE=1 webpack --mode production",
109
- "lib:dev": "REACT_APP_LIB_MODE=1 webpack --mode development",
110
- "link2": "cmdToAdd=$(node ./scripts/read-pkg-json.js add) && $cmdToAdd && yarn build && cmdToRemove=$(node ./scripts/read-pkg-json.js remove) && $cmdToRemove && cd build && yarn link",
111
110
  "lint": "eslint src/**/*.js src/**/*.ts && stylelint src/**/*.css src/**/*.scss --allow-empty-input",
112
111
  "prepare": "is-ci || husky",
113
112
  "publish:beta": "HUSKY=0 yarn release -- --prerelease beta --skip.changelog && yarn run build && cd build && HUSKY=0 yarn publish --tag beta && git push origin HEAD && git push --tags ",