@maptiler/sdk 3.8.0-rc2 → 3.8.0-rc4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/eslint.mjs +133 -0
  2. package/dist/maptiler-sdk.d.ts +2 -0
  3. package/dist/maptiler-sdk.mjs +13070 -0
  4. package/dist/maptiler-sdk.mjs.map +1 -0
  5. package/dist/src/ColorRamp.d.ts +359 -0
  6. package/dist/src/ImageViewer/ImageViewer.d.ts +66 -0
  7. package/dist/src/ImageViewer/events.d.ts +22 -0
  8. package/dist/src/ImageViewer/index.d.ts +1 -0
  9. package/dist/src/ImageViewer/utils.d.ts +5 -0
  10. package/dist/src/MLAdapters/AttributionControl.d.ts +5 -0
  11. package/dist/src/MLAdapters/BoxZoomHandler.d.ts +7 -0
  12. package/dist/src/MLAdapters/CanvasSource.d.ts +5 -0
  13. package/dist/src/MLAdapters/CooperativeGesturesHandler.d.ts +5 -0
  14. package/dist/src/MLAdapters/FullscreenControl.d.ts +5 -0
  15. package/dist/src/MLAdapters/GeoJSONSource.d.ts +5 -0
  16. package/dist/src/MLAdapters/GeolocateControl.d.ts +5 -0
  17. package/dist/src/MLAdapters/ImageSource.d.ts +5 -0
  18. package/dist/src/MLAdapters/KeyboardHandler.d.ts +5 -0
  19. package/dist/src/MLAdapters/LogoControl.d.ts +5 -0
  20. package/dist/src/MLAdapters/MapMouseEvent.d.ts +5 -0
  21. package/dist/src/MLAdapters/MapTouchEvent.d.ts +5 -0
  22. package/dist/src/MLAdapters/MapWheelEvent.d.ts +5 -0
  23. package/dist/src/MLAdapters/Marker.d.ts +5 -0
  24. package/dist/src/MLAdapters/NavigationControl.d.ts +5 -0
  25. package/dist/src/MLAdapters/Popup.d.ts +5 -0
  26. package/dist/src/MLAdapters/RasterDEMTileSource.d.ts +5 -0
  27. package/dist/src/MLAdapters/RasterTileSource.d.ts +5 -0
  28. package/dist/src/MLAdapters/ScaleControl.d.ts +5 -0
  29. package/dist/src/MLAdapters/ScrollZoomHandler.d.ts +5 -0
  30. package/dist/src/MLAdapters/Style.d.ts +5 -0
  31. package/dist/src/MLAdapters/TerrainControl.d.ts +5 -0
  32. package/dist/src/MLAdapters/TwoFingersTouchPitchHandler.d.ts +5 -0
  33. package/dist/src/MLAdapters/VectorTileSource.d.ts +5 -0
  34. package/dist/src/MLAdapters/VideoSource.d.ts +5 -0
  35. package/dist/src/Map.d.ts +431 -0
  36. package/dist/src/Point.d.ts +177 -0
  37. package/dist/src/Telemetry.d.ts +23 -0
  38. package/dist/src/caching.d.ts +4 -0
  39. package/dist/src/config.d.ts +85 -0
  40. package/dist/src/constants/defaults.d.ts +15 -0
  41. package/dist/src/controls/MaptilerGeolocateControl.d.ts +21 -0
  42. package/dist/src/controls/MaptilerLogoControl.d.ts +19 -0
  43. package/dist/src/controls/MaptilerNavigationControl.d.ts +17 -0
  44. package/dist/src/controls/MaptilerProjectionControl.d.ts +14 -0
  45. package/dist/src/controls/MaptilerTerrainControl.d.ts +16 -0
  46. package/dist/src/controls/Minimap.d.ts +57 -0
  47. package/dist/src/controls/index.d.ts +6 -0
  48. package/dist/src/converters/index.d.ts +1 -0
  49. package/dist/src/converters/xml.d.ts +54 -0
  50. package/dist/src/custom-layers/CubemapLayer/CubemapLayer.d.ts +227 -0
  51. package/dist/src/custom-layers/CubemapLayer/constants.d.ts +3 -0
  52. package/dist/src/custom-layers/CubemapLayer/index.d.ts +2 -0
  53. package/dist/src/custom-layers/CubemapLayer/loadCubemapTexture.d.ts +41 -0
  54. package/dist/src/custom-layers/CubemapLayer/types.d.ts +67 -0
  55. package/dist/src/custom-layers/RadialGradientLayer/RadialGradientLayer.d.ts +128 -0
  56. package/dist/src/custom-layers/RadialGradientLayer/index.d.ts +2 -0
  57. package/dist/src/custom-layers/RadialGradientLayer/types.d.ts +50 -0
  58. package/dist/src/custom-layers/extractCustomLayerStyle.d.ts +17 -0
  59. package/dist/src/custom-layers/index.d.ts +5 -0
  60. package/dist/src/helpers/index.d.ts +5 -0
  61. package/dist/src/helpers/screenshot.d.ts +18 -0
  62. package/dist/src/helpers/stylehelper.d.ts +28 -0
  63. package/dist/src/helpers/vectorlayerhelpers.d.ts +508 -0
  64. package/dist/src/index.d.ts +92 -0
  65. package/dist/src/language.d.ts +107 -0
  66. package/dist/src/mapstyle.d.ts +17 -0
  67. package/dist/src/tools.d.ts +84 -0
  68. package/dist/src/types.d.ts +1 -0
  69. package/dist/src/utils/dom.d.ts +2 -0
  70. package/dist/src/utils/geo-utils.d.ts +6 -0
  71. package/dist/src/utils/index.d.ts +1 -0
  72. package/dist/src/utils/math-utils.d.ts +8 -0
  73. package/dist/src/utils/webgl-utils.d.ts +49 -0
  74. package/package.json +1 -1
@@ -0,0 +1,431 @@
1
+ import { default as maplibregl, StyleSpecification, MapOptions as MapOptionsML, ControlPosition, StyleSwapOptions, StyleOptions, RequestTransformFunction, LayerSpecification, SourceSpecification, CustomLayerInterface, FilterSpecification, StyleSetterOptions } from 'maplibre-gl';
2
+ import { ReferenceMapStyle, MapStyleVariant } from '@maptiler/client';
3
+ import { SdkConfig } from './config';
4
+ import { LanguageInfo } from './language';
5
+ import { MinimapOptionsInput } from './controls/Minimap';
6
+ import { Telemetry } from './Telemetry';
7
+ import { CubemapDefinition, CubemapLayer, CubemapLayerConstructorOptions } from './custom-layers/CubemapLayer';
8
+ import { GradientDefinition, RadialGradientLayer, RadialGradientLayerConstructorOptions } from './custom-layers/RadialGradientLayer';
9
+ export type LoadWithTerrainEvent = {
10
+ type: "loadWithTerrain";
11
+ target: Map;
12
+ terrain: {
13
+ source: string;
14
+ exaggeration: number;
15
+ };
16
+ };
17
+ export declare const GeolocationType: {
18
+ POINT: "POINT";
19
+ COUNTRY: "COUNTRY";
20
+ };
21
+ /**
22
+ * The type of projection, `undefined` means it's decided by the style and if the style does not contain any projection info,
23
+ * if falls back to the default Mercator
24
+ */
25
+ export type ProjectionTypes = "mercator" | "globe" | undefined;
26
+ /**
27
+ * Options to provide to the `Map` constructor
28
+ */
29
+ export type MapOptions = Omit<MapOptionsML, "style" | "maplibreLogo"> & {
30
+ /**
31
+ * Style of the map. Can be:
32
+ * - a full style URL (possibly with API key)
33
+ * - a shorthand with only the MapTIler style name (eg. `"streets-v2"`)
34
+ * - a longer form with the prefix `"maptiler://"` (eg. `"maptiler://streets-v2"`)
35
+ */
36
+ style?: ReferenceMapStyle | MapStyleVariant | StyleSpecification | string;
37
+ /**
38
+ * Define the language of the map. This can be done directly with a language ISO code (eg. "en"),
39
+ * the ISO code prepended with the OSM flag (eg. "name:en" or even just "name"),
40
+ * or with a built-in shorthand (eg. Language.ENGLISH).
41
+ * Note that this is equivalent to setting the `config.primaryLanguage` and will overwrite it.
42
+ */
43
+ language?: LanguageInfo | string;
44
+ /**
45
+ * Define the MapTiler Cloud API key to be used. This is strictly equivalent to setting
46
+ * `config.apiKey` and will overwrite it.
47
+ */
48
+ apiKey?: string;
49
+ /**
50
+ * Shows or hides the MapTiler logo in the bottom left corner.
51
+ *
52
+ * For paid plans:
53
+ * - `true` shows MapTiler logo
54
+ * - `false` hodes MapTiler logo
55
+ * - default: `false` (hide)
56
+ *
57
+ * For free plans: MapTiler logo always shows, regardless of the value.
58
+ */
59
+ maptilerLogo?: boolean;
60
+ /**
61
+ * Attribution text to show in an {@link AttributionControl}.
62
+ */
63
+ customAttribution?: string | Array<string>;
64
+ /**
65
+ * Enables 3D terrain if `true`. (default: `false`)
66
+ */
67
+ terrain?: boolean;
68
+ /**
69
+ * Exaggeration factor of the terrain. (default: `1`, no exaggeration)
70
+ */
71
+ terrainExaggeration?: number;
72
+ /**
73
+ * Show the navigation control. (default: `true`, will hide if `false`)
74
+ */
75
+ navigationControl?: boolean | ControlPosition;
76
+ /**
77
+ * Show the terrain control. (default: `false`, will show if `true`)
78
+ */
79
+ terrainControl?: boolean | ControlPosition;
80
+ /**
81
+ * Show the geolocate control. (default: `true`, will hide if `false`)
82
+ */
83
+ geolocateControl?: boolean | ControlPosition;
84
+ /**
85
+ * Show the scale control. (default: `false`, will show if `true`)
86
+ */
87
+ scaleControl?: boolean | ControlPosition;
88
+ /**
89
+ * Show the full screen control. (default: `false`, will show if `true`)
90
+ */
91
+ fullscreenControl?: boolean | ControlPosition;
92
+ /**
93
+ * Display a minimap in a user defined corner of the map. (default: `bottom-left` corner)
94
+ * If set to true, the map will assume it is a minimap and forego the attribution control.
95
+ */
96
+ minimap?: boolean | ControlPosition | MinimapOptionsInput;
97
+ /**
98
+ * attributionControl
99
+ */
100
+ forceNoAttributionControl?: boolean;
101
+ /**
102
+ * Method to position the map at a given geolocation. Only if:
103
+ * - `hash` is `false`
104
+ * - `center` is not provided
105
+ *
106
+ * If the value is `true` of `"POINT"` (given by `GeolocationType.POINT`) then the positionning uses the MapTiler Cloud
107
+ * Geolocation to find the non-GPS location point.
108
+ * The zoom level can be provided in the `Map` constructor with the `zoom` option or will be `13` if not provided.
109
+ *
110
+ * If the value is `"COUNTRY"` (given by `GeolocationType.COUNTRY`) then the map is centered around the bounding box of the country.
111
+ * In this case, the `zoom` option will be ignored.
112
+ *
113
+ * If the value is `false`, no geolocation is performed and the map centering and zooming depends on other options or on
114
+ * the built-in defaults.
115
+ *
116
+ * If this option is non-false and the options `center` is also provided, then `center` prevails.
117
+ *
118
+ * Default: `false`
119
+ */
120
+ geolocate?: (typeof GeolocationType)[keyof typeof GeolocationType] | boolean;
121
+ /**
122
+ * Show the projection control. (default: `false`, will show if `true`)
123
+ */
124
+ projectionControl?: boolean | ControlPosition;
125
+ /**
126
+ * Whether the projection should be "mercator" or "globe".
127
+ * If not provided, the style takes precedence. If provided, overwrite the style.
128
+ */
129
+ projection?: ProjectionTypes;
130
+ /**
131
+ * Turn on/off spacebox.
132
+ *
133
+ * Default: { color: "#1D29F1" }
134
+ */
135
+ space?: CubemapLayerConstructorOptions | boolean;
136
+ halo?: RadialGradientLayerConstructorOptions | boolean;
137
+ };
138
+ /**
139
+ * The Map class can be instanciated to display a map in a `<div>`
140
+ */
141
+ export declare class Map extends maplibregl.Map {
142
+ readonly telemetry: Telemetry;
143
+ private space?;
144
+ private halo?;
145
+ getSpace(): CubemapLayer | undefined;
146
+ /**
147
+ * Sets the space for the map.
148
+ * @param {CubemapDefinition} space the `CubemapDefinition` options to set.
149
+ * @remarks This method, at present, ** overwrites ** the current config.
150
+ * If an option is not set it will internally revert to the default option
151
+ * unless explicitly set when calling.
152
+ */
153
+ setSpace(space: CubemapDefinition): void;
154
+ private setSpaceFromStyle;
155
+ private setHaloFromStyle;
156
+ private setSpaceFromCurrentStyle;
157
+ private setHaloFromCurrentStyle;
158
+ private initSpace;
159
+ private initHalo;
160
+ getHalo(): RadialGradientLayer | undefined;
161
+ setHalo(halo: GradientDefinition): void;
162
+ private options;
163
+ private isTerrainEnabled;
164
+ private terrainExaggeration;
165
+ private primaryLanguage;
166
+ private terrainGrowing;
167
+ private terrainFlattening;
168
+ private minimap?;
169
+ private forceLanguageUpdate;
170
+ private languageAlwaysBeenStyle;
171
+ private isReady;
172
+ private terrainAnimationDuration;
173
+ private monitoredStyleUrls;
174
+ private styleInProcess;
175
+ private curentProjection;
176
+ private originalLabelStyle;
177
+ private isStyleLocalized;
178
+ private languageIsUpdated;
179
+ constructor(options: MapOptions);
180
+ /**
181
+ * Recreates the map instance with the same options.
182
+ * Useful for WebGL context loss.
183
+ */
184
+ recreate(): void;
185
+ /**
186
+ * Set the duration (millisec) of the terrain animation for growing or flattening.
187
+ * Must be positive. (Built-in default: `1000` milliseconds)
188
+ */
189
+ setTerrainAnimationDuration(d: number): void;
190
+ /**
191
+ * Awaits for _this_ Map instance to be "loaded" and returns a Promise to the Map.
192
+ * If _this_ Map instance is already loaded, the Promise is resolved directly,
193
+ * otherwise, it is resolved as a result of the "load" event.
194
+ * @returns
195
+ */
196
+ onLoadAsync(): Promise<Map>;
197
+ /**
198
+ * Awaits for _this_ Map instance to be "ready" and returns a Promise to the Map.
199
+ * If _this_ Map instance is already ready, the Promise is resolved directly,
200
+ * otherwise, it is resolved as a result of the "ready" event.
201
+ * A map instance is "ready" when all the controls that can be managed by the contructor are
202
+ * dealt with. This happens after the "load" event, due to the asynchronous nature
203
+ * of some built-in controls.
204
+ */
205
+ onReadyAsync(): Promise<Map>;
206
+ /**
207
+ * Awaits for _this_ Map instance to be "loaded" as well as with terrain being non-null for the first time
208
+ * and returns a Promise to the Map.
209
+ * If _this_ Map instance is already loaded with terrain, the Promise is resolved directly,
210
+ * otherwise, it is resolved as a result of the "loadWithTerrain" event.
211
+ * @returns
212
+ */
213
+ onLoadWithTerrainAsync(): Promise<Map>;
214
+ private monitorStyleUrl;
215
+ /**
216
+ * Update the style of the map.
217
+ * Can be:
218
+ * - a full style URL (possibly with API key)
219
+ * - a shorthand with only the MapTIler style name (eg. `"streets-v2"`)
220
+ * - a longer form with the prefix `"maptiler://"` (eg. `"maptiler://streets-v2"`)
221
+ */
222
+ setStyle(style: null | ReferenceMapStyle | MapStyleVariant | StyleSpecification | string, options?: StyleSwapOptions & StyleOptions): this;
223
+ /**
224
+ * Adds a [MapLibre style layer](https://maplibre.org/maplibre-style-spec/layers)
225
+ * to the map's style.
226
+ *
227
+ * A layer defines how data from a specified source will be styled. Read more about layer types
228
+ * and available paint and layout properties in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/layers).
229
+ *
230
+ * @param layer - The layer to add,
231
+ * conforming to either the MapLibre Style Specification's [layer definition](https://maplibre.org/maplibre-style-spec/layers) or,
232
+ * less commonly, the {@link CustomLayerInterface} specification.
233
+ * The MapLibre Style Specification's layer definition is appropriate for most layers.
234
+ *
235
+ * @param beforeId - The ID of an existing layer to insert the new layer before,
236
+ * resulting in the new layer appearing visually beneath the existing layer.
237
+ * If this argument is not specified, the layer will be appended to the end of the layers array
238
+ * and appear visually above all other layers.
239
+ *
240
+ * @returns `this`
241
+ */
242
+ addLayer(layer: (LayerSpecification & {
243
+ source?: string | SourceSpecification;
244
+ }) | CustomLayerInterface, beforeId?: string): this;
245
+ /**
246
+ * Moves a layer to a different z-position.
247
+ *
248
+ * @param id - The ID of the layer to move.
249
+ * @param beforeId - The ID of an existing layer to insert the new layer before. When viewing the map, the `id` layer will appear beneath the `beforeId` layer. If `beforeId` is omitted, the layer will be appended to the end of the layers array and appear above all other layers on the map.
250
+ * @returns `this`
251
+ *
252
+ * @example
253
+ * Move a layer with ID 'polygon' before the layer with ID 'country-label'. The `polygon` layer will appear beneath the `country-label` layer on the map.
254
+ * ```ts
255
+ * map.moveLayer('polygon', 'country-label');
256
+ * ```
257
+ */
258
+ moveLayer(id: string, beforeId?: string): this;
259
+ /**
260
+ * Removes the layer with the given ID from the map's style.
261
+ *
262
+ * An {@link ErrorEvent} will be fired if the image parameter is invald.
263
+ *
264
+ * @param id - The ID of the layer to remove
265
+ * @returns `this`
266
+ *
267
+ * @example
268
+ * If a layer with ID 'state-data' exists, remove it.
269
+ * ```ts
270
+ * if (map.getLayer('state-data')) map.removeLayer('state-data');
271
+ * ```
272
+ */
273
+ removeLayer(id: string): this;
274
+ /**
275
+ * Sets the zoom extent for the specified style layer. The zoom extent includes the
276
+ * [minimum zoom level](https://maplibre.org/maplibre-style-spec/layers/#minzoom)
277
+ * and [maximum zoom level](https://maplibre.org/maplibre-style-spec/layers/#maxzoom))
278
+ * at which the layer will be rendered.
279
+ *
280
+ * Note: For style layers using vector sources, style layers cannot be rendered at zoom levels lower than the
281
+ * minimum zoom level of the _source layer_ because the data does not exist at those zoom levels. If the minimum
282
+ * zoom level of the source layer is higher than the minimum zoom level defined in the style layer, the style
283
+ * layer will not be rendered at all zoom levels in the zoom range.
284
+ */
285
+ setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number): this;
286
+ /**
287
+ * Sets the filter for the specified style layer.
288
+ *
289
+ * Filters control which features a style layer renders from its source.
290
+ * Any feature for which the filter expression evaluates to `true` will be
291
+ * rendered on the map. Those that are false will be hidden.
292
+ *
293
+ * Use `setFilter` to show a subset of your source data.
294
+ *
295
+ * To clear the filter, pass `null` or `undefined` as the second parameter.
296
+ */
297
+ setFilter(layerId: string, filter?: FilterSpecification | null, options?: StyleSetterOptions): this;
298
+ /**
299
+ * Sets the value of a paint property in the specified style layer.
300
+ *
301
+ * @param layerId - The ID of the layer to set the paint property in.
302
+ * @param name - The name of the paint property to set.
303
+ * @param value - The value of the paint property to set.
304
+ * Must be of a type appropriate for the property, as defined in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/).
305
+ * @param options - Options object.
306
+ * @returns `this`
307
+ * @example
308
+ * ```ts
309
+ * map.setPaintProperty('my-layer', 'fill-color', '#faafee');
310
+ * ```
311
+ */
312
+ setPaintProperty(layerId: string, name: string, value: any, options?: StyleSetterOptions): this;
313
+ /**
314
+ * Sets the value of a layout property in the specified style layer.
315
+ * Layout properties define how the layer is styled.
316
+ * Layout properties for layers of the same type are documented together.
317
+ * Layers of different types have different layout properties.
318
+ * See the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/) for the complete list of layout properties.
319
+ * @param layerId - The ID of the layer to set the layout property in.
320
+ * @param name - The name of the layout property to set.
321
+ * @param value - The value of the layout property to set.
322
+ * Must be of a type appropriate for the property, as defined in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/).
323
+ * @param options - Options object.
324
+ * @returns `this`
325
+ */
326
+ setLayoutProperty(layerId: string, name: string, value: any, options?: StyleSetterOptions): this;
327
+ /**
328
+ * Sets the value of the style's glyphs property.
329
+ *
330
+ * @param glyphsUrl - Glyph URL to set. Must conform to the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/glyphs/).
331
+ * @param options - Options object.
332
+ * @returns `this`
333
+ * @example
334
+ * ```ts
335
+ * map.setGlyphs('https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf');
336
+ * ```
337
+ */
338
+ setGlyphs(glyphsUrl: string | null, options?: StyleSetterOptions): this;
339
+ private getStyleLanguage;
340
+ /**
341
+ * Define the primary language of the map. Note that not all the languages shorthands provided are available.
342
+ */
343
+ setLanguage(language: LanguageInfo | string): void;
344
+ /**
345
+ * Define the primary language of the map. Note that not all the languages shorthands provided are available.
346
+ */
347
+ private setPrimaryLanguage;
348
+ /**
349
+ * Get the primary language
350
+ * @returns
351
+ */
352
+ getPrimaryLanguage(): LanguageInfo;
353
+ /**
354
+ * Get the exaggeration factor applied to the terrain
355
+ * @returns
356
+ */
357
+ getTerrainExaggeration(): number;
358
+ /**
359
+ * Know if terrian is enabled or not
360
+ * @returns
361
+ */
362
+ hasTerrain(): boolean;
363
+ private growTerrain;
364
+ /**
365
+ * Enables the 3D terrain visualization
366
+ */
367
+ enableTerrain(exaggeration?: number): void;
368
+ /**
369
+ * Disable the 3D terrain visualization
370
+ */
371
+ disableTerrain(): void;
372
+ /**
373
+ * Sets the 3D terrain exageration factor.
374
+ * If the terrain was not enabled prior to the call of this method,
375
+ * the method `.enableTerrain()` will be called.
376
+ * If `animate` is `true`, the terrain transformation will be animated in the span of 1 second.
377
+ * If `animate` is `false`, no animated transition to the newly defined exaggeration.
378
+ */
379
+ setTerrainExaggeration(exaggeration: number, animate?: boolean): void;
380
+ /**
381
+ * Perform an action when the style is ready. It could be at the moment of calling this method
382
+ * or later.
383
+ */
384
+ private onStyleReady;
385
+ fitToIpBounds(): Promise<void>;
386
+ centerOnIpPoint(zoom: number | undefined): Promise<void>;
387
+ getCameraHash(): string;
388
+ /**
389
+ * Get the SDK config object.
390
+ * This is convenient to dispatch the SDK configuration to externally built layers
391
+ * that do not directly have access to the SDK configuration but do have access to a Map instance.
392
+ */
393
+ getSdkConfig(): SdkConfig;
394
+ /**
395
+ * Get the MapTiler session ID. Convenient to dispatch to externaly built component
396
+ * that do not directly have access to the SDK configuration but do have access to a Map instance.
397
+ * @returns
398
+ */
399
+ getMaptilerSessionId(): string;
400
+ /**
401
+ * Updates the requestManager's transform request with a new function.
402
+ *
403
+ * @param transformRequest A callback run before the Map makes a request for an external URL. The callback can be used to modify the url, set headers, or set the credentials property for cross-origin requests.
404
+ * Expected to return an object with a `url` property and optionally `headers` and `credentials` properties
405
+ *
406
+ * @returns {Map} `this`
407
+ *
408
+ * @example
409
+ * map.setTransformRequest((url: string, resourceType: string) => {});
410
+ */
411
+ setTransformRequest(transformRequest: RequestTransformFunction): this;
412
+ /**
413
+ * Returns whether a globe projection is currently being used
414
+ */
415
+ isGlobeProjection(): boolean;
416
+ /**
417
+ * Activate the globe projection.
418
+ */
419
+ enableGlobeProjection(): void;
420
+ /**
421
+ * Activate the mercator projection.
422
+ */
423
+ enableMercatorProjection(): void;
424
+ /**
425
+ * Returns `true` is the language was ever updated, meaning changed
426
+ * from what is delivered in the style.
427
+ * Returns `false` if language in use is the language from the style
428
+ * and has never been changed.
429
+ */
430
+ isLanguageUpdated(): boolean;
431
+ }
@@ -0,0 +1,177 @@
1
+ /**
2
+ * This is TypeScript rewrite of the Point class to use instead of the version imported in MapLibre.
3
+ * It also uses a class instead of prototypes.
4
+ */
5
+ /**
6
+ * Row major 2x2 matrix
7
+ */
8
+ export type Matrix2 = [number, number, number, number];
9
+ /**
10
+ * a point
11
+ */
12
+ export declare class Point {
13
+ x: number;
14
+ y: number;
15
+ constructor(x: number, y: number);
16
+ private _matMult;
17
+ private _add;
18
+ private _sub;
19
+ private _mult;
20
+ private _div;
21
+ private _multByPoint;
22
+ private _divByPoint;
23
+ private _unit;
24
+ private _perp;
25
+ private _rotate;
26
+ private _rotateAround;
27
+ private _round;
28
+ /**
29
+ * Clone this point, returning a new point that can be modified
30
+ * without affecting the old one.
31
+ * @return {Point} the clone
32
+ */
33
+ clone(): Point;
34
+ /**
35
+ * Add this point's x & y coordinates to another point,
36
+ * yielding a new point.
37
+ * @param {Point} p the other point
38
+ * @return {Point} output point
39
+ */
40
+ add(p: Point): Point;
41
+ /**
42
+ * Subtract this point's x & y coordinates to from point,
43
+ * yielding a new point.
44
+ * @param {Point} p the other point
45
+ * @return {Point} output point
46
+ */
47
+ sub(p: Point): Point;
48
+ /**
49
+ * Multiply this point's x & y coordinates by point,
50
+ * yielding a new point.
51
+ * @param {Point} p the other point
52
+ * @return {Point} output point
53
+ */
54
+ multByPoint(p: Point): Point;
55
+ /**
56
+ * Divide this point's x & y coordinates by point,
57
+ * yielding a new point.
58
+ * @param {Point} p the other point
59
+ * @return {Point} output point
60
+ */
61
+ divByPoint(p: Point): Point;
62
+ /**
63
+ * Multiply this point's x & y coordinates by a factor,
64
+ * yielding a new point.
65
+ * @param {Number} k factor
66
+ * @return {Point} output point
67
+ */
68
+ mult(k: number): Point;
69
+ /**
70
+ * Divide this point's x & y coordinates by a factor,
71
+ * yielding a new point.
72
+ * @param {Point} k factor
73
+ * @return {Point} output point
74
+ */
75
+ div(k: number): Point;
76
+ /**
77
+ * Rotate this point around the 0, 0 origin by an angle a,
78
+ * given in radians
79
+ * @param {Number} a angle to rotate around, in radians
80
+ * @return {Point} output point
81
+ */
82
+ rotate(a: number): Point;
83
+ /**
84
+ * Rotate this point around p point by an angle a,
85
+ * given in radians
86
+ * @param {Number} a angle to rotate around, in radians
87
+ * @param {Point} p Point to rotate around
88
+ * @return {Point} output point
89
+ */
90
+ rotateAround(a: number, p: Point): Point;
91
+ /**
92
+ * Multiply this point by a 4x1 transformation matrix
93
+ * @param {Array<Number>} m transformation matrix
94
+ * @return {Point} output point
95
+ */
96
+ matMult(m: Matrix2): Point;
97
+ /**
98
+ * Calculate this point but as a unit vector from 0, 0, meaning
99
+ * that the distance from the resulting point to the 0, 0
100
+ * coordinate will be equal to 1 and the angle from the resulting
101
+ * point to the 0, 0 coordinate will be the same as before.
102
+ * @return {Point} unit vector point
103
+ */
104
+ unit(): Point;
105
+ /**
106
+ * Compute a perpendicular point, where the new y coordinate
107
+ * is the old x coordinate and the new x coordinate is the old y
108
+ * coordinate multiplied by -1
109
+ * @return {Point} perpendicular point
110
+ */
111
+ perp(): Point;
112
+ /**
113
+ * Return a version of this point with the x & y coordinates
114
+ * rounded to integers.
115
+ * @return {Point} rounded point
116
+ */
117
+ round(): Point;
118
+ /**
119
+ * Return the magnitude of this point: this is the Euclidean
120
+ * distance from the 0, 0 coordinate to this point's x and y
121
+ * coordinates.
122
+ * @return {Number} magnitude
123
+ */
124
+ mag(): number;
125
+ /**
126
+ * Judge whether this point is equal to another point, returning
127
+ * true or false.
128
+ * @param {Point} other the other point
129
+ * @return {boolean} whether the points are equal
130
+ */
131
+ equals(other: Point): boolean;
132
+ /**
133
+ * Calculate the distance from this point to another point
134
+ * @param {Point} p the other point
135
+ * @return {Number} distance
136
+ */
137
+ dist(p: Point): number;
138
+ /**
139
+ * Calculate the distance from this point to another point,
140
+ * without the square root step. Useful if you're comparing
141
+ * relative distances.
142
+ * @param {Point} p the other point
143
+ * @return {Number} distance
144
+ */
145
+ distSqr(p: Point): number;
146
+ /**
147
+ * Get the angle from the 0, 0 coordinate to this point, in radians
148
+ * coordinates.
149
+ * @return {Number} angle
150
+ */
151
+ angle(): number;
152
+ /**
153
+ * Get the angle from this point to another point, in radians
154
+ * @param {Point} b the other point
155
+ * @return {Number} angle
156
+ */
157
+ angleTo(b: Point): number;
158
+ /**
159
+ * Get the angle between this point and another point, in radians
160
+ * @param {Point} b the other point
161
+ * @return {Number} angle
162
+ */
163
+ angleWith(b: Point): number;
164
+ angleWithSep(x: number, y: number): number;
165
+ /**
166
+ * Construct a point from an array if necessary, otherwise if the input
167
+ * is already a Point, or an unknown type, return it unchanged
168
+ * @param {Array<number> | Point} a any kind of input value
169
+ * @return {Point} constructed point, or passed-through value.
170
+ * @example
171
+ * // this
172
+ * var point = Point.convert([0, 1]);
173
+ * // is equivalent to
174
+ * var point = new Point(0, 1);
175
+ */
176
+ static convert(a: Point | Array<number>): Point;
177
+ }
@@ -0,0 +1,23 @@
1
+ import { Map as MapSDK } from './Map';
2
+ /**
3
+ * A Telemetry instance sends some usage and merics to a dedicated endpoint at MapTiler Cloud.
4
+ */
5
+ export declare class Telemetry {
6
+ private map;
7
+ private registeredModules;
8
+ private viewerType;
9
+ /**
10
+ *
11
+ * @param map : a Map instance
12
+ * @param delay : a delay in milliseconds after which the payload is sent to MapTiler cloud (cannot be less than 1000ms)
13
+ */
14
+ constructor(map: MapSDK, delay?: number);
15
+ /**
16
+ * Register a module to the telemetry system of the SDK.
17
+ * The arguments `name` and `version` likely come from the package.json
18
+ * of each module.
19
+ */
20
+ registerModule(name: string, version: string): void;
21
+ registerViewerType(viewerType?: string): void;
22
+ private preparePayload;
23
+ }
@@ -0,0 +1,4 @@
1
+ import { ResourceType } from 'maplibre-gl';
2
+ export declare const CACHE_API_AVAILABLE: boolean;
3
+ export declare function localCacheTransformRequest(reqUrl: URL, resourceType?: ResourceType): string;
4
+ export declare function registerLocalCacheProtocol(): void;