@maptiler/sdk 3.7.0 → 3.8.0-rc.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.
@@ -0,0 +1,354 @@
1
+ import { DoubleClickZoomHandler, DragPanHandler, EaseToOptions, PointLike, TwoFingersTouchZoomRotateHandler, default as MapLibre } from 'maplibre-gl';
2
+ import { FlyToOptions, MapDataEvent, MapOptions, JumpToOptions, ScrollZoomHandler, BoxZoomHandler, KeyboardHandler, CooperativeGesturesHandler } from '..';
3
+ import { Map } from '../Map';
4
+ export type AllowedConstrcutorOptions = "container" | "apiKey" | "maxZoom" | "minZoom" | "zoom" | "bearing";
5
+ declare const Evented: typeof MapLibre.Evented;
6
+ export type ImageViewerFlyToOptions = Omit<FlyToOptions, "pitch"> & {
7
+ center: [number, number];
8
+ };
9
+ export type ImageViewerJumpToOptions = Omit<JumpToOptions, "pitch"> & {
10
+ center: [number, number];
11
+ };
12
+ export type ImageViewerEaseToOptions = Omit<EaseToOptions, "pitch"> & {
13
+ center: [number, number];
14
+ };
15
+ export type ImageViewerConstructorOptions = Pick<MapOptions, AllowedConstrcutorOptions> & {
16
+ /**
17
+ * The UUID of the image.
18
+ */
19
+ imageUUID: string;
20
+ /**
21
+ * Whether to show debug information.
22
+ */
23
+ debug?: boolean;
24
+ /**
25
+ * The center of the image.
26
+ */
27
+ center?: [number, number];
28
+ /**
29
+ * Whether to show a control to fit the image to the viewport.
30
+ */
31
+ fitToBoundsControl?: boolean;
32
+ /**
33
+ * Whether to show a navigation control.
34
+ */
35
+ navigationControl?: boolean;
36
+ };
37
+ /**
38
+ * The metadata of the image. This is the shape of the response from the API.
39
+ * And used to convert px to lnglat and vice versa.
40
+ */
41
+ export type ImageMetadata = {
42
+ id: string;
43
+ description: string;
44
+ attribution: string;
45
+ width: number;
46
+ height: number;
47
+ minzoom: number;
48
+ maxzoom: number;
49
+ tileSize: number;
50
+ };
51
+ export default class ImageViewer extends Evented {
52
+ /**
53
+ * The UUID of the image.
54
+ *
55
+ * @internal
56
+ */
57
+ private imageUUID;
58
+ /**
59
+ * Whether to enable debug mode.
60
+ *
61
+ * @internal
62
+ */
63
+ private debug;
64
+ /**
65
+ * The metadata of the image.
66
+ *
67
+ * @internal
68
+ */
69
+ private imageMetadata?;
70
+ /**
71
+ * Why not extend the Map class?
72
+ * Because ImageViewer technically operates in screen space and not in map space.
73
+ * We wrap map and perform calculations in screen space.
74
+ * We do not want to have to extend the Map class and give access to
75
+ * methods and properties that operate in LngLat space. *
76
+ */
77
+ private sdk;
78
+ /**
79
+ * The options for the ImageViewer.
80
+ *
81
+ * @internal
82
+ */
83
+ private options;
84
+ /**
85
+ * The size of the image.
86
+ *
87
+ * @internal
88
+ */
89
+ private imageSize?;
90
+ /**
91
+ * The padded size max.
92
+ *
93
+ * @internal
94
+ */
95
+ private paddedSizeMax?;
96
+ /**
97
+ * The version of the ImageViewer / SDK.
98
+ */
99
+ get version(): string;
100
+ /**
101
+ * The constructor for the ImageViewer.
102
+ *
103
+ * @param {Partial<ImageViewerConstructorOptions>} imageViewerConstructorOptions - The options for the ImageViewer.
104
+ * @example
105
+ * ```ts
106
+ * import "@maptiler/sdk/dist/maptiler-sdk.css"; // import css
107
+ * import { ImageViewer } from "@maptiler/sdk"; // import the sdk
108
+ *
109
+ * const imageViewer = new ImageViewer({
110
+ * container: document.getElementById("map"),
111
+ * imageUUID: "01986025-ceb9-7487-9ea6-7a8637dcc1a1",
112
+ * debug: true, // show tile boundaries, padding, collision boxes etc
113
+ * fitToBoundsControl: true, // show a control to fit the image to the viewport
114
+ * navigationControl: true, // show a navigation control
115
+ * center: [0, 0], // center in pixels
116
+ * zoom: 1, // zoom level
117
+ * bearing: 0, // bearing
118
+ * });
119
+ * ```
120
+ */
121
+ constructor(imageViewerConstructorOptions: Partial<ImageViewerConstructorOptions>);
122
+ /**
123
+ * Waits for the ImageViewer to be ready.
124
+ *
125
+ * @returns {Promise<void>}
126
+ */
127
+ onReadyAsync(): Promise<void>;
128
+ shouldFitImageToViewport: boolean;
129
+ /**
130
+ * Initializes the ImageViewer
131
+ * - fetches the image metadata
132
+ * - adds the image source to the sdk instance
133
+ * - sets the center to the middle of the image (if center is not provided)
134
+ * - monkeypatches the maplibre-gl sdk transform method to allow for overpanning and underzooming.
135
+ * - sets up global event forwarding / intercepting from the map instance
136
+ * - sets the center to the middle of the image (if center is not provided)
137
+ *
138
+ * @internal
139
+ * @returns {Promise<void>}
140
+ */
141
+ private init;
142
+ /**
143
+ * Fits the image to the viewport.
144
+ *
145
+ * @param {Object} options - The options for the fit image to viewport.
146
+ * @param {boolean} options.ease - Whether to ease to the viewport bounds.
147
+ */
148
+ fitImageToViewport({ ease }?: {
149
+ ease?: boolean;
150
+ }): void;
151
+ /**
152
+ * Fetches the image metadata from the API.
153
+ *
154
+ * @internal
155
+ * @returns {Promise<void>}
156
+ */
157
+ private fetchImageMetadata;
158
+ /**
159
+ * Adds the image source to the sdk instance.
160
+ *
161
+ * @internal
162
+ * @returns {void}
163
+ */
164
+ private addImageSource;
165
+ /**
166
+ * Triggers a repaint of the ImageViewer. Same as map.triggerRepaint().
167
+ *
168
+ * @internal
169
+ * @returns {void}
170
+ */
171
+ triggerRepaint(): void;
172
+ /**
173
+ * The scroll zoom handler.
174
+ *
175
+ * @internal
176
+ * @returns {ScrollZoomHandler}
177
+ */
178
+ get scrollZoom(): ScrollZoomHandler;
179
+ /**
180
+ * The scroll zoom handler.
181
+ *
182
+ * @internal
183
+ * @param {ScrollZoomHandler} value - The scroll zoom handler.
184
+ */
185
+ set scrollZoom(value: ScrollZoomHandler);
186
+ /**
187
+ * The box zoom handler.
188
+ *
189
+ * @internal
190
+ * @returns {BoxZoomHandler}
191
+ */
192
+ get boxZoom(): BoxZoomHandler;
193
+ /**
194
+ * The box zoom handler.
195
+ *
196
+ * @internal
197
+ * @param {BoxZoomHandler} value - The box zoom handler.
198
+ */
199
+ set boxZoom(value: BoxZoomHandler);
200
+ /**
201
+ * The drag pan handler.
202
+ *
203
+ * @internal
204
+ * @returns {DragPanHandler}
205
+ */
206
+ get dragPan(): DragPanHandler;
207
+ /**
208
+ * The drag pan handler.
209
+ *
210
+ * @internal
211
+ * @param {DragPanHandler} value - The drag pan handler.
212
+ */
213
+ set dragPan(value: DragPanHandler);
214
+ /**
215
+ * The keyboard handler.
216
+ *
217
+ * @internal
218
+ * @returns {KeyboardHandler}
219
+ */
220
+ get keyboard(): KeyboardHandler;
221
+ /**
222
+ * The keyboard handler.
223
+ *
224
+ * @internal
225
+ * @param {KeyboardHandler} value - The keyboard handler.
226
+ */
227
+ set keyboard(value: KeyboardHandler);
228
+ /**
229
+ * The double click zoom handler.
230
+ *
231
+ * @internal
232
+ * @returns {DoubleClickZoomHandler}
233
+ */
234
+ get doubleClickZoom(): DoubleClickZoomHandler;
235
+ /**
236
+ * The double click zoom handler.
237
+ *
238
+ * @internal
239
+ * @param {DoubleClickZoomHandler} value - The double click zoom handler.
240
+ */
241
+ set doubleClickZoom(value: DoubleClickZoomHandler);
242
+ /**
243
+ * The touch zoom rotate handler.
244
+ *
245
+ * @internal
246
+ * @returns {TwoFingersTouchZoomRotateHandler}
247
+ */
248
+ get touchZoomRotate(): TwoFingersTouchZoomRotateHandler;
249
+ /**
250
+ * The touch zoom rotate handler.
251
+ *
252
+ * @internal
253
+ * @param {TwoFingersTouchZoomRotateHandler} value - The touch zoom rotate handler.
254
+ */
255
+ set touchZoomRotate(value: TwoFingersTouchZoomRotateHandler);
256
+ /**
257
+ * The cooperative gestures handler.
258
+ *
259
+ * @internal
260
+ * @returns {CooperativeGesturesHandler}
261
+ */
262
+ get cooperativeGestures(): CooperativeGesturesHandler;
263
+ /**
264
+ * The cooperative gestures handler.
265
+ *
266
+ * @internal
267
+ * @param {CooperativeGesturesHandler} value - The cooperative gestures handler.
268
+ */
269
+ set cooperativeGestures(value: CooperativeGesturesHandler);
270
+ /**
271
+ * Converts a LngLat to a px coordinate, based on the image metadata.
272
+ *
273
+ * @internal
274
+ * @param {LngLat} lngLat - The LngLat to convert.
275
+ * @returns {[number, number]} The px coordinate.
276
+ */
277
+ private lngLatToPx;
278
+ /**
279
+ * Converts a px coordinate to a LngLat, based on the image metadata.
280
+ *
281
+ * @internal
282
+ * @param {LngLat} lngLat - The LngLat to convert.
283
+ * @returns {[number, number]} The px coordinate.
284
+ */
285
+ private pxToLngLat;
286
+ /**
287
+ * Fly to a given center.
288
+ *
289
+ * @param {ImageViewerFlyToOptions} options - The options for the fly to.
290
+ * @param {MapDataEvent} eventData - The event data.
291
+ */
292
+ flyTo(options: ImageViewerFlyToOptions, eventData?: MapDataEvent): Map;
293
+ /**
294
+ * Jump to a given center.
295
+ *
296
+ * @param {ImageViewerJumpToOptions} options - The options for the jump to.
297
+ * @param {MapDataEvent} eventData - The event data.
298
+ */
299
+ jumpTo(options: ImageViewerJumpToOptions, eventData?: MapDataEvent): Map;
300
+ /**
301
+ * Set the zoom level.
302
+ *
303
+ * @param {number} zoom - The zoom level.
304
+ */
305
+ setZoom(zoom: number): void;
306
+ /**
307
+ * Get the zoom level.
308
+ *
309
+ * @returns {number} The zoom level.
310
+ */
311
+ getZoom(): number;
312
+ /**
313
+ * Get the center of the ImageViewer in pixels.
314
+ *
315
+ * @internal
316
+ * @returns {[number, number]} The center of the ImageViewer.
317
+ */
318
+ getCenter(): [number, number];
319
+ /**
320
+ * Set the center of the ImageViewer in pixels.
321
+ *
322
+ * @param {number} center - The center of the ImageViewer.
323
+ */
324
+ setCenter(center: [number, number]): void;
325
+ /**
326
+ * Set the bearing of the ImageViewer in degrees.
327
+ *
328
+ * @param {number} bearing - The bearing of the ImageViewer.
329
+ */
330
+ setBearing(bearing: number): void;
331
+ /**
332
+ * Get the bearing of the ImageViewer in degrees.
333
+ *
334
+ * @returns {number} The bearing of the ImageViewer.
335
+ */
336
+ getBearing(): number;
337
+ /**
338
+ * Pan by a given delta in pixels.
339
+ *
340
+ * @param {PointLike} delta - The delta to pan by.
341
+ * @param {ImageViewerEaseToOptions} options - The options for the pan.
342
+ * @param {any} eventData - The event data.
343
+ */
344
+ panBy(delta: PointLike, options?: ImageViewerEaseToOptions, eventData?: any): void;
345
+ /**
346
+ * Pan to a given center in pixels.
347
+ *
348
+ * @param {number} center - The center to pan to.
349
+ * @param {ImageViewerEaseToOptions} options - The options for the pan.
350
+ * @param {any} eventData - The event data.
351
+ */
352
+ panTo(center: [number, number], options?: ImageViewerEaseToOptions, eventData?: any): void;
353
+ }
354
+ export {};
@@ -0,0 +1,44 @@
1
+ import { Map } from '../Map';
2
+ import { default as ImageViewer } from './ImageViewer';
3
+ import { LngLat } from 'maplibre-gl';
4
+ export declare class ImageViewerEvent {
5
+ readonly type: string;
6
+ readonly target: ImageViewer;
7
+ readonly originalEvent: MouseEvent | TouchEvent | WheelEvent | WebGLContextEvent | null;
8
+ [key: string]: any;
9
+ constructor(type: string, viewer: ImageViewer, originalEvent?: MouseEvent | TouchEvent | WheelEvent | WebGLContextEvent | null, data?: Record<string, any>);
10
+ }
11
+ declare const BASE_MAP_EVENT_TYPES: readonly ["idle", "render", "load", "remove", "idle"];
12
+ declare const ERROR_EVENTS: readonly ["error"];
13
+ declare const RESIZE_EVENTS: readonly ["resize"];
14
+ declare const WEBGL_CONTEXT_EVENTS: readonly ["webglcontextlost", "webglcontextrestored"];
15
+ declare const CAMERA_EVENTS: readonly ["moveend", "movestart", "move", "zoomend", "zoomstart", "zoom", "rotatestart", "rotateend", "rotate", "dragstart", "dragend", "drag", "boxzoomcancel", "boxzoomend", "boxzoomstart"];
16
+ declare const UI_EVENTS: readonly ["click", "dblclick", "mousedown", "mouseup", "mousemove", "mouseout", "mouseover", "contextmenu", "touchstart", "touchend", "touchmove", "touchcancel"];
17
+ declare const COOPERATIVE_GESTURE_EVENTS: readonly ["cooperativegestureprevented"];
18
+ declare const DATA_EVENTS: readonly ["data", "dataloading", "sourcedata", "sourcedataloading", "dataabort", "sourcedataabort"];
19
+ export declare const IMAGE_VIEWER_EVENT_TYPES: ("data" | "error" | "load" | "idle" | "remove" | "render" | "resize" | "webglcontextlost" | "webglcontextrestored" | "dataloading" | "sourcedataloading" | "sourcedata" | "dataabort" | "sourcedataabort" | "boxzoomcancel" | "boxzoomstart" | "boxzoomend" | "touchcancel" | "touchmove" | "touchend" | "touchstart" | "click" | "contextmenu" | "dblclick" | "mousemove" | "mouseup" | "mousedown" | "mouseout" | "mouseover" | "movestart" | "move" | "moveend" | "zoomstart" | "zoom" | "zoomend" | "rotatestart" | "rotate" | "rotateend" | "dragstart" | "drag" | "dragend" | "cooperativegestureprevented")[];
20
+ type BaseMapEventKeys = (typeof BASE_MAP_EVENT_TYPES)[number];
21
+ type UiEventKeys = (typeof UI_EVENTS)[number];
22
+ type CameraEventKeys = (typeof CAMERA_EVENTS)[number];
23
+ type ErrorEventKeys = (typeof ERROR_EVENTS)[number];
24
+ type ResizeEventKeys = (typeof RESIZE_EVENTS)[number];
25
+ type WebglContextEventKeys = (typeof WEBGL_CONTEXT_EVENTS)[number];
26
+ type DataEventKeys = (typeof DATA_EVENTS)[number];
27
+ type CooperativeGestureEventKeys = (typeof COOPERATIVE_GESTURE_EVENTS)[number];
28
+ export type ImageViewerEventTypes = BaseMapEventKeys | UiEventKeys | CameraEventKeys | ErrorEventKeys | ResizeEventKeys | WebglContextEventKeys | DataEventKeys | CooperativeGestureEventKeys | "imageviewerready" | "imagevieweriniterror";
29
+ type LngLatToPixel = (lngLat: LngLat) => [number, number];
30
+ interface SetupGlobalMapEventForwarderOptions {
31
+ map: Map;
32
+ viewer: ImageViewer;
33
+ lngLatToPx: LngLatToPixel;
34
+ }
35
+ /**
36
+ * Sets up event forwarding from Map to ImageViewer with proper categorization
37
+ * @param {SetupGlobalMapEventForwarderOptions} options - The options for setting up the event forwarder.
38
+ * @param {Map} options.map - The map to forward events from.
39
+ * @param {ImageViewer} options.viewer - The viewer to forward events to.
40
+ * @param {LngLatToPixel} options.lngLatToPx - A function to convert LngLat to pixel coordinates.
41
+ * @returns {void}
42
+ */
43
+ export declare function setupGlobalMapEventForwarder({ map, viewer, lngLatToPx }: SetupGlobalMapEventForwarderOptions): void;
44
+ export {};
@@ -0,0 +1,4 @@
1
+ export { default as ImageViewer } from './ImageViewer';
2
+ export type { ImageViewerEventTypes } from './events';
3
+ export type { ImageViewerConstructorOptions, ImageViewerFlyToOptions, ImageViewerJumpToOptions, ImageMetadata } from './ImageViewer';
4
+ export { ImageViewerEvent } from './events';
@@ -0,0 +1,4 @@
1
+ import { LngLat, Point } from '../index';
2
+ import { Map } from '../Map';
3
+ export declare function unprojectFromWorldCoordinates(worldSize: number, point: Point): LngLat;
4
+ export declare function monkeyPatchMapTransformInstance(instance: Map): void;
package/dist/src/Map.d.ts CHANGED
@@ -90,6 +90,10 @@ export type MapOptions = Omit<MapOptionsML, "style" | "maplibreLogo"> & {
90
90
  * Show the full screen control. (default: `false`, will show if `true`)
91
91
  */
92
92
  fullscreenControl?: boolean | ControlPosition;
93
+ /**
94
+ * Detect custom external controls. (default: `false`, will detect automatically if `true`)
95
+ */
96
+ customControls?: boolean | string;
93
97
  /**
94
98
  * Display a minimap in a user defined corner of the map. (default: `bottom-left` corner)
95
99
  * If set to true, the map will assume it is a minimap and forego the attribution control.
@@ -151,7 +155,33 @@ export declare class Map extends maplibregl.Map {
151
155
  * If an option is not set it will internally revert to the default option
152
156
  * unless explicitly set when calling.
153
157
  */
154
- setSpace(space: CubemapDefinition): void;
158
+ setSpace(space: CubemapDefinition | boolean): void;
159
+ /**
160
+ * Enables the animations for the space layer.
161
+ */
162
+ enableSpaceAnimations(): void;
163
+ /**
164
+ * Disables the animations for the space layer.
165
+ */
166
+ disableSpaceAnimations(): void;
167
+ /**
168
+ * Enables the animations for the halo layer.
169
+ */
170
+ enableHaloAnimations(): void;
171
+ /**
172
+ * Disables the animations for the halo layer.
173
+ */
174
+ disableHaloAnimations(): void;
175
+ /**
176
+ * Sets whether the halo layer should be animated in and out.
177
+ * @param active - Whether the animation should be active.
178
+ */
179
+ setHaloAnimationActive(active: boolean): void;
180
+ /**
181
+ * Sets whether the space layer should be animated in and out.
182
+ * @param active - Whether the animation should be active.
183
+ */
184
+ setSpaceAnimationActive(active: boolean): void;
155
185
  private setSpaceFromStyle;
156
186
  private setHaloFromStyle;
157
187
  private initSpace;
@@ -5,6 +5,7 @@ import { Map as MapSDK } from './Map';
5
5
  export declare class Telemetry {
6
6
  private map;
7
7
  private registeredModules;
8
+ private viewerType;
8
9
  /**
9
10
  *
10
11
  * @param map : a Map instance
@@ -17,5 +18,6 @@ export declare class Telemetry {
17
18
  * of each module.
18
19
  */
19
20
  registerModule(name: string, version: string): void;
21
+ registerViewerType(viewerType?: string): void;
20
22
  private preparePayload;
21
23
  }
@@ -0,0 +1,13 @@
1
+ import { IControl } from 'maplibre-gl';
2
+ import { ImageViewer } from '../ImageViewer';
3
+ import { Map as MapSDK } from '../Map';
4
+ export declare class ImageViewerFitImageToBoundsControl implements IControl {
5
+ private viewer;
6
+ private container;
7
+ constructor({ imageViewer }: {
8
+ imageViewer: ImageViewer;
9
+ });
10
+ handleClick: () => void;
11
+ onAdd(_map: MapSDK): HTMLElement;
12
+ onRemove(): void;
13
+ }
@@ -0,0 +1,17 @@
1
+ import { Map as SDKMap } from '../Map';
2
+ import { IControl, MapLibreEvent } from 'maplibre-gl';
3
+ export type MaptilerCustomControlCallback<E> = (map: SDKMap, element: HTMLElement, event: E) => void;
4
+ /**
5
+ * The MaptilerCustomControl allows any existing element to become a map control.
6
+ */
7
+ export declare class MaptilerCustomControl implements IControl {
8
+ #private;
9
+ /**
10
+ * @param selectorOrElement Element to be used as control, specified as either reference to element itself or a CSS selector to find the element in DOM
11
+ * @param onClick Function called when the element is clicked
12
+ * @param onRender Function called every time the underlying map renders a new state
13
+ */
14
+ constructor(selectorOrElement: string | HTMLElement, onClick?: MaptilerCustomControlCallback<Event>, onRender?: MaptilerCustomControlCallback<MapLibreEvent>);
15
+ onAdd(map: SDKMap): HTMLElement;
16
+ onRemove(): void;
17
+ }
@@ -0,0 +1,25 @@
1
+ import { Map as SDKMap } from '../Map';
2
+ import { IControl } from 'maplibre-gl';
3
+ import { MaptilerCustomControl, MaptilerCustomControlCallback } from './MaptilerCustomControl';
4
+ export type MaptilerExternalControlType = "zoom-in" | "zoom-out" | "toggle-projection" | "toggle-terrain" | "reset-view" | "reset-bearing" | "reset-pitch" | "reset-roll";
5
+ /**
6
+ * The MaptilerExternalControl allows any existing element to automatically become a map control. Used for detected controls if `customControls` config is turned on.
7
+ */
8
+ export declare class MaptilerExternalControl extends MaptilerCustomControl implements IControl {
9
+ #private;
10
+ static controlCallbacks: Record<MaptilerExternalControlType, MaptilerCustomControlCallback<Event>>;
11
+ /**
12
+ * Constructs an instance of External Control to have a predefined functionality
13
+ * @param controlElement Element to be used as control, specified as reference to element itself
14
+ * @param controlType One of the predefined types of functionality
15
+ */
16
+ constructor(controlElement: HTMLElement, controlType?: MaptilerExternalControlType);
17
+ onAdd(map: SDKMap): HTMLElement;
18
+ onRemove(): void;
19
+ /**
20
+ * Configure a child element to be part of this control and to have a predefined functionality added
21
+ * @param controlElement Element that is a descendant of the control element and that optionally should have some functionality
22
+ * @param controlType One of the predefined types of functionality
23
+ */
24
+ configureGroupItem(controlElement: HTMLElement, controlType: MaptilerExternalControlType | undefined): void;
25
+ }
@@ -12,3 +12,4 @@ export declare class MaptilerProjectionControl implements IControl {
12
12
  private toggleProjection;
13
13
  private updateProjectionIcon;
14
14
  }
15
+ export declare function toggleProjection(map: SDKMap): void;
@@ -14,3 +14,4 @@ export declare class MaptilerTerrainControl implements IControl {
14
14
  _toggleTerrain(): void;
15
15
  _updateTerrainIcon(): void;
16
16
  }
17
+ export declare function toggleTerrain(map: SDKMap): void;
@@ -1,3 +1,5 @@
1
+ export * from './MaptilerCustomControl';
2
+ export * from './MaptilerExternalControl';
1
3
  export * from './MaptilerGeolocateControl';
2
4
  export * from './MaptilerLogoControl';
3
5
  export * from './MaptilerTerrainControl';
@@ -96,6 +96,7 @@ declare class CubemapLayer implements CustomLayerInterface {
96
96
  * @private
97
97
  */
98
98
  private options;
99
+ private animationActive;
99
100
  /**
100
101
  * Creates a new instance of CubemapLayer
101
102
  *
@@ -186,6 +187,7 @@ declare class CubemapLayer implements CustomLayerInterface {
186
187
  * @private
187
188
  */
188
189
  private animateOut;
190
+ setAnimationActive(active: boolean): void;
189
191
  /**
190
192
  * Renders the cubemap layer to the WebGL context.
191
193
  * This method is called internally during the rendering phase of the map.
@@ -214,7 +216,7 @@ declare class CubemapLayer implements CustomLayerInterface {
214
216
  * and if so, it updates the cubemap faces.
215
217
  * Finally, it calls `updateCubemap` to apply the changes and trigger a repaint of the map.
216
218
  */
217
- setCubemap(cubemap: CubemapDefinition): Promise<void>;
219
+ setCubemap(spec: CubemapDefinition | boolean): Promise<void>;
218
220
  /**
219
221
  * Shows the cubemap layer by setting its visibility to "visible".
220
222
  * This method is used to make the cubemap layer visible on the map.
@@ -226,5 +228,5 @@ declare class CubemapLayer implements CustomLayerInterface {
226
228
  */
227
229
  hide(): void;
228
230
  }
229
- export declare function validateSpaceSpecification(space: CubemapDefinition | boolean): boolean;
231
+ export declare function validateSpaceSpecification(space?: CubemapDefinition | boolean): boolean;
230
232
  export { CubemapLayer };
@@ -67,6 +67,12 @@ export declare class RadialGradientLayer implements CustomLayerInterface {
67
67
  * @type {Object3D<(typeof ATTRIBUTES_KEYS)[number], (typeof UNIFORMS_KEYS)[number]>}
68
68
  */
69
69
  private plane?;
70
+ /**
71
+ * Whether the halo should be animated in and out.
72
+ * @private
73
+ * @type {boolean}
74
+ */
75
+ private animationActive;
70
76
  /**
71
77
  * Creates a new RadialGradientLayer instance.
72
78
  *
@@ -128,7 +134,8 @@ export declare class RadialGradientLayer implements CustomLayerInterface {
128
134
  * @param {GradientDefinition} gradient - The new gradient definition to set for this layer.
129
135
  * @returns {Promise<void>} A promise that resolves when the new gradient is set and animated in.
130
136
  */
131
- setGradient(gradient: GradientDefinition): Promise<void>;
137
+ setGradient(gradient: GradientDefinition | boolean): Promise<void>;
138
+ setAnimationActive(active: boolean): void;
132
139
  show(): void;
133
140
  hide(): void;
134
141
  }
@@ -78,6 +78,7 @@ export { MapMouseEvent } from './MLAdapters/MapMouseEvent';
78
78
  export { Map, GeolocationType, type MapOptions, type LoadWithTerrainEvent } from './Map';
79
79
  export * from './controls';
80
80
  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, canParsePixelData, } from '@maptiler/client';
81
+ export * from './ImageViewer';
81
82
  export { getWebGLSupportError, displayWebGLContextLostWarning } from './tools';
82
83
  export { config, SdkConfig } from './config';
83
84
  export * from './language';
@@ -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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maptiler/sdk",
3
- "version": "3.7.0",
3
+ "version": "3.8.0-rc.9",
4
4
  "description": "The Javascript & TypeScript map SDK tailored for MapTiler Cloud",
5
5
  "author": "MapTiler",
6
6
  "module": "dist/maptiler-sdk.mjs",
@@ -86,11 +86,14 @@
86
86
  "vitest": "^3.0.9"
87
87
  },
88
88
  "dependencies": {
89
+ "@koa/cors": "^5.0.0",
90
+ "@koa/router": "^13.1.1",
89
91
  "@maplibre/maplibre-gl-style-spec": "~23.3.0",
90
- "@maptiler/client": "~2.5.0",
92
+ "@maptiler/client": "~2.5.1",
91
93
  "events": "^3.3.0",
92
94
  "gl-matrix": "^3.4.3",
93
95
  "js-base64": "^3.7.7",
96
+ "koa": "^3.0.0",
94
97
  "maplibre-gl": "~5.6.0",
95
98
  "uuid": "^11.0.5"
96
99
  }
@@ -1,4 +1,3 @@
1
1
  import ImageData from "@canvas/image-data";
2
-
3
2
  // @ts-expect-error: Global type missing
4
3
  global.ImageData = ImageData;