@local-logic/maps 0.0.21 → 0.0.22
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-B85VZGVP.js +56 -0
- package/dist/index-BRD3rjLE.js +138 -0
- package/dist/index-BpFpg_5A.js +78 -0
- package/dist/index-BrxP9NHZ.js +56 -0
- package/dist/{index-AcZakyxd.js → index-CN_dNOir.js} +168 -172
- package/dist/index-CRdDPWou.js +34 -0
- package/dist/{index-Dz1XJJEv.js → index-CSVsF1EQ.js} +28 -28
- package/dist/index-CceEGv05.js +104 -0
- package/dist/{index-DdYanSGw.js → index-CiWKwaC4.js} +2 -2
- package/dist/{index-6JzOJU8O.js → index-CmajMf1d.js} +21 -21
- package/dist/index-D5kHxP9H.js +43 -0
- package/dist/{index-29Y5fJR0.js → index-DNNz78Rc.js} +2 -2
- package/dist/index-Db33Ugg9.js +34 -0
- package/dist/index-DfhwDiOS.js +155 -0
- package/dist/index-arkRlpaR.js +80 -0
- package/dist/index-ufLC1PLO.js +57 -0
- package/dist/{index-Dxh7aMoG.js → index-vHMPqmOL.js} +2 -2
- package/dist/index.es.js +1 -1
- package/dist/{index.modern-fpUBOYPT.js → index.modern-B-ChKejQ.js} +9 -9
- package/dist/index.umd.js +115 -115
- package/dist/{logo-control-C5ZdRec5.js → logo-control-VgN6MEKI.js} +186 -206
- package/dist/{mapbox-gl-D6JObe4m.js → mapbox-gl-C6frO4Gl.js} +1877 -1877
- package/dist/{maplibre-gl-DDfJU6SR.js → maplibre-gl-DkDrZ6rP.js} +1230 -1228
- package/dist/{scale-control-Cflgzbvb.js → scale-control-jBKptTbw.js} +234 -252
- package/dist/style.css +1 -1
- package/dist/{styles-B8oT_wcC.js → styles-BR85tnqI.js} +16 -17
- package/package.json +2 -2
- package/dist/index-CHSsiFtN.js +0 -139
- package/dist/index-CqUTGwL0.js +0 -34
- package/dist/index-Cwn0dgP_.js +0 -56
- package/dist/index-D--WdzK4.js +0 -79
- package/dist/index-D1Phs0fA.js +0 -57
- package/dist/index-D1vI6Ww_.js +0 -43
- package/dist/index-DHHG0vNa.js +0 -157
- package/dist/index-DKFcZs0A.js +0 -81
- package/dist/index-DZTFM839.js +0 -105
- package/dist/index-_8n5sl1B.js +0 -56
- package/dist/index-_n1FGHXc.js +0 -34
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as s } from "react";
|
|
3
|
+
import { P as u } from "./logo-control-VgN6MEKI.js";
|
|
4
|
+
import { u as a } from "./index-CN_dNOir.js";
|
|
5
|
+
import { c as i } from "./styles-ChFj97uV.js";
|
|
6
|
+
function y({
|
|
7
|
+
latitude: e,
|
|
8
|
+
longitude: o,
|
|
9
|
+
anchor: p,
|
|
10
|
+
offset: f = [0, -35],
|
|
11
|
+
onClose: r,
|
|
12
|
+
children: m
|
|
13
|
+
}) {
|
|
14
|
+
const { zoom: n } = a();
|
|
15
|
+
return s(() => {
|
|
16
|
+
r?.();
|
|
17
|
+
}, [n]), typeof e > "u" || typeof o > "u" ? null : /* @__PURE__ */ t(
|
|
18
|
+
u,
|
|
19
|
+
{
|
|
20
|
+
className: "maplibre-popup",
|
|
21
|
+
focusAfterOpen: !0,
|
|
22
|
+
latitude: e,
|
|
23
|
+
longitude: o,
|
|
24
|
+
anchor: p,
|
|
25
|
+
offset: f,
|
|
26
|
+
onClose: r,
|
|
27
|
+
closeButton: !1,
|
|
28
|
+
children: /* @__PURE__ */ t("div", { className: i, children: m })
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
y as default
|
|
34
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as P, Fragment as u } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { G as L } from "./index.modern-
|
|
4
|
-
import { a as
|
|
5
|
-
function f(
|
|
6
|
-
switch (
|
|
2
|
+
import { useState as y, useContext as M, useEffect as g } from "react";
|
|
3
|
+
import { G as L } from "./index.modern-B-ChKejQ.js";
|
|
4
|
+
import { a as s } from "./utils-DJ13veBM.js";
|
|
5
|
+
function f(o, e, r) {
|
|
6
|
+
switch (o) {
|
|
7
7
|
case "fill":
|
|
8
8
|
return {
|
|
9
9
|
fillColor: e,
|
|
@@ -12,61 +12,61 @@ function f(a, e, l) {
|
|
|
12
12
|
case "line":
|
|
13
13
|
return {
|
|
14
14
|
strokeColor: e,
|
|
15
|
-
strokeWeight:
|
|
15
|
+
strokeWeight: r === "LineString" ? 6 : 2
|
|
16
16
|
};
|
|
17
17
|
default:
|
|
18
18
|
return {};
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function E({ sources:
|
|
22
|
-
const [e,
|
|
21
|
+
function E({ sources: o }) {
|
|
22
|
+
const [e, r] = y(null), [m, c] = y(
|
|
23
23
|
[]
|
|
24
24
|
), i = M(L);
|
|
25
|
-
return
|
|
26
|
-
i &&
|
|
27
|
-
}, [i]),
|
|
25
|
+
return g(() => {
|
|
26
|
+
i && r(i.map);
|
|
27
|
+
}, [i]), g(() => {
|
|
28
28
|
if (m.forEach((t) => {
|
|
29
|
-
t
|
|
30
|
-
}), !e || typeof
|
|
29
|
+
t?.setMap(null);
|
|
30
|
+
}), !e || typeof o > "u" || o.length === 0)
|
|
31
31
|
return;
|
|
32
|
-
const
|
|
32
|
+
const p = o.map((t) => {
|
|
33
33
|
const n = {
|
|
34
34
|
type: t.type || "MultiPolygon",
|
|
35
35
|
clickable: !1
|
|
36
36
|
};
|
|
37
37
|
if (Array.isArray(t.layer))
|
|
38
|
-
t.layer.forEach((
|
|
39
|
-
const h = f(
|
|
38
|
+
t.layer.forEach((a) => {
|
|
39
|
+
const h = f(a.type, a.color, t.type);
|
|
40
40
|
Object.assign(n, h);
|
|
41
41
|
});
|
|
42
42
|
else {
|
|
43
|
-
const
|
|
44
|
-
Object.assign(n,
|
|
43
|
+
const a = f(t.layer.type, t.layer.color, t.type);
|
|
44
|
+
Object.assign(n, a);
|
|
45
45
|
}
|
|
46
|
-
let
|
|
47
|
-
return t.type === "LineString" ?
|
|
46
|
+
let l;
|
|
47
|
+
return t.type === "LineString" ? l = new google.maps.Polyline({
|
|
48
48
|
// Set default options otherwise the polyline remains visible (even if eg: we only want the outline)
|
|
49
49
|
// We then overrider the default options with the layer options
|
|
50
50
|
strokeWeight: 6,
|
|
51
|
-
path:
|
|
51
|
+
path: s(t.geometry),
|
|
52
52
|
...n
|
|
53
|
-
}) :
|
|
53
|
+
}) : l = new google.maps.Polygon({
|
|
54
54
|
// Set default options otherwise the polygon remains visible (even if eg: we only want the outline)
|
|
55
55
|
// We then overrider the default options with the layer options
|
|
56
56
|
strokeWeight: 0,
|
|
57
57
|
fillOpacity: 0,
|
|
58
|
-
paths:
|
|
58
|
+
paths: s(t.geometry),
|
|
59
59
|
...n
|
|
60
|
-
}),
|
|
60
|
+
}), l.setMap(e), l;
|
|
61
61
|
});
|
|
62
|
-
return c(
|
|
62
|
+
return c(p), p.forEach((t) => {
|
|
63
63
|
t.setMap(e);
|
|
64
64
|
}), () => {
|
|
65
|
-
|
|
66
|
-
t
|
|
65
|
+
p.forEach((t) => {
|
|
66
|
+
t?.setMap(null);
|
|
67
67
|
});
|
|
68
68
|
};
|
|
69
|
-
}, [e,
|
|
69
|
+
}, [e, o]), /* @__PURE__ */ P(u, {});
|
|
70
70
|
}
|
|
71
71
|
export {
|
|
72
72
|
E as default
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsxs as b, jsx as M } from "react/jsx-runtime";
|
|
2
|
+
import { useState as L, useEffect as h } from "react";
|
|
3
|
+
import { A as v, M as y, C as f, u as B } from "./index.modern-B-ChKejQ.js";
|
|
4
|
+
import { b as C } from "./index-CFomI3Il.js";
|
|
5
|
+
import { u as T, d as p, a as P, m as x } from "./index-CN_dNOir.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
|
+
}, O = ({
|
|
12
|
+
isMapLoaded: c,
|
|
13
|
+
padding: d
|
|
14
|
+
}) => {
|
|
15
|
+
const e = B(), { markerPoints: n, setBounds: r, setZoom: u } = T(), [s, m] = L(void 0), i = () => {
|
|
16
|
+
if (!e)
|
|
17
|
+
return;
|
|
18
|
+
const o = e.getBounds()?.toJSON();
|
|
19
|
+
o && r([o.west, o.south, o.east, o.north]);
|
|
20
|
+
}, l = () => {
|
|
21
|
+
if (!e)
|
|
22
|
+
return;
|
|
23
|
+
const o = e.getZoom();
|
|
24
|
+
typeof o < "u" && u(o + 1);
|
|
25
|
+
};
|
|
26
|
+
return h(() => {
|
|
27
|
+
i(), l();
|
|
28
|
+
const o = e?.addListener("bounds_changed", () => {
|
|
29
|
+
i();
|
|
30
|
+
}), t = e?.addListener("zoom_changed", () => {
|
|
31
|
+
l();
|
|
32
|
+
});
|
|
33
|
+
return () => {
|
|
34
|
+
o?.remove(), t?.remove();
|
|
35
|
+
};
|
|
36
|
+
}, [e]), h(() => {
|
|
37
|
+
if (!e || typeof n > "u" || n.length === 0)
|
|
38
|
+
return;
|
|
39
|
+
const o = C(x(n));
|
|
40
|
+
o.every((t, a) => t === s?.[a]) || m(o);
|
|
41
|
+
}, [e, n]), h(() => {
|
|
42
|
+
if (!e || typeof s > "u")
|
|
43
|
+
return;
|
|
44
|
+
const [o, t, a, g] = s;
|
|
45
|
+
e.fitBounds(
|
|
46
|
+
{
|
|
47
|
+
south: o,
|
|
48
|
+
west: t,
|
|
49
|
+
north: a,
|
|
50
|
+
east: g
|
|
51
|
+
},
|
|
52
|
+
d
|
|
53
|
+
);
|
|
54
|
+
}, [c, e, s, d]), null;
|
|
55
|
+
};
|
|
56
|
+
function w({ padding: c, children: d }) {
|
|
57
|
+
const [e, n] = L(!1), {
|
|
58
|
+
mapProvider: r,
|
|
59
|
+
center: u,
|
|
60
|
+
zoom: s = p.zoom,
|
|
61
|
+
minZoom: m,
|
|
62
|
+
maxZoom: i,
|
|
63
|
+
pitch: l = p.pitch,
|
|
64
|
+
bearing: o = p.bearing,
|
|
65
|
+
cooperativeGestures: t = p.cooperativeGestures,
|
|
66
|
+
zoomPosition: a
|
|
67
|
+
} = T();
|
|
68
|
+
if (r.name !== "google")
|
|
69
|
+
return null;
|
|
70
|
+
const g = () => {
|
|
71
|
+
n(!0);
|
|
72
|
+
};
|
|
73
|
+
return /* @__PURE__ */ b(v, { apiKey: r.apiKey, children: [
|
|
74
|
+
/* @__PURE__ */ M(O, { isMapLoaded: e, padding: c }),
|
|
75
|
+
/* @__PURE__ */ M(
|
|
76
|
+
y,
|
|
77
|
+
{
|
|
78
|
+
mapId: r.theme || P.google,
|
|
79
|
+
defaultCenter: {
|
|
80
|
+
lat: u.latitude,
|
|
81
|
+
lng: u.longitude
|
|
82
|
+
},
|
|
83
|
+
defaultZoom: s + 1,
|
|
84
|
+
defaultTilt: l,
|
|
85
|
+
defaultHeading: o,
|
|
86
|
+
gestureHandling: t ? "cooperative" : "greedy",
|
|
87
|
+
streetViewControl: !1,
|
|
88
|
+
fullscreenControl: !1,
|
|
89
|
+
clickableIcons: !1,
|
|
90
|
+
mapTypeControl: !1,
|
|
91
|
+
zoomControlOptions: {
|
|
92
|
+
position: a && z[a]
|
|
93
|
+
},
|
|
94
|
+
minZoom: typeof m == "number" ? m + 1 : void 0,
|
|
95
|
+
maxZoom: typeof i == "number" ? i + 1 : void 0,
|
|
96
|
+
onTilesLoaded: g,
|
|
97
|
+
children: d
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] });
|
|
101
|
+
}
|
|
102
|
+
export {
|
|
103
|
+
w as default
|
|
104
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as e, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { t as a, b as o, S as r, o as s, i as c, c as d } from "./styles-
|
|
3
|
-
import { a as l } from "./scale-control-
|
|
2
|
+
import { t as a, b as o, S as r, o as s, i as c, c as d } from "./styles-BR85tnqI.js";
|
|
3
|
+
import { a as l } from "./scale-control-jBKptTbw.js";
|
|
4
4
|
import "react";
|
|
5
5
|
function b({ marker: t, className: n }) {
|
|
6
6
|
return /* @__PURE__ */ e(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t, jsxs as i, Fragment as f } from "react/jsx-runtime";
|
|
2
2
|
import * as e from "react";
|
|
3
3
|
import { useMemo as g } from "react";
|
|
4
|
-
import { u as p, M as c } from "./index-
|
|
4
|
+
import { u as p, M as c } from "./index-CN_dNOir.js";
|
|
5
5
|
import { p as Z } from "./IconBase.es-rM5tt24D.js";
|
|
6
6
|
const A = /* @__PURE__ */ new Map([
|
|
7
7
|
[
|
|
@@ -34,9 +34,9 @@ const A = /* @__PURE__ */ new Map([
|
|
|
34
34
|
"thin",
|
|
35
35
|
/* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M128,68a36,36,0,1,0,36,36A36,36,0,0,0,128,68Zm0,64a28,28,0,1,1,28-28A28,28,0,0,1,128,132Zm0-112a84.09,84.09,0,0,0-84,84c0,30.42,14.17,62.79,41,93.62a250,250,0,0,0,40.73,37.66,4,4,0,0,0,4.58,0A250,250,0,0,0,171,197.62c26.81-30.83,41-63.2,41-93.62A84.09,84.09,0,0,0,128,20Zm37.1,172.23A254.62,254.62,0,0,1,128,227a254.62,254.62,0,0,1-37.1-34.81C73.15,171.8,52,139.9,52,104a76,76,0,0,1,152,0C204,139.9,182.85,171.8,165.1,192.23Z" }))
|
|
36
36
|
]
|
|
37
|
-
]), d = e.forwardRef((
|
|
37
|
+
]), d = e.forwardRef((a, r) => /* @__PURE__ */ e.createElement(Z, { ref: r, ...a, weights: A }));
|
|
38
38
|
d.displayName = "MapPinIcon";
|
|
39
|
-
const
|
|
39
|
+
const m = `
|
|
40
40
|
group/marker cursor-pointer rounded-full
|
|
41
41
|
relative h-7 w-7 flex items-center justify-center
|
|
42
42
|
text-base-white ring-1 ring-inset
|
|
@@ -62,8 +62,8 @@ const n = `
|
|
|
62
62
|
|
|
63
63
|
group-data-[is-active=true]/marker:fill-[var(--background,theme(colors.base.white))]
|
|
64
64
|
`;
|
|
65
|
-
function v({ icon:
|
|
66
|
-
return typeof
|
|
65
|
+
function v({ icon: a }) {
|
|
66
|
+
return typeof a < "u" ? /* @__PURE__ */ t(a, { className: s }) : /* @__PURE__ */ t(d, { className: s });
|
|
67
67
|
}
|
|
68
68
|
const M = `
|
|
69
69
|
relative flex
|
|
@@ -71,32 +71,32 @@ const M = `
|
|
|
71
71
|
-ml-6 -z-10 last:-z-20
|
|
72
72
|
`;
|
|
73
73
|
function w({
|
|
74
|
-
isActive:
|
|
75
|
-
colors:
|
|
74
|
+
isActive: a = !1,
|
|
75
|
+
colors: r,
|
|
76
76
|
icon: h
|
|
77
77
|
}) {
|
|
78
|
-
const { zoom:
|
|
79
|
-
return /* @__PURE__ */
|
|
78
|
+
const { zoom: o, mapProvider: l } = p(), n = g(() => l.name === "google" ? o - 1 < c + 1 : o < c, [o, l]);
|
|
79
|
+
return /* @__PURE__ */ i(
|
|
80
80
|
"div",
|
|
81
81
|
{
|
|
82
82
|
className: M,
|
|
83
83
|
style: {
|
|
84
|
-
"--background":
|
|
85
|
-
"--fill":
|
|
84
|
+
"--background": r?.background,
|
|
85
|
+
"--fill": r?.fill
|
|
86
86
|
},
|
|
87
87
|
children: [
|
|
88
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ t(
|
|
89
89
|
"div",
|
|
90
90
|
{
|
|
91
|
-
className:
|
|
92
|
-
"data-is-zoomed-out":
|
|
93
|
-
"data-is-active":
|
|
94
|
-
children: /* @__PURE__ */
|
|
91
|
+
className: m,
|
|
92
|
+
"data-is-zoomed-out": n,
|
|
93
|
+
"data-is-active": a,
|
|
94
|
+
children: /* @__PURE__ */ t(v, { icon: h })
|
|
95
95
|
}
|
|
96
96
|
),
|
|
97
|
-
!
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
97
|
+
!n && /* @__PURE__ */ i(f, { children: [
|
|
98
|
+
/* @__PURE__ */ t("div", { className: `${m} ${u}` }),
|
|
99
|
+
/* @__PURE__ */ t("div", { className: `${m} ${u}` })
|
|
100
100
|
] })
|
|
101
101
|
]
|
|
102
102
|
}
|
|
@@ -105,5 +105,5 @@ function w({
|
|
|
105
105
|
export {
|
|
106
106
|
w as C,
|
|
107
107
|
v as M,
|
|
108
|
-
|
|
108
|
+
m as c
|
|
109
109
|
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as u, useMemo as c } from "react";
|
|
3
|
+
import { u as d, I as l } from "./index.modern-B-ChKejQ.js";
|
|
4
|
+
import { u as f } from "./index-CN_dNOir.js";
|
|
5
|
+
import { c as y } from "./styles-ChFj97uV.js";
|
|
6
|
+
function I({
|
|
7
|
+
latitude: o,
|
|
8
|
+
longitude: t,
|
|
9
|
+
offset: r = [0, -25],
|
|
10
|
+
onClose: e,
|
|
11
|
+
children: s
|
|
12
|
+
}) {
|
|
13
|
+
const n = d(), { zoom: a } = f();
|
|
14
|
+
u(() => {
|
|
15
|
+
e?.();
|
|
16
|
+
}, [a]), u(() => {
|
|
17
|
+
if (!n) return;
|
|
18
|
+
const p = n.addListener("click", () => {
|
|
19
|
+
e?.();
|
|
20
|
+
});
|
|
21
|
+
return () => {
|
|
22
|
+
p.remove();
|
|
23
|
+
};
|
|
24
|
+
}, [n]);
|
|
25
|
+
const m = c(() => Array.isArray(r) ? [r[0], r[1]] : [r, r], [r]);
|
|
26
|
+
return typeof o > "u" || typeof t > "u" ? null : /* @__PURE__ */ i(
|
|
27
|
+
l,
|
|
28
|
+
{
|
|
29
|
+
shouldFocus: !0,
|
|
30
|
+
disableAutoPan: !0,
|
|
31
|
+
position: {
|
|
32
|
+
lat: o,
|
|
33
|
+
lng: t
|
|
34
|
+
},
|
|
35
|
+
pixelOffset: m,
|
|
36
|
+
onClose: e,
|
|
37
|
+
children: /* @__PURE__ */ i("div", { className: y, children: s })
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
I as default
|
|
43
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { t as a, b as o, S as r, o as s, i as c, c as d } from "./styles-
|
|
3
|
-
import { a as l } from "./index.modern-
|
|
2
|
+
import { t as a, b as o, S as r, o as s, i as c, c as d } from "./styles-BR85tnqI.js";
|
|
3
|
+
import { a as l } from "./index.modern-B-ChKejQ.js";
|
|
4
4
|
function m({ marker: n, className: i }) {
|
|
5
5
|
return /* @__PURE__ */ t(
|
|
6
6
|
l,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as s } from "react";
|
|
3
|
+
import { P as u } from "./scale-control-jBKptTbw.js";
|
|
4
|
+
import { u as a } from "./index-CN_dNOir.js";
|
|
5
|
+
import { c } from "./styles-ChFj97uV.js";
|
|
6
|
+
function b({
|
|
7
|
+
latitude: o,
|
|
8
|
+
longitude: e,
|
|
9
|
+
anchor: t,
|
|
10
|
+
offset: f = [0, -35],
|
|
11
|
+
onClose: r,
|
|
12
|
+
children: m
|
|
13
|
+
}) {
|
|
14
|
+
const { zoom: n } = a();
|
|
15
|
+
return s(() => {
|
|
16
|
+
r?.();
|
|
17
|
+
}, [n]), typeof o > "u" || typeof e > "u" ? null : /* @__PURE__ */ p(
|
|
18
|
+
u,
|
|
19
|
+
{
|
|
20
|
+
className: "mapbox-popup",
|
|
21
|
+
focusAfterOpen: !0,
|
|
22
|
+
latitude: o,
|
|
23
|
+
longitude: e,
|
|
24
|
+
anchor: t,
|
|
25
|
+
offset: f,
|
|
26
|
+
onClose: r,
|
|
27
|
+
closeButton: !1,
|
|
28
|
+
children: /* @__PURE__ */ p("div", { className: c, children: m })
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
b as default
|
|
34
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsx as c, Fragment as x } from "react/jsx-runtime";
|
|
2
|
+
import * as $ from "react";
|
|
3
|
+
import { useContext as S, useRef as k, useState as b, useMemo as g, useEffect as w, cloneElement as j } from "react";
|
|
4
|
+
import { b as C, d as u } from "./logo-control-VgN6MEKI.js";
|
|
5
|
+
import { g as I } from "./utils-DJ13veBM.js";
|
|
6
|
+
function s(t, e) {
|
|
7
|
+
if (!t)
|
|
8
|
+
throw new Error(e);
|
|
9
|
+
}
|
|
10
|
+
let M = 0;
|
|
11
|
+
function z(t, e, n) {
|
|
12
|
+
if (t.style && t.style._loaded) {
|
|
13
|
+
const a = { ...n };
|
|
14
|
+
return delete a.id, delete a.children, t.addSource(e, a), t.getSource(e);
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
function A(t, e, n) {
|
|
19
|
+
s(e.id === n.id, "source id changed"), s(e.type === n.type, "source type changed");
|
|
20
|
+
let a = "", r = 0;
|
|
21
|
+
for (const o in e)
|
|
22
|
+
o !== "children" && o !== "id" && !u(n[o], e[o]) && (a = o, r++);
|
|
23
|
+
if (!r)
|
|
24
|
+
return;
|
|
25
|
+
const l = e.type;
|
|
26
|
+
if (l === "geojson")
|
|
27
|
+
t.setData(e.data);
|
|
28
|
+
else if (l === "image")
|
|
29
|
+
t.updateImage({
|
|
30
|
+
url: e.url,
|
|
31
|
+
coordinates: e.coordinates
|
|
32
|
+
});
|
|
33
|
+
else
|
|
34
|
+
switch (a) {
|
|
35
|
+
case "coordinates":
|
|
36
|
+
t.setCoordinates?.(e.coordinates);
|
|
37
|
+
break;
|
|
38
|
+
case "url":
|
|
39
|
+
t.setUrl?.(e.url);
|
|
40
|
+
break;
|
|
41
|
+
case "tiles":
|
|
42
|
+
t.setTiles?.(e.tiles);
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
console.warn(`Unable to update <Source> prop: ${a}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function E(t) {
|
|
49
|
+
const e = S(C).map.getMap(), n = k(t), [, a] = b(0), r = g(() => t.id || `jsx-source-${M++}`, []);
|
|
50
|
+
w(() => {
|
|
51
|
+
if (e) {
|
|
52
|
+
const o = () => setTimeout(() => a((y) => y + 1), 0);
|
|
53
|
+
return e.on("styledata", o), o(), () => {
|
|
54
|
+
if (e.off("styledata", o), e.style && e.style._loaded && e.getSource(r)) {
|
|
55
|
+
const y = e.getStyle()?.layers;
|
|
56
|
+
if (y)
|
|
57
|
+
for (const d of y)
|
|
58
|
+
d.source === r && e.removeLayer(d.id);
|
|
59
|
+
e.removeSource(r);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}, [e]);
|
|
64
|
+
let l = e && e.style && e.getSource(r);
|
|
65
|
+
return l ? A(l, t, n.current) : l = z(e, r, t), n.current = t, l && $.Children.map(t.children, (o) => o && j(o, {
|
|
66
|
+
source: r
|
|
67
|
+
})) || null;
|
|
68
|
+
}
|
|
69
|
+
function F(t, e, n, a) {
|
|
70
|
+
if (s(n.id === a.id, "layer id changed"), s(n.type === a.type, "layer type changed"), n.type === "custom" || a.type === "custom")
|
|
71
|
+
return;
|
|
72
|
+
const { layout: r = {}, paint: l = {}, filter: o, minzoom: y, maxzoom: d, beforeId: m } = n;
|
|
73
|
+
if (m !== a.beforeId && t.moveLayer(e, m), r !== a.layout) {
|
|
74
|
+
const f = a.layout || {};
|
|
75
|
+
for (const i in r)
|
|
76
|
+
u(r[i], f[i]) || t.setLayoutProperty(e, i, r[i]);
|
|
77
|
+
for (const i in f)
|
|
78
|
+
r.hasOwnProperty(i) || t.setLayoutProperty(e, i, void 0);
|
|
79
|
+
}
|
|
80
|
+
if (l !== a.paint) {
|
|
81
|
+
const f = a.paint || {};
|
|
82
|
+
for (const i in l)
|
|
83
|
+
u(l[i], f[i]) || t.setPaintProperty(e, i, l[i]);
|
|
84
|
+
for (const i in f)
|
|
85
|
+
l.hasOwnProperty(i) || t.setPaintProperty(e, i, void 0);
|
|
86
|
+
}
|
|
87
|
+
u(o, a.filter) || t.setFilter(e, o), (y !== a.minzoom || d !== a.maxzoom) && t.setLayerZoomRange(e, y, d);
|
|
88
|
+
}
|
|
89
|
+
function R(t, e, n) {
|
|
90
|
+
if (t.style && t.style._loaded && (!("source" in n) || t.getSource(n.source))) {
|
|
91
|
+
const a = { ...n, id: e };
|
|
92
|
+
delete a.beforeId, t.addLayer(a, n.beforeId);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
let U = 0;
|
|
96
|
+
function h(t) {
|
|
97
|
+
const e = S(C).map.getMap(), n = k(t), [, a] = b(0), r = g(() => t.id || `jsx-layer-${U++}`, []);
|
|
98
|
+
if (w(() => {
|
|
99
|
+
if (e) {
|
|
100
|
+
const o = () => a((y) => y + 1);
|
|
101
|
+
return e.on("styledata", o), o(), () => {
|
|
102
|
+
e.off("styledata", o), e.style && e.style._loaded && e.getLayer(r) && e.removeLayer(r);
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}, [e]), e && e.style && e.getLayer(r))
|
|
106
|
+
try {
|
|
107
|
+
F(e, r, t, n.current);
|
|
108
|
+
} catch (o) {
|
|
109
|
+
console.warn(o);
|
|
110
|
+
}
|
|
111
|
+
else
|
|
112
|
+
R(e, r, t);
|
|
113
|
+
return n.current = t, null;
|
|
114
|
+
}
|
|
115
|
+
function L(t, e, n) {
|
|
116
|
+
switch (t) {
|
|
117
|
+
case "fill":
|
|
118
|
+
return {
|
|
119
|
+
"fill-color": e,
|
|
120
|
+
"fill-opacity": 0.25
|
|
121
|
+
};
|
|
122
|
+
case "line":
|
|
123
|
+
return {
|
|
124
|
+
"line-color": e,
|
|
125
|
+
"line-width": n === "LineString" ? 6 : 2
|
|
126
|
+
};
|
|
127
|
+
default:
|
|
128
|
+
return {};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function T({ sources: t }) {
|
|
132
|
+
const e = g(() => !Array.isArray(t) || t.length === 0 ? [] : t.map((n) => ({
|
|
133
|
+
...n,
|
|
134
|
+
geoJson: n.geometry ? I(n.geometry, n.type) : null
|
|
135
|
+
})), [t]);
|
|
136
|
+
return e?.length === 0 ? null : /* @__PURE__ */ c(x, { children: e?.map((n) => /* @__PURE__ */ c("div", { children: n.geoJson && /* @__PURE__ */ c(E, { id: n.key, type: "geojson", data: n.geoJson, children: n.layer && (Array.isArray(n.layer) ? n.layer.map((a, r) => /* @__PURE__ */ c(
|
|
137
|
+
h,
|
|
138
|
+
{
|
|
139
|
+
id: `${n.key}-${r}`,
|
|
140
|
+
type: a.type,
|
|
141
|
+
paint: L(a.type, a.color, n.type)
|
|
142
|
+
},
|
|
143
|
+
`${n.key}-${r}`
|
|
144
|
+
)) : /* @__PURE__ */ c(
|
|
145
|
+
h,
|
|
146
|
+
{
|
|
147
|
+
id: n.key,
|
|
148
|
+
type: n.layer.type,
|
|
149
|
+
paint: L(n.layer.type, n.layer.color, n.type)
|
|
150
|
+
}
|
|
151
|
+
)) }, n.key) }, n.key)) });
|
|
152
|
+
}
|
|
153
|
+
export {
|
|
154
|
+
T as default
|
|
155
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsxs as M, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useState as v, useEffect as d } from "react";
|
|
3
|
+
import { M as y, N as B, u as g } from "./scale-control-jBKptTbw.js";
|
|
4
|
+
import { b as h } from "./index-CFomI3Il.js";
|
|
5
|
+
import { u as b, d as i, a as Z, m as k } from "./index-CN_dNOir.js";
|
|
6
|
+
const z = ({ padding: m }) => {
|
|
7
|
+
const { current: o } = g(), { markerPoints: t, setBounds: u, setZoom: p } = b(), [a, f] = v(void 0), r = () => {
|
|
8
|
+
if (!o)
|
|
9
|
+
return;
|
|
10
|
+
const e = o.getBounds()?.toArray().flat();
|
|
11
|
+
e && u(e);
|
|
12
|
+
}, s = () => {
|
|
13
|
+
o && p(o.getZoom());
|
|
14
|
+
};
|
|
15
|
+
return d(() => (r(), s(), o?.on("move", () => {
|
|
16
|
+
r();
|
|
17
|
+
}), o?.on("zoom", () => {
|
|
18
|
+
s();
|
|
19
|
+
}), () => {
|
|
20
|
+
o?.off("move", r), o?.off("zoom", s);
|
|
21
|
+
}), [o]), d(() => {
|
|
22
|
+
if (!o || typeof t > "u" || t.length === 0)
|
|
23
|
+
return;
|
|
24
|
+
const e = h(k(t));
|
|
25
|
+
e.every((n, c) => n === a?.[c]) || f(e);
|
|
26
|
+
}, [o, t]), d(() => {
|
|
27
|
+
if (!o || typeof a > "u")
|
|
28
|
+
return;
|
|
29
|
+
const [e, n, c, x] = a;
|
|
30
|
+
o.fitBounds(
|
|
31
|
+
[
|
|
32
|
+
[n, e],
|
|
33
|
+
[x, c]
|
|
34
|
+
],
|
|
35
|
+
{
|
|
36
|
+
maxZoom: 17,
|
|
37
|
+
duration: 700,
|
|
38
|
+
padding: m
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}, [o, a, m]), null;
|
|
42
|
+
};
|
|
43
|
+
function A({ padding: m, children: o }) {
|
|
44
|
+
const {
|
|
45
|
+
mapProvider: t,
|
|
46
|
+
center: u,
|
|
47
|
+
zoom: p = i.zoom,
|
|
48
|
+
minZoom: a,
|
|
49
|
+
maxZoom: f,
|
|
50
|
+
pitch: r = i.pitch,
|
|
51
|
+
bearing: s = i.bearing,
|
|
52
|
+
cooperativeGestures: e = i.cooperativeGestures,
|
|
53
|
+
zoomPosition: n
|
|
54
|
+
} = b();
|
|
55
|
+
return t.name !== "mapbox" ? null : /* @__PURE__ */ M(
|
|
56
|
+
y,
|
|
57
|
+
{
|
|
58
|
+
mapboxAccessToken: t.apiKey,
|
|
59
|
+
initialViewState: {
|
|
60
|
+
...u,
|
|
61
|
+
zoom: p,
|
|
62
|
+
pitch: r,
|
|
63
|
+
bearing: s
|
|
64
|
+
},
|
|
65
|
+
cooperativeGestures: e,
|
|
66
|
+
minZoom: a,
|
|
67
|
+
maxZoom: f,
|
|
68
|
+
mapStyle: `mapbox://styles/${t.theme || Z.mapbox}`,
|
|
69
|
+
interactiveLayerIds: ["road-label", "waterway-label"],
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ l(z, { padding: m }),
|
|
72
|
+
n && /* @__PURE__ */ l(B, { position: n }),
|
|
73
|
+
o
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
A as default
|
|
80
|
+
};
|