@mapbox/mapbox-gl-style-spec 13.10.1 → 13.13.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/CHANGELOG.md +32 -4
- package/dist/index.es.js +2244 -2406
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +2244 -2405
- package/dist/index.js.map +1 -1
- package/empty.js +29 -0
- package/error/parsing_error.js +5 -2
- package/error/validation_error.js +6 -3
- package/expression/compound_expression.js +5 -5
- package/expression/definitions/assertion.js +3 -4
- package/expression/definitions/at.js +3 -3
- package/expression/definitions/case.js +3 -6
- package/expression/definitions/coalesce.js +3 -4
- package/expression/definitions/coercion.js +3 -4
- package/expression/definitions/collator.js +5 -5
- package/expression/definitions/comparison.js +3 -3
- package/expression/definitions/format.js +3 -3
- package/expression/definitions/format_section_override.js +3 -4
- package/expression/definitions/image.js +6 -8
- package/expression/definitions/in.js +4 -4
- package/expression/definitions/index.js +4 -2
- package/expression/definitions/interpolate.js +3 -4
- package/expression/definitions/length.js +3 -3
- package/expression/definitions/let.js +3 -3
- package/expression/definitions/literal.js +2 -2
- package/expression/definitions/match.js +3 -6
- package/expression/definitions/number_format.js +3 -3
- package/expression/definitions/step.js +3 -4
- package/expression/definitions/var.js +2 -2
- package/expression/definitions/within.js +297 -0
- package/expression/evaluation_context.js +12 -1
- package/expression/expression.js +3 -5
- package/expression/index.js +24 -19
- package/expression/is_constant.js +5 -1
- package/expression/parsing_context.js +3 -0
- package/expression/scope.js +1 -1
- package/expression/types/resolved_image.js +2 -1
- package/feature_filter/convert.js +1 -1
- package/feature_filter/index.js +10 -5
- package/flow-typed/offscreen-canvas.js +9 -0
- package/flow-typed/vector-tile.js +2 -2
- package/function/convert.js +8 -2
- package/package.json +2 -1
- package/reference/v8.json +166 -168
- package/style-spec.js +3 -1
- package/types.js +7 -3
- package/validate/validate_expression.js +1 -1
- package/validate/validate_source.js +22 -2
- package/visit.js +2 -2
package/style-spec.js
CHANGED
|
@@ -31,7 +31,7 @@ export type StylePropertySpecification = {
|
|
|
31
31
|
type: 'enum',
|
|
32
32
|
'property-type': ExpressionType,
|
|
33
33
|
expression?: ExpressionSpecification,
|
|
34
|
-
values: {[string]: {}},
|
|
34
|
+
values: {[_: string]: {}},
|
|
35
35
|
transition: boolean,
|
|
36
36
|
default?: string
|
|
37
37
|
} | {
|
|
@@ -64,6 +64,7 @@ import latest from './reference/latest';
|
|
|
64
64
|
import format from './format';
|
|
65
65
|
import migrate from './migrate';
|
|
66
66
|
import composite from './composite';
|
|
67
|
+
import derefLayers from './deref';
|
|
67
68
|
import diff from './diff';
|
|
68
69
|
import ValidationError from './error/validation_error';
|
|
69
70
|
import ParsingError from './error/parsing_error';
|
|
@@ -103,6 +104,7 @@ export {
|
|
|
103
104
|
format,
|
|
104
105
|
migrate,
|
|
105
106
|
composite,
|
|
107
|
+
derefLayers,
|
|
106
108
|
diff,
|
|
107
109
|
ValidationError,
|
|
108
110
|
ParsingError,
|
package/types.js
CHANGED
|
@@ -8,6 +8,8 @@ export type FormattedSpecification = string;
|
|
|
8
8
|
|
|
9
9
|
export type ResolvedImageSpecification = string;
|
|
10
10
|
|
|
11
|
+
export type PromoteIdSpecification = {[_: string]: string} | string;
|
|
12
|
+
|
|
11
13
|
export type FilterSpecification =
|
|
12
14
|
| ['has', string]
|
|
13
15
|
| ['!has', string]
|
|
@@ -64,7 +66,7 @@ export type StyleSpecification = {|
|
|
|
64
66
|
"bearing"?: number,
|
|
65
67
|
"pitch"?: number,
|
|
66
68
|
"light"?: LightSpecification,
|
|
67
|
-
"sources": {[string]: SourceSpecification},
|
|
69
|
+
"sources": {[_: string]: SourceSpecification},
|
|
68
70
|
"sprite"?: string,
|
|
69
71
|
"glyphs"?: string,
|
|
70
72
|
"transition"?: TransitionSpecification,
|
|
@@ -86,7 +88,8 @@ export type VectorSourceSpecification = {
|
|
|
86
88
|
"scheme"?: "xyz" | "tms",
|
|
87
89
|
"minzoom"?: number,
|
|
88
90
|
"maxzoom"?: number,
|
|
89
|
-
"attribution"?: string
|
|
91
|
+
"attribution"?: string,
|
|
92
|
+
"promoteId"?: PromoteIdSpecification
|
|
90
93
|
}
|
|
91
94
|
|
|
92
95
|
export type RasterSourceSpecification = {
|
|
@@ -125,7 +128,8 @@ export type GeoJSONSourceSpecification = {|
|
|
|
125
128
|
"clusterMaxZoom"?: number,
|
|
126
129
|
"clusterProperties"?: mixed,
|
|
127
130
|
"lineMetrics"?: boolean,
|
|
128
|
-
"generateId"?: boolean
|
|
131
|
+
"generateId"?: boolean,
|
|
132
|
+
"promoteId"?: PromoteIdSpecification
|
|
129
133
|
|}
|
|
130
134
|
|
|
131
135
|
export type VideoSourceSpecification = {|
|
|
@@ -17,7 +17,7 @@ export default function validateExpression(options: any): Array<ValidationError>
|
|
|
17
17
|
const expressionObj = (expression.value: any).expression || (expression.value: any)._styleExpression.expression;
|
|
18
18
|
|
|
19
19
|
if (options.expressionContext === 'property' && (options.propertyKey === 'text-font') &&
|
|
20
|
-
expressionObj.
|
|
20
|
+
!expressionObj.outputDefined()) {
|
|
21
21
|
return [new ValidationError(options.key, options.value, `Invalid data expression for "${options.propertyKey}". Output values must be contained as literals within the expression.`)];
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -4,6 +4,12 @@ import {unbundle} from '../util/unbundle_jsonlint';
|
|
|
4
4
|
import validateObject from './validate_object';
|
|
5
5
|
import validateEnum from './validate_enum';
|
|
6
6
|
import validateExpression from './validate_expression';
|
|
7
|
+
import validateString from './validate_string';
|
|
8
|
+
import getType from '../util/get_type';
|
|
9
|
+
|
|
10
|
+
const objectElementValidators = {
|
|
11
|
+
promoteId: validatePromoteId
|
|
12
|
+
};
|
|
7
13
|
|
|
8
14
|
export default function validateSource(options) {
|
|
9
15
|
const value = options.value;
|
|
@@ -27,7 +33,8 @@ export default function validateSource(options) {
|
|
|
27
33
|
value,
|
|
28
34
|
valueSpec: styleSpec[`source_${type.replace('-', '_')}`],
|
|
29
35
|
style: options.style,
|
|
30
|
-
styleSpec
|
|
36
|
+
styleSpec,
|
|
37
|
+
objectElementValidators
|
|
31
38
|
});
|
|
32
39
|
return errors;
|
|
33
40
|
|
|
@@ -37,7 +44,8 @@ export default function validateSource(options) {
|
|
|
37
44
|
value,
|
|
38
45
|
valueSpec: styleSpec.source_geojson,
|
|
39
46
|
style,
|
|
40
|
-
styleSpec
|
|
47
|
+
styleSpec,
|
|
48
|
+
objectElementValidators
|
|
41
49
|
});
|
|
42
50
|
if (value.cluster) {
|
|
43
51
|
for (const prop in value.clusterProperties) {
|
|
@@ -89,3 +97,15 @@ export default function validateSource(options) {
|
|
|
89
97
|
});
|
|
90
98
|
}
|
|
91
99
|
}
|
|
100
|
+
|
|
101
|
+
function validatePromoteId({key, value}) {
|
|
102
|
+
if (getType(value) === 'string') {
|
|
103
|
+
return validateString({key, value});
|
|
104
|
+
} else {
|
|
105
|
+
const errors = [];
|
|
106
|
+
for (const prop in value) {
|
|
107
|
+
errors.push(...validateString({key: `${key}.${prop}`, value: value[prop]}));
|
|
108
|
+
}
|
|
109
|
+
return errors;
|
|
110
|
+
}
|
|
111
|
+
}
|
package/visit.js
CHANGED
|
@@ -25,13 +25,13 @@ function getPropertyReference(propertyName): StylePropertySpecification {
|
|
|
25
25
|
return (null: any);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export function eachSource(style: StyleSpecification, callback: (SourceSpecification) => void) {
|
|
28
|
+
export function eachSource(style: StyleSpecification, callback: (_: SourceSpecification) => void) {
|
|
29
29
|
for (const k in style.sources) {
|
|
30
30
|
callback(style.sources[k]);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export function eachLayer(style: StyleSpecification, callback: (LayerSpecification) => void) {
|
|
34
|
+
export function eachLayer(style: StyleSpecification, callback: (_: LayerSpecification) => void) {
|
|
35
35
|
for (const layer of style.layers) {
|
|
36
36
|
callback(layer);
|
|
37
37
|
}
|