@local-logic/maps 0.0.16 → 0.0.18
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/{index-NEUlLLtm.js → index-Be6RGKzc.js} +3 -3
- package/dist/{index-BvnFFiii.js → index-C0nB-ZYI.js} +2 -2
- package/dist/{index-CnuTCmRK.js → index-C1QREXT1.js} +2 -2
- package/dist/index-C7cTTXxY.js +24 -0
- package/dist/{index-DJ1PVoCd.js → index-C9z8YU4t.js} +3 -3
- package/dist/{index-Cg3HD19r.js → index-CBfuS_n2.js} +2 -2
- package/dist/{index-BUkdAOYF.js → index-C_RtwL3E.js} +5 -5
- package/dist/{index-Brp2pz_Z.js → index-DMwjyhBt.js} +3 -3
- package/dist/{index-Dzgb7feN.js → index-DUdSU2pv.js} +2 -2
- package/dist/{index-_YvDHCeI.js → index-DjQpPQGI.js} +1 -1
- package/dist/{index-CTU66ogZ.js → index-DnE7POcz.js} +1 -1
- package/dist/{index-3kRdcdZh.js → index-Dvg9jDs5.js} +1 -1
- package/dist/{index-x3wrHsPD.js → index-Dz1XJJEv.js} +1 -1
- package/dist/{index-DyGtnON3.js → index-gTk5Txmy.js} +2 -2
- package/dist/{index-CV_IAyz3.js → index-pztBT1mz.js} +2 -2
- package/dist/{index-Yh7bUURu.js → index-r9nwo0R7.js} +1 -1
- package/dist/index-t8m-nFSa.js +23 -0
- package/dist/index.es.js +1 -1
- package/dist/{index.modern-CLRs8JwI.js → index.modern-fpUBOYPT.js} +288 -282
- package/dist/index.umd.js +624 -251
- package/dist/{logo-control-NE-LlsRy.js → logo-control-BALqfBGo.js} +212 -202
- package/dist/mapbox-gl-Coz2msiN.js +34257 -0
- package/dist/maplibre-gl-CAHhS7Ky.js +21377 -0
- package/dist/{scale-control-CyJd4u6j.js → scale-control-BOI2g14-.js} +183 -173
- package/dist/src/components/Map/Root/CenterPin/Google/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/CenterPin/Mapbox/index.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +30 -30
- package/dist/index-BFK3wMTT.js +0 -24
- package/dist/index-BQRXN0e-.js +0 -23
- package/dist/mapbox-gl-D58OubwB.js +0 -32266
- package/dist/maplibre-gl-CfOZKUDd.js +0 -20722
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import b, { forwardRef as Y, useMemo as P, useContext as R, useEffect as v, useLayoutEffect as W, useImperativeHandle as Q, useState as A, useRef as z, useReducer as ee, useCallback as te, Children as ue } from "react";
|
|
2
2
|
import { createPortal as $ } from "react-dom";
|
|
3
|
-
import { g as
|
|
4
|
-
var j,
|
|
5
|
-
function
|
|
6
|
-
return
|
|
3
|
+
import { g as de } from "./_commonjsHelpers-C6fGbg64.js";
|
|
4
|
+
var j, q;
|
|
5
|
+
function fe() {
|
|
6
|
+
return q || (q = 1, j = function t(e, n) {
|
|
7
7
|
if (e === n) return !0;
|
|
8
8
|
if (e && n && typeof e == "object" && typeof n == "object") {
|
|
9
9
|
if (e.constructor !== n.constructor) return !1;
|
|
@@ -29,16 +29,16 @@ function ue() {
|
|
|
29
29
|
return e !== e && n !== n;
|
|
30
30
|
}), j;
|
|
31
31
|
}
|
|
32
|
-
var
|
|
33
|
-
const
|
|
34
|
-
function
|
|
35
|
-
return
|
|
32
|
+
var ge = fe();
|
|
33
|
+
const ne = /* @__PURE__ */ de(ge);
|
|
34
|
+
function _() {
|
|
35
|
+
return _ = Object.assign ? Object.assign.bind() : function(t) {
|
|
36
36
|
for (var e = 1; e < arguments.length; e++) {
|
|
37
37
|
var n = arguments[e];
|
|
38
38
|
for (var o in n) ({}).hasOwnProperty.call(n, o) && (t[o] = n[o]);
|
|
39
39
|
}
|
|
40
40
|
return t;
|
|
41
|
-
},
|
|
41
|
+
}, _.apply(null, arguments);
|
|
42
42
|
}
|
|
43
43
|
function D(t, e) {
|
|
44
44
|
if (t == null) return {};
|
|
@@ -49,7 +49,7 @@ function D(t, e) {
|
|
|
49
49
|
}
|
|
50
50
|
return n;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function me(t, e) {
|
|
53
53
|
if (typeof t != "object" || !t) return t;
|
|
54
54
|
var n = t[Symbol.toPrimitive];
|
|
55
55
|
if (n !== void 0) {
|
|
@@ -59,8 +59,8 @@ function ge(t, e) {
|
|
|
59
59
|
}
|
|
60
60
|
return String(t);
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
var e =
|
|
62
|
+
function pe(t) {
|
|
63
|
+
var e = me(t, "string");
|
|
64
64
|
return typeof e == "symbol" ? e : e + "";
|
|
65
65
|
}
|
|
66
66
|
const x = {
|
|
@@ -69,8 +69,8 @@ const x = {
|
|
|
69
69
|
LOADED: "LOADED",
|
|
70
70
|
FAILED: "FAILED",
|
|
71
71
|
AUTH_FAILURE: "AUTH_FAILURE"
|
|
72
|
-
},
|
|
73
|
-
class
|
|
72
|
+
}, he = "https://maps.googleapis.com/maps/api/js";
|
|
73
|
+
class B {
|
|
74
74
|
/**
|
|
75
75
|
* Loads the Maps JavaScript API with the specified parameters.
|
|
76
76
|
* Since the Maps library can only be loaded once per page, this will
|
|
@@ -112,12 +112,12 @@ class R {
|
|
|
112
112
|
let n = null;
|
|
113
113
|
const o = () => n || (n = new Promise((r, i) => {
|
|
114
114
|
var a;
|
|
115
|
-
const s = document.createElement("script"),
|
|
116
|
-
for (const [
|
|
117
|
-
const p =
|
|
118
|
-
|
|
115
|
+
const s = document.createElement("script"), c = new URLSearchParams();
|
|
116
|
+
for (const [u, d] of Object.entries(e)) {
|
|
117
|
+
const p = u.replace(/[A-Z]/g, (f) => "_" + f[0].toLowerCase());
|
|
118
|
+
c.set(p, String(d));
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
c.set("loading", "async"), c.set("callback", "__googleMapsCallback__"), s.async = !0, s.src = he + "?" + c.toString(), s.nonce = ((a = document.querySelector("script[nonce]")) == null ? void 0 : a.nonce) || "", s.onerror = () => {
|
|
121
121
|
this.loadingStatus = x.FAILED, this.notifyLoadingStatusListeners(), i(new Error("The Google Maps JavaScript API could not load."));
|
|
122
122
|
}, window.__googleMapsCallback__ = () => {
|
|
123
123
|
this.loadingStatus = x.LOADED, this.notifyLoadingStatusListeners(), r();
|
|
@@ -135,59 +135,59 @@ class R {
|
|
|
135
135
|
e(this.loadingStatus);
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
function
|
|
138
|
+
B.loadingStatus = x.NOT_LOADED;
|
|
139
|
+
B.serializedApiParams = void 0;
|
|
140
|
+
B.listeners = [];
|
|
141
|
+
const ve = ["onLoad", "onError", "apiKey", "version", "libraries"], Ce = ["children"], ye = "GMP_visgl_rgmlibrary_v1_default", G = b.createContext(null);
|
|
142
|
+
function be() {
|
|
143
143
|
const [t, e] = A({});
|
|
144
144
|
return {
|
|
145
145
|
mapInstances: t,
|
|
146
146
|
addMapInstance: (i, a = "default") => {
|
|
147
|
-
e((s) =>
|
|
147
|
+
e((s) => _({}, s, {
|
|
148
148
|
[a]: i
|
|
149
149
|
}));
|
|
150
150
|
},
|
|
151
151
|
removeMapInstance: (i = "default") => {
|
|
152
|
-
e((a) => D(a, [i].map(
|
|
152
|
+
e((a) => D(a, [i].map(pe)));
|
|
153
153
|
},
|
|
154
154
|
clearMapInstances: () => {
|
|
155
155
|
e({});
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function Oe(t) {
|
|
160
160
|
const {
|
|
161
161
|
onLoad: e,
|
|
162
162
|
onError: n,
|
|
163
163
|
apiKey: o,
|
|
164
164
|
version: r,
|
|
165
165
|
libraries: i = []
|
|
166
|
-
} = t, a = D(t,
|
|
166
|
+
} = t, a = D(t, ve), [s, c] = A(B.loadingStatus), [u, d] = ee((l, g) => l[g.name] ? l : _({}, l, {
|
|
167
167
|
[g.name]: g.value
|
|
168
|
-
}), {}), p = P(() => i == null ? void 0 : i.join(","), [i]), f = P(() => JSON.stringify(
|
|
168
|
+
}), {}), p = P(() => i == null ? void 0 : i.join(","), [i]), f = P(() => JSON.stringify(_({
|
|
169
169
|
apiKey: o,
|
|
170
170
|
version: r
|
|
171
171
|
}, a)), [o, r, a]), m = te(async (l) => {
|
|
172
172
|
var g;
|
|
173
|
-
if (
|
|
174
|
-
return
|
|
173
|
+
if (u[l])
|
|
174
|
+
return u[l];
|
|
175
175
|
if (!((g = google) != null && (g = g.maps) != null && g.importLibrary))
|
|
176
176
|
throw new Error("[api-provider-internal] importLibrary was called before google.maps.importLibrary was defined.");
|
|
177
|
-
const
|
|
178
|
-
return
|
|
177
|
+
const C = await window.google.maps.importLibrary(l);
|
|
178
|
+
return d({
|
|
179
179
|
name: l,
|
|
180
|
-
value:
|
|
181
|
-
}),
|
|
182
|
-
}, [
|
|
183
|
-
return
|
|
180
|
+
value: C
|
|
181
|
+
}), C;
|
|
182
|
+
}, [u]);
|
|
183
|
+
return v(
|
|
184
184
|
() => {
|
|
185
185
|
(async () => {
|
|
186
186
|
try {
|
|
187
|
-
const l =
|
|
187
|
+
const l = _({
|
|
188
188
|
key: o
|
|
189
189
|
}, a);
|
|
190
|
-
r && (l.v = r), (p == null ? void 0 : p.length) > 0 && (l.libraries = p), (l.channel === void 0 || l.channel < 0 || l.channel > 999) && delete l.channel, l.solutionChannel === void 0 ? l.solutionChannel =
|
|
190
|
+
r && (l.v = r), (p == null ? void 0 : p.length) > 0 && (l.libraries = p), (l.channel === void 0 || l.channel < 0 || l.channel > 999) && delete l.channel, l.solutionChannel === void 0 ? l.solutionChannel = ye : l.solutionChannel === "" && delete l.solutionChannel, await B.load(l, (g) => c(g));
|
|
191
191
|
for (const g of ["core", "maps", ...i])
|
|
192
192
|
await m(g);
|
|
193
193
|
e && e();
|
|
@@ -200,48 +200,48 @@ function be(t) {
|
|
|
200
200
|
[o, p, f]
|
|
201
201
|
), {
|
|
202
202
|
status: s,
|
|
203
|
-
loadedLibraries:
|
|
203
|
+
loadedLibraries: u,
|
|
204
204
|
importLibrary: m
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
|
-
const
|
|
207
|
+
const rt = (t) => {
|
|
208
208
|
const {
|
|
209
209
|
children: e
|
|
210
|
-
} = t, n = D(t,
|
|
210
|
+
} = t, n = D(t, Ce), {
|
|
211
211
|
mapInstances: o,
|
|
212
212
|
addMapInstance: r,
|
|
213
213
|
removeMapInstance: i,
|
|
214
214
|
clearMapInstances: a
|
|
215
|
-
} =
|
|
215
|
+
} = be(), {
|
|
216
216
|
status: s,
|
|
217
|
-
loadedLibraries:
|
|
218
|
-
importLibrary:
|
|
219
|
-
} =
|
|
217
|
+
loadedLibraries: c,
|
|
218
|
+
importLibrary: u
|
|
219
|
+
} = Oe(n), d = P(() => ({
|
|
220
220
|
mapInstances: o,
|
|
221
221
|
addMapInstance: r,
|
|
222
222
|
removeMapInstance: i,
|
|
223
223
|
clearMapInstances: a,
|
|
224
224
|
status: s,
|
|
225
|
-
loadedLibraries:
|
|
226
|
-
importLibrary:
|
|
227
|
-
}), [o, r, i, a, s,
|
|
228
|
-
return /* @__PURE__ */
|
|
229
|
-
value:
|
|
225
|
+
loadedLibraries: c,
|
|
226
|
+
importLibrary: u
|
|
227
|
+
}), [o, r, i, a, s, c, u]);
|
|
228
|
+
return /* @__PURE__ */ b.createElement(G.Provider, {
|
|
229
|
+
value: d
|
|
230
230
|
}, e);
|
|
231
231
|
};
|
|
232
|
-
function
|
|
233
|
-
for (const n of
|
|
234
|
-
const o = e[n], r =
|
|
235
|
-
|
|
232
|
+
function we(t, e) {
|
|
233
|
+
for (const n of Ie) {
|
|
234
|
+
const o = e[n], r = oe[n];
|
|
235
|
+
v(() => {
|
|
236
236
|
if (!t || !o) return;
|
|
237
237
|
const i = google.maps.event.addListener(t, r, (a) => {
|
|
238
|
-
o(
|
|
238
|
+
o(Ee(r, t, a));
|
|
239
239
|
});
|
|
240
240
|
return () => i.remove();
|
|
241
241
|
}, [t, r, o]);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function Ee(t, e, n) {
|
|
245
245
|
const o = {
|
|
246
246
|
type: t,
|
|
247
247
|
map: e,
|
|
@@ -250,24 +250,24 @@ function we(t, e, n) {
|
|
|
250
250
|
stop: () => {
|
|
251
251
|
}
|
|
252
252
|
};
|
|
253
|
-
if (
|
|
254
|
-
const i = o, a = e.getCenter(), s = e.getZoom(),
|
|
255
|
-
return (!a || !
|
|
253
|
+
if (Le.includes(t)) {
|
|
254
|
+
const i = o, a = e.getCenter(), s = e.getZoom(), c = e.getHeading() || 0, u = e.getTilt() || 0, d = e.getBounds();
|
|
255
|
+
return (!a || !d || !Number.isFinite(s)) && console.warn("[createEvent] at least one of the values from the map returned undefined. This is not expected to happen. Please report an issue at https://github.com/visgl/react-google-maps/issues/new"), i.detail = {
|
|
256
256
|
center: (a == null ? void 0 : a.toJSON()) || {
|
|
257
257
|
lat: 0,
|
|
258
258
|
lng: 0
|
|
259
259
|
},
|
|
260
260
|
zoom: s || 0,
|
|
261
|
-
heading:
|
|
262
|
-
tilt:
|
|
263
|
-
bounds: (
|
|
261
|
+
heading: c,
|
|
262
|
+
tilt: u,
|
|
263
|
+
bounds: (d == null ? void 0 : d.toJSON()) || {
|
|
264
264
|
north: 90,
|
|
265
265
|
east: 180,
|
|
266
266
|
south: -90,
|
|
267
267
|
west: -180
|
|
268
268
|
}
|
|
269
269
|
}, i;
|
|
270
|
-
} else if (
|
|
270
|
+
} else if (Me.includes(t)) {
|
|
271
271
|
var r;
|
|
272
272
|
if (!n) throw new Error("[createEvent] mouse events must provide a srcEvent");
|
|
273
273
|
const i = o;
|
|
@@ -278,7 +278,7 @@ function we(t, e, n) {
|
|
|
278
278
|
}
|
|
279
279
|
return o;
|
|
280
280
|
}
|
|
281
|
-
const
|
|
281
|
+
const oe = {
|
|
282
282
|
onBoundsChanged: "bounds_changed",
|
|
283
283
|
onCenterChanged: "center_changed",
|
|
284
284
|
onClick: "click",
|
|
@@ -304,25 +304,31 @@ const ne = {
|
|
|
304
304
|
// since that is going to be fired in every situation where the camera is
|
|
305
305
|
// updated.
|
|
306
306
|
onCameraChanged: "bounds_changed"
|
|
307
|
-
},
|
|
308
|
-
function
|
|
309
|
-
const n =
|
|
310
|
-
|
|
307
|
+
}, Le = ["bounds_changed", "center_changed", "heading_changed", "tilt_changed", "zoom_changed"], Me = ["click", "contextmenu", "dblclick", "mousemove", "mouseout", "mouseover"], Ie = Object.keys(oe);
|
|
308
|
+
function re(t, e) {
|
|
309
|
+
const n = z(t);
|
|
310
|
+
return e(t, n.current) || (n.current = t), n.current;
|
|
311
|
+
}
|
|
312
|
+
function Se(t, e, n) {
|
|
313
|
+
v(t, [re(e, n)]);
|
|
311
314
|
}
|
|
312
|
-
|
|
313
|
-
|
|
315
|
+
function _e(t, e) {
|
|
316
|
+
Se(t, e, ne);
|
|
317
|
+
}
|
|
318
|
+
const ke = /* @__PURE__ */ new Set(["backgroundColor", "clickableIcons", "controlSize", "disableDefaultUI", "disableDoubleClickZoom", "draggable", "draggableCursor", "draggingCursor", "fullscreenControl", "fullscreenControlOptions", "gestureHandling", "headingInteractionEnabled", "isFractionalZoomEnabled", "keyboardShortcuts", "mapTypeControl", "mapTypeControlOptions", "mapTypeId", "maxZoom", "minZoom", "noClear", "panControl", "panControlOptions", "restriction", "rotateControl", "rotateControlOptions", "scaleControl", "scaleControlOptions", "scrollwheel", "streetView", "streetViewControl", "streetViewControlOptions", "styles", "tiltInteractionEnabled", "zoomControl", "zoomControlOptions"]);
|
|
319
|
+
function xe(t, e) {
|
|
314
320
|
const n = {}, o = Object.keys(e);
|
|
315
321
|
for (const r of o)
|
|
316
|
-
|
|
317
|
-
|
|
322
|
+
ke.has(r) && (n[r] = e[r]);
|
|
323
|
+
_e(() => {
|
|
318
324
|
t && t.setOptions(n);
|
|
319
325
|
}, [n]);
|
|
320
326
|
}
|
|
321
|
-
function
|
|
327
|
+
function ie() {
|
|
322
328
|
var t;
|
|
323
|
-
return ((t =
|
|
329
|
+
return ((t = R(G)) == null ? void 0 : t.status) || x.NOT_LOADED;
|
|
324
330
|
}
|
|
325
|
-
function
|
|
331
|
+
function Ae(t, e) {
|
|
326
332
|
const {
|
|
327
333
|
viewport: n,
|
|
328
334
|
viewState: o
|
|
@@ -333,8 +339,8 @@ function _e(t, e) {
|
|
|
333
339
|
latitude: i,
|
|
334
340
|
longitude: a,
|
|
335
341
|
bearing: s,
|
|
336
|
-
pitch:
|
|
337
|
-
zoom:
|
|
342
|
+
pitch: c,
|
|
343
|
+
zoom: u
|
|
338
344
|
} = o;
|
|
339
345
|
t.moveCamera({
|
|
340
346
|
center: {
|
|
@@ -342,33 +348,33 @@ function _e(t, e) {
|
|
|
342
348
|
lng: a
|
|
343
349
|
},
|
|
344
350
|
heading: s,
|
|
345
|
-
tilt:
|
|
346
|
-
zoom:
|
|
351
|
+
tilt: c,
|
|
352
|
+
zoom: u + 1
|
|
347
353
|
});
|
|
348
354
|
}, [t, o]), r;
|
|
349
355
|
}
|
|
350
|
-
function
|
|
356
|
+
function Pe(t) {
|
|
351
357
|
return !t || typeof t != "object" || !("lat" in t && "lng" in t) ? !1 : Number.isFinite(t.lat) && Number.isFinite(t.lng);
|
|
352
358
|
}
|
|
353
|
-
function
|
|
354
|
-
return
|
|
359
|
+
function ae(t) {
|
|
360
|
+
return Pe(t) ? t : t.toJSON();
|
|
355
361
|
}
|
|
356
|
-
function
|
|
357
|
-
const o = n.center ?
|
|
362
|
+
function De(t, e, n) {
|
|
363
|
+
const o = n.center ? ae(n.center) : null;
|
|
358
364
|
let r = null, i = null;
|
|
359
365
|
o && Number.isFinite(o.lat) && Number.isFinite(o.lng) && (r = o.lat, i = o.lng);
|
|
360
|
-
const a = Number.isFinite(n.zoom) ? n.zoom : null, s = Number.isFinite(n.heading) ? n.heading : null,
|
|
366
|
+
const a = Number.isFinite(n.zoom) ? n.zoom : null, s = Number.isFinite(n.heading) ? n.heading : null, c = Number.isFinite(n.tilt) ? n.tilt : null;
|
|
361
367
|
W(() => {
|
|
362
368
|
if (!t) return;
|
|
363
|
-
const
|
|
364
|
-
let
|
|
365
|
-
r !== null && i !== null && (e.current.center.lat !== r || e.current.center.lng !== i) && (
|
|
369
|
+
const u = {};
|
|
370
|
+
let d = !1;
|
|
371
|
+
r !== null && i !== null && (e.current.center.lat !== r || e.current.center.lng !== i) && (u.center = {
|
|
366
372
|
lat: r,
|
|
367
373
|
lng: i
|
|
368
|
-
},
|
|
374
|
+
}, d = !0), a !== null && e.current.zoom !== a && (u.zoom = a, d = !0), s !== null && e.current.heading !== s && (u.heading = s, d = !0), c !== null && e.current.tilt !== c && (u.tilt = c, d = !0), d && t.moveCamera(u);
|
|
369
375
|
});
|
|
370
376
|
}
|
|
371
|
-
const
|
|
377
|
+
const Te = () => {
|
|
372
378
|
const t = {
|
|
373
379
|
position: "absolute",
|
|
374
380
|
top: 0,
|
|
@@ -385,22 +391,22 @@ const Ae = () => {
|
|
|
385
391
|
background: "#dddddd",
|
|
386
392
|
padding: "1rem 1.5rem"
|
|
387
393
|
};
|
|
388
|
-
return /* @__PURE__ */
|
|
394
|
+
return /* @__PURE__ */ b.createElement("div", {
|
|
389
395
|
style: t
|
|
390
|
-
}, /* @__PURE__ */
|
|
396
|
+
}, /* @__PURE__ */ b.createElement("h2", null, "Error: AuthFailure"), /* @__PURE__ */ b.createElement("p", null, "A problem with your API key prevents the map from rendering correctly. Please make sure the value of the ", /* @__PURE__ */ b.createElement("code", null, "APIProvider.apiKey"), " prop is correct. Check the error-message in the console for further details."));
|
|
391
397
|
};
|
|
392
|
-
function
|
|
398
|
+
function Fe() {
|
|
393
399
|
const [t, e] = A(null), n = te((o) => e(o), [e]);
|
|
394
400
|
return [t, n];
|
|
395
401
|
}
|
|
396
|
-
function
|
|
397
|
-
return
|
|
402
|
+
function se() {
|
|
403
|
+
return ie() === x.LOADED;
|
|
398
404
|
}
|
|
399
|
-
function
|
|
405
|
+
function Ne() {
|
|
400
406
|
const [, t] = ee((e) => e + 1, 0);
|
|
401
407
|
return t;
|
|
402
408
|
}
|
|
403
|
-
function
|
|
409
|
+
function ze(t, e) {
|
|
404
410
|
const n = t.getCenter(), o = t.getZoom(), r = t.getHeading() || 0, i = t.getTilt() || 0, a = t.getBounds();
|
|
405
411
|
(!n || !a || !Number.isFinite(o)) && console.warn("[useTrackedCameraState] at least one of the values from the map returned undefined. This is not expected to happen. Please report an issue at https://github.com/visgl/react-google-maps/issues/new"), Object.assign(e.current, {
|
|
406
412
|
center: (n == null ? void 0 : n.toJSON()) || {
|
|
@@ -412,8 +418,8 @@ function Te(t, e) {
|
|
|
412
418
|
tilt: i
|
|
413
419
|
});
|
|
414
420
|
}
|
|
415
|
-
function
|
|
416
|
-
const e =
|
|
421
|
+
function Re(t) {
|
|
422
|
+
const e = Ne(), n = z({
|
|
417
423
|
center: {
|
|
418
424
|
lat: 0,
|
|
419
425
|
lng: 0
|
|
@@ -422,16 +428,16 @@ function Fe(t) {
|
|
|
422
428
|
tilt: 0,
|
|
423
429
|
zoom: 0
|
|
424
430
|
});
|
|
425
|
-
return
|
|
431
|
+
return v(() => {
|
|
426
432
|
if (!t) return;
|
|
427
433
|
const o = google.maps.event.addListener(t, "bounds_changed", () => {
|
|
428
|
-
|
|
434
|
+
ze(t, n), e();
|
|
429
435
|
});
|
|
430
436
|
return () => o.remove();
|
|
431
437
|
}, [t, e]), n;
|
|
432
438
|
}
|
|
433
|
-
const
|
|
434
|
-
class
|
|
439
|
+
const Be = ["id", "defaultBounds", "defaultCenter", "defaultZoom", "defaultHeading", "defaultTilt", "reuseMaps", "renderingType", "colorScheme"], Ge = ["padding"];
|
|
440
|
+
class U {
|
|
435
441
|
static has(e) {
|
|
436
442
|
return this.entries[e] && this.entries[e].length > 0;
|
|
437
443
|
}
|
|
@@ -442,60 +448,60 @@ class H {
|
|
|
442
448
|
this.entries[e] || (this.entries[e] = []), this.entries[e].push(n);
|
|
443
449
|
}
|
|
444
450
|
}
|
|
445
|
-
|
|
446
|
-
function
|
|
447
|
-
const n =
|
|
448
|
-
id:
|
|
449
|
-
defaultBounds:
|
|
450
|
-
defaultCenter:
|
|
451
|
+
U.entries = {};
|
|
452
|
+
function He(t, e) {
|
|
453
|
+
const n = se(), [o, r] = A(null), [i, a] = Fe(), s = Re(o), {
|
|
454
|
+
id: c,
|
|
455
|
+
defaultBounds: u,
|
|
456
|
+
defaultCenter: d,
|
|
451
457
|
defaultZoom: p,
|
|
452
458
|
defaultHeading: f,
|
|
453
459
|
defaultTilt: m,
|
|
454
460
|
reuseMaps: l,
|
|
455
461
|
renderingType: g,
|
|
456
|
-
colorScheme:
|
|
457
|
-
} = t, h = D(t,
|
|
458
|
-
!
|
|
459
|
-
for (const
|
|
460
|
-
const
|
|
461
|
-
return
|
|
462
|
+
colorScheme: C
|
|
463
|
+
} = t, h = D(t, Be), I = t.zoom !== void 0 || t.defaultZoom !== void 0, O = t.center !== void 0 || t.defaultCenter !== void 0;
|
|
464
|
+
!u && (!I || !O) && console.warn("<Map> component is missing configuration. You have to provide zoom and center (via the `zoom`/`defaultZoom` and `center`/`defaultCenter` props) or specify the region to show using `defaultBounds`. See https://visgl.github.io/react-google-maps/docs/api-reference/components/map#required"), !h.center && d && (h.center = d), !h.zoom && Number.isFinite(p) && (h.zoom = p), !h.heading && Number.isFinite(f) && (h.heading = f), !h.tilt && Number.isFinite(m) && (h.tilt = m);
|
|
465
|
+
for (const w of Object.keys(h)) h[w] === void 0 && delete h[w];
|
|
466
|
+
const E = z(void 0);
|
|
467
|
+
return v(
|
|
462
468
|
() => {
|
|
463
469
|
if (!i || !n) return;
|
|
464
470
|
const {
|
|
465
|
-
addMapInstance:
|
|
466
|
-
removeMapInstance:
|
|
471
|
+
addMapInstance: w,
|
|
472
|
+
removeMapInstance: y
|
|
467
473
|
} = e, {
|
|
468
|
-
mapId:
|
|
469
|
-
} = t,
|
|
470
|
-
let
|
|
471
|
-
if (l &&
|
|
474
|
+
mapId: M
|
|
475
|
+
} = t, k = `${M || "default"}:${g || "default"}:${C || "LIGHT"}`;
|
|
476
|
+
let S, L;
|
|
477
|
+
if (l && U.has(k) ? (L = U.pop(k), S = L.getDiv(), i.appendChild(S), L.setOptions(h), setTimeout(() => L.setCenter(L.getCenter()), 0)) : (S = document.createElement("div"), S.style.height = "100%", i.appendChild(S), L = new google.maps.Map(S, _({}, h, g ? {
|
|
472
478
|
renderingType: g
|
|
473
|
-
} : {},
|
|
474
|
-
colorScheme:
|
|
475
|
-
} : {}))), r(
|
|
479
|
+
} : {}, C ? {
|
|
480
|
+
colorScheme: C
|
|
481
|
+
} : {}))), r(L), w(L, c), u) {
|
|
476
482
|
const {
|
|
477
483
|
padding: T
|
|
478
|
-
} =
|
|
479
|
-
|
|
480
|
-
} else (!
|
|
484
|
+
} = u, F = D(u, Ge);
|
|
485
|
+
L.fitBounds(F, T);
|
|
486
|
+
} else (!I || !O) && L.fitBounds({
|
|
481
487
|
east: 180,
|
|
482
488
|
west: -180,
|
|
483
489
|
south: -90,
|
|
484
490
|
north: 90
|
|
485
491
|
});
|
|
486
|
-
if (
|
|
492
|
+
if (E.current) {
|
|
487
493
|
const {
|
|
488
494
|
mapId: T,
|
|
489
|
-
cameraState:
|
|
490
|
-
} =
|
|
491
|
-
T !==
|
|
495
|
+
cameraState: F
|
|
496
|
+
} = E.current;
|
|
497
|
+
T !== M && L.setOptions(F);
|
|
492
498
|
}
|
|
493
499
|
return () => {
|
|
494
|
-
|
|
495
|
-
mapId:
|
|
500
|
+
E.current = {
|
|
501
|
+
mapId: M,
|
|
496
502
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
497
503
|
cameraState: s.current
|
|
498
|
-
},
|
|
504
|
+
}, S.remove(), l ? U.push(k, L) : google.maps.event.clearInstanceListeners(L), r(null), y(c);
|
|
499
505
|
};
|
|
500
506
|
},
|
|
501
507
|
// some dependencies are ignored in the list below:
|
|
@@ -506,7 +512,7 @@ function Re(t, e) {
|
|
|
506
512
|
[
|
|
507
513
|
i,
|
|
508
514
|
n,
|
|
509
|
-
|
|
515
|
+
c,
|
|
510
516
|
// these props can't be changed after initialization and require a new
|
|
511
517
|
// instance to be created
|
|
512
518
|
t.mapId,
|
|
@@ -515,23 +521,23 @@ function Re(t, e) {
|
|
|
515
521
|
]
|
|
516
522
|
), [o, a, s];
|
|
517
523
|
}
|
|
518
|
-
const
|
|
524
|
+
const le = b.createContext(null), Ue = (t) => {
|
|
519
525
|
const {
|
|
520
526
|
children: e,
|
|
521
527
|
id: n,
|
|
522
528
|
className: o,
|
|
523
529
|
style: r
|
|
524
|
-
} = t, i =
|
|
530
|
+
} = t, i = R(G), a = ie();
|
|
525
531
|
if (!i)
|
|
526
532
|
throw new Error("<Map> can only be used inside an <ApiProvider> component.");
|
|
527
|
-
const [s,
|
|
528
|
-
|
|
529
|
-
const
|
|
530
|
-
|
|
533
|
+
const [s, c, u] = He(t, i);
|
|
534
|
+
De(s, u, t), we(s, t), xe(s, t);
|
|
535
|
+
const d = Ae(s, t), p = !!t.controlled;
|
|
536
|
+
v(() => {
|
|
531
537
|
if (s)
|
|
532
|
-
return
|
|
538
|
+
return d && s.setOptions({
|
|
533
539
|
disableDefaultUI: !0
|
|
534
|
-
}), (
|
|
540
|
+
}), (d || p) && s.setOptions({
|
|
535
541
|
gestureHandling: "none",
|
|
536
542
|
keyboardShortcuts: !1
|
|
537
543
|
}), () => {
|
|
@@ -540,180 +546,180 @@ const ae = C.createContext(null), Be = (t) => {
|
|
|
540
546
|
keyboardShortcuts: t.keyboardShortcuts
|
|
541
547
|
});
|
|
542
548
|
};
|
|
543
|
-
}, [s,
|
|
544
|
-
const f = t.center ?
|
|
549
|
+
}, [s, d, p, t.gestureHandling, t.keyboardShortcuts]);
|
|
550
|
+
const f = t.center ? ae(t.center) : null;
|
|
545
551
|
let m = null, l = null;
|
|
546
552
|
f && Number.isFinite(f.lat) && Number.isFinite(f.lng) && (m = f.lat, l = f.lng);
|
|
547
553
|
const g = P(() => {
|
|
548
|
-
var
|
|
554
|
+
var I, O, E, w, y;
|
|
549
555
|
return {
|
|
550
556
|
center: {
|
|
551
|
-
lat: (
|
|
552
|
-
lng: (
|
|
557
|
+
lat: (I = m) != null ? I : 0,
|
|
558
|
+
lng: (O = l) != null ? O : 0
|
|
553
559
|
},
|
|
554
|
-
zoom: (
|
|
555
|
-
heading: (
|
|
556
|
-
tilt: (
|
|
560
|
+
zoom: (E = t.zoom) != null ? E : 0,
|
|
561
|
+
heading: (w = t.heading) != null ? w : 0,
|
|
562
|
+
tilt: (y = t.tilt) != null ? y : 0
|
|
557
563
|
};
|
|
558
564
|
}, [m, l, t.zoom, t.heading, t.tilt]);
|
|
559
565
|
W(() => {
|
|
560
566
|
if (!s || !p) return;
|
|
561
567
|
s.moveCamera(g);
|
|
562
|
-
const
|
|
568
|
+
const I = s.addListener("bounds_changed", () => {
|
|
563
569
|
s.moveCamera(g);
|
|
564
570
|
});
|
|
565
|
-
return () =>
|
|
571
|
+
return () => I.remove();
|
|
566
572
|
}, [s, p, g]);
|
|
567
|
-
const
|
|
573
|
+
const C = P(() => _({
|
|
568
574
|
width: "100%",
|
|
569
575
|
height: "100%",
|
|
570
576
|
position: "relative",
|
|
571
577
|
// when using deckgl, the map should be sent to the back
|
|
572
|
-
zIndex:
|
|
573
|
-
}, r), [r,
|
|
578
|
+
zIndex: d ? -1 : 0
|
|
579
|
+
}, r), [r, d]), h = P(() => ({
|
|
574
580
|
map: s
|
|
575
581
|
}), [s]);
|
|
576
|
-
return a === x.AUTH_FAILURE ? /* @__PURE__ */
|
|
577
|
-
style:
|
|
582
|
+
return a === x.AUTH_FAILURE ? /* @__PURE__ */ b.createElement("div", {
|
|
583
|
+
style: _({
|
|
578
584
|
position: "relative"
|
|
579
|
-
}, o ? {} :
|
|
585
|
+
}, o ? {} : C),
|
|
580
586
|
className: o
|
|
581
|
-
}, /* @__PURE__ */
|
|
582
|
-
ref:
|
|
587
|
+
}, /* @__PURE__ */ b.createElement(Te, null)) : /* @__PURE__ */ b.createElement("div", _({
|
|
588
|
+
ref: c,
|
|
583
589
|
"data-testid": "map",
|
|
584
|
-
style: o ? void 0 :
|
|
590
|
+
style: o ? void 0 : C,
|
|
585
591
|
className: o
|
|
586
592
|
}, n ? {
|
|
587
593
|
id: n
|
|
588
|
-
} : {}), s ? /* @__PURE__ */
|
|
594
|
+
} : {}), s ? /* @__PURE__ */ b.createElement(le.Provider, {
|
|
589
595
|
value: h
|
|
590
596
|
}, e) : null);
|
|
591
597
|
};
|
|
592
|
-
|
|
593
|
-
const
|
|
594
|
-
function
|
|
598
|
+
Ue.deckGLViewProps = !0;
|
|
599
|
+
const J = /* @__PURE__ */ new Set();
|
|
600
|
+
function je(...t) {
|
|
595
601
|
const e = JSON.stringify(t);
|
|
596
|
-
|
|
602
|
+
J.has(e) || (J.add(e), console.error(...t));
|
|
597
603
|
}
|
|
598
|
-
const
|
|
599
|
-
const e =
|
|
604
|
+
const Z = (t = null) => {
|
|
605
|
+
const e = R(G), {
|
|
600
606
|
map: n
|
|
601
|
-
} =
|
|
607
|
+
} = R(le) || {};
|
|
602
608
|
if (e === null)
|
|
603
|
-
return
|
|
609
|
+
return je("useMap(): failed to retrieve APIProviderContext. Make sure that the <APIProvider> component exists and that the component you are calling `useMap()` from is a sibling of the <APIProvider>."), null;
|
|
604
610
|
const {
|
|
605
611
|
mapInstances: o
|
|
606
612
|
} = e;
|
|
607
613
|
return t !== null ? o[t] || null : n || o.default || null;
|
|
608
614
|
};
|
|
609
|
-
function
|
|
610
|
-
const e =
|
|
611
|
-
return
|
|
615
|
+
function ce(t) {
|
|
616
|
+
const e = se(), n = R(G);
|
|
617
|
+
return v(() => {
|
|
612
618
|
!e || !n || n.importLibrary(t);
|
|
613
619
|
}, [e, n, t]), (n == null ? void 0 : n.loadedLibraries[t]) || null;
|
|
614
620
|
}
|
|
615
|
-
function
|
|
616
|
-
|
|
621
|
+
function N(t, e, n) {
|
|
622
|
+
v(() => {
|
|
617
623
|
if (!t || !e || !n) return;
|
|
618
624
|
const o = google.maps.event.addListener(t, e, n);
|
|
619
625
|
return () => o.remove();
|
|
620
626
|
}, [t, e, n]);
|
|
621
627
|
}
|
|
622
|
-
function
|
|
623
|
-
|
|
628
|
+
function H(t, e, n) {
|
|
629
|
+
v(() => {
|
|
624
630
|
t && (t[e] = n);
|
|
625
631
|
}, [t, e, n]);
|
|
626
632
|
}
|
|
627
|
-
function
|
|
628
|
-
|
|
633
|
+
function V(t, e, n) {
|
|
634
|
+
v(() => {
|
|
629
635
|
if (!(!t || !e || !n))
|
|
630
636
|
return t.addEventListener(e, n), () => t.removeEventListener(e, n);
|
|
631
637
|
}, [t, e, n]);
|
|
632
638
|
}
|
|
633
|
-
function
|
|
639
|
+
function $e(t) {
|
|
634
640
|
return t.content !== void 0;
|
|
635
641
|
}
|
|
636
|
-
function
|
|
642
|
+
function K(t) {
|
|
637
643
|
return t.nodeType === Node.ELEMENT_NODE;
|
|
638
644
|
}
|
|
639
|
-
const
|
|
645
|
+
const We = b.createContext(null), Ze = {
|
|
640
646
|
BOTTOM: ["50%", "100%"]
|
|
641
|
-
},
|
|
647
|
+
}, qe = ({
|
|
642
648
|
children: t,
|
|
643
649
|
styles: e,
|
|
644
650
|
className: n,
|
|
645
651
|
anchorPoint: o
|
|
646
652
|
}) => {
|
|
647
|
-
const [r, i] = o ??
|
|
653
|
+
const [r, i] = o ?? Ze.BOTTOM;
|
|
648
654
|
let a = `-${r}`, s = `-${i}`;
|
|
649
655
|
r.trimStart().startsWith("-") && (a = r.substring(1)), i.trimStart().startsWith("-") && (s = i.substring(1));
|
|
650
|
-
const
|
|
656
|
+
const c = `translate(50%, 100%) translate(${a}, ${s})`;
|
|
651
657
|
return (
|
|
652
658
|
// anchoring container
|
|
653
|
-
/* @__PURE__ */
|
|
659
|
+
/* @__PURE__ */ b.createElement("div", {
|
|
654
660
|
style: {
|
|
655
|
-
transform:
|
|
661
|
+
transform: c
|
|
656
662
|
}
|
|
657
|
-
}, /* @__PURE__ */
|
|
663
|
+
}, /* @__PURE__ */ b.createElement("div", {
|
|
658
664
|
className: n,
|
|
659
665
|
style: e
|
|
660
666
|
}, t))
|
|
661
667
|
);
|
|
662
668
|
};
|
|
663
|
-
function
|
|
664
|
-
const [e, n] = A(null), [o, r] = A(null), i =
|
|
669
|
+
function Je(t) {
|
|
670
|
+
const [e, n] = A(null), [o, r] = A(null), i = Z(), a = ce("marker"), {
|
|
665
671
|
children: s,
|
|
666
|
-
onClick:
|
|
667
|
-
className:
|
|
668
|
-
onMouseEnter:
|
|
672
|
+
onClick: c,
|
|
673
|
+
className: u,
|
|
674
|
+
onMouseEnter: d,
|
|
669
675
|
onMouseLeave: p,
|
|
670
676
|
onDrag: f,
|
|
671
677
|
onDragStart: m,
|
|
672
678
|
onDragEnd: l,
|
|
673
679
|
collisionBehavior: g,
|
|
674
|
-
clickable:
|
|
680
|
+
clickable: C,
|
|
675
681
|
draggable: h,
|
|
676
|
-
position:
|
|
677
|
-
title:
|
|
678
|
-
zIndex:
|
|
679
|
-
} = t,
|
|
680
|
-
return
|
|
682
|
+
position: I,
|
|
683
|
+
title: O,
|
|
684
|
+
zIndex: E
|
|
685
|
+
} = t, w = ue.count(s);
|
|
686
|
+
return v(() => {
|
|
681
687
|
if (!i || !a) return;
|
|
682
|
-
const
|
|
683
|
-
|
|
684
|
-
let
|
|
685
|
-
return
|
|
686
|
-
var
|
|
687
|
-
|
|
688
|
+
const y = new a.AdvancedMarkerElement();
|
|
689
|
+
y.map = i, n(y);
|
|
690
|
+
let M = null;
|
|
691
|
+
return w > 0 && (M = document.createElement("div"), M.isCustomMarker = !0, y.content = M, r(M)), () => {
|
|
692
|
+
var k;
|
|
693
|
+
y.map = null, (k = M) == null || k.remove(), n(null), r(null);
|
|
688
694
|
};
|
|
689
|
-
}, [i, a,
|
|
690
|
-
!e || !e.content ||
|
|
691
|
-
}, [e,
|
|
695
|
+
}, [i, a, w]), v(() => {
|
|
696
|
+
!(e != null && e.content) || !K(e.content) || w > 0 || (e.content.className = u ?? "");
|
|
697
|
+
}, [e, u, w]), H(e, "position", I), H(e, "title", O ?? ""), H(e, "zIndex", E), H(e, "collisionBehavior", g), v(() => {
|
|
692
698
|
e && (h !== void 0 ? e.gmpDraggable = h : f || m || l ? e.gmpDraggable = !0 : e.gmpDraggable = !1);
|
|
693
|
-
}, [e, h, f, l, m]),
|
|
699
|
+
}, [e, h, f, l, m]), v(() => {
|
|
694
700
|
if (!e) return;
|
|
695
|
-
const
|
|
696
|
-
e.gmpClickable =
|
|
697
|
-
}, [e,
|
|
701
|
+
const y = C !== void 0 || !!c || !!d || !!p;
|
|
702
|
+
e.gmpClickable = y, y && e != null && e.content && K(e.content) && (e.content.style.pointerEvents = "none", e.content.firstElementChild && (e.content.firstElementChild.style.pointerEvents = "all"));
|
|
703
|
+
}, [e, C, c, d, p]), N(e, "click", c), N(e, "drag", f), N(e, "dragstart", m), N(e, "dragend", l), V(e == null ? void 0 : e.element, "mouseenter", d), V(e == null ? void 0 : e.element, "mouseleave", p), [e, o];
|
|
698
704
|
}
|
|
699
|
-
const
|
|
705
|
+
const it = Y((t, e) => {
|
|
700
706
|
const {
|
|
701
707
|
children: n,
|
|
702
708
|
style: o,
|
|
703
709
|
className: r,
|
|
704
710
|
anchorPoint: i
|
|
705
|
-
} = t, [a, s] =
|
|
711
|
+
} = t, [a, s] = Je(t), c = P(() => a ? {
|
|
706
712
|
marker: a
|
|
707
713
|
} : null, [a]);
|
|
708
|
-
return Q(e, () => a, [a]), s ? /* @__PURE__ */
|
|
709
|
-
value:
|
|
710
|
-
}, $(/* @__PURE__ */
|
|
714
|
+
return Q(e, () => a, [a]), s ? /* @__PURE__ */ b.createElement(We.Provider, {
|
|
715
|
+
value: c
|
|
716
|
+
}, $(/* @__PURE__ */ b.createElement(qe, {
|
|
711
717
|
anchorPoint: i,
|
|
712
718
|
styles: o,
|
|
713
719
|
className: r
|
|
714
720
|
}, n), s)) : null;
|
|
715
721
|
});
|
|
716
|
-
function
|
|
722
|
+
function Ve(t, e, n) {
|
|
717
723
|
if (e != null && typeof e != "object")
|
|
718
724
|
throw new Error("The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.");
|
|
719
725
|
const o = t.style;
|
|
@@ -733,9 +739,9 @@ function qe(t, e, n) {
|
|
|
733
739
|
}
|
|
734
740
|
function X(t, e, n) {
|
|
735
741
|
const o = e.indexOf("--") === 0;
|
|
736
|
-
n == null || typeof n == "boolean" || n === "" ? o ? t.setProperty(e, "") : e === "float" ? t.cssFloat = "" : t[e] = "" : o ? t.setProperty(e, n) : typeof n == "number" && n !== 0 && !
|
|
742
|
+
n == null || typeof n == "boolean" || n === "" ? o ? t.setProperty(e, "") : e === "float" ? t.cssFloat = "" : t[e] = "" : o ? t.setProperty(e, n) : typeof n == "number" && n !== 0 && !Xe(e) ? t[e] = n + "px" : e === "float" ? t.cssFloat = n : t[e] = ("" + n).trim();
|
|
737
743
|
}
|
|
738
|
-
const
|
|
744
|
+
const Ke = /* @__PURE__ */ new Set([
|
|
739
745
|
"animationIterationCount",
|
|
740
746
|
"aspectRatio",
|
|
741
747
|
"borderImageOutset",
|
|
@@ -782,10 +788,10 @@ const Je = /* @__PURE__ */ new Set([
|
|
|
782
788
|
"strokeOpacity",
|
|
783
789
|
"strokeWidth"
|
|
784
790
|
]);
|
|
785
|
-
function
|
|
786
|
-
return
|
|
791
|
+
function Xe(t) {
|
|
792
|
+
return Ke.has(t);
|
|
787
793
|
}
|
|
788
|
-
const
|
|
794
|
+
const Ye = ["children", "headerContent", "style", "className", "pixelOffset", "anchor", "shouldFocus", "onClose", "onCloseClick"], at = (t) => {
|
|
789
795
|
const {
|
|
790
796
|
// content options
|
|
791
797
|
children: e,
|
|
@@ -797,20 +803,20 @@ const Ke = ["children", "headerContent", "style", "className", "pixelOffset", "a
|
|
|
797
803
|
anchor: a,
|
|
798
804
|
shouldFocus: s,
|
|
799
805
|
// events
|
|
800
|
-
onClose:
|
|
801
|
-
onCloseClick:
|
|
806
|
+
onClose: c,
|
|
807
|
+
onCloseClick: u
|
|
802
808
|
// other options
|
|
803
|
-
} = t,
|
|
804
|
-
|
|
809
|
+
} = t, d = D(t, Ye), p = ce("maps"), [f, m] = A(null), l = z(null), g = z(null), C = re(d, ne);
|
|
810
|
+
v(
|
|
805
811
|
() => {
|
|
806
812
|
if (!p) return;
|
|
807
813
|
l.current = document.createElement("div"), g.current = document.createElement("div");
|
|
808
|
-
const
|
|
809
|
-
i && (
|
|
810
|
-
const
|
|
811
|
-
return
|
|
812
|
-
var
|
|
813
|
-
|
|
814
|
+
const O = C;
|
|
815
|
+
i && (O.pixelOffset = new google.maps.Size(i[0], i[1])), n && (O.headerContent = typeof n == "string" ? n : g.current);
|
|
816
|
+
const E = new google.maps.InfoWindow(C);
|
|
817
|
+
return E.setContent(l.current), m(E), () => {
|
|
818
|
+
var w, y;
|
|
819
|
+
E.setContent(null), (w = l.current) == null || w.remove(), (y = g.current) == null || y.remove(), l.current = null, g.current = null, m(null);
|
|
814
820
|
};
|
|
815
821
|
},
|
|
816
822
|
// `infoWindowOptions` and other props are missing from dependencies:
|
|
@@ -822,87 +828,87 @@ const Ke = ["children", "headerContent", "style", "className", "pixelOffset", "a
|
|
|
822
828
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
823
829
|
[p]
|
|
824
830
|
);
|
|
825
|
-
const
|
|
826
|
-
|
|
827
|
-
!f || !l.current || (
|
|
828
|
-
}, [f, r, o]),
|
|
831
|
+
const h = z(null);
|
|
832
|
+
v(() => {
|
|
833
|
+
!f || !l.current || (Ve(l.current, o || null, h.current), h.current = o || null, r !== l.current.className && (l.current.className = r || ""));
|
|
834
|
+
}, [f, r, o]), v(
|
|
829
835
|
() => {
|
|
830
836
|
if (!f) return;
|
|
831
|
-
const
|
|
832
|
-
i ?
|
|
837
|
+
const O = C;
|
|
838
|
+
i ? O.pixelOffset = new google.maps.Size(i[0], i[1]) : O.pixelOffset = null, n ? O.headerContent = typeof n == "string" ? n : g.current : O.headerContent = null, f.setOptions(C);
|
|
833
839
|
},
|
|
834
840
|
// dependency `infoWindow` isn't needed since options are also passed
|
|
835
841
|
// to the constructor when a new infoWindow is created.
|
|
836
842
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
837
|
-
[
|
|
838
|
-
),
|
|
839
|
-
const
|
|
840
|
-
return
|
|
841
|
-
if (!
|
|
842
|
-
const
|
|
843
|
-
map:
|
|
843
|
+
[C, i, n]
|
|
844
|
+
), N(f, "close", c), N(f, "closeclick", u);
|
|
845
|
+
const I = Z();
|
|
846
|
+
return v(() => {
|
|
847
|
+
if (!I || !f || a === null) return;
|
|
848
|
+
const O = !!a, E = {
|
|
849
|
+
map: I
|
|
844
850
|
};
|
|
845
|
-
if (a && (
|
|
846
|
-
const
|
|
847
|
-
if (
|
|
848
|
-
var
|
|
849
|
-
const
|
|
850
|
-
|
|
851
|
+
if (a && (E.anchor = a, $e(a) && a.content instanceof Element)) {
|
|
852
|
+
const y = a.content, M = y == null ? void 0 : y.getBoundingClientRect();
|
|
853
|
+
if (M && y != null && y.isCustomMarker) {
|
|
854
|
+
var w;
|
|
855
|
+
const k = (w = a.content.firstElementChild) == null ? void 0 : w.firstElementChild, S = k == null ? void 0 : k.getBoundingClientRect(), L = S.x - M.x + (S.width - M.width) / 2, T = S.y - M.y, F = C;
|
|
856
|
+
F.pixelOffset = new google.maps.Size(i ? i[0] + L : L, i ? i[1] + T : T), f.setOptions(F);
|
|
851
857
|
}
|
|
852
858
|
}
|
|
853
|
-
return s !== void 0 && (
|
|
854
|
-
|
|
859
|
+
return s !== void 0 && (E.shouldFocus = s), f.open(E), () => {
|
|
860
|
+
O && f.set("anchor", null), f.close();
|
|
855
861
|
};
|
|
856
|
-
}, [f, a,
|
|
857
|
-
},
|
|
862
|
+
}, [f, a, I, s, C, i]), /* @__PURE__ */ b.createElement(b.Fragment, null, l.current && $(e, l.current), g.current !== null && $(n, g.current));
|
|
863
|
+
}, st = {
|
|
858
864
|
LEFT_TOP: 5,
|
|
859
865
|
LEFT_BOTTOM: 6,
|
|
860
866
|
RIGHT_TOP: 7,
|
|
861
867
|
RIGHT_BOTTOM: 9
|
|
862
|
-
},
|
|
863
|
-
function
|
|
864
|
-
const [e, n] = A(null), o =
|
|
868
|
+
}, Qe = ["onClick", "onDrag", "onDragStart", "onDragEnd", "onMouseOver", "onMouseOut"];
|
|
869
|
+
function et(t) {
|
|
870
|
+
const [e, n] = A(null), o = Z(), {
|
|
865
871
|
onClick: r,
|
|
866
872
|
onDrag: i,
|
|
867
873
|
onDragStart: a,
|
|
868
874
|
onDragEnd: s,
|
|
869
|
-
onMouseOver:
|
|
870
|
-
onMouseOut:
|
|
871
|
-
} = t,
|
|
875
|
+
onMouseOver: c,
|
|
876
|
+
onMouseOut: u
|
|
877
|
+
} = t, d = D(t, Qe), {
|
|
872
878
|
position: p,
|
|
873
879
|
draggable: f
|
|
874
|
-
} =
|
|
875
|
-
return
|
|
880
|
+
} = d;
|
|
881
|
+
return v(() => {
|
|
876
882
|
if (!o) {
|
|
877
883
|
o === void 0 && console.error("<Marker> has to be inside a Map component.");
|
|
878
884
|
return;
|
|
879
885
|
}
|
|
880
|
-
const m = new google.maps.Marker(
|
|
886
|
+
const m = new google.maps.Marker(d);
|
|
881
887
|
return m.setMap(o), n(m), () => {
|
|
882
888
|
m.setMap(null), n(null);
|
|
883
889
|
};
|
|
884
|
-
}, [o]),
|
|
890
|
+
}, [o]), v(() => {
|
|
885
891
|
if (!e) return;
|
|
886
892
|
const m = e, l = google.maps.event;
|
|
887
|
-
return r && l.addListener(m, "click", r), i && l.addListener(m, "drag", i), a && l.addListener(m, "dragstart", a), s && l.addListener(m, "dragend", s),
|
|
893
|
+
return r && l.addListener(m, "click", r), i && l.addListener(m, "drag", i), a && l.addListener(m, "dragstart", a), s && l.addListener(m, "dragend", s), c && l.addListener(m, "mouseover", c), u && l.addListener(m, "mouseout", u), e.setDraggable(!!f), () => {
|
|
888
894
|
l.clearInstanceListeners(m);
|
|
889
895
|
};
|
|
890
|
-
}, [e, f, r, i, a, s,
|
|
891
|
-
e &&
|
|
892
|
-
}, [e,
|
|
896
|
+
}, [e, f, r, i, a, s, c, u]), v(() => {
|
|
897
|
+
e && d && e.setOptions(d);
|
|
898
|
+
}, [e, d]), v(() => {
|
|
893
899
|
f || !p || !e || e.setPosition(p);
|
|
894
900
|
}, [f, p, e]), e;
|
|
895
901
|
}
|
|
896
902
|
Y((t, e) => {
|
|
897
|
-
const n =
|
|
898
|
-
return Q(e, () => n, [n]), /* @__PURE__ */
|
|
903
|
+
const n = et(t);
|
|
904
|
+
return Q(e, () => n, [n]), /* @__PURE__ */ b.createElement(b.Fragment, null);
|
|
899
905
|
});
|
|
900
906
|
export {
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
907
|
+
rt as A,
|
|
908
|
+
st as C,
|
|
909
|
+
le as G,
|
|
910
|
+
at as I,
|
|
911
|
+
Ue as M,
|
|
912
|
+
it as a,
|
|
913
|
+
Z as u
|
|
908
914
|
};
|