@maptiler/sdk 3.0.1 → 3.1.0-rc1
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 +1 -0
- package/README.md +24 -6
- package/dist/eslint.config.d.mts +2 -0
- package/dist/maptiler-sdk.mjs +3300 -2171
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/src/MLAdapters/MapMouseEvent.d.ts +1 -1
- package/dist/src/Map.d.ts +21 -0
- package/dist/src/config.d.ts +1 -1
- 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 +18 -0
- package/dist/src/custom-layers/index.d.ts +5 -0
- package/dist/src/index.d.ts +2 -2
- package/dist/src/tools.d.ts +3 -5
- package/dist/src/utils/geo-utils.d.ts +6 -0
- package/dist/src/utils/math-utils.d.ts +4 -0
- package/dist/src/utils/webgl-utils.d.ts +49 -0
- package/eslint.config.mjs +61 -0
- package/package.json +24 -9
- package/tsconfig.json +10 -6
- package/biome.json +0 -50
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
|
|
2
2
|
import { Map as SDKMap } from '../Map';
|
|
3
3
|
export declare class MapMouseEvent extends maplibregl.MapMouseEvent {
|
|
4
|
-
constructor(type: string, map: SDKMap | MapMLGL, originalEvent: MouseEvent, data?:
|
|
4
|
+
constructor(type: string, map: SDKMap | MapMLGL, originalEvent: MouseEvent, data?: Record<string, unknown>);
|
|
5
5
|
}
|
package/dist/src/Map.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { SdkConfig } from './config';
|
|
|
4
4
|
import { LanguageInfo } from './language';
|
|
5
5
|
import { MinimapOptionsInput } from './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;
|
|
@@ -125,12 +127,26 @@ export type MapOptions = Omit<MapOptionsML, "style" | "maplibreLogo"> & {
|
|
|
125
127
|
* If not provided, the style takes precedence. If provided, overwrite the style.
|
|
126
128
|
*/
|
|
127
129
|
projection?: ProjectionTypes;
|
|
130
|
+
/**
|
|
131
|
+
* Turn on/off spacebox.
|
|
132
|
+
*
|
|
133
|
+
* Default: { color: "#1D29F1" }
|
|
134
|
+
*/
|
|
135
|
+
space?: CubemapLayerConstructorOptions | boolean;
|
|
136
|
+
halo?: RadialGradientLayerOptions | boolean;
|
|
128
137
|
};
|
|
129
138
|
/**
|
|
130
139
|
* The Map class can be instanciated to display a map in a `<div>`
|
|
131
140
|
*/
|
|
132
141
|
export declare class Map extends maplibregl.Map {
|
|
133
142
|
readonly telemetry: Telemetry;
|
|
143
|
+
private space?;
|
|
144
|
+
private halo?;
|
|
145
|
+
getSpace(): CubemapLayer | undefined;
|
|
146
|
+
setSpace(space: CubemapDefinition): void;
|
|
147
|
+
getHalo(): RadialGradientLayer | undefined;
|
|
148
|
+
setHalo(halo: GradientDefinition): void;
|
|
149
|
+
private options;
|
|
134
150
|
private isTerrainEnabled;
|
|
135
151
|
private terrainExaggeration;
|
|
136
152
|
private primaryLanguage;
|
|
@@ -148,6 +164,11 @@ export declare class Map extends maplibregl.Map {
|
|
|
148
164
|
private isStyleLocalized;
|
|
149
165
|
private languageIsUpdated;
|
|
150
166
|
constructor(options: MapOptions);
|
|
167
|
+
/**
|
|
168
|
+
* Recreates the map instance with the same options.
|
|
169
|
+
* Useful for WebGL context loss.
|
|
170
|
+
*/
|
|
171
|
+
recreate(): void;
|
|
151
172
|
/**
|
|
152
173
|
* Set the duration (millisec) of the terrain animation for growing or flattening.
|
|
153
174
|
* Must be positive. (Built-in default: `1000` milliseconds)
|
package/dist/src/config.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ declare class SdkConfig extends EventEmitter {
|
|
|
45
45
|
* - if terrain is activated at initialization [boolean]
|
|
46
46
|
* - if globe projection is activated at initialization [boolean]
|
|
47
47
|
*
|
|
48
|
-
* In addition, each official module will be
|
|
48
|
+
* In addition, each official module will be added to a list, alongside its version number.
|
|
49
49
|
*/
|
|
50
50
|
telemetry: boolean;
|
|
51
51
|
/**
|
|
@@ -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,18 @@
|
|
|
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 type CustomLayerDefinitionType = CubemapLayerConstructorOptions | RadialGradientLayerOptions | null;
|
|
18
|
+
export default function extractCustomLayerStyle(options: IExtractCustomLayerStyleOptions): CustomLayerDefinitionType;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -73,14 +73,14 @@ export { TwoFingersTouchPitchHandler } from './MLAdapters/TwoFingersTouchPitchHa
|
|
|
73
73
|
export { MapWheelEvent } from './MLAdapters/MapWheelEvent';
|
|
74
74
|
export { MapTouchEvent } from './MLAdapters/MapTouchEvent';
|
|
75
75
|
export { MapMouseEvent } from './MLAdapters/MapMouseEvent';
|
|
76
|
-
export { Map, GeolocationType, type MapOptions, type LoadWithTerrainEvent
|
|
76
|
+
export { Map, GeolocationType, type MapOptions, type LoadWithTerrainEvent } from './Map';
|
|
77
77
|
export * from './MaptilerGeolocateControl';
|
|
78
78
|
export * from './MaptilerLogoControl';
|
|
79
79
|
export * from './MaptilerTerrainControl';
|
|
80
80
|
export * from './MaptilerNavigationControl';
|
|
81
81
|
export * from './MaptilerProjectionControl';
|
|
82
82
|
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
|
-
export { getWebGLSupportError } from './tools';
|
|
83
|
+
export { getWebGLSupportError, displayWebGLContextLostWarning } from './tools';
|
|
84
84
|
export { config, SdkConfig } from './config';
|
|
85
85
|
export * from './language';
|
|
86
86
|
export type { Unit } from './unit';
|
package/dist/src/tools.d.ts
CHANGED
|
@@ -45,9 +45,9 @@ export declare function getWebGLSupportError(): string | null;
|
|
|
45
45
|
*/
|
|
46
46
|
export declare function displayNoWebGlWarning(container: HTMLElement | string): void;
|
|
47
47
|
/**
|
|
48
|
-
* Display
|
|
48
|
+
* Display a warning message in the Map div if the WebGL context was lost
|
|
49
49
|
*/
|
|
50
|
-
export declare function displayWebGLContextLostWarning(
|
|
50
|
+
export declare function displayWebGLContextLostWarning(map: MapSDK): void;
|
|
51
51
|
/**
|
|
52
52
|
* In a text-field style property (as an object, not a string) the languages that are specified as
|
|
53
53
|
* ["get", "name:XX"] are replaced by the proved replacer (also an object).
|
|
@@ -82,7 +82,5 @@ export declare function findLanguageStr(str: string): Array<string | null>;
|
|
|
82
82
|
export declare function findLanguageObj(origExpr: maplibregl.ExpressionSpecification): Array<string | null>;
|
|
83
83
|
export declare function computeLabelsLocalizationMetrics(layers: maplibregl.LayerSpecification[], map: MapSDK): {
|
|
84
84
|
unlocalized: number;
|
|
85
|
-
localized:
|
|
86
|
-
[k: string]: number;
|
|
87
|
-
};
|
|
85
|
+
localized: Record<string, number>;
|
|
88
86
|
};
|
|
@@ -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,61 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import tseslint from "typescript-eslint";
|
|
4
|
+
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
5
|
+
|
|
6
|
+
export default tseslint.config(
|
|
7
|
+
// https://typescript-eslint.io/getting-started/typed-linting/
|
|
8
|
+
tseslint.configs.strictTypeChecked,
|
|
9
|
+
tseslint.configs.stylisticTypeChecked,
|
|
10
|
+
tseslint.configs.recommendedTypeChecked,
|
|
11
|
+
{
|
|
12
|
+
languageOptions: {
|
|
13
|
+
parserOptions: {
|
|
14
|
+
projectService: true,
|
|
15
|
+
tsconfigRootDir: import.meta.dirname,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
// https://github.com/prettier/eslint-plugin-prettier
|
|
20
|
+
eslintPluginPrettierRecommended,
|
|
21
|
+
//
|
|
22
|
+
{
|
|
23
|
+
rules: {
|
|
24
|
+
"@typescript-eslint/array-type": "off",
|
|
25
|
+
"@typescript-eslint/consistent-indexed-object-style": "warn",
|
|
26
|
+
"@typescript-eslint/consistent-type-definitions": "off",
|
|
27
|
+
"@typescript-eslint/no-base-to-string": "warn",
|
|
28
|
+
"@typescript-eslint/no-confusing-void-expression": "warn",
|
|
29
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
30
|
+
"@typescript-eslint/no-empty-function": "warn", // this is to satisfy maplibre-gl custom layer interface
|
|
31
|
+
"@typescript-eslint/no-floating-promises": "warn",
|
|
32
|
+
"@typescript-eslint/no-inferrable-types": "off",
|
|
33
|
+
"@typescript-eslint/no-misused-promises": "warn",
|
|
34
|
+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "off",
|
|
35
|
+
"@typescript-eslint/no-unnecessary-condition": "warn",
|
|
36
|
+
"@typescript-eslint/no-unnecessary-type-arguments": "off",
|
|
37
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "off",
|
|
38
|
+
"@typescript-eslint/no-unnecessary-type-parameters": "warn",
|
|
39
|
+
"@typescript-eslint/no-unused-vars": "warn",
|
|
40
|
+
"@typescript-eslint/no-unsafe-argument": "warn",
|
|
41
|
+
"@typescript-eslint/no-unsafe-assignment": "warn",
|
|
42
|
+
"@typescript-eslint/no-unsafe-call": "warn",
|
|
43
|
+
"@typescript-eslint/no-unsafe-enum-comparison": "off",
|
|
44
|
+
"@typescript-eslint/no-unsafe-member-access": "warn",
|
|
45
|
+
"@typescript-eslint/no-unsafe-return": "warn",
|
|
46
|
+
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
47
|
+
"@typescript-eslint/non-nullable-type-assertion-style": "warn",
|
|
48
|
+
"@typescript-eslint/prefer-for-of": "off",
|
|
49
|
+
"@typescript-eslint/prefer-nullish-coalescing": "warn",
|
|
50
|
+
"@typescript-eslint/prefer-optional-chain": "off",
|
|
51
|
+
"@typescript-eslint/prefer-return-this-type": "off",
|
|
52
|
+
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
|
|
53
|
+
"@typescript-eslint/restrict-plus-operands": "warn",
|
|
54
|
+
"@typescript-eslint/restrict-template-expressions": "warn",
|
|
55
|
+
"@typescript-eslint/related-getter-setter-pairs": "off",
|
|
56
|
+
"@typescript-eslint/unbound-method": "warn",
|
|
57
|
+
"@typescript-eslint/use-unknown-in-catch-callback-variable": "warn",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
//
|
|
61
|
+
);
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maptiler/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0rc1",
|
|
4
4
|
"description": "The Javascript & TypeScript map SDK tailored for MapTiler Cloud",
|
|
5
|
+
"author": "MapTiler",
|
|
5
6
|
"module": "dist/maptiler-sdk.mjs",
|
|
6
7
|
"types": "dist/maptiler-sdk.d.ts",
|
|
7
8
|
"style": "dist/maptiler-sdk.css",
|
|
@@ -34,28 +35,41 @@
|
|
|
34
35
|
"url": "https://github.com/maptiler/maptiler-sdk-js.git"
|
|
35
36
|
},
|
|
36
37
|
"scripts": {
|
|
37
|
-
"
|
|
38
|
-
"biome:fix": "npx @biomejs/biome check --max-diagnostics=1000 --write",
|
|
38
|
+
"prepare": "husky",
|
|
39
39
|
"doc": "rm -rf docs/* && typedoc --out docs && cp -r images docs/",
|
|
40
|
+
"ncu": "npx npm-check-updates",
|
|
41
|
+
"lint": "npx eslint src",
|
|
42
|
+
"lint:fix": "npx eslint src --fix",
|
|
40
43
|
"test": "vitest run -c vite.config-test.ts",
|
|
44
|
+
"install:clean": "rm -rf build/ dist/ node_modules/ && npm ci",
|
|
45
|
+
"dev": "concurrently \"vite -c vite.config-dev.ts\" \"npm run dev-umd\"",
|
|
46
|
+
"dev-umd": "npm run build-css && tsc && NODE_ENV=development vite build -w -c vite.config-umd.ts",
|
|
41
47
|
"build-css": "mkdir -p dist build && node scripts/replace-path-with-content.js src/style/style_template.css dist/tmp_maptiler-sdk.css && cat node_modules/maplibre-gl/dist/maplibre-gl.css dist/tmp_maptiler-sdk.css > dist/maptiler-sdk.css && rm dist/tmp_maptiler-sdk.css && cp dist/maptiler-sdk.css build/maptiler-sdk.css",
|
|
42
48
|
"build-umd": "tsc && NODE_ENV=production vite build -c vite.config-umd.ts",
|
|
43
49
|
"build-es": "tsc && NODE_ENV=production vite build -c vite.config-es.ts",
|
|
44
50
|
"build": "npm run build-es; npm run build-umd; npm run build-css",
|
|
45
|
-
"make": "npm run
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
51
|
+
"make": "npm run install:clean && npm run build"
|
|
52
|
+
},
|
|
53
|
+
"lint-staged": {
|
|
54
|
+
"*.ts": "npm run lint:fix"
|
|
49
55
|
},
|
|
50
|
-
"author": "MapTiler",
|
|
51
56
|
"devDependencies": {
|
|
52
|
-
"@
|
|
57
|
+
"@eslint/js": "^9.21.0",
|
|
58
|
+
"@types/color-convert": "^2.0.4",
|
|
59
|
+
"@types/color-name": "^2.0.0",
|
|
53
60
|
"@types/uuid": "^10.0.0",
|
|
54
61
|
"@types/xmldom": "^0.1.31",
|
|
55
62
|
"@xmldom/xmldom": "^0.8.10",
|
|
56
63
|
"concurrently": "^9.1.2",
|
|
64
|
+
"eslint": "^9.21.0",
|
|
65
|
+
"eslint-config-prettier": "^10.0.2",
|
|
66
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
67
|
+
"husky": "^8.0.0",
|
|
68
|
+
"lint-staged": "^15.4.3",
|
|
69
|
+
"prettier": "3.5.2",
|
|
57
70
|
"typedoc": "^0.27.6",
|
|
58
71
|
"typescript": "^5.7.3",
|
|
72
|
+
"typescript-eslint": "^8.25.0",
|
|
59
73
|
"vite": "^6.0.7",
|
|
60
74
|
"vite-plugin-dts": "^4.5.0",
|
|
61
75
|
"vitest": "^2.1.8"
|
|
@@ -64,6 +78,7 @@
|
|
|
64
78
|
"@maplibre/maplibre-gl-style-spec": "^23.0.0",
|
|
65
79
|
"@maptiler/client": "^2.2.0",
|
|
66
80
|
"events": "^3.3.0",
|
|
81
|
+
"gl-matrix": "^3.4.3",
|
|
67
82
|
"js-base64": "^3.7.7",
|
|
68
83
|
"maplibre-gl": "^5.0.1",
|
|
69
84
|
"uuid": "^11.0.5"
|
package/tsconfig.json
CHANGED
|
@@ -5,23 +5,27 @@
|
|
|
5
5
|
"target": "es2021",
|
|
6
6
|
"useDefineForClassFields": true,
|
|
7
7
|
"module": "ESNext",
|
|
8
|
-
"lib": [
|
|
8
|
+
"lib": [
|
|
9
|
+
"es2021",
|
|
10
|
+
"DOM",
|
|
11
|
+
"DOM.Iterable"
|
|
12
|
+
],
|
|
9
13
|
"skipLibCheck": true,
|
|
10
|
-
|
|
11
14
|
/* Bundler mode */
|
|
12
15
|
"resolveJsonModule": true,
|
|
13
16
|
"isolatedModules": true,
|
|
14
17
|
"noEmit": true,
|
|
15
|
-
|
|
16
18
|
/* Linting */
|
|
17
19
|
"strict": true,
|
|
18
20
|
"noUnusedLocals": true,
|
|
19
21
|
"noUnusedParameters": true,
|
|
20
22
|
"noFallthroughCasesInSwitch": true,
|
|
21
|
-
|
|
22
|
-
|
|
23
23
|
"declaration": true,
|
|
24
24
|
"allowSyntheticDefaultImports": true,
|
|
25
|
+
"allowJs": true,
|
|
25
26
|
},
|
|
26
|
-
"include": [
|
|
27
|
+
"include": [
|
|
28
|
+
"src",
|
|
29
|
+
"./eslint.config.mjs"
|
|
30
|
+
],
|
|
27
31
|
}
|
package/biome.json
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"files": {
|
|
3
|
-
"include": ["./src/**/*.js", "./src/**/*.ts"],
|
|
4
|
-
"ignore": ["dist", "build"]
|
|
5
|
-
},
|
|
6
|
-
"organizeImports": {
|
|
7
|
-
"enabled": false
|
|
8
|
-
},
|
|
9
|
-
"formatter": {
|
|
10
|
-
"indentStyle": "space",
|
|
11
|
-
"indentWidth": 2,
|
|
12
|
-
"lineWidth": 120
|
|
13
|
-
},
|
|
14
|
-
"javascript": {
|
|
15
|
-
"formatter": {
|
|
16
|
-
"arrowParentheses": "always",
|
|
17
|
-
"bracketSameLine": false,
|
|
18
|
-
"bracketSpacing": true,
|
|
19
|
-
"jsxQuoteStyle": "double",
|
|
20
|
-
"quoteProperties": "asNeeded",
|
|
21
|
-
"semicolons": "always",
|
|
22
|
-
"trailingCommas": "all"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"json": {
|
|
26
|
-
"formatter": {
|
|
27
|
-
"trailingCommas": "none"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"linter": {
|
|
31
|
-
"rules": {
|
|
32
|
-
"style": {
|
|
33
|
-
"noInferrableTypes": "off"
|
|
34
|
-
},
|
|
35
|
-
"suspicious": {
|
|
36
|
-
"noExplicitAny": {
|
|
37
|
-
"level": "off"
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"complexity": {
|
|
41
|
-
"noUselessTernary": {
|
|
42
|
-
"level": "off"
|
|
43
|
-
},
|
|
44
|
-
"useOptionalChain": {
|
|
45
|
-
"level": "off"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|