@maptiler/sdk 3.2.0-rc.1 → 3.3.0-rc2
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/.editorconfig +13 -0
- package/.husky/pre-commit +3 -1
- package/README.md +125 -0
- package/dist/maptiler-sdk.mjs +3476 -2827
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/src/MLAdapters/ScaleControl.d.ts +0 -3
- package/dist/src/Map.d.ts +19 -7
- package/dist/src/config.d.ts +1 -1
- package/dist/src/{MaptilerGeolocateControl.d.ts → controls/MaptilerGeolocateControl.d.ts} +1 -12
- package/dist/src/{MaptilerLogoControl.d.ts → controls/MaptilerLogoControl.d.ts} +2 -6
- package/dist/src/controls/MaptilerNavigationControl.d.ts +17 -0
- package/dist/src/{MaptilerProjectionControl.d.ts → controls/MaptilerProjectionControl.d.ts} +1 -11
- package/dist/src/{MaptilerTerrainControl.d.ts → controls/MaptilerTerrainControl.d.ts} +4 -13
- 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/CubemapLayer/CubemapLayer.d.ts +29 -0
- package/dist/src/custom-layers/CubemapLayer/constants.d.ts +3 -0
- package/dist/src/custom-layers/CubemapLayer/index.d.ts +2 -0
- package/dist/src/custom-layers/CubemapLayer/loadCubemapTexture.d.ts +6 -0
- package/dist/src/custom-layers/CubemapLayer/types.d.ts +37 -0
- package/dist/src/custom-layers/RadialGradientLayer/RadialGradientLayer.d.ts +23 -0
- package/dist/src/custom-layers/RadialGradientLayer/index.d.ts +2 -0
- package/dist/src/custom-layers/RadialGradientLayer/types.d.ts +11 -0
- package/dist/src/custom-layers/extractCustomLayerStyle.d.ts +17 -0
- package/dist/src/custom-layers/index.d.ts +5 -0
- package/dist/src/helpers/stylehelper.d.ts +1 -1
- package/dist/src/helpers/vectorlayerhelpers.d.ts +1 -1
- package/dist/src/index.d.ts +8 -12
- package/dist/src/tools.d.ts +0 -2
- package/dist/src/utils/dom.d.ts +2 -0
- package/dist/src/utils/geo-utils.d.ts +6 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/math-utils.d.ts +4 -0
- package/dist/src/utils/webgl-utils.d.ts +49 -0
- package/dist/vite.config-test.d.ts +2 -0
- package/dist/vitest-setup-tests.d.ts +1 -0
- package/eslint.config.mjs +2 -1
- package/package.json +17 -6
- 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/MaptilerNavigationControl.d.ts +0 -30
- package/dist/src/MaptilerScaleControl.d.ts +0 -15
- /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
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
|
|
2
2
|
import { Map as SDKMap } from '../Map';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated Please use MaptilerScaleControl from '@maptiler/sdk' instead.
|
|
5
|
-
*/
|
|
6
3
|
export declare class ScaleControl extends maplibregl.ScaleControl {
|
|
7
4
|
onAdd(map: SDKMap | MapMLGL): HTMLElement;
|
|
8
5
|
}
|
package/dist/src/Map.d.ts
CHANGED
|
@@ -2,8 +2,10 @@ 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
|
+
import { CubemapDefinition, CubemapLayer, CubemapLayerConstructorOptions } from './custom-layers/CubemapLayer';
|
|
8
|
+
import { GradientDefinition, RadialGradientLayer, RadialGradientLayerOptions } from './custom-layers/RadialGradientLayer';
|
|
7
9
|
export type LoadWithTerrainEvent = {
|
|
8
10
|
type: "loadWithTerrain";
|
|
9
11
|
target: Map;
|
|
@@ -126,18 +128,29 @@ export type MapOptions = Omit<MapOptionsML, "style" | "maplibreLogo"> & {
|
|
|
126
128
|
*/
|
|
127
129
|
projection?: ProjectionTypes;
|
|
128
130
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
131
|
+
* Turn on/off spacebox.
|
|
132
|
+
*
|
|
133
|
+
* Default: { color: "#1D29F1" }
|
|
132
134
|
*/
|
|
133
|
-
|
|
135
|
+
space?: CubemapLayerConstructorOptions | boolean;
|
|
136
|
+
halo?: RadialGradientLayerOptions | boolean;
|
|
134
137
|
};
|
|
135
138
|
/**
|
|
136
139
|
* The Map class can be instanciated to display a map in a `<div>`
|
|
137
140
|
*/
|
|
138
141
|
export declare class Map extends maplibregl.Map {
|
|
139
|
-
private options;
|
|
140
142
|
readonly telemetry: Telemetry;
|
|
143
|
+
private space?;
|
|
144
|
+
private halo?;
|
|
145
|
+
getSpace(): CubemapLayer | undefined;
|
|
146
|
+
setSpace(space: CubemapDefinition): void;
|
|
147
|
+
private setSpaceFromCurrentStyle;
|
|
148
|
+
private setHaloFromCurrentStyle;
|
|
149
|
+
private initSpace;
|
|
150
|
+
private initHalo;
|
|
151
|
+
getHalo(): RadialGradientLayer | undefined;
|
|
152
|
+
setHalo(halo: GradientDefinition): void;
|
|
153
|
+
private options;
|
|
141
154
|
private isTerrainEnabled;
|
|
142
155
|
private terrainExaggeration;
|
|
143
156
|
private primaryLanguage;
|
|
@@ -155,7 +168,6 @@ export declare class Map extends maplibregl.Map {
|
|
|
155
168
|
private isStyleLocalized;
|
|
156
169
|
private languageIsUpdated;
|
|
157
170
|
constructor(options: MapOptions);
|
|
158
|
-
private checkControlsConfiguration;
|
|
159
171
|
/**
|
|
160
172
|
* Recreates the map instance with the same options.
|
|
161
173
|
* 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,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GeolocateControl } from './MLAdapters/GeolocateControl';
|
|
3
|
-
import { Map as SDKMap } from './Map';
|
|
4
|
-
type MaptilerGeolocateControlOptions = GeolocateControlOptions & {
|
|
5
|
-
geolocateElement?: HTMLElement;
|
|
6
|
-
removeDefaultDOM?: boolean;
|
|
7
|
-
};
|
|
1
|
+
import { GeolocateControl } from '../MLAdapters/GeolocateControl';
|
|
8
2
|
/**
|
|
9
3
|
* The MaptilerGeolocateControl is an extension of the original GeolocateControl
|
|
10
4
|
* with a few changes. In this version, the active mode persists as long as the
|
|
@@ -13,10 +7,6 @@ type MaptilerGeolocateControlOptions = GeolocateControlOptions & {
|
|
|
13
7
|
*/
|
|
14
8
|
export declare class MaptilerGeolocateControl extends GeolocateControl {
|
|
15
9
|
private lastUpdatedCenter;
|
|
16
|
-
private removeDefaultDOM;
|
|
17
|
-
private externalGeolocateElement?;
|
|
18
|
-
constructor(options?: MaptilerGeolocateControlOptions);
|
|
19
|
-
onAdd(map: SDKMap | MapMLGL): HTMLElement;
|
|
20
10
|
/**
|
|
21
11
|
* Update the camera location to center on the current position
|
|
22
12
|
*
|
|
@@ -29,4 +19,3 @@ export declare class MaptilerGeolocateControl extends GeolocateControl {
|
|
|
29
19
|
_onZoom: () => void;
|
|
30
20
|
_setErrorState(): void;
|
|
31
21
|
}
|
|
32
|
-
export {};
|
|
@@ -1,10 +1,9 @@
|
|
|
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;
|
|
7
|
-
defaultControlsEnabled?: boolean;
|
|
8
7
|
};
|
|
9
8
|
/**
|
|
10
9
|
* This LogoControl extends the MapLibre LogoControl but instead can use any image URL and
|
|
@@ -14,10 +13,7 @@ export declare class MaptilerLogoControl extends LogoControl {
|
|
|
14
13
|
_compact: boolean;
|
|
15
14
|
private logoURL;
|
|
16
15
|
private linkURL;
|
|
17
|
-
private defaultControlsEnabled;
|
|
18
16
|
constructor(options?: LogoControlOptions);
|
|
19
17
|
onAdd(map: SDKMap): HTMLElement;
|
|
20
|
-
_createAnchor(): HTMLAnchorElement;
|
|
21
|
-
_externalControlsEnabled(): void;
|
|
22
18
|
}
|
|
23
19
|
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NavigationControlOptions } from 'maplibre-gl';
|
|
2
|
+
import { NavigationControl } from '../MLAdapters/NavigationControl';
|
|
3
|
+
type HTMLButtonElementPlus = HTMLButtonElement & {
|
|
4
|
+
clickFunction: (e?: Event) => unknown;
|
|
5
|
+
};
|
|
6
|
+
export declare class MaptilerNavigationControl extends NavigationControl {
|
|
7
|
+
constructor(options?: NavigationControlOptions);
|
|
8
|
+
/**
|
|
9
|
+
* Overloading: the button now stores its click callback so that we can later on delete it and replace it
|
|
10
|
+
*/
|
|
11
|
+
_createButton(className: string, fn: (e?: Event) => unknown): HTMLButtonElementPlus;
|
|
12
|
+
/**
|
|
13
|
+
* Overloading: Limit how flat the compass icon can get
|
|
14
|
+
*/
|
|
15
|
+
_rotateCompassArrow: () => void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { Map as SDKMap } from '
|
|
1
|
+
import { Map as SDKMap } from '../Map';
|
|
2
2
|
import { IControl } from 'maplibre-gl';
|
|
3
|
-
type MaptilerProjectionControlOptions = {
|
|
4
|
-
removeDefaultDOM?: boolean;
|
|
5
|
-
projectionElement?: HTMLElement;
|
|
6
|
-
};
|
|
7
3
|
/**
|
|
8
4
|
* A `MaptilerProjectionControl` control adds a button to switch from Mercator to Globe projection.
|
|
9
5
|
*/
|
|
@@ -11,14 +7,8 @@ export declare class MaptilerProjectionControl implements IControl {
|
|
|
11
7
|
map: SDKMap;
|
|
12
8
|
container: HTMLElement;
|
|
13
9
|
projectionButton: HTMLButtonElement;
|
|
14
|
-
private externalProjection?;
|
|
15
|
-
private options;
|
|
16
|
-
constructor(options?: MaptilerProjectionControlOptions);
|
|
17
10
|
onAdd(map: SDKMap): HTMLElement;
|
|
18
11
|
onRemove(): void;
|
|
19
|
-
private setupExternalElements;
|
|
20
12
|
private toggleProjection;
|
|
21
|
-
private updateExternalTitle;
|
|
22
13
|
private updateProjectionIcon;
|
|
23
14
|
}
|
|
24
|
-
export {};
|
|
@@ -1,25 +1,16 @@
|
|
|
1
|
-
import { Map as SDKMap } from '
|
|
1
|
+
import { Map as SDKMap } from '../Map';
|
|
2
2
|
import { IControl } from 'maplibre-gl';
|
|
3
3
|
/**
|
|
4
4
|
* A `MaptilerTerrainControl` control adds a button to turn terrain on and off
|
|
5
5
|
* by triggering the terrain logic that is already deployed in the Map object.
|
|
6
6
|
*/
|
|
7
|
-
type MaptilerTerrainControlOptions = {
|
|
8
|
-
removeDefaultDOM?: boolean;
|
|
9
|
-
terrainElement?: HTMLElement;
|
|
10
|
-
};
|
|
11
7
|
export declare class MaptilerTerrainControl implements IControl {
|
|
12
8
|
_map: SDKMap;
|
|
13
9
|
_container: HTMLElement;
|
|
14
10
|
_terrainButton: HTMLButtonElement;
|
|
15
|
-
|
|
16
|
-
private options;
|
|
17
|
-
constructor(options?: MaptilerTerrainControlOptions);
|
|
11
|
+
constructor();
|
|
18
12
|
onAdd(map: SDKMap): HTMLElement;
|
|
19
|
-
private setupInternalElements;
|
|
20
|
-
private setupExternalElements;
|
|
21
13
|
onRemove(): void;
|
|
22
|
-
_toggleTerrain
|
|
23
|
-
_updateTerrainIcon
|
|
14
|
+
_toggleTerrain(): void;
|
|
15
|
+
_updateTerrainIcon(): void;
|
|
24
16
|
}
|
|
25
|
-
export {};
|
|
@@ -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 {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CustomLayerInterface, CustomRenderMethodInput } from 'maplibre-gl';
|
|
2
|
+
import { Map as MapSDK } from '../../Map';
|
|
3
|
+
import { WebGLContext } from '../../utils/webgl-utils';
|
|
4
|
+
import { CubemapDefinition, CubemapLayerConstructorOptions } from './types';
|
|
5
|
+
declare class CubemapLayer implements CustomLayerInterface {
|
|
6
|
+
id: string;
|
|
7
|
+
type: CustomLayerInterface["type"];
|
|
8
|
+
renderingMode: CustomLayerInterface["renderingMode"];
|
|
9
|
+
private map;
|
|
10
|
+
private faces?;
|
|
11
|
+
private useCubemapTexture;
|
|
12
|
+
private currentFadeOpacity;
|
|
13
|
+
private cubeMapNeedsUpdate;
|
|
14
|
+
private bgColor;
|
|
15
|
+
private gl;
|
|
16
|
+
private cubemap?;
|
|
17
|
+
private texture?;
|
|
18
|
+
constructor(cubemapConfig: CubemapLayerConstructorOptions | true);
|
|
19
|
+
updateCubemap(): void;
|
|
20
|
+
onAdd(map: MapSDK, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
|
|
21
|
+
onRemove(_map: MapSDK, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
|
|
22
|
+
prerender(gl: WebGLContext, _options: CustomRenderMethodInput): void;
|
|
23
|
+
private animateIn;
|
|
24
|
+
render(gl: WebGLRenderingContext | WebGL2RenderingContext, _options: CustomRenderMethodInput): void;
|
|
25
|
+
setCubemap(cubemap: CubemapDefinition): void;
|
|
26
|
+
show(): void;
|
|
27
|
+
hide(): void;
|
|
28
|
+
}
|
|
29
|
+
export { CubemapLayer };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare enum CubemapImagesPresets {
|
|
2
|
+
UNIVERSE_DARK = "universe-dark"
|
|
3
|
+
}
|
|
4
|
+
export type CubemapLayerConstructorOptions = CubemapDefinition & {};
|
|
5
|
+
export type CubemapDefinition = {
|
|
6
|
+
path: {
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
format?: "png" | "jpg" | "webp";
|
|
9
|
+
};
|
|
10
|
+
faces?: never;
|
|
11
|
+
preset?: never;
|
|
12
|
+
color?: string;
|
|
13
|
+
} | {
|
|
14
|
+
faces: CubemapFaces;
|
|
15
|
+
path?: never;
|
|
16
|
+
preset?: never;
|
|
17
|
+
color?: string;
|
|
18
|
+
} | {
|
|
19
|
+
preset: string;
|
|
20
|
+
path?: never;
|
|
21
|
+
faces?: never;
|
|
22
|
+
color?: string;
|
|
23
|
+
} | {
|
|
24
|
+
color: string;
|
|
25
|
+
path?: never;
|
|
26
|
+
faces?: never;
|
|
27
|
+
preset?: never;
|
|
28
|
+
};
|
|
29
|
+
export declare enum CubemapFaceNames {
|
|
30
|
+
POSITIVE_X = "pX",
|
|
31
|
+
NEGATIVE_X = "nX",
|
|
32
|
+
POSITIVE_Y = "pY",
|
|
33
|
+
NEGATIVE_Y = "nY",
|
|
34
|
+
POSITIVE_Z = "pZ",
|
|
35
|
+
NEGATIVE_Z = "nZ"
|
|
36
|
+
}
|
|
37
|
+
export type CubemapFaces = Record<CubemapFaceNames, string>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CustomLayerInterface, CustomRenderMethodInput } from 'maplibre-gl';
|
|
2
|
+
import { Map as MapSDK } from '../../Map';
|
|
3
|
+
import { GradientDefinition, RadialGradientLayerOptions } from './types';
|
|
4
|
+
export declare class RadialGradientLayer implements CustomLayerInterface {
|
|
5
|
+
id: string;
|
|
6
|
+
type: CustomLayerInterface["type"];
|
|
7
|
+
renderingMode: CustomLayerInterface["renderingMode"];
|
|
8
|
+
private gradient;
|
|
9
|
+
private scale;
|
|
10
|
+
private map;
|
|
11
|
+
private plane?;
|
|
12
|
+
constructor(gradient: RadialGradientLayerOptions | boolean);
|
|
13
|
+
onAdd(map: MapSDK, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
|
|
14
|
+
onRemove(_map: MapSDK, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
|
|
15
|
+
prerender(_gl: WebGLRenderingContext | WebGL2RenderingContext, _options: CustomRenderMethodInput): void;
|
|
16
|
+
render(gl: WebGLRenderingContext | WebGL2RenderingContext, options: CustomRenderMethodInput): void;
|
|
17
|
+
/**
|
|
18
|
+
* Value settings methods
|
|
19
|
+
*/
|
|
20
|
+
setGradient(gradient: GradientDefinition): void;
|
|
21
|
+
show(): void;
|
|
22
|
+
hide(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Object3D } from '../../utils/webgl-utils';
|
|
2
|
+
export type Color = string;
|
|
3
|
+
export type GradientStop = number;
|
|
4
|
+
export type RadialGradientLayerOptions = GradientDefinition;
|
|
5
|
+
export type GradientDefinition = {
|
|
6
|
+
stops: Array<[GradientStop, Color]>;
|
|
7
|
+
scale: number;
|
|
8
|
+
};
|
|
9
|
+
export type GradientAttributeKey = "vertexPosition";
|
|
10
|
+
export type GradientUniformKey = "stopsNumber" | "stops" | "colors";
|
|
11
|
+
export type GradientPlaneObject3D = Pick<Object3D<GradientAttributeKey, GradientUniformKey>, "shaderProgram" | "programInfo" | "positionBuffer">;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Map as MapSDK } from '../Map';
|
|
2
|
+
import { StyleSpecification } from 'maplibre-gl';
|
|
3
|
+
import { CubemapLayerConstructorOptions, RadialGradientLayerOptions } from 'custom-layers';
|
|
4
|
+
export type StyleSpecificationWithMetaData = StyleSpecification & {
|
|
5
|
+
metadata?: {
|
|
6
|
+
"maptiler:copyright": string;
|
|
7
|
+
maptiler?: {
|
|
8
|
+
halo: RadialGradientLayerOptions;
|
|
9
|
+
space: CubemapLayerConstructorOptions;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export interface IExtractCustomLayerStyleOptions {
|
|
14
|
+
map: MapSDK;
|
|
15
|
+
property: "halo" | "space";
|
|
16
|
+
}
|
|
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;
|
|
@@ -73,19 +74,14 @@ export { TwoFingersTouchPitchHandler } from './MLAdapters/TwoFingersTouchPitchHa
|
|
|
73
74
|
export { MapWheelEvent } from './MLAdapters/MapWheelEvent';
|
|
74
75
|
export { MapTouchEvent } from './MLAdapters/MapTouchEvent';
|
|
75
76
|
export { MapMouseEvent } from './MLAdapters/MapMouseEvent';
|
|
76
|
-
export { Map, GeolocationType, type MapOptions, type LoadWithTerrainEvent
|
|
77
|
-
export * from './
|
|
78
|
-
export * from './MaptilerLogoControl';
|
|
79
|
-
export * from './MaptilerTerrainControl';
|
|
80
|
-
export * from './MaptilerNavigationControl';
|
|
81
|
-
export * from './MaptilerProjectionControl';
|
|
82
|
-
export * from './MaptilerScaleControl';
|
|
77
|
+
export { Map, GeolocationType, type MapOptions, type LoadWithTerrainEvent } from './Map';
|
|
78
|
+
export * from './controls';
|
|
83
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';
|
|
84
80
|
export { getWebGLSupportError, displayWebGLContextLostWarning } from './tools';
|
|
85
81
|
export { config, SdkConfig } from './config';
|
|
86
82
|
export * from './language';
|
|
87
|
-
export type { Unit } from './
|
|
88
|
-
export * from './Minimap';
|
|
83
|
+
export type { Unit } from './types';
|
|
89
84
|
export * from './converters';
|
|
90
|
-
export * from './
|
|
91
|
-
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,49 @@
|
|
|
1
|
+
export type WebGLContext = WebGLRenderingContext | WebGL2RenderingContext;
|
|
2
|
+
/**
|
|
3
|
+
* Load a shader from a source string
|
|
4
|
+
*/
|
|
5
|
+
export declare function loadShader({ gl, type, source }: {
|
|
6
|
+
gl: WebGLContext;
|
|
7
|
+
type: GLenum;
|
|
8
|
+
source: string;
|
|
9
|
+
}): WebGLShader;
|
|
10
|
+
/**
|
|
11
|
+
* Create a set of shaders (vertex and fragment) and link them into a program
|
|
12
|
+
*
|
|
13
|
+
* @param gl WebGL context
|
|
14
|
+
* @param vertexShaderSource Vertex shader source code
|
|
15
|
+
* @param fragmentShaderSource Fragment shader source code
|
|
16
|
+
*
|
|
17
|
+
* @returns WebGL program
|
|
18
|
+
*/
|
|
19
|
+
export declare function createShadersSetProgram({ gl, vertexShaderSource, fragmentShaderSource }: {
|
|
20
|
+
gl: WebGLContext;
|
|
21
|
+
vertexShaderSource: string;
|
|
22
|
+
fragmentShaderSource: string;
|
|
23
|
+
}): WebGLProgram;
|
|
24
|
+
/**
|
|
25
|
+
* null-free version of getUniformLocation
|
|
26
|
+
*/
|
|
27
|
+
export declare function getUniformLocation(gl: WebGLRenderingContext | WebGL2RenderingContext, program: WebGLProgram, name: string): WebGLUniformLocation;
|
|
28
|
+
export type Object3D<Attribute extends string, Uniform extends string> = {
|
|
29
|
+
shaderProgram: WebGLProgram;
|
|
30
|
+
programInfo: {
|
|
31
|
+
attributesLocations: Record<Attribute, number>;
|
|
32
|
+
uniformsLocations: Record<Uniform, WebGLUniformLocation>;
|
|
33
|
+
};
|
|
34
|
+
positionBuffer: WebGLBuffer;
|
|
35
|
+
indexBuffer?: WebGLBuffer;
|
|
36
|
+
indexBufferLength?: number;
|
|
37
|
+
};
|
|
38
|
+
export declare function createObject3D<Attribute extends string, Uniform extends string>({ gl, vertexShaderSource, fragmentShaderSource, attributesKeys, uniformsKeys, vertices, indices, }: {
|
|
39
|
+
gl: WebGLContext;
|
|
40
|
+
vertexShaderSource: string;
|
|
41
|
+
fragmentShaderSource: string;
|
|
42
|
+
attributesKeys: readonly Attribute[];
|
|
43
|
+
uniformsKeys: readonly Uniform[];
|
|
44
|
+
vertices: Array<number>;
|
|
45
|
+
indices?: Array<number>;
|
|
46
|
+
}): Object3D<Attribute, Uniform>;
|
|
47
|
+
export type Vec4 = [number, number, number, number];
|
|
48
|
+
export declare function parseColorStringToVec4(color?: string): Vec4;
|
|
49
|
+
export declare function degreesToRadians(degrees: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/eslint.config.mjs
CHANGED
|
@@ -27,6 +27,7 @@ export default tseslint.config(
|
|
|
27
27
|
"@typescript-eslint/no-base-to-string": "warn",
|
|
28
28
|
"@typescript-eslint/no-confusing-void-expression": "warn",
|
|
29
29
|
"@typescript-eslint/no-explicit-any": "warn",
|
|
30
|
+
"@typescript-eslint/no-empty-function": "warn", // this is to satisfy maplibre-gl custom layer interface
|
|
30
31
|
"@typescript-eslint/no-floating-promises": "warn",
|
|
31
32
|
"@typescript-eslint/no-inferrable-types": "off",
|
|
32
33
|
"@typescript-eslint/no-misused-promises": "warn",
|
|
@@ -34,7 +35,7 @@ export default tseslint.config(
|
|
|
34
35
|
"@typescript-eslint/no-unnecessary-condition": "warn",
|
|
35
36
|
"@typescript-eslint/no-unnecessary-type-arguments": "off",
|
|
36
37
|
"@typescript-eslint/no-unnecessary-type-assertion": "off",
|
|
37
|
-
"@typescript-eslint/no-unnecessary-type-parameters": "
|
|
38
|
+
"@typescript-eslint/no-unnecessary-type-parameters": "off", // as we are a lib, types serve as documentation
|
|
38
39
|
"@typescript-eslint/no-unused-vars": "warn",
|
|
39
40
|
"@typescript-eslint/no-unsafe-argument": "warn",
|
|
40
41
|
"@typescript-eslint/no-unsafe-assignment": "warn",
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maptiler/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0-rc2",
|
|
4
4
|
"description": "The Javascript & TypeScript map SDK tailored for MapTiler Cloud",
|
|
5
5
|
"author": "MapTiler",
|
|
6
6
|
"module": "dist/maptiler-sdk.mjs",
|
|
7
7
|
"types": "dist/maptiler-sdk.d.ts",
|
|
8
8
|
"style": "dist/maptiler-sdk.css",
|
|
9
9
|
"type": "module",
|
|
10
|
+
"main": "dist/maptiler-sdk.mjs",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
13
|
"import": "./dist/maptiler-sdk.mjs",
|
|
@@ -38,9 +39,10 @@
|
|
|
38
39
|
"prepare": "husky",
|
|
39
40
|
"doc": "rm -rf docs/* && typedoc --out docs && cp -r images docs/",
|
|
40
41
|
"ncu": "npx npm-check-updates",
|
|
41
|
-
"lint": "
|
|
42
|
-
"lint:fix": "
|
|
43
|
-
"test": "vitest
|
|
42
|
+
"lint": "eslint src",
|
|
43
|
+
"lint:fix": "eslint src --fix",
|
|
44
|
+
"test:watch": "vitest watch -c vite.config-test.ts --dom",
|
|
45
|
+
"test": "vitest run -c vite.config-test.ts --dom",
|
|
44
46
|
"install:clean": "rm -rf build/ dist/ node_modules/ && npm ci",
|
|
45
47
|
"dev": "concurrently \"vite -c vite.config-dev.ts\" \"npm run dev-umd\"",
|
|
46
48
|
"dev-umd": "npm run build-css && tsc && NODE_ENV=development vite build -w -c vite.config-umd.ts",
|
|
@@ -53,15 +55,23 @@
|
|
|
53
55
|
"lint-staged": {
|
|
54
56
|
"*.ts": "npm run lint:fix"
|
|
55
57
|
},
|
|
58
|
+
"ts-typecheck": {
|
|
59
|
+
"*.ts": "npm tsc --noEmit"
|
|
60
|
+
},
|
|
56
61
|
"devDependencies": {
|
|
62
|
+
"@canvas/image-data": "^1.0.0",
|
|
57
63
|
"@eslint/js": "^9.21.0",
|
|
64
|
+
"@types/color-convert": "^2.0.4",
|
|
65
|
+
"@types/color-name": "^2.0.0",
|
|
58
66
|
"@types/uuid": "^10.0.0",
|
|
59
67
|
"@types/xmldom": "^0.1.31",
|
|
68
|
+
"@vitest/web-worker": "^3.0.9",
|
|
60
69
|
"@xmldom/xmldom": "^0.8.10",
|
|
61
70
|
"concurrently": "^9.1.2",
|
|
62
71
|
"eslint": "^9.21.0",
|
|
63
72
|
"eslint-config-prettier": "^10.0.2",
|
|
64
73
|
"eslint-plugin-prettier": "^5.2.3",
|
|
74
|
+
"happy-dom": "^17.4.4",
|
|
65
75
|
"husky": "^8.0.0",
|
|
66
76
|
"lint-staged": "^15.4.3",
|
|
67
77
|
"prettier": "3.5.2",
|
|
@@ -70,12 +80,13 @@
|
|
|
70
80
|
"typescript-eslint": "^8.25.0",
|
|
71
81
|
"vite": "^6.0.7",
|
|
72
82
|
"vite-plugin-dts": "^4.5.0",
|
|
73
|
-
"vitest": "^
|
|
83
|
+
"vitest": "^3.0.9"
|
|
74
84
|
},
|
|
75
85
|
"dependencies": {
|
|
76
86
|
"@maplibre/maplibre-gl-style-spec": "^23.0.0",
|
|
77
|
-
"@maptiler/client": "^2.
|
|
87
|
+
"@maptiler/client": "^2.3.0",
|
|
78
88
|
"events": "^3.3.0",
|
|
89
|
+
"gl-matrix": "^3.4.3",
|
|
79
90
|
"js-base64": "^3.7.7",
|
|
80
91
|
"maplibre-gl": "^5.0.1",
|
|
81
92
|
"uuid": "^11.0.5"
|
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
|
})
|