@mapbox/mapbox-gl-style-spec 14.9.1 → 14.10.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/dist/index.cjs CHANGED
@@ -234,6 +234,13 @@
234
234
  experimental: true,
235
235
  type: "featuresets",
236
236
  doc: "Defines sets of features for querying, interaction, and state management on the map, referencing individual layers or subsets of layers within the map's style.",
237
+ "sdk-support": {
238
+ "basic functionality": {
239
+ js: "3.9.0",
240
+ android: "11.9.0",
241
+ ios: "11.9.0"
242
+ }
243
+ },
237
244
  example: {
238
245
  poi: {
239
246
  selectors: [
@@ -266,10 +273,12 @@
266
273
  var featureset = {
267
274
  experimental: true,
268
275
  metadata: {
276
+ experimental: true,
269
277
  type: "*",
270
278
  doc: "Arbitrary properties useful to track with the stylesheet, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."
271
279
  },
272
280
  selectors: {
281
+ experimental: true,
273
282
  type: "array",
274
283
  value: "selector",
275
284
  doc: "A collection of categorized selectors."
@@ -278,24 +287,35 @@
278
287
  var selector = {
279
288
  experimental: true,
280
289
  layer: {
290
+ experimental: true,
281
291
  type: "string",
282
292
  doc: "The ID of a layer that exists in the current style.",
283
293
  required: true
284
294
  },
285
295
  properties: {
296
+ experimental: true,
286
297
  type: "selectorProperty",
287
298
  required: false,
288
299
  doc: "Properties accessible to the end user through queried feautures. If properties are empty, no feature properties are exposed. If undefined, all original feature properties will be accessible."
289
300
  },
290
301
  featureNamespace: {
302
+ experimental: true,
291
303
  type: "string",
292
304
  required: false,
293
305
  doc: "An optional field that represents the feature namespace defined by the selector within a featureset to which this feature belongs. If the underlying source is the same for multiple selectors within a featureset, the same featureNamespace should be used across those selectors."
306
+ },
307
+ _uniqueFeatureID: {
308
+ experimental: true,
309
+ type: "boolean",
310
+ "private": true,
311
+ required: false,
312
+ doc: "Internal flag used for standard style, in case multiple features sharing the same featureId, only one feature will be returned for feature query."
294
313
  }
295
314
  };
296
315
  var selectorProperty = {
297
316
  experimental: true,
298
317
  "*": {
318
+ experimental: true,
299
319
  type: "*",
300
320
  doc: "The value of the property. It can be an expression that generates the returned value from the feature, or a constant value specifying the returned value."
301
321
  }
@@ -5101,7 +5121,8 @@
5101
5121
  "sdk-support": {
5102
5122
  "basic functionality": {
5103
5123
  android: "11.9.0",
5104
- ios: "11.9.0"
5124
+ ios: "11.9.0",
5125
+ js: "3.9.0"
5105
5126
  }
5106
5127
  }
5107
5128
  },
@@ -5125,7 +5146,8 @@
5125
5146
  "sdk-support": {
5126
5147
  "basic functionality": {
5127
5148
  android: "11.9.0",
5128
- ios: "11.9.0"
5149
+ ios: "11.9.0",
5150
+ js: "3.9.0"
5129
5151
  }
5130
5152
  }
5131
5153
  },
@@ -5147,7 +5169,8 @@
5147
5169
  "sdk-support": {
5148
5170
  "basic functionality": {
5149
5171
  android: "11.9.0",
5150
- ios: "11.9.0"
5172
+ ios: "11.9.0",
5173
+ js: "3.9.0"
5151
5174
  }
5152
5175
  }
5153
5176
  },
@@ -5171,7 +5194,8 @@
5171
5194
  "sdk-support": {
5172
5195
  "basic functionality": {
5173
5196
  android: "11.9.0",
5174
- ios: "11.9.0"
5197
+ ios: "11.9.0",
5198
+ js: "3.9.0"
5175
5199
  }
5176
5200
  }
5177
5201
  },
@@ -5207,7 +5231,8 @@
5207
5231
  "sdk-support": {
5208
5232
  "basic functionality": {
5209
5233
  android: "11.9.0",
5210
- ios: "11.9.0"
5234
+ ios: "11.9.0",
5235
+ js: "3.9.0"
5211
5236
  }
5212
5237
  }
5213
5238
  },
@@ -5229,7 +5254,8 @@
5229
5254
  "sdk-support": {
5230
5255
  "basic functionality": {
5231
5256
  android: "11.9.0",
5232
- ios: "11.9.0"
5257
+ ios: "11.9.0",
5258
+ js: "3.9.0"
5233
5259
  }
5234
5260
  }
5235
5261
  },
@@ -5253,7 +5279,8 @@
5253
5279
  "sdk-support": {
5254
5280
  "basic functionality": {
5255
5281
  android: "11.9.0",
5256
- ios: "11.9.0"
5282
+ ios: "11.9.0",
5283
+ js: "3.9.0"
5257
5284
  }
5258
5285
  }
5259
5286
  },
@@ -5286,7 +5313,8 @@
5286
5313
  "sdk-support": {
5287
5314
  "basic functionality": {
5288
5315
  android: "11.9.0",
5289
- ios: "11.9.0"
5316
+ ios: "11.9.0",
5317
+ js: "3.9.0"
5290
5318
  }
5291
5319
  }
5292
5320
  },
@@ -5310,7 +5338,8 @@
5310
5338
  "sdk-support": {
5311
5339
  "basic functionality": {
5312
5340
  android: "11.9.0",
5313
- ios: "11.9.0"
5341
+ ios: "11.9.0",
5342
+ js: "3.9.0"
5314
5343
  }
5315
5344
  }
5316
5345
  }
@@ -5348,7 +5377,8 @@
5348
5377
  "sdk-support": {
5349
5378
  "basic functionality": {
5350
5379
  android: "11.9.0",
5351
- ios: "11.9.0"
5380
+ ios: "11.9.0",
5381
+ js: "3.9.0"
5352
5382
  }
5353
5383
  }
5354
5384
  },
@@ -5372,7 +5402,8 @@
5372
5402
  "sdk-support": {
5373
5403
  "basic functionality": {
5374
5404
  android: "11.9.0",
5375
- ios: "11.9.0"
5405
+ ios: "11.9.0",
5406
+ js: "3.9.0"
5376
5407
  }
5377
5408
  }
5378
5409
  },
@@ -5407,7 +5438,8 @@
5407
5438
  "sdk-support": {
5408
5439
  "basic functionality": {
5409
5440
  android: "11.9.0",
5410
- ios: "11.9.0"
5441
+ ios: "11.9.0",
5442
+ js: "3.9.0"
5411
5443
  }
5412
5444
  }
5413
5445
  },
@@ -5444,7 +5476,8 @@
5444
5476
  "sdk-support": {
5445
5477
  "basic functionality": {
5446
5478
  android: "11.9.0",
5447
- ios: "11.9.0"
5479
+ ios: "11.9.0",
5480
+ js: "3.9.0"
5448
5481
  }
5449
5482
  }
5450
5483
  },
@@ -5480,7 +5513,8 @@
5480
5513
  "sdk-support": {
5481
5514
  "basic functionality": {
5482
5515
  android: "11.9.0",
5483
- ios: "11.9.0"
5516
+ ios: "11.9.0",
5517
+ js: "3.9.0"
5484
5518
  }
5485
5519
  }
5486
5520
  },
@@ -5515,7 +5549,8 @@
5515
5549
  "sdk-support": {
5516
5550
  "basic functionality": {
5517
5551
  android: "11.9.0",
5518
- ios: "11.9.0"
5552
+ ios: "11.9.0",
5553
+ js: "3.9.0"
5519
5554
  }
5520
5555
  }
5521
5556
  },
@@ -5539,7 +5574,8 @@
5539
5574
  "sdk-support": {
5540
5575
  "basic functionality": {
5541
5576
  android: "11.9.0",
5542
- ios: "11.9.0"
5577
+ ios: "11.9.0",
5578
+ js: "3.9.0"
5543
5579
  }
5544
5580
  }
5545
5581
  },
@@ -5572,7 +5608,8 @@
5572
5608
  "sdk-support": {
5573
5609
  "basic functionality": {
5574
5610
  android: "11.9.0",
5575
- ios: "11.9.0"
5611
+ ios: "11.9.0",
5612
+ js: "3.9.0"
5576
5613
  }
5577
5614
  }
5578
5615
  },
@@ -5605,7 +5642,8 @@
5605
5642
  "sdk-support": {
5606
5643
  "basic functionality": {
5607
5644
  android: "11.9.0",
5608
- ios: "11.9.0"
5645
+ ios: "11.9.0",
5646
+ js: "3.9.0"
5609
5647
  }
5610
5648
  }
5611
5649
  },
@@ -5629,7 +5667,8 @@
5629
5667
  "sdk-support": {
5630
5668
  "basic functionality": {
5631
5669
  android: "11.9.0",
5632
- ios: "11.9.0"
5670
+ ios: "11.9.0",
5671
+ js: "3.9.0"
5633
5672
  }
5634
5673
  }
5635
5674
  }
@@ -9271,8 +9310,8 @@
9271
9310
  };
9272
9311
  var promoteId = {
9273
9312
  "*": {
9274
- type: "string",
9275
- doc: "A name of a feature property to use as ID for feature state."
9313
+ type: "*",
9314
+ doc: "A feature property name to use as the ID, or an expression to evaluate as the ID for feature state."
9276
9315
  }
9277
9316
  };
9278
9317
  var v8 = {
@@ -12301,6 +12340,9 @@
12301
12340
  ]);
12302
12341
  }
12303
12342
  }
12343
+ static deserializeId(serialized) {
12344
+ return JSON.parse(serialized).id;
12345
+ }
12304
12346
  static deserializeFromString(serialized) {
12305
12347
  const deserializedObject = JSON.parse(serialized);
12306
12348
  ({ params: deserializedObject.options.params });
@@ -12775,7 +12817,7 @@
12775
12817
  }
12776
12818
 
12777
12819
  function isImageOptions(value) {
12778
- if (value !== null && typeof value === 'object') {
12820
+ if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
12779
12821
  return true;
12780
12822
  }
12781
12823
  return false;
@@ -19742,6 +19784,30 @@ ${ JSON.stringify(filterExp, null, 2) }
19742
19784
  return [];
19743
19785
  const useThemeMatch = propertyKey.match(/^(.*)-use-theme$/);
19744
19786
  if (propertyType === 'paint' && useThemeMatch && layerSpec[useThemeMatch[1]]) {
19787
+ if (isExpression(value)) {
19788
+ const errors2 = [];
19789
+ return errors2.concat(validate({
19790
+ key: options.key,
19791
+ value,
19792
+ valueSpec: {
19793
+ 'type': 'string',
19794
+ 'expression': {
19795
+ 'interpolated': false,
19796
+ 'parameters': [
19797
+ 'zoom',
19798
+ 'feature'
19799
+ ]
19800
+ },
19801
+ 'property-type': 'data-driven'
19802
+ },
19803
+ style,
19804
+ styleSpec,
19805
+ // @ts-expect-error - TS2353 - Object literal may only specify known properties, and 'expressionContext' does not exist in type 'ValidationOptions'.
19806
+ expressionContext: 'property',
19807
+ propertyType,
19808
+ propertyKey
19809
+ }));
19810
+ }
19745
19811
  return validate({
19746
19812
  key,
19747
19813
  value,
@@ -20071,10 +20137,37 @@ Use an identity property function instead: ${ example }.`)];
20071
20137
  key,
20072
20138
  value
20073
20139
  });
20140
+ } else if (Array.isArray(value)) {
20141
+ const errors = [];
20142
+ const unbundledValue = deepUnbundle(value);
20143
+ const expression = createExpression(unbundledValue);
20144
+ if (expression.result === 'error') {
20145
+ expression.value.forEach(err => {
20146
+ errors.push(new ValidationError(`${ key }${ err.key }`, null, `${ err.message }`));
20147
+ });
20148
+ }
20149
+ const parsed = expression.value.expression;
20150
+ const onlyFeatureDependent = isGlobalPropertyConstant(parsed, [
20151
+ 'zoom',
20152
+ 'heatmap-density',
20153
+ 'line-progress',
20154
+ 'raster-value',
20155
+ 'sky-radial-progress',
20156
+ 'accumulated',
20157
+ 'is-supported-script',
20158
+ 'pitch',
20159
+ 'distance-from-center',
20160
+ 'measure-light',
20161
+ 'raster-particle-speed'
20162
+ ]);
20163
+ if (!onlyFeatureDependent) {
20164
+ errors.push(new ValidationError(`${ key }`, null, 'promoteId expression should be only feature dependent'));
20165
+ }
20166
+ return errors;
20074
20167
  } else {
20075
20168
  const errors = [];
20076
20169
  for (const prop in value) {
20077
- errors.push(...validateString({
20170
+ errors.push(...validatePromoteId({
20078
20171
  key: `${ key }.${ prop }`,
20079
20172
  value: value[prop]
20080
20173
  }));
@@ -21612,7 +21705,8 @@ Use an identity property function instead: ${ example }.`)];
21612
21705
  const sourceKeys = [
21613
21706
  'type',
21614
21707
  'url',
21615
- 'tileSize'
21708
+ 'tileSize',
21709
+ 'promoteId'
21616
21710
  ];
21617
21711
  errors.push(...getAllowedKeyErrors(source, sourceKeys, 'source'));
21618
21712
  if (!acceptedSourceTypes.has(String(source.type))) {