@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.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.mapboxGlStyleSpecification = {}));
|
|
5
|
-
}(this, (function (exports) { 'use strict';
|
|
5
|
+
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var $version = 8;
|
|
8
8
|
var $root = {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
fog: {
|
|
70
70
|
type: "fog",
|
|
71
|
-
doc: "A global effect that fades layers and markers based on their distance to the camera. The fog can be used to approximate the effect of atmosphere on distant objects and enhance the depth perception of the map when used with terrain or 3D features."
|
|
71
|
+
doc: "A global effect that fades layers and markers based on their distance to the camera. The fog can be used to approximate the effect of atmosphere on distant objects and enhance the depth perception of the map when used with terrain or 3D features. Note: fog is renamed to atmosphere in the Android and iOS SDKs and planned to be changed in GL-JS v.3.0.0."
|
|
72
72
|
},
|
|
73
73
|
sources: {
|
|
74
74
|
required: true,
|
|
@@ -2642,7 +2642,7 @@
|
|
|
2642
2642
|
length: 2,
|
|
2643
2643
|
doc: "Zoom level and value pair."
|
|
2644
2644
|
};
|
|
2645
|
-
var expression = {
|
|
2645
|
+
var expression$1 = {
|
|
2646
2646
|
type: "array",
|
|
2647
2647
|
value: "*",
|
|
2648
2648
|
minimum: 1,
|
|
@@ -3747,7 +3747,9 @@
|
|
|
3747
3747
|
],
|
|
3748
3748
|
"sdk-support": {
|
|
3749
3749
|
"basic functionality": {
|
|
3750
|
-
js: "2.3.0"
|
|
3750
|
+
js: "2.3.0",
|
|
3751
|
+
android: "10.6.0",
|
|
3752
|
+
ios: "10.6.0"
|
|
3751
3753
|
}
|
|
3752
3754
|
}
|
|
3753
3755
|
},
|
|
@@ -3762,17 +3764,83 @@
|
|
|
3762
3764
|
]
|
|
3763
3765
|
},
|
|
3764
3766
|
transition: true,
|
|
3765
|
-
doc: "The color of the
|
|
3767
|
+
doc: "The color of the atmosphere region immediately below the horizon and within the `range` and above the horizon and within `horizon-blend`. Using opacity is recommended only for smoothly transitioning fog on/off as anything less than 100% opacity results in more tiles loaded and drawn.",
|
|
3766
3768
|
"sdk-support": {
|
|
3767
3769
|
"basic functionality": {
|
|
3768
|
-
js: "2.3.0"
|
|
3770
|
+
js: "2.3.0",
|
|
3771
|
+
android: "10.6.0",
|
|
3772
|
+
ios: "10.6.0"
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3775
|
+
},
|
|
3776
|
+
"high-color": {
|
|
3777
|
+
type: "color",
|
|
3778
|
+
"property-type": "data-constant",
|
|
3779
|
+
"default": "#245cdf",
|
|
3780
|
+
expression: {
|
|
3781
|
+
interpolated: true,
|
|
3782
|
+
parameters: [
|
|
3783
|
+
"zoom"
|
|
3784
|
+
]
|
|
3785
|
+
},
|
|
3786
|
+
transition: true,
|
|
3787
|
+
doc: "The color of the atmosphere region above the horizon, `high-color` extends further above the horizon than the `color` property and its spread can be controlled with `horizon-blend`. The opacity can be set to `0` to remove the high atmosphere color contribution.",
|
|
3788
|
+
"sdk-support": {
|
|
3789
|
+
"basic functionality": {
|
|
3790
|
+
js: "2.9.0",
|
|
3791
|
+
android: "10.6.0",
|
|
3792
|
+
ios: "10.6.0"
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
},
|
|
3796
|
+
"space-color": {
|
|
3797
|
+
type: "color",
|
|
3798
|
+
"property-type": "data-constant",
|
|
3799
|
+
"default": [
|
|
3800
|
+
"interpolate",
|
|
3801
|
+
[
|
|
3802
|
+
"linear"
|
|
3803
|
+
],
|
|
3804
|
+
[
|
|
3805
|
+
"zoom"
|
|
3806
|
+
],
|
|
3807
|
+
4,
|
|
3808
|
+
"#010b19",
|
|
3809
|
+
7,
|
|
3810
|
+
"#367ab9"
|
|
3811
|
+
],
|
|
3812
|
+
expression: {
|
|
3813
|
+
interpolated: true,
|
|
3814
|
+
parameters: [
|
|
3815
|
+
"zoom"
|
|
3816
|
+
]
|
|
3817
|
+
},
|
|
3818
|
+
transition: true,
|
|
3819
|
+
doc: "The color of the region above the horizon and after the end of the `horizon-blend` contribution. The opacity can be set to `0` to have a transparent background.",
|
|
3820
|
+
"sdk-support": {
|
|
3821
|
+
"basic functionality": {
|
|
3822
|
+
js: "2.9.0",
|
|
3823
|
+
android: "10.6.0",
|
|
3824
|
+
ios: "10.6.0"
|
|
3769
3825
|
}
|
|
3770
3826
|
}
|
|
3771
3827
|
},
|
|
3772
3828
|
"horizon-blend": {
|
|
3773
3829
|
type: "number",
|
|
3774
3830
|
"property-type": "data-constant",
|
|
3775
|
-
"default":
|
|
3831
|
+
"default": [
|
|
3832
|
+
"interpolate",
|
|
3833
|
+
[
|
|
3834
|
+
"linear"
|
|
3835
|
+
],
|
|
3836
|
+
[
|
|
3837
|
+
"zoom"
|
|
3838
|
+
],
|
|
3839
|
+
4,
|
|
3840
|
+
0.2,
|
|
3841
|
+
7,
|
|
3842
|
+
0.1
|
|
3843
|
+
],
|
|
3776
3844
|
minimum: 0,
|
|
3777
3845
|
maximum: 1,
|
|
3778
3846
|
expression: {
|
|
@@ -3782,10 +3850,46 @@
|
|
|
3782
3850
|
]
|
|
3783
3851
|
},
|
|
3784
3852
|
transition: true,
|
|
3785
|
-
doc: "Horizon blend applies a smooth fade from the color of the
|
|
3853
|
+
doc: "Horizon blend applies a smooth fade from the color of the atmosphere to the color of space. A value of zero leaves a sharp transition from atmosphere to space. Increasing the value blends the color of atmosphere into increasingly high angles of the sky.",
|
|
3786
3854
|
"sdk-support": {
|
|
3787
3855
|
"basic functionality": {
|
|
3788
|
-
js: "2.3.0"
|
|
3856
|
+
js: "2.3.0",
|
|
3857
|
+
android: "10.6.0",
|
|
3858
|
+
ios: "10.6.0"
|
|
3859
|
+
}
|
|
3860
|
+
}
|
|
3861
|
+
},
|
|
3862
|
+
"star-intensity": {
|
|
3863
|
+
type: "number",
|
|
3864
|
+
"property-type": "data-constant",
|
|
3865
|
+
"default": [
|
|
3866
|
+
"interpolate",
|
|
3867
|
+
[
|
|
3868
|
+
"linear"
|
|
3869
|
+
],
|
|
3870
|
+
[
|
|
3871
|
+
"zoom"
|
|
3872
|
+
],
|
|
3873
|
+
5,
|
|
3874
|
+
0.35,
|
|
3875
|
+
6,
|
|
3876
|
+
0
|
|
3877
|
+
],
|
|
3878
|
+
minimum: 0,
|
|
3879
|
+
maximum: 1,
|
|
3880
|
+
expression: {
|
|
3881
|
+
interpolated: true,
|
|
3882
|
+
parameters: [
|
|
3883
|
+
"zoom"
|
|
3884
|
+
]
|
|
3885
|
+
},
|
|
3886
|
+
transition: true,
|
|
3887
|
+
doc: "A value controlling the star intensity where `0` will show no stars and `1` will show stars at their maximum intensity.",
|
|
3888
|
+
"sdk-support": {
|
|
3889
|
+
"basic functionality": {
|
|
3890
|
+
js: "2.9.0",
|
|
3891
|
+
android: "10.6.0",
|
|
3892
|
+
ios: "10.6.0"
|
|
3789
3893
|
}
|
|
3790
3894
|
}
|
|
3791
3895
|
}
|
|
@@ -4014,6 +4118,9 @@
|
|
|
4014
4118
|
},
|
|
4015
4119
|
transition: true,
|
|
4016
4120
|
doc: "Exaggerates the elevation of the terrain by multiplying the data from the DEM with this value.",
|
|
4121
|
+
requires: [
|
|
4122
|
+
"source"
|
|
4123
|
+
],
|
|
4017
4124
|
"sdk-support": {
|
|
4018
4125
|
"basic functionality": {
|
|
4019
4126
|
js: "2.0.0",
|
|
@@ -4581,6 +4688,35 @@
|
|
|
4581
4688
|
]
|
|
4582
4689
|
},
|
|
4583
4690
|
"property-type": "color-ramp"
|
|
4691
|
+
},
|
|
4692
|
+
"line-trim-offset": {
|
|
4693
|
+
type: "array",
|
|
4694
|
+
value: "number",
|
|
4695
|
+
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.",
|
|
4696
|
+
length: 2,
|
|
4697
|
+
"default": [
|
|
4698
|
+
0,
|
|
4699
|
+
0
|
|
4700
|
+
],
|
|
4701
|
+
transition: false,
|
|
4702
|
+
requires: [
|
|
4703
|
+
"line-gradient",
|
|
4704
|
+
{
|
|
4705
|
+
source: "geojson",
|
|
4706
|
+
has: {
|
|
4707
|
+
lineMetrics: true
|
|
4708
|
+
}
|
|
4709
|
+
}
|
|
4710
|
+
],
|
|
4711
|
+
"sdk-support": {
|
|
4712
|
+
"basic functionality": {
|
|
4713
|
+
js: "2.3.0",
|
|
4714
|
+
android: "10.5.0",
|
|
4715
|
+
ios: "10.5.0",
|
|
4716
|
+
macos: "10.5.0"
|
|
4717
|
+
}
|
|
4718
|
+
},
|
|
4719
|
+
"property-type": "constant"
|
|
4584
4720
|
}
|
|
4585
4721
|
};
|
|
4586
4722
|
var paint_circle = {
|
|
@@ -6326,7 +6462,7 @@
|
|
|
6326
6462
|
}
|
|
6327
6463
|
},
|
|
6328
6464
|
function_stop: function_stop,
|
|
6329
|
-
expression: expression,
|
|
6465
|
+
expression: expression$1,
|
|
6330
6466
|
expression_name: expression_name,
|
|
6331
6467
|
fog: fog,
|
|
6332
6468
|
light: light,
|
|
@@ -6700,6 +6836,8 @@
|
|
|
6700
6836
|
})(passedObj, "", 0);
|
|
6701
6837
|
};
|
|
6702
6838
|
|
|
6839
|
+
var stringifyPretty = jsonStringifyPrettyCompact;
|
|
6840
|
+
|
|
6703
6841
|
function sortKeysBy(obj, reference) {
|
|
6704
6842
|
const result = {};
|
|
6705
6843
|
for (const key in reference) {
|
|
@@ -6714,12 +6852,12 @@
|
|
|
6714
6852
|
}
|
|
6715
6853
|
return result;
|
|
6716
6854
|
}
|
|
6717
|
-
function format(style, space = 2) {
|
|
6855
|
+
function format$1(style, space = 2) {
|
|
6718
6856
|
style = sortKeysBy(style, v8.$root);
|
|
6719
6857
|
if (style.layers) {
|
|
6720
6858
|
style.layers = style.layers.map(layer => sortKeysBy(layer, v8.layer));
|
|
6721
6859
|
}
|
|
6722
|
-
return
|
|
6860
|
+
return stringifyPretty(style, { indent: space });
|
|
6723
6861
|
}
|
|
6724
6862
|
|
|
6725
6863
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -7387,7 +7525,7 @@
|
|
|
7387
7525
|
var parse = urlParse;
|
|
7388
7526
|
var resolve = urlResolve;
|
|
7389
7527
|
var resolveObject = urlResolveObject;
|
|
7390
|
-
var format
|
|
7528
|
+
var format = urlFormat;
|
|
7391
7529
|
|
|
7392
7530
|
var Url_1 = Url;
|
|
7393
7531
|
|
|
@@ -8094,7 +8232,7 @@
|
|
|
8094
8232
|
parse: parse,
|
|
8095
8233
|
resolve: resolve,
|
|
8096
8234
|
resolveObject: resolveObject,
|
|
8097
|
-
format: format
|
|
8235
|
+
format: format,
|
|
8098
8236
|
Url: Url_1
|
|
8099
8237
|
};
|
|
8100
8238
|
|
|
@@ -8175,7 +8313,7 @@
|
|
|
8175
8313
|
return value;
|
|
8176
8314
|
}
|
|
8177
8315
|
}
|
|
8178
|
-
function isFunction(value) {
|
|
8316
|
+
function isFunction$1(value) {
|
|
8179
8317
|
return Array.isArray(value.stops);
|
|
8180
8318
|
}
|
|
8181
8319
|
function renameProperty(obj, from, to) {
|
|
@@ -8217,7 +8355,7 @@
|
|
|
8217
8355
|
layout: true
|
|
8218
8356
|
}, property => {
|
|
8219
8357
|
const value = resolveConstant(style, property.value);
|
|
8220
|
-
if (isFunction(value)) {
|
|
8358
|
+
if (isFunction$1(value)) {
|
|
8221
8359
|
value.stops.forEach(stop => {
|
|
8222
8360
|
stop[1] = resolveConstant(style, stop[1]);
|
|
8223
8361
|
});
|
|
@@ -8308,13 +8446,14 @@
|
|
|
8308
8446
|
return output;
|
|
8309
8447
|
}
|
|
8310
8448
|
|
|
8311
|
-
class ParsingError extends Error {
|
|
8449
|
+
class ParsingError$1 extends Error {
|
|
8312
8450
|
constructor(key, message) {
|
|
8313
8451
|
super(message);
|
|
8314
8452
|
this.message = message;
|
|
8315
8453
|
this.key = key;
|
|
8316
8454
|
}
|
|
8317
8455
|
}
|
|
8456
|
+
var ParsingError$2 = ParsingError$1;
|
|
8318
8457
|
|
|
8319
8458
|
class Scope {
|
|
8320
8459
|
constructor(parent, bindings = []) {
|
|
@@ -8342,6 +8481,7 @@
|
|
|
8342
8481
|
return this.parent ? this.parent.has(name) : false;
|
|
8343
8482
|
}
|
|
8344
8483
|
}
|
|
8484
|
+
var Scope$1 = Scope;
|
|
8345
8485
|
|
|
8346
8486
|
const NullType = { kind: 'null' };
|
|
8347
8487
|
const NumberType = { kind: 'number' };
|
|
@@ -8354,16 +8494,16 @@
|
|
|
8354
8494
|
const CollatorType = { kind: 'collator' };
|
|
8355
8495
|
const FormattedType = { kind: 'formatted' };
|
|
8356
8496
|
const ResolvedImageType = { kind: 'resolvedImage' };
|
|
8357
|
-
function array(itemType, N) {
|
|
8497
|
+
function array$1(itemType, N) {
|
|
8358
8498
|
return {
|
|
8359
8499
|
kind: 'array',
|
|
8360
8500
|
itemType,
|
|
8361
8501
|
N
|
|
8362
8502
|
};
|
|
8363
8503
|
}
|
|
8364
|
-
function toString(type) {
|
|
8504
|
+
function toString$1(type) {
|
|
8365
8505
|
if (type.kind === 'array') {
|
|
8366
|
-
const itemType = toString(type.itemType);
|
|
8506
|
+
const itemType = toString$1(type.itemType);
|
|
8367
8507
|
return typeof type.N === 'number' ? `array<${ itemType }, ${ type.N }>` : type.itemType.kind === 'value' ? 'array' : `array<${ itemType }>`;
|
|
8368
8508
|
} else {
|
|
8369
8509
|
return type.kind;
|
|
@@ -8377,7 +8517,7 @@
|
|
|
8377
8517
|
ColorType,
|
|
8378
8518
|
FormattedType,
|
|
8379
8519
|
ObjectType,
|
|
8380
|
-
array(ValueType),
|
|
8520
|
+
array$1(ValueType),
|
|
8381
8521
|
ResolvedImageType
|
|
8382
8522
|
];
|
|
8383
8523
|
function checkSubtype(expected, t) {
|
|
@@ -8396,7 +8536,7 @@
|
|
|
8396
8536
|
}
|
|
8397
8537
|
}
|
|
8398
8538
|
}
|
|
8399
|
-
return `Expected ${ toString(expected) } but found ${ toString(t) } instead.`;
|
|
8539
|
+
return `Expected ${ toString$1(expected) } but found ${ toString$1(t) } instead.`;
|
|
8400
8540
|
}
|
|
8401
8541
|
function isValidType(provided, allowedTypes) {
|
|
8402
8542
|
return allowedTypes.some(t => t.kind === provided.kind);
|
|
@@ -8660,12 +8800,36 @@
|
|
|
8660
8800
|
a
|
|
8661
8801
|
];
|
|
8662
8802
|
}
|
|
8803
|
+
toArray01() {
|
|
8804
|
+
const {r, g, b, a} = this;
|
|
8805
|
+
return a === 0 ? [
|
|
8806
|
+
0,
|
|
8807
|
+
0,
|
|
8808
|
+
0,
|
|
8809
|
+
0
|
|
8810
|
+
] : [
|
|
8811
|
+
r / a,
|
|
8812
|
+
g / a,
|
|
8813
|
+
b / a,
|
|
8814
|
+
a
|
|
8815
|
+
];
|
|
8816
|
+
}
|
|
8817
|
+
toArray01PremultipliedAlpha() {
|
|
8818
|
+
const {r, g, b, a} = this;
|
|
8819
|
+
return [
|
|
8820
|
+
r,
|
|
8821
|
+
g,
|
|
8822
|
+
b,
|
|
8823
|
+
a
|
|
8824
|
+
];
|
|
8825
|
+
}
|
|
8663
8826
|
}
|
|
8664
8827
|
Color.black = new Color(0, 0, 0, 1);
|
|
8665
8828
|
Color.white = new Color(1, 1, 1, 1);
|
|
8666
8829
|
Color.transparent = new Color(0, 0, 0, 0);
|
|
8667
8830
|
Color.red = new Color(1, 0, 0, 1);
|
|
8668
8831
|
Color.blue = new Color(0, 0, 1, 1);
|
|
8832
|
+
var Color$1 = Color;
|
|
8669
8833
|
|
|
8670
8834
|
class Collator {
|
|
8671
8835
|
constructor(caseSensitive, diacriticSensitive, locale) {
|
|
@@ -8807,7 +8971,7 @@
|
|
|
8807
8971
|
return true;
|
|
8808
8972
|
} else if (typeof mixed === 'number') {
|
|
8809
8973
|
return true;
|
|
8810
|
-
} else if (mixed instanceof Color) {
|
|
8974
|
+
} else if (mixed instanceof Color$1) {
|
|
8811
8975
|
return true;
|
|
8812
8976
|
} else if (mixed instanceof Collator) {
|
|
8813
8977
|
return true;
|
|
@@ -8842,7 +9006,7 @@
|
|
|
8842
9006
|
return BooleanType;
|
|
8843
9007
|
} else if (typeof value === 'number') {
|
|
8844
9008
|
return NumberType;
|
|
8845
|
-
} else if (value instanceof Color) {
|
|
9009
|
+
} else if (value instanceof Color$1) {
|
|
8846
9010
|
return ColorType;
|
|
8847
9011
|
} else if (value instanceof Collator) {
|
|
8848
9012
|
return CollatorType;
|
|
@@ -8864,18 +9028,18 @@
|
|
|
8864
9028
|
break;
|
|
8865
9029
|
}
|
|
8866
9030
|
}
|
|
8867
|
-
return array(itemType || ValueType, length);
|
|
9031
|
+
return array$1(itemType || ValueType, length);
|
|
8868
9032
|
} else {
|
|
8869
9033
|
return ObjectType;
|
|
8870
9034
|
}
|
|
8871
9035
|
}
|
|
8872
|
-
function toString
|
|
9036
|
+
function toString(value) {
|
|
8873
9037
|
const type = typeof value;
|
|
8874
9038
|
if (value === null) {
|
|
8875
9039
|
return '';
|
|
8876
9040
|
} else if (type === 'string' || type === 'number' || type === 'boolean') {
|
|
8877
9041
|
return String(value);
|
|
8878
|
-
} else if (value instanceof Color || value instanceof Formatted || value instanceof ResolvedImage) {
|
|
9042
|
+
} else if (value instanceof Color$1 || value instanceof Formatted || value instanceof ResolvedImage) {
|
|
8879
9043
|
return value.toString();
|
|
8880
9044
|
} else {
|
|
8881
9045
|
return JSON.stringify(value);
|
|
@@ -8914,7 +9078,7 @@
|
|
|
8914
9078
|
'literal',
|
|
8915
9079
|
this.value
|
|
8916
9080
|
];
|
|
8917
|
-
} else if (this.value instanceof Color) {
|
|
9081
|
+
} else if (this.value instanceof Color$1) {
|
|
8918
9082
|
return ['rgba'].concat(this.value.toArray());
|
|
8919
9083
|
} else if (this.value instanceof Formatted) {
|
|
8920
9084
|
return this.value.serialize();
|
|
@@ -8923,6 +9087,7 @@
|
|
|
8923
9087
|
}
|
|
8924
9088
|
}
|
|
8925
9089
|
}
|
|
9090
|
+
var Literal$1 = Literal;
|
|
8926
9091
|
|
|
8927
9092
|
class RuntimeError {
|
|
8928
9093
|
constructor(message) {
|
|
@@ -8933,8 +9098,9 @@
|
|
|
8933
9098
|
return this.message;
|
|
8934
9099
|
}
|
|
8935
9100
|
}
|
|
9101
|
+
var RuntimeError$1 = RuntimeError;
|
|
8936
9102
|
|
|
8937
|
-
const types = {
|
|
9103
|
+
const types$1 = {
|
|
8938
9104
|
string: StringType,
|
|
8939
9105
|
number: NumberType,
|
|
8940
9106
|
boolean: BooleanType,
|
|
@@ -8955,9 +9121,9 @@
|
|
|
8955
9121
|
let itemType;
|
|
8956
9122
|
if (args.length > 2) {
|
|
8957
9123
|
const type = args[1];
|
|
8958
|
-
if (typeof type !== 'string' || !(type in types) || type === 'object')
|
|
9124
|
+
if (typeof type !== 'string' || !(type in types$1) || type === 'object')
|
|
8959
9125
|
return context.error('The item type argument of "array" must be one of string, number, boolean', 1);
|
|
8960
|
-
itemType = types[type];
|
|
9126
|
+
itemType = types$1[type];
|
|
8961
9127
|
i++;
|
|
8962
9128
|
} else {
|
|
8963
9129
|
itemType = ValueType;
|
|
@@ -8970,9 +9136,9 @@
|
|
|
8970
9136
|
N = args[2];
|
|
8971
9137
|
i++;
|
|
8972
9138
|
}
|
|
8973
|
-
type = array(itemType, N);
|
|
9139
|
+
type = array$1(itemType, N);
|
|
8974
9140
|
} else {
|
|
8975
|
-
type = types[name];
|
|
9141
|
+
type = types$1[name];
|
|
8976
9142
|
}
|
|
8977
9143
|
const parsed = [];
|
|
8978
9144
|
for (; i < args.length; i++) {
|
|
@@ -8990,7 +9156,7 @@
|
|
|
8990
9156
|
if (!error) {
|
|
8991
9157
|
return value;
|
|
8992
9158
|
} else if (i === this.args.length - 1) {
|
|
8993
|
-
throw new RuntimeError(`Expected value to be of type ${ toString(this.type) }, but found ${ toString(typeOf(value)) } instead.`);
|
|
9159
|
+
throw new RuntimeError$1(`Expected value to be of type ${ toString$1(this.type) }, but found ${ toString$1(typeOf(value)) } instead.`);
|
|
8994
9160
|
}
|
|
8995
9161
|
}
|
|
8996
9162
|
return null;
|
|
@@ -9017,6 +9183,7 @@
|
|
|
9017
9183
|
return serialized.concat(this.args.map(arg => arg.serialize()));
|
|
9018
9184
|
}
|
|
9019
9185
|
}
|
|
9186
|
+
var Assertion$1 = Assertion;
|
|
9020
9187
|
|
|
9021
9188
|
class FormatExpression {
|
|
9022
9189
|
constructor(sections) {
|
|
@@ -9045,7 +9212,7 @@
|
|
|
9045
9212
|
}
|
|
9046
9213
|
let font = null;
|
|
9047
9214
|
if (arg['text-font']) {
|
|
9048
|
-
font = context.parse(arg['text-font'], 1, array(StringType));
|
|
9215
|
+
font = context.parse(arg['text-font'], 1, array$1(StringType));
|
|
9049
9216
|
if (!font)
|
|
9050
9217
|
return null;
|
|
9051
9218
|
}
|
|
@@ -9083,7 +9250,7 @@
|
|
|
9083
9250
|
if (typeOf(evaluatedContent) === ResolvedImageType) {
|
|
9084
9251
|
return new FormattedSection('', evaluatedContent, null, null, null);
|
|
9085
9252
|
}
|
|
9086
|
-
return new FormattedSection(toString
|
|
9253
|
+
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);
|
|
9087
9254
|
};
|
|
9088
9255
|
return new Formatted(this.sections.map(evaluateSection));
|
|
9089
9256
|
}
|
|
@@ -9159,7 +9326,7 @@
|
|
|
9159
9326
|
}
|
|
9160
9327
|
}
|
|
9161
9328
|
|
|
9162
|
-
const types
|
|
9329
|
+
const types = {
|
|
9163
9330
|
'to-boolean': BooleanType,
|
|
9164
9331
|
'to-color': ColorType,
|
|
9165
9332
|
'to-number': NumberType,
|
|
@@ -9176,7 +9343,7 @@
|
|
|
9176
9343
|
const name = args[0];
|
|
9177
9344
|
if ((name === 'to-boolean' || name === 'to-string') && args.length !== 2)
|
|
9178
9345
|
return context.error(`Expected one argument.`);
|
|
9179
|
-
const type = types
|
|
9346
|
+
const type = types[name];
|
|
9180
9347
|
const parsed = [];
|
|
9181
9348
|
for (let i = 1; i < args.length; i++) {
|
|
9182
9349
|
const input = context.parse(args[i], i, ValueType);
|
|
@@ -9195,7 +9362,7 @@
|
|
|
9195
9362
|
for (const arg of this.args) {
|
|
9196
9363
|
input = arg.evaluate(ctx);
|
|
9197
9364
|
error = null;
|
|
9198
|
-
if (input instanceof Color) {
|
|
9365
|
+
if (input instanceof Color$1) {
|
|
9199
9366
|
return input;
|
|
9200
9367
|
} else if (typeof input === 'string') {
|
|
9201
9368
|
const c = ctx.parseColor(input);
|
|
@@ -9208,11 +9375,11 @@
|
|
|
9208
9375
|
error = validateRGBA(input[0], input[1], input[2], input[3]);
|
|
9209
9376
|
}
|
|
9210
9377
|
if (!error) {
|
|
9211
|
-
return new Color(input[0] / 255, input[1] / 255, input[2] / 255, input[3]);
|
|
9378
|
+
return new Color$1(input[0] / 255, input[1] / 255, input[2] / 255, input[3]);
|
|
9212
9379
|
}
|
|
9213
9380
|
}
|
|
9214
9381
|
}
|
|
9215
|
-
throw new RuntimeError(error || `Could not parse color from value '${ typeof input === 'string' ? input : String(JSON.stringify(input)) }'`);
|
|
9382
|
+
throw new RuntimeError$1(error || `Could not parse color from value '${ typeof input === 'string' ? input : String(JSON.stringify(input)) }'`);
|
|
9216
9383
|
} else if (this.type.kind === 'number') {
|
|
9217
9384
|
let value = null;
|
|
9218
9385
|
for (const arg of this.args) {
|
|
@@ -9224,13 +9391,13 @@
|
|
|
9224
9391
|
continue;
|
|
9225
9392
|
return num;
|
|
9226
9393
|
}
|
|
9227
|
-
throw new RuntimeError(`Could not convert ${ JSON.stringify(value) } to number.`);
|
|
9394
|
+
throw new RuntimeError$1(`Could not convert ${ JSON.stringify(value) } to number.`);
|
|
9228
9395
|
} else if (this.type.kind === 'formatted') {
|
|
9229
|
-
return Formatted.fromString(toString
|
|
9396
|
+
return Formatted.fromString(toString(this.args[0].evaluate(ctx)));
|
|
9230
9397
|
} else if (this.type.kind === 'resolvedImage') {
|
|
9231
|
-
return ResolvedImage.fromString(toString
|
|
9398
|
+
return ResolvedImage.fromString(toString(this.args[0].evaluate(ctx)));
|
|
9232
9399
|
} else {
|
|
9233
|
-
return toString
|
|
9400
|
+
return toString(this.args[0].evaluate(ctx));
|
|
9234
9401
|
}
|
|
9235
9402
|
}
|
|
9236
9403
|
eachChild(fn) {
|
|
@@ -9258,6 +9425,7 @@
|
|
|
9258
9425
|
return serialized;
|
|
9259
9426
|
}
|
|
9260
9427
|
}
|
|
9428
|
+
var Coercion$1 = Coercion;
|
|
9261
9429
|
|
|
9262
9430
|
const geometryTypes = [
|
|
9263
9431
|
'Unknown',
|
|
@@ -9278,7 +9446,7 @@
|
|
|
9278
9446
|
this.featureDistanceData = null;
|
|
9279
9447
|
}
|
|
9280
9448
|
id() {
|
|
9281
|
-
return this.feature && 'id' in this.feature ? this.feature.id : null;
|
|
9449
|
+
return this.feature && 'id' in this.feature && this.feature.id ? this.feature.id : null;
|
|
9282
9450
|
}
|
|
9283
9451
|
geometryType() {
|
|
9284
9452
|
return this.feature ? typeof this.feature.type === 'number' ? geometryTypes[this.feature.type] : this.feature.type : null;
|
|
@@ -9309,11 +9477,12 @@
|
|
|
9309
9477
|
parseColor(input) {
|
|
9310
9478
|
let cached = this._parseColorCache[input];
|
|
9311
9479
|
if (!cached) {
|
|
9312
|
-
cached = this._parseColorCache[input] = Color.parse(input);
|
|
9480
|
+
cached = this._parseColorCache[input] = Color$1.parse(input);
|
|
9313
9481
|
}
|
|
9314
9482
|
return cached;
|
|
9315
9483
|
}
|
|
9316
9484
|
}
|
|
9485
|
+
var EvaluationContext$1 = EvaluationContext;
|
|
9317
9486
|
|
|
9318
9487
|
class CompoundExpression {
|
|
9319
9488
|
constructor(name, type, evaluate, args) {
|
|
@@ -9348,7 +9517,7 @@
|
|
|
9348
9517
|
const overloads = availableOverloads.filter(([signature]) => !Array.isArray(signature) || signature.length === args.length - 1);
|
|
9349
9518
|
let signatureContext = null;
|
|
9350
9519
|
for (const [params, evaluate] of overloads) {
|
|
9351
|
-
signatureContext = new ParsingContext(context.registry, context.path, null, context.scope);
|
|
9520
|
+
signatureContext = new ParsingContext$1(context.registry, context.path, null, context.scope);
|
|
9352
9521
|
const parsedArgs = [];
|
|
9353
9522
|
let argParseFailed = false;
|
|
9354
9523
|
for (let i = 1; i < args.length; i++) {
|
|
@@ -9389,7 +9558,7 @@
|
|
|
9389
9558
|
const parsed = context.parse(args[i], 1 + actualTypes.length);
|
|
9390
9559
|
if (!parsed)
|
|
9391
9560
|
return null;
|
|
9392
|
-
actualTypes.push(toString(parsed.type));
|
|
9561
|
+
actualTypes.push(toString$1(parsed.type));
|
|
9393
9562
|
}
|
|
9394
9563
|
context.error(`Expected arguments of type ${ signatures }, but found (${ actualTypes.join(', ') }) instead.`);
|
|
9395
9564
|
}
|
|
@@ -9404,11 +9573,12 @@
|
|
|
9404
9573
|
}
|
|
9405
9574
|
function stringifySignature(signature) {
|
|
9406
9575
|
if (Array.isArray(signature)) {
|
|
9407
|
-
return `(${ signature.map(toString).join(', ') })`;
|
|
9576
|
+
return `(${ signature.map(toString$1).join(', ') })`;
|
|
9408
9577
|
} else {
|
|
9409
|
-
return `(${ toString(signature.type) }...)`;
|
|
9578
|
+
return `(${ toString$1(signature.type) }...)`;
|
|
9410
9579
|
}
|
|
9411
9580
|
}
|
|
9581
|
+
var CompoundExpression$1 = CompoundExpression;
|
|
9412
9582
|
|
|
9413
9583
|
class CollatorExpression {
|
|
9414
9584
|
constructor(caseSensitive, diacriticSensitive, locale) {
|
|
@@ -9631,6 +9801,8 @@
|
|
|
9631
9801
|
canonical.y * EXTENT
|
|
9632
9802
|
];
|
|
9633
9803
|
const tilePoints = [];
|
|
9804
|
+
if (!geometry)
|
|
9805
|
+
return tilePoints;
|
|
9634
9806
|
for (const points of geometry) {
|
|
9635
9807
|
for (const point of points) {
|
|
9636
9808
|
const p = [
|
|
@@ -9650,6 +9822,8 @@
|
|
|
9650
9822
|
canonical.y * EXTENT
|
|
9651
9823
|
];
|
|
9652
9824
|
const tileLines = [];
|
|
9825
|
+
if (!geometry)
|
|
9826
|
+
return tileLines;
|
|
9653
9827
|
for (const line of geometry) {
|
|
9654
9828
|
const tileLine = [];
|
|
9655
9829
|
for (const point of line) {
|
|
@@ -9686,6 +9860,9 @@
|
|
|
9686
9860
|
-Infinity
|
|
9687
9861
|
];
|
|
9688
9862
|
const canonical = ctx.canonicalID();
|
|
9863
|
+
if (!canonical) {
|
|
9864
|
+
return false;
|
|
9865
|
+
}
|
|
9689
9866
|
if (polygonGeometry.type === 'Polygon') {
|
|
9690
9867
|
const tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);
|
|
9691
9868
|
const tilePoints = getTilePoints(ctx.geometry(), pointBBox, polyBBox, canonical);
|
|
@@ -9722,6 +9899,9 @@
|
|
|
9722
9899
|
-Infinity
|
|
9723
9900
|
];
|
|
9724
9901
|
const canonical = ctx.canonicalID();
|
|
9902
|
+
if (!canonical) {
|
|
9903
|
+
return false;
|
|
9904
|
+
}
|
|
9725
9905
|
if (polygonGeometry.type === 'Polygon') {
|
|
9726
9906
|
const tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);
|
|
9727
9907
|
const tileLines = getTileLines(ctx.geometry(), lineBBox, polyBBox, canonical);
|
|
@@ -9795,9 +9975,10 @@
|
|
|
9795
9975
|
];
|
|
9796
9976
|
}
|
|
9797
9977
|
}
|
|
9978
|
+
var Within$1 = Within;
|
|
9798
9979
|
|
|
9799
9980
|
function isFeatureConstant(e) {
|
|
9800
|
-
if (e instanceof CompoundExpression) {
|
|
9981
|
+
if (e instanceof CompoundExpression$1) {
|
|
9801
9982
|
if (e.name === 'get' && e.args.length === 1) {
|
|
9802
9983
|
return false;
|
|
9803
9984
|
} else if (e.name === 'feature-state') {
|
|
@@ -9810,7 +9991,7 @@
|
|
|
9810
9991
|
return false;
|
|
9811
9992
|
}
|
|
9812
9993
|
}
|
|
9813
|
-
if (e instanceof Within) {
|
|
9994
|
+
if (e instanceof Within$1) {
|
|
9814
9995
|
return false;
|
|
9815
9996
|
}
|
|
9816
9997
|
let result = true;
|
|
@@ -9822,7 +10003,7 @@
|
|
|
9822
10003
|
return result;
|
|
9823
10004
|
}
|
|
9824
10005
|
function isStateConstant(e) {
|
|
9825
|
-
if (e instanceof CompoundExpression) {
|
|
10006
|
+
if (e instanceof CompoundExpression$1) {
|
|
9826
10007
|
if (e.name === 'feature-state') {
|
|
9827
10008
|
return false;
|
|
9828
10009
|
}
|
|
@@ -9836,7 +10017,7 @@
|
|
|
9836
10017
|
return result;
|
|
9837
10018
|
}
|
|
9838
10019
|
function isGlobalPropertyConstant(e, properties) {
|
|
9839
|
-
if (e instanceof CompoundExpression && properties.indexOf(e.name) >= 0) {
|
|
10020
|
+
if (e instanceof CompoundExpression$1 && properties.indexOf(e.name) >= 0) {
|
|
9840
10021
|
return false;
|
|
9841
10022
|
}
|
|
9842
10023
|
let result = true;
|
|
@@ -9878,9 +10059,10 @@
|
|
|
9878
10059
|
];
|
|
9879
10060
|
}
|
|
9880
10061
|
}
|
|
10062
|
+
var Var$1 = Var;
|
|
9881
10063
|
|
|
9882
10064
|
class ParsingContext {
|
|
9883
|
-
constructor(registry, path = [], expectedType, scope = new Scope(), errors = []) {
|
|
10065
|
+
constructor(registry, path = [], expectedType, scope = new Scope$1(), errors = []) {
|
|
9884
10066
|
this.registry = registry;
|
|
9885
10067
|
this.path = path;
|
|
9886
10068
|
this.key = path.map(part => `[${ part }]`).join('');
|
|
@@ -9903,9 +10085,9 @@
|
|
|
9903
10085
|
}
|
|
9904
10086
|
function annotate(parsed, type, typeAnnotation) {
|
|
9905
10087
|
if (typeAnnotation === 'assert') {
|
|
9906
|
-
return new Assertion(type, [parsed]);
|
|
10088
|
+
return new Assertion$1(type, [parsed]);
|
|
9907
10089
|
} else if (typeAnnotation === 'coerce') {
|
|
9908
|
-
return new Coercion(type, [parsed]);
|
|
10090
|
+
return new Coercion$1(type, [parsed]);
|
|
9909
10091
|
} else {
|
|
9910
10092
|
return parsed;
|
|
9911
10093
|
}
|
|
@@ -9935,10 +10117,10 @@
|
|
|
9935
10117
|
return null;
|
|
9936
10118
|
}
|
|
9937
10119
|
}
|
|
9938
|
-
if (!(parsed instanceof Literal) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
|
|
9939
|
-
const ec = new EvaluationContext();
|
|
10120
|
+
if (!(parsed instanceof Literal$1) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
|
|
10121
|
+
const ec = new EvaluationContext$1();
|
|
9940
10122
|
try {
|
|
9941
|
-
parsed = new Literal(parsed.type, parsed.evaluate(ec));
|
|
10123
|
+
parsed = new Literal$1(parsed.type, parsed.evaluate(ec));
|
|
9942
10124
|
} catch (e) {
|
|
9943
10125
|
this.error(e.message);
|
|
9944
10126
|
return null;
|
|
@@ -9962,7 +10144,7 @@
|
|
|
9962
10144
|
}
|
|
9963
10145
|
error(error, ...keys) {
|
|
9964
10146
|
const key = `${ this.key }${ keys.map(k => `[${ k }]`).join('') }`;
|
|
9965
|
-
this.errors.push(new ParsingError(key, error));
|
|
10147
|
+
this.errors.push(new ParsingError$2(key, error));
|
|
9966
10148
|
}
|
|
9967
10149
|
checkSubtype(expected, t) {
|
|
9968
10150
|
const error = checkSubtype(expected, t);
|
|
@@ -9971,23 +10153,24 @@
|
|
|
9971
10153
|
return error;
|
|
9972
10154
|
}
|
|
9973
10155
|
}
|
|
10156
|
+
var ParsingContext$1 = ParsingContext;
|
|
9974
10157
|
function isConstant(expression) {
|
|
9975
|
-
if (expression instanceof Var) {
|
|
10158
|
+
if (expression instanceof Var$1) {
|
|
9976
10159
|
return isConstant(expression.boundExpression);
|
|
9977
|
-
} else if (expression instanceof CompoundExpression && expression.name === 'error') {
|
|
10160
|
+
} else if (expression instanceof CompoundExpression$1 && expression.name === 'error') {
|
|
9978
10161
|
return false;
|
|
9979
10162
|
} else if (expression instanceof CollatorExpression) {
|
|
9980
10163
|
return false;
|
|
9981
|
-
} else if (expression instanceof Within) {
|
|
10164
|
+
} else if (expression instanceof Within$1) {
|
|
9982
10165
|
return false;
|
|
9983
10166
|
}
|
|
9984
|
-
const isTypeAnnotation = expression instanceof Coercion || expression instanceof Assertion;
|
|
10167
|
+
const isTypeAnnotation = expression instanceof Coercion$1 || expression instanceof Assertion$1;
|
|
9985
10168
|
let childrenConstant = true;
|
|
9986
10169
|
expression.eachChild(child => {
|
|
9987
10170
|
if (isTypeAnnotation) {
|
|
9988
10171
|
childrenConstant = childrenConstant && isConstant(child);
|
|
9989
10172
|
} else {
|
|
9990
|
-
childrenConstant = childrenConstant && child instanceof Literal;
|
|
10173
|
+
childrenConstant = childrenConstant && child instanceof Literal$1;
|
|
9991
10174
|
}
|
|
9992
10175
|
});
|
|
9993
10176
|
if (!childrenConstant) {
|
|
@@ -10023,7 +10206,7 @@
|
|
|
10023
10206
|
} else if (currentValue > input) {
|
|
10024
10207
|
upperIndex = currentIndex - 1;
|
|
10025
10208
|
} else {
|
|
10026
|
-
throw new RuntimeError('Input is not a number.');
|
|
10209
|
+
throw new RuntimeError$1('Input is not a number.');
|
|
10027
10210
|
}
|
|
10028
10211
|
}
|
|
10029
10212
|
return 0;
|
|
@@ -10117,6 +10300,7 @@
|
|
|
10117
10300
|
return serialized;
|
|
10118
10301
|
}
|
|
10119
10302
|
}
|
|
10303
|
+
var Step$1 = Step;
|
|
10120
10304
|
|
|
10121
10305
|
/*
|
|
10122
10306
|
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
|
@@ -10227,9 +10411,9 @@
|
|
|
10227
10411
|
return a * (1 - t) + b * t;
|
|
10228
10412
|
}
|
|
10229
10413
|
function color(from, to, t) {
|
|
10230
|
-
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));
|
|
10414
|
+
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));
|
|
10231
10415
|
}
|
|
10232
|
-
function array
|
|
10416
|
+
function array(from, to, t) {
|
|
10233
10417
|
return from.map((d, i) => {
|
|
10234
10418
|
return number(d, to[i], t);
|
|
10235
10419
|
});
|
|
@@ -10239,7 +10423,7 @@
|
|
|
10239
10423
|
__proto__: null,
|
|
10240
10424
|
number: number,
|
|
10241
10425
|
color: color,
|
|
10242
|
-
array: array
|
|
10426
|
+
array: array
|
|
10243
10427
|
});
|
|
10244
10428
|
|
|
10245
10429
|
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;
|
|
@@ -10270,7 +10454,7 @@
|
|
|
10270
10454
|
y = Yn * lab2xyz(y);
|
|
10271
10455
|
x = Xn * lab2xyz(x);
|
|
10272
10456
|
z = Zn * lab2xyz(z);
|
|
10273
|
-
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);
|
|
10457
|
+
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);
|
|
10274
10458
|
}
|
|
10275
10459
|
function interpolateLab(from, to, t) {
|
|
10276
10460
|
return {
|
|
@@ -10418,7 +10602,7 @@
|
|
|
10418
10602
|
]);
|
|
10419
10603
|
}
|
|
10420
10604
|
if (outputType.kind !== 'number' && outputType.kind !== 'color' && !(outputType.kind === 'array' && outputType.itemType.kind === 'number' && typeof outputType.N === 'number')) {
|
|
10421
|
-
return context.error(`Type ${ toString(outputType) } is not interpolatable.`);
|
|
10605
|
+
return context.error(`Type ${ toString$1(outputType) } is not interpolatable.`);
|
|
10422
10606
|
}
|
|
10423
10607
|
return new Interpolate(outputType, operator, interpolation, input, stops);
|
|
10424
10608
|
}
|
|
@@ -10497,6 +10681,7 @@
|
|
|
10497
10681
|
return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);
|
|
10498
10682
|
}
|
|
10499
10683
|
}
|
|
10684
|
+
var Interpolate$1 = Interpolate;
|
|
10500
10685
|
|
|
10501
10686
|
class Coalesce {
|
|
10502
10687
|
constructor(type, args) {
|
|
@@ -10558,6 +10743,7 @@
|
|
|
10558
10743
|
return serialized;
|
|
10559
10744
|
}
|
|
10560
10745
|
}
|
|
10746
|
+
var Coalesce$1 = Coalesce;
|
|
10561
10747
|
|
|
10562
10748
|
class Let {
|
|
10563
10749
|
constructor(bindings, result) {
|
|
@@ -10611,6 +10797,7 @@
|
|
|
10611
10797
|
return serialized;
|
|
10612
10798
|
}
|
|
10613
10799
|
}
|
|
10800
|
+
var Let$1 = Let;
|
|
10614
10801
|
|
|
10615
10802
|
class At {
|
|
10616
10803
|
constructor(type, index, input) {
|
|
@@ -10622,7 +10809,7 @@
|
|
|
10622
10809
|
if (args.length !== 3)
|
|
10623
10810
|
return context.error(`Expected 2 arguments, but found ${ args.length - 1 } instead.`);
|
|
10624
10811
|
const index = context.parse(args[1], 1, NumberType);
|
|
10625
|
-
const input = context.parse(args[2], 2, array(context.expectedType || ValueType));
|
|
10812
|
+
const input = context.parse(args[2], 2, array$1(context.expectedType || ValueType));
|
|
10626
10813
|
if (!index || !input)
|
|
10627
10814
|
return null;
|
|
10628
10815
|
const t = input.type;
|
|
@@ -10632,13 +10819,13 @@
|
|
|
10632
10819
|
const index = this.index.evaluate(ctx);
|
|
10633
10820
|
const array = this.input.evaluate(ctx);
|
|
10634
10821
|
if (index < 0) {
|
|
10635
|
-
throw new RuntimeError(`Array index out of bounds: ${ index } < 0.`);
|
|
10822
|
+
throw new RuntimeError$1(`Array index out of bounds: ${ index } < 0.`);
|
|
10636
10823
|
}
|
|
10637
10824
|
if (index >= array.length) {
|
|
10638
|
-
throw new RuntimeError(`Array index out of bounds: ${ index } > ${ array.length - 1 }.`);
|
|
10825
|
+
throw new RuntimeError$1(`Array index out of bounds: ${ index } > ${ array.length - 1 }.`);
|
|
10639
10826
|
}
|
|
10640
10827
|
if (index !== Math.floor(index)) {
|
|
10641
|
-
throw new RuntimeError(`Array index must be an integer, but found ${ index } instead.`);
|
|
10828
|
+
throw new RuntimeError$1(`Array index must be an integer, but found ${ index } instead.`);
|
|
10642
10829
|
}
|
|
10643
10830
|
return array[index];
|
|
10644
10831
|
}
|
|
@@ -10657,6 +10844,7 @@
|
|
|
10657
10844
|
];
|
|
10658
10845
|
}
|
|
10659
10846
|
}
|
|
10847
|
+
var At$1 = At;
|
|
10660
10848
|
|
|
10661
10849
|
class In {
|
|
10662
10850
|
constructor(needle, haystack) {
|
|
@@ -10679,7 +10867,7 @@
|
|
|
10679
10867
|
NullType,
|
|
10680
10868
|
ValueType
|
|
10681
10869
|
])) {
|
|
10682
|
-
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(needle.type) } instead`);
|
|
10870
|
+
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(needle.type) } instead`);
|
|
10683
10871
|
}
|
|
10684
10872
|
return new In(needle, haystack);
|
|
10685
10873
|
}
|
|
@@ -10694,13 +10882,13 @@
|
|
|
10694
10882
|
'number',
|
|
10695
10883
|
'null'
|
|
10696
10884
|
])) {
|
|
10697
|
-
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(typeOf(needle)) } instead.`);
|
|
10885
|
+
throw new RuntimeError$1(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
10698
10886
|
}
|
|
10699
10887
|
if (!isValidNativeType(haystack, [
|
|
10700
10888
|
'string',
|
|
10701
10889
|
'array'
|
|
10702
10890
|
])) {
|
|
10703
|
-
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString(typeOf(haystack)) } instead.`);
|
|
10891
|
+
throw new RuntimeError$1(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
10704
10892
|
}
|
|
10705
10893
|
return haystack.indexOf(needle) >= 0;
|
|
10706
10894
|
}
|
|
@@ -10719,6 +10907,7 @@
|
|
|
10719
10907
|
];
|
|
10720
10908
|
}
|
|
10721
10909
|
}
|
|
10910
|
+
var In$1 = In;
|
|
10722
10911
|
|
|
10723
10912
|
class IndexOf {
|
|
10724
10913
|
constructor(needle, haystack, fromIndex) {
|
|
@@ -10742,7 +10931,7 @@
|
|
|
10742
10931
|
NullType,
|
|
10743
10932
|
ValueType
|
|
10744
10933
|
])) {
|
|
10745
|
-
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(needle.type) } instead`);
|
|
10934
|
+
return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(needle.type) } instead`);
|
|
10746
10935
|
}
|
|
10747
10936
|
if (args.length === 4) {
|
|
10748
10937
|
const fromIndex = context.parse(args[3], 3, NumberType);
|
|
@@ -10762,13 +10951,13 @@
|
|
|
10762
10951
|
'number',
|
|
10763
10952
|
'null'
|
|
10764
10953
|
])) {
|
|
10765
|
-
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(typeOf(needle)) } instead.`);
|
|
10954
|
+
throw new RuntimeError$1(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
10766
10955
|
}
|
|
10767
10956
|
if (!isValidNativeType(haystack, [
|
|
10768
10957
|
'string',
|
|
10769
10958
|
'array'
|
|
10770
10959
|
])) {
|
|
10771
|
-
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString(typeOf(haystack)) } instead.`);
|
|
10960
|
+
throw new RuntimeError$1(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
10772
10961
|
}
|
|
10773
10962
|
if (this.fromIndex) {
|
|
10774
10963
|
const fromIndex = this.fromIndex.evaluate(ctx);
|
|
@@ -10803,6 +10992,7 @@
|
|
|
10803
10992
|
];
|
|
10804
10993
|
}
|
|
10805
10994
|
}
|
|
10995
|
+
var IndexOf$1 = IndexOf;
|
|
10806
10996
|
|
|
10807
10997
|
class Match {
|
|
10808
10998
|
constructor(inputType, outputType, input, cases, outputs, otherwise) {
|
|
@@ -10915,6 +11105,7 @@
|
|
|
10915
11105
|
return serialized;
|
|
10916
11106
|
}
|
|
10917
11107
|
}
|
|
11108
|
+
var Match$1 = Match;
|
|
10918
11109
|
|
|
10919
11110
|
class Case {
|
|
10920
11111
|
constructor(type, branches, otherwise) {
|
|
@@ -10976,6 +11167,7 @@
|
|
|
10976
11167
|
return serialized;
|
|
10977
11168
|
}
|
|
10978
11169
|
}
|
|
11170
|
+
var Case$1 = Case;
|
|
10979
11171
|
|
|
10980
11172
|
class Slice {
|
|
10981
11173
|
constructor(type, input, beginIndex, endIndex) {
|
|
@@ -10993,11 +11185,11 @@
|
|
|
10993
11185
|
if (!input || !beginIndex)
|
|
10994
11186
|
return null;
|
|
10995
11187
|
if (!isValidType(input.type, [
|
|
10996
|
-
array(ValueType),
|
|
11188
|
+
array$1(ValueType),
|
|
10997
11189
|
StringType,
|
|
10998
11190
|
ValueType
|
|
10999
11191
|
])) {
|
|
11000
|
-
return context.error(`Expected first argument to be of type array or string, but found ${ toString(input.type) } instead`);
|
|
11192
|
+
return context.error(`Expected first argument to be of type array or string, but found ${ toString$1(input.type) } instead`);
|
|
11001
11193
|
}
|
|
11002
11194
|
if (args.length === 4) {
|
|
11003
11195
|
const endIndex = context.parse(args[3], 3, NumberType);
|
|
@@ -11015,7 +11207,7 @@
|
|
|
11015
11207
|
'string',
|
|
11016
11208
|
'array'
|
|
11017
11209
|
])) {
|
|
11018
|
-
throw new RuntimeError(`Expected first argument to be of type array or string, but found ${ toString(typeOf(input)) } instead.`);
|
|
11210
|
+
throw new RuntimeError$1(`Expected first argument to be of type array or string, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
11019
11211
|
}
|
|
11020
11212
|
if (this.endIndex) {
|
|
11021
11213
|
const endIndex = this.endIndex.evaluate(ctx);
|
|
@@ -11050,6 +11242,7 @@
|
|
|
11050
11242
|
];
|
|
11051
11243
|
}
|
|
11052
11244
|
}
|
|
11245
|
+
var Slice$1 = Slice;
|
|
11053
11246
|
|
|
11054
11247
|
function isComparableType(op, type) {
|
|
11055
11248
|
if (op === '==' || op === '!=') {
|
|
@@ -11112,22 +11305,22 @@
|
|
|
11112
11305
|
if (!lhs)
|
|
11113
11306
|
return null;
|
|
11114
11307
|
if (!isComparableType(op, lhs.type)) {
|
|
11115
|
-
return context.concat(1).error(`"${ op }" comparisons are not supported for type '${ toString(lhs.type) }'.`);
|
|
11308
|
+
return context.concat(1).error(`"${ op }" comparisons are not supported for type '${ toString$1(lhs.type) }'.`);
|
|
11116
11309
|
}
|
|
11117
11310
|
let rhs = context.parse(args[2], 2, ValueType);
|
|
11118
11311
|
if (!rhs)
|
|
11119
11312
|
return null;
|
|
11120
11313
|
if (!isComparableType(op, rhs.type)) {
|
|
11121
|
-
return context.concat(2).error(`"${ op }" comparisons are not supported for type '${ toString(rhs.type) }'.`);
|
|
11314
|
+
return context.concat(2).error(`"${ op }" comparisons are not supported for type '${ toString$1(rhs.type) }'.`);
|
|
11122
11315
|
}
|
|
11123
11316
|
if (lhs.type.kind !== rhs.type.kind && lhs.type.kind !== 'value' && rhs.type.kind !== 'value') {
|
|
11124
|
-
return context.error(`Cannot compare types '${ toString(lhs.type) }' and '${ toString(rhs.type) }'.`);
|
|
11317
|
+
return context.error(`Cannot compare types '${ toString$1(lhs.type) }' and '${ toString$1(rhs.type) }'.`);
|
|
11125
11318
|
}
|
|
11126
11319
|
if (isOrderComparison) {
|
|
11127
11320
|
if (lhs.type.kind === 'value' && rhs.type.kind !== 'value') {
|
|
11128
|
-
lhs = new Assertion(rhs.type, [lhs]);
|
|
11321
|
+
lhs = new Assertion$1(rhs.type, [lhs]);
|
|
11129
11322
|
} else if (lhs.type.kind !== 'value' && rhs.type.kind === 'value') {
|
|
11130
|
-
rhs = new Assertion(lhs.type, [rhs]);
|
|
11323
|
+
rhs = new Assertion$1(lhs.type, [rhs]);
|
|
11131
11324
|
}
|
|
11132
11325
|
}
|
|
11133
11326
|
let collator = null;
|
|
@@ -11148,7 +11341,7 @@
|
|
|
11148
11341
|
const lt = typeOf(lhs);
|
|
11149
11342
|
const rt = typeOf(rhs);
|
|
11150
11343
|
if (lt.kind !== rt.kind || !(lt.kind === 'string' || lt.kind === 'number')) {
|
|
11151
|
-
throw new RuntimeError(`Expected arguments for "${ op }" to be (string, string) or (number, number), but found (${ lt.kind }, ${ rt.kind }) instead.`);
|
|
11344
|
+
throw new RuntimeError$1(`Expected arguments for "${ op }" to be (string, string) or (number, number), but found (${ lt.kind }, ${ rt.kind }) instead.`);
|
|
11152
11345
|
}
|
|
11153
11346
|
}
|
|
11154
11347
|
if (this.collator && !isOrderComparison && this.hasUntypedArgument) {
|
|
@@ -11290,7 +11483,7 @@
|
|
|
11290
11483
|
if (!input)
|
|
11291
11484
|
return null;
|
|
11292
11485
|
if (input.type.kind !== 'array' && input.type.kind !== 'string' && input.type.kind !== 'value')
|
|
11293
|
-
return context.error(`Expected argument of type string or array, but found ${ toString(input.type) } instead.`);
|
|
11486
|
+
return context.error(`Expected argument of type string or array, but found ${ toString$1(input.type) } instead.`);
|
|
11294
11487
|
return new Length(input);
|
|
11295
11488
|
}
|
|
11296
11489
|
evaluate(ctx) {
|
|
@@ -11300,7 +11493,7 @@
|
|
|
11300
11493
|
} else if (Array.isArray(input)) {
|
|
11301
11494
|
return input.length;
|
|
11302
11495
|
} else {
|
|
11303
|
-
throw new RuntimeError(`Expected value to be of type string or array, but found ${ toString(typeOf(input)) } instead.`);
|
|
11496
|
+
throw new RuntimeError$1(`Expected value to be of type string or array, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
11304
11497
|
}
|
|
11305
11498
|
}
|
|
11306
11499
|
eachChild(fn) {
|
|
@@ -11317,6 +11510,7 @@
|
|
|
11317
11510
|
return serialized;
|
|
11318
11511
|
}
|
|
11319
11512
|
}
|
|
11513
|
+
var Length$1 = Length;
|
|
11320
11514
|
|
|
11321
11515
|
const expressions = {
|
|
11322
11516
|
'==': Equals,
|
|
@@ -11325,35 +11519,35 @@
|
|
|
11325
11519
|
'<': LessThan,
|
|
11326
11520
|
'>=': GreaterThanOrEqual,
|
|
11327
11521
|
'<=': LessThanOrEqual,
|
|
11328
|
-
'array': Assertion,
|
|
11329
|
-
'at': At,
|
|
11330
|
-
'boolean': Assertion,
|
|
11331
|
-
'case': Case,
|
|
11332
|
-
'coalesce': Coalesce,
|
|
11522
|
+
'array': Assertion$1,
|
|
11523
|
+
'at': At$1,
|
|
11524
|
+
'boolean': Assertion$1,
|
|
11525
|
+
'case': Case$1,
|
|
11526
|
+
'coalesce': Coalesce$1,
|
|
11333
11527
|
'collator': CollatorExpression,
|
|
11334
11528
|
'format': FormatExpression,
|
|
11335
11529
|
'image': ImageExpression,
|
|
11336
|
-
'in': In,
|
|
11337
|
-
'index-of': IndexOf,
|
|
11338
|
-
'interpolate': Interpolate,
|
|
11339
|
-
'interpolate-hcl': Interpolate,
|
|
11340
|
-
'interpolate-lab': Interpolate,
|
|
11341
|
-
'length': Length,
|
|
11342
|
-
'let': Let,
|
|
11343
|
-
'literal': Literal,
|
|
11344
|
-
'match': Match,
|
|
11345
|
-
'number': Assertion,
|
|
11530
|
+
'in': In$1,
|
|
11531
|
+
'index-of': IndexOf$1,
|
|
11532
|
+
'interpolate': Interpolate$1,
|
|
11533
|
+
'interpolate-hcl': Interpolate$1,
|
|
11534
|
+
'interpolate-lab': Interpolate$1,
|
|
11535
|
+
'length': Length$1,
|
|
11536
|
+
'let': Let$1,
|
|
11537
|
+
'literal': Literal$1,
|
|
11538
|
+
'match': Match$1,
|
|
11539
|
+
'number': Assertion$1,
|
|
11346
11540
|
'number-format': NumberFormat,
|
|
11347
|
-
'object': Assertion,
|
|
11348
|
-
'slice': Slice,
|
|
11349
|
-
'step': Step,
|
|
11350
|
-
'string': Assertion,
|
|
11351
|
-
'to-boolean': Coercion,
|
|
11352
|
-
'to-color': Coercion,
|
|
11353
|
-
'to-number': Coercion,
|
|
11354
|
-
'to-string': Coercion,
|
|
11355
|
-
'var': Var,
|
|
11356
|
-
'within': Within
|
|
11541
|
+
'object': Assertion$1,
|
|
11542
|
+
'slice': Slice$1,
|
|
11543
|
+
'step': Step$1,
|
|
11544
|
+
'string': Assertion$1,
|
|
11545
|
+
'to-boolean': Coercion$1,
|
|
11546
|
+
'to-color': Coercion$1,
|
|
11547
|
+
'to-number': Coercion$1,
|
|
11548
|
+
'to-string': Coercion$1,
|
|
11549
|
+
'var': Var$1,
|
|
11550
|
+
'within': Within$1
|
|
11357
11551
|
};
|
|
11358
11552
|
function rgba(ctx, [r, g, b, a]) {
|
|
11359
11553
|
r = r.evaluate(ctx);
|
|
@@ -11362,8 +11556,8 @@
|
|
|
11362
11556
|
const alpha = a ? a.evaluate(ctx) : 1;
|
|
11363
11557
|
const error = validateRGBA(r, g, b, alpha);
|
|
11364
11558
|
if (error)
|
|
11365
|
-
throw new RuntimeError(error);
|
|
11366
|
-
return new Color(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);
|
|
11559
|
+
throw new RuntimeError$1(error);
|
|
11560
|
+
return new Color$1(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);
|
|
11367
11561
|
}
|
|
11368
11562
|
function has(key, obj) {
|
|
11369
11563
|
return key in obj;
|
|
@@ -11387,21 +11581,21 @@
|
|
|
11387
11581
|
function varargs(type) {
|
|
11388
11582
|
return { type };
|
|
11389
11583
|
}
|
|
11390
|
-
CompoundExpression.register(expressions, {
|
|
11584
|
+
CompoundExpression$1.register(expressions, {
|
|
11391
11585
|
'error': [
|
|
11392
11586
|
ErrorType,
|
|
11393
11587
|
[StringType],
|
|
11394
11588
|
(ctx, [v]) => {
|
|
11395
|
-
throw new RuntimeError(v.evaluate(ctx));
|
|
11589
|
+
throw new RuntimeError$1(v.evaluate(ctx));
|
|
11396
11590
|
}
|
|
11397
11591
|
],
|
|
11398
11592
|
'typeof': [
|
|
11399
11593
|
StringType,
|
|
11400
11594
|
[ValueType],
|
|
11401
|
-
(ctx, [v]) => toString(typeOf(v.evaluate(ctx)))
|
|
11595
|
+
(ctx, [v]) => toString$1(typeOf(v.evaluate(ctx)))
|
|
11402
11596
|
],
|
|
11403
11597
|
'to-rgba': [
|
|
11404
|
-
array(NumberType, 4),
|
|
11598
|
+
array$1(NumberType, 4),
|
|
11405
11599
|
[ColorType],
|
|
11406
11600
|
(ctx, [v]) => {
|
|
11407
11601
|
return v.evaluate(ctx).toArray();
|
|
@@ -11787,19 +11981,19 @@
|
|
|
11787
11981
|
],
|
|
11788
11982
|
'filter-type-in': [
|
|
11789
11983
|
BooleanType,
|
|
11790
|
-
[array(StringType)],
|
|
11984
|
+
[array$1(StringType)],
|
|
11791
11985
|
(ctx, [v]) => v.value.indexOf(ctx.geometryType()) >= 0
|
|
11792
11986
|
],
|
|
11793
11987
|
'filter-id-in': [
|
|
11794
11988
|
BooleanType,
|
|
11795
|
-
[array(ValueType)],
|
|
11989
|
+
[array$1(ValueType)],
|
|
11796
11990
|
(ctx, [v]) => v.value.indexOf(ctx.id()) >= 0
|
|
11797
11991
|
],
|
|
11798
11992
|
'filter-in-small': [
|
|
11799
11993
|
BooleanType,
|
|
11800
11994
|
[
|
|
11801
11995
|
StringType,
|
|
11802
|
-
array(ValueType)
|
|
11996
|
+
array$1(ValueType)
|
|
11803
11997
|
],
|
|
11804
11998
|
(ctx, [k, v]) => v.value.indexOf(ctx.properties()[k.value]) >= 0
|
|
11805
11999
|
],
|
|
@@ -11807,7 +12001,7 @@
|
|
|
11807
12001
|
BooleanType,
|
|
11808
12002
|
[
|
|
11809
12003
|
StringType,
|
|
11810
|
-
array(ValueType)
|
|
12004
|
+
array$1(ValueType)
|
|
11811
12005
|
],
|
|
11812
12006
|
(ctx, [k, v]) => binarySearch(ctx.properties()[k.value], v.value, 0, v.value.length - 1)
|
|
11813
12007
|
],
|
|
@@ -11884,7 +12078,7 @@
|
|
|
11884
12078
|
'concat': [
|
|
11885
12079
|
StringType,
|
|
11886
12080
|
varargs(ValueType),
|
|
11887
|
-
(ctx, args) => args.map(arg => toString
|
|
12081
|
+
(ctx, args) => args.map(arg => toString(arg.evaluate(ctx))).join('')
|
|
11888
12082
|
],
|
|
11889
12083
|
'resolved-locale': [
|
|
11890
12084
|
StringType,
|
|
@@ -11892,6 +12086,7 @@
|
|
|
11892
12086
|
(ctx, [collator]) => collator.evaluate(ctx).resolvedLocale()
|
|
11893
12087
|
]
|
|
11894
12088
|
});
|
|
12089
|
+
var definitions = expressions;
|
|
11895
12090
|
|
|
11896
12091
|
function success(value) {
|
|
11897
12092
|
return {
|
|
@@ -11932,7 +12127,7 @@
|
|
|
11932
12127
|
}
|
|
11933
12128
|
}
|
|
11934
12129
|
|
|
11935
|
-
function isFunction
|
|
12130
|
+
function isFunction(value) {
|
|
11936
12131
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
11937
12132
|
}
|
|
11938
12133
|
function identityFunction(x) {
|
|
@@ -11950,14 +12145,14 @@
|
|
|
11950
12145
|
parameters.stops = parameters.stops.map(stop => {
|
|
11951
12146
|
return [
|
|
11952
12147
|
stop[0],
|
|
11953
|
-
Color.parse(stop[1])
|
|
12148
|
+
Color$1.parse(stop[1])
|
|
11954
12149
|
];
|
|
11955
12150
|
});
|
|
11956
12151
|
}
|
|
11957
12152
|
if (parameters.default) {
|
|
11958
|
-
parameters.default = Color.parse(parameters.default);
|
|
12153
|
+
parameters.default = Color$1.parse(parameters.default);
|
|
11959
12154
|
} else {
|
|
11960
|
-
parameters.default = Color.parse(propertySpec.default);
|
|
12155
|
+
parameters.default = Color$1.parse(propertySpec.default);
|
|
11961
12156
|
}
|
|
11962
12157
|
}
|
|
11963
12158
|
if (parameters.colorSpace && parameters.colorSpace !== 'rgb' && !colorSpaces[parameters.colorSpace]) {
|
|
@@ -12014,7 +12209,7 @@
|
|
|
12014
12209
|
return {
|
|
12015
12210
|
kind: 'composite',
|
|
12016
12211
|
interpolationType,
|
|
12017
|
-
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
12212
|
+
interpolationFactor: Interpolate$1.interpolationFactor.bind(undefined, interpolationType),
|
|
12018
12213
|
zoomStops: featureFunctionStops.map(s => s[0]),
|
|
12019
12214
|
evaluate({zoom}, properties) {
|
|
12020
12215
|
return evaluateExponentialFunction({
|
|
@@ -12031,7 +12226,7 @@
|
|
|
12031
12226
|
return {
|
|
12032
12227
|
kind: 'camera',
|
|
12033
12228
|
interpolationType,
|
|
12034
|
-
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
12229
|
+
interpolationFactor: Interpolate$1.interpolationFactor.bind(undefined, interpolationType),
|
|
12035
12230
|
zoomStops: parameters.stops.map(s => s[0]),
|
|
12036
12231
|
evaluate: ({zoom}) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)
|
|
12037
12232
|
};
|
|
@@ -12041,14 +12236,14 @@
|
|
|
12041
12236
|
evaluate(_, feature) {
|
|
12042
12237
|
const value = feature && feature.properties ? feature.properties[parameters.property] : undefined;
|
|
12043
12238
|
if (value === undefined) {
|
|
12044
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12239
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12045
12240
|
}
|
|
12046
12241
|
return innerFun(parameters, propertySpec, value, hashedStops, categoricalKeyType);
|
|
12047
12242
|
}
|
|
12048
12243
|
};
|
|
12049
12244
|
}
|
|
12050
12245
|
}
|
|
12051
|
-
function coalesce(a, b, c) {
|
|
12246
|
+
function coalesce$1(a, b, c) {
|
|
12052
12247
|
if (a !== undefined)
|
|
12053
12248
|
return a;
|
|
12054
12249
|
if (b !== undefined)
|
|
@@ -12058,11 +12253,11 @@
|
|
|
12058
12253
|
}
|
|
12059
12254
|
function evaluateCategoricalFunction(parameters, propertySpec, input, hashedStops, keyType) {
|
|
12060
12255
|
const evaluated = typeof input === keyType ? hashedStops[input] : undefined;
|
|
12061
|
-
return coalesce(evaluated, parameters.default, propertySpec.default);
|
|
12256
|
+
return coalesce$1(evaluated, parameters.default, propertySpec.default);
|
|
12062
12257
|
}
|
|
12063
12258
|
function evaluateIntervalFunction(parameters, propertySpec, input) {
|
|
12064
12259
|
if (getType(input) !== 'number')
|
|
12065
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12260
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12066
12261
|
const n = parameters.stops.length;
|
|
12067
12262
|
if (n === 1)
|
|
12068
12263
|
return parameters.stops[0][1];
|
|
@@ -12076,7 +12271,7 @@
|
|
|
12076
12271
|
function evaluateExponentialFunction(parameters, propertySpec, input) {
|
|
12077
12272
|
const base = parameters.base !== undefined ? parameters.base : 1;
|
|
12078
12273
|
if (getType(input) !== 'number')
|
|
12079
|
-
return coalesce(parameters.default, propertySpec.default);
|
|
12274
|
+
return coalesce$1(parameters.default, propertySpec.default);
|
|
12080
12275
|
const n = parameters.stops.length;
|
|
12081
12276
|
if (n === 1)
|
|
12082
12277
|
return parameters.stops[0][1];
|
|
@@ -12109,7 +12304,7 @@
|
|
|
12109
12304
|
}
|
|
12110
12305
|
function evaluateIdentityFunction(parameters, propertySpec, input) {
|
|
12111
12306
|
if (propertySpec.type === 'color') {
|
|
12112
|
-
input = Color.parse(input);
|
|
12307
|
+
input = Color$1.parse(input);
|
|
12113
12308
|
} else if (propertySpec.type === 'formatted') {
|
|
12114
12309
|
input = Formatted.fromString(input.toString());
|
|
12115
12310
|
} else if (propertySpec.type === 'resolvedImage') {
|
|
@@ -12117,7 +12312,7 @@
|
|
|
12117
12312
|
} else if (getType(input) !== propertySpec.type && (propertySpec.type !== 'enum' || !propertySpec.values[input])) {
|
|
12118
12313
|
input = undefined;
|
|
12119
12314
|
}
|
|
12120
|
-
return coalesce(input, parameters.default, propertySpec.default);
|
|
12315
|
+
return coalesce$1(input, parameters.default, propertySpec.default);
|
|
12121
12316
|
}
|
|
12122
12317
|
function interpolationFactor(input, base, lowerValue, upperValue) {
|
|
12123
12318
|
const difference = upperValue - lowerValue;
|
|
@@ -12135,7 +12330,7 @@
|
|
|
12135
12330
|
constructor(expression, propertySpec) {
|
|
12136
12331
|
this.expression = expression;
|
|
12137
12332
|
this._warningHistory = {};
|
|
12138
|
-
this._evaluator = new EvaluationContext();
|
|
12333
|
+
this._evaluator = new EvaluationContext$1();
|
|
12139
12334
|
this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
|
|
12140
12335
|
this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;
|
|
12141
12336
|
}
|
|
@@ -12143,7 +12338,7 @@
|
|
|
12143
12338
|
this._evaluator.globals = globals;
|
|
12144
12339
|
this._evaluator.feature = feature;
|
|
12145
12340
|
this._evaluator.featureState = featureState;
|
|
12146
|
-
this._evaluator.canonical = canonical;
|
|
12341
|
+
this._evaluator.canonical = canonical || null;
|
|
12147
12342
|
this._evaluator.availableImages = availableImages || null;
|
|
12148
12343
|
this._evaluator.formattedSection = formattedSection;
|
|
12149
12344
|
this._evaluator.featureTileCoord = featureTileCoord || null;
|
|
@@ -12154,7 +12349,7 @@
|
|
|
12154
12349
|
this._evaluator.globals = globals;
|
|
12155
12350
|
this._evaluator.feature = feature || null;
|
|
12156
12351
|
this._evaluator.featureState = featureState || null;
|
|
12157
|
-
this._evaluator.canonical = canonical;
|
|
12352
|
+
this._evaluator.canonical = canonical || null;
|
|
12158
12353
|
this._evaluator.availableImages = availableImages || null;
|
|
12159
12354
|
this._evaluator.formattedSection = formattedSection || null;
|
|
12160
12355
|
this._evaluator.featureTileCoord = featureTileCoord || null;
|
|
@@ -12165,7 +12360,7 @@
|
|
|
12165
12360
|
return this._defaultValue;
|
|
12166
12361
|
}
|
|
12167
12362
|
if (this._enumValues && !(val in this._enumValues)) {
|
|
12168
|
-
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.`);
|
|
12363
|
+
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.`);
|
|
12169
12364
|
}
|
|
12170
12365
|
return val;
|
|
12171
12366
|
} catch (e) {
|
|
@@ -12180,10 +12375,10 @@
|
|
|
12180
12375
|
}
|
|
12181
12376
|
}
|
|
12182
12377
|
function isExpression(expression) {
|
|
12183
|
-
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in
|
|
12378
|
+
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in definitions;
|
|
12184
12379
|
}
|
|
12185
12380
|
function createExpression(expression, propertySpec) {
|
|
12186
|
-
const parser = new ParsingContext(
|
|
12381
|
+
const parser = new ParsingContext$1(definitions, [], propertySpec ? getExpectedType(propertySpec) : undefined);
|
|
12187
12382
|
const parsed = parser.parse(expression, undefined, undefined, undefined, propertySpec && propertySpec.type === 'string' ? { typeAnnotation: 'coerce' } : undefined);
|
|
12188
12383
|
if (!parsed) {
|
|
12189
12384
|
return error(parser.errors);
|
|
@@ -12219,7 +12414,7 @@
|
|
|
12219
12414
|
}
|
|
12220
12415
|
interpolationFactor(input, lower, upper) {
|
|
12221
12416
|
if (this.interpolationType) {
|
|
12222
|
-
return Interpolate.interpolationFactor(this.interpolationType, input, lower, upper);
|
|
12417
|
+
return Interpolate$1.interpolationFactor(this.interpolationType, input, lower, upper);
|
|
12223
12418
|
} else {
|
|
12224
12419
|
return 0;
|
|
12225
12420
|
}
|
|
@@ -12233,7 +12428,7 @@
|
|
|
12233
12428
|
const parsed = expression.value.expression;
|
|
12234
12429
|
const isFeatureConstant$1 = isFeatureConstant(parsed);
|
|
12235
12430
|
if (!isFeatureConstant$1 && !supportsPropertyExpression(propertySpec)) {
|
|
12236
|
-
return error([new ParsingError('', 'data expressions not supported')]);
|
|
12431
|
+
return error([new ParsingError$2('', 'data expressions not supported')]);
|
|
12237
12432
|
}
|
|
12238
12433
|
const isZoomConstant = isGlobalPropertyConstant(parsed, [
|
|
12239
12434
|
'zoom',
|
|
@@ -12241,20 +12436,20 @@
|
|
|
12241
12436
|
'distance-from-center'
|
|
12242
12437
|
]);
|
|
12243
12438
|
if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {
|
|
12244
|
-
return error([new ParsingError('', 'zoom expressions not supported')]);
|
|
12439
|
+
return error([new ParsingError$2('', 'zoom expressions not supported')]);
|
|
12245
12440
|
}
|
|
12246
12441
|
const zoomCurve = findZoomCurve(parsed);
|
|
12247
12442
|
if (!zoomCurve && !isZoomConstant) {
|
|
12248
|
-
return error([new ParsingError('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);
|
|
12249
|
-
} else if (zoomCurve instanceof ParsingError) {
|
|
12443
|
+
return error([new ParsingError$2('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);
|
|
12444
|
+
} else if (zoomCurve instanceof ParsingError$2) {
|
|
12250
12445
|
return error([zoomCurve]);
|
|
12251
|
-
} else if (zoomCurve instanceof Interpolate && !supportsInterpolation(propertySpec)) {
|
|
12252
|
-
return error([new ParsingError('', '"interpolate" expressions cannot be used with this property')]);
|
|
12446
|
+
} else if (zoomCurve instanceof Interpolate$1 && !supportsInterpolation(propertySpec)) {
|
|
12447
|
+
return error([new ParsingError$2('', '"interpolate" expressions cannot be used with this property')]);
|
|
12253
12448
|
}
|
|
12254
12449
|
if (!zoomCurve) {
|
|
12255
12450
|
return success(isFeatureConstant$1 ? new ZoomConstantExpression('constant', expression.value) : new ZoomConstantExpression('source', expression.value));
|
|
12256
12451
|
}
|
|
12257
|
-
const interpolationType = zoomCurve instanceof Interpolate ? zoomCurve.interpolation : undefined;
|
|
12452
|
+
const interpolationType = zoomCurve instanceof Interpolate$1 ? zoomCurve.interpolation : undefined;
|
|
12258
12453
|
return success(isFeatureConstant$1 ? new ZoomDependentExpression('camera', expression.value, zoomCurve.labels, interpolationType) : new ZoomDependentExpression('composite', expression.value, zoomCurve.labels, interpolationType));
|
|
12259
12454
|
}
|
|
12260
12455
|
class StylePropertyFunction {
|
|
@@ -12274,7 +12469,7 @@
|
|
|
12274
12469
|
}
|
|
12275
12470
|
}
|
|
12276
12471
|
function normalizePropertyExpression(value, specification) {
|
|
12277
|
-
if (isFunction
|
|
12472
|
+
if (isFunction(value)) {
|
|
12278
12473
|
return new StylePropertyFunction(value, specification);
|
|
12279
12474
|
} else if (isExpression(value)) {
|
|
12280
12475
|
const expression = createPropertyExpression(value, specification);
|
|
@@ -12285,7 +12480,7 @@
|
|
|
12285
12480
|
} else {
|
|
12286
12481
|
let constant = value;
|
|
12287
12482
|
if (typeof value === 'string' && specification.type === 'color') {
|
|
12288
|
-
constant = Color.parse(value);
|
|
12483
|
+
constant = Color$1.parse(value);
|
|
12289
12484
|
}
|
|
12290
12485
|
return {
|
|
12291
12486
|
kind: 'constant',
|
|
@@ -12295,29 +12490,29 @@
|
|
|
12295
12490
|
}
|
|
12296
12491
|
function findZoomCurve(expression) {
|
|
12297
12492
|
let result = null;
|
|
12298
|
-
if (expression instanceof Let) {
|
|
12493
|
+
if (expression instanceof Let$1) {
|
|
12299
12494
|
result = findZoomCurve(expression.result);
|
|
12300
|
-
} else if (expression instanceof Coalesce) {
|
|
12495
|
+
} else if (expression instanceof Coalesce$1) {
|
|
12301
12496
|
for (const arg of expression.args) {
|
|
12302
12497
|
result = findZoomCurve(arg);
|
|
12303
12498
|
if (result) {
|
|
12304
12499
|
break;
|
|
12305
12500
|
}
|
|
12306
12501
|
}
|
|
12307
|
-
} else if ((expression instanceof Step || expression instanceof Interpolate) && expression.input instanceof CompoundExpression && expression.input.name === 'zoom') {
|
|
12502
|
+
} else if ((expression instanceof Step$1 || expression instanceof Interpolate$1) && expression.input instanceof CompoundExpression$1 && expression.input.name === 'zoom') {
|
|
12308
12503
|
result = expression;
|
|
12309
12504
|
}
|
|
12310
|
-
if (result instanceof ParsingError) {
|
|
12505
|
+
if (result instanceof ParsingError$2) {
|
|
12311
12506
|
return result;
|
|
12312
12507
|
}
|
|
12313
12508
|
expression.eachChild(child => {
|
|
12314
12509
|
const childResult = findZoomCurve(child);
|
|
12315
|
-
if (childResult instanceof ParsingError) {
|
|
12510
|
+
if (childResult instanceof ParsingError$2) {
|
|
12316
12511
|
result = childResult;
|
|
12317
12512
|
} else if (!result && childResult) {
|
|
12318
|
-
result = new ParsingError('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.');
|
|
12513
|
+
result = new ParsingError$2('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.');
|
|
12319
12514
|
} else if (result && childResult && result !== childResult) {
|
|
12320
|
-
result = new ParsingError('', 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.');
|
|
12515
|
+
result = new ParsingError$2('', 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.');
|
|
12321
12516
|
}
|
|
12322
12517
|
});
|
|
12323
12518
|
return result;
|
|
@@ -12333,15 +12528,15 @@
|
|
|
12333
12528
|
resolvedImage: ResolvedImageType
|
|
12334
12529
|
};
|
|
12335
12530
|
if (spec.type === 'array') {
|
|
12336
|
-
return array(types[spec.value] || ValueType, spec.length);
|
|
12531
|
+
return array$1(types[spec.value] || ValueType, spec.length);
|
|
12337
12532
|
}
|
|
12338
12533
|
return types[spec.type];
|
|
12339
12534
|
}
|
|
12340
12535
|
function getDefaultValue(spec) {
|
|
12341
|
-
if (spec.type === 'color' && isFunction
|
|
12342
|
-
return new Color(0, 0, 0, 0);
|
|
12536
|
+
if (spec.type === 'color' && (isFunction(spec.default) || Array.isArray(spec.default))) {
|
|
12537
|
+
return new Color$1(0, 0, 0, 0);
|
|
12343
12538
|
} else if (spec.type === 'color') {
|
|
12344
|
-
return Color.parse(spec.default) || null;
|
|
12539
|
+
return Color$1.parse(spec.default) || null;
|
|
12345
12540
|
} else if (spec.default === undefined) {
|
|
12346
12541
|
return null;
|
|
12347
12542
|
} else {
|
|
@@ -12470,14 +12665,14 @@
|
|
|
12470
12665
|
return expression;
|
|
12471
12666
|
}
|
|
12472
12667
|
}
|
|
12473
|
-
function coalesce
|
|
12668
|
+
function coalesce(a, b) {
|
|
12474
12669
|
if (a !== undefined)
|
|
12475
12670
|
return a;
|
|
12476
12671
|
if (b !== undefined)
|
|
12477
12672
|
return b;
|
|
12478
12673
|
}
|
|
12479
12674
|
function getFallback(parameters, propertySpec) {
|
|
12480
|
-
const defaultValue = convertLiteral(coalesce
|
|
12675
|
+
const defaultValue = convertLiteral(coalesce(parameters.default, propertySpec.default));
|
|
12481
12676
|
if (defaultValue === undefined && propertySpec.type === 'resolvedImage') {
|
|
12482
12677
|
return '';
|
|
12483
12678
|
}
|
|
@@ -12711,7 +12906,7 @@
|
|
|
12711
12906
|
};
|
|
12712
12907
|
}
|
|
12713
12908
|
if (!isExpressionFilter(filter)) {
|
|
12714
|
-
filter = convertFilter(filter);
|
|
12909
|
+
filter = convertFilter$1(filter);
|
|
12715
12910
|
}
|
|
12716
12911
|
const filterExp = filter;
|
|
12717
12912
|
let staticFilter = true;
|
|
@@ -12856,16 +13051,16 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12856
13051
|
}
|
|
12857
13052
|
return false;
|
|
12858
13053
|
}
|
|
12859
|
-
function convertFilter(filter) {
|
|
13054
|
+
function convertFilter$1(filter) {
|
|
12860
13055
|
if (!filter)
|
|
12861
13056
|
return true;
|
|
12862
13057
|
const op = filter[0];
|
|
12863
13058
|
if (filter.length <= 1)
|
|
12864
13059
|
return op !== 'any';
|
|
12865
|
-
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;
|
|
13060
|
+
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;
|
|
12866
13061
|
return converted;
|
|
12867
13062
|
}
|
|
12868
|
-
function convertComparisonOp(property, value, op) {
|
|
13063
|
+
function convertComparisonOp$1(property, value, op) {
|
|
12869
13064
|
switch (property) {
|
|
12870
13065
|
case '$type':
|
|
12871
13066
|
return [
|
|
@@ -12886,9 +13081,9 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12886
13081
|
}
|
|
12887
13082
|
}
|
|
12888
13083
|
function convertDisjunctionOp(filters) {
|
|
12889
|
-
return ['any'].concat(filters.map(convertFilter));
|
|
13084
|
+
return ['any'].concat(filters.map(convertFilter$1));
|
|
12890
13085
|
}
|
|
12891
|
-
function convertInOp(property, values) {
|
|
13086
|
+
function convertInOp$1(property, values) {
|
|
12892
13087
|
if (values.length === 0) {
|
|
12893
13088
|
return false;
|
|
12894
13089
|
}
|
|
@@ -12931,7 +13126,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12931
13126
|
}
|
|
12932
13127
|
}
|
|
12933
13128
|
}
|
|
12934
|
-
function convertHasOp(property) {
|
|
13129
|
+
function convertHasOp$1(property) {
|
|
12935
13130
|
switch (property) {
|
|
12936
13131
|
case '$type':
|
|
12937
13132
|
return true;
|
|
@@ -12951,7 +13146,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12951
13146
|
];
|
|
12952
13147
|
}
|
|
12953
13148
|
|
|
12954
|
-
function convertFilter
|
|
13149
|
+
function convertFilter(filter) {
|
|
12955
13150
|
return _convertFilter(filter, {});
|
|
12956
13151
|
}
|
|
12957
13152
|
function _convertFilter(filter, expectedTypes) {
|
|
@@ -12966,7 +13161,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12966
13161
|
let converted;
|
|
12967
13162
|
if (op === '==' || op === '!=' || op === '<' || op === '>' || op === '<=' || op === '>=') {
|
|
12968
13163
|
const [, property, value] = filter;
|
|
12969
|
-
converted = convertComparisonOp
|
|
13164
|
+
converted = convertComparisonOp(property, value, op, expectedTypes);
|
|
12970
13165
|
} else if (op === 'any') {
|
|
12971
13166
|
const children = filter.slice(1).map(f => {
|
|
12972
13167
|
const types = {};
|
|
@@ -12989,15 +13184,15 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
12989
13184
|
_convertFilter(['any'].concat(filter.slice(1)), {})
|
|
12990
13185
|
];
|
|
12991
13186
|
} else if (op === 'in') {
|
|
12992
|
-
converted = convertInOp
|
|
13187
|
+
converted = convertInOp(filter[1], filter.slice(2));
|
|
12993
13188
|
} else if (op === '!in') {
|
|
12994
|
-
converted = convertInOp
|
|
13189
|
+
converted = convertInOp(filter[1], filter.slice(2), true);
|
|
12995
13190
|
} else if (op === 'has') {
|
|
12996
|
-
converted = convertHasOp
|
|
13191
|
+
converted = convertHasOp(filter[1]);
|
|
12997
13192
|
} else if (op === '!has') {
|
|
12998
13193
|
converted = [
|
|
12999
13194
|
'!',
|
|
13000
|
-
convertHasOp
|
|
13195
|
+
convertHasOp(filter[1])
|
|
13001
13196
|
];
|
|
13002
13197
|
} else {
|
|
13003
13198
|
converted = true;
|
|
@@ -13026,7 +13221,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13026
13221
|
return conditions[0];
|
|
13027
13222
|
return ['all'].concat(conditions);
|
|
13028
13223
|
}
|
|
13029
|
-
function convertComparisonOp
|
|
13224
|
+
function convertComparisonOp(property, value, op, expectedTypes) {
|
|
13030
13225
|
let get;
|
|
13031
13226
|
if (property === '$type') {
|
|
13032
13227
|
return [
|
|
@@ -13082,7 +13277,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13082
13277
|
value
|
|
13083
13278
|
];
|
|
13084
13279
|
}
|
|
13085
|
-
function convertInOp
|
|
13280
|
+
function convertInOp(property, values, negate = false) {
|
|
13086
13281
|
if (values.length === 0)
|
|
13087
13282
|
return negate;
|
|
13088
13283
|
let get;
|
|
@@ -13120,7 +13315,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13120
13315
|
v
|
|
13121
13316
|
]));
|
|
13122
13317
|
}
|
|
13123
|
-
function convertHasOp
|
|
13318
|
+
function convertHasOp(property) {
|
|
13124
13319
|
if (property === '$type') {
|
|
13125
13320
|
return true;
|
|
13126
13321
|
} else if (property === '$id') {
|
|
@@ -13141,7 +13336,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13141
13336
|
const converted = [];
|
|
13142
13337
|
eachLayer(style, layer => {
|
|
13143
13338
|
if (layer.filter) {
|
|
13144
|
-
layer.filter = convertFilter
|
|
13339
|
+
layer.filter = convertFilter(layer.filter);
|
|
13145
13340
|
}
|
|
13146
13341
|
});
|
|
13147
13342
|
eachProperty(style, {
|
|
@@ -13668,7 +13863,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13668
13863
|
}
|
|
13669
13864
|
}
|
|
13670
13865
|
|
|
13671
|
-
class ParsingError
|
|
13866
|
+
class ParsingError {
|
|
13672
13867
|
constructor(error) {
|
|
13673
13868
|
this.error = error;
|
|
13674
13869
|
this.message = error.message;
|
|
@@ -13701,7 +13896,8 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13701
13896
|
validateElement = elementValidators['*'];
|
|
13702
13897
|
} else if (elementSpecs['*']) {
|
|
13703
13898
|
validateElement = validate;
|
|
13704
|
-
}
|
|
13899
|
+
}
|
|
13900
|
+
if (!validateElement) {
|
|
13705
13901
|
errors.push(new ValidationError(key, object[objectKey], `unknown property "${ objectKey }"`));
|
|
13706
13902
|
continue;
|
|
13707
13903
|
}
|
|
@@ -13746,7 +13942,8 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13746
13942
|
'type': arraySpec.value,
|
|
13747
13943
|
'values': arraySpec.values,
|
|
13748
13944
|
'minimum': arraySpec.minimum,
|
|
13749
|
-
'maximum': arraySpec.maximum
|
|
13945
|
+
'maximum': arraySpec.maximum,
|
|
13946
|
+
function: undefined
|
|
13750
13947
|
};
|
|
13751
13948
|
if (styleSpec.$version < 7) {
|
|
13752
13949
|
arrayElementSpec.function = arraySpec.function;
|
|
@@ -13883,11 +14080,15 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13883
14080
|
if (value[0].value === undefined) {
|
|
13884
14081
|
return [new ValidationError(key, value, 'object stop key must have value')];
|
|
13885
14082
|
}
|
|
13886
|
-
|
|
14083
|
+
const nextStopDomainZoom = unbundle(value[0].zoom);
|
|
14084
|
+
if (typeof nextStopDomainZoom !== 'number') {
|
|
14085
|
+
return [new ValidationError(key, value[0].zoom, 'stop zoom values must be numbers')];
|
|
14086
|
+
}
|
|
14087
|
+
if (previousStopDomainZoom && previousStopDomainZoom > nextStopDomainZoom) {
|
|
13887
14088
|
return [new ValidationError(key, value[0].zoom, 'stop zoom values must appear in ascending order')];
|
|
13888
14089
|
}
|
|
13889
|
-
if (
|
|
13890
|
-
previousStopDomainZoom =
|
|
14090
|
+
if (nextStopDomainZoom !== previousStopDomainZoom) {
|
|
14091
|
+
previousStopDomainZoom = nextStopDomainZoom;
|
|
13891
14092
|
previousStopDomainValue = undefined;
|
|
13892
14093
|
stopDomainValues = {};
|
|
13893
14094
|
}
|
|
@@ -13931,7 +14132,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13931
14132
|
} else if (type !== stopKeyType) {
|
|
13932
14133
|
return [new ValidationError(options.key, reportValue, `${ type } stop domain type must match previous stop domain type ${ stopKeyType }`)];
|
|
13933
14134
|
}
|
|
13934
|
-
if (type !== 'number' && type !== 'string' && type !== 'boolean') {
|
|
14135
|
+
if (type !== 'number' && type !== 'string' && type !== 'boolean' && typeof value !== 'number' && typeof value !== 'string' && typeof value !== 'boolean') {
|
|
13935
14136
|
return [new ValidationError(options.key, reportValue, 'stop domain value must be a number, string, or boolean')];
|
|
13936
14137
|
}
|
|
13937
14138
|
if (type !== 'number' && functionType !== 'categorical') {
|
|
@@ -13941,10 +14142,10 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13941
14142
|
}
|
|
13942
14143
|
return [new ValidationError(options.key, reportValue, message)];
|
|
13943
14144
|
}
|
|
13944
|
-
if (functionType === 'categorical' && type === 'number' && (!isFinite(value) || Math.floor(value) !== value)) {
|
|
13945
|
-
return [new ValidationError(options.key, reportValue, `integer expected, found ${ value }`)];
|
|
14145
|
+
if (functionType === 'categorical' && type === 'number' && (typeof value !== 'number' || !isFinite(value) || Math.floor(value) !== value)) {
|
|
14146
|
+
return [new ValidationError(options.key, reportValue, `integer expected, found ${ String(value) }`)];
|
|
13946
14147
|
}
|
|
13947
|
-
if (functionType !== 'categorical' && type === 'number' && previousStopDomainValue !== undefined && value < previousStopDomainValue) {
|
|
14148
|
+
if (functionType !== 'categorical' && type === 'number' && typeof value === 'number' && typeof previousStopDomainValue === 'number' && previousStopDomainValue !== undefined && value < previousStopDomainValue) {
|
|
13948
14149
|
return [new ValidationError(options.key, reportValue, 'stop domain values must appear in ascending order')];
|
|
13949
14150
|
} else {
|
|
13950
14151
|
previousStopDomainValue = value;
|
|
@@ -14004,14 +14205,16 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14004
14205
|
'pitch',
|
|
14005
14206
|
'distance-from-center'
|
|
14006
14207
|
]);
|
|
14007
|
-
|
|
14008
|
-
|
|
14208
|
+
if (options.valueSpec && options.valueSpec.expression) {
|
|
14209
|
+
for (const param of options.valueSpec.expression.parameters) {
|
|
14210
|
+
disallowedParameters.delete(param);
|
|
14211
|
+
}
|
|
14009
14212
|
}
|
|
14010
14213
|
if (disallowedParameters.size === 0) {
|
|
14011
14214
|
return [];
|
|
14012
14215
|
}
|
|
14013
14216
|
const errors = [];
|
|
14014
|
-
if (e instanceof CompoundExpression) {
|
|
14217
|
+
if (e instanceof CompoundExpression$1) {
|
|
14015
14218
|
if (disallowedParameters.has(e.name)) {
|
|
14016
14219
|
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 }`)];
|
|
14017
14220
|
}
|
|
@@ -14064,10 +14267,10 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14064
14267
|
|
|
14065
14268
|
function validateFilter(options) {
|
|
14066
14269
|
if (isExpressionFilter(deepUnbundle(options.value))) {
|
|
14067
|
-
const layerType =
|
|
14270
|
+
const layerType = options.layerType || 'fill';
|
|
14068
14271
|
return validateExpression(extend({}, options, {
|
|
14069
14272
|
expressionContext: 'filter',
|
|
14070
|
-
valueSpec: options.styleSpec[`filter_${ layerType
|
|
14273
|
+
valueSpec: options.styleSpec[`filter_${ layerType }`]
|
|
14071
14274
|
}));
|
|
14072
14275
|
} else {
|
|
14073
14276
|
return validateNonExpressionFilter(options);
|
|
@@ -14193,7 +14396,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14193
14396
|
if (propertyKey === 'text-field' && style && !style.glyphs) {
|
|
14194
14397
|
errors.push(new ValidationError(key, value, 'use of "text-field" requires a style "glyphs" property'));
|
|
14195
14398
|
}
|
|
14196
|
-
if (propertyKey === 'text-font' && isFunction
|
|
14399
|
+
if (propertyKey === 'text-font' && isFunction(deepUnbundle(value)) && unbundle(value.type) === 'identity') {
|
|
14197
14400
|
errors.push(new ValidationError(key, value, '"text-font" does not support identity functions'));
|
|
14198
14401
|
}
|
|
14199
14402
|
}
|
|
@@ -14255,7 +14458,8 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14255
14458
|
parent = layer;
|
|
14256
14459
|
});
|
|
14257
14460
|
if (!parent) {
|
|
14258
|
-
|
|
14461
|
+
if (typeof ref === 'string')
|
|
14462
|
+
errors.push(new ValidationError(key, layer.ref, `ref layer "${ ref }" not found`));
|
|
14259
14463
|
} else if (parent.ref) {
|
|
14260
14464
|
errors.push(new ValidationError(key, layer.ref, 'ref cannot reference another ref layer'));
|
|
14261
14465
|
} else {
|
|
@@ -14279,6 +14483,8 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14279
14483
|
errors.push(new ValidationError(key, layer.source, 'raster-dem source can only be used with layer type \'hillshade\'.'));
|
|
14280
14484
|
} else if (type === 'line' && layer.paint && layer.paint['line-gradient'] && (sourceType !== 'geojson' || !source.lineMetrics)) {
|
|
14281
14485
|
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`));
|
|
14486
|
+
} else if (type === 'line' && layer.paint && layer.paint['line-trim-offset'] && !layer.paint['line-gradient']) {
|
|
14487
|
+
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-trim-offset, which requires line-gradient enabled.`));
|
|
14282
14488
|
}
|
|
14283
14489
|
}
|
|
14284
14490
|
}
|
|
@@ -14311,6 +14517,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14311
14517
|
layer,
|
|
14312
14518
|
key: options.key,
|
|
14313
14519
|
value: options.value,
|
|
14520
|
+
valueSpec: {},
|
|
14314
14521
|
style: options.style,
|
|
14315
14522
|
styleSpec: options.styleSpec,
|
|
14316
14523
|
objectElementValidators: {
|
|
@@ -14325,6 +14532,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14325
14532
|
layer,
|
|
14326
14533
|
key: options.key,
|
|
14327
14534
|
value: options.value,
|
|
14535
|
+
valueSpec: {},
|
|
14328
14536
|
style: options.style,
|
|
14329
14537
|
styleSpec: options.styleSpec,
|
|
14330
14538
|
objectElementValidators: {
|
|
@@ -14543,7 +14751,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14543
14751
|
if (!source) {
|
|
14544
14752
|
errors.push(new ValidationError(key, terrain.source, `source "${ terrain.source }" not found`));
|
|
14545
14753
|
} else if (sourceType !== 'raster-dem') {
|
|
14546
|
-
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`));
|
|
14754
|
+
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`));
|
|
14547
14755
|
}
|
|
14548
14756
|
}
|
|
14549
14757
|
return errors;
|
|
@@ -14650,7 +14858,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14650
14858
|
const value = options.value;
|
|
14651
14859
|
const valueSpec = options.valueSpec;
|
|
14652
14860
|
const styleSpec = options.styleSpec;
|
|
14653
|
-
if (valueSpec.expression && isFunction
|
|
14861
|
+
if (valueSpec.expression && isFunction(unbundle(value))) {
|
|
14654
14862
|
return validateFunction(options);
|
|
14655
14863
|
} else if (valueSpec.expression && isExpression(deepUnbundle(value))) {
|
|
14656
14864
|
return validateExpression(options);
|
|
@@ -14677,7 +14885,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14677
14885
|
return errors;
|
|
14678
14886
|
}
|
|
14679
14887
|
|
|
14680
|
-
function validateStyle(style, styleSpec = v8) {
|
|
14888
|
+
function validateStyle$1(style, styleSpec = v8) {
|
|
14681
14889
|
const errors = validate({
|
|
14682
14890
|
key: '',
|
|
14683
14891
|
value: style,
|
|
@@ -14692,7 +14900,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14692
14900
|
return sortErrors(errors);
|
|
14693
14901
|
}
|
|
14694
14902
|
function sortErrors(errors) {
|
|
14695
|
-
return errors.slice().sort((a, b) => a.line - b.line);
|
|
14903
|
+
return errors.slice().sort((a, b) => a.line && b.line ? a.line - b.line : 0);
|
|
14696
14904
|
}
|
|
14697
14905
|
|
|
14698
14906
|
/* parser generated by jison 0.4.15 */
|
|
@@ -15354,25 +15562,27 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
15354
15562
|
}
|
|
15355
15563
|
});
|
|
15356
15564
|
|
|
15565
|
+
var jsonlint$1 = jsonlint;
|
|
15566
|
+
|
|
15357
15567
|
function readStyle(style) {
|
|
15358
15568
|
if (style instanceof String || typeof style === 'string' || style instanceof Buffer) {
|
|
15359
15569
|
try {
|
|
15360
|
-
return jsonlint.parse(style.toString());
|
|
15570
|
+
return jsonlint$1.parse(style.toString());
|
|
15361
15571
|
} catch (e) {
|
|
15362
|
-
throw new ParsingError
|
|
15572
|
+
throw new ParsingError(e);
|
|
15363
15573
|
}
|
|
15364
15574
|
}
|
|
15365
15575
|
return style;
|
|
15366
15576
|
}
|
|
15367
15577
|
|
|
15368
|
-
function validateStyle
|
|
15578
|
+
function validateStyle(style, styleSpec = v8) {
|
|
15369
15579
|
let s = style;
|
|
15370
15580
|
try {
|
|
15371
15581
|
s = readStyle(s);
|
|
15372
15582
|
} catch (e) {
|
|
15373
15583
|
return [e];
|
|
15374
15584
|
}
|
|
15375
|
-
return validateStyle(s, styleSpec);
|
|
15585
|
+
return validateStyle$1(s, styleSpec);
|
|
15376
15586
|
}
|
|
15377
15587
|
|
|
15378
15588
|
const SUPPORTED_SPEC_VERSION = 8;
|
|
@@ -15481,14 +15691,14 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
15481
15691
|
} catch (e) {
|
|
15482
15692
|
return [e];
|
|
15483
15693
|
}
|
|
15484
|
-
let errors = validateStyle(s, v8).concat(getRootErrors(s, Object.keys(v8.$root)));
|
|
15694
|
+
let errors = validateStyle$1(s, v8).concat(getRootErrors(s, Object.keys(v8.$root)));
|
|
15485
15695
|
if (s.sources) {
|
|
15486
15696
|
errors = errors.concat(getSourcesErrors(s.sources));
|
|
15487
15697
|
}
|
|
15488
15698
|
return errors;
|
|
15489
15699
|
}
|
|
15490
15700
|
|
|
15491
|
-
const expression
|
|
15701
|
+
const expression = {
|
|
15492
15702
|
StyleExpression,
|
|
15493
15703
|
isExpression,
|
|
15494
15704
|
isExpressionFilter,
|
|
@@ -15502,7 +15712,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
15502
15712
|
const styleFunction = {
|
|
15503
15713
|
convertFunction,
|
|
15504
15714
|
createFunction,
|
|
15505
|
-
isFunction
|
|
15715
|
+
isFunction
|
|
15506
15716
|
};
|
|
15507
15717
|
const visit = {
|
|
15508
15718
|
eachSource,
|
|
@@ -15510,25 +15720,25 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
15510
15720
|
eachProperty
|
|
15511
15721
|
};
|
|
15512
15722
|
|
|
15513
|
-
exports.Color = Color;
|
|
15514
|
-
exports.ParsingError = ParsingError
|
|
15723
|
+
exports.Color = Color$1;
|
|
15724
|
+
exports.ParsingError = ParsingError;
|
|
15515
15725
|
exports.ValidationError = ValidationError;
|
|
15516
15726
|
exports.composite = composite;
|
|
15517
|
-
exports.convertFilter = convertFilter
|
|
15727
|
+
exports.convertFilter = convertFilter;
|
|
15518
15728
|
exports.derefLayers = derefLayers;
|
|
15519
15729
|
exports.diff = diffStyles;
|
|
15520
|
-
exports.expression = expression
|
|
15730
|
+
exports.expression = expression;
|
|
15521
15731
|
exports.featureFilter = createFilter;
|
|
15522
|
-
exports.format = format;
|
|
15523
|
-
exports
|
|
15732
|
+
exports.format = format$1;
|
|
15733
|
+
exports["function"] = styleFunction;
|
|
15524
15734
|
exports.latest = v8;
|
|
15525
15735
|
exports.migrate = migrate;
|
|
15526
15736
|
exports.v8 = v8;
|
|
15527
|
-
exports.validate = validateStyle
|
|
15737
|
+
exports.validate = validateStyle;
|
|
15528
15738
|
exports.validateMapboxApiSupported = validateMapboxApiSupported;
|
|
15529
15739
|
exports.visit = visit;
|
|
15530
15740
|
|
|
15531
15741
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
15532
15742
|
|
|
15533
|
-
}))
|
|
15743
|
+
}));
|
|
15534
15744
|
//# sourceMappingURL=index.cjs.map
|