@local-logic/maps 0.1.9 → 0.1.11

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.
@@ -1,109 +0,0 @@
1
- import { jsx as v, jsxs as x, Fragment as A } from "react/jsx-runtime";
2
- import { useState as B, useEffect as P, useRef as C, useCallback as E } from "react";
3
- import { APIProvider as O, Map as z, ControlPosition as L, useMap as G } from "@vis.gl/react-google-maps";
4
- import { u as _, D as T, W as p, a as Z, m as I } from "./index-B-7FSpFA.js";
5
- import { t as R } from "./index-DscDx7HE.js";
6
- const F = {
7
- "top-left": L.LEFT_TOP,
8
- "top-right": L.RIGHT_TOP,
9
- "bottom-left": L.LEFT_BOTTOM,
10
- "bottom-right": L.RIGHT_BOTTOM
11
- }, D = ({ isMapLoaded: y }) => {
12
- const e = G(), { centerPinMarkerPoints: l, markerPoints: t, locationBoundary: c, setZoom: a, mapPadding: n } = _(), [u, g] = B(void 0), m = C(void 0), r = E(() => {
13
- if (!e)
14
- return;
15
- const o = e.getZoom();
16
- typeof o < "u" && a(o + 1);
17
- }, [e, a]);
18
- return P(() => {
19
- r();
20
- const o = e?.addListener("zoom_changed", r);
21
- return () => {
22
- o?.remove();
23
- };
24
- }, [e, r]), P(() => {
25
- if (!e)
26
- return;
27
- const o = [];
28
- typeof t < "u" && t.length > 0 ? (o.push(...t), l && o.push(l)) : o.push(...c || []);
29
- const s = o.length === 0 ? p : R(I(o));
30
- (!m.current || !s.every((i, d) => i === m.current?.[d])) && (m.current = s, g(s));
31
- }, [e, t, c, l]), P(() => {
32
- if (!e || typeof u > "u")
33
- return;
34
- const [o, s, i, d] = u, f = (i - o) * 0.05 || 1e-3, h = (d - s) * 0.05 || 1e-3;
35
- e.fitBounds(
36
- {
37
- south: s - h,
38
- west: o - f,
39
- north: d + h,
40
- east: i + f
41
- },
42
- n
43
- );
44
- }, [y, e, u, n]), null;
45
- };
46
- function j({ children: y }) {
47
- const [e, l] = B(!1), [t, c] = B(!1), {
48
- mapProvider: a,
49
- mapPadding: n,
50
- locale: u,
51
- center: g,
52
- zoom: m = T.zoom,
53
- minZoom: r,
54
- maxZoom: o,
55
- pitch: s = T.pitch,
56
- bearing: i = T.bearing,
57
- cooperativeGestures: d = T.cooperativeGestures,
58
- zoomPosition: f
59
- } = _();
60
- if (P(() => {
61
- if (!t)
62
- return;
63
- const M = document.querySelector(".gm-style-moc");
64
- M && n && (M.style.paddingLeft = `${n.left}px`, M.style.paddingRight = `${n.right}px`);
65
- }, [t, n?.left, n?.right]), a.name !== "google")
66
- return null;
67
- const h = () => {
68
- l(!0);
69
- }, b = () => {
70
- c(!0);
71
- };
72
- return /* @__PURE__ */ v(O, { apiKey: a.apiKey, language: u, onLoad: h, children: e && /* @__PURE__ */ x(A, { children: [
73
- /* @__PURE__ */ v(D, { isMapLoaded: t }),
74
- /* @__PURE__ */ v(
75
- z,
76
- {
77
- mapId: a.theme || Z.google,
78
- defaultCenter: {
79
- lat: g.latitude,
80
- lng: g.longitude
81
- },
82
- defaultBounds: {
83
- north: p[3],
84
- south: p[1],
85
- east: p[2],
86
- west: p[0]
87
- },
88
- defaultZoom: m + 1,
89
- defaultTilt: s,
90
- defaultHeading: i,
91
- gestureHandling: d ? "cooperative" : "greedy",
92
- streetViewControl: !1,
93
- fullscreenControl: !1,
94
- clickableIcons: !1,
95
- mapTypeControl: !1,
96
- zoomControlOptions: {
97
- position: f && F[f]
98
- },
99
- minZoom: typeof r == "number" ? r + 1 : void 0,
100
- maxZoom: typeof o == "number" ? o + 1 : void 0,
101
- onTilesLoaded: b,
102
- children: y
103
- }
104
- )
105
- ] }) });
106
- }
107
- export {
108
- j as default
109
- };