@mapbox/mapbox-gl-style-spec 13.24.0 → 13.25.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/CHANGELOG.md +13 -0
- package/dist/index.cjs +421 -208
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +413 -200
- 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 +153 -8
- package/types.js +7 -3
- package/util/color.js +35 -0
- package/validate/validate_layer.js +1 -1
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,
|
|
104
|
+
doc: "The projection the map should be rendered in. Supported projections are Mercator, Globe, Albers, Equal Earth, Equirectangular (WGS84), Lambert conformal conic, Natural Earth, and Winkel Tripel. Terrain, sky and fog are supported by only Mercator and globe. CustomLayerInterface is not supported outside of 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,42 @@
|
|
|
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 range [0.0, 1.0].",
|
|
4712
|
+
length: 2,
|
|
4713
|
+
"default": [
|
|
4714
|
+
0,
|
|
4715
|
+
0
|
|
4716
|
+
],
|
|
4717
|
+
minimum: [
|
|
4718
|
+
0,
|
|
4719
|
+
0
|
|
4720
|
+
],
|
|
4721
|
+
maximum: [
|
|
4722
|
+
1,
|
|
4723
|
+
1
|
|
4724
|
+
],
|
|
4725
|
+
transition: false,
|
|
4726
|
+
requires: [
|
|
4727
|
+
{
|
|
4728
|
+
source: "geojson",
|
|
4729
|
+
has: {
|
|
4730
|
+
lineMetrics: true
|
|
4731
|
+
}
|
|
4732
|
+
}
|
|
4733
|
+
],
|
|
4734
|
+
"sdk-support": {
|
|
4735
|
+
"basic functionality": {
|
|
4736
|
+
js: "2.9.0",
|
|
4737
|
+
android: "10.5.0",
|
|
4738
|
+
ios: "10.5.0",
|
|
4739
|
+
macos: "10.5.0"
|
|
4740
|
+
}
|
|
4741
|
+
},
|
|
4742
|
+
"property-type": "constant"
|
|
4581
4743
|
}
|
|
4582
4744
|
};
|
|
4583
4745
|
var paint_circle = {
|
|
@@ -6323,7 +6485,7 @@
|
|
|
6323
6485
|
}
|
|
6324
6486
|
},
|
|
6325
6487
|
function_stop: function_stop,
|
|
6326
|
-
expression: expression,
|
|
6488
|
+
expression: expression$1,
|
|
6327
6489
|
expression_name: expression_name,
|
|
6328
6490
|
fog: fog,
|
|
6329
6491
|
light: light,
|
|
@@ -6697,6 +6859,8 @@
|
|
|
6697
6859
|
})(passedObj, "", 0);
|
|
6698
6860
|
};
|
|
6699
6861
|
|
|
6862
|
+
var stringifyPretty = jsonStringifyPrettyCompact;
|
|
6863
|
+
|
|
6700
6864
|
function sortKeysBy(obj, reference) {
|
|
6701
6865
|
const result = {};
|
|
6702
6866
|
for (const key in reference) {
|
|
@@ -6711,12 +6875,12 @@
|
|
|
6711
6875
|
}
|
|
6712
6876
|
return result;
|
|
6713
6877
|
}
|
|
6714
|
-
function format(style, space = 2) {
|
|
6878
|
+
function format$1(style, space = 2) {
|
|
6715
6879
|
style = sortKeysBy(style, v8.$root);
|
|
6716
6880
|
if (style.layers) {
|
|
6717
6881
|
style.layers = style.layers.map(layer => sortKeysBy(layer, v8.layer));
|
|
6718
6882
|
}
|
|
6719
|
-
return
|
|
6883
|
+
return stringifyPretty(style, { indent: space });
|
|
6720
6884
|
}
|
|
6721
6885
|
|
|
6722
6886
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -7384,7 +7548,7 @@
|
|
|
7384
7548
|
var parse = urlParse;
|
|
7385
7549
|
var resolve = urlResolve;
|
|
7386
7550
|
var resolveObject = urlResolveObject;
|
|
7387
|
-
var format
|
|
7551
|
+
var format = urlFormat;
|
|
7388
7552
|
|
|
7389
7553
|
var Url_1 = Url;
|
|
7390
7554
|
|
|
@@ -8091,7 +8255,7 @@
|
|
|
8091
8255
|
parse: parse,
|
|
8092
8256
|
resolve: resolve,
|
|
8093
8257
|
resolveObject: resolveObject,
|
|
8094
|
-
format: format
|
|
8258
|
+
format: format,
|
|
8095
8259
|
Url: Url_1
|
|
8096
8260
|
};
|
|
8097
8261
|
|
|
@@ -8172,7 +8336,7 @@
|
|
|
8172
8336
|
return value;
|
|
8173
8337
|
}
|
|
8174
8338
|
}
|
|
8175
|
-
function isFunction(value) {
|
|
8339
|
+
function isFunction$1(value) {
|
|
8176
8340
|
return Array.isArray(value.stops);
|
|
8177
8341
|
}
|
|
8178
8342
|
function renameProperty(obj, from, to) {
|
|
@@ -8214,7 +8378,7 @@
|
|
|
8214
8378
|
layout: true
|
|
8215
8379
|
}, property => {
|
|
8216
8380
|
const value = resolveConstant(style, property.value);
|
|
8217
|
-
if (isFunction(value)) {
|
|
8381
|
+
if (isFunction$1(value)) {
|
|
8218
8382
|
value.stops.forEach(stop => {
|
|
8219
8383
|
stop[1] = resolveConstant(style, stop[1]);
|
|
8220
8384
|
});
|
|
@@ -8305,13 +8469,14 @@
|
|
|
8305
8469
|
return output;
|
|
8306
8470
|
}
|
|
8307
8471
|
|
|
8308
|
-
class ParsingError extends Error {
|
|
8472
|
+
class ParsingError$1 extends Error {
|
|
8309
8473
|
constructor(key, message) {
|
|
8310
8474
|
super(message);
|
|
8311
8475
|
this.message = message;
|
|
8312
8476
|
this.key = key;
|
|
8313
8477
|
}
|
|
8314
8478
|
}
|
|
8479
|
+
var ParsingError$2 = ParsingError$1;
|
|
8315
8480
|
|
|
8316
8481
|
class Scope {
|
|
8317
8482
|
constructor(parent, bindings = []) {
|
|
@@ -8339,6 +8504,7 @@
|
|
|
8339
8504
|
return this.parent ? this.parent.has(name) : false;
|
|
8340
8505
|
}
|
|
8341
8506
|
}
|
|
8507
|
+
var Scope$1 = Scope;
|
|
8342
8508
|
|
|
8343
8509
|
const NullType = { kind: 'null' };
|
|
8344
8510
|
const NumberType = { kind: 'number' };
|
|
@@ -8351,16 +8517,16 @@
|
|
|
8351
8517
|
const CollatorType = { kind: 'collator' };
|
|
8352
8518
|
const FormattedType = { kind: 'formatted' };
|
|
8353
8519
|
const ResolvedImageType = { kind: 'resolvedImage' };
|
|
8354
|
-
function array(itemType, N) {
|
|
8520
|
+
function array$1(itemType, N) {
|
|
8355
8521
|
return {
|
|
8356
8522
|
kind: 'array',
|
|
8357
8523
|
itemType,
|
|
8358
8524
|
N
|
|
8359
8525
|
};
|
|
8360
8526
|
}
|
|
8361
|
-
function toString(type) {
|
|
8527
|
+
function toString$1(type) {
|
|
8362
8528
|
if (type.kind === 'array') {
|
|
8363
|
-
const itemType = toString(type.itemType);
|
|
8529
|
+
const itemType = toString$1(type.itemType);
|
|
8364
8530
|
return typeof type.N === 'number' ? `array<${ itemType }, ${ type.N }>` : type.itemType.kind === 'value' ? 'array' : `array<${ itemType }>`;
|
|
8365
8531
|
} else {
|
|
8366
8532
|
return type.kind;
|
|
@@ -8374,7 +8540,7 @@
|
|
|
8374
8540
|
ColorType,
|
|
8375
8541
|
FormattedType,
|
|
8376
8542
|
ObjectType,
|
|
8377
|
-
array(ValueType),
|
|
8543
|
+
array$1(ValueType),
|
|
8378
8544
|
ResolvedImageType
|
|
8379
8545
|
];
|
|
8380
8546
|
function checkSubtype(expected, t) {
|
|
@@ -8393,7 +8559,7 @@
|
|
|
8393
8559
|
}
|
|
8394
8560
|
}
|
|
8395
8561
|
}
|
|
8396
|
-
return `Expected ${ toString(expected) } but found ${ toString(t) } instead.`;
|
|
8562
|
+
return `Expected ${ toString$1(expected) } but found ${ toString$1(t) } instead.`;
|
|
8397
8563
|
}
|
|
8398
8564
|
function isValidType(provided, allowedTypes) {
|
|
8399
8565
|
return allowedTypes.some(t => t.kind === provided.kind);
|
|
@@ -8657,12 +8823,36 @@
|
|
|
8657
8823
|
a
|
|
8658
8824
|
];
|
|
8659
8825
|
}
|
|
8826
|
+
toArray01() {
|
|
8827
|
+
const {r, g, b, a} = this;
|
|
8828
|
+
return a === 0 ? [
|
|
8829
|
+
0,
|
|
8830
|
+
0,
|
|
8831
|
+
0,
|
|
8832
|
+
0
|
|
8833
|
+
] : [
|
|
8834
|
+
r / a,
|
|
8835
|
+
g / a,
|
|
8836
|
+
b / a,
|
|
8837
|
+
a
|
|
8838
|
+
];
|
|
8839
|
+
}
|
|
8840
|
+
toArray01PremultipliedAlpha() {
|
|
8841
|
+
const {r, g, b, a} = this;
|
|
8842
|
+
return [
|
|
8843
|
+
r,
|
|
8844
|
+
g,
|
|
8845
|
+
b,
|
|
8846
|
+
a
|
|
8847
|
+
];
|
|
8848
|
+
}
|
|
8660
8849
|
}
|
|
8661
8850
|
Color.black = new Color(0, 0, 0, 1);
|
|
8662
8851
|
Color.white = new Color(1, 1, 1, 1);
|
|
8663
8852
|
Color.transparent = new Color(0, 0, 0, 0);
|
|
8664
8853
|
Color.red = new Color(1, 0, 0, 1);
|
|
8665
8854
|
Color.blue = new Color(0, 0, 1, 1);
|
|
8855
|
+
var Color$1 = Color;
|
|
8666
8856
|
|
|
8667
8857
|
class Collator {
|
|
8668
8858
|
constructor(caseSensitive, diacriticSensitive, locale) {
|
|
@@ -8804,7 +8994,7 @@
|
|
|
8804
8994
|
return true;
|
|
8805
8995
|
} else if (typeof mixed === 'number') {
|
|
8806
8996
|
return true;
|
|
8807
|
-
} else if (mixed instanceof Color) {
|
|
8997
|
+
} else if (mixed instanceof Color$1) {
|
|
8808
8998
|
return true;
|
|
8809
8999
|
} else if (mixed instanceof Collator) {
|
|
8810
9000
|
return true;
|
|
@@ -8839,7 +9029,7 @@
|
|
|
8839
9029
|
return BooleanType;
|
|
8840
9030
|
} else if (typeof value === 'number') {
|
|
8841
9031
|
return NumberType;
|
|
8842
|
-
} else if (value instanceof Color) {
|
|
9032
|
+
} else if (value instanceof Color$1) {
|
|
8843
9033
|
return ColorType;
|
|
8844
9034
|
} else if (value instanceof Collator) {
|
|
8845
9035
|
return CollatorType;
|
|
@@ -8861,18 +9051,18 @@
|
|
|
8861
9051
|
break;
|
|
8862
9052
|
}
|
|
8863
9053
|
}
|
|
8864
|
-
return array(itemType || ValueType, length);
|
|
9054
|
+
return array$1(itemType || ValueType, length);
|
|
8865
9055
|
} else {
|
|
8866
9056
|
return ObjectType;
|
|
8867
9057
|
}
|
|
8868
9058
|
}
|
|
8869
|
-
function toString
|
|
9059
|
+
function toString(value) {
|
|
8870
9060
|
const type = typeof value;
|
|
8871
9061
|
if (value === null) {
|
|
8872
9062
|
return '';
|
|
8873
9063
|
} else if (type === 'string' || type === 'number' || type === 'boolean') {
|
|
8874
9064
|
return String(value);
|
|
8875
|
-
} else if (value instanceof Color || value instanceof Formatted || value instanceof ResolvedImage) {
|
|
9065
|
+
} else if (value instanceof Color$1 || value instanceof Formatted || value instanceof ResolvedImage) {
|
|
8876
9066
|
return value.toString();
|
|
8877
9067
|
} else {
|
|
8878
9068
|
return JSON.stringify(value);
|
|
@@ -8911,7 +9101,7 @@
|
|
|
8911
9101
|
'literal',
|
|
8912
9102
|
this.value
|
|
8913
9103
|
];
|
|
8914
|
-
} else if (this.value instanceof Color) {
|
|
9104
|
+
} else if (this.value instanceof Color$1) {
|
|
8915
9105
|
return ['rgba'].concat(this.value.toArray());
|
|
8916
9106
|
} else if (this.value instanceof Formatted) {
|
|
8917
9107
|
return this.value.serialize();
|
|
@@ -8920,6 +9110,7 @@
|
|
|
8920
9110
|
}
|
|
8921
9111
|
}
|
|
8922
9112
|
}
|
|
9113
|
+
var Literal$1 = Literal;
|
|
8923
9114
|
|
|
8924
9115
|
class RuntimeError {
|
|
8925
9116
|
constructor(message) {
|
|
@@ -8930,8 +9121,9 @@
|
|
|
8930
9121
|
return this.message;
|
|
8931
9122
|
}
|
|
8932
9123
|
}
|
|
9124
|
+
var RuntimeError$1 = RuntimeError;
|
|
8933
9125
|
|
|
8934
|
-
const types = {
|
|
9126
|
+
const types$1 = {
|
|
8935
9127
|
string: StringType,
|
|
8936
9128
|
number: NumberType,
|
|
8937
9129
|
boolean: BooleanType,
|
|
@@ -8952,9 +9144,9 @@
|
|
|
8952
9144
|
let itemType;
|
|
8953
9145
|
if (args.length > 2) {
|
|
8954
9146
|
const type = args[1];
|
|
8955
|
-
if (typeof type !== 'string' || !(type in types) || type === 'object')
|
|
9147
|
+
if (typeof type !== 'string' || !(type in types$1) || type === 'object')
|
|
8956
9148
|
return context.error('The item type argument of "array" must be one of string, number, boolean', 1);
|
|
8957
|
-
itemType = types[type];
|
|
9149
|
+
itemType = types$1[type];
|
|
8958
9150
|
i++;
|
|
8959
9151
|
} else {
|
|
8960
9152
|
itemType = ValueType;
|
|
@@ -8967,9 +9159,9 @@
|
|
|
8967
9159
|
N = args[2];
|
|
8968
9160
|
i++;
|
|
8969
9161
|
}
|
|
8970
|
-
type = array(itemType, N);
|
|
9162
|
+
type = array$1(itemType, N);
|
|
8971
9163
|
} else {
|
|
8972
|
-
type = types[name];
|
|
9164
|
+
type = types$1[name];
|
|
8973
9165
|
}
|
|
8974
9166
|
const parsed = [];
|
|
8975
9167
|
for (; i < args.length; i++) {
|
|
@@ -8987,7 +9179,7 @@
|
|
|
8987
9179
|
if (!error) {
|
|
8988
9180
|
return value;
|
|
8989
9181
|
} 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.`);
|
|
9182
|
+
throw new RuntimeError$1(`Expected value to be of type ${ toString$1(this.type) }, but found ${ toString$1(typeOf(value)) } instead.`);
|
|
8991
9183
|
}
|
|
8992
9184
|
}
|
|
8993
9185
|
return null;
|
|
@@ -9014,6 +9206,7 @@
|
|
|
9014
9206
|
return serialized.concat(this.args.map(arg => arg.serialize()));
|
|
9015
9207
|
}
|
|
9016
9208
|
}
|
|
9209
|
+
var Assertion$1 = Assertion;
|
|
9017
9210
|
|
|
9018
9211
|
class FormatExpression {
|
|
9019
9212
|
constructor(sections) {
|
|
@@ -9042,7 +9235,7 @@
|
|
|
9042
9235
|
}
|
|
9043
9236
|
let font = null;
|
|
9044
9237
|
if (arg['text-font']) {
|
|
9045
|
-
font = context.parse(arg['text-font'], 1, array(StringType));
|
|
9238
|
+
font = context.parse(arg['text-font'], 1, array$1(StringType));
|
|
9046
9239
|
if (!font)
|
|
9047
9240
|
return null;
|
|
9048
9241
|
}
|
|
@@ -9080,7 +9273,7 @@
|
|
|
9080
9273
|
if (typeOf(evaluatedContent) === ResolvedImageType) {
|
|
9081
9274
|
return new FormattedSection('', evaluatedContent, null, null, null);
|
|
9082
9275
|
}
|
|
9083
|
-
return new FormattedSection(toString
|
|
9276
|
+
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
9277
|
};
|
|
9085
9278
|
return new Formatted(this.sections.map(evaluateSection));
|
|
9086
9279
|
}
|
|
@@ -9156,7 +9349,7 @@
|
|
|
9156
9349
|
}
|
|
9157
9350
|
}
|
|
9158
9351
|
|
|
9159
|
-
const types
|
|
9352
|
+
const types = {
|
|
9160
9353
|
'to-boolean': BooleanType,
|
|
9161
9354
|
'to-color': ColorType,
|
|
9162
9355
|
'to-number': NumberType,
|
|
@@ -9173,7 +9366,7 @@
|
|
|
9173
9366
|
const name = args[0];
|
|
9174
9367
|
if ((name === 'to-boolean' || name === 'to-string') && args.length !== 2)
|
|
9175
9368
|
return context.error(`Expected one argument.`);
|
|
9176
|
-
const type = types
|
|
9369
|
+
const type = types[name];
|
|
9177
9370
|
const parsed = [];
|
|
9178
9371
|
for (let i = 1; i < args.length; i++) {
|
|
9179
9372
|
const input = context.parse(args[i], i, ValueType);
|
|
@@ -9192,7 +9385,7 @@
|
|
|
9192
9385
|
for (const arg of this.args) {
|
|
9193
9386
|
input = arg.evaluate(ctx);
|
|
9194
9387
|
error = null;
|
|
9195
|
-
if (input instanceof Color) {
|
|
9388
|
+
if (input instanceof Color$1) {
|
|
9196
9389
|
return input;
|
|
9197
9390
|
} else if (typeof input === 'string') {
|
|
9198
9391
|
const c = ctx.parseColor(input);
|
|
@@ -9205,11 +9398,11 @@
|
|
|
9205
9398
|
error = validateRGBA(input[0], input[1], input[2], input[3]);
|
|
9206
9399
|
}
|
|
9207
9400
|
if (!error) {
|
|
9208
|
-
return new Color(input[0] / 255, input[1] / 255, input[2] / 255, input[3]);
|
|
9401
|
+
return new Color$1(input[0] / 255, input[1] / 255, input[2] / 255, input[3]);
|
|
9209
9402
|
}
|
|
9210
9403
|
}
|
|
9211
9404
|
}
|
|
9212
|
-
throw new RuntimeError(error || `Could not parse color from value '${ typeof input === 'string' ? input : String(JSON.stringify(input)) }'`);
|
|
9405
|
+
throw new RuntimeError$1(error || `Could not parse color from value '${ typeof input === 'string' ? input : String(JSON.stringify(input)) }'`);
|
|
9213
9406
|
} else if (this.type.kind === 'number') {
|
|
9214
9407
|
let value = null;
|
|
9215
9408
|
for (const arg of this.args) {
|
|
@@ -9221,13 +9414,13 @@
|
|
|
9221
9414
|
continue;
|
|
9222
9415
|
return num;
|
|
9223
9416
|
}
|
|
9224
|
-
throw new RuntimeError(`Could not convert ${ JSON.stringify(value) } to number.`);
|
|
9417
|
+
throw new RuntimeError$1(`Could not convert ${ JSON.stringify(value) } to number.`);
|
|
9225
9418
|
} else if (this.type.kind === 'formatted') {
|
|
9226
|
-
return Formatted.fromString(toString
|
|
9419
|
+
return Formatted.fromString(toString(this.args[0].evaluate(ctx)));
|
|
9227
9420
|
} else if (this.type.kind === 'resolvedImage') {
|
|
9228
|
-
return ResolvedImage.fromString(toString
|
|
9421
|
+
return ResolvedImage.fromString(toString(this.args[0].evaluate(ctx)));
|
|
9229
9422
|
} else {
|
|
9230
|
-
return toString
|
|
9423
|
+
return toString(this.args[0].evaluate(ctx));
|
|
9231
9424
|
}
|
|
9232
9425
|
}
|
|
9233
9426
|
eachChild(fn) {
|
|
@@ -9255,6 +9448,7 @@
|
|
|
9255
9448
|
return serialized;
|
|
9256
9449
|
}
|
|
9257
9450
|
}
|
|
9451
|
+
var Coercion$1 = Coercion;
|
|
9258
9452
|
|
|
9259
9453
|
const geometryTypes = [
|
|
9260
9454
|
'Unknown',
|
|
@@ -9306,11 +9500,12 @@
|
|
|
9306
9500
|
parseColor(input) {
|
|
9307
9501
|
let cached = this._parseColorCache[input];
|
|
9308
9502
|
if (!cached) {
|
|
9309
|
-
cached = this._parseColorCache[input] = Color.parse(input);
|
|
9503
|
+
cached = this._parseColorCache[input] = Color$1.parse(input);
|
|
9310
9504
|
}
|
|
9311
9505
|
return cached;
|
|
9312
9506
|
}
|
|
9313
9507
|
}
|
|
9508
|
+
var EvaluationContext$1 = EvaluationContext;
|
|
9314
9509
|
|
|
9315
9510
|
class CompoundExpression {
|
|
9316
9511
|
constructor(name, type, evaluate, args) {
|
|
@@ -9345,7 +9540,7 @@
|
|
|
9345
9540
|
const overloads = availableOverloads.filter(([signature]) => !Array.isArray(signature) || signature.length === args.length - 1);
|
|
9346
9541
|
let signatureContext = null;
|
|
9347
9542
|
for (const [params, evaluate] of overloads) {
|
|
9348
|
-
signatureContext = new ParsingContext(context.registry, context.path, null, context.scope);
|
|
9543
|
+
signatureContext = new ParsingContext$1(context.registry, context.path, null, context.scope);
|
|
9349
9544
|
const parsedArgs = [];
|
|
9350
9545
|
let argParseFailed = false;
|
|
9351
9546
|
for (let i = 1; i < args.length; i++) {
|
|
@@ -9386,7 +9581,7 @@
|
|
|
9386
9581
|
const parsed = context.parse(args[i], 1 + actualTypes.length);
|
|
9387
9582
|
if (!parsed)
|
|
9388
9583
|
return null;
|
|
9389
|
-
actualTypes.push(toString(parsed.type));
|
|
9584
|
+
actualTypes.push(toString$1(parsed.type));
|
|
9390
9585
|
}
|
|
9391
9586
|
context.error(`Expected arguments of type ${ signatures }, but found (${ actualTypes.join(', ') }) instead.`);
|
|
9392
9587
|
}
|
|
@@ -9401,11 +9596,12 @@
|
|
|
9401
9596
|
}
|
|
9402
9597
|
function stringifySignature(signature) {
|
|
9403
9598
|
if (Array.isArray(signature)) {
|
|
9404
|
-
return `(${ signature.map(toString).join(', ') })`;
|
|
9599
|
+
return `(${ signature.map(toString$1).join(', ') })`;
|
|
9405
9600
|
} else {
|
|
9406
|
-
return `(${ toString(signature.type) }...)`;
|
|
9601
|
+
return `(${ toString$1(signature.type) }...)`;
|
|
9407
9602
|
}
|
|
9408
9603
|
}
|
|
9604
|
+
var CompoundExpression$1 = CompoundExpression;
|
|
9409
9605
|
|
|
9410
9606
|
class CollatorExpression {
|
|
9411
9607
|
constructor(caseSensitive, diacriticSensitive, locale) {
|
|
@@ -9802,9 +9998,10 @@
|
|
|
9802
9998
|
];
|
|
9803
9999
|
}
|
|
9804
10000
|
}
|
|
10001
|
+
var Within$1 = Within;
|
|
9805
10002
|
|
|
9806
10003
|
function isFeatureConstant(e) {
|
|
9807
|
-
if (e instanceof CompoundExpression) {
|
|
10004
|
+
if (e instanceof CompoundExpression$1) {
|
|
9808
10005
|
if (e.name === 'get' && e.args.length === 1) {
|
|
9809
10006
|
return false;
|
|
9810
10007
|
} else if (e.name === 'feature-state') {
|
|
@@ -9817,7 +10014,7 @@
|
|
|
9817
10014
|
return false;
|
|
9818
10015
|
}
|
|
9819
10016
|
}
|
|
9820
|
-
if (e instanceof Within) {
|
|
10017
|
+
if (e instanceof Within$1) {
|
|
9821
10018
|
return false;
|
|
9822
10019
|
}
|
|
9823
10020
|
let result = true;
|
|
@@ -9829,7 +10026,7 @@
|
|
|
9829
10026
|
return result;
|
|
9830
10027
|
}
|
|
9831
10028
|
function isStateConstant(e) {
|
|
9832
|
-
if (e instanceof CompoundExpression) {
|
|
10029
|
+
if (e instanceof CompoundExpression$1) {
|
|
9833
10030
|
if (e.name === 'feature-state') {
|
|
9834
10031
|
return false;
|
|
9835
10032
|
}
|
|
@@ -9843,7 +10040,7 @@
|
|
|
9843
10040
|
return result;
|
|
9844
10041
|
}
|
|
9845
10042
|
function isGlobalPropertyConstant(e, properties) {
|
|
9846
|
-
if (e instanceof CompoundExpression && properties.indexOf(e.name) >= 0) {
|
|
10043
|
+
if (e instanceof CompoundExpression$1 && properties.indexOf(e.name) >= 0) {
|
|
9847
10044
|
return false;
|
|
9848
10045
|
}
|
|
9849
10046
|
let result = true;
|
|
@@ -9885,9 +10082,10 @@
|
|
|
9885
10082
|
];
|
|
9886
10083
|
}
|
|
9887
10084
|
}
|
|
10085
|
+
var Var$1 = Var;
|
|
9888
10086
|
|
|
9889
10087
|
class ParsingContext {
|
|
9890
|
-
constructor(registry, path = [], expectedType, scope = new Scope(), errors = []) {
|
|
10088
|
+
constructor(registry, path = [], expectedType, scope = new Scope$1(), errors = []) {
|
|
9891
10089
|
this.registry = registry;
|
|
9892
10090
|
this.path = path;
|
|
9893
10091
|
this.key = path.map(part => `[${ part }]`).join('');
|
|
@@ -9910,9 +10108,9 @@
|
|
|
9910
10108
|
}
|
|
9911
10109
|
function annotate(parsed, type, typeAnnotation) {
|
|
9912
10110
|
if (typeAnnotation === 'assert') {
|
|
9913
|
-
return new Assertion(type, [parsed]);
|
|
10111
|
+
return new Assertion$1(type, [parsed]);
|
|
9914
10112
|
} else if (typeAnnotation === 'coerce') {
|
|
9915
|
-
return new Coercion(type, [parsed]);
|
|
10113
|
+
return new Coercion$1(type, [parsed]);
|
|
9916
10114
|
} else {
|
|
9917
10115
|
return parsed;
|
|
9918
10116
|
}
|
|
@@ -9942,10 +10140,10 @@
|
|
|
9942
10140
|
return null;
|
|
9943
10141
|
}
|
|
9944
10142
|
}
|
|
9945
|
-
if (!(parsed instanceof Literal) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
|
|
9946
|
-
const ec = new EvaluationContext();
|
|
10143
|
+
if (!(parsed instanceof Literal$1) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
|
|
10144
|
+
const ec = new EvaluationContext$1();
|
|
9947
10145
|
try {
|
|
9948
|
-
parsed = new Literal(parsed.type, parsed.evaluate(ec));
|
|
10146
|
+
parsed = new Literal$1(parsed.type, parsed.evaluate(ec));
|
|
9949
10147
|
} catch (e) {
|
|
9950
10148
|
this.error(e.message);
|
|
9951
10149
|
return null;
|
|
@@ -9969,7 +10167,7 @@
|
|
|
9969
10167
|
}
|
|
9970
10168
|
error(error, ...keys) {
|
|
9971
10169
|
const key = `${ this.key }${ keys.map(k => `[${ k }]`).join('') }`;
|
|
9972
|
-
this.errors.push(new ParsingError(key, error));
|
|
10170
|
+
this.errors.push(new ParsingError$2(key, error));
|
|
9973
10171
|
}
|
|
9974
10172
|
checkSubtype(expected, t) {
|
|
9975
10173
|
const error = checkSubtype(expected, t);
|
|
@@ -9978,23 +10176,24 @@
|
|
|
9978
10176
|
return error;
|
|
9979
10177
|
}
|
|
9980
10178
|
}
|
|
10179
|
+
var ParsingContext$1 = ParsingContext;
|
|
9981
10180
|
function isConstant(expression) {
|
|
9982
|
-
if (expression instanceof Var) {
|
|
10181
|
+
if (expression instanceof Var$1) {
|
|
9983
10182
|
return isConstant(expression.boundExpression);
|
|
9984
|
-
} else if (expression instanceof CompoundExpression && expression.name === 'error') {
|
|
10183
|
+
} else if (expression instanceof CompoundExpression$1 && expression.name === 'error') {
|
|
9985
10184
|
return false;
|
|
9986
10185
|
} else if (expression instanceof CollatorExpression) {
|
|
9987
10186
|
return false;
|
|
9988
|
-
} else if (expression instanceof Within) {
|
|
10187
|
+
} else if (expression instanceof Within$1) {
|
|
9989
10188
|
return false;
|
|
9990
10189
|
}
|
|
9991
|
-
const isTypeAnnotation = expression instanceof Coercion || expression instanceof Assertion;
|
|
10190
|
+
const isTypeAnnotation = expression instanceof Coercion$1 || expression instanceof Assertion$1;
|
|
9992
10191
|
let childrenConstant = true;
|
|
9993
10192
|
expression.eachChild(child => {
|
|
9994
10193
|
if (isTypeAnnotation) {
|
|
9995
10194
|
childrenConstant = childrenConstant && isConstant(child);
|
|
9996
10195
|
} else {
|
|
9997
|
-
childrenConstant = childrenConstant && child instanceof Literal;
|
|
10196
|
+
childrenConstant = childrenConstant && child instanceof Literal$1;
|
|
9998
10197
|
}
|
|
9999
10198
|
});
|
|
10000
10199
|
if (!childrenConstant) {
|
|
@@ -10030,7 +10229,7 @@
|
|
|
10030
10229
|
} else if (currentValue > input) {
|
|
10031
10230
|
upperIndex = currentIndex - 1;
|
|
10032
10231
|
} else {
|
|
10033
|
-
throw new RuntimeError('Input is not a number.');
|
|
10232
|
+
throw new RuntimeError$1('Input is not a number.');
|
|
10034
10233
|
}
|
|
10035
10234
|
}
|
|
10036
10235
|
return 0;
|
|
@@ -10124,6 +10323,7 @@
|
|
|
10124
10323
|
return serialized;
|
|
10125
10324
|
}
|
|
10126
10325
|
}
|
|
10326
|
+
var Step$1 = Step;
|
|
10127
10327
|
|
|
10128
10328
|
/*
|
|
10129
10329
|
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
|
@@ -10234,9 +10434,9 @@
|
|
|
10234
10434
|
return a * (1 - t) + b * t;
|
|
10235
10435
|
}
|
|
10236
10436
|
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));
|
|
10437
|
+
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
10438
|
}
|
|
10239
|
-
function array
|
|
10439
|
+
function array(from, to, t) {
|
|
10240
10440
|
return from.map((d, i) => {
|
|
10241
10441
|
return number(d, to[i], t);
|
|
10242
10442
|
});
|
|
@@ -10246,7 +10446,7 @@
|
|
|
10246
10446
|
__proto__: null,
|
|
10247
10447
|
number: number,
|
|
10248
10448
|
color: color,
|
|
10249
|
-
array: array
|
|
10449
|
+
array: array
|
|
10250
10450
|
});
|
|
10251
10451
|
|
|
10252
10452
|
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 +10477,7 @@
|
|
|
10277
10477
|
y = Yn * lab2xyz(y);
|
|
10278
10478
|
x = Xn * lab2xyz(x);
|
|
10279
10479
|
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);
|
|
10480
|
+
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
10481
|
}
|
|
10282
10482
|
function interpolateLab(from, to, t) {
|
|
10283
10483
|
return {
|
|
@@ -10425,7 +10625,7 @@
|
|
|
10425
10625
|
]);
|
|
10426
10626
|
}
|
|
10427
10627
|
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.`);
|
|
10628
|
+
return context.error(`Type ${ toString$1(outputType) } is not interpolatable.`);
|
|
10429
10629
|
}
|
|
10430
10630
|
return new Interpolate(outputType, operator, interpolation, input, stops);
|
|
10431
10631
|
}
|
|
@@ -10504,6 +10704,7 @@
|
|
|
10504
10704
|
return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);
|
|
10505
10705
|
}
|
|
10506
10706
|
}
|
|
10707
|
+
var Interpolate$1 = Interpolate;
|
|
10507
10708
|
|
|
10508
10709
|
class Coalesce {
|
|
10509
10710
|
constructor(type, args) {
|
|
@@ -10565,6 +10766,7 @@
|
|
|
10565
10766
|
return serialized;
|
|
10566
10767
|
}
|
|
10567
10768
|
}
|
|
10769
|
+
var Coalesce$1 = Coalesce;
|
|
10568
10770
|
|
|
10569
10771
|
class Let {
|
|
10570
10772
|
constructor(bindings, result) {
|
|
@@ -10618,6 +10820,7 @@
|
|
|
10618
10820
|
return serialized;
|
|
10619
10821
|
}
|
|
10620
10822
|
}
|
|
10823
|
+
var Let$1 = Let;
|
|
10621
10824
|
|
|
10622
10825
|
class At {
|
|
10623
10826
|
constructor(type, index, input) {
|
|
@@ -10629,7 +10832,7 @@
|
|
|
10629
10832
|
if (args.length !== 3)
|
|
10630
10833
|
return context.error(`Expected 2 arguments, but found ${ args.length - 1 } instead.`);
|
|
10631
10834
|
const index = context.parse(args[1], 1, NumberType);
|
|
10632
|
-
const input = context.parse(args[2], 2, array(context.expectedType || ValueType));
|
|
10835
|
+
const input = context.parse(args[2], 2, array$1(context.expectedType || ValueType));
|
|
10633
10836
|
if (!index || !input)
|
|
10634
10837
|
return null;
|
|
10635
10838
|
const t = input.type;
|
|
@@ -10639,13 +10842,13 @@
|
|
|
10639
10842
|
const index = this.index.evaluate(ctx);
|
|
10640
10843
|
const array = this.input.evaluate(ctx);
|
|
10641
10844
|
if (index < 0) {
|
|
10642
|
-
throw new RuntimeError(`Array index out of bounds: ${ index } < 0.`);
|
|
10845
|
+
throw new RuntimeError$1(`Array index out of bounds: ${ index } < 0.`);
|
|
10643
10846
|
}
|
|
10644
10847
|
if (index >= array.length) {
|
|
10645
|
-
throw new RuntimeError(`Array index out of bounds: ${ index } > ${ array.length - 1 }.`);
|
|
10848
|
+
throw new RuntimeError$1(`Array index out of bounds: ${ index } > ${ array.length - 1 }.`);
|
|
10646
10849
|
}
|
|
10647
10850
|
if (index !== Math.floor(index)) {
|
|
10648
|
-
throw new RuntimeError(`Array index must be an integer, but found ${ index } instead.`);
|
|
10851
|
+
throw new RuntimeError$1(`Array index must be an integer, but found ${ index } instead.`);
|
|
10649
10852
|
}
|
|
10650
10853
|
return array[index];
|
|
10651
10854
|
}
|
|
@@ -10664,6 +10867,7 @@
|
|
|
10664
10867
|
];
|
|
10665
10868
|
}
|
|
10666
10869
|
}
|
|
10870
|
+
var At$1 = At;
|
|
10667
10871
|
|
|
10668
10872
|
class In {
|
|
10669
10873
|
constructor(needle, haystack) {
|
|
@@ -10686,7 +10890,7 @@
|
|
|
10686
10890
|
NullType,
|
|
10687
10891
|
ValueType
|
|
10688
10892
|
])) {
|
|
10689
|
-
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(needle.type) } instead`);
|
|
10893
|
+
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(needle.type) } instead`);
|
|
10690
10894
|
}
|
|
10691
10895
|
return new In(needle, haystack);
|
|
10692
10896
|
}
|
|
@@ -10701,13 +10905,13 @@
|
|
|
10701
10905
|
'number',
|
|
10702
10906
|
'null'
|
|
10703
10907
|
])) {
|
|
10704
|
-
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(typeOf(needle)) } instead.`);
|
|
10908
|
+
throw new RuntimeError$1(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
10705
10909
|
}
|
|
10706
10910
|
if (!isValidNativeType(haystack, [
|
|
10707
10911
|
'string',
|
|
10708
10912
|
'array'
|
|
10709
10913
|
])) {
|
|
10710
|
-
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString(typeOf(haystack)) } instead.`);
|
|
10914
|
+
throw new RuntimeError$1(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
10711
10915
|
}
|
|
10712
10916
|
return haystack.indexOf(needle) >= 0;
|
|
10713
10917
|
}
|
|
@@ -10726,6 +10930,7 @@
|
|
|
10726
10930
|
];
|
|
10727
10931
|
}
|
|
10728
10932
|
}
|
|
10933
|
+
var In$1 = In;
|
|
10729
10934
|
|
|
10730
10935
|
class IndexOf {
|
|
10731
10936
|
constructor(needle, haystack, fromIndex) {
|
|
@@ -10749,7 +10954,7 @@
|
|
|
10749
10954
|
NullType,
|
|
10750
10955
|
ValueType
|
|
10751
10956
|
])) {
|
|
10752
|
-
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(needle.type) } instead`);
|
|
10957
|
+
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(needle.type) } instead`);
|
|
10753
10958
|
}
|
|
10754
10959
|
if (args.length === 4) {
|
|
10755
10960
|
const fromIndex = context.parse(args[3], 3, NumberType);
|
|
@@ -10769,13 +10974,13 @@
|
|
|
10769
10974
|
'number',
|
|
10770
10975
|
'null'
|
|
10771
10976
|
])) {
|
|
10772
|
-
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(typeOf(needle)) } instead.`);
|
|
10977
|
+
throw new RuntimeError$1(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
10773
10978
|
}
|
|
10774
10979
|
if (!isValidNativeType(haystack, [
|
|
10775
10980
|
'string',
|
|
10776
10981
|
'array'
|
|
10777
10982
|
])) {
|
|
10778
|
-
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString(typeOf(haystack)) } instead.`);
|
|
10983
|
+
throw new RuntimeError$1(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
10779
10984
|
}
|
|
10780
10985
|
if (this.fromIndex) {
|
|
10781
10986
|
const fromIndex = this.fromIndex.evaluate(ctx);
|
|
@@ -10810,6 +11015,7 @@
|
|
|
10810
11015
|
];
|
|
10811
11016
|
}
|
|
10812
11017
|
}
|
|
11018
|
+
var IndexOf$1 = IndexOf;
|
|
10813
11019
|
|
|
10814
11020
|
class Match {
|
|
10815
11021
|
constructor(inputType, outputType, input, cases, outputs, otherwise) {
|
|
@@ -10922,6 +11128,7 @@
|
|
|
10922
11128
|
return serialized;
|
|
10923
11129
|
}
|
|
10924
11130
|
}
|
|
11131
|
+
var Match$1 = Match;
|
|
10925
11132
|
|
|
10926
11133
|
class Case {
|
|
10927
11134
|
constructor(type, branches, otherwise) {
|
|
@@ -10983,6 +11190,7 @@
|
|
|
10983
11190
|
return serialized;
|
|
10984
11191
|
}
|
|
10985
11192
|
}
|
|
11193
|
+
var Case$1 = Case;
|
|
10986
11194
|
|
|
10987
11195
|
class Slice {
|
|
10988
11196
|
constructor(type, input, beginIndex, endIndex) {
|
|
@@ -11000,11 +11208,11 @@
|
|
|
11000
11208
|
if (!input || !beginIndex)
|
|
11001
11209
|
return null;
|
|
11002
11210
|
if (!isValidType(input.type, [
|
|
11003
|
-
array(ValueType),
|
|
11211
|
+
array$1(ValueType),
|
|
11004
11212
|
StringType,
|
|
11005
11213
|
ValueType
|
|
11006
11214
|
])) {
|
|
11007
|
-
return context.error(`Expected first argument to be of type array or string, but found ${ toString(input.type) } instead`);
|
|
11215
|
+
return context.error(`Expected first argument to be of type array or string, but found ${ toString$1(input.type) } instead`);
|
|
11008
11216
|
}
|
|
11009
11217
|
if (args.length === 4) {
|
|
11010
11218
|
const endIndex = context.parse(args[3], 3, NumberType);
|
|
@@ -11022,7 +11230,7 @@
|
|
|
11022
11230
|
'string',
|
|
11023
11231
|
'array'
|
|
11024
11232
|
])) {
|
|
11025
|
-
throw new RuntimeError(`Expected first argument to be of type array or string, but found ${ toString(typeOf(input)) } instead.`);
|
|
11233
|
+
throw new RuntimeError$1(`Expected first argument to be of type array or string, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
11026
11234
|
}
|
|
11027
11235
|
if (this.endIndex) {
|
|
11028
11236
|
const endIndex = this.endIndex.evaluate(ctx);
|
|
@@ -11057,6 +11265,7 @@
|
|
|
11057
11265
|
];
|
|
11058
11266
|
}
|
|
11059
11267
|
}
|
|
11268
|
+
var Slice$1 = Slice;
|
|
11060
11269
|
|
|
11061
11270
|
function isComparableType(op, type) {
|
|
11062
11271
|
if (op === '==' || op === '!=') {
|
|
@@ -11119,22 +11328,22 @@
|
|
|
11119
11328
|
if (!lhs)
|
|
11120
11329
|
return null;
|
|
11121
11330
|
if (!isComparableType(op, lhs.type)) {
|
|
11122
|
-
return context.concat(1).error(`"${ op }" comparisons are not supported for type '${ toString(lhs.type) }'.`);
|
|
11331
|
+
return context.concat(1).error(`"${ op }" comparisons are not supported for type '${ toString$1(lhs.type) }'.`);
|
|
11123
11332
|
}
|
|
11124
11333
|
let rhs = context.parse(args[2], 2, ValueType);
|
|
11125
11334
|
if (!rhs)
|
|
11126
11335
|
return null;
|
|
11127
11336
|
if (!isComparableType(op, rhs.type)) {
|
|
11128
|
-
return context.concat(2).error(`"${ op }" comparisons are not supported for type '${ toString(rhs.type) }'.`);
|
|
11337
|
+
return context.concat(2).error(`"${ op }" comparisons are not supported for type '${ toString$1(rhs.type) }'.`);
|
|
11129
11338
|
}
|
|
11130
11339
|
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) }'.`);
|
|
11340
|
+
return context.error(`Cannot compare types '${ toString$1(lhs.type) }' and '${ toString$1(rhs.type) }'.`);
|
|
11132
11341
|
}
|
|
11133
11342
|
if (isOrderComparison) {
|
|
11134
11343
|
if (lhs.type.kind === 'value' && rhs.type.kind !== 'value') {
|
|
11135
|
-
lhs = new Assertion(rhs.type, [lhs]);
|
|
11344
|
+
lhs = new Assertion$1(rhs.type, [lhs]);
|
|
11136
11345
|
} else if (lhs.type.kind !== 'value' && rhs.type.kind === 'value') {
|
|
11137
|
-
rhs = new Assertion(lhs.type, [rhs]);
|
|
11346
|
+
rhs = new Assertion$1(lhs.type, [rhs]);
|
|
11138
11347
|
}
|
|
11139
11348
|
}
|
|
11140
11349
|
let collator = null;
|
|
@@ -11155,7 +11364,7 @@
|
|
|
11155
11364
|
const lt = typeOf(lhs);
|
|
11156
11365
|
const rt = typeOf(rhs);
|
|
11157
11366
|
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.`);
|
|
11367
|
+
throw new RuntimeError$1(`Expected arguments for "${ op }" to be (string, string) or (number, number), but found (${ lt.kind }, ${ rt.kind }) instead.`);
|
|
11159
11368
|
}
|
|
11160
11369
|
}
|
|
11161
11370
|
if (this.collator && !isOrderComparison && this.hasUntypedArgument) {
|
|
@@ -11297,7 +11506,7 @@
|
|
|
11297
11506
|
if (!input)
|
|
11298
11507
|
return null;
|
|
11299
11508
|
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.`);
|
|
11509
|
+
return context.error(`Expected argument of type string or array, but found ${ toString$1(input.type) } instead.`);
|
|
11301
11510
|
return new Length(input);
|
|
11302
11511
|
}
|
|
11303
11512
|
evaluate(ctx) {
|
|
@@ -11307,7 +11516,7 @@
|
|
|
11307
11516
|
} else if (Array.isArray(input)) {
|
|
11308
11517
|
return input.length;
|
|
11309
11518
|
} else {
|
|
11310
|
-
throw new RuntimeError(`Expected value to be of type string or array, but found ${ toString(typeOf(input)) } instead.`);
|
|
11519
|
+
throw new RuntimeError$1(`Expected value to be of type string or array, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
11311
11520
|
}
|
|
11312
11521
|
}
|
|
11313
11522
|
eachChild(fn) {
|
|
@@ -11324,6 +11533,7 @@
|
|
|
11324
11533
|
return serialized;
|
|
11325
11534
|
}
|
|
11326
11535
|
}
|
|
11536
|
+
var Length$1 = Length;
|
|
11327
11537
|
|
|
11328
11538
|
const expressions = {
|
|
11329
11539
|
'==': Equals,
|
|
@@ -11332,35 +11542,35 @@
|
|
|
11332
11542
|
'<': LessThan,
|
|
11333
11543
|
'>=': GreaterThanOrEqual,
|
|
11334
11544
|
'<=': LessThanOrEqual,
|
|
11335
|
-
'array': Assertion,
|
|
11336
|
-
'at': At,
|
|
11337
|
-
'boolean': Assertion,
|
|
11338
|
-
'case': Case,
|
|
11339
|
-
'coalesce': Coalesce,
|
|
11545
|
+
'array': Assertion$1,
|
|
11546
|
+
'at': At$1,
|
|
11547
|
+
'boolean': Assertion$1,
|
|
11548
|
+
'case': Case$1,
|
|
11549
|
+
'coalesce': Coalesce$1,
|
|
11340
11550
|
'collator': CollatorExpression,
|
|
11341
11551
|
'format': FormatExpression,
|
|
11342
11552
|
'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,
|
|
11553
|
+
'in': In$1,
|
|
11554
|
+
'index-of': IndexOf$1,
|
|
11555
|
+
'interpolate': Interpolate$1,
|
|
11556
|
+
'interpolate-hcl': Interpolate$1,
|
|
11557
|
+
'interpolate-lab': Interpolate$1,
|
|
11558
|
+
'length': Length$1,
|
|
11559
|
+
'let': Let$1,
|
|
11560
|
+
'literal': Literal$1,
|
|
11561
|
+
'match': Match$1,
|
|
11562
|
+
'number': Assertion$1,
|
|
11353
11563
|
'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
|
|
11564
|
+
'object': Assertion$1,
|
|
11565
|
+
'slice': Slice$1,
|
|
11566
|
+
'step': Step$1,
|
|
11567
|
+
'string': Assertion$1,
|
|
11568
|
+
'to-boolean': Coercion$1,
|
|
11569
|
+
'to-color': Coercion$1,
|
|
11570
|
+
'to-number': Coercion$1,
|
|
11571
|
+
'to-string': Coercion$1,
|
|
11572
|
+
'var': Var$1,
|
|
11573
|
+
'within': Within$1
|
|
11364
11574
|
};
|
|
11365
11575
|
function rgba(ctx, [r, g, b, a]) {
|
|
11366
11576
|
r = r.evaluate(ctx);
|
|
@@ -11369,8 +11579,8 @@
|
|
|
11369
11579
|
const alpha = a ? a.evaluate(ctx) : 1;
|
|
11370
11580
|
const error = validateRGBA(r, g, b, alpha);
|
|
11371
11581
|
if (error)
|
|
11372
|
-
throw new RuntimeError(error);
|
|
11373
|
-
return new Color(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);
|
|
11582
|
+
throw new RuntimeError$1(error);
|
|
11583
|
+
return new Color$1(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);
|
|
11374
11584
|
}
|
|
11375
11585
|
function has(key, obj) {
|
|
11376
11586
|
return key in obj;
|
|
@@ -11394,21 +11604,21 @@
|
|
|
11394
11604
|
function varargs(type) {
|
|
11395
11605
|
return { type };
|
|
11396
11606
|
}
|
|
11397
|
-
CompoundExpression.register(expressions, {
|
|
11607
|
+
CompoundExpression$1.register(expressions, {
|
|
11398
11608
|
'error': [
|
|
11399
11609
|
ErrorType,
|
|
11400
11610
|
[StringType],
|
|
11401
11611
|
(ctx, [v]) => {
|
|
11402
|
-
throw new RuntimeError(v.evaluate(ctx));
|
|
11612
|
+
throw new RuntimeError$1(v.evaluate(ctx));
|
|
11403
11613
|
}
|
|
11404
11614
|
],
|
|
11405
11615
|
'typeof': [
|
|
11406
11616
|
StringType,
|
|
11407
11617
|
[ValueType],
|
|
11408
|
-
(ctx, [v]) => toString(typeOf(v.evaluate(ctx)))
|
|
11618
|
+
(ctx, [v]) => toString$1(typeOf(v.evaluate(ctx)))
|
|
11409
11619
|
],
|
|
11410
11620
|
'to-rgba': [
|
|
11411
|
-
array(NumberType, 4),
|
|
11621
|
+
array$1(NumberType, 4),
|
|
11412
11622
|
[ColorType],
|
|
11413
11623
|
(ctx, [v]) => {
|
|
11414
11624
|
return v.evaluate(ctx).toArray();
|
|
@@ -11794,19 +12004,19 @@
|
|
|
11794
12004
|
],
|
|
11795
12005
|
'filter-type-in': [
|
|
11796
12006
|
BooleanType,
|
|
11797
|
-
[array(StringType)],
|
|
12007
|
+
[array$1(StringType)],
|
|
11798
12008
|
(ctx, [v]) => v.value.indexOf(ctx.geometryType()) >= 0
|
|
11799
12009
|
],
|
|
11800
12010
|
'filter-id-in': [
|
|
11801
12011
|
BooleanType,
|
|
11802
|
-
[array(ValueType)],
|
|
12012
|
+
[array$1(ValueType)],
|
|
11803
12013
|
(ctx, [v]) => v.value.indexOf(ctx.id()) >= 0
|
|
11804
12014
|
],
|
|
11805
12015
|
'filter-in-small': [
|
|
11806
12016
|
BooleanType,
|
|
11807
12017
|
[
|
|
11808
12018
|
StringType,
|
|
11809
|
-
array(ValueType)
|
|
12019
|
+
array$1(ValueType)
|
|
11810
12020
|
],
|
|
11811
12021
|
(ctx, [k, v]) => v.value.indexOf(ctx.properties()[k.value]) >= 0
|
|
11812
12022
|
],
|
|
@@ -11814,7 +12024,7 @@
|
|
|
11814
12024
|
BooleanType,
|
|
11815
12025
|
[
|
|
11816
12026
|
StringType,
|
|
11817
|
-
array(ValueType)
|
|
12027
|
+
array$1(ValueType)
|
|
11818
12028
|
],
|
|
11819
12029
|
(ctx, [k, v]) => binarySearch(ctx.properties()[k.value], v.value, 0, v.value.length - 1)
|
|
11820
12030
|
],
|
|
@@ -11891,7 +12101,7 @@
|
|
|
11891
12101
|
'concat': [
|
|
11892
12102
|
StringType,
|
|
11893
12103
|
varargs(ValueType),
|
|
11894
|
-
(ctx, args) => args.map(arg => toString
|
|
12104
|
+
(ctx, args) => args.map(arg => toString(arg.evaluate(ctx))).join('')
|
|
11895
12105
|
],
|
|
11896
12106
|
'resolved-locale': [
|
|
11897
12107
|
StringType,
|
|
@@ -11899,6 +12109,7 @@
|
|
|
11899
12109
|
(ctx, [collator]) => collator.evaluate(ctx).resolvedLocale()
|
|
11900
12110
|
]
|
|
11901
12111
|
});
|
|
12112
|
+
var definitions = expressions;
|
|
11902
12113
|
|
|
11903
12114
|
function success(value) {
|
|
11904
12115
|
return {
|
|
@@ -11939,7 +12150,7 @@
|
|
|
11939
12150
|
}
|
|
11940
12151
|
}
|
|
11941
12152
|
|
|
11942
|
-
function isFunction
|
|
12153
|
+
function isFunction(value) {
|
|
11943
12154
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
11944
12155
|
}
|
|
11945
12156
|
function identityFunction(x) {
|
|
@@ -11957,14 +12168,14 @@
|
|
|
11957
12168
|
parameters.stops = parameters.stops.map(stop => {
|
|
11958
12169
|
return [
|
|
11959
12170
|
stop[0],
|
|
11960
|
-
Color.parse(stop[1])
|
|
12171
|
+
Color$1.parse(stop[1])
|
|
11961
12172
|
];
|
|
11962
12173
|
});
|
|
11963
12174
|
}
|
|
11964
12175
|
if (parameters.default) {
|
|
11965
|
-
parameters.default = Color.parse(parameters.default);
|
|
12176
|
+
parameters.default = Color$1.parse(parameters.default);
|
|
11966
12177
|
} else {
|
|
11967
|
-
parameters.default = Color.parse(propertySpec.default);
|
|
12178
|
+
parameters.default = Color$1.parse(propertySpec.default);
|
|
11968
12179
|
}
|
|
11969
12180
|
}
|
|
11970
12181
|
if (parameters.colorSpace && parameters.colorSpace !== 'rgb' && !colorSpaces[parameters.colorSpace]) {
|
|
@@ -12021,7 +12232,7 @@
|
|
|
12021
12232
|
return {
|
|
12022
12233
|
kind: 'composite',
|
|
12023
12234
|
interpolationType,
|
|
12024
|
-
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
12235
|
+
interpolationFactor: Interpolate$1.interpolationFactor.bind(undefined, interpolationType),
|
|
12025
12236
|
zoomStops: featureFunctionStops.map(s => s[0]),
|
|
12026
12237
|
evaluate({zoom}, properties) {
|
|
12027
12238
|
return evaluateExponentialFunction({
|
|
@@ -12038,7 +12249,7 @@
|
|
|
12038
12249
|
return {
|
|
12039
12250
|
kind: 'camera',
|
|
12040
12251
|
interpolationType,
|
|
12041
|
-
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
12252
|
+
interpolationFactor: Interpolate$1.interpolationFactor.bind(undefined, interpolationType),
|
|
12042
12253
|
zoomStops: parameters.stops.map(s => s[0]),
|
|
12043
12254
|
evaluate: ({zoom}) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)
|
|
12044
12255
|
};
|
|
@@ -12048,14 +12259,14 @@
|
|
|
12048
12259
|
evaluate(_, feature) {
|
|
12049
12260
|
const value = feature && feature.properties ? feature.properties[parameters.property] : undefined;
|
|
12050
12261
|
if (value === undefined) {
|
|
12051
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12262
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12052
12263
|
}
|
|
12053
12264
|
return innerFun(parameters, propertySpec, value, hashedStops, categoricalKeyType);
|
|
12054
12265
|
}
|
|
12055
12266
|
};
|
|
12056
12267
|
}
|
|
12057
12268
|
}
|
|
12058
|
-
function coalesce(a, b, c) {
|
|
12269
|
+
function coalesce$1(a, b, c) {
|
|
12059
12270
|
if (a !== undefined)
|
|
12060
12271
|
return a;
|
|
12061
12272
|
if (b !== undefined)
|
|
@@ -12065,11 +12276,11 @@
|
|
|
12065
12276
|
}
|
|
12066
12277
|
function evaluateCategoricalFunction(parameters, propertySpec, input, hashedStops, keyType) {
|
|
12067
12278
|
const evaluated = typeof input === keyType ? hashedStops[input] : undefined;
|
|
12068
|
-
return coalesce(evaluated, parameters.default, propertySpec.default);
|
|
12279
|
+
return coalesce$1(evaluated, parameters.default, propertySpec.default);
|
|
12069
12280
|
}
|
|
12070
12281
|
function evaluateIntervalFunction(parameters, propertySpec, input) {
|
|
12071
12282
|
if (getType(input) !== 'number')
|
|
12072
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12283
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12073
12284
|
const n = parameters.stops.length;
|
|
12074
12285
|
if (n === 1)
|
|
12075
12286
|
return parameters.stops[0][1];
|
|
@@ -12083,7 +12294,7 @@
|
|
|
12083
12294
|
function evaluateExponentialFunction(parameters, propertySpec, input) {
|
|
12084
12295
|
const base = parameters.base !== undefined ? parameters.base : 1;
|
|
12085
12296
|
if (getType(input) !== 'number')
|
|
12086
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12297
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12087
12298
|
const n = parameters.stops.length;
|
|
12088
12299
|
if (n === 1)
|
|
12089
12300
|
return parameters.stops[0][1];
|
|
@@ -12116,7 +12327,7 @@
|
|
|
12116
12327
|
}
|
|
12117
12328
|
function evaluateIdentityFunction(parameters, propertySpec, input) {
|
|
12118
12329
|
if (propertySpec.type === 'color') {
|
|
12119
|
-
input = Color.parse(input);
|
|
12330
|
+
input = Color$1.parse(input);
|
|
12120
12331
|
} else if (propertySpec.type === 'formatted') {
|
|
12121
12332
|
input = Formatted.fromString(input.toString());
|
|
12122
12333
|
} else if (propertySpec.type === 'resolvedImage') {
|
|
@@ -12124,7 +12335,7 @@
|
|
|
12124
12335
|
} else if (getType(input) !== propertySpec.type && (propertySpec.type !== 'enum' || !propertySpec.values[input])) {
|
|
12125
12336
|
input = undefined;
|
|
12126
12337
|
}
|
|
12127
|
-
return coalesce(input, parameters.default, propertySpec.default);
|
|
12338
|
+
return coalesce$1(input, parameters.default, propertySpec.default);
|
|
12128
12339
|
}
|
|
12129
12340
|
function interpolationFactor(input, base, lowerValue, upperValue) {
|
|
12130
12341
|
const difference = upperValue - lowerValue;
|
|
@@ -12142,7 +12353,7 @@
|
|
|
12142
12353
|
constructor(expression, propertySpec) {
|
|
12143
12354
|
this.expression = expression;
|
|
12144
12355
|
this._warningHistory = {};
|
|
12145
|
-
this._evaluator = new EvaluationContext();
|
|
12356
|
+
this._evaluator = new EvaluationContext$1();
|
|
12146
12357
|
this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
|
|
12147
12358
|
this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;
|
|
12148
12359
|
}
|
|
@@ -12172,7 +12383,7 @@
|
|
|
12172
12383
|
return this._defaultValue;
|
|
12173
12384
|
}
|
|
12174
12385
|
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.`);
|
|
12386
|
+
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
12387
|
}
|
|
12177
12388
|
return val;
|
|
12178
12389
|
} catch (e) {
|
|
@@ -12187,10 +12398,10 @@
|
|
|
12187
12398
|
}
|
|
12188
12399
|
}
|
|
12189
12400
|
function isExpression(expression) {
|
|
12190
|
-
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in
|
|
12401
|
+
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in definitions;
|
|
12191
12402
|
}
|
|
12192
12403
|
function createExpression(expression, propertySpec) {
|
|
12193
|
-
const parser = new ParsingContext(
|
|
12404
|
+
const parser = new ParsingContext$1(definitions, [], propertySpec ? getExpectedType(propertySpec) : undefined);
|
|
12194
12405
|
const parsed = parser.parse(expression, undefined, undefined, undefined, propertySpec && propertySpec.type === 'string' ? { typeAnnotation: 'coerce' } : undefined);
|
|
12195
12406
|
if (!parsed) {
|
|
12196
12407
|
return error(parser.errors);
|
|
@@ -12226,7 +12437,7 @@
|
|
|
12226
12437
|
}
|
|
12227
12438
|
interpolationFactor(input, lower, upper) {
|
|
12228
12439
|
if (this.interpolationType) {
|
|
12229
|
-
return Interpolate.interpolationFactor(this.interpolationType, input, lower, upper);
|
|
12440
|
+
return Interpolate$1.interpolationFactor(this.interpolationType, input, lower, upper);
|
|
12230
12441
|
} else {
|
|
12231
12442
|
return 0;
|
|
12232
12443
|
}
|
|
@@ -12240,7 +12451,7 @@
|
|
|
12240
12451
|
const parsed = expression.value.expression;
|
|
12241
12452
|
const isFeatureConstant$1 = isFeatureConstant(parsed);
|
|
12242
12453
|
if (!isFeatureConstant$1 && !supportsPropertyExpression(propertySpec)) {
|
|
12243
|
-
return error([new ParsingError('', 'data expressions not supported')]);
|
|
12454
|
+
return error([new ParsingError$2('', 'data expressions not supported')]);
|
|
12244
12455
|
}
|
|
12245
12456
|
const isZoomConstant = isGlobalPropertyConstant(parsed, [
|
|
12246
12457
|
'zoom',
|
|
@@ -12248,20 +12459,20 @@
|
|
|
12248
12459
|
'distance-from-center'
|
|
12249
12460
|
]);
|
|
12250
12461
|
if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {
|
|
12251
|
-
return error([new ParsingError('', 'zoom expressions not supported')]);
|
|
12462
|
+
return error([new ParsingError$2('', 'zoom expressions not supported')]);
|
|
12252
12463
|
}
|
|
12253
12464
|
const zoomCurve = findZoomCurve(parsed);
|
|
12254
12465
|
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) {
|
|
12466
|
+
return error([new ParsingError$2('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);
|
|
12467
|
+
} else if (zoomCurve instanceof ParsingError$2) {
|
|
12257
12468
|
return error([zoomCurve]);
|
|
12258
|
-
} else if (zoomCurve instanceof Interpolate && !supportsInterpolation(propertySpec)) {
|
|
12259
|
-
return error([new ParsingError('', '"interpolate" expressions cannot be used with this property')]);
|
|
12469
|
+
} else if (zoomCurve instanceof Interpolate$1 && !supportsInterpolation(propertySpec)) {
|
|
12470
|
+
return error([new ParsingError$2('', '"interpolate" expressions cannot be used with this property')]);
|
|
12260
12471
|
}
|
|
12261
12472
|
if (!zoomCurve) {
|
|
12262
12473
|
return success(isFeatureConstant$1 ? new ZoomConstantExpression('constant', expression.value) : new ZoomConstantExpression('source', expression.value));
|
|
12263
12474
|
}
|
|
12264
|
-
const interpolationType = zoomCurve instanceof Interpolate ? zoomCurve.interpolation : undefined;
|
|
12475
|
+
const interpolationType = zoomCurve instanceof Interpolate$1 ? zoomCurve.interpolation : undefined;
|
|
12265
12476
|
return success(isFeatureConstant$1 ? new ZoomDependentExpression('camera', expression.value, zoomCurve.labels, interpolationType) : new ZoomDependentExpression('composite', expression.value, zoomCurve.labels, interpolationType));
|
|
12266
12477
|
}
|
|
12267
12478
|
class StylePropertyFunction {
|
|
@@ -12281,7 +12492,7 @@
|
|
|
12281
12492
|
}
|
|
12282
12493
|
}
|
|
12283
12494
|
function normalizePropertyExpression(value, specification) {
|
|
12284
|
-
if (isFunction
|
|
12495
|
+
if (isFunction(value)) {
|
|
12285
12496
|
return new StylePropertyFunction(value, specification);
|
|
12286
12497
|
} else if (isExpression(value)) {
|
|
12287
12498
|
const expression = createPropertyExpression(value, specification);
|
|
@@ -12292,7 +12503,7 @@
|
|
|
12292
12503
|
} else {
|
|
12293
12504
|
let constant = value;
|
|
12294
12505
|
if (typeof value === 'string' && specification.type === 'color') {
|
|
12295
|
-
constant = Color.parse(value);
|
|
12506
|
+
constant = Color$1.parse(value);
|
|
12296
12507
|
}
|
|
12297
12508
|
return {
|
|
12298
12509
|
kind: 'constant',
|
|
@@ -12302,29 +12513,29 @@
|
|
|
12302
12513
|
}
|
|
12303
12514
|
function findZoomCurve(expression) {
|
|
12304
12515
|
let result = null;
|
|
12305
|
-
if (expression instanceof Let) {
|
|
12516
|
+
if (expression instanceof Let$1) {
|
|
12306
12517
|
result = findZoomCurve(expression.result);
|
|
12307
|
-
} else if (expression instanceof Coalesce) {
|
|
12518
|
+
} else if (expression instanceof Coalesce$1) {
|
|
12308
12519
|
for (const arg of expression.args) {
|
|
12309
12520
|
result = findZoomCurve(arg);
|
|
12310
12521
|
if (result) {
|
|
12311
12522
|
break;
|
|
12312
12523
|
}
|
|
12313
12524
|
}
|
|
12314
|
-
} else if ((expression instanceof Step || expression instanceof Interpolate) && expression.input instanceof CompoundExpression && expression.input.name === 'zoom') {
|
|
12525
|
+
} else if ((expression instanceof Step$1 || expression instanceof Interpolate$1) && expression.input instanceof CompoundExpression$1 && expression.input.name === 'zoom') {
|
|
12315
12526
|
result = expression;
|
|
12316
12527
|
}
|
|
12317
|
-
if (result instanceof ParsingError) {
|
|
12528
|
+
if (result instanceof ParsingError$2) {
|
|
12318
12529
|
return result;
|
|
12319
12530
|
}
|
|
12320
12531
|
expression.eachChild(child => {
|
|
12321
12532
|
const childResult = findZoomCurve(child);
|
|
12322
|
-
if (childResult instanceof ParsingError) {
|
|
12533
|
+
if (childResult instanceof ParsingError$2) {
|
|
12323
12534
|
result = childResult;
|
|
12324
12535
|
} else if (!result && childResult) {
|
|
12325
|
-
result = new ParsingError('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.');
|
|
12536
|
+
result = new ParsingError$2('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.');
|
|
12326
12537
|
} else if (result && childResult && result !== childResult) {
|
|
12327
|
-
result = new ParsingError('', 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.');
|
|
12538
|
+
result = new ParsingError$2('', 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.');
|
|
12328
12539
|
}
|
|
12329
12540
|
});
|
|
12330
12541
|
return result;
|
|
@@ -12340,15 +12551,15 @@
|
|
|
12340
12551
|
resolvedImage: ResolvedImageType
|
|
12341
12552
|
};
|
|
12342
12553
|
if (spec.type === 'array') {
|
|
12343
|
-
return array(types[spec.value] || ValueType, spec.length);
|
|
12554
|
+
return array$1(types[spec.value] || ValueType, spec.length);
|
|
12344
12555
|
}
|
|
12345
12556
|
return types[spec.type];
|
|
12346
12557
|
}
|
|
12347
12558
|
function getDefaultValue(spec) {
|
|
12348
|
-
if (spec.type === 'color' && isFunction
|
|
12349
|
-
return new Color(0, 0, 0, 0);
|
|
12559
|
+
if (spec.type === 'color' && (isFunction(spec.default) || Array.isArray(spec.default))) {
|
|
12560
|
+
return new Color$1(0, 0, 0, 0);
|
|
12350
12561
|
} else if (spec.type === 'color') {
|
|
12351
|
-
return Color.parse(spec.default) || null;
|
|
12562
|
+
return Color$1.parse(spec.default) || null;
|
|
12352
12563
|
} else if (spec.default === undefined) {
|
|
12353
12564
|
return null;
|
|
12354
12565
|
} else {
|
|
@@ -12477,14 +12688,14 @@
|
|
|
12477
12688
|
return expression;
|
|
12478
12689
|
}
|
|
12479
12690
|
}
|
|
12480
|
-
function coalesce
|
|
12691
|
+
function coalesce(a, b) {
|
|
12481
12692
|
if (a !== undefined)
|
|
12482
12693
|
return a;
|
|
12483
12694
|
if (b !== undefined)
|
|
12484
12695
|
return b;
|
|
12485
12696
|
}
|
|
12486
12697
|
function getFallback(parameters, propertySpec) {
|
|
12487
|
-
const defaultValue = convertLiteral(coalesce
|
|
12698
|
+
const defaultValue = convertLiteral(coalesce(parameters.default, propertySpec.default));
|
|
12488
12699
|
if (defaultValue === undefined && propertySpec.type === 'resolvedImage') {
|
|
12489
12700
|
return '';
|
|
12490
12701
|
}
|
|
@@ -12718,7 +12929,7 @@
|
|
|
12718
12929
|
};
|
|
12719
12930
|
}
|
|
12720
12931
|
if (!isExpressionFilter(filter)) {
|
|
12721
|
-
filter = convertFilter(filter);
|
|
12932
|
+
filter = convertFilter$1(filter);
|
|
12722
12933
|
}
|
|
12723
12934
|
const filterExp = filter;
|
|
12724
12935
|
let staticFilter = true;
|
|
@@ -12863,16 +13074,16 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12863
13074
|
}
|
|
12864
13075
|
return false;
|
|
12865
13076
|
}
|
|
12866
|
-
function convertFilter(filter) {
|
|
13077
|
+
function convertFilter$1(filter) {
|
|
12867
13078
|
if (!filter)
|
|
12868
13079
|
return true;
|
|
12869
13080
|
const op = filter[0];
|
|
12870
13081
|
if (filter.length <= 1)
|
|
12871
13082
|
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;
|
|
13083
|
+
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
13084
|
return converted;
|
|
12874
13085
|
}
|
|
12875
|
-
function convertComparisonOp(property, value, op) {
|
|
13086
|
+
function convertComparisonOp$1(property, value, op) {
|
|
12876
13087
|
switch (property) {
|
|
12877
13088
|
case '$type':
|
|
12878
13089
|
return [
|
|
@@ -12893,9 +13104,9 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12893
13104
|
}
|
|
12894
13105
|
}
|
|
12895
13106
|
function convertDisjunctionOp(filters) {
|
|
12896
|
-
return ['any'].concat(filters.map(convertFilter));
|
|
13107
|
+
return ['any'].concat(filters.map(convertFilter$1));
|
|
12897
13108
|
}
|
|
12898
|
-
function convertInOp(property, values) {
|
|
13109
|
+
function convertInOp$1(property, values) {
|
|
12899
13110
|
if (values.length === 0) {
|
|
12900
13111
|
return false;
|
|
12901
13112
|
}
|
|
@@ -12938,7 +13149,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12938
13149
|
}
|
|
12939
13150
|
}
|
|
12940
13151
|
}
|
|
12941
|
-
function convertHasOp(property) {
|
|
13152
|
+
function convertHasOp$1(property) {
|
|
12942
13153
|
switch (property) {
|
|
12943
13154
|
case '$type':
|
|
12944
13155
|
return true;
|
|
@@ -12958,7 +13169,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12958
13169
|
];
|
|
12959
13170
|
}
|
|
12960
13171
|
|
|
12961
|
-
function convertFilter
|
|
13172
|
+
function convertFilter(filter) {
|
|
12962
13173
|
return _convertFilter(filter, {});
|
|
12963
13174
|
}
|
|
12964
13175
|
function _convertFilter(filter, expectedTypes) {
|
|
@@ -12973,7 +13184,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12973
13184
|
let converted;
|
|
12974
13185
|
if (op === '==' || op === '!=' || op === '<' || op === '>' || op === '<=' || op === '>=') {
|
|
12975
13186
|
const [, property, value] = filter;
|
|
12976
|
-
converted = convertComparisonOp
|
|
13187
|
+
converted = convertComparisonOp(property, value, op, expectedTypes);
|
|
12977
13188
|
} else if (op === 'any') {
|
|
12978
13189
|
const children = filter.slice(1).map(f => {
|
|
12979
13190
|
const types = {};
|
|
@@ -12996,15 +13207,15 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12996
13207
|
_convertFilter(['any'].concat(filter.slice(1)), {})
|
|
12997
13208
|
];
|
|
12998
13209
|
} else if (op === 'in') {
|
|
12999
|
-
converted = convertInOp
|
|
13210
|
+
converted = convertInOp(filter[1], filter.slice(2));
|
|
13000
13211
|
} else if (op === '!in') {
|
|
13001
|
-
converted = convertInOp
|
|
13212
|
+
converted = convertInOp(filter[1], filter.slice(2), true);
|
|
13002
13213
|
} else if (op === 'has') {
|
|
13003
|
-
converted = convertHasOp
|
|
13214
|
+
converted = convertHasOp(filter[1]);
|
|
13004
13215
|
} else if (op === '!has') {
|
|
13005
13216
|
converted = [
|
|
13006
13217
|
'!',
|
|
13007
|
-
convertHasOp
|
|
13218
|
+
convertHasOp(filter[1])
|
|
13008
13219
|
];
|
|
13009
13220
|
} else {
|
|
13010
13221
|
converted = true;
|
|
@@ -13033,7 +13244,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13033
13244
|
return conditions[0];
|
|
13034
13245
|
return ['all'].concat(conditions);
|
|
13035
13246
|
}
|
|
13036
|
-
function convertComparisonOp
|
|
13247
|
+
function convertComparisonOp(property, value, op, expectedTypes) {
|
|
13037
13248
|
let get;
|
|
13038
13249
|
if (property === '$type') {
|
|
13039
13250
|
return [
|
|
@@ -13089,7 +13300,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13089
13300
|
value
|
|
13090
13301
|
];
|
|
13091
13302
|
}
|
|
13092
|
-
function convertInOp
|
|
13303
|
+
function convertInOp(property, values, negate = false) {
|
|
13093
13304
|
if (values.length === 0)
|
|
13094
13305
|
return negate;
|
|
13095
13306
|
let get;
|
|
@@ -13127,7 +13338,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13127
13338
|
v
|
|
13128
13339
|
]));
|
|
13129
13340
|
}
|
|
13130
|
-
function convertHasOp
|
|
13341
|
+
function convertHasOp(property) {
|
|
13131
13342
|
if (property === '$type') {
|
|
13132
13343
|
return true;
|
|
13133
13344
|
} else if (property === '$id') {
|
|
@@ -13148,7 +13359,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13148
13359
|
const converted = [];
|
|
13149
13360
|
eachLayer(style, layer => {
|
|
13150
13361
|
if (layer.filter) {
|
|
13151
|
-
layer.filter = convertFilter
|
|
13362
|
+
layer.filter = convertFilter(layer.filter);
|
|
13152
13363
|
}
|
|
13153
13364
|
});
|
|
13154
13365
|
eachProperty(style, {
|
|
@@ -13675,7 +13886,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13675
13886
|
}
|
|
13676
13887
|
}
|
|
13677
13888
|
|
|
13678
|
-
class ParsingError
|
|
13889
|
+
class ParsingError {
|
|
13679
13890
|
constructor(error) {
|
|
13680
13891
|
this.error = error;
|
|
13681
13892
|
this.message = error.message;
|
|
@@ -14026,7 +14237,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14026
14237
|
return [];
|
|
14027
14238
|
}
|
|
14028
14239
|
const errors = [];
|
|
14029
|
-
if (e instanceof CompoundExpression) {
|
|
14240
|
+
if (e instanceof CompoundExpression$1) {
|
|
14030
14241
|
if (disallowedParameters.has(e.name)) {
|
|
14031
14242
|
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
14243
|
}
|
|
@@ -14208,7 +14419,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14208
14419
|
if (propertyKey === 'text-field' && style && !style.glyphs) {
|
|
14209
14420
|
errors.push(new ValidationError(key, value, 'use of "text-field" requires a style "glyphs" property'));
|
|
14210
14421
|
}
|
|
14211
|
-
if (propertyKey === 'text-font' && isFunction
|
|
14422
|
+
if (propertyKey === 'text-font' && isFunction(deepUnbundle(value)) && unbundle(value.type) === 'identity') {
|
|
14212
14423
|
errors.push(new ValidationError(key, value, '"text-font" does not support identity functions'));
|
|
14213
14424
|
}
|
|
14214
14425
|
}
|
|
@@ -14293,7 +14504,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14293
14504
|
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" must specify a "source-layer"`));
|
|
14294
14505
|
} else if (sourceType === 'raster-dem' && type !== 'hillshade') {
|
|
14295
14506
|
errors.push(new ValidationError(key, layer.source, 'raster-dem source can only be used with layer type \'hillshade\'.'));
|
|
14296
|
-
} else if (type === 'line' && layer.paint && layer.paint['line-gradient'] && (sourceType !== 'geojson' || !source.lineMetrics)) {
|
|
14507
|
+
} else if (type === 'line' && layer.paint && (layer.paint['line-gradient'] || layer.paint['line-trim-offset']) && (sourceType !== 'geojson' || !source.lineMetrics)) {
|
|
14297
14508
|
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`));
|
|
14298
14509
|
}
|
|
14299
14510
|
}
|
|
@@ -14668,7 +14879,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14668
14879
|
const value = options.value;
|
|
14669
14880
|
const valueSpec = options.valueSpec;
|
|
14670
14881
|
const styleSpec = options.styleSpec;
|
|
14671
|
-
if (valueSpec.expression && isFunction
|
|
14882
|
+
if (valueSpec.expression && isFunction(unbundle(value))) {
|
|
14672
14883
|
return validateFunction(options);
|
|
14673
14884
|
} else if (valueSpec.expression && isExpression(deepUnbundle(value))) {
|
|
14674
14885
|
return validateExpression(options);
|
|
@@ -14695,7 +14906,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14695
14906
|
return errors;
|
|
14696
14907
|
}
|
|
14697
14908
|
|
|
14698
|
-
function validateStyle(style, styleSpec = v8) {
|
|
14909
|
+
function validateStyle$1(style, styleSpec = v8) {
|
|
14699
14910
|
const errors = validate({
|
|
14700
14911
|
key: '',
|
|
14701
14912
|
value: style,
|
|
@@ -15372,25 +15583,27 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
15372
15583
|
}
|
|
15373
15584
|
});
|
|
15374
15585
|
|
|
15586
|
+
var jsonlint$1 = jsonlint;
|
|
15587
|
+
|
|
15375
15588
|
function readStyle(style) {
|
|
15376
15589
|
if (style instanceof String || typeof style === 'string' || style instanceof Buffer) {
|
|
15377
15590
|
try {
|
|
15378
|
-
return jsonlint.parse(style.toString());
|
|
15591
|
+
return jsonlint$1.parse(style.toString());
|
|
15379
15592
|
} catch (e) {
|
|
15380
|
-
throw new ParsingError
|
|
15593
|
+
throw new ParsingError(e);
|
|
15381
15594
|
}
|
|
15382
15595
|
}
|
|
15383
15596
|
return style;
|
|
15384
15597
|
}
|
|
15385
15598
|
|
|
15386
|
-
function validateStyle
|
|
15599
|
+
function validateStyle(style, styleSpec = v8) {
|
|
15387
15600
|
let s = style;
|
|
15388
15601
|
try {
|
|
15389
15602
|
s = readStyle(s);
|
|
15390
15603
|
} catch (e) {
|
|
15391
15604
|
return [e];
|
|
15392
15605
|
}
|
|
15393
|
-
return validateStyle(s, styleSpec);
|
|
15606
|
+
return validateStyle$1(s, styleSpec);
|
|
15394
15607
|
}
|
|
15395
15608
|
|
|
15396
15609
|
const SUPPORTED_SPEC_VERSION = 8;
|
|
@@ -15499,14 +15712,14 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
15499
15712
|
} catch (e) {
|
|
15500
15713
|
return [e];
|
|
15501
15714
|
}
|
|
15502
|
-
let errors = validateStyle(s, v8).concat(getRootErrors(s, Object.keys(v8.$root)));
|
|
15715
|
+
let errors = validateStyle$1(s, v8).concat(getRootErrors(s, Object.keys(v8.$root)));
|
|
15503
15716
|
if (s.sources) {
|
|
15504
15717
|
errors = errors.concat(getSourcesErrors(s.sources));
|
|
15505
15718
|
}
|
|
15506
15719
|
return errors;
|
|
15507
15720
|
}
|
|
15508
15721
|
|
|
15509
|
-
const expression
|
|
15722
|
+
const expression = {
|
|
15510
15723
|
StyleExpression,
|
|
15511
15724
|
isExpression,
|
|
15512
15725
|
isExpressionFilter,
|
|
@@ -15520,7 +15733,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
15520
15733
|
const styleFunction = {
|
|
15521
15734
|
convertFunction,
|
|
15522
15735
|
createFunction,
|
|
15523
|
-
isFunction
|
|
15736
|
+
isFunction
|
|
15524
15737
|
};
|
|
15525
15738
|
const visit = {
|
|
15526
15739
|
eachSource,
|
|
@@ -15528,25 +15741,25 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
15528
15741
|
eachProperty
|
|
15529
15742
|
};
|
|
15530
15743
|
|
|
15531
|
-
exports.Color = Color;
|
|
15532
|
-
exports.ParsingError = ParsingError
|
|
15744
|
+
exports.Color = Color$1;
|
|
15745
|
+
exports.ParsingError = ParsingError;
|
|
15533
15746
|
exports.ValidationError = ValidationError;
|
|
15534
15747
|
exports.composite = composite;
|
|
15535
|
-
exports.convertFilter = convertFilter
|
|
15748
|
+
exports.convertFilter = convertFilter;
|
|
15536
15749
|
exports.derefLayers = derefLayers;
|
|
15537
15750
|
exports.diff = diffStyles;
|
|
15538
|
-
exports.expression = expression
|
|
15751
|
+
exports.expression = expression;
|
|
15539
15752
|
exports.featureFilter = createFilter;
|
|
15540
|
-
exports.format = format;
|
|
15541
|
-
exports
|
|
15753
|
+
exports.format = format$1;
|
|
15754
|
+
exports["function"] = styleFunction;
|
|
15542
15755
|
exports.latest = v8;
|
|
15543
15756
|
exports.migrate = migrate;
|
|
15544
15757
|
exports.v8 = v8;
|
|
15545
|
-
exports.validate = validateStyle
|
|
15758
|
+
exports.validate = validateStyle;
|
|
15546
15759
|
exports.validateMapboxApiSupported = validateMapboxApiSupported;
|
|
15547
15760
|
exports.visit = visit;
|
|
15548
15761
|
|
|
15549
15762
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
15550
15763
|
|
|
15551
|
-
}))
|
|
15764
|
+
}));
|
|
15552
15765
|
//# sourceMappingURL=index.cjs.map
|