@maptiler/sdk 4.2.0 → 5.0.0-beta.m-r.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/README.md +276 -30
- package/dist/ImageViewer/ImageViewer.d.ts +6 -8
- package/dist/ImageViewer/ImageViewerMarker.d.ts +9 -9
- package/dist/ImageViewer/monkeyPatchML.d.ts +1 -1
- package/dist/Map.d.ts +168 -11
- package/dist/Marker/Marker.d.ts +403 -0
- package/dist/Marker/MarkerManager.d.ts +137 -0
- package/dist/Marker/altitude-math.d.ts +24 -0
- package/dist/Marker/collision-helpers.d.ts +160 -0
- package/dist/Marker/index.d.ts +2 -0
- package/dist/Marker/marker-adaptive-colors.d.ts +11 -0
- package/dist/Marker/marker-animation-presets.d.ts +60 -0
- package/dist/Marker/marker-canvas.d.ts +31 -0
- package/dist/Marker/marker-constants.d.ts +112 -0
- package/dist/Marker/marker-content-registry.d.ts +17 -0
- package/dist/Marker/marker-dom-utils.d.ts +66 -0
- package/dist/Marker/marker-icons.d.ts +31 -0
- package/dist/Marker/marker-state-helpers.d.ts +2 -0
- package/dist/Marker/marker-svg-config.d.ts +84 -0
- package/dist/Marker/marker-symbols.d.ts +12 -0
- package/dist/Marker/marker-text-fit.d.ts +20 -0
- package/dist/Marker/marker-transitions.d.ts +29 -0
- package/dist/Marker/types.d.ts +465 -0
- package/dist/adaptive-colors.d.ts +48 -0
- package/dist/bundler/maplibre-gl-worker.mjs +13839 -0
- package/dist/bundler/next-worker.mjs +16 -0
- package/dist/bundler/next.cjs +42 -0
- package/dist/bundler/next.d.ts +6 -0
- package/dist/bundler/next.mjs +48 -0
- package/dist/bundler/side-effect.d.ts +2 -0
- package/dist/bundler/vite-worker.mjs +11 -0
- package/dist/bundler/webpack-worker.mjs +11 -0
- package/dist/constants/defaults.d.ts +0 -1
- package/dist/controls/MaptilerGeolocateControl.d.ts +1 -1
- package/dist/controls/MaptilerLogoControl.d.ts +1 -2
- package/dist/controls/MaptilerNavigationControl.d.ts +3 -4
- package/dist/controls/Minimap.d.ts +3 -3
- package/dist/eslint.mjs +4 -4
- package/dist/index.d.ts +11 -81
- package/dist/mapstyle.d.ts +11 -3
- package/dist/maptiler-sdk.css +108 -1
- package/dist/maptiler-sdk.d.ts +1 -1
- package/dist/maptiler-sdk.mjs +16816 -14372
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/routing.d.ts +18 -0
- package/dist/tools.d.ts +6 -7
- package/dist/utils/defaultWorkerUrl.d.ts +17 -0
- package/dist/utils/object.d.ts +1 -0
- package/package.json +26 -8
- package/dist/MLAdapters/AttributionControl.d.ts +0 -5
- package/dist/MLAdapters/BoxZoomHandler.d.ts +0 -7
- package/dist/MLAdapters/CanvasSource.d.ts +0 -5
- package/dist/MLAdapters/CooperativeGesturesHandler.d.ts +0 -5
- package/dist/MLAdapters/FullscreenControl.d.ts +0 -5
- package/dist/MLAdapters/GeoJSONSource.d.ts +0 -5
- package/dist/MLAdapters/GeolocateControl.d.ts +0 -5
- package/dist/MLAdapters/ImageSource.d.ts +0 -5
- package/dist/MLAdapters/KeyboardHandler.d.ts +0 -5
- package/dist/MLAdapters/LogoControl.d.ts +0 -5
- package/dist/MLAdapters/MapMouseEvent.d.ts +0 -5
- package/dist/MLAdapters/MapTouchEvent.d.ts +0 -5
- package/dist/MLAdapters/MapWheelEvent.d.ts +0 -5
- package/dist/MLAdapters/Marker.d.ts +0 -5
- package/dist/MLAdapters/NavigationControl.d.ts +0 -5
- package/dist/MLAdapters/Popup.d.ts +0 -5
- package/dist/MLAdapters/RasterDEMTileSource.d.ts +0 -5
- package/dist/MLAdapters/RasterTileSource.d.ts +0 -5
- package/dist/MLAdapters/ScaleControl.d.ts +0 -5
- package/dist/MLAdapters/ScrollZoomHandler.d.ts +0 -5
- package/dist/MLAdapters/Style.d.ts +0 -5
- package/dist/MLAdapters/TerrainControl.d.ts +0 -5
- package/dist/MLAdapters/TwoFingersTouchPitchHandler.d.ts +0 -5
- package/dist/MLAdapters/VectorTileSource.d.ts +0 -5
- package/dist/MLAdapters/VideoSource.d.ts +0 -5
- package/dist/ml-types.d.ts +0 -638
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as client from "@maptiler/client";
|
|
2
|
+
export type ExtraRoutingOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Specifies whether the routing request runs with a session logic.
|
|
5
|
+
* A "session" is started at the initialization of the SDK and finished when the browser
|
|
6
|
+
* page is being closed or refreshed.
|
|
7
|
+
* When this option is enabled, extra URL param `mtsid` is added to queries
|
|
8
|
+
* to the MapTiler Cloud API. This allows MapTiler to enable "session based billing".
|
|
9
|
+
*
|
|
10
|
+
* Default: value of this option in global config (which is `true` by default).
|
|
11
|
+
*/
|
|
12
|
+
session?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type RoutingOptions = client.RoutingOptions & ExtraRoutingOptions;
|
|
15
|
+
export declare const routing: {
|
|
16
|
+
directionsPost: (body: client.RoutingRequest, options?: RoutingOptions) => Promise<client.RoutingResponse>;
|
|
17
|
+
directionsGet: (req: client.RoutingGetRequest, options?: RoutingOptions) => Promise<client.RoutingResponse>;
|
|
18
|
+
};
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
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:
|
|
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:
|
|
69
|
-
export declare function addFormatElevationExpressionFromString(expression:
|
|
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:
|
|
82
|
-
export declare function computeLabelsLocalizationMetrics(layers:
|
|
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/dist/utils/object.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maptiler/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-beta.m-r.2",
|
|
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
|
},
|
|
@@ -44,6 +61,7 @@
|
|
|
44
61
|
},
|
|
45
62
|
"scripts": {
|
|
46
63
|
"prepare": "husky",
|
|
64
|
+
"prepack": "npm run build",
|
|
47
65
|
"doc": "rm -rf docs/* && typedoc --out docs && cp -r images docs/",
|
|
48
66
|
"ncu": "npx npm-check-updates",
|
|
49
67
|
"lint": "tsc --noEmit && eslint src",
|
|
@@ -80,7 +98,7 @@
|
|
|
80
98
|
"@types/stats.js": "^0.17.4",
|
|
81
99
|
"@types/uuid": "^10.0.0",
|
|
82
100
|
"@types/xmldom": "^0.1.31",
|
|
83
|
-
"@vitest/web-worker": "^
|
|
101
|
+
"@vitest/web-worker": "^5.0.4",
|
|
84
102
|
"@xmldom/xmldom": "^0.8.10",
|
|
85
103
|
"concurrently": "^9.1.2",
|
|
86
104
|
"eslint": "^9.21.0",
|
|
@@ -89,24 +107,24 @@
|
|
|
89
107
|
"happy-dom": "^20.8.9",
|
|
90
108
|
"husky": "^8.0.0",
|
|
91
109
|
"jiti": "^2.4.2",
|
|
92
|
-
"lint-staged": "^
|
|
110
|
+
"lint-staged": "^17.6.0",
|
|
93
111
|
"prettier": "3.5.2",
|
|
94
112
|
"stats.js": "^0.17.0",
|
|
95
113
|
"typedoc": "^0.27.6",
|
|
96
114
|
"typescript": "^5.7.3",
|
|
97
115
|
"typescript-eslint": "^8.25.0",
|
|
98
116
|
"vite": "^6.0.7",
|
|
99
|
-
"vite-plugin-dts": "^
|
|
100
|
-
"vitest": "^
|
|
117
|
+
"vite-plugin-dts": "^5.1.2",
|
|
118
|
+
"vitest": "^5.0.4"
|
|
101
119
|
},
|
|
102
120
|
"dependencies": {
|
|
103
|
-
"@maplibre/maplibre-gl-style-spec": "^
|
|
104
|
-
"@maptiler/client": "
|
|
121
|
+
"@maplibre/maplibre-gl-style-spec": "^26.4.4",
|
|
122
|
+
"@maptiler/client": "3.2.0-rc.2",
|
|
105
123
|
"eslint-plugin-compat": "^6.1.0",
|
|
106
124
|
"events": "^3.3.0",
|
|
107
125
|
"gl-matrix": "^3.4.4",
|
|
108
126
|
"js-base64": "^3.7.7",
|
|
109
|
-
"maplibre-gl": "
|
|
127
|
+
"maplibre-gl": "6.11.2",
|
|
110
128
|
"uuid": "^14.0.0"
|
|
111
129
|
}
|
|
112
130
|
}
|
|
@@ -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, 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 MapMouseEvent extends maplibregl.MapMouseEvent {
|
|
4
|
-
constructor(type: string, map: SDKMap | MapMLGL, originalEvent: MouseEvent, data?: Record<string, unknown>);
|
|
5
|
-
}
|