@mapbox/mapbox-gl-style-spec 14.4.0-beta.1 → 14.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +144 -186
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +144 -186
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/reference/v8.json +34 -1
- package/rollup.config.js +1 -0
- package/types.js +132 -19
package/dist/index.es.js
CHANGED
|
@@ -957,11 +957,21 @@ var source_geojson = {
|
|
|
957
957
|
generateId: {
|
|
958
958
|
type: "boolean",
|
|
959
959
|
"default": false,
|
|
960
|
-
doc: "Whether to generate ids for the
|
|
960
|
+
doc: "Whether to generate ids for the GeoJSON features. When enabled, the `feature.id` property will be auto assigned based on its index in the `features` array, over-writing any previous values."
|
|
961
961
|
},
|
|
962
962
|
promoteId: {
|
|
963
963
|
type: "promoteId",
|
|
964
964
|
doc: "A property to use as a feature id (for feature state). Either a property name, or an object of the form `{<sourceLayer>: <propertyName>}`."
|
|
965
|
+
},
|
|
966
|
+
dynamic: {
|
|
967
|
+
type: "boolean",
|
|
968
|
+
"default": false,
|
|
969
|
+
doc: "Whether to optimize this source for frequent data updates (e.g. animating features).",
|
|
970
|
+
"sdk-support": {
|
|
971
|
+
"basic functionality": {
|
|
972
|
+
js: "3.4.0"
|
|
973
|
+
}
|
|
974
|
+
}
|
|
965
975
|
}
|
|
966
976
|
};
|
|
967
977
|
var source_video = {
|
|
@@ -7898,6 +7908,43 @@ var paint_model = {
|
|
|
7898
7908
|
}
|
|
7899
7909
|
},
|
|
7900
7910
|
"property-type": "data-constant"
|
|
7911
|
+
},
|
|
7912
|
+
"model-front-cutoff": {
|
|
7913
|
+
type: "array",
|
|
7914
|
+
"private": true,
|
|
7915
|
+
value: "number",
|
|
7916
|
+
"property-type": "data-constant",
|
|
7917
|
+
transition: false,
|
|
7918
|
+
expression: {
|
|
7919
|
+
interpolated: true,
|
|
7920
|
+
parameters: [
|
|
7921
|
+
"zoom"
|
|
7922
|
+
]
|
|
7923
|
+
},
|
|
7924
|
+
length: 3,
|
|
7925
|
+
"default": [
|
|
7926
|
+
0,
|
|
7927
|
+
0,
|
|
7928
|
+
1
|
|
7929
|
+
],
|
|
7930
|
+
minimum: [
|
|
7931
|
+
0,
|
|
7932
|
+
0,
|
|
7933
|
+
0
|
|
7934
|
+
],
|
|
7935
|
+
maximum: [
|
|
7936
|
+
1,
|
|
7937
|
+
1,
|
|
7938
|
+
1
|
|
7939
|
+
],
|
|
7940
|
+
doc: "An array for configuring the fade-out effect for the front cutoff of content on pitched map views. It contains three values: start, range and final opacity. The start parameter defines the point at which the fade-out effect begins, with smaller values causing the effect to start earlier. The range parameter specifies how long the fade-out effect will last. A value of 0.0 for range makes content disappear immediately without a fade-out effect. The final opacity determines content opacity at the end of the fade-out effect. A value of 1.0 for final opacity means that the cutoff is completely disabled.",
|
|
7941
|
+
"sdk-support": {
|
|
7942
|
+
"basic functionality": {
|
|
7943
|
+
js: "3.5.0",
|
|
7944
|
+
android: "11.5.0",
|
|
7945
|
+
ios: "11.5.0"
|
|
7946
|
+
}
|
|
7947
|
+
}
|
|
7901
7948
|
}
|
|
7902
7949
|
};
|
|
7903
7950
|
var transition = {
|
|
@@ -9293,7 +9340,6 @@ let ParsingError$1 = class ParsingError extends Error {
|
|
|
9293
9340
|
this.key = key;
|
|
9294
9341
|
}
|
|
9295
9342
|
};
|
|
9296
|
-
var ParsingError$2 = ParsingError$1;
|
|
9297
9343
|
|
|
9298
9344
|
//
|
|
9299
9345
|
/**
|
|
@@ -9326,7 +9372,6 @@ class Scope {
|
|
|
9326
9372
|
return this.parent ? this.parent.has(name) : false;
|
|
9327
9373
|
}
|
|
9328
9374
|
}
|
|
9329
|
-
var Scope$1 = Scope;
|
|
9330
9375
|
|
|
9331
9376
|
//
|
|
9332
9377
|
const NullType = { kind: 'null' };
|
|
@@ -10927,7 +10972,6 @@ class Literal {
|
|
|
10927
10972
|
}
|
|
10928
10973
|
}
|
|
10929
10974
|
}
|
|
10930
|
-
var Literal$1 = Literal;
|
|
10931
10975
|
|
|
10932
10976
|
//
|
|
10933
10977
|
class RuntimeError {
|
|
@@ -10939,7 +10983,6 @@ class RuntimeError {
|
|
|
10939
10983
|
return this.message;
|
|
10940
10984
|
}
|
|
10941
10985
|
}
|
|
10942
|
-
var RuntimeError$1 = RuntimeError;
|
|
10943
10986
|
|
|
10944
10987
|
const types$1 = {
|
|
10945
10988
|
string: StringType,
|
|
@@ -10997,7 +11040,7 @@ class Assertion {
|
|
|
10997
11040
|
if (!error) {
|
|
10998
11041
|
return value;
|
|
10999
11042
|
} else if (i === this.args.length - 1) {
|
|
11000
|
-
throw new RuntimeError
|
|
11043
|
+
throw new RuntimeError(`Expected value to be of type ${ toString$1(this.type) }, but found ${ toString$1(typeOf(value)) } instead.`);
|
|
11001
11044
|
}
|
|
11002
11045
|
}
|
|
11003
11046
|
return null;
|
|
@@ -11024,7 +11067,6 @@ class Assertion {
|
|
|
11024
11067
|
return serialized.concat(this.args.map(arg => arg.serialize()));
|
|
11025
11068
|
}
|
|
11026
11069
|
}
|
|
11027
|
-
var Assertion$1 = Assertion;
|
|
11028
11070
|
|
|
11029
11071
|
//
|
|
11030
11072
|
class FormatExpression {
|
|
@@ -11311,7 +11353,7 @@ class Coercion {
|
|
|
11311
11353
|
}
|
|
11312
11354
|
}
|
|
11313
11355
|
}
|
|
11314
|
-
throw new RuntimeError
|
|
11356
|
+
throw new RuntimeError(error || `Could not parse color from value '${ typeof input === 'string' ? input : String(JSON.stringify(input)) }'`);
|
|
11315
11357
|
} else if (this.type.kind === 'number') {
|
|
11316
11358
|
let value = null;
|
|
11317
11359
|
for (const arg of this.args) {
|
|
@@ -11323,7 +11365,7 @@ class Coercion {
|
|
|
11323
11365
|
continue;
|
|
11324
11366
|
return num;
|
|
11325
11367
|
}
|
|
11326
|
-
throw new RuntimeError
|
|
11368
|
+
throw new RuntimeError(`Could not convert ${ JSON.stringify(value) } to number.`);
|
|
11327
11369
|
} else if (this.type.kind === 'formatted') {
|
|
11328
11370
|
// There is no explicit 'to-formatted' but this coercion can be implicitly
|
|
11329
11371
|
// created by properties that expect the 'formatted' type.
|
|
@@ -11363,7 +11405,6 @@ class Coercion {
|
|
|
11363
11405
|
return serialized;
|
|
11364
11406
|
}
|
|
11365
11407
|
}
|
|
11366
|
-
var Coercion$1 = Coercion;
|
|
11367
11408
|
|
|
11368
11409
|
//
|
|
11369
11410
|
const geometryTypes = [
|
|
@@ -11432,7 +11473,6 @@ class EvaluationContext {
|
|
|
11432
11473
|
return this.options ? this.options.get(id) : null;
|
|
11433
11474
|
}
|
|
11434
11475
|
}
|
|
11435
|
-
var EvaluationContext$1 = EvaluationContext;
|
|
11436
11476
|
|
|
11437
11477
|
//
|
|
11438
11478
|
class CompoundExpression {
|
|
@@ -11483,7 +11523,7 @@ class CompoundExpression {
|
|
|
11483
11523
|
overloadIndex++;
|
|
11484
11524
|
// Use a fresh context for each attempted signature so that, if
|
|
11485
11525
|
// we eventually succeed, we haven't polluted `context.errors`.
|
|
11486
|
-
signatureContext = new ParsingContext
|
|
11526
|
+
signatureContext = new ParsingContext(context.registry, context.path, null, context.scope, undefined, context._scope, context.options);
|
|
11487
11527
|
// First parse all the args, potentially coercing to the
|
|
11488
11528
|
// types expected by this overload.
|
|
11489
11529
|
const parsedArgs = [];
|
|
@@ -11551,7 +11591,6 @@ function stringifySignature(signature) {
|
|
|
11551
11591
|
return `(${ toString$1(signature.type) }...)`;
|
|
11552
11592
|
}
|
|
11553
11593
|
}
|
|
11554
|
-
var CompoundExpression$1 = CompoundExpression;
|
|
11555
11594
|
|
|
11556
11595
|
//
|
|
11557
11596
|
class CollatorExpression {
|
|
@@ -11612,57 +11651,6 @@ class CollatorExpression {
|
|
|
11612
11651
|
}
|
|
11613
11652
|
}
|
|
11614
11653
|
|
|
11615
|
-
function quickselect(arr, k, left, right, compare) {
|
|
11616
|
-
quickselectStep(arr, k, left || 0, right || arr.length - 1, compare || defaultCompare$1);
|
|
11617
|
-
}
|
|
11618
|
-
function quickselectStep(arr, k, left, right, compare) {
|
|
11619
|
-
while (right > left) {
|
|
11620
|
-
if (right - left > 600) {
|
|
11621
|
-
var n = right - left + 1;
|
|
11622
|
-
var m = k - left + 1;
|
|
11623
|
-
var z = Math.log(n);
|
|
11624
|
-
var s = 0.5 * Math.exp(2 * z / 3);
|
|
11625
|
-
var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
|
|
11626
|
-
var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
|
|
11627
|
-
var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
|
|
11628
|
-
quickselectStep(arr, k, newLeft, newRight, compare);
|
|
11629
|
-
}
|
|
11630
|
-
var t = arr[k];
|
|
11631
|
-
var i = left;
|
|
11632
|
-
var j = right;
|
|
11633
|
-
swap(arr, left, k);
|
|
11634
|
-
if (compare(arr[right], t) > 0)
|
|
11635
|
-
swap(arr, left, right);
|
|
11636
|
-
while (i < j) {
|
|
11637
|
-
swap(arr, i, j);
|
|
11638
|
-
i++;
|
|
11639
|
-
j--;
|
|
11640
|
-
while (compare(arr[i], t) < 0)
|
|
11641
|
-
i++;
|
|
11642
|
-
while (compare(arr[j], t) > 0)
|
|
11643
|
-
j--;
|
|
11644
|
-
}
|
|
11645
|
-
if (compare(arr[left], t) === 0)
|
|
11646
|
-
swap(arr, left, j);
|
|
11647
|
-
else {
|
|
11648
|
-
j++;
|
|
11649
|
-
swap(arr, j, right);
|
|
11650
|
-
}
|
|
11651
|
-
if (j <= k)
|
|
11652
|
-
left = j + 1;
|
|
11653
|
-
if (k <= j)
|
|
11654
|
-
right = j - 1;
|
|
11655
|
-
}
|
|
11656
|
-
}
|
|
11657
|
-
function swap(arr, i, j) {
|
|
11658
|
-
var tmp = arr[i];
|
|
11659
|
-
arr[i] = arr[j];
|
|
11660
|
-
arr[j] = tmp;
|
|
11661
|
-
}
|
|
11662
|
-
function defaultCompare$1(a, b) {
|
|
11663
|
-
return a < b ? -1 : a > b ? 1 : 0;
|
|
11664
|
-
}
|
|
11665
|
-
|
|
11666
11654
|
//
|
|
11667
11655
|
// minX, minY, maxX, maxY
|
|
11668
11656
|
/**
|
|
@@ -11679,9 +11667,6 @@ function calculateSignedArea(ring) {
|
|
|
11679
11667
|
}
|
|
11680
11668
|
return sum;
|
|
11681
11669
|
}
|
|
11682
|
-
function compareAreas(a, b) {
|
|
11683
|
-
return b.area - a.area;
|
|
11684
|
-
}
|
|
11685
11670
|
// classifies an array of rings into polygons with outer rings and holes
|
|
11686
11671
|
function classifyRings(rings, maxRings) {
|
|
11687
11672
|
const len = rings.length;
|
|
@@ -11706,16 +11691,6 @@ function classifyRings(rings, maxRings) {
|
|
|
11706
11691
|
}
|
|
11707
11692
|
if (polygon)
|
|
11708
11693
|
polygons.push(polygon);
|
|
11709
|
-
// Earcut performance degrades with the # of rings in a polygon. For this
|
|
11710
|
-
// reason, we limit strip out all but the `maxRings` largest rings.
|
|
11711
|
-
if (maxRings > 1) {
|
|
11712
|
-
for (let j = 0; j < polygons.length; j++) {
|
|
11713
|
-
if (polygons[j].length <= maxRings)
|
|
11714
|
-
continue;
|
|
11715
|
-
quickselect(polygons[j], maxRings, 1, polygons[j].length - 1, compareAreas);
|
|
11716
|
-
polygons[j] = polygons[j].slice(0, maxRings);
|
|
11717
|
-
}
|
|
11718
|
-
}
|
|
11719
11694
|
return polygons;
|
|
11720
11695
|
}
|
|
11721
11696
|
function updateBBox(bbox, coord) {
|
|
@@ -12078,7 +12053,6 @@ class Within {
|
|
|
12078
12053
|
];
|
|
12079
12054
|
}
|
|
12080
12055
|
}
|
|
12081
|
-
var Within$1 = Within;
|
|
12082
12056
|
|
|
12083
12057
|
/* */
|
|
12084
12058
|
const factors = {
|
|
@@ -13408,7 +13382,7 @@ function linesToGeometryDistance(originGeometry, canonical, geometry) {
|
|
|
13408
13382
|
}
|
|
13409
13383
|
function polygonsToGeometryDistance(originGeometry, canonical, geometry) {
|
|
13410
13384
|
const lngLatPolygons = [];
|
|
13411
|
-
for (const polygon of classifyRings(originGeometry
|
|
13385
|
+
for (const polygon of classifyRings(originGeometry)) {
|
|
13412
13386
|
const lngLatPolygon = [];
|
|
13413
13387
|
for (let i = 0; i < polygon.length; ++i) {
|
|
13414
13388
|
lngLatPolygon.push(getLngLatPoints(polygon[i], canonical));
|
|
@@ -13497,7 +13471,6 @@ class Distance {
|
|
|
13497
13471
|
];
|
|
13498
13472
|
}
|
|
13499
13473
|
}
|
|
13500
|
-
var Distance$1 = Distance;
|
|
13501
13474
|
|
|
13502
13475
|
//
|
|
13503
13476
|
function coerceValue(type, value) {
|
|
@@ -13546,12 +13519,12 @@ class Config {
|
|
|
13546
13519
|
return context.error(`Invalid number of arguments for 'config' expression.`);
|
|
13547
13520
|
}
|
|
13548
13521
|
const configKey = context.parse(args[1], 1);
|
|
13549
|
-
if (!(configKey instanceof Literal
|
|
13522
|
+
if (!(configKey instanceof Literal)) {
|
|
13550
13523
|
return context.error(`Key name of 'config' expression must be a string literal.`);
|
|
13551
13524
|
}
|
|
13552
13525
|
if (args.length >= 3) {
|
|
13553
13526
|
const configScope = context.parse(args[2], 2);
|
|
13554
|
-
if (!(configScope instanceof Literal
|
|
13527
|
+
if (!(configScope instanceof Literal)) {
|
|
13555
13528
|
return context.error(`Scope of 'config' expression must be a string literal.`);
|
|
13556
13529
|
}
|
|
13557
13530
|
return new Config(type, toString(configKey.value), toString(configScope.value));
|
|
@@ -13616,11 +13589,10 @@ class Config {
|
|
|
13616
13589
|
return res;
|
|
13617
13590
|
}
|
|
13618
13591
|
}
|
|
13619
|
-
var Config$1 = Config;
|
|
13620
13592
|
|
|
13621
13593
|
//
|
|
13622
13594
|
function isFeatureConstant(e) {
|
|
13623
|
-
if (e instanceof CompoundExpression
|
|
13595
|
+
if (e instanceof CompoundExpression) {
|
|
13624
13596
|
if (e.name === 'get' && e.args.length === 1) {
|
|
13625
13597
|
return false;
|
|
13626
13598
|
} else if (e.name === 'feature-state') {
|
|
@@ -13633,10 +13605,10 @@ function isFeatureConstant(e) {
|
|
|
13633
13605
|
return false;
|
|
13634
13606
|
}
|
|
13635
13607
|
}
|
|
13636
|
-
if (e instanceof Within
|
|
13608
|
+
if (e instanceof Within) {
|
|
13637
13609
|
return false;
|
|
13638
13610
|
}
|
|
13639
|
-
if (e instanceof Distance
|
|
13611
|
+
if (e instanceof Distance) {
|
|
13640
13612
|
return false;
|
|
13641
13613
|
}
|
|
13642
13614
|
let result = true;
|
|
@@ -13648,7 +13620,7 @@ function isFeatureConstant(e) {
|
|
|
13648
13620
|
return result;
|
|
13649
13621
|
}
|
|
13650
13622
|
function isStateConstant(e) {
|
|
13651
|
-
if (e instanceof CompoundExpression
|
|
13623
|
+
if (e instanceof CompoundExpression) {
|
|
13652
13624
|
if (e.name === 'feature-state') {
|
|
13653
13625
|
return false;
|
|
13654
13626
|
}
|
|
@@ -13662,7 +13634,7 @@ function isStateConstant(e) {
|
|
|
13662
13634
|
return result;
|
|
13663
13635
|
}
|
|
13664
13636
|
function isConfigConstant(e) {
|
|
13665
|
-
if (e instanceof Config
|
|
13637
|
+
if (e instanceof Config) {
|
|
13666
13638
|
return false;
|
|
13667
13639
|
}
|
|
13668
13640
|
let result = true;
|
|
@@ -13674,7 +13646,7 @@ function isConfigConstant(e) {
|
|
|
13674
13646
|
return result;
|
|
13675
13647
|
}
|
|
13676
13648
|
function isGlobalPropertyConstant(e, properties) {
|
|
13677
|
-
if (e instanceof CompoundExpression
|
|
13649
|
+
if (e instanceof CompoundExpression && properties.indexOf(e.name) >= 0) {
|
|
13678
13650
|
return false;
|
|
13679
13651
|
}
|
|
13680
13652
|
let result = true;
|
|
@@ -13717,7 +13689,6 @@ class Var {
|
|
|
13717
13689
|
];
|
|
13718
13690
|
}
|
|
13719
13691
|
}
|
|
13720
|
-
var Var$1 = Var;
|
|
13721
13692
|
|
|
13722
13693
|
//
|
|
13723
13694
|
/**
|
|
@@ -13729,7 +13700,7 @@ class ParsingContext {
|
|
|
13729
13700
|
// implementations to infer argument types: Expression#parse() need not
|
|
13730
13701
|
// check that the output type of the parsed expression matches
|
|
13731
13702
|
// `expectedType`.
|
|
13732
|
-
constructor(registry, path = [], expectedType, scope = new Scope
|
|
13703
|
+
constructor(registry, path = [], expectedType, scope = new Scope(), errors = [], _scope, options) {
|
|
13733
13704
|
this.registry = registry;
|
|
13734
13705
|
this.path = path;
|
|
13735
13706
|
this.key = path.map(part => `[${ part }]`).join('');
|
|
@@ -13761,9 +13732,9 @@ class ParsingContext {
|
|
|
13761
13732
|
}
|
|
13762
13733
|
function annotate(parsed, type, typeAnnotation) {
|
|
13763
13734
|
if (typeAnnotation === 'assert') {
|
|
13764
|
-
return new Assertion
|
|
13735
|
+
return new Assertion(type, [parsed]);
|
|
13765
13736
|
} else if (typeAnnotation === 'coerce') {
|
|
13766
|
-
return new Coercion
|
|
13737
|
+
return new Coercion(type, [parsed]);
|
|
13767
13738
|
} else {
|
|
13768
13739
|
return parsed;
|
|
13769
13740
|
}
|
|
@@ -13800,10 +13771,10 @@ class ParsingContext {
|
|
|
13800
13771
|
// it immediately and replace it with a literal value in the
|
|
13801
13772
|
// parsed/compiled result. Expressions that expect an image should
|
|
13802
13773
|
// not be resolved here so we can later get the available images.
|
|
13803
|
-
if (!(parsed instanceof Literal
|
|
13804
|
-
const ec = new EvaluationContext
|
|
13774
|
+
if (!(parsed instanceof Literal) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
|
|
13775
|
+
const ec = new EvaluationContext(this._scope, this.options);
|
|
13805
13776
|
try {
|
|
13806
|
-
parsed = new Literal
|
|
13777
|
+
parsed = new Literal(parsed.type, parsed.evaluate(ec));
|
|
13807
13778
|
} catch (e) {
|
|
13808
13779
|
this.error(e.message);
|
|
13809
13780
|
return null;
|
|
@@ -13812,7 +13783,7 @@ class ParsingContext {
|
|
|
13812
13783
|
return parsed;
|
|
13813
13784
|
}
|
|
13814
13785
|
// Try to parse as array
|
|
13815
|
-
return Coercion
|
|
13786
|
+
return Coercion.parse([
|
|
13816
13787
|
'to-array',
|
|
13817
13788
|
expr
|
|
13818
13789
|
], this);
|
|
@@ -13846,7 +13817,7 @@ class ParsingContext {
|
|
|
13846
13817
|
*/
|
|
13847
13818
|
error(error, ...keys) {
|
|
13848
13819
|
const key = `${ this.key }${ keys.map(k => `[${ k }]`).join('') }`;
|
|
13849
|
-
this.errors.push(new ParsingError$
|
|
13820
|
+
this.errors.push(new ParsingError$1(key, error));
|
|
13850
13821
|
}
|
|
13851
13822
|
/**
|
|
13852
13823
|
* Returns null if `t` is a subtype of `expected`; otherwise returns an
|
|
@@ -13859,25 +13830,24 @@ class ParsingContext {
|
|
|
13859
13830
|
return error;
|
|
13860
13831
|
}
|
|
13861
13832
|
}
|
|
13862
|
-
var ParsingContext$1 = ParsingContext;
|
|
13863
13833
|
function isConstant(expression) {
|
|
13864
|
-
if (expression instanceof Var
|
|
13834
|
+
if (expression instanceof Var) {
|
|
13865
13835
|
return isConstant(expression.boundExpression);
|
|
13866
|
-
} else if (expression instanceof CompoundExpression
|
|
13836
|
+
} else if (expression instanceof CompoundExpression && expression.name === 'error') {
|
|
13867
13837
|
return false;
|
|
13868
13838
|
} else if (expression instanceof CollatorExpression) {
|
|
13869
13839
|
// Although the results of a Collator expression with fixed arguments
|
|
13870
13840
|
// generally shouldn't change between executions, we can't serialize them
|
|
13871
13841
|
// as constant expressions because results change based on environment.
|
|
13872
13842
|
return false;
|
|
13873
|
-
} else if (expression instanceof Within
|
|
13843
|
+
} else if (expression instanceof Within) {
|
|
13874
13844
|
return false;
|
|
13875
|
-
} else if (expression instanceof Distance
|
|
13845
|
+
} else if (expression instanceof Distance) {
|
|
13876
13846
|
return false;
|
|
13877
|
-
} else if (expression instanceof Config
|
|
13847
|
+
} else if (expression instanceof Config) {
|
|
13878
13848
|
return false;
|
|
13879
13849
|
}
|
|
13880
|
-
const isTypeAnnotation = expression instanceof Coercion
|
|
13850
|
+
const isTypeAnnotation = expression instanceof Coercion || expression instanceof Assertion;
|
|
13881
13851
|
let childrenConstant = true;
|
|
13882
13852
|
expression.eachChild(child => {
|
|
13883
13853
|
// We can _almost_ assume that if `expressions` children are constant,
|
|
@@ -13889,7 +13859,7 @@ function isConstant(expression) {
|
|
|
13889
13859
|
if (isTypeAnnotation) {
|
|
13890
13860
|
childrenConstant = childrenConstant && isConstant(child);
|
|
13891
13861
|
} else {
|
|
13892
|
-
childrenConstant = childrenConstant && child instanceof Literal
|
|
13862
|
+
childrenConstant = childrenConstant && child instanceof Literal;
|
|
13893
13863
|
}
|
|
13894
13864
|
});
|
|
13895
13865
|
if (!childrenConstant) {
|
|
@@ -13934,7 +13904,7 @@ function findStopLessThanOrEqualTo(stops, input) {
|
|
|
13934
13904
|
} else if (currentValue > input) {
|
|
13935
13905
|
upperIndex = currentIndex - 1;
|
|
13936
13906
|
} else {
|
|
13937
|
-
throw new RuntimeError
|
|
13907
|
+
throw new RuntimeError('Input is not a number.');
|
|
13938
13908
|
}
|
|
13939
13909
|
}
|
|
13940
13910
|
return 0;
|
|
@@ -14029,7 +13999,6 @@ class Step {
|
|
|
14029
13999
|
return serialized;
|
|
14030
14000
|
}
|
|
14031
14001
|
}
|
|
14032
|
-
var Step$1 = Step;
|
|
14033
14002
|
|
|
14034
14003
|
var unitbezier = UnitBezier;
|
|
14035
14004
|
function UnitBezier(p1x, p1y, p2x, p2y) {
|
|
@@ -14417,7 +14386,6 @@ function exponentialInterpolation(input, base, lowerValue, upperValue) {
|
|
|
14417
14386
|
return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);
|
|
14418
14387
|
}
|
|
14419
14388
|
}
|
|
14420
|
-
var Interpolate$1 = Interpolate;
|
|
14421
14389
|
|
|
14422
14390
|
class Coalesce {
|
|
14423
14391
|
constructor(type, args) {
|
|
@@ -14488,7 +14456,6 @@ class Coalesce {
|
|
|
14488
14456
|
return serialized;
|
|
14489
14457
|
}
|
|
14490
14458
|
}
|
|
14491
|
-
var Coalesce$1 = Coalesce;
|
|
14492
14459
|
|
|
14493
14460
|
//
|
|
14494
14461
|
class Let {
|
|
@@ -14543,7 +14510,6 @@ class Let {
|
|
|
14543
14510
|
return serialized;
|
|
14544
14511
|
}
|
|
14545
14512
|
}
|
|
14546
|
-
var Let$1 = Let;
|
|
14547
14513
|
|
|
14548
14514
|
//
|
|
14549
14515
|
class At {
|
|
@@ -14566,13 +14532,13 @@ class At {
|
|
|
14566
14532
|
const index = this.index.evaluate(ctx);
|
|
14567
14533
|
const array = this.input.evaluate(ctx);
|
|
14568
14534
|
if (index < 0) {
|
|
14569
|
-
throw new RuntimeError
|
|
14535
|
+
throw new RuntimeError(`Array index out of bounds: ${ index } < 0.`);
|
|
14570
14536
|
}
|
|
14571
14537
|
if (index >= array.length) {
|
|
14572
|
-
throw new RuntimeError
|
|
14538
|
+
throw new RuntimeError(`Array index out of bounds: ${ index } > ${ array.length - 1 }.`);
|
|
14573
14539
|
}
|
|
14574
14540
|
if (index !== Math.floor(index)) {
|
|
14575
|
-
throw new RuntimeError
|
|
14541
|
+
throw new RuntimeError(`Array index must be an integer, but found ${ index } instead.`);
|
|
14576
14542
|
}
|
|
14577
14543
|
return array[index];
|
|
14578
14544
|
}
|
|
@@ -14591,7 +14557,6 @@ class At {
|
|
|
14591
14557
|
];
|
|
14592
14558
|
}
|
|
14593
14559
|
}
|
|
14594
|
-
var At$1 = At;
|
|
14595
14560
|
|
|
14596
14561
|
//
|
|
14597
14562
|
class In {
|
|
@@ -14630,13 +14595,13 @@ class In {
|
|
|
14630
14595
|
'number',
|
|
14631
14596
|
'null'
|
|
14632
14597
|
])) {
|
|
14633
|
-
throw new RuntimeError
|
|
14598
|
+
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
14634
14599
|
}
|
|
14635
14600
|
if (!isValidNativeType(haystack, [
|
|
14636
14601
|
'string',
|
|
14637
14602
|
'array'
|
|
14638
14603
|
])) {
|
|
14639
|
-
throw new RuntimeError
|
|
14604
|
+
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
14640
14605
|
}
|
|
14641
14606
|
return haystack.indexOf(needle) >= 0;
|
|
14642
14607
|
}
|
|
@@ -14655,7 +14620,6 @@ class In {
|
|
|
14655
14620
|
];
|
|
14656
14621
|
}
|
|
14657
14622
|
}
|
|
14658
|
-
var In$1 = In;
|
|
14659
14623
|
|
|
14660
14624
|
//
|
|
14661
14625
|
class IndexOf {
|
|
@@ -14700,13 +14664,13 @@ class IndexOf {
|
|
|
14700
14664
|
'number',
|
|
14701
14665
|
'null'
|
|
14702
14666
|
])) {
|
|
14703
|
-
throw new RuntimeError
|
|
14667
|
+
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
14704
14668
|
}
|
|
14705
14669
|
if (!isValidNativeType(haystack, [
|
|
14706
14670
|
'string',
|
|
14707
14671
|
'array'
|
|
14708
14672
|
])) {
|
|
14709
|
-
throw new RuntimeError
|
|
14673
|
+
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
14710
14674
|
}
|
|
14711
14675
|
if (this.fromIndex) {
|
|
14712
14676
|
const fromIndex = this.fromIndex.evaluate(ctx);
|
|
@@ -14741,7 +14705,6 @@ class IndexOf {
|
|
|
14741
14705
|
];
|
|
14742
14706
|
}
|
|
14743
14707
|
}
|
|
14744
|
-
var IndexOf$1 = IndexOf;
|
|
14745
14708
|
|
|
14746
14709
|
// Map input label values to output expression index
|
|
14747
14710
|
class Match {
|
|
@@ -14864,7 +14827,6 @@ class Match {
|
|
|
14864
14827
|
return serialized;
|
|
14865
14828
|
}
|
|
14866
14829
|
}
|
|
14867
|
-
var Match$1 = Match;
|
|
14868
14830
|
|
|
14869
14831
|
class Case {
|
|
14870
14832
|
constructor(type, branches, otherwise) {
|
|
@@ -14926,7 +14888,6 @@ class Case {
|
|
|
14926
14888
|
return serialized;
|
|
14927
14889
|
}
|
|
14928
14890
|
}
|
|
14929
|
-
var Case$1 = Case;
|
|
14930
14891
|
|
|
14931
14892
|
//
|
|
14932
14893
|
class Slice {
|
|
@@ -14967,7 +14928,7 @@ class Slice {
|
|
|
14967
14928
|
'string',
|
|
14968
14929
|
'array'
|
|
14969
14930
|
])) {
|
|
14970
|
-
throw new RuntimeError
|
|
14931
|
+
throw new RuntimeError(`Expected first argument to be of type array or string, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
14971
14932
|
}
|
|
14972
14933
|
if (this.endIndex) {
|
|
14973
14934
|
const endIndex = this.endIndex.evaluate(ctx);
|
|
@@ -15002,7 +14963,6 @@ class Slice {
|
|
|
15002
14963
|
];
|
|
15003
14964
|
}
|
|
15004
14965
|
}
|
|
15005
|
-
var Slice$1 = Slice;
|
|
15006
14966
|
|
|
15007
14967
|
//
|
|
15008
14968
|
function isComparableType(op, type) {
|
|
@@ -15102,10 +15062,10 @@ function makeComparison(op, compareBasic, compareWithCollator) {
|
|
|
15102
15062
|
// typing rules specific to less/greater than operators
|
|
15103
15063
|
if (lhs.type.kind === 'value' && rhs.type.kind !== 'value') {
|
|
15104
15064
|
// (value, T)
|
|
15105
|
-
lhs = new Assertion
|
|
15065
|
+
lhs = new Assertion(rhs.type, [lhs]);
|
|
15106
15066
|
} else if (lhs.type.kind !== 'value' && rhs.type.kind === 'value') {
|
|
15107
15067
|
// (T, value)
|
|
15108
|
-
rhs = new Assertion
|
|
15068
|
+
rhs = new Assertion(lhs.type, [rhs]);
|
|
15109
15069
|
}
|
|
15110
15070
|
}
|
|
15111
15071
|
let collator = null;
|
|
@@ -15127,7 +15087,7 @@ function makeComparison(op, compareBasic, compareWithCollator) {
|
|
|
15127
15087
|
const rt = typeOf(rhs);
|
|
15128
15088
|
// check that type is string or number, and equal
|
|
15129
15089
|
if (lt.kind !== rt.kind || !(lt.kind === 'string' || lt.kind === 'number')) {
|
|
15130
|
-
throw new RuntimeError
|
|
15090
|
+
throw new RuntimeError(`Expected arguments for "${ op }" to be (string, string) or (number, number), but found (${ lt.kind }, ${ rt.kind }) instead.`);
|
|
15131
15091
|
}
|
|
15132
15092
|
}
|
|
15133
15093
|
if (this.collator && !isOrderComparison && this.hasUntypedArgument) {
|
|
@@ -15300,7 +15260,7 @@ class Length {
|
|
|
15300
15260
|
} else if (Array.isArray(input)) {
|
|
15301
15261
|
return input.length;
|
|
15302
15262
|
} else {
|
|
15303
|
-
throw new RuntimeError
|
|
15263
|
+
throw new RuntimeError(`Expected value to be of type string or array, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
15304
15264
|
}
|
|
15305
15265
|
}
|
|
15306
15266
|
eachChild(fn) {
|
|
@@ -15317,7 +15277,6 @@ class Length {
|
|
|
15317
15277
|
return serialized;
|
|
15318
15278
|
}
|
|
15319
15279
|
}
|
|
15320
|
-
var Length$1 = Length;
|
|
15321
15280
|
|
|
15322
15281
|
//
|
|
15323
15282
|
// Seeded pseudo random generator function
|
|
@@ -15341,14 +15300,14 @@ const expressions = {
|
|
|
15341
15300
|
'>=': GreaterThanOrEqual,
|
|
15342
15301
|
'<=': LessThanOrEqual,
|
|
15343
15302
|
// $FlowFixMe[method-unbinding]
|
|
15344
|
-
'array': Assertion
|
|
15303
|
+
'array': Assertion,
|
|
15345
15304
|
// $FlowFixMe[method-unbinding]
|
|
15346
|
-
'at': At
|
|
15347
|
-
'boolean': Assertion
|
|
15305
|
+
'at': At,
|
|
15306
|
+
'boolean': Assertion,
|
|
15348
15307
|
// $FlowFixMe[method-unbinding]
|
|
15349
|
-
'case': Case
|
|
15308
|
+
'case': Case,
|
|
15350
15309
|
// $FlowFixMe[method-unbinding]
|
|
15351
|
-
'coalesce': Coalesce
|
|
15310
|
+
'coalesce': Coalesce,
|
|
15352
15311
|
// $FlowFixMe[method-unbinding]
|
|
15353
15312
|
'collator': CollatorExpression,
|
|
15354
15313
|
// $FlowFixMe[method-unbinding]
|
|
@@ -15356,43 +15315,43 @@ const expressions = {
|
|
|
15356
15315
|
// $FlowFixMe[method-unbinding]
|
|
15357
15316
|
'image': ImageExpression,
|
|
15358
15317
|
// $FlowFixMe[method-unbinding]
|
|
15359
|
-
'in': In
|
|
15318
|
+
'in': In,
|
|
15360
15319
|
// $FlowFixMe[method-unbinding]
|
|
15361
|
-
'index-of': IndexOf
|
|
15320
|
+
'index-of': IndexOf,
|
|
15362
15321
|
// $FlowFixMe[method-unbinding]
|
|
15363
|
-
'interpolate': Interpolate
|
|
15364
|
-
'interpolate-hcl': Interpolate
|
|
15365
|
-
'interpolate-lab': Interpolate
|
|
15322
|
+
'interpolate': Interpolate,
|
|
15323
|
+
'interpolate-hcl': Interpolate,
|
|
15324
|
+
'interpolate-lab': Interpolate,
|
|
15366
15325
|
// $FlowFixMe[method-unbinding]
|
|
15367
|
-
'length': Length
|
|
15326
|
+
'length': Length,
|
|
15368
15327
|
// $FlowFixMe[method-unbinding]
|
|
15369
|
-
'let': Let
|
|
15328
|
+
'let': Let,
|
|
15370
15329
|
// $FlowFixMe[method-unbinding]
|
|
15371
|
-
'literal': Literal
|
|
15330
|
+
'literal': Literal,
|
|
15372
15331
|
// $FlowFixMe[method-unbinding]
|
|
15373
|
-
'match': Match
|
|
15374
|
-
'number': Assertion
|
|
15332
|
+
'match': Match,
|
|
15333
|
+
'number': Assertion,
|
|
15375
15334
|
// $FlowFixMe[method-unbinding]
|
|
15376
15335
|
'number-format': NumberFormat,
|
|
15377
|
-
'object': Assertion
|
|
15336
|
+
'object': Assertion,
|
|
15378
15337
|
// $FlowFixMe[method-unbinding]
|
|
15379
|
-
'slice': Slice
|
|
15338
|
+
'slice': Slice,
|
|
15380
15339
|
// $FlowFixMe[method-unbinding]
|
|
15381
|
-
'step': Step
|
|
15382
|
-
'string': Assertion
|
|
15340
|
+
'step': Step,
|
|
15341
|
+
'string': Assertion,
|
|
15383
15342
|
// $FlowFixMe[method-unbinding]
|
|
15384
|
-
'to-boolean': Coercion
|
|
15385
|
-
'to-color': Coercion
|
|
15386
|
-
'to-number': Coercion
|
|
15387
|
-
'to-string': Coercion
|
|
15343
|
+
'to-boolean': Coercion,
|
|
15344
|
+
'to-color': Coercion,
|
|
15345
|
+
'to-number': Coercion,
|
|
15346
|
+
'to-string': Coercion,
|
|
15388
15347
|
// $FlowFixMe[method-unbinding]
|
|
15389
|
-
'var': Var
|
|
15348
|
+
'var': Var,
|
|
15390
15349
|
// $FlowFixMe[method-unbinding]
|
|
15391
|
-
'within': Within
|
|
15350
|
+
'within': Within,
|
|
15392
15351
|
// $FlowFixMe[method-unbinding]
|
|
15393
|
-
'distance': Distance
|
|
15352
|
+
'distance': Distance,
|
|
15394
15353
|
// $FlowFixMe[method-unbinding]
|
|
15395
|
-
'config': Config
|
|
15354
|
+
'config': Config
|
|
15396
15355
|
};
|
|
15397
15356
|
function rgba(ctx, [r, g, b, a]) {
|
|
15398
15357
|
r = r.evaluate(ctx);
|
|
@@ -15401,7 +15360,7 @@ function rgba(ctx, [r, g, b, a]) {
|
|
|
15401
15360
|
const alpha = a ? a.evaluate(ctx) : 1;
|
|
15402
15361
|
const error = validateRGBA(r, g, b, alpha);
|
|
15403
15362
|
if (error)
|
|
15404
|
-
throw new RuntimeError
|
|
15363
|
+
throw new RuntimeError(error);
|
|
15405
15364
|
return new Color$1(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);
|
|
15406
15365
|
}
|
|
15407
15366
|
function hsla(ctx, [h, s, l, a]) {
|
|
@@ -15411,11 +15370,11 @@ function hsla(ctx, [h, s, l, a]) {
|
|
|
15411
15370
|
const alpha = a ? a.evaluate(ctx) : 1;
|
|
15412
15371
|
const error = validateHSLA(h, s, l, alpha);
|
|
15413
15372
|
if (error)
|
|
15414
|
-
throw new RuntimeError
|
|
15373
|
+
throw new RuntimeError(error);
|
|
15415
15374
|
const colorFunction = `hsla(${ h }, ${ s }%, ${ l }%, ${ alpha })`;
|
|
15416
15375
|
const color = Color$1.parse(colorFunction);
|
|
15417
15376
|
if (!color)
|
|
15418
|
-
throw new RuntimeError
|
|
15377
|
+
throw new RuntimeError(`Failed to parse HSLA color: ${ colorFunction }`);
|
|
15419
15378
|
return color;
|
|
15420
15379
|
}
|
|
15421
15380
|
function has(key, obj) {
|
|
@@ -15452,12 +15411,12 @@ function hashString(str) {
|
|
|
15452
15411
|
}
|
|
15453
15412
|
return hash;
|
|
15454
15413
|
}
|
|
15455
|
-
CompoundExpression
|
|
15414
|
+
CompoundExpression.register(expressions, {
|
|
15456
15415
|
'error': [
|
|
15457
15416
|
ErrorType,
|
|
15458
15417
|
[StringType],
|
|
15459
15418
|
(ctx, [v]) => {
|
|
15460
|
-
throw new RuntimeError
|
|
15419
|
+
throw new RuntimeError(v.evaluate(ctx));
|
|
15461
15420
|
}
|
|
15462
15421
|
],
|
|
15463
15422
|
'typeof': [
|
|
@@ -16017,14 +15976,13 @@ CompoundExpression$1.register(expressions, {
|
|
|
16017
15976
|
} else if (typeof seed === 'number') {
|
|
16018
15977
|
seedVal = seed;
|
|
16019
15978
|
} else {
|
|
16020
|
-
throw new RuntimeError
|
|
15979
|
+
throw new RuntimeError(`Invalid seed input: ${ seed }`);
|
|
16021
15980
|
}
|
|
16022
15981
|
const random = mulberry32(seedVal)();
|
|
16023
15982
|
return min + random * (max - min);
|
|
16024
15983
|
}
|
|
16025
15984
|
]
|
|
16026
15985
|
});
|
|
16027
|
-
var definitions = expressions;
|
|
16028
15986
|
|
|
16029
15987
|
//
|
|
16030
15988
|
/**
|
|
@@ -16149,7 +16107,7 @@ function createFunction(parameters, propertySpec) {
|
|
|
16149
16107
|
return {
|
|
16150
16108
|
kind: 'composite',
|
|
16151
16109
|
interpolationType,
|
|
16152
|
-
interpolationFactor: Interpolate
|
|
16110
|
+
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
16153
16111
|
zoomStops: featureFunctionStops.map(s => s[0]),
|
|
16154
16112
|
evaluate({zoom}, properties) {
|
|
16155
16113
|
return evaluateExponentialFunction({
|
|
@@ -16166,7 +16124,7 @@ function createFunction(parameters, propertySpec) {
|
|
|
16166
16124
|
return {
|
|
16167
16125
|
kind: 'camera',
|
|
16168
16126
|
interpolationType,
|
|
16169
|
-
interpolationFactor: Interpolate
|
|
16127
|
+
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
16170
16128
|
zoomStops: parameters.stops.map(s => s[0]),
|
|
16171
16129
|
evaluate: ({zoom}) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)
|
|
16172
16130
|
};
|
|
@@ -16314,7 +16272,7 @@ class StyleExpression {
|
|
|
16314
16272
|
constructor(expression, propertySpec, scope, options) {
|
|
16315
16273
|
this.expression = expression;
|
|
16316
16274
|
this._warningHistory = {};
|
|
16317
|
-
this._evaluator = new EvaluationContext
|
|
16275
|
+
this._evaluator = new EvaluationContext(scope, options);
|
|
16318
16276
|
this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
|
|
16319
16277
|
this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;
|
|
16320
16278
|
}
|
|
@@ -16345,7 +16303,7 @@ class StyleExpression {
|
|
|
16345
16303
|
return this._defaultValue;
|
|
16346
16304
|
}
|
|
16347
16305
|
if (this._enumValues && !(val in this._enumValues)) {
|
|
16348
|
-
throw new RuntimeError
|
|
16306
|
+
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.`);
|
|
16349
16307
|
}
|
|
16350
16308
|
return val;
|
|
16351
16309
|
} catch (e) {
|
|
@@ -16360,7 +16318,7 @@ class StyleExpression {
|
|
|
16360
16318
|
}
|
|
16361
16319
|
}
|
|
16362
16320
|
function isExpression(expression) {
|
|
16363
|
-
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in
|
|
16321
|
+
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in expressions;
|
|
16364
16322
|
}
|
|
16365
16323
|
/**
|
|
16366
16324
|
* Parse and typecheck the given style spec JSON expression. If
|
|
@@ -16372,7 +16330,7 @@ function isExpression(expression) {
|
|
|
16372
16330
|
* @private
|
|
16373
16331
|
*/
|
|
16374
16332
|
function createExpression(expression, propertySpec, scope, options) {
|
|
16375
|
-
const parser = new ParsingContext
|
|
16333
|
+
const parser = new ParsingContext(expressions, [], propertySpec ? getExpectedType(propertySpec) : undefined, undefined, undefined, scope, options);
|
|
16376
16334
|
// For string-valued properties, coerce to string at the top level rather than asserting.
|
|
16377
16335
|
const parsed = parser.parse(expression, undefined, undefined, undefined, propertySpec && propertySpec.type === 'string' ? { typeAnnotation: 'coerce' } : undefined);
|
|
16378
16336
|
if (!parsed) {
|
|
@@ -16413,7 +16371,7 @@ class ZoomDependentExpression {
|
|
|
16413
16371
|
}
|
|
16414
16372
|
interpolationFactor(input, lower, upper) {
|
|
16415
16373
|
if (this.interpolationType) {
|
|
16416
|
-
return Interpolate
|
|
16374
|
+
return Interpolate.interpolationFactor(this.interpolationType, input, lower, upper);
|
|
16417
16375
|
} else {
|
|
16418
16376
|
return 0;
|
|
16419
16377
|
}
|
|
@@ -16427,7 +16385,7 @@ function createPropertyExpression(expression, propertySpec, scope, options) {
|
|
|
16427
16385
|
const parsed = expression.value.expression;
|
|
16428
16386
|
const isFeatureConstant$1 = isFeatureConstant(parsed);
|
|
16429
16387
|
if (!isFeatureConstant$1 && !supportsPropertyExpression(propertySpec)) {
|
|
16430
|
-
return error([new ParsingError$
|
|
16388
|
+
return error([new ParsingError$1('', 'data expressions not supported')]);
|
|
16431
16389
|
}
|
|
16432
16390
|
const isZoomConstant = isGlobalPropertyConstant(parsed, [
|
|
16433
16391
|
'zoom',
|
|
@@ -16435,25 +16393,25 @@ function createPropertyExpression(expression, propertySpec, scope, options) {
|
|
|
16435
16393
|
'distance-from-center'
|
|
16436
16394
|
]);
|
|
16437
16395
|
if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {
|
|
16438
|
-
return error([new ParsingError$
|
|
16396
|
+
return error([new ParsingError$1('', 'zoom expressions not supported')]);
|
|
16439
16397
|
}
|
|
16440
16398
|
const isLightConstant = isGlobalPropertyConstant(parsed, ['measure-light']);
|
|
16441
16399
|
if (!isLightConstant && !supportsLightExpression(propertySpec)) {
|
|
16442
|
-
return error([new ParsingError$
|
|
16400
|
+
return error([new ParsingError$1('', 'measure-light expression not supported')]);
|
|
16443
16401
|
}
|
|
16444
16402
|
const canRelaxZoomRestriction = propertySpec.expression && propertySpec.expression.relaxZoomRestriction;
|
|
16445
16403
|
const zoomCurve = findZoomCurve(parsed);
|
|
16446
16404
|
if (!zoomCurve && !isZoomConstant && !canRelaxZoomRestriction) {
|
|
16447
|
-
return error([new ParsingError$
|
|
16448
|
-
} else if (zoomCurve instanceof ParsingError$
|
|
16405
|
+
return error([new ParsingError$1('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')]);
|
|
16406
|
+
} else if (zoomCurve instanceof ParsingError$1) {
|
|
16449
16407
|
return error([zoomCurve]);
|
|
16450
|
-
} else if (zoomCurve instanceof Interpolate
|
|
16451
|
-
return error([new ParsingError$
|
|
16408
|
+
} else if (zoomCurve instanceof Interpolate && !supportsInterpolation(propertySpec)) {
|
|
16409
|
+
return error([new ParsingError$1('', '"interpolate" expressions cannot be used with this property')]);
|
|
16452
16410
|
}
|
|
16453
16411
|
if (!zoomCurve) {
|
|
16454
16412
|
return success(isFeatureConstant$1 ? new ZoomConstantExpression('constant', expression.value, isLightConstant) : new ZoomConstantExpression('source', expression.value, isLightConstant));
|
|
16455
16413
|
}
|
|
16456
|
-
const interpolationType = zoomCurve instanceof Interpolate
|
|
16414
|
+
const interpolationType = zoomCurve instanceof Interpolate ? zoomCurve.interpolation : undefined;
|
|
16457
16415
|
return success(isFeatureConstant$1 ? new ZoomDependentExpression('camera', expression.value, zoomCurve.labels, interpolationType, isLightConstant) : new ZoomDependentExpression('composite', expression.value, zoomCurve.labels, interpolationType, isLightConstant));
|
|
16458
16416
|
}
|
|
16459
16417
|
// serialization wrapper for old-style stop functions normalized to the
|
|
@@ -16501,27 +16459,27 @@ function normalizePropertyExpression(value, specification, scope, options) {
|
|
|
16501
16459
|
// "coalesce" expressions.
|
|
16502
16460
|
function findZoomCurve(expression) {
|
|
16503
16461
|
let result = null;
|
|
16504
|
-
if (expression instanceof Let
|
|
16462
|
+
if (expression instanceof Let) {
|
|
16505
16463
|
result = findZoomCurve(expression.result);
|
|
16506
|
-
} else if (expression instanceof Coalesce
|
|
16464
|
+
} else if (expression instanceof Coalesce) {
|
|
16507
16465
|
for (const arg of expression.args) {
|
|
16508
16466
|
result = findZoomCurve(arg);
|
|
16509
16467
|
if (result) {
|
|
16510
16468
|
break;
|
|
16511
16469
|
}
|
|
16512
16470
|
}
|
|
16513
|
-
} else if ((expression instanceof Step
|
|
16471
|
+
} else if ((expression instanceof Step || expression instanceof Interpolate) && expression.input instanceof CompoundExpression && expression.input.name === 'zoom') {
|
|
16514
16472
|
result = expression;
|
|
16515
16473
|
}
|
|
16516
|
-
if (result instanceof ParsingError$
|
|
16474
|
+
if (result instanceof ParsingError$1) {
|
|
16517
16475
|
return result;
|
|
16518
16476
|
}
|
|
16519
16477
|
expression.eachChild(child => {
|
|
16520
16478
|
const childResult = findZoomCurve(child);
|
|
16521
|
-
if (childResult instanceof ParsingError$
|
|
16479
|
+
if (childResult instanceof ParsingError$1) {
|
|
16522
16480
|
result = childResult;
|
|
16523
16481
|
} else if (result && childResult && result !== childResult) {
|
|
16524
|
-
result = new ParsingError$
|
|
16482
|
+
result = new ParsingError$1('', 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.');
|
|
16525
16483
|
}
|
|
16526
16484
|
});
|
|
16527
16485
|
return result;
|
|
@@ -18670,7 +18628,7 @@ function disallowedFilterParameters(e, options) {
|
|
|
18670
18628
|
return [];
|
|
18671
18629
|
}
|
|
18672
18630
|
const errors = [];
|
|
18673
|
-
if (e instanceof CompoundExpression
|
|
18631
|
+
if (e instanceof CompoundExpression) {
|
|
18674
18632
|
if (disallowedParameters.has(e.name)) {
|
|
18675
18633
|
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 }`)];
|
|
18676
18634
|
}
|