maplibre-gl 3.6.1 → 4.0.0-pre.1

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 (91) hide show
  1. package/README.md +0 -36
  2. package/build/generate-doc-images.ts +3 -4
  3. package/dist/maplibre-gl-csp-worker.js +1 -1
  4. package/dist/maplibre-gl-csp-worker.js.map +1 -1
  5. package/dist/maplibre-gl-csp.js +1 -1
  6. package/dist/maplibre-gl-csp.js.map +1 -1
  7. package/dist/maplibre-gl-dev.js +1933 -1881
  8. package/dist/maplibre-gl-dev.js.map +1 -1
  9. package/dist/maplibre-gl.d.ts +872 -640
  10. package/dist/maplibre-gl.js +4 -4
  11. package/dist/maplibre-gl.js.map +1 -1
  12. package/package.json +19 -19
  13. package/src/data/dem_data.ts +26 -13
  14. package/src/data/feature_index.ts +0 -1
  15. package/src/index.test.ts +33 -35
  16. package/src/render/glyph_atlas.ts +3 -6
  17. package/src/render/glyph_manager.test.ts +68 -98
  18. package/src/render/glyph_manager.ts +63 -104
  19. package/src/render/image_atlas.ts +2 -2
  20. package/src/render/image_manager.ts +45 -38
  21. package/src/render/terrain.test.ts +56 -1
  22. package/src/render/terrain.ts +17 -2
  23. package/src/render/update_pattern_positions_in_program.test.ts +74 -0
  24. package/src/render/update_pattern_positions_in_program.ts +4 -0
  25. package/src/source/canvas_source.ts +6 -6
  26. package/src/source/geojson_source.test.ts +61 -52
  27. package/src/source/geojson_source.ts +50 -69
  28. package/src/source/geojson_worker_source.test.ts +97 -159
  29. package/src/source/geojson_worker_source.ts +104 -159
  30. package/src/source/image_source.test.ts +16 -10
  31. package/src/source/image_source.ts +23 -23
  32. package/src/source/load_tilejson.ts +20 -26
  33. package/src/source/query_features.test.ts +2 -7
  34. package/src/source/raster_dem_tile_source.test.ts +64 -73
  35. package/src/source/raster_dem_tile_source.ts +40 -40
  36. package/src/source/raster_dem_tile_worker_source.test.ts +7 -9
  37. package/src/source/raster_dem_tile_worker_source.ts +3 -4
  38. package/src/source/raster_tile_source.test.ts +4 -6
  39. package/src/source/raster_tile_source.ts +42 -34
  40. package/src/source/rtl_text_plugin.ts +48 -40
  41. package/src/source/source.ts +57 -12
  42. package/src/source/source_cache.test.ts +266 -327
  43. package/src/source/source_cache.ts +20 -19
  44. package/src/source/tile.ts +2 -4
  45. package/src/source/vector_tile_source.test.ts +167 -122
  46. package/src/source/vector_tile_source.ts +58 -44
  47. package/src/source/vector_tile_worker_source.test.ts +130 -124
  48. package/src/source/vector_tile_worker_source.ts +90 -119
  49. package/src/source/video_source.ts +27 -26
  50. package/src/source/worker.test.ts +43 -55
  51. package/src/source/worker.ts +153 -128
  52. package/src/source/worker_source.ts +33 -34
  53. package/src/source/worker_tile.test.ts +50 -69
  54. package/src/source/worker_tile.ts +55 -101
  55. package/src/style/load_glyph_range.test.ts +19 -20
  56. package/src/style/load_glyph_range.ts +11 -17
  57. package/src/style/load_sprite.test.ts +67 -84
  58. package/src/style/load_sprite.ts +23 -52
  59. package/src/style/style.test.ts +37 -39
  60. package/src/style/style.ts +69 -71
  61. package/src/style/style_glyph.ts +3 -1
  62. package/src/style/style_image.ts +7 -0
  63. package/src/types/tilejson.ts +2 -0
  64. package/src/ui/control/geolocate_control.test.ts +111 -129
  65. package/src/ui/control/geolocate_control.ts +2 -3
  66. package/src/ui/events.ts +1 -1
  67. package/src/ui/handler/dblclick_zoom.test.ts +31 -49
  68. package/src/ui/map.test.ts +38 -34
  69. package/src/ui/map.ts +32 -28
  70. package/src/util/abort_error.ts +21 -0
  71. package/src/util/actor.test.ts +156 -73
  72. package/src/util/actor.ts +143 -166
  73. package/src/util/actor_messages.ts +124 -0
  74. package/src/util/ajax.test.ts +48 -54
  75. package/src/util/ajax.ts +150 -154
  76. package/src/util/browser.ts +11 -0
  77. package/src/util/dispatcher.test.ts +4 -4
  78. package/src/util/dispatcher.ts +16 -9
  79. package/src/util/geolocation_support.test.ts +17 -29
  80. package/src/util/geolocation_support.ts +17 -18
  81. package/src/util/image.ts +0 -1
  82. package/src/util/image_request.test.ts +135 -140
  83. package/src/util/image_request.ts +94 -131
  84. package/src/util/task_queue.ts +1 -1
  85. package/src/util/test/util.ts +27 -4
  86. package/src/util/throttled_invoker.ts +18 -17
  87. package/src/util/util.test.ts +1 -59
  88. package/src/util/util.ts +56 -54
  89. package/src/util/web_worker.ts +4 -8
  90. package/src/util/web_worker_transfer.ts +7 -1
  91. package/src/util/test/mock_fetch.ts +0 -51
package/README.md CHANGED
@@ -49,42 +49,6 @@ Check out the features through [examples](https://maplibre.org/maplibre-gl-js/do
49
49
 
50
50
  <br />
51
51
 
52
- ## Migrating from mapbox-gl to maplibre
53
- The libraries are very similar but diverge with newer features happening from v2 in both libraries where Mapbox turned proprietary.
54
-
55
- 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.
56
-
57
- ```diff
58
- - var map = new mapboxgl.Map({
59
- + var map = new maplibregl.Map({
60
-
61
- - <button class="mapboxgl-ctrl">
62
- + <button class="maplibregl-ctrl">
63
- ```
64
-
65
- #### Compatibility branch
66
-
67
- MapLibre GL JS v1 is completely backward compatible with Mapbox GL JS v1. This compatibility branch (named 1.x) is tagged v1 on npm, and its current version is 1.15.3.
68
-
69
- #### CDN Links
70
-
71
- > MapLibre GL JS is distributed via [unpkg.com](https://unpkg.com). For more information, please see [MapLibre GL JS is on unpkg.com](./developer-guides/README-unpkg.md).
72
-
73
- ```diff
74
- - <script src="https://api.mapbox.com/mapbox-gl-js/v#.#.#/mapbox-gl.js"></script>
75
- - <link
76
- - href="https://api.mapbox.com/mapbox-gl-js/v#.#.#/mapbox-gl.css"
77
- - rel="stylesheet"
78
- - />
79
-
80
-
81
- + <script src="https://unpkg.com/maplibre-gl@#.#.#/dist/maplibre-gl.js"></script>
82
- + <link
83
- + href="https://unpkg.com/maplibre-gl@#.#.#/dist/maplibre-gl.css"
84
- + rel="stylesheet"
85
- + />
86
-
87
- ```
88
52
 
89
53
  Want an example? Have a look at the official [MapLibre GL JS Documentation](https://maplibre.org/maplibre-gl-js/docs/examples/).
90
54
 
@@ -2,6 +2,7 @@ import path from 'path';
2
2
  import fs from 'fs';
3
3
  import puppeteer from 'puppeteer';
4
4
  import packageJson from '../package.json' assert { type: 'json' };
5
+ import {sleep} from '../src/util/test/util';
5
6
 
6
7
  const exampleName = process.argv[2];
7
8
  const examplePath = path.resolve('test', 'examples');
@@ -28,10 +29,8 @@ async function createImage(exampleName) {
28
29
  .then(async () => {
29
30
  // Wait for 5 seconds on 3d model examples, since this takes longer to load.
30
31
  const waitTime = exampleName.includes('3d-model') ? 5000 : 1500;
31
- await new Promise((resolve) => {
32
- console.log(`waiting for ${waitTime} ms`);
33
- setTimeout(resolve, waitTime);
34
- });
32
+ console.log(`waiting for ${waitTime} ms`);
33
+ await sleep(waitTime);
35
34
  })
36
35
  // map.loaded() does not evaluate to true within 3 seconds, it's probably an animated example.
37
36
  // In this case we take the screenshot immediately.