diff --git a/app/package-lock.json b/app/package-lock.json index 63c8e835..40f664c7 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.0", "dependencies": { "@maplibre/maplibre-gl-inspect": "^1.7.0", - "maplibre-gl": "4.7.1", + "maplibre-gl": "5.0.0", "pixelmatch": "^5.3.0", "pmtiles": "^4.1.0", "sirv": "^3.0.0", @@ -1034,16 +1034,16 @@ } }, "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==", "license": "ISC", "dependencies": { "@mapbox/jsonlint-lines-primitives": "~2.0.2", "@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" }, @@ -1053,12 +1053,6 @@ "gl-style-validate": "dist/gl-style-validate.mjs" } }, - "node_modules/@maplibre/maplibre-gl-style-spec/node_modules/quickselect": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz", - "integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==", - "license": "ISC" - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -2817,9 +2811,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==", "license": "BSD-3-Clause", "dependencies": { "@mapbox/geojson-rewind": "^0.5.2", @@ -2829,14 +2823,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", diff --git a/app/package.json b/app/package.json index 177c197c..2f7989af 100644 --- a/app/package.json +++ b/app/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "@maplibre/maplibre-gl-inspect": "^1.7.0", - "maplibre-gl": "4.7.1", + "maplibre-gl": "5.0.0", "pixelmatch": "^5.3.0", "pmtiles": "^4.1.0", "sirv": "^3.0.0", diff --git a/app/src/MapView.tsx b/app/src/MapView.tsx index 1f8d4f9a..a37a8c48 100644 --- a/app/src/MapView.tsx +++ b/app/src/MapView.tsx @@ -3,7 +3,18 @@ import { render } from "solid-js/web"; import "./index.css"; import MaplibreInspect from "@maplibre/maplibre-gl-inspect"; import "@maplibre/maplibre-gl-inspect/dist/maplibre-gl-inspect.css"; -import maplibregl from "maplibre-gl"; +import { + Map, + addProtocol, + getRTLTextPluginStatus, + setRTLTextPlugin, + NavigationControl, + GeolocateControl, + GlobeControl, + Popup, + ScaleControl, + removeProtocol, +} from "maplibre-gl"; import type { MapGeoJSONFeature, StyleSpecification } from "maplibre-gl"; import "maplibre-gl/dist/maplibre-gl.css"; import type { LayerSpecification } from "@maplibre/maplibre-gl-style-spec"; @@ -173,13 +184,13 @@ function MapLibreView(props: { droppedArchive?: PMTiles; }) { let mapContainer: HTMLDivElement | undefined; - let mapRef: maplibregl.Map | undefined; + let mapRef: Map | undefined; let protocolRef: Protocol | undefined; let hiddenRef: HTMLDivElement | undefined; onMount(() => { - if (maplibregl.getRTLTextPluginStatus() === "unavailable") { - maplibregl.setRTLTextPlugin( + if (getRTLTextPluginStatus() === "unavailable") { + setRTLTextPlugin( "https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.2.3/mapbox-gl-rtl-text.min.js", true, ); @@ -192,18 +203,19 @@ function MapLibreView(props: { const protocol = new Protocol({ metadata: true }); protocolRef = protocol; - maplibregl.addProtocol("pmtiles", protocol.tile); + addProtocol("pmtiles", protocol.tile); - const map = new maplibregl.Map({ + const map = new Map({ hash: "map", container: mapContainer, style: getMaplibreStyle("", "en", false), }); - map.addControl(new maplibregl.NavigationControl()); - map.addControl(new maplibregl.ScaleControl({})); + map.addControl(new NavigationControl()); + map.addControl(new ScaleControl()); + map.addControl(new GlobeControl()); map.addControl( - new maplibregl.GeolocateControl({ + new GeolocateControl({ positionOptions: { enableHighAccuracy: true, }, @@ -216,14 +228,14 @@ function MapLibreView(props: { map.addControl( new MaplibreInspect({ - popup: new maplibregl.Popup({ + popup: new Popup({ closeButton: false, closeOnClick: false, }), }), ); - const popup = new maplibregl.Popup({ + const popup = new Popup({ closeButton: true, closeOnClick: false, maxWidth: "none", @@ -245,7 +257,7 @@ function MapLibreView(props: { return () => { protocolRef = undefined; - maplibregl.removeProtocol("pmtiles"); + removeProtocol("pmtiles"); map.remove(); }; });