@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.
- package/dist/{index-Bn4XgGCE.js → index-BOJCRr60.js} +2 -2
- package/dist/{index-DRdXfLHP.js → index-BUZonjTY.js} +1 -1
- package/dist/index-BabQioiH.js +109 -0
- package/dist/{index-B9irDFVS.js → index-CTWLtI5f.js} +51 -48
- package/dist/{index-BCEeluIN.js → index-CWXZA3V3.js} +2 -2
- package/dist/{index-B1UUkU25.js → index-Ci9PQ3VM.js} +2 -2
- package/dist/{index-D5oT0rvy.js → index-D37STE_k.js} +88 -87
- package/dist/{index-CIE9YlvM.js → index-D8-yY6UK.js} +1 -1
- package/dist/{index-Cnab0xsb.js → index-DHOxmHER.js} +2 -2
- package/dist/{index-GGtrKiJn.js → index-DKy2opdk.js} +1 -1
- package/dist/{index-DImiFUoC.js → index-Dy0j33aN.js} +2 -2
- package/dist/{index-CEDpofgZ.js → index-k9UFzKZZ.js} +8 -7
- package/dist/{index--TOrExMa.js → index-vIYPnHrB.js} +2 -2
- package/dist/{index-7WiriOPf.js → index-xDS1OfMB.js} +48 -45
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/src/components/Map/Root/BaseMap/Google/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/BaseMap/Mapbox/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/BaseMap/Maptiler/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Layers/Google/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Layers/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Layers/types.d.ts +12 -1
- package/dist/src/components/Map/Root/Layers/types.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Layers/utils.d.ts +3 -4
- package/dist/src/components/Map/Root/Layers/utils.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Markers/index.d.ts +1 -1
- package/dist/src/components/Map/Root/Markers/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Markers/types.d.ts +1 -0
- package/dist/src/components/Map/Root/Markers/types.d.ts.map +1 -1
- package/dist/src/components/Map/Root/context.d.ts +0 -1
- package/dist/src/components/Map/Root/context.d.ts.map +1 -1
- package/dist/src/components/Map/Root/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/types.d.ts +1 -0
- package/dist/src/components/Map/Root/types.d.ts.map +1 -1
- package/dist/src/components/Map/storybook-data.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/{styles-mseP7Fna.js → styles-B3ZaR0wz.js} +1 -1
- package/dist/utils-IAXGPK5I.js +33 -0
- package/package.json +3 -3
- package/dist/index-5JWsWx8g.js +0 -107
- package/dist/utils-DJ13veBM.js +0 -25
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function u(a = [], l = "MultiPolygon") {
|
|
2
|
+
const n = (s) => Object.values(s).map((r) => Array.isArray(r[0]) ? n(r) : [r[1], r[0]]), o = n(a);
|
|
3
|
+
let t;
|
|
4
|
+
if (l === "MultiPolygon") {
|
|
5
|
+
const s = o[0]?.[0], r = o[0]?.[1];
|
|
6
|
+
t = [[s || [], ...r || []]];
|
|
7
|
+
} else
|
|
8
|
+
t = o;
|
|
9
|
+
return {
|
|
10
|
+
type: "FeatureCollection",
|
|
11
|
+
features: [
|
|
12
|
+
{
|
|
13
|
+
type: "Feature",
|
|
14
|
+
geometry: {
|
|
15
|
+
type: l,
|
|
16
|
+
coordinates: t
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function g(a = [], l = "MultiPolygon") {
|
|
23
|
+
const n = (t) => Object.values(t).map((e) => Array.isArray(e[0]) ? n(e) : { lat: e[0], lng: e[1] }), o = n(a);
|
|
24
|
+
if (l === "MultiPolygon") {
|
|
25
|
+
const t = o, e = t[0]?.[0], s = t[0]?.[1];
|
|
26
|
+
return [e || [], ...s || []];
|
|
27
|
+
}
|
|
28
|
+
return o;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
g as a,
|
|
32
|
+
u as g
|
|
33
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@local-logic/maps",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "This is a maps implementation allowing for the display of Local Logic data on a map.",
|
|
5
5
|
"author": "Local Logic",
|
|
6
6
|
"license": "ISC",
|
|
@@ -92,11 +92,11 @@
|
|
|
92
92
|
"react-dom": "^19.1.1",
|
|
93
93
|
"react-map-gl": "^8.1.0",
|
|
94
94
|
"rollup-plugin-visualizer": "^5.14.0",
|
|
95
|
-
"storybook": "^8.6.
|
|
95
|
+
"storybook": "^8.6.15",
|
|
96
96
|
"tailwindcss": "^3.4.17",
|
|
97
97
|
"tsconfig": "workspace:*",
|
|
98
98
|
"typescript": "^5.9.2",
|
|
99
|
-
"vite": "^7.2.
|
|
99
|
+
"vite": "^7.2.3",
|
|
100
100
|
"vite-plugin-dts": "^4.5.4",
|
|
101
101
|
"vite-plugin-svgr": "^4.3.0",
|
|
102
102
|
"vitest": "^3.2.4"
|
package/dist/index-5JWsWx8g.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { jsx as y, jsxs as x, Fragment as A } from "react/jsx-runtime";
|
|
2
|
-
import { useState as P, useEffect as h, useRef as C, useCallback as E } from "react";
|
|
3
|
-
import { APIProvider as O, Map as z, ControlPosition as c, useMap as G } from "@vis.gl/react-google-maps";
|
|
4
|
-
import { u as B, D as g, W as L, a as Z, m as k } from "./index-D5oT0rvy.js";
|
|
5
|
-
import { t as I } from "./index-DscDx7HE.js";
|
|
6
|
-
const R = {
|
|
7
|
-
"top-left": c.LEFT_TOP,
|
|
8
|
-
"top-right": c.RIGHT_TOP,
|
|
9
|
-
"bottom-left": c.LEFT_BOTTOM,
|
|
10
|
-
"bottom-right": c.RIGHT_BOTTOM
|
|
11
|
-
}, D = ({ isMapLoaded: M }) => {
|
|
12
|
-
const o = G(), { markerPoints: s, setZoom: i, mapPadding: m } = B(), [t, n] = P(void 0), l = C(void 0), d = E(() => {
|
|
13
|
-
if (!o)
|
|
14
|
-
return;
|
|
15
|
-
const e = o.getZoom();
|
|
16
|
-
typeof e < "u" && i(e + 1);
|
|
17
|
-
}, [o, i]);
|
|
18
|
-
return h(() => {
|
|
19
|
-
d();
|
|
20
|
-
const e = o?.addListener("zoom_changed", d);
|
|
21
|
-
return () => {
|
|
22
|
-
e?.remove();
|
|
23
|
-
};
|
|
24
|
-
}, [o, d]), h(() => {
|
|
25
|
-
if (!o || typeof s > "u" || s.length === 0)
|
|
26
|
-
return;
|
|
27
|
-
const e = I(k(s));
|
|
28
|
-
(!l.current || !e.every((a, r) => a === l.current?.[r])) && (l.current = e, n(e));
|
|
29
|
-
}, [o, s]), h(() => {
|
|
30
|
-
if (!o || typeof t > "u")
|
|
31
|
-
return;
|
|
32
|
-
const [e, a, r, u] = t, f = (r - e) * 0.05 || 1e-3, p = (u - a) * 0.05 || 1e-3;
|
|
33
|
-
o.fitBounds(
|
|
34
|
-
{
|
|
35
|
-
south: a - p,
|
|
36
|
-
west: e - f,
|
|
37
|
-
north: u + p,
|
|
38
|
-
east: r + f
|
|
39
|
-
},
|
|
40
|
-
m
|
|
41
|
-
);
|
|
42
|
-
}, [M, o, t, m]), null;
|
|
43
|
-
};
|
|
44
|
-
function j({ children: M }) {
|
|
45
|
-
const [o, s] = P(!1), [i, m] = P(!1), {
|
|
46
|
-
mapProvider: t,
|
|
47
|
-
mapPadding: n,
|
|
48
|
-
locale: l,
|
|
49
|
-
center: d,
|
|
50
|
-
zoom: e = g.zoom,
|
|
51
|
-
minZoom: a,
|
|
52
|
-
maxZoom: r,
|
|
53
|
-
pitch: u = g.pitch,
|
|
54
|
-
bearing: f = g.bearing,
|
|
55
|
-
cooperativeGestures: p = g.cooperativeGestures,
|
|
56
|
-
zoomPosition: v
|
|
57
|
-
} = B();
|
|
58
|
-
if (h(() => {
|
|
59
|
-
if (!i)
|
|
60
|
-
return;
|
|
61
|
-
const T = document.querySelector(".gm-style-moc");
|
|
62
|
-
T && n && (T.style.paddingLeft = `${n.left}px`, T.style.paddingRight = `${n.right}px`);
|
|
63
|
-
}, [i, n?.left, n?.right]), t.name !== "google")
|
|
64
|
-
return null;
|
|
65
|
-
const _ = () => {
|
|
66
|
-
s(!0);
|
|
67
|
-
}, b = () => {
|
|
68
|
-
m(!0);
|
|
69
|
-
};
|
|
70
|
-
return /* @__PURE__ */ y(O, { apiKey: t.apiKey, language: l, onLoad: _, children: o && /* @__PURE__ */ x(A, { children: [
|
|
71
|
-
/* @__PURE__ */ y(D, { isMapLoaded: i }),
|
|
72
|
-
/* @__PURE__ */ y(
|
|
73
|
-
z,
|
|
74
|
-
{
|
|
75
|
-
mapId: t.theme || Z.google,
|
|
76
|
-
defaultCenter: {
|
|
77
|
-
lat: d.latitude,
|
|
78
|
-
lng: d.longitude
|
|
79
|
-
},
|
|
80
|
-
defaultBounds: {
|
|
81
|
-
north: L[3],
|
|
82
|
-
south: L[1],
|
|
83
|
-
east: L[2],
|
|
84
|
-
west: L[0]
|
|
85
|
-
},
|
|
86
|
-
defaultZoom: e + 1,
|
|
87
|
-
defaultTilt: u,
|
|
88
|
-
defaultHeading: f,
|
|
89
|
-
gestureHandling: p ? "cooperative" : "greedy",
|
|
90
|
-
streetViewControl: !1,
|
|
91
|
-
fullscreenControl: !1,
|
|
92
|
-
clickableIcons: !1,
|
|
93
|
-
mapTypeControl: !1,
|
|
94
|
-
zoomControlOptions: {
|
|
95
|
-
position: v && R[v]
|
|
96
|
-
},
|
|
97
|
-
minZoom: typeof a == "number" ? a + 1 : void 0,
|
|
98
|
-
maxZoom: typeof r == "number" ? r + 1 : void 0,
|
|
99
|
-
onTilesLoaded: b,
|
|
100
|
-
children: M
|
|
101
|
-
}
|
|
102
|
-
)
|
|
103
|
-
] }) });
|
|
104
|
-
}
|
|
105
|
-
export {
|
|
106
|
-
j as default
|
|
107
|
-
};
|
package/dist/utils-DJ13veBM.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
function c(r = [], t = "MultiPolygon") {
|
|
2
|
-
const n = (s) => Object.values(s).map((o) => Array.isArray(o[0]) ? n(o) : [o[1], o[0]]), a = n(r);
|
|
3
|
-
return {
|
|
4
|
-
type: "FeatureCollection",
|
|
5
|
-
features: [
|
|
6
|
-
{
|
|
7
|
-
type: "Feature",
|
|
8
|
-
geometry: {
|
|
9
|
-
type: t,
|
|
10
|
-
coordinates: a
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
]
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function i(r = []) {
|
|
17
|
-
const t = (a) => Object.values(a).map((e) => Array.isArray(e[0]) ? t(e.flat()) : { lat: e[0], lng: e[1] });
|
|
18
|
-
return t(
|
|
19
|
-
r
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
i as a,
|
|
24
|
-
c as g
|
|
25
|
-
};
|