@react-fabric/map 1.0.0-beta.62 → 1.0.0-beta.63
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/layers/Json.js +3 -3
- package/dist/cjs/layers/Marker.js +4 -8
- package/dist/cjs/markers/Fill.js +6 -7
- package/dist/cjs/markers/Pin.js +4 -4
- package/dist/cjs/markers/context.js +34 -0
- package/dist/cjs/renderers/Heatmap.js +7 -7
- package/dist/cjs/tools/BasemapGallery.js +2 -2
- package/dist/cjs/tools/Home.js +4 -4
- package/dist/cjs/tools/Zoom.js +2 -2
- package/dist/cjs/viewer/{Context.js → Provider.js} +2 -6
- package/dist/cjs/viewer/Viewer.js +2 -2
- package/dist/cjs/viewer/context.js +34 -0
- package/dist/esm/layers/Json.js +2 -2
- package/dist/esm/layers/Marker.js +4 -7
- package/dist/esm/markers/Fill.js +4 -5
- package/dist/esm/markers/Pin.js +2 -2
- package/dist/esm/markers/context.js +33 -0
- package/dist/esm/renderers/Heatmap.js +7 -7
- package/dist/esm/tools/BasemapGallery.js +1 -1
- package/dist/esm/tools/Home.js +3 -3
- package/dist/esm/tools/Zoom.js +1 -1
- package/dist/esm/viewer/{Context.js → Provider.js} +4 -7
- package/dist/esm/viewer/Viewer.js +1 -1
- package/dist/esm/viewer/context.js +33 -0
- package/dist/types/index.d.ts +10 -10
- package/dist/types/layers/Json.d.ts +2 -1
- package/dist/types/layers/Marker.d.ts +2 -3
- package/dist/types/markers/Fill.d.ts +2 -1
- package/dist/types/markers/Pin.d.ts +2 -1
- package/dist/types/markers/context.d.ts +3 -0
- package/dist/types/renderers/Cluster.d.ts +3 -3
- package/dist/types/renderers/Heatmap.d.ts +3 -3
- package/dist/types/viewer/Provider.d.ts +5 -0
- package/dist/types/viewer/context.d.ts +25 -0
- package/package.json +13 -13
- package/src/layers/Json.tsx +4 -4
- package/src/layers/Marker.tsx +6 -19
- package/src/markers/Fill.tsx +8 -17
- package/src/markers/Pin.tsx +5 -12
- package/src/markers/context.ts +29 -0
- package/src/renderers/Cluster.tsx +10 -14
- package/src/renderers/Heatmap.tsx +10 -14
- package/src/renderers/Simple.tsx +1 -1
- package/src/tools/BasemapGallery.tsx +4 -22
- package/src/tools/Home.tsx +3 -11
- package/src/tools/Zoom.tsx +1 -1
- package/src/viewer/{Context.tsx → Provider.tsx} +14 -29
- package/src/viewer/Viewer.tsx +1 -1
- package/src/viewer/context.ts +42 -0
- package/dist/types/viewer/Context.d.ts +0 -16
package/dist/cjs/layers/Json.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
4
|
var GeoJSONLayer = require('@arcgis/core/layers/GeoJSONLayer');
|
|
5
5
|
var react = require('react');
|
|
6
|
-
var
|
|
6
|
+
var context = require('../viewer/context.js');
|
|
7
7
|
|
|
8
8
|
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; }
|
|
9
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).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; }
|
|
10
10
|
var JsonLayer = function JsonLayer(props) {
|
|
11
|
-
var _useMap =
|
|
11
|
+
var _useMap = context.useMap(),
|
|
12
12
|
map = _useMap.map,
|
|
13
13
|
view = _useMap.view;
|
|
14
14
|
var layer = react.useMemo(function () {
|
|
@@ -17,7 +17,7 @@ var JsonLayer = function JsonLayer(props) {
|
|
|
17
17
|
react.useEffect(function () {
|
|
18
18
|
if (map && view) {
|
|
19
19
|
void layer.when(function () {
|
|
20
|
-
void view.goTo(layer.fullExtent);
|
|
20
|
+
void (layer.fullExtent && view.goTo(layer.fullExtent));
|
|
21
21
|
});
|
|
22
22
|
map.add(layer);
|
|
23
23
|
return function () {
|
|
@@ -4,18 +4,18 @@ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProp
|
|
|
4
4
|
var GraphicsLayer = require('@arcgis/core/layers/GraphicsLayer');
|
|
5
5
|
require('@arcgis/map-components/components/arcgis-features');
|
|
6
6
|
var react = require('react');
|
|
7
|
-
var
|
|
7
|
+
var context$1 = require('../markers/context.js');
|
|
8
|
+
var context = require('../viewer/context.js');
|
|
8
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
10
|
|
|
10
11
|
var _excluded = ["children"];
|
|
11
|
-
var MarkerContext = /*#__PURE__*/react.createContext(null);
|
|
12
12
|
/**
|
|
13
13
|
* MarkerLayer component for displaying a layer of markers on the map.
|
|
14
14
|
*/
|
|
15
15
|
var MarkerLayer = function MarkerLayer(_ref) {
|
|
16
16
|
var children = _ref.children,
|
|
17
17
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
|
-
var _useMap =
|
|
18
|
+
var _useMap = context.useMap(),
|
|
19
19
|
map = _useMap.map,
|
|
20
20
|
view = _useMap.view;
|
|
21
21
|
var layer = react.useMemo(function () {
|
|
@@ -34,14 +34,10 @@ var MarkerLayer = function MarkerLayer(_ref) {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
}, [layer, map, view]);
|
|
37
|
-
return /*#__PURE__*/jsxRuntime.jsx(MarkerContext.Provider, {
|
|
37
|
+
return /*#__PURE__*/jsxRuntime.jsx(context$1.MarkerContext.Provider, {
|
|
38
38
|
value: layer,
|
|
39
39
|
children: children
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
|
-
var useMarkerLayer = function useMarkerLayer() {
|
|
43
|
-
return react.useContext(MarkerContext);
|
|
44
|
-
};
|
|
45
42
|
|
|
46
43
|
exports.MarkerLayer = MarkerLayer;
|
|
47
|
-
exports.useMarkerLayer = useMarkerLayer;
|
package/dist/cjs/markers/Fill.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
4
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
4
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
6
5
|
var Polygon = require('@arcgis/core/geometry/Polygon');
|
|
7
6
|
var Graphic = require('@arcgis/core/Graphic');
|
|
8
7
|
var SimpleFillSymbol = require('@arcgis/core/symbols/SimpleFillSymbol');
|
|
9
8
|
var utilities = require('@react-fabric/utilities');
|
|
9
|
+
var chroma = require('chroma-js');
|
|
10
10
|
var react = require('react');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var Context = require('../viewer/Context.js');
|
|
11
|
+
var context$1 = require('../viewer/context.js');
|
|
12
|
+
var context = require('./context.js');
|
|
14
13
|
|
|
15
14
|
var _excluded = ["coords", "style", "color", "borderWidth", "borderColor", "animate"];
|
|
16
15
|
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; }
|
|
@@ -29,8 +28,8 @@ var Fill = function Fill(_ref) {
|
|
|
29
28
|
borderColor = _ref.borderColor,
|
|
30
29
|
animate = _ref.animate,
|
|
31
30
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
-
var layer =
|
|
33
|
-
var _useMap =
|
|
31
|
+
var layer = context.useMarkerLayer();
|
|
32
|
+
var _useMap = context$1.useMap(),
|
|
34
33
|
is3D = _useMap.is3D;
|
|
35
34
|
var graphic = react.useMemo(function () {
|
|
36
35
|
return new Graphic(_objectSpread({
|
|
@@ -61,7 +60,7 @@ var Fill = function Fill(_ref) {
|
|
|
61
60
|
if (sat >= 0.9) up = -0.1;
|
|
62
61
|
if (sat <= 0.1) up = 0.1;
|
|
63
62
|
sat += up;
|
|
64
|
-
symbol.color =
|
|
63
|
+
symbol.color = chroma(_color).darken(sat).rgba();
|
|
65
64
|
requestAnimationFrame(function () {
|
|
66
65
|
graphic.symbol = symbol.clone();
|
|
67
66
|
});
|
package/dist/cjs/markers/Pin.js
CHANGED
|
@@ -7,8 +7,8 @@ var Graphic = require('@arcgis/core/Graphic');
|
|
|
7
7
|
var SimpleMarkerSymbol = require('@arcgis/core/symbols/SimpleMarkerSymbol');
|
|
8
8
|
var utilities = require('@react-fabric/utilities');
|
|
9
9
|
var react = require('react');
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var context$1 = require('../viewer/context.js');
|
|
11
|
+
var context = require('./context.js');
|
|
12
12
|
|
|
13
13
|
var _excluded = ["coords", "style", "size", "color", "path", "borderWidth", "borderColor", "animate"];
|
|
14
14
|
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; }
|
|
@@ -36,8 +36,8 @@ var Pin = function Pin(_ref) {
|
|
|
36
36
|
borderColor = _ref.borderColor,
|
|
37
37
|
animate = _ref.animate,
|
|
38
38
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
39
|
-
var layer =
|
|
40
|
-
var _useMap =
|
|
39
|
+
var layer = context.useMarkerLayer();
|
|
40
|
+
var _useMap = context$1.useMap(),
|
|
41
41
|
is3D = _useMap.is3D;
|
|
42
42
|
var graphic = react.useMemo(function () {
|
|
43
43
|
return new Graphic(_objectSpread({
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('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 MarkerContext = /*#__PURE__*/react.createContext(null);
|
|
29
|
+
var useMarkerLayer = function useMarkerLayer() {
|
|
30
|
+
return react.useContext(MarkerContext);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.MarkerContext = MarkerContext;
|
|
34
|
+
exports.useMarkerLayer = useMarkerLayer;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
4
4
|
var HeatmapRenderer = require('@arcgis/core/renderers/HeatmapRenderer');
|
|
5
|
-
var
|
|
5
|
+
var chroma = require('chroma-js');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
|
|
8
8
|
var useHeatmapRenderer = function useHeatmapRenderer(props) {
|
|
@@ -12,14 +12,14 @@ var useHeatmapRenderer = function useHeatmapRenderer(props) {
|
|
|
12
12
|
var colorMid = "#FF8C00FF";
|
|
13
13
|
var colorLow = "#FF3300FF";
|
|
14
14
|
if ((props === null || props === void 0 || (_props$colors = props.colors) === null || _props$colors === void 0 ? void 0 : _props$colors.length) === 1) {
|
|
15
|
-
colorHigh =
|
|
16
|
-
colorLow =
|
|
17
|
-
colorMid =
|
|
15
|
+
colorHigh = chroma(props.colors[0]).luminance(0.85, "oklab").hex();
|
|
16
|
+
colorLow = chroma(props.colors[0]).luminance(0.25, "oklab").hex();
|
|
17
|
+
colorMid = chroma.mix(colorHigh, colorLow, 0.5).hex();
|
|
18
18
|
}
|
|
19
19
|
if ((props === null || props === void 0 || (_props$colors2 = props.colors) === null || _props$colors2 === void 0 ? void 0 : _props$colors2.length) === 2) {
|
|
20
20
|
colorHigh = props.colors[0];
|
|
21
21
|
colorLow = props.colors[1];
|
|
22
|
-
colorMid =
|
|
22
|
+
colorMid = chroma.mix(colorHigh, colorLow, 0.5).hex();
|
|
23
23
|
}
|
|
24
24
|
if ((props === null || props === void 0 || (_props$colors3 = props.colors) === null || _props$colors3 === void 0 ? void 0 : _props$colors3.length) === 3) {
|
|
25
25
|
colorHigh = props.colors[0];
|
|
@@ -36,14 +36,14 @@ var useHeatmapRenderer = function useHeatmapRenderer(props) {
|
|
|
36
36
|
}, function (_, i) {
|
|
37
37
|
return {
|
|
38
38
|
ratio: (i + 1) / 12,
|
|
39
|
-
color:
|
|
39
|
+
color: chroma.mix(colorLow, colorMid, i / 6).hex()
|
|
40
40
|
};
|
|
41
41
|
})), _toConsumableArray(Array.from({
|
|
42
42
|
length: 6
|
|
43
43
|
}, function (_, i) {
|
|
44
44
|
return {
|
|
45
45
|
ratio: (i + 6) / 12,
|
|
46
|
-
color:
|
|
46
|
+
color: chroma.mix(colorMid, colorHigh, i / 6).hex()
|
|
47
47
|
};
|
|
48
48
|
})));
|
|
49
49
|
return new HeatmapRenderer({
|
|
@@ -7,7 +7,7 @@ var mapComponentsReact = require('@arcgis/map-components-react');
|
|
|
7
7
|
require('@arcgis/map-components/components/arcgis-basemap-gallery');
|
|
8
8
|
require('@arcgis/map-components/components/arcgis-basemap-layer-list');
|
|
9
9
|
require('@arcgis/map-components/components/arcgis-expand');
|
|
10
|
-
var
|
|
10
|
+
var context = require('../viewer/context.js');
|
|
11
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
12
12
|
|
|
13
13
|
/*
|
|
@@ -35,7 +35,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
35
35
|
|
|
36
36
|
var BasemapGallery = function BasemapGallery() {
|
|
37
37
|
var _map$basemap$baseLaye, _map$basemap;
|
|
38
|
-
var _useMap =
|
|
38
|
+
var _useMap = context.useMap(),
|
|
39
39
|
basemaps = _useMap.basemaps,
|
|
40
40
|
map = _useMap.map;
|
|
41
41
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
package/dist/cjs/tools/Home.js
CHANGED
|
@@ -9,7 +9,7 @@ require('@arcgis/map-components/components/arcgis-placement');
|
|
|
9
9
|
var calciteComponentsReact = require('@esri/calcite-components-react');
|
|
10
10
|
var utilities = require('@react-fabric/utilities');
|
|
11
11
|
var react = require('react');
|
|
12
|
-
var
|
|
12
|
+
var context = require('../viewer/context.js');
|
|
13
13
|
var jsxRuntime = require('react/jsx-runtime');
|
|
14
14
|
|
|
15
15
|
function _interopNamespaceDefault(e) {
|
|
@@ -33,7 +33,7 @@ var reactiveUtils__namespace = /*#__PURE__*/_interopNamespaceDefault(reactiveUti
|
|
|
33
33
|
|
|
34
34
|
var Home = function Home(_ref) {
|
|
35
35
|
var enableHistory = _ref.enableHistory;
|
|
36
|
-
var _useMap =
|
|
36
|
+
var _useMap = context.useMap(),
|
|
37
37
|
map = _useMap.map,
|
|
38
38
|
view = _useMap.view,
|
|
39
39
|
disableDrag = _useMap.disableDrag,
|
|
@@ -84,7 +84,7 @@ var Home = function Home(_ref) {
|
|
|
84
84
|
}, [history]);
|
|
85
85
|
var gotoHome = react.useCallback(function () {
|
|
86
86
|
if (view) {
|
|
87
|
-
var
|
|
87
|
+
var _view$tileInfo;
|
|
88
88
|
var extent;
|
|
89
89
|
map === null || map === void 0 || map.layers.forEach(function (layer) {
|
|
90
90
|
if (layer.visible && layer.fullExtent) {
|
|
@@ -95,7 +95,7 @@ var Home = function Home(_ref) {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
|
-
void view.goTo(
|
|
98
|
+
void view.goTo(extent !== null && extent !== void 0 ? extent : new Viewpoint({
|
|
99
99
|
scale: (_view$tileInfo = view.tileInfo) === null || _view$tileInfo === void 0 ? void 0 : _view$tileInfo.zoomToScale(zoom),
|
|
100
100
|
targetGeometry: new Point(utilities.getLatitudeLongitude(center))
|
|
101
101
|
}));
|
package/dist/cjs/tools/Zoom.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var mapComponentsReact = require('@arcgis/map-components-react');
|
|
4
4
|
require('@arcgis/map-components/components/arcgis-zoom');
|
|
5
|
-
var
|
|
5
|
+
var context = require('../viewer/context.js');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
|
|
8
8
|
/*
|
|
@@ -29,7 +29,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
var Zoom = function Zoom() {
|
|
32
|
-
var _useMap =
|
|
32
|
+
var _useMap = context.useMap(),
|
|
33
33
|
disableZoom = _useMap.disableZoom;
|
|
34
34
|
return !disableZoom && /*#__PURE__*/jsxRuntime.jsx(mapComponentsReact.ArcgisZoom, {
|
|
35
35
|
slot: "top-left",
|
|
@@ -13,9 +13,9 @@ var calciteComponentsReact = require('@esri/calcite-components-react');
|
|
|
13
13
|
var utilities = require('@react-fabric/utilities');
|
|
14
14
|
var react = require('react');
|
|
15
15
|
var index = require('../constants/index.js');
|
|
16
|
+
var context = require('./context.js');
|
|
16
17
|
var jsxRuntime = require('react/jsx-runtime');
|
|
17
18
|
|
|
18
|
-
var Context = /*#__PURE__*/react.createContext({});
|
|
19
19
|
var MapProvider = function MapProvider(_ref) {
|
|
20
20
|
var children = _ref.children,
|
|
21
21
|
onClick = _ref.onClick,
|
|
@@ -74,7 +74,7 @@ var MapProvider = function MapProvider(_ref) {
|
|
|
74
74
|
var E = react.useMemo(function () {
|
|
75
75
|
return enable3D && is3D ? mapComponentsReact.ArcgisScene : mapComponentsReact.ArcgisMap;
|
|
76
76
|
}, [is3D, enable3D]);
|
|
77
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
77
|
+
return /*#__PURE__*/jsxRuntime.jsx(context.MapContext.Provider, {
|
|
78
78
|
value: {
|
|
79
79
|
map: map,
|
|
80
80
|
view: view,
|
|
@@ -124,9 +124,5 @@ var MapProvider = function MapProvider(_ref) {
|
|
|
124
124
|
})
|
|
125
125
|
});
|
|
126
126
|
};
|
|
127
|
-
var useMap = function useMap() {
|
|
128
|
-
return react.useContext(Context);
|
|
129
|
-
};
|
|
130
127
|
|
|
131
128
|
exports.MapProvider = MapProvider;
|
|
132
|
-
exports.useMap = useMap;
|
|
@@ -5,7 +5,7 @@ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProp
|
|
|
5
5
|
require('@arcgis/core/assets/esri/themes/light/main.css');
|
|
6
6
|
var core = require('@react-fabric/core');
|
|
7
7
|
var react = require('react');
|
|
8
|
-
var
|
|
8
|
+
var Provider = require('./Provider.js');
|
|
9
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
10
|
|
|
11
11
|
var _excluded = ["children"];
|
|
@@ -20,7 +20,7 @@ var MapViewer = function MapViewer(_ref) {
|
|
|
20
20
|
}, [isDark]);
|
|
21
21
|
return /*#__PURE__*/jsxRuntime.jsx(core.Section, {
|
|
22
22
|
className: "relative",
|
|
23
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
23
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Provider.MapProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
24
24
|
children: children
|
|
25
25
|
}))
|
|
26
26
|
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('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__*/react.createContext({});
|
|
29
|
+
var useMap = function useMap() {
|
|
30
|
+
return react.useContext(MapContext);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.MapContext = MapContext;
|
|
34
|
+
exports.useMap = useMap;
|
package/dist/esm/layers/Json.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import GeoJSONLayer from '@arcgis/core/layers/GeoJSONLayer';
|
|
5
5
|
import { useMemo, useEffect } from 'react';
|
|
6
|
-
import { useMap } from '../viewer/
|
|
6
|
+
import { useMap } from '../viewer/context.js';
|
|
7
7
|
|
|
8
8
|
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; }
|
|
9
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).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; }
|
|
@@ -17,7 +17,7 @@ var JsonLayer = function JsonLayer(props) {
|
|
|
17
17
|
useEffect(function () {
|
|
18
18
|
if (map && view) {
|
|
19
19
|
void layer.when(function () {
|
|
20
|
-
void view.goTo(layer.fullExtent);
|
|
20
|
+
void (layer.fullExtent && view.goTo(layer.fullExtent));
|
|
21
21
|
});
|
|
22
22
|
map.add(layer);
|
|
23
23
|
return function () {
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
4
|
import GraphicsLayer from '@arcgis/core/layers/GraphicsLayer';
|
|
5
5
|
import '@arcgis/map-components/components/arcgis-features';
|
|
6
|
-
import { useMemo, useEffect
|
|
7
|
-
import {
|
|
6
|
+
import { useMemo, useEffect } from 'react';
|
|
7
|
+
import { MarkerContext } from '../markers/context.js';
|
|
8
|
+
import { useMap } from '../viewer/context.js';
|
|
8
9
|
import { jsx } from 'react/jsx-runtime';
|
|
9
10
|
|
|
10
11
|
var _excluded = ["children"];
|
|
11
|
-
var MarkerContext = /*#__PURE__*/createContext(null);
|
|
12
12
|
/**
|
|
13
13
|
* MarkerLayer component for displaying a layer of markers on the map.
|
|
14
14
|
*/
|
|
@@ -39,8 +39,5 @@ var MarkerLayer = function MarkerLayer(_ref) {
|
|
|
39
39
|
children: children
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
|
-
var useMarkerLayer = function useMarkerLayer() {
|
|
43
|
-
return useContext(MarkerContext);
|
|
44
|
-
};
|
|
45
42
|
|
|
46
|
-
export { MarkerLayer
|
|
43
|
+
export { MarkerLayer };
|
package/dist/esm/markers/Fill.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
4
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
5
4
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
6
5
|
import Polygon from '@arcgis/core/geometry/Polygon';
|
|
7
6
|
import Graphic from '@arcgis/core/Graphic';
|
|
8
7
|
import SimpleFillSymbol from '@arcgis/core/symbols/SimpleFillSymbol';
|
|
9
8
|
import { convertLatLng } from '@react-fabric/utilities';
|
|
9
|
+
import chroma from 'chroma-js';
|
|
10
10
|
import { useMemo, useEffect } from 'react';
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import { useMap } from '../viewer/Context.js';
|
|
11
|
+
import { useMap } from '../viewer/context.js';
|
|
12
|
+
import { useMarkerLayer } from './context.js';
|
|
14
13
|
|
|
15
14
|
var _excluded = ["coords", "style", "color", "borderWidth", "borderColor", "animate"];
|
|
16
15
|
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; }
|
|
@@ -61,7 +60,7 @@ var Fill = function Fill(_ref) {
|
|
|
61
60
|
if (sat >= 0.9) up = -0.1;
|
|
62
61
|
if (sat <= 0.1) up = 0.1;
|
|
63
62
|
sat += up;
|
|
64
|
-
symbol.color =
|
|
63
|
+
symbol.color = chroma(_color).darken(sat).rgba();
|
|
65
64
|
requestAnimationFrame(function () {
|
|
66
65
|
graphic.symbol = symbol.clone();
|
|
67
66
|
});
|
package/dist/esm/markers/Pin.js
CHANGED
|
@@ -7,8 +7,8 @@ import Graphic from '@arcgis/core/Graphic';
|
|
|
7
7
|
import SimpleMarkerSymbol from '@arcgis/core/symbols/SimpleMarkerSymbol';
|
|
8
8
|
import { getLatitudeLongitude } from '@react-fabric/utilities';
|
|
9
9
|
import { useMemo, useEffect } from 'react';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { useMap } from '../viewer/context.js';
|
|
11
|
+
import { useMarkerLayer } from './context.js';
|
|
12
12
|
|
|
13
13
|
var _excluded = ["coords", "style", "size", "color", "path", "borderWidth", "borderColor", "animate"];
|
|
14
14
|
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; }
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } 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 MarkerContext = /*#__PURE__*/createContext(null);
|
|
29
|
+
var useMarkerLayer = function useMarkerLayer() {
|
|
30
|
+
return useContext(MarkerContext);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { MarkerContext, useMarkerLayer };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
4
4
|
import HeatmapRenderer from '@arcgis/core/renderers/HeatmapRenderer';
|
|
5
|
-
import
|
|
5
|
+
import chroma from 'chroma-js';
|
|
6
6
|
import { useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
var useHeatmapRenderer = function useHeatmapRenderer(props) {
|
|
@@ -12,14 +12,14 @@ var useHeatmapRenderer = function useHeatmapRenderer(props) {
|
|
|
12
12
|
var colorMid = "#FF8C00FF";
|
|
13
13
|
var colorLow = "#FF3300FF";
|
|
14
14
|
if ((props === null || props === void 0 || (_props$colors = props.colors) === null || _props$colors === void 0 ? void 0 : _props$colors.length) === 1) {
|
|
15
|
-
colorHigh =
|
|
16
|
-
colorLow =
|
|
17
|
-
colorMid =
|
|
15
|
+
colorHigh = chroma(props.colors[0]).luminance(0.85, "oklab").hex();
|
|
16
|
+
colorLow = chroma(props.colors[0]).luminance(0.25, "oklab").hex();
|
|
17
|
+
colorMid = chroma.mix(colorHigh, colorLow, 0.5).hex();
|
|
18
18
|
}
|
|
19
19
|
if ((props === null || props === void 0 || (_props$colors2 = props.colors) === null || _props$colors2 === void 0 ? void 0 : _props$colors2.length) === 2) {
|
|
20
20
|
colorHigh = props.colors[0];
|
|
21
21
|
colorLow = props.colors[1];
|
|
22
|
-
colorMid =
|
|
22
|
+
colorMid = chroma.mix(colorHigh, colorLow, 0.5).hex();
|
|
23
23
|
}
|
|
24
24
|
if ((props === null || props === void 0 || (_props$colors3 = props.colors) === null || _props$colors3 === void 0 ? void 0 : _props$colors3.length) === 3) {
|
|
25
25
|
colorHigh = props.colors[0];
|
|
@@ -36,14 +36,14 @@ var useHeatmapRenderer = function useHeatmapRenderer(props) {
|
|
|
36
36
|
}, function (_, i) {
|
|
37
37
|
return {
|
|
38
38
|
ratio: (i + 1) / 12,
|
|
39
|
-
color:
|
|
39
|
+
color: chroma.mix(colorLow, colorMid, i / 6).hex()
|
|
40
40
|
};
|
|
41
41
|
})), _toConsumableArray(Array.from({
|
|
42
42
|
length: 6
|
|
43
43
|
}, function (_, i) {
|
|
44
44
|
return {
|
|
45
45
|
ratio: (i + 6) / 12,
|
|
46
|
-
color:
|
|
46
|
+
color: chroma.mix(colorMid, colorHigh, i / 6).hex()
|
|
47
47
|
};
|
|
48
48
|
})));
|
|
49
49
|
return new HeatmapRenderer({
|
|
@@ -7,7 +7,7 @@ import { ArcgisExpand, ArcgisBasemapGallery, ArcgisBasemapLayerList } from '@arc
|
|
|
7
7
|
import '@arcgis/map-components/components/arcgis-basemap-gallery';
|
|
8
8
|
import '@arcgis/map-components/components/arcgis-basemap-layer-list';
|
|
9
9
|
import '@arcgis/map-components/components/arcgis-expand';
|
|
10
|
-
import { useMap } from '../viewer/
|
|
10
|
+
import { useMap } from '../viewer/context.js';
|
|
11
11
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
12
12
|
|
|
13
13
|
/*
|
package/dist/esm/tools/Home.js
CHANGED
|
@@ -9,7 +9,7 @@ import '@arcgis/map-components/components/arcgis-placement';
|
|
|
9
9
|
import { CalciteButton } from '@esri/calcite-components-react';
|
|
10
10
|
import { debounce, getLatitudeLongitude } from '@react-fabric/utilities';
|
|
11
11
|
import { useRef, useState, useEffect, useCallback } from 'react';
|
|
12
|
-
import { useMap } from '../viewer/
|
|
12
|
+
import { useMap } from '../viewer/context.js';
|
|
13
13
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
14
14
|
|
|
15
15
|
var Home = function Home(_ref) {
|
|
@@ -65,7 +65,7 @@ var Home = function Home(_ref) {
|
|
|
65
65
|
}, [history]);
|
|
66
66
|
var gotoHome = useCallback(function () {
|
|
67
67
|
if (view) {
|
|
68
|
-
var
|
|
68
|
+
var _view$tileInfo;
|
|
69
69
|
var extent;
|
|
70
70
|
map === null || map === void 0 || map.layers.forEach(function (layer) {
|
|
71
71
|
if (layer.visible && layer.fullExtent) {
|
|
@@ -76,7 +76,7 @@ var Home = function Home(_ref) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
|
-
void view.goTo(
|
|
79
|
+
void view.goTo(extent !== null && extent !== void 0 ? extent : new Viewpoint({
|
|
80
80
|
scale: (_view$tileInfo = view.tileInfo) === null || _view$tileInfo === void 0 ? void 0 : _view$tileInfo.zoomToScale(zoom),
|
|
81
81
|
targetGeometry: new Point(getLatitudeLongitude(center))
|
|
82
82
|
}));
|
package/dist/esm/tools/Zoom.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { ArcgisZoom } from '@arcgis/map-components-react';
|
|
4
4
|
import '@arcgis/map-components/components/arcgis-zoom';
|
|
5
|
-
import { useMap } from '../viewer/
|
|
5
|
+
import { useMap } from '../viewer/context.js';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
8
|
/*
|
|
@@ -11,11 +11,11 @@ import '@arcgis/map-components/components/arcgis-popup';
|
|
|
11
11
|
import '@arcgis/map-components/components/arcgis-scene';
|
|
12
12
|
import { CalciteButton } from '@esri/calcite-components-react';
|
|
13
13
|
import { getLatitudeLongitude } from '@react-fabric/utilities';
|
|
14
|
-
import { useState, useMemo, useEffect
|
|
14
|
+
import { useState, useMemo, useEffect } from 'react';
|
|
15
15
|
import { BASEMAPS, DEFAULT_VIEWPOINT } from '../constants/index.js';
|
|
16
|
+
import { MapContext } from './context.js';
|
|
16
17
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
17
18
|
|
|
18
|
-
var Context = /*#__PURE__*/createContext({});
|
|
19
19
|
var MapProvider = function MapProvider(_ref) {
|
|
20
20
|
var children = _ref.children,
|
|
21
21
|
onClick = _ref.onClick,
|
|
@@ -74,7 +74,7 @@ var MapProvider = function MapProvider(_ref) {
|
|
|
74
74
|
var E = useMemo(function () {
|
|
75
75
|
return enable3D && is3D ? ArcgisScene : ArcgisMap;
|
|
76
76
|
}, [is3D, enable3D]);
|
|
77
|
-
return /*#__PURE__*/jsx(
|
|
77
|
+
return /*#__PURE__*/jsx(MapContext.Provider, {
|
|
78
78
|
value: {
|
|
79
79
|
map: map,
|
|
80
80
|
view: view,
|
|
@@ -124,8 +124,5 @@ var MapProvider = function MapProvider(_ref) {
|
|
|
124
124
|
})
|
|
125
125
|
});
|
|
126
126
|
};
|
|
127
|
-
var useMap = function useMap() {
|
|
128
|
-
return useContext(Context);
|
|
129
|
-
};
|
|
130
127
|
|
|
131
|
-
export { MapProvider
|
|
128
|
+
export { MapProvider };
|
|
@@ -5,7 +5,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
5
5
|
import '@arcgis/core/assets/esri/themes/light/main.css';
|
|
6
6
|
import { useIsDark, Section } 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"];
|