@local-logic/maps 0.0.5 → 0.0.6
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/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/index-B43MtiHH.js +30 -0
- package/dist/index-BAAE2pMq.js +64 -0
- package/dist/index-BHjgd5HB.js +29 -0
- package/dist/index-BZ2605rA.js +39 -0
- package/dist/index-B_LO5X9C.js +46 -0
- package/dist/index-BbrOUWDy.js +29 -0
- package/dist/index-Bd-X-1Gd.js +42 -0
- package/dist/index-CPq7k7F4.js +63 -0
- package/dist/index-CTk5bvm9.js +155 -0
- package/dist/index-CXLLvdx4.js +670 -0
- package/dist/index-CXjxZmYt.js +144 -0
- package/dist/index-DHw9gU4K.js +29 -0
- package/dist/index-DVitM43i.js +137 -0
- package/dist/index-J1MKzGEM.js +31 -0
- package/dist/index-qqbvBkdn.js +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +4 -0
- package/dist/index.modern-EsUgbhzI.js +908 -0
- package/dist/index.umd.js +3181 -0
- package/dist/logo-control-NE-LlsRy.js +607 -0
- package/dist/mapbox-gl-D58OubwB.js +32266 -0
- package/dist/maplibre-gl-CfOZKUDd.js +20722 -0
- package/dist/scale-control-CyJd4u6j.js +716 -0
- package/dist/src/components/Map/Root/BaseMap/Empty/index.d.ts +3 -0
- package/dist/src/components/Map/Root/BaseMap/Empty/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/BaseMap/Google/index.d.ts +11 -0
- package/dist/src/components/Map/Root/BaseMap/Google/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/BaseMap/Mapbox/index.d.ts +4 -0
- package/dist/src/components/Map/Root/BaseMap/Mapbox/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/BaseMap/Maptiler/index.d.ts +4 -0
- package/dist/src/components/Map/Root/BaseMap/Maptiler/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/BaseMap/index.d.ts +4 -0
- package/dist/src/components/Map/Root/BaseMap/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/BaseMap/styles.d.ts +2 -0
- package/dist/src/components/Map/Root/BaseMap/styles.d.ts.map +1 -0
- package/dist/src/components/Map/Root/BaseMap/types.d.ts +3 -0
- package/dist/src/components/Map/Root/BaseMap/types.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Layers/Google/index.d.ts +4 -0
- package/dist/src/components/Map/Root/Layers/Google/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Layers/Mapbox/index.d.ts +4 -0
- package/dist/src/components/Map/Root/Layers/Mapbox/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Layers/Maptiler/index.d.ts +4 -0
- package/dist/src/components/Map/Root/Layers/Maptiler/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Layers/index.d.ts +4 -0
- package/dist/src/components/Map/Root/Layers/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Layers/types.d.ts +13 -0
- package/dist/src/components/Map/Root/Layers/types.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Layers/utils.d.ts +6 -0
- package/dist/src/components/Map/Root/Layers/utils.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Markers/Cluster/index.d.ts +6 -0
- package/dist/src/components/Map/Root/Markers/Cluster/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Markers/Cluster/styles.d.ts +2 -0
- package/dist/src/components/Map/Root/Markers/Cluster/styles.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Markers/Google/index.d.ts +4 -0
- package/dist/src/components/Map/Root/Markers/Google/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Markers/Mapbox/index.d.ts +4 -0
- package/dist/src/components/Map/Root/Markers/Mapbox/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Markers/Maptiler/index.d.ts +4 -0
- package/dist/src/components/Map/Root/Markers/Maptiler/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Markers/index.d.ts +4 -0
- package/dist/src/components/Map/Root/Markers/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Markers/styles.d.ts +5 -0
- package/dist/src/components/Map/Root/Markers/styles.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Markers/types.d.ts +28 -0
- package/dist/src/components/Map/Root/Markers/types.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Popup/Google/index.d.ts +4 -0
- package/dist/src/components/Map/Root/Popup/Google/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Popup/Mapbox/index.d.ts +4 -0
- package/dist/src/components/Map/Root/Popup/Mapbox/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Popup/Maptiler/index.d.ts +4 -0
- package/dist/src/components/Map/Root/Popup/Maptiler/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Popup/index.d.ts +4 -0
- package/dist/src/components/Map/Root/Popup/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Popup/styles.d.ts +2 -0
- package/dist/src/components/Map/Root/Popup/styles.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Popup/types.d.ts +10 -0
- package/dist/src/components/Map/Root/Popup/types.d.ts.map +1 -0
- package/dist/src/components/Map/Root/constants.d.ts +7 -0
- package/dist/src/components/Map/Root/constants.d.ts.map +1 -0
- package/dist/src/components/Map/Root/context.d.ts +11 -0
- package/dist/src/components/Map/Root/context.d.ts.map +1 -0
- package/dist/src/components/Map/Root/index.d.ts +11 -0
- package/dist/src/components/Map/Root/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/types.d.ts +26 -0
- package/dist/src/components/Map/Root/types.d.ts.map +1 -0
- package/dist/src/components/Map/index.d.ts +2 -0
- package/dist/src/components/Map/index.d.ts.map +1 -0
- package/dist/src/components/Map/index.stories.d.ts +8 -0
- package/dist/src/components/Map/index.stories.d.ts.map +1 -0
- package/dist/src/components/Map/index.test.d.ts +2 -0
- package/dist/src/components/Map/index.test.d.ts.map +1 -0
- package/dist/src/components/Map/storybook-data.d.ts +18 -0
- package/dist/src/components/Map/storybook-data.d.ts.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/{src/components/Map/Root/Popup/styles.ts → dist/styles-uPzJnzVS.js} +4 -1
- package/dist/utils-YqJg0vBb.js +25 -0
- package/package.json +14 -2
- package/.env.example +0 -3
- package/.storybook/defaults.ts +0 -40
- package/.storybook/globals.css +0 -40
- package/.storybook/main.ts +0 -19
- package/.storybook/preview.tsx +0 -27
- package/CHANGELOG.md +0 -33
- package/eslint.config.mjs +0 -46
- package/lint-staged.config.cjs +0 -4
- package/postcss.config.cjs +0 -6
- package/prettier.config.cjs +0 -1
- package/src/components/Map/Root/BaseMap/Empty/index.tsx +0 -7
- package/src/components/Map/Root/BaseMap/Google/index.tsx +0 -96
- package/src/components/Map/Root/BaseMap/Mapbox/index.tsx +0 -66
- package/src/components/Map/Root/BaseMap/Maptiler/index.tsx +0 -59
- package/src/components/Map/Root/BaseMap/index.tsx +0 -34
- package/src/components/Map/Root/BaseMap/styles.ts +0 -1
- package/src/components/Map/Root/BaseMap/types.ts +0 -3
- package/src/components/Map/Root/Layers/Google/index.tsx +0 -97
- package/src/components/Map/Root/Layers/Mapbox/index.tsx +0 -74
- package/src/components/Map/Root/Layers/Maptiler/index.tsx +0 -74
- package/src/components/Map/Root/Layers/index.tsx +0 -32
- package/src/components/Map/Root/Layers/types.ts +0 -15
- package/src/components/Map/Root/Layers/utils.ts +0 -64
- package/src/components/Map/Root/Markers/Cluster/index.tsx +0 -27
- package/src/components/Map/Root/Markers/Cluster/styles.ts +0 -11
- package/src/components/Map/Root/Markers/Google/index.tsx +0 -49
- package/src/components/Map/Root/Markers/Mapbox/index.tsx +0 -52
- package/src/components/Map/Root/Markers/Maptiler/index.tsx +0 -52
- package/src/components/Map/Root/Markers/index.tsx +0 -81
- package/src/components/Map/Root/Markers/styles.ts +0 -39
- package/src/components/Map/Root/Markers/types.ts +0 -32
- package/src/components/Map/Root/Popup/Google/index.tsx +0 -57
- package/src/components/Map/Root/Popup/Google/popup.css +0 -15
- package/src/components/Map/Root/Popup/Mapbox/index.tsx +0 -36
- package/src/components/Map/Root/Popup/Mapbox/popup.css +0 -15
- package/src/components/Map/Root/Popup/Maptiler/index.tsx +0 -37
- package/src/components/Map/Root/Popup/Maptiler/popup.css +0 -15
- package/src/components/Map/Root/Popup/index.tsx +0 -32
- package/src/components/Map/Root/Popup/types.ts +0 -20
- package/src/components/Map/Root/constants.ts +0 -6
- package/src/components/Map/Root/context.tsx +0 -15
- package/src/components/Map/Root/index.tsx +0 -30
- package/src/components/Map/Root/types.ts +0 -30
- package/src/components/Map/index.stories.tsx +0 -134
- package/src/components/Map/index.test.tsx +0 -16
- package/src/components/Map/index.tsx +0 -1
- package/src/components/Map/storybook-data.ts +0 -255
- package/src/index.ts +0 -1
- package/tailwind.config.cjs +0 -1
- package/tsconfig.json +0 -14
- package/tsconfig.node.json +0 -8
- package/vite-env.d.ts +0 -13
- package/vite.config.ts +0 -46
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { P as a } from "./scale-control-CyJd4u6j.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { c as s } from "./styles-uPzJnzVS.js";
|
|
5
|
+
function l({
|
|
6
|
+
latitude: o,
|
|
7
|
+
longitude: e,
|
|
8
|
+
anchor: r,
|
|
9
|
+
offset: f = [0, -35],
|
|
10
|
+
onClose: n,
|
|
11
|
+
children: t
|
|
12
|
+
}) {
|
|
13
|
+
return typeof o > "u" || typeof e > "u" ? null : /* @__PURE__ */ p(
|
|
14
|
+
a,
|
|
15
|
+
{
|
|
16
|
+
className: "mapbox-popup",
|
|
17
|
+
focusAfterOpen: !0,
|
|
18
|
+
latitude: o,
|
|
19
|
+
longitude: e,
|
|
20
|
+
anchor: r,
|
|
21
|
+
offset: f,
|
|
22
|
+
onClose: n,
|
|
23
|
+
closeButton: !1,
|
|
24
|
+
children: /* @__PURE__ */ p("div", { className: s, children: t })
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
l as default
|
|
30
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsxs as g, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as T, useEffect as M } from "react";
|
|
3
|
+
import { A as b, M as h, C as a, u as C } from "./index.modern-EsUgbhzI.js";
|
|
4
|
+
import { u, d as n } from "./index-CXLLvdx4.js";
|
|
5
|
+
const O = {
|
|
6
|
+
"top-left": a.LEFT_TOP,
|
|
7
|
+
"top-right": a.RIGHT_TOP,
|
|
8
|
+
"bottom-left": a.LEFT_BOTTOM,
|
|
9
|
+
"bottom-right": a.RIGHT_BOTTOM
|
|
10
|
+
}, P = "a7ff20eb973126bb", I = ({ isMapLoaded: s }) => {
|
|
11
|
+
const e = C(), { setBounds: r } = u();
|
|
12
|
+
return M(() => {
|
|
13
|
+
var t;
|
|
14
|
+
if (!s || !e)
|
|
15
|
+
return;
|
|
16
|
+
const o = (t = e.getBounds()) == null ? void 0 : t.toJSON();
|
|
17
|
+
o && r([o.west, o.south, o.east, o.north]);
|
|
18
|
+
}, [s, e]), null;
|
|
19
|
+
};
|
|
20
|
+
function L({ children: s }) {
|
|
21
|
+
const [e, r] = T(!1), {
|
|
22
|
+
mapProvider: o,
|
|
23
|
+
center: t,
|
|
24
|
+
zoom: p = n.zoom,
|
|
25
|
+
pitch: d = n.pitch,
|
|
26
|
+
bearing: f = n.bearing,
|
|
27
|
+
cooperativeGestures: c = n.cooperativeGestures,
|
|
28
|
+
zoomPosition: l
|
|
29
|
+
} = u();
|
|
30
|
+
if (o.name !== "google")
|
|
31
|
+
return null;
|
|
32
|
+
const m = () => {
|
|
33
|
+
r(!0);
|
|
34
|
+
};
|
|
35
|
+
return /* @__PURE__ */ g(b, { apiKey: o.apiKey, children: [
|
|
36
|
+
/* @__PURE__ */ i(I, { isMapLoaded: e }),
|
|
37
|
+
/* @__PURE__ */ i(
|
|
38
|
+
h,
|
|
39
|
+
{
|
|
40
|
+
mapId: P,
|
|
41
|
+
defaultCenter: {
|
|
42
|
+
lat: t.latitude,
|
|
43
|
+
lng: t.longitude
|
|
44
|
+
},
|
|
45
|
+
defaultZoom: p,
|
|
46
|
+
defaultTilt: d,
|
|
47
|
+
defaultHeading: f,
|
|
48
|
+
gestureHandling: c ? "cooperative" : "greedy",
|
|
49
|
+
streetViewControl: !1,
|
|
50
|
+
fullscreenControl: !1,
|
|
51
|
+
clickableIcons: !1,
|
|
52
|
+
mapTypeControl: !1,
|
|
53
|
+
zoomControlOptions: {
|
|
54
|
+
position: l && O[l]
|
|
55
|
+
},
|
|
56
|
+
onTilesLoaded: m,
|
|
57
|
+
children: s
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
] });
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
L as default
|
|
64
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as r, jsxs as s, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
import { C as c, M as l } from "./index-CXjxZmYt.js";
|
|
3
|
+
import { a as f } from "./index.modern-EsUgbhzI.js";
|
|
4
|
+
import { c as g, i as h, a as t } from "./index-CXLLvdx4.js";
|
|
5
|
+
function j({ clusters: e, onClick: o, children: m }) {
|
|
6
|
+
return e == null ? void 0 : e.map((a, p) => {
|
|
7
|
+
const i = a.geometry.coordinates[0], n = a.geometry.coordinates[1];
|
|
8
|
+
return /* @__PURE__ */ r(
|
|
9
|
+
f,
|
|
10
|
+
{
|
|
11
|
+
position: {
|
|
12
|
+
lat: n,
|
|
13
|
+
lng: i
|
|
14
|
+
},
|
|
15
|
+
onClick: () => {
|
|
16
|
+
o == null || o(a);
|
|
17
|
+
},
|
|
18
|
+
children: /* @__PURE__ */ r("div", { className: g, "data-is-cluster": !!a.properties.cluster, children: a.properties.cluster ? /* @__PURE__ */ r(c, { cluster: a }) : /* @__PURE__ */ s(d, { children: [
|
|
19
|
+
/* @__PURE__ */ r("div", { className: h, children: a.properties.icon ? /* @__PURE__ */ r(a.properties.icon, { className: t }) : /* @__PURE__ */ r(l, { className: t }) }),
|
|
20
|
+
m
|
|
21
|
+
] }) })
|
|
22
|
+
},
|
|
23
|
+
`map-marker-${i}-${n}-${p}`
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
j as default
|
|
29
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as m, useMemo as o } from "react";
|
|
3
|
+
import { u as s, I as d } from "./index.modern-EsUgbhzI.js";
|
|
4
|
+
import { c as f } from "./styles-uPzJnzVS.js";
|
|
5
|
+
function v({
|
|
6
|
+
latitude: n,
|
|
7
|
+
longitude: t,
|
|
8
|
+
offset: r = [0, -25],
|
|
9
|
+
onClose: e,
|
|
10
|
+
children: a
|
|
11
|
+
}) {
|
|
12
|
+
const i = s();
|
|
13
|
+
m(() => {
|
|
14
|
+
if (!i) return;
|
|
15
|
+
const c = i.addListener("click", () => {
|
|
16
|
+
e == null || e();
|
|
17
|
+
});
|
|
18
|
+
return () => {
|
|
19
|
+
c.remove();
|
|
20
|
+
};
|
|
21
|
+
}, [i]);
|
|
22
|
+
const p = o(() => Array.isArray(r) ? [r[0], r[1]] : [r, r], [r]);
|
|
23
|
+
return typeof n > "u" || typeof t > "u" ? null : /* @__PURE__ */ u(
|
|
24
|
+
d,
|
|
25
|
+
{
|
|
26
|
+
shouldFocus: !0,
|
|
27
|
+
position: {
|
|
28
|
+
lat: n,
|
|
29
|
+
lng: t
|
|
30
|
+
},
|
|
31
|
+
pixelOffset: p,
|
|
32
|
+
onClose: e,
|
|
33
|
+
children: /* @__PURE__ */ u("div", { className: f, children: a })
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
v as default
|
|
39
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsxs as c, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as l } from "react";
|
|
3
|
+
import { M as f, N as b, u as d } from "./scale-control-CyJd4u6j.js";
|
|
4
|
+
import { u as n, d as r } from "./index-CXLLvdx4.js";
|
|
5
|
+
const x = () => {
|
|
6
|
+
const { current: o } = d(), { setBounds: t } = n();
|
|
7
|
+
return l(() => {
|
|
8
|
+
if (!o)
|
|
9
|
+
return;
|
|
10
|
+
const e = o.getBounds();
|
|
11
|
+
e && t(e.toArray().flat());
|
|
12
|
+
}, [o]), null;
|
|
13
|
+
};
|
|
14
|
+
function h({ children: o }) {
|
|
15
|
+
const {
|
|
16
|
+
mapProvider: t,
|
|
17
|
+
center: e,
|
|
18
|
+
zoom: i = r.zoom,
|
|
19
|
+
pitch: p = r.pitch,
|
|
20
|
+
bearing: u = r.bearing,
|
|
21
|
+
cooperativeGestures: m = r.cooperativeGestures,
|
|
22
|
+
zoomPosition: a
|
|
23
|
+
} = n();
|
|
24
|
+
return t.name !== "mapbox" ? null : /* @__PURE__ */ c(
|
|
25
|
+
f,
|
|
26
|
+
{
|
|
27
|
+
mapboxAccessToken: t.apiKey,
|
|
28
|
+
initialViewState: {
|
|
29
|
+
...e,
|
|
30
|
+
zoom: i,
|
|
31
|
+
pitch: p,
|
|
32
|
+
bearing: u
|
|
33
|
+
},
|
|
34
|
+
cooperativeGestures: m,
|
|
35
|
+
mapStyle: "mapbox://styles/mapbox/streets-v9",
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ s(x, {}),
|
|
38
|
+
a && /* @__PURE__ */ s(b, { position: a }),
|
|
39
|
+
o
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
h as default
|
|
46
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as r, jsxs as d, Fragment as c } from "react/jsx-runtime";
|
|
2
|
+
import { C as h, M as f } from "./index-CXjxZmYt.js";
|
|
3
|
+
import { a as g } from "./scale-control-CyJd4u6j.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { c as l, i as x, a as t } from "./index-CXLLvdx4.js";
|
|
6
|
+
function k({ clusters: o, onClick: e, children: p }) {
|
|
7
|
+
return o == null ? void 0 : o.map((a, m) => {
|
|
8
|
+
const i = a.geometry.coordinates[0], n = a.geometry.coordinates[1];
|
|
9
|
+
return /* @__PURE__ */ r(
|
|
10
|
+
g,
|
|
11
|
+
{
|
|
12
|
+
anchor: "bottom",
|
|
13
|
+
longitude: i,
|
|
14
|
+
latitude: n,
|
|
15
|
+
onClick: (s) => {
|
|
16
|
+
s.originalEvent.stopPropagation(), e == null || e(a);
|
|
17
|
+
},
|
|
18
|
+
children: /* @__PURE__ */ r("div", { className: l, "data-is-cluster": !!a.properties.cluster, children: a.properties.cluster ? /* @__PURE__ */ r(h, { cluster: a }) : /* @__PURE__ */ d(c, { children: [
|
|
19
|
+
/* @__PURE__ */ r("div", { className: x, children: a.properties.icon ? /* @__PURE__ */ r(a.properties.icon, { className: t }) : /* @__PURE__ */ r(f, { className: t }) }),
|
|
20
|
+
p
|
|
21
|
+
] }) })
|
|
22
|
+
},
|
|
23
|
+
`map-marker-${i}-${n}-${m}`
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
k as default
|
|
29
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsxs as l, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as c } from "react";
|
|
3
|
+
import { M as f, N as d, u as M } from "./logo-control-NE-LlsRy.js";
|
|
4
|
+
import { u as i, d as o } from "./index-CXLLvdx4.js";
|
|
5
|
+
const h = () => {
|
|
6
|
+
const { current: t } = M(), { setBounds: e } = i();
|
|
7
|
+
return c(() => {
|
|
8
|
+
t && e(t.getBounds().toArray().flat());
|
|
9
|
+
}, [t]), null;
|
|
10
|
+
};
|
|
11
|
+
function x({ children: t }) {
|
|
12
|
+
const {
|
|
13
|
+
mapProvider: e,
|
|
14
|
+
center: s,
|
|
15
|
+
zoom: n = o.zoom,
|
|
16
|
+
pitch: p = o.pitch,
|
|
17
|
+
bearing: m = o.bearing,
|
|
18
|
+
cooperativeGestures: u = o.cooperativeGestures,
|
|
19
|
+
zoomPosition: r
|
|
20
|
+
} = i();
|
|
21
|
+
return e.name !== "maptiler" ? null : /* @__PURE__ */ l(
|
|
22
|
+
f,
|
|
23
|
+
{
|
|
24
|
+
initialViewState: {
|
|
25
|
+
...s,
|
|
26
|
+
zoom: n,
|
|
27
|
+
pitch: p,
|
|
28
|
+
bearing: m
|
|
29
|
+
},
|
|
30
|
+
cooperativeGestures: u,
|
|
31
|
+
mapStyle: `https://api.maptiler.com/maps/${e.maptilerTheme}/style.json?key=${e.apiKey}`,
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ a(h, {}),
|
|
34
|
+
r && /* @__PURE__ */ a(d, { position: r }),
|
|
35
|
+
t
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
x as default
|
|
42
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as u, Fragment as h } from "react/jsx-runtime";
|
|
2
|
+
import { useState as i, useContext as P, useEffect as c } from "react";
|
|
3
|
+
import { G as M } from "./index.modern-EsUgbhzI.js";
|
|
4
|
+
import { a as x } from "./utils-YqJg0vBb.js";
|
|
5
|
+
function f(a, e) {
|
|
6
|
+
switch (a) {
|
|
7
|
+
case "fill":
|
|
8
|
+
return {
|
|
9
|
+
fillColor: e,
|
|
10
|
+
fillOpacity: 0.25
|
|
11
|
+
};
|
|
12
|
+
case "line":
|
|
13
|
+
return {
|
|
14
|
+
strokeColor: e,
|
|
15
|
+
strokeWeight: 2
|
|
16
|
+
};
|
|
17
|
+
default:
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function d({ sources: a }) {
|
|
22
|
+
const [e, m] = i(null), [p, y] = i([]), o = P(M);
|
|
23
|
+
return c(() => {
|
|
24
|
+
o && m(o.map);
|
|
25
|
+
}, [o]), c(() => {
|
|
26
|
+
if (p.forEach((t) => {
|
|
27
|
+
t == null || t.setMap(null);
|
|
28
|
+
}), !e || typeof a > "u" || a.length === 0)
|
|
29
|
+
return;
|
|
30
|
+
const n = a.map((t) => {
|
|
31
|
+
const l = {
|
|
32
|
+
paths: x(t.geometry)
|
|
33
|
+
};
|
|
34
|
+
if (Array.isArray(t.layer))
|
|
35
|
+
t.layer.forEach((r) => {
|
|
36
|
+
const g = f(r.type, r.color);
|
|
37
|
+
Object.assign(l, g);
|
|
38
|
+
});
|
|
39
|
+
else {
|
|
40
|
+
const r = f(t.layer.type, t.layer.color);
|
|
41
|
+
Object.assign(l, r);
|
|
42
|
+
}
|
|
43
|
+
const s = new google.maps.Polygon({
|
|
44
|
+
// Set default options otherwise the polygon remains visible (even if eg: we only want the outline)
|
|
45
|
+
// We then overrider the default options with the layer options
|
|
46
|
+
strokeWeight: 0,
|
|
47
|
+
fillOpacity: 0,
|
|
48
|
+
...l
|
|
49
|
+
});
|
|
50
|
+
return s.setMap(e), s;
|
|
51
|
+
});
|
|
52
|
+
return y(n), n.forEach((t) => {
|
|
53
|
+
t.setMap(e);
|
|
54
|
+
}), () => {
|
|
55
|
+
n.forEach((t) => {
|
|
56
|
+
t == null || t.setMap(null);
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
}, [e, a]), /* @__PURE__ */ u(h, {});
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
d as default
|
|
63
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsx as u, Fragment as C } from "react/jsx-runtime";
|
|
2
|
+
import * as j from "react";
|
|
3
|
+
import { useContext as k, useRef as S, useState as b, useMemo as m, useEffect as w, cloneElement as I } from "react";
|
|
4
|
+
import { b as x, d as s } from "./logo-control-NE-LlsRy.js";
|
|
5
|
+
import { g as M } from "./utils-YqJg0vBb.js";
|
|
6
|
+
function g(t, e) {
|
|
7
|
+
if (!t)
|
|
8
|
+
throw new Error(e);
|
|
9
|
+
}
|
|
10
|
+
let $ = 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
|
+
var l, y, d;
|
|
20
|
+
g(e.id === n.id, "source id changed"), g(e.type === n.type, "source type changed");
|
|
21
|
+
let a = "", i = 0;
|
|
22
|
+
for (const f in e)
|
|
23
|
+
f !== "children" && f !== "id" && !s(n[f], e[f]) && (a = f, i++);
|
|
24
|
+
if (!i)
|
|
25
|
+
return;
|
|
26
|
+
const r = e.type;
|
|
27
|
+
if (r === "geojson")
|
|
28
|
+
t.setData(e.data);
|
|
29
|
+
else if (r === "image")
|
|
30
|
+
t.updateImage({
|
|
31
|
+
url: e.url,
|
|
32
|
+
coordinates: e.coordinates
|
|
33
|
+
});
|
|
34
|
+
else
|
|
35
|
+
switch (a) {
|
|
36
|
+
case "coordinates":
|
|
37
|
+
(l = t.setCoordinates) == null || l.call(t, e.coordinates);
|
|
38
|
+
break;
|
|
39
|
+
case "url":
|
|
40
|
+
(y = t.setUrl) == null || y.call(t, e.url);
|
|
41
|
+
break;
|
|
42
|
+
case "tiles":
|
|
43
|
+
(d = t.setTiles) == null || d.call(t, e.tiles);
|
|
44
|
+
break;
|
|
45
|
+
default:
|
|
46
|
+
console.warn(`Unable to update <Source> prop: ${a}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function E(t) {
|
|
50
|
+
const e = k(x).map.getMap(), n = S(t), [, a] = b(0), i = m(() => t.id || `jsx-source-${$++}`, []);
|
|
51
|
+
w(() => {
|
|
52
|
+
if (e) {
|
|
53
|
+
const l = () => setTimeout(() => a((y) => y + 1), 0);
|
|
54
|
+
return e.on("styledata", l), l(), () => {
|
|
55
|
+
var y;
|
|
56
|
+
if (e.off("styledata", l), e.style && e.style._loaded && e.getSource(i)) {
|
|
57
|
+
const d = (y = e.getStyle()) == null ? void 0 : y.layers;
|
|
58
|
+
if (d)
|
|
59
|
+
for (const f of d)
|
|
60
|
+
f.source === i && e.removeLayer(f.id);
|
|
61
|
+
e.removeSource(i);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}, [e]);
|
|
66
|
+
let r = e && e.style && e.getSource(i);
|
|
67
|
+
return r ? A(r, t, n.current) : r = z(e, i, t), n.current = t, r && j.Children.map(t.children, (l) => l && I(l, {
|
|
68
|
+
source: i
|
|
69
|
+
})) || null;
|
|
70
|
+
}
|
|
71
|
+
function F(t, e, n, a) {
|
|
72
|
+
if (g(n.id === a.id, "layer id changed"), g(n.type === a.type, "layer type changed"), n.type === "custom" || a.type === "custom")
|
|
73
|
+
return;
|
|
74
|
+
const { layout: i = {}, paint: r = {}, filter: l, minzoom: y, maxzoom: d, beforeId: f } = n;
|
|
75
|
+
if (f !== a.beforeId && t.moveLayer(e, f), i !== a.layout) {
|
|
76
|
+
const c = a.layout || {};
|
|
77
|
+
for (const o in i)
|
|
78
|
+
s(i[o], c[o]) || t.setLayoutProperty(e, o, i[o]);
|
|
79
|
+
for (const o in c)
|
|
80
|
+
i.hasOwnProperty(o) || t.setLayoutProperty(e, o, void 0);
|
|
81
|
+
}
|
|
82
|
+
if (r !== a.paint) {
|
|
83
|
+
const c = a.paint || {};
|
|
84
|
+
for (const o in r)
|
|
85
|
+
s(r[o], c[o]) || t.setPaintProperty(e, o, r[o]);
|
|
86
|
+
for (const o in c)
|
|
87
|
+
r.hasOwnProperty(o) || t.setPaintProperty(e, o, void 0);
|
|
88
|
+
}
|
|
89
|
+
s(l, a.filter) || t.setFilter(e, l), (y !== a.minzoom || d !== a.maxzoom) && t.setLayerZoomRange(e, y, d);
|
|
90
|
+
}
|
|
91
|
+
function R(t, e, n) {
|
|
92
|
+
if (t.style && t.style._loaded && (!("source" in n) || t.getSource(n.source))) {
|
|
93
|
+
const a = { ...n, id: e };
|
|
94
|
+
delete a.beforeId, t.addLayer(a, n.beforeId);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
let U = 0;
|
|
98
|
+
function h(t) {
|
|
99
|
+
const e = k(x).map.getMap(), n = S(t), [, a] = b(0), i = m(() => t.id || `jsx-layer-${U++}`, []);
|
|
100
|
+
if (w(() => {
|
|
101
|
+
if (e) {
|
|
102
|
+
const l = () => a((y) => y + 1);
|
|
103
|
+
return e.on("styledata", l), l(), () => {
|
|
104
|
+
e.off("styledata", l), e.style && e.style._loaded && e.getLayer(i) && e.removeLayer(i);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}, [e]), e && e.style && e.getLayer(i))
|
|
108
|
+
try {
|
|
109
|
+
F(e, i, t, n.current);
|
|
110
|
+
} catch (l) {
|
|
111
|
+
console.warn(l);
|
|
112
|
+
}
|
|
113
|
+
else
|
|
114
|
+
R(e, i, t);
|
|
115
|
+
return n.current = t, null;
|
|
116
|
+
}
|
|
117
|
+
function L(t, e) {
|
|
118
|
+
switch (t) {
|
|
119
|
+
case "fill":
|
|
120
|
+
return {
|
|
121
|
+
"fill-color": e,
|
|
122
|
+
"fill-opacity": 0.25
|
|
123
|
+
};
|
|
124
|
+
case "line":
|
|
125
|
+
return {
|
|
126
|
+
"line-color": e,
|
|
127
|
+
"line-width": 2
|
|
128
|
+
};
|
|
129
|
+
default:
|
|
130
|
+
return {};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function T({ sources: t }) {
|
|
134
|
+
const e = m(() => !Array.isArray(t) || t.length === 0 ? [] : t.map((n) => ({
|
|
135
|
+
...n,
|
|
136
|
+
geoJson: n.geometry ? M(n.geometry) : null
|
|
137
|
+
})), [t]);
|
|
138
|
+
return (e == null ? void 0 : e.length) === 0 ? null : /* @__PURE__ */ u(C, { children: e == null ? void 0 : e.map((n) => /* @__PURE__ */ u("div", { children: n.geoJson && /* @__PURE__ */ u(E, { id: n.key, type: "geojson", data: n.geoJson, children: n.layer && (Array.isArray(n.layer) ? n.layer.map((a, i) => /* @__PURE__ */ u(
|
|
139
|
+
h,
|
|
140
|
+
{
|
|
141
|
+
type: a.type,
|
|
142
|
+
paint: L(a.type, a.color)
|
|
143
|
+
},
|
|
144
|
+
`${n.key}-${i}`
|
|
145
|
+
)) : /* @__PURE__ */ u(
|
|
146
|
+
h,
|
|
147
|
+
{
|
|
148
|
+
type: n.layer.type,
|
|
149
|
+
paint: L(n.layer.type, n.layer.color)
|
|
150
|
+
}
|
|
151
|
+
)) }, n.key) }, n.key)) });
|
|
152
|
+
}
|
|
153
|
+
export {
|
|
154
|
+
T as default
|
|
155
|
+
};
|