maplibre-gl 2.4.0 β†’ 3.0.0-pre.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.
Files changed (62) hide show
  1. package/README.md +70 -38
  2. package/build/generate-query-test-fixtures.ts +1 -3
  3. package/build/generate-style-spec.ts +1 -1
  4. package/dist/maplibre-gl-csp-worker.js +1 -1
  5. package/dist/maplibre-gl-csp.js +1 -1
  6. package/dist/maplibre-gl-dev.js +1497 -1348
  7. package/dist/maplibre-gl.css +1 -1
  8. package/dist/maplibre-gl.d.ts +116 -37
  9. package/dist/maplibre-gl.js +4 -4
  10. package/dist/style-spec/index.d.ts +4 -4
  11. package/package.json +19 -20
  12. package/src/css/maplibre-gl.css +126 -270
  13. package/src/geo/transform.test.ts +7 -0
  14. package/src/geo/transform.ts +7 -7
  15. package/src/render/draw_background.ts +2 -2
  16. package/src/render/draw_circle.ts +1 -1
  17. package/src/render/draw_collision_debug.ts +2 -2
  18. package/src/render/draw_debug.test.ts +122 -0
  19. package/src/render/draw_debug.ts +29 -1
  20. package/src/render/draw_fill.ts +1 -1
  21. package/src/render/draw_fill_extrusion.ts +2 -2
  22. package/src/render/draw_hillshade.ts +1 -1
  23. package/src/render/draw_line.ts +1 -1
  24. package/src/render/draw_raster.ts +2 -2
  25. package/src/render/draw_symbol.test.ts +6 -2
  26. package/src/render/draw_symbol.ts +3 -3
  27. package/src/render/painter.ts +9 -22
  28. package/src/render/program/terrain_program.ts +0 -2
  29. package/src/render/render_to_texture.test.ts +7 -5
  30. package/src/render/render_to_texture.ts +6 -6
  31. package/src/render/terrain.test.ts +5 -5
  32. package/src/render/terrain.ts +8 -13
  33. package/src/shaders/_prelude.vertex.glsl +1 -2
  34. package/src/shaders/_prelude.vertex.glsl.g.ts +1 -1
  35. package/src/source/query_features.test.ts +1 -1
  36. package/src/source/query_features.ts +2 -2
  37. package/src/source/tile.ts +4 -3
  38. package/src/style/style.test.ts +89 -1
  39. package/src/style/style.ts +78 -41
  40. package/src/style-spec/feature_filter/feature_filter.test.ts +1 -0
  41. package/src/style-spec/reference/v8.json +2 -12
  42. package/src/style-spec/types.g.ts +3 -4
  43. package/src/style-spec/validate/validate_terrain.test.ts +3 -6
  44. package/src/ui/anchor.ts +2 -2
  45. package/src/ui/camera.test.ts +61 -0
  46. package/src/ui/camera.ts +52 -4
  47. package/src/ui/control/attribution_control.ts +10 -10
  48. package/src/ui/control/fullscreen_control.ts +3 -5
  49. package/src/ui/control/geolocate_control.ts +39 -39
  50. package/src/ui/control/logo_control.ts +4 -4
  51. package/src/ui/control/navigation_control.ts +7 -7
  52. package/src/ui/control/scale_control.ts +1 -1
  53. package/src/ui/control/terrain_control.ts +8 -9
  54. package/src/ui/handler/box_zoom.ts +3 -3
  55. package/src/ui/handler/shim/drag_pan.ts +2 -2
  56. package/src/ui/handler/shim/touch_zoom_rotate.ts +2 -2
  57. package/src/ui/handler_manager.ts +5 -3
  58. package/src/ui/map.test.ts +126 -6
  59. package/src/ui/map.ts +71 -33
  60. package/src/ui/marker.test.ts +1 -1
  61. package/src/ui/marker.ts +2 -2
  62. package/src/ui/popup.ts +11 -11
package/README.md CHANGED
@@ -12,14 +12,14 @@ It originated as an open-source fork of [mapbox-gl-js](https://github.com/mapbox
12
12
 
13
13
  ## Getting Started
14
14
 
15
- Include the JavaScript and CSS files in the <head> of your HTML file.
15
+ Include the JavaScript and CSS files in the `<head>` of your HTML file.
16
16
 
17
17
  ``` html
18
18
  <script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
19
19
  <link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
20
20
  ```
21
21
 
22
- Include the following code in the <body> of your HTML file.
22
+ Include the following code in the `<body>` of your HTML file.
23
23
 
24
24
  ``` html
25
25
  <div id='map' style='width: 400px; height: 300px;'></div>
@@ -51,53 +51,41 @@ Check out the features through [examples](https://maplibre.org/maplibre-gl-js-do
51
51
 
52
52
  <br />
53
53
 
54
- ## Migrating from mapbox-gl
54
+ ## Migrating from mapbox-gl to maplibre
55
+ The libraries are very similar but diverge with newer features happening from v2 in both libraries where Mapbox turned proprietary.
55
56
 
56
- If you depend on mapbox-gl directly, simply replace `mapbox-gl` with `maplibre-gl` in `package.json`:
57
-
58
- Use
57
+ The overall migration happens by uninstalling `mapbox-gl` and installing `maplibre-gl` in your node packages (or see below for CDN links), and replacing `mapboxgl` with `maplibregl` throughout your TypeScript, JavaScript and HTML/CSS.
59
58
 
60
59
  ```diff
61
- "dependencies": {
62
- - "mapbox-gl": "^1.13.0"
63
- + "maplibre-gl": ">=1.15.2"
64
- }
65
- ```
60
+ - var map = new mapboxgl.Map({
61
+ + var map = new maplibregl.Map({
66
62
 
67
- if it is important to you that the behaviour is similar to `mapbox-gl` version 1.x.
63
+ - <button class="mapboxgl-ctrl">
64
+ + <button class="maplibregl-ctrl">
65
+ ```
68
66
 
69
- If you are OK with changes that integrate non-backward compatible features, install `maplibre-gl` version 2:
67
+ #### Compatibility branch
70
68
 
71
- ```diff
72
- "dependencies": {
73
- - "mapbox-gl": "^1.13.0"
74
- + "maplibre-gl": ">=2.0.0"
75
- }
76
- ```
69
+ Maplibre v1 is completely backward compatible with Mapbox v1. This compatibility branch (named 1.x) is tagged v1 on npm, and its current verison is 1.15.3.
77
70
 
78
- And replace `mapboxgl` with `maplibregl` in your JavaScript and optionally in your HTML/CSS code:
71
+ #### CDN Links
79
72
 
80
73
  > MapLibre GL JS is distributed via [unpkg.com](https://unpkg.com). For more informations please see [MapLibre GL is on unpkg.com](./docs/README-unpkg.md#maplibre-gl-on-unpkgcom).
81
74
 
82
75
  ```diff
83
- - <script src="https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js"></script>
76
+ - <script src="https://api.mapbox.com/mapbox-gl-js/v#.#.#/mapbox-gl.js"></script>
84
77
  - <link
85
- - href="https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.css"
78
+ - href="https://api.mapbox.com/mapbox-gl-js/v#.#.#/mapbox-gl.css"
86
79
  - rel="stylesheet"
87
80
  - />
88
81
 
89
- <!-- Use maplibre-gl version 1.15.2 for backwards compatibility with mapbox-gl version 1.x. -->
90
- + <script src="https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js"></script>
82
+
83
+ + <script src="https://unpkg.com/maplibre-gl@#.#.#/dist/maplibre-gl.js"></script>
91
84
  + <link
92
- + href="https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css"
85
+ + href="https://unpkg.com/maplibre-gl@#.#.#/dist/maplibre-gl.css"
93
86
  + rel="stylesheet"
94
87
  + />
95
88
 
96
- - var map = new mapboxgl.Map({
97
- + var map = new maplibregl.Map({
98
-
99
- - <button class="mapboxgl-ctrl">
100
- + <button class="maplibregl-ctrl">
101
89
  ```
102
90
 
103
91
  Want an example? Have a look at the official [MapLibre GL JS Documentation](https://maplibre.org/maplibre-gl-js-docs/example/).
@@ -119,10 +107,7 @@ You can find the official status of the backing community and steering committee
119
107
  ### Avoid Fragmentation
120
108
 
121
109
  If you depend on a free software alternative to `mapbox-gl-js`, please consider joining our effort! Anyone with a stake in a healthy community-led fork is welcome to help us figure out our next steps. We welcome contributors and leaders! MapLibre GL already represents the combined efforts of a few early fork efforts, and we all benefit from "one project" rather than "our way". If you know of other forks, please reach out to them and direct them here.
122
-
123
- ### Roadmap
124
-
125
- This project's initial plans are outlined in the [Roadmap](https://github.com/maplibre/maplibre-gl-js/projects/2) project. The primary goal is consistency and continued bug fixes and maintenance as we advance.
110
+
126
111
 
127
112
  > **MapLibre GL** is developed followingΒ [Semantic Versioning (2.0.0)](https://semver.org/spec/v2.0.0.html).
128
113
 
@@ -130,15 +115,62 @@ This project's initial plans are outlined in the [Roadmap](https://github.com/ma
130
115
 
131
116
  ## Sponsors
132
117
 
133
- We thank everyone who supported us financially in the past and special thanks to the people and organizations who support us with recurring dontations:
134
-
135
- [MIERUNE Inc.](https://www.mierune.co.jp/?lang=en) [@MIERUNE](https://github.com/MIERUNE), [@jawg](https://github.com/jawg), [@nekoyasan](https://github.com/nekoyasan), [@atierian](https://github.com/atierian), [@photoprism](https://github.com/photoprism), [@kaplanlior](https://github.com/kaplanlior), [@francois2metz](https://github.com/francois2metz), [@Schneider-Geo](https://github.com/Schneider-Geo), [@serghov](https://github.com/serghov), [@ambientlight](https://github.com/ambientlight), [@joschi77](https://github.com/joschi77), [@geoffhill](https://github.com/geoffhill), [@jasongode](https://github.com/jasongode)
118
+ We thank everyone who supported us financially in the past and special thanks to the people and organizations who support us with recurring donations!
119
+
120
+ Read more about the MapLibre Sponsorship Program at [https://maplibre.org/sponsors/](https://maplibre.org/sponsors/).
121
+
122
+ Platinum:
123
+
124
+ <img src="https://maplibre.org/img/aws-logo.svg" alt="Logo AWS" width="25%"/>
125
+
126
+
127
+ Silver:
128
+
129
+ <img src="https://maplibre.org/img/meta-logo.svg" alt="Logo Meta" width="50%"/>
130
+
131
+ Stone:
132
+
133
+ [MIERUNE Inc.](https://www.mierune.co.jp/?lang=en)
134
+
135
+ Backers and Supporters:
136
+
137
+ <a href="https://opencollective.com/maplibre/backer/0/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/0/avatar.svg?requireActive=false"></a>
138
+ <a href="https://opencollective.com/maplibre/backer/1/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/1/avatar.svg?requireActive=false"></a>
139
+ <a href="https://opencollective.com/maplibre/backer/2/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/2/avatar.svg?requireActive=false"></a>
140
+ <a href="https://opencollective.com/maplibre/backer/3/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/3/avatar.svg?requireActive=false"></a>
141
+ <a href="https://opencollective.com/maplibre/backer/4/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/4/avatar.svg?requireActive=false"></a>
142
+ <a href="https://opencollective.com/maplibre/backer/5/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/5/avatar.svg?requireActive=false"></a>
143
+ <a href="https://opencollective.com/maplibre/backer/6/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/6/avatar.svg?requireActive=false"></a>
144
+ <a href="https://opencollective.com/maplibre/backer/7/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/7/avatar.svg?requireActive=false"></a>
145
+ <a href="https://opencollective.com/maplibre/backer/8/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/8/avatar.svg?requireActive=false"></a>
146
+ <a href="https://opencollective.com/maplibre/backer/9/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/9/avatar.svg?requireActive=false"></a>
147
+ <a href="https://opencollective.com/maplibre/backer/10/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/10/avatar.svg?requireActive=false"></a>
148
+ <a href="https://opencollective.com/maplibre/backer/11/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/11/avatar.svg?requireActive=false"></a>
149
+ <a href="https://opencollective.com/maplibre/backer/12/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/12/avatar.svg?requireActive=false"></a>
150
+ <a href="https://opencollective.com/maplibre/backer/13/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/13/avatar.svg?requireActive=false"></a>
151
+ <a href="https://opencollective.com/maplibre/backer/14/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/14/avatar.svg?requireActive=false"></a>
152
+ <a href="https://opencollective.com/maplibre/backer/15/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/15/avatar.svg?requireActive=false"></a>
153
+ <a href="https://opencollective.com/maplibre/backer/16/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/16/avatar.svg?requireActive=false"></a>
154
+ <a href="https://opencollective.com/maplibre/backer/17/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/17/avatar.svg?requireActive=false"></a>
155
+ <a href="https://opencollective.com/maplibre/backer/18/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/18/avatar.svg?requireActive=false"></a>
156
+ <a href="https://opencollective.com/maplibre/backer/19/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/19/avatar.svg?requireActive=false"></a>
157
+ <a href="https://opencollective.com/maplibre/backer/20/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/20/avatar.svg?requireActive=false"></a>
158
+ <a href="https://opencollective.com/maplibre/backer/21/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/21/avatar.svg?requireActive=false"></a>
159
+ <a href="https://opencollective.com/maplibre/backer/22/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/22/avatar.svg?requireActive=false"></a>
160
+ <a href="https://opencollective.com/maplibre/backer/23/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/23/avatar.svg?requireActive=false"></a>
161
+ <a href="https://opencollective.com/maplibre/backer/24/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/24/avatar.svg?requireActive=false"></a>
162
+ <a href="https://opencollective.com/maplibre/backer/25/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/25/avatar.svg?requireActive=false"></a>
163
+ <a href="https://opencollective.com/maplibre/backer/26/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/26/avatar.svg?requireActive=false"></a>
164
+ <a href="https://opencollective.com/maplibre/backer/27/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/27/avatar.svg?requireActive=false"></a>
165
+ <a href="https://opencollective.com/maplibre/backer/28/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/28/avatar.svg?requireActive=false"></a>
166
+ <a href="https://opencollective.com/maplibre/backer/29/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/29/avatar.svg?requireActive=false"></a>
167
+ <a href="https://opencollective.com/maplibre/backer/30/website?requireActive=false" target="_blank"><img src="https://opencollective.com/maplibre/backer/30/avatar.svg?requireActive=false"></a>
136
168
 
137
169
  <br />
138
170
 
139
171
  ## Thank you Mapbox πŸ™πŸ½
140
172
 
141
- We'd like to acknowledge the amazing work Mapbox has contributed to open source. The open source community is sad to part ways with them, but we simultaneously feel grateful for everything they already contributed. `mapbox-gl-js` 1.x is an open source achievement which now lives on as `maplibre-gl`. We're proud to develop on the shoulders of giants, thank you Mapbox πŸ™‡πŸ½β€β™€οΈ.
173
+ We'd like to acknowledge the amazing work Mapbox has contributed to open source. The open source community is sad to part ways with them, but we simultaneously feel grateful for everything they already contributed. `mapbox-gl-js` 1.x is an open source achievement that now lives on as `maplibre-gl`. We're proud to develop on the shoulders of giants, thank you Mapbox πŸ™‡πŸ½β€β™€οΈ.
142
174
 
143
175
  Please keep in mind: Unauthorized backports are the biggest threat to the MapLibre project. It is unacceptable to backport code from mapbox-gl-js, which is not covered by the former BSD-3 license. If you are unsure about this issue, [please ask](https://github.com/maplibre/maplibre-gl-js/discussions)!
144
176
 
@@ -3,10 +3,8 @@ import fs from 'fs';
3
3
  import glob from 'glob';
4
4
  import localizeURLs from '../test/integration/lib/localize-urls';
5
5
  import {fileURLToPath} from 'url';
6
- import {createRequire} from 'module';
7
6
 
8
7
  const __dirname = dirname(fileURLToPath(import.meta.url));
9
- const requireFn = createRequire(import.meta.url);
10
8
  const OUTPUT_FILE = 'fixtures.json';
11
9
  const rootFixturePath = 'test/integration/query/';
12
10
  const suitePath = 'tests';
@@ -106,7 +104,7 @@ function pngToBase64Str(filePath) {
106
104
 
107
105
  function processStyle(testName, style) {
108
106
  const clone = JSON.parse(JSON.stringify(style));
109
- localizeURLs(clone, 7357, path.join(__dirname, '../test/integration'), requireFn);
107
+ localizeURLs(clone, 7357, path.join(__dirname, '../test/integration'));
110
108
 
111
109
  clone.metadata = clone.metadata || {};
112
110
 
@@ -191,7 +191,7 @@ export type ExpressionSpecification =
191
191
  | ['match', ExpressionInputType | ExpressionSpecification,
192
192
  ExpressionInputType | ExpressionInputType[], ExpressionInputType | ExpressionSpecification,
193
193
  ...(ExpressionInputType | ExpressionInputType[] | ExpressionSpecification)[], // repeated as above
194
- ExpressionInputType]
194
+ ExpressionInputType | ExpressionSpecification]
195
195
  | ['within', unknown | ExpressionSpecification]
196
196
  // Ramps, scales, curves
197
197
  | ['interpolate', InterpolationSpecification, number | ExpressionSpecification,