@arenarium/maps-integration-google 1.0.9 → 1.0.10
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.js +1 -1
- package/package.json +2 -2
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}),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};
|
|
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}),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
|
+
"version": "1.0.10",
|
|
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.
|
|
37
|
+
"@arenarium/maps-core": "1.0.11"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"lib_google_check": "bunx tsc --noEmit",
|