@react-fabric/map 1.0.0-beta.58

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.
Files changed (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -0
  3. package/css/styles.css +40 -0
  4. package/dist/cjs/constants/index.js +49 -0
  5. package/dist/cjs/index.js +69 -0
  6. package/dist/cjs/layers/Json.js +31 -0
  7. package/dist/cjs/layers/Marker.js +47 -0
  8. package/dist/cjs/markers/Fill.js +80 -0
  9. package/dist/cjs/markers/Pin.js +92 -0
  10. package/dist/cjs/renderers/Heatmap.js +62 -0
  11. package/dist/cjs/renderers/Simple.js +51 -0
  12. package/dist/cjs/tools/BasemapGallery.js +80 -0
  13. package/dist/cjs/tools/Home.js +134 -0
  14. package/dist/cjs/tools/LayerList.js +43 -0
  15. package/dist/cjs/tools/ScaleBar.js +36 -0
  16. package/dist/cjs/tools/Zoom.js +40 -0
  17. package/dist/cjs/viewer/Context.js +132 -0
  18. package/dist/cjs/viewer/Viewer.js +29 -0
  19. package/dist/esm/constants/index.js +48 -0
  20. package/dist/esm/index.js +68 -0
  21. package/dist/esm/layers/Json.js +31 -0
  22. package/dist/esm/layers/Marker.js +46 -0
  23. package/dist/esm/markers/Fill.js +80 -0
  24. package/dist/esm/markers/Pin.js +92 -0
  25. package/dist/esm/renderers/Heatmap.js +62 -0
  26. package/dist/esm/renderers/Simple.js +51 -0
  27. package/dist/esm/tools/BasemapGallery.js +80 -0
  28. package/dist/esm/tools/Home.js +115 -0
  29. package/dist/esm/tools/LayerList.js +43 -0
  30. package/dist/esm/tools/ScaleBar.js +36 -0
  31. package/dist/esm/tools/Zoom.js +40 -0
  32. package/dist/esm/viewer/Context.js +131 -0
  33. package/dist/esm/viewer/Viewer.js +29 -0
  34. package/dist/types/constants/index.d.ts +22 -0
  35. package/dist/types/index.d.ts +73 -0
  36. package/dist/types/layers/Json.d.ts +1 -0
  37. package/dist/types/layers/Marker.d.ts +14 -0
  38. package/dist/types/markers/Fill.d.ts +12 -0
  39. package/dist/types/markers/Pin.d.ts +16 -0
  40. package/dist/types/renderers/Cluster.d.ts +19 -0
  41. package/dist/types/renderers/Heatmap.d.ts +18 -0
  42. package/dist/types/renderers/Simple.d.ts +38 -0
  43. package/dist/types/tools/BasemapGallery.d.ts +4 -0
  44. package/dist/types/tools/Home.d.ts +4 -0
  45. package/dist/types/tools/LayerList.d.ts +3 -0
  46. package/dist/types/tools/ScaleBar.d.ts +2 -0
  47. package/dist/types/tools/Zoom.d.ts +2 -0
  48. package/dist/types/types/index.d.ts +34 -0
  49. package/dist/types/viewer/Context.d.ts +16 -0
  50. package/dist/types/viewer/Viewer.d.ts +3 -0
  51. package/package.json +61 -0
  52. package/src/constants/index.ts +44 -0
  53. package/src/index.ts +65 -0
  54. package/src/layers/Json.tsx +52 -0
  55. package/src/layers/Marker.tsx +83 -0
  56. package/src/markers/Fill.tsx +117 -0
  57. package/src/markers/Pin.tsx +136 -0
  58. package/src/renderers/Cluster.tsx +99 -0
  59. package/src/renderers/Heatmap.tsx +99 -0
  60. package/src/renderers/Simple.tsx +97 -0
  61. package/src/tools/BasemapGallery.tsx +91 -0
  62. package/src/tools/Home.tsx +134 -0
  63. package/src/tools/LayerList.tsx +41 -0
  64. package/src/tools/ScaleBar.tsx +29 -0
  65. package/src/tools/Zoom.tsx +31 -0
  66. package/src/types/index.ts +54 -0
  67. package/src/viewer/Context.tsx +160 -0
  68. package/src/viewer/Viewer.tsx +42 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 React Fabric, Adarsh Pastakia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,10 @@
1
+ # React-Fabric: ArcGIS map visualization
2
+
3
+ #### Install
4
+
5
+ ```bash
6
+ # Using
7
+ yarn add @react-fabric/map
8
+ ```
9
+
10
+ #### Usage
package/css/styles.css ADDED
@@ -0,0 +1,40 @@
1
+ /*
2
+ * React Fabric
3
+ * @version: 1.0.0
4
+ *
5
+ *
6
+ * The MIT License (MIT)
7
+ * Copyright (c) 2025 Adarsh Pastakia
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
10
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
11
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
12
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
13
+ * subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
16
+ * portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+
24
+ [data-color-scheme="light"] {
25
+ --calcite-color-foreground-1: var(--color-neutral-50);
26
+ --calcite-color-foreground-2: var(--color-neutral-100);
27
+ --calcite-color-foreground-3: var(--color-neutral-50);
28
+ }
29
+
30
+ [data-color-scheme="dark"] {
31
+ --calcite-color-foreground-1: var(--color-neutral-950);
32
+ --calcite-color-foreground-2: var(--color-neutral-900);
33
+ --calcite-color-foreground-3: var(--color-neutral-950);
34
+ }
35
+
36
+ :root {
37
+ --calcite-color-brand: var(--color-primary-500);
38
+ --calcite-color-brand-hover: var(--color-primary-400);
39
+ --calcite-color-brand-press: var(--color-primary-600);
40
+ }
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+
3
+ /*
4
+ * React Fabric
5
+ * @version: 1.0.0
6
+ *
7
+ *
8
+ * The MIT License (MIT)
9
+ * Copyright (c) 2025 Adarsh Pastakia
10
+ *
11
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
12
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
13
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
14
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
15
+ * subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
18
+ * portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
21
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+ var BASEMAPS = [{
27
+ "default": true,
28
+ title: "OpenFreeMap Bright",
29
+ thumbnail: "/assets/map/bright.png",
30
+ layers: [{
31
+ url: "https://tiles.openfreemap.org/styles/bright"
32
+ }]
33
+ }, {
34
+ title: "OpenFreeMap Grayscale",
35
+ thumbnail: "/assets/map/gray.png",
36
+ layers: [{
37
+ url: "https://tiles.openfreemap.org/styles/positron"
38
+ }]
39
+ }];
40
+ var DEFAULT_VIEWPOINT = {
41
+ point: {
42
+ latitude: 24.449448,
43
+ longitude: 54.529321
44
+ },
45
+ zoom: 11
46
+ };
47
+
48
+ exports.BASEMAPS = BASEMAPS;
49
+ exports.DEFAULT_VIEWPOINT = DEFAULT_VIEWPOINT;
@@ -0,0 +1,69 @@
1
+ 'use strict';
2
+
3
+ var esriConfig = require('@arcgis/core/config');
4
+ var Viewer = require('./viewer/Viewer.js');
5
+ var BasemapGallery = require('./tools/BasemapGallery.js');
6
+ var Home = require('./tools/Home.js');
7
+ var LayerList = require('./tools/LayerList.js');
8
+ var ScaleBar = require('./tools/ScaleBar.js');
9
+ var Zoom = require('./tools/Zoom.js');
10
+ var Json = require('./layers/Json.js');
11
+ var Marker = require('./layers/Marker.js');
12
+ var Fill = require('./markers/Fill.js');
13
+ var Pin = require('./markers/Pin.js');
14
+ var Heatmap = require('./renderers/Heatmap.js');
15
+ var Simple = require('./renderers/Simple.js');
16
+
17
+ /*
18
+ * React Fabric
19
+ * @version: 1.0.0
20
+ *
21
+ *
22
+ * The MIT License (MIT)
23
+ * Copyright (c) 2025 Adarsh Pastakia
24
+ *
25
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
26
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
27
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
28
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
29
+ * subject to the following conditions:
30
+ *
31
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
32
+ * portions of the Software.
33
+ *
34
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
35
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
36
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
37
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38
+ */
39
+
40
+ esriConfig.assetsPath = "/assets/@arcgis";
41
+ var setArcgisAssetsPath = function setArcgisAssetsPath(path) {
42
+ esriConfig.assetsPath = path;
43
+ };
44
+ exports.MapTools = void 0;
45
+ (function (_MapTools) {
46
+ _MapTools.BasemapGallery = BasemapGallery.BasemapGallery;
47
+ _MapTools.LayerList = LayerList.LayerList;
48
+ _MapTools.Zoom = Zoom.Zoom;
49
+ _MapTools.ScaleBar = ScaleBar.ScaleBar;
50
+ _MapTools.Home = Home.Home;
51
+ })(exports.MapTools || (exports.MapTools = {}));
52
+ exports.MapLayers = void 0;
53
+ (function (_MapLayers) {
54
+ _MapLayers.Markers = Marker.MarkerLayer;
55
+ _MapLayers.Json = Json.JsonLayer;
56
+ })(exports.MapLayers || (exports.MapLayers = {}));
57
+ exports.MapMarkers = void 0;
58
+ (function (_MapMarkers) {
59
+ _MapMarkers.Fill = Fill.Fill;
60
+ _MapMarkers.Pin = Pin.Pin;
61
+ })(exports.MapMarkers || (exports.MapMarkers = {}));
62
+ exports.MapRenderers = void 0;
63
+ (function (_MapRenderers) {
64
+ _MapRenderers.useSimple = Simple.useSimpleRenderer;
65
+ _MapRenderers.useHeatmap = Heatmap.useHeatmapRenderer;
66
+ })(exports.MapRenderers || (exports.MapRenderers = {}));
67
+
68
+ exports.MapViewer = Viewer.MapViewer;
69
+ exports.setArcgisAssetsPath = setArcgisAssetsPath;
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
+ var GeoJSONLayer = require('@arcgis/core/layers/GeoJSONLayer');
5
+ var react = require('react');
6
+ var Context = require('../viewer/Context.js');
7
+
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
+ 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
+ var JsonLayer = function JsonLayer(props) {
11
+ var _useMap = Context.useMap(),
12
+ map = _useMap.map,
13
+ view = _useMap.view;
14
+ var layer = react.useMemo(function () {
15
+ return new GeoJSONLayer(_objectSpread({}, props));
16
+ }, [props]);
17
+ react.useEffect(function () {
18
+ if (map && view) {
19
+ layer.when(function () {
20
+ view.goTo(layer.fullExtent);
21
+ });
22
+ map.add(layer);
23
+ return function () {
24
+ map.remove(layer);
25
+ };
26
+ }
27
+ }, [map, view, layer]);
28
+ return null;
29
+ };
30
+
31
+ exports.JsonLayer = JsonLayer;
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
4
+ var GraphicsLayer = require('@arcgis/core/layers/GraphicsLayer');
5
+ require('@arcgis/map-components/components/arcgis-features');
6
+ var react = require('react');
7
+ var Context = require('../viewer/Context.js');
8
+ var jsxRuntime = require('react/jsx-runtime');
9
+
10
+ var _excluded = ["children"];
11
+ var MarkerContext = /*#__PURE__*/react.createContext(null);
12
+ /**
13
+ * MarkerLayer component for displaying a layer of markers on the map.
14
+ */
15
+ var MarkerLayer = function MarkerLayer(_ref) {
16
+ var children = _ref.children,
17
+ props = _objectWithoutProperties(_ref, _excluded);
18
+ var _useMap = Context.useMap(),
19
+ map = _useMap.map,
20
+ view = _useMap.view;
21
+ var layer = react.useMemo(function () {
22
+ return new GraphicsLayer(Object.assign({
23
+ visible: true,
24
+ listMode: "show"
25
+ }, props));
26
+ }, [props]);
27
+ react.useEffect(function () {
28
+ if (map && view) {
29
+ view === null || view === void 0 || view.when(function () {
30
+ map === null || map === void 0 || map.layers.add(layer);
31
+ });
32
+ return function () {
33
+ map === null || map === void 0 || map.layers.remove(layer);
34
+ };
35
+ }
36
+ }, [layer, map, view]);
37
+ return /*#__PURE__*/jsxRuntime.jsx(MarkerContext.Provider, {
38
+ value: layer,
39
+ children: children
40
+ });
41
+ };
42
+ var useMarkerLayer = function useMarkerLayer() {
43
+ return react.useContext(MarkerContext);
44
+ };
45
+
46
+ exports.MarkerLayer = MarkerLayer;
47
+ exports.useMarkerLayer = useMarkerLayer;
@@ -0,0 +1,80 @@
1
+ 'use strict';
2
+
3
+ var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
4
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
5
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
6
+ var Polygon = require('@arcgis/core/geometry/Polygon');
7
+ var Graphic = require('@arcgis/core/Graphic');
8
+ var SimpleFillSymbol = require('@arcgis/core/symbols/SimpleFillSymbol');
9
+ var utilities = require('@react-fabric/utilities');
10
+ var react = require('react');
11
+ var Marker = require('../layers/Marker.js');
12
+ var Color = require('color');
13
+ var Context = require('../viewer/Context.js');
14
+
15
+ var _excluded = ["coords", "style", "color", "borderWidth", "borderColor", "animate"];
16
+ 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; }
17
+ 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; }
18
+
19
+ /**
20
+ * Fill graphic for displaying a fill polygon on the map.
21
+ */
22
+ var Fill = function Fill(_ref) {
23
+ var coords = _ref.coords,
24
+ _ref$style = _ref.style,
25
+ style = _ref$style === void 0 ? "solid" : _ref$style,
26
+ _ref$color = _ref.color,
27
+ color = _ref$color === void 0 ? "#f00" : _ref$color,
28
+ borderWidth = _ref.borderWidth,
29
+ borderColor = _ref.borderColor,
30
+ animate = _ref.animate,
31
+ props = _objectWithoutProperties(_ref, _excluded);
32
+ var layer = Marker.useMarkerLayer();
33
+ var _useMap = Context.useMap(),
34
+ is3D = _useMap.is3D;
35
+ var graphic = react.useMemo(function () {
36
+ return new Graphic(_objectSpread({
37
+ geometry: new Polygon({
38
+ rings: [coords.map(utilities.convertLatLng)]
39
+ }),
40
+ symbol: new SimpleFillSymbol(Object.assign({
41
+ style: style,
42
+ color: color,
43
+ outline: {
44
+ color: borderColor,
45
+ width: borderWidth
46
+ }
47
+ }))
48
+ }, props));
49
+ }, [coords, style, color, borderColor, borderWidth, props]);
50
+ react.useEffect(function () {
51
+ if (layer && coords) {
52
+ var tmr = null;
53
+ layer.when(function () {
54
+ layer.add(graphic);
55
+ if (animate && !is3D) {
56
+ var up = 0.1;
57
+ var sat = 0;
58
+ var symbol = graphic.symbol;
59
+ var _color = symbol.color.toRgba();
60
+ tmr = setInterval(function () {
61
+ if (sat >= 0.9) up = -0.1;
62
+ if (sat <= 0.1) up = 0.1;
63
+ sat += up;
64
+ symbol.color = Color.rgb(_toConsumableArray(_color)).darken(sat).rgb().array();
65
+ requestAnimationFrame(function () {
66
+ graphic.symbol = symbol.clone();
67
+ });
68
+ }, 100);
69
+ }
70
+ });
71
+ return function () {
72
+ clearInterval(tmr);
73
+ layer.remove(graphic);
74
+ };
75
+ }
76
+ }, [layer, graphic, animate, is3D]);
77
+ return null;
78
+ };
79
+
80
+ exports.Fill = Fill;
@@ -0,0 +1,92 @@
1
+ 'use strict';
2
+
3
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
5
+ var Point = require('@arcgis/core/geometry/Point');
6
+ var Graphic = require('@arcgis/core/Graphic');
7
+ var SimpleMarkerSymbol = require('@arcgis/core/symbols/SimpleMarkerSymbol');
8
+ var utilities = require('@react-fabric/utilities');
9
+ var react = require('react');
10
+ var Marker = require('../layers/Marker.js');
11
+ var Context = require('../viewer/Context.js');
12
+
13
+ var _excluded = ["coords", "style", "size", "color", "path", "borderWidth", "borderColor", "animate"];
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; }
15
+ 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; }
16
+ var paths = {
17
+ marker: "M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z",
18
+ "marker-radius": "M12,2C15.31,2 18,4.66 18,7.95C18,12.41 12,19 12,19C12,19 6,12.41 6,7.95C6,4.66 8.69,2 12,2M12,6A2,2 0 0,0 10,8A2,2 0 0,0 12,10A2,2 0 0,0 14,8A2,2 0 0,0 12,6M20,19C20,21.21 16.42,23 12,23C7.58,23 4,21.21 4,19C4,17.71 5.22,16.56 7.11,15.83L7.75,16.74C6.67,17.19 6,17.81 6,18.5C6,19.88 8.69,21 12,21C15.31,21 18,19.88 18,18.5C18,17.81 17.33,17.19 16.25,16.74L16.89,15.83C18.78,16.56 20,17.71 20,19Z",
19
+ pin: "M12 14.571c0.589 0 1.165-0.067 1.714-0.201v8.772c0 0.469-0.388 0.857-0.857 0.857h-1.714c-0.469 0-0.857-0.388-0.857-0.857v-8.772c0.549 0.134 1.125 0.201 1.714 0.201zM12 0c3.79 0 6.857 3.067 6.857 6.857s-3.067 6.857-6.857 6.857-6.857-3.067-6.857-6.857 3.067-6.857 6.857-6.857zM12 3c0.241 0 0.429-0.188 0.429-0.429s-0.188-0.429-0.429-0.429c-2.598 0-4.714 2.116-4.714 4.714 0 0.241 0.188 0.429 0.429 0.429s0.429-0.188 0.429-0.429c0-2.129 1.728-3.857 3.857-3.857z",
20
+ "pin-radius": "M12.479 20.11v-0.956c3.218 0.095 5.754 1.127 5.754 2.388 0 1.324-2.79 2.458-6.233 2.458s-6.233-1.134-6.233-2.458c0-1.261 2.536-2.294 5.753-2.388v0.956c-2.687 0.066-4.794 0.682-4.794 1.432 0 0.794 2.361 1.558 5.274 1.558s5.273-0.764 5.273-1.558c-0.001-0.75-2.107-1.364-4.794-1.432zM6.734 5.274c0-2.912 2.421-5.274 5.335-5.274s5.274 2.362 5.274 5.274c0 2.503-1.746 4.595-4.086 5.135l-1.257 12.692-1.261-12.728c-2.268-0.59-4.005-2.646-4.005-5.099zM11.999 3.862c0-0.795-0.644-1.438-1.438-1.438s-1.439 0.643-1.439 1.438c0 0.794 0.644 1.438 1.439 1.438s1.438-0.643 1.438-1.438z"
21
+ };
22
+
23
+ /**
24
+ * Pin graphic for displaying a pin on the map.
25
+ */
26
+ var Pin = function Pin(_ref) {
27
+ var coords = _ref.coords,
28
+ _ref$style = _ref.style,
29
+ style = _ref$style === void 0 ? "circle" : _ref$style,
30
+ _ref$size = _ref.size,
31
+ size = _ref$size === void 0 ? 18 : _ref$size,
32
+ _ref$color = _ref.color,
33
+ color = _ref$color === void 0 ? "#f00" : _ref$color,
34
+ path = _ref.path,
35
+ borderWidth = _ref.borderWidth,
36
+ borderColor = _ref.borderColor,
37
+ animate = _ref.animate,
38
+ props = _objectWithoutProperties(_ref, _excluded);
39
+ var layer = Marker.useMarkerLayer();
40
+ var _useMap = Context.useMap(),
41
+ is3D = _useMap.is3D;
42
+ var graphic = react.useMemo(function () {
43
+ return new Graphic(_objectSpread({
44
+ geometry: new Point(utilities.getLatitudeLongitude(coords)),
45
+ symbol: new SimpleMarkerSymbol(Object.assign({
46
+ style: style,
47
+ color: color,
48
+ size: size,
49
+ outline: {
50
+ color: borderColor,
51
+ width: borderWidth
52
+ }
53
+ }, style && style.toString() in paths ? {
54
+ path: paths[style.toString()],
55
+ style: "path"
56
+ } : {}, path ? {
57
+ path: path,
58
+ style: "path"
59
+ } : {}))
60
+ }, props));
61
+ }, [coords, style, size, color, borderColor, borderWidth, path, props]);
62
+ react.useEffect(function () {
63
+ if (layer && coords) {
64
+ var tmr = null;
65
+ layer.when(function () {
66
+ layer.add(graphic);
67
+ var symbol = graphic.symbol;
68
+ if (symbol.style === "path") symbol.yoffset = symbol.size / 2;
69
+ if (animate && !is3D) {
70
+ var baseSize = symbol.size;
71
+ var up = 2;
72
+ tmr = setInterval(function () {
73
+ symbol.size += up;
74
+ if (symbol.size > baseSize + 20) up = -2;
75
+ if (symbol.size <= baseSize) up = 2;
76
+ if (symbol.style === "path") symbol.yoffset = symbol.size / 2;
77
+ requestAnimationFrame(function () {
78
+ graphic.symbol = symbol.clone();
79
+ });
80
+ }, 100);
81
+ }
82
+ });
83
+ return function () {
84
+ clearInterval(tmr);
85
+ layer.remove(graphic);
86
+ };
87
+ }
88
+ }, [layer, graphic, animate, is3D]);
89
+ return null;
90
+ };
91
+
92
+ exports.Pin = Pin;
@@ -0,0 +1,62 @@
1
+ 'use strict';
2
+
3
+ var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
4
+ var HeatmapRenderer = require('@arcgis/core/renderers/HeatmapRenderer');
5
+ var Color = require('color');
6
+ var react = require('react');
7
+
8
+ var useHeatmapRenderer = function useHeatmapRenderer(props) {
9
+ var renderer = react.useMemo(function () {
10
+ var _props$colors, _props$colors2, _props$colors3, _props$minDensity, _props$maxDensity;
11
+ var colorHigh = "#FFE600FF";
12
+ var colorMid = "#FF8C00FF";
13
+ var colorLow = "#FF3300FF";
14
+ if ((props === null || props === void 0 || (_props$colors = props.colors) === null || _props$colors === void 0 ? void 0 : _props$colors.length) === 1) {
15
+ colorHigh = Color(props.colors[0]).lightness(95).toString();
16
+ colorLow = Color(props.colors[0]).lightness(25).toString();
17
+ colorMid = Color(colorHigh).mix(Color(colorLow), 0.5).toString();
18
+ }
19
+ if ((props === null || props === void 0 || (_props$colors2 = props.colors) === null || _props$colors2 === void 0 ? void 0 : _props$colors2.length) === 2) {
20
+ colorHigh = props.colors[0];
21
+ colorLow = props.colors[1];
22
+ colorMid = Color(colorHigh).mix(Color(colorLow), 0.5).toString();
23
+ }
24
+ if ((props === null || props === void 0 || (_props$colors3 = props.colors) === null || _props$colors3 === void 0 ? void 0 : _props$colors3.length) === 3) {
25
+ colorHigh = props.colors[0];
26
+ colorMid = props.colors[1];
27
+ colorLow = props.colors[2];
28
+ }
29
+ var colors = props !== null && props !== void 0 && props.colors && props.colors.length > 3 ? props.colors.map(function (color, index, arr) {
30
+ return {
31
+ ratio: (index + 1) / arr.length,
32
+ color: color
33
+ };
34
+ }) : [].concat(_toConsumableArray(Array.from({
35
+ length: 6
36
+ }, function (_, i) {
37
+ return {
38
+ ratio: (i + 1) / 12,
39
+ color: Color(colorLow).mix(Color(colorMid), i / 6).toString()
40
+ };
41
+ })), _toConsumableArray(Array.from({
42
+ length: 6
43
+ }, function (_, i) {
44
+ return {
45
+ ratio: (i + 6) / 12,
46
+ color: Color(colorMid).mix(Color(colorHigh), i / 6).toString()
47
+ };
48
+ })));
49
+ return new HeatmapRenderer({
50
+ field: props === null || props === void 0 ? void 0 : props.field,
51
+ colorStops: [{
52
+ color: "#00000000",
53
+ ratio: 0
54
+ }].concat(_toConsumableArray(colors)),
55
+ minDensity: (_props$minDensity = props === null || props === void 0 ? void 0 : props.minDensity) !== null && _props$minDensity !== void 0 ? _props$minDensity : 0,
56
+ maxDensity: (_props$maxDensity = props === null || props === void 0 ? void 0 : props.maxDensity) !== null && _props$maxDensity !== void 0 ? _props$maxDensity : 0.1
57
+ });
58
+ }, [props]);
59
+ return renderer;
60
+ };
61
+
62
+ exports.useHeatmapRenderer = useHeatmapRenderer;
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+
3
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
+ var SimpleRenderer = require('@arcgis/core/renderers/SimpleRenderer');
5
+ var react = require('react');
6
+
7
+ 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; }
8
+ 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; }
9
+ var useSimpleRenderer = function useSimpleRenderer(props) {
10
+ var renderer = react.useMemo(function () {
11
+ var _props$style, _props$color, _props$size, _props$borderColor, _props$borderWidth;
12
+ var vizVars = [];
13
+ var styleProps = {
14
+ style: (_props$style = props === null || props === void 0 ? void 0 : props.style) !== null && _props$style !== void 0 ? _props$style : "circle"
15
+ };
16
+ if (props !== null && props !== void 0 && props.path) {
17
+ styleProps.style = "path";
18
+ styleProps.path = props.path;
19
+ }
20
+ if (props !== null && props !== void 0 && props.sizeStops && props.sizeField) {
21
+ vizVars.push({
22
+ type: "size",
23
+ field: props.sizeField,
24
+ stops: props.sizeStops
25
+ });
26
+ }
27
+ if (props !== null && props !== void 0 && props.colorStops && props.colorField) {
28
+ vizVars.push({
29
+ type: "color",
30
+ field: props.colorField,
31
+ stops: props.colorStops
32
+ });
33
+ }
34
+ return new SimpleRenderer({
35
+ symbol: _objectSpread(_objectSpread({
36
+ type: "simple-marker"
37
+ }, styleProps), {}, {
38
+ color: (_props$color = props === null || props === void 0 ? void 0 : props.color) !== null && _props$color !== void 0 ? _props$color : "blue",
39
+ size: (_props$size = props === null || props === void 0 ? void 0 : props.size) !== null && _props$size !== void 0 ? _props$size : 4,
40
+ outline: {
41
+ color: (_props$borderColor = props === null || props === void 0 ? void 0 : props.borderColor) !== null && _props$borderColor !== void 0 ? _props$borderColor : "white",
42
+ width: (_props$borderWidth = props === null || props === void 0 ? void 0 : props.borderWidth) !== null && _props$borderWidth !== void 0 ? _props$borderWidth : 1
43
+ }
44
+ }),
45
+ visualVariables: vizVars
46
+ });
47
+ }, [props]);
48
+ return renderer;
49
+ };
50
+
51
+ exports.useSimpleRenderer = useSimpleRenderer;
@@ -0,0 +1,80 @@
1
+ 'use strict';
2
+
3
+ var Basemap = require('@arcgis/core/Basemap');
4
+ var VectorTileLayer = require('@arcgis/core/layers/VectorTileLayer');
5
+ var LocalBasemapsSource = require('@arcgis/core/widgets/BasemapGallery/support/LocalBasemapsSource');
6
+ var mapComponentsReact = require('@arcgis/map-components-react');
7
+ require('@arcgis/map-components/components/arcgis-basemap-gallery');
8
+ require('@arcgis/map-components/components/arcgis-basemap-layer-list');
9
+ require('@arcgis/map-components/components/arcgis-expand');
10
+ var Context = require('../viewer/Context.js');
11
+ var jsxRuntime = require('react/jsx-runtime');
12
+
13
+ /*
14
+ * React Fabric
15
+ * @version: 1.0.0
16
+ *
17
+ *
18
+ * The MIT License (MIT)
19
+ * Copyright (c) 2025 Adarsh Pastakia
20
+ *
21
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
22
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
23
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
24
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
25
+ * subject to the following conditions:
26
+ *
27
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
28
+ * portions of the Software.
29
+ *
30
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
31
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
32
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
33
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34
+ */
35
+
36
+ var BasemapGallery = function BasemapGallery() {
37
+ var _map$basemap$baseLaye, _map$basemap;
38
+ var _useMap = Context.useMap(),
39
+ basemaps = _useMap.basemaps,
40
+ map = _useMap.map;
41
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
42
+ children: [/*#__PURE__*/jsxRuntime.jsx(mapComponentsReact.ArcgisExpand, {
43
+ className: "mb-2",
44
+ expandIcon: "basemap",
45
+ collapseIcon: "x",
46
+ mode: "floating",
47
+ slot: "top-right",
48
+ autoCollapse: true,
49
+ children: /*#__PURE__*/jsxRuntime.jsx(mapComponentsReact.ArcgisBasemapGallery, {
50
+ source: new LocalBasemapsSource({
51
+ basemaps: basemaps.map(function (map) {
52
+ return new Basemap({
53
+ title: map.title,
54
+ thumbnailUrl: map.thumbnail,
55
+ baseLayers: map.layers.map(function (layer) {
56
+ return new VectorTileLayer("url" in layer ? {
57
+ url: layer.url
58
+ } : {
59
+ portalItem: {
60
+ id: layer.portalId
61
+ }
62
+ });
63
+ })
64
+ });
65
+ })
66
+ })
67
+ })
68
+ }), ((_map$basemap$baseLaye = map === null || map === void 0 || (_map$basemap = map.basemap) === null || _map$basemap === void 0 ? void 0 : _map$basemap.baseLayers.length) !== null && _map$basemap$baseLaye !== void 0 ? _map$basemap$baseLaye : 1) > 1 && /*#__PURE__*/jsxRuntime.jsx(mapComponentsReact.ArcgisExpand, {
69
+ className: "mb-2",
70
+ expandIcon: "layer-map",
71
+ collapseIcon: "x",
72
+ mode: "floating",
73
+ slot: "top-right",
74
+ autoCollapse: true,
75
+ children: /*#__PURE__*/jsxRuntime.jsx(mapComponentsReact.ArcgisBasemapLayerList, {})
76
+ })]
77
+ });
78
+ };
79
+
80
+ exports.BasemapGallery = BasemapGallery;