diff --git a/package-lock.json b/package-lock.json index 16127f7..fa3edea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "geo-coordinates-parser": "^1.7.4" }, "devDependencies": { - "@maptiler/sdk": "^2.5.0", + "@maptiler/sdk": "^3.0.0", "@sveltejs/package": "^2.3.7", "@sveltejs/vite-plugin-svelte": "^3.1.2", "@tsconfig/svelte": "^5.0.4", @@ -35,7 +35,7 @@ "husky": "^9.1.7", "leaflet": "^1.9.4", "lint-staged": "^15.2.11", - "maplibre-gl": "^4.7.1", + "maplibre-gl": "^5.0.0", "ol": "10.3", "prettier": "^3.4.2", "prettier-plugin-organize-imports": "^4.1.0", @@ -53,7 +53,7 @@ "vite": "^5.4.11" }, "peerDependencies": { - "@maptiler/sdk": "^1 || ^2", + "@maptiler/sdk": "^1 || ^2 || ^3", "leaflet": "^1.7 || ^1.8 || ^1.9", "maplibre-gl": "^2 || ^3 || ^4 || ^5", "ol": "^6 || ^7 || ^8 || ^9 || ^10", @@ -897,9 +897,9 @@ } }, "node_modules/@maplibre/maplibre-gl-style-spec": { - "version": "20.4.0", - "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-20.4.0.tgz", - "integrity": "sha512-AzBy3095fTFPjDjmWpR2w6HVRAZJ6hQZUCwk5Plz6EyfnfuQW1odeW5i2Ai47Y6TBA2hQnC+azscjBSALpaWgw==", + "version": "22.0.1", + "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-22.0.1.tgz", + "integrity": "sha512-V7bSw7Ui6+NhpeeuYqGoqamvKuy+3+uCvQ/t4ZJkwN8cx527CAlQQQ2kp+w5R9q+Tw6bUAH+fsq+mPEkicgT8g==", "dev": true, "license": "ISC", "dependencies": { @@ -907,7 +907,7 @@ "@mapbox/unitbezier": "^0.0.1", "json-stringify-pretty-compact": "^4.0.0", "minimist": "^1.2.8", - "quickselect": "^2.0.0", + "quickselect": "^3.0.0", "rw": "^1.3.3", "tinyqueue": "^3.0.0" }, @@ -928,18 +928,18 @@ } }, "node_modules/@maptiler/sdk": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@maptiler/sdk/-/sdk-2.5.0.tgz", - "integrity": "sha512-noyj935NMAHTd0Shr3xItsqJF5+wiAFB9Iz0iHXGiN6Q3zWWimr9qkXzD5nuuR1PgQ7HbccIWzlAgKqHLAdepg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@maptiler/sdk/-/sdk-3.0.0.tgz", + "integrity": "sha512-7O07BWQ31TcgiRvmmE30Zu9sVbkia7oSLe60qi/V5Om9yu9QUWE0KE657TZL3kApU0ioJ7X9XBCrU34FHug35g==", "dev": true, "license": "BSD-3-Clause", "dependencies": { - "@maplibre/maplibre-gl-style-spec": "^20.3.1", + "@maplibre/maplibre-gl-style-spec": "^22.0.1", "@maptiler/client": "^2.2.0", "events": "^3.3.0", - "js-base64": "^3.7.4", - "maplibre-gl": "4.7.1", - "uuid": "^9.0.0" + "js-base64": "^3.7.7", + "maplibre-gl": "^5.0.0", + "uuid": "^11.0.4" } }, "node_modules/@nodelib/fs.scandir": { @@ -2627,9 +2627,9 @@ } }, "node_modules/earcut": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/earcut/-/earcut-3.0.0.tgz", - "integrity": "sha512-41Fs7Q/PLq1SDbqjsgcY7GA42T0jvaCNGXgGtsNdvg+Yv8eIu06bxv4/PoREkZ9nMDNwnUSG9OFB9+yv8eKhDg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/earcut/-/earcut-3.0.1.tgz", + "integrity": "sha512-0l1/0gOjESMeQyYaK5IDiPNvFeu93Z/cO0TjZh9eZ1vyCtZnA7KMZ8rQggpsJHIbGSdrqYq9OhuveadOVHCshw==", "dev": true, "license": "ISC" }, @@ -3878,9 +3878,9 @@ } }, "node_modules/maplibre-gl": { - "version": "4.7.1", - "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-4.7.1.tgz", - "integrity": "sha512-lgL7XpIwsgICiL82ITplfS7IGwrB1OJIw/pCvprDp2dhmSSEBgmPzYRvwYYYvJGJD7fxUv1Tvpih4nZ6VrLuaA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-5.0.0.tgz", + "integrity": "sha512-WG8IYFK2gfJYXvWjlqg1yavo/YO/JlNkblAJMt19sjIafP5oJzTgXFiOLUIYkjtrv5pKiAWuSYsx4CD3ithJqw==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -3891,14 +3891,14 @@ "@mapbox/unitbezier": "^0.0.1", "@mapbox/vector-tile": "^1.3.1", "@mapbox/whoots-js": "^3.1.0", - "@maplibre/maplibre-gl-style-spec": "^20.3.1", - "@types/geojson": "^7946.0.14", + "@maplibre/maplibre-gl-style-spec": "^22.0.1", + "@types/geojson": "^7946.0.15", "@types/geojson-vt": "3.2.5", "@types/mapbox__point-geometry": "^0.1.4", "@types/mapbox__vector-tile": "^1.3.4", "@types/pbf": "^3.0.5", "@types/supercluster": "^7.1.3", - "earcut": "^3.0.0", + "earcut": "^3.0.1", "geojson-vt": "^4.0.2", "gl-matrix": "^3.4.3", "global-prefix": "^4.0.0", @@ -3919,13 +3919,6 @@ "url": "https://github.com/maplibre/maplibre-gl-js?sponsor=1" } }, - "node_modules/maplibre-gl/node_modules/quickselect": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-3.0.0.tgz", - "integrity": "sha512-XdjUArbK4Bm5fLLvlm5KpTFOiOThgfWWI4axAZDWg4E/0mKdZyI9tNEfds27qCi1ze/vwTR16kvmmGhRra3c2g==", - "dev": true, - "license": "ISC" - }, "node_modules/mdn-data": { "version": "2.0.30", "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", @@ -4621,9 +4614,9 @@ } }, "node_modules/quickselect": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz", - "integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-3.0.0.tgz", + "integrity": "sha512-XdjUArbK4Bm5fLLvlm5KpTFOiOThgfWWI4axAZDWg4E/0mKdZyI9tNEfds27qCi1ze/vwTR16kvmmGhRra3c2g==", "dev": true, "license": "ISC" }, @@ -4637,13 +4630,6 @@ "quickselect": "^3.0.0" } }, - "node_modules/rbush/node_modules/quickselect": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-3.0.0.tgz", - "integrity": "sha512-XdjUArbK4Bm5fLLvlm5KpTFOiOThgfWWI4axAZDWg4E/0mKdZyI9tNEfds27qCi1ze/vwTR16kvmmGhRra3c2g==", - "dev": true, - "license": "ISC" - }, "node_modules/react": { "version": "19.0.0", "resolved": "https://registry.npmjs.org/react/-/react-19.0.0.tgz", @@ -5568,9 +5554,9 @@ "license": "MIT" }, "node_modules/uuid": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", - "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.0.4.tgz", + "integrity": "sha512-IzL6VtTTYcAhA/oghbFJ1Dkmqev+FpQWnCBaKq/gUluLxliWvO8DPFWfIviRmYbtaavtSQe4WBL++rFjdcGWEg==", "dev": true, "funding": [ "https://github.com/sponsors/broofa", @@ -5578,7 +5564,7 @@ ], "license": "MIT", "bin": { - "uuid": "dist/bin/uuid" + "uuid": "dist/esm/bin/uuid" } }, "node_modules/vite": { diff --git a/package.json b/package.json index 8893a80..beaf578 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "./types": "./types.d.ts" }, "devDependencies": { - "@maptiler/sdk": "^2.5.0", + "@maptiler/sdk": "^3.0.0", "@sveltejs/package": "^2.3.7", "@sveltejs/vite-plugin-svelte": "^3.1.2", "@tsconfig/svelte": "^5.0.4", @@ -120,7 +120,7 @@ "husky": "^9.1.7", "leaflet": "^1.9.4", "lint-staged": "^15.2.11", - "maplibre-gl": "^4.7.1", + "maplibre-gl": "^5.0.0", "ol": "10.3", "prettier": "^3.4.2", "prettier-plugin-organize-imports": "^4.1.0", @@ -138,7 +138,7 @@ "vite": "^5.4.11" }, "peerDependencies": { - "@maptiler/sdk": "^1 || ^2", + "@maptiler/sdk": "^1 || ^2 || ^3", "leaflet": "^1.7 || ^1.8 || ^1.9", "maplibre-gl": "^2 || ^3 || ^4 || ^5", "ol": "^6 || ^7 || ^8 || ^9 || ^10", diff --git a/src/MapLibreBasedGeocodingControl.ts b/src/MapLibreBasedGeocodingControl.ts index 6a906b8..d08f2d5 100644 --- a/src/MapLibreBasedGeocodingControl.ts +++ b/src/MapLibreBasedGeocodingControl.ts @@ -6,6 +6,7 @@ import type { Map, Marker, MarkerOptions, + Subscription, } from "maplibre-gl"; import type { SvelteComponent } from "svelte"; import GeocodingControlComponent from "./GeocodingControl.svelte"; @@ -336,9 +337,9 @@ export function crateClasses( on( type: T, listener: (ev: EventTypes[T]) => void, - ): this; + ): Subscription; - on(type: keyof EventTypes, listener: Listener): this { + on(type: keyof EventTypes, listener: Listener): Subscription { return super.on(type, listener); } diff --git a/src/maptilersdk.ts b/src/maptilersdk.ts index 87c508a..92ebebc 100644 --- a/src/maptilersdk.ts +++ b/src/maptilersdk.ts @@ -5,6 +5,9 @@ import { crateClasses, type MapLibreBaseControlOptions, } from "./MapLibreBasedGeocodingControl"; + +import { name, version } from "../package.json"; + export { createMapLibreGlMapController } from "./maplibregl-controller"; const { MapLibreBasedGeocodingControl, events } = @@ -39,6 +42,7 @@ export class GeocodingControl implements maptilersdk.IControl { onAdd(map: maptilersdk.Map): HTMLElement { + map.telemetry.registerModule(name, version); return super.onAddInt(map as unknown as maplibregl.Map); } } diff --git a/tsconfig.dist.json b/tsconfig.dist.json index b89ec47..acb09e6 100644 --- a/tsconfig.dist.json +++ b/tsconfig.dist.json @@ -14,7 +14,8 @@ "allowJs": true, "checkJs": true, "strict": true, - "moduleResolution": "Node" + "moduleResolution": "Node", + "resolveJsonModule": true }, "include": ["src/*.d.ts", "src/*.ts", "src/*.js", "src/*.svelte"], "references": [{ "path": "./tsconfig.node.json" }],