@local-logic/maps 0.0.23 → 0.0.24
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-BOZt1-DO.js +69 -0
- package/dist/{index-BrxP9NHZ.js → index-Buv9_Jj9.js} +3 -3
- package/dist/index-C3Tj3r2u.js +24 -0
- package/dist/index-C6a0FCIX.js +92 -0
- package/dist/index-CCS3Ef2w.js +92 -0
- package/dist/{index-CSVsF1EQ.js → index-CEDpofgZ.js} +1 -1
- package/dist/{index-BRD3rjLE.js → index-CIE9YlvM.js} +12 -12
- package/dist/index-CUUravWc.js +25 -0
- package/dist/index-CUvZ7gVt.js +98 -0
- package/dist/{index-CN_dNOir.js → index-Ct-3yYUx.js} +245 -217
- package/dist/index-DJx0avMT.js +75 -0
- package/dist/{index-B85VZGVP.js → index-DOkeQ2e4.js} +3 -3
- package/dist/{index-ufLC1PLO.js → index-DbyYOXrb.js} +16 -16
- package/dist/index-DntG4mBo.js +75 -0
- package/dist/{index-CFomI3Il.js → index-DscDx7HE.js} +14 -13
- package/dist/{index-DfhwDiOS.js → index-GGtrKiJn.js} +22 -22
- package/dist/index-Y5T20C1G.js +92 -0
- package/dist/{index-CiWKwaC4.js → index-eWv3le07.js} +7 -6
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +8 -3615
- package/dist/{logo-control-VgN6MEKI.js → logo-control-CHapR1Dt.js} +11 -11
- package/dist/{scale-control-jBKptTbw.js → scale-control-Dsir9fWY.js} +21 -21
- package/dist/src/components/Map/Root/BaseMap/Google/index.d.ts +1 -1
- package/dist/src/components/Map/Root/BaseMap/Google/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/BaseMap/Mapbox/index.d.ts +1 -1
- package/dist/src/components/Map/Root/BaseMap/Mapbox/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/BaseMap/Maptiler/index.d.ts +1 -1
- package/dist/src/components/Map/Root/BaseMap/Maptiler/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/BaseMap/index.d.ts +1 -1
- package/dist/src/components/Map/Root/BaseMap/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/BaseMap/types.d.ts +1 -10
- package/dist/src/components/Map/Root/BaseMap/types.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Markers/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Popup/Google/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Popup/Mapbox/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Popup/Maptiler/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Popup/utils/index.d.ts +2 -0
- package/dist/src/components/Map/Root/Popup/utils/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Popup/utils/moveIntoView/index.d.ts +21 -0
- package/dist/src/components/Map/Root/Popup/utils/moveIntoView/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/constants.d.ts +11 -2
- package/dist/src/components/Map/Root/constants.d.ts.map +1 -1
- package/dist/src/components/Map/Root/context.d.ts +6 -6
- package/dist/src/components/Map/Root/context.d.ts.map +1 -1
- package/dist/src/components/Map/Root/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/types.d.ts +9 -0
- package/dist/src/components/Map/Root/types.d.ts.map +1 -1
- package/dist/src/components/Map/index.stories.d.ts +9 -3
- package/dist/src/components/Map/index.stories.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/styles-BNaT0cTi.js +36 -0
- package/dist/{styles-BR85tnqI.js → styles-BhmqUA5C.js} +231 -266
- package/package.json +30 -10
- package/dist/IconBase.es-rM5tt24D.js +0 -48
- package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
- package/dist/index-BpFpg_5A.js +0 -78
- package/dist/index-CRdDPWou.js +0 -34
- package/dist/index-CceEGv05.js +0 -104
- package/dist/index-CmajMf1d.js +0 -109
- package/dist/index-D5kHxP9H.js +0 -43
- package/dist/index-DNNz78Rc.js +0 -24
- package/dist/index-Db33Ugg9.js +0 -34
- package/dist/index-arkRlpaR.js +0 -80
- package/dist/index-vHMPqmOL.js +0 -23
- package/dist/index.modern-B-ChKejQ.js +0 -914
- package/dist/mapbox-gl-C6frO4Gl.js +0 -34625
- package/dist/maplibre-gl-DkDrZ6rP.js +0 -21669
- package/dist/styles-ChFj97uV.js +0 -7
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsxs as x, jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { useState as B, useRef as k, useCallback as y, useEffect as c } from "react";
|
|
3
|
+
import { M as E, N as L, u as P } from "./logo-control-CHapR1Dt.js";
|
|
4
|
+
import { u as v, D as p, a as h, m as Z } from "./index-Ct-3yYUx.js";
|
|
5
|
+
import { t as _ } from "./index-DscDx7HE.js";
|
|
6
|
+
const b = () => {
|
|
7
|
+
const { current: e } = P(), { markerPoints: o, setZoom: s, mapPadding: m } = v(), [a, f] = B(void 0), i = k(void 0), n = y(() => {
|
|
8
|
+
e && s(e.getZoom());
|
|
9
|
+
}, [e, s]);
|
|
10
|
+
return c(() => (n(), e?.on("zoom", n), () => {
|
|
11
|
+
e?.off("zoom", n);
|
|
12
|
+
}), [e, n]), c(() => {
|
|
13
|
+
if (!e || typeof o > "u" || o.length === 0)
|
|
14
|
+
return;
|
|
15
|
+
const t = _(Z(o));
|
|
16
|
+
(!i.current || !t.every((r, u) => r === i.current?.[u])) && (i.current = t, f(t));
|
|
17
|
+
}, [e, o]), c(() => {
|
|
18
|
+
if (!e || typeof a > "u")
|
|
19
|
+
return;
|
|
20
|
+
const [t, r, u, l] = a, d = (u - t) * 0.05 || 1e-3, M = (l - r) * 0.05 || 1e-3;
|
|
21
|
+
e.fitBounds(
|
|
22
|
+
[
|
|
23
|
+
[t - d, r - M],
|
|
24
|
+
[u + d, l + M]
|
|
25
|
+
],
|
|
26
|
+
{
|
|
27
|
+
padding: m,
|
|
28
|
+
maxZoom: 17,
|
|
29
|
+
duration: 700
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}, [e, a, m]), null;
|
|
33
|
+
};
|
|
34
|
+
function D({ children: e }) {
|
|
35
|
+
const {
|
|
36
|
+
mapProvider: o,
|
|
37
|
+
center: s,
|
|
38
|
+
zoom: m = p.zoom,
|
|
39
|
+
minZoom: a,
|
|
40
|
+
maxZoom: f,
|
|
41
|
+
pitch: i = p.pitch,
|
|
42
|
+
bearing: n = p.bearing,
|
|
43
|
+
cooperativeGestures: t = p.cooperativeGestures,
|
|
44
|
+
zoomPosition: r
|
|
45
|
+
} = v();
|
|
46
|
+
return o.name !== "maptiler" ? null : /* @__PURE__ */ x(
|
|
47
|
+
E,
|
|
48
|
+
{
|
|
49
|
+
initialViewState: {
|
|
50
|
+
...s,
|
|
51
|
+
zoom: m,
|
|
52
|
+
pitch: i,
|
|
53
|
+
bearing: n
|
|
54
|
+
},
|
|
55
|
+
cooperativeGestures: t,
|
|
56
|
+
minZoom: a,
|
|
57
|
+
maxZoom: f,
|
|
58
|
+
mapStyle: `https://api.maptiler.com/maps/${o.theme || h.maptiler}/style.json?key=${o.apiKey}`,
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ g(b, {}),
|
|
61
|
+
r && /* @__PURE__ */ g(L, { position: r }),
|
|
62
|
+
e
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
D as default
|
|
69
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as f, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { a as k } from "./logo-control-
|
|
2
|
+
import { a as k } from "./logo-control-CHapR1Dt.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { u, M } from "./index-
|
|
5
|
-
import { C as g, c as C, M as v } from "./index-
|
|
4
|
+
import { u, M } from "./index-Ct-3yYUx.js";
|
|
5
|
+
import { C as g, c as C, M as v } from "./index-DntG4mBo.js";
|
|
6
6
|
function x({
|
|
7
7
|
clusters: n,
|
|
8
8
|
colors: o,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsxs as n, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { t as o, b as a, S as r, i as s, c } from "./styles-BhmqUA5C.js";
|
|
3
|
+
import { a as d } from "./logo-control-CHapR1Dt.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { HouseLineIcon as l } from "@phosphor-icons/react";
|
|
6
|
+
function b({ marker: t, className: e }) {
|
|
7
|
+
return /* @__PURE__ */ n(
|
|
8
|
+
d,
|
|
9
|
+
{
|
|
10
|
+
anchor: "bottom",
|
|
11
|
+
longitude: t.longitude,
|
|
12
|
+
latitude: t.latitude,
|
|
13
|
+
className: o(c.trim(), e),
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ i("span", { id: "center-pin-background", className: a, children: /* @__PURE__ */ i(r, {}) }),
|
|
16
|
+
/* @__PURE__ */ i(l, { id: "center-pin-icon", className: s })
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
`center-pin-marker-${t.longitude}-${t.latitude}`
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
b as default
|
|
24
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsx as E } from "react/jsx-runtime";
|
|
2
|
+
import { useState as L, useRef as M, useCallback as N, useEffect as f, useMemo as W } from "react";
|
|
3
|
+
import { useMap as _, InfoWindow as x } from "@vis.gl/react-google-maps";
|
|
4
|
+
import { u as z, P as y } from "./index-Ct-3yYUx.js";
|
|
5
|
+
import { c as H, m as j } from "./styles-BNaT0cTi.js";
|
|
6
|
+
function Z({
|
|
7
|
+
latitude: g,
|
|
8
|
+
longitude: m,
|
|
9
|
+
offset: r = [0, -25],
|
|
10
|
+
onClose: d,
|
|
11
|
+
children: C
|
|
12
|
+
}) {
|
|
13
|
+
const [i, S] = L(null), e = _(), { mapPadding: s, activeMarker: n, clusterPoints: a } = z(), v = M(a), w = M(n), T = N((t) => {
|
|
14
|
+
S(t);
|
|
15
|
+
}, []);
|
|
16
|
+
f(() => {
|
|
17
|
+
const t = v.current !== a, l = w.current === n;
|
|
18
|
+
t && l && typeof n < "u" && d?.(), v.current = a, w.current = n;
|
|
19
|
+
}, [a, n, d]), f(() => {
|
|
20
|
+
let t = { width: 0, height: 0 };
|
|
21
|
+
const l = () => {
|
|
22
|
+
if (!e || !i || typeof n > "u")
|
|
23
|
+
return;
|
|
24
|
+
const c = e.getBounds(), h = e.getCenter(), p = e.getDiv(), o = i?.getBoundingClientRect();
|
|
25
|
+
if (!c || !h || !o)
|
|
26
|
+
return;
|
|
27
|
+
const I = Math.abs(o.width - t.width), O = Math.abs(o.height - t.height);
|
|
28
|
+
if (t.width !== 0 && I < y && O < y)
|
|
29
|
+
return;
|
|
30
|
+
t = { width: o.width, height: o.height };
|
|
31
|
+
const b = p.getBoundingClientRect(), A = {
|
|
32
|
+
width: p.clientWidth,
|
|
33
|
+
height: p.clientHeight,
|
|
34
|
+
top: b.top,
|
|
35
|
+
left: b.left
|
|
36
|
+
}, B = {
|
|
37
|
+
latitude: h.lat(),
|
|
38
|
+
longitude: h.lng()
|
|
39
|
+
}, D = {
|
|
40
|
+
left: c.getSouthWest().lng(),
|
|
41
|
+
right: c.getNorthEast().lng(),
|
|
42
|
+
top: c.getNorthEast().lat(),
|
|
43
|
+
bottom: c.getSouthWest().lat()
|
|
44
|
+
};
|
|
45
|
+
j(o, B, D, A, s, (P) => {
|
|
46
|
+
e.panTo(new google.maps.LatLng(P.latitude, P.longitude));
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
let u;
|
|
50
|
+
const R = new ResizeObserver(() => {
|
|
51
|
+
u && clearTimeout(u), u = window.setTimeout(() => {
|
|
52
|
+
l();
|
|
53
|
+
}, 100);
|
|
54
|
+
});
|
|
55
|
+
return i && R.observe(i), () => {
|
|
56
|
+
u && clearTimeout(u), R.disconnect();
|
|
57
|
+
};
|
|
58
|
+
}, [
|
|
59
|
+
e,
|
|
60
|
+
i,
|
|
61
|
+
n,
|
|
62
|
+
s.top,
|
|
63
|
+
s.bottom,
|
|
64
|
+
s.left,
|
|
65
|
+
s.right
|
|
66
|
+
]), f(() => {
|
|
67
|
+
if (!e) return;
|
|
68
|
+
const t = e.addListener("click", () => {
|
|
69
|
+
d?.();
|
|
70
|
+
});
|
|
71
|
+
return () => {
|
|
72
|
+
t.remove();
|
|
73
|
+
};
|
|
74
|
+
}, [e]);
|
|
75
|
+
const k = W(() => Array.isArray(r) ? [r[0], r[1]] : [r, r], [r]);
|
|
76
|
+
return typeof g > "u" || typeof m > "u" ? null : /* @__PURE__ */ E(
|
|
77
|
+
x,
|
|
78
|
+
{
|
|
79
|
+
shouldFocus: !0,
|
|
80
|
+
disableAutoPan: !0,
|
|
81
|
+
position: {
|
|
82
|
+
lat: g,
|
|
83
|
+
lng: m
|
|
84
|
+
},
|
|
85
|
+
pixelOffset: k,
|
|
86
|
+
children: /* @__PURE__ */ E("div", { ref: T, className: H, children: C })
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
Z as default
|
|
92
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsx as E } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as d, useEffect as M } from "react";
|
|
3
|
+
import { u as D, P as H } from "./logo-control-CHapR1Dt.js";
|
|
4
|
+
import { u as j, P as T } from "./index-Ct-3yYUx.js";
|
|
5
|
+
import { c as x, m as A } from "./styles-BNaT0cTi.js";
|
|
6
|
+
function Z({
|
|
7
|
+
latitude: l,
|
|
8
|
+
longitude: h,
|
|
9
|
+
anchor: B,
|
|
10
|
+
offset: C = [0, -35],
|
|
11
|
+
onClose: a,
|
|
12
|
+
children: O
|
|
13
|
+
}) {
|
|
14
|
+
const p = d(null), { current: n } = D(), { activeMarker: e, clusterPoints: u, mapPadding: t } = j(), m = d(u), g = d(e);
|
|
15
|
+
return M(() => {
|
|
16
|
+
const i = m.current !== u, o = g.current === e;
|
|
17
|
+
i && o && typeof e < "u" && a?.(), m.current = u, g.current = e;
|
|
18
|
+
}, [u, e, a]), M(() => {
|
|
19
|
+
const i = p?.current;
|
|
20
|
+
let o = { width: 0, height: 0 };
|
|
21
|
+
const y = () => {
|
|
22
|
+
if (!n || !i || typeof e > "u")
|
|
23
|
+
return;
|
|
24
|
+
const c = n.getBounds(), P = n.getCenter(), f = n.getCanvas(), r = i.getElement()?.getBoundingClientRect();
|
|
25
|
+
if (!c || !r)
|
|
26
|
+
return;
|
|
27
|
+
const I = Math.abs(r.width - o.width), N = Math.abs(r.height - o.height);
|
|
28
|
+
if (o.width !== 0 && I < T && N < T)
|
|
29
|
+
return;
|
|
30
|
+
o = { width: r.width, height: r.height };
|
|
31
|
+
const R = f.getBoundingClientRect(), S = {
|
|
32
|
+
width: f.clientWidth,
|
|
33
|
+
height: f.clientHeight,
|
|
34
|
+
top: R.top,
|
|
35
|
+
left: R.left
|
|
36
|
+
}, _ = {
|
|
37
|
+
latitude: P.lat,
|
|
38
|
+
longitude: P.lng
|
|
39
|
+
}, k = {
|
|
40
|
+
left: c.getWest(),
|
|
41
|
+
right: c.getEast(),
|
|
42
|
+
top: c.getNorth(),
|
|
43
|
+
bottom: c.getSouth()
|
|
44
|
+
}, z = {
|
|
45
|
+
left: t.left || 0,
|
|
46
|
+
right: t.right || 0,
|
|
47
|
+
top: t.top || 0,
|
|
48
|
+
bottom: t.bottom || 0
|
|
49
|
+
};
|
|
50
|
+
A(r, _, k, S, z, (w) => {
|
|
51
|
+
n.easeTo({
|
|
52
|
+
center: [w.longitude, w.latitude],
|
|
53
|
+
duration: 500
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
let s;
|
|
58
|
+
const v = new ResizeObserver(() => {
|
|
59
|
+
s && clearTimeout(s), s = window.setTimeout(() => {
|
|
60
|
+
y();
|
|
61
|
+
}, 100);
|
|
62
|
+
}), b = i?.getElement();
|
|
63
|
+
return b && v.observe(b), () => {
|
|
64
|
+
s && clearTimeout(s), v.disconnect();
|
|
65
|
+
};
|
|
66
|
+
}, [
|
|
67
|
+
n,
|
|
68
|
+
p,
|
|
69
|
+
e,
|
|
70
|
+
t.top,
|
|
71
|
+
t.bottom,
|
|
72
|
+
t.left,
|
|
73
|
+
t.right
|
|
74
|
+
]), typeof l > "u" || typeof h > "u" ? null : /* @__PURE__ */ E(
|
|
75
|
+
H,
|
|
76
|
+
{
|
|
77
|
+
ref: p,
|
|
78
|
+
className: "maplibre-popup",
|
|
79
|
+
focusAfterOpen: !0,
|
|
80
|
+
latitude: l,
|
|
81
|
+
longitude: h,
|
|
82
|
+
anchor: B,
|
|
83
|
+
offset: C,
|
|
84
|
+
onClose: a,
|
|
85
|
+
closeButton: !1,
|
|
86
|
+
children: /* @__PURE__ */ E("div", { className: x, children: O })
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
Z as default
|
|
92
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as P, Fragment as u } from "react/jsx-runtime";
|
|
2
2
|
import { useState as y, useContext as M, useEffect as g } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { GoogleMapsContext as L } from "@vis.gl/react-google-maps";
|
|
4
4
|
import { a as s } from "./utils-DJ13veBM.js";
|
|
5
5
|
function f(o, e, r) {
|
|
6
6
|
switch (o) {
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { jsx as c, Fragment as b } from "react/jsx-runtime";
|
|
2
2
|
import * as $ from "react";
|
|
3
3
|
import { useContext as S, useRef as k, useState as C, useMemo as g, useEffect as w, cloneElement as j } from "react";
|
|
4
|
-
import { b as x, d as u } from "./scale-control-
|
|
4
|
+
import { b as x, d as u } from "./scale-control-Dsir9fWY.js";
|
|
5
5
|
import { g as I } from "./utils-DJ13veBM.js";
|
|
6
6
|
function s(t, e) {
|
|
7
7
|
if (!t)
|
|
8
8
|
throw new Error(e);
|
|
9
9
|
}
|
|
10
10
|
let M = 0;
|
|
11
|
-
function
|
|
11
|
+
function R(t, e, n) {
|
|
12
12
|
if (t.style && t.style._loaded) {
|
|
13
13
|
const a = { ...n };
|
|
14
14
|
return delete a.id, delete a.children, t.addSource(e, a), t.getSource(e);
|
|
15
15
|
}
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function U(t, e, n) {
|
|
19
19
|
s(e.id === n.id, "source id changed"), s(e.type === n.type, "source type changed");
|
|
20
20
|
let a = "", i = 0;
|
|
21
21
|
for (const o in e)
|
|
@@ -28,7 +28,7 @@ function z(t, e, n) {
|
|
|
28
28
|
coordinates: e.coordinates
|
|
29
29
|
}) : "setCoordinates" in t && i === 1 && a === "coordinates" ? t.setCoordinates(e.coordinates) : "setUrl" in t && a === "url" ? t.setUrl(e.url) : "setTiles" in t && a === "tiles" ? t.setTiles(e.tiles) : console.warn(`Unable to update <Source> prop: ${a}`);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function z(t) {
|
|
32
32
|
const e = S(x).map.getMap(), n = k(t), [, a] = C(0), i = g(() => t.id || `jsx-source-${M++}`, []);
|
|
33
33
|
w(() => {
|
|
34
34
|
if (e) {
|
|
@@ -45,11 +45,11 @@ function A(t) {
|
|
|
45
45
|
}
|
|
46
46
|
}, [e]);
|
|
47
47
|
let l = e && e.style && e.getSource(i);
|
|
48
|
-
return l ?
|
|
48
|
+
return l ? U(l, t, n.current) : l = R(e, i, t), n.current = t, l && $.Children.map(t.children, (o) => o && j(o, {
|
|
49
49
|
source: i
|
|
50
50
|
})) || null;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function A(t, e, n, a) {
|
|
53
53
|
if (s(n.id === a.id, "layer id changed"), s(n.type === a.type, "layer type changed"), n.type === "custom" || a.type === "custom")
|
|
54
54
|
return;
|
|
55
55
|
const { layout: i = {}, paint: l = {}, filter: o, minzoom: y, maxzoom: f, beforeId: m } = n;
|
|
@@ -69,15 +69,15 @@ function E(t, e, n, a) {
|
|
|
69
69
|
}
|
|
70
70
|
u(o, a.filter) || t.setFilter(e, o), (y !== a.minzoom || f !== a.maxzoom) && t.setLayerZoomRange(e, y, f);
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function E(t, e, n) {
|
|
73
73
|
if (t.style && t.style._loaded && (!("source" in n) || t.getSource(n.source))) {
|
|
74
74
|
const a = { ...n, id: e };
|
|
75
75
|
delete a.beforeId, t.addLayer(a, n.beforeId);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
let
|
|
78
|
+
let F = 0;
|
|
79
79
|
function L(t) {
|
|
80
|
-
const e = S(x).map.getMap(), n = k(t), [, a] = C(0), i = g(() => t.id || `jsx-layer-${
|
|
80
|
+
const e = S(x).map.getMap(), n = k(t), [, a] = C(0), i = g(() => t.id || `jsx-layer-${F++}`, []);
|
|
81
81
|
if (w(() => {
|
|
82
82
|
if (e) {
|
|
83
83
|
const o = () => a((y) => y + 1);
|
|
@@ -87,12 +87,12 @@ function L(t) {
|
|
|
87
87
|
}
|
|
88
88
|
}, [e]), e && e.style && e.getLayer(i))
|
|
89
89
|
try {
|
|
90
|
-
|
|
90
|
+
A(e, i, t, n.current);
|
|
91
91
|
} catch (o) {
|
|
92
92
|
console.warn(o);
|
|
93
93
|
}
|
|
94
94
|
else
|
|
95
|
-
|
|
95
|
+
E(e, i, t);
|
|
96
96
|
return n.current = t, null;
|
|
97
97
|
}
|
|
98
98
|
function h(t, e, n) {
|
|
@@ -116,7 +116,7 @@ function O({ sources: t }) {
|
|
|
116
116
|
...n,
|
|
117
117
|
geoJson: n.geometry ? I(n.geometry, n.type) : null
|
|
118
118
|
})), [t]);
|
|
119
|
-
return e?.length === 0 ? null : /* @__PURE__ */ c(b, { children: e?.map((n) => /* @__PURE__ */ c("div", { children: n.geoJson && /* @__PURE__ */ c(
|
|
119
|
+
return e?.length === 0 ? null : /* @__PURE__ */ c(b, { children: e?.map((n) => /* @__PURE__ */ c("div", { children: n.geoJson && /* @__PURE__ */ c(z, { id: n.key, type: "geojson", data: n.geoJson, children: n.layer && (Array.isArray(n.layer) ? n.layer.map((a, i) => /* @__PURE__ */ c(
|
|
120
120
|
L,
|
|
121
121
|
{
|
|
122
122
|
id: `${n.key}-${i}`,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { t as o, b as a, S as r, i as s, c } from "./styles-BhmqUA5C.js";
|
|
3
|
+
import { AdvancedMarker as d } from "@vis.gl/react-google-maps";
|
|
4
|
+
import { HouseLineIcon as l } from "@phosphor-icons/react";
|
|
5
|
+
function f({ marker: n, className: i }) {
|
|
6
|
+
return /* @__PURE__ */ t(
|
|
7
|
+
d,
|
|
8
|
+
{
|
|
9
|
+
position: {
|
|
10
|
+
lat: n.latitude,
|
|
11
|
+
lng: n.longitude
|
|
12
|
+
},
|
|
13
|
+
className: o(c.trim(), i),
|
|
14
|
+
zIndex: 10,
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ e("span", { id: "center-pin-background", className: a, children: /* @__PURE__ */ e(r, {}) }),
|
|
17
|
+
/* @__PURE__ */ e(l, { id: "center-pin-icon", className: s })
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
`center-pin-marker-${n.longitude}-${n.latitude}`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
f as default
|
|
25
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { jsxs as B, jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { useState as P, useRef as _, useCallback as b, useEffect as M } from "react";
|
|
3
|
+
import { APIProvider as y, Map as C, ControlPosition as f, useMap as E } from "@vis.gl/react-google-maps";
|
|
4
|
+
import { u as v, D as p, W as c, a as O, m as x } from "./index-Ct-3yYUx.js";
|
|
5
|
+
import { t as z } from "./index-DscDx7HE.js";
|
|
6
|
+
const Z = {
|
|
7
|
+
"top-left": f.LEFT_TOP,
|
|
8
|
+
"top-right": f.RIGHT_TOP,
|
|
9
|
+
"bottom-left": f.LEFT_BOTTOM,
|
|
10
|
+
"bottom-right": f.RIGHT_BOTTOM
|
|
11
|
+
}, k = ({ isMapLoaded: g }) => {
|
|
12
|
+
const e = E(), { markerPoints: n, setZoom: r, mapPadding: i } = v(), [u, d] = P(void 0), a = _(void 0), m = b(() => {
|
|
13
|
+
if (!e)
|
|
14
|
+
return;
|
|
15
|
+
const o = e.getZoom();
|
|
16
|
+
typeof o < "u" && r(o + 1);
|
|
17
|
+
}, [e, r]);
|
|
18
|
+
return M(() => {
|
|
19
|
+
m();
|
|
20
|
+
const o = e?.addListener("zoom_changed", m);
|
|
21
|
+
return () => {
|
|
22
|
+
o?.remove();
|
|
23
|
+
};
|
|
24
|
+
}, [e, m]), M(() => {
|
|
25
|
+
if (!e || typeof n > "u" || n.length === 0)
|
|
26
|
+
return;
|
|
27
|
+
const o = z(x(n));
|
|
28
|
+
(!a.current || !o.every((s, t) => s === a.current?.[t])) && (a.current = o, d(o));
|
|
29
|
+
}, [e, n]), M(() => {
|
|
30
|
+
if (!e || typeof u > "u")
|
|
31
|
+
return;
|
|
32
|
+
const [o, s, t, l] = u, L = (t - o) * 0.05 || 1e-3, T = (l - s) * 0.05 || 1e-3;
|
|
33
|
+
e.fitBounds(
|
|
34
|
+
{
|
|
35
|
+
south: s - T,
|
|
36
|
+
west: o - L,
|
|
37
|
+
north: l + T,
|
|
38
|
+
east: t + L
|
|
39
|
+
},
|
|
40
|
+
i
|
|
41
|
+
);
|
|
42
|
+
}, [g, e, u, i]), null;
|
|
43
|
+
};
|
|
44
|
+
function H({ children: g }) {
|
|
45
|
+
const [e, n] = P(!1), {
|
|
46
|
+
mapProvider: r,
|
|
47
|
+
center: i,
|
|
48
|
+
zoom: u = p.zoom,
|
|
49
|
+
minZoom: d,
|
|
50
|
+
maxZoom: a,
|
|
51
|
+
pitch: m = p.pitch,
|
|
52
|
+
bearing: o = p.bearing,
|
|
53
|
+
cooperativeGestures: s = p.cooperativeGestures,
|
|
54
|
+
zoomPosition: t
|
|
55
|
+
} = v();
|
|
56
|
+
if (r.name !== "google")
|
|
57
|
+
return null;
|
|
58
|
+
const l = () => {
|
|
59
|
+
n(!0);
|
|
60
|
+
};
|
|
61
|
+
return /* @__PURE__ */ B(y, { apiKey: r.apiKey, children: [
|
|
62
|
+
/* @__PURE__ */ h(k, { isMapLoaded: e }),
|
|
63
|
+
/* @__PURE__ */ h(
|
|
64
|
+
C,
|
|
65
|
+
{
|
|
66
|
+
mapId: r.theme || O.google,
|
|
67
|
+
defaultCenter: {
|
|
68
|
+
lat: i.latitude,
|
|
69
|
+
lng: i.longitude
|
|
70
|
+
},
|
|
71
|
+
defaultBounds: {
|
|
72
|
+
north: c[3],
|
|
73
|
+
south: c[1],
|
|
74
|
+
east: c[2],
|
|
75
|
+
west: c[0]
|
|
76
|
+
},
|
|
77
|
+
defaultZoom: u + 1,
|
|
78
|
+
defaultTilt: m,
|
|
79
|
+
defaultHeading: o,
|
|
80
|
+
gestureHandling: s ? "cooperative" : "greedy",
|
|
81
|
+
streetViewControl: !1,
|
|
82
|
+
fullscreenControl: !1,
|
|
83
|
+
clickableIcons: !1,
|
|
84
|
+
mapTypeControl: !1,
|
|
85
|
+
zoomControlOptions: {
|
|
86
|
+
position: t && Z[t]
|
|
87
|
+
},
|
|
88
|
+
minZoom: typeof d == "number" ? d + 1 : void 0,
|
|
89
|
+
maxZoom: typeof a == "number" ? a + 1 : void 0,
|
|
90
|
+
onTilesLoaded: l,
|
|
91
|
+
children: g
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
] });
|
|
95
|
+
}
|
|
96
|
+
export {
|
|
97
|
+
H as default
|
|
98
|
+
};
|