@maptiler/sdk 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/demos/maptiler-sdk.umd.js +224 -62
- package/demos/simple.html +3 -2
- package/dist/maptiler-sdk.d.ts +187 -29
- package/dist/maptiler-sdk.min.mjs +1 -1
- package/dist/maptiler-sdk.mjs +128 -28
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/maptiler-sdk.umd.js +224 -62
- package/dist/maptiler-sdk.umd.js.map +1 -1
- package/dist/maptiler-sdk.umd.min.js +30 -30
- package/package.json +2 -2
- package/readme.md +3 -0
- package/src/AttributionControl.ts +13 -0
- package/src/CanvasSource.ts +13 -0
- package/src/FullscreenControl.ts +13 -0
- package/src/GeoJSONSource.ts +13 -0
- package/src/GeolocateControl.ts +13 -0
- package/src/ImageSource.ts +13 -0
- package/src/LogoControl.ts +13 -0
- package/src/Map.ts +8 -10
- package/src/MaptilerGeolocateControl.ts +1 -1
- package/src/MaptilerLogoControl.ts +2 -1
- package/src/MaptilerNavigationControl.ts +2 -2
- package/src/Marker.ts +13 -0
- package/src/NavigationControl.ts +13 -0
- package/src/Popup.ts +13 -0
- package/src/RasterDEMTileSource.ts +13 -0
- package/src/RasterTileSource.ts +13 -0
- package/src/ScaleControl.ts +13 -0
- package/src/Style.ts +13 -0
- package/src/TerrainControl.ts +13 -0
- package/src/VectorTileSource.ts +13 -0
- package/src/VideoSource.ts +13 -0
- package/src/index.ts +111 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maptiler/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "The Javascript & TypeScript map SDK tailored for MapTiler Cloud",
|
|
5
5
|
"module": "dist/maptiler-sdk.mjs",
|
|
6
6
|
"types": "dist/maptiler-sdk.d.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"typescript": "^4.8.4"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@maptiler/client": "^1.
|
|
65
|
+
"@maptiler/client": "^1.3.0",
|
|
66
66
|
"events": "^3.3.0",
|
|
67
67
|
"js-base64": "^3.7.4",
|
|
68
68
|
"maplibre-gl": "^3.0.0-pre.3",
|
package/readme.md
CHANGED
|
@@ -509,9 +509,12 @@ In the following static map functions, the `option` object features a `style` pr
|
|
|
509
509
|
- `MapStyle.STREETS`, reference style for navigation and city exploration
|
|
510
510
|
- `MapStyle.STREETS.DARK` (variant)
|
|
511
511
|
- `MapStyle.STREETS.LIGHT` (variant)
|
|
512
|
+
- `MapStyle.STREETS.NIGHT` (variant)
|
|
512
513
|
- `MapStyle.STREETS.PASTEL` (variant)
|
|
513
514
|
- `MapStyle.OUTDOOR` reference style for adventure
|
|
515
|
+
- `MapStyle.OUTDOOR.DARK` (variant)
|
|
514
516
|
- `MapStyle.WINTER` reference style for winter adventure
|
|
517
|
+
- `MapStyle.WINTER.DARK` (variant)
|
|
515
518
|
- `MapStyle.SATELLITE` reference style satellite and airborne imagery (no variants)
|
|
516
519
|
- `MapStyle.HYBRID` reference style satellite and airborne imagery with labels (no variants)
|
|
517
520
|
- `MapStyle.BASIC` reference style for minimalist design and general purpose
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre AttributionControl to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class AttributionControl extends maplibregl.AttributionControl {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
return super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre CanvasSource to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class CanvasSource extends maplibregl.CanvasSource {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre FullscreenControl to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class FullscreenControl extends maplibregl.FullscreenControl {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
return super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre GeoJSONSource to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class GeoJSONSource extends maplibregl.GeoJSONSource {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre GeolocateControl to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class GeolocateControl extends maplibregl.GeolocateControl {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
return super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre ImageSource to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class ImageSource extends maplibregl.ImageSource {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre LogoControl to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class LogoControl extends maplibregl.LogoControl {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
return super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
package/src/Map.ts
CHANGED
|
@@ -23,6 +23,9 @@ import { MaptilerTerrainControl } from "./MaptilerTerrainControl";
|
|
|
23
23
|
import { MaptilerNavigationControl } from "./MaptilerNavigationControl";
|
|
24
24
|
import { geolocation } from "@maptiler/client";
|
|
25
25
|
import { MaptilerGeolocateControl } from "./MaptilerGeolocateControl";
|
|
26
|
+
import { AttributionControl } from "./AttributionControl";
|
|
27
|
+
import { ScaleControl } from "./ScaleControl";
|
|
28
|
+
import { FullscreenControl } from "./FullscreenControl";
|
|
26
29
|
|
|
27
30
|
// StyleSwapOptions is not exported by Maplibre, but we can redefine it (used for setStyle)
|
|
28
31
|
export type TransformStyleFunction = (
|
|
@@ -136,18 +139,12 @@ export type MapOptions = Omit<MapOptionsML, "style" | "maplibreLogo"> & {
|
|
|
136
139
|
* The Map class can be instanciated to display a map in a `<div>`
|
|
137
140
|
*/
|
|
138
141
|
export class Map extends maplibregl.Map {
|
|
139
|
-
private languageShouldUpdate = false;
|
|
140
|
-
private isStyleInitialized = false;
|
|
141
142
|
private isTerrainEnabled = false;
|
|
142
143
|
private terrainExaggeration = 1;
|
|
143
144
|
private primaryLanguage: LanguageString | null = null;
|
|
144
145
|
private secondaryLanguage: LanguageString | null = null;
|
|
145
146
|
|
|
146
147
|
constructor(options: MapOptions) {
|
|
147
|
-
// if (options.language) {
|
|
148
|
-
// config.primaryLanguage = options.language;
|
|
149
|
-
// }
|
|
150
|
-
|
|
151
148
|
if (options.apiKey) {
|
|
152
149
|
config.apiKey = options.apiKey;
|
|
153
150
|
}
|
|
@@ -206,7 +203,8 @@ export class Map extends maplibregl.Map {
|
|
|
206
203
|
this.once("styledata", async () => {
|
|
207
204
|
// Not using geolocation centering if...
|
|
208
205
|
|
|
209
|
-
|
|
206
|
+
// the geolcoate option is not provided or is falsy
|
|
207
|
+
if (!options.geolocate) {
|
|
210
208
|
return;
|
|
211
209
|
}
|
|
212
210
|
|
|
@@ -335,7 +333,7 @@ export class Map extends maplibregl.Map {
|
|
|
335
333
|
|
|
336
334
|
// if attribution in option is `false` but the the logo shows up in the tileJson, then the attribution must show anyways
|
|
337
335
|
if (options.attributionControl === false) {
|
|
338
|
-
this.addControl(new
|
|
336
|
+
this.addControl(new AttributionControl(options));
|
|
339
337
|
}
|
|
340
338
|
} else if (options.maptilerLogo) {
|
|
341
339
|
this.addControl(new MaptilerLogoControl(), options.logoPosition);
|
|
@@ -353,7 +351,7 @@ export class Map extends maplibregl.Map {
|
|
|
353
351
|
: options.scaleControl
|
|
354
352
|
) as ControlPosition;
|
|
355
353
|
|
|
356
|
-
const scaleControl = new
|
|
354
|
+
const scaleControl = new ScaleControl({ unit: config.unit });
|
|
357
355
|
this.addControl(scaleControl, position);
|
|
358
356
|
config.on("unit", (unit) => {
|
|
359
357
|
scaleControl.setUnit(unit);
|
|
@@ -420,7 +418,7 @@ export class Map extends maplibregl.Map {
|
|
|
420
418
|
: options.fullscreenControl
|
|
421
419
|
) as ControlPosition;
|
|
422
420
|
|
|
423
|
-
this.addControl(new
|
|
421
|
+
this.addControl(new FullscreenControl({}), position);
|
|
424
422
|
}
|
|
425
423
|
});
|
|
426
424
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { LngLatLike } from "maplibre-gl";
|
|
2
2
|
import maplibregl from "maplibre-gl";
|
|
3
|
+
import { GeolocateControl } from "./GeolocateControl";
|
|
3
4
|
import { DOMcreate } from "./tools";
|
|
4
5
|
|
|
5
|
-
const GeolocateControl = maplibregl.GeolocateControl;
|
|
6
6
|
const Marker = maplibregl.Marker;
|
|
7
7
|
const LngLat = maplibregl.LngLat;
|
|
8
8
|
|
|
@@ -2,6 +2,7 @@ import maplibregl from "maplibre-gl";
|
|
|
2
2
|
import type { LogoOptions as LogoOptionsML } from "maplibre-gl";
|
|
3
3
|
import { defaults } from "./defaults";
|
|
4
4
|
import { Map } from "./Map";
|
|
5
|
+
import { LogoControl } from "./LogoControl";
|
|
5
6
|
|
|
6
7
|
type LogoOptions = LogoOptionsML & {
|
|
7
8
|
logoURL?: string;
|
|
@@ -12,7 +13,7 @@ type LogoOptions = LogoOptionsML & {
|
|
|
12
13
|
* This LogoControl extends the MapLibre LogoControl but instead can use any image URL and
|
|
13
14
|
* any link URL. By default this is using MapTiler logo and URL.
|
|
14
15
|
*/
|
|
15
|
-
export class MaptilerLogoControl extends
|
|
16
|
+
export class MaptilerLogoControl extends LogoControl {
|
|
16
17
|
private logoURL = "";
|
|
17
18
|
private linkURL = "";
|
|
18
19
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { NavigationControl } from "./NavigationControl";
|
|
2
2
|
|
|
3
3
|
type HTMLButtonElementPlus = HTMLButtonElement & {
|
|
4
4
|
clickFunction: (e?: any) => unknown;
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
export class MaptilerNavigationControl extends
|
|
7
|
+
export class MaptilerNavigationControl extends NavigationControl {
|
|
8
8
|
constructor() {
|
|
9
9
|
super({
|
|
10
10
|
showCompass: true,
|
package/src/Marker.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre Marker to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class Marker extends maplibregl.Marker {
|
|
10
|
+
addTo(map: Map | MapMLGL): this {
|
|
11
|
+
return super.addTo(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre NavigationControl to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class NavigationControl extends maplibregl.NavigationControl {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
return super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
package/src/Popup.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre Popup to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class Popup extends maplibregl.Popup {
|
|
10
|
+
addTo(map: Map | MapMLGL): this {
|
|
11
|
+
return super.addTo(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre RasterDEMTileSource to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class RasterDEMTileSource extends maplibregl.RasterDEMTileSource {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre RasterTileSource to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class RasterTileSource extends maplibregl.RasterTileSource {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre ScaleControl to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class ScaleControl extends maplibregl.ScaleControl {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
return super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
package/src/Style.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre Style to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL, StyleOptions } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class Style extends maplibregl.Style {
|
|
10
|
+
constructor(map: Map, options: StyleOptions = {}) {
|
|
11
|
+
super(map as MapMLGL, options);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre TerrainControl to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class TerrainControl extends maplibregl.TerrainControl {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
return super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre VectorTileSource to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class VectorTileSource extends maplibregl.VectorTileSource {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an extension of MapLibre VideoSource to make it fully type compatible with the SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import maplibregl from "maplibre-gl";
|
|
6
|
+
import type { Map as MapMLGL } from "maplibre-gl";
|
|
7
|
+
import { Map } from "./Map";
|
|
8
|
+
|
|
9
|
+
export class VideoSource extends maplibregl.VideoSource {
|
|
10
|
+
onAdd(map: Map | MapMLGL) {
|
|
11
|
+
super.onAdd(map as MapMLGL);
|
|
12
|
+
}
|
|
13
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -14,28 +14,18 @@ const {
|
|
|
14
14
|
supported,
|
|
15
15
|
setRTLTextPlugin,
|
|
16
16
|
getRTLTextPluginStatus,
|
|
17
|
-
NavigationControl,
|
|
18
|
-
GeolocateControl,
|
|
19
|
-
AttributionControl,
|
|
20
|
-
LogoControl,
|
|
21
|
-
ScaleControl,
|
|
22
|
-
FullscreenControl,
|
|
23
|
-
TerrainControl,
|
|
24
|
-
Popup,
|
|
25
|
-
Marker,
|
|
26
|
-
Style,
|
|
17
|
+
// NavigationControl,
|
|
18
|
+
// GeolocateControl,
|
|
19
|
+
// AttributionControl,
|
|
20
|
+
// LogoControl,
|
|
21
|
+
// ScaleControl,
|
|
22
|
+
// FullscreenControl,
|
|
23
|
+
// TerrainControl,
|
|
27
24
|
LngLat,
|
|
28
25
|
LngLatBounds,
|
|
29
26
|
MercatorCoordinate,
|
|
30
27
|
Evented,
|
|
31
28
|
AJAXError,
|
|
32
|
-
CanvasSource,
|
|
33
|
-
GeoJSONSource,
|
|
34
|
-
ImageSource,
|
|
35
|
-
RasterDEMTileSource,
|
|
36
|
-
RasterTileSource,
|
|
37
|
-
VectorTileSource,
|
|
38
|
-
VideoSource,
|
|
39
29
|
prewarm,
|
|
40
30
|
clearPrewarmedResources,
|
|
41
31
|
version,
|
|
@@ -45,28 +35,47 @@ const {
|
|
|
45
35
|
workerUrl,
|
|
46
36
|
addProtocol,
|
|
47
37
|
removeProtocol,
|
|
48
|
-
|
|
49
38
|
// isSafari,
|
|
50
39
|
// getPerformanceMetrics,
|
|
51
40
|
// config,
|
|
52
41
|
// Point,
|
|
53
42
|
} = maplibregl;
|
|
54
43
|
|
|
44
|
+
// We still want to export maplibregl.Map, but as a different name
|
|
45
|
+
const MapMLGL = maplibregl.Map;
|
|
46
|
+
const MarkerMLGL = maplibregl.Marker;
|
|
47
|
+
const PopupMLGL = maplibregl.Popup;
|
|
48
|
+
const StyleMLGL = maplibregl.Style;
|
|
49
|
+
const CanvasSourceMLGL = maplibregl.CanvasSource;
|
|
50
|
+
const GeoJSONSourceMLGL = maplibregl.GeoJSONSource;
|
|
51
|
+
const ImageSourceMLGL = maplibregl.ImageSource;
|
|
52
|
+
const RasterTileSourceMLGL = maplibregl.RasterTileSource;
|
|
53
|
+
const RasterDEMTileSourceMLGL = maplibregl.RasterDEMTileSource;
|
|
54
|
+
const VectorTileSourceMLGL = maplibregl.VectorTileSource;
|
|
55
|
+
const VideoSourceMLGL = maplibregl.VideoSource;
|
|
56
|
+
const NavigationControlMLGL = maplibregl.NavigationControl;
|
|
57
|
+
const GeolocateControlMLGL = maplibregl.GeolocateControl;
|
|
58
|
+
const AttributionControlMLGL = maplibregl.AttributionControl;
|
|
59
|
+
const LogoControlMLGL = maplibregl.LogoControl;
|
|
60
|
+
const ScaleControlMLGL = maplibregl.ScaleControl;
|
|
61
|
+
const FullscreenControlMLGL = maplibregl.FullscreenControl;
|
|
62
|
+
const TerrainControlMLGL = maplibregl.TerrainControl;
|
|
63
|
+
|
|
55
64
|
export {
|
|
56
65
|
supported,
|
|
57
66
|
setRTLTextPlugin,
|
|
58
67
|
getRTLTextPluginStatus,
|
|
59
68
|
// Map,
|
|
60
|
-
NavigationControl,
|
|
61
|
-
GeolocateControl,
|
|
62
|
-
AttributionControl,
|
|
63
|
-
LogoControl,
|
|
64
|
-
ScaleControl,
|
|
65
|
-
FullscreenControl,
|
|
66
|
-
TerrainControl,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
// NavigationControl,
|
|
70
|
+
// GeolocateControl,
|
|
71
|
+
// AttributionControl,
|
|
72
|
+
// LogoControl,
|
|
73
|
+
// ScaleControl,
|
|
74
|
+
// FullscreenControl,
|
|
75
|
+
// TerrainControl,
|
|
76
|
+
PopupMLGL,
|
|
77
|
+
MarkerMLGL,
|
|
78
|
+
StyleMLGL,
|
|
70
79
|
LngLat,
|
|
71
80
|
LngLatBounds,
|
|
72
81
|
// Point,
|
|
@@ -74,13 +83,13 @@ export {
|
|
|
74
83
|
Evented,
|
|
75
84
|
AJAXError,
|
|
76
85
|
// config,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
CanvasSourceMLGL,
|
|
87
|
+
GeoJSONSourceMLGL,
|
|
88
|
+
ImageSourceMLGL,
|
|
89
|
+
RasterDEMTileSourceMLGL,
|
|
90
|
+
RasterTileSourceMLGL,
|
|
91
|
+
VectorTileSourceMLGL,
|
|
92
|
+
VideoSourceMLGL,
|
|
84
93
|
prewarm,
|
|
85
94
|
clearPrewarmedResources,
|
|
86
95
|
version,
|
|
@@ -90,13 +99,63 @@ export {
|
|
|
90
99
|
workerUrl,
|
|
91
100
|
addProtocol,
|
|
92
101
|
removeProtocol,
|
|
102
|
+
MapMLGL,
|
|
93
103
|
// isSafari,
|
|
94
104
|
// getPerformanceMetrics
|
|
95
105
|
};
|
|
96
106
|
|
|
107
|
+
// Exporting types of class instances from MapLibre:
|
|
108
|
+
export type NavigationControlMLGL = InstanceType<typeof NavigationControlMLGL>;
|
|
109
|
+
export type GeolocateControlMLGL = InstanceType<typeof GeolocateControlMLGL>;
|
|
110
|
+
export type AttributionControlMLGL = InstanceType<
|
|
111
|
+
typeof AttributionControlMLGL
|
|
112
|
+
>;
|
|
113
|
+
export type LogoControlMLGL = InstanceType<typeof LogoControlMLGL>;
|
|
114
|
+
export type ScaleControlMLGL = InstanceType<typeof ScaleControlMLGL>;
|
|
115
|
+
export type FullscreenControlMLGL = InstanceType<typeof FullscreenControlMLGL>;
|
|
116
|
+
export type TerrainControlMLGL = InstanceType<typeof TerrainControlMLGL>;
|
|
117
|
+
export type MarkerMLGL = InstanceType<typeof MarkerMLGL>;
|
|
118
|
+
export type PopupMLGL = InstanceType<typeof PopupMLGL>;
|
|
119
|
+
export type StyleMLGL = InstanceType<typeof StyleMLGL>;
|
|
120
|
+
export type LngLat = InstanceType<typeof LngLat>;
|
|
121
|
+
export type LngLatBounds = InstanceType<typeof LngLatBounds>;
|
|
122
|
+
export type MercatorCoordinate = InstanceType<typeof MercatorCoordinate>;
|
|
123
|
+
export type Evented = InstanceType<typeof Evented>;
|
|
124
|
+
export type AJAXError = InstanceType<typeof AJAXError>;
|
|
125
|
+
export type CanvasSourceMLGL = InstanceType<typeof CanvasSourceMLGL>;
|
|
126
|
+
export type GeoJSONSourceMLGL = InstanceType<typeof GeoJSONSourceMLGL>;
|
|
127
|
+
export type ImageSourceMLGL = InstanceType<typeof ImageSourceMLGL>;
|
|
128
|
+
export type RasterDEMTileSourceMLGL = InstanceType<
|
|
129
|
+
typeof RasterDEMTileSourceMLGL
|
|
130
|
+
>;
|
|
131
|
+
export type RasterTileSourceMLGL = InstanceType<typeof RasterTileSourceMLGL>;
|
|
132
|
+
export type VectorTileSourceMLGL = InstanceType<typeof VectorTileSourceMLGL>;
|
|
133
|
+
export type VideoSourceMLGL = InstanceType<typeof VideoSourceMLGL>;
|
|
134
|
+
export type MapMLGL = InstanceType<typeof MapMLGL>;
|
|
135
|
+
|
|
136
|
+
// SDK specific
|
|
97
137
|
import { Map, GeolocationType } from "./Map";
|
|
98
138
|
import type { MapOptions } from "./Map";
|
|
99
139
|
|
|
140
|
+
import { Marker } from "./Marker";
|
|
141
|
+
import { Popup } from "./Popup";
|
|
142
|
+
import { Style } from "./Style";
|
|
143
|
+
import { CanvasSource } from "./CanvasSource";
|
|
144
|
+
import { GeoJSONSource } from "./GeoJSONSource";
|
|
145
|
+
import { ImageSource } from "./ImageSource";
|
|
146
|
+
import { RasterTileSource } from "./RasterTileSource";
|
|
147
|
+
import { RasterDEMTileSource } from "./RasterDEMTileSource";
|
|
148
|
+
import { VectorTileSource } from "./VectorTileSource";
|
|
149
|
+
import { VideoSource } from "./VideoSource";
|
|
150
|
+
import { NavigationControl } from "./NavigationControl";
|
|
151
|
+
import { GeolocateControl } from "./GeolocateControl";
|
|
152
|
+
import { AttributionControl } from "./AttributionControl";
|
|
153
|
+
import { LogoControl } from "./LogoControl";
|
|
154
|
+
import { ScaleControl } from "./ScaleControl";
|
|
155
|
+
import { FullscreenControl } from "./FullscreenControl";
|
|
156
|
+
import { TerrainControl } from "./TerrainControl";
|
|
157
|
+
|
|
158
|
+
// Import of modified versions of the controls
|
|
100
159
|
import { MaptilerGeolocateControl } from "./MaptilerGeolocateControl";
|
|
101
160
|
import { MaptilerLogoControl } from "./MaptilerLogoControl";
|
|
102
161
|
import { MaptilerTerrainControl } from "./MaptilerTerrainControl";
|
|
@@ -157,6 +216,23 @@ export type {
|
|
|
157
216
|
// Exporting classes, objects, functions, etc.
|
|
158
217
|
export {
|
|
159
218
|
Map,
|
|
219
|
+
Marker,
|
|
220
|
+
Popup,
|
|
221
|
+
Style,
|
|
222
|
+
CanvasSource,
|
|
223
|
+
GeoJSONSource,
|
|
224
|
+
ImageSource,
|
|
225
|
+
RasterTileSource,
|
|
226
|
+
RasterDEMTileSource,
|
|
227
|
+
VideoSource,
|
|
228
|
+
NavigationControl,
|
|
229
|
+
GeolocateControl,
|
|
230
|
+
AttributionControl,
|
|
231
|
+
LogoControl,
|
|
232
|
+
ScaleControl,
|
|
233
|
+
FullscreenControl,
|
|
234
|
+
TerrainControl,
|
|
235
|
+
VectorTileSource,
|
|
160
236
|
GeolocationType,
|
|
161
237
|
SdkConfig,
|
|
162
238
|
config,
|