maplibre-gl 3.3.0 → 3.3.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.
- package/LICENSE.txt +1 -1
- package/README.md +2 -1
- package/build/generate-dist-package.js +7 -2
- package/build/generate-typings.ts +1 -1
- package/dist/LICENSE.txt +116 -0
- 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 +57 -36
- package/dist/maplibre-gl-dev.js.map +1 -1
- package/dist/maplibre-gl.d.ts +14 -9
- package/dist/maplibre-gl.js +3 -3
- package/dist/maplibre-gl.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +22 -21
- package/src/render/program.ts +15 -0
- package/src/source/vector_tile_source.ts +0 -1
- package/src/source/video_source.ts +4 -0
- package/src/style/style.ts +14 -8
- package/src/style/style_layer/variable_text_anchor.ts +1 -1
- package/src/ui/control/navigation_control.ts +0 -1
- package/src/ui/map.test.ts +37 -8
- package/src/ui/map.ts +14 -13
- package/src/ui/marker.ts +1 -1
- package/src/ui/popup.ts +1 -1
- package/src/util/throttle.ts +7 -3
package/dist/maplibre-gl-dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v3.3.
|
|
1
|
+
/* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v3.3.1/LICENSE.txt */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -30249,7 +30249,7 @@ function evaluateVariableOffset(anchor, offset) {
|
|
|
30249
30249
|
if (radialOffset < 0)
|
|
30250
30250
|
radialOffset = 0; // Ignore negative offset.
|
|
30251
30251
|
// solve for r where r^2 + r^2 = radialOffset^2
|
|
30252
|
-
const hypotenuse = radialOffset / Math.
|
|
30252
|
+
const hypotenuse = radialOffset / Math.SQRT2;
|
|
30253
30253
|
switch (anchor) {
|
|
30254
30254
|
case 'top-right':
|
|
30255
30255
|
case 'top-left':
|
|
@@ -34029,7 +34029,7 @@ define(['./shared'], (function (performance) { 'use strict';
|
|
|
34029
34029
|
|
|
34030
34030
|
var name = "maplibre-gl";
|
|
34031
34031
|
var description = "BSD licensed community fork of mapbox-gl, a WebGL interactive maps library";
|
|
34032
|
-
var version$2 = "3.3.
|
|
34032
|
+
var version$2 = "3.3.1";
|
|
34033
34033
|
var main = "dist/maplibre-gl.js";
|
|
34034
34034
|
var style = "dist/maplibre-gl.css";
|
|
34035
34035
|
var license = "BSD-3-Clause";
|
|
@@ -34070,13 +34070,13 @@ var dependencies = {
|
|
|
34070
34070
|
var devDependencies = {
|
|
34071
34071
|
"@mapbox/mapbox-gl-rtl-text": "^0.2.3",
|
|
34072
34072
|
"@mapbox/mvt-fixtures": "^3.10.0",
|
|
34073
|
-
"@rollup/plugin-commonjs": "^25.0.
|
|
34073
|
+
"@rollup/plugin-commonjs": "^25.0.4",
|
|
34074
34074
|
"@rollup/plugin-json": "^6.0.0",
|
|
34075
|
-
"@rollup/plugin-node-resolve": "^15.1
|
|
34075
|
+
"@rollup/plugin-node-resolve": "^15.2.1",
|
|
34076
34076
|
"@rollup/plugin-replace": "^5.0.2",
|
|
34077
34077
|
"@rollup/plugin-strip": "^3.0.2",
|
|
34078
34078
|
"@rollup/plugin-terser": "^0.4.3",
|
|
34079
|
-
"@rollup/plugin-typescript": "^11.1.
|
|
34079
|
+
"@rollup/plugin-typescript": "^11.1.3",
|
|
34080
34080
|
"@types/benchmark": "^2.1.2",
|
|
34081
34081
|
"@types/cssnano": "^5.0.0",
|
|
34082
34082
|
"@types/d3": "^7.4.0",
|
|
@@ -34086,38 +34086,38 @@ var devDependencies = {
|
|
|
34086
34086
|
"@types/gl": "^6.0.2",
|
|
34087
34087
|
"@types/glob": "^8.1.0",
|
|
34088
34088
|
"@types/jest": "^29.5.3",
|
|
34089
|
-
"@types/jsdom": "^21.1.
|
|
34089
|
+
"@types/jsdom": "^21.1.2",
|
|
34090
34090
|
"@types/minimist": "^1.2.2",
|
|
34091
34091
|
"@types/murmurhash-js": "^1.0.4",
|
|
34092
34092
|
"@types/nise": "^1.4.1",
|
|
34093
|
-
"@types/node": "^20.
|
|
34093
|
+
"@types/node": "^20.5.7",
|
|
34094
34094
|
"@types/offscreencanvas": "^2019.7.0",
|
|
34095
34095
|
"@types/pixelmatch": "^5.2.4",
|
|
34096
34096
|
"@types/pngjs": "^6.0.1",
|
|
34097
|
-
"@types/react": "^18.2.
|
|
34097
|
+
"@types/react": "^18.2.21",
|
|
34098
34098
|
"@types/react-dom": "^18.2.7",
|
|
34099
34099
|
"@types/request": "^2.48.8",
|
|
34100
34100
|
"@types/shuffle-seed": "^1.1.0",
|
|
34101
34101
|
"@types/window-or-global": "^1.0.4",
|
|
34102
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
34103
|
-
"@typescript-eslint/parser": "^6.
|
|
34102
|
+
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
|
34103
|
+
"@typescript-eslint/parser": "^6.4.1",
|
|
34104
34104
|
address: "^1.2.2",
|
|
34105
34105
|
benchmark: "^2.1.4",
|
|
34106
34106
|
canvas: "^2.11.2",
|
|
34107
34107
|
cssnano: "^6.0.1",
|
|
34108
34108
|
d3: "^7.8.5",
|
|
34109
34109
|
"d3-queue": "^3.0.7",
|
|
34110
|
-
"devtools-protocol": "^0.0.
|
|
34110
|
+
"devtools-protocol": "^0.0.1188743",
|
|
34111
34111
|
diff: "^5.1.0",
|
|
34112
34112
|
"dts-bundle-generator": "^8.0.1",
|
|
34113
|
-
eslint: "^8.
|
|
34113
|
+
eslint: "^8.48.0",
|
|
34114
34114
|
"eslint-config-mourner": "^3.0.0",
|
|
34115
34115
|
"eslint-plugin-html": "^7.1.0",
|
|
34116
|
-
"eslint-plugin-import": "^2.28.
|
|
34116
|
+
"eslint-plugin-import": "^2.28.1",
|
|
34117
34117
|
"eslint-plugin-jest": "^27.2.3",
|
|
34118
|
-
"eslint-plugin-react": "^7.33.
|
|
34118
|
+
"eslint-plugin-react": "^7.33.2",
|
|
34119
34119
|
"eslint-plugin-tsdoc": "0.2.17",
|
|
34120
|
-
expect: "^29.6.
|
|
34120
|
+
expect: "^29.6.4",
|
|
34121
34121
|
gl: "^6.0.2",
|
|
34122
34122
|
glob: "^10.3.3",
|
|
34123
34123
|
"is-builtin-module": "^3.2.1",
|
|
@@ -34135,28 +34135,28 @@ var devDependencies = {
|
|
|
34135
34135
|
"pdf-merger-js": "^4.3.0",
|
|
34136
34136
|
pixelmatch: "^5.3.0",
|
|
34137
34137
|
pngjs: "^7.0.0",
|
|
34138
|
-
postcss: "^8.4.
|
|
34138
|
+
postcss: "^8.4.28",
|
|
34139
34139
|
"postcss-cli": "^10.1.0",
|
|
34140
34140
|
"postcss-inline-svg": "^6.0.0",
|
|
34141
34141
|
"pretty-bytes": "^6.1.1",
|
|
34142
|
-
puppeteer: "^21.0
|
|
34142
|
+
puppeteer: "^21.1.0",
|
|
34143
34143
|
react: "^18.2.0",
|
|
34144
34144
|
"react-dom": "^18.2.0",
|
|
34145
|
-
rollup: "^3.
|
|
34145
|
+
rollup: "^3.28.1",
|
|
34146
34146
|
"rollup-plugin-sourcemaps": "^0.6.3",
|
|
34147
34147
|
rw: "^1.3.3",
|
|
34148
34148
|
semver: "^7.5.4",
|
|
34149
34149
|
"shuffle-seed": "^1.1.6",
|
|
34150
34150
|
"source-map-explorer": "^2.5.3",
|
|
34151
34151
|
st: "^3.0.0",
|
|
34152
|
-
stylelint: "^15.10.
|
|
34152
|
+
stylelint: "^15.10.3",
|
|
34153
34153
|
"stylelint-config-standard": "^34.0.0",
|
|
34154
34154
|
"ts-jest": "^29.1.1",
|
|
34155
34155
|
"ts-node": "^10.9.1",
|
|
34156
|
-
tslib: "^2.6.
|
|
34156
|
+
tslib: "^2.6.2",
|
|
34157
34157
|
typedoc: "^0.24.8",
|
|
34158
|
-
"typedoc-plugin-markdown": "^3.
|
|
34159
|
-
"typedoc-plugin-missing-exports": "^2.0
|
|
34158
|
+
"typedoc-plugin-markdown": "^3.16.0",
|
|
34159
|
+
"typedoc-plugin-missing-exports": "^2.1.0",
|
|
34160
34160
|
typescript: "^5.1.6"
|
|
34161
34161
|
};
|
|
34162
34162
|
var overrides = {
|
|
@@ -34187,6 +34187,7 @@ var scripts = {
|
|
|
34187
34187
|
"build-benchmarks": "npm run build-dev && rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts",
|
|
34188
34188
|
"watch-benchmarks": "rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts --watch",
|
|
34189
34189
|
"start-server": "st --no-cache -H 0.0.0.0 --port 9966 .",
|
|
34190
|
+
"start-docs": "docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material",
|
|
34190
34191
|
start: "run-p watch-css watch-dev start-server",
|
|
34191
34192
|
"start-bench": "run-p watch-css watch-benchmarks start-server",
|
|
34192
34193
|
lint: "eslint --cache --ext .ts,.tsx,.js,.html --ignore-path .gitignore .",
|
|
@@ -36059,7 +36060,6 @@ class TileBounds {
|
|
|
36059
36060
|
* map.getSource('some id').setTiles(['https://d25uarhxywzl1j.cloudfront.net/v0.1/{z}/{x}/{y}.mvt']);
|
|
36060
36061
|
* ```
|
|
36061
36062
|
* @see [Add a vector tile source](https://maplibre.org/maplibre-gl-js/docs/examples/vector-source/)
|
|
36062
|
-
* @see [Add a third party vector tile source](https://maplibre.org/maplibre-gl-js/docs/examples/third-party/)
|
|
36063
36063
|
*/
|
|
36064
36064
|
class VectorTileSource extends performance.Evented {
|
|
36065
36065
|
constructor(id, options, dispatcher, eventedParent) {
|
|
@@ -37089,6 +37089,10 @@ function getCoordinatesCenterTileID(coords) {
|
|
|
37089
37089
|
* map.removeSource('some id'); // remove
|
|
37090
37090
|
* ```
|
|
37091
37091
|
* @see [Add a video](https://maplibre.org/maplibre-gl-js/docs/examples/video-on-a-map/)
|
|
37092
|
+
*
|
|
37093
|
+
* Note that when rendered as a raster layer, the layer's `raster-fade-duration` property will cause the video to fade in.
|
|
37094
|
+
* This happens when playback is started, paused and resumed, or when the video's coordinates are updated. To avoid this behavior,
|
|
37095
|
+
* set the layer's `raster-fade-duration` property to `0`.
|
|
37092
37096
|
*/
|
|
37093
37097
|
class VideoSource extends ImageSource {
|
|
37094
37098
|
constructor(id, options, dispatcher, eventedParent) {
|
|
@@ -41640,6 +41644,7 @@ class Style extends performance.Evented {
|
|
|
41640
41644
|
this._load(empty, { validate: false });
|
|
41641
41645
|
}
|
|
41642
41646
|
_load(json, options, previousStyle) {
|
|
41647
|
+
var _a;
|
|
41643
41648
|
const nextState = options.transformStyle ? options.transformStyle(previousStyle, json) : json;
|
|
41644
41649
|
if (options.validate && emitValidationErrors(this, performance.validateStyle(nextState))) {
|
|
41645
41650
|
return;
|
|
@@ -41658,7 +41663,7 @@ class Style extends performance.Evented {
|
|
|
41658
41663
|
this.glyphManager.setURL(nextState.glyphs);
|
|
41659
41664
|
this._createLayers();
|
|
41660
41665
|
this.light = new Light(this.stylesheet.light);
|
|
41661
|
-
this.map.setTerrain(this.stylesheet.terrain);
|
|
41666
|
+
this.map.setTerrain((_a = this.stylesheet.terrain) !== null && _a !== void 0 ? _a : null);
|
|
41662
41667
|
this.fire(new performance.Event('data', { dataType: 'style' }));
|
|
41663
41668
|
this.fire(new performance.Event('style.load'));
|
|
41664
41669
|
}
|
|
@@ -42076,7 +42081,7 @@ class Style extends performance.Evented {
|
|
|
42076
42081
|
layer = performance.createStyleLayer(layerObject);
|
|
42077
42082
|
}
|
|
42078
42083
|
else {
|
|
42079
|
-
if (typeof layerObject.source === 'object') {
|
|
42084
|
+
if ('source' in layerObject && typeof layerObject.source === 'object') {
|
|
42080
42085
|
this.addSource(id, layerObject.source);
|
|
42081
42086
|
layerObject = performance.clone$1(layerObject);
|
|
42082
42087
|
layerObject = performance.extend(layerObject, { source: id });
|
|
@@ -43277,6 +43282,9 @@ class Program {
|
|
|
43277
43282
|
}
|
|
43278
43283
|
gl.shaderSource(fragmentShader, fragmentSource);
|
|
43279
43284
|
gl.compileShader(fragmentShader);
|
|
43285
|
+
if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {
|
|
43286
|
+
throw new Error(`Could not compile fragment shader: ${gl.getShaderInfoLog(fragmentShader)}`);
|
|
43287
|
+
}
|
|
43280
43288
|
gl.attachShader(this.program, fragmentShader);
|
|
43281
43289
|
const vertexShader = gl.createShader(gl.VERTEX_SHADER);
|
|
43282
43290
|
if (gl.isContextLost()) {
|
|
@@ -43285,6 +43293,9 @@ class Program {
|
|
|
43285
43293
|
}
|
|
43286
43294
|
gl.shaderSource(vertexShader, vertexSource);
|
|
43287
43295
|
gl.compileShader(vertexShader);
|
|
43296
|
+
if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {
|
|
43297
|
+
throw new Error(`Could not compile vertex shader: ${gl.getShaderInfoLog(vertexShader)}`);
|
|
43298
|
+
}
|
|
43288
43299
|
gl.attachShader(this.program, vertexShader);
|
|
43289
43300
|
this.attributes = {};
|
|
43290
43301
|
const uniformLocations = {};
|
|
@@ -43296,6 +43307,9 @@ class Program {
|
|
|
43296
43307
|
}
|
|
43297
43308
|
}
|
|
43298
43309
|
gl.linkProgram(this.program);
|
|
43310
|
+
if (!gl.getProgramParameter(this.program, gl.LINK_STATUS)) {
|
|
43311
|
+
throw new Error(`Program failed to link: ${gl.getProgramInfoLog(this.program)}`);
|
|
43312
|
+
}
|
|
43299
43313
|
gl.deleteShader(vertexShader);
|
|
43300
43314
|
gl.deleteShader(fragmentShader);
|
|
43301
43315
|
for (let it = 0; it < allUniformsInfo.length; it++) {
|
|
@@ -47535,16 +47549,20 @@ class Transform {
|
|
|
47535
47549
|
function throttle(fn, time) {
|
|
47536
47550
|
let pending = false;
|
|
47537
47551
|
let timerId = null;
|
|
47552
|
+
let lastCallContext = null;
|
|
47553
|
+
let lastCallArgs;
|
|
47538
47554
|
const later = () => {
|
|
47539
47555
|
timerId = null;
|
|
47540
47556
|
if (pending) {
|
|
47541
|
-
fn();
|
|
47557
|
+
fn.apply(lastCallContext, lastCallArgs);
|
|
47542
47558
|
timerId = setTimeout(later, time);
|
|
47543
47559
|
pending = false;
|
|
47544
47560
|
}
|
|
47545
47561
|
};
|
|
47546
|
-
return () => {
|
|
47562
|
+
return (...args) => {
|
|
47547
47563
|
pending = true;
|
|
47564
|
+
lastCallContext = this;
|
|
47565
|
+
lastCallArgs = args;
|
|
47548
47566
|
if (!timerId) {
|
|
47549
47567
|
later();
|
|
47550
47568
|
}
|
|
@@ -52356,14 +52374,17 @@ let Map$1 = class Map extends Camera {
|
|
|
52356
52374
|
if (typeof window !== 'undefined') {
|
|
52357
52375
|
addEventListener('online', this._onWindowOnline, false);
|
|
52358
52376
|
let initialResizeEventCaptured = false;
|
|
52377
|
+
const throttledResizeCallback = throttle((entries) => {
|
|
52378
|
+
if (this._trackResize && !this._removed) {
|
|
52379
|
+
this.resize(entries)._update();
|
|
52380
|
+
}
|
|
52381
|
+
}, 50);
|
|
52359
52382
|
this._resizeObserver = new ResizeObserver((entries) => {
|
|
52360
52383
|
if (!initialResizeEventCaptured) {
|
|
52361
52384
|
initialResizeEventCaptured = true;
|
|
52362
52385
|
return;
|
|
52363
52386
|
}
|
|
52364
|
-
|
|
52365
|
-
this.resize(entries)._update();
|
|
52366
|
-
}
|
|
52387
|
+
throttledResizeCallback(entries);
|
|
52367
52388
|
});
|
|
52368
52389
|
this._resizeObserver.observe(this._container);
|
|
52369
52390
|
}
|
|
@@ -53455,7 +53476,8 @@ let Map$1 = class Map extends Camera {
|
|
|
53455
53476
|
* ```
|
|
53456
53477
|
*/
|
|
53457
53478
|
getTerrain() {
|
|
53458
|
-
|
|
53479
|
+
var _a, _b;
|
|
53480
|
+
return (_b = (_a = this.terrain) === null || _a === void 0 ? void 0 : _a.options) !== null && _b !== void 0 ? _b : null;
|
|
53459
53481
|
}
|
|
53460
53482
|
/**
|
|
53461
53483
|
* Returns a Boolean indicating whether all tiles in the viewport from all sources on
|
|
@@ -53744,7 +53766,7 @@ let Map$1 = class Map extends Camera {
|
|
|
53744
53766
|
*
|
|
53745
53767
|
* @param layer - The layer to add,
|
|
53746
53768
|
* conforming to either the MapLibre Style Specification's [layer definition](https://maplibre.org/maplibre-style-spec/layers) or,
|
|
53747
|
-
* less commonly, the {@link CustomLayerInterface} specification.
|
|
53769
|
+
* less commonly, the {@link CustomLayerInterface} specification. Can also be a layer definition with an embedded source definition.
|
|
53748
53770
|
* The MapLibre Style Specification's layer definition is appropriate for most layers.
|
|
53749
53771
|
*
|
|
53750
53772
|
* @param beforeId - The ID of an existing layer to insert the new layer before,
|
|
@@ -54748,7 +54770,6 @@ const defaultOptions$3 = {
|
|
|
54748
54770
|
* map.addControl(nav, 'top-left');
|
|
54749
54771
|
* ```
|
|
54750
54772
|
* @see [Display map navigation controls](https://maplibre.org/maplibre-gl-js/docs/examples/navigation/)
|
|
54751
|
-
* @see [Add a third party vector tile source](https://maplibre.org/maplibre-gl-js/docs/examples/third-party/)
|
|
54752
54773
|
*/
|
|
54753
54774
|
class NavigationControl {
|
|
54754
54775
|
/**
|
|
@@ -55448,7 +55469,7 @@ class Marker extends performance.Evented {
|
|
|
55448
55469
|
if (!('offset' in popup.options)) {
|
|
55449
55470
|
const markerHeight = 41 - (5.8 / 2);
|
|
55450
55471
|
const markerRadius = 13.5;
|
|
55451
|
-
const linearOffset = Math.
|
|
55472
|
+
const linearOffset = Math.abs(markerRadius) / Math.SQRT2;
|
|
55452
55473
|
popup.options.offset = this._defaultMarker ? {
|
|
55453
55474
|
'top': [0, 0],
|
|
55454
55475
|
'top-left': [0, 0],
|
|
@@ -57021,7 +57042,7 @@ function normalizeOffset(offset) {
|
|
|
57021
57042
|
}
|
|
57022
57043
|
else if (typeof offset === 'number') {
|
|
57023
57044
|
// input specifies a radius from which to calculate offsets at all positions
|
|
57024
|
-
const cornerOffset = Math.round(Math.
|
|
57045
|
+
const cornerOffset = Math.round(Math.abs(offset) / Math.SQRT2);
|
|
57025
57046
|
return {
|
|
57026
57047
|
'center': new performance.Point(0, 0),
|
|
57027
57048
|
'top': new performance.Point(0, offset),
|