@mapbox/mapbox-gl-style-spec 14.1.0 → 14.2.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/composite.js +1 -0
- package/dist/index.cjs +70 -1248
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +70 -1248
- package/dist/index.es.js.map +1 -1
- package/expression/compound_expression.js +1 -1
- package/expression/definitions/index.js +18 -7
- package/expression/definitions/number_format.js +0 -28
- package/expression/evaluation_context.js +3 -1
- package/expression/index.js +9 -9
- package/expression/parsing_context.js +5 -1
- package/expression/types/collator.js +0 -32
- package/flow-typed/intl.js +58 -0
- package/flow-typed/webgl2.js +10 -1
- package/format.js +1 -0
- package/function/index.js +1 -0
- package/migrate/v8.js +2 -3
- package/migrate/v9.js +1 -1
- package/migrate.js +1 -0
- package/package.json +1 -1
- package/read_style.js +2 -0
- package/reference/v8.json +25 -54
- package/rollup.config.js +2 -0
- package/style-spec.js +1 -1
- package/test.js +1 -0
- package/util/properties.js +3 -1
- package/validate/validate_source.js +2 -2
- package/validate/validate_style.js +1 -1
- package/flow-typed/jsdom.js +0 -16
- package/flow-typed/sinon.js +0 -29
|
@@ -82,7 +82,7 @@ class CompoundExpression implements Expression {
|
|
|
82
82
|
|
|
83
83
|
// Use a fresh context for each attempted signature so that, if
|
|
84
84
|
// we eventually succeed, we haven't polluted `context.errors`.
|
|
85
|
-
signatureContext = new ParsingContext(context.registry, context.path, null, context.scope, undefined, context.options);
|
|
85
|
+
signatureContext = new ParsingContext(context.registry, context.path, null, context.scope, undefined, context._scope, context.options);
|
|
86
86
|
|
|
87
87
|
// First parse all the args, potentially coercing to the
|
|
88
88
|
// types expected by this overload.
|
|
@@ -46,11 +46,11 @@ import ImageExpression from './image.js';
|
|
|
46
46
|
import Length from './length.js';
|
|
47
47
|
import Within from './within.js';
|
|
48
48
|
import Distance from './distance.js';
|
|
49
|
+
import {mulberry32} from '../../util/random.js';
|
|
49
50
|
|
|
50
51
|
import type EvaluationContext from '../evaluation_context.js';
|
|
51
52
|
import type {Varargs} from '../compound_expression.js';
|
|
52
53
|
import type {Expression, ExpressionRegistry} from '../expression.js';
|
|
53
|
-
import {mulberry32} from '../../util/random.js';
|
|
54
54
|
|
|
55
55
|
const expressions: ExpressionRegistry = {
|
|
56
56
|
// special forms
|
|
@@ -168,17 +168,28 @@ function clampToAllowedNumber(value: number, min: number | void, max: number | v
|
|
|
168
168
|
return value;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
const FQIDSeparator = '\u001F';
|
|
172
|
+
|
|
173
|
+
function getConfig(ctx: EvaluationContext, key: string, scope: ?string) {
|
|
174
|
+
// Create a fully qualified key from the requested scope
|
|
175
|
+
// and the scope from the current evaluation context
|
|
176
|
+
key = [key, scope, ctx.scope].filter(Boolean).join(FQIDSeparator);
|
|
177
|
+
|
|
175
178
|
const config = ctx.getConfig(key);
|
|
176
179
|
if (!config) return null;
|
|
177
180
|
|
|
178
181
|
const {type, value, values, minValue, maxValue, stepValue} = config;
|
|
179
182
|
|
|
180
183
|
const defaultValue = config.default.evaluate(ctx);
|
|
181
|
-
|
|
184
|
+
|
|
185
|
+
let result = defaultValue;
|
|
186
|
+
if (value) {
|
|
187
|
+
// temporarily override scope to parent to evaluate config expressions passed from the parent
|
|
188
|
+
const originalScope = ctx.scope;
|
|
189
|
+
ctx.scope = (originalScope || '').split(FQIDSeparator).slice(1).join(FQIDSeparator);
|
|
190
|
+
result = value.evaluate(ctx);
|
|
191
|
+
ctx.scope = originalScope;
|
|
192
|
+
}
|
|
182
193
|
|
|
183
194
|
if (type) result = coerceValue(type, result);
|
|
184
195
|
|
|
@@ -295,7 +306,7 @@ CompoundExpression.register(expressions, {
|
|
|
295
306
|
overloads: [
|
|
296
307
|
[
|
|
297
308
|
[StringType],
|
|
298
|
-
(ctx, [key]) => getConfig(ctx, key.evaluate(ctx)
|
|
309
|
+
(ctx, [key]) => getConfig(ctx, key.evaluate(ctx))
|
|
299
310
|
], [
|
|
300
311
|
[StringType, StringType],
|
|
301
312
|
(ctx, [key, scope]) => getConfig(ctx, key.evaluate(ctx), scope.evaluate(ctx))
|
|
@@ -7,34 +7,6 @@ import type EvaluationContext from '../evaluation_context.js';
|
|
|
7
7
|
import type ParsingContext from '../parsing_context.js';
|
|
8
8
|
import type {Type} from '../types.js';
|
|
9
9
|
|
|
10
|
-
declare var Intl: {
|
|
11
|
-
NumberFormat: Class<Intl$NumberFormat>
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
declare class Intl$NumberFormat {
|
|
15
|
-
constructor (
|
|
16
|
-
locales?: string | string[],
|
|
17
|
-
options?: NumberFormatOptions
|
|
18
|
-
): Intl$NumberFormat;
|
|
19
|
-
|
|
20
|
-
static (
|
|
21
|
-
locales?: string | string[],
|
|
22
|
-
options?: NumberFormatOptions
|
|
23
|
-
): Intl$NumberFormat;
|
|
24
|
-
|
|
25
|
-
format(a: number): string;
|
|
26
|
-
|
|
27
|
-
resolvedOptions(): any;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
type NumberFormatOptions = {
|
|
31
|
-
style?: 'decimal' | 'currency' | 'percent' | 'unit';
|
|
32
|
-
currency?: null | string;
|
|
33
|
-
unit?: null | string;
|
|
34
|
-
minimumFractionDigits?: null | string;
|
|
35
|
-
maximumFractionDigits?: null | string;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
10
|
export default class NumberFormat implements Expression {
|
|
39
11
|
type: Type;
|
|
40
12
|
number: Expression;
|
|
@@ -20,11 +20,12 @@ class EvaluationContext {
|
|
|
20
20
|
canonical: null | CanonicalTileID;
|
|
21
21
|
featureTileCoord: ?Point;
|
|
22
22
|
featureDistanceData: ?FeatureDistanceData;
|
|
23
|
+
scope: ?string;
|
|
23
24
|
options: ?ConfigOptions;
|
|
24
25
|
|
|
25
26
|
_parseColorCache: {[_: string]: ?Color};
|
|
26
27
|
|
|
27
|
-
constructor(options
|
|
28
|
+
constructor(scope: ?string, options: ?ConfigOptions) {
|
|
28
29
|
this.globals = (null: any);
|
|
29
30
|
this.feature = null;
|
|
30
31
|
this.featureState = null;
|
|
@@ -34,6 +35,7 @@ class EvaluationContext {
|
|
|
34
35
|
this.canonical = null;
|
|
35
36
|
this.featureTileCoord = null;
|
|
36
37
|
this.featureDistanceData = null;
|
|
38
|
+
this.scope = scope;
|
|
37
39
|
this.options = options;
|
|
38
40
|
}
|
|
39
41
|
|
package/expression/index.js
CHANGED
|
@@ -65,10 +65,10 @@ export class StyleExpression {
|
|
|
65
65
|
_warningHistory: {[key: string]: boolean};
|
|
66
66
|
_enumValues: ?{[_: string]: any};
|
|
67
67
|
|
|
68
|
-
constructor(expression: Expression, propertySpec: ?StylePropertySpecification, options?: ?ConfigOptions) {
|
|
68
|
+
constructor(expression: Expression, propertySpec: ?StylePropertySpecification, scope?: ?string, options?: ?ConfigOptions) {
|
|
69
69
|
this.expression = expression;
|
|
70
70
|
this._warningHistory = {};
|
|
71
|
-
this._evaluator = new EvaluationContext(options);
|
|
71
|
+
this._evaluator = new EvaluationContext(scope, options);
|
|
72
72
|
this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
|
|
73
73
|
this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;
|
|
74
74
|
}
|
|
@@ -132,8 +132,8 @@ export function isExpression(expression: mixed): boolean {
|
|
|
132
132
|
*
|
|
133
133
|
* @private
|
|
134
134
|
*/
|
|
135
|
-
export function createExpression(expression: mixed, propertySpec: ?StylePropertySpecification, options?: ?ConfigOptions): Result<StyleExpression, Array<ParsingError>> {
|
|
136
|
-
const parser = new ParsingContext(definitions, [], propertySpec ? getExpectedType(propertySpec) : undefined, undefined, undefined, options);
|
|
135
|
+
export function createExpression(expression: mixed, propertySpec: ?StylePropertySpecification, scope?: ?string, options?: ?ConfigOptions): Result<StyleExpression, Array<ParsingError>> {
|
|
136
|
+
const parser = new ParsingContext(definitions, [], propertySpec ? getExpectedType(propertySpec) : undefined, undefined, undefined, scope, options);
|
|
137
137
|
|
|
138
138
|
// For string-valued properties, coerce to string at the top level rather than asserting.
|
|
139
139
|
const parsed = parser.parse(expression, undefined, undefined, undefined,
|
|
@@ -144,7 +144,7 @@ export function createExpression(expression: mixed, propertySpec: ?StyleProperty
|
|
|
144
144
|
return error(parser.errors);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
return success(new StyleExpression(parsed, propertySpec, options));
|
|
147
|
+
return success(new StyleExpression(parsed, propertySpec, scope, options));
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
export class ZoomConstantExpression<Kind: EvaluationKind> {
|
|
@@ -249,8 +249,8 @@ export type StylePropertyExpression =
|
|
|
249
249
|
| CameraExpression
|
|
250
250
|
| CompositeExpression;
|
|
251
251
|
|
|
252
|
-
export function createPropertyExpression(expression: mixed, propertySpec: StylePropertySpecification, options?: ?ConfigOptions): Result<StylePropertyExpression, Array<ParsingError>> {
|
|
253
|
-
expression = createExpression(expression, propertySpec, options);
|
|
252
|
+
export function createPropertyExpression(expression: mixed, propertySpec: StylePropertySpecification, scope?: ?string, options?: ?ConfigOptions): Result<StylePropertyExpression, Array<ParsingError>> {
|
|
253
|
+
expression = createExpression(expression, propertySpec, scope, options);
|
|
254
254
|
if (expression.result === 'error') {
|
|
255
255
|
return expression;
|
|
256
256
|
}
|
|
@@ -331,12 +331,12 @@ export class StylePropertyFunction<T> {
|
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
export function normalizePropertyExpression<T>(value: PropertyValueSpecification<T>, specification: StylePropertySpecification, options?: ?ConfigOptions): StylePropertyExpression {
|
|
334
|
+
export function normalizePropertyExpression<T>(value: PropertyValueSpecification<T>, specification: StylePropertySpecification, scope?: ?string, options?: ?ConfigOptions): StylePropertyExpression {
|
|
335
335
|
if (isFunction(value)) {
|
|
336
336
|
return (new StylePropertyFunction(value, specification): any);
|
|
337
337
|
|
|
338
338
|
} else if (isExpression(value) || (Array.isArray(value) && value.length > 0)) {
|
|
339
|
-
const expression = createPropertyExpression(value, specification, options);
|
|
339
|
+
const expression = createPropertyExpression(value, specification, scope, options);
|
|
340
340
|
if (expression.result === 'error') {
|
|
341
341
|
// this should have been caught in validation
|
|
342
342
|
throw new Error(expression.value.map(err => `${err.key}: ${err.message}`).join(', '));
|
|
@@ -28,6 +28,7 @@ class ParsingContext {
|
|
|
28
28
|
key: string;
|
|
29
29
|
scope: Scope;
|
|
30
30
|
errors: Array<ParsingError>;
|
|
31
|
+
_scope: ?string;
|
|
31
32
|
options: ?ConfigOptions;
|
|
32
33
|
|
|
33
34
|
// The expected type of this expression. Provided only to allow Expression
|
|
@@ -42,6 +43,7 @@ class ParsingContext {
|
|
|
42
43
|
expectedType: ?Type,
|
|
43
44
|
scope: Scope = new Scope(),
|
|
44
45
|
errors: Array<ParsingError> = [],
|
|
46
|
+
_scope: ?string,
|
|
45
47
|
options?: ?ConfigOptions
|
|
46
48
|
) {
|
|
47
49
|
this.registry = registry;
|
|
@@ -50,6 +52,7 @@ class ParsingContext {
|
|
|
50
52
|
this.scope = scope;
|
|
51
53
|
this.errors = errors;
|
|
52
54
|
this.expectedType = expectedType;
|
|
55
|
+
this._scope = _scope;
|
|
53
56
|
this.options = options;
|
|
54
57
|
}
|
|
55
58
|
|
|
@@ -124,7 +127,7 @@ class ParsingContext {
|
|
|
124
127
|
// parsed/compiled result. Expressions that expect an image should
|
|
125
128
|
// not be resolved here so we can later get the available images.
|
|
126
129
|
if (!(parsed instanceof Literal) && (parsed.type.kind !== 'resolvedImage') && isConstant(parsed)) {
|
|
127
|
-
const ec = new EvaluationContext(this.options);
|
|
130
|
+
const ec = new EvaluationContext(this._scope, this.options);
|
|
128
131
|
try {
|
|
129
132
|
parsed = new Literal(parsed.type, parsed.evaluate(ec));
|
|
130
133
|
} catch (e) {
|
|
@@ -164,6 +167,7 @@ class ParsingContext {
|
|
|
164
167
|
expectedType || null,
|
|
165
168
|
scope,
|
|
166
169
|
this.errors,
|
|
170
|
+
this._scope,
|
|
167
171
|
this.options
|
|
168
172
|
);
|
|
169
173
|
}
|
|
@@ -1,37 +1,5 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
|
-
// Flow type declarations for Intl cribbed from
|
|
4
|
-
// https://github.com/facebook/flow/issues/1270
|
|
5
|
-
|
|
6
|
-
declare var Intl: {
|
|
7
|
-
Collator: Class<Intl$Collator>
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
declare class Intl$Collator {
|
|
11
|
-
constructor (
|
|
12
|
-
locales?: string | string[],
|
|
13
|
-
options?: CollatorOptions
|
|
14
|
-
): Intl$Collator;
|
|
15
|
-
|
|
16
|
-
static (
|
|
17
|
-
locales?: string | string[],
|
|
18
|
-
options?: CollatorOptions
|
|
19
|
-
): Intl$Collator;
|
|
20
|
-
|
|
21
|
-
compare (a: string, b: string): number;
|
|
22
|
-
|
|
23
|
-
resolvedOptions(): any;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
type CollatorOptions = {
|
|
27
|
-
localeMatcher?: 'lookup' | 'best fit',
|
|
28
|
-
usage?: 'sort' | 'search',
|
|
29
|
-
sensitivity?: 'base' | 'accent' | 'case' | 'variant',
|
|
30
|
-
ignorePunctuation?: boolean,
|
|
31
|
-
numeric?: boolean,
|
|
32
|
-
caseFirst?: 'upper' | 'lower' | 'false'
|
|
33
|
-
}
|
|
34
|
-
|
|
35
3
|
export default class Collator {
|
|
36
4
|
locale: string | null;
|
|
37
5
|
sensitivity: 'base' | 'accent' | 'case' | 'variant';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
// Flow type declarations for Intl cribbed from
|
|
4
|
+
// https://github.com/facebook/flow/issues/1270
|
|
5
|
+
|
|
6
|
+
declare var Intl: {
|
|
7
|
+
NumberFormat: Class<Intl$NumberFormat>;
|
|
8
|
+
Collator: Class<Intl$Collator>;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
declare class Intl$NumberFormat {
|
|
12
|
+
constructor (
|
|
13
|
+
locales?: string | string[],
|
|
14
|
+
options?: NumberFormatOptions
|
|
15
|
+
): Intl$NumberFormat;
|
|
16
|
+
|
|
17
|
+
static (
|
|
18
|
+
locales?: string | string[],
|
|
19
|
+
options?: NumberFormatOptions
|
|
20
|
+
): Intl$NumberFormat;
|
|
21
|
+
|
|
22
|
+
format(a: number): string;
|
|
23
|
+
|
|
24
|
+
resolvedOptions(): any;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type NumberFormatOptions = {
|
|
28
|
+
style?: 'decimal' | 'currency' | 'percent' | 'unit';
|
|
29
|
+
currency?: null | string;
|
|
30
|
+
unit?: null | string;
|
|
31
|
+
minimumFractionDigits?: null | string;
|
|
32
|
+
maximumFractionDigits?: null | string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
declare class Intl$Collator {
|
|
36
|
+
constructor (
|
|
37
|
+
locales?: string | string[],
|
|
38
|
+
options?: CollatorOptions
|
|
39
|
+
): Intl$Collator;
|
|
40
|
+
|
|
41
|
+
static (
|
|
42
|
+
locales?: string | string[],
|
|
43
|
+
options?: CollatorOptions
|
|
44
|
+
): Intl$Collator;
|
|
45
|
+
|
|
46
|
+
compare (a: string, b: string): number;
|
|
47
|
+
|
|
48
|
+
resolvedOptions(): any;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type CollatorOptions = {
|
|
52
|
+
localeMatcher?: 'lookup' | 'best fit',
|
|
53
|
+
usage?: 'sort' | 'search',
|
|
54
|
+
sensitivity?: 'base' | 'accent' | 'case' | 'variant',
|
|
55
|
+
ignorePunctuation?: boolean,
|
|
56
|
+
numeric?: boolean,
|
|
57
|
+
caseFirst?: 'upper' | 'lower' | 'false'
|
|
58
|
+
}
|
package/flow-typed/webgl2.js
CHANGED
|
@@ -15,7 +15,16 @@ declare interface WebGLQuery {
|
|
|
15
15
|
new(): WebGLQuery;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
declare class WebGL2RenderingContext extends WebGLRenderingContext {
|
|
19
|
+
R8: 0x8229;
|
|
20
|
+
R32F: 0x822E;
|
|
21
|
+
RGBA16F: 0x881A;
|
|
22
|
+
RED: 0x1903;
|
|
23
|
+
HALF_FLOAT: 0x140B;
|
|
24
|
+
QUERY_RESULT: 0x8866;
|
|
25
|
+
MIN: 0x8007;
|
|
26
|
+
MAX: 0x8008;
|
|
27
|
+
|
|
19
28
|
createVertexArray: () => WebGLVertexArrayObject | null;
|
|
20
29
|
deleteVertexArray: (vertexArray: WebGLVertexArrayObject | null) => void;
|
|
21
30
|
bindVertexArray: (array: WebGLVertexArrayObject | null) => void;
|
package/format.js
CHANGED
package/function/index.js
CHANGED
package/migrate/v8.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import URL from 'url';
|
|
1
|
+
// @noflow
|
|
3
2
|
import {eachSource, eachLayer, eachProperty} from '../visit.js';
|
|
4
3
|
|
|
5
4
|
function eachLayout(layer, callback) {
|
|
@@ -109,7 +108,7 @@ export default function(style) {
|
|
|
109
108
|
});
|
|
110
109
|
|
|
111
110
|
function migrateFontstackURL(input) {
|
|
112
|
-
const inputParsed = URL
|
|
111
|
+
const inputParsed = new URL(input);
|
|
113
112
|
const inputPathnameParts = inputParsed.pathname.split('/');
|
|
114
113
|
|
|
115
114
|
if (inputParsed.protocol !== 'mapbox:') {
|
package/migrate/v9.js
CHANGED
package/migrate.js
CHANGED
package/package.json
CHANGED
package/read_style.js
CHANGED
package/reference/v8.json
CHANGED
|
@@ -628,12 +628,12 @@
|
|
|
628
628
|
},
|
|
629
629
|
"url": {
|
|
630
630
|
"type": "string",
|
|
631
|
-
"doc": "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`."
|
|
631
|
+
"doc": "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`. Required if `tiles` is not provided."
|
|
632
632
|
},
|
|
633
633
|
"tiles": {
|
|
634
634
|
"type": "array",
|
|
635
635
|
"value": "string",
|
|
636
|
-
"doc": "An array of one or more tile source URLs, as in the TileJSON spec."
|
|
636
|
+
"doc": "An array of one or more tile source URLs, as in the TileJSON spec. Required if `url` is not provided."
|
|
637
637
|
},
|
|
638
638
|
"bounds": {
|
|
639
639
|
"type": "array",
|
|
@@ -707,12 +707,12 @@
|
|
|
707
707
|
},
|
|
708
708
|
"url": {
|
|
709
709
|
"type": "string",
|
|
710
|
-
"doc": "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`."
|
|
710
|
+
"doc": "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`. Required if `tiles` is not provided."
|
|
711
711
|
},
|
|
712
712
|
"tiles": {
|
|
713
713
|
"type": "array",
|
|
714
714
|
"value": "string",
|
|
715
|
-
"doc": "An array of one or more tile source URLs, as in the TileJSON spec."
|
|
715
|
+
"doc": "An array of one or more tile source URLs, as in the TileJSON spec. Required if `url` is not provided."
|
|
716
716
|
},
|
|
717
717
|
"bounds": {
|
|
718
718
|
"type": "array",
|
|
@@ -788,12 +788,12 @@
|
|
|
788
788
|
},
|
|
789
789
|
"url": {
|
|
790
790
|
"type": "string",
|
|
791
|
-
"doc": "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`."
|
|
791
|
+
"doc": "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`. Required if `tiles` is not provided."
|
|
792
792
|
},
|
|
793
793
|
"tiles": {
|
|
794
794
|
"type": "array",
|
|
795
795
|
"value": "string",
|
|
796
|
-
"doc": "An array of one or more tile source URLs, as in the TileJSON spec."
|
|
796
|
+
"doc": "An array of one or more tile source URLs, as in the TileJSON spec. Required if `url` is not provided."
|
|
797
797
|
},
|
|
798
798
|
"bounds": {
|
|
799
799
|
"type": "array",
|
|
@@ -869,12 +869,12 @@
|
|
|
869
869
|
},
|
|
870
870
|
"url": {
|
|
871
871
|
"type": "string",
|
|
872
|
-
"doc": "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`."
|
|
872
|
+
"doc": "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`. Required if `tiles` is not provided."
|
|
873
873
|
},
|
|
874
874
|
"tiles": {
|
|
875
875
|
"type": "array",
|
|
876
876
|
"value": "string",
|
|
877
|
-
"doc": "An array of one or more tile source URLs, as in the TileJSON spec."
|
|
877
|
+
"doc": "An array of one or more tile source URLs, as in the TileJSON spec. Required if `url` is not provided."
|
|
878
878
|
},
|
|
879
879
|
"bounds": {
|
|
880
880
|
"type": "array",
|
|
@@ -1227,7 +1227,7 @@
|
|
|
1227
1227
|
},
|
|
1228
1228
|
"source-layer": {
|
|
1229
1229
|
"type": "string",
|
|
1230
|
-
"doc": "Layer to use from a vector tile source. Required for vector
|
|
1230
|
+
"doc": "Layer to use from a vector tile source. Required for vector and raster-array sources; prohibited for all other source types, including GeoJSON sources."
|
|
1231
1231
|
},
|
|
1232
1232
|
"slot": {
|
|
1233
1233
|
"type": "string",
|
|
@@ -5450,12 +5450,6 @@
|
|
|
5450
5450
|
},
|
|
5451
5451
|
"transition": true,
|
|
5452
5452
|
"doc": "Controls the intensity of shading near ground and concave angles between walls. Default value 0.0 disables ambient occlusion and values around 0.3 provide the most plausible results for buildings.",
|
|
5453
|
-
"requires": [
|
|
5454
|
-
"lights",
|
|
5455
|
-
{
|
|
5456
|
-
"!": "fill-extrusion-flood-light-intensity"
|
|
5457
|
-
}
|
|
5458
|
-
],
|
|
5459
5453
|
"sdk-support": {
|
|
5460
5454
|
"basic functionality": {
|
|
5461
5455
|
"js": "3.0.0",
|
|
@@ -5479,10 +5473,7 @@
|
|
|
5479
5473
|
"transition": true,
|
|
5480
5474
|
"doc": "Shades area near ground and concave angles between walls where the radius defines only vertical impact. Default value 3.0 corresponds to height of one floor and brings the most plausible results for buildings. This property works only with legacy light. When 3D lights are enabled `fill-extrusion-ambient-occlusion-wall-radius` and `fill-extrusion-ambient-occlusion-ground-radius` are used instead.",
|
|
5481
5475
|
"requires": [
|
|
5482
|
-
"fill-extrusion-edge-radius"
|
|
5483
|
-
{
|
|
5484
|
-
"!": "fill-extrusion-flood-light-intensity"
|
|
5485
|
-
}
|
|
5476
|
+
"fill-extrusion-edge-radius"
|
|
5486
5477
|
],
|
|
5487
5478
|
"sdk-support": {
|
|
5488
5479
|
"basic functionality": {
|
|
@@ -5507,10 +5498,7 @@
|
|
|
5507
5498
|
"doc": "Shades area near ground and concave angles between walls where the radius defines only vertical impact. Default value 3.0 corresponds to height of one floor and brings the most plausible results for buildings.",
|
|
5508
5499
|
"requires": [
|
|
5509
5500
|
"lights",
|
|
5510
|
-
"fill-extrusion-edge-radius"
|
|
5511
|
-
{
|
|
5512
|
-
"!": "fill-extrusion-flood-light-intensity"
|
|
5513
|
-
}
|
|
5501
|
+
"fill-extrusion-edge-radius"
|
|
5514
5502
|
],
|
|
5515
5503
|
"sdk-support": {
|
|
5516
5504
|
"basic functionality": {
|
|
@@ -5534,10 +5522,7 @@
|
|
|
5534
5522
|
"transition": true,
|
|
5535
5523
|
"doc": "The extent of the ambient occlusion effect on the ground beneath the extruded buildings in meters.",
|
|
5536
5524
|
"requires": [
|
|
5537
|
-
"lights"
|
|
5538
|
-
{
|
|
5539
|
-
"!": "fill-extrusion-flood-light-intensity"
|
|
5540
|
-
}
|
|
5525
|
+
"lights"
|
|
5541
5526
|
],
|
|
5542
5527
|
"sdk-support": {
|
|
5543
5528
|
"basic functionality": {
|
|
@@ -5555,10 +5540,7 @@
|
|
|
5555
5540
|
"maximum": 1.0,
|
|
5556
5541
|
"doc": "Provides a control to futher fine-tune the look of the ambient occlusion on the ground beneath the extruded buildings. Lower values give the effect a more solid look while higher values make it smoother.",
|
|
5557
5542
|
"requires": [
|
|
5558
|
-
"lights"
|
|
5559
|
-
{
|
|
5560
|
-
"!": "fill-extrusion-flood-light-intensity"
|
|
5561
|
-
}
|
|
5543
|
+
"lights"
|
|
5562
5544
|
],
|
|
5563
5545
|
"transition": true,
|
|
5564
5546
|
"expression": {
|
|
@@ -5581,10 +5563,7 @@
|
|
|
5581
5563
|
"default": "#ffffff",
|
|
5582
5564
|
"doc": "The color of the flood light effect on the walls of the extruded buildings.",
|
|
5583
5565
|
"requires": [
|
|
5584
|
-
"lights"
|
|
5585
|
-
{
|
|
5586
|
-
"!": "fill-extrusion-ambient-occlusion-intensity"
|
|
5587
|
-
}
|
|
5566
|
+
"lights"
|
|
5588
5567
|
],
|
|
5589
5568
|
"transition": true,
|
|
5590
5569
|
"expression": {
|
|
@@ -5610,10 +5589,7 @@
|
|
|
5610
5589
|
"maximum": 1.0,
|
|
5611
5590
|
"doc": "The intensity of the flood light color.",
|
|
5612
5591
|
"requires": [
|
|
5613
|
-
"lights"
|
|
5614
|
-
{
|
|
5615
|
-
"!": "fill-extrusion-ambient-occlusion-intensity"
|
|
5616
|
-
}
|
|
5592
|
+
"lights"
|
|
5617
5593
|
],
|
|
5618
5594
|
"transition": true,
|
|
5619
5595
|
"expression": {
|
|
@@ -5639,10 +5615,7 @@
|
|
|
5639
5615
|
"minimum": 0,
|
|
5640
5616
|
"doc": "The extent of the flood light effect on the walls of the extruded buildings in meters.",
|
|
5641
5617
|
"requires": [
|
|
5642
|
-
"lights"
|
|
5643
|
-
{
|
|
5644
|
-
"!": "fill-extrusion-ambient-occlusion-intensity"
|
|
5645
|
-
}
|
|
5618
|
+
"lights"
|
|
5646
5619
|
],
|
|
5647
5620
|
"transition": true,
|
|
5648
5621
|
"expression": {
|
|
@@ -5670,13 +5643,9 @@
|
|
|
5670
5643
|
"type": "number",
|
|
5671
5644
|
"units": "meters",
|
|
5672
5645
|
"default": 0,
|
|
5673
|
-
"minimum": 0,
|
|
5674
5646
|
"doc": "The extent of the flood light effect on the ground beneath the extruded buildings in meters.",
|
|
5675
5647
|
"requires": [
|
|
5676
|
-
"lights"
|
|
5677
|
-
{
|
|
5678
|
-
"!": "fill-extrusion-ambient-occlusion-intensity"
|
|
5679
|
-
}
|
|
5648
|
+
"lights"
|
|
5680
5649
|
],
|
|
5681
5650
|
"transition": true,
|
|
5682
5651
|
"expression": {
|
|
@@ -5707,10 +5676,7 @@
|
|
|
5707
5676
|
"maximum": 1.0,
|
|
5708
5677
|
"doc": "Provides a control to futher fine-tune the look of the flood light on the ground beneath the extruded buildings. Lower values give the effect a more solid look while higher values make it smoother.",
|
|
5709
5678
|
"requires": [
|
|
5710
|
-
"lights"
|
|
5711
|
-
{
|
|
5712
|
-
"!": "fill-extrusion-ambient-occlusion-intensity"
|
|
5713
|
-
}
|
|
5679
|
+
"lights"
|
|
5714
5680
|
],
|
|
5715
5681
|
"transition": true,
|
|
5716
5682
|
"expression": {
|
|
@@ -5776,7 +5742,7 @@
|
|
|
5776
5742
|
"default": 0.0,
|
|
5777
5743
|
"minimum": 0.0,
|
|
5778
5744
|
"maximum": 1.0,
|
|
5779
|
-
"doc": "This parameter defines the range for the fade-out effect before an automatic content cutoff on pitched map views.
|
|
5745
|
+
"doc": "This parameter defines the range for the fade-out effect before an automatic content cutoff on pitched map views. Fade out is implemented by scaling down and removing buildings in the fade range in a staggered fashion. Opacity is not changed. The fade range is expressed in relation to the height of the map view. A value of 1.0 indicates that the content is faded to the same extent as the map's height in pixels, while a value close to zero represents a sharp cutoff. When the value is set to 0.0, the cutoff is completely disabled. Note: The property has no effect on the map if terrain is enabled.",
|
|
5780
5746
|
"transition": false,
|
|
5781
5747
|
"expression": {
|
|
5782
5748
|
"interpolated": false
|
|
@@ -7615,7 +7581,12 @@
|
|
|
7615
7581
|
"required": false,
|
|
7616
7582
|
"property-type": "data-constant",
|
|
7617
7583
|
"transition": false,
|
|
7618
|
-
"
|
|
7584
|
+
"requires": [
|
|
7585
|
+
{
|
|
7586
|
+
"source": "raster-array"
|
|
7587
|
+
}
|
|
7588
|
+
],
|
|
7589
|
+
"doc": "Displayed band of raster array source layer. Defaults to the first band if not set.",
|
|
7619
7590
|
"example": "band-name",
|
|
7620
7591
|
"sdk-support": {
|
|
7621
7592
|
"basic functionality": {
|
package/rollup.config.js
CHANGED
package/style-spec.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
type ExpressionType = 'data-driven' | 'color-ramp' | 'data-constant' | 'constant';
|
|
4
|
-
type ExpressionParameters = Array<'zoom' | 'feature' | 'feature-state' | 'heatmap-density' | 'line-progress' | 'raster-value' | 'sky-radial-progress' | 'pitch' | 'distance-from-center'>;
|
|
4
|
+
type ExpressionParameters = Array<'zoom' | 'feature' | 'feature-state' | 'heatmap-density' | 'line-progress' | 'raster-value' | 'sky-radial-progress' | 'pitch' | 'distance-from-center' | 'measure-light'>;
|
|
5
5
|
|
|
6
6
|
export type ExpressionSpecification = {
|
|
7
7
|
interpolated: boolean,
|
package/test.js
CHANGED
package/util/properties.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import type {ExpressionSpecification, StylePropertySpecification} from '../style-spec.js';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
type ExpressionParameter = ExpressionSpecification['parameters'][number];
|
|
6
|
+
|
|
7
|
+
function expressionHasParameter(expression: ?ExpressionSpecification, parameter: ExpressionParameter): boolean {
|
|
6
8
|
return !!expression && !!expression.parameters && expression.parameters.indexOf(parameter) > -1;
|
|
7
9
|
}
|
|
8
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
|
-
import ValidationError from '../error/validation_error.js';
|
|
3
|
+
import {default as ValidationError, ValidationWarning} from '../error/validation_error.js';
|
|
4
4
|
import {unbundle} from '../util/unbundle_jsonlint.js';
|
|
5
5
|
import validateObject from './validate_object.js';
|
|
6
6
|
import validateEnum from './validate_enum.js';
|
|
@@ -30,7 +30,7 @@ export default function validateSource(options: ValidationOptions): Array<Valida
|
|
|
30
30
|
|
|
31
31
|
if (['vector', 'raster', 'raster-dem'].includes(type)) {
|
|
32
32
|
if (!value.url && !value.tiles) {
|
|
33
|
-
errors.push(new
|
|
33
|
+
errors.push(new ValidationWarning(key, value, 'Either "url" or "tiles" is required.'));
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|