@mapbox/mapbox-gl-style-spec 14.31.0 → 14.32.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/dist/index.cjs +195 -188
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +53 -15
- package/dist/index.es.js +195 -188
- package/dist/index.es.js.map +1 -1
- package/expression/definitions/index.ts +3 -2
- package/expression/expression_dependencies.ts +20 -23
- package/expression/index.ts +23 -30
- package/expression/is_constant.ts +20 -1
- package/expression/parsing_context.ts +73 -57
- package/expression/types.ts +14 -32
- package/feature_filter/index.ts +2 -1
- package/format.ts +10 -17
- package/function/index.ts +106 -155
- package/migrate/v8.ts +49 -80
- package/migrate/v9.ts +13 -13
- package/migrate.ts +2 -3
- package/package.json +1 -1
- package/reference/v8.json +61 -26
- package/types.ts +2 -0
- package/validate/validate_appearance.ts +1 -2
- package/validate/validate_expression.ts +12 -11
- package/validate_mapbox_api_supported.ts +1 -1
package/dist/index.es.js
CHANGED
|
@@ -42,14 +42,14 @@ var $root = {
|
|
|
42
42
|
"default": 0,
|
|
43
43
|
period: 360,
|
|
44
44
|
units: "degrees",
|
|
45
|
-
doc: "Default bearing
|
|
45
|
+
doc: "Default bearing. The bearing is the compass direction that is \"up\"; for example, a bearing of 90° orients the map so that east is up. This value will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",
|
|
46
46
|
example: 29
|
|
47
47
|
},
|
|
48
48
|
pitch: {
|
|
49
49
|
type: "number",
|
|
50
50
|
"default": 0,
|
|
51
51
|
units: "degrees",
|
|
52
|
-
doc: "Default pitch
|
|
52
|
+
doc: "Default pitch. Zero is perpendicular to the surface, for a look straight down at the map, while a greater value like 60 looks ahead towards the horizon. The style pitch will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",
|
|
53
53
|
example: 50
|
|
54
54
|
},
|
|
55
55
|
light: {
|
|
@@ -1464,6 +1464,28 @@ var source_model = {
|
|
|
1464
1464
|
value: "string",
|
|
1465
1465
|
doc: "An array of one or more tile source URLs, as in the TileJSON spec. Requires `batched-model` source type."
|
|
1466
1466
|
},
|
|
1467
|
+
bounds: {
|
|
1468
|
+
type: "array",
|
|
1469
|
+
value: "number",
|
|
1470
|
+
length: 4,
|
|
1471
|
+
"default": [
|
|
1472
|
+
-180,
|
|
1473
|
+
-85.051129,
|
|
1474
|
+
180,
|
|
1475
|
+
85.051129
|
|
1476
|
+
],
|
|
1477
|
+
doc: "An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by Mapbox GL. Requires `batched-model` source type."
|
|
1478
|
+
},
|
|
1479
|
+
extra_bounds: {
|
|
1480
|
+
type: "array",
|
|
1481
|
+
value: {
|
|
1482
|
+
type: "array",
|
|
1483
|
+
value: "number",
|
|
1484
|
+
length: 4,
|
|
1485
|
+
doc: "An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`."
|
|
1486
|
+
},
|
|
1487
|
+
doc: "An array of additional discrete geographic regions where tiles are available. When used alongside the `bounds` property, these regions act as an additional filter - Mapbox GL will only request tiles that are both within the `bounds` and any of the regions defined in `extra_bounds`. When used independently (without `bounds`), Mapbox GL will request tiles that fall within any of the regions in `extra_bounds`. This allows for more fine-grained control over tile requests, particularly when dealing with sparse data coverage. Requires `batched-model` source type."
|
|
1488
|
+
},
|
|
1467
1489
|
models: {
|
|
1468
1490
|
type: "modelSourceModels",
|
|
1469
1491
|
doc: "Defines properties of 3D models in collection. Requires `model` source type."
|
|
@@ -1869,9 +1891,9 @@ var layout_model = {
|
|
|
1869
1891
|
doc: "If true, the models will be reduced in density based on the zoom level. This is useful for large datasets that may be slow to render.",
|
|
1870
1892
|
"sdk-support": {
|
|
1871
1893
|
"basic functionality": {
|
|
1872
|
-
js: "
|
|
1873
|
-
android: "
|
|
1874
|
-
ios: "
|
|
1894
|
+
js: "3.18.0",
|
|
1895
|
+
android: "11.20.0",
|
|
1896
|
+
ios: "11.18.0"
|
|
1875
1897
|
}
|
|
1876
1898
|
},
|
|
1877
1899
|
"property-type": "data-constant"
|
|
@@ -2258,6 +2280,7 @@ var layout_building = {
|
|
|
2258
2280
|
maximum: 20,
|
|
2259
2281
|
"default": 3.1,
|
|
2260
2282
|
doc: "Width of a floor. Think of this as measure how wide each unit should be. This effectively determines the number of units per each floor. Note that this does not affect the ground level facades (i.e. number of windows).",
|
|
2283
|
+
units: "meters",
|
|
2261
2284
|
"private": true,
|
|
2262
2285
|
"property-type": "data-driven",
|
|
2263
2286
|
"sdk-support": {
|
|
@@ -2425,7 +2448,7 @@ var layout_building = {
|
|
|
2425
2448
|
units: "meters",
|
|
2426
2449
|
"default": 0,
|
|
2427
2450
|
minimum: 0,
|
|
2428
|
-
doc: "The extent of the flood light effect on the walls of the buildings
|
|
2451
|
+
doc: "The extent of the flood light effect on the walls of the buildings.",
|
|
2429
2452
|
requires: [
|
|
2430
2453
|
"lights"
|
|
2431
2454
|
],
|
|
@@ -2456,7 +2479,7 @@ var layout_building = {
|
|
|
2456
2479
|
"private": true,
|
|
2457
2480
|
units: "meters",
|
|
2458
2481
|
"default": 0,
|
|
2459
|
-
doc: "The extent of the flood light effect on the ground beneath the buildings
|
|
2482
|
+
doc: "The extent of the flood light effect on the ground beneath the buildings.",
|
|
2460
2483
|
requires: [
|
|
2461
2484
|
"lights"
|
|
2462
2485
|
],
|
|
@@ -2485,7 +2508,6 @@ var layout_building = {
|
|
|
2485
2508
|
"property-type": "data-driven",
|
|
2486
2509
|
type: "boolean",
|
|
2487
2510
|
"private": true,
|
|
2488
|
-
units: "meters",
|
|
2489
2511
|
"default": false,
|
|
2490
2512
|
doc: "Flips the orientation of the roofs for the buildings. This only affects simple geometries. Namely buildings whose footprints form a quadrilateral. By default (false), the roof ridge takes the direction of the longer edge of the quadrilateral.",
|
|
2491
2513
|
transition: true,
|
|
@@ -2666,8 +2688,9 @@ var layout_line = {
|
|
|
2666
2688
|
},
|
|
2667
2689
|
"line-z-offset": {
|
|
2668
2690
|
type: "number",
|
|
2669
|
-
doc: "Vertical offset from ground
|
|
2691
|
+
doc: "Vertical offset from ground. Not supported for globe projection at the moment.",
|
|
2670
2692
|
"default": 0,
|
|
2693
|
+
units: "meters",
|
|
2671
2694
|
requires: [
|
|
2672
2695
|
"line-elevation-reference"
|
|
2673
2696
|
],
|
|
@@ -5957,7 +5980,8 @@ var fog = {
|
|
|
5957
5980
|
],
|
|
5958
5981
|
relaxZoomRestriction: true
|
|
5959
5982
|
},
|
|
5960
|
-
doc: "An array of two number values, specifying the vertical range
|
|
5983
|
+
doc: "An array of two number values, specifying the vertical range over which the fog should gradually fade out. When both parameters are set to zero, the fog will be rendered without any vertical constraints.",
|
|
5984
|
+
units: "meters",
|
|
5961
5985
|
"sdk-support": {
|
|
5962
5986
|
"basic functionality": {
|
|
5963
5987
|
js: "3.0.0",
|
|
@@ -7098,7 +7122,7 @@ var paint_fill = {
|
|
|
7098
7122
|
]
|
|
7099
7123
|
},
|
|
7100
7124
|
requires: [
|
|
7101
|
-
"
|
|
7125
|
+
"fill-pattern"
|
|
7102
7126
|
],
|
|
7103
7127
|
"sdk-support": {
|
|
7104
7128
|
"basic functionality": {
|
|
@@ -7137,7 +7161,8 @@ var paint_fill = {
|
|
|
7137
7161
|
},
|
|
7138
7162
|
"fill-z-offset": {
|
|
7139
7163
|
type: "number",
|
|
7140
|
-
doc: "Specifies an uniform elevation
|
|
7164
|
+
doc: "Specifies an uniform elevation. Note: If the value is zero, the layer will be rendered on the ground. Non-zero values will elevate the layer from the sea level, which can cause it to be rendered below the terrain.",
|
|
7165
|
+
units: "meters",
|
|
7141
7166
|
"default": 0,
|
|
7142
7167
|
minimum: 0,
|
|
7143
7168
|
transition: true,
|
|
@@ -7302,7 +7327,8 @@ var paint_building = {
|
|
|
7302
7327
|
]
|
|
7303
7328
|
},
|
|
7304
7329
|
transition: true,
|
|
7305
|
-
doc: "The extent of the ambient occlusion effect on the ground beneath the procedural buildings
|
|
7330
|
+
doc: "The extent of the ambient occlusion effect on the ground beneath the procedural buildings.",
|
|
7331
|
+
units: "meters",
|
|
7306
7332
|
"sdk-support": {
|
|
7307
7333
|
"basic functionality": {
|
|
7308
7334
|
js: "3.16.0",
|
|
@@ -7808,7 +7834,7 @@ var paint_line = {
|
|
|
7808
7834
|
minimum: 0,
|
|
7809
7835
|
transition: true,
|
|
7810
7836
|
units: "pixels",
|
|
7811
|
-
doc: "Blur applied to the line
|
|
7837
|
+
doc: "Blur applied to the line.",
|
|
7812
7838
|
"sdk-support": {
|
|
7813
7839
|
"basic functionality": {
|
|
7814
7840
|
js: "0.10.0",
|
|
@@ -8116,6 +8142,7 @@ var paint_line = {
|
|
|
8116
8142
|
"default": 0,
|
|
8117
8143
|
minimum: 0,
|
|
8118
8144
|
transition: true,
|
|
8145
|
+
units: "pixels",
|
|
8119
8146
|
"sdk-support": {
|
|
8120
8147
|
"basic functionality": {
|
|
8121
8148
|
js: "3.0.0",
|
|
@@ -8286,7 +8313,7 @@ var paint_line = {
|
|
|
8286
8313
|
"default": 0,
|
|
8287
8314
|
minimum: 0,
|
|
8288
8315
|
units: "meters",
|
|
8289
|
-
doc: "Depth offset along the camera
|
|
8316
|
+
doc: "Depth offset along the camera. When set to a non-zero value, applied cutout opacity is 0.",
|
|
8290
8317
|
experimental: true,
|
|
8291
8318
|
"private": true,
|
|
8292
8319
|
transition: true,
|
|
@@ -8656,7 +8683,7 @@ var paint_heatmap = {
|
|
|
8656
8683
|
minimum: 1,
|
|
8657
8684
|
transition: true,
|
|
8658
8685
|
units: "pixels",
|
|
8659
|
-
doc: "Radius of influence of one heatmap point
|
|
8686
|
+
doc: "Radius of influence of one heatmap point. Increasing the value makes the heatmap smoother, but less detailed. `queryRenderedFeatures` on heatmap layers will return points within this radius.",
|
|
8660
8687
|
"sdk-support": {
|
|
8661
8688
|
"basic functionality": {
|
|
8662
8689
|
js: "0.41.0",
|
|
@@ -9493,7 +9520,8 @@ var paint_symbol = {
|
|
|
9493
9520
|
},
|
|
9494
9521
|
"symbol-z-offset": {
|
|
9495
9522
|
type: "number",
|
|
9496
|
-
doc: "Specifies an uniform elevation from the ground
|
|
9523
|
+
doc: "Specifies an uniform elevation from the ground.",
|
|
9524
|
+
units: "meters",
|
|
9497
9525
|
"default": 0,
|
|
9498
9526
|
minimum: 0,
|
|
9499
9527
|
transition: true,
|
|
@@ -9929,10 +9957,11 @@ var paint_raster = {
|
|
|
9929
9957
|
},
|
|
9930
9958
|
"raster-elevation": {
|
|
9931
9959
|
type: "number",
|
|
9932
|
-
doc: "Defines an uniform elevation from the base specified in raster-elevation-reference
|
|
9960
|
+
doc: "Defines an uniform elevation from the base specified in raster-elevation-reference.",
|
|
9933
9961
|
"default": 0,
|
|
9934
9962
|
minimum: 0,
|
|
9935
9963
|
transition: true,
|
|
9964
|
+
units: "meters",
|
|
9936
9965
|
experimental: true,
|
|
9937
9966
|
"sdk-support": {
|
|
9938
9967
|
"basic functionality": {
|
|
@@ -9983,6 +10012,7 @@ var paint_hillshade = {
|
|
|
9983
10012
|
minimum: 0,
|
|
9984
10013
|
maximum: 359,
|
|
9985
10014
|
doc: "The direction of the light source used to generate the hillshading with 0 as the top of the viewport if `hillshade-illumination-anchor` is set to `viewport` and due north if `hillshade-illumination-anchor` is set to `map` and no 3d lights enabled. If `hillshade-illumination-anchor` is set to `map` and 3d lights enabled, the direction from 3d lights is used instead.",
|
|
10015
|
+
units: "degrees",
|
|
9986
10016
|
transition: false,
|
|
9987
10017
|
"sdk-support": {
|
|
9988
10018
|
"basic functionality": {
|
|
@@ -10398,7 +10428,8 @@ var paint_sky = {
|
|
|
10398
10428
|
minimum: 0,
|
|
10399
10429
|
maximum: 180,
|
|
10400
10430
|
transition: false,
|
|
10401
|
-
doc: "The angular distance
|
|
10431
|
+
doc: "The angular distance from `sky-gradient-center` up to which the gradient extends. A value of 180 causes the gradient to wrap around to the opposite direction from `sky-gradient-center`.",
|
|
10432
|
+
units: "degrees",
|
|
10402
10433
|
"sdk-support": {
|
|
10403
10434
|
"basic functionality": {
|
|
10404
10435
|
js: "2.0.0",
|
|
@@ -10646,7 +10677,8 @@ var paint_model = {
|
|
|
10646
10677
|
}
|
|
10647
10678
|
},
|
|
10648
10679
|
transition: true,
|
|
10649
|
-
|
|
10680
|
+
units: "meters",
|
|
10681
|
+
doc: "The translation of the model in form of [longitudal, latitudal, altitude] offsets."
|
|
10650
10682
|
},
|
|
10651
10683
|
"model-color": {
|
|
10652
10684
|
type: "color",
|
|
@@ -11179,7 +11211,8 @@ var v8 = {
|
|
|
11179
11211
|
"default": 0,
|
|
11180
11212
|
minimum: 0,
|
|
11181
11213
|
maximum: 1,
|
|
11182
|
-
doc: "Radius of a fill extrusion edge
|
|
11214
|
+
doc: "Radius of a fill extrusion edge. If not zero, rounds extrusion edges for a smoother appearance.",
|
|
11215
|
+
units: "meters",
|
|
11183
11216
|
"sdk-support": {
|
|
11184
11217
|
"basic functionality": {
|
|
11185
11218
|
js: "3.0.0",
|
|
@@ -11520,7 +11553,7 @@ var v8 = {
|
|
|
11520
11553
|
]
|
|
11521
11554
|
},
|
|
11522
11555
|
requires: [
|
|
11523
|
-
"
|
|
11556
|
+
"fill-extrusion-pattern"
|
|
11524
11557
|
],
|
|
11525
11558
|
"sdk-support": {
|
|
11526
11559
|
"basic functionality": {
|
|
@@ -11747,7 +11780,8 @@ var v8 = {
|
|
|
11747
11780
|
]
|
|
11748
11781
|
},
|
|
11749
11782
|
transition: true,
|
|
11750
|
-
doc: "The extent of the ambient occlusion effect on the ground beneath the extruded buildings
|
|
11783
|
+
doc: "The extent of the ambient occlusion effect on the ground beneath the extruded buildings.",
|
|
11784
|
+
units: "meters",
|
|
11751
11785
|
requires: [
|
|
11752
11786
|
"lights"
|
|
11753
11787
|
],
|
|
@@ -11845,7 +11879,7 @@ var v8 = {
|
|
|
11845
11879
|
units: "meters",
|
|
11846
11880
|
"default": 0,
|
|
11847
11881
|
minimum: 0,
|
|
11848
|
-
doc: "The extent of the flood light effect on the walls of the extruded buildings
|
|
11882
|
+
doc: "The extent of the flood light effect on the walls of the extruded buildings.",
|
|
11849
11883
|
requires: [
|
|
11850
11884
|
"lights"
|
|
11851
11885
|
],
|
|
@@ -11876,7 +11910,7 @@ var v8 = {
|
|
|
11876
11910
|
experimental: true,
|
|
11877
11911
|
units: "meters",
|
|
11878
11912
|
"default": 0,
|
|
11879
|
-
doc: "The extent of the flood light effect on the ground beneath the extruded buildings
|
|
11913
|
+
doc: "The extent of the flood light effect on the ground beneath the extruded buildings. Note: this experimental property is evaluated once per tile, during tile initialization. Changing the property value could trigger tile reload. The `feature-state` styling is deprecated and will get removed soon.",
|
|
11880
11914
|
requires: [
|
|
11881
11915
|
"lights"
|
|
11882
11916
|
],
|
|
@@ -12244,10 +12278,11 @@ var v8 = {
|
|
|
12244
12278
|
},
|
|
12245
12279
|
"raster-particle-elevation": {
|
|
12246
12280
|
type: "number",
|
|
12247
|
-
doc: "Defines an uniform elevation from sea level
|
|
12281
|
+
doc: "Defines an uniform elevation from sea level.",
|
|
12248
12282
|
"default": 0,
|
|
12249
12283
|
minimum: 0,
|
|
12250
12284
|
transition: true,
|
|
12285
|
+
units: "meters",
|
|
12251
12286
|
"sdk-support": {
|
|
12252
12287
|
"basic functionality": {
|
|
12253
12288
|
js: "3.7.0",
|
|
@@ -12405,11 +12440,11 @@ function sortKeysBy(obj, reference2) {
|
|
|
12405
12440
|
return result;
|
|
12406
12441
|
}
|
|
12407
12442
|
function format(style, space = 2) {
|
|
12408
|
-
|
|
12409
|
-
if (
|
|
12410
|
-
|
|
12443
|
+
const sorted = sortKeysBy(style, v8.$root);
|
|
12444
|
+
if (sorted.layers) {
|
|
12445
|
+
sorted.layers = sorted.layers.map((layer) => sortKeysBy(layer, v8.layer));
|
|
12411
12446
|
}
|
|
12412
|
-
return stringify(
|
|
12447
|
+
return stringify(sorted, { indent: space });
|
|
12413
12448
|
}
|
|
12414
12449
|
|
|
12415
12450
|
function getPropertyReference(propertyName) {
|
|
@@ -12662,34 +12697,15 @@ function toString$1(type) {
|
|
|
12662
12697
|
return type.kind;
|
|
12663
12698
|
}
|
|
12664
12699
|
}
|
|
12665
|
-
const valueMemberTypes = [
|
|
12666
|
-
NullType,
|
|
12667
|
-
NumberType,
|
|
12668
|
-
StringType,
|
|
12669
|
-
BooleanType,
|
|
12670
|
-
ColorType,
|
|
12671
|
-
FormattedType,
|
|
12672
|
-
ObjectType,
|
|
12673
|
-
array$1(ValueType),
|
|
12674
|
-
ResolvedImageType
|
|
12675
|
-
];
|
|
12676
12700
|
function checkSubtype(expected, t) {
|
|
12677
|
-
|
|
12678
|
-
|
|
12679
|
-
|
|
12680
|
-
|
|
12681
|
-
|
|
12682
|
-
|
|
12683
|
-
} else if (expected.kind === t.kind) {
|
|
12684
|
-
return null;
|
|
12685
|
-
} else if (expected.kind === "value") {
|
|
12686
|
-
for (const memberType of valueMemberTypes) {
|
|
12687
|
-
if (!checkSubtype(memberType, t)) {
|
|
12688
|
-
return null;
|
|
12689
|
-
}
|
|
12690
|
-
}
|
|
12701
|
+
return isSubtype(expected, t) ? null : `Expected ${toString$1(expected)} but found ${toString$1(t)} instead.`;
|
|
12702
|
+
}
|
|
12703
|
+
function isSubtype(expected, t) {
|
|
12704
|
+
if (t.kind === "error") return true;
|
|
12705
|
+
if (expected.kind === "array") {
|
|
12706
|
+
return t.kind === "array" && (t.N === 0 && t.itemType.kind === "value" || isSubtype(expected.itemType, t.itemType)) && (typeof expected.N !== "number" || expected.N === t.N);
|
|
12691
12707
|
}
|
|
12692
|
-
return
|
|
12708
|
+
return expected.kind === t.kind || expected.kind === "value" && t.kind !== "collator";
|
|
12693
12709
|
}
|
|
12694
12710
|
function isValidType(provided, allowedTypes) {
|
|
12695
12711
|
return allowedTypes.some((t) => t.kind === provided.kind);
|
|
@@ -15208,6 +15224,21 @@ function isGlobalPropertyConstantSet(e, properties) {
|
|
|
15208
15224
|
function isGlobalPropertyConstant(e, properties) {
|
|
15209
15225
|
return isGlobalPropertyConstantSet(e, new Set(properties));
|
|
15210
15226
|
}
|
|
15227
|
+
const GlobalDependency = { Zoom: 1, Light: 2, LineProgress: 4 };
|
|
15228
|
+
const globalDependencyFlags = {
|
|
15229
|
+
"zoom": GlobalDependency.Zoom,
|
|
15230
|
+
"pitch": GlobalDependency.Zoom,
|
|
15231
|
+
"distance-from-center": GlobalDependency.Zoom,
|
|
15232
|
+
"measure-light": GlobalDependency.Light,
|
|
15233
|
+
"line-progress": GlobalDependency.LineProgress
|
|
15234
|
+
};
|
|
15235
|
+
function getGlobalDependencies(e) {
|
|
15236
|
+
let flags = e instanceof CompoundExpression ? globalDependencyFlags[e.name] || 0 : 0;
|
|
15237
|
+
e.eachChild((arg) => {
|
|
15238
|
+
flags |= getGlobalDependencies(arg);
|
|
15239
|
+
});
|
|
15240
|
+
return flags;
|
|
15241
|
+
}
|
|
15211
15242
|
|
|
15212
15243
|
const RE = 6378.137;
|
|
15213
15244
|
const FE = 1 / 298.257223563;
|
|
@@ -15890,7 +15921,7 @@ class ParsingContext {
|
|
|
15890
15921
|
* @param options.omitTypeAnnotations set true to omit inferred type annotations. Caller beware: with this option set, the parsed expression's type will NOT satisfy `expectedType` if it would normally be wrapped in an inferred annotation.
|
|
15891
15922
|
* @private
|
|
15892
15923
|
*/
|
|
15893
|
-
parse(expr, index, expectedType, bindings, options
|
|
15924
|
+
parse(expr, index, expectedType, bindings, options) {
|
|
15894
15925
|
if (index || expectedType) {
|
|
15895
15926
|
const prevExpectedType = this.expectedType;
|
|
15896
15927
|
const prevScope = this.scope;
|
|
@@ -15914,7 +15945,7 @@ class ParsingContext {
|
|
|
15914
15945
|
* @param options.omitTypeAnnotations set true to omit inferred type annotations. Caller beware: with this option set, the parsed expression's type will NOT satisfy `expectedType` if it would normally be wrapped in an inferred annotation.
|
|
15915
15946
|
* @private
|
|
15916
15947
|
*/
|
|
15917
|
-
parseObjectValue(expr, index, key, expectedType, bindings, options
|
|
15948
|
+
parseObjectValue(expr, index, key, expectedType, bindings, options) {
|
|
15918
15949
|
const prevExpectedType = this.expectedType;
|
|
15919
15950
|
const prevScope = this.scope;
|
|
15920
15951
|
if (bindings) this.scope = this.scope.concat(bindings);
|
|
@@ -15928,41 +15959,34 @@ class ParsingContext {
|
|
|
15928
15959
|
this.scope = prevScope;
|
|
15929
15960
|
return result;
|
|
15930
15961
|
}
|
|
15931
|
-
|
|
15932
|
-
|
|
15933
|
-
|
|
15962
|
+
// Applies `expectedType` to a freshly parsed expression, wrapping it in an inferred assertion
|
|
15963
|
+
// or coercion where that is what the expected type calls for. Returns null if the type is wrong.
|
|
15964
|
+
_annotateToExpectedType(parsed, options) {
|
|
15965
|
+
const expected = this.expectedType;
|
|
15966
|
+
if (!expected) return parsed;
|
|
15967
|
+
const actual = parsed.type;
|
|
15968
|
+
if ((expected.kind === "string" || expected.kind === "number" || expected.kind === "boolean" || expected.kind === "object" || expected.kind === "array") && actual.kind === "value") {
|
|
15969
|
+
return annotate(parsed, expected, options?.typeAnnotation || "assert");
|
|
15970
|
+
} else if ((expected.kind === "color" || expected.kind === "formatted" || expected.kind === "resolvedImage") && (actual.kind === "value" || actual.kind === "string")) {
|
|
15971
|
+
return annotate(parsed, expected, options?.typeAnnotation || "coerce");
|
|
15972
|
+
} else if (this.checkSubtype(expected, actual)) {
|
|
15973
|
+
return null;
|
|
15934
15974
|
}
|
|
15935
|
-
|
|
15975
|
+
return parsed;
|
|
15976
|
+
}
|
|
15977
|
+
_parse(expr, options) {
|
|
15978
|
+
const scalarType = expr === null ? NullType : typeof expr === "string" ? StringType : typeof expr === "boolean" ? BooleanType : typeof expr === "number" ? NumberType : null;
|
|
15979
|
+
let result;
|
|
15980
|
+
if (scalarType) {
|
|
15981
|
+
result = new Literal(scalarType, expr);
|
|
15982
|
+
} else if (Array.isArray(expr)) {
|
|
15936
15983
|
if (expr.length === 0) {
|
|
15937
15984
|
return this.error(`Expected an array with at least one element. If you wanted a literal array, use ["literal", []].`);
|
|
15938
15985
|
}
|
|
15939
|
-
const Expr =
|
|
15940
|
-
if (Expr)
|
|
15941
|
-
|
|
15942
|
-
|
|
15943
|
-
if (this.expectedType) {
|
|
15944
|
-
const expected = this.expectedType;
|
|
15945
|
-
const actual = parsed.type;
|
|
15946
|
-
if ((expected.kind === "string" || expected.kind === "number" || expected.kind === "boolean" || expected.kind === "object" || expected.kind === "array") && actual.kind === "value") {
|
|
15947
|
-
parsed = annotate(parsed, expected, options.typeAnnotation || "assert");
|
|
15948
|
-
} else if ((expected.kind === "color" || expected.kind === "formatted" || expected.kind === "resolvedImage") && (actual.kind === "value" || actual.kind === "string")) {
|
|
15949
|
-
parsed = annotate(parsed, expected, options.typeAnnotation || "coerce");
|
|
15950
|
-
} else if (this.checkSubtype(expected, actual)) {
|
|
15951
|
-
return null;
|
|
15952
|
-
}
|
|
15953
|
-
}
|
|
15954
|
-
if (!(parsed instanceof Literal) && parsed.type.kind !== "resolvedImage" && isConstant(parsed)) {
|
|
15955
|
-
const ec = new EvaluationContext(this._scope, this.options, this.iconImageUseTheme);
|
|
15956
|
-
try {
|
|
15957
|
-
parsed = new Literal(parsed.type, parsed.evaluate(ec));
|
|
15958
|
-
} catch (e) {
|
|
15959
|
-
this.error(e.message);
|
|
15960
|
-
return null;
|
|
15961
|
-
}
|
|
15962
|
-
}
|
|
15963
|
-
return parsed;
|
|
15964
|
-
}
|
|
15965
|
-
return Coercion.parse(["to-array", expr], this);
|
|
15986
|
+
const Expr = this.registry[expr[0]];
|
|
15987
|
+
if (!Expr) return Coercion.parse(["to-array", expr], this);
|
|
15988
|
+
result = Expr.parse(expr, this);
|
|
15989
|
+
if (!result) return null;
|
|
15966
15990
|
} else if (typeof expr === "undefined") {
|
|
15967
15991
|
return this.error(`'undefined' value invalid. Use null instead.`);
|
|
15968
15992
|
} else if (typeof expr === "object") {
|
|
@@ -15970,6 +15994,18 @@ class ParsingContext {
|
|
|
15970
15994
|
} else {
|
|
15971
15995
|
return this.error(`Expected an array, but found ${typeof expr} instead.`);
|
|
15972
15996
|
}
|
|
15997
|
+
let parsed = this._annotateToExpectedType(result, options);
|
|
15998
|
+
if (!parsed) return null;
|
|
15999
|
+
if (!(parsed instanceof Literal) && parsed.type.kind !== "resolvedImage" && isConstant(parsed)) {
|
|
16000
|
+
const ec = new EvaluationContext(this._scope, this.options, this.iconImageUseTheme);
|
|
16001
|
+
try {
|
|
16002
|
+
parsed = new Literal(parsed.type, parsed.evaluate(ec));
|
|
16003
|
+
} catch (e) {
|
|
16004
|
+
this.error(e.message);
|
|
16005
|
+
return null;
|
|
16006
|
+
}
|
|
16007
|
+
}
|
|
16008
|
+
return parsed;
|
|
15973
16009
|
}
|
|
15974
16010
|
/**
|
|
15975
16011
|
* Returns a copy of this context suitable for parsing the subexpression at
|
|
@@ -16001,10 +16037,12 @@ class ParsingContext {
|
|
|
16001
16037
|
* overload signatures without polluting the parent errors list.
|
|
16002
16038
|
* @private
|
|
16003
16039
|
*/
|
|
16040
|
+
// `path` is shared rather than copied: argument parsing pushes and pops it in balance, and
|
|
16041
|
+
// `error` snapshots `key` into the message eagerly, so the fork never observes a stale path.
|
|
16004
16042
|
_forkForSignature() {
|
|
16005
16043
|
return new ParsingContext(
|
|
16006
16044
|
this.registry,
|
|
16007
|
-
this.path
|
|
16045
|
+
this.path,
|
|
16008
16046
|
null,
|
|
16009
16047
|
this.scope,
|
|
16010
16048
|
[],
|
|
@@ -17228,7 +17266,7 @@ function mulberry32(a) {
|
|
|
17228
17266
|
};
|
|
17229
17267
|
}
|
|
17230
17268
|
|
|
17231
|
-
const expressions = {
|
|
17269
|
+
const expressions = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
17232
17270
|
// special forms
|
|
17233
17271
|
"==": Equals,
|
|
17234
17272
|
"!=": NotEquals,
|
|
@@ -17266,7 +17304,7 @@ const expressions = {
|
|
|
17266
17304
|
"within": Within,
|
|
17267
17305
|
"distance": Distance,
|
|
17268
17306
|
"config": Config
|
|
17269
|
-
};
|
|
17307
|
+
});
|
|
17270
17308
|
function rgba(ctx, [r, g, b, a]) {
|
|
17271
17309
|
r = r.evaluate(ctx);
|
|
17272
17310
|
g = g.evaluate(ctx);
|
|
@@ -17939,28 +17977,22 @@ CompoundExpression.register(expressions, {
|
|
|
17939
17977
|
]
|
|
17940
17978
|
});
|
|
17941
17979
|
|
|
17942
|
-
|
|
17980
|
+
const NO_CONFIG_DEPENDENCIES = /* @__PURE__ */ new Set();
|
|
17981
|
+
function collect(e, deps) {
|
|
17943
17982
|
if (e instanceof Config) {
|
|
17944
|
-
|
|
17945
|
-
|
|
17983
|
+
if (deps.configDependencies === NO_CONFIG_DEPENDENCIES) deps.configDependencies = /* @__PURE__ */ new Set();
|
|
17984
|
+
deps.configDependencies.add(e.key);
|
|
17985
|
+
return;
|
|
17946
17986
|
}
|
|
17947
|
-
|
|
17987
|
+
if (e instanceof CompoundExpression && e.name === "is-active-floor") deps.isIndoorDependent = true;
|
|
17948
17988
|
e.eachChild((arg) => {
|
|
17949
|
-
|
|
17989
|
+
collect(arg, deps);
|
|
17950
17990
|
});
|
|
17951
|
-
return result;
|
|
17952
17991
|
}
|
|
17953
|
-
function
|
|
17954
|
-
|
|
17955
|
-
|
|
17956
|
-
|
|
17957
|
-
let result = false;
|
|
17958
|
-
e.eachChild((arg) => {
|
|
17959
|
-
if (!result && isIndoorDependent(arg)) {
|
|
17960
|
-
result = true;
|
|
17961
|
-
}
|
|
17962
|
-
});
|
|
17963
|
-
return result;
|
|
17992
|
+
function getExpressionDependencies(e) {
|
|
17993
|
+
const deps = { configDependencies: NO_CONFIG_DEPENDENCIES, isIndoorDependent: false };
|
|
17994
|
+
collect(e, deps);
|
|
17995
|
+
return deps;
|
|
17964
17996
|
}
|
|
17965
17997
|
|
|
17966
17998
|
function success(value) {
|
|
@@ -17997,7 +18029,8 @@ function isFunction(value) {
|
|
|
17997
18029
|
function identityFunction(x) {
|
|
17998
18030
|
return x;
|
|
17999
18031
|
}
|
|
18000
|
-
function createFunction(
|
|
18032
|
+
function createFunction(input, propertySpec) {
|
|
18033
|
+
let parameters = input;
|
|
18001
18034
|
const isColor = propertySpec.type === "color";
|
|
18002
18035
|
const zoomAndFeatureDependent = parameters.stops && typeof parameters.stops[0][0] === "object";
|
|
18003
18036
|
const featureDependent = zoomAndFeatureDependent || parameters.property !== void 0;
|
|
@@ -18046,13 +18079,9 @@ function createFunction(parameters, propertySpec) {
|
|
|
18046
18079
|
const zoom = stop[0].zoom;
|
|
18047
18080
|
if (featureFunctions[zoom] === void 0) {
|
|
18048
18081
|
featureFunctions[zoom] = {
|
|
18049
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
18050
18082
|
zoom,
|
|
18051
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
18052
18083
|
type: parameters.type,
|
|
18053
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
18054
18084
|
property: parameters.property,
|
|
18055
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
18056
18085
|
default: parameters.default,
|
|
18057
18086
|
stops: []
|
|
18058
18087
|
};
|
|
@@ -18069,29 +18098,21 @@ function createFunction(parameters, propertySpec) {
|
|
|
18069
18098
|
kind: "composite",
|
|
18070
18099
|
interpolationType,
|
|
18071
18100
|
interpolationFactor: Interpolate.interpolationFactor.bind(void 0, interpolationType),
|
|
18072
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
18073
18101
|
zoomStops: featureFunctionStops.map((s) => s[0]),
|
|
18074
18102
|
evaluate({ zoom }, properties) {
|
|
18075
18103
|
return evaluateExponentialFunction({
|
|
18076
18104
|
stops: featureFunctionStops,
|
|
18077
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
18078
18105
|
base: parameters.base
|
|
18079
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
18080
18106
|
}, propertySpec, zoom).evaluate(zoom, properties);
|
|
18081
18107
|
}
|
|
18082
18108
|
};
|
|
18083
18109
|
} else if (zoomDependent) {
|
|
18084
|
-
const interpolationType = type === "exponential" ?
|
|
18085
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
18086
|
-
{ name: "exponential", base: parameters.base !== void 0 ? parameters.base : 1 }
|
|
18087
|
-
) : null;
|
|
18110
|
+
const interpolationType = type === "exponential" ? { name: "exponential", base: parameters.base !== void 0 ? parameters.base : 1 } : null;
|
|
18088
18111
|
return {
|
|
18089
18112
|
kind: "camera",
|
|
18090
18113
|
interpolationType,
|
|
18091
18114
|
interpolationFactor: Interpolate.interpolationFactor.bind(void 0, interpolationType),
|
|
18092
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
18093
18115
|
zoomStops: parameters.stops.map((s) => s[0]),
|
|
18094
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
18095
18116
|
evaluate: ({ zoom }) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)
|
|
18096
18117
|
};
|
|
18097
18118
|
} else {
|
|
@@ -18118,31 +18139,26 @@ function evaluateCategoricalFunction(parameters, propertySpec, input, hashedStop
|
|
|
18118
18139
|
}
|
|
18119
18140
|
function evaluateIntervalFunction(parameters, propertySpec, input) {
|
|
18120
18141
|
if (!isNumber(input)) return coalesce$1(parameters.default, propertySpec.default);
|
|
18121
|
-
const
|
|
18122
|
-
|
|
18123
|
-
if (
|
|
18124
|
-
if (input
|
|
18125
|
-
|
|
18126
|
-
|
|
18142
|
+
const stops = parameters.stops;
|
|
18143
|
+
const n = stops.length;
|
|
18144
|
+
if (n === 1) return stops[0][1];
|
|
18145
|
+
if (input <= stops[0][0]) return stops[0][1];
|
|
18146
|
+
if (input >= stops[n - 1][0]) return stops[n - 1][1];
|
|
18147
|
+
const index = findStopLessThanOrEqualTo(stops.map((stop) => stop[0]), input);
|
|
18148
|
+
return stops[index][1];
|
|
18127
18149
|
}
|
|
18128
18150
|
function evaluateExponentialFunction(parameters, propertySpec, input) {
|
|
18129
18151
|
const base = parameters.base !== void 0 ? parameters.base : 1;
|
|
18130
18152
|
if (!isNumber(input)) return coalesce$1(parameters.default, propertySpec.default);
|
|
18131
|
-
const
|
|
18132
|
-
|
|
18133
|
-
if (
|
|
18134
|
-
if (input
|
|
18135
|
-
|
|
18136
|
-
const
|
|
18137
|
-
|
|
18138
|
-
|
|
18139
|
-
|
|
18140
|
-
parameters.stops[index][0],
|
|
18141
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
18142
|
-
parameters.stops[index + 1][0]
|
|
18143
|
-
);
|
|
18144
|
-
const outputLower = parameters.stops[index][1];
|
|
18145
|
-
const outputUpper = parameters.stops[index + 1][1];
|
|
18153
|
+
const stops = parameters.stops;
|
|
18154
|
+
const n = stops.length;
|
|
18155
|
+
if (n === 1) return stops[0][1];
|
|
18156
|
+
if (input <= stops[0][0]) return stops[0][1];
|
|
18157
|
+
if (input >= stops[n - 1][0]) return stops[n - 1][1];
|
|
18158
|
+
const index = findStopLessThanOrEqualTo(stops.map((stop) => stop[0]), input);
|
|
18159
|
+
const t = interpolationFactor(input, base, stops[index][0], stops[index + 1][0]);
|
|
18160
|
+
const outputLower = stops[index][1];
|
|
18161
|
+
const outputUpper = stops[index + 1][1];
|
|
18146
18162
|
let interp = interpolate[propertySpec.type] || identityFunction;
|
|
18147
18163
|
if (parameters.colorSpace && parameters.colorSpace !== "rgb") {
|
|
18148
18164
|
const colorspace = colorSpaces[parameters.colorSpace];
|
|
@@ -18196,8 +18212,9 @@ class StyleExpression {
|
|
|
18196
18212
|
this._evaluator = new EvaluationContext(scope, options, iconImageUseTheme);
|
|
18197
18213
|
this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
|
|
18198
18214
|
this._enumValues = propertySpec && propertySpec.type === "enum" ? propertySpec.values : null;
|
|
18199
|
-
|
|
18200
|
-
this.
|
|
18215
|
+
const dependencies = getExpressionDependencies(expression);
|
|
18216
|
+
this.configDependencies = dependencies.configDependencies;
|
|
18217
|
+
this.isIndoorDependent = dependencies.isIndoorDependent;
|
|
18201
18218
|
}
|
|
18202
18219
|
evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection, featureTileCoord, featureDistanceData) {
|
|
18203
18220
|
const evaluator = this._evaluator;
|
|
@@ -18269,8 +18286,8 @@ class ZoomConstantExpression {
|
|
|
18269
18286
|
this.isLightConstant = isLightConstant;
|
|
18270
18287
|
this.isLineProgressConstant = isLineProgressConstant;
|
|
18271
18288
|
this.isStateDependent = kind !== "constant" && !isStateConstant(expression.expression);
|
|
18272
|
-
this.configDependencies =
|
|
18273
|
-
this.isIndoorDependent =
|
|
18289
|
+
this.configDependencies = expression.configDependencies;
|
|
18290
|
+
this.isIndoorDependent = expression.isIndoorDependent;
|
|
18274
18291
|
}
|
|
18275
18292
|
evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {
|
|
18276
18293
|
return this._styleExpression.evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection);
|
|
@@ -18285,10 +18302,10 @@ class ZoomDependentExpression {
|
|
|
18285
18302
|
this.zoomStops = zoomStops;
|
|
18286
18303
|
this._styleExpression = expression;
|
|
18287
18304
|
this.isStateDependent = kind !== "camera" && !isStateConstant(expression.expression);
|
|
18288
|
-
this.isIndoorDependent =
|
|
18305
|
+
this.isIndoorDependent = expression.isIndoorDependent;
|
|
18289
18306
|
this.isLightConstant = isLightConstant;
|
|
18290
18307
|
this.isLineProgressConstant = isLineProgressConstant;
|
|
18291
|
-
this.configDependencies =
|
|
18308
|
+
this.configDependencies = expression.configDependencies;
|
|
18292
18309
|
this.interpolationType = interpolationType;
|
|
18293
18310
|
}
|
|
18294
18311
|
evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {
|
|
@@ -18306,24 +18323,25 @@ class ZoomDependentExpression {
|
|
|
18306
18323
|
}
|
|
18307
18324
|
}
|
|
18308
18325
|
function createPropertyExpression(expression, propertySpec, scope, options, iconImageUseTheme) {
|
|
18309
|
-
|
|
18310
|
-
if (
|
|
18311
|
-
return
|
|
18326
|
+
const styleExpression = createExpression(expression, propertySpec, scope, options, iconImageUseTheme);
|
|
18327
|
+
if (styleExpression.result === "error") {
|
|
18328
|
+
return styleExpression;
|
|
18312
18329
|
}
|
|
18313
|
-
const parsed =
|
|
18330
|
+
const parsed = styleExpression.value.expression;
|
|
18314
18331
|
const isFeatureConstant$1 = isFeatureConstant(parsed);
|
|
18315
18332
|
if (!isFeatureConstant$1 && !supportsPropertyExpression(propertySpec)) {
|
|
18316
18333
|
return error([new ParsingError$1("", "data expressions not supported")]);
|
|
18317
18334
|
}
|
|
18318
|
-
const
|
|
18335
|
+
const globalDependencies = getGlobalDependencies(parsed);
|
|
18336
|
+
const isZoomConstant = (globalDependencies & GlobalDependency.Zoom) === 0;
|
|
18319
18337
|
if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {
|
|
18320
18338
|
return error([new ParsingError$1("", "zoom expressions not supported")]);
|
|
18321
18339
|
}
|
|
18322
|
-
const isLightConstant =
|
|
18340
|
+
const isLightConstant = (globalDependencies & GlobalDependency.Light) === 0;
|
|
18323
18341
|
if (!isLightConstant && !supportsLightExpression(propertySpec)) {
|
|
18324
18342
|
return error([new ParsingError$1("", "measure-light expression not supported")]);
|
|
18325
18343
|
}
|
|
18326
|
-
const isLineProgressConstant =
|
|
18344
|
+
const isLineProgressConstant = (globalDependencies & GlobalDependency.LineProgress) === 0;
|
|
18327
18345
|
if (!isLineProgressConstant && !supportsLineProgressExpression(propertySpec)) {
|
|
18328
18346
|
return error([new ParsingError$1("", "line-progress expression not supported")]);
|
|
18329
18347
|
}
|
|
@@ -18337,22 +18355,10 @@ function createPropertyExpression(expression, propertySpec, scope, options, icon
|
|
|
18337
18355
|
return error([new ParsingError$1("", '"interpolate" expressions cannot be used with this property')]);
|
|
18338
18356
|
}
|
|
18339
18357
|
if (!zoomCurve) {
|
|
18340
|
-
return success(isFeatureConstant$1 && isLineProgressConstant ? (
|
|
18341
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
|
18342
|
-
new ZoomConstantExpression("constant", expression.value, isLightConstant, isLineProgressConstant)
|
|
18343
|
-
) : (
|
|
18344
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
|
18345
|
-
new ZoomConstantExpression("source", expression.value, isLightConstant, isLineProgressConstant)
|
|
18346
|
-
));
|
|
18358
|
+
return success(isFeatureConstant$1 && isLineProgressConstant ? new ZoomConstantExpression("constant", styleExpression.value, isLightConstant, isLineProgressConstant) : new ZoomConstantExpression("source", styleExpression.value, isLightConstant, isLineProgressConstant));
|
|
18347
18359
|
}
|
|
18348
18360
|
const interpolationType = zoomCurve instanceof Interpolate ? zoomCurve.interpolation : void 0;
|
|
18349
|
-
return success(isFeatureConstant$1 && isLineProgressConstant ? (
|
|
18350
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
|
18351
|
-
new ZoomDependentExpression("camera", expression.value, zoomCurve.labels, interpolationType, isLightConstant, isLineProgressConstant)
|
|
18352
|
-
) : (
|
|
18353
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
|
18354
|
-
new ZoomDependentExpression("composite", expression.value, zoomCurve.labels, interpolationType, isLightConstant, isLineProgressConstant)
|
|
18355
|
-
));
|
|
18361
|
+
return success(isFeatureConstant$1 && isLineProgressConstant ? new ZoomDependentExpression("camera", styleExpression.value, zoomCurve.labels, interpolationType, isLightConstant, isLineProgressConstant) : new ZoomDependentExpression("composite", styleExpression.value, zoomCurve.labels, interpolationType, isLightConstant, isLineProgressConstant));
|
|
18356
18362
|
}
|
|
18357
18363
|
class StylePropertyFunction {
|
|
18358
18364
|
constructor(parameters, specification) {
|
|
@@ -18793,6 +18799,7 @@ function collapseDynamicBooleanExpressions(expression) {
|
|
|
18793
18799
|
}
|
|
18794
18800
|
}
|
|
18795
18801
|
function unionDynamicBranches(filter) {
|
|
18802
|
+
if (!Array.isArray(filter)) return;
|
|
18796
18803
|
let isBranchingDynamically = false;
|
|
18797
18804
|
const branches = [];
|
|
18798
18805
|
if (filter[0] === "case") {
|
|
@@ -20024,32 +20031,32 @@ function disallowedFilterParameters(e, options) {
|
|
|
20024
20031
|
return errors;
|
|
20025
20032
|
}
|
|
20026
20033
|
const FEATURE_OPERATORS = /* @__PURE__ */ new Set(["get", "has", "properties", "geometry-type", "id"]);
|
|
20027
|
-
const APPEARANCES_DISALLOWED_PARAMETERS = /* @__PURE__ */ new Set([
|
|
20028
|
-
"zoom",
|
|
20029
|
-
"pitch",
|
|
20030
|
-
"distance-from-center",
|
|
20031
|
-
"feature",
|
|
20032
|
-
"feature-state",
|
|
20033
|
-
"measure-light",
|
|
20034
|
-
"heatmap-density",
|
|
20035
|
-
"line-progress",
|
|
20036
|
-
"raster-value",
|
|
20037
|
-
"raster-particle-speed",
|
|
20038
|
-
"sky-radial-progress"
|
|
20039
|
-
]);
|
|
20040
20034
|
function checkDisallowedAppearancesParameters(e, options) {
|
|
20035
|
+
const disallowedParameters = /* @__PURE__ */ new Set([
|
|
20036
|
+
"zoom",
|
|
20037
|
+
"pitch",
|
|
20038
|
+
"distance-from-center",
|
|
20039
|
+
"feature",
|
|
20040
|
+
"feature-state",
|
|
20041
|
+
"measure-light",
|
|
20042
|
+
"heatmap-density",
|
|
20043
|
+
"line-progress",
|
|
20044
|
+
"raster-value",
|
|
20045
|
+
"raster-particle-speed",
|
|
20046
|
+
"sky-radial-progress"
|
|
20047
|
+
]);
|
|
20041
20048
|
if (options.valueSpec && options.valueSpec.expression) {
|
|
20042
20049
|
for (const param of options.valueSpec.expression.parameters) {
|
|
20043
|
-
|
|
20050
|
+
disallowedParameters.delete(param);
|
|
20044
20051
|
}
|
|
20045
20052
|
}
|
|
20046
|
-
if (
|
|
20053
|
+
if (disallowedParameters.size === 0) {
|
|
20047
20054
|
return [];
|
|
20048
20055
|
}
|
|
20049
20056
|
const errors = [];
|
|
20050
20057
|
if (e instanceof CompoundExpression) {
|
|
20051
20058
|
const param = FEATURE_OPERATORS.has(e.name) ? "feature" : e.name;
|
|
20052
|
-
if (
|
|
20059
|
+
if (disallowedParameters.has(param)) {
|
|
20053
20060
|
return [new ValidationError(options.key, options.value, `["${e.name}"] is not an allowed parameter`)];
|
|
20054
20061
|
}
|
|
20055
20062
|
}
|
|
@@ -20341,7 +20348,7 @@ function validateCondition(options) {
|
|
|
20341
20348
|
errors.push(...validateExpression({
|
|
20342
20349
|
key: options.key,
|
|
20343
20350
|
value: condition,
|
|
20344
|
-
valueSpec:
|
|
20351
|
+
valueSpec: options.styleSpec["appearance"]["condition"],
|
|
20345
20352
|
expressionContext: "appearance"
|
|
20346
20353
|
}));
|
|
20347
20354
|
return errors;
|