@umituz/react-native-ai-generation-content 1.17.229 โ 1.17.231
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/LICENSE +21 -0
- package/README.md +346 -0
- package/package.json +1 -3
- package/src/domain/README.md +503 -0
- package/src/domains/content-moderation/README.md +363 -0
- package/src/domains/creations/README.md +394 -0
- package/src/domains/face-detection/README.md +395 -0
- package/src/domains/prompts/README.md +387 -0
- package/src/features/ai-hug/README.md +276 -0
- package/src/features/ai-kiss/README.md +276 -0
- package/src/features/anime-selfie/README.md +325 -0
- package/src/features/audio-generation/README.md +370 -0
- package/src/features/colorization/README.md +289 -0
- package/src/features/couple-future/README.md +270 -0
- package/src/features/face-swap/README.md +431 -0
- package/src/features/future-prediction/README.md +281 -0
- package/src/features/hd-touch-up/README.md +309 -0
- package/src/features/image-captioning/README.md +361 -0
- package/src/features/image-to-image/README.md +418 -0
- package/src/features/image-to-video/README.md +369 -0
- package/src/features/inpainting/README.md +302 -0
- package/src/features/meme-generator/README.md +327 -0
- package/src/features/photo-restoration/README.md +286 -0
- package/src/features/remove-background/README.md +292 -0
- package/src/features/remove-object/README.md +352 -0
- package/src/features/replace-background/README.md +288 -0
- package/src/features/script-generator/README.md +362 -0
- package/src/features/shared/README.md +280 -0
- package/src/features/sketch-to-image/README.md +296 -0
- package/src/features/style-transfer/README.md +301 -0
- package/src/features/text-to-image/README.md +394 -0
- package/src/features/text-to-video/README.md +245 -0
- package/src/features/text-to-voice/README.md +335 -0
- package/src/features/upscaling/README.md +247 -0
- package/src/infrastructure/config/README.md +310 -0
- package/src/infrastructure/middleware/README.md +378 -0
- package/src/infrastructure/orchestration/README.md +362 -0
- package/src/infrastructure/services/README.md +382 -0
- package/src/infrastructure/utils/README.md +523 -0
- package/src/infrastructure/wrappers/README.md +336 -0
- package/src/presentation/components/README.md +535 -0
- package/src/presentation/components/result/ResultStoryCard.tsx +1 -6
- package/src/presentation/hooks/README.md +380 -0
- package/src/presentation/layouts/README.md +374 -0
- package/src/presentation/screens/README.md +430 -0
- package/src/presentation/types/result-config.types.ts +3 -3
- package/src/presentation/layouts/types/.npmignore.tmp +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Umit Uz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
# @umituz/react-native-ai-generation-content
|
|
2
|
+
|
|
3
|
+
> Provider-agnostic AI generation orchestration for React Native
|
|
4
|
+
|
|
5
|
+
A comprehensive React Native library for AI-powered content generation, supporting multiple providers and offering a wide range of AI features including image generation, video creation, text-to-speech, face swap, and much more.
|
|
6
|
+
|
|
7
|
+
## ๐ Features
|
|
8
|
+
|
|
9
|
+
- **๐จ Text to Image**: Generate stunning images from text descriptions
|
|
10
|
+
- **๐ฌ Text to Video**: Create videos from text prompts
|
|
11
|
+
- **๐ค Text to Voice**: Convert text to natural-sounding speech
|
|
12
|
+
- **๐ Face Swap**: Swap faces between images with AI
|
|
13
|
+
- **๐ผ๏ธ Style Transfer**: Apply artistic styles to photos
|
|
14
|
+
- **โจ Photo Restoration**: Restore and enhance old photos
|
|
15
|
+
- **๐ Upscaling**: Increase image resolution while maintaining quality
|
|
16
|
+
- **๐ญ AI Hug & Kiss**: Generate creative AI-powered interactions
|
|
17
|
+
- **๐
Background Removal/Replacement**: Remove or replace image backgrounds
|
|
18
|
+
- **๐ช Anime Selfie**: Convert photos to anime style
|
|
19
|
+
- **๐ Image Captioning**: Generate descriptive captions for images
|
|
20
|
+
- **๐ต Audio Generation**: Create audio content with AI
|
|
21
|
+
- **๐ Script Generator**: Generate scripts for videos and podcasts
|
|
22
|
+
- **๐ฎ Future Prediction**: See yourself in future scenarios
|
|
23
|
+
|
|
24
|
+
## ๐ฆ Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @umituz/react-native-ai-generation-content
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
or
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
yarn add @umituz/react-native-ai-generation-content
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## ๐ Quick Start
|
|
37
|
+
|
|
38
|
+
### 1. Configure App Services
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { configureAppServices } from '@umituz/react-native-ai-generation-content';
|
|
42
|
+
|
|
43
|
+
// Configure required services
|
|
44
|
+
configureAppServices({
|
|
45
|
+
networkService: {
|
|
46
|
+
baseUrl: 'https://your-api.com',
|
|
47
|
+
apiKey: 'your-api-key',
|
|
48
|
+
},
|
|
49
|
+
creditService: {
|
|
50
|
+
checkCredits: async (userId, cost) => {
|
|
51
|
+
// Check if user has enough credits
|
|
52
|
+
return true;
|
|
53
|
+
},
|
|
54
|
+
deductCredits: async (userId, cost) => {
|
|
55
|
+
// Deduct credits from user
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
paywallService: {
|
|
59
|
+
showPaywall: async () => {
|
|
60
|
+
// Show paywall if needed
|
|
61
|
+
return true;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 2. Use a Feature Hook
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { useTextToImageFeature } from '@umituz/react-native-ai-generation-content';
|
|
71
|
+
|
|
72
|
+
function TextToImageScreen() {
|
|
73
|
+
const feature = useTextToImageFeature({
|
|
74
|
+
config: {
|
|
75
|
+
model: 'imagen-3',
|
|
76
|
+
onProcessingComplete: (result) => {
|
|
77
|
+
console.log('Image generated:', result.imageUrl);
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
userId: 'user-123',
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<View>
|
|
85
|
+
<TextInput
|
|
86
|
+
placeholder="Describe the image you want..."
|
|
87
|
+
onChangeText={feature.setPrompt}
|
|
88
|
+
value={feature.state.prompt}
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
<Button
|
|
92
|
+
title="Generate Image"
|
|
93
|
+
onPress={() => feature.generate()}
|
|
94
|
+
disabled={!feature.isReady}
|
|
95
|
+
/>
|
|
96
|
+
|
|
97
|
+
{feature.state.isProcessing && (
|
|
98
|
+
<Text>Generating... {feature.state.progress}%</Text>
|
|
99
|
+
)}
|
|
100
|
+
|
|
101
|
+
{feature.state.imageUrl && (
|
|
102
|
+
<Image source={{ uri: feature.state.imageUrl }} />
|
|
103
|
+
)}
|
|
104
|
+
</View>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 3. Or Use the Unified AI Feature Screen
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
|
|
113
|
+
|
|
114
|
+
function App() {
|
|
115
|
+
return (
|
|
116
|
+
<AIFeatureScreen
|
|
117
|
+
featureId="text-to-image"
|
|
118
|
+
userId="user-123"
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## ๐ Available Features
|
|
125
|
+
|
|
126
|
+
### Text Generation
|
|
127
|
+
- [Text to Image](./src/features/text-to-image/README.md)
|
|
128
|
+
- [Text to Video](./src/features/text-to-video/README.md)
|
|
129
|
+
- [Text to Voice](./src/features/text-to-voice/README.md)
|
|
130
|
+
|
|
131
|
+
### Image Processing
|
|
132
|
+
- [Face Swap](./src/features/face-swap/README.md)
|
|
133
|
+
- [Photo Restoration](./src/features/photo-restoration/README.md)
|
|
134
|
+
- [Upscaling](./src/features/upscaling/README.md)
|
|
135
|
+
- [Style Transfer](./src/features/style-transfer/README.md)
|
|
136
|
+
- [HD Touch Up](./src/features/hd-touch-up/README.md)
|
|
137
|
+
- [Colorization](./src/features/colorization/README.md)
|
|
138
|
+
- [Image to Image](./src/features/image-to-image/README.md)
|
|
139
|
+
|
|
140
|
+
### Background & Object Manipulation
|
|
141
|
+
- [Remove Background](./src/features/remove-background/README.md)
|
|
142
|
+
- [Replace Background](./src/features/replace-background/README.md)
|
|
143
|
+
- [Remove Object](./src/features/remove-object/README.md)
|
|
144
|
+
- [Inpainting](./src/features/inpainting/README.md)
|
|
145
|
+
|
|
146
|
+
### Special Effects
|
|
147
|
+
- [AI Hug](./src/features/ai-hug/README.md)
|
|
148
|
+
- [AI Kiss](./src/features/ai-kiss/README.md)
|
|
149
|
+
- [Anime Selfie](./src/features/anime-selfie/README.md)
|
|
150
|
+
- [Meme Generator](./src/features/meme-generator/README.md)
|
|
151
|
+
- [Couple Future](./src/features/couple-future/README.md)
|
|
152
|
+
- [Future Prediction](./src/features/future-prediction/README.md)
|
|
153
|
+
- [Sketch to Image](./src/features/sketch-to-image/README.md)
|
|
154
|
+
|
|
155
|
+
### Video & Audio
|
|
156
|
+
- [Image to Video](./src/features/image-to-video/README.md)
|
|
157
|
+
- [Audio Generation](./src/features/audio-generation/README.md)
|
|
158
|
+
|
|
159
|
+
### Content & Scripting
|
|
160
|
+
- [Image Captioning](./src/features/image-captioning/README.md)
|
|
161
|
+
- [Script Generator](./src/features/script-generator/README.md)
|
|
162
|
+
|
|
163
|
+
## ๐๏ธ Architecture
|
|
164
|
+
|
|
165
|
+
### Domain-Driven Design
|
|
166
|
+
|
|
167
|
+
The library follows clean architecture principles with clear separation of concerns:
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
src/
|
|
171
|
+
โโโ domain/ # Core business logic and types
|
|
172
|
+
โโโ infrastructure/ # External services and implementations
|
|
173
|
+
โโโ presentation/ # UI components and hooks
|
|
174
|
+
โโโ domains/ # Domain-specific modules
|
|
175
|
+
โ โโโ prompts/ # AI prompt management
|
|
176
|
+
โ โโโ content-moderation/ # Content moderation
|
|
177
|
+
โ โโโ creations/ # AI-generated content gallery
|
|
178
|
+
โ โโโ face-detection/ # Face detection API
|
|
179
|
+
โโโ features/ # Individual AI features
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Core Modules
|
|
183
|
+
|
|
184
|
+
- **Prompts Domain**: AI prompt management and generation
|
|
185
|
+
- **Content Moderation**: Content safety and filtering
|
|
186
|
+
- **Creations**: Gallery for managing AI-generated content
|
|
187
|
+
- **Face Detection**: Face detection and analysis
|
|
188
|
+
|
|
189
|
+
## ๐จ UI Components
|
|
190
|
+
|
|
191
|
+
The library provides ready-to-use components:
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
import {
|
|
195
|
+
GenerationProgressModal,
|
|
196
|
+
DualImagePicker,
|
|
197
|
+
PromptInput,
|
|
198
|
+
ResultDisplay,
|
|
199
|
+
StyleSelector,
|
|
200
|
+
AspectRatioSelector,
|
|
201
|
+
AIGenerationForm,
|
|
202
|
+
} from '@umituz/react-native-ai-generation-content';
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## ๐ง Configuration
|
|
206
|
+
|
|
207
|
+
### Provider Configuration
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
import { providerRegistry } from '@umituz/react-native-ai-generation-content';
|
|
211
|
+
|
|
212
|
+
// Register a custom provider
|
|
213
|
+
providerRegistry.registerProvider({
|
|
214
|
+
id: 'my-provider',
|
|
215
|
+
name: 'My AI Provider',
|
|
216
|
+
capabilities: {
|
|
217
|
+
textToImage: true,
|
|
218
|
+
textToVideo: false,
|
|
219
|
+
// ...
|
|
220
|
+
},
|
|
221
|
+
execute: async (request) => {
|
|
222
|
+
// Provider-specific implementation
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Middleware
|
|
228
|
+
|
|
229
|
+
```tsx
|
|
230
|
+
import {
|
|
231
|
+
createCreditCheckMiddleware,
|
|
232
|
+
createHistoryTrackingMiddleware,
|
|
233
|
+
} from '@umituz/react-native-ai-generation-content';
|
|
234
|
+
|
|
235
|
+
// Add credit check middleware
|
|
236
|
+
const creditMiddleware = createCreditCheckMiddleware({
|
|
237
|
+
creditCost: 1,
|
|
238
|
+
paywallThreshold: 5,
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
// Add history tracking middleware
|
|
242
|
+
const historyMiddleware = createHistoryTrackingMiddleware({
|
|
243
|
+
maxHistorySize: 100,
|
|
244
|
+
});
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## ๐ Examples
|
|
248
|
+
|
|
249
|
+
### Face Swap
|
|
250
|
+
|
|
251
|
+
```tsx
|
|
252
|
+
import { useFaceSwapFeature } from '@umituz/react-native-ai-generation-content';
|
|
253
|
+
|
|
254
|
+
const feature = useFaceSwapFeature({
|
|
255
|
+
config: {
|
|
256
|
+
enhanceFace: true,
|
|
257
|
+
matchSkinTone: true,
|
|
258
|
+
},
|
|
259
|
+
onSelectSourceImage: async () => { /* ... */ },
|
|
260
|
+
onSelectTargetImage: async () => { /* ... */ },
|
|
261
|
+
onSaveImage: async (url) => { /* ... */ },
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
await feature.process();
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Photo Restoration
|
|
268
|
+
|
|
269
|
+
```tsx
|
|
270
|
+
import { usePhotoRestoreFeature } from '@umituz/react-native-ai-generation-content';
|
|
271
|
+
|
|
272
|
+
const feature = usePhotoRestoreFeature({
|
|
273
|
+
config: {
|
|
274
|
+
restorationType: 'auto',
|
|
275
|
+
},
|
|
276
|
+
onSelectPhoto: async () => { /* ... */ },
|
|
277
|
+
onSaveResult: async (url) => { /* ... */ },
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
await feature.process();
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Text to Video
|
|
284
|
+
|
|
285
|
+
```tsx
|
|
286
|
+
import { useTextToVideoFeature } from '@umituz/react-native-ai-generation-content';
|
|
287
|
+
|
|
288
|
+
const feature = useTextToVideoFeature({
|
|
289
|
+
config: {
|
|
290
|
+
model: 'veo-3',
|
|
291
|
+
},
|
|
292
|
+
userId: 'user-123',
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
await feature.generate({
|
|
296
|
+
duration: 5,
|
|
297
|
+
aspectRatio: '16:9',
|
|
298
|
+
});
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## ๐งช Testing
|
|
302
|
+
|
|
303
|
+
```tsx
|
|
304
|
+
import { renderHook, waitFor } from '@testing-library/react-native';
|
|
305
|
+
import { useTextToImageFeature } from '@umituz/react-native-ai-generation-content';
|
|
306
|
+
|
|
307
|
+
test('generates image from prompt', async () => {
|
|
308
|
+
const { result } = renderHook(() =>
|
|
309
|
+
useTextToImageFeature({
|
|
310
|
+
config: {},
|
|
311
|
+
userId: 'test-user',
|
|
312
|
+
})
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
await act(async () => {
|
|
316
|
+
await result.current.generate({ prompt: 'Test prompt' });
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
await waitFor(() => {
|
|
320
|
+
expect(result.current.state.imageUrl).toBeTruthy();
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
## ๐ค Contributing
|
|
326
|
+
|
|
327
|
+
Contributions are welcome! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for details.
|
|
328
|
+
|
|
329
|
+
## ๐ License
|
|
330
|
+
|
|
331
|
+
MIT ยฉ [Umit Uz]
|
|
332
|
+
|
|
333
|
+
## ๐ Links
|
|
334
|
+
|
|
335
|
+
- [Documentation](./docs)
|
|
336
|
+
- [Examples](./examples)
|
|
337
|
+
- [Changelog](./CHANGELOG.md)
|
|
338
|
+
- [Report Issues](https://github.com/umituz/react-native-ai-generation-content/issues)
|
|
339
|
+
|
|
340
|
+
## โญ Star Us
|
|
341
|
+
|
|
342
|
+
If you find this library helpful, please consider giving it a star on GitHub!
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
Made with โค๏ธ by [Umit Uz]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.231",
|
|
4
4
|
"description": "Provider-agnostic AI generation orchestration for React Native",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
"@react-navigation/native": ">=6.0.0",
|
|
52
52
|
"@tanstack/react-query": ">=5.0.0",
|
|
53
53
|
"@umituz/react-native-video-editor": ">=1.0.0",
|
|
54
|
-
"expo-linear-gradient": ">=15.0.0",
|
|
55
54
|
"firebase": ">=10.0.0",
|
|
56
55
|
"react": ">=18.0.0",
|
|
57
56
|
"react-native": ">=0.74.0",
|
|
@@ -88,7 +87,6 @@
|
|
|
88
87
|
"expo-file-system": "^19.0.21",
|
|
89
88
|
"expo-haptics": "^15.0.8",
|
|
90
89
|
"expo-image": "^3.0.11",
|
|
91
|
-
"expo-linear-gradient": "~15.0.7",
|
|
92
90
|
"expo-localization": "^17.0.8",
|
|
93
91
|
"expo-network": "^8.0.8",
|
|
94
92
|
"expo-sharing": "^14.0.8",
|