@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.cjs
CHANGED
|
@@ -963,11 +963,21 @@
|
|
|
963
963
|
generateId: {
|
|
964
964
|
type: "boolean",
|
|
965
965
|
"default": false,
|
|
966
|
-
doc: "Whether to generate ids for the
|
|
966
|
+
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."
|
|
967
967
|
},
|
|
968
968
|
promoteId: {
|
|
969
969
|
type: "promoteId",
|
|
970
970
|
doc: "A property to use as a feature id (for feature state). Either a property name, or an object of the form `{<sourceLayer>: <propertyName>}`."
|
|
971
|
+
},
|
|
972
|
+
dynamic: {
|
|
973
|
+
type: "boolean",
|
|
974
|
+
"default": false,
|
|
975
|
+
doc: "Whether to optimize this source for frequent data updates (e.g. animating features).",
|
|
976
|
+
"sdk-support": {
|
|
977
|
+
"basic functionality": {
|
|
978
|
+
js: "3.4.0"
|
|
979
|
+
}
|
|
980
|
+
}
|
|
971
981
|
}
|
|
972
982
|
};
|
|
973
983
|
var source_video = {
|
|
@@ -7904,6 +7914,43 @@
|
|
|
7904
7914
|
}
|
|
7905
7915
|
},
|
|
7906
7916
|
"property-type": "data-constant"
|
|
7917
|
+
},
|
|
7918
|
+
"model-front-cutoff": {
|
|
7919
|
+
type: "array",
|
|
7920
|
+
"private": true,
|
|
7921
|
+
value: "number",
|
|
7922
|
+
"property-type": "data-constant",
|
|
7923
|
+
transition: false,
|
|
7924
|
+
expression: {
|
|
7925
|
+
interpolated: true,
|
|
7926
|
+
parameters: [
|
|
7927
|
+
"zoom"
|
|
7928
|
+
]
|
|
7929
|
+
},
|
|
7930
|
+
length: 3,
|
|
7931
|
+
"default": [
|
|
7932
|
+
0,
|
|
7933
|
+
0,
|
|
7934
|
+
1
|
|
7935
|
+
],
|
|
7936
|
+
minimum: [
|
|
7937
|
+
0,
|
|
7938
|
+
0,
|
|
7939
|
+
0
|
|
7940
|
+
],
|
|
7941
|
+
maximum: [
|
|
7942
|
+
1,
|
|
7943
|
+
1,
|
|
7944
|
+
1
|
|
7945
|
+
],
|
|
7946
|
+
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.",
|
|
7947
|
+
"sdk-support": {
|
|
7948
|
+
"basic functionality": {
|
|
7949
|
+
js: "3.5.0",
|
|
7950
|
+
android: "11.5.0",
|
|
7951
|
+
ios: "11.5.0"
|
|
7952
|
+
}
|
|
7953
|
+
}
|
|
7907
7954
|
}
|
|
7908
7955
|
};
|
|
7909
7956
|
var transition = {
|
|
@@ -9299,7 +9346,6 @@
|
|
|
9299
9346
|
this.key = key;
|
|
9300
9347
|
}
|
|
9301
9348
|
};
|
|
9302
|
-
var ParsingError$2 = ParsingError$1;
|
|
9303
9349
|
|
|
9304
9350
|
//
|
|
9305
9351
|
/**
|
|
@@ -9332,7 +9378,6 @@
|
|
|
9332
9378
|
return this.parent ? this.parent.has(name) : false;
|
|
9333
9379
|
}
|
|
9334
9380
|
}
|
|
9335
|
-
var Scope$1 = Scope;
|
|
9336
9381
|
|
|
9337
9382
|
//
|
|
9338
9383
|
const NullType = { kind: 'null' };
|
|
@@ -10933,7 +10978,6 @@
|
|
|
10933
10978
|
}
|
|
10934
10979
|
}
|
|
10935
10980
|
}
|
|
10936
|
-
var Literal$1 = Literal;
|
|
10937
10981
|
|
|
10938
10982
|
//
|
|
10939
10983
|
class RuntimeError {
|
|
@@ -10945,7 +10989,6 @@
|
|
|
10945
10989
|
return this.message;
|
|
10946
10990
|
}
|
|
10947
10991
|
}
|
|
10948
|
-
var RuntimeError$1 = RuntimeError;
|
|
10949
10992
|
|
|
10950
10993
|
const types$1 = {
|
|
10951
10994
|
string: StringType,
|
|
@@ -11003,7 +11046,7 @@
|
|
|
11003
11046
|
if (!error) {
|
|
11004
11047
|
return value;
|
|
11005
11048
|
} else if (i === this.args.length - 1) {
|
|
11006
|
-
throw new RuntimeError
|
|
11049
|
+
throw new RuntimeError(`Expected value to be of type ${ toString$1(this.type) }, but found ${ toString$1(typeOf(value)) } instead.`);
|
|
11007
11050
|
}
|
|
11008
11051
|
}
|
|
11009
11052
|
return null;
|
|
@@ -11030,7 +11073,6 @@
|
|
|
11030
11073
|
return serialized.concat(this.args.map(arg => arg.serialize()));
|
|
11031
11074
|
}
|
|
11032
11075
|
}
|
|
11033
|
-
var Assertion$1 = Assertion;
|
|
11034
11076
|
|
|
11035
11077
|
//
|
|
11036
11078
|
class FormatExpression {
|
|
@@ -11317,7 +11359,7 @@
|
|
|
11317
11359
|
}
|
|
11318
11360
|
}
|
|
11319
11361
|
}
|
|
11320
|
-
throw new RuntimeError
|
|
11362
|
+
throw new RuntimeError(error || `Could not parse color from value '${ typeof input === 'string' ? input : String(JSON.stringify(input)) }'`);
|
|
11321
11363
|
} else if (this.type.kind === 'number') {
|
|
11322
11364
|
let value = null;
|
|
11323
11365
|
for (const arg of this.args) {
|
|
@@ -11329,7 +11371,7 @@
|
|
|
11329
11371
|
continue;
|
|
11330
11372
|
return num;
|
|
11331
11373
|
}
|
|
11332
|
-
throw new RuntimeError
|
|
11374
|
+
throw new RuntimeError(`Could not convert ${ JSON.stringify(value) } to number.`);
|
|
11333
11375
|
} else if (this.type.kind === 'formatted') {
|
|
11334
11376
|
// There is no explicit 'to-formatted' but this coercion can be implicitly
|
|
11335
11377
|
// created by properties that expect the 'formatted' type.
|
|
@@ -11369,7 +11411,6 @@
|
|
|
11369
11411
|
return serialized;
|
|
11370
11412
|
}
|
|
11371
11413
|
}
|
|
11372
|
-
var Coercion$1 = Coercion;
|
|
11373
11414
|
|
|
11374
11415
|
//
|
|
11375
11416
|
const geometryTypes = [
|
|
@@ -11438,7 +11479,6 @@
|
|
|
11438
11479
|
return this.options ? this.options.get(id) : null;
|
|
11439
11480
|
}
|
|
11440
11481
|
}
|
|
11441
|
-
var EvaluationContext$1 = EvaluationContext;
|
|
11442
11482
|
|
|
11443
11483
|
//
|
|
11444
11484
|
class CompoundExpression {
|
|
@@ -11489,7 +11529,7 @@
|
|
|
11489
11529
|
overloadIndex++;
|
|
11490
11530
|
// Use a fresh context for each attempted signature so that, if
|
|
11491
11531
|
// we eventually succeed, we haven't polluted `context.errors`.
|
|
11492
|
-
signatureContext = new ParsingContext
|
|
11532
|
+
signatureContext = new ParsingContext(context.registry, context.path, null, context.scope, undefined, context._scope, context.options);
|
|
11493
11533
|
// First parse all the args, potentially coercing to the
|
|
11494
11534
|
// types expected by this overload.
|
|
11495
11535
|
const parsedArgs = [];
|
|
@@ -11557,7 +11597,6 @@
|
|
|
11557
11597
|
return `(${ toString$1(signature.type) }...)`;
|
|
11558
11598
|
}
|
|
11559
11599
|
}
|
|
11560
|
-
var CompoundExpression$1 = CompoundExpression;
|
|
11561
11600
|
|
|
11562
11601
|
//
|
|
11563
11602
|
class CollatorExpression {
|
|
@@ -11618,57 +11657,6 @@
|
|
|
11618
11657
|
}
|
|
11619
11658
|
}
|
|
11620
11659
|
|
|
11621
|
-
function quickselect(arr, k, left, right, compare) {
|
|
11622
|
-
quickselectStep(arr, k, left || 0, right || arr.length - 1, compare || defaultCompare$1);
|
|
11623
|
-
}
|
|
11624
|
-
function quickselectStep(arr, k, left, right, compare) {
|
|
11625
|
-
while (right > left) {
|
|
11626
|
-
if (right - left > 600) {
|
|
11627
|
-
var n = right - left + 1;
|
|
11628
|
-
var m = k - left + 1;
|
|
11629
|
-
var z = Math.log(n);
|
|
11630
|
-
var s = 0.5 * Math.exp(2 * z / 3);
|
|
11631
|
-
var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
|
|
11632
|
-
var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
|
|
11633
|
-
var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
|
|
11634
|
-
quickselectStep(arr, k, newLeft, newRight, compare);
|
|
11635
|
-
}
|
|
11636
|
-
var t = arr[k];
|
|
11637
|
-
var i = left;
|
|
11638
|
-
var j = right;
|
|
11639
|
-
swap(arr, left, k);
|
|
11640
|
-
if (compare(arr[right], t) > 0)
|
|
11641
|
-
swap(arr, left, right);
|
|
11642
|
-
while (i < j) {
|
|
11643
|
-
swap(arr, i, j);
|
|
11644
|
-
i++;
|
|
11645
|
-
j--;
|
|
11646
|
-
while (compare(arr[i], t) < 0)
|
|
11647
|
-
i++;
|
|
11648
|
-
while (compare(arr[j], t) > 0)
|
|
11649
|
-
j--;
|
|
11650
|
-
}
|
|
11651
|
-
if (compare(arr[left], t) === 0)
|
|
11652
|
-
swap(arr, left, j);
|
|
11653
|
-
else {
|
|
11654
|
-
j++;
|
|
11655
|
-
swap(arr, j, right);
|
|
11656
|
-
}
|
|
11657
|
-
if (j <= k)
|
|
11658
|
-
left = j + 1;
|
|
11659
|
-
if (k <= j)
|
|
11660
|
-
right = j - 1;
|
|
11661
|
-
}
|
|
11662
|
-
}
|
|
11663
|
-
function swap(arr, i, j) {
|
|
11664
|
-
var tmp = arr[i];
|
|
11665
|
-
arr[i] = arr[j];
|
|
11666
|
-
arr[j] = tmp;
|
|
11667
|
-
}
|
|
11668
|
-
function defaultCompare$1(a, b) {
|
|
11669
|
-
return a < b ? -1 : a > b ? 1 : 0;
|
|
11670
|
-
}
|
|
11671
|
-
|
|
11672
11660
|
//
|
|
11673
11661
|
// minX, minY, maxX, maxY
|
|
11674
11662
|
/**
|
|
@@ -11685,9 +11673,6 @@
|
|
|
11685
11673
|
}
|
|
11686
11674
|
return sum;
|
|
11687
11675
|
}
|
|
11688
|
-
function compareAreas(a, b) {
|
|
11689
|
-
return b.area - a.area;
|
|
11690
|
-
}
|
|
11691
11676
|
// classifies an array of rings into polygons with outer rings and holes
|
|
11692
11677
|
function classifyRings(rings, maxRings) {
|
|
11693
11678
|
const len = rings.length;
|
|
@@ -11712,16 +11697,6 @@
|
|
|
11712
11697
|
}
|
|
11713
11698
|
if (polygon)
|
|
11714
11699
|
polygons.push(polygon);
|
|
11715
|
-
// Earcut performance degrades with the # of rings in a polygon. For this
|
|
11716
|
-
// reason, we limit strip out all but the `maxRings` largest rings.
|
|
11717
|
-
if (maxRings > 1) {
|
|
11718
|
-
for (let j = 0; j < polygons.length; j++) {
|
|
11719
|
-
if (polygons[j].length <= maxRings)
|
|
11720
|
-
continue;
|
|
11721
|
-
quickselect(polygons[j], maxRings, 1, polygons[j].length - 1, compareAreas);
|
|
11722
|
-
polygons[j] = polygons[j].slice(0, maxRings);
|
|
11723
|
-
}
|
|
11724
|
-
}
|
|
11725
11700
|
return polygons;
|
|
11726
11701
|
}
|
|
11727
11702
|
function updateBBox(bbox, coord) {
|
|
@@ -12084,7 +12059,6 @@
|
|
|
12084
12059
|
];
|
|
12085
12060
|
}
|
|
12086
12061
|
}
|
|
12087
|
-
var Within$1 = Within;
|
|
12088
12062
|
|
|
12089
12063
|
/* */
|
|
12090
12064
|
const factors = {
|
|
@@ -13414,7 +13388,7 @@
|
|
|
13414
13388
|
}
|
|
13415
13389
|
function polygonsToGeometryDistance(originGeometry, canonical, geometry) {
|
|
13416
13390
|
const lngLatPolygons = [];
|
|
13417
|
-
for (const polygon of classifyRings(originGeometry
|
|
13391
|
+
for (const polygon of classifyRings(originGeometry)) {
|
|
13418
13392
|
const lngLatPolygon = [];
|
|
13419
13393
|
for (let i = 0; i < polygon.length; ++i) {
|
|
13420
13394
|
lngLatPolygon.push(getLngLatPoints(polygon[i], canonical));
|
|
@@ -13503,7 +13477,6 @@
|
|
|
13503
13477
|
];
|
|
13504
13478
|
}
|
|
13505
13479
|
}
|
|
13506
|
-
var Distance$1 = Distance;
|
|
13507
13480
|
|
|
13508
13481
|
//
|
|
13509
13482
|
function coerceValue(type, value) {
|
|
@@ -13552,12 +13525,12 @@
|
|
|
13552
13525
|
return context.error(`Invalid number of arguments for 'config' expression.`);
|
|
13553
13526
|
}
|
|
13554
13527
|
const configKey = context.parse(args[1], 1);
|
|
13555
|
-
if (!(configKey instanceof Literal
|
|
13528
|
+
if (!(configKey instanceof Literal)) {
|
|
13556
13529
|
return context.error(`Key name of 'config' expression must be a string literal.`);
|
|
13557
13530
|
}
|
|
13558
13531
|
if (args.length >= 3) {
|
|
13559
13532
|
const configScope = context.parse(args[2], 2);
|
|
13560
|
-
if (!(configScope instanceof Literal
|
|
13533
|
+
if (!(configScope instanceof Literal)) {
|
|
13561
13534
|
return context.error(`Scope of 'config' expression must be a string literal.`);
|
|
13562
13535
|
}
|
|
13563
13536
|
return new Config(type, toString(configKey.value), toString(configScope.value));
|
|
@@ -13622,11 +13595,10 @@
|
|
|
13622
13595
|
return res;
|
|
13623
13596
|
}
|
|
13624
13597
|
}
|
|
13625
|
-
var Config$1 = Config;
|
|
13626
13598
|
|
|
13627
13599
|
//
|
|
13628
13600
|
function isFeatureConstant(e) {
|
|
13629
|
-
if (e instanceof CompoundExpression
|
|
13601
|
+
if (e instanceof CompoundExpression) {
|
|
13630
13602
|
if (e.name === 'get' && e.args.length === 1) {
|
|
13631
13603
|
return false;
|
|
13632
13604
|
} else if (e.name === 'feature-state') {
|
|
@@ -13639,10 +13611,10 @@
|
|
|
13639
13611
|
return false;
|
|
13640
13612
|
}
|
|
13641
13613
|
}
|
|
13642
|
-
if (e instanceof Within
|
|
13614
|
+
if (e instanceof Within) {
|
|
13643
13615
|
return false;
|
|
13644
13616
|
}
|
|
13645
|
-
if (e instanceof Distance
|
|
13617
|
+
if (e instanceof Distance) {
|
|
13646
13618
|
return false;
|
|
13647
13619
|
}
|
|
13648
13620
|
let result = true;
|
|
@@ -13654,7 +13626,7 @@
|
|
|
13654
13626
|
return result;
|
|
13655
13627
|
}
|
|
13656
13628
|
function isStateConstant(e) {
|
|
13657
|
-
if (e instanceof CompoundExpression
|
|
13629
|
+
if (e instanceof CompoundExpression) {
|
|
13658
13630
|
if (e.name === 'feature-state') {
|
|
13659
13631
|
return false;
|
|
13660
13632
|
}
|
|
@@ -13668,7 +13640,7 @@
|
|
|
13668
13640
|
return result;
|
|
13669
13641
|
}
|
|
13670
13642
|
function isConfigConstant(e) {
|
|
13671
|
-
if (e instanceof Config
|
|
13643
|
+
if (e instanceof Config) {
|
|
13672
13644
|
return false;
|
|
13673
13645
|
}
|
|
13674
13646
|
let result = true;
|
|
@@ -13680,7 +13652,7 @@
|
|
|
13680
13652
|
return result;
|
|
13681
13653
|
}
|
|
13682
13654
|
function isGlobalPropertyConstant(e, properties) {
|
|
13683
|
-
if (e instanceof CompoundExpression
|
|
13655
|
+
if (e instanceof CompoundExpression && properties.indexOf(e.name) >= 0) {
|
|
13684
13656
|
return false;
|
|
13685
13657
|
}
|
|
13686
13658
|
let result = true;
|
|
@@ -13723,7 +13695,6 @@
|
|
|
13723
13695
|
];
|
|
13724
13696
|
}
|
|
13725
13697
|
}
|
|
13726
|
-
var Var$1 = Var;
|
|
13727
13698
|
|
|
13728
13699
|
//
|
|
13729
13700
|
/**
|
|
@@ -13735,7 +13706,7 @@
|
|
|
13735
13706
|
// implementations to infer argument types: Expression#parse() need not
|
|
13736
13707
|
// check that the output type of the parsed expression matches
|
|
13737
13708
|
// `expectedType`.
|
|
13738
|
-
constructor(registry, path = [], expectedType, scope = new Scope
|
|
13709
|
+
constructor(registry, path = [], expectedType, scope = new Scope(), errors = [], _scope, options) {
|
|
13739
13710
|
this.registry = registry;
|
|
13740
13711
|
this.path = path;
|
|
13741
13712
|
this.key = path.map(part => `[${ part }]`).join('');
|
|
@@ -13767,9 +13738,9 @@
|
|
|
13767
13738
|
}
|
|
13768
13739
|
function annotate(parsed, type, typeAnnotation) {
|
|
13769
13740
|
if (typeAnnotation === 'assert') {
|
|
13770
|
-
return new Assertion
|
|
13741
|
+
return new Assertion(type, [parsed]);
|
|
13771
13742
|
} else if (typeAnnotation === 'coerce') {
|
|
13772
|
-
return new Coercion
|
|
13743
|
+
return new Coercion(type, [parsed]);
|
|
13773
13744
|
} else {
|
|
13774
13745
|
return parsed;
|
|
13775
13746
|
}
|
|
@@ -13806,10 +13777,10 @@
|
|
|
13806
13777
|
// it immediately and replace it with a literal value in the
|
|
13807
13778
|
// parsed/compiled result. Expressions that expect an image should
|
|
13808
13779
|
// not be resolved here so we can later get the available images.
|
|
13809
|
-
if (!(parsed instanceof Literal
|
|
13810
|
-
const ec = new EvaluationContext
|
|
13780
|
+
if (!(parsed instanceof Literal) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
|
|
13781
|
+
const ec = new EvaluationContext(this._scope, this.options);
|
|
13811
13782
|
try {
|
|
13812
|
-
parsed = new Literal
|
|
13783
|
+
parsed = new Literal(parsed.type, parsed.evaluate(ec));
|
|
13813
13784
|
} catch (e) {
|
|
13814
13785
|
this.error(e.message);
|
|
13815
13786
|
return null;
|
|
@@ -13818,7 +13789,7 @@
|
|
|
13818
13789
|
return parsed;
|
|
13819
13790
|
}
|
|
13820
13791
|
// Try to parse as array
|
|
13821
|
-
return Coercion
|
|
13792
|
+
return Coercion.parse([
|
|
13822
13793
|
'to-array',
|
|
13823
13794
|
expr
|
|
13824
13795
|
], this);
|
|
@@ -13852,7 +13823,7 @@
|
|
|
13852
13823
|
*/
|
|
13853
13824
|
error(error, ...keys) {
|
|
13854
13825
|
const key = `${ this.key }${ keys.map(k => `[${ k }]`).join('') }`;
|
|
13855
|
-
this.errors.push(new ParsingError$
|
|
13826
|
+
this.errors.push(new ParsingError$1(key, error));
|
|
13856
13827
|
}
|
|
13857
13828
|
/**
|
|
13858
13829
|
* Returns null if `t` is a subtype of `expected`; otherwise returns an
|
|
@@ -13865,25 +13836,24 @@
|
|
|
13865
13836
|
return error;
|
|
13866
13837
|
}
|
|
13867
13838
|
}
|
|
13868
|
-
var ParsingContext$1 = ParsingContext;
|
|
13869
13839
|
function isConstant(expression) {
|
|
13870
|
-
if (expression instanceof Var
|
|
13840
|
+
if (expression instanceof Var) {
|
|
13871
13841
|
return isConstant(expression.boundExpression);
|
|
13872
|
-
} else if (expression instanceof CompoundExpression
|
|
13842
|
+
} else if (expression instanceof CompoundExpression && expression.name === 'error') {
|
|
13873
13843
|
return false;
|
|
13874
13844
|
} else if (expression instanceof CollatorExpression) {
|
|
13875
13845
|
// Although the results of a Collator expression with fixed arguments
|
|
13876
13846
|
// generally shouldn't change between executions, we can't serialize them
|
|
13877
13847
|
// as constant expressions because results change based on environment.
|
|
13878
13848
|
return false;
|
|
13879
|
-
} else if (expression instanceof Within
|
|
13849
|
+
} else if (expression instanceof Within) {
|
|
13880
13850
|
return false;
|
|
13881
|
-
} else if (expression instanceof Distance
|
|
13851
|
+
} else if (expression instanceof Distance) {
|
|
13882
13852
|
return false;
|
|
13883
|
-
} else if (expression instanceof Config
|
|
13853
|
+
} else if (expression instanceof Config) {
|
|
13884
13854
|
return false;
|
|
13885
13855
|
}
|
|
13886
|
-
const isTypeAnnotation = expression instanceof Coercion
|
|
13856
|
+
const isTypeAnnotation = expression instanceof Coercion || expression instanceof Assertion;
|
|
13887
13857
|
let childrenConstant = true;
|
|
13888
13858
|
expression.eachChild(child => {
|
|
13889
13859
|
// We can _almost_ assume that if `expressions` children are constant,
|
|
@@ -13895,7 +13865,7 @@
|
|
|
13895
13865
|
if (isTypeAnnotation) {
|
|
13896
13866
|
childrenConstant = childrenConstant && isConstant(child);
|
|
13897
13867
|
} else {
|
|
13898
|
-
childrenConstant = childrenConstant && child instanceof Literal
|
|
13868
|
+
childrenConstant = childrenConstant && child instanceof Literal;
|
|
13899
13869
|
}
|
|
13900
13870
|
});
|
|
13901
13871
|
if (!childrenConstant) {
|
|
@@ -13940,7 +13910,7 @@
|
|
|
13940
13910
|
} else if (currentValue > input) {
|
|
13941
13911
|
upperIndex = currentIndex - 1;
|
|
13942
13912
|
} else {
|
|
13943
|
-
throw new RuntimeError
|
|
13913
|
+
throw new RuntimeError('Input is not a number.');
|
|
13944
13914
|
}
|
|
13945
13915
|
}
|
|
13946
13916
|
return 0;
|
|
@@ -14035,7 +14005,6 @@
|
|
|
14035
14005
|
return serialized;
|
|
14036
14006
|
}
|
|
14037
14007
|
}
|
|
14038
|
-
var Step$1 = Step;
|
|
14039
14008
|
|
|
14040
14009
|
var unitbezier = UnitBezier;
|
|
14041
14010
|
function UnitBezier(p1x, p1y, p2x, p2y) {
|
|
@@ -14423,7 +14392,6 @@
|
|
|
14423
14392
|
return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);
|
|
14424
14393
|
}
|
|
14425
14394
|
}
|
|
14426
|
-
var Interpolate$1 = Interpolate;
|
|
14427
14395
|
|
|
14428
14396
|
class Coalesce {
|
|
14429
14397
|
constructor(type, args) {
|
|
@@ -14494,7 +14462,6 @@
|
|
|
14494
14462
|
return serialized;
|
|
14495
14463
|
}
|
|
14496
14464
|
}
|
|
14497
|
-
var Coalesce$1 = Coalesce;
|
|
14498
14465
|
|
|
14499
14466
|
//
|
|
14500
14467
|
class Let {
|
|
@@ -14549,7 +14516,6 @@
|
|
|
14549
14516
|
return serialized;
|
|
14550
14517
|
}
|
|
14551
14518
|
}
|
|
14552
|
-
var Let$1 = Let;
|
|
14553
14519
|
|
|
14554
14520
|
//
|
|
14555
14521
|
class At {
|
|
@@ -14572,13 +14538,13 @@
|
|
|
14572
14538
|
const index = this.index.evaluate(ctx);
|
|
14573
14539
|
const array = this.input.evaluate(ctx);
|
|
14574
14540
|
if (index < 0) {
|
|
14575
|
-
throw new RuntimeError
|
|
14541
|
+
throw new RuntimeError(`Array index out of bounds: ${ index } < 0.`);
|
|
14576
14542
|
}
|
|
14577
14543
|
if (index >= array.length) {
|
|
14578
|
-
throw new RuntimeError
|
|
14544
|
+
throw new RuntimeError(`Array index out of bounds: ${ index } > ${ array.length - 1 }.`);
|
|
14579
14545
|
}
|
|
14580
14546
|
if (index !== Math.floor(index)) {
|
|
14581
|
-
throw new RuntimeError
|
|
14547
|
+
throw new RuntimeError(`Array index must be an integer, but found ${ index } instead.`);
|
|
14582
14548
|
}
|
|
14583
14549
|
return array[index];
|
|
14584
14550
|
}
|
|
@@ -14597,7 +14563,6 @@
|
|
|
14597
14563
|
];
|
|
14598
14564
|
}
|
|
14599
14565
|
}
|
|
14600
|
-
var At$1 = At;
|
|
14601
14566
|
|
|
14602
14567
|
//
|
|
14603
14568
|
class In {
|
|
@@ -14636,13 +14601,13 @@
|
|
|
14636
14601
|
'number',
|
|
14637
14602
|
'null'
|
|
14638
14603
|
])) {
|
|
14639
|
-
throw new RuntimeError
|
|
14604
|
+
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
14640
14605
|
}
|
|
14641
14606
|
if (!isValidNativeType(haystack, [
|
|
14642
14607
|
'string',
|
|
14643
14608
|
'array'
|
|
14644
14609
|
])) {
|
|
14645
|
-
throw new RuntimeError
|
|
14610
|
+
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
14646
14611
|
}
|
|
14647
14612
|
return haystack.indexOf(needle) >= 0;
|
|
14648
14613
|
}
|
|
@@ -14661,7 +14626,6 @@
|
|
|
14661
14626
|
];
|
|
14662
14627
|
}
|
|
14663
14628
|
}
|
|
14664
|
-
var In$1 = In;
|
|
14665
14629
|
|
|
14666
14630
|
//
|
|
14667
14631
|
class IndexOf {
|
|
@@ -14706,13 +14670,13 @@
|
|
|
14706
14670
|
'number',
|
|
14707
14671
|
'null'
|
|
14708
14672
|
])) {
|
|
14709
|
-
throw new RuntimeError
|
|
14673
|
+
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
|
|
14710
14674
|
}
|
|
14711
14675
|
if (!isValidNativeType(haystack, [
|
|
14712
14676
|
'string',
|
|
14713
14677
|
'array'
|
|
14714
14678
|
])) {
|
|
14715
|
-
throw new RuntimeError
|
|
14679
|
+
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
|
|
14716
14680
|
}
|
|
14717
14681
|
if (this.fromIndex) {
|
|
14718
14682
|
const fromIndex = this.fromIndex.evaluate(ctx);
|
|
@@ -14747,7 +14711,6 @@
|
|
|
14747
14711
|
];
|
|
14748
14712
|
}
|
|
14749
14713
|
}
|
|
14750
|
-
var IndexOf$1 = IndexOf;
|
|
14751
14714
|
|
|
14752
14715
|
// Map input label values to output expression index
|
|
14753
14716
|
class Match {
|
|
@@ -14870,7 +14833,6 @@
|
|
|
14870
14833
|
return serialized;
|
|
14871
14834
|
}
|
|
14872
14835
|
}
|
|
14873
|
-
var Match$1 = Match;
|
|
14874
14836
|
|
|
14875
14837
|
class Case {
|
|
14876
14838
|
constructor(type, branches, otherwise) {
|
|
@@ -14932,7 +14894,6 @@
|
|
|
14932
14894
|
return serialized;
|
|
14933
14895
|
}
|
|
14934
14896
|
}
|
|
14935
|
-
var Case$1 = Case;
|
|
14936
14897
|
|
|
14937
14898
|
//
|
|
14938
14899
|
class Slice {
|
|
@@ -14973,7 +14934,7 @@
|
|
|
14973
14934
|
'string',
|
|
14974
14935
|
'array'
|
|
14975
14936
|
])) {
|
|
14976
|
-
throw new RuntimeError
|
|
14937
|
+
throw new RuntimeError(`Expected first argument to be of type array or string, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
14977
14938
|
}
|
|
14978
14939
|
if (this.endIndex) {
|
|
14979
14940
|
const endIndex = this.endIndex.evaluate(ctx);
|
|
@@ -15008,7 +14969,6 @@
|
|
|
15008
14969
|
];
|
|
15009
14970
|
}
|
|
15010
14971
|
}
|
|
15011
|
-
var Slice$1 = Slice;
|
|
15012
14972
|
|
|
15013
14973
|
//
|
|
15014
14974
|
function isComparableType(op, type) {
|
|
@@ -15108,10 +15068,10 @@
|
|
|
15108
15068
|
// typing rules specific to less/greater than operators
|
|
15109
15069
|
if (lhs.type.kind === 'value' && rhs.type.kind !== 'value') {
|
|
15110
15070
|
// (value, T)
|
|
15111
|
-
lhs = new Assertion
|
|
15071
|
+
lhs = new Assertion(rhs.type, [lhs]);
|
|
15112
15072
|
} else if (lhs.type.kind !== 'value' && rhs.type.kind === 'value') {
|
|
15113
15073
|
// (T, value)
|
|
15114
|
-
rhs = new Assertion
|
|
15074
|
+
rhs = new Assertion(lhs.type, [rhs]);
|
|
15115
15075
|
}
|
|
15116
15076
|
}
|
|
15117
15077
|
let collator = null;
|
|
@@ -15133,7 +15093,7 @@
|
|
|
15133
15093
|
const rt = typeOf(rhs);
|
|
15134
15094
|
// check that type is string or number, and equal
|
|
15135
15095
|
if (lt.kind !== rt.kind || !(lt.kind === 'string' || lt.kind === 'number')) {
|
|
15136
|
-
throw new RuntimeError
|
|
15096
|
+
throw new RuntimeError(`Expected arguments for "${ op }" to be (string, string) or (number, number), but found (${ lt.kind }, ${ rt.kind }) instead.`);
|
|
15137
15097
|
}
|
|
15138
15098
|
}
|
|
15139
15099
|
if (this.collator && !isOrderComparison && this.hasUntypedArgument) {
|
|
@@ -15306,7 +15266,7 @@
|
|
|
15306
15266
|
} else if (Array.isArray(input)) {
|
|
15307
15267
|
return input.length;
|
|
15308
15268
|
} else {
|
|
15309
|
-
throw new RuntimeError
|
|
15269
|
+
throw new RuntimeError(`Expected value to be of type string or array, but found ${ toString$1(typeOf(input)) } instead.`);
|
|
15310
15270
|
}
|
|
15311
15271
|
}
|
|
15312
15272
|
eachChild(fn) {
|
|
@@ -15323,7 +15283,6 @@
|
|
|
15323
15283
|
return serialized;
|
|
15324
15284
|
}
|
|
15325
15285
|
}
|
|
15326
|
-
var Length$1 = Length;
|
|
15327
15286
|
|
|
15328
15287
|
//
|
|
15329
15288
|
// Seeded pseudo random generator function
|
|
@@ -15347,14 +15306,14 @@
|
|
|
15347
15306
|
'>=': GreaterThanOrEqual,
|
|
15348
15307
|
'<=': LessThanOrEqual,
|
|
15349
15308
|
// $FlowFixMe[method-unbinding]
|
|
15350
|
-
'array': Assertion
|
|
15309
|
+
'array': Assertion,
|
|
15351
15310
|
// $FlowFixMe[method-unbinding]
|
|
15352
|
-
'at': At
|
|
15353
|
-
'boolean': Assertion
|
|
15311
|
+
'at': At,
|
|
15312
|
+
'boolean': Assertion,
|
|
15354
15313
|
// $FlowFixMe[method-unbinding]
|
|
15355
|
-
'case': Case
|
|
15314
|
+
'case': Case,
|
|
15356
15315
|
// $FlowFixMe[method-unbinding]
|
|
15357
|
-
'coalesce': Coalesce
|
|
15316
|
+
'coalesce': Coalesce,
|
|
15358
15317
|
// $FlowFixMe[method-unbinding]
|
|
15359
15318
|
'collator': CollatorExpression,
|
|
15360
15319
|
// $FlowFixMe[method-unbinding]
|
|
@@ -15362,43 +15321,43 @@
|
|
|
15362
15321
|
// $FlowFixMe[method-unbinding]
|
|
15363
15322
|
'image': ImageExpression,
|
|
15364
15323
|
// $FlowFixMe[method-unbinding]
|
|
15365
|
-
'in': In
|
|
15324
|
+
'in': In,
|
|
15366
15325
|
// $FlowFixMe[method-unbinding]
|
|
15367
|
-
'index-of': IndexOf
|
|
15326
|
+
'index-of': IndexOf,
|
|
15368
15327
|
// $FlowFixMe[method-unbinding]
|
|
15369
|
-
'interpolate': Interpolate
|
|
15370
|
-
'interpolate-hcl': Interpolate
|
|
15371
|
-
'interpolate-lab': Interpolate
|
|
15328
|
+
'interpolate': Interpolate,
|
|
15329
|
+
'interpolate-hcl': Interpolate,
|
|
15330
|
+
'interpolate-lab': Interpolate,
|
|
15372
15331
|
// $FlowFixMe[method-unbinding]
|
|
15373
|
-
'length': Length
|
|
15332
|
+
'length': Length,
|
|
15374
15333
|
// $FlowFixMe[method-unbinding]
|
|
15375
|
-
'let': Let
|
|
15334
|
+
'let': Let,
|
|
15376
15335
|
// $FlowFixMe[method-unbinding]
|
|
15377
|
-
'literal': Literal
|
|
15336
|
+
'literal': Literal,
|
|
15378
15337
|
// $FlowFixMe[method-unbinding]
|
|
15379
|
-
'match': Match
|
|
15380
|
-
'number': Assertion
|
|
15338
|
+
'match': Match,
|
|
15339
|
+
'number': Assertion,
|
|
15381
15340
|
// $FlowFixMe[method-unbinding]
|
|
15382
15341
|
'number-format': NumberFormat,
|
|
15383
|
-
'object': Assertion
|
|
15342
|
+
'object': Assertion,
|
|
15384
15343
|
// $FlowFixMe[method-unbinding]
|
|
15385
|
-
'slice': Slice
|
|
15344
|
+
'slice': Slice,
|
|
15386
15345
|
// $FlowFixMe[method-unbinding]
|
|
15387
|
-
'step': Step
|
|
15388
|
-
'string': Assertion
|
|
15346
|
+
'step': Step,
|
|
15347
|
+
'string': Assertion,
|
|
15389
15348
|
// $FlowFixMe[method-unbinding]
|
|
15390
|
-
'to-boolean': Coercion
|
|
15391
|
-
'to-color': Coercion
|
|
15392
|
-
'to-number': Coercion
|
|
15393
|
-
'to-string': Coercion
|
|
15349
|
+
'to-boolean': Coercion,
|
|
15350
|
+
'to-color': Coercion,
|
|
15351
|
+
'to-number': Coercion,
|
|
15352
|
+
'to-string': Coercion,
|
|
15394
15353
|
// $FlowFixMe[method-unbinding]
|
|
15395
|
-
'var': Var
|
|
15354
|
+
'var': Var,
|
|
15396
15355
|
// $FlowFixMe[method-unbinding]
|
|
15397
|
-
'within': Within
|
|
15356
|
+
'within': Within,
|
|
15398
15357
|
// $FlowFixMe[method-unbinding]
|
|
15399
|
-
'distance': Distance
|
|
15358
|
+
'distance': Distance,
|
|
15400
15359
|
// $FlowFixMe[method-unbinding]
|
|
15401
|
-
'config': Config
|
|
15360
|
+
'config': Config
|
|
15402
15361
|
};
|
|
15403
15362
|
function rgba(ctx, [r, g, b, a]) {
|
|
15404
15363
|
r = r.evaluate(ctx);
|
|
@@ -15407,7 +15366,7 @@
|
|
|
15407
15366
|
const alpha = a ? a.evaluate(ctx) : 1;
|
|
15408
15367
|
const error = validateRGBA(r, g, b, alpha);
|
|
15409
15368
|
if (error)
|
|
15410
|
-
throw new RuntimeError
|
|
15369
|
+
throw new RuntimeError(error);
|
|
15411
15370
|
return new Color$1(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);
|
|
15412
15371
|
}
|
|
15413
15372
|
function hsla(ctx, [h, s, l, a]) {
|
|
@@ -15417,11 +15376,11 @@
|
|
|
15417
15376
|
const alpha = a ? a.evaluate(ctx) : 1;
|
|
15418
15377
|
const error = validateHSLA(h, s, l, alpha);
|
|
15419
15378
|
if (error)
|
|
15420
|
-
throw new RuntimeError
|
|
15379
|
+
throw new RuntimeError(error);
|
|
15421
15380
|
const colorFunction = `hsla(${ h }, ${ s }%, ${ l }%, ${ alpha })`;
|
|
15422
15381
|
const color = Color$1.parse(colorFunction);
|
|
15423
15382
|
if (!color)
|
|
15424
|
-
throw new RuntimeError
|
|
15383
|
+
throw new RuntimeError(`Failed to parse HSLA color: ${ colorFunction }`);
|
|
15425
15384
|
return color;
|
|
15426
15385
|
}
|
|
15427
15386
|
function has(key, obj) {
|
|
@@ -15458,12 +15417,12 @@
|
|
|
15458
15417
|
}
|
|
15459
15418
|
return hash;
|
|
15460
15419
|
}
|
|
15461
|
-
CompoundExpression
|
|
15420
|
+
CompoundExpression.register(expressions, {
|
|
15462
15421
|
'error': [
|
|
15463
15422
|
ErrorType,
|
|
15464
15423
|
[StringType],
|
|
15465
15424
|
(ctx, [v]) => {
|
|
15466
|
-
throw new RuntimeError
|
|
15425
|
+
throw new RuntimeError(v.evaluate(ctx));
|
|
15467
15426
|
}
|
|
15468
15427
|
],
|
|
15469
15428
|
'typeof': [
|
|
@@ -16023,14 +15982,13 @@
|
|
|
16023
15982
|
} else if (typeof seed === 'number') {
|
|
16024
15983
|
seedVal = seed;
|
|
16025
15984
|
} else {
|
|
16026
|
-
throw new RuntimeError
|
|
15985
|
+
throw new RuntimeError(`Invalid seed input: ${ seed }`);
|
|
16027
15986
|
}
|
|
16028
15987
|
const random = mulberry32(seedVal)();
|
|
16029
15988
|
return min + random * (max - min);
|
|
16030
15989
|
}
|
|
16031
15990
|
]
|
|
16032
15991
|
});
|
|
16033
|
-
var definitions = expressions;
|
|
16034
15992
|
|
|
16035
15993
|
//
|
|
16036
15994
|
/**
|
|
@@ -16155,7 +16113,7 @@
|
|
|
16155
16113
|
return {
|
|
16156
16114
|
kind: 'composite',
|
|
16157
16115
|
interpolationType,
|
|
16158
|
-
interpolationFactor: Interpolate
|
|
16116
|
+
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
16159
16117
|
zoomStops: featureFunctionStops.map(s => s[0]),
|
|
16160
16118
|
evaluate({zoom}, properties) {
|
|
16161
16119
|
return evaluateExponentialFunction({
|
|
@@ -16172,7 +16130,7 @@
|
|
|
16172
16130
|
return {
|
|
16173
16131
|
kind: 'camera',
|
|
16174
16132
|
interpolationType,
|
|
16175
|
-
interpolationFactor: Interpolate
|
|
16133
|
+
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
|
|
16176
16134
|
zoomStops: parameters.stops.map(s => s[0]),
|
|
16177
16135
|
evaluate: ({zoom}) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)
|
|
16178
16136
|
};
|
|
@@ -16320,7 +16278,7 @@
|
|
|
16320
16278
|
constructor(expression, propertySpec, scope, options) {
|
|
16321
16279
|
this.expression = expression;
|
|
16322
16280
|
this._warningHistory = {};
|
|
16323
|
-
this._evaluator = new EvaluationContext
|
|
16281
|
+
this._evaluator = new EvaluationContext(scope, options);
|
|
16324
16282
|
this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
|
|
16325
16283
|
this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;
|
|
16326
16284
|
}
|
|
@@ -16351,7 +16309,7 @@
|
|
|
16351
16309
|
return this._defaultValue;
|
|
16352
16310
|
}
|
|
16353
16311
|
if (this._enumValues && !(val in this._enumValues)) {
|
|
16354
|
-
throw new RuntimeError
|
|
16312
|
+
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.`);
|
|
16355
16313
|
}
|
|
16356
16314
|
return val;
|
|
16357
16315
|
} catch (e) {
|
|
@@ -16366,7 +16324,7 @@
|
|
|
16366
16324
|
}
|
|
16367
16325
|
}
|
|
16368
16326
|
function isExpression(expression) {
|
|
16369
|
-
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in
|
|
16327
|
+
return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in expressions;
|
|
16370
16328
|
}
|
|
16371
16329
|
/**
|
|
16372
16330
|
* Parse and typecheck the given style spec JSON expression. If
|
|
@@ -16378,7 +16336,7 @@
|
|
|
16378
16336
|
* @private
|
|
16379
16337
|
*/
|
|
16380
16338
|
function createExpression(expression, propertySpec, scope, options) {
|
|
16381
|
-
const parser = new ParsingContext
|
|
16339
|
+
const parser = new ParsingContext(expressions, [], propertySpec ? getExpectedType(propertySpec) : undefined, undefined, undefined, scope, options);
|
|
16382
16340
|
// For string-valued properties, coerce to string at the top level rather than asserting.
|
|
16383
16341
|
const parsed = parser.parse(expression, undefined, undefined, undefined, propertySpec && propertySpec.type === 'string' ? { typeAnnotation: 'coerce' } : undefined);
|
|
16384
16342
|
if (!parsed) {
|
|
@@ -16419,7 +16377,7 @@
|
|
|
16419
16377
|
}
|
|
16420
16378
|
interpolationFactor(input, lower, upper) {
|
|
16421
16379
|
if (this.interpolationType) {
|
|
16422
|
-
return Interpolate
|
|
16380
|
+
return Interpolate.interpolationFactor(this.interpolationType, input, lower, upper);
|
|
16423
16381
|
} else {
|
|
16424
16382
|
return 0;
|
|
16425
16383
|
}
|
|
@@ -16433,7 +16391,7 @@
|
|
|
16433
16391
|
const parsed = expression.value.expression;
|
|
16434
16392
|
const isFeatureConstant$1 = isFeatureConstant(parsed);
|
|
16435
16393
|
if (!isFeatureConstant$1 && !supportsPropertyExpression(propertySpec)) {
|
|
16436
|
-
return error([new ParsingError$
|
|
16394
|
+
return error([new ParsingError$1('', 'data expressions not supported')]);
|
|
16437
16395
|
}
|
|
16438
16396
|
const isZoomConstant = isGlobalPropertyConstant(parsed, [
|
|
16439
16397
|
'zoom',
|
|
@@ -16441,25 +16399,25 @@
|
|
|
16441
16399
|
'distance-from-center'
|
|
16442
16400
|
]);
|
|
16443
16401
|
if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {
|
|
16444
|
-
return error([new ParsingError$
|
|
16402
|
+
return error([new ParsingError$1('', 'zoom expressions not supported')]);
|
|
16445
16403
|
}
|
|
16446
16404
|
const isLightConstant = isGlobalPropertyConstant(parsed, ['measure-light']);
|
|
16447
16405
|
if (!isLightConstant && !supportsLightExpression(propertySpec)) {
|
|
16448
|
-
return error([new ParsingError$
|
|
16406
|
+
return error([new ParsingError$1('', 'measure-light expression not supported')]);
|
|
16449
16407
|
}
|
|
16450
16408
|
const canRelaxZoomRestriction = propertySpec.expression && propertySpec.expression.relaxZoomRestriction;
|
|
16451
16409
|
const zoomCurve = findZoomCurve(parsed);
|
|
16452
16410
|
if (!zoomCurve && !isZoomConstant && !canRelaxZoomRestriction) {
|
|
16453
|
-
return error([new ParsingError$
|
|
16454
|
-
} else if (zoomCurve instanceof ParsingError$
|
|
16411
|
+
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.')]);
|
|
16412
|
+
} else if (zoomCurve instanceof ParsingError$1) {
|
|
16455
16413
|
return error([zoomCurve]);
|
|
16456
|
-
} else if (zoomCurve instanceof Interpolate
|
|
16457
|
-
return error([new ParsingError$
|
|
16414
|
+
} else if (zoomCurve instanceof Interpolate && !supportsInterpolation(propertySpec)) {
|
|
16415
|
+
return error([new ParsingError$1('', '"interpolate" expressions cannot be used with this property')]);
|
|
16458
16416
|
}
|
|
16459
16417
|
if (!zoomCurve) {
|
|
16460
16418
|
return success(isFeatureConstant$1 ? new ZoomConstantExpression('constant', expression.value, isLightConstant) : new ZoomConstantExpression('source', expression.value, isLightConstant));
|
|
16461
16419
|
}
|
|
16462
|
-
const interpolationType = zoomCurve instanceof Interpolate
|
|
16420
|
+
const interpolationType = zoomCurve instanceof Interpolate ? zoomCurve.interpolation : undefined;
|
|
16463
16421
|
return success(isFeatureConstant$1 ? new ZoomDependentExpression('camera', expression.value, zoomCurve.labels, interpolationType, isLightConstant) : new ZoomDependentExpression('composite', expression.value, zoomCurve.labels, interpolationType, isLightConstant));
|
|
16464
16422
|
}
|
|
16465
16423
|
// serialization wrapper for old-style stop functions normalized to the
|
|
@@ -16507,27 +16465,27 @@
|
|
|
16507
16465
|
// "coalesce" expressions.
|
|
16508
16466
|
function findZoomCurve(expression) {
|
|
16509
16467
|
let result = null;
|
|
16510
|
-
if (expression instanceof Let
|
|
16468
|
+
if (expression instanceof Let) {
|
|
16511
16469
|
result = findZoomCurve(expression.result);
|
|
16512
|
-
} else if (expression instanceof Coalesce
|
|
16470
|
+
} else if (expression instanceof Coalesce) {
|
|
16513
16471
|
for (const arg of expression.args) {
|
|
16514
16472
|
result = findZoomCurve(arg);
|
|
16515
16473
|
if (result) {
|
|
16516
16474
|
break;
|
|
16517
16475
|
}
|
|
16518
16476
|
}
|
|
16519
|
-
} else if ((expression instanceof Step
|
|
16477
|
+
} else if ((expression instanceof Step || expression instanceof Interpolate) && expression.input instanceof CompoundExpression && expression.input.name === 'zoom') {
|
|
16520
16478
|
result = expression;
|
|
16521
16479
|
}
|
|
16522
|
-
if (result instanceof ParsingError$
|
|
16480
|
+
if (result instanceof ParsingError$1) {
|
|
16523
16481
|
return result;
|
|
16524
16482
|
}
|
|
16525
16483
|
expression.eachChild(child => {
|
|
16526
16484
|
const childResult = findZoomCurve(child);
|
|
16527
|
-
if (childResult instanceof ParsingError$
|
|
16485
|
+
if (childResult instanceof ParsingError$1) {
|
|
16528
16486
|
result = childResult;
|
|
16529
16487
|
} else if (result && childResult && result !== childResult) {
|
|
16530
|
-
result = new ParsingError$
|
|
16488
|
+
result = new ParsingError$1('', 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.');
|
|
16531
16489
|
}
|
|
16532
16490
|
});
|
|
16533
16491
|
return result;
|
|
@@ -18676,7 +18634,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
18676
18634
|
return [];
|
|
18677
18635
|
}
|
|
18678
18636
|
const errors = [];
|
|
18679
|
-
if (e instanceof CompoundExpression
|
|
18637
|
+
if (e instanceof CompoundExpression) {
|
|
18680
18638
|
if (disallowedParameters.has(e.name)) {
|
|
18681
18639
|
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 }`)];
|
|
18682
18640
|
}
|