@umituz/react-native-ai-generation-content 1.17.34 → 1.17.35
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/features/text-to-image/domain/constants/options.constants.ts +13 -3
- package/src/presentation/components/selectors/factories/aspect-ratio.factory.ts +56 -0
- package/src/presentation/components/selectors/factories/duration.factory.ts +33 -0
- package/src/presentation/components/selectors/factories/index.ts +8 -0
- package/src/presentation/components/selectors/factories/style.factory.ts +47 -0
- package/src/presentation/components/selectors/index.ts +2 -0
package/package.json
CHANGED
|
@@ -13,12 +13,19 @@ import type {
|
|
|
13
13
|
|
|
14
14
|
export const DEFAULT_NUM_IMAGES_OPTIONS: NumImages[] = [1, 2, 3, 4];
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use createAspectRatioOptions factory with translations instead
|
|
18
|
+
* This will be removed in next major version
|
|
19
|
+
*/
|
|
16
20
|
export const DEFAULT_ASPECT_RATIO_OPTIONS: { value: AspectRatio; label: string }[] = [
|
|
17
|
-
{ value: "9:16", label: "
|
|
18
|
-
{ value: "16:9", label: "
|
|
19
|
-
{ value: "1:1", label: "
|
|
21
|
+
{ value: "9:16", label: "9:16" },
|
|
22
|
+
{ value: "16:9", label: "16:9" },
|
|
23
|
+
{ value: "1:1", label: "1:1" },
|
|
20
24
|
];
|
|
21
25
|
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Apps should provide their own translated labels
|
|
28
|
+
*/
|
|
22
29
|
export const DEFAULT_SIZE_OPTIONS: { value: ImageSize; label: string }[] = [
|
|
23
30
|
{ value: "512x512", label: "512×512" },
|
|
24
31
|
{ value: "768x768", label: "768×768" },
|
|
@@ -27,6 +34,9 @@ export const DEFAULT_SIZE_OPTIONS: { value: ImageSize; label: string }[] = [
|
|
|
27
34
|
{ value: "1792x1024", label: "1792×1024" },
|
|
28
35
|
];
|
|
29
36
|
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Apps should provide their own translated labels
|
|
39
|
+
*/
|
|
30
40
|
export const DEFAULT_OUTPUT_FORMAT_OPTIONS: { value: OutputFormat; label: string }[] = [
|
|
31
41
|
{ value: "png", label: "PNG" },
|
|
32
42
|
{ value: "jpeg", label: "JPEG" },
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aspect Ratio Factory
|
|
3
|
+
* Creates i18n-ready aspect ratio options
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { AspectRatioOption } from "../types";
|
|
7
|
+
|
|
8
|
+
export interface AspectRatioTranslations {
|
|
9
|
+
landscape: {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
portrait: {
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
square: {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Creates aspect ratio options with translations
|
|
25
|
+
* @param translations - Translated labels from app
|
|
26
|
+
* @returns Array of aspect ratio options
|
|
27
|
+
*/
|
|
28
|
+
export const createAspectRatioOptions = (
|
|
29
|
+
translations: AspectRatioTranslations
|
|
30
|
+
): AspectRatioOption[] => [
|
|
31
|
+
{
|
|
32
|
+
id: "16:9",
|
|
33
|
+
name: translations.landscape.name,
|
|
34
|
+
icon: "Monitor",
|
|
35
|
+
description: translations.landscape.description,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "9:16",
|
|
39
|
+
name: translations.portrait.name,
|
|
40
|
+
icon: "Smartphone",
|
|
41
|
+
description: translations.portrait.description,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "1:1",
|
|
45
|
+
name: translations.square.name,
|
|
46
|
+
icon: "Square",
|
|
47
|
+
description: translations.square.description,
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Default aspect ratio IDs (no translation needed)
|
|
53
|
+
*/
|
|
54
|
+
export const ASPECT_RATIO_IDS = ["16:9", "9:16", "1:1"] as const;
|
|
55
|
+
|
|
56
|
+
export type AspectRatioId = (typeof ASPECT_RATIO_IDS)[number];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Duration Factory
|
|
3
|
+
* Creates i18n-ready duration options
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { DurationValue } from "../types";
|
|
7
|
+
|
|
8
|
+
export interface DurationOption {
|
|
9
|
+
value: DurationValue;
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates duration options with translations
|
|
15
|
+
* @param durations - Array of duration values in seconds
|
|
16
|
+
* @param formatLabel - Function to format duration label (e.g., "4s", "8 seconds")
|
|
17
|
+
* @returns Array of duration options
|
|
18
|
+
*/
|
|
19
|
+
export const createDurationOptions = (
|
|
20
|
+
durations: readonly DurationValue[],
|
|
21
|
+
formatLabel: (seconds: DurationValue) => string
|
|
22
|
+
): DurationOption[] =>
|
|
23
|
+
durations.map((duration) => ({
|
|
24
|
+
value: duration,
|
|
25
|
+
label: formatLabel(duration),
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Common duration values (seconds)
|
|
30
|
+
*/
|
|
31
|
+
export const COMMON_DURATIONS = [4, 8, 12, 16] as const;
|
|
32
|
+
|
|
33
|
+
export type CommonDuration = (typeof COMMON_DURATIONS)[number];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Style Factory
|
|
3
|
+
* Creates i18n-ready style options
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { StyleOption } from "../types";
|
|
7
|
+
|
|
8
|
+
export interface StyleTranslation {
|
|
9
|
+
name: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type StyleTranslations = Record<string, StyleTranslation>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Creates style options with translations
|
|
17
|
+
* @param styleIds - Array of style IDs
|
|
18
|
+
* @param translations - Map of style ID to translations
|
|
19
|
+
* @param getThumbnail - Optional function to get thumbnail URL for style
|
|
20
|
+
* @returns Array of style options
|
|
21
|
+
*/
|
|
22
|
+
export const createStyleOptions = (
|
|
23
|
+
styleIds: readonly string[],
|
|
24
|
+
translations: StyleTranslations,
|
|
25
|
+
getThumbnail?: (styleId: string) => string | undefined
|
|
26
|
+
): StyleOption[] =>
|
|
27
|
+
styleIds.map((id) => ({
|
|
28
|
+
id,
|
|
29
|
+
name: translations[id]?.name || id,
|
|
30
|
+
description: translations[id]?.description,
|
|
31
|
+
thumbnail: getThumbnail?.(id),
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Helper to create style options from array of style configs
|
|
36
|
+
*/
|
|
37
|
+
export const createStyleOptionsFromConfig = <T extends { id: string }>(
|
|
38
|
+
styles: readonly T[],
|
|
39
|
+
translations: StyleTranslations,
|
|
40
|
+
getThumbnail?: (style: T) => string | undefined
|
|
41
|
+
): StyleOption[] =>
|
|
42
|
+
styles.map((style) => ({
|
|
43
|
+
id: style.id,
|
|
44
|
+
name: translations[style.id]?.name || style.id,
|
|
45
|
+
description: translations[style.id]?.description,
|
|
46
|
+
thumbnail: getThumbnail?.(style),
|
|
47
|
+
}));
|