@performant-software/geospatial 2.2.23-beta.13 → 2.2.23-beta.15
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/build/index.js +2 -0
- package/build/index.js.map +1 -0
- package/build/main.css +127 -0
- 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.cjs19.js +1 -1
- package/dist/index.cjs198.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.cjs26.js +1 -1
- package/dist/index.cjs52.js +1 -1
- package/dist/index.cjs59.js +1 -1
- package/dist/index.cjs6.js +1 -1
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs60.js +9 -1
- package/dist/index.cjs60.js.map +1 -1
- package/dist/index.cjs61.js +19 -1
- package/dist/index.cjs61.js.map +1 -1
- package/dist/index.cjs62.js +1 -9
- package/dist/index.cjs62.js.map +1 -1
- package/dist/index.cjs63.js +1 -19
- package/dist/index.cjs63.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 +2 -2
- package/dist/index.es15.js +9 -9
- package/dist/index.es16.js +1 -1
- package/dist/index.es17.js +3 -3
- package/dist/index.es19.js +2 -2
- package/dist/index.es198.js +2 -2
- package/dist/index.es233.js +46 -3
- package/dist/index.es233.js.map +1 -1
- package/dist/index.es234.js +22 -45
- package/dist/index.es234.js.map +1 -1
- package/dist/index.es235.js +3 -23
- package/dist/index.es235.js.map +1 -1
- package/dist/index.es26.js +1 -1
- package/dist/index.es52.js +6 -6
- package/dist/index.es59.js +2 -6
- package/dist/index.es59.js.map +1 -1
- package/dist/index.es6.js +19 -19
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es60.js +30 -2
- package/dist/index.es60.js.map +1 -1
- package/dist/index.es61.js +602 -2
- package/dist/index.es61.js.map +1 -1
- package/dist/index.es62.js +5 -29
- package/dist/index.es62.js.map +1 -1
- package/dist/index.es63.js +2 -602
- package/dist/index.es63.js.map +1 -1
- package/dist/index.es64.js +2 -2
- package/dist/index.es67.js +2 -55
- package/dist/index.es67.js.map +1 -1
- package/dist/index.es68.js +4 -48
- package/dist/index.es68.js.map +1 -1
- package/dist/index.es69.js +28 -37
- package/dist/index.es69.js.map +1 -1
- package/dist/index.es70.js +56 -11
- package/dist/index.es70.js.map +1 -1
- package/dist/index.es71.js +47 -14
- package/dist/index.es71.js.map +1 -1
- package/dist/index.es72.js +38 -29
- package/dist/index.es72.js.map +1 -1
- package/dist/index.es73.js +8 -11
- package/dist/index.es73.js.map +1 -1
- package/dist/index.es74.js +14 -13
- package/dist/index.es74.js.map +1 -1
- package/dist/index.es75.js +29 -12
- package/dist/index.es75.js.map +1 -1
- package/dist/index.es76.js +13 -2
- package/dist/index.es76.js.map +1 -1
- package/dist/index.es77.js +14 -4
- package/dist/index.es77.js.map +1 -1
- package/dist/index.es78.js +49 -26
- package/dist/index.es78.js.map +1 -1
- package/dist/index.es79.js +58 -44
- package/dist/index.es79.js.map +1 -1
- package/dist/index.es80.js +10 -64
- package/dist/index.es80.js.map +1 -1
- package/package.json +1 -1
- package/src/components/LocationMarkers.js +11 -1
- package/types/components/LocationMarker.js.flow +82 -0
- package/types/components/LocationMarkers.js.flow +11 -1
package/dist/index.es80.js
CHANGED
|
@@ -1,68 +1,14 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { MapContext as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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;
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
import { useContext as n, useMemo as a } from "react";
|
|
3
|
+
import { MapContext as u } from "./index.es70.js";
|
|
4
|
+
const p = e.createContext(null);
|
|
5
|
+
function c() {
|
|
6
|
+
var o;
|
|
7
|
+
const r = (o = n(p)) === null || o === void 0 ? void 0 : o.maps, t = n(u);
|
|
8
|
+
return a(() => ({ ...r, current: t == null ? void 0 : t.map }), [r, t]);
|
|
64
9
|
}
|
|
65
10
|
export {
|
|
66
|
-
|
|
11
|
+
p as MountedMapsContext,
|
|
12
|
+
c as useMap
|
|
67
13
|
};
|
|
68
14
|
//# sourceMappingURL=index.es80.js.map
|
package/dist/index.es80.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es80.js","sources":["../../../node_modules/react-map-gl/dist/esm/components/
|
|
1
|
+
{"version":3,"file":"index.es80.js","sources":["../../../node_modules/react-map-gl/dist/esm/components/use-map.js"],"sourcesContent":["import * as React from 'react';\nimport { useState, useCallback, useMemo, useContext } from 'react';\nimport { MapContext } from './map';\nexport const MountedMapsContext = React.createContext(null);\nexport const MapProvider = props => {\n const [maps, setMaps] = useState({});\n const onMapMount = useCallback((map, id = 'default') => {\n setMaps(currMaps => {\n if (id === 'current') {\n throw new Error(\"'current' cannot be used as map id\");\n }\n if (currMaps[id]) {\n throw new Error(`Multiple maps with the same id: ${id}`);\n }\n return { ...currMaps, [id]: map };\n });\n }, []);\n const onMapUnmount = useCallback((id = 'default') => {\n setMaps(currMaps => {\n if (currMaps[id]) {\n const nextMaps = { ...currMaps };\n delete nextMaps[id];\n return nextMaps;\n }\n return currMaps;\n });\n }, []);\n return (React.createElement(MountedMapsContext.Provider, { value: {\n maps,\n onMapMount,\n onMapUnmount\n } }, props.children));\n};\nexport function useMap() {\n var _a;\n const maps = (_a = useContext(MountedMapsContext)) === null || _a === void 0 ? void 0 : _a.maps;\n const currentMap = useContext(MapContext);\n const mapsWithCurrent = useMemo(() => {\n return { ...maps, current: currentMap === null || currentMap === void 0 ? void 0 : currentMap.map };\n }, [maps, currentMap]);\n return mapsWithCurrent;\n}\n//# sourceMappingURL=use-map.js.map"],"names":["MountedMapsContext","React","useMap","_a","maps","useContext","currentMap","MapContext","useMemo"],"mappings":";;;AAGa,MAAAA,IAAqBC,EAAM,cAAc,IAAI;AA8BnD,SAASC,IAAS;AACjB,MAAAC;AACE,QAAAC,KAAQD,IAAKE,EAAWL,CAAkB,OAAO,QAAQG,MAAO,SAAS,SAASA,EAAG,MACrFG,IAAaD,EAAWE,CAAU;AAIjC,SAHiBC,EAAQ,OACrB,EAAE,GAAGJ,GAAM,SAASE,KAAe,OAAgC,SAASA,EAAW,IAAI,IACnG,CAACF,GAAME,CAAU,CAAC;AAEzB;","x_google_ignoreList":[0]}
|
package/package.json
CHANGED
|
@@ -99,6 +99,16 @@ const LocationMarkers = (props: Props) => {
|
|
|
99
99
|
*/
|
|
100
100
|
const data = useMemo(() => (_.isEmpty(props.data) ? null : props.data), [props.data]);
|
|
101
101
|
|
|
102
|
+
const cluster = useMemo(() => {
|
|
103
|
+
if (!props.cluster) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
console.log(data);
|
|
108
|
+
|
|
109
|
+
return true;
|
|
110
|
+
}, [data, props.cluster]);
|
|
111
|
+
|
|
102
112
|
/**
|
|
103
113
|
* Sets the bounding box on the map.
|
|
104
114
|
*/
|
|
@@ -125,7 +135,7 @@ const LocationMarkers = (props: Props) => {
|
|
|
125
135
|
/>
|
|
126
136
|
)}
|
|
127
137
|
<GeoJSONLayer
|
|
128
|
-
cluster={
|
|
138
|
+
cluster={cluster}
|
|
129
139
|
clusterMaxZoom={props.clusterMaxZoom}
|
|
130
140
|
clusterMinPoints={props.clusterMinPoints}
|
|
131
141
|
clusterProperties={props.clusterProperties}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import { MixedGeoJSONLayer, PulsingMarkerLayer, useMap } from '@peripleo/maplibre';
|
|
4
|
+
import React, { useEffect } from 'react';
|
|
5
|
+
import { DEFAULT_FILL_STYLE, DEFAULT_POINT_STYLE, DEFAULT_STROKE_STYLE } from '../utils/MapStyles';
|
|
6
|
+
import MapUtils from '../utils/Map';
|
|
7
|
+
|
|
8
|
+
type Props = {
|
|
9
|
+
/**
|
|
10
|
+
* If `true`, the point marker will display with a pulsing animation.
|
|
11
|
+
*/
|
|
12
|
+
animate?: boolean,
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The number of miles to buffer the GeoJSON data.
|
|
16
|
+
*/
|
|
17
|
+
buffer: number,
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The GeoJSON data representing the location.
|
|
21
|
+
*/
|
|
22
|
+
data: { [key: string]: any },
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* GeoJSON layer fill style.
|
|
26
|
+
*/
|
|
27
|
+
fillStyle?: { [key: string]: any },
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* GeoJSON layer point style.
|
|
31
|
+
*/
|
|
32
|
+
pointStyle?: { [key: string]: any },
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* GeoJSON layer stroke style
|
|
36
|
+
*/
|
|
37
|
+
strokeStyle?: { [key: string]: any }
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const DEFAULT_BUFFER = 2;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* This component renders a location marker to be used in a Peripleo context.
|
|
44
|
+
*/
|
|
45
|
+
const LocationMarker = (props: Props) => {
|
|
46
|
+
const map = useMap();
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Sets the bounding box on the map.
|
|
50
|
+
*/
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (map && props.data) {
|
|
53
|
+
const boundingBox = MapUtils.getBoundingBox(props.data, props.buffer);
|
|
54
|
+
map.fitBounds(boundingBox);
|
|
55
|
+
}
|
|
56
|
+
}, [map, props.buffer, props.data]);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<>
|
|
60
|
+
{ props.animate && (
|
|
61
|
+
<PulsingMarkerLayer
|
|
62
|
+
data={props.data}
|
|
63
|
+
/>
|
|
64
|
+
)}
|
|
65
|
+
<MixedGeoJSONLayer
|
|
66
|
+
data={props.data}
|
|
67
|
+
fillStyle={props.fillStyle}
|
|
68
|
+
strokeStyle={props.strokeStyle}
|
|
69
|
+
pointStyle={props.pointStyle}
|
|
70
|
+
/>
|
|
71
|
+
</>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
LocationMarker.defaultProps = {
|
|
76
|
+
buffer: DEFAULT_BUFFER,
|
|
77
|
+
fillStyle: DEFAULT_FILL_STYLE,
|
|
78
|
+
pointStyle: DEFAULT_POINT_STYLE,
|
|
79
|
+
strokeStyle: DEFAULT_STROKE_STYLE
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export default LocationMarker;
|
|
@@ -99,6 +99,16 @@ const LocationMarkers = (props: Props) => {
|
|
|
99
99
|
*/
|
|
100
100
|
const data = useMemo(() => (_.isEmpty(props.data) ? null : props.data), [props.data]);
|
|
101
101
|
|
|
102
|
+
const cluster = useMemo(() => {
|
|
103
|
+
if (!props.cluster) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
console.log(data);
|
|
108
|
+
|
|
109
|
+
return true;
|
|
110
|
+
}, [data, props.cluster]);
|
|
111
|
+
|
|
102
112
|
/**
|
|
103
113
|
* Sets the bounding box on the map.
|
|
104
114
|
*/
|
|
@@ -125,7 +135,7 @@ const LocationMarkers = (props: Props) => {
|
|
|
125
135
|
/>
|
|
126
136
|
)}
|
|
127
137
|
<GeoJSONLayer
|
|
128
|
-
cluster={
|
|
138
|
+
cluster={cluster}
|
|
129
139
|
clusterMaxZoom={props.clusterMaxZoom}
|
|
130
140
|
clusterMinPoints={props.clusterMinPoints}
|
|
131
141
|
clusterProperties={props.clusterProperties}
|