@umituz/react-native-ai-generation-content 1.62.0 → 1.62.2
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/domains/image-to-video/domain/index.ts +0 -3
- package/src/domains/image-to-video/domain/types/config.types.ts +0 -6
- package/src/domains/image-to-video/domain/types/form.types.ts +0 -6
- package/src/domains/image-to-video/domain/types/image-to-video.types.ts +0 -4
- package/src/domains/image-to-video/index.ts +0 -13
- package/src/domains/image-to-video/presentation/hooks/useFormState.ts +6 -26
- package/src/domains/image-to-video/presentation/hooks/useImageToVideoForm.ts +0 -23
- package/src/exports/features.ts +0 -3
- package/src/domains/image-to-video/domain/constants/animation.constants.ts +0 -47
- package/src/domains/image-to-video/domain/constants/duration.constants.ts +0 -12
- package/src/domains/image-to-video/domain/constants/form.constants.ts +0 -22
- package/src/domains/image-to-video/domain/constants/index.ts +0 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.62.
|
|
3
|
+
"version": "1.62.2",
|
|
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",
|
|
@@ -9,7 +9,6 @@ import type { ImageToVideoFormState } from "./form.types";
|
|
|
9
9
|
export interface ImageToVideoCallbacks {
|
|
10
10
|
onGenerate: (formState: ImageToVideoFormState) => Promise<void>;
|
|
11
11
|
onSelectImages?: () => Promise<string[]>;
|
|
12
|
-
onSelectCustomAudio?: () => Promise<string | null>;
|
|
13
12
|
onCreditCheck?: (cost: number) => boolean;
|
|
14
13
|
onShowPaywall?: (cost: number) => void;
|
|
15
14
|
onSuccess?: (result: ImageToVideoResult) => void;
|
|
@@ -19,7 +18,6 @@ export interface ImageToVideoCallbacks {
|
|
|
19
18
|
export interface ImageToVideoFormConfig {
|
|
20
19
|
maxImages?: number;
|
|
21
20
|
creditCost?: number;
|
|
22
|
-
enableCustomAudio?: boolean;
|
|
23
21
|
enableMotionPrompt?: boolean;
|
|
24
22
|
}
|
|
25
23
|
|
|
@@ -28,7 +26,6 @@ export interface ImageToVideoTranslationsExtended {
|
|
|
28
26
|
selectedImages: string;
|
|
29
27
|
animationStyle: string;
|
|
30
28
|
durationPerImage: string;
|
|
31
|
-
addMusic: string;
|
|
32
29
|
};
|
|
33
30
|
imageSelection: {
|
|
34
31
|
selectImages: string;
|
|
@@ -38,9 +35,6 @@ export interface ImageToVideoTranslationsExtended {
|
|
|
38
35
|
duration: {
|
|
39
36
|
totalVideo: string;
|
|
40
37
|
};
|
|
41
|
-
music: {
|
|
42
|
-
customAudioSelected: string;
|
|
43
|
-
};
|
|
44
38
|
hero: {
|
|
45
39
|
title: string;
|
|
46
40
|
subtitle: string;
|
|
@@ -4,15 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { AnimationStyleId } from "./animation.types";
|
|
7
|
-
import type { MusicMoodId } from "./music.types";
|
|
8
7
|
import type { VideoDuration } from "./duration.types";
|
|
9
8
|
|
|
10
9
|
export interface ImageToVideoFormState {
|
|
11
10
|
selectedImages: string[];
|
|
12
11
|
animationStyle: AnimationStyleId;
|
|
13
12
|
duration: VideoDuration;
|
|
14
|
-
musicMood: MusicMoodId;
|
|
15
|
-
customAudioUri: string | null;
|
|
16
13
|
motionPrompt: string;
|
|
17
14
|
}
|
|
18
15
|
|
|
@@ -22,8 +19,6 @@ export interface ImageToVideoFormActions {
|
|
|
22
19
|
removeImage: (index: number) => void;
|
|
23
20
|
setAnimationStyle: (style: AnimationStyleId) => void;
|
|
24
21
|
setDuration: (duration: VideoDuration) => void;
|
|
25
|
-
setMusicMood: (mood: MusicMoodId) => void;
|
|
26
|
-
setCustomAudioUri: (uri: string | null) => void;
|
|
27
22
|
setMotionPrompt: (prompt: string) => void;
|
|
28
23
|
reset: () => void;
|
|
29
24
|
}
|
|
@@ -31,5 +26,4 @@ export interface ImageToVideoFormActions {
|
|
|
31
26
|
export interface ImageToVideoFormDefaults {
|
|
32
27
|
animationStyle?: AnimationStyleId;
|
|
33
28
|
duration?: VideoDuration;
|
|
34
|
-
musicMood?: MusicMoodId;
|
|
35
29
|
}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { AnimationStyleId } from "./animation.types";
|
|
7
|
-
import type { MusicMoodId } from "./music.types";
|
|
8
7
|
import type { VideoDuration } from "./duration.types";
|
|
9
8
|
|
|
10
9
|
export interface ImageToVideoOptions {
|
|
@@ -13,7 +12,6 @@ export interface ImageToVideoOptions {
|
|
|
13
12
|
aspectRatio?: "16:9" | "9:16" | "1:1";
|
|
14
13
|
fps?: number;
|
|
15
14
|
animationStyle?: AnimationStyleId;
|
|
16
|
-
musicMood?: MusicMoodId;
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
export interface ImageToVideoGenerateParams extends ImageToVideoOptions {
|
|
@@ -28,10 +26,8 @@ export interface ImageToVideoRequest {
|
|
|
28
26
|
motionPrompt?: string;
|
|
29
27
|
options?: ImageToVideoOptions;
|
|
30
28
|
allImages?: string[];
|
|
31
|
-
customAudioUri?: string | null;
|
|
32
29
|
animationStyle?: AnimationStyleId;
|
|
33
30
|
duration?: VideoDuration;
|
|
34
|
-
musicMood?: MusicMoodId;
|
|
35
31
|
model?: string;
|
|
36
32
|
}
|
|
37
33
|
|
|
@@ -44,19 +44,6 @@ export type {
|
|
|
44
44
|
ImageToVideoFeatureConfig,
|
|
45
45
|
} from "./domain";
|
|
46
46
|
|
|
47
|
-
// =============================================================================
|
|
48
|
-
// DOMAIN LAYER - Constants
|
|
49
|
-
// =============================================================================
|
|
50
|
-
|
|
51
|
-
export {
|
|
52
|
-
DEFAULT_ANIMATION_STYLES as IMAGE_TO_VIDEO_ANIMATION_STYLES,
|
|
53
|
-
DEFAULT_ANIMATION_STYLE_ID as IMAGE_TO_VIDEO_DEFAULT_ANIMATION,
|
|
54
|
-
DEFAULT_DURATION_OPTIONS as IMAGE_TO_VIDEO_DURATION_OPTIONS,
|
|
55
|
-
DEFAULT_VIDEO_DURATION as IMAGE_TO_VIDEO_DEFAULT_DURATION,
|
|
56
|
-
DEFAULT_FORM_VALUES as IMAGE_TO_VIDEO_FORM_DEFAULTS,
|
|
57
|
-
DEFAULT_FORM_CONFIG as IMAGE_TO_VIDEO_CONFIG,
|
|
58
|
-
} from "./domain";
|
|
59
|
-
|
|
60
47
|
// =============================================================================
|
|
61
48
|
// INFRASTRUCTURE LAYER
|
|
62
49
|
// =============================================================================
|
|
@@ -9,17 +9,11 @@ import type {
|
|
|
9
9
|
ImageToVideoFormActions,
|
|
10
10
|
ImageToVideoFormDefaults,
|
|
11
11
|
AnimationStyleId,
|
|
12
|
-
MusicMoodId,
|
|
13
12
|
VideoDuration,
|
|
14
13
|
} from "../../domain/types";
|
|
15
|
-
import {
|
|
16
|
-
DEFAULT_ANIMATION_STYLE_ID,
|
|
17
|
-
DEFAULT_MUSIC_MOOD_ID,
|
|
18
|
-
DEFAULT_VIDEO_DURATION,
|
|
19
|
-
} from "../../domain/constants";
|
|
20
14
|
|
|
21
15
|
export interface UseFormStateOptions {
|
|
22
|
-
defaults
|
|
16
|
+
defaults: ImageToVideoFormDefaults;
|
|
23
17
|
}
|
|
24
18
|
|
|
25
19
|
export interface UseFormStateReturn {
|
|
@@ -27,19 +21,17 @@ export interface UseFormStateReturn {
|
|
|
27
21
|
actions: ImageToVideoFormActions;
|
|
28
22
|
}
|
|
29
23
|
|
|
30
|
-
function createInitialState(defaults
|
|
24
|
+
function createInitialState(defaults: ImageToVideoFormDefaults): ImageToVideoFormState {
|
|
31
25
|
return {
|
|
32
26
|
selectedImages: [],
|
|
33
|
-
animationStyle: defaults
|
|
34
|
-
duration: defaults
|
|
35
|
-
musicMood: defaults?.musicMood ?? DEFAULT_MUSIC_MOOD_ID,
|
|
36
|
-
customAudioUri: null,
|
|
27
|
+
animationStyle: defaults.animationStyle,
|
|
28
|
+
duration: defaults.duration,
|
|
37
29
|
motionPrompt: "",
|
|
38
30
|
};
|
|
39
31
|
}
|
|
40
32
|
|
|
41
|
-
export function useFormState(options
|
|
42
|
-
const { defaults } = options
|
|
33
|
+
export function useFormState(options: UseFormStateOptions): UseFormStateReturn {
|
|
34
|
+
const { defaults } = options;
|
|
43
35
|
|
|
44
36
|
const [state, setState] = useState<ImageToVideoFormState>(() =>
|
|
45
37
|
createInitialState(defaults)
|
|
@@ -71,14 +63,6 @@ export function useFormState(options?: UseFormStateOptions): UseFormStateReturn
|
|
|
71
63
|
setState((prev) => ({ ...prev, duration }));
|
|
72
64
|
}, []);
|
|
73
65
|
|
|
74
|
-
const setMusicMood = useCallback((mood: MusicMoodId) => {
|
|
75
|
-
setState((prev) => ({ ...prev, musicMood: mood }));
|
|
76
|
-
}, []);
|
|
77
|
-
|
|
78
|
-
const setCustomAudioUri = useCallback((uri: string | null) => {
|
|
79
|
-
setState((prev) => ({ ...prev, customAudioUri: uri }));
|
|
80
|
-
}, []);
|
|
81
|
-
|
|
82
66
|
const setMotionPrompt = useCallback((prompt: string) => {
|
|
83
67
|
setState((prev) => ({ ...prev, motionPrompt: prompt }));
|
|
84
68
|
}, []);
|
|
@@ -94,8 +78,6 @@ export function useFormState(options?: UseFormStateOptions): UseFormStateReturn
|
|
|
94
78
|
removeImage,
|
|
95
79
|
setAnimationStyle,
|
|
96
80
|
setDuration,
|
|
97
|
-
setMusicMood,
|
|
98
|
-
setCustomAudioUri,
|
|
99
81
|
setMotionPrompt,
|
|
100
82
|
reset,
|
|
101
83
|
}),
|
|
@@ -105,8 +87,6 @@ export function useFormState(options?: UseFormStateOptions): UseFormStateReturn
|
|
|
105
87
|
removeImage,
|
|
106
88
|
setAnimationStyle,
|
|
107
89
|
setDuration,
|
|
108
|
-
setMusicMood,
|
|
109
|
-
setCustomAudioUri,
|
|
110
90
|
setMotionPrompt,
|
|
111
91
|
reset,
|
|
112
92
|
]
|
|
@@ -13,7 +13,6 @@ import type {
|
|
|
13
13
|
ImageToVideoFormActions,
|
|
14
14
|
ImageToVideoGenerationState,
|
|
15
15
|
ImageToVideoCallbacks,
|
|
16
|
-
MusicMoodId,
|
|
17
16
|
} from "../../domain/types";
|
|
18
17
|
|
|
19
18
|
export interface UseImageToVideoFormOptions extends UseFormStateOptions {
|
|
@@ -25,7 +24,6 @@ export interface UseImageToVideoFormReturn {
|
|
|
25
24
|
actions: ImageToVideoFormActions;
|
|
26
25
|
generationState: ImageToVideoGenerationState;
|
|
27
26
|
handleGenerate: () => Promise<void>;
|
|
28
|
-
handleMusicSelect: (moodId: MusicMoodId) => void;
|
|
29
27
|
handleSelectImages: () => Promise<void>;
|
|
30
28
|
isReady: boolean;
|
|
31
29
|
}
|
|
@@ -42,25 +40,6 @@ export function useImageToVideoForm(
|
|
|
42
40
|
callbacks,
|
|
43
41
|
});
|
|
44
42
|
|
|
45
|
-
const handleMusicSelect = useCallback(
|
|
46
|
-
(moodId: MusicMoodId) => {
|
|
47
|
-
if (moodId === "custom" && callbacks.onSelectCustomAudio) {
|
|
48
|
-
callbacks.onSelectCustomAudio().then((uri) => {
|
|
49
|
-
if (uri) {
|
|
50
|
-
actions.setCustomAudioUri(uri);
|
|
51
|
-
actions.setMusicMood("custom");
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
} else {
|
|
55
|
-
actions.setMusicMood(moodId);
|
|
56
|
-
if (moodId !== "custom") {
|
|
57
|
-
actions.setCustomAudioUri(null);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
[callbacks, actions]
|
|
62
|
-
);
|
|
63
|
-
|
|
64
43
|
const handleSelectImages = useCallback(async () => {
|
|
65
44
|
if (__DEV__) {
|
|
66
45
|
|
|
@@ -100,7 +79,6 @@ export function useImageToVideoForm(
|
|
|
100
79
|
actions,
|
|
101
80
|
generationState,
|
|
102
81
|
handleGenerate,
|
|
103
|
-
handleMusicSelect,
|
|
104
82
|
handleSelectImages,
|
|
105
83
|
isReady,
|
|
106
84
|
}),
|
|
@@ -109,7 +87,6 @@ export function useImageToVideoForm(
|
|
|
109
87
|
actions,
|
|
110
88
|
generationState,
|
|
111
89
|
handleGenerate,
|
|
112
|
-
handleMusicSelect,
|
|
113
90
|
handleSelectImages,
|
|
114
91
|
isReady,
|
|
115
92
|
]
|
package/src/exports/features.ts
CHANGED
|
@@ -72,9 +72,6 @@ export type {
|
|
|
72
72
|
ImageToVideoSelectionGridTranslations, ImageToVideoGenerateButtonProps,
|
|
73
73
|
} from "../domains/image-to-video";
|
|
74
74
|
export {
|
|
75
|
-
IMAGE_TO_VIDEO_ANIMATION_STYLES, IMAGE_TO_VIDEO_DEFAULT_ANIMATION,
|
|
76
|
-
IMAGE_TO_VIDEO_DURATION_OPTIONS, IMAGE_TO_VIDEO_DEFAULT_DURATION,
|
|
77
|
-
IMAGE_TO_VIDEO_FORM_DEFAULTS, IMAGE_TO_VIDEO_CONFIG,
|
|
78
75
|
executeImageToVideo, hasImageToVideoSupport,
|
|
79
76
|
useImageToVideoFormState, useImageToVideoGeneration, useImageToVideoForm, useImageToVideoFeature,
|
|
80
77
|
ImageToVideoAnimationStyleSelector, ImageToVideoDurationSelector,
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Animation Style Constants
|
|
3
|
-
* Default animation styles for image-to-video
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { AnimationStyle } from "../types";
|
|
7
|
-
|
|
8
|
-
export const DEFAULT_ANIMATION_STYLES: AnimationStyle[] = [
|
|
9
|
-
{
|
|
10
|
-
id: "ken_burns",
|
|
11
|
-
name: "Ken Burns",
|
|
12
|
-
description: "Slow zoom and pan effect",
|
|
13
|
-
icon: "expand-outline",
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
id: "zoom_in",
|
|
17
|
-
name: "Zoom In",
|
|
18
|
-
description: "Gradual zoom in effect",
|
|
19
|
-
icon: "add-circle-outline",
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
id: "zoom_out",
|
|
23
|
-
name: "Zoom Out",
|
|
24
|
-
description: "Gradual zoom out effect",
|
|
25
|
-
icon: "remove-circle-outline",
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
id: "slide_left",
|
|
29
|
-
name: "Slide Left",
|
|
30
|
-
description: "Pan from right to left",
|
|
31
|
-
icon: "arrow-back-outline",
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
id: "slide_right",
|
|
35
|
-
name: "Slide Right",
|
|
36
|
-
description: "Pan from left to right",
|
|
37
|
-
icon: "arrow-forward-outline",
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
id: "parallax",
|
|
41
|
-
name: "Parallax",
|
|
42
|
-
description: "3D depth effect",
|
|
43
|
-
icon: "layers-outline",
|
|
44
|
-
},
|
|
45
|
-
];
|
|
46
|
-
|
|
47
|
-
export const DEFAULT_ANIMATION_STYLE_ID = "ken_burns";
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Duration Constants
|
|
3
|
-
* Fixed to 4 seconds for video generation
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { VideoDuration, DurationOption } from "../types";
|
|
7
|
-
|
|
8
|
-
export const DEFAULT_DURATION_OPTIONS: DurationOption[] = [
|
|
9
|
-
{ value: 4, label: "4s" },
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
export const DEFAULT_VIDEO_DURATION: VideoDuration = 4;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Form Constants
|
|
3
|
-
* Default form values for image-to-video
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { ImageToVideoFormDefaults, ImageToVideoFormConfig } from "../types";
|
|
7
|
-
import { DEFAULT_ANIMATION_STYLE_ID } from "./animation.constants";
|
|
8
|
-
import { DEFAULT_MUSIC_MOOD_ID } from "./music.constants";
|
|
9
|
-
import { DEFAULT_VIDEO_DURATION } from "./duration.constants";
|
|
10
|
-
|
|
11
|
-
export const DEFAULT_FORM_VALUES: ImageToVideoFormDefaults = {
|
|
12
|
-
animationStyle: DEFAULT_ANIMATION_STYLE_ID,
|
|
13
|
-
duration: DEFAULT_VIDEO_DURATION,
|
|
14
|
-
musicMood: DEFAULT_MUSIC_MOOD_ID,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const DEFAULT_FORM_CONFIG: ImageToVideoFormConfig = {
|
|
18
|
-
maxImages: 10,
|
|
19
|
-
creditCost: 1,
|
|
20
|
-
enableCustomAudio: true,
|
|
21
|
-
enableMotionPrompt: false,
|
|
22
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Image-to-Video Constants Index
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
DEFAULT_ANIMATION_STYLES,
|
|
7
|
-
DEFAULT_ANIMATION_STYLE_ID,
|
|
8
|
-
} from "./animation.constants";
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
DEFAULT_DURATION_OPTIONS,
|
|
12
|
-
DEFAULT_VIDEO_DURATION,
|
|
13
|
-
} from "./duration.constants";
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
DEFAULT_FORM_VALUES,
|
|
17
|
-
DEFAULT_FORM_CONFIG,
|
|
18
|
-
} from "./form.constants";
|