@maptiler/sdk 3.9.0-rc.4 → 3.9.0-rc.5

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 (81) hide show
  1. package/dist/eslint.mjs +133 -0
  2. package/dist/maptiler-sdk.d.ts +2 -0
  3. package/dist/maptiler-sdk.mjs +14208 -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 +408 -0
  7. package/dist/src/ImageViewer/ImageViewerMarker.d.ts +236 -0
  8. package/dist/src/ImageViewer/events.d.ts +47 -0
  9. package/dist/src/ImageViewer/index.d.ts +5 -0
  10. package/dist/src/ImageViewer/monkeyPatchML.d.ts +11 -0
  11. package/dist/src/ImageViewer/symbols.d.ts +2 -0
  12. package/dist/src/MLAdapters/AttributionControl.d.ts +5 -0
  13. package/dist/src/MLAdapters/BoxZoomHandler.d.ts +7 -0
  14. package/dist/src/MLAdapters/CanvasSource.d.ts +5 -0
  15. package/dist/src/MLAdapters/CooperativeGesturesHandler.d.ts +5 -0
  16. package/dist/src/MLAdapters/FullscreenControl.d.ts +5 -0
  17. package/dist/src/MLAdapters/GeoJSONSource.d.ts +5 -0
  18. package/dist/src/MLAdapters/GeolocateControl.d.ts +5 -0
  19. package/dist/src/MLAdapters/ImageSource.d.ts +5 -0
  20. package/dist/src/MLAdapters/KeyboardHandler.d.ts +5 -0
  21. package/dist/src/MLAdapters/LogoControl.d.ts +5 -0
  22. package/dist/src/MLAdapters/MapMouseEvent.d.ts +5 -0
  23. package/dist/src/MLAdapters/MapTouchEvent.d.ts +5 -0
  24. package/dist/src/MLAdapters/MapWheelEvent.d.ts +5 -0
  25. package/dist/src/MLAdapters/Marker.d.ts +5 -0
  26. package/dist/src/MLAdapters/NavigationControl.d.ts +5 -0
  27. package/dist/src/MLAdapters/Popup.d.ts +5 -0
  28. package/dist/src/MLAdapters/RasterDEMTileSource.d.ts +5 -0
  29. package/dist/src/MLAdapters/RasterTileSource.d.ts +5 -0
  30. package/dist/src/MLAdapters/ScaleControl.d.ts +5 -0
  31. package/dist/src/MLAdapters/ScrollZoomHandler.d.ts +5 -0
  32. package/dist/src/MLAdapters/Style.d.ts +5 -0
  33. package/dist/src/MLAdapters/TerrainControl.d.ts +5 -0
  34. package/dist/src/MLAdapters/TwoFingersTouchPitchHandler.d.ts +5 -0
  35. package/dist/src/MLAdapters/VectorTileSource.d.ts +5 -0
  36. package/dist/src/MLAdapters/VideoSource.d.ts +5 -0
  37. package/dist/src/Map.d.ts +470 -0
  38. package/dist/src/Point.d.ts +177 -0
  39. package/dist/src/Telemetry.d.ts +23 -0
  40. package/dist/src/caching.d.ts +4 -0
  41. package/dist/src/config.d.ts +85 -0
  42. package/dist/src/constants/defaults.d.ts +15 -0
  43. package/dist/src/controls/ImageViewerFitImageToBoundsControl.d.ts +13 -0
  44. package/dist/src/controls/MaptilerCustomControl.d.ts +17 -0
  45. package/dist/src/controls/MaptilerExternalControl.d.ts +25 -0
  46. package/dist/src/controls/MaptilerGeolocateControl.d.ts +21 -0
  47. package/dist/src/controls/MaptilerLogoControl.d.ts +19 -0
  48. package/dist/src/controls/MaptilerNavigationControl.d.ts +17 -0
  49. package/dist/src/controls/MaptilerProjectionControl.d.ts +15 -0
  50. package/dist/src/controls/MaptilerTerrainControl.d.ts +17 -0
  51. package/dist/src/controls/Minimap.d.ts +57 -0
  52. package/dist/src/controls/index.d.ts +8 -0
  53. package/dist/src/converters/index.d.ts +1 -0
  54. package/dist/src/converters/xml.d.ts +54 -0
  55. package/dist/src/custom-layers/CubemapLayer/CubemapLayer.d.ts +239 -0
  56. package/dist/src/custom-layers/CubemapLayer/constants.d.ts +3 -0
  57. package/dist/src/custom-layers/CubemapLayer/index.d.ts +2 -0
  58. package/dist/src/custom-layers/CubemapLayer/loadCubemapTexture.d.ts +42 -0
  59. package/dist/src/custom-layers/CubemapLayer/types.d.ts +67 -0
  60. package/dist/src/custom-layers/RadialGradientLayer/RadialGradientLayer.d.ts +149 -0
  61. package/dist/src/custom-layers/RadialGradientLayer/index.d.ts +2 -0
  62. package/dist/src/custom-layers/RadialGradientLayer/types.d.ts +50 -0
  63. package/dist/src/custom-layers/extractCustomLayerStyle.d.ts +17 -0
  64. package/dist/src/custom-layers/index.d.ts +6 -0
  65. package/dist/src/helpers/index.d.ts +5 -0
  66. package/dist/src/helpers/screenshot.d.ts +18 -0
  67. package/dist/src/helpers/stylehelper.d.ts +28 -0
  68. package/dist/src/helpers/vectorlayerhelpers.d.ts +508 -0
  69. package/dist/src/index.d.ts +91 -0
  70. package/dist/src/language.d.ts +107 -0
  71. package/dist/src/mapstyle.d.ts +18 -0
  72. package/dist/src/tools.d.ts +84 -0
  73. package/dist/src/types.d.ts +1 -0
  74. package/dist/src/utils/dom.d.ts +2 -0
  75. package/dist/src/utils/errors.d.ts +5 -0
  76. package/dist/src/utils/geo-utils.d.ts +6 -0
  77. package/dist/src/utils/index.d.ts +1 -0
  78. package/dist/src/utils/math-utils.d.ts +8 -0
  79. package/dist/src/utils/object.d.ts +1 -0
  80. package/dist/src/utils/webgl-utils.d.ts +49 -0
  81. package/package.json +2 -2
@@ -0,0 +1,107 @@
1
+ import { LanguageInfo } from '@maptiler/client';
2
+ declare const Language: {
3
+ readonly ALBANIAN: LanguageInfo;
4
+ readonly AMHARIC: LanguageInfo;
5
+ readonly ARABIC: LanguageInfo;
6
+ readonly ARMENIAN: LanguageInfo;
7
+ readonly AZERBAIJANI: LanguageInfo;
8
+ readonly BASQUE: LanguageInfo;
9
+ readonly BELARUSIAN: LanguageInfo;
10
+ readonly BENGALI: LanguageInfo;
11
+ readonly BOSNIAN: LanguageInfo;
12
+ readonly BRETON: LanguageInfo;
13
+ readonly BULGARIAN: LanguageInfo;
14
+ readonly CATALAN: LanguageInfo;
15
+ readonly CHINESE: LanguageInfo;
16
+ readonly TRADITIONAL_CHINESE: LanguageInfo;
17
+ readonly SIMPLIFIED_CHINESE: LanguageInfo;
18
+ readonly CORSICAN: LanguageInfo;
19
+ readonly CROATIAN: LanguageInfo;
20
+ readonly CZECH: LanguageInfo;
21
+ readonly DANISH: LanguageInfo;
22
+ readonly DUTCH: LanguageInfo;
23
+ readonly GERMAN: LanguageInfo;
24
+ readonly GREEK: LanguageInfo;
25
+ readonly ENGLISH: LanguageInfo;
26
+ readonly ESPERANTO: LanguageInfo;
27
+ readonly ESTONIAN: LanguageInfo;
28
+ readonly FINNISH: LanguageInfo;
29
+ readonly FRENCH: LanguageInfo;
30
+ readonly FRISIAN: LanguageInfo;
31
+ readonly GEORGIAN: LanguageInfo;
32
+ readonly HEBREW: LanguageInfo;
33
+ readonly HINDI: LanguageInfo;
34
+ readonly HUNGARIAN: LanguageInfo;
35
+ readonly ICELANDIC: LanguageInfo;
36
+ readonly INDONESIAN: LanguageInfo;
37
+ readonly IRISH: LanguageInfo;
38
+ readonly ITALIAN: LanguageInfo;
39
+ readonly JAPANESE: LanguageInfo;
40
+ readonly JAPANESE_HIRAGANA: LanguageInfo;
41
+ readonly JAPANESE_2018: LanguageInfo;
42
+ readonly JAPANESE_KANA: LanguageInfo;
43
+ readonly JAPANESE_LATIN: LanguageInfo;
44
+ readonly KANNADA: LanguageInfo;
45
+ readonly KAZAKH: LanguageInfo;
46
+ readonly KOREAN: LanguageInfo;
47
+ readonly KOREAN_LATIN: LanguageInfo;
48
+ readonly KURDISH: LanguageInfo;
49
+ readonly CLASSICAL_LATIN: LanguageInfo;
50
+ readonly LATVIAN: LanguageInfo;
51
+ readonly LITHUANIAN: LanguageInfo;
52
+ readonly LUXEMBOURGISH: LanguageInfo;
53
+ readonly MACEDONIAN: LanguageInfo;
54
+ readonly MALAYALAM: LanguageInfo;
55
+ readonly MALTESE: LanguageInfo;
56
+ readonly NORWEGIAN: LanguageInfo;
57
+ readonly OCCITAN: LanguageInfo;
58
+ readonly PERSIAN: LanguageInfo;
59
+ readonly POLISH: LanguageInfo;
60
+ readonly PORTUGUESE: LanguageInfo;
61
+ readonly PUNJABI: LanguageInfo;
62
+ readonly WESTERN_PUNJABI: LanguageInfo;
63
+ readonly ROMANIAN: LanguageInfo;
64
+ readonly ROMANSH: LanguageInfo;
65
+ readonly RUSSIAN: LanguageInfo;
66
+ readonly SERBIAN_CYRILLIC: LanguageInfo;
67
+ readonly SERBIAN_LATIN: LanguageInfo;
68
+ readonly SCOTTISH_GAELIC: LanguageInfo;
69
+ readonly SLOVAK: LanguageInfo;
70
+ readonly SLOVENE: LanguageInfo;
71
+ readonly SPANISH: LanguageInfo;
72
+ readonly SWEDISH: LanguageInfo;
73
+ readonly TAMIL: LanguageInfo;
74
+ readonly TELUGU: LanguageInfo;
75
+ readonly THAI: LanguageInfo;
76
+ readonly TURKISH: LanguageInfo;
77
+ readonly UKRAINIAN: LanguageInfo;
78
+ readonly VIETNAMESE: LanguageInfo;
79
+ readonly WELSH: LanguageInfo;
80
+ readonly AUTO: LanguageInfo;
81
+ readonly LATIN: LanguageInfo;
82
+ readonly NON_LATIN: LanguageInfo;
83
+ readonly LOCAL: LanguageInfo;
84
+ /**
85
+ * Language mode to display labels in both the local language and the language of the visitor's device, concatenated.
86
+ * Note that if those two languages are the same, labels won't be duplicated.
87
+ */
88
+ readonly VISITOR: LanguageInfo;
89
+ /**
90
+ * Language mode to display labels in both the local language and English, concatenated.
91
+ * Note that if those two languages are the same, labels won't be duplicated.
92
+ */
93
+ readonly VISITOR_ENGLISH: LanguageInfo;
94
+ /**
95
+ * Language mode to display labels in a language enforced in the style.
96
+ */
97
+ readonly STYLE: LanguageInfo;
98
+ /**
99
+ * Language mode to display labels in a language enforced in the style. The language cannot be further modified.
100
+ */
101
+ readonly STYLE_LOCK: LanguageInfo;
102
+ };
103
+ /**
104
+ * Get the browser language
105
+ */
106
+ export declare function getBrowserLanguage(): LanguageInfo;
107
+ export { Language, type LanguageInfo };
@@ -0,0 +1,18 @@
1
+ import { ReferenceMapStyle, MapStyleVariant } from '@maptiler/client';
2
+ export declare function styleToStyle(style: string | ReferenceMapStyle | MapStyleVariant | maplibregl.StyleSpecification | null | undefined): {
3
+ style: string | maplibregl.StyleSpecification;
4
+ requiresUrlMonitoring: boolean;
5
+ isFallback: boolean;
6
+ isJSON?: boolean;
7
+ };
8
+ /**
9
+ * makes sure a URL is absolute
10
+ */
11
+ export declare function urlToAbsoluteUrl(url: string): string;
12
+ type StyleValidationReport = {
13
+ isValidJSON: boolean;
14
+ isValidStyle: boolean;
15
+ styleObject: maplibregl.StyleSpecification | null;
16
+ };
17
+ export declare function convertStringToStyleSpecification(str: string): StyleValidationReport;
18
+ export {};
@@ -0,0 +1,84 @@
1
+ import { default as maplibregl, RequestParameters, ResourceType, RequestTransformFunction } from 'maplibre-gl';
2
+ import { Map as MapSDK } from './Map';
3
+ export declare function enableRTL(customPluginURL?: string): Promise<void>;
4
+ export declare function bindAll(fns: Array<string>, context: any): void;
5
+ /**
6
+ * This function is meant to be used as transformRequest by any Map instance created.
7
+ * It adds the session ID as well as the MapTiler Cloud key from the config to all the requests
8
+ * performed on MapTiler Cloud servers.
9
+ */
10
+ export declare function maptilerCloudTransformRequest(url: string, resourceType?: ResourceType): RequestParameters;
11
+ /**
12
+ * This combines a user-defined tranformRequest function (optionnal)
13
+ * with the MapTiler Cloud-specific one: maptilerCloudTransformRequest
14
+ */
15
+ export declare function combineTransformRequest(userDefinedRTF?: RequestTransformFunction | null): RequestTransformFunction;
16
+ /**
17
+ * Generate a random string. Handy to create random IDs
18
+ */
19
+ export declare function generateRandomString(): string;
20
+ /**
21
+ * Check if a given string is in a uuid format
22
+ */
23
+ export declare function isUUID(s: string): boolean;
24
+ /**
25
+ * Attempt a JSON parse of a string but does not throw if the string is not valid JSON, returns `null` instead.
26
+ */
27
+ export declare function jsonParseNoThrow<T>(doc: string): T | null;
28
+ /**
29
+ * Simple function to check if an object is a GeoJSON
30
+ */
31
+ export declare function isValidGeoJSON<T>(obj: T & {
32
+ type: string;
33
+ }): boolean;
34
+ /**
35
+ * This function tests if WebGL2 is supported. Since it can be for a different reasons that WebGL2 is
36
+ * not supported but we do not have an action to take based on the reason, this function return null
37
+ * if there is no error (WebGL is supported), or returns a string with the error message if WebGL2 is
38
+ * not supported.
39
+ */
40
+ export declare function getWebGLSupportError(): string | null;
41
+ /**
42
+ * Display an error message in the Map div if WebGL2 is not supported
43
+ */
44
+ export declare function displayNoWebGlWarning(container: HTMLElement | string): void;
45
+ /**
46
+ * Display a warning message in the Map div if the WebGL context was lost
47
+ */
48
+ export declare function displayWebGLContextLostWarning(map: MapSDK): void;
49
+ /**
50
+ * In a text-field style property (as an object, not a string) the languages that are specified as
51
+ * ["get", "name:XX"] are replaced by the proved replacer (also an object).
52
+ * This replacement happened regardless of how deep in the object the flag is.
53
+ * Note that it does not replace the occurences of ["get", "name"] (local names)
54
+ */
55
+ export declare function changeFirstLanguage(origExpr: maplibregl.ExpressionSpecification, replacer: maplibregl.ExpressionSpecification, localized: boolean): maplibregl.ExpressionSpecification;
56
+ /**
57
+ * If `localized` is `true`, it checks for the pattern "{name:xx}" (with "xx" being a language iso string).
58
+ * If `localized` is `false`, it check for {name}.
59
+ * In a exact way or is a loose way (such as "foo {name:xx}" or "foo {name} bar")
60
+ */
61
+ export declare function checkNamePattern(str: string, localized: boolean): {
62
+ contains: boolean;
63
+ exactMatch: boolean;
64
+ };
65
+ /**
66
+ * Replaces the occurences of {name:xx} in a string by a provided object-expression to return a concat object expression
67
+ */
68
+ export declare function replaceLanguage(origLang: string, newLang: maplibregl.ExpressionSpecification, localized: boolean): maplibregl.ExpressionSpecification;
69
+ /**
70
+ * Find languages used in string label definition.
71
+ * The returned array contains languages such as "en", "fr" but
72
+ * can also contain null that stand for the use of {name}
73
+ */
74
+ export declare function findLanguageStr(str: string): Array<string | null>;
75
+ /**
76
+ * Find languages used in object label definition.
77
+ * The returned array contains languages such as "en", "fr" but
78
+ * can also contain null that stand for the use of {name}
79
+ */
80
+ export declare function findLanguageObj(origExpr: maplibregl.ExpressionSpecification): Array<string | null>;
81
+ export declare function computeLabelsLocalizationMetrics(layers: maplibregl.LayerSpecification[], map: MapSDK): {
82
+ unlocalized: number;
83
+ localized: Record<string, number>;
84
+ };
@@ -0,0 +1 @@
1
+ export type Unit = "imperial" | "metric" | "nautical";
@@ -0,0 +1,2 @@
1
+ export declare function DOMcreate<K extends keyof HTMLElementTagNameMap>(tagName: K, className?: string, container?: HTMLElement): HTMLElementTagNameMap[K];
2
+ export declare function DOMremove(node: HTMLElement): void;
@@ -0,0 +1,5 @@
1
+ export declare class FetchError extends Error {
2
+ status: number;
3
+ statusText: string;
4
+ constructor(response: Response, resource: string, module: string);
5
+ }
@@ -0,0 +1,6 @@
1
+ import { LngLat } from 'maplibre-gl';
2
+ declare function getAntipode(lngLat: LngLat): {
3
+ lat: number;
4
+ lng: number;
5
+ };
6
+ export { getAntipode };
@@ -0,0 +1 @@
1
+ export * from './dom';
@@ -0,0 +1,8 @@
1
+ import { Vec4 } from './webgl-utils';
2
+ declare function minMax(value: number, min: number, max: number): number;
3
+ declare function normalize(value: number, min: number, max: number): number;
4
+ declare function diagonalOfSquare(side: number): number;
5
+ type Lerpable = [number, number, number, number] | Vec4;
6
+ declare function lerpVec4(a: Lerpable, b: Lerpable, t: number): Vec4;
7
+ declare function lerp(a: number, b: number, t: number): number;
8
+ export { minMax, normalize, diagonalOfSquare, lerpVec4, lerp };
@@ -0,0 +1 @@
1
+ export declare function orderObjectKeys<T extends Record<string, unknown>>(obj?: T): T;
@@ -0,0 +1,49 @@
1
+ export type WebGLContext = WebGLRenderingContext | WebGL2RenderingContext;
2
+ /**
3
+ * Load a shader from a source string
4
+ */
5
+ export declare function loadShader({ gl, type, source }: {
6
+ gl: WebGLContext;
7
+ type: GLenum;
8
+ source: string;
9
+ }): WebGLShader;
10
+ /**
11
+ * Create a set of shaders (vertex and fragment) and link them into a program
12
+ *
13
+ * @param gl WebGL context
14
+ * @param vertexShaderSource Vertex shader source code
15
+ * @param fragmentShaderSource Fragment shader source code
16
+ *
17
+ * @returns WebGL program
18
+ */
19
+ export declare function createShaderProgram({ gl, vertexShaderSource, fragmentShaderSource }: {
20
+ gl: WebGLContext;
21
+ vertexShaderSource: string;
22
+ fragmentShaderSource: string;
23
+ }): WebGLProgram;
24
+ /**
25
+ * null-free version of getUniformLocation
26
+ */
27
+ export declare function getUniformLocation(gl: WebGLRenderingContext | WebGL2RenderingContext, program: WebGLProgram, name: string): WebGLUniformLocation;
28
+ export type Object3D<Attribute extends string, Uniform extends string> = {
29
+ shaderProgram: WebGLProgram;
30
+ programInfo: {
31
+ attributesLocations: Record<Attribute, number>;
32
+ uniformsLocations: Record<Uniform, WebGLUniformLocation>;
33
+ };
34
+ positionBuffer: WebGLBuffer;
35
+ indexBuffer?: WebGLBuffer;
36
+ indexBufferLength?: number;
37
+ };
38
+ export declare function createObject3D<Attribute extends string, Uniform extends string>({ gl, vertexShaderSource, fragmentShaderSource, attributesKeys, uniformsKeys, vertices, indices, }: {
39
+ gl: WebGLContext;
40
+ vertexShaderSource: string;
41
+ fragmentShaderSource: string;
42
+ attributesKeys: readonly Attribute[];
43
+ uniformsKeys: readonly Uniform[];
44
+ vertices: Array<number>;
45
+ indices?: Array<number>;
46
+ }): Object3D<Attribute, Uniform>;
47
+ export type Vec4 = [number, number, number, number];
48
+ export declare function parseColorStringToVec4(color?: string): Vec4;
49
+ export declare function degreesToRadians(degrees: number): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maptiler/sdk",
3
- "version": "3.9.0-rc.4",
3
+ "version": "3.9.0-rc.5",
4
4
  "description": "The Javascript & TypeScript map SDK tailored for MapTiler Cloud",
5
5
  "author": "MapTiler",
6
6
  "module": "dist/maptiler-sdk.mjs",
@@ -86,7 +86,7 @@
86
86
  "vitest": "^3.0.9"
87
87
  },
88
88
  "dependencies": {
89
- "@maplibre/maplibre-gl-style-spec": "~24.2.0",
89
+ "@maplibre/maplibre-gl-style-spec": "~23.3.0",
90
90
  "@maptiler/client": "2.6.0-rc.3",
91
91
  "events": "^3.3.0",
92
92
  "gl-matrix": "^3.4.3",