maplibre-gl 2.0.2 → 2.0.3

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.
Files changed (97) hide show
  1. package/build/generate-struct-arrays.ts +1 -1
  2. package/build/post-ts-build.js +0 -9
  3. package/build/release-notes.js +7 -32
  4. package/dist/maplibre-gl.d.ts +8 -204
  5. package/dist/maplibre-gl.js +4 -4
  6. package/dist/maplibre-gl.js.map +1 -1
  7. package/package.json +14 -11
  8. package/src/data/array_types.ts +1 -1
  9. package/src/data/bucket/circle_bucket.ts +1 -1
  10. package/src/data/bucket/fill_bucket.test.ts +1 -1
  11. package/src/data/bucket/fill_bucket.ts +1 -1
  12. package/src/data/bucket/fill_extrusion_bucket.ts +1 -1
  13. package/src/data/bucket/line_bucket.test.ts +1 -1
  14. package/src/data/bucket/line_bucket.ts +1 -1
  15. package/src/data/bucket/symbol_bucket.ts +1 -1
  16. package/src/data/bucket.ts +1 -1
  17. package/src/data/evaluation_feature.ts +1 -1
  18. package/src/data/feature_index.ts +1 -1
  19. package/src/data/load_geometry.ts +1 -1
  20. package/src/geo/edge_insets.ts +1 -1
  21. package/src/geo/transform.test.ts +1 -1
  22. package/src/geo/transform.ts +1 -1
  23. package/src/index.ts +1 -1
  24. package/src/render/draw_symbol.ts +1 -1
  25. package/src/source/geojson_source.test.ts +27 -0
  26. package/src/source/geojson_source.ts +1 -3
  27. package/src/source/geojson_wrapper.ts +1 -1
  28. package/src/source/query_features.test.ts +1 -1
  29. package/src/source/query_features.ts +1 -1
  30. package/src/source/source_cache.test.ts +1 -1
  31. package/src/source/source_cache.ts +1 -1
  32. package/src/source/tile.ts +1 -1
  33. package/src/source/tile_id.ts +1 -1
  34. package/src/source/vector_tile_worker_source.test.ts +306 -0
  35. package/src/style/query_utils.ts +1 -1
  36. package/src/style/style_layer/circle_style_layer.ts +1 -1
  37. package/src/style/style_layer/fill_extrusion_style_layer.ts +1 -1
  38. package/src/style/style_layer/fill_style_layer.ts +1 -1
  39. package/src/style/style_layer/line_style_layer.ts +1 -1
  40. package/src/style/style_layer.ts +1 -1
  41. package/src/style-spec/expression/index.ts +1 -1
  42. package/src/style-spec/feature_filter/feature_filter.test.ts +1 -1
  43. package/src/style-spec/migrate.test.ts +112 -0
  44. package/src/style-spec/style-spec.ts +0 -3
  45. package/src/style-spec/validate_spec.test.ts +29 -0
  46. package/src/symbol/anchor.ts +1 -1
  47. package/src/symbol/check_max_angle.test.ts +1 -1
  48. package/src/symbol/check_max_angle.ts +1 -1
  49. package/src/symbol/clip_line.test.ts +1 -1
  50. package/src/symbol/clip_line.ts +1 -1
  51. package/src/symbol/collision_feature.test.ts +1 -1
  52. package/src/symbol/collision_feature.ts +1 -1
  53. package/src/symbol/collision_index.ts +1 -1
  54. package/src/symbol/get_anchors.test.ts +1 -1
  55. package/src/symbol/get_anchors.ts +1 -1
  56. package/src/symbol/mergelines.test.ts +1 -1
  57. package/src/symbol/path_interpolator.test.ts +1 -1
  58. package/src/symbol/path_interpolator.ts +1 -1
  59. package/src/symbol/placement.ts +1 -1
  60. package/src/symbol/projection.ts +1 -1
  61. package/src/symbol/quads.ts +1 -1
  62. package/src/symbol/symbol_layout.ts +1 -1
  63. package/src/ui/camera.test.ts +0 -8
  64. package/src/ui/camera.ts +5 -3
  65. package/src/ui/control/navigation_control.ts +1 -1
  66. package/src/ui/events.ts +1 -1
  67. package/src/ui/handler/box_zoom.ts +1 -1
  68. package/src/ui/handler/click_zoom.ts +1 -1
  69. package/src/ui/handler/handler_util.ts +1 -1
  70. package/src/ui/handler/map_event.ts +1 -1
  71. package/src/ui/handler/mouse.ts +1 -1
  72. package/src/ui/handler/scroll_zoom.ts +1 -1
  73. package/src/ui/handler/tap_drag_zoom.ts +1 -1
  74. package/src/ui/handler/tap_recognizer.ts +1 -1
  75. package/src/ui/handler/tap_zoom.ts +1 -1
  76. package/src/ui/handler/touch_pan.ts +1 -1
  77. package/src/ui/handler/touch_zoom_rotate.ts +1 -1
  78. package/src/ui/handler_inertia.ts +1 -1
  79. package/src/ui/handler_manager.ts +1 -1
  80. package/src/ui/map.ts +2 -2
  81. package/src/ui/marker.test.ts +1 -1
  82. package/src/ui/marker.ts +2 -1
  83. package/src/ui/popup.test.ts +1 -1
  84. package/src/ui/popup.ts +2 -2
  85. package/src/util/classify_rings.test.ts +1 -1
  86. package/src/util/classify_rings.ts +1 -1
  87. package/src/util/dom.ts +1 -1
  88. package/src/util/find_pole_of_inaccessibility.test.ts +1 -1
  89. package/src/util/find_pole_of_inaccessibility.ts +1 -1
  90. package/src/util/intersection_tests.ts +1 -1
  91. package/src/util/smart_wrap.ts +1 -1
  92. package/src/util/util.test.ts +1 -1
  93. package/src/util/util.ts +1 -1
  94. package/CHANGELOG.md +0 -2585
  95. package/dist/package.json +0 -1
  96. package/src/types/packages-types/vector-tile/index.d.ts +0 -27
  97. package/src/util/point.ts +0 -349
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "maplibre-gl",
3
3
  "description": "BSD licensed community fork of mapbox-gl, a WebGL interactive maps library",
4
- "version": "2.0.2",
4
+ "version": "2.0.3",
5
5
  "main": "dist/maplibre-gl.js",
6
6
  "style": "dist/maplibre-gl.css",
7
7
  "license": "BSD-3-Clause",
@@ -10,7 +10,7 @@
10
10
  "url": "git://github.com/maplibre/maplibre-gl-js.git"
11
11
  },
12
12
  "engines": {
13
- "node": ">=14.0.0"
13
+ "node": ">=16.0.0"
14
14
  },
15
15
  "types": "dist/maplibre-gl.d.ts",
16
16
  "type": "module",
@@ -18,10 +18,14 @@
18
18
  "@mapbox/geojson-rewind": "^0.5.0",
19
19
  "@mapbox/jsonlint-lines-primitives": "^2.0.2",
20
20
  "@mapbox/mapbox-gl-supported": "^2.0.1",
21
+ "@mapbox/point-geometry": "^0.1.0",
21
22
  "@mapbox/tiny-sdf": "^2.0.4",
22
23
  "@mapbox/unitbezier": "^0.0.1",
23
24
  "@mapbox/vector-tile": "^1.3.1",
24
25
  "@mapbox/whoots-js": "^3.1.0",
26
+ "@types/geojson": "^7946.0.7",
27
+ "@types/mapbox__point-geometry": "^0.1.2",
28
+ "@types/mapbox__vector-tile": "^1.3.0",
25
29
  "@types/pbf": "^3.0.2",
26
30
  "csscolorparser": "~1.0.3",
27
31
  "earcut": "^2.2.2",
@@ -31,7 +35,7 @@
31
35
  "pbf": "^3.2.1",
32
36
  "potpack": "^1.0.1",
33
37
  "quickselect": "^2.0.0",
34
- "supercluster": "^7.1.0",
38
+ "supercluster": "^7.1.4",
35
39
  "tinyqueue": "^2.0.3",
36
40
  "vt-pbf": "^3.1.1"
37
41
  },
@@ -57,7 +61,6 @@
57
61
  "@types/earcut": "^2.1.1",
58
62
  "@types/ejs": "^3.1.0",
59
63
  "@types/eslint": "^8.2.1",
60
- "@types/geojson": "^7946.0.7",
61
64
  "@types/gl": "^4.1.0",
62
65
  "@types/glob": "^7.1.3",
63
66
  "@types/jest": "^27.0.2",
@@ -83,16 +86,15 @@
83
86
  "@types/supercluster": "^5.0.2",
84
87
  "@types/tape": "^4.13.2",
85
88
  "@types/window-or-global": "^1.0.4",
86
- "@typescript-eslint/eslint-plugin": "^4.30.0",
87
- "@typescript-eslint/parser": "^4.30.0",
89
+ "@typescript-eslint/eslint-plugin": "^5.9.1",
90
+ "@typescript-eslint/parser": "^5.9.1",
88
91
  "address": "^1.1.2",
89
92
  "babel-eslint": "^10.0.1",
90
93
  "babel-jest": "^27.2.5",
91
94
  "babelify": "^10.0.0",
92
95
  "benchmark": "^2.1.4",
93
96
  "browserify": "^17.0.0",
94
- "canvas": "^2.6.1",
95
- "chalk": "^4.1.2",
97
+ "canvas": "^2.9.0",
96
98
  "chokidar": "^3.0.2",
97
99
  "cssnano": "^5.0.8",
98
100
  "d3": "^4.12.0",
@@ -107,7 +109,7 @@
107
109
  "eslint-plugin-jest": "^25.2.2",
108
110
  "eslint-plugin-jsdoc": "^37.0.3",
109
111
  "eslint-plugin-react": "^7.25.1",
110
- "gl": "^4.5.3",
112
+ "gl": "^5.0.0",
111
113
  "glob": "^7.1.4",
112
114
  "is-builtin-module": "^3.0.0",
113
115
  "jest": "^27.2.4",
@@ -168,7 +170,7 @@
168
170
  "testem": "^3.5.0",
169
171
  "ts-jest": "^27.0.5",
170
172
  "ts-node": "^10.2.1",
171
- "typescript": "^4.4.2"
173
+ "typescript": "^4.5.4"
172
174
  },
173
175
  "browser": {
174
176
  "./rollup/build/tsc/src/util/web_worker.js": "./build/web_worker_replacement.js"
@@ -211,7 +213,8 @@
211
213
  "test-expressions": "node --experimental-specifier-resolution=node test/expression.test.js",
212
214
  "test-cov": "nyc --reporter=text-summary --reporter=lcov --cache run-s test-unit test-expressions test-query test-render",
213
215
  "test-jest": "jest",
214
- "codegen": "node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-style-code.ts && node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-struct-arrays.ts && node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-style-spec.ts"
216
+ "codegen": "node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-style-code.ts && node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-struct-arrays.ts && node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-style-spec.ts",
217
+ "gl-stats": "node bench/gl-stats.js"
215
218
  },
216
219
  "files": [
217
220
  "build/",
@@ -3,7 +3,7 @@
3
3
  import assert from 'assert';
4
4
  import {Struct, StructArray} from '../util/struct_array';
5
5
  import {register} from '../util/web_worker_transfer';
6
- import Point from '../util/point';
6
+ import Point from '@mapbox/point-geometry';
7
7
 
8
8
  /**
9
9
  * Implementation of the StructArray layout:
@@ -23,7 +23,7 @@ import type HeatmapStyleLayer from '../../style/style_layer/heatmap_style_layer'
23
23
  import type Context from '../../gl/context';
24
24
  import type IndexBuffer from '../../gl/index_buffer';
25
25
  import type VertexBuffer from '../../gl/vertex_buffer';
26
- import type Point from '../../util/point';
26
+ import type Point from '@mapbox/point-geometry';
27
27
  import type {FeatureStates} from '../../source/source_state';
28
28
  import type {ImagePosition} from '../../render/image_atlas';
29
29
  import type {VectorTileLayer} from '@mapbox/vector-tile';
@@ -3,7 +3,7 @@ import fs from 'fs';
3
3
  import path from 'path';
4
4
  import Protobuf from 'pbf';
5
5
  import {VectorTile} from '@mapbox/vector-tile';
6
- import Point from '../../util/point';
6
+ import Point from '@mapbox/point-geometry';
7
7
  import segment from '../segment';
8
8
  import FillBucket from './fill_bucket';
9
9
  import FillStyleLayer from '../../style/style_layer/fill_style_layer';
@@ -26,7 +26,7 @@ import type FillStyleLayer from '../../style/style_layer/fill_style_layer';
26
26
  import type Context from '../../gl/context';
27
27
  import type IndexBuffer from '../../gl/index_buffer';
28
28
  import type VertexBuffer from '../../gl/vertex_buffer';
29
- import type Point from '../../util/point';
29
+ import type Point from '@mapbox/point-geometry';
30
30
  import type {FeatureStates} from '../../source/source_state';
31
31
  import type {ImagePosition} from '../../render/image_atlas';
32
32
  import type {VectorTileLayer} from '@mapbox/vector-tile';
@@ -30,7 +30,7 @@ import type FillExtrusionStyleLayer from '../../style/style_layer/fill_extrusion
30
30
  import type Context from '../../gl/context';
31
31
  import type IndexBuffer from '../../gl/index_buffer';
32
32
  import type VertexBuffer from '../../gl/vertex_buffer';
33
- import type Point from '../../util/point';
33
+ import type Point from '@mapbox/point-geometry';
34
34
  import type {FeatureStates} from '../../source/source_state';
35
35
  import type {ImagePosition} from '../../render/image_atlas';
36
36
  import type {VectorTileLayer} from '@mapbox/vector-tile';
@@ -2,7 +2,7 @@ import fs from 'fs';
2
2
  import path from 'path';
3
3
  import Protobuf from 'pbf';
4
4
  import {VectorTile} from '@mapbox/vector-tile';
5
- import Point from '../../util/point';
5
+ import Point from '@mapbox/point-geometry';
6
6
  import segment from '../segment';
7
7
  import LineBucket from './line_bucket';
8
8
  import LineStyleLayer from '../../style/style_layer/line_style_layer';
@@ -23,7 +23,7 @@ import type {
23
23
  PopulateParameters
24
24
  } from '../bucket';
25
25
  import type LineStyleLayer from '../../style/style_layer/line_style_layer';
26
- import type Point from '../../util/point';
26
+ import type Point from '@mapbox/point-geometry';
27
27
  import type {Segment} from '../segment';
28
28
  import {RGBAImage} from '../../util/image';
29
29
  import type Context from '../../gl/context';
@@ -16,7 +16,7 @@ import {SymbolLayoutArray,
16
16
  SymbolLineVertexArray
17
17
  } from '../array_types';
18
18
 
19
- import Point from '../../util/point';
19
+ import Point from '@mapbox/point-geometry';
20
20
  import SegmentVector from '../segment';
21
21
  import {ProgramConfigurationSet} from '../program_configuration';
22
22
  import {TriangleIndexArray, LineIndexArray} from '../index_array_type';
@@ -7,7 +7,7 @@ import type {FeatureStates} from '../source/source_state';
7
7
  import type {ImagePosition} from '../render/image_atlas';
8
8
  import type {CanonicalTileID} from '../source/tile_id';
9
9
  import type {VectorTileFeature, VectorTileLayer} from '@mapbox/vector-tile';
10
- import Point from '../util/point';
10
+ import Point from '@mapbox/point-geometry';
11
11
 
12
12
  export type BucketParameters<Layer extends TypedStyleLayer> = {
13
13
  index: number;
@@ -1,5 +1,5 @@
1
1
  import loadGeometry from './load_geometry';
2
- import type Point from '../util/point';
2
+ import type Point from '@mapbox/point-geometry';
3
3
  import type {VectorTileFeature} from '@mapbox/vector-tile';
4
4
 
5
5
  type EvaluationFeature = {
@@ -1,4 +1,4 @@
1
- import Point from '../util/point';
1
+ import Point from '@mapbox/point-geometry';
2
2
  import loadGeometry from './load_geometry';
3
3
  import toEvaluationFeature from './evaluation_feature';
4
4
  import EXTENT from './extent';
@@ -2,7 +2,7 @@ import {warnOnce, clamp} from '../util/util';
2
2
 
3
3
  import EXTENT from './extent';
4
4
 
5
- import type Point from '../util/point';
5
+ import type Point from '@mapbox/point-geometry';
6
6
  import type {VectorTileFeature} from '@mapbox/vector-tile';
7
7
 
8
8
  // These bounds define the minimum and maximum supported coordinate values.
@@ -1,5 +1,5 @@
1
1
  import {number} from '../style-spec/util/interpolate';
2
- import Point from '../util/point';
2
+ import Point from '@mapbox/point-geometry';
3
3
  import {clamp} from '../util/util';
4
4
 
5
5
  /**
@@ -1,4 +1,4 @@
1
- import Point from '../util/point';
1
+ import Point from '@mapbox/point-geometry';
2
2
  import Transform from './transform';
3
3
  import LngLat from './lng_lat';
4
4
  import {OverscaledTileID, CanonicalTileID} from '../source/tile_id';
@@ -1,7 +1,7 @@
1
1
  import LngLat from './lng_lat';
2
2
  import LngLatBounds from './lng_lat_bounds';
3
3
  import MercatorCoordinate, {mercatorXfromLng, mercatorYfromLat, mercatorZfromAltitude} from './mercator_coordinate';
4
- import Point from '../util/point';
4
+ import Point from '@mapbox/point-geometry';
5
5
  import {wrap, clamp} from '../util/util';
6
6
  import {number as interpolate} from '../style-spec/util/interpolate';
7
7
  import EXTENT from '../data/extent';
package/src/index.ts CHANGED
@@ -13,7 +13,7 @@ import Marker from './ui/marker';
13
13
  import Style from './style/style';
14
14
  import LngLat from './geo/lng_lat';
15
15
  import LngLatBounds from './geo/lng_lat_bounds';
16
- import Point from './util/point';
16
+ import Point from '@mapbox/point-geometry';
17
17
  import MercatorCoordinate from './geo/mercator_coordinate';
18
18
  import {Evented} from './util/evented';
19
19
  import config from './util/config';
@@ -1,4 +1,4 @@
1
- import Point from '../util/point';
1
+ import Point from '@mapbox/point-geometry';
2
2
  import drawCollisionDebug from './draw_collision_debug';
3
3
 
4
4
  import SegmentVector from '../data/segment';
@@ -227,6 +227,33 @@ describe('GeoJSONSource#update', () => {
227
227
  } as GeoJSONSourceOptions, mockDispatcher, undefined).load();
228
228
  });
229
229
 
230
+ test('forwards Supercluster options with worker request, ignore max zoom of source', done => {
231
+ const mockDispatcher = wrapDispatcher({
232
+ send(message, params) {
233
+ expect(message).toBe('geojson.loadData');
234
+ expect(params.superclusterOptions).toEqual({
235
+ maxZoom: 12,
236
+ minPoints: 3,
237
+ extent: 8192,
238
+ radius: 1600,
239
+ log: false,
240
+ generateId: true
241
+ });
242
+ done();
243
+ }
244
+ });
245
+
246
+ new GeoJSONSource('id', {
247
+ data: {},
248
+ maxzoom: 10,
249
+ cluster: true,
250
+ clusterMaxZoom: 12,
251
+ clusterRadius: 100,
252
+ clusterMinPoints: 3,
253
+ generateId: true
254
+ } as GeoJSONSourceOptions, mockDispatcher, undefined).load();
255
+ });
256
+
230
257
  test('transforms url before making request', () => {
231
258
  const mapStub = {
232
259
  _requestManager: {
@@ -136,9 +136,7 @@ class GeoJSONSource extends Evented implements Source {
136
136
  generateId: options.generateId || false
137
137
  },
138
138
  superclusterOptions: {
139
- maxZoom: options.clusterMaxZoom !== undefined ?
140
- Math.min(options.clusterMaxZoom, this.maxzoom - 1) :
141
- (this.maxzoom - 1),
139
+ maxZoom: options.clusterMaxZoom !== undefined ? options.clusterMaxZoom : this.maxzoom - 1,
142
140
  minPoints: Math.max(2, options.clusterMinPoints || 2),
143
141
  extent: EXTENT,
144
142
  radius: (options.clusterRadius || 50) * scale,
@@ -1,4 +1,4 @@
1
- import Point from '../util/point';
1
+ import Point from '@mapbox/point-geometry';
2
2
 
3
3
  import mvt from '@mapbox/vector-tile';
4
4
  import type {VectorTileFeature, VectorTileLayer, VectorTile} from '@mapbox/vector-tile';
@@ -4,7 +4,7 @@ import {
4
4
  } from './query_features';
5
5
  import SourceCache from './source_cache';
6
6
  import Transform from '../geo/transform';
7
- import Point from '../util/point';
7
+ import Point from '@mapbox/point-geometry';
8
8
  import Dispatcher from '../util/dispatcher';
9
9
 
10
10
  describe('QueryFeatures#rendered', () => {
@@ -4,7 +4,7 @@ import type CollisionIndex from '../symbol/collision_index';
4
4
  import type Transform from '../geo/transform';
5
5
  import type {RetainedQueryData} from '../symbol/placement';
6
6
  import type {FilterSpecification} from '../style-spec/types';
7
- import type Point from '../util/point';
7
+ import type Point from '@mapbox/point-geometry';
8
8
  import assert from 'assert';
9
9
  import {mat4} from 'gl-matrix';
10
10
 
@@ -4,7 +4,7 @@ import Tile from './tile';
4
4
  import {OverscaledTileID} from './tile_id';
5
5
  import Transform from '../geo/transform';
6
6
  import LngLat from '../geo/lng_lat';
7
- import Point from '../util/point';
7
+ import Point from '@mapbox/point-geometry';
8
8
  import {Event, ErrorEvent, Evented} from '../util/evented';
9
9
  import {extend} from '../util/util';
10
10
  import browser from '../util/browser';
@@ -7,7 +7,7 @@ import MercatorCoordinate from '../geo/mercator_coordinate';
7
7
  import {keysDifference} from '../util/util';
8
8
  import EXTENT from '../data/extent';
9
9
  import Context from '../gl/context';
10
- import Point from '../util/point';
10
+ import Point from '@mapbox/point-geometry';
11
11
  import browser from '../util/browser';
12
12
  import {OverscaledTileID} from './tile_id';
13
13
  import assert from 'assert';
@@ -30,7 +30,7 @@ import type Transform from '../geo/transform';
30
30
  import type {LayerFeatureStates} from './source_state';
31
31
  import type {Cancelable} from '../types/cancelable';
32
32
  import type {FilterSpecification} from '../style-spec/types';
33
- import type Point from '../util/point';
33
+ import type Point from '@mapbox/point-geometry';
34
34
  import {mat4} from 'gl-matrix';
35
35
  import type {VectorTileLayer} from '@mapbox/vector-tile';
36
36
 
@@ -1,6 +1,6 @@
1
1
  import {getTileBBox} from '@mapbox/whoots-js';
2
2
  import EXTENT from '../data/extent';
3
- import Point from '../util/point';
3
+ import Point from '@mapbox/point-geometry';
4
4
  import MercatorCoordinate from '../geo/mercator_coordinate';
5
5
 
6
6
  import assert from 'assert';