@maptiler/sdk 3.3.0-rc3 → 3.3.0
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 +6 -123
- package/dist/eslint.mjs +133 -0
- package/dist/maptiler-sdk.mjs +2400 -3318
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/src/Map.d.ts +1 -22
- package/dist/src/helpers/index.d.ts +5 -13
- package/dist/src/index.d.ts +1 -0
- package/eslint.config.mjs +74 -2
- package/package.json +9 -13
- package/tsconfig.json +12 -4
- package/dist/eslint.config.d.mts +0 -2
- package/dist/src/custom-layers/CubemapLayer/CubemapLayer.d.ts +0 -33
- 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 -26
- 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 -8
- package/dist/src/utils/webgl-utils.d.ts +0 -49
- package/dist/vite.config-test.d.ts +0 -2
- package/dist/vitest-setup-tests.d.ts +0 -1
- package/vite.config-dev.ts +0 -34
- package/vite.config-es.ts +0 -52
- package/vite.config-test.ts +0 -17
- package/vite.config-umd.ts +0 -25
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,32 +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 setSpaceFromStyle;
|
|
148
|
-
private setHaloFromStyle;
|
|
149
|
-
private setSpaceFromCurrentStyle;
|
|
150
|
-
private setHaloFromCurrentStyle;
|
|
151
|
-
private initSpace;
|
|
152
|
-
private initHalo;
|
|
153
|
-
getHalo(): RadialGradientLayer | undefined;
|
|
154
|
-
setHalo(halo: GradientDefinition): void;
|
|
155
133
|
private options;
|
|
134
|
+
readonly telemetry: Telemetry;
|
|
156
135
|
private isTerrainEnabled;
|
|
157
136
|
private terrainExaggeration;
|
|
158
137
|
private primaryLanguage;
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
*
|
|
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 type * from './vectorlayerhelpers';
|
|
4
|
+
export type * from './stylehelper';
|
|
5
|
+
export * from './stylehelper';
|
package/dist/src/index.d.ts
CHANGED
package/eslint.config.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @ts-
|
|
1
|
+
// @ts-nocheck
|
|
2
2
|
|
|
3
3
|
import tseslint from "typescript-eslint";
|
|
4
4
|
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
@@ -8,6 +8,78 @@ export default tseslint.config(
|
|
|
8
8
|
tseslint.configs.strictTypeChecked,
|
|
9
9
|
tseslint.configs.stylisticTypeChecked,
|
|
10
10
|
tseslint.configs.recommendedTypeChecked,
|
|
11
|
+
{
|
|
12
|
+
// forked from https://www.npmjs.com/package/eslint-plugin-restrict-imports
|
|
13
|
+
plugins: {
|
|
14
|
+
import: {
|
|
15
|
+
rules: {
|
|
16
|
+
"default-imports-only": {
|
|
17
|
+
meta: {
|
|
18
|
+
type: "suggestion",
|
|
19
|
+
docs: {},
|
|
20
|
+
schema: [
|
|
21
|
+
{
|
|
22
|
+
bannedImport: {
|
|
23
|
+
locations: ["filePaths"],
|
|
24
|
+
message: "string",
|
|
25
|
+
fixedLocation: "string",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
create: function (context) {
|
|
31
|
+
const filePath = context.getFilename();
|
|
32
|
+
const options = context.options[0] || {
|
|
33
|
+
"^/(.*)": {
|
|
34
|
+
locations: ["(.*)"],
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
ImportDeclaration: (node) => {
|
|
40
|
+
Object.entries(options).forEach(([bannedImport, config]) => {
|
|
41
|
+
const importLocationRegex = new RegExp(bannedImport);
|
|
42
|
+
|
|
43
|
+
if (config.ignoreTypeImports && node.importKind === "type") return;
|
|
44
|
+
|
|
45
|
+
if (importLocationRegex.test(node.source.value)) {
|
|
46
|
+
config.locations.forEach((fp) => {
|
|
47
|
+
const bannedLocationRegex = new RegExp(fp);
|
|
48
|
+
|
|
49
|
+
if (bannedLocationRegex.test(filePath)) {
|
|
50
|
+
node.specifiers.forEach((specifier) => {
|
|
51
|
+
if (specifier.type !== "ImportDefaultSpecifier") {
|
|
52
|
+
context.report({
|
|
53
|
+
// @ts-expect-error `message` seems to work with this...
|
|
54
|
+
message: config.message ?? `Importing from '${bannedImport}' is banned in '${fp}'`,
|
|
55
|
+
node,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
rules: {
|
|
71
|
+
"import/default-imports-only": [
|
|
72
|
+
"error",
|
|
73
|
+
{
|
|
74
|
+
"maplibre-gl$": {
|
|
75
|
+
locations: ["^(?!.*\.d\.ts$).*\.((ts|js))$"],
|
|
76
|
+
message: `Maplibre-gl uses CJS modules, only default imports are supported, named imports may fail on some setups.`,
|
|
77
|
+
ignoreTypeImports: true,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
11
83
|
{
|
|
12
84
|
languageOptions: {
|
|
13
85
|
parserOptions: {
|
|
@@ -35,7 +107,7 @@ export default tseslint.config(
|
|
|
35
107
|
"@typescript-eslint/no-unnecessary-condition": "warn",
|
|
36
108
|
"@typescript-eslint/no-unnecessary-type-arguments": "off",
|
|
37
109
|
"@typescript-eslint/no-unnecessary-type-assertion": "off",
|
|
38
|
-
"@typescript-eslint/no-unnecessary-type-parameters": "
|
|
110
|
+
"@typescript-eslint/no-unnecessary-type-parameters": "warn",
|
|
39
111
|
"@typescript-eslint/no-unused-vars": "warn",
|
|
40
112
|
"@typescript-eslint/no-unsafe-argument": "warn",
|
|
41
113
|
"@typescript-eslint/no-unsafe-assignment": "warn",
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maptiler/sdk",
|
|
3
|
-
"version": "3.3.0
|
|
3
|
+
"version": "3.3.0",
|
|
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",
|
|
@@ -39,12 +38,12 @@
|
|
|
39
38
|
"prepare": "husky",
|
|
40
39
|
"doc": "rm -rf docs/* && typedoc --out docs && cp -r images docs/",
|
|
41
40
|
"ncu": "npx npm-check-updates",
|
|
42
|
-
"lint": "eslint src",
|
|
43
|
-
"lint:fix": "eslint src --fix",
|
|
41
|
+
"lint": "tsc --noEmit && eslint src",
|
|
42
|
+
"lint:fix": "tsc --noEmit && eslint src --fix",
|
|
44
43
|
"test:watch": "vitest watch -c vite.config-test.ts --dom",
|
|
45
44
|
"test": "vitest run -c vite.config-test.ts --dom",
|
|
46
45
|
"install:clean": "rm -rf build/ dist/ node_modules/ && npm ci",
|
|
47
|
-
"dev": "
|
|
46
|
+
"dev": "npm run build-css && vite -c vite.config-dev.ts",
|
|
48
47
|
"dev-umd": "npm run build-css && tsc && NODE_ENV=development vite build -w -c vite.config-umd.ts",
|
|
49
48
|
"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",
|
|
50
49
|
"build-umd": "tsc && NODE_ENV=production vite build -c vite.config-umd.ts",
|
|
@@ -55,14 +54,10 @@
|
|
|
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/
|
|
65
|
-
"@types/color-name": "^2.0.0",
|
|
60
|
+
"@types/stats.js": "^0.17.4",
|
|
66
61
|
"@types/uuid": "^10.0.0",
|
|
67
62
|
"@types/xmldom": "^0.1.31",
|
|
68
63
|
"@vitest/web-worker": "^3.0.9",
|
|
@@ -73,8 +68,10 @@
|
|
|
73
68
|
"eslint-plugin-prettier": "^5.2.3",
|
|
74
69
|
"happy-dom": "^17.4.4",
|
|
75
70
|
"husky": "^8.0.0",
|
|
71
|
+
"jiti": "^2.4.2",
|
|
76
72
|
"lint-staged": "^15.4.3",
|
|
77
73
|
"prettier": "3.5.2",
|
|
74
|
+
"stats.js": "^0.17.0",
|
|
78
75
|
"typedoc": "^0.27.6",
|
|
79
76
|
"typescript": "^5.7.3",
|
|
80
77
|
"typescript-eslint": "^8.25.0",
|
|
@@ -84,11 +81,10 @@
|
|
|
84
81
|
},
|
|
85
82
|
"dependencies": {
|
|
86
83
|
"@maplibre/maplibre-gl-style-spec": "^23.0.0",
|
|
87
|
-
"@maptiler/client": "^2.3.
|
|
84
|
+
"@maptiler/client": "^2.3.2",
|
|
88
85
|
"events": "^3.3.0",
|
|
89
|
-
"gl-matrix": "^3.4.3",
|
|
90
86
|
"js-base64": "^3.7.7",
|
|
91
|
-
"maplibre-gl": "^5.0
|
|
87
|
+
"maplibre-gl": "^5.5.0",
|
|
92
88
|
"uuid": "^11.0.5"
|
|
93
89
|
}
|
|
94
90
|
}
|
package/tsconfig.json
CHANGED
|
@@ -24,11 +24,19 @@
|
|
|
24
24
|
"allowSyntheticDefaultImports": true,
|
|
25
25
|
"allowJs": true,
|
|
26
26
|
},
|
|
27
|
+
"exclude": [
|
|
28
|
+
"vite.config-*.ts",
|
|
29
|
+
"vitest-setup-tests.ts",
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
27
32
|
"include": [
|
|
33
|
+
"vite.config-dev.ts",
|
|
34
|
+
"vite.config-es.ts",
|
|
35
|
+
"vite.config-umd.ts",
|
|
36
|
+
"vite.config-test.ts",
|
|
37
|
+
"vitest-setup-tests.ts",
|
|
28
38
|
"src",
|
|
29
|
-
"
|
|
30
|
-
"test"
|
|
31
|
-
"./vite.config-test.ts",
|
|
32
|
-
"./vitest-setup-tests.ts"
|
|
39
|
+
"demos",
|
|
40
|
+
"test"
|
|
33
41
|
],
|
|
34
42
|
}
|
package/dist/eslint.config.d.mts
DELETED
|
@@ -1,33 +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 previousBgColor;
|
|
16
|
-
private targetBgColor;
|
|
17
|
-
private transitionDelta;
|
|
18
|
-
private gl;
|
|
19
|
-
private cubemap?;
|
|
20
|
-
private texture?;
|
|
21
|
-
constructor(cubemapConfig: CubemapLayerConstructorOptions | true);
|
|
22
|
-
updateCubemap(): void;
|
|
23
|
-
onAdd(map: MapSDK, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
|
|
24
|
-
onRemove(_map: MapSDK, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
|
|
25
|
-
prerender(gl: WebGLContext, _options: CustomRenderMethodInput): void;
|
|
26
|
-
private animateTo;
|
|
27
|
-
private animateIn;
|
|
28
|
-
render(gl: WebGLRenderingContext | WebGL2RenderingContext, _options: CustomRenderMethodInput): void;
|
|
29
|
-
setCubemap(cubemap: CubemapDefinition): void;
|
|
30
|
-
show(): void;
|
|
31
|
-
hide(): void;
|
|
32
|
-
}
|
|
33
|
-
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,26 +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 animationDelta;
|
|
11
|
-
private map;
|
|
12
|
-
private plane?;
|
|
13
|
-
constructor(gradient: RadialGradientLayerOptions | boolean);
|
|
14
|
-
onAdd(map: MapSDK, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
|
|
15
|
-
private animateIn;
|
|
16
|
-
private animateOut;
|
|
17
|
-
onRemove(_map: MapSDK, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
|
|
18
|
-
prerender(_gl: WebGLRenderingContext | WebGL2RenderingContext, _options: CustomRenderMethodInput): void;
|
|
19
|
-
render(gl: WebGLRenderingContext | WebGL2RenderingContext, options: CustomRenderMethodInput): void;
|
|
20
|
-
/**
|
|
21
|
-
* Value settings methods
|
|
22
|
-
*/
|
|
23
|
-
setGradient(gradient: GradientDefinition): Promise<void>;
|
|
24
|
-
show(): void;
|
|
25
|
-
hide(): void;
|
|
26
|
-
}
|
|
@@ -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,8 +0,0 @@
|
|
|
1
|
-
import { Vec4 } from './webgl-utils';
|
|
2
|
-
declare function minMax(value: number, min: number, max: number): number;
|
|
3
|
-
declare function normalize(value: number, min: number, max: number): number;
|
|
4
|
-
declare function diagonalOfSquare(side: number): number;
|
|
5
|
-
type Lerpable = [number, number, number, number] | Vec4;
|
|
6
|
-
declare function lerpVec4(a: Lerpable, b: Lerpable, t: number): Vec4;
|
|
7
|
-
declare function lerp(a: number, b: number, t: number): number;
|
|
8
|
-
export { minMax, normalize, diagonalOfSquare, lerpVec4, lerp };
|
|
@@ -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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/vite.config-dev.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "vitest/config";
|
|
2
|
-
import packagejson from "./package.json";
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
server: {
|
|
6
|
-
port: 3000,
|
|
7
|
-
},
|
|
8
|
-
define: {
|
|
9
|
-
__MT_SDK_VERSION__: JSON.stringify(packagejson.version),
|
|
10
|
-
},
|
|
11
|
-
plugins: [
|
|
12
|
-
{
|
|
13
|
-
name: 'url-override',
|
|
14
|
-
/**
|
|
15
|
-
* Changing logged URLs to include the path to the demo directory.
|
|
16
|
-
*/
|
|
17
|
-
configureServer: (server) => {
|
|
18
|
-
const printUrls = server.printUrls;
|
|
19
|
-
|
|
20
|
-
server.printUrls = () => {
|
|
21
|
-
if (server.resolvedUrls !== null) {
|
|
22
|
-
for (const [key, value] of Object.entries(server.resolvedUrls)) {
|
|
23
|
-
for (let i = 0; i < value.length; i++) {
|
|
24
|
-
server.resolvedUrls[key][i] += "demos/index.html";
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
printUrls();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
});
|
package/vite.config-es.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'path';
|
|
2
|
-
import { defineConfig } from 'vite';
|
|
3
|
-
import dts from 'vite-plugin-dts';
|
|
4
|
-
import packagejson from "./package.json";
|
|
5
|
-
|
|
6
|
-
const isProduction = process.env.NODE_ENV === "production";
|
|
7
|
-
|
|
8
|
-
const plugins = [
|
|
9
|
-
dts({insertTypesEntry: true}),
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
export default defineConfig({
|
|
13
|
-
mode: isProduction ? "production" : "development",
|
|
14
|
-
build: {
|
|
15
|
-
minify: isProduction,
|
|
16
|
-
emptyOutDir: isProduction,
|
|
17
|
-
outDir: "dist",
|
|
18
|
-
sourcemap: true,
|
|
19
|
-
lib: {
|
|
20
|
-
// Could also be a dictionary or array of multiple entry points
|
|
21
|
-
entry: resolve(__dirname, 'src/index.ts'),
|
|
22
|
-
name: 'maptilersdk',
|
|
23
|
-
// the proper extensions will be added
|
|
24
|
-
fileName: (format, entryName) => "maptiler-sdk.mjs",
|
|
25
|
-
formats: ['es'],
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
rollupOptions: {
|
|
29
|
-
// make sure to externalize deps that shouldn't be bundled
|
|
30
|
-
// into your library
|
|
31
|
-
external: [
|
|
32
|
-
"maplibre-gl",
|
|
33
|
-
"@maptiler/client",
|
|
34
|
-
"@mapbox/point-geometry",
|
|
35
|
-
"uuid",
|
|
36
|
-
"@mapbox/unitbezier",
|
|
37
|
-
"events",
|
|
38
|
-
"js-base64",
|
|
39
|
-
"geojson-validation",
|
|
40
|
-
],
|
|
41
|
-
output: {
|
|
42
|
-
// Provide global variables to use in the UMD build
|
|
43
|
-
// for externalized deps
|
|
44
|
-
globals: {},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
define: {
|
|
49
|
-
__MT_SDK_VERSION__: JSON.stringify(packagejson.version),
|
|
50
|
-
},
|
|
51
|
-
plugins,
|
|
52
|
-
})
|
package/vite.config-test.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "vitest/config";
|
|
2
|
-
import packagejson from "./package.json";
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
test: {
|
|
6
|
-
include: ["test/**/*.test.ts"],
|
|
7
|
-
typecheck: {
|
|
8
|
-
tsconfig: "./tsconfig.json",
|
|
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),
|
|
16
|
-
},
|
|
17
|
-
});
|
package/vite.config-umd.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'path';
|
|
2
|
-
import { defineConfig } from 'vite';
|
|
3
|
-
import packagejson from "./package.json";
|
|
4
|
-
|
|
5
|
-
const isProduction = process.env.NODE_ENV === "production";
|
|
6
|
-
|
|
7
|
-
export default defineConfig({
|
|
8
|
-
mode: isProduction ? "production" : "development",
|
|
9
|
-
build: {
|
|
10
|
-
outDir: "build",
|
|
11
|
-
minify: true,
|
|
12
|
-
emptyOutDir: isProduction,
|
|
13
|
-
sourcemap: true,
|
|
14
|
-
lib: {
|
|
15
|
-
entry: resolve(__dirname, 'src/index.ts'),
|
|
16
|
-
name: 'maptilersdk',
|
|
17
|
-
fileName: (format, entryName) => "maptiler-sdk.umd.min.js",
|
|
18
|
-
formats: ['umd'],
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
define: {
|
|
22
|
-
__MT_SDK_VERSION__: JSON.stringify(packagejson.version),
|
|
23
|
-
},
|
|
24
|
-
plugins: [],
|
|
25
|
-
});
|