@arenarium/maps-integration-google 1.0.4 → 1.0.5

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 CHANGED
@@ -26,7 +26,7 @@ declare class GoogleMapsProvider implements MapProvider {
26
26
  getCenter(): MapCoordinates;
27
27
  getBounds(): MapBounds;
28
28
  getViewport(): MapViewport;
29
- panBy(x: number, y: number): undefined;
29
+ panBy(x: number, y: number): void;
30
30
  createMarker(element: HTMLElement, lat: number, lng: number, zIndex: number): MapProviderMarker;
31
31
  subscribe(event: MapProviderEvent, callback: () => void): void;
32
32
  unsubscribe(event: MapProviderEvent, callback: () => void): void;
package/dist/main.js CHANGED
@@ -1 +1 @@
1
- import{getAttributionHtml as S}from"@arenarium/maps-core/attribution";class M{MapClass;MapMarkerClass;map;options;listeners=new Set;attributionObserver;attributionElement;constructor(s,y,f,g){if(this.MapClass=s,this.MapMarkerClass=y,this.options=g,this.map=new this.MapClass(f,{...g}),g.attribution||g.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(f,{childList:!0,subtree:!0})}),this.map.addListener("bounds_changed",()=>{this.updateAttributionElement()})}insertAttributionElement(){let s=this.map.getDiv();if(s==null)return;let y=s.getElementsByClassName("gmnoprint")[0];if(y==null)return;if(y.parentElement==null)return;let f=y.cloneNode(!0),g=f.childNodes.item(0)?.childNodes.item(1)?.childNodes.item(0);if(g==null)return;g.title="",g.innerHTML=S(),y.parentElement.insertBefore(f,y),this.attributionElement=g}updateAttributionElement(){let s=this.map.getDiv();if(s==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 f=y.childNodes.item(0);if(f)f.style.height="12px",f.style.width="auto";let g=y.childNodes.item(1);if(g)g.style.display=s.clientWidth>500?"initial":"none",g.style.color=this.options.colorScheme==google.maps.ColorScheme.DARK?"#fff":"#000"}}getParameters(){return{mapSize:256,zoomMin:this.options.minZoom??0,zoomMax:this.options.maxZoom??24,zoomScale:10}}getMap(){return this.map}getContainer(){return this.map.getDiv()}getZoom(){return this.map.getZoom()??NaN}getCenter(){let s=this.map.getCenter();if(s==null)return{lat:NaN,lng:NaN};return{lat:s.lat(),lng:s.lng()}}getBounds(){let s=this.map.getBounds();if(s==null)return{sw:{lat:NaN,lng:NaN},ne:{lat:NaN,lng:NaN}};let y=s.getSouthWest(),f=s.getNorthEast();return{sw:{lat:y.lat(),lng:y.lng()},ne:{lat:f.lat(),lng:f.lng()}}}getViewport(){return{bounds:this.getBounds(),center:this.getCenter(),zoom:this.getZoom()}}panBy(s,y){this.map.panBy(s,y)}createMarker(s,y,f,g){let T=new this.MapMarkerClass({position:{lat:y,lng:f},content:s,zIndex:g});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(s,y){let f=google.maps.event.addListener(this.map,s,y);this.listeners.add({id:f,event:s,callback:y})}unsubscribe(s,y){let f=this.listeners.values().find((g)=>g.event==s&&g.callback==y);if(f==null)return;google.maps.event.removeListener(f.id)}}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{M as GoogleMapsProvider,D as GoogleMapLightStyle,P as GoogleMapDarkStyle};
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}),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{mapSize:256,zoomMin:this.options.minZoom??0,zoomMax:this.options.maxZoom??24,zoomScale: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",
4
+ "version": "1.0.5",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -34,7 +34,7 @@
34
34
  "@types/google.maps": "^3.58.1"
35
35
  },
36
36
  "dependencies": {
37
- "@arenarium/maps-core": "1.0.3"
37
+ "@arenarium/maps-core": "1.0.5"
38
38
  },
39
39
  "scripts": {
40
40
  "lib_google_build": "bunup",