@mapbox/mapbox-gl-style-spec 14.2.0 → 14.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/diff.js +4 -27
- package/dist/index.cjs +353 -131
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +353 -131
- 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 +198 -3
- 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/diff.js
CHANGED
|
@@ -148,20 +148,10 @@ export const operations: {[_: string]: string} = {
|
|
|
148
148
|
*/
|
|
149
149
|
removeImport: 'removeImport',
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
*
|
|
153
|
-
*/
|
|
154
|
-
setImportUrl: 'setImportUrl',
|
|
155
|
-
|
|
156
|
-
/*
|
|
157
|
-
* { command: 'setImportData', args: [importId, stylesheet] }
|
|
158
|
-
*/
|
|
159
|
-
setImportData: 'setImportData',
|
|
160
|
-
|
|
161
|
-
/*
|
|
162
|
-
* { command: 'setImportConfig', args: [importId, config] }
|
|
151
|
+
/**
|
|
152
|
+
* { command: 'updateImport', args: [importId, importSpecification | styleUrl] }
|
|
163
153
|
*/
|
|
164
|
-
|
|
154
|
+
updateImport: 'updateImport'
|
|
165
155
|
};
|
|
166
156
|
|
|
167
157
|
function addSource(sourceId: string, after: Sources, commands: Array<Command>) {
|
|
@@ -424,20 +414,7 @@ export function diffImports(before: Array<ImportSpecification> = [], after: Arra
|
|
|
424
414
|
const beforeImport = beforeIndex[afterImport.id];
|
|
425
415
|
if (!beforeImport || isEqual(beforeImport, afterImport)) continue;
|
|
426
416
|
|
|
427
|
-
|
|
428
|
-
commands.push({command: operations.setImportConfig, args: [afterImport.id, afterImport.config]});
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
if (!isEqual(beforeImport.url, afterImport.url)) {
|
|
432
|
-
commands.push({command: operations.setImportUrl, args: [afterImport.id, afterImport.url]});
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
const beforeData = beforeImport && beforeImport.data;
|
|
436
|
-
const afterData = afterImport.data;
|
|
437
|
-
|
|
438
|
-
if (!isEqual(beforeData, afterData)) {
|
|
439
|
-
commands.push({command: operations.setImportData, args: [afterImport.id, afterData]});
|
|
440
|
-
}
|
|
417
|
+
commands.push({command: operations.updateImport, args: [afterImport.id, afterImport]});
|
|
441
418
|
}
|
|
442
419
|
}
|
|
443
420
|
|
package/dist/index.cjs
CHANGED
|
@@ -871,6 +871,17 @@
|
|
|
871
871
|
type: "*",
|
|
872
872
|
doc: "Contains the description of the raster data layers and the bands contained within the tiles."
|
|
873
873
|
},
|
|
874
|
+
volatile: {
|
|
875
|
+
type: "boolean",
|
|
876
|
+
"default": false,
|
|
877
|
+
doc: "A setting to determine whether a source's tiles are cached locally.",
|
|
878
|
+
"sdk-support": {
|
|
879
|
+
"basic functionality": {
|
|
880
|
+
android: "9.3.0",
|
|
881
|
+
ios: "5.10.0"
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
},
|
|
874
885
|
"*": {
|
|
875
886
|
type: "*",
|
|
876
887
|
doc: "Other keys to configure the data source."
|
|
@@ -1122,6 +1133,17 @@
|
|
|
1122
1133
|
}
|
|
1123
1134
|
}
|
|
1124
1135
|
},
|
|
1136
|
+
"raster-particle": {
|
|
1137
|
+
doc: "Particle animation driven by textures such as wind maps.",
|
|
1138
|
+
"sdk-support": {
|
|
1139
|
+
"basic functionality": {
|
|
1140
|
+
js: "0.10.0",
|
|
1141
|
+
android: "2.0.1",
|
|
1142
|
+
ios: "2.0.0",
|
|
1143
|
+
macos: "0.1.0"
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
},
|
|
1125
1147
|
hillshade: {
|
|
1126
1148
|
doc: "Client-side hillshading visualization based on DEM data. Currently, the implementation only supports Mapbox Terrain RGB and Mapzen Terrarium tiles.",
|
|
1127
1149
|
"sdk-support": {
|
|
@@ -1232,6 +1254,7 @@
|
|
|
1232
1254
|
"layout_fill-extrusion",
|
|
1233
1255
|
"layout_symbol",
|
|
1234
1256
|
"layout_raster",
|
|
1257
|
+
"layout_raster-particle",
|
|
1235
1258
|
"layout_hillshade",
|
|
1236
1259
|
"layout_background",
|
|
1237
1260
|
"layout_sky",
|
|
@@ -3588,7 +3611,7 @@
|
|
|
3588
3611
|
}
|
|
3589
3612
|
},
|
|
3590
3613
|
image: {
|
|
3591
|
-
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.",
|
|
3614
|
+
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.",
|
|
3592
3615
|
group: "Types",
|
|
3593
3616
|
"sdk-support": {
|
|
3594
3617
|
"basic functionality": {
|
|
@@ -4332,6 +4355,17 @@
|
|
|
4332
4355
|
}
|
|
4333
4356
|
}
|
|
4334
4357
|
},
|
|
4358
|
+
"raster-particle-speed": {
|
|
4359
|
+
doc: "Returns the length of the particle velocity vector. Can only be used in the `raster-particle-color` property.",
|
|
4360
|
+
group: "Raster Particle Animation",
|
|
4361
|
+
"sdk-support": {
|
|
4362
|
+
"basic functionality": {
|
|
4363
|
+
js: "3.3.0",
|
|
4364
|
+
android: "",
|
|
4365
|
+
ios: ""
|
|
4366
|
+
}
|
|
4367
|
+
}
|
|
4368
|
+
},
|
|
4335
4369
|
random: {
|
|
4336
4370
|
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.",
|
|
4337
4371
|
group: "Math",
|
|
@@ -6331,6 +6365,9 @@
|
|
|
6331
6365
|
"measure-light"
|
|
6332
6366
|
]
|
|
6333
6367
|
},
|
|
6368
|
+
requires: [
|
|
6369
|
+
"icon-image"
|
|
6370
|
+
],
|
|
6334
6371
|
"sdk-support": {
|
|
6335
6372
|
"basic functionality": {
|
|
6336
6373
|
js: "3.0.0",
|
|
@@ -6908,7 +6945,7 @@
|
|
|
6908
6945
|
},
|
|
6909
6946
|
"raster-elevation": {
|
|
6910
6947
|
type: "number",
|
|
6911
|
-
doc: "Specifies an uniform elevation from the ground, in meters.
|
|
6948
|
+
doc: "Specifies an uniform elevation from the ground, in meters.",
|
|
6912
6949
|
"default": 0,
|
|
6913
6950
|
minimum: 0,
|
|
6914
6951
|
transition: true,
|
|
@@ -7982,6 +8019,37 @@
|
|
|
7982
8019
|
layout_line: layout_line,
|
|
7983
8020
|
layout_symbol: layout_symbol,
|
|
7984
8021
|
layout_raster: layout_raster,
|
|
8022
|
+
"layout_raster-particle": {
|
|
8023
|
+
visibility: {
|
|
8024
|
+
type: "enum",
|
|
8025
|
+
values: {
|
|
8026
|
+
visible: {
|
|
8027
|
+
doc: "The layer is shown."
|
|
8028
|
+
},
|
|
8029
|
+
none: {
|
|
8030
|
+
doc: "The layer is not shown."
|
|
8031
|
+
}
|
|
8032
|
+
},
|
|
8033
|
+
"default": "visible",
|
|
8034
|
+
doc: "Whether this layer is displayed.",
|
|
8035
|
+
"sdk-support": {
|
|
8036
|
+
"basic functionality": {
|
|
8037
|
+
js: "0.10.0",
|
|
8038
|
+
android: "2.0.1",
|
|
8039
|
+
ios: "2.0.0"
|
|
8040
|
+
},
|
|
8041
|
+
"expressions support": {
|
|
8042
|
+
js: "3.0.0",
|
|
8043
|
+
android: "11.0.0",
|
|
8044
|
+
ios: "11.0.0"
|
|
8045
|
+
}
|
|
8046
|
+
},
|
|
8047
|
+
expression: {
|
|
8048
|
+
interpolated: false
|
|
8049
|
+
},
|
|
8050
|
+
"property-type": "constant"
|
|
8051
|
+
}
|
|
8052
|
+
},
|
|
7985
8053
|
layout_hillshade: layout_hillshade,
|
|
7986
8054
|
filter: filter,
|
|
7987
8055
|
filter_symbol: filter_symbol,
|
|
@@ -8648,6 +8716,134 @@
|
|
|
8648
8716
|
paint_heatmap: paint_heatmap,
|
|
8649
8717
|
paint_symbol: paint_symbol,
|
|
8650
8718
|
paint_raster: paint_raster,
|
|
8719
|
+
"paint_raster-particle": {
|
|
8720
|
+
"raster-particle-array-band": {
|
|
8721
|
+
type: "string",
|
|
8722
|
+
required: false,
|
|
8723
|
+
"property-type": "data-constant",
|
|
8724
|
+
transition: false,
|
|
8725
|
+
doc: "Displayed band of raster array source layer",
|
|
8726
|
+
example: "band-name",
|
|
8727
|
+
"sdk-support": {
|
|
8728
|
+
"basic functionality": {
|
|
8729
|
+
js: "",
|
|
8730
|
+
android: "",
|
|
8731
|
+
ios: ""
|
|
8732
|
+
}
|
|
8733
|
+
}
|
|
8734
|
+
},
|
|
8735
|
+
"raster-particle-count": {
|
|
8736
|
+
type: "number",
|
|
8737
|
+
doc: "Defines the amount of particles per tile.",
|
|
8738
|
+
"default": 512,
|
|
8739
|
+
minimum: 1,
|
|
8740
|
+
transition: false,
|
|
8741
|
+
"sdk-support": {
|
|
8742
|
+
"basic functionality": {
|
|
8743
|
+
js: "",
|
|
8744
|
+
android: "",
|
|
8745
|
+
ios: ""
|
|
8746
|
+
}
|
|
8747
|
+
},
|
|
8748
|
+
"property-type": "data-constant"
|
|
8749
|
+
},
|
|
8750
|
+
"raster-particle-color": {
|
|
8751
|
+
type: "color",
|
|
8752
|
+
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`.",
|
|
8753
|
+
transition: false,
|
|
8754
|
+
"sdk-support": {
|
|
8755
|
+
"basic functionality": {
|
|
8756
|
+
js: "",
|
|
8757
|
+
android: "",
|
|
8758
|
+
ios: ""
|
|
8759
|
+
},
|
|
8760
|
+
"data-driven styling": {
|
|
8761
|
+
}
|
|
8762
|
+
},
|
|
8763
|
+
expression: {
|
|
8764
|
+
interpolated: true,
|
|
8765
|
+
parameters: [
|
|
8766
|
+
"raster-particle-speed"
|
|
8767
|
+
]
|
|
8768
|
+
},
|
|
8769
|
+
"property-type": "color-ramp"
|
|
8770
|
+
},
|
|
8771
|
+
"raster-particle-max-speed": {
|
|
8772
|
+
type: "number",
|
|
8773
|
+
doc: "Defines the maximum speed for particles. Velocities with magnitudes equal to or exceeding this value are clamped to the max value.",
|
|
8774
|
+
"default": 1,
|
|
8775
|
+
minimum: 1,
|
|
8776
|
+
transition: false,
|
|
8777
|
+
"sdk-support": {
|
|
8778
|
+
"basic functionality": {
|
|
8779
|
+
js: "",
|
|
8780
|
+
android: "",
|
|
8781
|
+
ios: ""
|
|
8782
|
+
}
|
|
8783
|
+
},
|
|
8784
|
+
"property-type": "data-constant"
|
|
8785
|
+
},
|
|
8786
|
+
"raster-particle-speed-factor": {
|
|
8787
|
+
type: "number",
|
|
8788
|
+
doc: "Defines a coefficient for the speed of particles’ motion.",
|
|
8789
|
+
"default": 0.2,
|
|
8790
|
+
minimum: 0,
|
|
8791
|
+
maximum: 1,
|
|
8792
|
+
transition: true,
|
|
8793
|
+
"sdk-support": {
|
|
8794
|
+
"basic functionality": {
|
|
8795
|
+
js: "",
|
|
8796
|
+
android: "",
|
|
8797
|
+
ios: ""
|
|
8798
|
+
}
|
|
8799
|
+
},
|
|
8800
|
+
expression: {
|
|
8801
|
+
interpolated: true,
|
|
8802
|
+
parameters: [
|
|
8803
|
+
"zoom"
|
|
8804
|
+
]
|
|
8805
|
+
},
|
|
8806
|
+
"property-type": "data-constant"
|
|
8807
|
+
},
|
|
8808
|
+
"raster-particle-fade-opacity-factor": {
|
|
8809
|
+
type: "number",
|
|
8810
|
+
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.",
|
|
8811
|
+
"default": 0.98,
|
|
8812
|
+
minimum: 0,
|
|
8813
|
+
maximum: 1,
|
|
8814
|
+
transition: true,
|
|
8815
|
+
"sdk-support": {
|
|
8816
|
+
"basic functionality": {
|
|
8817
|
+
js: "",
|
|
8818
|
+
android: "",
|
|
8819
|
+
ios: ""
|
|
8820
|
+
}
|
|
8821
|
+
},
|
|
8822
|
+
expression: {
|
|
8823
|
+
interpolated: true,
|
|
8824
|
+
parameters: [
|
|
8825
|
+
"zoom"
|
|
8826
|
+
]
|
|
8827
|
+
},
|
|
8828
|
+
"property-type": "data-constant"
|
|
8829
|
+
},
|
|
8830
|
+
"raster-particle-reset-rate-factor": {
|
|
8831
|
+
type: "number",
|
|
8832
|
+
doc: "Defines a coefficient for a time period at which particles will restart at a random position, to avoid degeneration (empty areas without particles).",
|
|
8833
|
+
"default": 0.8,
|
|
8834
|
+
minimum: 0,
|
|
8835
|
+
maximum: 1,
|
|
8836
|
+
transition: false,
|
|
8837
|
+
"sdk-support": {
|
|
8838
|
+
"basic functionality": {
|
|
8839
|
+
js: "",
|
|
8840
|
+
android: "",
|
|
8841
|
+
ios: ""
|
|
8842
|
+
}
|
|
8843
|
+
},
|
|
8844
|
+
"property-type": "data-constant"
|
|
8845
|
+
}
|
|
8846
|
+
},
|
|
8651
8847
|
paint_hillshade: paint_hillshade,
|
|
8652
8848
|
paint_background: paint_background,
|
|
8653
8849
|
paint_sky: paint_sky,
|
|
@@ -13245,6 +13441,125 @@
|
|
|
13245
13441
|
}
|
|
13246
13442
|
var Distance$1 = Distance;
|
|
13247
13443
|
|
|
13444
|
+
//
|
|
13445
|
+
function coerceValue(type, value) {
|
|
13446
|
+
switch (type) {
|
|
13447
|
+
case 'string':
|
|
13448
|
+
return toString(value);
|
|
13449
|
+
case 'number':
|
|
13450
|
+
return +value;
|
|
13451
|
+
case 'boolean':
|
|
13452
|
+
return !!value;
|
|
13453
|
+
case 'color':
|
|
13454
|
+
return Color$1.parse(value);
|
|
13455
|
+
case 'formatted': {
|
|
13456
|
+
return Formatted.fromString(toString(value));
|
|
13457
|
+
}
|
|
13458
|
+
case 'resolvedImage': {
|
|
13459
|
+
return ResolvedImage.fromString(toString(value));
|
|
13460
|
+
}
|
|
13461
|
+
}
|
|
13462
|
+
return value;
|
|
13463
|
+
}
|
|
13464
|
+
function clampToAllowedNumber(value, min, max, step) {
|
|
13465
|
+
if (step !== undefined) {
|
|
13466
|
+
value = step * Math.round(value / step);
|
|
13467
|
+
}
|
|
13468
|
+
if (min !== undefined && value < min) {
|
|
13469
|
+
value = min;
|
|
13470
|
+
}
|
|
13471
|
+
if (max !== undefined && value > max) {
|
|
13472
|
+
value = max;
|
|
13473
|
+
}
|
|
13474
|
+
return value;
|
|
13475
|
+
}
|
|
13476
|
+
class Config {
|
|
13477
|
+
constructor(type, key, scope) {
|
|
13478
|
+
this.type = type;
|
|
13479
|
+
this.key = key;
|
|
13480
|
+
this.scope = scope;
|
|
13481
|
+
}
|
|
13482
|
+
static parse(args, context) {
|
|
13483
|
+
let type = context.expectedType;
|
|
13484
|
+
if (type === null || type === undefined) {
|
|
13485
|
+
type = ValueType;
|
|
13486
|
+
}
|
|
13487
|
+
if (args.length < 2 || args.length > 3) {
|
|
13488
|
+
return context.error(`Invalid number of arguments for 'config' expression.`);
|
|
13489
|
+
}
|
|
13490
|
+
const configKey = context.parse(args[1], 1);
|
|
13491
|
+
if (!(configKey instanceof Literal$1)) {
|
|
13492
|
+
return context.error(`Key name of 'config' expression must be a string literal.`);
|
|
13493
|
+
}
|
|
13494
|
+
if (args.length >= 3) {
|
|
13495
|
+
const configScope = context.parse(args[2], 2);
|
|
13496
|
+
if (!(configScope instanceof Literal$1)) {
|
|
13497
|
+
return context.error(`Scope of 'config' expression must be a string literal.`);
|
|
13498
|
+
}
|
|
13499
|
+
return new Config(type, toString(configKey.value), toString(configScope.value));
|
|
13500
|
+
}
|
|
13501
|
+
return new Config(type, toString(configKey.value));
|
|
13502
|
+
}
|
|
13503
|
+
evaluate(ctx) {
|
|
13504
|
+
const FQIDSeparator = '\x1F';
|
|
13505
|
+
const configKey = [
|
|
13506
|
+
this.key,
|
|
13507
|
+
this.scope,
|
|
13508
|
+
ctx.scope
|
|
13509
|
+
].filter(Boolean).join(FQIDSeparator);
|
|
13510
|
+
const config = ctx.getConfig(configKey);
|
|
13511
|
+
if (!config)
|
|
13512
|
+
return null;
|
|
13513
|
+
const {type, value, values, minValue, maxValue, stepValue} = config;
|
|
13514
|
+
const defaultValue = config.default.evaluate(ctx);
|
|
13515
|
+
let result = defaultValue;
|
|
13516
|
+
if (value) {
|
|
13517
|
+
// temporarily override scope to parent to evaluate config expressions passed from the parent
|
|
13518
|
+
const originalScope = ctx.scope;
|
|
13519
|
+
ctx.scope = (originalScope || '').split(FQIDSeparator).slice(1).join(FQIDSeparator);
|
|
13520
|
+
result = value.evaluate(ctx);
|
|
13521
|
+
ctx.scope = originalScope;
|
|
13522
|
+
}
|
|
13523
|
+
if (type) {
|
|
13524
|
+
result = coerceValue(type, result);
|
|
13525
|
+
}
|
|
13526
|
+
if (result !== undefined && (minValue !== undefined || maxValue !== undefined || stepValue !== undefined)) {
|
|
13527
|
+
if (typeof result === 'number') {
|
|
13528
|
+
result = clampToAllowedNumber(result, minValue, maxValue, stepValue);
|
|
13529
|
+
} else if (Array.isArray(result)) {
|
|
13530
|
+
result = result.map(item => typeof item === 'number' ? clampToAllowedNumber(item, minValue, maxValue, stepValue) : item);
|
|
13531
|
+
}
|
|
13532
|
+
}
|
|
13533
|
+
if (value !== undefined && result !== undefined && values && !values.includes(result)) {
|
|
13534
|
+
// The result is not among the allowed values. Instead, use the default value from the option.
|
|
13535
|
+
result = defaultValue;
|
|
13536
|
+
if (type) {
|
|
13537
|
+
result = coerceValue(type, result);
|
|
13538
|
+
}
|
|
13539
|
+
}
|
|
13540
|
+
if (type && type !== this.type || result !== undefined && typeOf(result) !== this.type) {
|
|
13541
|
+
result = coerceValue(this.type.kind, result);
|
|
13542
|
+
}
|
|
13543
|
+
return result;
|
|
13544
|
+
}
|
|
13545
|
+
eachChild() {
|
|
13546
|
+
}
|
|
13547
|
+
outputDefined() {
|
|
13548
|
+
return false;
|
|
13549
|
+
}
|
|
13550
|
+
serialize() {
|
|
13551
|
+
const res = [
|
|
13552
|
+
'config',
|
|
13553
|
+
this.key
|
|
13554
|
+
];
|
|
13555
|
+
if (this.scope) {
|
|
13556
|
+
res.concat(this.key);
|
|
13557
|
+
}
|
|
13558
|
+
return res;
|
|
13559
|
+
}
|
|
13560
|
+
}
|
|
13561
|
+
var Config$1 = Config;
|
|
13562
|
+
|
|
13248
13563
|
//
|
|
13249
13564
|
function isFeatureConstant(e) {
|
|
13250
13565
|
if (e instanceof CompoundExpression$1) {
|
|
@@ -13289,10 +13604,8 @@
|
|
|
13289
13604
|
return result;
|
|
13290
13605
|
}
|
|
13291
13606
|
function isConfigConstant(e) {
|
|
13292
|
-
if (e instanceof
|
|
13293
|
-
|
|
13294
|
-
return false;
|
|
13295
|
-
}
|
|
13607
|
+
if (e instanceof Config$1) {
|
|
13608
|
+
return false;
|
|
13296
13609
|
}
|
|
13297
13610
|
let result = true;
|
|
13298
13611
|
e.eachChild(arg => {
|
|
@@ -13494,8 +13807,6 @@
|
|
|
13494
13807
|
return isConstant(expression.boundExpression);
|
|
13495
13808
|
} else if (expression instanceof CompoundExpression$1 && expression.name === 'error') {
|
|
13496
13809
|
return false;
|
|
13497
|
-
} else if (expression instanceof CompoundExpression$1 && expression.name === 'config') {
|
|
13498
|
-
return false;
|
|
13499
13810
|
} else if (expression instanceof CollatorExpression) {
|
|
13500
13811
|
// Although the results of a Collator expression with fixed arguments
|
|
13501
13812
|
// generally shouldn't change between executions, we can't serialize them
|
|
@@ -13505,6 +13816,8 @@
|
|
|
13505
13816
|
return false;
|
|
13506
13817
|
} else if (expression instanceof Distance$1) {
|
|
13507
13818
|
return false;
|
|
13819
|
+
} else if (expression instanceof Config$1) {
|
|
13820
|
+
return false;
|
|
13508
13821
|
}
|
|
13509
13822
|
const isTypeAnnotation = expression instanceof Coercion$1 || expression instanceof Assertion$1;
|
|
13510
13823
|
let childrenConstant = true;
|
|
@@ -13534,7 +13847,8 @@
|
|
|
13534
13847
|
'is-supported-script',
|
|
13535
13848
|
'pitch',
|
|
13536
13849
|
'distance-from-center',
|
|
13537
|
-
'measure-light'
|
|
13850
|
+
'measure-light',
|
|
13851
|
+
'raster-particle-speed'
|
|
13538
13852
|
]);
|
|
13539
13853
|
}
|
|
13540
13854
|
|
|
@@ -15018,7 +15332,9 @@
|
|
|
15018
15332
|
// $FlowFixMe[method-unbinding]
|
|
15019
15333
|
'within': Within$1,
|
|
15020
15334
|
// $FlowFixMe[method-unbinding]
|
|
15021
|
-
'distance': Distance$1
|
|
15335
|
+
'distance': Distance$1,
|
|
15336
|
+
// $FlowFixMe[method-unbinding]
|
|
15337
|
+
'config': Config$1
|
|
15022
15338
|
};
|
|
15023
15339
|
function rgba(ctx, [r, g, b, a]) {
|
|
15024
15340
|
r = r.evaluate(ctx);
|
|
@@ -15051,69 +15367,6 @@
|
|
|
15051
15367
|
const v = obj[key];
|
|
15052
15368
|
return typeof v === 'undefined' ? null : v;
|
|
15053
15369
|
}
|
|
15054
|
-
function coerceValue(type, value) {
|
|
15055
|
-
switch (type) {
|
|
15056
|
-
case 'string':
|
|
15057
|
-
return String(value);
|
|
15058
|
-
case 'number':
|
|
15059
|
-
return +value;
|
|
15060
|
-
case 'boolean':
|
|
15061
|
-
return !!value;
|
|
15062
|
-
case 'color':
|
|
15063
|
-
return Color$1.parse(value);
|
|
15064
|
-
}
|
|
15065
|
-
return value;
|
|
15066
|
-
}
|
|
15067
|
-
function clampToAllowedNumber(value, min, max, step) {
|
|
15068
|
-
if (step !== undefined) {
|
|
15069
|
-
value = step * Math.round(value / step);
|
|
15070
|
-
}
|
|
15071
|
-
if (min !== undefined && value < min) {
|
|
15072
|
-
value = min;
|
|
15073
|
-
}
|
|
15074
|
-
if (max !== undefined && value > max) {
|
|
15075
|
-
value = max;
|
|
15076
|
-
}
|
|
15077
|
-
return value;
|
|
15078
|
-
}
|
|
15079
|
-
const FQIDSeparator = '\x1F';
|
|
15080
|
-
function getConfig(ctx, key, scope) {
|
|
15081
|
-
// Create a fully qualified key from the requested scope
|
|
15082
|
-
// and the scope from the current evaluation context
|
|
15083
|
-
key = [
|
|
15084
|
-
key,
|
|
15085
|
-
scope,
|
|
15086
|
-
ctx.scope
|
|
15087
|
-
].filter(Boolean).join(FQIDSeparator);
|
|
15088
|
-
const config = ctx.getConfig(key);
|
|
15089
|
-
if (!config)
|
|
15090
|
-
return null;
|
|
15091
|
-
const {type, value, values, minValue, maxValue, stepValue} = config;
|
|
15092
|
-
const defaultValue = config.default.evaluate(ctx);
|
|
15093
|
-
let result = defaultValue;
|
|
15094
|
-
if (value) {
|
|
15095
|
-
// temporarily override scope to parent to evaluate config expressions passed from the parent
|
|
15096
|
-
const originalScope = ctx.scope;
|
|
15097
|
-
ctx.scope = (originalScope || '').split(FQIDSeparator).slice(1).join(FQIDSeparator);
|
|
15098
|
-
result = value.evaluate(ctx);
|
|
15099
|
-
ctx.scope = originalScope;
|
|
15100
|
-
}
|
|
15101
|
-
if (type)
|
|
15102
|
-
result = coerceValue(type, result);
|
|
15103
|
-
if (value !== undefined && result !== undefined && values && !values.includes(result)) {
|
|
15104
|
-
result = defaultValue;
|
|
15105
|
-
if (type)
|
|
15106
|
-
result = coerceValue(type, result);
|
|
15107
|
-
}
|
|
15108
|
-
if (result !== undefined && (minValue !== undefined || maxValue !== undefined || stepValue !== undefined)) {
|
|
15109
|
-
if (typeof result === 'number') {
|
|
15110
|
-
result = clampToAllowedNumber(result, minValue, maxValue, stepValue);
|
|
15111
|
-
} else if (Array.isArray(result)) {
|
|
15112
|
-
result = result.map(item => typeof item === 'number' ? clampToAllowedNumber(item, minValue, maxValue, stepValue) : item);
|
|
15113
|
-
}
|
|
15114
|
-
}
|
|
15115
|
-
return result;
|
|
15116
|
-
}
|
|
15117
15370
|
function binarySearch(v, a, i, j) {
|
|
15118
15371
|
while (i <= j) {
|
|
15119
15372
|
const m = i + j >> 1;
|
|
@@ -15231,22 +15484,6 @@
|
|
|
15231
15484
|
]
|
|
15232
15485
|
]
|
|
15233
15486
|
},
|
|
15234
|
-
'config': {
|
|
15235
|
-
type: ValueType,
|
|
15236
|
-
overloads: [
|
|
15237
|
-
[
|
|
15238
|
-
[StringType],
|
|
15239
|
-
(ctx, [key]) => getConfig(ctx, key.evaluate(ctx))
|
|
15240
|
-
],
|
|
15241
|
-
[
|
|
15242
|
-
[
|
|
15243
|
-
StringType,
|
|
15244
|
-
StringType
|
|
15245
|
-
],
|
|
15246
|
-
(ctx, [key, scope]) => getConfig(ctx, key.evaluate(ctx), scope.evaluate(ctx))
|
|
15247
|
-
]
|
|
15248
|
-
]
|
|
15249
|
-
},
|
|
15250
15487
|
'feature-state': [
|
|
15251
15488
|
ValueType,
|
|
15252
15489
|
[StringType],
|
|
@@ -15302,6 +15539,11 @@
|
|
|
15302
15539
|
[],
|
|
15303
15540
|
ctx => ctx.globals.rasterValue || 0
|
|
15304
15541
|
],
|
|
15542
|
+
'raster-particle-speed': [
|
|
15543
|
+
NumberType,
|
|
15544
|
+
[],
|
|
15545
|
+
ctx => ctx.globals.rasterParticleSpeed || 0
|
|
15546
|
+
],
|
|
15305
15547
|
'sky-radial-progress': [
|
|
15306
15548
|
NumberType,
|
|
15307
15549
|
[],
|
|
@@ -17459,18 +17701,10 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
17459
17701
|
* { command: 'removeImport', args: [importId] }
|
|
17460
17702
|
*/
|
|
17461
17703
|
removeImport: 'removeImport',
|
|
17462
|
-
|
|
17463
|
-
*
|
|
17464
|
-
*/
|
|
17465
|
-
setImportUrl: 'setImportUrl',
|
|
17466
|
-
/*
|
|
17467
|
-
* { command: 'setImportData', args: [importId, stylesheet] }
|
|
17468
|
-
*/
|
|
17469
|
-
setImportData: 'setImportData',
|
|
17470
|
-
/*
|
|
17471
|
-
* { command: 'setImportConfig', args: [importId, config] }
|
|
17704
|
+
/**
|
|
17705
|
+
* { command: 'updateImport', args: [importId, importSpecification | styleUrl] }
|
|
17472
17706
|
*/
|
|
17473
|
-
|
|
17707
|
+
updateImport: 'updateImport'
|
|
17474
17708
|
};
|
|
17475
17709
|
function addSource(sourceId, after, commands) {
|
|
17476
17710
|
commands.push({
|
|
@@ -17801,35 +18035,13 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
17801
18035
|
const beforeImport = beforeIndex[afterImport.id];
|
|
17802
18036
|
if (!beforeImport || deepEqual(beforeImport, afterImport))
|
|
17803
18037
|
continue;
|
|
17804
|
-
|
|
17805
|
-
|
|
17806
|
-
|
|
17807
|
-
|
|
17808
|
-
|
|
17809
|
-
|
|
17810
|
-
|
|
17811
|
-
});
|
|
17812
|
-
}
|
|
17813
|
-
if (!deepEqual(beforeImport.url, afterImport.url)) {
|
|
17814
|
-
commands.push({
|
|
17815
|
-
command: operations.setImportUrl,
|
|
17816
|
-
args: [
|
|
17817
|
-
afterImport.id,
|
|
17818
|
-
afterImport.url
|
|
17819
|
-
]
|
|
17820
|
-
});
|
|
17821
|
-
}
|
|
17822
|
-
const beforeData = beforeImport && beforeImport.data;
|
|
17823
|
-
const afterData = afterImport.data;
|
|
17824
|
-
if (!deepEqual(beforeData, afterData)) {
|
|
17825
|
-
commands.push({
|
|
17826
|
-
command: operations.setImportData,
|
|
17827
|
-
args: [
|
|
17828
|
-
afterImport.id,
|
|
17829
|
-
afterData
|
|
17830
|
-
]
|
|
17831
|
-
});
|
|
17832
|
-
}
|
|
18038
|
+
commands.push({
|
|
18039
|
+
command: operations.updateImport,
|
|
18040
|
+
args: [
|
|
18041
|
+
afterImport.id,
|
|
18042
|
+
afterImport
|
|
18043
|
+
]
|
|
18044
|
+
});
|
|
17833
18045
|
}
|
|
17834
18046
|
}
|
|
17835
18047
|
/**
|
|
@@ -18686,8 +18898,15 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
18686
18898
|
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" must specify a "source-layer"`));
|
|
18687
18899
|
} else if (sourceType === 'raster-dem' && type !== 'hillshade') {
|
|
18688
18900
|
errors.push(new ValidationError(key, layer.source, 'raster-dem source can only be used with layer type \'hillshade\'.'));
|
|
18901
|
+
} else if (sourceType === 'raster-array' && ![
|
|
18902
|
+
'raster',
|
|
18903
|
+
'raster-particle'
|
|
18904
|
+
].includes(type)) {
|
|
18905
|
+
errors.push(new ValidationError(key, layer.source, `raster-array source can only be used with layer type \'raster\'.`));
|
|
18689
18906
|
} else if (type === 'line' && layer.paint && (layer.paint['line-gradient'] || layer.paint['line-trim-offset']) && (sourceType !== 'geojson' || !source.lineMetrics)) {
|
|
18690
18907
|
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`));
|
|
18908
|
+
} else if (type === 'raster-particle' && sourceType !== 'raster-array') {
|
|
18909
|
+
errors.push(new ValidationError(key, layer.source, `layer "${ layer.id }" requires a \'raster-array\' source.`));
|
|
18691
18910
|
}
|
|
18692
18911
|
}
|
|
18693
18912
|
}
|
|
@@ -18781,7 +19000,8 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
18781
19000
|
if ([
|
|
18782
19001
|
'vector',
|
|
18783
19002
|
'raster',
|
|
18784
|
-
'raster-dem'
|
|
19003
|
+
'raster-dem',
|
|
19004
|
+
'raster-array'
|
|
18785
19005
|
].includes(type)) {
|
|
18786
19006
|
if (!value.url && !value.tiles) {
|
|
18787
19007
|
errors.push(new ValidationWarning(key, value, 'Either "url" or "tiles" is required.'));
|
|
@@ -18791,6 +19011,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
18791
19011
|
case 'vector':
|
|
18792
19012
|
case 'raster':
|
|
18793
19013
|
case 'raster-dem':
|
|
19014
|
+
case 'raster-array':
|
|
18794
19015
|
errors = errors.concat(validateObject({
|
|
18795
19016
|
key,
|
|
18796
19017
|
value,
|
|
@@ -20419,6 +20640,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
20419
20640
|
'vector',
|
|
20420
20641
|
'raster',
|
|
20421
20642
|
'raster-dem',
|
|
20643
|
+
'raster-array',
|
|
20422
20644
|
'model',
|
|
20423
20645
|
'batched-model'
|
|
20424
20646
|
]);
|
|
@@ -20435,7 +20657,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
20435
20657
|
];
|
|
20436
20658
|
errors.push(...getAllowedKeyErrors(source, sourceKeys, 'source'));
|
|
20437
20659
|
/*
|
|
20438
|
-
* "type" is required and must be one of "vector", "raster", "raster-dem"
|
|
20660
|
+
* "type" is required and must be one of "vector", "raster", "raster-dem", "raster-array"
|
|
20439
20661
|
*/
|
|
20440
20662
|
if (!acceptedSourceTypes.has(String(source.type))) {
|
|
20441
20663
|
errors.push(new ValidationError(`sources[${ i }].type`, source.type, `Expected one of [${ Array.from(acceptedSourceTypes).join(', ') }]`));
|