maplibre-gl 3.0.0-pre.2 → 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.
- package/README.md +0 -3
- package/build/banner.ts +2 -3
- package/build/generate-dist-package.js +21 -0
- package/build/generate-struct-arrays.ts +1 -1
- package/build/generate-style-code.ts +4 -0
- package/build/generate-style-spec.ts +3 -1
- package/build/rollup/bundle_prelude.js +21 -0
- package/build/rollup/maplibregl.js +47 -0
- package/build/rollup_plugins.ts +2 -1
- package/dist/maplibre-gl-csp-worker.js +1 -1
- package/dist/maplibre-gl-csp-worker.js.map +1 -1
- package/dist/maplibre-gl-csp.js +1 -1
- package/dist/maplibre-gl-csp.js.map +1 -1
- package/dist/maplibre-gl-dev.js +2101 -1843
- package/dist/maplibre-gl-dev.js.map +1 -0
- package/dist/maplibre-gl.d.ts +239 -70
- package/dist/maplibre-gl.js +4 -4
- package/dist/maplibre-gl.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/style-spec/index.d.ts +9 -6
- package/package.json +63 -63
- package/src/data/feature_index.ts +1 -1
- package/src/index.ts +0 -22
- package/src/render/glyph_manager.ts +5 -0
- package/src/render/image_manager.ts +35 -16
- package/src/render/painter.ts +4 -7
- package/src/source/geojson_source.test.ts +21 -1
- package/src/source/geojson_source.ts +61 -3
- package/src/source/image_source.ts +3 -2
- package/src/source/load_tilejson.ts +2 -1
- package/src/source/raster_dem_tile_source.ts +3 -2
- package/src/source/raster_tile_source.ts +4 -6
- package/src/source/terrain_source_cache.test.ts +4 -5
- package/src/source/vector_tile_source.test.ts +1 -1
- package/src/source/vector_tile_source.ts +1 -4
- package/src/source/video_source.ts +2 -1
- package/src/source/worker.ts +0 -5
- package/src/source/worker_tile.ts +1 -1
- package/src/style/load_glyph_range.ts +2 -1
- package/src/style/load_sprite.test.ts +209 -0
- package/src/style/load_sprite.ts +62 -35
- package/src/style/properties.ts +6 -6
- package/src/style/style.test.ts +213 -1
- package/src/style/style.ts +194 -12
- package/src/style/style_image.ts +10 -1
- package/src/style/validate_style.ts +2 -0
- package/src/style-spec/CHANGELOG.md +4 -0
- package/src/style-spec/README.md +0 -8
- package/src/style-spec/bin/{gl-style-format → gl-style-format.js} +7 -7
- package/src/style-spec/bin/gl-style-migrate.js +18 -0
- package/src/style-spec/bin/gl-style-validate.js +45 -0
- package/src/style-spec/expression/types.ts +1 -1
- package/src/style-spec/feature_filter/feature_filter.test.ts +5 -0
- package/src/style-spec/package.json +4 -5
- package/src/style-spec/reference/v8.json +3 -3
- package/src/style-spec/style-spec.test.ts +2 -1
- package/src/style-spec/style-spec.ts +0 -2
- package/src/style-spec/types.g.ts +4 -2
- package/src/style-spec/validate/validate.ts +4 -1
- package/src/style-spec/validate/validate_array.ts +3 -3
- package/src/style-spec/validate/validate_function.ts +8 -3
- package/src/style-spec/validate/validate_layer.ts +5 -2
- package/src/style-spec/validate/validate_light.ts +4 -4
- package/src/style-spec/validate/validate_object.ts +3 -2
- package/src/style-spec/validate/validate_padding.test.ts +20 -19
- package/src/style-spec/validate/validate_padding.ts +2 -2
- package/src/style-spec/validate/validate_property.ts +3 -3
- package/src/style-spec/validate/validate_source.ts +9 -1
- package/src/style-spec/validate/validate_sprite.test.ts +75 -0
- package/src/style-spec/validate/validate_sprite.ts +55 -0
- package/src/style-spec/validate/validate_terrain.test.ts +6 -5
- package/src/style-spec/validate/validate_terrain.ts +3 -3
- package/src/style-spec/validate_style.min.ts +24 -10
- package/src/ui/camera.ts +1 -1
- package/src/ui/control/fullscreen_control.test.ts +24 -0
- package/src/ui/control/fullscreen_control.ts +26 -1
- package/src/ui/handler/scroll_zoom.test.ts +24 -0
- package/src/ui/handler/scroll_zoom.ts +15 -5
- package/src/ui/handler_manager.ts +51 -36
- package/src/ui/map.test.ts +24 -0
- package/src/ui/map.ts +116 -14
- package/src/util/ajax.test.ts +1 -129
- package/src/util/ajax.ts +3 -168
- package/src/util/browser.ts +7 -2
- package/src/util/config.ts +2 -0
- package/src/util/dispatcher.test.ts +35 -12
- package/src/util/dispatcher.ts +7 -7
- package/src/util/dom.ts +2 -2
- package/src/util/image_request.test.ts +486 -0
- package/src/util/image_request.ts +221 -0
- package/src/util/primitives.ts +1 -1
- package/src/util/request_manager.ts +16 -5
- package/src/util/style.test.ts +19 -0
- package/src/util/style.ts +12 -0
- package/src/util/test/util.ts +3 -0
- package/src/util/util.ts +47 -2
- package/build/generate-debug-index-file.ts +0 -20
- package/build/generate-query-test-fixtures.ts +0 -124
- package/postinstall.js +0 -1
- package/src/style-spec/bin/gl-style-composite +0 -9
- package/src/style-spec/bin/gl-style-migrate +0 -9
- package/src/style-spec/bin/gl-style-validate +0 -42
- package/src/style-spec/composite.test.ts +0 -107
- package/src/style-spec/composite.ts +0 -51
- package/src/util/tile_request_cache.test.ts +0 -101
- 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.txt)[](https://www.npmjs.com/package/maplibre-gl)[](https://github.com/maplibre/maplibre-gl-js/actions/workflows/ci.yml)[](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
|
|
1
|
+
import packageJSON from '../package.json' assert {type: 'json'};
|
|
2
2
|
|
|
3
|
-
|
|
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
|
+
)
|
|
@@ -29,6 +29,8 @@ function nativeType(property) {
|
|
|
29
29
|
return 'Color';
|
|
30
30
|
case 'padding':
|
|
31
31
|
return 'Padding';
|
|
32
|
+
case 'sprite':
|
|
33
|
+
return 'Sprite';
|
|
32
34
|
case 'formatted':
|
|
33
35
|
return 'Formatted';
|
|
34
36
|
case 'resolvedImage':
|
|
@@ -91,6 +93,8 @@ function runtimeType(property) {
|
|
|
91
93
|
return 'ColorType';
|
|
92
94
|
case 'padding':
|
|
93
95
|
return 'PaddingType';
|
|
96
|
+
case 'sprite':
|
|
97
|
+
return 'SpriteType';
|
|
94
98
|
case 'formatted':
|
|
95
99
|
return 'FormattedType';
|
|
96
100
|
case 'Image':
|
|
@@ -122,6 +122,8 @@ export type ColorSpecification = string;
|
|
|
122
122
|
|
|
123
123
|
export type PaddingSpecification = number | number[];
|
|
124
124
|
|
|
125
|
+
export type SpriteSpecification = string | {id: string; url: string}[];
|
|
126
|
+
|
|
125
127
|
export type FormattedSpecification = string;
|
|
126
128
|
|
|
127
129
|
export type ResolvedImageSpecification = string;
|
|
@@ -174,7 +176,7 @@ export type ExpressionSpecification =
|
|
|
174
176
|
| ['in', ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification]
|
|
175
177
|
| ['index-of', ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification] // number
|
|
176
178
|
| ['length', string | ExpressionSpecification]
|
|
177
|
-
| ['slice', string | ExpressionSpecification, number | ExpressionSpecification]
|
|
179
|
+
| ['slice', string | ExpressionSpecification, number | ExpressionSpecification, (number | ExpressionSpecification)?]
|
|
178
180
|
// Decision
|
|
179
181
|
| ['!', boolean | ExpressionSpecification] // boolean
|
|
180
182
|
| ['!=', ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, CollatorExpressionSpecification?] // boolean
|
|
@@ -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;
|