@twick/video-editor 0.14.2 → 0.14.4
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/README.md +124 -8
- package/dist/components/controls/player-controls.d.ts +40 -1
- package/dist/components/player/player-manager.d.ts +1 -0
- package/dist/components/timeline/timeline-view.d.ts +2 -1
- package/dist/components/track/track-element.d.ts +1 -1
- package/dist/components/video-editor.d.ts +96 -8
- package/dist/helpers/animation-manager.d.ts +35 -0
- package/dist/helpers/constants.d.ts +145 -25
- package/dist/helpers/text-effects-manager.d.ts +32 -0
- package/dist/helpers/types.d.ts +52 -33
- package/dist/hooks/use-player-control.d.ts +15 -0
- package/dist/hooks/use-player-manager.d.ts +15 -0
- package/dist/hooks/use-timeline-control.d.ts +18 -0
- package/dist/hooks/use-timeline-manager.d.ts +19 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.js +365 -222
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +365 -222
- package/dist/index.mjs.map +1 -1
- package/dist/video-editor.css +3 -1
- package/package.json +7 -7
package/dist/helpers/types.d.ts
CHANGED
|
@@ -1,48 +1,67 @@
|
|
|
1
|
-
export
|
|
2
|
-
id: string;
|
|
3
|
-
type: 'image' | 'video' | 'audio';
|
|
4
|
-
url: string;
|
|
5
|
-
arrayBuffer?: ArrayBuffer;
|
|
6
|
-
thumbnail?: string;
|
|
7
|
-
metadata?: Record<string, any>;
|
|
8
|
-
};
|
|
9
|
-
export type PaginationOptions = {
|
|
10
|
-
page: number;
|
|
11
|
-
limit: number;
|
|
12
|
-
};
|
|
13
|
-
export type SearchOptions = {
|
|
14
|
-
query: string;
|
|
15
|
-
type?: 'image' | 'video' | 'audio';
|
|
16
|
-
metadata?: Record<string, any>;
|
|
17
|
-
};
|
|
18
|
-
export type TextEffect = {
|
|
19
|
-
name: string;
|
|
20
|
-
delay?: number;
|
|
21
|
-
bufferTime?: number;
|
|
22
|
-
getSample: (textEffect?: TextEffect) => string;
|
|
23
|
-
};
|
|
24
|
-
export type Animation = {
|
|
1
|
+
export interface Animation {
|
|
25
2
|
name: string;
|
|
26
3
|
interval?: number;
|
|
4
|
+
duration?: number;
|
|
5
|
+
intensity?: number;
|
|
27
6
|
animate?: "enter" | "exit" | "both";
|
|
28
7
|
mode?: "in" | "out";
|
|
29
8
|
direction?: "up" | "down" | "left" | "right" | "center";
|
|
30
|
-
options
|
|
31
|
-
animate?:
|
|
32
|
-
|
|
33
|
-
|
|
9
|
+
options: {
|
|
10
|
+
animate?: ("enter" | "exit" | "both")[];
|
|
11
|
+
mode?: ("in" | "out")[];
|
|
12
|
+
direction?: ("left" | "right" | "center" | "up" | "down")[];
|
|
13
|
+
intensity?: [number, number];
|
|
14
|
+
interval?: [number, number];
|
|
15
|
+
duration?: [number, number];
|
|
34
16
|
};
|
|
35
17
|
getSample: (animation?: Animation) => string;
|
|
36
|
-
}
|
|
18
|
+
}
|
|
19
|
+
export interface TextEffect {
|
|
20
|
+
name: string;
|
|
21
|
+
duration: number;
|
|
22
|
+
delay?: number;
|
|
23
|
+
bufferTime?: number;
|
|
24
|
+
getSample?: () => string;
|
|
25
|
+
}
|
|
26
|
+
export interface MediaItem {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
type: string;
|
|
30
|
+
url: string;
|
|
31
|
+
thumbnail?: string;
|
|
32
|
+
duration?: number;
|
|
33
|
+
width?: number;
|
|
34
|
+
height?: number;
|
|
35
|
+
metadata?: {
|
|
36
|
+
title?: string;
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
};
|
|
39
|
+
arrayBuffer?: ArrayBuffer;
|
|
40
|
+
}
|
|
41
|
+
export interface PaginationOptions {
|
|
42
|
+
page: number;
|
|
43
|
+
limit: number;
|
|
44
|
+
}
|
|
45
|
+
export interface SearchOptions {
|
|
46
|
+
query?: string;
|
|
47
|
+
type?: string;
|
|
48
|
+
sortBy?: string;
|
|
49
|
+
sortOrder?: 'asc' | 'desc';
|
|
50
|
+
metadata?: {
|
|
51
|
+
[key: string]: any;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
37
54
|
export interface ElementColors {
|
|
38
|
-
fragment: string;
|
|
39
55
|
video: string;
|
|
40
|
-
caption: string;
|
|
41
|
-
image: string;
|
|
42
56
|
audio: string;
|
|
57
|
+
image: string;
|
|
43
58
|
text: string;
|
|
44
|
-
|
|
59
|
+
caption: string;
|
|
60
|
+
icon: string;
|
|
61
|
+
circle: string;
|
|
45
62
|
rect: string;
|
|
63
|
+
element: string;
|
|
64
|
+
fragment: string;
|
|
46
65
|
frameEffect: string;
|
|
47
66
|
filters: string;
|
|
48
67
|
transition: string;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook to manage player control state and playback.
|
|
3
|
+
* Handles play/pause toggling and synchronization with timeline context
|
|
4
|
+
* for video editor playback control.
|
|
5
|
+
*
|
|
6
|
+
* @returns Object containing player control functions
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```js
|
|
10
|
+
* const { togglePlayback } = usePlayerControl();
|
|
11
|
+
*
|
|
12
|
+
* // Toggle between play and pause states
|
|
13
|
+
* togglePlayback();
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
1
16
|
export declare const usePlayerControl: () => {
|
|
2
17
|
togglePlayback: () => void;
|
|
3
18
|
};
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook to manage player state and canvas interactions.
|
|
3
|
+
* Handles player data updates, canvas operations, and timeline synchronization
|
|
4
|
+
* for the video editor component.
|
|
5
|
+
*
|
|
6
|
+
* @param videoProps - Object containing video dimensions
|
|
7
|
+
* @returns Object containing player management functions and state
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```js
|
|
11
|
+
* const { twickCanvas, projectData, updateCanvas } = usePlayerManager({
|
|
12
|
+
* videoProps: { width: 1920, height: 1080 }
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
1
16
|
export declare const usePlayerManager: ({ videoProps, }: {
|
|
2
17
|
videoProps: {
|
|
3
18
|
width: number;
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
import { TrackElement, Track } from '@twick/timeline';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Custom hook to manage timeline control operations.
|
|
5
|
+
* Provides functions for deleting items, splitting elements,
|
|
6
|
+
* and handling undo/redo operations in the video editor.
|
|
7
|
+
*
|
|
8
|
+
* @returns Object containing timeline control functions
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```js
|
|
12
|
+
* const { deleteItem, splitElement, handleUndo, handleRedo } = useTimelineControl();
|
|
13
|
+
*
|
|
14
|
+
* // Delete a track or element
|
|
15
|
+
* deleteItem(trackOrElement);
|
|
16
|
+
*
|
|
17
|
+
* // Split an element at current time
|
|
18
|
+
* splitElement(element, 5.5);
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
3
21
|
declare const useTimelineControl: () => {
|
|
4
22
|
splitElement: (element: TrackElement, currentTime: number) => void;
|
|
5
23
|
deleteItem: (item: Track | TrackElement) => void;
|
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
import { TrackElement, Track } from '@twick/timeline';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Custom hook to manage timeline operations and state.
|
|
5
|
+
* Provides functions for handling element dragging, track reordering,
|
|
6
|
+
* seeking, and selection changes in the video editor.
|
|
7
|
+
*
|
|
8
|
+
* @returns Object containing timeline management functions and state
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```js
|
|
12
|
+
* const { timelineData, onElementDrag, onSeek, onSelectionChange } = useTimelineManager();
|
|
13
|
+
*
|
|
14
|
+
* // Handle element dragging
|
|
15
|
+
* onElementDrag({ element, dragType: "START", updates: { start: 5, end: 10 } });
|
|
16
|
+
*
|
|
17
|
+
* // Seek to specific time
|
|
18
|
+
* onSeek(15.5);
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
3
21
|
export declare const useTimelineManager: () => {
|
|
4
22
|
timelineData: import('@twick/timeline/dist/services/data.service').TimelineTrackData | null;
|
|
23
|
+
onAddTrack: () => void;
|
|
5
24
|
onElementDrag: ({ element, dragType, updates, }: {
|
|
6
25
|
updates: {
|
|
7
26
|
start: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { default as VideoEditor } from './components/video-editor';
|
|
2
|
-
import { default as PlayerControls } from './components/controls/player-controls';
|
|
1
|
+
import { default as VideoEditor, VideoEditorProps, VideoEditorConfig } from './components/video-editor';
|
|
2
|
+
import { default as PlayerControls, PlayerControlsProps } from './components/controls/player-controls';
|
|
3
3
|
import { default as TimelineManager } from './components/timeline/timeline-manager';
|
|
4
4
|
import { usePlayerControl } from './hooks/use-player-control';
|
|
5
5
|
import { default as BrowserMediaManager } from './helpers/media-manager/browser-media-manager';
|
|
6
|
-
import { MediaItem, PaginationOptions, SearchOptions, Animation } from './helpers/types';
|
|
6
|
+
import { MediaItem, PaginationOptions, SearchOptions, Animation, TextEffect, ElementColors } from './helpers/types';
|
|
7
7
|
import { default as BaseMediaManager } from './helpers/media-manager/base-media-manager';
|
|
8
8
|
import { animationGifs, getAnimationGif } from './assets';
|
|
9
9
|
import { ANIMATIONS } from './helpers/animation-manager';
|
|
10
10
|
import { TEXT_EFFECTS } from './helpers/text-effects-manager';
|
|
11
11
|
import { default as useTimelineControl } from './hooks/use-timeline-control';
|
|
12
|
+
import { setElementColors } from './helpers/editor.utils';
|
|
12
13
|
|
|
13
|
-
export
|
|
14
|
+
export { setElementColors };
|
|
15
|
+
export type { MediaItem, PaginationOptions, SearchOptions, Animation, TextEffect, ElementColors };
|
|
16
|
+
export type { PlayerControlsProps, VideoEditorProps, VideoEditorConfig };
|
|
14
17
|
export { ANIMATIONS, TEXT_EFFECTS };
|
|
15
18
|
export { usePlayerControl, BrowserMediaManager, BaseMediaManager, animationGifs, getAnimationGif, PlayerControls, TimelineManager, useTimelineControl };
|
|
16
19
|
export * from './helpers/constants';
|