@react-fabric/map 1.0.0-beta.62 → 1.0.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/cjs/index.js +24 -18
- package/dist/cjs/layers/Json.js +6 -6
- package/dist/cjs/layers/Marker.js +6 -10
- package/dist/cjs/markers/Fill.js +14 -14
- package/dist/cjs/markers/Pin.js +11 -11
- package/dist/cjs/markers/context.js +34 -0
- package/dist/cjs/renderers/Heatmap.js +9 -9
- package/dist/cjs/renderers/Simple.js +5 -4
- package/dist/cjs/tools/BasemapGallery.js +8 -9
- package/dist/cjs/tools/Home.js +21 -22
- package/dist/cjs/tools/LayerList.js +4 -5
- package/dist/cjs/tools/ScaleBar.js +3 -4
- package/dist/cjs/tools/Zoom.js +5 -6
- package/dist/cjs/viewer/{Context.js → Provider.js} +10 -18
- package/dist/cjs/viewer/Viewer.js +4 -4
- package/dist/cjs/viewer/context.js +34 -0
- package/dist/esm/index.js +23 -19
- package/dist/esm/layers/Json.js +5 -5
- package/dist/esm/layers/Marker.js +7 -10
- package/dist/esm/markers/Fill.js +13 -13
- package/dist/esm/markers/Pin.js +9 -9
- package/dist/esm/markers/context.js +33 -0
- package/dist/esm/renderers/Heatmap.js +9 -9
- package/dist/esm/renderers/Simple.js +5 -4
- package/dist/esm/tools/BasemapGallery.js +7 -8
- package/dist/esm/tools/Home.js +20 -21
- package/dist/esm/tools/LayerList.js +4 -5
- package/dist/esm/tools/ScaleBar.js +3 -4
- package/dist/esm/tools/Zoom.js +4 -5
- package/dist/esm/viewer/{Context.js → Provider.js} +12 -19
- package/dist/esm/viewer/Viewer.js +4 -4
- package/dist/esm/viewer/context.js +33 -0
- package/dist/types/index.d.ts +48 -63
- package/dist/types/layers/Json.d.ts +2 -1
- package/dist/types/layers/Marker.d.ts +3 -4
- package/dist/types/markers/Fill.d.ts +3 -2
- package/dist/types/markers/Pin.d.ts +3 -2
- package/dist/types/markers/context.d.ts +3 -0
- package/dist/types/renderers/Cluster.d.ts +4 -4
- package/dist/types/renderers/Heatmap.d.ts +4 -4
- package/dist/types/renderers/Simple.d.ts +1 -1
- package/dist/types/tools/BasemapGallery.d.ts +1 -1
- package/dist/types/tools/Home.d.ts +3 -3
- package/dist/types/tools/LayerList.d.ts +1 -1
- package/dist/types/tools/ScaleBar.d.ts +1 -1
- package/dist/types/tools/Zoom.d.ts +1 -1
- package/dist/types/viewer/Provider.d.ts +5 -0
- package/dist/types/viewer/Viewer.d.ts +1 -1
- package/dist/types/viewer/context.d.ts +18 -0
- package/package.json +16 -22
- package/src/index.ts +23 -18
- package/src/layers/Json.tsx +5 -5
- package/src/layers/Marker.tsx +9 -22
- package/src/markers/Fill.tsx +23 -33
- package/src/markers/Pin.tsx +15 -22
- package/src/markers/context.ts +29 -0
- package/src/renderers/Cluster.tsx +12 -16
- package/src/renderers/Heatmap.tsx +12 -16
- package/src/renderers/Simple.tsx +6 -6
- package/src/tools/BasemapGallery.tsx +11 -28
- package/src/tools/Home.tsx +25 -30
- package/src/tools/LayerList.tsx +7 -13
- package/src/tools/ScaleBar.tsx +5 -4
- package/src/tools/Zoom.tsx +6 -5
- package/src/viewer/{Context.tsx → Provider.tsx} +25 -39
- package/src/viewer/Viewer.tsx +4 -4
- package/src/viewer/context.ts +44 -0
- package/dist/types/viewer/Context.d.ts +0 -16
package/dist/esm/tools/Home.js
CHANGED
|
@@ -4,15 +4,13 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
|
4
4
|
import * as reactiveUtils from '@arcgis/core/core/reactiveUtils';
|
|
5
5
|
import Point from '@arcgis/core/geometry/Point';
|
|
6
6
|
import Viewpoint from '@arcgis/core/Viewpoint';
|
|
7
|
-
import
|
|
8
|
-
import '@arcgis/map-components/components/arcgis-placement';
|
|
9
|
-
import { CalciteButton } from '@esri/calcite-components-react';
|
|
7
|
+
import '@esri/calcite-components/components/calcite-button';
|
|
10
8
|
import { debounce, getLatitudeLongitude } from '@react-fabric/utilities';
|
|
11
9
|
import { useRef, useState, useEffect, useCallback } from 'react';
|
|
12
|
-
import { useMap } from '../viewer/
|
|
10
|
+
import { useMap } from '../viewer/context.js';
|
|
13
11
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
function Home(_ref) {
|
|
16
14
|
var enableHistory = _ref.enableHistory;
|
|
17
15
|
var _useMap = useMap(),
|
|
18
16
|
map = _useMap.map,
|
|
@@ -20,8 +18,8 @@ var Home = function Home(_ref) {
|
|
|
20
18
|
disableDrag = _useMap.disableDrag,
|
|
21
19
|
center = _useMap.center,
|
|
22
20
|
zoom = _useMap.zoom;
|
|
23
|
-
var
|
|
24
|
-
var
|
|
21
|
+
var isNavigatingHistoryRef = useRef(false);
|
|
22
|
+
var currentIndexRef = useRef(0);
|
|
25
23
|
var _useState = useState([]),
|
|
26
24
|
_useState2 = _slicedToArray(_useState, 2),
|
|
27
25
|
history = _useState2[0],
|
|
@@ -31,22 +29,22 @@ var Home = function Home(_ref) {
|
|
|
31
29
|
activeIndex = _useState4[0],
|
|
32
30
|
setActiveIndex = _useState4[1];
|
|
33
31
|
useEffect(function () {
|
|
34
|
-
|
|
32
|
+
currentIndexRef.current = activeIndex;
|
|
35
33
|
}, [activeIndex]);
|
|
36
34
|
useEffect(function () {
|
|
37
35
|
if (enableHistory && !disableDrag && view) {
|
|
38
36
|
var addHistory = debounce(function (viewpoint) {
|
|
39
|
-
if (!
|
|
37
|
+
if (!isNavigatingHistoryRef.current) {
|
|
40
38
|
setHistory(function (h) {
|
|
41
39
|
// Keep max 25 history entries
|
|
42
|
-
var newHistory = h.slice(0,
|
|
40
|
+
var newHistory = h.slice(0, currentIndexRef.current + 1).slice(-24);
|
|
43
41
|
// Add new viewpoint to history
|
|
44
42
|
newHistory.push(viewpoint.clone());
|
|
45
43
|
setActiveIndex(newHistory.length - 1);
|
|
46
44
|
return newHistory;
|
|
47
45
|
});
|
|
48
46
|
}
|
|
49
|
-
|
|
47
|
+
isNavigatingHistoryRef.current = false;
|
|
50
48
|
});
|
|
51
49
|
var watcher = reactiveUtils.watch(function () {
|
|
52
50
|
return view.viewpoint;
|
|
@@ -58,17 +56,18 @@ var Home = function Home(_ref) {
|
|
|
58
56
|
}, [disableDrag, enableHistory, view]);
|
|
59
57
|
var navigate = useCallback(function (idx) {
|
|
60
58
|
if (history.length > 0 && history[idx] && view) {
|
|
61
|
-
|
|
59
|
+
isNavigatingHistoryRef.current = true;
|
|
62
60
|
void view.goTo(history[idx]);
|
|
63
61
|
setActiveIndex(idx);
|
|
64
62
|
}
|
|
65
|
-
}, [history]);
|
|
63
|
+
}, [history, view]);
|
|
66
64
|
var gotoHome = useCallback(function () {
|
|
67
65
|
if (view) {
|
|
68
|
-
var
|
|
69
|
-
var extent;
|
|
66
|
+
var _view$tileInfo;
|
|
67
|
+
var extent = undefined;
|
|
70
68
|
map === null || map === void 0 || map.layers.forEach(function (layer) {
|
|
71
69
|
if (layer.visible && layer.fullExtent) {
|
|
70
|
+
console.log(layer.type, layer.fullExtent);
|
|
72
71
|
if (extent) {
|
|
73
72
|
extent = extent.union(layer.fullExtent);
|
|
74
73
|
} else {
|
|
@@ -76,16 +75,16 @@ var Home = function Home(_ref) {
|
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
});
|
|
79
|
-
void view.goTo(
|
|
78
|
+
void view.goTo(extent !== null && extent !== void 0 ? extent : new Viewpoint({
|
|
80
79
|
scale: (_view$tileInfo = view.tileInfo) === null || _view$tileInfo === void 0 ? void 0 : _view$tileInfo.zoomToScale(zoom),
|
|
81
80
|
targetGeometry: new Point(getLatitudeLongitude(center))
|
|
82
81
|
}));
|
|
83
82
|
}
|
|
84
83
|
}, [center, zoom, view, map]);
|
|
85
|
-
return !disableDrag && /*#__PURE__*/jsxs(
|
|
84
|
+
return !disableDrag && /*#__PURE__*/jsxs("div", {
|
|
86
85
|
slot: "top-left",
|
|
87
86
|
className: "mb-2 flex flex-col divide-y divide-tint-100",
|
|
88
|
-
children: [enableHistory && /*#__PURE__*/jsx(
|
|
87
|
+
children: [enableHistory && /*#__PURE__*/jsx("calcite-button", {
|
|
89
88
|
appearance: "solid",
|
|
90
89
|
kind: "neutral",
|
|
91
90
|
iconStart: "arrow-left",
|
|
@@ -93,14 +92,14 @@ var Home = function Home(_ref) {
|
|
|
93
92
|
onClick: function onClick() {
|
|
94
93
|
return navigate(activeIndex - 1);
|
|
95
94
|
}
|
|
96
|
-
}), /*#__PURE__*/jsx(
|
|
95
|
+
}), /*#__PURE__*/jsx("calcite-button", {
|
|
97
96
|
appearance: "solid",
|
|
98
97
|
kind: "neutral",
|
|
99
98
|
iconStart: "home",
|
|
100
99
|
onClick: function onClick() {
|
|
101
100
|
return gotoHome();
|
|
102
101
|
}
|
|
103
|
-
}), enableHistory && /*#__PURE__*/jsx(
|
|
102
|
+
}), enableHistory && /*#__PURE__*/jsx("calcite-button", {
|
|
104
103
|
appearance: "solid",
|
|
105
104
|
kind: "neutral",
|
|
106
105
|
iconStart: "arrow-right",
|
|
@@ -110,6 +109,6 @@ var Home = function Home(_ref) {
|
|
|
110
109
|
}
|
|
111
110
|
})]
|
|
112
111
|
});
|
|
113
|
-
}
|
|
112
|
+
}
|
|
114
113
|
|
|
115
114
|
export { Home };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { ArcgisExpand, ArcgisLayerList } from '@arcgis/map-components-react';
|
|
4
3
|
import '@arcgis/map-components/components/arcgis-expand';
|
|
5
4
|
import '@arcgis/map-components/components/arcgis-layer-list';
|
|
6
5
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -28,16 +27,16 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
28
27
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
29
28
|
*/
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
return /*#__PURE__*/jsx(
|
|
30
|
+
function LayerList() {
|
|
31
|
+
return /*#__PURE__*/jsx("arcgis-expand", {
|
|
33
32
|
expandIcon: "layers",
|
|
34
33
|
className: "mb-2",
|
|
35
34
|
collapseIcon: "x",
|
|
36
35
|
mode: "floating",
|
|
37
36
|
slot: "top-right",
|
|
38
37
|
autoCollapse: true,
|
|
39
|
-
children: /*#__PURE__*/jsx(
|
|
38
|
+
children: /*#__PURE__*/jsx("arcgis-layer-list", {})
|
|
40
39
|
});
|
|
41
|
-
}
|
|
40
|
+
}
|
|
42
41
|
|
|
43
42
|
export { LayerList };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { ArcgisScaleBar } from '@arcgis/map-components-react';
|
|
4
3
|
import '@arcgis/map-components/components/arcgis-scale-bar';
|
|
5
4
|
import { jsx } from 'react/jsx-runtime';
|
|
6
5
|
|
|
@@ -27,10 +26,10 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
27
26
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
27
|
*/
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
return /*#__PURE__*/jsx(
|
|
29
|
+
function ScaleBar() {
|
|
30
|
+
return /*#__PURE__*/jsx("arcgis-scale-bar", {
|
|
32
31
|
slot: "bottom-left"
|
|
33
32
|
});
|
|
34
|
-
}
|
|
33
|
+
}
|
|
35
34
|
|
|
36
35
|
export { ScaleBar };
|
package/dist/esm/tools/Zoom.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { ArcgisZoom } from '@arcgis/map-components-react';
|
|
4
3
|
import '@arcgis/map-components/components/arcgis-zoom';
|
|
5
|
-
import { useMap } from '../viewer/
|
|
4
|
+
import { useMap } from '../viewer/context.js';
|
|
6
5
|
import { jsx } from 'react/jsx-runtime';
|
|
7
6
|
|
|
8
7
|
/*
|
|
@@ -28,13 +27,13 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
28
27
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
29
28
|
*/
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
function Zoom() {
|
|
32
31
|
var _useMap = useMap(),
|
|
33
32
|
disableZoom = _useMap.disableZoom;
|
|
34
|
-
return !disableZoom && /*#__PURE__*/jsx(
|
|
33
|
+
return !disableZoom && /*#__PURE__*/jsx("arcgis-zoom", {
|
|
35
34
|
slot: "top-left",
|
|
36
35
|
className: "mb-2"
|
|
37
36
|
});
|
|
38
|
-
}
|
|
37
|
+
}
|
|
39
38
|
|
|
40
39
|
export { Zoom };
|
|
@@ -5,18 +5,16 @@ import Basemap from '@arcgis/core/Basemap';
|
|
|
5
5
|
import Point from '@arcgis/core/geometry/Point';
|
|
6
6
|
import SpatialReference from '@arcgis/core/geometry/SpatialReference';
|
|
7
7
|
import VectorTileLayer from '@arcgis/core/layers/VectorTileLayer';
|
|
8
|
-
import { ArcgisScene, ArcgisMap } from '@arcgis/map-components-react';
|
|
9
8
|
import '@arcgis/map-components/components/arcgis-map';
|
|
10
9
|
import '@arcgis/map-components/components/arcgis-popup';
|
|
11
10
|
import '@arcgis/map-components/components/arcgis-scene';
|
|
12
|
-
import { CalciteButton } from '@esri/calcite-components-react';
|
|
13
11
|
import { getLatitudeLongitude } from '@react-fabric/utilities';
|
|
14
|
-
import { useState, useMemo, useEffect
|
|
12
|
+
import { useState, useMemo, useEffect } from 'react';
|
|
15
13
|
import { BASEMAPS, DEFAULT_VIEWPOINT } from '../constants/index.js';
|
|
14
|
+
import { MapContext } from './context.js';
|
|
16
15
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
var MapProvider = function MapProvider(_ref) {
|
|
17
|
+
function MapProvider(_ref) {
|
|
20
18
|
var children = _ref.children,
|
|
21
19
|
onClick = _ref.onClick,
|
|
22
20
|
_ref$basemaps = _ref.basemaps,
|
|
@@ -61,7 +59,7 @@ var MapProvider = function MapProvider(_ref) {
|
|
|
61
59
|
if (view && onClick) {
|
|
62
60
|
var handleClick = view.on("click", function (event) {
|
|
63
61
|
var _event$mapPoint$latit, _event$mapPoint$longi;
|
|
64
|
-
event.button === 0
|
|
62
|
+
if (event.button === 0) onClick({
|
|
65
63
|
latitude: (_event$mapPoint$latit = event.mapPoint.latitude) !== null && _event$mapPoint$latit !== void 0 ? _event$mapPoint$latit : 0,
|
|
66
64
|
longitude: (_event$mapPoint$longi = event.mapPoint.longitude) !== null && _event$mapPoint$longi !== void 0 ? _event$mapPoint$longi : 0
|
|
67
65
|
});
|
|
@@ -71,10 +69,8 @@ var MapProvider = function MapProvider(_ref) {
|
|
|
71
69
|
};
|
|
72
70
|
}
|
|
73
71
|
}, [view, onClick]);
|
|
74
|
-
var E =
|
|
75
|
-
|
|
76
|
-
}, [is3D, enable3D]);
|
|
77
|
-
return /*#__PURE__*/jsx(Context.Provider, {
|
|
72
|
+
var E = enable3D && is3D ? "arcgis-scene" : "arcgis-map";
|
|
73
|
+
return /*#__PURE__*/jsx(MapContext, {
|
|
78
74
|
value: {
|
|
79
75
|
map: map,
|
|
80
76
|
view: view,
|
|
@@ -86,9 +82,9 @@ var MapProvider = function MapProvider(_ref) {
|
|
|
86
82
|
zoom: zoom
|
|
87
83
|
},
|
|
88
84
|
children: /*#__PURE__*/jsxs(E, {
|
|
89
|
-
|
|
90
|
-
e.target.map
|
|
91
|
-
e.target.view
|
|
85
|
+
onarcgisViewReadyChange: function onarcgisViewReadyChange(e) {
|
|
86
|
+
if (e.target.map) setMap(e.target.map);
|
|
87
|
+
if (e.target.view) setView(e.target.view);
|
|
92
88
|
},
|
|
93
89
|
className: "area-content overflow-hidden",
|
|
94
90
|
basemap: new Basemap({
|
|
@@ -109,7 +105,7 @@ var MapProvider = function MapProvider(_ref) {
|
|
|
109
105
|
spatialReference: new SpatialReference({
|
|
110
106
|
wkid: 3857
|
|
111
107
|
}),
|
|
112
|
-
children: [enable3D && /*#__PURE__*/jsx(
|
|
108
|
+
children: [enable3D && /*#__PURE__*/jsx("calcite-button", {
|
|
113
109
|
appearance: "solid",
|
|
114
110
|
kind: "neutral",
|
|
115
111
|
slot: "top-right",
|
|
@@ -123,9 +119,6 @@ var MapProvider = function MapProvider(_ref) {
|
|
|
123
119
|
}), children]
|
|
124
120
|
})
|
|
125
121
|
});
|
|
126
|
-
}
|
|
127
|
-
var useMap = function useMap() {
|
|
128
|
-
return useContext(Context);
|
|
129
|
-
};
|
|
122
|
+
}
|
|
130
123
|
|
|
131
|
-
export { MapProvider
|
|
124
|
+
export { MapProvider };
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
5
|
import '@arcgis/core/assets/esri/themes/light/main.css';
|
|
6
|
-
import { useIsDark,
|
|
6
|
+
import { useIsDark, Layout } from '@react-fabric/core';
|
|
7
7
|
import { useEffect } from 'react';
|
|
8
|
-
import { MapProvider } from './
|
|
8
|
+
import { MapProvider } from './Provider.js';
|
|
9
9
|
import { jsx } from 'react/jsx-runtime';
|
|
10
10
|
|
|
11
11
|
var _excluded = ["children"];
|
|
12
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t),
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
14
|
var MapViewer = function MapViewer(_ref) {
|
|
15
15
|
var children = _ref.children,
|
|
16
16
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -18,7 +18,7 @@ var MapViewer = function MapViewer(_ref) {
|
|
|
18
18
|
useEffect(function () {
|
|
19
19
|
document.documentElement.classList.toggle("calcite-mode-dark", isDark);
|
|
20
20
|
}, [isDark]);
|
|
21
|
-
return /*#__PURE__*/jsx(
|
|
21
|
+
return /*#__PURE__*/jsx(Layout, {
|
|
22
22
|
className: "relative",
|
|
23
23
|
children: /*#__PURE__*/jsx(MapProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
24
24
|
children: children
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { use, createContext } from 'react';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* React Fabric
|
|
7
|
+
* @version: 1.0.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* The MIT License (MIT)
|
|
11
|
+
* Copyright (c) 2026 Adarsh Pastakia
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
14
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
15
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
16
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
17
|
+
* subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
20
|
+
* portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
23
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
24
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
25
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
var MapContext = /*#__PURE__*/createContext({});
|
|
29
|
+
var useMap = function useMap() {
|
|
30
|
+
return use(MapContext);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { MapContext, useMap };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,73 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Fabric
|
|
3
|
+
* @version 1.0.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2024 Adarsh Pastakia
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
export declare const MAP_PACKAGE = "@react-fabric/map";
|
|
26
|
+
export declare const MAP_VERSION = "1.0.0";
|
|
27
|
+
import { BasemapGallery as _BasemapGallery } from "./tools/BasemapGallery";
|
|
28
|
+
import { Home as _Home } from "./tools/Home";
|
|
29
|
+
import { LayerList as _LayerList } from "./tools/LayerList";
|
|
30
|
+
import { ScaleBar as _ScaleBar } from "./tools/ScaleBar";
|
|
31
|
+
import { Zoom as _Zoom } from "./tools/Zoom";
|
|
32
|
+
import { JsonLayer } from "./layers/Json";
|
|
33
|
+
import { MarkerLayer } from "./layers/Marker";
|
|
34
|
+
import { Fill as _Fill } from "./markers/Fill";
|
|
35
|
+
import { Pin as _Pin } from "./markers/Pin";
|
|
36
|
+
import { useHeatmapRenderer } from "./renderers/Heatmap";
|
|
37
|
+
import { useSimpleRenderer } from "./renderers/Simple";
|
|
1
38
|
export declare const setArcgisAssetsPath: (path: string) => void;
|
|
2
39
|
export { MapViewer } from "./viewer/Viewer";
|
|
3
40
|
export declare namespace MapTools {
|
|
4
|
-
const BasemapGallery:
|
|
5
|
-
const LayerList:
|
|
6
|
-
const Zoom:
|
|
7
|
-
const ScaleBar:
|
|
8
|
-
const Home:
|
|
9
|
-
enableHistory?: boolean;
|
|
10
|
-
}) => false | import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
const BasemapGallery: typeof _BasemapGallery;
|
|
42
|
+
const LayerList: typeof _LayerList;
|
|
43
|
+
const Zoom: typeof _Zoom;
|
|
44
|
+
const ScaleBar: typeof _ScaleBar;
|
|
45
|
+
const Home: typeof _Home;
|
|
11
46
|
}
|
|
12
47
|
export declare namespace MapLayers {
|
|
13
|
-
const Markers:
|
|
14
|
-
|
|
15
|
-
coords: import("@react-fabric/utilities").LngLatLike[];
|
|
16
|
-
color?: string;
|
|
17
|
-
style?: "backward-diagonal" | "cross" | "diagonal-cross" | "forward-diagonal" | "horizontal" | "none" | "solid" | "vertical";
|
|
18
|
-
borderWidth?: string | number;
|
|
19
|
-
borderColor?: string;
|
|
20
|
-
animate?: boolean;
|
|
21
|
-
} & Omit<__esri.GraphicProperties, "geometry" | "symbol">) => null) | (({ coords, style, size, color, path, borderWidth, borderColor, animate, ...props }: {
|
|
22
|
-
coords: import("@react-fabric/utilities").LngLatLike;
|
|
23
|
-
size?: string | number;
|
|
24
|
-
color?: string;
|
|
25
|
-
path?: string;
|
|
26
|
-
style?: "circle" | "square" | "cross" | "x" | "diamond" | "triangle" | ("pin" | "pin-radius" | "marker" | "marker-radius");
|
|
27
|
-
borderWidth?: string | number;
|
|
28
|
-
borderColor?: string;
|
|
29
|
-
animate?: boolean;
|
|
30
|
-
} & Omit<__esri.GraphicProperties, "geometry" | "symbol">) => null), string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<(({ coords, style, color, borderWidth, borderColor, animate, ...props }: {
|
|
31
|
-
coords: import("@react-fabric/utilities").LngLatLike[];
|
|
32
|
-
color?: string;
|
|
33
|
-
style?: "backward-diagonal" | "cross" | "diagonal-cross" | "forward-diagonal" | "horizontal" | "none" | "solid" | "vertical";
|
|
34
|
-
borderWidth?: string | number;
|
|
35
|
-
borderColor?: string;
|
|
36
|
-
animate?: boolean;
|
|
37
|
-
} & Omit<__esri.GraphicProperties, "geometry" | "symbol">) => null) | (({ coords, style, size, color, path, borderWidth, borderColor, animate, ...props }: {
|
|
38
|
-
coords: import("@react-fabric/utilities").LngLatLike;
|
|
39
|
-
size?: string | number;
|
|
40
|
-
color?: string;
|
|
41
|
-
path?: string;
|
|
42
|
-
style?: "circle" | "square" | "cross" | "x" | "diamond" | "triangle" | ("pin" | "pin-radius" | "marker" | "marker-radius");
|
|
43
|
-
borderWidth?: string | number;
|
|
44
|
-
borderColor?: string;
|
|
45
|
-
animate?: boolean;
|
|
46
|
-
} & Omit<__esri.GraphicProperties, "geometry" | "symbol">) => null), string | import("react").JSXElementConstructor<any>>[];
|
|
47
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
48
|
-
const Json: (props: __esri.GeoJSONLayerProperties) => null;
|
|
48
|
+
const Markers: typeof MarkerLayer;
|
|
49
|
+
const Json: typeof JsonLayer;
|
|
49
50
|
}
|
|
50
51
|
export declare namespace MapMarkers {
|
|
51
|
-
const Fill:
|
|
52
|
-
|
|
53
|
-
color?: string;
|
|
54
|
-
style?: "backward-diagonal" | "cross" | "diagonal-cross" | "forward-diagonal" | "horizontal" | "none" | "solid" | "vertical";
|
|
55
|
-
borderWidth?: string | number;
|
|
56
|
-
borderColor?: string;
|
|
57
|
-
animate?: boolean;
|
|
58
|
-
} & Omit<__esri.GraphicProperties, "geometry" | "symbol">) => null;
|
|
59
|
-
const Pin: ({ coords, style, size, color, path, borderWidth, borderColor, animate, ...props }: {
|
|
60
|
-
coords: import("@react-fabric/utilities").LngLatLike;
|
|
61
|
-
size?: string | number;
|
|
62
|
-
color?: string;
|
|
63
|
-
path?: string;
|
|
64
|
-
style?: "circle" | "square" | "cross" | "x" | "diamond" | "triangle" | ("pin" | "pin-radius" | "marker" | "marker-radius");
|
|
65
|
-
borderWidth?: string | number;
|
|
66
|
-
borderColor?: string;
|
|
67
|
-
animate?: boolean;
|
|
68
|
-
} & Omit<__esri.GraphicProperties, "geometry" | "symbol">) => null;
|
|
52
|
+
const Fill: typeof _Fill;
|
|
53
|
+
const Pin: typeof _Pin;
|
|
69
54
|
}
|
|
70
55
|
export declare namespace MapRenderers {
|
|
71
|
-
const useSimple:
|
|
72
|
-
const useHeatmap:
|
|
56
|
+
const useSimple: typeof useSimpleRenderer;
|
|
57
|
+
const useHeatmap: typeof useHeatmapRenderer;
|
|
73
58
|
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { type GeoJSONLayerProperties } from "@arcgis/core/layers/GeoJSONLayer";
|
|
2
|
+
export declare function JsonLayer(props: GeoJSONLayerProperties): null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type GraphicsLayerProperties } from "@arcgis/core/layers/GraphicsLayer";
|
|
2
2
|
import "@arcgis/map-components/components/arcgis-features";
|
|
3
3
|
import { type ReactElement } from "react";
|
|
4
4
|
import { type Fill } from "../markers/Fill";
|
|
@@ -7,8 +7,7 @@ type MarkerChildren = ReactElement<typeof Fill | typeof Pin>;
|
|
|
7
7
|
/**
|
|
8
8
|
* MarkerLayer component for displaying a layer of markers on the map.
|
|
9
9
|
*/
|
|
10
|
-
export declare
|
|
10
|
+
export declare function MarkerLayer({ children, ...props }: Omit<GraphicsLayerProperties, "graphics"> & {
|
|
11
11
|
children?: MarkerChildren | MarkerChildren[];
|
|
12
|
-
})
|
|
13
|
-
export declare const useMarkerLayer: () => GraphicsLayer;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
14
13
|
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { type GraphicProperties } from "@arcgis/core/Graphic";
|
|
1
2
|
import { type LngLatLike } from "@react-fabric/utilities";
|
|
2
3
|
/**
|
|
3
4
|
* Fill graphic for displaying a fill polygon on the map.
|
|
4
5
|
*/
|
|
5
|
-
export declare
|
|
6
|
+
export declare function Fill({ coords, style, color, borderWidth, borderColor, animate, ...props }: {
|
|
6
7
|
coords: LngLatLike[];
|
|
7
8
|
color?: string;
|
|
8
9
|
style?: "backward-diagonal" | "cross" | "diagonal-cross" | "forward-diagonal" | "horizontal" | "none" | "solid" | "vertical";
|
|
9
10
|
borderWidth?: string | number;
|
|
10
11
|
borderColor?: string;
|
|
11
12
|
animate?: boolean;
|
|
12
|
-
} & Omit<
|
|
13
|
+
} & Omit<GraphicProperties, "geometry" | "symbol">): null;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { type GraphicProperties } from "@arcgis/core/Graphic";
|
|
1
2
|
import { type LngLatLike } from "@react-fabric/utilities";
|
|
2
3
|
type Markers = "pin" | "pin-radius" | "marker" | "marker-radius";
|
|
3
4
|
/**
|
|
4
5
|
* Pin graphic for displaying a pin on the map.
|
|
5
6
|
*/
|
|
6
|
-
export declare
|
|
7
|
+
export declare function Pin({ coords, style, size, color, path, borderWidth, borderColor, animate, ...props }: {
|
|
7
8
|
coords: LngLatLike;
|
|
8
9
|
size?: string | number;
|
|
9
10
|
color?: string;
|
|
@@ -12,5 +13,5 @@ export declare const Pin: ({ coords, style, size, color, path, borderWidth, bord
|
|
|
12
13
|
borderWidth?: string | number;
|
|
13
14
|
borderColor?: string;
|
|
14
15
|
animate?: boolean;
|
|
15
|
-
} & Omit<
|
|
16
|
+
} & Omit<GraphicProperties, "geometry" | "symbol">): null;
|
|
16
17
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import HeatmapRenderer from "@arcgis/core/renderers/HeatmapRenderer";
|
|
1
|
+
import HeatmapRenderer, { type HeatmapRendererProperties } from "@arcgis/core/renderers/HeatmapRenderer";
|
|
2
2
|
interface Props {
|
|
3
3
|
/**
|
|
4
4
|
* Field name to be used for heatmap intensity
|
|
@@ -12,8 +12,8 @@ interface Props {
|
|
|
12
12
|
* [color1, color2, color3]: creates a multi-stop gradient color1 to color2 to color3
|
|
13
13
|
*/
|
|
14
14
|
colors?: string[];
|
|
15
|
-
minDensity?:
|
|
16
|
-
maxDensity?:
|
|
15
|
+
minDensity?: HeatmapRendererProperties["minDensity"];
|
|
16
|
+
maxDensity?: HeatmapRendererProperties["maxDensity"];
|
|
17
17
|
}
|
|
18
|
-
export declare
|
|
18
|
+
export declare function useHeatmapRenderer(props?: Props): HeatmapRenderer;
|
|
19
19
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import HeatmapRenderer from "@arcgis/core/renderers/HeatmapRenderer";
|
|
1
|
+
import HeatmapRenderer, { type HeatmapRendererProperties } from "@arcgis/core/renderers/HeatmapRenderer";
|
|
2
2
|
export interface Props {
|
|
3
3
|
/**
|
|
4
4
|
* Field name to be used for heatmap intensity
|
|
@@ -12,7 +12,7 @@ export interface Props {
|
|
|
12
12
|
* [color1, color2, color3]: creates a multi-stop gradient color1 to color2 to color3
|
|
13
13
|
*/
|
|
14
14
|
colors?: string[];
|
|
15
|
-
minDensity?:
|
|
16
|
-
maxDensity?:
|
|
15
|
+
minDensity?: HeatmapRendererProperties["minDensity"];
|
|
16
|
+
maxDensity?: HeatmapRendererProperties["maxDensity"];
|
|
17
17
|
}
|
|
18
|
-
export declare
|
|
18
|
+
export declare function useHeatmapRenderer(props?: Props): HeatmapRenderer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import "@arcgis/map-components/components/arcgis-basemap-gallery";
|
|
2
2
|
import "@arcgis/map-components/components/arcgis-basemap-layer-list";
|
|
3
3
|
import "@arcgis/map-components/components/arcgis-expand";
|
|
4
|
-
export declare
|
|
4
|
+
export declare function BasemapGallery(): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "@
|
|
2
|
-
export declare
|
|
1
|
+
import "@esri/calcite-components/components/calcite-button";
|
|
2
|
+
export declare function Home({ enableHistory }: {
|
|
3
3
|
enableHistory?: boolean;
|
|
4
|
-
})
|
|
4
|
+
}): false | import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import "@arcgis/map-components/components/arcgis-scale-bar";
|
|
2
|
-
export declare
|
|
2
|
+
export declare function ScaleBar(): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import "@arcgis/map-components/components/arcgis-zoom";
|
|
2
|
-
export declare
|
|
2
|
+
export declare function Zoom(): false | import("react").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "@arcgis/map-components/components/arcgis-map";
|
|
2
|
+
import "@arcgis/map-components/components/arcgis-popup";
|
|
3
|
+
import "@arcgis/map-components/components/arcgis-scene";
|
|
4
|
+
import { type MapViewerProps } from "../types";
|
|
5
|
+
export declare function MapProvider({ children, onClick, basemaps, center, zoom, enable3D, disableDrag, disableZoom, }: MapViewerProps): import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "@arcgis/core/assets/esri/themes/light/main.css";
|
|
2
2
|
import { type MapViewerProps } from "../types";
|
|
3
|
-
export declare const MapViewer: ({ children, ...props }: MapViewerProps) => import("react
|
|
3
|
+
export declare const MapViewer: ({ children, ...props }: MapViewerProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type Map from "@arcgis/core/Map";
|
|
2
|
+
import type MapView from "@arcgis/core/views/MapView";
|
|
3
|
+
import type SceneView from "@arcgis/core/views/SceneView";
|
|
4
|
+
import type { LngLatLike } from "@react-fabric/utilities";
|
|
5
|
+
import type { FabricBaseMap } from "../types";
|
|
6
|
+
interface ContextType {
|
|
7
|
+
map?: Map | null;
|
|
8
|
+
view?: MapView | SceneView;
|
|
9
|
+
disableDrag?: boolean;
|
|
10
|
+
disableZoom?: boolean;
|
|
11
|
+
basemaps: FabricBaseMap[];
|
|
12
|
+
center: LngLatLike;
|
|
13
|
+
zoom: number;
|
|
14
|
+
is3D: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const MapContext: import("react").Context<ContextType>;
|
|
17
|
+
export declare const useMap: () => ContextType;
|
|
18
|
+
export {};
|