@maptiler/sdk 2.2.0 → 2.2.2
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 -1851
- package/dist/maptiler-sdk.mjs +1748 -2683
- 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 +17 -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 +12 -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 +142 -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 +11 -19
- package/tsconfig.json +21 -8
- package/vite.config-es.ts +48 -0
- package/vite.config-umd.ts +25 -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, LanguageGeocoding, type LanguageGeocodingOptions, type LanguageGeocodingString, 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, getAutoLanguageGeocoding, getBufferToPixelDataParser, getTileCache, mapStylePresetList, math, misc, staticMaps, styleToStyle, } 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,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Languages. Note that not all the languages of this list are available but the compatibility list may be expanded in the future.
|
|
3
|
+
*/
|
|
4
|
+
declare const Language: {
|
|
5
|
+
/**
|
|
6
|
+
* The visitor language mode concatenates the prefered language from the user settings and the "default name".
|
|
7
|
+
* Note: The "default name" is equivalent to OSM's `{name}`, which can be the most recognized names a global
|
|
8
|
+
* scale or the local name.
|
|
9
|
+
* This mode is helpful in the context where a user needs to access both the local names and the names in their
|
|
10
|
+
* own language, for instance when traveling abroad, where signs likely to be only available in the local language.
|
|
11
|
+
*/
|
|
12
|
+
readonly VISITOR: "visitor";
|
|
13
|
+
/**
|
|
14
|
+
* The visitor language mode concatenates English and the "default name".
|
|
15
|
+
* Note: The "default name" is equivalent to OSM's `{name}`, which can be the most recognized names a global
|
|
16
|
+
* scale or the local name.
|
|
17
|
+
* This mode is helpful in the context where a user needs to access both the local names and the names in their
|
|
18
|
+
* own language, for instance when traveling abroad, where signs likely to be only available in the local language.
|
|
19
|
+
*/
|
|
20
|
+
readonly VISITOR_ENGLISH: "visitor_en";
|
|
21
|
+
/**
|
|
22
|
+
* Language as the style is designed. Not that this is the default state and one
|
|
23
|
+
* the language has been changed to another than `STYLE`, then it cannot be set back to `STYLE`.
|
|
24
|
+
*/
|
|
25
|
+
readonly STYLE: "style";
|
|
26
|
+
/**
|
|
27
|
+
* AUTO mode uses the language of the browser
|
|
28
|
+
*/
|
|
29
|
+
readonly AUTO: "auto";
|
|
30
|
+
/**
|
|
31
|
+
* STYLE is a custom flag to keep the language of the map as defined into the style.
|
|
32
|
+
* If STYLE is set in the constructor, then further modification of the language
|
|
33
|
+
* with `.setLanguage()` is not possible.
|
|
34
|
+
*/
|
|
35
|
+
readonly STYLE_LOCK: "style_lock";
|
|
36
|
+
/**
|
|
37
|
+
* Default fallback languages that uses latin charaters
|
|
38
|
+
*/
|
|
39
|
+
readonly LATIN: "name:latin";
|
|
40
|
+
/**
|
|
41
|
+
* Default fallback languages that uses non-latin charaters
|
|
42
|
+
*/
|
|
43
|
+
readonly NON_LATIN: "name:nonlatin";
|
|
44
|
+
/**
|
|
45
|
+
* Labels are in their local language, when available
|
|
46
|
+
*/
|
|
47
|
+
readonly LOCAL: "name";
|
|
48
|
+
/**
|
|
49
|
+
* International name
|
|
50
|
+
*/
|
|
51
|
+
readonly INTERNATIONAL: "name_int";
|
|
52
|
+
readonly ALBANIAN: "name:sq";
|
|
53
|
+
readonly AMHARIC: "name:am";
|
|
54
|
+
readonly ARABIC: "name:ar";
|
|
55
|
+
readonly ARMENIAN: "name:hy";
|
|
56
|
+
readonly AZERBAIJANI: "name:az";
|
|
57
|
+
readonly BASQUE: "name:eu";
|
|
58
|
+
readonly BELORUSSIAN: "name:be";
|
|
59
|
+
readonly BENGALI: "name:bn";
|
|
60
|
+
readonly BOSNIAN: "name:bs";
|
|
61
|
+
readonly BRETON: "name:br";
|
|
62
|
+
readonly BULGARIAN: "name:bg";
|
|
63
|
+
readonly CATALAN: "name:ca";
|
|
64
|
+
readonly CHINESE: "name:zh";
|
|
65
|
+
readonly TRADITIONAL_CHINESE: "name:zh-Hant";
|
|
66
|
+
readonly SIMPLIFIED_CHINESE: "name:zh-Hans";
|
|
67
|
+
readonly CORSICAN: "name:co";
|
|
68
|
+
readonly CROATIAN: "name:hr";
|
|
69
|
+
readonly CZECH: "name:cs";
|
|
70
|
+
readonly DANISH: "name:da";
|
|
71
|
+
readonly DUTCH: "name:nl";
|
|
72
|
+
readonly ENGLISH: "name:en";
|
|
73
|
+
readonly ESPERANTO: "name:eo";
|
|
74
|
+
readonly ESTONIAN: "name:et";
|
|
75
|
+
readonly FINNISH: "name:fi";
|
|
76
|
+
readonly FRENCH: "name:fr";
|
|
77
|
+
readonly FRISIAN: "name:fy";
|
|
78
|
+
readonly GEORGIAN: "name:ka";
|
|
79
|
+
readonly GERMAN: "name:de";
|
|
80
|
+
readonly GREEK: "name:el";
|
|
81
|
+
readonly HEBREW: "name:he";
|
|
82
|
+
readonly HINDI: "name:hi";
|
|
83
|
+
readonly HUNGARIAN: "name:hu";
|
|
84
|
+
readonly ICELANDIC: "name:is";
|
|
85
|
+
readonly INDONESIAN: "name:id";
|
|
86
|
+
readonly IRISH: "name:ga";
|
|
87
|
+
readonly ITALIAN: "name:it";
|
|
88
|
+
readonly JAPANESE: "name:ja";
|
|
89
|
+
readonly JAPANESE_HIRAGANA: "name:ja-Hira";
|
|
90
|
+
readonly JAPANESE_KANA: "name:ja_kana";
|
|
91
|
+
readonly JAPANESE_LATIN: "name:ja_rm";
|
|
92
|
+
readonly JAPANESE_2018: "name:ja-Latn";
|
|
93
|
+
readonly KANNADA: "name:kn";
|
|
94
|
+
readonly KAZAKH: "name:kk";
|
|
95
|
+
readonly KOREAN: "name:ko";
|
|
96
|
+
readonly KOREAN_LATIN: "name:ko-Latn";
|
|
97
|
+
readonly KURDISH: "name:ku";
|
|
98
|
+
readonly ROMAN_LATIN: "name:la";
|
|
99
|
+
readonly LATVIAN: "name:lv";
|
|
100
|
+
readonly LITHUANIAN: "name:lt";
|
|
101
|
+
readonly LUXEMBOURGISH: "name:lb";
|
|
102
|
+
readonly MACEDONIAN: "name:mk";
|
|
103
|
+
readonly MALAYALAM: "name:ml";
|
|
104
|
+
readonly MALTESE: "name:mt";
|
|
105
|
+
readonly NORWEGIAN: "name:no";
|
|
106
|
+
readonly OCCITAN: "name:oc";
|
|
107
|
+
readonly PERSIAN: "name:fa";
|
|
108
|
+
readonly POLISH: "name:pl";
|
|
109
|
+
readonly PORTUGUESE: "name:pt";
|
|
110
|
+
readonly PUNJABI: "name:pa";
|
|
111
|
+
readonly WESTERN_PUNJABI: "name:pnb";
|
|
112
|
+
readonly ROMANIAN: "name:ro";
|
|
113
|
+
readonly ROMANSH: "name:rm";
|
|
114
|
+
readonly RUSSIAN: "name:ru";
|
|
115
|
+
readonly SCOTTISH_GAELIC: "name:gd";
|
|
116
|
+
readonly SERBIAN_CYRILLIC: "name:sr";
|
|
117
|
+
readonly SERBIAN_LATIN: "name:sr-Latn";
|
|
118
|
+
readonly SLOVAK: "name:sk";
|
|
119
|
+
readonly SLOVENE: "name:sl";
|
|
120
|
+
readonly SPANISH: "name:es";
|
|
121
|
+
readonly SWEDISH: "name:sv";
|
|
122
|
+
readonly TAMIL: "name:ta";
|
|
123
|
+
readonly TELUGU: "name:te";
|
|
124
|
+
readonly THAI: "name:th";
|
|
125
|
+
readonly TURKISH: "name:tr";
|
|
126
|
+
readonly UKRAINIAN: "name:uk";
|
|
127
|
+
readonly URDU: "name:ur";
|
|
128
|
+
readonly VIETNAMIAN_LATIN: "name:vi";
|
|
129
|
+
readonly WELSH: "name:cy";
|
|
130
|
+
};
|
|
131
|
+
declare function isLanguageSupported(lang: string): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Type representing the key of the Language object
|
|
134
|
+
*/
|
|
135
|
+
type LanguageKey = keyof typeof Language;
|
|
136
|
+
type Values<T> = T[keyof T];
|
|
137
|
+
/**
|
|
138
|
+
* Built-in languages values as strings
|
|
139
|
+
*/
|
|
140
|
+
type LanguageString = Values<typeof Language>;
|
|
141
|
+
declare function getBrowserLanguage(): LanguageString;
|
|
142
|
+
export { Language, type LanguageString, type LanguageKey, getBrowserLanguage, isLanguageSupported };
|
|
@@ -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.2.
|
|
3
|
+
"version": "2.2.2",
|
|
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,35 @@
|
|
|
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": "NODE_ENV=production tsc && vite build -c vite.config-umd.ts",
|
|
43
|
+
"build-es": "NODE_ENV=production tsc && 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"
|
|
45
46
|
},
|
|
46
47
|
"author": "MapTiler",
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"@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
50
|
"@types/uuid": "^9.0.2",
|
|
53
51
|
"@types/xmldom": "^0.1.31",
|
|
54
|
-
"rollup": "^4.18.0",
|
|
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",
|
|
62
52
|
"serve": "^14.2.0",
|
|
63
53
|
"terser": "^5.17.1",
|
|
64
54
|
"typedoc": "^0.24.8",
|
|
65
55
|
"typescript": "^5.1.6",
|
|
66
56
|
"vitest": "^0.34.2",
|
|
67
|
-
"
|
|
57
|
+
"vite": "^5.3.4",
|
|
58
|
+
"vite-plugin-dts": "^4.0.0-beta.0"
|
|
68
59
|
},
|
|
69
60
|
"dependencies": {
|
|
70
61
|
"@maptiler/client": "^1.8.1",
|
|
71
62
|
"events": "^3.3.0",
|
|
72
63
|
"js-base64": "^3.7.4",
|
|
73
64
|
"maplibre-gl": "4.4.1",
|
|
74
|
-
"uuid": "^9.0.0"
|
|
65
|
+
"uuid": "^9.0.0",
|
|
66
|
+
"xmldom": "^0.6.0"
|
|
75
67
|
}
|
|
76
68
|
}
|
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
|
+
outDir: "dist",
|
|
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) => "maptiler-sdk.mjs",
|
|
23
|
+
formats: ['es'],
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
rollupOptions: {
|
|
27
|
+
// make sure to externalize deps that shouldn't be bundled
|
|
28
|
+
// into your library
|
|
29
|
+
external: [
|
|
30
|
+
"maplibre-gl",
|
|
31
|
+
"@maptiler/client",
|
|
32
|
+
"@mapbox/point-geometry",
|
|
33
|
+
"uuid",
|
|
34
|
+
"@mapbox/unitbezier",
|
|
35
|
+
"events",
|
|
36
|
+
"js-base64",
|
|
37
|
+
"geojson-validation",
|
|
38
|
+
"xmldom",
|
|
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,25 @@
|
|
|
1
|
+
import { resolve } from 'path';
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
|
|
4
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
5
|
+
|
|
6
|
+
const plugins = [];
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
mode: isProduction ? "production" : "development",
|
|
11
|
+
build: {
|
|
12
|
+
outDir: "build",
|
|
13
|
+
minify: isProduction,
|
|
14
|
+
sourcemap: true,
|
|
15
|
+
lib: {
|
|
16
|
+
// Could also be a dictionary or array of multiple entry points
|
|
17
|
+
entry: resolve(__dirname, 'src/index.ts'),
|
|
18
|
+
name: 'maptilersdk',
|
|
19
|
+
// the proper extensions will be added
|
|
20
|
+
fileName: (format, entryName) => "maptiler-sdk.umd.js",
|
|
21
|
+
formats: ['umd'],
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
plugins,
|
|
25
|
+
})
|
|
@@ -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}}
|