maplibre-gl 3.5.1 → 3.5.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.
@@ -1,4 +1,4 @@
1
- /* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v3.5.1/LICENSE.txt */
1
+ /* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v3.5.2/LICENSE.txt */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -11866,7 +11866,6 @@ function serialize(input, transferables) {
11866
11866
  klass.serialize(input, transferables) : {};
11867
11867
  if (!klass.serialize) {
11868
11868
  for (const key in input) {
11869
- // any cast due to https://github.com/facebook/flow/issues/5393
11870
11869
  if (!input.hasOwnProperty(key))
11871
11870
  continue; // eslint-disable-line no-prototype-builtins
11872
11871
  if (registry[name].omit.indexOf(key) >= 0)
@@ -29180,8 +29179,8 @@ class Actor {
29180
29179
  if (callback) {
29181
29180
  this.callbacks[id] = callback;
29182
29181
  }
29183
- const buffers = isSafari(this.globalScope) ? undefined : [];
29184
- this.target.postMessage({
29182
+ const buffers = [];
29183
+ const message = {
29185
29184
  id,
29186
29185
  type,
29187
29186
  hasCallback: !!callback,
@@ -29189,19 +29188,21 @@ class Actor {
29189
29188
  mustQueue,
29190
29189
  sourceMapId: this.mapId,
29191
29190
  data: serialize(data, buffers)
29192
- }, buffers);
29191
+ };
29192
+ this.target.postMessage(message, { transfer: buffers });
29193
29193
  return {
29194
29194
  cancel: () => {
29195
29195
  if (callback) {
29196
29196
  // Set the callback to null so that it never fires after the request is aborted.
29197
29197
  delete this.callbacks[id];
29198
29198
  }
29199
- this.target.postMessage({
29199
+ const cancelMessage = {
29200
29200
  id,
29201
29201
  type: '<cancel>',
29202
29202
  targetMapId,
29203
29203
  sourceMapId: this.mapId
29204
- });
29204
+ };
29205
+ this.target.postMessage(cancelMessage);
29205
29206
  }
29206
29207
  };
29207
29208
  }
@@ -29223,17 +29224,18 @@ class Actor {
29223
29224
  }
29224
29225
  else {
29225
29226
  let completed = false;
29226
- const buffers = isSafari(this.globalScope) ? undefined : [];
29227
+ const buffers = [];
29227
29228
  const done = task.hasCallback ? (err, data) => {
29228
29229
  completed = true;
29229
29230
  delete this.cancelCallbacks[id];
29230
- this.target.postMessage({
29231
+ const responseMessage = {
29231
29232
  id,
29232
29233
  type: '<response>',
29233
29234
  sourceMapId: this.mapId,
29234
29235
  error: err ? serialize(err) : null,
29235
29236
  data: serialize(data, buffers)
29236
- }, buffers);
29237
+ };
29238
+ this.target.postMessage(responseMessage, { transfer: buffers });
29237
29239
  } : (_) => {
29238
29240
  completed = true;
29239
29241
  };
@@ -29243,7 +29245,7 @@ class Actor {
29243
29245
  // task.type == 'loadTile', 'removeTile', etc.
29244
29246
  callback = this.parent[task.type](task.sourceMapId, params, done);
29245
29247
  }
29246
- else if (this.parent.getWorkerSource) {
29248
+ else if ('getWorkerSource' in this.parent) {
29247
29249
  // task.type == sourcetype.method
29248
29250
  const keys = task.type.split('.');
29249
29251
  const scope = this.parent.getWorkerSource(task.sourceMapId, keys[0], params.source);
@@ -34271,34 +34273,11 @@ function applySourceDiff(updateable, diff, promoteId) {
34271
34273
  }
34272
34274
  }
34273
34275
 
34274
- function loadGeoJSONTile(params, callback) {
34275
- const canonical = params.tileID.canonical;
34276
- if (!this._geoJSONIndex) {
34277
- return callback(null, null); // we couldn't load the file
34278
- }
34279
- const geoJSONTile = this._geoJSONIndex.getTile(canonical.z, canonical.x, canonical.y);
34280
- if (!geoJSONTile) {
34281
- return callback(null, null); // nothing in the given tile
34282
- }
34283
- const geojsonWrapper = new GeoJSONWrapper$2(geoJSONTile.features);
34284
- // Encode the geojson-vt tile into binary vector tile form. This
34285
- // is a convenience that allows `FeatureIndex` to operate the same way
34286
- // across `VectorTileSource` and `GeoJSONSource` data.
34287
- let pbf = vtpbf(geojsonWrapper);
34288
- if (pbf.byteOffset !== 0 || pbf.byteLength !== pbf.buffer.byteLength) {
34289
- // Compatibility with node Buffer (https://github.com/mapbox/pbf/issues/35)
34290
- pbf = new Uint8Array(pbf);
34291
- }
34292
- callback(null, {
34293
- vectorTile: geojsonWrapper,
34294
- rawData: pbf.buffer
34295
- });
34296
- }
34297
34276
  /**
34298
34277
  * The {@link WorkerSource} implementation that supports {@link GeoJSONSource}.
34299
34278
  * This class is designed to be easily reused to support custom source types
34300
34279
  * for data formats that can be parsed/converted into an in-memory GeoJSON
34301
- * representation. To do so, create it with
34280
+ * representation. To do so, create it with
34302
34281
  * `new GeoJSONWorkerSource(actor, layerIndex, customLoadGeoJSONFunction)`.
34303
34282
  * For a full example, see [mapbox-gl-topojson](https://github.com/developmentseed/mapbox-gl-topojson).
34304
34283
  */
@@ -34309,7 +34288,7 @@ class GeoJSONWorkerSource extends VectorTileWorkerSource {
34309
34288
  * See {@link GeoJSONWorkerSource#loadGeoJSON}.
34310
34289
  */
34311
34290
  constructor(actor, layerIndex, availableImages, loadGeoJSON) {
34312
- super(actor, layerIndex, availableImages, loadGeoJSONTile);
34291
+ super(actor, layerIndex, availableImages);
34313
34292
  this._dataUpdateable = new Map();
34314
34293
  /**
34315
34294
  * Fetch and parse GeoJSON according to the given params. Calls `callback`
@@ -34358,10 +34337,34 @@ class GeoJSONWorkerSource extends VectorTileWorkerSource {
34358
34337
  }
34359
34338
  return { cancel: () => { } };
34360
34339
  };
34340
+ this.loadVectorData = this.loadGeoJSONTile;
34361
34341
  if (loadGeoJSON) {
34362
34342
  this.loadGeoJSON = loadGeoJSON;
34363
34343
  }
34364
34344
  }
34345
+ loadGeoJSONTile(params, callback) {
34346
+ const canonical = params.tileID.canonical;
34347
+ if (!this._geoJSONIndex) {
34348
+ return callback(null, null); // we couldn't load the file
34349
+ }
34350
+ const geoJSONTile = this._geoJSONIndex.getTile(canonical.z, canonical.x, canonical.y);
34351
+ if (!geoJSONTile) {
34352
+ return callback(null, null); // nothing in the given tile
34353
+ }
34354
+ const geojsonWrapper = new GeoJSONWrapper$2(geoJSONTile.features);
34355
+ // Encode the geojson-vt tile into binary vector tile form. This
34356
+ // is a convenience that allows `FeatureIndex` to operate the same way
34357
+ // across `VectorTileSource` and `GeoJSONSource` data.
34358
+ let pbf = vtpbf(geojsonWrapper);
34359
+ if (pbf.byteOffset !== 0 || pbf.byteLength !== pbf.buffer.byteLength) {
34360
+ // Compatibility with node Buffer (https://github.com/mapbox/pbf/issues/35)
34361
+ pbf = new Uint8Array(pbf);
34362
+ }
34363
+ callback(null, {
34364
+ vectorTile: geojsonWrapper,
34365
+ rawData: pbf.buffer
34366
+ });
34367
+ }
34365
34368
  /**
34366
34369
  * Fetches (if appropriate), parses, and index geojson data into tiles. This
34367
34370
  * preparatory method must be called before {@link GeoJSONWorkerSource#loadTile}
@@ -34643,12 +34646,12 @@ class Worker {
34643
34646
  }
34644
34647
  return layerIndexes;
34645
34648
  }
34646
- getWorkerSource(mapId, type, source) {
34649
+ getWorkerSource(mapId, sourceType, sourceName) {
34647
34650
  if (!this.workerSources[mapId])
34648
34651
  this.workerSources[mapId] = {};
34649
- if (!this.workerSources[mapId][type])
34650
- this.workerSources[mapId][type] = {};
34651
- if (!this.workerSources[mapId][type][source]) {
34652
+ if (!this.workerSources[mapId][sourceType])
34653
+ this.workerSources[mapId][sourceType] = {};
34654
+ if (!this.workerSources[mapId][sourceType][sourceName]) {
34652
34655
  // use a wrapped actor so that we can attach a target mapId param
34653
34656
  // to any messages invoked by the WorkerSource
34654
34657
  const actor = {
@@ -34656,9 +34659,9 @@ class Worker {
34656
34659
  this.actor.send(type, data, callback, mapId);
34657
34660
  }
34658
34661
  };
34659
- this.workerSources[mapId][type][source] = new this.workerSourceTypes[type](actor, this.getLayerIndex(mapId), this.getAvailableImages(mapId));
34662
+ this.workerSources[mapId][sourceType][sourceName] = new this.workerSourceTypes[sourceType](actor, this.getLayerIndex(mapId), this.getAvailableImages(mapId));
34660
34663
  }
34661
- return this.workerSources[mapId][type][source];
34664
+ return this.workerSources[mapId][sourceType][sourceName];
34662
34665
  }
34663
34666
  getDEMWorkerSource(mapId, source) {
34664
34667
  if (!this.demWorkerSources[mapId])
@@ -34681,7 +34684,7 @@ define(['./shared'], (function (performance) { 'use strict';
34681
34684
 
34682
34685
  var name = "maplibre-gl";
34683
34686
  var description = "BSD licensed community fork of mapbox-gl, a WebGL interactive maps library";
34684
- var version$2 = "3.5.1";
34687
+ var version$2 = "3.5.2";
34685
34688
  var main = "dist/maplibre-gl.js";
34686
34689
  var style = "dist/maplibre-gl.css";
34687
34690
  var license = "BSD-3-Clause";
@@ -34700,12 +34703,12 @@ var dependencies = {
34700
34703
  "@mapbox/unitbezier": "^0.0.1",
34701
34704
  "@mapbox/vector-tile": "^1.3.1",
34702
34705
  "@mapbox/whoots-js": "^3.1.0",
34703
- "@maplibre/maplibre-gl-style-spec": "^19.3.2",
34704
- "@types/geojson": "^7946.0.11",
34705
- "@types/mapbox__point-geometry": "^0.1.2",
34706
- "@types/mapbox__vector-tile": "^1.3.1",
34707
- "@types/pbf": "^3.0.3",
34708
- "@types/supercluster": "^7.1.1",
34706
+ "@maplibre/maplibre-gl-style-spec": "^19.3.3",
34707
+ "@types/geojson": "^7946.0.12",
34708
+ "@types/mapbox__point-geometry": "^0.1.3",
34709
+ "@types/mapbox__vector-tile": "^1.3.3",
34710
+ "@types/pbf": "^3.0.4",
34711
+ "@types/supercluster": "^7.1.2",
34709
34712
  earcut: "^2.2.4",
34710
34713
  "geojson-vt": "^3.2.1",
34711
34714
  "gl-matrix": "^3.4.3",
@@ -34732,41 +34735,42 @@ var devDependencies = {
34732
34735
  "@types/benchmark": "^2.1.3",
34733
34736
  "@types/cssnano": "^5.0.0",
34734
34737
  "@types/d3": "^7.4.1",
34735
- "@types/diff": "^5.0.6",
34736
- "@types/earcut": "^2.1.2",
34737
- "@types/eslint": "^8.44.4",
34738
- "@types/gl": "^6.0.3",
34738
+ "@types/diff": "^5.0.7",
34739
+ "@types/earcut": "^2.1.3",
34740
+ "@types/eslint": "^8.44.6",
34741
+ "@types/geojson-vt": "3.2.3",
34742
+ "@types/gl": "^6.0.4",
34739
34743
  "@types/glob": "^8.1.0",
34740
34744
  "@types/jest": "^29.5.3",
34741
34745
  "@types/jsdom": "^21.1.3",
34742
- "@types/minimist": "^1.2.3",
34743
- "@types/murmurhash-js": "^1.0.4",
34746
+ "@types/minimist": "^1.2.4",
34747
+ "@types/murmurhash-js": "^1.0.5",
34744
34748
  "@types/nise": "^1.4.2",
34745
34749
  "@types/node": "^20.8.3",
34746
- "@types/offscreencanvas": "^2019.7.1",
34750
+ "@types/offscreencanvas": "^2019.7.2",
34747
34751
  "@types/pixelmatch": "^5.2.4",
34748
- "@types/pngjs": "^6.0.2",
34749
- "@types/react": "^18.2.28",
34752
+ "@types/pngjs": "^6.0.3",
34753
+ "@types/react": "^18.2.31",
34750
34754
  "@types/react-dom": "^18.2.13",
34751
- "@types/request": "^2.48.10",
34752
- "@types/shuffle-seed": "^1.1.0",
34755
+ "@types/request": "^2.48.11",
34756
+ "@types/shuffle-seed": "^1.1.1",
34753
34757
  "@types/window-or-global": "^1.0.4",
34754
- "@typescript-eslint/eslint-plugin": "^6.7.5",
34755
- "@typescript-eslint/parser": "^6.7.5",
34758
+ "@typescript-eslint/eslint-plugin": "^6.8.0",
34759
+ "@typescript-eslint/parser": "^6.8.0",
34756
34760
  address: "^2.0.1",
34757
34761
  benchmark: "^2.1.4",
34758
34762
  canvas: "^2.11.2",
34759
34763
  cssnano: "^6.0.1",
34760
34764
  d3: "^7.8.5",
34761
34765
  "d3-queue": "^3.0.7",
34762
- "devtools-protocol": "^0.0.1209236",
34766
+ "devtools-protocol": "^0.0.1212569",
34763
34767
  diff: "^5.1.0",
34764
34768
  "dts-bundle-generator": "^8.0.1",
34765
- eslint: "^8.51.0",
34769
+ eslint: "^8.52.0",
34766
34770
  "eslint-config-mourner": "^3.0.0",
34767
34771
  "eslint-plugin-html": "^7.1.0",
34768
34772
  "eslint-plugin-import": "^2.28.1",
34769
- "eslint-plugin-jest": "^27.4.2",
34773
+ "eslint-plugin-jest": "^27.4.3",
34770
34774
  "eslint-plugin-react": "^7.33.2",
34771
34775
  "eslint-plugin-tsdoc": "0.2.17",
34772
34776
  expect: "^29.7.0",
@@ -34780,7 +34784,7 @@ var devDependencies = {
34780
34784
  "json-stringify-pretty-compact": "^4.0.0",
34781
34785
  minimist: "^1.2.8",
34782
34786
  "mock-geolocation": "^1.0.11",
34783
- nise: "^5.1.4",
34787
+ nise: "^5.1.5",
34784
34788
  "npm-font-open-sans": "^1.1.0",
34785
34789
  "npm-run-all": "^4.1.5",
34786
34790
  "pdf-merger-js": "^4.3.0",
@@ -34800,7 +34804,7 @@ var devDependencies = {
34800
34804
  "shuffle-seed": "^1.1.6",
34801
34805
  "source-map-explorer": "^2.5.3",
34802
34806
  st: "^3.0.0",
34803
- stylelint: "^15.10.3",
34807
+ stylelint: "^15.11.0",
34804
34808
  "stylelint-config-standard": "^34.0.0",
34805
34809
  "ts-jest": "^29.1.1",
34806
34810
  "ts-node": "^10.9.1",
@@ -36311,7 +36315,7 @@ class Dispatcher {
36311
36315
  const workers = this.workerPool.acquire(mapId);
36312
36316
  for (let i = 0; i < workers.length; i++) {
36313
36317
  const worker = workers[i];
36314
- const actor = new Dispatcher.Actor(worker, parent, mapId);
36318
+ const actor = new performance.Actor(worker, parent, mapId);
36315
36319
  actor.name = `Worker ${i}`;
36316
36320
  this.actors.push(actor);
36317
36321
  }
@@ -36342,7 +36346,6 @@ class Dispatcher {
36342
36346
  this.workerPool.release(this.id);
36343
36347
  }
36344
36348
  }
36345
- Dispatcher.Actor = performance.Actor;
36346
36349
 
36347
36350
  function loadTileJson(options, requestManager, callback) {
36348
36351
  const loaded = function (err, tileJSON) {
@@ -43052,6 +43055,7 @@ class Style extends performance.Evented {
43052
43055
  return;
43053
43056
  const sources = performance.mapObject(this.sourceCaches, (source) => source.serialize());
43054
43057
  const layers = this._serializeByIds(this._order);
43058
+ const terrain = this.map.getTerrain() || undefined;
43055
43059
  const myStyleSheet = this.stylesheet;
43056
43060
  return performance.filterObject({
43057
43061
  version: myStyleSheet.version,
@@ -43066,7 +43070,8 @@ class Style extends performance.Evented {
43066
43070
  glyphs: myStyleSheet.glyphs,
43067
43071
  transition: myStyleSheet.transition,
43068
43072
  sources,
43069
- layers
43073
+ layers,
43074
+ terrain
43070
43075
  }, (value) => { return value !== undefined; });
43071
43076
  }
43072
43077
  _updateLayer(layer) {
@@ -44800,11 +44805,12 @@ class VertexBuffer {
44800
44805
 
44801
44806
  const cache = new WeakMap();
44802
44807
  function isWebGL2(gl) {
44808
+ var _a;
44803
44809
  if (cache.has(gl)) {
44804
44810
  return cache.get(gl);
44805
44811
  }
44806
44812
  else {
44807
- const value = gl.getParameter(gl.VERSION).startsWith('WebGL 2.0');
44813
+ const value = (_a = gl.getParameter(gl.VERSION)) === null || _a === void 0 ? void 0 : _a.startsWith('WebGL 2.0');
44808
44814
  cache.set(gl, value);
44809
44815
  return value;
44810
44816
  }