@mapbox/mapbox-gl-style-spec 13.24.0-beta.1 → 13.25.0-beta.2
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/CHANGELOG.md +14 -1
- package/dist/index.cjs +415 -207
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +407 -199
- package/dist/index.es.js.map +1 -1
- package/expression/index.js +1 -1
- package/flow-typed/gl-matrix.js +8 -1
- package/package.json +1 -1
- package/reference/v8.json +152 -8
- package/types.js +7 -3
- package/util/color.js +35 -0
- package/validate/validate_layer.js +2 -0
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.mapboxGlStyleSpecification = {}));
|
|
5
|
-
}(this, (function (exports) { 'use strict';
|
|
5
|
+
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var $version = 8;
|
|
8
8
|
var $root = {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
fog: {
|
|
70
70
|
type: "fog",
|
|
71
|
-
doc: "A global effect that fades layers and markers based on their distance to the camera. The fog can be used to approximate the effect of atmosphere on distant objects and enhance the depth perception of the map when used with terrain or 3D features."
|
|
71
|
+
doc: "A global effect that fades layers and markers based on their distance to the camera. The fog can be used to approximate the effect of atmosphere on distant objects and enhance the depth perception of the map when used with terrain or 3D features. Note: fog is renamed to atmosphere in the Android and iOS SDKs and planned to be changed in GL-JS v.3.0.0."
|
|
72
72
|
},
|
|
73
73
|
sources: {
|
|
74
74
|
required: true,
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
},
|
|
102
102
|
projection: {
|
|
103
103
|
type: "projection",
|
|
104
|
-
doc: "The projection the map should be rendered in. Supported projections are Albers, Equal Earth, Equirectangular (WGS84), Lambert conformal conic, Mercator, Natural Earth, and Winkel Tripel. Terrain, fog, sky and CustomLayerInterface are not supported for projections other than mercator.",
|
|
104
|
+
doc: "The projection the map should be rendered in. Supported projections are Albers, Equal Earth, Equirectangular (WGS84), Lambert conformal conic, Mercator, Natural Earth, Globe, and Winkel Tripel. Terrain, fog, sky and CustomLayerInterface are not supported for projections other than mercator.",
|
|
105
105
|
example: {
|
|
106
106
|
name: "albers",
|
|
107
107
|
center: [
|
|
@@ -2642,7 +2642,7 @@
|
|
|
2642
2642
|
length: 2,
|
|
2643
2643
|
doc: "Zoom level and value pair."
|
|
2644
2644
|
};
|
|
2645
|
-
var expression = {
|
|
2645
|
+
var expression$1 = {
|
|
2646
2646
|
type: "array",
|
|
2647
2647
|
value: "*",
|
|
2648
2648
|
minimum: 1,
|
|
@@ -3747,7 +3747,9 @@
|
|
|
3747
3747
|
],
|
|
3748
3748
|
"sdk-support": {
|
|
3749
3749
|
"basic functionality": {
|
|
3750
|
-
js: "2.3.0"
|
|
3750
|
+
js: "2.3.0",
|
|
3751
|
+
android: "10.6.0",
|
|
3752
|
+
ios: "10.6.0"
|
|
3751
3753
|
}
|
|
3752
3754
|
}
|
|
3753
3755
|
},
|
|
@@ -3762,17 +3764,83 @@
|
|
|
3762
3764
|
]
|
|
3763
3765
|
},
|
|
3764
3766
|
transition: true,
|
|
3765
|
-
doc: "The color of the
|
|
3767
|
+
doc: "The color of the atmosphere region immediately below the horizon and within the `range` and above the horizon and within `horizon-blend`. Using opacity is recommended only for smoothly transitioning fog on/off as anything less than 100% opacity results in more tiles loaded and drawn.",
|
|
3766
3768
|
"sdk-support": {
|
|
3767
3769
|
"basic functionality": {
|
|
3768
|
-
js: "2.3.0"
|
|
3770
|
+
js: "2.3.0",
|
|
3771
|
+
android: "10.6.0",
|
|
3772
|
+
ios: "10.6.0"
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3775
|
+
},
|
|
3776
|
+
"high-color": {
|
|
3777
|
+
type: "color",
|
|
3778
|
+
"property-type": "data-constant",
|
|
3779
|
+
"default": "#245cdf",
|
|
3780
|
+
expression: {
|
|
3781
|
+
interpolated: true,
|
|
3782
|
+
parameters: [
|
|
3783
|
+
"zoom"
|
|
3784
|
+
]
|
|
3785
|
+
},
|
|
3786
|
+
transition: true,
|
|
3787
|
+
doc: "The color of the atmosphere region above the horizon, `high-color` extends further above the horizon than the `color` property and its spread can be controlled with `horizon-blend`. The opacity can be set to `0` to remove the high atmosphere color contribution.",
|
|
3788
|
+
"sdk-support": {
|
|
3789
|
+
"basic functionality": {
|
|
3790
|
+
js: "2.9.0",
|
|
3791
|
+
android: "10.6.0",
|
|
3792
|
+
ios: "10.6.0"
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
},
|
|
3796
|
+
"space-color": {
|
|
3797
|
+
type: "color",
|
|
3798
|
+
"property-type": "data-constant",
|
|
3799
|
+
"default": [
|
|
3800
|
+
"interpolate",
|
|
3801
|
+
[
|
|
3802
|
+
"linear"
|
|
3803
|
+
],
|
|
3804
|
+
[
|
|
3805
|
+
"zoom"
|
|
3806
|
+
],
|
|
3807
|
+
4,
|
|
3808
|
+
"#010b19",
|
|
3809
|
+
7,
|
|
3810
|
+
"#367ab9"
|
|
3811
|
+
],
|
|
3812
|
+
expression: {
|
|
3813
|
+
interpolated: true,
|
|
3814
|
+
parameters: [
|
|
3815
|
+
"zoom"
|
|
3816
|
+
]
|
|
3817
|
+
},
|
|
3818
|
+
transition: true,
|
|
3819
|
+
doc: "The color of the region above the horizon and after the end of the `horizon-blend` contribution. The opacity can be set to `0` to have a transparent background.",
|
|
3820
|
+
"sdk-support": {
|
|
3821
|
+
"basic functionality": {
|
|
3822
|
+
js: "2.9.0",
|
|
3823
|
+
android: "10.6.0",
|
|
3824
|
+
ios: "10.6.0"
|
|
3769
3825
|
}
|
|
3770
3826
|
}
|
|
3771
3827
|
},
|
|
3772
3828
|
"horizon-blend": {
|
|
3773
3829
|
type: "number",
|
|
3774
3830
|
"property-type": "data-constant",
|
|
3775
|
-
"default":
|
|
3831
|
+
"default": [
|
|
3832
|
+
"interpolate",
|
|
3833
|
+
[
|
|
3834
|
+
"linear"
|
|
3835
|
+
],
|
|
3836
|
+
[
|
|
3837
|
+
"zoom"
|
|
3838
|
+
],
|
|
3839
|
+
4,
|
|
3840
|
+
0.2,
|
|
3841
|
+
7,
|
|
3842
|
+
0.1
|
|
3843
|
+
],
|
|
3776
3844
|
minimum: 0,
|
|
3777
3845
|
maximum: 1,
|
|
3778
3846
|
expression: {
|
|
@@ -3782,10 +3850,46 @@
|
|
|
3782
3850
|
]
|
|
3783
3851
|
},
|
|
3784
3852
|
transition: true,
|
|
3785
|
-
doc: "Horizon blend applies a smooth fade from the color of the
|
|
3853
|
+
doc: "Horizon blend applies a smooth fade from the color of the atmosphere to the color of space. A value of zero leaves a sharp transition from atmosphere to space. Increasing the value blends the color of atmosphere into increasingly high angles of the sky.",
|
|
3786
3854
|
"sdk-support": {
|
|
3787
3855
|
"basic functionality": {
|
|
3788
|
-
js: "2.3.0"
|
|
3856
|
+
js: "2.3.0",
|
|
3857
|
+
android: "10.6.0",
|
|
3858
|
+
ios: "10.6.0"
|
|
3859
|
+
}
|
|
3860
|
+
}
|
|
3861
|
+
},
|
|
3862
|
+
"star-intensity": {
|
|
3863
|
+
type: "number",
|
|
3864
|
+
"property-type": "data-constant",
|
|
3865
|
+
"default": [
|
|
3866
|
+
"interpolate",
|
|
3867
|
+
[
|
|
3868
|
+
"linear"
|
|
3869
|
+
],
|
|
3870
|
+
[
|
|
3871
|
+
"zoom"
|
|
3872
|
+
],
|
|
3873
|
+
5,
|
|
3874
|
+
0.35,
|
|
3875
|
+
6,
|
|
3876
|
+
0
|
|
3877
|
+
],
|
|
3878
|
+
minimum: 0,
|
|
3879
|
+
maximum: 1,
|
|
3880
|
+
expression: {
|
|
3881
|
+
interpolated: true,
|
|
3882
|
+
parameters: [
|
|
3883
|
+
"zoom"
|
|
3884
|
+
]
|
|
3885
|
+
},
|
|
3886
|
+
transition: true,
|
|
3887
|
+
doc: "A value controlling the star intensity where `0` will show no stars and `1` will show stars at their maximum intensity.",
|
|
3888
|
+
"sdk-support": {
|
|
3889
|
+
"basic functionality": {
|
|
3890
|
+
js: "2.9.0",
|
|
3891
|
+
android: "10.6.0",
|
|
3892
|
+
ios: "10.6.0"
|
|
3789
3893
|
}
|
|
3790
3894
|
}
|
|
3791
3895
|
}
|
|
@@ -3922,6 +4026,9 @@
|
|
|
3922
4026
|
},
|
|
3923
4027
|
winkelTripel: {
|
|
3924
4028
|
doc: "A Winkel Tripel projection."
|
|
4029
|
+
},
|
|
4030
|
+
globe: {
|
|
4031
|
+
doc: "A globe projection."
|
|
3925
4032
|
}
|
|
3926
4033
|
},
|
|
3927
4034
|
"default": "mercator",
|
|
@@ -3938,6 +4045,14 @@
|
|
|
3938
4045
|
length: 2,
|
|
3939
4046
|
value: "number",
|
|
3940
4047
|
"property-type": "data-constant",
|
|
4048
|
+
minimum: [
|
|
4049
|
+
-180,
|
|
4050
|
+
-90
|
|
4051
|
+
],
|
|
4052
|
+
maximum: [
|
|
4053
|
+
180,
|
|
4054
|
+
90
|
|
4055
|
+
],
|
|
3941
4056
|
transition: false,
|
|
3942
4057
|
doc: "The reference longitude and latitude of the projection. `center` takes the form of [lng, lat]. This property is only configurable for conic projections (Albers and Lambert Conformal Conic). All other projections are centered on [0, 0].",
|
|
3943
4058
|
example: [
|
|
@@ -3963,6 +4078,14 @@
|
|
|
3963
4078
|
length: 2,
|
|
3964
4079
|
value: "number",
|
|
3965
4080
|
"property-type": "data-constant",
|
|
4081
|
+
minimum: [
|
|
4082
|
+
-90,
|
|
4083
|
+
-90
|
|
4084
|
+
],
|
|
4085
|
+
maximum: [
|
|
4086
|
+
90,
|
|
4087
|
+
90
|
|
4088
|
+
],
|
|
3966
4089
|
transition: false,
|
|
3967
4090
|
doc: "The standard parallels of the projection, denoting the desired latitude range with minimal distortion. `parallels` takes the form of [lat0, lat1]. This property is only configurable for conic projections (Albers and Lambert Conformal Conic).",
|
|
3968
4091
|
example: [
|
|
@@ -4011,6 +4134,9 @@
|
|
|
4011
4134
|
},
|
|
4012
4135
|
transition: true,
|
|
4013
4136
|
doc: "Exaggerates the elevation of the terrain by multiplying the data from the DEM with this value.",
|
|
4137
|
+
requires: [
|
|
4138
|
+
"source"
|
|
4139
|
+
],
|
|
4014
4140
|
"sdk-support": {
|
|
4015
4141
|
"basic functionality": {
|
|
4016
4142
|
js: "2.0.0",
|
|
@@ -4578,6 +4704,35 @@
|
|
|
4578
4704
|
]
|
|
4579
4705
|
},
|
|
4580
4706
|
"property-type": "color-ramp"
|
|
4707
|
+
},
|
|
4708
|
+
"line-trim-offset": {
|
|
4709
|
+
type: "array",
|
|
4710
|
+
value: "number",
|
|
4711
|
+
doc: "The line part between [trim-start, trim-end] will be marked as transparent to make a route vanishing effect. The line trim-off offset is based on the whole line gradient range [0.0, 1.0]. If either 'trim-start' or 'trim-end' offset is out of valid range, the default range will be set.",
|
|
4712
|
+
length: 2,
|
|
4713
|
+
"default": [
|
|
4714
|
+
0,
|
|
4715
|
+
0
|
|
4716
|
+
],
|
|
4717
|
+
transition: false,
|
|
4718
|
+
requires: [
|
|
4719
|
+
"line-gradient",
|
|
4720
|
+
{
|
|
4721
|
+
source: "geojson",
|
|
4722
|
+
has: {
|
|
4723
|
+
lineMetrics: true
|
|
4724
|
+
}
|
|
4725
|
+
}
|
|
4726
|
+
],
|
|
4727
|
+
"sdk-support": {
|
|
4728
|
+
"basic functionality": {
|
|
4729
|
+
js: "2.3.0",
|
|
4730
|
+
android: "10.5.0",
|
|
4731
|
+
ios: "10.5.0",
|
|
4732
|
+
macos: "10.5.0"
|
|
4733
|
+
}
|
|
4734
|
+
},
|
|
4735
|
+
"property-type": "constant"
|
|
4581
4736
|
}
|
|
4582
4737
|
};
|
|
4583
4738
|
var paint_circle = {
|
|
@@ -6323,7 +6478,7 @@
|
|
|
6323
6478
|
}
|
|
6324
6479
|
},
|
|
6325
6480
|
function_stop: function_stop,
|
|
6326
|
-
expression: expression,
|
|
6481
|
+
expression: expression$1,
|
|
6327
6482
|
expression_name: expression_name,
|
|
6328
6483
|
fog: fog,
|
|
6329
6484
|
light: light,
|
|
@@ -6697,6 +6852,8 @@
|
|
|
6697
6852
|
})(passedObj, "", 0);
|
|
6698
6853
|
};
|
|
6699
6854
|
|
|
6855
|
+
var stringifyPretty = jsonStringifyPrettyCompact;
|
|
6856
|
+
|
|
6700
6857
|
function sortKeysBy(obj, reference) {
|
|
6701
6858
|
const result = {};
|
|
6702
6859
|
for (const key in reference) {
|
|
@@ -6711,12 +6868,12 @@
|
|
|
6711
6868
|
}
|
|
6712
6869
|
return result;
|
|
6713
6870
|
}
|
|
6714
|
-
function format(style, space = 2) {
|
|
6871
|
+
function format$1(style, space = 2) {
|
|
6715
6872
|
style = sortKeysBy(style, v8.$root);
|
|
6716
6873
|
if (style.layers) {
|
|
6717
6874
|
style.layers = style.layers.map(layer => sortKeysBy(layer, v8.layer));
|
|
6718
6875
|
}
|
|
6719
|
-
return
|
|
6876
|
+
return stringifyPretty(style, { indent: space });
|
|
6720
6877
|
}
|
|
6721
6878
|
|
|
6722
6879
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -7384,7 +7541,7 @@
|
|
|
7384
7541
|
var parse = urlParse;
|
|
7385
7542
|
var resolve = urlResolve;
|
|
7386
7543
|
var resolveObject = urlResolveObject;
|
|
7387
|
-
var format
|
|
7544
|
+
var format = urlFormat;
|
|
7388
7545
|
|
|
7389
7546
|
var Url_1 = Url;
|
|
7390
7547
|
|
|
@@ -8091,7 +8248,7 @@
|
|
|
8091
8248
|
parse: parse,
|
|
8092
8249
|
resolve: resolve,
|
|
8093
8250
|
resolveObject: resolveObject,
|
|
8094
|
-
format: format
|
|
8251
|
+
format: format,
|
|
8095
8252
|
Url: Url_1
|
|
8096
8253
|
};
|
|
8097
8254
|
|
|
@@ -8172,7 +8329,7 @@
|
|
|
8172
8329
|
return value;
|
|
8173
8330
|
}
|
|
8174
8331
|
}
|
|
8175
|
-
function isFunction(value) {
|
|
8332
|
+
function isFunction$1(value) {
|
|
8176
8333
|
return Array.isArray(value.stops);
|
|
8177
8334
|
}
|
|
8178
8335
|
function renameProperty(obj, from, to) {
|
|
@@ -8214,7 +8371,7 @@
|
|
|
8214
8371
|
layout: true
|
|
8215
8372
|
}, property => {
|
|
8216
8373
|
const value = resolveConstant(style, property.value);
|
|
8217
|
-
if (isFunction(value)) {
|
|
8374
|
+
if (isFunction$1(value)) {
|
|
8218
8375
|
value.stops.forEach(stop => {
|
|
8219
8376
|
stop[1] = resolveConstant(style, stop[1]);
|
|
8220
8377
|
});
|
|
@@ -8305,13 +8462,14 @@
|
|
|
8305
8462
|
return output;
|
|
8306
8463
|
}
|
|
8307
8464
|
|
|
8308
|
-
class ParsingError extends Error {
|
|
8465
|
+
class ParsingError$1 extends Error {
|
|
8309
8466
|
constructor(key, message) {
|
|
8310
8467
|
super(message);
|
|
8311
8468
|
this.message = message;
|
|
8312
8469
|
this.key = key;
|
|
8313
8470
|
}
|
|
8314
8471
|
}
|
|
8472
|
+
var ParsingError$2 = ParsingError$1;
|
|
8315
8473
|
|
|
8316
8474
|
class Scope {
|
|
8317
8475
|
constructor(parent, bindings = []) {
|
|
@@ -8339,6 +8497,7 @@
|
|
|
8339
8497
|
return this.parent ? this.parent.has(name) : false;
|
|
8340
8498
|
}
|
|
8341
8499
|
}
|
|
8500
|
+
var Scope$1 = Scope;
|
|
8342
8501
|
|
|
8343
8502
|
const NullType = { kind: 'null' };
|
|
8344
8503
|
const NumberType = { kind: 'number' };
|
|
@@ -8351,16 +8510,16 @@
|
|
|
8351
8510
|
const CollatorType = { kind: 'collator' };
|
|
8352
8511
|
const FormattedType = { kind: 'formatted' };
|
|
8353
8512
|
const ResolvedImageType = { kind: 'resolvedImage' };
|
|
8354
|
-
function array(itemType, N) {
|
|
8513
|
+
function array$1(itemType, N) {
|
|
8355
8514
|
return {
|
|
8356
8515
|
kind: 'array',
|
|
8357
8516
|
itemType,
|
|
8358
8517
|
N
|
|
8359
8518
|
};
|
|
8360
8519
|
}
|
|
8361
|
-
function toString(type) {
|
|
8520
|
+
function toString$1(type) {
|
|
8362
8521
|
if (type.kind === 'array') {
|
|
8363
|
-
const itemType = toString(type.itemType);
|
|
8522
|
+
const itemType = toString$1(type.itemType);
|
|
8364
8523
|
return typeof type.N === 'number' ? `array<${ itemType }, ${ type.N }>` : type.itemType.kind === 'value' ? 'array' : `array<${ itemType }>`;
|
|
8365
8524
|
} else {
|
|
8366
8525
|
return type.kind;
|
|
@@ -8374,7 +8533,7 @@
|
|
|
8374
8533
|
ColorType,
|
|
8375
8534
|
FormattedType,
|
|
8376
8535
|
ObjectType,
|
|
8377
|
-
array(ValueType),
|
|
8536
|
+
array$1(ValueType),
|
|
8378
8537
|
ResolvedImageType
|
|
8379
8538
|
];
|
|
8380
8539
|
function checkSubtype(expected, t) {
|
|
@@ -8393,7 +8552,7 @@
|
|
|
8393
8552
|
}
|
|
8394
8553
|
}
|
|
8395
8554
|
}
|
|
8396
|
-
return `Expected ${ toString(expected) } but found ${ toString(t) } instead.`;
|
|
8555
|
+
return `Expected ${ toString$1(expected) } but found ${ toString$1(t) } instead.`;
|
|
8397
8556
|
}
|
|
8398
8557
|
function isValidType(provided, allowedTypes) {
|
|
8399
8558
|
return allowedTypes.some(t => t.kind === provided.kind);
|
|
@@ -8657,12 +8816,36 @@
|
|
|
8657
8816
|
a
|
|
8658
8817
|
];
|
|
8659
8818
|
}
|
|
8819
|
+
toArray01() {
|
|
8820
|
+
const {r, g, b, a} = this;
|
|
8821
|
+
return a === 0 ? [
|
|
8822
|
+
0,
|
|
8823
|
+
0,
|
|
8824
|
+
0,
|
|
8825
|
+
0
|
|
8826
|
+
] : [
|
|
8827
|
+
r / a,
|
|
8828
|
+
g / a,
|
|
8829
|
+
b / a,
|
|
8830
|
+
a
|
|
8831
|
+
];
|
|
8832
|
+
}
|
|
8833
|
+
toArray01PremultipliedAlpha() {
|
|
8834
|
+
const {r, g, b, a} = this;
|
|
8835
|
+
return [
|
|
8836
|
+
r,
|
|
8837
|
+
g,
|
|
8838
|
+
b,
|
|
8839
|
+
a
|
|
8840
|
+
];
|
|
8841
|
+
}
|
|
8660
8842
|
}
|
|
8661
8843
|
Color.black = new Color(0, 0, 0, 1);
|
|
8662
8844
|
Color.white = new Color(1, 1, 1, 1);
|
|
8663
8845
|
Color.transparent = new Color(0, 0, 0, 0);
|
|
8664
8846
|
Color.red = new Color(1, 0, 0, 1);
|
|
8665
8847
|
Color.blue = new Color(0, 0, 1, 1);
|
|
8848
|
+
var Color$1 = Color;
|
|
8666
8849
|
|
|
8667
8850
|
class Collator {
|
|
8668
8851
|
constructor(caseSensitive, diacriticSensitive, locale) {
|
|
@@ -8804,7 +8987,7 @@
|
|
|
8804
8987
|
return true;
|
|
8805
8988
|
} else if (typeof mixed === 'number') {
|
|
8806
8989
|
return true;
|
|
8807
|
-
} else if (mixed instanceof Color) {
|
|
8990
|
+
} else if (mixed instanceof Color$1) {
|
|
8808
8991
|
return true;
|
|
8809
8992
|
} else if (mixed instanceof Collator) {
|
|
8810
8993
|
return true;
|
|
@@ -8839,7 +9022,7 @@
|
|
|
8839
9022
|
return BooleanType;
|
|
8840
9023
|
} else if (typeof value === 'number') {
|
|
8841
9024
|
return NumberType;
|
|
8842
|
-
} else if (value instanceof Color) {
|
|
9025
|
+
} else if (value instanceof Color$1) {
|
|
8843
9026
|
return ColorType;
|
|
8844
9027
|
} else if (value instanceof Collator) {
|
|
8845
9028
|
return CollatorType;
|
|
@@ -8861,18 +9044,18 @@
|
|
|
8861
9044
|
break;
|
|
8862
9045
|
}
|
|
8863
9046
|
}
|
|
8864
|
-
return array(itemType || ValueType, length);
|
|
9047
|
+
return array$1(itemType || ValueType, length);
|
|
8865
9048
|
} else {
|
|
8866
9049
|
return ObjectType;
|
|
8867
9050
|
}
|
|
8868
9051
|
}
|
|
8869
|
-
function toString
|
|
9052
|
+
function toString(value) {
|
|
8870
9053
|
const type = typeof value;
|
|
8871
9054
|
if (value === null) {
|
|
8872
9055
|
return '';
|
|
8873
9056
|
} else if (type === 'string' || type === 'number' || type === 'boolean') {
|
|
8874
9057
|
return String(value);
|
|
8875
|
-
} else if (value instanceof Color || value instanceof Formatted || value instanceof ResolvedImage) {
|
|
9058
|
+
} else if (value instanceof Color$1 || value instanceof Formatted || value instanceof ResolvedImage) {
|
|
8876
9059
|
return value.toString();
|
|
8877
9060
|
} else {
|
|
8878
9061
|
return JSON.stringify(value);
|
|
@@ -8911,7 +9094,7 @@
|
|
|
8911
9094
|
'literal',
|
|
8912
9095
|
this.value
|
|
8913
9096
|
];
|
|
8914
|
-
} else if (this.value instanceof Color) {
|
|
9097
|
+
} else if (this.value instanceof Color$1) {
|
|
8915
9098
|
return ['rgba'].concat(this.value.toArray());
|
|
8916
9099
|
} else if (this.value instanceof Formatted) {
|
|
8917
9100
|
return this.value.serialize();
|
|
@@ -8920,6 +9103,7 @@
|
|
|
8920
9103
|
}
|
|
8921
9104
|
}
|
|
8922
9105
|
}
|
|
9106
|
+
var Literal$1 = Literal;
|
|
8923
9107
|
|
|
8924
9108
|
class RuntimeError {
|
|
8925
9109
|
constructor(message) {
|
|
@@ -8930,8 +9114,9 @@
|
|
|
8930
9114
|
return this.message;
|
|
8931
9115
|
}
|
|
8932
9116
|
}
|
|
9117
|
+
var RuntimeError$1 = RuntimeError;
|
|
8933
9118
|
|
|
8934
|
-
const types = {
|
|
9119
|
+
const types$1 = {
|
|
8935
9120
|
string: StringType,
|
|
8936
9121
|
number: NumberType,
|
|
8937
9122
|
boolean: BooleanType,
|
|
@@ -8952,9 +9137,9 @@
|
|
|
8952
9137
|
let itemType;
|
|
8953
9138
|
if (args.length > 2) {
|
|
8954
9139
|
const type = args[1];
|
|
8955
|
-
if (typeof type !== 'string' || !(type in types) || type === 'object')
|
|
9140
|
+
if (typeof type !== 'string' || !(type in types$1) || type === 'object')
|
|
8956
9141
|
return context.error('The item type argument of "array" must be one of string, number, boolean', 1);
|
|
8957
|
-
itemType = types[type];
|
|
9142
|
+
itemType = types$1[type];
|
|
8958
9143
|
i++;
|
|
8959
9144
|
} else {
|
|
8960
9145
|
itemType = ValueType;
|
|
@@ -8967,9 +9152,9 @@
|
|
|
8967
9152
|
N = args[2];
|
|
8968
9153
|
i++;
|
|
8969
9154
|
}
|
|
8970
|
-
type = array(itemType, N);
|
|
9155
|
+
type = array$1(itemType, N);
|
|
8971
9156
|
} else {
|
|
8972
|
-
type = types[name];
|
|
9157
|
+
type = types$1[name];
|
|
8973
9158
|
}
|
|
8974
9159
|
const parsed = [];
|
|
8975
9160
|
for (; i < args.length; i++) {
|
|
@@ -8987,7 +9172,7 @@
|
|
|
8987
9172
|
if (!error) {
|
|
8988
9173
|
return value;
|
|
8989
9174
|
} else if (i === this.args.length - 1) {
|
|
8990
|
-
throw new RuntimeError(`Expected value to be of type ${ toString(this.type) }, but found ${ toString(typeOf(value)) } instead.`);
|
|
9175
|
+
throw new RuntimeError$1(`Expected value to be of type ${ toString$1(this.type) }, but found ${ toString$1(typeOf(value)) } instead.`);
|
|
8991
9176
|
}
|
|
8992
9177
|
}
|
|
8993
9178
|
return null;
|
|
@@ -9014,6 +9199,7 @@
|
|
|
9014
9199
|
return serialized.concat(this.args.map(arg => arg.serialize()));
|
|
9015
9200
|
}
|
|
9016
9201
|
}
|
|
9202
|
+
var Assertion$1 = Assertion;
|
|
9017
9203
|
|
|
9018
9204
|
class FormatExpression {
|
|
9019
9205
|
constructor(sections) {
|
|
@@ -9042,7 +9228,7 @@
|
|
|
9042
9228
|
}
|
|
9043
9229
|
let font = null;
|
|
9044
9230
|
if (arg['text-font']) {
|
|
9045
|
-
font = context.parse(arg['text-font'], 1, array(StringType));
|
|
9231
|
+
font = context.parse(arg['text-font'], 1, array$1(StringType));
|
|
9046
9232
|
if (!font)
|
|
9047
9233
|
return null;
|
|
9048
9234
|
}
|
|
@@ -9080,7 +9266,7 @@
|
|
|
9080
9266
|
if (typeOf(evaluatedContent) === ResolvedImageType) {
|
|
9081
9267
|
return new FormattedSection('', evaluatedContent, null, null, null);
|
|
9082
9268
|
}
|
|
9083
|
-
return new FormattedSection(toString
|
|
9269
|
+
return new FormattedSection(toString(evaluatedContent), null, section.scale ? section.scale.evaluate(ctx) : null, section.font ? section.font.evaluate(ctx).join(',') : null, section.textColor ? section.textColor.evaluate(ctx) : null);
|
|
9084
9270
|
};
|
|
9085
9271
|
return new Formatted(this.sections.map(evaluateSection));
|
|
9086
9272
|
}
|
|
@@ -9156,7 +9342,7 @@
|
|
|
9156
9342
|
}
|
|
9157
9343
|
}
|
|
9158
9344
|
|
|
9159
|
-
const types
|
|
9345
|
+
const types = {
|
|
9160
9346
|
'to-boolean': BooleanType,
|
|
9161
9347
|
'to-color': ColorType,
|
|
9162
9348
|
'to-number': NumberType,
|
|
@@ -9173,7 +9359,7 @@
|
|
|
9173
9359
|
const name = args[0];
|
|
9174
9360
|
if ((name === 'to-boolean' || name === 'to-string') && args.length !== 2)
|
|
9175
9361
|
return context.error(`Expected one argument.`);
|
|
9176
|
-
const type = types
|
|
9362
|
+
const type = types[name];
|
|
9177
9363
|
const parsed = [];
|
|
9178
9364
|
for (let i = 1; i < args.length; i++) {
|
|
9179
9365
|
const input = context.parse(args[i], i, ValueType);
|
|
@@ -9192,7 +9378,7 @@
|
|
|
9192
9378
|
for (const arg of this.args) {
|
|
9193
9379
|
input = arg.evaluate(ctx);
|
|
9194
9380
|
error = null;
|
|
9195
|
-
if (input instanceof Color) {
|
|
9381
|
+
if (input instanceof Color$1) {
|
|
9196
9382
|
return input;
|
|
9197
9383
|
} else if (typeof input === 'string') {
|
|
9198
9384
|
const c = ctx.parseColor(input);
|
|
@@ -9205,11 +9391,11 @@
|
|
|
9205
9391
|
error = validateRGBA(input[0], input[1], input[2], input[3]);
|
|
9206
9392
|
}
|
|
9207
9393
|
if (!error) {
|
|
9208
|
-
return new Color(input[0] / 255, input[1] / 255, input[2] / 255, input[3]);
|
|
9394
|
+
return new Color$1(input[0] / 255, input[1] / 255, input[2] / 255, input[3]);
|
|
9209
9395
|
}
|
|
9210
9396
|
}
|
|
9211
9397
|
}
|
|
9212
|
-
throw new RuntimeError(error || `Could not parse color from value '${ typeof input === 'string' ? input : String(JSON.stringify(input)) }'`);
|
|
9398
|
+
throw new RuntimeError$1(error || `Could not parse color from value '${ typeof input === 'string' ? input : String(JSON.stringify(input)) }'`);
|
|
9213
9399
|
} else if (this.type.kind === 'number') {
|
|
9214
9400
|
let value = null;
|
|
9215
9401
|
for (const arg of this.args) {
|
|
@@ -9221,13 +9407,13 @@
|
|
|
9221
9407
|
continue;
|
|
9222
9408
|
return num;
|
|
9223
9409
|
}
|
|
9224
|
-
throw new RuntimeError(`Could not convert ${ JSON.stringify(value) } to number.`);
|
|
9410
|
+
throw new RuntimeError$1(`Could not convert ${ JSON.stringify(value) } to number.`);
|
|
9225
9411
|
} else if (this.type.kind === 'formatted') {
|
|
9226
|
-
return Formatted.fromString(toString
|
|
9412
|
+
return Formatted.fromString(toString(this.args[0].evaluate(ctx)));
|
|
9227
9413
|
} else if (this.type.kind === 'resolvedImage') {
|
|
9228
|
-
return ResolvedImage.fromString(toString
|
|
9414
|
+
return ResolvedImage.fromString(toString(this.args[0].evaluate(ctx)));
|
|
9229
9415
|
} else {
|
|
9230
|
-
return toString
|
|
9416
|
+
return toString(this.args[0].evaluate(ctx));
|
|
9231
9417
|
}
|
|
9232
9418
|
}
|
|
9233
9419
|
eachChild(fn) {
|
|
@@ -9255,6 +9441,7 @@
|
|
|
9255
9441
|
return serialized;
|
|
9256
9442
|
}
|
|
9257
9443
|
}
|
|
9444
|
+
var Coercion$1 = Coercion;
|
|
9258
9445
|
|
|
9259
9446
|
const geometryTypes = [
|
|
9260
9447
|
'Unknown',
|
|
@@ -9306,11 +9493,12 @@
|
|
|
9306
9493
|
parseColor(input) {
|
|
9307
9494
|
let cached = this._parseColorCache[input];
|
|
9308
9495
|
if (!cached) {
|
|
9309
|
-
cached = this._parseColorCache[input] = Color.parse(input);
|
|
9496
|
+
cached = this._parseColorCache[input] = Color$1.parse(input);
|
|
9310
9497
|
}
|
|
9311
9498
|
return cached;
|
|
9312
9499
|
}
|
|
9313
9500
|
}
|
|
9501
|
+
var EvaluationContext$1 = EvaluationContext;
|
|
9314
9502
|
|
|
9315
9503
|
class CompoundExpression {
|
|
9316
9504
|
constructor(name, type, evaluate, args) {
|
|
@@ -9345,7 +9533,7 @@
|
|
|
9345
9533
|
const overloads = availableOverloads.filter(([signature]) => !Array.isArray(signature) || signature.length === args.length - 1);
|
|
9346
9534
|
let signatureContext = null;
|
|
9347
9535
|
for (const [params, evaluate] of overloads) {
|
|
9348
|
-
signatureContext = new ParsingContext(context.registry, context.path, null, context.scope);
|
|
9536
|
+
signatureContext = new ParsingContext$1(context.registry, context.path, null, context.scope);
|
|
9349
9537
|
const parsedArgs = [];
|
|
9350
9538
|
let argParseFailed = false;
|
|
9351
9539
|
for (let i = 1; i < args.length; i++) {
|
|
@@ -9386,7 +9574,7 @@
|
|
|
9386
9574
|
const parsed = context.parse(args[i], 1 + actualTypes.length);
|
|
9387
9575
|
if (!parsed)
|
|
9388
9576
|
return null;
|
|
9389
|
-
actualTypes.push(toString(parsed.type));
|
|
9577
|
+
actualTypes.push(toString$1(parsed.type));
|
|
9390
9578
|
}
|
|
9391
9579
|
context.error(`Expected arguments of type ${ signatures }, but found (${ actualTypes.join(', ') }) instead.`);
|
|
9392
9580
|
}
|
|
@@ -9401,11 +9589,12 @@
|
|
|
9401
9589
|
}
|
|
9402
9590
|
function stringifySignature(signature) {
|
|
9403
9591
|
if (Array.isArray(signature)) {
|
|
9404
|
-
return `(${ signature.map(toString).join(', ') })`;
|
|
9592
|
+
return `(${ signature.map(toString$1).join(', ') })`;
|
|
9405
9593
|
} else {
|
|
9406
|
-
return `(${ toString(signature.type) }...)`;
|
|
9594
|
+
return `(${ toString$1(signature.type) }...)`;
|
|
9407
9595
|
}
|
|
9408
9596
|
}
|
|
9597
|
+
var CompoundExpression$1 = CompoundExpression;
|
|
9409
9598
|
|
|
9410
9599
|
class CollatorExpression {
|
|
9411
9600
|
constructor(caseSensitive, diacriticSensitive, locale) {
|
|
@@ -9802,9 +9991,10 @@
|
|
|
9802
9991
|
];
|
|
9803
9992
|
}
|
|
9804
9993
|
}
|
|
9994
|
+
var Within$1 = Within;
|
|
9805
9995
|
|
|
9806
9996
|
function isFeatureConstant(e) {
|
|
9807
|
-
if (e instanceof CompoundExpression) {
|
|
9997
|
+
if (e instanceof CompoundExpression$1) {
|
|
9808
9998
|
if (e.name === 'get' && e.args.length === 1) {
|
|
9809
9999
|
return false;
|
|
9810
10000
|
} else if (e.name === 'feature-state') {
|
|
@@ -9817,7 +10007,7 @@
|
|
|
9817
10007
|
return false;
|
|
9818
10008
|
}
|
|
9819
10009
|
}
|
|
9820
|
-
if (e instanceof Within) {
|
|
10010
|
+
if (e instanceof Within$1) {
|
|
9821
10011
|
return false;
|
|
9822
10012
|
}
|
|
9823
10013
|
let result = true;
|
|
@@ -9829,7 +10019,7 @@
|
|
|
9829
10019
|
return result;
|
|
9830
10020
|
}
|
|
9831
10021
|
function isStateConstant(e) {
|
|
9832
|
-
if (e instanceof CompoundExpression) {
|
|
10022
|
+
if (e instanceof CompoundExpression$1) {
|
|
9833
10023
|
if (e.name === 'feature-state') {
|
|
9834
10024
|
return false;
|
|
9835
10025
|
}
|
|
@@ -9843,7 +10033,7 @@
|
|
|
9843
10033
|
return result;
|
|
9844
10034
|
}
|
|
9845
10035
|
function isGlobalPropertyConstant(e, properties) {
|
|
9846
|
-
if (e instanceof CompoundExpression && properties.indexOf(e.name) >= 0) {
|
|
10036
|
+
if (e instanceof CompoundExpression$1 && properties.indexOf(e.name) >= 0) {
|
|
9847
10037
|
return false;
|
|
9848
10038
|
}
|
|
9849
10039
|
let result = true;
|
|
@@ -9885,9 +10075,10 @@
|
|
|
9885
10075
|
];
|
|
9886
10076
|
}
|
|
9887
10077
|
}
|
|
10078
|
+
var Var$1 = Var;
|
|
9888
10079
|
|
|
9889
10080
|
class ParsingContext {
|
|
9890
|
-
constructor(registry, path = [], expectedType, scope = new Scope(), errors = []) {
|
|
10081
|
+
constructor(registry, path = [], expectedType, scope = new Scope$1(), errors = []) {
|
|
9891
10082
|
this.registry = registry;
|
|
9892
10083
|
this.path = path;
|
|
9893
10084
|
this.key = path.map(part => `[${ part }]`).join('');
|
|
@@ -9910,9 +10101,9 @@
|
|
|
9910
10101
|
}
|
|
9911
10102
|
function annotate(parsed, type, typeAnnotation) {
|
|
9912
10103
|
if (typeAnnotation === 'assert') {
|
|
9913
|
-
return new Assertion(type, [parsed]);
|
|
10104
|
+
return new Assertion$1(type, [parsed]);
|
|
9914
10105
|
} else if (typeAnnotation === 'coerce') {
|
|
9915
|
-
return new Coercion(type, [parsed]);
|
|
10106
|
+
return new Coercion$1(type, [parsed]);
|
|
9916
10107
|
} else {
|
|
9917
10108
|
return parsed;
|
|
9918
10109
|
}
|
|
@@ -9942,10 +10133,10 @@
|
|
|
9942
10133
|
return null;
|
|
9943
10134
|
}
|
|
9944
10135
|
}
|
|
9945
|
-
if (!(parsed instanceof Literal) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
|
|
9946
|
-
const ec = new EvaluationContext();
|
|
10136
|
+
if (!(parsed instanceof Literal$1) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
|
|
10137
|
+
const ec = new EvaluationContext$1();
|
|
9947
10138
|
try {
|
|
9948
|
-
parsed = new Literal(parsed.type, parsed.evaluate(ec));
|
|
10139
|
+
parsed = new Literal$1(parsed.type, parsed.evaluate(ec));
|
|
9949
10140
|
} catch (e) {
|
|
9950
10141
|
this.error(e.message);
|
|
9951
10142
|
return null;
|
|
@@ -9969,7 +10160,7 @@
|
|
|
9969
10160
|
}
|
|
9970
10161
|
error(error, ...keys) {
|
|
9971
10162
|
const key = `${ this.key }${ keys.map(k => `[${ k }]`).join('') }`;
|
|
9972
|
-
this.errors.push(new ParsingError(key, error));
|
|
10163
|
+
this.errors.push(new ParsingError$2(key, error));
|
|
9973
10164
|
}
|
|
9974
10165
|
checkSubtype(expected, t) {
|
|
9975
10166
|
const error = checkSubtype(expected, t);
|
|
@@ -9978,23 +10169,24 @@
|
|
|
9978
10169
|
return error;
|
|
9979
10170
|
}
|
|
9980
10171
|
}
|
|
10172
|
+
var ParsingContext$1 = ParsingContext;
|
|
9981
10173
|
function isConstant(expression) {
|
|
9982
|
-
if (expression instanceof Var) {
|
|
10174
|
+
if (expression instanceof Var$1) {
|
|
9983
10175
|
return isConstant(expression.boundExpression);
|
|
9984
|
-
} else if (expression instanceof CompoundExpression && expression.name === 'error') {
|
|
10176
|
+
} else if (expression instanceof CompoundExpression$1 && expression.name === 'error') {
|
|
9985
10177
|
return false;
|
|
9986
10178
|
} else if (expression instanceof CollatorExpression) {
|
|
9987
10179
|
return false;
|
|
9988
|
-
} else if (expression instanceof Within) {
|
|
10180
|
+
} else if (expression instanceof Within$1) {
|
|
9989
10181
|
return false;
|
|
9990
10182
|
}
|
|
9991
|
-
const isTypeAnnotation = expression instanceof Coercion || expression instanceof Assertion;
|
|
10183
|
+
const isTypeAnnotation = expression instanceof Coercion$1 || expression instanceof Assertion$1;
|
|
9992
10184
|
let childrenConstant = true;
|
|
9993
10185
|
expression.eachChild(child => {
|
|
9994
10186
|
if (isTypeAnnotation) {
|
|
9995
10187
|
childrenConstant = childrenConstant && isConstant(child);
|
|
9996
10188
|
} else {
|
|
9997
|
-
childrenConstant = childrenConstant && child instanceof Literal;
|
|
10189
|
+
childrenConstant = childrenConstant && child instanceof Literal$1;
|
|
9998
10190
|
}
|
|
9999
10191
|
});
|
|
10000
10192
|
if (!childrenConstant) {
|
|
@@ -10030,7 +10222,7 @@
|
|
|
10030
10222
|
} else if (currentValue > input) {
|
|
10031
10223
|
upperIndex = currentIndex - 1;
|
|
10032
10224
|
} else {
|
|
10033
|
-
throw new RuntimeError('Input is not a number.');
|
|
10225
|
+
throw new RuntimeError$1('Input is not a number.');
|
|
10034
10226
|
}
|
|
10035
10227
|
}
|
|
10036
10228
|
return 0;
|
|
@@ -10124,6 +10316,7 @@
|
|
|
10124
10316
|
return serialized;
|
|
10125
10317
|
}
|
|
10126
10318
|
}
|
|
10319
|
+
var Step$1 = Step;
|
|
10127
10320
|
|
|
10128
10321
|
/*
|
|
10129
10322
|
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
|
@@ -10234,9 +10427,9 @@
|
|
|
10234
10427
|
return a * (1 - t) + b * t;
|
|
10235
10428
|
}
|
|
10236
10429
|
function color(from, to, t) {
|
|
10237
|
-
return new Color(number(from.r, to.r, t), number(from.g, to.g, t), number(from.b, to.b, t), number(from.a, to.a, t));
|
|
10430
|
+
return new Color$1(number(from.r, to.r, t), number(from.g, to.g, t), number(from.b, to.b, t), number(from.a, to.a, t));
|
|
10238
10431
|
}
|
|
10239
|
-
function array
|
|
10432
|
+
function array(from, to, t) {
|
|
10240
10433
|
return from.map((d, i) => {
|
|
10241
10434
|
return number(d, to[i], t);
|
|
10242
10435
|
});
|
|
@@ -10246,7 +10439,7 @@
|
|
|
10246
10439
|
__proto__: null,
|
|
10247
10440
|
number: number,
|
|
10248
10441
|
color: color,
|
|
10249
|
-
array: array
|
|
10442
|
+
array: array
|
|
10250
10443
|
});
|
|
10251
10444
|
|
|
10252
10445
|
const Xn = 0.95047, Yn = 1, Zn = 1.08883, t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * t1 * t1, t3 = t1 * t1 * t1, deg2rad = Math.PI / 180, rad2deg = 180 / Math.PI;
|
|
@@ -10277,7 +10470,7 @@
|
|
|
10277
10470
|
y = Yn * lab2xyz(y);
|
|
10278
10471
|
x = Xn * lab2xyz(x);
|
|
10279
10472
|
z = Zn * lab2xyz(z);
|
|
10280
|
-
return new Color(xyz2rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z), xyz2rgb(-0.969266 * x + 1.8760108 * y + 0.041556 * z), xyz2rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z), labColor.alpha);
|
|
10473
|
+
return new Color$1(xyz2rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z), xyz2rgb(-0.969266 * x + 1.8760108 * y + 0.041556 * z), xyz2rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z), labColor.alpha);
|
|
10281
10474
|
}
|
|
10282
10475
|
function interpolateLab(from, to, t) {
|
|
10283
10476
|
return {
|
|
@@ -10425,7 +10618,7 @@
|
|
|
10425
10618
|
]);
|
|
10426
10619
|
}
|
|
10427
10620
|
if (outputType.kind !== 'number' && outputType.kind !== 'color' && !(outputType.kind === 'array' && outputType.itemType.kind === 'number' && typeof outputType.N === 'number')) {
|
|
10428
|
-
return context.error(`Type ${ toString(outputType) } is not interpolatable.`);
|
|
10621
|
+
return context.error(`Type ${ toString$1(outputType) } is not interpolatable.`);
|
|
10429
10622
|
}
|
|
10430
10623
|
return new Interpolate(outputType, operator, interpolation, input, stops);
|
|
10431
10624
|
}
|
|
@@ -10504,6 +10697,7 @@
|
|
|
10504
10697
|
return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);
|
|
10505
10698
|
}
|
|
10506
10699
|
}
|
|
10700
|
+
var Interpolate$1 = Interpolate;
|
|
10507
10701
|
|
|
10508
10702
|
class Coalesce {
|
|
10509
10703
|
constructor(type, args) {
|
|
@@ -10565,6 +10759,7 @@
|
|
|
10565
10759
|
return serialized;
|
|
10566
10760
|
}
|
|
10567
10761
|
}
|
|
10762
|
+
var Coalesce$1 = Coalesce;
|
|
10568
10763
|
|
|
10569
10764
|
class Let {
|
|
10570
10765
|
constructor(bindings, result) {
|
|
@@ -10618,6 +10813,7 @@
|
|
|
10618
10813
|
return serialized;
|
|
10619
10814
|
}
|
|
10620
10815
|
}
|
|
10816
|
+
var Let$1 = Let;
|
|
10621
10817
|
|
|
10622
10818
|
class At {
|
|
10623
10819
|
constructor(type, index, input) {
|
|
@@ -10629,7 +10825,7 @@
|
|
|
10629
10825
|
if (args.length !== 3)
|
|
10630
10826
|
return context.error(`Expected 2 arguments, but found ${ args.length - 1 } instead.`);
|
|
10631
10827
|
const index = context.parse(args[1], 1, NumberType);
|
|
10632
|
-
const input = context.parse(args[2], 2, array(context.expectedType || ValueType));
|
|
10828
|
+
const input = context.parse(args[2], 2, array$1(context.expectedType || ValueType));
|
|
10633
10829
|
if (!index || !input)
|
|
10634
10830
|
return null;
|
|
10635
10831
|
const t = input.type;
|
|
@@ -10639,13 +10835,13 @@
|
|
|
10639
10835
|
const index = this.index.evaluate(ctx);
|
|
10640
10836
|
const array = this.input.evaluate(ctx);
|
|
10641
10837
|
if (index < 0) {
|
|
10642
|
-
throw new RuntimeError(`Array index out of bounds: ${ index } < 0.`);
|
|
10838
|
+
throw new RuntimeError$1(`Array index out of bounds: ${ index } < 0.`);
|
|
10643
10839
|
}
|
|
10644
10840
|
if (index >= array.length) {
|
|
10645
|
-
throw new RuntimeError(`Array index out of bounds: ${ index } > ${ array.length - 1 }.`);
|
|
10841
|
+
throw new RuntimeError$1(`Array index out of bounds: ${ index } > ${ array.length - 1 }.`);
|
|
10646
10842
|
}
|
|
10647
10843
|
if (index !== Math.floor(index)) {
|
|
10648
|
-
throw new RuntimeError(`Array index must be an integer, but found ${ index } instead.`);
|
|
10844
|
+
throw new RuntimeError$1(`Array index must be an integer, but found ${ index } instead.`);
|
|
10649
10845
|
}
|
|
10650
10846
|
return array[index];
|
|
10651
10847
|
}
|
|
@@ -10664,6 +10860,7 @@
|
|
|
10664
10860
|
];
|
|
10665
10861
|
}
|
|
10666
10862
|
}
|
|
10863
|
+
var At$1 = At;
|
|
10667
10864
|
|
|
10668
10865
|
class In {
|
|
10669
10866
|
constructor(needle, haystack) {
|
|
@@ -10686,7 +10883,7 @@
|
|
|
10686
10883
|
NullType,
|
|
10687
10884
|
ValueType
|
|
10688
10885
|
])) {
|
|
10689
|
-
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(needle.type) } instead`);
|
|
10886
|
+
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(needle.type) } instead`);
|
|
10690
10887
|
}
|
|
10691
10888
|
return new In(needle, haystack);
|
|
10692
10889
|
}
|
|
@@ -10701,13 +10898,13 @@
|
|
|
10701
10898
|
'number',
|
|
10702
10899
|
'null'
|
|
10703
10900
|
])) {
|
|
10704
|
-
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(typeOf(needle)) } instead.`);
|
|
10901
|
+
throw new RuntimeError$1(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
10705
10902
|
}
|
|
10706
10903
|
if (!isValidNativeType(haystack, [
|
|
10707
10904
|
'string',
|
|
10708
10905
|
'array'
|
|
10709
10906
|
])) {
|
|
10710
|
-
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString(typeOf(haystack)) } instead.`);
|
|
10907
|
+
throw new RuntimeError$1(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
10711
10908
|
}
|
|
10712
10909
|
return haystack.indexOf(needle) >= 0;
|
|
10713
10910
|
}
|
|
@@ -10726,6 +10923,7 @@
|
|
|
10726
10923
|
];
|
|
10727
10924
|
}
|
|
10728
10925
|
}
|
|
10926
|
+
var In$1 = In;
|
|
10729
10927
|
|
|
10730
10928
|
class IndexOf {
|
|
10731
10929
|
constructor(needle, haystack, fromIndex) {
|
|
@@ -10749,7 +10947,7 @@
|
|
|
10749
10947
|
NullType,
|
|
10750
10948
|
ValueType
|
|
10751
10949
|
])) {
|
|
10752
|
-
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(needle.type) } instead`);
|
|
10950
|
+
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(needle.type) } instead`);
|
|
10753
10951
|
}
|
|
10754
10952
|
if (args.length === 4) {
|
|
10755
10953
|
const fromIndex = context.parse(args[3], 3, NumberType);
|
|
@@ -10769,13 +10967,13 @@
|
|
|
10769
10967
|
'number',
|
|
10770
10968
|
'null'
|
|
10771
10969
|
])) {
|
|
10772
|
-
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(typeOf(needle)) } instead.`);
|
|
10970
|
+
throw new RuntimeError$1(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
10773
10971
|
}
|
|
10774
10972
|
if (!isValidNativeType(haystack, [
|
|
10775
10973
|
'string',
|
|
10776
10974
|
'array'
|
|
10777
10975
|
])) {
|
|
10778
|
-
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString(typeOf(haystack)) } instead.`);
|
|
10976
|
+
throw new RuntimeError$1(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
10779
10977
|
}
|
|
10780
10978
|
if (this.fromIndex) {
|
|
10781
10979
|
const fromIndex = this.fromIndex.evaluate(ctx);
|
|
@@ -10810,6 +11008,7 @@
|
|
|
10810
11008
|
];
|
|
10811
11009
|
}
|
|
10812
11010
|
}
|
|
11011
|
+
var IndexOf$1 = IndexOf;
|
|
10813
11012
|
|
|
10814
11013
|
class Match {
|
|
10815
11014
|
constructor(inputType, outputType, input, cases, outputs, otherwise) {
|
|
@@ -10922,6 +11121,7 @@
|
|
|
10922
11121
|
return serialized;
|
|
10923
11122
|
}
|
|
10924
11123
|
}
|
|
11124
|
+
var Match$1 = Match;
|
|
10925
11125
|
|
|
10926
11126
|
class Case {
|
|
10927
11127
|
constructor(type, branches, otherwise) {
|
|
@@ -10983,6 +11183,7 @@
|
|
|
10983
11183
|
return serialized;
|
|
10984
11184
|
}
|
|
10985
11185
|
}
|
|
11186
|
+
var Case$1 = Case;
|
|
10986
11187
|
|
|
10987
11188
|
class Slice {
|
|
10988
11189
|
constructor(type, input, beginIndex, endIndex) {
|
|
@@ -11000,11 +11201,11 @@
|
|
|
11000
11201
|
if (!input || !beginIndex)
|
|
11001
11202
|
return null;
|
|
11002
11203
|
if (!isValidType(input.type, [
|
|
11003
|
-
array(ValueType),
|
|
11204
|
+
array$1(ValueType),
|
|
11004
11205
|
StringType,
|
|
11005
11206
|
ValueType
|
|
11006
11207
|
])) {
|
|
11007
|
-
return context.error(`Expected first argument to be of type array or string, but found ${ toString(input.type) } instead`);
|
|
11208
|
+
return context.error(`Expected first argument to be of type array or string, but found ${ toString$1(input.type) } instead`);
|
|
11008
11209
|
}
|
|
11009
11210
|
if (args.length === 4) {
|
|
11010
11211
|
const endIndex = context.parse(args[3], 3, NumberType);
|
|
@@ -11022,7 +11223,7 @@
|
|
|
11022
11223
|
'string',
|
|
11023
11224
|
'array'
|
|
11024
11225
|
])) {
|
|
11025
|
-
throw new RuntimeError(`Expected first argument to be of type array or string, but found ${ toString(typeOf(input)) } instead.`);
|
|
11226
|
+
throw new RuntimeError$1(`Expected first argument to be of type array or string, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
11026
11227
|
}
|
|
11027
11228
|
if (this.endIndex) {
|
|
11028
11229
|
const endIndex = this.endIndex.evaluate(ctx);
|
|
@@ -11057,6 +11258,7 @@
|
|
|
11057
11258
|
];
|
|
11058
11259
|
}
|
|
11059
11260
|
}
|
|
11261
|
+
var Slice$1 = Slice;
|
|
11060
11262
|
|
|
11061
11263
|
function isComparableType(op, type) {
|
|
11062
11264
|
if (op === '==' || op === '!=') {
|
|
@@ -11119,22 +11321,22 @@
|
|
|
11119
11321
|
if (!lhs)
|
|
11120
11322
|
return null;
|
|
11121
11323
|
if (!isComparableType(op, lhs.type)) {
|
|
11122
|
-
return context.concat(1).error(`"${ op }" comparisons are not supported for type '${ toString(lhs.type) }'.`);
|
|
11324
|
+
return context.concat(1).error(`"${ op }" comparisons are not supported for type '${ toString$1(lhs.type) }'.`);
|
|
11123
11325
|
}
|
|
11124
11326
|
let rhs = context.parse(args[2], 2, ValueType);
|
|
11125
11327
|
if (!rhs)
|
|
11126
11328
|
return null;
|
|
11127
11329
|
if (!isComparableType(op, rhs.type)) {
|
|
11128
|
-
return context.concat(2).error(`"${ op }" comparisons are not supported for type '${ toString(rhs.type) }'.`);
|
|
11330
|
+
return context.concat(2).error(`"${ op }" comparisons are not supported for type '${ toString$1(rhs.type) }'.`);
|
|
11129
11331
|
}
|
|
11130
11332
|
if (lhs.type.kind !== rhs.type.kind && lhs.type.kind !== 'value' && rhs.type.kind !== 'value') {
|
|
11131
|
-
return context.error(`Cannot compare types '${ toString(lhs.type) }' and '${ toString(rhs.type) }'.`);
|
|
11333
|
+
return context.error(`Cannot compare types '${ toString$1(lhs.type) }' and '${ toString$1(rhs.type) }'.`);
|
|
11132
11334
|
}
|
|
11133
11335
|
if (isOrderComparison) {
|
|
11134
11336
|
if (lhs.type.kind === 'value' && rhs.type.kind !== 'value') {
|
|
11135
|
-
lhs = new Assertion(rhs.type, [lhs]);
|
|
11337
|
+
lhs = new Assertion$1(rhs.type, [lhs]);
|
|
11136
11338
|
} else if (lhs.type.kind !== 'value' && rhs.type.kind === 'value') {
|
|
11137
|
-
rhs = new Assertion(lhs.type, [rhs]);
|
|
11339
|
+
rhs = new Assertion$1(lhs.type, [rhs]);
|
|
11138
11340
|
}
|
|
11139
11341
|
}
|
|
11140
11342
|
let collator = null;
|
|
@@ -11155,7 +11357,7 @@
|
|
|
11155
11357
|
const lt = typeOf(lhs);
|
|
11156
11358
|
const rt = typeOf(rhs);
|
|
11157
11359
|
if (lt.kind !== rt.kind || !(lt.kind === 'string' || lt.kind === 'number')) {
|
|
11158
|
-
throw new RuntimeError(`Expected arguments for "${ op }" to be (string, string) or (number, number), but found (${ lt.kind }, ${ rt.kind }) instead.`);
|
|
11360
|
+
throw new RuntimeError$1(`Expected arguments for "${ op }" to be (string, string) or (number, number), but found (${ lt.kind }, ${ rt.kind }) instead.`);
|
|
11159
11361
|
}
|
|
11160
11362
|
}
|
|
11161
11363
|
if (this.collator && !isOrderComparison && this.hasUntypedArgument) {
|
|
@@ -11297,7 +11499,7 @@
|
|
|
11297
11499
|
if (!input)
|
|
11298
11500
|
return null;
|
|
11299
11501
|
if (input.type.kind !== 'array' && input.type.kind !== 'string' && input.type.kind !== 'value')
|
|
11300
|
-
return context.error(`Expected argument of type string or array, but found ${ toString(input.type) } instead.`);
|
|
11502
|
+
return context.error(`Expected argument of type string or array, but found ${ toString$1(input.type) } instead.`);
|
|
11301
11503
|
return new Length(input);
|
|
11302
11504
|
}
|
|
11303
11505
|
evaluate(ctx) {
|
|
@@ -11307,7 +11509,7 @@
|
|
|
11307
11509
|
} else if (Array.isArray(input)) {
|
|
11308
11510
|
return input.length;
|
|
11309
11511
|
} else {
|
|
11310
|
-
throw new RuntimeError(`Expected value to be of type string or array, but found ${ toString(typeOf(input)) } instead.`);
|
|
11512
|
+
throw new RuntimeError$1(`Expected value to be of type string or array, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
11311
11513
|
}
|
|
11312
11514
|
}
|
|
11313
11515
|
eachChild(fn) {
|
|
@@ -11324,6 +11526,7 @@
|
|
|
11324
11526
|
return serialized;
|
|
11325
11527
|
}
|
|
11326
11528
|
}
|
|
11529
|
+
var Length$1 = Length;
|
|
11327
11530
|
|
|
11328
11531
|
const expressions = {
|
|
11329
11532
|
'==': Equals,
|
|
@@ -11332,35 +11535,35 @@
|
|
|
11332
11535
|
'<': LessThan,
|
|
11333
11536
|
'>=': GreaterThanOrEqual,
|
|
11334
11537
|
'<=': LessThanOrEqual,
|
|
11335
|
-
'array': Assertion,
|
|
11336
|
-
'at': At,
|
|
11337
|
-
'boolean': Assertion,
|
|
11338
|
-
'case': Case,
|
|
11339
|
-
'coalesce': Coalesce,
|
|
11538
|
+
'array': Assertion$1,
|
|
11539
|
+
'at': At$1,
|
|
11540
|
+
'boolean': Assertion$1,
|
|
11541
|
+
'case': Case$1,
|
|
11542
|
+
'coalesce': Coalesce$1,
|
|
11340
11543
|
'collator': CollatorExpression,
|
|
11341
11544
|
'format': FormatExpression,
|
|
11342
11545
|
'image': ImageExpression,
|
|
11343
|
-
'in': In,
|
|
11344
|
-
'index-of': IndexOf,
|
|
11345
|
-
'interpolate': Interpolate,
|
|
11346
|
-
'interpolate-hcl': Interpolate,
|
|
11347
|
-
'interpolate-lab': Interpolate,
|
|
11348
|
-
'length': Length,
|
|
11349
|
-
'let': Let,
|
|
11350
|
-
'literal': Literal,
|
|
11351
|
-
'match': Match,
|
|
11352
|
-
'number': Assertion,
|
|
11546
|
+
'in': In$1,
|
|
11547
|
+
'index-of': IndexOf$1,
|
|
11548
|
+
'interpolate': Interpolate$1,
|
|
11549
|
+
'interpolate-hcl': Interpolate$1,
|
|
11550
|
+
'interpolate-lab': Interpolate$1,
|
|
11551
|
+
'length': Length$1,
|
|
11552
|
+
'let': Let$1,
|
|
11553
|
+
'literal': Literal$1,
|
|
11554
|
+
'match': Match$1,
|
|
11555
|
+
'number': Assertion$1,
|
|
11353
11556
|
'number-format': NumberFormat,
|
|
11354
|
-
'object': Assertion,
|
|
11355
|
-
'slice': Slice,
|
|
11356
|
-
'step': Step,
|
|
11357
|
-
'string': Assertion,
|
|
11358
|
-
'to-boolean': Coercion,
|
|
11359
|
-
'to-color': Coercion,
|
|
11360
|
-
'to-number': Coercion,
|
|
11361
|
-
'to-string': Coercion,
|
|
11362
|
-
'var': Var,
|
|
11363
|
-
'within': Within
|
|
11557
|
+
'object': Assertion$1,
|
|
11558
|
+
'slice': Slice$1,
|
|
11559
|
+
'step': Step$1,
|
|
11560
|
+
'string': Assertion$1,
|
|
11561
|
+
'to-boolean': Coercion$1,
|
|
11562
|
+
'to-color': Coercion$1,
|
|
11563
|
+
'to-number': Coercion$1,
|
|
11564
|
+
'to-string': Coercion$1,
|
|
11565
|
+
'var': Var$1,
|
|
11566
|
+
'within': Within$1
|
|
11364
11567
|
};
|
|
11365
11568
|
function rgba(ctx, [r, g, b, a]) {
|
|
11366
11569
|
r = r.evaluate(ctx);
|
|
@@ -11369,8 +11572,8 @@
|
|
|
11369
11572
|
const alpha = a ? a.evaluate(ctx) : 1;
|
|
11370
11573
|
const error = validateRGBA(r, g, b, alpha);
|
|
11371
11574
|
if (error)
|
|
11372
|
-
throw new RuntimeError(error);
|
|
11373
|
-
return new Color(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);
|
|
11575
|
+
throw new RuntimeError$1(error);
|
|
11576
|
+
return new Color$1(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);
|
|
11374
11577
|
}
|
|
11375
11578
|
function has(key, obj) {
|
|
11376
11579
|
return key in obj;
|
|
@@ -11394,21 +11597,21 @@
|
|
|
11394
11597
|
function varargs(type) {
|
|
11395
11598
|
return { type };
|
|
11396
11599
|
}
|
|
11397
|
-
CompoundExpression.register(expressions, {
|
|
11600
|
+
CompoundExpression$1.register(expressions, {
|
|
11398
11601
|
'error': [
|
|
11399
11602
|
ErrorType,
|
|
11400
11603
|
[StringType],
|
|
11401
11604
|
(ctx, [v]) => {
|
|
11402
|
-
throw new RuntimeError(v.evaluate(ctx));
|
|
11605
|
+
throw new RuntimeError$1(v.evaluate(ctx));
|
|
11403
11606
|
}
|
|
11404
11607
|
],
|
|
11405
11608
|
'typeof': [
|
|
11406
11609
|
StringType,
|
|
11407
11610
|
[ValueType],
|
|
11408
|
-
(ctx, [v]) => toString(typeOf(v.evaluate(ctx)))
|
|
11611
|
+
(ctx, [v]) => toString$1(typeOf(v.evaluate(ctx)))
|
|
11409
11612
|
],
|
|
11410
11613
|
'to-rgba': [
|
|
11411
|
-
array(NumberType, 4),
|
|
11614
|
+
array$1(NumberType, 4),
|
|
11412
11615
|
[ColorType],
|
|
11413
11616
|
(ctx, [v]) => {
|
|
11414
11617
|
return v.evaluate(ctx).toArray();
|
|
@@ -11794,19 +11997,19 @@
|
|
|
11794
11997
|
],
|
|
11795
11998
|
'filter-type-in': [
|
|
11796
11999
|
BooleanType,
|
|
11797
|
-
[array(StringType)],
|
|
12000
|
+
[array$1(StringType)],
|
|
11798
12001
|
(ctx, [v]) => v.value.indexOf(ctx.geometryType()) >= 0
|
|
11799
12002
|
],
|
|
11800
12003
|
'filter-id-in': [
|
|
11801
12004
|
BooleanType,
|
|
11802
|
-
[array(ValueType)],
|
|
12005
|
+
[array$1(ValueType)],
|
|
11803
12006
|
(ctx, [v]) => v.value.indexOf(ctx.id()) >= 0
|
|
11804
12007
|
],
|
|
11805
12008
|
'filter-in-small': [
|
|
11806
12009
|
BooleanType,
|
|
11807
12010
|
[
|
|
11808
12011
|
StringType,
|
|
11809
|
-
array(ValueType)
|
|
12012
|
+
array$1(ValueType)
|
|
11810
12013
|
],
|
|
11811
12014
|
(ctx, [k, v]) => v.value.indexOf(ctx.properties()[k.value]) >= 0
|
|
11812
12015
|
],
|
|
@@ -11814,7 +12017,7 @@
|
|
|
11814
12017
|
BooleanType,
|
|
11815
12018
|
[
|
|
11816
12019
|
StringType,
|
|
11817
|
-
array(ValueType)
|
|
12020
|
+
array$1(ValueType)
|
|
11818
12021
|
],
|
|
11819
12022
|
(ctx, [k, v]) => binarySearch(ctx.properties()[k.value], v.value, 0, v.value.length - 1)
|
|
11820
12023
|
],
|
|
@@ -11891,7 +12094,7 @@
|
|
|
11891
12094
|
'concat': [
|
|
11892
12095
|
StringType,
|
|
11893
12096
|
varargs(ValueType),
|
|
11894
|
-
(ctx, args) => args.map(arg => toString
|
|
12097
|
+
(ctx, args) => args.map(arg => toString(arg.evaluate(ctx))).join('')
|
|
11895
12098
|
],
|
|
11896
12099
|
'resolved-locale': [
|
|
11897
12100
|
StringType,
|
|
@@ -11899,6 +12102,7 @@
|
|
|
11899
12102
|
(ctx, [collator]) => collator.evaluate(ctx).resolvedLocale()
|
|
11900
12103
|
]
|
|
11901
12104
|
});
|
|
12105
|
+
var definitions = expressions;
|
|
11902
12106
|
|
|
11903
12107
|
function success(value) {
|
|
11904
12108
|
return {
|
|
@@ -11939,7 +12143,7 @@
|
|
|
11939
12143
|
}
|
|
11940
12144
|
}
|
|
11941
12145
|
|
|
11942
|
-
function isFunction
|
|
12146
|
+
function isFunction(value) {
|
|
11943
12147
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
11944
12148
|
}
|
|
11945
12149
|
function identityFunction(x) {
|
|
@@ -11957,14 +12161,14 @@
|
|
|
11957
12161
|
parameters.stops = parameters.stops.map(stop => {
|
|
11958
12162
|
return [
|
|
11959
12163
|
stop[0],
|
|
11960
|
-
Color.parse(stop[1])
|
|
12164
|
+
Color$1.parse(stop[1])
|
|
11961
12165
|
];
|
|
11962
12166
|
});
|
|
11963
12167
|
}
|
|
11964
12168
|
if (parameters.default) {
|
|
11965
|
-
parameters.default = Color.parse(parameters.default);
|
|
12169
|
+
parameters.default = Color$1.parse(parameters.default);
|
|
11966
12170
|
} else {
|
|
11967
|
-
parameters.default = Color.parse(propertySpec.default);
|
|
12171
|
+
parameters.default = Color$1.parse(propertySpec.default);
|
|
11968
12172
|
}
|
|
11969
12173
|
}
|
|
11970
12174
|
if (parameters.colorSpace && parameters.colorSpace !== 'rgb' && !colorSpaces[parameters.colorSpace]) {
|
|
@@ -12021,7 +12225,7 @@
|
|
|
12021
12225
|
return {
|
|
12022
12226
|
kind: 'composite',
|
|
12023
12227
|
interpolationType,
|
|
12024
|
-
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
12228
|
+
interpolationFactor: Interpolate$1.interpolationFactor.bind(undefined, interpolationType),
|
|
12025
12229
|
zoomStops: featureFunctionStops.map(s => s[0]),
|
|
12026
12230
|
evaluate({zoom}, properties) {
|
|
12027
12231
|
return evaluateExponentialFunction({
|
|
@@ -12038,7 +12242,7 @@
|
|
|
12038
12242
|
return {
|
|
12039
12243
|
kind: 'camera',
|
|
12040
12244
|
interpolationType,
|
|
12041
|
-
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
12245
|
+
interpolationFactor: Interpolate$1.interpolationFactor.bind(undefined, interpolationType),
|
|
12042
12246
|
zoomStops: parameters.stops.map(s => s[0]),
|
|
12043
12247
|
evaluate: ({zoom}) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)
|
|
12044
12248
|
};
|
|
@@ -12048,14 +12252,14 @@
|
|
|
12048
12252
|
evaluate(_, feature) {
|
|
12049
12253
|
const value = feature && feature.properties ? feature.properties[parameters.property] : undefined;
|
|
12050
12254
|
if (value === undefined) {
|
|
12051
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12255
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12052
12256
|
}
|
|
12053
12257
|
return innerFun(parameters, propertySpec, value, hashedStops, categoricalKeyType);
|
|
12054
12258
|
}
|
|
12055
12259
|
};
|
|
12056
12260
|
}
|
|
12057
12261
|
}
|
|
12058
|
-
function coalesce(a, b, c) {
|
|
12262
|
+
function coalesce$1(a, b, c) {
|
|
12059
12263
|
if (a !== undefined)
|
|
12060
12264
|
return a;
|
|
12061
12265
|
if (b !== undefined)
|
|
@@ -12065,11 +12269,11 @@
|
|
|
12065
12269
|
}
|
|
12066
12270
|
function evaluateCategoricalFunction(parameters, propertySpec, input, hashedStops, keyType) {
|
|
12067
12271
|
const evaluated = typeof input === keyType ? hashedStops[input] : undefined;
|
|
12068
|
-
return coalesce(evaluated, parameters.default, propertySpec.default);
|
|
12272
|
+
return coalesce$1(evaluated, parameters.default, propertySpec.default);
|
|
12069
12273
|
}
|
|
12070
12274
|
function evaluateIntervalFunction(parameters, propertySpec, input) {
|
|
12071
12275
|
if (getType(input) !== 'number')
|
|
12072
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12276
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12073
12277
|
const n = parameters.stops.length;
|
|
12074
12278
|
if (n === 1)
|
|
12075
12279
|
return parameters.stops[0][1];
|
|
@@ -12083,7 +12287,7 @@
|
|
|
12083
12287
|
function evaluateExponentialFunction(parameters, propertySpec, input) {
|
|
12084
12288
|
const base = parameters.base !== undefined ? parameters.base : 1;
|
|
12085
12289
|
if (getType(input) !== 'number')
|
|
12086
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12290
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12087
12291
|
const n = parameters.stops.length;
|
|
12088
12292
|
if (n === 1)
|
|
12089
12293
|
return parameters.stops[0][1];
|
|
@@ -12116,7 +12320,7 @@
|
|
|
12116
12320
|
}
|
|
12117
12321
|
function evaluateIdentityFunction(parameters, propertySpec, input) {
|
|
12118
12322
|
if (propertySpec.type === 'color') {
|
|
12119
|
-
input = Color.parse(input);
|
|
12323
|
+
input = Color$1.parse(input);
|
|
12120
12324
|
} else if (propertySpec.type === 'formatted') {
|
|
12121
12325
|
input = Formatted.fromString(input.toString());
|
|
12122
12326
|
} else if (propertySpec.type === 'resolvedImage') {
|
|
@@ -12124,7 +12328,7 @@
|
|
|
12124
12328
|
} else if (getType(input) !== propertySpec.type && (propertySpec.type !== 'enum' || !propertySpec.values[input])) {
|
|
12125
12329
|
input = undefined;
|
|
12126
12330
|
}
|
|
12127
|
-
return coalesce(input, parameters.default, propertySpec.default);
|
|
12331
|
+
return coalesce$1(input, parameters.default, propertySpec.default);
|
|
12128
12332
|
}
|
|
12129
12333
|
function interpolationFactor(input, base, lowerValue, upperValue) {
|
|
12130
12334
|
const difference = upperValue - lowerValue;
|
|
@@ -12142,7 +12346,7 @@
|
|
|
12142
12346
|
constructor(expression, propertySpec) {
|
|
12143
12347
|
this.expression = expression;
|
|
12144
12348
|
this._warningHistory = {};
|
|
12145
|
-
this._evaluator = new EvaluationContext();
|
|
12349
|
+
this._evaluator = new EvaluationContext$1();
|
|
12146
12350
|
this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
|
|
12147
12351
|
this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;
|
|
12148
12352
|
}
|
|
@@ -12172,7 +12376,7 @@
|
|
|
12172
12376
|
return this._defaultValue;
|
|
12173
12377
|
}
|
|
12174
12378
|
if (this._enumValues && !(val in this._enumValues)) {
|
|
12175
|
-
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.`);
|
|
12379
|
+
throw new RuntimeError$1(`Expected value to be one of ${ Object.keys(this._enumValues).map(v => JSON.stringify(v)).join(', ') }, but found ${ JSON.stringify(val) } instead.`);
|
|
12176
12380
|
}
|
|
12177
12381
|
return val;
|
|
12178
12382
|
} catch (e) {
|
|
@@ -12187,10 +12391,10 @@
|
|
|
12187
12391
|
}
|
|
12188
12392
|
}
|
|
12189
12393
|
function isExpression(expression) {
|
|
12190
|
-
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in
|
|
12394
|
+
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in definitions;
|
|
12191
12395
|
}
|
|
12192
12396
|
function createExpression(expression, propertySpec) {
|
|
12193
|
-
const parser = new ParsingContext(
|
|
12397
|
+
const parser = new ParsingContext$1(definitions, [], propertySpec ? getExpectedType(propertySpec) : undefined);
|
|
12194
12398
|
const parsed = parser.parse(expression, undefined, undefined, undefined, propertySpec && propertySpec.type === 'string' ? { typeAnnotation: 'coerce' } : undefined);
|
|
12195
12399
|
if (!parsed) {
|
|
12196
12400
|
return error(parser.errors);
|
|
@@ -12226,7 +12430,7 @@
|
|
|
12226
12430
|
}
|
|
12227
12431
|
interpolationFactor(input, lower, upper) {
|
|
12228
12432
|
if (this.interpolationType) {
|
|
12229
|
-
return Interpolate.interpolationFactor(this.interpolationType, input, lower, upper);
|
|
12433
|
+
return Interpolate$1.interpolationFactor(this.interpolationType, input, lower, upper);
|
|
12230
12434
|
} else {
|
|
12231
12435
|
return 0;
|
|
12232
12436
|
}
|
|
@@ -12240,7 +12444,7 @@
|
|
|
12240
12444
|
const parsed = expression.value.expression;
|
|
12241
12445
|
const isFeatureConstant$1 = isFeatureConstant(parsed);
|
|
12242
12446
|
if (!isFeatureConstant$1 && !supportsPropertyExpression(propertySpec)) {
|
|
12243
|
-
return error([new ParsingError('', 'data expressions not supported')]);
|
|
12447
|
+
return error([new ParsingError$2('', 'data expressions not supported')]);
|
|
12244
12448
|
}
|
|
12245
12449
|
const isZoomConstant = isGlobalPropertyConstant(parsed, [
|
|
12246
12450
|
'zoom',
|
|
@@ -12248,20 +12452,20 @@
|
|
|
12248
12452
|
'distance-from-center'
|
|
12249
12453
|
]);
|
|
12250
12454
|
if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {
|
|
12251
|
-
return error([new ParsingError('', 'zoom expressions not supported')]);
|
|
12455
|
+
return error([new ParsingError$2('', 'zoom expressions not supported')]);
|
|
12252
12456
|
}
|
|
12253
12457
|
const zoomCurve = findZoomCurve(parsed);
|
|
12254
12458
|
if (!zoomCurve && !isZoomConstant) {
|
|
12255
|
-
return error([new ParsingError('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);
|
|
12256
|
-
} else if (zoomCurve instanceof ParsingError) {
|
|
12459
|
+
return error([new ParsingError$2('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);
|
|
12460
|
+
} else if (zoomCurve instanceof ParsingError$2) {
|
|
12257
12461
|
return error([zoomCurve]);
|
|
12258
|
-
} else if (zoomCurve instanceof Interpolate && !supportsInterpolation(propertySpec)) {
|
|
12259
|
-
return error([new ParsingError('', '"interpolate" expressions cannot be used with this property')]);
|
|
12462
|
+
} else if (zoomCurve instanceof Interpolate$1 && !supportsInterpolation(propertySpec)) {
|
|
12463
|
+
return error([new ParsingError$2('', '"interpolate" expressions cannot be used with this property')]);
|
|
12260
12464
|
}
|
|
12261
12465
|
if (!zoomCurve) {
|
|
12262
12466
|
return success(isFeatureConstant$1 ? new ZoomConstantExpression('constant', expression.value) : new ZoomConstantExpression('source', expression.value));
|
|
12263
12467
|
}
|
|
12264
|
-
const interpolationType = zoomCurve instanceof Interpolate ? zoomCurve.interpolation : undefined;
|
|
12468
|
+
const interpolationType = zoomCurve instanceof Interpolate$1 ? zoomCurve.interpolation : undefined;
|
|
12265
12469
|
return success(isFeatureConstant$1 ? new ZoomDependentExpression('camera', expression.value, zoomCurve.labels, interpolationType) : new ZoomDependentExpression('composite', expression.value, zoomCurve.labels, interpolationType));
|
|
12266
12470
|
}
|
|
12267
12471
|
class StylePropertyFunction {
|
|
@@ -12281,7 +12485,7 @@
|
|
|
12281
12485
|
}
|
|
12282
12486
|
}
|
|
12283
12487
|
function normalizePropertyExpression(value, specification) {
|
|
12284
|
-
if (isFunction
|
|
12488
|
+
if (isFunction(value)) {
|
|
12285
12489
|
return new StylePropertyFunction(value, specification);
|
|
12286
12490
|
} else if (isExpression(value)) {
|
|
12287
12491
|
const expression = createPropertyExpression(value, specification);
|
|
@@ -12292,7 +12496,7 @@
|
|
|
12292
12496
|
} else {
|
|
12293
12497
|
let constant = value;
|
|
12294
12498
|
if (typeof value === 'string' && specification.type === 'color') {
|
|
12295
|
-
constant = Color.parse(value);
|
|
12499
|
+
constant = Color$1.parse(value);
|
|
12296
12500
|
}
|
|
12297
12501
|
return {
|
|
12298
12502
|
kind: 'constant',
|
|
@@ -12302,29 +12506,29 @@
|
|
|
12302
12506
|
}
|
|
12303
12507
|
function findZoomCurve(expression) {
|
|
12304
12508
|
let result = null;
|
|
12305
|
-
if (expression instanceof Let) {
|
|
12509
|
+
if (expression instanceof Let$1) {
|
|
12306
12510
|
result = findZoomCurve(expression.result);
|
|
12307
|
-
} else if (expression instanceof Coalesce) {
|
|
12511
|
+
} else if (expression instanceof Coalesce$1) {
|
|
12308
12512
|
for (const arg of expression.args) {
|
|
12309
12513
|
result = findZoomCurve(arg);
|
|
12310
12514
|
if (result) {
|
|
12311
12515
|
break;
|
|
12312
12516
|
}
|
|
12313
12517
|
}
|
|
12314
|
-
} else if ((expression instanceof Step || expression instanceof Interpolate) && expression.input instanceof CompoundExpression && expression.input.name === 'zoom') {
|
|
12518
|
+
} else if ((expression instanceof Step$1 || expression instanceof Interpolate$1) && expression.input instanceof CompoundExpression$1 && expression.input.name === 'zoom') {
|
|
12315
12519
|
result = expression;
|
|
12316
12520
|
}
|
|
12317
|
-
if (result instanceof ParsingError) {
|
|
12521
|
+
if (result instanceof ParsingError$2) {
|
|
12318
12522
|
return result;
|
|
12319
12523
|
}
|
|
12320
12524
|
expression.eachChild(child => {
|
|
12321
12525
|
const childResult = findZoomCurve(child);
|
|
12322
|
-
if (childResult instanceof ParsingError) {
|
|
12526
|
+
if (childResult instanceof ParsingError$2) {
|
|
12323
12527
|
result = childResult;
|
|
12324
12528
|
} else if (!result && childResult) {
|
|
12325
|
-
result = new ParsingError('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.');
|
|
12529
|
+
result = new ParsingError$2('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.');
|
|
12326
12530
|
} else if (result && childResult && result !== childResult) {
|
|
12327
|
-
result = new ParsingError('', 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.');
|
|
12531
|
+
result = new ParsingError$2('', 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.');
|
|
12328
12532
|
}
|
|
12329
12533
|
});
|
|
12330
12534
|
return result;
|
|
@@ -12340,15 +12544,15 @@
|
|
|
12340
12544
|
resolvedImage: ResolvedImageType
|
|
12341
12545
|
};
|
|
12342
12546
|
if (spec.type === 'array') {
|
|
12343
|
-
return array(types[spec.value] || ValueType, spec.length);
|
|
12547
|
+
return array$1(types[spec.value] || ValueType, spec.length);
|
|
12344
12548
|
}
|
|
12345
12549
|
return types[spec.type];
|
|
12346
12550
|
}
|
|
12347
12551
|
function getDefaultValue(spec) {
|
|
12348
|
-
if (spec.type === 'color' && isFunction
|
|
12349
|
-
return new Color(0, 0, 0, 0);
|
|
12552
|
+
if (spec.type === 'color' && (isFunction(spec.default) || Array.isArray(spec.default))) {
|
|
12553
|
+
return new Color$1(0, 0, 0, 0);
|
|
12350
12554
|
} else if (spec.type === 'color') {
|
|
12351
|
-
return Color.parse(spec.default) || null;
|
|
12555
|
+
return Color$1.parse(spec.default) || null;
|
|
12352
12556
|
} else if (spec.default === undefined) {
|
|
12353
12557
|
return null;
|
|
12354
12558
|
} else {
|
|
@@ -12477,14 +12681,14 @@
|
|
|
12477
12681
|
return expression;
|
|
12478
12682
|
}
|
|
12479
12683
|
}
|
|
12480
|
-
function coalesce
|
|
12684
|
+
function coalesce(a, b) {
|
|
12481
12685
|
if (a !== undefined)
|
|
12482
12686
|
return a;
|
|
12483
12687
|
if (b !== undefined)
|
|
12484
12688
|
return b;
|
|
12485
12689
|
}
|
|
12486
12690
|
function getFallback(parameters, propertySpec) {
|
|
12487
|
-
const defaultValue = convertLiteral(coalesce
|
|
12691
|
+
const defaultValue = convertLiteral(coalesce(parameters.default, propertySpec.default));
|
|
12488
12692
|
if (defaultValue === undefined && propertySpec.type === 'resolvedImage') {
|
|
12489
12693
|
return '';
|
|
12490
12694
|
}
|
|
@@ -12718,7 +12922,7 @@
|
|
|
12718
12922
|
};
|
|
12719
12923
|
}
|
|
12720
12924
|
if (!isExpressionFilter(filter)) {
|
|
12721
|
-
filter = convertFilter(filter);
|
|
12925
|
+
filter = convertFilter$1(filter);
|
|
12722
12926
|
}
|
|
12723
12927
|
const filterExp = filter;
|
|
12724
12928
|
let staticFilter = true;
|
|
@@ -12863,16 +13067,16 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12863
13067
|
}
|
|
12864
13068
|
return false;
|
|
12865
13069
|
}
|
|
12866
|
-
function convertFilter(filter) {
|
|
13070
|
+
function convertFilter$1(filter) {
|
|
12867
13071
|
if (!filter)
|
|
12868
13072
|
return true;
|
|
12869
13073
|
const op = filter[0];
|
|
12870
13074
|
if (filter.length <= 1)
|
|
12871
13075
|
return op !== 'any';
|
|
12872
|
-
const converted = op === '==' ? convertComparisonOp(filter[1], filter[2], '==') : op === '!=' ? convertNegation(convertComparisonOp(filter[1], filter[2], '==')) : op === '<' || op === '>' || op === '<=' || op === '>=' ? convertComparisonOp(filter[1], filter[2], op) : op === 'any' ? convertDisjunctionOp(filter.slice(1)) : op === 'all' ? ['all'].concat(filter.slice(1).map(convertFilter)) : op === 'none' ? ['all'].concat(filter.slice(1).map(convertFilter).map(convertNegation)) : op === 'in' ? convertInOp(filter[1], filter.slice(2)) : op === '!in' ? convertNegation(convertInOp(filter[1], filter.slice(2))) : op === 'has' ? convertHasOp(filter[1]) : op === '!has' ? convertNegation(convertHasOp(filter[1])) : op === 'within' ? filter : true;
|
|
13076
|
+
const converted = op === '==' ? convertComparisonOp$1(filter[1], filter[2], '==') : op === '!=' ? convertNegation(convertComparisonOp$1(filter[1], filter[2], '==')) : op === '<' || op === '>' || op === '<=' || op === '>=' ? convertComparisonOp$1(filter[1], filter[2], op) : op === 'any' ? convertDisjunctionOp(filter.slice(1)) : op === 'all' ? ['all'].concat(filter.slice(1).map(convertFilter$1)) : op === 'none' ? ['all'].concat(filter.slice(1).map(convertFilter$1).map(convertNegation)) : op === 'in' ? convertInOp$1(filter[1], filter.slice(2)) : op === '!in' ? convertNegation(convertInOp$1(filter[1], filter.slice(2))) : op === 'has' ? convertHasOp$1(filter[1]) : op === '!has' ? convertNegation(convertHasOp$1(filter[1])) : op === 'within' ? filter : true;
|
|
12873
13077
|
return converted;
|
|
12874
13078
|
}
|
|
12875
|
-
function convertComparisonOp(property, value, op) {
|
|
13079
|
+
function convertComparisonOp$1(property, value, op) {
|
|
12876
13080
|
switch (property) {
|
|
12877
13081
|
case '$type':
|
|
12878
13082
|
return [
|
|
@@ -12893,9 +13097,9 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12893
13097
|
}
|
|
12894
13098
|
}
|
|
12895
13099
|
function convertDisjunctionOp(filters) {
|
|
12896
|
-
return ['any'].concat(filters.map(convertFilter));
|
|
13100
|
+
return ['any'].concat(filters.map(convertFilter$1));
|
|
12897
13101
|
}
|
|
12898
|
-
function convertInOp(property, values) {
|
|
13102
|
+
function convertInOp$1(property, values) {
|
|
12899
13103
|
if (values.length === 0) {
|
|
12900
13104
|
return false;
|
|
12901
13105
|
}
|
|
@@ -12938,7 +13142,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12938
13142
|
}
|
|
12939
13143
|
}
|
|
12940
13144
|
}
|
|
12941
|
-
function convertHasOp(property) {
|
|
13145
|
+
function convertHasOp$1(property) {
|
|
12942
13146
|
switch (property) {
|
|
12943
13147
|
case '$type':
|
|
12944
13148
|
return true;
|
|
@@ -12958,7 +13162,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12958
13162
|
];
|
|
12959
13163
|
}
|
|
12960
13164
|
|
|
12961
|
-
function convertFilter
|
|
13165
|
+
function convertFilter(filter) {
|
|
12962
13166
|
return _convertFilter(filter, {});
|
|
12963
13167
|
}
|
|
12964
13168
|
function _convertFilter(filter, expectedTypes) {
|
|
@@ -12973,7 +13177,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12973
13177
|
let converted;
|
|
12974
13178
|
if (op === '==' || op === '!=' || op === '<' || op === '>' || op === '<=' || op === '>=') {
|
|
12975
13179
|
const [, property, value] = filter;
|
|
12976
|
-
converted = convertComparisonOp
|
|
13180
|
+
converted = convertComparisonOp(property, value, op, expectedTypes);
|
|
12977
13181
|
} else if (op === 'any') {
|
|
12978
13182
|
const children = filter.slice(1).map(f => {
|
|
12979
13183
|
const types = {};
|
|
@@ -12996,15 +13200,15 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12996
13200
|
_convertFilter(['any'].concat(filter.slice(1)), {})
|
|
12997
13201
|
];
|
|
12998
13202
|
} else if (op === 'in') {
|
|
12999
|
-
converted = convertInOp
|
|
13203
|
+
converted = convertInOp(filter[1], filter.slice(2));
|
|
13000
13204
|
} else if (op === '!in') {
|
|
13001
|
-
converted = convertInOp
|
|
13205
|
+
converted = convertInOp(filter[1], filter.slice(2), true);
|
|
13002
13206
|
} else if (op === 'has') {
|
|
13003
|
-
converted = convertHasOp
|
|
13207
|
+
converted = convertHasOp(filter[1]);
|
|
13004
13208
|
} else if (op === '!has') {
|
|
13005
13209
|
converted = [
|
|
13006
13210
|
'!',
|
|
13007
|
-
convertHasOp
|
|
13211
|
+
convertHasOp(filter[1])
|
|
13008
13212
|
];
|
|
13009
13213
|
} else {
|
|
13010
13214
|
converted = true;
|
|
@@ -13033,7 +13237,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13033
13237
|
return conditions[0];
|
|
13034
13238
|
return ['all'].concat(conditions);
|
|
13035
13239
|
}
|
|
13036
|
-
function convertComparisonOp
|
|
13240
|
+
function convertComparisonOp(property, value, op, expectedTypes) {
|
|
13037
13241
|
let get;
|
|
13038
13242
|
if (property === '$type') {
|
|
13039
13243
|
return [
|
|
@@ -13089,7 +13293,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13089
13293
|
value
|
|
13090
13294
|
];
|
|
13091
13295
|
}
|
|
13092
|
-
function convertInOp
|
|
13296
|
+
function convertInOp(property, values, negate = false) {
|
|
13093
13297
|
if (values.length === 0)
|
|
13094
13298
|
return negate;
|
|
13095
13299
|
let get;
|
|
@@ -13127,7 +13331,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13127
13331
|
v
|
|
13128
13332
|
]));
|
|
13129
13333
|
}
|
|
13130
|
-
function convertHasOp
|
|
13334
|
+
function convertHasOp(property) {
|
|
13131
13335
|
if (property === '$type') {
|
|
13132
13336
|
return true;
|
|
13133
13337
|
} else if (property === '$id') {
|
|
@@ -13148,7 +13352,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13148
13352
|
const converted = [];
|
|
13149
13353
|
eachLayer(style, layer => {
|
|
13150
13354
|
if (layer.filter) {
|
|
13151
|
-
layer.filter = convertFilter
|
|
13355
|
+
layer.filter = convertFilter(layer.filter);
|
|
13152
13356
|
}
|
|
13153
13357
|
});
|
|
13154
13358
|
eachProperty(style, {
|
|
@@ -13675,7 +13879,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13675
13879
|
}
|
|
13676
13880
|
}
|
|
13677
13881
|
|
|
13678
|
-
class ParsingError
|
|
13882
|
+
class ParsingError {
|
|
13679
13883
|
constructor(error) {
|
|
13680
13884
|
this.error = error;
|
|
13681
13885
|
this.message = error.message;
|
|
@@ -14026,7 +14230,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14026
14230
|
return [];
|
|
14027
14231
|
}
|
|
14028
14232
|
const errors = [];
|
|
14029
|
-
if (e instanceof CompoundExpression) {
|
|
14233
|
+
if (e instanceof CompoundExpression$1) {
|
|
14030
14234
|
if (disallowedParameters.has(e.name)) {
|
|
14031
14235
|
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 }`)];
|
|
14032
14236
|
}
|
|
@@ -14208,7 +14412,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14208
14412
|
if (propertyKey === 'text-field' && style && !style.glyphs) {
|
|
14209
14413
|
errors.push(new ValidationError(key, value, 'use of "text-field" requires a style "glyphs" property'));
|
|
14210
14414
|
}
|
|
14211
|
-
if (propertyKey === 'text-font' && isFunction
|
|
14415
|
+
if (propertyKey === 'text-font' && isFunction(deepUnbundle(value)) && unbundle(value.type) === 'identity') {
|
|
14212
14416
|
errors.push(new ValidationError(key, value, '"text-font" does not support identity functions'));
|
|
14213
14417
|
}
|
|
14214
14418
|
}
|
|
@@ -14295,6 +14499,8 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14295
14499
|
errors.push(new ValidationError(key, layer.source, 'raster-dem source can only be used with layer type \'hillshade\'.'));
|
|
14296
14500
|
} else if (type === 'line' && layer.paint && layer.paint['line-gradient'] && (sourceType !== 'geojson' || !source.lineMetrics)) {
|
|
14297
14501
|
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`));
|
|
14502
|
+
} else if (type === 'line' && layer.paint && layer.paint['line-trim-offset'] && !layer.paint['line-gradient']) {
|
|
14503
|
+
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-trim-offset, which requires line-gradient enabled.`));
|
|
14298
14504
|
}
|
|
14299
14505
|
}
|
|
14300
14506
|
}
|
|
@@ -14668,7 +14874,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14668
14874
|
const value = options.value;
|
|
14669
14875
|
const valueSpec = options.valueSpec;
|
|
14670
14876
|
const styleSpec = options.styleSpec;
|
|
14671
|
-
if (valueSpec.expression && isFunction
|
|
14877
|
+
if (valueSpec.expression && isFunction(unbundle(value))) {
|
|
14672
14878
|
return validateFunction(options);
|
|
14673
14879
|
} else if (valueSpec.expression && isExpression(deepUnbundle(value))) {
|
|
14674
14880
|
return validateExpression(options);
|
|
@@ -14695,7 +14901,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14695
14901
|
return errors;
|
|
14696
14902
|
}
|
|
14697
14903
|
|
|
14698
|
-
function validateStyle(style, styleSpec = v8) {
|
|
14904
|
+
function validateStyle$1(style, styleSpec = v8) {
|
|
14699
14905
|
const errors = validate({
|
|
14700
14906
|
key: '',
|
|
14701
14907
|
value: style,
|
|
@@ -15372,25 +15578,27 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
15372
15578
|
}
|
|
15373
15579
|
});
|
|
15374
15580
|
|
|
15581
|
+
var jsonlint$1 = jsonlint;
|
|
15582
|
+
|
|
15375
15583
|
function readStyle(style) {
|
|
15376
15584
|
if (style instanceof String || typeof style === 'string' || style instanceof Buffer) {
|
|
15377
15585
|
try {
|
|
15378
|
-
return jsonlint.parse(style.toString());
|
|
15586
|
+
return jsonlint$1.parse(style.toString());
|
|
15379
15587
|
} catch (e) {
|
|
15380
|
-
throw new ParsingError
|
|
15588
|
+
throw new ParsingError(e);
|
|
15381
15589
|
}
|
|
15382
15590
|
}
|
|
15383
15591
|
return style;
|
|
15384
15592
|
}
|
|
15385
15593
|
|
|
15386
|
-
function validateStyle
|
|
15594
|
+
function validateStyle(style, styleSpec = v8) {
|
|
15387
15595
|
let s = style;
|
|
15388
15596
|
try {
|
|
15389
15597
|
s = readStyle(s);
|
|
15390
15598
|
} catch (e) {
|
|
15391
15599
|
return [e];
|
|
15392
15600
|
}
|
|
15393
|
-
return validateStyle(s, styleSpec);
|
|
15601
|
+
return validateStyle$1(s, styleSpec);
|
|
15394
15602
|
}
|
|
15395
15603
|
|
|
15396
15604
|
const SUPPORTED_SPEC_VERSION = 8;
|
|
@@ -15499,14 +15707,14 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
15499
15707
|
} catch (e) {
|
|
15500
15708
|
return [e];
|
|
15501
15709
|
}
|
|
15502
|
-
let errors = validateStyle(s, v8).concat(getRootErrors(s, Object.keys(v8.$root)));
|
|
15710
|
+
let errors = validateStyle$1(s, v8).concat(getRootErrors(s, Object.keys(v8.$root)));
|
|
15503
15711
|
if (s.sources) {
|
|
15504
15712
|
errors = errors.concat(getSourcesErrors(s.sources));
|
|
15505
15713
|
}
|
|
15506
15714
|
return errors;
|
|
15507
15715
|
}
|
|
15508
15716
|
|
|
15509
|
-
const expression
|
|
15717
|
+
const expression = {
|
|
15510
15718
|
StyleExpression,
|
|
15511
15719
|
isExpression,
|
|
15512
15720
|
isExpressionFilter,
|
|
@@ -15520,7 +15728,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
15520
15728
|
const styleFunction = {
|
|
15521
15729
|
convertFunction,
|
|
15522
15730
|
createFunction,
|
|
15523
|
-
isFunction
|
|
15731
|
+
isFunction
|
|
15524
15732
|
};
|
|
15525
15733
|
const visit = {
|
|
15526
15734
|
eachSource,
|
|
@@ -15528,25 +15736,25 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
15528
15736
|
eachProperty
|
|
15529
15737
|
};
|
|
15530
15738
|
|
|
15531
|
-
exports.Color = Color;
|
|
15532
|
-
exports.ParsingError = ParsingError
|
|
15739
|
+
exports.Color = Color$1;
|
|
15740
|
+
exports.ParsingError = ParsingError;
|
|
15533
15741
|
exports.ValidationError = ValidationError;
|
|
15534
15742
|
exports.composite = composite;
|
|
15535
|
-
exports.convertFilter = convertFilter
|
|
15743
|
+
exports.convertFilter = convertFilter;
|
|
15536
15744
|
exports.derefLayers = derefLayers;
|
|
15537
15745
|
exports.diff = diffStyles;
|
|
15538
|
-
exports.expression = expression
|
|
15746
|
+
exports.expression = expression;
|
|
15539
15747
|
exports.featureFilter = createFilter;
|
|
15540
|
-
exports.format = format;
|
|
15541
|
-
exports
|
|
15748
|
+
exports.format = format$1;
|
|
15749
|
+
exports["function"] = styleFunction;
|
|
15542
15750
|
exports.latest = v8;
|
|
15543
15751
|
exports.migrate = migrate;
|
|
15544
15752
|
exports.v8 = v8;
|
|
15545
|
-
exports.validate = validateStyle
|
|
15753
|
+
exports.validate = validateStyle;
|
|
15546
15754
|
exports.validateMapboxApiSupported = validateMapboxApiSupported;
|
|
15547
15755
|
exports.visit = visit;
|
|
15548
15756
|
|
|
15549
15757
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
15550
15758
|
|
|
15551
|
-
}))
|
|
15759
|
+
}));
|
|
15552
15760
|
//# sourceMappingURL=index.cjs.map
|