@mapbox/mapbox-gl-style-spec 14.11.0 → 14.12.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.
Files changed (82) hide show
  1. package/composite.ts +2 -0
  2. package/deref.ts +5 -5
  3. package/diff.ts +65 -31
  4. package/dist/index.cjs +816 -16
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.ts +224 -16
  7. package/dist/index.es.js +816 -16
  8. package/dist/index.es.js.map +1 -1
  9. package/error/validation_error.ts +1 -3
  10. package/expression/compound_expression.ts +1 -1
  11. package/expression/definitions/assertion.ts +2 -1
  12. package/expression/definitions/at.ts +1 -1
  13. package/expression/definitions/at_interpolated.ts +1 -1
  14. package/expression/definitions/case.ts +3 -1
  15. package/expression/definitions/coalesce.ts +3 -2
  16. package/expression/definitions/coercion.ts +3 -1
  17. package/expression/definitions/collator.ts +2 -1
  18. package/expression/definitions/comparison.ts +15 -1
  19. package/expression/definitions/config.ts +4 -1
  20. package/expression/definitions/distance.ts +6 -4
  21. package/expression/definitions/format.ts +1 -1
  22. package/expression/definitions/index.ts +24 -2
  23. package/expression/definitions/index_of.ts +1 -0
  24. package/expression/definitions/interpolate.ts +7 -3
  25. package/expression/definitions/let.ts +1 -0
  26. package/expression/definitions/literal.ts +2 -2
  27. package/expression/definitions/match.ts +4 -2
  28. package/expression/definitions/number_format.ts +3 -4
  29. package/expression/definitions/slice.ts +1 -0
  30. package/expression/definitions/step.ts +2 -1
  31. package/expression/definitions/var.ts +1 -0
  32. package/expression/definitions/within.ts +6 -2
  33. package/expression/evaluation_context.ts +3 -5
  34. package/expression/expression.ts +3 -0
  35. package/expression/index.ts +20 -10
  36. package/expression/parsing_context.ts +1 -1
  37. package/expression/types/image_variant.ts +2 -2
  38. package/expression/types.ts +1 -0
  39. package/expression/values.ts +1 -3
  40. package/feature_filter/convert.ts +13 -6
  41. package/feature_filter/index.ts +17 -1
  42. package/format.ts +1 -0
  43. package/function/convert.ts +5 -1
  44. package/function/index.ts +28 -0
  45. package/group_by_layout.ts +17 -8
  46. package/migrate/expressions.ts +3 -3
  47. package/migrate/v8.ts +10 -1
  48. package/migrate/v9.ts +2 -1
  49. package/migrate.ts +2 -1
  50. package/package.json +1 -1
  51. package/read_style.ts +1 -0
  52. package/reference/latest.ts +1 -0
  53. package/reference/v8.json +425 -8
  54. package/test.js +2 -4
  55. package/types.ts +207 -1
  56. package/union-to-intersection.ts +1 -0
  57. package/util/extend.ts +2 -1
  58. package/util/geometry_util.ts +25 -9
  59. package/util/interpolate.ts +1 -1
  60. package/validate/validate.ts +6 -0
  61. package/validate/validate_array.ts +2 -0
  62. package/validate/validate_enum.ts +1 -0
  63. package/validate/validate_expression.ts +4 -0
  64. package/validate/validate_filter.ts +4 -2
  65. package/validate/validate_fog.ts +4 -1
  66. package/validate/validate_function.ts +7 -2
  67. package/validate/validate_glyphs_url.ts +1 -1
  68. package/validate/validate_iconset.ts +1 -0
  69. package/validate/validate_layer.ts +3 -2
  70. package/validate/validate_light.ts +4 -1
  71. package/validate/validate_lights.ts +7 -1
  72. package/validate/validate_model.ts +4 -0
  73. package/validate/validate_object.ts +2 -2
  74. package/validate/validate_projection.ts +1 -0
  75. package/validate/validate_property.ts +5 -1
  76. package/validate/validate_rain.ts +3 -0
  77. package/validate/validate_snow.ts +3 -0
  78. package/validate/validate_source.ts +9 -9
  79. package/validate/validate_terrain.ts +5 -1
  80. package/validate_mapbox_api_supported.ts +31 -20
  81. package/validate_style.ts +1 -0
  82. package/visit.ts +4 -2
package/types.ts CHANGED
@@ -59,6 +59,7 @@ export type CompositeFunctionSpecification<T> =
59
59
  | { type: 'interval', stops: Array<[{zoom: number, value: number}, T]>, property: string, default?: T }
60
60
  | { type: 'categorical', stops: Array<[{zoom: number, value: string | number | boolean}, T]>, property: string, default?: T };
61
61
 
62
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
63
  export type ExpressionSpecification = [string, ...any[]];
63
64
 
64
65
  export type PropertyValueSpecification<T> =
@@ -171,49 +172,106 @@ export type FogSpecification = {
171
172
  }
172
173
 
173
174
  export type SnowSpecification = {
175
+ /**
176
+ * @experimental This property is experimental and subject to change in future versions.
177
+ */
174
178
  "density"?: PropertyValueSpecification<number>,
175
179
  "density-transition"?: TransitionSpecification,
180
+ /**
181
+ * @experimental This property is experimental and subject to change in future versions.
182
+ */
176
183
  "intensity"?: PropertyValueSpecification<number>,
177
184
  "intensity-transition"?: TransitionSpecification,
185
+ /**
186
+ * @experimental This property is experimental and subject to change in future versions.
187
+ */
178
188
  "color"?: PropertyValueSpecification<ColorSpecification>,
179
189
  "color-transition"?: TransitionSpecification,
180
190
  "color-use-theme"?: PropertyValueSpecification<string>,
191
+ /**
192
+ * @experimental This property is experimental and subject to change in future versions.
193
+ */
181
194
  "opacity"?: PropertyValueSpecification<number>,
182
195
  "opacity-transition"?: TransitionSpecification,
196
+ /**
197
+ * @experimental This property is experimental and subject to change in future versions.
198
+ */
183
199
  "vignette"?: PropertyValueSpecification<number>,
184
200
  "vignette-transition"?: TransitionSpecification,
201
+ /**
202
+ * @experimental This property is experimental and subject to change in future versions.
203
+ */
185
204
  "vignette-color"?: PropertyValueSpecification<ColorSpecification>,
186
205
  "vignette-color-transition"?: TransitionSpecification,
187
206
  "vignette-color-use-theme"?: PropertyValueSpecification<string>,
207
+ /**
208
+ * @experimental This property is experimental and subject to change in future versions.
209
+ */
188
210
  "center-thinning"?: PropertyValueSpecification<number>,
189
211
  "center-thinning-transition"?: TransitionSpecification,
212
+ /**
213
+ * @experimental This property is experimental and subject to change in future versions.
214
+ */
190
215
  "direction"?: PropertyValueSpecification<[number, number]>,
191
216
  "direction-transition"?: TransitionSpecification,
217
+ /**
218
+ * @experimental This property is experimental and subject to change in future versions.
219
+ */
192
220
  "flake-size"?: PropertyValueSpecification<number>,
193
221
  "flake-size-transition"?: TransitionSpecification
194
222
  }
195
223
 
196
224
  export type RainSpecification = {
225
+ /**
226
+ * @experimental This property is experimental and subject to change in future versions.
227
+ */
197
228
  "density"?: PropertyValueSpecification<number>,
198
229
  "density-transition"?: TransitionSpecification,
230
+ /**
231
+ * @experimental This property is experimental and subject to change in future versions.
232
+ */
199
233
  "intensity"?: PropertyValueSpecification<number>,
200
234
  "intensity-transition"?: TransitionSpecification,
235
+ /**
236
+ * @experimental This property is experimental and subject to change in future versions.
237
+ */
201
238
  "color"?: PropertyValueSpecification<ColorSpecification>,
202
239
  "color-transition"?: TransitionSpecification,
203
240
  "color-use-theme"?: PropertyValueSpecification<string>,
241
+ /**
242
+ * @experimental This property is experimental and subject to change in future versions.
243
+ */
204
244
  "opacity"?: PropertyValueSpecification<number>,
205
245
  "opacity-transition"?: TransitionSpecification,
246
+ /**
247
+ * @experimental This property is experimental and subject to change in future versions.
248
+ */
206
249
  "vignette"?: PropertyValueSpecification<number>,
207
250
  "vignette-transition"?: TransitionSpecification,
251
+ /**
252
+ * @experimental This property is experimental and subject to change in future versions.
253
+ */
208
254
  "vignette-color"?: PropertyValueSpecification<ColorSpecification>,
209
255
  "vignette-color-transition"?: TransitionSpecification,
210
256
  "vignette-color-use-theme"?: PropertyValueSpecification<string>,
257
+ /**
258
+ * @experimental This property is experimental and subject to change in future versions.
259
+ */
211
260
  "center-thinning"?: PropertyValueSpecification<number>,
212
261
  "center-thinning-transition"?: TransitionSpecification,
262
+ /**
263
+ * @experimental This property is experimental and subject to change in future versions.
264
+ */
213
265
  "direction"?: PropertyValueSpecification<[number, number]>,
214
266
  "direction-transition"?: TransitionSpecification,
267
+ /**
268
+ * @experimental This property is experimental and subject to change in future versions.
269
+ */
215
270
  "droplet-size"?: PropertyValueSpecification<[number, number]>,
216
271
  "droplet-size-transition"?: TransitionSpecification,
272
+ /**
273
+ * @experimental This property is experimental and subject to change in future versions.
274
+ */
217
275
  "distortion-strength"?: PropertyValueSpecification<number>,
218
276
  "distortion-strength-transition"?: TransitionSpecification
219
277
  }
@@ -329,6 +387,7 @@ export type VectorSourceSpecification = {
329
387
  "url"?: string,
330
388
  "tiles"?: Array<string>,
331
389
  "bounds"?: [number, number, number, number],
390
+ "extra_bounds"?: Array<[number, number, number, number]>,
332
391
  "scheme"?: "xyz" | "tms",
333
392
  "minzoom"?: number,
334
393
  "maxzoom"?: number,
@@ -343,6 +402,7 @@ export type RasterSourceSpecification = {
343
402
  "url"?: string,
344
403
  "tiles"?: Array<string>,
345
404
  "bounds"?: [number, number, number, number],
405
+ "extra_bounds"?: Array<[number, number, number, number]>,
346
406
  "minzoom"?: number,
347
407
  "maxzoom"?: number,
348
408
  "tileSize"?: number,
@@ -357,6 +417,7 @@ export type RasterDEMSourceSpecification = {
357
417
  "url"?: string,
358
418
  "tiles"?: Array<string>,
359
419
  "bounds"?: [number, number, number, number],
420
+ "extra_bounds"?: Array<[number, number, number, number]>,
360
421
  "minzoom"?: number,
361
422
  "maxzoom"?: number,
362
423
  "tileSize"?: number,
@@ -374,6 +435,7 @@ export type RasterArraySourceSpecification = {
374
435
  "url"?: string,
375
436
  "tiles"?: Array<string>,
376
437
  "bounds"?: [number, number, number, number],
438
+ "extra_bounds"?: Array<[number, number, number, number]>,
377
439
  "minzoom"?: number,
378
440
  "maxzoom"?: number,
379
441
  "tileSize"?: number,
@@ -533,13 +595,24 @@ export type FillLayerSpecification = {
533
595
  "fill-translate-transition"?: TransitionSpecification,
534
596
  "fill-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">,
535
597
  "fill-pattern"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>,
598
+ "fill-pattern-cross-fade"?: PropertyValueSpecification<number>,
599
+ "fill-pattern-cross-fade-transition"?: TransitionSpecification,
536
600
  "fill-emissive-strength"?: PropertyValueSpecification<number>,
537
601
  "fill-emissive-strength-transition"?: TransitionSpecification,
602
+ /**
603
+ * @experimental This property is experimental and subject to change in future versions.
604
+ */
538
605
  "fill-z-offset"?: DataDrivenPropertyValueSpecification<number>,
539
606
  "fill-z-offset-transition"?: TransitionSpecification,
607
+ /**
608
+ * @experimental This property is experimental and subject to change in future versions.
609
+ */
540
610
  "fill-bridge-guard-rail-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>,
541
611
  "fill-bridge-guard-rail-color-transition"?: TransitionSpecification,
542
612
  "fill-bridge-guard-rail-color-use-theme"?: PropertyValueSpecification<string>,
613
+ /**
614
+ * @experimental This property is experimental and subject to change in future versions.
615
+ */
543
616
  "fill-tunnel-structure-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>,
544
617
  "fill-tunnel-structure-color-transition"?: TransitionSpecification,
545
618
  "fill-tunnel-structure-color-use-theme"?: PropertyValueSpecification<string>
@@ -609,6 +682,8 @@ export type LineLayerSpecification = {
609
682
  "line-blur-transition"?: TransitionSpecification,
610
683
  "line-dasharray"?: DataDrivenPropertyValueSpecification<Array<number>>,
611
684
  "line-pattern"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>,
685
+ "line-pattern-cross-fade"?: PropertyValueSpecification<number>,
686
+ "line-pattern-cross-fade-transition"?: TransitionSpecification,
612
687
  "line-gradient"?: ExpressionSpecification,
613
688
  "line-gradient-use-theme"?: PropertyValueSpecification<string>,
614
689
  "line-trim-offset"?: [number, number],
@@ -616,6 +691,9 @@ export type LineLayerSpecification = {
616
691
  * @experimental This property is experimental and subject to change in future versions.
617
692
  */
618
693
  "line-trim-fade-range"?: PropertyValueSpecification<[number, number]>,
694
+ /**
695
+ * @experimental This property is experimental and subject to change in future versions.
696
+ */
619
697
  "line-trim-color"?: PropertyValueSpecification<ColorSpecification>,
620
698
  "line-trim-color-transition"?: TransitionSpecification,
621
699
  "line-trim-color-use-theme"?: PropertyValueSpecification<string>,
@@ -730,7 +808,7 @@ export type SymbolLayerSpecification = {
730
808
  "icon-translate"?: PropertyValueSpecification<[number, number]>,
731
809
  "icon-translate-transition"?: TransitionSpecification,
732
810
  "icon-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">,
733
- "icon-image-cross-fade"?: DataDrivenPropertyValueSpecification<number>,
811
+ "icon-image-cross-fade"?: PropertyValueSpecification<number>,
734
812
  "icon-image-cross-fade-transition"?: TransitionSpecification,
735
813
  "text-opacity"?: DataDrivenPropertyValueSpecification<number>,
736
814
  "text-opacity-transition"?: TransitionSpecification,
@@ -753,6 +831,9 @@ export type SymbolLayerSpecification = {
753
831
  "icon-color-contrast"?: ExpressionSpecification,
754
832
  "icon-color-brightness-min"?: ExpressionSpecification,
755
833
  "icon-color-brightness-max"?: ExpressionSpecification,
834
+ /**
835
+ * @experimental This property is experimental and subject to change in future versions.
836
+ */
756
837
  "symbol-z-offset"?: DataDrivenPropertyValueSpecification<number>,
757
838
  "symbol-z-offset-transition"?: TransitionSpecification
758
839
  }
@@ -886,6 +967,8 @@ export type FillExtrusionLayerSpecification = {
886
967
  "fill-extrusion-translate-transition"?: TransitionSpecification,
887
968
  "fill-extrusion-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">,
888
969
  "fill-extrusion-pattern"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>,
970
+ "fill-extrusion-pattern-cross-fade"?: PropertyValueSpecification<number>,
971
+ "fill-extrusion-pattern-cross-fade-transition"?: TransitionSpecification,
889
972
  "fill-extrusion-height"?: DataDrivenPropertyValueSpecification<number>,
890
973
  "fill-extrusion-height-transition"?: TransitionSpecification,
891
974
  "fill-extrusion-base"?: DataDrivenPropertyValueSpecification<number>,
@@ -903,23 +986,50 @@ export type FillExtrusionLayerSpecification = {
903
986
  "fill-extrusion-ambient-occlusion-intensity-transition"?: TransitionSpecification,
904
987
  "fill-extrusion-ambient-occlusion-radius"?: PropertyValueSpecification<number>,
905
988
  "fill-extrusion-ambient-occlusion-radius-transition"?: TransitionSpecification,
989
+ /**
990
+ * @experimental This property is experimental and subject to change in future versions.
991
+ */
906
992
  "fill-extrusion-ambient-occlusion-wall-radius"?: PropertyValueSpecification<number>,
907
993
  "fill-extrusion-ambient-occlusion-wall-radius-transition"?: TransitionSpecification,
994
+ /**
995
+ * @experimental This property is experimental and subject to change in future versions.
996
+ */
908
997
  "fill-extrusion-ambient-occlusion-ground-radius"?: PropertyValueSpecification<number>,
909
998
  "fill-extrusion-ambient-occlusion-ground-radius-transition"?: TransitionSpecification,
999
+ /**
1000
+ * @experimental This property is experimental and subject to change in future versions.
1001
+ */
910
1002
  "fill-extrusion-ambient-occlusion-ground-attenuation"?: PropertyValueSpecification<number>,
911
1003
  "fill-extrusion-ambient-occlusion-ground-attenuation-transition"?: TransitionSpecification,
1004
+ /**
1005
+ * @experimental This property is experimental and subject to change in future versions.
1006
+ */
912
1007
  "fill-extrusion-flood-light-color"?: PropertyValueSpecification<ColorSpecification>,
913
1008
  "fill-extrusion-flood-light-color-transition"?: TransitionSpecification,
914
1009
  "fill-extrusion-flood-light-color-use-theme"?: PropertyValueSpecification<string>,
1010
+ /**
1011
+ * @experimental This property is experimental and subject to change in future versions.
1012
+ */
915
1013
  "fill-extrusion-flood-light-intensity"?: PropertyValueSpecification<number>,
916
1014
  "fill-extrusion-flood-light-intensity-transition"?: TransitionSpecification,
1015
+ /**
1016
+ * @experimental This property is experimental and subject to change in future versions.
1017
+ */
917
1018
  "fill-extrusion-flood-light-wall-radius"?: DataDrivenPropertyValueSpecification<number>,
918
1019
  "fill-extrusion-flood-light-wall-radius-transition"?: TransitionSpecification,
1020
+ /**
1021
+ * @experimental This property is experimental and subject to change in future versions.
1022
+ */
919
1023
  "fill-extrusion-flood-light-ground-radius"?: DataDrivenPropertyValueSpecification<number>,
920
1024
  "fill-extrusion-flood-light-ground-radius-transition"?: TransitionSpecification,
1025
+ /**
1026
+ * @experimental This property is experimental and subject to change in future versions.
1027
+ */
921
1028
  "fill-extrusion-flood-light-ground-attenuation"?: PropertyValueSpecification<number>,
922
1029
  "fill-extrusion-flood-light-ground-attenuation-transition"?: TransitionSpecification,
1030
+ /**
1031
+ * @experimental This property is experimental and subject to change in future versions.
1032
+ */
923
1033
  "fill-extrusion-vertical-scale"?: PropertyValueSpecification<number>,
924
1034
  "fill-extrusion-vertical-scale-transition"?: TransitionSpecification,
925
1035
  /**
@@ -929,6 +1039,9 @@ export type FillExtrusionLayerSpecification = {
929
1039
  "fill-extrusion-cutoff-fade-range"?: ExpressionSpecification,
930
1040
  "fill-extrusion-emissive-strength"?: DataDrivenPropertyValueSpecification<number>,
931
1041
  "fill-extrusion-emissive-strength-transition"?: TransitionSpecification,
1042
+ /**
1043
+ * @experimental This property is experimental and subject to change in future versions.
1044
+ */
932
1045
  "fill-extrusion-line-width"?: DataDrivenPropertyValueSpecification<number>,
933
1046
  "fill-extrusion-line-width-transition"?: TransitionSpecification,
934
1047
  "fill-extrusion-cast-shadows"?: boolean
@@ -945,6 +1058,90 @@ export type FillExtrusionLayout = FillExtrusionLayerSpecification['layout'];
945
1058
  */
946
1059
  export type FillExtrusionPaint = FillExtrusionLayerSpecification['paint'];
947
1060
 
1061
+ export type BuildingLayerSpecification = {
1062
+ "id": string,
1063
+ "type": "building",
1064
+ "metadata"?: unknown,
1065
+ "source": string,
1066
+ "source-layer"?: string,
1067
+ "slot"?: string,
1068
+ "minzoom"?: number,
1069
+ "maxzoom"?: number,
1070
+ "filter"?: FilterSpecification,
1071
+ "layout"?: {
1072
+ "visibility"?: "visible" | "none" | ExpressionSpecification,
1073
+ /**
1074
+ * @experimental This property is experimental and subject to change in future versions.
1075
+ */
1076
+ "building-roof-shape"?: DataDrivenPropertyValueSpecification<"flat" | "hipped" | "gabled" | "parapet" | "mansard" | "skillion" | "pyramidal">,
1077
+ /**
1078
+ * @experimental This property is experimental and subject to change in future versions.
1079
+ */
1080
+ "building-height"?: DataDrivenPropertyValueSpecification<number>,
1081
+ "building-height-transition"?: TransitionSpecification,
1082
+ /**
1083
+ * @experimental This property is experimental and subject to change in future versions.
1084
+ */
1085
+ "building-base"?: DataDrivenPropertyValueSpecification<number>,
1086
+ "building-base-transition"?: TransitionSpecification
1087
+ },
1088
+ "paint"?: {
1089
+ /**
1090
+ * @experimental This property is experimental and subject to change in future versions.
1091
+ */
1092
+ "building-opacity"?: PropertyValueSpecification<number>,
1093
+ "building-opacity-transition"?: TransitionSpecification,
1094
+ /**
1095
+ * @experimental This property is experimental and subject to change in future versions.
1096
+ */
1097
+ "building-ambient-occlusion-wall-intensity"?: PropertyValueSpecification<number>,
1098
+ "building-ambient-occlusion-wall-intensity-transition"?: TransitionSpecification,
1099
+ /**
1100
+ * @experimental This property is experimental and subject to change in future versions.
1101
+ */
1102
+ "building-ambient-occlusion-ground-intensity"?: PropertyValueSpecification<number>,
1103
+ "building-ambient-occlusion-ground-intensity-transition"?: TransitionSpecification,
1104
+ /**
1105
+ * @experimental This property is experimental and subject to change in future versions.
1106
+ */
1107
+ "building-ambient-occlusion-ground-radius"?: PropertyValueSpecification<number>,
1108
+ "building-ambient-occlusion-ground-radius-transition"?: TransitionSpecification,
1109
+ /**
1110
+ * @experimental This property is experimental and subject to change in future versions.
1111
+ */
1112
+ "building-ambient-occlusion-ground-attenuation"?: PropertyValueSpecification<number>,
1113
+ "building-ambient-occlusion-ground-attenuation-transition"?: TransitionSpecification,
1114
+ /**
1115
+ * @experimental This property is experimental and subject to change in future versions.
1116
+ */
1117
+ "building-vertical-scale"?: PropertyValueSpecification<number>,
1118
+ "building-vertical-scale-transition"?: TransitionSpecification,
1119
+ /**
1120
+ * @experimental This property is experimental and subject to change in future versions.
1121
+ */
1122
+ "building-cast-shadows"?: boolean,
1123
+ /**
1124
+ * @experimental This property is experimental and subject to change in future versions.
1125
+ */
1126
+ "building-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>,
1127
+ "building-color-use-theme"?: PropertyValueSpecification<string>,
1128
+ /**
1129
+ * @experimental This property is experimental and subject to change in future versions.
1130
+ */
1131
+ "building-emissive-strength"?: DataDrivenPropertyValueSpecification<number>
1132
+ }
1133
+ }
1134
+
1135
+ /**
1136
+ * @deprecated Use `BuildingLayerSpecification['layout']` instead.
1137
+ */
1138
+ export type BuildingLayout = BuildingLayerSpecification['layout'];
1139
+
1140
+ /**
1141
+ * @deprecated Use `BuildingLayerSpecification['paint']` instead.
1142
+ */
1143
+ export type BuildingPaint = BuildingLayerSpecification['paint'];
1144
+
948
1145
  export type RasterLayerSpecification = {
949
1146
  "id": string,
950
1147
  "type": "raster",
@@ -985,6 +1182,9 @@ export type RasterLayerSpecification = {
985
1182
  * @experimental This property is experimental and subject to change in future versions.
986
1183
  */
987
1184
  "raster-array-band"?: string,
1185
+ /**
1186
+ * @experimental This property is experimental and subject to change in future versions.
1187
+ */
988
1188
  "raster-elevation"?: PropertyValueSpecification<number>,
989
1189
  "raster-elevation-transition"?: TransitionSpecification
990
1190
  }
@@ -1257,6 +1457,7 @@ export type LayerSpecification =
1257
1457
  | CircleLayerSpecification
1258
1458
  | HeatmapLayerSpecification
1259
1459
  | FillExtrusionLayerSpecification
1460
+ | BuildingLayerSpecification
1260
1461
  | RasterLayerSpecification
1261
1462
  | RasterParticleLayerSpecification
1262
1463
  | HillshadeLayerSpecification
@@ -1327,6 +1528,11 @@ export type HeatmapLayer = HeatmapLayerSpecification;
1327
1528
  */
1328
1529
  export type FillExtrusionLayer = FillExtrusionLayerSpecification;
1329
1530
 
1531
+ /**
1532
+ * @deprecated Use `BuildingLayerSpecification` instead.
1533
+ */
1534
+ export type BuildingLayer = BuildingLayerSpecification;
1535
+
1330
1536
  /**
1331
1537
  * @deprecated Use `RasterLayerSpecification` instead.
1332
1538
  */
@@ -1,4 +1,5 @@
1
1
  export type UnionToIntersection<U> =
2
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
3
  (U extends any ? (k: U) => void : never) extends (k: infer I) => void ?
3
4
  {[K in keyof I]: I[K]} :
4
5
  never;
package/util/extend.ts CHANGED
@@ -1,4 +1,5 @@
1
- export default function(output: any, ...inputs: Array<any>): any {
1
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
+ export default function (output: any, ...inputs: Array<any>): any {
2
3
  for (const input of inputs) {
3
4
  for (const k in input) {
4
5
  output[k] = input[k];
@@ -1,6 +1,7 @@
1
1
  import quickselect from 'quickselect';
2
+ import Point from '@mapbox/point-geometry';
2
3
 
3
- import type Point from '@mapbox/point-geometry';
4
+ type Ring = Point[] & {area?: number};
4
5
 
5
6
  // minX, minY, maxX, maxY
6
7
  export type BBox = [number, number, number, number];
@@ -10,7 +11,7 @@ export type BBox = [number, number, number, number];
10
11
  * have a clockwise winding. Negative areas are interior rings and have a counter clockwise
11
12
  * ordering.
12
13
  */
13
- function calculateSignedArea(ring: Array<Point>): number {
14
+ function calculateSignedArea(ring: Ring): number {
14
15
  let sum = 0;
15
16
  for (let i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) {
16
17
  p1 = ring[i];
@@ -20,16 +21,12 @@ function calculateSignedArea(ring: Array<Point>): number {
20
21
  return sum;
21
22
  }
22
23
 
23
- function compareAreas(a: {
24
- area: number;
25
- }, b: {
26
- area: number;
27
- }) {
24
+ function compareAreas(a: Ring, b: Ring): number {
28
25
  return b.area - a.area;
29
26
  }
30
27
 
31
28
  // classifies an array of rings into polygons with outer rings and holes
32
- export function classifyRings(rings: Array<Array<Point>>, maxRings: number): Array<Array<Array<Point>>> {
29
+ export function classifyRings(rings: Array<Ring>, maxRings: number): Array<Array<Ring>> {
33
30
  const len = rings.length;
34
31
 
35
32
  if (len <= 1) return [rings];
@@ -42,7 +39,7 @@ export function classifyRings(rings: Array<Array<Point>>, maxRings: number): Arr
42
39
  const area = calculateSignedArea(rings[i]);
43
40
  if (area === 0) continue;
44
41
 
45
- (rings[i] as any).area = Math.abs(area);
42
+ rings[i].area = Math.abs(area);
46
43
 
47
44
  if (ccw === undefined) ccw = area < 0;
48
45
 
@@ -66,6 +63,7 @@ export function classifyRings(rings: Array<Array<Point>>, maxRings: number): Arr
66
63
  }
67
64
  }
68
65
 
66
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
69
67
  return polygons;
70
68
  }
71
69
 
@@ -154,3 +152,21 @@ export function segmentIntersectSegment(
154
152
  return false;
155
153
  }
156
154
 
155
+ export interface Bounds {
156
+ min: Point;
157
+ max: Point;
158
+ }
159
+
160
+ export function computeBounds(points: Point[][]): Bounds {
161
+ const min = new Point(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);
162
+ const max = new Point(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY);
163
+
164
+ for (const point of points[0]) {
165
+ if (min.x > point.x) min.x = point.x;
166
+ if (min.y > point.y) min.y = point.y;
167
+ if (max.x < point.x) max.x = point.x;
168
+ if (max.y < point.y) max.y = point.y;
169
+ }
170
+
171
+ return {min, max};
172
+ }
@@ -19,6 +19,6 @@ export function array(from: Array<number>, to: Array<number>, t: number): Array<
19
19
  });
20
20
  }
21
21
 
22
- export function easeIn (x: number) {
22
+ export function easeIn(x: number) {
23
23
  return x * x * x * x * x;
24
24
  }
@@ -68,12 +68,16 @@ const VALIDATORS = {
68
68
  // - styleSpec: current full spec being evaluated.
69
69
  export type ValidationOptions = {
70
70
  key: string;
71
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
72
  value: any;
73
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
72
74
  valueSpec?: any;
73
75
  style: Partial<StyleSpecification>;
74
76
  styleSpec: StyleReference;
77
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
75
78
  object?: any;
76
79
  objectKey?: string;
80
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
77
81
  objectElementValidators?: Record<string, (...args: any[]) => Array<ValidationError>>;
78
82
  };
79
83
 
@@ -83,6 +87,7 @@ export default function validate(options: ValidationOptions, arrayAsExpression:
83
87
  const styleSpec = options.styleSpec;
84
88
 
85
89
  if (valueSpec.expression && isFunction(unbundle(value))) {
90
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
86
91
  return validateFunction(options);
87
92
  } else if (valueSpec.expression && isExpression(deepUnbundle(value))) {
88
93
  return validateExpression(options);
@@ -92,6 +97,7 @@ export default function validate(options: ValidationOptions, arrayAsExpression:
92
97
  // Try to validate as an expression
93
98
  return validateExpression(options);
94
99
  } else {
100
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
95
101
  return valid;
96
102
  }
97
103
  } else {
@@ -5,6 +5,7 @@ import ValidationError from '../error/validation_error';
5
5
  import type {ValidationOptions} from './validate';
6
6
 
7
7
  type Options = ValidationOptions & {
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
9
  arrayElementValidator: any;
9
10
  };
10
11
 
@@ -56,5 +57,6 @@ export default function validateArray(options: Options): Array<ValidationError>
56
57
  key: `${key}[${i}]`
57
58
  }, true));
58
59
  }
60
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
59
61
  return errors;
60
62
  }
@@ -18,5 +18,6 @@ export default function validateEnum(options: ValidationOptions): Array<Validati
18
18
  errors.push(new ValidationError(key, value, `expected one of [${Object.keys(valueSpec.values).join(', ')}], ${JSON.stringify(value)} found`));
19
19
  }
20
20
  }
21
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
21
22
  return errors;
22
23
  }
@@ -6,6 +6,7 @@ import CompoundExpression from '../expression/compound_expression';
6
6
 
7
7
  import type {Expression} from '../expression/expression';
8
8
 
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
10
  export default function validateExpression(options: any): Array<ValidationError> {
10
11
  const expression = (options.expressionContext === 'property' ? createPropertyExpression : createExpression)(deepUnbundle(options.value), options.valueSpec);
11
12
  if (expression.result === 'error') {
@@ -14,6 +15,7 @@ export default function validateExpression(options: any): Array<ValidationError>
14
15
  });
15
16
  }
16
17
 
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
19
  const expressionObj = (expression.value as any).expression || (expression.value as any)._styleExpression.expression;
18
20
 
19
21
  if (options.expressionContext === 'property' && (options.propertyKey === 'text-font') &&
@@ -42,6 +44,7 @@ export default function validateExpression(options: any): Array<ValidationError>
42
44
  return [];
43
45
  }
44
46
 
47
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
48
  export function disallowedFilterParameters(e: Expression, options: any): Array<ValidationError> {
46
49
  const disallowedParameters = new Set([
47
50
  'zoom',
@@ -70,5 +73,6 @@ export function disallowedFilterParameters(e: Expression, options: any): Array<V
70
73
  errors.push(...disallowedFilterParameters(arg, options));
71
74
  });
72
75
 
76
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
73
77
  return errors;
74
78
  }
@@ -26,6 +26,7 @@ export default function validateFilter(options: Options): Array<ValidationError>
26
26
  valueSpec: options.styleSpec[`filter_${layerType}`]
27
27
  }));
28
28
  } else {
29
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
29
30
  return validateNonExpressionFilter(options);
30
31
  }
31
32
  }
@@ -100,12 +101,12 @@ function validateNonExpressionFilter(options: Options) {
100
101
  case 'all':
101
102
  case 'none':
102
103
  for (let i = 1; i < value.length; i++) {
103
- errors = errors.concat(validateNonExpressionFilter(({
104
+ errors = errors.concat(validateNonExpressionFilter({
104
105
  key: `${key}[${i}]`,
105
106
  value: value[i],
106
107
  style: options.style,
107
108
  styleSpec: options.styleSpec
108
- } as any)));
109
+ }));
109
110
  }
110
111
  break;
111
112
 
@@ -119,5 +120,6 @@ function validateNonExpressionFilter(options: Options) {
119
120
  }
120
121
  break;
121
122
  }
123
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
122
124
  return errors;
123
125
  }
@@ -13,9 +13,11 @@ export default function validateFog(options: ValidationOptions): Array<Validatio
13
13
 
14
14
  const rootType = getType(fog);
15
15
  if (fog === undefined) {
16
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
16
17
  return errors;
17
18
  } else if (rootType !== 'object') {
18
19
  errors = errors.concat([new ValidationError('fog', fog, `object expected, ${rootType} found`)]);
20
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
19
21
  return errors;
20
22
  }
21
23
 
@@ -27,7 +29,7 @@ export default function validateFog(options: ValidationOptions): Array<Validatio
27
29
  errors = errors.concat(validate({
28
30
  key,
29
31
  value: fog[key],
30
- valueSpec: {type:'string'},
32
+ valueSpec: {type: 'string'},
31
33
  style,
32
34
  styleSpec
33
35
  }));
@@ -52,5 +54,6 @@ export default function validateFog(options: ValidationOptions): Array<Validatio
52
54
  }
53
55
  }
54
56
 
57
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
55
58
  return errors;
56
59
  }