@mapbox/mapbox-gl-style-spec 13.24.0-alpha.6 → 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/.eslintrc +10 -0
- package/CHANGELOG.md +23 -4
- package/bin/gl-style-composite.js +6 -2
- package/bin/gl-style-format.js +6 -2
- package/bin/gl-style-migrate.js +6 -2
- package/bin/gl-style-validate.js +5 -1
- package/dist/index.cjs +435 -225
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +427 -217
- package/dist/index.es.js.map +1 -1
- package/expression/compound_expression.js +2 -2
- package/expression/definitions/assertion.js +3 -3
- package/expression/definitions/at.js +5 -5
- package/expression/definitions/case.js +4 -4
- package/expression/definitions/coalesce.js +4 -4
- package/expression/definitions/coercion.js +3 -3
- package/expression/definitions/collator.js +4 -4
- package/expression/definitions/comparison.js +22 -22
- package/expression/definitions/format.js +4 -4
- package/expression/definitions/image.js +4 -4
- package/expression/definitions/in.js +5 -5
- package/expression/definitions/index_of.js +5 -5
- package/expression/definitions/interpolate.js +6 -5
- package/expression/definitions/length.js +5 -5
- package/expression/definitions/let.js +5 -5
- package/expression/definitions/literal.js +5 -5
- package/expression/definitions/match.js +4 -4
- package/expression/definitions/number_format.js +4 -4
- package/expression/definitions/slice.js +5 -5
- package/expression/definitions/step.js +4 -4
- package/expression/definitions/var.js +4 -4
- package/expression/definitions/within.js +16 -8
- package/expression/evaluation_context.js +8 -8
- package/expression/expression.js +1 -1
- package/expression/index.js +5 -5
- package/expression/is_constant.js +3 -3
- package/expression/parsing_context.js +1 -1
- package/expression/runtime_error.js +1 -1
- package/expression/scope.js +1 -1
- package/expression/stops.js +1 -1
- package/expression/values.js +1 -1
- package/feature_filter/index.js +1 -1
- package/flow-typed/gl-matrix.js +8 -1
- package/function/convert.js +4 -4
- package/migrate/expressions.js +1 -1
- package/package.json +1 -1
- package/reference/latest.js +4 -0
- package/reference/v8.json +144 -7
- package/types.js +6 -2
- package/util/color.js +35 -0
- package/validate/validate.js +13 -1
- package/validate/validate_array.js +10 -2
- package/validate/validate_boolean.js +4 -1
- package/validate/validate_color.js +4 -1
- package/validate/validate_enum.js +4 -1
- package/validate/validate_expression.js +5 -2
- package/validate/validate_filter.js +12 -4
- package/validate/validate_fog.js +4 -1
- package/validate/validate_formatted.js +5 -1
- package/validate/validate_function.js +24 -15
- package/validate/validate_glyphs_url.js +4 -1
- package/validate/validate_image.js +5 -1
- package/validate/validate_layer.js +17 -2
- package/validate/validate_layout_property.js +5 -1
- package/validate/validate_light.js +4 -1
- package/validate/validate_number.js +8 -1
- package/validate/validate_object.js +12 -2
- package/validate/validate_paint_property.js +5 -1
- package/validate/validate_projection.js +5 -1
- package/validate/validate_property.js +9 -1
- package/validate/validate_source.js +4 -1
- package/validate/validate_string.js +4 -1
- package/validate/validate_terrain.js +5 -2
- package/validate_style.min.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,
|
|
@@ -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
|
}
|
|
@@ -4008,6 +4112,9 @@ var terrain = {
|
|
|
4008
4112
|
},
|
|
4009
4113
|
transition: true,
|
|
4010
4114
|
doc: "Exaggerates the elevation of the terrain by multiplying the data from the DEM with this value.",
|
|
4115
|
+
requires: [
|
|
4116
|
+
"source"
|
|
4117
|
+
],
|
|
4011
4118
|
"sdk-support": {
|
|
4012
4119
|
"basic functionality": {
|
|
4013
4120
|
js: "2.0.0",
|
|
@@ -4575,6 +4682,35 @@ var paint_line = {
|
|
|
4575
4682
|
]
|
|
4576
4683
|
},
|
|
4577
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"
|
|
4578
4714
|
}
|
|
4579
4715
|
};
|
|
4580
4716
|
var paint_circle = {
|
|
@@ -6320,7 +6456,7 @@ var v8 = {
|
|
|
6320
6456
|
}
|
|
6321
6457
|
},
|
|
6322
6458
|
function_stop: function_stop,
|
|
6323
|
-
expression: expression,
|
|
6459
|
+
expression: expression$1,
|
|
6324
6460
|
expression_name: expression_name,
|
|
6325
6461
|
fog: fog,
|
|
6326
6462
|
light: light,
|
|
@@ -6694,6 +6830,8 @@ var jsonStringifyPrettyCompact = function stringify(passedObj, options) {
|
|
|
6694
6830
|
})(passedObj, "", 0);
|
|
6695
6831
|
};
|
|
6696
6832
|
|
|
6833
|
+
var stringifyPretty = jsonStringifyPrettyCompact;
|
|
6834
|
+
|
|
6697
6835
|
function sortKeysBy(obj, reference) {
|
|
6698
6836
|
const result = {};
|
|
6699
6837
|
for (const key in reference) {
|
|
@@ -6708,12 +6846,12 @@ function sortKeysBy(obj, reference) {
|
|
|
6708
6846
|
}
|
|
6709
6847
|
return result;
|
|
6710
6848
|
}
|
|
6711
|
-
function format(style, space = 2) {
|
|
6849
|
+
function format$1(style, space = 2) {
|
|
6712
6850
|
style = sortKeysBy(style, v8.$root);
|
|
6713
6851
|
if (style.layers) {
|
|
6714
6852
|
style.layers = style.layers.map(layer => sortKeysBy(layer, v8.layer));
|
|
6715
6853
|
}
|
|
6716
|
-
return
|
|
6854
|
+
return stringifyPretty(style, { indent: space });
|
|
6717
6855
|
}
|
|
6718
6856
|
|
|
6719
6857
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -7381,7 +7519,7 @@ exports.encode = exports.stringify = encode;
|
|
|
7381
7519
|
var parse = urlParse;
|
|
7382
7520
|
var resolve = urlResolve;
|
|
7383
7521
|
var resolveObject = urlResolveObject;
|
|
7384
|
-
var format
|
|
7522
|
+
var format = urlFormat;
|
|
7385
7523
|
|
|
7386
7524
|
var Url_1 = Url;
|
|
7387
7525
|
|
|
@@ -8088,7 +8226,7 @@ var url = {
|
|
|
8088
8226
|
parse: parse,
|
|
8089
8227
|
resolve: resolve,
|
|
8090
8228
|
resolveObject: resolveObject,
|
|
8091
|
-
format: format
|
|
8229
|
+
format: format,
|
|
8092
8230
|
Url: Url_1
|
|
8093
8231
|
};
|
|
8094
8232
|
|
|
@@ -8169,7 +8307,7 @@ function resolveConstant(style, value) {
|
|
|
8169
8307
|
return value;
|
|
8170
8308
|
}
|
|
8171
8309
|
}
|
|
8172
|
-
function isFunction(value) {
|
|
8310
|
+
function isFunction$1(value) {
|
|
8173
8311
|
return Array.isArray(value.stops);
|
|
8174
8312
|
}
|
|
8175
8313
|
function renameProperty(obj, from, to) {
|
|
@@ -8211,7 +8349,7 @@ function migrateToV8 (style) {
|
|
|
8211
8349
|
layout: true
|
|
8212
8350
|
}, property => {
|
|
8213
8351
|
const value = resolveConstant(style, property.value);
|
|
8214
|
-
if (isFunction(value)) {
|
|
8352
|
+
if (isFunction$1(value)) {
|
|
8215
8353
|
value.stops.forEach(stop => {
|
|
8216
8354
|
stop[1] = resolveConstant(style, stop[1]);
|
|
8217
8355
|
});
|
|
@@ -8302,13 +8440,14 @@ function extend (output, ...inputs) {
|
|
|
8302
8440
|
return output;
|
|
8303
8441
|
}
|
|
8304
8442
|
|
|
8305
|
-
class ParsingError extends Error {
|
|
8443
|
+
class ParsingError$1 extends Error {
|
|
8306
8444
|
constructor(key, message) {
|
|
8307
8445
|
super(message);
|
|
8308
8446
|
this.message = message;
|
|
8309
8447
|
this.key = key;
|
|
8310
8448
|
}
|
|
8311
8449
|
}
|
|
8450
|
+
var ParsingError$2 = ParsingError$1;
|
|
8312
8451
|
|
|
8313
8452
|
class Scope {
|
|
8314
8453
|
constructor(parent, bindings = []) {
|
|
@@ -8336,6 +8475,7 @@ class Scope {
|
|
|
8336
8475
|
return this.parent ? this.parent.has(name) : false;
|
|
8337
8476
|
}
|
|
8338
8477
|
}
|
|
8478
|
+
var Scope$1 = Scope;
|
|
8339
8479
|
|
|
8340
8480
|
const NullType = { kind: 'null' };
|
|
8341
8481
|
const NumberType = { kind: 'number' };
|
|
@@ -8348,16 +8488,16 @@ const ErrorType = { kind: 'error' };
|
|
|
8348
8488
|
const CollatorType = { kind: 'collator' };
|
|
8349
8489
|
const FormattedType = { kind: 'formatted' };
|
|
8350
8490
|
const ResolvedImageType = { kind: 'resolvedImage' };
|
|
8351
|
-
function array(itemType, N) {
|
|
8491
|
+
function array$1(itemType, N) {
|
|
8352
8492
|
return {
|
|
8353
8493
|
kind: 'array',
|
|
8354
8494
|
itemType,
|
|
8355
8495
|
N
|
|
8356
8496
|
};
|
|
8357
8497
|
}
|
|
8358
|
-
function toString(type) {
|
|
8498
|
+
function toString$1(type) {
|
|
8359
8499
|
if (type.kind === 'array') {
|
|
8360
|
-
const itemType = toString(type.itemType);
|
|
8500
|
+
const itemType = toString$1(type.itemType);
|
|
8361
8501
|
return typeof type.N === 'number' ? `array<${ itemType }, ${ type.N }>` : type.itemType.kind === 'value' ? 'array' : `array<${ itemType }>`;
|
|
8362
8502
|
} else {
|
|
8363
8503
|
return type.kind;
|
|
@@ -8371,7 +8511,7 @@ const valueMemberTypes = [
|
|
|
8371
8511
|
ColorType,
|
|
8372
8512
|
FormattedType,
|
|
8373
8513
|
ObjectType,
|
|
8374
|
-
array(ValueType),
|
|
8514
|
+
array$1(ValueType),
|
|
8375
8515
|
ResolvedImageType
|
|
8376
8516
|
];
|
|
8377
8517
|
function checkSubtype(expected, t) {
|
|
@@ -8390,7 +8530,7 @@ function checkSubtype(expected, t) {
|
|
|
8390
8530
|
}
|
|
8391
8531
|
}
|
|
8392
8532
|
}
|
|
8393
|
-
return `Expected ${ toString(expected) } but found ${ toString(t) } instead.`;
|
|
8533
|
+
return `Expected ${ toString$1(expected) } but found ${ toString$1(t) } instead.`;
|
|
8394
8534
|
}
|
|
8395
8535
|
function isValidType(provided, allowedTypes) {
|
|
8396
8536
|
return allowedTypes.some(t => t.kind === provided.kind);
|
|
@@ -8654,12 +8794,36 @@ class Color {
|
|
|
8654
8794
|
a
|
|
8655
8795
|
];
|
|
8656
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
|
+
}
|
|
8657
8820
|
}
|
|
8658
8821
|
Color.black = new Color(0, 0, 0, 1);
|
|
8659
8822
|
Color.white = new Color(1, 1, 1, 1);
|
|
8660
8823
|
Color.transparent = new Color(0, 0, 0, 0);
|
|
8661
8824
|
Color.red = new Color(1, 0, 0, 1);
|
|
8662
8825
|
Color.blue = new Color(0, 0, 1, 1);
|
|
8826
|
+
var Color$1 = Color;
|
|
8663
8827
|
|
|
8664
8828
|
class Collator {
|
|
8665
8829
|
constructor(caseSensitive, diacriticSensitive, locale) {
|
|
@@ -8801,7 +8965,7 @@ function isValue(mixed) {
|
|
|
8801
8965
|
return true;
|
|
8802
8966
|
} else if (typeof mixed === 'number') {
|
|
8803
8967
|
return true;
|
|
8804
|
-
} else if (mixed instanceof Color) {
|
|
8968
|
+
} else if (mixed instanceof Color$1) {
|
|
8805
8969
|
return true;
|
|
8806
8970
|
} else if (mixed instanceof Collator) {
|
|
8807
8971
|
return true;
|
|
@@ -8836,7 +9000,7 @@ function typeOf(value) {
|
|
|
8836
9000
|
return BooleanType;
|
|
8837
9001
|
} else if (typeof value === 'number') {
|
|
8838
9002
|
return NumberType;
|
|
8839
|
-
} else if (value instanceof Color) {
|
|
9003
|
+
} else if (value instanceof Color$1) {
|
|
8840
9004
|
return ColorType;
|
|
8841
9005
|
} else if (value instanceof Collator) {
|
|
8842
9006
|
return CollatorType;
|
|
@@ -8858,18 +9022,18 @@ function typeOf(value) {
|
|
|
8858
9022
|
break;
|
|
8859
9023
|
}
|
|
8860
9024
|
}
|
|
8861
|
-
return array(itemType || ValueType, length);
|
|
9025
|
+
return array$1(itemType || ValueType, length);
|
|
8862
9026
|
} else {
|
|
8863
9027
|
return ObjectType;
|
|
8864
9028
|
}
|
|
8865
9029
|
}
|
|
8866
|
-
function toString
|
|
9030
|
+
function toString(value) {
|
|
8867
9031
|
const type = typeof value;
|
|
8868
9032
|
if (value === null) {
|
|
8869
9033
|
return '';
|
|
8870
9034
|
} else if (type === 'string' || type === 'number' || type === 'boolean') {
|
|
8871
9035
|
return String(value);
|
|
8872
|
-
} else if (value instanceof Color || value instanceof Formatted || value instanceof ResolvedImage) {
|
|
9036
|
+
} else if (value instanceof Color$1 || value instanceof Formatted || value instanceof ResolvedImage) {
|
|
8873
9037
|
return value.toString();
|
|
8874
9038
|
} else {
|
|
8875
9039
|
return JSON.stringify(value);
|
|
@@ -8908,7 +9072,7 @@ class Literal {
|
|
|
8908
9072
|
'literal',
|
|
8909
9073
|
this.value
|
|
8910
9074
|
];
|
|
8911
|
-
} else if (this.value instanceof Color) {
|
|
9075
|
+
} else if (this.value instanceof Color$1) {
|
|
8912
9076
|
return ['rgba'].concat(this.value.toArray());
|
|
8913
9077
|
} else if (this.value instanceof Formatted) {
|
|
8914
9078
|
return this.value.serialize();
|
|
@@ -8917,6 +9081,7 @@ class Literal {
|
|
|
8917
9081
|
}
|
|
8918
9082
|
}
|
|
8919
9083
|
}
|
|
9084
|
+
var Literal$1 = Literal;
|
|
8920
9085
|
|
|
8921
9086
|
class RuntimeError {
|
|
8922
9087
|
constructor(message) {
|
|
@@ -8927,8 +9092,9 @@ class RuntimeError {
|
|
|
8927
9092
|
return this.message;
|
|
8928
9093
|
}
|
|
8929
9094
|
}
|
|
9095
|
+
var RuntimeError$1 = RuntimeError;
|
|
8930
9096
|
|
|
8931
|
-
const types = {
|
|
9097
|
+
const types$1 = {
|
|
8932
9098
|
string: StringType,
|
|
8933
9099
|
number: NumberType,
|
|
8934
9100
|
boolean: BooleanType,
|
|
@@ -8949,9 +9115,9 @@ class Assertion {
|
|
|
8949
9115
|
let itemType;
|
|
8950
9116
|
if (args.length > 2) {
|
|
8951
9117
|
const type = args[1];
|
|
8952
|
-
if (typeof type !== 'string' || !(type in types) || type === 'object')
|
|
9118
|
+
if (typeof type !== 'string' || !(type in types$1) || type === 'object')
|
|
8953
9119
|
return context.error('The item type argument of "array" must be one of string, number, boolean', 1);
|
|
8954
|
-
itemType = types[type];
|
|
9120
|
+
itemType = types$1[type];
|
|
8955
9121
|
i++;
|
|
8956
9122
|
} else {
|
|
8957
9123
|
itemType = ValueType;
|
|
@@ -8964,9 +9130,9 @@ class Assertion {
|
|
|
8964
9130
|
N = args[2];
|
|
8965
9131
|
i++;
|
|
8966
9132
|
}
|
|
8967
|
-
type = array(itemType, N);
|
|
9133
|
+
type = array$1(itemType, N);
|
|
8968
9134
|
} else {
|
|
8969
|
-
type = types[name];
|
|
9135
|
+
type = types$1[name];
|
|
8970
9136
|
}
|
|
8971
9137
|
const parsed = [];
|
|
8972
9138
|
for (; i < args.length; i++) {
|
|
@@ -8984,7 +9150,7 @@ class Assertion {
|
|
|
8984
9150
|
if (!error) {
|
|
8985
9151
|
return value;
|
|
8986
9152
|
} else if (i === this.args.length - 1) {
|
|
8987
|
-
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.`);
|
|
8988
9154
|
}
|
|
8989
9155
|
}
|
|
8990
9156
|
return null;
|
|
@@ -9011,6 +9177,7 @@ class Assertion {
|
|
|
9011
9177
|
return serialized.concat(this.args.map(arg => arg.serialize()));
|
|
9012
9178
|
}
|
|
9013
9179
|
}
|
|
9180
|
+
var Assertion$1 = Assertion;
|
|
9014
9181
|
|
|
9015
9182
|
class FormatExpression {
|
|
9016
9183
|
constructor(sections) {
|
|
@@ -9039,7 +9206,7 @@ class FormatExpression {
|
|
|
9039
9206
|
}
|
|
9040
9207
|
let font = null;
|
|
9041
9208
|
if (arg['text-font']) {
|
|
9042
|
-
font = context.parse(arg['text-font'], 1, array(StringType));
|
|
9209
|
+
font = context.parse(arg['text-font'], 1, array$1(StringType));
|
|
9043
9210
|
if (!font)
|
|
9044
9211
|
return null;
|
|
9045
9212
|
}
|
|
@@ -9077,7 +9244,7 @@ class FormatExpression {
|
|
|
9077
9244
|
if (typeOf(evaluatedContent) === ResolvedImageType) {
|
|
9078
9245
|
return new FormattedSection('', evaluatedContent, null, null, null);
|
|
9079
9246
|
}
|
|
9080
|
-
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);
|
|
9081
9248
|
};
|
|
9082
9249
|
return new Formatted(this.sections.map(evaluateSection));
|
|
9083
9250
|
}
|
|
@@ -9153,7 +9320,7 @@ class ImageExpression {
|
|
|
9153
9320
|
}
|
|
9154
9321
|
}
|
|
9155
9322
|
|
|
9156
|
-
const types
|
|
9323
|
+
const types = {
|
|
9157
9324
|
'to-boolean': BooleanType,
|
|
9158
9325
|
'to-color': ColorType,
|
|
9159
9326
|
'to-number': NumberType,
|
|
@@ -9170,7 +9337,7 @@ class Coercion {
|
|
|
9170
9337
|
const name = args[0];
|
|
9171
9338
|
if ((name === 'to-boolean' || name === 'to-string') && args.length !== 2)
|
|
9172
9339
|
return context.error(`Expected one argument.`);
|
|
9173
|
-
const type = types
|
|
9340
|
+
const type = types[name];
|
|
9174
9341
|
const parsed = [];
|
|
9175
9342
|
for (let i = 1; i < args.length; i++) {
|
|
9176
9343
|
const input = context.parse(args[i], i, ValueType);
|
|
@@ -9189,7 +9356,7 @@ class Coercion {
|
|
|
9189
9356
|
for (const arg of this.args) {
|
|
9190
9357
|
input = arg.evaluate(ctx);
|
|
9191
9358
|
error = null;
|
|
9192
|
-
if (input instanceof Color) {
|
|
9359
|
+
if (input instanceof Color$1) {
|
|
9193
9360
|
return input;
|
|
9194
9361
|
} else if (typeof input === 'string') {
|
|
9195
9362
|
const c = ctx.parseColor(input);
|
|
@@ -9202,11 +9369,11 @@ class Coercion {
|
|
|
9202
9369
|
error = validateRGBA(input[0], input[1], input[2], input[3]);
|
|
9203
9370
|
}
|
|
9204
9371
|
if (!error) {
|
|
9205
|
-
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]);
|
|
9206
9373
|
}
|
|
9207
9374
|
}
|
|
9208
9375
|
}
|
|
9209
|
-
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)) }'`);
|
|
9210
9377
|
} else if (this.type.kind === 'number') {
|
|
9211
9378
|
let value = null;
|
|
9212
9379
|
for (const arg of this.args) {
|
|
@@ -9218,13 +9385,13 @@ class Coercion {
|
|
|
9218
9385
|
continue;
|
|
9219
9386
|
return num;
|
|
9220
9387
|
}
|
|
9221
|
-
throw new RuntimeError(`Could not convert ${ JSON.stringify(value) } to number.`);
|
|
9388
|
+
throw new RuntimeError$1(`Could not convert ${ JSON.stringify(value) } to number.`);
|
|
9222
9389
|
} else if (this.type.kind === 'formatted') {
|
|
9223
|
-
return Formatted.fromString(toString
|
|
9390
|
+
return Formatted.fromString(toString(this.args[0].evaluate(ctx)));
|
|
9224
9391
|
} else if (this.type.kind === 'resolvedImage') {
|
|
9225
|
-
return ResolvedImage.fromString(toString
|
|
9392
|
+
return ResolvedImage.fromString(toString(this.args[0].evaluate(ctx)));
|
|
9226
9393
|
} else {
|
|
9227
|
-
return toString
|
|
9394
|
+
return toString(this.args[0].evaluate(ctx));
|
|
9228
9395
|
}
|
|
9229
9396
|
}
|
|
9230
9397
|
eachChild(fn) {
|
|
@@ -9252,6 +9419,7 @@ class Coercion {
|
|
|
9252
9419
|
return serialized;
|
|
9253
9420
|
}
|
|
9254
9421
|
}
|
|
9422
|
+
var Coercion$1 = Coercion;
|
|
9255
9423
|
|
|
9256
9424
|
const geometryTypes = [
|
|
9257
9425
|
'Unknown',
|
|
@@ -9272,7 +9440,7 @@ class EvaluationContext {
|
|
|
9272
9440
|
this.featureDistanceData = null;
|
|
9273
9441
|
}
|
|
9274
9442
|
id() {
|
|
9275
|
-
return this.feature && 'id' in this.feature ? this.feature.id : null;
|
|
9443
|
+
return this.feature && 'id' in this.feature && this.feature.id ? this.feature.id : null;
|
|
9276
9444
|
}
|
|
9277
9445
|
geometryType() {
|
|
9278
9446
|
return this.feature ? typeof this.feature.type === 'number' ? geometryTypes[this.feature.type] : this.feature.type : null;
|
|
@@ -9303,11 +9471,12 @@ class EvaluationContext {
|
|
|
9303
9471
|
parseColor(input) {
|
|
9304
9472
|
let cached = this._parseColorCache[input];
|
|
9305
9473
|
if (!cached) {
|
|
9306
|
-
cached = this._parseColorCache[input] = Color.parse(input);
|
|
9474
|
+
cached = this._parseColorCache[input] = Color$1.parse(input);
|
|
9307
9475
|
}
|
|
9308
9476
|
return cached;
|
|
9309
9477
|
}
|
|
9310
9478
|
}
|
|
9479
|
+
var EvaluationContext$1 = EvaluationContext;
|
|
9311
9480
|
|
|
9312
9481
|
class CompoundExpression {
|
|
9313
9482
|
constructor(name, type, evaluate, args) {
|
|
@@ -9342,7 +9511,7 @@ class CompoundExpression {
|
|
|
9342
9511
|
const overloads = availableOverloads.filter(([signature]) => !Array.isArray(signature) || signature.length === args.length - 1);
|
|
9343
9512
|
let signatureContext = null;
|
|
9344
9513
|
for (const [params, evaluate] of overloads) {
|
|
9345
|
-
signatureContext = new ParsingContext(context.registry, context.path, null, context.scope);
|
|
9514
|
+
signatureContext = new ParsingContext$1(context.registry, context.path, null, context.scope);
|
|
9346
9515
|
const parsedArgs = [];
|
|
9347
9516
|
let argParseFailed = false;
|
|
9348
9517
|
for (let i = 1; i < args.length; i++) {
|
|
@@ -9383,7 +9552,7 @@ class CompoundExpression {
|
|
|
9383
9552
|
const parsed = context.parse(args[i], 1 + actualTypes.length);
|
|
9384
9553
|
if (!parsed)
|
|
9385
9554
|
return null;
|
|
9386
|
-
actualTypes.push(toString(parsed.type));
|
|
9555
|
+
actualTypes.push(toString$1(parsed.type));
|
|
9387
9556
|
}
|
|
9388
9557
|
context.error(`Expected arguments of type ${ signatures }, but found (${ actualTypes.join(', ') }) instead.`);
|
|
9389
9558
|
}
|
|
@@ -9398,11 +9567,12 @@ class CompoundExpression {
|
|
|
9398
9567
|
}
|
|
9399
9568
|
function stringifySignature(signature) {
|
|
9400
9569
|
if (Array.isArray(signature)) {
|
|
9401
|
-
return `(${ signature.map(toString).join(', ') })`;
|
|
9570
|
+
return `(${ signature.map(toString$1).join(', ') })`;
|
|
9402
9571
|
} else {
|
|
9403
|
-
return `(${ toString(signature.type) }...)`;
|
|
9572
|
+
return `(${ toString$1(signature.type) }...)`;
|
|
9404
9573
|
}
|
|
9405
9574
|
}
|
|
9575
|
+
var CompoundExpression$1 = CompoundExpression;
|
|
9406
9576
|
|
|
9407
9577
|
class CollatorExpression {
|
|
9408
9578
|
constructor(caseSensitive, diacriticSensitive, locale) {
|
|
@@ -9625,6 +9795,8 @@ function getTilePoints(geometry, pointBBox, polyBBox, canonical) {
|
|
|
9625
9795
|
canonical.y * EXTENT
|
|
9626
9796
|
];
|
|
9627
9797
|
const tilePoints = [];
|
|
9798
|
+
if (!geometry)
|
|
9799
|
+
return tilePoints;
|
|
9628
9800
|
for (const points of geometry) {
|
|
9629
9801
|
for (const point of points) {
|
|
9630
9802
|
const p = [
|
|
@@ -9644,6 +9816,8 @@ function getTileLines(geometry, lineBBox, polyBBox, canonical) {
|
|
|
9644
9816
|
canonical.y * EXTENT
|
|
9645
9817
|
];
|
|
9646
9818
|
const tileLines = [];
|
|
9819
|
+
if (!geometry)
|
|
9820
|
+
return tileLines;
|
|
9647
9821
|
for (const line of geometry) {
|
|
9648
9822
|
const tileLine = [];
|
|
9649
9823
|
for (const point of line) {
|
|
@@ -9680,6 +9854,9 @@ function pointsWithinPolygons(ctx, polygonGeometry) {
|
|
|
9680
9854
|
-Infinity
|
|
9681
9855
|
];
|
|
9682
9856
|
const canonical = ctx.canonicalID();
|
|
9857
|
+
if (!canonical) {
|
|
9858
|
+
return false;
|
|
9859
|
+
}
|
|
9683
9860
|
if (polygonGeometry.type === 'Polygon') {
|
|
9684
9861
|
const tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);
|
|
9685
9862
|
const tilePoints = getTilePoints(ctx.geometry(), pointBBox, polyBBox, canonical);
|
|
@@ -9716,6 +9893,9 @@ function linesWithinPolygons(ctx, polygonGeometry) {
|
|
|
9716
9893
|
-Infinity
|
|
9717
9894
|
];
|
|
9718
9895
|
const canonical = ctx.canonicalID();
|
|
9896
|
+
if (!canonical) {
|
|
9897
|
+
return false;
|
|
9898
|
+
}
|
|
9719
9899
|
if (polygonGeometry.type === 'Polygon') {
|
|
9720
9900
|
const tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);
|
|
9721
9901
|
const tileLines = getTileLines(ctx.geometry(), lineBBox, polyBBox, canonical);
|
|
@@ -9789,9 +9969,10 @@ class Within {
|
|
|
9789
9969
|
];
|
|
9790
9970
|
}
|
|
9791
9971
|
}
|
|
9972
|
+
var Within$1 = Within;
|
|
9792
9973
|
|
|
9793
9974
|
function isFeatureConstant(e) {
|
|
9794
|
-
if (e instanceof CompoundExpression) {
|
|
9975
|
+
if (e instanceof CompoundExpression$1) {
|
|
9795
9976
|
if (e.name === 'get' && e.args.length === 1) {
|
|
9796
9977
|
return false;
|
|
9797
9978
|
} else if (e.name === 'feature-state') {
|
|
@@ -9804,7 +9985,7 @@ function isFeatureConstant(e) {
|
|
|
9804
9985
|
return false;
|
|
9805
9986
|
}
|
|
9806
9987
|
}
|
|
9807
|
-
if (e instanceof Within) {
|
|
9988
|
+
if (e instanceof Within$1) {
|
|
9808
9989
|
return false;
|
|
9809
9990
|
}
|
|
9810
9991
|
let result = true;
|
|
@@ -9816,7 +9997,7 @@ function isFeatureConstant(e) {
|
|
|
9816
9997
|
return result;
|
|
9817
9998
|
}
|
|
9818
9999
|
function isStateConstant(e) {
|
|
9819
|
-
if (e instanceof CompoundExpression) {
|
|
10000
|
+
if (e instanceof CompoundExpression$1) {
|
|
9820
10001
|
if (e.name === 'feature-state') {
|
|
9821
10002
|
return false;
|
|
9822
10003
|
}
|
|
@@ -9830,7 +10011,7 @@ function isStateConstant(e) {
|
|
|
9830
10011
|
return result;
|
|
9831
10012
|
}
|
|
9832
10013
|
function isGlobalPropertyConstant(e, properties) {
|
|
9833
|
-
if (e instanceof CompoundExpression && properties.indexOf(e.name) >= 0) {
|
|
10014
|
+
if (e instanceof CompoundExpression$1 && properties.indexOf(e.name) >= 0) {
|
|
9834
10015
|
return false;
|
|
9835
10016
|
}
|
|
9836
10017
|
let result = true;
|
|
@@ -9872,9 +10053,10 @@ class Var {
|
|
|
9872
10053
|
];
|
|
9873
10054
|
}
|
|
9874
10055
|
}
|
|
10056
|
+
var Var$1 = Var;
|
|
9875
10057
|
|
|
9876
10058
|
class ParsingContext {
|
|
9877
|
-
constructor(registry, path = [], expectedType, scope = new Scope(), errors = []) {
|
|
10059
|
+
constructor(registry, path = [], expectedType, scope = new Scope$1(), errors = []) {
|
|
9878
10060
|
this.registry = registry;
|
|
9879
10061
|
this.path = path;
|
|
9880
10062
|
this.key = path.map(part => `[${ part }]`).join('');
|
|
@@ -9897,9 +10079,9 @@ class ParsingContext {
|
|
|
9897
10079
|
}
|
|
9898
10080
|
function annotate(parsed, type, typeAnnotation) {
|
|
9899
10081
|
if (typeAnnotation === 'assert') {
|
|
9900
|
-
return new Assertion(type, [parsed]);
|
|
10082
|
+
return new Assertion$1(type, [parsed]);
|
|
9901
10083
|
} else if (typeAnnotation === 'coerce') {
|
|
9902
|
-
return new Coercion(type, [parsed]);
|
|
10084
|
+
return new Coercion$1(type, [parsed]);
|
|
9903
10085
|
} else {
|
|
9904
10086
|
return parsed;
|
|
9905
10087
|
}
|
|
@@ -9929,10 +10111,10 @@ class ParsingContext {
|
|
|
9929
10111
|
return null;
|
|
9930
10112
|
}
|
|
9931
10113
|
}
|
|
9932
|
-
if (!(parsed instanceof Literal) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
|
|
9933
|
-
const ec = new EvaluationContext();
|
|
10114
|
+
if (!(parsed instanceof Literal$1) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
|
|
10115
|
+
const ec = new EvaluationContext$1();
|
|
9934
10116
|
try {
|
|
9935
|
-
parsed = new Literal(parsed.type, parsed.evaluate(ec));
|
|
10117
|
+
parsed = new Literal$1(parsed.type, parsed.evaluate(ec));
|
|
9936
10118
|
} catch (e) {
|
|
9937
10119
|
this.error(e.message);
|
|
9938
10120
|
return null;
|
|
@@ -9956,7 +10138,7 @@ class ParsingContext {
|
|
|
9956
10138
|
}
|
|
9957
10139
|
error(error, ...keys) {
|
|
9958
10140
|
const key = `${ this.key }${ keys.map(k => `[${ k }]`).join('') }`;
|
|
9959
|
-
this.errors.push(new ParsingError(key, error));
|
|
10141
|
+
this.errors.push(new ParsingError$2(key, error));
|
|
9960
10142
|
}
|
|
9961
10143
|
checkSubtype(expected, t) {
|
|
9962
10144
|
const error = checkSubtype(expected, t);
|
|
@@ -9965,23 +10147,24 @@ class ParsingContext {
|
|
|
9965
10147
|
return error;
|
|
9966
10148
|
}
|
|
9967
10149
|
}
|
|
10150
|
+
var ParsingContext$1 = ParsingContext;
|
|
9968
10151
|
function isConstant(expression) {
|
|
9969
|
-
if (expression instanceof Var) {
|
|
10152
|
+
if (expression instanceof Var$1) {
|
|
9970
10153
|
return isConstant(expression.boundExpression);
|
|
9971
|
-
} else if (expression instanceof CompoundExpression && expression.name === 'error') {
|
|
10154
|
+
} else if (expression instanceof CompoundExpression$1 && expression.name === 'error') {
|
|
9972
10155
|
return false;
|
|
9973
10156
|
} else if (expression instanceof CollatorExpression) {
|
|
9974
10157
|
return false;
|
|
9975
|
-
} else if (expression instanceof Within) {
|
|
10158
|
+
} else if (expression instanceof Within$1) {
|
|
9976
10159
|
return false;
|
|
9977
10160
|
}
|
|
9978
|
-
const isTypeAnnotation = expression instanceof Coercion || expression instanceof Assertion;
|
|
10161
|
+
const isTypeAnnotation = expression instanceof Coercion$1 || expression instanceof Assertion$1;
|
|
9979
10162
|
let childrenConstant = true;
|
|
9980
10163
|
expression.eachChild(child => {
|
|
9981
10164
|
if (isTypeAnnotation) {
|
|
9982
10165
|
childrenConstant = childrenConstant && isConstant(child);
|
|
9983
10166
|
} else {
|
|
9984
|
-
childrenConstant = childrenConstant && child instanceof Literal;
|
|
10167
|
+
childrenConstant = childrenConstant && child instanceof Literal$1;
|
|
9985
10168
|
}
|
|
9986
10169
|
});
|
|
9987
10170
|
if (!childrenConstant) {
|
|
@@ -10017,7 +10200,7 @@ function findStopLessThanOrEqualTo(stops, input) {
|
|
|
10017
10200
|
} else if (currentValue > input) {
|
|
10018
10201
|
upperIndex = currentIndex - 1;
|
|
10019
10202
|
} else {
|
|
10020
|
-
throw new RuntimeError('Input is not a number.');
|
|
10203
|
+
throw new RuntimeError$1('Input is not a number.');
|
|
10021
10204
|
}
|
|
10022
10205
|
}
|
|
10023
10206
|
return 0;
|
|
@@ -10111,6 +10294,7 @@ class Step {
|
|
|
10111
10294
|
return serialized;
|
|
10112
10295
|
}
|
|
10113
10296
|
}
|
|
10297
|
+
var Step$1 = Step;
|
|
10114
10298
|
|
|
10115
10299
|
/*
|
|
10116
10300
|
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
|
@@ -10221,9 +10405,9 @@ function number(a, b, t) {
|
|
|
10221
10405
|
return a * (1 - t) + b * t;
|
|
10222
10406
|
}
|
|
10223
10407
|
function color(from, to, t) {
|
|
10224
|
-
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));
|
|
10225
10409
|
}
|
|
10226
|
-
function array
|
|
10410
|
+
function array(from, to, t) {
|
|
10227
10411
|
return from.map((d, i) => {
|
|
10228
10412
|
return number(d, to[i], t);
|
|
10229
10413
|
});
|
|
@@ -10233,7 +10417,7 @@ var interpolate = /*#__PURE__*/Object.freeze({
|
|
|
10233
10417
|
__proto__: null,
|
|
10234
10418
|
number: number,
|
|
10235
10419
|
color: color,
|
|
10236
|
-
array: array
|
|
10420
|
+
array: array
|
|
10237
10421
|
});
|
|
10238
10422
|
|
|
10239
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;
|
|
@@ -10264,7 +10448,7 @@ function labToRgb(labColor) {
|
|
|
10264
10448
|
y = Yn * lab2xyz(y);
|
|
10265
10449
|
x = Xn * lab2xyz(x);
|
|
10266
10450
|
z = Zn * lab2xyz(z);
|
|
10267
|
-
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);
|
|
10268
10452
|
}
|
|
10269
10453
|
function interpolateLab(from, to, t) {
|
|
10270
10454
|
return {
|
|
@@ -10412,7 +10596,7 @@ class Interpolate {
|
|
|
10412
10596
|
]);
|
|
10413
10597
|
}
|
|
10414
10598
|
if (outputType.kind !== 'number' && outputType.kind !== 'color' && !(outputType.kind === 'array' && outputType.itemType.kind === 'number' && typeof outputType.N === 'number')) {
|
|
10415
|
-
return context.error(`Type ${ toString(outputType) } is not interpolatable.`);
|
|
10599
|
+
return context.error(`Type ${ toString$1(outputType) } is not interpolatable.`);
|
|
10416
10600
|
}
|
|
10417
10601
|
return new Interpolate(outputType, operator, interpolation, input, stops);
|
|
10418
10602
|
}
|
|
@@ -10491,6 +10675,7 @@ function exponentialInterpolation(input, base, lowerValue, upperValue) {
|
|
|
10491
10675
|
return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);
|
|
10492
10676
|
}
|
|
10493
10677
|
}
|
|
10678
|
+
var Interpolate$1 = Interpolate;
|
|
10494
10679
|
|
|
10495
10680
|
class Coalesce {
|
|
10496
10681
|
constructor(type, args) {
|
|
@@ -10552,6 +10737,7 @@ class Coalesce {
|
|
|
10552
10737
|
return serialized;
|
|
10553
10738
|
}
|
|
10554
10739
|
}
|
|
10740
|
+
var Coalesce$1 = Coalesce;
|
|
10555
10741
|
|
|
10556
10742
|
class Let {
|
|
10557
10743
|
constructor(bindings, result) {
|
|
@@ -10605,6 +10791,7 @@ class Let {
|
|
|
10605
10791
|
return serialized;
|
|
10606
10792
|
}
|
|
10607
10793
|
}
|
|
10794
|
+
var Let$1 = Let;
|
|
10608
10795
|
|
|
10609
10796
|
class At {
|
|
10610
10797
|
constructor(type, index, input) {
|
|
@@ -10616,7 +10803,7 @@ class At {
|
|
|
10616
10803
|
if (args.length !== 3)
|
|
10617
10804
|
return context.error(`Expected 2 arguments, but found ${ args.length - 1 } instead.`);
|
|
10618
10805
|
const index = context.parse(args[1], 1, NumberType);
|
|
10619
|
-
const input = context.parse(args[2], 2, array(context.expectedType || ValueType));
|
|
10806
|
+
const input = context.parse(args[2], 2, array$1(context.expectedType || ValueType));
|
|
10620
10807
|
if (!index || !input)
|
|
10621
10808
|
return null;
|
|
10622
10809
|
const t = input.type;
|
|
@@ -10626,13 +10813,13 @@ class At {
|
|
|
10626
10813
|
const index = this.index.evaluate(ctx);
|
|
10627
10814
|
const array = this.input.evaluate(ctx);
|
|
10628
10815
|
if (index < 0) {
|
|
10629
|
-
throw new RuntimeError(`Array index out of bounds: ${ index } < 0.`);
|
|
10816
|
+
throw new RuntimeError$1(`Array index out of bounds: ${ index } < 0.`);
|
|
10630
10817
|
}
|
|
10631
10818
|
if (index >= array.length) {
|
|
10632
|
-
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 }.`);
|
|
10633
10820
|
}
|
|
10634
10821
|
if (index !== Math.floor(index)) {
|
|
10635
|
-
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.`);
|
|
10636
10823
|
}
|
|
10637
10824
|
return array[index];
|
|
10638
10825
|
}
|
|
@@ -10651,6 +10838,7 @@ class At {
|
|
|
10651
10838
|
];
|
|
10652
10839
|
}
|
|
10653
10840
|
}
|
|
10841
|
+
var At$1 = At;
|
|
10654
10842
|
|
|
10655
10843
|
class In {
|
|
10656
10844
|
constructor(needle, haystack) {
|
|
@@ -10673,7 +10861,7 @@ class In {
|
|
|
10673
10861
|
NullType,
|
|
10674
10862
|
ValueType
|
|
10675
10863
|
])) {
|
|
10676
|
-
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`);
|
|
10677
10865
|
}
|
|
10678
10866
|
return new In(needle, haystack);
|
|
10679
10867
|
}
|
|
@@ -10688,13 +10876,13 @@ class In {
|
|
|
10688
10876
|
'number',
|
|
10689
10877
|
'null'
|
|
10690
10878
|
])) {
|
|
10691
|
-
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.`);
|
|
10692
10880
|
}
|
|
10693
10881
|
if (!isValidNativeType(haystack, [
|
|
10694
10882
|
'string',
|
|
10695
10883
|
'array'
|
|
10696
10884
|
])) {
|
|
10697
|
-
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.`);
|
|
10698
10886
|
}
|
|
10699
10887
|
return haystack.indexOf(needle) >= 0;
|
|
10700
10888
|
}
|
|
@@ -10713,6 +10901,7 @@ class In {
|
|
|
10713
10901
|
];
|
|
10714
10902
|
}
|
|
10715
10903
|
}
|
|
10904
|
+
var In$1 = In;
|
|
10716
10905
|
|
|
10717
10906
|
class IndexOf {
|
|
10718
10907
|
constructor(needle, haystack, fromIndex) {
|
|
@@ -10736,7 +10925,7 @@ class IndexOf {
|
|
|
10736
10925
|
NullType,
|
|
10737
10926
|
ValueType
|
|
10738
10927
|
])) {
|
|
10739
|
-
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`);
|
|
10740
10929
|
}
|
|
10741
10930
|
if (args.length === 4) {
|
|
10742
10931
|
const fromIndex = context.parse(args[3], 3, NumberType);
|
|
@@ -10756,13 +10945,13 @@ class IndexOf {
|
|
|
10756
10945
|
'number',
|
|
10757
10946
|
'null'
|
|
10758
10947
|
])) {
|
|
10759
|
-
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.`);
|
|
10760
10949
|
}
|
|
10761
10950
|
if (!isValidNativeType(haystack, [
|
|
10762
10951
|
'string',
|
|
10763
10952
|
'array'
|
|
10764
10953
|
])) {
|
|
10765
|
-
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.`);
|
|
10766
10955
|
}
|
|
10767
10956
|
if (this.fromIndex) {
|
|
10768
10957
|
const fromIndex = this.fromIndex.evaluate(ctx);
|
|
@@ -10797,6 +10986,7 @@ class IndexOf {
|
|
|
10797
10986
|
];
|
|
10798
10987
|
}
|
|
10799
10988
|
}
|
|
10989
|
+
var IndexOf$1 = IndexOf;
|
|
10800
10990
|
|
|
10801
10991
|
class Match {
|
|
10802
10992
|
constructor(inputType, outputType, input, cases, outputs, otherwise) {
|
|
@@ -10909,6 +11099,7 @@ class Match {
|
|
|
10909
11099
|
return serialized;
|
|
10910
11100
|
}
|
|
10911
11101
|
}
|
|
11102
|
+
var Match$1 = Match;
|
|
10912
11103
|
|
|
10913
11104
|
class Case {
|
|
10914
11105
|
constructor(type, branches, otherwise) {
|
|
@@ -10970,6 +11161,7 @@ class Case {
|
|
|
10970
11161
|
return serialized;
|
|
10971
11162
|
}
|
|
10972
11163
|
}
|
|
11164
|
+
var Case$1 = Case;
|
|
10973
11165
|
|
|
10974
11166
|
class Slice {
|
|
10975
11167
|
constructor(type, input, beginIndex, endIndex) {
|
|
@@ -10987,11 +11179,11 @@ class Slice {
|
|
|
10987
11179
|
if (!input || !beginIndex)
|
|
10988
11180
|
return null;
|
|
10989
11181
|
if (!isValidType(input.type, [
|
|
10990
|
-
array(ValueType),
|
|
11182
|
+
array$1(ValueType),
|
|
10991
11183
|
StringType,
|
|
10992
11184
|
ValueType
|
|
10993
11185
|
])) {
|
|
10994
|
-
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`);
|
|
10995
11187
|
}
|
|
10996
11188
|
if (args.length === 4) {
|
|
10997
11189
|
const endIndex = context.parse(args[3], 3, NumberType);
|
|
@@ -11009,7 +11201,7 @@ class Slice {
|
|
|
11009
11201
|
'string',
|
|
11010
11202
|
'array'
|
|
11011
11203
|
])) {
|
|
11012
|
-
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.`);
|
|
11013
11205
|
}
|
|
11014
11206
|
if (this.endIndex) {
|
|
11015
11207
|
const endIndex = this.endIndex.evaluate(ctx);
|
|
@@ -11044,6 +11236,7 @@ class Slice {
|
|
|
11044
11236
|
];
|
|
11045
11237
|
}
|
|
11046
11238
|
}
|
|
11239
|
+
var Slice$1 = Slice;
|
|
11047
11240
|
|
|
11048
11241
|
function isComparableType(op, type) {
|
|
11049
11242
|
if (op === '==' || op === '!=') {
|
|
@@ -11106,22 +11299,22 @@ function makeComparison(op, compareBasic, compareWithCollator) {
|
|
|
11106
11299
|
if (!lhs)
|
|
11107
11300
|
return null;
|
|
11108
11301
|
if (!isComparableType(op, lhs.type)) {
|
|
11109
|
-
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) }'.`);
|
|
11110
11303
|
}
|
|
11111
11304
|
let rhs = context.parse(args[2], 2, ValueType);
|
|
11112
11305
|
if (!rhs)
|
|
11113
11306
|
return null;
|
|
11114
11307
|
if (!isComparableType(op, rhs.type)) {
|
|
11115
|
-
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) }'.`);
|
|
11116
11309
|
}
|
|
11117
11310
|
if (lhs.type.kind !== rhs.type.kind && lhs.type.kind !== 'value' && rhs.type.kind !== 'value') {
|
|
11118
|
-
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) }'.`);
|
|
11119
11312
|
}
|
|
11120
11313
|
if (isOrderComparison) {
|
|
11121
11314
|
if (lhs.type.kind === 'value' && rhs.type.kind !== 'value') {
|
|
11122
|
-
lhs = new Assertion(rhs.type, [lhs]);
|
|
11315
|
+
lhs = new Assertion$1(rhs.type, [lhs]);
|
|
11123
11316
|
} else if (lhs.type.kind !== 'value' && rhs.type.kind === 'value') {
|
|
11124
|
-
rhs = new Assertion(lhs.type, [rhs]);
|
|
11317
|
+
rhs = new Assertion$1(lhs.type, [rhs]);
|
|
11125
11318
|
}
|
|
11126
11319
|
}
|
|
11127
11320
|
let collator = null;
|
|
@@ -11142,7 +11335,7 @@ function makeComparison(op, compareBasic, compareWithCollator) {
|
|
|
11142
11335
|
const lt = typeOf(lhs);
|
|
11143
11336
|
const rt = typeOf(rhs);
|
|
11144
11337
|
if (lt.kind !== rt.kind || !(lt.kind === 'string' || lt.kind === 'number')) {
|
|
11145
|
-
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.`);
|
|
11146
11339
|
}
|
|
11147
11340
|
}
|
|
11148
11341
|
if (this.collator && !isOrderComparison && this.hasUntypedArgument) {
|
|
@@ -11284,7 +11477,7 @@ class Length {
|
|
|
11284
11477
|
if (!input)
|
|
11285
11478
|
return null;
|
|
11286
11479
|
if (input.type.kind !== 'array' && input.type.kind !== 'string' && input.type.kind !== 'value')
|
|
11287
|
-
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.`);
|
|
11288
11481
|
return new Length(input);
|
|
11289
11482
|
}
|
|
11290
11483
|
evaluate(ctx) {
|
|
@@ -11294,7 +11487,7 @@ class Length {
|
|
|
11294
11487
|
} else if (Array.isArray(input)) {
|
|
11295
11488
|
return input.length;
|
|
11296
11489
|
} else {
|
|
11297
|
-
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.`);
|
|
11298
11491
|
}
|
|
11299
11492
|
}
|
|
11300
11493
|
eachChild(fn) {
|
|
@@ -11311,6 +11504,7 @@ class Length {
|
|
|
11311
11504
|
return serialized;
|
|
11312
11505
|
}
|
|
11313
11506
|
}
|
|
11507
|
+
var Length$1 = Length;
|
|
11314
11508
|
|
|
11315
11509
|
const expressions = {
|
|
11316
11510
|
'==': Equals,
|
|
@@ -11319,35 +11513,35 @@ const expressions = {
|
|
|
11319
11513
|
'<': LessThan,
|
|
11320
11514
|
'>=': GreaterThanOrEqual,
|
|
11321
11515
|
'<=': LessThanOrEqual,
|
|
11322
|
-
'array': Assertion,
|
|
11323
|
-
'at': At,
|
|
11324
|
-
'boolean': Assertion,
|
|
11325
|
-
'case': Case,
|
|
11326
|
-
'coalesce': Coalesce,
|
|
11516
|
+
'array': Assertion$1,
|
|
11517
|
+
'at': At$1,
|
|
11518
|
+
'boolean': Assertion$1,
|
|
11519
|
+
'case': Case$1,
|
|
11520
|
+
'coalesce': Coalesce$1,
|
|
11327
11521
|
'collator': CollatorExpression,
|
|
11328
11522
|
'format': FormatExpression,
|
|
11329
11523
|
'image': ImageExpression,
|
|
11330
|
-
'in': In,
|
|
11331
|
-
'index-of': IndexOf,
|
|
11332
|
-
'interpolate': Interpolate,
|
|
11333
|
-
'interpolate-hcl': Interpolate,
|
|
11334
|
-
'interpolate-lab': Interpolate,
|
|
11335
|
-
'length': Length,
|
|
11336
|
-
'let': Let,
|
|
11337
|
-
'literal': Literal,
|
|
11338
|
-
'match': Match,
|
|
11339
|
-
'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,
|
|
11340
11534
|
'number-format': NumberFormat,
|
|
11341
|
-
'object': Assertion,
|
|
11342
|
-
'slice': Slice,
|
|
11343
|
-
'step': Step,
|
|
11344
|
-
'string': Assertion,
|
|
11345
|
-
'to-boolean': Coercion,
|
|
11346
|
-
'to-color': Coercion,
|
|
11347
|
-
'to-number': Coercion,
|
|
11348
|
-
'to-string': Coercion,
|
|
11349
|
-
'var': Var,
|
|
11350
|
-
'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
|
|
11351
11545
|
};
|
|
11352
11546
|
function rgba(ctx, [r, g, b, a]) {
|
|
11353
11547
|
r = r.evaluate(ctx);
|
|
@@ -11356,8 +11550,8 @@ function rgba(ctx, [r, g, b, a]) {
|
|
|
11356
11550
|
const alpha = a ? a.evaluate(ctx) : 1;
|
|
11357
11551
|
const error = validateRGBA(r, g, b, alpha);
|
|
11358
11552
|
if (error)
|
|
11359
|
-
throw new RuntimeError(error);
|
|
11360
|
-
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);
|
|
11361
11555
|
}
|
|
11362
11556
|
function has(key, obj) {
|
|
11363
11557
|
return key in obj;
|
|
@@ -11381,21 +11575,21 @@ function binarySearch(v, a, i, j) {
|
|
|
11381
11575
|
function varargs(type) {
|
|
11382
11576
|
return { type };
|
|
11383
11577
|
}
|
|
11384
|
-
CompoundExpression.register(expressions, {
|
|
11578
|
+
CompoundExpression$1.register(expressions, {
|
|
11385
11579
|
'error': [
|
|
11386
11580
|
ErrorType,
|
|
11387
11581
|
[StringType],
|
|
11388
11582
|
(ctx, [v]) => {
|
|
11389
|
-
throw new RuntimeError(v.evaluate(ctx));
|
|
11583
|
+
throw new RuntimeError$1(v.evaluate(ctx));
|
|
11390
11584
|
}
|
|
11391
11585
|
],
|
|
11392
11586
|
'typeof': [
|
|
11393
11587
|
StringType,
|
|
11394
11588
|
[ValueType],
|
|
11395
|
-
(ctx, [v]) => toString(typeOf(v.evaluate(ctx)))
|
|
11589
|
+
(ctx, [v]) => toString$1(typeOf(v.evaluate(ctx)))
|
|
11396
11590
|
],
|
|
11397
11591
|
'to-rgba': [
|
|
11398
|
-
array(NumberType, 4),
|
|
11592
|
+
array$1(NumberType, 4),
|
|
11399
11593
|
[ColorType],
|
|
11400
11594
|
(ctx, [v]) => {
|
|
11401
11595
|
return v.evaluate(ctx).toArray();
|
|
@@ -11781,19 +11975,19 @@ CompoundExpression.register(expressions, {
|
|
|
11781
11975
|
],
|
|
11782
11976
|
'filter-type-in': [
|
|
11783
11977
|
BooleanType,
|
|
11784
|
-
[array(StringType)],
|
|
11978
|
+
[array$1(StringType)],
|
|
11785
11979
|
(ctx, [v]) => v.value.indexOf(ctx.geometryType()) >= 0
|
|
11786
11980
|
],
|
|
11787
11981
|
'filter-id-in': [
|
|
11788
11982
|
BooleanType,
|
|
11789
|
-
[array(ValueType)],
|
|
11983
|
+
[array$1(ValueType)],
|
|
11790
11984
|
(ctx, [v]) => v.value.indexOf(ctx.id()) >= 0
|
|
11791
11985
|
],
|
|
11792
11986
|
'filter-in-small': [
|
|
11793
11987
|
BooleanType,
|
|
11794
11988
|
[
|
|
11795
11989
|
StringType,
|
|
11796
|
-
array(ValueType)
|
|
11990
|
+
array$1(ValueType)
|
|
11797
11991
|
],
|
|
11798
11992
|
(ctx, [k, v]) => v.value.indexOf(ctx.properties()[k.value]) >= 0
|
|
11799
11993
|
],
|
|
@@ -11801,7 +11995,7 @@ CompoundExpression.register(expressions, {
|
|
|
11801
11995
|
BooleanType,
|
|
11802
11996
|
[
|
|
11803
11997
|
StringType,
|
|
11804
|
-
array(ValueType)
|
|
11998
|
+
array$1(ValueType)
|
|
11805
11999
|
],
|
|
11806
12000
|
(ctx, [k, v]) => binarySearch(ctx.properties()[k.value], v.value, 0, v.value.length - 1)
|
|
11807
12001
|
],
|
|
@@ -11878,7 +12072,7 @@ CompoundExpression.register(expressions, {
|
|
|
11878
12072
|
'concat': [
|
|
11879
12073
|
StringType,
|
|
11880
12074
|
varargs(ValueType),
|
|
11881
|
-
(ctx, args) => args.map(arg => toString
|
|
12075
|
+
(ctx, args) => args.map(arg => toString(arg.evaluate(ctx))).join('')
|
|
11882
12076
|
],
|
|
11883
12077
|
'resolved-locale': [
|
|
11884
12078
|
StringType,
|
|
@@ -11886,6 +12080,7 @@ CompoundExpression.register(expressions, {
|
|
|
11886
12080
|
(ctx, [collator]) => collator.evaluate(ctx).resolvedLocale()
|
|
11887
12081
|
]
|
|
11888
12082
|
});
|
|
12083
|
+
var definitions = expressions;
|
|
11889
12084
|
|
|
11890
12085
|
function success(value) {
|
|
11891
12086
|
return {
|
|
@@ -11926,7 +12121,7 @@ function getType(val) {
|
|
|
11926
12121
|
}
|
|
11927
12122
|
}
|
|
11928
12123
|
|
|
11929
|
-
function isFunction
|
|
12124
|
+
function isFunction(value) {
|
|
11930
12125
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
11931
12126
|
}
|
|
11932
12127
|
function identityFunction(x) {
|
|
@@ -11944,14 +12139,14 @@ function createFunction(parameters, propertySpec) {
|
|
|
11944
12139
|
parameters.stops = parameters.stops.map(stop => {
|
|
11945
12140
|
return [
|
|
11946
12141
|
stop[0],
|
|
11947
|
-
Color.parse(stop[1])
|
|
12142
|
+
Color$1.parse(stop[1])
|
|
11948
12143
|
];
|
|
11949
12144
|
});
|
|
11950
12145
|
}
|
|
11951
12146
|
if (parameters.default) {
|
|
11952
|
-
parameters.default = Color.parse(parameters.default);
|
|
12147
|
+
parameters.default = Color$1.parse(parameters.default);
|
|
11953
12148
|
} else {
|
|
11954
|
-
parameters.default = Color.parse(propertySpec.default);
|
|
12149
|
+
parameters.default = Color$1.parse(propertySpec.default);
|
|
11955
12150
|
}
|
|
11956
12151
|
}
|
|
11957
12152
|
if (parameters.colorSpace && parameters.colorSpace !== 'rgb' && !colorSpaces[parameters.colorSpace]) {
|
|
@@ -12008,7 +12203,7 @@ function createFunction(parameters, propertySpec) {
|
|
|
12008
12203
|
return {
|
|
12009
12204
|
kind: 'composite',
|
|
12010
12205
|
interpolationType,
|
|
12011
|
-
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
12206
|
+
interpolationFactor: Interpolate$1.interpolationFactor.bind(undefined, interpolationType),
|
|
12012
12207
|
zoomStops: featureFunctionStops.map(s => s[0]),
|
|
12013
12208
|
evaluate({zoom}, properties) {
|
|
12014
12209
|
return evaluateExponentialFunction({
|
|
@@ -12025,7 +12220,7 @@ function createFunction(parameters, propertySpec) {
|
|
|
12025
12220
|
return {
|
|
12026
12221
|
kind: 'camera',
|
|
12027
12222
|
interpolationType,
|
|
12028
|
-
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
12223
|
+
interpolationFactor: Interpolate$1.interpolationFactor.bind(undefined, interpolationType),
|
|
12029
12224
|
zoomStops: parameters.stops.map(s => s[0]),
|
|
12030
12225
|
evaluate: ({zoom}) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)
|
|
12031
12226
|
};
|
|
@@ -12035,14 +12230,14 @@ function createFunction(parameters, propertySpec) {
|
|
|
12035
12230
|
evaluate(_, feature) {
|
|
12036
12231
|
const value = feature && feature.properties ? feature.properties[parameters.property] : undefined;
|
|
12037
12232
|
if (value === undefined) {
|
|
12038
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12233
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12039
12234
|
}
|
|
12040
12235
|
return innerFun(parameters, propertySpec, value, hashedStops, categoricalKeyType);
|
|
12041
12236
|
}
|
|
12042
12237
|
};
|
|
12043
12238
|
}
|
|
12044
12239
|
}
|
|
12045
|
-
function coalesce(a, b, c) {
|
|
12240
|
+
function coalesce$1(a, b, c) {
|
|
12046
12241
|
if (a !== undefined)
|
|
12047
12242
|
return a;
|
|
12048
12243
|
if (b !== undefined)
|
|
@@ -12052,11 +12247,11 @@ function coalesce(a, b, c) {
|
|
|
12052
12247
|
}
|
|
12053
12248
|
function evaluateCategoricalFunction(parameters, propertySpec, input, hashedStops, keyType) {
|
|
12054
12249
|
const evaluated = typeof input === keyType ? hashedStops[input] : undefined;
|
|
12055
|
-
return coalesce(evaluated, parameters.default, propertySpec.default);
|
|
12250
|
+
return coalesce$1(evaluated, parameters.default, propertySpec.default);
|
|
12056
12251
|
}
|
|
12057
12252
|
function evaluateIntervalFunction(parameters, propertySpec, input) {
|
|
12058
12253
|
if (getType(input) !== 'number')
|
|
12059
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12254
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12060
12255
|
const n = parameters.stops.length;
|
|
12061
12256
|
if (n === 1)
|
|
12062
12257
|
return parameters.stops[0][1];
|
|
@@ -12070,7 +12265,7 @@ function evaluateIntervalFunction(parameters, propertySpec, input) {
|
|
|
12070
12265
|
function evaluateExponentialFunction(parameters, propertySpec, input) {
|
|
12071
12266
|
const base = parameters.base !== undefined ? parameters.base : 1;
|
|
12072
12267
|
if (getType(input) !== 'number')
|
|
12073
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12268
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12074
12269
|
const n = parameters.stops.length;
|
|
12075
12270
|
if (n === 1)
|
|
12076
12271
|
return parameters.stops[0][1];
|
|
@@ -12103,7 +12298,7 @@ function evaluateExponentialFunction(parameters, propertySpec, input) {
|
|
|
12103
12298
|
}
|
|
12104
12299
|
function evaluateIdentityFunction(parameters, propertySpec, input) {
|
|
12105
12300
|
if (propertySpec.type === 'color') {
|
|
12106
|
-
input = Color.parse(input);
|
|
12301
|
+
input = Color$1.parse(input);
|
|
12107
12302
|
} else if (propertySpec.type === 'formatted') {
|
|
12108
12303
|
input = Formatted.fromString(input.toString());
|
|
12109
12304
|
} else if (propertySpec.type === 'resolvedImage') {
|
|
@@ -12111,7 +12306,7 @@ function evaluateIdentityFunction(parameters, propertySpec, input) {
|
|
|
12111
12306
|
} else if (getType(input) !== propertySpec.type && (propertySpec.type !== 'enum' || !propertySpec.values[input])) {
|
|
12112
12307
|
input = undefined;
|
|
12113
12308
|
}
|
|
12114
|
-
return coalesce(input, parameters.default, propertySpec.default);
|
|
12309
|
+
return coalesce$1(input, parameters.default, propertySpec.default);
|
|
12115
12310
|
}
|
|
12116
12311
|
function interpolationFactor(input, base, lowerValue, upperValue) {
|
|
12117
12312
|
const difference = upperValue - lowerValue;
|
|
@@ -12129,7 +12324,7 @@ class StyleExpression {
|
|
|
12129
12324
|
constructor(expression, propertySpec) {
|
|
12130
12325
|
this.expression = expression;
|
|
12131
12326
|
this._warningHistory = {};
|
|
12132
|
-
this._evaluator = new EvaluationContext();
|
|
12327
|
+
this._evaluator = new EvaluationContext$1();
|
|
12133
12328
|
this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
|
|
12134
12329
|
this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;
|
|
12135
12330
|
}
|
|
@@ -12137,7 +12332,7 @@ class StyleExpression {
|
|
|
12137
12332
|
this._evaluator.globals = globals;
|
|
12138
12333
|
this._evaluator.feature = feature;
|
|
12139
12334
|
this._evaluator.featureState = featureState;
|
|
12140
|
-
this._evaluator.canonical = canonical;
|
|
12335
|
+
this._evaluator.canonical = canonical || null;
|
|
12141
12336
|
this._evaluator.availableImages = availableImages || null;
|
|
12142
12337
|
this._evaluator.formattedSection = formattedSection;
|
|
12143
12338
|
this._evaluator.featureTileCoord = featureTileCoord || null;
|
|
@@ -12148,7 +12343,7 @@ class StyleExpression {
|
|
|
12148
12343
|
this._evaluator.globals = globals;
|
|
12149
12344
|
this._evaluator.feature = feature || null;
|
|
12150
12345
|
this._evaluator.featureState = featureState || null;
|
|
12151
|
-
this._evaluator.canonical = canonical;
|
|
12346
|
+
this._evaluator.canonical = canonical || null;
|
|
12152
12347
|
this._evaluator.availableImages = availableImages || null;
|
|
12153
12348
|
this._evaluator.formattedSection = formattedSection || null;
|
|
12154
12349
|
this._evaluator.featureTileCoord = featureTileCoord || null;
|
|
@@ -12159,7 +12354,7 @@ class StyleExpression {
|
|
|
12159
12354
|
return this._defaultValue;
|
|
12160
12355
|
}
|
|
12161
12356
|
if (this._enumValues && !(val in this._enumValues)) {
|
|
12162
|
-
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.`);
|
|
12163
12358
|
}
|
|
12164
12359
|
return val;
|
|
12165
12360
|
} catch (e) {
|
|
@@ -12174,10 +12369,10 @@ class StyleExpression {
|
|
|
12174
12369
|
}
|
|
12175
12370
|
}
|
|
12176
12371
|
function isExpression(expression) {
|
|
12177
|
-
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;
|
|
12178
12373
|
}
|
|
12179
12374
|
function createExpression(expression, propertySpec) {
|
|
12180
|
-
const parser = new ParsingContext(
|
|
12375
|
+
const parser = new ParsingContext$1(definitions, [], propertySpec ? getExpectedType(propertySpec) : undefined);
|
|
12181
12376
|
const parsed = parser.parse(expression, undefined, undefined, undefined, propertySpec && propertySpec.type === 'string' ? { typeAnnotation: 'coerce' } : undefined);
|
|
12182
12377
|
if (!parsed) {
|
|
12183
12378
|
return error(parser.errors);
|
|
@@ -12213,7 +12408,7 @@ class ZoomDependentExpression {
|
|
|
12213
12408
|
}
|
|
12214
12409
|
interpolationFactor(input, lower, upper) {
|
|
12215
12410
|
if (this.interpolationType) {
|
|
12216
|
-
return Interpolate.interpolationFactor(this.interpolationType, input, lower, upper);
|
|
12411
|
+
return Interpolate$1.interpolationFactor(this.interpolationType, input, lower, upper);
|
|
12217
12412
|
} else {
|
|
12218
12413
|
return 0;
|
|
12219
12414
|
}
|
|
@@ -12227,7 +12422,7 @@ function createPropertyExpression(expression, propertySpec) {
|
|
|
12227
12422
|
const parsed = expression.value.expression;
|
|
12228
12423
|
const isFeatureConstant$1 = isFeatureConstant(parsed);
|
|
12229
12424
|
if (!isFeatureConstant$1 && !supportsPropertyExpression(propertySpec)) {
|
|
12230
|
-
return error([new ParsingError('', 'data expressions not supported')]);
|
|
12425
|
+
return error([new ParsingError$2('', 'data expressions not supported')]);
|
|
12231
12426
|
}
|
|
12232
12427
|
const isZoomConstant = isGlobalPropertyConstant(parsed, [
|
|
12233
12428
|
'zoom',
|
|
@@ -12235,20 +12430,20 @@ function createPropertyExpression(expression, propertySpec) {
|
|
|
12235
12430
|
'distance-from-center'
|
|
12236
12431
|
]);
|
|
12237
12432
|
if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {
|
|
12238
|
-
return error([new ParsingError('', 'zoom expressions not supported')]);
|
|
12433
|
+
return error([new ParsingError$2('', 'zoom expressions not supported')]);
|
|
12239
12434
|
}
|
|
12240
12435
|
const zoomCurve = findZoomCurve(parsed);
|
|
12241
12436
|
if (!zoomCurve && !isZoomConstant) {
|
|
12242
|
-
return error([new ParsingError('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);
|
|
12243
|
-
} 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) {
|
|
12244
12439
|
return error([zoomCurve]);
|
|
12245
|
-
} else if (zoomCurve instanceof Interpolate && !supportsInterpolation(propertySpec)) {
|
|
12246
|
-
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')]);
|
|
12247
12442
|
}
|
|
12248
12443
|
if (!zoomCurve) {
|
|
12249
12444
|
return success(isFeatureConstant$1 ? new ZoomConstantExpression('constant', expression.value) : new ZoomConstantExpression('source', expression.value));
|
|
12250
12445
|
}
|
|
12251
|
-
const interpolationType = zoomCurve instanceof Interpolate ? zoomCurve.interpolation : undefined;
|
|
12446
|
+
const interpolationType = zoomCurve instanceof Interpolate$1 ? zoomCurve.interpolation : undefined;
|
|
12252
12447
|
return success(isFeatureConstant$1 ? new ZoomDependentExpression('camera', expression.value, zoomCurve.labels, interpolationType) : new ZoomDependentExpression('composite', expression.value, zoomCurve.labels, interpolationType));
|
|
12253
12448
|
}
|
|
12254
12449
|
class StylePropertyFunction {
|
|
@@ -12268,7 +12463,7 @@ class StylePropertyFunction {
|
|
|
12268
12463
|
}
|
|
12269
12464
|
}
|
|
12270
12465
|
function normalizePropertyExpression(value, specification) {
|
|
12271
|
-
if (isFunction
|
|
12466
|
+
if (isFunction(value)) {
|
|
12272
12467
|
return new StylePropertyFunction(value, specification);
|
|
12273
12468
|
} else if (isExpression(value)) {
|
|
12274
12469
|
const expression = createPropertyExpression(value, specification);
|
|
@@ -12279,7 +12474,7 @@ function normalizePropertyExpression(value, specification) {
|
|
|
12279
12474
|
} else {
|
|
12280
12475
|
let constant = value;
|
|
12281
12476
|
if (typeof value === 'string' && specification.type === 'color') {
|
|
12282
|
-
constant = Color.parse(value);
|
|
12477
|
+
constant = Color$1.parse(value);
|
|
12283
12478
|
}
|
|
12284
12479
|
return {
|
|
12285
12480
|
kind: 'constant',
|
|
@@ -12289,29 +12484,29 @@ function normalizePropertyExpression(value, specification) {
|
|
|
12289
12484
|
}
|
|
12290
12485
|
function findZoomCurve(expression) {
|
|
12291
12486
|
let result = null;
|
|
12292
|
-
if (expression instanceof Let) {
|
|
12487
|
+
if (expression instanceof Let$1) {
|
|
12293
12488
|
result = findZoomCurve(expression.result);
|
|
12294
|
-
} else if (expression instanceof Coalesce) {
|
|
12489
|
+
} else if (expression instanceof Coalesce$1) {
|
|
12295
12490
|
for (const arg of expression.args) {
|
|
12296
12491
|
result = findZoomCurve(arg);
|
|
12297
12492
|
if (result) {
|
|
12298
12493
|
break;
|
|
12299
12494
|
}
|
|
12300
12495
|
}
|
|
12301
|
-
} 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') {
|
|
12302
12497
|
result = expression;
|
|
12303
12498
|
}
|
|
12304
|
-
if (result instanceof ParsingError) {
|
|
12499
|
+
if (result instanceof ParsingError$2) {
|
|
12305
12500
|
return result;
|
|
12306
12501
|
}
|
|
12307
12502
|
expression.eachChild(child => {
|
|
12308
12503
|
const childResult = findZoomCurve(child);
|
|
12309
|
-
if (childResult instanceof ParsingError) {
|
|
12504
|
+
if (childResult instanceof ParsingError$2) {
|
|
12310
12505
|
result = childResult;
|
|
12311
12506
|
} else if (!result && childResult) {
|
|
12312
|
-
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.');
|
|
12313
12508
|
} else if (result && childResult && result !== childResult) {
|
|
12314
|
-
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.');
|
|
12315
12510
|
}
|
|
12316
12511
|
});
|
|
12317
12512
|
return result;
|
|
@@ -12327,15 +12522,15 @@ function getExpectedType(spec) {
|
|
|
12327
12522
|
resolvedImage: ResolvedImageType
|
|
12328
12523
|
};
|
|
12329
12524
|
if (spec.type === 'array') {
|
|
12330
|
-
return array(types[spec.value] || ValueType, spec.length);
|
|
12525
|
+
return array$1(types[spec.value] || ValueType, spec.length);
|
|
12331
12526
|
}
|
|
12332
12527
|
return types[spec.type];
|
|
12333
12528
|
}
|
|
12334
12529
|
function getDefaultValue(spec) {
|
|
12335
|
-
if (spec.type === 'color' && isFunction
|
|
12336
|
-
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);
|
|
12337
12532
|
} else if (spec.type === 'color') {
|
|
12338
|
-
return Color.parse(spec.default) || null;
|
|
12533
|
+
return Color$1.parse(spec.default) || null;
|
|
12339
12534
|
} else if (spec.default === undefined) {
|
|
12340
12535
|
return null;
|
|
12341
12536
|
} else {
|
|
@@ -12464,14 +12659,14 @@ function convertZoomAndPropertyFunction(parameters, propertySpec, stops) {
|
|
|
12464
12659
|
return expression;
|
|
12465
12660
|
}
|
|
12466
12661
|
}
|
|
12467
|
-
function coalesce
|
|
12662
|
+
function coalesce(a, b) {
|
|
12468
12663
|
if (a !== undefined)
|
|
12469
12664
|
return a;
|
|
12470
12665
|
if (b !== undefined)
|
|
12471
12666
|
return b;
|
|
12472
12667
|
}
|
|
12473
12668
|
function getFallback(parameters, propertySpec) {
|
|
12474
|
-
const defaultValue = convertLiteral(coalesce
|
|
12669
|
+
const defaultValue = convertLiteral(coalesce(parameters.default, propertySpec.default));
|
|
12475
12670
|
if (defaultValue === undefined && propertySpec.type === 'resolvedImage') {
|
|
12476
12671
|
return '';
|
|
12477
12672
|
}
|
|
@@ -12705,7 +12900,7 @@ function createFilter(filter, layerType = 'fill') {
|
|
|
12705
12900
|
};
|
|
12706
12901
|
}
|
|
12707
12902
|
if (!isExpressionFilter(filter)) {
|
|
12708
|
-
filter = convertFilter(filter);
|
|
12903
|
+
filter = convertFilter$1(filter);
|
|
12709
12904
|
}
|
|
12710
12905
|
const filterExp = filter;
|
|
12711
12906
|
let staticFilter = true;
|
|
@@ -12850,16 +13045,16 @@ function geometryNeeded(filter) {
|
|
|
12850
13045
|
}
|
|
12851
13046
|
return false;
|
|
12852
13047
|
}
|
|
12853
|
-
function convertFilter(filter) {
|
|
13048
|
+
function convertFilter$1(filter) {
|
|
12854
13049
|
if (!filter)
|
|
12855
13050
|
return true;
|
|
12856
13051
|
const op = filter[0];
|
|
12857
13052
|
if (filter.length <= 1)
|
|
12858
13053
|
return op !== 'any';
|
|
12859
|
-
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;
|
|
12860
13055
|
return converted;
|
|
12861
13056
|
}
|
|
12862
|
-
function convertComparisonOp(property, value, op) {
|
|
13057
|
+
function convertComparisonOp$1(property, value, op) {
|
|
12863
13058
|
switch (property) {
|
|
12864
13059
|
case '$type':
|
|
12865
13060
|
return [
|
|
@@ -12880,9 +13075,9 @@ function convertComparisonOp(property, value, op) {
|
|
|
12880
13075
|
}
|
|
12881
13076
|
}
|
|
12882
13077
|
function convertDisjunctionOp(filters) {
|
|
12883
|
-
return ['any'].concat(filters.map(convertFilter));
|
|
13078
|
+
return ['any'].concat(filters.map(convertFilter$1));
|
|
12884
13079
|
}
|
|
12885
|
-
function convertInOp(property, values) {
|
|
13080
|
+
function convertInOp$1(property, values) {
|
|
12886
13081
|
if (values.length === 0) {
|
|
12887
13082
|
return false;
|
|
12888
13083
|
}
|
|
@@ -12925,7 +13120,7 @@ function convertInOp(property, values) {
|
|
|
12925
13120
|
}
|
|
12926
13121
|
}
|
|
12927
13122
|
}
|
|
12928
|
-
function convertHasOp(property) {
|
|
13123
|
+
function convertHasOp$1(property) {
|
|
12929
13124
|
switch (property) {
|
|
12930
13125
|
case '$type':
|
|
12931
13126
|
return true;
|
|
@@ -12945,7 +13140,7 @@ function convertNegation(filter) {
|
|
|
12945
13140
|
];
|
|
12946
13141
|
}
|
|
12947
13142
|
|
|
12948
|
-
function convertFilter
|
|
13143
|
+
function convertFilter(filter) {
|
|
12949
13144
|
return _convertFilter(filter, {});
|
|
12950
13145
|
}
|
|
12951
13146
|
function _convertFilter(filter, expectedTypes) {
|
|
@@ -12960,7 +13155,7 @@ function _convertFilter(filter, expectedTypes) {
|
|
|
12960
13155
|
let converted;
|
|
12961
13156
|
if (op === '==' || op === '!=' || op === '<' || op === '>' || op === '<=' || op === '>=') {
|
|
12962
13157
|
const [, property, value] = filter;
|
|
12963
|
-
converted = convertComparisonOp
|
|
13158
|
+
converted = convertComparisonOp(property, value, op, expectedTypes);
|
|
12964
13159
|
} else if (op === 'any') {
|
|
12965
13160
|
const children = filter.slice(1).map(f => {
|
|
12966
13161
|
const types = {};
|
|
@@ -12983,15 +13178,15 @@ function _convertFilter(filter, expectedTypes) {
|
|
|
12983
13178
|
_convertFilter(['any'].concat(filter.slice(1)), {})
|
|
12984
13179
|
];
|
|
12985
13180
|
} else if (op === 'in') {
|
|
12986
|
-
converted = convertInOp
|
|
13181
|
+
converted = convertInOp(filter[1], filter.slice(2));
|
|
12987
13182
|
} else if (op === '!in') {
|
|
12988
|
-
converted = convertInOp
|
|
13183
|
+
converted = convertInOp(filter[1], filter.slice(2), true);
|
|
12989
13184
|
} else if (op === 'has') {
|
|
12990
|
-
converted = convertHasOp
|
|
13185
|
+
converted = convertHasOp(filter[1]);
|
|
12991
13186
|
} else if (op === '!has') {
|
|
12992
13187
|
converted = [
|
|
12993
13188
|
'!',
|
|
12994
|
-
convertHasOp
|
|
13189
|
+
convertHasOp(filter[1])
|
|
12995
13190
|
];
|
|
12996
13191
|
} else {
|
|
12997
13192
|
converted = true;
|
|
@@ -13020,7 +13215,7 @@ function runtimeTypeChecks(expectedTypes) {
|
|
|
13020
13215
|
return conditions[0];
|
|
13021
13216
|
return ['all'].concat(conditions);
|
|
13022
13217
|
}
|
|
13023
|
-
function convertComparisonOp
|
|
13218
|
+
function convertComparisonOp(property, value, op, expectedTypes) {
|
|
13024
13219
|
let get;
|
|
13025
13220
|
if (property === '$type') {
|
|
13026
13221
|
return [
|
|
@@ -13076,7 +13271,7 @@ function convertComparisonOp$1(property, value, op, expectedTypes) {
|
|
|
13076
13271
|
value
|
|
13077
13272
|
];
|
|
13078
13273
|
}
|
|
13079
|
-
function convertInOp
|
|
13274
|
+
function convertInOp(property, values, negate = false) {
|
|
13080
13275
|
if (values.length === 0)
|
|
13081
13276
|
return negate;
|
|
13082
13277
|
let get;
|
|
@@ -13114,7 +13309,7 @@ function convertInOp$1(property, values, negate = false) {
|
|
|
13114
13309
|
v
|
|
13115
13310
|
]));
|
|
13116
13311
|
}
|
|
13117
|
-
function convertHasOp
|
|
13312
|
+
function convertHasOp(property) {
|
|
13118
13313
|
if (property === '$type') {
|
|
13119
13314
|
return true;
|
|
13120
13315
|
} else if (property === '$id') {
|
|
@@ -13135,7 +13330,7 @@ function migrateToExpressions (style) {
|
|
|
13135
13330
|
const converted = [];
|
|
13136
13331
|
eachLayer(style, layer => {
|
|
13137
13332
|
if (layer.filter) {
|
|
13138
|
-
layer.filter = convertFilter
|
|
13333
|
+
layer.filter = convertFilter(layer.filter);
|
|
13139
13334
|
}
|
|
13140
13335
|
});
|
|
13141
13336
|
eachProperty(style, {
|
|
@@ -13662,7 +13857,7 @@ class ValidationError {
|
|
|
13662
13857
|
}
|
|
13663
13858
|
}
|
|
13664
13859
|
|
|
13665
|
-
class ParsingError
|
|
13860
|
+
class ParsingError {
|
|
13666
13861
|
constructor(error) {
|
|
13667
13862
|
this.error = error;
|
|
13668
13863
|
this.message = error.message;
|
|
@@ -13695,7 +13890,8 @@ function validateObject(options) {
|
|
|
13695
13890
|
validateElement = elementValidators['*'];
|
|
13696
13891
|
} else if (elementSpecs['*']) {
|
|
13697
13892
|
validateElement = validate;
|
|
13698
|
-
}
|
|
13893
|
+
}
|
|
13894
|
+
if (!validateElement) {
|
|
13699
13895
|
errors.push(new ValidationError(key, object[objectKey], `unknown property "${ objectKey }"`));
|
|
13700
13896
|
continue;
|
|
13701
13897
|
}
|
|
@@ -13740,7 +13936,8 @@ function validateArray(options) {
|
|
|
13740
13936
|
'type': arraySpec.value,
|
|
13741
13937
|
'values': arraySpec.values,
|
|
13742
13938
|
'minimum': arraySpec.minimum,
|
|
13743
|
-
'maximum': arraySpec.maximum
|
|
13939
|
+
'maximum': arraySpec.maximum,
|
|
13940
|
+
function: undefined
|
|
13744
13941
|
};
|
|
13745
13942
|
if (styleSpec.$version < 7) {
|
|
13746
13943
|
arrayElementSpec.function = arraySpec.function;
|
|
@@ -13877,11 +14074,15 @@ function validateFunction(options) {
|
|
|
13877
14074
|
if (value[0].value === undefined) {
|
|
13878
14075
|
return [new ValidationError(key, value, 'object stop key must have value')];
|
|
13879
14076
|
}
|
|
13880
|
-
|
|
14077
|
+
const nextStopDomainZoom = unbundle(value[0].zoom);
|
|
14078
|
+
if (typeof nextStopDomainZoom !== 'number') {
|
|
14079
|
+
return [new ValidationError(key, value[0].zoom, 'stop zoom values must be numbers')];
|
|
14080
|
+
}
|
|
14081
|
+
if (previousStopDomainZoom && previousStopDomainZoom > nextStopDomainZoom) {
|
|
13881
14082
|
return [new ValidationError(key, value[0].zoom, 'stop zoom values must appear in ascending order')];
|
|
13882
14083
|
}
|
|
13883
|
-
if (
|
|
13884
|
-
previousStopDomainZoom =
|
|
14084
|
+
if (nextStopDomainZoom !== previousStopDomainZoom) {
|
|
14085
|
+
previousStopDomainZoom = nextStopDomainZoom;
|
|
13885
14086
|
previousStopDomainValue = undefined;
|
|
13886
14087
|
stopDomainValues = {};
|
|
13887
14088
|
}
|
|
@@ -13925,7 +14126,7 @@ function validateFunction(options) {
|
|
|
13925
14126
|
} else if (type !== stopKeyType) {
|
|
13926
14127
|
return [new ValidationError(options.key, reportValue, `${ type } stop domain type must match previous stop domain type ${ stopKeyType }`)];
|
|
13927
14128
|
}
|
|
13928
|
-
if (type !== 'number' && type !== 'string' && type !== 'boolean') {
|
|
14129
|
+
if (type !== 'number' && type !== 'string' && type !== 'boolean' && typeof value !== 'number' && typeof value !== 'string' && typeof value !== 'boolean') {
|
|
13929
14130
|
return [new ValidationError(options.key, reportValue, 'stop domain value must be a number, string, or boolean')];
|
|
13930
14131
|
}
|
|
13931
14132
|
if (type !== 'number' && functionType !== 'categorical') {
|
|
@@ -13935,10 +14136,10 @@ function validateFunction(options) {
|
|
|
13935
14136
|
}
|
|
13936
14137
|
return [new ValidationError(options.key, reportValue, message)];
|
|
13937
14138
|
}
|
|
13938
|
-
if (functionType === 'categorical' && type === 'number' && (!isFinite(value) || Math.floor(value) !== value)) {
|
|
13939
|
-
return [new ValidationError(options.key, reportValue, `integer expected, found ${ value }`)];
|
|
14139
|
+
if (functionType === 'categorical' && type === 'number' && (typeof value !== 'number' || !isFinite(value) || Math.floor(value) !== value)) {
|
|
14140
|
+
return [new ValidationError(options.key, reportValue, `integer expected, found ${ String(value) }`)];
|
|
13940
14141
|
}
|
|
13941
|
-
if (functionType !== 'categorical' && type === 'number' && previousStopDomainValue !== undefined && value < previousStopDomainValue) {
|
|
14142
|
+
if (functionType !== 'categorical' && type === 'number' && typeof value === 'number' && typeof previousStopDomainValue === 'number' && previousStopDomainValue !== undefined && value < previousStopDomainValue) {
|
|
13942
14143
|
return [new ValidationError(options.key, reportValue, 'stop domain values must appear in ascending order')];
|
|
13943
14144
|
} else {
|
|
13944
14145
|
previousStopDomainValue = value;
|
|
@@ -13998,14 +14199,16 @@ function disallowedFilterParameters(e, options) {
|
|
|
13998
14199
|
'pitch',
|
|
13999
14200
|
'distance-from-center'
|
|
14000
14201
|
]);
|
|
14001
|
-
|
|
14002
|
-
|
|
14202
|
+
if (options.valueSpec && options.valueSpec.expression) {
|
|
14203
|
+
for (const param of options.valueSpec.expression.parameters) {
|
|
14204
|
+
disallowedParameters.delete(param);
|
|
14205
|
+
}
|
|
14003
14206
|
}
|
|
14004
14207
|
if (disallowedParameters.size === 0) {
|
|
14005
14208
|
return [];
|
|
14006
14209
|
}
|
|
14007
14210
|
const errors = [];
|
|
14008
|
-
if (e instanceof CompoundExpression) {
|
|
14211
|
+
if (e instanceof CompoundExpression$1) {
|
|
14009
14212
|
if (disallowedParameters.has(e.name)) {
|
|
14010
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 }`)];
|
|
14011
14214
|
}
|
|
@@ -14058,10 +14261,10 @@ function validateEnum(options) {
|
|
|
14058
14261
|
|
|
14059
14262
|
function validateFilter(options) {
|
|
14060
14263
|
if (isExpressionFilter(deepUnbundle(options.value))) {
|
|
14061
|
-
const layerType =
|
|
14264
|
+
const layerType = options.layerType || 'fill';
|
|
14062
14265
|
return validateExpression(extend({}, options, {
|
|
14063
14266
|
expressionContext: 'filter',
|
|
14064
|
-
valueSpec: options.styleSpec[`filter_${ layerType
|
|
14267
|
+
valueSpec: options.styleSpec[`filter_${ layerType }`]
|
|
14065
14268
|
}));
|
|
14066
14269
|
} else {
|
|
14067
14270
|
return validateNonExpressionFilter(options);
|
|
@@ -14187,7 +14390,7 @@ function validateProperty(options, propertyType) {
|
|
|
14187
14390
|
if (propertyKey === 'text-field' && style && !style.glyphs) {
|
|
14188
14391
|
errors.push(new ValidationError(key, value, 'use of "text-field" requires a style "glyphs" property'));
|
|
14189
14392
|
}
|
|
14190
|
-
if (propertyKey === 'text-font' && isFunction
|
|
14393
|
+
if (propertyKey === 'text-font' && isFunction(deepUnbundle(value)) && unbundle(value.type) === 'identity') {
|
|
14191
14394
|
errors.push(new ValidationError(key, value, '"text-font" does not support identity functions'));
|
|
14192
14395
|
}
|
|
14193
14396
|
}
|
|
@@ -14249,7 +14452,8 @@ function validateLayer(options) {
|
|
|
14249
14452
|
parent = layer;
|
|
14250
14453
|
});
|
|
14251
14454
|
if (!parent) {
|
|
14252
|
-
|
|
14455
|
+
if (typeof ref === 'string')
|
|
14456
|
+
errors.push(new ValidationError(key, layer.ref, `ref layer "${ ref }" not found`));
|
|
14253
14457
|
} else if (parent.ref) {
|
|
14254
14458
|
errors.push(new ValidationError(key, layer.ref, 'ref cannot reference another ref layer'));
|
|
14255
14459
|
} else {
|
|
@@ -14273,6 +14477,8 @@ function validateLayer(options) {
|
|
|
14273
14477
|
errors.push(new ValidationError(key, layer.source, 'raster-dem source can only be used with layer type \'hillshade\'.'));
|
|
14274
14478
|
} else if (type === 'line' && layer.paint && layer.paint['line-gradient'] && (sourceType !== 'geojson' || !source.lineMetrics)) {
|
|
14275
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.`));
|
|
14276
14482
|
}
|
|
14277
14483
|
}
|
|
14278
14484
|
}
|
|
@@ -14305,6 +14511,7 @@ function validateLayer(options) {
|
|
|
14305
14511
|
layer,
|
|
14306
14512
|
key: options.key,
|
|
14307
14513
|
value: options.value,
|
|
14514
|
+
valueSpec: {},
|
|
14308
14515
|
style: options.style,
|
|
14309
14516
|
styleSpec: options.styleSpec,
|
|
14310
14517
|
objectElementValidators: {
|
|
@@ -14319,6 +14526,7 @@ function validateLayer(options) {
|
|
|
14319
14526
|
layer,
|
|
14320
14527
|
key: options.key,
|
|
14321
14528
|
value: options.value,
|
|
14529
|
+
valueSpec: {},
|
|
14322
14530
|
style: options.style,
|
|
14323
14531
|
styleSpec: options.styleSpec,
|
|
14324
14532
|
objectElementValidators: {
|
|
@@ -14537,7 +14745,7 @@ function validateTerrain(options) {
|
|
|
14537
14745
|
if (!source) {
|
|
14538
14746
|
errors.push(new ValidationError(key, terrain.source, `source "${ terrain.source }" not found`));
|
|
14539
14747
|
} else if (sourceType !== 'raster-dem') {
|
|
14540
|
-
errors.push(new ValidationError(key, terrain.source, `terrain cannot be used with a source of type ${ sourceType }, it only be used with a "raster-dem" source type`));
|
|
14748
|
+
errors.push(new ValidationError(key, terrain.source, `terrain cannot be used with a source of type ${ String(sourceType) }, it only be used with a "raster-dem" source type`));
|
|
14541
14749
|
}
|
|
14542
14750
|
}
|
|
14543
14751
|
return errors;
|
|
@@ -14644,7 +14852,7 @@ function validate(options) {
|
|
|
14644
14852
|
const value = options.value;
|
|
14645
14853
|
const valueSpec = options.valueSpec;
|
|
14646
14854
|
const styleSpec = options.styleSpec;
|
|
14647
|
-
if (valueSpec.expression && isFunction
|
|
14855
|
+
if (valueSpec.expression && isFunction(unbundle(value))) {
|
|
14648
14856
|
return validateFunction(options);
|
|
14649
14857
|
} else if (valueSpec.expression && isExpression(deepUnbundle(value))) {
|
|
14650
14858
|
return validateExpression(options);
|
|
@@ -14671,7 +14879,7 @@ function validateGlyphsURL (options) {
|
|
|
14671
14879
|
return errors;
|
|
14672
14880
|
}
|
|
14673
14881
|
|
|
14674
|
-
function validateStyle(style, styleSpec = v8) {
|
|
14882
|
+
function validateStyle$1(style, styleSpec = v8) {
|
|
14675
14883
|
const errors = validate({
|
|
14676
14884
|
key: '',
|
|
14677
14885
|
value: style,
|
|
@@ -14686,7 +14894,7 @@ function validateStyle(style, styleSpec = v8) {
|
|
|
14686
14894
|
return sortErrors(errors);
|
|
14687
14895
|
}
|
|
14688
14896
|
function sortErrors(errors) {
|
|
14689
|
-
return errors.slice().sort((a, b) => a.line - b.line);
|
|
14897
|
+
return errors.slice().sort((a, b) => a.line && b.line ? a.line - b.line : 0);
|
|
14690
14898
|
}
|
|
14691
14899
|
|
|
14692
14900
|
/* parser generated by jison 0.4.15 */
|
|
@@ -15348,25 +15556,27 @@ exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
|
|
15348
15556
|
}
|
|
15349
15557
|
});
|
|
15350
15558
|
|
|
15559
|
+
var jsonlint$1 = jsonlint;
|
|
15560
|
+
|
|
15351
15561
|
function readStyle(style) {
|
|
15352
15562
|
if (style instanceof String || typeof style === 'string' || style instanceof Buffer) {
|
|
15353
15563
|
try {
|
|
15354
|
-
return jsonlint.parse(style.toString());
|
|
15564
|
+
return jsonlint$1.parse(style.toString());
|
|
15355
15565
|
} catch (e) {
|
|
15356
|
-
throw new ParsingError
|
|
15566
|
+
throw new ParsingError(e);
|
|
15357
15567
|
}
|
|
15358
15568
|
}
|
|
15359
15569
|
return style;
|
|
15360
15570
|
}
|
|
15361
15571
|
|
|
15362
|
-
function validateStyle
|
|
15572
|
+
function validateStyle(style, styleSpec = v8) {
|
|
15363
15573
|
let s = style;
|
|
15364
15574
|
try {
|
|
15365
15575
|
s = readStyle(s);
|
|
15366
15576
|
} catch (e) {
|
|
15367
15577
|
return [e];
|
|
15368
15578
|
}
|
|
15369
|
-
return validateStyle(s, styleSpec);
|
|
15579
|
+
return validateStyle$1(s, styleSpec);
|
|
15370
15580
|
}
|
|
15371
15581
|
|
|
15372
15582
|
const SUPPORTED_SPEC_VERSION = 8;
|
|
@@ -15475,14 +15685,14 @@ function validateMapboxApiSupported(style) {
|
|
|
15475
15685
|
} catch (e) {
|
|
15476
15686
|
return [e];
|
|
15477
15687
|
}
|
|
15478
|
-
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)));
|
|
15479
15689
|
if (s.sources) {
|
|
15480
15690
|
errors = errors.concat(getSourcesErrors(s.sources));
|
|
15481
15691
|
}
|
|
15482
15692
|
return errors;
|
|
15483
15693
|
}
|
|
15484
15694
|
|
|
15485
|
-
const expression
|
|
15695
|
+
const expression = {
|
|
15486
15696
|
StyleExpression,
|
|
15487
15697
|
isExpression,
|
|
15488
15698
|
isExpressionFilter,
|
|
@@ -15496,7 +15706,7 @@ const expression$1 = {
|
|
|
15496
15706
|
const styleFunction = {
|
|
15497
15707
|
convertFunction,
|
|
15498
15708
|
createFunction,
|
|
15499
|
-
isFunction
|
|
15709
|
+
isFunction
|
|
15500
15710
|
};
|
|
15501
15711
|
const visit = {
|
|
15502
15712
|
eachSource,
|
|
@@ -15504,5 +15714,5 @@ const visit = {
|
|
|
15504
15714
|
eachProperty
|
|
15505
15715
|
};
|
|
15506
15716
|
|
|
15507
|
-
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 };
|
|
15508
15718
|
//# sourceMappingURL=index.es.js.map
|