@mapbox/mapbox-gl-style-spec 14.9.2 → 14.10.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 +101 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +28 -2
- package/dist/index.es.js +101 -4
- package/dist/index.es.js.map +1 -1
- package/group_by_layout.ts +9 -1
- package/package.json +1 -1
- package/reference/v8.json +47 -2
- package/types.ts +28 -2
- package/validate/validate_property.ts +25 -1
- package/validate/validate_source.ts +22 -2
- package/validate_mapbox_api_supported.ts +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -43,8 +43,8 @@ type ColorSpecification = string;
|
|
|
43
43
|
type FormattedSpecification = string;
|
|
44
44
|
type ResolvedImageSpecification = string;
|
|
45
45
|
type PromoteIdSpecification = {
|
|
46
|
-
[_: string]: string;
|
|
47
|
-
} | string;
|
|
46
|
+
[_: string]: string | ExpressionSpecification;
|
|
47
|
+
} | string | ExpressionSpecification;
|
|
48
48
|
type FilterSpecification = ExpressionSpecification | [
|
|
49
49
|
"has",
|
|
50
50
|
string
|
|
@@ -382,15 +382,37 @@ type FeaturesetsSpecification = {
|
|
|
382
382
|
[_: string]: FeaturesetSpecification;
|
|
383
383
|
};
|
|
384
384
|
type FeaturesetSpecification = {
|
|
385
|
+
/**
|
|
386
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
387
|
+
*/
|
|
385
388
|
"metadata"?: unknown;
|
|
389
|
+
/**
|
|
390
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
391
|
+
*/
|
|
386
392
|
"selectors"?: Array<SelectorSpecification>;
|
|
387
393
|
};
|
|
388
394
|
type SelectorSpecification = {
|
|
395
|
+
/**
|
|
396
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
397
|
+
*/
|
|
389
398
|
"layer": string;
|
|
399
|
+
/**
|
|
400
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
401
|
+
*/
|
|
390
402
|
"properties"?: SelectorPropertySpecification;
|
|
403
|
+
/**
|
|
404
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
405
|
+
*/
|
|
391
406
|
"featureNamespace"?: string;
|
|
407
|
+
/**
|
|
408
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
409
|
+
*/
|
|
410
|
+
"_uniqueFeatureID"?: boolean;
|
|
392
411
|
};
|
|
393
412
|
type SelectorPropertySpecification = {
|
|
413
|
+
/**
|
|
414
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
415
|
+
*/
|
|
394
416
|
[_: string]: unknown;
|
|
395
417
|
};
|
|
396
418
|
type VectorSourceSpecification = {
|
|
@@ -858,6 +880,10 @@ type CircleLayerSpecification = {
|
|
|
858
880
|
"filter"?: FilterSpecification;
|
|
859
881
|
"layout"?: {
|
|
860
882
|
"circle-sort-key"?: DataDrivenPropertyValueSpecification<number>;
|
|
883
|
+
/**
|
|
884
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
885
|
+
*/
|
|
886
|
+
"circle-elevation-reference"?: "none" | "hd-road-markup" | ExpressionSpecification;
|
|
861
887
|
"visibility"?: "visible" | "none" | ExpressionSpecification;
|
|
862
888
|
};
|
|
863
889
|
"paint"?: {
|
package/dist/index.es.js
CHANGED
|
@@ -228,6 +228,13 @@ var $root = {
|
|
|
228
228
|
experimental: true,
|
|
229
229
|
type: "featuresets",
|
|
230
230
|
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.",
|
|
231
|
+
"sdk-support": {
|
|
232
|
+
"basic functionality": {
|
|
233
|
+
js: "3.9.0",
|
|
234
|
+
android: "11.9.0",
|
|
235
|
+
ios: "11.9.0"
|
|
236
|
+
}
|
|
237
|
+
},
|
|
231
238
|
example: {
|
|
232
239
|
poi: {
|
|
233
240
|
selectors: [
|
|
@@ -260,10 +267,12 @@ var featuresets = {
|
|
|
260
267
|
var featureset = {
|
|
261
268
|
experimental: true,
|
|
262
269
|
metadata: {
|
|
270
|
+
experimental: true,
|
|
263
271
|
type: "*",
|
|
264
272
|
doc: "Arbitrary properties useful to track with the stylesheet, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."
|
|
265
273
|
},
|
|
266
274
|
selectors: {
|
|
275
|
+
experimental: true,
|
|
267
276
|
type: "array",
|
|
268
277
|
value: "selector",
|
|
269
278
|
doc: "A collection of categorized selectors."
|
|
@@ -272,24 +281,35 @@ var featureset = {
|
|
|
272
281
|
var selector = {
|
|
273
282
|
experimental: true,
|
|
274
283
|
layer: {
|
|
284
|
+
experimental: true,
|
|
275
285
|
type: "string",
|
|
276
286
|
doc: "The ID of a layer that exists in the current style.",
|
|
277
287
|
required: true
|
|
278
288
|
},
|
|
279
289
|
properties: {
|
|
290
|
+
experimental: true,
|
|
280
291
|
type: "selectorProperty",
|
|
281
292
|
required: false,
|
|
282
293
|
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."
|
|
283
294
|
},
|
|
284
295
|
featureNamespace: {
|
|
296
|
+
experimental: true,
|
|
285
297
|
type: "string",
|
|
286
298
|
required: false,
|
|
287
299
|
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."
|
|
300
|
+
},
|
|
301
|
+
_uniqueFeatureID: {
|
|
302
|
+
experimental: true,
|
|
303
|
+
type: "boolean",
|
|
304
|
+
"private": true,
|
|
305
|
+
required: false,
|
|
306
|
+
doc: "Internal flag used for standard style, in case multiple features sharing the same featureId, only one feature will be returned for feature query."
|
|
288
307
|
}
|
|
289
308
|
};
|
|
290
309
|
var selectorProperty = {
|
|
291
310
|
experimental: true,
|
|
292
311
|
"*": {
|
|
312
|
+
experimental: true,
|
|
293
313
|
type: "*",
|
|
294
314
|
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."
|
|
295
315
|
}
|
|
@@ -1670,6 +1690,31 @@ var layout_circle = {
|
|
|
1670
1690
|
},
|
|
1671
1691
|
"property-type": "data-driven"
|
|
1672
1692
|
},
|
|
1693
|
+
"circle-elevation-reference": {
|
|
1694
|
+
type: "enum",
|
|
1695
|
+
doc: "Selects the base of circle-elevation. Some modes might require precomputed elevation data in the tileset.",
|
|
1696
|
+
values: {
|
|
1697
|
+
none: {
|
|
1698
|
+
doc: "Elevated rendering is disabled."
|
|
1699
|
+
},
|
|
1700
|
+
"hd-road-markup": {
|
|
1701
|
+
doc: "Elevated rendering is enabled. Use this mode to describe additive and stackable features that should exist only on top of road polygons."
|
|
1702
|
+
}
|
|
1703
|
+
},
|
|
1704
|
+
"default": "none",
|
|
1705
|
+
experimental: true,
|
|
1706
|
+
transition: false,
|
|
1707
|
+
"sdk-support": {
|
|
1708
|
+
"basic functionality": {
|
|
1709
|
+
android: "11.11.0",
|
|
1710
|
+
ios: "11.11.0"
|
|
1711
|
+
}
|
|
1712
|
+
},
|
|
1713
|
+
expression: {
|
|
1714
|
+
interpolated: false
|
|
1715
|
+
},
|
|
1716
|
+
"property-type": "data-constant"
|
|
1717
|
+
},
|
|
1673
1718
|
visibility: {
|
|
1674
1719
|
type: "enum",
|
|
1675
1720
|
values: {
|
|
@@ -9284,8 +9329,8 @@ var transition = {
|
|
|
9284
9329
|
};
|
|
9285
9330
|
var promoteId = {
|
|
9286
9331
|
"*": {
|
|
9287
|
-
type: "
|
|
9288
|
-
doc: "A name
|
|
9332
|
+
type: "*",
|
|
9333
|
+
doc: "A feature property name to use as the ID, or an expression to evaluate as the ID for feature state."
|
|
9289
9334
|
}
|
|
9290
9335
|
};
|
|
9291
9336
|
var v8 = {
|
|
@@ -19758,6 +19803,30 @@ function validateProperty(options, propertyType) {
|
|
|
19758
19803
|
return [];
|
|
19759
19804
|
const useThemeMatch = propertyKey.match(/^(.*)-use-theme$/);
|
|
19760
19805
|
if (propertyType === 'paint' && useThemeMatch && layerSpec[useThemeMatch[1]]) {
|
|
19806
|
+
if (isExpression(value)) {
|
|
19807
|
+
const errors2 = [];
|
|
19808
|
+
return errors2.concat(validate({
|
|
19809
|
+
key: options.key,
|
|
19810
|
+
value,
|
|
19811
|
+
valueSpec: {
|
|
19812
|
+
'type': 'string',
|
|
19813
|
+
'expression': {
|
|
19814
|
+
'interpolated': false,
|
|
19815
|
+
'parameters': [
|
|
19816
|
+
'zoom',
|
|
19817
|
+
'feature'
|
|
19818
|
+
]
|
|
19819
|
+
},
|
|
19820
|
+
'property-type': 'data-driven'
|
|
19821
|
+
},
|
|
19822
|
+
style,
|
|
19823
|
+
styleSpec,
|
|
19824
|
+
// @ts-expect-error - TS2353 - Object literal may only specify known properties, and 'expressionContext' does not exist in type 'ValidationOptions'.
|
|
19825
|
+
expressionContext: 'property',
|
|
19826
|
+
propertyType,
|
|
19827
|
+
propertyKey
|
|
19828
|
+
}));
|
|
19829
|
+
}
|
|
19761
19830
|
return validate({
|
|
19762
19831
|
key,
|
|
19763
19832
|
value,
|
|
@@ -20087,10 +20156,37 @@ function validatePromoteId({key, value}) {
|
|
|
20087
20156
|
key,
|
|
20088
20157
|
value
|
|
20089
20158
|
});
|
|
20159
|
+
} else if (Array.isArray(value)) {
|
|
20160
|
+
const errors = [];
|
|
20161
|
+
const unbundledValue = deepUnbundle(value);
|
|
20162
|
+
const expression = createExpression(unbundledValue);
|
|
20163
|
+
if (expression.result === 'error') {
|
|
20164
|
+
expression.value.forEach(err => {
|
|
20165
|
+
errors.push(new ValidationError(`${ key }${ err.key }`, null, `${ err.message }`));
|
|
20166
|
+
});
|
|
20167
|
+
}
|
|
20168
|
+
const parsed = expression.value.expression;
|
|
20169
|
+
const onlyFeatureDependent = isGlobalPropertyConstant(parsed, [
|
|
20170
|
+
'zoom',
|
|
20171
|
+
'heatmap-density',
|
|
20172
|
+
'line-progress',
|
|
20173
|
+
'raster-value',
|
|
20174
|
+
'sky-radial-progress',
|
|
20175
|
+
'accumulated',
|
|
20176
|
+
'is-supported-script',
|
|
20177
|
+
'pitch',
|
|
20178
|
+
'distance-from-center',
|
|
20179
|
+
'measure-light',
|
|
20180
|
+
'raster-particle-speed'
|
|
20181
|
+
]);
|
|
20182
|
+
if (!onlyFeatureDependent) {
|
|
20183
|
+
errors.push(new ValidationError(`${ key }`, null, 'promoteId expression should be only feature dependent'));
|
|
20184
|
+
}
|
|
20185
|
+
return errors;
|
|
20090
20186
|
} else {
|
|
20091
20187
|
const errors = [];
|
|
20092
20188
|
for (const prop in value) {
|
|
20093
|
-
errors.push(...
|
|
20189
|
+
errors.push(...validatePromoteId({
|
|
20094
20190
|
key: `${ key }.${ prop }`,
|
|
20095
20191
|
value: value[prop]
|
|
20096
20192
|
}));
|
|
@@ -21628,7 +21724,8 @@ function getSourceErrors(source, i) {
|
|
|
21628
21724
|
const sourceKeys = [
|
|
21629
21725
|
'type',
|
|
21630
21726
|
'url',
|
|
21631
|
-
'tileSize'
|
|
21727
|
+
'tileSize',
|
|
21728
|
+
'promoteId'
|
|
21632
21729
|
];
|
|
21633
21730
|
errors.push(...getAllowedKeyErrors(source, sourceKeys, 'source'));
|
|
21634
21731
|
if (!acceptedSourceTypes.has(String(source.type))) {
|