@arenarium/maps-integration-google 1.0.13 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.d.ts +5 -4
- package/dist/main.js +1 -1
- package/package.json +2 -2
package/dist/main.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IMapProvider, IMapProviderMarker, MapProviderEvent } from "@arenarium/maps-core/declarations/interfaces";
|
|
2
|
+
import { MapBounds, MapCoordinates, MapParameters, MapViewport } from "@arenarium/maps-core/declarations/types";
|
|
2
3
|
interface GoogleMapsClass {
|
|
3
4
|
new (container: HTMLElement, options: google.maps.MapOptions): google.maps.Map;
|
|
4
5
|
}
|
|
@@ -8,7 +9,7 @@ interface GoogleMapsMarkerClass {
|
|
|
8
9
|
interface GoogleMapsOptions extends google.maps.MapOptions {
|
|
9
10
|
attribution?: boolean;
|
|
10
11
|
}
|
|
11
|
-
declare class GoogleMapsProvider implements
|
|
12
|
+
declare class GoogleMapsProvider implements IMapProvider {
|
|
12
13
|
private MapClass;
|
|
13
14
|
private MapMarkerClass;
|
|
14
15
|
private map;
|
|
@@ -19,7 +20,7 @@ declare class GoogleMapsProvider implements MapProvider {
|
|
|
19
20
|
constructor(mapClass: GoogleMapsClass, mapMarkerClass: GoogleMapsMarkerClass, container: HTMLElement, options: GoogleMapsOptions);
|
|
20
21
|
private insertAttributionElement;
|
|
21
22
|
private updateAttributionElement;
|
|
22
|
-
getParameters():
|
|
23
|
+
getParameters(): MapParameters;
|
|
23
24
|
getMap(): google.maps.Map;
|
|
24
25
|
getContainer(): HTMLElement;
|
|
25
26
|
getZoom(): number;
|
|
@@ -27,7 +28,7 @@ declare class GoogleMapsProvider implements MapProvider {
|
|
|
27
28
|
getBounds(): MapBounds;
|
|
28
29
|
getViewport(): MapViewport;
|
|
29
30
|
panBy(x: number, y: number): void;
|
|
30
|
-
createMarker(element: HTMLElement, lat: number, lng: number, zIndex: number):
|
|
31
|
+
createMarker(element: HTMLElement, lat: number, lng: number, zIndex: number): IMapProviderMarker;
|
|
31
32
|
subscribe(event: MapProviderEvent, callback: () => void): void;
|
|
32
33
|
unsubscribe(event: MapProviderEvent, callback: () => void): void;
|
|
33
34
|
}
|
package/dist/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as M from"@arenarium/maps-core/attribution";class S{MapClass;MapMarkerClass;map;options;listeners=new Set;attributionObserver;attributionElement;constructor(g,y,s,f){if(this.MapClass=g,this.MapMarkerClass=y,this.options=f,this.map=new this.MapClass(s,{...f,tilt:0,tiltInteractionEnabled:!1,heading:0,headingInteractionEnabled:!1,rotateControl:!1,scaleControl:!1,clickableIcons:!1}),f.attribution==!0||f.attribution==null)this.map.addListener("idle",()=>{if(this.attributionObserver)return;this.attributionObserver=new MutationObserver((T,G)=>{if(this.insertAttributionElement(),this.attributionElement==null)return;this.updateAttributionElement(),G.disconnect()}),this.attributionObserver.observe(s,{childList:!0,subtree:!0})}),this.map.addListener("bounds_changed",()=>{this.updateAttributionElement()})}insertAttributionElement(){let g=this.map.getDiv();if(g==null)return;let y=g.getElementsByClassName("gmnoprint")[0];if(y==null)return;if(y.parentElement==null)return;let s=y.cloneNode(!0),f=s.childNodes.item(0)?.childNodes.item(1)?.childNodes.item(0);if(f==null)return;f.title="",f.innerHTML=M.getHtml(),y.parentElement.insertBefore(s,y),this.attributionElement=f}updateAttributionElement(){let g=this.map.getDiv();if(g==null)return;let y=this.attributionElement?.childNodes.item(0);if(y){y.style.height="14px",y.style.display="inline-flex",y.style.alignItems="center",y.style.gap="1px";let s=y.childNodes.item(0);if(s)s.style.height="12px",s.style.width="auto";let f=y.childNodes.item(1);if(f)f.style.display=g.clientWidth>500?"initial":"none",f.style.color=this.options.colorScheme==google.maps.ColorScheme.DARK?"#fff":"#000"}}getParameters(){return{
|
|
1
|
+
import*as M from"@arenarium/maps-core/map/attribution";class S{MapClass;MapMarkerClass;map;options;listeners=new Set;attributionObserver;attributionElement;constructor(g,y,s,f){if(this.MapClass=g,this.MapMarkerClass=y,this.options=f,this.map=new this.MapClass(s,{...f,tilt:0,tiltInteractionEnabled:!1,heading:0,headingInteractionEnabled:!1,rotateControl:!1,scaleControl:!1,clickableIcons:!1}),f.attribution==!0||f.attribution==null)this.map.addListener("idle",()=>{if(this.attributionObserver)return;this.attributionObserver=new MutationObserver((T,G)=>{if(this.insertAttributionElement(),this.attributionElement==null)return;this.updateAttributionElement(),G.disconnect()}),this.attributionObserver.observe(s,{childList:!0,subtree:!0})}),this.map.addListener("bounds_changed",()=>{this.updateAttributionElement()})}insertAttributionElement(){let g=this.map.getDiv();if(g==null)return;let y=g.getElementsByClassName("gmnoprint")[0];if(y==null)return;if(y.parentElement==null)return;let s=y.cloneNode(!0),f=s.childNodes.item(0)?.childNodes.item(1)?.childNodes.item(0);if(f==null)return;f.title="",f.innerHTML=M.getHtml(),y.parentElement.insertBefore(s,y),this.attributionElement=f}updateAttributionElement(){let g=this.map.getDiv();if(g==null)return;let y=this.attributionElement?.childNodes.item(0);if(y){y.style.height="14px",y.style.display="inline-flex",y.style.alignItems="center",y.style.gap="1px";let s=y.childNodes.item(0);if(s)s.style.height="12px",s.style.width="auto";let f=y.childNodes.item(1);if(f)f.style.display=g.clientWidth>500?"initial":"none",f.style.color=this.options.colorScheme==google.maps.ColorScheme.DARK?"#fff":"#000"}}getParameters(){return{size:256,zoom:{min:this.options.minZoom??0,max:this.options.maxZoom??24,scale:10}}}getMap(){return this.map}getContainer(){return this.map.getDiv()}getZoom(){return this.map.getZoom()??NaN}getCenter(){let g=this.map.getCenter();if(g==null)return{lat:NaN,lng:NaN};return{lat:g.lat(),lng:g.lng()}}getBounds(){let g=this.map.getBounds();if(g==null)return{sw:{lat:NaN,lng:NaN},ne:{lat:NaN,lng:NaN}};let y=g.getSouthWest(),s=g.getNorthEast();return{sw:{lat:y.lat(),lng:y.lng()},ne:{lat:s.lat(),lng:s.lng()}}}getViewport(){return{bounds:this.getBounds(),center:this.getCenter(),zoom:this.getZoom()}}panBy(g,y){this.map.panBy(g,y)}createMarker(g,y,s,f){let T=new this.MapMarkerClass({position:{lat:y,lng:s},content:g,zIndex:f});return{inserted:()=>T.map!=null&&T.map==this.map,insert:()=>T.map=this.map,remove:()=>T.map=void 0,update:(G)=>T.zIndex=G}}subscribe(g,y){let s=google.maps.event.addListener(this.map,g,y);this.listeners.add({id:s,event:g,callback:y})}unsubscribe(g,y){let s=this.listeners.values().find((f)=>f.event===g&&f.callback===y);if(s==null)return;google.maps.event.removeListener(s.id),this.listeners.delete(s)}}var D=[{elementType:"labels.icon",stylers:[{visibility:"off"}]},{stylers:[{saturation:-100},{lightness:-10}]},{featureType:"landscape",stylers:[{lightness:30}]},{featureType:"road",elementType:"geometry",stylers:[{saturation:-100}]}],P=[{elementType:"labels.icon",stylers:[{visibility:"off"}]},{stylers:[{saturation:-100}]},{elementType:"geometry",stylers:[{lightness:-45}]},{elementType:"labels.text.fill",stylers:[{lightness:-100}]},{elementType:"labels.text.stroke",stylers:[{lightness:-15}]},{featureType:"water",elementType:"geometry",stylers:[{lightness:-50}]}];export{S as GoogleMapsProvider,D as GoogleMapLightStyle,P as GoogleMapDarkStyle};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arenarium/maps-integration-google",
|
|
3
3
|
"description": "Integration with Google Maps for @arenarium/maps.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.15",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@types/google.maps": "^3.58.1"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@arenarium/maps-core": "1.0.
|
|
38
|
+
"@arenarium/maps-core": "1.0.19"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"lib_google_check": "bunx tsc --noEmit",
|