@maptiler/sdk 3.1.0-rc8 → 3.1.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.
- package/.husky/pre-commit +0 -1
- package/README.md +7 -118
- package/dist/maptiler-sdk.mjs +2092 -3242
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/src/Map.d.ts +1 -20
- package/dist/src/helpers/index.d.ts +3 -13
- package/eslint.config.mjs +1 -1
- package/package.json +2 -9
- package/dist/src/custom-layers/CubemapLayer/CubemapLayer.d.ts +0 -29
- package/dist/src/custom-layers/CubemapLayer/constants.d.ts +0 -3
- package/dist/src/custom-layers/CubemapLayer/index.d.ts +0 -2
- package/dist/src/custom-layers/CubemapLayer/loadCubemapTexture.d.ts +0 -6
- package/dist/src/custom-layers/CubemapLayer/types.d.ts +0 -37
- package/dist/src/custom-layers/RadialGradientLayer/RadialGradientLayer.d.ts +0 -23
- package/dist/src/custom-layers/RadialGradientLayer/index.d.ts +0 -2
- package/dist/src/custom-layers/RadialGradientLayer/types.d.ts +0 -11
- package/dist/src/custom-layers/extractCustomLayerStyle.d.ts +0 -17
- package/dist/src/custom-layers/index.d.ts +0 -5
- package/dist/src/utils/geo-utils.d.ts +0 -6
- package/dist/src/utils/math-utils.d.ts +0 -4
- package/dist/src/utils/webgl-utils.d.ts +0 -49
package/dist/src/Map.d.ts
CHANGED
|
@@ -4,8 +4,6 @@ import { SdkConfig } from './config';
|
|
|
4
4
|
import { LanguageInfo } from './language';
|
|
5
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';
|
|
9
7
|
export type LoadWithTerrainEvent = {
|
|
10
8
|
type: "loadWithTerrain";
|
|
11
9
|
target: Map;
|
|
@@ -127,30 +125,13 @@ export type MapOptions = Omit<MapOptionsML, "style" | "maplibreLogo"> & {
|
|
|
127
125
|
* If not provided, the style takes precedence. If provided, overwrite the style.
|
|
128
126
|
*/
|
|
129
127
|
projection?: ProjectionTypes;
|
|
130
|
-
/**
|
|
131
|
-
* Turn on/off spacebox.
|
|
132
|
-
*
|
|
133
|
-
* Default: { color: "#1D29F1" }
|
|
134
|
-
*/
|
|
135
|
-
space?: CubemapLayerConstructorOptions | boolean;
|
|
136
|
-
halo?: RadialGradientLayerOptions | boolean;
|
|
137
128
|
};
|
|
138
129
|
/**
|
|
139
130
|
* The Map class can be instanciated to display a map in a `<div>`
|
|
140
131
|
*/
|
|
141
132
|
export declare class Map extends maplibregl.Map {
|
|
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
133
|
private options;
|
|
134
|
+
readonly telemetry: Telemetry;
|
|
154
135
|
private isTerrainEnabled;
|
|
155
136
|
private terrainExaggeration;
|
|
156
137
|
private primaryLanguage;
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
/**
|
|
5
|
-
* Helpers are a set of functions to facilitate the creation of sources and layers
|
|
6
|
-
*/
|
|
7
|
-
export declare const helpers: {
|
|
8
|
-
addPolyline: typeof addPolyline;
|
|
9
|
-
addPolygon: typeof addPolygon;
|
|
10
|
-
addPoint: typeof addPoint;
|
|
11
|
-
addHeatmap: typeof addHeatmap;
|
|
12
|
-
takeScreenshot: typeof takeScreenshot;
|
|
13
|
-
};
|
|
1
|
+
export * from './screenshot';
|
|
2
|
+
export * from './vectorlayerhelpers';
|
|
3
|
+
export * from './stylehelper';
|
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": "warn",
|
|
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,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maptiler/sdk",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
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",
|
|
11
10
|
"exports": {
|
|
12
11
|
".": {
|
|
13
12
|
"import": "./dist/maptiler-sdk.mjs",
|
|
@@ -55,14 +54,9 @@
|
|
|
55
54
|
"lint-staged": {
|
|
56
55
|
"*.ts": "npm run lint:fix"
|
|
57
56
|
},
|
|
58
|
-
"ts-typecheck": {
|
|
59
|
-
"*.ts": "npm tsc --noEmit"
|
|
60
|
-
},
|
|
61
57
|
"devDependencies": {
|
|
62
58
|
"@canvas/image-data": "^1.0.0",
|
|
63
59
|
"@eslint/js": "^9.21.0",
|
|
64
|
-
"@types/color-convert": "^2.0.4",
|
|
65
|
-
"@types/color-name": "^2.0.0",
|
|
66
60
|
"@types/uuid": "^10.0.0",
|
|
67
61
|
"@types/xmldom": "^0.1.31",
|
|
68
62
|
"@vitest/web-worker": "^3.0.9",
|
|
@@ -84,9 +78,8 @@
|
|
|
84
78
|
},
|
|
85
79
|
"dependencies": {
|
|
86
80
|
"@maplibre/maplibre-gl-style-spec": "^23.0.0",
|
|
87
|
-
"@maptiler/client": "^2.
|
|
81
|
+
"@maptiler/client": "^2.3.1",
|
|
88
82
|
"events": "^3.3.0",
|
|
89
|
-
"gl-matrix": "^3.4.3",
|
|
90
83
|
"js-base64": "^3.7.7",
|
|
91
84
|
"maplibre-gl": "^5.0.1",
|
|
92
85
|
"uuid": "^11.0.5"
|
|
@@ -1,29 +0,0 @@
|
|
|
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 };
|
|
@@ -1,37 +0,0 @@
|
|
|
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>;
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
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">;
|
|
@@ -1,17 +0,0 @@
|
|
|
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,49 +0,0 @@
|
|
|
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;
|