@local-logic/maps 0.0.14 → 0.0.16
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-CTk5bvm9.js → index-3kRdcdZh.js} +41 -39
- package/dist/{index-BCa658u4.js → index-BFK3wMTT.js} +1 -1
- package/dist/{index-CNxLnZ8O.js → index-BQRXN0e-.js} +1 -1
- package/dist/{index-Bp1bWq9c.js → index-BUkdAOYF.js} +5 -5
- package/dist/index-Brp2pz_Z.js +57 -0
- package/dist/{index-BGoTpJjt.js → index-BvnFFiii.js} +1 -1
- package/dist/{index-CBp9gCca.js → index-CTU66ogZ.js} +29 -29
- package/dist/{index-DY5pY-zk.js → index-CV_IAyz3.js} +1 -1
- package/dist/{index-CUpaKIZP.js → index-Cg3HD19r.js} +1 -1
- package/dist/{index-S5SfktvB.js → index-CnuTCmRK.js} +1 -1
- package/dist/index-DJ1PVoCd.js +56 -0
- package/dist/{index-C36u5N_F.js → index-DyGtnON3.js} +1 -1
- package/dist/{index-CXUQoF5Q.js → index-Dzgb7feN.js} +1 -1
- package/dist/index-NEUlLLtm.js +56 -0
- package/dist/{index-DVitM43i.js → index-Yh7bUURu.js} +41 -39
- package/dist/index-_YvDHCeI.js +23 -0
- package/dist/index-x3wrHsPD.js +73 -0
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +27 -27
- package/dist/src/components/Map/Root/CenterPin/Maptiler/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/CenterPin/styles.d.ts +2 -2
- package/dist/src/components/Map/Root/CenterPin/styles.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/Mapbox/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Layers/Maptiler/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Layers/types.d.ts +1 -0
- package/dist/src/components/Map/Root/Layers/types.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Layers/utils.d.ts +2 -2
- package/dist/src/components/Map/Root/Layers/utils.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Markers/Google/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Markers/Mapbox/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Markers/Maptiler/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Markers/styles.d.ts +2 -2
- package/dist/src/components/Map/Root/Markers/styles.d.ts.map +1 -1
- package/dist/src/components/Map/Root/types.d.ts +2 -0
- package/dist/src/components/Map/Root/types.d.ts.map +1 -1
- package/dist/src/components/Map/index.stories.d.ts.map +1 -1
- package/dist/src/components/Map/storybook-data.d.ts +1 -0
- package/dist/src/components/Map/storybook-data.d.ts.map +1 -1
- package/dist/style.css +1 -24
- package/dist/{styles-D2MYaLhP.js → styles-Do-o-qNU.js} +8 -7
- package/dist/utils-DJ13veBM.js +25 -0
- package/package.json +1 -1
- package/dist/index-58w3Qwxr.js +0 -56
- package/dist/index-CCtDJ-mV.js +0 -56
- package/dist/index-CXTsUiSS.js +0 -57
- package/dist/index-Do_dW76Q.js +0 -23
- package/dist/index-UEadmVww.js +0 -64
- package/dist/utils-YqJg0vBb.js +0 -25
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as u, Fragment as b } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { useContext as S, useRef as k, useState as
|
|
4
|
-
import { b as
|
|
5
|
-
import { g as
|
|
2
|
+
import * as $ from "react";
|
|
3
|
+
import { useContext as S, useRef as k, useState as C, useMemo as m, useEffect as w, cloneElement as j } from "react";
|
|
4
|
+
import { b as x, d as s } from "./scale-control-CyJd4u6j.js";
|
|
5
|
+
import { g as I } from "./utils-DJ13veBM.js";
|
|
6
6
|
function g(t, e) {
|
|
7
7
|
if (!t)
|
|
8
8
|
throw new Error(e);
|
|
9
9
|
}
|
|
10
|
-
let
|
|
11
|
-
function
|
|
10
|
+
let M = 0;
|
|
11
|
+
function U(t, e, n) {
|
|
12
12
|
if (t.style && t.style._loaded) {
|
|
13
13
|
const a = { ...n };
|
|
14
14
|
return delete a.id, delete a.children, t.addSource(e, a), t.getSource(e);
|
|
@@ -18,8 +18,8 @@ function $(t, e, n) {
|
|
|
18
18
|
function z(t, e, n) {
|
|
19
19
|
g(e.id === n.id, "source id changed"), g(e.type === n.type, "source type changed");
|
|
20
20
|
let a = "", i = 0;
|
|
21
|
-
for (const
|
|
22
|
-
|
|
21
|
+
for (const l in e)
|
|
22
|
+
l !== "children" && l !== "id" && !s(n[l], e[l]) && (a = l, i++);
|
|
23
23
|
if (!i)
|
|
24
24
|
return;
|
|
25
25
|
const r = e.type;
|
|
@@ -29,13 +29,13 @@ function z(t, e, n) {
|
|
|
29
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
30
|
}
|
|
31
31
|
function A(t) {
|
|
32
|
-
const e = S(
|
|
33
|
-
|
|
32
|
+
const e = S(x).map.getMap(), n = k(t), [, a] = C(0), i = m(() => t.id || `jsx-source-${M++}`, []);
|
|
33
|
+
w(() => {
|
|
34
34
|
if (e) {
|
|
35
|
-
const
|
|
36
|
-
return e.on("styledata",
|
|
35
|
+
const l = () => setTimeout(() => a((y) => y + 1), 0);
|
|
36
|
+
return e.on("styledata", l), l(), () => {
|
|
37
37
|
var y;
|
|
38
|
-
if (e.off("styledata",
|
|
38
|
+
if (e.off("styledata", l), e.style && e.style._loaded && e.getSource(i)) {
|
|
39
39
|
const f = (y = e.getStyle()) == null ? void 0 : y.layers;
|
|
40
40
|
if (f)
|
|
41
41
|
for (const d of f)
|
|
@@ -46,29 +46,29 @@ function A(t) {
|
|
|
46
46
|
}
|
|
47
47
|
}, [e]);
|
|
48
48
|
let r = e && e.style && e.getSource(i);
|
|
49
|
-
return r ? z(r, t, n.current) : r =
|
|
49
|
+
return r ? z(r, t, n.current) : r = U(e, i, t), n.current = t, r && $.Children.map(t.children, (l) => l && j(l, {
|
|
50
50
|
source: i
|
|
51
51
|
})) || null;
|
|
52
52
|
}
|
|
53
53
|
function E(t, e, n, a) {
|
|
54
54
|
if (g(n.id === a.id, "layer id changed"), g(n.type === a.type, "layer type changed"), n.type === "custom" || a.type === "custom")
|
|
55
55
|
return;
|
|
56
|
-
const { layout: i = {}, paint: r = {}, filter:
|
|
56
|
+
const { layout: i = {}, paint: r = {}, filter: l, minzoom: y, maxzoom: f, beforeId: d } = n;
|
|
57
57
|
if (d !== a.beforeId && t.moveLayer(e, d), i !== a.layout) {
|
|
58
58
|
const c = a.layout || {};
|
|
59
|
-
for (const
|
|
60
|
-
s(i[
|
|
61
|
-
for (const
|
|
62
|
-
i.hasOwnProperty(
|
|
59
|
+
for (const o in i)
|
|
60
|
+
s(i[o], c[o]) || t.setLayoutProperty(e, o, i[o]);
|
|
61
|
+
for (const o in c)
|
|
62
|
+
i.hasOwnProperty(o) || t.setLayoutProperty(e, o, void 0);
|
|
63
63
|
}
|
|
64
64
|
if (r !== a.paint) {
|
|
65
65
|
const c = a.paint || {};
|
|
66
|
-
for (const
|
|
67
|
-
s(r[
|
|
68
|
-
for (const
|
|
69
|
-
r.hasOwnProperty(
|
|
66
|
+
for (const o in r)
|
|
67
|
+
s(r[o], c[o]) || t.setPaintProperty(e, o, r[o]);
|
|
68
|
+
for (const o in c)
|
|
69
|
+
r.hasOwnProperty(o) || t.setPaintProperty(e, o, void 0);
|
|
70
70
|
}
|
|
71
|
-
s(
|
|
71
|
+
s(l, a.filter) || t.setFilter(e, l), (y !== a.minzoom || f !== a.maxzoom) && t.setLayerZoomRange(e, y, f);
|
|
72
72
|
}
|
|
73
73
|
function F(t, e, n) {
|
|
74
74
|
if (t.style && t.style._loaded && (!("source" in n) || t.getSource(n.source))) {
|
|
@@ -77,26 +77,26 @@ function F(t, e, n) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
let R = 0;
|
|
80
|
-
function
|
|
81
|
-
const e = S(
|
|
82
|
-
if (
|
|
80
|
+
function L(t) {
|
|
81
|
+
const e = S(x).map.getMap(), n = k(t), [, a] = C(0), i = m(() => t.id || `jsx-layer-${R++}`, []);
|
|
82
|
+
if (w(() => {
|
|
83
83
|
if (e) {
|
|
84
|
-
const
|
|
85
|
-
return e.on("styledata",
|
|
86
|
-
e.off("styledata",
|
|
84
|
+
const l = () => a((y) => y + 1);
|
|
85
|
+
return e.on("styledata", l), l(), () => {
|
|
86
|
+
e.off("styledata", l), e.style && e.style._loaded && e.getLayer(i) && e.removeLayer(i);
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
}, [e]), e && e.style && e.getLayer(i))
|
|
90
90
|
try {
|
|
91
91
|
E(e, i, t, n.current);
|
|
92
|
-
} catch (
|
|
93
|
-
console.warn(
|
|
92
|
+
} catch (l) {
|
|
93
|
+
console.warn(l);
|
|
94
94
|
}
|
|
95
95
|
else
|
|
96
96
|
F(e, i, t);
|
|
97
97
|
return n.current = t, null;
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function h(t, e, n) {
|
|
100
100
|
switch (t) {
|
|
101
101
|
case "fill":
|
|
102
102
|
return {
|
|
@@ -106,7 +106,7 @@ function L(t, e) {
|
|
|
106
106
|
case "line":
|
|
107
107
|
return {
|
|
108
108
|
"line-color": e,
|
|
109
|
-
"line-width": 2
|
|
109
|
+
"line-width": n === "LineString" ? 6 : 2
|
|
110
110
|
};
|
|
111
111
|
default:
|
|
112
112
|
return {};
|
|
@@ -115,20 +115,22 @@ function L(t, e) {
|
|
|
115
115
|
function O({ sources: t }) {
|
|
116
116
|
const e = m(() => !Array.isArray(t) || t.length === 0 ? [] : t.map((n) => ({
|
|
117
117
|
...n,
|
|
118
|
-
geoJson: n.geometry ?
|
|
118
|
+
geoJson: n.geometry ? I(n.geometry, n.type) : null
|
|
119
119
|
})), [t]);
|
|
120
120
|
return (e == null ? void 0 : e.length) === 0 ? null : /* @__PURE__ */ u(b, { children: e == null ? void 0 : e.map((n) => /* @__PURE__ */ u("div", { children: n.geoJson && /* @__PURE__ */ u(A, { id: n.key, type: "geojson", data: n.geoJson, children: n.layer && (Array.isArray(n.layer) ? n.layer.map((a, i) => /* @__PURE__ */ u(
|
|
121
|
-
|
|
121
|
+
L,
|
|
122
122
|
{
|
|
123
|
+
id: `${n.key}-${i}`,
|
|
123
124
|
type: a.type,
|
|
124
|
-
paint:
|
|
125
|
+
paint: h(a.type, a.color, n.type)
|
|
125
126
|
},
|
|
126
127
|
`${n.key}-${i}`
|
|
127
128
|
)) : /* @__PURE__ */ u(
|
|
128
|
-
|
|
129
|
+
L,
|
|
129
130
|
{
|
|
131
|
+
id: n.key,
|
|
130
132
|
type: n.layer.type,
|
|
131
|
-
paint:
|
|
133
|
+
paint: h(n.layer.type, n.layer.color, n.type)
|
|
132
134
|
}
|
|
133
135
|
)) }, n.key) }, n.key)) });
|
|
134
136
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsxs as i, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { a as e } from "./logo-control-NE-LlsRy.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { c as n, b as o, S as r, o as s, i as l } from "./styles-Do-o-qNU.js";
|
|
5
|
+
function p({ marker: t }) {
|
|
6
|
+
return /* @__PURE__ */ i(
|
|
7
|
+
e,
|
|
8
|
+
{
|
|
9
|
+
anchor: "bottom",
|
|
10
|
+
longitude: t.longitude,
|
|
11
|
+
latitude: t.latitude,
|
|
12
|
+
className: n.trim(),
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ a("span", { className: o, children: /* @__PURE__ */ a(r, {}) }),
|
|
15
|
+
/* @__PURE__ */ a(s, { className: l })
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
`center-pin-marker-${t.longitude}-${t.latitude}`
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
p as default
|
|
23
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as P, Fragment as u } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useContext as M, useEffect as y } from "react";
|
|
3
|
+
import { G as L } from "./index.modern-CLRs8JwI.js";
|
|
4
|
+
import { a as g } from "./utils-DJ13veBM.js";
|
|
5
|
+
function f(a, e, l) {
|
|
6
|
+
switch (a) {
|
|
7
|
+
case "fill":
|
|
8
|
+
return {
|
|
9
|
+
fillColor: e,
|
|
10
|
+
fillOpacity: 0.25
|
|
11
|
+
};
|
|
12
|
+
case "line":
|
|
13
|
+
return {
|
|
14
|
+
strokeColor: e,
|
|
15
|
+
strokeWeight: l === "LineString" ? 6 : 2
|
|
16
|
+
};
|
|
17
|
+
default:
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function E({ sources: a }) {
|
|
22
|
+
const [e, l] = p(null), [m, c] = p(
|
|
23
|
+
[]
|
|
24
|
+
), i = M(L);
|
|
25
|
+
return y(() => {
|
|
26
|
+
i && l(i.map);
|
|
27
|
+
}, [i]), y(() => {
|
|
28
|
+
if (m.forEach((t) => {
|
|
29
|
+
t == null || t.setMap(null);
|
|
30
|
+
}), !e || typeof a > "u" || a.length === 0)
|
|
31
|
+
return;
|
|
32
|
+
const s = a.map((t) => {
|
|
33
|
+
const n = {
|
|
34
|
+
type: t.type || "MultiPolygon",
|
|
35
|
+
clickable: !1
|
|
36
|
+
};
|
|
37
|
+
if (Array.isArray(t.layer))
|
|
38
|
+
t.layer.forEach((r) => {
|
|
39
|
+
const h = f(r.type, r.color, t.type);
|
|
40
|
+
Object.assign(n, h);
|
|
41
|
+
});
|
|
42
|
+
else {
|
|
43
|
+
const r = f(t.layer.type, t.layer.color, t.type);
|
|
44
|
+
Object.assign(n, r);
|
|
45
|
+
}
|
|
46
|
+
let o;
|
|
47
|
+
return t.type === "LineString" ? o = new google.maps.Polyline({
|
|
48
|
+
// Set default options otherwise the polyline remains visible (even if eg: we only want the outline)
|
|
49
|
+
// We then overrider the default options with the layer options
|
|
50
|
+
strokeWeight: 6,
|
|
51
|
+
path: g(t.geometry),
|
|
52
|
+
...n
|
|
53
|
+
}) : o = new google.maps.Polygon({
|
|
54
|
+
// Set default options otherwise the polygon remains visible (even if eg: we only want the outline)
|
|
55
|
+
// We then overrider the default options with the layer options
|
|
56
|
+
strokeWeight: 0,
|
|
57
|
+
fillOpacity: 0,
|
|
58
|
+
paths: g(t.geometry),
|
|
59
|
+
...n
|
|
60
|
+
}), o.setMap(e), o;
|
|
61
|
+
});
|
|
62
|
+
return c(s), s.forEach((t) => {
|
|
63
|
+
t.setMap(e);
|
|
64
|
+
}), () => {
|
|
65
|
+
s.forEach((t) => {
|
|
66
|
+
t == null || t.setMap(null);
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
}, [e, a]), /* @__PURE__ */ P(u, {});
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
E as default
|
|
73
|
+
};
|
package/dist/index.es.js
CHANGED