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
@@ -428,7 +428,7 @@ fs.writeFileSync('src/data/array_types.ts',
428
428
  import assert from 'assert';
429
429
  import {Struct, StructArray} from '../util/struct_array';
430
430
  import {register} from '../util/web_worker_transfer';
431
- import Point from '../util/point';
431
+ import Point from '@mapbox/point-geometry';
432
432
 
433
433
  ${layouts.map(emitStructArrayLayout).join('\n')}
434
434
  ${arraysWithStructAccessors.map(emitStructArray).join('\n')}
@@ -37,15 +37,6 @@ child_process.execSync(`dts-bundle-generator --no-check --umd-module-name=maplib
37
37
  let types = fs.readFileSync(outputFile, 'utf8');
38
38
  // Classes are not exported but should be since this is exported as UMD - fixing...
39
39
  types = types.replace(/declare class/g, "export declare class");
40
- // Missing vector-tile types that are added to this file too
41
- let file = fs.readFileSync("./src/types/packages-types/vector-tile/index.d.ts", 'utf8');
42
- let lines = file.split("\n").filter(Boolean);
43
- lines.pop(); // last } is removed too.
44
- types = lines.join("\n") + "\n" + types;
45
- // remove imports of vector-tile and declare module lines
46
- types = types.split("\n")
47
- .filter(l => !l.includes("@mapbox/vector-tile"))
48
- .join("\n");
49
40
  fs.writeFileSync(outputFile, types);
50
41
  console.log(`Finished bundling types`);
51
42
 
@@ -1,28 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import * as fs from 'fs';
4
- import {execSync} from 'child_process';
5
4
  import * as ejs from 'ejs';
6
- import _ from 'lodash';
7
5
  import semver from 'semver';
8
6
 
9
7
  const changelogPath = 'CHANGELOG.md';
10
8
  const changelog = fs.readFileSync(changelogPath, 'utf8');
11
9
 
12
- let currentVersion = execSync('git describe --tags --match=v*.*.* --abbrev=0')
13
- .toString()
14
- .trim()
15
- .replace('v', '');
16
-
17
- let gitTags = execSync('git tag --list v*.*.*')
18
- .toString()
19
- .split('\n')
20
- .map(function(tag) {
21
- tag = tag.replace('v', '').trim();
22
- return semver.clean(tag);
23
- });
24
- let previousVersion = semver.maxSatisfying(gitTags, "<" + currentVersion, { includePrerelease: false });
25
-
26
10
  /*
27
11
  Parse the raw changelog text and split it into individual releases.
28
12
 
@@ -33,7 +17,7 @@ let previousVersion = semver.maxSatisfying(gitTags, "<" + currentVersion, { incl
33
17
  - Groups the changelog content.
34
18
  - Ends when another "## x.x.x" is found.
35
19
  */
36
- const regex = /^## (\d+\.\d+\.\d+).*?\n(.+?)(?=\n^## \d+\.\d+\.\d+.*?\n)/gms;
20
+ const regex = /^## (\d+\.\d+\.\d+.*?)\n(.+?)(?=\n^## \d+\.\d+\.\d+.*?\n)/gms;
37
21
 
38
22
  let releaseNotes = [];
39
23
  let match;
@@ -45,17 +29,8 @@ while (match = regex.exec(changelog)) {
45
29
  });
46
30
  }
47
31
 
48
- /*
49
- Match the current tag with the most appropriate release notes.
50
- */
51
- const versionsInReleaseNotes = _.map(releaseNotes, 'version');
52
- const bestReleaseNotesForCurrentVersion = semver.minSatisfying(versionsInReleaseNotes, ">=" + currentVersion);
53
- const currentReleaseNotes = _.find(releaseNotes, { version: bestReleaseNotesForCurrentVersion });
54
-
55
- if (!currentReleaseNotes) {
56
- console.error('Could not find a release section satisfying %s in %s — did you forget to rename the "main" section to %s?', currentVersion, changelogPath, currentVersion.split("-")[0]);
57
- process.exit(1); // eslint-disable-line no-process-exit
58
- }
32
+ const latest = releaseNotes[0];
33
+ const previous = releaseNotes[1];
59
34
 
60
35
  /*
61
36
  Fill and print the release notes template.
@@ -63,10 +38,10 @@ if (!currentReleaseNotes) {
63
38
  let templatedReleaseNotes;
64
39
 
65
40
  templatedReleaseNotes = ejs.render(fs.readFileSync('build/release-notes.md.ejs', 'utf8'), {
66
- 'CURRENTVERSION': currentVersion,
67
- 'PREVIOUSVERSION': previousVersion,
68
- 'CHANGELOG': currentReleaseNotes.changelog,
69
- 'isPrerelease': semver.prerelease(currentVersion)
41
+ 'CURRENTVERSION': latest.version,
42
+ 'PREVIOUSVERSION': previous.version,
43
+ 'CHANGELOG': latest.changelog,
44
+ 'isPrerelease': semver.prerelease(latest.version)
70
45
  });
71
46
  templatedReleaseNotes = templatedReleaseNotes.trimEnd();
72
47
 
@@ -1,27 +1,8 @@
1
- import type Pbf from 'pbf';
2
- export class VectorTileLayer {
3
- version?: number;
4
- name: string;
5
- extent: number;
6
- length: number;
7
- feature(i: number): VectorTileFeature;
8
- }
9
- export class VectorTile {
10
- constructor(pbf: Pbf);
11
- layers: {[_: string]: VectorTileLayer};
12
- }
13
- export class VectorTileFeature {
14
- static types: ['Unknown', 'Point', 'LineString', 'Polygon'];
15
- extent: number;
16
- type: 1 | 2 | 3;
17
- id: number;
18
- properties: {[_: string]: string | number | boolean};
19
- loadGeometry(): Array<Array<Point>>;
20
- toGeoJSON(x: number, y: number, z: number): GeoJSON.Feature;
21
- }
22
1
  // Generated by dts-bundle-generator v6.1.0
23
2
 
3
+ import Point from '@mapbox/point-geometry';
24
4
  import TinySDF from '@mapbox/tiny-sdf';
5
+ import { VectorTileFeature, VectorTileLayer } from '@mapbox/vector-tile';
25
6
  import { mat2, mat4 } from 'gl-matrix';
26
7
  import { PotpackBox } from 'potpack';
27
8
 
@@ -802,187 +783,6 @@ export declare class EvaluationParameters {
802
783
  crossFadingFactor(): number;
803
784
  getCrossfadeParameters(): CrossfadeParameters;
804
785
  }
805
- /**
806
- * A {@link Point} or an array of two numbers representing `x` and `y` screen coordinates in pixels.
807
- *
808
- * @typedef {(Point | [number, number])} PointLike
809
- * @example
810
- * var p1 = new maplibregl.Point(-77, 38); // a PointLike which is a Point
811
- * var p2 = [-77, 38]; // a PointLike which is an array of two numbers
812
- */
813
- export declare type PointLike = Point | [
814
- number,
815
- number
816
- ];
817
- export declare class Point {
818
- x: number;
819
- y: number;
820
- constructor(x: number, y: number);
821
- /**
822
- * Clone this point, returning a new point that can be modified
823
- * without affecting the old one.
824
- * @returns {Point} the clone
825
- */
826
- clone(): Point;
827
- /**
828
- * Add this point's x & y coordinates to another point,
829
- * yielding a new point.
830
- * @param {Point} p the other point
831
- * @returns {Point} output point
832
- */
833
- add(p: any): Point;
834
- /**
835
- * Subtract this point's x & y coordinates to from point,
836
- * yielding a new point.
837
- * @param {Point} p the other point
838
- * @returns {Point} output point
839
- */
840
- sub(p: any): Point;
841
- /**
842
- * Multiply this point's x & y coordinates by point,
843
- * yielding a new point.
844
- * @param {Point} p the other point
845
- * @returns {Point} output point
846
- */
847
- multByPoint(p: any): Point;
848
- /**
849
- * Divide this point's x & y coordinates by point,
850
- * yielding a new point.
851
- * @param {Point} p the other point
852
- * @returns {Point} output point
853
- */
854
- divByPoint(p: any): Point;
855
- /**
856
- * Multiply this point's x & y coordinates by a factor,
857
- * yielding a new point.
858
- * @param {Point} k factor
859
- * @returns {Point} output point
860
- */
861
- mult(k: any): Point;
862
- /**
863
- * Divide this point's x & y coordinates by a factor,
864
- * yielding a new point.
865
- * @param {Point} k factor
866
- * @returns {Point} output point
867
- */
868
- div(k: any): Point;
869
- /**
870
- * Rotate this point around the 0, 0 origin by an angle a,
871
- * given in radians
872
- * @param {Number} a angle to rotate around, in radians
873
- * @returns {Point} output point
874
- */
875
- rotate(a: any): Point;
876
- /**
877
- * Rotate this point around p point by an angle a,
878
- * given in radians
879
- * @param {Number} a angle to rotate around, in radians
880
- * @param {Point} p Point to rotate around
881
- * @returns {Point} output point
882
- */
883
- rotateAround(a: any, p: any): Point;
884
- /**
885
- * Multiply this point by a 4x1 transformation matrix
886
- * @param {Array<Number>} m transformation matrix
887
- * @returns {Point} output point
888
- */
889
- matMult(m: any): Point;
890
- /**
891
- * Calculate this point but as a unit vector from 0, 0, meaning
892
- * that the distance from the resulting point to the 0, 0
893
- * coordinate will be equal to 1 and the angle from the resulting
894
- * point to the 0, 0 coordinate will be the same as before.
895
- * @returns {Point} unit vector point
896
- */
897
- unit(): Point;
898
- /**
899
- * Compute a perpendicular point, where the new y coordinate
900
- * is the old x coordinate and the new x coordinate is the old y
901
- * coordinate multiplied by -1
902
- * @returns {Point} perpendicular point
903
- */
904
- perp(): Point;
905
- /**
906
- * Return a version of this point with the x & y coordinates
907
- * rounded to integers.
908
- * @returns {Point} rounded point
909
- */
910
- round(): Point;
911
- /**
912
- * Return the magitude of this point: this is the Euclidean
913
- * distance from the 0, 0 coordinate to this point's x and y
914
- * coordinates.
915
- * @returns {Number} magnitude
916
- */
917
- mag(): number;
918
- /**
919
- * Judge whether this point is equal to another point, returning
920
- * true or false.
921
- * @param {Point} other the other point
922
- * @returns {boolean} whether the points are equal
923
- */
924
- equals(other: any): boolean;
925
- /**
926
- * Calculate the distance from this point to another point
927
- * @param {Point} p the other point
928
- * @returns {Number} distance
929
- */
930
- dist(p: any): number;
931
- /**
932
- * Calculate the distance from this point to another point,
933
- * without the square root step. Useful if you're comparing
934
- * relative distances.
935
- * @param {Point} p the other point
936
- * @returns {Number} distance
937
- */
938
- distSqr(p: any): number;
939
- /**
940
- * Get the angle from the 0, 0 coordinate to this point, in radians
941
- * coordinates.
942
- * @returns {Number} angle
943
- */
944
- angle(): number;
945
- /**
946
- * Get the angle from this point to another point, in radians
947
- * @param {Point} b the other point
948
- * @returns {Number} angle
949
- */
950
- angleTo(b: any): number;
951
- /**
952
- * Get the angle between this point and another point, in radians
953
- * @param {Point} b the other point
954
- * @returns {Number} angle
955
- */
956
- angleWith(b: any): number;
957
- angleWithSep(x: any, y: any): number;
958
- _matMult(m: any): this;
959
- _add(p: any): this;
960
- _sub(p: any): this;
961
- _mult(k: any): this;
962
- _div(k: any): this;
963
- _multByPoint(p: any): this;
964
- _divByPoint(p: any): this;
965
- _unit(): this;
966
- _perp(): this;
967
- _rotate(angle: any): this;
968
- _rotateAround(angle: any, p: any): this;
969
- _round(): this;
970
- /**
971
- * Construct a point from an array if necessary, otherwise if the input
972
- * is already a Point, or an unknown type, return it unchanged
973
- * @param {Array<Number>|Point|*} a any kind of input value
974
- * @returns {Point} constructed point, or passed-through value.
975
- * @example
976
- * // this
977
- * var point = Point.convert([0, 1]);
978
- * // is equivalent to
979
- * var point = new Point(0, 1);
980
- */
981
- static convert(a: PointLike | {
982
- x: number;
983
- y: number;
984
- }): Point;
985
- }
986
786
  export declare class LngLatBounds {
987
787
  _ne: LngLat;
988
788
  _sw: LngLat;
@@ -7193,6 +6993,10 @@ export declare class TaskQueue {
7193
6993
  run(timeStamp?: number): void;
7194
6994
  clear(): void;
7195
6995
  }
6996
+ export declare type PointLike = Point | [
6997
+ number,
6998
+ number
6999
+ ];
7196
7000
  export declare type RequireAtLeastOne<T> = {
7197
7001
  [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;
7198
7002
  }[keyof T];
@@ -7614,7 +7418,7 @@ declare abstract class Camera extends Evented {
7614
7418
  * @memberof Map#
7615
7419
  * @param bounds Center these bounds in the viewport and use the highest
7616
7420
  * zoom level up to and including `Map#getMaxZoom()` that fits them in the viewport.
7617
- * @param {Object} [options] Options supports all properties from {@link AnimationOptions} and {@link CameraOptions} in addition to the fields below.
7421
+ * @param {FitBoundsOptions} [options] Options supports all properties from {@link AnimationOptions} and {@link CameraOptions} in addition to the fields below.
7618
7422
  * @param {number | PaddingOptions} [options.padding] The amount of padding in pixels to add to the given bounds.
7619
7423
  * @param {boolean} [options.linear=false] If `true`, the map transitions using
7620
7424
  * {@link Map#easeTo}. If `false`, the map transitions using {@link Map#flyTo}. See
@@ -7741,7 +7545,7 @@ declare abstract class Camera extends Evented {
7741
7545
  * unless 'options' includes `essential: true`.
7742
7546
  *
7743
7547
  * @memberof Map#
7744
- * @param {Object} options Options describing the destination and animation of the transition.
7548
+ * @param {FlyToOptions} options Options describing the destination and animation of the transition.
7745
7549
  * Accepts {@link CameraOptions}, {@link AnimationOptions},
7746
7550
  * and the following additional options.
7747
7551
  * @param {number} [options.curve=1.42] The zooming "curve" that will occur along the