@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,75 @@
|
|
|
1
|
+
import { jsxs as g, jsx as M } from "react/jsx-runtime";
|
|
2
|
+
import { useState as v, useRef as y, useCallback as B, useEffect as c } from "react";
|
|
3
|
+
import { M as L, N as P, u as k } from "./scale-control-Dsir9fWY.js";
|
|
4
|
+
import { u as b, D as p, a as E, m as A } from "./index-Ct-3yYUx.js";
|
|
5
|
+
import { t as Z } from "./index-DscDx7HE.js";
|
|
6
|
+
const _ = () => {
|
|
7
|
+
const { current: e } = k(), { markerPoints: o, setZoom: i, mapPadding: m } = b(), [n, f] = v(void 0), s = y(void 0), r = B(() => {
|
|
8
|
+
e && i(e.getZoom());
|
|
9
|
+
}, [e, i]);
|
|
10
|
+
return c(() => (r(), e?.on("zoom", r), () => {
|
|
11
|
+
e?.off("zoom", r);
|
|
12
|
+
}), [e, r]), c(() => {
|
|
13
|
+
if (!e || typeof o > "u" || o.length === 0)
|
|
14
|
+
return;
|
|
15
|
+
const t = Z(A(o));
|
|
16
|
+
(!s.current || !t.every((a, u) => a === s.current?.[u])) && (s.current = t, f(t));
|
|
17
|
+
}, [e, o]), c(() => {
|
|
18
|
+
if (!e || typeof n > "u")
|
|
19
|
+
return;
|
|
20
|
+
const [t, a, u, d] = n, l = (u - t) * 0.05 || 1e-3, x = (d - a) * 0.05 || 1e-3;
|
|
21
|
+
e.fitBounds(
|
|
22
|
+
[
|
|
23
|
+
[t - l, a - x],
|
|
24
|
+
[u + l, d + x]
|
|
25
|
+
],
|
|
26
|
+
{
|
|
27
|
+
// Mapbox seems to retain padding, thus further calls
|
|
28
|
+
// to map.getBounds() include the padding and make calculations
|
|
29
|
+
// harder. Explicitly turning this off.
|
|
30
|
+
retainPadding: !1,
|
|
31
|
+
padding: m,
|
|
32
|
+
maxZoom: 17,
|
|
33
|
+
duration: 700
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}, [e, n, m]), null;
|
|
37
|
+
};
|
|
38
|
+
function C({ children: e }) {
|
|
39
|
+
const {
|
|
40
|
+
mapProvider: o,
|
|
41
|
+
center: i,
|
|
42
|
+
zoom: m = p.zoom,
|
|
43
|
+
minZoom: n,
|
|
44
|
+
maxZoom: f,
|
|
45
|
+
pitch: s = p.pitch,
|
|
46
|
+
bearing: r = p.bearing,
|
|
47
|
+
cooperativeGestures: t = p.cooperativeGestures,
|
|
48
|
+
zoomPosition: a
|
|
49
|
+
} = b();
|
|
50
|
+
return o.name !== "mapbox" ? null : /* @__PURE__ */ g(
|
|
51
|
+
L,
|
|
52
|
+
{
|
|
53
|
+
mapboxAccessToken: o.apiKey,
|
|
54
|
+
initialViewState: {
|
|
55
|
+
...i,
|
|
56
|
+
zoom: m,
|
|
57
|
+
pitch: s,
|
|
58
|
+
bearing: r
|
|
59
|
+
},
|
|
60
|
+
cooperativeGestures: t,
|
|
61
|
+
minZoom: n,
|
|
62
|
+
maxZoom: f,
|
|
63
|
+
mapStyle: `mapbox://styles/${o.theme || E.mapbox}`,
|
|
64
|
+
interactiveLayerIds: ["road-label", "waterway-label"],
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ M(_, {}),
|
|
67
|
+
a && /* @__PURE__ */ M(P, { position: a }),
|
|
68
|
+
e
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
C as default
|
|
75
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as f, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { a as k } from "./scale-control-
|
|
2
|
+
import { a as k } from "./scale-control-Dsir9fWY.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { u, M } from "./index-
|
|
5
|
-
import { C as g, c as C, M as b } from "./index-
|
|
4
|
+
import { u, M } from "./index-Ct-3yYUx.js";
|
|
5
|
+
import { C as g, c as C, M as b } from "./index-DntG4mBo.js";
|
|
6
6
|
function _({
|
|
7
7
|
clusters: n,
|
|
8
8
|
colors: r,
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import { u as M, M as g } from "./index-
|
|
4
|
-
import { C, c as v, M as I } from "./index-
|
|
1
|
+
import { jsxs as f, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useMap as k, AdvancedMarker as u } from "@vis.gl/react-google-maps";
|
|
3
|
+
import { u as M, M as g } from "./index-Ct-3yYUx.js";
|
|
4
|
+
import { C, c as v, M as I } from "./index-DntG4mBo.js";
|
|
5
5
|
function x({
|
|
6
|
-
clusters:
|
|
6
|
+
clusters: a,
|
|
7
7
|
colors: o,
|
|
8
|
-
clusterIcon:
|
|
9
|
-
onClick:
|
|
8
|
+
clusterIcon: n,
|
|
9
|
+
onClick: s,
|
|
10
10
|
doesSuperclusterContainActiveMarker: p
|
|
11
11
|
}) {
|
|
12
|
-
|
|
12
|
+
k();
|
|
13
13
|
const { activeMarker: d, zoom: c } = M(), m = (e) => () => {
|
|
14
|
-
e.properties.disableClick ||
|
|
14
|
+
e.properties.disableClick || s?.(e);
|
|
15
15
|
};
|
|
16
|
-
return
|
|
17
|
-
const i = e.geometry.coordinates[0],
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
|
|
16
|
+
return a?.map((e, l) => {
|
|
17
|
+
const i = e.geometry.coordinates[0], t = e.geometry.coordinates[1];
|
|
18
|
+
return /* @__PURE__ */ f(
|
|
19
|
+
u,
|
|
20
20
|
{
|
|
21
21
|
position: {
|
|
22
|
-
lat:
|
|
22
|
+
lat: t,
|
|
23
23
|
lng: i
|
|
24
24
|
},
|
|
25
25
|
onClick: m(e),
|
|
@@ -28,7 +28,7 @@ function x({
|
|
|
28
28
|
C,
|
|
29
29
|
{
|
|
30
30
|
colors: o,
|
|
31
|
-
icon:
|
|
31
|
+
icon: n,
|
|
32
32
|
isActive: p(e.properties.cluster_id)
|
|
33
33
|
}
|
|
34
34
|
),
|
|
@@ -48,7 +48,7 @@ function x({
|
|
|
48
48
|
)
|
|
49
49
|
]
|
|
50
50
|
},
|
|
51
|
-
`map-marker-${i}-${
|
|
51
|
+
`map-marker-${i}-${t}-${l}`
|
|
52
52
|
);
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as r, jsxs as l, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as f } from "react";
|
|
3
|
+
import { u as h, M as n } from "./index-Ct-3yYUx.js";
|
|
4
|
+
import { MapPinIcon as g } from "@phosphor-icons/react";
|
|
5
|
+
const a = `
|
|
6
|
+
group/marker cursor-pointer rounded-full
|
|
7
|
+
relative h-7 w-7 flex items-center justify-center
|
|
8
|
+
text-base-white ring-1 ring-inset
|
|
9
|
+
transition-colors
|
|
10
|
+
|
|
11
|
+
bg-[var(--background,theme(colors.base.white))]
|
|
12
|
+
ring-[var(--fill,theme(colors.primary.100))]
|
|
13
|
+
|
|
14
|
+
hover:bg-[var(--fill,theme(colors.primary.100))]
|
|
15
|
+
|
|
16
|
+
data-[is-zoomed-out=true]:bg-[var(--fill,theme(colors.primary.100))]
|
|
17
|
+
data-[is-zoomed-out=true]:h-4
|
|
18
|
+
data-[is-zoomed-out=true]:w-4
|
|
19
|
+
|
|
20
|
+
data-[is-active=true]:bg-[var(--fill,theme(colors.primary.100))]
|
|
21
|
+
`, m = `
|
|
22
|
+
m-auto transition-all w-4 h-4
|
|
23
|
+
|
|
24
|
+
fill-[var(--fill,theme(colors.primary.100))]
|
|
25
|
+
group-hover/marker:fill-[var(--background,theme(colors.base.white))]
|
|
26
|
+
|
|
27
|
+
group-data-[is-zoomed-out=true]/marker:hidden
|
|
28
|
+
|
|
29
|
+
group-data-[is-active=true]/marker:fill-[var(--background,theme(colors.base.white))]
|
|
30
|
+
`;
|
|
31
|
+
function v({ icon: e }) {
|
|
32
|
+
return typeof e < "u" ? /* @__PURE__ */ r(e, { className: m }) : /* @__PURE__ */ r(g, { className: m });
|
|
33
|
+
}
|
|
34
|
+
const p = `
|
|
35
|
+
relative flex
|
|
36
|
+
`, c = `
|
|
37
|
+
-ml-6 -z-10 last:-z-20
|
|
38
|
+
`;
|
|
39
|
+
function M({
|
|
40
|
+
isActive: e = !1,
|
|
41
|
+
colors: t,
|
|
42
|
+
icon: u
|
|
43
|
+
}) {
|
|
44
|
+
const { zoom: o, mapProvider: i } = h(), s = f(() => i.name === "google" ? o - 1 < n + 1 : o < n, [o, i]);
|
|
45
|
+
return /* @__PURE__ */ l(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: p,
|
|
49
|
+
style: {
|
|
50
|
+
"--background": t?.background,
|
|
51
|
+
"--fill": t?.fill
|
|
52
|
+
},
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ r(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: a,
|
|
58
|
+
"data-is-zoomed-out": s,
|
|
59
|
+
"data-is-active": e,
|
|
60
|
+
children: /* @__PURE__ */ r(v, { icon: u })
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
!s && /* @__PURE__ */ l(d, { children: [
|
|
64
|
+
/* @__PURE__ */ r("div", { className: `${a} ${c}` }),
|
|
65
|
+
/* @__PURE__ */ r("div", { className: `${a} ${c}` })
|
|
66
|
+
] })
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
M as C,
|
|
73
|
+
v as M,
|
|
74
|
+
a as c
|
|
75
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
function g(t, o, f) {
|
|
2
2
|
if (t !== null)
|
|
3
|
-
for (var i, n,
|
|
4
|
-
|
|
5
|
-
for (var
|
|
3
|
+
for (var i, n, y, h, P, r, b, u = 0, s = 0, v, p = t.type, M = p === "FeatureCollection", k = p === "Feature", w = M ? t.features.length : 1, e = 0; e < w; e++) {
|
|
4
|
+
b = M ? t.features[e].geometry : k ? t.geometry : t, v = b ? b.type === "GeometryCollection" : !1, P = v ? b.geometries.length : 1;
|
|
5
|
+
for (var C = 0; C < P; C++) {
|
|
6
6
|
var l = 0, a = 0;
|
|
7
|
-
if (h =
|
|
7
|
+
if (h = v ? b.geometries[C] : b, h !== null) {
|
|
8
8
|
r = h.coordinates;
|
|
9
|
-
var
|
|
10
|
-
switch (u = 0,
|
|
9
|
+
var c = h.type;
|
|
10
|
+
switch (u = 0, c) {
|
|
11
11
|
case null:
|
|
12
12
|
break;
|
|
13
13
|
case "Point":
|
|
@@ -32,9 +32,9 @@ function g(t, o, f) {
|
|
|
32
32
|
a
|
|
33
33
|
) === !1)
|
|
34
34
|
return !1;
|
|
35
|
-
s++,
|
|
35
|
+
s++, c === "MultiPoint" && l++;
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
c === "LineString" && l++;
|
|
38
38
|
break;
|
|
39
39
|
case "Polygon":
|
|
40
40
|
case "MultiLineString":
|
|
@@ -50,16 +50,16 @@ function g(t, o, f) {
|
|
|
50
50
|
return !1;
|
|
51
51
|
s++;
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
c === "MultiLineString" && l++, c === "Polygon" && a++;
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
c === "Polygon" && l++;
|
|
56
56
|
break;
|
|
57
57
|
case "MultiPolygon":
|
|
58
58
|
for (i = 0; i < r.length; i++) {
|
|
59
59
|
for (a = 0, n = 0; n < r[i].length; n++) {
|
|
60
|
-
for (
|
|
60
|
+
for (y = 0; y < r[i][n].length - u; y++) {
|
|
61
61
|
if (o(
|
|
62
|
-
r[i][n][
|
|
62
|
+
r[i][n][y],
|
|
63
63
|
s,
|
|
64
64
|
e,
|
|
65
65
|
l,
|
|
@@ -93,6 +93,7 @@ function G(t, o = {}) {
|
|
|
93
93
|
f[0] > i[0] && (f[0] = i[0]), f[1] > i[1] && (f[1] = i[1]), f[2] < i[0] && (f[2] = i[0]), f[3] < i[1] && (f[3] = i[1]);
|
|
94
94
|
}), f;
|
|
95
95
|
}
|
|
96
|
+
var S = G;
|
|
96
97
|
export {
|
|
97
|
-
|
|
98
|
+
S as t
|
|
98
99
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as f, Fragment as x } from "react/jsx-runtime";
|
|
2
2
|
import * as $ from "react";
|
|
3
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-
|
|
4
|
+
import { b as C, d as u } from "./logo-control-CHapR1Dt.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 z(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 = "", r = 0;
|
|
21
21
|
for (const o in e)
|
|
@@ -45,7 +45,7 @@ function A(t, e, n) {
|
|
|
45
45
|
console.warn(`Unable to update <Source> prop: ${a}`);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function A(t) {
|
|
49
49
|
const e = S(C).map.getMap(), n = k(t), [, a] = b(0), r = g(() => t.id || `jsx-source-${M++}`, []);
|
|
50
50
|
w(() => {
|
|
51
51
|
if (e) {
|
|
@@ -54,39 +54,39 @@ function E(t) {
|
|
|
54
54
|
if (e.off("styledata", o), e.style && e.style._loaded && e.getSource(r)) {
|
|
55
55
|
const y = e.getStyle()?.layers;
|
|
56
56
|
if (y)
|
|
57
|
-
for (const
|
|
58
|
-
|
|
57
|
+
for (const c of y)
|
|
58
|
+
c.source === r && e.removeLayer(c.id);
|
|
59
59
|
e.removeSource(r);
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
}, [e]);
|
|
64
64
|
let l = e && e.style && e.getSource(r);
|
|
65
|
-
return l ?
|
|
65
|
+
return l ? z(l, t, n.current) : l = R(e, r, t), n.current = t, l && $.Children.map(t.children, (o) => o && j(o, {
|
|
66
66
|
source: r
|
|
67
67
|
})) || null;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function E(t, e, n, a) {
|
|
70
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
71
|
return;
|
|
72
|
-
const { layout: r = {}, paint: l = {}, filter: o, minzoom: y, maxzoom:
|
|
72
|
+
const { layout: r = {}, paint: l = {}, filter: o, minzoom: y, maxzoom: c, beforeId: m } = n;
|
|
73
73
|
if (m !== a.beforeId && t.moveLayer(e, m), r !== a.layout) {
|
|
74
|
-
const
|
|
74
|
+
const d = a.layout || {};
|
|
75
75
|
for (const i in r)
|
|
76
|
-
u(r[i],
|
|
77
|
-
for (const i in
|
|
76
|
+
u(r[i], d[i]) || t.setLayoutProperty(e, i, r[i]);
|
|
77
|
+
for (const i in d)
|
|
78
78
|
r.hasOwnProperty(i) || t.setLayoutProperty(e, i, void 0);
|
|
79
79
|
}
|
|
80
80
|
if (l !== a.paint) {
|
|
81
|
-
const
|
|
81
|
+
const d = a.paint || {};
|
|
82
82
|
for (const i in l)
|
|
83
|
-
u(l[i],
|
|
84
|
-
for (const i in
|
|
83
|
+
u(l[i], d[i]) || t.setPaintProperty(e, i, l[i]);
|
|
84
|
+
for (const i in d)
|
|
85
85
|
l.hasOwnProperty(i) || t.setPaintProperty(e, i, void 0);
|
|
86
86
|
}
|
|
87
|
-
u(o, a.filter) || t.setFilter(e, o), (y !== a.minzoom ||
|
|
87
|
+
u(o, a.filter) || t.setFilter(e, o), (y !== a.minzoom || c !== a.maxzoom) && t.setLayerZoomRange(e, y, c);
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function F(t, e, n) {
|
|
90
90
|
if (t.style && t.style._loaded && (!("source" in n) || t.getSource(n.source))) {
|
|
91
91
|
const a = { ...n, id: e };
|
|
92
92
|
delete a.beforeId, t.addLayer(a, n.beforeId);
|
|
@@ -104,12 +104,12 @@ function h(t) {
|
|
|
104
104
|
}
|
|
105
105
|
}, [e]), e && e.style && e.getLayer(r))
|
|
106
106
|
try {
|
|
107
|
-
|
|
107
|
+
E(e, r, t, n.current);
|
|
108
108
|
} catch (o) {
|
|
109
109
|
console.warn(o);
|
|
110
110
|
}
|
|
111
111
|
else
|
|
112
|
-
|
|
112
|
+
F(e, r, t);
|
|
113
113
|
return n.current = t, null;
|
|
114
114
|
}
|
|
115
115
|
function L(t, e, n) {
|
|
@@ -133,7 +133,7 @@ function T({ sources: t }) {
|
|
|
133
133
|
...n,
|
|
134
134
|
geoJson: n.geometry ? I(n.geometry, n.type) : null
|
|
135
135
|
})), [t]);
|
|
136
|
-
return e?.length === 0 ? null : /* @__PURE__ */
|
|
136
|
+
return e?.length === 0 ? null : /* @__PURE__ */ f(x, { children: e?.map((n) => /* @__PURE__ */ f("div", { children: n.geoJson && /* @__PURE__ */ f(A, { id: n.key, type: "geojson", data: n.geoJson, children: n.layer && (Array.isArray(n.layer) ? n.layer.map((a, r) => /* @__PURE__ */ f(
|
|
137
137
|
h,
|
|
138
138
|
{
|
|
139
139
|
id: `${n.key}-${r}`,
|
|
@@ -141,7 +141,7 @@ function T({ sources: t }) {
|
|
|
141
141
|
paint: L(a.type, a.color, n.type)
|
|
142
142
|
},
|
|
143
143
|
`${n.key}-${r}`
|
|
144
|
-
)) : /* @__PURE__ */
|
|
144
|
+
)) : /* @__PURE__ */ f(
|
|
145
145
|
h,
|
|
146
146
|
{
|
|
147
147
|
id: n.key,
|
|
@@ -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 z, P as D } from "./scale-control-Dsir9fWY.js";
|
|
4
|
+
import { u as H, P as T } from "./index-Ct-3yYUx.js";
|
|
5
|
+
import { c as j, m as A } from "./styles-BNaT0cTi.js";
|
|
6
|
+
function Z({
|
|
7
|
+
latitude: h,
|
|
8
|
+
longitude: l,
|
|
9
|
+
anchor: B,
|
|
10
|
+
offset: C = [0, -35],
|
|
11
|
+
onClose: a,
|
|
12
|
+
children: O
|
|
13
|
+
}) {
|
|
14
|
+
const p = d(null), { current: n } = z(), { activeMarker: e, clusterPoints: u, mapPadding: t } = H(), 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 x = () => {
|
|
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 y = Math.abs(r.width - o.width), I = Math.abs(r.height - o.height);
|
|
28
|
+
if (o.width !== 0 && y < T && I < T)
|
|
29
|
+
return;
|
|
30
|
+
o = { width: r.width, height: r.height };
|
|
31
|
+
const R = f.getBoundingClientRect(), N = {
|
|
32
|
+
width: f.clientWidth,
|
|
33
|
+
height: f.clientHeight,
|
|
34
|
+
top: R.top,
|
|
35
|
+
left: R.left
|
|
36
|
+
}, S = {
|
|
37
|
+
latitude: P.lat,
|
|
38
|
+
longitude: P.lng
|
|
39
|
+
}, _ = {
|
|
40
|
+
left: c.getWest(),
|
|
41
|
+
right: c.getEast(),
|
|
42
|
+
top: c.getNorth(),
|
|
43
|
+
bottom: c.getSouth()
|
|
44
|
+
}, k = {
|
|
45
|
+
left: t.left || 0,
|
|
46
|
+
right: t.right || 0,
|
|
47
|
+
top: t.top || 0,
|
|
48
|
+
bottom: t.bottom || 0
|
|
49
|
+
};
|
|
50
|
+
A(r, S, _, N, k, (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
|
+
x();
|
|
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 h > "u" || typeof l > "u" ? null : /* @__PURE__ */ E(
|
|
75
|
+
D,
|
|
76
|
+
{
|
|
77
|
+
ref: p,
|
|
78
|
+
className: "mapbox-popup",
|
|
79
|
+
focusAfterOpen: !0,
|
|
80
|
+
latitude: h,
|
|
81
|
+
longitude: l,
|
|
82
|
+
anchor: B,
|
|
83
|
+
offset: C,
|
|
84
|
+
onClose: a,
|
|
85
|
+
closeButton: !1,
|
|
86
|
+
children: /* @__PURE__ */ E("div", { className: j, children: O })
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
Z as default
|
|
92
|
+
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { jsxs as e, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { t as
|
|
3
|
-
import { a as
|
|
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 "./scale-control-Dsir9fWY.js";
|
|
4
4
|
import "react";
|
|
5
|
+
import { HouseLineIcon as l } from "@phosphor-icons/react";
|
|
5
6
|
function b({ marker: t, className: n }) {
|
|
6
7
|
return /* @__PURE__ */ e(
|
|
7
|
-
|
|
8
|
+
d,
|
|
8
9
|
{
|
|
9
10
|
anchor: "bottom",
|
|
10
11
|
longitude: t.longitude,
|
|
11
12
|
latitude: t.latitude,
|
|
12
|
-
className:
|
|
13
|
+
className: o(c.trim(), n),
|
|
13
14
|
children: [
|
|
14
|
-
/* @__PURE__ */ i("span", { id: "center-pin-background", className:
|
|
15
|
-
/* @__PURE__ */ i(
|
|
15
|
+
/* @__PURE__ */ i("span", { id: "center-pin-background", className: a, children: /* @__PURE__ */ i(r, {}) }),
|
|
16
|
+
/* @__PURE__ */ i(l, { id: "center-pin-icon", className: s })
|
|
16
17
|
]
|
|
17
18
|
},
|
|
18
19
|
`center-pin-marker-${t.longitude}-${t.latitude}`
|
package/dist/index.es.js
CHANGED