@mapbox/mapbox-gl-style-spec 14.7.1 → 14.8.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.ts CHANGED
@@ -386,7 +386,11 @@ export type FillLayerSpecification = {
386
386
  "filter"?: FilterSpecification,
387
387
  "layout"?: {
388
388
  "fill-sort-key"?: DataDrivenPropertyValueSpecification<number>,
389
- "visibility"?: "visible" | "none" | ExpressionSpecification
389
+ "visibility"?: "visible" | "none" | ExpressionSpecification,
390
+ /**
391
+ * @experimental This property is experimental and subject to change in future versions.
392
+ */
393
+ "fill-elevation-reference"?: "none" | "hd-road-base" | "hd-road-markup" | ExpressionSpecification
390
394
  },
391
395
  "paint"?: {
392
396
  "fill-antialias"?: PropertyValueSpecification<boolean>,
@@ -437,6 +441,14 @@ export type LineLayerSpecification = {
437
441
  * @experimental This property is experimental and subject to change in future versions.
438
442
  */
439
443
  "line-z-offset"?: DataDrivenPropertyValueSpecification<number>,
444
+ /**
445
+ * @experimental This property is experimental and subject to change in future versions.
446
+ */
447
+ "line-elevation-reference"?: "none" | "sea" | "ground" | "hd-road-markup" | ExpressionSpecification,
448
+ /**
449
+ * @experimental This property is experimental and subject to change in future versions.
450
+ */
451
+ "line-cross-slope"?: ExpressionSpecification,
440
452
  "visibility"?: "visible" | "none" | ExpressionSpecification
441
453
  },
442
454
  "paint"?: {
@@ -503,11 +515,19 @@ export type SymbolLayerSpecification = {
503
515
  "symbol-sort-key"?: DataDrivenPropertyValueSpecification<number>,
504
516
  "symbol-z-order"?: PropertyValueSpecification<"auto" | "viewport-y" | "source">,
505
517
  "symbol-z-elevate"?: PropertyValueSpecification<boolean>,
518
+ /**
519
+ * @experimental This property is experimental and subject to change in future versions.
520
+ */
521
+ "symbol-elevation-reference"?: PropertyValueSpecification<"sea" | "ground" | "hd-road-markup">,
506
522
  "icon-allow-overlap"?: PropertyValueSpecification<boolean>,
507
523
  "icon-ignore-placement"?: PropertyValueSpecification<boolean>,
508
524
  "icon-optional"?: PropertyValueSpecification<boolean>,
509
525
  "icon-rotation-alignment"?: PropertyValueSpecification<"map" | "viewport" | "auto">,
510
526
  "icon-size"?: DataDrivenPropertyValueSpecification<number>,
527
+ /**
528
+ * @experimental This property is experimental and subject to change in future versions.
529
+ */
530
+ "icon-size-scale-range"?: ExpressionSpecification,
511
531
  "icon-text-fit"?: DataDrivenPropertyValueSpecification<"none" | "width" | "height" | "both">,
512
532
  "icon-text-fit-padding"?: DataDrivenPropertyValueSpecification<[number, number, number, number]>,
513
533
  "icon-image"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>,
@@ -522,6 +542,10 @@ export type SymbolLayerSpecification = {
522
542
  "text-field"?: DataDrivenPropertyValueSpecification<FormattedSpecification>,
523
543
  "text-font"?: DataDrivenPropertyValueSpecification<Array<string>>,
524
544
  "text-size"?: DataDrivenPropertyValueSpecification<number>,
545
+ /**
546
+ * @experimental This property is experimental and subject to change in future versions.
547
+ */
548
+ "text-size-scale-range"?: ExpressionSpecification,
525
549
  "text-max-width"?: DataDrivenPropertyValueSpecification<number>,
526
550
  "text-line-height"?: DataDrivenPropertyValueSpecification<number>,
527
551
  "text-letter-spacing"?: DataDrivenPropertyValueSpecification<number>,
@@ -583,11 +607,7 @@ export type SymbolLayerSpecification = {
583
607
  "icon-color-brightness-min"?: ExpressionSpecification,
584
608
  "icon-color-brightness-max"?: ExpressionSpecification,
585
609
  "symbol-z-offset"?: DataDrivenPropertyValueSpecification<number>,
586
- "symbol-z-offset-transition"?: TransitionSpecification,
587
- /**
588
- * @experimental This property is experimental and subject to change in future versions.
589
- */
590
- "symbol-elevation-reference"?: PropertyValueSpecification<"sea" | "ground">
610
+ "symbol-z-offset-transition"?: TransitionSpecification
591
611
  }
592
612
  }
593
613
 
@@ -715,6 +735,14 @@ export type FillExtrusionLayerSpecification = {
715
735
  "fill-extrusion-height-transition"?: TransitionSpecification,
716
736
  "fill-extrusion-base"?: DataDrivenPropertyValueSpecification<number>,
717
737
  "fill-extrusion-base-transition"?: TransitionSpecification,
738
+ /**
739
+ * @experimental This property is experimental and subject to change in future versions.
740
+ */
741
+ "fill-extrusion-height-alignment"?: "terrain" | "flat",
742
+ /**
743
+ * @experimental This property is experimental and subject to change in future versions.
744
+ */
745
+ "fill-extrusion-base-alignment"?: "terrain" | "flat",
718
746
  "fill-extrusion-vertical-gradient"?: PropertyValueSpecification<boolean>,
719
747
  "fill-extrusion-ambient-occlusion-intensity"?: PropertyValueSpecification<number>,
720
748
  "fill-extrusion-ambient-occlusion-intensity-transition"?: TransitionSpecification,
@@ -21,6 +21,10 @@ export function supportsZoomExpression(spec: StylePropertySpecification): boolea
21
21
  return expressionHasParameter(spec.expression, 'zoom');
22
22
  }
23
23
 
24
+ export function supportsLineProgressExpression(spec: StylePropertySpecification): boolean {
25
+ return expressionHasParameter(spec.expression, 'line-progress');
26
+ }
27
+
24
28
  export function supportsInterpolation(spec: StylePropertySpecification): boolean {
25
29
  return !!spec.expression && spec.expression.interpolated;
26
30
  }
@@ -14,8 +14,7 @@ export default function validateEnum(options: ValidationOptions): Array<Validati
14
14
  errors.push(new ValidationError(key, value, `expected one of [${valueSpec.values.join(', ')}], ${JSON.stringify(value)} found`));
15
15
  }
16
16
  } else { // >=v8
17
- // @ts-expect-error - TS2345 - Argument of type 'unknown' is not assignable to parameter of type 'string'.
18
- if (Object.keys(valueSpec.values).indexOf(unbundle(value)) === -1) {
17
+ if (Object.keys(valueSpec.values).indexOf(unbundle(value) as string) === -1) {
19
18
  errors.push(new ValidationError(key, value, `expected one of [${Object.keys(valueSpec.values).join(', ')}], ${JSON.stringify(value)} found`));
20
19
  }
21
20
  }
@@ -8,7 +8,7 @@ import validateSpec from './validate';
8
8
  import extend from '../util/extend';
9
9
 
10
10
  import type {ValidationOptions} from './validate';
11
- import type {LayerSpecification} from '../types';
11
+ import type {LayerSpecification, GeoJSONSourceSpecification} from '../types';
12
12
 
13
13
  type Options = ValidationOptions & {
14
14
  value: LayerSpecification;
@@ -26,7 +26,7 @@ export default function validateLayer(options: Options): Array<ValidationError>
26
26
  if (!layer.type && !layer.ref) {
27
27
  errors.push(new ValidationError(key, layer, 'either "type" or "ref" is required'));
28
28
  }
29
- let type = unbundle(layer.type);
29
+ let type = unbundle(layer.type) as string;
30
30
  const ref = unbundle(layer.ref);
31
31
 
32
32
  if (layer.id) {
@@ -59,7 +59,7 @@ export default function validateLayer(options: Options): Array<ValidationError>
59
59
  } else if (parent.ref) {
60
60
  errors.push(new ValidationError(key, layer.ref, 'ref cannot reference another ref layer'));
61
61
  } else {
62
- type = unbundle(parent.type);
62
+ type = unbundle(parent.type) as string;
63
63
  }
64
64
  } else if (!(type === 'background' || type === 'sky' || type === 'slot')) {
65
65
  if (!layer.source) {
@@ -77,12 +77,10 @@ export default function validateLayer(options: Options): Array<ValidationError>
77
77
  errors.push(new ValidationError(key, layer, `layer "${layer.id}" must specify a "source-layer"`));
78
78
  } else if (sourceType === 'raster-dem' && type !== 'hillshade') {
79
79
  errors.push(new ValidationError(key, layer.source, 'raster-dem source can only be used with layer type \'hillshade\'.'));
80
- // @ts-expect-error - TS2345 - Argument of type 'unknown' is not assignable to parameter of type 'string'.
81
80
  } else if (sourceType === 'raster-array' && !['raster', 'raster-particle'].includes(type)) {
82
81
  errors.push(new ValidationError(key, layer.source, `raster-array source can only be used with layer type \'raster\'.`));
83
82
  } else if (type === 'line' && layer.paint && (layer.paint['line-gradient'] || layer.paint['line-trim-offset']) &&
84
- // @ts-expect-error - TS2339 - Property 'lineMetrics' does not exist on type 'SourceSpecification'.
85
- (sourceType !== 'geojson' || !source.lineMetrics)) {
83
+ (sourceType !== 'geojson' || !(source as GeoJSONSourceSpecification).lineMetrics)) {
86
84
  errors.push(new ValidationError(key, layer, `layer "${layer.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`));
87
85
  } else if (type === 'raster-particle' && sourceType !== 'raster-array') {
88
86
  errors.push(new ValidationError(key, layer.source, `layer "${layer.id}" requires a \'raster-array\' source.`));