@mapbox/mapbox-gl-style-spec 14.3.0 → 14.4.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 +255 -229
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +255 -229
- package/dist/index.es.js.map +1 -1
- package/expression/expression.js +1 -0
- package/flow-typed/gl-matrix.js +1 -1
- package/flow-typed/tracked_parameters_proxy.js +82 -0
- package/package.json +1 -1
- package/reference/v8.json +142 -41
- package/rollup.config.js +1 -0
- package/types.js +137 -20
- package/validate/validate_model.js +3 -3
- package/flow-typed/grid-index.js +0 -13
package/dist/index.es.js
CHANGED
|
@@ -901,6 +901,11 @@ var source_geojson = {
|
|
|
901
901
|
"default": 18,
|
|
902
902
|
doc: "Maximum zoom level at which to create vector tiles (higher means greater detail at high zoom levels)."
|
|
903
903
|
},
|
|
904
|
+
minzoom: {
|
|
905
|
+
type: "number",
|
|
906
|
+
"default": 0,
|
|
907
|
+
doc: "Minimum zoom level at which to create vector tiles"
|
|
908
|
+
},
|
|
904
909
|
attribution: {
|
|
905
910
|
type: "string",
|
|
906
911
|
doc: "Contains an attribution to be displayed when the map is shown to a user."
|
|
@@ -952,11 +957,21 @@ var source_geojson = {
|
|
|
952
957
|
generateId: {
|
|
953
958
|
type: "boolean",
|
|
954
959
|
"default": false,
|
|
955
|
-
doc: "Whether to generate ids for the
|
|
960
|
+
doc: "Whether to generate ids for the GeoJSON features. When enabled, the `feature.id` property will be auto assigned based on its index in the `features` array, over-writing any previous values."
|
|
956
961
|
},
|
|
957
962
|
promoteId: {
|
|
958
963
|
type: "promoteId",
|
|
959
964
|
doc: "A property to use as a feature id (for feature state). Either a property name, or an object of the form `{<sourceLayer>: <propertyName>}`."
|
|
965
|
+
},
|
|
966
|
+
dynamic: {
|
|
967
|
+
type: "boolean",
|
|
968
|
+
"default": false,
|
|
969
|
+
doc: "Whether to optimize this source for frequent data updates (e.g. animating features).",
|
|
970
|
+
"sdk-support": {
|
|
971
|
+
"basic functionality": {
|
|
972
|
+
js: "3.4.0"
|
|
973
|
+
}
|
|
974
|
+
}
|
|
960
975
|
}
|
|
961
976
|
};
|
|
962
977
|
var source_video = {
|
|
@@ -1131,10 +1146,9 @@ var layer = {
|
|
|
1131
1146
|
doc: "Particle animation driven by textures such as wind maps.",
|
|
1132
1147
|
"sdk-support": {
|
|
1133
1148
|
"basic functionality": {
|
|
1134
|
-
js: "
|
|
1135
|
-
android: "
|
|
1136
|
-
ios: "
|
|
1137
|
-
macos: "0.1.0"
|
|
1149
|
+
js: "3.3.0",
|
|
1150
|
+
android: "11.4.0",
|
|
1151
|
+
ios: "11.4.0"
|
|
1138
1152
|
}
|
|
1139
1153
|
}
|
|
1140
1154
|
},
|
|
@@ -1344,7 +1358,7 @@ var layout_model = {
|
|
|
1344
1358
|
"model-id": {
|
|
1345
1359
|
type: "string",
|
|
1346
1360
|
"default": "",
|
|
1347
|
-
doc: "Model to render.",
|
|
1361
|
+
doc: "Model to render. It can be either a string referencing an element to the models root property or an internal or external URL",
|
|
1348
1362
|
"property-type": "data-driven",
|
|
1349
1363
|
expression: {
|
|
1350
1364
|
interpolated: false,
|
|
@@ -1563,6 +1577,9 @@ var layout_line = {
|
|
|
1563
1577
|
},
|
|
1564
1578
|
miter: {
|
|
1565
1579
|
doc: "A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet."
|
|
1580
|
+
},
|
|
1581
|
+
none: {
|
|
1582
|
+
doc: "Line segments are not joined together, each one creates a separate line. Useful in combination with line-pattern. Line-cap property is not respected. Can't be used with data-driven styling."
|
|
1566
1583
|
}
|
|
1567
1584
|
},
|
|
1568
1585
|
"default": "miter",
|
|
@@ -1577,6 +1594,11 @@ var layout_line = {
|
|
|
1577
1594
|
js: "0.40.0",
|
|
1578
1595
|
android: "5.2.0",
|
|
1579
1596
|
ios: "3.7.0"
|
|
1597
|
+
},
|
|
1598
|
+
"`none` value": {
|
|
1599
|
+
js: "3.4.0",
|
|
1600
|
+
android: "11.5.0",
|
|
1601
|
+
ios: "11.5.0"
|
|
1580
1602
|
}
|
|
1581
1603
|
},
|
|
1582
1604
|
expression: {
|
|
@@ -4355,8 +4377,8 @@ var expression_name = {
|
|
|
4355
4377
|
"sdk-support": {
|
|
4356
4378
|
"basic functionality": {
|
|
4357
4379
|
js: "3.3.0",
|
|
4358
|
-
android: "",
|
|
4359
|
-
ios: ""
|
|
4380
|
+
android: "11.4.0",
|
|
4381
|
+
ios: "11.4.0"
|
|
4360
4382
|
}
|
|
4361
4383
|
}
|
|
4362
4384
|
},
|
|
@@ -6601,12 +6623,11 @@ var paint_symbol = {
|
|
|
6601
6623
|
},
|
|
6602
6624
|
"icon-color-saturation": {
|
|
6603
6625
|
type: "number",
|
|
6604
|
-
"default":
|
|
6605
|
-
minimum:
|
|
6626
|
+
"default": 0,
|
|
6627
|
+
minimum: -1,
|
|
6606
6628
|
maximum: 1,
|
|
6607
|
-
transition:
|
|
6608
|
-
|
|
6609
|
-
doc: "Controls saturation level of the symbol icon. With the default value of 1 the icon color is preserved while with a value of 0 it is fully desaturated and looks black and white.",
|
|
6629
|
+
transition: false,
|
|
6630
|
+
doc: "Increase or reduce the saturation of the symbol icon.",
|
|
6610
6631
|
"sdk-support": {
|
|
6611
6632
|
"basic functionality": {
|
|
6612
6633
|
js: "3.1.0",
|
|
@@ -6618,6 +6639,63 @@ var paint_symbol = {
|
|
|
6618
6639
|
interpolated: false
|
|
6619
6640
|
},
|
|
6620
6641
|
"property-type": "data-constant"
|
|
6642
|
+
},
|
|
6643
|
+
"icon-color-contrast": {
|
|
6644
|
+
type: "number",
|
|
6645
|
+
"default": 0,
|
|
6646
|
+
minimum: -1,
|
|
6647
|
+
maximum: 1,
|
|
6648
|
+
transition: false,
|
|
6649
|
+
doc: "Increase or reduce the contrast of the symbol icon.",
|
|
6650
|
+
"sdk-support": {
|
|
6651
|
+
"basic functionality": {
|
|
6652
|
+
js: "3.5.0",
|
|
6653
|
+
android: "11.5.0",
|
|
6654
|
+
ios: "11.5.0"
|
|
6655
|
+
}
|
|
6656
|
+
},
|
|
6657
|
+
expression: {
|
|
6658
|
+
interpolated: false
|
|
6659
|
+
},
|
|
6660
|
+
"property-type": "data-constant"
|
|
6661
|
+
},
|
|
6662
|
+
"icon-color-brightness-min": {
|
|
6663
|
+
type: "number",
|
|
6664
|
+
doc: "Increase or reduce the brightness of the symbols. The value is the minimum brightness.",
|
|
6665
|
+
"default": 0,
|
|
6666
|
+
minimum: 0,
|
|
6667
|
+
maximum: 1,
|
|
6668
|
+
transition: false,
|
|
6669
|
+
"sdk-support": {
|
|
6670
|
+
"basic functionality": {
|
|
6671
|
+
js: "3.5.0",
|
|
6672
|
+
android: "11.5.0",
|
|
6673
|
+
ios: "11.5.0"
|
|
6674
|
+
}
|
|
6675
|
+
},
|
|
6676
|
+
expression: {
|
|
6677
|
+
interpolated: false
|
|
6678
|
+
},
|
|
6679
|
+
"property-type": "data-constant"
|
|
6680
|
+
},
|
|
6681
|
+
"icon-color-brightness-max": {
|
|
6682
|
+
type: "number",
|
|
6683
|
+
doc: "Increase or reduce the brightness of the symbols. The value is the maximum brightness.",
|
|
6684
|
+
"default": 1,
|
|
6685
|
+
minimum: 0,
|
|
6686
|
+
maximum: 1,
|
|
6687
|
+
transition: false,
|
|
6688
|
+
"sdk-support": {
|
|
6689
|
+
"basic functionality": {
|
|
6690
|
+
js: "3.5.0",
|
|
6691
|
+
android: "11.5.0",
|
|
6692
|
+
ios: "11.5.0"
|
|
6693
|
+
}
|
|
6694
|
+
},
|
|
6695
|
+
expression: {
|
|
6696
|
+
interpolated: false
|
|
6697
|
+
},
|
|
6698
|
+
"property-type": "data-constant"
|
|
6621
6699
|
}
|
|
6622
6700
|
};
|
|
6623
6701
|
var paint_raster = {
|
|
@@ -7830,6 +7908,43 @@ var paint_model = {
|
|
|
7830
7908
|
}
|
|
7831
7909
|
},
|
|
7832
7910
|
"property-type": "data-constant"
|
|
7911
|
+
},
|
|
7912
|
+
"model-front-cutoff": {
|
|
7913
|
+
type: "array",
|
|
7914
|
+
"private": true,
|
|
7915
|
+
value: "number",
|
|
7916
|
+
"property-type": "data-constant",
|
|
7917
|
+
transition: false,
|
|
7918
|
+
expression: {
|
|
7919
|
+
interpolated: true,
|
|
7920
|
+
parameters: [
|
|
7921
|
+
"zoom"
|
|
7922
|
+
]
|
|
7923
|
+
},
|
|
7924
|
+
length: 3,
|
|
7925
|
+
"default": [
|
|
7926
|
+
0,
|
|
7927
|
+
0,
|
|
7928
|
+
1
|
|
7929
|
+
],
|
|
7930
|
+
minimum: [
|
|
7931
|
+
0,
|
|
7932
|
+
0,
|
|
7933
|
+
0
|
|
7934
|
+
],
|
|
7935
|
+
maximum: [
|
|
7936
|
+
1,
|
|
7937
|
+
1,
|
|
7938
|
+
1
|
|
7939
|
+
],
|
|
7940
|
+
doc: "An array for configuring the fade-out effect for the front cutoff of content on pitched map views. It contains three values: start, range and final opacity. The start parameter defines the point at which the fade-out effect begins, with smaller values causing the effect to start earlier. The range parameter specifies how long the fade-out effect will last. A value of 0.0 for range makes content disappear immediately without a fade-out effect. The final opacity determines content opacity at the end of the fade-out effect. A value of 1.0 for final opacity means that the cutoff is completely disabled.",
|
|
7941
|
+
"sdk-support": {
|
|
7942
|
+
"basic functionality": {
|
|
7943
|
+
js: "3.5.0",
|
|
7944
|
+
android: "11.5.0",
|
|
7945
|
+
ios: "11.5.0"
|
|
7946
|
+
}
|
|
7947
|
+
}
|
|
7833
7948
|
}
|
|
7834
7949
|
};
|
|
7835
7950
|
var transition = {
|
|
@@ -8024,14 +8139,14 @@ var v8 = {
|
|
|
8024
8139
|
doc: "Whether this layer is displayed.",
|
|
8025
8140
|
"sdk-support": {
|
|
8026
8141
|
"basic functionality": {
|
|
8027
|
-
js: "
|
|
8028
|
-
android: "
|
|
8029
|
-
ios: "
|
|
8142
|
+
js: "3.3.0",
|
|
8143
|
+
android: "11.4.0",
|
|
8144
|
+
ios: "11.4.0"
|
|
8030
8145
|
},
|
|
8031
8146
|
"expressions support": {
|
|
8032
|
-
js: "3.
|
|
8033
|
-
android: "11.
|
|
8034
|
-
ios: "11.
|
|
8147
|
+
js: "3.3.0",
|
|
8148
|
+
android: "11.4.0",
|
|
8149
|
+
ios: "11.4.0"
|
|
8035
8150
|
}
|
|
8036
8151
|
},
|
|
8037
8152
|
expression: {
|
|
@@ -8713,12 +8828,12 @@ var v8 = {
|
|
|
8713
8828
|
"property-type": "data-constant",
|
|
8714
8829
|
transition: false,
|
|
8715
8830
|
doc: "Displayed band of raster array source layer",
|
|
8716
|
-
example: "
|
|
8831
|
+
example: "\"1713348000\"",
|
|
8717
8832
|
"sdk-support": {
|
|
8718
8833
|
"basic functionality": {
|
|
8719
|
-
js: "",
|
|
8720
|
-
android: "",
|
|
8721
|
-
ios: ""
|
|
8834
|
+
js: "3.3.0",
|
|
8835
|
+
android: "11.4.0",
|
|
8836
|
+
ios: "11.4.0"
|
|
8722
8837
|
}
|
|
8723
8838
|
}
|
|
8724
8839
|
},
|
|
@@ -8730,9 +8845,9 @@ var v8 = {
|
|
|
8730
8845
|
transition: false,
|
|
8731
8846
|
"sdk-support": {
|
|
8732
8847
|
"basic functionality": {
|
|
8733
|
-
js: "",
|
|
8734
|
-
android: "",
|
|
8735
|
-
ios: ""
|
|
8848
|
+
js: "3.3.0",
|
|
8849
|
+
android: "11.4.0",
|
|
8850
|
+
ios: "11.4.0"
|
|
8736
8851
|
}
|
|
8737
8852
|
},
|
|
8738
8853
|
"property-type": "data-constant"
|
|
@@ -8743,9 +8858,9 @@ var v8 = {
|
|
|
8743
8858
|
transition: false,
|
|
8744
8859
|
"sdk-support": {
|
|
8745
8860
|
"basic functionality": {
|
|
8746
|
-
js: "",
|
|
8747
|
-
android: "",
|
|
8748
|
-
ios: ""
|
|
8861
|
+
js: "3.3.0",
|
|
8862
|
+
android: "11.4.0",
|
|
8863
|
+
ios: "11.4.0"
|
|
8749
8864
|
},
|
|
8750
8865
|
"data-driven styling": {
|
|
8751
8866
|
}
|
|
@@ -8766,9 +8881,9 @@ var v8 = {
|
|
|
8766
8881
|
transition: false,
|
|
8767
8882
|
"sdk-support": {
|
|
8768
8883
|
"basic functionality": {
|
|
8769
|
-
js: "",
|
|
8770
|
-
android: "",
|
|
8771
|
-
ios: ""
|
|
8884
|
+
js: "3.3.0",
|
|
8885
|
+
android: "11.4.0",
|
|
8886
|
+
ios: "11.4.0"
|
|
8772
8887
|
}
|
|
8773
8888
|
},
|
|
8774
8889
|
"property-type": "data-constant"
|
|
@@ -8782,9 +8897,9 @@ var v8 = {
|
|
|
8782
8897
|
transition: true,
|
|
8783
8898
|
"sdk-support": {
|
|
8784
8899
|
"basic functionality": {
|
|
8785
|
-
js: "",
|
|
8786
|
-
android: "",
|
|
8787
|
-
ios: ""
|
|
8900
|
+
js: "3.3.0",
|
|
8901
|
+
android: "11.4.0",
|
|
8902
|
+
ios: "11.4.0"
|
|
8788
8903
|
}
|
|
8789
8904
|
},
|
|
8790
8905
|
expression: {
|
|
@@ -8804,9 +8919,9 @@ var v8 = {
|
|
|
8804
8919
|
transition: true,
|
|
8805
8920
|
"sdk-support": {
|
|
8806
8921
|
"basic functionality": {
|
|
8807
|
-
js: "",
|
|
8808
|
-
android: "",
|
|
8809
|
-
ios: ""
|
|
8922
|
+
js: "3.3.0",
|
|
8923
|
+
android: "11.4.0",
|
|
8924
|
+
ios: "11.4.0"
|
|
8810
8925
|
}
|
|
8811
8926
|
},
|
|
8812
8927
|
expression: {
|
|
@@ -8826,9 +8941,9 @@ var v8 = {
|
|
|
8826
8941
|
transition: false,
|
|
8827
8942
|
"sdk-support": {
|
|
8828
8943
|
"basic functionality": {
|
|
8829
|
-
js: "",
|
|
8830
|
-
android: "",
|
|
8831
|
-
ios: ""
|
|
8944
|
+
js: "3.3.0",
|
|
8945
|
+
android: "11.4.0",
|
|
8946
|
+
ios: "11.4.0"
|
|
8832
8947
|
}
|
|
8833
8948
|
},
|
|
8834
8949
|
"property-type": "data-constant"
|
|
@@ -9225,7 +9340,6 @@ let ParsingError$1 = class ParsingError extends Error {
|
|
|
9225
9340
|
this.key = key;
|
|
9226
9341
|
}
|
|
9227
9342
|
};
|
|
9228
|
-
var ParsingError$2 = ParsingError$1;
|
|
9229
9343
|
|
|
9230
9344
|
//
|
|
9231
9345
|
/**
|
|
@@ -9258,7 +9372,6 @@ class Scope {
|
|
|
9258
9372
|
return this.parent ? this.parent.has(name) : false;
|
|
9259
9373
|
}
|
|
9260
9374
|
}
|
|
9261
|
-
var Scope$1 = Scope;
|
|
9262
9375
|
|
|
9263
9376
|
//
|
|
9264
9377
|
const NullType = { kind: 'null' };
|
|
@@ -10859,7 +10972,6 @@ class Literal {
|
|
|
10859
10972
|
}
|
|
10860
10973
|
}
|
|
10861
10974
|
}
|
|
10862
|
-
var Literal$1 = Literal;
|
|
10863
10975
|
|
|
10864
10976
|
//
|
|
10865
10977
|
class RuntimeError {
|
|
@@ -10871,7 +10983,6 @@ class RuntimeError {
|
|
|
10871
10983
|
return this.message;
|
|
10872
10984
|
}
|
|
10873
10985
|
}
|
|
10874
|
-
var RuntimeError$1 = RuntimeError;
|
|
10875
10986
|
|
|
10876
10987
|
const types$1 = {
|
|
10877
10988
|
string: StringType,
|
|
@@ -10929,7 +11040,7 @@ class Assertion {
|
|
|
10929
11040
|
if (!error) {
|
|
10930
11041
|
return value;
|
|
10931
11042
|
} else if (i === this.args.length - 1) {
|
|
10932
|
-
throw new RuntimeError
|
|
11043
|
+
throw new RuntimeError(`Expected value to be of type ${ toString$1(this.type) }, but found ${ toString$1(typeOf(value)) } instead.`);
|
|
10933
11044
|
}
|
|
10934
11045
|
}
|
|
10935
11046
|
return null;
|
|
@@ -10956,7 +11067,6 @@ class Assertion {
|
|
|
10956
11067
|
return serialized.concat(this.args.map(arg => arg.serialize()));
|
|
10957
11068
|
}
|
|
10958
11069
|
}
|
|
10959
|
-
var Assertion$1 = Assertion;
|
|
10960
11070
|
|
|
10961
11071
|
//
|
|
10962
11072
|
class FormatExpression {
|
|
@@ -11243,7 +11353,7 @@ class Coercion {
|
|
|
11243
11353
|
}
|
|
11244
11354
|
}
|
|
11245
11355
|
}
|
|
11246
|
-
throw new RuntimeError
|
|
11356
|
+
throw new RuntimeError(error || `Could not parse color from value '${ typeof input === 'string' ? input : String(JSON.stringify(input)) }'`);
|
|
11247
11357
|
} else if (this.type.kind === 'number') {
|
|
11248
11358
|
let value = null;
|
|
11249
11359
|
for (const arg of this.args) {
|
|
@@ -11255,7 +11365,7 @@ class Coercion {
|
|
|
11255
11365
|
continue;
|
|
11256
11366
|
return num;
|
|
11257
11367
|
}
|
|
11258
|
-
throw new RuntimeError
|
|
11368
|
+
throw new RuntimeError(`Could not convert ${ JSON.stringify(value) } to number.`);
|
|
11259
11369
|
} else if (this.type.kind === 'formatted') {
|
|
11260
11370
|
// There is no explicit 'to-formatted' but this coercion can be implicitly
|
|
11261
11371
|
// created by properties that expect the 'formatted' type.
|
|
@@ -11295,7 +11405,6 @@ class Coercion {
|
|
|
11295
11405
|
return serialized;
|
|
11296
11406
|
}
|
|
11297
11407
|
}
|
|
11298
|
-
var Coercion$1 = Coercion;
|
|
11299
11408
|
|
|
11300
11409
|
//
|
|
11301
11410
|
const geometryTypes = [
|
|
@@ -11364,7 +11473,6 @@ class EvaluationContext {
|
|
|
11364
11473
|
return this.options ? this.options.get(id) : null;
|
|
11365
11474
|
}
|
|
11366
11475
|
}
|
|
11367
|
-
var EvaluationContext$1 = EvaluationContext;
|
|
11368
11476
|
|
|
11369
11477
|
//
|
|
11370
11478
|
class CompoundExpression {
|
|
@@ -11415,7 +11523,7 @@ class CompoundExpression {
|
|
|
11415
11523
|
overloadIndex++;
|
|
11416
11524
|
// Use a fresh context for each attempted signature so that, if
|
|
11417
11525
|
// we eventually succeed, we haven't polluted `context.errors`.
|
|
11418
|
-
signatureContext = new ParsingContext
|
|
11526
|
+
signatureContext = new ParsingContext(context.registry, context.path, null, context.scope, undefined, context._scope, context.options);
|
|
11419
11527
|
// First parse all the args, potentially coercing to the
|
|
11420
11528
|
// types expected by this overload.
|
|
11421
11529
|
const parsedArgs = [];
|
|
@@ -11483,7 +11591,6 @@ function stringifySignature(signature) {
|
|
|
11483
11591
|
return `(${ toString$1(signature.type) }...)`;
|
|
11484
11592
|
}
|
|
11485
11593
|
}
|
|
11486
|
-
var CompoundExpression$1 = CompoundExpression;
|
|
11487
11594
|
|
|
11488
11595
|
//
|
|
11489
11596
|
class CollatorExpression {
|
|
@@ -11544,57 +11651,6 @@ class CollatorExpression {
|
|
|
11544
11651
|
}
|
|
11545
11652
|
}
|
|
11546
11653
|
|
|
11547
|
-
function quickselect(arr, k, left, right, compare) {
|
|
11548
|
-
quickselectStep(arr, k, left || 0, right || arr.length - 1, compare || defaultCompare$1);
|
|
11549
|
-
}
|
|
11550
|
-
function quickselectStep(arr, k, left, right, compare) {
|
|
11551
|
-
while (right > left) {
|
|
11552
|
-
if (right - left > 600) {
|
|
11553
|
-
var n = right - left + 1;
|
|
11554
|
-
var m = k - left + 1;
|
|
11555
|
-
var z = Math.log(n);
|
|
11556
|
-
var s = 0.5 * Math.exp(2 * z / 3);
|
|
11557
|
-
var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
|
|
11558
|
-
var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
|
|
11559
|
-
var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
|
|
11560
|
-
quickselectStep(arr, k, newLeft, newRight, compare);
|
|
11561
|
-
}
|
|
11562
|
-
var t = arr[k];
|
|
11563
|
-
var i = left;
|
|
11564
|
-
var j = right;
|
|
11565
|
-
swap(arr, left, k);
|
|
11566
|
-
if (compare(arr[right], t) > 0)
|
|
11567
|
-
swap(arr, left, right);
|
|
11568
|
-
while (i < j) {
|
|
11569
|
-
swap(arr, i, j);
|
|
11570
|
-
i++;
|
|
11571
|
-
j--;
|
|
11572
|
-
while (compare(arr[i], t) < 0)
|
|
11573
|
-
i++;
|
|
11574
|
-
while (compare(arr[j], t) > 0)
|
|
11575
|
-
j--;
|
|
11576
|
-
}
|
|
11577
|
-
if (compare(arr[left], t) === 0)
|
|
11578
|
-
swap(arr, left, j);
|
|
11579
|
-
else {
|
|
11580
|
-
j++;
|
|
11581
|
-
swap(arr, j, right);
|
|
11582
|
-
}
|
|
11583
|
-
if (j <= k)
|
|
11584
|
-
left = j + 1;
|
|
11585
|
-
if (k <= j)
|
|
11586
|
-
right = j - 1;
|
|
11587
|
-
}
|
|
11588
|
-
}
|
|
11589
|
-
function swap(arr, i, j) {
|
|
11590
|
-
var tmp = arr[i];
|
|
11591
|
-
arr[i] = arr[j];
|
|
11592
|
-
arr[j] = tmp;
|
|
11593
|
-
}
|
|
11594
|
-
function defaultCompare$1(a, b) {
|
|
11595
|
-
return a < b ? -1 : a > b ? 1 : 0;
|
|
11596
|
-
}
|
|
11597
|
-
|
|
11598
11654
|
//
|
|
11599
11655
|
// minX, minY, maxX, maxY
|
|
11600
11656
|
/**
|
|
@@ -11611,9 +11667,6 @@ function calculateSignedArea(ring) {
|
|
|
11611
11667
|
}
|
|
11612
11668
|
return sum;
|
|
11613
11669
|
}
|
|
11614
|
-
function compareAreas(a, b) {
|
|
11615
|
-
return b.area - a.area;
|
|
11616
|
-
}
|
|
11617
11670
|
// classifies an array of rings into polygons with outer rings and holes
|
|
11618
11671
|
function classifyRings(rings, maxRings) {
|
|
11619
11672
|
const len = rings.length;
|
|
@@ -11638,16 +11691,6 @@ function classifyRings(rings, maxRings) {
|
|
|
11638
11691
|
}
|
|
11639
11692
|
if (polygon)
|
|
11640
11693
|
polygons.push(polygon);
|
|
11641
|
-
// Earcut performance degrades with the # of rings in a polygon. For this
|
|
11642
|
-
// reason, we limit strip out all but the `maxRings` largest rings.
|
|
11643
|
-
if (maxRings > 1) {
|
|
11644
|
-
for (let j = 0; j < polygons.length; j++) {
|
|
11645
|
-
if (polygons[j].length <= maxRings)
|
|
11646
|
-
continue;
|
|
11647
|
-
quickselect(polygons[j], maxRings, 1, polygons[j].length - 1, compareAreas);
|
|
11648
|
-
polygons[j] = polygons[j].slice(0, maxRings);
|
|
11649
|
-
}
|
|
11650
|
-
}
|
|
11651
11694
|
return polygons;
|
|
11652
11695
|
}
|
|
11653
11696
|
function updateBBox(bbox, coord) {
|
|
@@ -12010,7 +12053,6 @@ class Within {
|
|
|
12010
12053
|
];
|
|
12011
12054
|
}
|
|
12012
12055
|
}
|
|
12013
|
-
var Within$1 = Within;
|
|
12014
12056
|
|
|
12015
12057
|
/* */
|
|
12016
12058
|
const factors = {
|
|
@@ -13340,7 +13382,7 @@ function linesToGeometryDistance(originGeometry, canonical, geometry) {
|
|
|
13340
13382
|
}
|
|
13341
13383
|
function polygonsToGeometryDistance(originGeometry, canonical, geometry) {
|
|
13342
13384
|
const lngLatPolygons = [];
|
|
13343
|
-
for (const polygon of classifyRings(originGeometry
|
|
13385
|
+
for (const polygon of classifyRings(originGeometry)) {
|
|
13344
13386
|
const lngLatPolygon = [];
|
|
13345
13387
|
for (let i = 0; i < polygon.length; ++i) {
|
|
13346
13388
|
lngLatPolygon.push(getLngLatPoints(polygon[i], canonical));
|
|
@@ -13429,7 +13471,6 @@ class Distance {
|
|
|
13429
13471
|
];
|
|
13430
13472
|
}
|
|
13431
13473
|
}
|
|
13432
|
-
var Distance$1 = Distance;
|
|
13433
13474
|
|
|
13434
13475
|
//
|
|
13435
13476
|
function coerceValue(type, value) {
|
|
@@ -13478,12 +13519,12 @@ class Config {
|
|
|
13478
13519
|
return context.error(`Invalid number of arguments for 'config' expression.`);
|
|
13479
13520
|
}
|
|
13480
13521
|
const configKey = context.parse(args[1], 1);
|
|
13481
|
-
if (!(configKey instanceof Literal
|
|
13522
|
+
if (!(configKey instanceof Literal)) {
|
|
13482
13523
|
return context.error(`Key name of 'config' expression must be a string literal.`);
|
|
13483
13524
|
}
|
|
13484
13525
|
if (args.length >= 3) {
|
|
13485
13526
|
const configScope = context.parse(args[2], 2);
|
|
13486
|
-
if (!(configScope instanceof Literal
|
|
13527
|
+
if (!(configScope instanceof Literal)) {
|
|
13487
13528
|
return context.error(`Scope of 'config' expression must be a string literal.`);
|
|
13488
13529
|
}
|
|
13489
13530
|
return new Config(type, toString(configKey.value), toString(configScope.value));
|
|
@@ -13548,11 +13589,10 @@ class Config {
|
|
|
13548
13589
|
return res;
|
|
13549
13590
|
}
|
|
13550
13591
|
}
|
|
13551
|
-
var Config$1 = Config;
|
|
13552
13592
|
|
|
13553
13593
|
//
|
|
13554
13594
|
function isFeatureConstant(e) {
|
|
13555
|
-
if (e instanceof CompoundExpression
|
|
13595
|
+
if (e instanceof CompoundExpression) {
|
|
13556
13596
|
if (e.name === 'get' && e.args.length === 1) {
|
|
13557
13597
|
return false;
|
|
13558
13598
|
} else if (e.name === 'feature-state') {
|
|
@@ -13565,10 +13605,10 @@ function isFeatureConstant(e) {
|
|
|
13565
13605
|
return false;
|
|
13566
13606
|
}
|
|
13567
13607
|
}
|
|
13568
|
-
if (e instanceof Within
|
|
13608
|
+
if (e instanceof Within) {
|
|
13569
13609
|
return false;
|
|
13570
13610
|
}
|
|
13571
|
-
if (e instanceof Distance
|
|
13611
|
+
if (e instanceof Distance) {
|
|
13572
13612
|
return false;
|
|
13573
13613
|
}
|
|
13574
13614
|
let result = true;
|
|
@@ -13580,7 +13620,7 @@ function isFeatureConstant(e) {
|
|
|
13580
13620
|
return result;
|
|
13581
13621
|
}
|
|
13582
13622
|
function isStateConstant(e) {
|
|
13583
|
-
if (e instanceof CompoundExpression
|
|
13623
|
+
if (e instanceof CompoundExpression) {
|
|
13584
13624
|
if (e.name === 'feature-state') {
|
|
13585
13625
|
return false;
|
|
13586
13626
|
}
|
|
@@ -13594,7 +13634,7 @@ function isStateConstant(e) {
|
|
|
13594
13634
|
return result;
|
|
13595
13635
|
}
|
|
13596
13636
|
function isConfigConstant(e) {
|
|
13597
|
-
if (e instanceof Config
|
|
13637
|
+
if (e instanceof Config) {
|
|
13598
13638
|
return false;
|
|
13599
13639
|
}
|
|
13600
13640
|
let result = true;
|
|
@@ -13606,7 +13646,7 @@ function isConfigConstant(e) {
|
|
|
13606
13646
|
return result;
|
|
13607
13647
|
}
|
|
13608
13648
|
function isGlobalPropertyConstant(e, properties) {
|
|
13609
|
-
if (e instanceof CompoundExpression
|
|
13649
|
+
if (e instanceof CompoundExpression && properties.indexOf(e.name) >= 0) {
|
|
13610
13650
|
return false;
|
|
13611
13651
|
}
|
|
13612
13652
|
let result = true;
|
|
@@ -13649,7 +13689,6 @@ class Var {
|
|
|
13649
13689
|
];
|
|
13650
13690
|
}
|
|
13651
13691
|
}
|
|
13652
|
-
var Var$1 = Var;
|
|
13653
13692
|
|
|
13654
13693
|
//
|
|
13655
13694
|
/**
|
|
@@ -13661,7 +13700,7 @@ class ParsingContext {
|
|
|
13661
13700
|
// implementations to infer argument types: Expression#parse() need not
|
|
13662
13701
|
// check that the output type of the parsed expression matches
|
|
13663
13702
|
// `expectedType`.
|
|
13664
|
-
constructor(registry, path = [], expectedType, scope = new Scope
|
|
13703
|
+
constructor(registry, path = [], expectedType, scope = new Scope(), errors = [], _scope, options) {
|
|
13665
13704
|
this.registry = registry;
|
|
13666
13705
|
this.path = path;
|
|
13667
13706
|
this.key = path.map(part => `[${ part }]`).join('');
|
|
@@ -13693,9 +13732,9 @@ class ParsingContext {
|
|
|
13693
13732
|
}
|
|
13694
13733
|
function annotate(parsed, type, typeAnnotation) {
|
|
13695
13734
|
if (typeAnnotation === 'assert') {
|
|
13696
|
-
return new Assertion
|
|
13735
|
+
return new Assertion(type, [parsed]);
|
|
13697
13736
|
} else if (typeAnnotation === 'coerce') {
|
|
13698
|
-
return new Coercion
|
|
13737
|
+
return new Coercion(type, [parsed]);
|
|
13699
13738
|
} else {
|
|
13700
13739
|
return parsed;
|
|
13701
13740
|
}
|
|
@@ -13732,10 +13771,10 @@ class ParsingContext {
|
|
|
13732
13771
|
// it immediately and replace it with a literal value in the
|
|
13733
13772
|
// parsed/compiled result. Expressions that expect an image should
|
|
13734
13773
|
// not be resolved here so we can later get the available images.
|
|
13735
|
-
if (!(parsed instanceof Literal
|
|
13736
|
-
const ec = new EvaluationContext
|
|
13774
|
+
if (!(parsed instanceof Literal) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
|
|
13775
|
+
const ec = new EvaluationContext(this._scope, this.options);
|
|
13737
13776
|
try {
|
|
13738
|
-
parsed = new Literal
|
|
13777
|
+
parsed = new Literal(parsed.type, parsed.evaluate(ec));
|
|
13739
13778
|
} catch (e) {
|
|
13740
13779
|
this.error(e.message);
|
|
13741
13780
|
return null;
|
|
@@ -13744,7 +13783,7 @@ class ParsingContext {
|
|
|
13744
13783
|
return parsed;
|
|
13745
13784
|
}
|
|
13746
13785
|
// Try to parse as array
|
|
13747
|
-
return Coercion
|
|
13786
|
+
return Coercion.parse([
|
|
13748
13787
|
'to-array',
|
|
13749
13788
|
expr
|
|
13750
13789
|
], this);
|
|
@@ -13778,7 +13817,7 @@ class ParsingContext {
|
|
|
13778
13817
|
*/
|
|
13779
13818
|
error(error, ...keys) {
|
|
13780
13819
|
const key = `${ this.key }${ keys.map(k => `[${ k }]`).join('') }`;
|
|
13781
|
-
this.errors.push(new ParsingError$
|
|
13820
|
+
this.errors.push(new ParsingError$1(key, error));
|
|
13782
13821
|
}
|
|
13783
13822
|
/**
|
|
13784
13823
|
* Returns null if `t` is a subtype of `expected`; otherwise returns an
|
|
@@ -13791,25 +13830,24 @@ class ParsingContext {
|
|
|
13791
13830
|
return error;
|
|
13792
13831
|
}
|
|
13793
13832
|
}
|
|
13794
|
-
var ParsingContext$1 = ParsingContext;
|
|
13795
13833
|
function isConstant(expression) {
|
|
13796
|
-
if (expression instanceof Var
|
|
13834
|
+
if (expression instanceof Var) {
|
|
13797
13835
|
return isConstant(expression.boundExpression);
|
|
13798
|
-
} else if (expression instanceof CompoundExpression
|
|
13836
|
+
} else if (expression instanceof CompoundExpression && expression.name === 'error') {
|
|
13799
13837
|
return false;
|
|
13800
13838
|
} else if (expression instanceof CollatorExpression) {
|
|
13801
13839
|
// Although the results of a Collator expression with fixed arguments
|
|
13802
13840
|
// generally shouldn't change between executions, we can't serialize them
|
|
13803
13841
|
// as constant expressions because results change based on environment.
|
|
13804
13842
|
return false;
|
|
13805
|
-
} else if (expression instanceof Within
|
|
13843
|
+
} else if (expression instanceof Within) {
|
|
13806
13844
|
return false;
|
|
13807
|
-
} else if (expression instanceof Distance
|
|
13845
|
+
} else if (expression instanceof Distance) {
|
|
13808
13846
|
return false;
|
|
13809
|
-
} else if (expression instanceof Config
|
|
13847
|
+
} else if (expression instanceof Config) {
|
|
13810
13848
|
return false;
|
|
13811
13849
|
}
|
|
13812
|
-
const isTypeAnnotation = expression instanceof Coercion
|
|
13850
|
+
const isTypeAnnotation = expression instanceof Coercion || expression instanceof Assertion;
|
|
13813
13851
|
let childrenConstant = true;
|
|
13814
13852
|
expression.eachChild(child => {
|
|
13815
13853
|
// We can _almost_ assume that if `expressions` children are constant,
|
|
@@ -13821,7 +13859,7 @@ function isConstant(expression) {
|
|
|
13821
13859
|
if (isTypeAnnotation) {
|
|
13822
13860
|
childrenConstant = childrenConstant && isConstant(child);
|
|
13823
13861
|
} else {
|
|
13824
|
-
childrenConstant = childrenConstant && child instanceof Literal
|
|
13862
|
+
childrenConstant = childrenConstant && child instanceof Literal;
|
|
13825
13863
|
}
|
|
13826
13864
|
});
|
|
13827
13865
|
if (!childrenConstant) {
|
|
@@ -13866,7 +13904,7 @@ function findStopLessThanOrEqualTo(stops, input) {
|
|
|
13866
13904
|
} else if (currentValue > input) {
|
|
13867
13905
|
upperIndex = currentIndex - 1;
|
|
13868
13906
|
} else {
|
|
13869
|
-
throw new RuntimeError
|
|
13907
|
+
throw new RuntimeError('Input is not a number.');
|
|
13870
13908
|
}
|
|
13871
13909
|
}
|
|
13872
13910
|
return 0;
|
|
@@ -13961,7 +13999,6 @@ class Step {
|
|
|
13961
13999
|
return serialized;
|
|
13962
14000
|
}
|
|
13963
14001
|
}
|
|
13964
|
-
var Step$1 = Step;
|
|
13965
14002
|
|
|
13966
14003
|
var unitbezier = UnitBezier;
|
|
13967
14004
|
function UnitBezier(p1x, p1y, p2x, p2y) {
|
|
@@ -14349,7 +14386,6 @@ function exponentialInterpolation(input, base, lowerValue, upperValue) {
|
|
|
14349
14386
|
return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);
|
|
14350
14387
|
}
|
|
14351
14388
|
}
|
|
14352
|
-
var Interpolate$1 = Interpolate;
|
|
14353
14389
|
|
|
14354
14390
|
class Coalesce {
|
|
14355
14391
|
constructor(type, args) {
|
|
@@ -14420,7 +14456,6 @@ class Coalesce {
|
|
|
14420
14456
|
return serialized;
|
|
14421
14457
|
}
|
|
14422
14458
|
}
|
|
14423
|
-
var Coalesce$1 = Coalesce;
|
|
14424
14459
|
|
|
14425
14460
|
//
|
|
14426
14461
|
class Let {
|
|
@@ -14475,7 +14510,6 @@ class Let {
|
|
|
14475
14510
|
return serialized;
|
|
14476
14511
|
}
|
|
14477
14512
|
}
|
|
14478
|
-
var Let$1 = Let;
|
|
14479
14513
|
|
|
14480
14514
|
//
|
|
14481
14515
|
class At {
|
|
@@ -14498,13 +14532,13 @@ class At {
|
|
|
14498
14532
|
const index = this.index.evaluate(ctx);
|
|
14499
14533
|
const array = this.input.evaluate(ctx);
|
|
14500
14534
|
if (index < 0) {
|
|
14501
|
-
throw new RuntimeError
|
|
14535
|
+
throw new RuntimeError(`Array index out of bounds: ${ index } < 0.`);
|
|
14502
14536
|
}
|
|
14503
14537
|
if (index >= array.length) {
|
|
14504
|
-
throw new RuntimeError
|
|
14538
|
+
throw new RuntimeError(`Array index out of bounds: ${ index } > ${ array.length - 1 }.`);
|
|
14505
14539
|
}
|
|
14506
14540
|
if (index !== Math.floor(index)) {
|
|
14507
|
-
throw new RuntimeError
|
|
14541
|
+
throw new RuntimeError(`Array index must be an integer, but found ${ index } instead.`);
|
|
14508
14542
|
}
|
|
14509
14543
|
return array[index];
|
|
14510
14544
|
}
|
|
@@ -14523,7 +14557,6 @@ class At {
|
|
|
14523
14557
|
];
|
|
14524
14558
|
}
|
|
14525
14559
|
}
|
|
14526
|
-
var At$1 = At;
|
|
14527
14560
|
|
|
14528
14561
|
//
|
|
14529
14562
|
class In {
|
|
@@ -14562,13 +14595,13 @@ class In {
|
|
|
14562
14595
|
'number',
|
|
14563
14596
|
'null'
|
|
14564
14597
|
])) {
|
|
14565
|
-
throw new RuntimeError
|
|
14598
|
+
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
14566
14599
|
}
|
|
14567
14600
|
if (!isValidNativeType(haystack, [
|
|
14568
14601
|
'string',
|
|
14569
14602
|
'array'
|
|
14570
14603
|
])) {
|
|
14571
|
-
throw new RuntimeError
|
|
14604
|
+
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
14572
14605
|
}
|
|
14573
14606
|
return haystack.indexOf(needle) >= 0;
|
|
14574
14607
|
}
|
|
@@ -14587,7 +14620,6 @@ class In {
|
|
|
14587
14620
|
];
|
|
14588
14621
|
}
|
|
14589
14622
|
}
|
|
14590
|
-
var In$1 = In;
|
|
14591
14623
|
|
|
14592
14624
|
//
|
|
14593
14625
|
class IndexOf {
|
|
@@ -14632,13 +14664,13 @@ class IndexOf {
|
|
|
14632
14664
|
'number',
|
|
14633
14665
|
'null'
|
|
14634
14666
|
])) {
|
|
14635
|
-
throw new RuntimeError
|
|
14667
|
+
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
14636
14668
|
}
|
|
14637
14669
|
if (!isValidNativeType(haystack, [
|
|
14638
14670
|
'string',
|
|
14639
14671
|
'array'
|
|
14640
14672
|
])) {
|
|
14641
|
-
throw new RuntimeError
|
|
14673
|
+
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
14642
14674
|
}
|
|
14643
14675
|
if (this.fromIndex) {
|
|
14644
14676
|
const fromIndex = this.fromIndex.evaluate(ctx);
|
|
@@ -14673,7 +14705,6 @@ class IndexOf {
|
|
|
14673
14705
|
];
|
|
14674
14706
|
}
|
|
14675
14707
|
}
|
|
14676
|
-
var IndexOf$1 = IndexOf;
|
|
14677
14708
|
|
|
14678
14709
|
// Map input label values to output expression index
|
|
14679
14710
|
class Match {
|
|
@@ -14796,7 +14827,6 @@ class Match {
|
|
|
14796
14827
|
return serialized;
|
|
14797
14828
|
}
|
|
14798
14829
|
}
|
|
14799
|
-
var Match$1 = Match;
|
|
14800
14830
|
|
|
14801
14831
|
class Case {
|
|
14802
14832
|
constructor(type, branches, otherwise) {
|
|
@@ -14858,7 +14888,6 @@ class Case {
|
|
|
14858
14888
|
return serialized;
|
|
14859
14889
|
}
|
|
14860
14890
|
}
|
|
14861
|
-
var Case$1 = Case;
|
|
14862
14891
|
|
|
14863
14892
|
//
|
|
14864
14893
|
class Slice {
|
|
@@ -14899,7 +14928,7 @@ class Slice {
|
|
|
14899
14928
|
'string',
|
|
14900
14929
|
'array'
|
|
14901
14930
|
])) {
|
|
14902
|
-
throw new RuntimeError
|
|
14931
|
+
throw new RuntimeError(`Expected first argument to be of type array or string, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
14903
14932
|
}
|
|
14904
14933
|
if (this.endIndex) {
|
|
14905
14934
|
const endIndex = this.endIndex.evaluate(ctx);
|
|
@@ -14934,7 +14963,6 @@ class Slice {
|
|
|
14934
14963
|
];
|
|
14935
14964
|
}
|
|
14936
14965
|
}
|
|
14937
|
-
var Slice$1 = Slice;
|
|
14938
14966
|
|
|
14939
14967
|
//
|
|
14940
14968
|
function isComparableType(op, type) {
|
|
@@ -15034,10 +15062,10 @@ function makeComparison(op, compareBasic, compareWithCollator) {
|
|
|
15034
15062
|
// typing rules specific to less/greater than operators
|
|
15035
15063
|
if (lhs.type.kind === 'value' && rhs.type.kind !== 'value') {
|
|
15036
15064
|
// (value, T)
|
|
15037
|
-
lhs = new Assertion
|
|
15065
|
+
lhs = new Assertion(rhs.type, [lhs]);
|
|
15038
15066
|
} else if (lhs.type.kind !== 'value' && rhs.type.kind === 'value') {
|
|
15039
15067
|
// (T, value)
|
|
15040
|
-
rhs = new Assertion
|
|
15068
|
+
rhs = new Assertion(lhs.type, [rhs]);
|
|
15041
15069
|
}
|
|
15042
15070
|
}
|
|
15043
15071
|
let collator = null;
|
|
@@ -15059,7 +15087,7 @@ function makeComparison(op, compareBasic, compareWithCollator) {
|
|
|
15059
15087
|
const rt = typeOf(rhs);
|
|
15060
15088
|
// check that type is string or number, and equal
|
|
15061
15089
|
if (lt.kind !== rt.kind || !(lt.kind === 'string' || lt.kind === 'number')) {
|
|
15062
|
-
throw new RuntimeError
|
|
15090
|
+
throw new RuntimeError(`Expected arguments for "${ op }" to be (string, string) or (number, number), but found (${ lt.kind }, ${ rt.kind }) instead.`);
|
|
15063
15091
|
}
|
|
15064
15092
|
}
|
|
15065
15093
|
if (this.collator && !isOrderComparison && this.hasUntypedArgument) {
|
|
@@ -15232,7 +15260,7 @@ class Length {
|
|
|
15232
15260
|
} else if (Array.isArray(input)) {
|
|
15233
15261
|
return input.length;
|
|
15234
15262
|
} else {
|
|
15235
|
-
throw new RuntimeError
|
|
15263
|
+
throw new RuntimeError(`Expected value to be of type string or array, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
15236
15264
|
}
|
|
15237
15265
|
}
|
|
15238
15266
|
eachChild(fn) {
|
|
@@ -15249,7 +15277,6 @@ class Length {
|
|
|
15249
15277
|
return serialized;
|
|
15250
15278
|
}
|
|
15251
15279
|
}
|
|
15252
|
-
var Length$1 = Length;
|
|
15253
15280
|
|
|
15254
15281
|
//
|
|
15255
15282
|
// Seeded pseudo random generator function
|
|
@@ -15273,14 +15300,14 @@ const expressions = {
|
|
|
15273
15300
|
'>=': GreaterThanOrEqual,
|
|
15274
15301
|
'<=': LessThanOrEqual,
|
|
15275
15302
|
// $FlowFixMe[method-unbinding]
|
|
15276
|
-
'array': Assertion
|
|
15303
|
+
'array': Assertion,
|
|
15277
15304
|
// $FlowFixMe[method-unbinding]
|
|
15278
|
-
'at': At
|
|
15279
|
-
'boolean': Assertion
|
|
15305
|
+
'at': At,
|
|
15306
|
+
'boolean': Assertion,
|
|
15280
15307
|
// $FlowFixMe[method-unbinding]
|
|
15281
|
-
'case': Case
|
|
15308
|
+
'case': Case,
|
|
15282
15309
|
// $FlowFixMe[method-unbinding]
|
|
15283
|
-
'coalesce': Coalesce
|
|
15310
|
+
'coalesce': Coalesce,
|
|
15284
15311
|
// $FlowFixMe[method-unbinding]
|
|
15285
15312
|
'collator': CollatorExpression,
|
|
15286
15313
|
// $FlowFixMe[method-unbinding]
|
|
@@ -15288,43 +15315,43 @@ const expressions = {
|
|
|
15288
15315
|
// $FlowFixMe[method-unbinding]
|
|
15289
15316
|
'image': ImageExpression,
|
|
15290
15317
|
// $FlowFixMe[method-unbinding]
|
|
15291
|
-
'in': In
|
|
15318
|
+
'in': In,
|
|
15292
15319
|
// $FlowFixMe[method-unbinding]
|
|
15293
|
-
'index-of': IndexOf
|
|
15320
|
+
'index-of': IndexOf,
|
|
15294
15321
|
// $FlowFixMe[method-unbinding]
|
|
15295
|
-
'interpolate': Interpolate
|
|
15296
|
-
'interpolate-hcl': Interpolate
|
|
15297
|
-
'interpolate-lab': Interpolate
|
|
15322
|
+
'interpolate': Interpolate,
|
|
15323
|
+
'interpolate-hcl': Interpolate,
|
|
15324
|
+
'interpolate-lab': Interpolate,
|
|
15298
15325
|
// $FlowFixMe[method-unbinding]
|
|
15299
|
-
'length': Length
|
|
15326
|
+
'length': Length,
|
|
15300
15327
|
// $FlowFixMe[method-unbinding]
|
|
15301
|
-
'let': Let
|
|
15328
|
+
'let': Let,
|
|
15302
15329
|
// $FlowFixMe[method-unbinding]
|
|
15303
|
-
'literal': Literal
|
|
15330
|
+
'literal': Literal,
|
|
15304
15331
|
// $FlowFixMe[method-unbinding]
|
|
15305
|
-
'match': Match
|
|
15306
|
-
'number': Assertion
|
|
15332
|
+
'match': Match,
|
|
15333
|
+
'number': Assertion,
|
|
15307
15334
|
// $FlowFixMe[method-unbinding]
|
|
15308
15335
|
'number-format': NumberFormat,
|
|
15309
|
-
'object': Assertion
|
|
15336
|
+
'object': Assertion,
|
|
15310
15337
|
// $FlowFixMe[method-unbinding]
|
|
15311
|
-
'slice': Slice
|
|
15338
|
+
'slice': Slice,
|
|
15312
15339
|
// $FlowFixMe[method-unbinding]
|
|
15313
|
-
'step': Step
|
|
15314
|
-
'string': Assertion
|
|
15340
|
+
'step': Step,
|
|
15341
|
+
'string': Assertion,
|
|
15315
15342
|
// $FlowFixMe[method-unbinding]
|
|
15316
|
-
'to-boolean': Coercion
|
|
15317
|
-
'to-color': Coercion
|
|
15318
|
-
'to-number': Coercion
|
|
15319
|
-
'to-string': Coercion
|
|
15343
|
+
'to-boolean': Coercion,
|
|
15344
|
+
'to-color': Coercion,
|
|
15345
|
+
'to-number': Coercion,
|
|
15346
|
+
'to-string': Coercion,
|
|
15320
15347
|
// $FlowFixMe[method-unbinding]
|
|
15321
|
-
'var': Var
|
|
15348
|
+
'var': Var,
|
|
15322
15349
|
// $FlowFixMe[method-unbinding]
|
|
15323
|
-
'within': Within
|
|
15350
|
+
'within': Within,
|
|
15324
15351
|
// $FlowFixMe[method-unbinding]
|
|
15325
|
-
'distance': Distance
|
|
15352
|
+
'distance': Distance,
|
|
15326
15353
|
// $FlowFixMe[method-unbinding]
|
|
15327
|
-
'config': Config
|
|
15354
|
+
'config': Config
|
|
15328
15355
|
};
|
|
15329
15356
|
function rgba(ctx, [r, g, b, a]) {
|
|
15330
15357
|
r = r.evaluate(ctx);
|
|
@@ -15333,7 +15360,7 @@ function rgba(ctx, [r, g, b, a]) {
|
|
|
15333
15360
|
const alpha = a ? a.evaluate(ctx) : 1;
|
|
15334
15361
|
const error = validateRGBA(r, g, b, alpha);
|
|
15335
15362
|
if (error)
|
|
15336
|
-
throw new RuntimeError
|
|
15363
|
+
throw new RuntimeError(error);
|
|
15337
15364
|
return new Color$1(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);
|
|
15338
15365
|
}
|
|
15339
15366
|
function hsla(ctx, [h, s, l, a]) {
|
|
@@ -15343,11 +15370,11 @@ function hsla(ctx, [h, s, l, a]) {
|
|
|
15343
15370
|
const alpha = a ? a.evaluate(ctx) : 1;
|
|
15344
15371
|
const error = validateHSLA(h, s, l, alpha);
|
|
15345
15372
|
if (error)
|
|
15346
|
-
throw new RuntimeError
|
|
15373
|
+
throw new RuntimeError(error);
|
|
15347
15374
|
const colorFunction = `hsla(${ h }, ${ s }%, ${ l }%, ${ alpha })`;
|
|
15348
15375
|
const color = Color$1.parse(colorFunction);
|
|
15349
15376
|
if (!color)
|
|
15350
|
-
throw new RuntimeError
|
|
15377
|
+
throw new RuntimeError(`Failed to parse HSLA color: ${ colorFunction }`);
|
|
15351
15378
|
return color;
|
|
15352
15379
|
}
|
|
15353
15380
|
function has(key, obj) {
|
|
@@ -15384,12 +15411,12 @@ function hashString(str) {
|
|
|
15384
15411
|
}
|
|
15385
15412
|
return hash;
|
|
15386
15413
|
}
|
|
15387
|
-
CompoundExpression
|
|
15414
|
+
CompoundExpression.register(expressions, {
|
|
15388
15415
|
'error': [
|
|
15389
15416
|
ErrorType,
|
|
15390
15417
|
[StringType],
|
|
15391
15418
|
(ctx, [v]) => {
|
|
15392
|
-
throw new RuntimeError
|
|
15419
|
+
throw new RuntimeError(v.evaluate(ctx));
|
|
15393
15420
|
}
|
|
15394
15421
|
],
|
|
15395
15422
|
'typeof': [
|
|
@@ -15949,14 +15976,13 @@ CompoundExpression$1.register(expressions, {
|
|
|
15949
15976
|
} else if (typeof seed === 'number') {
|
|
15950
15977
|
seedVal = seed;
|
|
15951
15978
|
} else {
|
|
15952
|
-
throw new RuntimeError
|
|
15979
|
+
throw new RuntimeError(`Invalid seed input: ${ seed }`);
|
|
15953
15980
|
}
|
|
15954
15981
|
const random = mulberry32(seedVal)();
|
|
15955
15982
|
return min + random * (max - min);
|
|
15956
15983
|
}
|
|
15957
15984
|
]
|
|
15958
15985
|
});
|
|
15959
|
-
var definitions = expressions;
|
|
15960
15986
|
|
|
15961
15987
|
//
|
|
15962
15988
|
/**
|
|
@@ -16081,7 +16107,7 @@ function createFunction(parameters, propertySpec) {
|
|
|
16081
16107
|
return {
|
|
16082
16108
|
kind: 'composite',
|
|
16083
16109
|
interpolationType,
|
|
16084
|
-
interpolationFactor: Interpolate
|
|
16110
|
+
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
16085
16111
|
zoomStops: featureFunctionStops.map(s => s[0]),
|
|
16086
16112
|
evaluate({zoom}, properties) {
|
|
16087
16113
|
return evaluateExponentialFunction({
|
|
@@ -16098,7 +16124,7 @@ function createFunction(parameters, propertySpec) {
|
|
|
16098
16124
|
return {
|
|
16099
16125
|
kind: 'camera',
|
|
16100
16126
|
interpolationType,
|
|
16101
|
-
interpolationFactor: Interpolate
|
|
16127
|
+
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
16102
16128
|
zoomStops: parameters.stops.map(s => s[0]),
|
|
16103
16129
|
evaluate: ({zoom}) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)
|
|
16104
16130
|
};
|
|
@@ -16246,7 +16272,7 @@ class StyleExpression {
|
|
|
16246
16272
|
constructor(expression, propertySpec, scope, options) {
|
|
16247
16273
|
this.expression = expression;
|
|
16248
16274
|
this._warningHistory = {};
|
|
16249
|
-
this._evaluator = new EvaluationContext
|
|
16275
|
+
this._evaluator = new EvaluationContext(scope, options);
|
|
16250
16276
|
this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
|
|
16251
16277
|
this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;
|
|
16252
16278
|
}
|
|
@@ -16277,7 +16303,7 @@ class StyleExpression {
|
|
|
16277
16303
|
return this._defaultValue;
|
|
16278
16304
|
}
|
|
16279
16305
|
if (this._enumValues && !(val in this._enumValues)) {
|
|
16280
|
-
throw new RuntimeError
|
|
16306
|
+
throw new RuntimeError(`Expected value to be one of ${ Object.keys(this._enumValues).map(v => JSON.stringify(v)).join(', ') }, but found ${ JSON.stringify(val) } instead.`);
|
|
16281
16307
|
}
|
|
16282
16308
|
return val;
|
|
16283
16309
|
} catch (e) {
|
|
@@ -16292,7 +16318,7 @@ class StyleExpression {
|
|
|
16292
16318
|
}
|
|
16293
16319
|
}
|
|
16294
16320
|
function isExpression(expression) {
|
|
16295
|
-
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in
|
|
16321
|
+
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in expressions;
|
|
16296
16322
|
}
|
|
16297
16323
|
/**
|
|
16298
16324
|
* Parse and typecheck the given style spec JSON expression. If
|
|
@@ -16304,7 +16330,7 @@ function isExpression(expression) {
|
|
|
16304
16330
|
* @private
|
|
16305
16331
|
*/
|
|
16306
16332
|
function createExpression(expression, propertySpec, scope, options) {
|
|
16307
|
-
const parser = new ParsingContext
|
|
16333
|
+
const parser = new ParsingContext(expressions, [], propertySpec ? getExpectedType(propertySpec) : undefined, undefined, undefined, scope, options);
|
|
16308
16334
|
// For string-valued properties, coerce to string at the top level rather than asserting.
|
|
16309
16335
|
const parsed = parser.parse(expression, undefined, undefined, undefined, propertySpec && propertySpec.type === 'string' ? { typeAnnotation: 'coerce' } : undefined);
|
|
16310
16336
|
if (!parsed) {
|
|
@@ -16345,7 +16371,7 @@ class ZoomDependentExpression {
|
|
|
16345
16371
|
}
|
|
16346
16372
|
interpolationFactor(input, lower, upper) {
|
|
16347
16373
|
if (this.interpolationType) {
|
|
16348
|
-
return Interpolate
|
|
16374
|
+
return Interpolate.interpolationFactor(this.interpolationType, input, lower, upper);
|
|
16349
16375
|
} else {
|
|
16350
16376
|
return 0;
|
|
16351
16377
|
}
|
|
@@ -16359,7 +16385,7 @@ function createPropertyExpression(expression, propertySpec, scope, options) {
|
|
|
16359
16385
|
const parsed = expression.value.expression;
|
|
16360
16386
|
const isFeatureConstant$1 = isFeatureConstant(parsed);
|
|
16361
16387
|
if (!isFeatureConstant$1 && !supportsPropertyExpression(propertySpec)) {
|
|
16362
|
-
return error([new ParsingError$
|
|
16388
|
+
return error([new ParsingError$1('', 'data expressions not supported')]);
|
|
16363
16389
|
}
|
|
16364
16390
|
const isZoomConstant = isGlobalPropertyConstant(parsed, [
|
|
16365
16391
|
'zoom',
|
|
@@ -16367,25 +16393,25 @@ function createPropertyExpression(expression, propertySpec, scope, options) {
|
|
|
16367
16393
|
'distance-from-center'
|
|
16368
16394
|
]);
|
|
16369
16395
|
if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {
|
|
16370
|
-
return error([new ParsingError$
|
|
16396
|
+
return error([new ParsingError$1('', 'zoom expressions not supported')]);
|
|
16371
16397
|
}
|
|
16372
16398
|
const isLightConstant = isGlobalPropertyConstant(parsed, ['measure-light']);
|
|
16373
16399
|
if (!isLightConstant && !supportsLightExpression(propertySpec)) {
|
|
16374
|
-
return error([new ParsingError$
|
|
16400
|
+
return error([new ParsingError$1('', 'measure-light expression not supported')]);
|
|
16375
16401
|
}
|
|
16376
16402
|
const canRelaxZoomRestriction = propertySpec.expression && propertySpec.expression.relaxZoomRestriction;
|
|
16377
16403
|
const zoomCurve = findZoomCurve(parsed);
|
|
16378
16404
|
if (!zoomCurve && !isZoomConstant && !canRelaxZoomRestriction) {
|
|
16379
|
-
return error([new ParsingError$
|
|
16380
|
-
} else if (zoomCurve instanceof ParsingError$
|
|
16405
|
+
return error([new ParsingError$1('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')]);
|
|
16406
|
+
} else if (zoomCurve instanceof ParsingError$1) {
|
|
16381
16407
|
return error([zoomCurve]);
|
|
16382
|
-
} else if (zoomCurve instanceof Interpolate
|
|
16383
|
-
return error([new ParsingError$
|
|
16408
|
+
} else if (zoomCurve instanceof Interpolate && !supportsInterpolation(propertySpec)) {
|
|
16409
|
+
return error([new ParsingError$1('', '"interpolate" expressions cannot be used with this property')]);
|
|
16384
16410
|
}
|
|
16385
16411
|
if (!zoomCurve) {
|
|
16386
16412
|
return success(isFeatureConstant$1 ? new ZoomConstantExpression('constant', expression.value, isLightConstant) : new ZoomConstantExpression('source', expression.value, isLightConstant));
|
|
16387
16413
|
}
|
|
16388
|
-
const interpolationType = zoomCurve instanceof Interpolate
|
|
16414
|
+
const interpolationType = zoomCurve instanceof Interpolate ? zoomCurve.interpolation : undefined;
|
|
16389
16415
|
return success(isFeatureConstant$1 ? new ZoomDependentExpression('camera', expression.value, zoomCurve.labels, interpolationType, isLightConstant) : new ZoomDependentExpression('composite', expression.value, zoomCurve.labels, interpolationType, isLightConstant));
|
|
16390
16416
|
}
|
|
16391
16417
|
// serialization wrapper for old-style stop functions normalized to the
|
|
@@ -16433,27 +16459,27 @@ function normalizePropertyExpression(value, specification, scope, options) {
|
|
|
16433
16459
|
// "coalesce" expressions.
|
|
16434
16460
|
function findZoomCurve(expression) {
|
|
16435
16461
|
let result = null;
|
|
16436
|
-
if (expression instanceof Let
|
|
16462
|
+
if (expression instanceof Let) {
|
|
16437
16463
|
result = findZoomCurve(expression.result);
|
|
16438
|
-
} else if (expression instanceof Coalesce
|
|
16464
|
+
} else if (expression instanceof Coalesce) {
|
|
16439
16465
|
for (const arg of expression.args) {
|
|
16440
16466
|
result = findZoomCurve(arg);
|
|
16441
16467
|
if (result) {
|
|
16442
16468
|
break;
|
|
16443
16469
|
}
|
|
16444
16470
|
}
|
|
16445
|
-
} else if ((expression instanceof Step
|
|
16471
|
+
} else if ((expression instanceof Step || expression instanceof Interpolate) && expression.input instanceof CompoundExpression && expression.input.name === 'zoom') {
|
|
16446
16472
|
result = expression;
|
|
16447
16473
|
}
|
|
16448
|
-
if (result instanceof ParsingError$
|
|
16474
|
+
if (result instanceof ParsingError$1) {
|
|
16449
16475
|
return result;
|
|
16450
16476
|
}
|
|
16451
16477
|
expression.eachChild(child => {
|
|
16452
16478
|
const childResult = findZoomCurve(child);
|
|
16453
|
-
if (childResult instanceof ParsingError$
|
|
16479
|
+
if (childResult instanceof ParsingError$1) {
|
|
16454
16480
|
result = childResult;
|
|
16455
16481
|
} else if (result && childResult && result !== childResult) {
|
|
16456
|
-
result = new ParsingError$
|
|
16482
|
+
result = new ParsingError$1('', 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.');
|
|
16457
16483
|
}
|
|
16458
16484
|
});
|
|
16459
16485
|
return result;
|
|
@@ -18602,7 +18628,7 @@ function disallowedFilterParameters(e, options) {
|
|
|
18602
18628
|
return [];
|
|
18603
18629
|
}
|
|
18604
18630
|
const errors = [];
|
|
18605
|
-
if (e instanceof CompoundExpression
|
|
18631
|
+
if (e instanceof CompoundExpression) {
|
|
18606
18632
|
if (disallowedParameters.has(e.name)) {
|
|
18607
18633
|
return [new ValidationError(options.key, options.value, `["${ e.name }"] expression is not supported in a filter for a ${ options.object.type } layer with id: ${ options.object.id }`)];
|
|
18608
18634
|
}
|
|
@@ -19101,10 +19127,10 @@ function validatePromoteId({key, value}) {
|
|
|
19101
19127
|
|
|
19102
19128
|
//
|
|
19103
19129
|
// Allow any URL, use dummy base, if it's a relative URL
|
|
19104
|
-
function isValidUrl(str) {
|
|
19130
|
+
function isValidUrl(str, allowRelativeUrls) {
|
|
19105
19131
|
const isRelative = str.indexOf('://') === -1;
|
|
19106
19132
|
try {
|
|
19107
|
-
new URL(str, isRelative ? 'http://example.com' : undefined);
|
|
19133
|
+
new URL(str, isRelative && allowRelativeUrls ? 'http://example.com' : undefined);
|
|
19108
19134
|
return true;
|
|
19109
19135
|
} catch (_) {
|
|
19110
19136
|
return false;
|
|
@@ -19121,7 +19147,7 @@ function validateModel(options) {
|
|
|
19121
19147
|
errors = errors.concat([new ValidationError(options.key, url, `string expected, "${ type }" found`)]);
|
|
19122
19148
|
return errors;
|
|
19123
19149
|
}
|
|
19124
|
-
if (!isValidUrl(url)) {
|
|
19150
|
+
if (!isValidUrl(url, true)) {
|
|
19125
19151
|
errors = errors.concat([new ValidationError(options.key, url, `invalid url "${ url }"`)]);
|
|
19126
19152
|
}
|
|
19127
19153
|
return errors;
|