@local-logic/maps 0.0.10 → 0.0.12

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 (49) hide show
  1. package/dist/{index-BYlamtEc.js → index-B3NH4rqN.js} +30 -17
  2. package/dist/index-B9YXnLOH.js +42 -0
  3. package/dist/index-BcpSqK0X.js +74 -0
  4. package/dist/{index-DgHrPgsK.js → index-Bd7meO8V.js} +245 -234
  5. package/dist/index-BhldVNew.js +35 -0
  6. package/dist/index-Bu4XEiYU.js +74 -0
  7. package/dist/{index-CR8t37Oz.js → index-CzBPD5Sw.js} +10 -10
  8. package/dist/index-DFdfOz0d.js +34 -0
  9. package/dist/index-DsrEcQq0.js +71 -0
  10. package/dist/{index-BtwgeEEU.js → index-LKvWHhi6.js} +14 -14
  11. package/dist/{index-BsnsAUt5.js → index-UEadmVww.js} +2 -1
  12. package/dist/{index-JQfyhSrg.js → index-aDlW4ps0.js} +5 -5
  13. package/dist/index.es.js +1 -1
  14. package/dist/index.umd.js +30 -26
  15. package/dist/src/components/Map/Root/BaseMap/index.d.ts.map +1 -1
  16. package/dist/src/components/Map/Root/Layers/Google/index.d.ts.map +1 -1
  17. package/dist/src/components/Map/Root/Markers/Cluster/index.d.ts +2 -1
  18. package/dist/src/components/Map/Root/Markers/Cluster/index.d.ts.map +1 -1
  19. package/dist/src/components/Map/Root/Markers/Google/index.d.ts +1 -1
  20. package/dist/src/components/Map/Root/Markers/Google/index.d.ts.map +1 -1
  21. package/dist/src/components/Map/Root/Markers/Mapbox/index.d.ts +1 -1
  22. package/dist/src/components/Map/Root/Markers/Mapbox/index.d.ts.map +1 -1
  23. package/dist/src/components/Map/Root/Markers/Maptiler/index.d.ts +1 -1
  24. package/dist/src/components/Map/Root/Markers/Maptiler/index.d.ts.map +1 -1
  25. package/dist/src/components/Map/Root/Markers/index.d.ts.map +1 -1
  26. package/dist/src/components/Map/Root/Markers/styles.d.ts +2 -2
  27. package/dist/src/components/Map/Root/Markers/styles.d.ts.map +1 -1
  28. package/dist/src/components/Map/Root/Markers/types.d.ts +1 -0
  29. package/dist/src/components/Map/Root/Markers/types.d.ts.map +1 -1
  30. package/dist/src/components/Map/Root/Popup/Google/index.d.ts.map +1 -1
  31. package/dist/src/components/Map/Root/Popup/Mapbox/index.d.ts.map +1 -1
  32. package/dist/src/components/Map/Root/Popup/Maptiler/index.d.ts.map +1 -1
  33. package/dist/src/components/Map/Root/Popup/styles.d.ts +1 -1
  34. package/dist/src/components/Map/Root/Popup/styles.d.ts.map +1 -1
  35. package/dist/src/components/Map/Root/constants.d.ts +1 -0
  36. package/dist/src/components/Map/Root/constants.d.ts.map +1 -1
  37. package/dist/src/components/Map/Root/context.d.ts +1 -0
  38. package/dist/src/components/Map/Root/context.d.ts.map +1 -1
  39. package/dist/src/components/Map/Root/types.d.ts +1 -0
  40. package/dist/src/components/Map/Root/types.d.ts.map +1 -1
  41. package/dist/style.css +2 -2
  42. package/dist/{styles-uPzJnzVS.js → styles-ChFj97uV.js} +1 -1
  43. package/package.json +1 -1
  44. package/dist/index-9RZYMoMG.js +0 -39
  45. package/dist/index-BOuko7CL.js +0 -32
  46. package/dist/index-CRQ5kxRL.js +0 -65
  47. package/dist/index-D5uhfwEH.js +0 -31
  48. package/dist/index-DNKXUpkv.js +0 -65
  49. package/dist/index-DnsF5I7I.js +0 -62
@@ -0,0 +1,35 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { useEffect as a } from "react";
3
+ import { P as i } from "./logo-control-NE-LlsRy.js";
4
+ import { u as c } from "./index-Bd7meO8V.js";
5
+ import { c as n } from "./styles-ChFj97uV.js";
6
+ function x({
7
+ latitude: r,
8
+ longitude: e,
9
+ anchor: f,
10
+ offset: m = [0, -35],
11
+ onClose: p,
12
+ children: o
13
+ }) {
14
+ const { zoom: u } = c();
15
+ return a(() => {
16
+ p == null || p();
17
+ }, [u]), typeof r > "u" || typeof e > "u" ? null : /* @__PURE__ */ t(
18
+ i,
19
+ {
20
+ className: "maplibre-popup",
21
+ focusAfterOpen: !0,
22
+ latitude: r,
23
+ longitude: e,
24
+ anchor: f,
25
+ offset: m,
26
+ onClose: p,
27
+ closeButton: !1,
28
+ children: /* @__PURE__ */ t("div", { className: n, children: o })
29
+ },
30
+ "maplibre-popup"
31
+ );
32
+ }
33
+ export {
34
+ x as default
35
+ };
@@ -0,0 +1,74 @@
1
+ import { jsxs as c, jsx as M } from "react/jsx-runtime";
2
+ import { useEffect as h } from "react";
3
+ import { u as L, a as b } from "./logo-control-NE-LlsRy.js";
4
+ import { u as E, M as _ } from "./index-Bd7meO8V.js";
5
+ import { C as v, c as y, M as O } from "./index-B3NH4rqN.js";
6
+ function R({
7
+ clusters: r,
8
+ colors: i,
9
+ clusterIcon: d,
10
+ markerBounds: n,
11
+ markerBoundsPadding: e,
12
+ onClick: m,
13
+ doesSuperclusterContainActiveMarker: g
14
+ }) {
15
+ const { current: f } = L(), { activeMarker: s, zoom: u } = E();
16
+ h(() => {
17
+ if (f && n) {
18
+ const [t, a, o, p] = n;
19
+ f.fitBounds(
20
+ [
21
+ [a - e.left, t - e.bottom],
22
+ [p + e.right, o + e.top]
23
+ ],
24
+ {
25
+ maxZoom: 17,
26
+ duration: 1e3
27
+ }
28
+ );
29
+ }
30
+ }, [f, n, e]);
31
+ const x = (t) => (a) => {
32
+ a.originalEvent.stopPropagation(), m == null || m(t);
33
+ };
34
+ return r == null ? void 0 : r.map((t, a) => {
35
+ const o = t.geometry.coordinates[0], p = t.geometry.coordinates[1];
36
+ return /* @__PURE__ */ c(
37
+ b,
38
+ {
39
+ anchor: "bottom",
40
+ longitude: o,
41
+ latitude: p,
42
+ onClick: x(t),
43
+ children: [
44
+ t.properties.cluster && t.properties.cluster_id && /* @__PURE__ */ M(
45
+ v,
46
+ {
47
+ colors: i,
48
+ icon: d,
49
+ isActive: g(t.properties.cluster_id)
50
+ }
51
+ ),
52
+ !t.properties.cluster && /* @__PURE__ */ M(
53
+ "div",
54
+ {
55
+ className: y,
56
+ style: {
57
+ "--background": i == null ? void 0 : i.background,
58
+ "--fill": i == null ? void 0 : i.fill
59
+ },
60
+ "data-is-cluster": !!t.properties.cluster,
61
+ "data-is-zoomed-out": u < _,
62
+ "data-is-active": (s == null ? void 0 : s.id) === t.properties.id,
63
+ children: /* @__PURE__ */ M(O, { icon: t.properties.icon })
64
+ }
65
+ )
66
+ ]
67
+ },
68
+ `map-marker-${o}-${p}-${a}`
69
+ );
70
+ });
71
+ }
72
+ export {
73
+ R as default
74
+ };
@@ -1,28 +1,28 @@
1
1
  import { jsxs as M, jsx as d } from "react/jsx-runtime";
2
2
  import { useState as h, useEffect as b } from "react";
3
3
  import { A as C, M as O, C as i, u as P } from "./index.modern-CLRs8JwI.js";
4
- import { u as p, d as l, a as v } from "./index-DgHrPgsK.js";
4
+ import { u as p, d as l, a as v } from "./index-Bd7meO8V.js";
5
5
  const y = {
6
6
  "top-left": i.LEFT_TOP,
7
7
  "top-right": i.RIGHT_TOP,
8
8
  "bottom-left": i.LEFT_BOTTOM,
9
9
  "bottom-right": i.RIGHT_BOTTOM
10
- }, Z = ({ isMapLoaded: r }) => {
11
- const o = P(), { setBounds: u, setZoom: t } = p(), a = () => {
10
+ }, z = ({ isMapLoaded: r }) => {
11
+ const o = P(), { setBounds: m, setZoom: t } = p(), a = () => {
12
12
  var s;
13
13
  if (!o)
14
14
  return;
15
15
  const e = (s = o.getBounds()) == null ? void 0 : s.toJSON(), n = o.getZoom();
16
- e && u([e.west, e.south, e.east, e.north]), typeof n < "u" && t(n + 1);
16
+ e && m([e.west, e.south, e.east, e.north]), typeof n < "u" && t(n + 1);
17
17
  };
18
18
  return b(() => {
19
- !r || !o || (a(), o.addListener("bounds_changed", () => {
19
+ !r || !o || (a(), o.addListener("zoom_changed", () => {
20
20
  a();
21
21
  }));
22
22
  }, [r, o]), null;
23
23
  };
24
24
  function B({ children: r }) {
25
- const [o, u] = h(!1), {
25
+ const [o, m] = h(!1), {
26
26
  mapProvider: t,
27
27
  center: a,
28
28
  // Google Maps zoom level starts at 0, so we add 1 to match our defaultMapValues
@@ -32,15 +32,15 @@ function B({ children: r }) {
32
32
  pitch: f = l.pitch,
33
33
  bearing: c = l.bearing,
34
34
  cooperativeGestures: g = l.cooperativeGestures,
35
- zoomPosition: m
35
+ zoomPosition: u
36
36
  } = p();
37
37
  if (t.name !== "google")
38
38
  return null;
39
39
  const T = () => {
40
- u(!0);
40
+ m(!0);
41
41
  };
42
42
  return /* @__PURE__ */ M(C, { apiKey: t.apiKey, children: [
43
- /* @__PURE__ */ d(Z, { isMapLoaded: o }),
43
+ /* @__PURE__ */ d(z, { isMapLoaded: o }),
44
44
  /* @__PURE__ */ d(
45
45
  O,
46
46
  {
@@ -58,7 +58,7 @@ function B({ children: r }) {
58
58
  clickableIcons: !1,
59
59
  mapTypeControl: !1,
60
60
  zoomControlOptions: {
61
- position: m && y[m]
61
+ position: u && y[u]
62
62
  },
63
63
  minZoom: typeof n == "number" ? n + 1 : void 0,
64
64
  maxZoom: typeof s == "number" ? s + 1 : void 0,
@@ -0,0 +1,34 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { useEffect as a } from "react";
3
+ import { P as c } from "./scale-control-CyJd4u6j.js";
4
+ import { u as i } from "./index-Bd7meO8V.js";
5
+ import { c as n } from "./styles-ChFj97uV.js";
6
+ function l({
7
+ latitude: p,
8
+ longitude: t,
9
+ anchor: f,
10
+ offset: o = [0, -35],
11
+ onClose: r,
12
+ children: m
13
+ }) {
14
+ const { zoom: u } = i();
15
+ return a(() => {
16
+ r == null || r();
17
+ }, [u]), typeof p > "u" || typeof t > "u" ? null : /* @__PURE__ */ e(
18
+ c,
19
+ {
20
+ className: "mapbox-popup",
21
+ focusAfterOpen: !0,
22
+ latitude: p,
23
+ longitude: t,
24
+ anchor: f,
25
+ offset: o,
26
+ onClose: r,
27
+ closeButton: !1,
28
+ children: /* @__PURE__ */ e("div", { className: n, children: m })
29
+ }
30
+ );
31
+ }
32
+ export {
33
+ l as default
34
+ };
@@ -0,0 +1,71 @@
1
+ import { jsxs as x, jsx as d } from "react/jsx-runtime";
2
+ import { useEffect as L } from "react";
3
+ import { u as c, a as b } from "./index.modern-CLRs8JwI.js";
4
+ import { u as v, M as y } from "./index-Bd7meO8V.js";
5
+ import { C as E, c as O, M as _ } from "./index-B3NH4rqN.js";
6
+ function N({
7
+ clusters: p,
8
+ colors: e,
9
+ clusterIcon: M,
10
+ markerBounds: n,
11
+ markerBoundsPadding: i,
12
+ onClick: m,
13
+ doesSuperclusterContainActiveMarker: g
14
+ }) {
15
+ const r = c(), { activeMarker: f, zoom: h } = v();
16
+ L(() => {
17
+ if (r && n) {
18
+ const [t, s, a, o] = n;
19
+ r.fitBounds({
20
+ south: t - i.bottom,
21
+ west: s - i.left,
22
+ north: a + i.top,
23
+ east: o + i.right
24
+ });
25
+ }
26
+ }, [r, n, i]);
27
+ const u = (t) => () => {
28
+ m == null || m(t);
29
+ };
30
+ return p == null ? void 0 : p.map((t, s) => {
31
+ const a = t.geometry.coordinates[0], o = t.geometry.coordinates[1];
32
+ return /* @__PURE__ */ x(
33
+ b,
34
+ {
35
+ position: {
36
+ lat: o,
37
+ lng: a
38
+ },
39
+ onClick: u(t),
40
+ children: [
41
+ t.properties.cluster && /* @__PURE__ */ d(
42
+ E,
43
+ {
44
+ colors: e,
45
+ icon: M,
46
+ isActive: g(t.properties.cluster_id)
47
+ }
48
+ ),
49
+ !t.properties.cluster && /* @__PURE__ */ d(
50
+ "div",
51
+ {
52
+ className: O,
53
+ style: {
54
+ "--background": e == null ? void 0 : e.background,
55
+ "--fill": e == null ? void 0 : e.fill
56
+ },
57
+ "data-is-cluster": !!t.properties.cluster,
58
+ "data-is-zoomed-out": h - 1 < y + 1,
59
+ "data-is-active": (f == null ? void 0 : f.id) === t.properties.id,
60
+ children: /* @__PURE__ */ d(_, { icon: t.properties.icon })
61
+ }
62
+ )
63
+ ]
64
+ },
65
+ `map-marker-${a}-${o}-${s}`
66
+ );
67
+ });
68
+ }
69
+ export {
70
+ N as default
71
+ };
@@ -1,21 +1,21 @@
1
1
  import { jsxs as f, jsx as i } from "react/jsx-runtime";
2
2
  import { useEffect as d } from "react";
3
3
  import { M as b, N as x, u as M } from "./scale-control-CyJd4u6j.js";
4
- import { u as m, d as r, a as v } from "./index-DgHrPgsK.js";
5
- const y = () => {
6
- const { current: e } = M(), { setBounds: o, setZoom: s } = m(), t = () => {
4
+ import { u as m, d as r, a as y } from "./index-Bd7meO8V.js";
5
+ const g = () => {
6
+ const { current: o } = M(), { setBounds: e, setZoom: s } = m(), t = () => {
7
7
  var a;
8
- e && (o((a = e.getBounds()) == null ? void 0 : a.toArray().flat()), s(e.getZoom()));
8
+ o && (e((a = o.getBounds()) == null ? void 0 : a.toArray().flat()), s(o.getZoom()));
9
9
  };
10
10
  return d(() => {
11
- e && (t(), e.on("move", () => {
11
+ o && (t(), o.on("zoom", () => {
12
12
  t();
13
13
  }));
14
- }, [e]), null;
14
+ }, [o]), null;
15
15
  };
16
- function z({ children: e }) {
16
+ function w({ children: o }) {
17
17
  const {
18
- mapProvider: o,
18
+ mapProvider: e,
19
19
  center: s,
20
20
  zoom: t = r.zoom,
21
21
  minZoom: a,
@@ -25,10 +25,10 @@ function z({ children: e }) {
25
25
  cooperativeGestures: c = r.cooperativeGestures,
26
26
  zoomPosition: n
27
27
  } = m();
28
- return o.name !== "mapbox" ? null : /* @__PURE__ */ f(
28
+ return e.name !== "mapbox" ? null : /* @__PURE__ */ f(
29
29
  b,
30
30
  {
31
- mapboxAccessToken: o.apiKey,
31
+ mapboxAccessToken: e.apiKey,
32
32
  initialViewState: {
33
33
  ...s,
34
34
  zoom: t,
@@ -38,16 +38,16 @@ function z({ children: e }) {
38
38
  cooperativeGestures: c,
39
39
  minZoom: a,
40
40
  maxZoom: p,
41
- mapStyle: `mapbox://styles/${o.theme || v.mapbox}`,
41
+ mapStyle: `mapbox://styles/${e.theme || y.mapbox}`,
42
42
  interactiveLayerIds: ["road-label", "waterway-label"],
43
43
  children: [
44
- /* @__PURE__ */ i(y, {}),
44
+ /* @__PURE__ */ i(g, {}),
45
45
  n && /* @__PURE__ */ i(x, { position: n }),
46
- e
46
+ o
47
47
  ]
48
48
  }
49
49
  );
50
50
  }
51
51
  export {
52
- z as default
52
+ w as default
53
53
  };
@@ -29,7 +29,8 @@ function d({ sources: a }) {
29
29
  return;
30
30
  const n = a.map((t) => {
31
31
  const l = {
32
- paths: x(t.geometry)
32
+ paths: x(t.geometry),
33
+ clickable: !1
33
34
  };
34
35
  if (Array.isArray(t.layer))
35
36
  t.layer.forEach((r) => {
@@ -1,13 +1,13 @@
1
1
  import { jsxs as f, jsx as i } from "react/jsx-runtime";
2
2
  import { useEffect as d } from "react";
3
3
  import { M, N as h, u as g } from "./logo-control-NE-LlsRy.js";
4
- import { u as n, d as a, a as v } from "./index-DgHrPgsK.js";
5
- const y = () => {
4
+ import { u as n, d as a, a as y } from "./index-Bd7meO8V.js";
5
+ const v = () => {
6
6
  const { current: t } = g(), { setBounds: e, setZoom: r } = n(), o = () => {
7
7
  t && (e(t.getBounds().toArray().flat()), r(t.getZoom()));
8
8
  };
9
9
  return d(() => {
10
- t && (o(), t.on("move", () => {
10
+ t && (o(), t.on("zoom", () => {
11
11
  o();
12
12
  }));
13
13
  }, [t]), null;
@@ -36,9 +36,9 @@ function B({ children: t }) {
36
36
  cooperativeGestures: c,
37
37
  minZoom: m,
38
38
  maxZoom: p,
39
- mapStyle: `https://api.maptiler.com/maps/${e.theme || v.maptiler}/style.json?key=${e.apiKey}`,
39
+ mapStyle: `https://api.maptiler.com/maps/${e.theme || y.maptiler}/style.json?key=${e.apiKey}`,
40
40
  children: [
41
- /* @__PURE__ */ i(y, {}),
41
+ /* @__PURE__ */ i(v, {}),
42
42
  s && /* @__PURE__ */ i(h, { position: s }),
43
43
  t
44
44
  ]
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as c } from "./index-DgHrPgsK.js";
1
+ import { i as c } from "./index-Bd7meO8V.js";
2
2
  export {
3
3
  c as LocalLogicMap
4
4
  };