@maptiler/sdk 3.1.0-rc1 → 3.1.0-rc3
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/.husky/pre-commit +2 -1
- package/README.md +118 -0
- package/dist/maptiler-sdk.mjs +1054 -1034
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/src/Map.d.ts +3 -1
- package/dist/src/config.d.ts +1 -1
- package/dist/src/{MaptilerGeolocateControl.d.ts → controls/MaptilerGeolocateControl.d.ts} +1 -1
- package/dist/src/{MaptilerLogoControl.d.ts → controls/MaptilerLogoControl.d.ts} +2 -2
- package/dist/src/{MaptilerNavigationControl.d.ts → controls/MaptilerNavigationControl.d.ts} +1 -1
- package/dist/src/{MaptilerProjectionControl.d.ts → controls/MaptilerProjectionControl.d.ts} +1 -1
- package/dist/src/{MaptilerTerrainControl.d.ts → controls/MaptilerTerrainControl.d.ts} +1 -1
- package/dist/src/{Minimap.d.ts → controls/Minimap.d.ts} +1 -1
- package/dist/src/controls/index.d.ts +6 -0
- package/dist/src/custom-layers/extractCustomLayerStyle.d.ts +1 -2
- package/dist/src/helpers/stylehelper.d.ts +1 -1
- package/dist/src/helpers/vectorlayerhelpers.d.ts +1 -1
- package/dist/src/index.d.ts +7 -10
- package/dist/src/tools.d.ts +0 -2
- package/dist/src/utils/dom.d.ts +2 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/vite.config-test.d.ts +2 -0
- package/dist/vitest-setup-tests.d.ts +1 -0
- package/eslint.config.mjs +1 -1
- package/package.json +9 -5
- package/tsconfig.json +4 -1
- package/vite.config-dev.ts +4 -0
- package/vite.config-es.ts +4 -0
- package/vite.config-test.ts +7 -0
- package/vite.config-umd.ts +4 -0
- package/vitest-setup-tests.ts +4 -0
- /package/dist/src/{colorramp.d.ts → ColorRamp.d.ts} +0 -0
- /package/dist/src/{defaults.d.ts → constants/defaults.d.ts} +0 -0
- /package/dist/src/{unit.d.ts → types.d.ts} +0 -0
package/dist/src/Map.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { default as maplibregl, StyleSpecification, MapOptions as MapOptionsML,
|
|
|
2
2
|
import { ReferenceMapStyle, MapStyleVariant } from '@maptiler/client';
|
|
3
3
|
import { SdkConfig } from './config';
|
|
4
4
|
import { LanguageInfo } from './language';
|
|
5
|
-
import { MinimapOptionsInput } from './Minimap';
|
|
5
|
+
import { MinimapOptionsInput } from './controls/Minimap';
|
|
6
6
|
import { Telemetry } from './Telemetry';
|
|
7
7
|
import { CubemapDefinition, CubemapLayer, CubemapLayerConstructorOptions } from './custom-layers/CubemapLayer';
|
|
8
8
|
import { GradientDefinition, RadialGradientLayer, RadialGradientLayerOptions } from './custom-layers/RadialGradientLayer';
|
|
@@ -164,6 +164,8 @@ export declare class Map extends maplibregl.Map {
|
|
|
164
164
|
private isStyleLocalized;
|
|
165
165
|
private languageIsUpdated;
|
|
166
166
|
constructor(options: MapOptions);
|
|
167
|
+
private initSpace;
|
|
168
|
+
private initHalo;
|
|
167
169
|
/**
|
|
168
170
|
* Recreates the map instance with the same options.
|
|
169
171
|
* Useful for WebGL context loss.
|
package/dist/src/config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as EventEmitter } from 'events';
|
|
2
2
|
import { LanguageInfo } from './language';
|
|
3
3
|
import { FetchFunction } from '@maptiler/client';
|
|
4
|
-
import { Unit } from './
|
|
4
|
+
import { Unit } from './types';
|
|
5
5
|
export declare const MAPTILER_SESSION_ID: string;
|
|
6
6
|
/**
|
|
7
7
|
* Configuration class for the SDK
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GeolocateControl } from '
|
|
1
|
+
import { GeolocateControl } from '../MLAdapters/GeolocateControl';
|
|
2
2
|
/**
|
|
3
3
|
* The MaptilerGeolocateControl is an extension of the original GeolocateControl
|
|
4
4
|
* with a few changes. In this version, the active mode persists as long as the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LogoControlOptions as LogoControlOptionsML } from 'maplibre-gl';
|
|
2
|
-
import { LogoControl } from '
|
|
3
|
-
import { Map as SDKMap } from '
|
|
2
|
+
import { LogoControl } from '../MLAdapters/LogoControl';
|
|
3
|
+
import { Map as SDKMap } from '../Map';
|
|
4
4
|
type LogoControlOptions = LogoControlOptionsML & {
|
|
5
5
|
logoURL?: string;
|
|
6
6
|
linkURL?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NavigationControlOptions } from 'maplibre-gl';
|
|
2
|
-
import { NavigationControl } from '
|
|
2
|
+
import { NavigationControl } from '../MLAdapters/NavigationControl';
|
|
3
3
|
type HTMLButtonElementPlus = HTMLButtonElement & {
|
|
4
4
|
clickFunction: (e?: Event) => unknown;
|
|
5
5
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Map as SDKMap, MapOptions } from '
|
|
1
|
+
import { Map as SDKMap, MapOptions } from '../Map';
|
|
2
2
|
import { ControlPosition, CustomLayerInterface, FillLayerSpecification, FilterSpecification, IControl, LayerSpecification, LineLayerSpecification, SourceSpecification, StyleOptions, StyleSetterOptions, StyleSpecification, StyleSwapOptions } from 'maplibre-gl';
|
|
3
3
|
import { MapStyleVariant, ReferenceMapStyle } from '@maptiler/client';
|
|
4
4
|
export interface ParentRect {
|
|
@@ -14,5 +14,4 @@ export interface IExtractCustomLayerStyleOptions {
|
|
|
14
14
|
map: MapSDK;
|
|
15
15
|
property: "halo" | "space";
|
|
16
16
|
}
|
|
17
|
-
export
|
|
18
|
-
export default function extractCustomLayerStyle(options: IExtractCustomLayerStyleOptions): CustomLayerDefinitionType;
|
|
17
|
+
export default function extractCustomLayerStyle<T extends CubemapLayerConstructorOptions | RadialGradientLayerOptions | null>(options: IExtractCustomLayerStyleOptions): T | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataDrivenPropertyValueSpecification, ExpressionSpecification } from 'maplibre-gl';
|
|
2
|
-
import { ColorRamp } from '../
|
|
2
|
+
import { ColorRamp } from '../ColorRamp';
|
|
3
3
|
import { DataDrivenStyle, PropertyValues, ZoomNumberValues, ZoomStringValues } from './vectorlayerhelpers';
|
|
4
4
|
export type ColorPalette = [string, string, string, string];
|
|
5
5
|
export declare const colorPalettes: Array<ColorPalette>;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { default as maplibregl } from 'maplibre-gl';
|
|
2
2
|
export type * from 'maplibre-gl';
|
|
3
3
|
/**
|
|
4
|
-
* Get the version of MapTiler SDK
|
|
4
|
+
* Get the version of MapTiler SDK, this is declared in the vite config
|
|
5
|
+
* to avoid importing the entire package.json
|
|
5
6
|
*/
|
|
6
7
|
export declare function getVersion(): string;
|
|
7
8
|
declare const MapMLGL: typeof maplibregl.Map;
|
|
@@ -74,17 +75,13 @@ export { MapWheelEvent } from './MLAdapters/MapWheelEvent';
|
|
|
74
75
|
export { MapTouchEvent } from './MLAdapters/MapTouchEvent';
|
|
75
76
|
export { MapMouseEvent } from './MLAdapters/MapMouseEvent';
|
|
76
77
|
export { Map, GeolocationType, type MapOptions, type LoadWithTerrainEvent } from './Map';
|
|
77
|
-
export * from './
|
|
78
|
-
export * from './MaptilerLogoControl';
|
|
79
|
-
export * from './MaptilerTerrainControl';
|
|
80
|
-
export * from './MaptilerNavigationControl';
|
|
81
|
-
export * from './MaptilerProjectionControl';
|
|
78
|
+
export * from './controls';
|
|
82
79
|
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, } from '@maptiler/client';
|
|
83
80
|
export { getWebGLSupportError, displayWebGLContextLostWarning } from './tools';
|
|
84
81
|
export { config, SdkConfig } from './config';
|
|
85
82
|
export * from './language';
|
|
86
|
-
export type { Unit } from './
|
|
87
|
-
export * from './Minimap';
|
|
83
|
+
export type { Unit } from './types';
|
|
88
84
|
export * from './converters';
|
|
89
|
-
export * from './
|
|
90
|
-
export * from './
|
|
85
|
+
export * as helpers from './helpers';
|
|
86
|
+
export * from './ColorRamp';
|
|
87
|
+
export * from './utils';
|
package/dist/src/tools.d.ts
CHANGED
|
@@ -2,8 +2,6 @@ import { default as maplibregl, RequestParameters, ResourceType, RequestTransfor
|
|
|
2
2
|
import { Map as MapSDK } from './Map';
|
|
3
3
|
export declare function enableRTL(): void;
|
|
4
4
|
export declare function bindAll(fns: Array<string>, context: any): void;
|
|
5
|
-
export declare function DOMcreate<K extends keyof HTMLElementTagNameMap>(tagName: K, className?: string, container?: HTMLElement): HTMLElementTagNameMap[K];
|
|
6
|
-
export declare function DOMremove(node: HTMLElement): void;
|
|
7
5
|
/**
|
|
8
6
|
* This function is meant to be used as transformRequest by any Map instance created.
|
|
9
7
|
* It adds the session ID as well as the MapTiler Cloud key from the config to all the requests
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/eslint.config.mjs
CHANGED
|
@@ -35,7 +35,7 @@ export default tseslint.config(
|
|
|
35
35
|
"@typescript-eslint/no-unnecessary-condition": "warn",
|
|
36
36
|
"@typescript-eslint/no-unnecessary-type-arguments": "off",
|
|
37
37
|
"@typescript-eslint/no-unnecessary-type-assertion": "off",
|
|
38
|
-
"@typescript-eslint/no-unnecessary-type-parameters": "
|
|
38
|
+
"@typescript-eslint/no-unnecessary-type-parameters": "off", // as we are a lib, types serve as documentation
|
|
39
39
|
"@typescript-eslint/no-unused-vars": "warn",
|
|
40
40
|
"@typescript-eslint/no-unsafe-argument": "warn",
|
|
41
41
|
"@typescript-eslint/no-unsafe-assignment": "warn",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maptiler/sdk",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.0rc3",
|
|
4
4
|
"description": "The Javascript & TypeScript map SDK tailored for MapTiler Cloud",
|
|
5
5
|
"author": "MapTiler",
|
|
6
6
|
"module": "dist/maptiler-sdk.mjs",
|
|
@@ -38,9 +38,10 @@
|
|
|
38
38
|
"prepare": "husky",
|
|
39
39
|
"doc": "rm -rf docs/* && typedoc --out docs && cp -r images docs/",
|
|
40
40
|
"ncu": "npx npm-check-updates",
|
|
41
|
-
"lint": "
|
|
42
|
-
"lint:fix": "
|
|
43
|
-
"test": "vitest
|
|
41
|
+
"lint": "eslint src",
|
|
42
|
+
"lint:fix": "eslint src --fix",
|
|
43
|
+
"test:watch": "vitest watch -c vite.config-test.ts --dom",
|
|
44
|
+
"test": "vitest run -c vite.config-test.ts --dom",
|
|
44
45
|
"install:clean": "rm -rf build/ dist/ node_modules/ && npm ci",
|
|
45
46
|
"dev": "concurrently \"vite -c vite.config-dev.ts\" \"npm run dev-umd\"",
|
|
46
47
|
"dev-umd": "npm run build-css && tsc && NODE_ENV=development vite build -w -c vite.config-umd.ts",
|
|
@@ -54,16 +55,19 @@
|
|
|
54
55
|
"*.ts": "npm run lint:fix"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
58
|
+
"@canvas/image-data": "^1.0.0",
|
|
57
59
|
"@eslint/js": "^9.21.0",
|
|
58
60
|
"@types/color-convert": "^2.0.4",
|
|
59
61
|
"@types/color-name": "^2.0.0",
|
|
60
62
|
"@types/uuid": "^10.0.0",
|
|
61
63
|
"@types/xmldom": "^0.1.31",
|
|
64
|
+
"@vitest/web-worker": "^3.0.9",
|
|
62
65
|
"@xmldom/xmldom": "^0.8.10",
|
|
63
66
|
"concurrently": "^9.1.2",
|
|
64
67
|
"eslint": "^9.21.0",
|
|
65
68
|
"eslint-config-prettier": "^10.0.2",
|
|
66
69
|
"eslint-plugin-prettier": "^5.2.3",
|
|
70
|
+
"happy-dom": "^17.4.4",
|
|
67
71
|
"husky": "^8.0.0",
|
|
68
72
|
"lint-staged": "^15.4.3",
|
|
69
73
|
"prettier": "3.5.2",
|
|
@@ -72,7 +76,7 @@
|
|
|
72
76
|
"typescript-eslint": "^8.25.0",
|
|
73
77
|
"vite": "^6.0.7",
|
|
74
78
|
"vite-plugin-dts": "^4.5.0",
|
|
75
|
-
"vitest": "^
|
|
79
|
+
"vitest": "^3.0.9"
|
|
76
80
|
},
|
|
77
81
|
"dependencies": {
|
|
78
82
|
"@maplibre/maplibre-gl-style-spec": "^23.0.0",
|
package/tsconfig.json
CHANGED
package/vite.config-dev.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { defineConfig } from "vitest/config";
|
|
2
|
+
import packagejson from "./package.json";
|
|
2
3
|
|
|
3
4
|
export default defineConfig({
|
|
4
5
|
server: {
|
|
5
6
|
port: 3000,
|
|
6
7
|
},
|
|
8
|
+
define: {
|
|
9
|
+
__MT_SDK_VERSION__: JSON.stringify(packagejson.version),
|
|
10
|
+
},
|
|
7
11
|
plugins: [
|
|
8
12
|
{
|
|
9
13
|
name: 'url-override',
|
package/vite.config-es.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { resolve } from 'path';
|
|
2
2
|
import { defineConfig } from 'vite';
|
|
3
3
|
import dts from 'vite-plugin-dts';
|
|
4
|
+
import packagejson from "./package.json";
|
|
4
5
|
|
|
5
6
|
const isProduction = process.env.NODE_ENV === "production";
|
|
6
7
|
|
|
@@ -43,6 +44,9 @@ export default defineConfig({
|
|
|
43
44
|
globals: {},
|
|
44
45
|
},
|
|
45
46
|
},
|
|
47
|
+
},
|
|
48
|
+
define: {
|
|
49
|
+
__MT_SDK_VERSION__: JSON.stringify(packagejson.version),
|
|
46
50
|
},
|
|
47
51
|
plugins,
|
|
48
52
|
})
|
package/vite.config-test.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineConfig } from "vitest/config";
|
|
2
|
+
import packagejson from "./package.json";
|
|
2
3
|
|
|
3
4
|
export default defineConfig({
|
|
4
5
|
test: {
|
|
@@ -6,5 +7,11 @@ export default defineConfig({
|
|
|
6
7
|
typecheck: {
|
|
7
8
|
tsconfig: "./tsconfig.json",
|
|
8
9
|
},
|
|
10
|
+
// environment: "jsdom",
|
|
11
|
+
globals: true,
|
|
12
|
+
setupFiles: ["@vitest/web-worker", "./vitest-setup-tests.ts"],
|
|
13
|
+
},
|
|
14
|
+
define: {
|
|
15
|
+
__MT_SDK_VERSION__: JSON.stringify(packagejson.version),
|
|
9
16
|
},
|
|
10
17
|
});
|
package/vite.config-umd.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { resolve } from 'path';
|
|
2
2
|
import { defineConfig } from 'vite';
|
|
3
|
+
import packagejson from "./package.json";
|
|
3
4
|
|
|
4
5
|
const isProduction = process.env.NODE_ENV === "production";
|
|
5
6
|
|
|
@@ -17,5 +18,8 @@ export default defineConfig({
|
|
|
17
18
|
formats: ['umd'],
|
|
18
19
|
}
|
|
19
20
|
},
|
|
21
|
+
define: {
|
|
22
|
+
__MT_SDK_VERSION__: JSON.stringify(packagejson.version),
|
|
23
|
+
},
|
|
20
24
|
plugins: [],
|
|
21
25
|
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|