national-metadata 0.1.4 → 0.1.5

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 (129) hide show
  1. package/dist/mapping/index.d.ts +26 -0
  2. package/dist/mapping/index.d.ts.map +1 -0
  3. package/dist/mapping/index.js +16 -0
  4. package/dist/mapping/index.js.map +1 -0
  5. package/dist/mapping/src/components/Annotation.d.ts +13 -0
  6. package/dist/mapping/src/components/Annotation.d.ts.map +1 -0
  7. package/dist/mapping/src/components/Annotation.js +15 -0
  8. package/dist/mapping/src/components/Annotation.js.map +1 -0
  9. package/dist/mapping/src/components/ComposableMap.d.ts +13 -0
  10. package/dist/mapping/src/components/ComposableMap.d.ts.map +1 -0
  11. package/dist/mapping/src/components/ComposableMap.js +9 -0
  12. package/dist/mapping/src/components/ComposableMap.js.map +1 -0
  13. package/dist/mapping/src/components/Geographies.d.ts +20 -0
  14. package/dist/mapping/src/components/Geographies.d.ts.map +1 -0
  15. package/dist/mapping/src/components/Geographies.js +16 -0
  16. package/dist/mapping/src/components/Geographies.js.map +1 -0
  17. package/dist/mapping/src/components/Geography.d.ts +21 -0
  18. package/dist/mapping/src/components/Geography.d.ts.map +1 -0
  19. package/dist/mapping/src/components/Geography.js +44 -0
  20. package/dist/mapping/src/components/Geography.js.map +1 -0
  21. package/dist/mapping/src/components/Graticule.d.ts +10 -0
  22. package/dist/mapping/src/components/Graticule.d.ts.map +1 -0
  23. package/dist/mapping/src/components/Graticule.js +10 -0
  24. package/dist/mapping/src/components/Graticule.js.map +1 -0
  25. package/dist/mapping/src/components/Line.d.ts +13 -0
  26. package/dist/mapping/src/components/Line.d.ts.map +1 -0
  27. package/dist/mapping/src/components/Line.js +13 -0
  28. package/dist/mapping/src/components/Line.js.map +1 -0
  29. package/dist/mapping/src/components/MapProvider.d.ts +26 -0
  30. package/dist/mapping/src/components/MapProvider.d.ts.map +1 -0
  31. package/dist/mapping/src/components/MapProvider.js +62 -0
  32. package/dist/mapping/src/components/MapProvider.js.map +1 -0
  33. package/dist/mapping/src/components/Marker.d.ts +21 -0
  34. package/dist/mapping/src/components/Marker.d.ts.map +1 -0
  35. package/dist/mapping/src/components/Marker.js +48 -0
  36. package/dist/mapping/src/components/Marker.js.map +1 -0
  37. package/dist/mapping/src/components/Sphere.d.ts +11 -0
  38. package/dist/mapping/src/components/Sphere.d.ts.map +1 -0
  39. package/dist/mapping/src/components/Sphere.js +14 -0
  40. package/dist/mapping/src/components/Sphere.js.map +1 -0
  41. package/dist/mapping/src/components/ZoomPanProvider.d.ts +14 -0
  42. package/dist/mapping/src/components/ZoomPanProvider.d.ts.map +1 -0
  43. package/dist/mapping/src/components/ZoomPanProvider.js +16 -0
  44. package/dist/mapping/src/components/ZoomPanProvider.js.map +1 -0
  45. package/dist/mapping/src/components/ZoomableGroup.d.ts +30 -0
  46. package/dist/mapping/src/components/ZoomableGroup.d.ts.map +1 -0
  47. package/dist/mapping/src/components/ZoomableGroup.js +24 -0
  48. package/dist/mapping/src/components/ZoomableGroup.js.map +1 -0
  49. package/dist/mapping/src/components/useGeographies.d.ts +13 -0
  50. package/dist/mapping/src/components/useGeographies.d.ts.map +1 -0
  51. package/dist/mapping/src/components/useGeographies.js +41 -0
  52. package/dist/mapping/src/components/useGeographies.js.map +1 -0
  53. package/dist/mapping/src/components/useZoomPan.d.ts +36 -0
  54. package/dist/mapping/src/components/useZoomPan.d.ts.map +1 -0
  55. package/dist/mapping/src/components/useZoomPan.js +129 -0
  56. package/dist/mapping/src/components/useZoomPan.js.map +1 -0
  57. package/dist/mapping/src/index.d.ts +14 -0
  58. package/dist/mapping/src/index.d.ts.map +1 -0
  59. package/dist/mapping/src/index.js +14 -0
  60. package/dist/mapping/src/index.js.map +1 -0
  61. package/dist/mapping/src/utils.d.ts +29 -0
  62. package/dist/mapping/src/utils.d.ts.map +1 -0
  63. package/dist/mapping/src/utils.js +71 -0
  64. package/dist/mapping/src/utils.js.map +1 -0
  65. package/dist/react-simple-maps/index.d.ts +14 -0
  66. package/dist/react-simple-maps/index.d.ts.map +1 -0
  67. package/dist/react-simple-maps/index.js +16 -0
  68. package/dist/react-simple-maps/index.js.map +1 -0
  69. package/dist/react-simple-maps/src/components/Annotation.d.ts +3 -0
  70. package/dist/react-simple-maps/src/components/Annotation.d.ts.map +1 -0
  71. package/dist/react-simple-maps/src/components/Annotation.js +27 -0
  72. package/dist/react-simple-maps/src/components/Annotation.js.map +1 -0
  73. package/dist/react-simple-maps/src/components/ComposableMap.d.ts +3 -0
  74. package/dist/react-simple-maps/src/components/ComposableMap.d.ts.map +1 -0
  75. package/dist/react-simple-maps/src/components/ComposableMap.js +17 -0
  76. package/dist/react-simple-maps/src/components/ComposableMap.js.map +1 -0
  77. package/dist/react-simple-maps/src/components/Geographies.d.ts +3 -0
  78. package/dist/react-simple-maps/src/components/Geographies.d.ts.map +1 -0
  79. package/dist/react-simple-maps/src/components/Geographies.js +27 -0
  80. package/dist/react-simple-maps/src/components/Geographies.js.map +1 -0
  81. package/dist/react-simple-maps/src/components/Geography.d.ts +3 -0
  82. package/dist/react-simple-maps/src/components/Geography.d.ts.map +1 -0
  83. package/dist/react-simple-maps/src/components/Geography.js +59 -0
  84. package/dist/react-simple-maps/src/components/Geography.js.map +1 -0
  85. package/dist/react-simple-maps/src/components/Graticule.d.ts +3 -0
  86. package/dist/react-simple-maps/src/components/Graticule.d.ts.map +1 -0
  87. package/dist/react-simple-maps/src/components/Graticule.js +17 -0
  88. package/dist/react-simple-maps/src/components/Graticule.js.map +1 -0
  89. package/dist/react-simple-maps/src/components/Line.d.ts +3 -0
  90. package/dist/react-simple-maps/src/components/Line.d.ts.map +1 -0
  91. package/dist/react-simple-maps/src/components/Line.js +23 -0
  92. package/dist/react-simple-maps/src/components/Line.js.map +1 -0
  93. package/dist/react-simple-maps/src/components/MapProvider.d.ts +18 -0
  94. package/dist/react-simple-maps/src/components/MapProvider.d.ts.map +1 -0
  95. package/dist/react-simple-maps/src/components/MapProvider.js +63 -0
  96. package/dist/react-simple-maps/src/components/MapProvider.js.map +1 -0
  97. package/dist/react-simple-maps/src/components/Marker.d.ts +3 -0
  98. package/dist/react-simple-maps/src/components/Marker.d.ts.map +1 -0
  99. package/dist/react-simple-maps/src/components/Marker.js +66 -0
  100. package/dist/react-simple-maps/src/components/Marker.js.map +1 -0
  101. package/dist/react-simple-maps/src/components/Sphere.d.ts +3 -0
  102. package/dist/react-simple-maps/src/components/Sphere.d.ts.map +1 -0
  103. package/dist/react-simple-maps/src/components/Sphere.js +22 -0
  104. package/dist/react-simple-maps/src/components/Sphere.js.map +1 -0
  105. package/dist/react-simple-maps/src/components/ZoomPanProvider.d.ts +20 -0
  106. package/dist/react-simple-maps/src/components/ZoomPanProvider.d.ts.map +1 -0
  107. package/dist/react-simple-maps/src/components/ZoomPanProvider.js +23 -0
  108. package/dist/react-simple-maps/src/components/ZoomPanProvider.js.map +1 -0
  109. package/dist/react-simple-maps/src/components/ZoomableGroup.d.ts +3 -0
  110. package/dist/react-simple-maps/src/components/ZoomableGroup.d.ts.map +1 -0
  111. package/dist/react-simple-maps/src/components/ZoomableGroup.js +36 -0
  112. package/dist/react-simple-maps/src/components/ZoomableGroup.js.map +1 -0
  113. package/dist/react-simple-maps/src/components/useGeographies.d.ts +9 -0
  114. package/dist/react-simple-maps/src/components/useGeographies.d.ts.map +1 -0
  115. package/dist/react-simple-maps/src/components/useGeographies.js +40 -0
  116. package/dist/react-simple-maps/src/components/useGeographies.js.map +1 -0
  117. package/dist/react-simple-maps/src/components/useZoomPan.d.ts +15 -0
  118. package/dist/react-simple-maps/src/components/useZoomPan.d.ts.map +1 -0
  119. package/dist/react-simple-maps/src/components/useZoomPan.js +114 -0
  120. package/dist/react-simple-maps/src/components/useZoomPan.js.map +1 -0
  121. package/dist/react-simple-maps/src/index.d.ts +14 -0
  122. package/dist/react-simple-maps/src/index.d.ts.map +1 -0
  123. package/dist/react-simple-maps/src/index.js +14 -0
  124. package/dist/react-simple-maps/src/index.js.map +1 -0
  125. package/dist/react-simple-maps/src/utils.d.ts +18 -0
  126. package/dist/react-simple-maps/src/utils.d.ts.map +1 -0
  127. package/dist/react-simple-maps/src/utils.js +65 -0
  128. package/dist/react-simple-maps/src/utils.js.map +1 -0
  129. package/package.json +36 -2
@@ -0,0 +1,30 @@
1
+ import React, { ReactNode } from "react";
2
+ export interface ZoomableGroupProps extends React.SVGProps<SVGGElement> {
3
+ center?: [number, number];
4
+ zoom?: number;
5
+ minZoom?: number;
6
+ maxZoom?: number;
7
+ translateExtent?: [[number, number], [number, number]];
8
+ filterZoomEvent?: (event: any) => boolean;
9
+ onMoveStart?: (position: {
10
+ x: number;
11
+ y: number;
12
+ k: number;
13
+ dragging?: boolean;
14
+ }, event?: any) => void;
15
+ onMove?: (position: {
16
+ x: number;
17
+ y: number;
18
+ zoom: number;
19
+ dragging?: boolean;
20
+ }, event?: any) => void;
21
+ onMoveEnd?: (position: {
22
+ coordinates?: [number, number];
23
+ zoom?: number;
24
+ }, event?: any) => void;
25
+ className?: string;
26
+ children?: ReactNode;
27
+ }
28
+ declare const ZoomableGroup: React.ForwardRefExoticComponent<Omit<ZoomableGroupProps, "ref"> & React.RefAttributes<SVGGElement>>;
29
+ export default ZoomableGroup;
30
+ //# sourceMappingURL=ZoomableGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ZoomableGroup.d.ts","sourceRoot":"","sources":["../../../../src/mapping/src/components/ZoomableGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA0B,SAAS,EAAE,MAAM,OAAO,CAAC;AAKjE,MAAM,WAAW,kBAAmB,SAAQ,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC;IACrE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC;IAC1C,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACvG,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACrG,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE;QAAE,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,QAAA,MAAM,aAAa,qGAiDlB,CAAC;AAIF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,24 @@
1
+ import React, { useContext, forwardRef } from "react";
2
+ import { MapContext } from "./MapProvider";
3
+ import { ZoomPanProvider } from "./ZoomPanProvider";
4
+ import useZoomPan from "./useZoomPan";
5
+ const ZoomableGroup = forwardRef(({ center = [0, 0], zoom = 1, minZoom = 1, maxZoom = 8, translateExtent, filterZoomEvent, onMoveStart, onMove, onMoveEnd, className = "", children, ...restProps }, ref) => {
6
+ const { width, height } = useContext(MapContext);
7
+ const { mapRef, transformString, position } = useZoomPan({
8
+ center,
9
+ filterZoomEvent,
10
+ onMoveStart,
11
+ onMove,
12
+ onMoveEnd,
13
+ scaleExtent: [minZoom, maxZoom],
14
+ translateExtent,
15
+ zoom,
16
+ });
17
+ return (React.createElement(ZoomPanProvider, { value: { x: position.x, y: position.y, k: position.k, transformString } },
18
+ React.createElement("g", { ref: mapRef },
19
+ React.createElement("rect", { width: width, height: height, fill: "transparent" }),
20
+ React.createElement("g", { ref: ref, transform: transformString, className: `rsm-zoomable-group ${className}`, ...restProps }, children))));
21
+ });
22
+ ZoomableGroup.displayName = "ZoomableGroup";
23
+ export default ZoomableGroup;
24
+ //# sourceMappingURL=ZoomableGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ZoomableGroup.js","sourceRoot":"","sources":["../../../../src/mapping/src/components/ZoomableGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAa,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,UAAU,MAAM,cAAc,CAAC;AAgBtC,MAAM,aAAa,GAAG,UAAU,CAC9B,CACE,EACE,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EACf,IAAI,GAAG,CAAC,EACR,OAAO,GAAG,CAAC,EACX,OAAO,GAAG,CAAC,EACX,eAAe,EACf,eAAe,EACf,WAAW,EACX,MAAM,EACN,SAAS,EACT,SAAS,GAAG,EAAE,EACd,QAAQ,EACR,GAAG,SAAS,EACb,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IAEjD,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC;QACvD,MAAM;QACN,eAAe;QACf,WAAW;QACX,MAAM;QACN,SAAS;QACT,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;QAC/B,eAAe;QACf,IAAI;KACL,CAAC,CAAC;IAEH,OAAO,CACL,oBAAC,eAAe,IACd,KAAK,EAAE,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,eAAe,EAAE;QAEvE,2BAAG,GAAG,EAAE,MAAM;YACZ,8BAAM,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAC,aAAa,GAAG;YACzD,2BACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,eAAe,EAC1B,SAAS,EAAE,sBAAsB,SAAS,EAAE,KACxC,SAAS,IAEZ,QAAQ,CACP,CACF,CACY,CACnB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC;AAE5C,eAAe,aAAa,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Feature } from "geojson";
2
+ import { Geography, PreparedFeature } from "../utils";
3
+ interface UseGeographiesOptions {
4
+ geography: string | Geography | Feature[];
5
+ parseGeographies?: (features: Feature[]) => Feature[];
6
+ }
7
+ export default function useGeographies({ geography, parseGeographies, }: UseGeographiesOptions): {
8
+ geographies: PreparedFeature[];
9
+ outline: PreparedFeature | undefined;
10
+ borders: PreparedFeature | undefined;
11
+ };
12
+ export {};
13
+ //# sourceMappingURL=useGeographies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGeographies.d.ts","sourceRoot":"","sources":["../../../../src/mapping/src/components/useGeographies.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAOL,SAAS,EACT,eAAe,EAChB,MAAM,UAAU,CAAC;AAElB,UAAU,qBAAqB;IAC7B,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,EAAE,CAAC;IAC1C,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,CAAC;CACvD;AAOD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,SAAS,EACT,gBAAgB,GACjB,EAAE,qBAAqB,GAAG;IACzB,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,OAAO,EAAE,eAAe,GAAG,SAAS,CAAC;IACrC,OAAO,EAAE,eAAe,GAAG,SAAS,CAAC;CACtC,CAsCA"}
@@ -0,0 +1,41 @@
1
+ import { useMemo, useState, useEffect, useContext } from "react";
2
+ import { MapContext } from "./MapProvider";
3
+ import { fetchGeographies, getFeatures, getMesh, prepareFeatures, isString, prepareMesh, } from "../utils";
4
+ export default function useGeographies({ geography, parseGeographies, }) {
5
+ const { path } = useContext(MapContext);
6
+ const [output, setOutput] = useState({});
7
+ useEffect(() => {
8
+ if (typeof window === `undefined`)
9
+ return;
10
+ if (!geography)
11
+ return;
12
+ if (isString(geography)) {
13
+ fetchGeographies(geography).then((geos) => {
14
+ if (geos) {
15
+ setOutput({
16
+ geographies: getFeatures(geos, parseGeographies),
17
+ mesh: getMesh(geos),
18
+ });
19
+ }
20
+ });
21
+ }
22
+ else {
23
+ const geographyData = geography;
24
+ setOutput({
25
+ geographies: getFeatures(geographyData, parseGeographies),
26
+ mesh: getMesh(geographyData),
27
+ });
28
+ }
29
+ }, [geography, parseGeographies]);
30
+ const { geographies, outline, borders } = useMemo(() => {
31
+ const mesh = output.mesh || { outline: undefined, borders: undefined };
32
+ const preparedMesh = prepareMesh(mesh.outline, mesh.borders, path);
33
+ return {
34
+ geographies: prepareFeatures(output.geographies, path),
35
+ outline: preparedMesh.outline,
36
+ borders: preparedMesh.borders,
37
+ };
38
+ }, [output, path]);
39
+ return { geographies, outline, borders };
40
+ }
41
+ //# sourceMappingURL=useGeographies.js.map
@@ -0,0 +1 @@
1
+ {"version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gB,CAAC,CAAC,CAAC;IAElC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE;QACrD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;QACvE,MAAM,YAAY,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACnE,OAAO;YACL,WAAW,EAAE,eAAe,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC;YACtD,OAAO,EAAE,YAAY,CAAC,OAAO;YAC7B,OAAO,EAAE,YAAY,CAAC,OAAO;SAC9B,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAEnB,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,36 @@
1
+ interface Position {
2
+ x: number;
3
+ y: number;
4
+ k: number;
5
+ dragging?: boolean;
6
+ }
7
+ interface UseZoomPanOptions {
8
+ center: [number, number];
9
+ filterZoomEvent?: (event: any) => boolean;
10
+ onMoveStart?: (position: {
11
+ x: number;
12
+ y: number;
13
+ k: number;
14
+ dragging?: boolean;
15
+ }, event?: any) => void;
16
+ onMoveEnd?: (position: {
17
+ coordinates?: [number, number];
18
+ zoom?: number;
19
+ }, event?: any) => void;
20
+ onMove?: (position: {
21
+ x: number;
22
+ y: number;
23
+ zoom: number;
24
+ dragging?: boolean;
25
+ }, event?: any) => void;
26
+ translateExtent?: [[number, number], [number, number]];
27
+ scaleExtent?: [number, number];
28
+ zoom?: number;
29
+ }
30
+ export default function useZoomPan({ center, filterZoomEvent, onMoveStart, onMoveEnd, onMove, translateExtent, scaleExtent, zoom, }: UseZoomPanOptions): {
31
+ mapRef: React.RefObject<SVGGElement | null>;
32
+ position: Position;
33
+ transformString: string;
34
+ };
35
+ export {};
36
+ //# sourceMappingURL=useZoomPan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useZoomPan.d.ts","sourceRoot":"","sources":["../../../../src/mapping/src/components/useZoomPan.ts"],"names":[],"mappings":"AAWA,UAAU,QAAQ;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,UAAU,iBAAiB;IACzB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC;IAC1C,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACvG,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE;QAAE,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/F,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACrG,eAAe,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,MAAM,EACN,eAAe,EACf,WAAW,EACX,SAAS,EACT,MAAM,EACN,eAGC,EACD,WAAoB,EACpB,IAAQ,GACT,EAAE,iBAAiB,GAAG;IACrB,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC5C,QAAQ,EAAE,QAAQ,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CACzB,CA2IA"}
@@ -0,0 +1,129 @@
1
+ import { useEffect, useRef, useState, useContext } from "react";
2
+ import { zoom as d3Zoom, zoomIdentity as d3ZoomIdentity, } from "d3-zoom";
3
+ import { select as d3Select } from "d3-selection";
4
+ import { MapContext } from "./MapProvider";
5
+ import { getCoords } from "../utils";
6
+ export default function useZoomPan({ center, filterZoomEvent, onMoveStart, onMoveEnd, onMove, translateExtent = [
7
+ [-Infinity, -Infinity],
8
+ [Infinity, Infinity],
9
+ ], scaleExtent = [1, 8], zoom = 1, }) {
10
+ const { width, height, projection } = useContext(MapContext);
11
+ const [lon, lat] = center;
12
+ const [position, setPosition] = useState({ x: 0, y: 0, k: 1 });
13
+ const lastPosition = useRef({ x: 0, y: 0, k: 1 });
14
+ const mapRef = useRef(null);
15
+ const zoomRef = useRef(undefined);
16
+ const bypassEvents = useRef(false);
17
+ const [a, b] = translateExtent;
18
+ const [a1, a2] = a;
19
+ const [b1, b2] = b;
20
+ const [minZoom, maxZoom] = scaleExtent;
21
+ useEffect(() => {
22
+ if (!mapRef.current)
23
+ return;
24
+ const svg = d3Select(mapRef.current);
25
+ function handleZoomStart(d3Event) {
26
+ if (!onMoveStart || bypassEvents.current)
27
+ return;
28
+ const inverter = projection.invert;
29
+ if (!inverter)
30
+ return;
31
+ const coords = inverter(getCoords(width, height, d3Event.transform));
32
+ onMoveStart({
33
+ x: coords ? coords[0] : 0,
34
+ y: coords ? coords[1] : 0,
35
+ k: d3Event.transform.k,
36
+ }, d3Event);
37
+ }
38
+ function handleZoom(d3Event) {
39
+ if (bypassEvents.current)
40
+ return;
41
+ const { transform, sourceEvent } = d3Event;
42
+ setPosition({
43
+ x: transform.x,
44
+ y: transform.y,
45
+ k: transform.k,
46
+ dragging: !!sourceEvent,
47
+ });
48
+ if (!onMove)
49
+ return;
50
+ onMove({
51
+ x: transform.x,
52
+ y: transform.y,
53
+ zoom: transform.k,
54
+ dragging: !!sourceEvent,
55
+ }, d3Event);
56
+ }
57
+ function handleZoomEnd(d3Event) {
58
+ if (bypassEvents.current) {
59
+ bypassEvents.current = false;
60
+ return;
61
+ }
62
+ const inverter = projection.invert;
63
+ if (!inverter)
64
+ return;
65
+ const coords = inverter(getCoords(width, height, d3Event.transform));
66
+ const [x, y] = coords || [0, 0];
67
+ lastPosition.current = { x, y, k: d3Event.transform.k };
68
+ if (!onMoveEnd)
69
+ return;
70
+ onMoveEnd({ coordinates: [x, y], zoom: d3Event.transform.k }, d3Event);
71
+ }
72
+ function filterFunc(d3Event) {
73
+ if (filterZoomEvent) {
74
+ return filterZoomEvent(d3Event);
75
+ }
76
+ return d3Event ? !d3Event.ctrlKey && !d3Event.button : false;
77
+ }
78
+ const zoom = d3Zoom()
79
+ .filter(filterFunc)
80
+ .scaleExtent([minZoom, maxZoom])
81
+ .translateExtent([
82
+ [a1, a2],
83
+ [b1, b2],
84
+ ])
85
+ .on("start", handleZoomStart)
86
+ .on("zoom", handleZoom)
87
+ .on("end", handleZoomEnd);
88
+ zoomRef.current = zoom;
89
+ svg.call(zoom);
90
+ }, [
91
+ width,
92
+ height,
93
+ a1,
94
+ a2,
95
+ b1,
96
+ b2,
97
+ minZoom,
98
+ maxZoom,
99
+ projection,
100
+ onMoveStart,
101
+ onMove,
102
+ onMoveEnd,
103
+ filterZoomEvent,
104
+ ]);
105
+ useEffect(() => {
106
+ if (lon === lastPosition.current.x &&
107
+ lat === lastPosition.current.y &&
108
+ zoom === lastPosition.current.k)
109
+ return;
110
+ if (!mapRef.current || !zoomRef.current)
111
+ return;
112
+ const coords = projection([lon, lat]);
113
+ if (!coords || coords.length < 2)
114
+ return;
115
+ const x = coords[0] * zoom;
116
+ const y = coords[1] * zoom;
117
+ const svg = d3Select(mapRef.current);
118
+ bypassEvents.current = true;
119
+ svg.call(zoomRef.current.transform, d3ZoomIdentity.translate(width / 2 - x, height / 2 - y).scale(zoom));
120
+ setPosition({ x: width / 2 - x, y: height / 2 - y, k: zoom });
121
+ lastPosition.current = { x: lon, y: lat, k: zoom };
122
+ }, [lon, lat, zoom, width, height, projection]);
123
+ return {
124
+ mapRef,
125
+ position,
126
+ transformString: `translate(${position.x} ${position.y}) scale(${position.k})`,
127
+ };
128
+ }
129
+ //# sourceMappingURL=useZoomPan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useZoomPan.js","sourceRoot":"","sources":["../../../../src/mapping/src/components/useZoomPan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EACL,IAAI,IAAI,MAAM,EACd,YAAY,IAAI,cAAc,GAG/B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAoBrC,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,MAAM,EACN,eAAe,EACf,WAAW,EACX,SAAS,EACT,MAAM,EACN,eAAe,GAAG;IAChB,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;IACtB,CAAC,QAAQ,EAAE,QAAQ,CAAC;CACrB,EACD,WAAW,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,IAAI,GAA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AG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IAEhD,OAAO;QACL,MAAM;QACN,QAAQ;QACR,eAAe,EAAE,aAAa,QAAQ,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,WAAW,QAAQ,CAAC,CAAC,GAAG;KAC/E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ export { default as ComposableMap } from "./components/ComposableMap";
2
+ export { default as Geographies } from "./components/Geographies";
3
+ export { default as Geography } from "./components/Geography";
4
+ export { default as Graticule } from "./components/Graticule";
5
+ export { default as ZoomableGroup } from "./components/ZoomableGroup";
6
+ export { default as Sphere } from "./components/Sphere";
7
+ export { default as Marker } from "./components/Marker";
8
+ export { default as Line } from "./components/Line";
9
+ export { default as Annotation } from "./components/Annotation";
10
+ export { MapProvider, MapContext, useMapContext, } from "./components/MapProvider";
11
+ export { ZoomPanProvider, ZoomPanContext, useZoomPanContext, } from "./components/ZoomPanProvider";
12
+ export { default as useGeographies } from "./components/useGeographies";
13
+ export { default as useZoomPan } from "./components/useZoomPan";
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mapping/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACL,WAAW,EACX,UAAU,EACV,aAAa,GACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,14 @@
1
+ export { default as ComposableMap } from "./components/ComposableMap";
2
+ export { default as Geographies } from "./components/Geographies";
3
+ export { default as Geography } from "./components/Geography";
4
+ export { default as Graticule } from "./components/Graticule";
5
+ export { default as ZoomableGroup } from "./components/ZoomableGroup";
6
+ export { default as Sphere } from "./components/Sphere";
7
+ export { default as Marker } from "./components/Marker";
8
+ export { default as Line } from "./components/Line";
9
+ export { default as Annotation } from "./components/Annotation";
10
+ export { MapProvider, MapContext, useMapContext, } from "./components/MapProvider";
11
+ export { ZoomPanProvider, ZoomPanContext, useZoomPanContext, } from "./components/ZoomPanProvider";
12
+ export { default as useGeographies } from "./components/useGeographies";
13
+ export { default as useZoomPan } from "./components/useZoomPan";
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mapping/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACL,WAAW,EACX,UAAU,EACV,aAAa,GACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { Topology } from "topojson-specification";
2
+ import type { Feature, FeatureCollection } from "geojson";
3
+ export interface Transform {
4
+ x: number;
5
+ y: number;
6
+ k: number;
7
+ }
8
+ export interface PreparedFeature extends Feature {
9
+ rsmKey: string;
10
+ svgPath: string;
11
+ }
12
+ export interface PreparedMesh {
13
+ outline?: PreparedFeature;
14
+ borders?: PreparedFeature;
15
+ }
16
+ export type Geography = Topology | FeatureCollection;
17
+ export type PathGenerator = (geo: any) => string | null;
18
+ export declare function getCoords(w: number, h: number, t: Transform): [number, number];
19
+ export declare function fetchGeographies(url: string): Promise<Geography | undefined>;
20
+ export declare function getFeatures(geographies: Geography, parseGeographies?: (features: Feature[]) => Feature[]): Feature[];
21
+ export declare function getMesh(geographies: Geography): {
22
+ outline: any;
23
+ borders: any;
24
+ } | null;
25
+ export declare function prepareMesh(outline: any, borders: any, path: PathGenerator): PreparedMesh;
26
+ export declare function prepareFeatures(geographies: Feature[] | null | undefined, path: PathGenerator): PreparedFeature[];
27
+ export declare function createConnectorPath(dx?: number, dy?: number, curve?: number | [number, number]): string;
28
+ export declare function isString(geo: any): geo is string;
29
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/mapping/src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAsB,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAA+B,MAAM,SAAS,CAAC;AAGvF,MAAM,WAAW,SAAS;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAGD,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAGD,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAGD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,iBAAiB,CAAC;AAGrD,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,GAAG,IAAI,CAAC;AAExD,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAI9E;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAY5E;AAED,wBAAgB,WAAW,CACzB,WAAW,EAAE,SAAS,EACtB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,GACpD,OAAO,EAAE,CAiBX;AAED,wBAAgB,OAAO,CAAC,WAAW,EAAE,SAAS,GAAG;IAAE,OAAO,EAAE,GAAG,CAAC;IAAC,OAAO,EAAE,GAAG,CAAA;CAAE,GAAG,IAAI,CAYrF;AAED,wBAAgB,WAAW,CACzB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,EACZ,IAAI,EAAE,aAAa,GAClB,YAAY,CAOd;AAED,wBAAgB,eAAe,CAC7B,WAAW,EAAE,OAAO,EAAE,GAAG,IAAI,GAAG,SAAS,EACzC,IAAI,EAAE,aAAa,GAClB,eAAe,EAAE,CAUnB;AAED,wBAAgB,mBAAmB,CACjC,EAAE,GAAE,MAAW,EACf,EAAE,GAAE,MAAW,EACf,KAAK,GAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAO,GACrC,MAAM,CAKR;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,CAEhD"}
@@ -0,0 +1,71 @@
1
+ import { feature, mesh } from "topojson-client";
2
+ export function getCoords(w, h, t) {
3
+ const xOffset = (w * t.k - w) / 2;
4
+ const yOffset = (h * t.k - h) / 2;
5
+ return [w / 2 - (xOffset + t.x) / t.k, h / 2 - (yOffset + t.y) / t.k];
6
+ }
7
+ export function fetchGeographies(url) {
8
+ return fetch(url)
9
+ .then((res) => {
10
+ if (!res.ok) {
11
+ throw Error(res.statusText);
12
+ }
13
+ return res.json();
14
+ })
15
+ .catch((error) => {
16
+ console.log("There was a problem when fetching the data: ", error);
17
+ return undefined;
18
+ });
19
+ }
20
+ export function getFeatures(geographies, parseGeographies) {
21
+ const isTopojson = geographies.type === "Topology";
22
+ if (!isTopojson) {
23
+ const geoCollection = geographies;
24
+ const features = geoCollection.features || geographies;
25
+ return parseGeographies ? parseGeographies(features) : features;
26
+ }
27
+ const topology = geographies;
28
+ const firstObjectKey = Object.keys(topology.objects)[0];
29
+ const feats = feature(topology, topology.objects[firstObjectKey]).features;
30
+ return parseGeographies ? parseGeographies(feats) : feats;
31
+ }
32
+ export function getMesh(geographies) {
33
+ const isTopojson = geographies.type === "Topology";
34
+ if (!isTopojson)
35
+ return null;
36
+ const topology = geographies;
37
+ const firstObjectKey = Object.keys(topology.objects)[0];
38
+ const geometryCollection = topology.objects[firstObjectKey];
39
+ const outline = mesh(topology, geometryCollection, (a, b) => a === b);
40
+ const borders = mesh(topology, geometryCollection, (a, b) => a !== b);
41
+ return { outline, borders };
42
+ }
43
+ export function prepareMesh(outline, borders, path) {
44
+ return outline && borders
45
+ ? {
46
+ outline: { ...outline, rsmKey: "outline", svgPath: path(outline) || "" },
47
+ borders: { ...borders, rsmKey: "borders", svgPath: path(borders) || "" },
48
+ }
49
+ : {};
50
+ }
51
+ export function prepareFeatures(geographies, path) {
52
+ return geographies
53
+ ? geographies.map((d, i) => {
54
+ return {
55
+ ...d,
56
+ rsmKey: `geo-${i}`,
57
+ svgPath: path(d) || "",
58
+ };
59
+ })
60
+ : [];
61
+ }
62
+ export function createConnectorPath(dx = 30, dy = 30, curve = 0.5) {
63
+ const curvature = Array.isArray(curve) ? curve : [curve, curve];
64
+ const curveX = (dx / 2) * curvature[0];
65
+ const curveY = (dy / 2) * curvature[1];
66
+ return `M${0},${0} Q${-dx / 2 - curveX},${-dy / 2 + curveY} ${-dx},${-dy}`;
67
+ }
68
+ export function isString(geo) {
69
+ return typeof geo === "string";
70
+ }
71
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/mapping/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AA6BhD,MAAM,UAAU,SAAS,CAAC,CAAS,EAAE,CAAS,EAAE,CAAY;IAC1D,MAAM,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IA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ACT,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,WAAyC,EACzC,IAAmB;IAEnB,OAAO,WAAW;QAChB,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACvB,OAAO;gBACL,GAAG,CAAC;gBACJ,MAAM,EAAE,OAAO,CAAC,EAAE;gBAClB,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;aACvB,CAAC;QACJ,CAAC,CAAC;QACJ,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,KAAa,EAAE,EACf,KAAa,EAAE,EACf,QAAmC,GAAG;IAEtC,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAChE,MAAM,MAAM,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IACvC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,GAAG,MAAM,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,MAAM,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAQ;IAC/B,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC;AACjC,CAAC"}
@@ -0,0 +1,14 @@
1
+ export { default as ComposableMap } from "./src/components/ComposableMap";
2
+ export { default as Geographies } from "./src/components/Geographies";
3
+ export { default as Geography } from "./src/components/Geography";
4
+ export { default as Graticule } from "./src/components/Graticule";
5
+ export { default as ZoomableGroup } from "./src/components/ZoomableGroup";
6
+ export { default as Sphere } from "./src/components/Sphere";
7
+ export { default as Marker } from "./src/components/Marker";
8
+ export { default as Line } from "./src/components/Line";
9
+ export { default as Annotation } from "./src/components/Annotation";
10
+ export { default as useGeographies } from "./src/components/useGeographies";
11
+ export { default as useZoomPan } from "./src/components/useZoomPan";
12
+ export { MapProvider, MapContext, useMapContext } from "./src/components/MapProvider";
13
+ export { ZoomPanProvider, ZoomPanContext, useZoomPanContext } from "./src/components/ZoomPanProvider";
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react-simple-maps/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ // Main export file for react-simple-maps integration
2
+ // This re-exports all components, hooks, and providers from the source
3
+ export { default as ComposableMap } from "./src/components/ComposableMap";
4
+ export { default as Geographies } from "./src/components/Geographies";
5
+ export { default as Geography } from "./src/components/Geography";
6
+ export { default as Graticule } from "./src/components/Graticule";
7
+ export { default as ZoomableGroup } from "./src/components/ZoomableGroup";
8
+ export { default as Sphere } from "./src/components/Sphere";
9
+ export { default as Marker } from "./src/components/Marker";
10
+ export { default as Line } from "./src/components/Line";
11
+ export { default as Annotation } from "./src/components/Annotation";
12
+ export { MapProvider, MapContext, useMapContext, } from "./src/components/MapProvider";
13
+ export { ZoomPanProvider, ZoomPanContext, useZoomPanContext, } from "./src/components/ZoomPanProvider";
14
+ export { default as useGeographies } from "./src/components/useGeographies";
15
+ export { default as useZoomPan } from "./src/components/useZoomPan";
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react-simple-maps/index.js"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,uEAAuE;AACvE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,gCAAgC,CAAA;AACzE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,gCAAgC,CAAA;AACzE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EACL,WAAW,EACX,UAAU,EACV,aAAa,GACd,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,GAClB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,6BAA6B,CAAA"}
@@ -0,0 +1,3 @@
1
+ export default Annotation;
2
+ declare const Annotation: any;
3
+ //# sourceMappingURL=Annotation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Annotation.d.ts","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/Annotation.js"],"names":[],"mappings":";AAMA,8BAmCC"}
@@ -0,0 +1,27 @@
1
+ import React, { useContext, forwardRef } from "react";
2
+ import PropTypes from "prop-types";
3
+ import { MapContext } from "./MapProvider";
4
+ import { createConnectorPath } from "../utils";
5
+ const Annotation = forwardRef(({ subject, children, connectorProps, dx = 30, dy = 30, curve = 0, className = "", ...restProps }, ref) => {
6
+ const { projection } = useContext(MapContext);
7
+ const [x, y] = projection(subject);
8
+ const connectorPath = createConnectorPath(dx, dy, curve);
9
+ return (React.createElement("g", { ref: ref, transform: `translate(${x + dx}, ${y + dy})`, className: `rsm-annotation ${className}`, ...restProps },
10
+ React.createElement("path", { d: connectorPath, fill: "transparent", stroke: "#000", ...connectorProps }),
11
+ children));
12
+ });
13
+ Annotation.displayName = "Annotation";
14
+ Annotation.propTypes = {
15
+ subject: PropTypes.array,
16
+ children: PropTypes.oneOfType([
17
+ PropTypes.node,
18
+ PropTypes.arrayOf(PropTypes.node),
19
+ ]),
20
+ dx: PropTypes.number,
21
+ dy: PropTypes.number,
22
+ curve: PropTypes.number,
23
+ connectorProps: PropTypes.object,
24
+ className: PropTypes.string,
25
+ };
26
+ export default Annotation;
27
+ //# sourceMappingURL=Annotation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Annotation.js","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/Annotation.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,SAAS,MAAM,YAAY,CAAA;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAE9C,MAAM,UAAU,GAAG,UAAU,CAC3B,CACE,EACE,OAAO,EACP,QAAQ,EACR,cAAc,EACd,EAAE,GAAG,EAAE,EACP,EAAE,GAAG,EAAE,EACP,KAAK,GAAG,CAAC,EACT,SAAS,GAAG,EAAE,EACd,GAAG,SAAS,EACb,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAAA;IAC7C,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;IAClC,MAAM,aAAa,GAAG,mBAAmB,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAA;IAExD,OAAO,CACL,2BACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAC5C,SAAS,EAAE,kBAAkB,SAAS,EAAE,KACpC,SAAS;QAEb,8BACE,CAAC,EAAE,aAAa,EAChB,IAAI,EAAC,aAAa,EAClB,MAAM,EAAC,MAAM,KACT,cAAc,GAClB;QACD,QAAQ,CACP,CACL,CAAA;AACH,CAAC,CACF,CAAA;AAED,UAAU,CAAC,WAAW,GAAG,YAAY,CAAA;AAErC,UAAU,CAAC,SAAS,GAAG;IACrB,OAAO,EAAE,SAAS,CAAC,KAAK;IACxB,QAAQ,EAAE,SAAS,CAAC,SAAS,CAAC;QAC5B,SAAS,CAAC,IAAI;QACd,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;KAClC,CAAC;IACF,EAAE,EAAE,SAAS,CAAC,MAAM;IACpB,EAAE,EAAE,SAAS,CAAC,MAAM;IACpB,KAAK,EAAE,SAAS,CAAC,MAAM;IACvB,cAAc,EAAE,SAAS,CAAC,MAAM;IAChC,SAAS,EAAE,SAAS,CAAC,MAAM;CAC5B,CAAA;AAED,eAAe,UAAU,CAAA"}
@@ -0,0 +1,3 @@
1
+ export default ComposableMap;
2
+ declare const ComposableMap: any;
3
+ //# sourceMappingURL=ComposableMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComposableMap.d.ts","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/ComposableMap.js"],"names":[],"mappings":";AAKA,iCA4BC"}
@@ -0,0 +1,17 @@
1
+ import React, { forwardRef } from "react";
2
+ import PropTypes from "prop-types";
3
+ import { MapProvider } from "./MapProvider";
4
+ const ComposableMap = forwardRef(({ width = 800, height = 600, projection = "geoEqualEarth", projectionConfig = {}, className = "", ...restProps }, ref) => {
5
+ return (React.createElement(MapProvider, { width: width, height: height, projection: projection, projectionConfig: projectionConfig },
6
+ React.createElement("svg", { ref: ref, viewBox: `0 0 ${width} ${height}`, className: `rsm-svg ${className}`, ...restProps })));
7
+ });
8
+ ComposableMap.displayName = "ComposableMap";
9
+ ComposableMap.propTypes = {
10
+ width: PropTypes.number,
11
+ height: PropTypes.number,
12
+ projection: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
13
+ projectionConfig: PropTypes.object,
14
+ className: PropTypes.string,
15
+ };
16
+ export default ComposableMap;
17
+ //# sourceMappingURL=ComposableMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComposableMap.js","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/ComposableMap.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,SAAS,MAAM,YAAY,CAAA;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,aAAa,GAAG,UAAU,CAC9B,CACE,EACE,KAAK,GAAG,GAAG,EACX,MAAM,GAAG,GAAG,EACZ,UAAU,GAAG,eAAe,EAC5B,gBAAgB,GAAG,EAAE,EACrB,SAAS,GAAG,EAAE,EACd,GAAG,SAAS,EACb,EACD,GAAG,EACH,EAAE;IACF,OAAO,CACL,oBAAC,WAAW,IACV,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB;QAElC,6BACE,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,KAAK,IAAI,MAAM,EAAE,EACjC,SAAS,EAAE,WAAW,SAAS,EAAE,KAC7B,SAAS,GACb,CACU,CACf,CAAA;AACH,CAAC,CACF,CAAA;AAED,aAAa,CAAC,WAAW,GAAG,eAAe,CAAA;AAE3C,aAAa,CAAC,SAAS,GAAG;IACxB,KAAK,EAAE,SAAS,CAAC,MAAM;IACvB,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,UAAU,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;IACnE,gBAAgB,EAAE,SAAS,CAAC,MAAM;IAClC,SAAS,EAAE,SAAS,CAAC,MAAM;CAC5B,CAAA;AAED,eAAe,aAAa,CAAA"}
@@ -0,0 +1,3 @@
1
+ export default Geographies;
2
+ declare const Geographies: any;
3
+ //# sourceMappingURL=Geographies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Geographies.d.ts","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/Geographies.js"],"names":[],"mappings":";AAMA,+BAmBC"}
@@ -0,0 +1,27 @@
1
+ import React, { useContext, forwardRef } from "react";
2
+ import PropTypes from "prop-types";
3
+ import { MapContext } from "./MapProvider";
4
+ import useGeographies from "./useGeographies";
5
+ const Geographies = forwardRef(({ geography, children, parseGeographies, className = "", ...restProps }, ref) => {
6
+ const { path, projection } = useContext(MapContext);
7
+ const { geographies, outline, borders } = useGeographies({
8
+ geography,
9
+ parseGeographies,
10
+ });
11
+ return (React.createElement("g", { ref: ref, className: `rsm-geographies ${className}`, ...restProps }, geographies &&
12
+ geographies.length > 0 &&
13
+ children({ geographies, outline, borders, path, projection })));
14
+ });
15
+ Geographies.displayName = "Geographies";
16
+ Geographies.propTypes = {
17
+ geography: PropTypes.oneOfType([
18
+ PropTypes.string,
19
+ PropTypes.object,
20
+ PropTypes.array,
21
+ ]),
22
+ children: PropTypes.func,
23
+ parseGeographies: PropTypes.func,
24
+ className: PropTypes.string,
25
+ };
26
+ export default Geographies;
27
+ //# sourceMappingURL=Geographies.js.map