@mapbox/mapbox-gl-style-spec 14.2.0 → 14.3.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/diff.js +4 -27
- package/dist/index.cjs +354 -136
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +354 -136
- package/dist/index.es.js.map +1 -1
- package/expression/definitions/config.js +142 -0
- package/expression/definitions/index.js +9 -77
- package/expression/index.js +1 -0
- package/expression/is_constant.js +4 -4
- package/expression/parsing_context.js +5 -4
- package/flow-typed/webgl2.js +2 -0
- package/package.json +1 -1
- package/reference/v8.json +199 -8
- package/style-spec.js +1 -1
- package/types.js +28 -2
- package/validate/validate_layer.js +4 -0
- package/validate/validate_source.js +2 -1
- package/validate_mapbox_api_supported.js +2 -2
package/dist/index.es.js
CHANGED
|
@@ -865,6 +865,17 @@ var source_raster_array = {
|
|
|
865
865
|
type: "*",
|
|
866
866
|
doc: "Contains the description of the raster data layers and the bands contained within the tiles."
|
|
867
867
|
},
|
|
868
|
+
volatile: {
|
|
869
|
+
type: "boolean",
|
|
870
|
+
"default": false,
|
|
871
|
+
doc: "A setting to determine whether a source's tiles are cached locally.",
|
|
872
|
+
"sdk-support": {
|
|
873
|
+
"basic functionality": {
|
|
874
|
+
android: "9.3.0",
|
|
875
|
+
ios: "5.10.0"
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
},
|
|
868
879
|
"*": {
|
|
869
880
|
type: "*",
|
|
870
881
|
doc: "Other keys to configure the data source."
|
|
@@ -1116,6 +1127,17 @@ var layer = {
|
|
|
1116
1127
|
}
|
|
1117
1128
|
}
|
|
1118
1129
|
},
|
|
1130
|
+
"raster-particle": {
|
|
1131
|
+
doc: "Particle animation driven by textures such as wind maps.",
|
|
1132
|
+
"sdk-support": {
|
|
1133
|
+
"basic functionality": {
|
|
1134
|
+
js: "0.10.0",
|
|
1135
|
+
android: "2.0.1",
|
|
1136
|
+
ios: "2.0.0",
|
|
1137
|
+
macos: "0.1.0"
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
},
|
|
1119
1141
|
hillshade: {
|
|
1120
1142
|
doc: "Client-side hillshading visualization based on DEM data. Currently, the implementation only supports Mapbox Terrain RGB and Mapzen Terrarium tiles.",
|
|
1121
1143
|
"sdk-support": {
|
|
@@ -1226,6 +1248,7 @@ var layout = [
|
|
|
1226
1248
|
"layout_fill-extrusion",
|
|
1227
1249
|
"layout_symbol",
|
|
1228
1250
|
"layout_raster",
|
|
1251
|
+
"layout_raster-particle",
|
|
1229
1252
|
"layout_hillshade",
|
|
1230
1253
|
"layout_background",
|
|
1231
1254
|
"layout_sky",
|
|
@@ -3582,7 +3605,7 @@ var expression_name = {
|
|
|
3582
3605
|
}
|
|
3583
3606
|
},
|
|
3584
3607
|
image: {
|
|
3585
|
-
doc: "Returns a [`ResolvedImage`](/mapbox-gl-js/style-spec/types/#resolvedimage) for use in [`icon-image`](/mapbox-gl-js/style-spec/layers/#layout-symbol-icon-image), `*-pattern` entries, and as a section in the [`'format'`](#types-format) expression. A [`'coalesce'`](#coalesce) expression containing `image` expressions will evaluate to the first listed image that is currently in the style. This validation process is synchronous and requires the image to have been added to the style before requesting it in the `'image'` argument.",
|
|
3608
|
+
doc: "Returns a [`ResolvedImage`](/mapbox-gl-js/style-spec/types/#resolvedimage) for use in [`icon-image`](/mapbox-gl-js/style-spec/layers/#layout-symbol-icon-image), `*-pattern` entries, and as a section in the [`'format'`](#types-format) expression. A [`'coalesce'`](#coalesce) expression containing `image` expressions will evaluate to the first listed image that is currently in the style. This validation process is synchronous and requires the image to have been added to the style before requesting it in the `'image'` argument. To implement crossfading between two images within a symbol layer using the [`icon-image-cross-fade`](/mapbox-gl-js/style-spec/layers/#paint-symbol-icon-image-cross-fade) attribute, include a second image as the second argument in the `'image'` expression.",
|
|
3586
3609
|
group: "Types",
|
|
3587
3610
|
"sdk-support": {
|
|
3588
3611
|
"basic functionality": {
|
|
@@ -4326,6 +4349,17 @@ var expression_name = {
|
|
|
4326
4349
|
}
|
|
4327
4350
|
}
|
|
4328
4351
|
},
|
|
4352
|
+
"raster-particle-speed": {
|
|
4353
|
+
doc: "Returns the length of the particle velocity vector. Can only be used in the `raster-particle-color` property.",
|
|
4354
|
+
group: "Raster Particle Animation",
|
|
4355
|
+
"sdk-support": {
|
|
4356
|
+
"basic functionality": {
|
|
4357
|
+
js: "3.3.0",
|
|
4358
|
+
android: "",
|
|
4359
|
+
ios: ""
|
|
4360
|
+
}
|
|
4361
|
+
}
|
|
4362
|
+
},
|
|
4329
4363
|
random: {
|
|
4330
4364
|
doc: "Returns a random value in the specified range (first two input numbers) based on a supplied seed (third input). The seed can be an expression or a constant number or string value.",
|
|
4331
4365
|
group: "Math",
|
|
@@ -6325,6 +6359,9 @@ var paint_symbol = {
|
|
|
6325
6359
|
"measure-light"
|
|
6326
6360
|
]
|
|
6327
6361
|
},
|
|
6362
|
+
requires: [
|
|
6363
|
+
"icon-image"
|
|
6364
|
+
],
|
|
6328
6365
|
"sdk-support": {
|
|
6329
6366
|
"basic functionality": {
|
|
6330
6367
|
js: "3.0.0",
|
|
@@ -6665,10 +6702,6 @@ var paint_raster = {
|
|
|
6665
6702
|
},
|
|
6666
6703
|
"raster-color-range": {
|
|
6667
6704
|
type: "array",
|
|
6668
|
-
"default": [
|
|
6669
|
-
0,
|
|
6670
|
-
1
|
|
6671
|
-
],
|
|
6672
6705
|
length: 2,
|
|
6673
6706
|
value: "number",
|
|
6674
6707
|
"property-type": "data-constant",
|
|
@@ -6682,7 +6715,7 @@ var paint_raster = {
|
|
|
6682
6715
|
"zoom"
|
|
6683
6716
|
]
|
|
6684
6717
|
},
|
|
6685
|
-
doc: "When `raster-color` is active, specifies the range over which `raster-color` is tabulated. Units correspond to the computed raster value via `raster-color-mix`.",
|
|
6718
|
+
doc: "When `raster-color` is active, specifies the range over which `raster-color` is tabulated. Units correspond to the computed raster value via `raster-color-mix`. For `rasterarray` sources, if `raster-color-range` is unspecified, the source's stated data range is used.",
|
|
6686
6719
|
example: [
|
|
6687
6720
|
0.5,
|
|
6688
6721
|
10
|
|
@@ -6902,7 +6935,7 @@ var paint_raster = {
|
|
|
6902
6935
|
},
|
|
6903
6936
|
"raster-elevation": {
|
|
6904
6937
|
type: "number",
|
|
6905
|
-
doc: "Specifies an uniform elevation from the ground, in meters.
|
|
6938
|
+
doc: "Specifies an uniform elevation from the ground, in meters.",
|
|
6906
6939
|
"default": 0,
|
|
6907
6940
|
minimum: 0,
|
|
6908
6941
|
transition: true,
|
|
@@ -7976,6 +8009,37 @@ var v8 = {
|
|
|
7976
8009
|
layout_line: layout_line,
|
|
7977
8010
|
layout_symbol: layout_symbol,
|
|
7978
8011
|
layout_raster: layout_raster,
|
|
8012
|
+
"layout_raster-particle": {
|
|
8013
|
+
visibility: {
|
|
8014
|
+
type: "enum",
|
|
8015
|
+
values: {
|
|
8016
|
+
visible: {
|
|
8017
|
+
doc: "The layer is shown."
|
|
8018
|
+
},
|
|
8019
|
+
none: {
|
|
8020
|
+
doc: "The layer is not shown."
|
|
8021
|
+
}
|
|
8022
|
+
},
|
|
8023
|
+
"default": "visible",
|
|
8024
|
+
doc: "Whether this layer is displayed.",
|
|
8025
|
+
"sdk-support": {
|
|
8026
|
+
"basic functionality": {
|
|
8027
|
+
js: "0.10.0",
|
|
8028
|
+
android: "2.0.1",
|
|
8029
|
+
ios: "2.0.0"
|
|
8030
|
+
},
|
|
8031
|
+
"expressions support": {
|
|
8032
|
+
js: "3.0.0",
|
|
8033
|
+
android: "11.0.0",
|
|
8034
|
+
ios: "11.0.0"
|
|
8035
|
+
}
|
|
8036
|
+
},
|
|
8037
|
+
expression: {
|
|
8038
|
+
interpolated: false
|
|
8039
|
+
},
|
|
8040
|
+
"property-type": "constant"
|
|
8041
|
+
}
|
|
8042
|
+
},
|
|
7979
8043
|
layout_hillshade: layout_hillshade,
|
|
7980
8044
|
filter: filter,
|
|
7981
8045
|
filter_symbol: filter_symbol,
|
|
@@ -8642,6 +8706,134 @@ var v8 = {
|
|
|
8642
8706
|
paint_heatmap: paint_heatmap,
|
|
8643
8707
|
paint_symbol: paint_symbol,
|
|
8644
8708
|
paint_raster: paint_raster,
|
|
8709
|
+
"paint_raster-particle": {
|
|
8710
|
+
"raster-particle-array-band": {
|
|
8711
|
+
type: "string",
|
|
8712
|
+
required: false,
|
|
8713
|
+
"property-type": "data-constant",
|
|
8714
|
+
transition: false,
|
|
8715
|
+
doc: "Displayed band of raster array source layer",
|
|
8716
|
+
example: "band-name",
|
|
8717
|
+
"sdk-support": {
|
|
8718
|
+
"basic functionality": {
|
|
8719
|
+
js: "",
|
|
8720
|
+
android: "",
|
|
8721
|
+
ios: ""
|
|
8722
|
+
}
|
|
8723
|
+
}
|
|
8724
|
+
},
|
|
8725
|
+
"raster-particle-count": {
|
|
8726
|
+
type: "number",
|
|
8727
|
+
doc: "Defines the amount of particles per tile.",
|
|
8728
|
+
"default": 512,
|
|
8729
|
+
minimum: 1,
|
|
8730
|
+
transition: false,
|
|
8731
|
+
"sdk-support": {
|
|
8732
|
+
"basic functionality": {
|
|
8733
|
+
js: "",
|
|
8734
|
+
android: "",
|
|
8735
|
+
ios: ""
|
|
8736
|
+
}
|
|
8737
|
+
},
|
|
8738
|
+
"property-type": "data-constant"
|
|
8739
|
+
},
|
|
8740
|
+
"raster-particle-color": {
|
|
8741
|
+
type: "color",
|
|
8742
|
+
doc: "Defines a color map by which to colorize a raster particle layer, parameterized by the `[\"raster-particle-speed\"]` expression and evaluated at 256 uniformly spaced steps over the range specified by `raster-particle-max-speed`.",
|
|
8743
|
+
transition: false,
|
|
8744
|
+
"sdk-support": {
|
|
8745
|
+
"basic functionality": {
|
|
8746
|
+
js: "",
|
|
8747
|
+
android: "",
|
|
8748
|
+
ios: ""
|
|
8749
|
+
},
|
|
8750
|
+
"data-driven styling": {
|
|
8751
|
+
}
|
|
8752
|
+
},
|
|
8753
|
+
expression: {
|
|
8754
|
+
interpolated: true,
|
|
8755
|
+
parameters: [
|
|
8756
|
+
"raster-particle-speed"
|
|
8757
|
+
]
|
|
8758
|
+
},
|
|
8759
|
+
"property-type": "color-ramp"
|
|
8760
|
+
},
|
|
8761
|
+
"raster-particle-max-speed": {
|
|
8762
|
+
type: "number",
|
|
8763
|
+
doc: "Defines the maximum speed for particles. Velocities with magnitudes equal to or exceeding this value are clamped to the max value.",
|
|
8764
|
+
"default": 1,
|
|
8765
|
+
minimum: 1,
|
|
8766
|
+
transition: false,
|
|
8767
|
+
"sdk-support": {
|
|
8768
|
+
"basic functionality": {
|
|
8769
|
+
js: "",
|
|
8770
|
+
android: "",
|
|
8771
|
+
ios: ""
|
|
8772
|
+
}
|
|
8773
|
+
},
|
|
8774
|
+
"property-type": "data-constant"
|
|
8775
|
+
},
|
|
8776
|
+
"raster-particle-speed-factor": {
|
|
8777
|
+
type: "number",
|
|
8778
|
+
doc: "Defines a coefficient for the speed of particles’ motion.",
|
|
8779
|
+
"default": 0.2,
|
|
8780
|
+
minimum: 0,
|
|
8781
|
+
maximum: 1,
|
|
8782
|
+
transition: true,
|
|
8783
|
+
"sdk-support": {
|
|
8784
|
+
"basic functionality": {
|
|
8785
|
+
js: "",
|
|
8786
|
+
android: "",
|
|
8787
|
+
ios: ""
|
|
8788
|
+
}
|
|
8789
|
+
},
|
|
8790
|
+
expression: {
|
|
8791
|
+
interpolated: true,
|
|
8792
|
+
parameters: [
|
|
8793
|
+
"zoom"
|
|
8794
|
+
]
|
|
8795
|
+
},
|
|
8796
|
+
"property-type": "data-constant"
|
|
8797
|
+
},
|
|
8798
|
+
"raster-particle-fade-opacity-factor": {
|
|
8799
|
+
type: "number",
|
|
8800
|
+
doc: "Defines defines the opacity coefficient applied to the faded particles in each frame. In practice, this property controls the length of the particle tail.",
|
|
8801
|
+
"default": 0.98,
|
|
8802
|
+
minimum: 0,
|
|
8803
|
+
maximum: 1,
|
|
8804
|
+
transition: true,
|
|
8805
|
+
"sdk-support": {
|
|
8806
|
+
"basic functionality": {
|
|
8807
|
+
js: "",
|
|
8808
|
+
android: "",
|
|
8809
|
+
ios: ""
|
|
8810
|
+
}
|
|
8811
|
+
},
|
|
8812
|
+
expression: {
|
|
8813
|
+
interpolated: true,
|
|
8814
|
+
parameters: [
|
|
8815
|
+
"zoom"
|
|
8816
|
+
]
|
|
8817
|
+
},
|
|
8818
|
+
"property-type": "data-constant"
|
|
8819
|
+
},
|
|
8820
|
+
"raster-particle-reset-rate-factor": {
|
|
8821
|
+
type: "number",
|
|
8822
|
+
doc: "Defines a coefficient for a time period at which particles will restart at a random position, to avoid degeneration (empty areas without particles).",
|
|
8823
|
+
"default": 0.8,
|
|
8824
|
+
minimum: 0,
|
|
8825
|
+
maximum: 1,
|
|
8826
|
+
transition: false,
|
|
8827
|
+
"sdk-support": {
|
|
8828
|
+
"basic functionality": {
|
|
8829
|
+
js: "",
|
|
8830
|
+
android: "",
|
|
8831
|
+
ios: ""
|
|
8832
|
+
}
|
|
8833
|
+
},
|
|
8834
|
+
"property-type": "data-constant"
|
|
8835
|
+
}
|
|
8836
|
+
},
|
|
8645
8837
|
paint_hillshade: paint_hillshade,
|
|
8646
8838
|
paint_background: paint_background,
|
|
8647
8839
|
paint_sky: paint_sky,
|
|
@@ -13239,6 +13431,125 @@ class Distance {
|
|
|
13239
13431
|
}
|
|
13240
13432
|
var Distance$1 = Distance;
|
|
13241
13433
|
|
|
13434
|
+
//
|
|
13435
|
+
function coerceValue(type, value) {
|
|
13436
|
+
switch (type) {
|
|
13437
|
+
case 'string':
|
|
13438
|
+
return toString(value);
|
|
13439
|
+
case 'number':
|
|
13440
|
+
return +value;
|
|
13441
|
+
case 'boolean':
|
|
13442
|
+
return !!value;
|
|
13443
|
+
case 'color':
|
|
13444
|
+
return Color$1.parse(value);
|
|
13445
|
+
case 'formatted': {
|
|
13446
|
+
return Formatted.fromString(toString(value));
|
|
13447
|
+
}
|
|
13448
|
+
case 'resolvedImage': {
|
|
13449
|
+
return ResolvedImage.fromString(toString(value));
|
|
13450
|
+
}
|
|
13451
|
+
}
|
|
13452
|
+
return value;
|
|
13453
|
+
}
|
|
13454
|
+
function clampToAllowedNumber(value, min, max, step) {
|
|
13455
|
+
if (step !== undefined) {
|
|
13456
|
+
value = step * Math.round(value / step);
|
|
13457
|
+
}
|
|
13458
|
+
if (min !== undefined && value < min) {
|
|
13459
|
+
value = min;
|
|
13460
|
+
}
|
|
13461
|
+
if (max !== undefined && value > max) {
|
|
13462
|
+
value = max;
|
|
13463
|
+
}
|
|
13464
|
+
return value;
|
|
13465
|
+
}
|
|
13466
|
+
class Config {
|
|
13467
|
+
constructor(type, key, scope) {
|
|
13468
|
+
this.type = type;
|
|
13469
|
+
this.key = key;
|
|
13470
|
+
this.scope = scope;
|
|
13471
|
+
}
|
|
13472
|
+
static parse(args, context) {
|
|
13473
|
+
let type = context.expectedType;
|
|
13474
|
+
if (type === null || type === undefined) {
|
|
13475
|
+
type = ValueType;
|
|
13476
|
+
}
|
|
13477
|
+
if (args.length < 2 || args.length > 3) {
|
|
13478
|
+
return context.error(`Invalid number of arguments for 'config' expression.`);
|
|
13479
|
+
}
|
|
13480
|
+
const configKey = context.parse(args[1], 1);
|
|
13481
|
+
if (!(configKey instanceof Literal$1)) {
|
|
13482
|
+
return context.error(`Key name of 'config' expression must be a string literal.`);
|
|
13483
|
+
}
|
|
13484
|
+
if (args.length >= 3) {
|
|
13485
|
+
const configScope = context.parse(args[2], 2);
|
|
13486
|
+
if (!(configScope instanceof Literal$1)) {
|
|
13487
|
+
return context.error(`Scope of 'config' expression must be a string literal.`);
|
|
13488
|
+
}
|
|
13489
|
+
return new Config(type, toString(configKey.value), toString(configScope.value));
|
|
13490
|
+
}
|
|
13491
|
+
return new Config(type, toString(configKey.value));
|
|
13492
|
+
}
|
|
13493
|
+
evaluate(ctx) {
|
|
13494
|
+
const FQIDSeparator = '\x1F';
|
|
13495
|
+
const configKey = [
|
|
13496
|
+
this.key,
|
|
13497
|
+
this.scope,
|
|
13498
|
+
ctx.scope
|
|
13499
|
+
].filter(Boolean).join(FQIDSeparator);
|
|
13500
|
+
const config = ctx.getConfig(configKey);
|
|
13501
|
+
if (!config)
|
|
13502
|
+
return null;
|
|
13503
|
+
const {type, value, values, minValue, maxValue, stepValue} = config;
|
|
13504
|
+
const defaultValue = config.default.evaluate(ctx);
|
|
13505
|
+
let result = defaultValue;
|
|
13506
|
+
if (value) {
|
|
13507
|
+
// temporarily override scope to parent to evaluate config expressions passed from the parent
|
|
13508
|
+
const originalScope = ctx.scope;
|
|
13509
|
+
ctx.scope = (originalScope || '').split(FQIDSeparator).slice(1).join(FQIDSeparator);
|
|
13510
|
+
result = value.evaluate(ctx);
|
|
13511
|
+
ctx.scope = originalScope;
|
|
13512
|
+
}
|
|
13513
|
+
if (type) {
|
|
13514
|
+
result = coerceValue(type, result);
|
|
13515
|
+
}
|
|
13516
|
+
if (result !== undefined && (minValue !== undefined || maxValue !== undefined || stepValue !== undefined)) {
|
|
13517
|
+
if (typeof result === 'number') {
|
|
13518
|
+
result = clampToAllowedNumber(result, minValue, maxValue, stepValue);
|
|
13519
|
+
} else if (Array.isArray(result)) {
|
|
13520
|
+
result = result.map(item => typeof item === 'number' ? clampToAllowedNumber(item, minValue, maxValue, stepValue) : item);
|
|
13521
|
+
}
|
|
13522
|
+
}
|
|
13523
|
+
if (value !== undefined && result !== undefined && values && !values.includes(result)) {
|
|
13524
|
+
// The result is not among the allowed values. Instead, use the default value from the option.
|
|
13525
|
+
result = defaultValue;
|
|
13526
|
+
if (type) {
|
|
13527
|
+
result = coerceValue(type, result);
|
|
13528
|
+
}
|
|
13529
|
+
}
|
|
13530
|
+
if (type && type !== this.type || result !== undefined && typeOf(result) !== this.type) {
|
|
13531
|
+
result = coerceValue(this.type.kind, result);
|
|
13532
|
+
}
|
|
13533
|
+
return result;
|
|
13534
|
+
}
|
|
13535
|
+
eachChild() {
|
|
13536
|
+
}
|
|
13537
|
+
outputDefined() {
|
|
13538
|
+
return false;
|
|
13539
|
+
}
|
|
13540
|
+
serialize() {
|
|
13541
|
+
const res = [
|
|
13542
|
+
'config',
|
|
13543
|
+
this.key
|
|
13544
|
+
];
|
|
13545
|
+
if (this.scope) {
|
|
13546
|
+
res.concat(this.key);
|
|
13547
|
+
}
|
|
13548
|
+
return res;
|
|
13549
|
+
}
|
|
13550
|
+
}
|
|
13551
|
+
var Config$1 = Config;
|
|
13552
|
+
|
|
13242
13553
|
//
|
|
13243
13554
|
function isFeatureConstant(e) {
|
|
13244
13555
|
if (e instanceof CompoundExpression$1) {
|
|
@@ -13283,10 +13594,8 @@ function isStateConstant(e) {
|
|
|
13283
13594
|
return result;
|
|
13284
13595
|
}
|
|
13285
13596
|
function isConfigConstant(e) {
|
|
13286
|
-
if (e instanceof
|
|
13287
|
-
|
|
13288
|
-
return false;
|
|
13289
|
-
}
|
|
13597
|
+
if (e instanceof Config$1) {
|
|
13598
|
+
return false;
|
|
13290
13599
|
}
|
|
13291
13600
|
let result = true;
|
|
13292
13601
|
e.eachChild(arg => {
|
|
@@ -13488,8 +13797,6 @@ function isConstant(expression) {
|
|
|
13488
13797
|
return isConstant(expression.boundExpression);
|
|
13489
13798
|
} else if (expression instanceof CompoundExpression$1 && expression.name === 'error') {
|
|
13490
13799
|
return false;
|
|
13491
|
-
} else if (expression instanceof CompoundExpression$1 && expression.name === 'config') {
|
|
13492
|
-
return false;
|
|
13493
13800
|
} else if (expression instanceof CollatorExpression) {
|
|
13494
13801
|
// Although the results of a Collator expression with fixed arguments
|
|
13495
13802
|
// generally shouldn't change between executions, we can't serialize them
|
|
@@ -13499,6 +13806,8 @@ function isConstant(expression) {
|
|
|
13499
13806
|
return false;
|
|
13500
13807
|
} else if (expression instanceof Distance$1) {
|
|
13501
13808
|
return false;
|
|
13809
|
+
} else if (expression instanceof Config$1) {
|
|
13810
|
+
return false;
|
|
13502
13811
|
}
|
|
13503
13812
|
const isTypeAnnotation = expression instanceof Coercion$1 || expression instanceof Assertion$1;
|
|
13504
13813
|
let childrenConstant = true;
|
|
@@ -13528,7 +13837,8 @@ function isConstant(expression) {
|
|
|
13528
13837
|
'is-supported-script',
|
|
13529
13838
|
'pitch',
|
|
13530
13839
|
'distance-from-center',
|
|
13531
|
-
'measure-light'
|
|
13840
|
+
'measure-light',
|
|
13841
|
+
'raster-particle-speed'
|
|
13532
13842
|
]);
|
|
13533
13843
|
}
|
|
13534
13844
|
|
|
@@ -15012,7 +15322,9 @@ const expressions = {
|
|
|
15012
15322
|
// $FlowFixMe[method-unbinding]
|
|
15013
15323
|
'within': Within$1,
|
|
15014
15324
|
// $FlowFixMe[method-unbinding]
|
|
15015
|
-
'distance': Distance$1
|
|
15325
|
+
'distance': Distance$1,
|
|
15326
|
+
// $FlowFixMe[method-unbinding]
|
|
15327
|
+
'config': Config$1
|
|
15016
15328
|
};
|
|
15017
15329
|
function rgba(ctx, [r, g, b, a]) {
|
|
15018
15330
|
r = r.evaluate(ctx);
|
|
@@ -15045,69 +15357,6 @@ function get(key, obj) {
|
|
|
15045
15357
|
const v = obj[key];
|
|
15046
15358
|
return typeof v === 'undefined' ? null : v;
|
|
15047
15359
|
}
|
|
15048
|
-
function coerceValue(type, value) {
|
|
15049
|
-
switch (type) {
|
|
15050
|
-
case 'string':
|
|
15051
|
-
return String(value);
|
|
15052
|
-
case 'number':
|
|
15053
|
-
return +value;
|
|
15054
|
-
case 'boolean':
|
|
15055
|
-
return !!value;
|
|
15056
|
-
case 'color':
|
|
15057
|
-
return Color$1.parse(value);
|
|
15058
|
-
}
|
|
15059
|
-
return value;
|
|
15060
|
-
}
|
|
15061
|
-
function clampToAllowedNumber(value, min, max, step) {
|
|
15062
|
-
if (step !== undefined) {
|
|
15063
|
-
value = step * Math.round(value / step);
|
|
15064
|
-
}
|
|
15065
|
-
if (min !== undefined && value < min) {
|
|
15066
|
-
value = min;
|
|
15067
|
-
}
|
|
15068
|
-
if (max !== undefined && value > max) {
|
|
15069
|
-
value = max;
|
|
15070
|
-
}
|
|
15071
|
-
return value;
|
|
15072
|
-
}
|
|
15073
|
-
const FQIDSeparator = '\x1F';
|
|
15074
|
-
function getConfig(ctx, key, scope) {
|
|
15075
|
-
// Create a fully qualified key from the requested scope
|
|
15076
|
-
// and the scope from the current evaluation context
|
|
15077
|
-
key = [
|
|
15078
|
-
key,
|
|
15079
|
-
scope,
|
|
15080
|
-
ctx.scope
|
|
15081
|
-
].filter(Boolean).join(FQIDSeparator);
|
|
15082
|
-
const config = ctx.getConfig(key);
|
|
15083
|
-
if (!config)
|
|
15084
|
-
return null;
|
|
15085
|
-
const {type, value, values, minValue, maxValue, stepValue} = config;
|
|
15086
|
-
const defaultValue = config.default.evaluate(ctx);
|
|
15087
|
-
let result = defaultValue;
|
|
15088
|
-
if (value) {
|
|
15089
|
-
// temporarily override scope to parent to evaluate config expressions passed from the parent
|
|
15090
|
-
const originalScope = ctx.scope;
|
|
15091
|
-
ctx.scope = (originalScope || '').split(FQIDSeparator).slice(1).join(FQIDSeparator);
|
|
15092
|
-
result = value.evaluate(ctx);
|
|
15093
|
-
ctx.scope = originalScope;
|
|
15094
|
-
}
|
|
15095
|
-
if (type)
|
|
15096
|
-
result = coerceValue(type, result);
|
|
15097
|
-
if (value !== undefined && result !== undefined && values && !values.includes(result)) {
|
|
15098
|
-
result = defaultValue;
|
|
15099
|
-
if (type)
|
|
15100
|
-
result = coerceValue(type, result);
|
|
15101
|
-
}
|
|
15102
|
-
if (result !== undefined && (minValue !== undefined || maxValue !== undefined || stepValue !== undefined)) {
|
|
15103
|
-
if (typeof result === 'number') {
|
|
15104
|
-
result = clampToAllowedNumber(result, minValue, maxValue, stepValue);
|
|
15105
|
-
} else if (Array.isArray(result)) {
|
|
15106
|
-
result = result.map(item => typeof item === 'number' ? clampToAllowedNumber(item, minValue, maxValue, stepValue) : item);
|
|
15107
|
-
}
|
|
15108
|
-
}
|
|
15109
|
-
return result;
|
|
15110
|
-
}
|
|
15111
15360
|
function binarySearch(v, a, i, j) {
|
|
15112
15361
|
while (i <= j) {
|
|
15113
15362
|
const m = i + j >> 1;
|
|
@@ -15225,22 +15474,6 @@ CompoundExpression$1.register(expressions, {
|
|
|
15225
15474
|
]
|
|
15226
15475
|
]
|
|
15227
15476
|
},
|
|
15228
|
-
'config': {
|
|
15229
|
-
type: ValueType,
|
|
15230
|
-
overloads: [
|
|
15231
|
-
[
|
|
15232
|
-
[StringType],
|
|
15233
|
-
(ctx, [key]) => getConfig(ctx, key.evaluate(ctx))
|
|
15234
|
-
],
|
|
15235
|
-
[
|
|
15236
|
-
[
|
|
15237
|
-
StringType,
|
|
15238
|
-
StringType
|
|
15239
|
-
],
|
|
15240
|
-
(ctx, [key, scope]) => getConfig(ctx, key.evaluate(ctx), scope.evaluate(ctx))
|
|
15241
|
-
]
|
|
15242
|
-
]
|
|
15243
|
-
},
|
|
15244
15477
|
'feature-state': [
|
|
15245
15478
|
ValueType,
|
|
15246
15479
|
[StringType],
|
|
@@ -15296,6 +15529,11 @@ CompoundExpression$1.register(expressions, {
|
|
|
15296
15529
|
[],
|
|
15297
15530
|
ctx => ctx.globals.rasterValue || 0
|
|
15298
15531
|
],
|
|
15532
|
+
'raster-particle-speed': [
|
|
15533
|
+
NumberType,
|
|
15534
|
+
[],
|
|
15535
|
+
ctx => ctx.globals.rasterParticleSpeed || 0
|
|
15536
|
+
],
|
|
15299
15537
|
'sky-radial-progress': [
|
|
15300
15538
|
NumberType,
|
|
15301
15539
|
[],
|
|
@@ -17453,18 +17691,10 @@ const operations = {
|
|
|
17453
17691
|
* { command: 'removeImport', args: [importId] }
|
|
17454
17692
|
*/
|
|
17455
17693
|
removeImport: 'removeImport',
|
|
17456
|
-
|
|
17457
|
-
*
|
|
17458
|
-
*/
|
|
17459
|
-
setImportUrl: 'setImportUrl',
|
|
17460
|
-
/*
|
|
17461
|
-
* { command: 'setImportData', args: [importId, stylesheet] }
|
|
17462
|
-
*/
|
|
17463
|
-
setImportData: 'setImportData',
|
|
17464
|
-
/*
|
|
17465
|
-
* { command: 'setImportConfig', args: [importId, config] }
|
|
17694
|
+
/**
|
|
17695
|
+
* { command: 'updateImport', args: [importId, importSpecification | styleUrl] }
|
|
17466
17696
|
*/
|
|
17467
|
-
|
|
17697
|
+
updateImport: 'updateImport'
|
|
17468
17698
|
};
|
|
17469
17699
|
function addSource(sourceId, after, commands) {
|
|
17470
17700
|
commands.push({
|
|
@@ -17795,35 +18025,13 @@ function diffImports(before = [], after = [], commands) {
|
|
|
17795
18025
|
const beforeImport = beforeIndex[afterImport.id];
|
|
17796
18026
|
if (!beforeImport || deepEqual(beforeImport, afterImport))
|
|
17797
18027
|
continue;
|
|
17798
|
-
|
|
17799
|
-
|
|
17800
|
-
|
|
17801
|
-
|
|
17802
|
-
|
|
17803
|
-
|
|
17804
|
-
|
|
17805
|
-
});
|
|
17806
|
-
}
|
|
17807
|
-
if (!deepEqual(beforeImport.url, afterImport.url)) {
|
|
17808
|
-
commands.push({
|
|
17809
|
-
command: operations.setImportUrl,
|
|
17810
|
-
args: [
|
|
17811
|
-
afterImport.id,
|
|
17812
|
-
afterImport.url
|
|
17813
|
-
]
|
|
17814
|
-
});
|
|
17815
|
-
}
|
|
17816
|
-
const beforeData = beforeImport && beforeImport.data;
|
|
17817
|
-
const afterData = afterImport.data;
|
|
17818
|
-
if (!deepEqual(beforeData, afterData)) {
|
|
17819
|
-
commands.push({
|
|
17820
|
-
command: operations.setImportData,
|
|
17821
|
-
args: [
|
|
17822
|
-
afterImport.id,
|
|
17823
|
-
afterData
|
|
17824
|
-
]
|
|
17825
|
-
});
|
|
17826
|
-
}
|
|
18028
|
+
commands.push({
|
|
18029
|
+
command: operations.updateImport,
|
|
18030
|
+
args: [
|
|
18031
|
+
afterImport.id,
|
|
18032
|
+
afterImport
|
|
18033
|
+
]
|
|
18034
|
+
});
|
|
17827
18035
|
}
|
|
17828
18036
|
}
|
|
17829
18037
|
/**
|
|
@@ -18680,8 +18888,15 @@ function validateLayer(options) {
|
|
|
18680
18888
|
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" must specify a "source-layer"`));
|
|
18681
18889
|
} else if (sourceType === 'raster-dem' && type !== 'hillshade') {
|
|
18682
18890
|
errors.push(new ValidationError(key, layer.source, 'raster-dem source can only be used with layer type \'hillshade\'.'));
|
|
18891
|
+
} else if (sourceType === 'raster-array' && ![
|
|
18892
|
+
'raster',
|
|
18893
|
+
'raster-particle'
|
|
18894
|
+
].includes(type)) {
|
|
18895
|
+
errors.push(new ValidationError(key, layer.source, `raster-array source can only be used with layer type \'raster\'.`));
|
|
18683
18896
|
} else if (type === 'line' && layer.paint && (layer.paint['line-gradient'] || layer.paint['line-trim-offset']) && (sourceType !== 'geojson' || !source.lineMetrics)) {
|
|
18684
18897
|
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`));
|
|
18898
|
+
} else if (type === 'raster-particle' && sourceType !== 'raster-array') {
|
|
18899
|
+
errors.push(new ValidationError(key, layer.source, `layer "${ layer.id }" requires a \'raster-array\' source.`));
|
|
18685
18900
|
}
|
|
18686
18901
|
}
|
|
18687
18902
|
}
|
|
@@ -18775,7 +18990,8 @@ function validateSource(options) {
|
|
|
18775
18990
|
if ([
|
|
18776
18991
|
'vector',
|
|
18777
18992
|
'raster',
|
|
18778
|
-
'raster-dem'
|
|
18993
|
+
'raster-dem',
|
|
18994
|
+
'raster-array'
|
|
18779
18995
|
].includes(type)) {
|
|
18780
18996
|
if (!value.url && !value.tiles) {
|
|
18781
18997
|
errors.push(new ValidationWarning(key, value, 'Either "url" or "tiles" is required.'));
|
|
@@ -18785,6 +19001,7 @@ function validateSource(options) {
|
|
|
18785
19001
|
case 'vector':
|
|
18786
19002
|
case 'raster':
|
|
18787
19003
|
case 'raster-dem':
|
|
19004
|
+
case 'raster-array':
|
|
18788
19005
|
errors = errors.concat(validateObject({
|
|
18789
19006
|
key,
|
|
18790
19007
|
value,
|
|
@@ -20413,6 +20630,7 @@ const acceptedSourceTypes = new Set([
|
|
|
20413
20630
|
'vector',
|
|
20414
20631
|
'raster',
|
|
20415
20632
|
'raster-dem',
|
|
20633
|
+
'raster-array',
|
|
20416
20634
|
'model',
|
|
20417
20635
|
'batched-model'
|
|
20418
20636
|
]);
|
|
@@ -20429,7 +20647,7 @@ function getSourceErrors(source, i) {
|
|
|
20429
20647
|
];
|
|
20430
20648
|
errors.push(...getAllowedKeyErrors(source, sourceKeys, 'source'));
|
|
20431
20649
|
/*
|
|
20432
|
-
* "type" is required and must be one of "vector", "raster", "raster-dem"
|
|
20650
|
+
* "type" is required and must be one of "vector", "raster", "raster-dem", "raster-array"
|
|
20433
20651
|
*/
|
|
20434
20652
|
if (!acceptedSourceTypes.has(String(source.type))) {
|
|
20435
20653
|
errors.push(new ValidationError(`sources[${ i }].type`, source.type, `Expected one of [${ Array.from(acceptedSourceTypes).join(', ') }]`));
|