@local-logic/maps 0.0.30 → 0.1.1

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-Bn4XgGCE.js → index-BOJCRr60.js} +2 -2
  2. package/dist/{index-DRdXfLHP.js → index-BUZonjTY.js} +1 -1
  3. package/dist/index-BabQioiH.js +109 -0
  4. package/dist/{index-B9irDFVS.js → index-CTWLtI5f.js} +51 -48
  5. package/dist/{index-BCEeluIN.js → index-CWXZA3V3.js} +2 -2
  6. package/dist/{index-B1UUkU25.js → index-Ci9PQ3VM.js} +2 -2
  7. package/dist/{index-D5oT0rvy.js → index-D37STE_k.js} +88 -87
  8. package/dist/{index-CIE9YlvM.js → index-D8-yY6UK.js} +1 -1
  9. package/dist/{index-Cnab0xsb.js → index-DHOxmHER.js} +2 -2
  10. package/dist/{index-GGtrKiJn.js → index-DKy2opdk.js} +1 -1
  11. package/dist/{index-DImiFUoC.js → index-Dy0j33aN.js} +2 -2
  12. package/dist/{index-CEDpofgZ.js → index-k9UFzKZZ.js} +8 -7
  13. package/dist/{index--TOrExMa.js → index-vIYPnHrB.js} +2 -2
  14. package/dist/{index-7WiriOPf.js → index-xDS1OfMB.js} +48 -45
  15. package/dist/index.es.js +1 -1
  16. package/dist/index.umd.js +5 -5
  17. package/dist/src/components/Map/Root/BaseMap/Google/index.d.ts.map +1 -1
  18. package/dist/src/components/Map/Root/BaseMap/Mapbox/index.d.ts.map +1 -1
  19. package/dist/src/components/Map/Root/BaseMap/Maptiler/index.d.ts.map +1 -1
  20. package/dist/src/components/Map/Root/Layers/Google/index.d.ts.map +1 -1
  21. package/dist/src/components/Map/Root/Layers/index.d.ts.map +1 -1
  22. package/dist/src/components/Map/Root/Layers/types.d.ts +12 -1
  23. package/dist/src/components/Map/Root/Layers/types.d.ts.map +1 -1
  24. package/dist/src/components/Map/Root/Layers/utils.d.ts +3 -4
  25. package/dist/src/components/Map/Root/Layers/utils.d.ts.map +1 -1
  26. package/dist/src/components/Map/Root/Markers/index.d.ts +1 -1
  27. package/dist/src/components/Map/Root/Markers/index.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/context.d.ts +0 -1
  31. package/dist/src/components/Map/Root/context.d.ts.map +1 -1
  32. package/dist/src/components/Map/Root/index.d.ts.map +1 -1
  33. package/dist/src/components/Map/Root/types.d.ts +1 -0
  34. package/dist/src/components/Map/Root/types.d.ts.map +1 -1
  35. package/dist/src/components/Map/storybook-data.d.ts.map +1 -1
  36. package/dist/style.css +1 -1
  37. package/dist/{styles-mseP7Fna.js → styles-B3ZaR0wz.js} +1 -1
  38. package/dist/utils-IAXGPK5I.js +33 -0
  39. package/package.json +3 -3
  40. package/dist/index-5JWsWx8g.js +0 -107
  41. package/dist/utils-DJ13veBM.js +0 -25
@@ -1,7 +1,7 @@
1
1
  import { jsxs as f, jsx as r } from "react/jsx-runtime";
2
2
  import { useMap as k, AdvancedMarker as u } from "@vis.gl/react-google-maps";
3
- import { u as M, M as g } from "./index-D5oT0rvy.js";
4
- import { C, c as v, M as I } from "./index-DRdXfLHP.js";
3
+ import { u as M, M as g } from "./index-D37STE_k.js";
4
+ import { C, c as v, M as I } from "./index-BUZonjTY.js";
5
5
  function x({
6
6
  clusters: a,
7
7
  colors: o,
@@ -1,6 +1,6 @@
1
1
  import { jsx as r, jsxs as l, Fragment as d } from "react/jsx-runtime";
2
2
  import { useMemo as f } from "react";
3
- import { u as h, M as n } from "./index-D5oT0rvy.js";
3
+ import { u as h, M as n } from "./index-D37STE_k.js";
4
4
  import { MapPinIcon as g } from "@phosphor-icons/react";
5
5
  const a = `
6
6
  group/marker cursor-pointer rounded-full
@@ -0,0 +1,109 @@
1
+ import { jsx as P, jsxs as x, Fragment as A } from "react/jsx-runtime";
2
+ import { useState as v, useEffect as L, useRef as C, useCallback as E } from "react";
3
+ import { APIProvider as O, Map as z, ControlPosition as g, useMap as G } from "@vis.gl/react-google-maps";
4
+ import { u as B, D as h, W as f, a as Z, m as I } from "./index-D37STE_k.js";
5
+ import { t as R } from "./index-DscDx7HE.js";
6
+ const F = {
7
+ "top-left": g.LEFT_TOP,
8
+ "top-right": g.RIGHT_TOP,
9
+ "bottom-left": g.LEFT_BOTTOM,
10
+ "bottom-right": g.RIGHT_BOTTOM
11
+ }, D = ({ isMapLoaded: T }) => {
12
+ const e = G(), { markerPoints: s, locationBoundary: a, setZoom: p, mapPadding: r } = B(), [t, y] = v(void 0), i = C(void 0), u = E(() => {
13
+ if (!e)
14
+ return;
15
+ const o = e.getZoom();
16
+ typeof o < "u" && p(o + 1);
17
+ }, [e, p]);
18
+ return L(() => {
19
+ u();
20
+ const o = e?.addListener("zoom_changed", u);
21
+ return () => {
22
+ o?.remove();
23
+ };
24
+ }, [e, u]), L(() => {
25
+ if (!e)
26
+ return;
27
+ const o = [];
28
+ typeof s < "u" && s.length > 0 ? o.push(...s) : o.push(...a || []);
29
+ const n = o.length === 0 ? f : R(I(o));
30
+ (!i.current || !n.every((d, l) => d === i.current?.[l])) && (i.current = n, y(n));
31
+ }, [e, s, a]), L(() => {
32
+ if (!e || typeof t > "u")
33
+ return;
34
+ const [o, n, d, l] = t, c = (d - o) * 0.05 || 1e-3, m = (l - n) * 0.05 || 1e-3;
35
+ e.fitBounds(
36
+ {
37
+ south: n - m,
38
+ west: o - c,
39
+ north: l + m,
40
+ east: d + c
41
+ },
42
+ r
43
+ );
44
+ }, [T, e, t, r]), null;
45
+ };
46
+ function j({ children: T }) {
47
+ const [e, s] = v(!1), [a, p] = v(!1), {
48
+ mapProvider: r,
49
+ mapPadding: t,
50
+ locale: y,
51
+ center: i,
52
+ zoom: u = h.zoom,
53
+ minZoom: o,
54
+ maxZoom: n,
55
+ pitch: d = h.pitch,
56
+ bearing: l = h.bearing,
57
+ cooperativeGestures: c = h.cooperativeGestures,
58
+ zoomPosition: m
59
+ } = B();
60
+ if (L(() => {
61
+ if (!a)
62
+ return;
63
+ const M = document.querySelector(".gm-style-moc");
64
+ M && t && (M.style.paddingLeft = `${t.left}px`, M.style.paddingRight = `${t.right}px`);
65
+ }, [a, t?.left, t?.right]), r.name !== "google")
66
+ return null;
67
+ const _ = () => {
68
+ s(!0);
69
+ }, b = () => {
70
+ p(!0);
71
+ };
72
+ return /* @__PURE__ */ P(O, { apiKey: r.apiKey, language: y, onLoad: _, children: e && /* @__PURE__ */ x(A, { children: [
73
+ /* @__PURE__ */ P(D, { isMapLoaded: a }),
74
+ /* @__PURE__ */ P(
75
+ z,
76
+ {
77
+ mapId: r.theme || Z.google,
78
+ defaultCenter: {
79
+ lat: i.latitude,
80
+ lng: i.longitude
81
+ },
82
+ defaultBounds: {
83
+ north: f[3],
84
+ south: f[1],
85
+ east: f[2],
86
+ west: f[0]
87
+ },
88
+ defaultZoom: u + 1,
89
+ defaultTilt: d,
90
+ defaultHeading: l,
91
+ gestureHandling: c ? "cooperative" : "greedy",
92
+ streetViewControl: !1,
93
+ fullscreenControl: !1,
94
+ clickableIcons: !1,
95
+ mapTypeControl: !1,
96
+ zoomControlOptions: {
97
+ position: m && F[m]
98
+ },
99
+ minZoom: typeof o == "number" ? o + 1 : void 0,
100
+ maxZoom: typeof n == "number" ? n + 1 : void 0,
101
+ onTilesLoaded: b,
102
+ children: T
103
+ }
104
+ )
105
+ ] }) });
106
+ }
107
+ export {
108
+ j as default
109
+ };
@@ -1,9 +1,9 @@
1
- import { jsxs as g, jsx as f } from "react/jsx-runtime";
2
- import { useState as v, useRef as T, useCallback as E, useEffect as p } from "react";
3
- import { M as x, N as L, u as A } from "./logo-control-CHapR1Dt.js";
4
- import { u as M, D as c, a as G, m as k } from "./index-D5oT0rvy.js";
5
- import { t as S } from "./index-DscDx7HE.js";
6
- const F = {
1
+ import { jsxs as v, jsx as g } from "react/jsx-runtime";
2
+ import { useState as T, useRef as E, useCallback as x, useEffect as b } from "react";
3
+ import { M as L, N as A, u as G } from "./logo-control-CHapR1Dt.js";
4
+ import { u as M, D as m, a as F, m as S } from "./index-D37STE_k.js";
5
+ import { t as h } from "./index-DscDx7HE.js";
6
+ const z = {
7
7
  en: {
8
8
  "AttributionControl.ToggleAttribution": "Toggle attribution",
9
9
  "AttributionControl.MapFeedback": "Map feedback",
@@ -58,25 +58,28 @@ const F = {
58
58
  "CooperativeGesturesHandler.MacHelpText": "Utilisez ⌘ + défilement pour zoomer sur la carte",
59
59
  "CooperativeGesturesHandler.MobileHelpText": "Utilisez deux doigts pour déplacer la carte"
60
60
  }
61
- }, z = () => {
62
- const { current: e } = A(), { markerPoints: o, setZoom: s, mapPadding: u } = M(), [a, m] = v(void 0), i = T(void 0), l = E(() => {
63
- e && s(e.getZoom());
64
- }, [e, s]);
65
- return p(() => (l(), e?.on("zoom", l), () => {
66
- e?.off("zoom", l);
67
- }), [e, l]), p(() => {
68
- if (!e || typeof o > "u" || o.length === 0)
61
+ }, H = () => {
62
+ const { current: o } = G(), { markerPoints: r, locationBoundary: i, setZoom: s, mapPadding: u } = M(), [l, C] = T(void 0), a = E(void 0), n = x(() => {
63
+ o && s(o.getZoom());
64
+ }, [o, s]);
65
+ return b(() => (n(), o?.on("zoom", n), () => {
66
+ o?.off("zoom", n);
67
+ }), [o, n]), b(() => {
68
+ if (!o)
69
69
  return;
70
- const t = S(k(o));
71
- (!i.current || !t.every((n, r) => n === i.current?.[r])) && (i.current = t, m(t));
72
- }, [e, o]), p(() => {
73
- if (!e || typeof a > "u")
70
+ const e = [];
71
+ if (typeof r < "u" && r.length > 0 ? e.push(...r) : e.push(...i || []), e.length === 0)
74
72
  return;
75
- const [t, n, r, C] = a, b = (r - t) * 0.05 || 1e-3, d = (C - n) * 0.05 || 1e-3;
76
- e.fitBounds(
73
+ const t = h(S(e));
74
+ (!a.current || !t.every((c, p) => c === a.current?.[p])) && (a.current = t, C(t));
75
+ }, [o, r, i]), b(() => {
76
+ if (!o || typeof l > "u")
77
+ return;
78
+ const [e, t, c, p] = l, d = (c - e) * 0.05 || 1e-3, f = (p - t) * 0.05 || 1e-3;
79
+ o.fitBounds(
77
80
  [
78
- [t - b, n - d],
79
- [r + b, C + d]
81
+ [e - d, t - f],
82
+ [c + d, p + f]
80
83
  ],
81
84
  {
82
85
  padding: u,
@@ -84,39 +87,39 @@ const F = {
84
87
  duration: 700
85
88
  }
86
89
  );
87
- }, [e, a, u]), null;
90
+ }, [o, l, u]), null;
88
91
  };
89
- function P({ children: e }) {
92
+ function P({ children: o }) {
90
93
  const {
91
- mapProvider: o,
92
- locale: s,
93
- center: u,
94
- zoom: a = c.zoom,
95
- minZoom: m,
96
- maxZoom: i,
97
- pitch: l = c.pitch,
98
- bearing: t = c.bearing,
99
- cooperativeGestures: n = c.cooperativeGestures,
100
- zoomPosition: r
94
+ mapProvider: r,
95
+ locale: i,
96
+ center: s,
97
+ zoom: u = m.zoom,
98
+ minZoom: l,
99
+ maxZoom: C,
100
+ pitch: a = m.pitch,
101
+ bearing: n = m.bearing,
102
+ cooperativeGestures: e = m.cooperativeGestures,
103
+ zoomPosition: t
101
104
  } = M();
102
- return o.name !== "maptiler" ? null : /* @__PURE__ */ g(
103
- x,
105
+ return r.name !== "maptiler" ? null : /* @__PURE__ */ v(
106
+ L,
104
107
  {
105
108
  initialViewState: {
106
- ...u,
107
- zoom: a,
108
- pitch: l,
109
- bearing: t
109
+ ...s,
110
+ zoom: u,
111
+ pitch: a,
112
+ bearing: n
110
113
  },
111
- cooperativeGestures: n,
112
- minZoom: m,
113
- maxZoom: i,
114
- mapStyle: `https://api.maptiler.com/maps/${o.theme || G.maptiler}/style.json?key=${o.apiKey}`,
115
- locale: F[s],
114
+ cooperativeGestures: e,
115
+ minZoom: l,
116
+ maxZoom: C,
117
+ mapStyle: `https://api.maptiler.com/maps/${r.theme || F.maptiler}/style.json?key=${r.apiKey}`,
118
+ locale: z[i],
116
119
  children: [
117
- /* @__PURE__ */ f(z, {}),
118
- r && /* @__PURE__ */ f(L, { position: r }),
119
- e
120
+ /* @__PURE__ */ g(H, {}),
121
+ t && /* @__PURE__ */ g(A, { position: t }),
122
+ o
120
123
  ]
121
124
  }
122
125
  );
@@ -1,8 +1,8 @@
1
1
  import { jsx as E } from "react/jsx-runtime";
2
2
  import { useRef as d, useEffect as M } from "react";
3
3
  import { u as z, P as D } from "./scale-control-Dsir9fWY.js";
4
- import { u as H, P as T } from "./index-D5oT0rvy.js";
5
- import { c as j, m as A } from "./styles-mseP7Fna.js";
4
+ import { u as H, P as T } from "./index-D37STE_k.js";
5
+ import { c as j, m as A } from "./styles-B3ZaR0wz.js";
6
6
  function Z({
7
7
  latitude: h,
8
8
  longitude: l,
@@ -1,8 +1,8 @@
1
1
  import { jsx as E } from "react/jsx-runtime";
2
2
  import { useRef as d, useEffect as M } from "react";
3
3
  import { u as D, P as H } from "./logo-control-CHapR1Dt.js";
4
- import { u as j, P as T } from "./index-D5oT0rvy.js";
5
- import { c as x, m as A } from "./styles-mseP7Fna.js";
4
+ import { u as j, P as T } from "./index-D37STE_k.js";
5
+ import { c as x, m as A } from "./styles-B3ZaR0wz.js";
6
6
  function Z({
7
7
  latitude: l,
8
8
  longitude: h,