@maptiler/sdk 3.8.0 → 3.9.0-rc.1

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.
@@ -1,8 +1,10 @@
1
- import { DoubleClickZoomHandler, DragPanHandler, EaseToOptions, PointLike, TwoFingersTouchZoomRotateHandler, default as MapLibre } from 'maplibre-gl';
2
- import { FlyToOptions, MapDataEvent, MapOptions, JumpToOptions, ScrollZoomHandler, BoxZoomHandler, KeyboardHandler, CooperativeGesturesHandler } from '..';
1
+ import { default as MaplibreGL } from 'maplibre-gl';
2
+ import { EaseToOptions, DoubleClickZoomHandler, DragPanHandler, TwoFingersTouchZoomRotateHandler, FlyToOptions, MapOptions, JumpToOptions, ScrollZoomHandler, BoxZoomHandler, KeyboardHandler, CooperativeGesturesHandler, LngLat, MapDataEvent, PointLike } from '..';
3
3
  import { Map } from '../Map';
4
+ import { ImageViewerFitImageToBoundsControl } from '../controls/ImageViewerFitImageToBoundsControl';
5
+ import { lngLatToPxInternalSymbolKey, pxToLngLatInternalSymbolKey, sdkSymbolKey } from './symbols';
6
+ declare const Evented: typeof MaplibreGL.Evented;
4
7
  export type AllowedConstrcutorOptions = "container" | "apiKey" | "maxZoom" | "minZoom" | "zoom" | "bearing";
5
- declare const Evented: typeof MapLibre.Evented;
6
8
  export type ImageViewerFlyToOptions = Omit<FlyToOptions, "pitch"> & {
7
9
  center: [number, number];
8
10
  };
@@ -64,7 +66,6 @@ export default class ImageViewer extends Evented {
64
66
  /**
65
67
  * The metadata of the image.
66
68
  *
67
- * @internal
68
69
  */
69
70
  private imageMetadata?;
70
71
  /**
@@ -74,7 +75,7 @@ export default class ImageViewer extends Evented {
74
75
  * We do not want to have to extend the Map class and give access to
75
76
  * methods and properties that operate in LngLat space. *
76
77
  */
77
- private sdk;
78
+ [sdkSymbolKey]: Map;
78
79
  /**
79
80
  * The options for the ImageViewer.
80
81
  *
@@ -97,6 +98,10 @@ export default class ImageViewer extends Evented {
97
98
  * The version of the ImageViewer / SDK.
98
99
  */
99
100
  get version(): string;
101
+ /**
102
+ * The control to fit the image to the viewport.
103
+ */
104
+ fitToBoundsControlInstance: ImageViewerFitImageToBoundsControl;
100
105
  /**
101
106
  * The constructor for the ImageViewer.
102
107
  *
@@ -288,21 +293,24 @@ export default class ImageViewer extends Evented {
288
293
  *
289
294
  * @param {ImageViewerFlyToOptions} options - The options for the fly to.
290
295
  * @param {MapDataEvent} eventData - The event data.
296
+ * @returns {ImageViewer} The ImageViewer instance.
291
297
  */
292
- flyTo(options: ImageViewerFlyToOptions, eventData?: MapDataEvent): Map;
298
+ flyTo(options: ImageViewerFlyToOptions, eventData?: MapDataEvent): this;
293
299
  /**
294
300
  * Jump to a given center.
295
301
  *
296
302
  * @param {ImageViewerJumpToOptions} options - The options for the jump to.
297
303
  * @param {MapDataEvent} eventData - The event data.
304
+ * @returns {ImageViewer} The ImageViewer instance.
298
305
  */
299
- jumpTo(options: ImageViewerJumpToOptions, eventData?: MapDataEvent): Map;
306
+ jumpTo(options: ImageViewerJumpToOptions, eventData?: MapDataEvent): this;
300
307
  /**
301
308
  * Set the zoom level.
302
309
  *
303
310
  * @param {number} zoom - The zoom level.
311
+ * @returns {ImageViewer} The ImageViewer instance.
304
312
  */
305
- setZoom(zoom: number): void;
313
+ setZoom(zoom: number): this;
306
314
  /**
307
315
  * Get the zoom level.
308
316
  *
@@ -320,14 +328,16 @@ export default class ImageViewer extends Evented {
320
328
  * Set the center of the ImageViewer in pixels.
321
329
  *
322
330
  * @param {number} center - The center of the ImageViewer.
331
+ * @returns {ImageViewer} The ImageViewer instance.
323
332
  */
324
- setCenter(center: [number, number]): void;
333
+ setCenter(center: [number, number]): this;
325
334
  /**
326
335
  * Set the bearing of the ImageViewer in degrees.
327
336
  *
328
337
  * @param {number} bearing - The bearing of the ImageViewer.
338
+ * @returns {ImageViewer} The ImageViewer instance.
329
339
  */
330
- setBearing(bearing: number): void;
340
+ setBearing(bearing: number): this;
331
341
  /**
332
342
  * Get the bearing of the ImageViewer in degrees.
333
343
  *
@@ -340,15 +350,46 @@ export default class ImageViewer extends Evented {
340
350
  * @param {PointLike} delta - The delta to pan by.
341
351
  * @param {ImageViewerEaseToOptions} options - The options for the pan.
342
352
  * @param {any} eventData - The event data.
353
+ * @returns {ImageViewer} The ImageViewer instance.
343
354
  */
344
- panBy(delta: PointLike, options?: ImageViewerEaseToOptions, eventData?: any): void;
355
+ panBy(delta: PointLike, options?: ImageViewerEaseToOptions, eventData?: any): this;
345
356
  /**
346
357
  * Pan to a given center in pixels.
347
358
  *
348
359
  * @param {number} center - The center to pan to.
349
360
  * @param {ImageViewerEaseToOptions} options - The options for the pan.
350
361
  * @param {any} eventData - The event data.
362
+ * @returns {ImageViewer} The ImageViewer instance.
363
+ */
364
+ panTo(center: [number, number], options?: ImageViewerEaseToOptions, eventData?: any): this;
365
+ /**
366
+ * Get the image metadata.
367
+ *
368
+ * @returns {ImageMetadata} The image metadata.
369
+ */
370
+ getImageMetadata(): ImageMetadata | undefined;
371
+ /**
372
+ * Get the visible bounds of the image in the viewport in imagePixels.
373
+ * [topLeft, bottomRight]
374
+ *
375
+ * @returns {[[number, number], [number, number]]} The visible bounds of the image.
376
+ */
377
+ getImageBounds(): number[][];
378
+ /**
379
+ * Set the bounds of the image.
380
+ *
381
+ * @param {[[number, number], [number, number]]} bounds - The bounds of the image.
382
+ * @returns {ImageViewer} The ImageViewer instance.
383
+ */
384
+ fitImageBounds([tl, br]: [[number, number], [number, number]]): this;
385
+ /**
386
+ * Destroys the ImageViewer, removes the map instance and all event listeners. Useful for cleanup.
387
+ *
388
+ * @returns {ImageViewer} The ImageViewer instance.
351
389
  */
352
- panTo(center: [number, number], options?: ImageViewerEaseToOptions, eventData?: any): void;
390
+ remove(): void;
391
+ pointIsWithinImageBounds(px: [number, number]): boolean;
392
+ [lngLatToPxInternalSymbolKey]: (lngLat: LngLat) => [number, number];
393
+ [pxToLngLatInternalSymbolKey]: (px: [number, number]) => LngLat;
353
394
  }
354
395
  export {};
@@ -0,0 +1,236 @@
1
+ import { Alignment, Subscription, MarkerOptions, PointLike, Popup } from '../index';
2
+ import { default as MapLibreGL } from 'maplibre-gl';
3
+ import { default as ImageViewer } from './ImageViewer';
4
+ declare const Evented: typeof MapLibreGL.Evented;
5
+ export type ImageViewerMarkerOptions = MarkerOptions & {};
6
+ export interface ImageViewerMarkerInterface {
7
+ on(event: MarkerEventTypes, listener: (e: ImageViewerMarkerEvent) => void): Subscription;
8
+ off(event: MarkerEventTypes, listener: (e: ImageViewerMarkerEvent) => void): void;
9
+ fire(event: ImageViewerMarkerEvent): void;
10
+ getPosition(): [number, number];
11
+ getOffset(): PointLike;
12
+ getPitchAlignment(): Alignment;
13
+ getPopup(): Popup;
14
+ getRotation(): number;
15
+ getRotationAlignment(): Alignment;
16
+ isDraggable(): boolean;
17
+ remove(): void;
18
+ removeClassName(className: string): void;
19
+ setDraggable(draggable: boolean): void;
20
+ setPosition(px: [number, number]): void;
21
+ setOffset(offset: PointLike): void;
22
+ setOpacity(opacity?: string, opacityWhenCovered?: string): void;
23
+ setPitchAlignment(pitchAlignment: Alignment): void;
24
+ setPopup(popup: Popup): void;
25
+ setRotation(rotation: number): void;
26
+ setRotationAlignment(rotationAlignment: Alignment): void;
27
+ setSubpixelPositioning(subpixelPositioning: boolean): void;
28
+ toggleClassName(className: string): void;
29
+ togglePopup(): void;
30
+ }
31
+ export declare class ImageViewerMarker extends Evented {
32
+ private viewer;
33
+ private readonly marker;
34
+ private readonly position;
35
+ constructor({ ...markerOptions }: ImageViewerMarkerOptions);
36
+ /**
37
+ * Adds the ImageViewerMarker to an instance of ImageViewer.
38
+ *
39
+ * @param {ImageViewer} viewer - The instance of ImageViewer to add the ImageViewerMarker to.
40
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
41
+ */
42
+ addTo(viewer: ImageViewer): this;
43
+ /**
44
+ * Adds a class name to the ImageViewerMarker.
45
+ *
46
+ * @param {string} className - The class name to add to the ImageViewerMarker.
47
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
48
+ */
49
+ addClassName(className: string): this;
50
+ /**
51
+ * Gets the element of the ImageViewerMarker.
52
+ *
53
+ * @returns {HTMLElement} The element of the ImageViewerMarker.
54
+ */
55
+ getElement(): HTMLElement;
56
+ /**
57
+ * Gets the position of the ImageViewerMarker.
58
+ *
59
+ * @returns {PointLike} The position of the ImageViewerMarker.
60
+ * @see [PointLike](https://docs.maptiler.com/sdk-js/api/geography/#pointlike)
61
+ *
62
+ */
63
+ getPosition(): [number, number];
64
+ /**
65
+ * Gets the offset of the ImageViewerMarker.
66
+ *
67
+ * @returns {PointLike} The offset of the ImageViewerMarker.
68
+ * @see [PointLike](https://docs.maptiler.com/sdk-js/api/geography/#pointlike)
69
+ */
70
+ getOffset(): MapLibreGL.Point;
71
+ /**
72
+ * Gets the pitch alignment of the ImageViewerMarker.
73
+ *
74
+ * @returns {Alignment} The pitch alignment of the ImageViewerMarker.
75
+ * @see [MapLibreGL.Alignment](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/Alignment/)
76
+ */
77
+ getPitchAlignment(): Alignment;
78
+ /**
79
+ * Gets the popup of the ImageViewerMarker.
80
+ *
81
+ * @returns {Popup} The popup of the ImageViewerMarker.
82
+ * @see [Popup](https://docs.maptiler.com/sdk-js/api/markers/#popup)
83
+ */
84
+ getPopup(): MapLibreGL.Popup;
85
+ /**
86
+ * Gets the rotation of the ImageViewerMarker.
87
+ *
88
+ * @returns {number} The rotation of the ImageViewerMarker.
89
+ */
90
+ getRotation(): number;
91
+ /**
92
+ * Gets the rotation alignment of the ImageViewerMarker.
93
+ *
94
+ * @returns {Alignment} The rotation alignment of the ImageViewerMarker.
95
+ * @see [MapLibreGL.Alignment](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/Alignment/)
96
+ */
97
+ getRotationAlignment(): Alignment;
98
+ /**
99
+ * Checks if the ImageViewerMarker is draggable.
100
+ *
101
+ * @returns {boolean} True if the ImageViewerMarker is draggable, false otherwise.
102
+ */
103
+ isDraggable(): boolean;
104
+ /**
105
+ * Fires an event on the ImageViewerMarker.
106
+ *
107
+ * @param {MarkerEventTypes | Event} event - The event to fire.
108
+ * @param {Record<string, any>} data - The data to fire the event with.
109
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
110
+ */
111
+ fire(event: MarkerEventTypes | Event, data?: Record<string, any>): this;
112
+ /**
113
+ * Removes an event listener from the ImageViewerMarker.
114
+ *
115
+ * @param {MarkerEventTypes} event - The event to remove the listener from.
116
+ * @param {ImageViewerMarkerEvent} listener - The listener to remove.
117
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
118
+ */
119
+ off(event: MarkerEventTypes, listener: (e: ImageViewerMarkerEvent) => void): this;
120
+ /**
121
+ * Adds an event listener to the ImageViewerMarker.
122
+ *
123
+ * @param {MarkerEventTypes} event - The event to add the listener to.
124
+ * @param {ImageViewerMarkerEvent} listener - The listener to add.
125
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
126
+ */
127
+ on(event: MarkerEventTypes, listener: (e: ImageViewerMarkerEvent) => void): Subscription;
128
+ /**
129
+ * Checks if the ImageViewerMarker is within the image bounds.
130
+ *
131
+ * @returns {boolean} True if the ImageViewerMarker is within the image bounds, false otherwise.
132
+ */
133
+ isWithinImageBounds(): boolean;
134
+ /**
135
+ * Removes the ImageViewerMarker from the ImageViewer and cleans up the event listeners.
136
+ *
137
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
138
+ */
139
+ remove(): this;
140
+ /**
141
+ * Removes a class name from the ImageViewerMarker dom element.
142
+ *
143
+ * @param {string} className - The class name to remove from the ImageViewerMarker.
144
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
145
+ */
146
+ removeClassName(className: string): this;
147
+ /**
148
+ * Sets the draggable state of the ImageViewerMarker.
149
+ *
150
+ * @param {boolean} draggable - The draggable state of the ImageViewerMarker.
151
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
152
+ */
153
+ setDraggable(draggable: boolean): this;
154
+ /**
155
+ * Sets the position of the ImageViewerMarker.
156
+ *
157
+ * @param {[number, number]} px - The position of the ImageViewerMarker in image pixels.
158
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
159
+ */
160
+ setPosition(px: [number, number]): this;
161
+ /**
162
+ * Sets the offset of the ImageViewerMarker.
163
+ *
164
+ * @param {PointLike} offset - The offset of the ImageViewerMarker.
165
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
166
+ */
167
+ setOffset(offset: PointLike): this;
168
+ /**
169
+ * Sets the opacity of the ImageViewerMarker.
170
+ *
171
+ * @param {string} opacity - The opacity of the ImageViewerMarker.
172
+ * @param {string} opacityWhenCovered - The opacity of the ImageViewerMarker when covered.
173
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
174
+ */
175
+ setOpacity(opacity?: string, opacityWhenCovered?: string): this;
176
+ /**
177
+ * Sets the pitch alignment of the ImageViewerMarker.
178
+ *
179
+ * @param {Alignment} pitchAlignment - The pitch alignment of the ImageViewerMarker.
180
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
181
+ * @see [MapLibreGL.Alignment](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/Alignment/)
182
+ */
183
+ setPitchAlignment(pitchAlignment: Alignment): this;
184
+ /**
185
+ * Sets the popup of the ImageViewerMarker.
186
+ *
187
+ * @param {Popup} popup - The popup of the ImageViewerMarker.
188
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
189
+ * @see [Popup](https://docs.maptiler.com/sdk-js/api/markers/#popup)
190
+ */
191
+ setPopup(popup: Popup): this;
192
+ /**
193
+ * Sets the rotation of the ImageViewerMarker.
194
+ *
195
+ * @param {number} rotation - The rotation of the ImageViewerMarker.
196
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
197
+ */
198
+ setRotation(rotation: number): this;
199
+ /**
200
+ * Sets the rotation alignment of the ImageViewerMarker.
201
+ *
202
+ * @param {Alignment} rotationAlignment - The rotation alignment of the ImageViewerMarker.
203
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
204
+ * @see [MapLibreGL.Alignment](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/Alignment/)
205
+ */
206
+ setRotationAlignment(rotationAlignment: Alignment): this;
207
+ /**
208
+ * Sets if subpixel positioning is enabled for the ImageViewerMarker.
209
+ *
210
+ * @param {boolean} subpixelPositioning - The subpixel positioning of the ImageViewerMarker.
211
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
212
+ */
213
+ setSubpixelPositioning(subpixelPositioning: boolean): this;
214
+ /**
215
+ * Toggles a class name on the ImageViewerMarker dom element.
216
+ *
217
+ * @param {string} className - The class name to toggle on the ImageViewerMarker.
218
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
219
+ */
220
+ toggleClassName(className: string): this;
221
+ /**
222
+ * Toggles the popup of the ImageViewerMarker.
223
+ *
224
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
225
+ */
226
+ togglePopup(): this;
227
+ }
228
+ declare const MARKER_EVENT_TYPES: readonly ["dragstart", "drag", "dragend"];
229
+ type MarkerEventTypes = (typeof MARKER_EVENT_TYPES)[number];
230
+ export declare class ImageViewerMarkerEvent {
231
+ readonly type: string;
232
+ readonly target: ImageViewerMarker;
233
+ [key: string]: any;
234
+ constructor(type: MarkerEventTypes, marker: ImageViewerMarker, data: Record<string, any>);
235
+ }
236
+ export {};
@@ -6,6 +6,9 @@ export declare class ImageViewerEvent {
6
6
  readonly target: ImageViewer;
7
7
  readonly originalEvent: MouseEvent | TouchEvent | WheelEvent | WebGLContextEvent | null;
8
8
  [key: string]: any;
9
+ imageX: number;
10
+ imageY: number;
11
+ isOutOfBounds: boolean;
9
12
  constructor(type: string, viewer: ImageViewer, originalEvent?: MouseEvent | TouchEvent | WheelEvent | WebGLContextEvent | null, data?: Record<string, any>);
10
13
  }
11
14
  declare const BASE_MAP_EVENT_TYPES: readonly ["idle", "render", "load", "remove", "idle"];
@@ -16,7 +19,7 @@ declare const CAMERA_EVENTS: readonly ["moveend", "movestart", "move", "zoomend"
16
19
  declare const UI_EVENTS: readonly ["click", "dblclick", "mousedown", "mouseup", "mousemove", "mouseout", "mouseover", "contextmenu", "touchstart", "touchend", "touchmove", "touchcancel"];
17
20
  declare const COOPERATIVE_GESTURE_EVENTS: readonly ["cooperativegestureprevented"];
18
21
  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")[];
22
+ export declare const IMAGE_VIEWER_EVENT_TYPES: ("error" | "load" | "idle" | "remove" | "render" | "resize" | "webglcontextlost" | "webglcontextrestored" | "dataloading" | "data" | "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
23
  type BaseMapEventKeys = (typeof BASE_MAP_EVENT_TYPES)[number];
21
24
  type UiEventKeys = (typeof UI_EVENTS)[number];
22
25
  type CameraEventKeys = (typeof CAMERA_EVENTS)[number];
@@ -25,7 +28,7 @@ type ResizeEventKeys = (typeof RESIZE_EVENTS)[number];
25
28
  type WebglContextEventKeys = (typeof WEBGL_CONTEXT_EVENTS)[number];
26
29
  type DataEventKeys = (typeof DATA_EVENTS)[number];
27
30
  type CooperativeGestureEventKeys = (typeof COOPERATIVE_GESTURE_EVENTS)[number];
28
- export type ImageViewerEventTypes = BaseMapEventKeys | UiEventKeys | CameraEventKeys | ErrorEventKeys | ResizeEventKeys | WebglContextEventKeys | DataEventKeys | CooperativeGestureEventKeys | "imageviewerready" | "imagevieweriniterror";
31
+ export type ImageViewerEventTypes = BaseMapEventKeys | UiEventKeys | CameraEventKeys | ErrorEventKeys | ResizeEventKeys | WebglContextEventKeys | DataEventKeys | CooperativeGestureEventKeys | "imageviewerready" | "imagevieweriniterror" | "beforeremove";
29
32
  type LngLatToPixel = (lngLat: LngLat) => [number, number];
30
33
  interface SetupGlobalMapEventForwarderOptions {
31
34
  map: Map;
@@ -1,4 +1,5 @@
1
1
  export { default as ImageViewer } from './ImageViewer';
2
+ export { ImageViewerMarker } from './ImageViewerMarker';
2
3
  export type { ImageViewerEventTypes } from './events';
3
4
  export type { ImageViewerConstructorOptions, ImageViewerFlyToOptions, ImageViewerJumpToOptions, ImageMetadata } from './ImageViewer';
4
5
  export { ImageViewerEvent } from './events';
@@ -0,0 +1,3 @@
1
+ export declare const sdkSymbolKey: unique symbol;
2
+ export declare const lngLatToPxInternalSymbolKey: unique symbol;
3
+ export declare const pxToLngLatInternalSymbolKey: unique symbol;
package/dist/src/Map.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { default as maplibregl, StyleSpecification, MapOptions as MapOptionsML, ControlPosition, StyleSwapOptions, StyleOptions, RequestTransformFunction, LayerSpecification, SourceSpecification, CustomLayerInterface, FilterSpecification, StyleSetterOptions } from 'maplibre-gl';
1
+ import { default as maplibregl, StyleSpecification, MapOptions as MapOptionsML, ControlPosition, StyleSwapOptions, StyleOptions, RequestTransformFunction, LayerSpecification, SourceSpecification, CustomLayerInterface, FilterSpecification, StyleSetterOptions, ProjectionSpecification } from 'maplibre-gl';
2
2
  import { ReferenceMapStyle, MapStyleVariant } from '@maptiler/client';
3
3
  import { SdkConfig } from './config';
4
4
  import { LanguageInfo } from './language';
@@ -155,7 +155,7 @@ export declare class Map extends maplibregl.Map {
155
155
  * If an option is not set it will internally revert to the default option
156
156
  * unless explicitly set when calling.
157
157
  */
158
- setSpace(space: CubemapDefinition | boolean): void;
158
+ setSpace(space: CubemapDefinition | boolean, updateOptions?: boolean): void;
159
159
  /**
160
160
  * Enables the animations for the space layer.
161
161
  */
@@ -439,6 +439,15 @@ export declare class Map extends maplibregl.Map {
439
439
  * map.setTransformRequest((url: string, resourceType: string) => {});
440
440
  */
441
441
  setTransformRequest(transformRequest: RequestTransformFunction): this;
442
+ /**
443
+ * Gets the {@link ProjectionSpecification}.
444
+ * @returns the projection specification.
445
+ * @example
446
+ * ```ts
447
+ * let projection = map.getProjection();
448
+ * ```
449
+ */
450
+ getProjection(): ProjectionSpecification;
442
451
  /**
443
452
  * Returns whether a globe projection is currently being used
444
453
  */
@@ -451,6 +460,7 @@ export declare class Map extends maplibregl.Map {
451
460
  * Activate the mercator projection.
452
461
  */
453
462
  enableMercatorProjection(): void;
463
+ setProjection(projection: maplibregl.ProjectionSpecification): this;
454
464
  /**
455
465
  * Returns `true` is the language was ever updated, meaning changed
456
466
  * from what is delivered in the style.
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl } from 'maplibre-gl';
2
2
  export type * from 'maplibre-gl';
3
- export type { ColorRamp as ColorRampML } from 'maplibre-gl';
4
3
  /**
5
4
  * Get the version of MapTiler SDK, this is declared in the vite config
6
5
  * to avoid importing the entire package.json
@@ -32,7 +31,15 @@ declare const TwoFingersTouchPitchHandlerMLGL: typeof maplibregl.TwoFingersTouch
32
31
  declare const MapWheelEventMLGL: typeof maplibregl.MapWheelEvent;
33
32
  declare const MapTouchEventMLGL: typeof maplibregl.MapTouchEvent;
34
33
  declare const MapMouseEventMLGL: typeof maplibregl.MapMouseEvent;
35
- declare const configMLGL: maplibregl.Config;
34
+ declare const configMLGL: {
35
+ MAX_PARALLEL_IMAGE_REQUESTS: number;
36
+ MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME: number;
37
+ MAX_TILE_CACHE_ZOOM_LEVELS: number;
38
+ REGISTERED_PROTOCOLS: {
39
+ [x: string]: maplibregl.AddProtocolAction;
40
+ };
41
+ WORKER_URL: string;
42
+ };
36
43
  declare const getMapLibreVersion: typeof maplibregl.getVersion;
37
44
  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;
38
45
  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, };
@@ -13,5 +13,5 @@ type StyleValidationReport = {
13
13
  isValidStyle: boolean;
14
14
  styleObject: maplibregl.StyleSpecification | null;
15
15
  };
16
- export declare function convertToStyleSpecificationString(str: string): StyleValidationReport;
16
+ export declare function convertStringToStyleSpecification(str: string): StyleValidationReport;
17
17
  export {};
@@ -1,6 +1,6 @@
1
1
  import { default as maplibregl, RequestParameters, ResourceType, RequestTransformFunction } from 'maplibre-gl';
2
2
  import { Map as MapSDK } from './Map';
3
- export declare function enableRTL(): void;
3
+ export declare function enableRTL(customPluginURL?: string): Promise<void>;
4
4
  export declare function bindAll(fns: Array<string>, context: any): void;
5
5
  /**
6
6
  * This function is meant to be used as transformRequest by any Map instance created.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maptiler/sdk",
3
- "version": "3.8.0",
3
+ "version": "3.9.0-rc.1",
4
4
  "description": "The Javascript & TypeScript map SDK tailored for MapTiler Cloud",
5
5
  "author": "MapTiler",
6
6
  "module": "dist/maptiler-sdk.mjs",
@@ -86,12 +86,12 @@
86
86
  "vitest": "^3.0.9"
87
87
  },
88
88
  "dependencies": {
89
- "@maplibre/maplibre-gl-style-spec": "~23.3.0",
90
- "@maptiler/client": "~2.5.1",
89
+ "@maplibre/maplibre-gl-style-spec": "~24.2.0",
90
+ "@maptiler/client": "2.6.0-rc.1",
91
91
  "events": "^3.3.0",
92
92
  "gl-matrix": "^3.4.3",
93
93
  "js-base64": "^3.7.7",
94
- "maplibre-gl": "~5.6.0",
94
+ "maplibre-gl": "~5.9.0",
95
95
  "uuid": "^11.0.5"
96
96
  }
97
97
  }