@maptiler/sdk 2.2.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/biome.json +2 -1
- package/dist/maptiler-sdk.css +0 -1
- package/dist/maptiler-sdk.d.ts +1 -1785
- package/dist/maptiler-sdk.mjs +1782 -2617
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/src/MLAdapters/AttributionControl.d.ts +6 -0
- package/dist/src/MLAdapters/BoxZoomHandler.d.ts +8 -0
- package/dist/src/MLAdapters/CanvasSource.d.ts +6 -0
- package/dist/src/MLAdapters/CooperativeGesturesHandler.d.ts +6 -0
- package/dist/src/MLAdapters/FullscreenControl.d.ts +6 -0
- package/dist/src/MLAdapters/GeoJSONSource.d.ts +6 -0
- package/dist/src/MLAdapters/GeolocateControl.d.ts +6 -0
- package/dist/src/MLAdapters/ImageSource.d.ts +6 -0
- package/dist/src/MLAdapters/KeyboardHandler.d.ts +6 -0
- package/dist/src/MLAdapters/LogoControl.d.ts +6 -0
- package/dist/src/MLAdapters/MapMouseEvent.d.ts +6 -0
- package/dist/src/MLAdapters/MapTouchEvent.d.ts +6 -0
- package/dist/src/MLAdapters/MapWheelEvent.d.ts +6 -0
- package/dist/src/MLAdapters/Marker.d.ts +6 -0
- package/dist/src/MLAdapters/NavigationControl.d.ts +6 -0
- package/dist/src/MLAdapters/Popup.d.ts +6 -0
- package/dist/src/MLAdapters/RasterDEMTileSource.d.ts +6 -0
- package/dist/src/MLAdapters/RasterTileSource.d.ts +6 -0
- package/dist/src/MLAdapters/ScaleControl.d.ts +6 -0
- package/dist/src/MLAdapters/ScrollZoomHandler.d.ts +6 -0
- package/dist/src/MLAdapters/Style.d.ts +6 -0
- package/dist/src/MLAdapters/TerrainControl.d.ts +6 -0
- package/dist/src/MLAdapters/TwoFingersTouchPitchHandler.d.ts +6 -0
- package/dist/src/MLAdapters/VectorTileSource.d.ts +6 -0
- package/dist/src/MLAdapters/VideoSource.d.ts +6 -0
- package/dist/src/Map.d.ts +349 -0
- package/dist/src/MaptilerGeolocateControl.d.ts +21 -0
- package/dist/src/MaptilerLogoControl.d.ts +20 -0
- package/dist/src/MaptilerNavigationControl.d.ts +18 -0
- package/dist/src/MaptilerTerrainControl.d.ts +17 -0
- package/dist/src/Minimap.d.ts +58 -0
- package/dist/src/Point.d.ts +177 -0
- package/dist/src/caching.d.ts +5 -0
- package/dist/src/colorramp.d.ts +359 -0
- package/dist/src/config.d.ts +68 -0
- package/dist/src/converters/index.d.ts +1 -0
- package/dist/src/converters/xml.d.ts +54 -0
- package/dist/src/defaults.d.ts +14 -0
- package/dist/src/helpers/index.d.ts +14 -0
- package/dist/src/helpers/screenshot.d.ts +19 -0
- package/dist/src/helpers/stylehelper.d.ts +29 -0
- package/dist/src/helpers/vectorlayerhelpers.d.ts +509 -0
- package/dist/src/index.d.ts +89 -0
- package/dist/src/language.d.ts +108 -0
- package/dist/src/mapstyle.d.ts +3 -0
- package/dist/src/tools.d.ts +46 -0
- package/dist/src/unit.d.ts +1 -0
- package/package.json +15 -21
- package/readme.md +31 -0
- package/tsconfig.json +21 -8
- package/vite.config-es.ts +48 -0
- package/vite.config-umd.ts +27 -0
- package/.github/pull_request_template.md +0 -11
- package/.github/workflows/format-lint.yml +0 -21
- package/.github/workflows/npm-publish.yml +0 -22
- package/dist/maptiler-sdk.min.mjs +0 -3
- package/rollup.config.js +0 -147
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { default as maplibregl } from 'maplibre-gl';
|
|
2
|
+
|
|
3
|
+
export type * from 'maplibre-gl';
|
|
4
|
+
/**
|
|
5
|
+
* Get the version of MapTiler SDK
|
|
6
|
+
*/
|
|
7
|
+
export declare function getVersion(): string;
|
|
8
|
+
declare const MapMLGL: typeof maplibregl.Map;
|
|
9
|
+
declare const MarkerMLGL: typeof maplibregl.Marker;
|
|
10
|
+
declare const PopupMLGL: typeof maplibregl.Popup;
|
|
11
|
+
declare const StyleMLGL: typeof maplibregl.Style;
|
|
12
|
+
declare const CanvasSourceMLGL: typeof maplibregl.CanvasSource;
|
|
13
|
+
declare const GeoJSONSourceMLGL: typeof maplibregl.GeoJSONSource;
|
|
14
|
+
declare const ImageSourceMLGL: typeof maplibregl.ImageSource;
|
|
15
|
+
declare const RasterTileSourceMLGL: typeof maplibregl.RasterTileSource;
|
|
16
|
+
declare const RasterDEMTileSourceMLGL: typeof maplibregl.RasterDEMTileSource;
|
|
17
|
+
declare const VectorTileSourceMLGL: typeof maplibregl.VectorTileSource;
|
|
18
|
+
declare const VideoSourceMLGL: typeof maplibregl.VideoSource;
|
|
19
|
+
declare const NavigationControMLGL: typeof maplibregl.NavigationControl;
|
|
20
|
+
declare const GeolocateControlMLGL: typeof maplibregl.GeolocateControl;
|
|
21
|
+
declare const AttributionControlMLGL: typeof maplibregl.AttributionControl;
|
|
22
|
+
declare const LogoControlMLGL: typeof maplibregl.LogoControl;
|
|
23
|
+
declare const ScaleControlMLGL: typeof maplibregl.ScaleControl;
|
|
24
|
+
declare const FullscreenControlMLGL: typeof maplibregl.FullscreenControl;
|
|
25
|
+
declare const TerrainControMLGL: typeof maplibregl.TerrainControl;
|
|
26
|
+
declare const BoxZoomHandlerMLGL: typeof maplibregl.BoxZoomHandler;
|
|
27
|
+
declare const ScrollZoomHandlerMLGL: typeof maplibregl.ScrollZoomHandler;
|
|
28
|
+
declare const CooperativeGesturesHandlerMLGL: typeof maplibregl.CooperativeGesturesHandler;
|
|
29
|
+
declare const KeyboardHandlerMLGL: typeof maplibregl.KeyboardHandler;
|
|
30
|
+
declare const TwoFingersTouchPitchHandlerMLGL: typeof maplibregl.TwoFingersTouchPitchHandler;
|
|
31
|
+
declare const MapWheelEventMLGL: typeof maplibregl.MapWheelEvent;
|
|
32
|
+
declare const MapTouchEventMLGL: typeof maplibregl.MapTouchEvent;
|
|
33
|
+
declare const MapMouseEventMLGL: typeof maplibregl.MapMouseEvent;
|
|
34
|
+
declare const configMLGL: maplibregl.Config;
|
|
35
|
+
declare const getMapLibreVersion: typeof maplibregl.getVersion;
|
|
36
|
+
declare const setRTLTextPlugin: typeof maplibregl.setRTLTextPlugin, getRTLTextPluginStatus: typeof maplibregl.getRTLTextPluginStatus, LngLat: typeof maplibregl.LngLat, LngLatBounds: typeof maplibregl.LngLatBounds, MercatorCoordinate: typeof maplibregl.MercatorCoordinate, Evented: typeof maplibregl.Evented, AJAXError: typeof maplibregl.AJAXError, prewarm: typeof maplibregl.prewarm, clearPrewarmedResources: typeof maplibregl.clearPrewarmedResources, Hash: typeof maplibregl.Hash, Point: typeof maplibregl.Point, EdgeInsets: typeof maplibregl.EdgeInsets, DragRotateHandler: typeof maplibregl.DragRotateHandler, DragPanHandler: typeof maplibregl.DragPanHandler, TwoFingersTouchZoomRotateHandler: typeof maplibregl.TwoFingersTouchZoomRotateHandler, DoubleClickZoomHandler: typeof maplibregl.DoubleClickZoomHandler, TwoFingersTouchZoomHandler: typeof maplibregl.TwoFingersTouchZoomHandler, TwoFingersTouchRotateHandler: typeof maplibregl.TwoFingersTouchRotateHandler, getWorkerCount: typeof maplibregl.getWorkerCount, setWorkerCount: typeof maplibregl.setWorkerCount, getMaxParallelImageRequests: typeof maplibregl.getMaxParallelImageRequests, setMaxParallelImageRequests: typeof maplibregl.setMaxParallelImageRequests, getWorkerUrl: typeof maplibregl.getWorkerUrl, setWorkerUrl: typeof maplibregl.setWorkerUrl, addSourceType: (name: string, SourceType: maplibregl.SourceClass) => Promise<void>, importScriptInWorkers: typeof maplibregl.importScriptInWorkers, addProtocol: typeof maplibregl.addProtocol, removeProtocol: typeof maplibregl.removeProtocol;
|
|
37
|
+
export { setRTLTextPlugin, getRTLTextPluginStatus, LngLat, LngLatBounds, MercatorCoordinate, Evented, AJAXError, prewarm, clearPrewarmedResources, Hash, Point, EdgeInsets, DragRotateHandler, DragPanHandler, TwoFingersTouchZoomRotateHandler, DoubleClickZoomHandler, TwoFingersTouchZoomHandler, TwoFingersTouchRotateHandler, getWorkerCount, setWorkerCount, getMaxParallelImageRequests, setMaxParallelImageRequests, getWorkerUrl, setWorkerUrl, addSourceType, importScriptInWorkers, addProtocol, removeProtocol, getMapLibreVersion, MapMLGL, MarkerMLGL, PopupMLGL, StyleMLGL, CanvasSourceMLGL, GeoJSONSourceMLGL, ImageSourceMLGL, RasterTileSourceMLGL, RasterDEMTileSourceMLGL, VectorTileSourceMLGL, VideoSourceMLGL, NavigationControMLGL, GeolocateControlMLGL, AttributionControlMLGL, LogoControlMLGL, ScaleControlMLGL, FullscreenControlMLGL, TerrainControMLGL, BoxZoomHandlerMLGL, ScrollZoomHandlerMLGL, CooperativeGesturesHandlerMLGL, KeyboardHandlerMLGL, TwoFingersTouchPitchHandlerMLGL, MapWheelEventMLGL, MapTouchEventMLGL, MapMouseEventMLGL, configMLGL, };
|
|
38
|
+
export type LngLat = InstanceType<typeof LngLat>;
|
|
39
|
+
export type LngLatBounds = InstanceType<typeof LngLatBounds>;
|
|
40
|
+
export type MercatorCoordinate = InstanceType<typeof MercatorCoordinate>;
|
|
41
|
+
export type Evented = InstanceType<typeof Evented>;
|
|
42
|
+
export type AJAXError = InstanceType<typeof AJAXError>;
|
|
43
|
+
export type Hash = InstanceType<typeof Hash>;
|
|
44
|
+
export type Point = InstanceType<typeof Point>;
|
|
45
|
+
export type EdgeInsets = InstanceType<typeof EdgeInsets>;
|
|
46
|
+
export type DragRotateHandler = InstanceType<typeof DragRotateHandler>;
|
|
47
|
+
export type DragPanHandler = InstanceType<typeof DragPanHandler>;
|
|
48
|
+
export type TwoFingersTouchZoomRotateHandler = InstanceType<typeof TwoFingersTouchZoomRotateHandler>;
|
|
49
|
+
export type DoubleClickZoomHandler = InstanceType<typeof DoubleClickZoomHandler>;
|
|
50
|
+
export type TwoFingersTouchZoomHandler = InstanceType<typeof TwoFingersTouchZoomHandler>;
|
|
51
|
+
export type TwoFingersTouchRotateHandler = InstanceType<typeof TwoFingersTouchRotateHandler>;
|
|
52
|
+
export { Marker } from './MLAdapters/Marker';
|
|
53
|
+
export { Popup } from './MLAdapters/Popup';
|
|
54
|
+
export { Style } from './MLAdapters/Style';
|
|
55
|
+
export { CanvasSource } from './MLAdapters/CanvasSource';
|
|
56
|
+
export { GeoJSONSource } from './MLAdapters/GeoJSONSource';
|
|
57
|
+
export { ImageSource } from './MLAdapters/ImageSource';
|
|
58
|
+
export { RasterTileSource } from './MLAdapters/RasterTileSource';
|
|
59
|
+
export { RasterDEMTileSource } from './MLAdapters/RasterDEMTileSource';
|
|
60
|
+
export { VectorTileSource } from './MLAdapters/VectorTileSource';
|
|
61
|
+
export { VideoSource } from './MLAdapters/VideoSource';
|
|
62
|
+
export { NavigationControl } from './MLAdapters/NavigationControl';
|
|
63
|
+
export { GeolocateControl } from './MLAdapters/GeolocateControl';
|
|
64
|
+
export { AttributionControl } from './MLAdapters/AttributionControl';
|
|
65
|
+
export { LogoControl } from './MLAdapters/LogoControl';
|
|
66
|
+
export { ScaleControl } from './MLAdapters/ScaleControl';
|
|
67
|
+
export { FullscreenControl } from './MLAdapters/FullscreenControl';
|
|
68
|
+
export { TerrainControl } from './MLAdapters/TerrainControl';
|
|
69
|
+
export { BoxZoomHandler } from './MLAdapters/BoxZoomHandler';
|
|
70
|
+
export { ScrollZoomHandler } from './MLAdapters/ScrollZoomHandler';
|
|
71
|
+
export { CooperativeGesturesHandler } from './MLAdapters/CooperativeGesturesHandler';
|
|
72
|
+
export { KeyboardHandler } from './MLAdapters/KeyboardHandler';
|
|
73
|
+
export { TwoFingersTouchPitchHandler } from './MLAdapters/TwoFingersTouchPitchHandler';
|
|
74
|
+
export { MapWheelEvent } from './MLAdapters/MapWheelEvent';
|
|
75
|
+
export { MapTouchEvent } from './MLAdapters/MapTouchEvent';
|
|
76
|
+
export { MapMouseEvent } from './MLAdapters/MapMouseEvent';
|
|
77
|
+
export { Map, GeolocationType, type MapOptions, type LoadWithTerrainEvent, } from './Map';
|
|
78
|
+
export * from './MaptilerGeolocateControl';
|
|
79
|
+
export * from './MaptilerLogoControl';
|
|
80
|
+
export * from './MaptilerTerrainControl';
|
|
81
|
+
export * from './MaptilerNavigationControl';
|
|
82
|
+
export { type AutomaticStaticMapOptions, type BoundedStaticMapOptions, type BufferToPixelDataFunction, type ByIdGeocodingOptions, type CenteredStaticMapOptions, type CommonForwardAndReverseGeocodingOptions, type CoordinateExport, type CoordinateGrid, type CoordinateId, type CoordinateSearch, type CoordinateSearchResult, type CoordinateTransformResult, type CoordinateTransformation, type Coordinates, type CoordinatesSearchOptions, type CoordinatesTransformOptions, type DefaultTransformation, type ElevationAtOptions, type ElevationBatchOptions, type FeatureHierarchy, type FetchFunction, type GeocodingFeature, type GeocodingOptions, type GeocodingSearchResult, type GeolocationInfoOptions, type GeolocationResult, type GetDataOptions, type LanguageGeocodingOptions, MapStyle, type MapStylePreset, type MapStyleType, MapStyleVariant, type PixelData, ReferenceMapStyle, type ReverseGeocodingOptions, ServiceError, type StaticMapBaseOptions, type StaticMapMarker, type TileJSON, type XYZ, bufferToPixelDataBrowser, circumferenceAtLatitude, coordinates, data, elevation, expandMapStyle, geocoding, geolocation, getBufferToPixelDataParser, getTileCache, mapStylePresetList, math, misc, staticMaps, styleToStyle, type LanguageInfo, areSameLanguages, toLanguageInfo, isLanguageInfo, getAutoLanguage, getLanguageInfoFromFlag, getLanguageInfoFromCode, getLanguageInfoFromKey, } from '@maptiler/client';
|
|
83
|
+
export { config, SdkConfig } from './config';
|
|
84
|
+
export * from './language';
|
|
85
|
+
export { type Unit } from './unit';
|
|
86
|
+
export * from './Minimap';
|
|
87
|
+
export * from './converters';
|
|
88
|
+
export * from './colorramp';
|
|
89
|
+
export * from './helpers';
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { LanguageInfo } from '@maptiler/client';
|
|
2
|
+
|
|
3
|
+
declare const Language: {
|
|
4
|
+
readonly AUTO: LanguageInfo;
|
|
5
|
+
readonly LATIN: LanguageInfo;
|
|
6
|
+
readonly NON_LATIN: LanguageInfo;
|
|
7
|
+
readonly LOCAL: LanguageInfo;
|
|
8
|
+
readonly AMHARIC: LanguageInfo;
|
|
9
|
+
readonly ARABIC: LanguageInfo;
|
|
10
|
+
readonly AZERBAIJANI: LanguageInfo;
|
|
11
|
+
readonly BELARUSIAN: LanguageInfo;
|
|
12
|
+
readonly BULGARIAN: LanguageInfo;
|
|
13
|
+
readonly BENGALI: LanguageInfo;
|
|
14
|
+
readonly BRETON: LanguageInfo;
|
|
15
|
+
readonly BOSNIAN: LanguageInfo;
|
|
16
|
+
readonly CATALAN: LanguageInfo;
|
|
17
|
+
readonly CHINESE: LanguageInfo;
|
|
18
|
+
readonly TRADITIONAL_CHINESE: LanguageInfo;
|
|
19
|
+
readonly SIMPLIFIED_CHINESE: LanguageInfo;
|
|
20
|
+
readonly CORSICAN: LanguageInfo;
|
|
21
|
+
readonly CZECH: LanguageInfo;
|
|
22
|
+
readonly WELSH: LanguageInfo;
|
|
23
|
+
readonly DANISH: LanguageInfo;
|
|
24
|
+
readonly GERMAN: LanguageInfo;
|
|
25
|
+
readonly GREEK: LanguageInfo;
|
|
26
|
+
readonly ENGLISH: LanguageInfo;
|
|
27
|
+
readonly ESPERANTO: LanguageInfo;
|
|
28
|
+
readonly SPANISH: LanguageInfo;
|
|
29
|
+
readonly ESTONIAN: LanguageInfo;
|
|
30
|
+
readonly BASQUE: LanguageInfo;
|
|
31
|
+
readonly FINNISH: LanguageInfo;
|
|
32
|
+
readonly FRENCH: LanguageInfo;
|
|
33
|
+
readonly FRISIAN: LanguageInfo;
|
|
34
|
+
readonly IRISH: LanguageInfo;
|
|
35
|
+
readonly SCOTTISH_GAELIC: LanguageInfo;
|
|
36
|
+
readonly HEBREW: LanguageInfo;
|
|
37
|
+
readonly HINDI: LanguageInfo;
|
|
38
|
+
readonly CROATIAN: LanguageInfo;
|
|
39
|
+
readonly HUNGARIAN: LanguageInfo;
|
|
40
|
+
readonly ARMENIAN: LanguageInfo;
|
|
41
|
+
readonly INDONESIAN: LanguageInfo;
|
|
42
|
+
readonly ICELANDIC: LanguageInfo;
|
|
43
|
+
readonly ITALIAN: LanguageInfo;
|
|
44
|
+
readonly JAPANESE: LanguageInfo;
|
|
45
|
+
readonly JAPANESE_HIRAGANA: LanguageInfo;
|
|
46
|
+
readonly JAPANESE_2018: LanguageInfo;
|
|
47
|
+
readonly JAPANESE_KANA: LanguageInfo;
|
|
48
|
+
readonly JAPANESE_LATIN: LanguageInfo;
|
|
49
|
+
readonly GEORGIAN: LanguageInfo;
|
|
50
|
+
readonly KAZAKH: LanguageInfo;
|
|
51
|
+
readonly KANNADA: LanguageInfo;
|
|
52
|
+
readonly KOREAN: LanguageInfo;
|
|
53
|
+
readonly KOREAN_LATIN: LanguageInfo;
|
|
54
|
+
readonly KURDISH: LanguageInfo;
|
|
55
|
+
readonly CLASSICAL_LATIN: LanguageInfo;
|
|
56
|
+
readonly LUXEMBOURGISH: LanguageInfo;
|
|
57
|
+
readonly LITHUANIAN: LanguageInfo;
|
|
58
|
+
readonly LATVIAN: LanguageInfo;
|
|
59
|
+
readonly MACEDONIAN: LanguageInfo;
|
|
60
|
+
readonly MALAYALAM: LanguageInfo;
|
|
61
|
+
readonly MALTESE: LanguageInfo;
|
|
62
|
+
readonly DUTCH: LanguageInfo;
|
|
63
|
+
readonly NORWEGIAN: LanguageInfo;
|
|
64
|
+
readonly OCCITAN: LanguageInfo;
|
|
65
|
+
readonly POLISH: LanguageInfo;
|
|
66
|
+
readonly PERSIAN: LanguageInfo;
|
|
67
|
+
readonly PUNJABI: LanguageInfo;
|
|
68
|
+
readonly WESTERN_PUNJABI: LanguageInfo;
|
|
69
|
+
readonly PORTUGUESE: LanguageInfo;
|
|
70
|
+
readonly ROMANSH: LanguageInfo;
|
|
71
|
+
readonly ROMANIAN: LanguageInfo;
|
|
72
|
+
readonly RUSSIAN: LanguageInfo;
|
|
73
|
+
readonly SLOVAK: LanguageInfo;
|
|
74
|
+
readonly SLOVENE: LanguageInfo;
|
|
75
|
+
readonly ALBANIAN: LanguageInfo;
|
|
76
|
+
readonly SERBIAN_CYRILLIC: LanguageInfo;
|
|
77
|
+
readonly SERBIAN_LATIN: LanguageInfo;
|
|
78
|
+
readonly SWEDISH: LanguageInfo;
|
|
79
|
+
readonly TAMIL: LanguageInfo;
|
|
80
|
+
readonly TELUGU: LanguageInfo;
|
|
81
|
+
readonly THAI: LanguageInfo;
|
|
82
|
+
readonly TURKISH: LanguageInfo;
|
|
83
|
+
readonly UKRAINIAN: LanguageInfo;
|
|
84
|
+
readonly VIETNAMESE: LanguageInfo;
|
|
85
|
+
/**
|
|
86
|
+
* Language mode to display labels in both the local language and the language of the visitor's device, concatenated.
|
|
87
|
+
* Note that if those two languages are the same, labels won't be duplicated.
|
|
88
|
+
*/
|
|
89
|
+
readonly VISITOR: LanguageInfo;
|
|
90
|
+
/**
|
|
91
|
+
* Language mode to display labels in both the local language and English, concatenated.
|
|
92
|
+
* Note that if those two languages are the same, labels won't be duplicated.
|
|
93
|
+
*/
|
|
94
|
+
readonly VISITOR_ENGLISH: LanguageInfo;
|
|
95
|
+
/**
|
|
96
|
+
* Language mode to display labels in a language enforced in the style.
|
|
97
|
+
*/
|
|
98
|
+
readonly STYLE: LanguageInfo;
|
|
99
|
+
/**
|
|
100
|
+
* Language mode to display labels in a language enforced in the style. The language cannot be further modified.
|
|
101
|
+
*/
|
|
102
|
+
readonly STYLE_LOCK: LanguageInfo;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Get the browser language
|
|
106
|
+
*/
|
|
107
|
+
export declare function getBrowserLanguage(): LanguageInfo;
|
|
108
|
+
export { Language, type LanguageInfo };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { RequestParameters, ResourceType, RequestTransformFunction } from 'maplibre-gl';
|
|
2
|
+
|
|
3
|
+
export declare function enableRTL(): void;
|
|
4
|
+
export declare function bindAll(fns: Array<string>, context: any): void;
|
|
5
|
+
export declare function DOMcreate<K extends keyof HTMLElementTagNameMap>(tagName: K, className?: string, container?: HTMLElement): HTMLElementTagNameMap[K];
|
|
6
|
+
export declare function DOMremove(node: HTMLElement): void;
|
|
7
|
+
/**
|
|
8
|
+
* This function is meant to be used as transformRequest by any Map instance created.
|
|
9
|
+
* It adds the session ID as well as the MapTiler Cloud key from the config to all the requests
|
|
10
|
+
* performed on MapTiler Cloud servers.
|
|
11
|
+
*/
|
|
12
|
+
export declare function maptilerCloudTransformRequest(url: string, resourceType?: ResourceType): RequestParameters;
|
|
13
|
+
/**
|
|
14
|
+
* This combines a user-defined tranformRequest function (optionnal)
|
|
15
|
+
* with the MapTiler Cloud-specific one: maptilerCloudTransformRequest
|
|
16
|
+
*/
|
|
17
|
+
export declare function combineTransformRequest(userDefinedRTF?: RequestTransformFunction | null): RequestTransformFunction;
|
|
18
|
+
/**
|
|
19
|
+
* Generate a random string. Handy to create random IDs
|
|
20
|
+
*/
|
|
21
|
+
export declare function generateRandomString(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Check if a given string is in a uuid format
|
|
24
|
+
*/
|
|
25
|
+
export declare function isUUID(s: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Attempt a JSON parse of a string but does not throw if the string is not valid JSON, returns `null` instead.
|
|
28
|
+
*/
|
|
29
|
+
export declare function jsonParseNoThrow<T>(doc: string): T | null;
|
|
30
|
+
/**
|
|
31
|
+
* Simple function to check if an object is a GeoJSON
|
|
32
|
+
*/
|
|
33
|
+
export declare function isValidGeoJSON<T>(obj: T & {
|
|
34
|
+
type: string;
|
|
35
|
+
}): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* This function tests if WebGL2 is supported. Since it can be for a different reasons that WebGL2 is
|
|
38
|
+
* not supported but we do not have an action to take based on the reason, this function return null
|
|
39
|
+
* if there is no error (WebGL is supported), or returns a string with the error message if WebGL2 is
|
|
40
|
+
* not supported.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getWebGLSupportError(): string | null;
|
|
43
|
+
/**
|
|
44
|
+
* Display an error message in the Map div if WebGL2 is not supported
|
|
45
|
+
*/
|
|
46
|
+
export declare function displayNoWebGlWarning(container: HTMLElement | string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Unit = "imperial" | "metric" | "nautical";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maptiler/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
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",
|
|
@@ -34,43 +34,37 @@
|
|
|
34
34
|
"url": "https://github.com/maptiler/maptiler-sdk-js.git"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
|
-
"build": "rm -rf dist/* && NODE_ENV=production rollup -c",
|
|
38
|
-
"dev": "rm -rf dist/* && NODE_ENV=development rollup -c -w",
|
|
39
37
|
"biome": "biome check --max-diagnostics=1000",
|
|
40
38
|
"biome:fix": "npx @biomejs/biome check --max-diagnostics=1000 --write",
|
|
41
39
|
"doc": "rm -rf docs/* && typedoc --out docs && cp -r images docs/",
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"build-css": "node scripts/replace-path-with-content.js src/style/style_template.css dist/tmp_maptiler-sdk.css && cat node_modules/maplibre-gl/dist/maplibre-gl.css dist/tmp_maptiler-sdk.css > dist/maptiler-sdk.css && rm dist/tmp_maptiler-sdk.css && cp dist/maptiler-sdk.css build/maptiler-sdk.css",
|
|
42
|
+
"build-umd": "tsc && NODE_ENV=production vite build -c vite.config-umd.ts",
|
|
43
|
+
"build-es": "tsc && NODE_ENV=production vite build -c vite.config-es.ts",
|
|
44
|
+
"build": "npm run build-es; npm run build-umd; npm run build-css",
|
|
45
|
+
"make": "npm run biome:fix && npm run build",
|
|
46
|
+
"dev-umd": "npm run build-css && tsc && NODE_ENV=dev vite build -w -c vite.config-umd.ts",
|
|
47
|
+
"help": "vite build --help"
|
|
45
48
|
},
|
|
46
49
|
"author": "MapTiler",
|
|
47
50
|
"devDependencies": {
|
|
48
51
|
"@biomejs/biome": "1.8.3",
|
|
49
|
-
"@rollup/plugin-commonjs": "^26.0.1",
|
|
50
|
-
"@rollup/plugin-json": "^6.1.0",
|
|
51
|
-
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
52
52
|
"@types/uuid": "^9.0.2",
|
|
53
53
|
"@types/xmldom": "^0.1.31",
|
|
54
|
-
"
|
|
55
|
-
"rollup-plugin-copy-merge": "^1.0.2",
|
|
56
|
-
"rollup-plugin-dts": "^6.1.1",
|
|
57
|
-
"rollup-plugin-esbuild": "^6.1.1",
|
|
58
|
-
"rollup-plugin-node-globals": "^1.4.0",
|
|
59
|
-
"rollup-plugin-shell": "^1.0.9",
|
|
60
|
-
"rollup-plugin-string": "^3.0.0",
|
|
61
|
-
"rollup-plugin-swc": "^0.2.1",
|
|
54
|
+
"@xmldom/xmldom": "^0.8.10",
|
|
62
55
|
"serve": "^14.2.0",
|
|
63
56
|
"terser": "^5.17.1",
|
|
64
57
|
"typedoc": "^0.24.8",
|
|
65
58
|
"typescript": "^5.1.6",
|
|
66
|
-
"
|
|
67
|
-
"
|
|
59
|
+
"vite": "^5.3.4",
|
|
60
|
+
"vite-plugin-dts": "^4.0.0-beta.0",
|
|
61
|
+
"vitest": "^0.34.2"
|
|
68
62
|
},
|
|
69
63
|
"dependencies": {
|
|
70
|
-
"@maptiler/client": "^
|
|
64
|
+
"@maptiler/client": "^2.0.0",
|
|
71
65
|
"events": "^3.3.0",
|
|
72
66
|
"js-base64": "^3.7.4",
|
|
73
|
-
"maplibre-gl": "4.
|
|
67
|
+
"maplibre-gl": "^4.7.0",
|
|
74
68
|
"uuid": "^9.0.0"
|
|
75
69
|
}
|
|
76
70
|
}
|
package/readme.md
CHANGED
|
@@ -862,6 +862,37 @@ Turning off *zoom compensation* allows for more accurate adjustments to the visu
|
|
|
862
862
|
|
|
863
863
|
All the other options are documented on [our reference page](https://docs.maptiler.com/sdk-js/api/helpers/#heatmap) and more examples are available [here](https://docs.maptiler.com/sdk-js/examples/?q=heatmap+helper).
|
|
864
864
|
|
|
865
|
+
# Other helper
|
|
866
|
+
## Take Screenshots, programmatically
|
|
867
|
+
There are two different ways to create screenshot, corresponding to two very different usecases. Note that screenshots will not contain *DOM elements* such as `Marker` and `Popup`, since those are not part of the rendering context.
|
|
868
|
+
|
|
869
|
+
**1. Get a `blob` of a screenshot, PNG encoded:**
|
|
870
|
+
```ts
|
|
871
|
+
import { Map, helpers } from "@maptiler/sdk";
|
|
872
|
+
|
|
873
|
+
// ... initialize a Map instance, wait for the "load" or "ready" event ...
|
|
874
|
+
|
|
875
|
+
// Inside an async function, or with using .then()
|
|
876
|
+
const blob = await helpers.takeScreenshot(map);
|
|
877
|
+
```
|
|
878
|
+
The returned `Blob` of a PNG image file can be very handy if the goal is to programmatically further manipulate the screenshot, such as sending it to some feedback endpoint with a POST request.
|
|
879
|
+
|
|
880
|
+
**2. Download a PNG file:**
|
|
881
|
+
```ts
|
|
882
|
+
import { Map, helpers } from "@maptiler/sdk";
|
|
883
|
+
|
|
884
|
+
// ... initialize a Map instance, wait for the "load" or "ready" event ...
|
|
885
|
+
|
|
886
|
+
// No need to be inside an async function, the download will be triggered when the file is ready
|
|
887
|
+
maptilersdk.helpers.takeScreenshot(map, {
|
|
888
|
+
download: true,
|
|
889
|
+
filename: "map_screenshot.png"
|
|
890
|
+
});
|
|
891
|
+
```
|
|
892
|
+
Getting a file directly is a nice option that can be useful to share some debugging context with colleagues, compare multiple styles, or share your creation on social media.
|
|
893
|
+
|
|
894
|
+
> 📣 *__Note:__* Keep in mind that MapTiler Cloud data are copyrighted and their usage is restricted. This include MapTiler built-in styles and tilesets, among others. In case of doubt, do not hesitate to read our [terms](https://www.maptiler.com/terms/) or to ask our [support team](https://www.maptiler.com/contacts/).
|
|
895
|
+
|
|
865
896
|
# Caching
|
|
866
897
|
Starting from v2, MapTiler SDK introduced the **caching** of tiles and fonts served by MapTiler Cloud, which can represent a large chunk of the data being fetched when browsing a map. This caching leverages modern browsers caching API so it's well-managed and there is no risk of bloating! When we update **MapTiler Planet** or our **official styles**, the caching logic will detect it and automatically invalidate older versions of the tiles that were previously cached.
|
|
867
898
|
|
package/tsconfig.json
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"baseUrl": "src",
|
|
4
|
+
"moduleResolution": "Node",
|
|
5
|
+
"target": "ES2020",
|
|
6
|
+
"useDefineForClassFields": true,
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
|
|
11
|
+
/* Bundler mode */
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
|
|
16
|
+
/* Linting */
|
|
5
17
|
"strict": true,
|
|
6
|
-
"
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
|
|
22
|
+
|
|
7
23
|
"declaration": true,
|
|
8
24
|
"allowSyntheticDefaultImports": true,
|
|
9
|
-
"resolveJsonModule": true,
|
|
10
|
-
"esModuleInterop": true
|
|
11
25
|
},
|
|
12
|
-
"include": ["src
|
|
13
|
-
|
|
14
|
-
}
|
|
26
|
+
"include": ["src"]
|
|
27
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { resolve } from 'path';
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
import dts from 'vite-plugin-dts';
|
|
4
|
+
|
|
5
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
6
|
+
|
|
7
|
+
const plugins = [
|
|
8
|
+
dts({insertTypesEntry: true}),
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
export default defineConfig({
|
|
12
|
+
mode: isProduction ? "production" : "development",
|
|
13
|
+
build: {
|
|
14
|
+
minify: isProduction,
|
|
15
|
+
emptyOutDir: isProduction,
|
|
16
|
+
outDir: "dist",
|
|
17
|
+
sourcemap: true,
|
|
18
|
+
lib: {
|
|
19
|
+
// Could also be a dictionary or array of multiple entry points
|
|
20
|
+
entry: resolve(__dirname, 'src/index.ts'),
|
|
21
|
+
name: 'maptilersdk',
|
|
22
|
+
// the proper extensions will be added
|
|
23
|
+
fileName: (format, entryName) => "maptiler-sdk.mjs",
|
|
24
|
+
formats: ['es'],
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
rollupOptions: {
|
|
28
|
+
// make sure to externalize deps that shouldn't be bundled
|
|
29
|
+
// into your library
|
|
30
|
+
external: [
|
|
31
|
+
"maplibre-gl",
|
|
32
|
+
"@maptiler/client",
|
|
33
|
+
"@mapbox/point-geometry",
|
|
34
|
+
"uuid",
|
|
35
|
+
"@mapbox/unitbezier",
|
|
36
|
+
"events",
|
|
37
|
+
"js-base64",
|
|
38
|
+
"geojson-validation",
|
|
39
|
+
],
|
|
40
|
+
output: {
|
|
41
|
+
// Provide global variables to use in the UMD build
|
|
42
|
+
// for externalized deps
|
|
43
|
+
globals: {},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
plugins,
|
|
48
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { resolve } from 'path';
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
|
|
4
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
5
|
+
const bundleFilename = isProduction ? "maptiler-sdk.umd.min.js" : "maptiler-sdk.umd.js"
|
|
6
|
+
|
|
7
|
+
const plugins = [];
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export default defineConfig({
|
|
11
|
+
mode: isProduction ? "production" : "development",
|
|
12
|
+
build: {
|
|
13
|
+
outDir: "build",
|
|
14
|
+
minify: isProduction,
|
|
15
|
+
emptyOutDir: isProduction,
|
|
16
|
+
sourcemap: true,
|
|
17
|
+
lib: {
|
|
18
|
+
// Could also be a dictionary or array of multiple entry points
|
|
19
|
+
entry: resolve(__dirname, 'src/index.ts'),
|
|
20
|
+
name: 'maptilersdk',
|
|
21
|
+
// the proper extensions will be added
|
|
22
|
+
fileName: (format, entryName) => bundleFilename,
|
|
23
|
+
formats: ['umd'],
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
plugins,
|
|
27
|
+
})
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
name: Format and Lint
|
|
2
|
-
|
|
3
|
-
on: [pull_request]
|
|
4
|
-
|
|
5
|
-
jobs:
|
|
6
|
-
format-and-lint:
|
|
7
|
-
runs-on: ubuntu-latest
|
|
8
|
-
steps:
|
|
9
|
-
- name: Check out Git repository
|
|
10
|
-
uses: actions/checkout@v3
|
|
11
|
-
|
|
12
|
-
- name: Set up Node.js
|
|
13
|
-
uses: actions/setup-node@v3
|
|
14
|
-
with:
|
|
15
|
-
node-version: 18
|
|
16
|
-
|
|
17
|
-
- name: Install Node.js dependencies
|
|
18
|
-
run: npm ci
|
|
19
|
-
|
|
20
|
-
- name: Formatting and linting with Biome
|
|
21
|
-
run: npm run biome
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
-
|
|
4
|
-
name: Node.js Package
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
release:
|
|
8
|
-
types: [created]
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
build-and-publish:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v3
|
|
15
|
-
- uses: actions/setup-node@v3
|
|
16
|
-
with:
|
|
17
|
-
node-version: 18
|
|
18
|
-
registry-url: https://registry.npmjs.org/
|
|
19
|
-
- run: npm ci
|
|
20
|
-
- run: npm publish --access public
|
|
21
|
-
env:
|
|
22
|
-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|