@umituz/react-native-ai-generation-content 1.17.229 → 1.17.230
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 +234 -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 +228 -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/hooks/README.md +380 -0
- package/src/presentation/layouts/README.md +374 -0
- package/src/presentation/screens/README.md +430 -0
- package/src/presentation/layouts/types/.npmignore.tmp +0 -0
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
# Presentation Layouts
|
|
2
|
+
|
|
3
|
+
Layout components for AI generation features.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The layouts module provides pre-built layout components that combine UI elements into complete screens for common AI generation patterns. These layouts handle the UI structure so you can focus on customization.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- Single image input layouts
|
|
12
|
+
- Dual image input layouts
|
|
13
|
+
- Image with prompt layouts
|
|
14
|
+
- Video generation layouts
|
|
15
|
+
- Result display layouts
|
|
16
|
+
- Progress modal layouts
|
|
17
|
+
|
|
18
|
+
## Layout Types
|
|
19
|
+
|
|
20
|
+
### SingleImageFeatureLayout
|
|
21
|
+
|
|
22
|
+
Layout for features requiring a single image:
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { SingleImageFeatureLayout } from '@umituz/react-native-ai-generation-content';
|
|
26
|
+
|
|
27
|
+
function UpscalingScreen() {
|
|
28
|
+
return (
|
|
29
|
+
<SingleImageFeatureLayout
|
|
30
|
+
featureId="upscaling"
|
|
31
|
+
userId="user-123"
|
|
32
|
+
config={{
|
|
33
|
+
title: 'AI Upscaling',
|
|
34
|
+
description: 'Enhance image resolution with AI',
|
|
35
|
+
showStyleSelector: false,
|
|
36
|
+
showAspectRatioSelector: false,
|
|
37
|
+
}}
|
|
38
|
+
onSelectImage={async () => {
|
|
39
|
+
// Image selection logic
|
|
40
|
+
return selectedImage;
|
|
41
|
+
}}
|
|
42
|
+
onSaveImage={async (imageUrl) => {
|
|
43
|
+
// Save logic
|
|
44
|
+
}}
|
|
45
|
+
onBeforeProcess={async () => {
|
|
46
|
+
// Pre-processing validation
|
|
47
|
+
return true;
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### SingleImageWithPromptFeatureLayout
|
|
55
|
+
|
|
56
|
+
Layout for single image + prompt:
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import { SingleImageWithPromptFeatureLayout } from '@umituz/react-native-ai-generation-content';
|
|
60
|
+
|
|
61
|
+
function ImageToImageScreen() {
|
|
62
|
+
return (
|
|
63
|
+
<SingleImageWithPromptFeatureLayout
|
|
64
|
+
featureId="image-to-image"
|
|
65
|
+
userId="user-123"
|
|
66
|
+
config={{
|
|
67
|
+
title: 'Transform Image',
|
|
68
|
+
description: 'Transform your image with AI',
|
|
69
|
+
promptPlaceholder: 'Describe how to transform the image...',
|
|
70
|
+
showStyleSelector: true,
|
|
71
|
+
showAspectRatioSelector: true,
|
|
72
|
+
}}
|
|
73
|
+
onSelectImage={async () => {
|
|
74
|
+
return selectedImage;
|
|
75
|
+
}}
|
|
76
|
+
onSaveImage={async (imageUrl) => {
|
|
77
|
+
await saveToGallery(imageUrl);
|
|
78
|
+
}}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### DualImageFeatureLayout
|
|
85
|
+
|
|
86
|
+
Layout for dual image features:
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
import { DualImageFeatureLayout } from '@umituz/react-native-ai-generation-content';
|
|
90
|
+
|
|
91
|
+
function FaceSwapScreen() {
|
|
92
|
+
return (
|
|
93
|
+
<DualImageFeatureLayout
|
|
94
|
+
featureId="face-swap"
|
|
95
|
+
userId="user-123"
|
|
96
|
+
config={{
|
|
97
|
+
title: 'Face Swap',
|
|
98
|
+
description: 'Swap faces between two photos',
|
|
99
|
+
sourceLabel: 'Face to Use',
|
|
100
|
+
targetLabel: 'Face to Replace',
|
|
101
|
+
}}
|
|
102
|
+
onSelectSourceImage={async () => {
|
|
103
|
+
return sourceImage;
|
|
104
|
+
}}
|
|
105
|
+
onSelectTargetImage={async () => {
|
|
106
|
+
return targetImage;
|
|
107
|
+
}}
|
|
108
|
+
onSaveImage={async (imageUrl) => {
|
|
109
|
+
await saveToGallery(imageUrl);
|
|
110
|
+
}}
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### DualImageVideoFeatureLayout
|
|
117
|
+
|
|
118
|
+
Layout for dual image/video features:
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
import { DualImageVideoFeatureLayout } from '@umituz/react-native-ai-generation-content';
|
|
122
|
+
|
|
123
|
+
function AIHugScreen() {
|
|
124
|
+
return (
|
|
125
|
+
<DualImageVideoFeatureLayout
|
|
126
|
+
featureId="ai-hug"
|
|
127
|
+
userId="user-123"
|
|
128
|
+
config={{
|
|
129
|
+
title: 'AI Hug',
|
|
130
|
+
description: 'Generate AI hug images',
|
|
131
|
+
inputType: 'image',
|
|
132
|
+
}}
|
|
133
|
+
onSelectSource={async () => {
|
|
134
|
+
return sourceImage;
|
|
135
|
+
}}
|
|
136
|
+
onSelectTarget={async () => {
|
|
137
|
+
return targetImage;
|
|
138
|
+
}}
|
|
139
|
+
onSaveResult={async (url) => {
|
|
140
|
+
await saveToGallery(url);
|
|
141
|
+
}}
|
|
142
|
+
/>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Layout Props
|
|
148
|
+
|
|
149
|
+
### Base Layout Props
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
interface BaseLayoutProps {
|
|
153
|
+
featureId: string;
|
|
154
|
+
userId: string;
|
|
155
|
+
config: {
|
|
156
|
+
title: string;
|
|
157
|
+
description: string;
|
|
158
|
+
showStyleSelector?: boolean;
|
|
159
|
+
showAspectRatioSelector?: boolean;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Single Image Props
|
|
165
|
+
|
|
166
|
+
```tsx
|
|
167
|
+
interface SingleImageFeatureLayoutProps extends BaseLayoutProps {
|
|
168
|
+
onSelectImage: () => Promise<string>;
|
|
169
|
+
onSaveImage: (imageUrl: string) => Promise<void>;
|
|
170
|
+
onBeforeProcess?: () => Promise<boolean>;
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Dual Image Props
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
interface DualImageFeatureLayoutProps extends BaseLayoutProps {
|
|
178
|
+
onSelectSourceImage: () => Promise<string>;
|
|
179
|
+
onSelectTargetImage: () => Promise<string>;
|
|
180
|
+
onSaveImage: (imageUrl: string) => Promise<void>;
|
|
181
|
+
onBeforeProcess?: () => Promise<boolean>;
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Customization
|
|
186
|
+
|
|
187
|
+
### Custom Header
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
<SingleImageFeatureLayout
|
|
191
|
+
featureId="upscaling"
|
|
192
|
+
userId="user-123"
|
|
193
|
+
config={{
|
|
194
|
+
title: 'AI Upscaling',
|
|
195
|
+
description: 'Enhance image resolution',
|
|
196
|
+
}}
|
|
197
|
+
headerComponent={
|
|
198
|
+
<View>
|
|
199
|
+
<Image source={require('./assets/banner.png')} />
|
|
200
|
+
<Text>Custom header content</Text>
|
|
201
|
+
</View>
|
|
202
|
+
}
|
|
203
|
+
onSelectImage={handleSelectImage}
|
|
204
|
+
onSaveImage={handleSaveImage}
|
|
205
|
+
/>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Custom Options
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
<SingleImageWithPromptFeatureLayout
|
|
212
|
+
featureId="image-to-image"
|
|
213
|
+
userId="user-123"
|
|
214
|
+
config={{
|
|
215
|
+
title: 'Transform Image',
|
|
216
|
+
customOptions: (
|
|
217
|
+
<View>
|
|
218
|
+
<Slider
|
|
219
|
+
value={intensity}
|
|
220
|
+
onValueChange={setIntensity}
|
|
221
|
+
/>
|
|
222
|
+
<Text>Intensity: {intensity}</Text>
|
|
223
|
+
</View>
|
|
224
|
+
),
|
|
225
|
+
}}
|
|
226
|
+
onSelectImage={handleSelectImage}
|
|
227
|
+
onSaveImage={handleSaveImage}
|
|
228
|
+
/>
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Custom Result Display
|
|
232
|
+
|
|
233
|
+
```tsx
|
|
234
|
+
<SingleImageFeatureLayout
|
|
235
|
+
featureId="upscaling"
|
|
236
|
+
userId="user-123"
|
|
237
|
+
config={{
|
|
238
|
+
title: 'AI Upscaling',
|
|
239
|
+
customResultRender: (result) => (
|
|
240
|
+
<View>
|
|
241
|
+
<ImageComparison
|
|
242
|
+
original={originalImage}
|
|
243
|
+
result={result.imageUrl}
|
|
244
|
+
/>
|
|
245
|
+
<Button onPress={() => saveResult(result.imageUrl)}>
|
|
246
|
+
Save
|
|
247
|
+
</Button>
|
|
248
|
+
</View>
|
|
249
|
+
),
|
|
250
|
+
}}
|
|
251
|
+
onSelectImage={handleSelectImage}
|
|
252
|
+
onSaveImage={handleSaveImage}
|
|
253
|
+
/>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Translations
|
|
257
|
+
|
|
258
|
+
Layouts support custom translations:
|
|
259
|
+
|
|
260
|
+
```tsx
|
|
261
|
+
<SingleImageFeatureLayout
|
|
262
|
+
featureId="upscaling"
|
|
263
|
+
userId="user-123"
|
|
264
|
+
translations={{
|
|
265
|
+
uploadButton: 'Upload Photo',
|
|
266
|
+
generateButton: 'Enhance Image',
|
|
267
|
+
processing: 'Enhancing...',
|
|
268
|
+
success: 'Image enhanced!',
|
|
269
|
+
error: 'Enhancement failed',
|
|
270
|
+
}}
|
|
271
|
+
onSelectImage={handleSelectImage}
|
|
272
|
+
onSaveImage={handleSaveImage}
|
|
273
|
+
/>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Built-in Screens
|
|
277
|
+
|
|
278
|
+
### AIFeatureScreen
|
|
279
|
+
|
|
280
|
+
Unified AI feature screen:
|
|
281
|
+
|
|
282
|
+
```tsx
|
|
283
|
+
import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
|
|
284
|
+
|
|
285
|
+
function App() {
|
|
286
|
+
return (
|
|
287
|
+
<AIFeatureScreen
|
|
288
|
+
featureId="text-to-image"
|
|
289
|
+
userId="user-123"
|
|
290
|
+
/>
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
This screen automatically:
|
|
296
|
+
- Detects feature type
|
|
297
|
+
- Shows appropriate layout
|
|
298
|
+
- Handles generation flow
|
|
299
|
+
- Displays results
|
|
300
|
+
- Manages errors
|
|
301
|
+
|
|
302
|
+
## Example Implementations
|
|
303
|
+
|
|
304
|
+
### Complete Upscaling Screen
|
|
305
|
+
|
|
306
|
+
```tsx
|
|
307
|
+
import { SingleImageFeatureLayout } from '@umituz/react-native-ai-generation-content';
|
|
308
|
+
|
|
309
|
+
function UpscalingScreen() {
|
|
310
|
+
return (
|
|
311
|
+
<SingleImageFeatureLayout
|
|
312
|
+
featureId="upscaling"
|
|
313
|
+
userId="user-123"
|
|
314
|
+
config={{
|
|
315
|
+
title: 'AI Upscaling',
|
|
316
|
+
description: 'Increase image resolution while maintaining quality',
|
|
317
|
+
showStyleSelector: false,
|
|
318
|
+
showAspectRatioSelector: false,
|
|
319
|
+
customOptions: (
|
|
320
|
+
<GridSelector
|
|
321
|
+
options={[
|
|
322
|
+
{ id: '2x', name: '2x', description: 'Double resolution' },
|
|
323
|
+
{ id: '4x', name: '4x', description: 'Quadruple resolution' },
|
|
324
|
+
]}
|
|
325
|
+
selectedOption="2x"
|
|
326
|
+
/>
|
|
327
|
+
),
|
|
328
|
+
}}
|
|
329
|
+
onSelectImage={async () => {
|
|
330
|
+
const result = await launchImageLibrary();
|
|
331
|
+
if (result.assets) {
|
|
332
|
+
return await convertToBase64(result.assets[0].uri);
|
|
333
|
+
}
|
|
334
|
+
throw new Error('No image selected');
|
|
335
|
+
}}
|
|
336
|
+
onSaveImage={async (imageUrl) => {
|
|
337
|
+
await saveToGallery(imageUrl);
|
|
338
|
+
Alert.alert('Success', 'Image saved to gallery');
|
|
339
|
+
}}
|
|
340
|
+
onBeforeProcess={async () => {
|
|
341
|
+
// Show confirmation
|
|
342
|
+
return new Promise((resolve) => {
|
|
343
|
+
Alert.alert(
|
|
344
|
+
'Confirm Upscaling',
|
|
345
|
+
'This may take a moment. Continue?',
|
|
346
|
+
[
|
|
347
|
+
{ text: 'Cancel', onPress: () => resolve(false) },
|
|
348
|
+
{ text: 'OK', onPress: () => resolve(true) },
|
|
349
|
+
]
|
|
350
|
+
);
|
|
351
|
+
});
|
|
352
|
+
}}
|
|
353
|
+
/>
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
## Best Practices
|
|
359
|
+
|
|
360
|
+
1. **Simplicity**: Use layouts for standard UI patterns
|
|
361
|
+
2. **Customization**: Extend layouts for custom needs
|
|
362
|
+
3. **Consistency**: Keep layouts consistent across features
|
|
363
|
+
4. **Accessibility**: Ensure layouts are accessible
|
|
364
|
+
5. **Performance**: Optimize layout rendering
|
|
365
|
+
|
|
366
|
+
## Related
|
|
367
|
+
|
|
368
|
+
- [Components](../components/) - UI components
|
|
369
|
+
- [Hooks](../hooks/) - Custom hooks
|
|
370
|
+
- [Screens](../screens/) - Screen components
|
|
371
|
+
|
|
372
|
+
## License
|
|
373
|
+
|
|
374
|
+
MIT
|