@react-fabric/map 1.0.0-beta.63 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/cjs/index.js +24 -18
  2. package/dist/cjs/layers/Json.js +3 -3
  3. package/dist/cjs/layers/Marker.js +3 -3
  4. package/dist/cjs/markers/Fill.js +10 -9
  5. package/dist/cjs/markers/Pin.js +7 -7
  6. package/dist/cjs/markers/context.js +1 -1
  7. package/dist/cjs/renderers/Heatmap.js +2 -2
  8. package/dist/cjs/renderers/Simple.js +5 -4
  9. package/dist/cjs/tools/BasemapGallery.js +6 -7
  10. package/dist/cjs/tools/Home.js +17 -18
  11. package/dist/cjs/tools/LayerList.js +4 -5
  12. package/dist/cjs/tools/ScaleBar.js +3 -4
  13. package/dist/cjs/tools/Zoom.js +3 -4
  14. package/dist/cjs/viewer/Provider.js +9 -13
  15. package/dist/cjs/viewer/Viewer.js +2 -2
  16. package/dist/cjs/viewer/context.js +1 -1
  17. package/dist/esm/index.js +23 -19
  18. package/dist/esm/layers/Json.js +3 -3
  19. package/dist/esm/layers/Marker.js +3 -3
  20. package/dist/esm/markers/Fill.js +11 -10
  21. package/dist/esm/markers/Pin.js +7 -7
  22. package/dist/esm/markers/context.js +2 -2
  23. package/dist/esm/renderers/Heatmap.js +2 -2
  24. package/dist/esm/renderers/Simple.js +5 -4
  25. package/dist/esm/tools/BasemapGallery.js +6 -7
  26. package/dist/esm/tools/Home.js +17 -18
  27. package/dist/esm/tools/LayerList.js +4 -5
  28. package/dist/esm/tools/ScaleBar.js +3 -4
  29. package/dist/esm/tools/Zoom.js +3 -4
  30. package/dist/esm/viewer/Provider.js +9 -13
  31. package/dist/esm/viewer/Viewer.js +3 -3
  32. package/dist/esm/viewer/context.js +2 -2
  33. package/dist/types/index.d.ts +48 -63
  34. package/dist/types/layers/Json.d.ts +1 -1
  35. package/dist/types/layers/Marker.d.ts +2 -2
  36. package/dist/types/markers/Fill.d.ts +2 -2
  37. package/dist/types/markers/Pin.d.ts +2 -2
  38. package/dist/types/markers/context.d.ts +1 -1
  39. package/dist/types/renderers/Cluster.d.ts +1 -1
  40. package/dist/types/renderers/Heatmap.d.ts +1 -1
  41. package/dist/types/renderers/Simple.d.ts +1 -1
  42. package/dist/types/tools/BasemapGallery.d.ts +1 -1
  43. package/dist/types/tools/Home.d.ts +3 -3
  44. package/dist/types/tools/LayerList.d.ts +1 -1
  45. package/dist/types/tools/ScaleBar.d.ts +1 -1
  46. package/dist/types/tools/Zoom.d.ts +1 -1
  47. package/dist/types/viewer/Provider.d.ts +1 -1
  48. package/dist/types/viewer/Viewer.d.ts +1 -1
  49. package/dist/types/viewer/context.d.ts +10 -17
  50. package/package.json +14 -20
  51. package/src/index.ts +23 -18
  52. package/src/layers/Json.tsx +2 -2
  53. package/src/layers/Marker.tsx +4 -4
  54. package/src/markers/Fill.tsx +17 -18
  55. package/src/markers/Pin.tsx +11 -11
  56. package/src/markers/context.ts +3 -3
  57. package/src/renderers/Cluster.tsx +2 -2
  58. package/src/renderers/Heatmap.tsx +2 -2
  59. package/src/renderers/Simple.tsx +6 -6
  60. package/src/tools/BasemapGallery.tsx +10 -9
  61. package/src/tools/Home.tsx +24 -21
  62. package/src/tools/LayerList.tsx +7 -13
  63. package/src/tools/ScaleBar.tsx +5 -4
  64. package/src/tools/Zoom.tsx +5 -4
  65. package/src/viewer/Provider.tsx +14 -13
  66. package/src/viewer/Viewer.tsx +3 -3
  67. package/src/viewer/context.ts +11 -9
@@ -1,73 +1,58 @@
1
+ /**
2
+ * React Fabric
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2024 Adarsh Pastakia
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ export declare const MAP_PACKAGE = "@react-fabric/map";
26
+ export declare const MAP_VERSION = "1.0.0";
27
+ import { BasemapGallery as _BasemapGallery } from "./tools/BasemapGallery";
28
+ import { Home as _Home } from "./tools/Home";
29
+ import { LayerList as _LayerList } from "./tools/LayerList";
30
+ import { ScaleBar as _ScaleBar } from "./tools/ScaleBar";
31
+ import { Zoom as _Zoom } from "./tools/Zoom";
32
+ import { JsonLayer } from "./layers/Json";
33
+ import { MarkerLayer } from "./layers/Marker";
34
+ import { Fill as _Fill } from "./markers/Fill";
35
+ import { Pin as _Pin } from "./markers/Pin";
36
+ import { useHeatmapRenderer } from "./renderers/Heatmap";
37
+ import { useSimpleRenderer } from "./renderers/Simple";
1
38
  export declare const setArcgisAssetsPath: (path: string) => void;
2
39
  export { MapViewer } from "./viewer/Viewer";
3
40
  export declare namespace MapTools {
4
- const BasemapGallery: () => import("react/jsx-runtime").JSX.Element;
5
- const LayerList: () => import("react/jsx-runtime").JSX.Element;
6
- const Zoom: () => false | import("react/jsx-runtime").JSX.Element;
7
- const ScaleBar: () => import("react/jsx-runtime").JSX.Element;
8
- const Home: ({ enableHistory }: {
9
- enableHistory?: boolean;
10
- }) => false | import("react/jsx-runtime").JSX.Element;
41
+ const BasemapGallery: typeof _BasemapGallery;
42
+ const LayerList: typeof _LayerList;
43
+ const Zoom: typeof _Zoom;
44
+ const ScaleBar: typeof _ScaleBar;
45
+ const Home: typeof _Home;
11
46
  }
12
47
  export declare namespace MapLayers {
13
- const Markers: ({ children, ...props }: Omit<import("@arcgis/core/layers/GraphicsLayer").GraphicsLayerProperties, "graphics"> & {
14
- children?: import("react").ReactElement<(({ coords, style, color, borderWidth, borderColor, animate, ...props }: {
15
- coords: import("@react-fabric/utilities").LngLatLike[];
16
- color?: string;
17
- style?: "backward-diagonal" | "cross" | "diagonal-cross" | "forward-diagonal" | "horizontal" | "none" | "solid" | "vertical";
18
- borderWidth?: string | number;
19
- borderColor?: string;
20
- animate?: boolean;
21
- } & Omit<import("@arcgis/core/Graphic").GraphicProperties, "geometry" | "symbol">) => null) | (({ coords, style, size, color, path, borderWidth, borderColor, animate, ...props }: {
22
- coords: import("@react-fabric/utilities").LngLatLike;
23
- size?: string | number;
24
- color?: string;
25
- path?: string;
26
- style?: "circle" | "square" | "cross" | "x" | "diamond" | "triangle" | ("pin" | "pin-radius" | "marker" | "marker-radius");
27
- borderWidth?: string | number;
28
- borderColor?: string;
29
- animate?: boolean;
30
- } & Omit<import("@arcgis/core/Graphic").GraphicProperties, "geometry" | "symbol">) => null), string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<(({ coords, style, color, borderWidth, borderColor, animate, ...props }: {
31
- coords: import("@react-fabric/utilities").LngLatLike[];
32
- color?: string;
33
- style?: "backward-diagonal" | "cross" | "diagonal-cross" | "forward-diagonal" | "horizontal" | "none" | "solid" | "vertical";
34
- borderWidth?: string | number;
35
- borderColor?: string;
36
- animate?: boolean;
37
- } & Omit<import("@arcgis/core/Graphic").GraphicProperties, "geometry" | "symbol">) => null) | (({ coords, style, size, color, path, borderWidth, borderColor, animate, ...props }: {
38
- coords: import("@react-fabric/utilities").LngLatLike;
39
- size?: string | number;
40
- color?: string;
41
- path?: string;
42
- style?: "circle" | "square" | "cross" | "x" | "diamond" | "triangle" | ("pin" | "pin-radius" | "marker" | "marker-radius");
43
- borderWidth?: string | number;
44
- borderColor?: string;
45
- animate?: boolean;
46
- } & Omit<import("@arcgis/core/Graphic").GraphicProperties, "geometry" | "symbol">) => null), string | import("react").JSXElementConstructor<any>>[];
47
- }) => import("react/jsx-runtime").JSX.Element;
48
- const Json: (props: import("@arcgis/core/layers/GeoJSONLayer").GeoJSONLayerProperties) => null;
48
+ const Markers: typeof MarkerLayer;
49
+ const Json: typeof JsonLayer;
49
50
  }
50
51
  export declare namespace MapMarkers {
51
- const Fill: ({ coords, style, color, borderWidth, borderColor, animate, ...props }: {
52
- coords: import("@react-fabric/utilities").LngLatLike[];
53
- color?: string;
54
- style?: "backward-diagonal" | "cross" | "diagonal-cross" | "forward-diagonal" | "horizontal" | "none" | "solid" | "vertical";
55
- borderWidth?: string | number;
56
- borderColor?: string;
57
- animate?: boolean;
58
- } & Omit<import("@arcgis/core/Graphic").GraphicProperties, "geometry" | "symbol">) => null;
59
- const Pin: ({ coords, style, size, color, path, borderWidth, borderColor, animate, ...props }: {
60
- coords: import("@react-fabric/utilities").LngLatLike;
61
- size?: string | number;
62
- color?: string;
63
- path?: string;
64
- style?: "circle" | "square" | "cross" | "x" | "diamond" | "triangle" | ("pin" | "pin-radius" | "marker" | "marker-radius");
65
- borderWidth?: string | number;
66
- borderColor?: string;
67
- animate?: boolean;
68
- } & Omit<import("@arcgis/core/Graphic").GraphicProperties, "geometry" | "symbol">) => null;
52
+ const Fill: typeof _Fill;
53
+ const Pin: typeof _Pin;
69
54
  }
70
55
  export declare namespace MapRenderers {
71
- const useSimple: (props?: import("./renderers/Simple").Props) => import("@arcgis/core/renderers/SimpleRenderer").default;
72
- const useHeatmap: (props?: import("./renderers/Heatmap").Props) => import("@arcgis/core/renderers/HeatmapRenderer").default;
56
+ const useSimple: typeof useSimpleRenderer;
57
+ const useHeatmap: typeof useHeatmapRenderer;
73
58
  }
@@ -1,2 +1,2 @@
1
1
  import { type GeoJSONLayerProperties } from "@arcgis/core/layers/GeoJSONLayer";
2
- export declare const JsonLayer: (props: GeoJSONLayerProperties) => null;
2
+ export declare function JsonLayer(props: GeoJSONLayerProperties): null;
@@ -7,7 +7,7 @@ type MarkerChildren = ReactElement<typeof Fill | typeof Pin>;
7
7
  /**
8
8
  * MarkerLayer component for displaying a layer of markers on the map.
9
9
  */
10
- export declare const MarkerLayer: ({ children, ...props }: Omit<GraphicsLayerProperties, "graphics"> & {
10
+ export declare function MarkerLayer({ children, ...props }: Omit<GraphicsLayerProperties, "graphics"> & {
11
11
  children?: MarkerChildren | MarkerChildren[];
12
- }) => import("react/jsx-runtime").JSX.Element;
12
+ }): import("react").JSX.Element;
13
13
  export {};
@@ -3,11 +3,11 @@ import { type LngLatLike } from "@react-fabric/utilities";
3
3
  /**
4
4
  * Fill graphic for displaying a fill polygon on the map.
5
5
  */
6
- export declare const Fill: ({ coords, style, color, borderWidth, borderColor, animate, ...props }: {
6
+ export declare function Fill({ coords, style, color, borderWidth, borderColor, animate, ...props }: {
7
7
  coords: LngLatLike[];
8
8
  color?: string;
9
9
  style?: "backward-diagonal" | "cross" | "diagonal-cross" | "forward-diagonal" | "horizontal" | "none" | "solid" | "vertical";
10
10
  borderWidth?: string | number;
11
11
  borderColor?: string;
12
12
  animate?: boolean;
13
- } & Omit<GraphicProperties, "geometry" | "symbol">) => null;
13
+ } & Omit<GraphicProperties, "geometry" | "symbol">): null;
@@ -4,7 +4,7 @@ type Markers = "pin" | "pin-radius" | "marker" | "marker-radius";
4
4
  /**
5
5
  * Pin graphic for displaying a pin on the map.
6
6
  */
7
- export declare const Pin: ({ coords, style, size, color, path, borderWidth, borderColor, animate, ...props }: {
7
+ export declare function Pin({ coords, style, size, color, path, borderWidth, borderColor, animate, ...props }: {
8
8
  coords: LngLatLike;
9
9
  size?: string | number;
10
10
  color?: string;
@@ -13,5 +13,5 @@ export declare const Pin: ({ coords, style, size, color, path, borderWidth, bord
13
13
  borderWidth?: string | number;
14
14
  borderColor?: string;
15
15
  animate?: boolean;
16
- } & Omit<GraphicProperties, "geometry" | "symbol">) => null;
16
+ } & Omit<GraphicProperties, "geometry" | "symbol">): null;
17
17
  export {};
@@ -1,3 +1,3 @@
1
- import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer";
1
+ import type GraphicsLayer from "@arcgis/core/layers/GraphicsLayer";
2
2
  export declare const MarkerContext: import("react").Context<GraphicsLayer>;
3
3
  export declare const useMarkerLayer: () => GraphicsLayer;
@@ -15,5 +15,5 @@ interface Props {
15
15
  minDensity?: HeatmapRendererProperties["minDensity"];
16
16
  maxDensity?: HeatmapRendererProperties["maxDensity"];
17
17
  }
18
- export declare const useHeatmapRenderer: (props?: Props) => HeatmapRenderer;
18
+ export declare function useHeatmapRenderer(props?: Props): HeatmapRenderer;
19
19
  export {};
@@ -15,4 +15,4 @@ export interface Props {
15
15
  minDensity?: HeatmapRendererProperties["minDensity"];
16
16
  maxDensity?: HeatmapRendererProperties["maxDensity"];
17
17
  }
18
- export declare const useHeatmapRenderer: (props?: Props) => HeatmapRenderer;
18
+ export declare function useHeatmapRenderer(props?: Props): HeatmapRenderer;
@@ -35,4 +35,4 @@ export interface Props {
35
35
  color: string;
36
36
  }>;
37
37
  }
38
- export declare const useSimpleRenderer: (props?: Props) => SimpleRenderer;
38
+ export declare function useSimpleRenderer(props?: Props): SimpleRenderer;
@@ -1,4 +1,4 @@
1
1
  import "@arcgis/map-components/components/arcgis-basemap-gallery";
2
2
  import "@arcgis/map-components/components/arcgis-basemap-layer-list";
3
3
  import "@arcgis/map-components/components/arcgis-expand";
4
- export declare const BasemapGallery: () => import("react/jsx-runtime").JSX.Element;
4
+ export declare function BasemapGallery(): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
- import "@arcgis/map-components/components/arcgis-placement";
2
- export declare const Home: ({ enableHistory }: {
1
+ import "@esri/calcite-components/components/calcite-button";
2
+ export declare function Home({ enableHistory }: {
3
3
  enableHistory?: boolean;
4
- }) => false | import("react/jsx-runtime").JSX.Element;
4
+ }): false | import("react").JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import "@arcgis/map-components/components/arcgis-expand";
2
2
  import "@arcgis/map-components/components/arcgis-layer-list";
3
- export declare const LayerList: () => import("react/jsx-runtime").JSX.Element;
3
+ export declare function LayerList(): import("react").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import "@arcgis/map-components/components/arcgis-scale-bar";
2
- export declare const ScaleBar: () => import("react/jsx-runtime").JSX.Element;
2
+ export declare function ScaleBar(): import("react").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import "@arcgis/map-components/components/arcgis-zoom";
2
- export declare const Zoom: () => false | import("react/jsx-runtime").JSX.Element;
2
+ export declare function Zoom(): false | import("react").JSX.Element;
@@ -2,4 +2,4 @@ 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
4
  import { type MapViewerProps } from "../types";
5
- export declare const MapProvider: ({ children, onClick, basemaps, center, zoom, enable3D, disableDrag, disableZoom, }: MapViewerProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare function MapProvider({ children, onClick, basemaps, center, zoom, enable3D, disableDrag, disableZoom, }: MapViewerProps): import("react").JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import "@arcgis/core/assets/esri/themes/light/main.css";
2
2
  import { type MapViewerProps } from "../types";
3
- export declare const MapViewer: ({ children, ...props }: MapViewerProps) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const MapViewer: ({ children, ...props }: MapViewerProps) => import("react").JSX.Element;
@@ -1,9 +1,9 @@
1
- import Map from "@arcgis/core/Map";
2
- import MapView from "@arcgis/core/views/MapView";
3
- import SceneView from "@arcgis/core/views/SceneView";
4
- import { LngLatLike } from "@react-fabric/utilities";
5
- import { FabricBaseMap } from "../types";
6
- export declare const MapContext: import("react").Context<{
1
+ import type Map from "@arcgis/core/Map";
2
+ import type MapView from "@arcgis/core/views/MapView";
3
+ import type SceneView from "@arcgis/core/views/SceneView";
4
+ import type { LngLatLike } from "@react-fabric/utilities";
5
+ import type { FabricBaseMap } from "../types";
6
+ interface ContextType {
7
7
  map?: Map | null;
8
8
  view?: MapView | SceneView;
9
9
  disableDrag?: boolean;
@@ -12,14 +12,7 @@ export declare const MapContext: import("react").Context<{
12
12
  center: LngLatLike;
13
13
  zoom: number;
14
14
  is3D: boolean;
15
- }>;
16
- export declare const useMap: () => {
17
- map?: Map | null;
18
- view?: MapView | SceneView;
19
- disableDrag?: boolean;
20
- disableZoom?: boolean;
21
- basemaps: FabricBaseMap[];
22
- center: LngLatLike;
23
- zoom: number;
24
- is3D: boolean;
25
- };
15
+ }
16
+ export declare const MapContext: import("react").Context<ContextType>;
17
+ export declare const useMap: () => ContextType;
18
+ export {};
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@react-fabric/map",
3
- "version": "1.0.0-beta.63",
3
+ "version": "1.0.1",
4
4
  "description": "RUF: ArcGIS Map Component for React",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
7
- "repository": "https://github.com/adarshpastakia/react-ui-framework/tree/main/packages/map",
7
+ "repository": "https://github.com/adarshpastakia/react-fabric/tree/main/packages/map",
8
8
  "source": "src/index.ts",
9
9
  "main": "dist/cjs/index.js",
10
10
  "module": "dist/esm/index.js",
@@ -24,8 +24,6 @@
24
24
  "registry": "https://registry.npmjs.org/"
25
25
  },
26
26
  "scripts": {
27
- "makelink": "yarn link",
28
- "removelink": "yarn unlink",
29
27
  "prebuild": "rm -rf ./dist",
30
28
  "build:dts": "tsc -p ./tsconfig.build.json",
31
29
  "build:rollup": "rollup -c ../../rollup.config.mjs",
@@ -35,27 +33,23 @@
35
33
  "watch": "npm-run-all -p watch:rollup watch:dts"
36
34
  },
37
35
  "dependencies": {
38
- "@arcgis/core": "~5.0.10",
39
- "@arcgis/map-components-react": "~4.34.5",
40
- "@esri/calcite-components-react": "~3.3.3",
41
- "@react-fabric/core": "^1.0.0-beta.63",
42
- "@react-fabric/utilities": "^1.0.0-beta.63",
36
+ "@arcgis/core": "~5.1.21",
37
+ "@arcgis/map-components": "~5.1.21",
38
+ "@esri/calcite-components": "~5.1.2",
39
+ "@react-fabric/core": "^1.0.1",
40
+ "@react-fabric/utilities": "^1.0.1",
43
41
  "chroma-js": "~3.2.0",
44
42
  "dom-to-image": "~2.6.0"
45
43
  },
46
44
  "peerDependencies": {
47
- "i18next": "~25.8.18",
48
- "react": "~19.2.4",
49
- "react-dom": "~19.2.4",
50
- "react-i18next": "~16.5.8"
51
- },
52
- "devDependencies": {
53
- "@types/dom-to-image": "~2.6.7",
54
- "@types/highlight.js": "~10.1.0"
45
+ "i18next": "~26.3.6",
46
+ "react": "~19.3.0",
47
+ "react-dom": "~19.3.0",
48
+ "react-i18next": "~17.0.11"
55
49
  },
56
50
  "engines": {
57
- "node": ">=22.18.0",
58
- "npm": ">=10.8.0"
51
+ "node": ">=24.0.0",
52
+ "npm": ">=11.0.0"
59
53
  },
60
- "gitHead": "6e0652b15c6384fbc316842862572e21299a5466"
54
+ "gitHead": "1419a9df05b5e3850e1d2b4e896ab63df702c7e8"
61
55
  }
package/src/index.ts CHANGED
@@ -1,26 +1,31 @@
1
- /*
1
+ /**
2
2
  * React Fabric
3
- * @version: 1.0.0
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2024 Adarsh Pastakia
4
6
  *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
5
13
  *
6
- * The MIT License (MIT)
7
- * Copyright (c) 2025 Adarsh Pastakia
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
8
16
  *
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.
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
22
24
  */
23
25
 
26
+ export const MAP_PACKAGE = "@react-fabric/map";
27
+ export const MAP_VERSION = "1.0.0";
28
+
24
29
  import esriConfig from "@arcgis/core/config";
25
30
 
26
31
  import { BasemapGallery as _BasemapGallery } from "./tools/BasemapGallery";
@@ -38,7 +43,7 @@ import { Pin as _Pin } from "./markers/Pin";
38
43
  import { useHeatmapRenderer } from "./renderers/Heatmap";
39
44
  import { useSimpleRenderer } from "./renderers/Simple";
40
45
 
41
- esriConfig.assetsPath = "/assets/@arcgis";
46
+ esriConfig.assetsPath = "./assets/@arcgis";
42
47
  export const setArcgisAssetsPath = (path: string) => {
43
48
  esriConfig.assetsPath = path;
44
49
  };
@@ -25,7 +25,7 @@ import GeoJSONLayer, { type GeoJSONLayerProperties } from "@arcgis/core/layers/G
25
25
  import { useEffect, useMemo } from "react";
26
26
  import { useMap } from "../viewer/context";
27
27
 
28
- export const JsonLayer = (props: GeoJSONLayerProperties) => {
28
+ export function JsonLayer(props: GeoJSONLayerProperties) {
29
29
  const { map, view } = useMap();
30
30
 
31
31
  const layer = useMemo(() => {
@@ -48,4 +48,4 @@ export const JsonLayer = (props: GeoJSONLayerProperties) => {
48
48
  }, [map, view, layer]);
49
49
 
50
50
  return null;
51
- };
51
+ }
@@ -34,12 +34,12 @@ type MarkerChildren = ReactElement<typeof Fill | typeof Pin>;
34
34
  /**
35
35
  * MarkerLayer component for displaying a layer of markers on the map.
36
36
  */
37
- export const MarkerLayer = ({
37
+ export function MarkerLayer({
38
38
  children,
39
39
  ...props
40
40
  }: Omit<GraphicsLayerProperties, "graphics"> & {
41
41
  children?: MarkerChildren | MarkerChildren[];
42
- }) => {
42
+ }) {
43
43
  const { map, view } = useMap();
44
44
 
45
45
  const layer = useMemo(
@@ -68,5 +68,5 @@ export const MarkerLayer = ({
68
68
  }
69
69
  }, [layer, map, view]);
70
70
 
71
- return <MarkerContext.Provider value={layer}>{children}</MarkerContext.Provider>;
72
- };
71
+ return <MarkerContext value={layer}>{children}</MarkerContext>;
72
+ }
@@ -24,7 +24,7 @@
24
24
  import Polygon from "@arcgis/core/geometry/Polygon";
25
25
  import Graphic, { type GraphicProperties } from "@arcgis/core/Graphic";
26
26
  import SimpleFillSymbol from "@arcgis/core/symbols/SimpleFillSymbol";
27
- import { type LngLatLike, convertLatLng } from "@react-fabric/utilities";
27
+ import { type LngLatLike, convertToLonLat } from "@react-fabric/utilities";
28
28
  import chroma from "chroma-js";
29
29
  import { useEffect, useMemo } from "react";
30
30
  import { useMap } from "../viewer/context";
@@ -33,7 +33,7 @@ import { useMarkerLayer } from "./context";
33
33
  /**
34
34
  * Fill graphic for displaying a fill polygon on the map.
35
35
  */
36
- export const Fill = ({
36
+ export function Fill({
37
37
  coords,
38
38
  style = "solid",
39
39
  color = "#f00",
@@ -48,7 +48,7 @@ export const Fill = ({
48
48
  borderWidth?: string | number;
49
49
  borderColor?: string;
50
50
  animate?: boolean;
51
- } & Omit<GraphicProperties, "geometry" | "symbol">) => {
51
+ } & Omit<GraphicProperties, "geometry" | "symbol">) {
52
52
  const layer = useMarkerLayer();
53
53
  const { is3D } = useMap();
54
54
 
@@ -56,18 +56,16 @@ export const Fill = ({
56
56
  () =>
57
57
  new Graphic({
58
58
  geometry: new Polygon({
59
- rings: [coords.map(convertLatLng)],
59
+ rings: [coords.map(convertToLonLat)],
60
+ }),
61
+ symbol: new SimpleFillSymbol({
62
+ style,
63
+ color,
64
+ outline: {
65
+ color: borderColor,
66
+ width: borderWidth,
67
+ },
60
68
  }),
61
- symbol: new SimpleFillSymbol(
62
- Object.assign({
63
- style,
64
- color,
65
- outline: {
66
- color: borderColor,
67
- width: borderWidth,
68
- },
69
- } as any),
70
- ),
71
69
  ...props,
72
70
  }),
73
71
  [coords, style, color, borderColor, borderWidth, props],
@@ -75,7 +73,7 @@ export const Fill = ({
75
73
 
76
74
  useEffect(() => {
77
75
  if (layer && coords) {
78
- let tmr: any = null;
76
+ let tmr: NodeJS.Timeout;
79
77
  void layer.when(() => {
80
78
  layer.add(graphic);
81
79
  if (animate && !is3D) {
@@ -87,7 +85,8 @@ export const Fill = ({
87
85
  if (sat >= 0.9) up = -0.1;
88
86
  if (sat <= 0.1) up = 0.1;
89
87
  sat += up;
90
- symbol.color = chroma(color as any)
88
+ symbol.color = chroma
89
+ .rgb(...color)
91
90
  .darken(sat)
92
91
  .rgba();
93
92
  requestAnimationFrame(() => {
@@ -102,7 +101,7 @@ export const Fill = ({
102
101
  layer.remove(graphic);
103
102
  };
104
103
  }
105
- }, [layer, graphic, animate, is3D]);
104
+ }, [layer, graphic, animate, is3D, coords]);
106
105
 
107
106
  return null;
108
- };
107
+ }
@@ -30,7 +30,7 @@ import { useMap } from "../viewer/context";
30
30
  import { useMarkerLayer } from "./context";
31
31
 
32
32
  type Markers = "pin" | "pin-radius" | "marker" | "marker-radius";
33
- const paths: Record<Markers, string> = {
33
+ const paths = {
34
34
  marker:
35
35
  "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",
36
36
  "marker-radius":
@@ -38,12 +38,12 @@ const paths: Record<Markers, string> = {
38
38
  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",
39
39
  "pin-radius":
40
40
  "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",
41
- };
41
+ } as const;
42
42
 
43
43
  /**
44
44
  * Pin graphic for displaying a pin on the map.
45
45
  */
46
- export const Pin = ({
46
+ export function Pin({
47
47
  coords,
48
48
  style = "circle",
49
49
  size = 18,
@@ -62,7 +62,7 @@ export const Pin = ({
62
62
  borderWidth?: string | number;
63
63
  borderColor?: string;
64
64
  animate?: boolean;
65
- } & Omit<GraphicProperties, "geometry" | "symbol">) => {
65
+ } & Omit<GraphicProperties, "geometry" | "symbol">) {
66
66
  const layer = useMarkerLayer();
67
67
  const { is3D } = useMap();
68
68
 
@@ -73,17 +73,17 @@ export const Pin = ({
73
73
  symbol: new SimpleMarkerSymbol(
74
74
  Object.assign(
75
75
  {
76
- style,
76
+ style: style as never,
77
77
  color,
78
78
  size,
79
79
  outline: {
80
80
  color: borderColor,
81
81
  width: borderWidth,
82
82
  },
83
- } as any,
84
- style && style.toString() in paths
83
+ },
84
+ style && style in paths
85
85
  ? {
86
- path: (paths as any)[style.toString()],
86
+ path: paths[style as never],
87
87
  style: "path",
88
88
  }
89
89
  : {},
@@ -97,7 +97,7 @@ export const Pin = ({
97
97
 
98
98
  useEffect(() => {
99
99
  if (layer && coords) {
100
- let tmr: any = null;
100
+ let tmr: NodeJS.Timeout;
101
101
  void layer.when(() => {
102
102
  layer.add(graphic);
103
103
  const symbol = graphic.symbol as SimpleMarkerSymbol;
@@ -122,7 +122,7 @@ export const Pin = ({
122
122
  layer.remove(graphic);
123
123
  };
124
124
  }
125
- }, [layer, graphic, animate, is3D]);
125
+ }, [layer, graphic, animate, is3D, coords]);
126
126
 
127
127
  return null;
128
- };
128
+ }
@@ -21,9 +21,9 @@
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 GraphicsLayer from "@arcgis/core/layers/GraphicsLayer";
25
- import { createContext, useContext } from "react";
24
+ import type GraphicsLayer from "@arcgis/core/layers/GraphicsLayer";
25
+ import { createContext, use } from "react";
26
26
 
27
27
  export const MarkerContext = createContext<GraphicsLayer>(null as unknown as GraphicsLayer);
28
28
 
29
- export const useMarkerLayer = () => useContext(MarkerContext);
29
+ export const useMarkerLayer = () => use(MarkerContext);
@@ -43,7 +43,7 @@ interface Props {
43
43
  maxDensity?: HeatmapRendererProperties["maxDensity"];
44
44
  }
45
45
 
46
- export const useHeatmapRenderer = (props?: Props) => {
46
+ export function useHeatmapRenderer(props?: Props) {
47
47
  const renderer = useMemo(() => {
48
48
  let colorHigh = "#FFE600FF";
49
49
  let colorMid = "#FF8C00FF";
@@ -92,4 +92,4 @@ export const useHeatmapRenderer = (props?: Props) => {
92
92
  });
93
93
  }, [props]);
94
94
  return renderer;
95
- };
95
+ }