@mapbox/mapbox-gl-style-spec 13.24.0-alpha.2 → 13.24.0-alpha.3
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 +6 -0
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +4 -4
- package/dist/index.es.js.map +1 -1
- package/expression/definitions/coalesce.js +7 -5
- package/expression/evaluation_context.js +1 -1
- package/expression/index.js +3 -3
- package/feature_filter/convert.js +1 -1
- package/flow-typed/gl-matrix.js +102 -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/package.json +1 -1
- package/style-spec.js +6 -0
|
@@ -54,19 +54,21 @@ class Coalesce implements Expression {
|
|
|
54
54
|
evaluate(ctx: EvaluationContext) {
|
|
55
55
|
let result = null;
|
|
56
56
|
let argCount = 0;
|
|
57
|
-
let
|
|
57
|
+
let firstImage;
|
|
58
58
|
for (const arg of this.args) {
|
|
59
59
|
argCount++;
|
|
60
60
|
result = arg.evaluate(ctx);
|
|
61
61
|
// we need to keep track of the first requested image in a coalesce statement
|
|
62
|
-
// if coalesce can't find a valid image, we return the first image
|
|
62
|
+
// if coalesce can't find a valid image, we return the first image so styleimagemissing can fire
|
|
63
63
|
if (result && result instanceof ResolvedImage && !result.available) {
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
// set to first image
|
|
65
|
+
if (!firstImage) {
|
|
66
|
+
firstImage = result;
|
|
66
67
|
}
|
|
67
68
|
result = null;
|
|
69
|
+
// if we reach the end, return the first image
|
|
68
70
|
if (argCount === this.args.length) {
|
|
69
|
-
|
|
71
|
+
return firstImage;
|
|
70
72
|
}
|
|
71
73
|
}
|
|
72
74
|
|
package/expression/index.js
CHANGED
|
@@ -286,11 +286,11 @@ export class StylePropertyFunction<T> {
|
|
|
286
286
|
extend(this, createFunction(this._parameters, this._specification));
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
static deserialize(serialized: {_parameters: PropertyValueSpecification<T>, _specification: StylePropertySpecification}) {
|
|
290
|
-
return
|
|
289
|
+
static deserialize(serialized: {_parameters: PropertyValueSpecification<T>, _specification: StylePropertySpecification}): StylePropertyFunction<T> {
|
|
290
|
+
return new StylePropertyFunction(serialized._parameters, serialized._specification);
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
-
static serialize(input: StylePropertyFunction<T>) {
|
|
293
|
+
static serialize(input: StylePropertyFunction<T>): {_parameters: PropertyValueSpecification<T>, _specification: StylePropertySpecification} {
|
|
294
294
|
return {
|
|
295
295
|
_parameters: input._parameters,
|
|
296
296
|
_specification: input._specification
|
|
@@ -94,7 +94,7 @@ function _convertFilter(filter: FilterSpecification, expectedTypes: ExpectedType
|
|
|
94
94
|
const children = (filter: any).slice(1).map(f => _convertFilter(f, expectedTypes));
|
|
95
95
|
return children.length > 1 ? ['all'].concat(children) : [].concat(...children);
|
|
96
96
|
} else if (op === 'none') {
|
|
97
|
-
return ['!', _convertFilter(['any'].concat(filter.slice(1)), {})];
|
|
97
|
+
return ['!', _convertFilter(['any'].concat((filter: any).slice(1)), {})];
|
|
98
98
|
} else if (op === 'in') {
|
|
99
99
|
converted = convertInOp((filter[1]: any), filter.slice(2));
|
|
100
100
|
} else if (op === '!in') {
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
type VecType = Array<number> | Float32Array | Float64Array;
|
|
3
|
+
|
|
4
|
+
declare module "gl-matrix" {
|
|
5
|
+
declare type Vec2 = VecType;
|
|
6
|
+
declare type Vec3 = VecType;
|
|
7
|
+
declare type Vec4 = VecType;
|
|
8
|
+
declare type Quat = VecType;
|
|
9
|
+
declare type Mat2 = VecType;
|
|
10
|
+
declare type Mat3 = VecType;
|
|
11
|
+
declare type Mat4 = VecType;
|
|
12
|
+
|
|
13
|
+
declare var vec2: {
|
|
14
|
+
exactEquals(Vec2, Vec2): boolean
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
declare var vec3: {
|
|
18
|
+
create(): Float32Array,
|
|
19
|
+
fromValues(number, number, number): Float32Array,
|
|
20
|
+
length(Vec3): number,
|
|
21
|
+
len(Vec3): number,
|
|
22
|
+
squaredLength(Vec3): number,
|
|
23
|
+
dot(Vec3, Vec3): number,
|
|
24
|
+
equals(Vec3, Vec3): boolean,
|
|
25
|
+
exactEquals(Vec3, Vec3): boolean,
|
|
26
|
+
|
|
27
|
+
clone<T: Vec3>(T): T,
|
|
28
|
+
normalize<T: Vec3>(T, Vec3): T,
|
|
29
|
+
add<T: Vec3>(T, Vec3, Vec3): T,
|
|
30
|
+
sub<T: Vec3>(T, Vec3, Vec3): T,
|
|
31
|
+
subtract<T: Vec3>(T, Vec3, Vec3): T,
|
|
32
|
+
cross<T: Vec3>(T, Vec3, Vec3): T,
|
|
33
|
+
negate<T: Vec3>(T, Vec3): T,
|
|
34
|
+
scale<T: Vec3>(T, Vec3, number): T,
|
|
35
|
+
scaleAndAdd<T: Vec3>(T, Vec3, Vec3, number): T,
|
|
36
|
+
multiply<T: Vec3>(T, Vec3, Vec3): T,
|
|
37
|
+
mul<T: Vec3>(T, Vec3, Vec3): T,
|
|
38
|
+
div<T: Vec3>(T, Vec3, Vec3): T,
|
|
39
|
+
min<T: Vec3>(T, Vec3, Vec3): T,
|
|
40
|
+
max<T: Vec3>(T, Vec3, Vec3): T,
|
|
41
|
+
transformQuat<T: Vec3>(T, Vec3, Quat): T,
|
|
42
|
+
transformMat3<T: Vec3>(T, Vec3, Mat3): T,
|
|
43
|
+
transformMat4<T: Vec3>(T, Vec3, Mat4): T
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
declare var vec4: {
|
|
47
|
+
scale<T: Vec4>(T, Vec4, number): T,
|
|
48
|
+
mul<T: Vec4>(T, Vec4, Vec4): T,
|
|
49
|
+
transformMat4<T: Vec4>(T, Vec4, Mat4): T
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
declare var mat2: {
|
|
53
|
+
create(): Float32Array,
|
|
54
|
+
rotate<T: Mat2>(T, Mat2, number): T,
|
|
55
|
+
invert<T: Mat2>(T, Mat2): T,
|
|
56
|
+
scale<T: Mat2>(T, Mat2, Vec2): T
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
declare var mat3: {
|
|
60
|
+
create(): Float32Array,
|
|
61
|
+
|
|
62
|
+
fromMat4<T: Mat3>(T, Mat4): T,
|
|
63
|
+
fromRotation<T: Mat3>(T, number): T,
|
|
64
|
+
mul<T: Mat3>(T, Mat3, Mat3): T,
|
|
65
|
+
multiply<T: Mat3>(T, Mat3, Mat3): T,
|
|
66
|
+
adjoint<T: Mat3>(T, Mat3): T,
|
|
67
|
+
transpose<T: Mat3>(T, Mat3): T
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
declare var mat4: {
|
|
71
|
+
create(): Float32Array,
|
|
72
|
+
|
|
73
|
+
fromScaling<T: Mat4>(T, Vec3): T,
|
|
74
|
+
fromQuat<T: Mat4>(T, Quat): T,
|
|
75
|
+
ortho<T: Mat4>(T, number, number, number, number, number, number): T,
|
|
76
|
+
perspective<T: Mat4>(T, number, number, number, number): T,
|
|
77
|
+
identity<T: Mat4>(T): T,
|
|
78
|
+
scale<T: Mat4>(T, Mat4, Vec3): T,
|
|
79
|
+
mul<T: Mat4>(T, Mat4, Mat4): T,
|
|
80
|
+
multiply<T: Mat4>(T, Mat4, Mat4): T,
|
|
81
|
+
rotateX<T: Mat4>(T, Mat4, number): T,
|
|
82
|
+
rotateY<T: Mat4>(T, Mat4, number): T,
|
|
83
|
+
rotateZ<T: Mat4>(T, Mat4, number): T,
|
|
84
|
+
translate<T: Mat4>(T, Mat4, Vec3): T,
|
|
85
|
+
invert<T: Mat4>(T, Mat4): T,
|
|
86
|
+
copy<T: Mat4>(T, Mat4): T,
|
|
87
|
+
clone<T: Mat4>(T): T
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
declare var quat: {
|
|
91
|
+
create(): Float32Array,
|
|
92
|
+
length(Quat): number,
|
|
93
|
+
exactEquals(Quat, Quat): boolean,
|
|
94
|
+
|
|
95
|
+
normalize<T: Quat>(T, Quat): T,
|
|
96
|
+
conjugate<T: Quat>(T, Quat): T,
|
|
97
|
+
identity<T: Quat>(T): T,
|
|
98
|
+
rotateX<T: Quat>(T, Quat, number): T,
|
|
99
|
+
rotateY<T: Quat>(T, Quat, number): T,
|
|
100
|
+
rotateZ<T: Quat>(T, Quat, number): T
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
declare module 'grid-index' {
|
|
3
|
+
declare class GridIndex {
|
|
4
|
+
constructor(extent: number, n: number, padding: number): GridIndex;
|
|
5
|
+
constructor(data: ArrayBuffer): GridIndex;
|
|
6
|
+
|
|
7
|
+
insert(key: number, x1: number, y1: number, x2: number, y2: number): void;
|
|
8
|
+
query(x1: number, y1: number, x2: number, y2: number, intersectionText?: (number, number, number, number) => boolean): Array<number>;
|
|
9
|
+
toArrayBuffer(): ArrayBuffer;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare export default Class<GridIndex>;
|
|
13
|
+
}
|
package/flow-typed/pbf.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
declare module "pbf" {
|
|
2
3
|
declare type ReadFunction<T> = (tag: number, result: T, pbf: Pbf) => void;
|
|
3
4
|
|
|
@@ -21,5 +22,5 @@ declare module "pbf" {
|
|
|
21
22
|
readBytes(): Uint8Array;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
declare
|
|
25
|
+
declare export default Class<Pbf>;
|
|
25
26
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
// @flow strict
|
|
1
2
|
declare module "@mapbox/point-geometry" {
|
|
2
|
-
declare type PointLike = Point | [number, number];
|
|
3
|
+
declare export type PointLike = Point | [number, number];
|
|
3
4
|
|
|
4
5
|
declare class Point {
|
|
5
6
|
x: number;
|
|
@@ -40,5 +41,6 @@ declare module "@mapbox/point-geometry" {
|
|
|
40
41
|
_round(): Point;
|
|
41
42
|
static convert(a: PointLike): Point;
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
+
|
|
45
|
+
declare export default Class<Point>;
|
|
44
46
|
}
|
package/flow-typed/potpack.js
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
declare module '@mapbox/tiny-sdf' {
|
|
3
|
+
declare type TinySDFOptions = {
|
|
4
|
+
fontSize?: number;
|
|
5
|
+
buffer?: number;
|
|
6
|
+
radius?: number;
|
|
7
|
+
cutoff?: number;
|
|
8
|
+
fontFamily?: string;
|
|
9
|
+
fontWeight?: string;
|
|
10
|
+
fontStyle?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
declare type TinySDFGlyph = {
|
|
14
|
+
data: Uint8ClampedArray;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
glyphWidth: number;
|
|
18
|
+
glyphHeight: number;
|
|
19
|
+
glyphTop: number;
|
|
20
|
+
glyphLeft: number;
|
|
21
|
+
glyphAdvance: number;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
declare class TinySDF {
|
|
25
|
+
fontWeight: string;
|
|
26
|
+
constructor(options: TinySDFOptions): TinySDF;
|
|
27
|
+
draw(char: string): TinySDFGlyph;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare export default Class<TinySDF>;
|
|
31
|
+
}
|
package/package.json
CHANGED
package/style-spec.js
CHANGED
|
@@ -57,6 +57,12 @@ export type StylePropertySpecification = {
|
|
|
57
57
|
length?: number,
|
|
58
58
|
transition: boolean,
|
|
59
59
|
default?: Array<string>
|
|
60
|
+
} | {
|
|
61
|
+
type: 'resolvedImage',
|
|
62
|
+
'property-type': ExpressionType,
|
|
63
|
+
expression?: ExpressionSpecification,
|
|
64
|
+
transition: boolean,
|
|
65
|
+
default?: string
|
|
60
66
|
};
|
|
61
67
|
|
|
62
68
|
import v8 from './reference/v8.json';
|