@umituz/react-native-ai-generation-content 1.80.4 → 1.81.0
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 +1 -1
- package/src/core/constants/animation.constants.ts +17 -0
- package/src/core/constants/aspect-ratio.constants.ts +24 -0
- package/src/core/constants/duration-options.constants.ts +12 -0
- package/src/core/constants/image.constants.ts +31 -0
- package/src/core/constants/index.ts +49 -0
- package/src/core/constants/model.constants.ts +11 -0
- package/src/core/constants/polling.constants.ts +12 -0
- package/src/core/constants/preset-styles.constants.ts +76 -0
- package/src/core/constants/script-durations.constants.ts +3 -0
- package/src/core/constants/status.constants.ts +24 -0
- package/src/core/constants/style-options.constants.ts +18 -0
- package/src/core/constants/text-to-image-models.constants.ts +18 -0
- package/src/core/constants/validation.constants.ts +45 -0
- package/src/core/constants/video.constants.ts +79 -0
- package/src/core/index.ts +3 -0
- package/src/index.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.81.0",
|
|
4
4
|
"description": "Provider-agnostic AI generation orchestration for React Native with result preview components",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animation Constants
|
|
3
|
+
* Single Responsibility: Define animation style constants
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const ANIMATION_STYLE = {
|
|
7
|
+
ZOOM: "zoom",
|
|
8
|
+
PAN: "pan",
|
|
9
|
+
KEN_BURNS: "ken_burns",
|
|
10
|
+
NONE: "none",
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
export type AnimationStyle =
|
|
14
|
+
| typeof ANIMATION_STYLE.ZOOM
|
|
15
|
+
| typeof ANIMATION_STYLE.PAN
|
|
16
|
+
| typeof ANIMATION_STYLE.KEN_BURNS
|
|
17
|
+
| typeof ANIMATION_STYLE.NONE;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aspect Ratio Constants
|
|
3
|
+
* Single Responsibility: Define aspect ratio constants for AI generation
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const ASPECT_RATIO = {
|
|
7
|
+
LANDSCAPE: "16:9",
|
|
8
|
+
PORTRAIT: "9:16",
|
|
9
|
+
SQUARE: "1:1",
|
|
10
|
+
} as const;
|
|
11
|
+
|
|
12
|
+
export type AspectRatio =
|
|
13
|
+
| typeof ASPECT_RATIO.LANDSCAPE
|
|
14
|
+
| typeof ASPECT_RATIO.PORTRAIT
|
|
15
|
+
| typeof ASPECT_RATIO.SQUARE;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Default image sizes based on aspect ratio
|
|
19
|
+
*/
|
|
20
|
+
export const DEFAULT_IMAGE_SIZES: Record<AspectRatio, string> = {
|
|
21
|
+
[ASPECT_RATIO.LANDSCAPE]: "1024x576",
|
|
22
|
+
[ASPECT_RATIO.PORTRAIT]: "576x1024",
|
|
23
|
+
[ASPECT_RATIO.SQUARE]: "1024x1024",
|
|
24
|
+
} as const;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image Generation Constants
|
|
3
|
+
* Single Responsibility: Define image generation constants
|
|
4
|
+
*
|
|
5
|
+
* NOTE: For AI model names, use DEFAULT_MODELS from model.constants.ts
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const IMAGE_SIZE = {
|
|
9
|
+
SMALL: "512x512",
|
|
10
|
+
MEDIUM: "768x768",
|
|
11
|
+
LARGE: "1024x1024",
|
|
12
|
+
PORTRAIT_LARGE: "1024x1792",
|
|
13
|
+
LANDSCAPE_LARGE: "1792x1024",
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
export type ImageSize =
|
|
17
|
+
| typeof IMAGE_SIZE.SMALL
|
|
18
|
+
| typeof IMAGE_SIZE.MEDIUM
|
|
19
|
+
| typeof IMAGE_SIZE.LARGE
|
|
20
|
+
| typeof IMAGE_SIZE.PORTRAIT_LARGE
|
|
21
|
+
| typeof IMAGE_SIZE.LANDSCAPE_LARGE;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Default number of images to generate
|
|
25
|
+
*/
|
|
26
|
+
export const DEFAULT_NUM_IMAGES = 1;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Default guidance scale for image generation
|
|
30
|
+
*/
|
|
31
|
+
export const DEFAULT_IMAGE_GUIDANCE_SCALE = 7.5;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Generation Constants
|
|
3
|
+
* Generic constants reusable across any AI generation app
|
|
4
|
+
*
|
|
5
|
+
* Note: AspectRatio, StyleOption, DurationOption, AnimationStyle, VideoDuration
|
|
6
|
+
* already exist in the feature domains with their own names.
|
|
7
|
+
* Here we export the raw config constants (not UI-specific types).
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// Video resolution options
|
|
11
|
+
export {
|
|
12
|
+
VIDEO_RESOLUTION,
|
|
13
|
+
VIDEO_RESOLUTION_OPTIONS,
|
|
14
|
+
DEFAULT_MOTION_STRENGTH,
|
|
15
|
+
DEFAULT_GUIDANCE_SCALE,
|
|
16
|
+
} from "./video.constants";
|
|
17
|
+
export type { VideoResolution } from "./video.constants";
|
|
18
|
+
|
|
19
|
+
// Video duration options
|
|
20
|
+
export {
|
|
21
|
+
VIDEO_DURATION,
|
|
22
|
+
VIDEO_DURATION_OPTIONS,
|
|
23
|
+
VIDEO_DURATION_OPTIONS_WITH_LABELS,
|
|
24
|
+
VIDEO_ASPECT_RATIO,
|
|
25
|
+
VIDEO_ASPECT_RATIO_OPTIONS,
|
|
26
|
+
} from "./video.constants";
|
|
27
|
+
export type { VideoAspectRatio } from "./video.constants";
|
|
28
|
+
|
|
29
|
+
// Image constants
|
|
30
|
+
export {
|
|
31
|
+
IMAGE_SIZE,
|
|
32
|
+
DEFAULT_NUM_IMAGES,
|
|
33
|
+
DEFAULT_IMAGE_GUIDANCE_SCALE,
|
|
34
|
+
} from "./image.constants";
|
|
35
|
+
|
|
36
|
+
// Aspect ratio config
|
|
37
|
+
export { ASPECT_RATIO, DEFAULT_IMAGE_SIZES } from "./aspect-ratio.constants";
|
|
38
|
+
|
|
39
|
+
// Status constants
|
|
40
|
+
export { FAL_AI_STATUS, CREATION_STATUS, PROVIDER } from "./status.constants";
|
|
41
|
+
|
|
42
|
+
// Validation limits
|
|
43
|
+
export { VALIDATION_LIMITS } from "./validation.constants";
|
|
44
|
+
|
|
45
|
+
// Polling config
|
|
46
|
+
export { POLLING_CONFIG } from "./polling.constants";
|
|
47
|
+
|
|
48
|
+
// Animation style options
|
|
49
|
+
export { ANIMATION_STYLE } from "./animation.constants";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Model Constants
|
|
3
|
+
* Single Source of Truth for all AI model IDs
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const DEFAULT_MODELS = {
|
|
7
|
+
TEXT_TO_IMAGE: "xai/grok-imagine-image",
|
|
8
|
+
TEXT_TO_VIDEO: "xai/grok-imagine-video/text-to-video",
|
|
9
|
+
IMAGE_TO_VIDEO: "xai/grok-imagine-video/image-to-video",
|
|
10
|
+
SCENARIO_VIDEO: "fal-ai/ltx-video",
|
|
11
|
+
} as const;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Job Polling Constants
|
|
3
|
+
* Single Responsibility: Define polling configuration constants
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const POLLING_CONFIG = {
|
|
7
|
+
MAX_ATTEMPTS: 60,
|
|
8
|
+
INTERVAL_MS: 5000,
|
|
9
|
+
INITIAL_PROGRESS: 20,
|
|
10
|
+
FINAL_PROGRESS: 90,
|
|
11
|
+
COMPLETION_PROGRESS: 100,
|
|
12
|
+
} as const;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preset Styles Constants
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface PresetStyle {
|
|
6
|
+
id: string;
|
|
7
|
+
emoji: string;
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
prompt: string;
|
|
11
|
+
style: string;
|
|
12
|
+
duration: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const PRESET_STYLES: PresetStyle[] = [
|
|
16
|
+
{
|
|
17
|
+
id: "birthday",
|
|
18
|
+
emoji: "🎉",
|
|
19
|
+
name: "Birthday",
|
|
20
|
+
description: "Celebration with balloons & confetti",
|
|
21
|
+
prompt:
|
|
22
|
+
"Create a joyful birthday celebration video with colorful balloons, confetti animations, happy birthday text effects, and party atmosphere",
|
|
23
|
+
style: "playful",
|
|
24
|
+
duration: 4,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "social",
|
|
28
|
+
emoji: "📱",
|
|
29
|
+
name: "Social Media",
|
|
30
|
+
description: "Modern intro with colors",
|
|
31
|
+
prompt:
|
|
32
|
+
"Create a modern social media intro with solid background, smooth transitions, trending aesthetics, and attention-grabbing text",
|
|
33
|
+
style: "vibrant",
|
|
34
|
+
duration: 4,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "business",
|
|
38
|
+
emoji: "💼",
|
|
39
|
+
name: "Business",
|
|
40
|
+
description: "Professional presentation",
|
|
41
|
+
prompt:
|
|
42
|
+
"Create a professional business presentation video with clean design, corporate colors, elegant transitions, and polished look",
|
|
43
|
+
style: "professional",
|
|
44
|
+
duration: 4,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: "education",
|
|
48
|
+
emoji: "🎓",
|
|
49
|
+
name: "Education",
|
|
50
|
+
description: "Tutorial & learning content",
|
|
51
|
+
prompt:
|
|
52
|
+
"Create an educational tutorial video with clear step-by-step structure, informative text, learning-friendly design",
|
|
53
|
+
style: "minimal",
|
|
54
|
+
duration: 4,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "music",
|
|
58
|
+
emoji: "🎵",
|
|
59
|
+
name: "Music Video",
|
|
60
|
+
description: "Vibrant & energetic visuals",
|
|
61
|
+
prompt:
|
|
62
|
+
"Create a music video with vibrant colors, rhythm-synced animations, abstract shapes, and energetic motion",
|
|
63
|
+
style: "vibrant",
|
|
64
|
+
duration: 4,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: "promo",
|
|
68
|
+
emoji: "🔥",
|
|
69
|
+
name: "Promotion",
|
|
70
|
+
description: "Product showcase & ads",
|
|
71
|
+
prompt:
|
|
72
|
+
"Create an engaging product promotion video with dynamic animations, call-to-action text, bold colors, and persuasive messaging",
|
|
73
|
+
style: "modern",
|
|
74
|
+
duration: 4,
|
|
75
|
+
},
|
|
76
|
+
];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Generation Status Constants
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export const FAL_AI_STATUS = {
|
|
6
|
+
IN_QUEUE: "IN_QUEUE",
|
|
7
|
+
QUEUED: "QUEUED",
|
|
8
|
+
IN_PROGRESS: "IN_PROGRESS",
|
|
9
|
+
PROCESSING: "PROCESSING",
|
|
10
|
+
COMPLETED: "COMPLETED",
|
|
11
|
+
FAILED: "FAILED",
|
|
12
|
+
} as const;
|
|
13
|
+
|
|
14
|
+
export const CREATION_STATUS = {
|
|
15
|
+
PENDING: "pending",
|
|
16
|
+
QUEUED: "queued",
|
|
17
|
+
PROCESSING: "processing",
|
|
18
|
+
COMPLETED: "completed",
|
|
19
|
+
FAILED: "failed",
|
|
20
|
+
} as const;
|
|
21
|
+
|
|
22
|
+
export const PROVIDER = {
|
|
23
|
+
FAL: "fal",
|
|
24
|
+
} as const;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Style Options Constants
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface StyleOption {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
icon: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const STYLE_OPTIONS: StyleOption[] = [
|
|
12
|
+
{ id: "modern", label: "Modern", icon: "Zap" },
|
|
13
|
+
{ id: "minimal", label: "Minimal", icon: "Minus" },
|
|
14
|
+
{ id: "vibrant", label: "Vibrant", icon: "sparkles" },
|
|
15
|
+
{ id: "professional", label: "Professional", icon: "Briefcase" },
|
|
16
|
+
{ id: "playful", label: "Playful", icon: "Smile" },
|
|
17
|
+
{ id: "elegant", label: "Elegant", icon: "Award" },
|
|
18
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text-to-Image Models Configuration
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { FalModelConfig } from "@umituz/react-native-ai-fal-provider";
|
|
6
|
+
|
|
7
|
+
export const TEXT_TO_IMAGE_MODELS: FalModelConfig[] = [
|
|
8
|
+
{
|
|
9
|
+
id: "xai/grok-imagine-image",
|
|
10
|
+
name: "Grok Imagine",
|
|
11
|
+
type: "text-to-image",
|
|
12
|
+
isDefault: true,
|
|
13
|
+
isActive: true,
|
|
14
|
+
pricing: { freeUserCost: 0.5, premiumUserCost: 0.25 },
|
|
15
|
+
description: "X.AI's cost-effective text-to-image generation ($0.02/image)",
|
|
16
|
+
order: 1,
|
|
17
|
+
},
|
|
18
|
+
];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation Constants
|
|
3
|
+
* Single Responsibility: Define validation limits and rules
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const VALIDATION_LIMITS = {
|
|
7
|
+
/**
|
|
8
|
+
* Prompt validation limits
|
|
9
|
+
*/
|
|
10
|
+
PROMPT: {
|
|
11
|
+
MIN_LENGTH: 3,
|
|
12
|
+
MAX_LENGTH: 5000,
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Text-to-voice validation limits
|
|
17
|
+
*/
|
|
18
|
+
TEXT_TO_VOICE: {
|
|
19
|
+
MAX_LENGTH: 5000,
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Number of images validation
|
|
24
|
+
*/
|
|
25
|
+
NUM_IMAGES: {
|
|
26
|
+
MIN: 1,
|
|
27
|
+
MAX: 4,
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Guidance scale validation
|
|
32
|
+
*/
|
|
33
|
+
GUIDANCE_SCALE: {
|
|
34
|
+
MIN: 1,
|
|
35
|
+
MAX: 20,
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Seed validation
|
|
40
|
+
*/
|
|
41
|
+
SEED: {
|
|
42
|
+
MIN: 0,
|
|
43
|
+
MAX: 2147483647, // 32-bit integer max
|
|
44
|
+
},
|
|
45
|
+
} as const;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video Generation Constants
|
|
3
|
+
* Single Responsibility: Define video generation constants
|
|
4
|
+
*
|
|
5
|
+
* Grok Imagine Video supports:
|
|
6
|
+
* - Duration: 4, 5, 6 seconds
|
|
7
|
+
* - Resolution: 480p, 720p ($0.05/sec @ 480p, $0.07/sec @ 720p)
|
|
8
|
+
* - Aspect Ratio: 16:9, 9:16
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export const VIDEO_DURATION = {
|
|
12
|
+
SHORT: 4,
|
|
13
|
+
MEDIUM: 8,
|
|
14
|
+
LONG: 12,
|
|
15
|
+
} as const;
|
|
16
|
+
|
|
17
|
+
export type VideoDuration =
|
|
18
|
+
| typeof VIDEO_DURATION.SHORT
|
|
19
|
+
| typeof VIDEO_DURATION.MEDIUM
|
|
20
|
+
| typeof VIDEO_DURATION.LONG;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Duration options for video generation (fixed to 4 seconds)
|
|
24
|
+
*/
|
|
25
|
+
export const VIDEO_DURATION_OPTIONS: VideoDuration[] = [4];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Duration options with labels (for DurationSelector components)
|
|
29
|
+
*/
|
|
30
|
+
export const VIDEO_DURATION_OPTIONS_WITH_LABELS: Array<{
|
|
31
|
+
value: VideoDuration;
|
|
32
|
+
label: string;
|
|
33
|
+
}> = [{ value: 4, label: "4s" }];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Video Aspect Ratio options
|
|
37
|
+
*/
|
|
38
|
+
export const VIDEO_ASPECT_RATIO = {
|
|
39
|
+
LANDSCAPE: "16:9",
|
|
40
|
+
PORTRAIT: "9:16",
|
|
41
|
+
} as const;
|
|
42
|
+
|
|
43
|
+
export type VideoAspectRatio =
|
|
44
|
+
| typeof VIDEO_ASPECT_RATIO.LANDSCAPE
|
|
45
|
+
| typeof VIDEO_ASPECT_RATIO.PORTRAIT;
|
|
46
|
+
|
|
47
|
+
export const VIDEO_ASPECT_RATIO_OPTIONS: VideoAspectRatio[] = ["16:9", "9:16"];
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Video Resolution options
|
|
51
|
+
*/
|
|
52
|
+
export const VIDEO_RESOLUTION = {
|
|
53
|
+
DEFAULT: "default",
|
|
54
|
+
SD_480P: "480p",
|
|
55
|
+
HD_720P: "720p",
|
|
56
|
+
} as const;
|
|
57
|
+
|
|
58
|
+
export type VideoResolution =
|
|
59
|
+
| typeof VIDEO_RESOLUTION.DEFAULT
|
|
60
|
+
| typeof VIDEO_RESOLUTION.SD_480P
|
|
61
|
+
| typeof VIDEO_RESOLUTION.HD_720P;
|
|
62
|
+
|
|
63
|
+
export const VIDEO_RESOLUTION_OPTIONS: Array<{
|
|
64
|
+
value: VideoResolution;
|
|
65
|
+
label: string;
|
|
66
|
+
}> = [
|
|
67
|
+
{ value: "480p", label: "Standard (480p)" },
|
|
68
|
+
{ value: "720p", label: "HD (720p)" },
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Default motion strength for video generation
|
|
73
|
+
*/
|
|
74
|
+
export const DEFAULT_MOTION_STRENGTH = 0.7;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Default guidance scale for text-to-video
|
|
78
|
+
*/
|
|
79
|
+
export const DEFAULT_GUIDANCE_SCALE = 12;
|
package/src/core/index.ts
CHANGED
|
@@ -54,6 +54,9 @@ export type {
|
|
|
54
54
|
IAIProvider,
|
|
55
55
|
} from "../domain/interfaces/ai-provider.interface";
|
|
56
56
|
|
|
57
|
+
// Generation Constants
|
|
58
|
+
export * from "./constants";
|
|
59
|
+
|
|
57
60
|
// Segregated provider sub-interfaces
|
|
58
61
|
export type { IAIProviderLifecycle } from "../domain/interfaces/provider-lifecycle.interface";
|
|
59
62
|
export type { IAIProviderCapabilities } from "../domain/interfaces/provider-capabilities.interface";
|
package/src/index.ts
CHANGED
|
@@ -46,3 +46,6 @@ export type { VideoModelConfig, ModelCapabilityOption } from "./domain/interface
|
|
|
46
46
|
|
|
47
47
|
// Wizard Config Builder (generates wizard steps from VideoModelConfig)
|
|
48
48
|
export { buildWizardConfigFromModelConfig } from "./domains/generation/wizard/utilities/build-wizard-config";
|
|
49
|
+
|
|
50
|
+
// Generation Constants (VideoResolution, AspectRatio, StyleOptions, etc.)
|
|
51
|
+
export * from "./core/constants";
|