@twick/video-editor 0.14.3 → 0.14.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.
@@ -20,6 +20,8 @@ import { TrackElement, Track } from '@twick/timeline';
20
20
  * onRedo={handleRedo}
21
21
  * onDelete={handleDelete}
22
22
  * onSplit={handleSplit}
23
+ * zoomLevel={1.0}
24
+ * setZoomLevel={handleZoomChange}
23
25
  * />
24
26
  * ```
25
27
  */
@@ -46,6 +48,10 @@ export interface PlayerControlsProps {
46
48
  onDelete?: (item: TrackElement | Track) => void;
47
49
  /** Optional callback for split operation */
48
50
  onSplit?: (item: TrackElement, splitTime: number) => void;
51
+ /** Current zoom level for timeline */
52
+ zoomLevel?: number;
53
+ /** Function to set zoom level */
54
+ setZoomLevel?: (zoom: number) => void;
49
55
  /** Optional CSS class name for styling */
50
56
  className?: string;
51
57
  }
@@ -1,8 +1,12 @@
1
1
 
2
- export declare const PlayerManager: ({ videoProps, canvasMode, }: {
2
+ export declare const PlayerManager: ({ videoProps, playerProps, canvasMode, }: {
3
3
  videoProps: {
4
4
  width: number;
5
5
  height: number;
6
+ backgroundColor?: string;
7
+ };
8
+ playerProps?: {
9
+ quality?: number;
6
10
  };
7
11
  canvasMode: boolean;
8
12
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,4 @@
1
- declare const TimelineManager: ({ timelineControls, trackZoom, }: {
2
- timelineControls?: React.ReactNode;
1
+ declare const TimelineManager: ({ trackZoom, }: {
3
2
  trackZoom: number;
4
3
  }) => import("react/jsx-runtime").JSX.Element;
5
4
  export default TimelineManager;
@@ -1,12 +1,12 @@
1
1
  import { Track, TrackElement } from '@twick/timeline';
2
2
 
3
- declare function TimelineView({ zoomLevel, selectedItem, duration, tracks, seekTrack, onReorder, onSelectionChange, onElementDrag, }: {
4
- timelineControls?: React.ReactNode;
3
+ declare function TimelineView({ zoomLevel, selectedItem, duration, tracks, seekTrack, onAddTrack, onReorder, onSelectionChange, onElementDrag, }: {
5
4
  zoomLevel: number;
6
5
  duration: number;
7
6
  tracks: Track[];
8
7
  selectedItem: Track | TrackElement | null;
9
8
  seekTrack?: React.ReactNode;
9
+ onAddTrack: () => void;
10
10
  onReorder: (tracks: Track[]) => void;
11
11
  onElementDrag: ({ element, dragType, updates, }: {
12
12
  element: TrackElement;
@@ -5,7 +5,7 @@ export declare const TrackElementView: React.FC<{
5
5
  selectedItem: TrackElement | null;
6
6
  parentWidth: number;
7
7
  duration: number;
8
- nextStart: number;
8
+ nextStart: number | null;
9
9
  prevEnd: number;
10
10
  allowOverlap: boolean;
11
11
  onSelection: (element: TrackElement) => void;
@@ -19,6 +19,13 @@ export interface VideoEditorConfig {
19
19
  width: number;
20
20
  /** Height of the video in pixels */
21
21
  height: number;
22
+ /** Background color of the video */
23
+ backgroundColor?: string;
24
+ };
25
+ playerProps?: {
26
+ quality?: number;
27
+ maxWidth?: number;
28
+ maxHeight?: number;
22
29
  };
23
30
  /** Whether to use canvas mode for rendering */
24
31
  canvasMode?: boolean;
@@ -48,8 +55,6 @@ export interface VideoEditorProps {
48
55
  rightPanel?: React.ReactNode;
49
56
  /** Custom bottom panel component (e.g., effects library) */
50
57
  bottomPanel?: React.ReactNode;
51
- /** Custom play controls component */
52
- playControls?: React.ReactNode;
53
58
  /** Whether to show default play controls if no custom controls provided */
54
59
  defaultPlayControls?: boolean;
55
60
  /** Editor configuration including video properties and mode settings */
@@ -1,200 +1,69 @@
1
- /**
2
- * Represents a media item in the video editor.
3
- * Defines the structure for images, videos, and audio files
4
- * that can be used in video editing projects.
5
- *
6
- * @example
7
- * ```js
8
- * const mediaItem: MediaItem = {
9
- * id: "media-123",
10
- * type: "video",
11
- * url: "https://example.com/video.mp4",
12
- * thumbnail: "https://example.com/thumbnail.jpg",
13
- * metadata: {
14
- * duration: 30,
15
- * width: 1920,
16
- * height: 1080
17
- * }
18
- * };
19
- * ```
20
- */
21
- export type MediaItem = {
22
- /** Unique identifier for the media item */
23
- id: string;
24
- /** Type of media (image, video, or audio) */
25
- type: 'image' | 'video' | 'audio';
26
- /** URL or path to the media file */
27
- url: string;
28
- /** Optional array buffer containing the media data */
29
- arrayBuffer?: ArrayBuffer;
30
- /** Optional thumbnail URL for the media item */
31
- thumbnail?: string;
32
- /** Optional metadata about the media item */
33
- metadata?: Record<string, any>;
34
- };
35
- /**
36
- * Pagination options for media library queries.
37
- * Used to control the number of items returned and pagination.
38
- *
39
- * @example
40
- * ```js
41
- * const pagination: PaginationOptions = {
42
- * page: 1,
43
- * limit: 20
44
- * };
45
- *
46
- * // Fetch first 20 items
47
- * const mediaItems = await mediaManager.getMedia(pagination);
48
- * ```
49
- */
50
- export type PaginationOptions = {
51
- /** Page number (1-based) */
52
- page: number;
53
- /** Number of items per page */
54
- limit: number;
55
- };
56
- /**
57
- * Search options for filtering media items.
58
- * Defines search criteria for finding specific media content.
59
- *
60
- * @example
61
- * ```js
62
- * const searchOptions: SearchOptions = {
63
- * query: "nature",
64
- * type: "image",
65
- * metadata: {
66
- * tags: ["landscape", "outdoor"]
67
- * }
68
- * };
69
- *
70
- * // Search for nature images with specific tags
71
- * const results = await mediaManager.searchMedia(searchOptions);
72
- * ```
73
- */
74
- export type SearchOptions = {
75
- /** Search query string */
76
- query: string;
77
- /** Optional media type filter */
78
- type?: 'image' | 'video' | 'audio';
79
- /** Optional metadata filters */
80
- metadata?: Record<string, any>;
81
- };
82
- /**
83
- * Text effect configuration for animated text elements.
84
- * Defines how text animations are applied to timeline elements.
85
- *
86
- * @example
87
- * ```js
88
- * const textEffect: TextEffect = {
89
- * name: "typewriter",
90
- * delay: 0.5,
91
- * bufferTime: 0.1,
92
- * getSample: (effect) => "Sample text animation"
93
- * };
94
- *
95
- * // Apply text effect to element
96
- * textElement.setTextEffect(textEffect);
97
- * ```
98
- */
99
- export type TextEffect = {
100
- /** Name of the text effect */
101
- name: string;
102
- /** Delay before effect starts (in seconds) */
103
- delay?: number;
104
- /** Buffer time between characters (in seconds) */
105
- bufferTime?: number;
106
- /** Function to get sample text for preview */
107
- getSample: (textEffect?: TextEffect) => string;
108
- };
109
- /**
110
- * Animation configuration for timeline elements.
111
- * Defines how elements are animated during playback.
112
- *
113
- * @example
114
- * ```js
115
- * const animation: Animation = {
116
- * name: "fade",
117
- * interval: 0.5,
118
- * animate: "enter",
119
- * mode: "in",
120
- * direction: "center",
121
- * options: {
122
- * animate: ["enter", "exit"],
123
- * direction: ["up", "down", "left", "right"],
124
- * mode: ["in", "out"]
125
- * },
126
- * getSample: (anim) => "Sample animation preview"
127
- * };
128
- *
129
- * // Apply animation to element
130
- * element.setAnimation(animation);
131
- * ```
132
- */
133
- export type Animation = {
134
- /** Name of the animation */
1
+ export interface Animation {
135
2
  name: string;
136
- /** Interval between animation cycles (in seconds) */
137
3
  interval?: number;
138
- /** When to apply the animation */
4
+ duration?: number;
5
+ intensity?: number;
139
6
  animate?: "enter" | "exit" | "both";
140
- /** Animation mode (in/out) */
141
7
  mode?: "in" | "out";
142
- /** Direction of the animation */
143
8
  direction?: "up" | "down" | "left" | "right" | "center";
144
- /** Available options for the animation */
145
- options?: {
146
- /** Available animation types */
147
- animate?: string[];
148
- /** Available directions */
149
- direction?: string[];
150
- /** Available modes */
151
- mode?: string[];
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];
152
16
  };
153
- /** Function to get sample preview */
154
17
  getSample: (animation?: Animation) => string;
155
- };
156
- /**
157
- * Color scheme for different element types in the timeline.
158
- * Provides consistent visual distinction between various timeline elements.
159
- * Each property represents the default color for a specific element type.
160
- *
161
- * @example
162
- * ```js
163
- * const colors: ElementColors = {
164
- * video: "#4B2E83",
165
- * text: "#375A7F",
166
- * image: "#805A38",
167
- * audio: "#3C665B",
168
- * // ... other element colors
169
- * };
170
- *
171
- * // Apply color to element
172
- * element.style.backgroundColor = colors[element.type];
173
- * ```
174
- */
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
+ }
175
54
  export interface ElementColors {
176
- /** Fragment element color */
177
- fragment: string;
178
- /** Video element color */
179
55
  video: string;
180
- /** Caption element color */
181
- caption: string;
182
- /** Image element color */
183
- image: string;
184
- /** Audio element color */
185
56
  audio: string;
186
- /** Text element color */
57
+ image: string;
187
58
  text: string;
188
- /** Generic element color */
189
- element: string;
190
- /** Rectangle element color */
59
+ caption: string;
60
+ icon: string;
61
+ circle: string;
191
62
  rect: string;
192
- /** Frame effect color */
63
+ element: string;
64
+ fragment: string;
193
65
  frameEffect: string;
194
- /** Filters color */
195
66
  filters: string;
196
- /** Transition color */
197
67
  transition: string;
198
- /** Animation color */
199
68
  animation: string;
200
69
  }
@@ -20,6 +20,7 @@ import { TrackElement, Track } from '@twick/timeline';
20
20
  */
21
21
  export declare const useTimelineManager: () => {
22
22
  timelineData: import('@twick/timeline/dist/services/data.service').TimelineTrackData | null;
23
+ onAddTrack: () => void;
23
24
  onElementDrag: ({ element, dragType, updates, }: {
24
25
  updates: {
25
26
  start: number;
package/dist/index.d.ts CHANGED
@@ -9,7 +9,9 @@ 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
 
14
+ export { setElementColors };
13
15
  export type { MediaItem, PaginationOptions, SearchOptions, Animation, TextEffect, ElementColors };
14
16
  export type { PlayerControlsProps, VideoEditorProps, VideoEditorConfig };
15
17
  export { ANIMATIONS, TEXT_EFFECTS };