@twick/video-editor 0.14.0
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/LICENSE +197 -0
- package/README.md +19 -0
- package/dist/assets/index.d.ts +19 -0
- package/dist/components/controls/control-manager.d.ts +5 -0
- package/dist/components/controls/player-controls.d.ts +20 -0
- package/dist/components/controls/seek-control.d.ts +7 -0
- package/dist/components/controls/timeline-zoom.d.ts +8 -0
- package/dist/components/controls/undo-redo-controls.d.ts +8 -0
- package/dist/components/player/player-manager.d.ts +8 -0
- package/dist/components/timeline/timeline-manager.d.ts +5 -0
- package/dist/components/timeline/timeline-view.d.ts +23 -0
- package/dist/components/track/seek-track.d.ts +10 -0
- package/dist/components/track/track-base.d.ts +21 -0
- package/dist/components/track/track-element.d.ts +21 -0
- package/dist/components/track/track-header.d.ts +13 -0
- package/dist/components/video-editor.d.ts +18 -0
- package/dist/helpers/animation-manager.d.ts +3 -0
- package/dist/helpers/constants.d.ts +54 -0
- package/dist/helpers/editor.utils.d.ts +4 -0
- package/dist/helpers/media-manager/base-media-manager.d.ts +18 -0
- package/dist/helpers/media-manager/browser-media-manager.d.ts +25 -0
- package/dist/helpers/text-effects-manager.d.ts +3 -0
- package/dist/helpers/types.d.ts +50 -0
- package/dist/hooks/use-player-control.d.ts +3 -0
- package/dist/hooks/use-player-manager.d.ts +11 -0
- package/dist/hooks/use-timeline-control.d.ts +9 -0
- package/dist/hooks/use-timeline-manager.d.ts +18 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +17900 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +17900 -0
- package/dist/index.mjs.map +1 -0
- package/dist/video-editor.css +471 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
-------------------------------------------------------------------------------
|
|
177
|
+
|
|
178
|
+
ADDITIONAL TERMS – NO RESALE / NO STANDALONE REDISTRIBUTION
|
|
179
|
+
|
|
180
|
+
The following additional terms apply to this project:
|
|
181
|
+
|
|
182
|
+
1. **No Standalone Resale or Licensing**
|
|
183
|
+
You may not sell, license, sublicense, or otherwise commercially distribute this software, or any modified version of it, as a standalone product, SDK, or developer tool/library.
|
|
184
|
+
|
|
185
|
+
2. **Permitted Commercial Use**
|
|
186
|
+
You may use this software in commercial applications, platforms, or services provided that:
|
|
187
|
+
- It is part of a larger product or service with meaningful added value.
|
|
188
|
+
- It is not positioned or marketed as a competing SDK or developer tool.
|
|
189
|
+
|
|
190
|
+
3. **Cloud Function Restrictions**
|
|
191
|
+
You may self-host the cloud function components within your application or product. However, you may not offer them as a hosted service, API, or commercial cloud product without obtaining a commercial license.
|
|
192
|
+
|
|
193
|
+
4. **Trademark and Branding Restrictions**
|
|
194
|
+
You may not use the name, logo, or branding associated with this project to market, redistribute, or promote your own products without explicit written permission.
|
|
195
|
+
|
|
196
|
+
For commercial licensing, redistribution rights, or branding permissions, please contact: [contact@kifferai.com]
|
|
197
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @twick/video-editor
|
|
2
|
+
|
|
3
|
+
A React component for video editing and timeline management
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🎥 Video preview with custom controls
|
|
8
|
+
- ⏱️ Timeline-based editing interface
|
|
9
|
+
- 📊 Multi-track timeline support
|
|
10
|
+
- 🎯 Customizable video dimensions
|
|
11
|
+
- 🔄 Drag-and-drop timeline reordering
|
|
12
|
+
- ⚡ High-performance video rendering
|
|
13
|
+
|
|
14
|
+
## Requirements
|
|
15
|
+
|
|
16
|
+
- React 18 or higher
|
|
17
|
+
- Browser environment with HTML5 Video support
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as fadeGif } from './fade.gif';
|
|
2
|
+
import { default as blurGif } from './blur.gif';
|
|
3
|
+
import { default as breatheInGif } from './breathe-in.gif';
|
|
4
|
+
import { default as breatheOutGif } from './breathe-out.gif';
|
|
5
|
+
import { default as riseDownGif } from './rise-down.gif';
|
|
6
|
+
import { default as riseUpGif } from './rise-up.gif';
|
|
7
|
+
import { default as successionGif } from './succession.gif';
|
|
8
|
+
|
|
9
|
+
export declare const animationGifs: {
|
|
10
|
+
fade: string;
|
|
11
|
+
blur: string;
|
|
12
|
+
'breathe-in': string;
|
|
13
|
+
'breathe-out': string;
|
|
14
|
+
'rise-down': string;
|
|
15
|
+
'rise-up': string;
|
|
16
|
+
succession: string;
|
|
17
|
+
};
|
|
18
|
+
export { fadeGif, blurGif, breatheInGif, breatheOutGif, riseDownGif, riseUpGif, successionGif, };
|
|
19
|
+
export declare const getAnimationGif: (name: string) => string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PLAYER_STATE } from '@twick/live-player';
|
|
3
|
+
import { TrackElement, Track } from '@twick/timeline';
|
|
4
|
+
|
|
5
|
+
interface PlayerControlsProps {
|
|
6
|
+
selectedItem: TrackElement | Track | null;
|
|
7
|
+
currentTime: number;
|
|
8
|
+
duration: number;
|
|
9
|
+
canUndo: boolean;
|
|
10
|
+
canRedo: boolean;
|
|
11
|
+
playerState: keyof typeof PLAYER_STATE;
|
|
12
|
+
togglePlayback: () => void;
|
|
13
|
+
onUndo?: () => void;
|
|
14
|
+
onRedo?: () => void;
|
|
15
|
+
onDelete?: (item: TrackElement | Track) => void;
|
|
16
|
+
onSplit?: (item: TrackElement, splitTime: number) => void;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
declare const PlayerControls: React.FC<PlayerControlsProps>;
|
|
20
|
+
export default PlayerControls;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const TimelineZoom: ({ zoomLevel, setZoomLevel, minZoom, maxZoom, zoomStep, }: {
|
|
2
|
+
zoomLevel: number;
|
|
3
|
+
setZoomLevel: (zoom: number) => void;
|
|
4
|
+
minZoom?: number;
|
|
5
|
+
maxZoom?: number;
|
|
6
|
+
zoomStep?: number;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default TimelineZoom;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type UndoRedoControlsProps = {
|
|
2
|
+
canUndo: boolean;
|
|
3
|
+
canRedo: boolean;
|
|
4
|
+
onUndo?: () => void;
|
|
5
|
+
onRedo?: () => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const UndoRedoControls: ({ canUndo, canRedo, onUndo, onRedo }: UndoRedoControlsProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Track, TrackElement } from '@twick/timeline';
|
|
2
|
+
|
|
3
|
+
declare function TimelineView({ zoomLevel, selectedItem, duration, tracks, seekTrack, onReorder, onSelectionChange, onElementDrag, }: {
|
|
4
|
+
timelineControls?: React.ReactNode;
|
|
5
|
+
zoomLevel: number;
|
|
6
|
+
duration: number;
|
|
7
|
+
tracks: Track[];
|
|
8
|
+
selectedItem: Track | TrackElement | null;
|
|
9
|
+
seekTrack?: React.ReactNode;
|
|
10
|
+
onReorder: (tracks: Track[]) => void;
|
|
11
|
+
onElementDrag: ({ element, dragType, updates, }: {
|
|
12
|
+
element: TrackElement;
|
|
13
|
+
dragType: string;
|
|
14
|
+
updates: {
|
|
15
|
+
start: number;
|
|
16
|
+
end: number;
|
|
17
|
+
};
|
|
18
|
+
}) => void;
|
|
19
|
+
onSeek: (time: number) => void;
|
|
20
|
+
onSelectionChange: (element: TrackElement | Track) => void;
|
|
21
|
+
onDeletion: (element: TrackElement | Track) => void;
|
|
22
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export default TimelineView;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
interface SeekTrackProps {
|
|
3
|
+
currentTime: number;
|
|
4
|
+
duration: number;
|
|
5
|
+
zoom?: number;
|
|
6
|
+
onSeek: (time: number) => void;
|
|
7
|
+
timelineCount?: number;
|
|
8
|
+
}
|
|
9
|
+
export default function SeekTrack({ currentTime, duration, zoom, onSeek, timelineCount, }: SeekTrackProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Track, TrackElement } from '@twick/timeline';
|
|
2
|
+
|
|
3
|
+
interface TrackBaseProps {
|
|
4
|
+
duration: number;
|
|
5
|
+
zoom: number;
|
|
6
|
+
track: Track;
|
|
7
|
+
trackWidth: number;
|
|
8
|
+
selectedItem: TrackElement | null;
|
|
9
|
+
allowOverlap?: boolean;
|
|
10
|
+
onItemSelection: (element: TrackElement) => void;
|
|
11
|
+
onDrag: ({ element, dragType, updates, }: {
|
|
12
|
+
element: TrackElement;
|
|
13
|
+
dragType: string;
|
|
14
|
+
updates: {
|
|
15
|
+
start: number;
|
|
16
|
+
end: number;
|
|
17
|
+
};
|
|
18
|
+
}) => void;
|
|
19
|
+
}
|
|
20
|
+
declare const TrackBase: ({ duration, zoom, track, trackWidth, selectedItem, onItemSelection, onDrag, allowOverlap, }: TrackBaseProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export default TrackBase;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TrackElement } from '@twick/timeline';
|
|
2
|
+
|
|
3
|
+
export declare const TrackElementView: React.FC<{
|
|
4
|
+
element: TrackElement;
|
|
5
|
+
selectedItem: TrackElement | null;
|
|
6
|
+
parentWidth: number;
|
|
7
|
+
duration: number;
|
|
8
|
+
nextStart: number;
|
|
9
|
+
prevEnd: number;
|
|
10
|
+
allowOverlap: boolean;
|
|
11
|
+
onSelection: (element: TrackElement) => void;
|
|
12
|
+
onDrag: ({ element, dragType, updates, }: {
|
|
13
|
+
element: TrackElement;
|
|
14
|
+
dragType: string;
|
|
15
|
+
updates: {
|
|
16
|
+
start: number;
|
|
17
|
+
end: number;
|
|
18
|
+
};
|
|
19
|
+
}) => void;
|
|
20
|
+
}>;
|
|
21
|
+
export default TrackElementView;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Track } from '@twick/timeline';
|
|
3
|
+
|
|
4
|
+
interface TrackHeaderProps {
|
|
5
|
+
track: Track;
|
|
6
|
+
selectedItem: Track | null;
|
|
7
|
+
onSelect: (track: Track) => void;
|
|
8
|
+
onDragStart: (e: React.DragEvent, track: Track) => void;
|
|
9
|
+
onDragOver: (e: React.DragEvent) => void;
|
|
10
|
+
onDrop: (e: React.DragEvent, track: Track) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const TrackHeader: ({ track, selectedItem, onDragStart, onDragOver, onDrop, onSelect, }: TrackHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default TrackHeader;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
interface VideoEditorProps {
|
|
4
|
+
leftPanel?: React.ReactNode;
|
|
5
|
+
rightPanel?: React.ReactNode;
|
|
6
|
+
bottomPanel?: React.ReactNode;
|
|
7
|
+
playControls?: React.ReactNode;
|
|
8
|
+
defaultPlayControls?: boolean;
|
|
9
|
+
editorConfig: {
|
|
10
|
+
videoProps: {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
canvasMode?: boolean;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
declare const VideoEditor: React.FC<VideoEditorProps>;
|
|
18
|
+
export default VideoEditor;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ElementColors } from './types';
|
|
2
|
+
|
|
3
|
+
export declare const INITIAL_TIMELINE_DATA: {
|
|
4
|
+
tracks: {
|
|
5
|
+
type: string;
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
elements: {
|
|
9
|
+
id: string;
|
|
10
|
+
trackId: string;
|
|
11
|
+
name: string;
|
|
12
|
+
type: string;
|
|
13
|
+
s: number;
|
|
14
|
+
e: number;
|
|
15
|
+
props: {
|
|
16
|
+
text: string;
|
|
17
|
+
fill: string;
|
|
18
|
+
};
|
|
19
|
+
}[];
|
|
20
|
+
}[];
|
|
21
|
+
version: number;
|
|
22
|
+
};
|
|
23
|
+
export declare const MIN_DURATION = 0.1;
|
|
24
|
+
export declare const DRAG_TYPE: {
|
|
25
|
+
START: string;
|
|
26
|
+
MOVE: string;
|
|
27
|
+
END: string;
|
|
28
|
+
};
|
|
29
|
+
export declare const DEFAULT_TIMELINE_ZOOM = 1.5;
|
|
30
|
+
export declare const DEFAULT_ELEMENT_COLORS: ElementColors;
|
|
31
|
+
export declare const AVAILABLE_TEXT_FONTS: {
|
|
32
|
+
RUBIK: string;
|
|
33
|
+
MULISH: string;
|
|
34
|
+
LUCKIEST_GUY: string;
|
|
35
|
+
PLAYFAIR_DISPLAY: string;
|
|
36
|
+
ROBOTO: string;
|
|
37
|
+
POPPINS: string;
|
|
38
|
+
BANGERS: string;
|
|
39
|
+
BIRTHSTONE: string;
|
|
40
|
+
CORINTHIA: string;
|
|
41
|
+
IMPERIAL_SCRIPT: string;
|
|
42
|
+
KUMAR_ONE_OUTLINE: string;
|
|
43
|
+
LONDRI_OUTLINE: string;
|
|
44
|
+
MARCK_SCRIPT: string;
|
|
45
|
+
MONTSERRAT: string;
|
|
46
|
+
PATTAYA: string;
|
|
47
|
+
PERALTA: string;
|
|
48
|
+
IMPACT: string;
|
|
49
|
+
LUMANOSIMO: string;
|
|
50
|
+
KAPAKANA: string;
|
|
51
|
+
HANDYRUSH: string;
|
|
52
|
+
DASHER: string;
|
|
53
|
+
BRITTANY_SIGNATURE: string;
|
|
54
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MediaItem, PaginationOptions, SearchOptions } from '../types';
|
|
2
|
+
|
|
3
|
+
declare abstract class BaseMediaManager {
|
|
4
|
+
abstract addItem(item: Omit<MediaItem, 'id'>): Promise<MediaItem>;
|
|
5
|
+
abstract addItems(items: Omit<MediaItem, 'id'>[]): Promise<MediaItem[]>;
|
|
6
|
+
abstract getItem(id: string): Promise<MediaItem | undefined>;
|
|
7
|
+
abstract getItems(options?: PaginationOptions): Promise<MediaItem[]>;
|
|
8
|
+
abstract updateItem(id: string, updates: Partial<MediaItem>): Promise<MediaItem | undefined>;
|
|
9
|
+
abstract updateItems(updates: {
|
|
10
|
+
id: string;
|
|
11
|
+
updates: Partial<MediaItem>;
|
|
12
|
+
}[]): Promise<MediaItem[]>;
|
|
13
|
+
abstract deleteItem(id: string): Promise<boolean>;
|
|
14
|
+
abstract deleteItems(ids: string[]): Promise<boolean>;
|
|
15
|
+
abstract search(options: SearchOptions): Promise<MediaItem[]>;
|
|
16
|
+
abstract getTotalCount(): Promise<number>;
|
|
17
|
+
}
|
|
18
|
+
export default BaseMediaManager;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { default as BaseMediaManager } from './base-media-manager';
|
|
2
|
+
import { MediaItem, PaginationOptions, SearchOptions } from '../types';
|
|
3
|
+
|
|
4
|
+
declare class BrowserMediaManager extends BaseMediaManager {
|
|
5
|
+
private dbName;
|
|
6
|
+
private storeName;
|
|
7
|
+
private db;
|
|
8
|
+
private initDB;
|
|
9
|
+
private getStore;
|
|
10
|
+
private convertArrayBufferToBlob;
|
|
11
|
+
addItem(item: Omit<MediaItem, 'id'>): Promise<MediaItem>;
|
|
12
|
+
addItems(items: Omit<MediaItem, 'id'>[]): Promise<MediaItem[]>;
|
|
13
|
+
getItem(id: string): Promise<MediaItem | undefined>;
|
|
14
|
+
getItems(options?: PaginationOptions): Promise<MediaItem[]>;
|
|
15
|
+
updateItem(id: string, updates: Partial<MediaItem>): Promise<MediaItem | undefined>;
|
|
16
|
+
updateItems(updates: {
|
|
17
|
+
id: string;
|
|
18
|
+
updates: Partial<MediaItem>;
|
|
19
|
+
}[]): Promise<MediaItem[]>;
|
|
20
|
+
deleteItem(id: string): Promise<boolean>;
|
|
21
|
+
deleteItems(ids: string[]): Promise<boolean>;
|
|
22
|
+
search(options: SearchOptions): Promise<MediaItem[]>;
|
|
23
|
+
getTotalCount(): Promise<number>;
|
|
24
|
+
}
|
|
25
|
+
export default BrowserMediaManager;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export type MediaItem = {
|
|
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 = {
|
|
25
|
+
name: string;
|
|
26
|
+
interval?: number;
|
|
27
|
+
animate?: "enter" | "exit" | "both";
|
|
28
|
+
mode?: "in" | "out";
|
|
29
|
+
direction?: "up" | "down" | "left" | "right" | "center";
|
|
30
|
+
options?: {
|
|
31
|
+
animate?: string[];
|
|
32
|
+
direction?: string[];
|
|
33
|
+
mode?: string[];
|
|
34
|
+
};
|
|
35
|
+
getSample: (animation?: Animation) => string;
|
|
36
|
+
};
|
|
37
|
+
export interface ElementColors {
|
|
38
|
+
fragment: string;
|
|
39
|
+
video: string;
|
|
40
|
+
caption: string;
|
|
41
|
+
image: string;
|
|
42
|
+
audio: string;
|
|
43
|
+
text: string;
|
|
44
|
+
element: string;
|
|
45
|
+
rect: string;
|
|
46
|
+
frameEffect: string;
|
|
47
|
+
filters: string;
|
|
48
|
+
transition: string;
|
|
49
|
+
animation: string;
|
|
50
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TrackElement, Track } from '@twick/timeline';
|
|
2
|
+
|
|
3
|
+
declare const useTimelineControl: () => {
|
|
4
|
+
splitElement: (element: TrackElement, currentTime: number) => void;
|
|
5
|
+
deleteItem: (item: Track | TrackElement) => void;
|
|
6
|
+
handleUndo: () => void;
|
|
7
|
+
handleRedo: () => void;
|
|
8
|
+
};
|
|
9
|
+
export default useTimelineControl;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TrackElement, Track } from '@twick/timeline';
|
|
2
|
+
|
|
3
|
+
export declare const useTimelineManager: () => {
|
|
4
|
+
timelineData: import('@twick/timeline/dist/services/data.service').TimelineTrackData | null;
|
|
5
|
+
onElementDrag: ({ element, dragType, updates, }: {
|
|
6
|
+
updates: {
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
};
|
|
10
|
+
element: TrackElement;
|
|
11
|
+
dragType: string;
|
|
12
|
+
}) => void;
|
|
13
|
+
onReorder: (reorderedItems: Track[]) => void;
|
|
14
|
+
onSeek: (time: number) => void;
|
|
15
|
+
onSelectionChange: (selectedItem: TrackElement | Track | null) => void;
|
|
16
|
+
selectedItem: TrackElement | Track | null;
|
|
17
|
+
totalDuration: number;
|
|
18
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as VideoEditor } from './components/video-editor';
|
|
2
|
+
import { default as PlayerControls } from './components/controls/player-controls';
|
|
3
|
+
import { default as TimelineManager } from './components/timeline/timeline-manager';
|
|
4
|
+
import { usePlayerControl } from './hooks/use-player-control';
|
|
5
|
+
import { default as BrowserMediaManager } from './helpers/media-manager/browser-media-manager';
|
|
6
|
+
import { MediaItem, PaginationOptions, SearchOptions, Animation } from './helpers/types';
|
|
7
|
+
import { default as BaseMediaManager } from './helpers/media-manager/base-media-manager';
|
|
8
|
+
import { animationGifs, getAnimationGif } from './assets';
|
|
9
|
+
import { ANIMATIONS } from './helpers/animation-manager';
|
|
10
|
+
import { TEXT_EFFECTS } from './helpers/text-effects-manager';
|
|
11
|
+
import { default as useTimelineControl } from './hooks/use-timeline-control';
|
|
12
|
+
|
|
13
|
+
export type { MediaItem, PaginationOptions, SearchOptions, Animation };
|
|
14
|
+
export { ANIMATIONS, TEXT_EFFECTS };
|
|
15
|
+
export { usePlayerControl, BrowserMediaManager, BaseMediaManager, animationGifs, getAnimationGif, PlayerControls, TimelineManager, useTimelineControl };
|
|
16
|
+
export * from './helpers/constants';
|
|
17
|
+
export default VideoEditor;
|