@mapbox/mapbox-gl-style-spec 13.24.0 → 13.25.0-beta.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.
@@ -384,7 +384,7 @@ function getExpectedType(spec: StylePropertySpecification): Type {
384
384
  }
385
385
 
386
386
  function getDefaultValue(spec: StylePropertySpecification): Value {
387
- if (spec.type === 'color' && isFunction(spec.default)) {
387
+ if (spec.type === 'color' && (isFunction(spec.default) || Array.isArray(spec.default))) {
388
388
  // Special case for heatmap-color: it uses the 'default:' to define a
389
389
  // default color ramp, but createExpression expects a simple value to fall
390
390
  // back to in case of runtime errors
@@ -19,6 +19,7 @@ declare module "gl-matrix" {
19
19
  fromValues(number, number, number): Float32Array,
20
20
  length(Vec3): number,
21
21
  len(Vec3): number,
22
+ distance(Vec3, Vec3): number,
22
23
  squaredLength(Vec3): number,
23
24
  dot(Vec3, Vec3): number,
24
25
  equals(Vec3, Vec3): boolean,
@@ -41,7 +42,11 @@ declare module "gl-matrix" {
41
42
  lerp<T: Vec3>(T, Vec3, Vec3, number): T,
42
43
  transformQuat<T: Vec3>(T, Vec3, Quat): T,
43
44
  transformMat3<T: Vec3>(T, Vec3, Mat3): T,
44
- transformMat4<T: Vec3>(T, Vec3, Mat4): T
45
+ transformMat4<T: Vec3>(T, Vec3, Mat4): T,
46
+ angle(Vec3, Vec3): number;
47
+ rotateX<T: Vec3>(T, Vec3, Vec3, number): T,
48
+ rotateY<T: Vec3>(T, Vec3, Vec3, number): T,
49
+ rotateZ<T: Vec3>(T, Vec3, Vec3, number): T,
45
50
  };
46
51
 
47
52
  declare var vec4: {
@@ -82,6 +87,8 @@ declare module "gl-matrix" {
82
87
  rotateX<T: Mat4>(T, Mat4, number): T,
83
88
  rotateY<T: Mat4>(T, Mat4, number): T,
84
89
  rotateZ<T: Mat4>(T, Mat4, number): T,
90
+ rotate<T: Mat4>(T, Mat4, number, Vec3): T,
91
+ fromRotation<T: Mat4>(T, number, Vec3): T,
85
92
  translate<T: Mat4>(T, Mat4, Vec3): T,
86
93
  invert<T: Mat4>(T, Mat4): T,
87
94
  copy<T: Mat4>(T, Mat4): T,
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.24.0",
4
+ "version": "13.25.0-beta.1",
5
5
  "author": "Mapbox",
6
6
  "keywords": [
7
7
  "mapbox",
package/reference/v8.json CHANGED
@@ -63,7 +63,7 @@
63
63
  },
64
64
  "fog": {
65
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."
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. Note: fog is renamed to atmosphere in the Android and iOS SDKs and planned to be changed in GL-JS v.3.0.0."
67
67
  },
68
68
  "sources": {
69
69
  "required": true,
@@ -96,7 +96,7 @@
96
96
  },
97
97
  "projection": {
98
98
  "type": "projection",
99
- "doc": "The projection the map should be rendered in. Supported projections are Albers, Equal Earth, Equirectangular (WGS84), Lambert conformal conic, Mercator, Natural Earth, and Winkel Tripel. Terrain, fog, sky and CustomLayerInterface are not supported for projections other than mercator.",
99
+ "doc": "The projection the map should be rendered in. Supported projections are Albers, Equal Earth, Equirectangular (WGS84), Lambert conformal conic, Mercator, Natural Earth, Globe, and Winkel Tripel. Terrain, fog, sky and CustomLayerInterface are not supported for projections other than mercator.",
100
100
  "example": {
101
101
  "name": "albers",
102
102
  "center": [-154, 50],
@@ -3816,7 +3816,9 @@
3816
3816
  ],
3817
3817
  "sdk-support": {
3818
3818
  "basic functionality": {
3819
- "js": "2.3.0"
3819
+ "js": "2.3.0",
3820
+ "android": "10.6.0",
3821
+ "ios": "10.6.0"
3820
3822
  }
3821
3823
  }
3822
3824
  },
@@ -3831,17 +3833,121 @@
3831
3833
  ]
3832
3834
  },
3833
3835
  "transition": true,
3834
- "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.",
3836
+ "doc": "The color of the atmosphere region immediately below the horizon and within the `range` and above the horizon and within `horizon-blend`. Using opacity is recommended only for smoothly transitioning fog on/off as anything less than 100% opacity results in more tiles loaded and drawn.",
3835
3837
  "sdk-support": {
3836
3838
  "basic functionality": {
3837
- "js": "2.3.0"
3839
+ "js": "2.3.0",
3840
+ "android": "10.6.0",
3841
+ "ios": "10.6.0"
3842
+ }
3843
+ }
3844
+ },
3845
+ "high-color": {
3846
+ "type": "color",
3847
+ "property-type": "data-constant",
3848
+ "default": "#245cdf",
3849
+ "expression": {
3850
+ "interpolated": true,
3851
+ "parameters": [
3852
+ "zoom"
3853
+ ]
3854
+ },
3855
+ "transition": true,
3856
+ "doc": "The color of the atmosphere region above the horizon, `high-color` extends further above the horizon than the `color` property and its spread can be controlled with `horizon-blend`. The opacity can be set to `0` to remove the high atmosphere color contribution.",
3857
+ "sdk-support": {
3858
+ "basic functionality": {
3859
+ "js": "2.9.0",
3860
+ "android": "10.6.0",
3861
+ "ios": "10.6.0"
3862
+ }
3863
+ }
3864
+ },
3865
+ "space-color": {
3866
+ "type": "color",
3867
+ "property-type": "data-constant",
3868
+
3869
+ "default":
3870
+ [
3871
+ "interpolate",
3872
+ [
3873
+ "linear"
3874
+ ],
3875
+ [
3876
+ "zoom"
3877
+ ],
3878
+ 4,
3879
+ "#010b19",
3880
+ 7,
3881
+ "#367ab9"
3882
+ ],
3883
+ "expression": {
3884
+ "interpolated": true,
3885
+ "parameters": [
3886
+ "zoom"
3887
+ ]
3888
+ },
3889
+ "transition": true,
3890
+ "doc": "The color of the region above the horizon and after the end of the `horizon-blend` contribution. The opacity can be set to `0` to have a transparent background.",
3891
+ "sdk-support": {
3892
+ "basic functionality": {
3893
+ "js": "2.9.0",
3894
+ "android": "10.6.0",
3895
+ "ios": "10.6.0"
3838
3896
  }
3839
3897
  }
3840
3898
  },
3841
3899
  "horizon-blend": {
3842
3900
  "type": "number",
3843
3901
  "property-type": "data-constant",
3844
- "default": 0.1,
3902
+ "default":
3903
+ [
3904
+ "interpolate",
3905
+ [
3906
+ "linear"
3907
+ ],
3908
+ [
3909
+ "zoom"
3910
+ ],
3911
+ 4,
3912
+ 0.2,
3913
+ 7,
3914
+ 0.1
3915
+ ],
3916
+ "minimum": 0,
3917
+ "maximum": 1,
3918
+ "expression": {
3919
+ "interpolated": true,
3920
+ "parameters": [
3921
+ "zoom"
3922
+ ]
3923
+ },
3924
+ "transition": true,
3925
+ "doc": "Horizon blend applies a smooth fade from the color of the atmosphere to the color of space. A value of zero leaves a sharp transition from atmosphere to space. Increasing the value blends the color of atmosphere into increasingly high angles of the sky.",
3926
+ "sdk-support": {
3927
+ "basic functionality": {
3928
+ "js": "2.3.0",
3929
+ "android": "10.6.0",
3930
+ "ios": "10.6.0"
3931
+ }
3932
+ }
3933
+ },
3934
+ "star-intensity": {
3935
+ "type": "number",
3936
+ "property-type": "data-constant",
3937
+ "default":
3938
+ [
3939
+ "interpolate",
3940
+ [
3941
+ "linear"
3942
+ ],
3943
+ [
3944
+ "zoom"
3945
+ ],
3946
+ 5,
3947
+ 0.35,
3948
+ 6,
3949
+ 0
3950
+ ],
3845
3951
  "minimum": 0,
3846
3952
  "maximum": 1,
3847
3953
  "expression": {
@@ -3851,10 +3957,12 @@
3851
3957
  ]
3852
3958
  },
3853
3959
  "transition": true,
3854
- "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.",
3960
+ "doc": "A value controlling the star intensity where `0` will show no stars and `1` will show stars at their maximum intensity.",
3855
3961
  "sdk-support": {
3856
3962
  "basic functionality": {
3857
- "js": "2.3.0"
3963
+ "js": "2.9.0",
3964
+ "android": "10.6.0",
3965
+ "ios": "10.6.0"
3858
3966
  }
3859
3967
  }
3860
3968
  }
@@ -3991,6 +4099,9 @@
3991
4099
  },
3992
4100
  "winkelTripel": {
3993
4101
  "doc": "A Winkel Tripel projection."
4102
+ },
4103
+ "globe": {
4104
+ "doc": "A globe projection."
3994
4105
  }
3995
4106
  },
3996
4107
  "default": "mercator",
@@ -4080,6 +4191,9 @@
4080
4191
  },
4081
4192
  "transition": true,
4082
4193
  "doc": "Exaggerates the elevation of the terrain by multiplying the data from the DEM with this value.",
4194
+ "requires": [
4195
+ "source"
4196
+ ],
4083
4197
  "sdk-support": {
4084
4198
  "basic functionality": {
4085
4199
  "js": "2.0.0",
@@ -4876,6 +4990,32 @@
4876
4990
  ]
4877
4991
  },
4878
4992
  "property-type": "color-ramp"
4993
+ },
4994
+ "line-trim-offset": {
4995
+ "type": "array",
4996
+ "value": "number",
4997
+ "doc": "The line part between [trim-start, trim-end] will be marked as transparent to make a route vanishing effect. The line trim-off offset is based on the whole line gradient range [0.0, 1.0]. If either 'trim-start' or 'trim-end' offset is out of valid range, the default range will be set.",
4998
+ "length": 2,
4999
+ "default": [0.0, 0.0],
5000
+ "transition": false,
5001
+ "requires": [
5002
+ "line-gradient",
5003
+ {
5004
+ "source": "geojson",
5005
+ "has": {
5006
+ "lineMetrics": true
5007
+ }
5008
+ }
5009
+ ],
5010
+ "sdk-support": {
5011
+ "basic functionality": {
5012
+ "js": "2.3.0",
5013
+ "android": "10.5.0",
5014
+ "ios": "10.5.0",
5015
+ "macos": "10.5.0"
5016
+ }
5017
+ },
5018
+ "property-type": "constant"
4879
5019
  }
4880
5020
  },
4881
5021
  "paint_circle": {
package/types.js CHANGED
@@ -91,11 +91,14 @@ export type TerrainSpecification = {|
91
91
  export type FogSpecification = {|
92
92
  "range"?: PropertyValueSpecification<[number, number]>,
93
93
  "color"?: PropertyValueSpecification<ColorSpecification>,
94
- "horizon-blend"?: PropertyValueSpecification<number>
94
+ "high-color"?: PropertyValueSpecification<ColorSpecification>,
95
+ "space-color"?: PropertyValueSpecification<ColorSpecification>,
96
+ "horizon-blend"?: PropertyValueSpecification<number>,
97
+ "star-intensity"?: PropertyValueSpecification<number>
95
98
  |}
96
99
 
97
100
  export type ProjectionSpecification = {|
98
- "name": "albers" | "equalEarth" | "equirectangular" | "lambertConformalConic" | "mercator" | "naturalEarth" | "winkelTripel",
101
+ "name": "albers" | "equalEarth" | "equirectangular" | "lambertConformalConic" | "mercator" | "naturalEarth" | "winkelTripel" | "globe",
99
102
  "center"?: [number, number],
100
103
  "parallels"?: [number, number]
101
104
  |}
@@ -229,7 +232,8 @@ export type LineLayerSpecification = {|
229
232
  "line-blur"?: DataDrivenPropertyValueSpecification<number>,
230
233
  "line-dasharray"?: DataDrivenPropertyValueSpecification<Array<number>>,
231
234
  "line-pattern"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>,
232
- "line-gradient"?: ExpressionSpecification
235
+ "line-gradient"?: ExpressionSpecification,
236
+ "line-trim-offset"?: [number, number]
233
237
  |}
234
238
  |}
235
239
 
package/util/color.js CHANGED
@@ -77,6 +77,11 @@ class Color {
77
77
  return `rgba(${Math.round(r)},${Math.round(g)},${Math.round(b)},${a})`;
78
78
  }
79
79
 
80
+ /**
81
+ * Returns an RGBA array of values representing the color, unpremultiplied by A.
82
+ *
83
+ * @returns An array of RGBA color values in the range [0, 255].
84
+ */
80
85
  toArray(): [number, number, number, number] {
81
86
  const {r, g, b, a} = this;
82
87
  return a === 0 ? [0, 0, 0, 0] : [
@@ -86,6 +91,36 @@ class Color {
86
91
  a
87
92
  ];
88
93
  }
94
+
95
+ /**
96
+ * Returns a RGBA array of float values representing the color, unpremultiplied by A.
97
+ *
98
+ * @returns An array of RGBA color values in the range [0, 1].
99
+ */
100
+ toArray01(): [number, number, number, number] {
101
+ const {r, g, b, a} = this;
102
+ return a === 0 ? [0, 0, 0, 0] : [
103
+ r / a,
104
+ g / a,
105
+ b / a,
106
+ a
107
+ ];
108
+ }
109
+
110
+ /**
111
+ * Returns an RGBA array of values representing the color, premultiplied by A.
112
+ *
113
+ * @returns An array of RGBA color values in the range [0, 1].
114
+ */
115
+ toArray01PremultipliedAlpha(): [number, number, number, number] {
116
+ const {r, g, b, a} = this;
117
+ return [
118
+ r,
119
+ g,
120
+ b,
121
+ a
122
+ ];
123
+ }
89
124
  }
90
125
 
91
126
  Color.black = new Color(0, 0, 0, 1);
@@ -82,6 +82,8 @@ export default function validateLayer(options: Options): Array<ValidationError>
82
82
  } else if (type === 'line' && layer.paint && layer.paint['line-gradient'] &&
83
83
  (sourceType !== 'geojson' || !source.lineMetrics)) {
84
84
  errors.push(new ValidationError(key, layer, `layer "${layer.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`));
85
+ } else if (type === 'line' && layer.paint && layer.paint['line-trim-offset'] && !layer.paint['line-gradient']) {
86
+ errors.push(new ValidationError(key, layer, `layer "${layer.id}" specifies a line-trim-offset, which requires line-gradient enabled.`));
85
87
  }
86
88
  }
87
89
  }