@umituz/react-native-ai-generation-content 1.26.2 → 1.26.4
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/package.json +3 -2
- package/src/domains/generation/application/feature-registry.ts +101 -0
- package/src/domains/generation/application/generation-strategy.factory.ts +128 -0
- package/src/domains/generation/domain/feature-config.types.ts +61 -0
- package/src/domains/generation/domain/generation.types.ts +74 -0
- package/src/domains/generation/index.ts +37 -0
- package/src/domains/generation/presentation/useAIGeneration.hook.ts +106 -0
- package/src/domains/wizard/infrastructure/strategies/wizard-strategy.factory.ts +3 -4
- package/src/index.ts +1 -25
- package/src/infrastructure/executors/executor-factory.ts +53 -0
- package/src/infrastructure/executors/image-executor.ts +133 -0
- package/src/infrastructure/executors/video-executor.ts +130 -0
- package/src/features/ai-hug/README.md +0 -438
- package/src/features/ai-hug/domain/index.ts +0 -5
- package/src/features/ai-hug/domain/types/ai-hug.types.ts +0 -25
- package/src/features/ai-hug/domain/types/index.ts +0 -7
- package/src/features/ai-hug/index.ts +0 -19
- package/src/features/ai-hug/presentation/components/AIHugFeature.tsx +0 -77
- package/src/features/ai-hug/presentation/components/index.ts +0 -2
- package/src/features/ai-hug/presentation/hooks/index.ts +0 -9
- package/src/features/ai-hug/presentation/hooks/useAIHugFeature.ts +0 -34
- package/src/features/ai-hug/presentation/index.ts +0 -6
- package/src/features/ai-kiss/README.md +0 -445
- package/src/features/ai-kiss/domain/index.ts +0 -5
- package/src/features/ai-kiss/domain/types/ai-kiss.types.ts +0 -25
- package/src/features/ai-kiss/domain/types/index.ts +0 -7
- package/src/features/ai-kiss/index.ts +0 -19
- package/src/features/ai-kiss/presentation/components/AIKissFeature.tsx +0 -77
- package/src/features/ai-kiss/presentation/components/index.ts +0 -2
- package/src/features/ai-kiss/presentation/hooks/index.ts +0 -9
- package/src/features/ai-kiss/presentation/hooks/useAIKissFeature.ts +0 -34
- package/src/features/ai-kiss/presentation/index.ts +0 -6
- package/src/features/anime-selfie/README.md +0 -396
- package/src/features/anime-selfie/domain/index.ts +0 -5
- package/src/features/anime-selfie/domain/types/anime-selfie.types.ts +0 -52
- package/src/features/anime-selfie/domain/types/index.ts +0 -8
- package/src/features/anime-selfie/index.ts +0 -20
- package/src/features/anime-selfie/presentation/components/AnimeSelfieFeature.tsx +0 -86
- package/src/features/anime-selfie/presentation/components/index.ts +0 -2
- package/src/features/anime-selfie/presentation/hooks/index.ts +0 -9
- package/src/features/anime-selfie/presentation/hooks/useAnimeSelfieFeature.ts +0 -59
- package/src/features/anime-selfie/presentation/index.ts +0 -6
- package/src/features/couple-future/README.md +0 -445
- package/src/features/couple-future/domain/types.ts +0 -63
- package/src/features/couple-future/domain/wizard-config.adapter.ts +0 -76
- package/src/features/couple-future/domain/wizard.types.ts +0 -121
- package/src/features/couple-future/index.ts +0 -83
- package/src/features/couple-future/infrastructure/coupleFeatureRegistry.ts +0 -76
- package/src/features/couple-future/infrastructure/couplePromptEnhancer.ts +0 -100
- package/src/features/couple-future/infrastructure/executor.ts +0 -188
- package/src/features/couple-future/infrastructure/generationUtils.ts +0 -228
- package/src/features/couple-future/presentation/components/ArtStyleSelector.tsx +0 -146
- package/src/features/couple-future/presentation/components/ArtistStyleSelector.tsx +0 -122
- package/src/features/couple-future/presentation/components/CoupleFutureWizard.tsx +0 -239
- package/src/features/couple-future/presentation/components/GeneratingStepContent.tsx +0 -86
- package/src/features/couple-future/presentation/components/RomanticMoodSelector.tsx +0 -147
- package/src/features/couple-future/presentation/components/WardrobeSelector.tsx +0 -141
- package/src/features/couple-future/presentation/components/index.ts +0 -12
- package/src/features/couple-future/presentation/hooks/useCoupleFutureFlow.ts +0 -166
- package/src/features/couple-future/presentation/hooks/useCoupleFutureFlow.types.ts +0 -69
- package/src/features/couple-future/presentation/hooks/useCoupleFutureHandlers.ts +0 -117
- package/src/features/couple-future/presentation/screens/CoupleFeatureScreen.tsx +0 -113
- package/src/features/face-swap/README.md +0 -431
- package/src/features/face-swap/domain/index.ts +0 -5
- package/src/features/face-swap/domain/types/face-swap.types.ts +0 -26
- package/src/features/face-swap/domain/types/index.ts +0 -7
- package/src/features/face-swap/index.ts +0 -19
- package/src/features/face-swap/presentation/components/FaceSwapFeature.tsx +0 -87
- package/src/features/face-swap/presentation/components/index.ts +0 -2
- package/src/features/face-swap/presentation/hooks/index.ts +0 -6
- package/src/features/face-swap/presentation/hooks/useFaceSwapFeature.ts +0 -35
- package/src/features/face-swap/presentation/index.ts +0 -6
- package/src/features/hd-touch-up/README.md +0 -396
- package/src/features/hd-touch-up/domain/index.ts +0 -1
- package/src/features/hd-touch-up/domain/types/hd-touch-up.types.ts +0 -62
- package/src/features/hd-touch-up/domain/types/index.ts +0 -9
- package/src/features/hd-touch-up/index.ts +0 -21
- package/src/features/hd-touch-up/presentation/components/HDTouchUpFeature.tsx +0 -86
- package/src/features/hd-touch-up/presentation/components/index.ts +0 -2
- package/src/features/hd-touch-up/presentation/hooks/index.ts +0 -1
- package/src/features/hd-touch-up/presentation/hooks/useHDTouchUpFeature.ts +0 -23
- package/src/features/hd-touch-up/presentation/index.ts +0 -2
- package/src/features/image-to-image/README.md +0 -459
- package/src/features/image-to-image/domain/index.ts +0 -1
- package/src/features/image-to-image/domain/types/base.types.ts +0 -48
- package/src/features/image-to-image/domain/types/index.ts +0 -1
- package/src/features/image-to-image/domain/types/partials/config.types.ts +0 -37
- package/src/features/image-to-image/domain/types/partials/hook.types.ts +0 -53
- package/src/features/image-to-image/domain/types/partials/metadata.types.ts +0 -32
- package/src/features/image-to-image/domain/types/partials/result.types.ts +0 -44
- package/src/features/image-to-image/domain/types/partials/state.types.ts +0 -34
- package/src/features/image-to-image/domain/types/partials/translation.types.ts +0 -57
- package/src/features/image-to-image/index.ts +0 -2
- package/src/features/image-to-image/presentation/hooks/index.ts +0 -3
- package/src/features/image-to-image/presentation/hooks/useDualImageFeature.ts +0 -204
- package/src/features/image-to-image/presentation/hooks/useImageWithPromptFeature.ts +0 -223
- package/src/features/image-to-image/presentation/hooks/useSingleImageFeature.ts +0 -166
- package/src/features/image-to-image/presentation/index.ts +0 -1
- package/src/features/image-to-video/README.md +0 -414
- package/src/features/image-to-video/domain/constants/animation.constants.ts +0 -47
- package/src/features/image-to-video/domain/constants/duration.constants.ts +0 -13
- package/src/features/image-to-video/domain/constants/form.constants.ts +0 -22
- package/src/features/image-to-video/domain/constants/index.ts +0 -23
- package/src/features/image-to-video/domain/constants/music.constants.ts +0 -53
- package/src/features/image-to-video/domain/index.ts +0 -5
- package/src/features/image-to-video/domain/types/animation.types.ts +0 -20
- package/src/features/image-to-video/domain/types/config.types.ts +0 -56
- package/src/features/image-to-video/domain/types/duration.types.ts +0 -11
- package/src/features/image-to-video/domain/types/form.types.ts +0 -35
- package/src/features/image-to-video/domain/types/image-to-video.types.ts +0 -122
- package/src/features/image-to-video/domain/types/index.ts +0 -39
- package/src/features/image-to-video/domain/types/music.types.ts +0 -21
- package/src/features/image-to-video/index.ts +0 -116
- package/src/features/image-to-video/infrastructure/index.ts +0 -1
- package/src/features/image-to-video/infrastructure/services/image-to-video-executor.ts +0 -154
- package/src/features/image-to-video/infrastructure/services/index.ts +0 -5
- package/src/features/image-to-video/presentation/components/AddMoreCard.tsx +0 -52
- package/src/features/image-to-video/presentation/components/AnimationStyleSelector.tsx +0 -135
- package/src/features/image-to-video/presentation/components/DurationSelector.tsx +0 -110
- package/src/features/image-to-video/presentation/components/EmptyGridState.tsx +0 -69
- package/src/features/image-to-video/presentation/components/GridImageItem.tsx +0 -64
- package/src/features/image-to-video/presentation/components/ImageSelectionGrid.styles.ts +0 -84
- package/src/features/image-to-video/presentation/components/ImageSelectionGrid.tsx +0 -77
- package/src/features/image-to-video/presentation/components/ImageSelectionGrid.types.ts +0 -18
- package/src/features/image-to-video/presentation/components/MusicMoodSelector.tsx +0 -181
- package/src/features/image-to-video/presentation/components/index.ts +0 -30
- package/src/features/image-to-video/presentation/hooks/index.ts +0 -27
- package/src/features/image-to-video/presentation/hooks/useFormState.ts +0 -116
- package/src/features/image-to-video/presentation/hooks/useGeneration.ts +0 -85
- package/src/features/image-to-video/presentation/hooks/useGenerationExecution.ts +0 -143
- package/src/features/image-to-video/presentation/hooks/useImageToVideoFeature.ts +0 -107
- package/src/features/image-to-video/presentation/hooks/useImageToVideoForm.ts +0 -119
- package/src/features/image-to-video/presentation/hooks/useImageToVideoValidation.ts +0 -46
- package/src/features/image-to-video/presentation/index.ts +0 -5
- package/src/features/love-message/domain/constants.ts +0 -162
- package/src/features/love-message/domain/types.ts +0 -58
- package/src/features/love-message/index.ts +0 -37
- package/src/features/love-message/infrastructure/persistence/PartnerProfileRepository.ts +0 -52
- package/src/features/love-message/infrastructure/prompts/messagePromptBuilder.ts +0 -109
- package/src/features/love-message/infrastructure/services/LoveMessageService.ts +0 -35
- package/src/features/love-message/presentation/components/CategoryGrid.tsx +0 -88
- package/src/features/love-message/presentation/components/DetailsInput.tsx +0 -74
- package/src/features/love-message/presentation/components/ExploreHeader.tsx +0 -67
- package/src/features/love-message/presentation/components/FieldInput.tsx +0 -83
- package/src/features/love-message/presentation/components/GeneratorHeader.tsx +0 -88
- package/src/features/love-message/presentation/components/LoveMessageHeroSection.tsx +0 -114
- package/src/features/love-message/presentation/components/MessageListItem.tsx +0 -77
- package/src/features/love-message/presentation/components/MessageResult.tsx +0 -105
- package/src/features/love-message/presentation/components/PartnerInput.tsx +0 -78
- package/src/features/love-message/presentation/components/ProgressDots.tsx +0 -48
- package/src/features/love-message/presentation/components/StepDetails.tsx +0 -23
- package/src/features/love-message/presentation/components/StepPartner.tsx +0 -116
- package/src/features/love-message/presentation/components/StepVibe.tsx +0 -30
- package/src/features/love-message/presentation/components/ToneSelector.tsx +0 -100
- package/src/features/love-message/presentation/components/TrendingSection.tsx +0 -130
- package/src/features/love-message/presentation/components/TypeSelector.tsx +0 -99
- package/src/features/love-message/presentation/hooks/useLoveMessageGenerator.ts +0 -114
- package/src/features/love-message/presentation/hooks/usePartnerProfile.ts +0 -43
- package/src/features/love-message/presentation/navigation/LoveMessageStack.tsx +0 -39
- package/src/features/love-message/presentation/screens/LoveMessageExploreScreen.tsx +0 -53
- package/src/features/love-message/presentation/screens/LoveMessageGeneratorScreen.tsx +0 -169
- package/src/features/love-message/presentation/screens/MessageListScreen.tsx +0 -127
- package/src/features/love-message/presentation/screens/PartnerProfileScreen.tsx +0 -119
- package/src/features/meme-generator/README.md +0 -408
- package/src/features/meme-generator/index.ts +0 -3
- package/src/features/meme-generator/infrastructure/services/MemeGenerationService.ts +0 -87
- package/src/features/meme-generator/presentation/components/MemeGeneratorFeature.tsx +0 -180
- package/src/features/meme-generator/presentation/components/index.ts +0 -2
- package/src/features/meme-generator/presentation/screens/MemeGeneratorScreen.tsx +0 -168
- package/src/features/meme-generator/presentation/screens/index.ts +0 -1
- package/src/features/partner-upload/domain/types.ts +0 -59
- package/src/features/partner-upload/index.ts +0 -30
- package/src/features/partner-upload/presentation/components/PartnerInfoInput.tsx +0 -112
- package/src/features/partner-upload/presentation/components/PhotoTips.tsx +0 -53
- package/src/features/partner-upload/presentation/components/index.ts +0 -4
- package/src/features/partner-upload/presentation/hooks/index.ts +0 -7
- package/src/features/partner-upload/presentation/hooks/usePartnerStep.ts +0 -130
- package/src/features/partner-upload/presentation/screens/PartnerStepScreen.tsx +0 -231
- package/src/features/partner-upload/presentation/screens/index.ts +0 -6
- package/src/features/photo-restoration/README.md +0 -399
- package/src/features/photo-restoration/domain/index.ts +0 -1
- package/src/features/photo-restoration/domain/types/index.ts +0 -9
- package/src/features/photo-restoration/domain/types/photo-restore.types.ts +0 -64
- package/src/features/photo-restoration/index.ts +0 -22
- package/src/features/photo-restoration/presentation/components/PhotoRestoreFeature.tsx +0 -88
- package/src/features/photo-restoration/presentation/components/PhotoRestoreResultView.tsx +0 -86
- package/src/features/photo-restoration/presentation/components/index.ts +0 -4
- package/src/features/photo-restoration/presentation/hooks/index.ts +0 -1
- package/src/features/photo-restoration/presentation/hooks/usePhotoRestoreFeature.ts +0 -23
- package/src/features/photo-restoration/presentation/index.ts +0 -2
- package/src/features/remove-background/README.md +0 -393
- package/src/features/remove-background/domain/index.ts +0 -5
- package/src/features/remove-background/domain/types/index.ts +0 -7
- package/src/features/remove-background/domain/types/remove-background.types.ts +0 -28
- package/src/features/remove-background/index.ts +0 -19
- package/src/features/remove-background/presentation/components/RemoveBackgroundFeature.tsx +0 -86
- package/src/features/remove-background/presentation/components/index.ts +0 -2
- package/src/features/remove-background/presentation/hooks/index.ts +0 -1
- package/src/features/remove-background/presentation/hooks/useRemoveBackgroundFeature.ts +0 -28
- package/src/features/remove-background/presentation/index.ts +0 -6
- package/src/features/remove-object/README.md +0 -405
- package/src/features/remove-object/domain/index.ts +0 -5
- package/src/features/remove-object/domain/types/index.ts +0 -7
- package/src/features/remove-object/domain/types/remove-object.types.ts +0 -54
- package/src/features/remove-object/index.ts +0 -23
- package/src/features/remove-object/presentation/components/RemoveObjectFeature.tsx +0 -136
- package/src/features/remove-object/presentation/components/index.ts +0 -2
- package/src/features/remove-object/presentation/hooks/index.ts +0 -9
- package/src/features/remove-object/presentation/hooks/useRemoveObjectFeature.ts +0 -221
- package/src/features/remove-object/presentation/index.ts +0 -6
- package/src/features/replace-background/README.md +0 -405
- package/src/features/replace-background/domain/types/index.ts +0 -7
- package/src/features/replace-background/domain/types/replace-background.types.ts +0 -33
- package/src/features/replace-background/index.ts +0 -23
- package/src/features/replace-background/presentation/components/ReplaceBackgroundFeature.tsx +0 -105
- package/src/features/replace-background/presentation/components/index.ts +0 -6
- package/src/features/replace-background/presentation/hooks/index.ts +0 -9
- package/src/features/replace-background/presentation/hooks/useReplaceBackgroundFeature.ts +0 -55
- package/src/features/scenarios/domain/types.ts +0 -147
- package/src/features/scenarios/index.ts +0 -64
- package/src/features/scenarios/presentation/components/InspirationChips.tsx +0 -82
- package/src/features/scenarios/presentation/components/MagicPromptHeadline.tsx +0 -79
- package/src/features/scenarios/presentation/components/ScenarioGrid.tsx +0 -224
- package/src/features/scenarios/presentation/components/ScenarioHeader.tsx +0 -55
- package/src/features/scenarios/presentation/components/StyleSelector.tsx +0 -119
- package/src/features/scenarios/presentation/components/index.ts +0 -18
- package/src/features/scenarios/presentation/containers/CategoryNavigationContainer.tsx +0 -178
- package/src/features/scenarios/presentation/screens/HierarchicalScenarioListScreen.tsx +0 -266
- package/src/features/scenarios/presentation/screens/MagicPromptScreen.tsx +0 -242
- package/src/features/scenarios/presentation/screens/MainCategoryScreen.tsx +0 -198
- package/src/features/scenarios/presentation/screens/ScenarioPreviewScreen.tsx +0 -164
- package/src/features/scenarios/presentation/screens/ScenarioSelectorScreen.tsx +0 -66
- package/src/features/scenarios/presentation/screens/SubCategoryScreen.tsx +0 -216
- package/src/features/script-generator/README.md +0 -433
- package/src/features/script-generator/domain/constants/index.ts +0 -10
- package/src/features/script-generator/domain/types/script.types.ts +0 -30
- package/src/features/script-generator/index.ts +0 -5
- package/src/features/script-generator/infrastructure/services/ScriptGenerationService.ts +0 -62
- package/src/features/script-generator/presentation/components/ScriptDisplay.tsx +0 -158
- package/src/features/script-generator/presentation/components/VideoTypeSelector.tsx +0 -102
- package/src/features/script-generator/presentation/components/index.ts +0 -2
- package/src/features/script-generator/presentation/hooks/index.ts +0 -1
- package/src/features/script-generator/presentation/hooks/useScriptGenerator.ts +0 -77
- package/src/features/shared/README.md +0 -311
- package/src/features/shared/dual-image-video/domain/types/dual-image-video.types.ts +0 -88
- package/src/features/shared/dual-image-video/domain/types/index.ts +0 -14
- package/src/features/shared/dual-image-video/index.ts +0 -17
- package/src/features/shared/dual-image-video/presentation/hooks/index.ts +0 -5
- package/src/features/shared/dual-image-video/presentation/hooks/useDualImageVideoFeature.ts +0 -185
- package/src/features/shared/index.ts +0 -6
- package/src/features/text-to-image/README.md +0 -394
- package/src/features/text-to-image/domain/constants/index.ts +0 -8
- package/src/features/text-to-image/domain/constants/options.constants.ts +0 -39
- package/src/features/text-to-image/domain/constants/styles.constants.ts +0 -34
- package/src/features/text-to-image/domain/index.ts +0 -7
- package/src/features/text-to-image/domain/types/config.types.ts +0 -75
- package/src/features/text-to-image/domain/types/form.types.ts +0 -58
- package/src/features/text-to-image/domain/types/index.ts +0 -38
- package/src/features/text-to-image/domain/types/text-to-image.types.ts +0 -58
- package/src/features/text-to-image/index.ts +0 -116
- package/src/features/text-to-image/infrastructure/index.ts +0 -1
- package/src/features/text-to-image/infrastructure/services/index.ts +0 -5
- package/src/features/text-to-image/infrastructure/services/text-to-image-executor.ts +0 -147
- package/src/features/text-to-image/presentation/components/index.ts +0 -30
- package/src/features/text-to-image/presentation/hooks/index.ts +0 -30
- package/src/features/text-to-image/presentation/hooks/useFormState.ts +0 -103
- package/src/features/text-to-image/presentation/hooks/useGeneration.ts +0 -139
- package/src/features/text-to-image/presentation/hooks/useTextToImageFeature.ts +0 -111
- package/src/features/text-to-image/presentation/hooks/useTextToImageForm.ts +0 -58
- package/src/features/text-to-image/presentation/index.ts +0 -7
- package/src/features/text-to-video/README.md +0 -412
- package/src/features/text-to-video/domain/index.ts +0 -1
- package/src/features/text-to-video/domain/types/callback.types.ts +0 -69
- package/src/features/text-to-video/domain/types/component.types.ts +0 -106
- package/src/features/text-to-video/domain/types/config.types.ts +0 -61
- package/src/features/text-to-video/domain/types/index.ts +0 -56
- package/src/features/text-to-video/domain/types/request.types.ts +0 -36
- package/src/features/text-to-video/domain/types/state.types.ts +0 -53
- package/src/features/text-to-video/index.ts +0 -68
- package/src/features/text-to-video/infrastructure/index.ts +0 -1
- package/src/features/text-to-video/infrastructure/services/index.ts +0 -5
- package/src/features/text-to-video/infrastructure/services/text-to-video-executor.ts +0 -141
- package/src/features/text-to-video/presentation/components/FrameSelector.tsx +0 -153
- package/src/features/text-to-video/presentation/components/GenerationTabs.tsx +0 -73
- package/src/features/text-to-video/presentation/components/HeroSection.tsx +0 -61
- package/src/features/text-to-video/presentation/components/HintCarousel.tsx +0 -96
- package/src/features/text-to-video/presentation/components/OptionsPanel.tsx +0 -121
- package/src/features/text-to-video/presentation/components/index.ts +0 -10
- package/src/features/text-to-video/presentation/hooks/index.ts +0 -17
- package/src/features/text-to-video/presentation/hooks/useTextToVideoFeature.ts +0 -225
- package/src/features/text-to-video/presentation/hooks/useTextToVideoForm.ts +0 -134
- package/src/features/text-to-video/presentation/index.ts +0 -7
- package/src/features/text-to-voice/README.md +0 -445
- package/src/features/text-to-voice/domain/index.ts +0 -1
- package/src/features/text-to-voice/domain/types/component.types.ts +0 -91
- package/src/features/text-to-voice/domain/types/config.types.ts +0 -34
- package/src/features/text-to-voice/domain/types/form.types.ts +0 -39
- package/src/features/text-to-voice/domain/types/generation.types.ts +0 -43
- package/src/features/text-to-voice/domain/types/index.ts +0 -38
- package/src/features/text-to-voice/index.ts +0 -53
- package/src/features/text-to-voice/infrastructure/index.ts +0 -1
- package/src/features/text-to-voice/infrastructure/services/index.ts +0 -4
- package/src/features/text-to-voice/infrastructure/services/text-to-voice-executor.ts +0 -103
- package/src/features/text-to-voice/presentation/components/TextToVoiceAudioPlayer.tsx +0 -81
- package/src/features/text-to-voice/presentation/components/index.ts +0 -7
- package/src/features/text-to-voice/presentation/hooks/index.ts +0 -6
- package/src/features/text-to-voice/presentation/hooks/useTextToVoiceForm.ts +0 -91
- package/src/features/text-to-voice/presentation/hooks/useTextToVoiceGeneration.ts +0 -116
- package/src/features/text-to-voice/presentation/index.ts +0 -2
- package/src/features/upscaling/README.md +0 -396
- package/src/features/upscaling/domain/index.ts +0 -1
- package/src/features/upscaling/domain/types/index.ts +0 -1
- package/src/features/upscaling/domain/types/upscale.types.ts +0 -23
- package/src/features/upscaling/index.ts +0 -20
- package/src/features/upscaling/presentation/components/ComparisonSlider.tsx +0 -200
- package/src/features/upscaling/presentation/components/UpscaleFeature.tsx +0 -89
- package/src/features/upscaling/presentation/components/UpscaleResultView.tsx +0 -98
- package/src/features/upscaling/presentation/components/index.ts +0 -6
- package/src/features/upscaling/presentation/hooks/index.ts +0 -1
- package/src/features/upscaling/presentation/hooks/useUpscaleFeature.ts +0 -28
- package/src/features/upscaling/presentation/index.ts +0 -2
- package/src/features/wizard/domain/types.ts +0 -154
- package/src/features/wizard/index.ts +0 -43
- package/src/features/wizard/presentation/components/AIFeatureWizard.tsx +0 -231
- package/src/features/wizard/presentation/components/AIGenerationWizard.tsx +0 -132
- package/src/features/wizard/presentation/hooks/useWizard.ts +0 -120
- package/src/features/wizard/presentation/store/useWizardStore.ts +0 -82
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
# Meme Generator Feature
|
|
2
|
-
|
|
3
|
-
Create memes from images with AI-generated text and styling.
|
|
4
|
-
|
|
5
|
-
## 📍 Import Path
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
import { useMemeGeneratorFeature } from '@umituz/react-native-ai-generation-content';
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
**Location**: `src/features/meme-generator/`
|
|
12
|
-
|
|
13
|
-
## 🎯 Feature Purpose
|
|
14
|
-
|
|
15
|
-
Generate memes from images with customizable text, templates, and styling. Supports classic top/bottom text format, modern styling, minimal design, and bold impact templates with font and color customization.
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## 📋 Usage Strategy
|
|
20
|
-
|
|
21
|
-
### When to Use This Feature
|
|
22
|
-
|
|
23
|
-
✅ **Use Cases:**
|
|
24
|
-
- Creating humorous memes
|
|
25
|
-
- Generating shareable social media content
|
|
26
|
-
- Creating marketing memes
|
|
27
|
-
- Making reaction images
|
|
28
|
-
- Personalized content creation
|
|
29
|
-
|
|
30
|
-
❌ **When NOT to Use:**
|
|
31
|
-
- Complex image editing (use image editing software)
|
|
32
|
-
- Graphic design work (use design tools)
|
|
33
|
-
- Text-to-image generation (use Text to Image)
|
|
34
|
-
- Adding artistic effects (use Style Transfer)
|
|
35
|
-
|
|
36
|
-
### Implementation Strategy
|
|
37
|
-
|
|
38
|
-
1. **Select image** for meme background
|
|
39
|
-
2. **Choose template** (classic, modern, minimal, bold)
|
|
40
|
-
3. **Add text** (top and/or bottom)
|
|
41
|
-
4. **Customize style** (font, size, colors)
|
|
42
|
-
5. **Generate meme** with progress tracking
|
|
43
|
-
6. **Preview result** and offer regeneration
|
|
44
|
-
7. **Save or share** final meme
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## ⚠️ Critical Rules (MUST FOLLOW)
|
|
49
|
-
|
|
50
|
-
### 1. Image Requirements
|
|
51
|
-
- **MUST** provide ONE image for meme
|
|
52
|
-
- **MUST** use clear, appropriate images
|
|
53
|
-
- **MUST** have visible content
|
|
54
|
-
- **MUST NOT** exceed file size limits (10MB max)
|
|
55
|
-
- **MUST** respect copyright and usage rights
|
|
56
|
-
|
|
57
|
-
### 2. Configuration
|
|
58
|
-
- **MUST** provide valid `userId` for tracking
|
|
59
|
-
- **MUST** specify `template` (classic, modern, minimal, bold)
|
|
60
|
-
- **MUST** implement `onError` callback
|
|
61
|
-
- **MUST** implement `onSelectImage` callback
|
|
62
|
-
- **MUST** provide text input fields
|
|
63
|
-
|
|
64
|
-
### 3. State Management
|
|
65
|
-
- **MUST** check `isReady` before enabling generate button
|
|
66
|
-
- **MUST** display progress during generation
|
|
67
|
-
- **MUST** handle long processing times
|
|
68
|
-
- **MUST** display `error` state with clear messages
|
|
69
|
-
- **MUST** implement proper cleanup on unmount
|
|
70
|
-
|
|
71
|
-
### 4. Performance
|
|
72
|
-
- **MUST** implement image compression before upload
|
|
73
|
-
- **MUST** show progress indicator for processing
|
|
74
|
-
- **MUST** cache results locally
|
|
75
|
-
- **MUST** allow users to cancel processing
|
|
76
|
-
- **MUST NOT** generate multiple memes simultaneously
|
|
77
|
-
|
|
78
|
-
### 5. Content Quality
|
|
79
|
-
- **MUST** provide text preview
|
|
80
|
-
- **MUST** allow font and color customization
|
|
81
|
-
- **MUST** handle various text lengths
|
|
82
|
-
- **MUST** ensure text readability
|
|
83
|
-
- **MUST** offer template switching
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## 🚫 Prohibitions (MUST AVOID)
|
|
88
|
-
|
|
89
|
-
### Strictly Forbidden
|
|
90
|
-
|
|
91
|
-
❌ **NEVER** do the following:
|
|
92
|
-
|
|
93
|
-
1. **No Missing Images**
|
|
94
|
-
- Always validate image is selected
|
|
95
|
-
- Never call process() without image
|
|
96
|
-
|
|
97
|
-
2. **No Auto-Processing**
|
|
98
|
-
- Never start generation without user action
|
|
99
|
-
- Always require explicit "Create" button press
|
|
100
|
-
- Show preview before processing
|
|
101
|
-
|
|
102
|
-
3. **No Hardcoded Credentials**
|
|
103
|
-
- Never store API keys in component files
|
|
104
|
-
- Use environment variables or secure storage
|
|
105
|
-
|
|
106
|
-
4. **No Unhandled Errors**
|
|
107
|
-
- Never ignore generation failures
|
|
108
|
-
- Always explain what went wrong
|
|
109
|
-
- Provide retry or alternative options
|
|
110
|
-
|
|
111
|
-
5. **No Memory Leaks**
|
|
112
|
-
- Never store both original and meme simultaneously
|
|
113
|
-
- Clean up temporary images
|
|
114
|
-
- Implement proper image disposal
|
|
115
|
-
|
|
116
|
-
6. **No Blocked UI**
|
|
117
|
-
- Never block main thread with image processing
|
|
118
|
-
- Always show progress indicator
|
|
119
|
-
- Allow cancellation
|
|
120
|
-
|
|
121
|
-
7. **No Offensive Content**
|
|
122
|
-
- Never generate hate speech or offensive content
|
|
123
|
-
- Implement content moderation
|
|
124
|
-
- Provide content guidelines
|
|
125
|
-
|
|
126
|
-
---
|
|
127
|
-
|
|
128
|
-
## 🤖 AI Agent Directions
|
|
129
|
-
|
|
130
|
-
### For AI Code Generation Tools
|
|
131
|
-
|
|
132
|
-
When using this feature with AI code generation tools, follow these guidelines:
|
|
133
|
-
|
|
134
|
-
#### Prompt Template for AI Agents
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
You are implementing a meme generator feature using @umituz/react-native-ai-generation-content.
|
|
138
|
-
|
|
139
|
-
REQUIREMENTS:
|
|
140
|
-
1. Import from: @umituz/react-native-ai-generation-content
|
|
141
|
-
2. Use the useMemeGeneratorFeature hook
|
|
142
|
-
3. Select meme template (classic, modern, minimal, bold)
|
|
143
|
-
4. Implement image selection UI
|
|
144
|
-
5. Add text input fields (top and bottom)
|
|
145
|
-
6. Customize style (font, size, colors)
|
|
146
|
-
7. Validate image and text before generation
|
|
147
|
-
8. Show result preview
|
|
148
|
-
9. Handle long processing times with progress
|
|
149
|
-
10. Implement proper error handling
|
|
150
|
-
11. Implement cleanup on unmount
|
|
151
|
-
|
|
152
|
-
CRITICAL RULES:
|
|
153
|
-
- MUST validate image and text before calling generate()
|
|
154
|
-
- MUST show result preview with quality check
|
|
155
|
-
- MUST handle template selection
|
|
156
|
-
- MUST handle text input (top and bottom)
|
|
157
|
-
- MUST implement debouncing (300ms)
|
|
158
|
-
- MUST allow regeneration with different settings
|
|
159
|
-
|
|
160
|
-
CONFIGURATION:
|
|
161
|
-
- Provide valid userId (string)
|
|
162
|
-
- Set template: 'classic' | 'modern' | 'minimal' | 'bold'
|
|
163
|
-
- Set topText: string (optional)
|
|
164
|
-
- Set bottomText: string (optional)
|
|
165
|
-
- Set fontSize: number (font size)
|
|
166
|
-
- Set textColor: string (text color)
|
|
167
|
-
- Set strokeColor: string (text outline color)
|
|
168
|
-
- Implement onSelectImage callback
|
|
169
|
-
- Implement onSaveResult callback
|
|
170
|
-
- Configure callbacks: onProcessingStart, onProcessingComplete, onError
|
|
171
|
-
|
|
172
|
-
MEME TEMPLATES:
|
|
173
|
-
- classic: Top/bottom text format
|
|
174
|
-
- modern: Contemporary styling
|
|
175
|
-
- minimal: Clean, simple design
|
|
176
|
-
- bold: Big, impactful text
|
|
177
|
-
|
|
178
|
-
OPTIONS:
|
|
179
|
-
- fontSize: Adjust text size
|
|
180
|
-
- textColor: Text color
|
|
181
|
-
- strokeColor: Text outline color
|
|
182
|
-
- font: Font family selection
|
|
183
|
-
|
|
184
|
-
STRICTLY FORBIDDEN:
|
|
185
|
-
- No missing image validation
|
|
186
|
-
- No auto-processing without user action
|
|
187
|
-
- No hardcoded API keys
|
|
188
|
-
- No unhandled errors
|
|
189
|
-
- No memory leaks
|
|
190
|
-
- No blocking UI
|
|
191
|
-
- No offensive content generation
|
|
192
|
-
|
|
193
|
-
QUALITY CHECKLIST:
|
|
194
|
-
- [ ] Image selection implemented
|
|
195
|
-
- [ ] Template selector added
|
|
196
|
-
- [ ] Text inputs included (top/bottom)
|
|
197
|
-
- [ ] Style customization (font, colors)
|
|
198
|
-
- [ ] Validation before generate()
|
|
199
|
-
- [ ] Result preview display
|
|
200
|
-
- [ ] Progress indicator during processing
|
|
201
|
-
- [ ] Error display with retry option
|
|
202
|
-
- [ ] Download/share functionality
|
|
203
|
-
- [ ] Template switching option
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
#### AI Implementation Checklist
|
|
207
|
-
|
|
208
|
-
Use this checklist when generating code:
|
|
209
|
-
|
|
210
|
-
- [ ] Feature imported from correct path
|
|
211
|
-
- [ ] Image selection implemented
|
|
212
|
-
- [ ] Template selector added
|
|
213
|
-
- [ ] Text inputs implemented (top/bottom)
|
|
214
|
-
- [ ] Style customization added
|
|
215
|
-
- [ ] Validation before generate()
|
|
216
|
-
- [ ] Result preview display
|
|
217
|
-
- [ ] Progress indicator during processing
|
|
218
|
-
- [ ] Error display with user-friendly message
|
|
219
|
-
- [ ] Download/share buttons
|
|
220
|
-
- [ ] Template switching option
|
|
221
|
-
- [ ] Cleanup on unmount
|
|
222
|
-
- [ ] Original image preserved
|
|
223
|
-
|
|
224
|
-
---
|
|
225
|
-
|
|
226
|
-
## 🛠️ Configuration Strategy
|
|
227
|
-
|
|
228
|
-
### Essential Configuration
|
|
229
|
-
|
|
230
|
-
```typescript
|
|
231
|
-
// Required fields
|
|
232
|
-
{
|
|
233
|
-
userId: string
|
|
234
|
-
template: 'classic' | 'modern' | 'minimal' | 'bold'
|
|
235
|
-
onSelectImage: () => Promise<string | null>
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// Optional callbacks
|
|
239
|
-
{
|
|
240
|
-
onProcessingStart?: () => void
|
|
241
|
-
onProcessingComplete?: (result) => void
|
|
242
|
-
onError?: (error: string) => void
|
|
243
|
-
}
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
### Recommended Settings
|
|
247
|
-
|
|
248
|
-
1. **Meme Templates**
|
|
249
|
-
- Classic: Traditional top/bottom text format
|
|
250
|
-
- Modern: Contemporary styling with flexible placement
|
|
251
|
-
- Minimal: Clean, simple design
|
|
252
|
-
- Bold: Big, impactful text
|
|
253
|
-
|
|
254
|
-
2. **Text Options**
|
|
255
|
-
- Top text: Primary message
|
|
256
|
-
- Bottom text: Secondary message or punchline
|
|
257
|
-
- Keep text short and punchy
|
|
258
|
-
|
|
259
|
-
3. **Style Customization**
|
|
260
|
-
- Font size: Adjust based on image size
|
|
261
|
-
- Text color: Ensure good contrast
|
|
262
|
-
- Stroke color: Add outline for readability
|
|
263
|
-
|
|
264
|
-
4. **Image Quality**
|
|
265
|
-
- Minimum: 512x512 resolution
|
|
266
|
-
- Recommended: 1024x1024 or higher
|
|
267
|
-
- Format: JPEG or PNG
|
|
268
|
-
- Max size: 10MB
|
|
269
|
-
|
|
270
|
-
---
|
|
271
|
-
|
|
272
|
-
## 📊 State Management
|
|
273
|
-
|
|
274
|
-
### Feature States
|
|
275
|
-
|
|
276
|
-
**isReady**: boolean
|
|
277
|
-
- Image selected and text provided (optional)
|
|
278
|
-
- Check before enabling generate button
|
|
279
|
-
|
|
280
|
-
**isProcessing**: boolean
|
|
281
|
-
- Meme generation in progress
|
|
282
|
-
- Show loading/progress indicator
|
|
283
|
-
- Disable generate button
|
|
284
|
-
|
|
285
|
-
**progress**: number (0-100)
|
|
286
|
-
- Generation progress percentage
|
|
287
|
-
- Update progress bar
|
|
288
|
-
|
|
289
|
-
**error**: string | null
|
|
290
|
-
- Error message if generation failed
|
|
291
|
-
- Display to user with clear message
|
|
292
|
-
|
|
293
|
-
**result**: {
|
|
294
|
-
imageUrl: string
|
|
295
|
-
originalImageUrl?: string
|
|
296
|
-
template?: string
|
|
297
|
-
topText?: string
|
|
298
|
-
bottomText?: string
|
|
299
|
-
metadata?: any
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
---
|
|
303
|
-
|
|
304
|
-
## 🎨 Best Practices
|
|
305
|
-
|
|
306
|
-
### Meme Creation
|
|
307
|
-
|
|
308
|
-
1. **Text Quality**
|
|
309
|
-
- Keep text short and punchy
|
|
310
|
-
- Ensure good readability
|
|
311
|
-
- Match text to image content
|
|
312
|
-
|
|
313
|
-
2. **Template Selection**
|
|
314
|
-
- Classic: Traditional memes
|
|
315
|
-
- Modern: Contemporary content
|
|
316
|
-
- Minimal: Subtle messages
|
|
317
|
-
- Bold: Impactful statements
|
|
318
|
-
|
|
319
|
-
3. **Style Customization**
|
|
320
|
-
- Ensure text contrasts well
|
|
321
|
-
- Adjust font size appropriately
|
|
322
|
-
- Use stroke for readability
|
|
323
|
-
|
|
324
|
-
### User Experience
|
|
325
|
-
|
|
326
|
-
1. **Template Preview**
|
|
327
|
-
- Show examples of each template
|
|
328
|
-
- Preview before generating
|
|
329
|
-
- Explain template characteristics
|
|
330
|
-
|
|
331
|
-
2. **Text Input**
|
|
332
|
-
- Provide clear input fields
|
|
333
|
-
- Show character limits
|
|
334
|
-
- Suggest text examples
|
|
335
|
-
|
|
336
|
-
---
|
|
337
|
-
|
|
338
|
-
## 🐛 Common Pitfalls
|
|
339
|
-
|
|
340
|
-
### Readability Issues
|
|
341
|
-
|
|
342
|
-
❌ **Problem**: Text is hard to read
|
|
343
|
-
✅ **Solution**: Adjust font size, add stroke, improve contrast
|
|
344
|
-
|
|
345
|
-
### Template Issues
|
|
346
|
-
|
|
347
|
-
❌ **Problem**: Wrong template for content
|
|
348
|
-
✅ **Solution**: Try different template, adjust text placement
|
|
349
|
-
|
|
350
|
-
### Content Issues
|
|
351
|
-
|
|
352
|
-
❌ **Problem**: Text doesn't match image
|
|
353
|
-
✅ **Solution**: Ensure text relevance to image content
|
|
354
|
-
|
|
355
|
-
---
|
|
356
|
-
|
|
357
|
-
## 📦 Related Components
|
|
358
|
-
|
|
359
|
-
Use these components from the library:
|
|
360
|
-
|
|
361
|
-
- **PhotoUploadCard**: Upload image interface
|
|
362
|
-
- **MemeTemplateSelector**: Choose meme template
|
|
363
|
-
- **TextInputFields**: Top/bottom text input
|
|
364
|
-
- **ColorPicker**: Select text and stroke colors
|
|
365
|
-
- **ResultDisplay**: Show generated meme
|
|
366
|
-
- **ProgressBar**: Progress display
|
|
367
|
-
|
|
368
|
-
Located at: `src/presentation/components/`
|
|
369
|
-
|
|
370
|
-
---
|
|
371
|
-
|
|
372
|
-
## 🔄 Migration Strategy
|
|
373
|
-
|
|
374
|
-
If migrating from previous implementation:
|
|
375
|
-
|
|
376
|
-
1. **Update imports** to new path
|
|
377
|
-
2. **Add template selector**
|
|
378
|
-
3. **Implement text input fields**
|
|
379
|
-
4. **Add style customization options**
|
|
380
|
-
5. **Update state handling** for new structure
|
|
381
|
-
6. **Test all meme templates**
|
|
382
|
-
|
|
383
|
-
---
|
|
384
|
-
|
|
385
|
-
## 📚 Additional Resources
|
|
386
|
-
|
|
387
|
-
- Main documentation: `/docs/`
|
|
388
|
-
- API reference: `/docs/api/`
|
|
389
|
-
- Examples: `/docs/examples/basic/meme-generator/`
|
|
390
|
-
- Architecture: `/ARCHITECTURE.md`
|
|
391
|
-
|
|
392
|
-
---
|
|
393
|
-
|
|
394
|
-
**Last Updated**: 2025-01-08
|
|
395
|
-
**Version**: 2.0.0 (Strategy-based Documentation)
|
|
396
|
-
|
|
397
|
-
---
|
|
398
|
-
|
|
399
|
-
## 📝 Changelog
|
|
400
|
-
|
|
401
|
-
### v2.0.0 - 2025-01-08
|
|
402
|
-
- **BREAKING**: Documentation format changed to strategy-based
|
|
403
|
-
- Removed extensive code examples
|
|
404
|
-
- Added rules, prohibitions, and AI agent directions
|
|
405
|
-
- Focus on best practices and implementation guidance
|
|
406
|
-
|
|
407
|
-
### v1.0.0 - Initial Release
|
|
408
|
-
- Initial feature documentation
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { providerRegistry } from "../../../../infrastructure/services";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export interface MemeGenerationParams {
|
|
5
|
-
prompt: string;
|
|
6
|
-
styleId?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export class MemeGenerationService {
|
|
10
|
-
/**
|
|
11
|
-
* Enhance a simple user prompt into a rich image generation prompt
|
|
12
|
-
* @param prompt - The user's meme idea
|
|
13
|
-
* @param modelId - REQUIRED: Text-to-text model ID from app config
|
|
14
|
-
*/
|
|
15
|
-
async enhancePrompt(prompt: string, modelId: string): Promise<string> {
|
|
16
|
-
try {
|
|
17
|
-
const provider = providerRegistry.getActiveProvider();
|
|
18
|
-
if (!provider) {
|
|
19
|
-
throw new Error("AI provider not available");
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (!modelId) {
|
|
23
|
-
throw new Error("modelId is required for enhancePrompt. Please provide model from app config.");
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const systemPrompt = `You are an AI art director. Take the user's simple meme idea and transform it into a visually rich, detailed, and funny image generation prompt. Your response should be only the new prompt, no explanations. Idea: "${prompt}"`;
|
|
27
|
-
|
|
28
|
-
const result = await provider.run<{ text?: string, data?: { text: string } }>(
|
|
29
|
-
modelId,
|
|
30
|
-
{ prompt: systemPrompt }
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
// Handle different provider response formats
|
|
34
|
-
const text = result.text || result.data?.text || prompt;
|
|
35
|
-
return text;
|
|
36
|
-
} catch (error) {
|
|
37
|
-
if (__DEV__) {
|
|
38
|
-
|
|
39
|
-
console.error("[MemeGenerationService] Enhance prompt error:", error);
|
|
40
|
-
}
|
|
41
|
-
return prompt;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Generate a meme image
|
|
47
|
-
* @param prompt - The final prompt to use (should already be enhanced if desired)
|
|
48
|
-
* @param modelId - REQUIRED: Image generation model ID from app config
|
|
49
|
-
*/
|
|
50
|
-
async generateMeme(prompt: string, modelId: string): Promise<string> {
|
|
51
|
-
try {
|
|
52
|
-
const provider = providerRegistry.getActiveProvider();
|
|
53
|
-
if (!provider) {
|
|
54
|
-
throw new Error("AI provider not available");
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (!modelId) {
|
|
58
|
-
throw new Error("modelId is required for generateMeme. Please provide model from app config.");
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const finalPrompt = `High-quality, funny meme: ${prompt}. Cinematic, vibrant, clean subject, NO TEXT in image.`;
|
|
62
|
-
|
|
63
|
-
const result = await provider.run<{ images: { url: string }[] }>(
|
|
64
|
-
modelId,
|
|
65
|
-
{
|
|
66
|
-
prompt: finalPrompt,
|
|
67
|
-
image_size: "square",
|
|
68
|
-
num_inference_steps: 4
|
|
69
|
-
}
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
if (result.images && result.images.length > 0) {
|
|
73
|
-
return result.images[0].url;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
throw new Error("No image generated");
|
|
77
|
-
} catch (error) {
|
|
78
|
-
if (__DEV__) {
|
|
79
|
-
|
|
80
|
-
console.error("[MemeGenerationService] Generate meme error:", error);
|
|
81
|
-
}
|
|
82
|
-
throw error;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export const memeGenerationService = new MemeGenerationService();
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MemeGeneratorFeature Component
|
|
3
|
-
*
|
|
4
|
-
* Unified Text-to-Image feature component for Meme Generation.
|
|
5
|
-
* Integrates PromptInput, StyleSelector, and Generation logic using useTextToImageFeature.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React, { useMemo, useCallback } from "react";
|
|
9
|
-
import { View, ScrollView, StyleSheet, KeyboardAvoidingView, Platform } from "react-native";
|
|
10
|
-
import { useAppDesignTokens, AtomicCard, AtomicText } from "@umituz/react-native-design-system";
|
|
11
|
-
import { getAuthService } from "../../../../infrastructure/config";
|
|
12
|
-
import { useTextToImageFeature } from "../../../text-to-image/presentation/hooks/useTextToImageFeature";
|
|
13
|
-
import { PromptInput } from "../../../../presentation/components/PromptInput";
|
|
14
|
-
import { GenerateButton } from "../../../../presentation/components/buttons/GenerateButton";
|
|
15
|
-
import { GridSelector } from "../../../../presentation/components/selectors/GridSelector";
|
|
16
|
-
import { GenerationResultContent } from "../../../../presentation/components/result/GenerationResultContent";
|
|
17
|
-
|
|
18
|
-
// Constants (Using default provided styles if config doesn't override)
|
|
19
|
-
import { DEFAULT_IMAGE_STYLES } from "../../../text-to-image/domain/constants/styles.constants";
|
|
20
|
-
import type { TextToImageFeatureConfig } from "../../../text-to-image/domain/types";
|
|
21
|
-
|
|
22
|
-
export interface MemeGeneratorFeatureProps {
|
|
23
|
-
config: TextToImageFeatureConfig & {
|
|
24
|
-
styles?: Array<{
|
|
25
|
-
id: string;
|
|
26
|
-
name: string;
|
|
27
|
-
emoji?: string;
|
|
28
|
-
icon?: string;
|
|
29
|
-
description?: string;
|
|
30
|
-
}>;
|
|
31
|
-
[key: string]: unknown;
|
|
32
|
-
};
|
|
33
|
-
translations: Record<string, string>;
|
|
34
|
-
onSaveImage: (url: string) => Promise<void>;
|
|
35
|
-
onBeforeProcess?: () => Promise<boolean>;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const MemeGeneratorFeature: React.FC<MemeGeneratorFeatureProps> = ({
|
|
39
|
-
config,
|
|
40
|
-
translations,
|
|
41
|
-
onSaveImage,
|
|
42
|
-
onBeforeProcess,
|
|
43
|
-
}) => {
|
|
44
|
-
const tokens = useAppDesignTokens();
|
|
45
|
-
const authService = getAuthService();
|
|
46
|
-
const userId = authService.getUserId() || "anonymous";
|
|
47
|
-
|
|
48
|
-
// Config can override styles, or use defaults
|
|
49
|
-
const stylesList = config.styles || DEFAULT_IMAGE_STYLES;
|
|
50
|
-
|
|
51
|
-
// Transform styles for GridSelector
|
|
52
|
-
const styleOptions = useMemo(() => stylesList.map((s: {
|
|
53
|
-
id: string;
|
|
54
|
-
name: string;
|
|
55
|
-
emoji?: string;
|
|
56
|
-
icon?: string;
|
|
57
|
-
description?: string;
|
|
58
|
-
}) => ({
|
|
59
|
-
value: s.id,
|
|
60
|
-
label: s.name,
|
|
61
|
-
emoji: s.emoji || s.icon, // Handle different formats
|
|
62
|
-
description: s.description
|
|
63
|
-
})), [stylesList]);
|
|
64
|
-
|
|
65
|
-
// Validate model is provided from app
|
|
66
|
-
if (!config.model) {
|
|
67
|
-
throw new Error(
|
|
68
|
-
"MemeGeneratorFeature: model is required in config. " +
|
|
69
|
-
"Please provide model from app's generation config."
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const { state, setPrompt, generate, reset, isReady } = useTextToImageFeature({
|
|
74
|
-
config,
|
|
75
|
-
userId,
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
const [selectedStyle, setSelectedStyle] = React.useState<string | null>(null);
|
|
79
|
-
|
|
80
|
-
const handleGenerate = useCallback(async () => {
|
|
81
|
-
if (onBeforeProcess) {
|
|
82
|
-
const canProceed = await onBeforeProcess();
|
|
83
|
-
if (!canProceed) return;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Append style logic handled via buildInput or here
|
|
87
|
-
// For now simple pass
|
|
88
|
-
await generate();
|
|
89
|
-
}, [generate, onBeforeProcess]);
|
|
90
|
-
|
|
91
|
-
const handleSave = useCallback(() => {
|
|
92
|
-
if (state.imageUrl) {
|
|
93
|
-
onSaveImage(state.imageUrl);
|
|
94
|
-
}
|
|
95
|
-
}, [state.imageUrl, onSaveImage]);
|
|
96
|
-
|
|
97
|
-
const styles = StyleSheet.create({
|
|
98
|
-
container: {
|
|
99
|
-
flex: 1,
|
|
100
|
-
},
|
|
101
|
-
content: {
|
|
102
|
-
padding: tokens.spacing.lg,
|
|
103
|
-
gap: tokens.spacing.xl,
|
|
104
|
-
paddingBottom: 100,
|
|
105
|
-
},
|
|
106
|
-
section: {
|
|
107
|
-
gap: tokens.spacing.md,
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
if (state.imageUrl) {
|
|
112
|
-
return (
|
|
113
|
-
<GenerationResultContent
|
|
114
|
-
result={{ imageUrl: state.imageUrl }}
|
|
115
|
-
onSave={handleSave}
|
|
116
|
-
onRetry={reset}
|
|
117
|
-
translations={{
|
|
118
|
-
share: "Share",
|
|
119
|
-
sharing: "Sharing...",
|
|
120
|
-
save: translations.saveButtonText || "Save to Gallery",
|
|
121
|
-
retry: translations.tryAnotherText || "Create Another",
|
|
122
|
-
aiGenerated: translations.successText || "Your meme is ready!",
|
|
123
|
-
}}
|
|
124
|
-
/>
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return (
|
|
129
|
-
<KeyboardAvoidingView
|
|
130
|
-
behavior={Platform.OS === "ios" ? "padding" : "height"}
|
|
131
|
-
style={styles.container}
|
|
132
|
-
>
|
|
133
|
-
<ScrollView contentContainerStyle={styles.content} keyboardShouldPersistTaps="handled">
|
|
134
|
-
|
|
135
|
-
{/* Prompt Input */}
|
|
136
|
-
<View style={styles.section}>
|
|
137
|
-
<AtomicText type="labelLarge" style={{color: tokens.colors.textPrimary}}>
|
|
138
|
-
{translations.description || "Describe your meme idea"}
|
|
139
|
-
</AtomicText>
|
|
140
|
-
<PromptInput
|
|
141
|
-
value={state.prompt}
|
|
142
|
-
onChangeText={setPrompt}
|
|
143
|
-
placeholder={translations.promptPlaceholder || "Enter your funny idea..."}
|
|
144
|
-
isDisabled={state.isProcessing}
|
|
145
|
-
minHeight={100}
|
|
146
|
-
/>
|
|
147
|
-
</View>
|
|
148
|
-
|
|
149
|
-
{/* Style Selector */}
|
|
150
|
-
{styleOptions.length > 0 && (
|
|
151
|
-
<GridSelector
|
|
152
|
-
title={translations.styleLabel || "Choose a Style"}
|
|
153
|
-
options={styleOptions}
|
|
154
|
-
selectedValue={selectedStyle}
|
|
155
|
-
onSelect={setSelectedStyle}
|
|
156
|
-
disabled={state.isProcessing}
|
|
157
|
-
columns={3}
|
|
158
|
-
/>
|
|
159
|
-
)}
|
|
160
|
-
|
|
161
|
-
{/* Generate Button */}
|
|
162
|
-
<GenerateButton
|
|
163
|
-
onPress={handleGenerate}
|
|
164
|
-
isProcessing={state.isProcessing}
|
|
165
|
-
isDisabled={!isReady}
|
|
166
|
-
text={translations.processButtonText || "Generate Meme"}
|
|
167
|
-
/>
|
|
168
|
-
|
|
169
|
-
{/* Error Display */}
|
|
170
|
-
{state.error && (
|
|
171
|
-
<AtomicCard style={{backgroundColor: tokens.colors.errorContainer}}>
|
|
172
|
-
<AtomicText style={{color: tokens.colors.error}}>
|
|
173
|
-
{state.error}
|
|
174
|
-
</AtomicText>
|
|
175
|
-
</AtomicCard>
|
|
176
|
-
)}
|
|
177
|
-
</ScrollView>
|
|
178
|
-
</KeyboardAvoidingView>
|
|
179
|
-
);
|
|
180
|
-
};
|