mobility-toolbox-js 3.1.0-beta.1 → 3.1.0

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.
@@ -11,9 +11,7 @@ export type MobilityLayerOptions = {
11
11
  key?: string;
12
12
  map?: Map;
13
13
  name?: string;
14
- properties?: Record<string, any>;
15
- visible?: boolean;
16
- } & Options & Record<string, any>;
14
+ } & Options & Record<string, unknown>;
17
15
  /**
18
16
  * An OpenLayers layer here only for backward compatibility v2.
19
17
  * @deprecated Use an OpenLayers Layer instead.
@@ -7,6 +7,7 @@ import { ObjectEvent } from 'ol/Object';
7
7
  import { FilterFunction } from '../../common/typedefs';
8
8
  import { LayerGetFeatureInfoResponse } from '../../types';
9
9
  import MaplibreStyleLayerRenderer from '../renderers/MaplibreStyleLayerRenderer';
10
+ import { MobilityLayerOptions } from './Layer';
10
11
  import MaplibreLayer, { MaplibreLayerOptions } from './MaplibreLayer';
11
12
  export type MaplibreStyleLayerOptions = {
12
13
  beforeId?: string;
@@ -14,7 +15,7 @@ export type MaplibreStyleLayerOptions = {
14
15
  layersFilter?: FilterFunction;
15
16
  maplibreLayer?: MaplibreLayer;
16
17
  queryRenderedLayersFilter?: FilterFunction;
17
- } & MaplibreLayerOptions;
18
+ } & MaplibreLayerOptions & MobilityLayerOptions;
18
19
  /**
19
20
  * Layer that helps show/hide a specific subset of style layers of a [MaplibreLayer](./MaplibreLayer.js~MaplibreLayer.html).
20
21
  *
@@ -128,7 +128,7 @@ class MaplibreStyleLayer extends Layer {
128
128
  /** Manage renamed property for backward compatibility with v2 */
129
129
  if (options.mapboxLayer) {
130
130
  deprecated('options.mapboxLayer is deprecated. Use options.maplibreLayer instead.');
131
- // eslint-disable-next-line no-param-reassign
131
+ // @ts-expect-error - mapboxLayer is deprecated
132
132
  options.maplibreLayer = options.mapboxLayer;
133
133
  // eslint-disable-next-line no-param-reassign
134
134
  delete options.mapboxLayer;
@@ -12,11 +12,12 @@ import RealtimeEngine, { RealtimeEngineOptions } from '../../common/utils/Realti
12
12
  import { RealtimeAPI } from '../../maplibre';
13
13
  import { RealtimeMode, RealtimeRenderState, RealtimeStopSequence, RealtimeTrainId, ViewState } from '../../types';
14
14
  import RealtimeLayerRenderer from '../renderers/RealtimeLayerRenderer';
15
+ import { MobilityLayerOptions } from './Layer';
15
16
  export type RealtimeLayerOptions = {
16
17
  allowRenderWhenAnimating?: boolean;
17
18
  fullTrajectoryStyle?: (feature: FeatureLike, resolution: number, options: any) => void;
18
19
  maxNbFeaturesRequested?: number;
19
- } & RealtimeEngineOptions;
20
+ } & MobilityLayerOptions & RealtimeEngineOptions;
20
21
  /**
21
22
  * An OpenLayers layer able to display data from the [geOps Realtime API](https://developer.geops.io/apis/realtime/).
22
23
  *
@@ -6,4 +6,5 @@ export default class MaplibreLayerRenderer extends MapLibreLayerRenderer {
6
6
  constructor(layer: MaplibreLayer);
7
7
  renderFrame(frameState: FrameState): HTMLElement;
8
8
  setIsReady(): void;
9
+ updateReadyState(): void;
9
10
  }
@@ -13,20 +13,20 @@ export default class MaplibreLayerRenderer extends MapLibreLayerRenderer {
13
13
  this.ignoreNextRender = false;
14
14
  }
15
15
  renderFrame(frameState) {
16
- var _a, _b;
17
16
  const layer = this.getLayer();
18
17
  const { mapLibreMap } = layer;
19
18
  const map = layer.getMapInternal();
20
- (_b = (_a = this.getLayer()) === null || _a === void 0 ? void 0 : _a.mapLibreMap) === null || _b === void 0 ? void 0 : _b.off('idle', this.setIsReady);
21
19
  if (!layer || !map || !mapLibreMap) {
22
20
  // @ts-expect-error - can return null
23
21
  return null;
24
22
  }
25
- if (this.ignoreNextRender) {
23
+ if (this.ready && this.ignoreNextRender) {
26
24
  this.ignoreNextRender = false;
27
25
  return mapLibreMap === null || mapLibreMap === void 0 ? void 0 : mapLibreMap.getContainer();
28
26
  }
29
27
  this.ready = false;
28
+ this.ignoreNextRender = false;
29
+ this.updateReadyState();
30
30
  const container = super.renderFrame(frameState);
31
31
  // Mark the renderer as ready when the map is idle
32
32
  mapLibreMap === null || mapLibreMap === void 0 ? void 0 : mapLibreMap.once('idle', this.setIsReady);
@@ -39,4 +39,9 @@ export default class MaplibreLayerRenderer extends MapLibreLayerRenderer {
39
39
  this.getLayer().changed();
40
40
  }
41
41
  }
42
+ updateReadyState() {
43
+ var _a, _b, _c, _d;
44
+ (_b = (_a = this.getLayer()) === null || _a === void 0 ? void 0 : _a.mapLibreMap) === null || _b === void 0 ? void 0 : _b.off('idle', this.setIsReady);
45
+ (_d = (_c = this.getLayer()) === null || _c === void 0 ? void 0 : _c.mapLibreMap) === null || _d === void 0 ? void 0 : _d.once('idle', this.setIsReady);
46
+ }
42
47
  }
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.1.0-beta.1",
5
+ "version": "3.1.0",
6
6
  "homepage": "https://mobility-toolbox-js.geops.io/",
7
7
  "exports": {
8
8
  ".": "./index.js",
@@ -26,7 +26,7 @@
26
26
  "devDependencies": {
27
27
  "@babel/preset-env": "^7.26.0",
28
28
  "@babel/preset-typescript": "^7.26.0",
29
- "@commitlint/cli": "19.6.0",
29
+ "@commitlint/cli": "19.6.1",
30
30
  "@commitlint/config-conventional": "19.6.0",
31
31
  "@geops/eslint-config-react": "^1.3.2",
32
32
  "@types/geojson": "7946.0.15",
@@ -37,8 +37,8 @@
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.18.0",
41
- "@typescript-eslint/parser": "8.18.0",
40
+ "@typescript-eslint/eslint-plugin": "8.18.1",
41
+ "@typescript-eslint/parser": "8.18.1",
42
42
  "cypress": "13.16.1",
43
43
  "esbuild": "0.24.0",
44
44
  "esdoc": "1.1.0",
@@ -77,7 +77,7 @@
77
77
  "sort-json": "2.0.1",
78
78
  "standard-version": "9.5.0",
79
79
  "start-server-and-test": "2.0.9",
80
- "stylelint": "16.11.0",
80
+ "stylelint": "16.12.0",
81
81
  "stylelint-config-recommended-scss": "14.1.0",
82
82
  "stylelint-config-standard": "36.0.1",
83
83
  "stylelint-scss": "6.10.0",