@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.es.js
CHANGED
|
@@ -62,7 +62,7 @@ var $root = {
|
|
|
62
62
|
},
|
|
63
63
|
fog: {
|
|
64
64
|
type: "fog",
|
|
65
|
-
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."
|
|
65
|
+
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."
|
|
66
66
|
},
|
|
67
67
|
sources: {
|
|
68
68
|
required: true,
|
|
@@ -95,7 +95,7 @@ var $root = {
|
|
|
95
95
|
},
|
|
96
96
|
projection: {
|
|
97
97
|
type: "projection",
|
|
98
|
-
doc: "The projection the map should be rendered in. Supported projections are Albers, Equal Earth, Equirectangular (WGS84), Lambert conformal conic,
|
|
98
|
+
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.",
|
|
99
99
|
example: {
|
|
100
100
|
name: "albers",
|
|
101
101
|
center: [
|
|
@@ -2636,7 +2636,7 @@ var function_stop = {
|
|
|
2636
2636
|
length: 2,
|
|
2637
2637
|
doc: "Zoom level and value pair."
|
|
2638
2638
|
};
|
|
2639
|
-
var expression = {
|
|
2639
|
+
var expression$1 = {
|
|
2640
2640
|
type: "array",
|
|
2641
2641
|
value: "*",
|
|
2642
2642
|
minimum: 1,
|
|
@@ -3741,7 +3741,9 @@ var fog = {
|
|
|
3741
3741
|
],
|
|
3742
3742
|
"sdk-support": {
|
|
3743
3743
|
"basic functionality": {
|
|
3744
|
-
js: "2.3.0"
|
|
3744
|
+
js: "2.3.0",
|
|
3745
|
+
android: "10.6.0",
|
|
3746
|
+
ios: "10.6.0"
|
|
3745
3747
|
}
|
|
3746
3748
|
}
|
|
3747
3749
|
},
|
|
@@ -3756,17 +3758,83 @@ var fog = {
|
|
|
3756
3758
|
]
|
|
3757
3759
|
},
|
|
3758
3760
|
transition: true,
|
|
3759
|
-
doc: "The color of the
|
|
3761
|
+
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.",
|
|
3760
3762
|
"sdk-support": {
|
|
3761
3763
|
"basic functionality": {
|
|
3762
|
-
js: "2.3.0"
|
|
3764
|
+
js: "2.3.0",
|
|
3765
|
+
android: "10.6.0",
|
|
3766
|
+
ios: "10.6.0"
|
|
3767
|
+
}
|
|
3768
|
+
}
|
|
3769
|
+
},
|
|
3770
|
+
"high-color": {
|
|
3771
|
+
type: "color",
|
|
3772
|
+
"property-type": "data-constant",
|
|
3773
|
+
"default": "#245cdf",
|
|
3774
|
+
expression: {
|
|
3775
|
+
interpolated: true,
|
|
3776
|
+
parameters: [
|
|
3777
|
+
"zoom"
|
|
3778
|
+
]
|
|
3779
|
+
},
|
|
3780
|
+
transition: true,
|
|
3781
|
+
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.",
|
|
3782
|
+
"sdk-support": {
|
|
3783
|
+
"basic functionality": {
|
|
3784
|
+
js: "2.9.0",
|
|
3785
|
+
android: "10.6.0",
|
|
3786
|
+
ios: "10.6.0"
|
|
3787
|
+
}
|
|
3788
|
+
}
|
|
3789
|
+
},
|
|
3790
|
+
"space-color": {
|
|
3791
|
+
type: "color",
|
|
3792
|
+
"property-type": "data-constant",
|
|
3793
|
+
"default": [
|
|
3794
|
+
"interpolate",
|
|
3795
|
+
[
|
|
3796
|
+
"linear"
|
|
3797
|
+
],
|
|
3798
|
+
[
|
|
3799
|
+
"zoom"
|
|
3800
|
+
],
|
|
3801
|
+
4,
|
|
3802
|
+
"#010b19",
|
|
3803
|
+
7,
|
|
3804
|
+
"#367ab9"
|
|
3805
|
+
],
|
|
3806
|
+
expression: {
|
|
3807
|
+
interpolated: true,
|
|
3808
|
+
parameters: [
|
|
3809
|
+
"zoom"
|
|
3810
|
+
]
|
|
3811
|
+
},
|
|
3812
|
+
transition: true,
|
|
3813
|
+
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.",
|
|
3814
|
+
"sdk-support": {
|
|
3815
|
+
"basic functionality": {
|
|
3816
|
+
js: "2.9.0",
|
|
3817
|
+
android: "10.6.0",
|
|
3818
|
+
ios: "10.6.0"
|
|
3763
3819
|
}
|
|
3764
3820
|
}
|
|
3765
3821
|
},
|
|
3766
3822
|
"horizon-blend": {
|
|
3767
3823
|
type: "number",
|
|
3768
3824
|
"property-type": "data-constant",
|
|
3769
|
-
"default":
|
|
3825
|
+
"default": [
|
|
3826
|
+
"interpolate",
|
|
3827
|
+
[
|
|
3828
|
+
"linear"
|
|
3829
|
+
],
|
|
3830
|
+
[
|
|
3831
|
+
"zoom"
|
|
3832
|
+
],
|
|
3833
|
+
4,
|
|
3834
|
+
0.2,
|
|
3835
|
+
7,
|
|
3836
|
+
0.1
|
|
3837
|
+
],
|
|
3770
3838
|
minimum: 0,
|
|
3771
3839
|
maximum: 1,
|
|
3772
3840
|
expression: {
|
|
@@ -3776,10 +3844,46 @@ var fog = {
|
|
|
3776
3844
|
]
|
|
3777
3845
|
},
|
|
3778
3846
|
transition: true,
|
|
3779
|
-
doc: "Horizon blend applies a smooth fade from the color of the
|
|
3847
|
+
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.",
|
|
3780
3848
|
"sdk-support": {
|
|
3781
3849
|
"basic functionality": {
|
|
3782
|
-
js: "2.3.0"
|
|
3850
|
+
js: "2.3.0",
|
|
3851
|
+
android: "10.6.0",
|
|
3852
|
+
ios: "10.6.0"
|
|
3853
|
+
}
|
|
3854
|
+
}
|
|
3855
|
+
},
|
|
3856
|
+
"star-intensity": {
|
|
3857
|
+
type: "number",
|
|
3858
|
+
"property-type": "data-constant",
|
|
3859
|
+
"default": [
|
|
3860
|
+
"interpolate",
|
|
3861
|
+
[
|
|
3862
|
+
"linear"
|
|
3863
|
+
],
|
|
3864
|
+
[
|
|
3865
|
+
"zoom"
|
|
3866
|
+
],
|
|
3867
|
+
5,
|
|
3868
|
+
0.35,
|
|
3869
|
+
6,
|
|
3870
|
+
0
|
|
3871
|
+
],
|
|
3872
|
+
minimum: 0,
|
|
3873
|
+
maximum: 1,
|
|
3874
|
+
expression: {
|
|
3875
|
+
interpolated: true,
|
|
3876
|
+
parameters: [
|
|
3877
|
+
"zoom"
|
|
3878
|
+
]
|
|
3879
|
+
},
|
|
3880
|
+
transition: true,
|
|
3881
|
+
doc: "A value controlling the star intensity where `0` will show no stars and `1` will show stars at their maximum intensity.",
|
|
3882
|
+
"sdk-support": {
|
|
3883
|
+
"basic functionality": {
|
|
3884
|
+
js: "2.9.0",
|
|
3885
|
+
android: "10.6.0",
|
|
3886
|
+
ios: "10.6.0"
|
|
3783
3887
|
}
|
|
3784
3888
|
}
|
|
3785
3889
|
}
|
|
@@ -3916,6 +4020,9 @@ var projection = {
|
|
|
3916
4020
|
},
|
|
3917
4021
|
winkelTripel: {
|
|
3918
4022
|
doc: "A Winkel Tripel projection."
|
|
4023
|
+
},
|
|
4024
|
+
globe: {
|
|
4025
|
+
doc: "A globe projection."
|
|
3919
4026
|
}
|
|
3920
4027
|
},
|
|
3921
4028
|
"default": "mercator",
|
|
@@ -3932,6 +4039,14 @@ var projection = {
|
|
|
3932
4039
|
length: 2,
|
|
3933
4040
|
value: "number",
|
|
3934
4041
|
"property-type": "data-constant",
|
|
4042
|
+
minimum: [
|
|
4043
|
+
-180,
|
|
4044
|
+
-90
|
|
4045
|
+
],
|
|
4046
|
+
maximum: [
|
|
4047
|
+
180,
|
|
4048
|
+
90
|
|
4049
|
+
],
|
|
3935
4050
|
transition: false,
|
|
3936
4051
|
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].",
|
|
3937
4052
|
example: [
|
|
@@ -3957,6 +4072,14 @@ var projection = {
|
|
|
3957
4072
|
length: 2,
|
|
3958
4073
|
value: "number",
|
|
3959
4074
|
"property-type": "data-constant",
|
|
4075
|
+
minimum: [
|
|
4076
|
+
-90,
|
|
4077
|
+
-90
|
|
4078
|
+
],
|
|
4079
|
+
maximum: [
|
|
4080
|
+
90,
|
|
4081
|
+
90
|
|
4082
|
+
],
|
|
3960
4083
|
transition: false,
|
|
3961
4084
|
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).",
|
|
3962
4085
|
example: [
|
|
@@ -4005,6 +4128,9 @@ var terrain = {
|
|
|
4005
4128
|
},
|
|
4006
4129
|
transition: true,
|
|
4007
4130
|
doc: "Exaggerates the elevation of the terrain by multiplying the data from the DEM with this value.",
|
|
4131
|
+
requires: [
|
|
4132
|
+
"source"
|
|
4133
|
+
],
|
|
4008
4134
|
"sdk-support": {
|
|
4009
4135
|
"basic functionality": {
|
|
4010
4136
|
js: "2.0.0",
|
|
@@ -4572,6 +4698,42 @@ var paint_line = {
|
|
|
4572
4698
|
]
|
|
4573
4699
|
},
|
|
4574
4700
|
"property-type": "color-ramp"
|
|
4701
|
+
},
|
|
4702
|
+
"line-trim-offset": {
|
|
4703
|
+
type: "array",
|
|
4704
|
+
value: "number",
|
|
4705
|
+
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].",
|
|
4706
|
+
length: 2,
|
|
4707
|
+
"default": [
|
|
4708
|
+
0,
|
|
4709
|
+
0
|
|
4710
|
+
],
|
|
4711
|
+
minimum: [
|
|
4712
|
+
0,
|
|
4713
|
+
0
|
|
4714
|
+
],
|
|
4715
|
+
maximum: [
|
|
4716
|
+
1,
|
|
4717
|
+
1
|
|
4718
|
+
],
|
|
4719
|
+
transition: false,
|
|
4720
|
+
requires: [
|
|
4721
|
+
{
|
|
4722
|
+
source: "geojson",
|
|
4723
|
+
has: {
|
|
4724
|
+
lineMetrics: true
|
|
4725
|
+
}
|
|
4726
|
+
}
|
|
4727
|
+
],
|
|
4728
|
+
"sdk-support": {
|
|
4729
|
+
"basic functionality": {
|
|
4730
|
+
js: "2.9.0",
|
|
4731
|
+
android: "10.5.0",
|
|
4732
|
+
ios: "10.5.0",
|
|
4733
|
+
macos: "10.5.0"
|
|
4734
|
+
}
|
|
4735
|
+
},
|
|
4736
|
+
"property-type": "constant"
|
|
4575
4737
|
}
|
|
4576
4738
|
};
|
|
4577
4739
|
var paint_circle = {
|
|
@@ -6317,7 +6479,7 @@ var v8 = {
|
|
|
6317
6479
|
}
|
|
6318
6480
|
},
|
|
6319
6481
|
function_stop: function_stop,
|
|
6320
|
-
expression: expression,
|
|
6482
|
+
expression: expression$1,
|
|
6321
6483
|
expression_name: expression_name,
|
|
6322
6484
|
fog: fog,
|
|
6323
6485
|
light: light,
|
|
@@ -6691,6 +6853,8 @@ var jsonStringifyPrettyCompact = function stringify(passedObj, options) {
|
|
|
6691
6853
|
})(passedObj, "", 0);
|
|
6692
6854
|
};
|
|
6693
6855
|
|
|
6856
|
+
var stringifyPretty = jsonStringifyPrettyCompact;
|
|
6857
|
+
|
|
6694
6858
|
function sortKeysBy(obj, reference) {
|
|
6695
6859
|
const result = {};
|
|
6696
6860
|
for (const key in reference) {
|
|
@@ -6705,12 +6869,12 @@ function sortKeysBy(obj, reference) {
|
|
|
6705
6869
|
}
|
|
6706
6870
|
return result;
|
|
6707
6871
|
}
|
|
6708
|
-
function format(style, space = 2) {
|
|
6872
|
+
function format$1(style, space = 2) {
|
|
6709
6873
|
style = sortKeysBy(style, v8.$root);
|
|
6710
6874
|
if (style.layers) {
|
|
6711
6875
|
style.layers = style.layers.map(layer => sortKeysBy(layer, v8.layer));
|
|
6712
6876
|
}
|
|
6713
|
-
return
|
|
6877
|
+
return stringifyPretty(style, { indent: space });
|
|
6714
6878
|
}
|
|
6715
6879
|
|
|
6716
6880
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -7378,7 +7542,7 @@ exports.encode = exports.stringify = encode;
|
|
|
7378
7542
|
var parse = urlParse;
|
|
7379
7543
|
var resolve = urlResolve;
|
|
7380
7544
|
var resolveObject = urlResolveObject;
|
|
7381
|
-
var format
|
|
7545
|
+
var format = urlFormat;
|
|
7382
7546
|
|
|
7383
7547
|
var Url_1 = Url;
|
|
7384
7548
|
|
|
@@ -8085,7 +8249,7 @@ var url = {
|
|
|
8085
8249
|
parse: parse,
|
|
8086
8250
|
resolve: resolve,
|
|
8087
8251
|
resolveObject: resolveObject,
|
|
8088
|
-
format: format
|
|
8252
|
+
format: format,
|
|
8089
8253
|
Url: Url_1
|
|
8090
8254
|
};
|
|
8091
8255
|
|
|
@@ -8166,7 +8330,7 @@ function resolveConstant(style, value) {
|
|
|
8166
8330
|
return value;
|
|
8167
8331
|
}
|
|
8168
8332
|
}
|
|
8169
|
-
function isFunction(value) {
|
|
8333
|
+
function isFunction$1(value) {
|
|
8170
8334
|
return Array.isArray(value.stops);
|
|
8171
8335
|
}
|
|
8172
8336
|
function renameProperty(obj, from, to) {
|
|
@@ -8208,7 +8372,7 @@ function migrateToV8 (style) {
|
|
|
8208
8372
|
layout: true
|
|
8209
8373
|
}, property => {
|
|
8210
8374
|
const value = resolveConstant(style, property.value);
|
|
8211
|
-
if (isFunction(value)) {
|
|
8375
|
+
if (isFunction$1(value)) {
|
|
8212
8376
|
value.stops.forEach(stop => {
|
|
8213
8377
|
stop[1] = resolveConstant(style, stop[1]);
|
|
8214
8378
|
});
|
|
@@ -8299,13 +8463,14 @@ function extend (output, ...inputs) {
|
|
|
8299
8463
|
return output;
|
|
8300
8464
|
}
|
|
8301
8465
|
|
|
8302
|
-
class ParsingError extends Error {
|
|
8466
|
+
class ParsingError$1 extends Error {
|
|
8303
8467
|
constructor(key, message) {
|
|
8304
8468
|
super(message);
|
|
8305
8469
|
this.message = message;
|
|
8306
8470
|
this.key = key;
|
|
8307
8471
|
}
|
|
8308
8472
|
}
|
|
8473
|
+
var ParsingError$2 = ParsingError$1;
|
|
8309
8474
|
|
|
8310
8475
|
class Scope {
|
|
8311
8476
|
constructor(parent, bindings = []) {
|
|
@@ -8333,6 +8498,7 @@ class Scope {
|
|
|
8333
8498
|
return this.parent ? this.parent.has(name) : false;
|
|
8334
8499
|
}
|
|
8335
8500
|
}
|
|
8501
|
+
var Scope$1 = Scope;
|
|
8336
8502
|
|
|
8337
8503
|
const NullType = { kind: 'null' };
|
|
8338
8504
|
const NumberType = { kind: 'number' };
|
|
@@ -8345,16 +8511,16 @@ const ErrorType = { kind: 'error' };
|
|
|
8345
8511
|
const CollatorType = { kind: 'collator' };
|
|
8346
8512
|
const FormattedType = { kind: 'formatted' };
|
|
8347
8513
|
const ResolvedImageType = { kind: 'resolvedImage' };
|
|
8348
|
-
function array(itemType, N) {
|
|
8514
|
+
function array$1(itemType, N) {
|
|
8349
8515
|
return {
|
|
8350
8516
|
kind: 'array',
|
|
8351
8517
|
itemType,
|
|
8352
8518
|
N
|
|
8353
8519
|
};
|
|
8354
8520
|
}
|
|
8355
|
-
function toString(type) {
|
|
8521
|
+
function toString$1(type) {
|
|
8356
8522
|
if (type.kind === 'array') {
|
|
8357
|
-
const itemType = toString(type.itemType);
|
|
8523
|
+
const itemType = toString$1(type.itemType);
|
|
8358
8524
|
return typeof type.N === 'number' ? `array<${ itemType }, ${ type.N }>` : type.itemType.kind === 'value' ? 'array' : `array<${ itemType }>`;
|
|
8359
8525
|
} else {
|
|
8360
8526
|
return type.kind;
|
|
@@ -8368,7 +8534,7 @@ const valueMemberTypes = [
|
|
|
8368
8534
|
ColorType,
|
|
8369
8535
|
FormattedType,
|
|
8370
8536
|
ObjectType,
|
|
8371
|
-
array(ValueType),
|
|
8537
|
+
array$1(ValueType),
|
|
8372
8538
|
ResolvedImageType
|
|
8373
8539
|
];
|
|
8374
8540
|
function checkSubtype(expected, t) {
|
|
@@ -8387,7 +8553,7 @@ function checkSubtype(expected, t) {
|
|
|
8387
8553
|
}
|
|
8388
8554
|
}
|
|
8389
8555
|
}
|
|
8390
|
-
return `Expected ${ toString(expected) } but found ${ toString(t) } instead.`;
|
|
8556
|
+
return `Expected ${ toString$1(expected) } but found ${ toString$1(t) } instead.`;
|
|
8391
8557
|
}
|
|
8392
8558
|
function isValidType(provided, allowedTypes) {
|
|
8393
8559
|
return allowedTypes.some(t => t.kind === provided.kind);
|
|
@@ -8651,12 +8817,36 @@ class Color {
|
|
|
8651
8817
|
a
|
|
8652
8818
|
];
|
|
8653
8819
|
}
|
|
8820
|
+
toArray01() {
|
|
8821
|
+
const {r, g, b, a} = this;
|
|
8822
|
+
return a === 0 ? [
|
|
8823
|
+
0,
|
|
8824
|
+
0,
|
|
8825
|
+
0,
|
|
8826
|
+
0
|
|
8827
|
+
] : [
|
|
8828
|
+
r / a,
|
|
8829
|
+
g / a,
|
|
8830
|
+
b / a,
|
|
8831
|
+
a
|
|
8832
|
+
];
|
|
8833
|
+
}
|
|
8834
|
+
toArray01PremultipliedAlpha() {
|
|
8835
|
+
const {r, g, b, a} = this;
|
|
8836
|
+
return [
|
|
8837
|
+
r,
|
|
8838
|
+
g,
|
|
8839
|
+
b,
|
|
8840
|
+
a
|
|
8841
|
+
];
|
|
8842
|
+
}
|
|
8654
8843
|
}
|
|
8655
8844
|
Color.black = new Color(0, 0, 0, 1);
|
|
8656
8845
|
Color.white = new Color(1, 1, 1, 1);
|
|
8657
8846
|
Color.transparent = new Color(0, 0, 0, 0);
|
|
8658
8847
|
Color.red = new Color(1, 0, 0, 1);
|
|
8659
8848
|
Color.blue = new Color(0, 0, 1, 1);
|
|
8849
|
+
var Color$1 = Color;
|
|
8660
8850
|
|
|
8661
8851
|
class Collator {
|
|
8662
8852
|
constructor(caseSensitive, diacriticSensitive, locale) {
|
|
@@ -8798,7 +8988,7 @@ function isValue(mixed) {
|
|
|
8798
8988
|
return true;
|
|
8799
8989
|
} else if (typeof mixed === 'number') {
|
|
8800
8990
|
return true;
|
|
8801
|
-
} else if (mixed instanceof Color) {
|
|
8991
|
+
} else if (mixed instanceof Color$1) {
|
|
8802
8992
|
return true;
|
|
8803
8993
|
} else if (mixed instanceof Collator) {
|
|
8804
8994
|
return true;
|
|
@@ -8833,7 +9023,7 @@ function typeOf(value) {
|
|
|
8833
9023
|
return BooleanType;
|
|
8834
9024
|
} else if (typeof value === 'number') {
|
|
8835
9025
|
return NumberType;
|
|
8836
|
-
} else if (value instanceof Color) {
|
|
9026
|
+
} else if (value instanceof Color$1) {
|
|
8837
9027
|
return ColorType;
|
|
8838
9028
|
} else if (value instanceof Collator) {
|
|
8839
9029
|
return CollatorType;
|
|
@@ -8855,18 +9045,18 @@ function typeOf(value) {
|
|
|
8855
9045
|
break;
|
|
8856
9046
|
}
|
|
8857
9047
|
}
|
|
8858
|
-
return array(itemType || ValueType, length);
|
|
9048
|
+
return array$1(itemType || ValueType, length);
|
|
8859
9049
|
} else {
|
|
8860
9050
|
return ObjectType;
|
|
8861
9051
|
}
|
|
8862
9052
|
}
|
|
8863
|
-
function toString
|
|
9053
|
+
function toString(value) {
|
|
8864
9054
|
const type = typeof value;
|
|
8865
9055
|
if (value === null) {
|
|
8866
9056
|
return '';
|
|
8867
9057
|
} else if (type === 'string' || type === 'number' || type === 'boolean') {
|
|
8868
9058
|
return String(value);
|
|
8869
|
-
} else if (value instanceof Color || value instanceof Formatted || value instanceof ResolvedImage) {
|
|
9059
|
+
} else if (value instanceof Color$1 || value instanceof Formatted || value instanceof ResolvedImage) {
|
|
8870
9060
|
return value.toString();
|
|
8871
9061
|
} else {
|
|
8872
9062
|
return JSON.stringify(value);
|
|
@@ -8905,7 +9095,7 @@ class Literal {
|
|
|
8905
9095
|
'literal',
|
|
8906
9096
|
this.value
|
|
8907
9097
|
];
|
|
8908
|
-
} else if (this.value instanceof Color) {
|
|
9098
|
+
} else if (this.value instanceof Color$1) {
|
|
8909
9099
|
return ['rgba'].concat(this.value.toArray());
|
|
8910
9100
|
} else if (this.value instanceof Formatted) {
|
|
8911
9101
|
return this.value.serialize();
|
|
@@ -8914,6 +9104,7 @@ class Literal {
|
|
|
8914
9104
|
}
|
|
8915
9105
|
}
|
|
8916
9106
|
}
|
|
9107
|
+
var Literal$1 = Literal;
|
|
8917
9108
|
|
|
8918
9109
|
class RuntimeError {
|
|
8919
9110
|
constructor(message) {
|
|
@@ -8924,8 +9115,9 @@ class RuntimeError {
|
|
|
8924
9115
|
return this.message;
|
|
8925
9116
|
}
|
|
8926
9117
|
}
|
|
9118
|
+
var RuntimeError$1 = RuntimeError;
|
|
8927
9119
|
|
|
8928
|
-
const types = {
|
|
9120
|
+
const types$1 = {
|
|
8929
9121
|
string: StringType,
|
|
8930
9122
|
number: NumberType,
|
|
8931
9123
|
boolean: BooleanType,
|
|
@@ -8946,9 +9138,9 @@ class Assertion {
|
|
|
8946
9138
|
let itemType;
|
|
8947
9139
|
if (args.length > 2) {
|
|
8948
9140
|
const type = args[1];
|
|
8949
|
-
if (typeof type !== 'string' || !(type in types) || type === 'object')
|
|
9141
|
+
if (typeof type !== 'string' || !(type in types$1) || type === 'object')
|
|
8950
9142
|
return context.error('The item type argument of "array" must be one of string, number, boolean', 1);
|
|
8951
|
-
itemType = types[type];
|
|
9143
|
+
itemType = types$1[type];
|
|
8952
9144
|
i++;
|
|
8953
9145
|
} else {
|
|
8954
9146
|
itemType = ValueType;
|
|
@@ -8961,9 +9153,9 @@ class Assertion {
|
|
|
8961
9153
|
N = args[2];
|
|
8962
9154
|
i++;
|
|
8963
9155
|
}
|
|
8964
|
-
type = array(itemType, N);
|
|
9156
|
+
type = array$1(itemType, N);
|
|
8965
9157
|
} else {
|
|
8966
|
-
type = types[name];
|
|
9158
|
+
type = types$1[name];
|
|
8967
9159
|
}
|
|
8968
9160
|
const parsed = [];
|
|
8969
9161
|
for (; i < args.length; i++) {
|
|
@@ -8981,7 +9173,7 @@ class Assertion {
|
|
|
8981
9173
|
if (!error) {
|
|
8982
9174
|
return value;
|
|
8983
9175
|
} else if (i === this.args.length - 1) {
|
|
8984
|
-
throw new RuntimeError(`Expected value to be of type ${ toString(this.type) }, but found ${ toString(typeOf(value)) } instead.`);
|
|
9176
|
+
throw new RuntimeError$1(`Expected value to be of type ${ toString$1(this.type) }, but found ${ toString$1(typeOf(value)) } instead.`);
|
|
8985
9177
|
}
|
|
8986
9178
|
}
|
|
8987
9179
|
return null;
|
|
@@ -9008,6 +9200,7 @@ class Assertion {
|
|
|
9008
9200
|
return serialized.concat(this.args.map(arg => arg.serialize()));
|
|
9009
9201
|
}
|
|
9010
9202
|
}
|
|
9203
|
+
var Assertion$1 = Assertion;
|
|
9011
9204
|
|
|
9012
9205
|
class FormatExpression {
|
|
9013
9206
|
constructor(sections) {
|
|
@@ -9036,7 +9229,7 @@ class FormatExpression {
|
|
|
9036
9229
|
}
|
|
9037
9230
|
let font = null;
|
|
9038
9231
|
if (arg['text-font']) {
|
|
9039
|
-
font = context.parse(arg['text-font'], 1, array(StringType));
|
|
9232
|
+
font = context.parse(arg['text-font'], 1, array$1(StringType));
|
|
9040
9233
|
if (!font)
|
|
9041
9234
|
return null;
|
|
9042
9235
|
}
|
|
@@ -9074,7 +9267,7 @@ class FormatExpression {
|
|
|
9074
9267
|
if (typeOf(evaluatedContent) === ResolvedImageType) {
|
|
9075
9268
|
return new FormattedSection('', evaluatedContent, null, null, null);
|
|
9076
9269
|
}
|
|
9077
|
-
return new FormattedSection(toString
|
|
9270
|
+
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);
|
|
9078
9271
|
};
|
|
9079
9272
|
return new Formatted(this.sections.map(evaluateSection));
|
|
9080
9273
|
}
|
|
@@ -9150,7 +9343,7 @@ class ImageExpression {
|
|
|
9150
9343
|
}
|
|
9151
9344
|
}
|
|
9152
9345
|
|
|
9153
|
-
const types
|
|
9346
|
+
const types = {
|
|
9154
9347
|
'to-boolean': BooleanType,
|
|
9155
9348
|
'to-color': ColorType,
|
|
9156
9349
|
'to-number': NumberType,
|
|
@@ -9167,7 +9360,7 @@ class Coercion {
|
|
|
9167
9360
|
const name = args[0];
|
|
9168
9361
|
if ((name === 'to-boolean' || name === 'to-string') && args.length !== 2)
|
|
9169
9362
|
return context.error(`Expected one argument.`);
|
|
9170
|
-
const type = types
|
|
9363
|
+
const type = types[name];
|
|
9171
9364
|
const parsed = [];
|
|
9172
9365
|
for (let i = 1; i < args.length; i++) {
|
|
9173
9366
|
const input = context.parse(args[i], i, ValueType);
|
|
@@ -9186,7 +9379,7 @@ class Coercion {
|
|
|
9186
9379
|
for (const arg of this.args) {
|
|
9187
9380
|
input = arg.evaluate(ctx);
|
|
9188
9381
|
error = null;
|
|
9189
|
-
if (input instanceof Color) {
|
|
9382
|
+
if (input instanceof Color$1) {
|
|
9190
9383
|
return input;
|
|
9191
9384
|
} else if (typeof input === 'string') {
|
|
9192
9385
|
const c = ctx.parseColor(input);
|
|
@@ -9199,11 +9392,11 @@ class Coercion {
|
|
|
9199
9392
|
error = validateRGBA(input[0], input[1], input[2], input[3]);
|
|
9200
9393
|
}
|
|
9201
9394
|
if (!error) {
|
|
9202
|
-
return new Color(input[0] / 255, input[1] / 255, input[2] / 255, input[3]);
|
|
9395
|
+
return new Color$1(input[0] / 255, input[1] / 255, input[2] / 255, input[3]);
|
|
9203
9396
|
}
|
|
9204
9397
|
}
|
|
9205
9398
|
}
|
|
9206
|
-
throw new RuntimeError(error || `Could not parse color from value '${ typeof input === 'string' ? input : String(JSON.stringify(input)) }'`);
|
|
9399
|
+
throw new RuntimeError$1(error || `Could not parse color from value '${ typeof input === 'string' ? input : String(JSON.stringify(input)) }'`);
|
|
9207
9400
|
} else if (this.type.kind === 'number') {
|
|
9208
9401
|
let value = null;
|
|
9209
9402
|
for (const arg of this.args) {
|
|
@@ -9215,13 +9408,13 @@ class Coercion {
|
|
|
9215
9408
|
continue;
|
|
9216
9409
|
return num;
|
|
9217
9410
|
}
|
|
9218
|
-
throw new RuntimeError(`Could not convert ${ JSON.stringify(value) } to number.`);
|
|
9411
|
+
throw new RuntimeError$1(`Could not convert ${ JSON.stringify(value) } to number.`);
|
|
9219
9412
|
} else if (this.type.kind === 'formatted') {
|
|
9220
|
-
return Formatted.fromString(toString
|
|
9413
|
+
return Formatted.fromString(toString(this.args[0].evaluate(ctx)));
|
|
9221
9414
|
} else if (this.type.kind === 'resolvedImage') {
|
|
9222
|
-
return ResolvedImage.fromString(toString
|
|
9415
|
+
return ResolvedImage.fromString(toString(this.args[0].evaluate(ctx)));
|
|
9223
9416
|
} else {
|
|
9224
|
-
return toString
|
|
9417
|
+
return toString(this.args[0].evaluate(ctx));
|
|
9225
9418
|
}
|
|
9226
9419
|
}
|
|
9227
9420
|
eachChild(fn) {
|
|
@@ -9249,6 +9442,7 @@ class Coercion {
|
|
|
9249
9442
|
return serialized;
|
|
9250
9443
|
}
|
|
9251
9444
|
}
|
|
9445
|
+
var Coercion$1 = Coercion;
|
|
9252
9446
|
|
|
9253
9447
|
const geometryTypes = [
|
|
9254
9448
|
'Unknown',
|
|
@@ -9300,11 +9494,12 @@ class EvaluationContext {
|
|
|
9300
9494
|
parseColor(input) {
|
|
9301
9495
|
let cached = this._parseColorCache[input];
|
|
9302
9496
|
if (!cached) {
|
|
9303
|
-
cached = this._parseColorCache[input] = Color.parse(input);
|
|
9497
|
+
cached = this._parseColorCache[input] = Color$1.parse(input);
|
|
9304
9498
|
}
|
|
9305
9499
|
return cached;
|
|
9306
9500
|
}
|
|
9307
9501
|
}
|
|
9502
|
+
var EvaluationContext$1 = EvaluationContext;
|
|
9308
9503
|
|
|
9309
9504
|
class CompoundExpression {
|
|
9310
9505
|
constructor(name, type, evaluate, args) {
|
|
@@ -9339,7 +9534,7 @@ class CompoundExpression {
|
|
|
9339
9534
|
const overloads = availableOverloads.filter(([signature]) => !Array.isArray(signature) || signature.length === args.length - 1);
|
|
9340
9535
|
let signatureContext = null;
|
|
9341
9536
|
for (const [params, evaluate] of overloads) {
|
|
9342
|
-
signatureContext = new ParsingContext(context.registry, context.path, null, context.scope);
|
|
9537
|
+
signatureContext = new ParsingContext$1(context.registry, context.path, null, context.scope);
|
|
9343
9538
|
const parsedArgs = [];
|
|
9344
9539
|
let argParseFailed = false;
|
|
9345
9540
|
for (let i = 1; i < args.length; i++) {
|
|
@@ -9380,7 +9575,7 @@ class CompoundExpression {
|
|
|
9380
9575
|
const parsed = context.parse(args[i], 1 + actualTypes.length);
|
|
9381
9576
|
if (!parsed)
|
|
9382
9577
|
return null;
|
|
9383
|
-
actualTypes.push(toString(parsed.type));
|
|
9578
|
+
actualTypes.push(toString$1(parsed.type));
|
|
9384
9579
|
}
|
|
9385
9580
|
context.error(`Expected arguments of type ${ signatures }, but found (${ actualTypes.join(', ') }) instead.`);
|
|
9386
9581
|
}
|
|
@@ -9395,11 +9590,12 @@ class CompoundExpression {
|
|
|
9395
9590
|
}
|
|
9396
9591
|
function stringifySignature(signature) {
|
|
9397
9592
|
if (Array.isArray(signature)) {
|
|
9398
|
-
return `(${ signature.map(toString).join(', ') })`;
|
|
9593
|
+
return `(${ signature.map(toString$1).join(', ') })`;
|
|
9399
9594
|
} else {
|
|
9400
|
-
return `(${ toString(signature.type) }...)`;
|
|
9595
|
+
return `(${ toString$1(signature.type) }...)`;
|
|
9401
9596
|
}
|
|
9402
9597
|
}
|
|
9598
|
+
var CompoundExpression$1 = CompoundExpression;
|
|
9403
9599
|
|
|
9404
9600
|
class CollatorExpression {
|
|
9405
9601
|
constructor(caseSensitive, diacriticSensitive, locale) {
|
|
@@ -9796,9 +9992,10 @@ class Within {
|
|
|
9796
9992
|
];
|
|
9797
9993
|
}
|
|
9798
9994
|
}
|
|
9995
|
+
var Within$1 = Within;
|
|
9799
9996
|
|
|
9800
9997
|
function isFeatureConstant(e) {
|
|
9801
|
-
if (e instanceof CompoundExpression) {
|
|
9998
|
+
if (e instanceof CompoundExpression$1) {
|
|
9802
9999
|
if (e.name === 'get' && e.args.length === 1) {
|
|
9803
10000
|
return false;
|
|
9804
10001
|
} else if (e.name === 'feature-state') {
|
|
@@ -9811,7 +10008,7 @@ function isFeatureConstant(e) {
|
|
|
9811
10008
|
return false;
|
|
9812
10009
|
}
|
|
9813
10010
|
}
|
|
9814
|
-
if (e instanceof Within) {
|
|
10011
|
+
if (e instanceof Within$1) {
|
|
9815
10012
|
return false;
|
|
9816
10013
|
}
|
|
9817
10014
|
let result = true;
|
|
@@ -9823,7 +10020,7 @@ function isFeatureConstant(e) {
|
|
|
9823
10020
|
return result;
|
|
9824
10021
|
}
|
|
9825
10022
|
function isStateConstant(e) {
|
|
9826
|
-
if (e instanceof CompoundExpression) {
|
|
10023
|
+
if (e instanceof CompoundExpression$1) {
|
|
9827
10024
|
if (e.name === 'feature-state') {
|
|
9828
10025
|
return false;
|
|
9829
10026
|
}
|
|
@@ -9837,7 +10034,7 @@ function isStateConstant(e) {
|
|
|
9837
10034
|
return result;
|
|
9838
10035
|
}
|
|
9839
10036
|
function isGlobalPropertyConstant(e, properties) {
|
|
9840
|
-
if (e instanceof CompoundExpression && properties.indexOf(e.name) >= 0) {
|
|
10037
|
+
if (e instanceof CompoundExpression$1 && properties.indexOf(e.name) >= 0) {
|
|
9841
10038
|
return false;
|
|
9842
10039
|
}
|
|
9843
10040
|
let result = true;
|
|
@@ -9879,9 +10076,10 @@ class Var {
|
|
|
9879
10076
|
];
|
|
9880
10077
|
}
|
|
9881
10078
|
}
|
|
10079
|
+
var Var$1 = Var;
|
|
9882
10080
|
|
|
9883
10081
|
class ParsingContext {
|
|
9884
|
-
constructor(registry, path = [], expectedType, scope = new Scope(), errors = []) {
|
|
10082
|
+
constructor(registry, path = [], expectedType, scope = new Scope$1(), errors = []) {
|
|
9885
10083
|
this.registry = registry;
|
|
9886
10084
|
this.path = path;
|
|
9887
10085
|
this.key = path.map(part => `[${ part }]`).join('');
|
|
@@ -9904,9 +10102,9 @@ class ParsingContext {
|
|
|
9904
10102
|
}
|
|
9905
10103
|
function annotate(parsed, type, typeAnnotation) {
|
|
9906
10104
|
if (typeAnnotation === 'assert') {
|
|
9907
|
-
return new Assertion(type, [parsed]);
|
|
10105
|
+
return new Assertion$1(type, [parsed]);
|
|
9908
10106
|
} else if (typeAnnotation === 'coerce') {
|
|
9909
|
-
return new Coercion(type, [parsed]);
|
|
10107
|
+
return new Coercion$1(type, [parsed]);
|
|
9910
10108
|
} else {
|
|
9911
10109
|
return parsed;
|
|
9912
10110
|
}
|
|
@@ -9936,10 +10134,10 @@ class ParsingContext {
|
|
|
9936
10134
|
return null;
|
|
9937
10135
|
}
|
|
9938
10136
|
}
|
|
9939
|
-
if (!(parsed instanceof Literal) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
|
|
9940
|
-
const ec = new EvaluationContext();
|
|
10137
|
+
if (!(parsed instanceof Literal$1) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
|
|
10138
|
+
const ec = new EvaluationContext$1();
|
|
9941
10139
|
try {
|
|
9942
|
-
parsed = new Literal(parsed.type, parsed.evaluate(ec));
|
|
10140
|
+
parsed = new Literal$1(parsed.type, parsed.evaluate(ec));
|
|
9943
10141
|
} catch (e) {
|
|
9944
10142
|
this.error(e.message);
|
|
9945
10143
|
return null;
|
|
@@ -9963,7 +10161,7 @@ class ParsingContext {
|
|
|
9963
10161
|
}
|
|
9964
10162
|
error(error, ...keys) {
|
|
9965
10163
|
const key = `${ this.key }${ keys.map(k => `[${ k }]`).join('') }`;
|
|
9966
|
-
this.errors.push(new ParsingError(key, error));
|
|
10164
|
+
this.errors.push(new ParsingError$2(key, error));
|
|
9967
10165
|
}
|
|
9968
10166
|
checkSubtype(expected, t) {
|
|
9969
10167
|
const error = checkSubtype(expected, t);
|
|
@@ -9972,23 +10170,24 @@ class ParsingContext {
|
|
|
9972
10170
|
return error;
|
|
9973
10171
|
}
|
|
9974
10172
|
}
|
|
10173
|
+
var ParsingContext$1 = ParsingContext;
|
|
9975
10174
|
function isConstant(expression) {
|
|
9976
|
-
if (expression instanceof Var) {
|
|
10175
|
+
if (expression instanceof Var$1) {
|
|
9977
10176
|
return isConstant(expression.boundExpression);
|
|
9978
|
-
} else if (expression instanceof CompoundExpression && expression.name === 'error') {
|
|
10177
|
+
} else if (expression instanceof CompoundExpression$1 && expression.name === 'error') {
|
|
9979
10178
|
return false;
|
|
9980
10179
|
} else if (expression instanceof CollatorExpression) {
|
|
9981
10180
|
return false;
|
|
9982
|
-
} else if (expression instanceof Within) {
|
|
10181
|
+
} else if (expression instanceof Within$1) {
|
|
9983
10182
|
return false;
|
|
9984
10183
|
}
|
|
9985
|
-
const isTypeAnnotation = expression instanceof Coercion || expression instanceof Assertion;
|
|
10184
|
+
const isTypeAnnotation = expression instanceof Coercion$1 || expression instanceof Assertion$1;
|
|
9986
10185
|
let childrenConstant = true;
|
|
9987
10186
|
expression.eachChild(child => {
|
|
9988
10187
|
if (isTypeAnnotation) {
|
|
9989
10188
|
childrenConstant = childrenConstant && isConstant(child);
|
|
9990
10189
|
} else {
|
|
9991
|
-
childrenConstant = childrenConstant && child instanceof Literal;
|
|
10190
|
+
childrenConstant = childrenConstant && child instanceof Literal$1;
|
|
9992
10191
|
}
|
|
9993
10192
|
});
|
|
9994
10193
|
if (!childrenConstant) {
|
|
@@ -10024,7 +10223,7 @@ function findStopLessThanOrEqualTo(stops, input) {
|
|
|
10024
10223
|
} else if (currentValue > input) {
|
|
10025
10224
|
upperIndex = currentIndex - 1;
|
|
10026
10225
|
} else {
|
|
10027
|
-
throw new RuntimeError('Input is not a number.');
|
|
10226
|
+
throw new RuntimeError$1('Input is not a number.');
|
|
10028
10227
|
}
|
|
10029
10228
|
}
|
|
10030
10229
|
return 0;
|
|
@@ -10118,6 +10317,7 @@ class Step {
|
|
|
10118
10317
|
return serialized;
|
|
10119
10318
|
}
|
|
10120
10319
|
}
|
|
10320
|
+
var Step$1 = Step;
|
|
10121
10321
|
|
|
10122
10322
|
/*
|
|
10123
10323
|
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
|
@@ -10228,9 +10428,9 @@ function number(a, b, t) {
|
|
|
10228
10428
|
return a * (1 - t) + b * t;
|
|
10229
10429
|
}
|
|
10230
10430
|
function color(from, to, t) {
|
|
10231
|
-
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));
|
|
10431
|
+
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));
|
|
10232
10432
|
}
|
|
10233
|
-
function array
|
|
10433
|
+
function array(from, to, t) {
|
|
10234
10434
|
return from.map((d, i) => {
|
|
10235
10435
|
return number(d, to[i], t);
|
|
10236
10436
|
});
|
|
@@ -10240,7 +10440,7 @@ var interpolate = /*#__PURE__*/Object.freeze({
|
|
|
10240
10440
|
__proto__: null,
|
|
10241
10441
|
number: number,
|
|
10242
10442
|
color: color,
|
|
10243
|
-
array: array
|
|
10443
|
+
array: array
|
|
10244
10444
|
});
|
|
10245
10445
|
|
|
10246
10446
|
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;
|
|
@@ -10271,7 +10471,7 @@ function labToRgb(labColor) {
|
|
|
10271
10471
|
y = Yn * lab2xyz(y);
|
|
10272
10472
|
x = Xn * lab2xyz(x);
|
|
10273
10473
|
z = Zn * lab2xyz(z);
|
|
10274
|
-
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);
|
|
10474
|
+
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);
|
|
10275
10475
|
}
|
|
10276
10476
|
function interpolateLab(from, to, t) {
|
|
10277
10477
|
return {
|
|
@@ -10419,7 +10619,7 @@ class Interpolate {
|
|
|
10419
10619
|
]);
|
|
10420
10620
|
}
|
|
10421
10621
|
if (outputType.kind !== 'number' && outputType.kind !== 'color' && !(outputType.kind === 'array' && outputType.itemType.kind === 'number' && typeof outputType.N === 'number')) {
|
|
10422
|
-
return context.error(`Type ${ toString(outputType) } is not interpolatable.`);
|
|
10622
|
+
return context.error(`Type ${ toString$1(outputType) } is not interpolatable.`);
|
|
10423
10623
|
}
|
|
10424
10624
|
return new Interpolate(outputType, operator, interpolation, input, stops);
|
|
10425
10625
|
}
|
|
@@ -10498,6 +10698,7 @@ function exponentialInterpolation(input, base, lowerValue, upperValue) {
|
|
|
10498
10698
|
return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);
|
|
10499
10699
|
}
|
|
10500
10700
|
}
|
|
10701
|
+
var Interpolate$1 = Interpolate;
|
|
10501
10702
|
|
|
10502
10703
|
class Coalesce {
|
|
10503
10704
|
constructor(type, args) {
|
|
@@ -10559,6 +10760,7 @@ class Coalesce {
|
|
|
10559
10760
|
return serialized;
|
|
10560
10761
|
}
|
|
10561
10762
|
}
|
|
10763
|
+
var Coalesce$1 = Coalesce;
|
|
10562
10764
|
|
|
10563
10765
|
class Let {
|
|
10564
10766
|
constructor(bindings, result) {
|
|
@@ -10612,6 +10814,7 @@ class Let {
|
|
|
10612
10814
|
return serialized;
|
|
10613
10815
|
}
|
|
10614
10816
|
}
|
|
10817
|
+
var Let$1 = Let;
|
|
10615
10818
|
|
|
10616
10819
|
class At {
|
|
10617
10820
|
constructor(type, index, input) {
|
|
@@ -10623,7 +10826,7 @@ class At {
|
|
|
10623
10826
|
if (args.length !== 3)
|
|
10624
10827
|
return context.error(`Expected 2 arguments, but found ${ args.length - 1 } instead.`);
|
|
10625
10828
|
const index = context.parse(args[1], 1, NumberType);
|
|
10626
|
-
const input = context.parse(args[2], 2, array(context.expectedType || ValueType));
|
|
10829
|
+
const input = context.parse(args[2], 2, array$1(context.expectedType || ValueType));
|
|
10627
10830
|
if (!index || !input)
|
|
10628
10831
|
return null;
|
|
10629
10832
|
const t = input.type;
|
|
@@ -10633,13 +10836,13 @@ class At {
|
|
|
10633
10836
|
const index = this.index.evaluate(ctx);
|
|
10634
10837
|
const array = this.input.evaluate(ctx);
|
|
10635
10838
|
if (index < 0) {
|
|
10636
|
-
throw new RuntimeError(`Array index out of bounds: ${ index } < 0.`);
|
|
10839
|
+
throw new RuntimeError$1(`Array index out of bounds: ${ index } < 0.`);
|
|
10637
10840
|
}
|
|
10638
10841
|
if (index >= array.length) {
|
|
10639
|
-
throw new RuntimeError(`Array index out of bounds: ${ index } > ${ array.length - 1 }.`);
|
|
10842
|
+
throw new RuntimeError$1(`Array index out of bounds: ${ index } > ${ array.length - 1 }.`);
|
|
10640
10843
|
}
|
|
10641
10844
|
if (index !== Math.floor(index)) {
|
|
10642
|
-
throw new RuntimeError(`Array index must be an integer, but found ${ index } instead.`);
|
|
10845
|
+
throw new RuntimeError$1(`Array index must be an integer, but found ${ index } instead.`);
|
|
10643
10846
|
}
|
|
10644
10847
|
return array[index];
|
|
10645
10848
|
}
|
|
@@ -10658,6 +10861,7 @@ class At {
|
|
|
10658
10861
|
];
|
|
10659
10862
|
}
|
|
10660
10863
|
}
|
|
10864
|
+
var At$1 = At;
|
|
10661
10865
|
|
|
10662
10866
|
class In {
|
|
10663
10867
|
constructor(needle, haystack) {
|
|
@@ -10680,7 +10884,7 @@ class In {
|
|
|
10680
10884
|
NullType,
|
|
10681
10885
|
ValueType
|
|
10682
10886
|
])) {
|
|
10683
|
-
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(needle.type) } instead`);
|
|
10887
|
+
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(needle.type) } instead`);
|
|
10684
10888
|
}
|
|
10685
10889
|
return new In(needle, haystack);
|
|
10686
10890
|
}
|
|
@@ -10695,13 +10899,13 @@ class In {
|
|
|
10695
10899
|
'number',
|
|
10696
10900
|
'null'
|
|
10697
10901
|
])) {
|
|
10698
|
-
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(typeOf(needle)) } instead.`);
|
|
10902
|
+
throw new RuntimeError$1(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
10699
10903
|
}
|
|
10700
10904
|
if (!isValidNativeType(haystack, [
|
|
10701
10905
|
'string',
|
|
10702
10906
|
'array'
|
|
10703
10907
|
])) {
|
|
10704
|
-
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString(typeOf(haystack)) } instead.`);
|
|
10908
|
+
throw new RuntimeError$1(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
10705
10909
|
}
|
|
10706
10910
|
return haystack.indexOf(needle) >= 0;
|
|
10707
10911
|
}
|
|
@@ -10720,6 +10924,7 @@ class In {
|
|
|
10720
10924
|
];
|
|
10721
10925
|
}
|
|
10722
10926
|
}
|
|
10927
|
+
var In$1 = In;
|
|
10723
10928
|
|
|
10724
10929
|
class IndexOf {
|
|
10725
10930
|
constructor(needle, haystack, fromIndex) {
|
|
@@ -10743,7 +10948,7 @@ class IndexOf {
|
|
|
10743
10948
|
NullType,
|
|
10744
10949
|
ValueType
|
|
10745
10950
|
])) {
|
|
10746
|
-
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(needle.type) } instead`);
|
|
10951
|
+
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(needle.type) } instead`);
|
|
10747
10952
|
}
|
|
10748
10953
|
if (args.length === 4) {
|
|
10749
10954
|
const fromIndex = context.parse(args[3], 3, NumberType);
|
|
@@ -10763,13 +10968,13 @@ class IndexOf {
|
|
|
10763
10968
|
'number',
|
|
10764
10969
|
'null'
|
|
10765
10970
|
])) {
|
|
10766
|
-
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(typeOf(needle)) } instead.`);
|
|
10971
|
+
throw new RuntimeError$1(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
10767
10972
|
}
|
|
10768
10973
|
if (!isValidNativeType(haystack, [
|
|
10769
10974
|
'string',
|
|
10770
10975
|
'array'
|
|
10771
10976
|
])) {
|
|
10772
|
-
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString(typeOf(haystack)) } instead.`);
|
|
10977
|
+
throw new RuntimeError$1(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
10773
10978
|
}
|
|
10774
10979
|
if (this.fromIndex) {
|
|
10775
10980
|
const fromIndex = this.fromIndex.evaluate(ctx);
|
|
@@ -10804,6 +11009,7 @@ class IndexOf {
|
|
|
10804
11009
|
];
|
|
10805
11010
|
}
|
|
10806
11011
|
}
|
|
11012
|
+
var IndexOf$1 = IndexOf;
|
|
10807
11013
|
|
|
10808
11014
|
class Match {
|
|
10809
11015
|
constructor(inputType, outputType, input, cases, outputs, otherwise) {
|
|
@@ -10916,6 +11122,7 @@ class Match {
|
|
|
10916
11122
|
return serialized;
|
|
10917
11123
|
}
|
|
10918
11124
|
}
|
|
11125
|
+
var Match$1 = Match;
|
|
10919
11126
|
|
|
10920
11127
|
class Case {
|
|
10921
11128
|
constructor(type, branches, otherwise) {
|
|
@@ -10977,6 +11184,7 @@ class Case {
|
|
|
10977
11184
|
return serialized;
|
|
10978
11185
|
}
|
|
10979
11186
|
}
|
|
11187
|
+
var Case$1 = Case;
|
|
10980
11188
|
|
|
10981
11189
|
class Slice {
|
|
10982
11190
|
constructor(type, input, beginIndex, endIndex) {
|
|
@@ -10994,11 +11202,11 @@ class Slice {
|
|
|
10994
11202
|
if (!input || !beginIndex)
|
|
10995
11203
|
return null;
|
|
10996
11204
|
if (!isValidType(input.type, [
|
|
10997
|
-
array(ValueType),
|
|
11205
|
+
array$1(ValueType),
|
|
10998
11206
|
StringType,
|
|
10999
11207
|
ValueType
|
|
11000
11208
|
])) {
|
|
11001
|
-
return context.error(`Expected first argument to be of type array or string, but found ${ toString(input.type) } instead`);
|
|
11209
|
+
return context.error(`Expected first argument to be of type array or string, but found ${ toString$1(input.type) } instead`);
|
|
11002
11210
|
}
|
|
11003
11211
|
if (args.length === 4) {
|
|
11004
11212
|
const endIndex = context.parse(args[3], 3, NumberType);
|
|
@@ -11016,7 +11224,7 @@ class Slice {
|
|
|
11016
11224
|
'string',
|
|
11017
11225
|
'array'
|
|
11018
11226
|
])) {
|
|
11019
|
-
throw new RuntimeError(`Expected first argument to be of type array or string, but found ${ toString(typeOf(input)) } instead.`);
|
|
11227
|
+
throw new RuntimeError$1(`Expected first argument to be of type array or string, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
11020
11228
|
}
|
|
11021
11229
|
if (this.endIndex) {
|
|
11022
11230
|
const endIndex = this.endIndex.evaluate(ctx);
|
|
@@ -11051,6 +11259,7 @@ class Slice {
|
|
|
11051
11259
|
];
|
|
11052
11260
|
}
|
|
11053
11261
|
}
|
|
11262
|
+
var Slice$1 = Slice;
|
|
11054
11263
|
|
|
11055
11264
|
function isComparableType(op, type) {
|
|
11056
11265
|
if (op === '==' || op === '!=') {
|
|
@@ -11113,22 +11322,22 @@ function makeComparison(op, compareBasic, compareWithCollator) {
|
|
|
11113
11322
|
if (!lhs)
|
|
11114
11323
|
return null;
|
|
11115
11324
|
if (!isComparableType(op, lhs.type)) {
|
|
11116
|
-
return context.concat(1).error(`"${ op }" comparisons are not supported for type '${ toString(lhs.type) }'.`);
|
|
11325
|
+
return context.concat(1).error(`"${ op }" comparisons are not supported for type '${ toString$1(lhs.type) }'.`);
|
|
11117
11326
|
}
|
|
11118
11327
|
let rhs = context.parse(args[2], 2, ValueType);
|
|
11119
11328
|
if (!rhs)
|
|
11120
11329
|
return null;
|
|
11121
11330
|
if (!isComparableType(op, rhs.type)) {
|
|
11122
|
-
return context.concat(2).error(`"${ op }" comparisons are not supported for type '${ toString(rhs.type) }'.`);
|
|
11331
|
+
return context.concat(2).error(`"${ op }" comparisons are not supported for type '${ toString$1(rhs.type) }'.`);
|
|
11123
11332
|
}
|
|
11124
11333
|
if (lhs.type.kind !== rhs.type.kind && lhs.type.kind !== 'value' && rhs.type.kind !== 'value') {
|
|
11125
|
-
return context.error(`Cannot compare types '${ toString(lhs.type) }' and '${ toString(rhs.type) }'.`);
|
|
11334
|
+
return context.error(`Cannot compare types '${ toString$1(lhs.type) }' and '${ toString$1(rhs.type) }'.`);
|
|
11126
11335
|
}
|
|
11127
11336
|
if (isOrderComparison) {
|
|
11128
11337
|
if (lhs.type.kind === 'value' && rhs.type.kind !== 'value') {
|
|
11129
|
-
lhs = new Assertion(rhs.type, [lhs]);
|
|
11338
|
+
lhs = new Assertion$1(rhs.type, [lhs]);
|
|
11130
11339
|
} else if (lhs.type.kind !== 'value' && rhs.type.kind === 'value') {
|
|
11131
|
-
rhs = new Assertion(lhs.type, [rhs]);
|
|
11340
|
+
rhs = new Assertion$1(lhs.type, [rhs]);
|
|
11132
11341
|
}
|
|
11133
11342
|
}
|
|
11134
11343
|
let collator = null;
|
|
@@ -11149,7 +11358,7 @@ function makeComparison(op, compareBasic, compareWithCollator) {
|
|
|
11149
11358
|
const lt = typeOf(lhs);
|
|
11150
11359
|
const rt = typeOf(rhs);
|
|
11151
11360
|
if (lt.kind !== rt.kind || !(lt.kind === 'string' || lt.kind === 'number')) {
|
|
11152
|
-
throw new RuntimeError(`Expected arguments for "${ op }" to be (string, string) or (number, number), but found (${ lt.kind }, ${ rt.kind }) instead.`);
|
|
11361
|
+
throw new RuntimeError$1(`Expected arguments for "${ op }" to be (string, string) or (number, number), but found (${ lt.kind }, ${ rt.kind }) instead.`);
|
|
11153
11362
|
}
|
|
11154
11363
|
}
|
|
11155
11364
|
if (this.collator && !isOrderComparison && this.hasUntypedArgument) {
|
|
@@ -11291,7 +11500,7 @@ class Length {
|
|
|
11291
11500
|
if (!input)
|
|
11292
11501
|
return null;
|
|
11293
11502
|
if (input.type.kind !== 'array' && input.type.kind !== 'string' && input.type.kind !== 'value')
|
|
11294
|
-
return context.error(`Expected argument of type string or array, but found ${ toString(input.type) } instead.`);
|
|
11503
|
+
return context.error(`Expected argument of type string or array, but found ${ toString$1(input.type) } instead.`);
|
|
11295
11504
|
return new Length(input);
|
|
11296
11505
|
}
|
|
11297
11506
|
evaluate(ctx) {
|
|
@@ -11301,7 +11510,7 @@ class Length {
|
|
|
11301
11510
|
} else if (Array.isArray(input)) {
|
|
11302
11511
|
return input.length;
|
|
11303
11512
|
} else {
|
|
11304
|
-
throw new RuntimeError(`Expected value to be of type string or array, but found ${ toString(typeOf(input)) } instead.`);
|
|
11513
|
+
throw new RuntimeError$1(`Expected value to be of type string or array, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
11305
11514
|
}
|
|
11306
11515
|
}
|
|
11307
11516
|
eachChild(fn) {
|
|
@@ -11318,6 +11527,7 @@ class Length {
|
|
|
11318
11527
|
return serialized;
|
|
11319
11528
|
}
|
|
11320
11529
|
}
|
|
11530
|
+
var Length$1 = Length;
|
|
11321
11531
|
|
|
11322
11532
|
const expressions = {
|
|
11323
11533
|
'==': Equals,
|
|
@@ -11326,35 +11536,35 @@ const expressions = {
|
|
|
11326
11536
|
'<': LessThan,
|
|
11327
11537
|
'>=': GreaterThanOrEqual,
|
|
11328
11538
|
'<=': LessThanOrEqual,
|
|
11329
|
-
'array': Assertion,
|
|
11330
|
-
'at': At,
|
|
11331
|
-
'boolean': Assertion,
|
|
11332
|
-
'case': Case,
|
|
11333
|
-
'coalesce': Coalesce,
|
|
11539
|
+
'array': Assertion$1,
|
|
11540
|
+
'at': At$1,
|
|
11541
|
+
'boolean': Assertion$1,
|
|
11542
|
+
'case': Case$1,
|
|
11543
|
+
'coalesce': Coalesce$1,
|
|
11334
11544
|
'collator': CollatorExpression,
|
|
11335
11545
|
'format': FormatExpression,
|
|
11336
11546
|
'image': ImageExpression,
|
|
11337
|
-
'in': In,
|
|
11338
|
-
'index-of': IndexOf,
|
|
11339
|
-
'interpolate': Interpolate,
|
|
11340
|
-
'interpolate-hcl': Interpolate,
|
|
11341
|
-
'interpolate-lab': Interpolate,
|
|
11342
|
-
'length': Length,
|
|
11343
|
-
'let': Let,
|
|
11344
|
-
'literal': Literal,
|
|
11345
|
-
'match': Match,
|
|
11346
|
-
'number': Assertion,
|
|
11547
|
+
'in': In$1,
|
|
11548
|
+
'index-of': IndexOf$1,
|
|
11549
|
+
'interpolate': Interpolate$1,
|
|
11550
|
+
'interpolate-hcl': Interpolate$1,
|
|
11551
|
+
'interpolate-lab': Interpolate$1,
|
|
11552
|
+
'length': Length$1,
|
|
11553
|
+
'let': Let$1,
|
|
11554
|
+
'literal': Literal$1,
|
|
11555
|
+
'match': Match$1,
|
|
11556
|
+
'number': Assertion$1,
|
|
11347
11557
|
'number-format': NumberFormat,
|
|
11348
|
-
'object': Assertion,
|
|
11349
|
-
'slice': Slice,
|
|
11350
|
-
'step': Step,
|
|
11351
|
-
'string': Assertion,
|
|
11352
|
-
'to-boolean': Coercion,
|
|
11353
|
-
'to-color': Coercion,
|
|
11354
|
-
'to-number': Coercion,
|
|
11355
|
-
'to-string': Coercion,
|
|
11356
|
-
'var': Var,
|
|
11357
|
-
'within': Within
|
|
11558
|
+
'object': Assertion$1,
|
|
11559
|
+
'slice': Slice$1,
|
|
11560
|
+
'step': Step$1,
|
|
11561
|
+
'string': Assertion$1,
|
|
11562
|
+
'to-boolean': Coercion$1,
|
|
11563
|
+
'to-color': Coercion$1,
|
|
11564
|
+
'to-number': Coercion$1,
|
|
11565
|
+
'to-string': Coercion$1,
|
|
11566
|
+
'var': Var$1,
|
|
11567
|
+
'within': Within$1
|
|
11358
11568
|
};
|
|
11359
11569
|
function rgba(ctx, [r, g, b, a]) {
|
|
11360
11570
|
r = r.evaluate(ctx);
|
|
@@ -11363,8 +11573,8 @@ function rgba(ctx, [r, g, b, a]) {
|
|
|
11363
11573
|
const alpha = a ? a.evaluate(ctx) : 1;
|
|
11364
11574
|
const error = validateRGBA(r, g, b, alpha);
|
|
11365
11575
|
if (error)
|
|
11366
|
-
throw new RuntimeError(error);
|
|
11367
|
-
return new Color(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);
|
|
11576
|
+
throw new RuntimeError$1(error);
|
|
11577
|
+
return new Color$1(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);
|
|
11368
11578
|
}
|
|
11369
11579
|
function has(key, obj) {
|
|
11370
11580
|
return key in obj;
|
|
@@ -11388,21 +11598,21 @@ function binarySearch(v, a, i, j) {
|
|
|
11388
11598
|
function varargs(type) {
|
|
11389
11599
|
return { type };
|
|
11390
11600
|
}
|
|
11391
|
-
CompoundExpression.register(expressions, {
|
|
11601
|
+
CompoundExpression$1.register(expressions, {
|
|
11392
11602
|
'error': [
|
|
11393
11603
|
ErrorType,
|
|
11394
11604
|
[StringType],
|
|
11395
11605
|
(ctx, [v]) => {
|
|
11396
|
-
throw new RuntimeError(v.evaluate(ctx));
|
|
11606
|
+
throw new RuntimeError$1(v.evaluate(ctx));
|
|
11397
11607
|
}
|
|
11398
11608
|
],
|
|
11399
11609
|
'typeof': [
|
|
11400
11610
|
StringType,
|
|
11401
11611
|
[ValueType],
|
|
11402
|
-
(ctx, [v]) => toString(typeOf(v.evaluate(ctx)))
|
|
11612
|
+
(ctx, [v]) => toString$1(typeOf(v.evaluate(ctx)))
|
|
11403
11613
|
],
|
|
11404
11614
|
'to-rgba': [
|
|
11405
|
-
array(NumberType, 4),
|
|
11615
|
+
array$1(NumberType, 4),
|
|
11406
11616
|
[ColorType],
|
|
11407
11617
|
(ctx, [v]) => {
|
|
11408
11618
|
return v.evaluate(ctx).toArray();
|
|
@@ -11788,19 +11998,19 @@ CompoundExpression.register(expressions, {
|
|
|
11788
11998
|
],
|
|
11789
11999
|
'filter-type-in': [
|
|
11790
12000
|
BooleanType,
|
|
11791
|
-
[array(StringType)],
|
|
12001
|
+
[array$1(StringType)],
|
|
11792
12002
|
(ctx, [v]) => v.value.indexOf(ctx.geometryType()) >= 0
|
|
11793
12003
|
],
|
|
11794
12004
|
'filter-id-in': [
|
|
11795
12005
|
BooleanType,
|
|
11796
|
-
[array(ValueType)],
|
|
12006
|
+
[array$1(ValueType)],
|
|
11797
12007
|
(ctx, [v]) => v.value.indexOf(ctx.id()) >= 0
|
|
11798
12008
|
],
|
|
11799
12009
|
'filter-in-small': [
|
|
11800
12010
|
BooleanType,
|
|
11801
12011
|
[
|
|
11802
12012
|
StringType,
|
|
11803
|
-
array(ValueType)
|
|
12013
|
+
array$1(ValueType)
|
|
11804
12014
|
],
|
|
11805
12015
|
(ctx, [k, v]) => v.value.indexOf(ctx.properties()[k.value]) >= 0
|
|
11806
12016
|
],
|
|
@@ -11808,7 +12018,7 @@ CompoundExpression.register(expressions, {
|
|
|
11808
12018
|
BooleanType,
|
|
11809
12019
|
[
|
|
11810
12020
|
StringType,
|
|
11811
|
-
array(ValueType)
|
|
12021
|
+
array$1(ValueType)
|
|
11812
12022
|
],
|
|
11813
12023
|
(ctx, [k, v]) => binarySearch(ctx.properties()[k.value], v.value, 0, v.value.length - 1)
|
|
11814
12024
|
],
|
|
@@ -11885,7 +12095,7 @@ CompoundExpression.register(expressions, {
|
|
|
11885
12095
|
'concat': [
|
|
11886
12096
|
StringType,
|
|
11887
12097
|
varargs(ValueType),
|
|
11888
|
-
(ctx, args) => args.map(arg => toString
|
|
12098
|
+
(ctx, args) => args.map(arg => toString(arg.evaluate(ctx))).join('')
|
|
11889
12099
|
],
|
|
11890
12100
|
'resolved-locale': [
|
|
11891
12101
|
StringType,
|
|
@@ -11893,6 +12103,7 @@ CompoundExpression.register(expressions, {
|
|
|
11893
12103
|
(ctx, [collator]) => collator.evaluate(ctx).resolvedLocale()
|
|
11894
12104
|
]
|
|
11895
12105
|
});
|
|
12106
|
+
var definitions = expressions;
|
|
11896
12107
|
|
|
11897
12108
|
function success(value) {
|
|
11898
12109
|
return {
|
|
@@ -11933,7 +12144,7 @@ function getType(val) {
|
|
|
11933
12144
|
}
|
|
11934
12145
|
}
|
|
11935
12146
|
|
|
11936
|
-
function isFunction
|
|
12147
|
+
function isFunction(value) {
|
|
11937
12148
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
11938
12149
|
}
|
|
11939
12150
|
function identityFunction(x) {
|
|
@@ -11951,14 +12162,14 @@ function createFunction(parameters, propertySpec) {
|
|
|
11951
12162
|
parameters.stops = parameters.stops.map(stop => {
|
|
11952
12163
|
return [
|
|
11953
12164
|
stop[0],
|
|
11954
|
-
Color.parse(stop[1])
|
|
12165
|
+
Color$1.parse(stop[1])
|
|
11955
12166
|
];
|
|
11956
12167
|
});
|
|
11957
12168
|
}
|
|
11958
12169
|
if (parameters.default) {
|
|
11959
|
-
parameters.default = Color.parse(parameters.default);
|
|
12170
|
+
parameters.default = Color$1.parse(parameters.default);
|
|
11960
12171
|
} else {
|
|
11961
|
-
parameters.default = Color.parse(propertySpec.default);
|
|
12172
|
+
parameters.default = Color$1.parse(propertySpec.default);
|
|
11962
12173
|
}
|
|
11963
12174
|
}
|
|
11964
12175
|
if (parameters.colorSpace && parameters.colorSpace !== 'rgb' && !colorSpaces[parameters.colorSpace]) {
|
|
@@ -12015,7 +12226,7 @@ function createFunction(parameters, propertySpec) {
|
|
|
12015
12226
|
return {
|
|
12016
12227
|
kind: 'composite',
|
|
12017
12228
|
interpolationType,
|
|
12018
|
-
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
12229
|
+
interpolationFactor: Interpolate$1.interpolationFactor.bind(undefined, interpolationType),
|
|
12019
12230
|
zoomStops: featureFunctionStops.map(s => s[0]),
|
|
12020
12231
|
evaluate({zoom}, properties) {
|
|
12021
12232
|
return evaluateExponentialFunction({
|
|
@@ -12032,7 +12243,7 @@ function createFunction(parameters, propertySpec) {
|
|
|
12032
12243
|
return {
|
|
12033
12244
|
kind: 'camera',
|
|
12034
12245
|
interpolationType,
|
|
12035
|
-
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
12246
|
+
interpolationFactor: Interpolate$1.interpolationFactor.bind(undefined, interpolationType),
|
|
12036
12247
|
zoomStops: parameters.stops.map(s => s[0]),
|
|
12037
12248
|
evaluate: ({zoom}) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)
|
|
12038
12249
|
};
|
|
@@ -12042,14 +12253,14 @@ function createFunction(parameters, propertySpec) {
|
|
|
12042
12253
|
evaluate(_, feature) {
|
|
12043
12254
|
const value = feature && feature.properties ? feature.properties[parameters.property] : undefined;
|
|
12044
12255
|
if (value === undefined) {
|
|
12045
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12256
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12046
12257
|
}
|
|
12047
12258
|
return innerFun(parameters, propertySpec, value, hashedStops, categoricalKeyType);
|
|
12048
12259
|
}
|
|
12049
12260
|
};
|
|
12050
12261
|
}
|
|
12051
12262
|
}
|
|
12052
|
-
function coalesce(a, b, c) {
|
|
12263
|
+
function coalesce$1(a, b, c) {
|
|
12053
12264
|
if (a !== undefined)
|
|
12054
12265
|
return a;
|
|
12055
12266
|
if (b !== undefined)
|
|
@@ -12059,11 +12270,11 @@ function coalesce(a, b, c) {
|
|
|
12059
12270
|
}
|
|
12060
12271
|
function evaluateCategoricalFunction(parameters, propertySpec, input, hashedStops, keyType) {
|
|
12061
12272
|
const evaluated = typeof input === keyType ? hashedStops[input] : undefined;
|
|
12062
|
-
return coalesce(evaluated, parameters.default, propertySpec.default);
|
|
12273
|
+
return coalesce$1(evaluated, parameters.default, propertySpec.default);
|
|
12063
12274
|
}
|
|
12064
12275
|
function evaluateIntervalFunction(parameters, propertySpec, input) {
|
|
12065
12276
|
if (getType(input) !== 'number')
|
|
12066
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12277
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12067
12278
|
const n = parameters.stops.length;
|
|
12068
12279
|
if (n === 1)
|
|
12069
12280
|
return parameters.stops[0][1];
|
|
@@ -12077,7 +12288,7 @@ function evaluateIntervalFunction(parameters, propertySpec, input) {
|
|
|
12077
12288
|
function evaluateExponentialFunction(parameters, propertySpec, input) {
|
|
12078
12289
|
const base = parameters.base !== undefined ? parameters.base : 1;
|
|
12079
12290
|
if (getType(input) !== 'number')
|
|
12080
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12291
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12081
12292
|
const n = parameters.stops.length;
|
|
12082
12293
|
if (n === 1)
|
|
12083
12294
|
return parameters.stops[0][1];
|
|
@@ -12110,7 +12321,7 @@ function evaluateExponentialFunction(parameters, propertySpec, input) {
|
|
|
12110
12321
|
}
|
|
12111
12322
|
function evaluateIdentityFunction(parameters, propertySpec, input) {
|
|
12112
12323
|
if (propertySpec.type === 'color') {
|
|
12113
|
-
input = Color.parse(input);
|
|
12324
|
+
input = Color$1.parse(input);
|
|
12114
12325
|
} else if (propertySpec.type === 'formatted') {
|
|
12115
12326
|
input = Formatted.fromString(input.toString());
|
|
12116
12327
|
} else if (propertySpec.type === 'resolvedImage') {
|
|
@@ -12118,7 +12329,7 @@ function evaluateIdentityFunction(parameters, propertySpec, input) {
|
|
|
12118
12329
|
} else if (getType(input) !== propertySpec.type && (propertySpec.type !== 'enum' || !propertySpec.values[input])) {
|
|
12119
12330
|
input = undefined;
|
|
12120
12331
|
}
|
|
12121
|
-
return coalesce(input, parameters.default, propertySpec.default);
|
|
12332
|
+
return coalesce$1(input, parameters.default, propertySpec.default);
|
|
12122
12333
|
}
|
|
12123
12334
|
function interpolationFactor(input, base, lowerValue, upperValue) {
|
|
12124
12335
|
const difference = upperValue - lowerValue;
|
|
@@ -12136,7 +12347,7 @@ class StyleExpression {
|
|
|
12136
12347
|
constructor(expression, propertySpec) {
|
|
12137
12348
|
this.expression = expression;
|
|
12138
12349
|
this._warningHistory = {};
|
|
12139
|
-
this._evaluator = new EvaluationContext();
|
|
12350
|
+
this._evaluator = new EvaluationContext$1();
|
|
12140
12351
|
this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
|
|
12141
12352
|
this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;
|
|
12142
12353
|
}
|
|
@@ -12166,7 +12377,7 @@ class StyleExpression {
|
|
|
12166
12377
|
return this._defaultValue;
|
|
12167
12378
|
}
|
|
12168
12379
|
if (this._enumValues && !(val in this._enumValues)) {
|
|
12169
|
-
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.`);
|
|
12380
|
+
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.`);
|
|
12170
12381
|
}
|
|
12171
12382
|
return val;
|
|
12172
12383
|
} catch (e) {
|
|
@@ -12181,10 +12392,10 @@ class StyleExpression {
|
|
|
12181
12392
|
}
|
|
12182
12393
|
}
|
|
12183
12394
|
function isExpression(expression) {
|
|
12184
|
-
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in
|
|
12395
|
+
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in definitions;
|
|
12185
12396
|
}
|
|
12186
12397
|
function createExpression(expression, propertySpec) {
|
|
12187
|
-
const parser = new ParsingContext(
|
|
12398
|
+
const parser = new ParsingContext$1(definitions, [], propertySpec ? getExpectedType(propertySpec) : undefined);
|
|
12188
12399
|
const parsed = parser.parse(expression, undefined, undefined, undefined, propertySpec && propertySpec.type === 'string' ? { typeAnnotation: 'coerce' } : undefined);
|
|
12189
12400
|
if (!parsed) {
|
|
12190
12401
|
return error(parser.errors);
|
|
@@ -12220,7 +12431,7 @@ class ZoomDependentExpression {
|
|
|
12220
12431
|
}
|
|
12221
12432
|
interpolationFactor(input, lower, upper) {
|
|
12222
12433
|
if (this.interpolationType) {
|
|
12223
|
-
return Interpolate.interpolationFactor(this.interpolationType, input, lower, upper);
|
|
12434
|
+
return Interpolate$1.interpolationFactor(this.interpolationType, input, lower, upper);
|
|
12224
12435
|
} else {
|
|
12225
12436
|
return 0;
|
|
12226
12437
|
}
|
|
@@ -12234,7 +12445,7 @@ function createPropertyExpression(expression, propertySpec) {
|
|
|
12234
12445
|
const parsed = expression.value.expression;
|
|
12235
12446
|
const isFeatureConstant$1 = isFeatureConstant(parsed);
|
|
12236
12447
|
if (!isFeatureConstant$1 && !supportsPropertyExpression(propertySpec)) {
|
|
12237
|
-
return error([new ParsingError('', 'data expressions not supported')]);
|
|
12448
|
+
return error([new ParsingError$2('', 'data expressions not supported')]);
|
|
12238
12449
|
}
|
|
12239
12450
|
const isZoomConstant = isGlobalPropertyConstant(parsed, [
|
|
12240
12451
|
'zoom',
|
|
@@ -12242,20 +12453,20 @@ function createPropertyExpression(expression, propertySpec) {
|
|
|
12242
12453
|
'distance-from-center'
|
|
12243
12454
|
]);
|
|
12244
12455
|
if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {
|
|
12245
|
-
return error([new ParsingError('', 'zoom expressions not supported')]);
|
|
12456
|
+
return error([new ParsingError$2('', 'zoom expressions not supported')]);
|
|
12246
12457
|
}
|
|
12247
12458
|
const zoomCurve = findZoomCurve(parsed);
|
|
12248
12459
|
if (!zoomCurve && !isZoomConstant) {
|
|
12249
|
-
return error([new ParsingError('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);
|
|
12250
|
-
} else if (zoomCurve instanceof ParsingError) {
|
|
12460
|
+
return error([new ParsingError$2('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);
|
|
12461
|
+
} else if (zoomCurve instanceof ParsingError$2) {
|
|
12251
12462
|
return error([zoomCurve]);
|
|
12252
|
-
} else if (zoomCurve instanceof Interpolate && !supportsInterpolation(propertySpec)) {
|
|
12253
|
-
return error([new ParsingError('', '"interpolate" expressions cannot be used with this property')]);
|
|
12463
|
+
} else if (zoomCurve instanceof Interpolate$1 && !supportsInterpolation(propertySpec)) {
|
|
12464
|
+
return error([new ParsingError$2('', '"interpolate" expressions cannot be used with this property')]);
|
|
12254
12465
|
}
|
|
12255
12466
|
if (!zoomCurve) {
|
|
12256
12467
|
return success(isFeatureConstant$1 ? new ZoomConstantExpression('constant', expression.value) : new ZoomConstantExpression('source', expression.value));
|
|
12257
12468
|
}
|
|
12258
|
-
const interpolationType = zoomCurve instanceof Interpolate ? zoomCurve.interpolation : undefined;
|
|
12469
|
+
const interpolationType = zoomCurve instanceof Interpolate$1 ? zoomCurve.interpolation : undefined;
|
|
12259
12470
|
return success(isFeatureConstant$1 ? new ZoomDependentExpression('camera', expression.value, zoomCurve.labels, interpolationType) : new ZoomDependentExpression('composite', expression.value, zoomCurve.labels, interpolationType));
|
|
12260
12471
|
}
|
|
12261
12472
|
class StylePropertyFunction {
|
|
@@ -12275,7 +12486,7 @@ class StylePropertyFunction {
|
|
|
12275
12486
|
}
|
|
12276
12487
|
}
|
|
12277
12488
|
function normalizePropertyExpression(value, specification) {
|
|
12278
|
-
if (isFunction
|
|
12489
|
+
if (isFunction(value)) {
|
|
12279
12490
|
return new StylePropertyFunction(value, specification);
|
|
12280
12491
|
} else if (isExpression(value)) {
|
|
12281
12492
|
const expression = createPropertyExpression(value, specification);
|
|
@@ -12286,7 +12497,7 @@ function normalizePropertyExpression(value, specification) {
|
|
|
12286
12497
|
} else {
|
|
12287
12498
|
let constant = value;
|
|
12288
12499
|
if (typeof value === 'string' && specification.type === 'color') {
|
|
12289
|
-
constant = Color.parse(value);
|
|
12500
|
+
constant = Color$1.parse(value);
|
|
12290
12501
|
}
|
|
12291
12502
|
return {
|
|
12292
12503
|
kind: 'constant',
|
|
@@ -12296,29 +12507,29 @@ function normalizePropertyExpression(value, specification) {
|
|
|
12296
12507
|
}
|
|
12297
12508
|
function findZoomCurve(expression) {
|
|
12298
12509
|
let result = null;
|
|
12299
|
-
if (expression instanceof Let) {
|
|
12510
|
+
if (expression instanceof Let$1) {
|
|
12300
12511
|
result = findZoomCurve(expression.result);
|
|
12301
|
-
} else if (expression instanceof Coalesce) {
|
|
12512
|
+
} else if (expression instanceof Coalesce$1) {
|
|
12302
12513
|
for (const arg of expression.args) {
|
|
12303
12514
|
result = findZoomCurve(arg);
|
|
12304
12515
|
if (result) {
|
|
12305
12516
|
break;
|
|
12306
12517
|
}
|
|
12307
12518
|
}
|
|
12308
|
-
} else if ((expression instanceof Step || expression instanceof Interpolate) && expression.input instanceof CompoundExpression && expression.input.name === 'zoom') {
|
|
12519
|
+
} else if ((expression instanceof Step$1 || expression instanceof Interpolate$1) && expression.input instanceof CompoundExpression$1 && expression.input.name === 'zoom') {
|
|
12309
12520
|
result = expression;
|
|
12310
12521
|
}
|
|
12311
|
-
if (result instanceof ParsingError) {
|
|
12522
|
+
if (result instanceof ParsingError$2) {
|
|
12312
12523
|
return result;
|
|
12313
12524
|
}
|
|
12314
12525
|
expression.eachChild(child => {
|
|
12315
12526
|
const childResult = findZoomCurve(child);
|
|
12316
|
-
if (childResult instanceof ParsingError) {
|
|
12527
|
+
if (childResult instanceof ParsingError$2) {
|
|
12317
12528
|
result = childResult;
|
|
12318
12529
|
} else if (!result && childResult) {
|
|
12319
|
-
result = new ParsingError('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.');
|
|
12530
|
+
result = new ParsingError$2('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.');
|
|
12320
12531
|
} else if (result && childResult && result !== childResult) {
|
|
12321
|
-
result = new ParsingError('', 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.');
|
|
12532
|
+
result = new ParsingError$2('', 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.');
|
|
12322
12533
|
}
|
|
12323
12534
|
});
|
|
12324
12535
|
return result;
|
|
@@ -12334,15 +12545,15 @@ function getExpectedType(spec) {
|
|
|
12334
12545
|
resolvedImage: ResolvedImageType
|
|
12335
12546
|
};
|
|
12336
12547
|
if (spec.type === 'array') {
|
|
12337
|
-
return array(types[spec.value] || ValueType, spec.length);
|
|
12548
|
+
return array$1(types[spec.value] || ValueType, spec.length);
|
|
12338
12549
|
}
|
|
12339
12550
|
return types[spec.type];
|
|
12340
12551
|
}
|
|
12341
12552
|
function getDefaultValue(spec) {
|
|
12342
|
-
if (spec.type === 'color' && isFunction
|
|
12343
|
-
return new Color(0, 0, 0, 0);
|
|
12553
|
+
if (spec.type === 'color' && (isFunction(spec.default) || Array.isArray(spec.default))) {
|
|
12554
|
+
return new Color$1(0, 0, 0, 0);
|
|
12344
12555
|
} else if (spec.type === 'color') {
|
|
12345
|
-
return Color.parse(spec.default) || null;
|
|
12556
|
+
return Color$1.parse(spec.default) || null;
|
|
12346
12557
|
} else if (spec.default === undefined) {
|
|
12347
12558
|
return null;
|
|
12348
12559
|
} else {
|
|
@@ -12471,14 +12682,14 @@ function convertZoomAndPropertyFunction(parameters, propertySpec, stops) {
|
|
|
12471
12682
|
return expression;
|
|
12472
12683
|
}
|
|
12473
12684
|
}
|
|
12474
|
-
function coalesce
|
|
12685
|
+
function coalesce(a, b) {
|
|
12475
12686
|
if (a !== undefined)
|
|
12476
12687
|
return a;
|
|
12477
12688
|
if (b !== undefined)
|
|
12478
12689
|
return b;
|
|
12479
12690
|
}
|
|
12480
12691
|
function getFallback(parameters, propertySpec) {
|
|
12481
|
-
const defaultValue = convertLiteral(coalesce
|
|
12692
|
+
const defaultValue = convertLiteral(coalesce(parameters.default, propertySpec.default));
|
|
12482
12693
|
if (defaultValue === undefined && propertySpec.type === 'resolvedImage') {
|
|
12483
12694
|
return '';
|
|
12484
12695
|
}
|
|
@@ -12712,7 +12923,7 @@ function createFilter(filter, layerType = 'fill') {
|
|
|
12712
12923
|
};
|
|
12713
12924
|
}
|
|
12714
12925
|
if (!isExpressionFilter(filter)) {
|
|
12715
|
-
filter = convertFilter(filter);
|
|
12926
|
+
filter = convertFilter$1(filter);
|
|
12716
12927
|
}
|
|
12717
12928
|
const filterExp = filter;
|
|
12718
12929
|
let staticFilter = true;
|
|
@@ -12857,16 +13068,16 @@ function geometryNeeded(filter) {
|
|
|
12857
13068
|
}
|
|
12858
13069
|
return false;
|
|
12859
13070
|
}
|
|
12860
|
-
function convertFilter(filter) {
|
|
13071
|
+
function convertFilter$1(filter) {
|
|
12861
13072
|
if (!filter)
|
|
12862
13073
|
return true;
|
|
12863
13074
|
const op = filter[0];
|
|
12864
13075
|
if (filter.length <= 1)
|
|
12865
13076
|
return op !== 'any';
|
|
12866
|
-
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;
|
|
13077
|
+
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;
|
|
12867
13078
|
return converted;
|
|
12868
13079
|
}
|
|
12869
|
-
function convertComparisonOp(property, value, op) {
|
|
13080
|
+
function convertComparisonOp$1(property, value, op) {
|
|
12870
13081
|
switch (property) {
|
|
12871
13082
|
case '$type':
|
|
12872
13083
|
return [
|
|
@@ -12887,9 +13098,9 @@ function convertComparisonOp(property, value, op) {
|
|
|
12887
13098
|
}
|
|
12888
13099
|
}
|
|
12889
13100
|
function convertDisjunctionOp(filters) {
|
|
12890
|
-
return ['any'].concat(filters.map(convertFilter));
|
|
13101
|
+
return ['any'].concat(filters.map(convertFilter$1));
|
|
12891
13102
|
}
|
|
12892
|
-
function convertInOp(property, values) {
|
|
13103
|
+
function convertInOp$1(property, values) {
|
|
12893
13104
|
if (values.length === 0) {
|
|
12894
13105
|
return false;
|
|
12895
13106
|
}
|
|
@@ -12932,7 +13143,7 @@ function convertInOp(property, values) {
|
|
|
12932
13143
|
}
|
|
12933
13144
|
}
|
|
12934
13145
|
}
|
|
12935
|
-
function convertHasOp(property) {
|
|
13146
|
+
function convertHasOp$1(property) {
|
|
12936
13147
|
switch (property) {
|
|
12937
13148
|
case '$type':
|
|
12938
13149
|
return true;
|
|
@@ -12952,7 +13163,7 @@ function convertNegation(filter) {
|
|
|
12952
13163
|
];
|
|
12953
13164
|
}
|
|
12954
13165
|
|
|
12955
|
-
function convertFilter
|
|
13166
|
+
function convertFilter(filter) {
|
|
12956
13167
|
return _convertFilter(filter, {});
|
|
12957
13168
|
}
|
|
12958
13169
|
function _convertFilter(filter, expectedTypes) {
|
|
@@ -12967,7 +13178,7 @@ function _convertFilter(filter, expectedTypes) {
|
|
|
12967
13178
|
let converted;
|
|
12968
13179
|
if (op === '==' || op === '!=' || op === '<' || op === '>' || op === '<=' || op === '>=') {
|
|
12969
13180
|
const [, property, value] = filter;
|
|
12970
|
-
converted = convertComparisonOp
|
|
13181
|
+
converted = convertComparisonOp(property, value, op, expectedTypes);
|
|
12971
13182
|
} else if (op === 'any') {
|
|
12972
13183
|
const children = filter.slice(1).map(f => {
|
|
12973
13184
|
const types = {};
|
|
@@ -12990,15 +13201,15 @@ function _convertFilter(filter, expectedTypes) {
|
|
|
12990
13201
|
_convertFilter(['any'].concat(filter.slice(1)), {})
|
|
12991
13202
|
];
|
|
12992
13203
|
} else if (op === 'in') {
|
|
12993
|
-
converted = convertInOp
|
|
13204
|
+
converted = convertInOp(filter[1], filter.slice(2));
|
|
12994
13205
|
} else if (op === '!in') {
|
|
12995
|
-
converted = convertInOp
|
|
13206
|
+
converted = convertInOp(filter[1], filter.slice(2), true);
|
|
12996
13207
|
} else if (op === 'has') {
|
|
12997
|
-
converted = convertHasOp
|
|
13208
|
+
converted = convertHasOp(filter[1]);
|
|
12998
13209
|
} else if (op === '!has') {
|
|
12999
13210
|
converted = [
|
|
13000
13211
|
'!',
|
|
13001
|
-
convertHasOp
|
|
13212
|
+
convertHasOp(filter[1])
|
|
13002
13213
|
];
|
|
13003
13214
|
} else {
|
|
13004
13215
|
converted = true;
|
|
@@ -13027,7 +13238,7 @@ function runtimeTypeChecks(expectedTypes) {
|
|
|
13027
13238
|
return conditions[0];
|
|
13028
13239
|
return ['all'].concat(conditions);
|
|
13029
13240
|
}
|
|
13030
|
-
function convertComparisonOp
|
|
13241
|
+
function convertComparisonOp(property, value, op, expectedTypes) {
|
|
13031
13242
|
let get;
|
|
13032
13243
|
if (property === '$type') {
|
|
13033
13244
|
return [
|
|
@@ -13083,7 +13294,7 @@ function convertComparisonOp$1(property, value, op, expectedTypes) {
|
|
|
13083
13294
|
value
|
|
13084
13295
|
];
|
|
13085
13296
|
}
|
|
13086
|
-
function convertInOp
|
|
13297
|
+
function convertInOp(property, values, negate = false) {
|
|
13087
13298
|
if (values.length === 0)
|
|
13088
13299
|
return negate;
|
|
13089
13300
|
let get;
|
|
@@ -13121,7 +13332,7 @@ function convertInOp$1(property, values, negate = false) {
|
|
|
13121
13332
|
v
|
|
13122
13333
|
]));
|
|
13123
13334
|
}
|
|
13124
|
-
function convertHasOp
|
|
13335
|
+
function convertHasOp(property) {
|
|
13125
13336
|
if (property === '$type') {
|
|
13126
13337
|
return true;
|
|
13127
13338
|
} else if (property === '$id') {
|
|
@@ -13142,7 +13353,7 @@ function migrateToExpressions (style) {
|
|
|
13142
13353
|
const converted = [];
|
|
13143
13354
|
eachLayer(style, layer => {
|
|
13144
13355
|
if (layer.filter) {
|
|
13145
|
-
layer.filter = convertFilter
|
|
13356
|
+
layer.filter = convertFilter(layer.filter);
|
|
13146
13357
|
}
|
|
13147
13358
|
});
|
|
13148
13359
|
eachProperty(style, {
|
|
@@ -13669,7 +13880,7 @@ class ValidationError {
|
|
|
13669
13880
|
}
|
|
13670
13881
|
}
|
|
13671
13882
|
|
|
13672
|
-
class ParsingError
|
|
13883
|
+
class ParsingError {
|
|
13673
13884
|
constructor(error) {
|
|
13674
13885
|
this.error = error;
|
|
13675
13886
|
this.message = error.message;
|
|
@@ -14020,7 +14231,7 @@ function disallowedFilterParameters(e, options) {
|
|
|
14020
14231
|
return [];
|
|
14021
14232
|
}
|
|
14022
14233
|
const errors = [];
|
|
14023
|
-
if (e instanceof CompoundExpression) {
|
|
14234
|
+
if (e instanceof CompoundExpression$1) {
|
|
14024
14235
|
if (disallowedParameters.has(e.name)) {
|
|
14025
14236
|
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 }`)];
|
|
14026
14237
|
}
|
|
@@ -14202,7 +14413,7 @@ function validateProperty(options, propertyType) {
|
|
|
14202
14413
|
if (propertyKey === 'text-field' && style && !style.glyphs) {
|
|
14203
14414
|
errors.push(new ValidationError(key, value, 'use of "text-field" requires a style "glyphs" property'));
|
|
14204
14415
|
}
|
|
14205
|
-
if (propertyKey === 'text-font' && isFunction
|
|
14416
|
+
if (propertyKey === 'text-font' && isFunction(deepUnbundle(value)) && unbundle(value.type) === 'identity') {
|
|
14206
14417
|
errors.push(new ValidationError(key, value, '"text-font" does not support identity functions'));
|
|
14207
14418
|
}
|
|
14208
14419
|
}
|
|
@@ -14287,7 +14498,7 @@ function validateLayer(options) {
|
|
|
14287
14498
|
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" must specify a "source-layer"`));
|
|
14288
14499
|
} else if (sourceType === 'raster-dem' && type !== 'hillshade') {
|
|
14289
14500
|
errors.push(new ValidationError(key, layer.source, 'raster-dem source can only be used with layer type \'hillshade\'.'));
|
|
14290
|
-
} else if (type === 'line' && layer.paint && layer.paint['line-gradient'] && (sourceType !== 'geojson' || !source.lineMetrics)) {
|
|
14501
|
+
} else if (type === 'line' && layer.paint && (layer.paint['line-gradient'] || layer.paint['line-trim-offset']) && (sourceType !== 'geojson' || !source.lineMetrics)) {
|
|
14291
14502
|
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`));
|
|
14292
14503
|
}
|
|
14293
14504
|
}
|
|
@@ -14662,7 +14873,7 @@ function validate(options) {
|
|
|
14662
14873
|
const value = options.value;
|
|
14663
14874
|
const valueSpec = options.valueSpec;
|
|
14664
14875
|
const styleSpec = options.styleSpec;
|
|
14665
|
-
if (valueSpec.expression && isFunction
|
|
14876
|
+
if (valueSpec.expression && isFunction(unbundle(value))) {
|
|
14666
14877
|
return validateFunction(options);
|
|
14667
14878
|
} else if (valueSpec.expression && isExpression(deepUnbundle(value))) {
|
|
14668
14879
|
return validateExpression(options);
|
|
@@ -14689,7 +14900,7 @@ function validateGlyphsURL (options) {
|
|
|
14689
14900
|
return errors;
|
|
14690
14901
|
}
|
|
14691
14902
|
|
|
14692
|
-
function validateStyle(style, styleSpec = v8) {
|
|
14903
|
+
function validateStyle$1(style, styleSpec = v8) {
|
|
14693
14904
|
const errors = validate({
|
|
14694
14905
|
key: '',
|
|
14695
14906
|
value: style,
|
|
@@ -15366,25 +15577,27 @@ exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
|
|
15366
15577
|
}
|
|
15367
15578
|
});
|
|
15368
15579
|
|
|
15580
|
+
var jsonlint$1 = jsonlint;
|
|
15581
|
+
|
|
15369
15582
|
function readStyle(style) {
|
|
15370
15583
|
if (style instanceof String || typeof style === 'string' || style instanceof Buffer) {
|
|
15371
15584
|
try {
|
|
15372
|
-
return jsonlint.parse(style.toString());
|
|
15585
|
+
return jsonlint$1.parse(style.toString());
|
|
15373
15586
|
} catch (e) {
|
|
15374
|
-
throw new ParsingError
|
|
15587
|
+
throw new ParsingError(e);
|
|
15375
15588
|
}
|
|
15376
15589
|
}
|
|
15377
15590
|
return style;
|
|
15378
15591
|
}
|
|
15379
15592
|
|
|
15380
|
-
function validateStyle
|
|
15593
|
+
function validateStyle(style, styleSpec = v8) {
|
|
15381
15594
|
let s = style;
|
|
15382
15595
|
try {
|
|
15383
15596
|
s = readStyle(s);
|
|
15384
15597
|
} catch (e) {
|
|
15385
15598
|
return [e];
|
|
15386
15599
|
}
|
|
15387
|
-
return validateStyle(s, styleSpec);
|
|
15600
|
+
return validateStyle$1(s, styleSpec);
|
|
15388
15601
|
}
|
|
15389
15602
|
|
|
15390
15603
|
const SUPPORTED_SPEC_VERSION = 8;
|
|
@@ -15493,14 +15706,14 @@ function validateMapboxApiSupported(style) {
|
|
|
15493
15706
|
} catch (e) {
|
|
15494
15707
|
return [e];
|
|
15495
15708
|
}
|
|
15496
|
-
let errors = validateStyle(s, v8).concat(getRootErrors(s, Object.keys(v8.$root)));
|
|
15709
|
+
let errors = validateStyle$1(s, v8).concat(getRootErrors(s, Object.keys(v8.$root)));
|
|
15497
15710
|
if (s.sources) {
|
|
15498
15711
|
errors = errors.concat(getSourcesErrors(s.sources));
|
|
15499
15712
|
}
|
|
15500
15713
|
return errors;
|
|
15501
15714
|
}
|
|
15502
15715
|
|
|
15503
|
-
const expression
|
|
15716
|
+
const expression = {
|
|
15504
15717
|
StyleExpression,
|
|
15505
15718
|
isExpression,
|
|
15506
15719
|
isExpressionFilter,
|
|
@@ -15514,7 +15727,7 @@ const expression$1 = {
|
|
|
15514
15727
|
const styleFunction = {
|
|
15515
15728
|
convertFunction,
|
|
15516
15729
|
createFunction,
|
|
15517
|
-
isFunction
|
|
15730
|
+
isFunction
|
|
15518
15731
|
};
|
|
15519
15732
|
const visit = {
|
|
15520
15733
|
eachSource,
|
|
@@ -15522,5 +15735,5 @@ const visit = {
|
|
|
15522
15735
|
eachProperty
|
|
15523
15736
|
};
|
|
15524
15737
|
|
|
15525
|
-
export { Color
|
|
15738
|
+
export { Color$1 as Color, ParsingError, ValidationError, composite, convertFilter, derefLayers, diffStyles as diff, expression, createFilter as featureFilter, format$1 as format, styleFunction as function, v8 as latest, migrate, v8, validateStyle as validate, validateMapboxApiSupported, visit };
|
|
15526
15739
|
//# sourceMappingURL=index.es.js.map
|