Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Add map clustering and asset type legend (#2284)

Koen1dcc840bd5e2
diff --git a/ui/app/manager/package.json b/ui/app/manager/package.json
index 72a86f28f..dcc2dc767 100644
--- a/ui/app/manager/package.json
+++ b/ui/app/manager/package.json
@@ -50,7 +50,7 @@
"@reduxjs/toolkit": "^1.8.1",
"iso-639-1": "^3.1.3",
"lit": "^3.3.1",
- "maplibre-gl": "^4.1.2",
+ "maplibre-gl": "^5.12.0",
"moment": "^2.29.4",
"reselect": "^4.1.8"
},
diff --git a/ui/app/manager/src/pages/page-map.ts b/ui/app/manager/src/pages/page-map.ts
index 1e024319a..849f174c1 100644
--- a/ui/app/manager/src/pages/page-map.ts
+++ b/ui/app/manager/src/pages/page-map.ts
@@ -1,4 +1,4 @@
-import {css, html} from "lit";
+import {css, html, PropertyValues} from "lit";
import {customElement, property, query, state} from "lit/decorators.js";
import {createSlice, Store, PayloadAction} from "@reduxjs/toolkit";
import "@openremote/or-map";
@@ -10,7 +10,9 @@ import {
OrMapMarkerAsset,
OrMapMarkerClickedEvent,
OrMapGeocoderChangeEvent,
- MapMarkerAssetConfig
+ MapMarkerAssetConfig,
+ OrMapMarkersChangedEvent,
+ OrMapLegendEvent
} from "@openremote/or-map";
import manager, {Util} from "@openremote/core";
import {createSelector} from "reselect";
@@ -19,7 +21,6 @@ import {
AssetEvent,
AssetEventCause,
AssetQuery,
- Attribute,
AttributeEvent,
GeoJSONPoint,
WellknownAttributes,
@@ -28,6 +29,7 @@ import {
import {getAssetsRoute, getMapRoute} from "../routes";
import {AppStateKeyed, Page, PageProvider, router} from "@openremote/or-app";
import {GenericAxiosResponse} from "@openremote/rest";
+import { ClusterConfig, Util as MapUtil, AssetWithLocation } from "@openremote/or-map";
export interface MapState {
assets: Asset[];
@@ -53,8 +55,7 @@ const pageMapSlice = createSlice({
// Update and delete handled by attribute handler
const asset = action.payload.asset;
- const locationAttr = asset.attributes && asset.attributes.hasOwnProperty(WellknownAttributes.LOCATION) ? asset.attributes[WellknownAttributes.LOCATION] as Attribute<GeoJSONPoint> : undefined;
- if (locationAttr && (!locationAttr.meta || locationAttr.meta && (!locationAttr.meta.hasOwnProperty(WellknownMetaItems.SHOWONDASHBOARD) || !!locationAttr.meta[WellknownMetaItems.SHOWONDASHBOARD]))) {
+ if (MapUtil.isAssetWithLocation(asset)) {
return {
...state,
assets: [...state.assets, action.payload.asset]
@@ -105,6 +106,10 @@ const {assetEventReceived, attributeEventReceived, setAssets} = pageMapSlice.act
export const pageMapReducer = pageMapSlice.reducer;
export interface PageMapConfig {
+ legend?: {
+ show: boolean
+ },
+ clustering?: ClusterConfig,
card?: MapAssetCardConfig,
assetQuery?: AssetQuery,
markers?: MapMarkerAssetConfig
@@ -140,6 +145,15 @@ export class PageMap extends Page<MapStateKeyed> {
width: 100vw;
z-index: 3;
}
+
+ or-map-legend {
+ position: absolute;
+ top: 60px;
+ left: 10px;
+ width: 254px;
+ margin: 10px 0;
+ z-index: 1;
+ }
or-map {
display: block;
@@ -158,6 +172,17 @@ export class PageMap extends Page<MapStateKeyed> {
height: max-content;
max-height: calc(100vh - 150px);
}
+
+ or-map-legend {
+ position: absolute;
+ top: 60px;
+ left: 10px;
+ width: calc(100%);
+ max-width: 254px;
+ margin: 0;
+ height: max-content;
+ max-height: calc(100vh - 150px);
+ }
}
`;
}
@@ -174,12 +199,26 @@ export class PageMap extends Page<MapStateKeyed> {
@state()
protected _currentAsset?: Asset;
+ @state()
+ protected _assetsOnScreen: AssetWithLocation[] = [];
+
protected _assetSelector = (state: MapStateKeyed) => state.map.assets;
protected _paramsSelector = (state: MapStateKeyed) => state.app.params;
protected _realmSelector = (state: MapStateKeyed) => state.app.realm || manager.displayRealm;
- protected assetSubscriptionId: string;
- protected attributeSubscriptionId: string;
+ protected _assetSubscriptionId: string;
+ protected _attributeSubscriptionId: string;
+
+ protected _assetTypes: string[] = [];
+ protected _excludedTypes: string[] = [];
+
+ shouldUpdate(_changedProperties: PropertyValues): boolean {
+ if (_changedProperties.has("_assets")) {
+ this._updateMarkers();
+ this._map?.reload();
+ }
+ return super.shouldUpdate(_changedProperties);
+ }
protected getAttributesOfInterest(): (string | WellknownAttributes)[] {
// Extract all label attributes configured in marker config
@@ -261,34 +300,34 @@ export class PageMap extends Page<MapStateKeyed> {
return;
}
- this.assetSubscriptionId = assetSubscriptionId;
+ this._assetSubscriptionId = assetSubscriptionId;
const attributeSubscriptionId = await manager.events.subscribeAttributeEvents(undefined, false, (event) => {
this._store.dispatch(attributeEventReceived([attrsOfInterest, event]));
});
if (!this.isConnected || realm !== this._realmSelector(this.getState())) {
- this.assetSubscriptionId = undefined;
+ this._assetSubscriptionId = undefined;
manager.events.unsubscribe(assetSubscriptionId);
manager.events.unsubscribe(attributeSubscriptionId);
return;
}
- this.attributeSubscriptionId = attributeSubscriptionId;
+ this._attributeSubscriptionId = attributeSubscriptionId;
}
} catch (e) {
- console.error("Failed to subscribe to assets", e)
+ console.error("Failed to subscribe to assets", e);
}
};
protected unsubscribeAssets = () => {
- if (this.assetSubscriptionId) {
- manager.events.unsubscribe(this.assetSubscriptionId);
- this.assetSubscriptionId = undefined;
+ if (this._assetSubscriptionId) {
+ manager.events.unsubscribe(this._assetSubscriptionId);
+ this._assetSubscriptionId = undefined;
}
- if (this.attributeSubscriptionId) {
- manager.events.unsubscribe(this.attributeSubscriptionId);
- this.attributeSubscriptionId = undefined;
+ if (this._attributeSubscriptionId) {
+ manager.events.unsubscribe(this._attributeSubscriptionId);
+ this._attributeSubscriptionId = undefined;
}
};
@@ -299,12 +338,15 @@ export class PageMap extends Page<MapStateKeyed> {
// Clear existing assets
this._assets = [];
}
- this.unsubscribeAssets();
- this.subscribeAssets(realm);
-
- if (this._map) {
- this._map.refresh();
+ if (this._excludedTypes.length > 0) {
+ this._excludedTypes = [];
}
+
+ this.unsubscribeAssets();
+ this.subscribeAssets(realm).then(async () => {
+ await this._map?.reload();
+ });
+ this._map?.refresh();
}
)
@@ -336,51 +378,42 @@ export class PageMap extends Page<MapStateKeyed> {
constructor(store: Store<MapStateKeyed>) {
super(store);
- this.addEventListener(OrMapAssetCardLoadAssetEvent.NAME, this.onLoadAssetEvent);
+ this.addEventListener(OrMapAssetCardLoadAssetEvent.NAME, this._onLoadAssetEvent);
}
protected render() {
-
+ const showLegend = this.config?.legend?.show !== false && this._assetTypes.length > 1;
return html`
-
${this._currentAsset ? html `<or-map-asset-card .config="${this.config?.card}" .assetId="${this._currentAsset.id}" .markerconfig="${this.config?.markers}"></or-map-asset-card>` : ``}
-
- <or-map id="map" class="or-map" showGeoCodingControl @or-map-geocoder-change="${(ev: OrMapGeocoderChangeEvent) => {this._setCenter(ev.detail.geocode);}}">
- ${
- this._assets.filter((asset) => {
- if (!asset.attributes) {
- return false;
- }
- const attr = asset.attributes[WellknownAttributes.LOCATION] as Attribute<GeoJSONPoint>;
- return !attr.meta || !attr.meta.hasOwnProperty(WellknownMetaItems.SHOWONDASHBOARD) || !!Util.getMetaValue(WellknownMetaItems.SHOWONDASHBOARD, attr);
- })
- .sort((a,b) => {
- if (a.attributes[WellknownAttributes.LOCATION].value && b.attributes[WellknownAttributes.LOCATION].value){
- return b.attributes[WellknownAttributes.LOCATION].value.coordinates[1] - a.attributes[WellknownAttributes.LOCATION].value.coordinates[1];
- } else {
- return;
- }
- })
- .map(asset => {
- return html`
- <or-map-marker-asset ?active="${this._currentAsset && this._currentAsset.id === asset.id}" .asset="${asset}" .config="${this.config.markers}"></or-map-marker-asset>
- `;
- })
- }
+
+ ${showLegend ? html`<or-map-legend .assetTypes="${this._assetTypes}" @or-map-legend-changed="${this._onMapLegendChanged}"></or-map-legend>` : null}
+
+ <or-map id="map" class="or-map" .cluster="${this.config.clustering}" showGeoCodingControl @or-map-geocoder-change="${(ev: OrMapGeocoderChangeEvent) => {this._setCenter(ev.detail.geocode);}}">
+ ${this._assetsOnScreen.sort((a,b) => {
+ const pointA = a.attributes[WellknownAttributes.LOCATION].value as GeoJSONPoint;
+ const pointB = b.attributes[WellknownAttributes.LOCATION].value as GeoJSONPoint;
+ if (pointA && pointB){
+ return pointB.coordinates[1] - pointA.coordinates[1];
+ }
+ }).map(asset => html`
+ <or-map-marker-asset ?active="${this._currentAsset && this._currentAsset.id === asset.id}" .asset="${asset}" .config="${this.config.markers}"></or-map-marker-asset>
+ `)}
</or-map>
`;
}
public connectedCallback() {
super.connectedCallback();
- this.addEventListener(OrMapMarkerClickedEvent.NAME, this.onMapMarkerClick);
- this.addEventListener(OrMapClickedEvent.NAME, this.onMapClick);
+ this.addEventListener(OrMapMarkerClickedEvent.NAME, this._onMapMarkerClick);
+ this.addEventListener(OrMapClickedEvent.NAME, this._onMapClick);
+ this.addEventListener(OrMapMarkersChangedEvent.NAME, this._onMapMarkersChanged);
}
public disconnectedCallback() {
super.disconnectedCallback();
- this.removeEventListener(OrMapMarkerClickedEvent.NAME, this.onMapMarkerClick);
- this.removeEventListener(OrMapClickedEvent.NAME, this.onMapClick);
+ this.removeEventListener(OrMapMarkerClickedEvent.NAME, this._onMapMarkerClick);
+ this.removeEventListener(OrMapClickedEvent.NAME, this._onMapClick);
+ this.removeEventListener(OrMapMarkersChangedEvent.NAME, this._onMapMarkersChanged);
this.unsubscribeAssets();
}
@@ -390,20 +423,45 @@ export class PageMap extends Page<MapStateKeyed> {
this.getRealmState(state);
}
- protected onMapMarkerClick(e: OrMapMarkerClickedEvent) {
+ protected _onMapMarkerClick(e: OrMapMarkerClickedEvent) {
const asset = (e.detail.marker as OrMapMarkerAsset).asset;
router.navigate(getMapRoute(asset.id));
}
- protected onMapClick(e: OrMapClickedEvent) {
+ protected _onMapClick(e: OrMapClickedEvent) {
router.navigate(getMapRoute());
}
- protected getCurrentAsset() {
- this._getCurrentAsset(this.getState());
+ protected _onMapMarkersChanged(e: OrMapMarkersChangedEvent) {
+ this._assetsOnScreen = e.detail;
}
- protected onLoadAssetEvent(loadAssetEvent: OrMapAssetCardLoadAssetEvent) {
+ protected _onLoadAssetEvent(loadAssetEvent: OrMapAssetCardLoadAssetEvent) {
router.navigate(getAssetsRoute(false, loadAssetEvent.detail));
}
+
+ protected _onMapLegendChanged(e: OrMapLegendEvent) {
+ if (this._map) {
+ this._excludedTypes = e.detail;
+ this._updateMarkers();
+ this._map.reload();
+ }
+ }
+
+ protected _updateMarkers() {
+ if (this._map) {
+ this._assetTypes = [];
+ this._map.cleanUpAssetMarkers();
+ this._assets.forEach((asset: Asset) => {
+ if (MapUtil.isAssetWithLocation(asset)) {
+ if (!this._excludedTypes.includes(asset.type)) {
+ this._map.addAssetMarker(asset)
+ }
+ if (!this._assetTypes.includes(asset.type)) {
+ this._assetTypes.push(asset.type);
+ }
+ }
+ });
+ }
+ }
}
diff --git a/ui/app/manager/test/fixtures/data/assets.ts b/ui/app/manager/test/fixtures/data/assets.ts
index 70bc71122..a38acb272 100644
--- a/ui/app/manager/test/fixtures/data/assets.ts
+++ b/ui/app/manager/test/fixtures/data/assets.ts
@@ -1,128 +1,203 @@
import * as Util from "@openremote/core/lib/util";
-import { Asset } from "@openremote/model";
+import { Asset, AssetInfo, AssetTypeInfo } from "@openremote/model";
+
+export const notes = { name: "notes", type: "text" };
+export const location = { name: "location", type: "GEO_JSONPoint" };
+export const commonAttrs = { notes, location };
export const assetMap = {
- Battery: "ElectricityBatteryAsset",
- "Solar Panel": "ElectricityProducerSolarAsset"
+ Battery: "ElectricityBatteryAsset",
+ "Solar Panel": "ElectricityProducerSolarAsset",
};
const assets = [
- {
- name: "Battery",
- type: "ThingAsset",
- realm: "smartcity",
- attributes: {
- notes: { name: "notes", type: "text" },
- location: { name: "location", type: "GEO_JSONPoint" },
- energyLevel: { name: "energyLevel", type: "positiveNumber", meta: { readOnly: true } },
- power: { name: "power", type: "number", meta: { readOnly: false } },
- powerSetpoint: { name: "powerSetpoint", type: "number" },
- energyCapacity: { name: "energyCapacity", type: "positiveNumber" }
- }
- },
- {
- name: "Solar Panel",
- type: "ThingAsset",
- realm: "smartcity",
- attributes: {
- notes: { name: "notes", type: "text" },
- location: { name: "location", type: "GEO_JSONPoint" },
- panelPitch: { name: "panelPitch", type: "positiveInteger", meta: { readOnly: true } },
- power: { name: "power", type: "number", meta: { readOnly: false } },
- powerForecast: { name: "powerForecast", type: "number", meta: { readOnly: true } }
- }
- }
+ {
+ name: "Battery",
+ type: "ThingAsset",
+ realm: "smartcity",
+ attributes: {
+ ...commonAttrs,
+ energyLevel: { name: "energyLevel", type: "positiveNumber", meta: { readOnly: true } },
+ power: { name: "power", type: "number", meta: { readOnly: false } },
+ powerSetpoint: { name: "powerSetpoint", type: "number" },
+ energyCapacity: { name: "energyCapacity", type: "positiveNumber" },
+ },
+ },
+ {
+ name: "Solar Panel",
+ type: "ThingAsset",
+ realm: "smartcity",
+ attributes: {
+ ...commonAttrs,
+ panelPitch: { name: "panelPitch", type: "positiveInteger", meta: { readOnly: true } },
+ power: { name: "power", type: "number", meta: { readOnly: false } },
+ powerForecast: { name: "powerForecast", type: "number", meta: { readOnly: true } },
+ },
+ },
] as const;
export const preparedAssetsWithLocation = Object.values(
- Util.mergeObjects(
- structuredClone(assets),
- [
- { attributes: { location: { value: { type: "Point", coordinates: [4.482259693115793, 51.91756799273] } } } },
- { attributes: { location: { value: { type: "Point", coordinates: [4.4845127486877345, 51.917435642781214] } } } }
- ],
- true
- )
+ Util.mergeObjects(
+ structuredClone(assets),
+ [
+ {
+ attributes: {
+ location: { value: { type: "Point", coordinates: [4.482259693115793, 51.91756799273] } },
+ },
+ },
+ {
+ attributes: {
+ location: { value: { type: "Point", coordinates: [4.4845127486877345, 51.917435642781214] } },
+ },
+ },
+ ],
+ true
+ )
);
export const preparedAssetsForRules = Object.values(
- Util.mergeObjects(
- structuredClone(assets),
- [
- {
- attributes: {
- energyLevel: { meta: { ruleState: true, storeDataPoints: true } },
- power: { meta: { ruleState: true, storeDataPoints: true } }
- }
- },
- {
- attributes: {
- power: { meta: { ruleState: true, storeDataPoints: true } },
- powerForecast: { meta: { ruleState: true, storeDataPoints: true } }
- }
- }
- ],
- true
- )
+ Util.mergeObjects(
+ structuredClone(assets),
+ [
+ {
+ attributes: {
+ energyLevel: { meta: { ruleState: true, storeDataPoints: true } },
+ power: { meta: { ruleState: true, storeDataPoints: true } },
+ },
+ },
+ {
+ attributes: {
+ power: { meta: { ruleState: true, storeDataPoints: true } },
+ powerForecast: { meta: { ruleState: true, storeDataPoints: true } },
+ },
+ },
+ ],
+ true
+ )
);
type AssetNames = (typeof assets)[number]["name"];
export const assetPatches: Record<
- AssetNames,
- {
- attribute1: string;
- attribute2: string;
- attribute3: string;
- value1: string;
- value2: string;
- value3: string;
- x: number;
- y: number;
- }
+ AssetNames,
+ {
+ attribute1: string;
+ attribute2: string;
+ attribute3: string;
+ value1: string;
+ value2: string;
+ value3: string;
+ x: number;
+ y: number;
+ }
> = {
- Battery: {
- attribute1: "energyLevel",
- attribute2: "power",
- attribute3: "powerSetpoint",
- value1: "30",
- value2: "50",
- value3: "70",
- x: 705,
- y: 210,
- },
- "Solar Panel": {
- attribute1: "panelPitch",
- attribute2: "power",
- attribute3: "powerForecast",
- value1: "30",
- value2: "70",
- value3: "100",
- x: 600,
- y: 200
- }
+ Battery: {
+ attribute1: "energyLevel",
+ attribute2: "power",
+ attribute3: "powerSetpoint",
+ value1: "30",
+ value2: "50",
+ value3: "70",
+ x: 705,
+ y: 210,
+ },
+ "Solar Panel": {
+ attribute1: "panelPitch",
+ attribute2: "power",
+ attribute3: "powerForecast",
+ value1: "30",
+ value2: "70",
+ value3: "100",
+ x: 600,
+ y: 200,
+ },
};
export type DefaultAssets = typeof assets;
export default assets;
export const thing: Asset = {
- name: "Thing",
- realm: "smartcity",
- type: "ThingAsset",
- attributes: {
- notes: { name: "notes", type: "text", meta: {} },
- location: { name: "location", type: "GEO_JSONPoint", meta: {} },
- },
+ name: "Thing",
+ realm: "smartcity",
+ type: "ThingAsset",
+ attributes: { ...commonAttrs },
};
export const agent: Asset = {
- name: "Simulator",
- realm: "smartcity",
- type: "SimulatorAgent",
- attributes: {
- notes: { name: "notes", type: "text", meta: {} },
- agentDisabled: { name: "agentDisabled", type: "boolean", meta: {} },
- location: { name: "location", type: "GEO_JSONPoint", meta: {} },
- agentStatus: { name: "agentStatus", type: "connectionStatus", meta: { readOnly: true } }
- }
+ name: "Simulator",
+ realm: "smartcity",
+ type: "SimulatorAgent",
+ attributes: {
+ ...commonAttrs,
+ agentDisabled: { name: "agentDisabled", type: "boolean", meta: {} },
+ agentStatus: { name: "agentStatus", type: "connectionStatus", meta: { readOnly: true } },
+ },
+};
+
+export type BBox = { south: number; north: number; west: number; east: number };
+
+const rotterdam: BBox = {
+ south: 51.89,
+ north: 51.99,
+ west: 4.24,
+ east: 4.51,
};
+
+/**
+ * Assigns a random location within the specified bounding box
+ *
+ * @param asset The asset to assign the location attribute
+ * @param boundingBox The bounding box to add assets within
+ * @default {@link rotterdam}
+ */
+export function assignLocation(asset: Asset, { south, north, east, west }: BBox = rotterdam): Asset {
+ const y = randomBetween(south, north);
+ const x = randomBetween(east, west);
+
+ Object.assign(asset?.attributes ?? {}, {
+ location: {
+ name: "location",
+ type: "GEO_JSONPoint",
+ value: { type: "Point", coordinates: [x, y] },
+ meta: {},
+ },
+ });
+
+ return asset;
+}
+
+export function getAssetAt(assetInfos: AssetTypeInfo[], index = 0): Asset {
+ const validAssetInfos = assetInfos.filter(
+ ({ assetDescriptor }) => assetDescriptor?.name && assetDescriptor.descriptorType === "asset"
+ );
+
+ const info = validAssetInfos[index % validAssetInfos.length];
+
+ const type = info.assetDescriptor!.name;
+ const attributes = Object.fromEntries(
+ Object.values(info?.attributeDescriptors ?? {}).map(({ name, type }) => [name, { name, type, meta: {} }])
+ );
+
+ return { type, name: type, attributes };
+}
+
+export function getAssetsForAllTypes(assetInfos: AssetTypeInfo[], options?: { realm?: string, limit?: number, bbox?: BBox }): Asset[] {
+ return Array.from({ length: options?.limit ?? assetInfos.length }).map((_, i) => {
+ return { ...assignLocation(getAssetAt(assetInfos, i), options?.bbox), name: String(i), realm: options?.realm ?? "smartcity" };
+ });
+}
+
+export function getAssetTypes(assets: Asset[]) {
+ return assets.map(({ type }) => type!).filter((value, index, array) => array.indexOf(value) === index);
+}
+
+export function getAssetTypeColour(type: string, infos: AssetTypeInfo[]) {
+ return infos.find(({ assetDescriptor }) => assetDescriptor?.name === type)?.assetDescriptor?.colour ?? "";
+}
+
+export function rgbToHex(rgb: string[]) {
+ return rgb.map((i) => ("0" + parseInt(i).toString(16)).slice(-2)).join("");
+}
+
+function randomBetween(max: number, min: number) {
+ return Math.random() * (max - min) + min;
+}
diff --git a/ui/app/manager/test/fixtures/data/manager.ts b/ui/app/manager/test/fixtures/data/manager.ts
new file mode 100644
index 000000000..d14f16cf0
--- /dev/null
+++ b/ui/app/manager/test/fixtures/data/manager.ts
@@ -0,0 +1,34 @@
+export const markers = [
+ {
+ attributeName: "onOff",
+ showLabel: false,
+ showUnits: false,
+ colours: {
+ type: "boolean",
+ true: "fce61e",
+ false: "000000",
+ },
+ },
+ {
+ attributeName: "temperature",
+ showLabel: true,
+ showUnits: true,
+ colours: {
+ type: "range",
+ ranges: [
+ {
+ min: 0,
+ colour: "39b54a",
+ },
+ {
+ min: 30,
+ colour: "f7931e",
+ },
+ {
+ min: 40,
+ colour: "c1272d",
+ },
+ ],
+ },
+ },
+] as const;
diff --git a/ui/app/manager/test/fixtures/manager.ts b/ui/app/manager/test/fixtures/manager.ts
index ff1ebbb8f..fe35034cd 100644
--- a/ui/app/manager/test/fixtures/manager.ts
+++ b/ui/app/manager/test/fixtures/manager.ts
@@ -6,7 +6,7 @@ import type { DefaultAssets } from "./data/assets";
const { admin, smartcity } = users;
import { UserModel } from "../../src/pages/page-users";
-import { Asset, Role } from "@openremote/model";
+import { Asset, ManagerAppConfig, ManagerConfig, Role } from "@openremote/model";
import { test as base, expect, type Page, type ComponentTestFixtures, type Shared, withPage } from "@openremote/test";
import { AssetsPage, RealmsPage, RolesPage, RulesPage, UsersPage } from "./pages";
import { AssetViewer } from "../../../../component/or-asset-viewer/test/fixtures";
@@ -21,6 +21,7 @@ export const userStatePath = path.join(__dirname, "data/.auth/user.json");
export class Manager {
private readonly clientId = "openremote";
private readonly managerHost: String;
+ readonly api: RestApi["api"];
readonly axios: RestApi["_axiosInstance"];
public realm?: string;
@@ -32,9 +33,26 @@ export class Manager {
constructor(readonly page: Page, readonly baseURL: string) {
this.managerHost = process.env.managerUrl || "http://localhost:8080";
rest.initialise(`${this.managerHost}/api/master/`);
+ this.api = rest.api;
this.axios = rest.axiosInstance;
}
+ /**
+ * Fulfill the `manager_config.json` response with a custom app config.
+ * @param config The manager app config to merge with the default.
+ */
+ async configureAppConfig(config: ManagerAppConfig) {
+ const realms = {
+ default: {
+ appTitle: "OpenRemote Manager Test",
+ language: "en"
+ }
+ }
+ await this.page.route("/api/master/configuration/manager",
+ async (route) => await route.fulfill({ json: { realms, ...config } })
+ );
+ }
+
async goToRealmStartPage(realm: string) {
await this.page.goto(this.getAppUrl(realm));
}
@@ -112,6 +130,40 @@ export class Manager {
return access_token;
}
+ /**
+ * When an application initialises a WebSocket this will assign that instance to the `window.ws` object.
+ *
+ * Must only be used inside a `await page.addInitScript` before the WebSocket gets initialised.
+ */
+ hijackWebSocket() {
+ return () => {
+ const OriginalWS = WebSocket;
+ window.WebSocket = function (url: string | URL, protocols?: string | string[]) {
+ return (window as any).ws = new OriginalWS(url, protocols);
+ } as any;
+ }
+ }
+
+ /**
+ * Send a WebSocket event to the server using an existing WebSocket connection.
+ *
+ * You must add `await page.addInitScript(manager.hijackWebSocket())`
+ *
+ * @param payload The playload to send to WebSocket server.
+ * @see {@link hijackWebSocket}
+ */
+ async sendWebSocketEvent(payload: any) {
+ await this.page.evaluate((message) => {
+ if ("ws" in window) {
+ const ws = window.ws as WebSocket;
+ if (ws && ws.readyState === ws.OPEN) {
+ return ws.send(message);
+ }
+ }
+ console.warn('No active WebSocket found.');
+ }, `EVENT:${JSON.stringify(payload)}`);
+ }
+
/**
* Get the roles of the current realm
*
diff --git a/ui/app/manager/test/map.test.ts b/ui/app/manager/test/map.test.ts
index 0d51d1d50..be592f14d 100644
--- a/ui/app/manager/test/map.test.ts
+++ b/ui/app/manager/test/map.test.ts
@@ -1,35 +1,501 @@
import { expect } from "@openremote/test";
-import { test, userStatePath } from "./fixtures/manager.js";
-import { preparedAssetsWithLocation as assets } from "./fixtures/data/assets.js";
+import { adminStatePath, test, userStatePath } from "./fixtures/manager.js";
+import { preparedAssetsWithLocation as assets, assignLocation, commonAttrs, getAssetTypeColour, getAssetTypes, getAssetAt, rgbToHex, getAssetsForAllTypes } from "./fixtures/data/assets.js";
+import { markers } from "./fixtures/data/manager.js";
+import type { OrMap, OrClusterMarker } from "@openremote/or-map";
+import { type Asset, WellknownMetaItems } from "@openremote/model";
test.use({ storageState: userStatePath });
-/**
- * @given Assets with location are set up in the "smartcity" realm
- * @when Logging in to OpenRemote "smartcity" realm as "smartcity"
- * @and Navigating to the "map" tab
- * @and Checking that asset markers are displayed on the map
- * @and Clicking on a marker for the asset "Battery"
- * @and Navigating to the asset detail page from the map card
- * @then The asset detail page for "Battery" is visible
- *
- * @skip This test is skipped on Firefox because headless mode does not support WebGL required by maplibre
- */
-test("Verify that asset markers appear on the map and navigate correctly", async ({ page, manager, browserName }) => {
- test.skip(browserName === "firefox", "firefox headless mode does not support webgl required by maplibre");
+test.describe("Map markers", () => {
+ /**
+ * @given Assets with location are set up in the "smartcity" realm
+ * @when Logging in to OpenRemote "smartcity" realm as "smartcity"
+ * @and Navigating to the "map" page
+ * @then 2 asset markers are displayed on the map
+ * @when Clicking on the asset "Battery" marker
+ * @then The asset card is displayed
+ * @when Clicking "View"
+ * @then Navigates to the asset detail page from the asset card
+ * @and Shows the asset name "Battery" on the page header
+ * @and Displays a default marker on the map preview
+ * @when Clicking "Modify"
+ * @and the location attribute input icon
+ * @Then Displays a default marker on the map preview
+ *
+ * @skip This test is skipped on Firefox because headless mode does not support WebGL required by maplibre
+ */
+ test("should show asset and navigate", async ({ page, manager, browserName }) => {
+ test.skip(browserName === "firefox", "firefox headless mode does not support webgl required by maplibre");
- await manager.setup("smartcity", { assets });
- await manager.goToRealmStartPage("smartcity");
+ await manager.setup("smartcity", { assets });
+ await manager.configureAppConfig({ pages: { map: { clustering: { cluster: false } } } });
+ await manager.goToRealmStartPage("smartcity");
- const asset = assets[0].name;
+ const asset = assets[0].name;
+
+ await expect(page.locator(".or-map-marker")).toHaveCount(2);
- await expect(page.locator(".marker-icon")).toHaveCount(2);
+ await page.click(".marker-container");
+ await expect(page.locator("#card-container", { hasText: asset })).toBeVisible();
+
+ await page.getByRole("button", { name: "View" }).click();
+ await expect(page.locator(`#asset-header`, { hasText: asset })).toBeVisible();
+ await expect(page.locator("or-map").locator(".marker-container")).toBeVisible();
- await page.click(".marker-container");
- await expect(page.locator("#card-container", { hasText: asset })).toBeVisible();
+ await page.getByRole("button", { name: "Modify" }).click();
+ await page.locator("or-mwc-input[icon=crosshairs-gps]").click();
+ await expect(page.locator("or-map").locator(".marker-container")).toBeVisible();
+ });
- await page.getByRole("button", { name: "View" }).click();
- await expect(page.locator(`#asset-header`, { hasText: asset })).toBeVisible();
+ /**
+ * @given 1 asset is setup with "show on dashboard" set to true in the "smartcity" realm
+ * @and 1 asset is setup with "show on dashboard" set to false
+ * @when Logging in to OpenRemote "smartcity" realm as "smartcity"
+ * @and Navigating to the "map" page
+ * @then Only shows 1 marker
+ * @when Clicking the marker
+ * @then Shows the asset name "ShownOnMap" on the card title
+ *
+ * @skip This test is skipped on Firefox because headless mode does not support WebGL required by maplibre
+ */
+ test('should not show when "show on dashboard" is disabled', async ({ page, manager, browserName }) => {
+ test.skip(browserName === "firefox", "firefox headless mode does not support webgl required by maplibre");
+
+ const assets = [
+ ["ShownOnMap", { [WellknownMetaItems.SHOWONDASHBOARD]: true }, 4.482259693115793, 51.91756799273],
+ ["NotShownOnMap", { [WellknownMetaItems.SHOWONDASHBOARD]: false }, 4.4845127486877345, 51.917435642781214]
+ ].map(([name, meta, ...coordinates]) => Object.assign({ name, type: "ThingAsset", realm: "smartcity" }, {
+ attributes: {
+ ...commonAttrs,
+ location: { meta, value: { type: "Point", coordinates } }
+ }
+ })) as Asset[];
+ await manager.setup("smartcity", { assets });
+ await manager.configureAppConfig({ pages: { map: { clustering: { cluster: false } } } });
+ await manager.goToRealmStartPage("smartcity");
+
+ await expect(page.locator(".or-map-marker")).toHaveCount(1);
+
+ await page.click(".marker-container");
+ await expect(page.locator("#card-container", { hasText: assets[0].name })).toBeVisible();
+ });
+
+ /**
+ * @given Assets with location and different directions are set up in the "smartcity" realm
+ * @when Logging in to OpenRemote "smartcity" realm as "smartcity"
+ * @and Navigating to the "map" page
+ * @then Shows 3 asset markers
+ * @when Clicking each individually
+ * @then Shows their name and direction value
+ *
+ * @skip This test is skipped on Firefox because headless mode does not support WebGL required by maplibre
+ */
+ test("should show marker direction", async ({ page, manager, browserName }) => {
+ test.skip(browserName === "firefox", "firefox headless mode does not support webgl required by maplibre");
+
+ const assets = [
+ ["Thing1", 30, 4.482259693115793, 51.91756799273],
+ ["Thing2", 60, 4.4845127486877345, 51.917435642781214],
+ ["Thing3", 180, 4.486293735477517, 51.91605818019178]
+ ].map(([name, direction, ...coordinates]) => Object.assign({ name, type: "ThingAsset", realm: "smartcity" }, {
+ attributes: {
+ ...commonAttrs,
+ location: { value: { type: "Point", coordinates } },
+ direction: { type: "direction", value: direction }
+ }
+ })) as Asset[];
+ await manager.setup("smartcity", { assets });
+ await manager.configureAppConfig({ pages: { map: { clustering: { cluster: false } } } });
+ await manager.goToRealmStartPage("smartcity");
+
+ await expect(page.locator(".or-map-marker")).toHaveCount(assets.length);
+
+ // const getDirection = (el: Element) => window.getComputedStyle(el).transform;
+
+ for (const [i, asset] of assets.entries()) {
+ await page.locator(".marker-container").nth(i).click();
+ await expect(page.locator("#card-container", { hasText: asset.name })).toBeVisible();
+ await expect(page.locator('#attribute-list', { hasText: asset.attributes!.direction.value })).toBeVisible();
+ }
+ });
+})
+
+test.describe("Marker config", () => {
+ const getRGBColor = (el: Element): string[] => window.getComputedStyle(el).color.match(/\d+/g)!;
+
+ /**
+ * @given Asset with location is set up in the "smartcity" realm
+ * @and a marker config is configured
+ * @when Logging in to OpenRemote "smartcity" realm as "smartcity"
+ * @and Navigating to the "map" page
+ * @then 1 asset marker is displayed on the map
+ * @and It is colored black
+ * @when the marker is clicked
+ * @then shows the correct marker name
+ * @and The attribute value is shows "-"
+ * @when An update is sent to toggle the attribute value
+ * @then The marker changes to yellow
+ * @and The attribute value is shows "true"
+ *
+ * @skip This test is skipped on Firefox because headless mode does not support WebGL required by maplibre
+ */
+ test("should toggle asset marker colour based on attribute value", async ({ page, manager, browserName }) => {
+ test.skip(browserName === "firefox", "firefox headless mode does not support webgl required by maplibre");
+
+ await page.addInitScript(manager.hijackWebSocket());
+
+ const assets = [assignLocation({
+ name: "Light",
+ type: "ThingAsset",
+ realm: "smartcity",
+ attributes: { ...commonAttrs, onOff: { name: "onOff", type: "boolean" } }
+ }, { west: 4.4857, south: 51.9162, east: 4.4865, north: 51.9167 })]
+ await manager.setup("smartcity", { assets });
+ await manager.configureAppConfig({ pages: { map: { clustering: { cluster: false }, markers: { ThingAsset: markers[0] } } } });
+ await manager.goToRealmStartPage("smartcity");
+
+ await expect(page.locator(".or-map-marker")).toHaveCount(1);
+ await page.click(".marker-container");
+ await expect(page.locator("#card-container", { hasText: assets[0].name })).toBeVisible();
+ await expect(page.locator('#attribute-list', { hasText: "-" })).toBeVisible();
+
+ const off = await page.locator('or-icon[icon="or:marker"]').evaluate(getRGBColor);
+ expect(rgbToHex(off)).toBe(markers[0].colours.false);
+
+ await manager.sendWebSocketEvent({ eventType: "attribute", ref: { id: manager.assets[0].id, name: "onOff" }, value: true });
+ await expect(page.locator('#attribute-list', { hasText: "true" })).toBeVisible();
+
+ const on = await page.locator('or-icon[icon="or:marker"]').evaluate(getRGBColor);
+ expect(rgbToHex(on)).toBe(markers[0].colours.true);
+ });
+
+ /**
+ * @given Asset with location is set up in the "smartcity" realm
+ * @and a marker config is configured
+ * @when Logging in to OpenRemote "smartcity" realm as "smartcity"
+ * @and Navigating to the "map" page
+ * @then 1 asset marker is displayed on the map
+ * @when the marker is clicked
+ * @then shows the correct marker name
+ * @and it has the default marker color
+ * @and The attribute value is shows "-"
+ * @when An update is sent with a value of 0
+ * @then It is colored green
+ * @and The attribute value is shows "0"
+ * @when An update is sent with a value of 30
+ * @then The marker changes to orange
+ * @and The attribute value is shows "30"
+ * @when An update is sent with a value of 40
+ * @then The marker changes to red
+ * @and The attribute value is shows "40"
+ *
+ * @skip This test is skipped on Firefox because headless mode does not support WebGL required by maplibre
+ */
+ test("should display marker with label and change marker colour based on attribute range", async ({ page, manager, browserName }) => {
+ test.skip(browserName === "firefox", "firefox headless mode does not support webgl required by maplibre");
+
+ await page.addInitScript(manager.hijackWebSocket());
+
+ const assets = [assignLocation({
+ name: "Thermometer",
+ type: "ThingAsset",
+ realm: "smartcity",
+ attributes: { ...commonAttrs, temperature: { name: "temperature", type: "number" } }
+ }, { west: 4.4857, south: 51.9162, east: 4.4865, north: 51.9167 })]
+ await manager.setup("smartcity", { assets });
+ await manager.configureAppConfig({ pages: { map: { markers: { ThingAsset: markers[1] } } } });
+ await manager.goToRealmStartPage("smartcity");
+
+ await expect(page.locator(".or-map-marker")).toHaveCount(1);
+ await page.click(".marker-container");
+ await expect(page.locator("#card-container", { hasText: assets[0].name })).toBeVisible();
+ await expect(page.locator('#attribute-list', { hasText: "-" })).toBeVisible();
+ await expect(page.locator(".marker-container .label", { hasText: "-" })).toBeVisible();
+
+ const _default = await page.locator('or-icon[icon="or:marker"]').evaluate(getRGBColor);
+ expect(rgbToHex(_default)).toBe("4c4c4c");
+
+ await manager.sendWebSocketEvent({ eventType: "attribute", ref: { id: manager.assets[0].id, name: "temperature" }, value: 0 });
+ await expect(page.locator('#attribute-list', { hasText: "0" })).toBeVisible();
+ await expect(page.locator(".marker-container .label", { hasText: "0" })).toBeVisible();
+
+ const green = await page.locator('or-icon[icon="or:marker"]').evaluate(getRGBColor);
+ expect(rgbToHex(green)).toBe(markers[1].colours.ranges[0].colour);
+
+ await manager.sendWebSocketEvent({ eventType: "attribute", ref: { id: manager.assets[0].id, name: "temperature" }, value: 30 });
+ await expect(page.locator('#attribute-list', { hasText: "30" })).toBeVisible();
+ await expect(page.locator(".marker-container .label", { hasText: "30" })).toBeVisible();
+
+ const orange = await page.locator('or-icon[icon="or:marker"]').evaluate(getRGBColor);
+ expect(rgbToHex(orange)).toBe(markers[1].colours.ranges[1].colour);
+
+ await manager.sendWebSocketEvent({ eventType: "attribute", ref: { id: manager.assets[0].id, name: "temperature" }, value: 40 });
+ await expect(page.locator('#attribute-list', { hasText: "40" })).toBeVisible();
+ await expect(page.locator(".marker-container .label", { hasText: "40" })).toBeVisible();
+
+ const red = await page.locator('or-icon[icon="or:marker"]').evaluate(getRGBColor);
+ expect(rgbToHex(red)).toBe(markers[1].colours.ranges[2].colour);
+ });
+})
+
+test.describe("Marker clustering", () => {
+ /**
+ * @given Assets with location are set up in the "smartcity" realm
+ * @when Logging in to OpenRemote "smartcity" realm as "smartcity"
+ * @and Navigating to the "map" page
+ * @then Shows cluster marker with the expected asset type colours
+ * @when Zooming in
+ * @then Shows cluster marker reduce to 10
+ * @and Shows a normal marker
+ * @when When clicking the cluster marker
+ * @then Cluster marker disappears
+ * @and All 10 asset markers part of the cluster are shown
+ *
+ * @skip This test is skipped on Firefox because headless mode does not support WebGL required by maplibre
+ */
+ test("should display clustered markers", async ({ page, manager, browserName }) => {
+ test.skip(browserName === "firefox", "firefox headless mode does not support webgl required by maplibre");
+
+ const bbox = { west: 4.4857, south: 51.9162, east: 4.4865, north: 51.9167 };
+ const assetInfos = (await manager.api.AssetModelResource.getAssetInfos()).data;
+ const assets = getAssetsForAllTypes(assetInfos, { bbox });
+ const outlierbbox = { west: 4.483812, south: 51.916359, east: 4.484017, north: 51.916495 };
+ assets.push({ ...assignLocation(getAssetAt(assetInfos), outlierbbox), name: "outlier", realm: "smartcity" })
+
+ await manager.setup("smartcity", { assets });
+ await manager.goToRealmStartPage("smartcity");
+
+ await expect(page.locator("or-map")).toBeVisible();
+ await page.locator("or-map").evaluate((map: OrMap) => map.flyTo(undefined, 10));
+
+ const clusterMarker = page.locator("or-cluster-marker");
+ const coords = await clusterMarker.evaluate((marker: OrClusterMarker) => [marker.lng,marker.lat]);
+ await expect(clusterMarker.locator("text")).toContainText(`${assets.length}`);
+ const assetTypes = getAssetTypes(assets);
+ expect(
+ await clusterMarker.locator("path[fill]").evaluateAll(el => el.map(e => e.getAttribute("fill")!))
+ ).toStrictEqual(assetTypes.map((t) => "#" + getAssetTypeColour(t, assetInfos)));
+
+ // await page.locator("or-map").evaluate((map: OrMap) => map.flyTo([4.482259693115793, 51.91756799273], 17));
+ await page.locator("or-map").evaluate((map: OrMap, [lng,lat]) => map.flyTo([lng!,lat!], 16.1), coords);
+
+ await expect(clusterMarker.locator("text")).toContainText(`${assets.length}`);
+ await expect(page.locator('.or-map-marker')).toHaveCount(1);
+
+ await clusterMarker.click();
+ await expect(clusterMarker).not.toBeVisible();
+ await expect(page.locator('.or-map-marker')).toHaveCount(assets.length - 1);
+ });
+
+ /**
+ * @given Assets with location are set up in the "smartcity" realm
+ * @and clustering is disabled
+ * @when Logging in to OpenRemote "smartcity" realm as "smartcity"
+ * @and Navigating to the "map" page
+ * @then Shows asset markers
+ *
+ * @skip This test is skipped on Firefox because headless mode does not support WebGL required by maplibre
+ */
+ test("should not display clustered markers", async ({ page, manager, browserName }) => {
+ test.skip(browserName === "firefox", "firefox headless mode does not support webgl required by maplibre");
+
+ const assetInfos = (await manager.api.AssetModelResource.getAssetInfos()).data;
+ const assets = getAssetsForAllTypes(assetInfos);
+
+ await manager.setup("smartcity", { assets });
+ await manager.configureAppConfig({ pages: { map: { clustering: { cluster: false } } } })
+ await manager.goToRealmStartPage("smartcity");
+
+ await expect(page.locator("or-map")).toBeVisible();
+ await page.locator("or-map").evaluate((map: OrMap) => map.flyTo(undefined, 10));
+
+ await expect(page.locator("or-cluster-marker")).not.toBeVisible();
+ await expect(page.locator(".or-map-marker")).toHaveCount(assets.length);
+ });
+
+ test.describe(() => {
+ test.use({ storageState: adminStatePath });
+
+ /**
+ * @given Assets with location are set up in the "smartcity" realm
+ * @when Logging in to OpenRemote "master" realm as "admin"
+ * @and Navigating to the "map" page
+ * @then Shows no markers
+ * @when Switching to the "smartcity" realm
+ * @then Shows cluster markers
+ * @when Switching back to the "master" realm
+ * @then Shows no markers
+ *
+ * @skip This test is skipped on Firefox because headless mode does not support WebGL required by maplibre
+ */
+ test("should update markers when switching realm", async ({ page, manager, browserName }) => {
+ test.skip(browserName === "firefox", "firefox headless mode does not support webgl required by maplibre");
+
+ const assetInfos = (await manager.api.AssetModelResource.getAssetInfos()).data;
+ const assets = getAssetsForAllTypes(assetInfos);
+ await manager.setup("smartcity", { assets });
+
+ await manager.goToRealmStartPage("master");
+ await page.locator("or-map").evaluate((map: OrMap) => map.flyTo(undefined, 10));
+ await expect(page.locator("or-cluster-marker")).not.toBeVisible();
+ await expect(page.locator(".or-map-marker")).not.toBeVisible();
+
+ await manager.switchToRealmByRealmPicker("smartcity");
+ await page.locator("or-map").evaluate((map: OrMap) => map.flyTo(undefined, 10));
+ await expect(page.locator(".or-map-marker").or(page.locator("or-cluster-marker")).first()).toBeVisible();
+
+ await manager.switchToRealmByRealmPicker("master");
+ await page.locator("or-map").evaluate((map: OrMap) => map.flyTo(undefined, 10));
+ await expect(page.locator("or-cluster-marker")).not.toBeVisible();
+ await expect(page.locator(".or-map-marker")).not.toBeVisible();
+ });
+ })
+});
+
+test.describe("Asset type legend", () => {
+ /**
+ * @given Assets with location are set up in the "smartcity" realm
+ * @when Logging in to OpenRemote "smartcity" realm as "smartcity"
+ * @and Navigating to the "map" page
+ * @then Show the asset type legend
+ * @when clicking the open menu button
+ * @then the asset type legend opens and shows the asset types
+ * @and the asset types checkboxes are checked
+ * @when Unchecking the asset type check boxes 1 by 1
+ * @then Hides the markers
+ *
+ * @skip This test is skipped on Firefox because headless mode does not support WebGL required by maplibre
+ */
+ test("should toggle asset types", async ({ page, manager, browserName }) => {
+ test.skip(browserName === "firefox", "firefox headless mode does not support webgl required by maplibre");
+
+ const assetInfos = (await manager.api.AssetModelResource.getAssetInfos()).data;
+ const assets = getAssetsForAllTypes(assetInfos, { limit: 3 });
+
+ await manager.setup("smartcity", { assets });
+ await manager.configureAppConfig({ pages: { map: { clustering: { cluster: false } } } });
+ await manager.goToRealmStartPage("smartcity");
+
+ await expect(page.locator("or-map")).toBeVisible();
+ await page.locator("or-map").evaluate((map: OrMap) => map.flyTo(undefined, 10));
+
+ await page.locator('or-map-legend [icon="menu"]').click();
+ await expect(page.locator("or-map-legend #legend-content")).toBeVisible();
+
+ const assetTypes = getAssetTypes(assets);
+
+ const options = await page.locator("or-map-legend #legend-content").getByRole("listitem").all();
+ for (const [i, option] of options.entries()) {
+ await expect(option).toHaveAttribute("data-asset-type", assetTypes[i]);
+ }
+
+ let count = 0;
+ for (const option of options) {
+ await expect(option.getByRole("checkbox")).toBeChecked()
+ await expect(page.locator(".or-map-marker")).toHaveCount(assets.length - count);
+
+ for (const asset of assets) { if (asset.type == (await option.getAttribute("data-asset-type"))) count++ }
+ await option.getByRole("checkbox").uncheck();
+ await expect(page.locator(".or-map-marker")).toHaveCount(assets.length - count);
+ }
+ });
+
+ /**
+ * @given Only 1 asset type is setup with a location in the "smartcity" realm
+ * @when Logging in to OpenRemote "smartcity" realm as "smartcity"
+ * @and Navigating to the "map" page
+ * @then Shows the marker
+ * @and the legend is not visible
+ *
+ * @skip This test is skipped on Firefox because headless mode does not support WebGL required by maplibre
+ */
+ test("should not not be shown with 1 asset type", async ({ page, manager, browserName }) => {
+ test.skip(browserName === "firefox", "firefox headless mode does not support webgl required by maplibre");
+
+ const assets = [assignLocation({
+ name: "Thing",
+ type: "ThingAsset",
+ realm: "smartcity",
+ attributes: { ...commonAttrs }
+ }, { west: 4.4857, south: 51.9162, east: 4.4865, north: 51.9167 })]
+
+ await manager.setup("smartcity", { assets });
+ await manager.goToRealmStartPage("smartcity");
+
+ await expect(page.locator("or-map")).toBeVisible();
+ await expect(page.locator(".or-map-marker")).toBeVisible();
+ await expect(page.locator("or-map-legend")).not.toBeVisible();
+ });
+
+ test.describe(() => {
+ test.use({ storageState: adminStatePath });
+
+ /**
+ * @given Assets with location are set up in the "smartcity" realm
+ * @when Logging in to OpenRemote "smartcity" realm as "smartcity"
+ * @and Navigating to the "map" page
+ * @then Show the asset type legend
+ * @when clicking the open menu button
+ * @then the asset type legend opens and shows the asset types
+ * @and the asset types checkboxes are checked
+ * @when Unchecking the asset type check boxes 1 by 1
+ * @then Hides the markers
+ * @when Switching to the "master" realm
+ * @then Hides the legend
+ * @and No markers are shown
+ * @when Switching back to the "smartcity" realm
+ * @then Shows the legend again
+ * @and All asset types are checked
+ * @and All markers are shown
+ *
+ * @skip This test is skipped on Firefox because headless mode does not support WebGL required by maplibre
+ */
+ test("should reset when switching realm", async ({ page, manager, browserName }) => {
+ test.skip(browserName === "firefox", "firefox headless mode does not support webgl required by maplibre");
+
+ const assetInfos = (await manager.api.AssetModelResource.getAssetInfos()).data;
+ const assets = getAssetsForAllTypes(assetInfos, { limit: 3 });
+
+ await manager.setup("smartcity", { assets });
+ await manager.configureAppConfig({ pages: { map: { clustering: { cluster: false } } } });
+ await manager.goToRealmStartPage("master");
+ await manager.switchToRealmByRealmPicker("smartcity");
+
+ await expect(page.locator("or-map")).toBeVisible();
+ await page.locator("or-map").evaluate((map: OrMap) => map.flyTo(undefined, 10));
+ await expect(page.locator(".or-map-marker")).toHaveCount(assets.length);
+
+ await page.locator('or-map-legend [icon="menu"]').click();
+ await expect(page.locator("or-map-legend #legend-content")).toBeVisible();
+
+ const assetTypes = getAssetTypes(assets);
+
+ const options = await page.locator("or-map-legend #legend-content").getByRole("listitem").all();
+ for (const [i, option] of options.entries()) {
+ await expect(option).toHaveAttribute("data-asset-type", assetTypes[i]);
+ }
+
+ for (const option of options) {
+ await expect(option.getByRole("checkbox")).toBeChecked()
+ await option.getByRole("checkbox").uncheck();
+ }
+ await expect(page.locator(".or-map-marker")).toHaveCount(0);
+
+ await manager.switchToRealmByRealmPicker("master");
+ await page.locator("or-map").evaluate((map: OrMap) => map.flyTo(undefined, 10));
+ await expect(page.locator(".or-map-marker")).toHaveCount(0);
+ await expect(page.locator('or-map-legend')).not.toBeVisible();
+
+ await manager.switchToRealmByRealmPicker("smartcity");
+ await page.locator("or-map").evaluate((map: OrMap) => map.flyTo(undefined, 10));
+ await expect(page.locator(".or-map-marker")).toHaveCount(assets.length);
+ await page.locator('or-map-legend [icon="menu"]').click();
+ for (const option of options) {
+ await expect(option.getByRole("checkbox")).toBeChecked()
+ }
+ });
+ });
});
test.afterEach(async ({ manager }) => {
diff --git a/ui/app/shared/locales/en/or.json b/ui/app/shared/locales/en/or.json
index 64e71c257..472b430d1 100644
--- a/ui/app/shared/locales/en/or.json
+++ b/ui/app/shared/locales/en/or.json
@@ -918,6 +918,9 @@
"MEDIAN": "Median",
"MODE": "Mode",
"SUM": "Sum",
+ "mapPage": {
+ "legendTitle": "Legend"
+ },
"alarm": {
"": "Alarm",
"alarm_plural": "Alarms",
diff --git a/ui/app/shared/locales/fr/or.json b/ui/app/shared/locales/fr/or.json
index 9b9bd18d8..c0c125f44 100644
--- a/ui/app/shared/locales/fr/or.json
+++ b/ui/app/shared/locales/fr/or.json
@@ -461,6 +461,9 @@
"attributeValueLabel": "Attribute value",
"assetTypeDoesNotExist": "Filter : Asset type does not exist"
},
+ "mapPage": {
+ "legendTitle": "Légende"
+ },
"org": {
"openremote": {
"model": {
diff --git a/ui/app/shared/locales/nl/or.json b/ui/app/shared/locales/nl/or.json
index 4ee916fd4..ef1dea821 100644
--- a/ui/app/shared/locales/nl/or.json
+++ b/ui/app/shared/locales/nl/or.json
@@ -916,6 +916,9 @@
"MEDIAN": "Mediaan",
"MODE": "Modus",
"SUM": "Som",
+ "mapPage": {
+ "legendTitle": "Legenda"
+ },
"alarm": {
"": "Alarm",
"alarm_plural": "Alarmen",
diff --git a/ui/component/or-map/package.json b/ui/component/or-map/package.json
index caa54461c..9ea446e54 100644
--- a/ui/component/or-map/package.json
+++ b/ui/component/or-map/package.json
@@ -28,12 +28,11 @@
"@openremote/or-icon": "workspace:*",
"@openremote/or-mwc-components": "workspace:*",
"@openremote/or-translate": "workspace:*",
- "@polymer/polymer": "^3.3.1",
"lit": "^3.3.1",
"lit-html": "^3.3.1",
"lodash": "^4.17.21",
"mapbox.js": "^3.3.1",
- "maplibre-gl": "^4.1.2"
+ "maplibre-gl": "^5.12.0"
},
"devDependencies": {
"@types/geojson": "^7946.0.7",
diff --git a/ui/component/or-map/src/controls/center.ts b/ui/component/or-map/src/controls/center.ts
new file mode 100644
index 000000000..dab1bce9d
--- /dev/null
+++ b/ui/component/or-map/src/controls/center.ts
@@ -0,0 +1,33 @@
+import { LngLatLike, Map as MapGL } from "maplibre-gl";
+
+export class CenterControl {
+ protected map?: MapGL;
+ protected elem?: HTMLElement;
+ public pos?: LngLatLike;
+
+ onAdd(map: MapGL): HTMLElement {
+ this.map = map;
+ const control = document.createElement("div");
+ control.classList.add("maplibregl-ctrl");
+ control.classList.add("maplibregl-ctrl-group");
+ const button = document.createElement("button");
+ button.className = "maplibregl-ctrl-compass";
+ button.addEventListener("click", (ev) =>
+ map.flyTo({
+ center: this.pos,
+ zoom: map.getZoom(),
+ })
+ );
+ const buttonIcon = document.createElement("span");
+ buttonIcon.className = "maplibregl-ctrl-icon";
+ button.appendChild(buttonIcon);
+ control.appendChild(button);
+ this.elem = control;
+ return control;
+ }
+
+ onRemove(map: MapGL) {
+ this.map = undefined;
+ this.elem = undefined;
+ }
+}
diff --git a/ui/component/or-map/src/controls/coordinates.ts b/ui/component/or-map/src/controls/coordinates.ts
new file mode 100644
index 000000000..130edce3a
--- /dev/null
+++ b/ui/component/or-map/src/controls/coordinates.ts
@@ -0,0 +1,79 @@
+import { IControl, LngLat, Map as MapGL } from "maplibre-gl";
+import { InputType, OrMwcInput } from "@openremote/or-mwc-components/or-mwc-input";
+
+export const CoordinatesRegexPattern = "^[ ]*(?:Lat: )?(-?\\d+\\.?\\d*)[, ]+(?:Lng: )?(-?\\d+\\.?\\d*)[ ]*$";
+
+export function getCoordinatesInputKeyHandler(valueChangedHandler: (value: LngLat | undefined) => void) {
+ return (e: KeyboardEvent) => {
+ if (e.code === "Enter" || e.code === "NumpadEnter") {
+ const valStr = (e.target as OrMwcInput).value as string;
+ let value: LngLat | undefined = !valStr ? undefined : {} as LngLat;
+
+ if (valStr) {
+ const lngLatArr = valStr.split(/[ ,]/).filter(v => !!v);
+ if (lngLatArr.length === 2) {
+ value = new LngLat(
+ Number.parseFloat(lngLatArr[0]),
+ Number.parseFloat(lngLatArr[1])
+ );
+ }
+ }
+ valueChangedHandler(value);
+ }
+ };
+}
+
+export class CoordinatesControl implements IControl {
+ protected map?: MapGL;
+ protected elem?: HTMLElement;
+ protected input!: OrMwcInput;
+ protected _readonly = false;
+ protected _value: any;
+ protected _valueChangedHandler: (value: LngLat | undefined) => void;
+
+ constructor(disabled = false, valueChangedHandler: (value: LngLat | undefined) => void) {
+ this._readonly = disabled;
+ this._valueChangedHandler = valueChangedHandler;
+ }
+
+ onAdd(map: MapGL): HTMLElement {
+ this.map = map;
+ const control = document.createElement("div");
+ control.classList.add("maplibregl-ctrl");
+ control.classList.add("maplibregl-ctrl-group");
+
+ const input = new OrMwcInput();
+ input.type = InputType.TEXT;
+ input.outlined = true;
+ input.compact = true;
+ input.readonly = this._readonly;
+ input.icon = "crosshairs-gps";
+ input.value = this._value;
+ input.pattern = CoordinatesRegexPattern;
+ input.onkeyup = getCoordinatesInputKeyHandler(this._valueChangedHandler);
+
+ control.appendChild(input);
+ this.elem = control;
+ this.input = input;
+ return control;
+ }
+
+ onRemove(map: MapGL) {
+ this.map = undefined;
+ this.elem = undefined;
+ }
+
+ public set readonly(readonly: boolean) {
+ this._readonly = readonly;
+ if (this.input) {
+ this.input.readonly = readonly;
+ }
+ }
+
+ public set value(value: any) {
+ this._value = value;
+ if (this.input) {
+ this.input.value = value;
+ }
+ }
+}
diff --git a/ui/component/or-map/src/index.ts b/ui/component/or-map/src/index.ts
index b770aa943..9359d728d 100644
--- a/ui/component/or-map/src/index.ts
+++ b/ui/component/or-map/src/index.ts
@@ -1,9 +1,8 @@
import manager, {EventCallback} from "@openremote/core";
-import {FlattenedNodesObserver} from "@polymer/polymer/lib/utils/flattened-nodes-observer.js";
-import {CSSResult, html, LitElement, PropertyValues} from "lit";
+import {html, LitElement, PropertyValues} from "lit";
import {customElement, property, query} from "lit/decorators.js";
-import {IControl, LngLat, LngLatBoundsLike, LngLatLike, Map as MapGL, GeolocateControl} from "maplibre-gl";
-import {MapWidget} from "./mapwidget";
+import {IControl, LngLat, LngLatBoundsLike, LngLatLike, GeolocateControl} from "maplibre-gl";
+import {ClusterConfig, MapWidget} from "./mapwidget";
import {style} from "./style";
import "./markers/or-map-marker";
import "./markers/or-map-marker-asset";
@@ -11,7 +10,6 @@ import {OrMapMarker, OrMapMarkerChangedEvent} from "./markers/or-map-marker";
import * as Util from "./util";
import {
InputType,
- OrMwcInput,
ValueInputProviderGenerator,
ValueInputTemplateFunction
} from "@openremote/or-mwc-components/or-mwc-input";
@@ -19,14 +17,24 @@ import {OrMwcDialog, showDialog} from "@openremote/or-mwc-components/or-mwc-dial
import {getMarkerIconAndColorFromAssetType} from "./util";
import {i18next} from "@openremote/or-translate";
import { debounce } from "lodash";
-import {GeoJsonConfig, MapType } from "@openremote/model";
+import { Asset, Attribute, GeoJsonConfig, GeoJSONPoint, MapType, WellknownAttributes } from "@openremote/model";
+import { CoordinatesControl, CoordinatesRegexPattern, getCoordinatesInputKeyHandler } from "./controls/coordinates";
+import { CenterControl } from "./controls/center";
// Re-exports
-export {Util, LngLatLike, LngLat};
+export {Util, LngLatLike, LngLat, ClusterConfig};
export * from "./markers/or-map-marker";
export * from "./markers/or-map-marker-asset";
+export * from "./markers/or-cluster-marker";
export {IControl} from "maplibre-gl";
export * from "./or-map-asset-card";
+export * from "./or-map-legend";
+
+export interface AssetWithLocation extends Asset {
+ attributes: { [index: string]: Attribute<any> } & {
+ [WellknownAttributes.LOCATION]: Attribute<GeoJSONPoint>
+ };
+}
export interface ViewSettings {
center: LngLatLike;
@@ -35,7 +43,7 @@ export interface ViewSettings {
maxZoom: number;
minZoom: number;
boxZoom: boolean;
- geocodeUrl: String;
+ geocodeUrl: string;
geoJson?: GeoJsonConfig
}
@@ -62,7 +70,7 @@ export class OrMapClickedEvent extends CustomEvent<MapEventDetail> {
public static readonly NAME = "or-map-clicked";
- constructor(lngLat: LngLat, doubleClick: boolean = false) {
+ constructor(lngLat: LngLat, doubleClick = false) {
super(OrMapClickedEvent.NAME, {
detail: {
doubleClick: doubleClick,
@@ -105,125 +113,31 @@ export class OrMapGeocoderChangeEvent extends CustomEvent<MapGeocoderEventDetail
}
}
+export class OrMapMarkersChangedEvent extends CustomEvent<AssetWithLocation[]> {
+
+ public static readonly NAME = "or-map-markers-changed";
+
+ constructor(assets: AssetWithLocation[]) {
+ super(OrMapMarkersChangedEvent.NAME, {
+ detail: assets,
+ bubbles: true,
+ composed: true
+ });
+ }
+}
+
declare global {
export interface HTMLElementEventMap {
[OrMapClickedEvent.NAME]: OrMapClickedEvent;
[OrMapLoadedEvent.NAME]: OrMapLoadedEvent;
[OrMapLongPressEvent.NAME]: OrMapLongPressEvent;
[OrMapGeocoderChangeEvent.NAME]: OrMapGeocoderChangeEvent;
+ [OrMapMarkersChangedEvent.NAME]: OrMapMarkersChangedEvent;
}
}
export type ControlPosition = "top-right" | "top-left" | "bottom-right" | "bottom-left";
-export class CenterControl {
- protected map?: MapGL;
- protected elem?: HTMLElement;
- public pos?: LngLatLike;
-
- onAdd(map: MapGL): HTMLElement {
- this.map = map;
- const control = document.createElement("div");
- control.classList.add("maplibregl-ctrl");
- control.classList.add("maplibregl-ctrl-group");
- const button = document.createElement("button");
- button.className = "maplibregl-ctrl-compass";
- button.addEventListener("click", (ev) => map.flyTo({
- center: this.pos,
- zoom: map.getZoom()
- }));
- const buttonIcon = document.createElement("span");
- buttonIcon.className = "maplibregl-ctrl-icon";
- button.appendChild(buttonIcon);
- control.appendChild(button);
- this.elem = control;
- return control;
- }
-
- onRemove(map: MapGL) {
- this.map = undefined;
- this.elem = undefined;
- }
-}
-
-const CoordinatesRegexPattern = "^[ ]*(?:Lat: )?(-?\\d+\\.?\\d*)[, ]+(?:Lng: )?(-?\\d+\\.?\\d*)[ ]*$";
-
-function getCoordinatesInputKeyHandler(valueChangedHandler: (value: LngLat | undefined) => void) {
- return (e: KeyboardEvent) => {
- if (e.code === "Enter" || e.code === "NumpadEnter") {
- const valStr = (e.target as OrMwcInput).value as string;
- let value: LngLat | undefined = !valStr ? undefined : {} as LngLat;
-
- if (valStr) {
- const lngLatArr = valStr.split(/[ ,]/).filter(v => !!v);
- if (lngLatArr.length === 2) {
- value = new LngLat(
- Number.parseFloat(lngLatArr[0]),
- Number.parseFloat(lngLatArr[1])
- );
- }
- }
- valueChangedHandler(value);
- }
- };
-}
-
-export class CoordinatesControl {
-
- protected map?: MapGL;
- protected elem?: HTMLElement;
- protected input!: OrMwcInput;
- protected _readonly = false;
- protected _value: any;
- protected _valueChangedHandler: (value: LngLat | undefined) => void;
-
- constructor(disabled: boolean = false, valueChangedHandler: (value: LngLat | undefined) => void) {
- this._readonly = disabled;
- this._valueChangedHandler = valueChangedHandler;
- }
-
- onAdd(map: MapGL): HTMLElement {
- this.map = map;
- const control = document.createElement("div");
- control.classList.add("maplibregl-ctrl");
- control.classList.add("maplibregl-ctrl-group");
-
- const input = new OrMwcInput();
- input.type = InputType.TEXT;
- input.outlined = true;
- input.compact = true;
- input.readonly = this._readonly;
- input.icon = "crosshairs-gps";
- input.value = this._value;
- input.pattern = CoordinatesRegexPattern;
- input.onkeyup = getCoordinatesInputKeyHandler(this._valueChangedHandler);
-
- control.appendChild(input);
- this.elem = control;
- this.input = input;
- return control;
- }
-
- onRemove(map: MapGL) {
- this.map = undefined;
- this.elem = undefined;
- }
-
- public set readonly(readonly: boolean) {
- this._readonly = readonly;
- if (this.input) {
- this.input.readonly = readonly;
- }
- }
-
- public set value(value: any) {
- this._value = value;
- if (this.input) {
- this.input.value = value;
- }
- }
-}
-
export const geoJsonPointInputTemplateProvider: ValueInputProviderGenerator = (assetDescriptor, valueHolder, valueHolderDescriptor, valueDescriptor, valueChangeNotifier, options) => {
const disabled = !!(options && options.disabled);
@@ -388,7 +302,6 @@ export const geoJsonPointInputTemplateProvider: ValueInputProviderGenerator = (a
};
}
-
@customElement("or-map")
export class OrMap extends LitElement {
@@ -397,7 +310,9 @@ export class OrMap extends LitElement {
@property({type: String})
public type: MapType = manager.mapType;
- protected _markerStyles: string[] = [];
+ @property({type: Object})
+ public cluster?: ClusterConfig;
+
@property({type: String, converter: {
fromAttribute(value: string | null, type?: String): LngLatLike | undefined {
if (!value) {
@@ -451,8 +366,6 @@ export class OrMap extends LitElement {
protected _initCallback?: EventCallback;
protected _map?: MapWidget;
protected _loaded: boolean = false;
- protected _observer?: FlattenedNodesObserver;
- protected _markers: OrMapMarker[] = [];
protected _resizeObserver?: ResizeObserver;
@@ -467,6 +380,20 @@ export class OrMap extends LitElement {
this.addEventListener(OrMapMarkerChangedEvent.NAME, this._onMarkerChangedEvent);
}
+ public addAssetMarker(asset: AssetWithLocation) {
+ const coordinates = asset?.attributes?.location.value;
+ if (!coordinates?.coordinates) return;
+ this._map?.addAssetMarker(asset.id ?? '', asset.name ?? '', asset.type ?? '', coordinates.coordinates[0], coordinates.coordinates[1], asset);
+ }
+
+ public cleanUpAssetMarkers(): void {
+ this._map?.cleanUpAssetMarkers();
+ }
+
+ public async reload() {
+ await this._map?.load();
+ }
+
protected firstUpdated(_changedProperties: PropertyValues): void {
super.firstUpdated(_changedProperties);
if (manager.ready) {
@@ -474,19 +401,12 @@ export class OrMap extends LitElement {
}
}
- public get markers(): OrMapMarker[] {
- return this._markers;
- }
-
public connectedCallback() {
super.connectedCallback();
}
public disconnectedCallback() {
super.disconnectedCallback();
- if (this._observer) {
- this._observer.disconnect();
- }
if(this._resizeObserver) {
this._resizeObserver.disconnect();
}
@@ -527,37 +447,38 @@ export class OrMap extends LitElement {
}
public loadMap() {
-
if (this._loaded) {
return;
}
if (this._mapContainer && this._slotElement) {
- this._map = new MapWidget(this.type, this.shadowRoot!, this._mapContainer, this.showGeoCodingControl, this.showBoundaryBoxControl, this.useZoomControl, this.showGeoJson)
+ this._map = new MapWidget(this.type, this.shadowRoot!, this._mapContainer, this.showGeoCodingControl, this.showBoundaryBoxControl, this.useZoomControl, this.showGeoJson, this.cluster)
.setCenter(this.center)
.setZoom(this.zoom)
.setControls(this.controls)
.setGeoJson(this.geoJson);
- this._map.load().then(() => {
- // Get markers from slot
- this._observer = new FlattenedNodesObserver(this._slotElement!, (info: any) => {
- this._processNewMarkers(info.addedNodes);
- this._processRemovedMarkers(info.removedNodes);
- });
+
+ this._map.build().then(() => {
this._resizeObserver?.disconnect();
this._resizeObserver = new ResizeObserver(debounce(() => {
this.resize();
}, 200));
- var container = this._mapContainer?.parentElement;
+ const container = this._mapContainer?.parentElement;
if (container) {
this._resizeObserver.observe(container);
}
+ this._slotElement!.assignedNodes({ flatten: true }).forEach((node) => {
+ if (node instanceof OrMapMarker) {
+ const marker = node;
+ this._map!.addMarker(marker)
+ }
+ })
});
}
this._loaded = true;
}
-
+
public resize() {
if (this._map) {
this._map.resize();
@@ -575,62 +496,4 @@ export class OrMap extends LitElement {
this._map.onMarkerChanged(evt.detail.marker, evt.detail.property);
}
}
-
- protected _processNewMarkers(nodes: Element[]) {
- nodes.forEach((node) => {
- if (!this._map) {
- return;
- }
-
- if (node instanceof OrMapMarker) {
-
- this._markers.push(node);
-
- // Add styles of marker class to the shadow root if not already added
- const className = node.constructor.name;
- if (this._markerStyles.indexOf(className) < 0) {
- const styles = (node.constructor as any).styles;
- let stylesArr: CSSResult[] = [];
-
- if (styles) {
- if (!Array.isArray(styles)) {
- stylesArr.push(styles as CSSResult);
- } else {
- stylesArr = styles as CSSResult[];
- }
-
- stylesArr.forEach((styleItem) => {
- const styleElem = document.createElement("style");
- styleElem.textContent = String(styleItem.toString());
- if (this._mapContainer!.children.length > 0) {
- this._mapContainer!.insertBefore(styleElem, this._mapContainer!.children[0]);
- } else {
- this._mapContainer!.appendChild(styleElem);
- }
- });
- }
-
- this._markerStyles.push(className);
- }
-
- this._map.addMarker(node);
- }
- });
- }
-
- protected _processRemovedMarkers(nodes: Element[]) {
- nodes.forEach((node) => {
- if (!this._map) {
- return;
- }
-
- if (node instanceof OrMapMarker) {
- const i = this._markers.indexOf(node);
- if (i >= 0) {
- this._markers.splice(i, 1);
- }
- this._map.removeMarker(node);
- }
- });
- }
}
diff --git a/ui/component/or-map/src/mapwidget.ts b/ui/component/or-map/src/mapwidget.ts
index 8212f8a28..a401d1097 100644
--- a/ui/component/or-map/src/mapwidget.ts
+++ b/ui/component/or-map/src/mapwidget.ts
@@ -23,17 +23,27 @@ import {
OrMapLoadedEvent,
OrMapLongPressEvent,
ViewSettings,
+ OrMapMarkersChangedEvent,
+ AssetWithLocation,
} from "./index";
import { OrMapMarker } from "./markers/or-map-marker";
-import { getLatLngBounds, getLngLat } from "./util";
-import {GeoJsonConfig, MapType } from "@openremote/model";
-import { Feature, FeatureCollection } from "geojson";
-import { isMapboxURL, transformMapboxUrl } from "./mapbox-url-utils";
+import { getLatLngBounds, getLngLat, getMarkerIconAndColorFromAssetType, isWebglSupported } from "./util";
+import { Asset, GeoJsonConfig, MapType } from "@openremote/model";
+import { Feature, FeatureCollection, Geometry } from "geojson";
+import { isMapboxURL, transformMapboxUrl } from "./util/mapbox-url";
+import { OrClusterMarker, Slice } from "./markers/or-cluster-marker";
const mapboxJsStyles = require("mapbox.js/dist/mapbox.css");
const maplibreGlStyles = require("maplibre-gl/dist/maplibre-gl.css");
const maplibreGeoCoderStyles = require("@maplibre/maplibre-gl-geocoder/dist/maplibre-gl-geocoder.css");
+export interface ClusterConfig {
+ cluster: boolean,
+ clusterRadius: number,
+ /** Until what zoom level cluster markers are shown */
+ clusterMaxZoom: number
+}
+
// TODO: fix any type
const metersToPixelsAtMaxZoom = (meters: number, latitude: number) =>
meters / 0.075 / Math.cos(latitude * Math.PI / 180);
@@ -62,8 +72,18 @@ export class MapWidget {
protected _controls?: (IControl | [IControl, ControlPosition?])[];
protected _clickHandlers: Map<OrMapMarker, (ev: MouseEvent) => void> = new Map();
protected _geocoder?: any;
+ protected _clusterConfig?: ClusterConfig;
+ protected _pointsMap: any = {
+ type: "FeatureCollection",
+ features: []
+ };
+
+ protected _assetTypeColors: any = {};
+ protected _cachedMarkers: Record<string, maplibregl.Marker> = {};
+ protected _markersOnScreen: Record<string, maplibregl.Marker> = {};
+ protected _assetsOnScreen: Record<string, AssetWithLocation> = {};
- constructor(type: MapType, styleParent: Node, mapContainer: HTMLElement, showGeoCodingControl: boolean = false, showBoundaryBox = false, useZoomControls = true, showGeoJson = true) {
+ constructor(type: MapType, styleParent: Node, mapContainer: HTMLElement, showGeoCodingControl: boolean = false, showBoundaryBox = false, useZoomControls = true, showGeoJson = true, clusterConfig?: ClusterConfig) {
this._type = type;
this._styleParent = styleParent;
this._mapContainer = mapContainer;
@@ -71,6 +91,7 @@ export class MapWidget {
this._showBoundaryBox = showBoundaryBox;
this._useZoomControls = useZoomControls;
this._showGeoJson = showGeoJson;
+ this._clusterConfig = clusterConfig;
}
public setCenter(center?: LngLatLike): this {
@@ -191,9 +212,9 @@ export class MapWidget {
this._geoJsonConfig = geoJsonConfig;
if(this._mapGl) {
if(this._geoJsonConfig) {
- this.loadGeoJSON(this._geoJsonConfig);
+ this._loadGeoJSON(this._geoJsonConfig);
} else {
- this.loadGeoJSON(this._viewSettings?.geoJson);
+ this._loadGeoJSON(this._viewSettings?.geoJson);
}
}
return this;
@@ -228,9 +249,9 @@ export class MapWidget {
}
// Unload all GeoJSON that is present, and load new layers if present
if(this._geoJsonConfig) {
- await this.loadGeoJSON(this._geoJsonConfig);
+ await this._loadGeoJSON(this._geoJsonConfig);
} else {
- await this.loadGeoJSON(this._viewSettings?.geoJson);
+ await this._loadGeoJSON(this._viewSettings?.geoJson);
}
}
if (!this._center) {
@@ -243,7 +264,10 @@ export class MapWidget {
return settings;
}
- public async load(): Promise<void> {
+ /**
+ * Build the map based on the map config.
+ */
+ public async build(): Promise<void> {
if (this._loaded) {
return;
}
@@ -357,14 +381,14 @@ export class MapWidget {
}
// Firefox headless mode does not support webgl, see https://bugzilla.mozilla.org/show_bug.cgi?id=1375585
- if (!this.isWebglSupported()) {
+ if (!isWebglSupported()) {
console.warn("WebGL is not supported in this environment. The map cannot be initialized.");
return;
}
this._mapGl = new map.Map(options);
- await this.styleLoaded();
+ await this._styleLoaded();
this._mapGl.on("click", (e: MapMouseEvent) => {
this._onMapClick(e.lngLat);
@@ -433,7 +457,7 @@ export class MapWidget {
this._geocoder._inputEl.addEventListener("change", () => {
var selected = this._geocoder._typeahead.selected;
this._onGeocodeChange(selected);
- });
+ });
}
// Add custom controls
@@ -461,12 +485,13 @@ export class MapWidget {
// Unload all GeoJSON that is present, and load new layers if present
if(this._geoJsonConfig) {
- await this.loadGeoJSON(this._geoJsonConfig);
+ await this._loadGeoJSON(this._geoJsonConfig);
} else {
- await this.loadGeoJSON(this._viewSettings?.geoJson);
+ await this._loadGeoJSON(this._viewSettings?.geoJson);
}
this._initLongPressEvent();
+ this._mapGl.on("load", async () => await this.load());
}
this._mapContainer.dispatchEvent(new OrMapLoadedEvent());
@@ -474,15 +499,66 @@ export class MapWidget {
this.createBoundaryBox()
}
- protected styleLoaded(): Promise<void> {
+ protected _styleLoaded(): Promise<void> {
return new Promise(resolve => {
if (this._mapGl) {
+ this._mapGl.once('style.load', resolve);
+ }
+ });
+ }
- this._mapGl.once('style.load', () => {
- resolve();
- });
+ /**
+ * Load map sources, layers and events
+ */
+ public async load() {
+ if (!this._mapGl || !this._loaded) {
+ console.warn("MapLibre Map not initialized!");
+ return;
+ }
+
+ if (this._mapGl.getSource('mapPoints')) {
+ if (this._mapGl.getLayer('unclustered-point')) {
+ this._mapGl.removeLayer('unclustered-point');
+ }
+ if (this._mapGl.getLayer('clusters')) {
+ this._mapGl.removeLayer('clusters');
+ }
+ if (this._mapGl.getLayer('cluster-count')) {
+ this._mapGl.removeLayer('cluster-count');
}
+ this._mapGl.removeSource('mapPoints');
+ }
+
+ this._mapGl.addSource('mapPoints', {
+ 'type': 'geojson',
+ 'cluster': this._clusterConfig?.cluster ?? true,
+ 'clusterRadius': this._clusterConfig?.clusterRadius ?? 180,
+ 'clusterMaxZoom': this._clusterConfig?.clusterMaxZoom ?? 17,
+ 'data': this._pointsMap,
+ 'clusterProperties': Object.fromEntries(Object.keys(this._assetTypeColors).map(t => [t,["+", ["case", ["==", ["get", "assetType"], t], 1, 0]]]))
});
+
+ if (!this._mapGl.getLayer('unclustered-point')) {
+ this._mapGl.addLayer({
+ id: 'unclustered-point',
+ type: 'circle',
+ source: 'mapPoints',
+ filter: ['!', ['has', 'point_count']],
+ paint: { 'circle-radius': 0 }
+ });
+ }
+
+ this._mapGl.on("data", async (e: any) => {
+ if (!this._mapGl) return;
+ if (e.sourceId !== 'mapPoints' || !e.isSourceLoaded) return;
+
+ this._mapGl.off('move', () => this._updateMarkers());
+ this._mapGl.off('moveend', () => this._updateMarkers());
+
+ this._mapGl.on('move', debounce(() => this._updateMarkers()));
+ this._mapGl.on('moveend', () => this._updateMarkers());
+ this._updateMarkers()
+ })
}
// Clean up of internal resources associated with the map.
@@ -502,7 +578,7 @@ export class MapWidget {
this._mapContainer.dispatchEvent(new OrMapClickedEvent(lngLat, doubleClicked));
}
- protected async loadGeoJSON(geoJsonConfig?: GeoJsonConfig) {
+ protected async _loadGeoJSON(geoJsonConfig?: GeoJsonConfig) {
// Remove old layers
if(this._geoJsonLayers.size > 0) {
@@ -656,6 +732,92 @@ export class MapWidget {
}
}
+ protected _updateMarkers() {
+ if (!this._mapGl) return;
+
+ const newMarkers: Record<string, maplibregl.Marker> = {};
+ const features = this._mapGl.querySourceFeatures('mapPoints');
+
+ // Asset markers
+ for (const feature of features) {
+ if (!feature.properties.id) continue;
+ const id: string = feature.properties.id;
+ const geometry = feature.geometry as Geometry & { coordinates: LngLatLike };
+ const coords = geometry.coordinates;
+
+ let marker = this._cachedMarkers[id]
+ if (!marker) {
+ const placeholder = document.createElement("div");
+ marker = this._cachedMarkers[id] = new maplibregl.Marker({ element: placeholder }).setLngLat(coords);
+ }
+ newMarkers[id] = marker;
+
+ if (!this._markersOnScreen[id]) {
+ marker.addTo(this._mapGl);
+ this._assetsOnScreen[id] = JSON.parse(feature.properties.asset);
+ };
+ }
+
+ // Cluster markers
+ for (const feature of features) {
+ if (!feature.properties.cluster) continue;
+ const id: number = feature.properties.cluster_id;
+ const geometry = feature.geometry as Geometry & { coordinates: [number, number] };
+ const [lng, lat] = geometry.coordinates;
+
+ let marker = this._cachedMarkers[id];
+ if (!marker) {
+ const slices: Slice[] = Object.entries(feature.properties)
+ .filter(([k]) => this._assetTypeColors.hasOwnProperty(k))
+ .map(([type, count]) => [type, this._assetTypeColors[type], count]);
+
+ marker = this._cachedMarkers[id] = new maplibregl.Marker({
+ element: new OrClusterMarker(slices, id, lng, lat, this._mapGl),
+ }).setLngLat([lng, lat]);
+ }
+ newMarkers[id] = marker;
+
+ if (!this._markersOnScreen[id]) marker.addTo(this._mapGl);
+ }
+
+ for (const id in this._markersOnScreen) {
+ const marker = newMarkers[id];
+ if (!marker
+ || marker._element instanceof OrClusterMarker && !marker._element.hasTypes(Object.keys(this._assetTypeColors))
+ ) {
+ this._markersOnScreen[id].remove();
+ delete this._assetsOnScreen[id];
+ }
+ }
+ this._markersOnScreen = newMarkers;
+ this._mapContainer.dispatchEvent(new OrMapMarkersChangedEvent(Object.values(this._assetsOnScreen)));
+ }
+
+ public addAssetMarker(assetId: string, assetName: string, assetType: string, long: number, lat: number, asset: Asset) {
+ this._assetTypeColors[assetType] = getMarkerIconAndColorFromAssetType(assetType)?.color;
+ this._pointsMap.features.push({
+ type: 'Feature',
+ properties: {
+ name: assetName,
+ id: assetId,
+ assetType: assetType,
+ asset: asset
+ },
+ geometry: {
+ type: "Point",
+ coordinates: [ long, lat ]
+ }
+ });
+ }
+
+ public cleanUpAssetMarkers(): void {
+ this._assetTypeColors = {};
+ this._pointsMap = {
+ type: "FeatureCollection",
+ features: []
+ };
+ }
+
public removeMarker(marker: OrMapMarker) {
this._removeMarkerRadius(marker);
this._updateMarkerElement(marker, false);
@@ -992,32 +1154,12 @@ export class MapWidget {
this._mapGl.on('gestureend', clearTimeoutFunc);
}
};
+
protected _onLongPress(lngLat: LngLat) {
this._mapContainer.dispatchEvent(new OrMapLongPressEvent(lngLat));
}
+
protected _onGeocodeChange(geocode:any) {
this._mapContainer.dispatchEvent(new OrMapGeocoderChangeEvent(geocode));
}
-
- // Source: maplibre.org/maplibre-gl-js/docs/examples/check-for-support/
- protected isWebglSupported() {
- if (window.WebGLRenderingContext) {
- const canvas = document.createElement('canvas');
- try {
- // Note that { failIfMajorPerformanceCaveat: true } can be passed as a second argument
- // to canvas.getContext(), causing the check to fail if hardware rendering is not available. See
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext
- // for more details.
- const context = canvas.getContext('webgl2') || canvas.getContext('webgl');
- if (context && typeof context.getParameter == 'function') {
- return true;
- }
- } catch (e) {
- // WebGL is supported, but disabled
- }
- return false;
- }
- // WebGL not supported
- return false;
- }
}
diff --git a/ui/component/or-map/src/markers/or-cluster-marker.ts b/ui/component/or-map/src/markers/or-cluster-marker.ts
new file mode 100644
index 000000000..e24a7c47f
--- /dev/null
+++ b/ui/component/or-map/src/markers/or-cluster-marker.ts
@@ -0,0 +1,137 @@
+import { svg as html /** Aliased for syntax highlighting */, LitElement, TemplateResult, SVGTemplateResult } from "lit";
+import { customElement } from "lit/decorators.js";
+import { GeoJSONSource, Map } from "maplibre-gl";
+
+/**
+ * Slice of the donut chart for cluster markers
+ */
+export type Slice = [type: string, color: string, count: number]
+
+type SliceWithOffset = [...Slice, offset: number]
+
+@customElement("or-cluster-marker")
+export class OrClusterMarker extends LitElement {
+
+ public lng?: number;
+ public lat?: number;
+
+ protected _slices: Slice[] = [];
+ protected _clusterId?: number;
+ protected _map: Map;
+
+ protected _highThreshold = 99;
+ protected _midTreshold = this._highThreshold / 10;
+ protected _lowTreshold = this._midTreshold / 10;
+
+ constructor(slices: Slice[], clusterId: number, lng: number, lat: number, map: Map) {
+ super();
+ this._clusterId = clusterId;
+ this._slices = slices;
+ this.lng = lng;
+ this.lat = lat;
+ this._map = map;
+ }
+
+ /**
+ * Checks that all types exactly match the cluster marker types
+ * @param types The types that must be present
+ * @returns Whether all types are present in the cluster marker
+ */
+ public hasTypes(types: string[]) {
+ for (const type of types) {
+ if (!this._slices.some(([t]) => t === type)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected render() {
+ return html`${this._createDonutChart(this._slices)}`;
+ }
+
+ /**
+ * Based on https://github.com/maplibre/maplibre-gl-js/blob/3aa2de2e3a365c07ac2792847c242a7c36e625ea/test/examples/display-html-clusters-with-custom-properties.html#L147
+ */
+ protected _createDonutChart(slices: Slice[]): TemplateResult {
+ let total = 0;
+ for (const slice of slices) {
+ slice.push(total);
+ total += slice[2];
+ }
+
+ const fontSize = total >= this._highThreshold ? 18 : total >= this._midTreshold ? 16 : total >= this._lowTreshold ? 14 : 12;
+ const r = total >= this._highThreshold ? 32 : total >= this._midTreshold ? 26 : total >= this._lowTreshold ? 16 : 12;
+ const r2 = total >= this._highThreshold ? 28 : total >= this._midTreshold ? 24 : total >= this._lowTreshold ? 16 : 8;
+ const dR = r - r2;
+ const innerRadius: number = Math.round(r * 0.6);
+ const w: number = r * 2;
+
+ const isClusterCountlimitSurpassed = total > this._highThreshold
+
+ return html`
+ <svg
+ width="${w}"
+ height="${w}"
+ viewbox="0 0 ${w} ${w}"
+ text-anchor="middle"
+ style="cursor: pointer; pointer-events: auto; font: ${fontSize}px Helvetica Neue,Arial,Helvetica,sans-serif; display: block">
+ ${(slices as [] as SliceWithOffset[]).map(([,color,count,offset]) => this._donutSegment(
+ offset / total,
+ (offset + count) / total,
+ r2,
+ innerRadius,
+ color, dR
+ ))}
+ <circle cx="${r}" cy="${r}" r="${innerRadius}" fill="white" />
+ <text dominant-baseline="central" transform="translate(${r}, ${r})">
+ ${(isClusterCountlimitSurpassed ? this._highThreshold : total).toLocaleString() + (isClusterCountlimitSurpassed ? "+" : "")}
+ </text>
+ </svg>
+ `;
+ }
+
+ /**
+ * Based on https://github.com/maplibre/maplibre-gl-js/blob/3aa2de2e3a365c07ac2792847c242a7c36e625ea/test/examples/display-html-clusters-with-custom-properties.html#L209
+ */
+ protected _donutSegment(start: number, end: number, r: number, r0: number, color: string, dR: number): SVGTemplateResult {
+ if (end - start === 1) {
+ end -= 0.00001;
+ }
+ const a0: number = 2 * Math.PI * (start - 0.25);
+ const a1: number = 2 * Math.PI * (end - 0.25);
+ const x0: number = Math.cos(a0);
+ const y0: number = Math.sin(a0);
+ const x1: number = Math.cos(a1)
+ const y1: number = Math.sin(a1);
+ const largeArc: 1 | 0 = end - start > 0.5 ? 1 : 0;
+
+ return html`<path fill="#${color}" transform="translate(${dR}, ${dR})" d="
+ M ${r + r0 * x0} ${r + r0 * y0}
+ L ${r + r * x0} ${r + r * y0}
+ A ${r} ${r} 0 ${largeArc} 1 ${r + r * x1} ${r + r * y1}
+ L ${r + r0 * x1} ${r + r0 * y1}
+ A ${r0} ${r0} 0 ${largeArc} 0 ${r + r0 * x0} ${r + r0 * y0}
+ "
+ />`;
+ }
+
+ connectedCallback(): void {
+ super.connectedCallback();
+ this.addEventListener("click", this.onClick)
+ }
+
+ disconnectedCallback(): void {
+ super.disconnectedCallback();
+ this.removeEventListener("click", this.onClick)
+ }
+
+ protected async onClick() {
+ if (this.lng && this.lat) {
+ const zoom = await this._map.getSource<GeoJSONSource>('mapPoints')!.getClusterExpansionZoom(this._clusterId!);
+ // Offset 0.99 added to ensure cluster marker dissappears
+ // Essential is enabled to ensure animations are always run for the offset to be applied
+ this._map.easeTo({ center: [this.lng, this.lat], zoom: zoom + 0.99, essential: true });
+ }
+ }
+}
diff --git a/ui/component/or-map/src/markers/or-map-marker-asset.ts b/ui/component/or-map/src/markers/or-map-marker-asset.ts
index 78fa39e56..3aa434881 100644
--- a/ui/component/or-map/src/markers/or-map-marker-asset.ts
+++ b/ui/component/or-map/src/markers/or-map-marker-asset.ts
@@ -80,7 +80,7 @@ export class OrMapMarkerAsset extends subscribe(manager)(OrMapMarker) {
this.visible = false;
}
- protected markerColor?: string;
+ protected _markerColor?: string;
protected set type(type: string | undefined) {
@@ -106,8 +106,8 @@ export class OrMapMarkerAsset extends subscribe(manager)(OrMapMarker) {
this.icon = iconAndColour.icon;
}
- this.markerColor = (Array.isArray(iconAndColour.color)) ? iconAndColour.color[0].colour : iconAndColour.color || undefined;
- this.updateColor(this.markerContainer);
+ this._markerColor = (Array.isArray(iconAndColour.color)) ? iconAndColour.color[0].colour : iconAndColour.color || undefined;
+ this._updateColor(this.markerContainer);
this.visible = true;
}
@@ -128,7 +128,7 @@ export class OrMapMarkerAsset extends subscribe(manager)(OrMapMarker) {
if (_changedProperties.has("asset")) {
try {
- this.onAssetChanged(this.asset);
+ this._onAssetChanged(this.asset);
} catch (e) {
console.error(e);
}
@@ -166,16 +166,16 @@ export class OrMapMarkerAsset extends subscribe(manager)(OrMapMarker) {
case AssetEventCause.READ:
case AssetEventCause.CREATE:
case AssetEventCause.UPDATE:
- this.onAssetChanged(assetEvent.asset);
+ this._onAssetChanged(assetEvent.asset);
break;
case AssetEventCause.DELETE:
- this.onAssetChanged(undefined);
+ this._onAssetChanged(undefined);
break;
}
}
}
- protected async onAssetChanged(asset?: Asset) {
+ protected async _onAssetChanged(asset?: Asset) {
if (asset) {
this.direction = undefined;
this.displayValue = undefined;
@@ -215,17 +215,17 @@ export class OrMapMarkerAsset extends subscribe(manager)(OrMapMarker) {
this.lng = location && location.coordinates ? (location.coordinates as any)[0] : undefined;
}
- protected getColor() {
- if (this.markerColor && !this.color) {
- return "#" + this.markerColor;
+ protected _getColor() {
+ if (this._markerColor && !this.color) {
+ return "#" + this._markerColor;
}
- return super.getColor();
+ return super._getColor();
}
- protected getActiveColor() {
- if (this.markerColor && !this.activeColor) {
- return "#" + this.markerColor;
+ protected _getActiveColor() {
+ if (this._markerColor && !this.activeColor) {
+ return "#" + this._markerColor;
}
- return super.getActiveColor();
+ return super._getActiveColor();
}
}
diff --git a/ui/component/or-map/src/markers/or-map-marker.ts b/ui/component/or-map/src/markers/or-map-marker.ts
index 78c2f750f..594b146c5 100644
--- a/ui/component/or-map/src/markers/or-map-marker.ts
+++ b/ui/component/or-map/src/markers/or-map-marker.ts
@@ -1,7 +1,8 @@
-import {css, CSSResultGroup, html, LitElement, PropertyValues, unsafeCSS} from "lit";
+import {css, CSSResult, CSSResultGroup, html, LitElement, PropertyValues, unsafeCSS} from "lit";
import {customElement, property, query} from "lit/decorators.js";
import {markerActiveColorVar, markerColorVar} from "../style";
import {DefaultBoxShadow} from "@openremote/core";
+import { OrMap } from "..";
export class OrMapMarkerChangedEvent extends CustomEvent<OrMapMarkerChangedEventDetail> {
@@ -204,19 +205,19 @@ export class OrMapMarker extends LitElement {
const markerElem = document.createElement("div");
const markerContainerElem = document.createElement("div");
markerElem.appendChild(markerContainerElem);
- this.addMarkerClassNames(markerElem);
- this.addMarkerContainerClassNames(markerContainerElem);
+ this._addMarkerClassNames(markerElem);
+ this._addMarkerContainerClassNames(markerContainerElem);
let content = this.createMarkerContent();
if (!content) {
// Append default marker
markerElem.classList.add("or-map-marker-default");
- content = this.createDefaultMarkerContent();
+ content = this._createDefaultMarkerContent();
}
markerContainerElem.appendChild(content);
- this.updateInteractive(markerElem);
- this.updateVisibility(markerElem);
- this.updateColor(markerContainerElem);
- this.updateActive(markerElem);
+ this._updateInteractive(markerElem);
+ this._updateVisibility(markerElem);
+ this._updateColor(markerContainerElem);
+ this._updateActive(markerElem);
return markerElem;
}
@@ -248,31 +249,31 @@ export class OrMapMarker extends LitElement {
protected shouldUpdate(_changedProperties: PropertyValues): boolean {
if (_changedProperties.has("icon") || _changedProperties.has("displayValue") || _changedProperties.has("direction")) {
- this.refreshMarkerContent();
+ this._refreshMarkerContent();
}
if (_changedProperties.has("color") || _changedProperties.has("activeColor")) {
- this.updateColor(this.markerContainer);
+ this._updateColor(this.markerContainer);
}
if (_changedProperties.has("visible")) {
- this.updateVisibility(this._actualMarkerElement);
+ this._updateVisibility(this._actualMarkerElement);
}
if (_changedProperties.has("interactive")) {
- this.updateInteractive(this._actualMarkerElement);
+ this._updateInteractive(this._actualMarkerElement);
}
if (_changedProperties.has("active")) {
- this.updateActive(this._actualMarkerElement);
- this.updateColor(this.markerContainer);
+ this._updateActive(this._actualMarkerElement);
+ this._updateColor(this.markerContainer);
}
_changedProperties.forEach((oldValue, prop) => this._raisePropertyChange(prop as string));
return false;
}
- protected updateVisibility(container?: HTMLDivElement) {
+ protected _updateVisibility(container?: HTMLDivElement) {
if (container) {
if (this.visible) {
container.removeAttribute("hidden");
@@ -282,21 +283,21 @@ export class OrMapMarker extends LitElement {
}
}
- protected getColor() {
+ protected _getColor() {
return this.color && this.color !== "unset" ? this.color : undefined;
}
- protected getActiveColor() {
+ protected _getActiveColor() {
return this.activeColor && this.activeColor !== "unset" ? this.activeColor : undefined;
}
- protected updateColor(container?: HTMLDivElement) {
+ protected _updateColor(container?: HTMLDivElement) {
if (container) {
container.style.removeProperty(markerColorVar);
container.style.removeProperty(markerActiveColorVar);
- const color = this.getColor();
- const activeColor = this.getActiveColor();
+ const color = this._getColor();
+ const activeColor = this._getActiveColor();
if (color) {
container.style.setProperty(markerColorVar, color);
@@ -307,7 +308,7 @@ export class OrMapMarker extends LitElement {
}
}
- protected updateActive(container?: HTMLDivElement) {
+ protected _updateActive(container?: HTMLDivElement) {
if (container) {
if (this.active) {
container.classList.add("active");
@@ -317,7 +318,7 @@ export class OrMapMarker extends LitElement {
}
}
- protected updateInteractive(container?: HTMLDivElement) {
+ protected _updateInteractive(container?: HTMLDivElement) {
if (container) {
if (this.interactive) {
container.classList.add("interactive");
@@ -327,13 +328,13 @@ export class OrMapMarker extends LitElement {
}
}
- protected refreshMarkerContent() {
+ protected _refreshMarkerContent() {
if (this.markerContainer) {
let content = this.createMarkerContent();
if (!content) {
// Append default marker
this._actualMarkerElement!.classList.add("or-map-marker-default");
- content = this.createDefaultMarkerContent();
+ content = this._createDefaultMarkerContent();
} else {
this._actualMarkerElement!.classList.remove("or-map-marker-default");
}
@@ -354,19 +355,45 @@ export class OrMapMarker extends LitElement {
this.dispatchEvent(new OrMapMarkerChangedEvent(this, prop));
}
- protected addMarkerClassNames(markerElement: HTMLElement) {
+ protected _addMarkerClassNames(markerElement: HTMLElement) {
markerElement.classList.add("or-map-marker");
}
- protected addMarkerContainerClassNames(markerContainer: HTMLElement) {
+ protected _addMarkerContainerClassNames(markerContainer: HTMLElement) {
markerContainer.classList.add("marker-container");
}
- protected createDefaultMarkerContent(): HTMLElement {
+ protected _createDefaultMarkerContent(): HTMLElement {
const div = document.createElement("div");
div.innerHTML = OrMapMarker._defaultTemplate(this.icon, {displayValue: this.displayValue, direction: this.direction});
return div;
}
+
+ protected _applyMapMarkerStyles() {
+ if (this.parentElement instanceof OrMap) {
+ const container = this.parentElement.shadowRoot?.querySelector("#map");
+ const styles = (this.constructor as any).styles;
+
+ let stylesArr: CSSResult[] = [];
+ if (container && styles) {
+ if (!Array.isArray(styles)) {
+ stylesArr.push(styles as CSSResult);
+ } else {
+ stylesArr = styles as CSSResult[];
+ }
+
+ stylesArr.forEach((styleItem) => {
+ const styleElem = document.createElement("style");
+ styleElem.textContent = String(styleItem);
+ if (container.children.length > 0) {
+ container.insertBefore(styleElem, container.children[0]);
+ } else {
+ container.appendChild(styleElem);
+ }
+ })
+ }
+ }
+ }
public hasPosition(): boolean {
return typeof this.lat === "number"
@@ -374,4 +401,15 @@ export class OrMapMarker extends LitElement {
&& this.lat >= -90 && this.lat < 90
&& this.lng >= -180 && this.lng < 180;
}
+
+ connectedCallback(): void {
+ super.connectedCallback();
+ this._applyMapMarkerStyles();
+ }
+
+ disconnectedCallback(): void {
+ super.disconnectedCallback();
+ // Safely cleanup markers once removed from the DOM
+ this._actualMarkerElement?.parentElement?.removeChild(this._actualMarkerElement);
+ }
}
diff --git a/ui/component/or-map/src/or-map-asset-card.ts b/ui/component/or-map/src/or-map-asset-card.ts
index c6eed627c..40a71385d 100644
--- a/ui/component/or-map/src/or-map-asset-card.ts
+++ b/ui/component/or-map/src/or-map-asset-card.ts
@@ -124,7 +124,7 @@ export class OrMapAssetCard extends subscribe(manager)(LitElement) {
}
}
- protected getCardConfig(): MapAssetCardTypeConfig | undefined {
+ protected _getCardConfig(): MapAssetCardTypeConfig | undefined {
let cardConfig = this.config || DefaultConfig;
if (!this.asset) {
@@ -140,10 +140,10 @@ export class OrMapAssetCard extends subscribe(manager)(LitElement) {
return html``;
}
- const icon = this.getIcon();
- const color = this.getColor();
+ const icon = this._getIcon();
+ const color = this._getColor();
const styleStr = color ? "--internal-or-map-asset-card-header-color: #" + color + ";" : "";
- const cardConfig = this.getCardConfig();
+ const cardConfig = this._getCardConfig();
const attributes = Object.values(this.asset.attributes!).filter((attr) => attr.name !== WellknownAttributes.LOCATION);
const includedAttributes = cardConfig && cardConfig.include ? cardConfig.include : undefined;
const excludedAttributes = cardConfig && cardConfig.exclude ? cardConfig.exclude : [];
@@ -188,7 +188,7 @@ export class OrMapAssetCard extends subscribe(manager)(LitElement) {
this.dispatchEvent(new OrMapAssetCardLoadAssetEvent(assetId));
}
- protected getIcon(): string | undefined {
+ protected _getIcon(): string | undefined {
if (this.asset) {
const descriptor = AssetModelUtil.getAssetDescriptor(this.asset.type);
const icon = getMarkerIconAndColorFromAssetType(descriptor)?.icon;
@@ -196,7 +196,7 @@ export class OrMapAssetCard extends subscribe(manager)(LitElement) {
}
}
- protected getColor(): string | undefined {
+ protected _getColor(): string | undefined {
if (this.asset) {
const descriptor = AssetModelUtil.getAssetDescriptor(this.asset.type);
const color = getMarkerIconAndColorFromAssetType(descriptor)?.color;
diff --git a/ui/component/or-map/src/or-map-legend.ts b/ui/component/or-map/src/or-map-legend.ts
new file mode 100644
index 000000000..bc19733fa
--- /dev/null
+++ b/ui/component/or-map/src/or-map-legend.ts
@@ -0,0 +1,105 @@
+import { CSSResultGroup, html, LitElement, PropertyValues } from "lit";
+import { customElement, property, query } from "lit/decorators.js";
+import { mapAssetLegendStyle } from "./style";
+import { AssetModelUtil } from "@openremote/model";
+import { getMarkerIconAndColorFromAssetType } from "./util";
+import { Util } from "@openremote/core";
+import { InputType, OrInputChangedEvent } from "@openremote/or-mwc-components/or-mwc-input";
+
+export class OrMapLegendEvent extends CustomEvent<string[]> {
+ public static readonly NAME = "or-map-legend-changed";
+
+ constructor(assetTypes: string[]) {
+ super(OrMapLegendEvent.NAME, {
+ bubbles: false,
+ composed: false,
+ detail: assetTypes,
+ });
+ }
+}
+
+declare global {
+ export interface HTMLElementEventMap {
+ [OrMapLegendEvent.NAME]: OrMapLegendEvent;
+ }
+}
+
+@customElement("or-map-legend")
+export class OrMapLegend extends LitElement {
+
+ static get styles(): CSSResultGroup {
+ return mapAssetLegendStyle;
+ }
+
+ @property({ type: Array })
+ public assetTypes: string[] = [];
+
+ protected _assetTypesInfo: any;
+
+ protected _excludedTypes: string[] = [];
+
+ @query("#legend-content")
+ protected _showLegend?: HTMLDivElement;
+
+ protected shouldUpdate(changedProperties: PropertyValues): boolean {
+ if (changedProperties.has("assetTypes")) {
+ this._assetTypesInfo = {};
+
+ this.assetTypes.forEach((assetType: string) => {
+ const descriptor = AssetModelUtil.getAssetDescriptor(assetType);
+ const icon = getMarkerIconAndColorFromAssetType(descriptor)?.icon;
+ const color = getMarkerIconAndColorFromAssetType(descriptor)?.color;
+ const label = Util.getAssetTypeLabel(descriptor);
+
+ this._assetTypesInfo[assetType] = {
+ icon: icon,
+ color: color,
+ label: label,
+ };
+ });
+ }
+
+ return super.shouldUpdate(changedProperties);
+ }
+
+ protected _onHeaderClick() {
+ if (this._showLegend) {
+ this._showLegend.hidden = !this._showLegend.hidden;
+ }
+ }
+
+ protected render() {
+ return html`
+ <div id="legend">
+ <div id="legend-title" @click="${() => this._onHeaderClick()}">
+ <or-translate value="mapPage.legendTitle"></or-translate><or-icon style="cursor: pointer" icon="menu"></or-icon>
+ </div>
+ <div id="legend-content" hidden>
+ <ul>
+ ${this.assetTypes.map(
+ (assetType) => html` <li id="asset-legend" data-asset-type="${assetType}" style="display: flex;">
+ <or-icon
+ icon="${this._assetTypesInfo[assetType].icon}"
+ style="color: #${this._assetTypesInfo[assetType].color}"
+ ></or-icon>
+ <span id="asset-label" style="flex: 1">${this._assetTypesInfo[assetType].label}</span>
+ <or-mwc-input
+ .type="${InputType.CHECKBOX}"
+ .value="${!this._excludedTypes.includes(assetType)}"
+ @or-mwc-input-changed="${(ev: OrInputChangedEvent) => {
+ if (ev.detail.value) {
+ this._excludedTypes.splice(this._excludedTypes.indexOf(assetType), 1);
+ } else {
+ this._excludedTypes.push(assetType);
+ }
+ this.dispatchEvent(new OrMapLegendEvent(this._excludedTypes));
+ }}"
+ ></or-mwc-input>
+ </li>`
+ )}
+ </ul>
+ </div>
+ </div>
+ `;
+ }
+}
diff --git a/ui/component/or-map/src/style.ts b/ui/component/or-map/src/style.ts
index 7f2f9534e..a89adea3f 100644
--- a/ui/component/or-map/src/style.ts
+++ b/ui/component/or-map/src/style.ts
@@ -12,7 +12,7 @@ export const style = css`
--internal-or-map-marker-transform: var(--or-map-marker-transform, translate(-16px, -29px));
--internal-or-map-marker-width: var(--or-map-marker-width, 32px);
--internal-or-map-marker-height: var(--or-map-marker-height, 32px);
- --internal-or-map-marker-color: var(--or-map-marker-color, var(--or-app-color4, ${unsafeCSS(DefaultColor4)}));
+ --internal-or-map-marker-color: var(--or-map-marker-color, var(--or-app-color3, ${unsafeCSS(DefaultColor3)}));
--internal-or-map-marker-stroke: var(--or-map-marker-stroke, none);
--internal-or-map-marker-icon-color: var(--or-map-marker-icon-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));
--internal-or-map-marker-icon-stroke: var(--or-map-marker-icon-stroke, none);
@@ -22,7 +22,7 @@ export const style = css`
--internal-or-map-marker-active-transform: var(--or-map-marker-active-transform, translate(-24px, -44px));
--internal-or-map-marker-active-width: var(--or-map-marker-active-width, 48px);
--internal-or-map-marker-active-height: var(--or-map-marker-active-height, 48px);
- --internal-or-map-marker-active-color: var(--or-map-marker-active-color, var(--or-app-color4, ${unsafeCSS(DefaultColor4)}));
+ --internal-or-map-marker-active-color: var(--or-map-marker-active-color, var(--or-app-color3, ${unsafeCSS(DefaultColor3)}));
--internal-or-map-marker-active-stroke: var(--or-map-marker-active-stroke, 2px);
--internal-or-map-marker-icon-active-color: var(--or-map-marker-icon-active-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));
--internal-or-map-marker-icon-active-stroke: var(--or-map-marker-icon-active-stroke, none);
@@ -153,7 +153,7 @@ export const style = css`
export const mapAssetCardStyle = css`
:host {
- --internal-or-map-asset-card-header-color: var(--or-map-asset-card-header-color, var(--or-app-color4, ${unsafeCSS(DefaultColor4)}));
+ --internal-or-map-asset-card-header-color: var(--or-map-asset-card-header-color, var(--or-app-color3, ${unsafeCSS(DefaultColor3)}));
--internal-or-map-asset-card-header-text-color: var(--or-map-asset-card-header-text-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));
--internal-or-map-asset-card-header-height: var(--or-map-asset-card-header-height, calc(${unsafeCSS(DefaultHeaderHeight)} - 10px));
--internal-or-map-asset-card-background-color: var(--or-map-asset-card-background-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));
@@ -241,4 +241,73 @@ export const mapAssetCardStyle = css`
min-height: 134px;
}
}
+`;
+
+export const mapAssetLegendStyle = css`
+ :host {
+ --internal-or-map-asset-legend-background-color: var(--or-map-asset-card-background-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));
+ --internal-or-map-asset-legend-header-height: var(--or-map-asset-card-header-height, calc(${unsafeCSS(DefaultHeaderHeight)} - 10px));
+
+ display: block;
+ }
+
+ #legend {
+ display: flex;
+ flex-direction: column;
+ }
+
+ #legend-title {
+ height: var(--internal-or-map-asset-legend-header-height);
+ background-color: var(--internal-or-map-asset-legend-background-color);
+ -webkit-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
+ -moz-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
+ box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
+ line-height: var(--internal-or-map-asset-legend-header-height);
+ border-bottom: 1px solid ${unsafeCSS(DefaultColor5)};
+ z-index: 99999;
+ padding-left: 10px;
+ padding-right: 10px;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ border-radius: 3px;
+ }
+
+ #legend-content {
+ -webkit-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
+ -moz-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
+ box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
+ background-color: var(--internal-or-map-asset-legend-background-color);
+ margin-top: 10px;
+ border-radius: 3px;
+ padding: 5px 0 5px 10px;
+ }
+
+ #title {
+ font-weight: 500;
+ }
+
+ #asset-legend {
+ display: flex;
+ align-items: center;
+ }
+
+ #asset-label {
+ margin-left: 5px;
+ }
+
+ ul {
+ list-style-type: none;
+ margin: 0;
+ padding: 0;
+ }
+
+ li {
+ display: flex;
+ line-height: 30px;
+ -webkit-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ }
+}
`
diff --git a/ui/component/or-map/src/util.ts b/ui/component/or-map/src/util/index.ts
similarity index 75%
rename from ui/component/or-map/src/util.ts
rename to ui/component/or-map/src/util/index.ts
index 552c8d62e..5be844374 100644
--- a/ui/component/or-map/src/util.ts
+++ b/ui/component/or-map/src/util/index.ts
@@ -6,9 +6,12 @@ import {
Attribute,
GeoJSONPoint,
ValueHolder,
- WellknownAttributes
+ WellknownAttributes,
+ WellknownMetaItems
} from "@openremote/model";
-import {AttributeMarkerColoursRange, MapMarkerColours} from "./markers/or-map-marker-asset";
+import {AttributeMarkerColoursRange, MapMarkerColours} from "../markers/or-map-marker-asset";
+import { Util } from "@openremote/core";
+import { AssetWithLocation } from "..";
export function getLngLat(lngLatLike?: LngLatLike | Asset | ValueHolder<any> | GeoJSONPoint): { lng: number, lat: number } | undefined {
if (!lngLatLike) {
@@ -133,3 +136,31 @@ export function getMarkerIconAndColorFromAssetType(
icon: icon
};
}
+
+// Source: maplibre.org/maplibre-gl-js/docs/examples/check-for-support/
+export function isWebglSupported() {
+ if (window.WebGLRenderingContext) {
+ const canvas = document.createElement('canvas');
+ try {
+ // Note that { failIfMajorPerformanceCaveat: true } can be passed as a second argument
+ // to canvas.getContext(), causing the check to fail if hardware rendering is not available. See
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext
+ // for more details.
+ const context = canvas.getContext('webgl2') || canvas.getContext('webgl');
+ if (context && typeof context.getParameter === 'function') {
+ return true;
+ }
+ } catch (e) {
+ // WebGL is supported, but disabled
+ }
+ return false;
+ }
+ // WebGL not supported
+ return false;
+}
+
+export function isAssetWithLocation(asset: Asset): asset is AssetWithLocation {
+ if (!asset.attributes) return false;
+ const attr = asset.attributes[WellknownAttributes.LOCATION] as Attribute<GeoJSONPoint>;
+ return !!attr.value && (!attr.meta || !attr.meta.hasOwnProperty(WellknownMetaItems.SHOWONDASHBOARD) || !!Util.getMetaValue(WellknownMetaItems.SHOWONDASHBOARD, attr));
+}
diff --git a/ui/component/or-map/src/mapbox-url-utils.ts b/ui/component/or-map/src/util/mapbox-url.ts
similarity index 100%
rename from ui/component/or-map/src/mapbox-url-utils.ts
rename to ui/component/or-map/src/util/mapbox-url.ts
diff --git a/yarn.lock b/yarn.lock
index a336d54de..cf4412f5d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -855,10 +855,10 @@ __metadata:
languageName: node
linkType: hard
-"@mapbox/point-geometry@npm:0.1.0, @mapbox/point-geometry@npm:^0.1.0, @mapbox/point-geometry@npm:~0.1.0":
- version: 0.1.0
- resolution: "@mapbox/point-geometry@npm:0.1.0"
- checksum: 10c0/e4d861908574cb3165f5ad37b000416ebc90a2d6b3e0073191e6b6dc5074a6159d84ac5114d78557399bb429134f0d05bfb529e7902d1cb2b36d722b72ab662c
+"@mapbox/point-geometry@npm:^1.1.0, @mapbox/point-geometry@npm:~1.1.0":
+ version: 1.1.0
+ resolution: "@mapbox/point-geometry@npm:1.1.0"
+ checksum: 10c0/fe43d00a92592a28835090722df771be50182ff5fc40705cbd571534e2397beef884a97f701869b4a99a61289700cf709f588883f4b085c034bbe722cf17155d
languageName: node
linkType: hard
@@ -869,10 +869,10 @@ __metadata:
languageName: node
linkType: hard
-"@mapbox/tiny-sdf@npm:^2.0.6":
- version: 2.0.6
- resolution: "@mapbox/tiny-sdf@npm:2.0.6"
- checksum: 10c0/cb272578a30c88d6694937af9b084106aa251e92c71089e7d57b0df8152fd0ce0598d5816182a4cd478dc40b188ea680cb6d53f4385107719424beabe7ed4e13
+"@mapbox/tiny-sdf@npm:^2.0.7":
+ version: 2.0.7
+ resolution: "@mapbox/tiny-sdf@npm:2.0.7"
+ checksum: 10c0/f117d8537ee4b5ee2deed54b9b426792744c15a649681305b4fb21b608b7c6a815015f015cd612923cc8efa30424d0440abfc1af2c85eda00a726024bb4f3ede
languageName: node
linkType: hard
@@ -883,12 +883,14 @@ __metadata:
languageName: node
linkType: hard
-"@mapbox/vector-tile@npm:^1.3.1":
- version: 1.3.1
- resolution: "@mapbox/vector-tile@npm:1.3.1"
+"@mapbox/vector-tile@npm:^2.0.4":
+ version: 2.0.4
+ resolution: "@mapbox/vector-tile@npm:2.0.4"
dependencies:
- "@mapbox/point-geometry": "npm:~0.1.0"
- checksum: 10c0/ffb271b95c383923768295e72bdf95e428efb906434b864ea04d3853a8373cf0de19f039bd6615f7cf018fbfb4dbf4599f27ebaa86c2b7b09f7d69187f8d7da1
+ "@mapbox/point-geometry": "npm:~1.1.0"
+ "@types/geojson": "npm:^7946.0.16"
+ pbf: "npm:^4.0.1"
+ checksum: 10c0/3cade1c8c3a4e0896bbe8ee1d6bcdb78cb34dc2257bc0151ba85d06f2cb96c87b5bddfd28f8b8a20131a85aa26af7091965da19ac356bf126eb66e20d48542fa
languageName: node
linkType: hard
@@ -913,21 +915,46 @@ __metadata:
languageName: node
linkType: hard
-"@maplibre/maplibre-gl-style-spec@npm:^20.1.1":
- version: 20.1.1
- resolution: "@maplibre/maplibre-gl-style-spec@npm:20.1.1"
+"@maplibre/maplibre-gl-style-spec@npm:^24.3.1":
+ version: 24.3.1
+ resolution: "@maplibre/maplibre-gl-style-spec@npm:24.3.1"
dependencies:
"@mapbox/jsonlint-lines-primitives": "npm:~2.0.2"
"@mapbox/unitbezier": "npm:^0.0.1"
json-stringify-pretty-compact: "npm:^4.0.0"
minimist: "npm:^1.2.8"
+ quickselect: "npm:^3.0.0"
rw: "npm:^1.3.3"
- sort-object: "npm:^3.0.3"
+ tinyqueue: "npm:^3.0.0"
bin:
gl-style-format: dist/gl-style-format.mjs
gl-style-migrate: dist/gl-style-migrate.mjs
gl-style-validate: dist/gl-style-validate.mjs
- checksum: 10c0/e099522770a21ce34417a94fbcff1b559618e1ae60f98b180df9bca0e6cfe8ee7850a8db057357b11c2bb5bbaf9b317ebb226721c4579ba542d2f20f71548ae6
+ checksum: 10c0/a0ad05b816cbd98d182a672b668952ee93f3c7703aa7932e93e6611353a204894a4a018f80adeb5daf064cae6568ac9ee52e251328c9331366363a640243ae90
+ languageName: node
+ linkType: hard
+
+"@maplibre/mlt@npm:^1.1.0":
+ version: 1.1.0
+ resolution: "@maplibre/mlt@npm:1.1.0"
+ dependencies:
+ "@mapbox/point-geometry": "npm:^1.1.0"
+ checksum: 10c0/ede425839f1d08832b08476a946ee75868b0267c39f87566ba43ffc0fac733827f5ca122ede84ec97a4c833ad801ebd4e051acecea072b7440131736ce395364
+ languageName: node
+ linkType: hard
+
+"@maplibre/vt-pbf@npm:^4.0.3":
+ version: 4.0.3
+ resolution: "@maplibre/vt-pbf@npm:4.0.3"
+ dependencies:
+ "@mapbox/point-geometry": "npm:^1.1.0"
+ "@mapbox/vector-tile": "npm:^2.0.4"
+ "@types/geojson-vt": "npm:3.2.5"
+ "@types/supercluster": "npm:^7.1.3"
+ geojson-vt: "npm:^4.0.2"
+ pbf: "npm:^4.0.1"
+ supercluster: "npm:^8.0.1"
+ checksum: 10c0/d3c84adabb9dc93ff72ea6ab8c17900479f09e4d473f34ccae1f8e22d29f814d288f529f0d85959545bc4d7021675e056f7f558e758f705a4cb060b1f75f0aff
languageName: node
linkType: hard
@@ -1842,7 +1869,7 @@ __metadata:
"@reduxjs/toolkit": "npm:^1.8.1"
iso-639-1: "npm:^3.1.3"
lit: "npm:^3.3.1"
- maplibre-gl: "npm:^4.1.2"
+ maplibre-gl: "npm:^5.12.0"
moment: "npm:^2.29.4"
reselect: "npm:^4.1.8"
languageName: unknown
@@ -2151,14 +2178,13 @@ __metadata:
"@openremote/or-icon": "workspace:*"
"@openremote/or-mwc-components": "workspace:*"
"@openremote/or-translate": "workspace:*"
- "@polymer/polymer": "npm:^3.3.1"
"@types/geojson": "npm:^7946.0.7"
"@types/mapbox": "npm:^1.6.42"
lit: "npm:^3.3.1"
lit-html: "npm:^3.3.1"
lodash: "npm:^4.17.21"
mapbox.js: "npm:^3.3.1"
- maplibre-gl: "npm:^4.1.2"
+ maplibre-gl: "npm:^5.12.0"
languageName: unknown
linkType: soft
@@ -3322,13 +3348,20 @@ __metadata:
languageName: node
linkType: hard
-"@types/geojson@npm:*, @types/geojson@npm:^7946.0.14, @types/geojson@npm:^7946.0.7":
+"@types/geojson@npm:*, @types/geojson@npm:^7946.0.7":
version: 7946.0.14
resolution: "@types/geojson@npm:7946.0.14"
checksum: 10c0/54f3997708fa2970c03eeb31f7e4540a0eb6387b15e9f8a60513a1409c23cafec8d618525404573468b59c6fecbfd053724b3327f7fca416729c26271d799f55
languageName: node
linkType: hard
+"@types/geojson@npm:^7946.0.16":
+ version: 7946.0.16
+ resolution: "@types/geojson@npm:7946.0.16"
+ checksum: 10c0/1ff24a288bd5860b766b073ead337d31d73bdc715e5b50a2cee5cb0af57a1ed02cc04ef295f5fa68dc40fe3e4f104dd31282b2b818a5ba3231bc1001ba084e3c
+ languageName: node
+ linkType: hard
+
"@types/html-minifier-terser@npm:^6.0.0":
version: 6.1.0
resolution: "@types/html-minifier-terser@npm:6.1.0"
@@ -3407,24 +3440,6 @@ __metadata:
languageName: node
linkType: hard
-"@types/mapbox__point-geometry@npm:*, @types/mapbox__point-geometry@npm:^0.1.4":
- version: 0.1.4
- resolution: "@types/mapbox__point-geometry@npm:0.1.4"
- checksum: 10c0/670191664ea0a6ccb4563500fe815a9aba029ba2f0528d42f9eb560ccb44f6542ba8674e2a3f6d41bd10ad8855b4df4782b5340c980ca182ef9fe6752f2737b8
- languageName: node
- linkType: hard
-
-"@types/mapbox__vector-tile@npm:^1.3.4":
- version: 1.3.4
- resolution: "@types/mapbox__vector-tile@npm:1.3.4"
- dependencies:
- "@types/geojson": "npm:*"
- "@types/mapbox__point-geometry": "npm:*"
- "@types/pbf": "npm:*"
- checksum: 10c0/082907ed9cf96b82327dabf3b4c3a14746a825e4a81f0abf46b50e2557f25cbda652725d8af002e5edcc344a83c85e1a4b71a2d39ef4d829c243344a85ac13a6
- languageName: node
- linkType: hard
-
"@types/mdx@npm:^2.0.0":
version: 2.0.13
resolution: "@types/mdx@npm:2.0.13"
@@ -3471,13 +3486,6 @@ __metadata:
languageName: node
linkType: hard
-"@types/pbf@npm:*, @types/pbf@npm:^3.0.5":
- version: 3.0.5
- resolution: "@types/pbf@npm:3.0.5"
- checksum: 10c0/c32348c6c81e6c31fe4a1f59983e3a9904727b809fb1e5ddec4fad49abaf93070ec26ee0c04c6516536c181c945b3c7d9e226549eaac3b2e12cb7b57f549a49c
- languageName: node
- linkType: hard
-
"@types/prop-types@npm:*":
version: 15.7.15
resolution: "@types/prop-types@npm:15.7.15"
@@ -4199,13 +4207,6 @@ __metadata:
languageName: node
linkType: hard
-"arr-union@npm:^3.1.0":
- version: 3.1.0
- resolution: "arr-union@npm:3.1.0"
- checksum: 10c0/7d5aa05894e54aa93c77c5726c1dd5d8e8d3afe4f77983c0aa8a14a8a5cbe8b18f0cf4ecaa4ac8c908ef5f744d2cbbdaa83fd6e96724d15fea56cfa7f5efdd51
- languageName: node
- linkType: hard
-
"array-back@npm:^3.0.1":
version: 3.1.0
resolution: "array-back@npm:3.1.0"
@@ -4330,13 +4331,6 @@ __metadata:
languageName: node
linkType: hard
-"assign-symbols@npm:^1.0.0":
- version: 1.0.0
- resolution: "assign-symbols@npm:1.0.0"
- checksum: 10c0/29a654b8a6da6889a190d0d0efef4b1bfb5948fa06cbc245054aef05139f889f2f7c75b989917e3fde853fc4093b88048e4de8578a73a76f113d41bfd66e5775
- languageName: node
- linkType: hard
-
"ast-types@npm:^0.16.1":
version: 0.16.1
resolution: "ast-types@npm:0.16.1"
@@ -4533,25 +4527,6 @@ __metadata:
languageName: node
linkType: hard
-"bytewise-core@npm:^1.2.2":
- version: 1.2.3
- resolution: "bytewise-core@npm:1.2.3"
- dependencies:
- typewise-core: "npm:^1.2"
- checksum: 10c0/210239f3048de9463b4ab02968bd0ef7b3c9b330c0329f9df1851fee0819e19fbb0eca8cc235947112dcce942ed58541283ddaefe29515c93a2b7e0820be3f2d
- languageName: node
- linkType: hard
-
-"bytewise@npm:^1.1.0":
- version: 1.1.0
- resolution: "bytewise@npm:1.1.0"
- dependencies:
- bytewise-core: "npm:^1.2.2"
- typewise: "npm:^1.0.3"
- checksum: 10c0/bcf994a8b635390dce43b22e97201cc0e3df0089ada4e77cc0bb48ce241efd0c27ca24a9400828cdd288a69a961da0b60c05bf7381b6cb529f048ab22092cc6d
- languageName: node
- linkType: hard
-
"cacache@npm:^18.0.0":
version: 18.0.2
resolution: "cacache@npm:18.0.2"
@@ -5365,10 +5340,10 @@ __metadata:
languageName: node
linkType: hard
-"earcut@npm:^2.2.4":
- version: 2.2.4
- resolution: "earcut@npm:2.2.4"
- checksum: 10c0/01ca51830edd2787819f904ae580087d37351f6048b4565e7add4b3da8a86b7bc19262ab2aa7fdc64129ab03af2d9cec8cccee4d230c82275f97ef285c79aafb
+"earcut@npm:^3.0.2":
+ version: 3.0.2
+ resolution: "earcut@npm:3.0.2"
+ checksum: 10c0/3d76da3d8a935244d59713edc70de71cdb5326a80b31c5c5cb96bc5b61f56b86ed35f032fffb66be7a4558e06efe1e94934f43ba6ca1b6c2af1420e87dd7ad71
languageName: node
linkType: hard
@@ -6199,25 +6174,6 @@ __metadata:
languageName: node
linkType: hard
-"extend-shallow@npm:^2.0.1":
- version: 2.0.1
- resolution: "extend-shallow@npm:2.0.1"
- dependencies:
- is-extendable: "npm:^0.1.0"
- checksum: 10c0/ee1cb0a18c9faddb42d791b2d64867bd6cfd0f3affb711782eb6e894dd193e2934a7f529426aac7c8ddb31ac5d38000a00aa2caf08aa3dfc3e1c8ff6ba340bd9
- languageName: node
- linkType: hard
-
-"extend-shallow@npm:^3.0.0":
- version: 3.0.2
- resolution: "extend-shallow@npm:3.0.2"
- dependencies:
- assign-symbols: "npm:^1.0.0"
- is-extendable: "npm:^1.0.1"
- checksum: 10c0/f39581b8f98e3ad94995e33214fff725b0297cf09f2725b6f624551cfb71e0764accfd0af80becc0182af5014d2a57b31b85ec999f9eb8a6c45af81752feac9a
- languageName: node
- linkType: hard
-
"fast-deep-equal@npm:^3.1.1, fast-deep-equal@npm:^3.1.3":
version: 3.1.3
resolution: "fast-deep-equal@npm:3.1.3"
@@ -6547,10 +6503,10 @@ __metadata:
languageName: node
linkType: hard
-"geojson-vt@npm:^3.2.1":
- version: 3.2.1
- resolution: "geojson-vt@npm:3.2.1"
- checksum: 10c0/db2fc1a452067ee8436fa86e5a138f6ebd3d64893e0af097bc1cc960ec63d67c0ce77444711e9583036192d6bf9ce754bf9b56a76789684fc0fea4d52321fffc
+"geojson-vt@npm:^4.0.2":
+ version: 4.0.2
+ resolution: "geojson-vt@npm:4.0.2"
+ checksum: 10c0/f2ca14d868e46f6262f5d3862f8e38a2418ecf9bd7cd6938a67bf87f1e2f8fbf65345d95996711b07cdf8f05ef512be0e2c20f0a8179c6393c2fd41badcb0532
languageName: node
linkType: hard
@@ -6628,17 +6584,10 @@ __metadata:
languageName: node
linkType: hard
-"get-value@npm:^2.0.2, get-value@npm:^2.0.6":
- version: 2.0.6
- resolution: "get-value@npm:2.0.6"
- checksum: 10c0/f069c132791b357c8fc4adfe9e2929b0a2c6e95f98ca7bc6fcbc27f8a302e552f86b4ae61ec56d9e9ac2544b93b6a39743d479866a37b43fcc104088ba74f0d9
- languageName: node
- linkType: hard
-
-"gl-matrix@npm:^3.4.3":
- version: 3.4.3
- resolution: "gl-matrix@npm:3.4.3"
- checksum: 10c0/c8ee6e2ce2d089b4ba4ae13ec9d4cb99bf2abe5f68f0cb08d94bbd8bafbec13aacc7230b86539ce5ca01b79226ea8c3194f971f5ca0c81838bc5e4e619dc398e
+"gl-matrix@npm:^3.4.4":
+ version: 3.4.4
+ resolution: "gl-matrix@npm:3.4.4"
+ checksum: 10c0/9aa022ffac0d158212ad0cd29939864ad919ac31cd5dc5a5d35e9d66bb62679ddf152ff7b2173ded20131045e40572b87f31b26a920be2a7583a1516b13b5b4b
languageName: node
linkType: hard
@@ -6705,17 +6654,6 @@ __metadata:
languageName: node
linkType: hard
-"global-prefix@npm:^3.0.0":
- version: 3.0.0
- resolution: "global-prefix@npm:3.0.0"
- dependencies:
- ini: "npm:^1.3.5"
- kind-of: "npm:^6.0.2"
- which: "npm:^1.3.1"
- checksum: 10c0/510f489fb68d1cc7060f276541709a0ee6d41356ef852de48f7906c648ac223082a1cc8fce86725ca6c0e032bcdc1189ae77b4744a624b29c34a9d0ece498269
- languageName: node
- linkType: hard
-
"globals@npm:^13.19.0":
version: 13.24.0
resolution: "globals@npm:13.24.0"
@@ -7144,13 +7082,6 @@ __metadata:
languageName: node
linkType: hard
-"ieee754@npm:^1.1.12":
- version: 1.2.1
- resolution: "ieee754@npm:1.2.1"
- checksum: 10c0/b0782ef5e0935b9f12883a2e2aa37baa75da6e66ce6515c168697b42160807d9330de9a32ec1ed73149aea02e0d822e572bca6f1e22bdcbd2149e13b050b17bb
- languageName: node
- linkType: hard
-
"ignore@npm:^5.1.1, ignore@npm:^5.2.0":
version: 5.3.1
resolution: "ignore@npm:5.3.1"
@@ -7220,13 +7151,6 @@ __metadata:
languageName: node
linkType: hard
-"ini@npm:^1.3.5":
- version: 1.3.8
- resolution: "ini@npm:1.3.8"
- checksum: 10c0/ec93838d2328b619532e4f1ff05df7909760b6f66d9c9e2ded11e5c1897d6f2f9980c54dd638f88654b00919ce31e827040631eab0a3969e4d1abefa0719516a
- languageName: node
- linkType: hard
-
"internal-slot@npm:^1.0.5":
version: 1.0.7
resolution: "internal-slot@npm:1.0.7"
@@ -7364,22 +7288,6 @@ __metadata:
languageName: node
linkType: hard
-"is-extendable@npm:^0.1.0, is-extendable@npm:^0.1.1":
- version: 0.1.1
- resolution: "is-extendable@npm:0.1.1"
- checksum: 10c0/dd5ca3994a28e1740d1e25192e66eed128e0b2ff161a7ea348e87ae4f616554b486854de423877a2a2c171d5f7cd6e8093b91f54533bc88a59ee1c9838c43879
- languageName: node
- linkType: hard
-
-"is-extendable@npm:^1.0.1":
- version: 1.0.1
- resolution: "is-extendable@npm:1.0.1"
- dependencies:
- is-plain-object: "npm:^2.0.4"
- checksum: 10c0/1d6678a5be1563db6ecb121331c819c38059703f0179f52aa80c242c223ee9c6b66470286636c0e63d7163e4d905c0a7d82a096e0b5eaeabb51b9f8d0af0d73f
- languageName: node
- linkType: hard
-
"is-extglob@npm:^2.1.1":
version: 2.1.1
resolution: "is-extglob@npm:2.1.1"
@@ -7478,15 +7386,6 @@ __metadata:
languageName: node
linkType: hard
-"is-plain-object@npm:^2.0.3, is-plain-object@npm:^2.0.4":
- version: 2.0.4
- resolution: "is-plain-object@npm:2.0.4"
- dependencies:
- isobject: "npm:^3.0.1"
- checksum: 10c0/f050fdd5203d9c81e8c4df1b3ff461c4bc64e8b5ca383bcdde46131361d0a678e80bcf00b5257646f6c636197629644d53bd8e2375aea633de09a82d57e942f4
- languageName: node
- linkType: hard
-
"is-regex@npm:^1.1.4":
version: 1.1.4
resolution: "is-regex@npm:1.1.4"
@@ -7623,13 +7522,6 @@ __metadata:
languageName: node
linkType: hard
-"isobject@npm:^3.0.1":
- version: 3.0.1
- resolution: "isobject@npm:3.0.1"
- checksum: 10c0/03344f5064a82f099a0cd1a8a407f4c0d20b7b8485e8e816c39f249e9416b06c322e8dec5b842b6bb8a06de0af9cb48e7bc1b5352f0fadc2f0abac033db3d4db
- languageName: node
- linkType: hard
-
"jackspeak@npm:^2.3.5":
version: 2.3.6
resolution: "jackspeak@npm:2.3.6"
@@ -7803,13 +7695,6 @@ __metadata:
languageName: node
linkType: hard
-"kind-of@npm:^6.0.2":
- version: 6.0.3
- resolution: "kind-of@npm:6.0.3"
- checksum: 10c0/61cdff9623dabf3568b6445e93e31376bee1cdb93f8ba7033d86022c2a9b1791a1d9510e026e6465ebd701a6dd2f7b0808483ad8838341ac52f003f512e0b4c4
- languageName: node
- linkType: hard
-
"launch-editor@npm:^2.6.1":
version: 2.11.0
resolution: "launch-editor@npm:2.11.0"
@@ -8012,37 +7897,34 @@ __metadata:
languageName: node
linkType: hard
-"maplibre-gl@npm:^4.1.2":
- version: 4.1.2
- resolution: "maplibre-gl@npm:4.1.2"
+"maplibre-gl@npm:^5.12.0":
+ version: 5.12.0
+ resolution: "maplibre-gl@npm:5.12.0"
dependencies:
"@mapbox/geojson-rewind": "npm:^0.5.2"
"@mapbox/jsonlint-lines-primitives": "npm:^2.0.2"
- "@mapbox/point-geometry": "npm:^0.1.0"
- "@mapbox/tiny-sdf": "npm:^2.0.6"
+ "@mapbox/point-geometry": "npm:^1.1.0"
+ "@mapbox/tiny-sdf": "npm:^2.0.7"
"@mapbox/unitbezier": "npm:^0.0.1"
- "@mapbox/vector-tile": "npm:^1.3.1"
+ "@mapbox/vector-tile": "npm:^2.0.4"
"@mapbox/whoots-js": "npm:^3.1.0"
- "@maplibre/maplibre-gl-style-spec": "npm:^20.1.1"
- "@types/geojson": "npm:^7946.0.14"
+ "@maplibre/maplibre-gl-style-spec": "npm:^24.3.1"
+ "@maplibre/mlt": "npm:^1.1.0"
+ "@maplibre/vt-pbf": "npm:^4.0.3"
+ "@types/geojson": "npm:^7946.0.16"
"@types/geojson-vt": "npm:3.2.5"
- "@types/mapbox__point-geometry": "npm:^0.1.4"
- "@types/mapbox__vector-tile": "npm:^1.3.4"
- "@types/pbf": "npm:^3.0.5"
"@types/supercluster": "npm:^7.1.3"
- earcut: "npm:^2.2.4"
- geojson-vt: "npm:^3.2.1"
- gl-matrix: "npm:^3.4.3"
- global-prefix: "npm:^3.0.0"
+ earcut: "npm:^3.0.2"
+ geojson-vt: "npm:^4.0.2"
+ gl-matrix: "npm:^3.4.4"
kdbush: "npm:^4.0.2"
murmurhash-js: "npm:^1.0.0"
- pbf: "npm:^3.2.1"
- potpack: "npm:^2.0.0"
- quickselect: "npm:^2.0.0"
+ pbf: "npm:^4.0.1"
+ potpack: "npm:^2.1.0"
+ quickselect: "npm:^3.0.0"
supercluster: "npm:^8.0.1"
- tinyqueue: "npm:^2.0.3"
- vt-pbf: "npm:^3.1.3"
- checksum: 10c0/5bbb5a0e7b91b7671528d041a02a66445487041c2b8844c357020fe3bf4df1114faef220f179f33c7f2563fc99ca25f0948de75af884404832ffe72b0623db18
+ tinyqueue: "npm:^3.0.0"
+ checksum: 10c0/ee1a36aa53c06aa35fea46bc9aaa517d6d83f51f119a20f9948c0da5871ffea0cc6d260f3b7e4454133d88da1def1e47369f5afc632dbc12f6dbf2e603ca4ef9
languageName: node
linkType: hard
@@ -8846,15 +8728,14 @@ __metadata:
languageName: node
linkType: hard
-"pbf@npm:^3.2.1":
- version: 3.2.1
- resolution: "pbf@npm:3.2.1"
+"pbf@npm:^4.0.1":
+ version: 4.0.1
+ resolution: "pbf@npm:4.0.1"
dependencies:
- ieee754: "npm:^1.1.12"
resolve-protobuf-schema: "npm:^2.1.0"
bin:
pbf: bin/pbf
- checksum: 10c0/63b4a27749a9b5a3cf4260d75f9d91ad8d8b326bcdd2bfafd9460a94d0a297a80f80c70d5481213d6c4ebf03c027aca0ac9287c7d8217d327a6d0456f23b9d3c
+ checksum: 10c0/1a95cc3bdc61ee01d4728f4a57a9f1233732d183a8568818b714a747fd8b957d99b63e1c67f0f72dc5623657c42f88a1a7e44e1fbcd06e2fe2ef9a85a964832e
languageName: node
linkType: hard
@@ -9050,10 +8931,10 @@ __metadata:
languageName: node
linkType: hard
-"potpack@npm:^2.0.0":
- version: 2.0.0
- resolution: "potpack@npm:2.0.0"
- checksum: 10c0/8df693484486535b95586a624c5abf3fd7bebad161b1c10c10d86562c870fe1c90703b862a19020b1d1c2f3fbd6cea1e9d699c6eca6ded4b5792873a992c81e1
+"potpack@npm:^2.1.0":
+ version: 2.1.0
+ resolution: "potpack@npm:2.1.0"
+ checksum: 10c0/25fb86728e2eba7d67928ba770cecf76d1d09e82ca2fe090a20ad573fee20ed67e727b353aeef99d03dbc32c7bf76bdcdf0f6466f25d0cd66a40b9776e607e56
languageName: node
linkType: hard
@@ -9210,10 +9091,10 @@ __metadata:
languageName: node
linkType: hard
-"quickselect@npm:^2.0.0":
- version: 2.0.0
- resolution: "quickselect@npm:2.0.0"
- checksum: 10c0/6c8d591bc73beae4c1996b7b7138233a7dbbbdde29b7b6d822a02d08cd220fd27613f47d6e9635989b12e250d42ef9da3448de1ed12ad962974e207ab3c3562c
+"quickselect@npm:^3.0.0":
+ version: 3.0.0
+ resolution: "quickselect@npm:3.0.0"
+ checksum: 10c0/3a0d33b0ec06841d953accdfd735aa3d8b7922cddd12970544a2c4b0278871280d8f5ba496803600693c1e7b7b2fb57c31d2b14d99132f478888006a1be6e6b7
languageName: node
linkType: hard
@@ -9877,18 +9758,6 @@ __metadata:
languageName: node
linkType: hard
-"set-value@npm:^2.0.1":
- version: 2.0.1
- resolution: "set-value@npm:2.0.1"
- dependencies:
- extend-shallow: "npm:^2.0.1"
- is-extendable: "npm:^0.1.1"
- is-plain-object: "npm:^2.0.3"
- split-string: "npm:^3.0.1"
- checksum: 10c0/4c40573c4f6540456e4b38b95f570272c4cfbe1d12890ad4057886da8535047cd772dfadf5b58e2e87aa244dfb4c57e3586f6716b976fc47c5144b6b09e1811b
- languageName: node
- linkType: hard
-
"setprototypeof@npm:1.1.0":
version: 1.1.0
resolution: "setprototypeof@npm:1.1.0"
@@ -10122,34 +9991,6 @@ __metadata:
languageName: node
linkType: hard
-"sort-asc@npm:^0.2.0":
- version: 0.2.0
- resolution: "sort-asc@npm:0.2.0"
- checksum: 10c0/637d08a3f42d9b20ad489fa50970cc46ff606764ecfc95f00e607151d38a4b9086b74366ef99177783ff2da75ad821dff5d76557caa7206e5b3082e1e743e7cf
- languageName: node
- linkType: hard
-
-"sort-desc@npm:^0.2.0":
- version: 0.2.0
- resolution: "sort-desc@npm:0.2.0"
- checksum: 10c0/d9b49e49c8aa1d443ace95a86845f7ad9c9aeb9bb231f43adf7af22109bbd05b11983497f7c449d88ee6c499f43cf0591cde59975f5321c7883c6a395dce8482
- languageName: node
- linkType: hard
-
-"sort-object@npm:^3.0.3":
- version: 3.0.3
- resolution: "sort-object@npm:3.0.3"
- dependencies:
- bytewise: "npm:^1.1.0"
- get-value: "npm:^2.0.2"
- is-extendable: "npm:^0.1.1"
- sort-asc: "npm:^0.2.0"
- sort-desc: "npm:^0.2.0"
- union-value: "npm:^1.0.1"
- checksum: 10c0/b19518e3659875d0997bfb6e4a2bc681a71b3cc30a39b7ab673fcb5c32e65b2c9d4b66eba6c97c29c78b5fc437306ec0e0a85a381565d54eff8716388535db5d
- languageName: node
- linkType: hard
-
"source-map-js@npm:^1.0.2":
version: 1.0.2
resolution: "source-map-js@npm:1.0.2"
@@ -10227,15 +10068,6 @@ __metadata:
languageName: node
linkType: hard
-"split-string@npm:^3.0.1":
- version: 3.1.0
- resolution: "split-string@npm:3.1.0"
- dependencies:
- extend-shallow: "npm:^3.0.0"
- checksum: 10c0/72d7cd625445c7af215130e1e2bc183013bb9dd48a074eda1d35741e2b0dcb355e6df5b5558a62543a24dcec37dd1d6eb7a6228ff510d3c9de0f3dc1d1da8a70
- languageName: node
- linkType: hard
-
"ssri@npm:^10.0.0":
version: 10.0.5
resolution: "ssri@npm:10.0.5"
@@ -10644,10 +10476,10 @@ __metadata:
languageName: node
linkType: hard
-"tinyqueue@npm:^2.0.3":
- version: 2.0.3
- resolution: "tinyqueue@npm:2.0.3"
- checksum: 10c0/d7b590088f015a94a17132fa209c2f2a80c45158259af5474901fdf5932e95ea13ff6f034bcc725a6d5f66d3e5b888b048c310229beb25ad5bebb4f0a635abf2
+"tinyqueue@npm:^3.0.0":
+ version: 3.0.0
+ resolution: "tinyqueue@npm:3.0.0"
+ checksum: 10c0/edd6f1a6146aa3aa7bc85b44b3aacf44cddfa805b0901019272d7e9235894b4f28b2f9d09c1bce500ae48883b03708b6b871aa33920e895d2943720f7a9ad3ba
languageName: node
linkType: hard
@@ -10961,22 +10793,6 @@ __metadata:
languageName: node
linkType: hard
-"typewise-core@npm:^1.2, typewise-core@npm:^1.2.0":
- version: 1.2.0
- resolution: "typewise-core@npm:1.2.0"
- checksum: 10c0/0c574b036e430ef29a3c71dca1f88c041597734448db50e697ec4b7d03d71af4f8afeec556a2553f7db1cf98f9313b983071f0731d784108b2daf4f2e0c37d9e
- languageName: node
- linkType: hard
-
-"typewise@npm:^1.0.3":
- version: 1.0.3
- resolution: "typewise@npm:1.0.3"
- dependencies:
- typewise-core: "npm:^1.2.0"
- checksum: 10c0/0e300a963cd344f9f4216343eb1c9714e1aee12c5b928ae3ff4a19b4b1edcd82356b8bd763905bd72528718a3c863612f8259cb047934b59bdd849f305e12e80
- languageName: node
- linkType: hard
-
"typical@npm:^4.0.0":
version: 4.0.0
resolution: "typical@npm:4.0.0"
@@ -11003,18 +10819,6 @@ __metadata:
languageName: node
linkType: hard
-"union-value@npm:^1.0.1":
- version: 1.0.1
- resolution: "union-value@npm:1.0.1"
- dependencies:
- arr-union: "npm:^3.1.0"
- get-value: "npm:^2.0.6"
- is-extendable: "npm:^0.1.1"
- set-value: "npm:^2.0.1"
- checksum: 10c0/8758d880cb9545f62ce9cfb9b791b2b7a206e0ff5cc4b9d7cd6581da2c6839837fbb45e639cf1fd8eef3cae08c0201b614b7c06dd9f5f70d9dbe7c5fe2fbf592
- languageName: node
- linkType: hard
-
"unique-filename@npm:^3.0.0":
version: 3.0.0
resolution: "unique-filename@npm:3.0.0"
@@ -11202,17 +11006,6 @@ __metadata:
languageName: node
linkType: hard
-"vt-pbf@npm:^3.1.3":
- version: 3.1.3
- resolution: "vt-pbf@npm:3.1.3"
- dependencies:
- "@mapbox/point-geometry": "npm:0.1.0"
- "@mapbox/vector-tile": "npm:^1.3.1"
- pbf: "npm:^3.2.1"
- checksum: 10c0/a568801ae25f0ffe65ef697bf520c996c8a4067f73f355c0d5815238de90322c8ca207c61220206141cfe6f5b525de875b7eb26e22979a1b768b96d03b93dca7
- languageName: node
- linkType: hard
-
"watchpack@npm:^2.4.1":
version: 2.4.4
resolution: "watchpack@npm:2.4.4"
@@ -11446,7 +11239,7 @@ __metadata:
languageName: node
linkType: hard
-"which@npm:^1.2.9, which@npm:^1.3.1":
+"which@npm:^1.2.9":
version: 1.3.1
resolution: "which@npm:1.3.1"
dependencies: