@arenarium/maps 1.1.0 → 1.1.1

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.
@@ -0,0 +1 @@
1
+ "use strict";const t=()=>'<img src="https://arenarium.dev/favicon.svg" alt="Arenarium Maps" style="height: 1.25em; vertical-align: middle;" />',e=()=>`<a href="https://arenarium.dev" target="_blank" style="color: inherit;">${t()}<span>&nbsp;@arenarium/maps</span></a>`;exports.getAttributionHtml=e;
@@ -0,0 +1,4 @@
1
+ const t = () => '<img src="https://arenarium.dev/favicon.svg" alt="Arenarium Maps" style="height: 1.25em; vertical-align: middle;" />', a = () => `<a href="https://arenarium.dev" target="_blank" style="color: inherit;">${t()}<span>&nbsp;@arenarium/maps</span></a>`;
2
+ export {
3
+ a as g
4
+ };
@@ -1 +1 @@
1
- "use strict";var i=Object.defineProperty;var p=(s,e,t)=>e in s?i(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var l=(s,e,t)=>p(s,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class m{constructor(e,t,a,n){l(this,"MapClass");l(this,"MapMarkerClass");l(this,"map");l(this,"options");this.MapClass=e,this.MapMarkerClass=t,this.options=n,this.map=new this.MapClass(a,{...n})}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 e=this.map.getBounds();if(e==null)return{sw:{lat:NaN,lng:NaN},ne:{lat:NaN,lng:NaN}};const t=e.getSouthWest(),a=e.getNorthEast();return{sw:{lat:t.lat(),lng:t.lng()},ne:{lat:a.lat(),lng:a.lng()}}}panBy(e,t){this.map.panBy(e,t)}createMarker(e,t,a,n){const o=new this.MapMarkerClass({position:{lat:t,lng:a},content:e,zIndex:n});return{instance:o,inserted:()=>o.map!=null&&o.map==this.map,insert:()=>o.map=this.map,remove:()=>o.map=void 0,update:r=>o.zIndex=r}}}const g=[{elementType:"labels.icon",stylers:[{visibility:"off"}]},{stylers:[{saturation:-100},{lightness:-10}]},{featureType:"landscape",stylers:[{lightness:30}]},{featureType:"road",elementType:"geometry",stylers:[{saturation:-100}]}],y=[{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=y;exports.GoogleMapLightStyle=g;exports.GoogleMapsProvider=m;
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;
package/dist/google.d.ts CHANGED
@@ -69,7 +69,11 @@ export declare class GoogleMapsProvider implements MapProvider {
69
69
  private MapMarkerClass;
70
70
  private map;
71
71
  private options;
72
+ private attributionObserver;
73
+ private attributionElement;
72
74
  constructor(mapClass: GoogleMapsClass, mapMarkerClass: GoogleMapsMarkerClass, container: HTMLElement, options: google.maps.MapOptions);
75
+ private insertAttributionElement;
76
+ private updateAttributionElement;
73
77
  getParameters(): MapProviderParameters;
74
78
  getMap(): google.maps.Map;
75
79
  getContainer(): HTMLElement;
package/dist/google.es.js CHANGED
@@ -1,16 +1,41 @@
1
- var i = Object.defineProperty;
2
- var p = (s, e, t) => e in s ? i(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var l = (s, e, t) => p(s, typeof e != "symbol" ? e + "" : e, t);
4
- class g {
5
- constructor(e, t, a, o) {
6
- l(this, "MapClass");
7
- l(this, "MapMarkerClass");
8
- l(this, "map");
9
- l(this, "options");
10
- this.MapClass = e, this.MapMarkerClass = t, this.options = o, this.map = new this.MapClass(a, {
11
- ...o
1
+ var l = Object.defineProperty;
2
+ var m = (a, t, e) => t in a ? l(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
+ var r = (a, t, e) => m(a, typeof t != "symbol" ? t + "" : t, e);
4
+ import { g as p } from "./attribution-BYiDRQF4.js";
5
+ class d {
6
+ constructor(t, e, i, s) {
7
+ r(this, "MapClass");
8
+ r(this, "MapMarkerClass");
9
+ r(this, "map");
10
+ r(this, "options");
11
+ r(this, "attributionObserver");
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", () => {
16
+ this.attributionObserver || (this.attributionObserver = new MutationObserver((n, o) => {
17
+ this.insertAttributionElement(), this.attributionElement != null && (this.updateAttributionElement(), o.disconnect());
18
+ }), this.attributionObserver.observe(i, { childList: !0, subtree: !0 }));
19
+ }), this.map.addListener("bounds_changed", () => {
20
+ this.updateAttributionElement();
12
21
  });
13
22
  }
23
+ insertAttributionElement() {
24
+ var n, o;
25
+ const t = this.map.getDiv();
26
+ if (t == null) return;
27
+ const e = t.getElementsByClassName("gmnoprint")[0];
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);
31
+ }
32
+ updateAttributionElement() {
33
+ var i, s;
34
+ const t = this.map.getDiv();
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);
37
+ e != null && (e.style.display = t.clientWidth > 500 ? "initial" : "none");
38
+ }
14
39
  getParameters() {
15
40
  return {
16
41
  mapSize: 256,
@@ -29,26 +54,26 @@ class g {
29
54
  return this.map.getZoom() ?? NaN;
30
55
  }
31
56
  getBounds() {
32
- const e = this.map.getBounds();
33
- if (e == null) return { sw: { lat: NaN, lng: NaN }, ne: { lat: NaN, lng: NaN } };
34
- const t = e.getSouthWest(), a = e.getNorthEast();
35
- return { sw: { lat: t.lat(), lng: t.lng() }, ne: { lat: a.lat(), lng: a.lng() } };
57
+ const t = this.map.getBounds();
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() } };
36
61
  }
37
- panBy(e, t) {
38
- this.map.panBy(e, t);
62
+ panBy(t, e) {
63
+ this.map.panBy(t, e);
39
64
  }
40
- createMarker(e, t, a, o) {
41
- const n = new this.MapMarkerClass({ position: { lat: t, lng: a }, content: e, zIndex: o });
65
+ createMarker(t, e, i, s) {
66
+ const n = new this.MapMarkerClass({ position: { lat: e, lng: i }, content: t, zIndex: s });
42
67
  return {
43
68
  instance: n,
44
69
  inserted: () => n.map != null && n.map == this.map,
45
70
  insert: () => n.map = this.map,
46
71
  remove: () => n.map = void 0,
47
- update: (r) => n.zIndex = r
72
+ update: (o) => n.zIndex = o
48
73
  };
49
74
  }
50
75
  }
51
- const y = [
76
+ const g = [
52
77
  {
53
78
  elementType: "labels.icon",
54
79
  stylers: [
@@ -84,7 +109,7 @@ const y = [
84
109
  }
85
110
  ]
86
111
  }
87
- ], h = [
112
+ ], c = [
88
113
  {
89
114
  elementType: "labels.icon",
90
115
  stylers: [
@@ -135,7 +160,7 @@ const y = [
135
160
  }
136
161
  ];
137
162
  export {
138
- h as GoogleMapDarkStyle,
139
- y as GoogleMapLightStyle,
140
- g as GoogleMapsProvider
163
+ c as GoogleMapDarkStyle,
164
+ g as GoogleMapLightStyle,
165
+ d as GoogleMapsProvider
141
166
  };
package/dist/index.d.ts CHANGED
@@ -554,7 +554,11 @@ export declare class GoogleMapsProvider implements MapProvider {
554
554
  private MapMarkerClass;
555
555
  private map;
556
556
  private options;
557
+ private attributionObserver;
558
+ private attributionElement;
557
559
  constructor(mapClass: GoogleMapsClass, mapMarkerClass: GoogleMapsMarkerClass, container: HTMLElement, options: google.maps.MapOptions);
560
+ private insertAttributionElement;
561
+ private updateAttributionElement;
558
562
  getParameters(): MapProviderParameters;
559
563
  getMap(): google.maps.Map;
560
564
  getContainer(): HTMLElement;