@mapbox/mapbox-gl-style-spec 13.24.0 → 13.25.0-beta.1
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 +399 -207
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +391 -199
- package/dist/index.es.js.map +1 -1
- package/expression/index.js +1 -1
- package/flow-typed/gl-matrix.js +8 -1
- package/package.json +1 -1
- package/reference/v8.json +148 -8
- package/types.js +7 -3
- package/util/color.js +35 -0
- package/validate/validate_layer.js +2 -0
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, Mercator, Natural Earth, and Winkel Tripel. Terrain, fog, sky and CustomLayerInterface are not supported for projections other than mercator.",
|
|
98
|
+
doc: "The projection the map should be rendered in. Supported projections are Albers, Equal Earth, Equirectangular (WGS84), Lambert conformal conic, Mercator, Natural Earth, Globe, and Winkel Tripel. Terrain, fog, sky and CustomLayerInterface are not supported for projections other than mercator.",
|
|
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",
|
|
@@ -4005,6 +4112,9 @@ var terrain = {
|
|
|
4005
4112
|
},
|
|
4006
4113
|
transition: true,
|
|
4007
4114
|
doc: "Exaggerates the elevation of the terrain by multiplying the data from the DEM with this value.",
|
|
4115
|
+
requires: [
|
|
4116
|
+
"source"
|
|
4117
|
+
],
|
|
4008
4118
|
"sdk-support": {
|
|
4009
4119
|
"basic functionality": {
|
|
4010
4120
|
js: "2.0.0",
|
|
@@ -4572,6 +4682,35 @@ var paint_line = {
|
|
|
4572
4682
|
]
|
|
4573
4683
|
},
|
|
4574
4684
|
"property-type": "color-ramp"
|
|
4685
|
+
},
|
|
4686
|
+
"line-trim-offset": {
|
|
4687
|
+
type: "array",
|
|
4688
|
+
value: "number",
|
|
4689
|
+
doc: "The line part between [trim-start, trim-end] will be marked as transparent to make a route vanishing effect. The line trim-off offset is based on the whole line gradient range [0.0, 1.0]. If either 'trim-start' or 'trim-end' offset is out of valid range, the default range will be set.",
|
|
4690
|
+
length: 2,
|
|
4691
|
+
"default": [
|
|
4692
|
+
0,
|
|
4693
|
+
0
|
|
4694
|
+
],
|
|
4695
|
+
transition: false,
|
|
4696
|
+
requires: [
|
|
4697
|
+
"line-gradient",
|
|
4698
|
+
{
|
|
4699
|
+
source: "geojson",
|
|
4700
|
+
has: {
|
|
4701
|
+
lineMetrics: true
|
|
4702
|
+
}
|
|
4703
|
+
}
|
|
4704
|
+
],
|
|
4705
|
+
"sdk-support": {
|
|
4706
|
+
"basic functionality": {
|
|
4707
|
+
js: "2.3.0",
|
|
4708
|
+
android: "10.5.0",
|
|
4709
|
+
ios: "10.5.0",
|
|
4710
|
+
macos: "10.5.0"
|
|
4711
|
+
}
|
|
4712
|
+
},
|
|
4713
|
+
"property-type": "constant"
|
|
4575
4714
|
}
|
|
4576
4715
|
};
|
|
4577
4716
|
var paint_circle = {
|
|
@@ -6317,7 +6456,7 @@ var v8 = {
|
|
|
6317
6456
|
}
|
|
6318
6457
|
},
|
|
6319
6458
|
function_stop: function_stop,
|
|
6320
|
-
expression: expression,
|
|
6459
|
+
expression: expression$1,
|
|
6321
6460
|
expression_name: expression_name,
|
|
6322
6461
|
fog: fog,
|
|
6323
6462
|
light: light,
|
|
@@ -6691,6 +6830,8 @@ var jsonStringifyPrettyCompact = function stringify(passedObj, options) {
|
|
|
6691
6830
|
})(passedObj, "", 0);
|
|
6692
6831
|
};
|
|
6693
6832
|
|
|
6833
|
+
var stringifyPretty = jsonStringifyPrettyCompact;
|
|
6834
|
+
|
|
6694
6835
|
function sortKeysBy(obj, reference) {
|
|
6695
6836
|
const result = {};
|
|
6696
6837
|
for (const key in reference) {
|
|
@@ -6705,12 +6846,12 @@ function sortKeysBy(obj, reference) {
|
|
|
6705
6846
|
}
|
|
6706
6847
|
return result;
|
|
6707
6848
|
}
|
|
6708
|
-
function format(style, space = 2) {
|
|
6849
|
+
function format$1(style, space = 2) {
|
|
6709
6850
|
style = sortKeysBy(style, v8.$root);
|
|
6710
6851
|
if (style.layers) {
|
|
6711
6852
|
style.layers = style.layers.map(layer => sortKeysBy(layer, v8.layer));
|
|
6712
6853
|
}
|
|
6713
|
-
return
|
|
6854
|
+
return stringifyPretty(style, { indent: space });
|
|
6714
6855
|
}
|
|
6715
6856
|
|
|
6716
6857
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -7378,7 +7519,7 @@ exports.encode = exports.stringify = encode;
|
|
|
7378
7519
|
var parse = urlParse;
|
|
7379
7520
|
var resolve = urlResolve;
|
|
7380
7521
|
var resolveObject = urlResolveObject;
|
|
7381
|
-
var format
|
|
7522
|
+
var format = urlFormat;
|
|
7382
7523
|
|
|
7383
7524
|
var Url_1 = Url;
|
|
7384
7525
|
|
|
@@ -8085,7 +8226,7 @@ var url = {
|
|
|
8085
8226
|
parse: parse,
|
|
8086
8227
|
resolve: resolve,
|
|
8087
8228
|
resolveObject: resolveObject,
|
|
8088
|
-
format: format
|
|
8229
|
+
format: format,
|
|
8089
8230
|
Url: Url_1
|
|
8090
8231
|
};
|
|
8091
8232
|
|
|
@@ -8166,7 +8307,7 @@ function resolveConstant(style, value) {
|
|
|
8166
8307
|
return value;
|
|
8167
8308
|
}
|
|
8168
8309
|
}
|
|
8169
|
-
function isFunction(value) {
|
|
8310
|
+
function isFunction$1(value) {
|
|
8170
8311
|
return Array.isArray(value.stops);
|
|
8171
8312
|
}
|
|
8172
8313
|
function renameProperty(obj, from, to) {
|
|
@@ -8208,7 +8349,7 @@ function migrateToV8 (style) {
|
|
|
8208
8349
|
layout: true
|
|
8209
8350
|
}, property => {
|
|
8210
8351
|
const value = resolveConstant(style, property.value);
|
|
8211
|
-
if (isFunction(value)) {
|
|
8352
|
+
if (isFunction$1(value)) {
|
|
8212
8353
|
value.stops.forEach(stop => {
|
|
8213
8354
|
stop[1] = resolveConstant(style, stop[1]);
|
|
8214
8355
|
});
|
|
@@ -8299,13 +8440,14 @@ function extend (output, ...inputs) {
|
|
|
8299
8440
|
return output;
|
|
8300
8441
|
}
|
|
8301
8442
|
|
|
8302
|
-
class ParsingError extends Error {
|
|
8443
|
+
class ParsingError$1 extends Error {
|
|
8303
8444
|
constructor(key, message) {
|
|
8304
8445
|
super(message);
|
|
8305
8446
|
this.message = message;
|
|
8306
8447
|
this.key = key;
|
|
8307
8448
|
}
|
|
8308
8449
|
}
|
|
8450
|
+
var ParsingError$2 = ParsingError$1;
|
|
8309
8451
|
|
|
8310
8452
|
class Scope {
|
|
8311
8453
|
constructor(parent, bindings = []) {
|
|
@@ -8333,6 +8475,7 @@ class Scope {
|
|
|
8333
8475
|
return this.parent ? this.parent.has(name) : false;
|
|
8334
8476
|
}
|
|
8335
8477
|
}
|
|
8478
|
+
var Scope$1 = Scope;
|
|
8336
8479
|
|
|
8337
8480
|
const NullType = { kind: 'null' };
|
|
8338
8481
|
const NumberType = { kind: 'number' };
|
|
@@ -8345,16 +8488,16 @@ const ErrorType = { kind: 'error' };
|
|
|
8345
8488
|
const CollatorType = { kind: 'collator' };
|
|
8346
8489
|
const FormattedType = { kind: 'formatted' };
|
|
8347
8490
|
const ResolvedImageType = { kind: 'resolvedImage' };
|
|
8348
|
-
function array(itemType, N) {
|
|
8491
|
+
function array$1(itemType, N) {
|
|
8349
8492
|
return {
|
|
8350
8493
|
kind: 'array',
|
|
8351
8494
|
itemType,
|
|
8352
8495
|
N
|
|
8353
8496
|
};
|
|
8354
8497
|
}
|
|
8355
|
-
function toString(type) {
|
|
8498
|
+
function toString$1(type) {
|
|
8356
8499
|
if (type.kind === 'array') {
|
|
8357
|
-
const itemType = toString(type.itemType);
|
|
8500
|
+
const itemType = toString$1(type.itemType);
|
|
8358
8501
|
return typeof type.N === 'number' ? `array<${ itemType }, ${ type.N }>` : type.itemType.kind === 'value' ? 'array' : `array<${ itemType }>`;
|
|
8359
8502
|
} else {
|
|
8360
8503
|
return type.kind;
|
|
@@ -8368,7 +8511,7 @@ const valueMemberTypes = [
|
|
|
8368
8511
|
ColorType,
|
|
8369
8512
|
FormattedType,
|
|
8370
8513
|
ObjectType,
|
|
8371
|
-
array(ValueType),
|
|
8514
|
+
array$1(ValueType),
|
|
8372
8515
|
ResolvedImageType
|
|
8373
8516
|
];
|
|
8374
8517
|
function checkSubtype(expected, t) {
|
|
@@ -8387,7 +8530,7 @@ function checkSubtype(expected, t) {
|
|
|
8387
8530
|
}
|
|
8388
8531
|
}
|
|
8389
8532
|
}
|
|
8390
|
-
return `Expected ${ toString(expected) } but found ${ toString(t) } instead.`;
|
|
8533
|
+
return `Expected ${ toString$1(expected) } but found ${ toString$1(t) } instead.`;
|
|
8391
8534
|
}
|
|
8392
8535
|
function isValidType(provided, allowedTypes) {
|
|
8393
8536
|
return allowedTypes.some(t => t.kind === provided.kind);
|
|
@@ -8651,12 +8794,36 @@ class Color {
|
|
|
8651
8794
|
a
|
|
8652
8795
|
];
|
|
8653
8796
|
}
|
|
8797
|
+
toArray01() {
|
|
8798
|
+
const {r, g, b, a} = this;
|
|
8799
|
+
return a === 0 ? [
|
|
8800
|
+
0,
|
|
8801
|
+
0,
|
|
8802
|
+
0,
|
|
8803
|
+
0
|
|
8804
|
+
] : [
|
|
8805
|
+
r / a,
|
|
8806
|
+
g / a,
|
|
8807
|
+
b / a,
|
|
8808
|
+
a
|
|
8809
|
+
];
|
|
8810
|
+
}
|
|
8811
|
+
toArray01PremultipliedAlpha() {
|
|
8812
|
+
const {r, g, b, a} = this;
|
|
8813
|
+
return [
|
|
8814
|
+
r,
|
|
8815
|
+
g,
|
|
8816
|
+
b,
|
|
8817
|
+
a
|
|
8818
|
+
];
|
|
8819
|
+
}
|
|
8654
8820
|
}
|
|
8655
8821
|
Color.black = new Color(0, 0, 0, 1);
|
|
8656
8822
|
Color.white = new Color(1, 1, 1, 1);
|
|
8657
8823
|
Color.transparent = new Color(0, 0, 0, 0);
|
|
8658
8824
|
Color.red = new Color(1, 0, 0, 1);
|
|
8659
8825
|
Color.blue = new Color(0, 0, 1, 1);
|
|
8826
|
+
var Color$1 = Color;
|
|
8660
8827
|
|
|
8661
8828
|
class Collator {
|
|
8662
8829
|
constructor(caseSensitive, diacriticSensitive, locale) {
|
|
@@ -8798,7 +8965,7 @@ function isValue(mixed) {
|
|
|
8798
8965
|
return true;
|
|
8799
8966
|
} else if (typeof mixed === 'number') {
|
|
8800
8967
|
return true;
|
|
8801
|
-
} else if (mixed instanceof Color) {
|
|
8968
|
+
} else if (mixed instanceof Color$1) {
|
|
8802
8969
|
return true;
|
|
8803
8970
|
} else if (mixed instanceof Collator) {
|
|
8804
8971
|
return true;
|
|
@@ -8833,7 +9000,7 @@ function typeOf(value) {
|
|
|
8833
9000
|
return BooleanType;
|
|
8834
9001
|
} else if (typeof value === 'number') {
|
|
8835
9002
|
return NumberType;
|
|
8836
|
-
} else if (value instanceof Color) {
|
|
9003
|
+
} else if (value instanceof Color$1) {
|
|
8837
9004
|
return ColorType;
|
|
8838
9005
|
} else if (value instanceof Collator) {
|
|
8839
9006
|
return CollatorType;
|
|
@@ -8855,18 +9022,18 @@ function typeOf(value) {
|
|
|
8855
9022
|
break;
|
|
8856
9023
|
}
|
|
8857
9024
|
}
|
|
8858
|
-
return array(itemType || ValueType, length);
|
|
9025
|
+
return array$1(itemType || ValueType, length);
|
|
8859
9026
|
} else {
|
|
8860
9027
|
return ObjectType;
|
|
8861
9028
|
}
|
|
8862
9029
|
}
|
|
8863
|
-
function toString
|
|
9030
|
+
function toString(value) {
|
|
8864
9031
|
const type = typeof value;
|
|
8865
9032
|
if (value === null) {
|
|
8866
9033
|
return '';
|
|
8867
9034
|
} else if (type === 'string' || type === 'number' || type === 'boolean') {
|
|
8868
9035
|
return String(value);
|
|
8869
|
-
} else if (value instanceof Color || value instanceof Formatted || value instanceof ResolvedImage) {
|
|
9036
|
+
} else if (value instanceof Color$1 || value instanceof Formatted || value instanceof ResolvedImage) {
|
|
8870
9037
|
return value.toString();
|
|
8871
9038
|
} else {
|
|
8872
9039
|
return JSON.stringify(value);
|
|
@@ -8905,7 +9072,7 @@ class Literal {
|
|
|
8905
9072
|
'literal',
|
|
8906
9073
|
this.value
|
|
8907
9074
|
];
|
|
8908
|
-
} else if (this.value instanceof Color) {
|
|
9075
|
+
} else if (this.value instanceof Color$1) {
|
|
8909
9076
|
return ['rgba'].concat(this.value.toArray());
|
|
8910
9077
|
} else if (this.value instanceof Formatted) {
|
|
8911
9078
|
return this.value.serialize();
|
|
@@ -8914,6 +9081,7 @@ class Literal {
|
|
|
8914
9081
|
}
|
|
8915
9082
|
}
|
|
8916
9083
|
}
|
|
9084
|
+
var Literal$1 = Literal;
|
|
8917
9085
|
|
|
8918
9086
|
class RuntimeError {
|
|
8919
9087
|
constructor(message) {
|
|
@@ -8924,8 +9092,9 @@ class RuntimeError {
|
|
|
8924
9092
|
return this.message;
|
|
8925
9093
|
}
|
|
8926
9094
|
}
|
|
9095
|
+
var RuntimeError$1 = RuntimeError;
|
|
8927
9096
|
|
|
8928
|
-
const types = {
|
|
9097
|
+
const types$1 = {
|
|
8929
9098
|
string: StringType,
|
|
8930
9099
|
number: NumberType,
|
|
8931
9100
|
boolean: BooleanType,
|
|
@@ -8946,9 +9115,9 @@ class Assertion {
|
|
|
8946
9115
|
let itemType;
|
|
8947
9116
|
if (args.length > 2) {
|
|
8948
9117
|
const type = args[1];
|
|
8949
|
-
if (typeof type !== 'string' || !(type in types) || type === 'object')
|
|
9118
|
+
if (typeof type !== 'string' || !(type in types$1) || type === 'object')
|
|
8950
9119
|
return context.error('The item type argument of "array" must be one of string, number, boolean', 1);
|
|
8951
|
-
itemType = types[type];
|
|
9120
|
+
itemType = types$1[type];
|
|
8952
9121
|
i++;
|
|
8953
9122
|
} else {
|
|
8954
9123
|
itemType = ValueType;
|
|
@@ -8961,9 +9130,9 @@ class Assertion {
|
|
|
8961
9130
|
N = args[2];
|
|
8962
9131
|
i++;
|
|
8963
9132
|
}
|
|
8964
|
-
type = array(itemType, N);
|
|
9133
|
+
type = array$1(itemType, N);
|
|
8965
9134
|
} else {
|
|
8966
|
-
type = types[name];
|
|
9135
|
+
type = types$1[name];
|
|
8967
9136
|
}
|
|
8968
9137
|
const parsed = [];
|
|
8969
9138
|
for (; i < args.length; i++) {
|
|
@@ -8981,7 +9150,7 @@ class Assertion {
|
|
|
8981
9150
|
if (!error) {
|
|
8982
9151
|
return value;
|
|
8983
9152
|
} 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.`);
|
|
9153
|
+
throw new RuntimeError$1(`Expected value to be of type ${ toString$1(this.type) }, but found ${ toString$1(typeOf(value)) } instead.`);
|
|
8985
9154
|
}
|
|
8986
9155
|
}
|
|
8987
9156
|
return null;
|
|
@@ -9008,6 +9177,7 @@ class Assertion {
|
|
|
9008
9177
|
return serialized.concat(this.args.map(arg => arg.serialize()));
|
|
9009
9178
|
}
|
|
9010
9179
|
}
|
|
9180
|
+
var Assertion$1 = Assertion;
|
|
9011
9181
|
|
|
9012
9182
|
class FormatExpression {
|
|
9013
9183
|
constructor(sections) {
|
|
@@ -9036,7 +9206,7 @@ class FormatExpression {
|
|
|
9036
9206
|
}
|
|
9037
9207
|
let font = null;
|
|
9038
9208
|
if (arg['text-font']) {
|
|
9039
|
-
font = context.parse(arg['text-font'], 1, array(StringType));
|
|
9209
|
+
font = context.parse(arg['text-font'], 1, array$1(StringType));
|
|
9040
9210
|
if (!font)
|
|
9041
9211
|
return null;
|
|
9042
9212
|
}
|
|
@@ -9074,7 +9244,7 @@ class FormatExpression {
|
|
|
9074
9244
|
if (typeOf(evaluatedContent) === ResolvedImageType) {
|
|
9075
9245
|
return new FormattedSection('', evaluatedContent, null, null, null);
|
|
9076
9246
|
}
|
|
9077
|
-
return new FormattedSection(toString
|
|
9247
|
+
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
9248
|
};
|
|
9079
9249
|
return new Formatted(this.sections.map(evaluateSection));
|
|
9080
9250
|
}
|
|
@@ -9150,7 +9320,7 @@ class ImageExpression {
|
|
|
9150
9320
|
}
|
|
9151
9321
|
}
|
|
9152
9322
|
|
|
9153
|
-
const types
|
|
9323
|
+
const types = {
|
|
9154
9324
|
'to-boolean': BooleanType,
|
|
9155
9325
|
'to-color': ColorType,
|
|
9156
9326
|
'to-number': NumberType,
|
|
@@ -9167,7 +9337,7 @@ class Coercion {
|
|
|
9167
9337
|
const name = args[0];
|
|
9168
9338
|
if ((name === 'to-boolean' || name === 'to-string') && args.length !== 2)
|
|
9169
9339
|
return context.error(`Expected one argument.`);
|
|
9170
|
-
const type = types
|
|
9340
|
+
const type = types[name];
|
|
9171
9341
|
const parsed = [];
|
|
9172
9342
|
for (let i = 1; i < args.length; i++) {
|
|
9173
9343
|
const input = context.parse(args[i], i, ValueType);
|
|
@@ -9186,7 +9356,7 @@ class Coercion {
|
|
|
9186
9356
|
for (const arg of this.args) {
|
|
9187
9357
|
input = arg.evaluate(ctx);
|
|
9188
9358
|
error = null;
|
|
9189
|
-
if (input instanceof Color) {
|
|
9359
|
+
if (input instanceof Color$1) {
|
|
9190
9360
|
return input;
|
|
9191
9361
|
} else if (typeof input === 'string') {
|
|
9192
9362
|
const c = ctx.parseColor(input);
|
|
@@ -9199,11 +9369,11 @@ class Coercion {
|
|
|
9199
9369
|
error = validateRGBA(input[0], input[1], input[2], input[3]);
|
|
9200
9370
|
}
|
|
9201
9371
|
if (!error) {
|
|
9202
|
-
return new Color(input[0] / 255, input[1] / 255, input[2] / 255, input[3]);
|
|
9372
|
+
return new Color$1(input[0] / 255, input[1] / 255, input[2] / 255, input[3]);
|
|
9203
9373
|
}
|
|
9204
9374
|
}
|
|
9205
9375
|
}
|
|
9206
|
-
throw new RuntimeError(error || `Could not parse color from value '${ typeof input === 'string' ? input : String(JSON.stringify(input)) }'`);
|
|
9376
|
+
throw new RuntimeError$1(error || `Could not parse color from value '${ typeof input === 'string' ? input : String(JSON.stringify(input)) }'`);
|
|
9207
9377
|
} else if (this.type.kind === 'number') {
|
|
9208
9378
|
let value = null;
|
|
9209
9379
|
for (const arg of this.args) {
|
|
@@ -9215,13 +9385,13 @@ class Coercion {
|
|
|
9215
9385
|
continue;
|
|
9216
9386
|
return num;
|
|
9217
9387
|
}
|
|
9218
|
-
throw new RuntimeError(`Could not convert ${ JSON.stringify(value) } to number.`);
|
|
9388
|
+
throw new RuntimeError$1(`Could not convert ${ JSON.stringify(value) } to number.`);
|
|
9219
9389
|
} else if (this.type.kind === 'formatted') {
|
|
9220
|
-
return Formatted.fromString(toString
|
|
9390
|
+
return Formatted.fromString(toString(this.args[0].evaluate(ctx)));
|
|
9221
9391
|
} else if (this.type.kind === 'resolvedImage') {
|
|
9222
|
-
return ResolvedImage.fromString(toString
|
|
9392
|
+
return ResolvedImage.fromString(toString(this.args[0].evaluate(ctx)));
|
|
9223
9393
|
} else {
|
|
9224
|
-
return toString
|
|
9394
|
+
return toString(this.args[0].evaluate(ctx));
|
|
9225
9395
|
}
|
|
9226
9396
|
}
|
|
9227
9397
|
eachChild(fn) {
|
|
@@ -9249,6 +9419,7 @@ class Coercion {
|
|
|
9249
9419
|
return serialized;
|
|
9250
9420
|
}
|
|
9251
9421
|
}
|
|
9422
|
+
var Coercion$1 = Coercion;
|
|
9252
9423
|
|
|
9253
9424
|
const geometryTypes = [
|
|
9254
9425
|
'Unknown',
|
|
@@ -9300,11 +9471,12 @@ class EvaluationContext {
|
|
|
9300
9471
|
parseColor(input) {
|
|
9301
9472
|
let cached = this._parseColorCache[input];
|
|
9302
9473
|
if (!cached) {
|
|
9303
|
-
cached = this._parseColorCache[input] = Color.parse(input);
|
|
9474
|
+
cached = this._parseColorCache[input] = Color$1.parse(input);
|
|
9304
9475
|
}
|
|
9305
9476
|
return cached;
|
|
9306
9477
|
}
|
|
9307
9478
|
}
|
|
9479
|
+
var EvaluationContext$1 = EvaluationContext;
|
|
9308
9480
|
|
|
9309
9481
|
class CompoundExpression {
|
|
9310
9482
|
constructor(name, type, evaluate, args) {
|
|
@@ -9339,7 +9511,7 @@ class CompoundExpression {
|
|
|
9339
9511
|
const overloads = availableOverloads.filter(([signature]) => !Array.isArray(signature) || signature.length === args.length - 1);
|
|
9340
9512
|
let signatureContext = null;
|
|
9341
9513
|
for (const [params, evaluate] of overloads) {
|
|
9342
|
-
signatureContext = new ParsingContext(context.registry, context.path, null, context.scope);
|
|
9514
|
+
signatureContext = new ParsingContext$1(context.registry, context.path, null, context.scope);
|
|
9343
9515
|
const parsedArgs = [];
|
|
9344
9516
|
let argParseFailed = false;
|
|
9345
9517
|
for (let i = 1; i < args.length; i++) {
|
|
@@ -9380,7 +9552,7 @@ class CompoundExpression {
|
|
|
9380
9552
|
const parsed = context.parse(args[i], 1 + actualTypes.length);
|
|
9381
9553
|
if (!parsed)
|
|
9382
9554
|
return null;
|
|
9383
|
-
actualTypes.push(toString(parsed.type));
|
|
9555
|
+
actualTypes.push(toString$1(parsed.type));
|
|
9384
9556
|
}
|
|
9385
9557
|
context.error(`Expected arguments of type ${ signatures }, but found (${ actualTypes.join(', ') }) instead.`);
|
|
9386
9558
|
}
|
|
@@ -9395,11 +9567,12 @@ class CompoundExpression {
|
|
|
9395
9567
|
}
|
|
9396
9568
|
function stringifySignature(signature) {
|
|
9397
9569
|
if (Array.isArray(signature)) {
|
|
9398
|
-
return `(${ signature.map(toString).join(', ') })`;
|
|
9570
|
+
return `(${ signature.map(toString$1).join(', ') })`;
|
|
9399
9571
|
} else {
|
|
9400
|
-
return `(${ toString(signature.type) }...)`;
|
|
9572
|
+
return `(${ toString$1(signature.type) }...)`;
|
|
9401
9573
|
}
|
|
9402
9574
|
}
|
|
9575
|
+
var CompoundExpression$1 = CompoundExpression;
|
|
9403
9576
|
|
|
9404
9577
|
class CollatorExpression {
|
|
9405
9578
|
constructor(caseSensitive, diacriticSensitive, locale) {
|
|
@@ -9796,9 +9969,10 @@ class Within {
|
|
|
9796
9969
|
];
|
|
9797
9970
|
}
|
|
9798
9971
|
}
|
|
9972
|
+
var Within$1 = Within;
|
|
9799
9973
|
|
|
9800
9974
|
function isFeatureConstant(e) {
|
|
9801
|
-
if (e instanceof CompoundExpression) {
|
|
9975
|
+
if (e instanceof CompoundExpression$1) {
|
|
9802
9976
|
if (e.name === 'get' && e.args.length === 1) {
|
|
9803
9977
|
return false;
|
|
9804
9978
|
} else if (e.name === 'feature-state') {
|
|
@@ -9811,7 +9985,7 @@ function isFeatureConstant(e) {
|
|
|
9811
9985
|
return false;
|
|
9812
9986
|
}
|
|
9813
9987
|
}
|
|
9814
|
-
if (e instanceof Within) {
|
|
9988
|
+
if (e instanceof Within$1) {
|
|
9815
9989
|
return false;
|
|
9816
9990
|
}
|
|
9817
9991
|
let result = true;
|
|
@@ -9823,7 +9997,7 @@ function isFeatureConstant(e) {
|
|
|
9823
9997
|
return result;
|
|
9824
9998
|
}
|
|
9825
9999
|
function isStateConstant(e) {
|
|
9826
|
-
if (e instanceof CompoundExpression) {
|
|
10000
|
+
if (e instanceof CompoundExpression$1) {
|
|
9827
10001
|
if (e.name === 'feature-state') {
|
|
9828
10002
|
return false;
|
|
9829
10003
|
}
|
|
@@ -9837,7 +10011,7 @@ function isStateConstant(e) {
|
|
|
9837
10011
|
return result;
|
|
9838
10012
|
}
|
|
9839
10013
|
function isGlobalPropertyConstant(e, properties) {
|
|
9840
|
-
if (e instanceof CompoundExpression && properties.indexOf(e.name) >= 0) {
|
|
10014
|
+
if (e instanceof CompoundExpression$1 && properties.indexOf(e.name) >= 0) {
|
|
9841
10015
|
return false;
|
|
9842
10016
|
}
|
|
9843
10017
|
let result = true;
|
|
@@ -9879,9 +10053,10 @@ class Var {
|
|
|
9879
10053
|
];
|
|
9880
10054
|
}
|
|
9881
10055
|
}
|
|
10056
|
+
var Var$1 = Var;
|
|
9882
10057
|
|
|
9883
10058
|
class ParsingContext {
|
|
9884
|
-
constructor(registry, path = [], expectedType, scope = new Scope(), errors = []) {
|
|
10059
|
+
constructor(registry, path = [], expectedType, scope = new Scope$1(), errors = []) {
|
|
9885
10060
|
this.registry = registry;
|
|
9886
10061
|
this.path = path;
|
|
9887
10062
|
this.key = path.map(part => `[${ part }]`).join('');
|
|
@@ -9904,9 +10079,9 @@ class ParsingContext {
|
|
|
9904
10079
|
}
|
|
9905
10080
|
function annotate(parsed, type, typeAnnotation) {
|
|
9906
10081
|
if (typeAnnotation === 'assert') {
|
|
9907
|
-
return new Assertion(type, [parsed]);
|
|
10082
|
+
return new Assertion$1(type, [parsed]);
|
|
9908
10083
|
} else if (typeAnnotation === 'coerce') {
|
|
9909
|
-
return new Coercion(type, [parsed]);
|
|
10084
|
+
return new Coercion$1(type, [parsed]);
|
|
9910
10085
|
} else {
|
|
9911
10086
|
return parsed;
|
|
9912
10087
|
}
|
|
@@ -9936,10 +10111,10 @@ class ParsingContext {
|
|
|
9936
10111
|
return null;
|
|
9937
10112
|
}
|
|
9938
10113
|
}
|
|
9939
|
-
if (!(parsed instanceof Literal) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
|
|
9940
|
-
const ec = new EvaluationContext();
|
|
10114
|
+
if (!(parsed instanceof Literal$1) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
|
|
10115
|
+
const ec = new EvaluationContext$1();
|
|
9941
10116
|
try {
|
|
9942
|
-
parsed = new Literal(parsed.type, parsed.evaluate(ec));
|
|
10117
|
+
parsed = new Literal$1(parsed.type, parsed.evaluate(ec));
|
|
9943
10118
|
} catch (e) {
|
|
9944
10119
|
this.error(e.message);
|
|
9945
10120
|
return null;
|
|
@@ -9963,7 +10138,7 @@ class ParsingContext {
|
|
|
9963
10138
|
}
|
|
9964
10139
|
error(error, ...keys) {
|
|
9965
10140
|
const key = `${ this.key }${ keys.map(k => `[${ k }]`).join('') }`;
|
|
9966
|
-
this.errors.push(new ParsingError(key, error));
|
|
10141
|
+
this.errors.push(new ParsingError$2(key, error));
|
|
9967
10142
|
}
|
|
9968
10143
|
checkSubtype(expected, t) {
|
|
9969
10144
|
const error = checkSubtype(expected, t);
|
|
@@ -9972,23 +10147,24 @@ class ParsingContext {
|
|
|
9972
10147
|
return error;
|
|
9973
10148
|
}
|
|
9974
10149
|
}
|
|
10150
|
+
var ParsingContext$1 = ParsingContext;
|
|
9975
10151
|
function isConstant(expression) {
|
|
9976
|
-
if (expression instanceof Var) {
|
|
10152
|
+
if (expression instanceof Var$1) {
|
|
9977
10153
|
return isConstant(expression.boundExpression);
|
|
9978
|
-
} else if (expression instanceof CompoundExpression && expression.name === 'error') {
|
|
10154
|
+
} else if (expression instanceof CompoundExpression$1 && expression.name === 'error') {
|
|
9979
10155
|
return false;
|
|
9980
10156
|
} else if (expression instanceof CollatorExpression) {
|
|
9981
10157
|
return false;
|
|
9982
|
-
} else if (expression instanceof Within) {
|
|
10158
|
+
} else if (expression instanceof Within$1) {
|
|
9983
10159
|
return false;
|
|
9984
10160
|
}
|
|
9985
|
-
const isTypeAnnotation = expression instanceof Coercion || expression instanceof Assertion;
|
|
10161
|
+
const isTypeAnnotation = expression instanceof Coercion$1 || expression instanceof Assertion$1;
|
|
9986
10162
|
let childrenConstant = true;
|
|
9987
10163
|
expression.eachChild(child => {
|
|
9988
10164
|
if (isTypeAnnotation) {
|
|
9989
10165
|
childrenConstant = childrenConstant && isConstant(child);
|
|
9990
10166
|
} else {
|
|
9991
|
-
childrenConstant = childrenConstant && child instanceof Literal;
|
|
10167
|
+
childrenConstant = childrenConstant && child instanceof Literal$1;
|
|
9992
10168
|
}
|
|
9993
10169
|
});
|
|
9994
10170
|
if (!childrenConstant) {
|
|
@@ -10024,7 +10200,7 @@ function findStopLessThanOrEqualTo(stops, input) {
|
|
|
10024
10200
|
} else if (currentValue > input) {
|
|
10025
10201
|
upperIndex = currentIndex - 1;
|
|
10026
10202
|
} else {
|
|
10027
|
-
throw new RuntimeError('Input is not a number.');
|
|
10203
|
+
throw new RuntimeError$1('Input is not a number.');
|
|
10028
10204
|
}
|
|
10029
10205
|
}
|
|
10030
10206
|
return 0;
|
|
@@ -10118,6 +10294,7 @@ class Step {
|
|
|
10118
10294
|
return serialized;
|
|
10119
10295
|
}
|
|
10120
10296
|
}
|
|
10297
|
+
var Step$1 = Step;
|
|
10121
10298
|
|
|
10122
10299
|
/*
|
|
10123
10300
|
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
|
@@ -10228,9 +10405,9 @@ function number(a, b, t) {
|
|
|
10228
10405
|
return a * (1 - t) + b * t;
|
|
10229
10406
|
}
|
|
10230
10407
|
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));
|
|
10408
|
+
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
10409
|
}
|
|
10233
|
-
function array
|
|
10410
|
+
function array(from, to, t) {
|
|
10234
10411
|
return from.map((d, i) => {
|
|
10235
10412
|
return number(d, to[i], t);
|
|
10236
10413
|
});
|
|
@@ -10240,7 +10417,7 @@ var interpolate = /*#__PURE__*/Object.freeze({
|
|
|
10240
10417
|
__proto__: null,
|
|
10241
10418
|
number: number,
|
|
10242
10419
|
color: color,
|
|
10243
|
-
array: array
|
|
10420
|
+
array: array
|
|
10244
10421
|
});
|
|
10245
10422
|
|
|
10246
10423
|
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 +10448,7 @@ function labToRgb(labColor) {
|
|
|
10271
10448
|
y = Yn * lab2xyz(y);
|
|
10272
10449
|
x = Xn * lab2xyz(x);
|
|
10273
10450
|
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);
|
|
10451
|
+
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
10452
|
}
|
|
10276
10453
|
function interpolateLab(from, to, t) {
|
|
10277
10454
|
return {
|
|
@@ -10419,7 +10596,7 @@ class Interpolate {
|
|
|
10419
10596
|
]);
|
|
10420
10597
|
}
|
|
10421
10598
|
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.`);
|
|
10599
|
+
return context.error(`Type ${ toString$1(outputType) } is not interpolatable.`);
|
|
10423
10600
|
}
|
|
10424
10601
|
return new Interpolate(outputType, operator, interpolation, input, stops);
|
|
10425
10602
|
}
|
|
@@ -10498,6 +10675,7 @@ function exponentialInterpolation(input, base, lowerValue, upperValue) {
|
|
|
10498
10675
|
return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);
|
|
10499
10676
|
}
|
|
10500
10677
|
}
|
|
10678
|
+
var Interpolate$1 = Interpolate;
|
|
10501
10679
|
|
|
10502
10680
|
class Coalesce {
|
|
10503
10681
|
constructor(type, args) {
|
|
@@ -10559,6 +10737,7 @@ class Coalesce {
|
|
|
10559
10737
|
return serialized;
|
|
10560
10738
|
}
|
|
10561
10739
|
}
|
|
10740
|
+
var Coalesce$1 = Coalesce;
|
|
10562
10741
|
|
|
10563
10742
|
class Let {
|
|
10564
10743
|
constructor(bindings, result) {
|
|
@@ -10612,6 +10791,7 @@ class Let {
|
|
|
10612
10791
|
return serialized;
|
|
10613
10792
|
}
|
|
10614
10793
|
}
|
|
10794
|
+
var Let$1 = Let;
|
|
10615
10795
|
|
|
10616
10796
|
class At {
|
|
10617
10797
|
constructor(type, index, input) {
|
|
@@ -10623,7 +10803,7 @@ class At {
|
|
|
10623
10803
|
if (args.length !== 3)
|
|
10624
10804
|
return context.error(`Expected 2 arguments, but found ${ args.length - 1 } instead.`);
|
|
10625
10805
|
const index = context.parse(args[1], 1, NumberType);
|
|
10626
|
-
const input = context.parse(args[2], 2, array(context.expectedType || ValueType));
|
|
10806
|
+
const input = context.parse(args[2], 2, array$1(context.expectedType || ValueType));
|
|
10627
10807
|
if (!index || !input)
|
|
10628
10808
|
return null;
|
|
10629
10809
|
const t = input.type;
|
|
@@ -10633,13 +10813,13 @@ class At {
|
|
|
10633
10813
|
const index = this.index.evaluate(ctx);
|
|
10634
10814
|
const array = this.input.evaluate(ctx);
|
|
10635
10815
|
if (index < 0) {
|
|
10636
|
-
throw new RuntimeError(`Array index out of bounds: ${ index } < 0.`);
|
|
10816
|
+
throw new RuntimeError$1(`Array index out of bounds: ${ index } < 0.`);
|
|
10637
10817
|
}
|
|
10638
10818
|
if (index >= array.length) {
|
|
10639
|
-
throw new RuntimeError(`Array index out of bounds: ${ index } > ${ array.length - 1 }.`);
|
|
10819
|
+
throw new RuntimeError$1(`Array index out of bounds: ${ index } > ${ array.length - 1 }.`);
|
|
10640
10820
|
}
|
|
10641
10821
|
if (index !== Math.floor(index)) {
|
|
10642
|
-
throw new RuntimeError(`Array index must be an integer, but found ${ index } instead.`);
|
|
10822
|
+
throw new RuntimeError$1(`Array index must be an integer, but found ${ index } instead.`);
|
|
10643
10823
|
}
|
|
10644
10824
|
return array[index];
|
|
10645
10825
|
}
|
|
@@ -10658,6 +10838,7 @@ class At {
|
|
|
10658
10838
|
];
|
|
10659
10839
|
}
|
|
10660
10840
|
}
|
|
10841
|
+
var At$1 = At;
|
|
10661
10842
|
|
|
10662
10843
|
class In {
|
|
10663
10844
|
constructor(needle, haystack) {
|
|
@@ -10680,7 +10861,7 @@ class In {
|
|
|
10680
10861
|
NullType,
|
|
10681
10862
|
ValueType
|
|
10682
10863
|
])) {
|
|
10683
|
-
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(needle.type) } instead`);
|
|
10864
|
+
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(needle.type) } instead`);
|
|
10684
10865
|
}
|
|
10685
10866
|
return new In(needle, haystack);
|
|
10686
10867
|
}
|
|
@@ -10695,13 +10876,13 @@ class In {
|
|
|
10695
10876
|
'number',
|
|
10696
10877
|
'null'
|
|
10697
10878
|
])) {
|
|
10698
|
-
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(typeOf(needle)) } instead.`);
|
|
10879
|
+
throw new RuntimeError$1(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
10699
10880
|
}
|
|
10700
10881
|
if (!isValidNativeType(haystack, [
|
|
10701
10882
|
'string',
|
|
10702
10883
|
'array'
|
|
10703
10884
|
])) {
|
|
10704
|
-
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString(typeOf(haystack)) } instead.`);
|
|
10885
|
+
throw new RuntimeError$1(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
10705
10886
|
}
|
|
10706
10887
|
return haystack.indexOf(needle) >= 0;
|
|
10707
10888
|
}
|
|
@@ -10720,6 +10901,7 @@ class In {
|
|
|
10720
10901
|
];
|
|
10721
10902
|
}
|
|
10722
10903
|
}
|
|
10904
|
+
var In$1 = In;
|
|
10723
10905
|
|
|
10724
10906
|
class IndexOf {
|
|
10725
10907
|
constructor(needle, haystack, fromIndex) {
|
|
@@ -10743,7 +10925,7 @@ class IndexOf {
|
|
|
10743
10925
|
NullType,
|
|
10744
10926
|
ValueType
|
|
10745
10927
|
])) {
|
|
10746
|
-
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(needle.type) } instead`);
|
|
10928
|
+
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(needle.type) } instead`);
|
|
10747
10929
|
}
|
|
10748
10930
|
if (args.length === 4) {
|
|
10749
10931
|
const fromIndex = context.parse(args[3], 3, NumberType);
|
|
@@ -10763,13 +10945,13 @@ class IndexOf {
|
|
|
10763
10945
|
'number',
|
|
10764
10946
|
'null'
|
|
10765
10947
|
])) {
|
|
10766
|
-
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(typeOf(needle)) } instead.`);
|
|
10948
|
+
throw new RuntimeError$1(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
10767
10949
|
}
|
|
10768
10950
|
if (!isValidNativeType(haystack, [
|
|
10769
10951
|
'string',
|
|
10770
10952
|
'array'
|
|
10771
10953
|
])) {
|
|
10772
|
-
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString(typeOf(haystack)) } instead.`);
|
|
10954
|
+
throw new RuntimeError$1(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
10773
10955
|
}
|
|
10774
10956
|
if (this.fromIndex) {
|
|
10775
10957
|
const fromIndex = this.fromIndex.evaluate(ctx);
|
|
@@ -10804,6 +10986,7 @@ class IndexOf {
|
|
|
10804
10986
|
];
|
|
10805
10987
|
}
|
|
10806
10988
|
}
|
|
10989
|
+
var IndexOf$1 = IndexOf;
|
|
10807
10990
|
|
|
10808
10991
|
class Match {
|
|
10809
10992
|
constructor(inputType, outputType, input, cases, outputs, otherwise) {
|
|
@@ -10916,6 +11099,7 @@ class Match {
|
|
|
10916
11099
|
return serialized;
|
|
10917
11100
|
}
|
|
10918
11101
|
}
|
|
11102
|
+
var Match$1 = Match;
|
|
10919
11103
|
|
|
10920
11104
|
class Case {
|
|
10921
11105
|
constructor(type, branches, otherwise) {
|
|
@@ -10977,6 +11161,7 @@ class Case {
|
|
|
10977
11161
|
return serialized;
|
|
10978
11162
|
}
|
|
10979
11163
|
}
|
|
11164
|
+
var Case$1 = Case;
|
|
10980
11165
|
|
|
10981
11166
|
class Slice {
|
|
10982
11167
|
constructor(type, input, beginIndex, endIndex) {
|
|
@@ -10994,11 +11179,11 @@ class Slice {
|
|
|
10994
11179
|
if (!input || !beginIndex)
|
|
10995
11180
|
return null;
|
|
10996
11181
|
if (!isValidType(input.type, [
|
|
10997
|
-
array(ValueType),
|
|
11182
|
+
array$1(ValueType),
|
|
10998
11183
|
StringType,
|
|
10999
11184
|
ValueType
|
|
11000
11185
|
])) {
|
|
11001
|
-
return context.error(`Expected first argument to be of type array or string, but found ${ toString(input.type) } instead`);
|
|
11186
|
+
return context.error(`Expected first argument to be of type array or string, but found ${ toString$1(input.type) } instead`);
|
|
11002
11187
|
}
|
|
11003
11188
|
if (args.length === 4) {
|
|
11004
11189
|
const endIndex = context.parse(args[3], 3, NumberType);
|
|
@@ -11016,7 +11201,7 @@ class Slice {
|
|
|
11016
11201
|
'string',
|
|
11017
11202
|
'array'
|
|
11018
11203
|
])) {
|
|
11019
|
-
throw new RuntimeError(`Expected first argument to be of type array or string, but found ${ toString(typeOf(input)) } instead.`);
|
|
11204
|
+
throw new RuntimeError$1(`Expected first argument to be of type array or string, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
11020
11205
|
}
|
|
11021
11206
|
if (this.endIndex) {
|
|
11022
11207
|
const endIndex = this.endIndex.evaluate(ctx);
|
|
@@ -11051,6 +11236,7 @@ class Slice {
|
|
|
11051
11236
|
];
|
|
11052
11237
|
}
|
|
11053
11238
|
}
|
|
11239
|
+
var Slice$1 = Slice;
|
|
11054
11240
|
|
|
11055
11241
|
function isComparableType(op, type) {
|
|
11056
11242
|
if (op === '==' || op === '!=') {
|
|
@@ -11113,22 +11299,22 @@ function makeComparison(op, compareBasic, compareWithCollator) {
|
|
|
11113
11299
|
if (!lhs)
|
|
11114
11300
|
return null;
|
|
11115
11301
|
if (!isComparableType(op, lhs.type)) {
|
|
11116
|
-
return context.concat(1).error(`"${ op }" comparisons are not supported for type '${ toString(lhs.type) }'.`);
|
|
11302
|
+
return context.concat(1).error(`"${ op }" comparisons are not supported for type '${ toString$1(lhs.type) }'.`);
|
|
11117
11303
|
}
|
|
11118
11304
|
let rhs = context.parse(args[2], 2, ValueType);
|
|
11119
11305
|
if (!rhs)
|
|
11120
11306
|
return null;
|
|
11121
11307
|
if (!isComparableType(op, rhs.type)) {
|
|
11122
|
-
return context.concat(2).error(`"${ op }" comparisons are not supported for type '${ toString(rhs.type) }'.`);
|
|
11308
|
+
return context.concat(2).error(`"${ op }" comparisons are not supported for type '${ toString$1(rhs.type) }'.`);
|
|
11123
11309
|
}
|
|
11124
11310
|
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) }'.`);
|
|
11311
|
+
return context.error(`Cannot compare types '${ toString$1(lhs.type) }' and '${ toString$1(rhs.type) }'.`);
|
|
11126
11312
|
}
|
|
11127
11313
|
if (isOrderComparison) {
|
|
11128
11314
|
if (lhs.type.kind === 'value' && rhs.type.kind !== 'value') {
|
|
11129
|
-
lhs = new Assertion(rhs.type, [lhs]);
|
|
11315
|
+
lhs = new Assertion$1(rhs.type, [lhs]);
|
|
11130
11316
|
} else if (lhs.type.kind !== 'value' && rhs.type.kind === 'value') {
|
|
11131
|
-
rhs = new Assertion(lhs.type, [rhs]);
|
|
11317
|
+
rhs = new Assertion$1(lhs.type, [rhs]);
|
|
11132
11318
|
}
|
|
11133
11319
|
}
|
|
11134
11320
|
let collator = null;
|
|
@@ -11149,7 +11335,7 @@ function makeComparison(op, compareBasic, compareWithCollator) {
|
|
|
11149
11335
|
const lt = typeOf(lhs);
|
|
11150
11336
|
const rt = typeOf(rhs);
|
|
11151
11337
|
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.`);
|
|
11338
|
+
throw new RuntimeError$1(`Expected arguments for "${ op }" to be (string, string) or (number, number), but found (${ lt.kind }, ${ rt.kind }) instead.`);
|
|
11153
11339
|
}
|
|
11154
11340
|
}
|
|
11155
11341
|
if (this.collator && !isOrderComparison && this.hasUntypedArgument) {
|
|
@@ -11291,7 +11477,7 @@ class Length {
|
|
|
11291
11477
|
if (!input)
|
|
11292
11478
|
return null;
|
|
11293
11479
|
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.`);
|
|
11480
|
+
return context.error(`Expected argument of type string or array, but found ${ toString$1(input.type) } instead.`);
|
|
11295
11481
|
return new Length(input);
|
|
11296
11482
|
}
|
|
11297
11483
|
evaluate(ctx) {
|
|
@@ -11301,7 +11487,7 @@ class Length {
|
|
|
11301
11487
|
} else if (Array.isArray(input)) {
|
|
11302
11488
|
return input.length;
|
|
11303
11489
|
} else {
|
|
11304
|
-
throw new RuntimeError(`Expected value to be of type string or array, but found ${ toString(typeOf(input)) } instead.`);
|
|
11490
|
+
throw new RuntimeError$1(`Expected value to be of type string or array, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
11305
11491
|
}
|
|
11306
11492
|
}
|
|
11307
11493
|
eachChild(fn) {
|
|
@@ -11318,6 +11504,7 @@ class Length {
|
|
|
11318
11504
|
return serialized;
|
|
11319
11505
|
}
|
|
11320
11506
|
}
|
|
11507
|
+
var Length$1 = Length;
|
|
11321
11508
|
|
|
11322
11509
|
const expressions = {
|
|
11323
11510
|
'==': Equals,
|
|
@@ -11326,35 +11513,35 @@ const expressions = {
|
|
|
11326
11513
|
'<': LessThan,
|
|
11327
11514
|
'>=': GreaterThanOrEqual,
|
|
11328
11515
|
'<=': LessThanOrEqual,
|
|
11329
|
-
'array': Assertion,
|
|
11330
|
-
'at': At,
|
|
11331
|
-
'boolean': Assertion,
|
|
11332
|
-
'case': Case,
|
|
11333
|
-
'coalesce': Coalesce,
|
|
11516
|
+
'array': Assertion$1,
|
|
11517
|
+
'at': At$1,
|
|
11518
|
+
'boolean': Assertion$1,
|
|
11519
|
+
'case': Case$1,
|
|
11520
|
+
'coalesce': Coalesce$1,
|
|
11334
11521
|
'collator': CollatorExpression,
|
|
11335
11522
|
'format': FormatExpression,
|
|
11336
11523
|
'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,
|
|
11524
|
+
'in': In$1,
|
|
11525
|
+
'index-of': IndexOf$1,
|
|
11526
|
+
'interpolate': Interpolate$1,
|
|
11527
|
+
'interpolate-hcl': Interpolate$1,
|
|
11528
|
+
'interpolate-lab': Interpolate$1,
|
|
11529
|
+
'length': Length$1,
|
|
11530
|
+
'let': Let$1,
|
|
11531
|
+
'literal': Literal$1,
|
|
11532
|
+
'match': Match$1,
|
|
11533
|
+
'number': Assertion$1,
|
|
11347
11534
|
'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
|
|
11535
|
+
'object': Assertion$1,
|
|
11536
|
+
'slice': Slice$1,
|
|
11537
|
+
'step': Step$1,
|
|
11538
|
+
'string': Assertion$1,
|
|
11539
|
+
'to-boolean': Coercion$1,
|
|
11540
|
+
'to-color': Coercion$1,
|
|
11541
|
+
'to-number': Coercion$1,
|
|
11542
|
+
'to-string': Coercion$1,
|
|
11543
|
+
'var': Var$1,
|
|
11544
|
+
'within': Within$1
|
|
11358
11545
|
};
|
|
11359
11546
|
function rgba(ctx, [r, g, b, a]) {
|
|
11360
11547
|
r = r.evaluate(ctx);
|
|
@@ -11363,8 +11550,8 @@ function rgba(ctx, [r, g, b, a]) {
|
|
|
11363
11550
|
const alpha = a ? a.evaluate(ctx) : 1;
|
|
11364
11551
|
const error = validateRGBA(r, g, b, alpha);
|
|
11365
11552
|
if (error)
|
|
11366
|
-
throw new RuntimeError(error);
|
|
11367
|
-
return new Color(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);
|
|
11553
|
+
throw new RuntimeError$1(error);
|
|
11554
|
+
return new Color$1(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);
|
|
11368
11555
|
}
|
|
11369
11556
|
function has(key, obj) {
|
|
11370
11557
|
return key in obj;
|
|
@@ -11388,21 +11575,21 @@ function binarySearch(v, a, i, j) {
|
|
|
11388
11575
|
function varargs(type) {
|
|
11389
11576
|
return { type };
|
|
11390
11577
|
}
|
|
11391
|
-
CompoundExpression.register(expressions, {
|
|
11578
|
+
CompoundExpression$1.register(expressions, {
|
|
11392
11579
|
'error': [
|
|
11393
11580
|
ErrorType,
|
|
11394
11581
|
[StringType],
|
|
11395
11582
|
(ctx, [v]) => {
|
|
11396
|
-
throw new RuntimeError(v.evaluate(ctx));
|
|
11583
|
+
throw new RuntimeError$1(v.evaluate(ctx));
|
|
11397
11584
|
}
|
|
11398
11585
|
],
|
|
11399
11586
|
'typeof': [
|
|
11400
11587
|
StringType,
|
|
11401
11588
|
[ValueType],
|
|
11402
|
-
(ctx, [v]) => toString(typeOf(v.evaluate(ctx)))
|
|
11589
|
+
(ctx, [v]) => toString$1(typeOf(v.evaluate(ctx)))
|
|
11403
11590
|
],
|
|
11404
11591
|
'to-rgba': [
|
|
11405
|
-
array(NumberType, 4),
|
|
11592
|
+
array$1(NumberType, 4),
|
|
11406
11593
|
[ColorType],
|
|
11407
11594
|
(ctx, [v]) => {
|
|
11408
11595
|
return v.evaluate(ctx).toArray();
|
|
@@ -11788,19 +11975,19 @@ CompoundExpression.register(expressions, {
|
|
|
11788
11975
|
],
|
|
11789
11976
|
'filter-type-in': [
|
|
11790
11977
|
BooleanType,
|
|
11791
|
-
[array(StringType)],
|
|
11978
|
+
[array$1(StringType)],
|
|
11792
11979
|
(ctx, [v]) => v.value.indexOf(ctx.geometryType()) >= 0
|
|
11793
11980
|
],
|
|
11794
11981
|
'filter-id-in': [
|
|
11795
11982
|
BooleanType,
|
|
11796
|
-
[array(ValueType)],
|
|
11983
|
+
[array$1(ValueType)],
|
|
11797
11984
|
(ctx, [v]) => v.value.indexOf(ctx.id()) >= 0
|
|
11798
11985
|
],
|
|
11799
11986
|
'filter-in-small': [
|
|
11800
11987
|
BooleanType,
|
|
11801
11988
|
[
|
|
11802
11989
|
StringType,
|
|
11803
|
-
array(ValueType)
|
|
11990
|
+
array$1(ValueType)
|
|
11804
11991
|
],
|
|
11805
11992
|
(ctx, [k, v]) => v.value.indexOf(ctx.properties()[k.value]) >= 0
|
|
11806
11993
|
],
|
|
@@ -11808,7 +11995,7 @@ CompoundExpression.register(expressions, {
|
|
|
11808
11995
|
BooleanType,
|
|
11809
11996
|
[
|
|
11810
11997
|
StringType,
|
|
11811
|
-
array(ValueType)
|
|
11998
|
+
array$1(ValueType)
|
|
11812
11999
|
],
|
|
11813
12000
|
(ctx, [k, v]) => binarySearch(ctx.properties()[k.value], v.value, 0, v.value.length - 1)
|
|
11814
12001
|
],
|
|
@@ -11885,7 +12072,7 @@ CompoundExpression.register(expressions, {
|
|
|
11885
12072
|
'concat': [
|
|
11886
12073
|
StringType,
|
|
11887
12074
|
varargs(ValueType),
|
|
11888
|
-
(ctx, args) => args.map(arg => toString
|
|
12075
|
+
(ctx, args) => args.map(arg => toString(arg.evaluate(ctx))).join('')
|
|
11889
12076
|
],
|
|
11890
12077
|
'resolved-locale': [
|
|
11891
12078
|
StringType,
|
|
@@ -11893,6 +12080,7 @@ CompoundExpression.register(expressions, {
|
|
|
11893
12080
|
(ctx, [collator]) => collator.evaluate(ctx).resolvedLocale()
|
|
11894
12081
|
]
|
|
11895
12082
|
});
|
|
12083
|
+
var definitions = expressions;
|
|
11896
12084
|
|
|
11897
12085
|
function success(value) {
|
|
11898
12086
|
return {
|
|
@@ -11933,7 +12121,7 @@ function getType(val) {
|
|
|
11933
12121
|
}
|
|
11934
12122
|
}
|
|
11935
12123
|
|
|
11936
|
-
function isFunction
|
|
12124
|
+
function isFunction(value) {
|
|
11937
12125
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
11938
12126
|
}
|
|
11939
12127
|
function identityFunction(x) {
|
|
@@ -11951,14 +12139,14 @@ function createFunction(parameters, propertySpec) {
|
|
|
11951
12139
|
parameters.stops = parameters.stops.map(stop => {
|
|
11952
12140
|
return [
|
|
11953
12141
|
stop[0],
|
|
11954
|
-
Color.parse(stop[1])
|
|
12142
|
+
Color$1.parse(stop[1])
|
|
11955
12143
|
];
|
|
11956
12144
|
});
|
|
11957
12145
|
}
|
|
11958
12146
|
if (parameters.default) {
|
|
11959
|
-
parameters.default = Color.parse(parameters.default);
|
|
12147
|
+
parameters.default = Color$1.parse(parameters.default);
|
|
11960
12148
|
} else {
|
|
11961
|
-
parameters.default = Color.parse(propertySpec.default);
|
|
12149
|
+
parameters.default = Color$1.parse(propertySpec.default);
|
|
11962
12150
|
}
|
|
11963
12151
|
}
|
|
11964
12152
|
if (parameters.colorSpace && parameters.colorSpace !== 'rgb' && !colorSpaces[parameters.colorSpace]) {
|
|
@@ -12015,7 +12203,7 @@ function createFunction(parameters, propertySpec) {
|
|
|
12015
12203
|
return {
|
|
12016
12204
|
kind: 'composite',
|
|
12017
12205
|
interpolationType,
|
|
12018
|
-
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
12206
|
+
interpolationFactor: Interpolate$1.interpolationFactor.bind(undefined, interpolationType),
|
|
12019
12207
|
zoomStops: featureFunctionStops.map(s => s[0]),
|
|
12020
12208
|
evaluate({zoom}, properties) {
|
|
12021
12209
|
return evaluateExponentialFunction({
|
|
@@ -12032,7 +12220,7 @@ function createFunction(parameters, propertySpec) {
|
|
|
12032
12220
|
return {
|
|
12033
12221
|
kind: 'camera',
|
|
12034
12222
|
interpolationType,
|
|
12035
|
-
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
12223
|
+
interpolationFactor: Interpolate$1.interpolationFactor.bind(undefined, interpolationType),
|
|
12036
12224
|
zoomStops: parameters.stops.map(s => s[0]),
|
|
12037
12225
|
evaluate: ({zoom}) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)
|
|
12038
12226
|
};
|
|
@@ -12042,14 +12230,14 @@ function createFunction(parameters, propertySpec) {
|
|
|
12042
12230
|
evaluate(_, feature) {
|
|
12043
12231
|
const value = feature && feature.properties ? feature.properties[parameters.property] : undefined;
|
|
12044
12232
|
if (value === undefined) {
|
|
12045
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12233
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12046
12234
|
}
|
|
12047
12235
|
return innerFun(parameters, propertySpec, value, hashedStops, categoricalKeyType);
|
|
12048
12236
|
}
|
|
12049
12237
|
};
|
|
12050
12238
|
}
|
|
12051
12239
|
}
|
|
12052
|
-
function coalesce(a, b, c) {
|
|
12240
|
+
function coalesce$1(a, b, c) {
|
|
12053
12241
|
if (a !== undefined)
|
|
12054
12242
|
return a;
|
|
12055
12243
|
if (b !== undefined)
|
|
@@ -12059,11 +12247,11 @@ function coalesce(a, b, c) {
|
|
|
12059
12247
|
}
|
|
12060
12248
|
function evaluateCategoricalFunction(parameters, propertySpec, input, hashedStops, keyType) {
|
|
12061
12249
|
const evaluated = typeof input === keyType ? hashedStops[input] : undefined;
|
|
12062
|
-
return coalesce(evaluated, parameters.default, propertySpec.default);
|
|
12250
|
+
return coalesce$1(evaluated, parameters.default, propertySpec.default);
|
|
12063
12251
|
}
|
|
12064
12252
|
function evaluateIntervalFunction(parameters, propertySpec, input) {
|
|
12065
12253
|
if (getType(input) !== 'number')
|
|
12066
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12254
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12067
12255
|
const n = parameters.stops.length;
|
|
12068
12256
|
if (n === 1)
|
|
12069
12257
|
return parameters.stops[0][1];
|
|
@@ -12077,7 +12265,7 @@ function evaluateIntervalFunction(parameters, propertySpec, input) {
|
|
|
12077
12265
|
function evaluateExponentialFunction(parameters, propertySpec, input) {
|
|
12078
12266
|
const base = parameters.base !== undefined ? parameters.base : 1;
|
|
12079
12267
|
if (getType(input) !== 'number')
|
|
12080
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12268
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12081
12269
|
const n = parameters.stops.length;
|
|
12082
12270
|
if (n === 1)
|
|
12083
12271
|
return parameters.stops[0][1];
|
|
@@ -12110,7 +12298,7 @@ function evaluateExponentialFunction(parameters, propertySpec, input) {
|
|
|
12110
12298
|
}
|
|
12111
12299
|
function evaluateIdentityFunction(parameters, propertySpec, input) {
|
|
12112
12300
|
if (propertySpec.type === 'color') {
|
|
12113
|
-
input = Color.parse(input);
|
|
12301
|
+
input = Color$1.parse(input);
|
|
12114
12302
|
} else if (propertySpec.type === 'formatted') {
|
|
12115
12303
|
input = Formatted.fromString(input.toString());
|
|
12116
12304
|
} else if (propertySpec.type === 'resolvedImage') {
|
|
@@ -12118,7 +12306,7 @@ function evaluateIdentityFunction(parameters, propertySpec, input) {
|
|
|
12118
12306
|
} else if (getType(input) !== propertySpec.type && (propertySpec.type !== 'enum' || !propertySpec.values[input])) {
|
|
12119
12307
|
input = undefined;
|
|
12120
12308
|
}
|
|
12121
|
-
return coalesce(input, parameters.default, propertySpec.default);
|
|
12309
|
+
return coalesce$1(input, parameters.default, propertySpec.default);
|
|
12122
12310
|
}
|
|
12123
12311
|
function interpolationFactor(input, base, lowerValue, upperValue) {
|
|
12124
12312
|
const difference = upperValue - lowerValue;
|
|
@@ -12136,7 +12324,7 @@ class StyleExpression {
|
|
|
12136
12324
|
constructor(expression, propertySpec) {
|
|
12137
12325
|
this.expression = expression;
|
|
12138
12326
|
this._warningHistory = {};
|
|
12139
|
-
this._evaluator = new EvaluationContext();
|
|
12327
|
+
this._evaluator = new EvaluationContext$1();
|
|
12140
12328
|
this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
|
|
12141
12329
|
this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;
|
|
12142
12330
|
}
|
|
@@ -12166,7 +12354,7 @@ class StyleExpression {
|
|
|
12166
12354
|
return this._defaultValue;
|
|
12167
12355
|
}
|
|
12168
12356
|
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.`);
|
|
12357
|
+
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
12358
|
}
|
|
12171
12359
|
return val;
|
|
12172
12360
|
} catch (e) {
|
|
@@ -12181,10 +12369,10 @@ class StyleExpression {
|
|
|
12181
12369
|
}
|
|
12182
12370
|
}
|
|
12183
12371
|
function isExpression(expression) {
|
|
12184
|
-
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in
|
|
12372
|
+
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in definitions;
|
|
12185
12373
|
}
|
|
12186
12374
|
function createExpression(expression, propertySpec) {
|
|
12187
|
-
const parser = new ParsingContext(
|
|
12375
|
+
const parser = new ParsingContext$1(definitions, [], propertySpec ? getExpectedType(propertySpec) : undefined);
|
|
12188
12376
|
const parsed = parser.parse(expression, undefined, undefined, undefined, propertySpec && propertySpec.type === 'string' ? { typeAnnotation: 'coerce' } : undefined);
|
|
12189
12377
|
if (!parsed) {
|
|
12190
12378
|
return error(parser.errors);
|
|
@@ -12220,7 +12408,7 @@ class ZoomDependentExpression {
|
|
|
12220
12408
|
}
|
|
12221
12409
|
interpolationFactor(input, lower, upper) {
|
|
12222
12410
|
if (this.interpolationType) {
|
|
12223
|
-
return Interpolate.interpolationFactor(this.interpolationType, input, lower, upper);
|
|
12411
|
+
return Interpolate$1.interpolationFactor(this.interpolationType, input, lower, upper);
|
|
12224
12412
|
} else {
|
|
12225
12413
|
return 0;
|
|
12226
12414
|
}
|
|
@@ -12234,7 +12422,7 @@ function createPropertyExpression(expression, propertySpec) {
|
|
|
12234
12422
|
const parsed = expression.value.expression;
|
|
12235
12423
|
const isFeatureConstant$1 = isFeatureConstant(parsed);
|
|
12236
12424
|
if (!isFeatureConstant$1 && !supportsPropertyExpression(propertySpec)) {
|
|
12237
|
-
return error([new ParsingError('', 'data expressions not supported')]);
|
|
12425
|
+
return error([new ParsingError$2('', 'data expressions not supported')]);
|
|
12238
12426
|
}
|
|
12239
12427
|
const isZoomConstant = isGlobalPropertyConstant(parsed, [
|
|
12240
12428
|
'zoom',
|
|
@@ -12242,20 +12430,20 @@ function createPropertyExpression(expression, propertySpec) {
|
|
|
12242
12430
|
'distance-from-center'
|
|
12243
12431
|
]);
|
|
12244
12432
|
if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {
|
|
12245
|
-
return error([new ParsingError('', 'zoom expressions not supported')]);
|
|
12433
|
+
return error([new ParsingError$2('', 'zoom expressions not supported')]);
|
|
12246
12434
|
}
|
|
12247
12435
|
const zoomCurve = findZoomCurve(parsed);
|
|
12248
12436
|
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) {
|
|
12437
|
+
return error([new ParsingError$2('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);
|
|
12438
|
+
} else if (zoomCurve instanceof ParsingError$2) {
|
|
12251
12439
|
return error([zoomCurve]);
|
|
12252
|
-
} else if (zoomCurve instanceof Interpolate && !supportsInterpolation(propertySpec)) {
|
|
12253
|
-
return error([new ParsingError('', '"interpolate" expressions cannot be used with this property')]);
|
|
12440
|
+
} else if (zoomCurve instanceof Interpolate$1 && !supportsInterpolation(propertySpec)) {
|
|
12441
|
+
return error([new ParsingError$2('', '"interpolate" expressions cannot be used with this property')]);
|
|
12254
12442
|
}
|
|
12255
12443
|
if (!zoomCurve) {
|
|
12256
12444
|
return success(isFeatureConstant$1 ? new ZoomConstantExpression('constant', expression.value) : new ZoomConstantExpression('source', expression.value));
|
|
12257
12445
|
}
|
|
12258
|
-
const interpolationType = zoomCurve instanceof Interpolate ? zoomCurve.interpolation : undefined;
|
|
12446
|
+
const interpolationType = zoomCurve instanceof Interpolate$1 ? zoomCurve.interpolation : undefined;
|
|
12259
12447
|
return success(isFeatureConstant$1 ? new ZoomDependentExpression('camera', expression.value, zoomCurve.labels, interpolationType) : new ZoomDependentExpression('composite', expression.value, zoomCurve.labels, interpolationType));
|
|
12260
12448
|
}
|
|
12261
12449
|
class StylePropertyFunction {
|
|
@@ -12275,7 +12463,7 @@ class StylePropertyFunction {
|
|
|
12275
12463
|
}
|
|
12276
12464
|
}
|
|
12277
12465
|
function normalizePropertyExpression(value, specification) {
|
|
12278
|
-
if (isFunction
|
|
12466
|
+
if (isFunction(value)) {
|
|
12279
12467
|
return new StylePropertyFunction(value, specification);
|
|
12280
12468
|
} else if (isExpression(value)) {
|
|
12281
12469
|
const expression = createPropertyExpression(value, specification);
|
|
@@ -12286,7 +12474,7 @@ function normalizePropertyExpression(value, specification) {
|
|
|
12286
12474
|
} else {
|
|
12287
12475
|
let constant = value;
|
|
12288
12476
|
if (typeof value === 'string' && specification.type === 'color') {
|
|
12289
|
-
constant = Color.parse(value);
|
|
12477
|
+
constant = Color$1.parse(value);
|
|
12290
12478
|
}
|
|
12291
12479
|
return {
|
|
12292
12480
|
kind: 'constant',
|
|
@@ -12296,29 +12484,29 @@ function normalizePropertyExpression(value, specification) {
|
|
|
12296
12484
|
}
|
|
12297
12485
|
function findZoomCurve(expression) {
|
|
12298
12486
|
let result = null;
|
|
12299
|
-
if (expression instanceof Let) {
|
|
12487
|
+
if (expression instanceof Let$1) {
|
|
12300
12488
|
result = findZoomCurve(expression.result);
|
|
12301
|
-
} else if (expression instanceof Coalesce) {
|
|
12489
|
+
} else if (expression instanceof Coalesce$1) {
|
|
12302
12490
|
for (const arg of expression.args) {
|
|
12303
12491
|
result = findZoomCurve(arg);
|
|
12304
12492
|
if (result) {
|
|
12305
12493
|
break;
|
|
12306
12494
|
}
|
|
12307
12495
|
}
|
|
12308
|
-
} else if ((expression instanceof Step || expression instanceof Interpolate) && expression.input instanceof CompoundExpression && expression.input.name === 'zoom') {
|
|
12496
|
+
} else if ((expression instanceof Step$1 || expression instanceof Interpolate$1) && expression.input instanceof CompoundExpression$1 && expression.input.name === 'zoom') {
|
|
12309
12497
|
result = expression;
|
|
12310
12498
|
}
|
|
12311
|
-
if (result instanceof ParsingError) {
|
|
12499
|
+
if (result instanceof ParsingError$2) {
|
|
12312
12500
|
return result;
|
|
12313
12501
|
}
|
|
12314
12502
|
expression.eachChild(child => {
|
|
12315
12503
|
const childResult = findZoomCurve(child);
|
|
12316
|
-
if (childResult instanceof ParsingError) {
|
|
12504
|
+
if (childResult instanceof ParsingError$2) {
|
|
12317
12505
|
result = childResult;
|
|
12318
12506
|
} else if (!result && childResult) {
|
|
12319
|
-
result = new ParsingError('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.');
|
|
12507
|
+
result = new ParsingError$2('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.');
|
|
12320
12508
|
} else if (result && childResult && result !== childResult) {
|
|
12321
|
-
result = new ParsingError('', 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.');
|
|
12509
|
+
result = new ParsingError$2('', 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.');
|
|
12322
12510
|
}
|
|
12323
12511
|
});
|
|
12324
12512
|
return result;
|
|
@@ -12334,15 +12522,15 @@ function getExpectedType(spec) {
|
|
|
12334
12522
|
resolvedImage: ResolvedImageType
|
|
12335
12523
|
};
|
|
12336
12524
|
if (spec.type === 'array') {
|
|
12337
|
-
return array(types[spec.value] || ValueType, spec.length);
|
|
12525
|
+
return array$1(types[spec.value] || ValueType, spec.length);
|
|
12338
12526
|
}
|
|
12339
12527
|
return types[spec.type];
|
|
12340
12528
|
}
|
|
12341
12529
|
function getDefaultValue(spec) {
|
|
12342
|
-
if (spec.type === 'color' && isFunction
|
|
12343
|
-
return new Color(0, 0, 0, 0);
|
|
12530
|
+
if (spec.type === 'color' && (isFunction(spec.default) || Array.isArray(spec.default))) {
|
|
12531
|
+
return new Color$1(0, 0, 0, 0);
|
|
12344
12532
|
} else if (spec.type === 'color') {
|
|
12345
|
-
return Color.parse(spec.default) || null;
|
|
12533
|
+
return Color$1.parse(spec.default) || null;
|
|
12346
12534
|
} else if (spec.default === undefined) {
|
|
12347
12535
|
return null;
|
|
12348
12536
|
} else {
|
|
@@ -12471,14 +12659,14 @@ function convertZoomAndPropertyFunction(parameters, propertySpec, stops) {
|
|
|
12471
12659
|
return expression;
|
|
12472
12660
|
}
|
|
12473
12661
|
}
|
|
12474
|
-
function coalesce
|
|
12662
|
+
function coalesce(a, b) {
|
|
12475
12663
|
if (a !== undefined)
|
|
12476
12664
|
return a;
|
|
12477
12665
|
if (b !== undefined)
|
|
12478
12666
|
return b;
|
|
12479
12667
|
}
|
|
12480
12668
|
function getFallback(parameters, propertySpec) {
|
|
12481
|
-
const defaultValue = convertLiteral(coalesce
|
|
12669
|
+
const defaultValue = convertLiteral(coalesce(parameters.default, propertySpec.default));
|
|
12482
12670
|
if (defaultValue === undefined && propertySpec.type === 'resolvedImage') {
|
|
12483
12671
|
return '';
|
|
12484
12672
|
}
|
|
@@ -12712,7 +12900,7 @@ function createFilter(filter, layerType = 'fill') {
|
|
|
12712
12900
|
};
|
|
12713
12901
|
}
|
|
12714
12902
|
if (!isExpressionFilter(filter)) {
|
|
12715
|
-
filter = convertFilter(filter);
|
|
12903
|
+
filter = convertFilter$1(filter);
|
|
12716
12904
|
}
|
|
12717
12905
|
const filterExp = filter;
|
|
12718
12906
|
let staticFilter = true;
|
|
@@ -12857,16 +13045,16 @@ function geometryNeeded(filter) {
|
|
|
12857
13045
|
}
|
|
12858
13046
|
return false;
|
|
12859
13047
|
}
|
|
12860
|
-
function convertFilter(filter) {
|
|
13048
|
+
function convertFilter$1(filter) {
|
|
12861
13049
|
if (!filter)
|
|
12862
13050
|
return true;
|
|
12863
13051
|
const op = filter[0];
|
|
12864
13052
|
if (filter.length <= 1)
|
|
12865
13053
|
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;
|
|
13054
|
+
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
13055
|
return converted;
|
|
12868
13056
|
}
|
|
12869
|
-
function convertComparisonOp(property, value, op) {
|
|
13057
|
+
function convertComparisonOp$1(property, value, op) {
|
|
12870
13058
|
switch (property) {
|
|
12871
13059
|
case '$type':
|
|
12872
13060
|
return [
|
|
@@ -12887,9 +13075,9 @@ function convertComparisonOp(property, value, op) {
|
|
|
12887
13075
|
}
|
|
12888
13076
|
}
|
|
12889
13077
|
function convertDisjunctionOp(filters) {
|
|
12890
|
-
return ['any'].concat(filters.map(convertFilter));
|
|
13078
|
+
return ['any'].concat(filters.map(convertFilter$1));
|
|
12891
13079
|
}
|
|
12892
|
-
function convertInOp(property, values) {
|
|
13080
|
+
function convertInOp$1(property, values) {
|
|
12893
13081
|
if (values.length === 0) {
|
|
12894
13082
|
return false;
|
|
12895
13083
|
}
|
|
@@ -12932,7 +13120,7 @@ function convertInOp(property, values) {
|
|
|
12932
13120
|
}
|
|
12933
13121
|
}
|
|
12934
13122
|
}
|
|
12935
|
-
function convertHasOp(property) {
|
|
13123
|
+
function convertHasOp$1(property) {
|
|
12936
13124
|
switch (property) {
|
|
12937
13125
|
case '$type':
|
|
12938
13126
|
return true;
|
|
@@ -12952,7 +13140,7 @@ function convertNegation(filter) {
|
|
|
12952
13140
|
];
|
|
12953
13141
|
}
|
|
12954
13142
|
|
|
12955
|
-
function convertFilter
|
|
13143
|
+
function convertFilter(filter) {
|
|
12956
13144
|
return _convertFilter(filter, {});
|
|
12957
13145
|
}
|
|
12958
13146
|
function _convertFilter(filter, expectedTypes) {
|
|
@@ -12967,7 +13155,7 @@ function _convertFilter(filter, expectedTypes) {
|
|
|
12967
13155
|
let converted;
|
|
12968
13156
|
if (op === '==' || op === '!=' || op === '<' || op === '>' || op === '<=' || op === '>=') {
|
|
12969
13157
|
const [, property, value] = filter;
|
|
12970
|
-
converted = convertComparisonOp
|
|
13158
|
+
converted = convertComparisonOp(property, value, op, expectedTypes);
|
|
12971
13159
|
} else if (op === 'any') {
|
|
12972
13160
|
const children = filter.slice(1).map(f => {
|
|
12973
13161
|
const types = {};
|
|
@@ -12990,15 +13178,15 @@ function _convertFilter(filter, expectedTypes) {
|
|
|
12990
13178
|
_convertFilter(['any'].concat(filter.slice(1)), {})
|
|
12991
13179
|
];
|
|
12992
13180
|
} else if (op === 'in') {
|
|
12993
|
-
converted = convertInOp
|
|
13181
|
+
converted = convertInOp(filter[1], filter.slice(2));
|
|
12994
13182
|
} else if (op === '!in') {
|
|
12995
|
-
converted = convertInOp
|
|
13183
|
+
converted = convertInOp(filter[1], filter.slice(2), true);
|
|
12996
13184
|
} else if (op === 'has') {
|
|
12997
|
-
converted = convertHasOp
|
|
13185
|
+
converted = convertHasOp(filter[1]);
|
|
12998
13186
|
} else if (op === '!has') {
|
|
12999
13187
|
converted = [
|
|
13000
13188
|
'!',
|
|
13001
|
-
convertHasOp
|
|
13189
|
+
convertHasOp(filter[1])
|
|
13002
13190
|
];
|
|
13003
13191
|
} else {
|
|
13004
13192
|
converted = true;
|
|
@@ -13027,7 +13215,7 @@ function runtimeTypeChecks(expectedTypes) {
|
|
|
13027
13215
|
return conditions[0];
|
|
13028
13216
|
return ['all'].concat(conditions);
|
|
13029
13217
|
}
|
|
13030
|
-
function convertComparisonOp
|
|
13218
|
+
function convertComparisonOp(property, value, op, expectedTypes) {
|
|
13031
13219
|
let get;
|
|
13032
13220
|
if (property === '$type') {
|
|
13033
13221
|
return [
|
|
@@ -13083,7 +13271,7 @@ function convertComparisonOp$1(property, value, op, expectedTypes) {
|
|
|
13083
13271
|
value
|
|
13084
13272
|
];
|
|
13085
13273
|
}
|
|
13086
|
-
function convertInOp
|
|
13274
|
+
function convertInOp(property, values, negate = false) {
|
|
13087
13275
|
if (values.length === 0)
|
|
13088
13276
|
return negate;
|
|
13089
13277
|
let get;
|
|
@@ -13121,7 +13309,7 @@ function convertInOp$1(property, values, negate = false) {
|
|
|
13121
13309
|
v
|
|
13122
13310
|
]));
|
|
13123
13311
|
}
|
|
13124
|
-
function convertHasOp
|
|
13312
|
+
function convertHasOp(property) {
|
|
13125
13313
|
if (property === '$type') {
|
|
13126
13314
|
return true;
|
|
13127
13315
|
} else if (property === '$id') {
|
|
@@ -13142,7 +13330,7 @@ function migrateToExpressions (style) {
|
|
|
13142
13330
|
const converted = [];
|
|
13143
13331
|
eachLayer(style, layer => {
|
|
13144
13332
|
if (layer.filter) {
|
|
13145
|
-
layer.filter = convertFilter
|
|
13333
|
+
layer.filter = convertFilter(layer.filter);
|
|
13146
13334
|
}
|
|
13147
13335
|
});
|
|
13148
13336
|
eachProperty(style, {
|
|
@@ -13669,7 +13857,7 @@ class ValidationError {
|
|
|
13669
13857
|
}
|
|
13670
13858
|
}
|
|
13671
13859
|
|
|
13672
|
-
class ParsingError
|
|
13860
|
+
class ParsingError {
|
|
13673
13861
|
constructor(error) {
|
|
13674
13862
|
this.error = error;
|
|
13675
13863
|
this.message = error.message;
|
|
@@ -14020,7 +14208,7 @@ function disallowedFilterParameters(e, options) {
|
|
|
14020
14208
|
return [];
|
|
14021
14209
|
}
|
|
14022
14210
|
const errors = [];
|
|
14023
|
-
if (e instanceof CompoundExpression) {
|
|
14211
|
+
if (e instanceof CompoundExpression$1) {
|
|
14024
14212
|
if (disallowedParameters.has(e.name)) {
|
|
14025
14213
|
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
14214
|
}
|
|
@@ -14202,7 +14390,7 @@ function validateProperty(options, propertyType) {
|
|
|
14202
14390
|
if (propertyKey === 'text-field' && style && !style.glyphs) {
|
|
14203
14391
|
errors.push(new ValidationError(key, value, 'use of "text-field" requires a style "glyphs" property'));
|
|
14204
14392
|
}
|
|
14205
|
-
if (propertyKey === 'text-font' && isFunction
|
|
14393
|
+
if (propertyKey === 'text-font' && isFunction(deepUnbundle(value)) && unbundle(value.type) === 'identity') {
|
|
14206
14394
|
errors.push(new ValidationError(key, value, '"text-font" does not support identity functions'));
|
|
14207
14395
|
}
|
|
14208
14396
|
}
|
|
@@ -14289,6 +14477,8 @@ function validateLayer(options) {
|
|
|
14289
14477
|
errors.push(new ValidationError(key, layer.source, 'raster-dem source can only be used with layer type \'hillshade\'.'));
|
|
14290
14478
|
} else if (type === 'line' && layer.paint && layer.paint['line-gradient'] && (sourceType !== 'geojson' || !source.lineMetrics)) {
|
|
14291
14479
|
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`));
|
|
14480
|
+
} else if (type === 'line' && layer.paint && layer.paint['line-trim-offset'] && !layer.paint['line-gradient']) {
|
|
14481
|
+
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-trim-offset, which requires line-gradient enabled.`));
|
|
14292
14482
|
}
|
|
14293
14483
|
}
|
|
14294
14484
|
}
|
|
@@ -14662,7 +14852,7 @@ function validate(options) {
|
|
|
14662
14852
|
const value = options.value;
|
|
14663
14853
|
const valueSpec = options.valueSpec;
|
|
14664
14854
|
const styleSpec = options.styleSpec;
|
|
14665
|
-
if (valueSpec.expression && isFunction
|
|
14855
|
+
if (valueSpec.expression && isFunction(unbundle(value))) {
|
|
14666
14856
|
return validateFunction(options);
|
|
14667
14857
|
} else if (valueSpec.expression && isExpression(deepUnbundle(value))) {
|
|
14668
14858
|
return validateExpression(options);
|
|
@@ -14689,7 +14879,7 @@ function validateGlyphsURL (options) {
|
|
|
14689
14879
|
return errors;
|
|
14690
14880
|
}
|
|
14691
14881
|
|
|
14692
|
-
function validateStyle(style, styleSpec = v8) {
|
|
14882
|
+
function validateStyle$1(style, styleSpec = v8) {
|
|
14693
14883
|
const errors = validate({
|
|
14694
14884
|
key: '',
|
|
14695
14885
|
value: style,
|
|
@@ -15366,25 +15556,27 @@ exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
|
|
15366
15556
|
}
|
|
15367
15557
|
});
|
|
15368
15558
|
|
|
15559
|
+
var jsonlint$1 = jsonlint;
|
|
15560
|
+
|
|
15369
15561
|
function readStyle(style) {
|
|
15370
15562
|
if (style instanceof String || typeof style === 'string' || style instanceof Buffer) {
|
|
15371
15563
|
try {
|
|
15372
|
-
return jsonlint.parse(style.toString());
|
|
15564
|
+
return jsonlint$1.parse(style.toString());
|
|
15373
15565
|
} catch (e) {
|
|
15374
|
-
throw new ParsingError
|
|
15566
|
+
throw new ParsingError(e);
|
|
15375
15567
|
}
|
|
15376
15568
|
}
|
|
15377
15569
|
return style;
|
|
15378
15570
|
}
|
|
15379
15571
|
|
|
15380
|
-
function validateStyle
|
|
15572
|
+
function validateStyle(style, styleSpec = v8) {
|
|
15381
15573
|
let s = style;
|
|
15382
15574
|
try {
|
|
15383
15575
|
s = readStyle(s);
|
|
15384
15576
|
} catch (e) {
|
|
15385
15577
|
return [e];
|
|
15386
15578
|
}
|
|
15387
|
-
return validateStyle(s, styleSpec);
|
|
15579
|
+
return validateStyle$1(s, styleSpec);
|
|
15388
15580
|
}
|
|
15389
15581
|
|
|
15390
15582
|
const SUPPORTED_SPEC_VERSION = 8;
|
|
@@ -15493,14 +15685,14 @@ function validateMapboxApiSupported(style) {
|
|
|
15493
15685
|
} catch (e) {
|
|
15494
15686
|
return [e];
|
|
15495
15687
|
}
|
|
15496
|
-
let errors = validateStyle(s, v8).concat(getRootErrors(s, Object.keys(v8.$root)));
|
|
15688
|
+
let errors = validateStyle$1(s, v8).concat(getRootErrors(s, Object.keys(v8.$root)));
|
|
15497
15689
|
if (s.sources) {
|
|
15498
15690
|
errors = errors.concat(getSourcesErrors(s.sources));
|
|
15499
15691
|
}
|
|
15500
15692
|
return errors;
|
|
15501
15693
|
}
|
|
15502
15694
|
|
|
15503
|
-
const expression
|
|
15695
|
+
const expression = {
|
|
15504
15696
|
StyleExpression,
|
|
15505
15697
|
isExpression,
|
|
15506
15698
|
isExpressionFilter,
|
|
@@ -15514,7 +15706,7 @@ const expression$1 = {
|
|
|
15514
15706
|
const styleFunction = {
|
|
15515
15707
|
convertFunction,
|
|
15516
15708
|
createFunction,
|
|
15517
|
-
isFunction
|
|
15709
|
+
isFunction
|
|
15518
15710
|
};
|
|
15519
15711
|
const visit = {
|
|
15520
15712
|
eachSource,
|
|
@@ -15522,5 +15714,5 @@ const visit = {
|
|
|
15522
15714
|
eachProperty
|
|
15523
15715
|
};
|
|
15524
15716
|
|
|
15525
|
-
export { Color
|
|
15717
|
+
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
15718
|
//# sourceMappingURL=index.es.js.map
|