@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
@@ -0,0 +1,134 @@
1
+ 'use strict';
2
+
3
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
4
+ var reactiveUtils = require('@arcgis/core/core/reactiveUtils');
5
+ var Point = require('@arcgis/core/geometry/Point');
6
+ var Viewpoint = require('@arcgis/core/Viewpoint');
7
+ var mapComponentsReact = require('@arcgis/map-components-react');
8
+ require('@arcgis/map-components/components/arcgis-placement');
9
+ var calciteComponentsReact = require('@esri/calcite-components-react');
10
+ var utilities = require('@react-fabric/utilities');
11
+ var react = require('react');
12
+ var Context = require('../viewer/Context.js');
13
+ var jsxRuntime = require('react/jsx-runtime');
14
+
15
+ function _interopNamespaceDefault(e) {
16
+ var n = Object.create(null);
17
+ if (e) {
18
+ Object.keys(e).forEach(function (k) {
19
+ if (k !== 'default') {
20
+ var d = Object.getOwnPropertyDescriptor(e, k);
21
+ Object.defineProperty(n, k, d.get ? d : {
22
+ enumerable: true,
23
+ get: function () { return e[k]; }
24
+ });
25
+ }
26
+ });
27
+ }
28
+ n.default = e;
29
+ return Object.freeze(n);
30
+ }
31
+
32
+ var reactiveUtils__namespace = /*#__PURE__*/_interopNamespaceDefault(reactiveUtils);
33
+
34
+ var Home = function Home(_ref) {
35
+ var enableHistory = _ref.enableHistory;
36
+ var _useMap = Context.useMap(),
37
+ map = _useMap.map,
38
+ view = _useMap.view,
39
+ disableDrag = _useMap.disableDrag,
40
+ center = _useMap.center,
41
+ zoom = _useMap.zoom;
42
+ var isNavigatingHistory = react.useRef(false);
43
+ var currentIndex = react.useRef(0);
44
+ var _useState = react.useState([]),
45
+ _useState2 = _slicedToArray(_useState, 2),
46
+ history = _useState2[0],
47
+ setHistory = _useState2[1];
48
+ var _useState3 = react.useState(0),
49
+ _useState4 = _slicedToArray(_useState3, 2),
50
+ activeIndex = _useState4[0],
51
+ setActiveIndex = _useState4[1];
52
+ react.useEffect(function () {
53
+ currentIndex.current = activeIndex;
54
+ }, [activeIndex]);
55
+ react.useEffect(function () {
56
+ if (enableHistory && !disableDrag && view) {
57
+ var addHistory = utilities.debounce(function (viewpoint) {
58
+ if (!isNavigatingHistory.current) {
59
+ setHistory(function (h) {
60
+ // Keep max 25 history entries
61
+ var newHistory = h.slice(0, currentIndex.current + 1).slice(-24);
62
+ // Add new viewpoint to history
63
+ newHistory.push(viewpoint.clone());
64
+ setActiveIndex(newHistory.length - 1);
65
+ return newHistory;
66
+ });
67
+ }
68
+ isNavigatingHistory.current = false;
69
+ });
70
+ var watcher = reactiveUtils__namespace.watch(function () {
71
+ return view.viewpoint;
72
+ }, addHistory);
73
+ return function () {
74
+ watcher.remove();
75
+ };
76
+ }
77
+ }, [disableDrag, enableHistory, view]);
78
+ var navigate = react.useCallback(function (idx) {
79
+ if (history.length > 0 && history[idx] && view) {
80
+ isNavigatingHistory.current = true;
81
+ view.goTo(history[idx]);
82
+ setActiveIndex(idx);
83
+ }
84
+ }, [history]);
85
+ var gotoHome = react.useCallback(function () {
86
+ if (view) {
87
+ var _extent, _view$tileInfo;
88
+ var extent;
89
+ map === null || map === void 0 || map.layers.forEach(function (layer) {
90
+ if (layer.visible && layer.fullExtent) {
91
+ if (extent) {
92
+ extent = extent.union(layer.fullExtent);
93
+ } else {
94
+ extent = layer.fullExtent;
95
+ }
96
+ }
97
+ });
98
+ view.goTo((_extent = extent) !== null && _extent !== void 0 ? _extent : new Viewpoint({
99
+ scale: (_view$tileInfo = view.tileInfo) === null || _view$tileInfo === void 0 ? void 0 : _view$tileInfo.zoomToScale(zoom),
100
+ targetGeometry: new Point(utilities.getLatitudeLongitude(center))
101
+ }));
102
+ }
103
+ }, [center, zoom, view, map]);
104
+ return !disableDrag && /*#__PURE__*/jsxRuntime.jsxs(mapComponentsReact.ArcgisPlacement, {
105
+ slot: "top-left",
106
+ className: "mb-2 flex flex-col divide-y divide-tint-100",
107
+ children: [enableHistory && /*#__PURE__*/jsxRuntime.jsx(calciteComponentsReact.CalciteButton, {
108
+ appearance: "solid",
109
+ kind: "neutral",
110
+ iconStart: "arrow-left",
111
+ disabled: activeIndex <= 0,
112
+ onClick: function onClick() {
113
+ return navigate(activeIndex - 1);
114
+ }
115
+ }), /*#__PURE__*/jsxRuntime.jsx(calciteComponentsReact.CalciteButton, {
116
+ appearance: "solid",
117
+ kind: "neutral",
118
+ iconStart: "home",
119
+ onClick: function onClick() {
120
+ return gotoHome();
121
+ }
122
+ }), enableHistory && /*#__PURE__*/jsxRuntime.jsx(calciteComponentsReact.CalciteButton, {
123
+ appearance: "solid",
124
+ kind: "neutral",
125
+ iconStart: "arrow-right",
126
+ disabled: activeIndex >= history.length - 1,
127
+ onClick: function onClick() {
128
+ return navigate(activeIndex + 1);
129
+ }
130
+ })]
131
+ });
132
+ };
133
+
134
+ exports.Home = Home;
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ var mapComponentsReact = require('@arcgis/map-components-react');
4
+ require('@arcgis/map-components/components/arcgis-expand');
5
+ require('@arcgis/map-components/components/arcgis-layer-list');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+
8
+ /*
9
+ * React Fabric
10
+ * @version: 1.0.0
11
+ *
12
+ *
13
+ * The MIT License (MIT)
14
+ * Copyright (c) 2025 Adarsh Pastakia
15
+ *
16
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
18
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20
+ * subject to the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
23
+ * portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
26
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
28
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
+ */
30
+
31
+ var LayerList = function LayerList() {
32
+ return /*#__PURE__*/jsxRuntime.jsx(mapComponentsReact.ArcgisExpand, {
33
+ expandIcon: "layers",
34
+ className: "mb-2",
35
+ collapseIcon: "x",
36
+ mode: "floating",
37
+ slot: "top-right",
38
+ autoCollapse: true,
39
+ children: /*#__PURE__*/jsxRuntime.jsx(mapComponentsReact.ArcgisLayerList, {})
40
+ });
41
+ };
42
+
43
+ exports.LayerList = LayerList;
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ var mapComponentsReact = require('@arcgis/map-components-react');
4
+ require('@arcgis/map-components/components/arcgis-scale-bar');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+
7
+ /*
8
+ * React Fabric
9
+ * @version: 1.0.0
10
+ *
11
+ *
12
+ * The MIT License (MIT)
13
+ * Copyright (c) 2025 Adarsh Pastakia
14
+ *
15
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
16
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
17
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
18
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
19
+ * subject to the following conditions:
20
+ *
21
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
22
+ * portions of the Software.
23
+ *
24
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
25
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
+ */
29
+
30
+ var ScaleBar = function ScaleBar() {
31
+ return /*#__PURE__*/jsxRuntime.jsx(mapComponentsReact.ArcgisScaleBar, {
32
+ slot: "bottom-left"
33
+ });
34
+ };
35
+
36
+ exports.ScaleBar = ScaleBar;
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ var mapComponentsReact = require('@arcgis/map-components-react');
4
+ require('@arcgis/map-components/components/arcgis-zoom');
5
+ var Context = require('../viewer/Context.js');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+
8
+ /*
9
+ * React Fabric
10
+ * @version: 1.0.0
11
+ *
12
+ *
13
+ * The MIT License (MIT)
14
+ * Copyright (c) 2025 Adarsh Pastakia
15
+ *
16
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
18
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20
+ * subject to the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
23
+ * portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
26
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
28
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
+ */
30
+
31
+ var Zoom = function Zoom() {
32
+ var _useMap = Context.useMap(),
33
+ disableZoom = _useMap.disableZoom;
34
+ return !disableZoom && /*#__PURE__*/jsxRuntime.jsx(mapComponentsReact.ArcgisZoom, {
35
+ slot: "top-left",
36
+ className: "mb-2"
37
+ });
38
+ };
39
+
40
+ exports.Zoom = Zoom;
@@ -0,0 +1,132 @@
1
+ 'use strict';
2
+
3
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
4
+ var Basemap = require('@arcgis/core/Basemap');
5
+ var Point = require('@arcgis/core/geometry/Point');
6
+ var SpatialReference = require('@arcgis/core/geometry/SpatialReference');
7
+ var VectorTileLayer = require('@arcgis/core/layers/VectorTileLayer');
8
+ var mapComponentsReact = require('@arcgis/map-components-react');
9
+ require('@arcgis/map-components/components/arcgis-map');
10
+ require('@arcgis/map-components/components/arcgis-popup');
11
+ require('@arcgis/map-components/components/arcgis-scene');
12
+ var calciteComponentsReact = require('@esri/calcite-components-react');
13
+ var utilities = require('@react-fabric/utilities');
14
+ var react = require('react');
15
+ var index = require('../constants/index.js');
16
+ var jsxRuntime = require('react/jsx-runtime');
17
+
18
+ var Context = /*#__PURE__*/react.createContext({});
19
+ var MapProvider = function MapProvider(_ref) {
20
+ var children = _ref.children,
21
+ onClick = _ref.onClick,
22
+ _ref$basemaps = _ref.basemaps,
23
+ basemaps = _ref$basemaps === void 0 ? index.BASEMAPS : _ref$basemaps,
24
+ _ref$center = _ref.center,
25
+ center = _ref$center === void 0 ? index.DEFAULT_VIEWPOINT.point : _ref$center,
26
+ _ref$zoom = _ref.zoom,
27
+ zoom = _ref$zoom === void 0 ? index.DEFAULT_VIEWPOINT.zoom : _ref$zoom,
28
+ _ref$enable3D = _ref.enable3D,
29
+ enable3D = _ref$enable3D === void 0 ? false : _ref$enable3D,
30
+ _ref$disableDrag = _ref.disableDrag,
31
+ disableDrag = _ref$disableDrag === void 0 ? false : _ref$disableDrag,
32
+ _ref$disableZoom = _ref.disableZoom,
33
+ disableZoom = _ref$disableZoom === void 0 ? false : _ref$disableZoom;
34
+ var _useState = react.useState(null),
35
+ _useState2 = _slicedToArray(_useState, 2),
36
+ map = _useState2[0],
37
+ setMap = _useState2[1];
38
+ var _useState3 = react.useState(),
39
+ _useState4 = _slicedToArray(_useState3, 2),
40
+ view = _useState4[0],
41
+ setView = _useState4[1];
42
+ var _useState5 = react.useState(false),
43
+ _useState6 = _slicedToArray(_useState5, 2),
44
+ is3D = _useState6[0],
45
+ setIs3D = _useState6[1];
46
+ var defaultBaseMap = react.useMemo(function () {
47
+ var _basemaps$find;
48
+ return (_basemaps$find = basemaps.find(function (b) {
49
+ return b["default"];
50
+ })) !== null && _basemaps$find !== void 0 ? _basemaps$find : basemaps[0];
51
+ }, [basemaps]);
52
+ react.useEffect(function () {
53
+ view === null || view === void 0 || view.navigation.set("actionMap", {
54
+ dragPrimary: disableDrag ? "none" : "pan",
55
+ dragSecondary: !disableDrag && is3D ? "rotate" : "none",
56
+ dragTertiary: disableZoom ? "none" : "zoom",
57
+ mouseWheel: disableZoom ? "none" : "zoom"
58
+ });
59
+ }, [view, disableDrag, disableZoom, is3D]);
60
+ react.useEffect(function () {
61
+ if (view && onClick) {
62
+ var handleClick = view.on("click", function (event) {
63
+ var _event$mapPoint$latit, _event$mapPoint$longi;
64
+ event.button === 0 && onClick({
65
+ latitude: (_event$mapPoint$latit = event.mapPoint.latitude) !== null && _event$mapPoint$latit !== void 0 ? _event$mapPoint$latit : 0,
66
+ longitude: (_event$mapPoint$longi = event.mapPoint.longitude) !== null && _event$mapPoint$longi !== void 0 ? _event$mapPoint$longi : 0
67
+ });
68
+ });
69
+ return function () {
70
+ handleClick.remove();
71
+ };
72
+ }
73
+ }, [view, onClick]);
74
+ var E = react.useMemo(function () {
75
+ return enable3D && is3D ? mapComponentsReact.ArcgisScene : mapComponentsReact.ArcgisMap;
76
+ }, [is3D, enable3D]);
77
+ return /*#__PURE__*/jsxRuntime.jsx(Context.Provider, {
78
+ value: {
79
+ map: map,
80
+ view: view,
81
+ is3D: is3D,
82
+ disableDrag: disableDrag,
83
+ disableZoom: disableZoom,
84
+ basemaps: basemaps,
85
+ center: center,
86
+ zoom: zoom
87
+ },
88
+ children: /*#__PURE__*/jsxRuntime.jsxs(E, {
89
+ onArcgisViewReadyChange: function onArcgisViewReadyChange(e) {
90
+ e.target.map && setMap(e.target.map);
91
+ e.target.view && setView(e.target.view);
92
+ },
93
+ className: "area-content overflow-hidden",
94
+ basemap: new Basemap({
95
+ baseLayers: defaultBaseMap === null || defaultBaseMap === void 0 ? void 0 : defaultBaseMap.layers.map(function (layer) {
96
+ return new VectorTileLayer("url" in layer ? {
97
+ url: layer.url
98
+ } : {
99
+ portalItem: {
100
+ id: layer.portalId
101
+ }
102
+ });
103
+ }),
104
+ title: defaultBaseMap === null || defaultBaseMap === void 0 ? void 0 : defaultBaseMap.title,
105
+ thumbnailUrl: defaultBaseMap === null || defaultBaseMap === void 0 ? void 0 : defaultBaseMap.thumbnail
106
+ }),
107
+ zoom: zoom,
108
+ center: new Point(utilities.getLatitudeLongitude(center)),
109
+ spatialReference: new SpatialReference({
110
+ wkid: 3857
111
+ }),
112
+ children: [enable3D && /*#__PURE__*/jsxRuntime.jsx(calciteComponentsReact.CalciteButton, {
113
+ appearance: "solid",
114
+ kind: "neutral",
115
+ slot: "top-right",
116
+ className: "mb-2",
117
+ iconStart: is3D ? "layer-basemap" : "globe",
118
+ onClick: function onClick() {
119
+ return setIs3D(function (n) {
120
+ return !n;
121
+ });
122
+ }
123
+ }), children]
124
+ })
125
+ });
126
+ };
127
+ var useMap = function useMap() {
128
+ return react.useContext(Context);
129
+ };
130
+
131
+ exports.MapProvider = MapProvider;
132
+ exports.useMap = useMap;
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
5
+ require('@arcgis/core/assets/esri/themes/light/main.css');
6
+ var core = require('@react-fabric/core');
7
+ var react = require('react');
8
+ var Context = require('./Context.js');
9
+ var jsxRuntime = require('react/jsx-runtime');
10
+
11
+ var _excluded = ["children"];
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), !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; }
14
+ var MapViewer = function MapViewer(_ref) {
15
+ var children = _ref.children,
16
+ props = _objectWithoutProperties(_ref, _excluded);
17
+ var isDark = core.useIsDark();
18
+ react.useEffect(function () {
19
+ document.documentElement.classList.toggle("calcite-mode-dark", isDark);
20
+ }, [isDark]);
21
+ return /*#__PURE__*/jsxRuntime.jsx(core.Section, {
22
+ className: "relative",
23
+ children: /*#__PURE__*/jsxRuntime.jsx(Context.MapProvider, _objectSpread(_objectSpread({}, props), {}, {
24
+ children: children
25
+ }))
26
+ });
27
+ };
28
+
29
+ exports.MapViewer = MapViewer;
@@ -0,0 +1,48 @@
1
+ 'use client';
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
+ export { BASEMAPS, DEFAULT_VIEWPOINT };
@@ -0,0 +1,68 @@
1
+ 'use client';
2
+
3
+ import esriConfig from '@arcgis/core/config';
4
+ export { MapViewer } from './viewer/Viewer.js';
5
+ import { BasemapGallery } from './tools/BasemapGallery.js';
6
+ import { Home } from './tools/Home.js';
7
+ import { LayerList } from './tools/LayerList.js';
8
+ import { ScaleBar } from './tools/ScaleBar.js';
9
+ import { Zoom } from './tools/Zoom.js';
10
+ import { JsonLayer } from './layers/Json.js';
11
+ import { MarkerLayer } from './layers/Marker.js';
12
+ import { Fill } from './markers/Fill.js';
13
+ import { Pin } from './markers/Pin.js';
14
+ import { useHeatmapRenderer } from './renderers/Heatmap.js';
15
+ import { useSimpleRenderer } from './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
+ var MapTools;
45
+ (function (_MapTools) {
46
+ _MapTools.BasemapGallery = BasemapGallery;
47
+ _MapTools.LayerList = LayerList;
48
+ _MapTools.Zoom = Zoom;
49
+ _MapTools.ScaleBar = ScaleBar;
50
+ _MapTools.Home = Home;
51
+ })(MapTools || (MapTools = {}));
52
+ var MapLayers;
53
+ (function (_MapLayers) {
54
+ _MapLayers.Markers = MarkerLayer;
55
+ _MapLayers.Json = JsonLayer;
56
+ })(MapLayers || (MapLayers = {}));
57
+ var MapMarkers;
58
+ (function (_MapMarkers) {
59
+ _MapMarkers.Fill = Fill;
60
+ _MapMarkers.Pin = Pin;
61
+ })(MapMarkers || (MapMarkers = {}));
62
+ var MapRenderers;
63
+ (function (_MapRenderers) {
64
+ _MapRenderers.useSimple = useSimpleRenderer;
65
+ _MapRenderers.useHeatmap = useHeatmapRenderer;
66
+ })(MapRenderers || (MapRenderers = {}));
67
+
68
+ export { MapLayers, MapMarkers, MapRenderers, MapTools, setArcgisAssetsPath };
@@ -0,0 +1,31 @@
1
+ 'use client';
2
+
3
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
+ import GeoJSONLayer from '@arcgis/core/layers/GeoJSONLayer';
5
+ import { useMemo, useEffect } from 'react';
6
+ import { useMap } from '../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 = useMap(),
12
+ map = _useMap.map,
13
+ view = _useMap.view;
14
+ var layer = useMemo(function () {
15
+ return new GeoJSONLayer(_objectSpread({}, props));
16
+ }, [props]);
17
+ 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
+ export { JsonLayer };
@@ -0,0 +1,46 @@
1
+ 'use client';
2
+
3
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
+ import GraphicsLayer from '@arcgis/core/layers/GraphicsLayer';
5
+ import '@arcgis/map-components/components/arcgis-features';
6
+ import { useMemo, useEffect, createContext, useContext } from 'react';
7
+ import { useMap } from '../viewer/Context.js';
8
+ import { jsx } from 'react/jsx-runtime';
9
+
10
+ var _excluded = ["children"];
11
+ var MarkerContext = /*#__PURE__*/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 = useMap(),
19
+ map = _useMap.map,
20
+ view = _useMap.view;
21
+ var layer = useMemo(function () {
22
+ return new GraphicsLayer(Object.assign({
23
+ visible: true,
24
+ listMode: "show"
25
+ }, props));
26
+ }, [props]);
27
+ 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__*/jsx(MarkerContext.Provider, {
38
+ value: layer,
39
+ children: children
40
+ });
41
+ };
42
+ var useMarkerLayer = function useMarkerLayer() {
43
+ return useContext(MarkerContext);
44
+ };
45
+
46
+ export { MarkerLayer, useMarkerLayer };