Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mapbox-gl

Package Overview
Dependencies
Maintainers
28
Versions
228
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mapbox-gl - npm Package Compare versions

Comparing version 2.13.0 to 2.14.0-beta.1

12

flow-typed/geojson.js

@@ -30,8 +30,8 @@ // @flow strict

declare export type GeoJSONFeature = {
type: 'Feature',
geometry: ?GeoJSONGeometry,
properties: ?{},
id?: number | string
};
declare export interface GeoJSONFeature {
type: 'Feature';
geometry: ?GeoJSONGeometry;
properties: ?{};
id?: number | string;
}

@@ -38,0 +38,0 @@ declare export type GeoJSONFeatureCollection = {

{
"name": "mapbox-gl",
"description": "A WebGL interactive maps library",
"version": "2.13.0",
"version": "2.14.0-beta.1",
"main": "dist/mapbox-gl.js",

@@ -52,3 +52,3 @@ "style": "dist/mapbox-gl.css",

"cross-env": "^7.0.3",
"cssnano": "^5.1.13",
"cssnano": "^6.0.0",
"d3": "^7.6.1",

@@ -65,3 +65,3 @@ "d3-queue": "^3.0.7",

"eslint-plugin-jsdoc": "^39.6.4",
"flow-bin": "0.152.0",
"flow-bin": "0.188.0",
"gl": "6.0.2",

@@ -85,3 +85,3 @@ "glob": "^8.0.3",

"pretty-bytes": "^6.0.0",
"puppeteer-core": "^19.3.0",
"puppeteer-core": "^19.7.0",
"qrcode-terminal": "^0.12.0",

@@ -91,4 +91,4 @@ "rollup": "^2.78.1",

"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-unassert": "^0.5.0",
"selenium-webdriver": "^4.4.0",
"rollup-plugin-unassert": "^0.6.0",
"selenium-webdriver": "^4.8.0",
"serve-static": "^1.15.0",

@@ -152,2 +152,3 @@ "shuffle-seed": "^1.1.6",

"print-release-url": "node build/print-release-url.js",
"check-bundle-size": "node build/check-bundle-size.js",
"codegen": "build/run-node build/generate-style-code.js && build/run-node build/generate-struct-arrays.js"

@@ -154,0 +155,0 @@ },

@@ -110,2 +110,3 @@ // @flow

// $FlowFixMe[method-unbinding]
if (!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom), evaluationFeature, canonical)) continue;

@@ -112,0 +113,0 @@

@@ -92,2 +92,3 @@ // @flow

// $FlowFixMe[method-unbinding]
if (!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom), evaluationFeature, canonical)) continue;

@@ -94,0 +95,0 @@

@@ -246,2 +246,3 @@ // @flow

// $FlowFixMe[method-unbinding]
if (!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom), evaluationFeature, canonical)) continue;

@@ -248,0 +249,0 @@

@@ -149,2 +149,3 @@ // @flow

// $FlowFixMe[method-unbinding]
if (!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom), evaluationFeature, canonical)) continue;

@@ -151,0 +152,0 @@

@@ -509,2 +509,3 @@ // @flow

const evaluationFeature = toEvaluationFeature(feature, needGeometry);
// $FlowFixMe[method-unbinding]
if (!layer._featureFilter.filter(globalProperties, evaluationFeature, canonical)) {

@@ -511,0 +512,0 @@ continue;

@@ -26,2 +26,14 @@ // @flow

function unpackMapbox(r: number, g: number, b: number): number {
// unpacking formula for mapbox.terrain-rgb:
// https://www.mapbox.com/help/access-elevation-data/#mapbox-terrain-rgb
return ((r * 256 * 256 + g * 256.0 + b) / 10.0 - 10000.0);
}
function unpackTerrarium(r: number, g: number, b: number): number {
// unpacking formula for mapzen terrarium:
// https://aws.amazon.com/public-datasets/terrain/
return ((r * 256 + g + b / 256) - 32768.0);
}
export default class DEMData {

@@ -90,3 +102,3 @@ uid: number;

const index = this._idx(x, y) * 4;
const unpack = this.encoding === "terrarium" ? this._unpackTerrarium : this._unpackMapbox;
const unpack = this.encoding === "terrarium" ? unpackTerrarium : unpackMapbox;
return unpack(this.pixels[index], this.pixels[index + 1], this.pixels[index + 2]);

@@ -108,14 +120,2 @@ }

_unpackMapbox(r: number, g: number, b: number): number {
// unpacking formula for mapbox.terrain-rgb:
// https://www.mapbox.com/help/access-elevation-data/#mapbox-terrain-rgb
return ((r * 256 * 256 + g * 256.0 + b) / 10.0 - 10000.0);
}
_unpackTerrarium(r: number, g: number, b: number): number {
// unpacking formula for mapzen terrarium:
// https://aws.amazon.com/public-datasets/terrain/
return ((r * 256 + g + b / 256) - 32768.0);
}
static pack(altitude: number, encoding: DEMEncoding): [number, number, number, number] {

@@ -122,0 +122,0 @@ const color = [0, 0, 0, 0];

@@ -195,5 +195,7 @@ // @flow

const evaluationFeature = toEvaluationFeature(feature, true);
// $FlowFixMe[method-unbinding]
if (!filter.filter(new EvaluationParameters(this.tileID.overscaledZ), evaluationFeature, this.tileID.canonical)) {
return;
}
// $FlowFixMe[method-unbinding]
} else if (!filter.filter(new EvaluationParameters(this.tileID.overscaledZ), feature)) {

@@ -309,4 +311,5 @@ return;

const propName = typeof this.promoteId === 'string' ? this.promoteId : this.promoteId[sourceLayerId];
// $FlowFixMe[incompatible-type] - Flow can't narrow the id type from IVectorTileFeature.id
if (propName != null) id = feature.properties[propName];
if (typeof id === 'boolean') id = Number(id);
if (typeof id === 'boolean') id = Number(id);
}

@@ -313,0 +316,0 @@ return id;

@@ -35,3 +35,3 @@ // @flow

// a subset of VectorTileGeometry
type FeatureWithGeometry = {
interface FeatureWithGeometry {
extent: number;

@@ -38,0 +38,0 @@ type: 1 | 2 | 3;

@@ -109,3 +109,5 @@ // @flow

// $FlowFixMe[method-unbinding]
getBinding(context: Context, _: string): $Shape<Uniform<any>> {
// $FlowFixMe[method-unbinding]
return (this.type === 'color') ?

@@ -140,3 +142,5 @@ new UniformColor(context) :

// $FlowFixMe[method-unbinding]
getBinding(context: Context, name: string): $Shape<Uniform<any>> {
// $FlowFixMe[method-unbinding]
return name === 'u_pattern' || name === 'u_dash' ?

@@ -173,2 +177,3 @@ new Uniform4f(context) :

assert(Array.isArray(availableImages));
// $FlowFixMe[method-unbinding]
const value = this.expression.evaluate(new EvaluationParameters(0), feature, {}, canonical, availableImages, formattedSection);

@@ -244,3 +249,5 @@ this.paintVertexArray.resize(newLength);

populatePaintArray(newLength: number, feature: Feature, imagePositions: SpritePositions, availableImages: Array<string>, canonical?: CanonicalTileID, formattedSection?: FormattedSection) {
// $FlowFixMe[method-unbinding]
const min = this.expression.evaluate(new EvaluationParameters(this.zoom), feature, {}, canonical, availableImages, formattedSection);
// $FlowFixMe[method-unbinding]
const max = this.expression.evaluate(new EvaluationParameters(this.zoom + 1), feature, {}, canonical, availableImages, formattedSection);

@@ -295,2 +302,3 @@ const start = this.paintVertexArray.length;

// $FlowFixMe[method-unbinding]
getBinding(context: Context, _: string): Uniform1f {

@@ -395,3 +403,3 @@ return new Uniform1f(context);

const type = value.property.specification.type;
const useIntegerZoom = value.property.useIntegerZoom;
const useIntegerZoom = !!value.property.useIntegerZoom;
const isPattern = property === 'line-dasharray' || property.endsWith('pattern');

@@ -409,4 +417,9 @@ const sourceException = property === 'line-dasharray' && (layer.layout: any).get('line-cap').value.kind !== 'constant';

this.binders[property] = isPattern ?
// $FlowFixMe[prop-missing]
// $FlowFixMe[incompatible-call] - expression can be a `composite` or `constant` kind expression
new PatternCompositeBinder(expression, names, type, StructArrayLayout, layer.id) :
// $FlowFixMe[prop-missing]
// $FlowFixMe[incompatible-call] - expression can be a `composite` or `constant` kind expression
new SourceExpressionBinder(expression, names, type, StructArrayLayout);
keys.push(`/a_${property}`);

@@ -416,2 +429,4 @@

const StructArrayLayout = layoutType(property, type, 'composite');
// $FlowFixMe[prop-missing]
// $FlowFixMe[incompatible-call] — expression can be a `constant` kind expression
this.binders[property] = new CompositeExpressionBinder(expression, names, type, useIntegerZoom, zoom, StructArrayLayout);

@@ -671,2 +686,3 @@ keys.push(`/z_${property}`);

const layoutException = propertyExceptions[property];
// $FlowFixMe[prop-missing] - we don't cover all types in defaultLayouts for some reason
return (layoutException && layoutException[binderType]) || defaultLayouts[type][binderType];

@@ -673,0 +689,0 @@ }

@@ -100,2 +100,3 @@ // @flow

} else if (Array.isArray(obj)) {
// $FlowFixMe[method-unbinding]
if (obj.length === 4 || obj.every(Array.isArray)) {

@@ -108,3 +109,3 @@ const lngLatBoundsObj = ((obj: any): LngLatBoundsLike);

}
} else if (typeof obj === 'object' && obj !== null && obj.hasOwnProperty("lat") && obj.hasOwnProperty("lon")) {
} else if (typeof obj === 'object' && obj !== null && obj.hasOwnProperty("lat") && (obj.hasOwnProperty("lon") || obj.hasOwnProperty("lng"))) {
return this.extend(LngLat.convert(obj));

@@ -111,0 +112,0 @@ } else {

@@ -117,3 +117,3 @@ // @flow

export function getTilePoint(tileTransform: TileTransform, {x, y}: {x: number, y: number}, wrap: number = 0): Point {
export function getTilePoint(tileTransform: TileTransform, {x, y}: interface { x: number, y: number }, wrap: number = 0): Point {
return new Point(

@@ -120,0 +120,0 @@ ((x - wrap) * tileTransform.scale - tileTransform.x) * EXTENT,

@@ -148,3 +148,3 @@ // @flow

const neighborCoord = [
coord => {
(coord: OverscaledTileID) => {
let x = coord.canonical.x - 1;

@@ -158,3 +158,3 @@ let w = coord.wrap;

},
coord => {
(coord: OverscaledTileID) => {
let x = coord.canonical.x + 1;

@@ -161,0 +161,0 @@ let w = coord.wrap;

@@ -65,3 +65,3 @@ // @flow

const textureFilter = layer.paint.get('raster-resampling') === 'nearest' ? gl.NEAREST : gl.LINEAR;
const textureFilter = layer.paint.get('raster-resampling') === 'nearest' ? gl.NEAREST : gl.LINEAR;

@@ -82,2 +82,8 @@ context.activeTexture.set(gl.TEXTURE0);

// Enable trilinear filtering on tiles only beyond 20 degrees pitch,
// to prevent it from compromising image crispness on flat or low tilted maps.
if (tile.texture.useMipmap && context.extTextureFilterAnisotropic && painter.transform.pitch > 20) {
gl.texParameterf(gl.TEXTURE_2D, context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, context.extTextureFilterAnisotropicMax);
}
const perspectiveTransform = source instanceof ImageSource ? source.perspectiveTransform : [0, 0];

@@ -84,0 +90,0 @@ const uniformValues = rasterUniformValues(projMatrix, parentTL || [0, 0], parentScaleBy || 1, fade, layer, perspectiveTransform);

@@ -298,3 +298,3 @@ // @flow

let globeCameraUp = mercatorCameraUp;
let globeCameraUp: [number, number, number] = mercatorCameraUp;
if ((isGlobeProjection || tr.mercatorFromTransition) && !rotateWithMap) {

@@ -301,0 +301,0 @@ // Each symbol rotating with the viewport requires per-instance information about

@@ -255,2 +255,3 @@ // @flow

if (!this.atlasTexture) return; // Flow can't infer that atlasTexture is defined here
this.atlasTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);

@@ -257,0 +258,0 @@ }

@@ -557,4 +557,5 @@ // @flow

// This texture is used for occlusion testing (labels)
if (this.terrain && (this.style.hasSymbolLayers() || this.style.hasCircleLayers())) {
this.terrain.drawDepth();
const terrain = this.terrain;
if (terrain && (this.style.hasSymbolLayers() || this.style.hasCircleLayers())) {
terrain.drawDepth();
}

@@ -561,0 +562,0 @@

@@ -37,2 +37,3 @@ // @flow

// $FlowFixMe[method-unbinding]
set(program: WebGLProgram, name: string, v: number): void {

@@ -53,2 +54,3 @@ if (!this.fetchUniformLocation(program, name)) return;

// $FlowFixMe[method-unbinding]
set(program: WebGLProgram, name: string, v: number): void {

@@ -69,2 +71,3 @@ if (!this.fetchUniformLocation(program, name)) return;

// $FlowFixMe[method-unbinding]
set(program: WebGLProgram, name: string, v: [number, number]): void {

@@ -85,2 +88,3 @@ if (!this.fetchUniformLocation(program, name)) return;

// $FlowFixMe[method-unbinding]
set(program: WebGLProgram, name: string, v: [number, number, number]): void {

@@ -101,2 +105,3 @@ if (!this.fetchUniformLocation(program, name)) return;

// $FlowFixMe[method-unbinding]
set(program: WebGLProgram, name: string, v: [number, number, number, number]): void {

@@ -118,2 +123,3 @@ if (!this.fetchUniformLocation(program, name)) return;

// $FlowFixMe[method-unbinding]
set(program: WebGLProgram, name: string, v: Color): void {

@@ -136,2 +142,3 @@ if (!this.fetchUniformLocation(program, name)) return;

// $FlowFixMe[method-unbinding]
set(program: WebGLProgram, name: string, v: Float32Array): void {

@@ -164,2 +171,3 @@ if (!this.fetchUniformLocation(program, name)) return;

// $FlowFixMe[method-unbinding]
set(program: WebGLProgram, name: string, v: Float32Array): void {

@@ -184,2 +192,3 @@ if (!this.fetchUniformLocation(program, name)) return;

// $FlowFixMe[method-unbinding]
set(program: WebGLProgram, name: string, v: Float32Array): void {

@@ -186,0 +195,0 @@ if (!this.fetchUniformLocation(program, name)) return;

@@ -165,2 +165,3 @@ // @flow

// $FlowFixMe[method-unbinding]
onAdd(map: Map) {

@@ -174,2 +175,3 @@ this.map = map;

// $FlowFixMe[method-unbinding]
onRemove() {

@@ -194,2 +196,3 @@ this.pause();

// $FlowFixMe[method-unbinding]
prepare() {

@@ -196,0 +199,0 @@ let resize = false;

@@ -201,8 +201,11 @@ // @flow

// $FlowFixMe[prop-missing]
// $FlowFixMe[method-unbinding]
implementation.update = this._update.bind(this);
// $FlowFixMe[prop-missing]
// $FlowFixMe[method-unbinding]
implementation.clearTiles = this._clearTiles.bind(this);
// $FlowFixMe[prop-missing]
// $FlowFixMe[method-unbinding]
implementation.coveringTiles = this._coveringTiles.bind(this);

@@ -227,2 +230,3 @@

// $FlowFixMe[method-unbinding]
onAdd(map: Map): void {

@@ -236,2 +240,3 @@ this._map = map;

// $FlowFixMe[method-unbinding]
onRemove(map: Map): void {

@@ -243,2 +248,3 @@ if (this._implementation.onRemove) {

// $FlowFixMe[method-unbinding]
hasTile(tileID: OverscaledTileID): boolean {

@@ -319,2 +325,3 @@ if (this._implementation.hasTile) {

// $FlowFixMe[method-unbinding]
unloadTile(tile: Tile, callback: Callback<void>): void {

@@ -330,2 +337,3 @@ this.unloadTileData(tile);

// $FlowFixMe[method-unbinding]
abortTile(tile: Tile, callback: Callback<void>): void {

@@ -332,0 +340,0 @@ if (tile.request && tile.request.cancel) {

@@ -151,2 +151,3 @@ // @flow

// $FlowFixMe[method-unbinding]
onAdd(map: Map) {

@@ -379,2 +380,3 @@ this.map = map;

// $FlowFixMe[method-unbinding]
abortTile(tile: Tile) {

@@ -388,2 +390,3 @@ if (tile.request) {

// $FlowFixMe[method-unbinding]
unloadTile(tile: Tile) {

@@ -394,2 +397,3 @@ tile.unloadVectorData();

// $FlowFixMe[method-unbinding]
onRemove() {

@@ -396,0 +400,0 @@ if (this._pendingLoad) {

@@ -206,2 +206,3 @@ // @flow

*/
// $FlowFixMe[duplicate-class-member]
loadGeoJSON(params: LoadGeoJSONParameters, callback: ResponseCallback<Object>): void {

@@ -208,0 +209,0 @@ // Because of same origin issues, urls must either include an explicit

@@ -6,2 +6,3 @@ // @flow

import {VectorTileFeature} from '@mapbox/vector-tile';
// $FlowFixMe[method-unbinding]
const toGeoJSON = VectorTileFeature.prototype.toGeoJSON;

@@ -8,0 +9,0 @@ import EXTENT from '../data/extent.js';

@@ -231,2 +231,3 @@ // @flow

// $FlowFixMe[method-unbinding]
onAdd(map: Map) {

@@ -237,2 +238,3 @@ this.map = map;

// $FlowFixMe[method-unbinding]
onRemove() {

@@ -283,2 +285,3 @@ if (this._imageRequest) {

// transform the geo coordinates into (zoom 0) tile space coordinates
// $FlowFixMe[method-unbinding]
const cornerCoords = coordinates.map(MercatorCoordinate.fromLngLat);

@@ -299,2 +302,3 @@

// $FlowFixMe[method-unbinding]
_clear() {

@@ -339,2 +343,3 @@ this._boundsArray = undefined;

// $FlowFixMe[method-unbinding]
prepare() {

@@ -341,0 +346,0 @@ if (Object.keys(this.tiles).length === 0 || !this.image) return;

@@ -23,7 +23,7 @@ // @flow

*/
export default function(tile: {tileID: OverscaledTileID, tileSize: number}, pixelValue: number, z: number): number {
export default function(tile: interface {tileID: OverscaledTileID, tileSize: number}, pixelValue: number, z: number): number {
return pixelValue * (EXTENT / (tile.tileSize * Math.pow(2, z - tile.tileID.overscaledZ)));
}
export function getPixelsToTileUnitsMatrix(tile: {tileID: OverscaledTileID, tileSize: number, +tileTransform: TileTransform}, transform: Transform): Float32Array {
export function getPixelsToTileUnitsMatrix(tile: interface {tileID: OverscaledTileID, tileSize: number, +tileTransform: TileTransform}, transform: Transform): Float32Array {
const {scale} = tile.tileTransform;

@@ -30,0 +30,0 @@ const s = scale * EXTENT / (tile.tileSize * Math.pow(2, transform.zoom - tile.tileID.overscaledZ + tile.tileID.canonical.z));

@@ -81,3 +81,3 @@ // @flow

serializedLayers: {[_: string]: StyleLayer},
getLayerSourceCache: (layer: StyleLayer) => SourceCache,
getLayerSourceCache: (layer: StyleLayer) => SourceCache | void,
queryGeometry: Array<Point>,

@@ -141,2 +141,4 @@ params: { filter: FilterSpecification, layers: Array<string>, availableImages: Array<string> },

const sourceCache = getLayerSourceCache(layer);
if (!sourceCache) return;
const state = sourceCache.getFeatureState(feature.layer['source-layer'], feature.id);

@@ -143,0 +145,0 @@ feature.source = feature.layer.source;

@@ -20,2 +20,3 @@ // @flow

// $FlowFixMe[method-unbinding]
class RasterDEMTileSource extends RasterTileSource implements Source {

@@ -120,2 +121,3 @@ encoding: "mapbox" | "terrarium";

// $FlowFixMe[method-unbinding]
unloadTile(tile: Tile) {

@@ -122,0 +124,0 @@ if (tile.demTexture) this.map.painter.saveTileTexture(tile.demTexture);

@@ -116,2 +116,3 @@ // @flow

// $FlowFixMe[method-unbinding]
onAdd(map: Map) {

@@ -128,2 +129,3 @@ this.map = map;

*/
// $FlowFixMe[method-unbinding]
reload() {

@@ -178,2 +180,3 @@ this.cancelTileJSONRequest();

// $FlowFixMe[method-unbinding]
onRemove() {

@@ -187,2 +190,3 @@ this.cancelTileJSONRequest();

// $FlowFixMe[method-unbinding]
hasTile(tileID: OverscaledTileID): boolean {

@@ -229,2 +233,3 @@ return !this.tileBounds || this.tileBounds.contains(tileID.canonical);

// $FlowFixMe[method-unbinding]
abortTile(tile: Tile, callback: Callback<void>) {

@@ -238,2 +243,3 @@ if (tile.request) {

// $FlowFixMe[method-unbinding]
unloadTile(tile: Tile, callback: Callback<void>) {

@@ -240,0 +246,0 @@ if (tile.texture) this.map.painter.saveTileTexture(tile.texture);

@@ -28,3 +28,3 @@ // @flow

let pluginStatus = status.unavailable;
let pluginURL = null;
let pluginURL: ?string = null;

@@ -31,0 +31,0 @@ export const triggerPluginCompletionEvent = function(error: ?Error) {

@@ -56,3 +56,2 @@ // @flow

transform: Transform;
_isIdRenderable: (id: number, symbolLayer?: boolean) => boolean;
used: boolean;

@@ -94,2 +93,3 @@ usedForTerrain: boolean;

this._tiles = {};
// $FlowFixMe[method-unbinding]
this._cache = new TileCache(0, this._unloadTile.bind(this));

@@ -251,2 +251,3 @@ this._timers = {};

// $FlowFixMe[method-unbinding]
this._loadTile(tile, this._tileLoaded.bind(this, tile, id, state));

@@ -749,3 +750,3 @@ }

_addTile(tileID: OverscaledTileID): Tile {
let tile = this._tiles[tileID.key];
let tile: ?Tile = this._tiles[tileID.key];
if (tile) return tile;

@@ -770,2 +771,3 @@

tile = new Tile(tileID, this._source.tileSize * tileID.overscaleFactor(), this.transform.tileZoom, painter, this._isRaster);
// $FlowFixMe[method-unbinding]
this._loadTile(tile, this._tileLoaded.bind(this, tile, tileID.key, tile.state));

@@ -772,0 +774,0 @@ }

@@ -11,2 +11,3 @@ // @flow

import type {Callback} from '../types/callback.js';
import type {MapEvent} from '../ui/events.js';
import {CanonicalTileID} from './tile_id.js';

@@ -62,3 +63,3 @@

fire(event: Event): mixed;
on(type: *, listener: (Object) => any): Evented;
on(type: MapEvent, listener: (Object) => any): Evented;
setEventedParent(parent: ?Evented, data?: Object | () => Object): Evented;

@@ -65,0 +66,0 @@

@@ -466,3 +466,5 @@ // @flow

const evaluationFeature = toEvaluationFeature(feature, true);
// $FlowFixMe[method-unbinding]
if (!filter.filter(new EvaluationParameters(this.tileID.overscaledZ), evaluationFeature, this.tileID.canonical)) continue;
// $FlowFixMe[method-unbinding]
} else if (!filter.filter(new EvaluationParameters(this.tileID.overscaledZ), feature)) {

@@ -609,6 +611,2 @@ continue;

this.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);
if (context.extTextureFilterAnisotropic) {
gl.texParameterf(gl.TEXTURE_2D, context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, context.extTextureFilterAnisotropicMax);
}
}

@@ -615,0 +613,0 @@ }

@@ -137,2 +137,3 @@ // @flow

// $FlowFixMe[method-unbinding]
hasTile(tileID: OverscaledTileID): boolean {

@@ -142,2 +143,3 @@ return !this.tileBounds || this.tileBounds.contains(tileID.canonical);

// $FlowFixMe[method-unbinding]
onAdd(map: Map) {

@@ -154,2 +156,3 @@ this.map = map;

*/
// $FlowFixMe[method-unbinding]
reload() {

@@ -205,2 +208,3 @@ this.cancelTileJSONRequest();

// $FlowFixMe[method-unbinding]
onRemove() {

@@ -295,2 +299,3 @@ this.cancelTileJSONRequest();

// $FlowFixMe[method-unbinding]
abortTile(tile: Tile) {

@@ -306,2 +311,3 @@ if (tile.request) {

// $FlowFixMe[method-unbinding]
unloadTile(tile: Tile) {

@@ -318,2 +324,3 @@ tile.unloadVectorData();

// $FlowFixMe[method-unbinding]
afterUpdate() {

@@ -320,0 +327,0 @@ this._tileWorkers = {};

@@ -158,2 +158,3 @@ // @flow

index: featureIndex.bucketLayerIDs.length,
// $FlowFixMe[incompatible-call] - Flow can't infer proper `family` type from `layer` above
layers: family,

@@ -181,5 +182,5 @@ zoom: this.zoom,

let error: ?Error;
let glyphMap: ?{[_: string]: {glyphs: {[_: number]: ?StyleGlyph}, ascender?: number, descender?: number}};
let iconMap: ?{[_: string]: StyleImage};
let patternMap: ?{[_: string]: StyleImage};
let glyphMap: {[_: string]: {glyphs: {[_: number]: ?StyleGlyph}, ascender?: number, descender?: number}};
let iconMap: {[_: string]: StyleImage};
let patternMap: {[_: string]: StyleImage};
const taskMetadata = {type: 'maybePrepare', isSymbolTile: this.isSymbolTile, zoom: this.zoom};

@@ -186,0 +187,0 @@

@@ -150,2 +150,3 @@ // @flow

assert(params.type);
// $FlowFixMe[method-unbinding]
const p = this.enableTerrain ? extend({enableTerrain: this.terrain}, params) : params;

@@ -157,2 +158,3 @@ p.projection = this.projections[mapId] || this.defaultProjection;

loadDEMTile(mapId: string, params: WorkerDEMTileParameters, callback: WorkerDEMTileCallback) {
// $FlowFixMe[method-unbinding]
const p = this.enableTerrain ? extend({buildQuadTree: this.terrain}, params) : params;

@@ -164,2 +166,3 @@ this.getDEMWorkerSource(mapId, params.source).loadTile(p, callback);

assert(params.type);
// $FlowFixMe[method-unbinding]
const p = this.enableTerrain ? extend({enableTerrain: this.terrain}, params) : params;

@@ -297,3 +300,4 @@ p.projection = this.projections[mapId] || this.defaultProjection;

self instanceof WorkerGlobalScope) {
// $FlowFixMe[prop-missing]
self.worker = new Worker(self);
}

@@ -173,7 +173,8 @@ // @flow

if (!after.hasOwnProperty(sourceId)) continue;
const source = after[sourceId];
if (!before.hasOwnProperty(sourceId)) {
addSource(sourceId, after, commands);
} else if (!isEqual(before[sourceId], after[sourceId])) {
if (before[sourceId].type === 'geojson' && after[sourceId].type === 'geojson' && canUpdateGeoJSON(before, after, sourceId)) {
commands.push({command: operations.setGeoJSONSourceData, args: [sourceId, after[sourceId].data]});
} else if (!isEqual(before[sourceId], source)) {
if (before[sourceId].type === 'geojson' && source.type === 'geojson' && canUpdateGeoJSON(before, after, sourceId)) {
commands.push({command: operations.setGeoJSONSourceData, args: [sourceId, source.data]});
} else {

@@ -180,0 +181,0 @@ // no update command, must remove then add

@@ -149,2 +149,3 @@ // @flow

for (const name in definitions) {
// $FlowFixMe[method-unbinding]
registry[name] = CompoundExpression;

@@ -151,0 +152,0 @@ }

@@ -59,3 +59,3 @@ // @flow

let N;
let N: ?number;
if (args.length > 3) {

@@ -69,3 +69,3 @@ if (args[2] !== null &&

}
N = args[2];
N = ((args[2]: any): number);
i++;

@@ -72,0 +72,0 @@ }

@@ -65,2 +65,3 @@ // @flow

// $FlowFixMe[method-unbinding]
return class Comparison implements Expression {

@@ -81,2 +82,3 @@ type: Type;

// $FlowFixMe[method-unbinding]
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext): ?Expression {

@@ -83,0 +85,0 @@ if (args.length !== 3 && args.length !== 4)

@@ -60,25 +60,43 @@ // @flow

'<=': LessThanOrEqual,
// $FlowFixMe[method-unbinding]
'array': Assertion,
// $FlowFixMe[method-unbinding]
'at': At,
'boolean': Assertion,
// $FlowFixMe[method-unbinding]
'case': Case,
// $FlowFixMe[method-unbinding]
'coalesce': Coalesce,
// $FlowFixMe[method-unbinding]
'collator': CollatorExpression,
// $FlowFixMe[method-unbinding]
'format': FormatExpression,
// $FlowFixMe[method-unbinding]
'image': ImageExpression,
// $FlowFixMe[method-unbinding]
'in': In,
// $FlowFixMe[method-unbinding]
'index-of': IndexOf,
// $FlowFixMe[method-unbinding]
'interpolate': Interpolate,
'interpolate-hcl': Interpolate,
'interpolate-lab': Interpolate,
// $FlowFixMe[method-unbinding]
'length': Length,
// $FlowFixMe[method-unbinding]
'let': Let,
// $FlowFixMe[method-unbinding]
'literal': Literal,
// $FlowFixMe[method-unbinding]
'match': Match,
'number': Assertion,
// $FlowFixMe[method-unbinding]
'number-format': NumberFormat,
'object': Assertion,
// $FlowFixMe[method-unbinding]
'slice': Slice,
// $FlowFixMe[method-unbinding]
'step': Step,
'string': Assertion,
// $FlowFixMe[method-unbinding]
'to-boolean': Coercion,

@@ -88,3 +106,5 @@ 'to-color': Coercion,

'to-string': Coercion,
// $FlowFixMe[method-unbinding]
'var': Var,
// $FlowFixMe[method-unbinding]
'within': Within

@@ -91,0 +111,0 @@ };

@@ -40,3 +40,3 @@ // @flow

let inputType;
let outputType;
let outputType: ?Type;
if (context.expectedType && context.expectedType.kind !== 'value') {

@@ -43,0 +43,0 @@ outputType = context.expectedType;

@@ -32,21 +32,21 @@ // @flow

export type Feature = {
+type: 1 | 2 | 3 | 'Unknown' | 'Point' | 'LineString' | 'Polygon',
+id?: number | null,
+properties: {[_: string]: any},
+patterns?: {[_: string]: string},
+geometry?: Array<Array<Point>>
};
export interface Feature {
+type: 1 | 2 | 3 | 'Unknown' | 'Point' | 'LineString' | 'Polygon';
+id?: number | null;
+properties: {[_: string]: any};
+patterns?: {[_: string]: string};
+geometry?: Array<Array<Point>>;
}
export type FeatureState = {[_: string]: any};
export type GlobalProperties = $ReadOnly<{
zoom: number,
pitch?: number,
heatmapDensity?: number,
lineProgress?: number,
skyRadialProgress?: number,
isSupportedScript?: (_: string) => boolean,
accumulated?: Value
}>;
export interface GlobalProperties {
+zoom: number;
+pitch?: number;
+heatmapDensity?: number;
+lineProgress?: number;
+skyRadialProgress?: number;
+isSupportedScript?: (_: string) => boolean;
+accumulated?: Value;
}

@@ -196,3 +196,3 @@ export class StyleExpression {

export type ConstantExpression = {
export type ConstantExpression = interface {
kind: 'constant',

@@ -202,3 +202,3 @@ +evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array<string>) => any,

export type SourceExpression = {
export type SourceExpression = interface {
kind: 'source',

@@ -209,3 +209,3 @@ isStateDependent: boolean,

export type CameraExpression = {
export type CameraExpression = interface {
kind: 'camera',

@@ -218,10 +218,10 @@ +evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array<string>) => any,

export type CompositeExpression = {
kind: 'composite',
isStateDependent: boolean,
+evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array<string>, formattedSection?: FormattedSection) => any,
+interpolationFactor: (input: number, lower: number, upper: number) => number,
zoomStops: Array<number>,
interpolationType: ?InterpolationType
};
export interface CompositeExpression {
kind: 'composite';
isStateDependent: boolean;
+evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array<string>, formattedSection?: FormattedSection) => any;
+interpolationFactor: (input: number, lower: number, upper: number) => number;
zoomStops: Array<number>;
interpolationType: ?InterpolationType;
}

@@ -263,3 +263,5 @@ export type StylePropertyExpression =

return success(isFeatureConstant ?
// $FlowFixMe[method-unbinding]
(new ZoomConstantExpression('constant', expression.value): ConstantExpression) :
// $FlowFixMe[method-unbinding]
(new ZoomConstantExpression('source', expression.value): SourceExpression));

@@ -271,3 +273,5 @@ }

return success(isFeatureConstant ?
// $FlowFixMe[method-unbinding]
(new ZoomDependentExpression('camera', expression.value, zoomCurve.labels, interpolationType): CameraExpression) :
// $FlowFixMe[method-unbinding]
(new ZoomDependentExpression('composite', expression.value, zoomCurve.labels, interpolationType): CompositeExpression));

@@ -274,0 +278,0 @@ }

@@ -76,2 +76,3 @@ // @flow

if (!isExpressionFilter(filter)) {
// $FlowFixMe[incompatible-call]
filter = convertFilter(filter);

@@ -78,0 +79,0 @@ }

@@ -17,6 +17,6 @@ // @flow

export type ValidationError = {
message: string;
identifier?: ?string;
line?: ?number;
export type ValidationError = interface {
message: string,
identifier?: ?string,
line?: ?number,
};

@@ -23,0 +23,0 @@ export type ValidationErrors = $ReadOnlyArray<ValidationError>;

@@ -24,3 +24,3 @@ // @flow

let stopDomainValues: {[string | number]: boolean} = {};
let previousStopDomainValue;
let previousStopDomainValue: ?mixed;
let previousStopDomainZoom;

@@ -27,0 +27,0 @@

@@ -61,2 +61,3 @@ // @flow

errors.push(new ValidationError(key, layer.ref, `ref layer "${ref}" not found`));
// $FlowFixMe[prop-missing] - ref is not defined on the LayerSpecification subtypes
} else if (parent.ref) {

@@ -63,0 +64,0 @@ errors.push(new ValidationError(key, layer.ref, 'ref cannot reference another ref layer'));

@@ -43,8 +43,9 @@ // @flow

let tokenMatch;
let tokenMatch: ?RegExp$matchResult;
if (getType(value) === 'string' && supportsPropertyExpression(valueSpec) && !valueSpec.tokens && (tokenMatch = /^{([^}]+)}$/.exec(value))) {
const example = `\`{ "type": "identity", "property": ${tokenMatch ? JSON.stringify(tokenMatch[1]) : '"_"'} }\``;
return [new ValidationError(
key, value,
`"${propertyKey}" does not support interpolation syntax\n` +
`Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(tokenMatch[1])} }\`.`)];
`Use an identity property function instead: ${example}.`)];
}

@@ -51,0 +52,0 @@

@@ -16,3 +16,3 @@ // @flow

// "options" may also be another EvaluationParameters to copy
constructor(zoom: number, options?: *) {
constructor(zoom: number, options?: any) {
this.zoom = zoom;

@@ -19,0 +19,0 @@

@@ -63,2 +63,3 @@ // @flow

possiblyEvaluate(value: PropertyValue<[number, number, number], LightPosition>, parameters: EvaluationParameters): LightPosition {
// $FlowFixMe[method-unbinding]
return sphericalToCartesian(value.expression.evaluate(parameters));

@@ -65,0 +66,0 @@ }

@@ -19,3 +19,3 @@ // @flow

let jsonRequest = getJSON(requestManager.transformRequest(requestManager.normalizeSpriteURL(baseURL, format, '.json'), ResourceType.SpriteJSON), (err: ?Error, data: ?Object) => {
let jsonRequest: ?Cancelable = getJSON(requestManager.transformRequest(requestManager.normalizeSpriteURL(baseURL, format, '.json'), ResourceType.SpriteJSON), (err: ?Error, data: ?Object) => {
jsonRequest = null;

@@ -29,3 +29,3 @@ if (!error) {

let imageRequest = getImage(requestManager.transformRequest(requestManager.normalizeSpriteURL(baseURL, format, '.png'), ResourceType.SpriteImage), (err, img) => {
let imageRequest: ?Cancelable = getImage(requestManager.transformRequest(requestManager.normalizeSpriteURL(baseURL, format, '.png'), ResourceType.SpriteImage), (err, img) => {
imageRequest = null;

@@ -32,0 +32,0 @@ if (!error) {

@@ -109,5 +109,5 @@ // @flow

export type TransitionParameters = {
export type TransitionParameters = interface {
now: TimePoint,
transition: TransitionSpecification
transition: TransitionSpecification,
};

@@ -380,3 +380,3 @@

setValue<S: string>(name: S, value: *) {
setValue<S: string>(name: S, value: any) {
this._values[name] = new PropertyValue(this._values[name].property, value === null ? undefined : clone(value));

@@ -522,2 +522,3 @@ }

assert(!value.isDataDriven());
// $FlowFixMe[method-unbinding]
return value.expression.evaluate(parameters);

@@ -546,2 +547,3 @@ }

overrides: ?Object;
useIntegerZoom: ?boolean;

@@ -555,2 +557,3 @@ constructor(specification: StylePropertySpecification, overrides?: Object) {

if (value.expression.kind === 'constant' || value.expression.kind === 'camera') {
// $FlowFixMe[method-unbinding]
return new PossiblyEvaluatedPropertyValue(this, {kind: 'constant', value: value.expression.evaluate(parameters, (null: any), {}, canonical, availableImages)}, parameters);

@@ -593,2 +596,3 @@ } else {

} else {
// $FlowFixMe[method-unbinding]
return value.evaluate(parameters, feature, featureState, canonical, availableImages);

@@ -614,2 +618,3 @@ }

possiblyEvaluate(value: PropertyValue<Color, boolean>, parameters: EvaluationParameters, canonical?: CanonicalTileID, availableImages?: Array<string>): boolean {
// $FlowFixMe[method-unbinding]
return !!value.expression.evaluate(parameters, (null: any), {}, canonical, availableImages);

@@ -616,0 +621,0 @@ }

@@ -39,6 +39,7 @@ // @flow

createBucket(parameters: BucketParameters<*>): CircleBucket<CircleStyleLayer> {
createBucket(parameters: BucketParameters<CircleStyleLayer>): CircleBucket<CircleStyleLayer> {
return new CircleBucket(parameters);
}
// $FlowFixMe[method-unbinding]
queryRadius(bucket: Bucket): number {

@@ -51,2 +52,3 @@ const circleBucket: CircleBucket<CircleStyleLayer> = (bucket: any);

// $FlowFixMe[method-unbinding]
queryIntersectsFeature(queryGeometry: TilespaceQueryGeometry,

@@ -53,0 +55,0 @@ feature: IVectorTileFeature,

@@ -228,2 +228,3 @@ // @flow

// $FlowFixMe[method-unbinding]
onAdd(map: Map) {

@@ -235,2 +236,3 @@ if (this.implementation.onAdd) {

// $FlowFixMe[method-unbinding]
onRemove(map: Map) {

@@ -237,0 +239,0 @@ if (this.implementation.onRemove) {

@@ -48,2 +48,3 @@ // @flow

// $FlowFixMe[method-unbinding]
queryRadius(): number {

@@ -67,2 +68,3 @@ return translateDistance(this.paint.get('fill-extrusion-translate'));

// $FlowFixMe[method-unbinding]
queryIntersectsFeature(queryGeometry: TilespaceQueryGeometry,

@@ -69,0 +71,0 @@ feature: IVectorTileFeature,

@@ -60,6 +60,7 @@ // @flow

createBucket(parameters: BucketParameters<*>): FillBucket {
createBucket(parameters: BucketParameters<FillStyleLayer>): FillBucket {
return new FillBucket(parameters);
}
// $FlowFixMe[method-unbinding]
queryRadius(): number {

@@ -69,2 +70,3 @@ return translateDistance(this.paint.get('fill-translate'));

// $FlowFixMe[method-unbinding]
queryIntersectsFeature(queryGeometry: TilespaceQueryGeometry,

@@ -71,0 +73,0 @@ feature: IVectorTileFeature,

@@ -37,3 +37,3 @@ // @flow

createBucket(parameters: BucketParameters<*>): HeatmapBucket {
createBucket(parameters: BucketParameters<HeatmapStyleLayer>): HeatmapBucket {
return new HeatmapBucket(parameters);

@@ -72,2 +72,3 @@ }

// $FlowFixMe[method-unbinding]
queryRadius(bucket: Bucket): number {

@@ -77,2 +78,3 @@ return getMaximumPaintValue('heatmap-radius', this, ((bucket: any): CircleBucket<*>));

// $FlowFixMe[method-unbinding]
queryIntersectsFeature(queryGeometry: TilespaceQueryGeometry,

@@ -79,0 +81,0 @@ feature: IVectorTileFeature,

@@ -25,3 +25,3 @@ // @flow

class LineFloorwidthProperty extends DataDrivenProperty<number> {
useIntegerZoom: true;
useIntegerZoom = true;

@@ -85,3 +85,3 @@ possiblyEvaluate(value, parameters) {

createBucket(parameters: BucketParameters<*>): LineBucket {
createBucket(parameters: BucketParameters<LineStyleLayer>): LineBucket {
return new LineBucket(parameters);

@@ -101,2 +101,3 @@ }

// $FlowFixMe[method-unbinding]
queryRadius(bucket: Bucket): number {

@@ -111,2 +112,3 @@ const lineBucket: LineBucket = (bucket: any);

// $FlowFixMe[method-unbinding]
queryIntersectsFeature(queryGeometry: TilespaceQueryGeometry,

@@ -113,0 +115,0 @@ feature: IVectorTileFeature,

@@ -99,3 +99,3 @@ // @flow

getValueAndResolveTokens(name: *, feature: Feature, canonical: CanonicalTileID, availableImages: Array<string>): string {
getValueAndResolveTokens(name: any, feature: Feature, canonical: CanonicalTileID, availableImages: Array<string>): string {
const value = this.layout.get(name).evaluate(feature, {}, canonical, availableImages);

@@ -110,6 +110,7 @@ const unevaluated = this._unevaluatedLayout._values[name];

createBucket(parameters: BucketParameters<*>): SymbolBucket {
createBucket(parameters: BucketParameters<SymbolStyleLayer>): SymbolBucket {
return new SymbolBucket(parameters);
}
// $FlowFixMe[method-unbinding]
queryRadius(): number {

@@ -119,2 +120,3 @@ return 0;

// $FlowFixMe[method-unbinding]
queryIntersectsFeature(): boolean {

@@ -135,4 +137,6 @@ assert(false); // Should take a different path in FeatureIndex

if (overriden.value.kind === 'constant' || overriden.value.kind === 'source') {
// $FlowFixMe[method-unbinding]
expression = (new ZoomConstantExpression('source', styleExpression): SourceExpression);
} else {
// $FlowFixMe[method-unbinding]
expression = (new ZoomDependentExpression('composite',

@@ -139,0 +143,0 @@ styleExpression,

@@ -26,3 +26,3 @@ // @flow

let p = anchor;
let p: Point = anchor;
let index = anchor.segment + 1;

@@ -29,0 +29,0 @@ let anchorDistance = 0;

@@ -22,3 +22,3 @@ // @flow

type PlacedCollisionBox = {|
export type PlacedCollisionBox = {|
box: Array<number>,

@@ -25,0 +25,0 @@ offscreen: boolean,

@@ -72,2 +72,3 @@ // @flow

insert(key: any, x1: number, y1: number, x2: number, y2: number) {
// $FlowFixMe[method-unbinding]
this._forEachCell(x1, y1, x2, y2, this._insertBoxCell, this.boxUid++);

@@ -84,2 +85,3 @@ this.boxKeys.push(key);

// It's more than necessary (by a factor of 4/PI), but fast to insert
// $FlowFixMe[method-unbinding]
this._forEachCell(x - radius, y - radius, x + radius, y + radius, this._insertCircleCell, this.circleUid++);

@@ -136,2 +138,3 @@ this.circleKeys.push(key);

};
// $FlowFixMe[method-unbinding]
this._forEachCell(x1, y1, x2, y2, this._queryCell, result, queryArgs, predicate);

@@ -162,2 +165,3 @@ return hitTest ? result.length > 0 : result;

};
// $FlowFixMe[method-unbinding]
this._forEachCell(x1, y1, x2, y2, this._queryCellCircle, result, queryArgs, predicate);

@@ -164,0 +168,0 @@ return hitTest ? result.length > 0 : result;

@@ -24,3 +24,7 @@ // @flow

import type {Mat4} from 'gl-matrix';
import type {PlacedCollisionBox} from './collision_index.js';
// PlacedCollisionBox with all fields optional
type PartialPlacedCollisionBox = $ObjMap<PlacedCollisionBox, <V>() => ?V>;
class OpacityState {

@@ -340,3 +344,3 @@ opacity: number;

symbolInstance: SymbolInstance, boxIndex: number, bucket: SymbolBucket,
orientation: number, iconBox: ?SingleCollisionBox, textSize: any, iconSize: any): ?{ shift: Point, placedGlyphBoxes: { box: Array<number>, offscreen: boolean, occluded: boolean } } {
orientation: number, iconBox: ?SingleCollisionBox, textSize: any, iconSize: any): ?{ shift: Point, placedGlyphBoxes: PlacedCollisionBox } {

@@ -483,11 +487,11 @@ const {textOffset0, textOffset1, crossTileID} = symbolInstance;

}
let placeText = false;
let placeIcon = false;
let offscreen = true;
let textOccluded = false;
let placeText: ?boolean = false;
let placeIcon: ?boolean = false;
let offscreen: ?boolean = true;
let textOccluded: ?boolean = false;
let iconOccluded = false;
let shift = null;
let placed = {box: null, offscreen: null, occluded: null};
let placedVerticalText = {box: null, offscreen: null, occluded: null};
let placed: PartialPlacedCollisionBox = {box: null, offscreen: null, occluded: null};
let placedVerticalText: PartialPlacedCollisionBox = {box: null, offscreen: null, occluded: null};

@@ -533,3 +537,3 @@ let placedGlyphBoxes = null;

const placeTextForPlacementModes = (placeHorizontalFn, placeVerticalFn) => {
const placeTextForPlacementModes = (placeHorizontalFn: () => PartialPlacedCollisionBox, placeVerticalFn: () => PartialPlacedCollisionBox) => {
if (bucket.allowVerticalPlacement && numVerticalGlyphVertices > 0 && collisionArrays.verticalTextBox) {

@@ -562,7 +566,7 @@ for (const placementMode of bucket.writingModes) {

const placeHorizontal = () => {
const placeHorizontal: () => PlacedCollisionBox = () => {
return placeBox(textBox, WritingMode.horizontal);
};
const placeVertical = () => {
const placeVertical: () => PlacedCollisionBox | PartialPlacedCollisionBox = () => {
const verticalTextBox = collisionArrays.verticalTextBox;

@@ -576,3 +580,7 @@ if (bucket.allowVerticalPlacement && numVerticalGlyphVertices > 0 && verticalTextBox) {

placeTextForPlacementModes(placeHorizontal, placeVertical);
placeTextForPlacementModes(
((placeHorizontal: any): () => PartialPlacedCollisionBox),
((placeVertical: any): () => PartialPlacedCollisionBox),
);
updatePreviousOrientationIfNotPlaced(placed && placed.box && placed.box.length);

@@ -602,3 +610,3 @@

let placedBox: ?{ box: Array<number>, offscreen: boolean, occluded: boolean } = {box: [], offscreen: false, occluded: false};
let placedBox: PartialPlacedCollisionBox = {box: [], offscreen: false, occluded: false};
const placementAttempts = textAllowOverlap ? anchors.length * 2 : anchors.length;

@@ -615,3 +623,3 @@ for (let i = 0; i < placementAttempts; ++i) {

if (result) {
placedBox = result.placedGlyphBoxes;
placedBox = ((result.placedGlyphBoxes: any): PartialPlacedCollisionBox);
if (placedBox && placedBox.box && placedBox.box.length) {

@@ -618,0 +626,0 @@ placeText = true;

@@ -272,3 +272,3 @@ // @flow

let useVertical = false;
let useVertical: ?boolean = false;
let prevWritingMode;

@@ -632,3 +632,3 @@

let axisZ = [0, 0, 1];
let axisZ: Vec3 = [0, 0, 1];
let diffX = prevToCurrent[0];

@@ -635,0 +635,0 @@ let diffY = prevToCurrent[1];

@@ -45,2 +45,3 @@ // @flow

if (expression.kind === 'constant') {
// $FlowFixMe[method-unbinding]
const layoutSize = expression.evaluate(new EvaluationParameters(tileZoom + 1));

@@ -75,3 +76,5 @@ return {kind: 'constant', layoutSize};

// evaluated at the covering zoom levels
// $FlowFixMe[method-unbinding]
const minSize = expression.evaluate(new EvaluationParameters(minZoom));
// $FlowFixMe[method-unbinding]
const maxSize = expression.evaluate(new EvaluationParameters(maxZoom));

@@ -85,3 +88,3 @@

{uSize, uSizeT}: InterpolatedSize,
{lowerSize, upperSize}: {+lowerSize: number, +upperSize: number}): number {
{lowerSize, upperSize}: interface {+lowerSize: number, +upperSize: number}): number {
if (sizeData.kind === 'source') {

@@ -88,0 +91,0 @@ return lowerSize / SIZE_PACK_FACTOR;

@@ -76,3 +76,3 @@ // @flow

*/
getAtPoint(point: MercatorCoordinate, defaultIfNotLoaded: ?number, exaggerated: boolean = true): number | null {
getAtPoint(point: MercatorCoordinate, defaultIfNotLoaded: ?number, exaggerated: boolean = true): ?number {
if (this.isUsingMockSource()) {

@@ -79,0 +79,0 @@ return null;

// @flow strict
export type Cancelable = { cancel: () => void };
export type Cancelable = interface { cancel: () => void };

@@ -63,2 +63,3 @@ // @flow

this._compactButton.type = 'button';
// $FlowFixMe[method-unbinding]
this._compactButton.addEventListener('click', this._toggleAttribution);

@@ -76,7 +77,11 @@ this._setElementTitle(this._compactButton, 'ToggleAttribution');

// $FlowFixMe[method-unbinding]
this._map.on('styledata', this._updateData);
// $FlowFixMe[method-unbinding]
this._map.on('sourcedata', this._updateData);
// $FlowFixMe[method-unbinding]
this._map.on('moveend', this._updateEditLink);
if (compact === undefined) {
// $FlowFixMe[method-unbinding]
this._map.on('resize', this._updateCompact);

@@ -92,5 +97,9 @@ this._updateCompact();

// $FlowFixMe[method-unbinding]
this._map.off('styledata', this._updateData);
// $FlowFixMe[method-unbinding]
this._map.off('sourcedata', this._updateData);
// $FlowFixMe[method-unbinding]
this._map.off('moveend', this._updateEditLink);
// $FlowFixMe[method-unbinding]
this._map.off('resize', this._updateCompact);

@@ -167,2 +176,3 @@

if (source.attribution && attributions.indexOf(source.attribution) < 0) {
// $FlowFixMe[incompatible-call] - Flow can't infer that attribution is a string
attributions.push(source.attribution);

@@ -169,0 +179,0 @@ }

@@ -71,2 +71,3 @@ // @flow

this._map = (null: any);
// $FlowFixMe[method-unbinding]
window.document.removeEventListener(this._fullscreenchange, this._changeIcon);

@@ -87,3 +88,5 @@ }

this._updateTitle();
// $FlowFixMe[method-unbinding]
this._fullscreenButton.addEventListener('click', this._onClickFullscreen);
// $FlowFixMe[method-unbinding]
window.document.addEventListener(this._fullscreenchange, this._changeIcon);

@@ -126,2 +129,3 @@ }

}
// $FlowFixMe[method-unbinding]
} else if (this._container.requestFullscreen) {

@@ -128,0 +132,0 @@ this._container.requestFullscreen();

@@ -129,2 +129,3 @@ // @flow

// $FlowFixMe[method-unbinding]
this._updateMarkerRotationThrottled = throttle(this._updateMarkerRotation, 20);

@@ -137,2 +138,3 @@ this._numberOfWatches = 0;

this._container = DOM.create('div', `mapboxgl-ctrl mapboxgl-ctrl-group`);
// $FlowFixMe[method-unbinding]
this._checkGeolocationSupport(this._setupUI);

@@ -158,2 +160,3 @@ return this._container;

this._container.remove();
// $FlowFixMe[method-unbinding]
this._map.off('zoom', this._onZoom);

@@ -468,7 +471,8 @@ this._map = (undefined: any);

// $FlowFixMe[method-unbinding]
this._map.on('zoom', this._onZoom);
}
this._geolocateButton.addEventListener('click',
this.trigger.bind(this));
// $FlowFixMe[method-unbinding]
this._geolocateButton.addEventListener('click', this.trigger.bind(this));

@@ -643,7 +647,8 @@ this._setup = true;

} else {
this.options.geolocation.getCurrentPosition(
this._onSuccess, this._onError, this.options.positionOptions);
// $FlowFixMe[method-unbinding]
this.options.geolocation.getCurrentPosition(this._onSuccess, this._onError, this.options.positionOptions);
// This timeout ensures that we still call finish() even if
// the user declines to share their location in Firefox
// $FlowFixMe[method-unbinding]
this._timeoutId = setTimeout(this._finish, 10000 /* 10sec */);

@@ -658,4 +663,6 @@ }

if ('ondeviceorientationabsolute' in window) {
// $FlowFixMe[method-unbinding]
window.addEventListener('deviceorientationabsolute', this._onDeviceOrientation);
} else {
// $FlowFixMe[method-unbinding]
window.addEventListener('deviceorientation', this._onDeviceOrientation);

@@ -683,3 +690,5 @@ }

// $FlowFixMe[method-unbinding]
window.removeEventListener('deviceorientation', this._onDeviceOrientation);
// $FlowFixMe[method-unbinding]
window.removeEventListener('deviceorientationabsolute', this._onDeviceOrientation);

@@ -686,0 +695,0 @@

@@ -38,5 +38,7 @@ // @flow

// $FlowFixMe[method-unbinding]
this._map.on('sourcedata', this._updateLogo);
this._updateLogo();
// $FlowFixMe[method-unbinding]
this._map.on('resize', this._updateCompact);

@@ -50,3 +52,5 @@ this._updateCompact();

this._container.remove();
// $FlowFixMe[method-unbinding]
this._map.off('sourcedata', this._updateLogo);
// $FlowFixMe[method-unbinding]
this._map.off('resize', this._updateCompact);

@@ -53,0 +57,0 @@ }

@@ -120,2 +120,3 @@ // @flow

this._setButtonTitle(this._zoomOutButton, 'ZoomOut');
// $FlowFixMe[method-unbinding]
map.on('zoom', this._updateZoomButtons);

@@ -127,4 +128,6 @@ this._updateZoomButtons();

if (this.options.visualizePitch) {
// $FlowFixMe[method-unbinding]
map.on('pitch', this._rotateCompassArrow);
}
// $FlowFixMe[method-unbinding]
map.on('rotate', this._rotateCompassArrow);

@@ -142,2 +145,3 @@ this._rotateCompassArrow();

if (this.options.showZoom) {
// $FlowFixMe[method-unbinding]
map.off('zoom', this._updateZoomButtons);

@@ -147,4 +151,6 @@ }

if (this.options.visualizePitch) {
// $FlowFixMe[method-unbinding]
map.off('pitch', this._rotateCompassArrow);
}
// $FlowFixMe[method-unbinding]
map.off('rotate', this._rotateCompassArrow);

@@ -190,6 +196,11 @@ if (this._handler) this._handler.off();

bindAll(['mousedown', 'mousemove', 'mouseup', 'touchstart', 'touchmove', 'touchend', 'reset'], this);
// $FlowFixMe[method-unbinding]
element.addEventListener('mousedown', this.mousedown);
// $FlowFixMe[method-unbinding]
element.addEventListener('touchstart', this.touchstart, {passive: false});
// $FlowFixMe[method-unbinding]
element.addEventListener('touchmove', this.touchmove);
// $FlowFixMe[method-unbinding]
element.addEventListener('touchend', this.touchend);
// $FlowFixMe[method-unbinding]
element.addEventListener('touchcancel', this.reset);

@@ -218,6 +229,11 @@ }

const element = this.element;
// $FlowFixMe[method-unbinding]
element.removeEventListener('mousedown', this.mousedown);
// $FlowFixMe[method-unbinding]
element.removeEventListener('touchstart', this.touchstart, {passive: false});
// $FlowFixMe[method-unbinding]
element.removeEventListener('touchmove', this.touchmove);
// $FlowFixMe[method-unbinding]
element.removeEventListener('touchend', this.touchend);
// $FlowFixMe[method-unbinding]
element.removeEventListener('touchcancel', this.reset);

@@ -229,3 +245,5 @@ this.offTemp();

DOM.enableDrag();
// $FlowFixMe[method-unbinding]
window.removeEventListener('mousemove', this.mousemove);
// $FlowFixMe[method-unbinding]
window.removeEventListener('mouseup', this.mouseup);

@@ -236,3 +254,5 @@ }

this.down(extend({}, e, {ctrlKey: true, preventDefault: () => e.preventDefault()}), DOM.mousePos(this.element, e));
// $FlowFixMe[method-unbinding]
window.addEventListener('mousemove', this.mousemove);
// $FlowFixMe[method-unbinding]
window.addEventListener('mouseup', this.mouseup);

@@ -239,0 +259,0 @@ }

@@ -123,2 +123,3 @@ // @flow

// $FlowFixMe[method-unbinding]
this._map.on('move', this._update);

@@ -132,2 +133,3 @@ this._update();

this._container.remove();
// $FlowFixMe[method-unbinding]
this._map.off('move', this._update);

@@ -134,0 +136,0 @@ this._map = (undefined: any);

@@ -1488,6 +1488,17 @@ // @flow

/**
* Fired immediately after all style resources have been downloaded
* and the first visually complete rendering of the base style has occurred.
*
* @event style.load
* @memberof Map
* @instance
* @private
* @example
* // Initialize the map
* const map = new mapboxgl.Map({});
* // Set an event listener that fires
* // when the map has finished loading.
* map.on('style.load', () => {
* console.log('A style load event occurred.');
* });
* @see [Example: Persist layers when switching base style](https://www.mapbox.com/mapbox-gl-js/example/style-switch)
*/

@@ -1514,2 +1525,29 @@ | 'style.load'

| 'speedindexcompleted'
/**
* Fired after RTL text plugin state changes.
*
* @event pluginStateChange
* @instance
* @private
*/
| 'pluginStateChange'
/**
* Fired in worker.js after sprite loaded.
*
* @event pluginStateChange
* @instance
* @private
*/
| 'isSpriteLoaded'
/**
* Fired in style.js after layer order changed.
*
* @event pluginStateChange
* @instance
* @private
*/
| 'neworder'
;

@@ -147,4 +147,4 @@ // @flow

const pos: MercatorCoordinate = this.position;
const altitude = this._elevation ? this._elevation.getAtPointOrZero(MercatorCoordinate.fromLngLat(location)) : 0;
const pos: MercatorCoordinate = this.position;
const target = MercatorCoordinate.fromLngLat(location, altitude);

@@ -151,0 +151,0 @@ const forward = [target.x - pos.x, target.y - pos.y, target.z - pos.z];

@@ -73,2 +73,6 @@ // @flow

_onMoveEnd(panInertiaOptions?: DragPanOptions): ?(EasingOptions & {easeId?: string}) {
if (browser.prefersReducedMotion) {
return;
}
this._drainInertiaBuffer();

@@ -75,0 +79,0 @@ if (this._inertiaBuffer.length < 2) {

@@ -224,2 +224,3 @@ // @flow

for (const [target, type, listenerOptions] of this._listeners) {
// $FlowFixMe[method-unbinding]
const listener = target === window.document ? this.handleWindowEvent : this.handleEvent;

@@ -232,2 +233,3 @@ target.addEventListener((type: any), (listener: any), listenerOptions);

for (const [target, type, listenerOptions] of this._listeners) {
// $FlowFixMe[method-unbinding]
const listener = target === window.document ? this.handleWindowEvent : this.handleEvent;

@@ -241,5 +243,7 @@ target.removeEventListener((type: any), (listener: any), listenerOptions);

const el = map.getCanvasContainer();
// $FlowFixMe[method-unbinding]
this._add('mapEvent', new MapEventHandler(map, options));
const boxZoom = map.boxZoom = new BoxZoomHandler(map, options);
// $FlowFixMe[method-unbinding]
this._add('boxZoom', boxZoom);

@@ -250,9 +254,13 @@

map.doubleClickZoom = new DoubleClickZoomHandler(clickZoom, tapZoom);
// $FlowFixMe[method-unbinding]
this._add('tapZoom', tapZoom);
// $FlowFixMe[method-unbinding]
this._add('clickZoom', clickZoom);
const tapDragZoom = new TapDragZoomHandler();
// $FlowFixMe[method-unbinding]
this._add('tapDragZoom', tapDragZoom);
const touchPitch = map.touchPitch = new TouchPitchHandler(map);
// $FlowFixMe[method-unbinding]
this._add('touchPitch', touchPitch);

@@ -263,3 +271,5 @@

map.dragRotate = new DragRotateHandler(options, mouseRotate, mousePitch);
// $FlowFixMe[method-unbinding]
this._add('mouseRotate', mouseRotate, ['mousePitch']);
// $FlowFixMe[method-unbinding]
this._add('mousePitch', mousePitch, ['mouseRotate']);

@@ -270,3 +280,5 @@

map.dragPan = new DragPanHandler(el, mousePan, touchPan);
// $FlowFixMe[method-unbinding]
this._add('mousePan', mousePan);
// $FlowFixMe[method-unbinding]
this._add('touchPan', touchPan, ['touchZoom', 'touchRotate']);

@@ -277,11 +289,16 @@

map.touchZoomRotate = new TouchZoomRotateHandler(el, touchZoom, touchRotate, tapDragZoom);
// $FlowFixMe[method-unbinding]
this._add('touchRotate', touchRotate, ['touchPan', 'touchZoom']);
// $FlowFixMe[method-unbinding]
this._add('touchZoom', touchZoom, ['touchPan', 'touchRotate']);
// $FlowFixMe[method-unbinding]
this._add('blockableMapEvent', new BlockableMapEventHandler(map));
const scrollZoom = map.scrollZoom = new ScrollZoomHandler(map, this);
// $FlowFixMe[method-unbinding]
this._add('scrollZoom', scrollZoom, ['mousePan']);
const keyboard = map.keyboard = new KeyboardHandler();
// $FlowFixMe[method-unbinding]
this._add('keyboard', keyboard);

@@ -680,3 +697,3 @@

_fireEvent(type: string, e: *) {
_fireEvent(type: string, e: any) {
this._map.fire(new Event(type, e ? {originalEvent: e} : {}));

@@ -683,0 +700,0 @@ }

@@ -178,3 +178,3 @@ // @flow

_fireEvent(type: string, e: *): Map {
_fireEvent(type: string, e: any): Map {
return this._map.fire(new Event(type, {originalEvent: e}));

@@ -181,0 +181,0 @@ }

@@ -199,2 +199,3 @@ // @flow

// Start a timeout in case this was a singular event, and delay it by up to 40ms.
// $FlowFixMe[method-unbinding]
this._timeout = setTimeout(this._onTimeout, 40, e);

@@ -201,0 +202,0 @@

@@ -142,3 +142,3 @@ // @flow

function getBearingDelta(a, b) {
function getBearingDelta(a: Point, b: Point) {
return a.angleWith(b) * 180 / Math.PI;

@@ -170,2 +170,3 @@ }

return {
// $FlowFixMe[incompatible-call] - Flow doesn't infer that this._vectoris not null
bearingDelta: getBearingDelta(this._vector, lastVector),

@@ -172,0 +173,0 @@ pinchAround

@@ -29,2 +29,3 @@ // @flow

// Mobile Safari doesn't allow updating the hash more than 100 times per 30 seconds.
// $FlowFixMe[method-unbinding]
this._updateHash = throttle(this._updateHashUnthrottled.bind(this), 30 * 1000 / 100);

@@ -41,2 +42,3 @@ }

this._map = map;
// $FlowFixMe[method-unbinding]
window.addEventListener('hashchange', this._onHashChange, false);

@@ -56,2 +58,3 @@ map.on('moveend', this._updateHash);

this._map.off('moveend', this._updateHash);
// $FlowFixMe[method-unbinding]
window.removeEventListener('hashchange', this._onHashChange, false);

@@ -58,0 +61,0 @@ clearTimeout(this._updateHash());

@@ -202,3 +202,5 @@ // @flow

map.on('move', this._updateMoving);
// $FlowFixMe[method-unbinding]
map.on('moveend', this._update);
// $FlowFixMe[method-unbinding]
map.on('remove', this._clearFadeTimer);

@@ -212,2 +214,3 @@ map._addMarker(this);

// `Popup#_onClickClose` listener.
// $FlowFixMe[method-unbinding]
map.on('click', this._onMapClick);

@@ -229,11 +232,20 @@

if (map) {
// $FlowFixMe[method-unbinding]
map.off('click', this._onMapClick);
map.off('move', this._updateMoving);
// $FlowFixMe[method-unbinding]
map.off('moveend', this._update);
// $FlowFixMe[method-unbinding]
map.off('mousedown', this._addDragHandler);
// $FlowFixMe[method-unbinding]
map.off('touchstart', this._addDragHandler);
// $FlowFixMe[method-unbinding]
map.off('mouseup', this._onUp);
// $FlowFixMe[method-unbinding]
map.off('touchend', this._onUp);
// $FlowFixMe[method-unbinding]
map.off('mousemove', this._onMove);
// $FlowFixMe[method-unbinding]
map.off('touchmove', this._onMove);
// $FlowFixMe[method-unbinding]
map.off('remove', this._clearFadeTimer);

@@ -319,2 +331,3 @@ map._removeMarker(this);

this._element.removeAttribute('role');
// $FlowFixMe[method-unbinding]
this._element.removeEventListener('keypress', this._onKeyPress);

@@ -352,2 +365,3 @@

}
// $FlowFixMe[method-unbinding]
this._element.addEventListener('keypress', this._onKeyPress);

@@ -586,2 +600,3 @@ this._element.setAttribute('aria-expanded', 'false');

if ((map._showingGlobe() || map.getTerrain() || map.getFog()) && !this._fadeTimer) {
// $FlowFixMe[method-unbinding]
this._fadeTimer = setTimeout(this._evaluateOpacity.bind(this), 60);

@@ -676,3 +691,5 @@ }

if (map) {
// $FlowFixMe[method-unbinding]
map.off('mousemove', this._onMove);
// $FlowFixMe[method-unbinding]
map.off('touchmove', this._onMove);

@@ -716,5 +733,9 @@ }

this._state = 'pending';
// $FlowFixMe[method-unbinding]
map.on('mousemove', this._onMove);
// $FlowFixMe[method-unbinding]
map.on('touchmove', this._onMove);
// $FlowFixMe[method-unbinding]
map.once('mouseup', this._onUp);
// $FlowFixMe[method-unbinding]
map.once('touchend', this._onUp);

@@ -740,6 +761,10 @@ }

if (shouldBeDraggable) {
// $FlowFixMe[method-unbinding]
map.on('mousedown', this._addDragHandler);
// $FlowFixMe[method-unbinding]
map.on('touchstart', this._addDragHandler);
} else {
// $FlowFixMe[method-unbinding]
map.off('mousedown', this._addDragHandler);
// $FlowFixMe[method-unbinding]
map.off('touchstart', this._addDragHandler);

@@ -746,0 +771,0 @@ }

@@ -146,2 +146,3 @@ // @flow

if (this.options.closeOnClick) {
// $FlowFixMe[method-unbinding]
map.on('preclick', this._onClose);

@@ -151,5 +152,7 @@ }

if (this.options.closeOnMove) {
// $FlowFixMe[method-unbinding]
map.on('move', this._onClose);
}
// $FlowFixMe[method-unbinding]
map.on('remove', this.remove);

@@ -161,6 +164,9 @@ this._update();

if (this._trackPointer) {
// $FlowFixMe[method-unbinding]
map.on('mousemove', this._onMouseEvent);
// $FlowFixMe[method-unbinding]
map.on('mouseup', this._onMouseEvent);
map._canvasContainer.classList.add('mapboxgl-track-pointer');
} else {
// $FlowFixMe[method-unbinding]
map.on('move', this._update);

@@ -224,9 +230,17 @@ }

if (map) {
// $FlowFixMe[method-unbinding]
map.off('move', this._update);
// $FlowFixMe[method-unbinding]
map.off('move', this._onClose);
// $FlowFixMe[method-unbinding]
map.off('preclick', this._onClose);
// $FlowFixMe[method-unbinding]
map.off('click', this._onClose);
// $FlowFixMe[method-unbinding]
map.off('remove', this.remove);
// $FlowFixMe[method-unbinding]
map.off('mousemove', this._onMouseEvent);
// $FlowFixMe[method-unbinding]
map.off('mouseup', this._onMouseEvent);
// $FlowFixMe[method-unbinding]
map.off('drag', this._onMouseEvent);

@@ -297,3 +311,5 @@ if (map._canvasContainer) {

if (map) {
// $FlowFixMe[method-unbinding]
map.on('move', this._update);
// $FlowFixMe[method-unbinding]
map.off('mousemove', this._onMouseEvent);

@@ -323,4 +339,7 @@ map._canvasContainer.classList.remove('mapboxgl-track-pointer');

if (map) {
// $FlowFixMe[method-unbinding]
map.off('move', this._update);
// $FlowFixMe[method-unbinding]
map.on('mousemove', this._onMouseEvent);
// $FlowFixMe[method-unbinding]
map.on('drag', this._onMouseEvent);

@@ -465,2 +484,3 @@ map._canvasContainer.classList.add('mapboxgl-track-pointer');

button.innerHTML = '&#215;';
// $FlowFixMe[method-unbinding]
button.addEventListener('click', this._onClose);

@@ -467,0 +487,0 @@ }

@@ -39,2 +39,3 @@ // @flow

bindAll(['receive'], this);
// $FlowFixMe[method-unbinding]
this.target.addEventListener('message', this.receive, false);

@@ -174,2 +175,3 @@ this.globalScope = isWorker() ? target : window;

this.scheduler.remove();
// $FlowFixMe[method-unbinding]
this.target.removeEventListener('message', this.receive, false);

@@ -176,0 +178,0 @@ }

@@ -46,2 +46,3 @@ // @flow

* @property {boolean} collectResourceTiming If true, Resource Timing API information will be collected for these transformed requests and returned in a resourceTiming property of relevant data events.
* @property {string} referrerPolicy A string representing the request's referrerPolicy. For more information and possible values, see the [Referrer-Policy HTTP header page](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy).
* @example

@@ -71,4 +72,5 @@ * // use transformRequest to modify requests that begin with `http://myHost`

credentials?: 'same-origin' | 'include',
collectResourceTiming?: boolean
};
collectResourceTiming?: boolean,
referrerPolicy?: ReferrerPolicyType
}

@@ -116,2 +118,3 @@ export type ResponseCallback<T> = (error: ?Error, data: ?T, cacheControl: ?string, expires: ?string) => void;

referrer: getReferrer(),
referrerPolicy: requestParameters.referrerPolicy,
signal: controller.signal

@@ -328,2 +331,3 @@ });

cancelled: false,
// $FlowFixMe[object-this-reference]
cancel() { this.cancelled = true; }

@@ -346,2 +350,3 @@ };

if (!cancelled) {
// $FlowFixMe[cannot-write] - Flow can't infer that cancel is a writable property
request.cancel = getImage(requestParameters, callback).cancel;

@@ -348,0 +353,0 @@ }

@@ -10,3 +10,3 @@ // @flow strict

let stubTime;
let stubTime: number | void;

@@ -13,0 +13,0 @@ let canvas;

@@ -57,8 +57,13 @@ // @flow strict

get EVENTS_URL() {
if (!this.API_URL) { return null; }
if (this.API_URL.indexOf('https://api.mapbox.cn') === 0) {
return 'https://events.mapbox.cn/events/v2';
} else if (this.API_URL.indexOf('https://api.mapbox.com') === 0) {
return 'https://events.mapbox.com/events/v2';
} else {
if (!config.API_URL) { return null; }
try {
const url = new URL(config.API_URL);
if (url.hostname === 'api.mapbox.cn') {
return 'https://events.mapbox.cn/events/v2';
} else if (url.hostname === 'api.mapbox.com') {
return 'https://events.mapbox.com/events/v2';
} else {
return null;
}
} catch (e) {
return null;

@@ -65,0 +70,0 @@ }

@@ -26,3 +26,7 @@ // @flow

drawAabbs: Function,
clearAabbs: Function
clearAabbs: Function,
_drawBox: Function,
_drawLine: Function,
_drawQuad: Function,
_initializeCanvas: Function,
} =

@@ -51,14 +55,17 @@ {

_initializeCanvas(tr: Transform) {
if (!this.debugCanvas) {
this.debugCanvas = window.document.createElement('canvas');
window.document.body.appendChild(this.debugCanvas);
this.debugCanvas.style.position = 'absolute';
this.debugCanvas.style.left = 0;
this.debugCanvas.style.top = 0;
this.debugCanvas.style.pointerEvents = 'none';
if (!Debug.debugCanvas) {
Debug.debugCanvas = window.document.createElement('canvas');
window.document.body.appendChild(Debug.debugCanvas);
// Supress Flow check because we're checking for null above
if (!Debug.debugCanvas) return;
Debug.debugCanvas.style.position = 'absolute';
Debug.debugCanvas.style.left = '0';
Debug.debugCanvas.style.top = '0';
Debug.debugCanvas.style.pointerEvents = 'none';
const resize = () => {
if (!this.debugCanvas) { return; }
this.debugCanvas.width = tr.width;
this.debugCanvas.height = tr.height;
if (!Debug.debugCanvas) { return; }
Debug.debugCanvas.width = tr.width;
Debug.debugCanvas.height = tr.height;
};

@@ -69,3 +76,3 @@ resize();

}
return this.debugCanvas;
return Debug.debugCanvas;
},

@@ -80,6 +87,6 @@

_drawQuad(ctx: CanvasRenderingContext2D, corners: Array<?Vec2>) {
this._drawLine(ctx, corners[0], corners[1]);
this._drawLine(ctx, corners[1], corners[2]);
this._drawLine(ctx, corners[2], corners[3]);
this._drawLine(ctx, corners[3], corners[0]);
Debug._drawLine(ctx, corners[0], corners[1]);
Debug._drawLine(ctx, corners[1], corners[2]);
Debug._drawLine(ctx, corners[2], corners[3]);
Debug._drawLine(ctx, corners[3], corners[0]);
},

@@ -90,8 +97,8 @@

ctx.beginPath();
this._drawQuad(ctx, corners.slice(0, 4));
this._drawQuad(ctx, corners.slice(4));
this._drawLine(ctx, corners[0], corners[4]);
this._drawLine(ctx, corners[1], corners[5]);
this._drawLine(ctx, corners[2], corners[6]);
this._drawLine(ctx, corners[3], corners[7]);
Debug._drawQuad(ctx, corners.slice(0, 4));
Debug._drawQuad(ctx, corners.slice(4));
Debug._drawLine(ctx, corners[0], corners[4]);
Debug._drawLine(ctx, corners[1], corners[5]);
Debug._drawLine(ctx, corners[2], corners[6]);
Debug._drawLine(ctx, corners[3], corners[7]);
ctx.stroke();

@@ -108,3 +115,3 @@ },

if (!tr.freezeTileCoverage) {
this.aabbCorners = coords.map(coord => {
Debug.aabbCorners = coords.map(coord => {
// Get tile AABBs in world/pixel space scaled by worldSize

@@ -118,2 +125,3 @@ const aabb = aabbForTileOnGlobe(tr, tr.worldSize, coord.canonical);

}
// $FlowFixMe[incompatible-type]
return corners;

@@ -123,7 +131,7 @@ });

const canvas = this._initializeCanvas(tr);
const canvas = Debug._initializeCanvas(tr);
const ctx = canvas.getContext('2d');
ctx.clearRect(0, 0, canvas.width, canvas.height);
const tileCount = this.aabbCorners.length;
const tileCount = Debug.aabbCorners.length;
ctx.shadowColor = '#000';

@@ -134,3 +142,3 @@ ctx.shadowBlur = 2;

for (let i = 0; i < tileCount; i++) {
const pixelCorners = this.aabbCorners[i].map(ecef => {
const pixelCorners = Debug.aabbCorners[i].map(ecef => {
// Clipping to prevent visual artifacts.

@@ -141,8 +149,13 @@ // We don't draw any lines if one of their points is behind the camera.

// Full AABBs can be viewed by enabling `map.transform.freezeTileCoverage` and panning.
// $FlowFixMe[incompatible-call]
const cameraPos = vec3.transformMat4([], ecef, ecefToCameraMatrix);
// $FlowFixMe[incompatible-call]
if (cameraPos[2] > 0) { return null; }
// $FlowFixMe[incompatible-call]
return vec3.transformMat4([], ecef, ecefToPixelMatrix);
});
ctx.strokeStyle = `hsl(${360 * i / tileCount}, 100%, 50%)`;
this._drawBox(ctx, pixelCorners);
Debug._drawBox(ctx, pixelCorners);
}

@@ -152,7 +165,7 @@ },

clearAabbs() {
if (!this.debugCanvas) { return; }
this.debugCanvas.getContext('2d').clearRect(0, 0, this.debugCanvas.width, this.debugCanvas.height);
this.aabbCorners = [];
if (!Debug.debugCanvas) return;
// $FlowFixMe[incompatible-use] - Flow doesn't know that debugCanvas is non-null here
Debug.debugCanvas.getContext('2d').clearRect(0, 0, Debug.debugCanvas.width, Debug.debugCanvas.height);
Debug.aabbCorners = [];
}
};

@@ -9,2 +9,3 @@ // @flow strict

// refine the return type based on tagName, e.g. 'button' -> HTMLButtonElement
// $FlowFixMe[method-unbinding]
export function create<T: string>(tagName: T, className: ?string, container?: HTMLElement): $Call<typeof document.createElement, T> {

@@ -11,0 +12,0 @@ const el = window.document.createElement(tagName);

// @flow
import {extend} from './util.js';
import type {MapEvent} from '../ui/events.js';

@@ -70,3 +71,3 @@ type Listener = (Object) => any;

*/
on(type: *, listener: Listener): this {
on(type: MapEvent, listener: Listener): this {
this._listeners = this._listeners || {};

@@ -85,3 +86,3 @@ _addEventListener(type, listener, this._listeners);

*/
off(type: *, listener: Listener): this {
off(type: MapEvent, listener: Listener): this {
_removeEventListener(type, listener, this._listeners);

@@ -103,3 +104,3 @@ _removeEventListener(type, listener, this._oneTimeListeners);

*/
once(type: *, listener?: Listener): this | Promise<Event> {
once(type: MapEvent, listener?: Listener): this | Promise<Event> {
if (!listener) {

@@ -106,0 +107,0 @@ return new Promise(resolve => this.once(type, resolve));

@@ -85,7 +85,14 @@ // @flow

function Cell(x, y, h, polygon) {
this.p = new Point(x, y);
this.h = h; // half the cell size
this.d = pointToPolygonDist(this.p, polygon); // distance from cell center to polygon
this.max = this.d + this.h * Math.SQRT2; // max distance to polygon within a cell
class Cell {
p: Point;
h: number;
d: number;
max: number;
constructor(x, y, h, polygon) {
this.p = new Point(x, y);
this.h = h; // half the cell size
this.d = pointToPolygonDist(this.p, polygon); // distance from cell center to polygon
this.max = this.d + this.h * Math.SQRT2; // max distance to polygon within a cell
}
}

@@ -92,0 +99,0 @@

@@ -5,3 +5,3 @@ // @flow

let globalWorkerPool;
let globalWorkerPool: ?WorkerPool;

@@ -8,0 +8,0 @@ /**

@@ -7,5 +7,5 @@ // @flow

export type Size = {
export type Size = interface {
width: number,
height: number
height: number,
};

@@ -12,0 +12,0 @@

@@ -644,11 +644,15 @@ // @flow

const turnstileEvent_ = new TurnstileEvent();
// $FlowFixMe[method-unbinding]
export const postTurnstileEvent: (tileUrls: Array<string>, customAccessToken?: ?string) => void = turnstileEvent_.postTurnstileEvent.bind(turnstileEvent_);
const mapLoadEvent_ = new MapLoadEvent();
// $FlowFixMe[method-unbinding]
export const postMapLoadEvent: (number, string, ?string, EventCallback) => void = mapLoadEvent_.postMapLoadEvent.bind(mapLoadEvent_);
export const performanceEvent_: PerformanceEvent = new PerformanceEvent();
// $FlowFixMe[method-unbinding]
export const postPerformanceEvent: (?string, LivePerformanceData) => void = performanceEvent_.postPerformanceEvent.bind(performanceEvent_);
const mapSessionAPI_ = new MapSessionAPI();
// $FlowFixMe[method-unbinding]
export const getMapSessionAPI: (number, string, ?string, EventCallback) => void = mapSessionAPI_.getSessionAPI.bind(mapSessionAPI_);

@@ -655,0 +659,0 @@

@@ -35,2 +35,3 @@ // @flow

bindAll(['process'], this);
// $FlowFixMe[method-unbinding]
this.invoker = new ThrottledInvoker(this.process);

@@ -37,0 +38,0 @@

@@ -138,3 +138,3 @@ // @flow

// $FlowFixMe not-an-object - newer Flow doesn't understand this pattern, silence for now
const structArray = Object.create(this.prototype);
const structArray: {[_: string]: any} = Object.create(this.prototype);
structArray.arrayBuffer = input.arrayBuffer;

@@ -141,0 +141,0 @@ structArray.length = input.length;

// @flow
import type {LayerSpecification} from '../style-spec/types.js';
import type {LayerSpecification, SourceSpecification} from '../style-spec/types.js';
import type {GeoJSONGeometry, GeoJSONFeature} from '@mapbox/geojson-types';

@@ -7,6 +7,9 @@ import type {IVectorTileFeature} from '@mapbox/vector-tile';

// we augment GeoJSON with custom properties in query*Features results
export type QueryFeature = $ReadOnly<GeoJSONFeature> & {
export interface QueryFeature extends GeoJSONFeature {
layer?: ?LayerSpecification;
source?: ?SourceSpecification | ?mixed;
sourceLayer?: ?string | ?mixed;
state: ?mixed;
[key: string]: mixed;
};
}

@@ -18,3 +21,3 @@ const customProps = ['tile', 'layer', 'source', 'sourceLayer', 'state'];

_geometry: ?GeoJSONGeometry;
properties: {};
properties: ?{};
id: number | string | void;

@@ -58,2 +61,3 @@ _vectorTileFeature: IVectorTileFeature;

type: 'Feature',
state: undefined,
geometry: this.geometry,

@@ -60,0 +64,0 @@ properties: this.properties

@@ -88,3 +88,5 @@ // @flow

'「': '﹁',
'」': '﹂'
'」': '﹂',
'←': '↑',
'→': '↓'
};

@@ -91,0 +93,0 @@

@@ -16,3 +16,3 @@ // @flow

type SerializedObject = {[_: string]: Serialized }; // eslint-disable-line
type SerializedObject = interface { [_: string]: Serialized };
export type Serialized =

@@ -198,3 +198,3 @@ | null

if (input instanceof Error) {
properties.message = input.message;
properties['message'] = input.message;
}

@@ -206,7 +206,7 @@ } else {

if (properties.$name) {
if (properties['$name']) {
throw new Error('$name property is reserved for worker serialization logic.');
}
if (name !== 'Object') {
properties.$name = name;
properties['$name'] = name;
}

@@ -254,5 +254,6 @@

const result = Object.create(klass.prototype);
const result: {[_: string]: any} = Object.create(klass.prototype);
for (const key of Object.keys(input)) {
// $FlowFixMe[incompatible-type]
if (key === '$name') continue;

@@ -259,0 +260,0 @@ const value = (input: SerializedObject)[key];

@@ -27,4 +27,4 @@ // @flow

registerWorkerSource: (string, Class<WorkerSource>) => void,
registerRTLTextPlugin: (_: any) => void
registerWorkerSource?: (string, Class<WorkerSource>) => void,
registerRTLTextPlugin?: (_: any) => void
}

@@ -36,4 +36,4 @@

target: MessageBus;
registerWorkerSource: *;
registerRTLTextPlugin: *;
registerWorkerSource: any;
registerRTLTextPlugin: any;

@@ -40,0 +40,0 @@ constructor(addListeners: Array<MessageListener>, postListeners: Array<MessageListener>) {

@@ -83,2 +83,3 @@ // @flow strict

global.WorkerGlobalScope = function() {};
// $FlowFixMe[invalid-constructor]
global.self = new global.WorkerGlobalScope();

@@ -85,0 +86,0 @@ };

@@ -17,3 +17,3 @@ // @flow

const metrics = PerformanceUtils.getPerformanceMetrics();
const dispatcher = new Dispatcher(getWorkerPool(), this);
const dispatcher = new Dispatcher(getWorkerPool(), WorkerPerformanceUtils);

@@ -20,0 +20,0 @@ const createTime = performance.getEntriesByName('create', 'mark')[0].startTime;

@@ -28,2 +28,3 @@ // @flow

while (this.workers.length < WorkerPool.workerCount) {
// $FlowFixMe[invalid-constructor]
this.workers.push(new WebWorker());

@@ -30,0 +31,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc