mobility-toolbox-js 3.0.0-beta.0 → 3.0.0-beta.2

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.
@@ -84,7 +84,7 @@ class MapGlLayer extends MobilityLayerMixin(Layer) {
84
84
  this.loaded = false;
85
85
  this.olListenersKeys.push(
86
86
  // @ts-ignore
87
- (_a = this.map) === null || _a === void 0 ? void 0 : _a.on('change:target', this.loadMbMap));
87
+ (_a = this.map) === null || _a === void 0 ? void 0 : _a.on('change:target', this.loadMbMap.bind(this)));
88
88
  if (!((_b = this.map) === null || _b === void 0 ? void 0 : _b.getTargetElement())) {
89
89
  return;
90
90
  }
@@ -92,7 +92,7 @@ class MapGlLayer extends MobilityLayerMixin(Layer) {
92
92
  // On next change of visibility we load the map
93
93
  this.olListenersKeys.push(
94
94
  // @ts-ignore
95
- this.once('change:visible', this.loadMbMap));
95
+ this.once('change:visible', this.loadMbMap.bind(this)));
96
96
  return;
97
97
  }
98
98
  const container = document.createElement('div');
@@ -103,9 +103,7 @@ class MapGlLayer extends MobilityLayerMixin(Layer) {
103
103
  * A Maplibre map
104
104
  * @type {maplibregl.Map}
105
105
  */
106
- this.mbMap = this.createMap(Object.assign({
107
- // https://maps.geops.io/styles/t7ravic_v2/style.json',
108
- style: this.getStyle(), container }, (((_c = this.options) === null || _c === void 0 ? void 0 : _c.mapOptions) || {})));
106
+ this.mbMap = this.createMap(Object.assign({ style: this.getStyle(), container }, (((_c = this.options) === null || _c === void 0 ? void 0 : _c.mapOptions) || {})));
109
107
  this.mbMap.on('sourcedata', () => {
110
108
  var _a;
111
109
  (_a = this.getSource()) === null || _a === void 0 ? void 0 : _a.refresh(); // Refresh attribution
@@ -156,13 +156,13 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
156
156
  maplibreMap.once('load', this.onLoad);
157
157
  }
158
158
  // Apply the visibiltity when layer's visibility change.
159
- this.olListenersKeys.push(this.on('change:visible', (evt) => {
159
+ this.olListenersKeys.push(
160
+ // @ts-expect-error 'load' is a custom event form mobility-toolbox-js
161
+ this.maplibreLayer.on('load', this.onLoad.bind(this)), this.on('change:visible', (evt) => {
160
162
  // Once the map is loaded we can apply visiblity without waiting
161
163
  // the style. Maplibre take care of the application of style changes.
162
164
  this.applyLayoutVisibility(evt);
163
- }),
164
- // @ts-expect-error 'load' is a custom event form mobility-toolbox-js
165
- this.maplibreLayer.on('load', this.onLoad), this.on('propertychange', (evt) => {
165
+ }), this.on('propertychange', (evt) => {
166
166
  if (/(sources|layers|layersFilter|maplibreLayer|beforeId|)/.test(evt.key)) {
167
167
  this.detachFromMap();
168
168
  this.attachToMap(map);
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.0",
5
+ "version": "3.0.0-beta.2",
6
6
  "homepage": "https://mobility-toolbox-js.geops.io/",
7
7
  "module": "index.js",
8
8
  "exports": {
@@ -85,7 +85,7 @@
85
85
  "scripts": {
86
86
  "apidoc": "esdoc && cp apidoc/index.json doc/src/components/Esdoc",
87
87
  "build": "yarn build:tsc && yarn esbuild:iife",
88
- "build:tsc": "rm -rf build && yarn tsc && cp package.json build/ && cp -R src/types build/ && find build -type f -name '*.test.*' -delete",
88
+ "build:tsc": "rm -rf build && yarn tsc && cp package.json build/ && cp README.md build/ && cp LICENSE build/ && cp -R src/types build/ && find build -type f -name '*.test.*' -delete",
89
89
  "clean": "rm -rf .next && rm -rf doc/.next",
90
90
  "coverage": "yarn test --watchAll=false --coverage --coverageDirectory=coverage",
91
91
  "cy:open": "cypress open",