react-native-ensys-camera-x 1.0.7

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 (506) hide show
  1. package/CustomCamera.podspec +20 -0
  2. package/LICENSE +20 -0
  3. package/README.md +833 -0
  4. package/android/build.gradle +135 -0
  5. package/android/consumer-rules.pro +47 -0
  6. package/android/src/main/AndroidManifest.xml +72 -0
  7. package/android/src/main/java/android/print/PdfPrint.java +51 -0
  8. package/android/src/main/java/com/customcamera/AnimatedImageViewManager.kt +199 -0
  9. package/android/src/main/java/com/customcamera/AudioPlayerView.kt +322 -0
  10. package/android/src/main/java/com/customcamera/AudioRecorder.kt +506 -0
  11. package/android/src/main/java/com/customcamera/BarcodeScannerActivity.kt +361 -0
  12. package/android/src/main/java/com/customcamera/BlurBackgroundView.kt +199 -0
  13. package/android/src/main/java/com/customcamera/CacheCleanupManager.kt +386 -0
  14. package/android/src/main/java/com/customcamera/CameraAspectRatioMode.kt +77 -0
  15. package/android/src/main/java/com/customcamera/CameraAsset.kt +211 -0
  16. package/android/src/main/java/com/customcamera/CameraTheme.kt +479 -0
  17. package/android/src/main/java/com/customcamera/CompressionCacheStore.kt +504 -0
  18. package/android/src/main/java/com/customcamera/CompressionFileNameUtils.kt +7 -0
  19. package/android/src/main/java/com/customcamera/CompressionProfile.kt +195 -0
  20. package/android/src/main/java/com/customcamera/CustomCameraActivity.kt +7291 -0
  21. package/android/src/main/java/com/customcamera/CustomCameraFileProvider.kt +9 -0
  22. package/android/src/main/java/com/customcamera/CustomCameraModule.kt +2479 -0
  23. package/android/src/main/java/com/customcamera/CustomCameraPackage.kt +53 -0
  24. package/android/src/main/java/com/customcamera/DisplayUtils.kt +9 -0
  25. package/android/src/main/java/com/customcamera/DocumentPreviewView.kt +846 -0
  26. package/android/src/main/java/com/customcamera/DrawingView.kt +214 -0
  27. package/android/src/main/java/com/customcamera/EmojiPickerData.kt +228 -0
  28. package/android/src/main/java/com/customcamera/FilterStripAdapter.kt +158 -0
  29. package/android/src/main/java/com/customcamera/GifSupport.kt +215 -0
  30. package/android/src/main/java/com/customcamera/GlobalAudioPlayer.kt +320 -0
  31. package/android/src/main/java/com/customcamera/ImageExporter.kt +1394 -0
  32. package/android/src/main/java/com/customcamera/ImageFormatSupport.kt +163 -0
  33. package/android/src/main/java/com/customcamera/Localization.kt +206 -0
  34. package/android/src/main/java/com/customcamera/MediaAdapters.kt +758 -0
  35. package/android/src/main/java/com/customcamera/MediaCacheManager.kt +782 -0
  36. package/android/src/main/java/com/customcamera/MediaExportFormats.kt +201 -0
  37. package/android/src/main/java/com/customcamera/MediaFileIo.kt +310 -0
  38. package/android/src/main/java/com/customcamera/MediaMetadataStore.kt +494 -0
  39. package/android/src/main/java/com/customcamera/MediaPreviewEditor.kt +14865 -0
  40. package/android/src/main/java/com/customcamera/MediaPublisher.kt +423 -0
  41. package/android/src/main/java/com/customcamera/MediaStorageWorkflow.kt +722 -0
  42. package/android/src/main/java/com/customcamera/MediaStoreRepository.kt +378 -0
  43. package/android/src/main/java/com/customcamera/MediaThumbnailView.kt +286 -0
  44. package/android/src/main/java/com/customcamera/MediaUtils.kt +37 -0
  45. package/android/src/main/java/com/customcamera/NativeVideoViewManager.kt +845 -0
  46. package/android/src/main/java/com/customcamera/OfficeDocumentConverter.kt +2791 -0
  47. package/android/src/main/java/com/customcamera/PendingCaptureCrops.kt +88 -0
  48. package/android/src/main/java/com/customcamera/PowerPointPreview.kt +4077 -0
  49. package/android/src/main/java/com/customcamera/RecentPickerStore.kt +74 -0
  50. package/android/src/main/java/com/customcamera/SecureFileEraser.kt +411 -0
  51. package/android/src/main/java/com/customcamera/SecureKeyModule.kt +88 -0
  52. package/android/src/main/java/com/customcamera/SecureMediaDeleter.kt +493 -0
  53. package/android/src/main/java/com/customcamera/StickerPickerData.kt +107 -0
  54. package/android/src/main/java/com/customcamera/SvgDrawable.kt +175 -0
  55. package/android/src/main/java/com/customcamera/SvgIconViewManager.kt +77 -0
  56. package/android/src/main/java/com/customcamera/TextEntryController.kt +553 -0
  57. package/android/src/main/java/com/customcamera/ThumbnailLoader.kt +455 -0
  58. package/android/src/main/java/com/customcamera/UploadService.kt +909 -0
  59. package/android/src/main/java/com/customcamera/VideoEditUtils.kt +210 -0
  60. package/android/src/main/java/com/customcamera/VideoRotationTranscoder.kt +1992 -0
  61. package/android/src/main/java/com/customcamera/gif/AnimatedGifEncoder.kt +473 -0
  62. package/android/src/main/java/com/customcamera/gif/GifDecoder.kt +690 -0
  63. package/android/src/main/java/com/customcamera/gif/GifFramesDrawable.kt +160 -0
  64. package/android/src/main/java/com/customcamera/gif/GifHttp.kt +112 -0
  65. package/android/src/main/java/com/customcamera/gif/GifImageLoader.kt +186 -0
  66. package/android/src/main/java/com/customcamera/gif/GifModels.kt +74 -0
  67. package/android/src/main/java/com/customcamera/gif/GifProvider.kt +49 -0
  68. package/android/src/main/java/com/customcamera/gif/GifProviders.kt +27 -0
  69. package/android/src/main/java/com/customcamera/gif/GifRepository.kt +124 -0
  70. package/android/src/main/java/com/customcamera/gif/GifSafety.kt +33 -0
  71. package/android/src/main/java/com/customcamera/gif/GiphyGifProvider.kt +146 -0
  72. package/android/src/main/java/com/customcamera/gif/LZWEncoder.kt +258 -0
  73. package/android/src/main/java/com/customcamera/gif/NeuQuant.kt +435 -0
  74. package/android/src/main/java/com/customcamera/gif/TenorGifProvider.kt +147 -0
  75. package/android/src/main/res/drawable/bg_brush_selected.xml +5 -0
  76. package/android/src/main/res/drawable/bg_color_swatch.xml +5 -0
  77. package/android/src/main/res/drawable/bg_editor_toolbar.xml +6 -0
  78. package/android/src/main/res/drawable/bg_icon_circle.xml +5 -0
  79. package/android/src/main/res/drawable/bg_icon_circle_light.xml +5 -0
  80. package/android/src/main/res/drawable/bg_mode_tab_active.xml +6 -0
  81. package/android/src/main/res/drawable/bg_pill.xml +6 -0
  82. package/android/src/main/res/drawable/bg_recording_dot.xml +6 -0
  83. package/android/src/main/res/drawable/bg_selection_badge.xml +8 -0
  84. package/android/src/main/res/drawable/bg_send_button.xml +5 -0
  85. package/android/src/main/res/drawable/bg_shutter_inner.xml +5 -0
  86. package/android/src/main/res/drawable/bg_shutter_recording.xml +6 -0
  87. package/android/src/main/res/drawable/bg_shutter_ring.xml +8 -0
  88. package/android/src/main/res/drawable/bg_shutter_video_idle.xml +5 -0
  89. package/android/src/main/res/drawable/bg_thumbnail.xml +9 -0
  90. package/android/src/main/res/drawable/ic_aspect_ratio.xml +17 -0
  91. package/android/src/main/res/drawable/ic_audio.xml +10 -0
  92. package/android/src/main/res/drawable/ic_back.xml +10 -0
  93. package/android/src/main/res/drawable/ic_brush_medium.xml +12 -0
  94. package/android/src/main/res/drawable/ic_brush_thick.xml +12 -0
  95. package/android/src/main/res/drawable/ic_brush_thin.xml +12 -0
  96. package/android/src/main/res/drawable/ic_check.xml +17 -0
  97. package/android/src/main/res/drawable/ic_chevron_down.xml +10 -0
  98. package/android/src/main/res/drawable/ic_chevron_up.xml +13 -0
  99. package/android/src/main/res/drawable/ic_clear_drawing.xml +10 -0
  100. package/android/src/main/res/drawable/ic_close.xml +10 -0
  101. package/android/src/main/res/drawable/ic_cover.xml +9 -0
  102. package/android/src/main/res/drawable/ic_crop.xml +10 -0
  103. package/android/src/main/res/drawable/ic_delete.xml +9 -0
  104. package/android/src/main/res/drawable/ic_document.xml +10 -0
  105. package/android/src/main/res/drawable/ic_done.xml +10 -0
  106. package/android/src/main/res/drawable/ic_download.xml +10 -0
  107. package/android/src/main/res/drawable/ic_emoji.xml +10 -0
  108. package/android/src/main/res/drawable/ic_filter.xml +10 -0
  109. package/android/src/main/res/drawable/ic_flash_auto.xml +7 -0
  110. package/android/src/main/res/drawable/ic_flash_off.xml +23 -0
  111. package/android/src/main/res/drawable/ic_flash_on.xml +16 -0
  112. package/android/src/main/res/drawable/ic_flip.xml +15 -0
  113. package/android/src/main/res/drawable/ic_gallery.xml +10 -0
  114. package/android/src/main/res/drawable/ic_gif.xml +24 -0
  115. package/android/src/main/res/drawable/ic_lock.xml +19 -0
  116. package/android/src/main/res/drawable/ic_lock_open.xml +22 -0
  117. package/android/src/main/res/drawable/ic_marker.xml +10 -0
  118. package/android/src/main/res/drawable/ic_more_vert.xml +18 -0
  119. package/android/src/main/res/drawable/ic_overlay_close.xml +19 -0
  120. package/android/src/main/res/drawable/ic_overlay_resize.xml +18 -0
  121. package/android/src/main/res/drawable/ic_pause.xml +10 -0
  122. package/android/src/main/res/drawable/ic_photo_mode.xml +10 -0
  123. package/android/src/main/res/drawable/ic_play.xml +10 -0
  124. package/android/src/main/res/drawable/ic_redo.xml +10 -0
  125. package/android/src/main/res/drawable/ic_rotate.xml +9 -0
  126. package/android/src/main/res/drawable/ic_send.xml +10 -0
  127. package/android/src/main/res/drawable/ic_share.xml +10 -0
  128. package/android/src/main/res/drawable/ic_stat_upload.xml +10 -0
  129. package/android/src/main/res/drawable/ic_sticker.xml +24 -0
  130. package/android/src/main/res/drawable/ic_text.xml +10 -0
  131. package/android/src/main/res/drawable/ic_text_align_center.xml +11 -0
  132. package/android/src/main/res/drawable/ic_text_align_left.xml +11 -0
  133. package/android/src/main/res/drawable/ic_text_align_right.xml +11 -0
  134. package/android/src/main/res/drawable/ic_text_bg.xml +11 -0
  135. package/android/src/main/res/drawable/ic_trim.xml +23 -0
  136. package/android/src/main/res/drawable/ic_undo.xml +10 -0
  137. package/android/src/main/res/drawable/ic_video_mode.xml +10 -0
  138. package/android/src/main/res/drawable/ic_video_note.xml +13 -0
  139. package/android/src/main/res/drawable/ic_volume_off.xml +9 -0
  140. package/android/src/main/res/drawable/ic_volume_on.xml +9 -0
  141. package/android/src/main/res/drawable/sticker_heart.xml +9 -0
  142. package/android/src/main/res/drawable/sticker_smile.xml +9 -0
  143. package/android/src/main/res/drawable/sticker_star.xml +9 -0
  144. package/android/src/main/res/drawable/sticker_thumbsup.xml +9 -0
  145. package/android/src/main/res/values/colors.xml +34 -0
  146. package/android/src/main/res/values/ids.xml +15 -0
  147. package/android/src/main/res/values/strings.xml +15 -0
  148. package/android/src/main/res/values/styles.xml +20 -0
  149. package/android/src/main/res/xml/file_paths.xml +34 -0
  150. package/ios/CustomCamera.h +5 -0
  151. package/ios/CustomCamera.mm +214 -0
  152. package/lib/module/AudioPlayerContext.js +233 -0
  153. package/lib/module/AudioPlayerContext.js.map +1 -0
  154. package/lib/module/CameraPreview.js +304 -0
  155. package/lib/module/CameraPreview.js.map +1 -0
  156. package/lib/module/NativeAnimatedImageView.js +41 -0
  157. package/lib/module/NativeAnimatedImageView.js.map +1 -0
  158. package/lib/module/NativeAudioPlayerView.js +33 -0
  159. package/lib/module/NativeAudioPlayerView.js.map +1 -0
  160. package/lib/module/NativeBlurView.js +35 -0
  161. package/lib/module/NativeBlurView.js.map +1 -0
  162. package/lib/module/NativeCustomCamera.js +128 -0
  163. package/lib/module/NativeCustomCamera.js.map +1 -0
  164. package/lib/module/NativeCustomCamera.web.js +143 -0
  165. package/lib/module/NativeCustomCamera.web.js.map +1 -0
  166. package/lib/module/NativeCustomVideoView.js +5 -0
  167. package/lib/module/NativeCustomVideoView.js.map +1 -0
  168. package/lib/module/NativeDocumentPreviewView.js +156 -0
  169. package/lib/module/NativeDocumentPreviewView.js.map +1 -0
  170. package/lib/module/NativeMediaThumbnailView.js +110 -0
  171. package/lib/module/NativeMediaThumbnailView.js.map +1 -0
  172. package/lib/module/NativeSvgIcon.js +32 -0
  173. package/lib/module/NativeSvgIcon.js.map +1 -0
  174. package/lib/module/ResponsivePreviewContainer.js +171 -0
  175. package/lib/module/ResponsivePreviewContainer.js.map +1 -0
  176. package/lib/module/accessibility.js +61 -0
  177. package/lib/module/accessibility.js.map +1 -0
  178. package/lib/module/config.js +352 -0
  179. package/lib/module/config.js.map +1 -0
  180. package/lib/module/cpuOptimization.js +296 -0
  181. package/lib/module/cpuOptimization.js.map +1 -0
  182. package/lib/module/db/DatabaseManager.js +191 -0
  183. package/lib/module/db/DatabaseManager.js.map +1 -0
  184. package/lib/module/db/MediaMapper.js +284 -0
  185. package/lib/module/db/MediaMapper.js.map +1 -0
  186. package/lib/module/db/MediaRepository.js +242 -0
  187. package/lib/module/db/MediaRepository.js.map +1 -0
  188. package/lib/module/db/index.js +41 -0
  189. package/lib/module/db/index.js.map +1 -0
  190. package/lib/module/db/migrations.js +180 -0
  191. package/lib/module/db/migrations.js.map +1 -0
  192. package/lib/module/db/react-native-sqlcipher.d.js +2 -0
  193. package/lib/module/db/react-native-sqlcipher.d.js.map +1 -0
  194. package/lib/module/db/secureKey.js +87 -0
  195. package/lib/module/db/secureKey.js.map +1 -0
  196. package/lib/module/db/types.js +57 -0
  197. package/lib/module/db/types.js.map +1 -0
  198. package/lib/module/db/useMediaDatabase.js +123 -0
  199. package/lib/module/db/useMediaDatabase.js.map +1 -0
  200. package/lib/module/defaultIcons.js +2259 -0
  201. package/lib/module/defaultIcons.js.map +1 -0
  202. package/lib/module/deviceCapabilities.js +408 -0
  203. package/lib/module/deviceCapabilities.js.map +1 -0
  204. package/lib/module/errors.js +267 -0
  205. package/lib/module/errors.js.map +1 -0
  206. package/lib/module/iconConfig.js +796 -0
  207. package/lib/module/iconConfig.js.map +1 -0
  208. package/lib/module/icons.js +514 -0
  209. package/lib/module/icons.js.map +1 -0
  210. package/lib/module/index.js +251 -0
  211. package/lib/module/index.js.map +1 -0
  212. package/lib/module/jest-globals.d.js +2 -0
  213. package/lib/module/jest-globals.d.js.map +1 -0
  214. package/lib/module/library/MediaLibrary.js +107 -0
  215. package/lib/module/library/MediaLibrary.js.map +1 -0
  216. package/lib/module/library/MediaLibraryScreen.js +2597 -0
  217. package/lib/module/library/MediaLibraryScreen.js.map +1 -0
  218. package/lib/module/library/components/AudioPreview.js +74 -0
  219. package/lib/module/library/components/AudioPreview.js.map +1 -0
  220. package/lib/module/library/components/DocumentPreview.js +331 -0
  221. package/lib/module/library/components/DocumentPreview.js.map +1 -0
  222. package/lib/module/library/components/ExpandableFab.js +343 -0
  223. package/lib/module/library/components/ExpandableFab.js.map +1 -0
  224. package/lib/module/library/components/FileTiles.js +251 -0
  225. package/lib/module/library/components/FileTiles.js.map +1 -0
  226. package/lib/module/library/components/ImagePreview.js +70 -0
  227. package/lib/module/library/components/ImagePreview.js.map +1 -0
  228. package/lib/module/library/components/MediaMetadataHeader.js +175 -0
  229. package/lib/module/library/components/MediaMetadataHeader.js.map +1 -0
  230. package/lib/module/library/components/RecordAudioScreen.js +816 -0
  231. package/lib/module/library/components/RecordAudioScreen.js.map +1 -0
  232. package/lib/module/library/components/VideoPreview.js +453 -0
  233. package/lib/module/library/components/VideoPreview.js.map +1 -0
  234. package/lib/module/library/components/ViewerCounter.js +55 -0
  235. package/lib/module/library/components/ViewerCounter.js.map +1 -0
  236. package/lib/module/library/compressionEstimate.js +507 -0
  237. package/lib/module/library/compressionEstimate.js.map +1 -0
  238. package/lib/module/library/fileMetadata.js +196 -0
  239. package/lib/module/library/fileMetadata.js.map +1 -0
  240. package/lib/module/library/index.js +42 -0
  241. package/lib/module/library/index.js.map +1 -0
  242. package/lib/module/library/libraryIconRegistry.js +69 -0
  243. package/lib/module/library/libraryIconRegistry.js.map +1 -0
  244. package/lib/module/library/libraryIcons.js +858 -0
  245. package/lib/module/library/libraryIcons.js.map +1 -0
  246. package/lib/module/library/localizedFormat.js +181 -0
  247. package/lib/module/library/localizedFormat.js.map +1 -0
  248. package/lib/module/library/palette.js +225 -0
  249. package/lib/module/library/palette.js.map +1 -0
  250. package/lib/module/library/responsive.js +53 -0
  251. package/lib/module/library/responsive.js.map +1 -0
  252. package/lib/module/locales.js +416 -0
  253. package/lib/module/locales.js.map +1 -0
  254. package/lib/module/localization.js +1064 -0
  255. package/lib/module/localization.js.map +1 -0
  256. package/lib/module/logger.js +20 -0
  257. package/lib/module/logger.js.map +1 -0
  258. package/lib/module/lowMemoryCache.js +206 -0
  259. package/lib/module/lowMemoryCache.js.map +1 -0
  260. package/lib/module/mediaHistory.js +33 -0
  261. package/lib/module/mediaHistory.js.map +1 -0
  262. package/lib/module/mediaStorageService.js +402 -0
  263. package/lib/module/mediaStorageService.js.map +1 -0
  264. package/lib/module/memory.js +79 -0
  265. package/lib/module/memory.js.map +1 -0
  266. package/lib/module/nativeActions.js +307 -0
  267. package/lib/module/nativeActions.js.map +1 -0
  268. package/lib/module/nativeComponentSupport.js +61 -0
  269. package/lib/module/nativeComponentSupport.js.map +1 -0
  270. package/lib/module/networkPerformance.js +24 -0
  271. package/lib/module/networkPerformance.js.map +1 -0
  272. package/lib/module/package.json +1 -0
  273. package/lib/module/performance.js +104 -0
  274. package/lib/module/performance.js.map +1 -0
  275. package/lib/module/performanceMonitor.js +155 -0
  276. package/lib/module/performanceMonitor.js.map +1 -0
  277. package/lib/module/permissions.js +370 -0
  278. package/lib/module/permissions.js.map +1 -0
  279. package/lib/module/rendering.js +40 -0
  280. package/lib/module/rendering.js.map +1 -0
  281. package/lib/module/security.js +18 -0
  282. package/lib/module/security.js.map +1 -0
  283. package/lib/module/state.js +266 -0
  284. package/lib/module/state.js.map +1 -0
  285. package/lib/module/storage.js +400 -0
  286. package/lib/module/storage.js.map +1 -0
  287. package/lib/module/theme.js +390 -0
  288. package/lib/module/theme.js.map +1 -0
  289. package/lib/module/types.js +4 -0
  290. package/lib/module/types.js.map +1 -0
  291. package/lib/module/utils.js +115 -0
  292. package/lib/module/utils.js.map +1 -0
  293. package/lib/module/validation.js +288 -0
  294. package/lib/module/validation.js.map +1 -0
  295. package/lib/typescript/package.json +1 -0
  296. package/lib/typescript/src/AudioPlayerContext.d.ts +27 -0
  297. package/lib/typescript/src/AudioPlayerContext.d.ts.map +1 -0
  298. package/lib/typescript/src/CameraPreview.d.ts +13 -0
  299. package/lib/typescript/src/CameraPreview.d.ts.map +1 -0
  300. package/lib/typescript/src/NativeAnimatedImageView.d.ts +33 -0
  301. package/lib/typescript/src/NativeAnimatedImageView.d.ts.map +1 -0
  302. package/lib/typescript/src/NativeAudioPlayerView.d.ts +12 -0
  303. package/lib/typescript/src/NativeAudioPlayerView.d.ts.map +1 -0
  304. package/lib/typescript/src/NativeBlurView.d.ts +12 -0
  305. package/lib/typescript/src/NativeBlurView.d.ts.map +1 -0
  306. package/lib/typescript/src/NativeCustomCamera.d.ts +167 -0
  307. package/lib/typescript/src/NativeCustomCamera.d.ts.map +1 -0
  308. package/lib/typescript/src/NativeCustomCamera.web.d.ts +47 -0
  309. package/lib/typescript/src/NativeCustomCamera.web.d.ts.map +1 -0
  310. package/lib/typescript/src/NativeCustomVideoView.d.ts +30 -0
  311. package/lib/typescript/src/NativeCustomVideoView.d.ts.map +1 -0
  312. package/lib/typescript/src/NativeDocumentPreviewView.d.ts +48 -0
  313. package/lib/typescript/src/NativeDocumentPreviewView.d.ts.map +1 -0
  314. package/lib/typescript/src/NativeMediaThumbnailView.d.ts +54 -0
  315. package/lib/typescript/src/NativeMediaThumbnailView.d.ts.map +1 -0
  316. package/lib/typescript/src/NativeSvgIcon.d.ts +25 -0
  317. package/lib/typescript/src/NativeSvgIcon.d.ts.map +1 -0
  318. package/lib/typescript/src/ResponsivePreviewContainer.d.ts +92 -0
  319. package/lib/typescript/src/ResponsivePreviewContainer.d.ts.map +1 -0
  320. package/lib/typescript/src/accessibility.d.ts +20 -0
  321. package/lib/typescript/src/accessibility.d.ts.map +1 -0
  322. package/lib/typescript/src/config.d.ts +145 -0
  323. package/lib/typescript/src/config.d.ts.map +1 -0
  324. package/lib/typescript/src/cpuOptimization.d.ts +63 -0
  325. package/lib/typescript/src/cpuOptimization.d.ts.map +1 -0
  326. package/lib/typescript/src/db/DatabaseManager.d.ts +48 -0
  327. package/lib/typescript/src/db/DatabaseManager.d.ts.map +1 -0
  328. package/lib/typescript/src/db/MediaMapper.d.ts +77 -0
  329. package/lib/typescript/src/db/MediaMapper.d.ts.map +1 -0
  330. package/lib/typescript/src/db/MediaRepository.d.ts +66 -0
  331. package/lib/typescript/src/db/MediaRepository.d.ts.map +1 -0
  332. package/lib/typescript/src/db/index.d.ts +23 -0
  333. package/lib/typescript/src/db/index.d.ts.map +1 -0
  334. package/lib/typescript/src/db/migrations.d.ts +31 -0
  335. package/lib/typescript/src/db/migrations.d.ts.map +1 -0
  336. package/lib/typescript/src/db/secureKey.d.ts +10 -0
  337. package/lib/typescript/src/db/secureKey.d.ts.map +1 -0
  338. package/lib/typescript/src/db/types.d.ts +115 -0
  339. package/lib/typescript/src/db/types.d.ts.map +1 -0
  340. package/lib/typescript/src/db/useMediaDatabase.d.ts +41 -0
  341. package/lib/typescript/src/db/useMediaDatabase.d.ts.map +1 -0
  342. package/lib/typescript/src/defaultIcons.d.ts +139 -0
  343. package/lib/typescript/src/defaultIcons.d.ts.map +1 -0
  344. package/lib/typescript/src/deviceCapabilities.d.ts +92 -0
  345. package/lib/typescript/src/deviceCapabilities.d.ts.map +1 -0
  346. package/lib/typescript/src/errors.d.ts +95 -0
  347. package/lib/typescript/src/errors.d.ts.map +1 -0
  348. package/lib/typescript/src/iconConfig.d.ts +176 -0
  349. package/lib/typescript/src/iconConfig.d.ts.map +1 -0
  350. package/lib/typescript/src/icons.d.ts +217 -0
  351. package/lib/typescript/src/icons.d.ts.map +1 -0
  352. package/lib/typescript/src/index.d.ts +104 -0
  353. package/lib/typescript/src/index.d.ts.map +1 -0
  354. package/lib/typescript/src/library/MediaLibrary.d.ts +57 -0
  355. package/lib/typescript/src/library/MediaLibrary.d.ts.map +1 -0
  356. package/lib/typescript/src/library/MediaLibraryScreen.d.ts +51 -0
  357. package/lib/typescript/src/library/MediaLibraryScreen.d.ts.map +1 -0
  358. package/lib/typescript/src/library/components/AudioPreview.d.ts +6 -0
  359. package/lib/typescript/src/library/components/AudioPreview.d.ts.map +1 -0
  360. package/lib/typescript/src/library/components/DocumentPreview.d.ts +10 -0
  361. package/lib/typescript/src/library/components/DocumentPreview.d.ts.map +1 -0
  362. package/lib/typescript/src/library/components/ExpandableFab.d.ts +39 -0
  363. package/lib/typescript/src/library/components/ExpandableFab.d.ts.map +1 -0
  364. package/lib/typescript/src/library/components/FileTiles.d.ts +8 -0
  365. package/lib/typescript/src/library/components/FileTiles.d.ts.map +1 -0
  366. package/lib/typescript/src/library/components/ImagePreview.d.ts +5 -0
  367. package/lib/typescript/src/library/components/ImagePreview.d.ts.map +1 -0
  368. package/lib/typescript/src/library/components/MediaMetadataHeader.d.ts +16 -0
  369. package/lib/typescript/src/library/components/MediaMetadataHeader.d.ts.map +1 -0
  370. package/lib/typescript/src/library/components/RecordAudioScreen.d.ts +8 -0
  371. package/lib/typescript/src/library/components/RecordAudioScreen.d.ts.map +1 -0
  372. package/lib/typescript/src/library/components/VideoPreview.d.ts +20 -0
  373. package/lib/typescript/src/library/components/VideoPreview.d.ts.map +1 -0
  374. package/lib/typescript/src/library/components/ViewerCounter.d.ts +13 -0
  375. package/lib/typescript/src/library/components/ViewerCounter.d.ts.map +1 -0
  376. package/lib/typescript/src/library/compressionEstimate.d.ts +313 -0
  377. package/lib/typescript/src/library/compressionEstimate.d.ts.map +1 -0
  378. package/lib/typescript/src/library/fileMetadata.d.ts +33 -0
  379. package/lib/typescript/src/library/fileMetadata.d.ts.map +1 -0
  380. package/lib/typescript/src/library/index.d.ts +40 -0
  381. package/lib/typescript/src/library/index.d.ts.map +1 -0
  382. package/lib/typescript/src/library/libraryIconRegistry.d.ts +35 -0
  383. package/lib/typescript/src/library/libraryIconRegistry.d.ts.map +1 -0
  384. package/lib/typescript/src/library/libraryIcons.d.ts +85 -0
  385. package/lib/typescript/src/library/libraryIcons.d.ts.map +1 -0
  386. package/lib/typescript/src/library/localizedFormat.d.ts +49 -0
  387. package/lib/typescript/src/library/localizedFormat.d.ts.map +1 -0
  388. package/lib/typescript/src/library/palette.d.ts +104 -0
  389. package/lib/typescript/src/library/palette.d.ts.map +1 -0
  390. package/lib/typescript/src/library/responsive.d.ts +15 -0
  391. package/lib/typescript/src/library/responsive.d.ts.map +1 -0
  392. package/lib/typescript/src/locales.d.ts +103 -0
  393. package/lib/typescript/src/locales.d.ts.map +1 -0
  394. package/lib/typescript/src/localization.d.ts +1051 -0
  395. package/lib/typescript/src/localization.d.ts.map +1 -0
  396. package/lib/typescript/src/logger.d.ts +4 -0
  397. package/lib/typescript/src/logger.d.ts.map +1 -0
  398. package/lib/typescript/src/lowMemoryCache.d.ts +64 -0
  399. package/lib/typescript/src/lowMemoryCache.d.ts.map +1 -0
  400. package/lib/typescript/src/mediaHistory.d.ts +3 -0
  401. package/lib/typescript/src/mediaHistory.d.ts.map +1 -0
  402. package/lib/typescript/src/mediaStorageService.d.ts +155 -0
  403. package/lib/typescript/src/mediaStorageService.d.ts.map +1 -0
  404. package/lib/typescript/src/memory.d.ts +21 -0
  405. package/lib/typescript/src/memory.d.ts.map +1 -0
  406. package/lib/typescript/src/nativeActions.d.ts +174 -0
  407. package/lib/typescript/src/nativeActions.d.ts.map +1 -0
  408. package/lib/typescript/src/nativeComponentSupport.d.ts +30 -0
  409. package/lib/typescript/src/nativeComponentSupport.d.ts.map +1 -0
  410. package/lib/typescript/src/networkPerformance.d.ts +12 -0
  411. package/lib/typescript/src/networkPerformance.d.ts.map +1 -0
  412. package/lib/typescript/src/performance.d.ts +32 -0
  413. package/lib/typescript/src/performance.d.ts.map +1 -0
  414. package/lib/typescript/src/performanceMonitor.d.ts +45 -0
  415. package/lib/typescript/src/performanceMonitor.d.ts.map +1 -0
  416. package/lib/typescript/src/permissions.d.ts +132 -0
  417. package/lib/typescript/src/permissions.d.ts.map +1 -0
  418. package/lib/typescript/src/rendering.d.ts +9 -0
  419. package/lib/typescript/src/rendering.d.ts.map +1 -0
  420. package/lib/typescript/src/security.d.ts +6 -0
  421. package/lib/typescript/src/security.d.ts.map +1 -0
  422. package/lib/typescript/src/state.d.ts +102 -0
  423. package/lib/typescript/src/state.d.ts.map +1 -0
  424. package/lib/typescript/src/storage.d.ts +117 -0
  425. package/lib/typescript/src/storage.d.ts.map +1 -0
  426. package/lib/typescript/src/theme.d.ts +15 -0
  427. package/lib/typescript/src/theme.d.ts.map +1 -0
  428. package/lib/typescript/src/types.d.ts +802 -0
  429. package/lib/typescript/src/types.d.ts.map +1 -0
  430. package/lib/typescript/src/utils.d.ts +50 -0
  431. package/lib/typescript/src/utils.d.ts.map +1 -0
  432. package/lib/typescript/src/validation.d.ts +52 -0
  433. package/lib/typescript/src/validation.d.ts.map +1 -0
  434. package/package.json +204 -0
  435. package/react-native.config.js +17 -0
  436. package/src/AudioPlayerContext.tsx +220 -0
  437. package/src/CameraPreview.tsx +352 -0
  438. package/src/NativeAnimatedImageView.tsx +71 -0
  439. package/src/NativeAudioPlayerView.tsx +39 -0
  440. package/src/NativeBlurView.tsx +40 -0
  441. package/src/NativeCustomCamera.ts +305 -0
  442. package/src/NativeCustomCamera.web.ts +192 -0
  443. package/src/NativeCustomVideoView.ts +30 -0
  444. package/src/NativeDocumentPreviewView.tsx +196 -0
  445. package/src/NativeMediaThumbnailView.tsx +167 -0
  446. package/src/NativeSvgIcon.tsx +46 -0
  447. package/src/ResponsivePreviewContainer.tsx +227 -0
  448. package/src/accessibility.ts +80 -0
  449. package/src/config.ts +406 -0
  450. package/src/cpuOptimization.ts +365 -0
  451. package/src/db/DatabaseManager.ts +212 -0
  452. package/src/db/MediaMapper.ts +377 -0
  453. package/src/db/MediaRepository.ts +313 -0
  454. package/src/db/index.ts +73 -0
  455. package/src/db/migrations.ts +222 -0
  456. package/src/db/react-native-sqlcipher.d.ts +76 -0
  457. package/src/db/secureKey.ts +100 -0
  458. package/src/db/types.ts +123 -0
  459. package/src/db/useMediaDatabase.ts +191 -0
  460. package/src/defaultIcons.tsx +2390 -0
  461. package/src/deviceCapabilities.ts +438 -0
  462. package/src/errors.ts +350 -0
  463. package/src/iconConfig.tsx +962 -0
  464. package/src/icons.tsx +788 -0
  465. package/src/index.tsx +763 -0
  466. package/src/jest-globals.d.ts +9 -0
  467. package/src/library/MediaLibrary.tsx +141 -0
  468. package/src/library/MediaLibraryScreen.tsx +3003 -0
  469. package/src/library/components/AudioPreview.tsx +73 -0
  470. package/src/library/components/DocumentPreview.tsx +361 -0
  471. package/src/library/components/ExpandableFab.tsx +342 -0
  472. package/src/library/components/FileTiles.tsx +252 -0
  473. package/src/library/components/ImagePreview.tsx +72 -0
  474. package/src/library/components/MediaMetadataHeader.tsx +208 -0
  475. package/src/library/components/RecordAudioScreen.tsx +845 -0
  476. package/src/library/components/VideoPreview.tsx +478 -0
  477. package/src/library/components/ViewerCounter.tsx +71 -0
  478. package/src/library/compressionEstimate.ts +662 -0
  479. package/src/library/fileMetadata.ts +212 -0
  480. package/src/library/index.ts +66 -0
  481. package/src/library/libraryIconRegistry.tsx +86 -0
  482. package/src/library/libraryIcons.tsx +928 -0
  483. package/src/library/localizedFormat.ts +207 -0
  484. package/src/library/palette.ts +281 -0
  485. package/src/library/responsive.ts +49 -0
  486. package/src/locales.ts +381 -0
  487. package/src/localization.ts +1947 -0
  488. package/src/logger.ts +20 -0
  489. package/src/lowMemoryCache.ts +218 -0
  490. package/src/mediaHistory.ts +42 -0
  491. package/src/mediaStorageService.ts +546 -0
  492. package/src/memory.ts +102 -0
  493. package/src/nativeActions.ts +422 -0
  494. package/src/nativeComponentSupport.ts +60 -0
  495. package/src/networkPerformance.ts +30 -0
  496. package/src/performance.ts +137 -0
  497. package/src/performanceMonitor.ts +219 -0
  498. package/src/permissions.ts +403 -0
  499. package/src/rendering.ts +47 -0
  500. package/src/security.ts +19 -0
  501. package/src/state.ts +333 -0
  502. package/src/storage.ts +453 -0
  503. package/src/theme.tsx +467 -0
  504. package/src/types.ts +946 -0
  505. package/src/utils.ts +177 -0
  506. package/src/validation.ts +372 -0
@@ -0,0 +1,962 @@
1
+ /**
2
+ * THE centralized icon configuration for the whole plugin.
3
+ *
4
+ * The plugin renders icons on two physically different surfaces:
5
+ *
6
+ * - **`app`** — the React Native components (`RenderIcon`, the preview/viewer
7
+ * screens, audio player chrome). These are React components drawn from RN
8
+ * primitives; see `src/icons.tsx`.
9
+ * - **`camera`** — the native Android camera Activity and its media editor.
10
+ * That UI is Kotlin and *cannot* render React components, so its icons are
11
+ * Android vector drawables or inline SVG rendered by the platform parser;
12
+ * see `CameraIconName` in `src/types.ts`.
13
+ *
14
+ * Historically each surface had its own key space, with overlapping names
15
+ * (`close` meant two different things). This module puts ONE catalog of unique,
16
+ * camelCase {@link CameraIconId} keys in front of both of them: a host app
17
+ * customizes `close` once and the change lands on every surface that draws a
18
+ * close icon.
19
+ *
20
+ * Every entry is optional and every icon keeps its shipped default — omitting an
21
+ * id (or omitting the config entirely) leaves the plugin pixel-identical to its
22
+ * stock appearance.
23
+ *
24
+ * ```tsx
25
+ * import { setCameraIcons } from 'react-native-ensys-camera-x';
26
+ *
27
+ * setCameraIcons({
28
+ * close: MyCloseIcon, // a React component
29
+ * flashOn: require('./flash-on.png'), // an image
30
+ * done: { svg: '<svg viewBox="0 0 24 24">...</svg>' },
31
+ * send: { tintColor: '#25D366' }, // recolor the built-in icon
32
+ * crop: { resourceName: 'my_crop' }, // an Android drawable in your app
33
+ * });
34
+ * ```
35
+ *
36
+ * This module is intentionally side-effect free: it owns the catalog and the
37
+ * pure resolvers. The live store, the native bridge push and the public
38
+ * `setCameraIcons()` entry point live in `src/config.ts`, which is the single
39
+ * place that talks to both layers.
40
+ */
41
+ import { Image } from 'react-native';
42
+ import type { ImageSourcePropType } from 'react-native';
43
+ import {
44
+ createDefaultIconRegistry,
45
+ DefaultFallbackIcon,
46
+ DEFAULT_ICON_SIZE,
47
+ type CameraIconKey,
48
+ type CameraIconRegistryConfig,
49
+ type IconComponent,
50
+ type IconOverride,
51
+ type IconProps,
52
+ } from './icons';
53
+ import { NativeSvgIcon } from './NativeSvgIcon';
54
+ import type { CameraIconConfig, CameraIconName, CameraIconStyle } from './types';
55
+
56
+ // ============================================================================
57
+ // Icon ids
58
+ // ============================================================================
59
+
60
+ /**
61
+ * Which surface an icon is drawn on. Determines which customization fields
62
+ * actually take effect for that icon — see {@link CameraIconCustomization}.
63
+ */
64
+ export type CameraIconSurface = 'app' | 'camera' | 'both';
65
+
66
+ /**
67
+ * Every customizable icon in the plugin, as one flat set of unique keys.
68
+ *
69
+ * Ids are camelCase and deliberately distinct from the two internal key spaces
70
+ * they drive (`CameraIconKey` for the RN registry, `CameraIconName` for the
71
+ * native drawables) so there is never any doubt about which one a config object
72
+ * is addressing.
73
+ */
74
+ export type CameraIconId =
75
+ // ── Common controls ──────────────────────────────────────────────────────
76
+ | 'close'
77
+ | 'back'
78
+ | 'done'
79
+ | 'cancel'
80
+ | 'check'
81
+ | 'selectionCheck'
82
+ // ── Camera screen ────────────────────────────────────────────────────────
83
+ | 'camera'
84
+ | 'photo'
85
+ | 'video'
86
+ | 'photoMode'
87
+ | 'videoMode'
88
+ | 'flipCamera'
89
+ | 'flashOn'
90
+ | 'flashOff'
91
+ | 'flashAuto'
92
+ | 'gallery'
93
+ | 'record'
94
+ | 'mic'
95
+ | 'lock'
96
+ | 'lockOpen'
97
+ // ── Editor tools ─────────────────────────────────────────────────────────
98
+ | 'crop'
99
+ | 'rotate'
100
+ | 'aspectRatio'
101
+ | 'filter'
102
+ | 'sticker'
103
+ | 'emoji'
104
+ | 'gif'
105
+ | 'text'
106
+ | 'textBackground'
107
+ | 'textAlignLeft'
108
+ | 'textAlignCenter'
109
+ | 'textAlignRight'
110
+ | 'draw'
111
+ | 'marker'
112
+ | 'brushThin'
113
+ | 'brushMedium'
114
+ | 'brushThick'
115
+ | 'clearDrawing'
116
+ | 'undo'
117
+ | 'redo'
118
+ | 'overlayClose'
119
+ | 'overlayResize'
120
+ // ── Media actions & playback ─────────────────────────────────────────────
121
+ | 'play'
122
+ | 'pause'
123
+ | 'stop'
124
+ | 'volumeOn'
125
+ | 'volumeOff'
126
+ | 'mute'
127
+ | 'trim'
128
+ | 'cover'
129
+ | 'compress'
130
+ | 'export'
131
+ | 'send'
132
+ | 'download'
133
+ | 'share'
134
+ | 'delete'
135
+ | 'trash'
136
+ | 'more'
137
+ | 'moreOptions'
138
+ | 'upload'
139
+ | 'uploadStatus'
140
+ // ── Documents & audio ────────────────────────────────────────────────────
141
+ | 'document'
142
+ | 'audio'
143
+ | 'browseAudio'
144
+ | 'imageVideo'
145
+ // ── Indicators ───────────────────────────────────────────────────────────
146
+ | 'chevronUp'
147
+ | 'chevronDown'
148
+ | 'chevronRight'
149
+ | 'warning'
150
+ | 'plus'
151
+ | 'minus'
152
+ // ── Interactive & inline icons ───────────────────────────────────────────
153
+ | 'plusClose'
154
+ | 'circularSeek'
155
+ | 'viewDetails'
156
+ | 'info';
157
+
158
+ /** One row of {@link CAMERA_ICON_CATALOG}. */
159
+ export type CameraIconCatalogEntry = {
160
+ /** Where this icon is drawn. */
161
+ surface: CameraIconSurface;
162
+ /** Key in the RN component registry, when this icon has an `app` surface. */
163
+ appKey?: CameraIconKey;
164
+ /** Native drawable name, when this icon has a `camera` surface. */
165
+ nativeName?: CameraIconName;
166
+ /** One-line description of what the icon is used for (documentation). */
167
+ description: string;
168
+ };
169
+
170
+ /**
171
+ * The single source of truth: every icon id, the surfaces it drives, and the
172
+ * internal keys it maps onto.
173
+ *
174
+ * Typed as a total `Record` on purpose — adding a member to
175
+ * {@link CameraIconId} without adding its row here is a compile error, so the
176
+ * catalog can never drift out of sync with the union.
177
+ */
178
+ export const CAMERA_ICON_CATALOG: Record<CameraIconId, CameraIconCatalogEntry> =
179
+ {
180
+ // ── Common controls ────────────────────────────────────────────────────
181
+ close: {
182
+ surface: 'both',
183
+ appKey: 'close',
184
+ nativeName: 'close',
185
+ description: 'Close / dismiss a screen, sheet or overlay.',
186
+ },
187
+ back: {
188
+ surface: 'both',
189
+ appKey: 'back',
190
+ nativeName: 'back',
191
+ description: 'Back arrow in headers.',
192
+ },
193
+ done: {
194
+ surface: 'both',
195
+ appKey: 'done',
196
+ nativeName: 'done',
197
+ description: 'Confirm / apply the current step (checkmark).',
198
+ },
199
+ cancel: {
200
+ surface: 'app',
201
+ appKey: 'cancel',
202
+ description: 'Cancel an action without applying it.',
203
+ },
204
+ check: {
205
+ surface: 'app',
206
+ appKey: 'check',
207
+ description: 'Generic checkmark used by list and option rows.',
208
+ },
209
+ selectionCheck: {
210
+ surface: 'camera',
211
+ nativeName: 'selectionCheck',
212
+ description: 'Checkmark badge on a selected gallery thumbnail.',
213
+ },
214
+
215
+ // ── Camera screen ──────────────────────────────────────────────────────
216
+ camera: {
217
+ surface: 'app',
218
+ appKey: 'camera',
219
+ description: 'Generic camera icon (buttons that open the camera).',
220
+ },
221
+ photo: {
222
+ surface: 'app',
223
+ appKey: 'photo',
224
+ description: 'Still photo / image media.',
225
+ },
226
+ video: {
227
+ surface: 'app',
228
+ appKey: 'video',
229
+ description: 'Video clip media.',
230
+ },
231
+ photoMode: {
232
+ surface: 'both',
233
+ appKey: 'photo_mode',
234
+ nativeName: 'photo_mode',
235
+ description: 'The "Photo" mode tab on the camera screen.',
236
+ },
237
+ videoMode: {
238
+ surface: 'both',
239
+ appKey: 'video_mode',
240
+ nativeName: 'video_mode',
241
+ description: 'The "Video" mode tab on the camera screen.',
242
+ },
243
+ flipCamera: {
244
+ surface: 'both',
245
+ appKey: 'flip',
246
+ nativeName: 'flip',
247
+ description: 'Switch between the front and back camera.',
248
+ },
249
+ flashOn: {
250
+ surface: 'both',
251
+ appKey: 'flash_on',
252
+ nativeName: 'flash_on',
253
+ description: 'Flash forced on.',
254
+ },
255
+ flashOff: {
256
+ surface: 'both',
257
+ appKey: 'flash_off',
258
+ nativeName: 'flash_off',
259
+ description: 'Flash off.',
260
+ },
261
+ flashAuto: {
262
+ surface: 'both',
263
+ appKey: 'flash_auto',
264
+ nativeName: 'flash_auto',
265
+ description: 'Flash in automatic mode.',
266
+ },
267
+ gallery: {
268
+ surface: 'both',
269
+ appKey: 'gallery',
270
+ nativeName: 'gallery',
271
+ description:
272
+ 'Gallery / recent media — the bottom-left thumbnail placeholder.',
273
+ },
274
+ record: {
275
+ surface: 'app',
276
+ appKey: 'record',
277
+ description: 'Start recording (record dot).',
278
+ },
279
+ mic: {
280
+ surface: 'app',
281
+ appKey: 'mic',
282
+ description: 'Microphone — audio recording entry points.',
283
+ },
284
+ lock: {
285
+ surface: 'both',
286
+ appKey: 'lock',
287
+ nativeName: 'lock',
288
+ description: 'Locked state — hands-free recording is engaged.',
289
+ },
290
+ lockOpen: {
291
+ surface: 'both',
292
+ appKey: 'lock_open',
293
+ nativeName: 'lock_open',
294
+ description: 'The slide-to-lock rail shown while holding to record.',
295
+ },
296
+
297
+ // ── Editor tools ───────────────────────────────────────────────────────
298
+ crop: {
299
+ surface: 'both',
300
+ appKey: 'crop',
301
+ nativeName: 'crop',
302
+ description: 'Crop tool in the editor.',
303
+ },
304
+ rotate: {
305
+ surface: 'both',
306
+ appKey: 'rotate',
307
+ nativeName: 'rotate',
308
+ description: 'Rotate the image 90°.',
309
+ },
310
+ aspectRatio: {
311
+ surface: 'camera',
312
+ nativeName: 'aspect_ratio',
313
+ description: 'Aspect-ratio picker inside the crop tool.',
314
+ },
315
+ filter: {
316
+ surface: 'both',
317
+ appKey: 'filter',
318
+ nativeName: 'filter',
319
+ description: 'Colour filter strip.',
320
+ },
321
+ sticker: {
322
+ surface: 'both',
323
+ appKey: 'sticker',
324
+ nativeName: 'sticker',
325
+ description: 'Add-sticker tool.',
326
+ },
327
+ emoji: {
328
+ surface: 'both',
329
+ appKey: 'emoji',
330
+ nativeName: 'emoji',
331
+ description: 'Add-emoji tool.',
332
+ },
333
+ gif: {
334
+ surface: 'camera',
335
+ nativeName: 'gif',
336
+ description: 'Add-GIF tool.',
337
+ },
338
+ text: {
339
+ surface: 'both',
340
+ appKey: 'text',
341
+ nativeName: 'text',
342
+ description: 'Add-text tool.',
343
+ },
344
+ textBackground: {
345
+ surface: 'camera',
346
+ nativeName: 'text_bg',
347
+ description: 'Cycle the text background style while typing.',
348
+ },
349
+ textAlignLeft: {
350
+ surface: 'camera',
351
+ nativeName: 'text_align_left',
352
+ description: 'Text aligned left (text tool).',
353
+ },
354
+ textAlignCenter: {
355
+ surface: 'camera',
356
+ nativeName: 'text_align_center',
357
+ description: 'Text aligned centre (text tool).',
358
+ },
359
+ textAlignRight: {
360
+ surface: 'camera',
361
+ nativeName: 'text_align_right',
362
+ description: 'Text aligned right (text tool).',
363
+ },
364
+ draw: {
365
+ surface: 'app',
366
+ appKey: 'draw',
367
+ description: 'Freehand drawing tool.',
368
+ },
369
+ marker: {
370
+ surface: 'camera',
371
+ nativeName: 'marker',
372
+ description: 'Marker / pen tool in the native editor.',
373
+ },
374
+ brushThin: {
375
+ surface: 'camera',
376
+ nativeName: 'brush_thin',
377
+ description: 'Thin brush width.',
378
+ },
379
+ brushMedium: {
380
+ surface: 'camera',
381
+ nativeName: 'brush_medium',
382
+ description: 'Medium brush width.',
383
+ },
384
+ brushThick: {
385
+ surface: 'camera',
386
+ nativeName: 'brush_thick',
387
+ description: 'Thick brush width.',
388
+ },
389
+ clearDrawing: {
390
+ surface: 'camera',
391
+ nativeName: 'clear_drawing',
392
+ description: 'Erase every drawing stroke.',
393
+ },
394
+ undo: {
395
+ surface: 'both',
396
+ appKey: 'undo',
397
+ nativeName: 'undo',
398
+ description: 'Undo the last edit.',
399
+ },
400
+ redo: {
401
+ surface: 'both',
402
+ appKey: 'redo',
403
+ nativeName: 'redo',
404
+ description: 'Redo the last undone edit.',
405
+ },
406
+ overlayClose: {
407
+ surface: 'camera',
408
+ nativeName: 'overlay_close',
409
+ description:
410
+ 'The X on a selected sticker / emoji / GIF / text overlay that deletes it.',
411
+ },
412
+ overlayResize: {
413
+ surface: 'camera',
414
+ nativeName: 'overlay_resize',
415
+ description: 'The corner handle that resizes a selected overlay.',
416
+ },
417
+
418
+ // ── Media actions & playback ───────────────────────────────────────────
419
+ play: {
420
+ surface: 'both',
421
+ appKey: 'play',
422
+ nativeName: 'play',
423
+ description: 'Play video or audio.',
424
+ },
425
+ pause: {
426
+ surface: 'both',
427
+ appKey: 'pause',
428
+ nativeName: 'pause',
429
+ description: 'Pause playback or recording.',
430
+ },
431
+ stop: {
432
+ surface: 'app',
433
+ appKey: 'stop',
434
+ description: 'Stop playback or recording.',
435
+ },
436
+ volumeOn: {
437
+ surface: 'both',
438
+ appKey: 'volume_on',
439
+ nativeName: 'volume_on',
440
+ description: 'Sound on — video audio is kept.',
441
+ },
442
+ volumeOff: {
443
+ surface: 'both',
444
+ appKey: 'volume_off',
445
+ nativeName: 'volume_off',
446
+ description: 'Sound off — video is muted.',
447
+ },
448
+ mute: {
449
+ surface: 'app',
450
+ appKey: 'mute',
451
+ description: 'Muted indicator on a media tile.',
452
+ },
453
+ trim: {
454
+ surface: 'both',
455
+ appKey: 'trim',
456
+ nativeName: 'trim',
457
+ description: 'Trim a video clip.',
458
+ },
459
+ cover: {
460
+ surface: 'both',
461
+ appKey: 'cover',
462
+ nativeName: 'cover',
463
+ description: "Pick a video's cover frame.",
464
+ },
465
+ compress: {
466
+ surface: 'app',
467
+ appKey: 'compress',
468
+ description: 'Compress an image or video.',
469
+ },
470
+ export: {
471
+ surface: 'app',
472
+ appKey: 'export',
473
+ description: 'Export in another file format.',
474
+ },
475
+ send: {
476
+ surface: 'both',
477
+ appKey: 'send',
478
+ nativeName: 'send',
479
+ description: 'Send / confirm the selected media.',
480
+ },
481
+ download: {
482
+ surface: 'both',
483
+ appKey: 'download',
484
+ nativeName: 'download',
485
+ description: 'Save media to the device.',
486
+ },
487
+ share: {
488
+ surface: 'both',
489
+ appKey: 'share',
490
+ nativeName: 'share',
491
+ description: 'Share media with another app.',
492
+ },
493
+ delete: {
494
+ surface: 'both',
495
+ appKey: 'delete',
496
+ nativeName: 'delete',
497
+ description: 'Delete / remove media.',
498
+ },
499
+ trash: {
500
+ surface: 'app',
501
+ appKey: 'trash',
502
+ description:
503
+ 'Dustbin shown when dragging an overlay away, and in bulk-delete bars.',
504
+ },
505
+ more: {
506
+ surface: 'app',
507
+ appKey: 'more',
508
+ description: 'Generic overflow / "more" affordance in the app UI.',
509
+ },
510
+ moreOptions: {
511
+ surface: 'camera',
512
+ nativeName: 'more_vert',
513
+ description:
514
+ 'The ⋮ overflow button in the native preview header (Compress / Export By).',
515
+ },
516
+ upload: {
517
+ surface: 'app',
518
+ appKey: 'upload',
519
+ description: 'Upload media to a server.',
520
+ },
521
+ uploadStatus: {
522
+ surface: 'camera',
523
+ nativeName: 'stat_upload',
524
+ description:
525
+ 'Small status-bar icon of the upload notification. Must be a plain monochrome vector.',
526
+ },
527
+
528
+ // ── Documents & audio ──────────────────────────────────────────────────
529
+ document: {
530
+ surface: 'both',
531
+ appKey: 'document',
532
+ nativeName: 'document',
533
+ description: 'Document file (PDF, DOCX, …).',
534
+ },
535
+ audio: {
536
+ surface: 'both',
537
+ appKey: 'audio',
538
+ nativeName: 'audio',
539
+ description: 'Audio file.',
540
+ },
541
+ browseAudio: {
542
+ surface: 'app',
543
+ appKey: 'browse_audio',
544
+ description: 'Browse the device for an audio file.',
545
+ },
546
+ imageVideo: {
547
+ surface: 'app',
548
+ appKey: 'image_video',
549
+ description: 'Combined image-or-video picker entry point.',
550
+ },
551
+
552
+ // ── Indicators ─────────────────────────────────────────────────────────
553
+ chevronUp: {
554
+ surface: 'both',
555
+ appKey: 'chevron_up',
556
+ nativeName: 'chevron_up',
557
+ description: 'Upward chevron — swipe-up hints and expanding panels.',
558
+ },
559
+ chevronDown: {
560
+ surface: 'camera',
561
+ nativeName: 'chevron_down',
562
+ description: 'Downward chevron — collapsing the editor colour palette.',
563
+ },
564
+ chevronRight: {
565
+ surface: 'app',
566
+ appKey: 'chevron_right',
567
+ description: 'Forward chevron on navigable rows.',
568
+ },
569
+ warning: {
570
+ surface: 'app',
571
+ appKey: 'warning',
572
+ description: 'Warning / error state.',
573
+ },
574
+ plus: {
575
+ surface: 'app',
576
+ appKey: 'plus',
577
+ description: 'Add / expand (the floating action button).',
578
+ },
579
+ minus: {
580
+ surface: 'app',
581
+ appKey: 'minus',
582
+ description: 'Remove / collapse.',
583
+ },
584
+ plusClose: {
585
+ surface: 'app',
586
+ appKey: 'plus_close',
587
+ description: 'The FAB animated plus-to-close (+ ↔ ×) morphing icon.',
588
+ },
589
+ circularSeek: {
590
+ surface: 'app',
591
+ appKey: 'circular_seek',
592
+ description: 'The video player ±10s circular seek skip rings.',
593
+ },
594
+ viewDetails: {
595
+ surface: 'app',
596
+ appKey: 'view_details',
597
+ description:
598
+ 'The View Details / metadata info (i) icon on the media viewer.',
599
+ },
600
+ info: {
601
+ surface: 'app',
602
+ appKey: 'view_details',
603
+ description: 'Information icon (alias for viewDetails).',
604
+ },
605
+ };
606
+
607
+ /** Every icon id, in catalog order. Handy for docs and tests. */
608
+ export const CAMERA_ICON_IDS = Object.keys(
609
+ CAMERA_ICON_CATALOG
610
+ ) as CameraIconId[];
611
+
612
+ /** Narrowing guard for an unknown string. */
613
+ export function isCameraIconId(value: string): value is CameraIconId {
614
+ return Object.prototype.hasOwnProperty.call(CAMERA_ICON_CATALOG, value);
615
+ }
616
+
617
+ // ============================================================================
618
+ // Customization shapes
619
+ // ============================================================================
620
+
621
+ /**
622
+ * How one icon should be customized.
623
+ *
624
+ * Which fields take effect depends on the icon's `surface`
625
+ * ({@link CAMERA_ICON_CATALOG}):
626
+ *
627
+ * | Field | `app` surface | `camera` surface |
628
+ * | -------------- | ------------- | ---------------- |
629
+ * | `component` | ✅ | — |
630
+ * | `source` | ✅ | — |
631
+ * | `svg` | ✅ | ✅ |
632
+ * | `resourceName` | — | ✅ |
633
+ * | `tintColor` | ✅ | ✅ |
634
+ * | `size` | ✅ | — |
635
+ *
636
+ * A `both`-surface icon accepts all of them and applies each where it works,
637
+ * so `{ component: MyClose, resourceName: 'my_close' }` replaces the artwork on
638
+ * every surface at once. Anything left unset keeps the icon's shipped default.
639
+ */
640
+ export type CameraIconCustomization = {
641
+ /** React component to draw instead of the built-in one (app surface). */
642
+ component?: IconComponent;
643
+ /**
644
+ * Image to draw instead of the built-in one (app surface) — e.g.
645
+ * `require('./my-icon.png')` or `{ uri: 'https://…' }`. Rendered with
646
+ * `resizeMode: 'contain'` at the icon's size, and left un-tinted unless
647
+ * `tintColor` is also given, so full-colour artwork survives intact.
648
+ */
649
+ source?: ImageSourcePropType;
650
+ /**
651
+ * Inline SVG markup, drawn on BOTH surfaces by the library's own bundled
652
+ * parser — no `react-native-svg`. The native camera screen parses it at
653
+ * runtime; the React Native surface draws it through the bundled
654
+ * `CameraSvgIcon` native view. Invalid/unsupported markup (or a platform
655
+ * without the native half) falls back to the icon's built-in default. Use
656
+ * `currentColor` for fills/strokes that should follow the icon tint.
657
+ */
658
+ svg?: string;
659
+ /**
660
+ * Name of a drawable resource in YOUR Android app to draw instead of the
661
+ * built-in one on the native camera screen (camera surface). Resolved with
662
+ * `Resources.getIdentifier`; falls back to the built-in drawable when the
663
+ * name does not exist.
664
+ */
665
+ resourceName?: string;
666
+ /** Recolour the icon. Applies on both surfaces. */
667
+ tintColor?: string;
668
+ /** Fixed size in dp for the app-surface icon. */
669
+ size?: number;
670
+ };
671
+
672
+ /**
673
+ * A customization, or one of two shorthands: a bare React component, or a bare
674
+ * image source. `close: MyIcon` is exactly `close: { component: MyIcon }`.
675
+ */
676
+ export type CameraIconValue =
677
+ | IconComponent
678
+ | ImageSourcePropType
679
+ | CameraIconCustomization;
680
+
681
+ /**
682
+ * The centralized icon configuration: a flat map of icon id → replacement.
683
+ * Every key is optional; an absent key keeps the plugin's default icon.
684
+ */
685
+ export type CameraIconsConfig = Partial<Record<CameraIconId, CameraIconValue>>;
686
+
687
+ // ============================================================================
688
+ // Normalization
689
+ // ============================================================================
690
+
691
+ const CUSTOMIZATION_FIELDS = [
692
+ 'component',
693
+ 'source',
694
+ 'svg',
695
+ 'resourceName',
696
+ 'tintColor',
697
+ 'size',
698
+ ] as const;
699
+
700
+ /**
701
+ * Collapse any of the accepted shorthands into a full
702
+ * {@link CameraIconCustomization}.
703
+ *
704
+ * The three input shapes are distinguished structurally, because an image
705
+ * source is `number | object | array` and a React component is
706
+ * `function | object`:
707
+ *
708
+ * - a function, or an object carrying React's `$$typeof` brand
709
+ * (`memo`/`forwardRef` results) → a component;
710
+ * - a number (what `require('./x.png')` compiles to) or an array of sources,
711
+ * or an object with a `uri` → an image source;
712
+ * - an object mentioning any customization field → already a customization;
713
+ * - anything else → treated as an image source, which is what the remaining
714
+ * `ImageSourcePropType` variants are.
715
+ */
716
+ export function normalizeCameraIconValue(
717
+ value: CameraIconValue
718
+ ): CameraIconCustomization {
719
+ if (typeof value === 'function') {
720
+ return { component: value as IconComponent };
721
+ }
722
+ if (typeof value === 'number' || Array.isArray(value)) {
723
+ return { source: value as ImageSourcePropType };
724
+ }
725
+ if (value && typeof value === 'object') {
726
+ const record = value as Record<string, unknown>;
727
+ if ('$$typeof' in record) {
728
+ return { component: value as IconComponent };
729
+ }
730
+ if ('uri' in record) {
731
+ return { source: value as ImageSourcePropType };
732
+ }
733
+ if (CUSTOMIZATION_FIELDS.some((field) => field in record)) {
734
+ return value as CameraIconCustomization;
735
+ }
736
+ }
737
+ return { source: value as ImageSourcePropType };
738
+ }
739
+
740
+ /**
741
+ * Wrap an image source in an {@link IconComponent}.
742
+ *
743
+ * The incoming `color` prop is deliberately ignored: a host-supplied PNG is
744
+ * usually already coloured, and blanket-tinting it with the current theme
745
+ * colour would flatten it. Pass `tintColor` explicitly to opt into recolouring.
746
+ */
747
+ export function createImageIconComponent(
748
+ source: ImageSourcePropType,
749
+ tintColor?: string
750
+ ): IconComponent {
751
+ const ImageIcon: IconComponent = ({ size, style }: IconProps) => {
752
+ const edge = size ?? DEFAULT_ICON_SIZE;
753
+ return (
754
+ <Image
755
+ source={source}
756
+ resizeMode="contain"
757
+ style={[
758
+ { width: edge, height: edge },
759
+ tintColor ? { tintColor } : null,
760
+ style,
761
+ ]}
762
+ />
763
+ );
764
+ };
765
+ ImageIcon.displayName = 'CameraImageIcon';
766
+ return ImageIcon;
767
+ }
768
+
769
+ /**
770
+ * Basic structural validity check for inline SVG markup: a non-empty string
771
+ * within the native parser's size cap, with an `<svg>` root and at least one
772
+ * drawable element the parser understands (`path` / `rect` / `circle` /
773
+ * `ellipse` / `line` / `polyline` / `polygon`). Markup that fails this is
774
+ * treated as "no SVG" so the icon keeps its built-in default — the same safe
775
+ * fallback the renderers apply when parsing fails at draw time.
776
+ */
777
+ export function isRenderableSvg(svg: unknown): svg is string {
778
+ if (typeof svg !== 'string') return false;
779
+ const markup = svg.trim();
780
+ if (markup.length === 0 || markup.length > 256 * 1024) return false;
781
+ if (!/<svg[\s>]/i.test(markup)) return false;
782
+ return /<(path|rect|circle|ellipse|line|polyline|polygon)[\s/>]/i.test(markup);
783
+ }
784
+
785
+ /**
786
+ * Wrap inline SVG markup in an {@link IconComponent} for the React Native
787
+ * component surface. The markup is drawn by the library's OWN bundled native
788
+ * renderer (`CameraSvgIcon`, backed by `SvgDrawable`) — no `react-native-svg`
789
+ * and no third-party SVG library.
790
+ *
791
+ * Anything that cannot be drawn falls back to [fallback] (the icon's built-in
792
+ * default component): invalid/empty markup, a platform with no native half
793
+ * (iOS / web), or an older linked binary without the renderer. So a
794
+ * customization never leaves an empty box.
795
+ *
796
+ * `currentColor` in the markup follows the icon's tint — an explicit
797
+ * [tintColor] wins, otherwise the render-time `color` is used — while explicit
798
+ * colours inside the SVG are always preserved.
799
+ */
800
+ export function createSvgIconComponent(
801
+ svg: string,
802
+ tintColor?: string,
803
+ fallback?: IconComponent
804
+ ): IconComponent {
805
+ const Fallback = fallback ?? DefaultFallbackIcon;
806
+ if (!isRenderableSvg(svg)) {
807
+ return Fallback;
808
+ }
809
+ const SvgIcon: IconComponent = (props: IconProps) => {
810
+ const edge = props.size ?? DEFAULT_ICON_SIZE;
811
+ const tint = tintColor ?? (props.color as string | undefined);
812
+ return (
813
+ <NativeSvgIcon
814
+ svg={svg}
815
+ tintColor={tint}
816
+ style={[{ width: edge, height: edge }, props.style]}
817
+ fallback={<Fallback {...props} />}
818
+ />
819
+ );
820
+ };
821
+ SvgIcon.displayName = 'CameraSvgIcon';
822
+ return SvgIcon;
823
+ }
824
+
825
+ // ============================================================================
826
+ // Projection onto the two internal layers
827
+ // ============================================================================
828
+
829
+ /**
830
+ * Project the centralized config onto the RN component registry
831
+ * (`src/icons.tsx`).
832
+ *
833
+ * Only ids with an `appKey` contribute. Artwork replacements become registry
834
+ * `overrides` — which take precedence over any registry a host also passes to
835
+ * `CameraIconProvider` — while bare `tintColor` / `size` become per-icon
836
+ * overrides that recolour or resize the *built-in* component. Ids the caller
837
+ * left out never appear, so their defaults resolve untouched.
838
+ */
839
+ export function resolveCameraIconRegistryConfig(
840
+ config: CameraIconsConfig
841
+ ): CameraIconRegistryConfig {
842
+ const overrides: Partial<Record<CameraIconKey, IconOverride>> = {};
843
+ // One shared default registry: both the returned base registry and each SVG
844
+ // icon's fallback are drawn from it, so an invalid SVG resolves to the exact
845
+ // built-in component that key ships with.
846
+ const defaultRegistry = createDefaultIconRegistry();
847
+
848
+ (Object.keys(config) as CameraIconId[]).forEach((id) => {
849
+ const entry = CAMERA_ICON_CATALOG[id];
850
+ const raw = config[id];
851
+ if (!entry?.appKey || raw === undefined || raw === null) {
852
+ return;
853
+ }
854
+
855
+ const custom = normalizeCameraIconValue(raw);
856
+ const override: IconOverride = {};
857
+
858
+ if (custom.component) {
859
+ override.component = custom.component;
860
+ } else if (custom.svg !== undefined && isRenderableSvg(custom.svg)) {
861
+ // Invalid/empty SVG is intentionally skipped here so the built-in default
862
+ // (still in the registry) resolves untouched — the "fall back to the
863
+ // default icon" guarantee.
864
+ override.component = createSvgIconComponent(
865
+ custom.svg,
866
+ custom.tintColor,
867
+ defaultRegistry.get(entry.appKey)
868
+ );
869
+ } else if (custom.source !== undefined) {
870
+ override.component = createImageIconComponent(
871
+ custom.source,
872
+ custom.tintColor
873
+ );
874
+ }
875
+ if (custom.tintColor !== undefined) {
876
+ override.tintColor = custom.tintColor;
877
+ }
878
+ if (custom.size !== undefined) {
879
+ override.size = custom.size;
880
+ }
881
+
882
+ if (Object.keys(override).length > 0) {
883
+ overrides[entry.appKey] = override;
884
+ }
885
+ });
886
+
887
+ return { registry: defaultRegistry, overrides };
888
+ }
889
+
890
+ /**
891
+ * Project the centralized config onto the native drawable layer
892
+ * (`CameraIconConfig` in `src/types.ts`), which is serialized to the Android
893
+ * Activity by `setCameraConfig`.
894
+ *
895
+ * Only ids with a `nativeName` contribute, and only the fields the native side
896
+ * understands (`resourceName`, `tintColor`, `size`) are carried across — a
897
+ * React component cannot cross into Kotlin UI. The wire format is unchanged, so
898
+ * no native code has to know this module exists.
899
+ */
900
+ export function resolveNativeIconConfig(
901
+ config: CameraIconsConfig
902
+ ): CameraIconConfig {
903
+ const overrides: Partial<Record<CameraIconName, CameraIconStyle>> = {};
904
+
905
+ (Object.keys(config) as CameraIconId[]).forEach((id) => {
906
+ const entry = CAMERA_ICON_CATALOG[id];
907
+ const raw = config[id];
908
+ if (!entry?.nativeName || raw === undefined || raw === null) {
909
+ return;
910
+ }
911
+
912
+ const custom = normalizeCameraIconValue(raw);
913
+ const style: CameraIconStyle = {};
914
+ if (custom.svg !== undefined) {
915
+ style.svg = custom.svg;
916
+ }
917
+ if (custom.resourceName !== undefined) {
918
+ style.resourceName = custom.resourceName;
919
+ }
920
+ if (custom.tintColor !== undefined) {
921
+ style.tintColor = custom.tintColor;
922
+ }
923
+ if (custom.size !== undefined) {
924
+ style.size = custom.size;
925
+ }
926
+
927
+ if (Object.keys(style).length > 0) {
928
+ overrides[entry.nativeName] = style;
929
+ }
930
+ });
931
+
932
+ return { overrides };
933
+ }
934
+
935
+ /** Merge two centralized icon configs; `override` wins per icon id. */
936
+ export function mergeCameraIconsConfig(
937
+ base: CameraIconsConfig,
938
+ override?: CameraIconsConfig
939
+ ): CameraIconsConfig {
940
+ if (!override) {
941
+ return base;
942
+ }
943
+ const merged: CameraIconsConfig = { ...base };
944
+ (Object.keys(override) as CameraIconId[]).forEach((id) => {
945
+ const next = override[id];
946
+ if (next === undefined) {
947
+ return;
948
+ }
949
+ const previous = merged[id];
950
+ // Two plain customization objects compose field-by-field, so
951
+ // `{ tintColor }` set now does not erase a `{ component }` set earlier.
952
+ // Any other shape (component / image source) replaces outright.
953
+ if (previous !== undefined) {
954
+ const a = normalizeCameraIconValue(previous);
955
+ const b = normalizeCameraIconValue(next);
956
+ merged[id] = { ...a, ...b };
957
+ return;
958
+ }
959
+ merged[id] = next;
960
+ });
961
+ return merged;
962
+ }