@umituz/react-native-video-editor 1.0.4 → 1.0.5

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.
Files changed (24) hide show
  1. package/package.json +1 -1
  2. package/src/infrastructure/services/image-layer-operations.service.ts +1 -1
  3. package/src/infrastructure/services/layer-manipulation.service.ts +1 -1
  4. package/src/infrastructure/services/layer-operations/layer-delete.service.ts +2 -2
  5. package/src/infrastructure/services/layer-operations/layer-duplicate.service.ts +2 -2
  6. package/src/infrastructure/services/layer-operations/layer-order.service.ts +2 -2
  7. package/src/infrastructure/services/layer-operations/layer-transform.service.ts +2 -2
  8. package/src/infrastructure/services/layer-operations.service.ts +1 -1
  9. package/src/infrastructure/services/scene-operations.service.ts +1 -1
  10. package/src/infrastructure/services/shape-layer-operations.service.ts +1 -1
  11. package/src/infrastructure/services/text-layer-operations.service.ts +1 -1
  12. package/src/presentation/components/AnimationEditor.tsx +2 -2
  13. package/src/presentation/components/AudioEditor.tsx +2 -2
  14. package/src/presentation/components/DraggableLayer.tsx +1 -1
  15. package/src/presentation/components/ExportDialog.tsx +3 -3
  16. package/src/presentation/components/ImageLayerEditor.tsx +29 -12
  17. package/src/presentation/components/ShapeLayerEditor.tsx +2 -2
  18. package/src/presentation/components/TextLayerEditor.tsx +2 -2
  19. package/src/presentation/components/shape-layer/ShapePreview.tsx +1 -1
  20. package/src/presentation/components/text-layer/TextPreview.tsx +1 -1
  21. package/src/presentation/hooks/useExportActions.tsx +1 -1
  22. package/src/presentation/hooks/useLayerActions.tsx +4 -4
  23. package/src/presentation/hooks/useMenuActions.tsx +1 -1
  24. package/src/presentation/hooks/useSceneActions.tsx +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-video-editor",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Professional video editor with layer-based timeline, text/image/shape/audio/animation layers, and export functionality",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { generateUUID } from "@umituz/react-native-uuid";
7
7
  import type { Scene, ImageLayer } from "../../domain/entities";
8
- import type { LayerOperationResult, AddImageLayerData } from "../../types";
8
+ import type { LayerOperationResult, AddImageLayerData } from "../../domain/entities";
9
9
 
10
10
  class ImageLayerOperationsService {
11
11
  /**
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import type { Scene, Animation } from "../../domain/entities";
7
- import type { LayerOperationResult, LayerOrderAction } from "../../types";
7
+ import type { LayerOperationResult, LayerOrderAction } from "../../domain/entities";
8
8
  import {
9
9
  layerDeleteService,
10
10
  layerOrderService,
@@ -3,8 +3,8 @@
3
3
  * Single Responsibility: Handle layer deletion operations
4
4
  */
5
5
 
6
- import type { Scene } from "../../domain/entities";
7
- import type { LayerOperationResult } from "../../../types";
6
+ import type { Scene } from "../../../domain/entities";
7
+ import type { LayerOperationResult } from "../../../domain/entities";
8
8
 
9
9
  class LayerDeleteService {
10
10
  /**
@@ -4,8 +4,8 @@
4
4
  */
5
5
 
6
6
  import { generateUUID } from "@umituz/react-native-uuid";
7
- import type { Scene } from "../../domain/entities";
8
- import type { LayerOperationResult } from "../../../types";
7
+ import type { Scene } from "../../../domain/entities";
8
+ import type { LayerOperationResult } from "../../../domain/entities";
9
9
 
10
10
  class LayerDuplicateService {
11
11
  /**
@@ -3,8 +3,8 @@
3
3
  * Single Responsibility: Handle layer ordering operations
4
4
  */
5
5
 
6
- import type { Scene } from "../../domain/entities";
7
- import type { LayerOperationResult, LayerOrderAction } from "../../../types";
6
+ import type { Scene } from "../../../domain/entities";
7
+ import type { LayerOperationResult, LayerOrderAction } from "../../../domain/entities";
8
8
 
9
9
  class LayerOrderService {
10
10
  /**
@@ -3,8 +3,8 @@
3
3
  * Single Responsibility: Handle layer position, size, and animation updates
4
4
  */
5
5
 
6
- import type { Scene, Animation, Layer } from "../../domain/entities";
7
- import type { LayerOperationResult } from "../../../types";
6
+ import type { Scene, Animation, Layer } from "../../../domain/entities";
7
+ import type { LayerOperationResult } from "../../../domain/entities";
8
8
 
9
9
  class LayerTransformService {
10
10
  /**
@@ -14,7 +14,7 @@ import type {
14
14
  AddTextLayerData,
15
15
  AddImageLayerData,
16
16
  AddShapeLayerData,
17
- } from "../../types";
17
+ } from "../../domain/entities";
18
18
 
19
19
  class LayerOperationsService {
20
20
  /**
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { generateUUID } from "@umituz/react-native-uuid";
7
7
  import type { Scene, Audio } from "../../domain/entities";
8
- import type { SceneOperationResult } from "../../types";
8
+ import type { SceneOperationResult } from "../../domain/entities";
9
9
 
10
10
  class SceneOperationsService {
11
11
  /**
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { generateUUID } from "@umituz/react-native-uuid";
7
7
  import type { Scene, ShapeLayer } from "../../domain/entities";
8
- import type { LayerOperationResult, AddShapeLayerData } from "../../types";
8
+ import type { LayerOperationResult, AddShapeLayerData } from "../../domain/entities";
9
9
 
10
10
  class ShapeLayerOperationsService {
11
11
  /**
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { generateUUID } from "@umituz/react-native-uuid";
7
7
  import type { Scene, TextLayer } from "../../domain/entities";
8
- import type { LayerOperationResult, AddTextLayerData } from "../../types";
8
+ import type { LayerOperationResult, AddTextLayerData } from "../../domain/entities";
9
9
 
10
10
  class TextLayerOperationsService {
11
11
  /**
@@ -7,13 +7,13 @@ import React from "react";
7
7
  import { View, ScrollView, StyleSheet } from "react-native";
8
8
  import { useAppDesignTokens } from "@umituz/react-native-design-system";
9
9
  import type { Animation } from "../../domain/entities";
10
- import { useAnimationLayerForm } from "../../hooks/useAnimationLayerForm";
10
+ import { useAnimationLayerForm } from "../hooks/useAnimationLayerForm";
11
11
  import {
12
12
  DURATIONS,
13
13
  DELAYS,
14
14
  EASINGS,
15
15
  type Easing,
16
- } from "../../constants/animation-layer.constants";
16
+ } from "../../infrastructure/constants/animation-layer.constants";
17
17
  import { ValueSelector } from "./shape-layer/ValueSelector";
18
18
  import { OptionSelector } from "./text-layer/OptionSelector";
19
19
  import {
@@ -11,8 +11,8 @@ import {
11
11
  useAppDesignTokens,
12
12
  } from "@umituz/react-native-design-system";
13
13
  import type { Audio } from "../../domain/entities";
14
- import { useAudioLayerForm } from "../../hooks/useAudioLayerForm";
15
- import { AUDIO_FILE_TYPES } from "../../constants/audio-layer.constants";
14
+ import { useAudioLayerForm } from "../hooks/useAudioLayerForm";
15
+ import { AUDIO_FILE_TYPES } from "../../infrastructure/constants/audio-layer.constants";
16
16
  import {
17
17
  AudioFileSelector,
18
18
  VolumeSelector,
@@ -9,7 +9,7 @@ import { GestureDetector } from "react-native-gesture-handler";
9
9
  import Animated, { useAnimatedStyle } from "react-native-reanimated";
10
10
  import { useAppDesignTokens } from "@umituz/react-native-design-system";
11
11
  import type { Layer } from "../../domain/entities";
12
- import { useDraggableLayerGestures } from "../../hooks/useDraggableLayerGestures";
12
+ import { useDraggableLayerGestures } from "../hooks/useDraggableLayerGestures";
13
13
  import { LayerContent } from "./draggable-layer/LayerContent";
14
14
  import { ResizeHandles } from "./draggable-layer/ResizeHandles";
15
15
 
@@ -7,13 +7,13 @@ import React, { useCallback } from "react";
7
7
  import { View, ScrollView, StyleSheet } from "react-native";
8
8
  import { useLocalization } from "@umituz/react-native-localization";
9
9
  import type { ExportSettings, VideoProject } from "../../domain/entities";
10
- import { useExportForm } from "../../hooks/useExportForm";
11
- import { useExport } from "../../hooks/useExport";
10
+ import { useExportForm } from "../hooks/useExportForm";
11
+ import { useExport } from "../hooks/useExport";
12
12
  import {
13
13
  RESOLUTIONS,
14
14
  QUALITIES,
15
15
  FORMATS,
16
- } from "../../constants/export.constants";
16
+ } from "../../infrastructure/constants/export.constants";
17
17
  import {
18
18
  ProjectInfoBox,
19
19
  OptionSelectorRow,
@@ -5,10 +5,8 @@
5
5
 
6
6
  import React, { useCallback } from "react";
7
7
  import { View, ScrollView, StyleSheet, Alert } from "react-native";
8
- import { useImagePicker } from "@/domains/media";
9
8
  import type { ImageLayer } from "../../domain/entities";
10
- import { useImageLayerForm } from "../../hooks/useImageLayerForm";
11
- import { IMAGE_PICKER_OPTIONS } from "../../constants/image-layer.constants";
9
+ import { useImageLayerForm } from "../hooks/useImageLayerForm";
12
10
  import {
13
11
  ImagePreview,
14
12
  ImageSelectionButtons,
@@ -16,36 +14,52 @@ import {
16
14
  } from "./image-layer";
17
15
  import { EditorActions } from "./text-layer/EditorActions";
18
16
 
17
+ interface ImagePickerResult {
18
+ canceled: boolean;
19
+ assets?: Array<{ uri: string }>;
20
+ }
21
+
19
22
  interface ImageLayerEditorProps {
20
- layer?: ImageLayer;
21
- onSave: (layerData: Partial<ImageLayer>) => void;
22
- onCancel: () => void;
23
+ readonly layer?: ImageLayer;
24
+ readonly onSave: (layerData: Partial<ImageLayer>) => void;
25
+ readonly onCancel: () => void;
26
+ readonly onPickFromLibrary?: () => Promise<ImagePickerResult>;
27
+ readonly onTakePhoto?: () => Promise<ImagePickerResult>;
23
28
  }
24
29
 
25
30
  export const ImageLayerEditor: React.FC<ImageLayerEditorProps> = ({
26
31
  layer,
27
32
  onSave,
28
33
  onCancel,
34
+ onPickFromLibrary,
35
+ onTakePhoto,
29
36
  }) => {
30
- const { pickFromLibrary, pickFromCamera } = useImagePicker();
31
37
  const { formState, setImageUri, setOpacity, buildLayerData, isValid } =
32
38
  useImageLayerForm(layer);
33
39
 
34
40
  const handlePickImage = useCallback(async () => {
35
- const result = await pickFromLibrary(IMAGE_PICKER_OPTIONS);
41
+ if (!onPickFromLibrary) {
42
+ Alert.alert("Not Available", "Image picker not configured.");
43
+ return;
44
+ }
45
+ const result = await onPickFromLibrary();
36
46
 
37
47
  if (!result.canceled && result.assets?.[0]) {
38
48
  setImageUri(result.assets[0].uri);
39
49
  }
40
- }, [pickFromLibrary, setImageUri]);
50
+ }, [onPickFromLibrary, setImageUri]);
41
51
 
42
52
  const handleTakePhoto = useCallback(async () => {
43
- const result = await pickFromCamera(IMAGE_PICKER_OPTIONS);
53
+ if (!onTakePhoto) {
54
+ Alert.alert("Not Available", "Camera not configured.");
55
+ return;
56
+ }
57
+ const result = await onTakePhoto();
44
58
 
45
59
  if (!result.canceled && result.assets?.[0]) {
46
60
  setImageUri(result.assets[0].uri);
47
61
  }
48
- }, [pickFromCamera, setImageUri]);
62
+ }, [onTakePhoto, setImageUri]);
49
63
 
50
64
  const handleSave = useCallback(() => {
51
65
  if (!isValid) {
@@ -58,7 +72,7 @@ export const ImageLayerEditor: React.FC<ImageLayerEditorProps> = ({
58
72
  return (
59
73
  <View style={styles.container}>
60
74
  <ScrollView showsVerticalScrollIndicator={false}>
61
- <View style={{ marginBottom: 24 }}>
75
+ <View style={styles.previewContainer}>
62
76
  <ImagePreview
63
77
  imageUri={formState.imageUri}
64
78
  opacity={formState.opacity}
@@ -92,4 +106,7 @@ const styles = StyleSheet.create({
92
106
  container: {
93
107
  paddingVertical: 16,
94
108
  },
109
+ previewContainer: {
110
+ marginBottom: 24,
111
+ },
95
112
  });
@@ -11,11 +11,11 @@ import {
11
11
  useAppDesignTokens,
12
12
  } from "@umituz/react-native-design-system";
13
13
  import type { ShapeLayer } from "../../domain/entities";
14
- import { useShapeLayerForm } from "../../hooks/useShapeLayerForm";
14
+ import { useShapeLayerForm } from "../hooks/useShapeLayerForm";
15
15
  import {
16
16
  BORDER_WIDTHS,
17
17
  OPACITY_OPTIONS,
18
- } from "../../constants/shape-layer.constants";
18
+ } from "../../infrastructure/constants/shape-layer.constants";
19
19
  import {
20
20
  ShapeTypeSelector,
21
21
  ColorPickerHorizontal,
@@ -7,11 +7,11 @@ import React from "react";
7
7
  import { View, ScrollView, StyleSheet } from "react-native";
8
8
  import { useLocalization } from "@umituz/react-native-localization";
9
9
  import type { TextLayer } from "../../domain/entities";
10
- import { useTextLayerForm } from "../../hooks/useTextLayerForm";
10
+ import { useTextLayerForm } from "../hooks/useTextLayerForm";
11
11
  import {
12
12
  FONT_FAMILIES,
13
13
  FONT_WEIGHTS,
14
- } from "../../constants/text-layer.constants";
14
+ } from "../../infrastructure/constants/text-layer.constants";
15
15
  import {
16
16
  TextInputSection,
17
17
  FontSizeSelector,
@@ -10,7 +10,7 @@ import {
10
10
  useAppDesignTokens,
11
11
  } from "@umituz/react-native-design-system";
12
12
  import type { ShapeType } from "../../../infrastructure/constants/shape-layer.constants";
13
- import type { ShapeLayerFormState } from "../../../hooks/useShapeLayerForm";
13
+ import type { ShapeLayerFormState } from "../../hooks/useShapeLayerForm";
14
14
 
15
15
  interface ShapePreviewProps {
16
16
  formState: ShapeLayerFormState;
@@ -9,7 +9,7 @@ import {
9
9
  AtomicText,
10
10
  useAppDesignTokens,
11
11
  } from "@umituz/react-native-design-system";
12
- import type { TextLayerFormState } from "../../../hooks/useTextLayerForm";
12
+ import type { TextLayerFormState } from "../../hooks/useTextLayerForm";
13
13
 
14
14
  interface TextPreviewProps {
15
15
  formState: TextLayerFormState;
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { useCallback } from "react";
7
- import { ExportDialog } from "../components/export";
7
+ import { ExportDialog } from "../components/ExportDialog";
8
8
  import type { VideoProject, ExportSettings } from "../../domain/entities";
9
9
  import type { UseEditorBottomSheetReturn } from "./useEditorBottomSheet";
10
10
 
@@ -4,10 +4,10 @@
4
4
  */
5
5
 
6
6
  import { useCallback } from "react";
7
- import { TextLayerEditor } from "../components/text-layer";
8
- import { ImageLayerEditor } from "../components/image-layer";
9
- import { ShapeLayerEditor } from "../components/shape-layer";
10
- import { AnimationEditor } from "../components/animation-layer";
7
+ import { TextLayerEditor } from "../components/TextLayerEditor";
8
+ import { ImageLayerEditor } from "../components/ImageLayerEditor";
9
+ import { ShapeLayerEditor } from "../components/ShapeLayerEditor";
10
+ import { AnimationEditor } from "../components/AnimationEditor";
11
11
  import type { ImageLayer } from "../../domain/entities";
12
12
  import type { UseEditorLayersReturn } from "./useEditorLayers";
13
13
  import type { UseEditorBottomSheetReturn } from "./useEditorBottomSheet";
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { useCallback } from "react";
7
- import { LayerActionsMenu } from "../presentation/components/LayerActionsMenu";
7
+ import { LayerActionsMenu } from "../components/LayerActionsMenu";
8
8
  import type { UseEditorLayersReturn } from "./useEditorLayers";
9
9
  import type { UseEditorBottomSheetReturn } from "./useEditorBottomSheet";
10
10
 
@@ -4,8 +4,8 @@
4
4
  */
5
5
 
6
6
  import { useCallback } from "react";
7
- import { AudioEditor } from "../presentation/components/AudioEditor";
8
- import { SceneActionsMenu } from "../presentation/components/SceneActionsMenu";
7
+ import { AudioEditor } from "../components/AudioEditor";
8
+ import { SceneActionsMenu } from "../components/SceneActionsMenu";
9
9
  import type { UseEditorScenesReturn } from "./useEditorScenes";
10
10
  import type { UseEditorBottomSheetReturn } from "./useEditorBottomSheet";
11
11