@react-fabric/map 1.0.0-beta.58 → 1.0.0-beta.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var esriConfig = require('@arcgis/core/config');
4
- var Viewer = require('./viewer/Viewer.js');
5
4
  var BasemapGallery = require('./tools/BasemapGallery.js');
6
5
  var Home = require('./tools/Home.js');
7
6
  var LayerList = require('./tools/LayerList.js');
@@ -13,6 +12,7 @@ var Fill = require('./markers/Fill.js');
13
12
  var Pin = require('./markers/Pin.js');
14
13
  var Heatmap = require('./renderers/Heatmap.js');
15
14
  var Simple = require('./renderers/Simple.js');
15
+ var Viewer = require('./viewer/Viewer.js');
16
16
 
17
17
  /*
18
18
  * React Fabric
@@ -16,8 +16,8 @@ var JsonLayer = function JsonLayer(props) {
16
16
  }, [props]);
17
17
  react.useEffect(function () {
18
18
  if (map && view) {
19
- layer.when(function () {
20
- view.goTo(layer.fullExtent);
19
+ void layer.when(function () {
20
+ void view.goTo(layer.fullExtent);
21
21
  });
22
22
  map.add(layer);
23
23
  return function () {
@@ -26,9 +26,9 @@ var MarkerLayer = function MarkerLayer(_ref) {
26
26
  }, [props]);
27
27
  react.useEffect(function () {
28
28
  if (map && view) {
29
- view === null || view === void 0 || view.when(function () {
29
+ void (view === null || view === void 0 ? void 0 : view.when(function () {
30
30
  map === null || map === void 0 || map.layers.add(layer);
31
- });
31
+ }));
32
32
  return function () {
33
33
  map === null || map === void 0 || map.layers.remove(layer);
34
34
  };
@@ -50,7 +50,7 @@ var Fill = function Fill(_ref) {
50
50
  react.useEffect(function () {
51
51
  if (layer && coords) {
52
52
  var tmr = null;
53
- layer.when(function () {
53
+ void layer.when(function () {
54
54
  layer.add(graphic);
55
55
  if (animate && !is3D) {
56
56
  var up = 0.1;
@@ -62,7 +62,7 @@ var Pin = function Pin(_ref) {
62
62
  react.useEffect(function () {
63
63
  if (layer && coords) {
64
64
  var tmr = null;
65
- layer.when(function () {
65
+ void layer.when(function () {
66
66
  layer.add(graphic);
67
67
  var symbol = graphic.symbol;
68
68
  if (symbol.style === "path") symbol.yoffset = symbol.size / 2;
@@ -78,7 +78,7 @@ var Home = function Home(_ref) {
78
78
  var navigate = react.useCallback(function (idx) {
79
79
  if (history.length > 0 && history[idx] && view) {
80
80
  isNavigatingHistory.current = true;
81
- view.goTo(history[idx]);
81
+ void view.goTo(history[idx]);
82
82
  setActiveIndex(idx);
83
83
  }
84
84
  }, [history]);
@@ -95,7 +95,7 @@ var Home = function Home(_ref) {
95
95
  }
96
96
  }
97
97
  });
98
- view.goTo((_extent = extent) !== null && _extent !== void 0 ? _extent : new Viewpoint({
98
+ void view.goTo((_extent = 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/esm/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  'use client';
2
2
 
3
3
  import esriConfig from '@arcgis/core/config';
4
- export { MapViewer } from './viewer/Viewer.js';
5
4
  import { BasemapGallery } from './tools/BasemapGallery.js';
6
5
  import { Home } from './tools/Home.js';
7
6
  import { LayerList } from './tools/LayerList.js';
@@ -13,6 +12,7 @@ import { Fill } from './markers/Fill.js';
13
12
  import { Pin } from './markers/Pin.js';
14
13
  import { useHeatmapRenderer } from './renderers/Heatmap.js';
15
14
  import { useSimpleRenderer } from './renderers/Simple.js';
15
+ export { MapViewer } from './viewer/Viewer.js';
16
16
 
17
17
  /*
18
18
  * React Fabric
@@ -16,8 +16,8 @@ var JsonLayer = function JsonLayer(props) {
16
16
  }, [props]);
17
17
  useEffect(function () {
18
18
  if (map && view) {
19
- layer.when(function () {
20
- view.goTo(layer.fullExtent);
19
+ void layer.when(function () {
20
+ void view.goTo(layer.fullExtent);
21
21
  });
22
22
  map.add(layer);
23
23
  return function () {
@@ -26,9 +26,9 @@ var MarkerLayer = function MarkerLayer(_ref) {
26
26
  }, [props]);
27
27
  useEffect(function () {
28
28
  if (map && view) {
29
- view === null || view === void 0 || view.when(function () {
29
+ void (view === null || view === void 0 ? void 0 : view.when(function () {
30
30
  map === null || map === void 0 || map.layers.add(layer);
31
- });
31
+ }));
32
32
  return function () {
33
33
  map === null || map === void 0 || map.layers.remove(layer);
34
34
  };
@@ -50,7 +50,7 @@ var Fill = function Fill(_ref) {
50
50
  useEffect(function () {
51
51
  if (layer && coords) {
52
52
  var tmr = null;
53
- layer.when(function () {
53
+ void layer.when(function () {
54
54
  layer.add(graphic);
55
55
  if (animate && !is3D) {
56
56
  var up = 0.1;
@@ -62,7 +62,7 @@ var Pin = function Pin(_ref) {
62
62
  useEffect(function () {
63
63
  if (layer && coords) {
64
64
  var tmr = null;
65
- layer.when(function () {
65
+ void layer.when(function () {
66
66
  layer.add(graphic);
67
67
  var symbol = graphic.symbol;
68
68
  if (symbol.style === "path") symbol.yoffset = symbol.size / 2;
@@ -59,7 +59,7 @@ var Home = function Home(_ref) {
59
59
  var navigate = useCallback(function (idx) {
60
60
  if (history.length > 0 && history[idx] && view) {
61
61
  isNavigatingHistory.current = true;
62
- view.goTo(history[idx]);
62
+ void view.goTo(history[idx]);
63
63
  setActiveIndex(idx);
64
64
  }
65
65
  }, [history]);
@@ -76,7 +76,7 @@ var Home = function Home(_ref) {
76
76
  }
77
77
  }
78
78
  });
79
- view.goTo((_extent = extent) !== null && _extent !== void 0 ? _extent : new Viewpoint({
79
+ void view.goTo((_extent = 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
  }));
@@ -1,8 +1,8 @@
1
1
  import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer";
2
2
  import "@arcgis/map-components/components/arcgis-features";
3
- import { ReactElement } from "react";
4
- import { Fill } from "../markers/Fill";
5
- import { Pin } from "../markers/Pin";
3
+ import { type ReactElement } from "react";
4
+ import { type Fill } from "../markers/Fill";
5
+ import { type Pin } from "../markers/Pin";
6
6
  type MarkerChildren = ReactElement<typeof Fill | typeof Pin>;
7
7
  /**
8
8
  * MarkerLayer component for displaying a layer of markers on the map.
@@ -1,4 +1,4 @@
1
- import { LngLatLike } from "@react-fabric/utilities";
1
+ import { type LngLatLike } from "@react-fabric/utilities";
2
2
  /**
3
3
  * Fill graphic for displaying a fill polygon on the map.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { LngLatLike } from "@react-fabric/utilities";
1
+ import { type LngLatLike } from "@react-fabric/utilities";
2
2
  type Markers = "pin" | "pin-radius" | "marker" | "marker-radius";
3
3
  /**
4
4
  * Pin graphic for displaying a pin on the map.
@@ -1,5 +1,4 @@
1
- import { LngLatLike } from "@react-fabric/utilities";
2
- import { ReactNode } from "react";
1
+ import { type LngLatLike } from "@react-fabric/utilities";
3
2
  export interface FabricBaseMap {
4
3
  title?: string;
5
4
  thumbnail?: string;
@@ -11,7 +10,7 @@ export interface FabricBaseMap {
11
10
  }>;
12
11
  }
13
12
  export interface MapViewerProps {
14
- children?: ReactNode;
13
+ children?: React.ReactNode;
15
14
  /**
16
15
  * Initial center position of the map viewer.
17
16
  */
@@ -1,8 +1,8 @@
1
1
  import "@arcgis/map-components/components/arcgis-map";
2
2
  import "@arcgis/map-components/components/arcgis-popup";
3
3
  import "@arcgis/map-components/components/arcgis-scene";
4
- import { LngLatLike } from "@react-fabric/utilities";
5
- import { FabricBaseMap, MapViewerProps } from "../types";
4
+ import { type LngLatLike } from "@react-fabric/utilities";
5
+ import { type FabricBaseMap, type MapViewerProps } from "../types";
6
6
  export declare const MapProvider: ({ children, onClick, basemaps, center, zoom, enable3D, disableDrag, disableZoom, }: MapViewerProps) => import("react/jsx-runtime").JSX.Element;
7
7
  export declare const useMap: () => {
8
8
  map?: __esri.Map | null;
@@ -1,3 +1,3 @@
1
1
  import "@arcgis/core/assets/esri/themes/light/main.css";
2
- import { MapViewerProps } from "../types";
2
+ import { type MapViewerProps } from "../types";
3
3
  export declare const MapViewer: ({ children, ...props }: MapViewerProps) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/map",
3
- "version": "1.0.0-beta.58",
3
+ "version": "1.0.0-beta.60",
4
4
  "description": "RUF: ArcGIS Map Component for React",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
@@ -39,8 +39,8 @@
39
39
  "@arcgis/map-components-react": "~4.34.5",
40
40
  "@esri/calcite-components-react": "~3.3.3",
41
41
  "@floating-ui/react": "~0.27.16",
42
- "@react-fabric/core": "^1.0.0-beta.58",
43
- "@react-fabric/utilities": "^1.0.0-beta.58",
42
+ "@react-fabric/core": "^1.0.0-beta.60",
43
+ "@react-fabric/utilities": "^1.0.0-beta.60",
44
44
  "color": "~5.0.2"
45
45
  },
46
46
  "peerDependencies": {
@@ -57,5 +57,5 @@
57
57
  "node": ">=18.12.0",
58
58
  "npm": ">=8.19.0"
59
59
  },
60
- "gitHead": "7e66f8c498e37a40e410ecafff2ea6b31505dc1a"
60
+ "gitHead": "a79f053ee7e13422c06d7d9c35d4f0c2610cdf5d"
61
61
  }
package/src/index.ts CHANGED
@@ -23,18 +23,27 @@
23
23
 
24
24
  import esriConfig from "@arcgis/core/config";
25
25
 
26
+ import { BasemapGallery as _BasemapGallery } from "./tools/BasemapGallery";
27
+ import { Home as _Home } from "./tools/Home";
28
+ import { LayerList as _LayerList } from "./tools/LayerList";
29
+ import { ScaleBar as _ScaleBar } from "./tools/ScaleBar";
30
+ import { Zoom as _Zoom } from "./tools/Zoom";
31
+
32
+ import { JsonLayer } from "./layers/Json";
33
+ import { MarkerLayer } from "./layers/Marker";
34
+
35
+ import { Fill as _Fill } from "./markers/Fill";
36
+ import { Pin as _Pin } from "./markers/Pin";
37
+
38
+ import { useHeatmapRenderer } from "./renderers/Heatmap";
39
+ import { useSimpleRenderer } from "./renderers/Simple";
40
+
26
41
  esriConfig.assetsPath = "/assets/@arcgis";
27
42
  export const setArcgisAssetsPath = (path: string) => {
28
43
  esriConfig.assetsPath = path;
29
44
  };
30
45
 
31
46
  export { MapViewer } from "./viewer/Viewer";
32
-
33
- import { BasemapGallery as _BasemapGallery } from "./tools/BasemapGallery";
34
- import { Home as _Home } from "./tools/Home";
35
- import { LayerList as _LayerList } from "./tools/LayerList";
36
- import { ScaleBar as _ScaleBar } from "./tools/ScaleBar";
37
- import { Zoom as _Zoom } from "./tools/Zoom";
38
47
  export namespace MapTools {
39
48
  export const BasemapGallery = _BasemapGallery;
40
49
  export const LayerList = _LayerList;
@@ -42,23 +51,14 @@ export namespace MapTools {
42
51
  export const ScaleBar = _ScaleBar;
43
52
  export const Home = _Home;
44
53
  }
45
-
46
- import { JsonLayer } from "./layers/Json";
47
- import { MarkerLayer } from "./layers/Marker";
48
54
  export namespace MapLayers {
49
55
  export const Markers = MarkerLayer;
50
56
  export const Json = JsonLayer;
51
57
  }
52
-
53
- import { Fill as _Fill } from "./markers/Fill";
54
- import { Pin as _Pin } from "./markers/Pin";
55
58
  export namespace MapMarkers {
56
59
  export const Fill = _Fill;
57
60
  export const Pin = _Pin;
58
61
  }
59
-
60
- import { useHeatmapRenderer } from "./renderers/Heatmap";
61
- import { useSimpleRenderer } from "./renderers/Simple";
62
62
  export namespace MapRenderers {
63
63
  export const useSimple = useSimpleRenderer;
64
64
  export const useHeatmap = useHeatmapRenderer;
@@ -22,7 +22,6 @@
22
22
  */
23
23
 
24
24
  import GeoJSONLayer from "@arcgis/core/layers/GeoJSONLayer";
25
- import SizeVariable from "@arcgis/core/renderers/visualVariables/SizeVariable";
26
25
  import { useEffect, useMemo } from "react";
27
26
  import { useMap } from "../viewer/Context";
28
27
 
@@ -37,8 +36,8 @@ export const JsonLayer = (props: __esri.GeoJSONLayerProperties) => {
37
36
 
38
37
  useEffect(() => {
39
38
  if (map && view) {
40
- layer.when(() => {
41
- view.goTo(layer.fullExtent);
39
+ void layer.when(() => {
40
+ void view.goTo(layer.fullExtent);
42
41
  });
43
42
  map.add(layer);
44
43
 
@@ -25,16 +25,18 @@ import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer";
25
25
  import "@arcgis/map-components/components/arcgis-features";
26
26
  import {
27
27
  createContext,
28
- ReactElement,
28
+ type ReactElement,
29
29
  useContext,
30
30
  useEffect,
31
31
  useMemo,
32
32
  } from "react";
33
- import { Fill } from "../markers/Fill";
34
- import { Pin } from "../markers/Pin";
33
+ import { type Fill } from "../markers/Fill";
34
+ import { type Pin } from "../markers/Pin";
35
35
  import { useMap } from "../viewer/Context";
36
36
 
37
- const MarkerContext = createContext<__esri.GraphicsLayer>(null!);
37
+ const MarkerContext = createContext<__esri.GraphicsLayer>(
38
+ null as unknown as __esri.GraphicsLayer,
39
+ );
38
40
 
39
41
  type MarkerChildren = ReactElement<typeof Fill | typeof Pin>;
40
42
 
@@ -65,7 +67,7 @@ export const MarkerLayer = ({
65
67
 
66
68
  useEffect(() => {
67
69
  if (map && view) {
68
- view?.when(() => {
70
+ void view?.when(() => {
69
71
  map?.layers.add(layer);
70
72
  });
71
73
 
@@ -24,7 +24,7 @@
24
24
  import Polygon from "@arcgis/core/geometry/Polygon";
25
25
  import Graphic from "@arcgis/core/Graphic";
26
26
  import SimpleFillSymbol from "@arcgis/core/symbols/SimpleFillSymbol";
27
- import { LngLatLike, convertLatLng } from "@react-fabric/utilities";
27
+ import { type LngLatLike, convertLatLng } from "@react-fabric/utilities";
28
28
  import { useEffect, useMemo } from "react";
29
29
  import { useMarkerLayer } from "../layers/Marker";
30
30
  import Color from "color";
@@ -84,7 +84,7 @@ export const Fill = ({
84
84
  useEffect(() => {
85
85
  if (layer && coords) {
86
86
  let tmr: any = null;
87
- layer.when(() => {
87
+ void layer.when(() => {
88
88
  layer.add(graphic);
89
89
  if (animate && !is3D) {
90
90
  let up = 0.1;
@@ -24,7 +24,7 @@
24
24
  import Point from "@arcgis/core/geometry/Point";
25
25
  import Graphic from "@arcgis/core/Graphic";
26
26
  import SimpleMarkerSymbol from "@arcgis/core/symbols/SimpleMarkerSymbol";
27
- import { LngLatLike, getLatitudeLongitude } from "@react-fabric/utilities";
27
+ import { type LngLatLike, getLatitudeLongitude } from "@react-fabric/utilities";
28
28
  import { useEffect, useMemo } from "react";
29
29
  import { useMarkerLayer } from "../layers/Marker";
30
30
  import { useMap } from "../viewer/Context";
@@ -105,11 +105,10 @@ export const Pin = ({
105
105
  useEffect(() => {
106
106
  if (layer && coords) {
107
107
  let tmr: any = null;
108
- layer.when(() => {
108
+ void layer.when(() => {
109
109
  layer.add(graphic);
110
110
  const symbol = graphic.symbol as SimpleMarkerSymbol;
111
- if (symbol.style === "path")
112
- symbol.yoffset = (symbol.size as number) / 2;
111
+ if (symbol.style === "path") symbol.yoffset = symbol.size / 2;
113
112
  if (animate && !is3D) {
114
113
  const baseSize = symbol.size;
115
114
  let up = 2;
@@ -71,7 +71,7 @@ export const useHeatmapRenderer = (props?: Props) => {
71
71
  props?.colors && props.colors.length > 3
72
72
  ? props.colors.map((color, index, arr) => ({
73
73
  ratio: (index + 1) / arr.length,
74
- color: color,
74
+ color,
75
75
  }))
76
76
  : [
77
77
  ...Array.from({ length: 6 }, (_, i) => ({
@@ -71,7 +71,7 @@ export const useHeatmapRenderer = (props?: Props) => {
71
71
  props?.colors && props.colors.length > 3
72
72
  ? props.colors.map((color, index, arr) => ({
73
73
  ratio: (index + 1) / arr.length,
74
- color: color,
74
+ color,
75
75
  }))
76
76
  : [
77
77
  ...Array.from({ length: 6 }, (_, i) => ({
@@ -60,7 +60,7 @@ export interface Props {
60
60
  export const useSimpleRenderer = (props?: Props) => {
61
61
  const renderer = useMemo(() => {
62
62
  const vizVars = [];
63
- let styleProps: any = { style: props?.style ?? "circle" };
63
+ const styleProps: any = { style: props?.style ?? "circle" };
64
64
  if (props?.path) {
65
65
  styleProps.style = "path";
66
66
  styleProps.path = props.path;
@@ -69,7 +69,7 @@ export const Home = ({ enableHistory }: { enableHistory?: boolean }) => {
69
69
  (idx: number) => {
70
70
  if (history.length > 0 && history[idx] && view) {
71
71
  isNavigatingHistory.current = true;
72
- view.goTo(history[idx]);
72
+ void view.goTo(history[idx]);
73
73
  setActiveIndex(idx);
74
74
  }
75
75
  },
@@ -88,7 +88,7 @@ export const Home = ({ enableHistory }: { enableHistory?: boolean }) => {
88
88
  }
89
89
  }
90
90
  });
91
- view.goTo(
91
+ void view.goTo(
92
92
  extent ??
93
93
  new Viewpoint({
94
94
  scale: view.tileInfo?.zoomToScale(zoom),
@@ -21,8 +21,7 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import { LngLatLike } from "@react-fabric/utilities";
25
- import { ReactNode } from "react";
24
+ import { type LngLatLike } from "@react-fabric/utilities";
26
25
 
27
26
  export interface FabricBaseMap {
28
27
  title?: string;
@@ -32,7 +31,7 @@ export interface FabricBaseMap {
32
31
  }
33
32
 
34
33
  export interface MapViewerProps {
35
- children?: ReactNode;
34
+ children?: React.ReactNode;
36
35
  /**
37
36
  * Initial center position of the map viewer.
38
37
  */
@@ -30,10 +30,10 @@ import "@arcgis/map-components/components/arcgis-map";
30
30
  import "@arcgis/map-components/components/arcgis-popup";
31
31
  import "@arcgis/map-components/components/arcgis-scene";
32
32
  import { CalciteButton } from "@esri/calcite-components-react";
33
- import { getLatitudeLongitude, LngLatLike } from "@react-fabric/utilities";
33
+ import { getLatitudeLongitude, type LngLatLike } from "@react-fabric/utilities";
34
34
  import { createContext, useContext, useEffect, useMemo, useState } from "react";
35
35
  import { BASEMAPS, DEFAULT_VIEWPOINT } from "../constants";
36
- import { FabricBaseMap, MapViewerProps } from "../types";
36
+ import { type FabricBaseMap, type MapViewerProps } from "../types";
37
37
 
38
38
  const Context = createContext<{
39
39
  map?: __esri.Map | null;
@@ -24,7 +24,7 @@
24
24
  import "@arcgis/core/assets/esri/themes/light/main.css";
25
25
  import { Section, useIsDark } from "@react-fabric/core";
26
26
  import { useEffect } from "react";
27
- import { MapViewerProps } from "../types";
27
+ import { type MapViewerProps } from "../types";
28
28
  import { MapProvider } from "./Context";
29
29
 
30
30
  export const MapViewer = ({ children, ...props }: MapViewerProps) => {