@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,9 +1,9 @@
1
- import { jsxs as b, jsx as M } from "react/jsx-runtime";
2
- import { useState as v, useRef as x, useCallback as Z, useEffect as p } from "react";
1
+ import { jsxs as v, jsx as C } from "react/jsx-runtime";
2
+ import { useState as x, useRef as Z, useCallback as h, useEffect as d } from "react";
3
3
  import { M as B, N as L, u as T } from "./scale-control-Dsir9fWY.js";
4
- import { u as C, D as m, a as h, m as k } from "./index-D5oT0rvy.js";
5
- import { t as z } from "./index-DscDx7HE.js";
6
- const A = {
4
+ import { u as M, D as p, a as z, m as A } from "./index-D37STE_k.js";
5
+ import { t as E } from "./index-DscDx7HE.js";
6
+ const P = {
7
7
  en: {
8
8
  "AttributionControl.ToggleAttribution": "Toggle attribution",
9
9
  "FullscreenControl.Enter": "Enter fullscreen",
@@ -34,25 +34,28 @@ const A = {
34
34
  "ScrollZoomBlocker.CmdMessage": "Utilisez ⌘ + défilement pour zoomer sur la carte",
35
35
  "TouchPanBlocker.Message": "Utilisez deux doigts pour déplacer la carte"
36
36
  }
37
- }, E = () => {
38
- const { current: o } = T(), { markerPoints: e, setZoom: s, mapPadding: c } = C(), [i, u] = v(void 0), l = x(void 0), n = Z(() => {
37
+ }, y = () => {
38
+ const { current: o } = T(), { markerPoints: n, locationBoundary: l, setZoom: s, mapPadding: c } = M(), [a, f] = x(void 0), i = Z(void 0), r = h(() => {
39
39
  o && s(o.getZoom());
40
40
  }, [o, s]);
41
- return p(() => (n(), o?.on("zoom", n), () => {
42
- o?.off("zoom", n);
43
- }), [o, n]), p(() => {
44
- if (!o || typeof e > "u" || e.length === 0)
41
+ return d(() => (r(), o?.on("zoom", r), () => {
42
+ o?.off("zoom", r);
43
+ }), [o, r]), d(() => {
44
+ if (!o)
45
45
  return;
46
- const t = z(k(e));
47
- (!l.current || !t.every((a, r) => a === l.current?.[r])) && (l.current = t, u(t));
48
- }, [o, e]), p(() => {
49
- if (!o || typeof i > "u")
46
+ const e = [];
47
+ if (typeof n < "u" && n.length > 0 ? e.push(...n) : e.push(...l || []), e.length === 0)
50
48
  return;
51
- const [t, a, r, d] = i, f = (r - t) * 0.05 || 1e-3, g = (d - a) * 0.05 || 1e-3;
49
+ const t = E(A(e));
50
+ (!i.current || !t.every((u, m) => u === i.current?.[m])) && (i.current = t, f(t));
51
+ }, [o, n, l]), d(() => {
52
+ if (!o || typeof a > "u")
53
+ return;
54
+ const [e, t, u, m] = a, g = (u - e) * 0.05 || 1e-3, b = (m - t) * 0.05 || 1e-3;
52
55
  o.fitBounds(
53
56
  [
54
- [t - f, a - g],
55
- [r + f, d + g]
57
+ [e - g, t - b],
58
+ [u + g, m + b]
56
59
  ],
57
60
  {
58
61
  // Mapbox seems to retain padding, thus further calls
@@ -64,45 +67,45 @@ const A = {
64
67
  duration: 700
65
68
  }
66
69
  );
67
- }, [o, i, c]), null;
70
+ }, [o, a, c]), null;
68
71
  };
69
- function U({ children: o }) {
72
+ function R({ children: o }) {
70
73
  const {
71
- mapProvider: e,
72
- locale: s,
73
- center: c,
74
- zoom: i = m.zoom,
75
- minZoom: u,
76
- maxZoom: l,
77
- pitch: n = m.pitch,
78
- bearing: t = m.bearing,
79
- cooperativeGestures: a = m.cooperativeGestures,
80
- zoomPosition: r
81
- } = C();
82
- return e.name !== "mapbox" ? null : /* @__PURE__ */ b(
74
+ mapProvider: n,
75
+ locale: l,
76
+ center: s,
77
+ zoom: c = p.zoom,
78
+ minZoom: a,
79
+ maxZoom: f,
80
+ pitch: i = p.pitch,
81
+ bearing: r = p.bearing,
82
+ cooperativeGestures: e = p.cooperativeGestures,
83
+ zoomPosition: t
84
+ } = M();
85
+ return n.name !== "mapbox" ? null : /* @__PURE__ */ v(
83
86
  B,
84
87
  {
85
- mapboxAccessToken: e.apiKey,
88
+ mapboxAccessToken: n.apiKey,
86
89
  initialViewState: {
87
- ...c,
88
- zoom: i,
89
- pitch: n,
90
- bearing: t
90
+ ...s,
91
+ zoom: c,
92
+ pitch: i,
93
+ bearing: r
91
94
  },
92
- cooperativeGestures: a,
93
- minZoom: u,
94
- maxZoom: l,
95
- mapStyle: `mapbox://styles/${e.theme || h.mapbox}`,
95
+ cooperativeGestures: e,
96
+ minZoom: a,
97
+ maxZoom: f,
98
+ mapStyle: `mapbox://styles/${n.theme || z.mapbox}`,
96
99
  interactiveLayerIds: ["road-label", "waterway-label"],
97
- locale: A[s],
100
+ locale: P[l],
98
101
  children: [
99
- /* @__PURE__ */ M(E, {}),
100
- r && /* @__PURE__ */ M(L, { position: r }),
102
+ /* @__PURE__ */ C(y, {}),
103
+ t && /* @__PURE__ */ C(L, { position: t }),
101
104
  o
102
105
  ]
103
106
  }
104
107
  );
105
108
  }
106
109
  export {
107
- U as default
110
+ R as default
108
111
  };
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as c } from "./index-D5oT0rvy.js";
1
+ import { i as c } from "./index-D37STE_k.js";
2
2
  export {
3
3
  c as LocalLogicMap
4
4
  };