maplibre-gl 3.0.0-pre.3 → 3.0.0-pre.4

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 (64) hide show
  1. package/README.md +0 -3
  2. package/build/banner.ts +2 -3
  3. package/build/generate-dist-package.js +21 -0
  4. package/build/generate-struct-arrays.ts +1 -1
  5. package/build/rollup/bundle_prelude.js +21 -0
  6. package/build/rollup/maplibregl.js +47 -0
  7. package/build/rollup_plugins.ts +2 -1
  8. package/dist/maplibre-gl-csp-worker.js +1 -1
  9. package/dist/maplibre-gl-csp-worker.js.map +1 -1
  10. package/dist/maplibre-gl-csp.js +1 -1
  11. package/dist/maplibre-gl-csp.js.map +1 -1
  12. package/dist/maplibre-gl-dev.js +1628 -1732
  13. package/dist/maplibre-gl-dev.js.map +1 -0
  14. package/dist/maplibre-gl.d.ts +83 -41
  15. package/dist/maplibre-gl.js +4 -4
  16. package/dist/maplibre-gl.js.map +1 -1
  17. package/dist/package.json +1 -1
  18. package/dist/style-spec/index.d.ts +2 -3
  19. package/package.json +57 -55
  20. package/src/data/feature_index.ts +1 -1
  21. package/src/index.ts +0 -22
  22. package/src/render/image_manager.ts +33 -14
  23. package/src/render/painter.ts +4 -7
  24. package/src/source/geojson_source.test.ts +21 -1
  25. package/src/source/geojson_source.ts +61 -3
  26. package/src/source/image_source.ts +3 -2
  27. package/src/source/load_tilejson.ts +2 -1
  28. package/src/source/raster_dem_tile_source.ts +3 -2
  29. package/src/source/raster_tile_source.ts +4 -6
  30. package/src/source/terrain_source_cache.test.ts +4 -5
  31. package/src/source/vector_tile_source.test.ts +1 -1
  32. package/src/source/vector_tile_source.ts +1 -4
  33. package/src/source/video_source.ts +2 -1
  34. package/src/source/worker.ts +0 -5
  35. package/src/style/load_glyph_range.ts +2 -1
  36. package/src/style/load_sprite.test.ts +8 -5
  37. package/src/style/load_sprite.ts +8 -8
  38. package/src/style/properties.ts +6 -6
  39. package/src/style/style.test.ts +56 -1
  40. package/src/style/style.ts +5 -4
  41. package/src/style/style_image.ts +10 -1
  42. package/src/style-spec/bin/gl-style-format.js +1 -1
  43. package/src/style-spec/bin/gl-style-migrate.js +1 -1
  44. package/src/style-spec/expression/types.ts +1 -1
  45. package/src/ui/camera.ts +1 -1
  46. package/src/ui/control/fullscreen_control.test.ts +24 -0
  47. package/src/ui/control/fullscreen_control.ts +26 -1
  48. package/src/ui/map.test.ts +24 -0
  49. package/src/ui/map.ts +24 -14
  50. package/src/util/ajax.test.ts +1 -129
  51. package/src/util/ajax.ts +4 -142
  52. package/src/util/browser.ts +7 -2
  53. package/src/util/config.ts +2 -0
  54. package/src/util/dispatcher.test.ts +35 -12
  55. package/src/util/dispatcher.ts +7 -7
  56. package/src/util/image_request.test.ts +486 -0
  57. package/src/util/image_request.ts +221 -0
  58. package/src/util/primitives.ts +1 -1
  59. package/src/util/request_manager.ts +16 -5
  60. package/src/util/test/util.ts +3 -0
  61. package/build/generate-query-test-fixtures.ts +0 -124
  62. package/postinstall.js +0 -1
  63. package/src/util/tile_request_cache.test.ts +0 -101
  64. package/src/util/tile_request_cache.ts +0 -169
package/README.md CHANGED
@@ -8,9 +8,6 @@ It originated as an open-source fork of [mapbox-gl-js](https://github.com/mapbox
8
8
 
9
9
  [![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg?style=flat)](LICENSE.txt)[![Version](https://img.shields.io/npm/v/maplibre-gl?style=flat)](https://www.npmjs.com/package/maplibre-gl)[![CI](https://github.com/maplibre/maplibre-gl-js/actions/workflows/ci.yml/badge.svg)](https://github.com/maplibre/maplibre-gl-js/actions/workflows/ci.yml)[![PRs](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](https://opensource.org/licenses/BSD-3-Clause)
10
10
 
11
- **Call for Bounties💰** If you have ideas for new features in MapLibre, you can now nominate them for the MapLibre Bounty Program at https://maplibre.org/news/2022-10-16-call-for-bounties/
12
- <br />
13
-
14
11
  ## Getting Started
15
12
 
16
13
  Include the JavaScript and CSS files in the `<head>` of your HTML file.
package/build/banner.ts CHANGED
@@ -1,4 +1,3 @@
1
- import fs from 'fs';
1
+ import packageJSON from '../package.json' assert {type: 'json'};
2
2
 
3
- const version = JSON.parse(fs.readFileSync('package.json').toString()).version;
4
- export default `/* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v${version}/LICENSE.txt */`;
3
+ export default `/* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v${packageJSON.version}/LICENSE.txt */`;
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+ /// js files in this project are esm.
3
+ /// This package.json ensures that node imports from outside see them as such
4
+ // https://nodejs.org/api/packages.html#type
5
+
6
+ import { writeFile, mkdir } from "node:fs/promises"
7
+
8
+ async function ensureDist() {
9
+ const dist = new URL("../dist/", import.meta.url);
10
+ await mkdir(dist, { recursive: true })
11
+ return dist
12
+ }
13
+
14
+ await writeFile(
15
+ new URL("package.json", await ensureDist()),
16
+ JSON.stringify({
17
+ name: "@maplibre/distfiles",
18
+ type: "commonjs",
19
+ deprecated: "Please install maplibre-gl from parent directory instead",
20
+ })
21
+ )
@@ -6,7 +6,7 @@
6
6
  * - Particular, named StructArray subclasses, when fancy struct accessors are needed (e.g. CollisionBoxArray)
7
7
  */
8
8
 
9
- 'use strict'; // eslint-disable-line strict
9
+ 'use strict';
10
10
 
11
11
  import * as fs from 'fs';
12
12
  import * as util from '../src/util/util';
@@ -0,0 +1,21 @@
1
+ /* eslint-disable */
2
+
3
+ var shared, worker, maplibregl;
4
+ // define gets called three times: one for each chunk. we rely on the order
5
+ // they're imported to know which is which
6
+ function define(_, chunk) {
7
+ if (!shared) {
8
+ shared = chunk;
9
+ } else if (!worker) {
10
+ worker = chunk;
11
+ } else {
12
+ var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'
13
+
14
+ var sharedChunk = {};
15
+ shared(sharedChunk);
16
+ maplibregl = chunk(sharedChunk);
17
+ if (typeof window !== 'undefined') {
18
+ maplibregl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,47 @@
1
+ //
2
+ // Our custom intro provides a specialized "define()" function, called by the
3
+ // AMD modules below, that sets up the worker blob URL and then executes the
4
+ // main module, storing its exported value as 'maplibregl'
5
+
6
+ // The three "chunks" imported here are produced by a first Rollup pass,
7
+ // which outputs them as AMD modules.
8
+
9
+ // Shared dependencies, i.e.:
10
+ /*
11
+ define(['exports'], function (exports) {
12
+ // Code for all common dependencies
13
+ // Each module's exports are attached attached to 'exports' (with
14
+ // names rewritten to avoid collisions, etc.)
15
+ })
16
+ */
17
+ import '../../staging/maplibregl/shared';
18
+
19
+ // Worker and its unique dependencies, i.e.:
20
+ /*
21
+ define(['./shared.js'], function (__shared__js) {
22
+ // Code for worker script and its unique dependencies.
23
+ // Expects the output of 'shared' module to be passed in as an argument,
24
+ // since all references to common deps look like, e.g.,
25
+ // __shared__js.shapeText().
26
+ });
27
+ */
28
+ // When this wrapper function is passed to our custom define() above,
29
+ // it gets stringified, together with the shared wrapper (using
30
+ // Function.toString()), and the resulting string of code is made into a
31
+ // Blob URL that gets used by the main module to create the web workers.
32
+ import '../../staging/maplibregl/worker';
33
+
34
+ // Main module and its unique dependencies
35
+ /*
36
+ define(['./shared.js'], function (__shared__js) {
37
+ // Code for main GL JS module and its unique dependencies.
38
+ // Expects the output of 'shared' module to be passed in as an argument,
39
+ // since all references to common deps look like, e.g.,
40
+ // __shared__js.shapeText().
41
+ //
42
+ // Returns the actual maplibregl (i.e. src/index.js)
43
+ });
44
+ */
45
+ import '../../staging/maplibregl/index';
46
+
47
+ export default maplibregl;
@@ -38,7 +38,8 @@ export const plugins = (production: boolean): Plugin[] => [
38
38
  // eslint-disable-next-line camelcase
39
39
  pure_getters: true,
40
40
  passes: 3
41
- }
41
+ },
42
+ sourceMap: true
42
43
  }),
43
44
  nodeResolve,
44
45
  typescript(),