@local-logic/maps 0.0.21 → 0.0.22

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 (38) hide show
  1. package/dist/index-B85VZGVP.js +56 -0
  2. package/dist/index-BRD3rjLE.js +138 -0
  3. package/dist/index-BpFpg_5A.js +78 -0
  4. package/dist/index-BrxP9NHZ.js +56 -0
  5. package/dist/{index-AcZakyxd.js → index-CN_dNOir.js} +168 -172
  6. package/dist/index-CRdDPWou.js +34 -0
  7. package/dist/{index-Dz1XJJEv.js → index-CSVsF1EQ.js} +28 -28
  8. package/dist/index-CceEGv05.js +104 -0
  9. package/dist/{index-DdYanSGw.js → index-CiWKwaC4.js} +2 -2
  10. package/dist/{index-6JzOJU8O.js → index-CmajMf1d.js} +21 -21
  11. package/dist/index-D5kHxP9H.js +43 -0
  12. package/dist/{index-29Y5fJR0.js → index-DNNz78Rc.js} +2 -2
  13. package/dist/index-Db33Ugg9.js +34 -0
  14. package/dist/index-DfhwDiOS.js +155 -0
  15. package/dist/index-arkRlpaR.js +80 -0
  16. package/dist/index-ufLC1PLO.js +57 -0
  17. package/dist/{index-Dxh7aMoG.js → index-vHMPqmOL.js} +2 -2
  18. package/dist/index.es.js +1 -1
  19. package/dist/{index.modern-fpUBOYPT.js → index.modern-B-ChKejQ.js} +9 -9
  20. package/dist/index.umd.js +115 -115
  21. package/dist/{logo-control-C5ZdRec5.js → logo-control-VgN6MEKI.js} +186 -206
  22. package/dist/{mapbox-gl-D6JObe4m.js → mapbox-gl-C6frO4Gl.js} +1877 -1877
  23. package/dist/{maplibre-gl-DDfJU6SR.js → maplibre-gl-DkDrZ6rP.js} +1230 -1228
  24. package/dist/{scale-control-Cflgzbvb.js → scale-control-jBKptTbw.js} +234 -252
  25. package/dist/style.css +1 -1
  26. package/dist/{styles-B8oT_wcC.js → styles-BR85tnqI.js} +16 -17
  27. package/package.json +2 -2
  28. package/dist/index-CHSsiFtN.js +0 -139
  29. package/dist/index-CqUTGwL0.js +0 -34
  30. package/dist/index-Cwn0dgP_.js +0 -56
  31. package/dist/index-D--WdzK4.js +0 -79
  32. package/dist/index-D1Phs0fA.js +0 -57
  33. package/dist/index-D1vI6Ww_.js +0 -43
  34. package/dist/index-DHHG0vNa.js +0 -157
  35. package/dist/index-DKFcZs0A.js +0 -81
  36. package/dist/index-DZTFM839.js +0 -105
  37. package/dist/index-_8n5sl1B.js +0 -56
  38. package/dist/index-_n1FGHXc.js +0 -34
@@ -1,157 +0,0 @@
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-C5ZdRec5.js";
5
- import { g as I } from "./utils-DJ13veBM.js";
6
- function g(t, e) {
7
- if (!t)
8
- throw new Error(e);
9
- }
10
- let M = 0;
11
- function z(t, e, n) {
12
- if (t.style && t.style._loaded) {
13
- const a = { ...n };
14
- return delete a.id, delete a.children, t.addSource(e, a), t.getSource(e);
15
- }
16
- return null;
17
- }
18
- function A(t, e, n) {
19
- var l, y, f;
20
- g(e.id === n.id, "source id changed"), g(e.type === n.type, "source type changed");
21
- let a = "", i = 0;
22
- for (const d in e)
23
- d !== "children" && d !== "id" && !s(n[d], e[d]) && (a = d, i++);
24
- if (!i)
25
- return;
26
- const o = e.type;
27
- if (o === "geojson")
28
- t.setData(e.data);
29
- else if (o === "image")
30
- t.updateImage({
31
- url: e.url,
32
- coordinates: e.coordinates
33
- });
34
- else
35
- switch (a) {
36
- case "coordinates":
37
- (l = t.setCoordinates) == null || l.call(t, e.coordinates);
38
- break;
39
- case "url":
40
- (y = t.setUrl) == null || y.call(t, e.url);
41
- break;
42
- case "tiles":
43
- (f = t.setTiles) == null || f.call(t, e.tiles);
44
- break;
45
- default:
46
- console.warn(`Unable to update <Source> prop: ${a}`);
47
- }
48
- }
49
- function E(t) {
50
- const e = k(C).map.getMap(), n = S(t), [, a] = b(0), i = m(() => t.id || `jsx-source-${M++}`, []);
51
- w(() => {
52
- if (e) {
53
- const l = () => setTimeout(() => a((y) => y + 1), 0);
54
- return e.on("styledata", l), l(), () => {
55
- var y;
56
- if (e.off("styledata", l), e.style && e.style._loaded && e.getSource(i)) {
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
- e.removeSource(i);
62
- }
63
- };
64
- }
65
- }, [e]);
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
- source: i
69
- })) || null;
70
- }
71
- function F(t, e, n, a) {
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
- return;
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
- const c = a.layout || {};
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
- }
82
- if (o !== a.paint) {
83
- const c = a.paint || {};
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
- }
89
- s(l, a.filter) || t.setFilter(e, l), (y !== a.minzoom || f !== a.maxzoom) && t.setLayerZoomRange(e, y, f);
90
- }
91
- function R(t, e, n) {
92
- if (t.style && t.style._loaded && (!("source" in n) || t.getSource(n.source))) {
93
- const a = { ...n, id: e };
94
- delete a.beforeId, t.addLayer(a, n.beforeId);
95
- }
96
- }
97
- let U = 0;
98
- function h(t) {
99
- const e = k(C).map.getMap(), n = S(t), [, a] = b(0), i = m(() => t.id || `jsx-layer-${U++}`, []);
100
- if (w(() => {
101
- if (e) {
102
- const l = () => a((y) => y + 1);
103
- return e.on("styledata", l), l(), () => {
104
- e.off("styledata", l), e.style && e.style._loaded && e.getLayer(i) && e.removeLayer(i);
105
- };
106
- }
107
- }, [e]), e && e.style && e.getLayer(i))
108
- try {
109
- F(e, i, t, n.current);
110
- } catch (l) {
111
- console.warn(l);
112
- }
113
- else
114
- R(e, i, t);
115
- return n.current = t, null;
116
- }
117
- function L(t, e, n) {
118
- switch (t) {
119
- case "fill":
120
- return {
121
- "fill-color": e,
122
- "fill-opacity": 0.25
123
- };
124
- case "line":
125
- return {
126
- "line-color": e,
127
- "line-width": n === "LineString" ? 6 : 2
128
- };
129
- default:
130
- return {};
131
- }
132
- }
133
- function T({ sources: t }) {
134
- const e = m(() => !Array.isArray(t) || t.length === 0 ? [] : t.map((n) => ({
135
- ...n,
136
- geoJson: n.geometry ? I(n.geometry, n.type) : null
137
- })), [t]);
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
- h,
140
- {
141
- id: `${n.key}-${i}`,
142
- type: a.type,
143
- paint: L(a.type, a.color, n.type)
144
- },
145
- `${n.key}-${i}`
146
- )) : /* @__PURE__ */ u(
147
- h,
148
- {
149
- id: n.key,
150
- type: n.layer.type,
151
- paint: L(n.layer.type, n.layer.color, n.type)
152
- }
153
- )) }, n.key) }, n.key)) });
154
- }
155
- export {
156
- T as default
157
- };
@@ -1,81 +0,0 @@
1
- import { jsxs as M, jsx as d } from "react/jsx-runtime";
2
- import { useState as v, useEffect as l } from "react";
3
- import { M as y, N as g, u as h } from "./scale-control-Cflgzbvb.js";
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-AcZakyxd.js";
6
- const L = ({ padding: i }) => {
7
- const { current: o } = h(), { markerPoints: n, setBounds: m, setZoom: f } = b(), [r, p] = v(void 0), a = () => {
8
- var t;
9
- if (!o)
10
- return;
11
- const e = (t = o.getBounds()) == null ? void 0 : t.toArray().flat();
12
- e && m(e);
13
- }, s = () => {
14
- o && f(o.getZoom());
15
- };
16
- return l(() => (a(), s(), o == null || o.on("move", () => {
17
- a();
18
- }), o == null || o.on("zoom", () => {
19
- s();
20
- }), () => {
21
- o == null || o.off("move", a), o == null || o.off("zoom", s);
22
- }), [o]), l(() => {
23
- if (!o || typeof n > "u" || n.length === 0)
24
- return;
25
- const e = B(z(n));
26
- e.every((t, c) => t === (r == null ? void 0 : r[c])) || p(e);
27
- }, [o, n]), l(() => {
28
- if (!o || typeof r > "u")
29
- return;
30
- const [e, t, c, x] = r;
31
- o.fitBounds(
32
- [
33
- [t, e],
34
- [x, c]
35
- ],
36
- {
37
- maxZoom: 17,
38
- duration: 700,
39
- padding: i
40
- }
41
- );
42
- }, [o, r, i]), null;
43
- };
44
- function A({ padding: i, children: o }) {
45
- const {
46
- mapProvider: n,
47
- center: m,
48
- zoom: f = u.zoom,
49
- minZoom: r,
50
- maxZoom: p,
51
- pitch: a = u.pitch,
52
- bearing: s = u.bearing,
53
- cooperativeGestures: e = u.cooperativeGestures,
54
- zoomPosition: t
55
- } = b();
56
- return n.name !== "mapbox" ? null : /* @__PURE__ */ M(
57
- y,
58
- {
59
- mapboxAccessToken: n.apiKey,
60
- initialViewState: {
61
- ...m,
62
- zoom: f,
63
- pitch: a,
64
- bearing: s
65
- },
66
- cooperativeGestures: e,
67
- minZoom: r,
68
- maxZoom: p,
69
- mapStyle: `mapbox://styles/${n.theme || Z.mapbox}`,
70
- interactiveLayerIds: ["road-label", "waterway-label"],
71
- children: [
72
- /* @__PURE__ */ d(L, { padding: i }),
73
- t && /* @__PURE__ */ d(g, { position: t }),
74
- o
75
- ]
76
- }
77
- );
78
- }
79
- export {
80
- A as default
81
- };
@@ -1,105 +0,0 @@
1
- import { jsxs as v, jsx as T } from "react/jsx-runtime";
2
- import { useState as h, useEffect as M } from "react";
3
- import { A as y, M as L, C as f, u as P } from "./index.modern-fpUBOYPT.js";
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-AcZakyxd.js";
6
- const Z = {
7
- "top-left": f.LEFT_TOP,
8
- "top-right": f.RIGHT_TOP,
9
- "bottom-left": f.LEFT_BOTTOM,
10
- "bottom-right": f.RIGHT_BOTTOM
11
- }, z = ({
12
- isMapLoaded: c,
13
- padding: u
14
- }) => {
15
- const e = P(), { markerPoints: s, setBounds: r, setZoom: d } = b(), [n, l] = h(void 0), i = () => {
16
- var t;
17
- if (!e)
18
- return;
19
- const o = (t = e.getBounds()) == null ? void 0 : t.toJSON();
20
- o && r([o.west, o.south, o.east, o.north]);
21
- }, m = () => {
22
- if (!e)
23
- return;
24
- const o = e.getZoom();
25
- typeof o < "u" && d(o + 1);
26
- };
27
- return M(() => {
28
- i(), m();
29
- const o = e == null ? void 0 : e.addListener("bounds_changed", () => {
30
- i();
31
- }), t = e == null ? void 0 : e.addListener("zoom_changed", () => {
32
- m();
33
- });
34
- return () => {
35
- o == null || o.remove(), t == null || t.remove();
36
- };
37
- }, [e]), M(() => {
38
- if (!e || typeof s > "u" || s.length === 0)
39
- return;
40
- const o = x(O(s));
41
- o.every((t, a) => t === (n == null ? void 0 : n[a])) || l(o);
42
- }, [e, s]), M(() => {
43
- if (!e || typeof n > "u")
44
- return;
45
- const [o, t, a, g] = n;
46
- e.fitBounds(
47
- {
48
- south: o,
49
- west: t,
50
- north: a,
51
- east: g
52
- },
53
- u
54
- );
55
- }, [c, e, n, u]), null;
56
- };
57
- function E({ padding: c, children: u }) {
58
- const [e, s] = h(!1), {
59
- mapProvider: r,
60
- center: d,
61
- zoom: n = p.zoom,
62
- minZoom: l,
63
- maxZoom: i,
64
- pitch: m = p.pitch,
65
- bearing: o = p.bearing,
66
- cooperativeGestures: t = p.cooperativeGestures,
67
- zoomPosition: a
68
- } = b();
69
- if (r.name !== "google")
70
- return null;
71
- const g = () => {
72
- s(!0);
73
- };
74
- return /* @__PURE__ */ v(y, { apiKey: r.apiKey, children: [
75
- /* @__PURE__ */ T(z, { isMapLoaded: e, padding: c }),
76
- /* @__PURE__ */ T(
77
- L,
78
- {
79
- mapId: r.theme || B.google,
80
- defaultCenter: {
81
- lat: d.latitude,
82
- lng: d.longitude
83
- },
84
- defaultZoom: n + 1,
85
- defaultTilt: m,
86
- defaultHeading: o,
87
- gestureHandling: t ? "cooperative" : "greedy",
88
- streetViewControl: !1,
89
- fullscreenControl: !1,
90
- clickableIcons: !1,
91
- mapTypeControl: !1,
92
- zoomControlOptions: {
93
- position: a && Z[a]
94
- },
95
- minZoom: typeof l == "number" ? l + 1 : void 0,
96
- maxZoom: typeof i == "number" ? i + 1 : void 0,
97
- onTilesLoaded: g,
98
- children: u
99
- }
100
- )
101
- ] });
102
- }
103
- export {
104
- E as default
105
- };
@@ -1,56 +0,0 @@
1
- import { jsxs as M, jsx as p } from "react/jsx-runtime";
2
- import { a as b } from "./scale-control-Cflgzbvb.js";
3
- import "react";
4
- import { u, M as h } from "./index-AcZakyxd.js";
5
- import { C as k, c as x, M as I } from "./index-6JzOJU8O.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,34 +0,0 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { useEffect as a } from "react";
3
- import { P as c } from "./scale-control-Cflgzbvb.js";
4
- import { u as i } from "./index-AcZakyxd.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
- };