@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.cjs
CHANGED
|
@@ -907,6 +907,11 @@
|
|
|
907
907
|
"default": 18,
|
|
908
908
|
doc: "Maximum zoom level at which to create vector tiles (higher means greater detail at high zoom levels)."
|
|
909
909
|
},
|
|
910
|
+
minzoom: {
|
|
911
|
+
type: "number",
|
|
912
|
+
"default": 0,
|
|
913
|
+
doc: "Minimum zoom level at which to create vector tiles"
|
|
914
|
+
},
|
|
910
915
|
attribution: {
|
|
911
916
|
type: "string",
|
|
912
917
|
doc: "Contains an attribution to be displayed when the map is shown to a user."
|
|
@@ -958,11 +963,21 @@
|
|
|
958
963
|
generateId: {
|
|
959
964
|
type: "boolean",
|
|
960
965
|
"default": false,
|
|
961
|
-
doc: "Whether to generate ids for the
|
|
966
|
+
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."
|
|
962
967
|
},
|
|
963
968
|
promoteId: {
|
|
964
969
|
type: "promoteId",
|
|
965
970
|
doc: "A property to use as a feature id (for feature state). Either a property name, or an object of the form `{<sourceLayer>: <propertyName>}`."
|
|
971
|
+
},
|
|
972
|
+
dynamic: {
|
|
973
|
+
type: "boolean",
|
|
974
|
+
"default": false,
|
|
975
|
+
doc: "Whether to optimize this source for frequent data updates (e.g. animating features).",
|
|
976
|
+
"sdk-support": {
|
|
977
|
+
"basic functionality": {
|
|
978
|
+
js: "3.4.0"
|
|
979
|
+
}
|
|
980
|
+
}
|
|
966
981
|
}
|
|
967
982
|
};
|
|
968
983
|
var source_video = {
|
|
@@ -1137,10 +1152,9 @@
|
|
|
1137
1152
|
doc: "Particle animation driven by textures such as wind maps.",
|
|
1138
1153
|
"sdk-support": {
|
|
1139
1154
|
"basic functionality": {
|
|
1140
|
-
js: "
|
|
1141
|
-
android: "
|
|
1142
|
-
ios: "
|
|
1143
|
-
macos: "0.1.0"
|
|
1155
|
+
js: "3.3.0",
|
|
1156
|
+
android: "11.4.0",
|
|
1157
|
+
ios: "11.4.0"
|
|
1144
1158
|
}
|
|
1145
1159
|
}
|
|
1146
1160
|
},
|
|
@@ -1350,7 +1364,7 @@
|
|
|
1350
1364
|
"model-id": {
|
|
1351
1365
|
type: "string",
|
|
1352
1366
|
"default": "",
|
|
1353
|
-
doc: "Model to render.",
|
|
1367
|
+
doc: "Model to render. It can be either a string referencing an element to the models root property or an internal or external URL",
|
|
1354
1368
|
"property-type": "data-driven",
|
|
1355
1369
|
expression: {
|
|
1356
1370
|
interpolated: false,
|
|
@@ -1569,6 +1583,9 @@
|
|
|
1569
1583
|
},
|
|
1570
1584
|
miter: {
|
|
1571
1585
|
doc: "A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet."
|
|
1586
|
+
},
|
|
1587
|
+
none: {
|
|
1588
|
+
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."
|
|
1572
1589
|
}
|
|
1573
1590
|
},
|
|
1574
1591
|
"default": "miter",
|
|
@@ -1583,6 +1600,11 @@
|
|
|
1583
1600
|
js: "0.40.0",
|
|
1584
1601
|
android: "5.2.0",
|
|
1585
1602
|
ios: "3.7.0"
|
|
1603
|
+
},
|
|
1604
|
+
"`none` value": {
|
|
1605
|
+
js: "3.4.0",
|
|
1606
|
+
android: "11.5.0",
|
|
1607
|
+
ios: "11.5.0"
|
|
1586
1608
|
}
|
|
1587
1609
|
},
|
|
1588
1610
|
expression: {
|
|
@@ -4361,8 +4383,8 @@
|
|
|
4361
4383
|
"sdk-support": {
|
|
4362
4384
|
"basic functionality": {
|
|
4363
4385
|
js: "3.3.0",
|
|
4364
|
-
android: "",
|
|
4365
|
-
ios: ""
|
|
4386
|
+
android: "11.4.0",
|
|
4387
|
+
ios: "11.4.0"
|
|
4366
4388
|
}
|
|
4367
4389
|
}
|
|
4368
4390
|
},
|
|
@@ -6607,12 +6629,11 @@
|
|
|
6607
6629
|
},
|
|
6608
6630
|
"icon-color-saturation": {
|
|
6609
6631
|
type: "number",
|
|
6610
|
-
"default":
|
|
6611
|
-
minimum:
|
|
6632
|
+
"default": 0,
|
|
6633
|
+
minimum: -1,
|
|
6612
6634
|
maximum: 1,
|
|
6613
|
-
transition:
|
|
6614
|
-
|
|
6615
|
-
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.",
|
|
6635
|
+
transition: false,
|
|
6636
|
+
doc: "Increase or reduce the saturation of the symbol icon.",
|
|
6616
6637
|
"sdk-support": {
|
|
6617
6638
|
"basic functionality": {
|
|
6618
6639
|
js: "3.1.0",
|
|
@@ -6624,6 +6645,63 @@
|
|
|
6624
6645
|
interpolated: false
|
|
6625
6646
|
},
|
|
6626
6647
|
"property-type": "data-constant"
|
|
6648
|
+
},
|
|
6649
|
+
"icon-color-contrast": {
|
|
6650
|
+
type: "number",
|
|
6651
|
+
"default": 0,
|
|
6652
|
+
minimum: -1,
|
|
6653
|
+
maximum: 1,
|
|
6654
|
+
transition: false,
|
|
6655
|
+
doc: "Increase or reduce the contrast of the symbol icon.",
|
|
6656
|
+
"sdk-support": {
|
|
6657
|
+
"basic functionality": {
|
|
6658
|
+
js: "3.5.0",
|
|
6659
|
+
android: "11.5.0",
|
|
6660
|
+
ios: "11.5.0"
|
|
6661
|
+
}
|
|
6662
|
+
},
|
|
6663
|
+
expression: {
|
|
6664
|
+
interpolated: false
|
|
6665
|
+
},
|
|
6666
|
+
"property-type": "data-constant"
|
|
6667
|
+
},
|
|
6668
|
+
"icon-color-brightness-min": {
|
|
6669
|
+
type: "number",
|
|
6670
|
+
doc: "Increase or reduce the brightness of the symbols. The value is the minimum brightness.",
|
|
6671
|
+
"default": 0,
|
|
6672
|
+
minimum: 0,
|
|
6673
|
+
maximum: 1,
|
|
6674
|
+
transition: false,
|
|
6675
|
+
"sdk-support": {
|
|
6676
|
+
"basic functionality": {
|
|
6677
|
+
js: "3.5.0",
|
|
6678
|
+
android: "11.5.0",
|
|
6679
|
+
ios: "11.5.0"
|
|
6680
|
+
}
|
|
6681
|
+
},
|
|
6682
|
+
expression: {
|
|
6683
|
+
interpolated: false
|
|
6684
|
+
},
|
|
6685
|
+
"property-type": "data-constant"
|
|
6686
|
+
},
|
|
6687
|
+
"icon-color-brightness-max": {
|
|
6688
|
+
type: "number",
|
|
6689
|
+
doc: "Increase or reduce the brightness of the symbols. The value is the maximum brightness.",
|
|
6690
|
+
"default": 1,
|
|
6691
|
+
minimum: 0,
|
|
6692
|
+
maximum: 1,
|
|
6693
|
+
transition: false,
|
|
6694
|
+
"sdk-support": {
|
|
6695
|
+
"basic functionality": {
|
|
6696
|
+
js: "3.5.0",
|
|
6697
|
+
android: "11.5.0",
|
|
6698
|
+
ios: "11.5.0"
|
|
6699
|
+
}
|
|
6700
|
+
},
|
|
6701
|
+
expression: {
|
|
6702
|
+
interpolated: false
|
|
6703
|
+
},
|
|
6704
|
+
"property-type": "data-constant"
|
|
6627
6705
|
}
|
|
6628
6706
|
};
|
|
6629
6707
|
var paint_raster = {
|
|
@@ -7836,6 +7914,43 @@
|
|
|
7836
7914
|
}
|
|
7837
7915
|
},
|
|
7838
7916
|
"property-type": "data-constant"
|
|
7917
|
+
},
|
|
7918
|
+
"model-front-cutoff": {
|
|
7919
|
+
type: "array",
|
|
7920
|
+
"private": true,
|
|
7921
|
+
value: "number",
|
|
7922
|
+
"property-type": "data-constant",
|
|
7923
|
+
transition: false,
|
|
7924
|
+
expression: {
|
|
7925
|
+
interpolated: true,
|
|
7926
|
+
parameters: [
|
|
7927
|
+
"zoom"
|
|
7928
|
+
]
|
|
7929
|
+
},
|
|
7930
|
+
length: 3,
|
|
7931
|
+
"default": [
|
|
7932
|
+
0,
|
|
7933
|
+
0,
|
|
7934
|
+
1
|
|
7935
|
+
],
|
|
7936
|
+
minimum: [
|
|
7937
|
+
0,
|
|
7938
|
+
0,
|
|
7939
|
+
0
|
|
7940
|
+
],
|
|
7941
|
+
maximum: [
|
|
7942
|
+
1,
|
|
7943
|
+
1,
|
|
7944
|
+
1
|
|
7945
|
+
],
|
|
7946
|
+
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.",
|
|
7947
|
+
"sdk-support": {
|
|
7948
|
+
"basic functionality": {
|
|
7949
|
+
js: "3.5.0",
|
|
7950
|
+
android: "11.5.0",
|
|
7951
|
+
ios: "11.5.0"
|
|
7952
|
+
}
|
|
7953
|
+
}
|
|
7839
7954
|
}
|
|
7840
7955
|
};
|
|
7841
7956
|
var transition = {
|
|
@@ -8030,14 +8145,14 @@
|
|
|
8030
8145
|
doc: "Whether this layer is displayed.",
|
|
8031
8146
|
"sdk-support": {
|
|
8032
8147
|
"basic functionality": {
|
|
8033
|
-
js: "
|
|
8034
|
-
android: "
|
|
8035
|
-
ios: "
|
|
8148
|
+
js: "3.3.0",
|
|
8149
|
+
android: "11.4.0",
|
|
8150
|
+
ios: "11.4.0"
|
|
8036
8151
|
},
|
|
8037
8152
|
"expressions support": {
|
|
8038
|
-
js: "3.
|
|
8039
|
-
android: "11.
|
|
8040
|
-
ios: "11.
|
|
8153
|
+
js: "3.3.0",
|
|
8154
|
+
android: "11.4.0",
|
|
8155
|
+
ios: "11.4.0"
|
|
8041
8156
|
}
|
|
8042
8157
|
},
|
|
8043
8158
|
expression: {
|
|
@@ -8719,12 +8834,12 @@
|
|
|
8719
8834
|
"property-type": "data-constant",
|
|
8720
8835
|
transition: false,
|
|
8721
8836
|
doc: "Displayed band of raster array source layer",
|
|
8722
|
-
example: "
|
|
8837
|
+
example: "\"1713348000\"",
|
|
8723
8838
|
"sdk-support": {
|
|
8724
8839
|
"basic functionality": {
|
|
8725
|
-
js: "",
|
|
8726
|
-
android: "",
|
|
8727
|
-
ios: ""
|
|
8840
|
+
js: "3.3.0",
|
|
8841
|
+
android: "11.4.0",
|
|
8842
|
+
ios: "11.4.0"
|
|
8728
8843
|
}
|
|
8729
8844
|
}
|
|
8730
8845
|
},
|
|
@@ -8736,9 +8851,9 @@
|
|
|
8736
8851
|
transition: false,
|
|
8737
8852
|
"sdk-support": {
|
|
8738
8853
|
"basic functionality": {
|
|
8739
|
-
js: "",
|
|
8740
|
-
android: "",
|
|
8741
|
-
ios: ""
|
|
8854
|
+
js: "3.3.0",
|
|
8855
|
+
android: "11.4.0",
|
|
8856
|
+
ios: "11.4.0"
|
|
8742
8857
|
}
|
|
8743
8858
|
},
|
|
8744
8859
|
"property-type": "data-constant"
|
|
@@ -8749,9 +8864,9 @@
|
|
|
8749
8864
|
transition: false,
|
|
8750
8865
|
"sdk-support": {
|
|
8751
8866
|
"basic functionality": {
|
|
8752
|
-
js: "",
|
|
8753
|
-
android: "",
|
|
8754
|
-
ios: ""
|
|
8867
|
+
js: "3.3.0",
|
|
8868
|
+
android: "11.4.0",
|
|
8869
|
+
ios: "11.4.0"
|
|
8755
8870
|
},
|
|
8756
8871
|
"data-driven styling": {
|
|
8757
8872
|
}
|
|
@@ -8772,9 +8887,9 @@
|
|
|
8772
8887
|
transition: false,
|
|
8773
8888
|
"sdk-support": {
|
|
8774
8889
|
"basic functionality": {
|
|
8775
|
-
js: "",
|
|
8776
|
-
android: "",
|
|
8777
|
-
ios: ""
|
|
8890
|
+
js: "3.3.0",
|
|
8891
|
+
android: "11.4.0",
|
|
8892
|
+
ios: "11.4.0"
|
|
8778
8893
|
}
|
|
8779
8894
|
},
|
|
8780
8895
|
"property-type": "data-constant"
|
|
@@ -8788,9 +8903,9 @@
|
|
|
8788
8903
|
transition: true,
|
|
8789
8904
|
"sdk-support": {
|
|
8790
8905
|
"basic functionality": {
|
|
8791
|
-
js: "",
|
|
8792
|
-
android: "",
|
|
8793
|
-
ios: ""
|
|
8906
|
+
js: "3.3.0",
|
|
8907
|
+
android: "11.4.0",
|
|
8908
|
+
ios: "11.4.0"
|
|
8794
8909
|
}
|
|
8795
8910
|
},
|
|
8796
8911
|
expression: {
|
|
@@ -8810,9 +8925,9 @@
|
|
|
8810
8925
|
transition: true,
|
|
8811
8926
|
"sdk-support": {
|
|
8812
8927
|
"basic functionality": {
|
|
8813
|
-
js: "",
|
|
8814
|
-
android: "",
|
|
8815
|
-
ios: ""
|
|
8928
|
+
js: "3.3.0",
|
|
8929
|
+
android: "11.4.0",
|
|
8930
|
+
ios: "11.4.0"
|
|
8816
8931
|
}
|
|
8817
8932
|
},
|
|
8818
8933
|
expression: {
|
|
@@ -8832,9 +8947,9 @@
|
|
|
8832
8947
|
transition: false,
|
|
8833
8948
|
"sdk-support": {
|
|
8834
8949
|
"basic functionality": {
|
|
8835
|
-
js: "",
|
|
8836
|
-
android: "",
|
|
8837
|
-
ios: ""
|
|
8950
|
+
js: "3.3.0",
|
|
8951
|
+
android: "11.4.0",
|
|
8952
|
+
ios: "11.4.0"
|
|
8838
8953
|
}
|
|
8839
8954
|
},
|
|
8840
8955
|
"property-type": "data-constant"
|
|
@@ -9231,7 +9346,6 @@
|
|
|
9231
9346
|
this.key = key;
|
|
9232
9347
|
}
|
|
9233
9348
|
};
|
|
9234
|
-
var ParsingError$2 = ParsingError$1;
|
|
9235
9349
|
|
|
9236
9350
|
//
|
|
9237
9351
|
/**
|
|
@@ -9264,7 +9378,6 @@
|
|
|
9264
9378
|
return this.parent ? this.parent.has(name) : false;
|
|
9265
9379
|
}
|
|
9266
9380
|
}
|
|
9267
|
-
var Scope$1 = Scope;
|
|
9268
9381
|
|
|
9269
9382
|
//
|
|
9270
9383
|
const NullType = { kind: 'null' };
|
|
@@ -10865,7 +10978,6 @@
|
|
|
10865
10978
|
}
|
|
10866
10979
|
}
|
|
10867
10980
|
}
|
|
10868
|
-
var Literal$1 = Literal;
|
|
10869
10981
|
|
|
10870
10982
|
//
|
|
10871
10983
|
class RuntimeError {
|
|
@@ -10877,7 +10989,6 @@
|
|
|
10877
10989
|
return this.message;
|
|
10878
10990
|
}
|
|
10879
10991
|
}
|
|
10880
|
-
var RuntimeError$1 = RuntimeError;
|
|
10881
10992
|
|
|
10882
10993
|
const types$1 = {
|
|
10883
10994
|
string: StringType,
|
|
@@ -10935,7 +11046,7 @@
|
|
|
10935
11046
|
if (!error) {
|
|
10936
11047
|
return value;
|
|
10937
11048
|
} else if (i === this.args.length - 1) {
|
|
10938
|
-
throw new RuntimeError
|
|
11049
|
+
throw new RuntimeError(`Expected value to be of type ${ toString$1(this.type) }, but found ${ toString$1(typeOf(value)) } instead.`);
|
|
10939
11050
|
}
|
|
10940
11051
|
}
|
|
10941
11052
|
return null;
|
|
@@ -10962,7 +11073,6 @@
|
|
|
10962
11073
|
return serialized.concat(this.args.map(arg => arg.serialize()));
|
|
10963
11074
|
}
|
|
10964
11075
|
}
|
|
10965
|
-
var Assertion$1 = Assertion;
|
|
10966
11076
|
|
|
10967
11077
|
//
|
|
10968
11078
|
class FormatExpression {
|
|
@@ -11249,7 +11359,7 @@
|
|
|
11249
11359
|
}
|
|
11250
11360
|
}
|
|
11251
11361
|
}
|
|
11252
|
-
throw new RuntimeError
|
|
11362
|
+
throw new RuntimeError(error || `Could not parse color from value '${ typeof input === 'string' ? input : String(JSON.stringify(input)) }'`);
|
|
11253
11363
|
} else if (this.type.kind === 'number') {
|
|
11254
11364
|
let value = null;
|
|
11255
11365
|
for (const arg of this.args) {
|
|
@@ -11261,7 +11371,7 @@
|
|
|
11261
11371
|
continue;
|
|
11262
11372
|
return num;
|
|
11263
11373
|
}
|
|
11264
|
-
throw new RuntimeError
|
|
11374
|
+
throw new RuntimeError(`Could not convert ${ JSON.stringify(value) } to number.`);
|
|
11265
11375
|
} else if (this.type.kind === 'formatted') {
|
|
11266
11376
|
// There is no explicit 'to-formatted' but this coercion can be implicitly
|
|
11267
11377
|
// created by properties that expect the 'formatted' type.
|
|
@@ -11301,7 +11411,6 @@
|
|
|
11301
11411
|
return serialized;
|
|
11302
11412
|
}
|
|
11303
11413
|
}
|
|
11304
|
-
var Coercion$1 = Coercion;
|
|
11305
11414
|
|
|
11306
11415
|
//
|
|
11307
11416
|
const geometryTypes = [
|
|
@@ -11370,7 +11479,6 @@
|
|
|
11370
11479
|
return this.options ? this.options.get(id) : null;
|
|
11371
11480
|
}
|
|
11372
11481
|
}
|
|
11373
|
-
var EvaluationContext$1 = EvaluationContext;
|
|
11374
11482
|
|
|
11375
11483
|
//
|
|
11376
11484
|
class CompoundExpression {
|
|
@@ -11421,7 +11529,7 @@
|
|
|
11421
11529
|
overloadIndex++;
|
|
11422
11530
|
// Use a fresh context for each attempted signature so that, if
|
|
11423
11531
|
// we eventually succeed, we haven't polluted `context.errors`.
|
|
11424
|
-
signatureContext = new ParsingContext
|
|
11532
|
+
signatureContext = new ParsingContext(context.registry, context.path, null, context.scope, undefined, context._scope, context.options);
|
|
11425
11533
|
// First parse all the args, potentially coercing to the
|
|
11426
11534
|
// types expected by this overload.
|
|
11427
11535
|
const parsedArgs = [];
|
|
@@ -11489,7 +11597,6 @@
|
|
|
11489
11597
|
return `(${ toString$1(signature.type) }...)`;
|
|
11490
11598
|
}
|
|
11491
11599
|
}
|
|
11492
|
-
var CompoundExpression$1 = CompoundExpression;
|
|
11493
11600
|
|
|
11494
11601
|
//
|
|
11495
11602
|
class CollatorExpression {
|
|
@@ -11550,57 +11657,6 @@
|
|
|
11550
11657
|
}
|
|
11551
11658
|
}
|
|
11552
11659
|
|
|
11553
|
-
function quickselect(arr, k, left, right, compare) {
|
|
11554
|
-
quickselectStep(arr, k, left || 0, right || arr.length - 1, compare || defaultCompare$1);
|
|
11555
|
-
}
|
|
11556
|
-
function quickselectStep(arr, k, left, right, compare) {
|
|
11557
|
-
while (right > left) {
|
|
11558
|
-
if (right - left > 600) {
|
|
11559
|
-
var n = right - left + 1;
|
|
11560
|
-
var m = k - left + 1;
|
|
11561
|
-
var z = Math.log(n);
|
|
11562
|
-
var s = 0.5 * Math.exp(2 * z / 3);
|
|
11563
|
-
var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
|
|
11564
|
-
var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
|
|
11565
|
-
var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
|
|
11566
|
-
quickselectStep(arr, k, newLeft, newRight, compare);
|
|
11567
|
-
}
|
|
11568
|
-
var t = arr[k];
|
|
11569
|
-
var i = left;
|
|
11570
|
-
var j = right;
|
|
11571
|
-
swap(arr, left, k);
|
|
11572
|
-
if (compare(arr[right], t) > 0)
|
|
11573
|
-
swap(arr, left, right);
|
|
11574
|
-
while (i < j) {
|
|
11575
|
-
swap(arr, i, j);
|
|
11576
|
-
i++;
|
|
11577
|
-
j--;
|
|
11578
|
-
while (compare(arr[i], t) < 0)
|
|
11579
|
-
i++;
|
|
11580
|
-
while (compare(arr[j], t) > 0)
|
|
11581
|
-
j--;
|
|
11582
|
-
}
|
|
11583
|
-
if (compare(arr[left], t) === 0)
|
|
11584
|
-
swap(arr, left, j);
|
|
11585
|
-
else {
|
|
11586
|
-
j++;
|
|
11587
|
-
swap(arr, j, right);
|
|
11588
|
-
}
|
|
11589
|
-
if (j <= k)
|
|
11590
|
-
left = j + 1;
|
|
11591
|
-
if (k <= j)
|
|
11592
|
-
right = j - 1;
|
|
11593
|
-
}
|
|
11594
|
-
}
|
|
11595
|
-
function swap(arr, i, j) {
|
|
11596
|
-
var tmp = arr[i];
|
|
11597
|
-
arr[i] = arr[j];
|
|
11598
|
-
arr[j] = tmp;
|
|
11599
|
-
}
|
|
11600
|
-
function defaultCompare$1(a, b) {
|
|
11601
|
-
return a < b ? -1 : a > b ? 1 : 0;
|
|
11602
|
-
}
|
|
11603
|
-
|
|
11604
11660
|
//
|
|
11605
11661
|
// minX, minY, maxX, maxY
|
|
11606
11662
|
/**
|
|
@@ -11617,9 +11673,6 @@
|
|
|
11617
11673
|
}
|
|
11618
11674
|
return sum;
|
|
11619
11675
|
}
|
|
11620
|
-
function compareAreas(a, b) {
|
|
11621
|
-
return b.area - a.area;
|
|
11622
|
-
}
|
|
11623
11676
|
// classifies an array of rings into polygons with outer rings and holes
|
|
11624
11677
|
function classifyRings(rings, maxRings) {
|
|
11625
11678
|
const len = rings.length;
|
|
@@ -11644,16 +11697,6 @@
|
|
|
11644
11697
|
}
|
|
11645
11698
|
if (polygon)
|
|
11646
11699
|
polygons.push(polygon);
|
|
11647
|
-
// Earcut performance degrades with the # of rings in a polygon. For this
|
|
11648
|
-
// reason, we limit strip out all but the `maxRings` largest rings.
|
|
11649
|
-
if (maxRings > 1) {
|
|
11650
|
-
for (let j = 0; j < polygons.length; j++) {
|
|
11651
|
-
if (polygons[j].length <= maxRings)
|
|
11652
|
-
continue;
|
|
11653
|
-
quickselect(polygons[j], maxRings, 1, polygons[j].length - 1, compareAreas);
|
|
11654
|
-
polygons[j] = polygons[j].slice(0, maxRings);
|
|
11655
|
-
}
|
|
11656
|
-
}
|
|
11657
11700
|
return polygons;
|
|
11658
11701
|
}
|
|
11659
11702
|
function updateBBox(bbox, coord) {
|
|
@@ -12016,7 +12059,6 @@
|
|
|
12016
12059
|
];
|
|
12017
12060
|
}
|
|
12018
12061
|
}
|
|
12019
|
-
var Within$1 = Within;
|
|
12020
12062
|
|
|
12021
12063
|
/* */
|
|
12022
12064
|
const factors = {
|
|
@@ -13346,7 +13388,7 @@
|
|
|
13346
13388
|
}
|
|
13347
13389
|
function polygonsToGeometryDistance(originGeometry, canonical, geometry) {
|
|
13348
13390
|
const lngLatPolygons = [];
|
|
13349
|
-
for (const polygon of classifyRings(originGeometry
|
|
13391
|
+
for (const polygon of classifyRings(originGeometry)) {
|
|
13350
13392
|
const lngLatPolygon = [];
|
|
13351
13393
|
for (let i = 0; i < polygon.length; ++i) {
|
|
13352
13394
|
lngLatPolygon.push(getLngLatPoints(polygon[i], canonical));
|
|
@@ -13435,7 +13477,6 @@
|
|
|
13435
13477
|
];
|
|
13436
13478
|
}
|
|
13437
13479
|
}
|
|
13438
|
-
var Distance$1 = Distance;
|
|
13439
13480
|
|
|
13440
13481
|
//
|
|
13441
13482
|
function coerceValue(type, value) {
|
|
@@ -13484,12 +13525,12 @@
|
|
|
13484
13525
|
return context.error(`Invalid number of arguments for 'config' expression.`);
|
|
13485
13526
|
}
|
|
13486
13527
|
const configKey = context.parse(args[1], 1);
|
|
13487
|
-
if (!(configKey instanceof Literal
|
|
13528
|
+
if (!(configKey instanceof Literal)) {
|
|
13488
13529
|
return context.error(`Key name of 'config' expression must be a string literal.`);
|
|
13489
13530
|
}
|
|
13490
13531
|
if (args.length >= 3) {
|
|
13491
13532
|
const configScope = context.parse(args[2], 2);
|
|
13492
|
-
if (!(configScope instanceof Literal
|
|
13533
|
+
if (!(configScope instanceof Literal)) {
|
|
13493
13534
|
return context.error(`Scope of 'config' expression must be a string literal.`);
|
|
13494
13535
|
}
|
|
13495
13536
|
return new Config(type, toString(configKey.value), toString(configScope.value));
|
|
@@ -13554,11 +13595,10 @@
|
|
|
13554
13595
|
return res;
|
|
13555
13596
|
}
|
|
13556
13597
|
}
|
|
13557
|
-
var Config$1 = Config;
|
|
13558
13598
|
|
|
13559
13599
|
//
|
|
13560
13600
|
function isFeatureConstant(e) {
|
|
13561
|
-
if (e instanceof CompoundExpression
|
|
13601
|
+
if (e instanceof CompoundExpression) {
|
|
13562
13602
|
if (e.name === 'get' && e.args.length === 1) {
|
|
13563
13603
|
return false;
|
|
13564
13604
|
} else if (e.name === 'feature-state') {
|
|
@@ -13571,10 +13611,10 @@
|
|
|
13571
13611
|
return false;
|
|
13572
13612
|
}
|
|
13573
13613
|
}
|
|
13574
|
-
if (e instanceof Within
|
|
13614
|
+
if (e instanceof Within) {
|
|
13575
13615
|
return false;
|
|
13576
13616
|
}
|
|
13577
|
-
if (e instanceof Distance
|
|
13617
|
+
if (e instanceof Distance) {
|
|
13578
13618
|
return false;
|
|
13579
13619
|
}
|
|
13580
13620
|
let result = true;
|
|
@@ -13586,7 +13626,7 @@
|
|
|
13586
13626
|
return result;
|
|
13587
13627
|
}
|
|
13588
13628
|
function isStateConstant(e) {
|
|
13589
|
-
if (e instanceof CompoundExpression
|
|
13629
|
+
if (e instanceof CompoundExpression) {
|
|
13590
13630
|
if (e.name === 'feature-state') {
|
|
13591
13631
|
return false;
|
|
13592
13632
|
}
|
|
@@ -13600,7 +13640,7 @@
|
|
|
13600
13640
|
return result;
|
|
13601
13641
|
}
|
|
13602
13642
|
function isConfigConstant(e) {
|
|
13603
|
-
if (e instanceof Config
|
|
13643
|
+
if (e instanceof Config) {
|
|
13604
13644
|
return false;
|
|
13605
13645
|
}
|
|
13606
13646
|
let result = true;
|
|
@@ -13612,7 +13652,7 @@
|
|
|
13612
13652
|
return result;
|
|
13613
13653
|
}
|
|
13614
13654
|
function isGlobalPropertyConstant(e, properties) {
|
|
13615
|
-
if (e instanceof CompoundExpression
|
|
13655
|
+
if (e instanceof CompoundExpression && properties.indexOf(e.name) >= 0) {
|
|
13616
13656
|
return false;
|
|
13617
13657
|
}
|
|
13618
13658
|
let result = true;
|
|
@@ -13655,7 +13695,6 @@
|
|
|
13655
13695
|
];
|
|
13656
13696
|
}
|
|
13657
13697
|
}
|
|
13658
|
-
var Var$1 = Var;
|
|
13659
13698
|
|
|
13660
13699
|
//
|
|
13661
13700
|
/**
|
|
@@ -13667,7 +13706,7 @@
|
|
|
13667
13706
|
// implementations to infer argument types: Expression#parse() need not
|
|
13668
13707
|
// check that the output type of the parsed expression matches
|
|
13669
13708
|
// `expectedType`.
|
|
13670
|
-
constructor(registry, path = [], expectedType, scope = new Scope
|
|
13709
|
+
constructor(registry, path = [], expectedType, scope = new Scope(), errors = [], _scope, options) {
|
|
13671
13710
|
this.registry = registry;
|
|
13672
13711
|
this.path = path;
|
|
13673
13712
|
this.key = path.map(part => `[${ part }]`).join('');
|
|
@@ -13699,9 +13738,9 @@
|
|
|
13699
13738
|
}
|
|
13700
13739
|
function annotate(parsed, type, typeAnnotation) {
|
|
13701
13740
|
if (typeAnnotation === 'assert') {
|
|
13702
|
-
return new Assertion
|
|
13741
|
+
return new Assertion(type, [parsed]);
|
|
13703
13742
|
} else if (typeAnnotation === 'coerce') {
|
|
13704
|
-
return new Coercion
|
|
13743
|
+
return new Coercion(type, [parsed]);
|
|
13705
13744
|
} else {
|
|
13706
13745
|
return parsed;
|
|
13707
13746
|
}
|
|
@@ -13738,10 +13777,10 @@
|
|
|
13738
13777
|
// it immediately and replace it with a literal value in the
|
|
13739
13778
|
// parsed/compiled result. Expressions that expect an image should
|
|
13740
13779
|
// not be resolved here so we can later get the available images.
|
|
13741
|
-
if (!(parsed instanceof Literal
|
|
13742
|
-
const ec = new EvaluationContext
|
|
13780
|
+
if (!(parsed instanceof Literal) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
|
|
13781
|
+
const ec = new EvaluationContext(this._scope, this.options);
|
|
13743
13782
|
try {
|
|
13744
|
-
parsed = new Literal
|
|
13783
|
+
parsed = new Literal(parsed.type, parsed.evaluate(ec));
|
|
13745
13784
|
} catch (e) {
|
|
13746
13785
|
this.error(e.message);
|
|
13747
13786
|
return null;
|
|
@@ -13750,7 +13789,7 @@
|
|
|
13750
13789
|
return parsed;
|
|
13751
13790
|
}
|
|
13752
13791
|
// Try to parse as array
|
|
13753
|
-
return Coercion
|
|
13792
|
+
return Coercion.parse([
|
|
13754
13793
|
'to-array',
|
|
13755
13794
|
expr
|
|
13756
13795
|
], this);
|
|
@@ -13784,7 +13823,7 @@
|
|
|
13784
13823
|
*/
|
|
13785
13824
|
error(error, ...keys) {
|
|
13786
13825
|
const key = `${ this.key }${ keys.map(k => `[${ k }]`).join('') }`;
|
|
13787
|
-
this.errors.push(new ParsingError$
|
|
13826
|
+
this.errors.push(new ParsingError$1(key, error));
|
|
13788
13827
|
}
|
|
13789
13828
|
/**
|
|
13790
13829
|
* Returns null if `t` is a subtype of `expected`; otherwise returns an
|
|
@@ -13797,25 +13836,24 @@
|
|
|
13797
13836
|
return error;
|
|
13798
13837
|
}
|
|
13799
13838
|
}
|
|
13800
|
-
var ParsingContext$1 = ParsingContext;
|
|
13801
13839
|
function isConstant(expression) {
|
|
13802
|
-
if (expression instanceof Var
|
|
13840
|
+
if (expression instanceof Var) {
|
|
13803
13841
|
return isConstant(expression.boundExpression);
|
|
13804
|
-
} else if (expression instanceof CompoundExpression
|
|
13842
|
+
} else if (expression instanceof CompoundExpression && expression.name === 'error') {
|
|
13805
13843
|
return false;
|
|
13806
13844
|
} else if (expression instanceof CollatorExpression) {
|
|
13807
13845
|
// Although the results of a Collator expression with fixed arguments
|
|
13808
13846
|
// generally shouldn't change between executions, we can't serialize them
|
|
13809
13847
|
// as constant expressions because results change based on environment.
|
|
13810
13848
|
return false;
|
|
13811
|
-
} else if (expression instanceof Within
|
|
13849
|
+
} else if (expression instanceof Within) {
|
|
13812
13850
|
return false;
|
|
13813
|
-
} else if (expression instanceof Distance
|
|
13851
|
+
} else if (expression instanceof Distance) {
|
|
13814
13852
|
return false;
|
|
13815
|
-
} else if (expression instanceof Config
|
|
13853
|
+
} else if (expression instanceof Config) {
|
|
13816
13854
|
return false;
|
|
13817
13855
|
}
|
|
13818
|
-
const isTypeAnnotation = expression instanceof Coercion
|
|
13856
|
+
const isTypeAnnotation = expression instanceof Coercion || expression instanceof Assertion;
|
|
13819
13857
|
let childrenConstant = true;
|
|
13820
13858
|
expression.eachChild(child => {
|
|
13821
13859
|
// We can _almost_ assume that if `expressions` children are constant,
|
|
@@ -13827,7 +13865,7 @@
|
|
|
13827
13865
|
if (isTypeAnnotation) {
|
|
13828
13866
|
childrenConstant = childrenConstant && isConstant(child);
|
|
13829
13867
|
} else {
|
|
13830
|
-
childrenConstant = childrenConstant && child instanceof Literal
|
|
13868
|
+
childrenConstant = childrenConstant && child instanceof Literal;
|
|
13831
13869
|
}
|
|
13832
13870
|
});
|
|
13833
13871
|
if (!childrenConstant) {
|
|
@@ -13872,7 +13910,7 @@
|
|
|
13872
13910
|
} else if (currentValue > input) {
|
|
13873
13911
|
upperIndex = currentIndex - 1;
|
|
13874
13912
|
} else {
|
|
13875
|
-
throw new RuntimeError
|
|
13913
|
+
throw new RuntimeError('Input is not a number.');
|
|
13876
13914
|
}
|
|
13877
13915
|
}
|
|
13878
13916
|
return 0;
|
|
@@ -13967,7 +14005,6 @@
|
|
|
13967
14005
|
return serialized;
|
|
13968
14006
|
}
|
|
13969
14007
|
}
|
|
13970
|
-
var Step$1 = Step;
|
|
13971
14008
|
|
|
13972
14009
|
var unitbezier = UnitBezier;
|
|
13973
14010
|
function UnitBezier(p1x, p1y, p2x, p2y) {
|
|
@@ -14355,7 +14392,6 @@
|
|
|
14355
14392
|
return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);
|
|
14356
14393
|
}
|
|
14357
14394
|
}
|
|
14358
|
-
var Interpolate$1 = Interpolate;
|
|
14359
14395
|
|
|
14360
14396
|
class Coalesce {
|
|
14361
14397
|
constructor(type, args) {
|
|
@@ -14426,7 +14462,6 @@
|
|
|
14426
14462
|
return serialized;
|
|
14427
14463
|
}
|
|
14428
14464
|
}
|
|
14429
|
-
var Coalesce$1 = Coalesce;
|
|
14430
14465
|
|
|
14431
14466
|
//
|
|
14432
14467
|
class Let {
|
|
@@ -14481,7 +14516,6 @@
|
|
|
14481
14516
|
return serialized;
|
|
14482
14517
|
}
|
|
14483
14518
|
}
|
|
14484
|
-
var Let$1 = Let;
|
|
14485
14519
|
|
|
14486
14520
|
//
|
|
14487
14521
|
class At {
|
|
@@ -14504,13 +14538,13 @@
|
|
|
14504
14538
|
const index = this.index.evaluate(ctx);
|
|
14505
14539
|
const array = this.input.evaluate(ctx);
|
|
14506
14540
|
if (index < 0) {
|
|
14507
|
-
throw new RuntimeError
|
|
14541
|
+
throw new RuntimeError(`Array index out of bounds: ${ index } < 0.`);
|
|
14508
14542
|
}
|
|
14509
14543
|
if (index >= array.length) {
|
|
14510
|
-
throw new RuntimeError
|
|
14544
|
+
throw new RuntimeError(`Array index out of bounds: ${ index } > ${ array.length - 1 }.`);
|
|
14511
14545
|
}
|
|
14512
14546
|
if (index !== Math.floor(index)) {
|
|
14513
|
-
throw new RuntimeError
|
|
14547
|
+
throw new RuntimeError(`Array index must be an integer, but found ${ index } instead.`);
|
|
14514
14548
|
}
|
|
14515
14549
|
return array[index];
|
|
14516
14550
|
}
|
|
@@ -14529,7 +14563,6 @@
|
|
|
14529
14563
|
];
|
|
14530
14564
|
}
|
|
14531
14565
|
}
|
|
14532
|
-
var At$1 = At;
|
|
14533
14566
|
|
|
14534
14567
|
//
|
|
14535
14568
|
class In {
|
|
@@ -14568,13 +14601,13 @@
|
|
|
14568
14601
|
'number',
|
|
14569
14602
|
'null'
|
|
14570
14603
|
])) {
|
|
14571
|
-
throw new RuntimeError
|
|
14604
|
+
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
14572
14605
|
}
|
|
14573
14606
|
if (!isValidNativeType(haystack, [
|
|
14574
14607
|
'string',
|
|
14575
14608
|
'array'
|
|
14576
14609
|
])) {
|
|
14577
|
-
throw new RuntimeError
|
|
14610
|
+
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
14578
14611
|
}
|
|
14579
14612
|
return haystack.indexOf(needle) >= 0;
|
|
14580
14613
|
}
|
|
@@ -14593,7 +14626,6 @@
|
|
|
14593
14626
|
];
|
|
14594
14627
|
}
|
|
14595
14628
|
}
|
|
14596
|
-
var In$1 = In;
|
|
14597
14629
|
|
|
14598
14630
|
//
|
|
14599
14631
|
class IndexOf {
|
|
@@ -14638,13 +14670,13 @@
|
|
|
14638
14670
|
'number',
|
|
14639
14671
|
'null'
|
|
14640
14672
|
])) {
|
|
14641
|
-
throw new RuntimeError
|
|
14673
|
+
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
14642
14674
|
}
|
|
14643
14675
|
if (!isValidNativeType(haystack, [
|
|
14644
14676
|
'string',
|
|
14645
14677
|
'array'
|
|
14646
14678
|
])) {
|
|
14647
|
-
throw new RuntimeError
|
|
14679
|
+
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
14648
14680
|
}
|
|
14649
14681
|
if (this.fromIndex) {
|
|
14650
14682
|
const fromIndex = this.fromIndex.evaluate(ctx);
|
|
@@ -14679,7 +14711,6 @@
|
|
|
14679
14711
|
];
|
|
14680
14712
|
}
|
|
14681
14713
|
}
|
|
14682
|
-
var IndexOf$1 = IndexOf;
|
|
14683
14714
|
|
|
14684
14715
|
// Map input label values to output expression index
|
|
14685
14716
|
class Match {
|
|
@@ -14802,7 +14833,6 @@
|
|
|
14802
14833
|
return serialized;
|
|
14803
14834
|
}
|
|
14804
14835
|
}
|
|
14805
|
-
var Match$1 = Match;
|
|
14806
14836
|
|
|
14807
14837
|
class Case {
|
|
14808
14838
|
constructor(type, branches, otherwise) {
|
|
@@ -14864,7 +14894,6 @@
|
|
|
14864
14894
|
return serialized;
|
|
14865
14895
|
}
|
|
14866
14896
|
}
|
|
14867
|
-
var Case$1 = Case;
|
|
14868
14897
|
|
|
14869
14898
|
//
|
|
14870
14899
|
class Slice {
|
|
@@ -14905,7 +14934,7 @@
|
|
|
14905
14934
|
'string',
|
|
14906
14935
|
'array'
|
|
14907
14936
|
])) {
|
|
14908
|
-
throw new RuntimeError
|
|
14937
|
+
throw new RuntimeError(`Expected first argument to be of type array or string, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
14909
14938
|
}
|
|
14910
14939
|
if (this.endIndex) {
|
|
14911
14940
|
const endIndex = this.endIndex.evaluate(ctx);
|
|
@@ -14940,7 +14969,6 @@
|
|
|
14940
14969
|
];
|
|
14941
14970
|
}
|
|
14942
14971
|
}
|
|
14943
|
-
var Slice$1 = Slice;
|
|
14944
14972
|
|
|
14945
14973
|
//
|
|
14946
14974
|
function isComparableType(op, type) {
|
|
@@ -15040,10 +15068,10 @@
|
|
|
15040
15068
|
// typing rules specific to less/greater than operators
|
|
15041
15069
|
if (lhs.type.kind === 'value' && rhs.type.kind !== 'value') {
|
|
15042
15070
|
// (value, T)
|
|
15043
|
-
lhs = new Assertion
|
|
15071
|
+
lhs = new Assertion(rhs.type, [lhs]);
|
|
15044
15072
|
} else if (lhs.type.kind !== 'value' && rhs.type.kind === 'value') {
|
|
15045
15073
|
// (T, value)
|
|
15046
|
-
rhs = new Assertion
|
|
15074
|
+
rhs = new Assertion(lhs.type, [rhs]);
|
|
15047
15075
|
}
|
|
15048
15076
|
}
|
|
15049
15077
|
let collator = null;
|
|
@@ -15065,7 +15093,7 @@
|
|
|
15065
15093
|
const rt = typeOf(rhs);
|
|
15066
15094
|
// check that type is string or number, and equal
|
|
15067
15095
|
if (lt.kind !== rt.kind || !(lt.kind === 'string' || lt.kind === 'number')) {
|
|
15068
|
-
throw new RuntimeError
|
|
15096
|
+
throw new RuntimeError(`Expected arguments for "${ op }" to be (string, string) or (number, number), but found (${ lt.kind }, ${ rt.kind }) instead.`);
|
|
15069
15097
|
}
|
|
15070
15098
|
}
|
|
15071
15099
|
if (this.collator && !isOrderComparison && this.hasUntypedArgument) {
|
|
@@ -15238,7 +15266,7 @@
|
|
|
15238
15266
|
} else if (Array.isArray(input)) {
|
|
15239
15267
|
return input.length;
|
|
15240
15268
|
} else {
|
|
15241
|
-
throw new RuntimeError
|
|
15269
|
+
throw new RuntimeError(`Expected value to be of type string or array, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
15242
15270
|
}
|
|
15243
15271
|
}
|
|
15244
15272
|
eachChild(fn) {
|
|
@@ -15255,7 +15283,6 @@
|
|
|
15255
15283
|
return serialized;
|
|
15256
15284
|
}
|
|
15257
15285
|
}
|
|
15258
|
-
var Length$1 = Length;
|
|
15259
15286
|
|
|
15260
15287
|
//
|
|
15261
15288
|
// Seeded pseudo random generator function
|
|
@@ -15279,14 +15306,14 @@
|
|
|
15279
15306
|
'>=': GreaterThanOrEqual,
|
|
15280
15307
|
'<=': LessThanOrEqual,
|
|
15281
15308
|
// $FlowFixMe[method-unbinding]
|
|
15282
|
-
'array': Assertion
|
|
15309
|
+
'array': Assertion,
|
|
15283
15310
|
// $FlowFixMe[method-unbinding]
|
|
15284
|
-
'at': At
|
|
15285
|
-
'boolean': Assertion
|
|
15311
|
+
'at': At,
|
|
15312
|
+
'boolean': Assertion,
|
|
15286
15313
|
// $FlowFixMe[method-unbinding]
|
|
15287
|
-
'case': Case
|
|
15314
|
+
'case': Case,
|
|
15288
15315
|
// $FlowFixMe[method-unbinding]
|
|
15289
|
-
'coalesce': Coalesce
|
|
15316
|
+
'coalesce': Coalesce,
|
|
15290
15317
|
// $FlowFixMe[method-unbinding]
|
|
15291
15318
|
'collator': CollatorExpression,
|
|
15292
15319
|
// $FlowFixMe[method-unbinding]
|
|
@@ -15294,43 +15321,43 @@
|
|
|
15294
15321
|
// $FlowFixMe[method-unbinding]
|
|
15295
15322
|
'image': ImageExpression,
|
|
15296
15323
|
// $FlowFixMe[method-unbinding]
|
|
15297
|
-
'in': In
|
|
15324
|
+
'in': In,
|
|
15298
15325
|
// $FlowFixMe[method-unbinding]
|
|
15299
|
-
'index-of': IndexOf
|
|
15326
|
+
'index-of': IndexOf,
|
|
15300
15327
|
// $FlowFixMe[method-unbinding]
|
|
15301
|
-
'interpolate': Interpolate
|
|
15302
|
-
'interpolate-hcl': Interpolate
|
|
15303
|
-
'interpolate-lab': Interpolate
|
|
15328
|
+
'interpolate': Interpolate,
|
|
15329
|
+
'interpolate-hcl': Interpolate,
|
|
15330
|
+
'interpolate-lab': Interpolate,
|
|
15304
15331
|
// $FlowFixMe[method-unbinding]
|
|
15305
|
-
'length': Length
|
|
15332
|
+
'length': Length,
|
|
15306
15333
|
// $FlowFixMe[method-unbinding]
|
|
15307
|
-
'let': Let
|
|
15334
|
+
'let': Let,
|
|
15308
15335
|
// $FlowFixMe[method-unbinding]
|
|
15309
|
-
'literal': Literal
|
|
15336
|
+
'literal': Literal,
|
|
15310
15337
|
// $FlowFixMe[method-unbinding]
|
|
15311
|
-
'match': Match
|
|
15312
|
-
'number': Assertion
|
|
15338
|
+
'match': Match,
|
|
15339
|
+
'number': Assertion,
|
|
15313
15340
|
// $FlowFixMe[method-unbinding]
|
|
15314
15341
|
'number-format': NumberFormat,
|
|
15315
|
-
'object': Assertion
|
|
15342
|
+
'object': Assertion,
|
|
15316
15343
|
// $FlowFixMe[method-unbinding]
|
|
15317
|
-
'slice': Slice
|
|
15344
|
+
'slice': Slice,
|
|
15318
15345
|
// $FlowFixMe[method-unbinding]
|
|
15319
|
-
'step': Step
|
|
15320
|
-
'string': Assertion
|
|
15346
|
+
'step': Step,
|
|
15347
|
+
'string': Assertion,
|
|
15321
15348
|
// $FlowFixMe[method-unbinding]
|
|
15322
|
-
'to-boolean': Coercion
|
|
15323
|
-
'to-color': Coercion
|
|
15324
|
-
'to-number': Coercion
|
|
15325
|
-
'to-string': Coercion
|
|
15349
|
+
'to-boolean': Coercion,
|
|
15350
|
+
'to-color': Coercion,
|
|
15351
|
+
'to-number': Coercion,
|
|
15352
|
+
'to-string': Coercion,
|
|
15326
15353
|
// $FlowFixMe[method-unbinding]
|
|
15327
|
-
'var': Var
|
|
15354
|
+
'var': Var,
|
|
15328
15355
|
// $FlowFixMe[method-unbinding]
|
|
15329
|
-
'within': Within
|
|
15356
|
+
'within': Within,
|
|
15330
15357
|
// $FlowFixMe[method-unbinding]
|
|
15331
|
-
'distance': Distance
|
|
15358
|
+
'distance': Distance,
|
|
15332
15359
|
// $FlowFixMe[method-unbinding]
|
|
15333
|
-
'config': Config
|
|
15360
|
+
'config': Config
|
|
15334
15361
|
};
|
|
15335
15362
|
function rgba(ctx, [r, g, b, a]) {
|
|
15336
15363
|
r = r.evaluate(ctx);
|
|
@@ -15339,7 +15366,7 @@
|
|
|
15339
15366
|
const alpha = a ? a.evaluate(ctx) : 1;
|
|
15340
15367
|
const error = validateRGBA(r, g, b, alpha);
|
|
15341
15368
|
if (error)
|
|
15342
|
-
throw new RuntimeError
|
|
15369
|
+
throw new RuntimeError(error);
|
|
15343
15370
|
return new Color$1(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);
|
|
15344
15371
|
}
|
|
15345
15372
|
function hsla(ctx, [h, s, l, a]) {
|
|
@@ -15349,11 +15376,11 @@
|
|
|
15349
15376
|
const alpha = a ? a.evaluate(ctx) : 1;
|
|
15350
15377
|
const error = validateHSLA(h, s, l, alpha);
|
|
15351
15378
|
if (error)
|
|
15352
|
-
throw new RuntimeError
|
|
15379
|
+
throw new RuntimeError(error);
|
|
15353
15380
|
const colorFunction = `hsla(${ h }, ${ s }%, ${ l }%, ${ alpha })`;
|
|
15354
15381
|
const color = Color$1.parse(colorFunction);
|
|
15355
15382
|
if (!color)
|
|
15356
|
-
throw new RuntimeError
|
|
15383
|
+
throw new RuntimeError(`Failed to parse HSLA color: ${ colorFunction }`);
|
|
15357
15384
|
return color;
|
|
15358
15385
|
}
|
|
15359
15386
|
function has(key, obj) {
|
|
@@ -15390,12 +15417,12 @@
|
|
|
15390
15417
|
}
|
|
15391
15418
|
return hash;
|
|
15392
15419
|
}
|
|
15393
|
-
CompoundExpression
|
|
15420
|
+
CompoundExpression.register(expressions, {
|
|
15394
15421
|
'error': [
|
|
15395
15422
|
ErrorType,
|
|
15396
15423
|
[StringType],
|
|
15397
15424
|
(ctx, [v]) => {
|
|
15398
|
-
throw new RuntimeError
|
|
15425
|
+
throw new RuntimeError(v.evaluate(ctx));
|
|
15399
15426
|
}
|
|
15400
15427
|
],
|
|
15401
15428
|
'typeof': [
|
|
@@ -15955,14 +15982,13 @@
|
|
|
15955
15982
|
} else if (typeof seed === 'number') {
|
|
15956
15983
|
seedVal = seed;
|
|
15957
15984
|
} else {
|
|
15958
|
-
throw new RuntimeError
|
|
15985
|
+
throw new RuntimeError(`Invalid seed input: ${ seed }`);
|
|
15959
15986
|
}
|
|
15960
15987
|
const random = mulberry32(seedVal)();
|
|
15961
15988
|
return min + random * (max - min);
|
|
15962
15989
|
}
|
|
15963
15990
|
]
|
|
15964
15991
|
});
|
|
15965
|
-
var definitions = expressions;
|
|
15966
15992
|
|
|
15967
15993
|
//
|
|
15968
15994
|
/**
|
|
@@ -16087,7 +16113,7 @@
|
|
|
16087
16113
|
return {
|
|
16088
16114
|
kind: 'composite',
|
|
16089
16115
|
interpolationType,
|
|
16090
|
-
interpolationFactor: Interpolate
|
|
16116
|
+
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
16091
16117
|
zoomStops: featureFunctionStops.map(s => s[0]),
|
|
16092
16118
|
evaluate({zoom}, properties) {
|
|
16093
16119
|
return evaluateExponentialFunction({
|
|
@@ -16104,7 +16130,7 @@
|
|
|
16104
16130
|
return {
|
|
16105
16131
|
kind: 'camera',
|
|
16106
16132
|
interpolationType,
|
|
16107
|
-
interpolationFactor: Interpolate
|
|
16133
|
+
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
16108
16134
|
zoomStops: parameters.stops.map(s => s[0]),
|
|
16109
16135
|
evaluate: ({zoom}) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)
|
|
16110
16136
|
};
|
|
@@ -16252,7 +16278,7 @@
|
|
|
16252
16278
|
constructor(expression, propertySpec, scope, options) {
|
|
16253
16279
|
this.expression = expression;
|
|
16254
16280
|
this._warningHistory = {};
|
|
16255
|
-
this._evaluator = new EvaluationContext
|
|
16281
|
+
this._evaluator = new EvaluationContext(scope, options);
|
|
16256
16282
|
this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
|
|
16257
16283
|
this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;
|
|
16258
16284
|
}
|
|
@@ -16283,7 +16309,7 @@
|
|
|
16283
16309
|
return this._defaultValue;
|
|
16284
16310
|
}
|
|
16285
16311
|
if (this._enumValues && !(val in this._enumValues)) {
|
|
16286
|
-
throw new RuntimeError
|
|
16312
|
+
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.`);
|
|
16287
16313
|
}
|
|
16288
16314
|
return val;
|
|
16289
16315
|
} catch (e) {
|
|
@@ -16298,7 +16324,7 @@
|
|
|
16298
16324
|
}
|
|
16299
16325
|
}
|
|
16300
16326
|
function isExpression(expression) {
|
|
16301
|
-
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in
|
|
16327
|
+
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in expressions;
|
|
16302
16328
|
}
|
|
16303
16329
|
/**
|
|
16304
16330
|
* Parse and typecheck the given style spec JSON expression. If
|
|
@@ -16310,7 +16336,7 @@
|
|
|
16310
16336
|
* @private
|
|
16311
16337
|
*/
|
|
16312
16338
|
function createExpression(expression, propertySpec, scope, options) {
|
|
16313
|
-
const parser = new ParsingContext
|
|
16339
|
+
const parser = new ParsingContext(expressions, [], propertySpec ? getExpectedType(propertySpec) : undefined, undefined, undefined, scope, options);
|
|
16314
16340
|
// For string-valued properties, coerce to string at the top level rather than asserting.
|
|
16315
16341
|
const parsed = parser.parse(expression, undefined, undefined, undefined, propertySpec && propertySpec.type === 'string' ? { typeAnnotation: 'coerce' } : undefined);
|
|
16316
16342
|
if (!parsed) {
|
|
@@ -16351,7 +16377,7 @@
|
|
|
16351
16377
|
}
|
|
16352
16378
|
interpolationFactor(input, lower, upper) {
|
|
16353
16379
|
if (this.interpolationType) {
|
|
16354
|
-
return Interpolate
|
|
16380
|
+
return Interpolate.interpolationFactor(this.interpolationType, input, lower, upper);
|
|
16355
16381
|
} else {
|
|
16356
16382
|
return 0;
|
|
16357
16383
|
}
|
|
@@ -16365,7 +16391,7 @@
|
|
|
16365
16391
|
const parsed = expression.value.expression;
|
|
16366
16392
|
const isFeatureConstant$1 = isFeatureConstant(parsed);
|
|
16367
16393
|
if (!isFeatureConstant$1 && !supportsPropertyExpression(propertySpec)) {
|
|
16368
|
-
return error([new ParsingError$
|
|
16394
|
+
return error([new ParsingError$1('', 'data expressions not supported')]);
|
|
16369
16395
|
}
|
|
16370
16396
|
const isZoomConstant = isGlobalPropertyConstant(parsed, [
|
|
16371
16397
|
'zoom',
|
|
@@ -16373,25 +16399,25 @@
|
|
|
16373
16399
|
'distance-from-center'
|
|
16374
16400
|
]);
|
|
16375
16401
|
if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {
|
|
16376
|
-
return error([new ParsingError$
|
|
16402
|
+
return error([new ParsingError$1('', 'zoom expressions not supported')]);
|
|
16377
16403
|
}
|
|
16378
16404
|
const isLightConstant = isGlobalPropertyConstant(parsed, ['measure-light']);
|
|
16379
16405
|
if (!isLightConstant && !supportsLightExpression(propertySpec)) {
|
|
16380
|
-
return error([new ParsingError$
|
|
16406
|
+
return error([new ParsingError$1('', 'measure-light expression not supported')]);
|
|
16381
16407
|
}
|
|
16382
16408
|
const canRelaxZoomRestriction = propertySpec.expression && propertySpec.expression.relaxZoomRestriction;
|
|
16383
16409
|
const zoomCurve = findZoomCurve(parsed);
|
|
16384
16410
|
if (!zoomCurve && !isZoomConstant && !canRelaxZoomRestriction) {
|
|
16385
|
-
return error([new ParsingError$
|
|
16386
|
-
} else if (zoomCurve instanceof ParsingError$
|
|
16411
|
+
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.')]);
|
|
16412
|
+
} else if (zoomCurve instanceof ParsingError$1) {
|
|
16387
16413
|
return error([zoomCurve]);
|
|
16388
|
-
} else if (zoomCurve instanceof Interpolate
|
|
16389
|
-
return error([new ParsingError$
|
|
16414
|
+
} else if (zoomCurve instanceof Interpolate && !supportsInterpolation(propertySpec)) {
|
|
16415
|
+
return error([new ParsingError$1('', '"interpolate" expressions cannot be used with this property')]);
|
|
16390
16416
|
}
|
|
16391
16417
|
if (!zoomCurve) {
|
|
16392
16418
|
return success(isFeatureConstant$1 ? new ZoomConstantExpression('constant', expression.value, isLightConstant) : new ZoomConstantExpression('source', expression.value, isLightConstant));
|
|
16393
16419
|
}
|
|
16394
|
-
const interpolationType = zoomCurve instanceof Interpolate
|
|
16420
|
+
const interpolationType = zoomCurve instanceof Interpolate ? zoomCurve.interpolation : undefined;
|
|
16395
16421
|
return success(isFeatureConstant$1 ? new ZoomDependentExpression('camera', expression.value, zoomCurve.labels, interpolationType, isLightConstant) : new ZoomDependentExpression('composite', expression.value, zoomCurve.labels, interpolationType, isLightConstant));
|
|
16396
16422
|
}
|
|
16397
16423
|
// serialization wrapper for old-style stop functions normalized to the
|
|
@@ -16439,27 +16465,27 @@
|
|
|
16439
16465
|
// "coalesce" expressions.
|
|
16440
16466
|
function findZoomCurve(expression) {
|
|
16441
16467
|
let result = null;
|
|
16442
|
-
if (expression instanceof Let
|
|
16468
|
+
if (expression instanceof Let) {
|
|
16443
16469
|
result = findZoomCurve(expression.result);
|
|
16444
|
-
} else if (expression instanceof Coalesce
|
|
16470
|
+
} else if (expression instanceof Coalesce) {
|
|
16445
16471
|
for (const arg of expression.args) {
|
|
16446
16472
|
result = findZoomCurve(arg);
|
|
16447
16473
|
if (result) {
|
|
16448
16474
|
break;
|
|
16449
16475
|
}
|
|
16450
16476
|
}
|
|
16451
|
-
} else if ((expression instanceof Step
|
|
16477
|
+
} else if ((expression instanceof Step || expression instanceof Interpolate) && expression.input instanceof CompoundExpression && expression.input.name === 'zoom') {
|
|
16452
16478
|
result = expression;
|
|
16453
16479
|
}
|
|
16454
|
-
if (result instanceof ParsingError$
|
|
16480
|
+
if (result instanceof ParsingError$1) {
|
|
16455
16481
|
return result;
|
|
16456
16482
|
}
|
|
16457
16483
|
expression.eachChild(child => {
|
|
16458
16484
|
const childResult = findZoomCurve(child);
|
|
16459
|
-
if (childResult instanceof ParsingError$
|
|
16485
|
+
if (childResult instanceof ParsingError$1) {
|
|
16460
16486
|
result = childResult;
|
|
16461
16487
|
} else if (result && childResult && result !== childResult) {
|
|
16462
|
-
result = new ParsingError$
|
|
16488
|
+
result = new ParsingError$1('', 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.');
|
|
16463
16489
|
}
|
|
16464
16490
|
});
|
|
16465
16491
|
return result;
|
|
@@ -18608,7 +18634,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
18608
18634
|
return [];
|
|
18609
18635
|
}
|
|
18610
18636
|
const errors = [];
|
|
18611
|
-
if (e instanceof CompoundExpression
|
|
18637
|
+
if (e instanceof CompoundExpression) {
|
|
18612
18638
|
if (disallowedParameters.has(e.name)) {
|
|
18613
18639
|
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 }`)];
|
|
18614
18640
|
}
|
|
@@ -19107,10 +19133,10 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
19107
19133
|
|
|
19108
19134
|
//
|
|
19109
19135
|
// Allow any URL, use dummy base, if it's a relative URL
|
|
19110
|
-
function isValidUrl(str) {
|
|
19136
|
+
function isValidUrl(str, allowRelativeUrls) {
|
|
19111
19137
|
const isRelative = str.indexOf('://') === -1;
|
|
19112
19138
|
try {
|
|
19113
|
-
new URL(str, isRelative ? 'http://example.com' : undefined);
|
|
19139
|
+
new URL(str, isRelative && allowRelativeUrls ? 'http://example.com' : undefined);
|
|
19114
19140
|
return true;
|
|
19115
19141
|
} catch (_) {
|
|
19116
19142
|
return false;
|
|
@@ -19127,7 +19153,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
19127
19153
|
errors = errors.concat([new ValidationError(options.key, url, `string expected, "${ type }" found`)]);
|
|
19128
19154
|
return errors;
|
|
19129
19155
|
}
|
|
19130
|
-
if (!isValidUrl(url)) {
|
|
19156
|
+
if (!isValidUrl(url, true)) {
|
|
19131
19157
|
errors = errors.concat([new ValidationError(options.key, url, `invalid url "${ url }"`)]);
|
|
19132
19158
|
}
|
|
19133
19159
|
return errors;
|