@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,394 @@
|
|
|
1
|
+
# Creations Domain
|
|
2
|
+
|
|
3
|
+
Gallery and management system for AI-generated content.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Creations domain provides a comprehensive system for managing AI-generated content. It includes features for storing, organizing, filtering, and sharing AI creations across all generation types.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Content Storage**: Store AI-generated images, videos, and audio
|
|
12
|
+
- **Organization**: Organize creations by type, date, and custom tags
|
|
13
|
+
- **Filtering & Sorting**: Advanced filtering and sorting options
|
|
14
|
+
- **Gallery View**: Beautiful gallery grid for browsing creations
|
|
15
|
+
- **Sharing**: Share creations to social media and other platforms
|
|
16
|
+
- **Favorites**: Mark and organize favorite creations
|
|
17
|
+
- **Metadata Management**: Track generation parameters and metadata
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
This domain is part of `@umituz/react-native-ai-generation-content`.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @umituz/react-native-ai-generation-content
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Basic Usage
|
|
28
|
+
|
|
29
|
+
### Using Creations Hook
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { useCreations } from '@umituz/react-native-ai-generation-content';
|
|
33
|
+
|
|
34
|
+
function CreationsGallery() {
|
|
35
|
+
const {
|
|
36
|
+
creations,
|
|
37
|
+
loading,
|
|
38
|
+
error,
|
|
39
|
+
filters,
|
|
40
|
+
setFilters,
|
|
41
|
+
loadMore,
|
|
42
|
+
refresh,
|
|
43
|
+
deleteCreation,
|
|
44
|
+
toggleFavorite,
|
|
45
|
+
} = useCreations({
|
|
46
|
+
userId: 'user-123',
|
|
47
|
+
type: 'image', // 'image' | 'video' | 'audio' | 'all'
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
if (loading) return <ActivityIndicator />;
|
|
51
|
+
if (error) return <Text>Error: {error}</Text>;
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<FlatGrid
|
|
55
|
+
data={creations}
|
|
56
|
+
renderItem={({ item }) => (
|
|
57
|
+
<CreationCard
|
|
58
|
+
creation={item}
|
|
59
|
+
onPress={() => viewCreation(item)}
|
|
60
|
+
onDelete={() => deleteCreation(item.id)}
|
|
61
|
+
onFavorite={() => toggleFavorite(item.id)}
|
|
62
|
+
/>
|
|
63
|
+
)}
|
|
64
|
+
onEndReached={loadMore}
|
|
65
|
+
onEndReachedThreshold={0.5}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Saving Creations
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import { saveCreation } from '@umituz/react-native-ai-generation-content';
|
|
75
|
+
|
|
76
|
+
// After generating content
|
|
77
|
+
const result = await generateImage({ prompt: '...' });
|
|
78
|
+
|
|
79
|
+
await saveCreation({
|
|
80
|
+
userId: 'user-123',
|
|
81
|
+
type: 'image',
|
|
82
|
+
url: result.imageUrl,
|
|
83
|
+
metadata: {
|
|
84
|
+
prompt: '...',
|
|
85
|
+
model: 'imagen-3',
|
|
86
|
+
aspectRatio: '16:9',
|
|
87
|
+
style: 'realistic',
|
|
88
|
+
createdAt: new Date().toISOString(),
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Data Models
|
|
94
|
+
|
|
95
|
+
### Creation
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
interface Creation {
|
|
99
|
+
id: string;
|
|
100
|
+
userId: string;
|
|
101
|
+
type: 'image' | 'video' | 'audio';
|
|
102
|
+
url: string;
|
|
103
|
+
thumbnailUrl?: string;
|
|
104
|
+
metadata: {
|
|
105
|
+
prompt?: string;
|
|
106
|
+
model?: string;
|
|
107
|
+
featureType?: string;
|
|
108
|
+
[key: string]: any;
|
|
109
|
+
};
|
|
110
|
+
tags: string[];
|
|
111
|
+
isFavorite: boolean;
|
|
112
|
+
createdAt: string;
|
|
113
|
+
updatedAt: string;
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### CreationsFilter
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
interface CreationsFilter {
|
|
121
|
+
type?: 'image' | 'video' | 'audio' | 'all';
|
|
122
|
+
featureType?: string; // e.g., 'text-to-image', 'face-swap'
|
|
123
|
+
tags?: string[];
|
|
124
|
+
dateFrom?: Date;
|
|
125
|
+
dateTo?: Date;
|
|
126
|
+
isFavorite?: boolean;
|
|
127
|
+
sortBy?: 'createdAt' | 'updatedAt' | 'name';
|
|
128
|
+
sortOrder?: 'asc' | 'desc';
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Hooks
|
|
133
|
+
|
|
134
|
+
### useCreations
|
|
135
|
+
|
|
136
|
+
Main hook for managing creations:
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
const {
|
|
140
|
+
creations,
|
|
141
|
+
loading,
|
|
142
|
+
error,
|
|
143
|
+
hasMore,
|
|
144
|
+
filters,
|
|
145
|
+
setFilters,
|
|
146
|
+
loadMore,
|
|
147
|
+
refresh,
|
|
148
|
+
deleteCreation,
|
|
149
|
+
toggleFavorite,
|
|
150
|
+
updateTags,
|
|
151
|
+
getCreation,
|
|
152
|
+
} = useCreations(options);
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### useCreationDetails
|
|
156
|
+
|
|
157
|
+
Get details of a specific creation:
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
import { useCreationDetails } from '@umituz/react-native-ai-generation-content';
|
|
161
|
+
|
|
162
|
+
function CreationDetailScreen({ creationId }) {
|
|
163
|
+
const { creation, loading, error, updateMetadata, share } = useCreationDetails({
|
|
164
|
+
creationId,
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
if (loading) return <ActivityIndicator />;
|
|
168
|
+
if (error) return <Text>Error: {error}</Text>;
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<View>
|
|
172
|
+
<Image source={{ uri: creation.url }} />
|
|
173
|
+
<Text>Prompt: {creation.metadata.prompt}</Text>
|
|
174
|
+
<Text>Created: {new Date(creation.createdAt).toLocaleDateString()}</Text>
|
|
175
|
+
<Button title="Share" onPress={() => share(creation)} />
|
|
176
|
+
</View>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### useCreationActions
|
|
182
|
+
|
|
183
|
+
Actions for creations:
|
|
184
|
+
|
|
185
|
+
```tsx
|
|
186
|
+
import { useCreationActions } from '@umituz/react-native-ai-generation-content';
|
|
187
|
+
|
|
188
|
+
const {
|
|
189
|
+
saveToGallery,
|
|
190
|
+
shareToSocialMedia,
|
|
191
|
+
download,
|
|
192
|
+
delete: deleteCreation,
|
|
193
|
+
duplicate,
|
|
194
|
+
exportMetadata,
|
|
195
|
+
} = useCreationActions();
|
|
196
|
+
|
|
197
|
+
// Save to device gallery
|
|
198
|
+
await saveToGallery(creation);
|
|
199
|
+
|
|
200
|
+
// Share to social media
|
|
201
|
+
await shareToSocialMedia({
|
|
202
|
+
creation,
|
|
203
|
+
platform: 'instagram', // 'instagram' | 'facebook' | 'twitter' | 'whatsapp'
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// Download to device
|
|
207
|
+
await download(creation);
|
|
208
|
+
|
|
209
|
+
// Delete creation
|
|
210
|
+
await deleteCreation(creation.id);
|
|
211
|
+
|
|
212
|
+
// Duplicate creation
|
|
213
|
+
await duplicate(creation);
|
|
214
|
+
|
|
215
|
+
// Export metadata
|
|
216
|
+
const metadata = await exportMetadata(creation);
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Components
|
|
220
|
+
|
|
221
|
+
### CreationsGallery
|
|
222
|
+
|
|
223
|
+
```tsx
|
|
224
|
+
import { CreationsGallery } from '@umituz/react-native-ai-generation-content';
|
|
225
|
+
|
|
226
|
+
<CreationsGallery
|
|
227
|
+
userId="user-123"
|
|
228
|
+
type="image"
|
|
229
|
+
filters={{
|
|
230
|
+
featureType: 'text-to-image',
|
|
231
|
+
isFavorite: false,
|
|
232
|
+
sortBy: 'createdAt',
|
|
233
|
+
sortOrder: 'desc',
|
|
234
|
+
}}
|
|
235
|
+
onCreationPress={(creation) => console.log('Pressed:', creation)}
|
|
236
|
+
onCreationLongPress={(creation) => console.log('Long pressed:', creation)}
|
|
237
|
+
onRefresh={() => console.log('Refreshed')}
|
|
238
|
+
/>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### CreationCard
|
|
242
|
+
|
|
243
|
+
```tsx
|
|
244
|
+
import { CreationCard } from '@umituz/react-native-ai-generation-content';
|
|
245
|
+
|
|
246
|
+
<CreationCard
|
|
247
|
+
creation={creation}
|
|
248
|
+
onPress={() => viewCreation(creation)}
|
|
249
|
+
onLongPress={() => showOptions(creation)}
|
|
250
|
+
showMetadata
|
|
251
|
+
showFavoriteButton
|
|
252
|
+
onFavoriteToggle={() => toggleFavorite(creation.id)}
|
|
253
|
+
/>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### CreationFilterBar
|
|
257
|
+
|
|
258
|
+
```tsx
|
|
259
|
+
import { CreationFilterBar } from '@umituz/react-native-ai-generation-content';
|
|
260
|
+
|
|
261
|
+
<CreationFilterBar
|
|
262
|
+
filters={filters}
|
|
263
|
+
onFiltersChange={setFilters}
|
|
264
|
+
availableTypes={['image', 'video', 'audio']}
|
|
265
|
+
availableFeatures={['text-to-image', 'face-swap', 'style-transfer']}
|
|
266
|
+
availableTags={['portrait', 'landscape', 'artistic']}
|
|
267
|
+
/>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Filtering Examples
|
|
271
|
+
|
|
272
|
+
### Filter by Type
|
|
273
|
+
|
|
274
|
+
```tsx
|
|
275
|
+
setFilters({
|
|
276
|
+
type: 'image',
|
|
277
|
+
});
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Filter by Feature
|
|
281
|
+
|
|
282
|
+
```tsx
|
|
283
|
+
setFilters({
|
|
284
|
+
featureType: 'text-to-image',
|
|
285
|
+
});
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Filter by Date Range
|
|
289
|
+
|
|
290
|
+
```tsx
|
|
291
|
+
setFilters({
|
|
292
|
+
dateFrom: new Date('2024-01-01'),
|
|
293
|
+
dateTo: new Date('2024-12-31'),
|
|
294
|
+
});
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Filter by Tags
|
|
298
|
+
|
|
299
|
+
```tsx
|
|
300
|
+
setFilters({
|
|
301
|
+
tags: ['portrait', 'artistic'],
|
|
302
|
+
});
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Filter by Favorites
|
|
306
|
+
|
|
307
|
+
```tsx
|
|
308
|
+
setFilters({
|
|
309
|
+
isFavorite: true,
|
|
310
|
+
});
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Sort Options
|
|
314
|
+
|
|
315
|
+
```tsx
|
|
316
|
+
setFilters({
|
|
317
|
+
sortBy: 'createdAt',
|
|
318
|
+
sortOrder: 'desc', // Newest first
|
|
319
|
+
});
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
## Advanced Usage
|
|
323
|
+
|
|
324
|
+
### Custom Storage Backend
|
|
325
|
+
|
|
326
|
+
```tsx
|
|
327
|
+
import { CreationsRepository } from '@umituz/react-native-ai-generation-content';
|
|
328
|
+
|
|
329
|
+
class CustomCreationsRepository extends CreationsRepository {
|
|
330
|
+
async save(creation: Creation): Promise<void> {
|
|
331
|
+
// Custom save logic (e.g., to your own backend)
|
|
332
|
+
await api.post('/creations', creation);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
async getAll(filters: CreationsFilter): Promise<Creation[]> {
|
|
336
|
+
// Custom fetch logic
|
|
337
|
+
const response = await api.get('/creations', { params: filters });
|
|
338
|
+
return response.data;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### Batch Operations
|
|
344
|
+
|
|
345
|
+
```tsx
|
|
346
|
+
import { batchDeleteCreations, batchUpdateTags } from '@umituz/react-native-ai-generation-content';
|
|
347
|
+
|
|
348
|
+
// Delete multiple creations
|
|
349
|
+
await batchDeleteCreations(['id1', 'id2', 'id3']);
|
|
350
|
+
|
|
351
|
+
// Update tags for multiple creations
|
|
352
|
+
await batchUpdateTags({
|
|
353
|
+
creationIds: ['id1', 'id2', 'id3'],
|
|
354
|
+
tags: ['portrait', 'professional'],
|
|
355
|
+
mode: 'replace', // 'replace' | 'append' | 'remove'
|
|
356
|
+
});
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Export Creations
|
|
360
|
+
|
|
361
|
+
```tsx
|
|
362
|
+
import { exportCreations, exportCreationMetadata } from '@umituz/react-native-ai-generation-content';
|
|
363
|
+
|
|
364
|
+
// Export creations to ZIP
|
|
365
|
+
const zipFile = await exportCreations({
|
|
366
|
+
creationIds: ['id1', 'id2', 'id3'],
|
|
367
|
+
includeMetadata: true,
|
|
368
|
+
format: 'zip',
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
// Export metadata as JSON
|
|
372
|
+
const metadata = await exportCreationMetadata({
|
|
373
|
+
creationIds: ['id1', 'id2', 'id3'],
|
|
374
|
+
format: 'json',
|
|
375
|
+
});
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
## Best Practices
|
|
379
|
+
|
|
380
|
+
1. **Metadata**: Always save relevant metadata for future reference
|
|
381
|
+
2. **Tagging**: Use consistent tagging for easy organization
|
|
382
|
+
3. **Cleanup**: Regularly clean up unwanted creations
|
|
383
|
+
4. **Backup**: Implement backup for important creations
|
|
384
|
+
5. **Privacy**: Respect user privacy when storing creations
|
|
385
|
+
|
|
386
|
+
## Related Features
|
|
387
|
+
|
|
388
|
+
- [Prompts](../prompts) - AI prompt management
|
|
389
|
+
- [Content Moderation](../content-moderation) - Content moderation
|
|
390
|
+
- [Face Detection](../face-detection) - Face detection API
|
|
391
|
+
|
|
392
|
+
## License
|
|
393
|
+
|
|
394
|
+
MIT
|