maplibre-gl 2.2.0 → 2.2.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/build/generate-typings.ts +1 -1
- package/dist/maplibre-gl-csp-worker.js +1 -1
- package/dist/maplibre-gl-dev.js +6 -9
- package/dist/maplibre-gl.d.ts +9 -9
- package/dist/maplibre-gl.js +3 -3
- package/package.json +1 -1
- package/src/source/worker.ts +2 -4
- package/src/style-spec/reference/latest.ts +1 -1
- package/src/style-spec/style-spec.ts +11 -10
- package/src/util/util.ts +2 -3
package/package.json
CHANGED
package/src/source/worker.ts
CHANGED
|
@@ -7,6 +7,7 @@ import GeoJSONWorkerSource from './geojson_worker_source';
|
|
|
7
7
|
import assert from 'assert';
|
|
8
8
|
import {plugin as globalRTLTextPlugin} from './rtl_text_plugin';
|
|
9
9
|
import {enforceCacheSizeLimit} from '../util/tile_request_cache';
|
|
10
|
+
import {isWorker} from '../util/util';
|
|
10
11
|
|
|
11
12
|
import type {
|
|
12
13
|
WorkerSource,
|
|
@@ -267,9 +268,6 @@ export default class Worker {
|
|
|
267
268
|
}
|
|
268
269
|
}
|
|
269
270
|
|
|
270
|
-
|
|
271
|
-
if (typeof WorkerGlobalScope !== 'undefined' &&
|
|
272
|
-
typeof self !== 'undefined' &&
|
|
273
|
-
self instanceof WorkerGlobalScope) {
|
|
271
|
+
if (isWorker()) {
|
|
274
272
|
(self as any).worker = new Worker(self as any);
|
|
275
273
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
type ExpressionType = 'data-driven' | 'cross-faded' | 'cross-faded-data-driven' | 'color-ramp' | 'data-constant' | 'constant';
|
|
2
2
|
type ExpressionParameters = Array<'zoom' | 'feature' | 'feature-state' | 'heatmap-density' | 'line-progress'>;
|
|
3
3
|
|
|
4
|
-
type
|
|
4
|
+
type ExpressionSpecificationDefinition = {
|
|
5
5
|
interpolated: boolean;
|
|
6
6
|
parameters: ExpressionParameters;
|
|
7
7
|
};
|
|
@@ -9,33 +9,33 @@ type ExpressionSpecification = {
|
|
|
9
9
|
export type StylePropertySpecification = {
|
|
10
10
|
type: 'number';
|
|
11
11
|
'property-type': ExpressionType;
|
|
12
|
-
expression?:
|
|
12
|
+
expression?: ExpressionSpecificationDefinition;
|
|
13
13
|
transition: boolean;
|
|
14
14
|
default?: number;
|
|
15
15
|
} | {
|
|
16
16
|
type: 'string';
|
|
17
17
|
'property-type': ExpressionType;
|
|
18
|
-
expression?:
|
|
18
|
+
expression?: ExpressionSpecificationDefinition;
|
|
19
19
|
transition: boolean;
|
|
20
20
|
default?: string;
|
|
21
21
|
tokens?: boolean;
|
|
22
22
|
} | {
|
|
23
23
|
type: 'boolean';
|
|
24
24
|
'property-type': ExpressionType;
|
|
25
|
-
expression?:
|
|
25
|
+
expression?: ExpressionSpecificationDefinition;
|
|
26
26
|
transition: boolean;
|
|
27
27
|
default?: boolean;
|
|
28
28
|
} | {
|
|
29
29
|
type: 'enum';
|
|
30
30
|
'property-type': ExpressionType;
|
|
31
|
-
expression?:
|
|
31
|
+
expression?: ExpressionSpecificationDefinition;
|
|
32
32
|
values: {[_: string]: {}};
|
|
33
33
|
transition: boolean;
|
|
34
34
|
default?: string;
|
|
35
35
|
} | {
|
|
36
36
|
type: 'color';
|
|
37
37
|
'property-type': ExpressionType;
|
|
38
|
-
expression?:
|
|
38
|
+
expression?: ExpressionSpecificationDefinition;
|
|
39
39
|
transition: boolean;
|
|
40
40
|
default?: string;
|
|
41
41
|
overridable: boolean;
|
|
@@ -43,7 +43,7 @@ export type StylePropertySpecification = {
|
|
|
43
43
|
type: 'array';
|
|
44
44
|
value: 'number';
|
|
45
45
|
'property-type': ExpressionType;
|
|
46
|
-
expression?:
|
|
46
|
+
expression?: ExpressionSpecificationDefinition;
|
|
47
47
|
length?: number;
|
|
48
48
|
transition: boolean;
|
|
49
49
|
default?: Array<number>;
|
|
@@ -51,19 +51,20 @@ export type StylePropertySpecification = {
|
|
|
51
51
|
type: 'array';
|
|
52
52
|
value: 'string';
|
|
53
53
|
'property-type': ExpressionType;
|
|
54
|
-
expression?:
|
|
54
|
+
expression?: ExpressionSpecificationDefinition;
|
|
55
55
|
length?: number;
|
|
56
56
|
transition: boolean;
|
|
57
57
|
default?: Array<string>;
|
|
58
58
|
} | {
|
|
59
59
|
type: 'padding';
|
|
60
60
|
'property-type': ExpressionType;
|
|
61
|
-
expression?:
|
|
61
|
+
expression?: ExpressionSpecificationDefinition;
|
|
62
62
|
transition: boolean;
|
|
63
63
|
default?: number | Array<number>;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
import
|
|
66
|
+
import v8Spec from './reference/v8.json' assert {type: 'json'};
|
|
67
|
+
const v8 = v8Spec as any;
|
|
67
68
|
import latest from './reference/latest';
|
|
68
69
|
import format from './format';
|
|
69
70
|
import migrate from './migrate';
|
package/src/util/util.ts
CHANGED
|
@@ -384,7 +384,6 @@ export function sphericalToCartesian([r, azimuthal, polar]: [number, number, num
|
|
|
384
384
|
};
|
|
385
385
|
}
|
|
386
386
|
|
|
387
|
-
/* global self, WorkerGlobalScope */
|
|
388
387
|
/**
|
|
389
388
|
* Returns true if the when run in the web-worker context.
|
|
390
389
|
*
|
|
@@ -392,8 +391,8 @@ export function sphericalToCartesian([r, azimuthal, polar]: [number, number, num
|
|
|
392
391
|
* @returns {boolean}
|
|
393
392
|
*/
|
|
394
393
|
export function isWorker(): boolean {
|
|
395
|
-
|
|
396
|
-
|
|
394
|
+
// @ts-ignore
|
|
395
|
+
return typeof WorkerGlobalScope !== 'undefined' && typeof self !== 'undefined' && self instanceof WorkerGlobalScope;
|
|
397
396
|
}
|
|
398
397
|
|
|
399
398
|
/**
|