From 7bfc4c011a3289b96c6e925772d700a676fc4983 Mon Sep 17 00:00:00 2001 From: Jonathan Lurie Date: Thu, 17 Aug 2023 12:09:44 +0200 Subject: [PATCH 1/4] UP typedoc and config --- package-lock.json | 16 ++++++++-------- package.json | 2 +- rollup.config.js | 28 ++++++++++++++-------------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index b20d92ed..221ae67f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,7 +34,7 @@ "rollup-plugin-swc": "^0.2.1", "serve": "^14.2.0", "terser": "^5.17.1", - "typedoc": "^0.24.4", + "typedoc": "^0.24.8", "typescript": "^5.1.6" } }, @@ -4201,9 +4201,9 @@ } }, "node_modules/typedoc": { - "version": "0.24.4", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.24.4.tgz", - "integrity": "sha512-vQuliyGhJEGeKzzCFHbkS3m0gHoIL6cfr0fHf6eX658iGELtq2J9mWe0b+X5McEYgFoMuHFt5Py3Zug6Sxjn/Q==", + "version": "0.24.8", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.24.8.tgz", + "integrity": "sha512-ahJ6Cpcvxwaxfu4KtjA8qZNqS43wYt6JL27wYiIgl1vd38WW/KWX11YuAeZhuz9v+ttrutSsgK+XO1CjL1kA3w==", "dev": true, "dependencies": { "lunr": "^2.3.9", @@ -4218,7 +4218,7 @@ "node": ">= 14.14" }, "peerDependencies": { - "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x" + "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x" } }, "node_modules/typedoc/node_modules/brace-expansion": { @@ -7403,9 +7403,9 @@ "dev": true }, "typedoc": { - "version": "0.24.4", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.24.4.tgz", - "integrity": "sha512-vQuliyGhJEGeKzzCFHbkS3m0gHoIL6cfr0fHf6eX658iGELtq2J9mWe0b+X5McEYgFoMuHFt5Py3Zug6Sxjn/Q==", + "version": "0.24.8", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.24.8.tgz", + "integrity": "sha512-ahJ6Cpcvxwaxfu4KtjA8qZNqS43wYt6JL27wYiIgl1vd38WW/KWX11YuAeZhuz9v+ttrutSsgK+XO1CjL1kA3w==", "dev": true, "requires": { "lunr": "^2.3.9", diff --git a/package.json b/package.json index 9c2beaa9..22c62762 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "rollup-plugin-swc": "^0.2.1", "serve": "^14.2.0", "terser": "^5.17.1", - "typedoc": "^0.24.4", + "typedoc": "^0.24.8", "typescript": "^5.1.6" }, "dependencies": { diff --git a/rollup.config.js b/rollup.config.js index 92477057..8946560e 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -28,19 +28,19 @@ const copyCssPlugin = copy({ ], }); -const copyUmdBundle = copy({ - targets: [ - { - src: `dist/${outputName}.umd.js`, - dest: "demos/", - }, - { - src: `dist/${outputName}.css`, - dest: "demos/", - }, - ], - hook: "writeBundle" -}); +// const copyUmdBundle = copy({ +// targets: [ +// { +// src: `dist/${outputName}.umd.js`, +// dest: "demos/", +// }, +// { +// src: `dist/${outputName}.css`, +// dest: "demos/", +// }, +// ], +// hook: "writeBundle" +// }); const bundles = [ @@ -78,7 +78,7 @@ const bundles = [ globals(), json(), esbuild(), - copyUmdBundle, + // copyUmdBundle, ], output: [ { From 112497b9c15a70349a1e3f1ca7b538128e40c642 Mon Sep 17 00:00:00 2001 From: Jonathan Lurie Date: Thu, 17 Aug 2023 12:11:33 +0200 Subject: [PATCH 2/4] UP the prepare npm script is no longer copying demos to doc --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 22c62762..3029c54c 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "format": "prettier --write \"src/**/*.{js,ts,tsx}\"", "lint": "eslint --fix \"src/**/*.{js,ts}\"", "doc": "rm -rf docs/* && typedoc --out docs && cp -r images docs/", - "prepare": "npm run format && npm run lint && npm run build && npm run doc && cp -r demos docs/" + "prepare": "npm run format && npm run lint && npm run build && npm run doc" }, "author": "MapTiler", "devDependencies": { From 1720ecae0e1529f5abfd32bf30e7257a41fcad53 Mon Sep 17 00:00:00 2001 From: Jonathan Lurie Date: Thu, 17 Aug 2023 15:01:20 +0200 Subject: [PATCH 3/4] FIX inheritance pattern of some Controls due to ML update --- package-lock.json | 52 ++++++++++++++++++++------------ package.json | 2 +- src/MaptilerGeolocateControl.ts | 12 ++++---- src/MaptilerNavigationControl.ts | 4 +-- 4 files changed, 42 insertions(+), 28 deletions(-) diff --git a/package-lock.json b/package-lock.json index 221ae67f..1ce03937 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@maptiler/client": "^1.5.0", "events": "^3.3.0", "js-base64": "^3.7.4", - "maplibre-gl": "3.1.0", + "maplibre-gl": "^3.3.0", "uuid": "^9.0.0" }, "devDependencies": { @@ -733,14 +733,12 @@ } }, "node_modules/@maplibre/maplibre-gl-style-spec": { - "version": "19.2.1", - "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-19.2.1.tgz", - "integrity": "sha512-ZVT5QlkVhlxlPav+ca0NO3Moc7EzbHDO2FXW4ic3Q0Vm+TDUw9I8A2EBws7xUUQZf7HQB3kQ+3Jsh5mFLRD4GQ==", + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-19.3.0.tgz", + "integrity": "sha512-ZbhX9CTV+Z7vHwkRIasDOwTSzr76e8Q6a55RMsAibjyX6+P0ZNL1qAKNzOjjBDP3+aEfNMl7hHo5knuY6pTAUQ==", "dependencies": { "@mapbox/jsonlint-lines-primitives": "~2.0.2", - "@mapbox/point-geometry": "^0.1.0", "@mapbox/unitbezier": "^0.0.1", - "@types/mapbox__point-geometry": "^0.1.2", "json-stringify-pretty-compact": "^3.0.0", "minimist": "^1.2.8", "rw": "^1.3.3", @@ -1196,6 +1194,14 @@ "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", "dev": true }, + "node_modules/@types/supercluster": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@types/supercluster/-/supercluster-7.1.0.tgz", + "integrity": "sha512-6JapQ2GmEkH66r23BK49I+u6zczVDGTtiJEVvKDYZVSm/vepWaJuTq6BXzJ6I4agG5s8vA1KM7m/gXWDg03O4Q==", + "dependencies": { + "@types/geojson": "*" + } + }, "node_modules/@types/uuid": { "version": "9.0.2", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.2.tgz", @@ -2987,9 +2993,9 @@ } }, "node_modules/maplibre-gl": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-3.1.0.tgz", - "integrity": "sha512-KFarVUUszCEucPwnGsFJtPMQBg/F6lg+SPDmTztKUD/n0YShETjIOdNmm5jpxacEX3+dq50MzlqDr6VH+RtDDA==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-3.3.0.tgz", + "integrity": "sha512-LDia3b8u2S8qtl50n8TYJM0IPLzfc01KDc71LNuydvDiEXAGBI5togty+juVtUipRZZjs4dAW6xhgrabc6lIgw==", "dependencies": { "@mapbox/geojson-rewind": "^0.5.2", "@mapbox/jsonlint-lines-primitives": "^2.0.2", @@ -2998,11 +3004,12 @@ "@mapbox/unitbezier": "^0.0.1", "@mapbox/vector-tile": "^1.3.1", "@mapbox/whoots-js": "^3.1.0", - "@maplibre/maplibre-gl-style-spec": "^19.2.1", + "@maplibre/maplibre-gl-style-spec": "^19.3.0", "@types/geojson": "^7946.0.10", "@types/mapbox__point-geometry": "^0.1.2", "@types/mapbox__vector-tile": "^1.3.0", "@types/pbf": "^3.0.2", + "@types/supercluster": "^7.1.0", "earcut": "^2.2.4", "geojson-vt": "^3.2.1", "gl-matrix": "^3.4.3", @@ -4919,14 +4926,12 @@ "integrity": "sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==" }, "@maplibre/maplibre-gl-style-spec": { - "version": "19.2.1", - "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-19.2.1.tgz", - "integrity": "sha512-ZVT5QlkVhlxlPav+ca0NO3Moc7EzbHDO2FXW4ic3Q0Vm+TDUw9I8A2EBws7xUUQZf7HQB3kQ+3Jsh5mFLRD4GQ==", + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-19.3.0.tgz", + "integrity": "sha512-ZbhX9CTV+Z7vHwkRIasDOwTSzr76e8Q6a55RMsAibjyX6+P0ZNL1qAKNzOjjBDP3+aEfNMl7hHo5knuY6pTAUQ==", "requires": { "@mapbox/jsonlint-lines-primitives": "~2.0.2", - "@mapbox/point-geometry": "^0.1.0", "@mapbox/unitbezier": "^0.0.1", - "@types/mapbox__point-geometry": "^0.1.2", "json-stringify-pretty-compact": "^3.0.0", "minimist": "^1.2.8", "rw": "^1.3.3", @@ -5211,6 +5216,14 @@ "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", "dev": true }, + "@types/supercluster": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@types/supercluster/-/supercluster-7.1.0.tgz", + "integrity": "sha512-6JapQ2GmEkH66r23BK49I+u6zczVDGTtiJEVvKDYZVSm/vepWaJuTq6BXzJ6I4agG5s8vA1KM7m/gXWDg03O4Q==", + "requires": { + "@types/geojson": "*" + } + }, "@types/uuid": { "version": "9.0.2", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.2.tgz", @@ -6510,9 +6523,9 @@ } }, "maplibre-gl": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-3.1.0.tgz", - "integrity": "sha512-KFarVUUszCEucPwnGsFJtPMQBg/F6lg+SPDmTztKUD/n0YShETjIOdNmm5jpxacEX3+dq50MzlqDr6VH+RtDDA==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-3.3.0.tgz", + "integrity": "sha512-LDia3b8u2S8qtl50n8TYJM0IPLzfc01KDc71LNuydvDiEXAGBI5togty+juVtUipRZZjs4dAW6xhgrabc6lIgw==", "requires": { "@mapbox/geojson-rewind": "^0.5.2", "@mapbox/jsonlint-lines-primitives": "^2.0.2", @@ -6521,11 +6534,12 @@ "@mapbox/unitbezier": "^0.0.1", "@mapbox/vector-tile": "^1.3.1", "@mapbox/whoots-js": "^3.1.0", - "@maplibre/maplibre-gl-style-spec": "^19.2.1", + "@maplibre/maplibre-gl-style-spec": "^19.3.0", "@types/geojson": "^7946.0.10", "@types/mapbox__point-geometry": "^0.1.2", "@types/mapbox__vector-tile": "^1.3.0", "@types/pbf": "^3.0.2", + "@types/supercluster": "^7.1.0", "earcut": "^2.2.4", "geojson-vt": "^3.2.1", "gl-matrix": "^3.4.3", diff --git a/package.json b/package.json index 3029c54c..564f5c48 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "@maptiler/client": "^1.5.0", "events": "^3.3.0", "js-base64": "^3.7.4", - "maplibre-gl": "3.1.0", + "maplibre-gl": "3.3.0", "uuid": "^9.0.0" } } diff --git a/src/MaptilerGeolocateControl.ts b/src/MaptilerGeolocateControl.ts index 1fe9ee9d..af4db923 100644 --- a/src/MaptilerGeolocateControl.ts +++ b/src/MaptilerGeolocateControl.ts @@ -22,7 +22,7 @@ export class MaptilerGeolocateControl extends GeolocateControl { * @param {Position} position the Geolocation API Position * @private */ - _updateCamera(position: GeolocationPosition) { + _updateCamera = (position: GeolocationPosition) => { const center = new LngLat( position.coords.longitude, position.coords.latitude @@ -73,9 +73,9 @@ export class MaptilerGeolocateControl extends GeolocateControl { this.lastUpdatedCenter = this._map.getCenter(); }); - } + }; - _setupUI(supported: boolean) { + _setupUI = (supported: boolean) => { this.lastUpdatedCenter = this._map.getCenter(); this._container.addEventListener("contextmenu", (e: MouseEvent) => @@ -168,7 +168,7 @@ export class MaptilerGeolocateControl extends GeolocateControl { } }); } - } + }; _updateCircleRadius() { if ( @@ -196,9 +196,9 @@ export class MaptilerGeolocateControl extends GeolocateControl { this._circleElement.style.height = `${circleDiameter}px`; } - _onZoom() { + _onZoom = () => { if (this.options.showUserLocation && this.options.showAccuracyCircle) { this._updateCircleRadius(); } - } + }; } diff --git a/src/MaptilerNavigationControl.ts b/src/MaptilerNavigationControl.ts index ee9d89ea..899db311 100644 --- a/src/MaptilerNavigationControl.ts +++ b/src/MaptilerNavigationControl.ts @@ -50,7 +50,7 @@ export class MaptilerNavigationControl extends NavigationControl { /** * Overloading: Limit how flat the compass icon can get */ - _rotateCompassArrow() { + _rotateCompassArrow = () => { const rotate = this.options.visualizePitch ? `scale(${Math.min( 1.5, @@ -62,5 +62,5 @@ export class MaptilerNavigationControl extends NavigationControl { : `rotate(${this._map.transform.angle * (180 / Math.PI)}deg)`; this._compassIcon.style.transform = rotate; - } + }; } From ab066bb7c45220f9da02494c6cc27affea52f259 Mon Sep 17 00:00:00 2001 From: Jonathan Lurie Date: Thu, 17 Aug 2023 15:38:25 +0200 Subject: [PATCH 4/4] FIX Marker now requires an option object --- src/MaptilerGeolocateControl.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/MaptilerGeolocateControl.ts b/src/MaptilerGeolocateControl.ts index af4db923..f74d8fc8 100644 --- a/src/MaptilerGeolocateControl.ts +++ b/src/MaptilerGeolocateControl.ts @@ -16,6 +16,8 @@ const LngLatBounds = maplibregl.LngLatBounds; export class MaptilerGeolocateControl extends GeolocateControl { private lastUpdatedCenter = new LngLat(0, 0); + + /** * Update the camera location to center on the current position * @@ -116,7 +118,10 @@ export class MaptilerGeolocateControl extends GeolocateControl { if (this.options.showUserLocation) { this._dotElement = DOMcreate("div", "maplibregl-user-location-dot"); - this._userLocationDotMarker = new Marker(this._dotElement); + console.log('debug01'); + + + this._userLocationDotMarker = new Marker({element: this._dotElement}); this._circleElement = DOMcreate( "div", @@ -170,6 +175,7 @@ export class MaptilerGeolocateControl extends GeolocateControl { } }; + _updateCircleRadius() { if ( this._watchState !== "BACKGROUND" &&