@mapbox/mapbox-gl-style-spec 14.2.0 → 14.3.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/types.js CHANGED
@@ -190,7 +190,7 @@ export type RasterDEMSourceSpecification = {
190
190
  [_: string]: mixed
191
191
  }
192
192
 
193
- export type Raster_arraySourceSpecification = {
193
+ export type RasterArraySourceSpecification = {
194
194
  "type": "raster-array",
195
195
  "url"?: string,
196
196
  "tiles"?: Array<string>,
@@ -200,6 +200,7 @@ export type Raster_arraySourceSpecification = {
200
200
  "tileSize"?: number,
201
201
  "attribution"?: string,
202
202
  "rasterLayers"?: mixed,
203
+ "volatile"?: boolean,
203
204
  [_: string]: mixed
204
205
  }
205
206
 
@@ -244,7 +245,7 @@ export type SourceSpecification =
244
245
  | VectorSourceSpecification
245
246
  | RasterSourceSpecification
246
247
  | RasterDEMSourceSpecification
247
- | Raster_arraySourceSpecification
248
+ | RasterArraySourceSpecification
248
249
  | GeoJSONSourceSpecification
249
250
  | VideoSourceSpecification
250
251
  | ImageSourceSpecification
@@ -552,6 +553,30 @@ export type RasterLayerSpecification = {|
552
553
  |}
553
554
  |}
554
555
 
556
+ export type RasterParticleLayerSpecification = {|
557
+ "id": string,
558
+ "type": "raster-particle",
559
+ "metadata"?: mixed,
560
+ "source": string,
561
+ "source-layer"?: string,
562
+ "slot"?: string,
563
+ "minzoom"?: number,
564
+ "maxzoom"?: number,
565
+ "filter"?: FilterSpecification,
566
+ "layout"?: {|
567
+ "visibility"?: ExpressionSpecification
568
+ |},
569
+ "paint"?: {|
570
+ "raster-particle-array-band"?: string,
571
+ "raster-particle-count"?: number,
572
+ "raster-particle-color"?: ExpressionSpecification,
573
+ "raster-particle-max-speed"?: number,
574
+ "raster-particle-speed-factor"?: PropertyValueSpecification<number>,
575
+ "raster-particle-fade-opacity-factor"?: PropertyValueSpecification<number>,
576
+ "raster-particle-reset-rate-factor"?: number
577
+ |}
578
+ |}
579
+
555
580
  export type HillshadeLayerSpecification = {|
556
581
  "id": string,
557
582
  "type": "hillshade",
@@ -664,6 +689,7 @@ export type LayerSpecification =
664
689
  | HeatmapLayerSpecification
665
690
  | FillExtrusionLayerSpecification
666
691
  | RasterLayerSpecification
692
+ | RasterParticleLayerSpecification
667
693
  | HillshadeLayerSpecification
668
694
  | ModelLayerSpecification
669
695
  | BackgroundLayerSpecification
@@ -80,9 +80,13 @@ export default function validateLayer(options: Options): Array<ValidationError>
80
80
  errors.push(new ValidationError(key, layer, `layer "${layer.id}" must specify a "source-layer"`));
81
81
  } else if (sourceType === 'raster-dem' && type !== 'hillshade') {
82
82
  errors.push(new ValidationError(key, layer.source, 'raster-dem source can only be used with layer type \'hillshade\'.'));
83
+ } else if (sourceType === 'raster-array' && !['raster', 'raster-particle'].includes(type)) {
84
+ errors.push(new ValidationError(key, layer.source, `raster-array source can only be used with layer type \'raster\'.`));
83
85
  } else if (type === 'line' && layer.paint && (layer.paint['line-gradient'] || layer.paint['line-trim-offset']) &&
84
86
  (sourceType !== 'geojson' || !source.lineMetrics)) {
85
87
  errors.push(new ValidationError(key, layer, `layer "${layer.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`));
88
+ } else if (type === 'raster-particle' && sourceType !== 'raster-array') {
89
+ errors.push(new ValidationError(key, layer.source, `layer "${layer.id}" requires a \'raster-array\' source.`));
86
90
  }
87
91
  }
88
92
  }
@@ -28,7 +28,7 @@ export default function validateSource(options: ValidationOptions): Array<Valida
28
28
  const type = unbundle(value.type);
29
29
  let errors = [];
30
30
 
31
- if (['vector', 'raster', 'raster-dem'].includes(type)) {
31
+ if (['vector', 'raster', 'raster-dem', 'raster-array'].includes(type)) {
32
32
  if (!value.url && !value.tiles) {
33
33
  errors.push(new ValidationWarning(key, value, 'Either "url" or "tiles" is required.'));
34
34
  }
@@ -38,6 +38,7 @@ export default function validateSource(options: ValidationOptions): Array<Valida
38
38
  case 'vector':
39
39
  case 'raster':
40
40
  case 'raster-dem':
41
+ case 'raster-array':
41
42
  errors = errors.concat(validateObject({
42
43
  key,
43
44
  value,
@@ -36,7 +36,7 @@ function getAllowedKeyErrors(obj: Object, keys: Array<*>, path: ?string): Array<
36
36
  return errors;
37
37
  }
38
38
 
39
- const acceptedSourceTypes = new Set(["vector", "raster", "raster-dem", "model", "batched-model"]);
39
+ const acceptedSourceTypes = new Set(["vector", "raster", "raster-dem", "raster-array", "model", "batched-model"]);
40
40
  function getSourceErrors(source: Object, i: number): Array<ValidationError> {
41
41
  const errors = [];
42
42
 
@@ -48,7 +48,7 @@ function getSourceErrors(source: Object, i: number): Array<ValidationError> {
48
48
  errors.push(...getAllowedKeyErrors(source, sourceKeys, 'source'));
49
49
 
50
50
  /*
51
- * "type" is required and must be one of "vector", "raster", "raster-dem"
51
+ * "type" is required and must be one of "vector", "raster", "raster-dem", "raster-array"
52
52
  */
53
53
  if (!acceptedSourceTypes.has(String(source.type))) {
54
54
  errors.push(new ValidationError(`sources[${i}].type`, source.type, `Expected one of [${Array.from(acceptedSourceTypes).join(", ")}]`));