@arenarium/maps 1.1.1 → 1.1.3

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.
@@ -1 +1 @@
1
- "use strict";var l=Object.defineProperty;var m=(o,t,e)=>t in o?l(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var r=(o,t,e)=>m(o,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./attribution-3vg4I3xA.cjs");class u{constructor(t,e,i,s){r(this,"MapClass");r(this,"MapMarkerClass");r(this,"map");r(this,"options");r(this,"attributionObserver");r(this,"attributionElement");this.MapClass=t,this.MapMarkerClass=e,this.options=s,this.map=new this.MapClass(i,{...s}),this.map.addListener("idle",()=>{this.attributionObserver||(this.attributionObserver=new MutationObserver((n,a)=>{this.insertAttributionElement(),this.attributionElement!=null&&(this.updateAttributionElement(),a.disconnect())}),this.attributionObserver.observe(i,{childList:!0,subtree:!0}))}),this.map.addListener("bounds_changed",()=>{this.updateAttributionElement()})}insertAttributionElement(){var n,a;const t=this.map.getDiv();if(t==null)return;const e=t.getElementsByClassName("gmnoprint")[0];if(e==null||e.parentElement==null)return;const i=e.cloneNode(!0),s=(a=(n=i.childNodes.item(0))==null?void 0:n.childNodes.item(1))==null?void 0:a.childNodes.item(0);s!=null&&(s.title="",s.innerHTML=p.getAttributionHtml(),e.parentElement.insertBefore(i,e),this.attributionElement=s)}updateAttributionElement(){var i,s;const t=this.map.getDiv();if(t==null)return;const e=(s=(i=this.attributionElement)==null?void 0:i.childNodes.item(0))==null?void 0:s.childNodes.item(1);e!=null&&(e.style.display=t.clientWidth>500?"initial":"none")}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}getBounds(){const t=this.map.getBounds();if(t==null)return{sw:{lat:NaN,lng:NaN},ne:{lat:NaN,lng:NaN}};const e=t.getSouthWest(),i=t.getNorthEast();return{sw:{lat:e.lat(),lng:e.lng()},ne:{lat:i.lat(),lng:i.lng()}}}panBy(t,e){this.map.panBy(t,e)}createMarker(t,e,i,s){const n=new this.MapMarkerClass({position:{lat:e,lng:i},content:t,zIndex:s});return{instance:n,inserted:()=>n.map!=null&&n.map==this.map,insert:()=>n.map=this.map,remove:()=>n.map=void 0,update:a=>n.zIndex=a}}}const d=[{elementType:"labels.icon",stylers:[{visibility:"off"}]},{stylers:[{saturation:-100},{lightness:-10}]},{featureType:"landscape",stylers:[{lightness:30}]},{featureType:"road",elementType:"geometry",stylers:[{saturation:-100}]}],h=[{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}]}];exports.GoogleMapDarkStyle=h;exports.GoogleMapLightStyle=d;exports.GoogleMapsProvider=u;
1
+ "use strict";var l=Object.defineProperty;var m=(a,t,e)=>t in a?l(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var r=(a,t,e)=>m(a,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./attribution-3vg4I3xA.cjs");class p{constructor(t,e,s,i){r(this,"MapClass");r(this,"MapMarkerClass");r(this,"map");r(this,"options");r(this,"attributionObserver");r(this,"attributionElement");this.MapClass=t,this.MapMarkerClass=e,this.options=i,this.map=new this.MapClass(s,{...i}),(i.attribution||i.attribution==null)&&(this.map.addListener("idle",()=>{this.attributionObserver||(this.attributionObserver=new MutationObserver((n,o)=>{this.insertAttributionElement(),this.attributionElement!=null&&(this.updateAttributionElement(),o.disconnect())}),this.attributionObserver.observe(s,{childList:!0,subtree:!0}))}),this.map.addListener("bounds_changed",()=>{this.updateAttributionElement()}))}insertAttributionElement(){var n,o;const t=this.map.getDiv();if(t==null)return;const e=t.getElementsByClassName("gmnoprint")[0];if(e==null||e.parentElement==null)return;const s=e.cloneNode(!0),i=(o=(n=s.childNodes.item(0))==null?void 0:n.childNodes.item(1))==null?void 0:o.childNodes.item(0);i!=null&&(i.title="",i.innerHTML=u.getAttributionHtml(),e.parentElement.insertBefore(s,e),this.attributionElement=i)}updateAttributionElement(){var s,i;const t=this.map.getDiv();if(t==null)return;const e=(i=(s=this.attributionElement)==null?void 0:s.childNodes.item(0))==null?void 0:i.childNodes.item(1);e!=null&&(e.style.display=t.clientWidth>500?"initial":"none")}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}getBounds(){const t=this.map.getBounds();if(t==null)return{sw:{lat:NaN,lng:NaN},ne:{lat:NaN,lng:NaN}};const e=t.getSouthWest(),s=t.getNorthEast();return{sw:{lat:e.lat(),lng:e.lng()},ne:{lat:s.lat(),lng:s.lng()}}}panBy(t,e){this.map.panBy(t,e)}createMarker(t,e,s,i){const n=new this.MapMarkerClass({position:{lat:e,lng:s},content:t,zIndex:i});return{instance:n,inserted:()=>n.map!=null&&n.map==this.map,insert:()=>n.map=this.map,remove:()=>n.map=void 0,update:o=>n.zIndex=o}}}const d=[{elementType:"labels.icon",stylers:[{visibility:"off"}]},{stylers:[{saturation:-100},{lightness:-10}]},{featureType:"landscape",stylers:[{lightness:30}]},{featureType:"road",elementType:"geometry",stylers:[{saturation:-100}]}],h=[{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}]}];exports.GoogleMapDarkStyle=h;exports.GoogleMapLightStyle=d;exports.GoogleMapsProvider=p;
package/dist/google.d.ts CHANGED
@@ -64,6 +64,10 @@ declare interface GoogleMapsMarkerClass {
64
64
  new (options: google.maps.marker.AdvancedMarkerElementOptions): google.maps.marker.AdvancedMarkerElement;
65
65
  }
66
66
 
67
+ declare interface GoogleMapsOptions extends google.maps.MapOptions {
68
+ attribution?: boolean;
69
+ }
70
+
67
71
  export declare class GoogleMapsProvider implements MapProvider {
68
72
  private MapClass;
69
73
  private MapMarkerClass;
@@ -71,7 +75,7 @@ export declare class GoogleMapsProvider implements MapProvider {
71
75
  private options;
72
76
  private attributionObserver;
73
77
  private attributionElement;
74
- constructor(mapClass: GoogleMapsClass, mapMarkerClass: GoogleMapsMarkerClass, container: HTMLElement, options: google.maps.MapOptions);
78
+ constructor(mapClass: GoogleMapsClass, mapMarkerClass: GoogleMapsMarkerClass, container: HTMLElement, options: GoogleMapsOptions);
75
79
  private insertAttributionElement;
76
80
  private updateAttributionElement;
77
81
  getParameters(): MapProviderParameters;
package/dist/google.es.js CHANGED
@@ -2,23 +2,23 @@ var l = Object.defineProperty;
2
2
  var m = (a, t, e) => t in a ? l(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
3
  var r = (a, t, e) => m(a, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { g as p } from "./attribution-BYiDRQF4.js";
5
- class d {
6
- constructor(t, e, i, s) {
5
+ class h {
6
+ constructor(t, e, s, i) {
7
7
  r(this, "MapClass");
8
8
  r(this, "MapMarkerClass");
9
9
  r(this, "map");
10
10
  r(this, "options");
11
11
  r(this, "attributionObserver");
12
12
  r(this, "attributionElement");
13
- this.MapClass = t, this.MapMarkerClass = e, this.options = s, this.map = new this.MapClass(i, {
14
- ...s
15
- }), this.map.addListener("idle", () => {
13
+ this.MapClass = t, this.MapMarkerClass = e, this.options = i, this.map = new this.MapClass(s, {
14
+ ...i
15
+ }), (i.attribution || i.attribution == null) && (this.map.addListener("idle", () => {
16
16
  this.attributionObserver || (this.attributionObserver = new MutationObserver((n, o) => {
17
17
  this.insertAttributionElement(), this.attributionElement != null && (this.updateAttributionElement(), o.disconnect());
18
- }), this.attributionObserver.observe(i, { childList: !0, subtree: !0 }));
18
+ }), this.attributionObserver.observe(s, { childList: !0, subtree: !0 }));
19
19
  }), this.map.addListener("bounds_changed", () => {
20
20
  this.updateAttributionElement();
21
- });
21
+ }));
22
22
  }
23
23
  insertAttributionElement() {
24
24
  var n, o;
@@ -26,14 +26,14 @@ class d {
26
26
  if (t == null) return;
27
27
  const e = t.getElementsByClassName("gmnoprint")[0];
28
28
  if (e == null || e.parentElement == null) return;
29
- const i = e.cloneNode(!0), s = (o = (n = i.childNodes.item(0)) == null ? void 0 : n.childNodes.item(1)) == null ? void 0 : o.childNodes.item(0);
30
- s != null && (s.title = "", s.innerHTML = p(), e.parentElement.insertBefore(i, e), this.attributionElement = s);
29
+ const s = e.cloneNode(!0), i = (o = (n = s.childNodes.item(0)) == null ? void 0 : n.childNodes.item(1)) == null ? void 0 : o.childNodes.item(0);
30
+ i != null && (i.title = "", i.innerHTML = p(), e.parentElement.insertBefore(s, e), this.attributionElement = i);
31
31
  }
32
32
  updateAttributionElement() {
33
- var i, s;
33
+ var s, i;
34
34
  const t = this.map.getDiv();
35
35
  if (t == null) return;
36
- const e = (s = (i = this.attributionElement) == null ? void 0 : i.childNodes.item(0)) == null ? void 0 : s.childNodes.item(1);
36
+ const e = (i = (s = this.attributionElement) == null ? void 0 : s.childNodes.item(0)) == null ? void 0 : i.childNodes.item(1);
37
37
  e != null && (e.style.display = t.clientWidth > 500 ? "initial" : "none");
38
38
  }
39
39
  getParameters() {
@@ -56,14 +56,14 @@ class d {
56
56
  getBounds() {
57
57
  const t = this.map.getBounds();
58
58
  if (t == null) return { sw: { lat: NaN, lng: NaN }, ne: { lat: NaN, lng: NaN } };
59
- const e = t.getSouthWest(), i = t.getNorthEast();
60
- return { sw: { lat: e.lat(), lng: e.lng() }, ne: { lat: i.lat(), lng: i.lng() } };
59
+ const e = t.getSouthWest(), s = t.getNorthEast();
60
+ return { sw: { lat: e.lat(), lng: e.lng() }, ne: { lat: s.lat(), lng: s.lng() } };
61
61
  }
62
62
  panBy(t, e) {
63
63
  this.map.panBy(t, e);
64
64
  }
65
- createMarker(t, e, i, s) {
66
- const n = new this.MapMarkerClass({ position: { lat: e, lng: i }, content: t, zIndex: s });
65
+ createMarker(t, e, s, i) {
66
+ const n = new this.MapMarkerClass({ position: { lat: e, lng: s }, content: t, zIndex: i });
67
67
  return {
68
68
  instance: n,
69
69
  inserted: () => n.map != null && n.map == this.map,
@@ -109,7 +109,7 @@ const g = [
109
109
  }
110
110
  ]
111
111
  }
112
- ], c = [
112
+ ], b = [
113
113
  {
114
114
  elementType: "labels.icon",
115
115
  stylers: [
@@ -160,7 +160,7 @@ const g = [
160
160
  }
161
161
  ];
162
162
  export {
163
- c as GoogleMapDarkStyle,
163
+ b as GoogleMapDarkStyle,
164
164
  g as GoogleMapLightStyle,
165
- d as GoogleMapsProvider
165
+ h as GoogleMapsProvider
166
166
  };
package/dist/index.d.ts CHANGED
@@ -549,6 +549,9 @@ export interface GoogleMapsClass {
549
549
  export interface GoogleMapsMarkerClass {
550
550
  new (options: google.maps.marker.AdvancedMarkerElementOptions): google.maps.marker.AdvancedMarkerElement;
551
551
  }
552
+ export interface GoogleMapsOptions extends google.maps.MapOptions {
553
+ attribution?: boolean;
554
+ }
552
555
  export declare class GoogleMapsProvider implements MapProvider {
553
556
  private MapClass;
554
557
  private MapMarkerClass;
@@ -556,7 +559,7 @@ export declare class GoogleMapsProvider implements MapProvider {
556
559
  private options;
557
560
  private attributionObserver;
558
561
  private attributionElement;
559
- constructor(mapClass: GoogleMapsClass, mapMarkerClass: GoogleMapsMarkerClass, container: HTMLElement, options: google.maps.MapOptions);
562
+ constructor(mapClass: GoogleMapsClass, mapMarkerClass: GoogleMapsMarkerClass, container: HTMLElement, options: GoogleMapsOptions);
560
563
  private insertAttributionElement;
561
564
  private updateAttributionElement;
562
565
  getParameters(): MapProviderParameters;