@mapbox/mapbox-gl-style-spec 13.24.0-alpha.6 → 13.24.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/.eslintrc +10 -0
- package/CHANGELOG.md +10 -4
- package/bin/gl-style-composite.js +6 -2
- package/bin/gl-style-format.js +6 -2
- package/bin/gl-style-migrate.js +6 -2
- package/bin/gl-style-validate.js +5 -1
- package/dist/index.cjs +41 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +41 -23
- package/dist/index.es.js.map +1 -1
- package/expression/compound_expression.js +2 -2
- package/expression/definitions/assertion.js +3 -3
- package/expression/definitions/at.js +5 -5
- package/expression/definitions/case.js +4 -4
- package/expression/definitions/coalesce.js +4 -4
- package/expression/definitions/coercion.js +3 -3
- package/expression/definitions/collator.js +4 -4
- package/expression/definitions/comparison.js +22 -22
- package/expression/definitions/format.js +4 -4
- package/expression/definitions/image.js +4 -4
- package/expression/definitions/in.js +5 -5
- package/expression/definitions/index_of.js +5 -5
- package/expression/definitions/interpolate.js +6 -5
- package/expression/definitions/length.js +5 -5
- package/expression/definitions/let.js +5 -5
- package/expression/definitions/literal.js +5 -5
- package/expression/definitions/match.js +4 -4
- package/expression/definitions/number_format.js +4 -4
- package/expression/definitions/slice.js +5 -5
- package/expression/definitions/step.js +4 -4
- package/expression/definitions/var.js +4 -4
- package/expression/definitions/within.js +16 -8
- package/expression/evaluation_context.js +8 -8
- package/expression/expression.js +1 -1
- package/expression/index.js +4 -4
- package/expression/is_constant.js +3 -3
- package/expression/parsing_context.js +1 -1
- package/expression/runtime_error.js +1 -1
- package/expression/scope.js +1 -1
- package/expression/stops.js +1 -1
- package/expression/values.js +1 -1
- package/feature_filter/index.js +1 -1
- package/function/convert.js +4 -4
- package/migrate/expressions.js +1 -1
- package/package.json +1 -1
- package/reference/latest.js +4 -0
- package/reference/v8.json +1 -4
- package/types.js +1 -1
- package/validate/validate.js +13 -1
- package/validate/validate_array.js +10 -2
- package/validate/validate_boolean.js +4 -1
- package/validate/validate_color.js +4 -1
- package/validate/validate_enum.js +4 -1
- package/validate/validate_expression.js +5 -2
- package/validate/validate_filter.js +12 -4
- package/validate/validate_fog.js +4 -1
- package/validate/validate_formatted.js +5 -1
- package/validate/validate_function.js +24 -15
- package/validate/validate_glyphs_url.js +4 -1
- package/validate/validate_image.js +5 -1
- package/validate/validate_layer.js +15 -2
- package/validate/validate_layout_property.js +5 -1
- package/validate/validate_light.js +4 -1
- package/validate/validate_number.js +8 -1
- package/validate/validate_object.js +12 -2
- package/validate/validate_paint_property.js +5 -1
- package/validate/validate_projection.js +5 -1
- package/validate/validate_property.js +9 -1
- package/validate/validate_source.js +4 -1
- package/validate/validate_string.js +4 -1
- package/validate/validate_terrain.js +5 -2
- package/validate_style.min.js +1 -1
package/dist/index.es.js
CHANGED
|
@@ -95,7 +95,7 @@ var $root = {
|
|
|
95
95
|
},
|
|
96
96
|
projection: {
|
|
97
97
|
type: "projection",
|
|
98
|
-
doc: "The projection the map should be rendered in. Supported projections are Albers, Equal Earth, Equirectangular (WGS84), Lambert conformal conic, Mercator, Natural Earth,
|
|
98
|
+
doc: "The projection the map should be rendered in. Supported projections are Albers, Equal Earth, Equirectangular (WGS84), Lambert conformal conic, Mercator, Natural Earth, and Winkel Tripel. Terrain, fog, sky and CustomLayerInterface are not supported for projections other than mercator.",
|
|
99
99
|
example: {
|
|
100
100
|
name: "albers",
|
|
101
101
|
center: [
|
|
@@ -3916,9 +3916,6 @@ var projection = {
|
|
|
3916
3916
|
},
|
|
3917
3917
|
winkelTripel: {
|
|
3918
3918
|
doc: "A Winkel Tripel projection."
|
|
3919
|
-
},
|
|
3920
|
-
globe: {
|
|
3921
|
-
doc: "A globe projection."
|
|
3922
3919
|
}
|
|
3923
3920
|
},
|
|
3924
3921
|
"default": "mercator",
|
|
@@ -9272,7 +9269,7 @@ class EvaluationContext {
|
|
|
9272
9269
|
this.featureDistanceData = null;
|
|
9273
9270
|
}
|
|
9274
9271
|
id() {
|
|
9275
|
-
return this.feature && 'id' in this.feature ? this.feature.id : null;
|
|
9272
|
+
return this.feature && 'id' in this.feature && this.feature.id ? this.feature.id : null;
|
|
9276
9273
|
}
|
|
9277
9274
|
geometryType() {
|
|
9278
9275
|
return this.feature ? typeof this.feature.type === 'number' ? geometryTypes[this.feature.type] : this.feature.type : null;
|
|
@@ -9625,6 +9622,8 @@ function getTilePoints(geometry, pointBBox, polyBBox, canonical) {
|
|
|
9625
9622
|
canonical.y * EXTENT
|
|
9626
9623
|
];
|
|
9627
9624
|
const tilePoints = [];
|
|
9625
|
+
if (!geometry)
|
|
9626
|
+
return tilePoints;
|
|
9628
9627
|
for (const points of geometry) {
|
|
9629
9628
|
for (const point of points) {
|
|
9630
9629
|
const p = [
|
|
@@ -9644,6 +9643,8 @@ function getTileLines(geometry, lineBBox, polyBBox, canonical) {
|
|
|
9644
9643
|
canonical.y * EXTENT
|
|
9645
9644
|
];
|
|
9646
9645
|
const tileLines = [];
|
|
9646
|
+
if (!geometry)
|
|
9647
|
+
return tileLines;
|
|
9647
9648
|
for (const line of geometry) {
|
|
9648
9649
|
const tileLine = [];
|
|
9649
9650
|
for (const point of line) {
|
|
@@ -9680,6 +9681,9 @@ function pointsWithinPolygons(ctx, polygonGeometry) {
|
|
|
9680
9681
|
-Infinity
|
|
9681
9682
|
];
|
|
9682
9683
|
const canonical = ctx.canonicalID();
|
|
9684
|
+
if (!canonical) {
|
|
9685
|
+
return false;
|
|
9686
|
+
}
|
|
9683
9687
|
if (polygonGeometry.type === 'Polygon') {
|
|
9684
9688
|
const tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);
|
|
9685
9689
|
const tilePoints = getTilePoints(ctx.geometry(), pointBBox, polyBBox, canonical);
|
|
@@ -9716,6 +9720,9 @@ function linesWithinPolygons(ctx, polygonGeometry) {
|
|
|
9716
9720
|
-Infinity
|
|
9717
9721
|
];
|
|
9718
9722
|
const canonical = ctx.canonicalID();
|
|
9723
|
+
if (!canonical) {
|
|
9724
|
+
return false;
|
|
9725
|
+
}
|
|
9719
9726
|
if (polygonGeometry.type === 'Polygon') {
|
|
9720
9727
|
const tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);
|
|
9721
9728
|
const tileLines = getTileLines(ctx.geometry(), lineBBox, polyBBox, canonical);
|
|
@@ -12137,7 +12144,7 @@ class StyleExpression {
|
|
|
12137
12144
|
this._evaluator.globals = globals;
|
|
12138
12145
|
this._evaluator.feature = feature;
|
|
12139
12146
|
this._evaluator.featureState = featureState;
|
|
12140
|
-
this._evaluator.canonical = canonical;
|
|
12147
|
+
this._evaluator.canonical = canonical || null;
|
|
12141
12148
|
this._evaluator.availableImages = availableImages || null;
|
|
12142
12149
|
this._evaluator.formattedSection = formattedSection;
|
|
12143
12150
|
this._evaluator.featureTileCoord = featureTileCoord || null;
|
|
@@ -12148,7 +12155,7 @@ class StyleExpression {
|
|
|
12148
12155
|
this._evaluator.globals = globals;
|
|
12149
12156
|
this._evaluator.feature = feature || null;
|
|
12150
12157
|
this._evaluator.featureState = featureState || null;
|
|
12151
|
-
this._evaluator.canonical = canonical;
|
|
12158
|
+
this._evaluator.canonical = canonical || null;
|
|
12152
12159
|
this._evaluator.availableImages = availableImages || null;
|
|
12153
12160
|
this._evaluator.formattedSection = formattedSection || null;
|
|
12154
12161
|
this._evaluator.featureTileCoord = featureTileCoord || null;
|
|
@@ -13695,7 +13702,8 @@ function validateObject(options) {
|
|
|
13695
13702
|
validateElement = elementValidators['*'];
|
|
13696
13703
|
} else if (elementSpecs['*']) {
|
|
13697
13704
|
validateElement = validate;
|
|
13698
|
-
}
|
|
13705
|
+
}
|
|
13706
|
+
if (!validateElement) {
|
|
13699
13707
|
errors.push(new ValidationError(key, object[objectKey], `unknown property "${ objectKey }"`));
|
|
13700
13708
|
continue;
|
|
13701
13709
|
}
|
|
@@ -13740,7 +13748,8 @@ function validateArray(options) {
|
|
|
13740
13748
|
'type': arraySpec.value,
|
|
13741
13749
|
'values': arraySpec.values,
|
|
13742
13750
|
'minimum': arraySpec.minimum,
|
|
13743
|
-
'maximum': arraySpec.maximum
|
|
13751
|
+
'maximum': arraySpec.maximum,
|
|
13752
|
+
function: undefined
|
|
13744
13753
|
};
|
|
13745
13754
|
if (styleSpec.$version < 7) {
|
|
13746
13755
|
arrayElementSpec.function = arraySpec.function;
|
|
@@ -13877,11 +13886,15 @@ function validateFunction(options) {
|
|
|
13877
13886
|
if (value[0].value === undefined) {
|
|
13878
13887
|
return [new ValidationError(key, value, 'object stop key must have value')];
|
|
13879
13888
|
}
|
|
13880
|
-
|
|
13889
|
+
const nextStopDomainZoom = unbundle(value[0].zoom);
|
|
13890
|
+
if (typeof nextStopDomainZoom !== 'number') {
|
|
13891
|
+
return [new ValidationError(key, value[0].zoom, 'stop zoom values must be numbers')];
|
|
13892
|
+
}
|
|
13893
|
+
if (previousStopDomainZoom && previousStopDomainZoom > nextStopDomainZoom) {
|
|
13881
13894
|
return [new ValidationError(key, value[0].zoom, 'stop zoom values must appear in ascending order')];
|
|
13882
13895
|
}
|
|
13883
|
-
if (
|
|
13884
|
-
previousStopDomainZoom =
|
|
13896
|
+
if (nextStopDomainZoom !== previousStopDomainZoom) {
|
|
13897
|
+
previousStopDomainZoom = nextStopDomainZoom;
|
|
13885
13898
|
previousStopDomainValue = undefined;
|
|
13886
13899
|
stopDomainValues = {};
|
|
13887
13900
|
}
|
|
@@ -13925,7 +13938,7 @@ function validateFunction(options) {
|
|
|
13925
13938
|
} else if (type !== stopKeyType) {
|
|
13926
13939
|
return [new ValidationError(options.key, reportValue, `${ type } stop domain type must match previous stop domain type ${ stopKeyType }`)];
|
|
13927
13940
|
}
|
|
13928
|
-
if (type !== 'number' && type !== 'string' && type !== 'boolean') {
|
|
13941
|
+
if (type !== 'number' && type !== 'string' && type !== 'boolean' && typeof value !== 'number' && typeof value !== 'string' && typeof value !== 'boolean') {
|
|
13929
13942
|
return [new ValidationError(options.key, reportValue, 'stop domain value must be a number, string, or boolean')];
|
|
13930
13943
|
}
|
|
13931
13944
|
if (type !== 'number' && functionType !== 'categorical') {
|
|
@@ -13935,10 +13948,10 @@ function validateFunction(options) {
|
|
|
13935
13948
|
}
|
|
13936
13949
|
return [new ValidationError(options.key, reportValue, message)];
|
|
13937
13950
|
}
|
|
13938
|
-
if (functionType === 'categorical' && type === 'number' && (!isFinite(value) || Math.floor(value) !== value)) {
|
|
13939
|
-
return [new ValidationError(options.key, reportValue, `integer expected, found ${ value }`)];
|
|
13951
|
+
if (functionType === 'categorical' && type === 'number' && (typeof value !== 'number' || !isFinite(value) || Math.floor(value) !== value)) {
|
|
13952
|
+
return [new ValidationError(options.key, reportValue, `integer expected, found ${ String(value) }`)];
|
|
13940
13953
|
}
|
|
13941
|
-
if (functionType !== 'categorical' && type === 'number' && previousStopDomainValue !== undefined && value < previousStopDomainValue) {
|
|
13954
|
+
if (functionType !== 'categorical' && type === 'number' && typeof value === 'number' && typeof previousStopDomainValue === 'number' && previousStopDomainValue !== undefined && value < previousStopDomainValue) {
|
|
13942
13955
|
return [new ValidationError(options.key, reportValue, 'stop domain values must appear in ascending order')];
|
|
13943
13956
|
} else {
|
|
13944
13957
|
previousStopDomainValue = value;
|
|
@@ -13998,8 +14011,10 @@ function disallowedFilterParameters(e, options) {
|
|
|
13998
14011
|
'pitch',
|
|
13999
14012
|
'distance-from-center'
|
|
14000
14013
|
]);
|
|
14001
|
-
|
|
14002
|
-
|
|
14014
|
+
if (options.valueSpec && options.valueSpec.expression) {
|
|
14015
|
+
for (const param of options.valueSpec.expression.parameters) {
|
|
14016
|
+
disallowedParameters.delete(param);
|
|
14017
|
+
}
|
|
14003
14018
|
}
|
|
14004
14019
|
if (disallowedParameters.size === 0) {
|
|
14005
14020
|
return [];
|
|
@@ -14058,10 +14073,10 @@ function validateEnum(options) {
|
|
|
14058
14073
|
|
|
14059
14074
|
function validateFilter(options) {
|
|
14060
14075
|
if (isExpressionFilter(deepUnbundle(options.value))) {
|
|
14061
|
-
const layerType =
|
|
14076
|
+
const layerType = options.layerType || 'fill';
|
|
14062
14077
|
return validateExpression(extend({}, options, {
|
|
14063
14078
|
expressionContext: 'filter',
|
|
14064
|
-
valueSpec: options.styleSpec[`filter_${ layerType
|
|
14079
|
+
valueSpec: options.styleSpec[`filter_${ layerType }`]
|
|
14065
14080
|
}));
|
|
14066
14081
|
} else {
|
|
14067
14082
|
return validateNonExpressionFilter(options);
|
|
@@ -14249,7 +14264,8 @@ function validateLayer(options) {
|
|
|
14249
14264
|
parent = layer;
|
|
14250
14265
|
});
|
|
14251
14266
|
if (!parent) {
|
|
14252
|
-
|
|
14267
|
+
if (typeof ref === 'string')
|
|
14268
|
+
errors.push(new ValidationError(key, layer.ref, `ref layer "${ ref }" not found`));
|
|
14253
14269
|
} else if (parent.ref) {
|
|
14254
14270
|
errors.push(new ValidationError(key, layer.ref, 'ref cannot reference another ref layer'));
|
|
14255
14271
|
} else {
|
|
@@ -14305,6 +14321,7 @@ function validateLayer(options) {
|
|
|
14305
14321
|
layer,
|
|
14306
14322
|
key: options.key,
|
|
14307
14323
|
value: options.value,
|
|
14324
|
+
valueSpec: {},
|
|
14308
14325
|
style: options.style,
|
|
14309
14326
|
styleSpec: options.styleSpec,
|
|
14310
14327
|
objectElementValidators: {
|
|
@@ -14319,6 +14336,7 @@ function validateLayer(options) {
|
|
|
14319
14336
|
layer,
|
|
14320
14337
|
key: options.key,
|
|
14321
14338
|
value: options.value,
|
|
14339
|
+
valueSpec: {},
|
|
14322
14340
|
style: options.style,
|
|
14323
14341
|
styleSpec: options.styleSpec,
|
|
14324
14342
|
objectElementValidators: {
|
|
@@ -14537,7 +14555,7 @@ function validateTerrain(options) {
|
|
|
14537
14555
|
if (!source) {
|
|
14538
14556
|
errors.push(new ValidationError(key, terrain.source, `source "${ terrain.source }" not found`));
|
|
14539
14557
|
} else if (sourceType !== 'raster-dem') {
|
|
14540
|
-
errors.push(new ValidationError(key, terrain.source, `terrain cannot be used with a source of type ${ sourceType }, it only be used with a "raster-dem" source type`));
|
|
14558
|
+
errors.push(new ValidationError(key, terrain.source, `terrain cannot be used with a source of type ${ String(sourceType) }, it only be used with a "raster-dem" source type`));
|
|
14541
14559
|
}
|
|
14542
14560
|
}
|
|
14543
14561
|
return errors;
|
|
@@ -14686,7 +14704,7 @@ function validateStyle(style, styleSpec = v8) {
|
|
|
14686
14704
|
return sortErrors(errors);
|
|
14687
14705
|
}
|
|
14688
14706
|
function sortErrors(errors) {
|
|
14689
|
-
return errors.slice().sort((a, b) => a.line - b.line);
|
|
14707
|
+
return errors.slice().sort((a, b) => a.line && b.line ? a.line - b.line : 0);
|
|
14690
14708
|
}
|
|
14691
14709
|
|
|
14692
14710
|
/* parser generated by jison 0.4.15 */
|