@shotstack/shotstack-studio 1.4.0 → 1.5.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.
Files changed (56) hide show
  1. package/dist/{src/core/schemas/edit.d.ts → index.d.ts} +5528 -4061
  2. package/dist/shotstack-studio.es.js +4325 -1387
  3. package/dist/shotstack-studio.umd.js +8 -8
  4. package/package.json +5 -3
  5. package/readme.md +150 -7
  6. package/dist/src/components/canvas/index.d.ts +0 -14
  7. package/dist/src/components/canvas/players/audio-player.d.ts +0 -17
  8. package/dist/src/components/canvas/players/html-player.d.ts +0 -17
  9. package/dist/src/components/canvas/players/image-player.d.ts +0 -15
  10. package/dist/src/components/canvas/players/luma-player.d.ts +0 -18
  11. package/dist/src/components/canvas/players/player.d.ts +0 -76
  12. package/dist/src/components/canvas/players/shape-player.d.ts +0 -15
  13. package/dist/src/components/canvas/players/text-player.d.ts +0 -19
  14. package/dist/src/components/canvas/players/video-player.d.ts +0 -22
  15. package/dist/src/components/canvas/shotstack-canvas.d.ts +0 -25
  16. package/dist/src/components/canvas/system/inspector.d.ts +0 -18
  17. package/dist/src/components/canvas/text/text-cursor.d.ts +0 -47
  18. package/dist/src/components/canvas/text/text-editor.d.ts +0 -43
  19. package/dist/src/components/canvas/text/text-input-handler.d.ts +0 -54
  20. package/dist/src/core/animations/curve-interpolator.d.ts +0 -6
  21. package/dist/src/core/animations/effect-preset-builder.d.ts +0 -18
  22. package/dist/src/core/animations/keyframe-builder.d.ts +0 -12
  23. package/dist/src/core/animations/transition-preset-builder.d.ts +0 -20
  24. package/dist/src/core/commands/add-clip-command.d.ts +0 -14
  25. package/dist/src/core/commands/add-track-command.d.ts +0 -8
  26. package/dist/src/core/commands/delete-clip-command.d.ts +0 -10
  27. package/dist/src/core/commands/delete-track-command.d.ts +0 -9
  28. package/dist/src/core/commands/set-updated-clip-command.d.ts +0 -17
  29. package/dist/src/core/commands/types.d.ts +0 -25
  30. package/dist/src/core/commands/update-text-content-command.d.ts +0 -16
  31. package/dist/src/core/edit.d.ts +0 -52
  32. package/dist/src/core/events/asset-load-tracker.d.ts +0 -16
  33. package/dist/src/core/events/event-emitter.d.ts +0 -10
  34. package/dist/src/core/export/video-exporter.d.ts +0 -17
  35. package/dist/src/core/inputs/controls.d.ts +0 -11
  36. package/dist/src/core/inputs/pointer.d.ts +0 -4
  37. package/dist/src/core/layouts/geometry.d.ts +0 -8
  38. package/dist/src/core/layouts/position-builder.d.ts +0 -8
  39. package/dist/src/core/loaders/asset-loader.d.ts +0 -17
  40. package/dist/src/core/loaders/audio-load-parser.d.ts +0 -11
  41. package/dist/src/core/loaders/font-load-parser.d.ts +0 -13
  42. package/dist/src/core/schemas/asset.d.ts +0 -648
  43. package/dist/src/core/schemas/audio-asset.d.ts +0 -82
  44. package/dist/src/core/schemas/clip.d.ts +0 -1185
  45. package/dist/src/core/schemas/html-asset.d.ts +0 -27
  46. package/dist/src/core/schemas/image-asset.d.ts +0 -57
  47. package/dist/src/core/schemas/keyframe.d.ts +0 -26
  48. package/dist/src/core/schemas/luma-asset.d.ts +0 -13
  49. package/dist/src/core/schemas/shape-asset.d.ts +0 -199
  50. package/dist/src/core/schemas/text-asset.d.ts +0 -155
  51. package/dist/src/core/schemas/track.d.ts +0 -1491
  52. package/dist/src/core/schemas/video-asset.d.ts +0 -126
  53. package/dist/src/core/shared/entity.d.ts +0 -5
  54. package/dist/src/index.d.ts +0 -4
  55. package/dist/src/main.d.ts +0 -1
  56. package/dist/vite.config.d.ts +0 -2
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "cpuccino",
6
6
  "dazzatron"
7
7
  ],
8
- "version": "1.4.0",
8
+ "version": "1.5.0",
9
9
  "description": "A video editing library for creating and editing videos with Shotstack",
10
10
  "type": "module",
11
11
  "main": "dist/shotstack-studio.umd.js",
@@ -28,7 +28,7 @@
28
28
  "url": "https://github.com/shotstack/shotstack-studio-sdk"
29
29
  },
30
30
  "scripts": {
31
- "build": "vite build && tsc --emitDeclarationOnly",
31
+ "build": "vite build",
32
32
  "prepublishOnly": "npm run build"
33
33
  },
34
34
  "peerDependencies": {
@@ -46,9 +46,11 @@
46
46
  "eslint-config-prettier": "^9.1.0",
47
47
  "eslint-plugin-import": "^2.31.0",
48
48
  "typescript": "^5.6.2",
49
- "vite": "^5.4.10"
49
+ "vite": "^5.4.10",
50
+ "vite-plugin-dts": "^4.5.4"
50
51
  },
51
52
  "dependencies": {
53
+ "fast-deep-equal": "^3.1.3",
52
54
  "howler": "^2.2.4",
53
55
  "opentype.js": "^1.3.4",
54
56
  "pixi-filters": "^6.0.5",
package/readme.md CHANGED
@@ -19,7 +19,9 @@ Try Shotstack Studio in your preferred framework:
19
19
  ## Features
20
20
 
21
21
  - Create video compositions with multiple tracks and clips
22
+ - Visual timeline interface
22
23
  - WYSIWYG text editing
24
+ - Multi-track, drag-and-drop clip manipulation with snap-to-grid
23
25
  - Use in conjunction with the [Shotstack Edit API](https://shotstack.io/docs/guide/getting-started/hello-world-using-curl/) to render video
24
26
  - Export to video using browser-based FFmpeg
25
27
 
@@ -46,14 +48,13 @@ You can skip this if you're using the [Shotstack Edit API](https://shotstack.io/
46
48
  ## Quick Start
47
49
 
48
50
  ```typescript
49
- import { Edit, Canvas, Controls } from "@shotstack/shotstack-studio";
51
+ import { Edit, Canvas, Controls, Timeline } from "@shotstack/shotstack-studio";
50
52
 
51
- // 1. Retrieve an edit from a template
52
- const templateUrl = "https://shotstack-assets.s3.amazonaws.com/templates/hello-world/hello.json";
53
- const response = await fetch(templateUrl);
53
+ // 1. Load a template
54
+ const response = await fetch("https://shotstack-assets.s3.amazonaws.com/templates/hello-world/hello.json");
54
55
  const template = await response.json();
55
56
 
56
- // 2. Initialize the edit with dimensions and background color
57
+ // 2. Initialize the edit
57
58
  const edit = new Edit(template.output.size, template.timeline.background);
58
59
  await edit.load();
59
60
 
@@ -64,15 +65,20 @@ await canvas.load(); // Renders to [data-shotstack-studio] element
64
65
  // 4. Load the template
65
66
  await edit.loadEdit(template);
66
67
 
67
- // 5. Add keyboard controls
68
+ // 5. Initialize the Timeline
69
+ const timeline = new Timeline(edit, { width: 1280, height: 300 });
70
+ await timeline.load(); // Renders to [data-shotstack-timeline] element
71
+
72
+ // 6. Add keyboard controls
68
73
  const controls = new Controls(edit);
69
74
  await controls.load();
70
75
  ```
71
76
 
72
- Your HTML should include a container with the `data-shotstack-studio` attribute:
77
+ Your HTML should include containers for both the canvas and timeline:
73
78
 
74
79
  ```html
75
80
  <div data-shotstack-studio></div>
81
+ <div data-shotstack-timeline></div>
76
82
  ```
77
83
 
78
84
  ## Main Components
@@ -182,6 +188,25 @@ await controls.load();
182
188
  // Cmd/Ctrl + Shift + Z - Redo
183
189
  ```
184
190
 
191
+ ### Timeline
192
+
193
+ The Timeline class provides a visual timeline interface for editing.
194
+
195
+ ```typescript
196
+ import { Timeline } from "@shotstack/shotstack-studio";
197
+
198
+ const timeline = new Timeline(edit, { width: 1280, height: 300 });
199
+ await timeline.load();
200
+
201
+ // Timeline features:
202
+ // - Visual track and clip representation
203
+ // - Drag-and-drop clip manipulation
204
+ // - Clip resizing with edge detection
205
+ // - Playhead control for navigation
206
+ // - Snap-to-grid functionality
207
+ // - Zoom and scroll controls
208
+ ```
209
+
185
210
  ### VideoExporter
186
211
 
187
212
  The VideoExporter class exports the edit to a video file.
@@ -191,6 +216,101 @@ const exporter = new VideoExporter(edit, canvas);
191
216
  await exporter.export("my-video.mp4", 25); // filename, fps
192
217
  ```
193
218
 
219
+ ## Theming
220
+
221
+ Shotstack Studio supports theming for visual components. Currently, theming is available for the Timeline component, with Canvas theming coming in a future releases.
222
+
223
+ ### Built-in Themes
224
+
225
+ The library includes pre-designed themes that you can use immediately:
226
+
227
+ ```typescript
228
+ import { Timeline } from "@shotstack/shotstack-studio";
229
+ import darkTheme from "@shotstack/shotstack-studio/themes/dark.json";
230
+ import minimalTheme from "@shotstack/shotstack-studio/themes/minimal.json";
231
+
232
+ // Apply a theme when creating the timeline
233
+ const timeline = new Timeline(edit, { width: 1280, height: 300 }, { theme: darkTheme });
234
+ ```
235
+
236
+ ### Custom Themes
237
+
238
+ Create your own theme by defining colors and dimensions for each component:
239
+
240
+ ```typescript
241
+ const customTheme = {
242
+ timeline: {
243
+ // Main timeline colors
244
+ background: "#1e1e1e",
245
+ divider: "#1a1a1a",
246
+ playhead: "#ff4444",
247
+ snapGuide: "#888888",
248
+ dropZone: "#00ff00",
249
+ trackInsertion: "#00ff00",
250
+
251
+ // Toolbar styling
252
+ toolbar: {
253
+ background: "#1a1a1a",
254
+ surface: "#2a2a2a", // Button backgrounds
255
+ hover: "#3a3a3a", // Button hover state
256
+ active: "#007acc", // Button active state
257
+ divider: "#3a3a3a", // Separator lines
258
+ icon: "#888888", // Icon colors
259
+ text: "#ffffff", // Text color
260
+ height: 36 // Toolbar height in pixels
261
+ },
262
+
263
+ // Ruler styling
264
+ ruler: {
265
+ background: "#404040",
266
+ text: "#ffffff", // Time labels
267
+ markers: "#666666", // Time marker dots
268
+ height: 40 // Ruler height in pixels
269
+ },
270
+
271
+ // Track styling
272
+ tracks: {
273
+ surface: "#2d2d2d", // Primary track color
274
+ surfaceAlt: "#252525", // Alternating track color
275
+ border: "#3a3a3a", // Track borders
276
+ height: 60 // Track height in pixels
277
+ },
278
+
279
+ // Clip colors by asset type
280
+ clips: {
281
+ video: "#4a9eff",
282
+ audio: "#00d4aa",
283
+ image: "#f5a623",
284
+ text: "#d0021b",
285
+ shape: "#9013fe",
286
+ html: "#50e3c2",
287
+ luma: "#b8e986",
288
+ default: "#8e8e93", // Unknown asset types
289
+ selected: "#007acc", // Selection border
290
+ radius: 4 // Corner radius in pixels
291
+ }
292
+ }
293
+ // Canvas theming will be available in future releases
294
+ // canvas: { ... }
295
+ };
296
+
297
+ const timeline = new Timeline(edit, { width: 1280, height: 300 }, { theme: customTheme });
298
+ ```
299
+
300
+ ### Theme Structure
301
+
302
+ Themes are organized by component, making it intuitive to customize specific parts of the interface:
303
+
304
+ - **Timeline**: Controls the appearance of the timeline interface
305
+
306
+ - `toolbar`: Playback controls and buttons
307
+ - `ruler`: Time markers and labels
308
+ - `tracks`: Track backgrounds and borders
309
+ - `clips`: Asset-specific colors and selection states
310
+ - Global timeline properties (background, playhead, etc.)
311
+
312
+ - **Canvas** (coming soon): Will control the appearance of the video preview area
313
+
194
314
  ## Template Format
195
315
 
196
316
  Templates use a JSON format with the following structure:
@@ -338,6 +458,29 @@ Creates a new controls instance for the provided Edit.
338
458
 
339
459
  - `async load()` - Set up event listeners for keyboard controls
340
460
 
461
+ ### Timeline
462
+
463
+ The `Timeline` class provides a visual timeline interface for video editing.
464
+
465
+ ```typescript
466
+ import { Timeline } from "@shotstack/shotstack-studio";
467
+ ```
468
+
469
+ #### Constructor
470
+
471
+ ```typescript
472
+ constructor(edit: Edit, size: { width: number, height: number }, themeOptions?: TimelineThemeOptions)
473
+ ```
474
+
475
+ Creates a new timeline interface for the provided Edit.
476
+
477
+ #### Methods
478
+
479
+ - `async load()` - Initialize the timeline and add it to the DOM
480
+ - `setTheme(themeOptions: TimelineThemeOptions)` - Change the timeline theme
481
+ - `setOptions(options: Partial<TimelineOptions>)` - Update timeline options
482
+ - `dispose()` - Clean up resources and remove from DOM
483
+
341
484
  ### VideoExporter
342
485
 
343
486
  The `VideoExporter` class handles exporting the edit to mp4.
@@ -1,14 +0,0 @@
1
- export { Entity } from "@core/shared/entity";
2
- export { Player } from "./players/player";
3
- export { AudioPlayer } from "./players/audio-player";
4
- export { HtmlPlayer } from "./players/html-player";
5
- export { ImagePlayer } from "./players/image-player";
6
- export { LumaPlayer } from "./players/luma-player";
7
- export { ShapePlayer } from "./players/shape-player";
8
- export { TextPlayer } from "./players/text-player";
9
- export { VideoPlayer } from "./players/video-player";
10
- export { TextCursor } from "./text/text-cursor";
11
- export { TextEditor } from "./text/text-editor";
12
- export { TextInputHandler } from "./text/text-input-handler";
13
- export { Edit } from "@core/edit";
14
- export { Inspector } from "./system/inspector";
@@ -1,17 +0,0 @@
1
- import type { Edit } from "@core/edit";
2
- import { type Size } from "@layouts/geometry";
3
- import { type Clip } from "@schemas/clip";
4
- import { Player } from "./player";
5
- export declare class AudioPlayer extends Player {
6
- private audioResource;
7
- private isPlaying;
8
- private volumeKeyframeBuilder;
9
- private syncTimer;
10
- constructor(edit: Edit, clipConfiguration: Clip);
11
- load(): Promise<void>;
12
- update(deltaTime: number, elapsed: number): void;
13
- draw(): void;
14
- dispose(): void;
15
- getSize(): Size;
16
- getVolume(): number;
17
- }
@@ -1,17 +0,0 @@
1
- import { type Size } from "@layouts/geometry";
2
- import { type Clip } from "@schemas/clip";
3
- import type { Edit } from "core/edit";
4
- import { Player } from "./player";
5
- export declare class HtmlPlayer extends Player {
6
- private background;
7
- private text;
8
- constructor(timeline: Edit, clipConfiguration: Clip);
9
- load(): Promise<void>;
10
- update(deltaTime: number, elapsed: number): void;
11
- draw(): void;
12
- dispose(): void;
13
- getSize(): Size;
14
- protected getFitScale(): number;
15
- private parseDocument;
16
- private parseAlignment;
17
- }
@@ -1,15 +0,0 @@
1
- import type { Edit } from "@core/edit";
2
- import { type Size } from "@layouts/geometry";
3
- import { type Clip } from "@schemas/clip";
4
- import { Player } from "./player";
5
- export declare class ImagePlayer extends Player {
6
- private texture;
7
- private sprite;
8
- constructor(timeline: Edit, clipConfiguration: Clip);
9
- load(): Promise<void>;
10
- update(deltaTime: number, elapsed: number): void;
11
- draw(): void;
12
- dispose(): void;
13
- getSize(): Size;
14
- private createCroppedTexture;
15
- }
@@ -1,18 +0,0 @@
1
- import type { Edit } from "@core/edit";
2
- import { type Size } from "@layouts/geometry";
3
- import { type Clip } from "@schemas/clip";
4
- import * as pixi from "pixi.js";
5
- import { Player } from "./player";
6
- export declare class LumaPlayer extends Player {
7
- private texture;
8
- private sprite;
9
- private isPlaying;
10
- constructor(edit: Edit, clipConfiguration: Clip);
11
- load(): Promise<void>;
12
- update(deltaTime: number, elapsed: number): void;
13
- draw(): void;
14
- dispose(): void;
15
- getSize(): Size;
16
- getVolume(): number;
17
- getMask(): pixi.Sprite | null;
18
- }
@@ -1,76 +0,0 @@
1
- import { type Edit } from "@core/edit";
2
- import { type Size, type Vector } from "@layouts/geometry";
3
- import { type Clip } from "@schemas/clip";
4
- import { Entity } from "../../../core/shared/entity";
5
- /**
6
- * TODO: Move handles on UI level (screen space)
7
- * TODO: Handle overlapping frames - ex: length of a clip is 1.5s but there's an in (1s) and out (1s) transition
8
- * TODO: Scale X and Y needs to be implemented separately for getFitScale cover
9
- * TODO: Move animation effects and transitions out of player
10
- * TODO: On pointer down and custom keyframe, add a keyframe at the current time. Get current and time and push a keyframe into the state, and then reconfigure the keyframes.
11
- * TODO: Move bounding box to a separate entity
12
- */
13
- export declare abstract class Player extends Entity {
14
- private static readonly SnapThreshold;
15
- private static readonly DiscardedFrameCount;
16
- private static readonly ScaleHandleRadius;
17
- private static readonly RotationHandleRadius;
18
- private static readonly RotationHandleOffset;
19
- private static readonly OutlineWidth;
20
- private static readonly MinScale;
21
- private static readonly MaxScale;
22
- layer: number;
23
- shouldDispose: boolean;
24
- protected edit: Edit;
25
- clipConfiguration: Clip;
26
- private positionBuilder;
27
- private offsetXKeyframeBuilder?;
28
- private offsetYKeyframeBuilder?;
29
- private scaleKeyframeBuilder?;
30
- private opacityKeyframeBuilder?;
31
- private rotationKeyframeBuilder?;
32
- private outline;
33
- private topLeftScaleHandle;
34
- private topRightScaleHandle;
35
- private bottomLeftScaleHandle;
36
- private bottomRightScaleHandle;
37
- private rotationHandle;
38
- private isHovering;
39
- private isDragging;
40
- private dragOffset;
41
- private scaleDirection;
42
- private scaleStart;
43
- private scaleOffset;
44
- private isRotating;
45
- private rotationStart;
46
- private rotationOffset;
47
- private initialClipConfiguration;
48
- constructor(edit: Edit, clipConfiguration: Clip);
49
- reconfigureAfterRestore(): void;
50
- protected configureKeyframes(): void;
51
- load(): Promise<void>;
52
- update(_: number, __: number): void;
53
- draw(): void;
54
- dispose(): void;
55
- getStart(): number;
56
- getLength(): number;
57
- getEnd(): number;
58
- getPlaybackTime(): number;
59
- abstract getSize(): Size;
60
- getOpacity(): number;
61
- getPosition(): Vector;
62
- getPivot(): Vector;
63
- protected getFitScale(): number;
64
- getScale(): number;
65
- getRotation(): number;
66
- isActive(): boolean;
67
- shouldDiscardFrame(): boolean;
68
- private onPointerStart;
69
- private onPointerMove;
70
- private onPointerUp;
71
- private onPointerOver;
72
- private onPointerOut;
73
- private clipHasPresets;
74
- private clipHasKeyframes;
75
- private hasStateChanged;
76
- }
@@ -1,15 +0,0 @@
1
- import type { Edit } from "@core/edit";
2
- import { type Size } from "@layouts/geometry";
3
- import { type Clip } from "@schemas/clip";
4
- import { Player } from "./player";
5
- export declare class ShapePlayer extends Player {
6
- private shape;
7
- private shapeBackground;
8
- constructor(timeline: Edit, clipConfiguration: Clip);
9
- load(): Promise<void>;
10
- update(deltaTime: number, elapsed: number): void;
11
- draw(): void;
12
- dispose(): void;
13
- getSize(): Size;
14
- protected getFitScale(): number;
15
- }
@@ -1,19 +0,0 @@
1
- import { Player } from "@canvas/players/player";
2
- import { type Size } from "@layouts/geometry";
3
- import { type Clip } from "@schemas/clip";
4
- /**
5
- * TextPlayer renders and manages editable text elements in the canvas
6
- */
7
- export declare class TextPlayer extends Player {
8
- private background;
9
- private text;
10
- private textEditor;
11
- load(): Promise<void>;
12
- update(deltaTime: number, elapsed: number): void;
13
- dispose(): void;
14
- getSize(): Size;
15
- protected getFitScale(): number;
16
- private createTextStyle;
17
- private positionText;
18
- updateTextContent(newText: string, initialConfig: Clip): void;
19
- }
@@ -1,22 +0,0 @@
1
- import type { Edit } from "@core/edit";
2
- import { type Size } from "@layouts/geometry";
3
- import { type Clip } from "@schemas/clip";
4
- import { Player } from "./player";
5
- export declare class VideoPlayer extends Player {
6
- private texture;
7
- private sprite;
8
- private isPlaying;
9
- private volumeKeyframeBuilder;
10
- private syncTimer;
11
- constructor(edit: Edit, clipConfiguration: Clip);
12
- /**
13
- * TODO: Add support for .mov and .webm files
14
- */
15
- load(): Promise<void>;
16
- update(deltaTime: number, elapsed: number): void;
17
- draw(): void;
18
- dispose(): void;
19
- getSize(): Size;
20
- getVolume(): number;
21
- private createCroppedTexture;
22
- }
@@ -1,25 +0,0 @@
1
- import { Edit } from "@core/edit";
2
- import { type Size } from "@layouts/geometry";
3
- export declare class Canvas {
4
- private static extensionsRegistered;
5
- private readonly size;
6
- private readonly edit;
7
- private readonly inspector;
8
- private container?;
9
- private background?;
10
- private minZoom;
11
- private maxZoom;
12
- private currentZoom;
13
- constructor(size: Size, edit: Edit);
14
- load(): Promise<void>;
15
- private setupTouchHandling;
16
- centerEdit(): void;
17
- zoomToFit(): void;
18
- setZoom(zoom: number): void;
19
- private registerExtensions;
20
- private configureApplication;
21
- private onTick;
22
- private configureStage;
23
- private onClick;
24
- dispose(): void;
25
- }
@@ -1,18 +0,0 @@
1
- import { Entity } from "@core/shared/entity";
2
- export declare class Inspector extends Entity {
3
- private static readonly Width;
4
- private static readonly Height;
5
- fps: number;
6
- playbackTime: number;
7
- playbackDuration: number;
8
- isPlaying: boolean;
9
- private background;
10
- private text;
11
- constructor();
12
- load(): Promise<void>;
13
- update(_: number, __: number): void;
14
- draw(): void;
15
- dispose(): void;
16
- private getMemoryInfo;
17
- private bytesToMegabytes;
18
- }
@@ -1,47 +0,0 @@
1
- import { type Clip } from "@schemas/clip";
2
- import * as pixi from "pixi.js";
3
- type TextCursorOptions = {
4
- width?: number;
5
- color?: number;
6
- blinkInterval?: number;
7
- };
8
- export declare class TextCursor {
9
- private static readonly DEFAULT_BLINK_INTERVAL_MS;
10
- private static readonly DEFAULT_CURSOR_WIDTH_PX;
11
- private static readonly DEFAULT_CURSOR_COLOR;
12
- private cursor;
13
- private parent;
14
- private textElement;
15
- private clipConfig;
16
- private textPosition;
17
- private pixelX;
18
- private pixelY;
19
- private currentLine;
20
- private isBlinking;
21
- private blinkInterval;
22
- private blinkIntervalMs;
23
- private width;
24
- private color;
25
- private isVisible;
26
- constructor(parent: pixi.Container, textElement: pixi.Text, clipConfig: Clip, options?: TextCursorOptions);
27
- updatePosition(textPosition: number): void;
28
- setPosition(x: number, y: number): void;
29
- show(): void;
30
- hide(): void;
31
- setVisible(visible: boolean): void;
32
- startBlinking(): void;
33
- stopBlinking(): void;
34
- setBlinkInterval(intervalMs: number): void;
35
- dispose(): void;
36
- private createCursor;
37
- private validateTextPosition;
38
- private calculateAndApplyPixelPosition;
39
- private calculatePixelPositionFromText;
40
- private updateGraphicsPosition;
41
- private startBlinkingAnimation;
42
- private stopBlinkingAnimation;
43
- private measureText;
44
- isInitialized(): boolean;
45
- getState(): object;
46
- }
47
- export {};
@@ -1,43 +0,0 @@
1
- import type { TextPlayer } from "@canvas/players/text-player";
2
- import { type Clip } from "@schemas/clip";
3
- import * as pixi from "pixi.js";
4
- export declare enum HorizontalAlignment {
5
- LEFT = "left",
6
- CENTER = "center",
7
- RIGHT = "right"
8
- }
9
- export declare enum VerticalAlignment {
10
- TOP = "top",
11
- CENTER = "center",
12
- BOTTOM = "bottom"
13
- }
14
- export declare class TextEditor {
15
- private static readonly DOUBLE_CLICK_THRESHOLD_MS;
16
- private static readonly EDITING_BG_PADDING_PX;
17
- private static readonly EDITING_BG_ALPHA;
18
- private static readonly CLICK_HANDLER_DELAY_MS;
19
- private parent;
20
- private targetText;
21
- private clipConfig;
22
- private isEditing;
23
- private lastClickTime;
24
- private editingContainer;
25
- private editableText;
26
- private textCursor;
27
- private textInputHandler;
28
- private outsideClickHandler;
29
- constructor(parent: TextPlayer, targetText: pixi.Text, clipConfig: Clip);
30
- dispose(): void;
31
- private startEditing;
32
- private stopEditing;
33
- private checkForDoubleClick;
34
- private setupOutsideClickHandler;
35
- private createEditingEnvironment;
36
- private setupEditingContainer;
37
- private setupTextInputHandler;
38
- private updateTextAlignment;
39
- private calculateHorizontalPosition;
40
- private calculateVerticalPosition;
41
- private getContainerDimensions;
42
- private getAlignmentSettings;
43
- }
@@ -1,54 +0,0 @@
1
- type TextInputHandlerOptions = {
2
- initialText?: string;
3
- autoFocus?: boolean;
4
- focusDelay?: number;
5
- };
6
- type TextChangeCallback = (text: string, cursorPosition: number) => void;
7
- type KeyboardEventHandlers = {
8
- onTextInput?: TextChangeCallback;
9
- onCursorMove?: (direction: "left" | "right" | "up" | "down", event: KeyboardEvent) => void;
10
- onEnter?: (event: KeyboardEvent) => void;
11
- onEscape?: (event: KeyboardEvent) => void;
12
- onDelete?: (type: "backspace" | "delete", event: KeyboardEvent) => void;
13
- onFocus?: (event: FocusEvent) => void;
14
- onBlur?: (event: FocusEvent) => void;
15
- onTabNavigation?: (direction: "forward" | "backward") => void;
16
- onCustomKey?: (key: string, event: KeyboardEvent) => boolean;
17
- };
18
- export declare class TextInputHandler {
19
- private static readonly DEFAULT_FOCUS_DELAY_MS;
20
- private hiddenInput;
21
- private isFocused;
22
- private focusRetryCount;
23
- private maxFocusRetries;
24
- private focusDelay;
25
- private eventHandlers;
26
- private abortController;
27
- private textChangeCallback;
28
- private lastSyncedText;
29
- private isComposing;
30
- setupInput(initialText: string, options?: TextInputHandlerOptions): void;
31
- updateInputValue(text: string): void;
32
- focusInput(): void;
33
- blurInput(): void;
34
- setSelectionRange(start: number, end: number): void;
35
- getCursorPosition(): number;
36
- getValue(): string;
37
- setTextInputHandler(callback: TextChangeCallback): void;
38
- setEventHandlers(handlers: Partial<KeyboardEventHandlers>): void;
39
- isFocusedInput(): boolean;
40
- dispose(): void;
41
- private createHiddenTextarea;
42
- private setupEventListeners;
43
- private removeAllEventListeners;
44
- private handleTextInput;
45
- private handleKeyDown;
46
- private handleKeyboardShortcuts;
47
- private handleCompositionStart;
48
- private handleCompositionEnd;
49
- private handleFocus;
50
- private handleBlur;
51
- private handlePaste;
52
- private selectAll;
53
- }
54
- export {};
@@ -1,6 +0,0 @@
1
- export declare class CurveInterpolator {
2
- private curves;
3
- constructor();
4
- private initializeCurves;
5
- getValue(from: number, to: number, progress: number, easing?: string): number;
6
- }
@@ -1,18 +0,0 @@
1
- import { type Size } from "../layouts/geometry";
2
- import { type Clip } from "../schemas/clip";
3
- import { type Keyframe } from "../schemas/keyframe";
4
- export type EffectKeyframeSet = {
5
- offsetXKeyframes: Keyframe[];
6
- offsetYKeyframes: Keyframe[];
7
- opacityKeyframes: Keyframe[];
8
- scaleKeyframes: Keyframe[];
9
- rotationKeyframes: Keyframe[];
10
- };
11
- export declare class EffectPresetBuilder {
12
- private clipConfiguration;
13
- constructor(clipConfiguration: Clip);
14
- build(editSize: Size, clipSize: Size): EffectKeyframeSet;
15
- private getPresetName;
16
- private getZoomSpeed;
17
- private getSlideStart;
18
- }