UNPKG

maplibre-gl

Version:

BSD licensed community fork of mapbox-gl, a WebGL interactive maps library

1,628 lines (1,626 loc) 421 kB
// Generated by dts-bundle-generator v6.12.0 import Point from '@mapbox/point-geometry'; import TinySDF from '@mapbox/tiny-sdf'; import { VectorTileFeature, VectorTileLayer } from '@mapbox/vector-tile'; import { mat2, mat4, vec4 } from 'gl-matrix'; import { PotpackBox } from 'potpack'; export declare type Callback<T> = (error?: Error | null, result?: T | null) => void; export declare type Cancelable = { cancel: () => void; }; export interface IResourceType { Unknown: keyof this; Style: keyof this; Source: keyof this; Tile: keyof this; Glyphs: keyof this; SpriteImage: keyof this; SpriteJSON: keyof this; Image: keyof this; } /** * A `RequestParameters` object to be returned from Map.options.transformRequest callbacks. * @typedef {Object} RequestParameters * @property {string} url The URL to be requested. * @property {Object} headers The headers to be sent with the request. * @property {string} method Request method `'GET' | 'POST' | 'PUT'`. * @property {string} body Request body. * @property {string} type Response body type to be returned `'string' | 'json' | 'arrayBuffer'`. * @property {string} credentials `'same-origin'|'include'` Use 'include' to send cookies with cross-origin requests. * @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. * @example * // use transformRequest to modify requests that begin with `http://myHost` * transformRequest: function(url, resourceType) { * if (resourceType === 'Source' && url.indexOf('http://myHost') > -1) { * return { * url: url.replace('http', 'https'), * headers: { 'my-custom-header': true }, * credentials: 'include' // Include cookies for cross-origin requests * } * } * } * */ export declare type RequestParameters = { url: string; headers?: any; method?: "GET" | "POST" | "PUT"; body?: string; type?: "string" | "json" | "arrayBuffer"; credentials?: "same-origin" | "include"; collectResourceTiming?: boolean; }; export declare type ResponseCallback<T> = (error?: Error | null, data?: T | null, cacheControl?: string | null, expires?: string | null) => void; export declare class AJAXError extends Error { /** * The response's HTTP status code. */ status: number; /** * The response's HTTP status text. */ statusText: string; /** * The request's URL. */ url: string; /** * The response's body. */ body: Blob; constructor(status: number, statusText: string, url: string, body: Blob); } export declare type ExpiryData = { cacheControl?: string | null; expires?: Date | string | null; }; export declare type GetImageCallback = (error?: Error | null, image?: HTMLImageElement | ImageBitmap | null, expiry?: ExpiryData | null) => void; export declare type ResourceTypeEnum = keyof IResourceType; export declare type RequestTransformFunction = (url: string, resourceType?: ResourceTypeEnum) => RequestParameters; export declare class RequestManager { _transformRequestFn: RequestTransformFunction; constructor(transformRequestFn?: RequestTransformFunction); transformRequest(url: string, type: ResourceTypeEnum): RequestParameters; normalizeSpriteURL(url: string, format: string, extension: string): string; setTransformRequest(transformRequest: RequestTransformFunction): void; } export declare type Listener = (a: any) => any; export declare type Listeners = { [_: string]: Array<Listener>; }; export declare class Event { readonly type: string; constructor(type: string, data?: any); } export declare class Evented { _listeners: Listeners; _oneTimeListeners: Listeners; _eventedParent: Evented; _eventedParentData: any | (() => any); /** * Adds a listener to a specified event type. * * @param {string} type The event type to add a listen for. * @param {Function} listener The function to be called when the event is fired. * The listener function is called with the data object passed to `fire`, * extended with `target` and `type` properties. * @returns {Object} `this` */ on(type: string, listener: Listener): this; /** * Removes a previously registered event listener. * * @param {string} type The event type to remove listeners for. * @param {Function} listener The listener function to remove. * @returns {Object} `this` */ off(type: string, listener: Listener): this; /** * Adds a listener that will be called only once to a specified event type. * * The listener will be called first time the event fires after the listener is registered. * * @param {string} type The event type to listen for. * @param {Function} listener The function to be called when the event is fired the first time. * @returns {Object} `this` */ once(type: string, listener: Listener): this; fire(event: Event | string, properties?: any): this; /** * Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type. * * @param {string} type The event type * @returns {boolean} `true` if there is at least one registered listener for specified event type, `false` otherwise * @private */ listens(type: string): any; /** * Bubble all events fired by this instance of Evented to this parent instance of Evented. * * @private * @returns {Object} `this` * @private */ setEventedParent(parent?: Evented | null, data?: any | (() => any)): this; } export declare class Color { r: number; g: number; b: number; a: number; constructor(r: number, g: number, b: number, a?: number); static black: Color; static white: Color; static transparent: Color; static red: Color; /** * Parses valid CSS color strings and returns a `Color` instance. * @returns A `Color` instance, or `undefined` if the input is not a valid color string. */ static parse(input?: string | Color | null): Color | void; /** * Returns an RGBA string representing the color value. * * @returns An RGBA string. * @example * var purple = new Color.parse('purple'); * purple.toString; // = "rgba(128,0,128,1)" * var translucentGreen = new Color.parse('rgba(26, 207, 26, .73)'); * translucentGreen.toString(); // = "rgba(26,207,26,0.73)" */ toString(): string; toArray(): [ number, number, number, number ]; } export declare class ZoomHistory { lastZoom: number; lastFloorZoom: number; lastIntegerZoom: number; lastIntegerZoomTime: number; first: boolean; constructor(); update(z: number, now: number): boolean; } export declare type ColorSpecification = string; export declare type PaddingSpecification = number | number[]; export declare type FormattedSpecification = string; export declare type ResolvedImageSpecification = string; export declare type PromoteIdSpecification = { [_: string]: string; } | string; export declare type ExpressionInputType = string | number | boolean; export declare type CollatorExpressionSpecification = [ "collator", { "case-sensitive"?: boolean | ExpressionSpecification; "diacritic-sensitive"?: boolean | ExpressionSpecification; locale?: string | ExpressionSpecification; } ]; export declare type InterpolationSpecification = [ "linear" ] | [ "exponential", number | ExpressionSpecification ] | [ "cubic-bezier", number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification ]; export declare type ExpressionSpecification = [ "array", unknown | ExpressionSpecification ] | [ "array", ExpressionInputType | ExpressionSpecification, unknown | ExpressionSpecification ] | [ "array", ExpressionInputType | ExpressionSpecification, number | ExpressionSpecification, unknown | ExpressionSpecification ] | [ "boolean", ...(unknown | ExpressionSpecification)[], unknown | ExpressionSpecification ] | CollatorExpressionSpecification | [ "format", ...(string | [ "image", ExpressionSpecification ] | ExpressionSpecification | { "font-scale"?: number | ExpressionSpecification; "text-font"?: string[] | ExpressionSpecification; "text-color": ColorSpecification | ExpressionSpecification; })[] ] | [ "image", unknown | ExpressionSpecification ] | [ "literal", unknown ] | [ "number", unknown | ExpressionSpecification, ...(unknown | ExpressionSpecification)[] ] | [ "number-format", number | ExpressionSpecification, { "locale"?: string | ExpressionSpecification; "currency"?: string | ExpressionSpecification; "min-fraction-digits"?: number | ExpressionSpecification; "max-fraction-digits"?: number | ExpressionSpecification; } ] | [ "object", unknown | ExpressionSpecification, ...(unknown | ExpressionSpecification)[] ] | [ "string", unknown | ExpressionSpecification, ...(unknown | ExpressionSpecification)[] ] | [ "to-boolean", unknown | ExpressionSpecification ] | [ "to-color", unknown | ExpressionSpecification, ...(unknown | ExpressionSpecification)[] ] | [ "to-number", unknown | ExpressionSpecification, ...(unknown | ExpressionSpecification)[] ] | [ "to-string", unknown | ExpressionSpecification ] | [ "accumulated" ] | [ "feature-state", string ] | [ "geometry-type" ] | [ "id" ] | [ "line-progress" ] | [ "properties" ] | [ "at", number | ExpressionSpecification, ExpressionSpecification ] | [ "get", string | ExpressionSpecification, (Record<string, unknown> | ExpressionSpecification)? ] | [ "has", string | ExpressionSpecification, (Record<string, unknown> | ExpressionSpecification)? ] | [ "in", ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification ] | [ "index-of", ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification ] | [ "length", string | ExpressionSpecification ] | [ "slice", string | ExpressionSpecification, number | ExpressionSpecification ] | [ "!", boolean | ExpressionSpecification ] | [ "!=", ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, CollatorExpressionSpecification? ] | [ "<", ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, CollatorExpressionSpecification? ] | [ "<=", ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, CollatorExpressionSpecification? ] | [ "==", ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, CollatorExpressionSpecification? ] | [ ">", ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, CollatorExpressionSpecification? ] | [ ">=", ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, CollatorExpressionSpecification? ] | [ "all", ...(boolean | ExpressionSpecification)[] ] | [ "any", ...(boolean | ExpressionSpecification)[] ] | [ "case", boolean | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, ...(boolean | ExpressionInputType | ExpressionSpecification)[], ExpressionInputType | ExpressionSpecification ] | [ "coalesce", ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, ...(ExpressionInputType | ExpressionSpecification)[] ] | [ "match", ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionInputType[], ExpressionInputType | ExpressionSpecification, ...(ExpressionInputType | ExpressionInputType[] | ExpressionSpecification)[], ExpressionInputType ] | [ "within", unknown | ExpressionSpecification ] | [ "interpolate", InterpolationSpecification, number | ExpressionSpecification, number | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, ...(number | ExpressionInputType | ExpressionSpecification)[] ] | [ "interpolate-hcl", InterpolationSpecification, number | ExpressionSpecification, number | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, ...(number | ColorSpecification | ExpressionSpecification)[] ] | [ "interpolate-lab", InterpolationSpecification, number | ExpressionSpecification, number | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, ...(number | ColorSpecification | ExpressionSpecification)[] ] | [ "step", number | ExpressionSpecification, number | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, ...(number | ExpressionInputType | ExpressionSpecification)[] ] | [ "let", string, ExpressionInputType | ExpressionSpecification, ...(string | ExpressionInputType | ExpressionSpecification)[] ] | [ "var", string ] | [ "concat", ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, ...(ExpressionInputType | ExpressionSpecification)[] ] | [ "downcase", string | ExpressionSpecification ] | [ "is-supported-script", string | ExpressionSpecification ] | [ "resolved-locale", CollatorExpressionSpecification ] | [ "upcase", string | ExpressionSpecification ] | [ "rgb", number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification ] | [ "rgba", number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification ] | [ "to-rgba", ColorSpecification | ExpressionSpecification ] | [ "-", number | ExpressionSpecification, (number | ExpressionSpecification)? ] | [ "*", number | ExpressionSpecification, number | ExpressionSpecification, ...(number | ExpressionSpecification)[] ] | [ "/", number | ExpressionSpecification, number | ExpressionSpecification ] | [ "%", number | ExpressionSpecification, number | ExpressionSpecification ] | [ "^", number | ExpressionSpecification, number | ExpressionSpecification ] | [ "+", number | ExpressionSpecification, number | ExpressionSpecification, ...(number | ExpressionSpecification)[] ] | [ "abs", number | ExpressionSpecification ] | [ "acos", number | ExpressionSpecification ] | [ "asin", number | ExpressionSpecification ] | [ "atan", number | ExpressionSpecification ] | [ "ceil", number | ExpressionSpecification ] | [ "cos", number | ExpressionSpecification ] | [ "distance", Record<string, unknown> | ExpressionSpecification ] | [ "ExpressionSpecification" ] | [ "floor", number | ExpressionSpecification ] | [ "ln", number | ExpressionSpecification ] | [ "ln2" ] | [ "log10", number | ExpressionSpecification ] | [ "log2", number | ExpressionSpecification ] | [ "max", number | ExpressionSpecification, ...(number | ExpressionSpecification)[] ] | [ "min", number | ExpressionSpecification, ...(number | ExpressionSpecification)[] ] | [ "pi" ] | [ "round", number | ExpressionSpecification ] | [ "sin", number | ExpressionSpecification ] | [ "sqrt", number | ExpressionSpecification ] | [ "tan", number | ExpressionSpecification ] | [ "zoom" ] | [ "heatmap-density" ]; export declare type ExpressionFilterSpecification = boolean | ExpressionSpecification; export declare type LegacyFilterSpecification = [ "has", string ] | [ "!has", string ] | [ "==", string, string | number | boolean ] | [ "!=", string, string | number | boolean ] | [ ">", string, string | number | boolean ] | [ ">=", string, string | number | boolean ] | [ "<", string, string | number | boolean ] | [ "<=", string, string | number | boolean ] | [ "in", string, ...(string | number | boolean)[] ] | [ "!in", string, ...(string | number | boolean)[] ] | [ "all", ...LegacyFilterSpecification[] ] | [ "any", ...LegacyFilterSpecification[] ] | [ "none", ...LegacyFilterSpecification[] ]; export declare type FilterSpecification = ExpressionFilterSpecification | LegacyFilterSpecification; export declare type TransitionSpecification = { duration?: number; delay?: number; }; export declare type CameraFunctionSpecification<T> = { type: "exponential"; stops: Array<[ number, T ]>; } | { type: "interval"; stops: Array<[ number, T ]>; }; export declare type SourceFunctionSpecification<T> = { type: "exponential"; stops: Array<[ number, T ]>; property: string; default?: T; } | { type: "interval"; stops: Array<[ number, T ]>; property: string; default?: T; } | { type: "categorical"; stops: Array<[ string | number | boolean, T ]>; property: string; default?: T; } | { type: "identity"; property: string; default?: T; }; export declare type CompositeFunctionSpecification<T> = { type: "exponential"; stops: Array<[ { zoom: number; value: number; }, T ]>; property: string; default?: T; } | { type: "interval"; stops: Array<[ { zoom: number; value: number; }, T ]>; property: string; default?: T; } | { type: "categorical"; stops: Array<[ { zoom: number; value: string | number | boolean; }, T ]>; property: string; default?: T; }; export declare type PropertyValueSpecification<T> = T | CameraFunctionSpecification<T> | ExpressionSpecification; export declare type DataDrivenPropertyValueSpecification<T> = T | CameraFunctionSpecification<T> | SourceFunctionSpecification<T> | CompositeFunctionSpecification<T> | ExpressionSpecification; export declare type StyleSpecification = { "version": 8; "name"?: string; "metadata"?: unknown; "center"?: Array<number>; "zoom"?: number; "bearing"?: number; "pitch"?: number; "light"?: LightSpecification; "terrain"?: TerrainSpecification; "sources": { [_: string]: SourceSpecification; }; "sprite"?: string; "glyphs"?: string; "transition"?: TransitionSpecification; "layers": Array<LayerSpecification>; }; export declare type LightSpecification = { "anchor"?: PropertyValueSpecification<"map" | "viewport">; "position"?: PropertyValueSpecification<[ number, number, number ]>; "color"?: PropertyValueSpecification<ColorSpecification>; "intensity"?: PropertyValueSpecification<number>; }; export declare type TerrainSpecification = { "source": string; "exaggeration"?: number; "elevationOffset"?: number; }; export declare type VectorSourceSpecification = { "type": "vector"; "url"?: string; "tiles"?: Array<string>; "bounds"?: [ number, number, number, number ]; "scheme"?: "xyz" | "tms"; "minzoom"?: number; "maxzoom"?: number; "attribution"?: string; "promoteId"?: PromoteIdSpecification; "volatile"?: boolean; }; export declare type RasterSourceSpecification = { "type": "raster"; "url"?: string; "tiles"?: Array<string>; "bounds"?: [ number, number, number, number ]; "minzoom"?: number; "maxzoom"?: number; "tileSize"?: number; "scheme"?: "xyz" | "tms"; "attribution"?: string; "volatile"?: boolean; }; export declare type RasterDEMSourceSpecification = { "type": "raster-dem"; "url"?: string; "tiles"?: Array<string>; "bounds"?: [ number, number, number, number ]; "minzoom"?: number; "maxzoom"?: number; "tileSize"?: number; "attribution"?: string; "encoding"?: "terrarium" | "mapbox"; "volatile"?: boolean; }; export declare type GeoJSONSourceSpecification = { "type": "geojson"; "data"?: unknown; "maxzoom"?: number; "attribution"?: string; "buffer"?: number; "filter"?: unknown; "tolerance"?: number; "cluster"?: boolean; "clusterRadius"?: number; "clusterMaxZoom"?: number; "clusterMinPoints"?: number; "clusterProperties"?: unknown; "lineMetrics"?: boolean; "generateId"?: boolean; "promoteId"?: PromoteIdSpecification; }; export declare type VideoSourceSpecification = { "type": "video"; "urls": Array<string>; "coordinates": [ [ number, number ], [ number, number ], [ number, number ], [ number, number ] ]; }; export declare type ImageSourceSpecification = { "type": "image"; "url": string; "coordinates": [ [ number, number ], [ number, number ], [ number, number ], [ number, number ] ]; }; export declare type SourceSpecification = VectorSourceSpecification | RasterSourceSpecification | RasterDEMSourceSpecification | GeoJSONSourceSpecification | VideoSourceSpecification | ImageSourceSpecification; export declare type FillLayerSpecification = { "id": string; "type": "fill"; "metadata"?: unknown; "source": string; "source-layer"?: string; "minzoom"?: number; "maxzoom"?: number; "filter"?: FilterSpecification; "layout"?: { "fill-sort-key"?: DataDrivenPropertyValueSpecification<number>; "visibility"?: "visible" | "none"; }; "paint"?: { "fill-antialias"?: PropertyValueSpecification<boolean>; "fill-opacity"?: DataDrivenPropertyValueSpecification<number>; "fill-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>; "fill-outline-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>; "fill-translate"?: PropertyValueSpecification<[ number, number ]>; "fill-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">; "fill-pattern"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>; }; }; export declare type LineLayerSpecification = { "id": string; "type": "line"; "metadata"?: unknown; "source": string; "source-layer"?: string; "minzoom"?: number; "maxzoom"?: number; "filter"?: FilterSpecification; "layout"?: { "line-cap"?: PropertyValueSpecification<"butt" | "round" | "square">; "line-join"?: DataDrivenPropertyValueSpecification<"bevel" | "round" | "miter">; "line-miter-limit"?: PropertyValueSpecification<number>; "line-round-limit"?: PropertyValueSpecification<number>; "line-sort-key"?: DataDrivenPropertyValueSpecification<number>; "visibility"?: "visible" | "none"; }; "paint"?: { "line-opacity"?: DataDrivenPropertyValueSpecification<number>; "line-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>; "line-translate"?: PropertyValueSpecification<[ number, number ]>; "line-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">; "line-width"?: DataDrivenPropertyValueSpecification<number>; "line-gap-width"?: DataDrivenPropertyValueSpecification<number>; "line-offset"?: DataDrivenPropertyValueSpecification<number>; "line-blur"?: DataDrivenPropertyValueSpecification<number>; "line-dasharray"?: PropertyValueSpecification<Array<number>>; "line-pattern"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>; "line-gradient"?: ExpressionSpecification; }; }; export declare type SymbolLayerSpecification = { "id": string; "type": "symbol"; "metadata"?: unknown; "source": string; "source-layer"?: string; "minzoom"?: number; "maxzoom"?: number; "filter"?: FilterSpecification; "layout"?: { "symbol-placement"?: PropertyValueSpecification<"point" | "line" | "line-center">; "symbol-spacing"?: PropertyValueSpecification<number>; "symbol-avoid-edges"?: PropertyValueSpecification<boolean>; "symbol-sort-key"?: DataDrivenPropertyValueSpecification<number>; "symbol-z-order"?: PropertyValueSpecification<"auto" | "viewport-y" | "source">; "icon-allow-overlap"?: PropertyValueSpecification<boolean>; "icon-overlap"?: PropertyValueSpecification<"never" | "always" | "cooperative">; "icon-ignore-placement"?: PropertyValueSpecification<boolean>; "icon-optional"?: PropertyValueSpecification<boolean>; "icon-rotation-alignment"?: PropertyValueSpecification<"map" | "viewport" | "auto">; "icon-size"?: DataDrivenPropertyValueSpecification<number>; "icon-text-fit"?: PropertyValueSpecification<"none" | "width" | "height" | "both">; "icon-text-fit-padding"?: PropertyValueSpecification<[ number, number, number, number ]>; "icon-image"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>; "icon-rotate"?: DataDrivenPropertyValueSpecification<number>; "icon-padding"?: DataDrivenPropertyValueSpecification<PaddingSpecification>; "icon-keep-upright"?: PropertyValueSpecification<boolean>; "icon-offset"?: DataDrivenPropertyValueSpecification<[ number, number ]>; "icon-anchor"?: DataDrivenPropertyValueSpecification<"center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right">; "icon-pitch-alignment"?: PropertyValueSpecification<"map" | "viewport" | "auto">; "text-pitch-alignment"?: PropertyValueSpecification<"map" | "viewport" | "auto">; "text-rotation-alignment"?: PropertyValueSpecification<"map" | "viewport" | "viewport-glyph" | "auto">; "text-field"?: DataDrivenPropertyValueSpecification<FormattedSpecification>; "text-font"?: DataDrivenPropertyValueSpecification<Array<string>>; "text-size"?: DataDrivenPropertyValueSpecification<number>; "text-max-width"?: DataDrivenPropertyValueSpecification<number>; "text-line-height"?: PropertyValueSpecification<number>; "text-letter-spacing"?: DataDrivenPropertyValueSpecification<number>; "text-justify"?: DataDrivenPropertyValueSpecification<"auto" | "left" | "center" | "right">; "text-radial-offset"?: DataDrivenPropertyValueSpecification<number>; "text-variable-anchor"?: PropertyValueSpecification<Array<"center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right">>; "text-anchor"?: DataDrivenPropertyValueSpecification<"center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right">; "text-max-angle"?: PropertyValueSpecification<number>; "text-writing-mode"?: PropertyValueSpecification<Array<"horizontal" | "vertical">>; "text-rotate"?: DataDrivenPropertyValueSpecification<number>; "text-padding"?: PropertyValueSpecification<number>; "text-keep-upright"?: PropertyValueSpecification<boolean>; "text-transform"?: DataDrivenPropertyValueSpecification<"none" | "uppercase" | "lowercase">; "text-offset"?: DataDrivenPropertyValueSpecification<[ number, number ]>; "text-allow-overlap"?: PropertyValueSpecification<boolean>; "text-overlap"?: PropertyValueSpecification<"never" | "always" | "cooperative">; "text-ignore-placement"?: PropertyValueSpecification<boolean>; "text-optional"?: PropertyValueSpecification<boolean>; "visibility"?: "visible" | "none"; }; "paint"?: { "icon-opacity"?: DataDrivenPropertyValueSpecification<number>; "icon-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>; "icon-halo-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>; "icon-halo-width"?: DataDrivenPropertyValueSpecification<number>; "icon-halo-blur"?: DataDrivenPropertyValueSpecification<number>; "icon-translate"?: PropertyValueSpecification<[ number, number ]>; "icon-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">; "text-opacity"?: DataDrivenPropertyValueSpecification<number>; "text-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>; "text-halo-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>; "text-halo-width"?: DataDrivenPropertyValueSpecification<number>; "text-halo-blur"?: DataDrivenPropertyValueSpecification<number>; "text-translate"?: PropertyValueSpecification<[ number, number ]>; "text-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">; }; }; export declare type CircleLayerSpecification = { "id": string; "type": "circle"; "metadata"?: unknown; "source": string; "source-layer"?: string; "minzoom"?: number; "maxzoom"?: number; "filter"?: FilterSpecification; "layout"?: { "circle-sort-key"?: DataDrivenPropertyValueSpecification<number>; "visibility"?: "visible" | "none"; }; "paint"?: { "circle-radius"?: DataDrivenPropertyValueSpecification<number>; "circle-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>; "circle-blur"?: DataDrivenPropertyValueSpecification<number>; "circle-opacity"?: DataDrivenPropertyValueSpecification<number>; "circle-translate"?: PropertyValueSpecification<[ number, number ]>; "circle-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">; "circle-pitch-scale"?: PropertyValueSpecification<"map" | "viewport">; "circle-pitch-alignment"?: PropertyValueSpecification<"map" | "viewport">; "circle-stroke-width"?: DataDrivenPropertyValueSpecification<number>; "circle-stroke-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>; "circle-stroke-opacity"?: DataDrivenPropertyValueSpecification<number>; }; }; export declare type HeatmapLayerSpecification = { "id": string; "type": "heatmap"; "metadata"?: unknown; "source": string; "source-layer"?: string; "minzoom"?: number; "maxzoom"?: number; "filter"?: FilterSpecification; "layout"?: { "visibility"?: "visible" | "none"; }; "paint"?: { "heatmap-radius"?: DataDrivenPropertyValueSpecification<number>; "heatmap-weight"?: DataDrivenPropertyValueSpecification<number>; "heatmap-intensity"?: PropertyValueSpecification<number>; "heatmap-color"?: ExpressionSpecification; "heatmap-opacity"?: PropertyValueSpecification<number>; }; }; export declare type FillExtrusionLayerSpecification = { "id": string; "type": "fill-extrusion"; "metadata"?: unknown; "source": string; "source-layer"?: string; "minzoom"?: number; "maxzoom"?: number; "filter"?: FilterSpecification; "layout"?: { "visibility"?: "visible" | "none"; }; "paint"?: { "fill-extrusion-opacity"?: PropertyValueSpecification<number>; "fill-extrusion-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>; "fill-extrusion-translate"?: PropertyValueSpecification<[ number, number ]>; "fill-extrusion-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">; "fill-extrusion-pattern"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>; "fill-extrusion-height"?: DataDrivenPropertyValueSpecification<number>; "fill-extrusion-base"?: DataDrivenPropertyValueSpecification<number>; "fill-extrusion-vertical-gradient"?: PropertyValueSpecification<boolean>; }; }; export declare type RasterLayerSpecification = { "id": string; "type": "raster"; "metadata"?: unknown; "source": string; "source-layer"?: string; "minzoom"?: number; "maxzoom"?: number; "filter"?: FilterSpecification; "layout"?: { "visibility"?: "visible" | "none"; }; "paint"?: { "raster-opacity"?: PropertyValueSpecification<number>; "raster-hue-rotate"?: PropertyValueSpecification<number>; "raster-brightness-min"?: PropertyValueSpecification<number>; "raster-brightness-max"?: PropertyValueSpecification<number>; "raster-saturation"?: PropertyValueSpecification<number>; "raster-contrast"?: PropertyValueSpecification<number>; "raster-resampling"?: PropertyValueSpecification<"linear" | "nearest">; "raster-fade-duration"?: PropertyValueSpecification<number>; }; }; export declare type HillshadeLayerSpecification = { "id": string; "type": "hillshade"; "metadata"?: unknown; "source": string; "source-layer"?: string; "minzoom"?: number; "maxzoom"?: number; "filter"?: FilterSpecification; "layout"?: { "visibility"?: "visible" | "none"; }; "paint"?: { "hillshade-illumination-direction"?: PropertyValueSpecification<number>; "hillshade-illumination-anchor"?: PropertyValueSpecification<"map" | "viewport">; "hillshade-exaggeration"?: PropertyValueSpecification<number>; "hillshade-shadow-color"?: PropertyValueSpecification<ColorSpecification>; "hillshade-highlight-color"?: PropertyValueSpecification<ColorSpecification>; "hillshade-accent-color"?: PropertyValueSpecification<ColorSpecification>; }; }; export declare type BackgroundLayerSpecification = { "id": string; "type": "background"; "metadata"?: unknown; "minzoom"?: number; "maxzoom"?: number; "layout"?: { "visibility"?: "visible" | "none"; }; "paint"?: { "background-color"?: PropertyValueSpecification<ColorSpecification>; "background-pattern"?: PropertyValueSpecification<ResolvedImageSpecification>; "background-opacity"?: PropertyValueSpecification<number>; }; }; export declare type LayerSpecification = FillLayerSpecification | LineLayerSpecification | SymbolLayerSpecification | CircleLayerSpecification | HeatmapLayerSpecification | FillExtrusionLayerSpecification | RasterLayerSpecification | HillshadeLayerSpecification | BackgroundLayerSpecification; export declare type CrossfadeParameters = { fromScale: number; toScale: number; t: number; }; export declare class EvaluationParameters { zoom: number; now: number; fadeDuration: number; zoomHistory: ZoomHistory; transition: TransitionSpecification; constructor(zoom: number, options?: any); isSupportedScript(str: string): boolean; crossFadingFactor(): number; getCrossfadeParameters(): CrossfadeParameters; } export declare class LngLatBounds { _ne: LngLat; _sw: LngLat; constructor(sw?: any, ne?: any); /** * Set the northeast corner of the bounding box * * @param {LngLatLike} ne a {@link LngLatLike} object describing the northeast corner of the bounding box. * @returns {LngLatBounds} `this` */ setNorthEast(ne: LngLatLike): this; /** * Set the southwest corner of the bounding box * * @param {LngLatLike} sw a {@link LngLatLike} object describing the southwest corner of the bounding box. * @returns {LngLatBounds} `this` */ setSouthWest(sw: LngLatLike): this; /** * Extend the bounds to include a given LngLatLike or LngLatBoundsLike. * * @param {LngLatLike|LngLatBoundsLike} obj object to extend to * @returns {LngLatBounds} `this` */ extend(obj: LngLatLike | LngLatBoundsLike): any; /** * Returns the geographical coordinate equidistant from the bounding box's corners. * * @returns {LngLat} The bounding box's center. * @example * var llb = new maplibregl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); * llb.getCenter(); // = LngLat {lng: -73.96365, lat: 40.78315} */ getCenter(): LngLat; /** * Returns the southwest corner of the bounding box. * * @returns {LngLat} The southwest corner of the bounding box. */ getSouthWest(): LngLat; /** * Returns the northeast corner of the bounding box. * * @returns {LngLat} The northeast corner of the bounding box. */ getNorthEast(): LngLat; /** * Returns the northwest corner of the bounding box. * * @returns {LngLat} The northwest corner of the bounding box. */ getNorthWest(): LngLat; /** * Returns the southeast corner of the bounding box. * * @returns {LngLat} The southeast corner of the bounding box. */ getSouthEast(): LngLat; /** * Returns the west edge of the bounding box. * * @returns {number} The west edge of the bounding box. */ getWest(): number; /** * Returns the south edge of the bounding box. * * @returns {number} The south edge of the bounding box. */ getSouth(): number; /** * Returns the east edge of the bounding box. * * @returns {number} The east edge of the bounding box. */ getEast(): number; /** * Returns the north edge of the bounding box. * * @returns {number} The north edge of the bounding box. */ getNorth(): number; /** * Returns the bounding box represented as an array. * * @returns {Array<Array<number>>} The bounding box represented as an array, consisting of the * southwest and northeast coordinates of the bounding represented as arrays of numbers. * @example * var llb = new maplibregl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); * llb.toArray(); // = [[-73.9876, 40.7661], [-73.9397, 40.8002]] */ toArray(): number[][]; /** * Return the bounding box represented as a string. * * @returns {string} The bounding box represents as a string of the format * `'LngLatBounds(LngLat(lng, lat), LngLat(lng, lat))'`. * @example * var llb = new maplibregl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); * llb.toString(); // = "LngLatBounds(LngLat(-73.9876, 40.7661), LngLat(-73.9397, 40.8002))" */ toString(): string; /** * Check if the bounding box is an empty/`null`-type box. * * @returns {boolean} True if bounds have been defined, otherwise false. */ isEmpty(): boolean; /** * Check if the point is within the bounding box. * * @param {LngLatLike} lnglat geographic point to check against. * @returns {boolean} True if the point is within the bounding box. * @example * var llb = new maplibregl.LngLatBounds( * new maplibregl.LngLat(-73.9876, 40.7661), * new maplibregl.LngLat(-73.9397, 40.8002) * ); * * var ll = new maplibregl.LngLat(-73.9567, 40.7789); * * console.log(llb.contains(ll)); // = true */ contains(lnglat: LngLatLike): boolean; /** * Converts an array to a `LngLatBounds` object. * * If a `LngLatBounds` object is passed in, the function returns it unchanged. * * Internally, the function calls `LngLat#convert` to convert arrays to `LngLat` values. * * @param {LngLatBoundsLike} input An array of two coordinates to convert, or a `LngLatBounds` object to return. * @returns {LngLatBounds} A new `LngLatBounds` object, if a conversion occurred, or the original `LngLatBounds` object. * @example * var arr = [[-73.9876, 40.7661], [-73.9397, 40.8002]]; * var llb = maplibregl.LngLatBounds.convert(arr); * llb; // = LngLatBounds {_sw: LngLat {lng: -73.9876, lat: 40.7661}, _ne: LngLat {lng: -73.9397, lat: 40.8002}} */ static convert(input: LngLatBoundsLike | null): LngLatBounds; } /** * A {@link LngLatBounds} object, an array of {@link LngLatLike} objects in [sw, ne] order, * or an array of numbers in [west, south, east, north] order. * * @typedef {LngLatBounds | [LngLatLike, LngLatLike] | [number, number, number, number]} LngLatBoundsLike * @example * var v1 = new maplibregl.LngLatBounds( * new maplibregl.LngLat(-73.9876, 40.7661), * new maplibregl.LngLat(-73.9397, 40.8002) * ); * var v2 = new maplibregl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]) * var v3 = [[-73.9876, 40.7661], [-73.9397, 40.8002]]; */ export declare type LngLatBoundsLike = LngLatBounds | [ LngLatLike, LngLatLike ] | [ number, number, number, number ]; export declare class LngLat { lng: number; lat: number; constructor(lng: number, lat: number); /** * Returns a new `LngLat` object whose longitude is wrapped to the range (-180, 180). * * @returns {LngLat} The wrapped `LngLat` object. * @example * var ll = new maplibregl.LngLat(286.0251, 40.7736); * var wrapped = ll.wrap(); * wrapped.lng; // = -73.9749 */ wrap(): LngLat; /** * Returns the coordinates represented as an array of two numbers. * * @returns {Array<number>} The coordinates represeted as an array of longitude and latitude. * @example * var ll = new maplibregl.LngLat(-73.9749, 40.7736); * ll.toArray(); // = [-73.9749, 40.7736] */ toArray(): number[]; /** * Returns the coordinates represent as a string. * * @returns {string} The coordinates represented as a string of the format `'LngLat(lng, lat)'`. * @example * var ll = new maplibregl.LngLat(-73.9749, 40.7736); * ll.toString(); // = "LngLat(-73.9749, 40.7736)" */ toString(): string; /** * Returns the approximate distance between a pair of coordinates in meters * Uses the Haversine Formula (from R.W. Sinnott, "Virtues of the Haversine", Sky and Telescope, vol. 68, no. 2, 1984, p. 159) * * @param {LngLat} lngLat coordinates to compute the distance to * @returns {number} Distance in meters between the two coordinates. * @example * var new_york = new maplibregl.LngLat(-74.0060, 40.7128); * var los_angeles = new maplibregl.LngLat(-118.2437, 34.0522); * new_york.distanceTo(los_angeles); // = 3935751.690893987, "true distance" using a non-spherical approximation is ~3966km */ distanceTo(lngLat: LngLat): number; /** * Returns a `LngLatBounds` from the coordinates extended by a given `radius`. The returned `LngLatBounds` completely contains the `radius`. * * @param {number} [radius=0] Distance in meters from the coordinates to extend the bounds. * @returns {LngLatBounds} A new `LngLatBounds` object representing the coordinates extended by the `radius`. * @example * var ll = new maplibregl.LngLat(-73.9749, 40.7736); * ll.toBounds(100).toArray(); // = [[-73.97501862141328, 40.77351016847229], [-73.97478137858673, 40.77368983152771]] */ toBounds(radius?: number): LngLatBounds; /** * Converts an array of two numbers or an object with `lng` and `lat` or `lon` and `lat` properties * to a `LngLat` object. * * If a `LngLat` object is passed in, the function returns it unchanged. * * @param {LngLatLike} input An array of two numbers or object to convert, or a `LngLat` object to return. * @returns {LngLat} A new `LngLat` object, if a conversion occurred, or the original `LngLat` object. * @example * var arr = [-73.9749, 40.7736]; * var ll = maplibregl.LngLat.convert(arr); * ll; // = LngLat {lng: -73.9749, lat: 40.7736} */ static convert(input: LngLatLike): LngLat; } /** * A {@link LngLat} object, an array of two numbers representing longitude and latitude, * or an object with `lng` and `lat` or `lon` and `lat` properties. * * @typedef {LngLat | {lng: number, lat: number} | {lon: number, lat: number} | [number, number]} LngLatLike * @example * var v1 = new maplibregl.LngLat(-122.420679, 37.772537); * var v2 = [-122.420679, 37.772537]; * var v3 = {lon: -122.420679, lat: 37.772537}; */ export declare type LngLatLike = LngLat | { lng: number; lat: number; } | { lon: number; lat: number; } | [ number, number ]; export declare class MercatorCoordinate { x: number; y: number; z: number; constructor(x: number, y: number, z?: number); /** * Project a `LngLat` to a `MercatorCoordinate`. * * @param {LngLatLike} lngLatLike The location to project. * @param {number} altitude The altitude in meters of the position. * @returns {MercatorCoordinate} The projected mercator coordinate. * @example * var coord = maplibregl.MercatorCoordinate.fromLngLat({ lng: 0, lat: 0}, 0); * coord; // MercatorCoordinate(0.5, 0.5, 0) */ static fromLngLat(lngLatLike: LngLatLike, altitude?: number): MercatorCoordinate; /** * Returns the `LngLat` for the coordinate. * * @returns {LngLat} The `LngLat` object. * @example * var coord = new maplibregl.MercatorCoordinate(0.5, 0.5, 0); * var lngLat = coord.toLngLat(); // LngLat(0, 0) */ toLngLat(): LngLat; /** * Returns the altitude in meters of the coordinate. * * @returns {number} The altitude in meters. * @example * var coord = new maplibregl.MercatorCoordinate(0, 0, 0.02); * coord.toAltitude(); // 6914.281956295339 */ toAltitude(): number; /** * Returns the distance of 1 meter in `MercatorCoordinate` units at this latitude. * * For coordinates in real world units using meters, this naturally provides the scale * to transform into `MercatorCoordinate`s. * * @returns {number} Distance of 1 meter in `MercatorCoordinate` units. */ meterInMercatorCoordinateUnits(): number; } export declare class CanonicalTileID { z: number; x: number; y: number; key: string; constructor(z: number, x: number, y: number); equals(id: CanonicalTileID): boolean; url(urls: Array<string>, pixelRatio: number, scheme?: string | null): string; isChildOf(parent: CanonicalTileID): boolean; getTilePoint(coord: MercatorCoordinate): Point; toString(): string; } export declare class UnwrappedTileID { wrap: number; canonical: CanonicalTileID; key: string; constructor(wrap: number, canonical: CanonicalTileID); } export declare class OverscaledTileID { overscaledZ: number; wrap: number; canonical: CanonicalTileID; key: string; posMatrix: mat4; constructor(overscaledZ: number, wrap: number, z: number, x: number, y: number); clone(): OverscaledTileID; equals(id: OverscaledTileID): boolean; scaledTo(targetZ: number): OverscaledTileID; calculateScaledKey(targetZ: number, withWrap: boolean): string; isChildOf(parent: OverscaledTileID): boolean; children(sourceMaxZoom: number): OverscaledTileID[]; isLessThan(rhs: OverscaledTileID): boolean; wrapped(): OverscaledTileID; unwrapTo(wrap: number): OverscaledTileID; overscaleFactor(): number; toUnwrapped(): UnwrappedTileID; toString(): string; getTilePoint(coord: MercatorCoordinate): Point; } export declare class Intl$Collator { constructor(locales?: string | string[], options?: CollatorOptions); compare(a: string, b: string): number; resolvedOptions(): any; } export declare type CollatorOptions = { localeMatcher?: "lookup" | "best fit"; usage?: "sort" | "search"; sensitivity?: "base" | "accent" | "case" | "variant"; ignorePunctuation?: boolean; numeric?: boolean; caseFirst?: "upper" | "lower" | "false"; }; export declare class Collator { locale: string | null; sensitivity: "base" | "accent" | "case" | "variant"; collator: Intl$Collator; constructor(caseSensitive: boolean, diacriticSensitive: boolean, locale: string | null); compare(lhs: string, rhs: string): number; resolvedLocale(): string; } export declare type ResolvedImageOptions = { name: string; available: boolean; }; export declare class ResolvedImage { name: string; available: boolean; constructor(options: ResolvedImageOptions); toString(): string; static fromString(name: string): ResolvedImage | null; } export declare class FormattedSection { text: string; image: ResolvedImage | null; scale: number | null; fontStack: string | null; textColor: Color | null; constructor(text: string, image: ResolvedImage | null, scale: number | null, fontStack: string | null, textColor: Color | null); } export declare class Formatted { sections: Array<FormattedSection>; constructor(sections: Array<FormattedSection>); static fromString(unformatted: string): Formatted; isEmpty(): boolean; static factory(text: Formatted | string): Formatted; toString(): string; } export declare class Padding { /** Padding values are in CSS order: top, right, bottom, left */ values: [ number, number, number, number ]; constructor(values: [ number, number, number, number ]); /** * Numeric padding values * @returns A `Padding` instance, or `undefined` if the input is not a valid padding value. */ static parse(input?: number | number[] | Padding | null): Padding | void; toString(): string; } export declare type Value = null | string | boolean | number | Color | Collator | Formatted | Padding | ResolvedImage | ReadonlyArray<Value> | { readonly [x: string]: Value; }; export declare type InterpolationType = { name: "linear"; } | { name: "exponential"; base: number; } | { name: "cubic-bezier"; controlPoints: [ number, number, number, number ]; }; export declare type Feature = { readonly type: 1 | 2 | 3 | "Unknown" | "Point" | "MultiPoint" | "LineString" | "MultiLineString" | "Polygon" | "MultiPolygon"; readonly id?: any; readonly properties: { [_: string]: any; }; readonly patterns?: { [_: string]: { "min": string; "mid": string; "max": string; }; }; readonly geometry?: Array<Array<Point>>; }; export declare type FeatureState = { [_: string]: any; }; export declare type GlobalProperties = Readonly<{ zoom: number; heatmapDensity?: number; lineProgress?: number; isSupportedScript?: (_: string) => boolean; accumulated?: Value; }>; export declare type ConstantExpression = { kind: "constant"; readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array<string>) => any; }; export declare type SourceExpression = { kind: "source"; isStateDependent: boolean; readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array<string>, formattedSection?: FormattedSection) => any; }; export declare type CameraExpression = { kind: "camera"; readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array<string>) => any; readonly interpolationFactor: (input: number, lower: number, upper: number) => number; zoomStops: Array<number>; interpolationType: InterpolationType; }; export declare type CompositeExpression = { kind: "composite"; isStateDependent: boolean; readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array<string>, formattedSection?: FormattedSection) => any; readonly interpolationFactor: (input: number, lower: number, upper: number) => number; zoomStops: Array<number>; interpolationType: InterpolationType; }; export declare type StylePropertyExpression = ConstantExpression | SourceExpression | CameraExpression | CompositeExpression; export declare type FilterExpression = (globalProperties: GlobalProperties, feature: Feature, canonical?: CanonicalTileID) => boolean; export declare type FeatureFilter = { filter: FilterExpression; needGeometry: boolean; }; export declare type ExpressionType = "data-driven" | "cross-faded" | "cross-faded-data-driven" | "color-ramp" | "data-constant" | "constant"; export declare type ExpressionParameters = Array<"zoom" | "feature" | "feature-state" | "heatmap-density" | "line-progress">; export declare type ExpressionSpecificationDefinition = { interpolated: boolean; parameters: ExpressionParameters; }; export declare type StylePropertySpecification = { type: "number"; "property-type": ExpressionType; expression?: ExpressionSpecificationDefinition; transition: boolean; default?: number; } | { type: "string"; "property-type": ExpressionType; expression?: ExpressionSpecificationDefinition; transition: boolean; default?: string; tokens?: boolean; } | { type: "boolean"; "property-type": ExpressionType; expression?: ExpressionSpecificationDefinition; transition: boolean; default?: boolean; } | { type: "enum"; "property-type": ExpressionType; expression?: ExpressionSpecificationDefinition; values: { [_: string]: {}; }; transition: boolean; default?: strin