@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
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
# Presentation Screens
|
|
2
|
+
|
|
3
|
+
Screen components for AI generation features.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The screens module provides complete, ready-to-use screen components for AI generation features. These screens combine layouts, components, and hooks into fully functional screens.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- Unified AI feature screen
|
|
12
|
+
- Feature-specific screens
|
|
13
|
+
- Navigation integration
|
|
14
|
+
- State management
|
|
15
|
+
- Error handling
|
|
16
|
+
|
|
17
|
+
## Core Screens
|
|
18
|
+
|
|
19
|
+
### AIFeatureScreen
|
|
20
|
+
|
|
21
|
+
Unified screen for all AI features:
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
|
|
25
|
+
|
|
26
|
+
function App() {
|
|
27
|
+
return (
|
|
28
|
+
<Stack.Navigator>
|
|
29
|
+
<Stack.Screen
|
|
30
|
+
name="AIImage"
|
|
31
|
+
component={() => (
|
|
32
|
+
<AIFeatureScreen
|
|
33
|
+
featureId="text-to-image"
|
|
34
|
+
userId="user-123"
|
|
35
|
+
/>
|
|
36
|
+
)}
|
|
37
|
+
/>
|
|
38
|
+
<Stack.Screen
|
|
39
|
+
name="FaceSwap"
|
|
40
|
+
component={() => (
|
|
41
|
+
<AIFeatureScreen
|
|
42
|
+
featureId="face-swap"
|
|
43
|
+
userId="user-123"
|
|
44
|
+
/>
|
|
45
|
+
)}
|
|
46
|
+
/>
|
|
47
|
+
<Stack.Screen
|
|
48
|
+
name="PhotoRestoration"
|
|
49
|
+
component={() => (
|
|
50
|
+
<AIFeatureScreen
|
|
51
|
+
featureId="photo-restoration"
|
|
52
|
+
userId="user-123"
|
|
53
|
+
/>
|
|
54
|
+
)}
|
|
55
|
+
/>
|
|
56
|
+
</Stack.Navigator>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Feature Configuration
|
|
62
|
+
|
|
63
|
+
### AI_FEATURE_CONFIGS
|
|
64
|
+
|
|
65
|
+
Pre-configured feature definitions:
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
import { AI_FEATURE_CONFIGS, getAIFeatureConfig } from '@umituz/react-native-ai-generation-content';
|
|
69
|
+
|
|
70
|
+
// Get config for a feature
|
|
71
|
+
const config = getAIFeatureConfig('text-to-image');
|
|
72
|
+
console.log(config);
|
|
73
|
+
// {
|
|
74
|
+
// id: 'text-to-image',
|
|
75
|
+
// name: 'Text to Image',
|
|
76
|
+
// description: 'Generate images from text',
|
|
77
|
+
// mode: 'single-image-prompt',
|
|
78
|
+
// ...
|
|
79
|
+
// }
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### AIFeatureConfig
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
interface AIFeatureConfig {
|
|
86
|
+
id: AIFeatureId;
|
|
87
|
+
name: string;
|
|
88
|
+
description: string;
|
|
89
|
+
mode: AIFeatureMode;
|
|
90
|
+
outputType: AIFeatureOutputType;
|
|
91
|
+
creditType: AIFeatureCreditType;
|
|
92
|
+
creditCost: number;
|
|
93
|
+
translations?: AIFeatureTranslations;
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Feature IDs
|
|
98
|
+
|
|
99
|
+
### Available Features
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
type AIFeatureId =
|
|
103
|
+
| 'text-to-image'
|
|
104
|
+
| 'text-to-video'
|
|
105
|
+
| 'text-to-voice'
|
|
106
|
+
| 'face-swap'
|
|
107
|
+
| 'photo-restoration'
|
|
108
|
+
| 'upscaling'
|
|
109
|
+
| 'style-transfer'
|
|
110
|
+
| 'hd-touch-up'
|
|
111
|
+
| 'colorization'
|
|
112
|
+
| 'remove-background'
|
|
113
|
+
| 'replace-background'
|
|
114
|
+
| 'remove-object'
|
|
115
|
+
| 'inpainting'
|
|
116
|
+
| 'image-to-image'
|
|
117
|
+
| 'image-to-video'
|
|
118
|
+
| 'ai-hug'
|
|
119
|
+
| 'ai-kiss'
|
|
120
|
+
| 'anime-selfie'
|
|
121
|
+
| 'meme-generator'
|
|
122
|
+
| 'couple-future'
|
|
123
|
+
| 'future-prediction'
|
|
124
|
+
| 'sketch-to-image'
|
|
125
|
+
| 'script-generator'
|
|
126
|
+
| 'audio-generation'
|
|
127
|
+
| 'image-captioning';
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Feature Modes
|
|
131
|
+
|
|
132
|
+
### AIFeatureMode
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
type AIFeatureMode =
|
|
136
|
+
| 'single-image' // Single image input
|
|
137
|
+
| 'dual-image' // Two image inputs
|
|
138
|
+
| 'single-image-prompt' // Image + prompt
|
|
139
|
+
| 'prompt-only' // Text prompt only
|
|
140
|
+
| 'dual-image-video' // Two images/videos
|
|
141
|
+
| 'video-input' // Video input
|
|
142
|
+
| 'text-input-only'; // Text input only
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Screen Props
|
|
146
|
+
|
|
147
|
+
### AIFeatureScreenProps
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
interface AIFeatureScreenProps {
|
|
151
|
+
featureId: AIFeatureId;
|
|
152
|
+
userId: string;
|
|
153
|
+
customConfig?: Partial<AIFeatureConfig>;
|
|
154
|
+
translations?: Partial<AIFeatureTranslations>;
|
|
155
|
+
onResult?: (result: GenerationResult) => void;
|
|
156
|
+
onError?: (error: Error) => void;
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Usage Examples
|
|
161
|
+
|
|
162
|
+
### Basic Usage
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
|
|
166
|
+
|
|
167
|
+
function TextToImageScreen() {
|
|
168
|
+
return (
|
|
169
|
+
<AIFeatureScreen
|
|
170
|
+
featureId="text-to-image"
|
|
171
|
+
userId="user-123"
|
|
172
|
+
/>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### With Custom Config
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
function CustomScreen() {
|
|
181
|
+
return (
|
|
182
|
+
<AIFeatureScreen
|
|
183
|
+
featureId="text-to-image"
|
|
184
|
+
userId="user-123"
|
|
185
|
+
customConfig={{
|
|
186
|
+
creditCost: 2, // Override default cost
|
|
187
|
+
}}
|
|
188
|
+
translations={{
|
|
189
|
+
title: 'Custom Title',
|
|
190
|
+
description: 'Custom Description',
|
|
191
|
+
}}
|
|
192
|
+
onResult={(result) => {
|
|
193
|
+
console.log('Result:', result);
|
|
194
|
+
}}
|
|
195
|
+
onError={(error) => {
|
|
196
|
+
Alert.alert('Error', error.message);
|
|
197
|
+
}}
|
|
198
|
+
/>
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### With Navigation
|
|
204
|
+
|
|
205
|
+
```tsx
|
|
206
|
+
import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
|
|
207
|
+
|
|
208
|
+
function App() {
|
|
209
|
+
return (
|
|
210
|
+
<Stack.Navigator>
|
|
211
|
+
<Stack.Screen
|
|
212
|
+
name="Home"
|
|
213
|
+
component={HomeScreen}
|
|
214
|
+
options={{ title: 'Home' }}
|
|
215
|
+
/>
|
|
216
|
+
<Stack.Screen
|
|
217
|
+
name="AIFeature"
|
|
218
|
+
component={({ route }) => (
|
|
219
|
+
<AIFeatureScreen
|
|
220
|
+
featureId={route.params.featureId}
|
|
221
|
+
userId={route.params.userId}
|
|
222
|
+
/>
|
|
223
|
+
)}
|
|
224
|
+
options={({ route }) => ({
|
|
225
|
+
title: route.params.featureId,
|
|
226
|
+
})}
|
|
227
|
+
/>
|
|
228
|
+
</Stack.Navigator>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Navigate to feature
|
|
233
|
+
navigation.navigate('AIFeature', {
|
|
234
|
+
featureId: 'text-to-image',
|
|
235
|
+
userId: 'user-123',
|
|
236
|
+
});
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Feature Detection
|
|
240
|
+
|
|
241
|
+
### hasAIFeature
|
|
242
|
+
|
|
243
|
+
Check if feature exists:
|
|
244
|
+
|
|
245
|
+
```tsx
|
|
246
|
+
import { hasAIFeature } from '@umituz/react-native-ai-generation-content';
|
|
247
|
+
|
|
248
|
+
if (hasAIFeature('text-to-image')) {
|
|
249
|
+
console.log('Feature exists');
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### getAllAIFeatureIds
|
|
254
|
+
|
|
255
|
+
Get all feature IDs:
|
|
256
|
+
|
|
257
|
+
```tsx
|
|
258
|
+
import { getAllAIFeatureIds } from '@umituz/react-native-ai-generation-content';
|
|
259
|
+
|
|
260
|
+
const features = getAllAIFeatureIds();
|
|
261
|
+
console.log('Available features:', features);
|
|
262
|
+
// ['text-to-image', 'face-swap', 'photo-restoration', ...]
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### getAIFeaturesByMode
|
|
266
|
+
|
|
267
|
+
Get features by mode:
|
|
268
|
+
|
|
269
|
+
```tsx
|
|
270
|
+
import { getAIFeaturesByMode } from '@umituz/react-native-ai-generation-content';
|
|
271
|
+
|
|
272
|
+
const singleImageFeatures = getAIFeaturesByMode('single-image');
|
|
273
|
+
console.log('Single image features:', singleImageFeatures);
|
|
274
|
+
// ['photo-restoration', 'upscaling', 'hd-touch-up', ...]
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Translations
|
|
278
|
+
|
|
279
|
+
### createFeatureTranslations
|
|
280
|
+
|
|
281
|
+
Create translations for a feature:
|
|
282
|
+
|
|
283
|
+
```tsx
|
|
284
|
+
import { createFeatureTranslations } from '@umituz/react-native-ai-generation-content';
|
|
285
|
+
|
|
286
|
+
const translations = createFeatureTranslations({
|
|
287
|
+
title: 'Text to Image',
|
|
288
|
+
description: 'Generate images from text',
|
|
289
|
+
input: {
|
|
290
|
+
prompt: {
|
|
291
|
+
label: 'Prompt',
|
|
292
|
+
placeholder: 'Describe the image...',
|
|
293
|
+
error: 'Please enter a prompt',
|
|
294
|
+
},
|
|
295
|
+
image: {
|
|
296
|
+
label: 'Image',
|
|
297
|
+
placeholder: 'Select an image',
|
|
298
|
+
error: 'Please select an image',
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
actions: {
|
|
302
|
+
generate: 'Generate',
|
|
303
|
+
cancel: 'Cancel',
|
|
304
|
+
save: 'Save',
|
|
305
|
+
share: 'Share',
|
|
306
|
+
},
|
|
307
|
+
status: {
|
|
308
|
+
generating: 'Generating...',
|
|
309
|
+
completed: 'Completed!',
|
|
310
|
+
error: 'Error',
|
|
311
|
+
},
|
|
312
|
+
});
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### createSingleImageTranslations
|
|
316
|
+
|
|
317
|
+
Single image input translations:
|
|
318
|
+
|
|
319
|
+
```tsx
|
|
320
|
+
import { createSingleImageTranslations } from '@umituz/react-native-ai-generation-content';
|
|
321
|
+
|
|
322
|
+
const translations = createSingleImageTranslations({
|
|
323
|
+
imageLabel: 'Upload Photo',
|
|
324
|
+
imagePlaceholder: 'Select a photo to enhance',
|
|
325
|
+
generateButton: 'Enhance Photo',
|
|
326
|
+
});
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### createDualImageTranslations
|
|
330
|
+
|
|
331
|
+
Dual image input translations:
|
|
332
|
+
|
|
333
|
+
```tsx
|
|
334
|
+
import { createDualImageTranslations } from '@umituz/react-native-ai-generation-content';
|
|
335
|
+
|
|
336
|
+
const translations = createDualImageTranslations({
|
|
337
|
+
sourceLabel: 'First Photo',
|
|
338
|
+
targetLabel: 'Second Photo',
|
|
339
|
+
generateButton: 'Process',
|
|
340
|
+
});
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### createPromptTranslations
|
|
344
|
+
|
|
345
|
+
Prompt input translations:
|
|
346
|
+
|
|
347
|
+
```tsx
|
|
348
|
+
import { createPromptTranslations } from '@umituz/react-native-ai-generation-content';
|
|
349
|
+
|
|
350
|
+
const translations = createPromptTranslations({
|
|
351
|
+
label: 'Prompt',
|
|
352
|
+
placeholder: 'Describe what you want to create...',
|
|
353
|
+
charLimit: 1000,
|
|
354
|
+
examples: [
|
|
355
|
+
'A beautiful sunset',
|
|
356
|
+
'A futuristic city',
|
|
357
|
+
'A serene forest',
|
|
358
|
+
],
|
|
359
|
+
});
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
## Custom Screens
|
|
363
|
+
|
|
364
|
+
### Creating Custom Screen
|
|
365
|
+
|
|
366
|
+
```tsx
|
|
367
|
+
import { useTextToImageFeature } from '@umituz/react-native-ai-generation-content';
|
|
368
|
+
|
|
369
|
+
function CustomTextToImageScreen() {
|
|
370
|
+
const feature = useTextToImageFeature({
|
|
371
|
+
config: {
|
|
372
|
+
model: 'imagen-3',
|
|
373
|
+
},
|
|
374
|
+
userId: 'user-123',
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
return (
|
|
378
|
+
<View style={{ flex: 1, padding: 16 }}>
|
|
379
|
+
<Text style={{ fontSize: 24, fontWeight: 'bold' }}>
|
|
380
|
+
AI Image Generator
|
|
381
|
+
</Text>
|
|
382
|
+
|
|
383
|
+
<TextInput
|
|
384
|
+
style={{ height: 100, borderWidth: 1, marginTop: 16 }}
|
|
385
|
+
placeholder="Describe the image..."
|
|
386
|
+
onChangeText={feature.setPrompt}
|
|
387
|
+
value={feature.state.prompt}
|
|
388
|
+
/>
|
|
389
|
+
|
|
390
|
+
<Button
|
|
391
|
+
style={{ marginTop: 16 }}
|
|
392
|
+
onPress={() => feature.generate()}
|
|
393
|
+
disabled={!feature.isReady}
|
|
394
|
+
title="Generate"
|
|
395
|
+
/>
|
|
396
|
+
|
|
397
|
+
{feature.state.isProcessing && (
|
|
398
|
+
<Text style={{ marginTop: 16 }}>
|
|
399
|
+
Generating... {feature.state.progress}%
|
|
400
|
+
</Text>
|
|
401
|
+
)}
|
|
402
|
+
|
|
403
|
+
{feature.state.result && (
|
|
404
|
+
<Image
|
|
405
|
+
source={{ uri: feature.state.result.imageUrl }}
|
|
406
|
+
style={{ width: '100%', height: 300, marginTop: 16 }}
|
|
407
|
+
/>
|
|
408
|
+
)}
|
|
409
|
+
</View>
|
|
410
|
+
);
|
|
411
|
+
}
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
## Best Practices
|
|
415
|
+
|
|
416
|
+
1. **Use AIFeatureScreen**: For standard features, use the unified screen
|
|
417
|
+
2. **Custom Screens**: Create custom screens only when needed
|
|
418
|
+
3. **Translations**: Provide translations for all user-facing text
|
|
419
|
+
4. **Error Handling**: Handle errors gracefully
|
|
420
|
+
5. **Navigation**: Integrate with your navigation system
|
|
421
|
+
|
|
422
|
+
## Related
|
|
423
|
+
|
|
424
|
+
- [Components](../components/) - UI components
|
|
425
|
+
- [Hooks](../hooks/) - Custom hooks
|
|
426
|
+
- [Layouts](../layouts/) - Layout components
|
|
427
|
+
|
|
428
|
+
## License
|
|
429
|
+
|
|
430
|
+
MIT
|
|
@@ -34,7 +34,7 @@ export interface ResultImageConfig {
|
|
|
34
34
|
borderRadius?: number;
|
|
35
35
|
showBadge?: boolean;
|
|
36
36
|
badgePosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
37
|
-
badgeStyle?: "dark" | "light"
|
|
37
|
+
badgeStyle?: "dark" | "light";
|
|
38
38
|
badgeIcon?: string;
|
|
39
39
|
spacing?: {
|
|
40
40
|
marginBottom?: number;
|
|
@@ -59,7 +59,7 @@ export interface ResultStoryConfig {
|
|
|
59
59
|
| "700"
|
|
60
60
|
| "800"
|
|
61
61
|
| "900";
|
|
62
|
-
borderStyle?: "outline" | "filled"
|
|
62
|
+
borderStyle?: "outline" | "filled";
|
|
63
63
|
spacing?: {
|
|
64
64
|
marginBottom?: number;
|
|
65
65
|
paddingHorizontal?: number;
|
|
@@ -149,7 +149,7 @@ export const DEFAULT_RESULT_CONFIG: ResultConfig = {
|
|
|
149
149
|
fontSize: 14,
|
|
150
150
|
fontStyle: "italic",
|
|
151
151
|
fontWeight: "500",
|
|
152
|
-
borderStyle: "
|
|
152
|
+
borderStyle: "filled",
|
|
153
153
|
spacing: {
|
|
154
154
|
marginBottom: 20,
|
|
155
155
|
paddingHorizontal: 20,
|
|
File without changes
|