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.
- package/CustomCamera.podspec +20 -0
- package/LICENSE +20 -0
- package/README.md +833 -0
- package/android/build.gradle +135 -0
- package/android/consumer-rules.pro +47 -0
- package/android/src/main/AndroidManifest.xml +72 -0
- package/android/src/main/java/android/print/PdfPrint.java +51 -0
- package/android/src/main/java/com/customcamera/AnimatedImageViewManager.kt +199 -0
- package/android/src/main/java/com/customcamera/AudioPlayerView.kt +322 -0
- package/android/src/main/java/com/customcamera/AudioRecorder.kt +506 -0
- package/android/src/main/java/com/customcamera/BarcodeScannerActivity.kt +361 -0
- package/android/src/main/java/com/customcamera/BlurBackgroundView.kt +199 -0
- package/android/src/main/java/com/customcamera/CacheCleanupManager.kt +386 -0
- package/android/src/main/java/com/customcamera/CameraAspectRatioMode.kt +77 -0
- package/android/src/main/java/com/customcamera/CameraAsset.kt +211 -0
- package/android/src/main/java/com/customcamera/CameraTheme.kt +479 -0
- package/android/src/main/java/com/customcamera/CompressionCacheStore.kt +504 -0
- package/android/src/main/java/com/customcamera/CompressionFileNameUtils.kt +7 -0
- package/android/src/main/java/com/customcamera/CompressionProfile.kt +195 -0
- package/android/src/main/java/com/customcamera/CustomCameraActivity.kt +7291 -0
- package/android/src/main/java/com/customcamera/CustomCameraFileProvider.kt +9 -0
- package/android/src/main/java/com/customcamera/CustomCameraModule.kt +2479 -0
- package/android/src/main/java/com/customcamera/CustomCameraPackage.kt +53 -0
- package/android/src/main/java/com/customcamera/DisplayUtils.kt +9 -0
- package/android/src/main/java/com/customcamera/DocumentPreviewView.kt +846 -0
- package/android/src/main/java/com/customcamera/DrawingView.kt +214 -0
- package/android/src/main/java/com/customcamera/EmojiPickerData.kt +228 -0
- package/android/src/main/java/com/customcamera/FilterStripAdapter.kt +158 -0
- package/android/src/main/java/com/customcamera/GifSupport.kt +215 -0
- package/android/src/main/java/com/customcamera/GlobalAudioPlayer.kt +320 -0
- package/android/src/main/java/com/customcamera/ImageExporter.kt +1394 -0
- package/android/src/main/java/com/customcamera/ImageFormatSupport.kt +163 -0
- package/android/src/main/java/com/customcamera/Localization.kt +206 -0
- package/android/src/main/java/com/customcamera/MediaAdapters.kt +758 -0
- package/android/src/main/java/com/customcamera/MediaCacheManager.kt +782 -0
- package/android/src/main/java/com/customcamera/MediaExportFormats.kt +201 -0
- package/android/src/main/java/com/customcamera/MediaFileIo.kt +310 -0
- package/android/src/main/java/com/customcamera/MediaMetadataStore.kt +494 -0
- package/android/src/main/java/com/customcamera/MediaPreviewEditor.kt +14865 -0
- package/android/src/main/java/com/customcamera/MediaPublisher.kt +423 -0
- package/android/src/main/java/com/customcamera/MediaStorageWorkflow.kt +722 -0
- package/android/src/main/java/com/customcamera/MediaStoreRepository.kt +378 -0
- package/android/src/main/java/com/customcamera/MediaThumbnailView.kt +286 -0
- package/android/src/main/java/com/customcamera/MediaUtils.kt +37 -0
- package/android/src/main/java/com/customcamera/NativeVideoViewManager.kt +845 -0
- package/android/src/main/java/com/customcamera/OfficeDocumentConverter.kt +2791 -0
- package/android/src/main/java/com/customcamera/PendingCaptureCrops.kt +88 -0
- package/android/src/main/java/com/customcamera/PowerPointPreview.kt +4077 -0
- package/android/src/main/java/com/customcamera/RecentPickerStore.kt +74 -0
- package/android/src/main/java/com/customcamera/SecureFileEraser.kt +411 -0
- package/android/src/main/java/com/customcamera/SecureKeyModule.kt +88 -0
- package/android/src/main/java/com/customcamera/SecureMediaDeleter.kt +493 -0
- package/android/src/main/java/com/customcamera/StickerPickerData.kt +107 -0
- package/android/src/main/java/com/customcamera/SvgDrawable.kt +175 -0
- package/android/src/main/java/com/customcamera/SvgIconViewManager.kt +77 -0
- package/android/src/main/java/com/customcamera/TextEntryController.kt +553 -0
- package/android/src/main/java/com/customcamera/ThumbnailLoader.kt +455 -0
- package/android/src/main/java/com/customcamera/UploadService.kt +909 -0
- package/android/src/main/java/com/customcamera/VideoEditUtils.kt +210 -0
- package/android/src/main/java/com/customcamera/VideoRotationTranscoder.kt +1992 -0
- package/android/src/main/java/com/customcamera/gif/AnimatedGifEncoder.kt +473 -0
- package/android/src/main/java/com/customcamera/gif/GifDecoder.kt +690 -0
- package/android/src/main/java/com/customcamera/gif/GifFramesDrawable.kt +160 -0
- package/android/src/main/java/com/customcamera/gif/GifHttp.kt +112 -0
- package/android/src/main/java/com/customcamera/gif/GifImageLoader.kt +186 -0
- package/android/src/main/java/com/customcamera/gif/GifModels.kt +74 -0
- package/android/src/main/java/com/customcamera/gif/GifProvider.kt +49 -0
- package/android/src/main/java/com/customcamera/gif/GifProviders.kt +27 -0
- package/android/src/main/java/com/customcamera/gif/GifRepository.kt +124 -0
- package/android/src/main/java/com/customcamera/gif/GifSafety.kt +33 -0
- package/android/src/main/java/com/customcamera/gif/GiphyGifProvider.kt +146 -0
- package/android/src/main/java/com/customcamera/gif/LZWEncoder.kt +258 -0
- package/android/src/main/java/com/customcamera/gif/NeuQuant.kt +435 -0
- package/android/src/main/java/com/customcamera/gif/TenorGifProvider.kt +147 -0
- package/android/src/main/res/drawable/bg_brush_selected.xml +5 -0
- package/android/src/main/res/drawable/bg_color_swatch.xml +5 -0
- package/android/src/main/res/drawable/bg_editor_toolbar.xml +6 -0
- package/android/src/main/res/drawable/bg_icon_circle.xml +5 -0
- package/android/src/main/res/drawable/bg_icon_circle_light.xml +5 -0
- package/android/src/main/res/drawable/bg_mode_tab_active.xml +6 -0
- package/android/src/main/res/drawable/bg_pill.xml +6 -0
- package/android/src/main/res/drawable/bg_recording_dot.xml +6 -0
- package/android/src/main/res/drawable/bg_selection_badge.xml +8 -0
- package/android/src/main/res/drawable/bg_send_button.xml +5 -0
- package/android/src/main/res/drawable/bg_shutter_inner.xml +5 -0
- package/android/src/main/res/drawable/bg_shutter_recording.xml +6 -0
- package/android/src/main/res/drawable/bg_shutter_ring.xml +8 -0
- package/android/src/main/res/drawable/bg_shutter_video_idle.xml +5 -0
- package/android/src/main/res/drawable/bg_thumbnail.xml +9 -0
- package/android/src/main/res/drawable/ic_aspect_ratio.xml +17 -0
- package/android/src/main/res/drawable/ic_audio.xml +10 -0
- package/android/src/main/res/drawable/ic_back.xml +10 -0
- package/android/src/main/res/drawable/ic_brush_medium.xml +12 -0
- package/android/src/main/res/drawable/ic_brush_thick.xml +12 -0
- package/android/src/main/res/drawable/ic_brush_thin.xml +12 -0
- package/android/src/main/res/drawable/ic_check.xml +17 -0
- package/android/src/main/res/drawable/ic_chevron_down.xml +10 -0
- package/android/src/main/res/drawable/ic_chevron_up.xml +13 -0
- package/android/src/main/res/drawable/ic_clear_drawing.xml +10 -0
- package/android/src/main/res/drawable/ic_close.xml +10 -0
- package/android/src/main/res/drawable/ic_cover.xml +9 -0
- package/android/src/main/res/drawable/ic_crop.xml +10 -0
- package/android/src/main/res/drawable/ic_delete.xml +9 -0
- package/android/src/main/res/drawable/ic_document.xml +10 -0
- package/android/src/main/res/drawable/ic_done.xml +10 -0
- package/android/src/main/res/drawable/ic_download.xml +10 -0
- package/android/src/main/res/drawable/ic_emoji.xml +10 -0
- package/android/src/main/res/drawable/ic_filter.xml +10 -0
- package/android/src/main/res/drawable/ic_flash_auto.xml +7 -0
- package/android/src/main/res/drawable/ic_flash_off.xml +23 -0
- package/android/src/main/res/drawable/ic_flash_on.xml +16 -0
- package/android/src/main/res/drawable/ic_flip.xml +15 -0
- package/android/src/main/res/drawable/ic_gallery.xml +10 -0
- package/android/src/main/res/drawable/ic_gif.xml +24 -0
- package/android/src/main/res/drawable/ic_lock.xml +19 -0
- package/android/src/main/res/drawable/ic_lock_open.xml +22 -0
- package/android/src/main/res/drawable/ic_marker.xml +10 -0
- package/android/src/main/res/drawable/ic_more_vert.xml +18 -0
- package/android/src/main/res/drawable/ic_overlay_close.xml +19 -0
- package/android/src/main/res/drawable/ic_overlay_resize.xml +18 -0
- package/android/src/main/res/drawable/ic_pause.xml +10 -0
- package/android/src/main/res/drawable/ic_photo_mode.xml +10 -0
- package/android/src/main/res/drawable/ic_play.xml +10 -0
- package/android/src/main/res/drawable/ic_redo.xml +10 -0
- package/android/src/main/res/drawable/ic_rotate.xml +9 -0
- package/android/src/main/res/drawable/ic_send.xml +10 -0
- package/android/src/main/res/drawable/ic_share.xml +10 -0
- package/android/src/main/res/drawable/ic_stat_upload.xml +10 -0
- package/android/src/main/res/drawable/ic_sticker.xml +24 -0
- package/android/src/main/res/drawable/ic_text.xml +10 -0
- package/android/src/main/res/drawable/ic_text_align_center.xml +11 -0
- package/android/src/main/res/drawable/ic_text_align_left.xml +11 -0
- package/android/src/main/res/drawable/ic_text_align_right.xml +11 -0
- package/android/src/main/res/drawable/ic_text_bg.xml +11 -0
- package/android/src/main/res/drawable/ic_trim.xml +23 -0
- package/android/src/main/res/drawable/ic_undo.xml +10 -0
- package/android/src/main/res/drawable/ic_video_mode.xml +10 -0
- package/android/src/main/res/drawable/ic_video_note.xml +13 -0
- package/android/src/main/res/drawable/ic_volume_off.xml +9 -0
- package/android/src/main/res/drawable/ic_volume_on.xml +9 -0
- package/android/src/main/res/drawable/sticker_heart.xml +9 -0
- package/android/src/main/res/drawable/sticker_smile.xml +9 -0
- package/android/src/main/res/drawable/sticker_star.xml +9 -0
- package/android/src/main/res/drawable/sticker_thumbsup.xml +9 -0
- package/android/src/main/res/values/colors.xml +34 -0
- package/android/src/main/res/values/ids.xml +15 -0
- package/android/src/main/res/values/strings.xml +15 -0
- package/android/src/main/res/values/styles.xml +20 -0
- package/android/src/main/res/xml/file_paths.xml +34 -0
- package/ios/CustomCamera.h +5 -0
- package/ios/CustomCamera.mm +214 -0
- package/lib/module/AudioPlayerContext.js +233 -0
- package/lib/module/AudioPlayerContext.js.map +1 -0
- package/lib/module/CameraPreview.js +304 -0
- package/lib/module/CameraPreview.js.map +1 -0
- package/lib/module/NativeAnimatedImageView.js +41 -0
- package/lib/module/NativeAnimatedImageView.js.map +1 -0
- package/lib/module/NativeAudioPlayerView.js +33 -0
- package/lib/module/NativeAudioPlayerView.js.map +1 -0
- package/lib/module/NativeBlurView.js +35 -0
- package/lib/module/NativeBlurView.js.map +1 -0
- package/lib/module/NativeCustomCamera.js +128 -0
- package/lib/module/NativeCustomCamera.js.map +1 -0
- package/lib/module/NativeCustomCamera.web.js +143 -0
- package/lib/module/NativeCustomCamera.web.js.map +1 -0
- package/lib/module/NativeCustomVideoView.js +5 -0
- package/lib/module/NativeCustomVideoView.js.map +1 -0
- package/lib/module/NativeDocumentPreviewView.js +156 -0
- package/lib/module/NativeDocumentPreviewView.js.map +1 -0
- package/lib/module/NativeMediaThumbnailView.js +110 -0
- package/lib/module/NativeMediaThumbnailView.js.map +1 -0
- package/lib/module/NativeSvgIcon.js +32 -0
- package/lib/module/NativeSvgIcon.js.map +1 -0
- package/lib/module/ResponsivePreviewContainer.js +171 -0
- package/lib/module/ResponsivePreviewContainer.js.map +1 -0
- package/lib/module/accessibility.js +61 -0
- package/lib/module/accessibility.js.map +1 -0
- package/lib/module/config.js +352 -0
- package/lib/module/config.js.map +1 -0
- package/lib/module/cpuOptimization.js +296 -0
- package/lib/module/cpuOptimization.js.map +1 -0
- package/lib/module/db/DatabaseManager.js +191 -0
- package/lib/module/db/DatabaseManager.js.map +1 -0
- package/lib/module/db/MediaMapper.js +284 -0
- package/lib/module/db/MediaMapper.js.map +1 -0
- package/lib/module/db/MediaRepository.js +242 -0
- package/lib/module/db/MediaRepository.js.map +1 -0
- package/lib/module/db/index.js +41 -0
- package/lib/module/db/index.js.map +1 -0
- package/lib/module/db/migrations.js +180 -0
- package/lib/module/db/migrations.js.map +1 -0
- package/lib/module/db/react-native-sqlcipher.d.js +2 -0
- package/lib/module/db/react-native-sqlcipher.d.js.map +1 -0
- package/lib/module/db/secureKey.js +87 -0
- package/lib/module/db/secureKey.js.map +1 -0
- package/lib/module/db/types.js +57 -0
- package/lib/module/db/types.js.map +1 -0
- package/lib/module/db/useMediaDatabase.js +123 -0
- package/lib/module/db/useMediaDatabase.js.map +1 -0
- package/lib/module/defaultIcons.js +2259 -0
- package/lib/module/defaultIcons.js.map +1 -0
- package/lib/module/deviceCapabilities.js +408 -0
- package/lib/module/deviceCapabilities.js.map +1 -0
- package/lib/module/errors.js +267 -0
- package/lib/module/errors.js.map +1 -0
- package/lib/module/iconConfig.js +796 -0
- package/lib/module/iconConfig.js.map +1 -0
- package/lib/module/icons.js +514 -0
- package/lib/module/icons.js.map +1 -0
- package/lib/module/index.js +251 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/jest-globals.d.js +2 -0
- package/lib/module/jest-globals.d.js.map +1 -0
- package/lib/module/library/MediaLibrary.js +107 -0
- package/lib/module/library/MediaLibrary.js.map +1 -0
- package/lib/module/library/MediaLibraryScreen.js +2597 -0
- package/lib/module/library/MediaLibraryScreen.js.map +1 -0
- package/lib/module/library/components/AudioPreview.js +74 -0
- package/lib/module/library/components/AudioPreview.js.map +1 -0
- package/lib/module/library/components/DocumentPreview.js +331 -0
- package/lib/module/library/components/DocumentPreview.js.map +1 -0
- package/lib/module/library/components/ExpandableFab.js +343 -0
- package/lib/module/library/components/ExpandableFab.js.map +1 -0
- package/lib/module/library/components/FileTiles.js +251 -0
- package/lib/module/library/components/FileTiles.js.map +1 -0
- package/lib/module/library/components/ImagePreview.js +70 -0
- package/lib/module/library/components/ImagePreview.js.map +1 -0
- package/lib/module/library/components/MediaMetadataHeader.js +175 -0
- package/lib/module/library/components/MediaMetadataHeader.js.map +1 -0
- package/lib/module/library/components/RecordAudioScreen.js +816 -0
- package/lib/module/library/components/RecordAudioScreen.js.map +1 -0
- package/lib/module/library/components/VideoPreview.js +453 -0
- package/lib/module/library/components/VideoPreview.js.map +1 -0
- package/lib/module/library/components/ViewerCounter.js +55 -0
- package/lib/module/library/components/ViewerCounter.js.map +1 -0
- package/lib/module/library/compressionEstimate.js +507 -0
- package/lib/module/library/compressionEstimate.js.map +1 -0
- package/lib/module/library/fileMetadata.js +196 -0
- package/lib/module/library/fileMetadata.js.map +1 -0
- package/lib/module/library/index.js +42 -0
- package/lib/module/library/index.js.map +1 -0
- package/lib/module/library/libraryIconRegistry.js +69 -0
- package/lib/module/library/libraryIconRegistry.js.map +1 -0
- package/lib/module/library/libraryIcons.js +858 -0
- package/lib/module/library/libraryIcons.js.map +1 -0
- package/lib/module/library/localizedFormat.js +181 -0
- package/lib/module/library/localizedFormat.js.map +1 -0
- package/lib/module/library/palette.js +225 -0
- package/lib/module/library/palette.js.map +1 -0
- package/lib/module/library/responsive.js +53 -0
- package/lib/module/library/responsive.js.map +1 -0
- package/lib/module/locales.js +416 -0
- package/lib/module/locales.js.map +1 -0
- package/lib/module/localization.js +1064 -0
- package/lib/module/localization.js.map +1 -0
- package/lib/module/logger.js +20 -0
- package/lib/module/logger.js.map +1 -0
- package/lib/module/lowMemoryCache.js +206 -0
- package/lib/module/lowMemoryCache.js.map +1 -0
- package/lib/module/mediaHistory.js +33 -0
- package/lib/module/mediaHistory.js.map +1 -0
- package/lib/module/mediaStorageService.js +402 -0
- package/lib/module/mediaStorageService.js.map +1 -0
- package/lib/module/memory.js +79 -0
- package/lib/module/memory.js.map +1 -0
- package/lib/module/nativeActions.js +307 -0
- package/lib/module/nativeActions.js.map +1 -0
- package/lib/module/nativeComponentSupport.js +61 -0
- package/lib/module/nativeComponentSupport.js.map +1 -0
- package/lib/module/networkPerformance.js +24 -0
- package/lib/module/networkPerformance.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/performance.js +104 -0
- package/lib/module/performance.js.map +1 -0
- package/lib/module/performanceMonitor.js +155 -0
- package/lib/module/performanceMonitor.js.map +1 -0
- package/lib/module/permissions.js +370 -0
- package/lib/module/permissions.js.map +1 -0
- package/lib/module/rendering.js +40 -0
- package/lib/module/rendering.js.map +1 -0
- package/lib/module/security.js +18 -0
- package/lib/module/security.js.map +1 -0
- package/lib/module/state.js +266 -0
- package/lib/module/state.js.map +1 -0
- package/lib/module/storage.js +400 -0
- package/lib/module/storage.js.map +1 -0
- package/lib/module/theme.js +390 -0
- package/lib/module/theme.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils.js +115 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/module/validation.js +288 -0
- package/lib/module/validation.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/AudioPlayerContext.d.ts +27 -0
- package/lib/typescript/src/AudioPlayerContext.d.ts.map +1 -0
- package/lib/typescript/src/CameraPreview.d.ts +13 -0
- package/lib/typescript/src/CameraPreview.d.ts.map +1 -0
- package/lib/typescript/src/NativeAnimatedImageView.d.ts +33 -0
- package/lib/typescript/src/NativeAnimatedImageView.d.ts.map +1 -0
- package/lib/typescript/src/NativeAudioPlayerView.d.ts +12 -0
- package/lib/typescript/src/NativeAudioPlayerView.d.ts.map +1 -0
- package/lib/typescript/src/NativeBlurView.d.ts +12 -0
- package/lib/typescript/src/NativeBlurView.d.ts.map +1 -0
- package/lib/typescript/src/NativeCustomCamera.d.ts +167 -0
- package/lib/typescript/src/NativeCustomCamera.d.ts.map +1 -0
- package/lib/typescript/src/NativeCustomCamera.web.d.ts +47 -0
- package/lib/typescript/src/NativeCustomCamera.web.d.ts.map +1 -0
- package/lib/typescript/src/NativeCustomVideoView.d.ts +30 -0
- package/lib/typescript/src/NativeCustomVideoView.d.ts.map +1 -0
- package/lib/typescript/src/NativeDocumentPreviewView.d.ts +48 -0
- package/lib/typescript/src/NativeDocumentPreviewView.d.ts.map +1 -0
- package/lib/typescript/src/NativeMediaThumbnailView.d.ts +54 -0
- package/lib/typescript/src/NativeMediaThumbnailView.d.ts.map +1 -0
- package/lib/typescript/src/NativeSvgIcon.d.ts +25 -0
- package/lib/typescript/src/NativeSvgIcon.d.ts.map +1 -0
- package/lib/typescript/src/ResponsivePreviewContainer.d.ts +92 -0
- package/lib/typescript/src/ResponsivePreviewContainer.d.ts.map +1 -0
- package/lib/typescript/src/accessibility.d.ts +20 -0
- package/lib/typescript/src/accessibility.d.ts.map +1 -0
- package/lib/typescript/src/config.d.ts +145 -0
- package/lib/typescript/src/config.d.ts.map +1 -0
- package/lib/typescript/src/cpuOptimization.d.ts +63 -0
- package/lib/typescript/src/cpuOptimization.d.ts.map +1 -0
- package/lib/typescript/src/db/DatabaseManager.d.ts +48 -0
- package/lib/typescript/src/db/DatabaseManager.d.ts.map +1 -0
- package/lib/typescript/src/db/MediaMapper.d.ts +77 -0
- package/lib/typescript/src/db/MediaMapper.d.ts.map +1 -0
- package/lib/typescript/src/db/MediaRepository.d.ts +66 -0
- package/lib/typescript/src/db/MediaRepository.d.ts.map +1 -0
- package/lib/typescript/src/db/index.d.ts +23 -0
- package/lib/typescript/src/db/index.d.ts.map +1 -0
- package/lib/typescript/src/db/migrations.d.ts +31 -0
- package/lib/typescript/src/db/migrations.d.ts.map +1 -0
- package/lib/typescript/src/db/secureKey.d.ts +10 -0
- package/lib/typescript/src/db/secureKey.d.ts.map +1 -0
- package/lib/typescript/src/db/types.d.ts +115 -0
- package/lib/typescript/src/db/types.d.ts.map +1 -0
- package/lib/typescript/src/db/useMediaDatabase.d.ts +41 -0
- package/lib/typescript/src/db/useMediaDatabase.d.ts.map +1 -0
- package/lib/typescript/src/defaultIcons.d.ts +139 -0
- package/lib/typescript/src/defaultIcons.d.ts.map +1 -0
- package/lib/typescript/src/deviceCapabilities.d.ts +92 -0
- package/lib/typescript/src/deviceCapabilities.d.ts.map +1 -0
- package/lib/typescript/src/errors.d.ts +95 -0
- package/lib/typescript/src/errors.d.ts.map +1 -0
- package/lib/typescript/src/iconConfig.d.ts +176 -0
- package/lib/typescript/src/iconConfig.d.ts.map +1 -0
- package/lib/typescript/src/icons.d.ts +217 -0
- package/lib/typescript/src/icons.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +104 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/library/MediaLibrary.d.ts +57 -0
- package/lib/typescript/src/library/MediaLibrary.d.ts.map +1 -0
- package/lib/typescript/src/library/MediaLibraryScreen.d.ts +51 -0
- package/lib/typescript/src/library/MediaLibraryScreen.d.ts.map +1 -0
- package/lib/typescript/src/library/components/AudioPreview.d.ts +6 -0
- package/lib/typescript/src/library/components/AudioPreview.d.ts.map +1 -0
- package/lib/typescript/src/library/components/DocumentPreview.d.ts +10 -0
- package/lib/typescript/src/library/components/DocumentPreview.d.ts.map +1 -0
- package/lib/typescript/src/library/components/ExpandableFab.d.ts +39 -0
- package/lib/typescript/src/library/components/ExpandableFab.d.ts.map +1 -0
- package/lib/typescript/src/library/components/FileTiles.d.ts +8 -0
- package/lib/typescript/src/library/components/FileTiles.d.ts.map +1 -0
- package/lib/typescript/src/library/components/ImagePreview.d.ts +5 -0
- package/lib/typescript/src/library/components/ImagePreview.d.ts.map +1 -0
- package/lib/typescript/src/library/components/MediaMetadataHeader.d.ts +16 -0
- package/lib/typescript/src/library/components/MediaMetadataHeader.d.ts.map +1 -0
- package/lib/typescript/src/library/components/RecordAudioScreen.d.ts +8 -0
- package/lib/typescript/src/library/components/RecordAudioScreen.d.ts.map +1 -0
- package/lib/typescript/src/library/components/VideoPreview.d.ts +20 -0
- package/lib/typescript/src/library/components/VideoPreview.d.ts.map +1 -0
- package/lib/typescript/src/library/components/ViewerCounter.d.ts +13 -0
- package/lib/typescript/src/library/components/ViewerCounter.d.ts.map +1 -0
- package/lib/typescript/src/library/compressionEstimate.d.ts +313 -0
- package/lib/typescript/src/library/compressionEstimate.d.ts.map +1 -0
- package/lib/typescript/src/library/fileMetadata.d.ts +33 -0
- package/lib/typescript/src/library/fileMetadata.d.ts.map +1 -0
- package/lib/typescript/src/library/index.d.ts +40 -0
- package/lib/typescript/src/library/index.d.ts.map +1 -0
- package/lib/typescript/src/library/libraryIconRegistry.d.ts +35 -0
- package/lib/typescript/src/library/libraryIconRegistry.d.ts.map +1 -0
- package/lib/typescript/src/library/libraryIcons.d.ts +85 -0
- package/lib/typescript/src/library/libraryIcons.d.ts.map +1 -0
- package/lib/typescript/src/library/localizedFormat.d.ts +49 -0
- package/lib/typescript/src/library/localizedFormat.d.ts.map +1 -0
- package/lib/typescript/src/library/palette.d.ts +104 -0
- package/lib/typescript/src/library/palette.d.ts.map +1 -0
- package/lib/typescript/src/library/responsive.d.ts +15 -0
- package/lib/typescript/src/library/responsive.d.ts.map +1 -0
- package/lib/typescript/src/locales.d.ts +103 -0
- package/lib/typescript/src/locales.d.ts.map +1 -0
- package/lib/typescript/src/localization.d.ts +1051 -0
- package/lib/typescript/src/localization.d.ts.map +1 -0
- package/lib/typescript/src/logger.d.ts +4 -0
- package/lib/typescript/src/logger.d.ts.map +1 -0
- package/lib/typescript/src/lowMemoryCache.d.ts +64 -0
- package/lib/typescript/src/lowMemoryCache.d.ts.map +1 -0
- package/lib/typescript/src/mediaHistory.d.ts +3 -0
- package/lib/typescript/src/mediaHistory.d.ts.map +1 -0
- package/lib/typescript/src/mediaStorageService.d.ts +155 -0
- package/lib/typescript/src/mediaStorageService.d.ts.map +1 -0
- package/lib/typescript/src/memory.d.ts +21 -0
- package/lib/typescript/src/memory.d.ts.map +1 -0
- package/lib/typescript/src/nativeActions.d.ts +174 -0
- package/lib/typescript/src/nativeActions.d.ts.map +1 -0
- package/lib/typescript/src/nativeComponentSupport.d.ts +30 -0
- package/lib/typescript/src/nativeComponentSupport.d.ts.map +1 -0
- package/lib/typescript/src/networkPerformance.d.ts +12 -0
- package/lib/typescript/src/networkPerformance.d.ts.map +1 -0
- package/lib/typescript/src/performance.d.ts +32 -0
- package/lib/typescript/src/performance.d.ts.map +1 -0
- package/lib/typescript/src/performanceMonitor.d.ts +45 -0
- package/lib/typescript/src/performanceMonitor.d.ts.map +1 -0
- package/lib/typescript/src/permissions.d.ts +132 -0
- package/lib/typescript/src/permissions.d.ts.map +1 -0
- package/lib/typescript/src/rendering.d.ts +9 -0
- package/lib/typescript/src/rendering.d.ts.map +1 -0
- package/lib/typescript/src/security.d.ts +6 -0
- package/lib/typescript/src/security.d.ts.map +1 -0
- package/lib/typescript/src/state.d.ts +102 -0
- package/lib/typescript/src/state.d.ts.map +1 -0
- package/lib/typescript/src/storage.d.ts +117 -0
- package/lib/typescript/src/storage.d.ts.map +1 -0
- package/lib/typescript/src/theme.d.ts +15 -0
- package/lib/typescript/src/theme.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +802 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils.d.ts +50 -0
- package/lib/typescript/src/utils.d.ts.map +1 -0
- package/lib/typescript/src/validation.d.ts +52 -0
- package/lib/typescript/src/validation.d.ts.map +1 -0
- package/package.json +204 -0
- package/react-native.config.js +17 -0
- package/src/AudioPlayerContext.tsx +220 -0
- package/src/CameraPreview.tsx +352 -0
- package/src/NativeAnimatedImageView.tsx +71 -0
- package/src/NativeAudioPlayerView.tsx +39 -0
- package/src/NativeBlurView.tsx +40 -0
- package/src/NativeCustomCamera.ts +305 -0
- package/src/NativeCustomCamera.web.ts +192 -0
- package/src/NativeCustomVideoView.ts +30 -0
- package/src/NativeDocumentPreviewView.tsx +196 -0
- package/src/NativeMediaThumbnailView.tsx +167 -0
- package/src/NativeSvgIcon.tsx +46 -0
- package/src/ResponsivePreviewContainer.tsx +227 -0
- package/src/accessibility.ts +80 -0
- package/src/config.ts +406 -0
- package/src/cpuOptimization.ts +365 -0
- package/src/db/DatabaseManager.ts +212 -0
- package/src/db/MediaMapper.ts +377 -0
- package/src/db/MediaRepository.ts +313 -0
- package/src/db/index.ts +73 -0
- package/src/db/migrations.ts +222 -0
- package/src/db/react-native-sqlcipher.d.ts +76 -0
- package/src/db/secureKey.ts +100 -0
- package/src/db/types.ts +123 -0
- package/src/db/useMediaDatabase.ts +191 -0
- package/src/defaultIcons.tsx +2390 -0
- package/src/deviceCapabilities.ts +438 -0
- package/src/errors.ts +350 -0
- package/src/iconConfig.tsx +962 -0
- package/src/icons.tsx +788 -0
- package/src/index.tsx +763 -0
- package/src/jest-globals.d.ts +9 -0
- package/src/library/MediaLibrary.tsx +141 -0
- package/src/library/MediaLibraryScreen.tsx +3003 -0
- package/src/library/components/AudioPreview.tsx +73 -0
- package/src/library/components/DocumentPreview.tsx +361 -0
- package/src/library/components/ExpandableFab.tsx +342 -0
- package/src/library/components/FileTiles.tsx +252 -0
- package/src/library/components/ImagePreview.tsx +72 -0
- package/src/library/components/MediaMetadataHeader.tsx +208 -0
- package/src/library/components/RecordAudioScreen.tsx +845 -0
- package/src/library/components/VideoPreview.tsx +478 -0
- package/src/library/components/ViewerCounter.tsx +71 -0
- package/src/library/compressionEstimate.ts +662 -0
- package/src/library/fileMetadata.ts +212 -0
- package/src/library/index.ts +66 -0
- package/src/library/libraryIconRegistry.tsx +86 -0
- package/src/library/libraryIcons.tsx +928 -0
- package/src/library/localizedFormat.ts +207 -0
- package/src/library/palette.ts +281 -0
- package/src/library/responsive.ts +49 -0
- package/src/locales.ts +381 -0
- package/src/localization.ts +1947 -0
- package/src/logger.ts +20 -0
- package/src/lowMemoryCache.ts +218 -0
- package/src/mediaHistory.ts +42 -0
- package/src/mediaStorageService.ts +546 -0
- package/src/memory.ts +102 -0
- package/src/nativeActions.ts +422 -0
- package/src/nativeComponentSupport.ts +60 -0
- package/src/networkPerformance.ts +30 -0
- package/src/performance.ts +137 -0
- package/src/performanceMonitor.ts +219 -0
- package/src/permissions.ts +403 -0
- package/src/rendering.ts +47 -0
- package/src/security.ts +19 -0
- package/src/state.ts +333 -0
- package/src/storage.ts +453 -0
- package/src/theme.tsx +467 -0
- package/src/types.ts +946 -0
- package/src/utils.ts +177 -0
- package/src/validation.ts +372 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale-aware formatting for the media-library shell.
|
|
3
|
+
*
|
|
4
|
+
* Every date, time, size, duration and dimension the shell renders flows through here so the
|
|
5
|
+
* output follows the host's active language instead of a hardcoded `en-GB`/`en-US`. Numbers use
|
|
6
|
+
* the locale's own numbering system (so Arabic/Persian get their digits), size units come from the
|
|
7
|
+
* host-overridable `fileSizeBytes/Kb/Mb/Gb` keys, and dates/times use the locale's month names and
|
|
8
|
+
* 12/24-hour convention.
|
|
9
|
+
*
|
|
10
|
+
* All calls are defensive: a malformed host locale that makes `Intl` throw falls back to the
|
|
11
|
+
* runtime default rather than crashing a preview.
|
|
12
|
+
*/
|
|
13
|
+
import type { CameraTranslationKey } from '../localization';
|
|
14
|
+
|
|
15
|
+
/** The shape of the `t` returned by `useCameraLocalization()`. */
|
|
16
|
+
type Translate = (
|
|
17
|
+
key: CameraTranslationKey,
|
|
18
|
+
...args: Array<string | number | boolean | null | undefined>
|
|
19
|
+
) => string;
|
|
20
|
+
|
|
21
|
+
/** An empty locale ('' = host set none) becomes `undefined` so `Intl` picks the runtime default. */
|
|
22
|
+
function loc(locale?: string): string | undefined {
|
|
23
|
+
return locale && locale.length > 0 ? locale : undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Per-locale Western→local digit map. `null` means the locale already uses Latin digits (no remap).
|
|
27
|
+
const digitMaps = new Map<string, Record<string, string> | null>();
|
|
28
|
+
|
|
29
|
+
/** Rewrite the ASCII digits in `text` into the locale's numbering system (no-op for Latin locales). */
|
|
30
|
+
export function localizeDigits(text: string, locale?: string): string {
|
|
31
|
+
const l = loc(locale);
|
|
32
|
+
if (!l) return text;
|
|
33
|
+
let map = digitMaps.get(l);
|
|
34
|
+
if (map === undefined) {
|
|
35
|
+
map = null;
|
|
36
|
+
try {
|
|
37
|
+
const fmt = new Intl.NumberFormat(l, { useGrouping: false });
|
|
38
|
+
const built: Record<string, string> = {};
|
|
39
|
+
let identity = true;
|
|
40
|
+
for (let d = 0; d <= 9; d += 1) {
|
|
41
|
+
const glyph = fmt.format(d);
|
|
42
|
+
built[String(d)] = glyph;
|
|
43
|
+
if (glyph !== String(d)) identity = false;
|
|
44
|
+
}
|
|
45
|
+
map = identity ? null : built;
|
|
46
|
+
} catch {
|
|
47
|
+
map = null;
|
|
48
|
+
}
|
|
49
|
+
digitMaps.set(l, map);
|
|
50
|
+
}
|
|
51
|
+
if (!map) return text;
|
|
52
|
+
const table = map;
|
|
53
|
+
return text.replace(/[0-9]/g, (ch) => table[ch] ?? ch);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Format a plain number in the locale's numbering system, without grouping separators. */
|
|
57
|
+
export function localizeNumber(value: number, locale?: string): string {
|
|
58
|
+
try {
|
|
59
|
+
return new Intl.NumberFormat(loc(locale), { useGrouping: false }).format(value);
|
|
60
|
+
} catch {
|
|
61
|
+
return String(value);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** The size units, smallest first. Host-overridable, which is why they are translation keys. */
|
|
66
|
+
const FILE_SIZE_UNIT_KEYS: CameraTranslationKey[] = [
|
|
67
|
+
'fileSizeBytes',
|
|
68
|
+
'fileSizeKb',
|
|
69
|
+
'fileSizeMb',
|
|
70
|
+
'fileSizeGb',
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The unit rung `bytes` is quoted at and the value rounded for that rung — the half of the size
|
|
75
|
+
* formatting that has nothing to do with language, shared so a single size and a size RANGE can
|
|
76
|
+
* never round or scale the same byte count differently.
|
|
77
|
+
*/
|
|
78
|
+
function scaleFileSize(bytes: number): { unit: number; rounded: number } {
|
|
79
|
+
let value = bytes;
|
|
80
|
+
let unit = 0;
|
|
81
|
+
while (value >= 1024 && unit < FILE_SIZE_UNIT_KEYS.length - 1) {
|
|
82
|
+
value /= 1024;
|
|
83
|
+
unit += 1;
|
|
84
|
+
}
|
|
85
|
+
const rounded =
|
|
86
|
+
value >= 10 || unit === 0 ? Math.round(value) : Math.round(value * 10) / 10;
|
|
87
|
+
return { unit, rounded };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** `1.5 MB` style, with the unit drawn from the host-overridable size keys. Null when unknown. */
|
|
91
|
+
export function formatFileSize(
|
|
92
|
+
bytes: number | undefined | null,
|
|
93
|
+
locale: string | undefined,
|
|
94
|
+
t: Translate
|
|
95
|
+
): string | null {
|
|
96
|
+
if (bytes === undefined || bytes === null || bytes <= 0) return null;
|
|
97
|
+
const { unit, rounded } = scaleFileSize(bytes);
|
|
98
|
+
return t(FILE_SIZE_UNIT_KEYS[unit]!, localizeNumber(rounded, locale));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* A low–high size span as ONE string (`5.8 – 7.1 MB`), for a figure that is honestly a band rather
|
|
103
|
+
* than a single number — a video re-encoded at a TARGET bit rate, which the encoder spends around
|
|
104
|
+
* instead of hitting exactly.
|
|
105
|
+
*
|
|
106
|
+
* The low end drops its unit whenever both ends land on the same rung, which is what the
|
|
107
|
+
* `compressSizeRange` key documents and what its translations are written against; that decision is
|
|
108
|
+
* made HERE, from the rung itself, rather than by trying to strip a unit back out of an already
|
|
109
|
+
* translated string. Ends on different rungs are both formatted in full (`900 KB – 1.1 MB`).
|
|
110
|
+
*
|
|
111
|
+
* Collapses to the single high figure when the band has no width left to show — the low end is
|
|
112
|
+
* missing, at or above the high end, or rounds to the very same number on the very same rung — so a
|
|
113
|
+
* row never reads `7.1 – 7.1 MB`. Null when nothing is known.
|
|
114
|
+
*/
|
|
115
|
+
export function formatFileSizeRange(
|
|
116
|
+
low: number | undefined | null,
|
|
117
|
+
high: number | undefined | null,
|
|
118
|
+
locale: string | undefined,
|
|
119
|
+
t: Translate
|
|
120
|
+
): string | null {
|
|
121
|
+
const highText = formatFileSize(high, locale, t);
|
|
122
|
+
if (!highText) return formatFileSize(low, locale, t);
|
|
123
|
+
const lowText = formatFileSize(low, locale, t);
|
|
124
|
+
if (!lowText || !low || !high || low >= high) return highText;
|
|
125
|
+
|
|
126
|
+
const lowScale = scaleFileSize(low);
|
|
127
|
+
const highScale = scaleFileSize(high);
|
|
128
|
+
if (lowScale.unit === highScale.unit) {
|
|
129
|
+
if (lowScale.rounded === highScale.rounded) return highText;
|
|
130
|
+
return t(
|
|
131
|
+
'compressSizeRange',
|
|
132
|
+
localizeNumber(lowScale.rounded, locale),
|
|
133
|
+
highText
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
return t('compressSizeRange', lowText, highText);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Localized calendar date. `month` picks the short ("Aug") or long ("August") form. Null when unknown. */
|
|
140
|
+
export function formatMediaDate(
|
|
141
|
+
timestamp: number | undefined | null,
|
|
142
|
+
locale: string | undefined,
|
|
143
|
+
month: 'short' | 'long' = 'short'
|
|
144
|
+
): string | null {
|
|
145
|
+
if (timestamp === undefined || timestamp === null) return null;
|
|
146
|
+
const date = new Date(timestamp);
|
|
147
|
+
if (Number.isNaN(date.getTime())) return null;
|
|
148
|
+
const options: Intl.DateTimeFormatOptions = {
|
|
149
|
+
day: '2-digit',
|
|
150
|
+
month,
|
|
151
|
+
year: 'numeric',
|
|
152
|
+
};
|
|
153
|
+
try {
|
|
154
|
+
return date.toLocaleDateString(loc(locale), options);
|
|
155
|
+
} catch {
|
|
156
|
+
return date.toLocaleDateString(undefined, options);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Localized wall-clock time; the locale decides 12- vs 24-hour. Null when unknown. */
|
|
161
|
+
export function formatMediaTime(
|
|
162
|
+
timestamp: number | undefined | null,
|
|
163
|
+
locale: string | undefined
|
|
164
|
+
): string | null {
|
|
165
|
+
if (timestamp === undefined || timestamp === null) return null;
|
|
166
|
+
const date = new Date(timestamp);
|
|
167
|
+
if (Number.isNaN(date.getTime())) return null;
|
|
168
|
+
const options: Intl.DateTimeFormatOptions = { hour: 'numeric', minute: '2-digit' };
|
|
169
|
+
try {
|
|
170
|
+
return date.toLocaleTimeString(loc(locale), options);
|
|
171
|
+
} catch {
|
|
172
|
+
return date.toLocaleTimeString(undefined, options);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* `m:ss` / `h:mm:ss` clip length with locale digits. `value` may be seconds or milliseconds
|
|
178
|
+
* (MediaStore's DURATION column) — the same >1000 normalization the rest of the shell uses.
|
|
179
|
+
*/
|
|
180
|
+
export function formatMediaDuration(
|
|
181
|
+
value: number | undefined | null,
|
|
182
|
+
locale: string | undefined
|
|
183
|
+
): string | null {
|
|
184
|
+
if (value === undefined || value === null || value <= 0) return null;
|
|
185
|
+
const seconds = value > 1000 ? Math.floor(value / 1000) : Math.floor(value);
|
|
186
|
+
if (seconds <= 0) return null;
|
|
187
|
+
const h = Math.floor(seconds / 3600);
|
|
188
|
+
const m = Math.floor((seconds % 3600) / 60);
|
|
189
|
+
const s = seconds % 60;
|
|
190
|
+
const base =
|
|
191
|
+
h > 0
|
|
192
|
+
? `${h}:${String(m).padStart(2, '0')}:${String(s).padStart(2, '0')}`
|
|
193
|
+
: `${m}:${String(s).padStart(2, '0')}`;
|
|
194
|
+
return localizeDigits(base, locale);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** `1920 × 1080` with locale digits. Null when either side is unknown. */
|
|
198
|
+
export function formatDimensions(
|
|
199
|
+
width: number | undefined | null,
|
|
200
|
+
height: number | undefined | null,
|
|
201
|
+
locale: string | undefined
|
|
202
|
+
): string | null {
|
|
203
|
+
if (!width || !height || width <= 0 || height <= 0) return null;
|
|
204
|
+
const w = localizeDigits(String(Math.round(width)), locale);
|
|
205
|
+
const h = localizeDigits(String(Math.round(height)), locale);
|
|
206
|
+
return `${w} × ${h}`;
|
|
207
|
+
}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* palette — the ONE source of color tokens for the media library shell,
|
|
3
|
+
* mirroring what responsive.ts does for scaling. Every screen and component
|
|
4
|
+
* derives its colors from here, so the whole shell re-themes from this single
|
|
5
|
+
* file — statically (`libraryPalette`) or live (`useLibraryPalette()`).
|
|
6
|
+
*
|
|
7
|
+
* ── Light / Dark ────────────────────────────────────────────────────────────
|
|
8
|
+
* The shell ships BOTH a dark and a light token set and picks between them from
|
|
9
|
+
* the active plugin theme, so a host that flips `configureCameraPlugin({ theme:
|
|
10
|
+
* 'light' })` (or pushes a light palette) re-colours the entire JS shell with no
|
|
11
|
+
* restart. Selection is by the luminance of the theme's `background`: a dark
|
|
12
|
+
* background → the dark set, a light one → the light set. The DARK set is
|
|
13
|
+
* byte-for-byte the shell's original shipped palette, so every existing (dark)
|
|
14
|
+
* install renders pixel-identical; the LIGHT set is the new day-mode design.
|
|
15
|
+
*
|
|
16
|
+
* Three token families deliberately DON'T flip, because they are not painted on
|
|
17
|
+
* the browsing surface:
|
|
18
|
+
* • `white` / `black` / shadows and the `whiteA*` / `scrim*` overlays — they
|
|
19
|
+
* sit on ACCENT buttons, on the dark media-viewer chrome, or directly over
|
|
20
|
+
* the user's photos/videos, where they must stay high-contrast in either
|
|
21
|
+
* mode.
|
|
22
|
+
* • the `chrome*` surfaces — the full-screen viewer, editor and bottom sheets
|
|
23
|
+
* keep a dark backdrop in both themes (the Google/Apple Photos convention
|
|
24
|
+
* for a full-screen media viewer).
|
|
25
|
+
* • the brand `accent*` shades — legible on either background.
|
|
26
|
+
* Everything that IS the browsing surface — grid/list backgrounds, cards, tiles,
|
|
27
|
+
* category pills, the record screen, document/audio preview cards, and all text
|
|
28
|
+
* and hairlines drawn on them — flips.
|
|
29
|
+
*
|
|
30
|
+
* Tokens that overlap the plugin's own theme (`primary`, `textMuted`, `success`,
|
|
31
|
+
* `error`, `surfaceMuted`) are always taken straight from the active theme so
|
|
32
|
+
* the JS chrome and the native camera screens stay on one palette.
|
|
33
|
+
*/
|
|
34
|
+
import { useEffect, useState } from 'react';
|
|
35
|
+
import {
|
|
36
|
+
DEFAULT_CAMERA_THEME_CONFIG,
|
|
37
|
+
getCurrentCameraTheme,
|
|
38
|
+
subscribeToCameraTheme,
|
|
39
|
+
} from '../theme';
|
|
40
|
+
import type { CameraThemeConfig } from '../types';
|
|
41
|
+
|
|
42
|
+
type ThemeColors = CameraThemeConfig['colors'];
|
|
43
|
+
const base = DEFAULT_CAMERA_THEME_CONFIG.colors;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Relative luminance (0 = black … 1 = white) of a `#rgb`/`#rrggbb` color, used
|
|
47
|
+
* only to decide dark-vs-light. rgba()/rgb() and unparseable values fall back to
|
|
48
|
+
* "dark" so an unknown theme keeps the original shipped (dark) shell.
|
|
49
|
+
*/
|
|
50
|
+
const luminance = (color: string): number => {
|
|
51
|
+
const hex = color.trim().replace(/^#/, '');
|
|
52
|
+
const expand =
|
|
53
|
+
hex.length === 3 ? hex.split('').map((c) => c + c).join('') : hex;
|
|
54
|
+
if (expand.length < 6 || /[^0-9a-fA-F]/.test(expand.slice(0, 6))) return 0;
|
|
55
|
+
const r = parseInt(expand.slice(0, 2), 16) / 255;
|
|
56
|
+
const g = parseInt(expand.slice(2, 4), 16) / 255;
|
|
57
|
+
const b = parseInt(expand.slice(4, 6), 16) / 255;
|
|
58
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/** Whether the active theme reads as dark (drives which shell token set is used). */
|
|
62
|
+
export const isDarkTheme = (colors: ThemeColors = base): boolean =>
|
|
63
|
+
luminance(colors.background) < 0.5;
|
|
64
|
+
|
|
65
|
+
// ── Shared tokens (identical in both themes) ─────────────────────────────────
|
|
66
|
+
// Painted on accents, on the dark media viewer, or directly over user media, so
|
|
67
|
+
// they must stay high-contrast regardless of the browsing theme.
|
|
68
|
+
const SHARED = {
|
|
69
|
+
// Core neutrals / shadows.
|
|
70
|
+
white: '#FFFFFF',
|
|
71
|
+
black: '#000000',
|
|
72
|
+
blackShort: '#000',
|
|
73
|
+
inkDark: '#111',
|
|
74
|
+
ink: '#333',
|
|
75
|
+
grayMid: '#666',
|
|
76
|
+
|
|
77
|
+
// Dark media-viewer / editor / bottom-sheet chrome (dark in both themes).
|
|
78
|
+
chromeDark: '#1E1E1E',
|
|
79
|
+
chromeGray: '#2D2D2D',
|
|
80
|
+
chromeSystem: '#2C2C2E',
|
|
81
|
+
chromeSystemAlt: '#3A3A3C',
|
|
82
|
+
// The full-screen media viewer's near-black backdrop. Fixed in both themes so
|
|
83
|
+
// photos/videos always read against a neutral dark canvas (the Google/Apple
|
|
84
|
+
// Photos convention) — value = the dark theme's `appBackgroundDeepest`, so the
|
|
85
|
+
// dark shell is byte-identical while the light shell keeps a dark viewer.
|
|
86
|
+
viewerBackdrop: '#050715',
|
|
87
|
+
// Text drawn ON the dark chrome (viewer counter, compression menu, metadata
|
|
88
|
+
// sheet). These must stay light in BOTH themes — the flipping text tokens would
|
|
89
|
+
// turn dark-on-dark in light mode — so they live in SHARED, not ShellSurfaces.
|
|
90
|
+
chromeText: '#F1F5F9',
|
|
91
|
+
chromeTextMuted: '#A0A9C9',
|
|
92
|
+
|
|
93
|
+
// Brand accents (legible on either background).
|
|
94
|
+
accentGreen: '#4CAF50',
|
|
95
|
+
accentGreenDark: '#388E3C',
|
|
96
|
+
accentMint: '#3DD9A4',
|
|
97
|
+
accentTeal: '#1E81A5',
|
|
98
|
+
accentBlue: '#007AFF',
|
|
99
|
+
accentSky: '#6C9AFF',
|
|
100
|
+
accentIndigo: '#6070FF',
|
|
101
|
+
accentIndigoDeep: '#3A46E0',
|
|
102
|
+
accentPeriwinkle: '#C7D2FE',
|
|
103
|
+
accentViolet: '#8F86FF',
|
|
104
|
+
accentLavender: '#B79CFF',
|
|
105
|
+
accentPurple: '#5856D6',
|
|
106
|
+
accentPurpleMuted: '#5F58A8',
|
|
107
|
+
accentOrange: '#FF9500',
|
|
108
|
+
accentAmber: '#FFB454',
|
|
109
|
+
accentRose: '#FF7A85',
|
|
110
|
+
accentSalmon: '#FCA5A5',
|
|
111
|
+
|
|
112
|
+
// Overlays over media / dark chrome (white-alpha), black scrims, dark sheets.
|
|
113
|
+
whiteA12: 'rgba(255, 255, 255, 0.12)',
|
|
114
|
+
whiteA15: 'rgba(255, 255, 255, 0.15)',
|
|
115
|
+
whiteA20: 'rgba(255, 255, 255, 0.2)',
|
|
116
|
+
whiteA25: 'rgba(255, 255, 255, 0.25)',
|
|
117
|
+
whiteA30: 'rgba(255, 255, 255, 0.3)',
|
|
118
|
+
whiteA35: 'rgba(255, 255, 255, 0.35)',
|
|
119
|
+
whiteA40: 'rgba(255, 255, 255, 0.4)',
|
|
120
|
+
whiteA90: 'rgba(255,255,255,0.9)',
|
|
121
|
+
rippleStrong: 'rgba(255, 255, 255, 0.25)',
|
|
122
|
+
rippleMedium: 'rgba(255, 255, 255, 0.18)',
|
|
123
|
+
scrimA22: 'rgba(0,0,0,0.22)',
|
|
124
|
+
scrimA30: 'rgba(0, 0, 0, 0.3)',
|
|
125
|
+
scrimA55: 'rgba(0, 0, 0, 0.55)',
|
|
126
|
+
scrimA55Tight: 'rgba(0,0,0,0.55)',
|
|
127
|
+
scrimA60: 'rgba(0, 0, 0, 0.6)',
|
|
128
|
+
scrimA70: 'rgba(0, 0, 0, 0.7)',
|
|
129
|
+
sheet85: 'rgba(20, 20, 22, 0.85)',
|
|
130
|
+
sheet95: 'rgba(20, 20, 22, 0.95)',
|
|
131
|
+
greenTintA10: 'rgba(76, 175, 80, 0.1)',
|
|
132
|
+
greenTintA18: 'rgba(76, 175, 80, 0.18)',
|
|
133
|
+
greenTintA28: 'rgba(76, 175, 80, 0.28)',
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// ── Browsing surfaces + text + hairlines (these flip with the theme) ─────────
|
|
137
|
+
// Same keys in both maps (the ShellSurfaces shape enforces parity); the dark map
|
|
138
|
+
// is the shell's original shipped values, so the dark theme is pixel-identical.
|
|
139
|
+
interface ShellSurfaces {
|
|
140
|
+
appBackground: string;
|
|
141
|
+
appBackgroundDeep: string;
|
|
142
|
+
appBackgroundDeepest: string;
|
|
143
|
+
surface: string;
|
|
144
|
+
surfaceRaised: string;
|
|
145
|
+
surfaceCard: string;
|
|
146
|
+
surfaceIndigo: string;
|
|
147
|
+
surfaceViolet: string;
|
|
148
|
+
surfacePlum: string;
|
|
149
|
+
surfaceNavy: string;
|
|
150
|
+
surfaceGreenTint: string;
|
|
151
|
+
surfaceAmberTint: string;
|
|
152
|
+
surfaceRoseTint: string;
|
|
153
|
+
textBright: string;
|
|
154
|
+
textSoft: string;
|
|
155
|
+
textPale: string;
|
|
156
|
+
textSystem: string;
|
|
157
|
+
textFaded: string;
|
|
158
|
+
textDim: string;
|
|
159
|
+
textSlate: string;
|
|
160
|
+
textSteel: string;
|
|
161
|
+
textGray: string;
|
|
162
|
+
textCharcoal: string;
|
|
163
|
+
navInactive: string;
|
|
164
|
+
hairline: string;
|
|
165
|
+
hairlineFaint: string;
|
|
166
|
+
hairlineFainter: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const DARK_SURFACES: ShellSurfaces = {
|
|
170
|
+
appBackground: '#0B0D1F',
|
|
171
|
+
appBackgroundDeep: '#0A0D1C',
|
|
172
|
+
appBackgroundDeepest: '#050715',
|
|
173
|
+
surface: '#141A32',
|
|
174
|
+
surfaceRaised: '#1B2247',
|
|
175
|
+
surfaceCard: '#191A23',
|
|
176
|
+
surfaceIndigo: '#1F2243',
|
|
177
|
+
surfaceViolet: '#221D42',
|
|
178
|
+
surfacePlum: '#2A2040',
|
|
179
|
+
surfaceNavy: '#182450',
|
|
180
|
+
surfaceGreenTint: '#12322B',
|
|
181
|
+
surfaceAmberTint: '#33260F',
|
|
182
|
+
surfaceRoseTint: '#33202A',
|
|
183
|
+
textBright: '#F1F5F9',
|
|
184
|
+
textSoft: '#E2E8F0',
|
|
185
|
+
textPale: '#E2E2E2',
|
|
186
|
+
textSystem: '#E5E5EA',
|
|
187
|
+
textFaded: '#A0A9C9',
|
|
188
|
+
textDim: '#5A6178',
|
|
189
|
+
textSlate: '#64748B',
|
|
190
|
+
textSteel: '#8A93B5',
|
|
191
|
+
textGray: '#A0A0A0',
|
|
192
|
+
textCharcoal: '#4B5563',
|
|
193
|
+
navInactive: '#666872',
|
|
194
|
+
hairline: 'rgba(255,255,255,0.08)',
|
|
195
|
+
hairlineFaint: 'rgba(255,255,255,0.07)',
|
|
196
|
+
hairlineFainter: 'rgba(255,255,255,0.06)',
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
// Day-mode surfaces: clean white cards on an off-white grid, slate-family text,
|
|
200
|
+
// black-alpha hairlines. Tints mirror the file-type badge families in light.
|
|
201
|
+
const LIGHT_SURFACES: ShellSurfaces = {
|
|
202
|
+
appBackground: '#F5F6FA',
|
|
203
|
+
appBackgroundDeep: '#EDEFF6',
|
|
204
|
+
appBackgroundDeepest: '#E3E7F1',
|
|
205
|
+
surface: '#FFFFFF',
|
|
206
|
+
surfaceRaised: '#FFFFFF',
|
|
207
|
+
surfaceCard: '#FFFFFF',
|
|
208
|
+
surfaceIndigo: '#EEF1FF',
|
|
209
|
+
surfaceViolet: '#F3EEFF',
|
|
210
|
+
surfacePlum: '#F5EEFF',
|
|
211
|
+
surfaceNavy: '#E9EEFF',
|
|
212
|
+
surfaceGreenTint: '#E3F5EE',
|
|
213
|
+
surfaceAmberTint: '#FBF0DD',
|
|
214
|
+
surfaceRoseTint: '#FCE7EC',
|
|
215
|
+
textBright: '#0F172A',
|
|
216
|
+
textSoft: '#1E293B',
|
|
217
|
+
textPale: '#334155',
|
|
218
|
+
textSystem: '#1C1C1E',
|
|
219
|
+
textFaded: '#5A6274',
|
|
220
|
+
textDim: '#8A93A6',
|
|
221
|
+
textSlate: '#64748B',
|
|
222
|
+
textSteel: '#5B647F',
|
|
223
|
+
textGray: '#6B7280',
|
|
224
|
+
textCharcoal: '#4B5563',
|
|
225
|
+
navInactive: '#9AA0AE',
|
|
226
|
+
hairline: 'rgba(0,0,0,0.08)',
|
|
227
|
+
hairlineFaint: 'rgba(0,0,0,0.06)',
|
|
228
|
+
hairlineFainter: 'rgba(0,0,0,0.05)',
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
/** Build the shell palette from a plugin theme; the dark set = today's exact UI. */
|
|
232
|
+
export const createPalette = (colors: ThemeColors = base) => {
|
|
233
|
+
const dark = isDarkTheme(colors);
|
|
234
|
+
return {
|
|
235
|
+
// ── Plugin-linked tokens (always from the active theme) ──────────
|
|
236
|
+
primary: colors.primary,
|
|
237
|
+
textMuted: colors.textMuted,
|
|
238
|
+
success: colors.success,
|
|
239
|
+
error: colors.error,
|
|
240
|
+
// Inactive counterpart of `primary` for meter/waveform bars.
|
|
241
|
+
surfaceMuted: colors.surfaceMuted,
|
|
242
|
+
|
|
243
|
+
// ── Shared (non-flipping) tokens ────────────────────────────────
|
|
244
|
+
...SHARED,
|
|
245
|
+
|
|
246
|
+
// ── Browsing surfaces / text / hairlines (flip with the theme) ──
|
|
247
|
+
...(dark ? DARK_SURFACES : LIGHT_SURFACES),
|
|
248
|
+
|
|
249
|
+
/** True when the active theme is dark — lets a component branch layout/logic. */
|
|
250
|
+
isDark: dark,
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export type LibraryPalette = ReturnType<typeof createPalette>;
|
|
255
|
+
|
|
256
|
+
/** Launch-time palette snapshot — used by static StyleSheet.create() styles. */
|
|
257
|
+
export const libraryPalette: LibraryPalette = createPalette(
|
|
258
|
+
getCurrentCameraTheme().colors
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Live palette hook: re-derives the whole shell palette whenever the global
|
|
263
|
+
* camera theme changes. Use in components that must react to runtime
|
|
264
|
+
* re-theming (i.e. the persistent library shell); static one-shot styles can
|
|
265
|
+
* keep the launch-time `libraryPalette`.
|
|
266
|
+
*/
|
|
267
|
+
export function useLibraryPalette(): LibraryPalette {
|
|
268
|
+
const [current, setCurrent] = useState<LibraryPalette>(() =>
|
|
269
|
+
createPalette(getCurrentCameraTheme().colors)
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
useEffect(
|
|
273
|
+
() =>
|
|
274
|
+
subscribeToCameraTheme((theme) =>
|
|
275
|
+
setCurrent(createPalette(theme.colors))
|
|
276
|
+
),
|
|
277
|
+
[]
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
return current;
|
|
281
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* responsive — the ONE source of scaling math for the media library shell.
|
|
3
|
+
*
|
|
4
|
+
* Every screen and component (MediaLibraryScreen, ExpandableFab, FileTiles,
|
|
5
|
+
* Document/Audio previews) imports these helpers instead of re-deriving them
|
|
6
|
+
* from Dimensions.get('window') locally, so chrome scales identically
|
|
7
|
+
* everywhere and there is a single place to reason about device size.
|
|
8
|
+
*
|
|
9
|
+
* Portrait-normalized: the SHORTER window edge is width, the longer is height.
|
|
10
|
+
* Module-level Dimensions.get is a launch-time snapshot — without
|
|
11
|
+
* normalization, an app launched in landscape would compute scaleW from the
|
|
12
|
+
* ~844px edge and permanently inflate every padding, radius and font. Layout
|
|
13
|
+
* that must track live rotation (pager page widths, viewer slides) uses
|
|
14
|
+
* useWindowDimensions at render time instead; these helpers size CHROME
|
|
15
|
+
* (paddings, fonts, icons), which should stay constant across rotation.
|
|
16
|
+
*/
|
|
17
|
+
import { Dimensions, PixelRatio } from 'react-native';
|
|
18
|
+
|
|
19
|
+
const { width: WIN_W, height: WIN_H } = Dimensions.get('window');
|
|
20
|
+
|
|
21
|
+
/** Portrait-normalized window edges (launch-time snapshot). */
|
|
22
|
+
export const SCREEN_W = Math.min(WIN_W, WIN_H);
|
|
23
|
+
export const SCREEN_H = Math.max(WIN_W, WIN_H);
|
|
24
|
+
|
|
25
|
+
/** Design base — standard iPhone / mid-range Android portrait canvas. */
|
|
26
|
+
export const BASE_W = 390;
|
|
27
|
+
export const BASE_H = 844;
|
|
28
|
+
|
|
29
|
+
// Clamped: tablets get moderately larger chrome, not 2× paddings; tiny phones
|
|
30
|
+
// never shrink touch targets below ~85% of design size.
|
|
31
|
+
const scaleW = Math.min(Math.max(SCREEN_W / BASE_W, 0.85), 1.35);
|
|
32
|
+
const scaleH = Math.min(Math.max(SCREEN_H / BASE_H, 0.85), 1.35);
|
|
33
|
+
const fontScale = PixelRatio.getFontScale();
|
|
34
|
+
|
|
35
|
+
/** Width-proportional scaling. */
|
|
36
|
+
export const wp = (size: number) => Math.round(size * scaleW);
|
|
37
|
+
|
|
38
|
+
/** Height-proportional scaling. */
|
|
39
|
+
export const hp = (size: number) => Math.round(size * scaleH);
|
|
40
|
+
|
|
41
|
+
/** Moderate scale — averages width scale with 1:1 for balanced sizing. */
|
|
42
|
+
export const ms = (size: number, factor = 0.5) =>
|
|
43
|
+
Math.round(size + (scaleW - 1) * size * factor);
|
|
44
|
+
|
|
45
|
+
/** Font scaling — clamped, and neutralizes the system font-size setting. */
|
|
46
|
+
export const fs = (size: number) => {
|
|
47
|
+
const scaled = Math.round(size * Math.min(scaleW, 1.35));
|
|
48
|
+
return Math.round(scaled / fontScale);
|
|
49
|
+
};
|