@mapbox/mapbox-gl-style-spec 14.14.0-beta.1 → 14.14.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/composite.ts +5 -8
- package/dist/index.cjs +31 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +37 -15
- package/dist/index.es.js +31 -9
- package/dist/index.es.js.map +1 -1
- package/expression/definitions/distance.ts +2 -3
- package/expression/definitions/image.ts +1 -1
- package/expression/definitions/index.ts +4 -20
- package/expression/definitions/interpolate.ts +6 -9
- package/expression/definitions/within.ts +14 -15
- package/expression/index.ts +2 -4
- package/expression/types/image_variant.ts +1 -1
- package/expression/types.ts +13 -2
- package/group_by_layout.ts +3 -6
- package/migrate.ts +6 -8
- package/package.json +1 -1
- package/read_style.ts +1 -2
- package/reference/v8.json +25 -0
- package/style-spec.ts +1 -1
- package/types.ts +92 -71
- package/util/geometry_util.ts +1 -2
- package/validate/validate.ts +5 -6
- package/validate/validate_array.ts +2 -2
- package/validate/validate_enum.ts +2 -2
- package/validate/validate_expression.ts +1 -2
- package/validate/validate_filter.ts +3 -4
- package/validate/validate_fog.ts +2 -5
- package/validate/validate_function.ts +6 -10
- package/validate/validate_iconset.ts +1 -2
- package/validate/validate_layer.ts +2 -3
- package/validate/validate_light.ts +1 -4
- package/validate/validate_lights.ts +2 -8
- package/validate/validate_model.ts +1 -4
- package/validate/validate_projection.ts +1 -2
- package/validate/validate_property.ts +2 -6
- package/validate/validate_rain.ts +1 -4
- package/validate/validate_snow.ts +1 -4
- package/validate/validate_source.ts +2 -3
- package/validate/validate_terrain.ts +1 -5
- package/validate_mapbox_api_supported.ts +2 -4
- package/validate_style.ts +1 -2
- package/visit.ts +3 -5
package/types.ts
CHANGED
|
@@ -45,19 +45,19 @@ export type FunctionSpecification<T> = {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
export type CameraFunctionSpecification<T> =
|
|
48
|
-
| {
|
|
49
|
-
| {
|
|
48
|
+
| {type: 'exponential', stops: Array<[number, T]>}
|
|
49
|
+
| {type: 'interval', stops: Array<[number, T]>};
|
|
50
50
|
|
|
51
51
|
export type SourceFunctionSpecification<T> =
|
|
52
|
-
| {
|
|
53
|
-
| {
|
|
54
|
-
| {
|
|
55
|
-
| {
|
|
52
|
+
| {type: 'exponential', stops: Array<[number, T]>, property: string, default?: T}
|
|
53
|
+
| {type: 'interval', stops: Array<[number, T]>, property: string, default?: T}
|
|
54
|
+
| {type: 'categorical', stops: Array<[string | number | boolean, T]>, property: string, default?: T}
|
|
55
|
+
| {type: 'identity', property: string, default?: T};
|
|
56
56
|
|
|
57
57
|
export type CompositeFunctionSpecification<T> =
|
|
58
|
-
| {
|
|
59
|
-
| {
|
|
60
|
-
| {
|
|
58
|
+
| {type: 'exponential', stops: Array<[{zoom: number, value: number}, T]>, property: string, default?: T}
|
|
59
|
+
| {type: 'interval', stops: Array<[{zoom: number, value: number}, T]>, property: string, default?: T}
|
|
60
|
+
| {type: 'categorical', stops: Array<[{zoom: number, value: string | number | boolean}, T]>, property: string, default?: T};
|
|
61
61
|
|
|
62
62
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
63
|
export type ExpressionSpecification = [string, ...any[]];
|
|
@@ -120,19 +120,19 @@ export type StyleSpecification = {
|
|
|
120
120
|
* @experimental This property is experimental and subject to change in future versions.
|
|
121
121
|
*/
|
|
122
122
|
"featuresets"?: FeaturesetsSpecification
|
|
123
|
-
}
|
|
123
|
+
};
|
|
124
124
|
|
|
125
125
|
export type SourcesSpecification = {
|
|
126
126
|
[_: string]: SourceSpecification
|
|
127
|
-
}
|
|
127
|
+
};
|
|
128
128
|
|
|
129
129
|
export type ModelsSpecification = {
|
|
130
130
|
[_: string]: ModelSpecification
|
|
131
|
-
}
|
|
131
|
+
};
|
|
132
132
|
|
|
133
133
|
export type IconsetsSpecification = {
|
|
134
134
|
[_: string]: IconsetSpecification
|
|
135
|
-
}
|
|
135
|
+
};
|
|
136
136
|
|
|
137
137
|
export type LightSpecification = {
|
|
138
138
|
"anchor"?: PropertyValueSpecification<"map" | "viewport">,
|
|
@@ -143,13 +143,13 @@ export type LightSpecification = {
|
|
|
143
143
|
"color-use-theme"?: PropertyValueSpecification<string>,
|
|
144
144
|
"intensity"?: PropertyValueSpecification<number>,
|
|
145
145
|
"intensity-transition"?: TransitionSpecification
|
|
146
|
-
}
|
|
146
|
+
};
|
|
147
147
|
|
|
148
148
|
export type TerrainSpecification = {
|
|
149
149
|
"source": string,
|
|
150
150
|
"exaggeration"?: PropertyValueSpecification<number>,
|
|
151
151
|
"exaggeration-transition"?: TransitionSpecification
|
|
152
|
-
}
|
|
152
|
+
};
|
|
153
153
|
|
|
154
154
|
export type FogSpecification = {
|
|
155
155
|
"range"?: PropertyValueSpecification<[number, number]>,
|
|
@@ -169,7 +169,7 @@ export type FogSpecification = {
|
|
|
169
169
|
"star-intensity-transition"?: TransitionSpecification,
|
|
170
170
|
"vertical-range"?: PropertyValueSpecification<[number, number]>,
|
|
171
171
|
"vertical-range-transition"?: TransitionSpecification
|
|
172
|
-
}
|
|
172
|
+
};
|
|
173
173
|
|
|
174
174
|
export type SnowSpecification = {
|
|
175
175
|
/**
|
|
@@ -219,7 +219,7 @@ export type SnowSpecification = {
|
|
|
219
219
|
*/
|
|
220
220
|
"flake-size"?: PropertyValueSpecification<number>,
|
|
221
221
|
"flake-size-transition"?: TransitionSpecification
|
|
222
|
-
}
|
|
222
|
+
};
|
|
223
223
|
|
|
224
224
|
export type RainSpecification = {
|
|
225
225
|
/**
|
|
@@ -274,22 +274,22 @@ export type RainSpecification = {
|
|
|
274
274
|
*/
|
|
275
275
|
"distortion-strength"?: PropertyValueSpecification<number>,
|
|
276
276
|
"distortion-strength-transition"?: TransitionSpecification
|
|
277
|
-
}
|
|
277
|
+
};
|
|
278
278
|
|
|
279
279
|
export type CameraSpecification = {
|
|
280
280
|
"camera-projection"?: PropertyValueSpecification<"perspective" | "orthographic">,
|
|
281
281
|
"camera-projection-transition"?: TransitionSpecification
|
|
282
|
-
}
|
|
282
|
+
};
|
|
283
283
|
|
|
284
284
|
export type ColorThemeSpecification = {
|
|
285
285
|
"data"?: ExpressionSpecification
|
|
286
|
-
}
|
|
286
|
+
};
|
|
287
287
|
|
|
288
288
|
export type ProjectionSpecification = {
|
|
289
289
|
"name": "albers" | "equalEarth" | "equirectangular" | "lambertConformalConic" | "mercator" | "naturalEarth" | "winkelTripel" | "globe",
|
|
290
290
|
"center"?: [number, number],
|
|
291
291
|
"parallels"?: [number, number]
|
|
292
|
-
}
|
|
292
|
+
};
|
|
293
293
|
|
|
294
294
|
export type ImportSpecification = {
|
|
295
295
|
"id": string,
|
|
@@ -297,7 +297,7 @@ export type ImportSpecification = {
|
|
|
297
297
|
"config"?: ConfigSpecification,
|
|
298
298
|
"data"?: StyleSpecification,
|
|
299
299
|
"color-theme"?: ColorThemeSpecification | null | undefined
|
|
300
|
-
}
|
|
300
|
+
};
|
|
301
301
|
|
|
302
302
|
export type IndoorSpecification = {
|
|
303
303
|
/**
|
|
@@ -308,15 +308,15 @@ export type IndoorSpecification = {
|
|
|
308
308
|
* @experimental This property is experimental and subject to change in future versions.
|
|
309
309
|
*/
|
|
310
310
|
"buildingFeaturesetId"?: ExpressionSpecification
|
|
311
|
-
}
|
|
311
|
+
};
|
|
312
312
|
|
|
313
313
|
export type ConfigSpecification = {
|
|
314
314
|
[_: string]: unknown
|
|
315
|
-
}
|
|
315
|
+
};
|
|
316
316
|
|
|
317
317
|
export type SchemaSpecification = {
|
|
318
318
|
[_: string]: OptionSpecification
|
|
319
|
-
}
|
|
319
|
+
};
|
|
320
320
|
|
|
321
321
|
export type OptionSpecification = {
|
|
322
322
|
"default": ExpressionSpecification,
|
|
@@ -327,14 +327,14 @@ export type OptionSpecification = {
|
|
|
327
327
|
"stepValue"?: number,
|
|
328
328
|
"values"?: Array<unknown>,
|
|
329
329
|
"metadata"?: unknown
|
|
330
|
-
}
|
|
330
|
+
};
|
|
331
331
|
|
|
332
332
|
/**
|
|
333
333
|
* @experimental This is experimental and subject to change in future versions.
|
|
334
334
|
*/
|
|
335
335
|
export type FeaturesetsSpecification = {
|
|
336
336
|
[_: string]: FeaturesetSpecification
|
|
337
|
-
}
|
|
337
|
+
};
|
|
338
338
|
|
|
339
339
|
/**
|
|
340
340
|
* @experimental This is experimental and subject to change in future versions.
|
|
@@ -348,7 +348,7 @@ export type FeaturesetSpecification = {
|
|
|
348
348
|
* @experimental This property is experimental and subject to change in future versions.
|
|
349
349
|
*/
|
|
350
350
|
"selectors"?: Array<SelectorSpecification>
|
|
351
|
-
}
|
|
351
|
+
};
|
|
352
352
|
|
|
353
353
|
/**
|
|
354
354
|
* @experimental This is experimental and subject to change in future versions.
|
|
@@ -370,7 +370,7 @@ export type SelectorSpecification = {
|
|
|
370
370
|
* @experimental This property is experimental and subject to change in future versions.
|
|
371
371
|
*/
|
|
372
372
|
"_uniqueFeatureID"?: boolean
|
|
373
|
-
}
|
|
373
|
+
};
|
|
374
374
|
|
|
375
375
|
/**
|
|
376
376
|
* @experimental This is experimental and subject to change in future versions.
|
|
@@ -380,7 +380,13 @@ export type SelectorPropertySpecification = {
|
|
|
380
380
|
* @experimental This property is experimental and subject to change in future versions.
|
|
381
381
|
*/
|
|
382
382
|
[_: string]: unknown
|
|
383
|
-
}
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
export type AppearanceSpecification = {
|
|
386
|
+
"condition"?: ExpressionSpecification,
|
|
387
|
+
"name"?: string,
|
|
388
|
+
"properties"?: unknown
|
|
389
|
+
};
|
|
384
390
|
|
|
385
391
|
export type VectorSourceSpecification = {
|
|
386
392
|
"type": "vector",
|
|
@@ -398,7 +404,7 @@ export type VectorSourceSpecification = {
|
|
|
398
404
|
"promoteId"?: PromoteIdSpecification,
|
|
399
405
|
"volatile"?: boolean,
|
|
400
406
|
[_: string]: unknown
|
|
401
|
-
}
|
|
407
|
+
};
|
|
402
408
|
|
|
403
409
|
export type RasterSourceSpecification = {
|
|
404
410
|
"type": "raster",
|
|
@@ -416,7 +422,7 @@ export type RasterSourceSpecification = {
|
|
|
416
422
|
"attribution"?: string,
|
|
417
423
|
"volatile"?: boolean,
|
|
418
424
|
[_: string]: unknown
|
|
419
|
-
}
|
|
425
|
+
};
|
|
420
426
|
|
|
421
427
|
export type RasterDEMSourceSpecification = {
|
|
422
428
|
"type": "raster-dem",
|
|
@@ -434,7 +440,7 @@ export type RasterDEMSourceSpecification = {
|
|
|
434
440
|
"encoding"?: "terrarium" | "mapbox",
|
|
435
441
|
"volatile"?: boolean,
|
|
436
442
|
[_: string]: unknown
|
|
437
|
-
}
|
|
443
|
+
};
|
|
438
444
|
|
|
439
445
|
/**
|
|
440
446
|
* @experimental This is experimental and subject to change in future versions.
|
|
@@ -455,7 +461,7 @@ export type RasterArraySourceSpecification = {
|
|
|
455
461
|
"rasterLayers"?: unknown,
|
|
456
462
|
"volatile"?: boolean,
|
|
457
463
|
[_: string]: unknown
|
|
458
|
-
}
|
|
464
|
+
};
|
|
459
465
|
|
|
460
466
|
export type GeoJSONSourceSpecification = {
|
|
461
467
|
"type": "geojson",
|
|
@@ -475,26 +481,26 @@ export type GeoJSONSourceSpecification = {
|
|
|
475
481
|
"generateId"?: boolean,
|
|
476
482
|
"promoteId"?: PromoteIdSpecification,
|
|
477
483
|
"dynamic"?: boolean
|
|
478
|
-
}
|
|
484
|
+
};
|
|
479
485
|
|
|
480
486
|
export type VideoSourceSpecification = {
|
|
481
487
|
"type": "video",
|
|
482
488
|
"urls": Array<string>,
|
|
483
489
|
"coordinates": [[number, number], [number, number], [number, number], [number, number]]
|
|
484
|
-
}
|
|
490
|
+
};
|
|
485
491
|
|
|
486
492
|
export type ImageSourceSpecification = {
|
|
487
493
|
"type": "image",
|
|
488
494
|
"url"?: string,
|
|
489
495
|
"coordinates": [[number, number], [number, number], [number, number], [number, number]]
|
|
490
|
-
}
|
|
496
|
+
};
|
|
491
497
|
|
|
492
498
|
export type ModelSourceSpecification = {
|
|
493
499
|
"type": "model" | "batched-model",
|
|
494
500
|
"maxzoom"?: number,
|
|
495
501
|
"minzoom"?: number,
|
|
496
502
|
"tiles"?: Array<string>
|
|
497
|
-
}
|
|
503
|
+
};
|
|
498
504
|
|
|
499
505
|
export type SourceSpecification =
|
|
500
506
|
| VectorSourceSpecification
|
|
@@ -504,7 +510,7 @@ export type SourceSpecification =
|
|
|
504
510
|
| GeoJSONSourceSpecification
|
|
505
511
|
| VideoSourceSpecification
|
|
506
512
|
| ImageSourceSpecification
|
|
507
|
-
| ModelSourceSpecification
|
|
513
|
+
| ModelSourceSpecification;
|
|
508
514
|
|
|
509
515
|
export type IconsetSpecification =
|
|
510
516
|
| {
|
|
@@ -514,7 +520,7 @@ export type IconsetSpecification =
|
|
|
514
520
|
| {
|
|
515
521
|
"type": "source",
|
|
516
522
|
"source": string
|
|
517
|
-
}
|
|
523
|
+
};
|
|
518
524
|
|
|
519
525
|
export type ModelSpecification = string;
|
|
520
526
|
|
|
@@ -528,7 +534,7 @@ export type AmbientLightSpecification = {
|
|
|
528
534
|
"intensity-transition"?: TransitionSpecification
|
|
529
535
|
},
|
|
530
536
|
"type": "ambient"
|
|
531
|
-
}
|
|
537
|
+
};
|
|
532
538
|
|
|
533
539
|
export type DirectionalLightSpecification = {
|
|
534
540
|
"id": string,
|
|
@@ -549,7 +555,7 @@ export type DirectionalLightSpecification = {
|
|
|
549
555
|
"shadow-intensity-transition"?: TransitionSpecification
|
|
550
556
|
},
|
|
551
557
|
"type": "directional"
|
|
552
|
-
}
|
|
558
|
+
};
|
|
553
559
|
|
|
554
560
|
export type FlatLightSpecification = {
|
|
555
561
|
"id": string,
|
|
@@ -564,7 +570,7 @@ export type FlatLightSpecification = {
|
|
|
564
570
|
"intensity-transition"?: TransitionSpecification
|
|
565
571
|
},
|
|
566
572
|
"type": "flat"
|
|
567
|
-
}
|
|
573
|
+
};
|
|
568
574
|
|
|
569
575
|
export type LightsSpecification =
|
|
570
576
|
| AmbientLightSpecification
|
|
@@ -627,8 +633,9 @@ export type FillLayerSpecification = {
|
|
|
627
633
|
"fill-tunnel-structure-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>,
|
|
628
634
|
"fill-tunnel-structure-color-transition"?: TransitionSpecification,
|
|
629
635
|
"fill-tunnel-structure-color-use-theme"?: PropertyValueSpecification<string>
|
|
630
|
-
}
|
|
631
|
-
|
|
636
|
+
},
|
|
637
|
+
"appearances"?: Array<AppearanceSpecification>
|
|
638
|
+
};
|
|
632
639
|
|
|
633
640
|
/**
|
|
634
641
|
* @deprecated Use `FillLayerSpecification['layout']` instead.
|
|
@@ -716,8 +723,9 @@ export type LineLayerSpecification = {
|
|
|
716
723
|
"line-border-color-use-theme"?: PropertyValueSpecification<string>,
|
|
717
724
|
"line-occlusion-opacity"?: PropertyValueSpecification<number>,
|
|
718
725
|
"line-occlusion-opacity-transition"?: TransitionSpecification
|
|
719
|
-
}
|
|
720
|
-
|
|
726
|
+
},
|
|
727
|
+
"appearances"?: Array<AppearanceSpecification>
|
|
728
|
+
};
|
|
721
729
|
|
|
722
730
|
/**
|
|
723
731
|
* @deprecated Use `LineLayerSpecification['layout']` instead.
|
|
@@ -845,8 +853,9 @@ export type SymbolLayerSpecification = {
|
|
|
845
853
|
*/
|
|
846
854
|
"symbol-z-offset"?: DataDrivenPropertyValueSpecification<number>,
|
|
847
855
|
"symbol-z-offset-transition"?: TransitionSpecification
|
|
848
|
-
}
|
|
849
|
-
|
|
856
|
+
},
|
|
857
|
+
"appearances"?: Array<AppearanceSpecification>
|
|
858
|
+
};
|
|
850
859
|
|
|
851
860
|
/**
|
|
852
861
|
* @deprecated Use `SymbolLayerSpecification['layout']` instead.
|
|
@@ -900,8 +909,9 @@ export type CircleLayerSpecification = {
|
|
|
900
909
|
"circle-stroke-opacity-transition"?: TransitionSpecification,
|
|
901
910
|
"circle-emissive-strength"?: PropertyValueSpecification<number>,
|
|
902
911
|
"circle-emissive-strength-transition"?: TransitionSpecification
|
|
903
|
-
}
|
|
904
|
-
|
|
912
|
+
},
|
|
913
|
+
"appearances"?: Array<AppearanceSpecification>
|
|
914
|
+
};
|
|
905
915
|
|
|
906
916
|
/**
|
|
907
917
|
* @deprecated Use `CircleLayerSpecification['layout']` instead.
|
|
@@ -936,8 +946,9 @@ export type HeatmapLayerSpecification = {
|
|
|
936
946
|
"heatmap-color-use-theme"?: PropertyValueSpecification<string>,
|
|
937
947
|
"heatmap-opacity"?: PropertyValueSpecification<number>,
|
|
938
948
|
"heatmap-opacity-transition"?: TransitionSpecification
|
|
939
|
-
}
|
|
940
|
-
|
|
949
|
+
},
|
|
950
|
+
"appearances"?: Array<AppearanceSpecification>
|
|
951
|
+
};
|
|
941
952
|
|
|
942
953
|
/**
|
|
943
954
|
* @deprecated Use `HeatmapLayerSpecification['layout']` instead.
|
|
@@ -1053,8 +1064,9 @@ export type FillExtrusionLayerSpecification = {
|
|
|
1053
1064
|
"fill-extrusion-line-width"?: DataDrivenPropertyValueSpecification<number>,
|
|
1054
1065
|
"fill-extrusion-line-width-transition"?: TransitionSpecification,
|
|
1055
1066
|
"fill-extrusion-cast-shadows"?: boolean
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1067
|
+
},
|
|
1068
|
+
"appearances"?: Array<AppearanceSpecification>
|
|
1069
|
+
};
|
|
1058
1070
|
|
|
1059
1071
|
/**
|
|
1060
1072
|
* @deprecated Use `FillExtrusionLayerSpecification['layout']` instead.
|
|
@@ -1154,8 +1166,9 @@ export type BuildingLayerSpecification = {
|
|
|
1154
1166
|
*/
|
|
1155
1167
|
"building-facade-emissive-chance"?: PropertyValueSpecification<number>,
|
|
1156
1168
|
"building-cutoff-fade-range"?: ExpressionSpecification
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1169
|
+
},
|
|
1170
|
+
"appearances"?: Array<AppearanceSpecification>
|
|
1171
|
+
};
|
|
1159
1172
|
|
|
1160
1173
|
/**
|
|
1161
1174
|
* @deprecated Use `BuildingLayerSpecification['layout']` instead.
|
|
@@ -1212,8 +1225,9 @@ export type RasterLayerSpecification = {
|
|
|
1212
1225
|
*/
|
|
1213
1226
|
"raster-elevation"?: PropertyValueSpecification<number>,
|
|
1214
1227
|
"raster-elevation-transition"?: TransitionSpecification
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1228
|
+
},
|
|
1229
|
+
"appearances"?: Array<AppearanceSpecification>
|
|
1230
|
+
};
|
|
1217
1231
|
|
|
1218
1232
|
/**
|
|
1219
1233
|
* @deprecated Use `RasterLayerSpecification['layout']` instead.
|
|
@@ -1251,8 +1265,9 @@ export type RasterParticleLayerSpecification = {
|
|
|
1251
1265
|
"raster-particle-reset-rate-factor"?: number,
|
|
1252
1266
|
"raster-particle-elevation"?: PropertyValueSpecification<number>,
|
|
1253
1267
|
"raster-particle-elevation-transition"?: TransitionSpecification
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1268
|
+
},
|
|
1269
|
+
"appearances"?: Array<AppearanceSpecification>
|
|
1270
|
+
};
|
|
1256
1271
|
|
|
1257
1272
|
/**
|
|
1258
1273
|
* @deprecated Use `RasterParticleLayerSpecification['layout']` instead.
|
|
@@ -1293,8 +1308,9 @@ export type HillshadeLayerSpecification = {
|
|
|
1293
1308
|
"hillshade-accent-color-use-theme"?: PropertyValueSpecification<string>,
|
|
1294
1309
|
"hillshade-emissive-strength"?: PropertyValueSpecification<number>,
|
|
1295
1310
|
"hillshade-emissive-strength-transition"?: TransitionSpecification
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1311
|
+
},
|
|
1312
|
+
"appearances"?: Array<AppearanceSpecification>
|
|
1313
|
+
};
|
|
1298
1314
|
|
|
1299
1315
|
/**
|
|
1300
1316
|
* @deprecated Use `HillshadeLayerSpecification['layout']` instead.
|
|
@@ -1347,8 +1363,9 @@ export type ModelLayerSpecification = {
|
|
|
1347
1363
|
"model-height-based-emissive-strength-multiplier-transition"?: TransitionSpecification,
|
|
1348
1364
|
"model-cutoff-fade-range"?: ExpressionSpecification,
|
|
1349
1365
|
"model-front-cutoff"?: PropertyValueSpecification<[number, number, number]>
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1366
|
+
},
|
|
1367
|
+
"appearances"?: Array<AppearanceSpecification>
|
|
1368
|
+
};
|
|
1352
1369
|
|
|
1353
1370
|
/**
|
|
1354
1371
|
* @deprecated Use `ModelLayerSpecification['layout']` instead.
|
|
@@ -1386,8 +1403,9 @@ export type BackgroundLayerSpecification = {
|
|
|
1386
1403
|
"background-opacity-transition"?: TransitionSpecification,
|
|
1387
1404
|
"background-emissive-strength"?: PropertyValueSpecification<number>,
|
|
1388
1405
|
"background-emissive-strength-transition"?: TransitionSpecification
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1406
|
+
},
|
|
1407
|
+
"appearances"?: Array<AppearanceSpecification>
|
|
1408
|
+
};
|
|
1391
1409
|
|
|
1392
1410
|
/**
|
|
1393
1411
|
* @deprecated Use `BackgroundLayerSpecification['layout']` instead.
|
|
@@ -1426,8 +1444,9 @@ export type SkyLayerSpecification = {
|
|
|
1426
1444
|
"sky-atmosphere-color-use-theme"?: PropertyValueSpecification<string>,
|
|
1427
1445
|
"sky-opacity"?: PropertyValueSpecification<number>,
|
|
1428
1446
|
"sky-opacity-transition"?: TransitionSpecification
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1447
|
+
},
|
|
1448
|
+
"appearances"?: Array<AppearanceSpecification>
|
|
1449
|
+
};
|
|
1431
1450
|
|
|
1432
1451
|
/**
|
|
1433
1452
|
* @deprecated Use `SkyLayerSpecification['layout']` instead.
|
|
@@ -1449,9 +1468,10 @@ export type SlotLayerSpecification = {
|
|
|
1449
1468
|
"minzoom"?: never,
|
|
1450
1469
|
"maxzoom"?: never,
|
|
1451
1470
|
"filter"?: never,
|
|
1471
|
+
"appearances"?: Array<AppearanceSpecification>,
|
|
1452
1472
|
"layout"?: never,
|
|
1453
1473
|
"paint"?: never
|
|
1454
|
-
}
|
|
1474
|
+
};
|
|
1455
1475
|
|
|
1456
1476
|
export type ClipLayerSpecification = {
|
|
1457
1477
|
"id": string,
|
|
@@ -1467,8 +1487,9 @@ export type ClipLayerSpecification = {
|
|
|
1467
1487
|
"clip-layer-types"?: ExpressionSpecification,
|
|
1468
1488
|
"clip-layer-scope"?: ExpressionSpecification
|
|
1469
1489
|
},
|
|
1490
|
+
"appearances"?: Array<AppearanceSpecification>,
|
|
1470
1491
|
"paint"?: never
|
|
1471
|
-
}
|
|
1492
|
+
};
|
|
1472
1493
|
|
|
1473
1494
|
/**
|
|
1474
1495
|
* @deprecated Use `ClipLayerSpecification['layout']` instead.
|
package/util/geometry_util.ts
CHANGED
|
@@ -31,7 +31,7 @@ export function classifyRings(rings: Array<Ring>, maxRings: number): Array<Array
|
|
|
31
31
|
|
|
32
32
|
if (len <= 1) return [rings];
|
|
33
33
|
|
|
34
|
-
const polygons = [];
|
|
34
|
+
const polygons: Array<Array<Ring>> = [];
|
|
35
35
|
let polygon,
|
|
36
36
|
ccw;
|
|
37
37
|
|
|
@@ -63,7 +63,6 @@ export function classifyRings(rings: Array<Ring>, maxRings: number): Array<Array
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
67
66
|
return polygons;
|
|
68
67
|
}
|
|
69
68
|
|
package/validate/validate.ts
CHANGED
|
@@ -30,10 +30,8 @@ import type {StyleReference} from '../reference/latest';
|
|
|
30
30
|
import type {StyleSpecification} from '../types';
|
|
31
31
|
import type ValidationError from '../error/validation_error';
|
|
32
32
|
|
|
33
|
-
const VALIDATORS = {
|
|
34
|
-
'*'()
|
|
35
|
-
return [];
|
|
36
|
-
},
|
|
33
|
+
const VALIDATORS: Record<string, (unknown) => ValidationError[]> = {
|
|
34
|
+
'*': () => [],
|
|
37
35
|
'array': validateArray,
|
|
38
36
|
'boolean': validateBoolean,
|
|
39
37
|
'number': validateNumber,
|
|
@@ -79,6 +77,9 @@ export type ValidationOptions = {
|
|
|
79
77
|
objectKey?: string;
|
|
80
78
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
79
|
objectElementValidators?: Record<string, (...args: any[]) => Array<ValidationError>>;
|
|
80
|
+
propertyKey?: string
|
|
81
|
+
propertyType?: string
|
|
82
|
+
expressionContext?: 'property';
|
|
82
83
|
};
|
|
83
84
|
|
|
84
85
|
export default function validate(options: ValidationOptions, arrayAsExpression: boolean = false): Array<ValidationError> {
|
|
@@ -87,7 +88,6 @@ export default function validate(options: ValidationOptions, arrayAsExpression:
|
|
|
87
88
|
const styleSpec = options.styleSpec;
|
|
88
89
|
|
|
89
90
|
if (valueSpec.expression && isFunction(unbundle(value))) {
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
91
91
|
return validateFunction(options);
|
|
92
92
|
} else if (valueSpec.expression && isExpression(deepUnbundle(value))) {
|
|
93
93
|
return validateExpression(options);
|
|
@@ -97,7 +97,6 @@ export default function validate(options: ValidationOptions, arrayAsExpression:
|
|
|
97
97
|
// Try to validate as an expression
|
|
98
98
|
return validateExpression(options);
|
|
99
99
|
} else {
|
|
100
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
101
100
|
return valid;
|
|
102
101
|
}
|
|
103
102
|
} else {
|
|
@@ -45,7 +45,7 @@ export default function validateArray(options: Options): Array<ValidationError>
|
|
|
45
45
|
arrayElementSpec = arraySpec.value;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
let errors = [];
|
|
48
|
+
let errors: ValidationError[] = [];
|
|
49
49
|
for (let i = 0; i < array.length; i++) {
|
|
50
50
|
errors = errors.concat(validateArrayElement({
|
|
51
51
|
array,
|
|
@@ -57,6 +57,6 @@ export default function validateArray(options: Options): Array<ValidationError>
|
|
|
57
57
|
key: `${key}[${i}]`
|
|
58
58
|
}, true));
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
return errors;
|
|
62
62
|
}
|
|
@@ -7,7 +7,7 @@ export default function validateEnum(options: ValidationOptions): Array<Validati
|
|
|
7
7
|
const key = options.key;
|
|
8
8
|
const value = options.value;
|
|
9
9
|
const valueSpec = options.valueSpec;
|
|
10
|
-
const errors = [];
|
|
10
|
+
const errors: ValidationError[] = [];
|
|
11
11
|
|
|
12
12
|
if (Array.isArray(valueSpec.values)) { // <=v7
|
|
13
13
|
if (valueSpec.values.indexOf(unbundle(value)) === -1) {
|
|
@@ -18,6 +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
|
-
|
|
21
|
+
|
|
22
22
|
return errors;
|
|
23
23
|
}
|
|
@@ -62,7 +62,7 @@ export function disallowedFilterParameters(e: Expression, options: any): Array<V
|
|
|
62
62
|
if (disallowedParameters.size === 0) {
|
|
63
63
|
return [];
|
|
64
64
|
}
|
|
65
|
-
const errors = [];
|
|
65
|
+
const errors: ValidationError[] = [];
|
|
66
66
|
|
|
67
67
|
if (e instanceof CompoundExpression) {
|
|
68
68
|
if (disallowedParameters.has(e.name)) {
|
|
@@ -73,6 +73,5 @@ export function disallowedFilterParameters(e: Expression, options: any): Array<V
|
|
|
73
73
|
errors.push(...disallowedFilterParameters(arg, options));
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
77
76
|
return errors;
|
|
78
77
|
}
|
|
@@ -26,12 +26,11 @@ 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
|
|
30
29
|
return validateNonExpressionFilter(options);
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
function validateNonExpressionFilter(options: Options) {
|
|
33
|
+
function validateNonExpressionFilter(options: Options): ValidationError[] {
|
|
35
34
|
const value = options.value;
|
|
36
35
|
const key = options.key;
|
|
37
36
|
|
|
@@ -42,7 +41,7 @@ function validateNonExpressionFilter(options: Options) {
|
|
|
42
41
|
const styleSpec = options.styleSpec;
|
|
43
42
|
let type;
|
|
44
43
|
|
|
45
|
-
let errors = [];
|
|
44
|
+
let errors: ValidationError[] = [];
|
|
46
45
|
|
|
47
46
|
if (value.length < 1) {
|
|
48
47
|
return [new ValidationError(key, value, 'filter array must have at least 1 element')];
|
|
@@ -120,6 +119,6 @@ function validateNonExpressionFilter(options: Options) {
|
|
|
120
119
|
}
|
|
121
120
|
break;
|
|
122
121
|
}
|
|
123
|
-
|
|
122
|
+
|
|
124
123
|
return errors;
|
|
125
124
|
}
|
package/validate/validate_fog.ts
CHANGED
|
@@ -4,20 +4,18 @@ import getType from '../util/get_type';
|
|
|
4
4
|
|
|
5
5
|
import type {ValidationOptions} from './validate';
|
|
6
6
|
|
|
7
|
-
export default function validateFog(options: ValidationOptions):
|
|
7
|
+
export default function validateFog(options: ValidationOptions): ValidationError[] {
|
|
8
8
|
const fog = options.value;
|
|
9
9
|
const style = options.style;
|
|
10
10
|
const styleSpec = options.styleSpec;
|
|
11
11
|
const fogSpec = styleSpec.fog;
|
|
12
|
-
let errors = [];
|
|
12
|
+
let errors: ValidationError[] = [];
|
|
13
13
|
|
|
14
14
|
const rootType = getType(fog);
|
|
15
15
|
if (fog === undefined) {
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
17
16
|
return errors;
|
|
18
17
|
} else if (rootType !== 'object') {
|
|
19
18
|
errors = errors.concat([new ValidationError('fog', fog, `object expected, ${rootType} found`)]);
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
21
19
|
return errors;
|
|
22
20
|
}
|
|
23
21
|
|
|
@@ -54,6 +52,5 @@ export default function validateFog(options: ValidationOptions): Array<Validatio
|
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
58
55
|
return errors;
|
|
59
56
|
}
|