@mapbox/mapbox-gl-style-spec 14.16.0 → 14.16.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 +31 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +48 -0
- package/dist/index.es.js +31 -27
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/reference/v8.json +4 -2
- package/types.ts +48 -0
- package/validate/validate_filter.ts +28 -17
- package/validate_mapbox_api_supported.ts +3 -6
package/package.json
CHANGED
package/reference/v8.json
CHANGED
|
@@ -1668,7 +1668,7 @@
|
|
|
1668
1668
|
"type": "array",
|
|
1669
1669
|
"value": "appearance",
|
|
1670
1670
|
"supported-layer-types": ["symbol"],
|
|
1671
|
-
"
|
|
1671
|
+
"experimental": true,
|
|
1672
1672
|
"doc": "Conditional styling applied to symbol layer features based on dynamic conditions. If multiple conditions are true, only the first matching appearance will be applied. Only properties marked with 'Works with appearances' are supported."
|
|
1673
1673
|
}
|
|
1674
1674
|
},
|
|
@@ -1677,7 +1677,7 @@
|
|
|
1677
1677
|
"type": "boolean",
|
|
1678
1678
|
"doc": "A boolean expression that determines when this appearance should be applied.",
|
|
1679
1679
|
"expression": {
|
|
1680
|
-
"interpolated":
|
|
1680
|
+
"interpolated": true,
|
|
1681
1681
|
"parameters": [
|
|
1682
1682
|
"zoom",
|
|
1683
1683
|
"pitch",
|
|
@@ -6610,6 +6610,8 @@
|
|
|
6610
6610
|
"indoor": {
|
|
6611
6611
|
"*": {
|
|
6612
6612
|
"type": "indoor_source",
|
|
6613
|
+
"private": true,
|
|
6614
|
+
"experimental": true,
|
|
6613
6615
|
"doc": "Specification of an indoor source - sourceId and sourceLayer required for vector source, for GeoJSON sourceLayers should be omitted."
|
|
6614
6616
|
}
|
|
6615
6617
|
},
|
package/types.ts
CHANGED
|
@@ -329,6 +329,9 @@ export type ImportSpecification = {
|
|
|
329
329
|
};
|
|
330
330
|
|
|
331
331
|
export type IndoorSpecification = {
|
|
332
|
+
/**
|
|
333
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
334
|
+
*/
|
|
332
335
|
[_: string]: IndoorSourceSpecification
|
|
333
336
|
};
|
|
334
337
|
|
|
@@ -668,6 +671,9 @@ export type FillLayerSpecification = {
|
|
|
668
671
|
"fill-tunnel-structure-color-transition"?: TransitionSpecification,
|
|
669
672
|
"fill-tunnel-structure-color-use-theme"?: PropertyValueSpecification<string>
|
|
670
673
|
},
|
|
674
|
+
/**
|
|
675
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
676
|
+
*/
|
|
671
677
|
"appearances"?: Array<AppearanceSpecification>
|
|
672
678
|
};
|
|
673
679
|
|
|
@@ -758,6 +764,9 @@ export type LineLayerSpecification = {
|
|
|
758
764
|
"line-occlusion-opacity"?: PropertyValueSpecification<number>,
|
|
759
765
|
"line-occlusion-opacity-transition"?: TransitionSpecification
|
|
760
766
|
},
|
|
767
|
+
/**
|
|
768
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
769
|
+
*/
|
|
761
770
|
"appearances"?: Array<AppearanceSpecification>
|
|
762
771
|
};
|
|
763
772
|
|
|
@@ -889,6 +898,9 @@ export type SymbolLayerSpecification = {
|
|
|
889
898
|
"symbol-z-offset"?: DataDrivenPropertyValueSpecification<number>,
|
|
890
899
|
"symbol-z-offset-transition"?: TransitionSpecification
|
|
891
900
|
},
|
|
901
|
+
/**
|
|
902
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
903
|
+
*/
|
|
892
904
|
"appearances"?: Array<AppearanceSpecification>
|
|
893
905
|
};
|
|
894
906
|
|
|
@@ -945,6 +957,9 @@ export type CircleLayerSpecification = {
|
|
|
945
957
|
"circle-emissive-strength"?: PropertyValueSpecification<number>,
|
|
946
958
|
"circle-emissive-strength-transition"?: TransitionSpecification
|
|
947
959
|
},
|
|
960
|
+
/**
|
|
961
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
962
|
+
*/
|
|
948
963
|
"appearances"?: Array<AppearanceSpecification>
|
|
949
964
|
};
|
|
950
965
|
|
|
@@ -982,6 +997,9 @@ export type HeatmapLayerSpecification = {
|
|
|
982
997
|
"heatmap-opacity"?: PropertyValueSpecification<number>,
|
|
983
998
|
"heatmap-opacity-transition"?: TransitionSpecification
|
|
984
999
|
},
|
|
1000
|
+
/**
|
|
1001
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
1002
|
+
*/
|
|
985
1003
|
"appearances"?: Array<AppearanceSpecification>
|
|
986
1004
|
};
|
|
987
1005
|
|
|
@@ -1100,6 +1118,9 @@ export type FillExtrusionLayerSpecification = {
|
|
|
1100
1118
|
"fill-extrusion-line-width-transition"?: TransitionSpecification,
|
|
1101
1119
|
"fill-extrusion-cast-shadows"?: boolean
|
|
1102
1120
|
},
|
|
1121
|
+
/**
|
|
1122
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
1123
|
+
*/
|
|
1103
1124
|
"appearances"?: Array<AppearanceSpecification>
|
|
1104
1125
|
};
|
|
1105
1126
|
|
|
@@ -1237,6 +1258,9 @@ export type BuildingLayerSpecification = {
|
|
|
1237
1258
|
"building-flood-light-ground-attenuation"?: PropertyValueSpecification<number>,
|
|
1238
1259
|
"building-flood-light-ground-attenuation-transition"?: TransitionSpecification
|
|
1239
1260
|
},
|
|
1261
|
+
/**
|
|
1262
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
1263
|
+
*/
|
|
1240
1264
|
"appearances"?: Array<AppearanceSpecification>
|
|
1241
1265
|
};
|
|
1242
1266
|
|
|
@@ -1296,6 +1320,9 @@ export type RasterLayerSpecification = {
|
|
|
1296
1320
|
"raster-elevation"?: PropertyValueSpecification<number>,
|
|
1297
1321
|
"raster-elevation-transition"?: TransitionSpecification
|
|
1298
1322
|
},
|
|
1323
|
+
/**
|
|
1324
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
1325
|
+
*/
|
|
1299
1326
|
"appearances"?: Array<AppearanceSpecification>
|
|
1300
1327
|
};
|
|
1301
1328
|
|
|
@@ -1336,6 +1363,9 @@ export type RasterParticleLayerSpecification = {
|
|
|
1336
1363
|
"raster-particle-elevation"?: PropertyValueSpecification<number>,
|
|
1337
1364
|
"raster-particle-elevation-transition"?: TransitionSpecification
|
|
1338
1365
|
},
|
|
1366
|
+
/**
|
|
1367
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
1368
|
+
*/
|
|
1339
1369
|
"appearances"?: Array<AppearanceSpecification>
|
|
1340
1370
|
};
|
|
1341
1371
|
|
|
@@ -1379,6 +1409,9 @@ export type HillshadeLayerSpecification = {
|
|
|
1379
1409
|
"hillshade-emissive-strength"?: PropertyValueSpecification<number>,
|
|
1380
1410
|
"hillshade-emissive-strength-transition"?: TransitionSpecification
|
|
1381
1411
|
},
|
|
1412
|
+
/**
|
|
1413
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
1414
|
+
*/
|
|
1382
1415
|
"appearances"?: Array<AppearanceSpecification>
|
|
1383
1416
|
};
|
|
1384
1417
|
|
|
@@ -1438,6 +1471,9 @@ export type ModelLayerSpecification = {
|
|
|
1438
1471
|
*/
|
|
1439
1472
|
"model-elevation-reference"?: "sea" | "ground" | "hd-road-markup" | ExpressionSpecification
|
|
1440
1473
|
},
|
|
1474
|
+
/**
|
|
1475
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
1476
|
+
*/
|
|
1441
1477
|
"appearances"?: Array<AppearanceSpecification>
|
|
1442
1478
|
};
|
|
1443
1479
|
|
|
@@ -1478,6 +1514,9 @@ export type BackgroundLayerSpecification = {
|
|
|
1478
1514
|
"background-emissive-strength"?: PropertyValueSpecification<number>,
|
|
1479
1515
|
"background-emissive-strength-transition"?: TransitionSpecification
|
|
1480
1516
|
},
|
|
1517
|
+
/**
|
|
1518
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
1519
|
+
*/
|
|
1481
1520
|
"appearances"?: Array<AppearanceSpecification>
|
|
1482
1521
|
};
|
|
1483
1522
|
|
|
@@ -1519,6 +1558,9 @@ export type SkyLayerSpecification = {
|
|
|
1519
1558
|
"sky-opacity"?: PropertyValueSpecification<number>,
|
|
1520
1559
|
"sky-opacity-transition"?: TransitionSpecification
|
|
1521
1560
|
},
|
|
1561
|
+
/**
|
|
1562
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
1563
|
+
*/
|
|
1522
1564
|
"appearances"?: Array<AppearanceSpecification>
|
|
1523
1565
|
};
|
|
1524
1566
|
|
|
@@ -1542,6 +1584,9 @@ export type SlotLayerSpecification = {
|
|
|
1542
1584
|
"minzoom"?: never,
|
|
1543
1585
|
"maxzoom"?: never,
|
|
1544
1586
|
"filter"?: never,
|
|
1587
|
+
/**
|
|
1588
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
1589
|
+
*/
|
|
1545
1590
|
"appearances"?: Array<AppearanceSpecification>,
|
|
1546
1591
|
"layout"?: never,
|
|
1547
1592
|
"paint"?: never
|
|
@@ -1561,6 +1606,9 @@ export type ClipLayerSpecification = {
|
|
|
1561
1606
|
"clip-layer-types"?: ExpressionSpecification,
|
|
1562
1607
|
"clip-layer-scope"?: ExpressionSpecification
|
|
1563
1608
|
},
|
|
1609
|
+
/**
|
|
1610
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
1611
|
+
*/
|
|
1564
1612
|
"appearances"?: Array<AppearanceSpecification>,
|
|
1565
1613
|
"paint"?: never
|
|
1566
1614
|
};
|
|
@@ -55,23 +55,7 @@ function validateNonExpressionFilter(options: FilterValidatorOptions): Validatio
|
|
|
55
55
|
valueSpec: styleSpec.filter_operator
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
case '<':
|
|
60
|
-
case '<=':
|
|
61
|
-
case '>':
|
|
62
|
-
case '>=':
|
|
63
|
-
if (value.length >= 2 && unbundle(value[1]) === '$type') {
|
|
64
|
-
errors.push(new ValidationError(key, value, `"$type" cannot be use with operator "${value[0]}"`));
|
|
65
|
-
}
|
|
66
|
-
/* falls through */
|
|
67
|
-
case '==':
|
|
68
|
-
case '!=':
|
|
69
|
-
if (value.length !== 3) {
|
|
70
|
-
errors.push(new ValidationError(key, value, `filter array for operator "${value[0]}" must have 3 elements`));
|
|
71
|
-
}
|
|
72
|
-
/* falls through */
|
|
73
|
-
case 'in':
|
|
74
|
-
case '!in':
|
|
58
|
+
const validate = () => {
|
|
75
59
|
if (value.length >= 2) {
|
|
76
60
|
if (!isString(value[1])) {
|
|
77
61
|
errors.push(new ValidationError(`${key}[1]`, value[1], `string expected, ${getType(value[1])} found`));
|
|
@@ -89,6 +73,33 @@ function validateNonExpressionFilter(options: FilterValidatorOptions): Validatio
|
|
|
89
73
|
errors.push(new ValidationError(`${key}[${i}]`, value[i], `string, number, or boolean expected, ${getType(value[i])} found.`));
|
|
90
74
|
}
|
|
91
75
|
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
switch (unbundle(value[0])) {
|
|
79
|
+
case '<':
|
|
80
|
+
case '<=':
|
|
81
|
+
case '>':
|
|
82
|
+
case '>=':
|
|
83
|
+
if (value.length >= 2 && unbundle(value[1]) === '$type') {
|
|
84
|
+
errors.push(new ValidationError(key, value, `"$type" cannot be use with operator "${value[0]}"`));
|
|
85
|
+
}
|
|
86
|
+
if (value.length !== 3) {
|
|
87
|
+
errors.push(new ValidationError(key, value, `filter array for operator "${value[0]}" must have 3 elements`));
|
|
88
|
+
}
|
|
89
|
+
validate();
|
|
90
|
+
break;
|
|
91
|
+
|
|
92
|
+
case '==':
|
|
93
|
+
case '!=':
|
|
94
|
+
if (value.length !== 3) {
|
|
95
|
+
errors.push(new ValidationError(key, value, `filter array for operator "${value[0]}" must have 3 elements`));
|
|
96
|
+
}
|
|
97
|
+
validate();
|
|
98
|
+
break;
|
|
99
|
+
|
|
100
|
+
case 'in':
|
|
101
|
+
case '!in':
|
|
102
|
+
validate();
|
|
92
103
|
break;
|
|
93
104
|
|
|
94
105
|
case 'any':
|
|
@@ -108,10 +108,9 @@ function getSourcesErrors(sources: SourcesSpecification): {
|
|
|
108
108
|
return {errors, sourcesCount};
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
function getImportErrors(imports: ImportSpecification[] = []):
|
|
111
|
+
function getImportErrors(imports: ImportSpecification[] = []): Array<ValidationError> {
|
|
112
112
|
let errors: Array<ValidationError> = [];
|
|
113
113
|
|
|
114
|
-
let sourcesCount = 0;
|
|
115
114
|
const validateImports = (imports: ImportSpecification[] = []) => {
|
|
116
115
|
for (const importSpec of imports) {
|
|
117
116
|
const style = importSpec.data;
|
|
@@ -125,7 +124,6 @@ function getImportErrors(imports: ImportSpecification[] = []): {errors: Array<Va
|
|
|
125
124
|
|
|
126
125
|
if (style.sources) {
|
|
127
126
|
const sourcesErrors = getSourcesErrors(style.sources);
|
|
128
|
-
sourcesCount += sourcesErrors.sourcesCount;
|
|
129
127
|
errors = errors.concat(sourcesErrors.errors);
|
|
130
128
|
}
|
|
131
129
|
}
|
|
@@ -136,7 +134,7 @@ function getImportErrors(imports: ImportSpecification[] = []): {errors: Array<Va
|
|
|
136
134
|
errors.push(new ValidationError(null, null, 'Duplicate ids of imports'));
|
|
137
135
|
}
|
|
138
136
|
|
|
139
|
-
return
|
|
137
|
+
return errors;
|
|
140
138
|
}
|
|
141
139
|
|
|
142
140
|
function getRootErrors(style: MapboxStyleSpecification, specKeys: string[]): Array<ValidationError> {
|
|
@@ -238,8 +236,7 @@ export default function validateMapboxApiSupported(style: MapboxStyleSpecificati
|
|
|
238
236
|
|
|
239
237
|
if (s.imports) {
|
|
240
238
|
const importsErrors = getImportErrors(s.imports);
|
|
241
|
-
|
|
242
|
-
errors = errors.concat(importsErrors.errors);
|
|
239
|
+
errors = errors.concat(importsErrors);
|
|
243
240
|
}
|
|
244
241
|
|
|
245
242
|
errors = errors.concat(getMaxSourcesErrors(sourcesCount));
|