react-native-leaflet-kit 1.0.0

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/LICENSE +21 -0
  2. package/README.md +410 -0
  3. package/dist/components/Circle.d.ts +4 -0
  4. package/dist/components/Circle.d.ts.map +1 -0
  5. package/dist/components/Circle.js +15 -0
  6. package/dist/components/Circle.js.map +1 -0
  7. package/dist/components/GeoJSON.d.ts +4 -0
  8. package/dist/components/GeoJSON.d.ts.map +1 -0
  9. package/dist/components/GeoJSON.js +14 -0
  10. package/dist/components/GeoJSON.js.map +1 -0
  11. package/dist/components/Heatmap.d.ts +4 -0
  12. package/dist/components/Heatmap.d.ts.map +1 -0
  13. package/dist/components/Heatmap.js +14 -0
  14. package/dist/components/Heatmap.js.map +1 -0
  15. package/dist/components/MapContainer.d.ts +9 -0
  16. package/dist/components/MapContainer.d.ts.map +1 -0
  17. package/dist/components/MapContainer.js +86 -0
  18. package/dist/components/MapContainer.js.map +1 -0
  19. package/dist/components/Marker.d.ts +7 -0
  20. package/dist/components/Marker.d.ts.map +1 -0
  21. package/dist/components/Marker.js +20 -0
  22. package/dist/components/Marker.js.map +1 -0
  23. package/dist/components/MarkerCluster.d.ts +4 -0
  24. package/dist/components/MarkerCluster.d.ts.map +1 -0
  25. package/dist/components/MarkerCluster.js +14 -0
  26. package/dist/components/MarkerCluster.js.map +1 -0
  27. package/dist/components/Polygon.d.ts +4 -0
  28. package/dist/components/Polygon.d.ts.map +1 -0
  29. package/dist/components/Polygon.js +15 -0
  30. package/dist/components/Polygon.js.map +1 -0
  31. package/dist/components/Polyline.d.ts +4 -0
  32. package/dist/components/Polyline.d.ts.map +1 -0
  33. package/dist/components/Polyline.js +14 -0
  34. package/dist/components/Polyline.js.map +1 -0
  35. package/dist/components/Popup.d.ts +4 -0
  36. package/dist/components/Popup.d.ts.map +1 -0
  37. package/dist/components/Popup.js +27 -0
  38. package/dist/components/Popup.js.map +1 -0
  39. package/dist/components/TileLayer.d.ts +4 -0
  40. package/dist/components/TileLayer.d.ts.map +1 -0
  41. package/dist/components/TileLayer.js +14 -0
  42. package/dist/components/TileLayer.js.map +1 -0
  43. package/dist/components/UserMarker.d.ts +4 -0
  44. package/dist/components/UserMarker.d.ts.map +1 -0
  45. package/dist/components/UserMarker.js +15 -0
  46. package/dist/components/UserMarker.js.map +1 -0
  47. package/dist/context/MapContext.d.ts +11 -0
  48. package/dist/context/MapContext.d.ts.map +1 -0
  49. package/dist/context/MapContext.js +11 -0
  50. package/dist/context/MapContext.js.map +1 -0
  51. package/dist/index.d.ts +14 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +14 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/templates/LeafletHTML.d.ts +2 -0
  56. package/dist/templates/LeafletHTML.d.ts.map +1 -0
  57. package/dist/templates/LeafletHTML.js +539 -0
  58. package/dist/templates/LeafletHTML.js.map +1 -0
  59. package/dist/types/index.d.ts +155 -0
  60. package/dist/types/index.d.ts.map +1 -0
  61. package/dist/types/index.js +15 -0
  62. package/dist/types/index.js.map +1 -0
  63. package/dist/utils/deepEqual.d.ts +2 -0
  64. package/dist/utils/deepEqual.d.ts.map +1 -0
  65. package/dist/utils/deepEqual.js +22 -0
  66. package/dist/utils/deepEqual.js.map +1 -0
  67. package/package.json +52 -0
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { MarkerClusterProps } from '../types';
3
+ export declare const MarkerCluster: React.FC<MarkerClusterProps>;
4
+ //# sourceMappingURL=MarkerCluster.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkerCluster.d.ts","sourceRoot":"","sources":["../../src/components/MarkerCluster.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAYtD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import React, { useEffect } from 'react';
2
+ import { useMap } from '../context/MapContext';
3
+ export const MarkerCluster = ({ children, options }) => {
4
+ const { registerLayer, unregisterLayer } = useMap();
5
+ const clusterId = 'global-cluster';
6
+ useEffect(() => {
7
+ registerLayer('cluster', clusterId, { enabled: true, options });
8
+ return () => {
9
+ unregisterLayer('cluster', clusterId);
10
+ };
11
+ }, []);
12
+ return <>{children}</>;
13
+ };
14
+ //# sourceMappingURL=MarkerCluster.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkerCluster.js","sourceRoot":"","sources":["../../src/components/MarkerCluster.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG/C,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;IACjF,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,MAAM,EAAE,CAAC;IACpD,MAAM,SAAS,GAAG,gBAAgB,CAAC;IAEnC,SAAS,CAAC,GAAG,EAAE;QACX,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;QAChE,OAAO,GAAG,EAAE;YACR,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAC1C,CAAC,CAAC;IACN,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;AAC3B,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { PolygonProps } from '../types';
3
+ export declare const Polygon: React.FC<PolygonProps>;
4
+ //# sourceMappingURL=Polygon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Polygon.d.ts","sourceRoot":"","sources":["../../src/components/Polygon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAc1C,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { useEffect } from 'react';
2
+ import { useMap } from '../context/MapContext';
3
+ export const Polygon = (props) => {
4
+ const { registerLayer, unregisterLayer, updateLayer } = useMap();
5
+ const { id, positions, color, fillColor, fillOpacity, weight } = props;
6
+ useEffect(() => {
7
+ registerLayer('polygon', id, { positions, color, fillColor, fillOpacity, weight });
8
+ return () => unregisterLayer('polygon', id);
9
+ }, []);
10
+ useEffect(() => {
11
+ updateLayer('polygon', id, { positions, color, fillColor, fillOpacity, weight });
12
+ }, [id, positions, color, fillColor, fillOpacity, weight]);
13
+ return null;
14
+ };
15
+ //# sourceMappingURL=Polygon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Polygon.js","sourceRoot":"","sources":["../../src/components/Polygon.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG/C,MAAM,CAAC,MAAM,OAAO,GAA2B,CAAC,KAAK,EAAE,EAAE;IACrD,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,MAAM,EAAE,CAAC;IACjE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEvE,SAAS,CAAC,GAAG,EAAE;QACX,aAAa,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC;QACnF,OAAO,GAAG,EAAE,CAAC,eAAe,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAChD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACX,WAAW,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC;IACrF,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAE3D,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { PolylineProps } from '../types';
3
+ export declare const Polyline: React.FC<PolylineProps>;
4
+ //# sourceMappingURL=Polyline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Polyline.d.ts","sourceRoot":"","sources":["../../src/components/Polyline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAa5C,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { useEffect } from 'react';
2
+ import { useMap } from '../context/MapContext';
3
+ export const Polyline = ({ id, positions, color, weight, opacity, dashArray, isAnimated }) => {
4
+ const { registerLayer, unregisterLayer, updateLayer } = useMap();
5
+ useEffect(() => {
6
+ registerLayer('polyline', id, { positions, color, weight, opacity, dashArray, isAnimated });
7
+ return () => unregisterLayer('polyline', id);
8
+ }, []);
9
+ useEffect(() => {
10
+ updateLayer('polyline', id, { positions, color, weight, opacity, dashArray, isAnimated });
11
+ }, [positions, color, weight, opacity, dashArray, isAnimated]);
12
+ return null;
13
+ };
14
+ //# sourceMappingURL=Polyline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Polyline.js","sourceRoot":"","sources":["../../src/components/Polyline.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG/C,MAAM,CAAC,MAAM,QAAQ,GAA4B,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE;IAClH,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,MAAM,EAAE,CAAC;IAEjE,SAAS,CAAC,GAAG,EAAE;QACX,aAAa,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;QAC5F,OAAO,GAAG,EAAE,CAAC,eAAe,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACjD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACX,WAAW,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;IAC9F,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IAE/D,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { PopupProps } from '../types';
3
+ export declare const Popup: React.FC<PopupProps>;
4
+ //# sourceMappingURL=Popup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../../src/components/Popup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA4BtC,CAAC"}
@@ -0,0 +1,27 @@
1
+ import React, { useEffect } from 'react';
2
+ import { useMarker } from './Marker';
3
+ export const Popup = (props) => {
4
+ const markerContext = useMarker();
5
+ const lastOptions = React.useRef('');
6
+ useEffect(() => {
7
+ if (!markerContext)
8
+ return;
9
+ let finalContent = props.content;
10
+ if (!finalContent && typeof props.children === 'string') {
11
+ finalContent = props.children;
12
+ }
13
+ const currentOptions = {
14
+ content: finalContent,
15
+ style: props.style,
16
+ autoPan: props.autoPan,
17
+ offset: props.offset
18
+ };
19
+ const optionsStr = JSON.stringify(currentOptions);
20
+ if (optionsStr !== lastOptions.current) {
21
+ lastOptions.current = optionsStr;
22
+ markerContext.setPopupOptions(currentOptions);
23
+ }
24
+ }, [props.content, props.children, props.style, props.autoPan, props.offset, markerContext]);
25
+ return null;
26
+ };
27
+ //# sourceMappingURL=Popup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Popup.js","sourceRoot":"","sources":["../../src/components/Popup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,MAAM,CAAC,MAAM,KAAK,GAAyB,CAAC,KAAK,EAAE,EAAE;IACjD,MAAM,aAAa,GAAG,SAAS,EAAE,CAAC;IAElC,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAS,EAAE,CAAC,CAAC;IAE7C,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,CAAC,aAAa;YAAE,OAAO;QAE3B,IAAI,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC;QACjC,IAAI,CAAC,YAAY,IAAI,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACtD,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC;QAClC,CAAC;QAED,MAAM,cAAc,GAAG;YACnB,OAAO,EAAE,YAAY;YACrB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,MAAM,EAAE,KAAK,CAAC,MAAM;SACvB,CAAC;QAEF,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAClD,IAAI,UAAU,KAAK,WAAW,CAAC,OAAO,EAAE,CAAC;YACrC,WAAW,CAAC,OAAO,GAAG,UAAU,CAAC;YACjC,aAAa,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;QAClD,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;IAE7F,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { TileLayerProps } from '../types';
3
+ export declare const TileLayer: React.FC<TileLayerProps>;
4
+ //# sourceMappingURL=TileLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TileLayer.d.ts","sourceRoot":"","sources":["../../src/components/TileLayer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAiB9C,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { useEffect } from 'react';
2
+ import { useMap } from '../context/MapContext';
3
+ export const TileLayer = ({ url = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', attribution, id = 'default-tile' }) => {
4
+ const { registerLayer, unregisterLayer, updateLayer } = useMap();
5
+ useEffect(() => {
6
+ registerLayer('tile', id, { url, attribution });
7
+ return () => unregisterLayer('tile', id);
8
+ }, []);
9
+ useEffect(() => {
10
+ updateLayer('tile', id, { url, attribution });
11
+ }, [url, attribution]);
12
+ return null;
13
+ };
14
+ //# sourceMappingURL=TileLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TileLayer.js","sourceRoot":"","sources":["../../src/components/TileLayer.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG/C,MAAM,CAAC,MAAM,SAAS,GAA6B,CAAC,EAChD,GAAG,GAAG,oDAAoD,EAC1D,WAAW,EACX,EAAE,GAAG,cAAc,EACtB,EAAE,EAAE;IACD,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,MAAM,EAAE,CAAC;IAEjE,SAAS,CAAC,GAAG,EAAE;QACX,aAAa,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;QAChD,OAAO,GAAG,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC7C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACX,WAAW,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;IAClD,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC;IAEvB,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { UserMarkerProps } from '../types';
3
+ export declare const UserMarker: React.FC<UserMarkerProps>;
4
+ //# sourceMappingURL=UserMarker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserMarker.d.ts","sourceRoot":"","sources":["../../src/components/UserMarker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAchD,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { useEffect } from 'react';
2
+ import { useMap } from '../context/MapContext';
3
+ export const UserMarker = (props) => {
4
+ const { registerLayer, unregisterLayer, updateLayer } = useMap();
5
+ const id = 'USER_POSITION_MARKER';
6
+ useEffect(() => {
7
+ registerLayer('userMarker', id, props);
8
+ return () => unregisterLayer('userMarker', id);
9
+ }, []);
10
+ useEffect(() => {
11
+ updateLayer('userMarker', id, props);
12
+ }, [props.position.lat, props.position.lng, props.heading, props.accuracy, props.markerColor, props.style]);
13
+ return null;
14
+ };
15
+ //# sourceMappingURL=UserMarker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserMarker.js","sourceRoot":"","sources":["../../src/components/UserMarker.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG/C,MAAM,CAAC,MAAM,UAAU,GAA8B,CAAC,KAAK,EAAE,EAAE;IAC3D,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,MAAM,EAAE,CAAC;IACjE,MAAM,EAAE,GAAG,sBAAsB,CAAC;IAElC,SAAS,CAAC,GAAG,EAAE;QACX,aAAa,CAAC,YAAY,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QACvC,OAAO,GAAG,EAAE,CAAC,eAAe,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IACnD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACX,WAAW,CAAC,YAAY,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAE5G,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface MapContextValue {
3
+ registerLayer: (type: 'marker' | 'polyline' | 'tile' | 'userMarker' | 'circle' | 'polygon' | 'geojson' | 'heatmap' | 'cluster', id: string, props: any) => void;
4
+ unregisterLayer: (type: 'marker' | 'polyline' | 'tile' | 'userMarker' | 'circle' | 'polygon' | 'geojson' | 'heatmap' | 'cluster', id: string) => void;
5
+ updateLayer: (type: 'marker' | 'polyline' | 'tile' | 'userMarker' | 'circle' | 'polygon' | 'geojson' | 'heatmap' | 'cluster', id: string, props: any) => void;
6
+ sendMessage: (payload: any) => void;
7
+ }
8
+ declare const MapContext: React.Context<MapContextValue | undefined>;
9
+ export declare const useMap: () => MapContextValue;
10
+ export default MapContext;
11
+ //# sourceMappingURL=MapContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapContext.d.ts","sourceRoot":"","sources":["../../src/context/MapContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAEzD,UAAU,eAAe;IACrB,aAAa,EAAE,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAChK,eAAe,EAAE,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACtJ,WAAW,EAAE,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAC9J,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;CACvC;AAED,QAAA,MAAM,UAAU,4CAAwD,CAAC;AAEzE,eAAO,MAAM,MAAM,uBAMlB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { createContext, useContext } from 'react';
2
+ const MapContext = createContext(undefined);
3
+ export const useMap = () => {
4
+ const context = useContext(MapContext);
5
+ if (!context) {
6
+ throw new Error('Map components must be wrapped in <MapContainer />');
7
+ }
8
+ return context;
9
+ };
10
+ export default MapContext;
11
+ //# sourceMappingURL=MapContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapContext.js","sourceRoot":"","sources":["../../src/context/MapContext.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AASzD,MAAM,UAAU,GAAG,aAAa,CAA8B,SAAS,CAAC,CAAC;AAEzE,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,EAAE;IACvB,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,14 @@
1
+ export * from './components/MapContainer';
2
+ export * from './components/TileLayer';
3
+ export * from './components/Marker';
4
+ export * from './components/Polyline';
5
+ export * from './components/UserMarker';
6
+ export * from './components/Popup';
7
+ export * from './components/Circle';
8
+ export * from './components/Polygon';
9
+ export * from './components/GeoJSON';
10
+ export * from './components/MarkerCluster';
11
+ export * from './components/Heatmap';
12
+ export * from './types';
13
+ export { useMap } from './context/MapContext';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ export * from './components/MapContainer';
2
+ export * from './components/TileLayer';
3
+ export * from './components/Marker';
4
+ export * from './components/Polyline';
5
+ export * from './components/UserMarker';
6
+ export * from './components/Popup';
7
+ export * from './components/Circle';
8
+ export * from './components/Polygon';
9
+ export * from './components/GeoJSON';
10
+ export * from './components/MarkerCluster';
11
+ export * from './components/Heatmap';
12
+ export * from './types';
13
+ export { useMap } from './context/MapContext';
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const LEAFLET_HTML_CONTENT = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\" />\n <title>Leaflet Map</title>\n <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.css\" />\n <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.5.3/MarkerCluster.css\" />\n <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.5.3/MarkerCluster.Default.css\" />\n <style>\n :root {\n --theme-bg: #ffffff;\n --theme-color: #333333;\n }\n \n #map.dark-mode-tiles {\n --theme-bg: #1a1a1a;\n --theme-color: #ffffff;\n }\n \n body { \n margin: 0; \n padding: 0; \n font-family: Arial, sans-serif; \n background-color: var(--theme-bg);\n }\n \n #map { \n height: 100vh; \n width: 100vw; \n background-color: var(--theme-bg);\n }\n \n .leaflet-container {\n background: none !important;\n outline: 0;\n }\n \n .dark-mode-tiles .leaflet-tile-pane {\n filter: brightness(0.6) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.7);\n }\n \n .custom-div-icon { background: none; border: none; }\n .pulse-marker {\n width: var(--user-marker-size, 12px); \n height: var(--user-marker-size, 12px);\n border-radius: 50%;\n background: var(--user-marker-color, #1169C2); \n border: 3px solid white;\n box-shadow: 0 0 8px var(--user-marker-shadow, rgba(66, 133, 244, 0.7));\n position: absolute;\n top: 50%;\n left: 50%;\n margin-top: calc(var(--user-marker-size, 12px) / -2 - 3px);\n margin-left: calc(var(--user-marker-size, 12px) / -2 - 3px);\n z-index: 2;\n display: var(--pulse-display, block);\n }\n .pulse-marker::before {\n content: ''; \n position: absolute;\n top: 0;\n left: 0;\n width: 100%; \n height: 100%;\n border-radius: 50%; \n background: var(--user-marker-color, #1169C2);\n animation: pulse var(--user-marker-pulse-duration, 2.5s) ease-out infinite;\n pointer-events: none;\n display: var(--pulse-animation-display, block);\n } \n @keyframes pulse {\n 0% { transform: scale(0.8); opacity: 0.7; }\n 50% { opacity: 0.4; }\n 100% { transform: scale(var(--user-marker-pulse-max-scale, 2.5)); opacity: 0; }\n }\n .accuracy-circle { \n stroke: var(--user-marker-color, #1169C2); \n stroke-width: 2; \n fill: var(--accuracy-circle-color, rgba(66, 133, 244, 0.1)); \n }\n .direction-cone {\n position: absolute;\n width: var(--direction-cone-width, 60px);\n height: var(--direction-cone-height, 50px);\n left: 50%;\n top: 50%;\n margin-left: calc(var(--direction-cone-width, 60px) / -2);\n margin-top: calc(var(--direction-cone-height, 50px) * -1);\n transform-origin: center bottom;\n background: linear-gradient(to top, var(--direction-cone-color, rgba(66, 133, 244, 0.6)), transparent);\n clip-path: polygon(50% 100%, 0% 0%, 100% 0%);\n transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);\n pointer-events: none;\n z-index: 1;\n display: var(--direction-cone-display, block);\n }\n .leaflet-control-zoom { visibility: hidden; }\n\n @keyframes flow {\n from { stroke-dashoffset: 20; }\n to { stroke-dashoffset: 0; }\n }\n .animated-polyline {\n stroke-dasharray: 10, 10;\n animation: flow 1s linear infinite;\n }\n\n .custom-popup .leaflet-popup-content-wrapper {\n background: var(--theme-bg);\n color: var(--theme-color);\n border-radius: 12px;\n padding: 0;\n box-shadow: 0 3px 14px rgba(0,0,0,0.4);\n }\n .custom-popup .leaflet-popup-content {\n margin: 12px;\n line-height: 1.4;\n }\n .custom-popup .leaflet-popup-tip {\n background: var(--theme-bg);\n }\n .custom-popup .leaflet-popup-close-button {\n top: 10px !important;\n right: 12px !important;\n font-size: 20px !important;\n font-weight: normal;\n color: var(--theme-color);\n padding: 0;\n width: 24px;\n height: 24px;\n line-height: 24px;\n text-align: center;\n z-index: 1000;\n }\n </style>\n</head>\n<body>\n <div id=\"map\"></div>\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.js\"></script>\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.5.3/leaflet.markercluster.js\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/leaflet.heat@0.2.0/dist/leaflet-heat.js\"></script>\n <script>\n const svg = '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"256\" height=\"256\"><rect width=\"100%\" height=\"100%\" fill=\"#f4f4f4\"/><g transform=\"translate(100, 100) scale(0.30)\"><path d=\"M0 16 L40 0 L88 16 L128 0 L128 112 L88 128 L40 112 L0 128 Z\" fill=\"none\" stroke=\"#888\" stroke-width=\"3\"/><line x1=\"40\" y1=\"0\" x2=\"40\" y2=\"112\" stroke=\"#888\" stroke-width=\"3\"/><line x1=\"88\" y1=\"16\" x2=\"88\" y2=\"128\" stroke=\"#888\" stroke-width=\"3\"/></g><text x=\"47%\" y=\"60%\" text-anchor=\"middle\" font-size=\"9\" fill=\"#888\" font-family=\"system-ui, -apple-system, BlinkMacSystemFont\">Offline</text></svg>';\n const OFFLINE_TILE = 'data:image/svg+xml;charset=UTF-8,' + encodeURIComponent(svg);\n\n let map, bounds = null, isReady = false, dragEnabled = true, zoomEnabled = true, isAutoFitEnabled = false, hasInitialFitPerformed = false, fitTimeout = null;\n const markers = new Map(), polylines = new Map(), layers = new Map(), circles = new Map(), polygons = new Map();\n const geojsonLayers = new Map(), heatmaps = new Map();\n let markerClusterGroup = null;\n let ownPositionMarker = null, accuracyCircle = null, directionCone = null, currentHeadingValue = 0;\n\n const sendMessage = (message) => {\n const msgStr = JSON.stringify(message);\n if (window.ReactNativeWebView) window.ReactNativeWebView.postMessage(msgStr);\n };\n\n const hexToRgba = (hex, alpha) => {\n const r = parseInt(hex.slice(1, 3), 16), g = parseInt(hex.slice(3, 5), 16), b = parseInt(hex.slice(5, 7), 16);\n return 'rgba(' + r + ', ' + g + ', ' + b + ', ' + alpha + ')';\n };\n\n const createIcon = (iconData, size = [32, 32]) => {\n if (!iconData) return null;\n if (typeof iconData === 'string' && (iconData.startsWith('http') || iconData.includes('.'))) {\n return L.icon({ iconUrl: iconData, iconSize: size, iconAnchor: [size[0]/2, size[1]], popupAnchor: [0, -size[1]] });\n }\n return L.divIcon({\n className: 'custom-div-icon',\n html: '<div style=\"font-size:' + Math.round(size[0]/2) + 'px;text-align:center;line-height:' + size[1] + 'px\">' + iconData + '</div>',\n iconSize: size, iconAnchor: [Math.round(size[0]/2), Math.round(size[1]/2)]\n });\n };\n\n const addPopupStyle = (data) => {\n const styleId = 'style-popup-' + data.id;\n let styleEl = document.getElementById(styleId);\n if (!styleEl) {\n styleEl = document.createElement('style');\n styleEl.id = styleId;\n document.head.appendChild(styleEl);\n }\n \n const s = data.style || {};\n styleEl.textContent = \n '.custom-popup-' + data.id + ' .leaflet-popup-content-wrapper {' +\n (s.backgroundColor ? 'background: ' + s.backgroundColor + ' !important;' : '') +\n (s.textColor ? 'color: ' + s.textColor + ' !important;' : '') +\n (s.borderRadius !== undefined ? 'border-radius: ' + s.borderRadius + 'px !important;' : '') +\n '}' +\n '.custom-popup-' + data.id + ' .leaflet-popup-content {' +\n (s.padding !== undefined ? 'padding: ' + s.padding + 'px !important;' : '') +\n (s.fontSize !== undefined ? 'font-size: ' + s.fontSize + 'px !important;' : '') +\n (s.fontWeight !== undefined ? 'font-weight: ' + s.fontWeight + ' !important;' : '') +\n '}' +\n '.custom-popup-' + data.id + ' .leaflet-popup-tip {' +\n (s.backgroundColor ? 'background: ' + s.backgroundColor + ' !important;' : '') +\n '}' +\n '.custom-popup-' + data.id + ' .leaflet-popup-close-button {' +\n (s.closeButtonColor ? 'color: ' + s.closeButtonColor + ' !important;' : '') +\n '}';\n };\n\n const updateMarkers = (markerData) => {\n if (!markers.has(markerData.id)) {\n const icon = markerData.icon ? createIcon(markerData.icon, markerData.size) : null;\n const marker = icon ? L.marker(markerData.position, { icon }) : L.marker(markerData.position);\n if (markerData.title || markerData.content) {\n const popupOptions = {\n className: 'custom-popup custom-popup-' + markerData.id,\n maxWidth: (markerData.style && markerData.style.maxWidth) || 300,\n minWidth: (markerData.style && markerData.style.minWidth) || 50,\n offset: markerData.offset || [0, 7],\n autoPan: markerData.autoPan !== undefined ? markerData.autoPan : true\n };\n marker.bindPopup(markerData.content || markerData.title, popupOptions);\n addPopupStyle(markerData);\n }\n marker.on('click', () => sendMessage({ event: 'ON_MARKER_CLICK', payload: { id: markerData.id } }));\n \n if (markerClusterGroup) {\n markerClusterGroup.addLayer(marker);\n } else {\n marker.addTo(map);\n }\n markers.set(markerData.id, marker);\n } else {\n const marker = markers.get(markerData.id);\n marker.setLatLng(markerData.position);\n if (markerData.content || markerData.title) {\n marker.setPopupContent(markerData.content || markerData.title);\n addPopupStyle(markerData);\n }\n }\n updateBounds();\n };\n\n const updatePolylines = (data) => {\n const options = { \n color: data.color || '#3388ff', \n weight: data.weight || 3, \n opacity: data.opacity || 1, \n dashArray: data.dashArray,\n className: data.isAnimated ? 'animated-polyline' : ''\n };\n \n if (!polylines.has(data.id)) {\n const poly = L.polyline(data.positions, options).addTo(map);\n polylines.set(data.id, poly);\n } else {\n const poly = polylines.get(data.id);\n poly.setLatLngs(data.positions);\n poly.setStyle(options);\n }\n updateBounds();\n };\n\n const updateCircles = (data) => {\n const options = {\n color: data.color || '#3388ff',\n fillColor: data.fillColor || data.color || '#3388ff',\n fillOpacity: data.fillOpacity || 0.2,\n weight: data.weight || 2\n };\n if (!circles.has(data.id)) {\n const circle = L.circle(data.center, { radius: data.radius, ...options }).addTo(map);\n circles.set(data.id, circle);\n } else {\n const circle = circles.get(data.id);\n circle.setLatLng(data.center);\n circle.setRadius(data.radius);\n circle.setStyle(options);\n }\n updateBounds();\n };\n\n const updatePolygons = (data) => {\n const options = {\n color: data.color || '#3388ff',\n fillColor: data.fillColor || data.color || '#3388ff',\n fillOpacity: data.fillOpacity || 0.2,\n weight: data.weight || 2\n };\n if (!polygons.has(data.id)) {\n const polygon = L.polygon(data.positions, options).addTo(map);\n polygons.set(data.id, polygon);\n } else {\n const polygon = polygons.get(data.id);\n polygon.setLatLngs(data.positions);\n polygon.setStyle(options);\n }\n updateBounds();\n };\n\n const updateGeoJSON = (data) => {\n if (geojsonLayers.has(data.id)) {\n map.removeLayer(geojsonLayers.get(data.id));\n }\n const layer = L.geoJSON(data.data, {\n style: data.style,\n onEachFeature: (feature, layer) => {\n layer.on('click', () => {\n sendMessage({ event: 'ON_GEOJSON_CLICK', payload: { id: data.id, feature } });\n });\n }\n }).addTo(map);\n geojsonLayers.set(data.id, layer);\n updateBounds();\n };\n\n const updateHeatmap = (data) => {\n if (heatmaps.has(data.id)) {\n map.removeLayer(heatmaps.get(data.id));\n }\n const heatPoints = data.points.map(p => [p.lat, p.lng, p.intensity]);\n const layer = L.heatLayer(heatPoints, {\n radius: data.radius || 25,\n blur: data.blur || 15,\n max: data.max || 1.0\n }).addTo(map);\n heatmaps.set(data.id, layer);\n };\n\n const toggleCluster = (enabled, options = {}) => {\n if (enabled && !markerClusterGroup) {\n markerClusterGroup = L.markerClusterGroup(options);\n markers.forEach(m => {\n map.removeLayer(m);\n markerClusterGroup.addLayer(m);\n });\n map.addLayer(markerClusterGroup);\n } else if (!enabled && markerClusterGroup) {\n map.removeLayer(markerClusterGroup);\n markers.forEach(m => m.addTo(map));\n markerClusterGroup = null;\n }\n };\n\n const updateOwnPositionMarker = (markerData) => {\n if (!markerData || !markerData.position) {\n if (ownPositionMarker) { map.removeLayer(ownPositionMarker); ownPositionMarker = null; }\n if (accuracyCircle) { map.removeLayer(accuracyCircle); accuracyCircle = null; }\n if (directionCone) { map.removeLayer(directionCone); directionCone = null; }\n return;\n }\n const { lat, lng } = markerData.position;\n const markerColor = markerData.markerColor || '#1169C2';\n const style = markerData.style || {};\n const root = document.documentElement;\n \n root.style.setProperty('--user-marker-size', (style.markerSize || 12) + 'px');\n root.style.setProperty('--user-marker-color', markerColor);\n root.style.setProperty('--user-marker-shadow', hexToRgba(markerColor, 0.5));\n root.style.setProperty('--accuracy-circle-color', hexToRgba(markerData.accuracyCircleColor || markerColor, 0.1));\n \n root.style.setProperty('--pulse-display', (style.showPulse !== false) ? 'block' : 'none');\n root.style.setProperty('--user-marker-pulse-max-scale', style.pulseMaxScale || 2.5);\n root.style.setProperty('--user-marker-pulse-duration', style.pulseDuration || '2.5s');\n \n root.style.setProperty('--direction-cone-display', (style.showDirectionCone !== false) ? 'block' : 'none');\n root.style.setProperty('--direction-cone-width', (style.coneWidth || 60) + 'px');\n root.style.setProperty('--direction-cone-height', (style.coneHeight || 50) + 'px');\n\n const newLatLng = L.latLng(lat, lng);\n if (!ownPositionMarker) {\n ownPositionMarker = L.marker(newLatLng, { icon: L.divIcon({ className: 'custom-div-icon', html: '<div class=\"pulse-marker\"></div>', iconSize: [30, 30], iconAnchor: [15, 15] }) }).addTo(map);\n } else if (!ownPositionMarker.getLatLng().equals(newLatLng, 0.00001)) {\n animateMarker(ownPositionMarker, ownPositionMarker.getLatLng(), newLatLng, 1000);\n }\n\n if (markerData.accuracy > 0) {\n if (!accuracyCircle) accuracyCircle = L.circle(newLatLng, { radius: markerData.accuracy, className: 'accuracy-circle', fillOpacity: 0.1, weight: 2 }).addTo(map);\n else { accuracyCircle.setLatLng(newLatLng); accuracyCircle.setRadius(markerData.accuracy); }\n }\n\n if (markerData.heading !== undefined && markerData.heading !== null) {\n if (!directionCone) directionCone = L.marker(newLatLng, { icon: L.divIcon({ className: 'custom-div-icon', html: '<div class=\"direction-cone\"></div>', iconSize: [30, 30], iconAnchor: [15, 15] }), zIndexOffset: -100 }).addTo(map);\n else directionCone.setLatLng(newLatLng);\n \n const coneDiv = directionCone.getElement()?.querySelector('.direction-cone');\n if (coneDiv) {\n let diff = (markerData.heading - (currentHeadingValue % 360));\n if (diff > 180) diff -= 360; else if (diff < -180) diff += 360;\n currentHeadingValue += diff;\n coneDiv.style.transform = 'rotate(' + currentHeadingValue + 'deg)';\n document.documentElement.style.setProperty('--direction-cone-color', hexToRgba(markerColor, style.coneOpacity || 0.6));\n }\n } else if (directionCone) { map.removeLayer(directionCone); directionCone = null; }\n updateBounds();\n };\n\n const animateMarker = (marker, from, to, duration) => {\n const start = Date.now();\n const animate = () => {\n const progress = Math.min((Date.now() - start) / duration, 1);\n const ease = 1 - Math.pow(1 - progress, 3);\n const cur = [from.lat + (to.lat - from.lat) * ease, from.lng + (to.lng - from.lng) * ease];\n marker.setLatLng(cur);\n if (accuracyCircle) accuracyCircle.setLatLng(cur);\n if (directionCone) directionCone.setLatLng(cur);\n if (progress < 1) requestAnimationFrame(animate);\n };\n requestAnimationFrame(animate);\n };\n\n window.addEventListener('message', (event) => {\n let data = event.data;\n if (typeof data === 'string') {\n try { data = JSON.parse(data); } catch (e) { return; }\n }\n if (!data) return;\n \n if (data.type === 'init') {\n if (data.center) map.setView(data.center, data.zoom || 13);\n if (data.isDark) document.getElementById('map').classList.add('dark-mode-tiles');\n if (data.fitBounds) isAutoFitEnabled = true;\n }\n if (data.type === 'fit_bounds_toggle') {\n isAutoFitEnabled = !!data.enabled;\n if (isAutoFitEnabled) hasInitialFitPerformed = false; // Reset to allow re-fit\n }\n if (data.type === 'marker') updateMarkers(data);\n if (data.type === 'remove_marker') { \n if (markers.has(data.id)) { \n map.removeLayer(markers.get(data.id)); \n markers.delete(data.id);\n const styleEl = document.getElementById('style-popup-' + data.id);\n if (styleEl) styleEl.remove();\n } \n }\n if (data.type === 'polyline') updatePolylines(data);\n if (data.type === 'remove_polyline') { if (polylines.has(data.id)) { map.removeLayer(polylines.get(data.id)); polylines.delete(data.id); } }\n if (data.type === 'circle') updateCircles(data);\n if (data.type === 'remove_circle') { if (circles.has(data.id)) { map.removeLayer(circles.get(data.id)); circles.delete(data.id); } }\n if (data.type === 'polygon') updatePolygons(data);\n if (data.type === 'remove_polygon') { if (polygons.has(data.id)) { map.removeLayer(polygons.get(data.id)); polygons.delete(data.id); } }\n if (data.type === 'geojson') updateGeoJSON(data);\n if (data.type === 'remove_geojson') { if (geojsonLayers.has(data.id)) { map.removeLayer(geojsonLayers.get(data.id)); geojsonLayers.delete(data.id); } }\n if (data.type === 'heatmap') updateHeatmap(data);\n if (data.type === 'remove_heatmap') { if (heatmaps.has(data.id)) { map.removeLayer(heatmaps.get(data.id)); heatmaps.delete(data.id); } }\n if (data.type === 'cluster') toggleCluster(data.enabled, data.options);\n if (data.type === 'userMarker') updateOwnPositionMarker(data);\n if (data.type === 'center') {\n isAutoFitEnabled = false; // Disable auto-fit if specifically centering\n map.setView(data.position, data.zoom || map.getZoom());\n }\n if (data.type === 'tile') {\n if (layers.has(data.id)) map.removeLayer(layers.get(data.id));\n const layer = L.tileLayer(data.url, { attribution: data.attribution }).addTo(map);\n layers.set(data.id, layer);\n }\n if (data.type === 'theme') {\n document.documentElement.style.setProperty('--theme-bg', data.background);\n if (data.isDark) document.getElementById('map').classList.add('dark-mode-tiles');\n else document.getElementById('map').classList.remove('dark-mode-tiles');\n }\n if (data.type === 'fitBounds') {\n const options = data.options || { padding: [50, 50], maxZoom: 15 };\n if (bounds && bounds.isValid()) map.fitBounds(bounds, options);\n }\n });\n\n const updateBounds = () => {\n const routeBounds = L.latLngBounds();\n let hasRouteData = false;\n \n // Collect Route Elements (Markers, Polylines, etc.)\n markers.forEach(m => { routeBounds.extend(m.getLatLng()); hasRouteData = true; });\n polylines.forEach(p => { routeBounds.extend(p.getBounds()); hasRouteData = true; });\n geojsonLayers.forEach(g => { routeBounds.extend(g.getBounds()); hasRouteData = true; });\n circles.forEach(c => { routeBounds.extend(c.getBounds()); hasRouteData = true; });\n polygons.forEach(p => { routeBounds.extend(p.getBounds()); hasRouteData = true; });\n\n // Global bounds (used for manual fitBounds/Recenter, includes User)\n bounds = L.latLngBounds();\n if (hasRouteData) bounds.extend(routeBounds);\n if (ownPositionMarker) bounds.extend(ownPositionMarker.getLatLng());\n\n if (isAutoFitEnabled && !hasInitialFitPerformed) {\n if (fitTimeout) clearTimeout(fitTimeout);\n fitTimeout = setTimeout(() => {\n if (hasRouteData && routeBounds.isValid()) {\n // Priority 1: Focus on the Route context (Hero view)\n map.fitBounds(routeBounds, { padding: [50, 50], maxZoom: 15 });\n hasInitialFitPerformed = true;\n } else if (ownPositionMarker) {\n // Priority 2: Focus on User if no route markers are present\n map.setView(ownPositionMarker.getLatLng(), 15);\n hasInitialFitPerformed = true;\n }\n }, 200); // Wait for all components to register through the bridge\n }\n };\n\n const initMap = () => {\n try {\n if (map) return;\n map = L.map('map', { center: [28.7041, 77.1025], zoom: 13, zoomControl: false });\n bounds = L.latLngBounds();\n map.on('moveend', () => {\n const center = map.getCenter();\n sendMessage({ event: 'ON_MOVE_END', payload: { mapCenterPosition: center, zoom: map.getZoom(), bounds: map.getBounds() } });\n });\n map.on('click', (e) => sendMessage({ event: 'ON_MAP_CLICK', payload: { latlng: e.latlng } }));\n \n // Gesture Detection\n const onUserInteraction = () => {\n if (isAutoFitEnabled) {\n isAutoFitEnabled = false;\n sendMessage({ event: 'ON_USER_GESTURE' });\n }\n };\n\n map.on('dragstart', onUserInteraction);\n map.on('zoomstart', onUserInteraction);\n map.on('touchstart', onUserInteraction);\n map.on('mousedown', onUserInteraction);\n\n isReady = true;\n // Tiny delay to ensure bridge is fully established\n setTimeout(() => {\n sendMessage({ event: 'MAP_READY' });\n }, 100);\n } catch (err) {\n sendMessage({ event: 'ON_MAP_ERROR', msg: err.message });\n }\n };\n\n window.onerror = (msg, url, line) => {\n sendMessage({ event: 'ON_MAP_ERROR', msg: msg + ' at ' + line });\n return false;\n };\n\n document.addEventListener('DOMContentLoaded', initMap);\n setTimeout(initMap, 500); // Fallback if DOMContentLoaded already fired\n </script>\n</body>\n</html>";
2
+ //# sourceMappingURL=LeafletHTML.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LeafletHTML.d.ts","sourceRoot":"","sources":["../../src/templates/LeafletHTML.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,k50BAyhBzB,CAAC"}