@mapbox/mapbox-gl-style-spec 14.0.0 → 14.1.0
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/diff.js +5 -4
- package/dist/index.cjs +567 -637
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +567 -637
- package/dist/index.es.js.map +1 -1
- package/expression/compound_expression.js +20 -12
- package/expression/definitions/index.js +47 -2
- package/expression/evaluation_context.js +4 -4
- package/expression/index.js +5 -4
- package/expression/parsing_context.js +3 -2
- package/flow-typed/sinon.js +1 -0
- package/package.json +1 -1
- package/reference/v8.json +481 -621
- package/types.js +23 -4
- package/validate/validate_property.js +5 -2
- package/validate/validate_source.js +9 -3
- package/validate/validate_terrain.js +2 -0
package/types.js
CHANGED
|
@@ -68,7 +68,7 @@ export type StyleSpecification = {|
|
|
|
68
68
|
"pitch"?: number,
|
|
69
69
|
"light"?: LightSpecification,
|
|
70
70
|
"lights"?: Array<LightsSpecification>,
|
|
71
|
-
"terrain"?: TerrainSpecification,
|
|
71
|
+
"terrain"?: ?TerrainSpecification,
|
|
72
72
|
"fog"?: FogSpecification,
|
|
73
73
|
"camera"?: CameraSpecification,
|
|
74
74
|
"imports"?: Array<ImportSpecification>,
|
|
@@ -190,6 +190,19 @@ export type RasterDEMSourceSpecification = {
|
|
|
190
190
|
[_: string]: mixed
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
export type Raster_arraySourceSpecification = {
|
|
194
|
+
"type": "raster-array",
|
|
195
|
+
"url"?: string,
|
|
196
|
+
"tiles"?: Array<string>,
|
|
197
|
+
"bounds"?: [number, number, number, number],
|
|
198
|
+
"minzoom"?: number,
|
|
199
|
+
"maxzoom"?: number,
|
|
200
|
+
"tileSize"?: number,
|
|
201
|
+
"attribution"?: string,
|
|
202
|
+
"rasterLayers"?: mixed,
|
|
203
|
+
[_: string]: mixed
|
|
204
|
+
}
|
|
205
|
+
|
|
193
206
|
export type GeoJSONSourceSpecification = {|
|
|
194
207
|
"type": "geojson",
|
|
195
208
|
"data"?: mixed,
|
|
@@ -231,6 +244,7 @@ export type SourceSpecification =
|
|
|
231
244
|
| VectorSourceSpecification
|
|
232
245
|
| RasterSourceSpecification
|
|
233
246
|
| RasterDEMSourceSpecification
|
|
247
|
+
| Raster_arraySourceSpecification
|
|
234
248
|
| GeoJSONSourceSpecification
|
|
235
249
|
| VideoSourceSpecification
|
|
236
250
|
| ImageSourceSpecification
|
|
@@ -410,7 +424,8 @@ export type SymbolLayerSpecification = {|
|
|
|
410
424
|
"text-halo-width"?: DataDrivenPropertyValueSpecification<number>,
|
|
411
425
|
"text-halo-blur"?: DataDrivenPropertyValueSpecification<number>,
|
|
412
426
|
"text-translate"?: PropertyValueSpecification<[number, number]>,
|
|
413
|
-
"text-translate-anchor"?: PropertyValueSpecification<"map" | "viewport"
|
|
427
|
+
"text-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">,
|
|
428
|
+
"icon-color-saturation"?: ExpressionSpecification
|
|
414
429
|
|}
|
|
415
430
|
|}
|
|
416
431
|
|
|
@@ -501,7 +516,8 @@ export type FillExtrusionLayerSpecification = {|
|
|
|
501
516
|
"fill-extrusion-flood-light-ground-attenuation"?: PropertyValueSpecification<number>,
|
|
502
517
|
"fill-extrusion-vertical-scale"?: PropertyValueSpecification<number>,
|
|
503
518
|
"fill-extrusion-rounded-roof"?: PropertyValueSpecification<boolean>,
|
|
504
|
-
"fill-extrusion-cutoff-fade-range"?: ExpressionSpecification
|
|
519
|
+
"fill-extrusion-cutoff-fade-range"?: ExpressionSpecification,
|
|
520
|
+
"fill-extrusion-emissive-strength"?: PropertyValueSpecification<number>
|
|
505
521
|
|}
|
|
506
522
|
|}
|
|
507
523
|
|
|
@@ -529,7 +545,10 @@ export type RasterLayerSpecification = {|
|
|
|
529
545
|
"raster-saturation"?: PropertyValueSpecification<number>,
|
|
530
546
|
"raster-contrast"?: PropertyValueSpecification<number>,
|
|
531
547
|
"raster-resampling"?: PropertyValueSpecification<"linear" | "nearest">,
|
|
532
|
-
"raster-fade-duration"?: PropertyValueSpecification<number
|
|
548
|
+
"raster-fade-duration"?: PropertyValueSpecification<number>,
|
|
549
|
+
"raster-emissive-strength"?: PropertyValueSpecification<number>,
|
|
550
|
+
"raster-array-band"?: string,
|
|
551
|
+
"raster-elevation"?: PropertyValueSpecification<number>
|
|
533
552
|
|}
|
|
534
553
|
|}
|
|
535
554
|
|
|
@@ -6,7 +6,7 @@ import getType from '../util/get_type.js';
|
|
|
6
6
|
import {isFunction} from '../function/index.js';
|
|
7
7
|
import {unbundle, deepUnbundle} from '../util/unbundle_jsonlint.js';
|
|
8
8
|
import {supportsLightExpression, supportsPropertyExpression, supportsZoomExpression} from '../util/properties.js';
|
|
9
|
-
import {isGlobalPropertyConstant} from '../expression/is_constant.js';
|
|
9
|
+
import {isGlobalPropertyConstant, isFeatureConstant, isStateConstant} from '../expression/is_constant.js';
|
|
10
10
|
|
|
11
11
|
import type {ValidationOptions} from './validate.js';
|
|
12
12
|
import {createPropertyExpression} from '../expression/index.js';
|
|
@@ -67,8 +67,11 @@ export default function validateProperty(options: PropertyValidationOptions, pro
|
|
|
67
67
|
// Performance related style spec limitation: zoom and light expressions are not allowed for e.g. trees.
|
|
68
68
|
const expression = createPropertyExpression(deepUnbundle(value), valueSpec);
|
|
69
69
|
const expressionObj = (expression.value: any).expression || (expression.value: any)._styleExpression.expression;
|
|
70
|
+
|
|
70
71
|
if (expressionObj && !isGlobalPropertyConstant(expressionObj, ['measure-light'])) {
|
|
71
|
-
|
|
72
|
+
if (propertyKey !== 'model-emissive-strength' || (!isFeatureConstant(expressionObj) || !isStateConstant(expressionObj))) {
|
|
73
|
+
errors.push(new ValidationError(key, value, `${propertyKey} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`));
|
|
74
|
+
}
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
}
|
|
@@ -26,20 +26,26 @@ export default function validateSource(options: ValidationOptions): Array<Valida
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const type = unbundle(value.type);
|
|
29
|
-
let errors;
|
|
29
|
+
let errors = [];
|
|
30
|
+
|
|
31
|
+
if (['vector', 'raster', 'raster-dem'].includes(type)) {
|
|
32
|
+
if (!value.url && !value.tiles) {
|
|
33
|
+
errors.push(new ValidationError(key, value, 'Either "url" or "tiles" is required.'));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
30
36
|
|
|
31
37
|
switch (type) {
|
|
32
38
|
case 'vector':
|
|
33
39
|
case 'raster':
|
|
34
40
|
case 'raster-dem':
|
|
35
|
-
errors = validateObject({
|
|
41
|
+
errors = errors.concat(validateObject({
|
|
36
42
|
key,
|
|
37
43
|
value,
|
|
38
44
|
valueSpec: styleSpec[`source_${type.replace('-', '_')}`],
|
|
39
45
|
style: options.style,
|
|
40
46
|
styleSpec,
|
|
41
47
|
objectElementValidators
|
|
42
|
-
});
|
|
48
|
+
}));
|
|
43
49
|
return errors;
|
|
44
50
|
|
|
45
51
|
case 'geojson':
|
|
@@ -18,6 +18,8 @@ export default function validateTerrain(options: ValidationOptions): Array<Valid
|
|
|
18
18
|
const rootType = getType(terrain);
|
|
19
19
|
if (terrain === undefined) {
|
|
20
20
|
return errors;
|
|
21
|
+
} else if (rootType === 'null') {
|
|
22
|
+
return errors;
|
|
21
23
|
} else if (rootType !== 'object') {
|
|
22
24
|
errors = errors.concat([new ValidationError('terrain', terrain, `object expected, ${rootType} found`)]);
|
|
23
25
|
return errors;
|