@twick/studio 0.14.5 → 0.14.7

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 CHANGED
@@ -1,122 +1,214 @@
1
- # @twick/studio
2
-
3
- The main video editing interface for Twick, providing a professional-grade editing experience in the browser.
4
-
5
- ## Features
6
-
7
- - **Modern Interface**: Clean, intuitive dark theme design
8
- - **Media Management**: Integrated video, audio, and image library
9
- - **Text Tools**: Advanced text editing with multiple fonts and styles
10
- - **Timeline Control**: Precise timeline-based editing
11
- - **Element Library**: Rich set of editing elements (shapes, icons, etc.)
12
- - **Audio Support**: Audio track management and editing
13
- - **Effects**: Visual effects and transitions
14
-
15
- ## Installation
16
-
17
- ```bash
18
- pnpm add @twick/studio
19
- ```
20
-
21
- ## Quick Start
22
-
23
- ```tsx
24
- import { StudioProvider, VideoEditor } from '@twick/studio';
25
-
26
- function App() {
27
- return (
28
- <StudioProvider>
29
- <VideoEditor />
30
- </StudioProvider>
31
- );
32
- }
33
- ```
34
-
35
- ## Components
36
-
37
- ### VideoEditor
38
-
39
- The main editor component that combines all editing features.
40
-
41
- ```tsx
42
- <VideoEditor
43
- config={{
44
- canvas: {
45
- width: 1920,
46
- height: 1080
47
- }
48
- }}
49
- />
50
- ```
51
-
52
- ### ElementPanel
53
-
54
- Panel for managing different types of elements:
55
- - Videos
56
- - Images
57
- - Audio
58
- - Text
59
- - Icons
60
- - Shapes
61
- - Subtitles
62
-
63
- ```tsx
64
- <ElementPanel
65
- addElement={handleAddElement}
66
- />
67
- ```
68
-
69
- ### TextPanel
70
-
71
- Advanced text editing with features:
72
- - Font selection
73
- - Size control
74
- - Color picker
75
- - Shadow effects
76
- - Stroke settings
77
-
78
- ### IconPanel
79
-
80
- Icon library with features:
81
- - Search functionality
82
- - Category filtering
83
- - Color customization
84
- - Size adjustment
85
-
86
- ## Development
87
-
88
- ### Running Locally
89
-
90
- ```bash
91
- # Install dependencies
92
- pnpm install
93
-
94
- # Start development server
95
- pnpm dev
96
- ```
97
-
98
- ### Building
99
-
100
- ```bash
101
- pnpm build
102
- ```
103
-
104
- ## Browser Support
105
-
106
- Requires modern browsers with support for:
107
- - WebGL
108
- - Canvas API
109
- - Web Audio API
110
- - Modern JavaScript (ES2020+)
111
-
112
- ## License
113
-
114
- This package is licensed under the **Sustainable Use License (SUL) Version 1.0**.
115
-
116
- - Free for use in commercial and non-commercial apps
117
- - Can be modified and self-hosted
118
- - Cannot be sold, rebranded, or distributed as a standalone SDK
119
-
120
- For commercial licensing inquiries, contact: contact@kifferai.com
121
-
122
- For full license terms, see the main LICENSE.md file in the project root.
1
+ # @twick/studio
2
+
3
+ The main video editing interface for Twick, providing a professional-grade editing experience in the browser.
4
+
5
+ ## Features
6
+
7
+ - **Modern Interface**: Clean, intuitive dark theme design
8
+ - **Media Management**: Integrated video, audio, and image library
9
+ - **Text Tools**: Advanced text editing with multiple fonts and styles
10
+ - **Timeline Control**: Precise timeline-based editing
11
+ - **Element Library**: Rich set of editing elements (shapes, icons, etc.)
12
+ - **Audio Support**: Audio track management and editing
13
+ - **Effects**: Visual effects and transitions
14
+ - **Project Management**: Save, load, and export video projects
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ pnpm add @twick/timeline @twick/live-player @twick/studio
20
+ ```
21
+
22
+ ## Quick Start
23
+
24
+ ```tsx
25
+ import { LivePlayerProvider } from "@twick/live-player";
26
+ import { TwickStudio } from "@twick/studio";
27
+ import { TimelineProvider, INITIAL_TIMELINE_DATA } from "@twick/timeline";
28
+ import "@twick/studio/dist/studio.css";
29
+
30
+ export default function App() {
31
+ return (
32
+ <LivePlayerProvider>
33
+ <TimelineProvider
34
+ initialData={INITIAL_TIMELINE_DATA}
35
+ contextId={"studio-demo"}
36
+ >
37
+ <TwickStudio
38
+ studioConfig={{
39
+ videoProps: {
40
+ width: 720,
41
+ height: 1280,
42
+ },
43
+ // Optional: Customize timeline tick marks
44
+ timelineTickConfigs: [
45
+ { durationThreshold: 30, majorInterval: 5, minorTicks: 5 },
46
+ { durationThreshold: 300, majorInterval: 30, minorTicks: 6 }
47
+ ],
48
+ // Optional: Customize zoom behavior
49
+ timelineZoomConfig: {
50
+ min: 0.5, max: 2.0, step: 0.25, default: 1.0
51
+ },
52
+ // Optional: Customize element colors
53
+ elementColors: {
54
+ video: "#8B5FBF",
55
+ audio: "#3D8B8B",
56
+ image: "#D4956C",
57
+ text: "#A78EC8",
58
+ caption: "#9B8ACE",
59
+ fragment: "#1A1A1A"
60
+ }
61
+ }}
62
+ />
63
+ </TimelineProvider>
64
+ </LivePlayerProvider>
65
+ );
66
+ }
67
+ ```
68
+
69
+ ## Components
70
+
71
+ ### TwickStudio
72
+
73
+ The main studio component that provides a complete video editing interface.
74
+
75
+ ```tsx
76
+ <TwickStudio
77
+ studioConfig={{
78
+ videoProps: {
79
+ width: 1920,
80
+ height: 1080
81
+ },
82
+ // Optional: Customize timeline tick marks
83
+ timelineTickConfigs: [
84
+ { durationThreshold: 30, majorInterval: 5, minorTicks: 5 },
85
+ { durationThreshold: 300, majorInterval: 30, minorTicks: 6 }
86
+ ],
87
+ // Optional: Customize zoom behavior
88
+ timelineZoomConfig: {
89
+ min: 0.5, max: 2.0, step: 0.25, default: 1.0
90
+ },
91
+ // Optional: Customize element colors
92
+ elementColors: {
93
+ video: "#8B5FBF",
94
+ audio: "#3D8B8B",
95
+ image: "#D4956C",
96
+ text: "#A78EC8",
97
+ caption: "#9B8ACE",
98
+ fragment: "#1A1A1A"
99
+ },
100
+ saveProject: async (project, fileName) => {
101
+ // Custom save logic
102
+ return { status: true, message: "Project saved" };
103
+ },
104
+ loadProject: async () => {
105
+ // Custom load logic
106
+ return projectData;
107
+ },
108
+ exportVideo: async (project, videoSettings) => {
109
+ // Custom export logic
110
+ return { status: true, message: "Video exported" };
111
+ }
112
+ }}
113
+ />
114
+ ```
115
+
116
+ ### StudioConfig
117
+
118
+ Configuration options for the studio:
119
+
120
+ ```tsx
121
+ interface StudioConfig {
122
+ videoProps?: {
123
+ width: number;
124
+ height: number;
125
+ };
126
+ // Timeline tick configuration
127
+ timelineTickConfigs?: TimelineTickConfig[];
128
+ // Zoom configuration
129
+ timelineZoomConfig?: TimelineZoomConfig;
130
+ // Element colors
131
+ elementColors?: ElementColors;
132
+ // Project management callbacks
133
+ saveProject?: (project: ProjectJSON, fileName: string) => Promise<Result>;
134
+ loadProject?: () => Promise<ProjectJSON>;
135
+ exportVideo?: (project: ProjectJSON, videoSettings: VideoSettings) => Promise<Result>;
136
+ }
137
+
138
+ interface TimelineTickConfig {
139
+ durationThreshold: number; // Applies when duration < threshold
140
+ majorInterval: number; // Major tick interval in seconds
141
+ minorTicks: number; // Number of minor ticks between majors
142
+ }
143
+
144
+ interface TimelineZoomConfig {
145
+ min: number; // Minimum zoom level
146
+ max: number; // Maximum zoom level
147
+ step: number; // Zoom step increment/decrement
148
+ default: number; // Default zoom level
149
+ }
150
+
151
+ interface ElementColors {
152
+ video: string;
153
+ audio: string;
154
+ image: string;
155
+ text: string;
156
+ caption: string;
157
+ fragment: string;
158
+ }
159
+ ```
160
+
161
+ ### Individual Panels
162
+
163
+ The studio includes specialized panels for different element types:
164
+
165
+ - **AudioPanel**: Audio management and library
166
+ - **VideoPanel**: Video management and library
167
+ - **ImagePanel**: Image management and library
168
+ - **TextPanel**: Text editing with advanced styling
169
+ - **SubtitlesPanel**: Subtitle and caption management
170
+ - **CirclePanel**: Circle shape creation and editing
171
+ - **RectPanel**: Rectangle shape creation and editing
172
+ - **IconPanel**: Icon library with search and customization
173
+
174
+ ### Hooks
175
+
176
+ - **useStudioManager**: Hook for managing studio state, selected tools, and element manipulation
177
+
178
+ ## Development
179
+
180
+ ### Running Locally
181
+
182
+ ```bash
183
+ # Install dependencies
184
+ pnpm install
185
+
186
+ # Start development server
187
+ pnpm dev
188
+ ```
189
+
190
+ ### Building
191
+
192
+ ```bash
193
+ pnpm build
194
+ ```
195
+
196
+ ## Browser Support
197
+
198
+ Requires modern browsers with support for:
199
+ - WebGL
200
+ - Canvas API
201
+ - Web Audio API
202
+ - Modern JavaScript (ES2020+)
203
+
204
+ ## License
205
+
206
+ This package is licensed under the **Sustainable Use License (SUL) Version 1.0**.
207
+
208
+ - Free for use in commercial and non-commercial apps
209
+ - Can be modified and self-hosted
210
+ - Cannot be sold, rebranded, or distributed as a standalone SDK
211
+
212
+ For commercial licensing inquiries, contact: contact@kifferai.com
213
+
214
+ For full license terms, see the main LICENSE.md file in the project root.
@@ -1,3 +1,3 @@
1
1
  import { AudioPanelProps } from '../../types/media-panel';
2
2
 
3
- export declare const AudioPanel: ({ items, searchQuery, onSearchChange, onItemSelect, onFileUpload, acceptFileTypes, }: AudioPanelProps) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const AudioPanel: ({ items, onItemSelect, onFileUpload, acceptFileTypes, onUrlAdd, }: AudioPanelProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  import { CirclePanelState, CirclePanelActions } from '../../hooks/use-circle-panel';
2
2
 
3
3
  export type CirclePanelProps = CirclePanelState & CirclePanelActions;
4
- export declare function CirclePanel({ radius, fillColor, opacity, strokeColor, lineWidth, setRadius, setFillColor, setOpacity, setStrokeColor, setLineWidth, handleApplyChanges, }: CirclePanelProps): import("react/jsx-runtime").JSX.Element;
4
+ export declare function CirclePanel({ radius, fillColor, opacity, strokeColor, lineWidth, operation, setRadius, setFillColor, setOpacity, setStrokeColor, setLineWidth, handleApplyChanges, }: CirclePanelProps): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  import { IconPanelState, IconPanelActions } from '../../hooks/use-icon-panel';
2
2
 
3
3
  export type IconPanelProps = IconPanelState & IconPanelActions;
4
- export declare function IconPanel({ icons, loading, hasMore, totalIcons, searchQuery, handleSearch, handleSelection, handleDownloadIcon, handleLoadMore, }: IconPanelProps): import("react/jsx-runtime").JSX.Element;
4
+ export declare function IconPanel({ icons, loading, totalIcons, searchQuery, handleSearch, handleSelection, handleDownloadIcon, handleLoadMore, }: IconPanelProps): import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import { ImagePanelProps } from '../../types/media-panel';
2
2
 
3
- export declare function ImagePanel({ items, searchQuery, onSearchChange, onItemSelect, onFileUpload, acceptFileTypes, }: ImagePanelProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function ImagePanel({ items, onItemSelect, onFileUpload, acceptFileTypes, onUrlAdd, }: ImagePanelProps): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  import { RectPanelState, RectPanelActions } from '../../hooks/use-rect-panel';
2
2
 
3
3
  export type RectPanelProps = RectPanelState & RectPanelActions;
4
- export declare function RectPanel({ cornerRadius, fillColor, opacity, strokeColor, lineWidth, setCornerRadius, setFillColor, setOpacity, setStrokeColor, setLineWidth, handleApplyChanges, }: RectPanelProps): import("react/jsx-runtime").JSX.Element;
4
+ export declare function RectPanel({ cornerRadius, fillColor, opacity, strokeColor, lineWidth, operation, setCornerRadius, setFillColor, setOpacity, setStrokeColor, setLineWidth, handleApplyChanges, }: RectPanelProps): import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import { VideoPanelProps } from '../../types/media-panel';
2
2
 
3
- export declare function VideoPanel({ items, searchQuery, onSearchChange, onItemSelect, onFileUpload, acceptFileTypes, }: VideoPanelProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function VideoPanel({ items, onItemSelect, onFileUpload, acceptFileTypes, onUrlAdd, }: VideoPanelProps): import("react/jsx-runtime").JSX.Element;
@@ -4,4 +4,4 @@ export declare function PropsToolbar({ selectedElement, selectedProp, setSelecte
4
4
  selectedElement: TrackElement | null;
5
5
  selectedProp: string;
6
6
  setSelectedProp: (prop: string) => void;
7
- }): import("react/jsx-runtime").JSX.Element | null;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,9 @@
1
- declare const FileInput: ({ acceptFileTypes, onFileLoad, buttonText, id, }: {
1
+ declare const FileInput: ({ acceptFileTypes, onFileLoad, buttonText, id, className, icon, }: {
2
2
  acceptFileTypes: string[];
3
3
  onFileLoad: (content: any) => void;
4
4
  buttonText: string;
5
5
  id: string;
6
+ className?: string;
7
+ icon?: React.ReactNode;
6
8
  }) => import("react/jsx-runtime").JSX.Element;
7
9
  export default FileInput;
@@ -1,3 +1,4 @@
1
1
  export * from './color-input';
2
2
  export * from './file-input';
3
3
  export * from './media-manager';
4
+ export { default as UrlInput } from './url-input';
@@ -0,0 +1,6 @@
1
+ type MediaType = "video" | "audio" | "image";
2
+ export default function UrlInput({ type, onSubmit, }: {
3
+ type: MediaType;
4
+ onSubmit: (url: string) => void;
5
+ }): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -13,6 +13,7 @@ export interface CirclePanelState {
13
13
  opacity: number;
14
14
  strokeColor: string;
15
15
  lineWidth: number;
16
+ operation: string;
16
17
  }
17
18
  export interface CirclePanelActions {
18
19
  setRadius: (radius: number) => void;
@@ -13,6 +13,7 @@ export interface RectPanelState {
13
13
  opacity: number;
14
14
  strokeColor: string;
15
15
  lineWidth: number;
16
+ operation: string;
16
17
  }
17
18
  export interface RectPanelActions {
18
19
  setCornerRadius: (radius: number) => void;