@maplibre/maplibre-react-native 11.0.0-alpha.42 → 11.0.0-alpha.43

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 (137) hide show
  1. package/android/build.gradle +1 -3
  2. package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.kt +3 -3
  3. package/android/src/main/java/org/maplibre/reactnative/components/annotations/callout/MLRNCallout.kt +7 -0
  4. package/android/src/main/java/org/maplibre/reactnative/components/annotations/callout/MLRNCalloutManager.kt +29 -0
  5. package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MLRNMarkerView.kt +220 -0
  6. package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MLRNMarkerViewContent.kt +50 -0
  7. package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MLRNMarkerViewManager.kt +81 -0
  8. package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MarkerViewManager.kt +127 -0
  9. package/android/src/main/java/org/maplibre/reactnative/components/annotations/pointannotation/MLRNPointAnnotation.kt +407 -0
  10. package/android/src/main/java/org/maplibre/reactnative/components/annotations/pointannotation/MLRNPointAnnotationManager.kt +105 -0
  11. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.kt +38 -37
  12. package/android/src/main/java/org/maplibre/reactnative/events/PointAnnotationClickEvent.java +1 -1
  13. package/android/src/main/java/org/maplibre/reactnative/events/PointAnnotationDragEvent.java +1 -1
  14. package/android/src/main/java/org/maplibre/reactnative/events/PointAnnotationEvent.kt +30 -0
  15. package/ios/components/annotations/callout/MLRNCalloutComponentView.h +10 -0
  16. package/ios/components/annotations/callout/MLRNCalloutComponentView.mm +91 -0
  17. package/ios/components/annotations/point-annotation/MLRNPointAnnotation.h +44 -0
  18. package/ios/components/annotations/{MLRNPointAnnotation.m → point-annotation/MLRNPointAnnotation.m} +69 -35
  19. package/ios/components/annotations/point-annotation/MLRNPointAnnotationComponentView.h +10 -0
  20. package/ios/components/annotations/point-annotation/MLRNPointAnnotationComponentView.mm +331 -0
  21. package/ios/components/map-view/MLRNMapView.m +4 -5
  22. package/lib/commonjs/components/annotations/callout/Callout.js +94 -0
  23. package/lib/commonjs/components/annotations/callout/Callout.js.map +1 -0
  24. package/lib/commonjs/components/annotations/callout/CalloutNativeComponent.ts +11 -0
  25. package/lib/commonjs/components/annotations/marker-view/MarkerView.js +70 -0
  26. package/lib/commonjs/components/annotations/marker-view/MarkerView.js.map +1 -0
  27. package/lib/commonjs/components/annotations/marker-view/MarkerViewNativeComponent.ts +30 -0
  28. package/lib/commonjs/components/annotations/point-annotation/PointAnnotation.js +88 -0
  29. package/lib/commonjs/components/annotations/point-annotation/PointAnnotation.js.map +1 -0
  30. package/lib/commonjs/components/annotations/point-annotation/PointAnnotationNativeComponent.ts +58 -0
  31. package/lib/commonjs/index.js +3 -3
  32. package/lib/commonjs/index.js.map +1 -1
  33. package/lib/commonjs/types/Anchor.js +68 -0
  34. package/lib/commonjs/types/Anchor.js.map +1 -0
  35. package/lib/commonjs/utils/animated/Animated.js +4 -0
  36. package/lib/commonjs/utils/animated/Animated.js.map +1 -1
  37. package/lib/module/components/annotations/callout/Callout.js +88 -0
  38. package/lib/module/components/annotations/callout/Callout.js.map +1 -0
  39. package/lib/module/components/annotations/callout/CalloutNativeComponent.ts +11 -0
  40. package/lib/module/components/annotations/marker-view/MarkerView.js +64 -0
  41. package/lib/module/components/annotations/marker-view/MarkerView.js.map +1 -0
  42. package/lib/module/components/annotations/marker-view/MarkerViewNativeComponent.ts +30 -0
  43. package/lib/module/components/annotations/point-annotation/PointAnnotation.js +83 -0
  44. package/lib/module/components/annotations/point-annotation/PointAnnotation.js.map +1 -0
  45. package/lib/module/components/annotations/point-annotation/PointAnnotationNativeComponent.ts +58 -0
  46. package/lib/module/index.js +3 -3
  47. package/lib/module/index.js.map +1 -1
  48. package/lib/module/types/Anchor.js +64 -0
  49. package/lib/module/types/Anchor.js.map +1 -0
  50. package/lib/module/utils/animated/Animated.js +4 -0
  51. package/lib/module/utils/animated/Animated.js.map +1 -1
  52. package/lib/typescript/{module/src/components/annotations → commonjs/src/components/annotations/callout}/Callout.d.ts +9 -9
  53. package/lib/typescript/commonjs/src/components/annotations/callout/Callout.d.ts.map +1 -0
  54. package/lib/typescript/commonjs/src/components/annotations/callout/CalloutNativeComponent.d.ts +6 -0
  55. package/lib/typescript/commonjs/src/components/annotations/callout/CalloutNativeComponent.d.ts.map +1 -0
  56. package/lib/typescript/commonjs/src/components/annotations/marker-view/MarkerView.d.ts +52 -0
  57. package/lib/typescript/commonjs/src/components/annotations/marker-view/MarkerView.d.ts.map +1 -0
  58. package/lib/typescript/commonjs/src/components/annotations/marker-view/MarkerViewNativeComponent.d.ts +21 -0
  59. package/lib/typescript/commonjs/src/components/annotations/marker-view/MarkerViewNativeComponent.d.ts.map +1 -0
  60. package/lib/typescript/commonjs/src/components/annotations/point-annotation/PointAnnotation.d.ts +95 -0
  61. package/lib/typescript/commonjs/src/components/annotations/point-annotation/PointAnnotation.d.ts.map +1 -0
  62. package/lib/typescript/commonjs/src/components/annotations/point-annotation/PointAnnotationNativeComponent.d.ts +43 -0
  63. package/lib/typescript/commonjs/src/components/annotations/point-annotation/PointAnnotationNativeComponent.d.ts.map +1 -0
  64. package/lib/typescript/commonjs/src/index.d.ts +4 -4
  65. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  66. package/lib/typescript/commonjs/src/types/Anchor.d.ts +17 -0
  67. package/lib/typescript/commonjs/src/types/Anchor.d.ts.map +1 -0
  68. package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts +1 -0
  69. package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts.map +1 -1
  70. package/lib/typescript/{commonjs/src/components/annotations → module/src/components/annotations/callout}/Callout.d.ts +9 -9
  71. package/lib/typescript/module/src/components/annotations/callout/Callout.d.ts.map +1 -0
  72. package/lib/typescript/module/src/components/annotations/callout/CalloutNativeComponent.d.ts +6 -0
  73. package/lib/typescript/module/src/components/annotations/callout/CalloutNativeComponent.d.ts.map +1 -0
  74. package/lib/typescript/module/src/components/annotations/marker-view/MarkerView.d.ts +52 -0
  75. package/lib/typescript/module/src/components/annotations/marker-view/MarkerView.d.ts.map +1 -0
  76. package/lib/typescript/module/src/components/annotations/marker-view/MarkerViewNativeComponent.d.ts +21 -0
  77. package/lib/typescript/module/src/components/annotations/marker-view/MarkerViewNativeComponent.d.ts.map +1 -0
  78. package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotation.d.ts +95 -0
  79. package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotation.d.ts.map +1 -0
  80. package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotationNativeComponent.d.ts +43 -0
  81. package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotationNativeComponent.d.ts.map +1 -0
  82. package/lib/typescript/module/src/index.d.ts +4 -4
  83. package/lib/typescript/module/src/index.d.ts.map +1 -1
  84. package/lib/typescript/module/src/types/Anchor.d.ts +17 -0
  85. package/lib/typescript/module/src/types/Anchor.d.ts.map +1 -0
  86. package/lib/typescript/module/src/utils/animated/Animated.d.ts +1 -0
  87. package/lib/typescript/module/src/utils/animated/Animated.d.ts.map +1 -1
  88. package/package.json +3 -1
  89. package/src/components/annotations/callout/Callout.tsx +145 -0
  90. package/src/components/annotations/callout/CalloutNativeComponent.ts +11 -0
  91. package/src/components/annotations/marker-view/MarkerView.tsx +124 -0
  92. package/src/components/annotations/marker-view/MarkerViewNativeComponent.ts +30 -0
  93. package/src/components/annotations/point-annotation/PointAnnotation.tsx +219 -0
  94. package/src/components/annotations/point-annotation/PointAnnotationNativeComponent.ts +58 -0
  95. package/src/index.ts +15 -4
  96. package/src/types/Anchor.ts +44 -0
  97. package/src/utils/animated/Animated.tsx +6 -0
  98. package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNCallout.java +0 -11
  99. package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNCalloutManager.java +0 -18
  100. package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNMarkerView.java +0 -112
  101. package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNMarkerViewManager.java +0 -45
  102. package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNPointAnnotation.java +0 -361
  103. package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNPointAnnotationManager.java +0 -84
  104. package/android/src/main/java/org/maplibre/reactnative/components/annotations/MarkerView.java +0 -23
  105. package/android/src/main/java/org/maplibre/reactnative/components/annotations/MarkerViewManager.java +0 -69
  106. package/ios/components/annotations/MLRNCalloutManager.h +0 -5
  107. package/ios/components/annotations/MLRNCalloutManager.m +0 -12
  108. package/ios/components/annotations/MLRNPointAnnotation.h +0 -33
  109. package/ios/components/annotations/MLRNPointAnnotationManager.h +0 -5
  110. package/ios/components/annotations/MLRNPointAnnotationManager.m +0 -27
  111. package/lib/commonjs/components/annotations/Callout.js +0 -101
  112. package/lib/commonjs/components/annotations/Callout.js.map +0 -1
  113. package/lib/commonjs/components/annotations/MarkerView.js +0 -60
  114. package/lib/commonjs/components/annotations/MarkerView.js.map +0 -1
  115. package/lib/commonjs/components/annotations/PointAnnotation.js +0 -114
  116. package/lib/commonjs/components/annotations/PointAnnotation.js.map +0 -1
  117. package/lib/module/components/annotations/Callout.js +0 -96
  118. package/lib/module/components/annotations/Callout.js.map +0 -1
  119. package/lib/module/components/annotations/MarkerView.js +0 -55
  120. package/lib/module/components/annotations/MarkerView.js.map +0 -1
  121. package/lib/module/components/annotations/PointAnnotation.js +0 -110
  122. package/lib/module/components/annotations/PointAnnotation.js.map +0 -1
  123. package/lib/typescript/commonjs/src/components/annotations/Callout.d.ts.map +0 -1
  124. package/lib/typescript/commonjs/src/components/annotations/MarkerView.d.ts +0 -44
  125. package/lib/typescript/commonjs/src/components/annotations/MarkerView.d.ts.map +0 -1
  126. package/lib/typescript/commonjs/src/components/annotations/PointAnnotation.d.ts +0 -90
  127. package/lib/typescript/commonjs/src/components/annotations/PointAnnotation.d.ts.map +0 -1
  128. package/lib/typescript/module/src/components/annotations/Callout.d.ts.map +0 -1
  129. package/lib/typescript/module/src/components/annotations/MarkerView.d.ts +0 -44
  130. package/lib/typescript/module/src/components/annotations/MarkerView.d.ts.map +0 -1
  131. package/lib/typescript/module/src/components/annotations/PointAnnotation.d.ts +0 -90
  132. package/lib/typescript/module/src/components/annotations/PointAnnotation.d.ts.map +0 -1
  133. package/src/components/annotations/Callout.tsx +0 -139
  134. package/src/components/annotations/MarkerView.tsx +0 -86
  135. package/src/components/annotations/PointAnnotation.tsx +0 -240
  136. /package/ios/components/annotations/{MLRNCallout.h → callout/MLRNCallout.h} +0 -0
  137. /package/ios/components/annotations/{MLRNCallout.m → callout/MLRNCallout.m} +0 -0
@@ -0,0 +1,58 @@
1
+ import {
2
+ codegenNativeCommands,
3
+ codegenNativeComponent,
4
+ type CodegenTypes,
5
+ type HostComponent,
6
+ type ViewProps,
7
+ } from "react-native";
8
+
9
+ import type { UnsafeMixed } from "../../../types/codegen/UnsafeMixed";
10
+
11
+ type NativeAnchor = {
12
+ x: CodegenTypes.Double;
13
+ y: CodegenTypes.Double;
14
+ };
15
+
16
+ type NativeOffset = {
17
+ x: CodegenTypes.Double;
18
+ y: CodegenTypes.Double;
19
+ };
20
+
21
+ type NativeAnnotationEvent = {
22
+ id: string;
23
+ lngLat: UnsafeMixed<
24
+ [longitude: CodegenTypes.Double, latitude: CodegenTypes.Double]
25
+ >;
26
+ point: UnsafeMixed<[x: CodegenTypes.Double, y: CodegenTypes.Double]>;
27
+ };
28
+
29
+ export interface NativeProps extends ViewProps {
30
+ id: string;
31
+ title?: string;
32
+ snippet?: string;
33
+ selected?: CodegenTypes.WithDefault<boolean, false>;
34
+ draggable?: CodegenTypes.WithDefault<boolean, false>;
35
+ lngLat: UnsafeMixed<
36
+ [longitude: CodegenTypes.Double, latitude: CodegenTypes.Double]
37
+ >;
38
+ anchor?: NativeAnchor;
39
+ offset?: NativeOffset;
40
+
41
+ onSelected?: CodegenTypes.DirectEventHandler<NativeAnnotationEvent>;
42
+ onDeselected?: CodegenTypes.DirectEventHandler<NativeAnnotationEvent>;
43
+ onDragStart?: CodegenTypes.DirectEventHandler<NativeAnnotationEvent>;
44
+ onDrag?: CodegenTypes.DirectEventHandler<NativeAnnotationEvent>;
45
+ onDragEnd?: CodegenTypes.DirectEventHandler<NativeAnnotationEvent>;
46
+ }
47
+
48
+ interface NativeCommands {
49
+ refresh: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
50
+ }
51
+
52
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
53
+ supportedCommands: ["refresh"],
54
+ });
55
+
56
+ export default codegenNativeComponent<NativeProps>(
57
+ "MLRNPointAnnotation",
58
+ ) as HostComponent<NativeProps>;
@@ -137,9 +137,9 @@ Object.defineProperty(exports, "useCurrentPosition", {
137
137
  });
138
138
  var _Camera = require("./components/camera/Camera.js");
139
139
  var _MapView = require("./components/map-view/MapView.js");
140
- var _PointAnnotation = require("./components/annotations/PointAnnotation.js");
140
+ var _PointAnnotation = require("./components/annotations/point-annotation/PointAnnotation.js");
141
141
  var _GeoJSONSourceAnnotation = require("./components/annotations/GeoJSONSourceAnnotation.js");
142
- var _Callout = require("./components/annotations/Callout.js");
142
+ var _Callout = require("./components/annotations/callout/Callout.js");
143
143
  var _UserLocation = require("./components/user-location/UserLocation.js");
144
144
  var _NativeUserLocation = require("./components/user-location/NativeUserLocation.js");
145
145
  var _useCurrentPosition = require("./hooks/useCurrentPosition.js");
@@ -149,7 +149,7 @@ var _RasterSource = require("./components/sources/raster-source/RasterSource.js"
149
149
  var _VectorSource = require("./components/sources/vector-source/VectorSource.js");
150
150
  var _Layer = require("./components/layers/Layer.js");
151
151
  var _Images = require("./components/images/Images.js");
152
- var _MarkerView = require("./components/annotations/MarkerView.js");
152
+ var _MarkerView = require("./components/annotations/marker-view/MarkerView.js");
153
153
  var _LocationManager = require("./modules/location/LocationManager.js");
154
154
  var _LogManager = require("./modules/log/LogManager.js");
155
155
  var _NetworkManager = require("./modules/network/NetworkManager.js");
@@ -1 +1 @@
1
- {"version":3,"names":["_Camera","require","_MapView","_PointAnnotation","_GeoJSONSourceAnnotation","_Callout","_UserLocation","_NativeUserLocation","_useCurrentPosition","_ImageSource","_GeoJSONSource","_RasterSource","_VectorSource","_Layer","_Images","_MarkerView","_LocationManager","_LogManager","_NetworkManager","_OfflineManager","_OfflinePack","_StaticMapManager","_Animated"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAiBA,IAAAC,QAAA,GAAAD,OAAA;AAQA,IAAAE,gBAAA,GAAAF,OAAA;AAEA,IAAAG,wBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAEA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,mBAAA,GAAAP,OAAA;AAEA,IAAAQ,YAAA,GAAAR,OAAA;AAKA,IAAAS,cAAA,GAAAT,OAAA;AAMA,IAAAU,aAAA,GAAAV,OAAA;AAKA,IAAAW,aAAA,GAAAX,OAAA;AAMA,IAAAY,MAAA,GAAAZ,OAAA;AAeA,IAAAa,OAAA,GAAAb,OAAA;AAOA,IAAAc,WAAA,GAAAd,OAAA;AAEA,IAAAe,gBAAA,GAAAf,OAAA;AAKA,IAAAgB,WAAA,GAAAhB,OAAA;AAEA,IAAAiB,eAAA,GAAAjB,OAAA;AAEA,IAAAkB,eAAA,GAAAlB,OAAA;AAQA,IAAAmB,YAAA,GAAAnB,OAAA;AAKA,IAAAoB,iBAAA,GAAApB,OAAA;AA6BA,IAAAqB,SAAA,GAAArB,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_Camera","require","_MapView","_PointAnnotation","_GeoJSONSourceAnnotation","_Callout","_UserLocation","_NativeUserLocation","_useCurrentPosition","_ImageSource","_GeoJSONSource","_RasterSource","_VectorSource","_Layer","_Images","_MarkerView","_LocationManager","_LogManager","_NetworkManager","_OfflineManager","_OfflinePack","_StaticMapManager","_Animated"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAiBA,IAAAC,QAAA,GAAAD,OAAA;AAQA,IAAAE,gBAAA,GAAAF,OAAA;AAMA,IAAAG,wBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,mBAAA,GAAAP,OAAA;AAEA,IAAAQ,YAAA,GAAAR,OAAA;AAKA,IAAAS,cAAA,GAAAT,OAAA;AAMA,IAAAU,aAAA,GAAAV,OAAA;AAKA,IAAAW,aAAA,GAAAX,OAAA;AAMA,IAAAY,MAAA,GAAAZ,OAAA;AAeA,IAAAa,OAAA,GAAAb,OAAA;AAOA,IAAAc,WAAA,GAAAd,OAAA;AAKA,IAAAe,gBAAA,GAAAf,OAAA;AAKA,IAAAgB,WAAA,GAAAhB,OAAA;AAEA,IAAAiB,eAAA,GAAAjB,OAAA;AAEA,IAAAkB,eAAA,GAAAlB,OAAA;AAQA,IAAAmB,YAAA,GAAAnB,OAAA;AAKA,IAAAoB,iBAAA,GAAApB,OAAA;AA8BA,IAAAqB,SAAA,GAAArB,OAAA","ignoreList":[]}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.anchorToNative = anchorToNative;
7
+ /**
8
+ * Position anchor for markers and annotations.
9
+ * Follows MapLibre GL JS PositionAnchor format.
10
+ *
11
+ * @see https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/PositionAnchor/
12
+ */
13
+
14
+ /**
15
+ * Converts an Anchor string to native {x, y} format.
16
+ * x: 0 = left, 0.5 = center, 1 = right
17
+ * y: 0 = top, 0.5 = center, 1 = bottom
18
+ */
19
+ function anchorToNative(anchor) {
20
+ switch (anchor) {
21
+ case "center":
22
+ return {
23
+ x: 0.5,
24
+ y: 0.5
25
+ };
26
+ case "top":
27
+ return {
28
+ x: 0.5,
29
+ y: 0
30
+ };
31
+ case "bottom":
32
+ return {
33
+ x: 0.5,
34
+ y: 1
35
+ };
36
+ case "left":
37
+ return {
38
+ x: 0,
39
+ y: 0.5
40
+ };
41
+ case "right":
42
+ return {
43
+ x: 1,
44
+ y: 0.5
45
+ };
46
+ case "top-left":
47
+ return {
48
+ x: 0,
49
+ y: 0
50
+ };
51
+ case "top-right":
52
+ return {
53
+ x: 1,
54
+ y: 0
55
+ };
56
+ case "bottom-left":
57
+ return {
58
+ x: 0,
59
+ y: 1
60
+ };
61
+ case "bottom-right":
62
+ return {
63
+ x: 1,
64
+ y: 1
65
+ };
66
+ }
67
+ }
68
+ //# sourceMappingURL=Anchor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["anchorToNative","anchor","x","y"],"sourceRoot":"../../../src","sources":["types/Anchor.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAACC,MAAc,EAA4B;EACvE,QAAQA,MAAM;IACZ,KAAK,QAAQ;MACX,OAAO;QAAEC,CAAC,EAAE,GAAG;QAAEC,CAAC,EAAE;MAAI,CAAC;IAC3B,KAAK,KAAK;MACR,OAAO;QAAED,CAAC,EAAE,GAAG;QAAEC,CAAC,EAAE;MAAE,CAAC;IACzB,KAAK,QAAQ;MACX,OAAO;QAAED,CAAC,EAAE,GAAG;QAAEC,CAAC,EAAE;MAAE,CAAC;IACzB,KAAK,MAAM;MACT,OAAO;QAAED,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAI,CAAC;IACzB,KAAK,OAAO;MACV,OAAO;QAAED,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAI,CAAC;IACzB,KAAK,UAAU;MACb,OAAO;QAAED,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAC;IACvB,KAAK,WAAW;MACd,OAAO;QAAED,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAC;IACvB,KAAK,aAAa;MAChB,OAAO;QAAED,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAC;IACvB,KAAK,cAAc;MACjB,OAAO;QAAED,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAC;EACzB;AACF","ignoreList":[]}
@@ -9,15 +9,19 @@ var _AnimatedCoordinatesArray = require("./AnimatedCoordinatesArray.js");
9
9
  var _AnimatedExtractCoordinateFromArray = require("./AnimatedExtractCoordinateFromArray.js");
10
10
  var _AnimatedGeoJSON = require("./AnimatedGeoJSON.js");
11
11
  var _AnimatedRouteCoordinatesArray = require("./AnimatedRouteCoordinatesArray.js");
12
+ var _MarkerView = require("../../components/annotations/marker-view/MarkerView.js");
12
13
  var _Layer = require("../../components/layers/Layer.js");
13
14
  var _GeoJSONSource = require("../../components/sources/geojson-source/GeoJSONSource.js");
14
15
  var _ImageSource = require("../../components/sources/image-source/ImageSource.js");
15
16
  const Animated = exports.Animated = {
16
17
  // Components
18
+
17
19
  GeoJSONSource: _reactNative.Animated.createAnimatedComponent(_GeoJSONSource.GeoJSONSource),
18
20
  ImageSource: _reactNative.Animated.createAnimatedComponent(_ImageSource.ImageSource),
21
+ MarkerView: _reactNative.Animated.createAnimatedComponent(_MarkerView.MarkerView),
19
22
  Layer: _reactNative.Animated.createAnimatedComponent(_Layer.Layer),
20
23
  // Values
24
+
21
25
  CoordinatesArray: _AnimatedCoordinatesArray.AnimatedCoordinatesArray,
22
26
  RouteCoordinatesArray: _AnimatedRouteCoordinatesArray.AnimatedRouteCoordinatesArray,
23
27
  GeoJSON: _AnimatedGeoJSON.AnimatedGeoJSON,
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_AnimatedCoordinatesArray","_AnimatedExtractCoordinateFromArray","_AnimatedGeoJSON","_AnimatedRouteCoordinatesArray","_Layer","_GeoJSONSource","_ImageSource","Animated","exports","GeoJSONSource","RNAnimated","createAnimatedComponent","ImageSource","Layer","CoordinatesArray","AnimatedCoordinatesArray","RouteCoordinatesArray","AnimatedRouteCoordinatesArray","GeoJSON","AnimatedGeoJSON","ExtractCoordinateFromArray","AnimatedExtractCoordinateFromArray"],"sourceRoot":"../../../../src","sources":["utils/animated/Animated.tsx"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,yBAAA,GAAAD,OAAA;AACA,IAAAE,mCAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,8BAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAEO,MAAMQ,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG;EACtB;EACAE,aAAa,EAAEC,qBAAU,CAACC,uBAAuB,CAC/CF,4BAKF,CAAC;EACDG,WAAW,EAAEF,qBAAU,CAACC,uBAAuB,CAACC,wBAAW,CAAC;EAC5DC,KAAK,EAAEH,qBAAU,CAACC,uBAAuB,CAACE,YAAK,CAAC;EAEhD;EACAC,gBAAgB,EAAEC,kDAAwB;EAC1CC,qBAAqB,EAAEC,4DAA6B;EACpDC,OAAO,EAAEC,gCAAe;EACxBC,0BAA0B,EAAEC;AAC9B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_AnimatedCoordinatesArray","_AnimatedExtractCoordinateFromArray","_AnimatedGeoJSON","_AnimatedRouteCoordinatesArray","_MarkerView","_Layer","_GeoJSONSource","_ImageSource","Animated","exports","GeoJSONSource","RNAnimated","createAnimatedComponent","ImageSource","MarkerView","Layer","CoordinatesArray","AnimatedCoordinatesArray","RouteCoordinatesArray","AnimatedRouteCoordinatesArray","GeoJSON","AnimatedGeoJSON","ExtractCoordinateFromArray","AnimatedExtractCoordinateFromArray"],"sourceRoot":"../../../../src","sources":["utils/animated/Animated.tsx"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,yBAAA,GAAAD,OAAA;AACA,IAAAE,mCAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,8BAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,cAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AAEO,MAAMS,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG;EACtB;;EAEAE,aAAa,EAAEC,qBAAU,CAACC,uBAAuB,CAC/CF,4BAKF,CAAC;EACDG,WAAW,EAAEF,qBAAU,CAACC,uBAAuB,CAACC,wBAAW,CAAC;EAE5DC,UAAU,EAAEH,qBAAU,CAACC,uBAAuB,CAACE,sBAAU,CAAC;EAE1DC,KAAK,EAAEJ,qBAAU,CAACC,uBAAuB,CAACG,YAAK,CAAC;EAEhD;;EAEAC,gBAAgB,EAAEC,kDAAwB;EAC1CC,qBAAqB,EAAEC,4DAA6B;EACpDC,OAAO,EAAEC,gCAAe;EACxBC,0BAA0B,EAAEC;AAC9B,CAAC","ignoreList":[]}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+
3
+ import { Children } from "react";
4
+ import { Animated, StyleSheet, Text, View } from "react-native";
5
+ import CalloutNativeComponent from "./CalloutNativeComponent";
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ const styles = StyleSheet.create({
8
+ animated: {
9
+ alignItems: "center",
10
+ justifyContent: "center",
11
+ width: 180,
12
+ zIndex: 9999999
13
+ },
14
+ content: {
15
+ backgroundColor: "white",
16
+ borderColor: "rgba(0, 0, 0, 0.2)",
17
+ borderRadius: 3,
18
+ borderWidth: 1,
19
+ flex: 1,
20
+ padding: 8,
21
+ position: "relative"
22
+ },
23
+ tip: {
24
+ backgroundColor: "transparent",
25
+ borderBottomColor: "transparent",
26
+ borderBottomWidth: 0,
27
+ borderLeftColor: "transparent",
28
+ borderLeftWidth: 8,
29
+ borderRightColor: "transparent",
30
+ borderRightWidth: 8,
31
+ borderTopColor: "white",
32
+ borderTopWidth: 16,
33
+ elevation: 0,
34
+ marginTop: -2,
35
+ zIndex: 1000
36
+ },
37
+ title: {
38
+ color: "black",
39
+ textAlign: "center"
40
+ }
41
+ });
42
+ /**
43
+ * Callout that displays information about a selected annotation near the annotation.
44
+ */
45
+ export const Callout = ({
46
+ title,
47
+ style,
48
+ animatedStyle,
49
+ contentStyle,
50
+ tipStyle,
51
+ titleStyle,
52
+ children,
53
+ testID,
54
+ ...props
55
+ }) => {
56
+ const calloutContent = Children.count(children) > 0 ? /*#__PURE__*/_jsx(Animated.View, {
57
+ testID: testID ? `${testID}-animated` : undefined,
58
+ style: animatedStyle,
59
+ ...props,
60
+ children: children
61
+ }) : /*#__PURE__*/_jsxs(Animated.View, {
62
+ testID: testID ? `${testID}-animated` : undefined,
63
+ style: [styles.animated, animatedStyle],
64
+ ...props,
65
+ children: [/*#__PURE__*/_jsx(View, {
66
+ testID: testID ? `${testID}-content` : undefined,
67
+ style: [styles.content, contentStyle],
68
+ children: /*#__PURE__*/_jsx(Text, {
69
+ testID: testID ? `${testID}-title` : undefined,
70
+ style: [styles.title, titleStyle],
71
+ children: title
72
+ })
73
+ }), /*#__PURE__*/_jsx(View, {
74
+ testID: testID ? `${testID}-tip` : undefined,
75
+ style: [styles.tip, tipStyle]
76
+ })]
77
+ });
78
+ return /*#__PURE__*/_jsx(CalloutNativeComponent, {
79
+ testID: testID,
80
+ style: [{
81
+ position: "absolute",
82
+ zIndex: 999,
83
+ backgroundColor: "transparent"
84
+ }, style],
85
+ children: calloutContent
86
+ });
87
+ };
88
+ //# sourceMappingURL=Callout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Children","Animated","StyleSheet","Text","View","CalloutNativeComponent","jsx","_jsx","jsxs","_jsxs","styles","create","animated","alignItems","justifyContent","width","zIndex","content","backgroundColor","borderColor","borderRadius","borderWidth","flex","padding","position","tip","borderBottomColor","borderBottomWidth","borderLeftColor","borderLeftWidth","borderRightColor","borderRightWidth","borderTopColor","borderTopWidth","elevation","marginTop","title","color","textAlign","Callout","style","animatedStyle","contentStyle","tipStyle","titleStyle","children","testID","props","calloutContent","count","undefined"],"sourceRoot":"../../../../../src","sources":["components/annotations/callout/Callout.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,OAAO;AAChC,SACEC,QAAQ,EACRC,UAAU,EACVC,IAAI,EACJC,IAAI,QAGC,cAAc;AAErB,OAAOC,sBAAsB,MAAM,0BAA0B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE9D,MAAMC,MAAM,GAAGR,UAAU,CAACS,MAAM,CAAC;EAC/BC,QAAQ,EAAE;IACRC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,KAAK,EAAE,GAAG;IACVC,MAAM,EAAE;EACV,CAAC;EACDC,OAAO,EAAE;IACPC,eAAe,EAAE,OAAO;IACxBC,WAAW,EAAE,oBAAoB;IACjCC,YAAY,EAAE,CAAC;IACfC,WAAW,EAAE,CAAC;IACdC,IAAI,EAAE,CAAC;IACPC,OAAO,EAAE,CAAC;IACVC,QAAQ,EAAE;EACZ,CAAC;EACDC,GAAG,EAAE;IACHP,eAAe,EA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tCtC,IAAA,CAACJ,IAAI;QACH2C,MAAM,EAAEA,MAAM,GAAG,GAAGA,MAAM,QAAQ,GAAGI,SAAU;QAC/CV,KAAK,EAAE,CAAC9B,MAAM,CAAC0B,KAAK,EAAEQ,UAAU,CAAE;QAAAC,QAAA,EAEjCT;MAAK,CACF;IAAC,CACH,CAAC,eACP7B,IAAA,CAACH,IAAI;MACH0C,MAAM,EAAEA,MAAM,GAAG,GAAGA,MAAM,MAAM,GAAGI,SAAU;MAC7CV,KAAK,EAAE,CAAC9B,MAAM,CAACe,GAAG,EAAEkB,QAAQ;IAAE,CAC/B,CAAC;EAAA,CACW,CAChB;EAEH,oBACEpC,IAAA,CAACF,sBAAsB;IACrByC,MAAM,EAAEA,MAAO;IACfN,KAAK,EAAE,CACL;MACEhB,QAAQ,EAAE,UAAU;MACpBR,MAAM,EAAE,GAAG;MACXE,eAAe,EAAE;IACnB,CAAC,EACDsB,KAAK,CACL;IAAAK,QAAA,EAEDG;EAAc,CACO,CAAC;AAE7B,CAAC","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import {
2
+ codegenNativeComponent,
3
+ type HostComponent,
4
+ type ViewProps,
5
+ } from "react-native";
6
+
7
+ export interface NativeProps extends ViewProps {}
8
+
9
+ export default codegenNativeComponent<NativeProps>(
10
+ "MLRNCallout",
11
+ ) as HostComponent<NativeProps>;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ import { useRef } from "react";
4
+ import { Platform, View } from "react-native";
5
+ import MarkerViewNativeComponent from "./MarkerViewNativeComponent";
6
+ import { useFrozenId } from "../../../hooks/useFrozenId.js";
7
+ import { anchorToNative } from "../../../types/Anchor.js";
8
+ import { PointAnnotation } from "../point-annotation/PointAnnotation.js";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ /**
11
+ * MarkerView allows you to place an interactive React Native View on the map.
12
+ *
13
+ * If you have static view consider using PointAnnotation or SymbolLayer for better performance.
14
+ *
15
+ * Implemented through:
16
+ * - Android: Native MarkerViewManager using map projection
17
+ * - iOS: [MLNPointAnnotation](https://maplibre.org/maplibre-native/ios/latest/documentation/maplibre/mlnpointannotation/)
18
+ */
19
+ export const MarkerView = ({
20
+ id,
21
+ anchor = "center",
22
+ offset,
23
+ ...props
24
+ }) => {
25
+ const nativeRef = useRef(null);
26
+ const nativeAnchor = anchorToNative(anchor);
27
+ const nativeOffset = offset ? {
28
+ x: offset[0],
29
+ y: offset[1]
30
+ } : undefined;
31
+ const pointAnnotationRef = useRef(null);
32
+ const frozenId = useFrozenId(id);
33
+ if (Platform.OS === "ios") {
34
+ return /*#__PURE__*/_jsx(PointAnnotation, {
35
+ ref: pointAnnotationRef,
36
+ id: frozenId,
37
+ anchor: anchor,
38
+ offset: offset,
39
+ ...props
40
+ });
41
+ }
42
+ return /*#__PURE__*/_jsx(MarkerViewNativeComponent, {
43
+ ref: nativeRef,
44
+ id: frozenId,
45
+ anchor: nativeAnchor,
46
+ offset: nativeOffset,
47
+ ...props,
48
+ style: [{
49
+ flex: 0,
50
+ alignSelf: "flex-start",
51
+ overflow: "visible"
52
+ }, props.style],
53
+ children: /*#__PURE__*/_jsx(View, {
54
+ collapsable: false,
55
+ style: {
56
+ flex: 0,
57
+ alignSelf: "flex-start",
58
+ overflow: "visible"
59
+ },
60
+ children: props.children
61
+ })
62
+ });
63
+ };
64
+ //# sourceMappingURL=MarkerView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useRef","Platform","View","MarkerViewNativeComponent","useFrozenId","anchorToNative","PointAnnotation","jsx","_jsx","MarkerView","id","anchor","offset","props","nativeRef","nativeAnchor","nativeOffset","x","y","undefined","pointAnnotationRef","frozenId","OS","ref","style","flex","alignSelf","overflow","children","collapsable"],"sourceRoot":"../../../../../src","sources":["components/annotations/marker-view/MarkerView.tsx"],"mappings":";;AAAA,SAIEA,MAAM,QACD,OAAO;AACd,SAEEC,QAAQ,EACRC,IAAI,QAEC,cAAc;AAErB,OAAOC,yBAAyB,MAAM,6BAA6B;A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,EAAE,KAAM;MACnBL,KAAK,EAAE;QAAEC,IAAI,EAAE,CAAC;QAAEC,SAAS,EAAE,YAAY;QAAEC,QAAQ,EAAE;MAAU,CAAE;MAAAC,QAAA,EAEhEf,KAAK,CAACe;IAAQ,CACX;EAAC,CACkB,CAAC;AAEhC,CAAC","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ import {
2
+ codegenNativeComponent,
3
+ type CodegenTypes,
4
+ type HostComponent,
5
+ type ViewProps,
6
+ } from "react-native";
7
+
8
+ import type { UnsafeMixed } from "../../../types/codegen/UnsafeMixed";
9
+
10
+ type NativeAnchor = {
11
+ x: CodegenTypes.Double;
12
+ y: CodegenTypes.Double;
13
+ };
14
+
15
+ type NativeOffset = {
16
+ x: CodegenTypes.Double;
17
+ y: CodegenTypes.Double;
18
+ };
19
+
20
+ export interface NativeProps extends ViewProps {
21
+ lngLat: UnsafeMixed<
22
+ [longitude: CodegenTypes.Double, latitude: CodegenTypes.Double]
23
+ >;
24
+ anchor?: NativeAnchor;
25
+ offset?: NativeOffset;
26
+ }
27
+
28
+ export default codegenNativeComponent<NativeProps>(
29
+ "MLRNMarkerView",
30
+ ) as HostComponent<NativeProps>;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ import { Children, forwardRef, isValidElement, useImperativeHandle, useRef } from "react";
4
+ import { Platform, StyleSheet, View } from "react-native";
5
+ import PointAnnotationNativeComponent, { Commands } from "./PointAnnotationNativeComponent";
6
+ import { useFrozenId } from "../../../hooks/useFrozenId.js";
7
+ import { anchorToNative } from "../../../types/Anchor.js";
8
+ import { Callout } from "../callout/Callout.js";
9
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
10
+ const styles = StyleSheet.create({
11
+ container: {
12
+ alignItems: "center",
13
+ justifyContent: "center",
14
+ position: "absolute"
15
+ }
16
+ });
17
+ /**
18
+ * PointAnnotation represents a one-dimensional shape located at a single geographical coordinate.
19
+ *
20
+ * Consider using GeoJSONSource and SymbolLayer instead, if you have many points, and you have static images,
21
+ * they'll offer much better performance.
22
+ *
23
+ * If you need interactive views please use MarkerView,
24
+ * as with PointAnnotation on Android child views are rendered onto a bitmap for better performance.
25
+ */
26
+ export const PointAnnotation = /*#__PURE__*/forwardRef(({
27
+ id,
28
+ anchor = "center",
29
+ draggable = false,
30
+ offset,
31
+ ...props
32
+ }, ref) => {
33
+ const frozenId = useFrozenId(id);
34
+ const nativeAnchor = anchorToNative(anchor);
35
+ const nativeOffset = offset ? {
36
+ x: offset[0],
37
+ y: offset[1]
38
+ } : undefined;
39
+ const nativeRef = useRef(null);
40
+ useImperativeHandle(ref, () => ({
41
+ refresh
42
+ }));
43
+ function refresh() {
44
+ if (Platform.OS === "android" && nativeRef.current) {
45
+ Commands.refresh(nativeRef.current);
46
+ }
47
+ }
48
+
49
+ // On Android, wrap children in a non-collapsable View to prevent Fabric
50
+ // from flattening the view hierarchy. Without this, Fabric may flatten
51
+ // intermediate Views, causing their backgrounds to disappear.
52
+ // We need to keep Callout separate so native code can identify it.
53
+ const wrappedChildren = (() => {
54
+ if (Platform.OS !== "android") {
55
+ return props.children;
56
+ }
57
+
58
+ // Separate Callout from other children so native can identify it
59
+ const childArray = Children.toArray(props.children);
60
+ const callout = childArray.find(child => /*#__PURE__*/isValidElement(child) && child.type === Callout);
61
+ const otherChildren = childArray.filter(child => ! /*#__PURE__*/isValidElement(child) || child.type !== Callout);
62
+ return /*#__PURE__*/_jsxs(_Fragment, {
63
+ children: [/*#__PURE__*/_jsx(View, {
64
+ collapsable: false,
65
+ style: {
66
+ overflow: "visible"
67
+ },
68
+ children: otherChildren
69
+ }), callout]
70
+ });
71
+ })();
72
+ return /*#__PURE__*/_jsx(PointAnnotationNativeComponent, {
73
+ ref: nativeRef,
74
+ ...props,
75
+ id: frozenId,
76
+ anchor: nativeAnchor,
77
+ offset: nativeOffset,
78
+ draggable: draggable,
79
+ style: [props.style, styles.container],
80
+ children: wrappedChildren
81
+ });
82
+ });
83
+ //# sourceMappingURL=PointAnnotation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Children","forwardRef","isValidElement","useImperativeHandle","useRef","Platform","StyleSheet","View","PointAnnotationNativeComponent","Commands","useFrozenId","anchorToNative","Callout","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","styles","create","container","alignItems","justifyContent","position","PointAnnotation","id","anchor","draggable","offset","props","ref","frozenId","nativeAnchor","nativeOffset","x","y","undefined","nativeRef","refresh","OS","current","wrappedChildren","children","childArray","toArray","callout","find","child","type","otherChildren","filter","collapsable","style","overflow"],"sourceRoot":"../../../../../src","sources":["components/annotations/point-annotation/PointAnnotation.tsx"],"mappings":";;AAAA,SACEA,QAAQ,EAGRC,UAAU,EACVC,cAAc,EAEdC,mBAAmB,EACnBC,MAAM,QACD,OAAO;AACd,SAGEC,QAAQ,EACRC,UAAU,EACVC,IAAI,QAEC,cAAc;AAErB,OAAOC,8BAA8B,IACnCC,QAAQ,QACH,kCAAkC;AACzC,SAASC,WAAW,QAAQ,+BAA4B;AACxD,SAAsBC,cAAc,QAAQ,0BAAuB;AAInE,SAASC,OAAO,QAAQ,uBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAE7C,MAAMC,MAAM,GAAGb,UAAU,CAACc,MAAM,CAAC;EAC/BC,SAAS,EAAE;IACTC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAiGF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,gBAAGxB,UAAU,CAIvC,CACE;EACEyB,EAAE;EACFC,MAAM,GAAG,QAAQ;EACjBC,SAAS,GAAG,KAAK;EACjBC,MAAM;EACN,GAAGC;AACiB,CAAC,EACvBC,GAAG,KACA;EACH,MAAMC,QAAQ,GAAGtB,WAAW,CAACgB,EAAE,CAAC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AO;IAAA,CACR,CAAC;EAEP,CAAC,EAAE,CAAC;EAEJ,oBACEhC,IAAA,CAACN,8BAA8B;IAC7BuB,GAAG,EAAEO,SAAU;IAAA,GACXR,KAAK;IACTJ,EAAE,EAAEM,QAAS;IACbL,MAAM,EAAEM,YAAa;IACrBJ,MAAM,EAAEK,YAAa;IACrBN,SAAS,EAAEA,SAAU;IACrByB,KAAK,EAAE,CAACvB,KAAK,CAACuB,KAAK,EAAElC,MAAM,CAACE,SAAS,CAAE;IAAAsB,QAAA,EAEtCD;EAAe,CACc,CAAC;AAErC,CACF,CAAC","ignoreList":[]}
@@ -0,0 +1,58 @@
1
+ import {
2
+ codegenNativeCommands,
3
+ codegenNativeComponent,
4
+ type CodegenTypes,
5
+ type HostComponent,
6
+ type ViewProps,
7
+ } from "react-native";
8
+
9
+ import type { UnsafeMixed } from "../../../types/codegen/UnsafeMixed";
10
+
11
+ type NativeAnchor = {
12
+ x: CodegenTypes.Double;
13
+ y: CodegenTypes.Double;
14
+ };
15
+
16
+ type NativeOffset = {
17
+ x: CodegenTypes.Double;
18
+ y: CodegenTypes.Double;
19
+ };
20
+
21
+ type NativeAnnotationEvent = {
22
+ id: string;
23
+ lngLat: UnsafeMixed<
24
+ [longitude: CodegenTypes.Double, latitude: CodegenTypes.Double]
25
+ >;
26
+ point: UnsafeMixed<[x: CodegenTypes.Double, y: CodegenTypes.Double]>;
27
+ };
28
+
29
+ export interface NativeProps extends ViewProps {
30
+ id: string;
31
+ title?: string;
32
+ snippet?: string;
33
+ selected?: CodegenTypes.WithDefault<boolean, false>;
34
+ draggable?: CodegenTypes.WithDefault<boolean, false>;
35
+ lngLat: UnsafeMixed<
36
+ [longitude: CodegenTypes.Double, latitude: CodegenTypes.Double]
37
+ >;
38
+ anchor?: NativeAnchor;
39
+ offset?: NativeOffset;
40
+
41
+ onSelected?: CodegenTypes.DirectEventHandler<NativeAnnotationEvent>;
42
+ onDeselected?: CodegenTypes.DirectEventHandler<NativeAnnotationEvent>;
43
+ onDragStart?: CodegenTypes.DirectEventHandler<NativeAnnotationEvent>;
44
+ onDrag?: CodegenTypes.DirectEventHandler<NativeAnnotationEvent>;
45
+ onDragEnd?: CodegenTypes.DirectEventHandler<NativeAnnotationEvent>;
46
+ }
47
+
48
+ interface NativeCommands {
49
+ refresh: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
50
+ }
51
+
52
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
53
+ supportedCommands: ["refresh"],
54
+ });
55
+
56
+ export default codegenNativeComponent<NativeProps>(
57
+ "MLRNPointAnnotation",
58
+ ) as HostComponent<NativeProps>;
@@ -2,9 +2,9 @@
2
2
 
3
3
  export { Camera } from "./components/camera/Camera.js";
4
4
  export { MapView } from "./components/map-view/MapView.js";
5
- export { PointAnnotation } from "./components/annotations/PointAnnotation.js";
5
+ export { PointAnnotation } from "./components/annotations/point-annotation/PointAnnotation.js";
6
6
  export { GeoJSONSourceAnnotation } from "./components/annotations/GeoJSONSourceAnnotation.js";
7
- export { Callout } from "./components/annotations/Callout.js";
7
+ export { Callout } from "./components/annotations/callout/Callout.js";
8
8
  export { UserLocation } from "./components/user-location/UserLocation.js";
9
9
  export { NativeUserLocation } from "./components/user-location/NativeUserLocation.js";
10
10
  export { useCurrentPosition } from "./hooks/useCurrentPosition.js";
@@ -14,7 +14,7 @@ export { RasterSource } from "./components/sources/raster-source/RasterSource.js
14
14
  export { VectorSource } from "./components/sources/vector-source/VectorSource.js";
15
15
  export { Layer } from "./components/layers/Layer.js";
16
16
  export { Images } from "./components/images/Images.js";
17
- export { MarkerView } from "./components/annotations/MarkerView.js";
17
+ export { MarkerView } from "./components/annotations/marker-view/MarkerView.js";
18
18
  export { LocationManager } from "./modules/location/LocationManager.js";
19
19
  export { LogManager } from "./modules/log/LogManager.js";
20
20
  export { NetworkManager } from "./modules/network/NetworkManager.js";
@@ -1 +1 @@
1
- {"version":3,"names":["Camera","MapView","PointAnnotation","GeoJSONSourceAnnotation","Callout","UserLocation","NativeUserLocation","useCurrentPosition","ImageSource","GeoJSONSource","RasterSource","VectorSource","Layer","Images","MarkerView","LocationManager","LogManager","NetworkManager","OfflineManager","OfflinePack","StaticMapImageManager","Animated"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAcEA,MAAM,QACD,+BAA4B;AAEnC,SAKEC,OAAO,QACF,kCAA+B;AAEtC,SAASC,eAAe,QAAQ,6CAA0C;AAE1E,SAASC,uBAAuB,QAAQ,qDAAkD;AAC1F,SAASC,OAAO,QAAQ,qCAAkC;AAE1D,SAASC,YAAY,QAAQ,4CAAyC;AACtE,SAASC,kBAAkB,QAAQ,kDAA+C;AAClF,SAASC,kBAAkB,QAAQ,+BAA4B;AAE/D,SAEEC,WAAW,QACN,kDAA+C;AAEtD,SAGEC,aAAa,QACR,sDAAmD;AAE1D,SAEEC,YAAY,QACP,oDAAiD;AAExD,SAGEC,YAAY,QACP,oDAAiD;AAExD,SACEC,KAAK,QAYA,8BAA2B;AAElC,SAIEC,MAAM,QACD,+BAA4B;AAEnC,SAASC,UAAU,QAAQ,wCAAqC;AAEhE,SACEC,eAAe,QAEV,uCAAoC;AAE3C,SAASC,UAAU,QAAuB,6BAA0B;AAEpE,SAASC,cAAc,QAAQ,qCAAkC;AAEjE,SACEC,cAAc,QAMT,qCAAkC;AACzC,SACEC,WAAW,QAEN,kCAA+B;AAEtC,SACEC,qBAAqB,QAKhB,0CAAuC;AAuB9C,SAASC,QAAQ,QAAQ,8BAA2B","ignoreList":[]}
1
+ {"version":3,"names":["Camera","MapView","PointAnnotation","GeoJSONSourceAnnotation","Callout","UserLocation","NativeUserLocation","useCurrentPosition","ImageSource","GeoJSONSource","RasterSource","VectorSource","Layer","Images","MarkerView","LocationManager","LogManager","NetworkManager","OfflineManager","OfflinePack","StaticMapImageManager","Animated"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAcEA,MAAM,QACD,+BAA4B;AAEnC,SAKEC,OAAO,QACF,kCAA+B;AAEtC,SACEC,eAAe,QAIV,8DAA2D;AAClE,SAASC,uBAAuB,QAAQ,qDAAkD;AAC1F,SACEC,OAAO,QAEF,6CAA0C;AAEjD,SAASC,YAAY,QAAQ,4CAAyC;AACtE,SAASC,kBAAkB,QAAQ,kDAA+C;AAClF,SAASC,kBAAkB,QAAQ,+BAA4B;AAE/D,SAEEC,WAAW,QACN,kDAA+C;AAEtD,SAGEC,aAAa,QACR,sDAAmD;AAE1D,SAEEC,YAAY,QACP,oDAAiD;AAExD,SAGEC,YAAY,QACP,oDAAiD;AAExD,SACEC,KAAK,QAYA,8BAA2B;AAElC,SAIEC,MAAM,QACD,+BAA4B;AAEnC,SACEC,UAAU,QAEL,oDAAiD;AAExD,SACEC,eAAe,QAEV,uCAAoC;AAE3C,SAASC,UAAU,QAAuB,6BAA0B;AAEpE,SAASC,cAAc,QAAQ,qCAAkC;AAEjE,SACEC,cAAc,QAMT,qCAAkC;AACzC,SACEC,WAAW,QAEN,kCAA+B;AAEtC,SACEC,qBAAqB,QAKhB,0CAAuC;AAwB9C,SAASC,QAAQ,QAAQ,8BAA2B","ignoreList":[]}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Position anchor for markers and annotations.
5
+ * Follows MapLibre GL JS PositionAnchor format.
6
+ *
7
+ * @see https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/PositionAnchor/
8
+ */
9
+
10
+ /**
11
+ * Converts an Anchor string to native {x, y} format.
12
+ * x: 0 = left, 0.5 = center, 1 = right
13
+ * y: 0 = top, 0.5 = center, 1 = bottom
14
+ */
15
+ export function anchorToNative(anchor) {
16
+ switch (anchor) {
17
+ case "center":
18
+ return {
19
+ x: 0.5,
20
+ y: 0.5
21
+ };
22
+ case "top":
23
+ return {
24
+ x: 0.5,
25
+ y: 0
26
+ };
27
+ case "bottom":
28
+ return {
29
+ x: 0.5,
30
+ y: 1
31
+ };
32
+ case "left":
33
+ return {
34
+ x: 0,
35
+ y: 0.5
36
+ };
37
+ case "right":
38
+ return {
39
+ x: 1,
40
+ y: 0.5
41
+ };
42
+ case "top-left":
43
+ return {
44
+ x: 0,
45
+ y: 0
46
+ };
47
+ case "top-right":
48
+ return {
49
+ x: 1,
50
+ y: 0
51
+ };
52
+ case "bottom-left":
53
+ return {
54
+ x: 0,
55
+ y: 1
56
+ };
57
+ case "bottom-right":
58
+ return {
59
+ x: 1,
60
+ y: 1
61
+ };
62
+ }
63
+ }
64
+ //# sourceMappingURL=Anchor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["anchorToNative","anchor","x","y"],"sourceRoot":"../../../src","sources":["types/Anchor.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,cAAcA,CAACC,MAAc,EAA4B;EACvE,QAAQA,MAAM;IACZ,KAAK,QAAQ;MACX,OAAO;QAAEC,CAAC,EAAE,GAAG;QAAEC,CAAC,EAAE;MAAI,CAAC;IAC3B,KAAK,KAAK;MACR,OAAO;QAAED,CAAC,EAAE,GAAG;QAAEC,CAAC,EAAE;MAAE,CAAC;IACzB,KAAK,QAAQ;MACX,OAAO;QAAED,CAAC,EAAE,GAAG;QAAEC,CAAC,EAAE;MAAE,CAAC;IACzB,KAAK,MAAM;MACT,OAAO;QAAED,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAI,CAAC;IACzB,KAAK,OAAO;MACV,OAAO;QAAED,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAI,CAAC;IACzB,KAAK,UAAU;MACb,OAAO;QAAED,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAC;IACvB,KAAK,WAAW;MACd,OAAO;QAAED,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAC;IACvB,KAAK,aAAa;MAChB,OAAO;QAAED,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAC;IACvB,KAAK,cAAc;MACjB,OAAO;QAAED,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAC;EACzB;AACF","ignoreList":[]}