@performant-software/geospatial 2.3.12-beta.2 → 2.3.12-beta.4
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.cjs14.js +1 -1
- package/dist/index.cjs15.js +1 -1
- package/dist/index.cjs16.js +1 -1
- package/dist/index.cjs17.js +1 -1
- package/dist/index.cjs183.js +1 -1
- package/dist/index.cjs183.js.map +1 -1
- package/dist/index.cjs184.js +1 -1
- package/dist/index.cjs184.js.map +1 -1
- package/dist/index.cjs185.js +1 -4
- package/dist/index.cjs185.js.map +1 -1
- package/dist/index.cjs186.js +1 -1
- package/dist/index.cjs186.js.map +1 -1
- package/dist/index.cjs187.js +1 -1
- package/dist/index.cjs187.js.map +1 -1
- package/dist/index.cjs188.js +1 -1
- package/dist/index.cjs188.js.map +1 -1
- package/dist/index.cjs189.js +1 -1
- package/dist/index.cjs189.js.map +1 -1
- package/dist/index.cjs19.js +1 -1
- package/dist/index.cjs190.js +1 -1
- package/dist/index.cjs190.js.map +1 -1
- package/dist/index.cjs191.js +1 -1
- package/dist/index.cjs191.js.map +1 -1
- package/dist/index.cjs192.js +4 -1
- package/dist/index.cjs192.js.map +1 -1
- package/dist/index.cjs193.js +1 -1
- package/dist/index.cjs193.js.map +1 -1
- package/dist/index.cjs194.js +1 -1
- package/dist/index.cjs194.js.map +1 -1
- package/dist/index.cjs195.js +1 -1
- package/dist/index.cjs195.js.map +1 -1
- package/dist/index.cjs196.js +1 -1
- package/dist/index.cjs196.js.map +1 -1
- package/dist/index.cjs197.js +1 -1
- package/dist/index.cjs197.js.map +1 -1
- package/dist/index.cjs198.js +1 -1
- package/dist/index.cjs198.js.map +1 -1
- package/dist/index.cjs199.js +1 -1
- package/dist/index.cjs199.js.map +1 -1
- package/dist/index.cjs200.js +1 -1
- package/dist/index.cjs200.js.map +1 -1
- package/dist/index.cjs201.js +1 -1
- package/dist/index.cjs201.js.map +1 -1
- package/dist/index.cjs202.js +1 -1
- package/dist/index.cjs202.js.map +1 -1
- package/dist/index.cjs203.js +1 -1
- package/dist/index.cjs203.js.map +1 -1
- package/dist/index.cjs204.js +1 -1
- package/dist/index.cjs204.js.map +1 -1
- package/dist/index.cjs208.js +1 -1
- package/dist/index.cjs209.js +1 -1
- package/dist/index.cjs21.js +1 -1
- package/dist/index.cjs210.js +1 -1
- package/dist/index.cjs22.js +1 -1
- package/dist/index.cjs228.js +1 -1
- package/dist/index.cjs233.js +1 -1
- package/dist/index.cjs233.js.map +1 -1
- package/dist/index.cjs234.js +1 -1
- package/dist/index.cjs234.js.map +1 -1
- package/dist/index.cjs235.js +1 -1
- package/dist/index.cjs235.js.map +1 -1
- package/dist/index.cjs236.js +1 -1
- package/dist/index.cjs236.js.map +1 -1
- package/dist/index.cjs237.js +1 -1
- package/dist/index.cjs237.js.map +1 -1
- package/dist/index.cjs239.js +1 -1
- package/dist/index.cjs242.js +1 -1
- package/dist/index.cjs248.js +1 -1
- package/dist/index.cjs254.js +1 -1
- package/dist/index.cjs259.js +1 -1
- package/dist/index.cjs26.js +1 -1
- package/dist/index.cjs52.js +1 -1
- package/dist/index.cjs56.js +1 -1
- package/dist/index.cjs58.js +1 -1
- package/dist/index.cjs62.js +9 -1
- package/dist/index.cjs62.js.map +1 -1
- package/dist/index.cjs63.js +13 -3
- package/dist/index.cjs63.js.map +1 -1
- package/dist/index.cjs64.js +1 -19
- package/dist/index.cjs64.js.map +1 -1
- package/dist/index.cjs65.js +1 -1
- package/dist/index.cjs65.js.map +1 -1
- package/dist/index.cjs66.js +1 -1
- package/dist/index.cjs66.js.map +1 -1
- package/dist/index.cjs67.js +1 -1
- package/dist/index.cjs67.js.map +1 -1
- package/dist/index.cjs68.js +1 -1
- package/dist/index.cjs68.js.map +1 -1
- package/dist/index.cjs69.js +1 -1
- package/dist/index.cjs69.js.map +1 -1
- package/dist/index.cjs70.js +1 -1
- package/dist/index.cjs70.js.map +1 -1
- package/dist/index.cjs71.js +1 -1
- package/dist/index.cjs71.js.map +1 -1
- package/dist/index.cjs72.js +1 -1
- package/dist/index.cjs72.js.map +1 -1
- package/dist/index.cjs73.js +1 -1
- package/dist/index.cjs73.js.map +1 -1
- package/dist/index.cjs74.js +1 -1
- package/dist/index.cjs74.js.map +1 -1
- package/dist/index.cjs75.js +1 -1
- package/dist/index.cjs75.js.map +1 -1
- package/dist/index.cjs76.js +1 -1
- package/dist/index.cjs76.js.map +1 -1
- package/dist/index.cjs77.js +1 -1
- package/dist/index.cjs77.js.map +1 -1
- package/dist/index.cjs78.js +1 -1
- package/dist/index.cjs78.js.map +1 -1
- package/dist/index.cjs79.js +1 -1
- package/dist/index.cjs79.js.map +1 -1
- package/dist/index.cjs80.js +1 -1
- package/dist/index.cjs80.js.map +1 -1
- package/dist/index.es14.js +1 -1
- package/dist/index.es15.js +8 -8
- package/dist/index.es16.js +1 -1
- package/dist/index.es17.js +3 -3
- package/dist/index.es183.js +320 -7
- package/dist/index.es183.js.map +1 -1
- package/dist/index.es184.js +71 -144
- package/dist/index.es184.js.map +1 -1
- package/dist/index.es185.js +3 -12197
- package/dist/index.es185.js.map +1 -1
- package/dist/index.es186.js +18 -3
- package/dist/index.es186.js.map +1 -1
- package/dist/index.es187.js +13 -3
- package/dist/index.es187.js.map +1 -1
- package/dist/index.es188.js +28 -33
- package/dist/index.es188.js.map +1 -1
- package/dist/index.es189.js +7 -3
- package/dist/index.es189.js.map +1 -1
- package/dist/index.es19.js +1 -1
- package/dist/index.es190.js +7 -22
- package/dist/index.es190.js.map +1 -1
- package/dist/index.es191.js +150 -2
- package/dist/index.es191.js.map +1 -1
- package/dist/index.es192.js +12199 -3
- package/dist/index.es192.js.map +1 -1
- package/dist/index.es193.js +1 -0
- package/dist/index.es193.js.map +1 -1
- package/dist/index.es194.js +3 -34
- package/dist/index.es194.js.map +1 -1
- package/dist/index.es195.js +36 -13
- package/dist/index.es195.js.map +1 -1
- package/dist/index.es196.js +3 -16
- package/dist/index.es196.js.map +1 -1
- package/dist/index.es197.js +22 -8
- package/dist/index.es197.js.map +1 -1
- package/dist/index.es198.js +2 -323
- package/dist/index.es198.js.map +1 -1
- package/dist/index.es199.js +3 -77
- package/dist/index.es199.js.map +1 -1
- package/dist/index.es200.js +2 -5
- package/dist/index.es200.js.map +1 -1
- package/dist/index.es201.js +31 -15
- package/dist/index.es201.js.map +1 -1
- package/dist/index.es202.js +13 -11
- package/dist/index.es202.js.map +1 -1
- package/dist/index.es203.js +13 -30
- package/dist/index.es203.js.map +1 -1
- package/dist/index.es204.js +8 -4
- package/dist/index.es204.js.map +1 -1
- package/dist/index.es208.js +1 -1
- package/dist/index.es209.js +1 -1
- package/dist/index.es21.js +2 -2
- package/dist/index.es210.js +1 -1
- package/dist/index.es22.js +2 -2
- package/dist/index.es228.js +1 -1
- package/dist/index.es233.js +46 -3
- package/dist/index.es233.js.map +1 -1
- package/dist/index.es234.js +22 -5
- package/dist/index.es234.js.map +1 -1
- package/dist/index.es235.js +3 -8
- package/dist/index.es235.js.map +1 -1
- package/dist/index.es236.js +4 -44
- package/dist/index.es236.js.map +1 -1
- package/dist/index.es237.js +7 -22
- package/dist/index.es237.js.map +1 -1
- package/dist/index.es239.js +1 -1
- package/dist/index.es242.js +1 -1
- package/dist/index.es248.js +2 -2
- package/dist/index.es254.js +1 -1
- package/dist/index.es259.js +2 -2
- package/dist/index.es26.js +1 -1
- package/dist/index.es52.js +4 -4
- package/dist/index.es56.js +1 -1
- package/dist/index.es58.js +11 -11
- package/dist/index.es60.js +2 -2
- package/dist/index.es62.js +30 -2
- package/dist/index.es62.js.map +1 -1
- package/dist/index.es63.js +593 -21
- package/dist/index.es63.js.map +1 -1
- package/dist/index.es64.js +106 -601
- package/dist/index.es64.js.map +1 -1
- package/dist/index.es65.js +10 -107
- package/dist/index.es65.js.map +1 -1
- package/dist/index.es66.js +2 -10
- package/dist/index.es66.js.map +1 -1
- package/dist/index.es67.js +54 -27
- package/dist/index.es67.js.map +1 -1
- package/dist/index.es68.js +47 -56
- package/dist/index.es68.js.map +1 -1
- package/dist/index.es69.js +37 -46
- package/dist/index.es69.js.map +1 -1
- package/dist/index.es70.js +11 -38
- package/dist/index.es70.js.map +1 -1
- package/dist/index.es71.js +13 -10
- package/dist/index.es71.js.map +1 -1
- package/dist/index.es72.js +29 -14
- package/dist/index.es72.js.map +1 -1
- package/dist/index.es73.js +14 -29
- package/dist/index.es73.js.map +1 -1
- package/dist/index.es74.js +12 -13
- package/dist/index.es74.js.map +1 -1
- package/dist/index.es75.js +12 -13
- package/dist/index.es75.js.map +1 -1
- package/dist/index.es76.js +2 -51
- package/dist/index.es76.js.map +1 -1
- package/dist/index.es77.js +2 -65
- package/dist/index.es77.js.map +1 -1
- package/dist/index.es78.js +27 -10
- package/dist/index.es78.js.map +1 -1
- package/dist/index.es79.js +51 -2
- package/dist/index.es79.js.map +1 -1
- package/dist/index.es80.js +65 -2
- package/dist/index.es80.js.map +1 -1
- package/package.json +1 -1
- package/build/index.js +0 -2
- package/build/index.js.map +0 -1
- package/build/main.css +0 -127
- package/types/components/LocationMarker.js.flow +0 -82
package/dist/index.es76.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es76.js","sources":[
|
|
1
|
+
{"version":3,"file":"index.es76.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/index.es77.js
CHANGED
|
@@ -1,68 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { useContext as f, useRef as y, useState as m, useMemo as g, useEffect as S, cloneElement as h } from "react";
|
|
3
|
-
import { MapContext as C } from "./index.es68.js";
|
|
4
|
-
import s from "./index.es204.js";
|
|
5
|
-
import { deepEqual as v } from "./index.es203.js";
|
|
6
|
-
let x = 0;
|
|
7
|
-
function U(t, e, a) {
|
|
8
|
-
if (t.style && t.style._loaded) {
|
|
9
|
-
const n = { ...a };
|
|
10
|
-
return delete n.id, delete n.children, t.addSource(e, n), t.getSource(e);
|
|
11
|
-
}
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
function b(t, e, a) {
|
|
15
|
-
s(e.id === a.id, "source id changed"), s(e.type === a.type, "source type changed");
|
|
16
|
-
let n = "", r = 0;
|
|
17
|
-
for (const o in e)
|
|
18
|
-
o !== "children" && o !== "id" && !v(a[o], e[o]) && (n = o, r++);
|
|
19
|
-
if (!r)
|
|
20
|
-
return;
|
|
21
|
-
const l = e.type;
|
|
22
|
-
if (l === "geojson")
|
|
23
|
-
t.setData(e.data);
|
|
24
|
-
else if (l === "image")
|
|
25
|
-
t.updateImage({
|
|
26
|
-
url: e.url,
|
|
27
|
-
coordinates: e.coordinates
|
|
28
|
-
});
|
|
29
|
-
else if ("setCoordinates" in t && r === 1 && n === "coordinates")
|
|
30
|
-
t.setCoordinates(e.coordinates);
|
|
31
|
-
else if ("setUrl" in t)
|
|
32
|
-
switch (n) {
|
|
33
|
-
case "url":
|
|
34
|
-
t.setUrl(e.url);
|
|
35
|
-
break;
|
|
36
|
-
case "tiles":
|
|
37
|
-
t.setTiles(e.tiles);
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
else
|
|
41
|
-
console.warn(`Unable to update <Source> prop: ${n}`);
|
|
42
|
-
}
|
|
43
|
-
function R(t) {
|
|
44
|
-
const e = f(C).map.getMap(), a = y(t), [, n] = m(0), r = g(() => t.id || `jsx-source-${x++}`, []);
|
|
45
|
-
S(() => {
|
|
46
|
-
if (e) {
|
|
47
|
-
const o = () => setTimeout(() => n((i) => i + 1), 0);
|
|
48
|
-
return e.on("styledata", o), o(), () => {
|
|
49
|
-
var i;
|
|
50
|
-
if (e.off("styledata", o), e.style && e.style._loaded && e.getSource(r)) {
|
|
51
|
-
const c = (i = e.getStyle()) === null || i === void 0 ? void 0 : i.layers;
|
|
52
|
-
if (c)
|
|
53
|
-
for (const d of c)
|
|
54
|
-
d.source === r && e.removeLayer(d.id);
|
|
55
|
-
e.removeSource(r);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}, [e]);
|
|
60
|
-
let l = e && e.style && e.getSource(r);
|
|
61
|
-
return l ? b(l, t, a.current) : l = U(e, r, t), a.current = t, l && u.Children.map(t.children, (o) => o && h(o, {
|
|
62
|
-
source: r
|
|
63
|
-
})) || null;
|
|
64
|
-
}
|
|
1
|
+
var e = {};
|
|
65
2
|
export {
|
|
66
|
-
|
|
3
|
+
e as __exports
|
|
67
4
|
};
|
|
68
5
|
//# sourceMappingURL=index.es77.js.map
|
package/dist/index.es77.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es77.js","sources":[
|
|
1
|
+
{"version":3,"file":"index.es77.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/index.es78.js
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { __exports as a } from "./index.es205.js";
|
|
2
|
+
function i(r, s) {
|
|
3
|
+
for (var o = 0; o < s.length; o++) {
|
|
4
|
+
const e = s[o];
|
|
5
|
+
if (typeof e != "string" && !Array.isArray(e)) {
|
|
6
|
+
for (const t in e)
|
|
7
|
+
if (t !== "default" && !(t in r)) {
|
|
8
|
+
const n = Object.getOwnPropertyDescriptor(e, t);
|
|
9
|
+
n && Object.defineProperty(r, t, n.get ? n : {
|
|
10
|
+
enumerable: !0,
|
|
11
|
+
get: () => e[t]
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return Object.freeze(Object.defineProperty(r, Symbol.toStringTag, { value: "Module" }));
|
|
9
17
|
}
|
|
18
|
+
var f = a.printMsg = function() {
|
|
19
|
+
console.log("This is a message from the demo package");
|
|
20
|
+
};
|
|
21
|
+
const p = /* @__PURE__ */ i({
|
|
22
|
+
__proto__: null,
|
|
23
|
+
default: a,
|
|
24
|
+
printMsg: f
|
|
25
|
+
}, [a]);
|
|
10
26
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
27
|
+
a as default,
|
|
28
|
+
p as i,
|
|
29
|
+
f as printMsg
|
|
13
30
|
};
|
|
14
31
|
//# sourceMappingURL=index.es78.js.map
|
package/dist/index.es78.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es78.js","sources":["../../../node_modules/
|
|
1
|
+
{"version":3,"file":"index.es78.js","sources":["../../../node_modules/mapbox-gl/index.js"],"sourcesContent":["exports.printMsg = function() {\r\n console.log(\"This is a message from the demo package\");\r\n }"],"names":["printMsg","mapboxGl"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,IAAAC,EAAA,WAAmB,WAAW;AAC1B,UAAQ,IAAI,yCAAyC;AACvD;;;;;;","x_google_ignoreList":[0]}
|
package/dist/index.es79.js
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
import { useContext as m, useRef as L, useState as g, useMemo as x, useEffect as h } from "react";
|
|
2
|
+
import { MapContext as b } from "./index.es67.js";
|
|
3
|
+
import d from "./index.es189.js";
|
|
4
|
+
import { deepEqual as l } from "./index.es188.js";
|
|
5
|
+
function k(t, e, a, o) {
|
|
6
|
+
if (d(a.id === o.id, "layer id changed"), d(a.type === o.type, "layer type changed"), a.type === "custom" || o.type === "custom")
|
|
7
|
+
return;
|
|
8
|
+
const { layout: r = {}, paint: i = {}, filter: y, minzoom: c, maxzoom: u, beforeId: s } = a;
|
|
9
|
+
if (s !== o.beforeId && t.moveLayer(e, s), r !== o.layout) {
|
|
10
|
+
const f = o.layout || {};
|
|
11
|
+
for (const n in r)
|
|
12
|
+
l(r[n], f[n]) || t.setLayoutProperty(e, n, r[n]);
|
|
13
|
+
for (const n in f)
|
|
14
|
+
r.hasOwnProperty(n) || t.setLayoutProperty(e, n, void 0);
|
|
15
|
+
}
|
|
16
|
+
if (i !== o.paint) {
|
|
17
|
+
const f = o.paint || {};
|
|
18
|
+
for (const n in i)
|
|
19
|
+
l(i[n], f[n]) || t.setPaintProperty(e, n, i[n]);
|
|
20
|
+
for (const n in f)
|
|
21
|
+
i.hasOwnProperty(n) || t.setPaintProperty(e, n, void 0);
|
|
22
|
+
}
|
|
23
|
+
l(y, o.filter) || t.setFilter(e, y), (c !== o.minzoom || u !== o.maxzoom) && t.setLayerZoomRange(e, c, u);
|
|
24
|
+
}
|
|
25
|
+
function z(t, e, a) {
|
|
26
|
+
if (t.style && t.style._loaded && (!("source" in a) || t.getSource(a.source))) {
|
|
27
|
+
const o = { ...a, id: e };
|
|
28
|
+
delete o.beforeId, t.addLayer(o, a.beforeId);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
let I = 0;
|
|
32
|
+
function S(t) {
|
|
33
|
+
const e = m(b).map.getMap(), a = L(t), [, o] = g(0), r = x(() => t.id || `jsx-layer-${I++}`, []);
|
|
34
|
+
if (h(() => {
|
|
35
|
+
if (e) {
|
|
36
|
+
const y = () => o((c) => c + 1);
|
|
37
|
+
return e.on("styledata", y), y(), () => {
|
|
38
|
+
e.off("styledata", y), e.style && e.style._loaded && e.getLayer(r) && e.removeLayer(r);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}, [e]), e && e.style && e.getLayer(r))
|
|
42
|
+
try {
|
|
43
|
+
k(e, r, t, a.current);
|
|
44
|
+
} catch (y) {
|
|
45
|
+
console.warn(y);
|
|
46
|
+
}
|
|
47
|
+
else
|
|
48
|
+
z(e, r, t);
|
|
49
|
+
return a.current = t, null;
|
|
50
|
+
}
|
|
2
51
|
export {
|
|
3
|
-
|
|
52
|
+
S as default
|
|
4
53
|
};
|
|
5
54
|
//# sourceMappingURL=index.es79.js.map
|
package/dist/index.es79.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es79.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"index.es79.js","sources":["../../../node_modules/react-map-gl/dist/esm/components/layer.js"],"sourcesContent":["import { useContext, useEffect, useMemo, useState, useRef } from 'react';\nimport { MapContext } from './map';\nimport assert from '../utils/assert';\nimport { deepEqual } from '../utils/deep-equal';\n/* eslint-disable complexity, max-statements */\nfunction updateLayer(map, id, props, prevProps) {\n assert(props.id === prevProps.id, 'layer id changed');\n assert(props.type === prevProps.type, 'layer type changed');\n if (props.type === 'custom' || prevProps.type === 'custom') {\n return;\n }\n const { layout = {}, paint = {}, filter, minzoom, maxzoom, beforeId } = props;\n if (beforeId !== prevProps.beforeId) {\n map.moveLayer(id, beforeId);\n }\n if (layout !== prevProps.layout) {\n const prevLayout = prevProps.layout || {};\n for (const key in layout) {\n if (!deepEqual(layout[key], prevLayout[key])) {\n map.setLayoutProperty(id, key, layout[key]);\n }\n }\n for (const key in prevLayout) {\n if (!layout.hasOwnProperty(key)) {\n map.setLayoutProperty(id, key, undefined);\n }\n }\n }\n if (paint !== prevProps.paint) {\n const prevPaint = prevProps.paint || {};\n for (const key in paint) {\n if (!deepEqual(paint[key], prevPaint[key])) {\n map.setPaintProperty(id, key, paint[key]);\n }\n }\n for (const key in prevPaint) {\n if (!paint.hasOwnProperty(key)) {\n map.setPaintProperty(id, key, undefined);\n }\n }\n }\n if (!deepEqual(filter, prevProps.filter)) {\n map.setFilter(id, filter);\n }\n if (minzoom !== prevProps.minzoom || maxzoom !== prevProps.maxzoom) {\n map.setLayerZoomRange(id, minzoom, maxzoom);\n }\n}\nfunction createLayer(map, id, props) {\n // @ts-ignore\n if (map.style && map.style._loaded && (!('source' in props) || map.getSource(props.source))) {\n const options = { ...props, id };\n delete options.beforeId;\n // @ts-ignore\n map.addLayer(options, props.beforeId);\n }\n}\n/* eslint-enable complexity, max-statements */\nlet layerCounter = 0;\nfunction Layer(props) {\n const map = useContext(MapContext).map.getMap();\n const propsRef = useRef(props);\n const [, setStyleLoaded] = useState(0);\n const id = useMemo(() => props.id || `jsx-layer-${layerCounter++}`, []);\n useEffect(() => {\n if (map) {\n const forceUpdate = () => setStyleLoaded(version => version + 1);\n map.on('styledata', forceUpdate);\n forceUpdate();\n return () => {\n map.off('styledata', forceUpdate);\n // @ts-ignore\n if (map.style && map.style._loaded && map.getLayer(id)) {\n map.removeLayer(id);\n }\n };\n }\n return undefined;\n }, [map]);\n // @ts-ignore\n const layer = map && map.style && map.getLayer(id);\n if (layer) {\n try {\n updateLayer(map, id, props, propsRef.current);\n }\n catch (error) {\n console.warn(error); // eslint-disable-line\n }\n }\n else {\n createLayer(map, id, props);\n }\n // Store last rendered props\n propsRef.current = props;\n return null;\n}\nexport default Layer;\n//# sourceMappingURL=layer.js.map"],"names":["updateLayer","map","id","props","prevProps","assert","layout","paint","filter","minzoom","maxzoom","beforeId","prevLayout","key","deepEqual","prevPaint","createLayer","options","layerCounter","Layer","useContext","MapContext","propsRef","useRef","setStyleLoaded","useState","useMemo","useEffect","forceUpdate","version","error"],"mappings":";;;;AAKA,SAASA,EAAYC,GAAKC,GAAIC,GAAOC,GAAW;AAG5C,MAFAC,EAAOF,EAAM,OAAOC,EAAU,IAAI,kBAAkB,GACpDC,EAAOF,EAAM,SAASC,EAAU,MAAM,oBAAoB,GACtDD,EAAM,SAAS,YAAYC,EAAU,SAAS;AAC9C;AAEE,QAAA,EAAE,QAAAE,IAAS,IAAI,OAAAC,IAAQ,CAAC,GAAG,QAAAC,GAAQ,SAAAC,GAAS,SAAAC,GAAS,UAAAC,EAAa,IAAAR;AAIpE,MAHAQ,MAAaP,EAAU,YACnBH,EAAA,UAAUC,GAAIS,CAAQ,GAE1BL,MAAWF,EAAU,QAAQ;AACvB,UAAAQ,IAAaR,EAAU,UAAU;AACvC,eAAWS,KAAOP;AACV,MAACQ,EAAUR,EAAOO,CAAG,GAAGD,EAAWC,CAAG,CAAC,KACvCZ,EAAI,kBAAkBC,GAAIW,GAAKP,EAAOO,CAAG,CAAC;AAGlD,eAAWA,KAAOD;AACd,MAAKN,EAAO,eAAeO,CAAG,KACtBZ,EAAA,kBAAkBC,GA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AAI,SAASA,EAAI,MAAM,WAAWA,EAAI,SAASC,CAAE,KACjDD,EAAI,YAAYC,CAAE;AAAA,MACtB;AAAA,IAER;AAAA,EACO,GACR,CAACD,CAAG,CAAC,GAEMA,KAAOA,EAAI,SAASA,EAAI,SAASC,CAAE;AAEzC,QAAA;AACA,MAAAF,EAAYC,GAAKC,GAAIC,GAAOmB,EAAS,OAAO;AAAA,aAEzCQ,GAAO;AACV,cAAQ,KAAKA,CAAK;AAAA,IACtB;AAAA;AAGY,IAAAd,EAAAf,GAAKC,GAAIC,CAAK;AAG9B,SAAAmB,EAAS,UAAUnB,GACZ;AACX;","x_google_ignoreList":[0]}
|
package/dist/index.es80.js
CHANGED
|
@@ -1,5 +1,68 @@
|
|
|
1
|
-
|
|
1
|
+
import * as u from "react";
|
|
2
|
+
import { useContext as f, useRef as y, useState as m, useMemo as g, useEffect as S, cloneElement as h } from "react";
|
|
3
|
+
import { MapContext as C } from "./index.es67.js";
|
|
4
|
+
import s from "./index.es189.js";
|
|
5
|
+
import { deepEqual as v } from "./index.es188.js";
|
|
6
|
+
let x = 0;
|
|
7
|
+
function U(t, e, a) {
|
|
8
|
+
if (t.style && t.style._loaded) {
|
|
9
|
+
const n = { ...a };
|
|
10
|
+
return delete n.id, delete n.children, t.addSource(e, n), t.getSource(e);
|
|
11
|
+
}
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
function b(t, e, a) {
|
|
15
|
+
s(e.id === a.id, "source id changed"), s(e.type === a.type, "source type changed");
|
|
16
|
+
let n = "", r = 0;
|
|
17
|
+
for (const o in e)
|
|
18
|
+
o !== "children" && o !== "id" && !v(a[o], e[o]) && (n = o, r++);
|
|
19
|
+
if (!r)
|
|
20
|
+
return;
|
|
21
|
+
const l = e.type;
|
|
22
|
+
if (l === "geojson")
|
|
23
|
+
t.setData(e.data);
|
|
24
|
+
else if (l === "image")
|
|
25
|
+
t.updateImage({
|
|
26
|
+
url: e.url,
|
|
27
|
+
coordinates: e.coordinates
|
|
28
|
+
});
|
|
29
|
+
else if ("setCoordinates" in t && r === 1 && n === "coordinates")
|
|
30
|
+
t.setCoordinates(e.coordinates);
|
|
31
|
+
else if ("setUrl" in t)
|
|
32
|
+
switch (n) {
|
|
33
|
+
case "url":
|
|
34
|
+
t.setUrl(e.url);
|
|
35
|
+
break;
|
|
36
|
+
case "tiles":
|
|
37
|
+
t.setTiles(e.tiles);
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
else
|
|
41
|
+
console.warn(`Unable to update <Source> prop: ${n}`);
|
|
42
|
+
}
|
|
43
|
+
function R(t) {
|
|
44
|
+
const e = f(C).map.getMap(), a = y(t), [, n] = m(0), r = g(() => t.id || `jsx-source-${x++}`, []);
|
|
45
|
+
S(() => {
|
|
46
|
+
if (e) {
|
|
47
|
+
const o = () => setTimeout(() => n((i) => i + 1), 0);
|
|
48
|
+
return e.on("styledata", o), o(), () => {
|
|
49
|
+
var i;
|
|
50
|
+
if (e.off("styledata", o), e.style && e.style._loaded && e.getSource(r)) {
|
|
51
|
+
const c = (i = e.getStyle()) === null || i === void 0 ? void 0 : i.layers;
|
|
52
|
+
if (c)
|
|
53
|
+
for (const d of c)
|
|
54
|
+
d.source === r && e.removeLayer(d.id);
|
|
55
|
+
e.removeSource(r);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}, [e]);
|
|
60
|
+
let l = e && e.style && e.getSource(r);
|
|
61
|
+
return l ? b(l, t, a.current) : l = U(e, r, t), a.current = t, l && u.Children.map(t.children, (o) => o && h(o, {
|
|
62
|
+
source: r
|
|
63
|
+
})) || null;
|
|
64
|
+
}
|
|
2
65
|
export {
|
|
3
|
-
|
|
66
|
+
R as default
|
|
4
67
|
};
|
|
5
68
|
//# sourceMappingURL=index.es80.js.map
|
package/dist/index.es80.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es80.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"index.es80.js","sources":["../../../node_modules/react-map-gl/dist/esm/components/source.js"],"sourcesContent":["import * as React from 'react';\nimport { useContext, useEffect, useMemo, useState, useRef } from 'react';\nimport { cloneElement } from 'react';\nimport { MapContext } from './map';\nimport assert from '../utils/assert';\nimport { deepEqual } from '../utils/deep-equal';\nlet sourceCounter = 0;\nfunction createSource(map, id, props) {\n // @ts-ignore\n if (map.style && map.style._loaded) {\n const options = { ...props };\n delete options.id;\n delete options.children;\n // @ts-ignore\n map.addSource(id, options);\n return map.getSource(id);\n }\n return null;\n}\n/* eslint-disable complexity */\nfunction updateSource(source, props, prevProps) {\n assert(props.id === prevProps.id, 'source id changed');\n assert(props.type === prevProps.type, 'source type changed');\n let changedKey = '';\n let changedKeyCount = 0;\n for (const key in props) {\n if (key !== 'children' && key !== 'id' && !deepEqual(prevProps[key], props[key])) {\n changedKey = key;\n changedKeyCount++;\n }\n }\n if (!changedKeyCount) {\n return;\n }\n const type = props.type;\n if (type === 'geojson') {\n source.setData(props.data);\n }\n else if (type === 'image') {\n source.updateImage({\n url: props.url,\n coordinates: props.coordinates\n });\n }\n else if ('setCoordinates' in source && changedKeyCount === 1 && changedKey === 'coordinates') {\n source.setCoordinates(props.coordinates);\n }\n else if ('setUrl' in source) {\n // Added in 1.12.0:\n // vectorTileSource.setTiles\n // vectorTileSource.setUrl\n switch (changedKey) {\n case 'url':\n source.setUrl(props.url);\n break;\n case 'tiles':\n source.setTiles(props.tiles);\n break;\n default:\n }\n }\n else {\n // eslint-disable-next-line\n console.warn(`Unable to update <Source> prop: ${changedKey}`);\n }\n}\n/* eslint-enable complexity */\nfunction Source(props) {\n const map = useContext(MapContext).map.getMap();\n const propsRef = useRef(props);\n const [, setStyleLoaded] = useState(0);\n const id = useMemo(() => props.id || `jsx-source-${sourceCounter++}`, []);\n useEffect(() => {\n if (map) {\n /* global setTimeout */\n const forceUpdate = () => setTimeout(() => setStyleLoaded(version => version + 1), 0);\n map.on('styledata', forceUpdate);\n forceUpdate();\n return () => {\n var _a;\n map.off('styledata', forceUpdate);\n // @ts-ignore\n if (map.style && map.style._loaded && map.getSource(id)) {\n // Parent effects are destroyed before child ones, see\n // https://github.com/facebook/react/issues/16728\n // Source can only be removed after all child layers are removed\n const allLayers = (_a = map.getStyle()) === null || _a === void 0 ? void 0 : _a.layers;\n if (allLayers) {\n for (const layer of allLayers) {\n // @ts-ignore (2339) source does not exist on all layer types\n if (layer.source === id) {\n map.removeLayer(layer.id);\n }\n }\n }\n map.removeSource(id);\n }\n };\n }\n return undefined;\n }, [map]);\n // @ts-ignore\n let source = map && map.style && map.getSource(id);\n if (source) {\n updateSource(source, props, propsRef.current);\n }\n else {\n source = createSource(map, id, props);\n }\n propsRef.current = props;\n return ((source &&\n React.Children.map(props.children, child => child &&\n cloneElement(child, {\n source: id\n }))) ||\n null);\n}\nexport default Source;\n//# sourceMappingURL=source.js.map"],"names":["sourceCounter","createSource","map","id","props","options","updateSource","source","prevProps","assert","changedKey","changedKeyCount","key","deepEqual","type","Source","useContext","MapContext","propsRef","useRef","setStyleLoaded","useState","useMemo","useEffect","forceUpdate","version","_a","allLayers","layer","React","child","cloneElement"],"mappings":";;;;;AAMA,IAAIA,IAAgB;AACpB,SAASC,EAAaC,GAAKC,GAAIC,GAAO;AAElC,MAAIF,EAAI,SAASA,EAAI,MAAM,SAAS;AAC1B,UAAAG,IAAU,EAAE,GAAGD;AACrB,kBAAOC,EAAQ,IACf,OAAOA,EAAQ,UAEXH,EAAA,UAAUC,GAAIE,CAAO,GAClBH,EAAI,UAAUC,CAAE;AAAA,EAC3B;AACO,SAAA;AACX;AAEA,SAASG,EAAaC,GAAQH,GAAOI,GAAW;AAC5C,EAAAC,EAAOL,EAAM,OAAOI,EAAU,IAAI,mBAAmB,GACrDC,EAAOL,EAAM,SAASI,EAAU,MAAM,qBAAqB;AAC3D,MAAIE,IAAa,IACbC,IAAkB;AACtB,aAAWC,KAAOR;AACd,IAAIQ,MAAQ,cAAcA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,EAAG;AAChF,cAAIC;AACA,uBAAWC,KAASD;AAEZ,cAAAC,EAAM,WAAWzB,KACbD,EAAA,YAAY0B,EAAM,EAAE;AAIpC,UAAA1B,EAAI,aAAaC,CAAE;AAAA,QACvB;AAAA,MAAA;AAAA,IAER;AAAA,EACO,GACR,CAACD,CAAG,CAAC;AAER,MAAIK,IAASL,KAAOA,EAAI,SAASA,EAAI,UAAUC,CAAE;AACjD,SAAII,IACaD,EAAAC,GAAQH,GAAOc,EAAS,OAAO,IAGnCX,IAAAN,EAAaC,GAAKC,GAAIC,CAAK,GAExCc,EAAS,UAAUd,GACVG,KACLsB,EAAM,SAAS,IAAIzB,EAAM,UAAU,CAAA0B,MAASA,KACxCC,EAAaD,GAAO;AAAA,IAChB,QAAQ3B;AAAA,EAAA,CACX,CAAC,KACN;AACR;","x_google_ignoreList":[0]}
|
package/package.json
CHANGED
package/build/index.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{DrawControl:()=>u,GeoJsonLayer:()=>v,LayerMenu:()=>I,MapControl:()=>A,MapDraw:()=>q,RasterLayer:()=>U});const r=require("@mapbox/mapbox-gl-draw");var n=e.n(r);const o=require("react");var a=e.n(o);const i=require("react-map-gl");var l=e.n(i);const u=(0,o.forwardRef)((function(e,t){var r=(0,i.useControl)((function(){return new(n())(e)}),(function(t){var r=t.map;r.on("draw.create",e.onCreate),r.on("draw.update",e.onUpdate),r.on("draw.delete",e.onDelete)}),(function(t){var r=t.map;r.off("draw.create",e.onCreate),r.off("draw.update",e.onUpdate),r.off("draw.delete",e.onDelete)}),{position:e.position});return(0,o.useImperativeHandle)(t,(function(){return r}),[r]),null})),c=require("underscore");var f=e.n(c);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var m="#CC3333",p="#990000",y={"fill-color":m,"fill-opacity":.2},d={"line-color":p,"line-opacity":.6},b={"circle-radius":["interpolate",["linear"],["number",["get","point_count"],1],0,4,10,14],"circle-stroke-width":1,"circle-color":m,"circle-stroke-color":p};const v=function(e){var t,r,n=(t=(0,o.useState)(e.data),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw o}}return a}}(t,r)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=n[0],u=n[1],c=(0,o.useCallback)((function(e,t){return f().defaults(e,t)}),[]),m=(0,o.useMemo)((function(){return c(e.fillStyle,y)}),[c,e.fillStyle]),p=(0,o.useMemo)((function(){return c(e.lineStyle,d)}),[c,e.lineStyle]),v=(0,o.useMemo)((function(){return c(e.pointStyle,b)}),[c,e.pointStyle]);return(0,o.useEffect)((function(){e.url&&fetch(e.url).then((function(e){return e.json()})).then((function(e){return u(e)}))}),[e.url]),a().createElement(i.Source,{data:l,type:"geojson"},a().createElement(i.Layer,{filter:["!=","$type","Point"],paint:m,type:"fill"}),a().createElement(i.Layer,{filter:["!=","$type","Point"],paint:p,type:"line"}),a().createElement(i.Layer,{filter:["==","$type","Point"],paint:v,type:"circle"}))},h=require("react-icons/bs"),g=require("react-icons/io5"),w=require("maplibre-gl");var S=e.n(w);const O=require("react-dom");function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function C(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var j=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._map=null,this._redraw=t}var t,r;return t=e,(r=[{key:"onAdd",value:function(e){return this._map=e,e.on("move",this._redraw),this._container=document.createElement("div"),this._container.className="maplibregl-ctrl-group maplibregl-ctrl",this._redraw(),this._container}},{key:"onRemove",value:function(){this._container.remove(),this._map.off("move",this._redraw),this._map=null}},{key:"getMap",value:function(){return this._map}},{key:"getElement",value:function(){return this._container}}])&&C(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();const A=function(e){var t,r,n=(t=(0,o.useState)(0),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw o}}return a}}(t,r)||function(e,t){if(e){if("string"==typeof e)return E(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1],a=(0,o.useCallback)((function(){return n((function(e){return e+1}))}),[]),l=(0,i.useControl)((function(){return new j(a)}),{position:e.position}),u=l.getMap(),c=o.Children.map(f().compact(o.Children.toArray(e.children)),(function(e){return(0,o.cloneElement)(e,{map:u})}));return(0,o.useEffect)((function(){e.mapRef&&(e.mapRef.current=u)}),[u,e.mapRef]),u&&(0,O.createPortal)(c,l.getElement())};function _(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw o}}return a}}(e,t)||P(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function P(e,t){if(e){if("string"==typeof e)return k(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?k(e,t):void 0}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var x=function(e){var t=_((0,o.useState)(0),2),r=t[0],n=t[1],i=_((0,o.useState)(),2),l=i[0],u=i[1],c=_((0,o.useState)(!1),2),s=c[0],m=c[1],p=(0,o.useRef)(),y=(0,o.useCallback)((function(t){return e.names&&e.names.length>t&&e.names[t]}),[e.names]),d=(0,o.useCallback)((function(e){return f().includes(l,e)}),[l]),b=(0,o.useMemo)((function(){return o.Children.toArray(e.children)}),[e.children]),v=(0,o.useMemo)((function(){return f().filter(b,(function(e,t){return d(t)}))}),[b,d]),w=(0,o.useCallback)((function(e){var t,r;t=d(e)?f().without(l,e):[].concat(function(e){if(Array.isArray(e))return k(e)}(r=l)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||P(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[e]),u(t)}),[d,l]);return(0,o.useEffect)((function(){u(f().times(b.length,(function(e){return e})))}),[]),(0,o.useEffect)((function(){var e=p.current;if(e&&e._canvas){var t=p.current._canvas.offsetHeight;n(void 0===t?0:t)}}),[p.current]),f().isEmpty(b)?null:a().createElement(a().Fragment,null,a().createElement(A,{mapRef:p,position:e.position},a().createElement("button",{className:"mapbox-gl-draw_ctrl-draw-btn layer-button",onClick:function(){return m((function(e){return!e}))},type:"button"},a().createElement(h.BsStack,{size:"1.25em"})),s&&a().createElement("div",{className:"layer-menu",style:{maxHeight:"calc(".concat(r,"px - ").concat(30,"px)")}},a().createElement("div",{className:"menu"},f().map(b,(function(e,t){return a().createElement("div",{"aria-selected":d(t),className:"option",role:"option",onClick:function(){return w(t)},onKeyDown:function(){return w(t)},tabIndex:t},a().createElement("div",{className:"checkmark-container"},d(t)&&a().createElement(g.IoCheckmarkOutline,{size:"1em"})),y(t))}))))),v)};x.defaultProps={position:"top-left"};const I=x,M=require("@turf/turf");function R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function z(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function D(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return L(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?L(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}n().constants.classes.CONTROL_BASE="maplibregl-ctrl",n().constants.classes.CONTROL_PREFIX="maplibregl-ctrl-",n().constants.classes.CONTROL_GROUP="maplibregl-ctrl-group";var T=function(e){var t=D((0,o.useState)(!1),2),r=t[0],n=t[1],i=(0,o.useRef)(),c=(0,o.useRef)(),s=(0,o.useCallback)((function(){e.onChange(i.current.getAll())}),[e.onChange]),m=(0,o.useMemo)((function(){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?R(Object(r),!0).forEach((function(t){z(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({height:500,width:"100%"},e.style||{})}),[e.style]);return(0,o.useEffect)((function(){if(r&&e.data){var t=(0,M.bbox)(e.data),n=(0,M.bboxPolygon)(t),o=(0,M.buffer)(n,e.buffer,{units:"miles"}),a=(0,M.bbox)(o);if(f().every(a,f().isFinite)){var l=D(a,4),u=[[l[0],l[1]],[l[2],l[3]]];c.current.fitBounds(u,{duration:e.zoomDuration})}"GeometryCollection"===e.data.type?f().each(e.data.geometries,(function(e){i.current.add((0,M.feature)(e))})):i.current.add(e.data)}}),[r,e.data]),a().createElement(l(),{attributionControl:!1,onLoad:function(){return n(!0)},mapLib:S(),ref:c,style:m,mapStyle:e.mapStyle},a().createElement(u,{ref:i,controls:{line_string:!0,point:!0,polygon:!0,trash:!0},displayControlsDefault:!1,onCreate:s,onUpdate:s,onDelete:s,position:"bottom-left"}),e.children)};T.defaultProps={buffer:2,zoomDuration:1e3};const q=T;var N=function(e){return a().createElement(i.Source,{tileSize:e.tileSize,tiles:[e.url],type:"raster"},a().createElement(i.Layer,{type:"raster",paint:{"raster-opacity":e.opacity},minzoom:e.minzoom,maxzoom:e.maxzoom}))};N.defaultProps={maxzoom:22,minzoom:0,opacity:.7,tileSize:256};const U=N;module.exports=t})();
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,2HCL9D,MAAM,EAA+BC,QAAQ,0B,aCA7C,MAAM,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mB,KAAKkB,KACbZ,IAAAA,KAAOzB,EAAMmB,KAAK4F,YAAY,SAACC,GAC7B9G,EAAQ2D,QAAQoD,KAAIC,EAAAA,EAAAA,SAAQF,GAC9B,IAEA9G,EAAQ2D,QAAQoD,IAAIjH,EAAMmB,KAE9B,CACF,GAAG,CAAC0E,EAAQ7F,EAAMmB,OAGhB,kBAAC,IAAG,CACFgG,oBAAoB,EACpBC,OAAQ,kBAAMtB,GAAU,EAAK,EAC7BuB,OAAQC,IACRrH,IAAK2D,EACLrC,MAAOA,EACPgG,SAAUvH,EAAMuH,UAEhB,kBAAC,EAAW,CACVtH,IAAKC,EACLsH,SAAU,CACRC,aAAa,EACbC,OAAO,EACPrB,SAAS,EACTsB,OAAO,GAETC,wBAAwB,EACxBrH,SAAUwF,EACVvF,SAAUuF,EACVtF,SAAUsF,EACVpF,SAAS,gBAETX,EAAMwD,SAGd,EAEAoC,EAAQD,aAAe,CACrBa,OAnGqB,EAoGrBM,aAnGyB,KAsG3B,UC/JA,IAAMe,EAAc,SAAC7H,GAAY,OAC/B,kBAAC,EAAAoC,OAAM,CACL0F,SAAU9H,EAAM8H,SAChBC,MAAO,CAAC/H,EAAM+B,KACdM,KAAK,UAEL,kBAAC,EAAAC,MAAK,CACJD,KAAK,SACLG,MAAO,CACL,iBAAkBxC,EAAMgI,SAE1BC,QAASjI,EAAMiI,QACfC,QAASlI,EAAMkI,UAEV,EAGXL,EAAYlC,aAAe,CACzBuC,QAAS,GACTD,QAAS,EACTD,QAAS,GACTF,SAAU,KAGZ,U","sources":["webpack://@performant-software/geospatial/webpack/bootstrap","webpack://@performant-software/geospatial/webpack/runtime/compat get default export","webpack://@performant-software/geospatial/webpack/runtime/define property getters","webpack://@performant-software/geospatial/webpack/runtime/hasOwnProperty shorthand","webpack://@performant-software/geospatial/webpack/runtime/make namespace object","webpack://@performant-software/geospatial/external commonjs \"@mapbox/mapbox-gl-draw\"","webpack://@performant-software/geospatial/external commonjs2 \"react\"","webpack://@performant-software/geospatial/external commonjs \"react-map-gl\"","webpack://@performant-software/geospatial/./src/components/DrawControl.js","webpack://@performant-software/geospatial/external commonjs \"underscore\"","webpack://@performant-software/geospatial/./src/components/GeoJsonLayer.js","webpack://@performant-software/geospatial/external commonjs \"react-icons/bs\"","webpack://@performant-software/geospatial/external commonjs \"react-icons/io5\"","webpack://@performant-software/geospatial/external commonjs \"maplibre-gl\"","webpack://@performant-software/geospatial/external commonjs2 \"react-dom\"","webpack://@performant-software/geospatial/./src/components/MapControl.js","webpack://@performant-software/geospatial/./src/components/LayerMenu.js","webpack://@performant-software/geospatial/external commonjs \"@turf/turf\"","webpack://@performant-software/geospatial/./src/components/MapDraw.js","webpack://@performant-software/geospatial/./src/components/RasterLayer.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@mapbox/mapbox-gl-draw\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-map-gl\");","// @flow\n\nimport MapboxDraw from '@mapbox/mapbox-gl-draw';\nimport { forwardRef, useImperativeHandle } from 'react';\nimport { useControl, type ControlPosition, type MapRef } from 'react-map-gl';\n\ntype Props = {\n position?: ControlPosition;\n onCreate?: (evt: { features: Array<any> }) => void;\n onUpdate?: (evt: { features: Array<any>, action: string }) => void;\n onDelete?: (evt: { features: Array<any> }) => void;\n};\n\nconst DrawControl = forwardRef((props: Props, ref) => {\n /**\n * Creates the drawer ref using MapboxDraw.\n */\n const drawRef = useControl(\n () => new MapboxDraw(props),\n ({ map }: { map: MapRef }) => {\n map.on('draw.create', props.onCreate);\n map.on('draw.update', props.onUpdate);\n map.on('draw.delete', props.onDelete);\n },\n ({ map }: { map: MapRef }) => {\n map.off('draw.create', props.onCreate);\n map.off('draw.update', props.onUpdate);\n map.off('draw.delete', props.onDelete);\n },\n {\n position: props.position\n }\n );\n\n /**\n * Exposes the ref for the MapboxDraw object.\n */\n useImperativeHandle(ref, () => drawRef, [drawRef]);\n\n return null;\n});\n\nexport default DrawControl;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"underscore\");","// @flow\n\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useState\n} from 'react';\nimport { Layer, Source } from 'react-map-gl';\nimport _ from 'underscore';\n\ntype Props = {\n data?: { [key: string]: any },\n fillStyle?: { [key: string]: any },\n lineStyle?: { [key: string]: any },\n pointStyle?: { [key: string]: any },\n url?: string\n};\n\nconst DEFAULT_COLOR = '#CC3333';\nconst HIGHLIGHT_COLOR = '#990000';\n\nconst DEFAULT_FILL_STYLES = {\n 'fill-color': DEFAULT_COLOR,\n 'fill-opacity': 0.2\n};\n\nconst DEFAULT_LINE_STYLES = {\n 'line-color': HIGHLIGHT_COLOR,\n 'line-opacity': 0.6\n};\n\nconst DEFAULT_POINT_STYLES = {\n 'circle-radius': [\n 'interpolate',\n ['linear'],\n ['number', ['get', 'point_count'], 1],\n 0, 4,\n 10, 14\n ],\n 'circle-stroke-width': 1,\n 'circle-color': DEFAULT_COLOR,\n 'circle-stroke-color': HIGHLIGHT_COLOR\n};\n\nconst GeoJsonLayer = (props: Props) => {\n const [data, setData] = useState(props.data);\n\n /**\n * Returns the layer style for the passed style and default.\n *\n * @type {function(*, *): *}\n */\n const getLayerStyles = useCallback((style, defaultStyle) => _.defaults(style, defaultStyle), []);\n\n /**\n * Sets the fill layer style.\n *\n * @type {*}\n */\n const fillStyle = useMemo(() => (\n getLayerStyles(props.fillStyle, DEFAULT_FILL_STYLES)\n ), [getLayerStyles, props.fillStyle]);\n\n /**\n * Sets the line layer style.\n *\n * @type {*}\n */\n const lineStyle = useMemo(() => (\n getLayerStyles(props.lineStyle, DEFAULT_LINE_STYLES)\n ), [getLayerStyles, props.lineStyle]);\n\n /**\n * Sets the point layer style.\n *\n * @type {*}\n */\n const pointStyle = useMemo(() => (\n getLayerStyles(props.pointStyle, DEFAULT_POINT_STYLES)\n ), [getLayerStyles, props.pointStyle]);\n\n /**\n * If the data is passed as a URL, fetches the passed URL and sets the response on the state.\n */\n useEffect(() => {\n if (props.url) {\n fetch(props.url)\n .then((response) => response.json())\n .then((json) => setData(json));\n }\n }, [props.url]);\n\n return (\n <Source\n data={data}\n type='geojson'\n >\n <Layer\n filter={['!=', '$type', 'Point']}\n paint={fillStyle}\n type='fill'\n />\n <Layer\n filter={['!=', '$type', 'Point']}\n paint={lineStyle}\n type='line'\n />\n <Layer\n filter={['==', '$type', 'Point']}\n paint={pointStyle}\n type='circle'\n />\n </Source>\n );\n};\n\nexport default GeoJsonLayer;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-icons/bs\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-icons/io5\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"maplibre-gl\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-dom\");","// @flow\n\nimport { IControl } from 'maplibre-gl';\nimport {\n Children,\n cloneElement,\n useCallback,\n useEffect,\n useState\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { MapboxMap, useControl } from 'react-map-gl';\nimport _ from 'underscore';\n\n/**\n * Class to implement the IControl interface to allow custom controls to be drawn on the map.\n */\nclass IControlImpl implements IControl {\n _map: MapboxMap = null;\n _container: HTMLElement;\n _redraw: () => void;\n\n /**\n * Constructs a new IControlImpl object.\n *\n * @param redraw\n */\n constructor(redraw: () => void) {\n this._redraw = redraw;\n }\n\n /**\n * Creates the container when the component is added to the passed map.\n *\n * @param map\n *\n * @returns {HTMLElement}\n */\n onAdd(map) {\n this._map = map;\n map.on('move', this._redraw);\n\n this._container = document.createElement('div');\n this._container.className = 'maplibregl-ctrl-group maplibregl-ctrl';\n this._redraw();\n return this._container;\n }\n\n /**\n * Removes the container when the component is removed from the map.\n */\n onRemove() {\n this._container.remove();\n this._map.off('move', this._redraw);\n this._map = null;\n }\n\n /**\n * Returns the map instance.\n *\n * @returns {mapboxgl.Map}\n */\n getMap() {\n return this._map;\n }\n\n /**\n * Returns the container instance.\n *\n * @returns {HTMLElement}\n */\n getElement() {\n return this._container;\n }\n}\n\nconst MapControl = (props) => {\n const [, setVersion] = useState(0);\n\n /**\n * Forces the component to re-render on map move.\n *\n * @type {function(): void}\n */\n const forceUpdate = useCallback(() => setVersion((v) => v + 1), []);\n\n /**\n * Creates the map control.\n *\n * @type {IControlImpl}\n */\n const ctrl = useControl(() => new IControlImpl(forceUpdate), { position: props.position });\n\n /**\n * Sets the map instance.\n *\n * @type {mapboxgl.Map}\n */\n const map = ctrl.getMap();\n\n /**\n * Creates the list of children to be added to the map instance.\n *\n * @type {Array<$NonMaybeType<*>>}\n */\n const children = Children.map(_.compact(Children.toArray(props.children)), (child) => cloneElement(child, { map }));\n\n /**\n * Sets the map ref.\n */\n useEffect(() => {\n if (props.mapRef) {\n // eslint-disable-next-line no-param-reassign\n props.mapRef.current = map;\n }\n }, [map, props.mapRef]);\n\n return map && createPortal(children, ctrl.getElement());\n};\n\nexport default MapControl;\n","// @flow\n\nimport React, {\n Children,\n useCallback,\n useEffect,\n useMemo, useRef,\n useState\n} from 'react';\nimport { BsStack } from 'react-icons/bs';\nimport { IoCheckmarkOutline } from 'react-icons/io5';\nimport _ from 'underscore';\nimport MapControl from './MapControl';\nimport './LayerMenu.css';\n\ntype Props = {\n children: Node,\n names: Array<string>,\n position: 'top-left' | 'bottom-left' | 'top-right' | 'bottom-right'\n};\n\nconst MENU_PADDING = 30;\n\nconst LayerMenu = (props: Props) => {\n const [canvasHeight, setCanvasHeight] = useState(0);\n const [visible, setVisible] = useState();\n const [menuOpen, setMenuOpen] = useState(false);\n\n const mapRef = useRef();\n\n /**\n * Returns the name of the layer at the passed index.\n *\n * @type {unknown}\n */\n const getLayerName = useCallback((index) => (\n props.names && props.names.length > index && props.names[index]\n ), [props.names]);\n\n /**\n * Returns true if the child element at the passed index is visible.\n *\n * @type {function(*): *}\n */\n const isVisible = useCallback((index) => _.includes(visible, index), [visible]);\n\n /**\n * Returns a memoized array of the child elements.\n *\n * @type {Array<$NonMaybeType<unknown>>}\n */\n const children = useMemo(() => Children.toArray(props.children), [props.children]);\n\n /**\n * Returns a memoized array of visible child elements.\n */\n const visibleChildren = useMemo(() => _.filter(children, (child, index) => isVisible(index)), [children, isVisible]);\n\n /**\n * Toggles the visibility for the child element at the passed index.\n *\n * @type {(function(*): void)|*}\n */\n const toggleVisibility = useCallback((index) => {\n let value;\n\n if (isVisible(index)) {\n value = _.without(visible, index);\n } else {\n value = [...visible, index];\n }\n\n setVisible(value);\n }, [isVisible, visible]);\n\n /**\n * Sets all of the child elements to be visible when the component mounts.\n */\n useEffect(() => {\n setVisible(_.times(children.length, (index) => index));\n }, []);\n\n /**\n * Sets the map canvas height.\n */\n useEffect(() => {\n const { current: instance } = mapRef;\n\n if (instance && instance._canvas) {\n const { offsetHeight = 0 } = mapRef.current._canvas;\n setCanvasHeight(offsetHeight);\n }\n }, [mapRef.current]);\n\n if (_.isEmpty(children)) {\n return null;\n }\n\n return (\n <>\n <MapControl\n mapRef={mapRef}\n position={props.position}\n >\n <button\n className='mapbox-gl-draw_ctrl-draw-btn layer-button'\n onClick={() => setMenuOpen((prevMenuOpen) => !prevMenuOpen)}\n type='button'\n >\n <BsStack\n size='1.25em'\n />\n </button>\n { menuOpen && (\n <div\n className='layer-menu'\n style={{\n maxHeight: `calc(${canvasHeight}px - ${MENU_PADDING}px)`\n }}\n >\n <div\n className='menu'\n >\n { _.map(children, (child, index) => (\n <div\n aria-selected={isVisible(index)}\n className='option'\n role='option'\n onClick={() => toggleVisibility(index)}\n onKeyDown={() => toggleVisibility(index)}\n tabIndex={index}\n >\n <div\n className='checkmark-container'\n >\n { isVisible(index) && (\n <IoCheckmarkOutline\n size='1em'\n />\n )}\n </div>\n { getLayerName(index) }\n </div>\n ))}\n </div>\n </div>\n )}\n </MapControl>\n { visibleChildren }\n </>\n );\n};\n\nLayerMenu.defaultProps = {\n position: 'top-left'\n};\n\nexport default LayerMenu;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@turf/turf\");","// @flow\n\nimport MapboxDraw from '@mapbox/mapbox-gl-draw';\nimport {\n bbox,\n bboxPolygon,\n buffer,\n feature,\n type FeatureCollection,\n type GeometryCollection\n} from '@turf/turf';\nimport maplibregl from 'maplibre-gl';\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type Node\n} from 'react';\nimport Map, { MapRef } from 'react-map-gl';\nimport _ from 'underscore';\nimport DrawControl from './DrawControl';\nimport './MapDraw.css';\n\n// Override the MapboxDraw components to use MapLibre styles\nMapboxDraw.constants.classes.CONTROL_BASE = 'maplibregl-ctrl';\nMapboxDraw.constants.classes.CONTROL_PREFIX = 'maplibregl-ctrl-';\nMapboxDraw.constants.classes.CONTROL_GROUP = 'maplibregl-ctrl-group';\n\ntype Props = {\n /**\n * The number of miles to buffer the GeoJSON data.\n */\n buffer?: number,\n\n /**\n * Additional child nodes to render.\n */\n children?: Node,\n\n /**\n * GeoJSON structured data to be displayed on the map.\n */\n data: GeometryCollection | FeatureCollection,\n\n /**\n * URL of the map style to render. This URL should contain any necessary API keys.\n */\n mapStyle: string,\n\n /**\n * Callback fired when the map geometries are changed.\n *\n * @param features\n */\n onChange: (features: Array<any>) => void,\n\n /**\n * Map style object.\n */\n style?: any,\n\n /**\n * The time in milliseconds to zoom into the location.\n */\n zoomDuration?: number\n};\n\nconst DEFAULT_BUFFER = 2;\nconst DEFAULT_ZOOM_DELAY = 1000;\n\nconst GeometryTypes = {\n geometryCollection: 'GeometryCollection',\n point: 'Point'\n};\n\n/**\n * This component renders a map with controls for drawing one or more geometries. Geometries can be a point (lat/long),\n * a line, or a polygon.\n */\nconst MapDraw = (props: Props) => {\n const [loaded, setLoaded] = useState(false);\n\n const drawRef = useRef<MapboxDraw>();\n const mapRef = useRef<MapRef>();\n\n /**\n * Calls the onChange prop with all of the geometries in the current drawer.\n *\n * @type {(function(): void)|*}\n */\n const onChange = useCallback(() => {\n props.onChange(drawRef.current.getAll());\n }, [props.onChange]);\n\n /**\n * Sets the map style.\n *\n * @type {{width: string, height: number}}\n */\n const style = useMemo(() => ({ height: 500, width: '100%', ...(props.style || {}) }), [props.style]);\n\n /**\n * Updates the map bounding box and drawer when the geometry is changed.\n */\n useEffect(() => {\n if (loaded && props.data) {\n // Convert the GeoJSON into a bounding box\n const box = bbox(props.data);\n\n // Convert the bounding box to a polygon\n const polygon = bboxPolygon(box);\n\n // Create a buffer around the polygon\n const polygonBuffer = buffer(polygon, props.buffer, { units: 'miles' });\n\n // Convert the buffer to a bounding box\n const boundingBox = bbox(polygonBuffer);\n\n // Sets the bounding box for the current geometry.\n if (_.every(boundingBox, _.isFinite)) {\n const [minLng, minLat, maxLng, maxLat] = boundingBox;\n const bounds = [[minLng, minLat], [maxLng, maxLat]];\n\n mapRef.current.fitBounds(bounds, { duration: props.zoomDuration });\n }\n\n // Handle special cases for geometry collection (not supported by mabox-gl-draw) and point\n if (props.data.type === GeometryTypes.geometryCollection) {\n _.each(props.data.geometries, (geometry) => {\n drawRef.current.add(feature(geometry));\n });\n } else {\n drawRef.current.add(props.data);\n }\n }\n }, [loaded, props.data]);\n\n return (\n <Map\n attributionControl={false}\n onLoad={() => setLoaded(true)}\n mapLib={maplibregl}\n ref={mapRef}\n style={style}\n mapStyle={props.mapStyle}\n >\n <DrawControl\n ref={drawRef}\n controls={{\n line_string: true,\n point: true,\n polygon: true,\n trash: true\n }}\n displayControlsDefault={false}\n onCreate={onChange}\n onUpdate={onChange}\n onDelete={onChange}\n position='bottom-left'\n />\n { props.children }\n </Map>\n );\n};\n\nMapDraw.defaultProps = {\n buffer: DEFAULT_BUFFER,\n zoomDuration: DEFAULT_ZOOM_DELAY\n};\n\nexport default MapDraw;\n","// @flow\n\nimport React from 'react';\nimport { Layer, Source } from 'react-map-gl';\n\ntype Props = {\n maxzoom?: number,\n minzoom?: number,\n opacity?: number,\n tileSize?: number,\n url?: string,\n};\n\nconst RasterLayer = (props: Props) => (\n <Source\n tileSize={props.tileSize}\n tiles={[props.url]}\n type='raster'\n >\n <Layer\n type='raster'\n paint={{\n 'raster-opacity': props.opacity\n }}\n minzoom={props.minzoom}\n maxzoom={props.maxzoom}\n />\n </Source>\n);\n\nRasterLayer.defaultProps = {\n maxzoom: 22,\n minzoom: 0,\n opacity: 0.7,\n tileSize: 256\n};\n\nexport default RasterLayer;\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","forwardRef","props","ref","drawRef","useControl","MapboxDraw","map","on","onCreate","onUpdate","onDelete","off","position","useImperativeHandle","DEFAULT_COLOR","HIGHLIGHT_COLOR","DEFAULT_FILL_STYLES","DEFAULT_LINE_STYLES","DEFAULT_POINT_STYLES","useState","data","setData","getLayerStyles","useCallback","style","defaultStyle","_","fillStyle","useMemo","lineStyle","pointStyle","useEffect","url","fetch","then","response","json","Source","type","Layer","filter","paint","IControlImpl","redraw","_map","this","_redraw","_container","document","createElement","className","remove","setVersion","forceUpdate","v","ctrl","getMap","children","Children","child","cloneElement","mapRef","current","createPortal","getElement","LayerMenu","canvasHeight","setCanvasHeight","visible","setVisible","menuOpen","setMenuOpen","useRef","getLayerName","index","names","length","isVisible","visibleChildren","toggleVisibility","instance","_canvas","offsetHeight","onClick","prevMenuOpen","BsStack","size","maxHeight","role","onKeyDown","tabIndex","IoCheckmarkOutline","defaultProps","MapDraw","loaded","setLoaded","onChange","getAll","height","width","box","bbox","polygon","bboxPolygon","polygonBuffer","buffer","units","boundingBox","bounds","fitBounds","duration","zoomDuration","geometries","geometry","add","feature","attributionControl","onLoad","mapLib","maplibregl","mapStyle","controls","line_string","point","trash","displayControlsDefault","RasterLayer","tileSize","tiles","opacity","minzoom","maxzoom"],"sourceRoot":""}
|