@mapbox/mapbox-gl-style-spec 13.28.0 → 14.0.0-beta.2
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/LICENSE.txt +47 -0
- package/README.md +7 -0
- package/data/extent.js +18 -0
- package/deref.js +1 -1
- package/diff.js +36 -15
- package/dist/index.cjs +5839 -2015
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +5837 -2011
- package/dist/index.es.js.map +1 -1
- package/expression/compound_expression.js +2 -1
- package/expression/definitions/assertion.js +2 -2
- package/expression/definitions/coercion.js +54 -15
- package/expression/definitions/comparison.js +2 -0
- package/expression/definitions/distance.js +597 -0
- package/expression/definitions/format.js +2 -2
- package/expression/definitions/image.js +34 -14
- package/expression/definitions/index.js +122 -8
- package/expression/definitions/interpolate.js +1 -1
- package/expression/definitions/match.js +2 -2
- package/expression/definitions/within.js +21 -92
- package/expression/evaluation_context.js +12 -1
- package/expression/index.js +74 -43
- package/expression/is_constant.js +19 -1
- package/expression/parsing_context.js +20 -16
- package/expression/types/formatted.js +2 -2
- package/expression/types/resolved_image.js +19 -8
- package/expression/types.js +2 -1
- package/expression/values.js +25 -0
- package/feature_filter/convert.js +1 -1
- package/feature_filter/index.js +4 -4
- package/flow-typed/cheap-ruler.js +25 -0
- package/flow-typed/geojson.js +8 -7
- package/flow-typed/gl-matrix.js +4 -2
- package/flow-typed/kdbush.js +9 -0
- package/function/convert.js +23 -12
- package/group_by_layout.js +2 -2
- package/migrate/expressions.js +3 -0
- package/package.json +6 -3
- package/reference/v8.json +1771 -114
- package/style-spec.js +4 -3
- package/types.js +190 -24
- package/util/color.js +31 -0
- package/util/geometry_util.js +145 -0
- package/util/properties.js +10 -2
- package/util/random.js +12 -0
- package/validate/validate.js +17 -7
- package/validate/validate_array.js +1 -1
- package/validate/validate_filter.js +4 -12
- package/validate/validate_function.js +2 -2
- package/validate/validate_import.js +31 -0
- package/validate/validate_layer.js +3 -2
- package/validate/validate_lights.js +84 -0
- package/validate/validate_model.js +38 -0
- package/validate/validate_property.js +18 -4
- package/validate/validate_source.js +3 -2
- package/validate/validate_style.js +29 -0
- package/validate_mapbox_api_supported.js +55 -11
- package/validate_style.js +4 -0
- package/validate_style.min.js +11 -19
- package/visit.js +3 -2
package/validate_style.min.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import validate from './validate/validate.js';
|
|
3
2
|
import latestStyleSpec from './reference/latest.js';
|
|
4
|
-
import validateGlyphsURL from './validate/validate_glyphs_url.js';
|
|
5
3
|
|
|
4
|
+
import _validateStyle from './validate/validate_style.js';
|
|
6
5
|
import _validateSource from './validate/validate_source.js';
|
|
7
6
|
import _validateLight from './validate/validate_light.js';
|
|
7
|
+
import _validateLights from './validate/validate_lights.js';
|
|
8
8
|
import _validateTerrain from './validate/validate_terrain.js';
|
|
9
9
|
import _validateFog from './validate/validate_fog.js';
|
|
10
10
|
import _validateLayer from './validate/validate_layer.js';
|
|
11
11
|
import _validateFilter from './validate/validate_filter.js';
|
|
12
12
|
import _validatePaintProperty from './validate/validate_paint_property.js';
|
|
13
13
|
import _validateLayoutProperty from './validate/validate_layout_property.js';
|
|
14
|
+
import _validateModel from './validate/validate_model.js';
|
|
14
15
|
|
|
15
16
|
import type {StyleSpecification} from './types.js';
|
|
16
17
|
|
|
17
|
-
export type ValidationError = {
|
|
18
|
-
message: string
|
|
19
|
-
identifier?: ?string
|
|
20
|
-
line?: ?number
|
|
18
|
+
export type ValidationError = interface {
|
|
19
|
+
message: string,
|
|
20
|
+
identifier?: ?string,
|
|
21
|
+
line?: ?number,
|
|
21
22
|
};
|
|
22
23
|
export type ValidationErrors = $ReadOnlyArray<ValidationError>;
|
|
23
24
|
export type Validator = (Object) => ValidationErrors;
|
|
@@ -38,30 +39,21 @@ export type Validator = (Object) => ValidationErrors;
|
|
|
38
39
|
* var errors = validate(style);
|
|
39
40
|
*/
|
|
40
41
|
export function validateStyle(style: StyleSpecification, styleSpec: Object = latestStyleSpec): ValidationErrors {
|
|
41
|
-
|
|
42
|
-
const errors = validate({
|
|
43
|
-
key: '',
|
|
44
|
-
value: style,
|
|
45
|
-
valueSpec: styleSpec.$root,
|
|
46
|
-
styleSpec,
|
|
47
|
-
style,
|
|
48
|
-
objectElementValidators: {
|
|
49
|
-
glyphs: validateGlyphsURL,
|
|
50
|
-
'*': () => []
|
|
51
|
-
}
|
|
52
|
-
});
|
|
42
|
+
const errors = _validateStyle(style, styleSpec);
|
|
53
43
|
return sortErrors(errors);
|
|
54
44
|
}
|
|
55
45
|
|
|
56
46
|
export const validateSource: Validator = opts => sortErrors(_validateSource(opts));
|
|
57
47
|
export const validateLight: Validator = opts => sortErrors(_validateLight(opts));
|
|
48
|
+
export const validateLights: Validator = opts => sortErrors(_validateLights(opts));
|
|
58
49
|
export const validateTerrain: Validator = opts => sortErrors(_validateTerrain(opts));
|
|
59
50
|
export const validateFog: Validator = opts => sortErrors(_validateFog(opts));
|
|
60
51
|
export const validateLayer: Validator = opts => sortErrors(_validateLayer(opts));
|
|
61
52
|
export const validateFilter: Validator = opts => sortErrors(_validateFilter(opts));
|
|
62
53
|
export const validatePaintProperty: Validator = opts => sortErrors(_validatePaintProperty(opts));
|
|
63
54
|
export const validateLayoutProperty: Validator = opts => sortErrors(_validateLayoutProperty(opts));
|
|
55
|
+
export const validateModel: Validator = opts => sortErrors(_validateModel(opts));
|
|
64
56
|
|
|
65
|
-
function sortErrors(errors) {
|
|
57
|
+
function sortErrors(errors: ValidationErrors) {
|
|
66
58
|
return errors.slice().sort((a, b) => a.line && b.line ? a.line - b.line : 0);
|
|
67
59
|
}
|
package/visit.js
CHANGED
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
DataDrivenPropertyValueSpecification
|
|
11
11
|
} from './types.js';
|
|
12
12
|
|
|
13
|
-
function getPropertyReference(propertyName): StylePropertySpecification {
|
|
13
|
+
function getPropertyReference(propertyName: string): StylePropertySpecification {
|
|
14
14
|
for (let i = 0; i < Reference.layout.length; i++) {
|
|
15
15
|
for (const key in Reference[Reference.layout[i]]) {
|
|
16
16
|
if (key === propertyName) return (Reference[Reference.layout[i]][key]: any);
|
|
@@ -50,7 +50,8 @@ export function eachProperty(
|
|
|
50
50
|
options: {paint?: boolean, layout?: boolean},
|
|
51
51
|
callback: PropertyCallback
|
|
52
52
|
) {
|
|
53
|
-
function inner(layer, propertyType: 'paint' | 'layout') {
|
|
53
|
+
function inner(layer: LayerSpecification, propertyType: 'paint' | 'layout') {
|
|
54
|
+
if (layer.type === 'slot') return;
|
|
54
55
|
const properties = (layer[propertyType]: any);
|
|
55
56
|
if (!properties) return;
|
|
56
57
|
Object.keys(properties).forEach((key) => {
|