@mapbox/mapbox-gl-style-spec 13.24.0-alpha.2 → 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 +15 -3
- package/bin/gl-style-composite.js +25 -0
- package/bin/gl-style-format.js +30 -0
- package/bin/gl-style-migrate.js +25 -0
- package/bin/{gl-style-validate → gl-style-validate.js} +19 -12
- package/build/.gitkeep +0 -0
- package/deref.js +8 -7
- package/diff.js +11 -6
- package/dist/index.cjs +55 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +55 -76
- package/dist/index.es.js.map +1 -1
- package/empty.js +9 -28
- 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 +11 -9
- 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 +6 -6
- 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 +9 -9
- package/expression/expression.js +1 -1
- package/expression/index.js +7 -7
- 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/convert.js +1 -1
- package/feature_filter/index.js +2 -2
- package/flow-typed/gl-matrix.js +103 -0
- package/flow-typed/grid-index.js +13 -0
- package/flow-typed/pbf.js +2 -1
- package/flow-typed/point-geometry.js +4 -2
- package/flow-typed/potpack.js +1 -0
- package/flow-typed/tiny-sdf.js +31 -0
- package/flow-typed/vector-tile.js +1 -0
- package/function/convert.js +4 -4
- package/group_by_layout.js +8 -10
- package/migrate/expressions.js +1 -1
- package/package.json +9 -7
- package/reference/latest.js +4 -0
- package/reference/v8.json +1 -4
- package/style-spec.js +6 -3
- package/test.js +31 -0
- package/types.js +1 -1
- package/util/color_spaces.js +2 -2
- package/util/extend.js +1 -1
- package/util/interpolate.js +2 -2
- package/util/ref_properties.js +1 -1
- package/util/unbundle_jsonlint.js +1 -1
- package/validate/validate.js +13 -3
- 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_mapbox_api_supported.js +8 -6
- package/validate_style.js +14 -9
- package/validate_style.min.js +32 -47
- package/bin/gl-style-composite +0 -9
- package/bin/gl-style-format +0 -22
- package/bin/gl-style-migrate +0 -9
- package/declass.js +0 -42
- package/validate/latest.js +0 -11
- package/validate/validate_constants.js +0 -13
package/.eslintrc
ADDED
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
## 13.24.0-beta.1
|
|
2
|
+
### 🐞 Bug fixes
|
|
3
|
+
|
|
4
|
+
* Fix error on `gl-style-validate` script. ([#11538](https://github.com/mapbox/mapbox-gl-js/pull/11538))
|
|
5
|
+
* Allow the second argument to the `in` expression operator to be an empty string. ([#11547](https://github.com/mapbox/mapbox-gl-js/pull/11547))
|
|
6
|
+
* Fix error on some valid `filter` expressions. ([#11475](https://github.com/mapbox/mapbox-gl-js/pull/11475))
|
|
7
|
+
|
|
8
|
+
## 13.23.1
|
|
9
|
+
### ✨ Features and improvements
|
|
10
|
+
|
|
11
|
+
* Improve `coalesce` expressions to return a `ResolvedImage` when images are missing. ([#11371](https://github.com/mapbox/mapbox-gl-js/pull/11371))
|
|
12
|
+
|
|
13
|
+
## 13.23.0
|
|
2
14
|
|
|
3
15
|
### ✨ Features and improvements
|
|
4
16
|
|
|
5
17
|
* Add a `projection` root property that allows a non-mercator projection to be set as a style's default projection. ([#11124](https://github.com/mapbox/mapbox-gl-js/pull/11124))
|
|
6
18
|
* Add support for using `["pitch"]` and `["distance-from-camera"]` expressions within the `filter` of a symbol layer. ([#10795](https://github.com/mapbox/mapbox-gl-js/pull/10795))
|
|
7
19
|
|
|
8
|
-
|
|
20
|
+
## 13.22.0
|
|
9
21
|
|
|
10
22
|
### ✨ Features and improvements
|
|
11
23
|
|
|
12
24
|
* Added `protected` field to mapbox-api-supported validation. ([#10968](https://github.com/mapbox/mapbox-gl-js/pull/10968))
|
|
13
25
|
|
|
14
|
-
|
|
26
|
+
## 13.21.0
|
|
15
27
|
|
|
16
28
|
### ✨ Features and improvements
|
|
17
29
|
* Add support for `text-writing-mode` property when using `symbol-placement: line` text labels. ([#10647](https://github.com/mapbox/mapbox-gl-js/pull/10647))
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// @flow
|
|
4
|
+
/* eslint-disable no-process-exit */
|
|
5
|
+
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import minimist from 'minimist';
|
|
8
|
+
|
|
9
|
+
/* eslint import/no-unresolved: [error, { ignore: ['^@mapbox/mapbox-gl-style-spec$'] }] */
|
|
10
|
+
/* $FlowFixMe[cannot-resolve-module] */
|
|
11
|
+
import {format, composite} from '@mapbox/mapbox-gl-style-spec';
|
|
12
|
+
|
|
13
|
+
const argv = minimist(process.argv.slice(2));
|
|
14
|
+
|
|
15
|
+
if (argv.help || argv.h || (!argv._.length && process.stdin.isTTY)) {
|
|
16
|
+
help();
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
console.log(format(composite(JSON.parse(fs.readFileSync(argv._[0]).toString()))));
|
|
21
|
+
|
|
22
|
+
function help() {
|
|
23
|
+
console.log('usage:');
|
|
24
|
+
console.log(' gl-style-composite style.json');
|
|
25
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// @flow
|
|
4
|
+
/* eslint-disable no-process-exit */
|
|
5
|
+
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import minimist from 'minimist';
|
|
8
|
+
|
|
9
|
+
/* eslint import/no-unresolved: [error, { ignore: ['^@mapbox/mapbox-gl-style-spec$'] }] */
|
|
10
|
+
/* $FlowFixMe[cannot-resolve-module] */
|
|
11
|
+
import {format} from '@mapbox/mapbox-gl-style-spec';
|
|
12
|
+
|
|
13
|
+
const argv = minimist(process.argv.slice(2));
|
|
14
|
+
|
|
15
|
+
if (argv.help || argv.h || (!argv._.length && process.stdin.isTTY)) {
|
|
16
|
+
help();
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
console.log(format(JSON.parse(fs.readFileSync(argv._[0]).toString()), argv.space));
|
|
21
|
+
|
|
22
|
+
function help() {
|
|
23
|
+
console.log('usage:');
|
|
24
|
+
console.log(' gl-style-format source.json > destination.json');
|
|
25
|
+
console.log('');
|
|
26
|
+
console.log('options:');
|
|
27
|
+
console.log(' --space <num>');
|
|
28
|
+
console.log(' Number of spaces in output (default "2")');
|
|
29
|
+
console.log(' Pass "0" for minified output.');
|
|
30
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// @flow
|
|
4
|
+
/* eslint-disable no-process-exit */
|
|
5
|
+
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import minimist from 'minimist';
|
|
8
|
+
|
|
9
|
+
/* eslint import/no-unresolved: [error, { ignore: ['^@mapbox/mapbox-gl-style-spec$'] }] */
|
|
10
|
+
/* $FlowFixMe[cannot-resolve-module] */
|
|
11
|
+
import {format, migrate} from '@mapbox/mapbox-gl-style-spec';
|
|
12
|
+
|
|
13
|
+
const argv = minimist(process.argv.slice(2));
|
|
14
|
+
|
|
15
|
+
if (argv.help || argv.h || (!argv._.length && process.stdin.isTTY)) {
|
|
16
|
+
help();
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
console.log(format(migrate(JSON.parse(fs.readFileSync(argv._[0]).toString()))));
|
|
21
|
+
|
|
22
|
+
function help() {
|
|
23
|
+
console.log('usage:');
|
|
24
|
+
console.log(' gl-style-migrate source.json > destination.json');
|
|
25
|
+
}
|
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
// @flow
|
|
4
|
+
/* eslint-disable no-process-exit */
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
import rw from 'rw';
|
|
7
|
+
import minimist from 'minimist';
|
|
8
|
+
|
|
9
|
+
/* eslint import/no-unresolved: [error, { ignore: ['^@mapbox/mapbox-gl-style-spec$'] }] */
|
|
10
|
+
/* $FlowFixMe[cannot-resolve-module] */
|
|
11
|
+
import {validate, validateMapboxApiSupported} from '@mapbox/mapbox-gl-style-spec';
|
|
12
|
+
|
|
13
|
+
const argv = minimist(process.argv.slice(2), {
|
|
14
|
+
boolean: ['json', 'mapbox-api-supported'],
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
let status = 0;
|
|
12
18
|
|
|
13
19
|
if (argv.help || argv.h || (!argv._.length && process.stdin.isTTY)) {
|
|
14
|
-
|
|
20
|
+
help();
|
|
21
|
+
process.exit(status);
|
|
15
22
|
}
|
|
16
23
|
|
|
17
24
|
if (!argv._.length) {
|
|
18
25
|
argv._.push('/dev/stdin');
|
|
19
26
|
}
|
|
20
27
|
|
|
21
|
-
argv._.forEach(
|
|
22
|
-
|
|
28
|
+
argv._.forEach((file) => {
|
|
29
|
+
let errors = [];
|
|
23
30
|
if (argv['mapbox-api-supported']) {
|
|
24
31
|
errors = validateMapboxApiSupported(rw.readFileSync(file, 'utf8'));
|
|
25
32
|
} else {
|
|
@@ -29,7 +36,7 @@ argv._.forEach(function(file) {
|
|
|
29
36
|
if (argv.json) {
|
|
30
37
|
process.stdout.write(JSON.stringify(errors, null, 2));
|
|
31
38
|
} else {
|
|
32
|
-
errors.forEach(
|
|
39
|
+
errors.forEach((e) => {
|
|
33
40
|
console.log('%s:%d: %s', file, e.line, e.message);
|
|
34
41
|
});
|
|
35
42
|
}
|
package/build/.gitkeep
ADDED
|
File without changes
|
package/deref.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
|
|
2
3
|
import refProperties from './util/ref_properties.js';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
import type {LayerSpecification} from './types.js';
|
|
6
|
+
|
|
7
|
+
function deref(layer: LayerSpecification, parent: LayerSpecification): LayerSpecification {
|
|
5
8
|
const result = {};
|
|
6
9
|
|
|
7
10
|
for (const k in layer) {
|
|
@@ -12,15 +15,13 @@ function deref(layer, parent) {
|
|
|
12
15
|
|
|
13
16
|
refProperties.forEach((k) => {
|
|
14
17
|
if (k in parent) {
|
|
15
|
-
result[k] = parent[k];
|
|
18
|
+
result[k] = (parent: any)[k];
|
|
16
19
|
}
|
|
17
20
|
});
|
|
18
21
|
|
|
19
|
-
return result;
|
|
22
|
+
return ((result: any): LayerSpecification);
|
|
20
23
|
}
|
|
21
24
|
|
|
22
|
-
export default derefLayers;
|
|
23
|
-
|
|
24
25
|
/**
|
|
25
26
|
* Given an array of layers, some of which may contain `ref` properties
|
|
26
27
|
* whose value is the `id` of another property, return a new array where
|
|
@@ -34,7 +35,7 @@ export default derefLayers;
|
|
|
34
35
|
* @param {Array<Layer>} layers
|
|
35
36
|
* @returns {Array<Layer>}
|
|
36
37
|
*/
|
|
37
|
-
function derefLayers(layers) {
|
|
38
|
+
export default function derefLayers(layers: Array<LayerSpecification>): Array<LayerSpecification> {
|
|
38
39
|
layers = layers.slice();
|
|
39
40
|
|
|
40
41
|
const map = Object.create(null);
|
|
@@ -44,7 +45,7 @@ function derefLayers(layers) {
|
|
|
44
45
|
|
|
45
46
|
for (let i = 0; i < layers.length; i++) {
|
|
46
47
|
if ('ref' in layers[i]) {
|
|
47
|
-
layers[i] = deref(layers[i], map[layers[i].ref]);
|
|
48
|
+
layers[i] = deref(layers[i], map[(layers[i]: any).ref]);
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
|
package/diff.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
|
|
2
3
|
import isEqual from './util/deep_equal.js';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
import type {StyleSpecification} from './types.js';
|
|
6
|
+
|
|
7
|
+
type Command = {
|
|
8
|
+
command: string;
|
|
9
|
+
args: Array<any>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const operations: {[_: string]: string} = {
|
|
5
13
|
|
|
6
14
|
/*
|
|
7
15
|
* { command: 'setStyle', args: [stylesheet] }
|
|
@@ -330,7 +338,7 @@ function diffLayers(before, after, commands) {
|
|
|
330
338
|
* @param {*} after stylesheet to compare to
|
|
331
339
|
* @returns Array list of changes
|
|
332
340
|
*/
|
|
333
|
-
function diffStyles(before, after) {
|
|
341
|
+
export default function diffStyles(before: StyleSpecification, after: StyleSpecification): Array<Command> {
|
|
334
342
|
if (!before) return [{command: operations.setStyle, args: [after]}];
|
|
335
343
|
|
|
336
344
|
let commands = [];
|
|
@@ -388,7 +396,7 @@ function diffStyles(before, after) {
|
|
|
388
396
|
const beforeLayers = [];
|
|
389
397
|
if (before.layers) {
|
|
390
398
|
before.layers.forEach((layer) => {
|
|
391
|
-
if (sourcesRemoved[layer.source]) {
|
|
399
|
+
if (layer.source && sourcesRemoved[layer.source]) {
|
|
392
400
|
commands.push({command: operations.removeLayer, args: [layer.id]});
|
|
393
401
|
} else {
|
|
394
402
|
beforeLayers.push(layer);
|
|
@@ -424,6 +432,3 @@ function diffStyles(before, after) {
|
|
|
424
432
|
|
|
425
433
|
return commands;
|
|
426
434
|
}
|
|
427
|
-
|
|
428
|
-
export default diffStyles;
|
|
429
|
-
export {operations};
|
package/dist/index.cjs
CHANGED
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
},
|
|
102
102
|
projection: {
|
|
103
103
|
type: "projection",
|
|
104
|
-
doc: "The projection the map should be rendered in. Supported projections are Albers, Equal Earth, Equirectangular (WGS84), Lambert conformal conic, Mercator, Natural Earth,
|
|
104
|
+
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.",
|
|
105
105
|
example: {
|
|
106
106
|
name: "albers",
|
|
107
107
|
center: [
|
|
@@ -3922,9 +3922,6 @@
|
|
|
3922
3922
|
},
|
|
3923
3923
|
winkelTripel: {
|
|
3924
3924
|
doc: "A Winkel Tripel projection."
|
|
3925
|
-
},
|
|
3926
|
-
globe: {
|
|
3927
|
-
doc: "A globe projection."
|
|
3928
3925
|
}
|
|
3929
3926
|
},
|
|
3930
3927
|
"default": "mercator",
|
|
@@ -9278,7 +9275,7 @@
|
|
|
9278
9275
|
this.featureDistanceData = null;
|
|
9279
9276
|
}
|
|
9280
9277
|
id() {
|
|
9281
|
-
return this.feature && 'id' in this.feature ? this.feature.id : null;
|
|
9278
|
+
return this.feature && 'id' in this.feature && this.feature.id ? this.feature.id : null;
|
|
9282
9279
|
}
|
|
9283
9280
|
geometryType() {
|
|
9284
9281
|
return this.feature ? typeof this.feature.type === 'number' ? geometryTypes[this.feature.type] : this.feature.type : null;
|
|
@@ -9631,6 +9628,8 @@
|
|
|
9631
9628
|
canonical.y * EXTENT
|
|
9632
9629
|
];
|
|
9633
9630
|
const tilePoints = [];
|
|
9631
|
+
if (!geometry)
|
|
9632
|
+
return tilePoints;
|
|
9634
9633
|
for (const points of geometry) {
|
|
9635
9634
|
for (const point of points) {
|
|
9636
9635
|
const p = [
|
|
@@ -9650,6 +9649,8 @@
|
|
|
9650
9649
|
canonical.y * EXTENT
|
|
9651
9650
|
];
|
|
9652
9651
|
const tileLines = [];
|
|
9652
|
+
if (!geometry)
|
|
9653
|
+
return tileLines;
|
|
9653
9654
|
for (const line of geometry) {
|
|
9654
9655
|
const tileLine = [];
|
|
9655
9656
|
for (const point of line) {
|
|
@@ -9686,6 +9687,9 @@
|
|
|
9686
9687
|
-Infinity
|
|
9687
9688
|
];
|
|
9688
9689
|
const canonical = ctx.canonicalID();
|
|
9690
|
+
if (!canonical) {
|
|
9691
|
+
return false;
|
|
9692
|
+
}
|
|
9689
9693
|
if (polygonGeometry.type === 'Polygon') {
|
|
9690
9694
|
const tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);
|
|
9691
9695
|
const tilePoints = getTilePoints(ctx.geometry(), pointBBox, polyBBox, canonical);
|
|
@@ -9722,6 +9726,9 @@
|
|
|
9722
9726
|
-Infinity
|
|
9723
9727
|
];
|
|
9724
9728
|
const canonical = ctx.canonicalID();
|
|
9729
|
+
if (!canonical) {
|
|
9730
|
+
return false;
|
|
9731
|
+
}
|
|
9725
9732
|
if (polygonGeometry.type === 'Polygon') {
|
|
9726
9733
|
const tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);
|
|
9727
9734
|
const tileLines = getTileLines(ctx.geometry(), lineBBox, polyBBox, canonical);
|
|
@@ -10526,17 +10533,17 @@
|
|
|
10526
10533
|
evaluate(ctx) {
|
|
10527
10534
|
let result = null;
|
|
10528
10535
|
let argCount = 0;
|
|
10529
|
-
let
|
|
10536
|
+
let firstImage;
|
|
10530
10537
|
for (const arg of this.args) {
|
|
10531
10538
|
argCount++;
|
|
10532
10539
|
result = arg.evaluate(ctx);
|
|
10533
10540
|
if (result && result instanceof ResolvedImage && !result.available) {
|
|
10534
|
-
if (!
|
|
10535
|
-
|
|
10541
|
+
if (!firstImage) {
|
|
10542
|
+
firstImage = result;
|
|
10536
10543
|
}
|
|
10537
10544
|
result = null;
|
|
10538
10545
|
if (argCount === this.args.length) {
|
|
10539
|
-
|
|
10546
|
+
return firstImage;
|
|
10540
10547
|
}
|
|
10541
10548
|
}
|
|
10542
10549
|
if (result !== null)
|
|
@@ -10686,7 +10693,7 @@
|
|
|
10686
10693
|
evaluate(ctx) {
|
|
10687
10694
|
const needle = this.needle.evaluate(ctx);
|
|
10688
10695
|
const haystack = this.haystack.evaluate(ctx);
|
|
10689
|
-
if (
|
|
10696
|
+
if (haystack == null)
|
|
10690
10697
|
return false;
|
|
10691
10698
|
if (!isValidNativeType(needle, [
|
|
10692
10699
|
'boolean',
|
|
@@ -12143,7 +12150,7 @@
|
|
|
12143
12150
|
this._evaluator.globals = globals;
|
|
12144
12151
|
this._evaluator.feature = feature;
|
|
12145
12152
|
this._evaluator.featureState = featureState;
|
|
12146
|
-
this._evaluator.canonical = canonical;
|
|
12153
|
+
this._evaluator.canonical = canonical || null;
|
|
12147
12154
|
this._evaluator.availableImages = availableImages || null;
|
|
12148
12155
|
this._evaluator.formattedSection = formattedSection;
|
|
12149
12156
|
this._evaluator.featureTileCoord = featureTileCoord || null;
|
|
@@ -12154,7 +12161,7 @@
|
|
|
12154
12161
|
this._evaluator.globals = globals;
|
|
12155
12162
|
this._evaluator.feature = feature || null;
|
|
12156
12163
|
this._evaluator.featureState = featureState || null;
|
|
12157
|
-
this._evaluator.canonical = canonical;
|
|
12164
|
+
this._evaluator.canonical = canonical || null;
|
|
12158
12165
|
this._evaluator.availableImages = availableImages || null;
|
|
12159
12166
|
this._evaluator.formattedSection = formattedSection || null;
|
|
12160
12167
|
this._evaluator.featureTileCoord = featureTileCoord || null;
|
|
@@ -13619,7 +13626,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13619
13626
|
const beforeLayers = [];
|
|
13620
13627
|
if (before.layers) {
|
|
13621
13628
|
before.layers.forEach(layer => {
|
|
13622
|
-
if (sourcesRemoved[layer.source]) {
|
|
13629
|
+
if (layer.source && sourcesRemoved[layer.source]) {
|
|
13623
13630
|
commands.push({
|
|
13624
13631
|
command: operations.removeLayer,
|
|
13625
13632
|
args: [layer.id]
|
|
@@ -13677,16 +13684,6 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13677
13684
|
}
|
|
13678
13685
|
}
|
|
13679
13686
|
|
|
13680
|
-
function validateConstants(options) {
|
|
13681
|
-
const key = options.key;
|
|
13682
|
-
const constants = options.value;
|
|
13683
|
-
if (constants) {
|
|
13684
|
-
return [new ValidationError(key, constants, 'constants have been deprecated as of v8')];
|
|
13685
|
-
} else {
|
|
13686
|
-
return [];
|
|
13687
|
-
}
|
|
13688
|
-
}
|
|
13689
|
-
|
|
13690
13687
|
function validateObject(options) {
|
|
13691
13688
|
const key = options.key;
|
|
13692
13689
|
const object = options.value;
|
|
@@ -13711,7 +13708,8 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13711
13708
|
validateElement = elementValidators['*'];
|
|
13712
13709
|
} else if (elementSpecs['*']) {
|
|
13713
13710
|
validateElement = validate;
|
|
13714
|
-
}
|
|
13711
|
+
}
|
|
13712
|
+
if (!validateElement) {
|
|
13715
13713
|
errors.push(new ValidationError(key, object[objectKey], `unknown property "${ objectKey }"`));
|
|
13716
13714
|
continue;
|
|
13717
13715
|
}
|
|
@@ -13756,7 +13754,8 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13756
13754
|
'type': arraySpec.value,
|
|
13757
13755
|
'values': arraySpec.values,
|
|
13758
13756
|
'minimum': arraySpec.minimum,
|
|
13759
|
-
'maximum': arraySpec.maximum
|
|
13757
|
+
'maximum': arraySpec.maximum,
|
|
13758
|
+
function: undefined
|
|
13760
13759
|
};
|
|
13761
13760
|
if (styleSpec.$version < 7) {
|
|
13762
13761
|
arrayElementSpec.function = arraySpec.function;
|
|
@@ -13893,11 +13892,15 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13893
13892
|
if (value[0].value === undefined) {
|
|
13894
13893
|
return [new ValidationError(key, value, 'object stop key must have value')];
|
|
13895
13894
|
}
|
|
13896
|
-
|
|
13895
|
+
const nextStopDomainZoom = unbundle(value[0].zoom);
|
|
13896
|
+
if (typeof nextStopDomainZoom !== 'number') {
|
|
13897
|
+
return [new ValidationError(key, value[0].zoom, 'stop zoom values must be numbers')];
|
|
13898
|
+
}
|
|
13899
|
+
if (previousStopDomainZoom && previousStopDomainZoom > nextStopDomainZoom) {
|
|
13897
13900
|
return [new ValidationError(key, value[0].zoom, 'stop zoom values must appear in ascending order')];
|
|
13898
13901
|
}
|
|
13899
|
-
if (
|
|
13900
|
-
previousStopDomainZoom =
|
|
13902
|
+
if (nextStopDomainZoom !== previousStopDomainZoom) {
|
|
13903
|
+
previousStopDomainZoom = nextStopDomainZoom;
|
|
13901
13904
|
previousStopDomainValue = undefined;
|
|
13902
13905
|
stopDomainValues = {};
|
|
13903
13906
|
}
|
|
@@ -13941,7 +13944,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13941
13944
|
} else if (type !== stopKeyType) {
|
|
13942
13945
|
return [new ValidationError(options.key, reportValue, `${ type } stop domain type must match previous stop domain type ${ stopKeyType }`)];
|
|
13943
13946
|
}
|
|
13944
|
-
if (type !== 'number' && type !== 'string' && type !== 'boolean') {
|
|
13947
|
+
if (type !== 'number' && type !== 'string' && type !== 'boolean' && typeof value !== 'number' && typeof value !== 'string' && typeof value !== 'boolean') {
|
|
13945
13948
|
return [new ValidationError(options.key, reportValue, 'stop domain value must be a number, string, or boolean')];
|
|
13946
13949
|
}
|
|
13947
13950
|
if (type !== 'number' && functionType !== 'categorical') {
|
|
@@ -13951,10 +13954,10 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
13951
13954
|
}
|
|
13952
13955
|
return [new ValidationError(options.key, reportValue, message)];
|
|
13953
13956
|
}
|
|
13954
|
-
if (functionType === 'categorical' && type === 'number' && (!isFinite(value) || Math.floor(value) !== value)) {
|
|
13955
|
-
return [new ValidationError(options.key, reportValue, `integer expected, found ${ value }`)];
|
|
13957
|
+
if (functionType === 'categorical' && type === 'number' && (typeof value !== 'number' || !isFinite(value) || Math.floor(value) !== value)) {
|
|
13958
|
+
return [new ValidationError(options.key, reportValue, `integer expected, found ${ String(value) }`)];
|
|
13956
13959
|
}
|
|
13957
|
-
if (functionType !== 'categorical' && type === 'number' && previousStopDomainValue !== undefined && value < previousStopDomainValue) {
|
|
13960
|
+
if (functionType !== 'categorical' && type === 'number' && typeof value === 'number' && typeof previousStopDomainValue === 'number' && previousStopDomainValue !== undefined && value < previousStopDomainValue) {
|
|
13958
13961
|
return [new ValidationError(options.key, reportValue, 'stop domain values must appear in ascending order')];
|
|
13959
13962
|
} else {
|
|
13960
13963
|
previousStopDomainValue = value;
|
|
@@ -14014,8 +14017,10 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14014
14017
|
'pitch',
|
|
14015
14018
|
'distance-from-center'
|
|
14016
14019
|
]);
|
|
14017
|
-
|
|
14018
|
-
|
|
14020
|
+
if (options.valueSpec && options.valueSpec.expression) {
|
|
14021
|
+
for (const param of options.valueSpec.expression.parameters) {
|
|
14022
|
+
disallowedParameters.delete(param);
|
|
14023
|
+
}
|
|
14019
14024
|
}
|
|
14020
14025
|
if (disallowedParameters.size === 0) {
|
|
14021
14026
|
return [];
|
|
@@ -14074,10 +14079,10 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14074
14079
|
|
|
14075
14080
|
function validateFilter(options) {
|
|
14076
14081
|
if (isExpressionFilter(deepUnbundle(options.value))) {
|
|
14077
|
-
const layerType =
|
|
14082
|
+
const layerType = options.layerType || 'fill';
|
|
14078
14083
|
return validateExpression(extend({}, options, {
|
|
14079
14084
|
expressionContext: 'filter',
|
|
14080
|
-
valueSpec: options.styleSpec[`filter_${ layerType
|
|
14085
|
+
valueSpec: options.styleSpec[`filter_${ layerType }`]
|
|
14081
14086
|
}));
|
|
14082
14087
|
} else {
|
|
14083
14088
|
return validateNonExpressionFilter(options);
|
|
@@ -14265,7 +14270,8 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14265
14270
|
parent = layer;
|
|
14266
14271
|
});
|
|
14267
14272
|
if (!parent) {
|
|
14268
|
-
|
|
14273
|
+
if (typeof ref === 'string')
|
|
14274
|
+
errors.push(new ValidationError(key, layer.ref, `ref layer "${ ref }" not found`));
|
|
14269
14275
|
} else if (parent.ref) {
|
|
14270
14276
|
errors.push(new ValidationError(key, layer.ref, 'ref cannot reference another ref layer'));
|
|
14271
14277
|
} else {
|
|
@@ -14321,6 +14327,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14321
14327
|
layer,
|
|
14322
14328
|
key: options.key,
|
|
14323
14329
|
value: options.value,
|
|
14330
|
+
valueSpec: {},
|
|
14324
14331
|
style: options.style,
|
|
14325
14332
|
styleSpec: options.styleSpec,
|
|
14326
14333
|
objectElementValidators: {
|
|
@@ -14335,6 +14342,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14335
14342
|
layer,
|
|
14336
14343
|
key: options.key,
|
|
14337
14344
|
value: options.value,
|
|
14345
|
+
valueSpec: {},
|
|
14338
14346
|
style: options.style,
|
|
14339
14347
|
styleSpec: options.styleSpec,
|
|
14340
14348
|
objectElementValidators: {
|
|
@@ -14553,7 +14561,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14553
14561
|
if (!source) {
|
|
14554
14562
|
errors.push(new ValidationError(key, terrain.source, `source "${ terrain.source }" not found`));
|
|
14555
14563
|
} else if (sourceType !== 'raster-dem') {
|
|
14556
|
-
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`));
|
|
14564
|
+
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`));
|
|
14557
14565
|
}
|
|
14558
14566
|
}
|
|
14559
14567
|
return errors;
|
|
@@ -14642,7 +14650,6 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14642
14650
|
'boolean': validateBoolean,
|
|
14643
14651
|
'number': validateNumber,
|
|
14644
14652
|
'color': validateColor,
|
|
14645
|
-
'constants': validateConstants,
|
|
14646
14653
|
'enum': validateEnum,
|
|
14647
14654
|
'filter': validateFilter,
|
|
14648
14655
|
'function': validateFunction,
|
|
@@ -14688,9 +14695,8 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14688
14695
|
return errors;
|
|
14689
14696
|
}
|
|
14690
14697
|
|
|
14691
|
-
function
|
|
14692
|
-
|
|
14693
|
-
errors = errors.concat(validate({
|
|
14698
|
+
function validateStyle(style, styleSpec = v8) {
|
|
14699
|
+
const errors = validate({
|
|
14694
14700
|
key: '',
|
|
14695
14701
|
value: style,
|
|
14696
14702
|
valueSpec: styleSpec.$root,
|
|
@@ -14698,38 +14704,13 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14698
14704
|
style,
|
|
14699
14705
|
objectElementValidators: {
|
|
14700
14706
|
glyphs: validateGlyphsURL,
|
|
14701
|
-
'*'()
|
|
14702
|
-
return [];
|
|
14703
|
-
}
|
|
14707
|
+
'*': () => []
|
|
14704
14708
|
}
|
|
14705
|
-
})
|
|
14706
|
-
if (style.constants) {
|
|
14707
|
-
errors = errors.concat(validateConstants({
|
|
14708
|
-
key: 'constants',
|
|
14709
|
-
value: style.constants,
|
|
14710
|
-
style,
|
|
14711
|
-
styleSpec
|
|
14712
|
-
}));
|
|
14713
|
-
}
|
|
14709
|
+
});
|
|
14714
14710
|
return sortErrors(errors);
|
|
14715
14711
|
}
|
|
14716
|
-
validateStyleMin.source = wrapCleanErrors(validateSource);
|
|
14717
|
-
validateStyleMin.light = wrapCleanErrors(validateLight);
|
|
14718
|
-
validateStyleMin.terrain = wrapCleanErrors(validateTerrain);
|
|
14719
|
-
validateStyleMin.fog = wrapCleanErrors(validateFog);
|
|
14720
|
-
validateStyleMin.layer = wrapCleanErrors(validateLayer);
|
|
14721
|
-
validateStyleMin.filter = wrapCleanErrors(validateFilter);
|
|
14722
|
-
validateStyleMin.paintProperty = wrapCleanErrors(validatePaintProperty);
|
|
14723
|
-
validateStyleMin.layoutProperty = wrapCleanErrors(validateLayoutProperty);
|
|
14724
14712
|
function sortErrors(errors) {
|
|
14725
|
-
return
|
|
14726
|
-
return a.line - b.line;
|
|
14727
|
-
});
|
|
14728
|
-
}
|
|
14729
|
-
function wrapCleanErrors(inner) {
|
|
14730
|
-
return function (...args) {
|
|
14731
|
-
return sortErrors(inner.apply(this, args));
|
|
14732
|
-
};
|
|
14713
|
+
return errors.slice().sort((a, b) => a.line && b.line ? a.line - b.line : 0);
|
|
14733
14714
|
}
|
|
14734
14715
|
|
|
14735
14716
|
/* parser generated by jison 0.4.15 */
|
|
@@ -15402,14 +15383,14 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
15402
15383
|
return style;
|
|
15403
15384
|
}
|
|
15404
15385
|
|
|
15405
|
-
function validateStyle(style, styleSpec = v8) {
|
|
15386
|
+
function validateStyle$1(style, styleSpec = v8) {
|
|
15406
15387
|
let s = style;
|
|
15407
15388
|
try {
|
|
15408
15389
|
s = readStyle(s);
|
|
15409
15390
|
} catch (e) {
|
|
15410
15391
|
return [e];
|
|
15411
15392
|
}
|
|
15412
|
-
return
|
|
15393
|
+
return validateStyle(s, styleSpec);
|
|
15413
15394
|
}
|
|
15414
15395
|
|
|
15415
15396
|
const SUPPORTED_SPEC_VERSION = 8;
|
|
@@ -15518,7 +15499,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
15518
15499
|
} catch (e) {
|
|
15519
15500
|
return [e];
|
|
15520
15501
|
}
|
|
15521
|
-
let errors =
|
|
15502
|
+
let errors = validateStyle(s, v8).concat(getRootErrors(s, Object.keys(v8.$root)));
|
|
15522
15503
|
if (s.sources) {
|
|
15523
15504
|
errors = errors.concat(getSourcesErrors(s.sources));
|
|
15524
15505
|
}
|
|
@@ -15546,8 +15527,6 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
15546
15527
|
eachLayer,
|
|
15547
15528
|
eachProperty
|
|
15548
15529
|
};
|
|
15549
|
-
validateStyle.parsed = validateStyle;
|
|
15550
|
-
validateStyle.latest = validateStyle;
|
|
15551
15530
|
|
|
15552
15531
|
exports.Color = Color;
|
|
15553
15532
|
exports.ParsingError = ParsingError$1;
|
|
@@ -15563,7 +15542,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
15563
15542
|
exports.latest = v8;
|
|
15564
15543
|
exports.migrate = migrate;
|
|
15565
15544
|
exports.v8 = v8;
|
|
15566
|
-
exports.validate = validateStyle;
|
|
15545
|
+
exports.validate = validateStyle$1;
|
|
15567
15546
|
exports.validateMapboxApiSupported = validateMapboxApiSupported;
|
|
15568
15547
|
exports.visit = visit;
|
|
15569
15548
|
|