@maydon_tech/react-native-nitro-maps 0.1.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 (283) hide show
  1. package/LICENSE +20 -0
  2. package/NitroMap.podspec +42 -0
  3. package/README.md +172 -0
  4. package/android/CMakeLists.txt +27 -0
  5. package/android/build.gradle +141 -0
  6. package/android/gradle.properties +5 -0
  7. package/android/src/main/AndroidManifest.xml +3 -0
  8. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  9. package/android/src/main/java/com/margelo/nitro/nitromap/ClusterIconGenerator.kt +108 -0
  10. package/android/src/main/java/com/margelo/nitro/nitromap/ColorUtils.kt +63 -0
  11. package/android/src/main/java/com/margelo/nitro/nitromap/HybridNitroMap.kt +408 -0
  12. package/android/src/main/java/com/margelo/nitro/nitromap/HybridNitroMapConfig.kt +68 -0
  13. package/android/src/main/java/com/margelo/nitro/nitromap/MarkerIconCache.kt +176 -0
  14. package/android/src/main/java/com/margelo/nitro/nitromap/MarkerIconFactory.kt +252 -0
  15. package/android/src/main/java/com/margelo/nitro/nitromap/NitroMapPackage.kt +33 -0
  16. package/android/src/main/java/com/margelo/nitro/nitromap/clustering/NitroClusterEngine.kt +252 -0
  17. package/android/src/main/java/com/margelo/nitro/nitromap/clustering/QuadTree.kt +195 -0
  18. package/android/src/main/java/com/margelo/nitro/nitromap/providers/GoogleMapProvider.kt +912 -0
  19. package/android/src/main/java/com/margelo/nitro/nitromap/providers/MapProviderInterface.kt +70 -0
  20. package/cpp/ClusterEngine.hpp +411 -0
  21. package/cpp/KDBush.hpp +238 -0
  22. package/cpp/QuadTree.hpp +246 -0
  23. package/ios/Clustering/ClusterEngineWrapper.h +58 -0
  24. package/ios/Clustering/ClusterEngineWrapper.mm +142 -0
  25. package/ios/Clustering/ClusterIconRenderer.swift +80 -0
  26. package/ios/Clustering/NitroClusterEngine.swift +117 -0
  27. package/ios/Clustering/NitroClusterIconGenerator.swift +35 -0
  28. package/ios/MarkerRenderer/MarkerIconFactory.swift +322 -0
  29. package/ios/MarkerRenderer/PriceMarkerRenderer.swift +140 -0
  30. package/ios/NitroMap.swift +332 -0
  31. package/ios/NitroMapConfig/HybridNitroMapConfig.swift +33 -0
  32. package/ios/Providers/GoogleMapDelegate.swift +310 -0
  33. package/ios/Providers/GoogleMapProvider+Camera.swift +164 -0
  34. package/ios/Providers/GoogleMapProvider.swift +924 -0
  35. package/ios/Providers/MapProviderProtocol.swift +78 -0
  36. package/ios/Shared/ClusterConfig+Factory.swift +58 -0
  37. package/ios/Shared/ClusteringManager.swift +211 -0
  38. package/ios/Shared/MapStyleProvider.swift +135 -0
  39. package/ios/Shared/MarkerSelectionHandler.swift +116 -0
  40. package/ios/Utils/ColorValueExtension.swift +54 -0
  41. package/lib/module/components/ImageMarker.js +146 -0
  42. package/lib/module/components/ImageMarker.js.map +1 -0
  43. package/lib/module/components/NitroMap.js +320 -0
  44. package/lib/module/components/NitroMap.js.map +1 -0
  45. package/lib/module/components/PriceMarker.js +165 -0
  46. package/lib/module/components/PriceMarker.js.map +1 -0
  47. package/lib/module/context/NitroMapContext.js +15 -0
  48. package/lib/module/context/NitroMapContext.js.map +1 -0
  49. package/lib/module/hooks/useNitroMarker.js +104 -0
  50. package/lib/module/hooks/useNitroMarker.js.map +1 -0
  51. package/lib/module/index.js +21 -0
  52. package/lib/module/index.js.map +1 -0
  53. package/lib/module/modules/index.js +4 -0
  54. package/lib/module/modules/index.js.map +1 -0
  55. package/lib/module/modules/module.js +30 -0
  56. package/lib/module/modules/module.js.map +1 -0
  57. package/lib/module/package.json +1 -0
  58. package/lib/module/specs/NitroMap.nitro.js +4 -0
  59. package/lib/module/specs/NitroMap.nitro.js.map +1 -0
  60. package/lib/module/specs/NitroMapConfig.nitro.js +4 -0
  61. package/lib/module/specs/NitroMapConfig.nitro.js.map +1 -0
  62. package/lib/module/types/map.js +2 -0
  63. package/lib/module/types/map.js.map +1 -0
  64. package/lib/module/types/marker.js +4 -0
  65. package/lib/module/types/marker.js.map +1 -0
  66. package/lib/module/utils/colors.js +147 -0
  67. package/lib/module/utils/colors.js.map +1 -0
  68. package/lib/typescript/package.json +1 -0
  69. package/lib/typescript/src/components/ImageMarker.d.ts +70 -0
  70. package/lib/typescript/src/components/ImageMarker.d.ts.map +1 -0
  71. package/lib/typescript/src/components/NitroMap.d.ts +14 -0
  72. package/lib/typescript/src/components/NitroMap.d.ts.map +1 -0
  73. package/lib/typescript/src/components/PriceMarker.d.ts +88 -0
  74. package/lib/typescript/src/components/PriceMarker.d.ts.map +1 -0
  75. package/lib/typescript/src/context/NitroMapContext.d.ts +16 -0
  76. package/lib/typescript/src/context/NitroMapContext.d.ts.map +1 -0
  77. package/lib/typescript/src/hooks/useNitroMarker.d.ts +78 -0
  78. package/lib/typescript/src/hooks/useNitroMarker.d.ts.map +1 -0
  79. package/lib/typescript/src/index.d.ts +12 -0
  80. package/lib/typescript/src/index.d.ts.map +1 -0
  81. package/lib/typescript/src/modules/index.d.ts +2 -0
  82. package/lib/typescript/src/modules/index.d.ts.map +1 -0
  83. package/lib/typescript/src/modules/module.d.ts +22 -0
  84. package/lib/typescript/src/modules/module.d.ts.map +1 -0
  85. package/lib/typescript/src/specs/NitroMap.nitro.d.ts +227 -0
  86. package/lib/typescript/src/specs/NitroMap.nitro.d.ts.map +1 -0
  87. package/lib/typescript/src/specs/NitroMapConfig.nitro.d.ts +10 -0
  88. package/lib/typescript/src/specs/NitroMapConfig.nitro.d.ts.map +1 -0
  89. package/lib/typescript/src/types/map.d.ts +154 -0
  90. package/lib/typescript/src/types/map.d.ts.map +1 -0
  91. package/lib/typescript/src/types/marker.d.ts +248 -0
  92. package/lib/typescript/src/types/marker.d.ts.map +1 -0
  93. package/lib/typescript/src/utils/colors.d.ts +82 -0
  94. package/lib/typescript/src/utils/colors.d.ts.map +1 -0
  95. package/nitro.json +21 -0
  96. package/nitrogen/generated/android/c++/JCamera.hpp +74 -0
  97. package/nitrogen/generated/android/c++/JClusterAnimationStyle.hpp +68 -0
  98. package/nitrogen/generated/android/c++/JClusterConfig.hpp +121 -0
  99. package/nitrogen/generated/android/c++/JClusterPressEvent.hpp +86 -0
  100. package/nitrogen/generated/android/c++/JClusterStrategy.hpp +59 -0
  101. package/nitrogen/generated/android/c++/JColorValue.cpp +26 -0
  102. package/nitrogen/generated/android/c++/JColorValue.hpp +70 -0
  103. package/nitrogen/generated/android/c++/JCoordinate.hpp +61 -0
  104. package/nitrogen/generated/android/c++/JEdgePadding.hpp +69 -0
  105. package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
  106. package/nitrogen/generated/android/c++/JFunc_void_ClusterPressEvent.hpp +81 -0
  107. package/nitrogen/generated/android/c++/JFunc_void_MapError.hpp +78 -0
  108. package/nitrogen/generated/android/c++/JFunc_void_MapPressEvent.hpp +81 -0
  109. package/nitrogen/generated/android/c++/JFunc_void_MarkerDragEvent.hpp +80 -0
  110. package/nitrogen/generated/android/c++/JFunc_void_MarkerPressEvent.hpp +80 -0
  111. package/nitrogen/generated/android/c++/JFunc_void_RegionChangeEvent.hpp +79 -0
  112. package/nitrogen/generated/android/c++/JHybridNitroMapConfigSpec.cpp +59 -0
  113. package/nitrogen/generated/android/c++/JHybridNitroMapConfigSpec.hpp +66 -0
  114. package/nitrogen/generated/android/c++/JHybridNitroMapSpec.cpp +593 -0
  115. package/nitrogen/generated/android/c++/JHybridNitroMapSpec.hpp +125 -0
  116. package/nitrogen/generated/android/c++/JImageMarkerConfig.hpp +86 -0
  117. package/nitrogen/generated/android/c++/JMapBoundaries.hpp +62 -0
  118. package/nitrogen/generated/android/c++/JMapError.hpp +61 -0
  119. package/nitrogen/generated/android/c++/JMapPressEvent.hpp +64 -0
  120. package/nitrogen/generated/android/c++/JMapProvider.hpp +62 -0
  121. package/nitrogen/generated/android/c++/JMapStyleElement.hpp +87 -0
  122. package/nitrogen/generated/android/c++/JMapStyler.hpp +78 -0
  123. package/nitrogen/generated/android/c++/JMapType.hpp +62 -0
  124. package/nitrogen/generated/android/c++/JMarkerAnimation.hpp +62 -0
  125. package/nitrogen/generated/android/c++/JMarkerColor.hpp +69 -0
  126. package/nitrogen/generated/android/c++/JMarkerConfig.hpp +77 -0
  127. package/nitrogen/generated/android/c++/JMarkerData.hpp +121 -0
  128. package/nitrogen/generated/android/c++/JMarkerDragEvent.hpp +63 -0
  129. package/nitrogen/generated/android/c++/JMarkerPressEvent.hpp +63 -0
  130. package/nitrogen/generated/android/c++/JMarkerStyle.hpp +62 -0
  131. package/nitrogen/generated/android/c++/JPoint.hpp +61 -0
  132. package/nitrogen/generated/android/c++/JPriceMarkerStyle.hpp +102 -0
  133. package/nitrogen/generated/android/c++/JRegion.hpp +69 -0
  134. package/nitrogen/generated/android/c++/JRegionChangeEvent.hpp +62 -0
  135. package/nitrogen/generated/android/c++/JVariant_String_MarkerColor.cpp +26 -0
  136. package/nitrogen/generated/android/c++/JVariant_String_MarkerColor.hpp +70 -0
  137. package/nitrogen/generated/android/c++/views/JHybridNitroMapStateUpdater.cpp +144 -0
  138. package/nitrogen/generated/android/c++/views/JHybridNitroMapStateUpdater.hpp +49 -0
  139. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Camera.kt +50 -0
  140. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/ClusterAnimationStyle.kt +24 -0
  141. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/ClusterConfig.kt +80 -0
  142. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/ClusterPressEvent.kt +44 -0
  143. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/ClusterStrategy.kt +21 -0
  144. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/ColorValue.kt +59 -0
  145. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Coordinate.kt +41 -0
  146. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/EdgePadding.kt +47 -0
  147. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Func_void.kt +80 -0
  148. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Func_void_ClusterPressEvent.kt +80 -0
  149. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Func_void_MapError.kt +80 -0
  150. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Func_void_MapPressEvent.kt +80 -0
  151. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Func_void_MarkerDragEvent.kt +80 -0
  152. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Func_void_MarkerPressEvent.kt +80 -0
  153. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Func_void_RegionChangeEvent.kt +80 -0
  154. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/HybridNitroMapConfigSpec.kt +61 -0
  155. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/HybridNitroMapSpec.kt +342 -0
  156. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/ImageMarkerConfig.kt +56 -0
  157. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MapBoundaries.kt +41 -0
  158. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MapError.kt +41 -0
  159. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MapPressEvent.kt +41 -0
  160. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MapProvider.kt +22 -0
  161. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MapStyleElement.kt +44 -0
  162. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MapStyler.kt +53 -0
  163. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MapType.kt +22 -0
  164. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MarkerAnimation.kt +22 -0
  165. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MarkerColor.kt +47 -0
  166. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MarkerConfig.kt +44 -0
  167. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MarkerData.kt +71 -0
  168. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MarkerDragEvent.kt +41 -0
  169. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MarkerPressEvent.kt +41 -0
  170. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MarkerStyle.kt +22 -0
  171. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Point.kt +41 -0
  172. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/PriceMarkerStyle.kt +68 -0
  173. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Region.kt +47 -0
  174. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/RegionChangeEvent.kt +41 -0
  175. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Variant_String_MarkerColor.kt +59 -0
  176. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/nitromapOnLoad.kt +35 -0
  177. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/views/HybridNitroMapManager.kt +50 -0
  178. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/views/HybridNitroMapStateUpdater.kt +23 -0
  179. package/nitrogen/generated/android/nitromap+autolinking.cmake +87 -0
  180. package/nitrogen/generated/android/nitromap+autolinking.gradle +27 -0
  181. package/nitrogen/generated/android/nitromapOnLoad.cpp +70 -0
  182. package/nitrogen/generated/android/nitromapOnLoad.hpp +25 -0
  183. package/nitrogen/generated/ios/NitroMap+autolinking.rb +60 -0
  184. package/nitrogen/generated/ios/NitroMap-Swift-Cxx-Bridge.cpp +130 -0
  185. package/nitrogen/generated/ios/NitroMap-Swift-Cxx-Bridge.hpp +793 -0
  186. package/nitrogen/generated/ios/NitroMap-Swift-Cxx-Umbrella.hpp +132 -0
  187. package/nitrogen/generated/ios/NitroMapAutolinking.mm +41 -0
  188. package/nitrogen/generated/ios/NitroMapAutolinking.swift +40 -0
  189. package/nitrogen/generated/ios/c++/HybridNitroMapConfigSpecSwift.cpp +11 -0
  190. package/nitrogen/generated/ios/c++/HybridNitroMapConfigSpecSwift.hpp +84 -0
  191. package/nitrogen/generated/ios/c++/HybridNitroMapSpecSwift.cpp +11 -0
  192. package/nitrogen/generated/ios/c++/HybridNitroMapSpecSwift.hpp +410 -0
  193. package/nitrogen/generated/ios/c++/views/HybridNitroMapComponent.mm +206 -0
  194. package/nitrogen/generated/ios/swift/Camera.swift +80 -0
  195. package/nitrogen/generated/ios/swift/ClusterAnimationStyle.swift +52 -0
  196. package/nitrogen/generated/ios/swift/ClusterConfig.swift +268 -0
  197. package/nitrogen/generated/ios/swift/ClusterPressEvent.swift +70 -0
  198. package/nitrogen/generated/ios/swift/ClusterStrategy.swift +40 -0
  199. package/nitrogen/generated/ios/swift/ColorValue.swift +18 -0
  200. package/nitrogen/generated/ios/swift/Coordinate.swift +47 -0
  201. package/nitrogen/generated/ios/swift/EdgePadding.swift +69 -0
  202. package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  203. package/nitrogen/generated/ios/swift/Func_void_Camera.swift +47 -0
  204. package/nitrogen/generated/ios/swift/Func_void_ClusterPressEvent.swift +47 -0
  205. package/nitrogen/generated/ios/swift/Func_void_MapBoundaries.swift +47 -0
  206. package/nitrogen/generated/ios/swift/Func_void_MapError.swift +47 -0
  207. package/nitrogen/generated/ios/swift/Func_void_MapPressEvent.swift +47 -0
  208. package/nitrogen/generated/ios/swift/Func_void_MarkerDragEvent.swift +47 -0
  209. package/nitrogen/generated/ios/swift/Func_void_MarkerPressEvent.swift +47 -0
  210. package/nitrogen/generated/ios/swift/Func_void_RegionChangeEvent.swift +47 -0
  211. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
  212. package/nitrogen/generated/ios/swift/HybridNitroMapConfigSpec.swift +57 -0
  213. package/nitrogen/generated/ios/swift/HybridNitroMapConfigSpec_cxx.swift +142 -0
  214. package/nitrogen/generated/ios/swift/HybridNitroMapSpec.swift +93 -0
  215. package/nitrogen/generated/ios/swift/HybridNitroMapSpec_cxx.swift +953 -0
  216. package/nitrogen/generated/ios/swift/ImageMarkerConfig.swift +166 -0
  217. package/nitrogen/generated/ios/swift/MapBoundaries.swift +47 -0
  218. package/nitrogen/generated/ios/swift/MapError.swift +47 -0
  219. package/nitrogen/generated/ios/swift/MapPressEvent.swift +47 -0
  220. package/nitrogen/generated/ios/swift/MapProvider.swift +44 -0
  221. package/nitrogen/generated/ios/swift/MapStyleElement.swift +108 -0
  222. package/nitrogen/generated/ios/swift/MapStyler.swift +177 -0
  223. package/nitrogen/generated/ios/swift/MapType.swift +44 -0
  224. package/nitrogen/generated/ios/swift/MarkerAnimation.swift +44 -0
  225. package/nitrogen/generated/ios/swift/MarkerColor.swift +69 -0
  226. package/nitrogen/generated/ios/swift/MarkerConfig.swift +82 -0
  227. package/nitrogen/generated/ios/swift/MarkerData.swift +195 -0
  228. package/nitrogen/generated/ios/swift/MarkerDragEvent.swift +47 -0
  229. package/nitrogen/generated/ios/swift/MarkerPressEvent.swift +47 -0
  230. package/nitrogen/generated/ios/swift/MarkerStyle.swift +44 -0
  231. package/nitrogen/generated/ios/swift/Point.swift +47 -0
  232. package/nitrogen/generated/ios/swift/PriceMarkerStyle.swift +374 -0
  233. package/nitrogen/generated/ios/swift/Region.swift +69 -0
  234. package/nitrogen/generated/ios/swift/RegionChangeEvent.swift +47 -0
  235. package/nitrogen/generated/ios/swift/Variant_String_MarkerColor.swift +18 -0
  236. package/nitrogen/generated/shared/c++/Camera.hpp +92 -0
  237. package/nitrogen/generated/shared/c++/ClusterAnimationStyle.hpp +88 -0
  238. package/nitrogen/generated/shared/c++/ClusterConfig.hpp +140 -0
  239. package/nitrogen/generated/shared/c++/ClusterPressEvent.hpp +86 -0
  240. package/nitrogen/generated/shared/c++/ClusterStrategy.hpp +76 -0
  241. package/nitrogen/generated/shared/c++/Coordinate.hpp +79 -0
  242. package/nitrogen/generated/shared/c++/EdgePadding.hpp +87 -0
  243. package/nitrogen/generated/shared/c++/HybridNitroMapConfigSpec.cpp +22 -0
  244. package/nitrogen/generated/shared/c++/HybridNitroMapConfigSpec.hpp +65 -0
  245. package/nitrogen/generated/shared/c++/HybridNitroMapSpec.cpp +82 -0
  246. package/nitrogen/generated/shared/c++/HybridNitroMapSpec.hpp +173 -0
  247. package/nitrogen/generated/shared/c++/ImageMarkerConfig.hpp +103 -0
  248. package/nitrogen/generated/shared/c++/MapBoundaries.hpp +80 -0
  249. package/nitrogen/generated/shared/c++/MapError.hpp +79 -0
  250. package/nitrogen/generated/shared/c++/MapPressEvent.hpp +83 -0
  251. package/nitrogen/generated/shared/c++/MapProvider.hpp +80 -0
  252. package/nitrogen/generated/shared/c++/MapStyleElement.hpp +87 -0
  253. package/nitrogen/generated/shared/c++/MapStyler.hpp +96 -0
  254. package/nitrogen/generated/shared/c++/MapType.hpp +80 -0
  255. package/nitrogen/generated/shared/c++/MarkerAnimation.hpp +80 -0
  256. package/nitrogen/generated/shared/c++/MarkerColor.hpp +87 -0
  257. package/nitrogen/generated/shared/c++/MarkerConfig.hpp +91 -0
  258. package/nitrogen/generated/shared/c++/MarkerData.hpp +131 -0
  259. package/nitrogen/generated/shared/c++/MarkerDragEvent.hpp +81 -0
  260. package/nitrogen/generated/shared/c++/MarkerPressEvent.hpp +81 -0
  261. package/nitrogen/generated/shared/c++/MarkerStyle.hpp +80 -0
  262. package/nitrogen/generated/shared/c++/Point.hpp +79 -0
  263. package/nitrogen/generated/shared/c++/PriceMarkerStyle.hpp +119 -0
  264. package/nitrogen/generated/shared/c++/Region.hpp +87 -0
  265. package/nitrogen/generated/shared/c++/RegionChangeEvent.hpp +80 -0
  266. package/nitrogen/generated/shared/c++/views/HybridNitroMapComponent.cpp +351 -0
  267. package/nitrogen/generated/shared/c++/views/HybridNitroMapComponent.hpp +141 -0
  268. package/nitrogen/generated/shared/json/NitroMapConfig.json +32 -0
  269. package/package.json +176 -0
  270. package/react-native.config.js +16 -0
  271. package/src/components/ImageMarker.tsx +254 -0
  272. package/src/components/NitroMap.tsx +433 -0
  273. package/src/components/PriceMarker.tsx +311 -0
  274. package/src/context/NitroMapContext.tsx +33 -0
  275. package/src/hooks/useNitroMarker.ts +198 -0
  276. package/src/index.tsx +62 -0
  277. package/src/modules/index.ts +6 -0
  278. package/src/modules/module.ts +45 -0
  279. package/src/specs/NitroMap.nitro.ts +292 -0
  280. package/src/specs/NitroMapConfig.nitro.ts +8 -0
  281. package/src/types/map.ts +166 -0
  282. package/src/types/marker.ts +267 -0
  283. package/src/utils/colors.ts +159 -0
@@ -0,0 +1,267 @@
1
+ import type { Coordinate, Point } from './map';
2
+ import type { ColorValue } from '../utils/colors';
3
+
4
+ /**
5
+ * Visual style of the marker
6
+ * - `'default'` - Standard Google Maps marker
7
+ * - `'price'` - Simple price tag
8
+ * - `'image'` - Custom image marker
9
+ * - `'priceMarker'` - Full-featured price marker with currency
10
+ * - `'reactView'` - React Native view marker (internal use by NitroCustomMarker)
11
+ *
12
+ * Note: For React Native views as markers, use the NitroCustomMarker component.
13
+ */
14
+ export type MarkerStyle = 'default' | 'image' | 'priceMarker';
15
+
16
+ /**
17
+ * Animation type for individual markers when they appear
18
+ * - `'none'` - No animation
19
+ * - `'pop'` - Pop/bounce effect
20
+ * - `'fadeIn'` - Fade in animation
21
+ */
22
+ export type MarkerAnimation = 'none' | 'pop' | 'fadeIn';
23
+
24
+ /**
25
+ * Animation style for cluster expand/collapse
26
+ * - `'default'` - Standard Google Maps Utils animation
27
+ * - `'bounce'` - Markers bounce when appearing
28
+ * - `'scale'` - Scale up from 0 to full size
29
+ * - `'fade'` - Fade in/out
30
+ * - `'spring'` - Spring effect animation
31
+ */
32
+ export type ClusterAnimationStyle =
33
+ | 'default'
34
+ | 'bounce'
35
+ | 'scale'
36
+ | 'fade'
37
+ | 'spring';
38
+
39
+ /**
40
+ * Style configuration for price markers
41
+ * Colors can be hex strings ("#FF0000", "#F00") or MarkerColor objects
42
+ */
43
+ export type PriceMarkerStyle = {
44
+ /** Price text to display (e.g., "9M", "150K") */
45
+ price: string;
46
+ /** Currency code (e.g., "UZS", "USD", "EUR") */
47
+ currency: string;
48
+ /** Whether the marker is in selected state (changes colors) */
49
+ selected: boolean;
50
+ /** Background color in normal state (hex string or MarkerColor) */
51
+ backgroundColor?: ColorValue;
52
+ /** Background color when selected (hex string or MarkerColor) */
53
+ selectedBackgroundColor?: ColorValue;
54
+ /** Text color in normal state (hex string or MarkerColor) */
55
+ textColor?: ColorValue;
56
+ /** Text color when selected (hex string or MarkerColor) */
57
+ selectedTextColor?: ColorValue;
58
+ /** Font size in pixels */
59
+ fontSize?: number;
60
+ /** Horizontal padding in pixels */
61
+ paddingHorizontal?: number;
62
+ /** Vertical padding in pixels */
63
+ paddingVertical?: number;
64
+ /** Shadow opacity (0-1) */
65
+ shadowOpacity?: number;
66
+ };
67
+
68
+ /**
69
+ * RGBA color representation
70
+ * All values range from 0-255
71
+ */
72
+ export type MarkerColor = {
73
+ /** Red component (0-255) */
74
+ r: number;
75
+ /** Green component (0-255) */
76
+ g: number;
77
+ /** Blue component (0-255) */
78
+ b: number;
79
+ /** Alpha/opacity component (0-255) */
80
+ a: number;
81
+ };
82
+
83
+ /**
84
+ * Configuration for price-style markers
85
+ */
86
+ export type PriceMarkerConfig = {
87
+ /** Price text to display */
88
+ price: string;
89
+ /** Background color */
90
+ backgroundColor: MarkerColor;
91
+ /** Text color */
92
+ textColor: MarkerColor;
93
+ /** Font size in pixels */
94
+ fontSize: number;
95
+ /** Corner radius in pixels */
96
+ cornerRadius: number;
97
+ /** Whether marker is in selected state */
98
+ selected: boolean;
99
+ };
100
+
101
+ /**
102
+ * Configuration for image-style markers
103
+ * Colors can be hex strings ("#FF0000", "#F00") or MarkerColor objects
104
+ */
105
+ export type ImageMarkerConfig = {
106
+ /** URL of the image to display */
107
+ imageUrl?: string;
108
+ /** Base64-encoded image data (alternative to URL) */
109
+ imageBase64?: string;
110
+ /** Image width in pixels */
111
+ width: number;
112
+ /** Image height in pixels */
113
+ height: number;
114
+ /** Corner radius in pixels */
115
+ cornerRadius: number;
116
+ /** Border thickness in pixels */
117
+ borderWidth: number;
118
+ /** Border color (hex string or MarkerColor) */
119
+ borderColor: ColorValue;
120
+ };
121
+
122
+ /**
123
+ * Combined marker configuration based on style type
124
+ */
125
+ export type MarkerConfig = {
126
+ /** The marker style type */
127
+ style: MarkerStyle;
128
+ /** Image marker config (when style is 'image') */
129
+ image?: ImageMarkerConfig;
130
+ /** Price marker style config (when style is 'priceMarker') */
131
+ priceMarker?: PriceMarkerStyle;
132
+ /** React view marker config (when style is 'reactView') */
133
+ };
134
+
135
+ /**
136
+ * Complete marker data structure used internally
137
+ */
138
+ export type MarkerData = {
139
+ /** Unique identifier for the marker */
140
+ id: string;
141
+ /** Geographic coordinates of the marker */
142
+ coordinate: Coordinate;
143
+ /** Title shown in info window */
144
+ title?: string;
145
+ /** Description shown in info window */
146
+ description?: string;
147
+ /** Whether the marker can be dragged */
148
+ draggable: boolean;
149
+ /** Marker opacity (0-1) */
150
+ opacity: number;
151
+ /** Rotation in degrees */
152
+ rotation: number;
153
+ /** Z-index for overlapping markers */
154
+ zIndex: number;
155
+ /** Anchor point for positioning (0-1 range) */
156
+ anchor: Point;
157
+ /** Visual configuration for the marker */
158
+ config: MarkerConfig;
159
+ /** Whether this marker should be included in clustering */
160
+ clusteringEnabled: boolean;
161
+ /** Animation when marker appears */
162
+ animation: MarkerAnimation;
163
+ };
164
+
165
+ /**
166
+ * Event data when a marker is pressed
167
+ */
168
+ export type MarkerPressEvent = {
169
+ /** ID of the pressed marker */
170
+ id: string;
171
+ /** Coordinates where marker was pressed */
172
+ coordinate: Coordinate;
173
+ };
174
+
175
+ /**
176
+ * Event data during marker drag operations
177
+ */
178
+ export type MarkerDragEvent = {
179
+ /** ID of the dragged marker */
180
+ id: string;
181
+ /** Current coordinates during drag */
182
+ coordinate: Coordinate;
183
+ };
184
+
185
+ /**
186
+ * Event data when a cluster is pressed
187
+ */
188
+ export type ClusterPressEvent = {
189
+ /** Coordinates of the cluster */
190
+ coordinate: Coordinate;
191
+ /** IDs of all markers in the cluster */
192
+ markerIds: string[];
193
+ /** Number of markers in the cluster */
194
+ count: number;
195
+ };
196
+
197
+ /**
198
+ * Clustering strategy
199
+ * - `'supercluster'` - Pure geographic clustering. Overlapping icons are tolerated.
200
+ * This is what Mapbox and most map libraries use. User zooms in to resolve overlaps.
201
+ * - `'hideOnOverlap'` - After geographic clustering, overlapping icons are hidden
202
+ * (not merged). Every visible marker sits at its real geographic position.
203
+ * This is what Zillow/Airbnb use for property maps.
204
+ */
205
+ export type ClusterStrategy = 'supercluster' | 'hideOnOverlap';
206
+
207
+ /**
208
+ * Configuration for marker clustering behavior
209
+ * Colors can be hex strings ("#FF0000", "#F00") or MarkerColor objects
210
+ */
211
+ export type ClusterConfig = {
212
+ /** Enable or disable clustering */
213
+ enabled: boolean;
214
+ /**
215
+ * Clustering strategy
216
+ * - `'supercluster'` — overlaps tolerated, user zooms to resolve
217
+ * - `'hideOnOverlap'` — lower-priority overlapping icons hidden
218
+ * @default 'supercluster'
219
+ */
220
+ strategy: ClusterStrategy;
221
+ /**
222
+ * Clustering radius in pixels.
223
+ * Controls how aggressively markers group together.
224
+ * Higher = fewer, larger clusters. Lower = more, smaller clusters.
225
+ * @default 80
226
+ */
227
+ radius: number;
228
+ /** Minimum number of markers to form a cluster */
229
+ minimumClusterSize: number;
230
+ /** Maximum zoom level at which clustering occurs */
231
+ maxZoom: number;
232
+ /** Background color of cluster circles (hex string or MarkerColor) */
233
+ backgroundColor: ColorValue;
234
+ /** Text color for cluster count numbers (hex string or MarkerColor) */
235
+ textColor: ColorValue;
236
+ /** Border thickness in pixels */
237
+ borderWidth: number;
238
+ /** Border color of cluster circles (hex string or MarkerColor) */
239
+ borderColor: ColorValue;
240
+ /** Enable cluster animations */
241
+ animatesClusters: boolean;
242
+ /** Animation duration in seconds (e.g., 0.3) */
243
+ animationDuration: number;
244
+ /** Animation style for cluster expand/collapse */
245
+ animationStyle: ClusterAnimationStyle;
246
+ /**
247
+ * When true, clusters update live during pan/zoom gestures (throttled).
248
+ * When false, clusters only update after the gesture ends (debounced).
249
+ * Live mode provides smoother UX but uses more CPU.
250
+ * @default false
251
+ */
252
+ realtimeClustering: boolean;
253
+ /**
254
+ * Extra buffer around the visible viewport for pre-computing clusters.
255
+ * Expressed as a fraction of the viewport size (0 = no buffer, 0.5 = 50% extra on each side).
256
+ * Prevents markers from "popping in" at edges during pan.
257
+ * @default 0
258
+ */
259
+ renderBuffer: number;
260
+ /**
261
+ * Throttle interval in milliseconds for live clustering during gestures.
262
+ * Only used when `realtimeClustering` is true.
263
+ * Higher = better performance, lower = smoother updates.
264
+ * @default 150
265
+ */
266
+ throttleInterval: number;
267
+ };
@@ -0,0 +1,159 @@
1
+ // ============ Color Helpers ============
2
+
3
+ import type { MarkerColor } from '../types/marker';
4
+
5
+ /**
6
+ * Color value that can be either a MarkerColor object or a hex string
7
+ * Hex strings can be in formats: "#RRGGBB", "RRGGBB", "#RGB", or "RGB"
8
+ * @example
9
+ * ```ts
10
+ * const color1: ColorValue = "#FF0000"; // Hex string
11
+ * const color2: ColorValue = "#F00"; // Short hex
12
+ * const color3: ColorValue = { r: 255, g: 0, b: 0, a: 255 }; // MarkerColor
13
+ * ```
14
+ */
15
+ export type ColorValue = MarkerColor | string;
16
+
17
+ /**
18
+ * Parse a ColorValue into a MarkerColor object
19
+ * Handles both hex strings and MarkerColor objects
20
+ * @param color - Color value (hex string or MarkerColor)
21
+ * @param defaultAlpha - Default alpha value (0-255) for hex strings
22
+ * @returns MarkerColor object
23
+ * @internal
24
+ */
25
+ export const parseColor = (
26
+ color: ColorValue | undefined,
27
+ defaultAlpha: number = 255
28
+ ): MarkerColor | undefined => {
29
+ if (color === undefined) {
30
+ return undefined;
31
+ }
32
+
33
+ // If it's already a MarkerColor object, return as-is
34
+ if (
35
+ typeof color === 'object' &&
36
+ 'r' in color &&
37
+ 'g' in color &&
38
+ 'b' in color
39
+ ) {
40
+ return {
41
+ r: color.r,
42
+ g: color.g,
43
+ b: color.b,
44
+ a: color.a ?? defaultAlpha,
45
+ };
46
+ }
47
+
48
+ // It's a string - parse as hex
49
+ if (typeof color === 'string') {
50
+ return hex(color, defaultAlpha);
51
+ }
52
+
53
+ return undefined;
54
+ };
55
+
56
+ /**
57
+ * Parse a ColorValue with a fallback default color
58
+ * @param color - Color value (hex string or MarkerColor)
59
+ * @param fallback - Fallback MarkerColor if parsing fails
60
+ * @returns MarkerColor object
61
+ * @internal
62
+ */
63
+ export const parseColorWithFallback = (
64
+ color: ColorValue | undefined,
65
+ fallback: MarkerColor
66
+ ): MarkerColor => {
67
+ const parsed = parseColor(color);
68
+ return parsed ?? fallback;
69
+ };
70
+
71
+ /**
72
+ * Create a MarkerColor from RGB values
73
+ * @param r - Red component (0-255)
74
+ * @param g - Green component (0-255)
75
+ * @param b - Blue component (0-255)
76
+ * @param a - Alpha/opacity (0-255, default: 255)
77
+ * @returns MarkerColor object
78
+ * @example
79
+ * ```ts
80
+ * const customRed = rgb(255, 0, 0);
81
+ * const semiTransparent = rgb(0, 0, 255, 128);
82
+ * ```
83
+ */
84
+ export const rgb = (
85
+ r: number,
86
+ g: number,
87
+ b: number,
88
+ a: number = 255
89
+ ): MarkerColor => ({
90
+ r,
91
+ g,
92
+ b,
93
+ a,
94
+ });
95
+
96
+ /**
97
+ * Create a MarkerColor from a hex string
98
+ * @param hexStr - Hex color string (e.g., "#FF0000", "FF0000", "#F00", or "F00")
99
+ * @param alpha - Alpha/opacity (0-255, default: 255)
100
+ * @returns MarkerColor object
101
+ * @example
102
+ * ```ts
103
+ * const red = hex("#FF0000");
104
+ * const shortRed = hex("#F00");
105
+ * const semiTransparentBlue = hex("#0000FF", 128);
106
+ * ```
107
+ */
108
+ export const hex = (hexStr: string, alpha: number = 255): MarkerColor => {
109
+ // Try 6-char hex first (#RRGGBB or RRGGBB)
110
+ const result6 = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexStr);
111
+ if (result6) {
112
+ return {
113
+ r: parseInt(result6[1]!, 16),
114
+ g: parseInt(result6[2]!, 16),
115
+ b: parseInt(result6[3]!, 16),
116
+ a: alpha,
117
+ };
118
+ }
119
+
120
+ // Try 3-char hex (#RGB or RGB)
121
+ const result3 = /^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(hexStr);
122
+ if (result3) {
123
+ return {
124
+ r: parseInt(result3[1]! + result3[1]!, 16),
125
+ g: parseInt(result3[2]! + result3[2]!, 16),
126
+ b: parseInt(result3[3]! + result3[3]!, 16),
127
+ a: alpha,
128
+ };
129
+ }
130
+
131
+ // Fallback to black
132
+ return { r: 0, g: 0, b: 0, a: alpha };
133
+ };
134
+
135
+ /**
136
+ * Preset colors for convenience
137
+ * @example
138
+ * ```ts
139
+ * <NitroMarker backgroundColor={Colors.red} />
140
+ * ```
141
+ */
142
+ export const Colors = {
143
+ /** White (255, 255, 255) */
144
+ white: rgb(255, 255, 255),
145
+ /** Black (0, 0, 0) */
146
+ black: rgb(0, 0, 0),
147
+ /** iOS system red (255, 59, 48) */
148
+ red: rgb(255, 59, 48),
149
+ /** iOS system blue (0, 122, 255) */
150
+ blue: rgb(0, 122, 255),
151
+ /** Material green (76, 175, 80) */
152
+ green: rgb(76, 175, 80),
153
+ /** iOS system orange (255, 149, 0) */
154
+ orange: rgb(255, 149, 0),
155
+ /** Dark gray (51, 51, 51) */
156
+ gray: rgb(51, 51, 51),
157
+ /** Light gray (240, 240, 240) */
158
+ lightGray: rgb(240, 240, 240),
159
+ };