@mapbox/mapbox-gl-style-spec 13.19.1 → 13.20.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/CHANGELOG.md +14 -3
- package/diff.js +9 -1
- package/dist/index.cjs +15123 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.es.js +149 -10
- package/dist/index.es.js.map +1 -1
- package/flow-typed/gl.js +5 -0
- package/flow-typed/jsdom.js +18 -0
- package/flow-typed/mapbox-gl-supported.js +16 -0
- package/flow-typed/mapbox-unitbezier.js +14 -0
- package/flow-typed/offscreen-canvas.js +9 -0
- package/flow-typed/pbf.js +25 -0
- package/flow-typed/point-geometry.js +44 -0
- package/flow-typed/potpack.js +12 -0
- package/flow-typed/sinon.js +28 -0
- package/flow-typed/vector-tile.js +41 -0
- package/package.json +13 -4
- package/reference/v8.json +92 -8
- package/rollup.config.js +1 -1
- package/types.js +10 -3
- package/validate/validate.js +2 -0
- package/validate/validate_fog.js +46 -0
- package/validate_mapbox_api_supported.js +10 -2
- package/validate_style.min.js +2 -0
- package/dist/index.js.map +0 -1
package/flow-typed/gl.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import type Window from '../src/types/window';
|
|
4
|
+
|
|
5
|
+
declare module "jsdom" {
|
|
6
|
+
declare class JSDOM {
|
|
7
|
+
constructor(content: string, options: Object): JSDOM;
|
|
8
|
+
window: Window;
|
|
9
|
+
}
|
|
10
|
+
declare class VirtualConsole {
|
|
11
|
+
constructor(): VirtualConsole;
|
|
12
|
+
sendTo(console: typeof console): VirtualConsole;
|
|
13
|
+
}
|
|
14
|
+
declare module.exports: {
|
|
15
|
+
JSDOM: typeof JSDOM,
|
|
16
|
+
VirtualConsole: typeof VirtualConsole
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
'use strict';
|
|
3
|
+
declare module "@mapbox/mapbox-gl-supported" {
|
|
4
|
+
declare type SupportedOptions = {failIfMajorPerformanceCaveat: boolean};
|
|
5
|
+
|
|
6
|
+
declare type SupportedFn = {
|
|
7
|
+
(options?: SupportedOptions): boolean,
|
|
8
|
+
webGLContextAttributes: WebGLContextAttributes
|
|
9
|
+
};
|
|
10
|
+
declare function notSupportedReason(options?: SupportedOptions): ?string;
|
|
11
|
+
|
|
12
|
+
declare module.exports: {
|
|
13
|
+
supported: SupportedFn;
|
|
14
|
+
notSupportedReason: typeof notSupportedReason;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// @flow
|
|
3
|
+
|
|
4
|
+
declare module "@mapbox/unitbezier" {
|
|
5
|
+
declare class UnitBezier {
|
|
6
|
+
constructor(p1x: number, p1y: number, p2x: number, p2y: number): UnitBezier;
|
|
7
|
+
sampleCurveX(t: number): number;
|
|
8
|
+
sampleCurveY(t: number): number;
|
|
9
|
+
sampleCurveDerivativeX(t: number): number;
|
|
10
|
+
solveCurveX(x: number, epsilon: number | void): number;
|
|
11
|
+
solve(x: number, epsilon: number | void): number;
|
|
12
|
+
}
|
|
13
|
+
declare module.exports: typeof UnitBezier;
|
|
14
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare module "pbf" {
|
|
2
|
+
declare type ReadFunction<T> = (tag: number, result: T, pbf: Pbf) => void;
|
|
3
|
+
|
|
4
|
+
declare class Pbf {
|
|
5
|
+
constructor(buf?: ArrayBuffer | Uint8Array): Pbf;
|
|
6
|
+
|
|
7
|
+
readFields<T>(readField: ReadFunction<T>, result: T, end?: number): T;
|
|
8
|
+
readMessage<T>(readField: ReadFunction<T>, result: T): T;
|
|
9
|
+
|
|
10
|
+
readFixed32(): number;
|
|
11
|
+
readSFixed32(): number;
|
|
12
|
+
readFixed64(): number;
|
|
13
|
+
readSFixed64(): number;
|
|
14
|
+
readFloat(): number;
|
|
15
|
+
readDouble(): number;
|
|
16
|
+
readVarint(): number;
|
|
17
|
+
readVarint64(): number;
|
|
18
|
+
readSVarint(): number;
|
|
19
|
+
readBoolean(): boolean;
|
|
20
|
+
readString(): string;
|
|
21
|
+
readBytes(): Uint8Array;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare module.exports: typeof Pbf
|
|
25
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
declare module "@mapbox/point-geometry" {
|
|
2
|
+
declare type PointLike = Point | [number, number];
|
|
3
|
+
|
|
4
|
+
declare class Point {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
constructor(x: number, y: number): Point;
|
|
8
|
+
clone(): Point;
|
|
9
|
+
add(point: Point): Point;
|
|
10
|
+
sub(point: Point): Point;
|
|
11
|
+
multByPoint(point: Point): Point;
|
|
12
|
+
divByPoint(point: Point): Point;
|
|
13
|
+
mult(k: number): Point;
|
|
14
|
+
div(k: number): Point;
|
|
15
|
+
rotate(angle: number): Point;
|
|
16
|
+
rotateAround(angle: number, point: Point): Point;
|
|
17
|
+
matMult(matrix: [number, number, number, number]): Point;
|
|
18
|
+
unit(): Point;
|
|
19
|
+
perp(): Point;
|
|
20
|
+
round(): Point;
|
|
21
|
+
mag(): number;
|
|
22
|
+
equals(point: Point): boolean;
|
|
23
|
+
dist(point: Point): number;
|
|
24
|
+
distSqr(point: Point): number;
|
|
25
|
+
angle(): number;
|
|
26
|
+
angleTo(point: Point): number;
|
|
27
|
+
angleWith(point: Point): number;
|
|
28
|
+
angleWithSep(x: number, y: number): number;
|
|
29
|
+
_matMult(matrix: [number, number, number, number]): Point;
|
|
30
|
+
_add(point: Point): Point;
|
|
31
|
+
_sub(point: Point): Point;
|
|
32
|
+
_mult(k: number): Point;
|
|
33
|
+
_div(k: number): Point;
|
|
34
|
+
_multByPoint(point: Point): Point;
|
|
35
|
+
_divByPoint(point: Point): Point;
|
|
36
|
+
_unit(): Point;
|
|
37
|
+
_perp(): Point;
|
|
38
|
+
_rotate(angle: number): Point;
|
|
39
|
+
_rotateAround(angle: number, point: Point): Point;
|
|
40
|
+
_round(): Point;
|
|
41
|
+
static convert(a: PointLike): Point;
|
|
42
|
+
}
|
|
43
|
+
declare module.exports: typeof Point;
|
|
44
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
declare module "sinon" {
|
|
3
|
+
declare type SpyCall = {
|
|
4
|
+
args: Array<mixed>
|
|
5
|
+
};
|
|
6
|
+
declare type Spy = {
|
|
7
|
+
(): any,
|
|
8
|
+
calledOnce: number,
|
|
9
|
+
getCall(i: number): SpyCall
|
|
10
|
+
};
|
|
11
|
+
declare type Stub = {
|
|
12
|
+
callsFake(fn: mixed): Spy
|
|
13
|
+
};
|
|
14
|
+
declare class FakeServer {
|
|
15
|
+
xhr: XMLHttpRequest
|
|
16
|
+
}
|
|
17
|
+
declare type Sandbox = {
|
|
18
|
+
xhr: {supportsCORS: boolean},
|
|
19
|
+
fakeServer: {create: () => FakeServer},
|
|
20
|
+
|
|
21
|
+
createSandbox(options: mixed): Sandbox,
|
|
22
|
+
stub(obj?: mixed, prop?: string): Stub,
|
|
23
|
+
spy(obj?: mixed, prop?: string): Spy,
|
|
24
|
+
restore(): void;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
declare module.exports: Sandbox;
|
|
28
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type Pbf from 'pbf';
|
|
2
|
+
import type Point from '@mapbox/point-geometry';
|
|
3
|
+
import type { GeoJSONFeature } from '@mapbox/geojson-types';
|
|
4
|
+
|
|
5
|
+
declare interface VectorTile {
|
|
6
|
+
layers: {[_: string]: VectorTileLayer};
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare interface VectorTileLayer {
|
|
10
|
+
version?: number;
|
|
11
|
+
name: string;
|
|
12
|
+
extent: number;
|
|
13
|
+
length: number;
|
|
14
|
+
feature(i: number): VectorTileFeature;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare interface VectorTileFeature {
|
|
18
|
+
extent: number;
|
|
19
|
+
type: 1 | 2 | 3;
|
|
20
|
+
id: number;
|
|
21
|
+
properties: {[_: string]: string | number | boolean};
|
|
22
|
+
|
|
23
|
+
loadGeometry(): Array<Array<Point>>;
|
|
24
|
+
toGeoJSON(x: number, y: number, z: number): GeoJSONFeature;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare module "@mapbox/vector-tile" {
|
|
28
|
+
declare class VectorTileImpl {
|
|
29
|
+
constructor(pbf: Pbf): VectorTile;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
declare class VectorTileFeatureImpl {
|
|
33
|
+
static types: ['Unknown', 'Point', 'LineString', 'Polygon'];
|
|
34
|
+
toGeoJSON(x: number, y: number, z: number): GeoJSONFeature;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare module.exports: {
|
|
38
|
+
VectorTile: typeof VectorTileImpl;
|
|
39
|
+
VectorTileFeature: typeof VectorTileFeatureImpl;
|
|
40
|
+
}
|
|
41
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapbox/mapbox-gl-style-spec",
|
|
3
3
|
"description": "a specification for mapbox gl styles",
|
|
4
|
-
"version": "13.
|
|
4
|
+
"version": "13.20.1",
|
|
5
5
|
"author": "Mapbox",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"mapbox",
|
|
@@ -9,14 +9,23 @@
|
|
|
9
9
|
"mapbox-gl-js"
|
|
10
10
|
],
|
|
11
11
|
"license": "ISC",
|
|
12
|
-
"main": "./dist/index.
|
|
12
|
+
"main": "./dist/index.cjs",
|
|
13
13
|
"module": "./dist/index.es.js",
|
|
14
14
|
"type": "module",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"require": "./dist/index.cjs",
|
|
18
|
+
"import": "./dist/index.es.js"
|
|
19
|
+
},
|
|
20
|
+
"./": {
|
|
21
|
+
"import": "./"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
15
24
|
"scripts": {
|
|
16
25
|
"copy-flow-typed": "cp -R ../../flow-typed .",
|
|
17
26
|
"build": "../../node_modules/.bin/rollup -c && ../../node_modules/.bin/rollup -c --environment esm",
|
|
18
|
-
"
|
|
19
|
-
"postpublish": "rm -r flow-typed dist/index.
|
|
27
|
+
"prepublishOnly": "git clean -fdx && yarn copy-flow-typed && yarn build",
|
|
28
|
+
"postpublish": "rm -r flow-typed dist/index.cjs"
|
|
20
29
|
},
|
|
21
30
|
"repository": {
|
|
22
31
|
"type": "git",
|
package/reference/v8.json
CHANGED
|
@@ -61,6 +61,10 @@
|
|
|
61
61
|
"type": "terrain",
|
|
62
62
|
"doc": "A global modifier that elevates layers and markers based on a DEM data source."
|
|
63
63
|
},
|
|
64
|
+
"fog": {
|
|
65
|
+
"type": "fog",
|
|
66
|
+
"doc": "A global effect that fades layers and markers based on their distance to the camera. The fog can be used to approximate the effect of atmosphere on distant objects and enhance the depth perception of the map when used with terrain or 3D features."
|
|
67
|
+
},
|
|
64
68
|
"sources": {
|
|
65
69
|
"required": true,
|
|
66
70
|
"type": "sources",
|
|
@@ -884,15 +888,19 @@
|
|
|
884
888
|
"android": "2.0.1",
|
|
885
889
|
"ios": "2.0.0",
|
|
886
890
|
"macos": "0.1.0"
|
|
891
|
+
},
|
|
892
|
+
"data-driven styling": {
|
|
893
|
+
"js": "2.3.0"
|
|
887
894
|
}
|
|
888
895
|
},
|
|
889
896
|
"expression": {
|
|
890
897
|
"interpolated": false,
|
|
891
898
|
"parameters": [
|
|
892
|
-
"zoom"
|
|
899
|
+
"zoom",
|
|
900
|
+
"feature"
|
|
893
901
|
]
|
|
894
902
|
},
|
|
895
|
-
"property-type": "data-
|
|
903
|
+
"property-type": "data-driven"
|
|
896
904
|
},
|
|
897
905
|
"line-join": {
|
|
898
906
|
"type": "enum",
|
|
@@ -1862,15 +1870,19 @@
|
|
|
1862
1870
|
"android": "2.0.1",
|
|
1863
1871
|
"ios": "2.0.0",
|
|
1864
1872
|
"macos": "0.1.0"
|
|
1873
|
+
},
|
|
1874
|
+
"data-driven styling": {
|
|
1875
|
+
"js": "2.3.0"
|
|
1865
1876
|
}
|
|
1866
1877
|
},
|
|
1867
1878
|
"expression": {
|
|
1868
1879
|
"interpolated": true,
|
|
1869
1880
|
"parameters": [
|
|
1870
|
-
"zoom"
|
|
1881
|
+
"zoom",
|
|
1882
|
+
"feature"
|
|
1871
1883
|
]
|
|
1872
1884
|
},
|
|
1873
|
-
"property-type": "data-
|
|
1885
|
+
"property-type": "data-driven"
|
|
1874
1886
|
},
|
|
1875
1887
|
"text-letter-spacing": {
|
|
1876
1888
|
"type": "number",
|
|
@@ -2733,7 +2745,7 @@
|
|
|
2733
2745
|
}
|
|
2734
2746
|
},
|
|
2735
2747
|
"match": {
|
|
2736
|
-
"doc": "Selects the output
|
|
2748
|
+
"doc": "Selects the output for which the label value matches the input value, or the fallback value if no match is found. The input can be any expression (for example, `[\"get\", \"building_type\"]`). Each label must be unique, and must be either:\n - a single literal value; or\n - an array of literal values, the values of which must be all strings or all numbers (for example `[100, 101]` or `[\"c\", \"b\"]`).\n\nThe input matches if any of the values in the array matches using strict equality, similar to the `\"in\"` operator.\nIf the input type does not match the type of the labels, the result will be the fallback value.",
|
|
2737
2749
|
"group": "Decision",
|
|
2738
2750
|
"sdk-support": {
|
|
2739
2751
|
"basic functionality": {
|
|
@@ -3673,6 +3685,75 @@
|
|
|
3673
3685
|
}
|
|
3674
3686
|
}
|
|
3675
3687
|
},
|
|
3688
|
+
"fog": {
|
|
3689
|
+
"range": {
|
|
3690
|
+
"type": "array",
|
|
3691
|
+
"default": [
|
|
3692
|
+
0.5,
|
|
3693
|
+
10
|
|
3694
|
+
],
|
|
3695
|
+
"minimum": -20,
|
|
3696
|
+
"maximum": 20,
|
|
3697
|
+
"length": 2,
|
|
3698
|
+
"value": "number",
|
|
3699
|
+
"property-type": "data-constant",
|
|
3700
|
+
"transition": true,
|
|
3701
|
+
"expression": {
|
|
3702
|
+
"interpolated": true,
|
|
3703
|
+
"parameters": [
|
|
3704
|
+
"zoom"
|
|
3705
|
+
]
|
|
3706
|
+
},
|
|
3707
|
+
"doc": "The start and end distance range in which fog fades from fully transparent to fully opaque. The distance to the point at the center of the map is defined as zero, so that negative range values are closer to the camera, and positive values are farther away.",
|
|
3708
|
+
"example": [
|
|
3709
|
+
0.5,
|
|
3710
|
+
10
|
|
3711
|
+
],
|
|
3712
|
+
"sdk-support": {
|
|
3713
|
+
"basic functionality": {
|
|
3714
|
+
"js": "2.3.0"
|
|
3715
|
+
}
|
|
3716
|
+
}
|
|
3717
|
+
},
|
|
3718
|
+
"color": {
|
|
3719
|
+
"type": "color",
|
|
3720
|
+
"property-type": "data-constant",
|
|
3721
|
+
"default": "#ffffff",
|
|
3722
|
+
"expression": {
|
|
3723
|
+
"interpolated": true,
|
|
3724
|
+
"parameters": [
|
|
3725
|
+
"zoom"
|
|
3726
|
+
]
|
|
3727
|
+
},
|
|
3728
|
+
"transition": true,
|
|
3729
|
+
"doc": "The color of the fog. Using opacity is recommended only for smoothly transitioning fog on/off as anything less than 100% opacity results in more tiles loaded and drawn.",
|
|
3730
|
+
"sdk-support": {
|
|
3731
|
+
"basic functionality": {
|
|
3732
|
+
"js": "2.3.0"
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
},
|
|
3736
|
+
"horizon-blend": {
|
|
3737
|
+
"type": "number",
|
|
3738
|
+
"property-type": "data-constant",
|
|
3739
|
+
"default": 0.1,
|
|
3740
|
+
"minimum": 0,
|
|
3741
|
+
"maximum": 1,
|
|
3742
|
+
"expression": {
|
|
3743
|
+
"interpolated": true,
|
|
3744
|
+
"parameters": [
|
|
3745
|
+
"zoom"
|
|
3746
|
+
]
|
|
3747
|
+
},
|
|
3748
|
+
"transition": true,
|
|
3749
|
+
"doc": "Horizon blend applies a smooth fade from the color of the fog to the color of the sky. A value of zero leaves a sharp transition from fog to sky. Increasing the value blends the color of fog into increasingly high angles of the sky.",
|
|
3750
|
+
"sdk-support": {
|
|
3751
|
+
"basic functionality": {
|
|
3752
|
+
"js": "2.3.0"
|
|
3753
|
+
}
|
|
3754
|
+
}
|
|
3755
|
+
}
|
|
3756
|
+
},
|
|
3676
3757
|
"light": {
|
|
3677
3758
|
"anchor": {
|
|
3678
3759
|
"type": "enum",
|
|
@@ -4528,15 +4609,18 @@
|
|
|
4528
4609
|
"ios": "2.0.0",
|
|
4529
4610
|
"macos": "0.1.0"
|
|
4530
4611
|
},
|
|
4531
|
-
"data-driven styling": {
|
|
4612
|
+
"data-driven styling": {
|
|
4613
|
+
"js": "2.3.0"
|
|
4614
|
+
}
|
|
4532
4615
|
},
|
|
4533
4616
|
"expression": {
|
|
4534
4617
|
"interpolated": false,
|
|
4535
4618
|
"parameters": [
|
|
4536
|
-
"zoom"
|
|
4619
|
+
"zoom",
|
|
4620
|
+
"feature"
|
|
4537
4621
|
]
|
|
4538
4622
|
},
|
|
4539
|
-
"property-type": "cross-faded"
|
|
4623
|
+
"property-type": "cross-faded-data-driven"
|
|
4540
4624
|
},
|
|
4541
4625
|
"line-pattern": {
|
|
4542
4626
|
"type": "resolvedImage",
|
package/rollup.config.js
CHANGED
|
@@ -16,7 +16,7 @@ const config = [{
|
|
|
16
16
|
input: `${__dirname}/style-spec.js`,
|
|
17
17
|
output: {
|
|
18
18
|
name: 'mapboxGlStyleSpecification',
|
|
19
|
-
file: `${__dirname}/dist/${esm ? 'index.es.js' : 'index.
|
|
19
|
+
file: `${__dirname}/dist/${esm ? 'index.es.js' : 'index.cjs'}`,
|
|
20
20
|
format: esm ? 'esm' : 'umd',
|
|
21
21
|
sourcemap: true
|
|
22
22
|
},
|
package/types.js
CHANGED
|
@@ -67,6 +67,7 @@ export type StyleSpecification = {|
|
|
|
67
67
|
"pitch"?: number,
|
|
68
68
|
"light"?: LightSpecification,
|
|
69
69
|
"terrain"?: TerrainSpecification,
|
|
70
|
+
"fog"?: FogSpecification,
|
|
70
71
|
"sources": {[_: string]: SourceSpecification},
|
|
71
72
|
"sprite"?: string,
|
|
72
73
|
"glyphs"?: string,
|
|
@@ -86,6 +87,12 @@ export type TerrainSpecification = {|
|
|
|
86
87
|
"exaggeration"?: PropertyValueSpecification<number>
|
|
87
88
|
|}
|
|
88
89
|
|
|
90
|
+
export type FogSpecification = {|
|
|
91
|
+
"range"?: PropertyValueSpecification<[number, number]>,
|
|
92
|
+
"color"?: PropertyValueSpecification<ColorSpecification>,
|
|
93
|
+
"horizon-blend"?: PropertyValueSpecification<number>
|
|
94
|
+
|}
|
|
95
|
+
|
|
89
96
|
export type VectorSourceSpecification = {
|
|
90
97
|
"type": "vector",
|
|
91
98
|
"url"?: string,
|
|
@@ -197,7 +204,7 @@ export type LineLayerSpecification = {|
|
|
|
197
204
|
"maxzoom"?: number,
|
|
198
205
|
"filter"?: FilterSpecification,
|
|
199
206
|
"layout"?: {|
|
|
200
|
-
"line-cap"?:
|
|
207
|
+
"line-cap"?: DataDrivenPropertyValueSpecification<"butt" | "round" | "square">,
|
|
201
208
|
"line-join"?: DataDrivenPropertyValueSpecification<"bevel" | "round" | "miter">,
|
|
202
209
|
"line-miter-limit"?: PropertyValueSpecification<number>,
|
|
203
210
|
"line-round-limit"?: PropertyValueSpecification<number>,
|
|
@@ -213,7 +220,7 @@ export type LineLayerSpecification = {|
|
|
|
213
220
|
"line-gap-width"?: DataDrivenPropertyValueSpecification<number>,
|
|
214
221
|
"line-offset"?: DataDrivenPropertyValueSpecification<number>,
|
|
215
222
|
"line-blur"?: DataDrivenPropertyValueSpecification<number>,
|
|
216
|
-
"line-dasharray"?:
|
|
223
|
+
"line-dasharray"?: DataDrivenPropertyValueSpecification<Array<number>>,
|
|
217
224
|
"line-pattern"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>,
|
|
218
225
|
"line-gradient"?: ExpressionSpecification
|
|
219
226
|
|}
|
|
@@ -254,7 +261,7 @@ export type SymbolLayerSpecification = {|
|
|
|
254
261
|
"text-font"?: DataDrivenPropertyValueSpecification<Array<string>>,
|
|
255
262
|
"text-size"?: DataDrivenPropertyValueSpecification<number>,
|
|
256
263
|
"text-max-width"?: DataDrivenPropertyValueSpecification<number>,
|
|
257
|
-
"text-line-height"?:
|
|
264
|
+
"text-line-height"?: DataDrivenPropertyValueSpecification<number>,
|
|
258
265
|
"text-letter-spacing"?: DataDrivenPropertyValueSpecification<number>,
|
|
259
266
|
"text-justify"?: DataDrivenPropertyValueSpecification<"auto" | "left" | "center" | "right">,
|
|
260
267
|
"text-radial-offset"?: DataDrivenPropertyValueSpecification<number>,
|
package/validate/validate.js
CHANGED
|
@@ -18,6 +18,7 @@ import validateLayer from './validate_layer.js';
|
|
|
18
18
|
import validateSource from './validate_source.js';
|
|
19
19
|
import validateLight from './validate_light.js';
|
|
20
20
|
import validateTerrain from './validate_terrain.js';
|
|
21
|
+
import validateFog from './validate_fog.js';
|
|
21
22
|
import validateString from './validate_string.js';
|
|
22
23
|
import validateFormatted from './validate_formatted.js';
|
|
23
24
|
import validateImage from './validate_image.js';
|
|
@@ -39,6 +40,7 @@ const VALIDATORS = {
|
|
|
39
40
|
'source': validateSource,
|
|
40
41
|
'light': validateLight,
|
|
41
42
|
'terrain': validateTerrain,
|
|
43
|
+
'fog': validateFog,
|
|
42
44
|
'string': validateString,
|
|
43
45
|
'formatted': validateFormatted,
|
|
44
46
|
'resolvedImage': validateImage
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
import ValidationError from '../error/validation_error.js';
|
|
3
|
+
import validate from './validate.js';
|
|
4
|
+
import getType from '../util/get_type.js';
|
|
5
|
+
|
|
6
|
+
export default function validateFog(options) {
|
|
7
|
+
const fog = options.value;
|
|
8
|
+
const style = options.style;
|
|
9
|
+
const styleSpec = options.styleSpec;
|
|
10
|
+
const fogSpec = styleSpec.fog;
|
|
11
|
+
let errors = [];
|
|
12
|
+
|
|
13
|
+
const rootType = getType(fog);
|
|
14
|
+
if (fog === undefined) {
|
|
15
|
+
return errors;
|
|
16
|
+
} else if (rootType !== 'object') {
|
|
17
|
+
errors = errors.concat([new ValidationError('fog', fog, `object expected, ${rootType} found`)]);
|
|
18
|
+
return errors;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
for (const key in fog) {
|
|
22
|
+
const transitionMatch = key.match(/^(.*)-transition$/);
|
|
23
|
+
|
|
24
|
+
if (transitionMatch && fogSpec[transitionMatch[1]] && fogSpec[transitionMatch[1]].transition) {
|
|
25
|
+
errors = errors.concat(validate({
|
|
26
|
+
key,
|
|
27
|
+
value: fog[key],
|
|
28
|
+
valueSpec: styleSpec.transition,
|
|
29
|
+
style,
|
|
30
|
+
styleSpec
|
|
31
|
+
}));
|
|
32
|
+
} else if (fogSpec[key]) {
|
|
33
|
+
errors = errors.concat(validate({
|
|
34
|
+
key,
|
|
35
|
+
value: fog[key],
|
|
36
|
+
valueSpec: fogSpec[key],
|
|
37
|
+
style,
|
|
38
|
+
styleSpec
|
|
39
|
+
}));
|
|
40
|
+
} else {
|
|
41
|
+
errors = errors.concat([new ValidationError(key, fog[key], `unknown property "${key}"`)]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return errors;
|
|
46
|
+
}
|
|
@@ -34,6 +34,7 @@ function getAllowedKeyErrors(obj: Object, keys: Array<*>, path: ?string): Array<
|
|
|
34
34
|
return errors;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
const acceptedSourceTypes = new Set(["vector", "raster", "raster-dem"]);
|
|
37
38
|
function getSourceErrors(source: Object, i: number): Array<?ValidationError> {
|
|
38
39
|
const errors = [];
|
|
39
40
|
|
|
@@ -44,6 +45,13 @@ function getSourceErrors(source: Object, i: number): Array<?ValidationError> {
|
|
|
44
45
|
const sourceKeys = ['type', 'url', 'tileSize'];
|
|
45
46
|
errors.push(...getAllowedKeyErrors(source, sourceKeys, 'source'));
|
|
46
47
|
|
|
48
|
+
/*
|
|
49
|
+
* "type" is required and must be one of "vector", "raster", "raster-dem"
|
|
50
|
+
*/
|
|
51
|
+
if (!acceptedSourceTypes.has(String(source.type))) {
|
|
52
|
+
errors.push(new ValidationError(`sources[${i}].type`, source.type, `Expected one of [${Array.from(acceptedSourceTypes).join(", ")}]`));
|
|
53
|
+
}
|
|
54
|
+
|
|
47
55
|
/*
|
|
48
56
|
* "source" is required. Valid examples:
|
|
49
57
|
* mapbox://mapbox.abcd1234
|
|
@@ -51,8 +59,8 @@ function getSourceErrors(source: Object, i: number): Array<?ValidationError> {
|
|
|
51
59
|
* mapbox://mapbox.abcd1234,penny.abcd1234
|
|
52
60
|
*/
|
|
53
61
|
const sourceUrlPattern = /^mapbox:\/\/([^/]*)$/;
|
|
54
|
-
if (!isValid(source.url, sourceUrlPattern)) {
|
|
55
|
-
errors.push(new ValidationError(`sources[${i}]`, source.url, '
|
|
62
|
+
if (!source.url || !isValid(source.url, sourceUrlPattern)) {
|
|
63
|
+
errors.push(new ValidationError(`sources[${i}].url`, source.url, 'Expected a valid Mapbox tileset url'));
|
|
56
64
|
}
|
|
57
65
|
|
|
58
66
|
return errors;
|
package/validate_style.min.js
CHANGED
|
@@ -7,6 +7,7 @@ import validateGlyphsURL from './validate/validate_glyphs_url.js';
|
|
|
7
7
|
import validateSource from './validate/validate_source.js';
|
|
8
8
|
import validateLight from './validate/validate_light.js';
|
|
9
9
|
import validateTerrain from './validate/validate_terrain.js';
|
|
10
|
+
import validateFog from './validate/validate_fog.js';
|
|
10
11
|
import validateLayer from './validate/validate_layer.js';
|
|
11
12
|
import validateFilter from './validate/validate_filter.js';
|
|
12
13
|
import validatePaintProperty from './validate/validate_paint_property.js';
|
|
@@ -60,6 +61,7 @@ function validateStyleMin(style, styleSpec = latestStyleSpec) {
|
|
|
60
61
|
validateStyleMin.source = wrapCleanErrors(validateSource);
|
|
61
62
|
validateStyleMin.light = wrapCleanErrors(validateLight);
|
|
62
63
|
validateStyleMin.terrain = wrapCleanErrors(validateTerrain);
|
|
64
|
+
validateStyleMin.fog = wrapCleanErrors(validateFog);
|
|
63
65
|
validateStyleMin.layer = wrapCleanErrors(validateLayer);
|
|
64
66
|
validateStyleMin.filter = wrapCleanErrors(validateFilter);
|
|
65
67
|
validateStyleMin.paintProperty = wrapCleanErrors(validatePaintProperty);
|