@mapbox/mapbox-gl-style-spec 14.4.0 → 14.5.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.
Files changed (142) hide show
  1. package/bin/gl-style-composite.js +0 -5
  2. package/bin/gl-style-format.js +0 -5
  3. package/bin/gl-style-migrate.js +0 -5
  4. package/bin/gl-style-validate.js +0 -5
  5. package/{composite.js → composite.ts} +1 -1
  6. package/data/{extent.js → extent.ts} +0 -2
  7. package/{deref.js → deref.ts} +7 -9
  8. package/{diff.js → diff.ts} +44 -21
  9. package/dist/index.cjs +794 -1226
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.ts +1746 -0
  12. package/dist/index.es.js +794 -1226
  13. package/dist/index.es.js.map +1 -1
  14. package/{empty.js → empty.ts} +1 -2
  15. package/error/{parsing_error.js → parsing_error.ts} +0 -2
  16. package/error/{validation_error.js → validation_error.ts} +5 -5
  17. package/expression/{compound_expression.js → compound_expression.ts} +29 -19
  18. package/expression/definitions/{assertion.js → assertion.ts} +16 -13
  19. package/expression/definitions/{at.js → at.ts} +12 -13
  20. package/expression/definitions/{case.js → case.ts} +12 -11
  21. package/expression/definitions/{coalesce.js → coalesce.ts} +11 -11
  22. package/expression/definitions/{coercion.js → coercion.ts} +21 -20
  23. package/expression/definitions/{collator.js → collator.ts} +11 -11
  24. package/expression/definitions/{comparison.js → comparison.ts} +30 -24
  25. package/expression/definitions/{config.js → config.ts} +16 -16
  26. package/expression/definitions/{distance.js → distance.ts} +60 -52
  27. package/expression/definitions/{format.js → format.ts} +26 -15
  28. package/expression/definitions/{image.js → image.ts} +12 -12
  29. package/expression/definitions/{in.js → in.ts} +22 -13
  30. package/expression/definitions/{index.js → index.ts} +70 -83
  31. package/expression/definitions/{index_of.js → index_of.ts} +24 -15
  32. package/expression/definitions/{interpolate.js → interpolate.ts} +44 -25
  33. package/expression/definitions/{length.js → length.ts} +11 -10
  34. package/expression/definitions/{let.js → let.ts} +10 -7
  35. package/expression/definitions/{literal.js → literal.ts} +11 -12
  36. package/expression/definitions/{match.js → match.ts} +25 -15
  37. package/expression/definitions/{number_format.js → number_format.ts} +10 -10
  38. package/expression/definitions/{slice.js → slice.ts} +23 -15
  39. package/expression/definitions/{step.js → step.ts} +14 -12
  40. package/expression/definitions/{var.js → var.ts} +5 -7
  41. package/expression/definitions/{within.js → within.ts} +41 -29
  42. package/expression/{evaluation_context.js → evaluation_context.ts} +26 -23
  43. package/expression/expression.ts +29 -0
  44. package/expression/{index.js → index.ts} +208 -110
  45. package/expression/{is_constant.js → is_constant.ts} +5 -7
  46. package/expression/{parsing_context.js → parsing_context.ts} +47 -34
  47. package/expression/{parsing_error.js → parsing_error.ts} +0 -2
  48. package/expression/{runtime_error.js → runtime_error.ts} +0 -2
  49. package/expression/{scope.js → scope.ts} +5 -5
  50. package/expression/{stops.js → stops.ts} +2 -4
  51. package/expression/types/{collator.js → collator.ts} +1 -3
  52. package/expression/types/{formatted.js → formatted.ts} +8 -7
  53. package/expression/types/{resolved_image.js → resolved_image.ts} +5 -7
  54. package/expression/{types.js → types.ts} +53 -45
  55. package/expression/{values.js → values.ts} +12 -12
  56. package/feature_filter/{convert.js → convert.ts} +19 -18
  57. package/feature_filter/{index.js → index.ts} +39 -21
  58. package/{format.js → format.ts} +3 -3
  59. package/function/{convert.js → convert.ts} +44 -44
  60. package/function/{index.js → index.ts} +12 -12
  61. package/{group_by_layout.js → group_by_layout.ts} +11 -8
  62. package/migrate/{expressions.js → expressions.ts} +7 -16
  63. package/migrate/{v8.js → v8.ts} +2 -2
  64. package/migrate/{v9.js → v9.ts} +2 -2
  65. package/{migrate.js → migrate.ts} +3 -3
  66. package/package.json +19 -18
  67. package/{read_style.js → read_style.ts} +5 -4
  68. package/reference/latest.ts +5 -0
  69. package/reference/v8.json +264 -7
  70. package/rollup.config.js +6 -24
  71. package/{style-spec.js → style-spec.ts} +41 -36
  72. package/test.js +3 -2
  73. package/types/config_options.ts +13 -0
  74. package/types/lut.ts +7 -0
  75. package/types/tile_id.ts +5 -0
  76. package/{types.js → types.ts} +527 -165
  77. package/util/{color.js → color.ts} +89 -3
  78. package/util/{color_spaces.js → color_spaces.ts} +12 -14
  79. package/util/{deep_equal.js → deep_equal.ts} +1 -3
  80. package/util/{extend.js → extend.ts} +1 -3
  81. package/util/{geometry_util.js → geometry_util.ts} +23 -11
  82. package/util/{get_type.js → get_type.ts} +1 -3
  83. package/util/{interpolate.js → interpolate.ts} +1 -3
  84. package/util/{properties.js → properties.ts} +5 -4
  85. package/util/{random.js → random.ts} +0 -2
  86. package/util/{ref_properties.js → ref_properties.ts} +0 -1
  87. package/util/{result.js → result.ts} +7 -5
  88. package/util/{unbundle_jsonlint.js → unbundle_jsonlint.ts} +5 -5
  89. package/validate/{validate.js → validate.ts} +33 -35
  90. package/validate/{validate_array.js → validate_array.ts} +5 -7
  91. package/validate/{validate_boolean.js → validate_boolean.ts} +3 -5
  92. package/validate/{validate_color.js → validate_color.ts} +3 -5
  93. package/validate/{validate_enum.js → validate_enum.ts} +4 -5
  94. package/validate/{validate_expression.js → validate_expression.ts} +7 -9
  95. package/validate/{validate_filter.js → validate_filter.ts} +16 -12
  96. package/validate/{validate_fog.js → validate_fog.ts} +4 -6
  97. package/validate/validate_formatted.ts +13 -0
  98. package/validate/{validate_function.js → validate_function.ts} +14 -16
  99. package/validate/{validate_glyphs_url.js → validate_glyphs_url.ts} +3 -5
  100. package/validate/validate_image.ts +13 -0
  101. package/validate/{validate_import.js → validate_import.ts} +6 -8
  102. package/validate/{validate_layer.js → validate_layer.ts} +17 -15
  103. package/validate/{validate_layout_property.js → validate_layout_property.ts} +3 -5
  104. package/validate/{validate_light.js → validate_light.ts} +4 -6
  105. package/validate/{validate_lights.js → validate_lights.ts} +7 -9
  106. package/validate/{validate_model.js → validate_model.ts} +4 -6
  107. package/validate/{validate_number.js → validate_number.ts} +4 -6
  108. package/validate/{validate_object.js → validate_object.ts} +5 -8
  109. package/validate/{validate_paint_property.js → validate_paint_property.ts} +3 -5
  110. package/validate/{validate_projection.js → validate_projection.ts} +4 -6
  111. package/validate/{validate_property.js → validate_property.ts} +15 -15
  112. package/validate/{validate_source.js → validate_source.ts} +16 -13
  113. package/validate/validate_string.ts +16 -0
  114. package/validate/validate_style.ts +33 -0
  115. package/validate/{validate_terrain.js → validate_terrain.ts} +5 -7
  116. package/{validate_mapbox_api_supported.js → validate_mapbox_api_supported.ts} +22 -18
  117. package/{validate_style.min.js → validate_style.min.ts} +20 -21
  118. package/{validate_style.js → validate_style.ts} +9 -9
  119. package/{visit.js → visit.ts} +22 -17
  120. package/.eslintrc +0 -10
  121. package/expression/expression.js +0 -28
  122. package/flow-typed/cheap-ruler.js +0 -25
  123. package/flow-typed/geojson.js +0 -44
  124. package/flow-typed/gl-matrix.js +0 -119
  125. package/flow-typed/gl.js +0 -5
  126. package/flow-typed/intl.js +0 -58
  127. package/flow-typed/kdbush.js +0 -9
  128. package/flow-typed/mapbox-gl-supported.js +0 -16
  129. package/flow-typed/mapbox-unitbezier.js +0 -14
  130. package/flow-typed/offscreen-canvas.js +0 -9
  131. package/flow-typed/pbf.js +0 -26
  132. package/flow-typed/point-geometry.js +0 -46
  133. package/flow-typed/potpack.js +0 -13
  134. package/flow-typed/tiny-sdf.js +0 -31
  135. package/flow-typed/tracked_parameters_proxy.js +0 -82
  136. package/flow-typed/vector-tile.js +0 -49
  137. package/flow-typed/webgl2.js +0 -41
  138. package/reference/latest.js +0 -7
  139. package/validate/validate_formatted.js +0 -15
  140. package/validate/validate_image.js +0 -15
  141. package/validate/validate_string.js +0 -18
  142. package/validate/validate_style.js +0 -29
@@ -1,27 +1,26 @@
1
- // @flow
2
- import latestStyleSpec from './reference/latest.js';
1
+ import latestStyleSpec from './reference/latest';
3
2
 
4
- import _validateStyle from './validate/validate_style.js';
5
- import _validateSource from './validate/validate_source.js';
6
- import _validateLight from './validate/validate_light.js';
7
- import _validateLights from './validate/validate_lights.js';
8
- import _validateTerrain from './validate/validate_terrain.js';
9
- import _validateFog from './validate/validate_fog.js';
10
- import _validateLayer from './validate/validate_layer.js';
11
- import _validateFilter from './validate/validate_filter.js';
12
- import _validatePaintProperty from './validate/validate_paint_property.js';
13
- import _validateLayoutProperty from './validate/validate_layout_property.js';
14
- import _validateModel from './validate/validate_model.js';
3
+ import _validateStyle from './validate/validate_style';
4
+ import _validateSource from './validate/validate_source';
5
+ import _validateLight from './validate/validate_light';
6
+ import _validateLights from './validate/validate_lights';
7
+ import _validateTerrain from './validate/validate_terrain';
8
+ import _validateFog from './validate/validate_fog';
9
+ import _validateLayer from './validate/validate_layer';
10
+ import _validateFilter from './validate/validate_filter';
11
+ import _validatePaintProperty from './validate/validate_paint_property';
12
+ import _validateLayoutProperty from './validate/validate_layout_property';
13
+ import _validateModel from './validate/validate_model';
15
14
 
16
- import type {StyleSpecification} from './types.js';
15
+ import type {StyleSpecification} from './types';
17
16
 
18
- export type ValidationError = interface {
19
- message: string,
20
- identifier?: ?string,
21
- line?: ?number,
17
+ export type ValidationError = {
18
+ message: string;
19
+ identifier?: string | null | undefined;
20
+ line?: number | null | undefined;
22
21
  };
23
- export type ValidationErrors = $ReadOnlyArray<ValidationError>;
24
- export type Validator = (Object) => ValidationErrors;
22
+ export type ValidationErrors = ReadonlyArray<ValidationError>;
23
+ export type Validator = (arg1: any) => ValidationErrors;
25
24
 
26
25
  /**
27
26
  * Validate a Mapbox GL style against the style specification. This entrypoint,
@@ -38,7 +37,7 @@ export type Validator = (Object) => ValidationErrors;
38
37
  * var validate = require('mapbox-gl-style-spec/lib/validate_style.min');
39
38
  * var errors = validate(style);
40
39
  */
41
- export function validateStyle(style: StyleSpecification, styleSpec: Object = latestStyleSpec): ValidationErrors {
40
+ export function validateStyle(style: StyleSpecification, styleSpec: any = latestStyleSpec): ValidationErrors {
42
41
  const errors = _validateStyle(style, styleSpec);
43
42
  return sortErrors(errors);
44
43
  }
@@ -1,10 +1,9 @@
1
- // @flow
2
- import {validateStyle as validateStyleMin} from './validate_style.min.js';
3
- import {v8} from './style-spec.js';
4
- import readStyle from './read_style.js';
1
+ import {validateStyle as validateStyleMin} from './validate_style.min';
2
+ import {v8} from './style-spec';
3
+ import readStyle from './read_style';
5
4
 
6
- import type {ValidationErrors} from './validate_style.min.js';
7
- import type {StyleSpecification} from './types.js';
5
+ import type {ValidationErrors} from './validate_style.min';
6
+ import type {StyleSpecification} from './types';
8
7
 
9
8
  /**
10
9
  * Validate a Mapbox GL style against the style specification.
@@ -22,15 +21,16 @@ import type {StyleSpecification} from './types.js';
22
21
  * var errors = validate(style);
23
22
  */
24
23
 
25
- export default function validateStyle(style: StyleSpecification | string | Buffer, styleSpec: Object = v8): ValidationErrors {
24
+ export default function validateStyle(style: StyleSpecification | string | Buffer, styleSpec: any = v8): ValidationErrors {
26
25
  let s = style;
27
26
 
28
27
  try {
29
28
  s = readStyle(s);
30
- } catch (e) {
29
+ } catch (e: any) {
31
30
  return [e];
32
31
  }
33
32
 
33
+ // @ts-expect-error - TS2345 - Argument of type 'string | StyleSpecification | Buffer' is not assignable to parameter of type 'StyleSpecification'.
34
34
  return validateStyleMin(s, styleSpec);
35
35
  }
36
36
 
@@ -45,4 +45,4 @@ export {
45
45
  validateFog as fog,
46
46
  validatePaintProperty as paintProperty,
47
47
  validateLayoutProperty as layoutProperty
48
- } from './validate_style.min.js';
48
+ } from './validate_style.min';
@@ -1,28 +1,26 @@
1
- // @flow
2
-
3
1
  import Reference from './reference/v8.json';
4
- import type {StylePropertySpecification} from './style-spec.js';
2
+ import type {StylePropertySpecification} from './style-spec';
5
3
  import type {
6
4
  StyleSpecification,
7
5
  SourceSpecification,
8
6
  LayerSpecification,
9
7
  PropertyValueSpecification,
10
8
  DataDrivenPropertyValueSpecification
11
- } from './types.js';
9
+ } from './types';
12
10
 
13
11
  function getPropertyReference(propertyName: string): StylePropertySpecification {
14
12
  for (let i = 0; i < Reference.layout.length; i++) {
15
13
  for (const key in Reference[Reference.layout[i]]) {
16
- if (key === propertyName) return (Reference[Reference.layout[i]][key]: any);
14
+ if (key === propertyName) return Reference[Reference.layout[i]][key];
17
15
  }
18
16
  }
19
17
  for (let i = 0; i < Reference.paint.length; i++) {
20
18
  for (const key in Reference[Reference.paint[i]]) {
21
- if (key === propertyName) return (Reference[Reference.paint[i]][key]: any);
19
+ if (key === propertyName) return Reference[Reference.paint[i]][key];
22
20
  }
23
21
  }
24
22
 
25
- return (null: any);
23
+ return null as any;
26
24
  }
27
25
 
28
26
  export function eachSource(style: StyleSpecification, callback: (_: SourceSpecification) => void) {
@@ -37,22 +35,29 @@ export function eachLayer(style: StyleSpecification, callback: (_: LayerSpecific
37
35
  }
38
36
  }
39
37
 
40
- type PropertyCallback = ({
41
- path: [string, 'paint' | 'layout', string], // [layerid, paint/layout, property key]
42
- key: string,
43
- value: PropertyValueSpecification<mixed> | DataDrivenPropertyValueSpecification<mixed>,
44
- reference: StylePropertySpecification,
45
- set: (PropertyValueSpecification<mixed> | DataDrivenPropertyValueSpecification<mixed>) => void
46
- }) => void;
38
+ type PropertyCallback = (
39
+ arg1: {
40
+ path: [string, 'paint' | 'layout', string] // [layerid, paint/layout, property key];
41
+ key: string;
42
+ value: PropertyValueSpecification<unknown> ;
43
+ reference: StylePropertySpecification;
44
+ set: (
45
+ arg1: PropertyValueSpecification<unknown>,
46
+ ) => void;
47
+ },
48
+ ) => void;
47
49
 
48
50
  export function eachProperty(
49
51
  style: StyleSpecification,
50
- options: {paint?: boolean, layout?: boolean},
52
+ options: {
53
+ paint?: boolean;
54
+ layout?: boolean;
55
+ },
51
56
  callback: PropertyCallback
52
57
  ) {
53
58
  function inner(layer: LayerSpecification, propertyType: 'paint' | 'layout') {
54
- if (layer.type === 'slot') return;
55
- const properties = (layer[propertyType]: any);
59
+ if (layer.type === 'slot' || layer.type === 'clip') return;
60
+ const properties = (layer[propertyType] as any);
56
61
  if (!properties) return;
57
62
  Object.keys(properties).forEach((key) => {
58
63
  callback({
package/.eslintrc DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "overrides": [
3
- {
4
- "files": ["rollup.config.js", "test.js"],
5
- "rules": {
6
- "flowtype/require-valid-file-annotation": "off"
7
- }
8
- }
9
- ]
10
- }
@@ -1,28 +0,0 @@
1
- // @flow
2
-
3
- import type {Type} from './types.js';
4
- import type {Class} from '../../types/class.js';
5
- import type ParsingContext from './parsing_context.js';
6
- import type EvaluationContext from './evaluation_context.js';
7
-
8
- export type SerializedExpression = Array<mixed> | Array<string> | string | number | boolean | null;
9
-
10
- export interface Expression {
11
- +type: Type;
12
-
13
- evaluate(ctx: EvaluationContext): any;
14
-
15
- eachChild(fn: Expression => void): void;
16
-
17
- /**
18
- * Statically analyze the expression, attempting to enumerate possible outputs. Returns
19
- * false if the complete set of outputs is statically undecidable, otherwise true.
20
- */
21
- outputDefined(): boolean;
22
-
23
- serialize(): SerializedExpression;
24
- }
25
-
26
- export type ExpressionParser = (args: $ReadOnlyArray<mixed>, context: ParsingContext) => ?Expression;
27
- export type ExpressionRegistration = Class<Expression> & { +parse: ExpressionParser };
28
- export type ExpressionRegistry = {[_: string]: ExpressionRegistration};
@@ -1,25 +0,0 @@
1
- // @flow strict
2
-
3
- declare module 'cheap-ruler' {
4
- import type { GeoJSONPosition} from '@mapbox/geojson-types';
5
- declare export default class CheapRuler {
6
- kx: number;
7
- ky: number;
8
- constructor(lat: number, units: string): CheapRuler;
9
- distance(a: GeoJSONPosition, b: GeoJSONPosition): number;
10
- bearing(a: GeoJSONPosition, b: GeoJSONPosition): number;
11
- destination(p: GeoJSONPosition, dist: number , bearing: number): GeoJSONPosition;
12
- offset(p: GeoJSONPosition, dx: number, dy: number): GeoJSONPosition;
13
- lineDistance(points: Array<GeoJSONPosition>): number;
14
- area(polygon: Array<Array<GeoJSONPosition>>): number;
15
- along(line: Array<GeoJSONPosition>, dist: number): GeoJSONPosition;
16
- pointToSegmentDistance(p: GeoJSONPosition, a: GeoJSONPosition, b: GeoJSONPosition): number;
17
- pointOnLine(line: Array<GeoJSONPosition>, p: GeoJSONPosition): Object;
18
- lineSlice(start: GeoJSONPosition, stop: GeoJSONPosition, line: Array<GeoJSONPosition>): Array<GeoJSONPosition>;
19
- lineSliceAlong(start: GeoJSONPosition, stop: GeoJSONPosition, line: Array<GeoJSONPosition>): Array<GeoJSONPosition>;
20
- bufferPoint(p: GeoJSONPosition, buffer: number): GeoJSONPosition;
21
- bufferBBox(bbox: GeoJSONPosition, buffer: number): GeoJSONPosition;
22
- insideBBox(p: GeoJSONPosition, bbox: GeoJSONPosition): boolean;
23
-
24
- }
25
- }
@@ -1,44 +0,0 @@
1
- // @flow strict
2
-
3
- type Geometry<T, C> = { type: T, coordinates: C }
4
-
5
- declare module "@mapbox/geojson-types" {
6
- declare export type GeoJSONPosition = [number, number] | [number, number, number];
7
-
8
- declare export type GeoJSONPoint = Geometry<'Point', GeoJSONPosition>;
9
- declare export type GeoJSONMultiPoint = Geometry<'MultiPoint', Array<GeoJSONPosition>>;
10
-
11
- declare export type GeoJSONLineString = Geometry<'LineString', Array<GeoJSONPosition>>;
12
- declare export type GeoJSONMultiLineString = Geometry<'MultiLineString', Array<Array<GeoJSONPosition>>>;
13
-
14
- declare export type GeoJSONPolygon = Geometry<'Polygon', Array<Array<GeoJSONPosition>>>;
15
- declare export type GeoJSONMultiPolygon = Geometry<'MultiPolygon', Array<Array<Array<GeoJSONPosition>>>>;
16
-
17
- declare export type GeoJSONGeometry =
18
- | GeoJSONPoint
19
- | GeoJSONMultiPoint
20
- | GeoJSONLineString
21
- | GeoJSONMultiLineString
22
- | GeoJSONPolygon
23
- | GeoJSONMultiPolygon
24
- | GeoJSONGeometryCollection;
25
-
26
- declare export type GeoJSONGeometryCollection = {
27
- type: 'GeometryCollection',
28
- geometries: Array<GeoJSONGeometry>
29
- };
30
-
31
- declare export interface GeoJSONFeature {
32
- type: 'Feature';
33
- geometry: ?GeoJSONGeometry;
34
- properties: ?{};
35
- id?: number | string;
36
- }
37
-
38
- declare export type GeoJSONFeatureCollection = {
39
- type: 'FeatureCollection',
40
- features: Array<GeoJSONFeature>
41
- };
42
-
43
- declare export type GeoJSON = GeoJSONGeometry | GeoJSONFeature | GeoJSONFeatureCollection;
44
- }
@@ -1,119 +0,0 @@
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
- distance(Vec3, Vec3): number,
23
- squaredLength(Vec3): number,
24
- dot(Vec3, Vec3): number,
25
- equals(Vec3, Vec3): boolean,
26
- exactEquals(Vec3, Vec3): boolean,
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
- set<T: Vec3>(T, number, number, number): T,
32
- subtract<T: Vec3>(T, Vec3, Vec3): T,
33
- cross<T: Vec3>(T, Vec3, Vec3): T,
34
- negate<T: Vec3>(T, Vec3): T,
35
- scale<T: Vec3>(T, Vec3, number): T,
36
- scaleAndAdd<T: Vec3>(T, Vec3, Vec3, number): T,
37
- multiply<T: Vec3>(T, Vec3, Vec3): T,
38
- mul<T: Vec3>(T, Vec3, Vec3): T,
39
- div<T: Vec3>(T, Vec3, Vec3): T,
40
- min<T: Vec3>(T, Vec3, Vec3): T,
41
- max<T: Vec3>(T, Vec3, Vec3): T,
42
- lerp<T: Vec3>(T, Vec3, Vec3, number): T,
43
- transformQuat<T: Vec3>(T, Vec3, Quat): T,
44
- transformMat3<T: Vec3>(T, Vec3, Mat3): T,
45
- transformMat4<T: Vec3>(T, Vec3, Mat4): T,
46
- angle(Vec3, Vec3): number;
47
- rotateX<T: Vec3>(T, Vec3, Vec3, number): T,
48
- rotateY<T: Vec3>(T, Vec3, Vec3, number): T,
49
- rotateZ<T: Vec3>(T, Vec3, Vec3, number): T,
50
- };
51
-
52
- declare var vec4: {
53
- scale<T: Vec4>(T, Vec4, number): T,
54
- mul<T: Vec4>(T, Vec4, Vec4): T,
55
- transformMat4<T: Vec4>(T, Vec4, Mat4): T,
56
- normalize<T: Vec4>(T, Vec4): T,
57
- dot(Vec4, Vec4): number,
58
- min<T: Vec4>(T, Vec4, Vec4): T,
59
- max<T: Vec4>(T, Vec4, Vec4): T,
60
- };
61
-
62
- declare var mat2: {
63
- create(): Float32Array,
64
- rotate<T: Mat2>(T, Mat2, number): T,
65
- invert<T: Mat2>(T, Mat2): T,
66
- scale<T: Mat2>(T, Mat2, Vec2): T
67
- };
68
-
69
- declare var mat3: {
70
- create(): Float32Array,
71
-
72
- fromMat4<T: Mat3>(T, Mat4): T,
73
- fromRotation<T: Mat3>(T, number): T,
74
- mul<T: Mat3>(T, Mat3, Mat3): T,
75
- multiply<T: Mat3>(T, Mat3, Mat3): T,
76
- adjoint<T: Mat3>(T, Mat3): T,
77
- invert<T: Mat3>(T, Mat3): T,
78
- transpose<T: Mat3>(T, Mat3): T
79
- };
80
-
81
- declare var mat4: {
82
- create(): Float32Array,
83
-
84
- fromScaling<T: Mat4>(T, Vec3): T,
85
- fromTranslation<T: Mat4>(T, Vec3): T,
86
- fromQuat<T: Mat4>(T, Quat): T,
87
- fromRotationTranslationScale<T: Mat4>(T, Quat, Vec3, Vec3): T,
88
- ortho<T: Mat4>(T, number, number, number, number, number, number): T,
89
- perspective<T: Mat4>(T, number, number, number, number): T,
90
- identity<T: Mat4>(T): T,
91
- scale<T: Mat4>(T, Mat4, Vec3): T,
92
- mul<T: Mat4>(T, Mat4, Mat4): T,
93
- multiply<T: Mat4>(T, Mat4, Mat4): T,
94
- rotateX<T: Mat4>(T, Mat4, number): T,
95
- rotateY<T: Mat4>(T, Mat4, number): T,
96
- rotateZ<T: Mat4>(T, Mat4, number): T,
97
- rotate<T: Mat4>(T, Mat4, number, Vec3): T,
98
- fromRotation<T: Mat4>(T, number, Vec3): T,
99
- translate<T: Mat4>(T, Mat4, Vec3): T,
100
- invert<T: Mat4>(T, Mat4): T,
101
- transpose<T: Mat4>(T, Mat4): T,
102
- copy<T: Mat4>(T, Mat4): T,
103
- clone<T: Mat4>(T): T
104
- };
105
-
106
- declare var quat: {
107
- create(): Float32Array,
108
- length(Quat): number,
109
- exactEquals(Quat, Quat): boolean,
110
-
111
- normalize<T: Quat>(T, Quat): T,
112
- conjugate<T: Quat>(T, Quat): T,
113
- identity<T: Quat>(T): T,
114
- rotateX<T: Quat>(T, Quat, number): T,
115
- rotateY<T: Quat>(T, Quat, number): T,
116
- rotateZ<T: Quat>(T, Quat, number): T,
117
- rotationTo<T:Quat>(T, Quat, Quat): T
118
- }
119
- }
package/flow-typed/gl.js DELETED
@@ -1,5 +0,0 @@
1
- // @flow strict
2
- declare module "gl" {
3
- declare function gl(width: number, height: number, attributes: WebGLContextAttributes): WebGL2RenderingContext;
4
- declare module.exports: typeof gl;
5
- }
@@ -1,58 +0,0 @@
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
- }
@@ -1,9 +0,0 @@
1
- // @flow strict
2
- declare module 'kdbush' {
3
- declare export default class KDBush {
4
- constructor(numPoints: number, nodeSize?: number, arrayType?: Class<$ArrayBufferView>): KDBush;
5
- add(x: number, y: number): number;
6
- finish(): void;
7
- range(minX: number, minY: number, maxX: number, maxY: number): Array<number>;
8
- }
9
- }
@@ -1,16 +0,0 @@
1
- // @flow
2
- 'use strict';
3
- declare module "@mapbox/mapbox-gl-supported" {
4
- declare type SupportedOptions = {failIfMajorPerformanceCaveat: boolean};
5
-
6
- declare type SupportedFn = {
7
- (options?: SupportedOptions): boolean,
8
- webGLContextAttributes: WebGLContextAttributes
9
- };
10
- declare function notSupportedReason(options?: SupportedOptions): ?string;
11
-
12
- declare module.exports: {
13
- supported: SupportedFn;
14
- notSupportedReason: typeof notSupportedReason;
15
- }
16
- }
@@ -1,14 +0,0 @@
1
- 'use strict';
2
- // @flow
3
-
4
- declare module "@mapbox/unitbezier" {
5
- declare class UnitBezier {
6
- constructor(p1x: number, p1y: number, p2x: number, p2y: number): UnitBezier;
7
- sampleCurveX(t: number): number;
8
- sampleCurveY(t: number): number;
9
- sampleCurveDerivativeX(t: number): number;
10
- solveCurveX(x: number, epsilon: number | void): number;
11
- solve(x: number, epsilon: number | void): number;
12
- }
13
- declare module.exports: typeof UnitBezier;
14
- }
@@ -1,9 +0,0 @@
1
- // @flow strict
2
-
3
- declare class OffscreenCanvas {
4
- width: number;
5
- height: number;
6
-
7
- constructor(width: number, height: number): OffscreenCanvas;
8
- getContext(contextType: '2d'): CanvasRenderingContext2D;
9
- }
package/flow-typed/pbf.js DELETED
@@ -1,26 +0,0 @@
1
- // @flow
2
- declare module "pbf" {
3
- declare type ReadFunction<T> = (tag: number, result: T, pbf: Pbf) => void;
4
-
5
- declare class Pbf {
6
- constructor(buf?: ArrayBuffer | Uint8Array): Pbf;
7
-
8
- readFields<T>(readField: ReadFunction<T>, result: T, end?: number): T;
9
- readMessage<T>(readField: ReadFunction<T>, result: T): T;
10
-
11
- readFixed32(): number;
12
- readSFixed32(): number;
13
- readFixed64(): number;
14
- readSFixed64(): number;
15
- readFloat(): number;
16
- readDouble(): number;
17
- readVarint(): number;
18
- readVarint64(): number;
19
- readSVarint(): number;
20
- readBoolean(): boolean;
21
- readString(): string;
22
- readBytes(): Uint8Array;
23
- }
24
-
25
- declare export default Class<Pbf>;
26
- }
@@ -1,46 +0,0 @@
1
- // @flow strict
2
- declare module "@mapbox/point-geometry" {
3
- declare export type PointLike = Point | [number, number];
4
-
5
- declare class Point {
6
- x: number;
7
- y: number;
8
- constructor(x: number, y: number): Point;
9
- clone(): Point;
10
- add(point: Point): Point;
11
- sub(point: Point): Point;
12
- multByPoint(point: Point): Point;
13
- divByPoint(point: Point): Point;
14
- mult(k: number): Point;
15
- div(k: number): Point;
16
- rotate(angle: number): Point;
17
- rotateAround(angle: number, point: Point): Point;
18
- matMult(matrix: [number, number, number, number]): Point;
19
- unit(): Point;
20
- perp(): Point;
21
- round(): Point;
22
- mag(): number;
23
- equals(point: Point): boolean;
24
- dist(point: Point): number;
25
- distSqr(point: Point): number;
26
- angle(): number;
27
- angleTo(point: Point): number;
28
- angleWith(point: Point): number;
29
- angleWithSep(x: number, y: number): number;
30
- _matMult(matrix: [number, number, number, number]): Point;
31
- _add(point: Point): Point;
32
- _sub(point: Point): Point;
33
- _mult(k: number): Point;
34
- _div(k: number): Point;
35
- _multByPoint(point: Point): Point;
36
- _divByPoint(point: Point): Point;
37
- _unit(): Point;
38
- _perp(): Point;
39
- _rotate(angle: number): Point;
40
- _rotateAround(angle: number, point: Point): Point;
41
- _round(): Point;
42
- static convert(a: PointLike): Point;
43
- }
44
-
45
- declare export default Class<Point>;
46
- }
@@ -1,13 +0,0 @@
1
- // @flow
2
- declare module "potpack" {
3
- declare type Bin = {
4
- x: number,
5
- y: number,
6
- w: number,
7
- h: number
8
- };
9
-
10
- declare function potpack(bins: Array<Bin>): {w: number, h: number, fill: number};
11
-
12
- declare module.exports: typeof potpack;
13
- }
@@ -1,31 +0,0 @@
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
- }