@maptiler/sdk 4.2.0 → 5.0.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.
Files changed (52) hide show
  1. package/README.md +98 -29
  2. package/dist/ImageViewer/ImageViewer.d.ts +6 -8
  3. package/dist/ImageViewer/ImageViewerMarker.d.ts +9 -9
  4. package/dist/Map.d.ts +73 -10
  5. package/dist/bundler/maplibre-gl-worker.mjs +13839 -0
  6. package/dist/bundler/next-worker.mjs +16 -0
  7. package/dist/bundler/next.cjs +42 -0
  8. package/dist/bundler/next.d.ts +6 -0
  9. package/dist/bundler/next.mjs +48 -0
  10. package/dist/bundler/side-effect.d.ts +2 -0
  11. package/dist/bundler/vite-worker.mjs +11 -0
  12. package/dist/bundler/webpack-worker.mjs +11 -0
  13. package/dist/constants/defaults.d.ts +0 -1
  14. package/dist/controls/MaptilerGeolocateControl.d.ts +1 -1
  15. package/dist/controls/MaptilerLogoControl.d.ts +1 -2
  16. package/dist/controls/MaptilerNavigationControl.d.ts +3 -4
  17. package/dist/controls/Minimap.d.ts +3 -3
  18. package/dist/eslint.mjs +4 -4
  19. package/dist/index.d.ts +5 -80
  20. package/dist/mapstyle.d.ts +4 -3
  21. package/dist/maptiler-sdk.css +1 -1
  22. package/dist/maptiler-sdk.mjs +3500 -3443
  23. package/dist/maptiler-sdk.mjs.map +1 -1
  24. package/dist/tools.d.ts +6 -7
  25. package/dist/utils/defaultWorkerUrl.d.ts +17 -0
  26. package/package.json +20 -3
  27. package/dist/MLAdapters/AttributionControl.d.ts +0 -5
  28. package/dist/MLAdapters/BoxZoomHandler.d.ts +0 -7
  29. package/dist/MLAdapters/CanvasSource.d.ts +0 -5
  30. package/dist/MLAdapters/CooperativeGesturesHandler.d.ts +0 -5
  31. package/dist/MLAdapters/FullscreenControl.d.ts +0 -5
  32. package/dist/MLAdapters/GeoJSONSource.d.ts +0 -5
  33. package/dist/MLAdapters/GeolocateControl.d.ts +0 -5
  34. package/dist/MLAdapters/ImageSource.d.ts +0 -5
  35. package/dist/MLAdapters/KeyboardHandler.d.ts +0 -5
  36. package/dist/MLAdapters/LogoControl.d.ts +0 -5
  37. package/dist/MLAdapters/MapMouseEvent.d.ts +0 -5
  38. package/dist/MLAdapters/MapTouchEvent.d.ts +0 -5
  39. package/dist/MLAdapters/MapWheelEvent.d.ts +0 -5
  40. package/dist/MLAdapters/Marker.d.ts +0 -5
  41. package/dist/MLAdapters/NavigationControl.d.ts +0 -5
  42. package/dist/MLAdapters/Popup.d.ts +0 -5
  43. package/dist/MLAdapters/RasterDEMTileSource.d.ts +0 -5
  44. package/dist/MLAdapters/RasterTileSource.d.ts +0 -5
  45. package/dist/MLAdapters/ScaleControl.d.ts +0 -5
  46. package/dist/MLAdapters/ScrollZoomHandler.d.ts +0 -5
  47. package/dist/MLAdapters/Style.d.ts +0 -5
  48. package/dist/MLAdapters/TerrainControl.d.ts +0 -5
  49. package/dist/MLAdapters/TwoFingersTouchPitchHandler.d.ts +0 -5
  50. package/dist/MLAdapters/VectorTileSource.d.ts +0 -5
  51. package/dist/MLAdapters/VideoSource.d.ts +0 -5
  52. package/dist/ml-types.d.ts +0 -638
package/dist/tools.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { default as maplibregl, RequestParameters, ResourceType, RequestTransformFunction } from 'maplibre-gl';
1
+ import { ExpressionSpecification, LayerSpecification, RequestParameters, ResourceType, RequestTransformFunction } from 'maplibre-gl';
2
2
  import { Map as MapSDK } from './Map';
3
- export declare function enableRTL(customPluginURL?: string): Promise<void>;
4
3
  export declare function bindAll(fns: Array<string>, context: any): void;
5
4
  /**
6
5
  * This function is meant to be used as transformRequest by any Map instance created.
@@ -52,7 +51,7 @@ export declare function displayWebGLContextLostWarning(map: MapSDK): void;
52
51
  * This replacement happened regardless of how deep in the object the flag is.
53
52
  * Note that it does not replace the occurences of ["get", "name"] (local names)
54
53
  */
55
- export declare function changeFirstLanguage(origExpr: maplibregl.ExpressionSpecification, replacer: maplibregl.ExpressionSpecification, localized: boolean): maplibregl.ExpressionSpecification;
54
+ export declare function changeFirstLanguage(origExpr: ExpressionSpecification, replacer: ExpressionSpecification, localized: boolean): ExpressionSpecification;
56
55
  /**
57
56
  * If `localized` is `true`, it checks for the pattern "{name:xx}" (with "xx" being a language iso string).
58
57
  * If `localized` is `false`, it check for {name}.
@@ -65,8 +64,8 @@ export declare function checkNamePattern(str: string, localized: boolean): {
65
64
  /**
66
65
  * Replaces the occurences of {name:xx} in a string by a provided object-expression to return a concat object expression
67
66
  */
68
- export declare function replaceLanguage(origLang: string, newLang: maplibregl.ExpressionSpecification, localized: boolean): maplibregl.ExpressionSpecification;
69
- export declare function addFormatElevationExpressionFromString(expression: maplibregl.ExpressionSpecification | string): maplibregl.ExpressionSpecification | string;
67
+ export declare function replaceLanguage(origLang: string, newLang: ExpressionSpecification, localized: boolean): ExpressionSpecification;
68
+ export declare function addFormatElevationExpressionFromString(expression: ExpressionSpecification | string): ExpressionSpecification | string;
70
69
  /**
71
70
  * Find languages used in string label definition.
72
71
  * The returned array contains languages such as "en", "fr" but
@@ -78,8 +77,8 @@ export declare function findLanguageStr(str: string): Array<string | null>;
78
77
  * The returned array contains languages such as "en", "fr" but
79
78
  * can also contain null that stand for the use of {name}
80
79
  */
81
- export declare function findLanguageObj(origExpr: maplibregl.ExpressionSpecification): Array<string | null>;
82
- export declare function computeLabelsLocalizationMetrics(layers: maplibregl.LayerSpecification[], map: MapSDK): {
80
+ export declare function findLanguageObj(origExpr: ExpressionSpecification): Array<string | null>;
81
+ export declare function computeLabelsLocalizationMetrics(layers: LayerSpecification[], map: MapSDK): {
83
82
  unlocalized: number;
84
83
  localized: Record<string, number>;
85
84
  };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * URL of the MapLibre worker published on the MapTiler CDN alongside the UMD bundle of this SDK version.
3
+ */
4
+ export declare function getCdnWorkerUrl(): string;
5
+ /**
6
+ * Since MapLibre v6, the worker is loaded from a separate file that bundlers generally don't emit,
7
+ * so in the ES build (npm) the SDK falls back to the worker hosted on the MapTiler CDN.
8
+ * A URL set beforehand, with `setWorkerUrl` or one of the bundler helpers
9
+ * (e.g. `@maptiler/sdk/vite-worker`), always takes precedence.
10
+ * The UMD build keeps MapLibre's default, which finds the worker next to the UMD bundle.
11
+ */
12
+ export declare function setDefaultWorkerUrl(): void;
13
+ /**
14
+ * Same as MapLibre's `prewarm`, but sets the default worker URL first,
15
+ * as the workers it starts are the ones later used by the maps.
16
+ */
17
+ export declare function prewarm(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maptiler/sdk",
3
- "version": "4.2.0",
3
+ "version": "5.0.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",
@@ -13,6 +13,23 @@
13
13
  "import": "./dist/maptiler-sdk.mjs",
14
14
  "types": "./dist/maptiler-sdk.d.ts"
15
15
  },
16
+ "./vite-worker": {
17
+ "types": "./dist/bundler/side-effect.d.ts",
18
+ "import": "./dist/bundler/vite-worker.mjs"
19
+ },
20
+ "./webpack-worker": {
21
+ "types": "./dist/bundler/side-effect.d.ts",
22
+ "import": "./dist/bundler/webpack-worker.mjs"
23
+ },
24
+ "./next-worker": {
25
+ "types": "./dist/bundler/side-effect.d.ts",
26
+ "import": "./dist/bundler/next-worker.mjs"
27
+ },
28
+ "./next": {
29
+ "types": "./dist/bundler/next.d.ts",
30
+ "import": "./dist/bundler/next.mjs",
31
+ "require": "./dist/bundler/next.cjs"
32
+ },
16
33
  "./dist/maptiler-sdk.css": {
17
34
  "import": "./dist/maptiler-sdk.css"
18
35
  },
@@ -100,13 +117,13 @@
100
117
  "vitest": "^3.0.9"
101
118
  },
102
119
  "dependencies": {
103
- "@maplibre/maplibre-gl-style-spec": "^24.7.0",
120
+ "@maplibre/maplibre-gl-style-spec": "^26.4.4",
104
121
  "@maptiler/client": "^3.1.0",
105
122
  "eslint-plugin-compat": "^6.1.0",
106
123
  "events": "^3.3.0",
107
124
  "gl-matrix": "^3.4.4",
108
125
  "js-base64": "^3.7.7",
109
- "maplibre-gl": "5.24",
126
+ "maplibre-gl": "6.11.2",
110
127
  "uuid": "^14.0.0"
111
128
  }
112
129
  }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class AttributionControl extends maplibregl.AttributionControl {
4
- onAdd(map: SDKMap | MapMLGL): HTMLElement;
5
- }
@@ -1,7 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class BoxZoomHandler extends maplibregl.BoxZoomHandler {
4
- constructor(map: SDKMap | MapMLGL, options: {
5
- clickTolerance: number;
6
- });
7
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class CanvasSource extends maplibregl.CanvasSource {
4
- onAdd(map: SDKMap | MapMLGL): void;
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, GestureOptions, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class CooperativeGesturesHandler extends maplibregl.CooperativeGesturesHandler {
4
- constructor(map: SDKMap | MapMLGL, options: GestureOptions);
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class FullscreenControl extends maplibregl.FullscreenControl {
4
- onAdd(map: SDKMap | MapMLGL): HTMLElement;
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class GeoJSONSource extends maplibregl.GeoJSONSource {
4
- onAdd(map: SDKMap | MapMLGL): void;
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class GeolocateControl extends maplibregl.GeolocateControl {
4
- onAdd(map: SDKMap | MapMLGL): HTMLElement;
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class ImageSource extends maplibregl.ImageSource {
4
- onAdd(map: SDKMap | MapMLGL): void;
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class KeyboardHandler extends maplibregl.KeyboardHandler {
4
- constructor(map: SDKMap | MapMLGL);
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class LogoControl extends maplibregl.LogoControl {
4
- onAdd(map: SDKMap | MapMLGL): HTMLElement;
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class MapMouseEvent extends maplibregl.MapMouseEvent {
4
- constructor(type: string, map: SDKMap | MapMLGL, originalEvent: MouseEvent, data?: Record<string, unknown>);
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class MapTouchEvent extends maplibregl.MapTouchEvent {
4
- constructor(type: string, map: SDKMap | MapMLGL, originalEvent: TouchEvent);
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class MapWheelEvent extends maplibregl.MapWheelEvent {
4
- constructor(type: string, map: SDKMap | MapMLGL, originalEvent: WheelEvent);
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class Marker extends maplibregl.Marker {
4
- addTo(map: SDKMap | MapMLGL): this;
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class NavigationControl extends maplibregl.NavigationControl {
4
- onAdd(map: SDKMap | MapMLGL): HTMLElement;
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class Popup extends maplibregl.Popup {
4
- addTo(map: SDKMap | MapMLGL): this;
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class RasterDEMTileSource extends maplibregl.RasterDEMTileSource {
4
- onAdd(map: SDKMap | MapMLGL): void;
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class RasterTileSource extends maplibregl.RasterTileSource {
4
- onAdd(map: SDKMap | MapMLGL): void;
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class ScaleControl extends maplibregl.ScaleControl {
4
- onAdd(map: SDKMap | MapMLGL): HTMLElement;
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class ScrollZoomHandler extends maplibregl.ScrollZoomHandler {
4
- constructor(map: SDKMap | MapMLGL, triggerRenderFrame: () => void);
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, StyleOptions } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class Style extends maplibregl.Style {
4
- constructor(map: SDKMap, options?: StyleOptions);
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class TerrainControl extends maplibregl.TerrainControl {
4
- onAdd(map: SDKMap | MapMLGL): HTMLElement;
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class TwoFingersTouchPitchHandler extends maplibregl.TwoFingersTouchPitchHandler {
4
- constructor(map: SDKMap | MapMLGL);
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class VectorTileSource extends maplibregl.VectorTileSource {
4
- onAdd(map: SDKMap | MapMLGL): void;
5
- }
@@ -1,5 +0,0 @@
1
- import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
- import { Map as SDKMap } from '../Map';
3
- export declare class VideoSource extends maplibregl.VideoSource {
4
- onAdd(map: SDKMap | MapMLGL): void;
5
- }