@mapbox/mapbox-gl-style-spec 14.9.2 → 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
  }
@@ -9290,8 +9310,8 @@
9290
9310
  };
9291
9311
  var promoteId = {
9292
9312
  "*": {
9293
- type: "string",
9294
- 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."
9295
9315
  }
9296
9316
  };
9297
9317
  var v8 = {
@@ -19764,6 +19784,30 @@ ${ JSON.stringify(filterExp, null, 2) }
19764
19784
  return [];
19765
19785
  const useThemeMatch = propertyKey.match(/^(.*)-use-theme$/);
19766
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
+ }
19767
19811
  return validate({
19768
19812
  key,
19769
19813
  value,
@@ -20093,10 +20137,37 @@ Use an identity property function instead: ${ example }.`)];
20093
20137
  key,
20094
20138
  value
20095
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;
20096
20167
  } else {
20097
20168
  const errors = [];
20098
20169
  for (const prop in value) {
20099
- errors.push(...validateString({
20170
+ errors.push(...validatePromoteId({
20100
20171
  key: `${ key }.${ prop }`,
20101
20172
  value: value[prop]
20102
20173
  }));
@@ -21634,7 +21705,8 @@ Use an identity property function instead: ${ example }.`)];
21634
21705
  const sourceKeys = [
21635
21706
  'type',
21636
21707
  'url',
21637
- 'tileSize'
21708
+ 'tileSize',
21709
+ 'promoteId'
21638
21710
  ];
21639
21711
  errors.push(...getAllowedKeyErrors(source, sourceKeys, 'source'));
21640
21712
  if (!acceptedSourceTypes.has(String(source.type))) {