@local-logic/maps 0.0.14 → 0.0.15

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.
Files changed (41) hide show
  1. package/dist/{index-CTk5bvm9.js → index-3kRdcdZh.js} +41 -39
  2. package/dist/{index-DY5pY-zk.js → index-BiSKh6cm.js} +1 -1
  3. package/dist/index-BsV7l4S5.js +57 -0
  4. package/dist/{index-C36u5N_F.js → index-CJL604iU.js} +1 -1
  5. package/dist/{index-Bp1bWq9c.js → index-D4zzctTs.js} +4 -4
  6. package/dist/{index-S5SfktvB.js → index-DAov3leT.js} +1 -1
  7. package/dist/index-DLKjaFD7.js +56 -0
  8. package/dist/{index-CXUQoF5Q.js → index-DQ-QUYzC.js} +1 -1
  9. package/dist/{index-BGoTpJjt.js → index-DcbaLZSy.js} +1 -1
  10. package/dist/{index-CUpaKIZP.js → index-DgzwPaj5.js} +1 -1
  11. package/dist/index-Dxhpxh8s.js +56 -0
  12. package/dist/{index-DVitM43i.js → index-Yh7bUURu.js} +41 -39
  13. package/dist/{index-CBp9gCca.js → index-pGewpik1.js} +29 -29
  14. package/dist/index-x3wrHsPD.js +73 -0
  15. package/dist/index.es.js +1 -1
  16. package/dist/index.umd.js +25 -25
  17. package/dist/src/components/Map/Root/Layers/Google/index.d.ts.map +1 -1
  18. package/dist/src/components/Map/Root/Layers/Mapbox/index.d.ts.map +1 -1
  19. package/dist/src/components/Map/Root/Layers/Maptiler/index.d.ts.map +1 -1
  20. package/dist/src/components/Map/Root/Layers/types.d.ts +1 -0
  21. package/dist/src/components/Map/Root/Layers/types.d.ts.map +1 -1
  22. package/dist/src/components/Map/Root/Layers/utils.d.ts +2 -2
  23. package/dist/src/components/Map/Root/Layers/utils.d.ts.map +1 -1
  24. package/dist/src/components/Map/Root/Markers/Google/index.d.ts.map +1 -1
  25. package/dist/src/components/Map/Root/Markers/Mapbox/index.d.ts.map +1 -1
  26. package/dist/src/components/Map/Root/Markers/Maptiler/index.d.ts.map +1 -1
  27. package/dist/src/components/Map/Root/Markers/styles.d.ts +2 -2
  28. package/dist/src/components/Map/Root/Markers/styles.d.ts.map +1 -1
  29. package/dist/src/components/Map/Root/types.d.ts +2 -0
  30. package/dist/src/components/Map/Root/types.d.ts.map +1 -1
  31. package/dist/src/components/Map/index.stories.d.ts.map +1 -1
  32. package/dist/src/components/Map/storybook-data.d.ts +1 -0
  33. package/dist/src/components/Map/storybook-data.d.ts.map +1 -1
  34. package/dist/style.css +1 -24
  35. package/dist/utils-DJ13veBM.js +25 -0
  36. package/package.json +1 -1
  37. package/dist/index-58w3Qwxr.js +0 -56
  38. package/dist/index-CCtDJ-mV.js +0 -56
  39. package/dist/index-CXTsUiSS.js +0 -57
  40. package/dist/index-UEadmVww.js +0 -64
  41. package/dist/utils-YqJg0vBb.js +0 -25
@@ -1,13 +1,13 @@
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";
1
+ import { jsx as u, Fragment as x } from "react/jsx-runtime";
2
+ import * as $ from "react";
3
+ import { useContext as k, useRef as S, useState as b, useMemo as m, useEffect as w, cloneElement as j } from "react";
4
+ import { b as C, d as s } from "./logo-control-NE-LlsRy.js";
5
+ import { g as I } from "./utils-DJ13veBM.js";
6
6
  function g(t, e) {
7
7
  if (!t)
8
8
  throw new Error(e);
9
9
  }
10
- let $ = 0;
10
+ let M = 0;
11
11
  function z(t, e, n) {
12
12
  if (t.style && t.style._loaded) {
13
13
  const a = { ...n };
@@ -16,17 +16,17 @@ function z(t, e, n) {
16
16
  return null;
17
17
  }
18
18
  function A(t, e, n) {
19
- var l, y, d;
19
+ var l, y, f;
20
20
  g(e.id === n.id, "source id changed"), g(e.type === n.type, "source type changed");
21
21
  let a = "", i = 0;
22
- for (const f in e)
23
- f !== "children" && f !== "id" && !s(n[f], e[f]) && (a = f, i++);
22
+ for (const d in e)
23
+ d !== "children" && d !== "id" && !s(n[d], e[d]) && (a = d, i++);
24
24
  if (!i)
25
25
  return;
26
- const r = e.type;
27
- if (r === "geojson")
26
+ const o = e.type;
27
+ if (o === "geojson")
28
28
  t.setData(e.data);
29
- else if (r === "image")
29
+ else if (o === "image")
30
30
  t.updateImage({
31
31
  url: e.url,
32
32
  coordinates: e.coordinates
@@ -40,53 +40,53 @@ function A(t, e, n) {
40
40
  (y = t.setUrl) == null || y.call(t, e.url);
41
41
  break;
42
42
  case "tiles":
43
- (d = t.setTiles) == null || d.call(t, e.tiles);
43
+ (f = t.setTiles) == null || f.call(t, e.tiles);
44
44
  break;
45
45
  default:
46
46
  console.warn(`Unable to update <Source> prop: ${a}`);
47
47
  }
48
48
  }
49
49
  function E(t) {
50
- const e = k(x).map.getMap(), n = S(t), [, a] = b(0), i = m(() => t.id || `jsx-source-${$++}`, []);
50
+ const e = k(C).map.getMap(), n = S(t), [, a] = b(0), i = m(() => t.id || `jsx-source-${M++}`, []);
51
51
  w(() => {
52
52
  if (e) {
53
53
  const l = () => setTimeout(() => a((y) => y + 1), 0);
54
54
  return e.on("styledata", l), l(), () => {
55
55
  var y;
56
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);
57
+ const f = (y = e.getStyle()) == null ? void 0 : y.layers;
58
+ if (f)
59
+ for (const d of f)
60
+ d.source === i && e.removeLayer(d.id);
61
61
  e.removeSource(i);
62
62
  }
63
63
  };
64
64
  }
65
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, {
66
+ let o = e && e.style && e.getSource(i);
67
+ return o ? A(o, t, n.current) : o = z(e, i, t), n.current = t, o && $.Children.map(t.children, (l) => l && j(l, {
68
68
  source: i
69
69
  })) || null;
70
70
  }
71
71
  function F(t, e, n, a) {
72
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
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) {
74
+ const { layout: i = {}, paint: o = {}, filter: l, minzoom: y, maxzoom: f, beforeId: d } = n;
75
+ if (d !== a.beforeId && t.moveLayer(e, d), i !== a.layout) {
76
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);
77
+ for (const r in i)
78
+ s(i[r], c[r]) || t.setLayoutProperty(e, r, i[r]);
79
+ for (const r in c)
80
+ i.hasOwnProperty(r) || t.setLayoutProperty(e, r, void 0);
81
81
  }
82
- if (r !== a.paint) {
82
+ if (o !== a.paint) {
83
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);
84
+ for (const r in o)
85
+ s(o[r], c[r]) || t.setPaintProperty(e, r, o[r]);
86
+ for (const r in c)
87
+ o.hasOwnProperty(r) || t.setPaintProperty(e, r, void 0);
88
88
  }
89
- s(l, a.filter) || t.setFilter(e, l), (y !== a.minzoom || d !== a.maxzoom) && t.setLayerZoomRange(e, y, d);
89
+ s(l, a.filter) || t.setFilter(e, l), (y !== a.minzoom || f !== a.maxzoom) && t.setLayerZoomRange(e, y, f);
90
90
  }
91
91
  function R(t, e, n) {
92
92
  if (t.style && t.style._loaded && (!("source" in n) || t.getSource(n.source))) {
@@ -96,7 +96,7 @@ function R(t, e, n) {
96
96
  }
97
97
  let U = 0;
98
98
  function h(t) {
99
- const e = k(x).map.getMap(), n = S(t), [, a] = b(0), i = m(() => t.id || `jsx-layer-${U++}`, []);
99
+ const e = k(C).map.getMap(), n = S(t), [, a] = b(0), i = m(() => t.id || `jsx-layer-${U++}`, []);
100
100
  if (w(() => {
101
101
  if (e) {
102
102
  const l = () => a((y) => y + 1);
@@ -114,7 +114,7 @@ function h(t) {
114
114
  R(e, i, t);
115
115
  return n.current = t, null;
116
116
  }
117
- function L(t, e) {
117
+ function L(t, e, n) {
118
118
  switch (t) {
119
119
  case "fill":
120
120
  return {
@@ -124,7 +124,7 @@ function L(t, e) {
124
124
  case "line":
125
125
  return {
126
126
  "line-color": e,
127
- "line-width": 2
127
+ "line-width": n === "LineString" ? 6 : 2
128
128
  };
129
129
  default:
130
130
  return {};
@@ -133,20 +133,22 @@ function L(t, e) {
133
133
  function T({ sources: t }) {
134
134
  const e = m(() => !Array.isArray(t) || t.length === 0 ? [] : t.map((n) => ({
135
135
  ...n,
136
- geoJson: n.geometry ? M(n.geometry) : null
136
+ geoJson: n.geometry ? I(n.geometry, n.type) : null
137
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(
138
+ return (e == null ? void 0 : e.length) === 0 ? null : /* @__PURE__ */ u(x, { 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
139
  h,
140
140
  {
141
+ id: `${n.key}-${i}`,
141
142
  type: a.type,
142
- paint: L(a.type, a.color)
143
+ paint: L(a.type, a.color, n.type)
143
144
  },
144
145
  `${n.key}-${i}`
145
146
  )) : /* @__PURE__ */ u(
146
147
  h,
147
148
  {
149
+ id: n.key,
148
150
  type: n.layer.type,
149
- paint: L(n.layer.type, n.layer.color)
151
+ paint: L(n.layer.type, n.layer.color, n.type)
150
152
  }
151
153
  )) }, n.key) }, n.key)) });
152
154
  }
@@ -1,7 +1,7 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import { useEffect as a, useMemo as f } from "react";
3
3
  import { u as o, I as s } from "./index.modern-CLRs8JwI.js";
4
- import { u as y } from "./index-Bp1bWq9c.js";
4
+ import { u as y } from "./index-D4zzctTs.js";
5
5
  import { c as x } from "./styles-ChFj97uV.js";
6
6
  function I({
7
7
  latitude: u,
@@ -0,0 +1,57 @@
1
+ import { jsxs as u, jsx as o } from "react/jsx-runtime";
2
+ import { u as M, a as k } from "./index.modern-CLRs8JwI.js";
3
+ import { u as I, M as O } from "./index-D4zzctTs.js";
4
+ import { C as _, c as b, M as h } from "./index-pGewpik1.js";
5
+ function C({
6
+ clusters: a,
7
+ colors: i,
8
+ clusterIcon: d,
9
+ onClick: t,
10
+ doesSuperclusterContainActiveMarker: m
11
+ }) {
12
+ M();
13
+ const { activeMarker: r, zoom: s } = I(), f = (e) => () => {
14
+ e.properties.disableClick || t == null || t(e);
15
+ };
16
+ return a == null ? void 0 : a.map((e, g) => {
17
+ const n = e.geometry.coordinates[0], p = e.geometry.coordinates[1];
18
+ return /* @__PURE__ */ u(
19
+ k,
20
+ {
21
+ position: {
22
+ lat: p,
23
+ lng: n
24
+ },
25
+ onClick: f(e),
26
+ children: [
27
+ e.properties.cluster && /* @__PURE__ */ o(
28
+ _,
29
+ {
30
+ colors: i,
31
+ icon: d,
32
+ isActive: m(e.properties.cluster_id)
33
+ }
34
+ ),
35
+ !e.properties.cluster && /* @__PURE__ */ o(
36
+ "div",
37
+ {
38
+ className: b,
39
+ style: e.properties.defaultColor ? {} : {
40
+ "--background": i == null ? void 0 : i.background,
41
+ "--fill": i == null ? void 0 : i.fill
42
+ },
43
+ "data-is-cluster": !!e.properties.cluster,
44
+ "data-is-zoomed-out": s - 1 < O + 1,
45
+ "data-is-active": (r == null ? void 0 : r.id) === e.properties.id,
46
+ children: /* @__PURE__ */ o(h, { icon: e.properties.icon })
47
+ }
48
+ )
49
+ ]
50
+ },
51
+ `map-marker-${n}-${p}-${g}`
52
+ );
53
+ });
54
+ }
55
+ export {
56
+ C as default
57
+ };
@@ -1,7 +1,7 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import { useEffect as a } from "react";
3
3
  import { P as c } from "./scale-control-CyJd4u6j.js";
4
- import { u as i } from "./index-Bp1bWq9c.js";
4
+ import { u as i } from "./index-D4zzctTs.js";
5
5
  import { c as n } from "./styles-ChFj97uV.js";
6
6
  function l({
7
7
  latitude: p,
@@ -10,7 +10,7 @@ const tt = it.createContext({}), R = () => at(tt), I = {
10
10
  maptiler: "600d69cb-288d-445e-9839-3dfe4d76b31a",
11
11
  mapbox: "locallogic/cmb9nz9kb011501ru8drq8fqf",
12
12
  google: "a7ff20eb973126bb"
13
- }, Y = 13, ut = 22, Ht = 12.5, ht = 30, pt = 60, lt = "w-full h-full relative overflow-hidden", ft = w(() => import("./index-S5SfktvB.js")), dt = w(() => import("./index-CUpaKIZP.js")), gt = w(() => import("./index-BGoTpJjt.js")), mt = w(() => import("./index-qqbvBkdn.js")), yt = ({ padding: r = 1e-3, children: t }) => {
13
+ }, Y = 13, ut = 22, Ht = 12.5, ht = 30, pt = 60, lt = "w-full h-full relative overflow-hidden", ft = w(() => import("./index-DAov3leT.js")), dt = w(() => import("./index-DgzwPaj5.js")), gt = w(() => import("./index-DcbaLZSy.js")), mt = w(() => import("./index-qqbvBkdn.js")), yt = ({ padding: r = 1e-3, children: t }) => {
14
14
  const {
15
15
  mapProvider: e,
16
16
  center: n,
@@ -564,7 +564,7 @@ var Lt = function(t) {
564
564
  supercluster: c.current
565
565
  };
566
566
  };
567
- const It = w(() => import("./index-CCtDJ-mV.js")), vt = w(() => import("./index-CXTsUiSS.js")), Rt = w(() => import("./index-58w3Qwxr.js"));
567
+ const It = w(() => import("./index-Dxhpxh8s.js")), vt = w(() => import("./index-BsV7l4S5.js")), Rt = w(() => import("./index-DLKjaFD7.js"));
568
568
  function Zt({ markers: r, onClick: t, ...e }) {
569
569
  const { mapProvider: n, activeMarker: o, center: i, bounds: a, zoom: c, setMarkerPoints: s } = R();
570
570
  ct(() => {
@@ -629,7 +629,7 @@ function Zt({ markers: r, onClick: t, ...e }) {
629
629
  }
630
630
  ) : null;
631
631
  }
632
- const Ct = w(() => import("./index-CXUQoF5Q.js")), Ut = w(() => import("./index-DY5pY-zk.js")), Bt = w(() => import("./index-C36u5N_F.js"));
632
+ const Ct = w(() => import("./index-DQ-QUYzC.js")), Ut = w(() => import("./index-BiSKh6cm.js")), Bt = w(() => import("./index-CJL604iU.js"));
633
633
  function Ft({ children: r, anchor: t = "bottom", ...e }) {
634
634
  const { mapProvider: n } = R(), o = P(() => {
635
635
  switch (n == null ? void 0 : n.name) {
@@ -645,7 +645,7 @@ function Ft({ children: r, anchor: t = "bottom", ...e }) {
645
645
  }, [n]);
646
646
  return o ? /* @__PURE__ */ T(o, { ...e, anchor: t, children: r }) : null;
647
647
  }
648
- const zt = w(() => import("./index-CTk5bvm9.js")), Dt = w(() => import("./index-UEadmVww.js")), Nt = w(() => import("./index-DVitM43i.js"));
648
+ const zt = w(() => import("./index-3kRdcdZh.js")), Dt = w(() => import("./index-x3wrHsPD.js")), Nt = w(() => import("./index-Yh7bUURu.js"));
649
649
  function jt(r) {
650
650
  const { mapProvider: t } = R(), e = P(() => {
651
651
  switch (t == null ? void 0 : t.name) {
@@ -2,7 +2,7 @@ import { jsxs as x, jsx as d } from "react/jsx-runtime";
2
2
  import { useState as y, useEffect as c } from "react";
3
3
  import { M as g, N as h, u as b } from "./logo-control-NE-LlsRy.js";
4
4
  import { b as B } from "./index-CFomI3Il.js";
5
- import { u as M, d as u, a as Z, m as z } from "./index-Bp1bWq9c.js";
5
+ import { u as M, d as u, a as Z, m as z } from "./index-D4zzctTs.js";
6
6
  const L = ({ padding: i }) => {
7
7
  const { current: o } = b(), { markerPoints: n, setBounds: m, setZoom: f } = M(), [r, p] = y(void 0), s = () => {
8
8
  var e;
@@ -0,0 +1,56 @@
1
+ import { jsxs as M, jsx as p } from "react/jsx-runtime";
2
+ import { a as b } from "./scale-control-CyJd4u6j.js";
3
+ import "react";
4
+ import { u, M as h } from "./index-D4zzctTs.js";
5
+ import { C as k, c as x, M as I } from "./index-pGewpik1.js";
6
+ function N({
7
+ clusters: t,
8
+ colors: e,
9
+ clusterIcon: m,
10
+ onClick: a,
11
+ doesSuperclusterContainActiveMarker: s
12
+ }) {
13
+ const { activeMarker: r, zoom: f } = u(), g = (i) => (o) => {
14
+ o.originalEvent.stopPropagation(), !i.properties.disableClick && (a == null || a(i));
15
+ };
16
+ return t == null ? void 0 : t.map((i, o) => {
17
+ const n = i.geometry.coordinates[0], d = i.geometry.coordinates[1];
18
+ return /* @__PURE__ */ M(
19
+ b,
20
+ {
21
+ anchor: "bottom",
22
+ longitude: n,
23
+ latitude: d,
24
+ onClick: g(i),
25
+ children: [
26
+ i.properties.cluster && /* @__PURE__ */ p(
27
+ k,
28
+ {
29
+ colors: e,
30
+ icon: m,
31
+ isActive: s(i.properties.cluster_id)
32
+ }
33
+ ),
34
+ !i.properties.cluster && /* @__PURE__ */ p(
35
+ "div",
36
+ {
37
+ className: x,
38
+ style: i.properties.defaultColor ? {} : {
39
+ "--background": e == null ? void 0 : e.background,
40
+ "--fill": e == null ? void 0 : e.fill
41
+ },
42
+ "data-is-cluster": !!i.properties.cluster,
43
+ "data-is-zoomed-out": f < h,
44
+ "data-is-active": (r == null ? void 0 : r.id) === i.properties.id,
45
+ children: /* @__PURE__ */ p(I, { icon: i.properties.icon })
46
+ }
47
+ )
48
+ ]
49
+ },
50
+ `map-marker-${n}-${d}-${o}`
51
+ );
52
+ });
53
+ }
54
+ export {
55
+ N as default
56
+ };
@@ -1,7 +1,7 @@
1
1
  import { jsx as p } from "react/jsx-runtime";
2
2
  import { useEffect as a } from "react";
3
3
  import { P as i } from "./logo-control-NE-LlsRy.js";
4
- import { u as c } from "./index-Bp1bWq9c.js";
4
+ import { u as c } from "./index-D4zzctTs.js";
5
5
  import { c as n } from "./styles-ChFj97uV.js";
6
6
  function y({
7
7
  latitude: e,
@@ -2,7 +2,7 @@ import { jsxs as M, jsx as d } from "react/jsx-runtime";
2
2
  import { useState as v, useEffect as l } from "react";
3
3
  import { M as y, N as g, u as h } from "./scale-control-CyJd4u6j.js";
4
4
  import { b as B } from "./index-CFomI3Il.js";
5
- import { u as b, d as u, a as Z, m as z } from "./index-Bp1bWq9c.js";
5
+ import { u as b, d as u, a as Z, m as z } from "./index-D4zzctTs.js";
6
6
  const L = ({ padding: i }) => {
7
7
  const { current: o } = h(), { markerPoints: n, setBounds: m, setZoom: f } = b(), [r, p] = v(void 0), a = () => {
8
8
  var t;
@@ -2,7 +2,7 @@ import { jsxs as v, jsx as T } from "react/jsx-runtime";
2
2
  import { useState as h, useEffect as M } from "react";
3
3
  import { A as y, M as L, C as f, u as P } from "./index.modern-CLRs8JwI.js";
4
4
  import { b as x } from "./index-CFomI3Il.js";
5
- import { u as b, d as p, a as B, m as O } from "./index-Bp1bWq9c.js";
5
+ import { u as b, d as p, a as B, m as O } from "./index-D4zzctTs.js";
6
6
  const Z = {
7
7
  "top-left": f.LEFT_TOP,
8
8
  "top-right": f.RIGHT_TOP,
@@ -0,0 +1,56 @@
1
+ import { jsxs as M, jsx as p } from "react/jsx-runtime";
2
+ import { a as u } from "./logo-control-NE-LlsRy.js";
3
+ import "react";
4
+ import { u as _, M as b } from "./index-D4zzctTs.js";
5
+ import { C as h, c as k, M as I } from "./index-pGewpik1.js";
6
+ function N({
7
+ clusters: t,
8
+ colors: e,
9
+ clusterIcon: m,
10
+ onClick: a,
11
+ doesSuperclusterContainActiveMarker: s
12
+ }) {
13
+ const { activeMarker: r, zoom: f } = _(), g = (i) => (o) => {
14
+ o.originalEvent.stopPropagation(), !i.properties.disableClick && (a == null || a(i));
15
+ };
16
+ return t == null ? void 0 : t.map((i, o) => {
17
+ const n = i.geometry.coordinates[0], d = i.geometry.coordinates[1];
18
+ return /* @__PURE__ */ M(
19
+ u,
20
+ {
21
+ anchor: "bottom",
22
+ longitude: n,
23
+ latitude: d,
24
+ onClick: g(i),
25
+ children: [
26
+ i.properties.cluster && i.properties.cluster_id && /* @__PURE__ */ p(
27
+ h,
28
+ {
29
+ colors: e,
30
+ icon: m,
31
+ isActive: s(i.properties.cluster_id)
32
+ }
33
+ ),
34
+ !i.properties.cluster && /* @__PURE__ */ p(
35
+ "div",
36
+ {
37
+ className: k,
38
+ style: i.properties.defaultColor ? {} : {
39
+ "--background": e == null ? void 0 : e.background,
40
+ "--fill": e == null ? void 0 : e.fill
41
+ },
42
+ "data-is-cluster": !!i.properties.cluster,
43
+ "data-is-zoomed-out": f < b,
44
+ "data-is-active": (r == null ? void 0 : r.id) === i.properties.id,
45
+ children: /* @__PURE__ */ p(I, { icon: i.properties.icon })
46
+ }
47
+ )
48
+ ]
49
+ },
50
+ `map-marker-${n}-${d}-${o}`
51
+ );
52
+ });
53
+ }
54
+ export {
55
+ N as default
56
+ };
@@ -1,14 +1,14 @@
1
1
  import { jsx as u, Fragment as b } from "react/jsx-runtime";
2
- import * as j from "react";
3
- import { useContext as S, useRef as k, useState as x, useMemo as m, useEffect as C, cloneElement as I } from "react";
4
- import { b as w, d as s } from "./scale-control-CyJd4u6j.js";
5
- import { g as M } from "./utils-YqJg0vBb.js";
2
+ import * as $ from "react";
3
+ import { useContext as S, useRef as k, useState as C, useMemo as m, useEffect as w, cloneElement as j } from "react";
4
+ import { b as x, d as s } from "./scale-control-CyJd4u6j.js";
5
+ import { g as I } from "./utils-DJ13veBM.js";
6
6
  function g(t, e) {
7
7
  if (!t)
8
8
  throw new Error(e);
9
9
  }
10
- let U = 0;
11
- function $(t, e, n) {
10
+ let M = 0;
11
+ function U(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);
@@ -18,8 +18,8 @@ function $(t, e, n) {
18
18
  function z(t, e, n) {
19
19
  g(e.id === n.id, "source id changed"), g(e.type === n.type, "source type changed");
20
20
  let a = "", i = 0;
21
- for (const o in e)
22
- o !== "children" && o !== "id" && !s(n[o], e[o]) && (a = o, i++);
21
+ for (const l in e)
22
+ l !== "children" && l !== "id" && !s(n[l], e[l]) && (a = l, i++);
23
23
  if (!i)
24
24
  return;
25
25
  const r = e.type;
@@ -29,13 +29,13 @@ function z(t, e, n) {
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
31
  function A(t) {
32
- const e = S(w).map.getMap(), n = k(t), [, a] = x(0), i = m(() => t.id || `jsx-source-${U++}`, []);
33
- C(() => {
32
+ const e = S(x).map.getMap(), n = k(t), [, a] = C(0), i = m(() => t.id || `jsx-source-${M++}`, []);
33
+ w(() => {
34
34
  if (e) {
35
- const o = () => setTimeout(() => a((y) => y + 1), 0);
36
- return e.on("styledata", o), o(), () => {
35
+ const l = () => setTimeout(() => a((y) => y + 1), 0);
36
+ return e.on("styledata", l), l(), () => {
37
37
  var y;
38
- if (e.off("styledata", o), e.style && e.style._loaded && e.getSource(i)) {
38
+ if (e.off("styledata", l), e.style && e.style._loaded && e.getSource(i)) {
39
39
  const f = (y = e.getStyle()) == null ? void 0 : y.layers;
40
40
  if (f)
41
41
  for (const d of f)
@@ -46,29 +46,29 @@ function A(t) {
46
46
  }
47
47
  }, [e]);
48
48
  let r = e && e.style && e.getSource(i);
49
- return r ? z(r, t, n.current) : r = $(e, i, t), n.current = t, r && j.Children.map(t.children, (o) => o && I(o, {
49
+ return r ? z(r, t, n.current) : r = U(e, i, t), n.current = t, r && $.Children.map(t.children, (l) => l && j(l, {
50
50
  source: i
51
51
  })) || null;
52
52
  }
53
53
  function E(t, e, n, a) {
54
54
  if (g(n.id === a.id, "layer id changed"), g(n.type === a.type, "layer type changed"), n.type === "custom" || a.type === "custom")
55
55
  return;
56
- const { layout: i = {}, paint: r = {}, filter: o, minzoom: y, maxzoom: f, beforeId: d } = n;
56
+ const { layout: i = {}, paint: r = {}, filter: l, minzoom: y, maxzoom: f, beforeId: d } = n;
57
57
  if (d !== a.beforeId && t.moveLayer(e, d), i !== a.layout) {
58
58
  const c = a.layout || {};
59
- for (const l in i)
60
- s(i[l], c[l]) || t.setLayoutProperty(e, l, i[l]);
61
- for (const l in c)
62
- i.hasOwnProperty(l) || t.setLayoutProperty(e, l, void 0);
59
+ for (const o in i)
60
+ s(i[o], c[o]) || t.setLayoutProperty(e, o, i[o]);
61
+ for (const o in c)
62
+ i.hasOwnProperty(o) || t.setLayoutProperty(e, o, void 0);
63
63
  }
64
64
  if (r !== a.paint) {
65
65
  const c = a.paint || {};
66
- for (const l in r)
67
- s(r[l], c[l]) || t.setPaintProperty(e, l, r[l]);
68
- for (const l in c)
69
- r.hasOwnProperty(l) || t.setPaintProperty(e, l, void 0);
66
+ for (const o in r)
67
+ s(r[o], c[o]) || t.setPaintProperty(e, o, r[o]);
68
+ for (const o in c)
69
+ r.hasOwnProperty(o) || t.setPaintProperty(e, o, void 0);
70
70
  }
71
- s(o, a.filter) || t.setFilter(e, o), (y !== a.minzoom || f !== a.maxzoom) && t.setLayerZoomRange(e, y, f);
71
+ s(l, a.filter) || t.setFilter(e, l), (y !== a.minzoom || f !== a.maxzoom) && t.setLayerZoomRange(e, y, f);
72
72
  }
73
73
  function F(t, e, n) {
74
74
  if (t.style && t.style._loaded && (!("source" in n) || t.getSource(n.source))) {
@@ -77,26 +77,26 @@ function F(t, e, n) {
77
77
  }
78
78
  }
79
79
  let R = 0;
80
- function h(t) {
81
- const e = S(w).map.getMap(), n = k(t), [, a] = x(0), i = m(() => t.id || `jsx-layer-${R++}`, []);
82
- if (C(() => {
80
+ function L(t) {
81
+ const e = S(x).map.getMap(), n = k(t), [, a] = C(0), i = m(() => t.id || `jsx-layer-${R++}`, []);
82
+ if (w(() => {
83
83
  if (e) {
84
- const o = () => a((y) => y + 1);
85
- return e.on("styledata", o), o(), () => {
86
- e.off("styledata", o), e.style && e.style._loaded && e.getLayer(i) && e.removeLayer(i);
84
+ const l = () => a((y) => y + 1);
85
+ return e.on("styledata", l), l(), () => {
86
+ e.off("styledata", l), e.style && e.style._loaded && e.getLayer(i) && e.removeLayer(i);
87
87
  };
88
88
  }
89
89
  }, [e]), e && e.style && e.getLayer(i))
90
90
  try {
91
91
  E(e, i, t, n.current);
92
- } catch (o) {
93
- console.warn(o);
92
+ } catch (l) {
93
+ console.warn(l);
94
94
  }
95
95
  else
96
96
  F(e, i, t);
97
97
  return n.current = t, null;
98
98
  }
99
- function L(t, e) {
99
+ function h(t, e, n) {
100
100
  switch (t) {
101
101
  case "fill":
102
102
  return {
@@ -106,7 +106,7 @@ function L(t, e) {
106
106
  case "line":
107
107
  return {
108
108
  "line-color": e,
109
- "line-width": 2
109
+ "line-width": n === "LineString" ? 6 : 2
110
110
  };
111
111
  default:
112
112
  return {};
@@ -115,20 +115,22 @@ function L(t, e) {
115
115
  function O({ sources: t }) {
116
116
  const e = m(() => !Array.isArray(t) || t.length === 0 ? [] : t.map((n) => ({
117
117
  ...n,
118
- geoJson: n.geometry ? M(n.geometry) : null
118
+ geoJson: n.geometry ? I(n.geometry, n.type) : null
119
119
  })), [t]);
120
120
  return (e == null ? void 0 : e.length) === 0 ? null : /* @__PURE__ */ u(b, { children: e == null ? void 0 : e.map((n) => /* @__PURE__ */ u("div", { children: n.geoJson && /* @__PURE__ */ u(A, { id: n.key, type: "geojson", data: n.geoJson, children: n.layer && (Array.isArray(n.layer) ? n.layer.map((a, i) => /* @__PURE__ */ u(
121
- h,
121
+ L,
122
122
  {
123
+ id: `${n.key}-${i}`,
123
124
  type: a.type,
124
- paint: L(a.type, a.color)
125
+ paint: h(a.type, a.color, n.type)
125
126
  },
126
127
  `${n.key}-${i}`
127
128
  )) : /* @__PURE__ */ u(
128
- h,
129
+ L,
129
130
  {
131
+ id: n.key,
130
132
  type: n.layer.type,
131
- paint: L(n.layer.type, n.layer.color)
133
+ paint: h(n.layer.type, n.layer.color, n.type)
132
134
  }
133
135
  )) }, n.key) }, n.key)) });
134
136
  }