100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Migrated from mapbox-gl to maplibre-gl
Michael Rademaker5a09d7ea0f5a
diff --git a/ui/app/console_loader/src/pages/page-mobile-geofences.ts b/ui/app/console_loader/src/pages/page-mobile-geofences.tsindex 04c9e7cf7..923a86854 100644--- a/ui/app/console_loader/src/pages/page-mobile-geofences.ts+++ b/ui/app/console_loader/src/pages/page-mobile-geofences.ts@@ -2,7 +2,7 @@ import {css, html, PropertyValues} from "lit";import {customElement, property} from "lit/decorators.js";import {AppStateKeyed} from "@openremote/or-app/dist/app";import {Page, PageProvider} from "@openremote/or-app/dist/types";-import {NavigationControl} from "mapbox-gl";+import {NavigationControl} from "maplibre-gl";import {EnhancedStore} from "@reduxjs/toolkit";import manager from "@openremote/core";import {JsonRulesetDefinition} from "@openremote/model";diff --git a/ui/component/or-json-forms/webpack.config.js b/ui/component/or-json-forms/webpack.config.jsindex 59ee22935..2a4620698 100644--- a/ui/component/or-json-forms/webpack.config.js+++ b/ui/component/or-json-forms/webpack.config.js@@ -3,7 +3,7 @@ const util = require("@openremote/util");bundles = {"index": {vendor: {- "mapbox-gl": "mapboxgl",+ "maplibre-gl": "maplibregl","mapbox.js": "L.mapbox","moment": "moment"},diff --git a/ui/component/or-map/package.json b/ui/component/or-map/package.jsonindex 939c64384..62c47c006 100644--- a/ui/component/or-map/package.json+++ b/ui/component/or-map/package.json@@ -21,13 +21,13 @@"@openremote/rest": "^1.0.3","@polymer/polymer": "^3.3.1","@types/mapbox": "^1.6.42",- "@types/mapbox-gl": "^2.4.2","lit": "^2.0.2",- "mapbox-gl": "^1.13.0",+ "maplibre-gl": ">=1.15.2","mapbox.js": "^3.2.0"},"devDependencies": {"@types/mapbox-gl": "^2.0.2",+ "@types/geojson": "^7946.0.7","tslint": ">=5.11.0","typescript": ">=4.5.2","webpack": "^5.64.3",diff --git a/ui/component/or-map/src/index.ts b/ui/component/or-map/src/index.tsindex 9a917400f..14c4ef3db 100644--- a/ui/component/or-map/src/index.ts+++ b/ui/component/or-map/src/index.ts@@ -2,7 +2,7 @@ import manager, {EventCallback, MapType} from "@openremote/core";import {FlattenedNodesObserver} from "@polymer/polymer/lib/utils/flattened-nodes-observer.js";import {CSSResult, html, LitElement, PropertyValues} from "lit";import {customElement, property, query} from "lit/decorators.js";-import {Control, IControl, LngLat, LngLatBoundsLike, LngLatLike, Map as MapGL} from "mapbox-gl";+import {Control, IControl, LngLat, LngLatBoundsLike, LngLatLike, Map as MapGL} from "maplibre-gl";import {MapWidget} from "./mapwidget";import {style} from "./style";import {OrMapMarker, OrMapMarkerChangedEvent} from "./markers/or-map-marker";@@ -21,7 +21,7 @@ import {i18next} from "@openremote/or-translate";export {Util, LngLatLike};export * from "./markers/or-map-marker";export * from "./markers/or-map-marker-asset";-export {Control, IControl} from "mapbox-gl";+export {Control, IControl} from "maplibre-gl";export * from "./or-map-asset-card";export interface ViewSettings {@@ -83,16 +83,16 @@ export class CenterControl {onAdd(map: MapGL): HTMLElement {this.map = map;const control = document.createElement("div");- control.classList.add("mapboxgl-ctrl");- control.classList.add("mapboxgl-ctrl-group");+ control.classList.add("maplibregl-ctrl");+ control.classList.add("maplibregl-ctrl-group");const button = document.createElement("button");- button.className = "mapboxgl-ctrl-geolocate";+ button.className = "maplibregl-ctrl-geolocate";button.addEventListener("click", (ev) => map.flyTo({center: this.pos,zoom: map.getZoom()}));const buttonIcon = document.createElement("span");- buttonIcon.className = "mapboxgl-ctrl-icon";+ buttonIcon.className = "maplibregl-ctrl-icon";button.appendChild(buttonIcon);control.appendChild(button);this.elem = control;@@ -144,8 +144,8 @@ export class CoordinatesControl {onAdd(map: MapGL): HTMLElement {this.map = map;const control = document.createElement("div");- control.classList.add("mapboxgl-ctrl");- control.classList.add("mapboxgl-ctrl-group");+ control.classList.add("maplibregl-ctrl");+ control.classList.add("maplibregl-ctrl-group");const input = new OrMwcInput();input.type = InputType.TEXT;diff --git a/ui/component/or-map/src/mapwidget.ts b/ui/component/or-map/src/mapwidget.tsindex 5affade03..560d62e15 100644--- a/ui/component/or-map/src/mapwidget.ts+++ b/ui/component/or-map/src/mapwidget.ts@@ -3,14 +3,14 @@ import {LngLatLike, Map as MapGL, MapboxOptions as OptionsGL, Marker as MarkerGLMapMouseEvent,NavigationControl,Control,- IControl} from "mapbox-gl";+ IControl} from "maplibre-gl";import {ControlPosition, OrMapClickedEvent, OrMapLoadedEvent, ViewSettings} from "./index";import {OrMapMarker} from "./markers/or-map-marker";import {getLatLngBounds, getLngLat} from "./util";const mapboxJsStyles = require("mapbox.js/dist/mapbox.css");-const mapboxGlStyles = require("mapbox-gl/dist/mapbox-gl.css");+const maplibreGlStyles = require("maplibre-gl/dist/maplibre-gl.css");// TODO: fix any typeconst metersToPixelsAtMaxZoom = (meters:number, latitude:number) =>@@ -234,11 +234,11 @@ export class MapWidget {} else {// Add style to shadow rootconst style = document.createElement("style");- style.id = "mapboxGlStyle";- style.textContent = mapboxGlStyles;+ style.id = "maplibreGlStyle";+ style.textContent = maplibreGlStyles;this._styleParent.appendChild(style);- const map: typeof import("mapbox-gl") = await import(/* webpackChunkName: "mapbox-gl" */ "mapbox-gl");+ const map: typeof import("maplibre-gl") = await import(/* webpackChunkName: "maplibre-gl" */ "maplibre-gl");const settings = await this.loadViewSettings();const options: OptionsGL = {diff --git a/ui/component/or-map/src/style.ts b/ui/component/or-map/src/style.tsindex daefaf01f..60c44b1fb 100644--- a/ui/component/or-map/src/style.ts+++ b/ui/component/or-map/src/style.ts@@ -62,12 +62,12 @@ export const style = css`bottom: 0;}- .leaflet-marker-icon, .mapboxgl-marker {+ .leaflet-marker-icon, .maplibregl-marker {pointer-events: none !important;}.or-map-marker {- position: absolute; /* This makes mapboxJS behave like mapboxGL */+ position: absolute; /* This makes mapboxJS behave like maplibreGL */}.or-map-marker.active {diff --git a/ui/component/or-map/src/util.ts b/ui/component/or-map/src/util.tsindex b0d36d1f0..e4acda1c7 100644--- a/ui/component/or-map/src/util.ts+++ b/ui/component/or-map/src/util.ts@@ -1,4 +1,4 @@-import {LngLat, LngLatBounds, LngLatBoundsLike, LngLatLike} from "mapbox-gl";+import {LngLat, LngLatBounds, LngLatBoundsLike, LngLatLike} from "maplibre-gl";import {Asset, Attribute, GeoJSONPoint, ValueHolder, WellknownAttributes} from "@openremote/model";export function getLngLat(lngLatLike?: LngLatLike | Asset | ValueHolder<any> | GeoJSONPoint): { lng: number, lat: number } | undefined {diff --git a/ui/component/or-map/webpack.config.js b/ui/component/or-map/webpack.config.jsindex 59ee22935..2a4620698 100644--- a/ui/component/or-map/webpack.config.js+++ b/ui/component/or-map/webpack.config.js@@ -3,7 +3,7 @@ const util = require("@openremote/util");bundles = {"index": {vendor: {- "mapbox-gl": "mapboxgl",+ "maplibre-gl": "maplibregl","mapbox.js": "L.mapbox","moment": "moment"},diff --git a/ui/component/or-rules/src/json-viewer/modals/or-rule-radial-modal.ts b/ui/component/or-rules/src/json-viewer/modals/or-rule-radial-modal.tsindex 8af3f8475..97b881913 100644--- a/ui/component/or-rules/src/json-viewer/modals/or-rule-radial-modal.ts+++ b/ui/component/or-rules/src/json-viewer/modals/or-rule-radial-modal.ts@@ -18,7 +18,7 @@ import {translate} from "@openremote/or-translate";import {DialogAction, OrMwcDialog, OrMwcDialogOpenedEvent} from "@openremote/or-mwc-components/or-mwc-dialog";import {OrMap, OrMapClickedEvent} from '@openremote/or-map';import '@openremote/or-map/dist/markers/or-map-marker';-import {LngLatLike} from "mapbox-gl";+import {LngLatLike} from "maplibre-gl";@customElement("or-rule-radial-modal")export class OrRuleRadialModal extends translate(i18next)(LitElement) {diff --git a/yarn.lock b/yarn.lockindex a6689313c..340ec4da0 100644--- a/yarn.lock+++ b/yarn.lock@@ -1776,11 +1776,6 @@resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-1.0.2.tgz#daa7a7c7a6c63d735f0c9634de6b7dbd70a702ab"integrity sha512-oz3d3MKjQ2tXynQgyaQaMpGTDNyNDeBdo6dXf1AbjTwhA1IRINHmA7kSaVYv9ttKweNkEoNqp9DqteDdgWzPEg==-"@mapbox/[email protected]":- version "0.0.7"- resolved "https://registry.yarnpkg.com/@mapbox/corslite/-/corslite-0.0.7.tgz#29f5b6a188ba946e514bdf0b6401ed4fbe13a39e"- integrity sha1-KfW2oYi6lG5RS98LZAHtT74To54=-"@mapbox/geojson-rewind@^0.5.0":version "0.5.1"resolved "https://registry.yarnpkg.com/@mapbox/geojson-rewind/-/geojson-rewind-0.5.1.tgz#adbe16dc683eb40e90934c51a5e28c7bbf44f4e1"@@ -1809,11 +1804,6 @@resolved "https://registry.yarnpkg.com/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz#8a83f9335c7860effa2eeeca254332aa0aeed8f2"integrity sha1-ioP5M1x4YO/6Lu7KJUMyqgru2PI=-"@mapbox/sanitize-caja@^0.1.4":- version "0.1.4"- resolved "https://registry.yarnpkg.com/@mapbox/sanitize-caja/-/sanitize-caja-0.1.4.tgz#1b3ca8220d132b76b1219b65f9a719fbefe35837"- integrity sha1-GzyoIg0TK3axIZtl+acZ++/jWDc=-"@mapbox/tiny-sdf@^1.1.1":version "1.2.5"resolved "https://registry.yarnpkg.com/@mapbox/tiny-sdf/-/tiny-sdf-1.2.5.tgz#424c620a96442b20402552be70a7f62a8407cc59"@@ -2543,10 +2533,10 @@resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.50.tgz#1e0caa9364d3fccd2931c3ed96fdbeaa5d4cca83"integrity sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw==-"@types/geojson@*":- version "7946.0.7"- resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.7.tgz#c8fa532b60a0042219cdf173ca21a975ef0666ad"- integrity sha512-wE2v81i4C4Ol09RtsWFAqg3BUitWbHSpSlIo+bNdsCJijO9sjme+zm+73ZMCa/qMC8UEERxzGbvmr1cffo2SiQ==+"@types/geojson@^7946.0.7":+ version "7946.0.8"+ resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.8.tgz#30744afdb385e2945e22f3b033f897f76b1f12ca"+ integrity sha512-1rkryxURpr6aWP7R786/UQOkJ3PcpQiWkAXBmdWc7ryFWqN6a4xfK7BtjXvFBKO9LjQ+MWQSWxYeZX1OApnArA=="@types/html-minifier-terser@^6.0.0":version "6.1.0"@@ -2570,13 +2560,6 @@resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d"integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==-"@types/leaflet@^0":- version "0.7.34"- resolved "https://registry.yarnpkg.com/@types/leaflet/-/leaflet-0.7.34.tgz#7c0619e075399985aa76d7f3633a5c973aae8584"- integrity sha512-NOon/TgvB9QiJ6H5EfxfL4PsmNgAh/dvZQ9cSE7LkSGbidPutx7f/JdxdziCSIR5A7TxRiDqm2CrK2Kkc7rorQ==- dependencies:- "@types/geojson" "*"-"@types/lodash-es@^4.17.5":version "4.17.5"resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.5.tgz#1c3fdd16849d84aea43890b1c60da379fb501353"@@ -2589,20 +2572,6 @@resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.170.tgz#0d67711d4bf7f4ca5147e9091b847479b87925d6"integrity sha512-bpcvu/MKHHeYX+qeEN8GE7DIravODWdACVA1ctevD8CN24RhPZIKMn9ntfAsrvLfSX3cR5RrBKAbYm9bGs0A+Q==-"@types/mapbox-gl@^2.4.2":- version "2.4.2"- resolved "https://registry.yarnpkg.com/@types/mapbox-gl/-/mapbox-gl-2.4.2.tgz#b2d5d6572a49561eef0eb361afd92365027efc50"- integrity sha512-mKgjmhUN780YGy9ZEyJK0Sr9gMtERmTQimGsIa5WrBHPlBXdmjYfqtz8nSMI7hOnQFphcuSMyqQswaQESFLHsA==- dependencies:- "@types/geojson" "*"--"@types/mapbox@^1.6.42":- version "1.6.42"- resolved "https://registry.yarnpkg.com/@types/mapbox/-/mapbox-1.6.42.tgz#e15d33d738b2242e490cc49985aa771ffc0050ef"- integrity sha512-mQlrYBOwqz/kGG8P5KOTXLRMlZFLNFDdxzNaEukig3Uh9I2ukk6LXg5yaCUS8bk3/3ie6o3h/ZKAaXuwTljpdw==- dependencies:- "@types/leaflet" "^0"-"@types/minimatch@^3.0.3":version "3.0.5"resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40"@@ -5564,11 +5533,6 @@ kind-of@^6.0.2, kind-of@^6.0.3:resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd"integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==- version "1.4.0"- resolved "https://registry.yarnpkg.com/leaflet/-/leaflet-1.4.0.tgz#d5f56eeb2aa32787c24011e8be4c77e362ae171b"- integrity sha512-x9j9tGY1+PDLN9pcWTx9/y6C5nezoTMB8BLK5jTakx+H7bPlnbCHfi9Hjg+Qt36sgDz/cb9lrSpNQXmk45Tvhw==-lerna@^4.0.0:version "4.0.0"resolved "https://registry.yarnpkg.com/lerna/-/lerna-4.0.0.tgz#b139d685d50ea0ca1be87713a7c2f44a5b678e9e"@@ -5843,10 +5807,10 @@ map-obj@^4.0.0:resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.2.1.tgz#e4ea399dbc979ae735c83c863dd31bdf364277b7"integrity sha512-+WA2/1sPmDj1dlvvJmB5G6JKfY9dpn7EVBUL06+y6PoljPkh+6V1QihwxNkbcGxCRjt2b0F9K0taiCuo7MbdFQ==-mapbox-gl@^1.13.0:- version "1.13.1"- resolved "https://registry.yarnpkg.com/mapbox-gl/-/mapbox-gl-1.13.1.tgz#322efe75ab4c764fc4c776da1506aad58d5a5b9d"- integrity sha512-GSyubcoSF5MyaP8z+DasLu5v7KmDK2pp4S5+VQ5WdVQUOaAqQY4jwl4JpcdNho3uWm2bIKs7x1l7q3ynGmW60g==+maplibre-gl@>=1.15.2:+ version "1.15.2"+ resolved "https://registry.yarnpkg.com/maplibre-gl/-/maplibre-gl-1.15.2.tgz#7fb47868b62455af916c090903f2154394450f9c"+ integrity sha512-uPeV530apb4JfX3cRFfE+awFnbcJTOnCv2QvY4mw4huiInbybElWYkNzTs324YLSADq0f4bidRoYcR81ho3aLA==dependencies:"@mapbox/geojson-rewind" "^0.5.0""@mapbox/geojson-types" "^1.0.2"@@ -5872,16 +5836,6 @@ mapbox-gl@^1.13.0:tinyqueue "^2.0.3"vt-pbf "^3.1.1"-mapbox.js@^3.2.0:- version "3.3.1"- resolved "https://registry.yarnpkg.com/mapbox.js/-/mapbox.js-3.3.1.tgz#342e7230e3ae5d3da3a2f10d6f2ed409ea32a20e"- integrity sha512-Vbco0r4DlQ4TOPZoj7Vl+rgZGie7ZWe3JL43fLzCnH3tC2AevqUFl5+mY8W+rwtd1oVsgfnNbIt4ZY4d9KkvBw==- dependencies:- "@mapbox/corslite" "0.0.7"- "@mapbox/sanitize-caja" "^0.1.4"- leaflet "1.4.0"- mustache "3.0.1"-version "0.3.0"resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"@@ -6161,11 +6115,6 @@ murmurhash-js@^1.0.0:resolved "https://registry.yarnpkg.com/murmurhash-js/-/murmurhash-js-1.0.0.tgz#b06278e21fc6c37fa5313732b0412bcb6ae15f51"integrity sha1-sGJ44h/Gw3+lMTcysEEry2rhX1E=- version "3.0.1"- resolved "https://registry.yarnpkg.com/mustache/-/mustache-3.0.1.tgz#873855f23aa8a95b150fb96d9836edbc5a1d248a"- integrity sha512-jFI/4UVRsRYdUbuDTKT7KzfOp7FiD5WzYmmwNwXyUVypC0xjoTL78Fqc0jHUPIvvGD+6DQSPHIt1NE7D1ArsqA==-[email protected], mute-stream@~0.0.4:version "0.0.8"resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d"