@local-logic/maps 0.0.21 → 0.0.23

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
@@ -0,0 +1,56 @@
1
+ import { jsxs as f, jsx as i } from "react/jsx-runtime";
2
+ import { a as k } from "./scale-control-jBKptTbw.js";
3
+ import "react";
4
+ import { u, M } from "./index-CN_dNOir.js";
5
+ import { C as g, c as C, M as b } from "./index-CmajMf1d.js";
6
+ function _({
7
+ clusters: n,
8
+ colors: r,
9
+ clusterIcon: s,
10
+ onClick: p,
11
+ doesSuperclusterContainActiveMarker: d
12
+ }) {
13
+ const { activeMarker: m, zoom: c } = u(), l = (o) => (e) => {
14
+ e.originalEvent.stopPropagation(), !o.properties.disableClick && p?.(o);
15
+ };
16
+ return n?.map((o, e) => {
17
+ const t = o.geometry.coordinates[0], a = o.geometry.coordinates[1];
18
+ return /* @__PURE__ */ f(
19
+ k,
20
+ {
21
+ anchor: "bottom",
22
+ longitude: t,
23
+ latitude: a,
24
+ onClick: l(o),
25
+ children: [
26
+ o.properties.cluster && /* @__PURE__ */ i(
27
+ g,
28
+ {
29
+ colors: r,
30
+ icon: s,
31
+ isActive: d(o.properties.cluster_id)
32
+ }
33
+ ),
34
+ !o.properties.cluster && /* @__PURE__ */ i(
35
+ "div",
36
+ {
37
+ className: C,
38
+ style: o.properties.defaultColor ? {} : {
39
+ "--background": r?.background,
40
+ "--fill": r?.fill
41
+ },
42
+ "data-is-cluster": !!o.properties.cluster,
43
+ "data-is-zoomed-out": c < M,
44
+ "data-is-active": m?.id === o.properties.id,
45
+ children: /* @__PURE__ */ i(b, { icon: o.properties.icon })
46
+ }
47
+ )
48
+ ]
49
+ },
50
+ `map-marker-${t}-${a}-${e}`
51
+ );
52
+ });
53
+ }
54
+ export {
55
+ _ as default
56
+ };
@@ -0,0 +1,138 @@
1
+ import { jsx as c, Fragment as b } from "react/jsx-runtime";
2
+ import * as $ from "react";
3
+ import { useContext as S, useRef as k, useState as C, useMemo as g, useEffect as w, cloneElement as j } from "react";
4
+ import { b as x, d as u } from "./scale-control-jBKptTbw.js";
5
+ import { g as I } from "./utils-DJ13veBM.js";
6
+ function s(t, e) {
7
+ if (!t)
8
+ throw new Error(e);
9
+ }
10
+ let M = 0;
11
+ function U(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 z(t, e, n) {
19
+ s(e.id === n.id, "source id changed"), s(e.type === n.type, "source type changed");
20
+ let a = "", i = 0;
21
+ for (const o in e)
22
+ o !== "children" && o !== "id" && !u(n[o], e[o]) && (a = o, i++);
23
+ if (!i)
24
+ return;
25
+ const l = e.type;
26
+ l === "geojson" ? t.setData(e.data) : l === "image" ? t.updateImage({
27
+ url: e.url,
28
+ coordinates: e.coordinates
29
+ }) : "setCoordinates" in t && i === 1 && a === "coordinates" ? t.setCoordinates(e.coordinates) : "setUrl" in t && a === "url" ? t.setUrl(e.url) : "setTiles" in t && a === "tiles" ? t.setTiles(e.tiles) : console.warn(`Unable to update <Source> prop: ${a}`);
30
+ }
31
+ function A(t) {
32
+ const e = S(x).map.getMap(), n = k(t), [, a] = C(0), i = g(() => t.id || `jsx-source-${M++}`, []);
33
+ w(() => {
34
+ if (e) {
35
+ const o = () => setTimeout(() => a((y) => y + 1), 0);
36
+ return e.on("styledata", o), o(), () => {
37
+ if (e.off("styledata", o), e.style && e.style._loaded && e.getSource(i)) {
38
+ const y = e.getStyle()?.layers;
39
+ if (y)
40
+ for (const f of y)
41
+ f.source === i && e.removeLayer(f.id);
42
+ e.removeSource(i);
43
+ }
44
+ };
45
+ }
46
+ }, [e]);
47
+ let l = e && e.style && e.getSource(i);
48
+ return l ? z(l, t, n.current) : l = U(e, i, t), n.current = t, l && $.Children.map(t.children, (o) => o && j(o, {
49
+ source: i
50
+ })) || null;
51
+ }
52
+ function E(t, e, n, a) {
53
+ if (s(n.id === a.id, "layer id changed"), s(n.type === a.type, "layer type changed"), n.type === "custom" || a.type === "custom")
54
+ return;
55
+ const { layout: i = {}, paint: l = {}, filter: o, minzoom: y, maxzoom: f, beforeId: m } = n;
56
+ if (m !== a.beforeId && t.moveLayer(e, m), i !== a.layout) {
57
+ const d = a.layout || {};
58
+ for (const r in i)
59
+ u(i[r], d[r]) || t.setLayoutProperty(e, r, i[r]);
60
+ for (const r in d)
61
+ i.hasOwnProperty(r) || t.setLayoutProperty(e, r, void 0);
62
+ }
63
+ if (l !== a.paint) {
64
+ const d = a.paint || {};
65
+ for (const r in l)
66
+ u(l[r], d[r]) || t.setPaintProperty(e, r, l[r]);
67
+ for (const r in d)
68
+ l.hasOwnProperty(r) || t.setPaintProperty(e, r, void 0);
69
+ }
70
+ u(o, a.filter) || t.setFilter(e, o), (y !== a.minzoom || f !== a.maxzoom) && t.setLayerZoomRange(e, y, f);
71
+ }
72
+ function F(t, e, n) {
73
+ if (t.style && t.style._loaded && (!("source" in n) || t.getSource(n.source))) {
74
+ const a = { ...n, id: e };
75
+ delete a.beforeId, t.addLayer(a, n.beforeId);
76
+ }
77
+ }
78
+ let R = 0;
79
+ function L(t) {
80
+ const e = S(x).map.getMap(), n = k(t), [, a] = C(0), i = g(() => t.id || `jsx-layer-${R++}`, []);
81
+ if (w(() => {
82
+ if (e) {
83
+ const o = () => a((y) => y + 1);
84
+ return e.on("styledata", o), o(), () => {
85
+ e.off("styledata", o), e.style && e.style._loaded && e.getLayer(i) && e.removeLayer(i);
86
+ };
87
+ }
88
+ }, [e]), e && e.style && e.getLayer(i))
89
+ try {
90
+ E(e, i, t, n.current);
91
+ } catch (o) {
92
+ console.warn(o);
93
+ }
94
+ else
95
+ F(e, i, t);
96
+ return n.current = t, null;
97
+ }
98
+ function h(t, e, n) {
99
+ switch (t) {
100
+ case "fill":
101
+ return {
102
+ "fill-color": e,
103
+ "fill-opacity": 0.25
104
+ };
105
+ case "line":
106
+ return {
107
+ "line-color": e,
108
+ "line-width": n === "LineString" ? 6 : 2
109
+ };
110
+ default:
111
+ return {};
112
+ }
113
+ }
114
+ function O({ sources: t }) {
115
+ const e = g(() => !Array.isArray(t) || t.length === 0 ? [] : t.map((n) => ({
116
+ ...n,
117
+ geoJson: n.geometry ? I(n.geometry, n.type) : null
118
+ })), [t]);
119
+ return e?.length === 0 ? null : /* @__PURE__ */ c(b, { children: e?.map((n) => /* @__PURE__ */ c("div", { children: n.geoJson && /* @__PURE__ */ c(A, { id: n.key, type: "geojson", data: n.geoJson, children: n.layer && (Array.isArray(n.layer) ? n.layer.map((a, i) => /* @__PURE__ */ c(
120
+ L,
121
+ {
122
+ id: `${n.key}-${i}`,
123
+ type: a.type,
124
+ paint: h(a.type, a.color, n.type)
125
+ },
126
+ `${n.key}-${i}`
127
+ )) : /* @__PURE__ */ c(
128
+ L,
129
+ {
130
+ id: n.key,
131
+ type: n.layer.type,
132
+ paint: h(n.layer.type, n.layer.color, n.type)
133
+ }
134
+ )) }, n.key) }, n.key)) });
135
+ }
136
+ export {
137
+ O as default
138
+ };
@@ -0,0 +1,78 @@
1
+ import { jsxs as x, jsx as d } from "react/jsx-runtime";
2
+ import { useState as y, useEffect as c } from "react";
3
+ import { M as B, N as g, u as h } from "./logo-control-VgN6MEKI.js";
4
+ import { b } from "./index-CFomI3Il.js";
5
+ import { u as M, d as m, a as Z, m as k } from "./index-CN_dNOir.js";
6
+ const z = ({ padding: i }) => {
7
+ const { current: o } = h(), { markerPoints: e, setBounds: u, setZoom: p } = M(), [n, f] = y(void 0), a = () => {
8
+ if (!o)
9
+ return;
10
+ const t = o.getBounds()?.toArray().flat();
11
+ t && u(t);
12
+ }, s = () => {
13
+ o && p(o.getZoom());
14
+ };
15
+ return c(() => (a(), s(), o?.on("move", () => {
16
+ a();
17
+ }), o?.on("zoom", () => {
18
+ s();
19
+ }), () => {
20
+ o?.off("move", a), o?.off("zoom", s);
21
+ }), [o]), c(() => {
22
+ if (!o || typeof e > "u" || e.length === 0)
23
+ return;
24
+ const t = b(k(e));
25
+ t.every((r, l) => r === n?.[l]) || f(t);
26
+ }, [o, e]), c(() => {
27
+ if (!o || typeof n > "u")
28
+ return;
29
+ const [t, r, l, v] = n;
30
+ o.fitBounds(
31
+ [
32
+ [r, t],
33
+ [v, l]
34
+ ],
35
+ {
36
+ maxZoom: 17,
37
+ duration: 700,
38
+ padding: i
39
+ }
40
+ );
41
+ }, [o, n, i]), null;
42
+ };
43
+ function C({ padding: i, children: o }) {
44
+ const {
45
+ mapProvider: e,
46
+ center: u,
47
+ zoom: p = m.zoom,
48
+ minZoom: n,
49
+ maxZoom: f,
50
+ pitch: a = m.pitch,
51
+ bearing: s = m.bearing,
52
+ cooperativeGestures: t = m.cooperativeGestures,
53
+ zoomPosition: r
54
+ } = M();
55
+ return e.name !== "maptiler" ? null : /* @__PURE__ */ x(
56
+ B,
57
+ {
58
+ initialViewState: {
59
+ ...u,
60
+ zoom: p,
61
+ pitch: a,
62
+ bearing: s
63
+ },
64
+ cooperativeGestures: t,
65
+ minZoom: n,
66
+ maxZoom: f,
67
+ mapStyle: `https://api.maptiler.com/maps/${e.theme || Z.maptiler}/style.json?key=${e.apiKey}`,
68
+ children: [
69
+ /* @__PURE__ */ d(z, { padding: i }),
70
+ r && /* @__PURE__ */ d(g, { position: r }),
71
+ o
72
+ ]
73
+ }
74
+ );
75
+ }
76
+ export {
77
+ C as default
78
+ };
@@ -0,0 +1,56 @@
1
+ import { jsxs as f, jsx as i } from "react/jsx-runtime";
2
+ import { a as k } from "./logo-control-VgN6MEKI.js";
3
+ import "react";
4
+ import { u, M } from "./index-CN_dNOir.js";
5
+ import { C as g, c as C, M as v } from "./index-CmajMf1d.js";
6
+ function x({
7
+ clusters: n,
8
+ colors: o,
9
+ clusterIcon: s,
10
+ onClick: p,
11
+ doesSuperclusterContainActiveMarker: d
12
+ }) {
13
+ const { activeMarker: m, zoom: c } = u(), l = (r) => (e) => {
14
+ e.originalEvent.stopPropagation(), !r.properties.disableClick && p?.(r);
15
+ };
16
+ return n?.map((r, e) => {
17
+ const t = r.geometry.coordinates[0], a = r.geometry.coordinates[1];
18
+ return /* @__PURE__ */ f(
19
+ k,
20
+ {
21
+ anchor: "bottom",
22
+ longitude: t,
23
+ latitude: a,
24
+ onClick: l(r),
25
+ children: [
26
+ r.properties.cluster && r.properties.cluster_id && /* @__PURE__ */ i(
27
+ g,
28
+ {
29
+ colors: o,
30
+ icon: s,
31
+ isActive: d(r.properties.cluster_id)
32
+ }
33
+ ),
34
+ !r.properties.cluster && /* @__PURE__ */ i(
35
+ "div",
36
+ {
37
+ className: C,
38
+ style: r.properties.defaultColor ? {} : {
39
+ "--background": o?.background,
40
+ "--fill": o?.fill
41
+ },
42
+ "data-is-cluster": !!r.properties.cluster,
43
+ "data-is-zoomed-out": c < M,
44
+ "data-is-active": m?.id === r.properties.id,
45
+ children: /* @__PURE__ */ i(v, { icon: r.properties.icon })
46
+ }
47
+ )
48
+ ]
49
+ },
50
+ `map-marker-${t}-${a}-${e}`
51
+ );
52
+ });
53
+ }
54
+ export {
55
+ x as default
56
+ };